diff --git a/.agent/skills/basalt-html/parts/diagram.css b/.agent/skills/basalt-html/parts/diagram.css index 9258fd2..abece83 100644 --- a/.agent/skills/basalt-html/parts/diagram.css +++ b/.agent/skills/basalt-html/parts/diagram.css @@ -1 +1 @@ -:root{--basalt-size-diagram-node: 144px;--basalt-size-diagram-table: 224px;--basalt-size-diagram-lane: 120px;--basalt-size-diagram-step: 56px;--basalt-size-diagram-head: 8px;--basalt-size-diagram-activation: 8px;--basalt-size-diagram-foot: 14px;--basalt-size-diagram-guide-dash: 4px;--basalt-size-diagram-bead: 24px;--basalt-size-diagram-flow: 12px}:root,[data-theme=light],.light{--basalt-diagram-edge-main: var(--basalt-text-primary);--basalt-diagram-edge: var(--basalt-text-secondary);--basalt-diagram-edge-dim: var(--basalt-border-input);--basalt-diagram-structure: var(--basalt-border-input);--basalt-diagram-focal: var(--basalt-action-primary);--basalt-diagram-focal-ink: var(--basalt-action-primary-text);--basalt-diagram-focal-rule: var(--basalt-white-6);--basalt-diagram-focal-rule-contrast: var(--basalt-white-38);--basalt-diagram-hit: var(--basalt-text-secondary);--basalt-diagram-focal-hit: var(--basalt-action-primary-hover)}[data-theme=dark],.dark{--basalt-diagram-edge-main: var(--basalt-text-primary);--basalt-diagram-edge: var(--basalt-text-secondary);--basalt-diagram-edge-dim: var(--basalt-border-input);--basalt-diagram-structure: var(--basalt-border-input);--basalt-diagram-focal: var(--basalt-action-primary);--basalt-diagram-focal-ink: var(--basalt-action-primary-text);--basalt-diagram-focal-rule: var(--basalt-black-8);--basalt-diagram-focal-rule-contrast: var(--basalt-black-45);--basalt-diagram-hit: var(--basalt-text-secondary);--basalt-diagram-focal-hit: var(--basalt-action-primary-hover)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--basalt-diagram-focal-rule: var(--basalt-black-8);--basalt-diagram-focal-rule-contrast: var(--basalt-black-45)}}@media(prefers-contrast:more){:root,[data-theme=light],[data-theme=dark],.light,.dark,:root:not([data-theme=light]):not(.light){--basalt-diagram-focal-rule: var(--basalt-diagram-focal-rule-contrast);--basalt-diagram-hit: var(--basalt-text-primary)}}@layer basalt{.diagram{--_ground: var(--panel-bg, var(--basalt-surface-page));container-type:inline-size;display:flex;flex-direction:column;gap:var(--basalt-space-4);width:100%;min-width:0;margin:0;font-family:var(--basalt-font-family-sans)}.diagram[hidden]{display:none}.diagram-head{display:flex;flex-direction:column;gap:var(--basalt-space-0-5);min-width:0}.diagram-title{margin:0;color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-md);letter-spacing:var(--basalt-text-md-tracking)}.diagram-source{margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-drawing{--_D: initial;--_Display: var(--_D) grid;--_Max: var(--_D) none;--_Cols: var(--_D) repeat(var(--_cols, 1), minmax(0, 1fr));--_Gap: var(--_D) var(--_row-gap) var(--_col-gap);--_Pad: var(--_D) var(--_gpad, 0);--_row-gap: var(--basalt-space-12);--_col-gap: var(--basalt-space-16);position:relative;box-sizing:border-box;display:var(--_Display, flex);flex-direction:column;grid-template-columns:var(--_Cols, none);gap:var(--_Gap, 0);width:100%;max-width:var(--_Max, var(--basalt-size-breakpoint-container));min-width:0;padding:var(--_Pad, 0 var(--_gutter, 0) 0 0)}.diagram[data-layout=drawn]>.diagram-drawing{--_D: }.diagram[data-layout=stacked]>.diagram-drawing{--_D: initial}.diagram[data-gutter]>.diagram-drawing{--_gutter: var(--_gw, var(--basalt-space-10))}.diagram[data-type=data-flow]>.diagram-drawing{--_Cols: var(--_D) var(--basalt-size-diagram-lane) repeat(var(--_cols, 1), minmax(0, 1fr));--_row-gap: var(--basalt-space-10);--_col-gap: var(--basalt-space-12)}.diagram[data-type=schema]>.diagram-drawing{--_row-gap: var(--basalt-space-8);--_col-gap: var(--basalt-space-12);--_Rows: var(--_D) var(--_rows, none);display:grid;grid-template-columns:var(--_Cols, repeat(auto-fit, minmax(min(100%, var(--_track, var(--basalt-size-diagram-table))), 1fr)));grid-template-rows:var(--_Rows, none);gap:var(--_Gap, var(--basalt-space-4));align-items:start;max-width:none}.diagram[data-type=schema][data-marks]>.diagram-drawing{--_col-gap: calc(var(--basalt-space-12) + var(--basalt-space-3))}.diagram[data-type=sequence]>.diagram-drawing{display:flex;gap:0}.diagram[data-rtl]>.diagram-drawing{direction:ltr}.diagram[data-rtl]>.diagram-drawing :is(.diagram-node>:not(.diagram-mark),.diagram-lane-name,.diagram-said,.diagram-note,.diagram-band,.diagram-fhead,.diagram-felse){direction:rtl}.diagram[data-rtl] .diagram-gbox>.diagram-glabel{inset-inline:auto var(--basalt-space-3)}.diagram[data-rtl] .diagram-group>.diagram-glabel{inset-inline:auto var(--basalt-space-3);margin-inline:0 calc(-1 * var(--basalt-space-1-5))}.diagram[data-rtl] .diagram-runs{direction:ltr;unicode-bidi:isolate}.diagram[data-rtl] .diagram-fhead{inset-inline-start:calc(100% - var(--_fl) - var(--_fw) + var(--basalt-size-hairline))}.diagram[data-rtl] .diagram-felse{padding-inline-start:calc(100% - var(--_fl) - var(--_fw) + var(--basalt-space-3))}.diagram[data-rtl] .diagram-felse:before{inset-inline-start:var(--_Fer, calc(-1 * var(--basalt-space-4)))}.diagram[data-rtl] .diagram-msg[data-self=end] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) left;margin-inline-start:0;margin-inline-end:var(--_Sm, 0)}.diagram[data-rtl] .diagram-msg[data-self=start] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) right;margin-inline-end:0;margin-inline-start:var(--_Sm, 0)}.diagram[data-rtl] :is(.diagram-run,.diagram-mlabel,.diagram-tname,.diagram-cname,.diagram-ctype,.diagram-label,.diagram-glabel,.diagram-kind){unicode-bidi:isolate}.diagram[data-rtl] :is(.diagram-run,.diagram-mlabel,.diagram-cname,.diagram-label){direction:ltr}.diagram[data-rtl] .diagram-arrow{scale:-1 1}.diagram-node{--_Gc: var(--_D) var(--_c);--_Gr: var(--_D) var(--_r) / var(--_r2);--_Mt: var(--_D) 0;--_Align: var(--_D) center;position:relative;z-index:1;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;grid-column:var(--_Gc, auto);grid-row:var(--_Gr, auto);align-self:var(--_Align, stretch);margin-block-start:var(--_Mt, var(--_gap, 0));padding:var(--basalt-space-2-5) var(--basalt-space-3);background:var(--panel-next, var(--basalt-surface-1));border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);color:var(--basalt-text-primary);overflow-wrap:break-word;outline:none;transition:border-color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram[data-type=data-flow] .diagram-node{--_Gc: var(--_D) var(--_lc)}.diagram-node{--_Mh: var(--_D) var(--_mh, auto);min-height:var(--_Mh, auto)}.diagram-node{--_Jc: var(--_D) normal;justify-content:var(--_Jc, center)}.diagram-node[data-branch]{--_Mi: var(--_D) 0;margin-inline:var(--_Mi, var(--basalt-space-12) var(--basalt-space-6))}.diagram-node:focus-visible{z-index:2;outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.diagram-node[data-near]{border-color:var(--basalt-border-hover)}.diagram-kind{color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-lane-word{--_Lw: var(--_D) none;display:var(--_Lw, inline)}.diagram-name{color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-detail{margin-block-start:var(--basalt-space-0-5);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-detail[data-mono]{font-family:var(--basalt-font-family-mono)}.diagram-run{display:inline-block;max-width:100%}:root,[data-theme=light],.light{--_dkm: initial}[data-theme=dark],.dark{--_dkm: }@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--_dkm: }}.diagram-mark{--_mf: var(--_dkm) var(--_md);position:absolute;inset-block-start:var(--basalt-space-2-5);inset-inline-end:var(--basalt-space-3);width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);background:var(--_mf, var(--_ml)) center / contain no-repeat;pointer-events:none}.diagram-node[data-focal]>.diagram-mark{--_mf: var(--_dkm) var(--_ml);background-image:var(--_mf, var(--_md, var(--_ml)))}.diagram-node[data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline-end:var(--basalt-space-6)}.diagram-node[data-shape=participant][data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline:var(--basalt-space-6)}.diagram-node[data-shape=participant]>.diagram-mark{--_Pmp: var(--_D) absolute;position:var(--_Pmp, static);flex:none;margin-inline-end:var(--_Pmm, var(--basalt-space-1-5));--_Pmm: var(--_D) 0}.diagram-node[data-shape=participant][data-mark]{--_Pfd: var(--_D) column;flex-direction:var(--_Pfd, row)}.diagram-node[data-shape=participant][data-mark]>.diagram-mark+.diagram-name{--_Pnp: var(--_D) var(--basalt-space-6);padding-inline:var(--_Pnp, 0)}.diagram-node[data-focal]{background:var(--basalt-diagram-focal);border-color:var(--basalt-diagram-focal)}.diagram-node[data-focal] :is(.diagram-name,.diagram-kind,.diagram-detail,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more){color:var(--basalt-diagram-focal-ink)}.diagram-node[data-focal] :is(.diagram-kind,.diagram-detail,.diagram-keyseat,.diagram-ctype,.diagram-more){opacity:var(--basalt-opacity-amount)}.diagram[data-type=flowchart] .diagram-node:not([data-focal]){border-color:var(--basalt-diagram-structure)}.diagram[data-type=flowchart] .diagram-node:not([data-focal],[data-shape=decision])[data-near]{border-color:var(--basalt-text-secondary)}.diagram-node[data-shape=terminal]{align-items:center;padding-inline:var(--basalt-space-5);border-radius:var(--basalt-radius-full);text-align:center}.diagram-node[data-shape=decision]{justify-content:center;align-items:center;height:var(--_h, auto);min-height:var(--basalt-space-16);padding:var(--basalt-space-2) var(--basalt-space-2-5);text-align:center}.diagram-words{position:relative;max-width:var(--_ww, calc(62% + (var(--basalt-space-2-5) + var(--basalt-size-hairline)) * 1.24))}.diagram-node[data-shape=decision] .diagram-name{font-weight:var(--basalt-font-weight-medium);text-wrap:balance}.diagram-diamond{display:none;position:absolute;inset:0;width:100%;height:100%;overflow:visible}.diagram-diamond path{fill:var(--panel-next, var(--basalt-surface-1));stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);vector-effect:non-scaling-stroke;transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram[data-measured] .diagram-node[data-shape=decision]{background:none;border-color:transparent}.diagram[data-measured] .diagram-node[data-shape=decision] .diagram-diamond{display:block}.diagram-node[data-shape=decision][data-near] .diagram-diamond path{stroke:var(--basalt-text-secondary)}.diagram-node[data-shape=decision][data-focal] .diagram-diamond path{fill:var(--basalt-diagram-focal);stroke:var(--basalt-diagram-focal)}.diagram-node[data-link]{color:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent}.diagram-name-end{white-space:nowrap}.diagram-node[data-link] .diagram-name-end:after{content:"";display:inline-block;width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);margin-inline-start:var(--basalt-space-1-5);vertical-align:calc(-1 * var(--basalt-space-0-5));background:var(--basalt-text-secondary);mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12L17.5 12M17.5 12L11.5 7M17.5 12L11.5 17' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;transition:transform var(--basalt-duration-base) var(--basalt-ease-out),background-color var(--basalt-duration-base) var(--basalt-ease-out)}.diagram-node[data-link=external] .diagram-name-end:after{mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 17L17 7M9.5 7L17 7M17 7L17 14.5' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}.diagram-node[data-link][data-focal] .diagram-name-end:after{background:var(--basalt-diagram-focal-ink);opacity:var(--basalt-opacity-amount)}.diagram-node[data-link]:is(:hover,:focus-visible) .diagram-name-end:after{background:var(--basalt-text-primary);transform:translate(var(--basalt-space-0-5))}.diagram-node[data-link][data-focal]:is(:hover,:focus-visible) .diagram-name-end:after{background:var(--basalt-diagram-focal-ink);opacity:1}.diagram-node[data-link]:is(:hover,:focus-visible) :is(.diagram-name,.diagram-tname){text-decoration:underline var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset)}.diagram-node[data-link]:active{background:light-dark(color-mix(in srgb,var(--basalt-neutral-0) 4%,var(--panel-next, var(--basalt-surface-1))),color-mix(in srgb,var(--basalt-neutral-100) 6%,var(--panel-next, var(--basalt-surface-1))))}@supports not (color: light-dark(white,black)){.diagram-node[data-link]:active{background:color-mix(in srgb,color-mix(in srgb,var(--basalt-neutral-100) 6%,var(--panel-next, var(--basalt-surface-1))) var(--_dkp),color-mix(in srgb,var(--basalt-neutral-0) 4%,var(--panel-next, var(--basalt-surface-1))))}}.diagram-node[data-link][data-focal]:active{background:var(--basalt-action-primary-press)}.diagram-node[data-link]:dir(rtl) .diagram-name-end:after{scale:-1 1}.diagram-node[data-link]:dir(rtl):is(:hover,:focus-visible) .diagram-name-end:after{transform:translate(calc(-1 * var(--basalt-space-0-5)))}@media(prefers-reduced-motion:reduce){.diagram-node[data-link]:is(:hover,:focus-visible) .diagram-name-end:after,.diagram-node[data-link]:dir(rtl):is(:hover,:focus-visible) .diagram-name-end:after{transform:none}}@media(pointer:coarse){.diagram-node[data-link]{min-height:var(--basalt-size-tap-min)}}@media(forced-colors:active){.diagram .diagram-node[data-link] :is(.diagram-name,.diagram-tname){color:LinkText;text-decoration:underline}.diagram .diagram-node[data-link] .diagram-name-end:after{forced-color-adjust:none;background:LinkText}.diagram .diagram-node[data-link][data-focal] :is(.diagram-name,.diagram-tname){color:Canvas}.diagram .diagram-node[data-link][data-focal] .diagram-name-end:after{background:Canvas}}.diagram-group{--_Gd: var(--_D) contents;position:relative;box-sizing:border-box;display:var(--_Gd, flex);flex-direction:column;margin-block-start:calc(var(--basalt-space-12) + var(--basalt-space-4) * var(--_ggrow, 0));padding:var(--basalt-space-8) var(--basalt-space-3) var(--basalt-space-3-5);border:var(--basalt-size-hairline) dashed var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg)}.diagram-group{--_tl: 0}.diagram-group:first-child{margin-block-start:0}.diagram-group[data-turn]{padding-block-start:calc(var(--basalt-space-12) + var(--basalt-space-4) * var(--_tl, 0))}.diagram-group>.diagram-glabel+.diagram-node{--_Mt: 0}.diagram-glabel{position:absolute;top:var(--basalt-space-2);inset-inline-start:var(--basalt-space-3);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono);white-space:nowrap}.diagram-group>.diagram-glabel{--_Gl: var(--_D) none;display:var(--_Gl, block)}.diagram-group>.diagram-glabel{z-index:1;margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground)}.diagram-gbox{--_Gb: var(--_D) block;position:relative;display:var(--_Gb, none);grid-column:var(--_c) / var(--_c2);grid-row:var(--_r) / var(--_r2);margin-block:calc(-1 * var(--_gt, 1) * var(--basalt-space-8)) calc(-1 * var(--_gb, 1) * var(--basalt-space-4));margin-inline:calc(-1 * var(--_gs, 1) * var(--basalt-space-4)) calc(-1 * var(--_ge, 1) * var(--basalt-space-4));border:var(--basalt-size-hairline) dashed var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg);pointer-events:none}.diagram-gbox[data-depth="2"],.diagram-group[data-depth="2"]{border-radius:var(--basalt-radius-md)}.diagram-list-group[data-depth="2"],.diagram-list-items[data-depth="2"]{margin-inline-start:var(--basalt-space-5)}.diagram-lane{--_Ln: var(--_D) flex;position:relative;display:var(--_Ln, none);grid-column:1 / -1;grid-row:var(--_r);align-items:center;pointer-events:none}.diagram-lane+.diagram-lane:before{content:"";position:absolute;inset-inline:0;top:calc(-1 * var(--basalt-space-5));border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-lane-name{box-sizing:border-box;width:var(--basalt-size-diagram-lane);padding-inline-end:var(--basalt-space-3);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-ink{position:absolute;inset:0;z-index:0;pointer-events:none}.diagram[data-type=sequence]>.diagram-drawing>.diagram-ink{z-index:auto}.diagram-lifes{position:absolute;top:0;left:0;z-index:0;overflow:visible}.diagram[data-type=sequence] .diagram-ink>.diagram-svg{z-index:2}.diagram[data-type=sequence] .diagram-steps{z-index:auto}.diagram[data-type=sequence] .diagram-msg :is(.diagram-said,.diagram-note){position:relative;z-index:3}.diagram[data-type=sequence] :is(.diagram-fhead,.diagram-felse){z-index:3}.diagram-svg{position:absolute;top:0;left:0;overflow:visible}.diagram-ruler{position:absolute;visibility:hidden;white-space:pre;pointer-events:none}.diagram-ruler[data-f=name]{font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-ruler[data-f=name-500]{font:var(--basalt-font-weight-medium) var(--bh-sm)}.diagram-ruler[data-f=table]{font:var(--basalt-font-weight-semibold) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-ruler:is([data-f=mono],[data-f=label]){font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-ruler[data-f=sans]{font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-line{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-line[data-kind=main]{stroke:var(--basalt-diagram-edge-main);stroke-width:var(--basalt-size-chart-line)}.diagram-line[data-kind=dashed]{stroke-dasharray:var(--basalt-size-chart-dash) var(--basalt-size-chart-dash-gap);stroke-linecap:butt}.diagram-tip{fill:var(--basalt-diagram-edge);transition:fill var(--basalt-duration-fast) var(--basalt-ease-out),stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-tip[data-kind=main]{fill:var(--basalt-diagram-edge-main)}.diagram-tip[data-open]{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);stroke-linecap:round;stroke-linejoin:round}.diagram-dot{fill:var(--basalt-diagram-edge)}.diagram-crow{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);stroke-linecap:butt;stroke-linejoin:miter;transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-ring{fill:var(--_ground);stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-life{fill:none;stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);stroke-dasharray:var(--basalt-size-diagram-guide-dash) var(--basalt-size-diagram-guide-dash)}.diagram-edge[data-lit] .diagram-line{stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-lit] .diagram-tip:not([data-open]),.diagram-edge[data-lit] .diagram-dot{fill:var(--basalt-diagram-edge-main)}.diagram-edge[data-lit] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-dim] .diagram-line{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-dim] .diagram-tip:not([data-open]),.diagram-edge[data-dim] .diagram-dot{fill:var(--basalt-diagram-edge-dim)}.diagram-edge[data-dim] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-lit] :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-dim] :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge-dim)}.diagram-label{position:absolute;box-sizing:border-box;height:var(--basalt-text-xs-line-height);color:var(--basalt-diagram-edge);font:var(--basalt-font-weight-regular) var(--bh-xs-mono);text-align:center;white-space:nowrap;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-label[data-on]{background:var(--_ground)}.diagram-label[data-lines="2"]{height:calc(2 * var(--basalt-text-xs-line-height))}.diagram-label[data-lit]{color:var(--basalt-diagram-edge-main)}.diagram-cast{--_Cd: var(--_D) grid;display:var(--_Cd, flex);flex-wrap:wrap;grid-template-columns:repeat(var(--_cols, 1),minmax(0,1fr));gap:var(--_Cast-gap, var(--basalt-space-1-5));--_Cast-gap: var(--_D) var(--basalt-space-5);margin:0;padding:0;list-style:none}.diagram-actor{--_Ac: var(--_D) var(--_ac, auto);display:flex;min-width:0;grid-column:var(--_Ac, auto);grid-row:1}.diagram-node[data-shape=participant]{--_Pd: var(--_D) var(--basalt-space-2-5) var(--basalt-space-3);--_Pr: var(--_D) var(--basalt-radius-md);--_Pa: var(--_D) center;flex:var(--_Pflex, none);--_Pflex: var(--_D) 1;align-items:center;justify-content:var(--_Pa, center);min-height:var(--_Ph, var(--basalt-size-badge));--_Ph: var(--_D) 0;padding:var(--_Pd, 0 calc(var(--basalt-space-2) - var(--basalt-size-hairline)));border-radius:var(--_Pr, var(--basalt-radius-xs));text-align:center}.diagram-node[data-shape=participant]:not([data-focal]){--_Pbg: var(--_D) var(--panel-next, var(--basalt-surface-1));--_Pbc: var(--_D) var(--basalt-border-rim);--_Pbt: var(--_D) var(--basalt-border-rim-top);background:var(--_Pbg, none);border-color:var(--_Pbc, var(--basalt-border-hairline));border-top-color:var(--_Pbt, var(--basalt-border-hairline))}.diagram-node[data-shape=participant] .diagram-kind{--_Pk: var(--_D) block;display:var(--_Pk, none)}.diagram-node[data-shape=participant] .diagram-name{font-size:var(--_Pn, var(--basalt-text-xs-size));line-height:var(--_Pnl, var(--basalt-text-xs-line-height));font-weight:var(--_Pw, var(--basalt-font-weight-medium));--_Pn: var(--_D) var(--basalt-text-sm-size);--_Pnl: var(--_D) var(--basalt-text-sm-line-height);--_Pw: var(--_D) var(--basalt-font-weight-semibold)}.diagram-steps{--_Sp: var(--_D) var(--basalt-space-4);position:relative;z-index:1;padding-block-start:var(--_Sp, var(--basalt-space-4))}.diagram-msgs{margin:0;padding:0;list-style:none}.diagram-msg{--_Md: var(--_D) grid;--_Mc: var(--_D) repeat(var(--_cols, 1), minmax(0, 1fr));--_Mr: var(--_D) 1fr 1fr;--_Mh: var(--_D) var(--basalt-size-diagram-step);--_Mg: var(--_D) 0 var(--basalt-space-5);display:grid;grid-template-columns:var(--_Mc, var(--basalt-space-8) minmax(0, 1fr));grid-template-rows:var(--_Mr, auto);column-gap:var(--basalt-space-5);gap:var(--_Mg, 0);height:var(--_Mh, auto);padding-block:var(--_Mpb, var(--basalt-space-2-5));--_Mpb: var(--_D) 0;border-top:var(--_Mb, var(--basalt-size-hairline) solid var(--basalt-border-divider));--_Mb: var(--_D) 0;font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-frame+.diagram-msgs>.diagram-msg:first-child{border-top-color:transparent}.diagram-said{--_Sd: var(--_D) block;display:var(--_Sd, contents);grid-column:var(--_a) / var(--_b);grid-row:1;align-self:end;justify-self:center;margin-block-end:calc(var(--basalt-space-1) + var(--basalt-size-hairline));padding-inline:var(--basalt-space-1-5);background:var(--_ground);white-space:nowrap}.diagram-num{grid-column:1;color:var(--basalt-text-tertiary);font-variant-numeric:tabular-nums}.diagram-said .diagram-num{margin-inline-end:var(--_Nm, 0);--_Nm: var(--_D) var(--basalt-space-1-5)}.diagram-mlabel{grid-column:2;color:var(--basalt-text-primary);font-family:var(--basalt-font-family-mono)}.diagram-route{--_Rd: var(--_D) none;display:var(--_Rd, inline-flex);grid-column:2;align-items:center;column-gap:var(--basalt-space-1);row-gap:0;flex-wrap:wrap;color:var(--basalt-text-secondary)}.diagram-to{display:inline-flex;align-items:center;gap:var(--basalt-space-1);white-space:nowrap}.diagram-note{--_Nd: var(--_D) 2;grid-column:var(--_Nc, 2);--_Nc: var(--_D) var(--_a) / var(--_b);grid-row:var(--_Nd, auto);align-self:start;justify-self:var(--_Nj, stretch);--_Nj: var(--_D) center;margin-block-start:var(--_Nmt, 0);--_Nmt: var(--_D) calc(var(--basalt-space-1) + var(--basalt-size-hairline));padding-inline:var(--_Npi, 0);--_Npi: var(--_D) var(--basalt-space-1-5);background:var(--_Nbg, none);--_Nbg: var(--_D) var(--_ground);color:var(--basalt-text-tertiary);white-space:var(--_Nws, normal);--_Nws: var(--_D) nowrap}.diagram-msg[data-self=end] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) start;justify-self:var(--_Sj, stretch);--_Sm: var(--_D) calc(50% + var(--basalt-space-6) + var(--basalt-space-1));margin-inline-start:var(--_Sm, 0)}.diagram-msg[data-self=start] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) end;justify-self:var(--_Sj, stretch);--_Sm: var(--_D) calc(50% + var(--basalt-space-6) + var(--basalt-space-1));margin-inline-end:var(--_Sm, 0)}.diagram-arrow{flex:none;overflow:visible}.diagram-bar{fill:var(--panel-next, var(--basalt-surface-1));stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);rx:var(--basalt-radius-2xs)}.diagram-frame{--_Fpi: var(--_D) 0;--_cw: calc((100% - (var(--_cols, 1) - 1) * var(--basalt-space-5)) / var(--_cols, 1));--_Fl: var(--_D) calc((var(--_a) - 1) * (var(--_cw) + var(--basalt-space-5)) + var(--_fis, 0) * var(--basalt-space-2));--_Fw: var(--_D) calc((var(--_b) - var(--_a)) * (var(--_cw) + var(--basalt-space-5)) - var(--basalt-space-5) - (var(--_fis, 0) + var(--_fie, 0)) * var(--basalt-space-2));--_fl: var(--_Fl, 0%);--_fw: var(--_Fw, 100%);--_Fel: var(--_D) var(--_fl);--_Few: var(--_D) var(--_fw);--_Fer: var(--_D) calc(100% - var(--_fl) - var(--_fw));position:relative;padding-block:var(--basalt-size-control-lg) var(--basalt-space-2);padding-inline:var(--_Fpi, var(--basalt-space-4))}.diagram-frame+.diagram-frame{margin-block-start:var(--basalt-space-2)}.diagram-frame[data-depth="2"]{--_Fl: var(--_D) calc((var(--_a) - 1) * (var(--_cw) + var(--basalt-space-5)) + var(--_fis, 0) * var(--basalt-space-2))}.diagram-fbox{position:absolute;inset-block:0;inset-inline-start:var(--_fl);z-index:1;box-sizing:border-box;width:var(--_fw);border:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg);pointer-events:none}.diagram-frame[data-depth="2"]>.diagram-fbox{border-radius:var(--basalt-radius-xs)}.diagram-fhead{position:absolute;top:var(--basalt-size-hairline);inset-inline-start:calc(var(--_fl) + var(--basalt-size-hairline));display:flex;align-items:flex-start;gap:var(--basalt-space-3);margin:0;white-space:nowrap}.diagram-ftab{padding:var(--basalt-space-1) var(--basalt-space-3);border-inline-end:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-block-end:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-end-end-radius:var(--basalt-radius-xs);background:var(--_ground);color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-xs-mono)}.diagram-flabel{margin-block-start:var(--basalt-space-1);margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-felse{position:relative;display:flex;align-items:center;gap:var(--basalt-space-1-5);height:var(--basalt-size-control-sm);margin:0;padding-inline-start:calc(var(--_fl) + var(--basalt-space-3));white-space:nowrap}.diagram-felse:before{content:"";position:absolute;top:0;inset-inline-start:var(--_Fel, calc(-1 * var(--basalt-space-4)));width:var(--_Few, calc(100% + 2 * var(--basalt-space-4)));height:var(--basalt-size-hairline);background:var(--basalt-diagram-structure);mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 1' preserveAspectRatio='none'%3E%3Crect width='1' height='1'/%3E%3C/svg%3E") 0 0 / calc(2 * var(--basalt-size-diagram-guide-dash)) var(--basalt-size-hairline) repeat-x}.diagram-felse .diagram-flabel{margin-block-start:0;margin-inline-start:0}.diagram-fword{margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground);color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-fword+.diagram-flabel{margin-inline-start:calc(-1 * var(--basalt-space-1-5))}.diagram-key-letters[data-op]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-text{box-sizing:border-box;margin:0;padding:var(--basalt-space-4);overflow:hidden;border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);background:var(--basalt-surface-sunken);color:var(--basalt-text-secondary);direction:ltr;font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-size-code-line-height) var(--basalt-font-family-mono);white-space:pre-wrap;overflow-wrap:break-word}.diagram-text[data-art]{white-space:pre;overflow-wrap:normal}.diagram-drawing:has(>.diagram-text){max-width:none}.diagram-text .diagram-text-ink{font:inherit;padding:0;border:0;border-radius:0;background:none;color:inherit}.diagram-tx-name,.diagram-tx-to{white-space:nowrap;color:var(--basalt-text-primary)}.diagram-tx-line{display:block;padding-inline-start:calc(var(--_in, 0) * 1ch);text-indent:calc(-1 * var(--_hang, 0) * 1ch)}.diagram-text [data-ink=focal],.diagram-text [data-ink=op]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-text :is([data-ink=name],[data-ink=working],[data-ink=plain]){color:var(--basalt-text-secondary)}.diagram-text :is([data-ink=main],[data-ink=label]){color:var(--basalt-text-primary)}.diagram-text :is([data-ink=life],[data-ink=num],[data-ink=note],[data-ink=frame],[data-ink=band]){color:var(--basalt-text-tertiary)}.diagram-key-glyph{font:var(--basalt-font-weight-regular) var(--bh-xs-mono);color:var(--basalt-text-secondary)}.diagram-key-glyph[data-ink=main]{color:var(--basalt-text-primary)}.diagram-key-glyph[data-ink=focal]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}@media(forced-colors:active){.diagram-text :is([data-ink]){color:CanvasText}}.diagram-band{--_Bh: var(--_D) var(--basalt-size-control-lg);--_Bj: var(--_D) center;position:relative;display:flex;align-items:center;justify-content:var(--_Bj, flex-start);height:var(--_Bh, auto);margin:var(--_Bm, var(--basalt-space-5) 0 var(--basalt-space-2));--_Bm: var(--_D) 0;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-band:before{--_Br: var(--_D) "";content:var(--_Br, none);position:absolute;inset-inline:0;top:50%;border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-band>span{position:relative;padding-inline:var(--_Bp, 0);--_Bp: var(--_D) var(--basalt-space-1-5);background:var(--_ground)}.diagram-node[data-shape=table]{align-self:start;padding:0;overflow-wrap:normal}.diagram-th{padding:var(--basalt-space-2) var(--basalt-space-3);border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-node[data-focal] .diagram-th{border-bottom-color:var(--basalt-diagram-focal-rule)}.diagram-tname{color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-rows{display:flex;flex-direction:column;padding-block:var(--basalt-space-1)}.diagram-row{display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-3);min-height:var(--basalt-size-control-sm);padding-inline:var(--basalt-space-3);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-keyseat{flex:none;width:var(--basalt-space-6);margin-inline-end:calc(-1 * var(--basalt-space-3));color:var(--basalt-text-tertiary)}.diagram-cname{flex:1 0 auto;color:var(--basalt-text-primary)}.diagram-ctype{margin-inline-start:auto;color:var(--basalt-text-tertiary)}.diagram-ctype[data-ref]{color:var(--basalt-text-secondary)}.diagram-more{padding:0 var(--basalt-space-3) var(--basalt-space-2);color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-key{padding-block-start:var(--basalt-space-3);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-legend{display:flex;flex-wrap:wrap;gap:var(--basalt-space-2) var(--basalt-space-5);margin:0;padding:0;list-style:none;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-entry{display:inline-flex;align-items:center;gap:var(--basalt-space-1-5)}.diagram[data-layout=drawn] .diagram-entry[data-when=stacked],.diagram[data-layout=stacked] .diagram-entry[data-when=drawn],.diagram:not([data-layout]) .diagram-entry[data-when=drawn]{display:none}.diagram-swatch{flex:none;overflow:visible}.diagram-swatch-shape{fill:var(--_ground);stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline)}.diagram-swatch[data-shape=focal] .diagram-swatch-shape{fill:var(--basalt-diagram-focal);stroke:var(--basalt-diagram-focal)}.diagram-swatch[data-shape=group] .diagram-swatch-shape{fill:none;stroke-dasharray:var(--basalt-space-1) var(--basalt-space-0-5)}.diagram-fk-mark{color:var(--basalt-text-secondary);font-family:var(--basalt-font-family-mono)}.diagram-key-letters{color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-hint{display:flex;flex-wrap:wrap;gap:var(--basalt-space-1) var(--basalt-space-4);margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-hint>span{display:inline-flex;align-items:center;gap:var(--basalt-space-1)}.diagram-tap-hint{display:none;margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram[data-touch][data-layout=drawn]>.diagram-tap-hint,.diagram[data-touch][data-layout=stacked]:not([data-bare],[data-type=sequence],[data-type=schema])>.diagram-tap-hint{display:block}.diagram[data-touch]>.diagram-hint{display:none}.diagram[data-touch] .diagram-node{min-height:var(--basalt-size-tap-min)}@media(pointer:coarse){.diagram-clear{min-height:var(--basalt-size-tap-min)}}.diagram[data-layout=stacked]:is([data-type=sequence],[data-type=schema]) .diagram-hint{display:none}.diagram[data-bare] :is(.diagram-entry[data-line],.diagram-hint){display:none}.diagram-summary{order:1;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);text-wrap:pretty}.diagram-foot{order:2;display:flex;flex-wrap:wrap;gap:var(--basalt-space-2)}.diagram-list{order:3;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm)}.diagram-list[hidden]{display:none}.diagram-list strong{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-code{padding:0;border-radius:0;background:none;color:var(--basalt-text-primary);font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-list-head{margin:var(--basalt-space-4) 0 var(--basalt-space-2);color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-list-head:first-child{margin-block-start:0}.diagram-list-group{margin:var(--basalt-space-3) 0 var(--basalt-space-1);color:var(--basalt-text-primary);font-size:inherit;font-weight:var(--basalt-font-weight-medium);line-height:inherit}.diagram-list-items{display:flex;flex-direction:column;gap:var(--basalt-space-1);margin:0;padding-inline-start:var(--basalt-space-5)}.diagram-list-exits{margin:var(--basalt-space-1) 0 0;padding-inline-start:var(--basalt-space-5)}@media(pointer:coarse){.diagram-toggle{min-height:var(--basalt-size-tap-min)}}@media(prefers-reduced-motion:reduce){.diagram-node,.diagram-line,.diagram-tip,.diagram-crow,.diagram-ring,.diagram-label,.diagram-diamond path{transition:none}}@media(prefers-contrast:more){.diagram-node[data-focal] :is(.diagram-kind,.diagram-detail,.diagram-keyseat,.diagram-ctype,.diagram-more){opacity:1}}@container (width >= 640px){.diagram:not([data-layout]):is(:is([data-type=architecture],[data-type=flowchart]):is([data-cols="1"],[data-cols="2"],[data-cols="3"]),:is([data-type=data-flow],[data-type=schema]):is([data-cols="1"],[data-cols="2"]),[data-type=sequence]:is([data-cols="1"],[data-cols="2"],[data-cols="3"],[data-cols="4"]))>.diagram-drawing{--_D: }}@container (width >= 696px){.diagram:not([data-layout])[data-type=data-flow][data-cols="3"]>.diagram-drawing{--_D: }}@container (width >= 768px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="4"][data-reach="0"],[data-type=flowchart][data-cols="4"],[data-type=schema][data-cols="3"]:not([data-marks]))>.diagram-drawing{--_D: }}@container (width >= 784px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 800px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="4"][data-reach="2"],[data-type=sequence][data-cols="5"])>.diagram-drawing{--_D: }}@container (width >= 816px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 832px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 888px){.diagram:not([data-layout])[data-type=data-flow][data-cols="4"]>.diagram-drawing{--_D: }}@container (width >= 964px){.diagram:not([data-layout])[data-type=sequence][data-cols="6"]>.diagram-drawing{--_D: }}@container (width >= 976px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="5"][data-reach="0"],[data-type=flowchart][data-cols="5"])>.diagram-drawing{--_D: }}@container (width >= 992px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 1008px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="2"]>.diagram-drawing{--_D: }}@container (width >= 1024px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 1040px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 1040px){.diagram:not([data-layout])[data-type=schema][data-cols="4"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 1080px){.diagram:not([data-layout])[data-type=data-flow][data-cols="5"]>.diagram-drawing{--_D: }}@container (width >= 1184px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="6"][data-reach="0"],[data-type=flowchart][data-cols="6"])>.diagram-drawing{--_D: }}@container (width >= 1200px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 1216px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="2"]>.diagram-drawing{--_D: }}@container (width >= 1232px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 1248px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 1272px){.diagram:not([data-layout])[data-type=data-flow][data-cols="6"]>.diagram-drawing{--_D: }}@container (width >= 1312px){.diagram:not([data-layout])[data-type=schema][data-cols="5"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 1584px){.diagram:not([data-layout])[data-type=schema][data-cols="6"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 792px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="3"]>.diagram-drawing{--_D: }}@container (width >= 1076px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="4"]>.diagram-drawing{--_D: }}@container (width >= 1360px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="5"]>.diagram-drawing{--_D: }}@container (width >= 1644px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="6"]>.diagram-drawing{--_D: }}@media(scripting:none){.diagram:not(#basalt-diagram-no-id)>.diagram-drawing{--_D: initial}.diagram-list[hidden]{display:block!important}.diagram-foot,.diagram-entry[data-line],.diagram-hint{display:none}}@media(forced-colors:active){.diagram-svg,.diagram-lifes,.diagram-swatch,.diagram-arrow{forced-color-adjust:none}.diagram .diagram-line,.diagram .diagram-line[data-kind]{stroke:CanvasText}.diagram .diagram-tip,.diagram .diagram-tip[data-kind],.diagram .diagram-dot{fill:CanvasText}.diagram .diagram-tip[data-open],.diagram .diagram-tip[data-kind][data-open]{fill:none;stroke:CanvasText}.diagram .diagram-edge[data-dim] .diagram-line{stroke:GrayText}.diagram .diagram-edge[data-dim] :is(.diagram-tip:not([data-open]),.diagram-dot){fill:GrayText}.diagram .diagram-edge[data-dim] .diagram-tip[data-open]{stroke:GrayText}.diagram .diagram-edge[data-lit] .diagram-line{stroke:Highlight}.diagram .diagram-edge[data-lit] :is(.diagram-tip:not([data-open]),.diagram-dot){fill:Highlight}.diagram .diagram-edge[data-lit] .diagram-tip[data-open]{stroke:Highlight}.diagram :is(.diagram-crow,.diagram-ring){stroke:CanvasText}.diagram .diagram-ring{fill:Canvas}.diagram .diagram-edge[data-dim] :is(.diagram-crow,.diagram-ring){stroke:GrayText}.diagram .diagram-edge[data-lit] :is(.diagram-crow,.diagram-ring){stroke:Highlight}.diagram .diagram-life{stroke:GrayText}.diagram .diagram-label{color:CanvasText;forced-color-adjust:none}.diagram .diagram-label[data-on]{background:Canvas}.diagram .diagram-label[data-lit]{color:Highlight}.diagram .diagram-swatch-shape{fill:Canvas;stroke:CanvasText}.diagram .diagram-swatch[data-shape=group] .diagram-swatch-shape{fill:none;stroke:GrayText}.diagram .diagram-swatch[data-shape=focal] .diagram-swatch-shape{fill:CanvasText;stroke:CanvasText}.diagram[data-type=flowchart] .diagram-node:not([data-focal]),.diagram[data-type=flowchart] .diagram-node:not([data-focal])[data-near]{border-color:CanvasText}.diagram[data-measured][data-type=flowchart] .diagram-node[data-shape=decision][data-shape]{forced-color-adjust:none;background:none;border-color:transparent}.diagram .diagram-diamond{forced-color-adjust:none}.diagram .diagram-diamond path,.diagram .diagram-node[data-near] .diagram-diamond path{fill:Canvas;stroke:CanvasText}.diagram .diagram-group,.diagram .diagram-gbox{border-color:GrayText}.diagram .diagram-lane+.diagram-lane:before,.diagram .diagram-band:before{border-color:GrayText}.diagram .diagram-hint{color:GrayText}.diagram :is(.diagram-kind,.diagram-name,.diagram-detail,.diagram-glabel,.diagram-lane-name,.diagram-title,.diagram-source,.diagram-num,.diagram-mlabel,.diagram-route,.diagram-note,.diagram-band,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more,.diagram-legend,.diagram-fk-mark,.diagram-key-letters){color:CanvasText}.diagram .diagram-node:focus-visible{outline-color:Highlight}.diagram .diagram-node[data-focal],.diagram .diagram-node[data-focal][data-near]{forced-color-adjust:none;background:CanvasText;border-color:CanvasText}.diagram .diagram-node[data-focal] :is(.diagram-name,.diagram-kind,.diagram-detail,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more){color:Canvas;opacity:1}.diagram .diagram-node[data-focal] .diagram-th{border-bottom-color:Canvas}.diagram .diagram-node[data-focal]:focus-visible{outline:var(--basalt-size-focus-width) solid Highlight}.diagram .diagram-node[data-focal][data-shape=decision] .diagram-diamond path{fill:CanvasText;stroke:CanvasText}.diagram .diagram-bar{fill:Canvas;stroke:CanvasText}.diagram .diagram-fbox,.diagram .diagram-ftab{border-color:GrayText}.diagram .diagram-felse:before{background:GrayText}.diagram :is(.diagram-ftab,.diagram-flabel,.diagram-fword){color:CanvasText;background:Canvas}.diagram .diagram-mark{display:none}.diagram .diagram-node[data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline-end:0}}@media print{.diagram-svg,.diagram-lifes,.diagram-swatch,.diagram-arrow,.diagram-mark,.diagram-node[data-focal]{-webkit-print-color-adjust:exact;print-color-adjust:exact}.diagram-hint,.diagram-tap-hint,.diagram-clear,.diagram-download{display:none!important}.diagram .diagram-edge :is(.diagram-line,.diagram-tip[data-open]){stroke:var(--basalt-diagram-edge)!important}.diagram .diagram-edge .diagram-line[data-kind=main]{stroke:var(--basalt-diagram-edge-main)!important}.diagram .diagram-edge :is(.diagram-tip:not([data-open]),.diagram-dot){fill:var(--basalt-diagram-edge)!important}.diagram .diagram-edge .diagram-tip[data-kind=main]:not([data-open]){fill:var(--basalt-diagram-edge-main)!important}.diagram .diagram-edge :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge)!important}.diagram .diagram-label{color:var(--basalt-diagram-edge)!important}}.basalt-exporting,.basalt-exporting *{transition:none!important}.diagram-msg[data-ahead] .diagram-mlabel{color:var(--basalt-text-secondary);transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-edge[data-ahead] .diagram-line{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-ahead] .diagram-tip:not([data-open]){fill:var(--basalt-diagram-edge-dim)}.diagram-edge[data-ahead] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-dim)}.diagram-text [data-n][data-ahead] [data-ink=label],.diagram[data-motion=animated][data-entrance=pending] .diagram-text [data-n] [data-ink=label]{color:var(--basalt-text-secondary)}.diagram-text [data-n][data-ahead] :is([data-ink=main],[data-ink=plain]),.diagram[data-motion=animated][data-entrance=pending] .diagram-text [data-n] :is([data-ink=main],[data-ink=plain]){color:var(--basalt-text-tertiary)}.diagram-text [data-n][data-arrival] [data-ink=num]{color:var(--basalt-text-primary)}@media(prefers-reduced-motion:reduce){.diagram-msg[data-ahead] .diagram-mlabel{transition:none}}@media(forced-colors:active){.diagram .diagram-msg[data-ahead] .diagram-mlabel{color:GrayText}.diagram .diagram-edge[data-ahead] .diagram-line{stroke:GrayText}.diagram .diagram-edge[data-ahead] .diagram-tip:not([data-open]){fill:GrayText}.diagram .diagram-edge[data-ahead] .diagram-tip[data-open]{stroke:GrayText}.diagram .diagram-text [data-n][data-ahead] [data-ink]{color:GrayText}.diagram .diagram-text [data-n][data-arrival] [data-ink=num]{color:Highlight}}@media print{.diagram .diagram-msg[data-ahead] .diagram-mlabel{color:var(--basalt-text-primary)!important}}} +:root{--basalt-size-diagram-node: 144px;--basalt-size-diagram-table: 224px;--basalt-size-diagram-lane: 120px;--basalt-size-diagram-step: 56px;--basalt-size-diagram-head: 8px;--basalt-size-diagram-activation: 8px;--basalt-size-diagram-foot: 14px;--basalt-size-diagram-guide-dash: 4px;--basalt-size-diagram-bead: 24px;--basalt-size-diagram-flow: 12px}:root,[data-theme=light],.light{--basalt-diagram-edge-main: var(--basalt-text-primary);--basalt-diagram-edge: var(--basalt-text-secondary);--basalt-diagram-edge-dim: var(--basalt-border-input);--basalt-diagram-structure: var(--basalt-border-input);--basalt-diagram-focal: var(--basalt-action-primary);--basalt-diagram-focal-ink: var(--basalt-action-primary-text);--basalt-diagram-focal-rule: var(--basalt-white-6);--basalt-diagram-focal-rule-contrast: var(--basalt-white-38);--basalt-diagram-hit: var(--basalt-text-secondary);--basalt-diagram-focal-hit: var(--basalt-action-primary-hover)}[data-theme=dark],.dark{--basalt-diagram-edge-main: var(--basalt-text-primary);--basalt-diagram-edge: var(--basalt-text-secondary);--basalt-diagram-edge-dim: var(--basalt-border-input);--basalt-diagram-structure: var(--basalt-border-input);--basalt-diagram-focal: var(--basalt-action-primary);--basalt-diagram-focal-ink: var(--basalt-action-primary-text);--basalt-diagram-focal-rule: var(--basalt-black-8);--basalt-diagram-focal-rule-contrast: var(--basalt-black-45);--basalt-diagram-hit: var(--basalt-text-secondary);--basalt-diagram-focal-hit: var(--basalt-action-primary-hover)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--basalt-diagram-focal-rule: var(--basalt-black-8);--basalt-diagram-focal-rule-contrast: var(--basalt-black-45)}}@media(prefers-contrast:more){:root,[data-theme=light],[data-theme=dark],.light,.dark,:root:not([data-theme=light]):not(.light){--basalt-diagram-focal-rule: var(--basalt-diagram-focal-rule-contrast);--basalt-diagram-hit: var(--basalt-text-primary)}}@layer basalt{.diagram{--_ground: var(--panel-bg, var(--basalt-surface-page));container-type:inline-size;display:flex;flex-direction:column;gap:var(--basalt-space-4);width:100%;min-width:0;margin:0;font-family:var(--basalt-font-family-sans)}.diagram[hidden]{display:none}.diagram-head{display:flex;flex-direction:column;gap:var(--basalt-space-0-5);min-width:0}.diagram-title{margin:0;color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-md);letter-spacing:var(--basalt-text-md-tracking)}.diagram-source{margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-drawing{--_D: initial;--_Display: var(--_D) grid;--_Max: var(--_D) none;--_Cols: var(--_D) repeat(var(--_cols, 1), minmax(0, 1fr));--_Gap: var(--_D) var(--_row-gap) var(--_col-gap);--_Pad: var(--_D) var(--_gpad, 0);--_row-gap: var(--basalt-space-12);--_col-gap: var(--basalt-space-16);position:relative;box-sizing:border-box;display:var(--_Display, flex);flex-direction:column;grid-template-columns:var(--_Cols, none);gap:var(--_Gap, 0);width:100%;max-width:var(--_Max, var(--basalt-size-breakpoint-container));min-width:0;padding:var(--_Pad, 0 var(--_gutter, 0) 0 0)}.diagram[data-layout=drawn]>.diagram-drawing{--_D: }.diagram[data-layout=stacked]>.diagram-drawing{--_D: initial}.diagram[data-gutter]>.diagram-drawing{--_gutter: var(--_gw, var(--basalt-space-10))}.diagram[data-type=data-flow]>.diagram-drawing{--_Cols: var(--_D) var(--basalt-size-diagram-lane) repeat(var(--_cols, 1), minmax(0, 1fr));--_row-gap: var(--basalt-space-10);--_col-gap: var(--basalt-space-12)}.diagram[data-type=schema]>.diagram-drawing{--_row-gap: var(--basalt-space-8);--_col-gap: var(--basalt-space-12);--_Rows: var(--_D) var(--_rows, none);display:grid;grid-template-columns:var(--_Cols, repeat(auto-fit, minmax(min(100%, var(--_track, var(--basalt-size-diagram-table))), 1fr)));grid-template-rows:var(--_Rows, none);gap:var(--_Gap, var(--basalt-space-4));align-items:start;max-width:none}.diagram[data-type=schema][data-marks]>.diagram-drawing{--_col-gap: calc(var(--basalt-space-12) + var(--basalt-space-3))}.diagram[data-type=sequence]>.diagram-drawing{display:flex;gap:0}.diagram[data-rtl]>.diagram-drawing{direction:ltr}.diagram[data-rtl]>.diagram-drawing{padding:var(--_Pad, 0 0 0 var(--_gutter, 0))}.diagram[data-rtl] .diagram-node[data-branch]{margin-inline:var(--_Mi, var(--basalt-space-6) var(--basalt-space-12))}.diagram[data-rtl]>.diagram-drawing :is(.diagram-node>:not(.diagram-mark),.diagram-lane-name,.diagram-said,.diagram-note,.diagram-band,.diagram-fhead,.diagram-felse){direction:rtl}.diagram[data-rtl] .diagram-gbox>.diagram-glabel{inset-inline:auto var(--basalt-space-3)}.diagram[data-rtl] .diagram-group>.diagram-glabel{inset-inline:auto calc(var(--basalt-space-3) + var(--_gx, var(--basalt-space-0)));margin-inline:0 calc(-1 * var(--basalt-space-1-5))}.diagram[data-rtl] .diagram-runs{direction:ltr;unicode-bidi:isolate}.diagram[data-rtl] .diagram-fhead{inset-inline-start:calc(100% - var(--_fl) - var(--_fw) + var(--basalt-size-hairline))}.diagram[data-rtl] .diagram-felse{padding-inline-start:calc(100% - var(--_fl) - var(--_fw) + var(--basalt-space-3))}.diagram[data-rtl] .diagram-felse:before{inset-inline-start:var(--_Fer, calc(-1 * var(--basalt-space-4)))}.diagram[data-rtl] .diagram-msg[data-self=end] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) left;margin-inline-start:0;margin-inline-end:var(--_Sm, 0)}.diagram[data-rtl] .diagram-msg[data-self=start] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) right;margin-inline-end:0;margin-inline-start:var(--_Sm, 0)}.diagram[data-rtl] :is(.diagram-run,.diagram-mlabel,.diagram-tname,.diagram-cname,.diagram-ctype,.diagram-label,.diagram-glabel,.diagram-kind){unicode-bidi:isolate}.diagram[data-rtl] :is(.diagram-run,.diagram-mlabel,.diagram-cname,.diagram-label){direction:ltr}.diagram[data-rtl] .diagram-arrow{scale:-1 1}.diagram-node{--_Gc: var(--_D) var(--_c);--_Gr: var(--_D) var(--_r) / var(--_r2);--_Mt: var(--_D) 0;--_Align: var(--_D) center;position:relative;z-index:1;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;grid-column:var(--_Gc, auto);grid-row:var(--_Gr, auto);align-self:var(--_Align, stretch);margin-block-start:var(--_Mt, var(--_gap, 0));padding:var(--basalt-space-2-5) var(--basalt-space-3);background:var(--panel-next, var(--basalt-surface-1));border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);color:var(--basalt-text-primary);overflow-wrap:break-word;outline:none;transition:border-color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram[data-type=data-flow] .diagram-node{--_Gc: var(--_D) var(--_lc)}.diagram-node{--_Mh: var(--_D) var(--_mh, auto);min-height:var(--_Mh, auto)}.diagram-node{--_Jc: var(--_D) normal;justify-content:var(--_Jc, center)}.diagram-node[data-branch]{--_Mi: var(--_D) 0;margin-inline:var(--_Mi, var(--basalt-space-12) var(--basalt-space-6))}.diagram-node:focus-visible{z-index:2;outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.diagram-node[data-near]{border-color:var(--basalt-border-hover)}.diagram-kind{color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-lane-word{--_Lw: var(--_D) none;display:var(--_Lw, inline)}.diagram-name{color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-detail{margin-block-start:var(--basalt-space-0-5);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-detail[data-mono]{font-family:var(--basalt-font-family-mono)}.diagram-run{display:inline-block;max-width:100%}:root,[data-theme=light],.light{--_dkm: initial}[data-theme=dark],.dark{--_dkm: }@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--_dkm: }}.diagram-mark{--_mf: var(--_dkm) var(--_md);position:absolute;inset-block-start:var(--basalt-space-2-5);inset-inline-end:var(--basalt-space-3);width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);background:var(--_mf, var(--_ml)) center / contain no-repeat;pointer-events:none}.diagram-node[data-focal]>.diagram-mark{--_mf: var(--_dkm) var(--_ml);background-image:var(--_mf, var(--_md, var(--_ml)))}.diagram-node[data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline-end:var(--basalt-space-6)}.diagram-node[data-shape=participant][data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline:var(--basalt-space-6)}.diagram-node[data-shape=participant]>.diagram-mark{--_Pmp: var(--_D) absolute;position:var(--_Pmp, static);flex:none;margin-inline-end:var(--_Pmm, var(--basalt-space-1-5));--_Pmm: var(--_D) 0}.diagram-node[data-shape=participant][data-mark]{--_Pfd: var(--_D) column;flex-direction:var(--_Pfd, row)}.diagram-node[data-shape=participant][data-mark]>.diagram-mark+.diagram-name{--_Pnp: var(--_D) var(--basalt-space-6);padding-inline:var(--_Pnp, 0)}.diagram-node[data-focal]{background:var(--basalt-diagram-focal);border-color:var(--basalt-diagram-focal)}.diagram-node[data-focal] :is(.diagram-name,.diagram-kind,.diagram-detail,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more){color:var(--basalt-diagram-focal-ink)}.diagram-node[data-focal] :is(.diagram-kind,.diagram-detail,.diagram-keyseat,.diagram-ctype,.diagram-more){opacity:var(--basalt-opacity-amount)}.diagram[data-type=flowchart] .diagram-node:not([data-focal]){border-color:var(--basalt-diagram-structure)}.diagram[data-type=flowchart] .diagram-node:not([data-focal],[data-shape=decision])[data-near]{border-color:var(--basalt-text-secondary)}.diagram-node[data-shape=terminal]{align-items:center;padding-inline:var(--basalt-space-5);border-radius:var(--basalt-radius-full);text-align:center}.diagram-node[data-shape=decision]{justify-content:center;align-items:center;height:var(--_h, auto);min-height:var(--basalt-space-16);padding:var(--basalt-space-2) var(--basalt-space-2-5);text-align:center}.diagram-words{position:relative;max-width:var(--_ww, calc(62% + (var(--basalt-space-2-5) + var(--basalt-size-hairline)) * 1.24))}.diagram-node[data-shape=decision] .diagram-name{font-weight:var(--basalt-font-weight-medium);text-wrap:balance}.diagram-diamond{display:none;position:absolute;inset:0;width:100%;height:100%;overflow:visible}.diagram-diamond path{fill:var(--panel-next, var(--basalt-surface-1));stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);vector-effect:non-scaling-stroke;transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram[data-measured] .diagram-node[data-shape=decision]{background:none;border-color:transparent}.diagram[data-measured] .diagram-node[data-shape=decision] .diagram-diamond{display:block}.diagram-node[data-shape=decision][data-near] .diagram-diamond path{stroke:var(--basalt-text-secondary)}.diagram-node[data-shape=decision][data-focal] .diagram-diamond path{fill:var(--basalt-diagram-focal);stroke:var(--basalt-diagram-focal)}.diagram-node[data-link]{color:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent}.diagram-name-end{white-space:nowrap}.diagram-node[data-link] .diagram-name-end:after{content:"";display:inline-block;width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);margin-inline-start:var(--basalt-space-1-5);vertical-align:calc(-1 * var(--basalt-space-0-5));background:var(--basalt-text-secondary);mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12L17.5 12M17.5 12L11.5 7M17.5 12L11.5 17' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;transition:transform var(--basalt-duration-base) var(--basalt-ease-out),background-color var(--basalt-duration-base) var(--basalt-ease-out)}.diagram-node[data-link=external] .diagram-name-end:after{mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 17L17 7M9.5 7L17 7M17 7L17 14.5' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}.diagram-node[data-link][data-focal] .diagram-name-end:after{background:var(--basalt-diagram-focal-ink);opacity:var(--basalt-opacity-amount)}.diagram-node[data-link]:is(:hover,:focus-visible) .diagram-name-end:after{background:var(--basalt-text-primary);transform:translate(var(--basalt-space-0-5))}.diagram-node[data-link][data-focal]:is(:hover,:focus-visible) .diagram-name-end:after{background:var(--basalt-diagram-focal-ink);opacity:1}.diagram-node[data-link]:is(:hover,:focus-visible) :is(.diagram-name,.diagram-tname){text-decoration:underline var(--basalt-size-hairline);text-underline-offset:var(--basalt-size-underline-offset)}.diagram-node[data-link]:active{background:light-dark(color-mix(in srgb,var(--basalt-neutral-0) 4%,var(--panel-next, var(--basalt-surface-1))),color-mix(in srgb,var(--basalt-neutral-100) 6%,var(--panel-next, var(--basalt-surface-1))))}@supports not (color: light-dark(white,black)){.diagram-node[data-link]:active{background:color-mix(in srgb,color-mix(in srgb,var(--basalt-neutral-100) 6%,var(--panel-next, var(--basalt-surface-1))) var(--_dkp),color-mix(in srgb,var(--basalt-neutral-0) 4%,var(--panel-next, var(--basalt-surface-1))))}}.diagram-node[data-link][data-focal]:active{background:var(--basalt-action-primary-press)}.diagram-node[data-link]:dir(rtl) .diagram-name-end:after{scale:-1 1}.diagram-node[data-link]:dir(rtl):is(:hover,:focus-visible) .diagram-name-end:after{transform:translate(calc(-1 * var(--basalt-space-0-5)))}@media(prefers-reduced-motion:reduce){.diagram-node[data-link]:is(:hover,:focus-visible) .diagram-name-end:after,.diagram-node[data-link]:dir(rtl):is(:hover,:focus-visible) .diagram-name-end:after{transform:none}}@media(pointer:coarse){.diagram-node[data-link]{min-height:var(--basalt-size-tap-min)}}@media(forced-colors:active){.diagram .diagram-node[data-link] :is(.diagram-name,.diagram-tname){color:LinkText;text-decoration:underline}.diagram .diagram-node[data-link] .diagram-name-end:after{forced-color-adjust:none;background:LinkText}.diagram .diagram-node[data-link][data-focal] :is(.diagram-name,.diagram-tname){color:Canvas}.diagram .diagram-node[data-link][data-focal] .diagram-name-end:after{background:Canvas}}.diagram-group{--_Gd: var(--_D) contents;position:relative;box-sizing:border-box;display:var(--_Gd, flex);flex-direction:column;margin-block-start:calc(var(--basalt-space-12) + var(--basalt-space-4) * var(--_ggrow, 0));padding:var(--basalt-space-8) var(--basalt-space-3) var(--basalt-space-3-5);border:var(--basalt-size-hairline) dashed var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg)}.diagram-group{--_tl: 0}.diagram-group:first-child{margin-block-start:0}.diagram-group[data-turn]{padding-block-start:calc(var(--basalt-space-12) + var(--basalt-space-4) * var(--_tl, 0))}.diagram-group>.diagram-glabel+.diagram-node{--_Mt: 0}.diagram-glabel{position:absolute;top:var(--basalt-space-2);inset-inline-start:var(--basalt-space-3);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono);white-space:nowrap}.diagram-group>.diagram-glabel{--_Gl: var(--_D) none;display:var(--_Gl, block)}.diagram-group>.diagram-glabel{z-index:1;margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground)}.diagram-group>.diagram-glabel{inset-inline-start:calc(var(--basalt-space-3) + var(--_gx, var(--basalt-space-0)))}.diagram-gbox{--_Gb: var(--_D) block;position:relative;display:var(--_Gb, none);grid-column:var(--_c) / var(--_c2);grid-row:var(--_r) / var(--_r2);margin-block:calc(-1 * var(--_gt, 1) * var(--basalt-space-8)) calc(-1 * var(--_gb, 1) * var(--basalt-space-4));margin-inline:calc(-1 * var(--_gs, 1) * var(--basalt-space-4)) calc(-1 * var(--_ge, 1) * var(--basalt-space-4));border:var(--basalt-size-hairline) dashed var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg);pointer-events:none}.diagram-gbox[data-depth="2"],.diagram-group[data-depth="2"]{border-radius:var(--basalt-radius-md)}.diagram-list-group[data-depth="2"],.diagram-list-items[data-depth="2"]{margin-inline-start:var(--basalt-space-5)}.diagram-lane{--_Ln: var(--_D) flex;position:relative;display:var(--_Ln, none);grid-column:1 / -1;grid-row:var(--_r);align-items:center;pointer-events:none}.diagram-lane+.diagram-lane:before{content:"";position:absolute;inset-inline:0;top:calc(-1 * var(--basalt-space-5));border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-lane-name{box-sizing:border-box;width:var(--basalt-size-diagram-lane);padding-inline-end:var(--basalt-space-3);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-ink{position:absolute;inset:0;z-index:0;pointer-events:none}.diagram[data-type=sequence]>.diagram-drawing>.diagram-ink{z-index:auto}.diagram-lifes{position:absolute;top:0;left:0;z-index:0;overflow:visible}.diagram[data-type=sequence] .diagram-ink>.diagram-svg{z-index:2}.diagram[data-type=sequence] .diagram-steps{z-index:auto}.diagram[data-type=sequence] .diagram-msg :is(.diagram-said,.diagram-note){position:relative;z-index:3}.diagram[data-type=sequence] :is(.diagram-fhead,.diagram-felse){z-index:3}.diagram-svg{position:absolute;top:0;left:0;overflow:visible}.diagram-ruler{position:absolute;visibility:hidden;white-space:pre;pointer-events:none}.diagram-ruler[data-f=name]{font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-ruler[data-f=name-500]{font:var(--basalt-font-weight-medium) var(--bh-sm)}.diagram-ruler[data-f=table]{font:var(--basalt-font-weight-semibold) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-ruler:is([data-f=mono],[data-f=label]){font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-ruler[data-f=sans]{font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-line{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-line[data-kind=main]{stroke:var(--basalt-diagram-edge-main);stroke-width:var(--basalt-size-chart-line)}.diagram-line[data-kind=dashed]{stroke-dasharray:var(--basalt-size-chart-dash) var(--basalt-size-chart-dash-gap);stroke-linecap:butt}.diagram-tip{fill:var(--basalt-diagram-edge);transition:fill var(--basalt-duration-fast) var(--basalt-ease-out),stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-tip[data-kind=main]{fill:var(--basalt-diagram-edge-main)}.diagram-tip[data-open]{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);stroke-linecap:round;stroke-linejoin:round}.diagram-dot{fill:var(--basalt-diagram-edge)}.diagram-crow{fill:none;stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);stroke-linecap:butt;stroke-linejoin:miter;transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-ring{fill:var(--_ground);stroke:var(--basalt-diagram-edge);stroke-width:var(--basalt-size-hairline);transition:stroke var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-life{fill:none;stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);stroke-dasharray:var(--basalt-size-diagram-guide-dash) var(--basalt-size-diagram-guide-dash)}.diagram-edge[data-lit] .diagram-line{stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-lit] .diagram-tip:not([data-open]),.diagram-edge[data-lit] .diagram-dot{fill:var(--basalt-diagram-edge-main)}.diagram-edge[data-lit] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-dim] .diagram-line{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-dim] .diagram-tip:not([data-open]),.diagram-edge[data-dim] .diagram-dot{fill:var(--basalt-diagram-edge-dim)}.diagram-edge[data-dim] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-lit] :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge-main)}.diagram-edge[data-dim] :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge-dim)}.diagram-label{position:absolute;box-sizing:border-box;height:var(--basalt-text-xs-line-height);color:var(--basalt-diagram-edge);font:var(--basalt-font-weight-regular) var(--bh-xs-mono);text-align:center;white-space:nowrap;transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-label[data-on]{background:var(--_ground)}.diagram-label[data-lines="2"]{height:calc(2 * var(--basalt-text-xs-line-height))}.diagram-label[data-lit]{color:var(--basalt-diagram-edge-main)}.diagram-cast{--_Cd: var(--_D) grid;display:var(--_Cd, flex);flex-wrap:wrap;grid-template-columns:repeat(var(--_cols, 1),minmax(0,1fr));gap:var(--_Cast-gap, var(--basalt-space-1-5));--_Cast-gap: var(--_D) var(--basalt-space-5);margin:0;padding:0;list-style:none}.diagram-actor{--_Ac: var(--_D) var(--_ac, auto);display:flex;min-width:0;grid-column:var(--_Ac, auto);grid-row:1}.diagram-node[data-shape=participant]{--_Pd: var(--_D) var(--basalt-space-2-5) var(--basalt-space-3);--_Pr: var(--_D) var(--basalt-radius-md);--_Pa: var(--_D) center;flex:var(--_Pflex, none);--_Pflex: var(--_D) 1;align-items:center;justify-content:var(--_Pa, center);min-height:var(--_Ph, var(--basalt-size-badge));--_Ph: var(--_D) 0;padding:var(--_Pd, 0 calc(var(--basalt-space-2) - var(--basalt-size-hairline)));border-radius:var(--_Pr, var(--basalt-radius-xs));text-align:center}.diagram-node[data-shape=participant]:not([data-focal]){--_Pbg: var(--_D) var(--panel-next, var(--basalt-surface-1));--_Pbc: var(--_D) var(--basalt-border-rim);--_Pbt: var(--_D) var(--basalt-border-rim-top);background:var(--_Pbg, none);border-color:var(--_Pbc, var(--basalt-border-hairline));border-top-color:var(--_Pbt, var(--basalt-border-hairline))}.diagram-node[data-shape=participant] .diagram-kind{--_Pk: var(--_D) block;display:var(--_Pk, none)}.diagram-node[data-shape=participant] .diagram-name{font-size:var(--_Pn, var(--basalt-text-xs-size));line-height:var(--_Pnl, var(--basalt-text-xs-line-height));font-weight:var(--_Pw, var(--basalt-font-weight-medium));--_Pn: var(--_D) var(--basalt-text-sm-size);--_Pnl: var(--_D) var(--basalt-text-sm-line-height);--_Pw: var(--_D) var(--basalt-font-weight-semibold)}.diagram-steps{--_Sp: var(--_D) var(--basalt-space-4);position:relative;z-index:1;padding-block-start:var(--_Sp, var(--basalt-space-4))}.diagram-msgs{margin:0;padding:0;list-style:none}.diagram-msg{--_Md: var(--_D) grid;--_Mc: var(--_D) repeat(var(--_cols, 1), minmax(0, 1fr));--_Mr: var(--_D) 1fr 1fr;--_Mh: var(--_D) var(--basalt-size-diagram-step);--_Mg: var(--_D) 0 var(--basalt-space-5);display:grid;grid-template-columns:var(--_Mc, var(--basalt-space-8) minmax(0, 1fr));grid-template-rows:var(--_Mr, auto);column-gap:var(--basalt-space-5);gap:var(--_Mg, 0);height:var(--_Mh, auto);padding-block:var(--_Mpb, var(--basalt-space-2-5));--_Mpb: var(--_D) 0;border-top:var(--_Mb, var(--basalt-size-hairline) solid var(--basalt-border-divider));--_Mb: var(--_D) 0;font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-frame+.diagram-msgs>.diagram-msg:first-child{border-top-color:transparent}.diagram-said{--_Sd: var(--_D) block;display:var(--_Sd, contents);grid-column:var(--_a) / var(--_b);grid-row:1;align-self:end;justify-self:center;margin-block-end:calc(var(--basalt-space-1) + var(--basalt-size-hairline));padding-inline:var(--basalt-space-1-5);background:var(--_ground);white-space:nowrap}.diagram-num{grid-column:1;color:var(--basalt-text-tertiary);font-variant-numeric:tabular-nums}.diagram-said .diagram-num{margin-inline-end:var(--_Nm, 0);--_Nm: var(--_D) var(--basalt-space-1-5)}.diagram-mlabel{grid-column:2;color:var(--basalt-text-primary);font-family:var(--basalt-font-family-mono)}.diagram-route{--_Rd: var(--_D) none;display:var(--_Rd, inline-flex);grid-column:2;align-items:center;column-gap:var(--basalt-space-1);row-gap:0;flex-wrap:wrap;color:var(--basalt-text-secondary)}.diagram-to{display:inline-flex;align-items:center;gap:var(--basalt-space-1);white-space:nowrap}.diagram-note{--_Nd: var(--_D) 2;grid-column:var(--_Nc, 2);--_Nc: var(--_D) var(--_a) / var(--_b);grid-row:var(--_Nd, auto);align-self:start;justify-self:var(--_Nj, stretch);--_Nj: var(--_D) center;margin-block-start:var(--_Nmt, 0);--_Nmt: var(--_D) calc(var(--basalt-space-1) + var(--basalt-size-hairline));padding-inline:var(--_Npi, 0);--_Npi: var(--_D) var(--basalt-space-1-5);background:var(--_Nbg, none);--_Nbg: var(--_D) var(--_ground);color:var(--basalt-text-tertiary);white-space:var(--_Nws, normal);--_Nws: var(--_D) nowrap}.diagram-msg[data-self=end] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) start;justify-self:var(--_Sj, stretch);--_Sm: var(--_D) calc(50% + var(--basalt-space-6) + var(--basalt-space-1));margin-inline-start:var(--_Sm, 0)}.diagram-msg[data-self=start] :is(.diagram-said,.diagram-note){--_Sj: var(--_D) end;justify-self:var(--_Sj, stretch);--_Sm: var(--_D) calc(50% + var(--basalt-space-6) + var(--basalt-space-1));margin-inline-end:var(--_Sm, 0)}.diagram-arrow{flex:none;overflow:visible}.diagram-bar{fill:var(--panel-next, var(--basalt-surface-1));stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline);rx:var(--basalt-radius-2xs)}.diagram-frame{--_Fpi: var(--_D) 0;--_cw: calc((100% - (var(--_cols, 1) - 1) * var(--basalt-space-5)) / var(--_cols, 1));--_Fl: var(--_D) calc((var(--_a) - 1) * (var(--_cw) + var(--basalt-space-5)) + var(--_fis, 0) * var(--basalt-space-2));--_Fw: var(--_D) calc((var(--_b) - var(--_a)) * (var(--_cw) + var(--basalt-space-5)) - var(--basalt-space-5) - (var(--_fis, 0) + var(--_fie, 0)) * var(--basalt-space-2));--_fl: var(--_Fl, 0%);--_fw: var(--_Fw, 100%);--_Fel: var(--_D) var(--_fl);--_Few: var(--_D) var(--_fw);--_Fer: var(--_D) calc(100% - var(--_fl) - var(--_fw));position:relative;padding-block:var(--basalt-size-control-lg) var(--basalt-space-2);padding-inline:var(--_Fpi, var(--basalt-space-4))}.diagram-frame+.diagram-frame{margin-block-start:var(--basalt-space-2)}.diagram-frame[data-depth="2"]{--_Fl: var(--_D) calc((var(--_a) - 1) * (var(--_cw) + var(--basalt-space-5)) + var(--_fis, 0) * var(--basalt-space-2))}.diagram-fbox{position:absolute;inset-block:0;inset-inline-start:var(--_fl);z-index:1;box-sizing:border-box;width:var(--_fw);border:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-radius:var(--basalt-radius-lg);pointer-events:none}.diagram-frame[data-depth="2"]>.diagram-fbox{border-radius:var(--basalt-radius-xs)}.diagram-fhead{position:absolute;top:var(--basalt-size-hairline);inset-inline-start:calc(var(--_fl) + var(--basalt-size-hairline));display:flex;align-items:flex-start;gap:var(--basalt-space-3);margin:0;white-space:nowrap}.diagram-ftab{padding:var(--basalt-space-1) var(--basalt-space-3);border-inline-end:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-block-end:var(--basalt-size-hairline) solid var(--basalt-diagram-structure);border-end-end-radius:var(--basalt-radius-xs);background:var(--_ground);color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-xs-mono)}.diagram-flabel{margin-block-start:var(--basalt-space-1);margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-felse{position:relative;display:flex;align-items:center;gap:var(--basalt-space-1-5);height:var(--basalt-size-control-sm);margin:0;padding-inline-start:calc(var(--_fl) + var(--basalt-space-3));white-space:nowrap}.diagram-felse:before{content:"";position:absolute;top:0;inset-inline-start:var(--_Fel, calc(-1 * var(--basalt-space-4)));width:var(--_Few, calc(100% + 2 * var(--basalt-space-4)));height:var(--basalt-size-hairline);background:var(--basalt-diagram-structure);mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 1' preserveAspectRatio='none'%3E%3Crect width='1' height='1'/%3E%3C/svg%3E") 0 0 / calc(2 * var(--basalt-size-diagram-guide-dash)) var(--basalt-size-hairline) repeat-x}.diagram-felse .diagram-flabel{margin-block-start:0;margin-inline-start:0}.diagram-fword{margin-inline-start:calc(-1 * var(--basalt-space-1-5));padding-inline:var(--basalt-space-1-5);background:var(--_ground);color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-fword+.diagram-flabel{margin-inline-start:calc(-1 * var(--basalt-space-1-5))}.diagram-key-letters[data-op]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-text{box-sizing:border-box;margin:0;padding:var(--basalt-space-4);overflow:hidden;border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);background:var(--basalt-surface-sunken);color:var(--basalt-text-secondary);direction:ltr;font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-size-code-line-height) var(--basalt-font-family-mono);white-space:pre-wrap;overflow-wrap:break-word}.diagram-text[data-art]{white-space:pre;overflow-wrap:normal}.diagram-drawing:has(>.diagram-text){max-width:none}.diagram-text .diagram-text-ink{font:inherit;padding:0;border:0;border-radius:0;background:none;color:inherit}.diagram-tx-name,.diagram-tx-to{white-space:nowrap;color:var(--basalt-text-primary)}.diagram-tx-line{display:block;padding-inline-start:calc(var(--_in, 0) * 1ch);text-indent:calc(-1 * var(--_hang, 0) * 1ch)}.diagram-text [data-ink=focal],.diagram-text [data-ink=op]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-text :is([data-ink=name],[data-ink=working],[data-ink=plain]){color:var(--basalt-text-secondary)}.diagram-text :is([data-ink=main],[data-ink=label]){color:var(--basalt-text-primary)}.diagram-text :is([data-ink=life],[data-ink=num],[data-ink=note],[data-ink=frame],[data-ink=band]){color:var(--basalt-text-tertiary)}.diagram-key-glyph{font:var(--basalt-font-weight-regular) var(--bh-xs-mono);color:var(--basalt-text-secondary)}.diagram-key-glyph[data-ink=main]{color:var(--basalt-text-primary)}.diagram-key-glyph[data-ink=focal]{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}@media(forced-colors:active){.diagram-text :is([data-ink]){color:CanvasText}}.diagram-band{--_Bh: var(--_D) var(--basalt-size-control-lg);--_Bj: var(--_D) center;position:relative;display:flex;align-items:center;justify-content:var(--_Bj, flex-start);height:var(--_Bh, auto);margin:var(--_Bm, var(--basalt-space-5) 0 var(--basalt-space-2));--_Bm: var(--_D) 0;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-medium) var(--bh-xs)}.diagram-band:before{--_Br: var(--_D) "";content:var(--_Br, none);position:absolute;inset-inline:0;top:50%;border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-band>span{position:relative;padding-inline:var(--_Bp, 0);--_Bp: var(--_D) var(--basalt-space-1-5);background:var(--_ground)}.diagram-node[data-shape=table]{align-self:start;padding:0;overflow-wrap:normal}.diagram-th{padding:var(--basalt-space-2) var(--basalt-space-3);border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-node[data-focal] .diagram-th{border-bottom-color:var(--basalt-diagram-focal-rule)}.diagram-tname{color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-rows{display:flex;flex-direction:column;padding-block:var(--basalt-space-1)}.diagram-row{display:flex;flex-wrap:wrap;align-items:center;column-gap:var(--basalt-space-3);min-height:var(--basalt-size-control-sm);padding-inline:var(--basalt-space-3);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-keyseat{flex:none;width:var(--basalt-space-6);margin-inline-end:calc(-1 * var(--basalt-space-3));color:var(--basalt-text-tertiary)}.diagram-cname{flex:1 0 auto;color:var(--basalt-text-primary)}.diagram-ctype{margin-inline-start:auto;color:var(--basalt-text-tertiary)}.diagram-ctype[data-ref]{color:var(--basalt-text-secondary)}.diagram-more{padding:0 var(--basalt-space-3) var(--basalt-space-2);color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-key{padding-block-start:var(--basalt-space-3);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.diagram-legend{display:flex;flex-wrap:wrap;gap:var(--basalt-space-2) var(--basalt-space-5);margin:0;padding:0;list-style:none;color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-entry{display:inline-flex;align-items:center;gap:var(--basalt-space-1-5)}.diagram[data-layout=drawn] .diagram-entry[data-when=stacked],.diagram[data-layout=stacked] .diagram-entry[data-when=drawn],.diagram:not([data-layout]) .diagram-entry[data-when=drawn]{display:none}.diagram-swatch{flex:none;overflow:visible}.diagram-swatch-shape{fill:var(--_ground);stroke:var(--basalt-diagram-structure);stroke-width:var(--basalt-size-hairline)}.diagram-swatch[data-shape=focal] .diagram-swatch-shape{fill:var(--basalt-diagram-focal);stroke:var(--basalt-diagram-focal)}.diagram-swatch[data-shape=group] .diagram-swatch-shape{fill:none;stroke-dasharray:var(--basalt-space-1) var(--basalt-space-0-5)}.diagram-fk-mark{color:var(--basalt-text-secondary);font-family:var(--basalt-font-family-mono)}.diagram-key-letters{color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs-mono)}.diagram-hint{display:flex;flex-wrap:wrap;gap:var(--basalt-space-1) var(--basalt-space-4);margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram-hint>span{display:inline-flex;align-items:center;gap:var(--basalt-space-1)}.diagram-tap-hint{display:none;margin:0;color:var(--basalt-text-tertiary);font:var(--basalt-font-weight-regular) var(--bh-xs)}.diagram[data-touch][data-layout=drawn]>.diagram-tap-hint,.diagram[data-touch][data-layout=stacked]:not([data-bare],[data-type=sequence],[data-type=schema])>.diagram-tap-hint{display:block}.diagram[data-touch]>.diagram-hint{display:none}.diagram[data-touch] .diagram-node{min-height:var(--basalt-size-tap-min)}@media(pointer:coarse){.diagram-clear{min-height:var(--basalt-size-tap-min)}}.diagram[data-layout=stacked]:is([data-type=sequence],[data-type=schema]) .diagram-hint{display:none}.diagram[data-bare] :is(.diagram-entry[data-line],.diagram-hint){display:none}.diagram-summary{order:1;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm);text-wrap:pretty}.diagram-foot{order:2;display:flex;flex-wrap:wrap;gap:var(--basalt-space-2)}.diagram-list{order:3;max-width:var(--basalt-size-prose-width);color:var(--basalt-text-secondary);font:var(--basalt-font-weight-regular) var(--bh-sm)}.diagram-list[hidden]{display:none}.diagram-list strong{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-semibold)}.diagram-code{padding:0;border-radius:0;background:none;color:var(--basalt-text-primary);font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-mono)}.diagram-list-head{margin:var(--basalt-space-4) 0 var(--basalt-space-2);color:var(--basalt-text-primary);font:var(--basalt-font-weight-semibold) var(--bh-sm)}.diagram-list-head:first-child{margin-block-start:0}.diagram-list-group{margin:var(--basalt-space-3) 0 var(--basalt-space-1);color:var(--basalt-text-primary);font-size:inherit;font-weight:var(--basalt-font-weight-medium);line-height:inherit}.diagram-list-items{display:flex;flex-direction:column;gap:var(--basalt-space-1);margin:0;padding-inline-start:var(--basalt-space-5)}.diagram-list-exits{margin:var(--basalt-space-1) 0 0;padding-inline-start:var(--basalt-space-5)}@media(pointer:coarse){.diagram-toggle{min-height:var(--basalt-size-tap-min)}}@media(prefers-reduced-motion:reduce){.diagram-node,.diagram-line,.diagram-tip,.diagram-crow,.diagram-ring,.diagram-label,.diagram-diamond path{transition:none}}@media(prefers-contrast:more){.diagram-node[data-focal] :is(.diagram-kind,.diagram-detail,.diagram-keyseat,.diagram-ctype,.diagram-more){opacity:1}}@container (width >= 640px){.diagram:not([data-layout]):is(:is([data-type=architecture],[data-type=flowchart]):is([data-cols="1"],[data-cols="2"],[data-cols="3"]),:is([data-type=data-flow],[data-type=schema]):is([data-cols="1"],[data-cols="2"]),[data-type=sequence]:is([data-cols="1"],[data-cols="2"],[data-cols="3"],[data-cols="4"]))>.diagram-drawing{--_D: }}@container (width >= 696px){.diagram:not([data-layout])[data-type=data-flow][data-cols="3"]>.diagram-drawing{--_D: }}@container (width >= 768px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="4"][data-reach="0"],[data-type=flowchart][data-cols="4"],[data-type=schema][data-cols="3"]:not([data-marks]))>.diagram-drawing{--_D: }}@container (width >= 784px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 800px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="4"][data-reach="2"],[data-type=sequence][data-cols="5"])>.diagram-drawing{--_D: }}@container (width >= 816px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 832px){.diagram:not([data-layout])[data-type=architecture][data-cols="4"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 888px){.diagram:not([data-layout])[data-type=data-flow][data-cols="4"]>.diagram-drawing{--_D: }}@container (width >= 964px){.diagram:not([data-layout])[data-type=sequence][data-cols="6"]>.diagram-drawing{--_D: }}@container (width >= 976px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="5"][data-reach="0"],[data-type=flowchart][data-cols="5"])>.diagram-drawing{--_D: }}@container (width >= 992px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 1008px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="2"]>.diagram-drawing{--_D: }}@container (width >= 1024px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 1040px){.diagram:not([data-layout])[data-type=architecture][data-cols="5"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 1040px){.diagram:not([data-layout])[data-type=schema][data-cols="4"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 1080px){.diagram:not([data-layout])[data-type=data-flow][data-cols="5"]>.diagram-drawing{--_D: }}@container (width >= 1184px){.diagram:not([data-layout]):is([data-type=architecture][data-cols="6"][data-reach="0"],[data-type=flowchart][data-cols="6"])>.diagram-drawing{--_D: }}@container (width >= 1200px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="1"]>.diagram-drawing{--_D: }}@container (width >= 1216px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="2"]>.diagram-drawing{--_D: }}@container (width >= 1232px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="3"]>.diagram-drawing{--_D: }}@container (width >= 1248px){.diagram:not([data-layout])[data-type=architecture][data-cols="6"][data-reach="4"]>.diagram-drawing{--_D: }}@container (width >= 1272px){.diagram:not([data-layout])[data-type=data-flow][data-cols="6"]>.diagram-drawing{--_D: }}@container (width >= 1312px){.diagram:not([data-layout])[data-type=schema][data-cols="5"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 1584px){.diagram:not([data-layout])[data-type=schema][data-cols="6"]:not([data-marks])>.diagram-drawing{--_D: }}@container (width >= 792px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="3"]>.diagram-drawing{--_D: }}@container (width >= 1076px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="4"]>.diagram-drawing{--_D: }}@container (width >= 1360px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="5"]>.diagram-drawing{--_D: }}@container (width >= 1644px){.diagram:not([data-layout])[data-type=schema][data-marks][data-cols="6"]>.diagram-drawing{--_D: }}@media(scripting:none){.diagram:not(#basalt-diagram-no-id)>.diagram-drawing{--_D: initial}.diagram-list[hidden]{display:block!important}.diagram-foot,.diagram-entry[data-line],.diagram-hint{display:none}}@media(forced-colors:active){.diagram-svg,.diagram-lifes,.diagram-swatch,.diagram-arrow{forced-color-adjust:none}.diagram .diagram-line,.diagram .diagram-line[data-kind]{stroke:CanvasText}.diagram .diagram-tip,.diagram .diagram-tip[data-kind],.diagram .diagram-dot{fill:CanvasText}.diagram .diagram-tip[data-open],.diagram .diagram-tip[data-kind][data-open]{fill:none;stroke:CanvasText}.diagram .diagram-edge[data-dim] .diagram-line{stroke:GrayText}.diagram .diagram-edge[data-dim] :is(.diagram-tip:not([data-open]),.diagram-dot){fill:GrayText}.diagram .diagram-edge[data-dim] .diagram-tip[data-open]{stroke:GrayText}.diagram .diagram-edge[data-lit] .diagram-line{stroke:Highlight}.diagram .diagram-edge[data-lit] :is(.diagram-tip:not([data-open]),.diagram-dot){fill:Highlight}.diagram .diagram-edge[data-lit] .diagram-tip[data-open]{stroke:Highlight}.diagram :is(.diagram-crow,.diagram-ring){stroke:CanvasText}.diagram .diagram-ring{fill:Canvas}.diagram .diagram-edge[data-dim] :is(.diagram-crow,.diagram-ring){stroke:GrayText}.diagram .diagram-edge[data-lit] :is(.diagram-crow,.diagram-ring){stroke:Highlight}.diagram .diagram-life{stroke:GrayText}.diagram .diagram-label{color:CanvasText;forced-color-adjust:none}.diagram .diagram-label[data-on]{background:Canvas}.diagram .diagram-label[data-lit]{color:Highlight}.diagram .diagram-swatch-shape{fill:Canvas;stroke:CanvasText}.diagram .diagram-swatch[data-shape=group] .diagram-swatch-shape{fill:none;stroke:GrayText}.diagram .diagram-swatch[data-shape=focal] .diagram-swatch-shape{fill:CanvasText;stroke:CanvasText}.diagram[data-type=flowchart] .diagram-node:not([data-focal]),.diagram[data-type=flowchart] .diagram-node:not([data-focal])[data-near]{border-color:CanvasText}.diagram[data-measured][data-type=flowchart] .diagram-node[data-shape=decision][data-shape]{forced-color-adjust:none;background:none;border-color:transparent}.diagram .diagram-diamond{forced-color-adjust:none}.diagram .diagram-diamond path,.diagram .diagram-node[data-near] .diagram-diamond path{fill:Canvas;stroke:CanvasText}.diagram .diagram-group,.diagram .diagram-gbox{border-color:GrayText}.diagram .diagram-lane+.diagram-lane:before,.diagram .diagram-band:before{border-color:GrayText}.diagram .diagram-hint{color:GrayText}.diagram :is(.diagram-kind,.diagram-name,.diagram-detail,.diagram-glabel,.diagram-lane-name,.diagram-title,.diagram-source,.diagram-num,.diagram-mlabel,.diagram-route,.diagram-note,.diagram-band,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more,.diagram-legend,.diagram-fk-mark,.diagram-key-letters){color:CanvasText}.diagram .diagram-node:focus-visible{outline-color:Highlight}.diagram .diagram-node[data-focal],.diagram .diagram-node[data-focal][data-near]{forced-color-adjust:none;background:CanvasText;border-color:CanvasText}.diagram .diagram-node[data-focal] :is(.diagram-name,.diagram-kind,.diagram-detail,.diagram-tname,.diagram-cname,.diagram-keyseat,.diagram-ctype,.diagram-more){color:Canvas;opacity:1}.diagram .diagram-node[data-focal] .diagram-th{border-bottom-color:Canvas}.diagram .diagram-node[data-focal]:focus-visible{outline:var(--basalt-size-focus-width) solid Highlight}.diagram .diagram-node[data-focal][data-shape=decision] .diagram-diamond path{fill:CanvasText;stroke:CanvasText}.diagram .diagram-bar{fill:Canvas;stroke:CanvasText}.diagram .diagram-fbox,.diagram .diagram-ftab{border-color:GrayText}.diagram .diagram-felse:before{background:GrayText}.diagram :is(.diagram-ftab,.diagram-flabel,.diagram-fword){color:CanvasText;background:Canvas}.diagram .diagram-mark{display:none}.diagram .diagram-node[data-mark]>.diagram-mark+:is(.diagram-kind,.diagram-name){padding-inline-end:0}}@media print{.diagram-svg,.diagram-lifes,.diagram-swatch,.diagram-arrow,.diagram-mark,.diagram-node[data-focal]{-webkit-print-color-adjust:exact;print-color-adjust:exact}.diagram-hint,.diagram-tap-hint,.diagram-clear,.diagram-download{display:none!important}.diagram .diagram-edge :is(.diagram-line,.diagram-tip[data-open]){stroke:var(--basalt-diagram-edge)!important}.diagram .diagram-edge .diagram-line[data-kind=main]{stroke:var(--basalt-diagram-edge-main)!important}.diagram .diagram-edge :is(.diagram-tip:not([data-open]),.diagram-dot){fill:var(--basalt-diagram-edge)!important}.diagram .diagram-edge .diagram-tip[data-kind=main]:not([data-open]){fill:var(--basalt-diagram-edge-main)!important}.diagram .diagram-edge :is(.diagram-crow,.diagram-ring){stroke:var(--basalt-diagram-edge)!important}.diagram .diagram-label{color:var(--basalt-diagram-edge)!important}}.basalt-exporting,.basalt-exporting *{transition:none!important}.diagram-msg[data-ahead] .diagram-mlabel{color:var(--basalt-text-secondary);transition:color var(--basalt-duration-fast) var(--basalt-ease-out)}.diagram-edge[data-ahead] .diagram-line{stroke:var(--basalt-diagram-edge-dim)}.diagram-edge[data-ahead] .diagram-tip:not([data-open]){fill:var(--basalt-diagram-edge-dim)}.diagram-edge[data-ahead] .diagram-tip[data-open]{stroke:var(--basalt-diagram-edge-dim)}.diagram-text [data-n][data-ahead] [data-ink=label],.diagram[data-motion=animated][data-entrance=pending] .diagram-text [data-n] [data-ink=label]{color:var(--basalt-text-secondary)}.diagram-text [data-n][data-ahead] :is([data-ink=main],[data-ink=plain]),.diagram[data-motion=animated][data-entrance=pending] .diagram-text [data-n] :is([data-ink=main],[data-ink=plain]){color:var(--basalt-text-tertiary)}.diagram-text [data-n][data-arrival] [data-ink=num]{color:var(--basalt-text-primary)}@media(prefers-reduced-motion:reduce){.diagram-msg[data-ahead] .diagram-mlabel{transition:none}}@media(forced-colors:active){.diagram .diagram-msg[data-ahead] .diagram-mlabel{color:GrayText}.diagram .diagram-edge[data-ahead] .diagram-line{stroke:GrayText}.diagram .diagram-edge[data-ahead] .diagram-tip:not([data-open]){fill:GrayText}.diagram .diagram-edge[data-ahead] .diagram-tip[data-open]{stroke:GrayText}.diagram .diagram-text [data-n][data-ahead] [data-ink]{color:GrayText}.diagram .diagram-text [data-n][data-arrival] [data-ink=num]{color:Highlight}}@media print{.diagram .diagram-msg[data-ahead] .diagram-mlabel{color:var(--basalt-text-primary)!important}}} diff --git a/.agent/skills/basalt-html/parts/diagram.js b/.agent/skills/basalt-html/parts/diagram.js index b451542..7287f9b 100644 --- a/.agent/skills/basalt-html/parts/diagram.js +++ b/.agent/skills/basalt-html/parts/diagram.js @@ -1,6 +1,6 @@ -(()=>{var dn=["top","right","bottom","left"],fn=["main","plain","dashed"],$e=["one","zero-or-one","one-or-many","zero-or-many"],Ft={one:"Exactly one","zero-or-one":"Zero or one","one-or-many":"One or many","zero-or-many":"Zero or many"},un=[2,3,4,5,6],gt=t=>t==null||t===""?void 0:String(t),Lt=t=>Object.assign(Object.create(null),t),Ot=(t,e)=>t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;function Nt(t,e={}){const o=e.checks!==!1,c=[],l=m=>{c.push(m)},a=[],s=m=>{a.push(m)},r=t.legend??{},d={};for(const m of["main","plain","dashed","focal","group","activation"]){const $=gt(r[m]);$&&(d[m]=$)}const p=t.stepLabel,f=typeof p=="function"?m=>String(p(m)):typeof p=="string"?(m=>p.replace("{n}",String(m))):m=>`Step ${m}`,i=t.shapeLabels??{},u={terminal:gt(i.terminal)??"Start or end",step:gt(i.step)??"Step",decision:gt(i.decision)??"Decision"},b=t.heading===void 0?3:un.includes(t.heading)?t.heading:(l(`heading ${String(t.heading)} is not a level from 2 to 6: the title is an h3`),3),h=(m,$)=>m==null?"plain":fn.includes(m)?m:(l(`"${String(m)}" is not a kind of line (main, plain or dashed): ${$} is drawn plain`),"plain"),g=m=>{if(m!=null){if(dn.includes(m))return m;l(`"${String(m)}" is not a side (top, right, bottom or left): the derived side is used`)}},k=(m,$)=>typeof m=="number"&&Number.isInteger(m)&&m>=1?m:(t.layout==="auto"&&m==null||l(`${$} is ${JSON.stringify(m)}, not a whole number from 1: it is placed at 1`),1),M=[],z=[];let w=[];const q=[],O=[],N=t.type;if(["architecture","flowchart","data-flow","sequence","schema"].includes(N)||l(`"${String(N)}" is not a type of diagram (architecture, flowchart, data-flow, sequence or schema)`),N==="architecture"||N==="flowchart"){for(const m of t.nodes??[]){const $=N==="flowchart"&&m.shape==="decision"?"decision":N==="flowchart"&&m.shape==="terminal"?"terminal":"box",S=String(m.id??""),B=k(m.row,`the row of ${S}`);M.push({id:S,i:M.length,name:String(m.name??""),kind:$==="decision"?void 0:gt(m.kind),detail:$==="decision"?void 0:gt(m.detail),mono:!!m.detailMono,focal:!!m.focal,col:k(m.col,`the column of ${S}`),row:B,row2:B,branch:!!m.branch,shape:$,group:N==="architecture"?gt(m.group):void 0,mark:N==="architecture"?ne(m.mark,l):void 0})}if(N==="architecture"){const m=(t.groups??[]).map(I=>({id:String(I.id??""),label:String(I.label??""),parent:gt(I.parent)})),$=new Map(m.map(I=>[I.id,I])),S=I=>{if(!I.parent)return 1;const j=$.get(I.parent);return j?j.parent===I.id||j.id===I.id?(s(`the groups "${I.label}" and "${j.label}" are each other's parent`),I.parent=void 0,1):j.parent?(s(`the group "${I.label}" is a third level: groups nest two deep`),I.parent=void 0,1):2:(s(`the group "${I.label}" names the parent "${I.parent}", which is not a group`),I.parent=void 0,1)},B=m.map(S);m.forEach((I,j)=>q.push({...I,depth:B[j],members:M.filter(tt=>tt.group===I.id).map(tt=>tt.id),all:[]}));for(const I of q)I.all=[...I.members,...q.filter(j=>j.parent===I.id).flatMap(j=>j.members)];q.sort((I,j)=>I.depth-j.depth)}}else if(N==="data-flow"){w=(t.lanes??[]).map($=>({id:String($.id??""),label:String($.label??"")}));const m=new Map(w.map(($,S)=>[$.id,S+1]));for(const $ of t.nodes??[]){const S=String($.id??""),B=String($.lane??""),I=m.get(B);I===void 0&&l(`a node (${S}) names the lane "${B}", which is not in lanes`);const j=M.length+1;M.push({id:S,i:M.length,name:String($.name??""),kind:f(j),detail:gt($.detail),mono:!!$.detailMono,focal:!!$.focal,col:k($.col,`the column of ${S}`),row:I??1,row2:I??1,branch:!1,shape:"box",lane:I??1,laneLabel:w[(I??1)-1]?.label??B,step:j,mark:ne($.mark)})}}else if(N==="sequence"){(t.participants??[]).forEach((B,I)=>{const j=String(B.name??"");M.push({id:String(B.id??""),i:I,name:j,kind:gt(B.kind),mono:!1,focal:!!B.focal,col:I+1,row:1,row2:1,branch:!1,shape:"participant",short:gt(B.short)??j,mark:ne(B.mark)})});let m=0;const $=new Map(M.map(B=>[B.id,B.col])),S=(B,I)=>{let j=1/0,tt=-1/0;for(const Y of B??[]){if(!Y||typeof Y!="object")continue;if("band"in Y){I>0&&s(`the band "${String(Y.band)}" is inside a frame: a band is the whole figure's`),O.push({band:String(Y.band??"")});continue}if("frame"in Y){if(I>=2){s("a frame is a third level: frames nest two deep");continue}const vt=Y.frame==="alt"||Y.frame==="loop"||Y.frame==="opt"?Y.frame:"opt",St=vt==="alt"?Y.branches??[]:[{label:Y.label,steps:Y.steps}];vt==="alt"&&St.length<2&&s("an alt frame has one branch: it needs two or more");const pt=String(St[0]?.label??"");pt.length>40&&s(`the frame label "${pt}" is over 40 characters`);const ut=O.length;O.push({open:vt,label:pt,depth:I+1,a:0,b:0}),St.forEach((y,A)=>{if(A){const H=String(y.label??"");H.length>40&&s(`the frame label "${H}" is over 40 characters`),O.push({otherwise:H,depth:I+1})}y.steps?.length||s(`a frame or branch ("${String(y.label??"")}") is empty`);const[_,x]=S(y.steps??[],I+1);j=Math.min(j,_),tt=Math.max(tt,x);const L=O[ut];L.a=Math.min(L.a||1/0,_),L.b=Math.max(L.b,x)}),O.push({close:I+1});continue}m++;const mt=String(Y.label??"");mt.includes(` -`)&&s(`message ${m}'s label has a break: a message's second line is its note`);const nt=String(Y.from??""),lt=String(Y.to??"");O.push({n:m,from:nt,to:lt,label:_t(mt),note:gt(Y.note),kind:h(Y.kind,`message ${m}`),activate:Y.activate===!0||void 0,deactivate:Y.deactivate===!0||void 0});const ft=$.get(nt)??1,yt=$.get(lt)??1,wt=ft===yt?ft===M.length?ft-1:ft+1:ft;j=Math.min(j,ft,yt,wt),tt=Math.max(tt,ft,yt,wt)}return[j,tt]};S(t.steps??[],0);for(const B of O)"open"in B&&!Number.isFinite(B.a)&&(B.a=1,B.b=Math.max(1,M.length))}else if(N==="schema")for(const m of t.tables??[]){const $=String(m.name??""),[S,B]=Array.isArray(m.row)?m.row:[m.row,m.row],I=k(S,`the row of ${$}`),j=Math.max(I,k(B,`the last row of ${$}`)),tt=m.more===void 0||m.more===null?void 0:Number.isInteger(m.more)&&m.more>0?m.more:(l(`${$}'s "more" is ${JSON.stringify(m.more)}, not a whole number from 1: it is left out`),void 0);M.push({id:$,i:M.length,name:$,mono:!0,focal:!!m.focal,col:k(m.col,`the column of ${$}`),row:I,row2:j,branch:!1,shape:"table",more:tt,columns:(m.columns??[]).map(Y=>({name:String(Y.name??""),type:gt(Y.type),key:Y.key==="PK"||Y.key==="FK"?Y.key:(Y.key!==void 0&&Y.key!==null&&l(`${$}.${String(Y.name)}'s key is "${String(Y.key)}", not PK or FK: it is left out`),void 0)}))})}let D=!1;if(t.layout==="auto"&&(N==="architecture"||N==="flowchart"||N==="schema")){const m=N==="schema"?t.tables:t.nodes;o&&(m??[]).some(S=>S&&(S.col!==void 0||S.row!==void 0))&&l('a card under layout="auto" has a col or row, which is not read: there are no hints');const $=e.placement?.cells;$||(D=!0);for(const S of M){const B=$?.[S.id];S.col=B?.col??1,S.row=S.row2=B?.row??1}if($){const S=new Map;for(const B of M){const I=Ot($,B.id);if(!I){D=!0,l(`the placement has no cell for ${B.id}, so it is not used`);continue}const j=`${I.col},${I.row}`;S.has(j)&&(D=!0,l(`the placement puts ${S.get(j)} and ${B.id} in one cell, so it is not used`)),S.set(j,B.id)}}if($&&!D)for(const S of q){const B=S.all.map(nt=>M.find(lt=>lt.id===nt)).filter(Boolean);if(!B.length)continue;const I=Math.min(...B.map(nt=>nt.col)),j=Math.max(...B.map(nt=>nt.col)),tt=Math.min(...B.map(nt=>nt.row)),Y=Math.max(...B.map(nt=>nt.row)),mt=M.filter(nt=>!S.all.includes(nt.id)&&nt.col>=I&&nt.col<=j&&nt.row>=tt&&nt.row<=Y);mt.length&&(D=!0,l(`the placement puts ${mt.map(nt=>nt.id).join(", ")} inside the box of the group "${S.label}", so it is not used`))}}else t.layout==="auto"&&s(`layout="auto" is for an architecture, a flowchart or a schema, not a ${N}`);((N==="schema"?t.tables:N==="sequence"?t.participants:t.nodes)??[]).forEach((m,$)=>{if(!m||m.href===void 0||m.href===null)return;const S=String(m.href);if(N==="sequence"){s(`${M[$]?.id}: a participant cannot be a link (href)`);return}if(!S.trim()){s(`${M[$]?.id}'s href is empty`);return}const B=M[$];B&&(B.href=S,B.blank=m.target==="_blank")});const E=new Map;for(const m of M)m.id?E.has(m.id)&&l(`the id "${m.id}" is used twice`):l("a node has no id"),E.set(m.id,m);if(N==="schema"){const m=(S,B)=>{if(S==null)return;const I=S,j=$e.includes(I.from)?I.from:void 0;if(!j){s(`${B}'s cardinality "from" is ${JSON.stringify(I.from)}, not one, zero-or-one, one-or-many or zero-or-many: it is left out`);return}return I.to===void 0||I.to===null?{from:j,to:"one"}:I.to==="one"||I.to==="zero-or-one"?{from:j,to:I.to}:(s(`${B}'s cardinality "to" is ${JSON.stringify(I.to)}: a foreign key references one row at most (one or zero-or-one), so it is drawn as one`),{from:j,to:"one"})};(t.tables??[]).forEach(S=>(S.columns??[]).forEach((B,I)=>{const j=gt(B.references);if(!j&&B.cardinality!==void 0&&B.cardinality!==null&&s(`${String(S.name)}.${String(B.name)} states a cardinality but references nothing`),!j)return;const[tt,Y]=j.split("."),mt=E.get(tt??""),nt=mt?.columns?.findIndex(yt=>yt.name===Y)??-1;if(!mt||nt<0){l(`${String(S.name)}.${String(B.name)} references ${j}, which is not a shown column`);return}const lt=E.get(String(S.name??""));lt.columns[I].ref={table:tt,column:Y,row:nt};const ft=m(B.cardinality,`${String(S.name)}.${String(B.name)}`);ft&&(lt.columns[I].card=ft),z.push({i:z.length,from:lt.id,to:tt,kind:"plain",fromRow:I,toRow:nt,fk:!0,card:ft})}));const $=z.filter(S=>S.card).length;$&&$!S.card).map(S=>`${S.from}.${E.get(S.from).columns[S.fromRow].name}`).join(", ")} ${z.length-$===1?"has":"have"} none)`)}else if(N!=="sequence")for(const m of t.edges??[]){const $=String(m.from??""),S=String(m.to??"");if(!E.has($)||!E.has(S)){l(`a line names ${E.has($)?S:$}, which is not a node`);continue}const B=gt(m.label),I=B?.split(` -`)??[];I.length>2&&s(`the label "${_t(B)}" has more than one break: a label is two lines at most`),I.some(j=>j.length>ve)&&s(`a line of the label "${_t(B)}" is over ${ve} characters: longer words belong in the node or the summary`),z.push({i:z.length,from:$,to:S,kind:h(m.kind,`the line from ${$} to ${S}`),label:B,fromSide:g(m.fromSide),toSide:g(m.toSide),flow:N!=="flowchart"&&m.flow===!0?!0:void 0})}else for(const m of O)"n"in m&&(!E.has(m.from)||!E.has(m.to))&&l(`message ${m.n} names ${E.has(m.from)?m.to:m.from}, which is not a participant`);if(o&&N!=="sequence"&&!D){const m=new Map;for(const $ of M)for(let S=$.row;S<=$.row2;S++){const B=`${$.col}:${S}`;m.has(B)&&l(`${$.id} and ${m.get(B)} share the cell at column ${$.col}, row ${S}`),m.set(B,$.id)}}if(o&&!D){for(const $ of q){const S=$.all.map(j=>E.get(j));if(!S.length)continue;const B={c1:Math.min(...S.map(j=>j.col)),c2:Math.max(...S.map(j=>j.col)),r1:Math.min(...S.map(j=>j.row)),r2:Math.max(...S.map(j=>j.row2))};for(const j of M)!$.all.includes(j.id)&&j.col>=B.c1&&j.col<=B.c2&&j.row>=B.r1&&j.row<=B.r2&&l(`${j.id} is inside the box of the group "${$.label}" but not a member`);const I=S.map(j=>j.i);Math.max(...I)-Math.min(...I)+1!==I.length&&l(`the members of the group "${$.label}" are not next to each other in the author's order, so the stacked drawing cannot wrap them in one box`)}for(const $ of M)$.group&&!q.some(S=>S.id===$.group)&&l(`${$.id} names the group "${$.group}", which is not in groups`);M.filter($=>$.focal).length>1&&l("more than one node is focal: a diagram has one at most");const m=new Set(N==="sequence"?O.flatMap($=>"n"in $?[$.kind]:[]):z.map($=>$.kind));m.has("main")&&!d.main&&l("main lines are drawn but the legend has no words for them (legend.main)"),m.has("dashed")&&!d.dashed&&l("dashed lines are drawn but the legend has no words for them (legend.dashed)"),M.some($=>$.focal)&&!d.focal&&l("a focal node is drawn but the legend has no words for what it marks (legend.focal)")}const G=N==="architecture"||N==="data-flow",R=m=>Array.isArray(m)&&m.length>1?m.map(String):void 0,C=G&&t.packet&&typeof t.packet=="object"?t.packet:void 0,W=C&&R(C.path),T={animated:t.motion==="animated",pulse:G?R(t.pulse):void 0,packet:W?{path:W,repeat:C.repeat===!0,send:C.send}:void 0,run:N==="sequence"&&t.run===!0,firstVisit:t.entrance==="first-visit"||void 0};if(o)for(const m of M){const $=m.mark?.says;if(!$?.length)continue;const S=[m.name,m.kind,m.detail,m.laneLabel].filter(Boolean).join(" ").toLowerCase();$.some(B=>S.includes(B.toLowerCase()))||l(`${m.id}'s mark stands for ${$.join(" or ")}, and none of its words say so`)}const K=[];if(N==="sequence"){const m=new Map,$=new Map;for(const S of O)"n"in S&&($.set(S.from,S.n),$.set(S.to,S.n));for(const S of O)if("n"in S){if(S.activate){const B=m.get(S.to)??[];if(B.length>=3)s(`message ${S.n} opens a fourth bar on ${S.to}: three deep at most`);else{const I={who:S.to,from:S.n,to:S.n,depth:B.length+1};B.push(I),K.push(I),m.set(S.to,B)}}if(S.deactivate){const I=m.get(S.from)?.pop();I?I.to=S.n:s(`message ${S.n} closes a bar on ${S.from}, which has none open`)}}for(const[S,B]of m)for(const I of B)I.to=Math.max(I.from,$.get(S)??I.from)}const U=t.frameLabels??{},st={opt:gt(U.opt)??"Only if",loop:gt(U.loop)??"Repeats",alt:gt(U.alt)??"One of these",else:gt(U.else)??"Otherwise"},X=t.layout==="auto"&&!D?e.placement:void 0;let J=Math.max(1,X?.cols??1,...M.map(m=>m.col));if(e.rtl){for(const $ of M)$.col=J-$.col+1;const m=$=>$==="left"?"right":$==="right"?"left":$;for(const $ of z)$.fromSide=m($.fromSide),$.toSide=m($.toSide);for(const $ of O)if("open"in $){const[S,B]=[J-$.b+1,J-$.a+1];$.a=S,$.b=B}J=Math.max(1,X?.cols??1,...M.map($=>$.col))}const Z=N==="data-flow"?Math.max(1,w.length):Math.max(1,X?.rows??1,...M.map(m=>m.row2)),Q={type:N,title:String(t.title??""),heading:b,legend:d,nodes:M,byId:E,edges:z,groups:q,lanes:w,steps:O,bars:K,frameWords:st,cols:J,rows:Z,shapeLabels:u,stepWord:f,warnings:c,errors:a,motion:T,memo:new Map,rtl:e.rtl||void 0,unplaced:D||void 0,text:N==="sequence"&&t.variant==="text"||void 0,marks:z.some(m=>m.card)||void 0};if(t.layout==="auto"&&!D&&N!=="schema"&&hn(Q),o)for(const[m,$]of Object.entries(Fe(Q)))$>=48&&l(`${m} grows to ${$}px to hold the lines on one side: use another side`);return o&&M.length>100&&l(`the figure has ${M.length} cards: more than 100, which automatic layout places on the main thread`),o&&M.length>1&&!D&&!Jt(Q)&&l("some part cannot be reached from another by the arrow keys where the figure is drawn, so its arrows keep the author's order"),Q}function hn(t){const e=new Set(t.nodes.map(s=>`${s.col},${s.row}`)),n=(s,r)=>{const d=[];for(let p=Math.min(s,r)+1;p{const r=t.byId.get(s.from),d=t.byId.get(s.to),p=d.col>r.col?"right":"left",f=d.row>r.row?"bottom":"top",i=d.col>r.col?"left":"right",u=d.row>r.row?"top":"bottom",b=(k,M,z,w)=>n(k,M).map(q=>w?[q,z]:[z,q]);let h;const g=k=>(k==="right"?r.col1:k==="bottom"?r.row1)?[{sides:[k,k],cells:[]}]:[];return r.row===d.row?h=[{sides:[p,i],cells:b(r.col,d.col,r.row,!0)},...g("bottom"),...g("top")]:r.col===d.col?h=[{sides:[f,u],cells:b(r.row,d.row,r.col,!1)},...g("right"),...g("left")]:h=[{sides:[p,u],cells:[...b(r.col,d.col,r.row,!0),[d.col,r.row],...b(r.row,d.row,d.col,!1)]},{sides:[f,i],cells:[...b(r.row,d.row,r.col,!1),[r.col,d.row],...b(r.col,d.col,d.row,!0)]},{sides:[p,i],cells:b(r.col,d.col,r.row,!0)},{sides:[f,u],cells:b(r.row,d.row,r.col,!1)}],h.filter(k=>k.cells.every(([M,z])=>!e.has(`${M},${z}`)))},c=new Map,l=new Set;for(const s of t.edges)if(s.fromSide||s.toSide){const[r,d]=de(t.byId.get(s.from),t.byId.get(s.to)),p=s.fromSide??r,f=s.toSide??d;l.add(`${s.from}.${p}`);for(const[i,u]of[[s.from,p],[s.to,f]])c.set(`${i}.${u}`,(c.get(`${i}.${u}`)??0)+1)}const a=t.edges.map((s,r)=>r).sort((s,r)=>o(t.edges[s]).length-o(t.edges[r]).length||+(t.edges[r].kind==="main")-+(t.edges[s].kind==="main")||s-r);for(const s of a){const r=t.edges[s];if(r.fromSide||r.toSide)continue;const d=(f,i,u)=>{const b=`${f}.${i}`;return(c.get(b)??0)>=3?!1:t.byId.get(f).shape!=="decision"?!0:u?!c.has(b):!l.has(b)},p=o(r).find(f=>d(r.from,f.sides[0],!0)&&d(r.to,f.sides[1],!1));if(p){l.add(`${r.from}.${p.sides[0]}`);for(const[f,i]of[[r.from,p.sides[0]],[r.to,p.sides[1]]])c.set(`${f}.${i}`,(c.get(`${f}.${i}`)??0)+1);r.fromSide=p.sides[0],r.toSide=p.sides[1]}}}function ne(t,e){if(typeof t=="string")return t?{id:t}:void 0;if(!t||typeof t!="object")return;const n=t,o=be(gt(n.onLight),e);if(o)return{onLight:o,onDark:be(gt(n.onDark),e)??o,says:Array.isArray(n.says)?n.says.map(String):void 0}}function be(t,e){if(t){if(/^data:image\//i.test(t.trim()))return t;try{if(/^https?:$/.test(new URL(t,"https://basalt.invalid/").protocol)&&!/^http:/i.test(t.trim()))return t}catch{}e?.(`a card's mark ${JSON.stringify(t.slice(0,60))} is not a relative path, https or a data: image, so it is not drawn`)}}var we=t=>`url("${t.replace(/[\\"\n\r\f;]/g,e=>e===` -`?"\\a ":e==="\r"?"\\d ":e==="\f"?"\\c ":e===";"?"\\3b ":`\\${e}`)}")`;function jt(t,e,n){return t.memo.has(e)||t.memo.set(e,n()),t.memo.get(e)}var ve=28,Vt=t=>t.includes(` -`)?2:1,_t=t=>t.replace(/\n/g," "),Wt=t=>{const e=t.trim();return e?/[.!?]$/.test(e)?e:`${e}.`:""};function xe(t,e){return t.legend[e]}function pn(t,e){return e.shape==="decision"?"decision":e.shape==="terminal"?t.edges.some(n=>n.from===e.id)?"start":"end":e.kind??"step"}function gn(t,e){return jt(t,`sentence:${e.i}`,()=>mn(t,e))}function mn(t,e){const n=[];if(t.type==="schema"){n.push(`${e.name}, table.`);const o=(e.columns??[]).filter(l=>l.ref).map(l=>`${l.ref.table} (${l.name}${l.card?`: ${ke(e.id,l.ref.table,l.card)}`:""})`),c=t.edges.filter(l=>l.to===e.id).map(l=>`${l.from} (${t.byId.get(l.from).columns[l.fromRow].name}${l.card?`: ${ke(l.from,l.to,l.card)}`:""})`);o.length&&n.push(`References ${o.join(", ")}.`),c.length&&n.push(`Referenced by ${c.join(", ")}.`)}else if(t.type==="sequence"){const o=t.steps.filter(a=>"n"in a&&a.from===e.id).length,c=t.steps.filter(a=>"n"in a&&a.to===e.id).length;n.push(Wt(e.kind?`${e.name}, ${e.kind}`:e.name)),n.push(`Sends ${o} ${o===1?"message":"messages"} and receives ${c}.`);const l=Me(t,e);l&&n.push(l.trim())}else{const o=t.type==="data-flow"?`${t.stepWord(e.step)} of ${t.nodes.length}, ${e.laneLabel}`:t.type==="flowchart"?pn(t,e):e.kind;if(n.push(Wt(o?`${e.name}, ${o}`:e.name)),e.detail&&n.push(Wt(e.detail)),e.group){const a=t.groups.find(r=>r.id===e.group),s=a?.parent?t.groups.find(r=>r.id===a.parent):void 0;a&&n.push(s?`In ${a.label}, in ${s.label}.`:`In ${a.label}.`)}const c=t.edges.filter(a=>a.to===e.id).map(a=>`${t.byId.get(a.from).name}${a.label?` (${_t(a.label)})`:""}`),l=t.edges.filter(a=>a.from===e.id).map(a=>`${t.byId.get(a.to).name}${a.label?` (${_t(a.label)})`:""}`);c.length&&n.push(`From: ${c.join(", ")}.`),l.length&&n.push(`To: ${l.join(", ")}.`)}return e.focal&&t.legend.focal&&n.push(Wt(t.legend.focal)),n.join(" ")}var yn=(t,e,n,o)=>[`${Ft[n.from].toLowerCase()} `,o(t),` to ${Ft[n.to].toLowerCase()} `,o(e)],ke=(t,e,n)=>`${Ft[n.from].toLowerCase()} ${t} to ${Ft[n.to].toLowerCase()} ${e}`;function Me(t,e){const n=t.bars.filter(c=>c.who===e.id&&c.depth===1);return n.length?` ${t.legend.activation??"Working"} during ${n.map(c=>c.from===c.to?`message ${c.from}`:`messages ${c.from} to ${c.to}`).join(" and ")}.`:""}function $n(t,e,n,o){const c=n.pointerType;if(c!=="touch"&&c!=="pen")return;const l=t.querySelector(`.${e}-drawing`),a=n.target;if(!l||!a||!l.contains(a)||!t.querySelector(`.${e}-edge`))return;const s=a.closest(`.${e}-node`);if(!s?.hasAttribute("href"))return s?s.dataset.node===o?null:s.dataset.node??null:o===null?void 0:null}function Se(t){return t.type==="architecture"?"a part":t.type==="sequence"?"a participant":t.type==="schema"?"a table":"a step"}function v(t,e,...n){const o=[];for(const c of n.flat(1/0))c!=null&&c!==!1&&!Array.isArray(c)&&o.push(c);return{t,a:e??{},c:o}}var bn={"&":"&","<":"<",">":">",'"':""","'":"'"},bt=t=>t.replace(/[&<>"']/g,e=>bn[e]),wn=" br img input meta link hr path polygon polyline circle rect line ";function oe(t,e={}){if(typeof t=="string")return bt(t);if("slot"in t)return e[t.slot]??"";if(!/^[a-z][a-z0-9]*$/.test(t.t))throw new Error(`diagram: "${t.t}" is not an element name`);let n="";for(const[o,c]of Object.entries(t.a))if(!(c==null||c===!1)){if(!/^[a-z][a-z0-9:-]*$/i.test(o))throw new Error(`diagram: "${o}" is not an attribute name`);n+=c===!0?` ${o}`:` ${o}="${bt(String(c))}"`}return wn.includes(` ${t.t} `)&&!t.c.length?t.t==="path"||t.t==="polygon"||t.t==="polyline"||t.t==="circle"||t.t==="rect"||t.t==="line"?`<${t.t}${n}/>`:`<${t.t}${n}>`:`<${t.t}${n}>${t.c.map(o=>oe(o,e)).join("")}`}var vn=t=>({title:`${t}-title`,summary:`${t}-summary`,keys:`${t}-keys`,list:`${t}-list`,toggle:`${t}-toggle`});function Rt(t,e){return!e.layout||e.bare?!1:e.layout==="drawn"?!0:t.type!=="sequence"&&t.type!=="schema"}function xn(t,e){return t.type==="sequence"||t.type==="schema"?e.layout==="drawn":!0}function Kt(t,e){const n=e.all.map(o=>t.byId.get(o));return n.length?{c1:Math.min(...n.map(o=>o.col)),c2:Math.max(...n.map(o=>o.col)),r1:Math.min(...n.map(o=>o.row)),r2:Math.max(...n.map(o=>o.row2))}:null}function Ee(t){return jt(t,"group-edges",()=>{const e=[0,0,0,0];for(const n of t.groups){const o=Kt(t,n);if(!o)continue;[o.r1===1,o.c2===t.cols,o.r2===t.rows,o.c1===1].forEach((l,a)=>{l&&(e[a]=Math.max(e[a],Ae(t,n,a)))})}return e})}function Ae(t,e,n){const o=Kt(t,e);return t.groups.filter(a=>a.parent===e.id).some(a=>{const s=Kt(t,a);return s&&[s.r1===o.r1,s.c2===o.c2,s.r2===o.r2,s.c1===o.c1][n]})?2:1}function Le(t){const e=Ee(t);return e[1]+e[3]}function ae(t){return t.type==="sequence"?t.nodes.length:t.cols}function _e(t){return jt(t,"plan",()=>kn(t))}function kn(t){const e=t.nodes,n=g=>t.type==="data-flow"||!e[g].branch,o=t.edges.map(g=>{const k=t.byId.get(g.from).i,M=t.byId.get(g.to).i,w=e.slice(Math.min(k,M)+1,Math.max(k,M)).every(q=>!n(q.i));return M===k+1&&!(n(k)&&!n(M))?"down":M===k-1?"up":M>k&&n(k)&&!n(M)&&w?"trunk":M>k&&n(k)&&n(M)&&w?"rail":M>k?"end-down":"end-up"}),c=t.edges.map((g,k)=>({e:g,k})).filter(({k:g})=>o[g]==="end-down"||o[g]==="end-up"),l=g=>{const k=t.byId.get(g.from).i,M=t.byId.get(g.to).i;return[Math.min(k,M),Math.max(k,M)]},a=(g,k)=>{const[M,z]=l(g),[w,q]=l(k);return M{const k=t.byId.get(g.from).i,[M,z]=l(g);return!n(k)&&e.slice(M+1,z).every(w=>!n(w.i))&&c.every(w=>w.e===g||!a(w.e,g))}),r=c.length>0&&(t.type==="data-flow"||!s),d=g=>{const[k,M]=l(g);return M-k},p=t.edges.map(()=>0);let f=!1;const i=[];for(const g of[...c].sort((k,M)=>d(k.e)-d(M.e)||k.k-M.k)){let k=0;for(const M of i)a(M.e,g.e)&&(k=Math.max(k,p[M.k]+1));p[g.k]=k,k>3&&(f=!0),i.push(g)}const u=Math.max(0,...c.map(({k:g})=>p[g]+1)),b=t.edges.map(()=>.5);for(const g of e){const k=c.filter(({e:w})=>w.from===g.id);if(k.length<2)continue;const M=k.filter(({k:w})=>o[w]==="end-down").sort((w,q)=>d(q.e)-d(w.e)||w.k-q.k);[...k.filter(({k:w})=>o[w]==="end-up").sort((w,q)=>d(w.e)-d(q.e)||q.k-w.k),...M].forEach(({k:w},q,O)=>{b[w]=O.length===2?q===0?1/3:2/3:(q+1)/(O.length+1)})}const h=Lt();for(let g=1;g{const G=o[E],R=t.byId.get(dt.from).i,C=t.byId.get(dt.to).i,W=C===g&&(G==="down"||G==="trunk"||G==="rail"||G==="end-down"),T=R===g&&C===g-1&&G==="up",K=C===g-1&&G==="end-up";W&&(G==="trunk"||G==="end-down")&&(q=!0),K&&(O=!0),(W||T||K)&&dt.label&&(z++,w=Math.max(w,G==="trunk"?40:48))}),(z>1||q&&O)&&(w=64);const N=c.filter(({e:dt,k:E})=>o[E]==="end-down"&&t.byId.get(dt.to).i===g).length,D=c.filter(({e:dt,k:E})=>o[E]==="end-up"&&t.byId.get(dt.to).i===g-1).length;w+=20*Math.max(0,N-1)+20*Math.max(0,D-1),h[k.id]=w}return{routes:o,gutter:r,lanes:p,exits:b,gaps:h,third:f,laneCount:u}}var zt=(t,e)=>({width:t,height:e,viewBox:`0 0 ${t} ${e}`,"aria-hidden":"true",focusable:"false"});function Ie(t,e){const n=e==="fk"?"plain":e,o=n==="main"?8:8.5,c=24,l=n==="dashed"?c-1:c-7;return v("svg",{class:`${t}-swatch`,"data-kind":n,...zt(24,16)},e==="fk"?v("circle",{class:`${t}-dot`,cx:3,cy:o,r:3}):null,v("path",{class:`${t}-line`,"data-kind":n,d:`M${e==="fk"?3:0} ${o}H${l}`}),n==="dashed"?v("path",{class:`${t}-tip`,"data-kind":n,"data-open":"",d:`M${c-8} ${o-4}L${c} ${o}L${c-8} ${o+4}`}):v("path",{class:`${t}-tip`,"data-kind":n,d:`M${c} ${o}L${c-8} ${o-4}L${c-8} ${o+4}Z`}))}function Mn(t,e){const{crow:n,ring:o}=qe(e,24,8.5,-1);return v("svg",{class:`${t}-swatch`,"data-card":e,...zt(24,16)},v("path",{class:`${t}-line`,"data-kind":"plain",d:"M0 8.5H24"}),v("path",{class:`${t}-crow`,d:n}),o?v("circle",{class:`${t}-ring`,cx:o.x,cy:o.y,r:o.r}):null)}function qe(t,e,n,o,c=8,l=6){const a=u=>String(Math.round(u*100)/100),s=u=>e+o*u,r=c/2,d=u=>`M${a(s(u-.5))} ${a(n-r)}V${a(n+r)}`,p=t==="one-or-many"||t==="zero-or-many",f=t==="zero-or-one"||t==="zero-or-many";let i=p?`M${a(e)} ${a(n-r)}L${a(s(7.5))} ${a(n)}L${a(e)} ${a(n+r)}`:d(4);return f||(i+=d(p?11:8)),{crow:i,ring:f?{x:Math.round(s(10.5)*100)/100,y:n,r:l/2}:void 0}}function Ht(t,e){return e==="decision"?v("svg",{class:`${t}-swatch`,"data-shape":e,...zt(16,16)},v("path",{class:`${t}-swatch-shape`,d:"M8 2.5L14.5 8L8 13.5L1.5 8Z"})):e==="terminal"?v("svg",{class:`${t}-swatch`,"data-shape":e,...zt(16,16)},v("rect",{class:`${t}-swatch-shape`,x:.5,y:3.5,width:15,height:9,rx:4.5})):v("svg",{class:`${t}-swatch`,"data-shape":e,...zt(16,16)},v("rect",{class:`${t}-swatch-shape`,x:.5,y:2.5,width:15,height:11,rx:2}))}function Oe(t,e){return jt(e,`key:${t}`,()=>En(t,e))}var Sn=Oe;function En(t,e){const n=[],o=(a,s,r={})=>n.push(v("li",{class:`${t}-entry`,...r},a,v("span",null,s)));if(e.type==="schema"){const a=new Set(e.nodes.flatMap(s=>(s.columns??[]).map(r=>r.key)));for(const[s,r]of[["PK","Primary key"],["FK","Foreign key"]])a.has(s)&&n.push(v("li",{class:`${t}-entry`},v("span",{class:`${t}-key-letters`,"aria-hidden":"true"},s),v("span",null,r)))}if(e.type==="flowchart"){const a=new Set(e.nodes.map(s=>s.shape));a.has("terminal")&&o(Ht(t,"terminal"),e.shapeLabels.terminal),a.has("box")&&o(Ht(t,"box"),e.shapeLabels.step),a.has("decision")&&o(Ht(t,"decision"),e.shapeLabels.decision)}const c=new Set(e.type==="sequence"?e.steps.flatMap(a=>"n"in a?[a.kind]:[]):e.edges.filter(a=>!a.fk).map(a=>a.kind)),l=(a,s)=>v("span",{class:`${t}-key-glyph`,"data-ink":s,"aria-hidden":"true"},a);for(const a of["main","plain","dashed"]){const s=e.legend[a];c.has(a)&&s&&o(e.text?l(a==="main"?"━━▶":a==="dashed"?"┄┄▷":"──▶",a==="main"?"main":"plain"):Ie(t,a),s,{"data-line":e.text?void 0:""})}if(e.type==="schema"&&e.edges.length){e.edges.some(s=>!s.card)&&o(Ie(t,"fk"),e.legend.plain??"A foreign key, to the key it references",{"data-line":"","data-when":"drawn"});const a=new Set(e.edges.flatMap(s=>s.card?[s.card.from,s.card.to]:[]));for(const s of $e)a.has(s)&&o(Mn(t,s),Ft[s],{"data-line":"","data-when":"drawn","data-card":s});n.push(v("li",{class:`${t}-entry`,"data-when":"stacked"},v("span",{class:`${t}-fk-mark`,"aria-hidden":"true"},e.rtl?"←":"→"),v("span",null,"The table a foreign key references")))}if(e.type==="sequence"){e.bars.length&&o(e.text?l("┃","working"):v("svg",{class:`${t}-swatch`,"data-shape":"bar",...zt(16,16)},v("path",{class:`${t}-life`,d:"M8 0V16"}),v("rect",{class:`${t}-bar`,x:4.5,y:2.5,width:7,height:11,rx:1.5})),e.legend.activation??"Working",e.text?{}:{"data-when":"drawn"});const a=new Set(e.steps.flatMap(s=>"open"in s?[s.open]:[]));for(const s of["opt","loop","alt"])a.has(s)&&n.push(v("li",{class:`${t}-entry`},v("span",{class:`${t}-key-letters`,"data-op":"","aria-hidden":"true"},s),v("span",null,e.frameWords[s])))}return e.nodes.some(a=>a.focal)&&e.legend.focal&&o(e.text?l("╔═╗","focal"):Ht(t,"focal"),e.legend.focal,{"data-focal":""}),e.groups.length&&e.legend.group&&o(Ht(t,"group"),e.legend.group),n.length?v("div",{class:`${t}-key`},v("ul",{class:`${t}-legend`,"aria-label":"Key"},n)):null}function An(t,e){const n=e==="main"?6:6.5;return v("svg",{class:`${t}-arrow`,"data-kind":e,...zt(20,12)},v("path",{class:`${t}-line`,"data-kind":e,d:`M0 ${n}H${e==="dashed"?19:13}`}),e==="dashed"?v("path",{class:`${t}-tip`,"data-kind":e,"data-open":"",d:`M12 ${n-4}L20 ${n}L12 ${n+4}`}):v("path",{class:`${t}-tip`,"data-kind":e,d:`M20 ${n}L12 ${n-4}L12 ${n+4}Z`}))}function se(t,e){if(!e.href)return e.name;const n=e.name.trimEnd().lastIndexOf(" ");return[n<0?"":e.name.slice(0,n+1),v("span",{class:`${t}-name-end`},n<0?e.name:e.name.slice(n+1))]}function Ln(t,e,n){if(n.shape==="decision")return[v("span",{class:`${t}-words`},v("span",{class:`${t}-name`},se(t,n)))];const o=[];return e.type==="data-flow"?o.push(v("span",{class:`${t}-kind`},n.kind,v("span",{class:`${t}-lane-word`},` · ${n.laneLabel}`))):n.kind&&o.push(v("span",{class:`${t}-kind`},n.kind)),o.push(v("span",{class:`${t}-name`},se(t,n))),n.detail&&o.push(v("span",{class:`${t}-detail`,"data-mono":n.mono?"":void 0},n.mono?v("span",{class:`${t}-runs`},Qt(n.detail).flatMap((c,l)=>[l?" ":"",v("span",{class:`${t}-run`},c)])):n.detail)),o}function _n(t,e,n){return[v("span",{class:`${t}-th`},v("span",{class:`${t}-tname`},se(t,e))),v("span",{class:`${t}-rows`},(e.columns??[]).map((o,c)=>v("span",{class:`${t}-row`,"data-row":c,"data-key":o.key},v("span",{class:`${t}-keyseat`},o.key??""),v("span",{class:`${t}-cname`},o.name),o.ref?v("span",{class:`${t}-ctype`,"data-ref":""},`${n.rtl?"←":"→"} ${o.ref.table}`):o.type?v("span",{class:`${t}-ctype`},o.type):null))),e.more?v("span",{class:`${t}-more`},`+ ${e.more} more`):null]}var Ce=t=>{const e={32:"space-8",40:"space-10",48:"space-12",64:"space-16"};return e[t]?`var(--basalt-${e[t]})`:`${t}px`};function Zt(t,e,n,o){const{P:c}=t,l=xn(e,o)||o.keep===n.id,a=Rt(e,o),s=o.layout==="drawn"&&o.rows,r=[`--_c:${n.col}`,`--_r:${s?2*n.row:n.row}`,`--_r2:${s?2*n.row2+1:n.row2+1}`];e.type==="data-flow"&&r.push(`--_lc:${n.col+1}`),e.type==="sequence"&&r.push(`--_c2:${n.col+1}`);const d=t.plan;if(d&&n.i>0){const b=Ot(d.gaps,n.id)??32,h=Ot(o.grow,n.id)??0;r.push(`--_gap:${h?`calc(${Ce(b)} + var(--basalt-space-4) * ${h})`:Ce(b)}`)}const p=Ot(o.heights,n.id);p&&r.push(`--_h:${p}px`);const f=Ot(Fe(e),n.id);f&&r.push(`--_mh:${f}px`);const i=Ot(o.words,n.id);i&&r.push(`--_ww:${i}px`);const u=a?o.stop===n.id?0:-1:o.keep===n.id?-1:void 0;return v(n.href?"a":"div",{class:`${c}-node`,href:n.href,target:n.href&&n.blank?"_blank":void 0,rel:n.href&&n.blank?"noopener noreferrer":void 0,"data-link":n.href?n.blank?"external":"":void 0,"data-node":n.id,"data-shape":n.shape,"data-focal":n.focal?"":void 0,"data-branch":n.branch?"":void 0,"data-mark":n.mark?n.mark.id??"":void 0,"data-level":t.level,style:r.join(";"),role:l&&!n.href?"img":void 0,"aria-label":l||n.href?gn(e,n):void 0,tabindex:u},n.shape==="decision"?v("svg",{class:`${c}-diamond`,viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",focusable:"false"},v("path",{d:"M50 0L100 50L50 100L0 50Z"})):null,n.mark?v("span",{class:`${c}-mark`,"aria-hidden":"true",style:n.mark.onLight?`--_ml:${we(n.mark.onLight)};--_md:${we(n.mark.onDark??n.mark.onLight)}`:void 0}):null,n.shape==="table"?_n(c,n,e):Ln(c,e,n))}function In(t,e,n){const{P:o}=t,c=[];if(e.type==="data-flow"&&c.push(...e.lanes.map((r,d)=>v("div",{class:`${o}-lane`,style:`--_r:${d+1}`,"aria-hidden":"true"},v("span",{class:`${o}-lane-name`},r.label)))),e.type==="architecture")for(const r of e.groups){const d=Kt(e,r);if(!d)continue;const p=[0,1,2,3].map(f=>Ae(e,r,f));c.push(v("div",{class:`${o}-gbox`,"data-group":r.id,"data-depth":r.depth>1?r.depth:void 0,style:`--_c:${d.c1};--_c2:${d.c2+1};--_r:${d.r1};--_r2:${d.r2+1}${p[0]>1?";--_gt:2":""}${p[1]>1?";--_ge:2":""}${p[2]>1?";--_gb:2":""}${p[3]>1?";--_gs:2":""}`,"aria-hidden":"true"},v("span",{class:`${o}-glabel`},r.label)))}if(e.text)return[v("pre",{class:`${o}-text`,"aria-hidden":"true","data-art":n.art?"":void 0},v("code",{class:`${o}-text-ink`},qn(o,e)))];if(e.type==="sequence")return c.push(v("ul",{class:`${o}-cast`},e.nodes.map(r=>v("li",{class:`${o}-actor`,style:e.rtl?`--_ac:${r.col}`:void 0},Zt(t,e,r,n))))),c.push(On(t,e)),c;const l=r=>{const d=r.group?e.groups.find(p=>p.id===r.group):void 0;return d?.parent?e.groups.find(p=>p.id===d.parent):d},a=(r,d,p)=>{const f=t.plan?Ot(n.grow,d[0].id)??0:0,i=d[0],u=t.plan&&i.group===r.id?e.edges.filter((g,k)=>g.to===i.id&&(t.plan.routes[k]==="trunk"||t.plan.routes[k]==="end-down")):[],b=Math.max(0,...u.map(g=>g.label?Vt(g.label):0)),h=[f?`--_ggrow:${f}`:"",b?`--_tl:${b}`:""].filter(Boolean).join(";");return v("div",{class:`${o}-group`,"data-group":r.id,"data-depth":r.depth>1?r.depth:void 0,"data-turn":u.length?"":void 0,style:h||void 0},v("span",{class:`${o}-glabel`,"aria-hidden":"true"},r.label),p)};let s=0;for(;sh.id===p[i].group):void 0;if(!u){f.push(Zt(t,e,p[i],n)),i++;continue}const b=[];for(;iZt(t,e,h,n))))}c.push(a(d,p,f))}return c}function qn(t,e){const n=[],o=r=>v("span",{class:`${t}-tx-name`},r),c=r=>r==="main"?"━▶":r==="dashed"?"┄▷":"─▶",l=(r,d,p,...f)=>v("span",{class:`${t}-tx-line`,...r,style:p?`--_in:${d+p};--_hang:${p}`:`--_in:${d}`},...f);n.push(l({"data-ink":"names"},0,0,e.nodes.flatMap((r,d)=>[d?" · ":"",o(r.name)])));const a=String(Math.max(1,...e.steps.map(r=>"n"in r?r.n:0))).length;let s=0;for(const r of e.steps){const d=2*s;if("band"in r){n.push(l({"data-ink":"band"},d,0,`── ${r.band} ──`));continue}if("open"in r){n.push(l({"data-ink":"frame"},d,0,v("span",{"data-ink":"op"},`[${r.open}]`),` ${r.label}`)),s++;continue}if("otherwise"in r){n.push(l({"data-ink":"frame"},2*Math.max(0,s-1),0,v("span",{"data-ink":"op"},"[else]"),` ${r.otherwise}`));continue}if("close"in r){s=Math.max(0,s-1),n.push(l({"data-ink":"frame"},2*s,0,"[end]"));continue}const p=e.byId.get(r.from)?.name??r.from,f=e.byId.get(r.to)?.name??r.to,i=a+2;n.push(l({"data-n":r.n},d,i,v("span",{"data-ink":"num"},String(r.n).padStart(a,"0"))," ",o(p)," ",v("span",{class:`${t}-tx-to`},v("span",{"data-ink":r.kind==="main"?"main":"plain"},c(r.kind))," ",f))),n.push(l({"data-n":r.n},d+i,0,v("span",{"data-ink":"label"},r.label))),r.note&&n.push(l({"data-n":r.n},d+i,0,v("span",{"data-ink":"note"},r.note)))}return n}function On(t,e){const{P:n}=t,o=[],c=[],l=()=>c.length?c[c.length-1].el.c:o;let a=null;for(const s of e.steps){if("band"in s){a=null,l().push(v("p",{class:`${n}-band`},v("span",null,s.band)));continue}if("open"in s){a=null;const h=c[c.length-1],g=h?`;--_fis:${s.a===h.a?1:0};--_fie:${s.b===h.b?1:0}`:"",k=v("div",{class:`${n}-frame`,"data-op":s.open,"data-depth":s.depth,style:`--_a:${s.a};--_b:${s.b+1}${g}`},v("span",{class:`${n}-fbox`,"aria-hidden":"true"}),v("p",{class:`${n}-fhead`},v("span",{class:`${n}-ftab`,"aria-hidden":"true"},s.open),v("span",{class:`${n}-flabel`},v("span",{class:t.hidden},`${e.frameWords[s.open]}: `),s.label)));l().push(k),c.push({el:k,a:s.a,b:s.b});continue}if("otherwise"in s){a=null,l().push(v("p",{class:`${n}-felse`},v("span",{class:`${n}-fword`,"aria-hidden":"true"},"else"),v("span",{class:`${n}-flabel`},v("span",{class:t.hidden},`${e.frameWords.else}: `),s.otherwise)));continue}if("close"in s){a=null,c.pop();continue}a||(a=v("ol",{class:`${n}-msgs`,start:s.n}),l().push(a));const r=e.byId.get(s.from),d=e.byId.get(s.to),p=r?.col??1,f=d?.col??1,i=p===f,u=i&&(e.rtl?p!==1:p===e.nodes.length),b=xe(e,s.kind);a.c.push(v("li",{class:`${n}-msg`,"data-kind":s.kind,"data-from":s.from,"data-to":s.to,"data-self":i?u?"start":"end":void 0,style:`--_a:${Math.min(p,f)};--_b:${Math.max(p,f)+1}`},v("span",{class:`${n}-said`},v("span",{class:`${n}-num`},String(s.n)),v("span",{class:`${n}-mlabel`},s.label)),v("span",{class:`${n}-route`},r?.short??s.from," ",v("span",{class:`${n}-to`},An(n,s.kind),v("span",{class:t.hidden}," to ")," ",d?.short??s.to,b?` · ${b}`:"")),s.note?v("span",{class:`${n}-note`},s.note):null))}return v("div",{class:`${n}-steps`},o)}function Be(t,e){return jt(e,`list:${t}`,()=>Bn(t,e))}var Cn=Be;function Bn(t,e){const n=Math.min(6,e.heading+1),o=f=>v(`h${n}`,{class:`${t}-list-head`},f),c=f=>v("strong",null,f),l=f=>f.href?v("a",{href:f.href,target:f.blank?"_blank":void 0,rel:f.blank?"noopener noreferrer":void 0},c(f.name)):c(f.name),a=f=>v("code",{class:`${t}-code`},f),s=f=>e.byId.get(f)?.name??f,r=f=>{const i=xe(e,f);return i?` (${i})`:""},d=f=>f.focal&&e.legend.focal?` ${Wt(e.legend.focal)}`:"";if(e.type==="architecture"){const f=b=>v("li",null,l(b),b.kind?`, ${b.kind}`:"",b.detail?[". ",b.mono?a(b.detail):b.detail,/[.!?]$/.test(b.detail)?"":"."]:/[.!?]$/.test(b.kind??b.name)?"":".",d(b)),i=[o("Parts")],u=e.nodes.filter(b=>!b.group);u.length&&i.push(v("ul",{class:`${t}-list-items`},u.map(f)));for(const b of e.groups.filter(h=>h.depth===1)){i.push(v("p",{class:`${t}-list-group`},b.label)),b.members.length&&i.push(v("ul",{class:`${t}-list-items`},b.members.map(h=>f(e.byId.get(h)))));for(const h of e.groups.filter(g=>g.parent===b.id))i.push(v("p",{class:`${t}-list-group`,"data-depth":2},h.label)),i.push(v("ul",{class:`${t}-list-items`,"data-depth":2},h.members.map(g=>f(e.byId.get(g)))))}return i.push(o("Connections")),i.push(v("ol",{class:`${t}-list-items`},e.edges.map(b=>v("li",null,c(s(b.from))," to ",c(s(b.to)),b.label?[": ",a(_t(b.label))]:"",`${r(b.kind)}.`)))),i}if(e.type==="flowchart"){const f=i=>(e.byId.get(i)?.i??0)+1;return[v("ol",{class:`${t}-list-items`},e.nodes.map(i=>{const u=e.edges.filter(g=>g.from===i.id),b=i.shape==="decision"?"Decision":i.shape==="terminal"?u.length?"Start":"End":"Step",h=!i.detail&&/[.!?]$/.test(i.name)?" ":". ";return v("li",null,l(i),i.detail?[", ",i.mono?a(i.detail):i.detail]:"",`${h}${b}.`,d(i),u.length?v("ul",{class:`${t}-list-exits`},u.map(g=>v("li",null,g.label?`If ${_t(g.label)}: go to ${f(g.to)}, `:`Then: go to ${f(g.to)}, `,c(s(g.to)),r(g.kind)))):null)}))]}if(e.type==="data-flow")return[v("ol",{class:`${t}-list-items`},e.nodes.map(f=>{const i=e.edges.filter(u=>u.from===f.id);return v("li",null,`${f.laneLabel}: `,l(f),f.detail?[", ",f.mono?a(f.detail):f.detail]:"",".",d(f),i.length?[" Then ",...i.flatMap((u,b)=>[b?"; ":"",`to step ${e.byId.get(u.to).step}, `,c(s(u.to)),u.label?[": ",a(_t(u.label))]:"",r(u.kind)]),"."]:"")}))];if(e.type==="sequence"){const f=[o("Participants"),v("ul",{class:`${t}-list-items`},e.nodes.map(u=>v("li",null,c(u.name),u.kind?`, ${u.kind}`:"",".",d(u),Me(e,u))))];f.push(o("Messages"));let i=null;for(const u of e.steps){if("band"in u){i=null,f.push(v(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`},u.band));continue}if("open"in u){i=null,f.push(v(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`,"data-depth":u.depth>1?u.depth:void 0},`${e.frameWords[u.open]}: ${u.label}`));continue}if("otherwise"in u){i=null,f.push(v(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`,"data-depth":u.depth>1?u.depth:void 0},`${e.frameWords.else}: ${u.otherwise}`));continue}if("close"in u){i=null;continue}i||(i=v("ol",{class:`${t}-list-items`,start:u.n}),f.push(i)),i.c.push(v("li",null,a(u.label),": ",c(s(u.from))," to ",c(s(u.to)),`${r(u.kind)}.`,u.note?` ${Wt(u.note)}`:""))}return f}const p=[];for(const f of e.nodes)p.push(v(`h${n}`,{class:`${t}-list-group`},f.href?v("a",{href:f.href,target:f.blank?"_blank":void 0,rel:f.blank?"noopener noreferrer":void 0},a(f.name)):a(f.name),d(f))),p.push(v("ul",{class:`${t}-list-items`},[...(f.columns??[]).map(i=>v("li",null,a(i.name),i.key==="PK"?", primary key":i.key==="FK"?", foreign key":"",i.ref?[", references ",a(`${i.ref.table}.${i.ref.column}`),i.card?[" (",yn(f.id,i.ref.table,i.card,a),")"]:""]:i.type?`, ${i.type}`:"")),...f.more?[v("li",null,`and ${f.more} more ${f.more===1?"column":"columns"}`)]:[]]));return p}function je(t,e=!1){const n=t.type==="architecture"?"part":t.type==="sequence"?"participant":t.type==="schema"?"table":"step";return`${e&&Jt(t)?`Arrow keys move to the nearest ${n} in that direction`:`Arrow keys move to the next or the previous ${n}, in the author's order`}; Home and End go to the ends; Escape clears the trace.${t.nodes.some(c=>c.href)?" Enter opens a part that is a link.":""}`}function re(t,e=!1){const n=e&&t.type!=="sequence"&&Jt(t)&&t.cols>1&&t.rows>1,o=t.nodes.some(c=>c.href)?[{keys:["Enter"],words:"open"}]:[];return[{keys:n?["←","↑","↓","→"]:["←","→"],words:Se(t)},{keys:["Home","End"],words:"the ends"},...o,{keys:["Esc"],words:"clear"}]}var jn=(t,e)=>{for(let n=0;n({col:e.col,rows:[e.row,e.row2]});function Jt(t){return jt(t,"spatial",()=>{const e=t.nodes.map(l=>({id:l.id,...Rn(t,l)})),n=(l,a)=>{const s=a==="right"||a==="left",r=a==="right"||a==="down",d=b=>s?[b.col,b.col]:b.rows,p=b=>s?b.rows:[b.col,b.col],f=d(l),i=p(l);let u=null;return e.forEach((b,h)=>{if(b===l)return;const g=d(b),k=p(b),M=r?g[0]-f[1]:f[0]-g[1];if(M<1)return;const z=Math.max(0,k[0]-i[1],i[0]-k[1]),w=[z===0?0:1,z===0?M:M+2*z,z,Math.abs(k[0]-i[0]),h];(!u||jn(w,u.rank))&&(u={id:b.id,rank:w})}),u?.id??null},o=Lt();for(const l of e)o[l.id]={right:n(l,"right"),left:n(l,"left"),down:n(l,"down"),up:n(l,"up")};const c=l=>{const a=new Set([l]),s=[l];for(;s.length;)for(const r of Object.values(o[s.pop()]))r&&!a.has(r)&&(a.add(r),s.push(r));return a.size};return e.every(l=>c(l.id)===e.length)?o:null})}function Ut(t){return jt(t,"turn-back-lanes",()=>{const e=new Map,n=new Set;if(!ie(t))return{lane:e,dropped:n,lanes:0};const o=(r,d)=>(t.byId.get(r)?.row??0)*1e3+d,c=new Map;t.edges.forEach((r,d)=>{const p=`${r.to}.${r.toRow}.${r.card?.to??""}`,f=o(r.from,r.fromRow??0),i=o(r.to,r.toRow??0),u=c.get(p)??{members:[],lo:1/0,hi:-1/0};u.members.push(d),u.lo=Math.min(u.lo,f,i),u.hi=Math.max(u.hi,f,i),c.set(p,u)});const l=[...c.values()].sort((r,d)=>d.hi-d.lo-(r.hi-r.lo)),a=[];let s=0;for(const r of l.reverse()){const d=new Set(a.filter(f=>f.lo<=r.hi&&r.lo<=f.hi).map(f=>f.lane));let p=0;for(;d.has(p);)p++;if(p>1){for(const f of r.members)n.add(f);continue}a.push({lo:r.lo,hi:r.hi,lane:p});for(const f of r.members)e.set(f,p);s=Math.max(s,p+1)}return{lane:e,dropped:n,lanes:s}})}var ie=t=>t.type==="schema"&&t.cols===1&&t.edges.length>0;function Xt(t,e,n){const o=n.prefix,c=vn(n.base),l=t.type==="sequence"||t.type==="schema"?null:_e(t),a={P:o,ids:c,level:n.level,plan:l,hidden:n.hiddenClass},s=e.layout==="drawn",r=Rt(t,e),d=t.type==="sequence"||t.type==="schema"?s:!0,p=`h${t.heading}`,f=[`--_cols:${ae(t)}`];if(t.type==="architecture"&&t.groups.length||s&&e.pad){const i=t.type==="architecture"?Ee(t):[0,0,0,0],u=(h,g,k)=>h?h>1?`calc(${h} * var(--basalt-space-${g}))`:`var(--basalt-space-${g})`:k?`var(--basalt-space-${k})`:"0px",b=s&&e.pad?"3":void 0;f.push(`--_gpad:${u(i[0],"8",b)} ${u(i[1],"4")} ${u(i[2],"4",b)} ${u(i[3],"4")}`)}if(l?.gutter&&l.laneCount>2&&f.push(`--_gw:calc(${l.laneCount} * var(--basalt-space-3-5) + var(--basalt-space-3))`),ie(t)){const i=t.marks?"var(--basalt-space-6) + var(--basalt-space-1)":"var(--basalt-space-5)";f.push(`--_gpad:0px ${Ut(t).lanes>1?`calc(${i} + var(--basalt-space-3))`:t.marks?`calc(${i})`:i} 0px 0px`)}return t.type==="schema"&&e.track&&f.push(`--_track:${e.track}px`),v("figure",{class:n.className?`${o} ${n.className}`:o,"aria-labelledby":c.title,"data-type":t.type,"data-cols":ae(t),"data-reach":t.type==="architecture"?Le(t):void 0,"data-gutter":l?.gutter?"":void 0,"data-marks":t.marks?"":void 0,"data-layout":e.layout??(t.unplaced?"stacked":void 0),"data-measured":e.layout?"":void 0,"data-bare":e.bare?"":void 0,"data-motion":t.motion.animated?"animated":void 0,"data-first-visit":t.motion.animated&&t.motion.firstVisit?"":void 0,"data-rtl":t.rtl?"":void 0,"data-viewer":n.viewer?"":void 0,style:f.join(";")},v("div",{class:`${o}-head`},v(p,{id:c.title,class:`${o}-title`},t.title),n.hasSource?v("p",{class:`${o}-source`},{slot:"source"}):null),v("div",{class:`${o}-drawing`,style:s&&e.rows?`--_rows:${e.rows};--_row-gap:0px`:void 0,role:d?"group":void 0,"aria-roledescription":d?"diagram":void 0,"aria-labelledby":d?c.title:void 0,"aria-describedby":d?r?`${c.summary} ${c.keys}`:c.summary:void 0,"data-stops":r?"":void 0},In(a,t,e),t.text?null:v("div",{class:`${o}-ink`,"aria-hidden":"true"}),v("span",{class:`${o}-ruler`,"aria-hidden":"true"})),Oe(o,t),v("p",{class:`${o}-hint`,"data-kbd-hint":"","aria-hidden":"true"},{slot:"hint"}),Rt(t,e)&&t.type!=="sequence"||s&&t.type==="sequence"?v("p",{class:`${o}-tap-hint`,"aria-hidden":"true"},`Tap ${Se(t)} to highlight its lines. Tap it again to clear.`):null,v("div",{class:`${o}-foot`},{slot:"toggle"}),v("div",{id:c.list,class:`${o}-list`,hidden:!e.open},Be(o,t)),v("span",{id:c.keys,class:n.hiddenClass},n.viewer?`${je(t,s)} ${n.viewer}`:je(t,s)),v("figcaption",{id:c.summary,class:`${o}-summary`},{slot:"summary"}))}function Tn(t){const e=getComputedStyle(t),n=(c,l)=>{const a=parseFloat(e.getPropertyValue(`--basalt-${c}`));return Number.isFinite(a)?a:l},o=new Map;return{space:c=>(o.has(c)||o.set(c,n(`space-${c}`,parseFloat(c.replace("-","."))*4)),o.get(c)),node:n("size-diagram-node",144),table:n("size-diagram-table",224),lane:n("size-diagram-lane",120),step:n("size-diagram-step",56),head:n("size-diagram-head",8),guide:n("size-diagram-guide-dash",4),hair:n("size-hairline",1),line:n("size-chart-line",2),cut:n("size-cut",2),dot:n("size-dot",6),dash:n("size-chart-dash",6),dashGap:n("size-chart-dash-gap",4),wide:n("size-breakpoint-container-lg",640),cap:n("size-breakpoint-container",480),radius:n("radius-md",8),radiusXs:n("radius-xs",4),activation:n("size-diagram-activation",8),foot:n("size-diagram-foot",14)}}var Yt=(t,e)=>t==="main"?e.line:e.hair,Mt=(t,e)=>{const n=t.getBoundingClientRect();return{l:n.left-e.left,t:n.top-e.top,r:n.right-e.left,b:n.bottom-e.top}},It=(t,e,n=.01)=>t.le.l+n&&t.te.t+n,le=(t,e)=>({l:t.l-e,r:t.r+e,t:t.t-e,b:t.b+e});function xt(t,e,n){const{l:o,t:c,r:l,b:a}=t.rect,s=(o+l)/2,r=(c+a)/2,d=(l-o)/2,p=(a-c)/2,f=e==="top"||e==="bottom";if(t.shape==="decision"){if(f){const b=n,h=p*Math.max(0,1-Math.abs(b-s)/d);return{x:b,y:e==="top"?r-h:r+h}}const i=n,u=d*Math.max(0,1-Math.abs(i-r)/p);return{x:e==="left"?s-u:s+u,y:i}}if(t.shape==="terminal"){const i=Math.min(d,p);if(f){const g=n,k=Math.min(Math.max(g,o+i),l-i),M=g-k,z=Math.abs(M)>=i?0:Math.sqrt(i*i-M*M);return{x:g,y:Math.abs(M)<1e-6?e==="top"?c:a:e==="top"?r-z:r+z}}const u=n,b=u-r,h=Math.abs(b)>=i?0:Math.sqrt(i*i-b*b);return{x:e==="left"?o+i-h:l-i+h,y:u}}return f?{x:n,y:e==="top"?c:a}:{x:e==="left"?o:l,y:n}}function zn(t,e,n){const{l:o,t:c,r:l,b:a}=e.rect,s=(o+l)/2,r=(c+a)/2,d=(l-o)/2,p=(a-c)/2;if(e.shape==="decision")return Math.abs(t.x-s)/d+Math.abs(t.y-r)/p<1-n/Math.min(d,p);if(e.shape==="terminal"){const f=Math.min(d,p),i=Math.min(Math.max(t.x,o+f),l-f);return Math.hypot(t.x-i,t.y-r)o+n&&t.xc+n&&t.ymatchMedia("(forced-colors: active)").matches;function Fn(t,e){const n=t.querySelector(`.${e}-ruler`),o=new Map;return(c,l)=>{const a=`${l}|${c}`;return o.has(a)||(n.setAttribute("data-f",l),n.textContent=c,o.set(a,n.getBoundingClientRect().width),n.textContent=""),o.get(a)}}var Qt=t=>t?t.split(/\s+/).filter(Boolean):[];function Hn(t,e,n){const o=e.space;let c=e.node,l=e.table;for(const r of t.nodes){if(r.shape==="table"){for(const h of r.columns??[]){const g=h.ref?`${t.rtl?"←":"→"} ${h.ref.table}`:h.type??"",k=o("6")+n(h.name,"mono")+(g?o("3")+n(g,"mono"):0)+2*o("3")+2*e.hair;l=Math.max(l,Math.ceil(k))}l=Math.max(l,Math.ceil(n(r.name,"table")+2*o("3")+2*e.hair+(r.href?16+o("1-5"):0)));continue}const d=r.shape==="terminal"?2*o("5"):2*o("3"),p=r.mark&&!Wn()?(r.shape==="participant"?2:1)*o("6"):0;let f=0;const i=r.href?16+o("1-5"):0,u=Qt(r.name);if(u.forEach((h,g)=>{f=Math.max(f,n(h,r.shape==="decision"?"name-500":"name")+(r.kind?0:p)+(g===u.length-1?i:0))}),t.type!=="data-flow")for(const h of Qt(r.kind))f=Math.max(f,n(h,"mono")+p);for(const h of Qt(r.detail))f=Math.max(f,n(h,r.mono?"mono":"sans"));const b=r.shape==="decision"?f/.62:f+d+2*e.hair;c=Math.max(c,Math.ceil(b))}const a=ae(t);let s;return t.type==="data-flow"?s=e.lane+a*(c+o("12")):t.type==="schema"?s=a*l+(a-1)*(o("12")+(t.marks?o("3"):0))+(ie(t)?(t.marks?o("6")+o("1"):o("5"))+(Ut(t).lanes>1?o("3"):0):0):t.type==="sequence"?s=a*c+(a-1)*o("5"):s=a*c+(a-1)*o("16")+Le(t)*o("4"),{track:c,table:l,least:Math.max(e.wide,s)}}function Te(t,e){return{x:(n,o)=>o%2===1?Math.round(n+t-.5)+.5-t:Math.round(n+t)-t,y:(n,o)=>o%2===1?Math.round(n+e-.5)+.5-e:Math.round(n+e)-e}}function ce(t){const e=t[t.length-2],n=t[t.length-1];return Math.abs(e.x-n.x)<.01?n.y>e.y?"down":"up":n.x>e.x?"right":"left"}function ze(t,e,n){const o=t.map(l=>({...l}));for(let l=1;l=2){const r=c[c.length-2];if(Math.abs(r.x-s.x)<.01&&Math.abs(s.x-a.x)<.01||Math.abs(r.y-s.y)<.01&&Math.abs(s.y-a.y)<.01){c[c.length-1]=a;continue}}c.push(a)}}return c}var qt=t=>t.slice(1).map((e,n)=>[t[n],e]);function Pt(t,e,n){const o=[];for(let l=0;lMath.min(h.x,g.x)+.75&&zMath.min(k.y,M.y)+.75&&wl.split(/\s+/).map(parseFloat).filter(a=>Number.isFinite(a)),o=(l,a,s)=>{const r=[];let d=a;for(const p of l)r.push([d,d+p]),d+=p+s;return r},c=o(n(e.gridTemplateRows),parseFloat(e.paddingTop)||0,parseFloat(e.rowGap)||0);return{cols:o(n(e.gridTemplateColumns),parseFloat(e.paddingLeft)||0,parseFloat(e.columnGap)||0),rows:t.style.getPropertyValue("--_rows").trim()?c.filter((l,a)=>a%2===1):c}}var ht=t=>t==="left"||t==="right",Ne={top:"bottom",bottom:"top",left:"right",right:"left"};function de(t,e){return t.row===e.row?e.col>t.col?["right","left"]:["left","right"]:t.col===e.col?e.row>t.row?["bottom","top"]:["top","bottom"]:[e.col>t.col?"right":"left",e.row>t.row?"top":"bottom"]}function We(t,e,n){const o=[];t.edges.forEach((l,a)=>{const s=t.byId.get(l.from),r=t.byId.get(l.to),[d,p]=e[a],f=s.row===r.row&&ht(d)&&ht(p)&&d===Ne[p]||s.col===r.col&&!ht(d)&&!ht(p)&&d===Ne[p];o.push({edge:a,end:"from",node:s,side:d,far:r,straight:f,f:.5},{edge:a,end:"to",node:r,side:p,far:s,straight:f,f:.5})});const c=new Map;for(const l of o){const a=`${l.node.id}.${l.side}`;c.has(a)||c.set(a,[]),c.get(a).push(l)}for(const[l,a]of c){if(a[0].node.shape==="decision")continue;const s=h=>ht(h.side)?h.far.row-h.node.row:h.far.col-h.node.col,r=a.filter(h=>h.straight),d=a.filter(h=>!h.straight);if(d.sort((h,g)=>s(h)-s(g)||(ht(h.side)?h.far.col-g.far.col:h.far.row-g.far.row)*(s(h)<0?1:-1)),a.length>3&&n(`${l.replace(".","'s ")} side has ${a.length} lines; more than three is an error: use another side`),!r.length){d.length===2?(d[0].f=.25,d[1].f=.75):d.length===3?(d[0].f=.25,d[1].f=.5,d[2].f=.75):d.length>3&&d.forEach((h,g)=>{h.f=(g+1)/(d.length+1)});continue}const p=new Map;for(const h of r)p.has(h.far.id)||p.set(h.far.id,[]),p.get(h.far.id).push(h);for(const h of p.values())h.length>1&&h.sort((g,k)=>g.edge-k.edge).forEach((g,k)=>{g.f=h.length===2?k===0?.25:.75:(k+1)/(h.length+1)});const f=Math.min(...r.map(h=>h.f)),i=Math.max(...r.map(h=>h.f)),u=d.filter(h=>s(h)<0),b=d.filter(h=>s(h)>=0);u.forEach((h,g)=>{h.f=f*(g+1)/(u.length+1)}),b.forEach((h,g)=>{h.f=i+(1-i)*(g+1)/(b.length+1)})}return o}function Fe(t,e=8,n=8){return jt(t,`port-floors:${e}:${n}`,()=>{const o=Lt();if(t.type!=="architecture"&&t.type!=="flowchart"&&t.type!=="data-flow")return o;const c=t.edges.map(a=>{const s=t.byId.get(a.from),r=t.byId.get(a.to),[d,p]=de(s,r);return[a.fromSide??d,a.toSide??p]}),l=new Map;for(const a of We(t,c,()=>{})){if(!ht(a.side)||a.node.shape!=="box")continue;const s=`${a.node.id}.${a.side}`;l.has(s)||l.set(s,[]),l.get(s).push(a.f)}for(const[a,s]of l){if(s.length<2)continue;const r=s.slice().sort((f,i)=>f-i).filter((f,i,u)=>i===0||f-u[i-1]>1e-9);let d=Math.max(e/r[0],e/(1-r[r.length-1]));for(let f=1;f{const a=t.byId.get(l.dataset.node);a&&c.set(a.id,{id:a.id,rect:Mt(l,n),shape:a.shape,i:a.i})}),c}function Ge(t,e){const n=e.head,o=e.head/2,{x:c,y:l}=t.tip;return t.dir==="down"?{l:c-o,r:c+o,t:l-n,b:l}:t.dir==="up"?{l:c-o,r:c+o,t:l,b:l+n}:t.dir==="right"?{l:c-n,r:c,t:l-o,b:l+o}:{l:c,r:c+n,t:l-o,b:l+o}}var Ve=(t,e,n)=>({l:Math.min(t.x,e.x)-n/2,r:Math.max(t.x,e.x)+n/2,t:Math.min(t.y,e.y)-n/2,b:Math.max(t.y,e.y)+n/2});function Ke(t,e,n,o){const c=(l,a)=>{const s=l+a-Math.floor(l+a);return s<.005||s>.995?[0]:s<=.5?[-s,1-s]:[1-s,-s]};for(const l of c(t.t,n))for(const a of c(t.l,e)){if(!a&&!l)return t;const s={l:t.l+a,r:t.r+a,t:t.t+l,b:t.b+l};if(o(s))return s}return t}function Gn(t,e,n,o,c,l,a,s,r){const d=a.space,p=[],f=[],i=[],u=[],b=d("1"),h=e.filter(g=>t.edges[g.i]?.label).sort((g,k)=>+(t.edges[k.i].kind==="main")-+(t.edges[g.i].kind==="main")||g.i-k.i);for(const g of h){const k=t.edges[g.i].label,M=s(k,"label"),z=16*Vt(k),w=g.pts.length-2,q=[];qt(g.pts).forEach(([E,G],R)=>{const C=Math.abs(E.y-G.y)<.01,W=C?E.x:E.y;let T=C?G.x:G.y;const K=Math.sign(T-W)||1;R===w&&(T-=K*a.head);let U=[[W,T]];for(const J of c)for(const Z of C?[J.l,J.r]:[J.t,J.b]){const Q=C?E.y:E.x;(C?Q>J.t&&QJ.l&&QZ>Math.min($,S)+1&&Z{const Q=(J+Z)/2,m=C?{x:Q,y:E.y}:{x:E.x,y:Q};return!c.some($=>m.x>$.l&&m.x<$.r&&m.y>$.t&&m.y<$.b)},X=g.axes?.[R]??(C?E.y:E.x);for(const[J,Z]of U)q.push({horiz:C,c:X,p:J,q:Z,len:Math.abs(Z-J),pri:U.length>1&&st(J,Z)?1:0})}),q.sort((E,G)=>G.pri-E.pri||G.len-E.len);let O=null,N=!1;const D=(E,G=!0)=>{const R=le(E,b);return G&&(E.ll.r||E.tl.b)||n.some(C=>Re(R,C))||p.some(C=>It(R,C))||o.heads.some(C=>It(R,C))||o.rects.some(C=>It(R,C))?!1:!e.some(C=>C.i!==g.i&&qt(C.pts).some(([W,T])=>It(R,Ve(W,T,C.width))))};for(const E of q){for(const G of[1/2,1/3,2/3]){const R=E.p+(E.q-E.p)*G,C=[],W=d("2")+g.width/2;if(E.horiz?(E.len>=M+2*d("1")+d("3-5")&&C.push({box:{l:R-M/2-d("1"),r:R+M/2+d("1"),t:E.c-z/2,b:E.c+z/2},on:!0}),C.push({box:{l:R-M/2,r:R+M/2,t:E.c-W-z,b:E.c-W},on:!1}),C.push({box:{l:R-M/2,r:R+M/2,t:E.c+W,b:E.c+W+z},on:!1})):(E.len>=z+d("3")&&C.push({box:{l:E.c-M/2-d("1"),r:E.c+M/2+d("1"),t:R-z/2,b:R+z/2},on:!0}),C.push({box:{l:E.c+W,r:E.c+W+M,t:R-z/2,b:R+z/2},on:!1}),C.push({box:{l:E.c-W-M,r:E.c-W,t:R-z/2,b:R+z/2},on:!1})),O=C.find(T=>D(T.box))??null,O)break;!N&&C.some(T=>D(T.box,!1))&&(N=!0)}if(O)break}if(!O){i.push(g.i),N&&u.push(g.i);continue}const dt=Ke(O.box,r.ox,r.oy,E=>D(E));p.push(dt),f.push({i:g.i,text:k,box:dt,on:O.on})}return{labels:f,unseated:i,bounded:u}}function Ze(t,e,n,o){const c=[],l=[];return t.querySelectorAll(`.${n}-gbox, .${n}-group`).forEach(a=>{if(a.getClientRects().length===0||getComputedStyle(a).display==="contents")return;const s=Mt(a,e);l.push(s),c.push({l:s.l,r:s.r,t:s.t,b:s.t+1},{l:s.l,r:s.r,t:s.b-1,b:s.b},{l:s.l,r:s.l+1,t:s.t,b:s.b},{l:s.r-1,r:s.r,t:s.t,b:s.b});const r=a.querySelector(`:scope > .${n}-glabel`);r&&r.getClientRects().length&&c.push(Mt(r,e))}),t.querySelectorAll(`.${n}-lane`).forEach((a,s)=>{if(!a.getClientRects().length)return;const r=Mt(a,e);s>0&&c.push({l:r.l,r:r.r,t:r.t-o/2-.5,b:r.t-o/2+.5});const d=a.querySelector(`.${n}-lane-name`);d&&c.push(Mt(d,e))}),{obstacles:{rects:c,heads:[]},groups:l}}function Je(t,e){const{m:o,tk:c,P:l,drawing:a,origin:s,warn:r}=t,d=c.space,p=De(o,a,s,l),f=[...p.values()],i=Dn(a),u=s.left-Math.floor(s.left),b=s.top-Math.floor(s.top),h=Te(u,b),g=a.clientWidth,k=a.clientHeight,M=y=>o.type==="data-flow"?y.col+1:y.col,z=parseFloat(getComputedStyle(a).rowGap)||0,w={w:g,h:k,nodes:f,lines:[],lifelines:[],labels:[],crossings:[],through:[],unseated:[],outside:[],ox:u,oy:b};if(o.type==="sequence")return Kn(t,w,h);let q,O=[];o.type==="schema"?q=o.edges.map(y=>{const A=o.byId.get(y.from),_=o.byId.get(y.to);if(A.col===_.col){const x=A.col===o.cols&&o.cols>1?"left":"right";return[x,x]}return _.col>A.col?["right","left"]:["left","right"]}):(q=o.edges.map(y=>{const A=o.byId.get(y.from),_=o.byId.get(y.to),[x,L]=de(A,_);return[y.fromSide??x,y.toSide??L]}),O=We(o,q,r||(()=>{})));const N=(y,A)=>{const _=a.querySelector(`.${l}-node[data-node="${CSS.escape(y)}"] .${l}-row[data-row="${A}"]`);if(!_)return 0;const x=Mt(_,s);return(x.t+x.b)/2},D=new Map;if(o.type==="schema"){const y=new Map;o.edges.forEach((_,x)=>{const L=`${_.to}.${_.toRow}.${q[x][1]}`;y.set(L,[...y.get(L)??[],x])});const A=_=>{const x=o.edges[_].card?.to;return x==="one"?0:x==="zero-or-one"?1:2};for(const _ of y.values()){const x=[...new Set(_.map(A))].sort((L,H)=>L-H);if(x.length>1)for(const L of _)D.set(L,(x.indexOf(A(L))-(x.length-1)/2)*d("2"))}}const dt=y=>Math.round(y+u)-u,E=o.edges.map((y,A)=>{const[_,x]=q[A],L=p.get(y.from),H=p.get(y.to),P=Yt(y.kind,c);if(y.fk){const et=N(y.from,y.fromRow),at=N(y.to,y.toRow)+(D.get(A)??0),$t=h.y(et,P),Ct=h.y(at,P),Et=_==="right"?L.rect.r:L.rect.l,kt=x==="right"?H.rect.r:H.rect.l;return{p1:{x:y.card?dt(Et):Et,y:$t},p2:{x:y.card?dt(kt):kt,y:Ct},r1:et,r2:Math.abs($t-Ct)<.01?et:at}}const ot=O.find(et=>et.edge===A&&et.end==="from").f,ct=O.find(et=>et.edge===A&&et.end==="to").f;let it=He(L,_,ot),rt=He(H,x,ct);const F=ht(_)?it.y:it.x;let V=ht(x)?rt.y:rt.x;return ht(_)?it={...it,y:h.y(it.y,P)}:it={...it,x:h.x(it.x,P)},ht(x)?rt={...rt,y:h.y(rt.y,P)}:rt={...rt,x:h.x(rt.x,P)},ht(_)&&ht(x)&&Math.abs(it.y-rt.y)<1.01&&(rt={...rt,y:it.y},V=F),!ht(_)&&!ht(x)&&Math.abs(it.x-rt.x)<1.01&&(rt={...rt,x:it.x},V=F),it=ht(_)?xt(L,_,it.y):xt(L,_,it.x),rt=ht(x)?xt(H,x,rt.y):xt(H,x,rt.x),{p1:it,p2:rt,r1:F,r2:V}}),G=new Set,R=(y,A)=>{G.has(y)||(G.add(y),r?.(`${o.edges[y].from} to ${o.edges[y].to} ${A}, so its line is not drawn; its row still writes the target`))};for(const y of Ut(o).dropped)R(y,"would need a third lane of turn-backs");const C=new Map,W=Lt();o.type==="schema"&&o.edges.forEach((y,A)=>{const _=o.byId.get(y.from),x=o.byId.get(y.to);if(Math.abs(_.col-x.col)<2)return;const L=Math.min(_.col,x.col),H=Math.max(_.col,x.col),P=o.nodes.filter(at=>at.col>L&&at.col$t.row<=at&&$t.row2>=at+1)||ct.push({key:`g${at}`,y:(ot[at-1][1]+ot[at][0])/2,inner:!0});ct.push({key:"top",y:ot[0][0]-d("4"),inner:!1},{key:"bottom",y:ot[ot.length-1][1]+d("4"),inner:!1});const it=(E[A].r1+E[A].r2)/2,rt=t.pick?.[A]??ct.slice().sort((at,$t)=>Math.abs(at.y-it)-Math.abs($t.y-it)||Number($t.inner)-Number(at.inner)||at.y-$t.y)[0].key;W[A]=rt;const F=q[A][0]==="right"?_.col:_.col-1,V=i.cols[F-1],et=i.cols[F];C.set(A,{corridor:rt,first:V&&et?{key:`c${F}`,span:[V[1],et[0]]}:null,y:0})});const T=new Map;for(const[y,A]of C){const _=o.edges[y],x=T.get(A.corridor)??[],L=x.find(H=>{const P=o.edges[H[0]];return P.to===_.to&&P.toRow===_.toRow&&q[H[0]][1]===q[y][1]&&Math.abs(E[H[0]].p2.y-E[y].p2.y)<.5});L?L.push(y):x.length>=2?R(y,"would need a third lane in its corridor"):x.push([y]),T.set(A.corridor,x)}for(const y of[...C.keys()])G.has(y)&&C.delete(y);const K=y=>{const A=o.edges[y[0]];return Math.abs(o.byId.get(A.from).col-o.byId.get(A.to).col)*1e4+Math.abs(E[y[0]].p1.x-E[y[0]].p2.x)},U=(y,A,_)=>{const x=i.rows;if(y==="top")return x[0][0]-d("4")-A*d("3");if(y==="bottom")return x[x.length-1][1]+d("4")+A*d("3");const L=Number(y.slice(1));return(x[L-1][1]+x[L][0])/2+(A-(_-1)/2)*d("3")},st=(y,A)=>A.forEach((_,x)=>_.forEach(L=>{C.get(L).y=U(y,x,A.length)})),X=()=>{for(const[y,A]of T){const _=A.map(x=>x.filter(L=>C.has(L))).filter(x=>x.length);T.set(y,_),st(y,y==="top"||y==="bottom"?_.slice().sort((x,L)=>K(x)-K(L)):_.slice().sort((x,L)=>K(L)-K(x)))}};X();const J=new Map,Z=new Set,Q=new Map,m=(y,A,_,x,L)=>{J.has(y)||J.set(y,{span:A,vertical:_,members:new Map});const H=J.get(y);H.members.has(x)||H.members.set(x,[]),H.members.get(x).push(L)},$=()=>{J.clear(),Z.clear(),Q.clear(),o.edges.forEach((y,A)=>{if(G.has(A))return;const _=C.get(A);_?.first&&m(_.first.key,_.first.span,!0,`far:${A}`,-(A+1));const[x,L]=q[A],{p1:H,p2:P}=E[A],ot=o.byId.get(y.from),ct=o.byId.get(y.to);let it=null,rt=null,F=!1;if(x===L){if(ht(x)){const V=x==="right"?Math.max(M(ot),M(ct)):Math.min(M(ot),M(ct))-1,et=i.cols[V-1],at=i.cols[V];et&&at&&(it=`c${V}`,rt=[et[1],at[0]],F=!0)}else{const V=x==="bottom"?Math.max(ot.row2,ct.row2):Math.min(ot.row,ct.row)-1,et=i.rows[V-1],at=i.rows[V];et&&at&&(it=`r${V}`,rt=[et[1],at[0]],F=!1)}it&&Z.add(A)}else if(ht(x)&&ht(L)&&(_||Math.abs(H.y-P.y)>.5)){const V=M(ct),et=L==="left",at=i.cols[(et?V-1:V)-1],$t=i.cols[(et?V:V+1)-1];at&&$t&&(it=`c${et?V-1:V}`,rt=[at[1],$t[0]],F=!0)}else if(!ht(x)&&!ht(L)&&Math.abs(H.x-P.x)>.5){const et=L==="top"?ct.row-1:ct.row2,at=i.rows[et-1],$t=i.rows[et];at&&$t&&(it=`r${et}`,rt=[at[1],$t[0]],F=!1)}!it||!rt||(_&&Q.set(A,rt),m(it,rt,F,`${y.to}.${L}.${Math.round(F?P.y:P.x)}`,A))})};$();const S=new Map,B=y=>{const[A,_]=q[y],{p1:x,p2:L}=E[y],H=C.get(y);if(H){const P=Q.get(y),ot=S.get(-(y+1))??(H.first?(H.first.span[0]+H.first.span[1])/2:x.x),ct=S.get(y)??(P?(P[0]+P[1])/2:L.x);return[x,{x:ot,y:x.y},{x:ot,y:H.y},{x:ct,y:H.y},{x:ct,y:L.y},L]}if(ht(A)&&ht(_)){if(A===_){const ot=d(o.marks?"6":"4")+(o.type==="schema"&&o.cols===1?(Ut(o).lane.get(y)??0)*d("3"):0),ct=S.get(y)??(A==="right"?Math.max(x.x,L.x)+ot:Math.min(x.x,L.x)-ot);return[x,{x:ct,y:x.y},{x:ct,y:L.y},L]}if(Math.abs(x.y-L.y)<=.5)return[x,{x:L.x,y:x.y}];const P=S.get(y)??(x.x+L.x)/2;return[x,{x:P,y:x.y},{x:P,y:L.y},L]}if(!ht(A)&&!ht(_)){if(A===_){const ot=S.get(y)??(A==="bottom"?Math.max(x.y,L.y)+d("4"):Math.min(x.y,L.y)-d("4"));return[x,{x:x.x,y:ot},{x:L.x,y:ot},L]}if(Math.abs(x.x-L.x)<=.5)return[x,{x:x.x,y:L.y}];const P=S.get(y)??(x.y+L.y)/2;return[x,{x:x.x,y:P},{x:L.x,y:P},L]}return ht(A)?[x,{x:L.x,y:x.y},L]:[x,{x:x.x,y:L.y},L]},I=y=>{const A=o.edges[y],_=Yt(A.kind,c),x=B(y),L=ze(x,_,h);let H;return x.length===L.length&&(H=qt(x).map(([P,ot])=>Math.abs(P.y-ot.y)<.75?(P.y+ot.y)/2:(P.x+ot.x)/2),H[0]=E[y].r1,H.length>1&&(H[H.length-1]=E[y].r2)),{i:y,from:A.from,to:A.to,kind:A.kind,pts:L,tip:L[L.length-1],dir:ce(L),dot:A.fk&&!A.card?L[0]:void 0,card:A.card,width:_,axes:H}},j=()=>o.edges.flatMap((y,A)=>G.has(A)?[]:[I(A)]);let tt=null;const Y=y=>{tt??(tt=j());const A=tt.map(_=>y.has(_.i)?I(_.i):_);return{lines:A,score:Vn(A,y)*1e5+Pt(A,void 0,y).length*1e3+ue(A.filter(_=>y.has(_.i)),f,o).length}},mt=(y,A)=>{const _=y.flatMap(x=>{const L=x<0?-x-1:x,{p1:H,p2:P}=E[L],ot=C.get(L);return ot?x<0?[H.y,ot.y]:[ot.y,P.y]:A?[H.y,P.y]:[H.x,P.x]});return[Math.min(..._),Math.max(..._)]},nt=y=>y<0?-y-1:y,lt=y=>{const A=[...y.members.values()].map(x=>({members:x,run:mt(x,y.vertical)})).sort((x,L)=>x.run[0]-L.run[0]),_=[];for(const x of A){const L=_[_.length-1];L&&L.some(H=>H.run[0]!(x.length===1&&x[0].members.every(L=>Z.has(L))))},ft=y=>(A,_)=>y[A].run[0]{const A=ft(y),_=[];return y.forEach((x,L)=>{let H=0;for(;_.some((P,ot)=>P===H&&A(L,ot));)H++;_.push(H)}),_},wt=y=>Math.max(0,...yt(y))+1;if(o.marks)for(let y=0;y3){A=H.map(P=>P.members.map(nt));break}if(!A)break;const _=L=>Math.max(...L),x=A.filter(L=>L.some(H=>C.has(H))).sort((L,H)=>_(H)-_(L))[0]??A.slice().sort((L,H)=>_(H)-_(L))[0];for(const L of x)R(L,"would need a fourth lane in a marked gutter"),C.delete(L);$()}const vt=(y,A,_)=>{const x=y[1]-y[0];if(!o.marks)return y[0]+x/(_+1)*(A+1);const L=c.foot+c.radiusXs,H=_>1?Math.min(x/(_+1),(x-2*L)/(_-1)):0;return(y[0]+y[1])/2+(A-(_-1)/2)*H};X();for(const[y,A]of T){if(y==="top"||y==="bottom"||A.length<2)continue;const _=new Set(A.flat());let x=A,L=1/0;for(const H of fe(A.slice().sort((P,ot)=>K(ot)-K(P)))){st(y,H),tt=null;const P=Y(_);P.scorect.members);if(o.marks){const ct=wt(A),it=ft(A),rt=A.length,F=new Set(_.flat().map(nt)),V=Et=>Et.forEach((kt,Tt)=>_[Tt].forEach(Bt=>S.set(Bt,vt(y.span,kt,ct))));let et=yt(A),at=1/0,$t=null;const Ct=[et];if(ct**rt<=729)for(let Et=0;EtMath.floor(Et/ct**Bt)%ct);kt.every((Tt,Bt)=>kt.every((ee,Gt)=>Gt<=Bt||Tt!==ee||!it(Bt,Gt)))&&Ct.push(kt)}for(const Et of Ct){V(Et);const kt=Y(F);kt.scorert.forEach(V=>S.set(V,vt(y.span,F,x))));const it=Y(L);it.scorect.forEach(rt=>S.set(rt,vt(y.span,it,x)))),tt=ot}if(w.lines=j(),o.marks&&(w.lines=w.lines.filter(y=>{if(!y.card)return!0;const A=qt(y.pts),_=([L,H])=>Math.hypot(H.x-L.x,H.y-L.y),x=A.length===1?2*c.foot:c.foot+c.radiusXs-.5;return _(A[0])>=x&&_(A[A.length-1])>=x?!0:(R(y.i,"has no room for its marks at an end"),C.delete(y.i),!1)})),C.size){const y=new Set([...C.values()].map(_=>_.corridor)),A=[y.has("top")?"var(--basalt-space-8)":"0px"];for(let _=1;_<=o.rows;_++)A.push("auto",_Ge(y,c));const ut=Gn(o,w.lines,f,St,pt,{l:0,t:0,r:g,b:k},c,e,{ox:u,oy:b});return w.labels=ut.labels,w.unseated=ut.unseated,w.bounded=ut.bounded,w.overlaps=[...new Set(Ue(w.lines,null).flat())],w}function Vn(t,e){return Ue(t,e).length}function Ue(t,e){const n=[];for(let o=0;o=s)continue;const[g,k]=i?[r.x,d.x]:[r.y,d.y],[M,z]=i?[p.x,f.x]:[p.y,f.y];Math.min(Math.max(g,k),Math.max(M,z))-Math.max(Math.min(g,k),Math.min(M,z))>1&&n.push([l.i,a.i])}}return n}function*fe(t){if(t.length<=1){yield t.slice();return}if(t.length>5){yield t.slice();return}for(let e=0;e{const r=s===l.pts.length-1?Math.max(l.width/2,o.head/2):l.width/2;return a.x-r<-.5||a.x+r>e+.5||a.y-r<-.5||a.y+r>n+.5})&&c.push(l.i);return c}function ue(t,e,n){const o=[];for(const c of t){const l=qt(c.pts);e.some(a=>l.some(([s,r])=>Nn(s,r,a)))&&o.push(c.i)}return o}function Kn(t,e,n){const{m:o,tk:c,P:l,drawing:a,origin:s}=t,r=c.space,d=new Map;a.querySelectorAll(`.${l}-node`).forEach(w=>d.set(w.dataset.node,Mt(w,s)));const p=a.querySelector(`.${l}-steps`),f=p?Mt(p,s).b:e.h,i=w=>{const q=d.get(w);return q?n.x((q.l+q.r)/2,c.hair):0};for(const w of o.nodes){const q=d.get(w.id);q&&e.lifelines.push({x:i(w.id),y1:q.b,y2:f})}const u=w=>d.get(w.id),b=new Map;a.querySelectorAll(`.${l}-msg`).forEach(w=>{const q=Mt(w,s);b.set(Number(w.querySelector(`.${l}-num`)?.textContent??0),(q.t+q.b)/2)});const h=c.activation,g=h/2,k=w=>{const q=o.byId.get(w.who);if(!q)return null;const O=i(w.who),D=(q.i===o.nodes.length-1&&o.nodes.length>1?-1:1)*(o.rtl?-1:1),dt=(w.depth-1)*r("1")*D,E=b.get(w.from)??0,G=b.get(w.to)??E,R=w.from===w.to;return{l:n.x(O-g+dt,c.hair),r:n.x(O+g+dt,c.hair),t:n.y(R?E-r("2")-r("1"):E,c.hair),b:n.y(R?E+r("2")+r("1"):G,c.hair)}},M=o.bars.map(w=>({bar:w,rect:k(w)})).filter(w=>w.rect);e.bars=M.map(w=>w.rect);const z=(w,q,O)=>M.filter(({bar:N})=>N.who===w&&N.to>=q&&(O?N.from<=q:N.fromD.bar.depth-N.bar.depth)[0]?.rect;a.querySelectorAll(`.${l}-msg`).forEach(w=>{const q=w.dataset.from,O=w.dataset.to,N=w.dataset.kind??"plain",D=Yt(N,c),dt=Mt(w,s),E=n.y((dt.t+dt.b)/2,D),G=Number(w.querySelector(`.${l}-num`)?.textContent??0);let R=i(q),C=i(O),W;if(q===O){const Z=w.dataset.self==="start"?-r("6"):r("6"),Q=z(q,G,!0),m=Q?Z>0?Q.r:Q.l:R,$=n.y(E-r("2"),D),S=n.y(E+r("2"),D);W=[{x:m,y:$},{x:n.x(R+Z,D),y:$},{x:n.x(R+Z,D),y:S},{x:m,y:S}]}else{const Z=C>R?1:-1,Q=z(q,G,!1),m=z(O,G,!0);Q&&(R=Z>0?Q.r:Q.l),m&&(C=Z>0?m.l:m.r),W=[{x:R,y:E},{x:C,y:E}]}e.lines.push({i:G,from:q,to:O,kind:N,pts:W,tip:W[W.length-1],dir:ce(W),width:D});const T=w.querySelector(`.${l}-said`),K=w.querySelector(`.${l}-note`),U=o.byId.get(q),st=o.byId.get(O);if(!U||!st)return;const X=q===O?(()=>{const Z=o.nodes.find(m=>m.col===U.col+(w.dataset.self==="start"?-1:1)),Q=Z?i(Z.id):w.dataset.self==="start"?0:e.w;return Math.abs(Q-R)-r("6")-r("2-5")-r("2")})():Math.abs(C-R)-2*r("2");Math.max(T?T.getBoundingClientRect().width:0,K?K.getBoundingClientRect().width:0)>X+.5&&e.unseated.push(G)}),a.querySelectorAll(`.${l}-fhead`).forEach(w=>{const q=w.parentElement?.querySelector(`:scope > .${l}-fbox`);if(!q)return;[...w.children].reduce((N,D)=>N+D.getBoundingClientRect().width,0)+r("3")>q.getBoundingClientRect().width+.5&&(e.misfit??(e.misfit=[])).push(`the frame "${w.querySelector(`.${l}-flabel`)?.textContent??""}" is wider than its participants`)});{const w=[...a.querySelectorAll(`.${l}-fbox`)].flatMap(q=>{const O=Mt(q,s);return[{x:O.l+.5,t:O.t,b:O.b},{x:O.r-.5,t:O.t,b:O.b}]});w.length&&a.querySelectorAll(`.${l}-said, .${l}-note, .${l}-band > span`).forEach(q=>{if(!q.getClientRects().length)return;const O=le(Mt(q,s),r("1"));w.some(N=>O.lN.x&&O.tN.t)&&(e.misfit??(e.misfit=[])).push(`"${q.textContent?.trim()??""}" would lie on a frame's side`)})}return e}function Ye(t,e,n,o=Lt()){const{m:c,tk:l,P:a,drawing:s,origin:r}=t,d=l.space,p=De(c,s,r,a),f=[...p.values()],i=r.left-Math.floor(r.left),u=r.top-Math.floor(r.top),b=Te(i,u),h=s.clientWidth,g=s.clientHeight,k={w:h,h:g,nodes:f,lines:[],lifelines:[],labels:[],crossings:[],through:[],unseated:[],outside:[],ox:i,oy:u},M=Lt();if(c.type==="sequence"||c.type==="schema")return{geo:k,grow:M};const z=h-(parseFloat(getComputedStyle(s).paddingRight)||0),w=(T,K,U)=>{const st=[T];for(let X=1;X<=(Ot(o,K)??0);X++)st.push({...T,t:T.t+U*d("4")*X,b:T.b+U*d("4")*X});return st},q=new Map;s.querySelectorAll(`.${a}-node`).forEach(T=>{const K=T.parentElement,U=Mt(K,r),st=getComputedStyle(K);q.set(T.dataset.node,U.r-(parseFloat(st.paddingRight)||0)-(parseFloat(st.borderRightWidth)||0))});const O=c.nodes,N=T=>p.get(O[T].id),D=T=>{const K=s.querySelector(`.${a}-node[data-node="${CSS.escape(T)}"]`),U=K?.parentElement;return!!(U?.matches(`.${a}-group[data-turn]`)&&U.querySelector(`:scope > .${a}-node`)===K)},dt=(T,K,U)=>D(K)?Array.from({length:Math.round(U/16)+1},(st,X)=>({...T,t:T.t-X*d("4"),b:T.b-X*d("4")})):[T],E=[],G=T=>Yt(c.edges[T].kind,l);c.edges.forEach((T,K)=>{const U=n.routes[K],st=p.get(T.from),X=p.get(T.to),J=G(K);let Z=[];const Q=T.label,m=Q?e(Q,"label"):0,$=Q?16*Vt(Q):16,S=d("4");if(U==="down"||U==="up"){const I=Math.max(st.rect.l,X.rect.l),j=Math.min(st.rect.r,X.rect.r),tt=c.edges.map((lt,ft)=>({o:lt,j:ft})).filter(({o:lt,j:ft})=>(n.routes[ft]==="down"||n.routes[ft]==="up")&&(lt.from===T.from&<.to===T.to||lt.from===T.to&<.to===T.from)),Y=tt.findIndex(lt=>lt.j===K),mt=tt.length<2?.5:tt.length===2?Y===0?.25:.75:(Y+1)/(tt.length+1),nt=b.x(I+(j-I)*mt,J);if(Z=U==="down"?[xt(st,"bottom",nt),xt(X,"top",nt)]:[xt(st,"top",nt),xt(X,"bottom",nt)],Q){let lt=Math.min(Z[0].y,Z[1].y),ft=Math.max(Z[0].y,Z[1].y);U==="down"?ft-=l.head:lt+=l.head;const yt=[...s.querySelectorAll(`.${a}-group`)].map(pt=>Mt(pt,r));let wt=[[lt,ft]];for(const pt of yt)for(const ut of[pt.t,pt.b])wt=wt.flatMap(([y,A])=>ut>y+1&&utyt.some(y=>(pt+ut)/2>y.t&&(pt+ut)/2y.l&&nt1){const pt=wt.filter(([y,A])=>!vt(y,A));[lt,ft]=(pt.length?pt:wt).reduce((y,A)=>A[1]-A[0]>y[1]-y[0]?A:y)}const St=[1/2,1/3,2/3].map(pt=>{const ut=lt+(ft-lt)*pt;return{l:nt-m/2-d("1"),r:nt+m/2+d("1"),t:ut-$/2,b:ut+$/2}});E.push({k:K,cands:St,on:!0,card:U==="down"?T.to:T.from})}}else if(U==="trunk"||U==="rail"){const I=b.x(Math.max(st.rect.l,U==="rail"?X.rect.l:st.rect.l)+d(U==="trunk"?"8":"3"),J),j=xt(st,"bottom",I);if(U==="rail"){if(Z=[j,xt(X,"top",I)],Q){const tt=X.rect.t-d("6");E.push({k:K,cands:w({l:I+d("2-5"),r:I+d("2-5")+m,t:tt-$/2,b:tt+$/2},T.to,-1),on:!1,card:T.to})}}else{const tt=b.x(X.rect.l+d("6"),J),Y=b.y(X.rect.t-S,J);Z=[j,{x:I,y:Y},{x:tt,y:Y},xt(X,"top",tt)],Q&&E.push({k:K,cands:[...dt({l:tt+d("2-5"),r:tt+d("2-5")+m,t:Y-$/2,b:Y+$/2},T.to,$),...w({l:tt+d("2-5"),r:tt+d("2-5")+m,t:Y-$/2,b:Y+$/2},T.to,-1).slice(1)],on:!1,card:T.to})}}else{const I=Math.min(q.get(T.from)??h,q.get(T.to)??h),j=b.x(n.gutter?z+(n.lanes[K]+1)*d("3-5"):I-d("2-5"),J),tt=b.y(st.rect.t+(st.rect.b-st.rect.t)*n.exits[K],J),Y=xt(st,"right",tt),mt=U==="end-down",nt=c.edges.map((ut,y)=>({o:ut,j:y})).filter(({o:ut,j:y})=>n.routes[y]===U&&ut.to===T.to).sort((ut,y)=>n.lanes[y.j]-n.lanes[ut.j]||ut.j-y.j),lt=Math.max(0,nt.findIndex(({j:ut})=>ut===K)),ft=X.rect.r-d("6")-lt*d("3"),yt=X.rect.r-d("6")-(nt.length-1)*d("3"),wt=b.x(ft,J),vt=mt?X.rect.t-S-lt*d("5"):X.rect.b+S+lt*d("5"),St=b.y(vt,J);Z=[Y,{x:j,y:Y.y},{x:j,y:St},{x:wt,y:St},xt(X,mt?"top":"bottom",wt)];const pt=mt?T.to:O[X.i+1]?.id??T.to;Q&&E.push({k:K,cands:[...mt?dt({l:yt-d("2-5")-m,r:yt-d("2-5"),t:vt-$/2,b:vt+$/2},pt,$):[{l:yt-d("2-5")-m,r:yt-d("2-5"),t:vt-$/2,b:vt+$/2}],...w({l:yt-d("2-5")-m,r:yt-d("2-5"),t:vt-$/2,b:vt+$/2},pt,mt?-1:1).slice(1)],on:!1,card:pt})}const B=ze(Z,J,b);k.lines.push({i:K,from:T.from,to:T.to,kind:T.kind,pts:B,tip:B[B.length-1],dir:ce(B),width:J})}),k.crossings=Pt(k.lines),k.through=ue(k.lines,f,c),k.outside=Xe(k.lines,h,g,l);const{obstacles:R}=Ze(s,r,a,0);R.heads=k.lines.map(T=>Ge(T,l));const C=[],W={l:0,t:0,r:h,b:g};for(const T of E){const K=X=>{const J=le(X,d("1"));return X.lW.r+.5||X.tW.b+.5||f.some(Z=>Re(J,Z))||C.some(Z=>It(J,Z))||R.heads.some(Z=>It(J,Z))||R.rects.some(Z=>It(J,Z))||k.lines.some(Z=>Z.i!==T.k&&qt(Z.pts).some(([Q,m])=>It(J,Ve(Q,m,Z.width))))},U=T.cands.find(X=>!K(X));U||(M[T.card]=(M[T.card]??0)+1,k.unseated.push(T.k));const st=U?Ke(U,i,u,X=>!K(X)):T.cands[0];C.push(st),k.labels.push({i:T.k,text:c.edges[T.k].label,box:st,on:T.on})}return{geo:k,grow:M}}function Qe(t,e,n=0){const o=a=>String(Math.round(a*100)/100);let c=`M${o(t[0].x)} ${o(t[0].y)}`;for(let a=1;a{const{crow:G,ring:R}=qe(N,D.x,D.y,dt,n.head,n.dot);return`${R?``:""}`};return`${O(e.card.from,w,Math.sign(q.x-w.x)||1,"from")}${O(e.card.to,e.tip,-l.x||1,"to")}`}const a=e.kind==="dashed",s=n.head,r=n.head/2,d=a?1:s-1,p=e.pts.map(w=>({...w})),f=p[p.length-1];f.x-=l.x*d,f.y-=l.y*d;const i=e.tip.x-l.x*s,u=e.tip.y-l.y*s,b=-l.y*r,h=l.x*r,g=w=>Math.round(w*100)/100,k=bt(e.kind),M=a?``:``,z=e.dot?``:"";return`${M}${z}`}function Pe(t,e,n,o){const c=new Map,l=new Map;for(const s of e.crossings)l.has(s.under)||l.set(s.under,[]),l.get(s.under).push(s);let a="";for(const[s,r]of l){const d=`${o}-cut-${s}`;c.set(s,d);const p=r.map(f=>{const i=e.lines[f.top],u=e.lines[f.under],b=i.width/2+n.cut,h=u.width/2+1;return f.underVertical?``:``}).join("");a+=`${p}`}return{defs:a,ids:c}}function tn(t,e,n,o){const{defs:c,ids:l}=Pe(t,e,n,o),a=e.lifelines.map(i=>``).join(""),s=(e.bars??[]).map(i=>``).join(""),r=e.lines.map((i,u)=>Jn(t,i,n,l.get(u)??null,i.from===i.to?n.radiusXs:n.radius)).join(""),p=`${a?`${a}`:""}${c?`${c}`:""}${s}${r}`,f=e.labels.map(i=>`1?' data-lines="2"':""} style="left:${Math.round(i.box.l*100)/100}px;top:${Math.round(i.box.t*100)/100}px;width:${Math.round((i.box.r-i.box.l)*100)/100}px">${i.text.split(` -`).map(bt).join("
")}
`).join("");return p+f}function he(t,e,n,o,c,l,a,s){const d=t.querySelector(`.${n}-drawing`);if(!d||t.clientWidth===0)return{dyn:c,geo:null,ink:"",tokens:null};const p=Tn(t),f=Fn(d,n),i=Hn(e,p,f);s?.(i.least);const u=t.clientWidth,b=(()=>{const E=document.activeElement;return E&&d.contains(E)&&E.dataset.node?E.dataset.node:void 0})(),h=E=>Rt(e,E)?{...E,stop:E.stop&&e.byId.has(E.stop)?E.stop:e.nodes[0]?.id,keep:void 0}:{...E,stop:E.stop??e.nodes[0]?.id,keep:b&&E.layout!=="drawn"?b:void 0};let g=!1;const k=E=>{if(g=!1,e.type!=="flowchart")return E;l({...E,heights:void 0,words:void 0});const G=Lt(),R=Lt();return d.querySelectorAll(`.${n}-node[data-shape="decision"]`).forEach(C=>{const W=C.querySelector(`.${n}-words`);if(!W)return;const T=C.getBoundingClientRect(),K=X=>{const J={w:X.width+2*p.space("2-5"),h:X.height+2*p.space("2")},Z=1-J.w/T.width,Q=Z>.05?J.h/2/Z:J.h*10;return Math.max(p.space("16"),Math.ceil(T.width/5),Math.ceil(2*Q))},U=W.getBoundingClientRect();let st=K(U);if(st>T.width){const X=m=>(C.style.setProperty("--_ww",`${m}px`),W.getBoundingClientRect()),J=Math.floor(C.clientWidth-2*p.space("2-5"));let Z=Math.ceil(U.width),Q=U.height;for(;Z1;){const I=m+$>>1;X(I).heightT.width&&(g=!0)}),{...E,heights:G,words:Object.keys(R).length?R:void 0}},M=()=>({m:e,tk:p,P:n,drawing:d,origin:d.getBoundingClientRect(),warn:a}),z=c.autoOpen?{open:!1,autoOpen:void 0}:{},w=(E,G)=>G.map(R=>Dt(e,E.lines.find(C=>C.i===R))).join(", ");if(e.text)return{dyn:{...c,layout:"stacked",bare:void 0},geo:null,ink:"",tokens:p,least:i.least};if(u>=i.least&&!e.unplaced){const E=W=>{let T=h({...c,...z,layout:"drawn",grow:void 0,track:void 0,bare:void 0,pad:W||void 0,rows:void 0});T=k(T),l(T);let K=Je(M(),f);return K.corridors&&(T={...T,rows:K.corridors.rows},l(T),K=Je({...M(),pick:K.corridors.pick},f)),{dd:T,g:K}};let{dd:G,g:R}=E(!1);const C=W=>W.through.length>0||W.outside.length>0||(W.overlaps?.length??0)>0||(W.misfit?.length??0)>0||g;if(!C(R)&&R.unseated.length&&R.unseated.every(W=>R.bounded?.includes(W))){const W=E(!0);!C(W.g)&&!W.g.unseated.length&&({dd:G,g:R}=W)}if(!C(R)&&!R.unseated.length)return R.crossings.length&&a?.(`${R.crossings.length} crossing${R.crossings.length===1?"":"s"} in the drawn layout: ${R.crossings.map(W=>`${Dt(e,R.lines[W.top])} over ${Dt(e,R.lines[W.under])}`).join("; ")}`),{dyn:G,geo:R,ink:tn(n,R,p,o),tokens:p,least:i.least};g&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: a decision would be taller than it is wide`),R.misfit?.length&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: ${R.misfit.join("; ")}`),R.through.length&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: ${w(R,R.through)} would pass through a node`),R.overlaps?.length&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: ${w(R,R.overlaps)} would lie on one another`),R.outside.length&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: ${w(R,R.outside)} would leave the drawing`),R.unseated.length&&a?.(`the drawn layout does not fit at ${Math.round(u)}px: no clean seat for ${R.unseated.map(W=>e.type==="sequence"?`message ${W}`:`"${_t(e.edges[W]?.label??"")}"`).join(", ")}`)}let q=h({...c,...z,layout:"stacked",heights:void 0,grow:Lt(),track:e.type==="schema"?i.table:void 0,bare:void 0,pad:void 0,rows:void 0});if(q=k(q),l(q),e.type==="sequence"||e.type==="schema")return{dyn:q,geo:null,ink:"",tokens:p,least:i.least};const O=_e(e);let N=Ye(M(),f,O,q.grow);for(let E=0;E<6&&Object.keys(N.grow).length;E++){const G=Lt(q.grow);for(const[R,C]of Object.entries(N.grow))G[R]=(Ot(G,R)??0)+C;q={...q,grow:G},l(q),N=Ye(M(),f,O,G)}const D=N.geo;if(!O.third&&O.laneCount>2&&a?.(`the stacked drawing uses ${O.laneCount} end lanes (four at most)`),D.unseated.length>0||D.through.length>0||D.outside.length>0||O.third){D.unseated.length&&a?.(`the stacked drawing has no clean seat for ${[...new Set(D.unseated)].map(R=>`"${_t(e.edges[R]?.label??"")}"`).join(", ")}, so its lines are not drawn; the list holds every connection`),D.through.length&&a?.(`in the stacked drawing ${w(D,D.through)} would pass through a node, so its lines are not drawn`),D.outside.length&&a?.(`in the stacked drawing ${w(D,D.outside)} would leave the drawing, so its lines are not drawn`),O.third&&a?.("the stacked drawing would need a fifth end lane, so its lines are not drawn","error");const E={...D,lines:[],labels:[],crossings:[]},G=h({...q,grow:Lt(),bare:!0,open:c.bare?c.open:!0,autoOpen:c.bare?c.autoOpen:c.open?void 0:!0});return l(G),{dyn:G,geo:E,ink:"",tokens:p,least:i.least}}return D.crossings.length&&a?.(`${D.crossings.length} crossing${D.crossings.length===1?"":"s"} in the stacked drawing (each is cut): ${D.crossings.map(E=>`${Dt(e,D.lines[E.top])} over ${Dt(e,D.lines[E.under])}`).join("; ")}`),{dyn:q,geo:D,ink:tn(n,D,p,o),tokens:p,least:i.least}}function Dt(t,e){const n=t.byId.get(e.from)?.name??e.from,o=t.byId.get(e.to)?.name??e.to;return`${n} to ${o}`}function Un(t,e,n,o,c,l){const a=new Set;if(l){a.add(l);for(const h of n?.lines??[])h.from===l&&a.add(h.to),h.to===l&&a.add(h.from)}if(t.toggleAttribute("data-tracing",!!l),t.querySelectorAll(`.${e}-node`).forEach(h=>h.toggleAttribute("data-near",a.has(h.dataset.node))),!n||!o)return;const s=h=>!!l&&(h.from===l||h.to===l),r=t.querySelector(`.${e}-edges`),d=new Map;t.querySelectorAll(`.${e}-edge`).forEach(h=>d.set(h.getAttribute("data-edge"),h));for(const h of n.lines){const g=d.get(String(h.i));g&&(g.toggleAttribute("data-lit",s(h)),g.toggleAttribute("data-dim",!!l&&!s(h)))}if(t.querySelectorAll(`.${e}-label`).forEach(h=>{const g=n.lines.find(k=>String(k.i)===h.dataset.edge);h.toggleAttribute("data-lit",!!(g&&s(g)))}),r){for(const h of n.lines)if(s(h)){const g=d.get(String(h.i));g&&r.appendChild(g)}}const p=Pt(n.lines,s),{defs:f,ids:i}=Pe(e,{...n,crossings:p},o,c),u=t.querySelector(`.${e}-svg`);if(!u)return;let b=u.querySelector("defs");!b&&f&&(b=document.createElementNS("http://www.w3.org/2000/svg","defs"),u.insertBefore(b,u.firstChild)),b&&(b.innerHTML=f),n.lines.forEach((h,g)=>{const k=d.get(String(h.i))?.querySelector(`.${e}-line`);if(!k)return;const M=i.get(g);M?k.setAttribute("mask",`url(#${M})`):k.removeAttribute("mask")})}var Xn=()=>matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active), print").matches||document.documentElement.getAttribute("data-loops")==="held";function Yn(t,e){const n=t.getAttribute("data-entrance");if(!(n==="running"||n==="done")){if(!e){n&&t.removeAttribute("data-entrance");return}n||t.setAttribute("data-entrance",Xn()||Pn(t)?"done":"pending")}}var Qn=t=>`basalt-diagram-entrance:${location.pathname}#${t.id}`;function Pn(t){if(!t.hasAttribute("data-first-visit")||!t.id)return!1;try{return localStorage.getItem(Qn(t))!==null}catch{return!1}}function en(t){const e=t.getAttribute("data-entrance");e!=="pending"&&e!=="running"||(t.setAttribute("data-entrance","done"),t.dispatchEvent(new Event("basalt-diagram-settle")))}function to(t,e,n,o=!1,c=!1){const l=o?Jt(t):null;if(l&&n.startsWith("Arrow")){const d={ArrowRight:c?"left":"right",ArrowLeft:c?"right":"left",ArrowDown:"down",ArrowUp:"up"}[n];return d?l[e]?.[d]??null:null}const a=t.byId.get(e)?.i??0,s=t.nodes.length;let r;if(n==="ArrowRight"||n==="ArrowDown")r=a+1;else if(n==="ArrowLeft"||n==="ArrowUp")r=a-1;else if(n==="Home")r=0;else if(n==="End")r=s-1;else return null;return t.nodes[Math.max(0,Math.min(s-1,r))].id}var eo=["data-layout","data-measured","role","aria-roledescription","aria-labelledby","aria-describedby","aria-label","tabindex","data-stops","hidden","data-art"],nn=["data-layout","data-measured","data-bare","data-motion","data-first-visit","data-rtl","data-cols","data-reach","data-gutter","data-marks"],no=["--_track","--_h","--_ww","--_gap","--_ggrow","--_tl","--_gpad","--_gw","--_mh","--_rows","--_row-gap"],on=t=>t==null||t===!1;function oo(t,e){if(t.tagName.toLowerCase()!==e.t)return!1;const n=typeof e.a.class=="string"?e.a.class.split(" ")[0]:"";return!n||t.classList.contains(n)}function te(t,e,n=!0){if(typeof e=="string"||"slot"in e)return;const o=n?nn:eo;for(const a of o)on(e.a[a])&&t.removeAttribute(a);for(const[a,s]of Object.entries(e.a)){if(a==="class")continue;if(a==="style"){const d=t.style,p=new Map(String(s??"").split(";").map(f=>{const i=f.indexOf(":");return[f.slice(0,i).trim(),f.slice(i+1).trim()]}).filter(([f])=>f));for(const[f,i]of p)d.getPropertyValue(f).trim()!==i&&d.setProperty(f,i);for(const f of no)p.has(f)||d.removeProperty(f);continue}if(n&&!nn.includes(a))continue;if(on(s)){t.removeAttribute(a);continue}const r=s===!0?"":String(s);t.getAttribute(a)!==r&&t.setAttribute(a,r)}if(e.t==="svg"||typeof e.a.class=="string"&&/-(ink|ruler)$/.test(e.a.class)||e.c.some(a=>typeof a!="string"&&"slot"in a))return;const c=[...t.children];let l=0;for(const a of e.c)if(!(typeof a=="string"||"slot"in a)){for(let s=l;st.querySelector(`.${e}-node[data-node="${CSS.escape(l)}"]`);n&&c(n)?.setAttribute("tabindex","-1"),c(o)?.setAttribute("tabindex","0")}(function(t){"use strict";var e=t._,n="diagram",o=0;function c(i,u,b){return{prefix:n,base:i,hasSource:u.source!==void 0&&u.source!==null&&u.source!=="",hiddenClass:"visually-hidden",viewer:b?b.keys:void 0}}function l(i,u,b,h){var g=function(k){return''+bt(k)+""};return{source:bt(String(u.source||"")),summary:bt(String(u.summary||"")),hint:re(i).map(function(k){return""+k.keys.map(g).join(" ")+" "+bt(k.words)+""}).join(""),toggle:'"}}function a(i,u,b){for(var h=i.layout==="auto"&&(i.type==="architecture"||i.type==="flowchart"||i.type==="schema"),g=h?Array.isArray(i.placement)?i.placement:i.placement?[i.placement]:[]:[],k=i.direction||(i.type==="flowchart"?"down":"right"),M=null,z=0;z");return{open:O.slice(0,N+1),inner:O.slice(N+1,O.length-9),warnings:w.errors.map(function(D){return"error: "+D}).concat(w.warnings)}}var s=["aria-labelledby","data-type","data-cols","data-reach","data-gutter","data-marks","data-layout","data-measured","data-bare"],r=["--_cols","--_gpad","--_track"];function d(i,u,b,h){i.__diagram&&i.__diagram.stop();var g=(i.getAttribute("aria-labelledby")||"").replace(/-title$/,"").replace(/[^A-Za-z0-9_-]/g,""),k=getComputedStyle(i).direction==="rtl",M=u.layout==="auto"&&(u.type==="architecture"||u.type==="flowchart"||u.type==="schema"),z=M?Array.isArray(u.placement)?u.placement:u.placement?[u.placement]:[]:[];M&&!z.length&&console.warn('Basalt diagram: "layout": "auto" needs a placement, which compose.mjs writes at build time; drawn from script, place it with placeDiagram (@srasyndicate/basalt/diagram-layout) and pass "placement". The figure is stacked');var w=u.direction?[u.direction]:u.type==="flowchart"?["down","right"]:["right","down"],q=function(F){for(var V=0;V .diagram-drawing")){if(!g||!i.querySelector("#"+CSS.escape(g+"-title"))){for(;document.getElementById("dg"+ ++o+"-title"););g="dg"+o}var N=a(u,g,h),D=document.createElement("div");D.innerHTML=N.open+"";var dt=D.firstChild;s.forEach(function(F){i.removeAttribute(F)}),r.forEach(function(F){i.style.removeProperty(F)});for(var E=0;E :not(script[data-diagram])").forEach(function(F){F.remove()}),i.insertAdjacentHTML("beforeend",N.inner)}O.warnings.forEach(function(F){console.warn("Basalt diagram: "+F)}),O.errors.forEach(function(F){console.error("Basalt diagram: "+F)}),O.motion.animated&&O.motion.firstVisit&&!i.id&&console.error('Basalt diagram: "entrance": "first-visit" needs an id on the figure: without one the entrance plays on every visit');var R=c(g,u,h),C={},W=null,T=null,K=null,U=null,st=Object.create(null),X=function(F,V){st[F]||(st[F]=1,(V==="error"?console.error:console.warn)("Basalt diagram: "+F))},J=function(F){te(i,Xt(O,F,R))},Z=i.querySelector(".diagram-ink"),Q=i.querySelector(".diagram-toggle"),m=!h&&O.motion.animated&&typeof e.diagramMotion=="function",$=null,S=null,B=function(){m&&en(i)};function I(){Un(i,n,W&&W.geo,W&&W.tokens,g,T||U||K),Y()}var j=null,tt=!h&&matchMedia("(hover: none), (pointer: coarse)").matches;function Y(){var F=tt&&!h&&Z&&Z.innerHTML!=="";if(i.toggleAttribute("data-touch",!!(tt&&!h)),F&&!j){var V=i.querySelector(":scope > .diagram-foot");if(!V)return;j=document.createElement("button"),j.type="button",j.className="btn diagram-clear",j.setAttribute("data-variant","secondary"),j.setAttribute("data-size","sm"),j.innerHTML="Clear highlight",j.addEventListener("click",function(){U&&(U=null,I())}),V.appendChild(j)}else!F&&j&&(j.remove(),j=null);j&&j!==j.parentNode.lastElementChild&&document.activeElement!==j&&j.parentNode.appendChild(j),j&&(U?j.removeAttribute("aria-disabled"):j.setAttribute("aria-disabled","true"))}function mt(F){if(!F.defaultPrevented){var V=$n(i,n,F,U);V!==void 0&&(B(),tt=!0,U=V,I())}}function nt(){Q&&(Q.setAttribute("aria-expanded",String(!!C.open)),Q.firstElementChild.textContent=C.open?"Hide the list":"View as list")}function lt(){if(M&&z.length>1&&!h){for(var F=null,V=[],et=!1,at=0;at1&&h&&!u.direction&&h.room){for(var ee=h.room(),Gt=-1,pe=null,ge=0;geGt+1e-6&&(Gt=sn,pe=me)}}}pe&&(O=pe)}W=(h?h.measure:he)(i,O,n,g,C,J,X),C=W.dyn,J(C),nt();var ye=i.querySelector(":scope > .diagram-hint");if(ye){var rn=re(O,C.layout==="drawn").map(function(At){return""+At.keys.map(function(io){return''+bt(io)+""}).join(" ")+" "+bt(At.words)+""}).join("");ye.innerHTML!==rn&&(ye.innerHTML=rn)}Rt(O,C)||(K=U=null);var ln=Z&&W.ink!==S;ln&&(Z.innerHTML=W.ink,S=W.ink),I();var ro=O.text?i.querySelector(".diagram-text[data-art]"):null;O.text&&typeof e.diagramText=="function"&&e.diagramText(i,O,u,h);var cn=O.text?i.querySelector(".diagram-text[data-art]"):null;m&&W.tokens&&(Yn(i,!!(W.geo&&W.geo.lines.length)||!!cn),(ln||cn!==ro)&&$&&$.redrawn()),h&&h.onMeasured&&W.tokens&&h.onMeasured(W,i)}function ft(F){C=F,J(C)}function yt(F){var V=C.stop;C=Object.assign({},C,{stop:F}),ao(i,n,V,F)}var wt=function(F){var V=F&&F.closest?F.closest(".diagram-node"):null;return V&&i.contains(V)?V:null};function vt(F){var V=wt(F.target);if(!(!V||F.defaultPrevented)){if(B(),F.key==="Escape"){!h&&(T||K||U)&&(F.preventDefault(),T=K=U=null,I());return}if(Rt(O,C)){var et=to(O,V.getAttribute("data-node"),F.key,C.layout==="drawn");if(et){F.preventDefault(),yt(et);var at=i.querySelector('.diagram-node[data-node="'+CSS.escape(et)+'"]');at&&at.focus()}}}}function St(F){var V=wt(F.target);if(V){B();var et=V.getAttribute("data-node");T=V.matches(":focus-visible")?et:null,Rt(O,C)&&C.stop!==et&&yt(et),I()}}function pt(F){var V=wt(F.target);V&&(wt(F.relatedTarget)||(T=null),C.keep===V.getAttribute("data-node")&&ft(Object.assign({},C,{keep:void 0})),I())}function ut(F){if(!(F.pointerType!=="mouse"||!matchMedia("(hover: hover)").matches)){var V=wt(F.target);V&&B();var et=V&&Rt(O,C)?V.getAttribute("data-node"):null;et!==K&&(K=et,I())}}function y(){K&&(K=null,I())}function A(){B(),ft(Object.assign({},C,{open:!C.open,autoOpen:void 0})),nt()}i.addEventListener("keydown",vt),i.addEventListener("focusin",St),i.addEventListener("focusout",pt),i.addEventListener("pointerover",ut),i.addEventListener("pointerleave",y),i.addEventListener("click",mt),Q&&Q.addEventListener("click",A),lt();var _=i.clientWidth,x=0,L=!0,H=new ResizeObserver(function(){Math.abs(i.clientWidth-_)<.5||(_=i.clientWidth,cancelAnimationFrame(x),x=requestAnimationFrame(lt))});H.observe(i),document.fonts&&document.fonts.ready.then(function(){L&<()});var P=matchMedia("(forced-colors: active)"),ot=O.nodes.some(function(F){return F.mark});ot&&P.addEventListener("change",lt),m&&($=e.diagramMotion(i,{fig:i,P:n,base:g,model:function(){return O},geo:function(){return W&&W.geo},tokens:function(){return W&&W.tokens}},u));var ct=!h&&u.zoom!==!1&&typeof e.diagramZoom=="function"?e.diagramZoom(i,u,{model:O,settle:B,animated:m}):null,it=i.querySelector(":scope > .diagram-foot"),rt=!h&&u.export===!0&&it&&typeof e.diagramExport=="function"?e.diagramExport(it,i):[];i.__diagram={stop:function(){ct&&ct.destroy(),rt.forEach(function(F){F.remove()}),L=!1,H.disconnect(),cancelAnimationFrame(x),ot&&P.removeEventListener("change",lt),$&&$.destroy(),i.removeEventListener("keydown",vt),i.removeEventListener("focusin",St),i.removeEventListener("focusout",pt),i.removeEventListener("pointerover",ut),i.removeEventListener("pointerleave",y),i.removeEventListener("click",mt),j&&j.remove(),Q&&Q.removeEventListener("click",A)},layout:lt,key:p(u),send:$&&$.sendValue?$.sendValue:null}}function p(i){try{return JSON.stringify(i,function(u,b){return u==="packet"&&b&&typeof b=="object"?Object.assign({},b,{send:void 0}):b})}catch{return null}}function f(){document.querySelectorAll("figure.diagram").forEach(function(i){if(!i.__diagram){var u=i.querySelector(":scope > script[data-diagram]");if(u)try{d(i,JSON.parse(u.textContent),!0)}catch(b){console.error("Basalt diagram: this figure could not be drawn",b)}}})}e.diagramMarkup=a,e.diagramKit={draw:d,buildModel:Nt,figureKey:Sn,figureList:Cn,hintEntries:re,toHtml:oe,escapeHtml:bt,settleEntrance:en,measureFigure:he},t.diagram=function(i,u){var b=i.__diagram,h=b&&b.send?p(u):null;if(h!==null&&h===b.key){b.send(u.packet?u.packet.send:void 0);return}d(i,u)},e.step(62,"wireDiagrams",f)})(window.Basalt)})(); +(()=>{var fn=["top","right","bottom","left"],un=["main","plain","dashed"],we=["one","zero-or-one","one-or-many","zero-or-many"],Ht={one:"Exactly one","zero-or-one":"Zero or one","one-or-many":"One or many","zero-or-many":"Zero or many"},hn=[2,3,4,5,6],ht=t=>t==null||t===""?void 0:String(t),Lt=t=>Object.assign(Object.create(null),t),Ot=(t,e)=>t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;function Wt(t,e={}){const o=e.checks!==!1,c=[],l=$=>{c.push($)},s=[],a=$=>{s.push($)},r=t.legend??{},d={};for(const $ of["main","plain","dashed","focal","group","activation"]){const u=ht(r[$]);u&&(d[$]=u)}const g=t.stepLabel,f=typeof g=="function"?$=>String(g($)):typeof g=="string"?($=>g.replace("{n}",String($))):$=>`Step ${$}`,i=t.shapeLabels??{},h={terminal:ht(i.terminal)??"Start or end",step:ht(i.step)??"Step",decision:ht(i.decision)??"Decision"},b=t.heading===void 0?3:hn.includes(t.heading)?t.heading:(l(`heading ${String(t.heading)} is not a level from 2 to 6: the title is an h3`),3),p=($,u)=>$==null?"plain":un.includes($)?$:(l(`"${String($)}" is not a kind of line (main, plain or dashed): ${u} is drawn plain`),"plain"),m=$=>{if($!=null){if(fn.includes($))return $;l(`"${String($)}" is not a side (top, right, bottom or left): the derived side is used`)}},k=($,u)=>typeof $=="number"&&Number.isInteger($)&&$>=1?$:(t.layout==="auto"&&$==null||l(`${u} is ${JSON.stringify($)}, not a whole number from 1: it is placed at 1`),1),L=[],z=[];let v=[];const O=[],B=[],j=t.type;if(["architecture","flowchart","data-flow","sequence","schema"].includes(j)||l(`"${String(j)}" is not a type of diagram (architecture, flowchart, data-flow, sequence or schema)`),j==="architecture"||j==="flowchart"){for(const $ of t.nodes??[]){const u=j==="flowchart"&&$.shape==="decision"?"decision":j==="flowchart"&&$.shape==="terminal"?"terminal":"box",w=String($.id??""),C=k($.row,`the row of ${w}`);L.push({id:w,i:L.length,name:String($.name??""),kind:u==="decision"?void 0:ht($.kind),detail:u==="decision"?void 0:ht($.detail),mono:!!$.detailMono,focal:!!$.focal,col:k($.col,`the column of ${w}`),row:C,row2:C,branch:!!$.branch,shape:u,group:j==="architecture"?ht($.group):void 0,mark:j==="architecture"?oe($.mark,l):void 0})}if(j==="architecture"){const $=(t.groups??[]).map(I=>({id:String(I.id??""),label:String(I.label??""),parent:ht(I.parent)})),u=new Map($.map(I=>[I.id,I])),w=I=>{if(!I.parent)return 1;const _=u.get(I.parent);return _?_.parent===I.id||_.id===I.id?(a(`the groups "${I.label}" and "${_.label}" are each other's parent`),I.parent=void 0,1):_.parent?(a(`the group "${I.label}" is a third level: groups nest two deep`),I.parent=void 0,1):2:(a(`the group "${I.label}" names the parent "${I.parent}", which is not a group`),I.parent=void 0,1)},C=$.map(w);$.forEach((I,_)=>O.push({...I,depth:C[_],members:L.filter(X=>X.group===I.id).map(X=>X.id),all:[]}));for(const I of O)I.all=[...I.members,...O.filter(_=>_.parent===I.id).flatMap(_=>_.members)];O.sort((I,_)=>I.depth-_.depth)}}else if(j==="data-flow"){v=(t.lanes??[]).map(u=>({id:String(u.id??""),label:String(u.label??"")}));const $=new Map(v.map((u,w)=>[u.id,w+1]));for(const u of t.nodes??[]){const w=String(u.id??""),C=String(u.lane??""),I=$.get(C);I===void 0&&l(`a node (${w}) names the lane "${C}", which is not in lanes`);const _=L.length+1;L.push({id:w,i:L.length,name:String(u.name??""),kind:f(_),detail:ht(u.detail),mono:!!u.detailMono,focal:!!u.focal,col:k(u.col,`the column of ${w}`),row:I??1,row2:I??1,branch:!1,shape:"box",lane:I??1,laneLabel:v[(I??1)-1]?.label??C,step:_,mark:oe(u.mark)})}}else if(j==="sequence"){(t.participants??[]).forEach((C,I)=>{const _=String(C.name??"");L.push({id:String(C.id??""),i:I,name:_,kind:ht(C.kind),mono:!1,focal:!!C.focal,col:I+1,row:1,row2:1,branch:!1,shape:"participant",short:ht(C.short)??_,mark:oe(C.mark)})});let $=0;const u=new Map(L.map(C=>[C.id,C.col])),w=(C,I)=>{let _=1/0,X=-1/0;for(const V of C??[]){if(!V||typeof V!="object")continue;if("band"in V){I>0&&a(`the band "${String(V.band)}" is inside a frame: a band is the whole figure's`),B.push({band:String(V.band??"")});continue}if("frame"in V){if(I>=2){a("a frame is a third level: frames nest two deep");continue}const $t=V.frame==="alt"||V.frame==="loop"||V.frame==="opt"?V.frame:"opt",bt=$t==="alt"?V.branches??[]:[{label:V.label,steps:V.steps}];$t==="alt"&&bt.length<2&&a("an alt frame has one branch: it needs two or more");const wt=String(bt[0]?.label??"");wt.length>40&&a(`the frame label "${wt}" is over 40 characters`);const vt=B.length;B.push({open:$t,label:wt,depth:I+1,a:0,b:0}),bt.forEach((y,S)=>{if(S){const N=String(y.label??"");N.length>40&&a(`the frame label "${N}" is over 40 characters`),B.push({otherwise:N,depth:I+1})}y.steps?.length||a(`a frame or branch ("${String(y.label??"")}") is empty`);const[E,M]=w(y.steps??[],I+1);_=Math.min(_,E),X=Math.max(X,M);const A=B[vt];A.a=Math.min(A.a||1/0,E),A.b=Math.max(A.b,M)}),B.push({close:I+1});continue}$++;const ft=String(V.label??"");ft.includes(` +`)&&a(`message ${$}'s label has a break: a message's second line is its note`);const st=String(V.from??""),lt=String(V.to??"");B.push({n:$,from:st,to:lt,label:qt(ft),note:ht(V.note),kind:p(V.kind,`message ${$}`),activate:V.activate===!0||void 0,deactivate:V.deactivate===!0||void 0});const pt=u.get(st)??1,Mt=u.get(lt)??1,ut=pt===Mt?pt===L.length?pt-1:pt+1:pt;_=Math.min(_,pt,Mt,ut),X=Math.max(X,pt,Mt,ut)}return[_,X]};w(t.steps??[],0);for(const C of B)"open"in C&&!Number.isFinite(C.a)&&(C.a=1,C.b=Math.max(1,L.length))}else if(j==="schema")for(const $ of t.tables??[]){const u=String($.name??""),[w,C]=Array.isArray($.row)?$.row:[$.row,$.row],I=k(w,`the row of ${u}`),_=Math.max(I,k(C,`the last row of ${u}`)),X=$.more===void 0||$.more===null?void 0:Number.isInteger($.more)&&$.more>0?$.more:(l(`${u}'s "more" is ${JSON.stringify($.more)}, not a whole number from 1: it is left out`),void 0);L.push({id:u,i:L.length,name:u,mono:!0,focal:!!$.focal,col:k($.col,`the column of ${u}`),row:I,row2:_,branch:!1,shape:"table",more:X,columns:($.columns??[]).map(V=>({name:String(V.name??""),type:ht(V.type),key:V.key==="PK"||V.key==="FK"?V.key:(V.key!==void 0&&V.key!==null&&l(`${u}.${String(V.name)}'s key is "${String(V.key)}", not PK or FK: it is left out`),void 0)}))})}let F=!1;if(t.layout==="auto"&&(j==="architecture"||j==="flowchart"||j==="schema")){const $=j==="schema"?t.tables:t.nodes;o&&($??[]).some(w=>w&&(w.col!==void 0||w.row!==void 0))&&l('a card under layout="auto" has a col or row, which is not read: there are no hints');const u=e.placement?.cells;u||(F=!0);for(const w of L){const C=u?.[w.id];w.col=C?.col??1,w.row=w.row2=C?.row??1}if(u){const w=new Map;for(const C of L){const I=Ot(u,C.id);if(!I){F=!0,l(`the placement has no cell for ${C.id}, so it is not used`);continue}const _=`${I.col},${I.row}`;w.has(_)&&(F=!0,l(`the placement puts ${w.get(_)} and ${C.id} in one cell, so it is not used`)),w.set(_,C.id)}}if(u&&!F)for(const w of O){const C=w.all.map(st=>L.find(lt=>lt.id===st)).filter(Boolean);if(!C.length)continue;const I=Math.min(...C.map(st=>st.col)),_=Math.max(...C.map(st=>st.col)),X=Math.min(...C.map(st=>st.row)),V=Math.max(...C.map(st=>st.row)),ft=L.filter(st=>!w.all.includes(st.id)&&st.col>=I&&st.col<=_&&st.row>=X&&st.row<=V);ft.length&&(F=!0,l(`the placement puts ${ft.map(st=>st.id).join(", ")} inside the box of the group "${w.label}", so it is not used`))}}else t.layout==="auto"&&a(`layout="auto" is for an architecture, a flowchart or a schema, not a ${j}`);((j==="schema"?t.tables:j==="sequence"?t.participants:t.nodes)??[]).forEach(($,u)=>{if(!$||$.href===void 0||$.href===null)return;const w=String($.href);if(j==="sequence"){a(`${L[u]?.id}: a participant cannot be a link (href)`);return}if(!w.trim()){a(`${L[u]?.id}'s href is empty`);return}const C=L[u];C&&(C.href=w,C.blank=$.target==="_blank")});const q=new Map;for(const $ of L)$.id?q.has($.id)&&l(`the id "${$.id}" is used twice`):l("a node has no id"),q.set($.id,$);if(j==="schema"){const $=(w,C)=>{if(w==null)return;const I=w,_=we.includes(I.from)?I.from:void 0;if(!_){a(`${C}'s cardinality "from" is ${JSON.stringify(I.from)}, not one, zero-or-one, one-or-many or zero-or-many: it is left out`);return}return I.to===void 0||I.to===null?{from:_,to:"one"}:I.to==="one"||I.to==="zero-or-one"?{from:_,to:I.to}:(a(`${C}'s cardinality "to" is ${JSON.stringify(I.to)}: a foreign key references one row at most (one or zero-or-one), so it is drawn as one`),{from:_,to:"one"})};(t.tables??[]).forEach(w=>(w.columns??[]).forEach((C,I)=>{const _=ht(C.references);if(!_&&C.cardinality!==void 0&&C.cardinality!==null&&a(`${String(w.name)}.${String(C.name)} states a cardinality but references nothing`),!_)return;const[X,V]=_.split("."),ft=q.get(X??""),st=ft?.columns?.findIndex(Mt=>Mt.name===V)??-1;if(!ft||st<0){l(`${String(w.name)}.${String(C.name)} references ${_}, which is not a shown column`);return}const lt=q.get(String(w.name??""));lt.columns[I].ref={table:X,column:V,row:st};const pt=$(C.cardinality,`${String(w.name)}.${String(C.name)}`);pt&&(lt.columns[I].card=pt),z.push({i:z.length,from:lt.id,to:X,kind:"plain",fromRow:I,toRow:st,fk:!0,card:pt})}));const u=z.filter(w=>w.card).length;u&&u!w.card).map(w=>`${w.from}.${q.get(w.from).columns[w.fromRow].name}`).join(", ")} ${z.length-u===1?"has":"have"} none)`)}else if(j!=="sequence")for(const $ of t.edges??[]){const u=String($.from??""),w=String($.to??"");if(!q.has(u)||!q.has(w)){l(`a line names ${q.has(u)?w:u}, which is not a node`);continue}const C=ht($.label),I=C?.split(` +`)??[];I.length>2&&a(`the label "${qt(C)}" has more than one break: a label is two lines at most`),I.some(_=>_.length>Me)&&a(`a line of the label "${qt(C)}" is over ${Me} characters: longer words belong in the node or the summary`),z.push({i:z.length,from:u,to:w,kind:p($.kind,`the line from ${u} to ${w}`),label:C,fromSide:m($.fromSide),toSide:m($.toSide),flow:j!=="flowchart"&&$.flow===!0?!0:void 0})}else for(const $ of B)"n"in $&&(!q.has($.from)||!q.has($.to))&&l(`message ${$.n} names ${q.has($.from)?$.to:$.from}, which is not a participant`);if(o&&j!=="sequence"&&!F){const $=new Map;for(const u of L)for(let w=u.row;w<=u.row2;w++){const C=`${u.col}:${w}`;$.has(C)&&l(`${u.id} and ${$.get(C)} share the cell at column ${u.col}, row ${w}`),$.set(C,u.id)}}if(o&&!F){for(const u of O){const w=u.all.map(_=>q.get(_));if(!w.length)continue;const C={c1:Math.min(...w.map(_=>_.col)),c2:Math.max(...w.map(_=>_.col)),r1:Math.min(...w.map(_=>_.row)),r2:Math.max(...w.map(_=>_.row2))};for(const _ of L)!u.all.includes(_.id)&&_.col>=C.c1&&_.col<=C.c2&&_.row>=C.r1&&_.row<=C.r2&&l(`${_.id} is inside the box of the group "${u.label}" but not a member`);const I=w.map(_=>_.i);Math.max(...I)-Math.min(...I)+1!==I.length&&l(`the members of the group "${u.label}" are not next to each other in the author's order, so the stacked drawing cannot wrap them in one box`)}for(const u of L)u.group&&!O.some(w=>w.id===u.group)&&l(`${u.id} names the group "${u.group}", which is not in groups`);L.filter(u=>u.focal).length>1&&l("more than one node is focal: a diagram has one at most");const $=new Set(j==="sequence"?B.flatMap(u=>"n"in u?[u.kind]:[]):z.map(u=>u.kind));$.has("main")&&!d.main&&l("main lines are drawn but the legend has no words for them (legend.main)"),$.has("dashed")&&!d.dashed&&l("dashed lines are drawn but the legend has no words for them (legend.dashed)"),L.some(u=>u.focal)&&!d.focal&&l("a focal node is drawn but the legend has no words for what it marks (legend.focal)")}const D=j==="architecture"||j==="data-flow",T=$=>Array.isArray($)&&$.length>1?$.map(String):void 0,R=D&&t.packet&&typeof t.packet=="object"?t.packet:void 0,H=R&&T(R.path),Q={animated:t.motion==="animated",pulse:D?T(t.pulse):void 0,packet:H?{path:H,repeat:R.repeat===!0,send:R.send}:void 0,run:j==="sequence"&&t.run===!0,firstVisit:t.entrance==="first-visit"||void 0};if(o)for(const $ of L){const u=$.mark?.says;if(!u?.length)continue;const w=[$.name,$.kind,$.detail,$.laneLabel].filter(Boolean).join(" ").toLowerCase();u.some(C=>w.includes(C.toLowerCase()))||l(`${$.id}'s mark stands for ${u.join(" or ")}, and none of its words say so`)}const at=[];if(j==="sequence"){const $=new Map,u=new Map;for(const w of B)"n"in w&&(u.set(w.from,w.n),u.set(w.to,w.n));for(const w of B)if("n"in w){if(w.activate){const C=$.get(w.to)??[];if(C.length>=3)a(`message ${w.n} opens a fourth bar on ${w.to}: three deep at most`);else{const I={who:w.to,from:w.n,to:w.n,depth:C.length+1};C.push(I),at.push(I),$.set(w.to,C)}}if(w.deactivate){const I=$.get(w.from)?.pop();I?I.to=w.n:a(`message ${w.n} closes a bar on ${w.from}, which has none open`)}}for(const[w,C]of $)for(const I of C)I.to=Math.max(I.from,u.get(w)??I.from)}const it=t.frameLabels??{},yt={opt:ht(it.opt)??"Only if",loop:ht(it.loop)??"Repeats",alt:ht(it.alt)??"One of these",else:ht(it.else)??"Otherwise"},dt=t.layout==="auto"&&!F?e.placement:void 0;let et=Math.max(1,dt?.cols??1,...L.map($=>$.col));if(e.rtl){for(const u of L)u.col=et-u.col+1;const $=u=>u==="left"?"right":u==="right"?"left":u;for(const u of z)u.fromSide=$(u.fromSide),u.toSide=$(u.toSide);for(const u of B)if("open"in u){const[w,C]=[et-u.b+1,et-u.a+1];u.a=w,u.b=C}et=Math.max(1,dt?.cols??1,...L.map(u=>u.col))}const nt=j==="data-flow"?Math.max(1,v.length):Math.max(1,dt?.rows??1,...L.map($=>$.row2)),tt={type:j,title:String(t.title??""),heading:b,legend:d,nodes:L,byId:q,edges:z,groups:O,lanes:v,steps:B,bars:at,frameWords:yt,cols:et,rows:nt,shapeLabels:h,stepWord:f,warnings:c,errors:s,motion:Q,memo:new Map,rtl:e.rtl||void 0,unplaced:F||void 0,text:j==="sequence"&&t.variant==="text"||void 0,marks:z.some($=>$.card)||void 0};if(t.layout==="auto"&&!F&&j!=="schema"&&pn(tt),o)for(const[$,u]of Object.entries(De(tt)))u>=48&&l(`${$} grows to ${u}px to hold the lines on one side: use another side`);return o&&L.length>100&&l(`the figure has ${L.length} cards: more than 100, which automatic layout places on the main thread`),o&&L.length>1&&!F&&!Ut(tt)&&l("some part cannot be reached from another by the arrow keys where the figure is drawn, so its arrows keep the author's order"),tt}function pn(t){const e=new Set(t.nodes.map(a=>`${a.col},${a.row}`)),n=(a,r)=>{const d=[];for(let g=Math.min(a,r)+1;g{const r=t.byId.get(a.from),d=t.byId.get(a.to),g=d.col>r.col?"right":"left",f=d.row>r.row?"bottom":"top",i=d.col>r.col?"left":"right",h=d.row>r.row?"top":"bottom",b=(k,L,z,v)=>n(k,L).map(O=>v?[O,z]:[z,O]);let p;const m=k=>(k==="right"?r.col1:k==="bottom"?r.row1)?[{sides:[k,k],cells:[]}]:[];return r.row===d.row?p=[{sides:[g,i],cells:b(r.col,d.col,r.row,!0)},...m("bottom"),...m("top")]:r.col===d.col?p=[{sides:[f,h],cells:b(r.row,d.row,r.col,!1)},...m("right"),...m("left")]:p=[{sides:[g,h],cells:[...b(r.col,d.col,r.row,!0),[d.col,r.row],...b(r.row,d.row,d.col,!1)]},{sides:[f,i],cells:[...b(r.row,d.row,r.col,!1),[r.col,d.row],...b(r.col,d.col,d.row,!0)]},{sides:[g,i],cells:b(r.col,d.col,r.row,!0)},{sides:[f,h],cells:b(r.row,d.row,r.col,!1)}],p.filter(k=>k.cells.every(([L,z])=>!e.has(`${L},${z}`)))},c=new Map,l=new Set;for(const a of t.edges)if(a.fromSide||a.toSide){const[r,d]=fe(t.byId.get(a.from),t.byId.get(a.to)),g=a.fromSide??r,f=a.toSide??d;l.add(`${a.from}.${g}`);for(const[i,h]of[[a.from,g],[a.to,f]])c.set(`${i}.${h}`,(c.get(`${i}.${h}`)??0)+1)}const s=t.edges.map((a,r)=>r).sort((a,r)=>o(t.edges[a]).length-o(t.edges[r]).length||+(t.edges[r].kind==="main")-+(t.edges[a].kind==="main")||a-r);for(const a of s){const r=t.edges[a];if(r.fromSide||r.toSide)continue;const d=(f,i,h)=>{const b=`${f}.${i}`;return(c.get(b)??0)>=3?!1:t.byId.get(f).shape!=="decision"?!0:h?!c.has(b):!l.has(b)},g=o(r).find(f=>d(r.from,f.sides[0],!0)&&d(r.to,f.sides[1],!1));if(g){l.add(`${r.from}.${g.sides[0]}`);for(const[f,i]of[[r.from,g.sides[0]],[r.to,g.sides[1]]])c.set(`${f}.${i}`,(c.get(`${f}.${i}`)??0)+1);r.fromSide=g.sides[0],r.toSide=g.sides[1]}}}function oe(t,e){if(typeof t=="string")return t?{id:t}:void 0;if(!t||typeof t!="object")return;const n=t,o=ve(ht(n.onLight),e);if(o)return{onLight:o,onDark:ve(ht(n.onDark),e)??o,says:Array.isArray(n.says)?n.says.map(String):void 0}}function ve(t,e){if(t){if(/^data:image\//i.test(t.trim()))return t;try{if(/^https?:$/.test(new URL(t,"https://basalt.invalid/").protocol)&&!/^http:/i.test(t.trim()))return t}catch{}e?.(`a card's mark ${JSON.stringify(t.slice(0,60))} is not a relative path, https or a data: image, so it is not drawn`)}}var xe=t=>`url("${t.replace(/[\\"\n\r\f;]/g,e=>e===` +`?"\\a ":e==="\r"?"\\d ":e==="\f"?"\\c ":e===";"?"\\3b ":`\\${e}`)}")`;function Rt(t,e,n){return t.memo.has(e)||t.memo.set(e,n()),t.memo.get(e)}var Me=28,Kt=t=>t.includes(` +`)?2:1,qt=t=>t.replace(/\n/g," "),Ft=t=>{const e=t.trim();return e?/[.!?]$/.test(e)?e:`${e}.`:""};function ke(t,e){return t.legend[e]}function gn(t,e){return e.shape==="decision"?"decision":e.shape==="terminal"?t.edges.some(n=>n.from===e.id)?"start":"end":e.kind??"step"}function mn(t,e){return Rt(t,`sentence:${e.i}`,()=>yn(t,e))}function yn(t,e){const n=[];if(t.type==="schema"){n.push(`${e.name}, table.`);const o=(e.columns??[]).filter(l=>l.ref).map(l=>`${l.ref.table} (${l.name}${l.card?`: ${Se(e.id,l.ref.table,l.card)}`:""})`),c=t.edges.filter(l=>l.to===e.id).map(l=>`${l.from} (${t.byId.get(l.from).columns[l.fromRow].name}${l.card?`: ${Se(l.from,l.to,l.card)}`:""})`);o.length&&n.push(`References ${o.join(", ")}.`),c.length&&n.push(`Referenced by ${c.join(", ")}.`)}else if(t.type==="sequence"){const o=t.steps.filter(s=>"n"in s&&s.from===e.id).length,c=t.steps.filter(s=>"n"in s&&s.to===e.id).length;n.push(Ft(e.kind?`${e.name}, ${e.kind}`:e.name)),n.push(`Sends ${o} ${o===1?"message":"messages"} and receives ${c}.`);const l=Ee(t,e);l&&n.push(l.trim())}else{const o=t.type==="data-flow"?`${t.stepWord(e.step)} of ${t.nodes.length}, ${e.laneLabel}`:t.type==="flowchart"?gn(t,e):e.kind;if(n.push(Ft(o?`${e.name}, ${o}`:e.name)),e.detail&&n.push(Ft(e.detail)),e.group){const s=t.groups.find(r=>r.id===e.group),a=s?.parent?t.groups.find(r=>r.id===s.parent):void 0;s&&n.push(a?`In ${s.label}, in ${a.label}.`:`In ${s.label}.`)}const c=t.edges.filter(s=>s.to===e.id).map(s=>`${t.byId.get(s.from).name}${s.label?` (${qt(s.label)})`:""}`),l=t.edges.filter(s=>s.from===e.id).map(s=>`${t.byId.get(s.to).name}${s.label?` (${qt(s.label)})`:""}`);c.length&&n.push(`From: ${c.join(", ")}.`),l.length&&n.push(`To: ${l.join(", ")}.`)}return e.focal&&t.legend.focal&&n.push(Ft(t.legend.focal)),n.join(" ")}var $n=(t,e,n,o)=>[`${Ht[n.from].toLowerCase()} `,o(t),` to ${Ht[n.to].toLowerCase()} `,o(e)],Se=(t,e,n)=>`${Ht[n.from].toLowerCase()} ${t} to ${Ht[n.to].toLowerCase()} ${e}`;function Ee(t,e){const n=t.bars.filter(c=>c.who===e.id&&c.depth===1);return n.length?` ${t.legend.activation??"Working"} during ${n.map(c=>c.from===c.to?`message ${c.from}`:`messages ${c.from} to ${c.to}`).join(" and ")}.`:""}function bn(t,e,n,o){const c=n.pointerType;if(c!=="touch"&&c!=="pen")return;const l=t.querySelector(`.${e}-drawing`),s=n.target;if(!l||!s||!l.contains(s)||!t.querySelector(`.${e}-edge`))return;const a=s.closest(`.${e}-node`);if(!a?.hasAttribute("href"))return a?a.dataset.node===o?null:a.dataset.node??null:o===null?void 0:null}function Ae(t){return t.type==="architecture"?"a part":t.type==="sequence"?"a participant":t.type==="schema"?"a table":"a step"}function x(t,e,...n){const o=[];for(const c of n.flat(1/0))c!=null&&c!==!1&&!Array.isArray(c)&&o.push(c);return{t,a:e??{},c:o}}var wn={"&":"&","<":"<",">":">",'"':""","'":"'"},mt=t=>t.replace(/[&<>"']/g,e=>wn[e]),vn=" br img input meta link hr path polygon polyline circle rect line ";function se(t,e={}){if(typeof t=="string")return mt(t);if("slot"in t)return e[t.slot]??"";if(!/^[a-z][a-z0-9]*$/.test(t.t))throw new Error(`diagram: "${t.t}" is not an element name`);let n="";for(const[o,c]of Object.entries(t.a))if(!(c==null||c===!1)){if(!/^[a-z][a-z0-9:-]*$/i.test(o))throw new Error(`diagram: "${o}" is not an attribute name`);n+=c===!0?` ${o}`:` ${o}="${mt(String(c))}"`}return vn.includes(` ${t.t} `)&&!t.c.length?t.t==="path"||t.t==="polygon"||t.t==="polyline"||t.t==="circle"||t.t==="rect"||t.t==="line"?`<${t.t}${n}/>`:`<${t.t}${n}>`:`<${t.t}${n}>${t.c.map(o=>se(o,e)).join("")}`}var xn=t=>({title:`${t}-title`,summary:`${t}-summary`,keys:`${t}-keys`,list:`${t}-list`,toggle:`${t}-toggle`});function Tt(t,e){return!e.layout||e.bare?!1:e.layout==="drawn"?!0:t.type!=="sequence"&&t.type!=="schema"}function Mn(t,e){return t.type==="sequence"||t.type==="schema"?e.layout==="drawn":!0}function Zt(t,e){const n=e.all.map(o=>t.byId.get(o));return n.length?{c1:Math.min(...n.map(o=>o.col)),c2:Math.max(...n.map(o=>o.col)),r1:Math.min(...n.map(o=>o.row)),r2:Math.max(...n.map(o=>o.row2))}:null}function Le(t){return Rt(t,"group-edges",()=>{const e=[0,0,0,0];for(const n of t.groups){const o=Zt(t,n);if(!o)continue;[o.r1===1,o.c2===t.cols,o.r2===t.rows,o.c1===1].forEach((l,s)=>{l&&(e[s]=Math.max(e[s],_e(t,n,s)))})}return e})}function _e(t,e,n){const o=Zt(t,e);return t.groups.filter(s=>s.parent===e.id).some(s=>{const a=Zt(t,s);return a&&[a.r1===o.r1,a.c2===o.c2,a.r2===o.r2,a.c1===o.c1][n]})?2:1}function qe(t){const e=Le(t);return e[1]+e[3]}function ae(t){return t.type==="sequence"?t.nodes.length:t.cols}function Ie(t){return Rt(t,"plan",()=>kn(t))}function kn(t){const e=t.nodes,n=m=>t.type==="data-flow"||!e[m].branch,o=t.edges.map(m=>{const k=t.byId.get(m.from).i,L=t.byId.get(m.to).i,v=e.slice(Math.min(k,L)+1,Math.max(k,L)).every(O=>!n(O.i));return L===k+1&&!(n(k)&&!n(L))?"down":L===k-1?"up":L>k&&n(k)&&!n(L)&&v?"trunk":L>k&&n(k)&&n(L)&&v?"rail":L>k?"end-down":"end-up"}),c=t.edges.map((m,k)=>({e:m,k})).filter(({k:m})=>o[m]==="end-down"||o[m]==="end-up"),l=m=>{const k=t.byId.get(m.from).i,L=t.byId.get(m.to).i;return[Math.min(k,L),Math.max(k,L)]},s=(m,k)=>{const[L,z]=l(m),[v,O]=l(k);return L{const k=t.byId.get(m.from).i,[L,z]=l(m);return!n(k)&&e.slice(L+1,z).every(v=>!n(v.i))&&c.every(v=>v.e===m||!s(v.e,m))}),r=c.length>0&&(t.type==="data-flow"||!a),d=m=>{const[k,L]=l(m);return L-k},g=t.edges.map(()=>0);let f=!1;const i=[];for(const m of[...c].sort((k,L)=>d(k.e)-d(L.e)||k.k-L.k)){let k=0;for(const L of i)s(L.e,m.e)&&(k=Math.max(k,g[L.k]+1));g[m.k]=k,k>3&&(f=!0),i.push(m)}const h=Math.max(0,...c.map(({k:m})=>g[m]+1)),b=t.edges.map(()=>.5);for(const m of e){const k=c.filter(({e:v})=>v.from===m.id);if(k.length<2)continue;const L=k.filter(({k:v})=>o[v]==="end-down").sort((v,O)=>d(O.e)-d(v.e)||v.k-O.k);[...k.filter(({k:v})=>o[v]==="end-up").sort((v,O)=>d(v.e)-d(O.e)||O.k-v.k),...L].forEach(({k:v},O,B)=>{b[v]=B.length===2?O===0?1/3:2/3:(O+1)/(B.length+1)})}const p=Lt();for(let m=1;m{const D=o[q],T=t.byId.get(rt.from).i,R=t.byId.get(rt.to).i,H=R===m&&(D==="down"||D==="trunk"||D==="rail"||D==="end-down"),Q=T===m&&R===m-1&&D==="up",at=R===m-1&&D==="end-up";H&&(D==="trunk"||D==="end-down")&&(O=!0),at&&(B=!0),(H||Q||at)&&rt.label&&(z++,v=Math.max(v,D==="trunk"?40:48))}),(z>1||O&&B)&&(v=64);const j=c.filter(({e:rt,k:q})=>o[q]==="end-down"&&t.byId.get(rt.to).i===m).length,F=c.filter(({e:rt,k:q})=>o[q]==="end-up"&&t.byId.get(rt.to).i===m-1).length;v+=20*Math.max(0,j-1)+20*Math.max(0,F-1),p[k.id]=v}return{routes:o,gutter:r,lanes:g,exits:b,gaps:p,third:f,laneCount:h}}var Nt=(t,e)=>({width:t,height:e,viewBox:`0 0 ${t} ${e}`,"aria-hidden":"true",focusable:"false"});function Ce(t,e){const n=e==="fk"?"plain":e,o=n==="main"?8:8.5,c=24,l=n==="dashed"?c-1:c-7;return x("svg",{class:`${t}-swatch`,"data-kind":n,...Nt(24,16)},e==="fk"?x("circle",{class:`${t}-dot`,cx:3,cy:o,r:3}):null,x("path",{class:`${t}-line`,"data-kind":n,d:`M${e==="fk"?3:0} ${o}H${l}`}),n==="dashed"?x("path",{class:`${t}-tip`,"data-kind":n,"data-open":"",d:`M${c-8} ${o-4}L${c} ${o}L${c-8} ${o+4}`}):x("path",{class:`${t}-tip`,"data-kind":n,d:`M${c} ${o}L${c-8} ${o-4}L${c-8} ${o+4}Z`}))}function Sn(t,e){const{crow:n,ring:o}=Oe(e,24,8.5,-1);return x("svg",{class:`${t}-swatch`,"data-card":e,...Nt(24,16)},x("path",{class:`${t}-line`,"data-kind":"plain",d:"M0 8.5H24"}),x("path",{class:`${t}-crow`,d:n}),o?x("circle",{class:`${t}-ring`,cx:o.x,cy:o.y,r:o.r}):null)}function Oe(t,e,n,o,c=8,l=6){const s=h=>String(Math.round(h*100)/100),a=h=>e+o*h,r=c/2,d=h=>`M${s(a(h-.5))} ${s(n-r)}V${s(n+r)}`,g=t==="one-or-many"||t==="zero-or-many",f=t==="zero-or-one"||t==="zero-or-many";let i=g?`M${s(e)} ${s(n-r)}L${s(a(7.5))} ${s(n)}L${s(e)} ${s(n+r)}`:d(4);return f||(i+=d(g?11:8)),{crow:i,ring:f?{x:Math.round(a(10.5)*100)/100,y:n,r:l/2}:void 0}}function Dt(t,e){return e==="decision"?x("svg",{class:`${t}-swatch`,"data-shape":e,...Nt(16,16)},x("path",{class:`${t}-swatch-shape`,d:"M8 2.5L14.5 8L8 13.5L1.5 8Z"})):e==="terminal"?x("svg",{class:`${t}-swatch`,"data-shape":e,...Nt(16,16)},x("rect",{class:`${t}-swatch-shape`,x:.5,y:3.5,width:15,height:9,rx:4.5})):x("svg",{class:`${t}-swatch`,"data-shape":e,...Nt(16,16)},x("rect",{class:`${t}-swatch-shape`,x:.5,y:2.5,width:15,height:11,rx:2}))}function Be(t,e){return Rt(e,`key:${t}`,()=>An(t,e))}var En=Be;function An(t,e){const n=[],o=(s,a,r={})=>n.push(x("li",{class:`${t}-entry`,...r},s,x("span",null,a)));if(e.type==="schema"){const s=new Set(e.nodes.flatMap(a=>(a.columns??[]).map(r=>r.key)));for(const[a,r]of[["PK","Primary key"],["FK","Foreign key"]])s.has(a)&&n.push(x("li",{class:`${t}-entry`},x("span",{class:`${t}-key-letters`,"aria-hidden":"true"},a),x("span",null,r)))}if(e.type==="flowchart"){const s=new Set(e.nodes.map(a=>a.shape));s.has("terminal")&&o(Dt(t,"terminal"),e.shapeLabels.terminal),s.has("box")&&o(Dt(t,"box"),e.shapeLabels.step),s.has("decision")&&o(Dt(t,"decision"),e.shapeLabels.decision)}const c=new Set(e.type==="sequence"?e.steps.flatMap(s=>"n"in s?[s.kind]:[]):e.edges.filter(s=>!s.fk).map(s=>s.kind)),l=(s,a)=>x("span",{class:`${t}-key-glyph`,"data-ink":a,"aria-hidden":"true"},s);for(const s of["main","plain","dashed"]){const a=e.legend[s];c.has(s)&&a&&o(e.text?l(s==="main"?"━━▶":s==="dashed"?"┄┄▷":"──▶",s==="main"?"main":"plain"):Ce(t,s),a,{"data-line":e.text?void 0:""})}if(e.type==="schema"&&e.edges.length){e.edges.some(a=>!a.card)&&o(Ce(t,"fk"),e.legend.plain??"A foreign key, to the key it references",{"data-line":"","data-when":"drawn"});const s=new Set(e.edges.flatMap(a=>a.card?[a.card.from,a.card.to]:[]));for(const a of we)s.has(a)&&o(Sn(t,a),Ht[a],{"data-line":"","data-when":"drawn","data-card":a});n.push(x("li",{class:`${t}-entry`,"data-when":"stacked"},x("span",{class:`${t}-fk-mark`,"aria-hidden":"true"},e.rtl?"←":"→"),x("span",null,"The table a foreign key references")))}if(e.type==="sequence"){e.bars.length&&o(e.text?l("┃","working"):x("svg",{class:`${t}-swatch`,"data-shape":"bar",...Nt(16,16)},x("path",{class:`${t}-life`,d:"M8 0V16"}),x("rect",{class:`${t}-bar`,x:4.5,y:2.5,width:7,height:11,rx:1.5})),e.legend.activation??"Working",e.text?{}:{"data-when":"drawn"});const s=new Set(e.steps.flatMap(a=>"open"in a?[a.open]:[]));for(const a of["opt","loop","alt"])s.has(a)&&n.push(x("li",{class:`${t}-entry`},x("span",{class:`${t}-key-letters`,"data-op":"","aria-hidden":"true"},a),x("span",null,e.frameWords[a])))}return e.nodes.some(s=>s.focal)&&e.legend.focal&&o(e.text?l("╔═╗","focal"):Dt(t,"focal"),e.legend.focal,{"data-focal":""}),e.groups.length&&e.legend.group&&o(Dt(t,"group"),e.legend.group),n.length?x("div",{class:`${t}-key`},x("ul",{class:`${t}-legend`,"aria-label":"Key"},n)):null}function Ln(t,e){const n=e==="main"?6:6.5;return x("svg",{class:`${t}-arrow`,"data-kind":e,...Nt(20,12)},x("path",{class:`${t}-line`,"data-kind":e,d:`M0 ${n}H${e==="dashed"?19:13}`}),e==="dashed"?x("path",{class:`${t}-tip`,"data-kind":e,"data-open":"",d:`M12 ${n-4}L20 ${n}L12 ${n+4}`}):x("path",{class:`${t}-tip`,"data-kind":e,d:`M20 ${n}L12 ${n-4}L12 ${n+4}Z`}))}var It=t=>x("bdi",null,t);function re(t,e){if(!e.href)return It(e.name);const n=e.name.trimEnd().lastIndexOf(" ");return[n<0?"":e.name.slice(0,n+1),x("span",{class:`${t}-name-end`},n<0?e.name:e.name.slice(n+1))]}function _n(t,e,n){if(n.shape==="decision")return[x("span",{class:`${t}-words`},x("span",{class:`${t}-name`},re(t,n)))];const o=[];return e.type==="data-flow"?o.push(x("span",{class:`${t}-kind`},It(n.kind),x("span",{class:`${t}-lane-word`}," · ",It(n.laneLabel??"")))):n.kind&&o.push(x("span",{class:`${t}-kind`},It(n.kind))),o.push(x("span",{class:`${t}-name`},re(t,n))),n.detail&&o.push(x("span",{class:`${t}-detail`,"data-mono":n.mono?"":void 0},n.mono?x("span",{class:`${t}-runs`},Pt(n.detail).flatMap((c,l)=>[l?" ":"",x("span",{class:`${t}-run`},c)])):It(n.detail))),o}function qn(t,e,n){return[x("span",{class:`${t}-th`},x("span",{class:`${t}-tname`},re(t,e))),x("span",{class:`${t}-rows`},(e.columns??[]).map((o,c)=>x("span",{class:`${t}-row`,"data-row":c,"data-key":o.key},x("span",{class:`${t}-keyseat`},o.key??""),x("span",{class:`${t}-cname`},o.name),o.ref?x("span",{class:`${t}-ctype`,"data-ref":""},`${n.rtl?"←":"→"} `,It(o.ref.table)):o.type?x("span",{class:`${t}-ctype`},It(o.type)):null))),e.more?x("span",{class:`${t}-more`},`+ ${e.more} more`):null]}var je=t=>{const e={32:"space-8",40:"space-10",48:"space-12",64:"space-16"};return e[t]?`var(--basalt-${e[t]})`:`${t}px`};function Jt(t,e,n,o){const{P:c}=t,l=Mn(e,o)||o.keep===n.id,s=Tt(e,o),a=o.layout==="drawn"&&o.rows,r=[`--_c:${n.col}`,`--_r:${a?2*n.row:n.row}`,`--_r2:${a?2*n.row2+1:n.row2+1}`];e.type==="data-flow"&&r.push(`--_lc:${n.col+1}`),e.type==="sequence"&&r.push(`--_c2:${n.col+1}`);const d=t.plan;if(d&&n.i>0){const b=Ot(d.gaps,n.id)??32,p=Ot(o.grow,n.id)??0;r.push(`--_gap:${p?`calc(${je(b)} + var(--basalt-space-4) * ${p})`:je(b)}`)}const g=Ot(o.heights,n.id);g&&r.push(`--_h:${g}px`);const f=Ot(De(e),n.id);f&&r.push(`--_mh:${f}px`);const i=Ot(o.words,n.id);i&&r.push(`--_ww:${i}px`);const h=s?o.stop===n.id?0:-1:o.keep===n.id?-1:void 0;return x(n.href?"a":"div",{class:`${c}-node`,href:n.href,target:n.href&&n.blank?"_blank":void 0,rel:n.href&&n.blank?"noopener noreferrer":void 0,"data-link":n.href?n.blank?"external":"":void 0,"data-node":n.id,"data-shape":n.shape,"data-focal":n.focal?"":void 0,"data-branch":n.branch?"":void 0,"data-mark":n.mark?n.mark.id??"":void 0,"data-level":t.level,style:r.join(";"),role:l&&!n.href?"img":void 0,"aria-label":l||n.href?mn(e,n):void 0,tabindex:h},n.shape==="decision"?x("svg",{class:`${c}-diamond`,viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",focusable:"false"},x("path",{d:"M50 0L100 50L50 100L0 50Z"})):null,n.mark?x("span",{class:`${c}-mark`,"aria-hidden":"true",style:n.mark.onLight?`--_ml:${xe(n.mark.onLight)};--_md:${xe(n.mark.onDark??n.mark.onLight)}`:void 0}):null,n.shape==="table"?qn(c,n,e):_n(c,e,n))}function In(t,e,n){const{P:o}=t,c=[];if(e.type==="data-flow"&&c.push(...e.lanes.map((r,d)=>x("div",{class:`${o}-lane`,style:`--_r:${d+1}`,"aria-hidden":"true"},x("span",{class:`${o}-lane-name`},r.label)))),e.type==="architecture")for(const r of e.groups){const d=Zt(e,r);if(!d)continue;const g=[0,1,2,3].map(f=>_e(e,r,f));c.push(x("div",{class:`${o}-gbox`,"data-group":r.id,"data-depth":r.depth>1?r.depth:void 0,style:`--_c:${d.c1};--_c2:${d.c2+1};--_r:${d.r1};--_r2:${d.r2+1}${g[0]>1?";--_gt:2":""}${g[1]>1?";--_ge:2":""}${g[2]>1?";--_gb:2":""}${g[3]>1?";--_gs:2":""}`,"aria-hidden":"true"},x("span",{class:`${o}-glabel`},It(r.label))))}if(e.text)return[x("pre",{class:`${o}-text`,"aria-hidden":"true","data-art":n.art?"":void 0},x("code",{class:`${o}-text-ink`},Cn(o,e)))];if(e.type==="sequence")return c.push(x("ul",{class:`${o}-cast`},e.nodes.map(r=>x("li",{class:`${o}-actor`,style:e.rtl?`--_ac:${r.col}`:void 0},Jt(t,e,r,n))))),c.push(On(t,e)),c;const l=r=>{const d=r.group?e.groups.find(g=>g.id===r.group):void 0;return d?.parent?e.groups.find(g=>g.id===d.parent):d},s=(r,d,g)=>{const f=t.plan?Ot(n.grow,d[0].id)??0:0,i=d[0],h=t.plan&&i.group===r.id?e.edges.filter((m,k)=>m.to===i.id&&(t.plan.routes[k]==="trunk"||t.plan.routes[k]==="end-down")):[],b=Math.max(0,...h.map(m=>m.label?Kt(m.label):0)),p=[f?`--_ggrow:${f}`:"",b?`--_tl:${b}`:""].filter(Boolean).join(";");return x("div",{class:`${o}-group`,"data-group":r.id,"data-depth":r.depth>1?r.depth:void 0,"data-turn":h.length?"":void 0,style:p||void 0},x("span",{class:`${o}-glabel`,"aria-hidden":"true"},It(r.label)),g)};let a=0;for(;ap.id===g[i].group):void 0;if(!h){f.push(Jt(t,e,g[i],n)),i++;continue}const b=[];for(;iJt(t,e,p,n))))}c.push(s(d,g,f))}return c}function Cn(t,e){const n=[],o=r=>x("span",{class:`${t}-tx-name`},r),c=r=>r==="main"?"━▶":r==="dashed"?"┄▷":"─▶",l=(r,d,g,...f)=>x("span",{class:`${t}-tx-line`,...r,style:g?`--_in:${d+g};--_hang:${g}`:`--_in:${d}`},...f);n.push(l({"data-ink":"names"},0,0,e.nodes.flatMap((r,d)=>[d?" · ":"",o(r.name)])));const s=String(Math.max(1,...e.steps.map(r=>"n"in r?r.n:0))).length;let a=0;for(const r of e.steps){const d=2*a;if("band"in r){n.push(l({"data-ink":"band"},d,0,`── ${r.band} ──`));continue}if("open"in r){n.push(l({"data-ink":"frame"},d,0,x("span",{"data-ink":"op"},`[${r.open}]`),` ${r.label}`)),a++;continue}if("otherwise"in r){n.push(l({"data-ink":"frame"},2*Math.max(0,a-1),0,x("span",{"data-ink":"op"},"[else]"),` ${r.otherwise}`));continue}if("close"in r){a=Math.max(0,a-1),n.push(l({"data-ink":"frame"},2*a,0,"[end]"));continue}const g=e.byId.get(r.from)?.name??r.from,f=e.byId.get(r.to)?.name??r.to,i=s+2;n.push(l({"data-n":r.n},d,i,x("span",{"data-ink":"num"},String(r.n).padStart(s,"0"))," ",o(g)," ",x("span",{class:`${t}-tx-to`},x("span",{"data-ink":r.kind==="main"?"main":"plain"},c(r.kind))," ",f))),n.push(l({"data-n":r.n},d+i,0,x("span",{"data-ink":"label"},r.label))),r.note&&n.push(l({"data-n":r.n},d+i,0,x("span",{"data-ink":"note"},r.note)))}return n}function On(t,e){const{P:n}=t,o=[],c=[],l=()=>c.length?c[c.length-1].el.c:o;let s=null;for(const a of e.steps){if("band"in a){s=null,l().push(x("p",{class:`${n}-band`},x("span",null,a.band)));continue}if("open"in a){s=null;const p=c[c.length-1],m=p?`;--_fis:${a.a===p.a?1:0};--_fie:${a.b===p.b?1:0}`:"",k=x("div",{class:`${n}-frame`,"data-op":a.open,"data-depth":a.depth,style:`--_a:${a.a};--_b:${a.b+1}${m}`},x("span",{class:`${n}-fbox`,"aria-hidden":"true"}),x("p",{class:`${n}-fhead`},x("span",{class:`${n}-ftab`,"aria-hidden":"true"},a.open),x("span",{class:`${n}-flabel`},x("span",{class:t.hidden},`${e.frameWords[a.open]}: `),a.label)));l().push(k),c.push({el:k,a:a.a,b:a.b});continue}if("otherwise"in a){s=null,l().push(x("p",{class:`${n}-felse`},x("span",{class:`${n}-fword`,"aria-hidden":"true"},"else"),x("span",{class:`${n}-flabel`},x("span",{class:t.hidden},`${e.frameWords.else}: `),a.otherwise)));continue}if("close"in a){s=null,c.pop();continue}s||(s=x("ol",{class:`${n}-msgs`,start:a.n}),l().push(s));const r=e.byId.get(a.from),d=e.byId.get(a.to),g=r?.col??1,f=d?.col??1,i=g===f,h=i&&(e.rtl?g!==1:g===e.nodes.length),b=ke(e,a.kind);s.c.push(x("li",{class:`${n}-msg`,"data-kind":a.kind,"data-from":a.from,"data-to":a.to,"data-self":i?h?"start":"end":void 0,style:`--_a:${Math.min(g,f)};--_b:${Math.max(g,f)+1}`},x("span",{class:`${n}-said`},x("span",{class:`${n}-num`},String(a.n)),x("span",{class:`${n}-mlabel`},a.label)),x("span",{class:`${n}-route`},r?.short??a.from," ",x("span",{class:`${n}-to`},Ln(n,a.kind),x("span",{class:t.hidden}," to ")," ",d?.short??a.to,b?` · ${b}`:"")),a.note?x("span",{class:`${n}-note`},a.note):null))}return x("div",{class:`${n}-steps`},o)}function Re(t,e){return Rt(e,`list:${t}`,()=>jn(t,e))}var Bn=Re;function jn(t,e){const n=Math.min(6,e.heading+1),o=f=>x(`h${n}`,{class:`${t}-list-head`},f),c=f=>x("strong",null,f),l=f=>f.href?x("a",{href:f.href,target:f.blank?"_blank":void 0,rel:f.blank?"noopener noreferrer":void 0},c(f.name)):c(f.name),s=f=>x("code",{class:`${t}-code`},f),a=f=>e.byId.get(f)?.name??f,r=f=>{const i=ke(e,f);return i?` (${i})`:""},d=f=>f.focal&&e.legend.focal?` ${Ft(e.legend.focal)}`:"";if(e.type==="architecture"){const f=b=>x("li",null,l(b),b.kind?`, ${b.kind}`:"",b.detail?[". ",b.mono?s(b.detail):b.detail,/[.!?]$/.test(b.detail)?"":"."]:/[.!?]$/.test(b.kind??b.name)?"":".",d(b)),i=[o("Parts")],h=e.nodes.filter(b=>!b.group);h.length&&i.push(x("ul",{class:`${t}-list-items`},h.map(f)));for(const b of e.groups.filter(p=>p.depth===1)){i.push(x("p",{class:`${t}-list-group`},b.label)),b.members.length&&i.push(x("ul",{class:`${t}-list-items`},b.members.map(p=>f(e.byId.get(p)))));for(const p of e.groups.filter(m=>m.parent===b.id))i.push(x("p",{class:`${t}-list-group`,"data-depth":2},p.label)),i.push(x("ul",{class:`${t}-list-items`,"data-depth":2},p.members.map(m=>f(e.byId.get(m)))))}return i.push(o("Connections")),i.push(x("ol",{class:`${t}-list-items`},e.edges.map(b=>x("li",null,c(a(b.from))," to ",c(a(b.to)),b.label?[": ",s(qt(b.label))]:"",`${r(b.kind)}.`)))),i}if(e.type==="flowchart"){const f=i=>(e.byId.get(i)?.i??0)+1;return[x("ol",{class:`${t}-list-items`},e.nodes.map(i=>{const h=e.edges.filter(m=>m.from===i.id),b=i.shape==="decision"?"Decision":i.shape==="terminal"?h.length?"Start":"End":"Step",p=!i.detail&&/[.!?]$/.test(i.name)?" ":". ";return x("li",null,l(i),i.detail?[", ",i.mono?s(i.detail):i.detail]:"",`${p}${b}.`,d(i),h.length?x("ul",{class:`${t}-list-exits`},h.map(m=>x("li",null,m.label?`If ${qt(m.label)}: go to ${f(m.to)}, `:`Then: go to ${f(m.to)}, `,c(a(m.to)),r(m.kind)))):null)}))]}if(e.type==="data-flow")return[x("ol",{class:`${t}-list-items`},e.nodes.map(f=>{const i=e.edges.filter(h=>h.from===f.id);return x("li",null,`${f.laneLabel}: `,l(f),f.detail?[", ",f.mono?s(f.detail):f.detail]:"",".",d(f),i.length?[" Then ",...i.flatMap((h,b)=>[b?"; ":"",`to step ${e.byId.get(h.to).step}, `,c(a(h.to)),h.label?[": ",s(qt(h.label))]:"",r(h.kind)]),"."]:"")}))];if(e.type==="sequence"){const f=[o("Participants"),x("ul",{class:`${t}-list-items`},e.nodes.map(h=>x("li",null,c(h.name),h.kind?`, ${h.kind}`:"",".",d(h),Ee(e,h))))];f.push(o("Messages"));let i=null;for(const h of e.steps){if("band"in h){i=null,f.push(x(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`},h.band));continue}if("open"in h){i=null,f.push(x(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`,"data-depth":h.depth>1?h.depth:void 0},`${e.frameWords[h.open]}: ${h.label}`));continue}if("otherwise"in h){i=null,f.push(x(`h${Math.min(6,n+1)}`,{class:`${t}-list-group`,"data-depth":h.depth>1?h.depth:void 0},`${e.frameWords.else}: ${h.otherwise}`));continue}if("close"in h){i=null;continue}i||(i=x("ol",{class:`${t}-list-items`,start:h.n}),f.push(i)),i.c.push(x("li",null,s(h.label),": ",c(a(h.from))," to ",c(a(h.to)),`${r(h.kind)}.`,h.note?` ${Ft(h.note)}`:""))}return f}const g=[];for(const f of e.nodes)g.push(x(`h${n}`,{class:`${t}-list-group`},f.href?x("a",{href:f.href,target:f.blank?"_blank":void 0,rel:f.blank?"noopener noreferrer":void 0},s(f.name)):s(f.name),d(f))),g.push(x("ul",{class:`${t}-list-items`},[...(f.columns??[]).map(i=>x("li",null,s(i.name),i.key==="PK"?", primary key":i.key==="FK"?", foreign key":"",i.ref?[", references ",s(`${i.ref.table}.${i.ref.column}`),i.card?[" (",$n(f.id,i.ref.table,i.card,s),")"]:""]:i.type?`, ${i.type}`:"")),...f.more?[x("li",null,`and ${f.more} more ${f.more===1?"column":"columns"}`)]:[]]));return g}function Te(t,e=!1){const n=t.type==="architecture"?"part":t.type==="sequence"?"participant":t.type==="schema"?"table":"step";return`${e&&Ut(t)?`Arrow keys move to the nearest ${n} in that direction`:`Arrow keys move to the next or the previous ${n}, in the author's order`}; Home and End go to the ends; Escape clears the trace.${t.nodes.some(c=>c.href)?" Enter opens a part that is a link.":""}`}function ie(t,e=!1){const n=e&&t.type!=="sequence"&&Ut(t)&&t.cols>1&&t.rows>1,o=t.nodes.some(c=>c.href)?[{keys:["Enter"],words:"open"}]:[];return[{keys:n?["←","↑","↓","→"]:["←","→"],words:Ae(t)},{keys:["Home","End"],words:"the ends"},...o,{keys:["Esc"],words:"clear"}]}var Rn=(t,e)=>{for(let n=0;n({col:e.col,rows:[e.row,e.row2]});function Ut(t){return Rt(t,"spatial",()=>{const e=t.nodes.map(l=>({id:l.id,...Tn(t,l)})),n=(l,s)=>{const a=s==="right"||s==="left",r=s==="right"||s==="down",d=b=>a?[b.col,b.col]:b.rows,g=b=>a?b.rows:[b.col,b.col],f=d(l),i=g(l);let h=null;return e.forEach((b,p)=>{if(b===l)return;const m=d(b),k=g(b),L=r?m[0]-f[1]:f[0]-m[1];if(L<1)return;const z=Math.max(0,k[0]-i[1],i[0]-k[1]),v=[z===0?0:1,z===0?L:L+2*z,z,Math.abs(k[0]-i[0]),p];(!h||Rn(v,h.rank))&&(h={id:b.id,rank:v})}),h?.id??null},o=Lt();for(const l of e)o[l.id]={right:n(l,"right"),left:n(l,"left"),down:n(l,"down"),up:n(l,"up")};const c=l=>{const s=new Set([l]),a=[l];for(;a.length;)for(const r of Object.values(o[a.pop()]))r&&!s.has(r)&&(s.add(r),a.push(r));return s.size};return e.every(l=>c(l.id)===e.length)?o:null})}function Xt(t){return Rt(t,"turn-back-lanes",()=>{const e=new Map,n=new Set;if(!le(t))return{lane:e,dropped:n,lanes:0};const o=(r,d)=>(t.byId.get(r)?.row??0)*1e3+d,c=new Map;t.edges.forEach((r,d)=>{const g=`${r.to}.${r.toRow}.${r.card?.to??""}`,f=o(r.from,r.fromRow??0),i=o(r.to,r.toRow??0),h=c.get(g)??{members:[],lo:1/0,hi:-1/0};h.members.push(d),h.lo=Math.min(h.lo,f,i),h.hi=Math.max(h.hi,f,i),c.set(g,h)});const l=[...c.values()].sort((r,d)=>d.hi-d.lo-(r.hi-r.lo)),s=[];let a=0;for(const r of l.reverse()){const d=new Set(s.filter(f=>f.lo<=r.hi&&r.lo<=f.hi).map(f=>f.lane));let g=0;for(;d.has(g);)g++;if(g>1){for(const f of r.members)n.add(f);continue}s.push({lo:r.lo,hi:r.hi,lane:g});for(const f of r.members)e.set(f,g);a=Math.max(a,g+1)}return{lane:e,dropped:n,lanes:a}})}var le=t=>t.type==="schema"&&t.cols===1&&t.edges.length>0;function Yt(t,e,n){const o=n.prefix,c=xn(n.base),l=t.type==="sequence"||t.type==="schema"?null:Ie(t),s={P:o,ids:c,level:n.level,plan:l,hidden:n.hiddenClass},a=e.layout==="drawn",r=Tt(t,e),d=t.type==="sequence"||t.type==="schema"?a:!0,g=`h${t.heading}`,f=[`--_cols:${ae(t)}`];if(t.type==="architecture"&&t.groups.length||a&&e.pad){const i=t.type==="architecture"?Le(t):[0,0,0,0],h=(p,m,k)=>p?p>1?`calc(${p} * var(--basalt-space-${m}))`:`var(--basalt-space-${m})`:k?`var(--basalt-space-${k})`:"0px",b=a&&e.pad?"3":void 0;f.push(`--_gpad:${h(i[0],"8",b)} ${h(i[1],"4")} ${h(i[2],"4",b)} ${h(i[3],"4")}`)}if(l?.gutter&&l.laneCount>2&&f.push(`--_gw:calc(${l.laneCount} * var(--basalt-space-3-5) + var(--basalt-space-3))`),le(t)){const i=t.marks?"var(--basalt-space-6) + var(--basalt-space-1)":"var(--basalt-space-5)",h=Xt(t).lanes>1?`calc(${i} + var(--basalt-space-3))`:t.marks?`calc(${i})`:i;f.push(t.rtl?`--_gpad:0px 0px 0px ${h}`:`--_gpad:0px ${h} 0px 0px`)}return t.type==="schema"&&e.track&&f.push(`--_track:${e.track}px`),x("figure",{class:n.className?`${o} ${n.className}`:o,"aria-labelledby":c.title,"data-type":t.type,"data-cols":ae(t),"data-reach":t.type==="architecture"?qe(t):void 0,"data-gutter":l?.gutter?"":void 0,"data-marks":t.marks?"":void 0,"data-layout":e.layout??(t.unplaced?"stacked":void 0),"data-measured":e.layout?"":void 0,"data-bare":e.bare?"":void 0,"data-motion":t.motion.animated?"animated":void 0,"data-first-visit":t.motion.animated&&t.motion.firstVisit?"":void 0,"data-rtl":t.rtl?"":void 0,"data-viewer":n.viewer?"":void 0,style:f.join(";")},x("div",{class:`${o}-head`},x(g,{id:c.title,class:`${o}-title`},It(t.title)),n.hasSource?x("p",{class:`${o}-source`},x("bdi",null,{slot:"source"})):null),x("div",{class:`${o}-drawing`,style:a&&e.rows?`--_rows:${e.rows};--_row-gap:0px`:void 0,role:d?"group":void 0,"aria-roledescription":d?"diagram":void 0,"aria-labelledby":d?c.title:void 0,"aria-describedby":d?r?`${c.summary} ${c.keys}`:c.summary:void 0,"data-stops":r?"":void 0},In(s,t,e),t.text?null:x("div",{class:`${o}-ink`,"aria-hidden":"true"}),x("span",{class:`${o}-ruler`,"aria-hidden":"true"})),Be(o,t),x("p",{class:`${o}-hint`,"data-kbd-hint":"","aria-hidden":"true"},{slot:"hint"}),Tt(t,e)&&t.type!=="sequence"||a&&t.type==="sequence"?x("p",{class:`${o}-tap-hint`,"aria-hidden":"true"},`Tap ${Ae(t)} to highlight its lines. Tap it again to clear.`):null,x("div",{class:`${o}-foot`},{slot:"toggle"}),x("div",{id:c.list,class:`${o}-list`,hidden:!e.open},Re(o,t)),x("span",{id:c.keys,class:n.hiddenClass},n.viewer?`${Te(t,a)} ${n.viewer}`:Te(t,a)),x("figcaption",{id:c.summary,class:`${o}-summary`},{slot:"summary"}))}function zn(t){const e=getComputedStyle(t),n=(c,l)=>{const s=parseFloat(e.getPropertyValue(`--basalt-${c}`));return Number.isFinite(s)?s:l},o=new Map;return{space:c=>(o.has(c)||o.set(c,n(`space-${c}`,parseFloat(c.replace("-","."))*4)),o.get(c)),node:n("size-diagram-node",144),table:n("size-diagram-table",224),lane:n("size-diagram-lane",120),step:n("size-diagram-step",56),head:n("size-diagram-head",8),guide:n("size-diagram-guide-dash",4),hair:n("size-hairline",1),line:n("size-chart-line",2),cut:n("size-cut",2),dot:n("size-dot",6),dash:n("size-chart-dash",6),dashGap:n("size-chart-dash-gap",4),wide:n("size-breakpoint-container-lg",640),cap:n("size-breakpoint-container",480),radius:n("radius-md",8),radiusXs:n("radius-xs",4),activation:n("size-diagram-activation",8),foot:n("size-diagram-foot",14)}}var Qt=(t,e)=>t==="main"?e.line:e.hair,xt=(t,e)=>{const n=t.getBoundingClientRect();return{l:n.left-e.left,t:n.top-e.top,r:n.right-e.left,b:n.bottom-e.top}},Ct=(t,e,n=.01)=>t.le.l+n&&t.te.t+n,ce=(t,e)=>({l:t.l-e,r:t.r+e,t:t.t-e,b:t.b+e});function kt(t,e,n){const{l:o,t:c,r:l,b:s}=t.rect,a=(o+l)/2,r=(c+s)/2,d=(l-o)/2,g=(s-c)/2,f=e==="top"||e==="bottom";if(t.shape==="decision"){if(f){const b=n,p=g*Math.max(0,1-Math.abs(b-a)/d);return{x:b,y:e==="top"?r-p:r+p}}const i=n,h=d*Math.max(0,1-Math.abs(i-r)/g);return{x:e==="left"?a-h:a+h,y:i}}if(t.shape==="terminal"){const i=Math.min(d,g);if(f){const m=n,k=Math.min(Math.max(m,o+i),l-i),L=m-k,z=Math.abs(L)>=i?0:Math.sqrt(i*i-L*L);return{x:m,y:Math.abs(L)<1e-6?e==="top"?c:s:e==="top"?r-z:r+z}}const h=n,b=h-r,p=Math.abs(b)>=i?0:Math.sqrt(i*i-b*b);return{x:e==="left"?o+i-p:l-i+p,y:h}}return f?{x:n,y:e==="top"?c:s}:{x:e==="left"?o:l,y:n}}function Nn(t,e,n){const{l:o,t:c,r:l,b:s}=e.rect,a=(o+l)/2,r=(c+s)/2,d=(l-o)/2,g=(s-c)/2;if(e.shape==="decision")return Math.abs(t.x-a)/d+Math.abs(t.y-r)/g<1-n/Math.min(d,g);if(e.shape==="terminal"){const f=Math.min(d,g),i=Math.min(Math.max(t.x,o+f),l-f);return Math.hypot(t.x-i,t.y-r)o+n&&t.xc+n&&t.ymatchMedia("(forced-colors: active)").matches;function Hn(t,e){const n=t.querySelector(`.${e}-ruler`),o=new Map;return(c,l)=>{const s=`${l}|${c}`;return o.has(s)||(n.setAttribute("data-f",l),n.textContent=c,o.set(s,n.getBoundingClientRect().width),n.textContent=""),o.get(s)}}var Pt=t=>t?t.split(/\s+/).filter(Boolean):[];function Dn(t,e,n){const o=e.space;let c=e.node,l=e.table;for(const r of t.nodes){if(r.shape==="table"){for(const p of r.columns??[]){const m=p.ref?`${t.rtl?"←":"→"} ${p.ref.table}`:p.type??"",k=o("6")+n(p.name,"mono")+(m?o("3")+n(m,"mono"):0)+2*o("3")+2*e.hair;l=Math.max(l,Math.ceil(k))}l=Math.max(l,Math.ceil(n(r.name,"table")+2*o("3")+2*e.hair+(r.href?16+o("1-5"):0)));continue}const d=r.shape==="terminal"?2*o("5"):2*o("3"),g=r.mark&&!Fn()?(r.shape==="participant"?2:1)*o("6"):0;let f=0;const i=r.href?16+o("1-5"):0,h=Pt(r.name);if(h.forEach((p,m)=>{f=Math.max(f,n(p,r.shape==="decision"?"name-500":"name")+(r.kind?0:g)+(m===h.length-1?i:0))}),t.type!=="data-flow")for(const p of Pt(r.kind))f=Math.max(f,n(p,"mono")+g);for(const p of Pt(r.detail))f=Math.max(f,n(p,r.mono?"mono":"sans"));const b=r.shape==="decision"?f/.62:f+d+2*e.hair;c=Math.max(c,Math.ceil(b))}const s=ae(t);let a;return t.type==="data-flow"?a=e.lane+s*(c+o("12")):t.type==="schema"?a=s*l+(s-1)*(o("12")+(t.marks?o("3"):0))+(le(t)?(t.marks?o("6")+o("1"):o("5"))+(Xt(t).lanes>1?o("3"):0):0):t.type==="sequence"?a=s*c+(s-1)*o("5"):a=s*c+(s-1)*o("16")+qe(t)*o("4"),{track:c,table:l,least:Math.max(e.wide,a)}}function Ne(t,e,n=!1){const o=n?c=>-Math.round(-c):Math.round;return{x:(c,l)=>l%2===1?o(c+t-.5)+.5-t:o(c+t)-t,y:(c,l)=>l%2===1?Math.round(c+e-.5)+.5-e:Math.round(c+e)-e}}function de(t){const e=t[t.length-2],n=t[t.length-1];return Math.abs(e.x-n.x)<.01?n.y>e.y?"down":"up":n.x>e.x?"right":"left"}function We(t,e,n){const o=t.map(l=>({...l}));for(let l=1;l=2){const r=c[c.length-2];if(Math.abs(r.x-a.x)<.01&&Math.abs(a.x-s.x)<.01||Math.abs(r.y-a.y)<.01&&Math.abs(a.y-s.y)<.01){c[c.length-1]=s;continue}}c.push(s)}}return c}var _t=t=>t.slice(1).map((e,n)=>[t[n],e]);function te(t,e,n){const o=[];for(let l=0;lMath.min(p.x,m.x)+.75&&zMath.min(k.y,L.y)+.75&&vl.split(/\s+/).map(parseFloat).filter(s=>Number.isFinite(s)),o=(l,s,a)=>{const r=[];let d=s;for(const g of l)r.push([d,d+g]),d+=g+a;return r},c=o(n(e.gridTemplateRows),parseFloat(e.paddingTop)||0,parseFloat(e.rowGap)||0);return{cols:o(n(e.gridTemplateColumns),parseFloat(e.paddingLeft)||0,parseFloat(e.columnGap)||0),rows:t.style.getPropertyValue("--_rows").trim()?c.filter((l,s)=>s%2===1):c}}var ct=t=>t==="left"||t==="right",Fe={top:"bottom",bottom:"top",left:"right",right:"left"};function fe(t,e){return t.row===e.row?e.col>t.col?["right","left"]:["left","right"]:t.col===e.col?e.row>t.row?["bottom","top"]:["top","bottom"]:[e.col>t.col?"right":"left",e.row>t.row?"top":"bottom"]}function He(t,e,n){const o=[];t.edges.forEach((l,s)=>{const a=t.byId.get(l.from),r=t.byId.get(l.to),[d,g]=e[s],f=a.row===r.row&&ct(d)&&ct(g)&&d===Fe[g]||a.col===r.col&&!ct(d)&&!ct(g)&&d===Fe[g];o.push({edge:s,end:"from",node:a,side:d,far:r,straight:f,f:.5},{edge:s,end:"to",node:r,side:g,far:a,straight:f,f:.5})});const c=new Map;for(const l of o){const s=`${l.node.id}.${l.side}`;c.has(s)||c.set(s,[]),c.get(s).push(l)}for(const[l,s]of c){if(s[0].node.shape==="decision")continue;const a=p=>ct(p.side)?p.far.row-p.node.row:p.far.col-p.node.col,r=s.filter(p=>p.straight),d=s.filter(p=>!p.straight);if(d.sort((p,m)=>a(p)-a(m)||(ct(p.side)?p.far.col-m.far.col:p.far.row-m.far.row)*(a(p)<0?1:-1)),s.length>3&&n(`${l.replace(".","'s ")} side has ${s.length} lines; more than three is an error: use another side`),!r.length){d.length===2?(d[0].f=.25,d[1].f=.75):d.length===3?(d[0].f=.25,d[1].f=.5,d[2].f=.75):d.length>3&&d.forEach((p,m)=>{p.f=(m+1)/(d.length+1)});continue}const g=new Map;for(const p of r)g.has(p.far.id)||g.set(p.far.id,[]),g.get(p.far.id).push(p);for(const p of g.values())p.length>1&&p.sort((m,k)=>m.edge-k.edge).forEach((m,k)=>{m.f=p.length===2?k===0?.25:.75:(k+1)/(p.length+1)});const f=Math.min(...r.map(p=>p.f)),i=Math.max(...r.map(p=>p.f)),h=d.filter(p=>a(p)<0),b=d.filter(p=>a(p)>=0);h.forEach((p,m)=>{p.f=f*(m+1)/(h.length+1)}),b.forEach((p,m)=>{p.f=i+(1-i)*(m+1)/(b.length+1)})}return o}function De(t,e=8,n=8){return Rt(t,`port-floors:${e}:${n}`,()=>{const o=Lt();if(t.type!=="architecture"&&t.type!=="flowchart"&&t.type!=="data-flow")return o;const c=t.edges.map(s=>{const a=t.byId.get(s.from),r=t.byId.get(s.to),[d,g]=fe(a,r);return[s.fromSide??d,s.toSide??g]}),l=new Map;for(const s of He(t,c,()=>{})){if(!ct(s.side)||s.node.shape!=="box")continue;const a=`${s.node.id}.${s.side}`;l.has(a)||l.set(a,[]),l.get(a).push(s.f)}for(const[s,a]of l){if(a.length<2)continue;const r=a.slice().sort((f,i)=>f-i).filter((f,i,h)=>i===0||f-h[i-1]>1e-9);let d=Math.max(e/r[0],e/(1-r[r.length-1]));for(let f=1;f{const s=t.byId.get(l.dataset.node);s&&c.set(s.id,{id:s.id,rect:xt(l,n),shape:s.shape,i:s.i})}),c}function Ke(t,e){const n=e.head,o=e.head/2,{x:c,y:l}=t.tip;return t.dir==="down"?{l:c-o,r:c+o,t:l-n,b:l}:t.dir==="up"?{l:c-o,r:c+o,t:l,b:l+n}:t.dir==="right"?{l:c-n,r:c,t:l-o,b:l+o}:{l:c,r:c+n,t:l-o,b:l+o}}var ue=(t,e,n)=>({l:Math.min(t.x,e.x)-n/2,r:Math.max(t.x,e.x)+n/2,t:Math.min(t.y,e.y)-n/2,b:Math.max(t.y,e.y)+n/2});function Ze(t,e,n,o,c=!1){const l=(a,r)=>{const d=a+r-Math.floor(a+r);return d<.005||d>.995?[0]:d<=.5?[-d,1-d]:[1-d,-d]},s=c?l(-t.r,-e).map(a=>-a):l(t.l,e);for(const a of l(t.t,n))for(const r of s){if(!r&&!a)return t;const d={l:t.l+r,r:t.r+r,t:t.t+a,b:t.b+a};if(o(d))return d}return t}function Vn(t,e,n,o,c,l,s,a,r){const d=s.space,g=[],f=[],i=[],h=[],b=d("1"),p=e.filter(m=>t.edges[m.i]?.label).sort((m,k)=>+(t.edges[k.i].kind==="main")-+(t.edges[m.i].kind==="main")||m.i-k.i);for(const m of p){const k=t.edges[m.i].label,L=a(k,"label"),z=16*Kt(k),v=m.pts.length-2,O=[];_t(m.pts).forEach(([q,D],T)=>{const R=Math.abs(q.y-D.y)<.01,H=R?q.x:q.y;let Q=R?D.x:D.y;const at=Math.sign(Q-H)||1;T===v&&(Q-=at*s.head);let it=[[H,Q]];for(const et of c)for(const nt of R?[et.l,et.r]:[et.t,et.b]){const tt=R?q.y:q.x;(R?tt>et.t&&ttet.l&&ttnt>Math.min(u,w)+1&&nt{const tt=(et+nt)/2,$=R?{x:tt,y:q.y}:{x:q.x,y:tt};return!c.some(u=>$.x>u.l&&$.xu.t&&$.y1&&yt(et,nt)?1:0})}),O.sort((q,D)=>D.pri-q.pri||D.len-q.len);let B=null,j=!1;const F=(q,D=!0)=>{const T=ce(q,b);return D&&(q.ll.r||q.tl.b)||n.some(R=>ze(T,R))||g.some(R=>Ct(T,R))||o.heads.some(R=>Ct(T,R))||o.rects.some(R=>Ct(T,R))?!1:!e.some(R=>R.i!==m.i&&_t(R.pts).some(([H,Q])=>Ct(T,ue(H,Q,R.width))))};for(const q of O){for(const D of[1/2,1/3,2/3]){const T=q.p+(q.q-q.p)*D,R=[],H=d("2")+m.width/2;if(q.horiz?(q.len>=L+2*d("1")+d("3-5")&&R.push({box:{l:T-L/2-d("1"),r:T+L/2+d("1"),t:q.c-z/2,b:q.c+z/2},on:!0}),R.push({box:{l:T-L/2,r:T+L/2,t:q.c-H-z,b:q.c-H},on:!1}),R.push({box:{l:T-L/2,r:T+L/2,t:q.c+H,b:q.c+H+z},on:!1})):(q.len>=z+d("3")&&R.push({box:{l:q.c-L/2-d("1"),r:q.c+L/2+d("1"),t:T-z/2,b:T+z/2},on:!0}),R.push({box:{l:q.c+H,r:q.c+H+L,t:T-z/2,b:T+z/2},on:!1}),R.push({box:{l:q.c-H-L,r:q.c-H,t:T-z/2,b:T+z/2},on:!1})),B=R.find(Q=>F(Q.box))??null,B)break;!j&&R.some(Q=>F(Q.box,!1))&&(j=!0)}if(B)break}if(!B){i.push(m.i),j&&h.push(m.i);continue}const rt=Ze(B.box,r.ox,r.oy,q=>F(q));g.push(rt),f.push({i:m.i,text:k,box:rt,on:B.on})}return{labels:f,unseated:i,bounded:h}}function Je(t,e,n,o){const c=[],l=[];return t.querySelectorAll(`.${n}-gbox, .${n}-group`).forEach(s=>{if(s.getClientRects().length===0||getComputedStyle(s).display==="contents")return;const a=xt(s,e);l.push(a),c.push({l:a.l,r:a.r,t:a.t,b:a.t+1},{l:a.l,r:a.r,t:a.b-1,b:a.b},{l:a.l,r:a.l+1,t:a.t,b:a.b},{l:a.r-1,r:a.r,t:a.t,b:a.b});const r=s.querySelector(`:scope > .${n}-glabel`);r&&r.getClientRects().length&&c.push(xt(r,e))}),t.querySelectorAll(`.${n}-lane`).forEach((s,a)=>{if(!s.getClientRects().length)return;const r=xt(s,e);a>0&&c.push({l:r.l,r:r.r,t:r.t-o/2-.5,b:r.t-o/2+.5});const d=s.querySelector(`.${n}-lane-name`);d&&c.push(xt(d,e))}),{obstacles:{rects:c,heads:[]},groups:l}}function Ue(t,e){const{m:o,tk:c,P:l,drawing:s,origin:a,warn:r}=t,d=c.space,g=Ve(o,s,a,l),f=[...g.values()],i=Gn(s),h=a.left-Math.floor(a.left),b=a.top-Math.floor(a.top),p=Ne(h,b),m=s.clientWidth,k=s.clientHeight,L=y=>o.type==="data-flow"?y.col+1:y.col,z=parseFloat(getComputedStyle(s).rowGap)||0,v={w:m,h:k,nodes:f,lines:[],lifelines:[],labels:[],crossings:[],through:[],unseated:[],outside:[],ox:h,oy:b};if(o.type==="sequence")return Zn(t,v,p);let O,B=[];o.type==="schema"?O=o.edges.map(y=>{const S=o.byId.get(y.from),E=o.byId.get(y.to);if(S.col===E.col){const N=!((o.rtl?S.col===1:S.col===o.cols)&&o.cols>1)===!o.rtl?"right":"left";return[N,N]}return E.col>S.col?["right","left"]:["left","right"]}):(O=o.edges.map(y=>{const S=o.byId.get(y.from),E=o.byId.get(y.to),[M,A]=fe(S,E);return[y.fromSide??M,y.toSide??A]}),B=He(o,O,r||(()=>{})));const j=(y,S)=>{const E=s.querySelector(`.${l}-node[data-node="${CSS.escape(y)}"] .${l}-row[data-row="${S}"]`);if(!E)return 0;const M=xt(E,a);return(M.t+M.b)/2},F=new Map;if(o.type==="schema"){const y=new Map;o.edges.forEach((E,M)=>{const A=`${E.to}.${E.toRow}.${O[M][1]}`;y.set(A,[...y.get(A)??[],M])});const S=E=>{const M=o.edges[E].card?.to;return M==="one"?0:M==="zero-or-one"?1:2};for(const E of y.values()){const M=[...new Set(E.map(S))].sort((A,N)=>A-N);if(M.length>1)for(const A of E)F.set(A,(M.indexOf(S(A))-(M.length-1)/2)*d("2"))}}const rt=y=>Math.round(y+h)-h,q=o.edges.map((y,S)=>{const[E,M]=O[S],A=g.get(y.from),N=g.get(y.to),J=Qt(y.kind,c);if(y.fk){const P=j(y.from,y.fromRow),ot=j(y.to,y.toRow)+(F.get(S)??0),gt=p.y(P,J),Bt=p.y(ot,J),Et=E==="right"?A.rect.r:A.rect.l,St=M==="right"?N.rect.r:N.rect.l;return{p1:{x:y.card?rt(Et):Et,y:gt},p2:{x:y.card?rt(St):St,y:Bt},r1:P,r2:Math.abs(gt-Bt)<.01?P:ot}}const K=B.find(P=>P.edge===S&&P.end==="from").f,Y=B.find(P=>P.edge===S&&P.end==="to").f;let U=Ge(A,E,K),Z=Ge(N,M,Y);const W=ct(E)?U.y:U.x;let G=ct(M)?Z.y:Z.x;return ct(E)?U={...U,y:p.y(U.y,J)}:U={...U,x:p.x(U.x,J)},ct(M)?Z={...Z,y:p.y(Z.y,J)}:Z={...Z,x:p.x(Z.x,J)},ct(E)&&ct(M)&&Math.abs(U.y-Z.y)<1.01&&(Z={...Z,y:U.y},G=W),!ct(E)&&!ct(M)&&Math.abs(U.x-Z.x)<1.01&&(Z={...Z,x:U.x},G=W),U=ct(E)?kt(A,E,U.y):kt(A,E,U.x),Z=ct(M)?kt(N,M,Z.y):kt(N,M,Z.x),{p1:U,p2:Z,r1:W,r2:G}}),D=new Set,T=(y,S)=>{D.has(y)||(D.add(y),r?.(`${o.edges[y].from} to ${o.edges[y].to} ${S}, so its line is not drawn; its row still writes the target`))};for(const y of Xt(o).dropped)T(y,"would need a third lane of turn-backs");const R=new Map,H=Lt();o.type==="schema"&&o.edges.forEach((y,S)=>{const E=o.byId.get(y.from),M=o.byId.get(y.to);if(Math.abs(E.col-M.col)<2)return;const A=Math.min(E.col,M.col),N=Math.max(E.col,M.col),J=o.nodes.filter(ot=>ot.col>A&&ot.colgt.row<=ot&>.row2>=ot+1)||Y.push({key:`g${ot}`,y:(K[ot-1][1]+K[ot][0])/2,inner:!0});Y.push({key:"top",y:K[0][0]-d("4"),inner:!1},{key:"bottom",y:K[K.length-1][1]+d("4"),inner:!1});const U=(q[S].r1+q[S].r2)/2,Z=t.pick?.[S]??Y.slice().sort((ot,gt)=>Math.abs(ot.y-U)-Math.abs(gt.y-U)||Number(gt.inner)-Number(ot.inner)||ot.y-gt.y)[0].key;H[S]=Z;const W=O[S][0]==="right"?E.col:E.col-1,G=i.cols[W-1],P=i.cols[W];R.set(S,{corridor:Z,first:G&&P?{key:`c${W}`,span:[G[1],P[0]]}:null,y:0})});const Q=new Map;for(const[y,S]of R){const E=o.edges[y],M=Q.get(S.corridor)??[],A=M.find(N=>{const J=o.edges[N[0]];return J.to===E.to&&J.toRow===E.toRow&&O[N[0]][1]===O[y][1]&&Math.abs(q[N[0]].p2.y-q[y].p2.y)<.5});A?A.push(y):M.length>=2?T(y,"would need a third lane in its corridor"):M.push([y]),Q.set(S.corridor,M)}for(const y of[...R.keys()])D.has(y)&&R.delete(y);const at=y=>{const S=o.edges[y[0]];return Math.abs(o.byId.get(S.from).col-o.byId.get(S.to).col)*1e4+Math.abs(q[y[0]].p1.x-q[y[0]].p2.x)},it=(y,S,E)=>{const M=i.rows;if(y==="top")return M[0][0]-d("4")-S*d("3");if(y==="bottom")return M[M.length-1][1]+d("4")+S*d("3");const A=Number(y.slice(1));return(M[A-1][1]+M[A][0])/2+(S-(E-1)/2)*d("3")},yt=(y,S)=>S.forEach((E,M)=>E.forEach(A=>{R.get(A).y=it(y,M,S.length)})),dt=()=>{for(const[y,S]of Q){const E=S.map(M=>M.filter(A=>R.has(A))).filter(M=>M.length);Q.set(y,E),yt(y,y==="top"||y==="bottom"?E.slice().sort((M,A)=>at(M)-at(A)):E.slice().sort((M,A)=>at(A)-at(M)))}};dt();const et=new Map,nt=new Set,tt=new Map,$=(y,S,E,M,A)=>{et.has(y)||et.set(y,{span:S,vertical:E,members:new Map});const N=et.get(y);N.members.has(M)||N.members.set(M,[]),N.members.get(M).push(A)},u=()=>{et.clear(),nt.clear(),tt.clear(),o.edges.forEach((y,S)=>{if(D.has(S))return;const E=R.get(S);E?.first&&$(E.first.key,E.first.span,!0,`far:${S}`,-(S+1));const[M,A]=O[S],{p1:N,p2:J}=q[S],K=o.byId.get(y.from),Y=o.byId.get(y.to);let U=null,Z=null,W=!1;if(M===A){if(ct(M)){const G=M==="right"?Math.max(L(K),L(Y)):Math.min(L(K),L(Y))-1,P=i.cols[G-1],ot=i.cols[G];P&&ot&&(U=`c${G}`,Z=[P[1],ot[0]],W=!0)}else{const G=M==="bottom"?Math.max(K.row2,Y.row2):Math.min(K.row,Y.row)-1,P=i.rows[G-1],ot=i.rows[G];P&&ot&&(U=`r${G}`,Z=[P[1],ot[0]],W=!1)}U&&nt.add(S)}else if(ct(M)&&ct(A)&&(E||Math.abs(N.y-J.y)>.5)){const G=L(Y),P=A==="left",ot=i.cols[(P?G-1:G)-1],gt=i.cols[(P?G:G+1)-1];ot&>&&(U=`c${P?G-1:G}`,Z=[ot[1],gt[0]],W=!0)}else if(!ct(M)&&!ct(A)&&Math.abs(N.x-J.x)>.5){const P=A==="top"?Y.row-1:Y.row2,ot=i.rows[P-1],gt=i.rows[P];ot&>&&(U=`r${P}`,Z=[ot[1],gt[0]],W=!1)}!U||!Z||(E&&tt.set(S,Z),$(U,Z,W,`${y.to}.${A}.${Math.round(W?J.y:J.x)}`,S))})};u();const w=new Map,C=y=>{const[S,E]=O[y],{p1:M,p2:A}=q[y],N=R.get(y);if(N){const J=tt.get(y),K=w.get(-(y+1))??(N.first?(N.first.span[0]+N.first.span[1])/2:M.x),Y=w.get(y)??(J?(J[0]+J[1])/2:A.x);return[M,{x:K,y:M.y},{x:K,y:N.y},{x:Y,y:N.y},{x:Y,y:A.y},A]}if(ct(S)&&ct(E)){if(S===E){const K=d(o.marks?"6":"4")+(o.type==="schema"&&o.cols===1?(Xt(o).lane.get(y)??0)*d("3"):0),Y=w.get(y)??(S==="right"?Math.max(M.x,A.x)+K:Math.min(M.x,A.x)-K);return[M,{x:Y,y:M.y},{x:Y,y:A.y},A]}if(Math.abs(M.y-A.y)<=.5)return[M,{x:A.x,y:M.y}];const J=w.get(y)??(M.x+A.x)/2;return[M,{x:J,y:M.y},{x:J,y:A.y},A]}if(!ct(S)&&!ct(E)){if(S===E){const K=w.get(y)??(S==="bottom"?Math.max(M.y,A.y)+d("4"):Math.min(M.y,A.y)-d("4"));return[M,{x:M.x,y:K},{x:A.x,y:K},A]}if(Math.abs(M.x-A.x)<=.5)return[M,{x:M.x,y:A.y}];const J=w.get(y)??(M.y+A.y)/2;return[M,{x:M.x,y:J},{x:A.x,y:J},A]}return ct(S)?[M,{x:A.x,y:M.y},A]:[M,{x:M.x,y:A.y},A]},I=y=>{const S=o.edges[y],E=Qt(S.kind,c),M=C(y),A=We(M,E,p);let N;return M.length===A.length&&(N=_t(M).map(([J,K])=>Math.abs(J.y-K.y)<.75?(J.y+K.y)/2:(J.x+K.x)/2),N[0]=q[y].r1,N.length>1&&(N[N.length-1]=q[y].r2)),{i:y,from:S.from,to:S.to,kind:S.kind,pts:A,tip:A[A.length-1],dir:de(A),dot:S.fk&&!S.card?A[0]:void 0,card:S.card,width:E,axes:N}},_=()=>o.edges.flatMap((y,S)=>D.has(S)?[]:[I(S)]);let X=null;const V=y=>{X??(X=_());const S=X.map(E=>y.has(E.i)?I(E.i):E);return{lines:S,score:Kn(S,y)*1e5+te(S,void 0,y).length*1e3+pe(S.filter(E=>y.has(E.i)),f,o).length}},ft=(y,S)=>{const E=y.flatMap(M=>{const A=M<0?-M-1:M,{p1:N,p2:J}=q[A],K=R.get(A);return K?M<0?[N.y,K.y]:[K.y,J.y]:S?[N.y,J.y]:[N.x,J.x]});return[Math.min(...E),Math.max(...E)]},st=y=>y<0?-y-1:y,lt=y=>{const S=[...y.members.values()].map(M=>({members:M,run:ft(M,y.vertical)})).sort((M,A)=>M.run[0]-A.run[0]),E=[];for(const M of S){const A=E[E.length-1];A&&A.some(N=>N.run[0]!(M.length===1&&M[0].members.every(A=>nt.has(A))))},pt=y=>(S,E)=>y[S].run[0]{const S=pt(y),E=[];return y.forEach((M,A)=>{let N=0;for(;E.some((J,K)=>J===N&&S(A,K));)N++;E.push(N)}),E},ut=y=>Math.max(0,...Mt(y))+1;if(o.marks)for(let y=0;y3){S=N.map(J=>J.members.map(st));break}if(!S)break;const E=A=>Math.max(...A),M=S.filter(A=>A.some(N=>R.has(N))).sort((A,N)=>E(N)-E(A))[0]??S.slice().sort((A,N)=>E(N)-E(A))[0];for(const A of M)T(A,"would need a fourth lane in a marked gutter"),R.delete(A);u()}const $t=(y,S,E,M=!1)=>{const A=o.rtl&&M?E-1-S:S,N=y[1]-y[0];if(!o.marks)return y[0]+N/(E+1)*(A+1);const J=c.foot+c.radiusXs,K=E>1?Math.min(N/(E+1),(N-2*J)/(E-1)):0;return(y[0]+y[1])/2+(A-(E-1)/2)*K};dt();for(const[y,S]of Q){if(y==="top"||y==="bottom"||S.length<2)continue;const E=new Set(S.flat());let M=S,A=1/0;for(const N of he(S.slice().sort((J,K)=>at(K)-at(J)))){yt(y,N),X=null;const J=V(E);J.scoreY.members);if(o.marks){const Y=ut(S),U=pt(S),Z=S.length,W=new Set(E.flat().map(st)),G=Et=>Et.forEach((St,zt)=>E[zt].forEach(jt=>w.set(jt,$t(y.span,St,Y,y.vertical))));let P=Mt(S),ot=1/0,gt=null;const Bt=[P];if(Y**Z<=729)for(let Et=0;EtMath.floor(Et/Y**jt)%Y);St.every((zt,jt)=>St.every((ne,Vt)=>Vt<=jt||zt!==ne||!U(jt,Vt)))&&Bt.push(St)}for(const Et of Bt){G(Et);const St=V(W);St.scoreZ.forEach(G=>w.set(G,$t(y.span,W,M,y.vertical))));const U=V(A);U.scoreY.forEach(Z=>w.set(Z,$t(y.span,U,M,y.vertical)))),X=K}if(v.lines=_(),o.marks&&(v.lines=v.lines.filter(y=>{if(!y.card)return!0;const S=_t(y.pts),E=([A,N])=>Math.hypot(N.x-A.x,N.y-A.y),M=S.length===1?2*c.foot:c.foot+c.radiusXs-.5;return E(S[0])>=M&&E(S[S.length-1])>=M?!0:(T(y.i,"has no room for its marks at an end"),R.delete(y.i),!1)})),R.size){const y=new Set([...R.values()].map(E=>E.corridor)),S=[y.has("top")?"var(--basalt-space-8)":"0px"];for(let E=1;E<=o.rows;E++)S.push("auto",EKe(y,c));const vt=Vn(o,v.lines,f,bt,wt,{l:0,t:0,r:m,b:k},c,e,{ox:h,oy:b});return v.labels=vt.labels,v.unseated=vt.unseated,v.bounded=vt.bounded,v.overlaps=[...new Set(Xe(v.lines,null).flat())],v}function Kn(t,e){return Xe(t,e).length}function Xe(t,e){const n=[];for(let o=0;o=a)continue;const[m,k]=i?[r.x,d.x]:[r.y,d.y],[L,z]=i?[g.x,f.x]:[g.y,f.y];Math.min(Math.max(m,k),Math.max(L,z))-Math.max(Math.min(m,k),Math.min(L,z))>1&&n.push([l.i,s.i])}}return n}function*he(t){if(t.length<=1){yield t.slice();return}if(t.length>5){yield t.slice();return}for(let e=0;e{const r=a===l.pts.length-1?Math.max(l.width/2,o.head/2):l.width/2;return s.x-r<-.5||s.x+r>e+.5||s.y-r<-.5||s.y+r>n+.5})&&c.push(l.i);return c}function pe(t,e,n){const o=[];for(const c of t){const l=_t(c.pts);e.some(s=>l.some(([a,r])=>Wn(a,r,s)))&&o.push(c.i)}return o}function Zn(t,e,n){const{m:o,tk:c,P:l,drawing:s,origin:a}=t,r=c.space,d=new Map;s.querySelectorAll(`.${l}-node`).forEach(v=>d.set(v.dataset.node,xt(v,a)));const g=s.querySelector(`.${l}-steps`),f=g?xt(g,a).b:e.h,i=v=>{const O=d.get(v);return O?n.x((O.l+O.r)/2,c.hair):0};for(const v of o.nodes){const O=d.get(v.id);O&&e.lifelines.push({x:i(v.id),y1:O.b,y2:f})}const h=v=>d.get(v.id),b=new Map;s.querySelectorAll(`.${l}-msg`).forEach(v=>{const O=xt(v,a);b.set(Number(v.querySelector(`.${l}-num`)?.textContent??0),(O.t+O.b)/2)});const p=c.activation,m=p/2,k=v=>{const O=o.byId.get(v.who);if(!O)return null;const B=i(v.who),F=(O.i===o.nodes.length-1&&o.nodes.length>1?-1:1)*(o.rtl?-1:1),rt=(v.depth-1)*r("1")*F,q=b.get(v.from)??0,D=b.get(v.to)??q,T=v.from===v.to;return{l:n.x(B-m+rt,c.hair),r:n.x(B+m+rt,c.hair),t:n.y(T?q-r("2")-r("1"):q,c.hair),b:n.y(T?q+r("2")+r("1"):D,c.hair)}},L=o.bars.map(v=>({bar:v,rect:k(v)})).filter(v=>v.rect);e.bars=L.map(v=>v.rect);const z=(v,O,B)=>L.filter(({bar:j})=>j.who===v&&j.to>=O&&(B?j.from<=O:j.fromF.bar.depth-j.bar.depth)[0]?.rect;s.querySelectorAll(`.${l}-msg`).forEach(v=>{const O=v.dataset.from,B=v.dataset.to,j=v.dataset.kind??"plain",F=Qt(j,c),rt=xt(v,a),q=n.y((rt.t+rt.b)/2,F),D=Number(v.querySelector(`.${l}-num`)?.textContent??0);let T=i(O),R=i(B),H;if(O===B){const nt=v.dataset.self==="start"?-r("6"):r("6"),tt=z(O,D,!0),$=tt?nt>0?tt.r:tt.l:T,u=n.y(q-r("2"),F),w=n.y(q+r("2"),F);H=[{x:$,y:u},{x:n.x(T+nt,F),y:u},{x:n.x(T+nt,F),y:w},{x:$,y:w}]}else{const nt=R>T?1:-1,tt=z(O,D,!1),$=z(B,D,!0);tt&&(T=nt>0?tt.r:tt.l),$&&(R=nt>0?$.l:$.r),H=[{x:T,y:q},{x:R,y:q}]}e.lines.push({i:D,from:O,to:B,kind:j,pts:H,tip:H[H.length-1],dir:de(H),width:F});const Q=v.querySelector(`.${l}-said`),at=v.querySelector(`.${l}-note`),it=o.byId.get(O),yt=o.byId.get(B);if(!it||!yt)return;const dt=O===B?(()=>{const nt=o.nodes.find($=>$.col===it.col+(v.dataset.self==="start"?-1:1)),tt=nt?i(nt.id):v.dataset.self==="start"?0:e.w;return Math.abs(tt-T)-r("6")-r("2-5")-r("2")})():Math.abs(R-T)-2*r("2");Math.max(Q?Q.getBoundingClientRect().width:0,at?at.getBoundingClientRect().width:0)>dt+.5&&e.unseated.push(D)}),s.querySelectorAll(`.${l}-fhead`).forEach(v=>{const O=v.parentElement?.querySelector(`:scope > .${l}-fbox`);if(!O)return;[...v.children].reduce((j,F)=>j+F.getBoundingClientRect().width,0)+r("3")>O.getBoundingClientRect().width+.5&&(e.misfit??(e.misfit=[])).push(`the frame "${v.querySelector(`.${l}-flabel`)?.textContent??""}" is wider than its participants`)});{const v=[...s.querySelectorAll(`.${l}-fbox`)].flatMap(O=>{const B=xt(O,a);return[{x:B.l+.5,t:B.t,b:B.b},{x:B.r-.5,t:B.t,b:B.b}]});v.length&&s.querySelectorAll(`.${l}-said, .${l}-note, .${l}-band > span`).forEach(O=>{if(!O.getClientRects().length)return;const B=ce(xt(O,a),r("1"));v.some(j=>B.lj.x&&B.tj.t)&&(e.misfit??(e.misfit=[])).push(`"${O.textContent?.trim()??""}" would lie on a frame's side`)})}return e}function Jn(t,e,n,o,c){const l=[];for(const[s,a]of t){if(!a.getClientRects().length)continue;const r=xt(a,n),d=xt(s,n),g=getComputedStyle(a),f=getComputedStyle(s),i={l:r.l+(parseFloat(g.paddingLeft)||0),r:r.r-(parseFloat(g.paddingRight)||0)},h=i.r-i.l,b=d.l+(parseFloat(f.borderLeftWidth)||0),p=d.r-(parseFloat(f.borderRightWidth)||0),m=[];for(const j of e)for(const[F,rt]of _t(j.pts)){const q=ue(F,rt,j.width);q.tr.t&&m.push({l:q.l,r:q.r})}const k=c("2-5"),L=j=>m.every(F=>F.r<=j-k+.01||F.l>=j+h+k-.01);if(L(i.l))continue;const z=m.map(j=>o?i.r-(j.l-k):j.r+k-i.l).filter(j=>j>0).sort((j,F)=>j-F),v=j=>o?i.l-j:i.l+j,O=j=>o?v(j)>=b+c("3")-.01:v(j)+h<=p-c("3")+.01,B=z.find(j=>O(j)&&L(v(j)));if(B===void 0){l.push(a.textContent??"");continue}a.style.setProperty("--_gx",`${Math.round(B*100)/100}px`)}return l}function Qe(t,e,n,o=Lt()){const{m:c,tk:l,P:s,drawing:a,origin:r}=t,d=l.space,g=Ve(c,a,r,s),f=[...g.values()],i=r.left-Math.floor(r.left),h=r.top-Math.floor(r.top),b=Ne(i,h,!!c.rtl),p=a.clientWidth,m=a.clientHeight,k={w:p,h:m,nodes:f,lines:[],lifelines:[],labels:[],crossings:[],through:[],unseated:[],outside:[],ox:i,oy:h},L=Lt();if(c.type==="sequence"||c.type==="schema")return{geo:k,grow:L};const z=!!c.rtl,v=z?-1:1,O=u=>z?u.r:u.l,B=u=>z?u.l:u.r,j=z?"left":"right",F=(u,w,C,I)=>{const _=u+I*v*w,X=_+I*v*C;return{l:Math.min(_,X),r:Math.max(_,X)}},rt=getComputedStyle(a),q=z?parseFloat(rt.paddingLeft)||0:p-(parseFloat(rt.paddingRight)||0),D=(u,w,C)=>{const I=[u];for(let _=1;_<=(Ot(o,w)??0);_++)I.push({...u,t:u.t+C*d("4")*_,b:u.b+C*d("4")*_});return I},T=new Map;a.querySelectorAll(`.${s}-node`).forEach(u=>{const w=u.parentElement,C=xt(w,r),I=getComputedStyle(w);T.set(u.dataset.node,z?C.l+(parseFloat(I.paddingLeft)||0)+(parseFloat(I.borderLeftWidth)||0):C.r-(parseFloat(I.paddingRight)||0)-(parseFloat(I.borderRightWidth)||0))});const R=c.nodes,H=u=>g.get(R[u].id),Q=new Map;a.querySelectorAll(`.${s}-group > .${s}-glabel`).forEach(u=>{u.style.removeProperty("--_gx"),Q.set(u.parentElement,u)});const at=new Map;for(const[u,w]of Q)w.getClientRects().length&&at.set(u,xt(w,r));const it=u=>{const w=a.querySelector(`.${s}-node[data-node="${CSS.escape(u)}"]`),C=w?.parentElement;return!!(C?.matches(`.${s}-group[data-turn]`)&&C.querySelector(`:scope > .${s}-node`)===w)},yt=(u,w,C)=>it(w)?Array.from({length:Math.round(C/16)+1},(I,_)=>({...u,t:u.t-_*d("4"),b:u.b-_*d("4")})):[u],dt=[],et=u=>Qt(c.edges[u].kind,l);c.edges.forEach((u,w)=>{const C=n.routes[w],I=g.get(u.from),_=g.get(u.to),X=et(w);let V=[];const ft=u.label,st=ft?e(ft,"label"):0,lt=ft?16*Kt(ft):16,pt=d("4");if(C==="down"||C==="up"){const ut=Math.max(I.rect.l,_.rect.l),$t=Math.min(I.rect.r,_.rect.r),bt=c.edges.map((S,E)=>({o:S,j:E})).filter(({o:S,j:E})=>(n.routes[E]==="down"||n.routes[E]==="up")&&(S.from===u.from&&S.to===u.to||S.from===u.to&&S.to===u.from)),wt=bt.findIndex(S=>S.j===w),vt=bt.length<2?.5:bt.length===2?wt===0?.25:.75:(wt+1)/(bt.length+1);let y=b.x(ut+($t-ut)*vt,X);if(C==="down"){const S=a.querySelector(`.${s}-node[data-node="${CSS.escape(u.to)}"]`),E=S?.parentElement,M=E&&E.matches(`.${s}-group`)&&E.querySelector(`:scope > .${s}-node`)===S?at.get(E):void 0;if(M&&E&&!E.contains(a.querySelector(`.${s}-node[data-node="${CSS.escape(u.from)}"]`))){const A=d("2-5")+X/2;if(y>M.l-A&&y=ut+d("6"):N<=$t-d("6"))&&(y=b.x(N,X))}}}if(V=C==="down"?[kt(I,"bottom",y),kt(_,"top",y)]:[kt(I,"top",y),kt(_,"bottom",y)],ft){let S=Math.min(V[0].y,V[1].y),E=Math.max(V[0].y,V[1].y);C==="down"?E-=l.head:S+=l.head;const M=[...a.querySelectorAll(`.${s}-group`)].map(K=>xt(K,r));let A=[[S,E]];for(const K of M)for(const Y of[K.t,K.b])A=A.flatMap(([U,Z])=>Y>U+1&&YM.some(U=>(K+Y)/2>U.t&&(K+Y)/2U.l&&y1){const K=A.filter(([U,Z])=>!N(U,Z));[S,E]=(K.length?K:A).reduce((U,Z)=>Z[1]-Z[0]>U[1]-U[0]?Z:U)}const J=[1/2,1/3,2/3].map(K=>{const Y=S+(E-S)*K;return{l:y-st/2-d("1"),r:y+st/2+d("1"),t:Y-lt/2,b:Y+lt/2}});dt.push({k:w,cands:J,on:!0,card:C==="down"?u.to:u.from})}}else if(C==="trunk"||C==="rail"){const ut=C==="rail"?z?Math.min(I.rect.r,_.rect.r):Math.max(I.rect.l,_.rect.l):O(I.rect),$t=b.x(ut+v*d(C==="trunk"?"8":"3"),X),bt=kt(I,"bottom",$t);if(C==="rail"){if(V=[bt,kt(_,"top",$t)],ft){const wt=_.rect.t-d("6");dt.push({k:w,cands:D({...F($t,d("2-5"),st,1),t:wt-lt/2,b:wt+lt/2},u.to,-1),on:!1,card:u.to})}}else{const wt=b.x(O(_.rect)+v*d("6"),X),vt=b.y(_.rect.t-pt,X);V=[bt,{x:$t,y:vt},{x:wt,y:vt},kt(_,"top",wt)];const y={...F(wt,d("2-5"),st,1),t:vt-lt/2,b:vt+lt/2};ft&&dt.push({k:w,cands:[...yt(y,u.to,lt),...D(y,u.to,-1).slice(1)],on:!1,card:u.to})}}else{const ut=Z=>T.get(Z)??(z?0:p),$t=z?Math.max(ut(u.from),ut(u.to)):Math.min(ut(u.from),ut(u.to)),bt=b.x(n.gutter?q+v*(n.lanes[w]+1)*d("3-5"):$t-v*d("2-5"),X),wt=b.y(I.rect.t+(I.rect.b-I.rect.t)*n.exits[w],X),vt=kt(I,j,wt),y=C==="end-down",S=c.edges.map((Z,W)=>({o:Z,j:W})).filter(({o:Z,j:W})=>n.routes[W]===C&&Z.to===u.to).sort((Z,W)=>n.lanes[W.j]-n.lanes[Z.j]||Z.j-W.j),E=Math.max(0,S.findIndex(({j:Z})=>Z===w)),M=B(_.rect)-v*(d("6")+E*d("3")),A=B(_.rect)-v*(d("6")+(S.length-1)*d("3")),N=b.x(M,X),J=y?_.rect.t-pt-E*d("5"):_.rect.b+pt+E*d("5"),K=b.y(J,X);V=[vt,{x:bt,y:vt.y},{x:bt,y:K},{x:N,y:K},kt(_,y?"top":"bottom",N)];const Y=y?u.to:R[_.i+1]?.id??u.to,U={...F(A,d("2-5"),st,-1),t:J-lt/2,b:J+lt/2};ft&&dt.push({k:w,cands:[...y?yt(U,Y,lt):[U],...D(U,Y,y?-1:1).slice(1)],on:!1,card:Y})}const Mt=We(V,X,b);k.lines.push({i:w,from:u.from,to:u.to,kind:u.kind,pts:Mt,tip:Mt[Mt.length-1],dir:de(Mt),width:X})}),k.crossings=te(k.lines),k.through=pe(k.lines,f,c),k.outside=Ye(k.lines,p,m,l),k.seatless=Jn(Q,k.lines,r,z,d);const{obstacles:nt}=Je(a,r,s,0);nt.heads=k.lines.map(u=>Ke(u,l));const tt=[],$={l:0,t:0,r:p,b:m};for(const u of dt){const w=_=>{const X=ce(_,d("1"));return _.l<$.l-.5||_.r>$.r+.5||_.t<$.t-.5||_.b>$.b+.5||f.some(V=>ze(X,V))||tt.some(V=>Ct(X,V))||nt.heads.some(V=>Ct(X,V))||nt.rects.some(V=>Ct(X,V))||k.lines.some(V=>V.i!==u.k&&_t(V.pts).some(([ft,st])=>Ct(X,ue(ft,st,V.width))))},C=u.cands.find(_=>!w(_));C||(L[u.card]=(L[u.card]??0)+1,k.unseated.push(u.k));const I=C?Ze(C,i,h,_=>!w(_),z):u.cands[0];tt.push(I),k.labels.push({i:u.k,text:c.edges[u.k].label,box:I,on:u.on})}return{geo:k,grow:L}}function Pe(t,e,n=0){const o=s=>String(Math.round(s*100)/100);let c=`M${o(t[0].x)} ${o(t[0].y)}`;for(let s=1;s{const{crow:D,ring:T}=Oe(j,F.x,F.y,rt,n.head,n.dot);return`${T?``:""}`};return`${B(e.card.from,v,Math.sign(O.x-v.x)||1,"from")}${B(e.card.to,e.tip,-l.x||1,"to")}`}const s=e.kind==="dashed",a=n.head,r=n.head/2,d=s?1:a-1,g=e.pts.map(v=>({...v})),f=g[g.length-1];f.x-=l.x*d,f.y-=l.y*d;const i=e.tip.x-l.x*a,h=e.tip.y-l.y*a,b=-l.y*r,p=l.x*r,m=v=>Math.round(v*100)/100,k=mt(e.kind),L=s?``:``,z=e.dot?``:"";return`${L}${z}`}function tn(t,e,n,o){const c=new Map,l=new Map;for(const a of e.crossings)l.has(a.under)||l.set(a.under,[]),l.get(a.under).push(a);let s="";for(const[a,r]of l){const d=`${o}-cut-${a}`;c.set(a,d);const g=r.map(f=>{const i=e.lines[f.top],h=e.lines[f.under],b=i.width/2+n.cut,p=h.width/2+1;return f.underVertical?``:``}).join("");s+=`${g}`}return{defs:s,ids:c}}function en(t,e,n,o){const{defs:c,ids:l}=tn(t,e,n,o),s=e.lifelines.map(i=>``).join(""),a=(e.bars??[]).map(i=>``).join(""),r=e.lines.map((i,h)=>Xn(t,i,n,l.get(h)??null,i.from===i.to?n.radiusXs:n.radius)).join(""),g=`${s?`${s}`:""}${c?`${c}`:""}${a}${r}`,f=e.labels.map(i=>`1?' data-lines="2"':""} style="left:${Math.round(i.box.l*100)/100}px;top:${Math.round(i.box.t*100)/100}px;width:${Math.round((i.box.r-i.box.l)*100)/100}px">${i.text.split(` +`).map(mt).join("
")}
`).join("");return g+f}function ge(t,e,n,o,c,l,s,a){const d=t.querySelector(`.${n}-drawing`);if(!d||t.clientWidth===0)return{dyn:c,geo:null,ink:"",tokens:null};const g=zn(t),f=Hn(d,n),i=Dn(e,g,f);a?.(i.least);const h=t.clientWidth,b=(()=>{const q=document.activeElement;return q&&d.contains(q)&&q.dataset.node?q.dataset.node:void 0})(),p=q=>Tt(e,q)?{...q,stop:q.stop&&e.byId.has(q.stop)?q.stop:e.nodes[0]?.id,keep:void 0}:{...q,stop:q.stop??e.nodes[0]?.id,keep:b&&q.layout!=="drawn"?b:void 0};let m=!1;const k=q=>{if(m=!1,e.type!=="flowchart")return q;l({...q,heights:void 0,words:void 0});const D=Lt(),T=Lt();return d.querySelectorAll(`.${n}-node[data-shape="decision"]`).forEach(R=>{const H=R.querySelector(`.${n}-words`);if(!H)return;const Q=R.getBoundingClientRect(),at=dt=>{const et={w:dt.width+2*g.space("2-5"),h:dt.height+2*g.space("2")},nt=1-et.w/Q.width,tt=nt>.05?et.h/2/nt:et.h*10;return Math.max(g.space("16"),Math.ceil(Q.width/5),Math.ceil(2*tt))},it=H.getBoundingClientRect();let yt=at(it);if(yt>Q.width){const dt=$=>(R.style.setProperty("--_ww",`${$}px`),H.getBoundingClientRect()),et=Math.floor(R.clientWidth-2*g.space("2-5"));let nt=Math.ceil(it.width),tt=it.height;for(;nt1;){const I=$+u>>1;dt(I).heightQ.width&&(m=!0)}),{...q,heights:D,words:Object.keys(T).length?T:void 0}},L=()=>({m:e,tk:g,P:n,drawing:d,origin:d.getBoundingClientRect(),warn:s}),z=c.autoOpen?{open:!1,autoOpen:void 0}:{},v=(q,D)=>D.map(T=>Gt(e,q.lines.find(R=>R.i===T))).join(", ");if(e.text)return{dyn:{...c,layout:"stacked",bare:void 0},geo:null,ink:"",tokens:g,least:i.least};if(h>=i.least&&!e.unplaced){const q=H=>{let Q=p({...c,...z,layout:"drawn",grow:void 0,track:void 0,bare:void 0,pad:H||void 0,rows:void 0});Q=k(Q),l(Q);let at=Ue(L(),f);return at.corridors&&(Q={...Q,rows:at.corridors.rows},l(Q),at=Ue({...L(),pick:at.corridors.pick},f)),{dd:Q,g:at}};let{dd:D,g:T}=q(!1);const R=H=>H.through.length>0||H.outside.length>0||(H.overlaps?.length??0)>0||(H.misfit?.length??0)>0||m;if(!R(T)&&T.unseated.length&&T.unseated.every(H=>T.bounded?.includes(H))){const H=q(!0);!R(H.g)&&!H.g.unseated.length&&({dd:D,g:T}=H)}if(!R(T)&&!T.unseated.length)return T.crossings.length&&s?.(`${T.crossings.length} crossing${T.crossings.length===1?"":"s"} in the drawn layout: ${T.crossings.map(H=>`${Gt(e,T.lines[H.top])} over ${Gt(e,T.lines[H.under])}`).join("; ")}`),{dyn:D,geo:T,ink:en(n,T,g,o),tokens:g,least:i.least};m&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: a decision would be taller than it is wide`),T.misfit?.length&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: ${T.misfit.join("; ")}`),T.through.length&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: ${v(T,T.through)} would pass through a node`),T.overlaps?.length&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: ${v(T,T.overlaps)} would lie on one another`),T.outside.length&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: ${v(T,T.outside)} would leave the drawing`),T.unseated.length&&s?.(`the drawn layout does not fit at ${Math.round(h)}px: no clean seat for ${T.unseated.map(H=>e.type==="sequence"?`message ${H}`:`"${qt(e.edges[H]?.label??"")}"`).join(", ")}`)}let O=p({...c,...z,layout:"stacked",heights:void 0,grow:Lt(),track:e.type==="schema"?i.table:void 0,bare:void 0,pad:void 0,rows:void 0});if(O=k(O),l(O),e.type==="sequence"||e.type==="schema")return{dyn:O,geo:null,ink:"",tokens:g,least:i.least};const B=Ie(e);let j=Qe(L(),f,B,O.grow);for(let q=0;q<6&&Object.keys(j.grow).length;q++){const D=Lt(O.grow);for(const[T,R]of Object.entries(j.grow))D[T]=(Ot(D,T)??0)+R;O={...O,grow:D},l(O),j=Qe(L(),f,B,D)}const F=j.geo;if(!B.third&&B.laneCount>2&&s?.(`the stacked drawing uses ${B.laneCount} end lanes (four at most)`),F.unseated.length>0||F.through.length>0||F.outside.length>0||B.third){F.unseated.length&&s?.(`the stacked drawing has no clean seat for ${[...new Set(F.unseated)].map(T=>`"${qt(e.edges[T]?.label??"")}"`).join(", ")}, so its lines are not drawn; the list holds every connection`),F.through.length&&s?.(`in the stacked drawing ${v(F,F.through)} would pass through a node, so its lines are not drawn`),F.outside.length&&s?.(`in the stacked drawing ${v(F,F.outside)} would leave the drawing, so its lines are not drawn`),B.third&&s?.("the stacked drawing would need a fifth end lane, so its lines are not drawn","error");const q={...F,lines:[],labels:[],crossings:[]};d.querySelectorAll(`.${n}-group > .${n}-glabel`).forEach(T=>T.style.removeProperty("--_gx"));const D=p({...O,grow:Lt(),bare:!0,open:c.bare?c.open:!0,autoOpen:c.bare?c.autoOpen:c.open?void 0:!0});return l(D),{dyn:D,geo:q,ink:"",tokens:g,least:i.least}}return F.seatless?.length&&s?.(`a stacked group's label has no clear seat on its top edge: ${F.seatless.map(q=>`"${q}"`).join(", ")}`),F.crossings.length&&s?.(`${F.crossings.length} crossing${F.crossings.length===1?"":"s"} in the stacked drawing (each is cut): ${F.crossings.map(q=>`${Gt(e,F.lines[q.top])} over ${Gt(e,F.lines[q.under])}`).join("; ")}`),{dyn:O,geo:F,ink:en(n,F,g,o),tokens:g,least:i.least}}function Gt(t,e){const n=t.byId.get(e.from)?.name??e.from,o=t.byId.get(e.to)?.name??e.to;return`${n} to ${o}`}function Yn(t,e,n,o,c,l){const s=new Set;if(l){s.add(l);for(const p of n?.lines??[])p.from===l&&s.add(p.to),p.to===l&&s.add(p.from)}if(t.toggleAttribute("data-tracing",!!l),t.querySelectorAll(`.${e}-node`).forEach(p=>p.toggleAttribute("data-near",s.has(p.dataset.node))),!n||!o)return;const a=p=>!!l&&(p.from===l||p.to===l),r=t.querySelector(`.${e}-edges`),d=new Map;t.querySelectorAll(`.${e}-edge`).forEach(p=>d.set(p.getAttribute("data-edge"),p));for(const p of n.lines){const m=d.get(String(p.i));m&&(m.toggleAttribute("data-lit",a(p)),m.toggleAttribute("data-dim",!!l&&!a(p)))}if(t.querySelectorAll(`.${e}-label`).forEach(p=>{const m=n.lines.find(k=>String(k.i)===p.dataset.edge);p.toggleAttribute("data-lit",!!(m&&a(m)))}),r){for(const p of n.lines)if(a(p)){const m=d.get(String(p.i));m&&r.appendChild(m)}}const g=te(n.lines,a),{defs:f,ids:i}=tn(e,{...n,crossings:g},o,c),h=t.querySelector(`.${e}-svg`);if(!h)return;let b=h.querySelector("defs");!b&&f&&(b=document.createElementNS("http://www.w3.org/2000/svg","defs"),h.insertBefore(b,h.firstChild)),b&&(b.innerHTML=f),n.lines.forEach((p,m)=>{const k=d.get(String(p.i))?.querySelector(`.${e}-line`);if(!k)return;const L=i.get(m);L?k.setAttribute("mask",`url(#${L})`):k.removeAttribute("mask")})}var Qn=()=>matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active), print").matches||document.documentElement.getAttribute("data-loops")==="held";function Pn(t,e){const n=t.getAttribute("data-entrance");if(!(n==="running"||n==="done")){if(!e){n&&t.removeAttribute("data-entrance");return}n||t.setAttribute("data-entrance",Qn()||eo(t)?"done":"pending")}}var to=t=>`basalt-diagram-entrance:${location.pathname}#${t.id}`;function eo(t){if(!t.hasAttribute("data-first-visit")||!t.id)return!1;try{return localStorage.getItem(to(t))!==null}catch{return!1}}function nn(t){const e=t.getAttribute("data-entrance");e!=="pending"&&e!=="running"||(t.setAttribute("data-entrance","done"),t.dispatchEvent(new Event("basalt-diagram-settle")))}function no(t,e,n,o=!1,c=!1){const l=o?Ut(t):null;if(l&&n.startsWith("Arrow")){const d={ArrowRight:c?"left":"right",ArrowLeft:c?"right":"left",ArrowDown:"down",ArrowUp:"up"}[n];return d?l[e]?.[d]??null:null}const s=t.byId.get(e)?.i??0,a=t.nodes.length;let r;if(n==="ArrowRight"||n==="ArrowDown")r=s+1;else if(n==="ArrowLeft"||n==="ArrowUp")r=s-1;else if(n==="Home")r=0;else if(n==="End")r=a-1;else return null;return t.nodes[Math.max(0,Math.min(a-1,r))].id}var oo=["data-layout","data-measured","role","aria-roledescription","aria-labelledby","aria-describedby","aria-label","tabindex","data-stops","hidden","data-art"],on=["data-layout","data-measured","data-bare","data-motion","data-first-visit","data-rtl","data-cols","data-reach","data-gutter","data-marks"],so=["--_track","--_h","--_ww","--_gap","--_ggrow","--_tl","--_gpad","--_gw","--_mh","--_rows","--_row-gap"],sn=t=>t==null||t===!1;function ao(t,e){if(t.tagName.toLowerCase()!==e.t)return!1;const n=typeof e.a.class=="string"?e.a.class.split(" ")[0]:"";return!n||t.classList.contains(n)}function ee(t,e,n=!0){if(typeof e=="string"||"slot"in e)return;const o=n?on:oo;for(const s of o)sn(e.a[s])&&t.removeAttribute(s);for(const[s,a]of Object.entries(e.a)){if(s==="class")continue;if(s==="style"){const d=t.style,g=new Map(String(a??"").split(";").map(f=>{const i=f.indexOf(":");return[f.slice(0,i).trim(),f.slice(i+1).trim()]}).filter(([f])=>f));for(const[f,i]of g)d.getPropertyValue(f).trim()!==i&&d.setProperty(f,i);for(const f of so)g.has(f)||d.removeProperty(f);continue}if(n&&!on.includes(s))continue;if(sn(a)){t.removeAttribute(s);continue}const r=a===!0?"":String(a);t.getAttribute(s)!==r&&t.setAttribute(s,r)}if(e.t==="svg"||typeof e.a.class=="string"&&/-(ink|ruler)$/.test(e.a.class)||e.c.some(s=>typeof s!="string"&&"slot"in s))return;const c=[...t.children];let l=0;for(const s of e.c)if(!(typeof s=="string"||"slot"in s)){for(let a=l;at.querySelector(`.${e}-node[data-node="${CSS.escape(l)}"]`);n&&c(n)?.setAttribute("tabindex","-1"),c(o)?.setAttribute("tabindex","0")}(function(t){"use strict";var e=t._,n="diagram",o=0;function c(i,h,b){return{prefix:n,base:i,hasSource:h.source!==void 0&&h.source!==null&&h.source!=="",hiddenClass:"visually-hidden",viewer:b?b.keys:void 0}}function l(i,h,b,p){var m=function(k){return''+mt(k)+""};return{source:mt(String(h.source||"")),summary:mt(String(h.summary||"")),hint:ie(i).map(function(k){return""+k.keys.map(m).join(" ")+" "+mt(k.words)+""}).join(""),toggle:'"}}function s(i,h,b){for(var p=i.layout==="auto"&&(i.type==="architecture"||i.type==="flowchart"||i.type==="schema"),m=p?Array.isArray(i.placement)?i.placement:i.placement?[i.placement]:[]:[],k=i.direction||(i.type==="flowchart"?"down":"right"),L=null,z=0;z");return{open:B.slice(0,j+1),inner:B.slice(j+1,B.length-9),warnings:v.errors.map(function(F){return"error: "+F}).concat(v.warnings)}}var a=["aria-labelledby","data-type","data-cols","data-reach","data-gutter","data-marks","data-layout","data-measured","data-bare"],r=["--_cols","--_gpad","--_track"];function d(i,h,b,p){i.__diagram&&i.__diagram.stop();var m=(i.getAttribute("aria-labelledby")||"").replace(/-title$/,"").replace(/[^A-Za-z0-9_-]/g,""),k=getComputedStyle(i).direction==="rtl",L=h.layout==="auto"&&(h.type==="architecture"||h.type==="flowchart"||h.type==="schema"),z=L?Array.isArray(h.placement)?h.placement:h.placement?[h.placement]:[]:[];L&&!z.length&&console.warn('Basalt diagram: "layout": "auto" needs a placement, which compose.mjs writes at build time; drawn from script, place it with placeDiagram (@srasyndicate/basalt/diagram-layout) and pass "placement". The figure is stacked');var v=h.direction?[h.direction]:h.type==="flowchart"?["down","right"]:["right","down"],O=function(W){for(var G=0;G .diagram-drawing")){if(!m||!i.querySelector("#"+CSS.escape(m+"-title"))){for(;document.getElementById("dg"+ ++o+"-title"););m="dg"+o}var j=s(h,m,p),F=document.createElement("div");F.innerHTML=j.open+"";var rt=F.firstChild;a.forEach(function(W){i.removeAttribute(W)}),r.forEach(function(W){i.style.removeProperty(W)});for(var q=0;q :not(script[data-diagram])").forEach(function(W){W.remove()}),i.insertAdjacentHTML("beforeend",j.inner)}B.warnings.forEach(function(W){console.warn("Basalt diagram: "+W)}),B.errors.forEach(function(W){console.error("Basalt diagram: "+W)}),B.motion.animated&&B.motion.firstVisit&&!i.id&&console.error('Basalt diagram: "entrance": "first-visit" needs an id on the figure: without one the entrance plays on every visit');var T=c(m,h,p),R={},H=null,Q=null,at=null,it=null,yt=Object.create(null),dt=function(W,G){yt[W]||(yt[W]=1,(G==="error"?console.error:console.warn)("Basalt diagram: "+W))},et=function(W){ee(i,Yt(B,W,T))},nt=i.querySelector(".diagram-ink"),tt=i.querySelector(".diagram-toggle"),$=!p&&B.motion.animated&&typeof e.diagramMotion=="function",u=null,w=null,C=function(){$&&nn(i)};function I(){Yn(i,n,H&&H.geo,H&&H.tokens,m,Q||it||at),V()}var _=null,X=!p&&matchMedia("(hover: none), (pointer: coarse)").matches;function V(){var W=X&&!p&&nt&&nt.innerHTML!=="";if(i.toggleAttribute("data-touch",!!(X&&!p)),W&&!_){var G=i.querySelector(":scope > .diagram-foot");if(!G)return;_=document.createElement("button"),_.type="button",_.className="btn diagram-clear",_.setAttribute("data-variant","secondary"),_.setAttribute("data-size","sm"),_.innerHTML="Clear highlight",_.addEventListener("click",function(){it&&(it=null,I())}),G.appendChild(_)}else!W&&_&&(_.remove(),_=null);_&&_!==_.parentNode.lastElementChild&&document.activeElement!==_&&_.parentNode.appendChild(_),_&&(it?_.removeAttribute("aria-disabled"):_.setAttribute("aria-disabled","true"))}function ft(W){if(!W.defaultPrevented){var G=bn(i,n,W,it);G!==void 0&&(C(),X=!0,it=G,I())}}function st(){tt&&(tt.setAttribute("aria-expanded",String(!!R.open)),tt.firstElementChild.textContent=R.open?"Hide the list":"View as list")}function lt(){if(L&&z.length>1&&!p){for(var W=null,G=[],P=!1,ot=0;ot1&&p&&!h.direction&&p.room){for(var ne=p.room(),Vt=-1,me=null,ye=0;yeVt+1e-6&&(Vt=rn,me=$e)}}}me&&(B=me)}H=(p?p.measure:ge)(i,B,n,m,R,et,dt),R=H.dyn,et(R),st();var be=i.querySelector(":scope > .diagram-hint");if(be){var ln=ie(B,R.layout==="drawn").map(function(At){return""+At.keys.map(function(co){return''+mt(co)+""}).join(" ")+" "+mt(At.words)+""}).join("");be.innerHTML!==ln&&(be.innerHTML=ln)}Tt(B,R)||(at=it=null);var cn=nt&&H.ink!==w;cn&&(nt.innerHTML=H.ink,w=H.ink),I();var lo=B.text?i.querySelector(".diagram-text[data-art]"):null;B.text&&typeof e.diagramText=="function"&&e.diagramText(i,B,h,p);var dn=B.text?i.querySelector(".diagram-text[data-art]"):null;$&&H.tokens&&(Pn(i,!!(H.geo&&H.geo.lines.length)||!!dn),(cn||dn!==lo)&&u&&u.redrawn()),p&&p.onMeasured&&H.tokens&&p.onMeasured(H,i)}function pt(W){R=W,et(R)}function Mt(W){var G=R.stop;R=Object.assign({},R,{stop:W}),ro(i,n,G,W)}var ut=function(W){var G=W&&W.closest?W.closest(".diagram-node"):null;return G&&i.contains(G)?G:null};function $t(W){var G=ut(W.target);if(!(!G||W.defaultPrevented)){if(C(),W.key==="Escape"){!p&&(Q||at||it)&&(W.preventDefault(),Q=at=it=null,I());return}if(Tt(B,R)){var P=no(B,G.getAttribute("data-node"),W.key,R.layout==="drawn");if(P){W.preventDefault(),Mt(P);var ot=i.querySelector('.diagram-node[data-node="'+CSS.escape(P)+'"]');ot&&ot.focus()}}}}function bt(W){var G=ut(W.target);if(G){C();var P=G.getAttribute("data-node");Q=G.matches(":focus-visible")?P:null,Tt(B,R)&&R.stop!==P&&Mt(P),I()}}function wt(W){var G=ut(W.target);G&&(ut(W.relatedTarget)||(Q=null),R.keep===G.getAttribute("data-node")&&pt(Object.assign({},R,{keep:void 0})),I())}function vt(W){if(!(W.pointerType!=="mouse"||!matchMedia("(hover: hover)").matches)){var G=ut(W.target);G&&C();var P=G&&Tt(B,R)?G.getAttribute("data-node"):null;P!==at&&(at=P,I())}}function y(){at&&(at=null,I())}function S(){C(),pt(Object.assign({},R,{open:!R.open,autoOpen:void 0})),st()}i.addEventListener("keydown",$t),i.addEventListener("focusin",bt),i.addEventListener("focusout",wt),i.addEventListener("pointerover",vt),i.addEventListener("pointerleave",y),i.addEventListener("click",ft),tt&&tt.addEventListener("click",S),lt();var E=i.clientWidth,M=0,A=!0,N=new ResizeObserver(function(){Math.abs(i.clientWidth-E)<.5||(E=i.clientWidth,cancelAnimationFrame(M),M=requestAnimationFrame(lt))});N.observe(i),document.fonts&&document.fonts.ready.then(function(){A&<()});var J=matchMedia("(forced-colors: active)"),K=B.nodes.some(function(W){return W.mark});K&&J.addEventListener("change",lt),$&&(u=e.diagramMotion(i,{fig:i,P:n,base:m,model:function(){return B},geo:function(){return H&&H.geo},tokens:function(){return H&&H.tokens}},h));var Y=!p&&h.zoom!==!1&&typeof e.diagramZoom=="function"?e.diagramZoom(i,h,{model:B,settle:C,animated:$}):null,U=i.querySelector(":scope > .diagram-foot"),Z=!p&&h.export===!0&&U&&typeof e.diagramExport=="function"?e.diagramExport(U,i):[];i.__diagram={stop:function(){Y&&Y.destroy(),Z.forEach(function(W){W.remove()}),A=!1,N.disconnect(),cancelAnimationFrame(M),K&&J.removeEventListener("change",lt),u&&u.destroy(),i.removeEventListener("keydown",$t),i.removeEventListener("focusin",bt),i.removeEventListener("focusout",wt),i.removeEventListener("pointerover",vt),i.removeEventListener("pointerleave",y),i.removeEventListener("click",ft),_&&_.remove(),tt&&tt.removeEventListener("click",S)},layout:lt,key:g(h),send:u&&u.sendValue?u.sendValue:null}}function g(i){try{return JSON.stringify(i,function(h,b){return h==="packet"&&b&&typeof b=="object"?Object.assign({},b,{send:void 0}):b})}catch{return null}}function f(){document.querySelectorAll("figure.diagram").forEach(function(i){if(!i.__diagram){var h=i.querySelector(":scope > script[data-diagram]");if(h)try{d(i,JSON.parse(h.textContent),!0)}catch(b){console.error("Basalt diagram: this figure could not be drawn",b)}}})}e.diagramMarkup=s,e.diagramKit={draw:d,buildModel:Wt,figureKey:En,figureList:Bn,hintEntries:ie,toHtml:se,escapeHtml:mt,settleEntrance:nn,measureFigure:ge},t.diagram=function(i,h){var b=i.__diagram,p=b&&b.send?g(h):null;if(p!==null&&p===b.key){b.send(h.packet?h.packet.send:void 0);return}d(i,h)},e.step(62,"wireDiagrams",f)})(window.Basalt)})(); diff --git a/.agent/skills/basalt-html/parts/manifest.json b/.agent/skills/basalt-html/parts/manifest.json index 4752626..65b09d0 100644 --- a/.agent/skills/basalt-html/parts/manifest.json +++ b/.agent/skills/basalt-html/parts/manifest.json @@ -1,5 +1,5 @@ { - "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800. Raised in diagram batch B's fix round (DECISIONS 318, the owner's diagram raise; and 326's sweep), each to its measured size: diagram 137700 to 144100 (the two reviews' fixes in the shared engine: right to left frames and self-calls, the corridors' and lanes' development words, the unusable-placement check, the transcript's hanging lines, the text art's frame widening, the frame-side fit check, the sequence's layers, the stacked group's turn room), diagram-motion 28450 to 30450 (the text sequence's build by ink and its colour-only run, moved into the motion module), diagram-zoom 17000 to 17600 (a linked card closes the viewer; the text art's own width; a placed model for the key hint), diagram-export 7850 to 10450 (an export at rest: sized drawing SVGs, no reveal masks, the pseudo-element rules, the lines under the cards, a viewer's figure read at 100% with its head and key, the rim's lit top). Raised at the batch B re-check (the decider's four rulings): diagram 144100 to 145100 (5.1's first list reported as errors apart from the warnings, a turn's label lines on the group entered by it and the seats beside its turn, the bare stack applied, the text art's reset of the core's inline code chip). Merging main (#127 and #128) into diagram batch B: skillMd keeps main's 12800 (batch B had raised it to 12950 for its diagram lines); SKILL.md was tightened in its wording to stay within it, no rule dropped; core takes main's 35550.Raised in the repo review (23 Nov 2026; budgets are soft, the owner's word): notifications 12450 to 12700 (a link is written only when relative, http, https or mailto, and side and align are checked before they reach the markup), combobox 11200 to 11350 (a disabled field's hidden input is disabled too, now and later), tooltip 3200 to 3550 (the gap to the opener is the tooltip's own, and hover and keyboard focus each hold it open; WCAG 1.4.13), chart 34750 to 34800 (the scale's step search and gridlines are bounded, so extreme values cannot hang the page), spinner 650 to 720 (its held rule moved in from loops, so a ring-only page keeps a stored hold), kbd 2900 to 2950, palette 11400 to 11500 (and its usage text 1350 to 1400, for the Mod line) and toast 16050 to 16200 (Mod in a palette item's keys is bound as it is drawn, and a toast action's aria-keyshortcuts resolves Mod). The safe-sinks rule (decided by the owner, Fable, Astra and Muse, 23 Nov 2026): skillMd 12650 to 12900, and 13050 with main's own raise merged in (one line: data goes in as textContent, a link passes Basalt.safeHref, an option comes from a fixed list), core 35400 to 35650, and 35800 with main's own raise merged in, and its usage 2950 to 3200 (one safeHref, published as Basalt.safeHref, and _.pick, in place of a copy in each module; esc escapes the apostrophe), link-tabs 5750 to 5900 (a refused link dispatches no event), diagram 92650 to 93000 (a card's mark is a relative path, https or a data: image). Merging #129 into diagram batch B: diagram keeps batch B's 145100 plus #129's mark check, set to its measure, and batch B's usage 4600. The fix round after both reviews of 421348e8 sets them to the measured sizes again: core 38950 to 39600 (every room says all three forms, and a hung word's box grows by a short room's shortfall), search to 5700 (it places its top again on a resize and with the keyboard; an empty list holds no padding), command-list to 14700 (it keeps the taller of its two heights), notifications to 12950 (the bell's edge), pane to 1950 (the page column's room), chart to 34950 (the date line's reason), and code, diagram-zoom, filter, links, sheet, still-table, tab-bar and topbar each by under 150 bytes (the three forms of a room; the selection column's width however given). Merged with main at db0bc418 (#129 to #131), DECISIONS 336's caps are set to the measured sizes again: core 35800 to 38950 and its usage 3200 to 3650, toast 16200 to 16750, terminal to 12700 (13050 with the open items' ruling: both copy buttons draw their three glyphs once, so a refused copy shows the close with no markup written after), diagram-zoom 17600 to 17750 (its viewer's Close and Zoom out hung, and the foot's room). Raised in DECISIONS 336 (reserved room across every component, claude/reserved-room), each to its measured size: core 35550 to 38700 (the edge rule a ghost .btn hangs by at a head, its ring and touch hit area, the side insets by direction, the .panel-head and page section-head that hang their last button by themselves) and its usage 2950 to 3450 (how data-edge and --basalt-edge-room are written); search 4400 to 5200 (search.js, the held top), terminal 11950 to 12550 (the close glyph for a refused copy, the edge on both copies), links 2750 to 3300 (the first icon link hung, the card room, the 20px glyph), toast 16050 to 16650 (the 46px hit areas on touch), selection 1500 to 1650 and still-table 14650 to 15000 (the 44px select column), command-list 14000 to 14350 (the panel hugs, the room is page), menu 8950 to 9150 (the column every row keeps when any row has a check or a glyph), notifications 12450 to 12600, filter 17500 to 17600, forms 3500 to 3550, sheet 5400 to 5450, topbar-nav 7550 to 7600 and app-shell 5200 to 5250 (logical sides, the edge and the room); topbar's usage 3100 to 3200 (a bar's last ghost control takes data-edge); command-list's usage 2150 to 2300 (the panel hugs; the room is page, and only on the page); dialog-form's usage 1300 to 1350 (its Close is written data-icon-only data-edge=\"end\"). Raised in the polish ruling of 336 (the selection box keeps to the cell's line): selection 1650 to 1750 (the box's start margin, min(space-4, half the spare room): 1710 measured) and its usage 1150 to 1350 (the rule's sentence: 1313 measured). Merging main (#130, #131) into claude/diagram-interop: diagram usage 4600 to 4850 (+5.4%: Batch B's diagram usage plus the basalt-diagram-export rule line, measured 4806), then 4850 to 5050 (noting that .lucid is for Lucid's REST API only and to use .vsdx in Lucid's UI, measured 4999).", + "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800. Raised in diagram batch B's fix round (DECISIONS 318, the owner's diagram raise; and 326's sweep), each to its measured size: diagram 137700 to 144100 (the two reviews' fixes in the shared engine: right to left frames and self-calls, the corridors' and lanes' development words, the unusable-placement check, the transcript's hanging lines, the text art's frame widening, the frame-side fit check, the sequence's layers, the stacked group's turn room), diagram-motion 28450 to 30450 (the text sequence's build by ink and its colour-only run, moved into the motion module), diagram-zoom 17000 to 17600 (a linked card closes the viewer; the text art's own width; a placed model for the key hint), diagram-export 7850 to 10450 (an export at rest: sized drawing SVGs, no reveal masks, the pseudo-element rules, the lines under the cards, a viewer's figure read at 100% with its head and key, the rim's lit top). Raised at the batch B re-check (the decider's four rulings): diagram 144100 to 145100 (5.1's first list reported as errors apart from the warnings, a turn's label lines on the group entered by it and the seats beside its turn, the bare stack applied, the text art's reset of the core's inline code chip). Merging main (#127 and #128) into diagram batch B: skillMd keeps main's 12800 (batch B had raised it to 12950 for its diagram lines); SKILL.md was tightened in its wording to stay within it, no rule dropped; core takes main's 35550.Raised in the repo review (23 Nov 2026; budgets are soft, the owner's word): notifications 12450 to 12700 (a link is written only when relative, http, https or mailto, and side and align are checked before they reach the markup), combobox 11200 to 11350 (a disabled field's hidden input is disabled too, now and later), tooltip 3200 to 3550 (the gap to the opener is the tooltip's own, and hover and keyboard focus each hold it open; WCAG 1.4.13), chart 34750 to 34800 (the scale's step search and gridlines are bounded, so extreme values cannot hang the page), spinner 650 to 720 (its held rule moved in from loops, so a ring-only page keeps a stored hold), kbd 2900 to 2950, palette 11400 to 11500 (and its usage text 1350 to 1400, for the Mod line) and toast 16050 to 16200 (Mod in a palette item's keys is bound as it is drawn, and a toast action's aria-keyshortcuts resolves Mod). The safe-sinks rule (decided by the owner, Fable, Astra and Muse, 23 Nov 2026): skillMd 12650 to 12900, and 13050 with main's own raise merged in (one line: data goes in as textContent, a link passes Basalt.safeHref, an option comes from a fixed list), core 35400 to 35650, and 35800 with main's own raise merged in, and its usage 2950 to 3200 (one safeHref, published as Basalt.safeHref, and _.pick, in place of a copy in each module; esc escapes the apostrophe), link-tabs 5750 to 5900 (a refused link dispatches no event), diagram 92650 to 93000 (a card's mark is a relative path, https or a data: image). Merging #129 into diagram batch B: diagram keeps batch B's 145100 plus #129's mark check, set to its measure, and batch B's usage 4600. The fix round after both reviews of 421348e8 sets them to the measured sizes again: core 38950 to 39600 (every room says all three forms, and a hung word's box grows by a short room's shortfall), search to 5700 (it places its top again on a resize and with the keyboard; an empty list holds no padding), command-list to 14700 (it keeps the taller of its two heights), notifications to 12950 (the bell's edge), pane to 1950 (the page column's room), chart to 34950 (the date line's reason), and code, diagram-zoom, filter, links, sheet, still-table, tab-bar and topbar each by under 150 bytes (the three forms of a room; the selection column's width however given). Merged with main at db0bc418 (#129 to #131), DECISIONS 336's caps are set to the measured sizes again: core 35800 to 38950 and its usage 3200 to 3650, toast 16200 to 16750, terminal to 12700 (13050 with the open items' ruling: both copy buttons draw their three glyphs once, so a refused copy shows the close with no markup written after), diagram-zoom 17600 to 17750 (its viewer's Close and Zoom out hung, and the foot's room). Raised in DECISIONS 336 (reserved room across every component, claude/reserved-room), each to its measured size: core 35550 to 38700 (the edge rule a ghost .btn hangs by at a head, its ring and touch hit area, the side insets by direction, the .panel-head and page section-head that hang their last button by themselves) and its usage 2950 to 3450 (how data-edge and --basalt-edge-room are written); search 4400 to 5200 (search.js, the held top), terminal 11950 to 12550 (the close glyph for a refused copy, the edge on both copies), links 2750 to 3300 (the first icon link hung, the card room, the 20px glyph), toast 16050 to 16650 (the 46px hit areas on touch), selection 1500 to 1650 and still-table 14650 to 15000 (the 44px select column), command-list 14000 to 14350 (the panel hugs, the room is page), menu 8950 to 9150 (the column every row keeps when any row has a check or a glyph), notifications 12450 to 12600, filter 17500 to 17600, forms 3500 to 3550, sheet 5400 to 5450, topbar-nav 7550 to 7600 and app-shell 5200 to 5250 (logical sides, the edge and the room); topbar's usage 3100 to 3200 (a bar's last ghost control takes data-edge); command-list's usage 2150 to 2300 (the panel hugs; the room is page, and only on the page); dialog-form's usage 1300 to 1350 (its Close is written data-icon-only data-edge=\"end\"). Raised in the polish ruling of 336 (the selection box keeps to the cell's line): selection 1650 to 1750 (the box's start margin, min(space-4, half the spare room): 1710 measured) and its usage 1150 to 1350 (the rule's sentence: 1313 measured). Merging main (#130, #131) into claude/diagram-interop: diagram usage 4600 to 4850 (+5.4%: Batch B's diagram usage plus the basalt-diagram-export rule line, measured 4806), then 4850 to 5050 (noting that .lucid is for Lucid's REST API only and to use .vsdx in Lucid's UI, measured 4999). Raised for right to left (diagrams-rtl): diagram 145450 to 146000 (the stacked figure mirrors, its snap and whole-pixel labels with it; a drawn schema takes its turn-backs, its one-column room and its gutter lanes from the end side); then 146000 to 148000 for Fable's ruling on the stacked group label (the stem gives way, the label slides, the last resort's warning) and the author's strings isolated in ).", "budgets": { "skillMd": 13050, "core": 39600 @@ -820,7 +820,7 @@ "art", "kbd" ], - "budget": 145450, + "budget": 148000, "usage": 5050, "builds": [ "kbd" diff --git a/docs/foundations.md b/docs/foundations.md index 67c10c4..a008c36 100644 --- a/docs/foundations.md +++ b/docs/foundations.md @@ -1810,7 +1810,8 @@ card keeps its owner's colours ([Service marks](#service-marks)). One node may b A line that leaves or passes a spine card runs in an end gutter outside the cards (lanes `space-3-5` apart, four at most; the gutter is its lanes and `space-3`), down into a card's top or up into its bottom. A data flow is its steps in order with bypasses in that gutter. A sequence is a strip of participants and a numbered list that names each message's sender, receiver and kind. A schema is its cards in an auto-fit grid with no lines, because every foreign-key row writes its target. A stacked - group whose first card is entered by a turn has `space-12` above; its label stays in the first `space-8`. + group whose first card is entered by a turn has `space-12` above; its label stays in the first `space-8`. Stacked, a group's label gives + way to the lines at its top edge: it slides along the edge, on the start side, and is never set over a line that has room to pass. - **Several end lines into one card nest:** the line from the outermost lane turns lowest and enters nearest the end edge; each line from a lane further in turns `space-5` higher and enters `space-3` further in. Their labels are seated `space-2-5` clear of the innermost entry, each on its own turn's height, taken before the half-pixel snap. @@ -2002,9 +2003,9 @@ over its lifeline; a stacked chip draws the mark before the name. - Forced colours: cardinality marks follow their line; an activation's edge is `CanvasText`; a frame's edges are `GrayText`; a linked name is `LinkText`, underlined. - Print: a figure prints untraced, in its resting ink, and in the light theme whatever the screen shows. -- Right to left: drawn, the figure mirrors and its words do not; stacked, not yet (the rail, the trunk and the end gutter stay on their - left-to-right sides: a named gap, on the backlog). Identifiers are isolated left to right as runs; named sides swap; the arrow keys - stay physical; the text art stays left to right. +- Right to left: the figure mirrors and its words do not, drawn and stacked (stacked, the rail and the trunk run down the right, a + branch is indented from the right, and the end lines and the end gutter are on the left). Identifiers are isolated left to right as + runs; named sides swap; the arrow keys stay physical; the text art stays left to right. - Export: a linked card's arrow is not drawn in a file. ### Diagram tokens diff --git a/packages/react/src/diagram-core.ts b/packages/react/src/diagram-core.ts index 396f50b..d345183 100644 --- a/packages/react/src/diagram-core.ts +++ b/packages/react/src/diagram-core.ts @@ -1105,8 +1105,12 @@ function inlineArrow(P: string, kind: DiagramLineKind): VElement { // ---- Nodes ---- /** A card's name; a link card's last word is held with its cue (the stylesheet's arrow after it), so the arrow never leaves the name's last word (1.4). */ +/** An author's string as a first-strong isolate (``, the diagrams-rtl ruling): it keeps its own order in a figure set right to left, so a closing quote, + * bracket or full stop stays at its end. Nothing changes left to right. */ +const iso = (text: string): VElement => h("bdi", null, text); function linkName(P: string, n: MNode): VChild { - if (!n.href) return n.name; + // A linked name is not isolated: its cue is drawn after its last word and must stay at the line's end in the figure's direction. + if (!n.href) return iso(n.name); const at = n.name.trimEnd().lastIndexOf(" "); return [at < 0 ? "" : n.name.slice(0, at + 1), h("span", { class: `${P}-name-end` }, at < 0 ? n.name : n.name.slice(at + 1))]; } @@ -1114,12 +1118,12 @@ function linkName(P: string, n: MNode): VChild { function nodeText(P: string, m: Model, n: MNode): VChild[] { if (n.shape === "decision") return [h("span", { class: `${P}-words` }, h("span", { class: `${P}-name` }, linkName(P, n)))]; const kids: VNode[] = []; - if (m.type === "data-flow") kids.push(h("span", { class: `${P}-kind` }, n.kind!, h("span", { class: `${P}-lane-word` }, ` · ${n.laneLabel}`))); - else if (n.kind) kids.push(h("span", { class: `${P}-kind` }, n.kind)); + if (m.type === "data-flow") kids.push(h("span", { class: `${P}-kind` }, iso(n.kind!), h("span", { class: `${P}-lane-word` }, " · ", iso(n.laneLabel ?? "")))); + else if (n.kind) kids.push(h("span", { class: `${P}-kind` }, iso(n.kind))); kids.push(h("span", { class: `${P}-name` }, linkName(P, n))); // An identifier breaks only at its spaces: each run between them is kept whole (an ordinary hyphen stays, so a copy is exact). // The runs are held in one span, a single left-to-right run right to left (1.7). - if (n.detail) kids.push(h("span", { class: `${P}-detail`, "data-mono": n.mono ? "" : undefined }, n.mono ? h("span", { class: `${P}-runs` }, words(n.detail).flatMap((w, j) => [j ? " " : "", h("span", { class: `${P}-run` }, w)])) : n.detail)); + if (n.detail) kids.push(h("span", { class: `${P}-detail`, "data-mono": n.mono ? "" : undefined }, n.mono ? h("span", { class: `${P}-runs` }, words(n.detail).flatMap((w, j) => [j ? " " : "", h("span", { class: `${P}-run` }, w)])) : iso(n.detail))); return kids; } @@ -1129,7 +1133,7 @@ function tableText(P: string, n: MNode, m: Model): VChild[] { h("span", { class: `${P}-rows` }, (n.columns ?? []).map((c, k) => h("span", { class: `${P}-row`, "data-row": k, "data-key": c.key }, h("span", { class: `${P}-keyseat` }, c.key ?? ""), h("span", { class: `${P}-cname` }, c.name), - c.ref ? h("span", { class: `${P}-ctype`, "data-ref": "" }, `${m.rtl ? "←" : "→"} ${c.ref.table}`) : c.type ? h("span", { class: `${P}-ctype` }, c.type) : null))), + c.ref ? h("span", { class: `${P}-ctype`, "data-ref": "" }, `${m.rtl ? "←" : "→"} `, iso(c.ref.table)) : c.type ? h("span", { class: `${P}-ctype` }, iso(c.type)) : null))), n.more ? h("span", { class: `${P}-more` }, `+ ${n.more} more`) : null, ]; } @@ -1200,7 +1204,7 @@ function drawingChildren(ctx: TreeContext, m: Model, dyn: Dyn): VNode[] { if (!c) continue; // A box grown past its cells by one level on each side, and by two where a child group reaches that side of it (1.3). const lv = [0, 1, 2, 3].map((k) => groupLevels(m, g, k)); - out.push(h("div", { class: `${P}-gbox`, "data-group": g.id, "data-depth": g.depth > 1 ? g.depth : undefined, style: `--_c:${c.c1};--_c2:${c.c2 + 1};--_r:${c.r1};--_r2:${c.r2 + 1}${lv[0]! > 1 ? ";--_gt:2" : ""}${lv[1]! > 1 ? ";--_ge:2" : ""}${lv[2]! > 1 ? ";--_gb:2" : ""}${lv[3]! > 1 ? ";--_gs:2" : ""}`, "aria-hidden": "true" }, h("span", { class: `${P}-glabel` }, g.label))); + out.push(h("div", { class: `${P}-gbox`, "data-group": g.id, "data-depth": g.depth > 1 ? g.depth : undefined, style: `--_c:${c.c1};--_c2:${c.c2 + 1};--_r:${c.r1};--_r2:${c.r2 + 1}${lv[0]! > 1 ? ";--_gt:2" : ""}${lv[1]! > 1 ? ";--_ge:2" : ""}${lv[2]! > 1 ? ";--_gb:2" : ""}${lv[3]! > 1 ? ";--_gs:2" : ""}`, "aria-hidden": "true" }, h("span", { class: `${P}-glabel` }, iso(g.label)))); } } // The text variant (1.2): one code block, aria-hidden (the title, the summary and the list carry the figure). Before script it holds the transcript; @@ -1226,7 +1230,7 @@ function drawingChildren(ctx: TreeContext, m: Model, dyn: Dyn): VNode[] { // line of the longest such label, so nothing grows above the group for it. const lines = Math.max(0, ...turns.map((e) => (e.label ? labelLines(e.label) : 0))); const style = [grow ? `--_ggrow:${grow}` : "", lines ? `--_tl:${lines}` : ""].filter(Boolean).join(";"); - return h("div", { class: `${P}-group`, "data-group": g.id, "data-depth": g.depth > 1 ? g.depth : undefined, "data-turn": turns.length ? "" : undefined, style: style || undefined }, h("span", { class: `${P}-glabel`, "aria-hidden": "true" }, g.label), kids); + return h("div", { class: `${P}-group`, "data-group": g.id, "data-depth": g.depth > 1 ? g.depth : undefined, "data-turn": turns.length ? "" : undefined, style: style || undefined }, h("span", { class: `${P}-glabel`, "aria-hidden": "true" }, iso(g.label)), kids); }; let k = 0; while (k < m.nodes.length) { @@ -1539,7 +1543,9 @@ export function figureTree(m: Model, dyn: Dyn, o: FigureOptions): VElement { if (oneColumnTurnBacks(m)) { // Where marks are drawn the first lane is space-6 out, so the padding is space-6 plus space-1 (1.1). const first = m.marks ? "var(--basalt-space-6) + var(--basalt-space-1)" : "var(--basalt-space-5)"; - style.push(`--_gpad:0px ${turnBackLanes(m).lanes > 1 ? `calc(${first} + var(--basalt-space-3))` : m.marks ? `calc(${first})` : first} 0px 0px`); + const room = turnBackLanes(m).lanes > 1 ? `calc(${first} + var(--basalt-space-3))` : m.marks ? `calc(${first})` : first; + // On the end side: the left, right to left (1.7). + style.push(m.rtl ? `--_gpad:0px 0px 0px ${room}` : `--_gpad:0px ${room} 0px 0px`); } if (m.type === "schema" && dyn.track) style.push(`--_track:${dyn.track}px`); return h("figure", { @@ -1560,7 +1566,7 @@ export function figureTree(m: Model, dyn: Dyn, o: FigureOptions): VElement { "data-viewer": o.viewer ? "" : undefined, style: style.join(";"), }, - h("div", { class: `${P}-head` }, h(Head, { id: ids.title, class: `${P}-title` }, m.title), o.hasSource ? h("p", { class: `${P}-source` }, { slot: "source" }) : null), + h("div", { class: `${P}-head` }, h(Head, { id: ids.title, class: `${P}-title` }, iso(m.title)), o.hasSource ? h("p", { class: `${P}-source` }, h("bdi", null, { slot: "source" })) : null), h("div", { class: `${P}-drawing`, // A schema's far keys run in corridors (1.1): its rows are spacer tracks round the author's, and the grid's own row gap is none. @@ -1639,6 +1645,8 @@ export interface Geo { oy: number; /** A schema's far keys (1.1): the rows their corridors need, and each far line's corridor, chosen once on the grid without them. */ corridors?: { rows: string; pick: Record }; + /** Stacked groups whose label found no clear place on the group's top edge and keeps its start seat on its plate (the last resort), by label. */ + seatless?: string[]; } export interface Tokens { @@ -1793,9 +1801,11 @@ function minimums(m: Model, tk: Tokens, measure: ReturnType) { // ---- Snapping: a 1px line on half pixels, a 2px line on whole ones, in the page's own pixel grid ---- -function snapper(ox: number, oy: number) { +function snapper(ox: number, oy: number, mirrored = false) { + // Mirrored (a stacked figure right to left), a place halfway between two takes the left one, so the snap mirrors the left-to-right snap exactly. + const rx = mirrored ? (v: number) => -Math.round(-v) : Math.round; return { - x: (v: number, w: number) => (w % 2 === 1 ? Math.round(v + ox - 0.5) + 0.5 - ox : Math.round(v + ox) - ox), + x: (v: number, w: number) => (w % 2 === 1 ? rx(v + ox - 0.5) + 0.5 - ox : rx(v + ox) - ox), y: (v: number, w: number) => (w % 2 === 1 ? Math.round(v + oy - 0.5) + 0.5 - oy : Math.round(v + oy) - oy), }; } @@ -1992,9 +2002,11 @@ const segRect = (a: Pt, b: Pt, w: number): Rect => ({ l: Math.min(a.x, b.x) - w * nearest such place that `clear` accepts, which is the test the seat itself passed. Where none is, the seat stays as it was found. The seat is chosen * before this, against the line's own centre, so whether a label seats never turns on where the pixel grid falls. */ -function wholePixels(box: Rect, ox: number, oy: number, clear: (b: Rect) => boolean): Rect { +function wholePixels(box: Rect, ox: number, oy: number, clear: (b: Rect) => boolean, mirrored = false): Rect { const moves = (v: number, o: number) => { const f = v + o - Math.floor(v + o); return f < 0.005 || f > 0.995 ? [0] : f <= 0.5 ? [-f, 1 - f] : [1 - f, -f]; }; - for (const dy of moves(box.t, oy)) for (const dx of moves(box.l, ox)) { + // Mirrored (a stacked figure right to left), the box's right edge goes onto the whole pixel, as the left does left to right. + const across = mirrored ? moves(-box.r, -ox).map((d) => -d) : moves(box.l, ox); + for (const dy of moves(box.t, oy)) for (const dx of across) { if (!dx && !dy) return box; const moved = { l: box.l + dx, r: box.r + dx, t: box.t + dy, b: box.b + dy }; if (clear(moved)) return moved; @@ -2117,8 +2129,14 @@ function drawnGeometry(input: DrawnInput, measure: ReturnType): Ge sides = m.edges.map((e) => { const a = m.byId.get(e.from)!, b = m.byId.get(e.to)!; // One column: a turn-back on the end side (the start side in the last column, where the end is the drawing's edge). A schema of one column has no - // gutter on either side, so its turn-backs take the end side and the drawing keeps room for them there (figureTree). - if (a.col === b.col) { const side: DiagramSide = a.col === m.cols && m.cols > 1 ? "left" : "right"; return [side, side]; } + // gutter on either side, so its turn-backs take the end side and the drawing keeps room for them there (figureTree). Right to left the model's + // columns are mirrored, so the end side is the left and the last column is column 1 (1.7). + if (a.col === b.col) { + const last = m.rtl ? a.col === 1 : a.col === m.cols; + const atEnd = !(last && m.cols > 1); + const side: DiagramSide = atEnd === !m.rtl ? "right" : "left"; + return [side, side]; + } return b.col > a.col ? ["right", "left"] : ["left", "right"]; }); } else { @@ -2391,7 +2409,9 @@ function drawnGeometry(input: DrawnInput, measure: ReturnType): Ge } // Lanes in a marked gutter (1.1): none nearer a table than the zone plus radius-xs (18), centred and evenly spaced at the merged pitch or the pitch // that puts the outer lanes 18 from the tables, whichever is less: one at 30, two at 20 and 40, three at 18, 30 and 42 in the 60 gap. - const laneAt = (span: [number, number], j: number, count: number) => { + // Right to left a column gutter's lanes are counted from its right, so the lanes chosen mirror the left-to-right ones (1.7: the gutter is logical). + const laneAt = (span: [number, number], at: number, count: number, vertical = false) => { + const j = m.rtl && vertical ? count - 1 - at : at; const width = span[1] - span[0]; if (!m.marks) return span[0] + (width / (count + 1)) * (j + 1); const room = tk.foot + tk.radiusXs; @@ -2421,7 +2441,7 @@ function drawnGeometry(input: DrawnInput, measure: ReturnType): Ge // least kept (the first-fit one wins a tie). const need = needOf(cluster), beside = besideIn(cluster), n = cluster.length; const inGutter = new Set(groupsOf.flat().map(edgeOf)); - const set = (slots: number[]) => slots.forEach((l, i) => groupsOf[i]!.forEach((k) => lanes.set(k, laneAt(g.span, l, need)))); + const set = (slots: number[]) => slots.forEach((l, i) => groupsOf[i]!.forEach((k) => lanes.set(k, laneAt(g.span, l, need, g.vertical)))); let best = firstFit(cluster), bestScore = Infinity, bestLines: GLine[] | null = null; const tries: number[][] = [best]; if (need ** n <= 729) for (let code = 0; code < need ** n; code++) { @@ -2442,11 +2462,11 @@ function drawnGeometry(input: DrawnInput, measure: ReturnType): Ge const inGutter = new Set(groupsOf.flat().map(edgeOf)); let best: number[][] = groupsOf, bestScore = Infinity, bestLines: GLine[] | null = null; for (const perm of permutations(groupsOf)) { - perm.forEach((members, j) => members.forEach((k) => lanes.set(k, laneAt(g.span, j, count)))); + perm.forEach((members, j) => members.forEach((k) => lanes.set(k, laneAt(g.span, j, count, g.vertical)))); const tried = score(inGutter); if (tried.score < bestScore) { bestScore = tried.score; best = perm; bestLines = tried.lines; } } - best.forEach((members, j) => members.forEach((k) => lanes.set(k, laneAt(g.span, j, count)))); + best.forEach((members, j) => members.forEach((k) => lanes.set(k, laneAt(g.span, j, count, g.vertical)))); current = bestLines; } } @@ -2630,19 +2650,64 @@ function sequenceGeometry(input: DrawnInput, geo: Geo, sn: ReturnType, lines: GLine[], origin: DOMRect, rtl: boolean, s: Tokens["space"]): string[] { + const seatless: string[] = []; + for (const [g, el] of glabels) { + if (!el.getClientRects().length) continue; + const plate = rectOf(el, origin), gr = rectOf(g, origin); + const ls = getComputedStyle(el), gs = getComputedStyle(g); + const words = { l: plate.l + (parseFloat(ls.paddingLeft) || 0), r: plate.r - (parseFloat(ls.paddingRight) || 0) }; + const lw = words.r - words.l; + // The group's inner edges (inside its border), and where its inner end edge stops the words. + const inL = gr.l + (parseFloat(gs.borderLeftWidth) || 0), inR = gr.r - (parseFloat(gs.borderRightWidth) || 0); + // Every stroke that runs through the label's band, as its extent across. + const blocked: Array<{ l: number; r: number }> = []; + for (const l of lines) for (const [a, b] of segmentsOf(l.pts)) { + const sr = segRect(a, b, l.width); + if (sr.t < plate.b && sr.b > plate.t) blocked.push({ l: sr.l, r: sr.r }); + } + const gap = s("2-5"); + const clear = (wl: number) => blocked.every((c) => c.r <= wl - gap + 0.01 || c.l >= wl + lw + gap - 0.01); + if (clear(words.l)) continue; + // The places to try, by how far each moves the words from the start seat toward the end: just past each stroke. + const moves = blocked.map((c) => (rtl ? words.r - (c.l - gap) : c.r + gap - words.l)).filter((d) => d > 0).sort((a, b) => a - b); + const at = (d: number) => (rtl ? words.l - d : words.l + d); + const fits = (d: number) => (rtl ? at(d) >= inL + s("3") - 0.01 : at(d) + lw <= inR - s("3") + 0.01); + const d = moves.find((v) => fits(v) && clear(at(v))); + if (d === undefined) { seatless.push(el.textContent ?? ""); continue; } + el.style.setProperty("--_gx", `${Math.round(d * 100) / 100}px`); + } + return seatless; +} + function stackedGeometry(input: DrawnInput, measure: ReturnType, plan: StackPlan, grown: Record = record()): { geo: Geo; grow: Record } { const { m, tk, P, drawing, origin } = input; const s = tk.space; const map = gNodes(m, drawing, origin, P); const nodes = [...map.values()]; const ox = origin.left - Math.floor(origin.left), oy = origin.top - Math.floor(origin.top); - const sn = snapper(ox, oy); + const sn = snapper(ox, oy, Boolean(m.rtl)); const W = drawing.clientWidth, H = drawing.clientHeight; const geo: Geo = { w: W, h: H, nodes, lines: [], lifelines: [], labels: [], crossings: [], through: [], unseated: [], outside: [], ox, oy }; const growBy = record(); if (m.type === "sequence" || m.type === "schema") return { geo, grow: growBy }; + // Right to left the stack mirrors (1.7): the rail and the trunk run down the start side, which is the right, and the end lines and the gutter are + // on the left. Every place across is written from the start edge (`st`) or the end edge (`en`) and stepped toward the end (`fw`). + const rtl = Boolean(m.rtl), fw = rtl ? -1 : 1; + const st = (r: Rect) => (rtl ? r.r : r.l), en = (r: Rect) => (rtl ? r.l : r.r); + const endSide: DiagramSide = rtl ? "left" : "right"; + /** A box `width` wide that starts `gap` toward the end from `x` (`toward` 1), or ends `gap` toward the start of it (`toward` -1). */ + const across = (x: number, gap: number, width: number, toward: 1 | -1): { l: number; r: number } => { + const a = x + toward * fw * gap, b = a + toward * fw * width; + return { l: Math.min(a, b), r: Math.max(a, b) }; + }; // The end gutter is outside the spine cards, from the drawing's end less its padding (where a group's box ends too), never from a card inside a group. - const spineEnd = W - (parseFloat(getComputedStyle(drawing).paddingRight) || 0); + const dcs = getComputedStyle(drawing); + const spineEnd = rtl ? parseFloat(dcs.paddingLeft) || 0 : W - (parseFloat(dcs.paddingRight) || 0); // A fixed seat that does not fit takes a line of its own (1.13): each line of 16 the gap above its card has grown gives the seat one more // place, a line further from the card, into the room the growth made (up for a seat above a card, down for one under the card above). const lineSeats = (box: Rect, id: string, dir: 1 | -1): Rect[] => { @@ -2650,17 +2715,23 @@ function stackedGeometry(input: DrawnInput, measure: ReturnType, p for (let j = 1; j <= (own(grown, id) ?? 0); j++) out.push({ ...box, t: box.t + dir * s("4") * j, b: box.b + dir * s("4") * j }); return out; }; - // The right edge a spine card has where each card sits (the group's inside, or the drawing's less the gutter). - const columnRight = new Map(); + // The end edge a spine card has where each card sits (the group's inside, or the drawing's less the gutter). + const columnEnd = new Map(); drawing.querySelectorAll(`.${P}-node`).forEach((el) => { const parent = el.parentElement!; const pr = rectOf(parent, origin); const cs = getComputedStyle(parent); - columnRight.set(el.dataset.node!, pr.r - (parseFloat(cs.paddingRight) || 0) - (parseFloat(cs.borderRightWidth) || 0)); + columnEnd.set(el.dataset.node!, rtl ? pr.l + (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.borderLeftWidth) || 0) : pr.r - (parseFloat(cs.paddingRight) || 0) - (parseFloat(cs.borderRightWidth) || 0)); }); const order = m.nodes; const card = (i: number) => map.get(order[i]!.id)!; - // The first card of a group entered by a turn (ruling 4 on the re-check): its turn's label takes the first seat beside the turn that clears the card, a + // A stacked group's label (the diagrams-rtl ruling): measured on its start seat, so the stem that enters the group gives way to the seat, never to a + // place the label slid to on an earlier measure. + const glabels = new Map(); + drawing.querySelectorAll(`.${P}-group > .${P}-glabel`).forEach((el) => { el.style.removeProperty("--_gx"); glabels.set(el.parentElement!, el); }); + const seatOf = new Map(); + for (const [g, el] of glabels) if (el.getClientRects().length) seatOf.set(g, rectOf(el, origin)); + // The first card of a group (ruling 4 on the re-check): its turn's label takes the first seat beside the turn that clears the card, a // line at a time up into the room the group keeps for it, never above the group's edge (the group's edge and label are obstacles). const turnInto = (id: string) => { const el = drawing.querySelector(`.${P}-node[data-node="${CSS.escape(id)}"]`); const g = el?.parentElement; return Boolean(g?.matches(`.${P}-group[data-turn]`) && g.querySelector(`:scope > .${P}-node`) === el); }; const beside = (box: Rect, id: string, lh: number) => (turnInto(id) ? Array.from({ length: Math.round(lh / 16) + 1 }, (_, j) => ({ ...box, t: box.t - j * s("4"), b: box.b - j * s("4") })) : [box]); @@ -2684,7 +2755,21 @@ function stackedGeometry(input: DrawnInput, measure: ReturnType, p const pair = m.edges.map((o, j) => ({ o, j })).filter(({ o, j }) => (plan.routes[j] === "down" || plan.routes[j] === "up") && ((o.from === e.from && o.to === e.to) || (o.from === e.to && o.to === e.from))); const at = pair.findIndex((p) => p.j === k); const slot = pair.length < 2 ? 0.5 : pair.length === 2 ? (at === 0 ? 0.25 : 0.75) : (at + 1) / (pair.length + 1); - const x = sn.x(lo + (hi - lo) * slot, w); + let x = sn.x(lo + (hi - lo) * slot, w); + // A stem into a group's first card from a card outside the group gives way to the group's label (the diagrams-rtl ruling, 2): toward the end + // until its stroke is space-2-5 past the label's plate, only while it stays space-6 inside the end edge of both cards. Its label goes with it. + if (r === "down") { + const el = drawing.querySelector(`.${P}-node[data-node="${CSS.escape(e.to)}"]`); + const g = el?.parentElement; + const seat = g && g.matches(`.${P}-group`) && g.querySelector(`:scope > .${P}-node`) === el ? seatOf.get(g) : undefined; + if (seat && g && !g.contains(drawing.querySelector(`.${P}-node[data-node="${CSS.escape(e.from)}"]`))) { + const clear = s("2-5") + w / 2; + if (x > seat.l - clear && x < seat.r + clear) { + const past = rtl ? seat.l - clear : seat.r + clear; + if (rtl ? past >= lo + s("6") : past <= hi - s("6")) x = sn.x(past, w); + } + } + } pts = r === "down" ? [contour(a, "bottom", x), contour(b, "top", x)] : [contour(a, "top", x), contour(b, "bottom", x)]; if (label) { // Centred on the stem's clear shaft, with a plate; a stem split by a group's boundary takes its outside part. @@ -2703,37 +2788,44 @@ function stackedGeometry(input: DrawnInput, measure: ReturnType, p labelSeats.push({ k, cands, on: true, card: r === "down" ? e.to : e.from }); } } else if (r === "trunk" || r === "rail") { - const x = sn.x(Math.max(a.rect.l, r === "rail" ? b.rect.l : a.rect.l) + (r === "trunk" ? s("8") : s("3")), w); + // The inner of the two cards' start edges (the later one going toward the end), then space-8 (a trunk) or space-3 (a rail) toward the end. + const inner = r === "rail" ? (rtl ? Math.min(a.rect.r, b.rect.r) : Math.max(a.rect.l, b.rect.l)) : st(a.rect); + const x = sn.x(inner + fw * (r === "trunk" ? s("8") : s("3")), w); const start = contour(a, "bottom", x); if (r === "rail") { pts = [start, contour(b, "top", x)]; - if (label) { const cy = b.rect.t - s("6"); labelSeats.push({ k, cands: lineSeats({ l: x + s("2-5"), r: x + s("2-5") + lw, t: cy - lh / 2, b: cy + lh / 2 }, e.to, -1), on: false, card: e.to }); } + if (label) { const cy = b.rect.t - s("6"); labelSeats.push({ k, cands: lineSeats({ ...across(x, s("2-5"), lw, 1), t: cy - lh / 2, b: cy + lh / 2 }, e.to, -1), on: false, card: e.to }); } } else { - const ex = sn.x(b.rect.l + s("6"), w); + const ex = sn.x(st(b.rect) + fw * s("6"), w); const ty = sn.y(b.rect.t - turn, w); pts = [start, { x, y: ty }, { x: ex, y: ty }, contour(b, "top", ex)]; - if (label) labelSeats.push({ k, cands: [...beside({ l: ex + s("2-5"), r: ex + s("2-5") + lw, t: ty - lh / 2, b: ty + lh / 2 }, e.to, lh), ...lineSeats({ l: ex + s("2-5"), r: ex + s("2-5") + lw, t: ty - lh / 2, b: ty + lh / 2 }, e.to, -1).slice(1)], on: false, card: e.to }); + const seat = { ...across(ex, s("2-5"), lw, 1), t: ty - lh / 2, b: ty + lh / 2 }; + if (label) labelSeats.push({ k, cands: [...beside(seat, e.to, lh), ...lineSeats(seat, e.to, -1).slice(1)], on: false, card: e.to }); } } else { // An end line: out the end side, along the end lane or the gutter, into the card's top (down) or bottom (up), space-6 in from its end edge. - const right = Math.min(columnRight.get(e.from) ?? W, columnRight.get(e.to) ?? W); + // The nearer of the two columns' end edges. + const ce = (id: string) => columnEnd.get(id) ?? (rtl ? 0 : W); + const colEnd = rtl ? Math.max(ce(e.from), ce(e.to)) : Math.min(ce(e.from), ce(e.to)); // Lanes space-3-5 apart, one pitch (DECISIONS 306, 1.3). - const laneX = sn.x(plan.gutter ? spineEnd + (plan.lanes[k]! + 1) * s("3-5") : right - s("2-5"), w); + const laneX = sn.x(plan.gutter ? spineEnd + fw * (plan.lanes[k]! + 1) * s("3-5") : colEnd - fw * s("2-5"), w); const yExit = sn.y(a.rect.t + (a.rect.b - a.rect.t) * plan.exits[k]!, w); - const exit = contour(a, "right", yExit); + const exit = contour(a, endSide, yExit); const down = r === "end-down"; // Several end lines into one card nest (1.3): the line from the outermost lane turns lowest (the merged turn) and enters nearest the end edge // (space-6 in); each from a lane further in turns space-5 higher and enters space-3 further in. Their labels are seated space-2-5 clear of the // innermost entry, each centred on its own turn's height, taken before the half-pixel snap. const mates = m.edges.map((o, j) => ({ o, j })).filter(({ o, j }) => (plan.routes[j] === r) && o.to === e.to).sort((x, y) => plan.lanes[y.j]! - plan.lanes[x.j]! || x.j - y.j); const at = Math.max(0, mates.findIndex(({ j }) => j === k)); - const exRaw = b.rect.r - s("6") - at * s("3"), innerEx = b.rect.r - s("6") - (mates.length - 1) * s("3"); + const exRaw = en(b.rect) - fw * (s("6") + at * s("3")), innerEx = en(b.rect) - fw * (s("6") + (mates.length - 1) * s("3")); const ex = sn.x(exRaw, w); const tyRaw = down ? b.rect.t - turn - at * s("5") : b.rect.b + turn + at * s("5"); const ty = sn.y(tyRaw, w); pts = [exit, { x: laneX, y: exit.y }, { x: laneX, y: ty }, { x: ex, y: ty }, contour(b, down ? "top" : "bottom", ex)]; const into = down ? e.to : order[b.i + 1]?.id ?? e.to; - if (label) labelSeats.push({ k, cands: [...(down ? beside({ l: innerEx - s("2-5") - lw, r: innerEx - s("2-5"), t: tyRaw - lh / 2, b: tyRaw + lh / 2 }, into, lh) : [{ l: innerEx - s("2-5") - lw, r: innerEx - s("2-5"), t: tyRaw - lh / 2, b: tyRaw + lh / 2 }]), ...lineSeats({ l: innerEx - s("2-5") - lw, r: innerEx - s("2-5"), t: tyRaw - lh / 2, b: tyRaw + lh / 2 }, into, down ? -1 : 1).slice(1)], on: false, card: into }); + // Its label is on the start side of the innermost entry. + const seat = { ...across(innerEx, s("2-5"), lw, -1), t: tyRaw - lh / 2, b: tyRaw + lh / 2 }; + if (label) labelSeats.push({ k, cands: [...(down ? beside(seat, into, lh) : [seat]), ...lineSeats(seat, into, down ? -1 : 1).slice(1)], on: false, card: into }); } const snapped = snapRoute(pts, w, sn); geo.lines.push({ i: k, from: e.from, to: e.to, kind: e.kind, pts: snapped, tip: snapped[snapped.length - 1]!, dir: finish(snapped), width: w }); @@ -2743,6 +2835,7 @@ function stackedGeometry(input: DrawnInput, measure: ReturnType, p geo.outside = outsideOf(geo.lines, W, H, tk); // Seats, checked by 1.8's rule (a head counts, its own line's included): a label whose every seat fails grows the gap above its card by 16, // and the figure is measured again; measureFigure draws no lines at all if any label is still without a clean seat after the last try. + geo.seatless = slideGroupLabels(glabels, geo.lines, origin, rtl, s); const { obstacles } = obstaclesOf(drawing, origin, P, 0); obstacles.heads = geo.lines.map((l) => headBox(l, tk)); const placed: Rect[] = []; @@ -2759,7 +2852,7 @@ function stackedGeometry(input: DrawnInput, measure: ReturnType, p }; const box = seat.cands.find((c) => !bad(c)); if (!box) { growBy[seat.card] = (growBy[seat.card] ?? 0) + 1; geo.unseated.push(seat.k); } - const use = box ? wholePixels(box, ox, oy, (b) => !bad(b)) : seat.cands[0]!; + const use = box ? wholePixels(box, ox, oy, (b) => !bad(b), rtl) : seat.cands[0]!; placed.push(use); geo.labels.push({ i: seat.k, text: m.edges[seat.k]!.label!, box: use, on: seat.on }); } @@ -2992,12 +3085,15 @@ export function measureFigure(fig: HTMLElement, m: Model, P: string, base: strin if (dev && plan.third) warn?.("the stacked drawing would need a fifth end lane, so its lines are not drawn", "error"); // Dressed as where scripting is off (1.13): no line in the key, no key hint, no stops, and the list open when the figure becomes bare. const bare: Geo = { ...geo, lines: [], labels: [], crossings: [] }; + // With no lines, every group's label is on its start seat. + drawing.querySelectorAll(`.${P}-group > .${P}-glabel`).forEach((el) => el.style.removeProperty("--_gx")); const dyn = stopOf({ ...d, grow: record(), bare: true, open: current.bare ? current.open : true, autoOpen: current.bare ? current.autoOpen : current.open ? undefined : true }); // Written as it is returned: the tries above wrote a state that is not bare, and a host that sees the same state as before renders nothing, so the // figure would keep their markup (a stack with no lines, not dressed bare, its list closed: P-R3 of the code re-check). apply(dyn); return { dyn, geo: bare, ink: "", tokens: tk, least: mins.least }; } + if (geo.seatless?.length) dev && warn?.(`a stacked group's label has no clear seat on its top edge: ${geo.seatless.map((t) => `"${t}"`).join(", ")}`); if (geo.crossings.length) dev && warn?.(`${geo.crossings.length} crossing${geo.crossings.length === 1 ? "" : "s"} in the stacked drawing (each is cut): ${geo.crossings.map((c) => `${lineName(m, geo.lines[c.top]!)} over ${lineName(m, geo.lines[c.under]!)}`).join("; ")}`); return { dyn: d, geo, ink: inkHtml(P, geo, tk, base), tokens: tk, least: mins.least }; } diff --git a/packages/react/src/styles/components.css b/packages/react/src/styles/components.css index 8b6b28b..b5e44dc 100644 --- a/packages/react/src/styles/components.css +++ b/packages/react/src/styles/components.css @@ -4997,10 +4997,13 @@ /* Right to left (DECISIONS 306, 1.7): the engine lays out a mirrored model on a left-to-right grid, so the drawing is set left to right and what is in it is set right to left again; identifiers are isolated left to right as runs, never as blocks, so they keep the card's start edge. */ .basalt-diagram[data-rtl] > .basalt-diagram-drawing { direction: ltr; } + /* Stacked, the figure mirrors too (1.7): the end gutter is on the left, and a branch is indented from the right, its end lane on the left. */ + .basalt-diagram[data-rtl] > .basalt-diagram-drawing { padding: var(--_d-pad, 0 0 0 var(--_gutter, 0)); } + .basalt-diagram[data-rtl] .basalt-diagram-node[data-branch] { margin-inline: var(--_d-mi, var(--basalt-space-6) var(--basalt-space-12)); } .basalt-diagram[data-rtl] > .basalt-diagram-drawing :is(.basalt-diagram-node > :not(.basalt-diagram-mark), .basalt-diagram-lane-name, .basalt-diagram-said, .basalt-diagram-note, .basalt-diagram-band, .basalt-diagram-fhead, .basalt-diagram-felse) { direction: rtl; } .basalt-diagram[data-rtl] .basalt-diagram-gbox > .basalt-diagram-glabel { inset-inline: auto var(--basalt-space-3); } /* Stacked, a group's label is on its start side too (the sweep's 66-3), its masking margin mirrored. */ - .basalt-diagram[data-rtl] .basalt-diagram-group > .basalt-diagram-glabel { inset-inline: auto var(--basalt-space-3); margin-inline: 0 calc(-1 * var(--basalt-space-1-5)); } + .basalt-diagram[data-rtl] .basalt-diagram-group > .basalt-diagram-glabel { inset-inline: auto calc(var(--basalt-space-3) + var(--_gx, var(--basalt-space-0))); margin-inline: 0 calc(-1 * var(--basalt-space-1-5)); } /* A Mono detail is one left-to-right run in a right-to-left card (B5 of the pixel review), so its words keep their order and the card's start edge. */ .basalt-diagram[data-rtl] .basalt-diagram-runs { direction: ltr; unicode-bidi: isolate; } /* A frame's header, its else row and its rule are set right to left, so their place across the mirrored grid is measured from the frame's end edge in @@ -5177,6 +5180,9 @@ .basalt-diagram-group > .basalt-diagram-glabel { --_d-gl: var(--_drawn) none; display: var(--_d-gl, block); } /* Stacked, a group's label sits on a ground plate over the lines, so a line that crosses it stops either side (DECISIONS 306, 1.3). */ .basalt-diagram-group > .basalt-diagram-glabel { z-index: 1; margin-inline-start: calc(-1 * var(--basalt-space-1-5)); padding-inline: var(--basalt-space-1-5); background: var(--_ground); } + /* A line through the label's band moves it along the top edge, toward the end, to the first place clear of every line (the diagrams-rtl ruling): the engine + writes how far as --_gx. Its plate stays for the last resort, where no place is clear. */ + .basalt-diagram-group > .basalt-diagram-glabel { inset-inline-start: calc(var(--basalt-space-3) + var(--_gx, var(--basalt-space-0))); } .basalt-diagram-gbox { --_d-gb: var(--_drawn) block; position: relative; diff --git a/packages/react/test/diagram-rtl.test.mjs b/packages/react/test/diagram-rtl.test.mjs new file mode 100644 index 0000000..04716be --- /dev/null +++ b/packages/react/test/diagram-rtl.test.mjs @@ -0,0 +1,283 @@ +// Right to left, the diagram gaps left after batch B (DECISIONS 306, 1.7: "every start side and end side choice in the engine is logical"). The stacked +// figure mirrors (its rail, trunk, branches, end lines and end gutter), and the drawn schema's turn-backs and gutter lanes are chosen from the end side, +// so CIMIP's automatic schema draws right to left what it draws left to right. A stacked group's label gives way to the lines at its top edge (Fable's +// ruling, diagrams-rtl/ruling.md), and an author's strings are isolated, so a closing quote stays at the end. In Chromium against the built package. +// Written while browser tests were paused (DECISIONS 330 and 359): not yet run. +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import * as esbuild from "esbuild"; + +import { inspectSource } from "./diagram-geometry.mjs"; +import { fixturePage, launch, pkg } from "./support.mjs"; + +const B = JSON.parse(fs.readFileSync(path.join(pkg, "test", "fixtures", "cimip-diagrams-b.json"), "utf8")); +const P = "basalt-diagram"; +const font = (file) => fs.readFileSync(path.join(pkg, "dist", "fonts", file)).toString("base64"); +const FONTS = `@font-face{font-family:"Geist";src:url(data:font/woff2;base64,${font("Geist-Variable.woff2")}) format("woff2");font-weight:100 900}@font-face{font-family:"Geist Mono";src:url(data:font/woff2;base64,${font("GeistMono-Variable.woff2")}) format("woff2");font-weight:100 900}`; +const PAGE = `${FONTS} body{background:var(--basalt-surface-page);margin:0;padding:16px;box-sizing:border-box} #root{max-width:1104px;margin:0 auto}`; + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const HOST = ` +const C = { architecture: B.ArchitectureDiagram, flowchart: B.FlowchartDiagram, "data-flow": B.DataFlowDiagram, sequence: B.SequenceDiagram, schema: B.SchemaDiagram }; +function Host() { + const [list, setList] = React.useState([]); + window.__set = (next) => flushSync(() => setList(next)); + return
{list.map(({ key, spec, dir }) => { const { type, ...props } = spec; const X = C[type]; return
; })}
; +} +createRoot(document.getElementById("root")).render();`; + +const frames = (page, n = 3) => page.evaluate((n) => new Promise((resolve) => { let k = 0; const step = () => (++k >= n ? resolve() : requestAnimationFrame(step)); requestAnimationFrame(step); }), n); +async function rtlPage({ theme = "dark", width = 1440, dev = false } = {}) { + const { page, errors } = await fixturePage(browser, "", { theme, viewport: { width, height: 900 }, standards: true }); + const built = await esbuild.build({ + stdin: { contents: `import * as React from "react"; import { createRoot } from "react-dom/client"; import { flushSync } from "react-dom"; import * as B from "./dist/index.js"; ${HOST}`, resolveDir: pkg, loader: "tsx" }, + bundle: true, format: "iife", write: false, jsx: "automatic", platform: "browser", logLevel: "silent", define: { "process.env.NODE_ENV": dev ? '"development"' : '"production"' }, + }); + const warnings = []; + page.on("console", (m) => { if (m.type() === "warning" || m.type() === "error") warnings.push(m.text()); }); + await page.addScriptTag({ content: built.outputFiles[0].text }); + await page.addStyleTag({ content: PAGE }); + await page.evaluate(() => document.fonts.ready); + return { page, errors, warnings }; +} +const draw = async (page, items) => { await page.evaluate((items) => window.__set(items), items); await page.waitForFunction((n) => document.querySelectorAll(".basalt-diagram[data-layout]").length >= n, items.length); await frames(page, 5); }; +const inspect = (page, key) => page.evaluate(`${inspectSource()}("${P}", "#fig-${key}")`); + +/** A figure's drawing as numbers: its width, each card's and label's box and each line's path, read from the page. */ +const shape = (page, key) => page.evaluate(({ P, key }) => { + const d = document.querySelector(`#fig-${key} .${P}-drawing`); + const o = d.getBoundingClientRect(); + const box = (el) => { const r = el.getBoundingClientRect(); return [r.left - o.left, r.top - o.top, r.right - o.left, r.bottom - o.top]; }; + const cs = getComputedStyle(d); + return { + w: o.width, + pad: [parseFloat(cs.paddingLeft), parseFloat(cs.paddingRight)], + nodes: [...d.querySelectorAll(`.${P}-node`)].map((el) => [el.dataset.node, ...box(el)]), + labels: [...d.querySelectorAll(`.${P}-label`)].map((el) => [el.textContent, ...box(el)]), + paths: [...d.querySelectorAll(`.${P}-edge`)].map((g) => [`${g.dataset.from}>${g.dataset.to}`, (g.querySelector(`.${P}-line`).getAttribute("d").match(/-?[\d.]+/g) ?? []).map(Number)]), + }; +}, { P, key }); + +/** The largest distance between a left-to-right drawing and a right-to-left one mirrored, over every card, label and line point. */ +function mirrorError(ltr, rtl) { + assert.equal(ltr.w, rtl.w); + const W = rtl.w; + const mirror = ([, l, t, r, b]) => [W - r, t, W - l, b]; + let most = 0; + const where = []; + const note = (what, d) => { if (d > most) most = d; if (d > 0.6) where.push(`${what} ${d.toFixed(2)}`); }; + assert.deepEqual(rtl.nodes.map((n) => n[0]), ltr.nodes.map((n) => n[0])); + ltr.nodes.forEach((n, i) => note(`card ${n[0]}`, Math.max(...mirror(rtl.nodes[i]).map((v, j) => Math.abs(v - n[j + 1]))))); + assert.deepEqual(rtl.labels.map((l) => l[0]), ltr.labels.map((l) => l[0])); + ltr.labels.forEach((l, i) => note(`label ${l[0]}`, Math.max(...mirror(rtl.labels[i]).map((v, j) => Math.abs(v - l[j + 1]))))); + ltr.paths.forEach(([name, a], i) => { + const b = rtl.paths[i][1]; + assert.equal(b.length, a.length, `${name} has as many points right to left`); + for (let j = 0; j < a.length; j += 2) note(`line ${name}`, Math.max(Math.abs(a[j] - (W - b[j])), Math.abs(a[j + 1] - b[j + 1]))); + }); + return { most, where }; +} + +describe("right to left, the stacked figure mirrors (1.7)", () => { + for (const key of ["architecture", "autoArchitecture", "dataFlow"]) test(`${key} at 390: the right-to-left stack is the left-to-right one mirrored, to the half pixel`, async () => { + const { page, errors } = await rtlPage({ width: 390 }); + await draw(page, [{ key: "ltr", spec: B[key], dir: "ltr" }, { key: "rtl", spec: B[key], dir: "rtl" }]); + for (const k of ["ltr", "rtl"]) { + assert.equal(await page.locator(`#fig-${k}`).getAttribute("data-layout"), "stacked", `${key} stacks at 390 (${k})`); + assert.deepEqual((await inspect(page, k)).problems, [], `${key} (${k})`); + } + const a = await shape(page, "ltr"), b = await shape(page, "rtl"); + // The end gutter is on the end side: the right's padding left to right is the left's right to left. + assert.deepEqual(b.pad, [a.pad[1], a.pad[0]], `${key}: the gutter is on the left right to left`); + const { where } = mirrorError(a, b); + assert.deepEqual(where, [], `${key}: right to left mirrors left to right`); + assert.deepEqual(errors, []); + await page.close(); + }); + + test("a branch is indented from the right and keeps its end lane on the left", async () => { + const { page } = await rtlPage({ width: 390 }); + await draw(page, [{ key: "ltr", spec: B.architecture, dir: "ltr" }, { key: "rtl", spec: B.architecture, dir: "rtl" }]); + const margins = (k) => page.evaluate(({ P, k }) => [...document.querySelectorAll(`#fig-${k} .${P}-node[data-branch]`)].map((el) => { const s = getComputedStyle(el); return [parseFloat(s.marginLeft), parseFloat(s.marginRight)]; }), { P, k }); + const a = await margins("ltr"), b = await margins("rtl"); + assert.ok(a.length > 0, "the architecture has branches"); + for (const [i, [l, r]] of a.entries()) { + assert.ok(l > r, "left to right, a branch is indented from the left"); + assert.deepEqual(b[i], [r, l], "right to left, from the right"); + } + await page.close(); + }); + + test("the trunk and the rail run down the right, the end lines out of the left", async () => { + const { page } = await rtlPage({ width: 390 }); + await draw(page, [{ key: "rtl", spec: B.architecture, dir: "rtl" }]); + const s = await shape(page, "rtl"); + const card = new Map(s.nodes.map(([id, l, t, r, b]) => [id, { l, t, r, b }])); + // A line from the service down to a branch leaves the service's bottom in its right half; ECS's line to the sandbox leaves ECS's left side. + const svc = card.get("svc"); + for (const [name, pts] of s.paths) { + if (name === "svc>aurora" || name === "svc>s3") assert.ok(pts[0] > (svc.l + svc.r) / 2, `${name} leaves the service's start (right) half`); + if (name === "ecs>agent") assert.ok(Math.abs(pts[0] - card.get("ecs").l) < 1.5, `${name} leaves ECS's end (left) side`); + } + await page.close(); + }); +}); + +describe("right to left, the drawn schema (DECISIONS 322, item 3 of 'Already decided, not built')", () => { + test("CIMIP's automatic schema draws the same lanes and crossings right to left as left to right, with no tight gutter", async () => { + const { page, warnings } = await rtlPage({ dev: true }); + await draw(page, [{ key: "ltr", spec: B.autoSchema, dir: "ltr" }]); + const ltrWarnings = warnings.splice(0); + await draw(page, [{ key: "rtl", spec: B.autoSchema, dir: "rtl" }]); + const rtlWarnings = warnings.splice(0); + assert.ok(!rtlWarnings.some((w) => /a gutter holds \d+ lanes side by side/.test(w)), rtlWarnings.join("\n")); + const crossings = (list) => Number(list.join("\n").match(/(\d+) crossings? in the drawn layout/)?.[1] ?? 0); + assert.equal(crossings(rtlWarnings), crossings(ltrWarnings), `${rtlWarnings.join("\n")}\n---\n${ltrWarnings.join("\n")}`); + await draw(page, [{ key: "ltr", spec: B.autoSchema, dir: "ltr" }, { key: "rtl", spec: B.autoSchema, dir: "rtl" }]); + assert.equal(await page.locator("#fig-rtl").getAttribute("data-layout"), "drawn"); + // The drawn layout snaps on the page's half pixels as left to right, so a mirrored point may be a pixel off; a lane chosen differently is 20 or more. + const { most } = mirrorError(await shape(page, "ltr"), await shape(page, "rtl")); + assert.ok(most <= 1.01, `right to left mirrors left to right to a pixel (${most})`); + await page.close(); + }); + + test("a schema of one column takes its turn-backs on the end side, the left, and keeps its room there", async () => { + const table = (name, row, refs = []) => ({ name, col: 1, row, columns: [{ name: "id", key: "PK" }, ...refs.map((r) => ({ name: `${r}_id`, key: "FK", references: `${r}.id` }))] }); + const spec = { type: "schema", title: "One column", summary: "b references c and c references a.", legend: { plain: "A foreign key" }, tables: [table("a", 1), table("b", 2, ["c"]), table("c", 3, ["a"])] }; + const { page } = await rtlPage(); + await draw(page, [{ key: "ltr", spec, dir: "ltr" }, { key: "rtl", spec, dir: "rtl" }]); + const a = await shape(page, "ltr"), b = await shape(page, "rtl"); + for (const [k, s] of [["ltr", a], ["rtl", b]]) { + assert.equal(await page.locator(`#fig-${k}`).getAttribute("data-layout"), "drawn", k); + const left = Math.min(...s.nodes.map((n) => n[1])), right = Math.max(...s.nodes.map((n) => n[3])); + for (const [name, pts] of s.paths) { + const xs = pts.filter((_, j) => j % 2 === 0); + if (k === "ltr") assert.ok(Math.max(...xs) > right, `${name} turns back on the right left to right`); + else assert.ok(Math.min(...xs) < left, `${name} turns back on the left right to left`); + } + } + assert.deepEqual(b.pad, [a.pad[1], a.pad[0]], "the turn-backs' room is on the left right to left"); + await page.close(); + }); +}); + +/** Each stacked group label's words, its plate, and every line's stroke that runs through the plate's band, in the drawing's coordinates. */ +const groupLabels = (page, key) => page.evaluate(({ P, key }) => { + const d = document.querySelector(`#fig-${key} .${P}-drawing`); + const o = d.getBoundingClientRect(); + const R = (r) => ({ l: r.left - o.left, t: r.top - o.top, r: r.right - o.left, b: r.bottom - o.top }); + const lines = [...d.querySelectorAll(`.${P}-edge`)].map((g) => { + const path = g.querySelector(`.${P}-line`); + const n = (path.getAttribute("d").match(/-?[\d.]+/g) ?? []).map(Number); + const pts = []; for (let j = 0; j < n.length; j += 2) pts.push({ x: n[j], y: n[j + 1] }); + return { name: `${g.dataset.from}>${g.dataset.to}`, pts, w: parseFloat(getComputedStyle(path).strokeWidth) }; + }); + return [...d.querySelectorAll(`.${P}-group > .${P}-glabel`)].map((el) => { + const range = document.createRange(); range.selectNodeContents(el); + const words = R(range.getBoundingClientRect()), plate = R(el.getBoundingClientRect()), group = R(el.parentElement.getBoundingClientRect()); + const through = []; + for (const l of lines) for (let k = 1; k < l.pts.length; k++) { + const a = l.pts[k - 1], b = l.pts[k]; + const s = { l: Math.min(a.x, b.x) - l.w / 2, r: Math.max(a.x, b.x) + l.w / 2, t: Math.min(a.y, b.y) - l.w / 2, b: Math.max(a.y, b.y) + l.w / 2 }; + if (s.t < plate.b && s.b > plate.t) through.push({ name: l.name, l: s.l, r: s.r }); + } + return { text: el.textContent, words, plate, group, through, gx: el.style.getPropertyValue("--_gx") }; + }); +}, { P, key }); +/** The gap between a label's words and the nearest stroke through its band (Infinity with none). */ +const nearest = (g, box = g.words) => Math.min(Infinity, ...g.through.map((c) => Math.max(c.l - box.r, box.l - c.r))); + +describe("a stacked group's label gives way to the lines at its top edge (the diagrams-rtl ruling)", () => { + for (const width of [320, 390]) for (const dir of ["ltr", "rtl"]) test(`${width} ${dir}: no line runs under either label; each keeps space-2-5 from every stroke through its band, on the start side`, async () => { + const { page, warnings } = await rtlPage({ width, dev: true }); + await draw(page, [{ key: "arch", spec: B.architecture, dir }]); + assert.equal(await page.locator("#fig-arch").getAttribute("data-layout"), "stacked"); + const labels = await groupLabels(page, "arch"); + assert.deepEqual(labels.map((g) => g.text), ["AWS · your account", "Data & logs"]); + for (const g of labels) { + assert.ok(nearest(g) >= 10 - 0.05, `${g.text}: its words are space-2-5 from every stroke (${nearest(g)}) ${JSON.stringify(g.through)}`); + // On the start side of its group, and at least space-3 inside the group's inner end edge. + const room = dir === "ltr" ? g.group.r - 1 - g.words.r : g.words.l - (g.group.l + 1); + assert.ok(room >= 12 - 0.05, `${g.text}: space-3 inside the end edge (${room})`); + } + // "Data & logs" sits past the trunk and the rail that pass down its group's start side: it has slid, toward the end. + const data = labels[1]; + assert.ok(parseFloat(data.gx) > 0, "the inner group's label slid"); + assert.ok(!warnings.some((w) => /no clear seat on its top edge/.test(w)), warnings.join("\n")); + await page.close(); + }); + + test("the stem into the group's first card moves only where it would run under the label: at 320 it stands space-2-5 past the plate, at 390 it keeps the middle", async () => { + for (const dir of ["ltr", "rtl"]) { + const at = {}; + for (const width of [320, 390]) { + const { page } = await rtlPage({ width }); + await draw(page, [{ key: "arch", spec: B.architecture, dir }]); + const s = await shape(page, "arch"); + const card = new Map(s.nodes.map(([id, l, t, r, b]) => [id, { l, t, r, b }])); + const stem = s.paths.find(([name]) => name === "browser>alb")[1]; + const [aws] = await groupLabels(page, "arch"); + const lo = Math.max(card.get("browser").l, card.get("alb").l), hi = Math.min(card.get("browser").r, card.get("alb").r); + at[width] = { x: stem[0], middle: (lo + hi) / 2, plate: aws.plate, words: aws.words, gx: aws.gx }; + await page.close(); + } + // 390: 35 clear in the middle, so it does not move, and the label keeps its seat. + assert.ok(Math.abs(at[390].x - at[390].middle) <= 1, `${dir} 390: the stem keeps its slot ${JSON.stringify(at[390])}`); + assert.equal(at[390].gx, "", `${dir} 390: the label keeps its seat`); + // 320: the stem's 2px stroke is space-2-5 past the plate, toward the end (16 from the words), and the label keeps its start seat. + const past = dir === "ltr" ? at[320].x - 1 - at[320].plate.r : at[320].plate.l - (at[320].x + 1); + assert.ok(past >= 10 - 0.5 && past <= 11.5, `${dir} 320: the stem stands space-2-5 past the plate (${past})`); + assert.equal(at[320].gx, "", `${dir} 320: the label keeps its seat`); + } + }); + + test("last resort: a label with no clear place keeps its start seat on its plate, and a development build warns", async () => { + const spec = { + type: "architecture", title: "A group label too long to seat", legend: { main: "Request" }, + // The stem from Client into Edge runs under the label's middle and cannot move past its end; the label cannot slide past the stem and still end + // space-3 inside the group. + nodes: [{ id: "a", name: "Client", col: 1, row: 1 }, { id: "b", name: "Edge", group: "g", col: 1, row: 2 }, { id: "c", name: "Service", group: "g", col: 1, row: 3 }], + groups: [{ id: "g", label: "A group label long enough to cross its stem" }], + edges: [{ from: "a", to: "b", kind: "main" }, { from: "b", to: "c", kind: "main" }], + }; + for (const dir of ["ltr", "rtl"]) { + const { page, warnings } = await rtlPage({ width: 390, dev: true }); + await draw(page, [{ key: "long", spec, dir }]); + assert.equal(await page.locator("#fig-long").getAttribute("data-layout"), "stacked"); + const [g] = await groupLabels(page, "long"); + assert.equal(g.gx, "", `${dir}: the label keeps its start seat`); + assert.ok(g.through.length > 0, `${dir}: a line still runs through its band, under its plate`); + assert.ok(warnings.some((w) => /a stacked group's label has no clear seat on its top edge/.test(w)), `${dir}: ${warnings.join("\n")}`); + await page.close(); + } + }); +}); + +describe("an author's strings are isolated (the diagrams-rtl ruling, the closing quote)", () => { + test(`right to left, the source line 'docs/architecture.md, "The shape"' ends in its quote`, async () => { + const { page } = await rtlPage({ width: 1440 }); + await draw(page, [{ key: "arch", spec: B.architecture, dir: "rtl" }]); + const read = await page.evaluate((P) => { + const p = document.querySelector(`#fig-arch .${P}-source`); + const bdi = p.querySelector(":scope > bdi"); + const text = bdi?.firstChild; + const rect = (from, to) => { const r = document.createRange(); r.setStart(text, from); r.setEnd(text, to); return r.getBoundingClientRect(); }; + const s = text.textContent; + return { s, last: rect(s.length - 1, s.length), shape: rect(s.lastIndexOf("shape"), s.lastIndexOf("shape") + 5), first: rect(0, 1) }; + }, P); + assert.equal(read.s, 'docs/architecture.md, "The shape"'); + // The words keep their own order inside the right-to-left figure: the quote is drawn after "shape", at the run's right, and "docs" starts it. + assert.ok(read.last.left >= read.shape.right - 0.5, JSON.stringify(read)); + assert.ok(read.first.left < read.shape.left, JSON.stringify(read)); + // The title, a group's label, a card's kind and name are isolates too. + const isolated = await page.evaluate((P) => [`.${P}-title`, `.${P}-gbox > .${P}-glabel`, `.${P}-group > .${P}-glabel`, `.${P}-kind`, `.${P}-node:not([data-link]) .${P}-name`].map((sel) => Boolean(document.querySelector(`#fig-arch ${sel}`)?.querySelector(":scope > bdi"))), P); + assert.deepEqual(isolated, [true, true, true, true, true]); + await page.close(); + }); +}); diff --git a/packages/react/test/export-sizes.json b/packages/react/test/export-sizes.json index 0dad096..58b75ca 100644 --- a/packages/react/test/export-sizes.json +++ b/packages/react/test/export-sizes.json @@ -18,7 +18,7 @@ "AppHeader": 1285, "AppShell": 104323, "AppTile": 1112, - "ArchitectureDiagram": 101300, + "ArchitectureDiagram": 103233, "ArrowDownGlyph": 2868, "ArrowLeftGlyph": 2869, "ArrowRightGlyph": 2859, @@ -70,7 +70,7 @@ "CopyGlyph": 2884, "Countdown": 3016, "CoverageStrip": 1570, - "DataFlowDiagram": 101243, + "DataFlowDiagram": 103178, "DateAge": 2527, "DescriptionColumns": 216, "DescriptionItem": 593, @@ -105,7 +105,7 @@ "Fieldset": 6390, "FilterResult": 698, "FilterToolbar": 774, - "FlowchartDiagram": 101264, + "FlowchartDiagram": 103199, "Form": 8730, "FormGrid": 438, "FormGridItem": 628, @@ -232,7 +232,7 @@ "STAGE_WORDS": 149, "STATUS_MESSAGE_MS": 26, "SandboxesGlyph": 2963, - "SchemaDiagram": 101212, + "SchemaDiagram": 103147, "SearchDialog": 89496, "SearchField": 18488, "SearchGlyph": 3181, @@ -251,7 +251,7 @@ "SelectableList": 821, "SelectionBar": 25913, "Separator": 4531, - "SequenceDiagram": 101240, + "SequenceDiagram": 103175, "SettingsGlyph": 3100, "ShareBar": 1411, "Sheet": 70793, @@ -433,11 +433,11 @@ } }, "package": { - "bytes": 948167, - "gzip": 316004 + "bytes": 950108, + "gzip": 316804 }, "styles": { - "bytes": 468713, - "gzip": 60543 + "bytes": 469113, + "gzip": 60589 } } diff --git a/tools/html-skill/src/modules.json b/tools/html-skill/src/modules.json index 4752626..65b09d0 100644 --- a/tools/html-skill/src/modules.json +++ b/tools/html-skill/src/modules.json @@ -1,5 +1,5 @@ { - "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800. Raised in diagram batch B's fix round (DECISIONS 318, the owner's diagram raise; and 326's sweep), each to its measured size: diagram 137700 to 144100 (the two reviews' fixes in the shared engine: right to left frames and self-calls, the corridors' and lanes' development words, the unusable-placement check, the transcript's hanging lines, the text art's frame widening, the frame-side fit check, the sequence's layers, the stacked group's turn room), diagram-motion 28450 to 30450 (the text sequence's build by ink and its colour-only run, moved into the motion module), diagram-zoom 17000 to 17600 (a linked card closes the viewer; the text art's own width; a placed model for the key hint), diagram-export 7850 to 10450 (an export at rest: sized drawing SVGs, no reveal masks, the pseudo-element rules, the lines under the cards, a viewer's figure read at 100% with its head and key, the rim's lit top). Raised at the batch B re-check (the decider's four rulings): diagram 144100 to 145100 (5.1's first list reported as errors apart from the warnings, a turn's label lines on the group entered by it and the seats beside its turn, the bare stack applied, the text art's reset of the core's inline code chip). Merging main (#127 and #128) into diagram batch B: skillMd keeps main's 12800 (batch B had raised it to 12950 for its diagram lines); SKILL.md was tightened in its wording to stay within it, no rule dropped; core takes main's 35550.Raised in the repo review (23 Nov 2026; budgets are soft, the owner's word): notifications 12450 to 12700 (a link is written only when relative, http, https or mailto, and side and align are checked before they reach the markup), combobox 11200 to 11350 (a disabled field's hidden input is disabled too, now and later), tooltip 3200 to 3550 (the gap to the opener is the tooltip's own, and hover and keyboard focus each hold it open; WCAG 1.4.13), chart 34750 to 34800 (the scale's step search and gridlines are bounded, so extreme values cannot hang the page), spinner 650 to 720 (its held rule moved in from loops, so a ring-only page keeps a stored hold), kbd 2900 to 2950, palette 11400 to 11500 (and its usage text 1350 to 1400, for the Mod line) and toast 16050 to 16200 (Mod in a palette item's keys is bound as it is drawn, and a toast action's aria-keyshortcuts resolves Mod). The safe-sinks rule (decided by the owner, Fable, Astra and Muse, 23 Nov 2026): skillMd 12650 to 12900, and 13050 with main's own raise merged in (one line: data goes in as textContent, a link passes Basalt.safeHref, an option comes from a fixed list), core 35400 to 35650, and 35800 with main's own raise merged in, and its usage 2950 to 3200 (one safeHref, published as Basalt.safeHref, and _.pick, in place of a copy in each module; esc escapes the apostrophe), link-tabs 5750 to 5900 (a refused link dispatches no event), diagram 92650 to 93000 (a card's mark is a relative path, https or a data: image). Merging #129 into diagram batch B: diagram keeps batch B's 145100 plus #129's mark check, set to its measure, and batch B's usage 4600. The fix round after both reviews of 421348e8 sets them to the measured sizes again: core 38950 to 39600 (every room says all three forms, and a hung word's box grows by a short room's shortfall), search to 5700 (it places its top again on a resize and with the keyboard; an empty list holds no padding), command-list to 14700 (it keeps the taller of its two heights), notifications to 12950 (the bell's edge), pane to 1950 (the page column's room), chart to 34950 (the date line's reason), and code, diagram-zoom, filter, links, sheet, still-table, tab-bar and topbar each by under 150 bytes (the three forms of a room; the selection column's width however given). Merged with main at db0bc418 (#129 to #131), DECISIONS 336's caps are set to the measured sizes again: core 35800 to 38950 and its usage 3200 to 3650, toast 16200 to 16750, terminal to 12700 (13050 with the open items' ruling: both copy buttons draw their three glyphs once, so a refused copy shows the close with no markup written after), diagram-zoom 17600 to 17750 (its viewer's Close and Zoom out hung, and the foot's room). Raised in DECISIONS 336 (reserved room across every component, claude/reserved-room), each to its measured size: core 35550 to 38700 (the edge rule a ghost .btn hangs by at a head, its ring and touch hit area, the side insets by direction, the .panel-head and page section-head that hang their last button by themselves) and its usage 2950 to 3450 (how data-edge and --basalt-edge-room are written); search 4400 to 5200 (search.js, the held top), terminal 11950 to 12550 (the close glyph for a refused copy, the edge on both copies), links 2750 to 3300 (the first icon link hung, the card room, the 20px glyph), toast 16050 to 16650 (the 46px hit areas on touch), selection 1500 to 1650 and still-table 14650 to 15000 (the 44px select column), command-list 14000 to 14350 (the panel hugs, the room is page), menu 8950 to 9150 (the column every row keeps when any row has a check or a glyph), notifications 12450 to 12600, filter 17500 to 17600, forms 3500 to 3550, sheet 5400 to 5450, topbar-nav 7550 to 7600 and app-shell 5200 to 5250 (logical sides, the edge and the room); topbar's usage 3100 to 3200 (a bar's last ghost control takes data-edge); command-list's usage 2150 to 2300 (the panel hugs; the room is page, and only on the page); dialog-form's usage 1300 to 1350 (its Close is written data-icon-only data-edge=\"end\"). Raised in the polish ruling of 336 (the selection box keeps to the cell's line): selection 1650 to 1750 (the box's start margin, min(space-4, half the spare room): 1710 measured) and its usage 1150 to 1350 (the rule's sentence: 1313 measured). Merging main (#130, #131) into claude/diagram-interop: diagram usage 4600 to 4850 (+5.4%: Batch B's diagram usage plus the basalt-diagram-export rule line, measured 4806), then 4850 to 5050 (noting that .lucid is for Lucid's REST API only and to use .vsdx in Lucid's UI, measured 4999).", + "$comment": "Which parts of the skill's CSS and JS a page gets. The core is always in. A module is in when the page's body has one of its classes, attributes or tags, matches one of its text patterns, or is named in a comment, and when another module needs it (requires). Modules are added in the order listed here, which is the order of the source files' cascade. classes: every class the module's CSS styles (the test checks them against the CSS and against SKILL.md). budget: the most bytes its minified CSS and JS may reach together. budgets: skillMd (SKILL.md, the context an agent pays: never above what it was), core (the CSS and JS of every page). icons: Phosphor names the module's script draws itself. Raised in the first parity PR (the owner's \"bring up the parity\"): forms (the number-input, search-clear and file-input chrome), disclosure (the native details marker), status (the accent reader and the forced-colours badge border), spinner (a fixed 16px ring), and the new number, range and accent modules. skillMd rose 10555 to 10900 for the new rules (number field, native chrome, the braille rule, the accent). Raised in the second parity PR (popup rows, levels and the segment's pill): segment 1400 to 3700 (the shared sliding pill: its script, 1.5 KB, and its CSS with the pill's two fallbacks), rows 3600 to 4300 (#27's plate-in-a-row geometry, the plate per level, the glide's shared plate and the forced-colours lit row, net of the removed bar), palette 9400 to 11300 (the glide's script, 2.4 KB: it follows the lit row, travels on a pointer, snaps on a key, and fades in place on leaving). The art module (DECISIONS 101 and 104) is the token groups only some pages name, taken out of the core so the core stays under its cap: the chart roles and lengths, the art colours, the aspect ratios and the stage headroom, in both themes (2087 bytes at 2100; it grows only when a token of those groups is added). A page gets it when its body names one of them, a var() in its own style included. The every-module page has no cap of its own (owner, DECISIONS 79): each part is capped, and a page carries only the parts it uses. usage: the most bytes of a module's usage text (src/usage/NAME.md; core.usage for core.md), which compose.mjs --usage prints on demand. It is context an agent pays only for the modules its page uses, so it is capped per part as SKILL.md and the CSS and script are (DECISIONS 79 and 109). Each is set a little above what its text was when the usage moved out of SKILL.md (DECISIONS 109); raising one needs a reason in the PR, and a rise of 40 to 50% is the owner's. textWords: each text pattern said in words, which compose.mjs --usage prints instead of the regular expression (one for each entry of text, in order). builds: modules a module requires whose markup its script writes, so --usage prints a line saying so instead of their usage text (the palette builds its own rows and key chips). The council's clarity check of the usage texts (all three: not yet clear) raised eight caps because the texts gained what an agent had to guess: callout 200 to 700 (the icon and one wrapper div around the title and body as markup, the four status icons, the role React's Callout renders), palette 1100 to 1300 (an item shown whole, keys as an array, keywords), stats 450 to 800 (a snippet of the figures and of the dl), tabs 500 to 650 (the unselected panels), code 250 to 450 (the markup and what each token class means), segment 150 to 300 (a click does not switch it), progress 150 to 350 (the empty span that paints the fill), theme 250 to 400 (leave the button empty), and accent 250 to 300. Topbar went down, 700 to 500, as its build detail was cut. Raised in the usage PR (the council's clarity check): palette 11300 to 11450 (the module grew 11283 to 11448, +165, about 1.5%), for the guard that makes a string `keys` warn and draw no chip instead of throwing in `keys.filter`, which the palette's usage already promised. Round 2 of the clarity check: tabs 650 to 750 (the panel's top space shown in the snippet, and that the script selects a tab on click). Raised in the site-icons and status PR (skill-parity part A, DECISIONS 106 and 107): status 1650 to 1900 (the neutral, pending and running marks, the badge's real border, and the forced-colours disc, net of the red danger word it drops) and its usage 400 to 1000 (every status in words, the word alone, running, forced colours); rows 4300 to 4450 (the profile list's seat rule and the status parts on a lit row) and its usage 300 to 600 (the profile list, with the one mistake: never an empty element for the seat). New: the links module (2671 bytes: the social row, the new-tab arrow's CSS and the script that draws it; budget 2750) and its usage (1746 bytes; cap 1850), which carries the social link, the glyph set, icon only and the new tab. Dropping Regular halves icons.json. Added in the overlay PR (skill-parity-4, batch 7 step 2, DECISIONS 108): the shared plate leaves palette.js for a glide module (the palette, a menu and the notification centre all call it), so the palette's cap went down, 11450 to 9250, and rows 4450 to 3850 (the plate's CSS moved to glide); and the overlay layer comes in as seven modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: popover (the native popup shell), menu, dialog (the dialog and alert dialog), sheet (on every side, the top one the site header's narrow menu), tooltip, toast and notifications (the centre). skillMd is unchanged in its cap (the eight new index lines fit within it); the core is unchanged in bytes. Added in the figures and charts PR (skill-parity-5, batch 7 step 3, DECISIONS 108): four modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: meter (React's Meter, CSS only, 2581 bytes), dlist (the description list, CSS only, 1265), terminal (the code block's transcript: its CSS, 3242, and the script that draws the gutter, the copy button and the replay, 4824) and chart (React's TimeChart and ChartGroup: 7313 of CSS and 23262 of script, which port chart.tsx's scale, layout, lane, labels, sentences, keyboard and table; it needs the art tokens, the table and the kbd chips, and a page without a chart carries none of it). Stats grew for the source line (budget 700 to 850, 798 bytes; its usage 800 to 950, 675 to 899 bytes, +33%, under the owner's 40 to 50%). skillMd is unchanged in its cap (four index lines fit within it); the core is unchanged in bytes. Added in the forms and selection PR (skill-parity-6, batch 7 step 4, DECISIONS 108): six modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: select (React's Select: the native select's closed trigger in every browser and, where `appearance: base-select` is shipped, the styled list with its two-line rows; a small script that says which input lit a row, 7740 bytes before it, choice (Checkbox, Radio, RadioGroup and Switch as styled native inputs; CSS only, with the first-frame rule), choice-card (ChoiceCard; CSS only), toggle (the pressed toggle's plate and check seat on .btn; CSS only), selection (a table's checkbox column: its fixed width and the script that sets aria-selected, the mixed header box and the count) and loops (the page-level hold on every loop with its switch: the held look and the script that stores it). The select's styles left forms, whose budget fell 3650 to 3250. skillMd rose 8621 to the size of its six new index lines, within its cap; the core is unchanged in bytes; compose adds the stored-hold line to the head of a page that has the loops module. Revised in the same PR (the lead's review of the build): the select gains select.js (one row is lit at a time, by whichever of the pointer and the keys moved last), and choice, toggle, selection and loops carry the first-frame rule, so a state a script sets on load (a mixed header box, the stored hold) paints at once with no crossfade. Added in the navigation and layout PR (skill-parity-7, batch 7 step 5, DECISIONS 108): five modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: glyph (Basalt's core glyphs drawn by name, at rest and selected, from a table the build works out from the drawn set; a page carries only the glyphs it names, and the drawing of a core glyph from data-glyph left the sheet module, which draws none now), nav (React's Nav: the sidebar's, the narrow menu's and More's rows, with the shared hugging pill), topbar-nav (the site header's links, one action and narrow menu, built by script from the bar's markup), app-shell (the shell, its sidebar and rail, and the app header) and tab-bar (the phone tab bar). The topbar module became the site header's bar (React's SiteHeader, DECISIONS 108: 56px with its line inside, the 44 by 44 brand target, the narrow-screen buttons, the derived sticky offset), budget 1600 to 3200 because its rules gained the app header's shared smoke, and its usage 500 to 750 (+50%) for the lockup's markup (the links, action and menu are topbar-nav's usage). Glide 3700 to 3950: the navigation's pill is a shape inside the row that the plate follows (about 200 bytes). The core's usage 2000 to 2100 (+5%): h2 is the Section step, the prose column's measure, and a link already 44px tall needs no margin. skillMd rose 9317 to 9863 for five index lines, under its cap; the core CSS grew 38 bytes (the layout tokens replace raw lengths, the gutter is one derived property, h2, .prose and .lead follow foundations) and the core script is unchanged. A module's media query writes %bp-md%, %bp-lg% or %bp-container% and the build substitutes the breakpoint tokens. Added in the tables and filters PR (skill-parity-8, batch 7 step 6, DECISIONS 108): the existing table module gains React's table additions (DECISIONS 95: the row header, \"Not observed\", the row density and the scroll hint with its small script), budget 1400 to 3000 (it was 1134 bytes of CSS; it is 2168 of CSS and 693 of script) and its usage 700 to 950 (+36%); and two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: still-table (React's Table with `columns`: the fixed layout from a colgroup, the whole header cell as the sort button with its reserved seat, aria-sort, the pinned columns and their divider, the empty row; 4767 of CSS and 3264 of script, budget 8200) and filter (React's MultiSelect and FilterResult: the chips, the trigger and checklist with the search band from ten values, Clear held in place, the one debounced result line, and the narrowing of a table by `data-column`; 8240 of CSS and 7978 of script, budget 16400; it needs the popover, glide, glyph and choice modules). The core is unchanged in bytes. skillMd rose 9863 to 10128 for two index lines and the CaretUpDown icon's name, within its cap. Added in the commands PR (skill-parity-9, batch 7 step 7, DECISIONS 103 and 108): one new module a page carries only when it uses it, command-list (React's CommandList: the command panel set in the page, list plus preview, the push; it extends the palette and needs rows, kbd and glide; 5229 of CSS and 8734 of script, budget 14000, usage 2150). Two-line rows come to the existing modules: rows 3850 to 5350 (the described row's grid and description line, the push's chevron: 1481 bytes of CSS, the same rules React's menu rows carry), palette 9250 to 9900 (its rows are one function the list shares, with the description and the two-tier ranking of title matches over keyword and description matches; +636) and its usage 1300 to 1350, rows' usage 600 to 800, and glide 3950 to 4000 (a host that is idle counts as having no lit row, +54). skillMd rose 10128 to 10259 for one index line, within its cap; the core's CSS grew 24 bytes (.split.aside takes size-list-width in place of its raw 20rem: the same 320px, so no pixel moves) and the core script is unchanged. Added in the art PR (skill-parity-10, batch 7 step 8, DECISIONS 104 and 108): two modules a page carries only when it uses them, each with its own cap and usage cap set a little above its size: stage (React's Stage and PairedArt: full-bleed art under the site header, the pull-up by the sticky offset, the headroom, the paired art that follows the page's theme, and the forced-colours and print rules; CSS only, 1179 bytes) and framed-art (React's FramedArt: the figure, its rim and radius, the reserved box, the placeholder and the failed alt, the caption and credit; 2208 bytes of CSS and the 733-byte script that sets the frame's phase); both need the art tokens. The bar stays smoked over a stage: React clears it only over a stage that passed the headroom test helper, and a page has no test run (DECISIONS 108's note), so the skill builds no clear state. skillMd rose 10259 to 10500 for two index lines, within its cap; the core is unchanged in bytes. The callout gained the status rim in the same PR (DECISIONS 82, D8's status callouts): success, warning and danger draw their border in the status colour at 45% mixed in sRGB over the callout's own level, one solid colour on every side, and CanvasText in forced colours with the icon; the status colour is now one property the icon and the rim read. Its budget rose 900 to 1150 (the module is 1089 bytes, from 792: +297, about 37%); its usage is unchanged. Added in the overlays-and-the-rest PR (skill-parity-11, batch 7 step 9, DECISIONS 90 and 108): the last two parts of D8's part 5, each a module a page carries only when it uses it, with its own cap and usage cap set a little above its size: combobox (React's Combobox: the input with its caret button inside, the popup of the menu's rows with the glide's shared plate and two-line options, the filtering, the keys, the hidden value, the empty message and the check; 4342 of CSS and 6423 of script, budget 10900, usage 2150; it needs forms, popover and glide, and builds the last two) and sparkline (React's Sparkline: the label and latest value, the line, the axis, the empty sentence and the loading line that breathes; 1609 of CSS and 1874 of script, budget 3600, usage 950). The combobox copies the menu's row rules, as the select's list does, because React's Combobox renders MenuItem rows (a 40px hit area, a 36px plate) and the skill's .row is the palette's 44px: it carries no menu script. popover.js gains the combobox popup in the list of popups that keep focus where it is (+21 bytes, within its cap). skillMd rose 10500 to 10724 for two index lines, within its cap; the core is unchanged in bytes. Added in the motion-rules PR (DECISIONS 136 and 139): one module, ambient (a page's one ambient loop: CSS 828 bytes, script 433, budget 1300, usage 800), taken out of loops so the hold's own module grows only by the icon toggle's glyph swap (loops 2000 to 2200, +10%; its usage 1300 to 1650 for the icon form and the new settings-row sentence, +27%); and the chart's entrance (`entrance: true`: the marks' animations, their conditions and the redraw that restarts them at the elapsed time, 23262 to 25299 bytes of script; budget 30700 to 32800, +7%, usage 2500 to 2950, +18%). The core grew by the three tokens (27704 to 27862 bytes of CSS, under its cap). its stage usage gained the ambient art's line (1650 to 1750, +6%). skillMd rose 10724 to the size of the ambient index line, within its cap. Raised again in the motion-rules amendment (DECISIONS 143): chart 32800 to 33800 (script 25299 to 26375 bytes, +4%; +10% over the 30700 it began with) for the glide a new data set makes mid-entrance, print settling it, and `Basalt.pageChange()`; its usage 2950 to 3150 (+26% over the 2500 it began with). Raised in the second motion-rules amendment (DECISIONS 148): chart 33800 to 34400 (script 26375 to 26970 bytes: a line and its markers glide from their drawn geometry, and `beforeprint` settles the entrance; +12% over the 30700 it began with); topbar-nav 6900 to 7500 (+8.7%: the narrow menu's pause row, its CSS and 275 bytes of script, DECISIONS 148 item 2); loops usage 1650 to 1800 (+38% over the 1300 it began with, for the icon form's `title` and the menu row). Raised in the audit-design-b PR (DECISIONS 138 and 139): still-table 8200 to 13400 (+63%: the module was 7927 bytes and is 13311; the cut cell's plate, its focus stops and its dismissal, ported from React's cell-peek.ts, are 4273 bytes of script and 1111 of CSS; a still table that truncates needs them). The same PR: core usage 2100 to 2250 (+7%: the skip link, one bullet), forms usage 350 to 480 (+37%: the required mark), still-table usage 1950 to 2150 (+10%: the cut cell and the width rule), notifications usage 1050 to 1100 (+5%: the 44px entry on touch). The skip link's rim and radius took the core 30457 to 30609 bytes, under its cap (the rules that hang it under the bar are the topbar module's: 3200 to 3600, +12.5%); core 30720 to 31050 (+1.1%, DECISIONS 147: also the bar's links left out of the rule: the pseudo-element that makes a short standalone link a 44 by 44 target), skip-link script in the topbar module (3200 to 4150 over this PR, +30%: the rules that hang the link under the bar, 3600, and the script that reads the bar's real edge, 4150), sparkline 3600 to 4050 (+12.5%: React's ticker structure, so the value copies once on its line, and in forced colours the strips go and the number is plain text), forms budget 3250 to 3500 (+7.7%: the necessity word), notifications 9050 to 9250 (+2.2%: the 44px entry). Raised in the audit-design-b PR's E2 port (DECISIONS 138 and 139: the core set draws check, close, the chevrons, copy, plus, minus and search wherever a component draws them): the modules that drew a Phosphor icon for one of those now carry the core glyph's whole SVG, written in at build time (`%glyph-svg:name%`, the markup the glyph module's `_.glyph(name)` returns, so no module needs the glyph module and a page pays for nothing it does not use), and the Phosphor path of the same icon leaves the page. Each module's own bytes rose by that markup, and a page's total moved by what the Phosphor path it no longer carries saves: menu 8600 to 8900 (+303), combobox 10900 to 11200 (+303), copy 1900 to 2400 (+640), terminal 8100 to 8850 (+761), toast 13850 to 14150 (+325), number 2900 to 3400 (+557), filter 16400 to 17050 (+785), palette 9900 to 10450 (+536); the command list shares the palette's search drawing and fell 20 bytes. Set in integration-nov15, where the type-layout, motion-rules and audit-design-b branches meet: the combined tree measured SKILL.md 10959 bytes (each side's cap was 10900: both added index lines), core 31192 bytes (caps 30720 and 31050: the page-row and display rules, the three motion tokens and the skip link and 44px target rules all land in the core CSS) and core usage 2348 bytes (caps 2300 and 2250: type-layout's line and the skip-link bullet), so each is set to the measured bytes rounded up to the next 50: skillMd 10900 to 11000, core 31050 to 31200, core usage 2300 to 2350. Raised in the audit-design PR (decisions 138 and 139, parts A, D and C11): core 30720 to 31600 (+2.9%: the more-contrast block and its three aliases, and the field boundary token, every page carries as React does; the shadow-pill token is gone; the script gained `reserve`, 240 bytes), segment 3700 to 4100 and tabs 2300 to 2700 (the chosen label is 600 against 400, its width reserved by a span that carries its own copy, drawn unseen at 600; the pill's drop shadow is gone), and the segment's usage 300 to 380 (the weight and the glyph-only button). Raised again in the audit-design-a amendment (decision 145): core 31600 to 32300 (reserve() also reserves a label that is not plain text), segment 4100 to 5100 and tabs 2700 to 3500 (the second copy of such a label, and an icon drawn in both its forms), glyph 1100 to 1300 (a glyph in a segment or tab is drawn in both forms). Raised in the second audit-design-a amendment (decision 149): core 32300 to 32800 (reserve() builds the second copy of a label without any id, name, reference or hidden control, and does not copy a frame or media), segment 5100 to 5400 and its usage 380 to 500 (the 600 is on the label, the one-line rule and the usage text); the still-table cap is back at 8200, as the wash is on every cell again. Return 3 of the audit-design-a build (decision 149): tabs 3500 to 3700 (a tab the script has not reserved is 600 itself when selected, and one it declined is marked; the same two lines are in segment, which stays under 5400). Raised in the audit-fix-c2 PR (engineering, no pixel changes): toast 13850 to 14350 (the module was 13789 bytes and is 14288, +499, 3.6%) for F6, which focuses the Notifications region and Shift+Tab or Escape from it (or from the first toast) leaves it for where focus came from (and keeps a dialog's focus trap from wrapping it), as Base UI's viewport does in React, and for placing the region from focus (in the modal that holds it, or in the body), so a toast is never under a backdrop or in an inert modal whatever order the modals opened in (A3-09); the palette module grew 9864 to 9897 of its 9900 so that a palette opened over a modal sits inside it; topbar 3200 to 3250 (3123 to 3233, +110) for the scroll margin on what the bar holds, so a Tab into the bar from a scrolled page does not scroll the page (React's rule from PR #66); stage usage 1650 to 1750 (1580 to 1713, +8%) for the art's new place in the markup, after the content (A1-09), the stage's own CSS rising 1179 to 1208 within its 1250. skillMd rose 10724 to 10876 for the sentence that says a body may carry head tags, within its 10900. compose.mjs, the tool an agent runs, has no cap here (it is never in a page): it grew 21673 to 38153 bytes for the tokenizer that reads a body as HTML does and the head tags. Raised in the site-parts PR (DECISIONS 146, round 39), which folds each new part into the module it belongs with, so SKILL.md gains no index line (it has 41 bytes under its cap and a new module needs about 100): topbar 4150 to 17600 (+13450: the site footer and its disclosures, the lockup by pixel density, and a bar that arrives or leaves and returns, with its observer; a page that has a .topbar and no footer carries them too: the alternative, a module for each, needs its own index line and so SKILL.md bytes) and its usage 950 to 2900 (the footer's markup, the lockup's and the phase's); theme 650 to 4550 (the three-word theme choice: its CSS 2230 bytes and its script, 2277, with arrows, storage and the system listener) and its usage 400 to 1150 (the choice's markup written in full, so the right word is chosen before any script); segment 3700 to 3800 (a radio group's checked state besides a pressed button); stage 1250 to 2150 (its first script, 768 bytes, for fit and anchor) and its usage 1750 to 2000; framed-art 3000 to 3900 (drawn art in the frame: fit, anchor, no scaling strokes) and its usage 1250 to 1400. SKILL.md rose 10959 to 10992 (the topbar and theme index lines name .site-footer and .theme-choice). The head's theme line also writes data-theme-choice. Raised in site-parts return 2 (DECISIONS 146 B1 and B4): theme 4550 to 5350 (+800: the icon form of the theme choice, [data-theme-menu], whose button shows the theme in use, is named for the choice and opens the page's own .menu of three radio rows, in the theme script's 3073 bytes; the menu and popover modules are the page's, brought by its markup, so no module line was added and SKILL.md is 10993 of 11000) and its usage 1150 to 2200 (+91%: the menu's markup is written in full, and the deprecated toggle is said once); app-shell usage 2000 to 2100 and topbar-nav usage 1900 to 1950 (the theme control leaves the bar's text; the tools and the end cluster come in). The two example bodies still carry the deprecated data-theme-toggle. Return 2, F3 (DECISIONS 146 F): stage 2150 to 2250 (script 842 bytes: slice is the stage's default, as a frame's, and a drawing's own preserveAspectRatio stands unless the stage names data-fit or data-anchor) and its usage 2000 to 2150. framed-art 3900 to 4000 (a drawing's own preserveAspectRatio stands unless the figure names data-fit or data-anchor, +101 bytes). Return 3: theme 5350 to 5900 (script +569 bytes: who wrote data-theme, so System follows the system's change live and a theme the page set by hand, or a .dark or .light root, survives it). Raised in the controls port (DECISIONS 154): skillMd 11000 to 11200 for two index lines (link-tabs and option-chips, 214 bytes together), and core 31200 to 31600 for the nine tokens the port adds to every page's token CSS (the control rungs 44 to 64, two container widths, the confirm hold and the amount's opacity, 311 bytes). New modules (DECISIONS 154): link-tabs 2700 (its sizes, the 640 container step, the forced-colours underline, and the select that replaces the row under 720 with its 590-byte script, A15; it requires the select module), option-chips 5700 (the chip's states each written for a native radio inside a label, which needs :has on every one, plus the 1 KB script that keeps an aria-disabled chip reachable and never chosen). Return 3 (DECISIONS 154 conformance): link-tabs 2700 to 3100 and its usage 1650 to 1850 (the select's height for each row size, and a script that reads aria-current when it is needed and watches it move: 3,048 bytes), option-chips 5700 to 6700 (each state written twice, as a state attribute and as :has(), so no browser needs :has(): 4,975 CSS and 1,623 script). Return 4 (DECISIONS 158, Q2): link-tabs 3100 to 4300 and its usage 1850 to 2400 (the \"Go to\" label drawn at the select's start with its measured clearance, the select's accessible name kept as the words and the chosen page's, and the key hold that keeps a letter or an arrow on the closed select from navigating: 4,174 bytes, CSS 2,951 and script 1,223). Raised in the links-and-rows port (DECISIONS 152; the owner's approval is the lead's to confirm): the new link-rows module (5050 bytes of CSS, 50 of them for Castle's big-row arrow stepping colour over duration-fast, return 1, 1500 of usage: the directory's and the big rows' CSS, whose arrow is a core glyph drawn as a mask, and their tokens, size-row taken out of the core like type-layout's), disclosure 1550 to 3500 (Show all: the track, the clip and the settle, 1.5 KB of script and 1.8 KB of CSS), copy 2400 to 3500 (the form with words: the one cell and its script). SKILL.md rose 10959 to 10997 for one line, within its 11000 cap. Raised in the charts port PR (DECISIONS 153, D7a): chart 34400 to 34650 (script 26970 to 27270 bytes, +1.1% on the 34283 it was: `Basalt.trailingMean`, the trend maths React exports as `trailingMean`, 300 bytes), its usage 3150 to 3350 (+6%: one line for it). The tokens the batch adds (chart-lit-top, -mid and -base in both themes, size-chart-plot-sm, size-chart-row, size-meter-marker and radius-2xs) took the art module 2087 to 2546 bytes (budget 2100 to 2600, +24%: the chart tokens are its group) and the core 31192 to 31250 (cap 31200 to 31300, +0.3%: radius-2xs). Only D7a names a skill module in the charts ballot; the lit marks, the headline frame, the phase chart, the share bar, the coverage strip, the marks row and the range meter are React-only in this batch. Added in the overlays-and-search PR (DECISIONS 155, D10b and D13a): the sheet gains React's head, body and foot (the 44px close, the 20/28 title over a 13px count, the divider and the safe areas; its CSS 3.6 to 5.2 KB, budget 4050 to 5250, +30%) and its usage 1050 to 1450 (+38%: the anatomy and the step's focus, two bullets); and one new module a page carries only when it uses it, search (React's SearchDialog: the form, the field's -2 outline, the count line, the fixed-height results area and the rows with their picture slots and full-bleed hover wash; CSS only, 4368 bytes, budget 4400, usage 2050; it requires the dialog). The dialog's title draws no ring when script focuses it. skillMd rose 10959 to 11079 for the search line (the sheet's line is unchanged: its usage carries the anatomy), so its cap rose 11000 to 11100 (+0.9%). The core's CSS grew 31192 to 31421 bytes for the six new size tokens (the wide dialog, the search trigger and the logo and picture slots of a search result): its cap rose 31200 to 31450 (+0.8%). The two 44px values (the sheet's close and the search field) are local to their modules, with a lint exception that says they join the controls batch's size token (DECISIONS 154). Set in integration-nov15b, where audit-design-a, audit-fix-c2, site-parts, port-controls, port-links-rows, port-charts and port-overlays-search meet: the combined tree measured SKILL.md 11560 bytes (the caps were 11000, 11100 and 11200: each side added index lines), core 34086 bytes (caps 31300 to 33550: every side's rules land in the core CSS and script), topbar 17660 (17600 from site-parts, plus audit-fix-c2's skip-link and focus work), number 3453 (3400), palette 11379 (11000, audit-fix-c2's hosted scrim plus the core search glyph), dialog 5120 (5100), toast 15692 (15400) and stage usage 2248 (2150), each over every side's cap, so each is set to the measured bytes rounded up to the next 50: skillMd 11200 to 11600, core 33550 to 34100, topbar 17600 to 17700, number 3400 to 3500, palette 11000 to 11400, dialog 5100 to 5150, toast 15400 to 15700, stage usage 2150 to 2250. The segment cap is the base's 5400 plus port-controls' 100 (5500), unchanged by the merge. Raised in integration-nov15b, join 2 (a link tab takes the selected state, DECISIONS 138 A, 145, 149 and 154's D12 row): link-tabs 4300 to 5750 (+34%: the module was 4174 bytes and is 5736; the 600 against 400, the reserved width and the second copy of a composed label, an icon drawn in both its forms, the same rules a tab carries, 1,530 bytes of CSS and script) and its usage 2400 to 2550 (+6%: one bullet). The cap is the measured bytes rounded up to the next 50; a module that needs the tab's rules carries them as the segment and tabs modules do, so a page without link tabs pays nothing. Raised in the panels, art and parts port (DECISIONS 162): table 3000 to 3150 and its usage 950 to 1450 (the flat form and the two-line cell), stage 2250 to 2600 and its usage 2250 to 3100 (the closing block: its held art, forced colours and print; its section gap is type-layout's --basalt-section-gap, which a page with data-closing brings), the new app-tile 4300 (a 120-point polygon clip and the hairline's mask of the same outline), captioned 2000 and period 1400; skillMd 11600 to 11950 for one index line each for captioned, app-tile and period (358 bytes; the file is 11918). Raised in the logs, status and forms port (DECISIONS 162): core 34100 to 34200 (the new size-field-label-inline token, 80px, is written into every page's tokens: 25 bytes); dlist 1300 to 1900 and its usage 950 to 1060 (the stacked form, R9 and R10: a title over its text, 20px between entries, no divider; one usage line). Raised in audit-fix-c6 (the owner's cap, raised by the builder and for the owner to confirm): glyph 1300 to 1900, for redrawing a glyph when its ancestor's aria-current or data-current moves (the lists that hold glyphs are watched). Raised in the colour-ink-ladder build (DECISIONS 166): core 34200 to 34350 (the four lifted dark inks are four new primitives, each written into every page's tokens: the core measured 34307). Raised in the audit-2-design build (DECISIONS 167, Q7a): disclosure 3500 to 3800 (the core chevron drawn as a mask in place of two borders: the module measured 3755). Joined in the integration of c7 (#86) and c10 (#91): option-chips 6750 to 6850 (c7's reset resync and c10's data-ready together measure 6839). Raised in table-sort-3 (DECISIONS 257 and 261, the owner's pick: three sort states, the arrow after the label, explainers on column titles): still-table 13400 to 14650 (+9.3%: the module was 13343 bytes and is 14602; the end-aligned label's move by a transform, its right-to-left sign and the indicator that waits for it on a fine pointer, 912 bytes of CSS; the third state, the sort from the table's own order and a .explainer kept out of the button, 347 bytes of script) and its usage 2150 to 2250 (2197: the third state and the own order); the new explainer module 5850 (5842: a manual native popover opened from the sort button on hover, keyboard focus and a long press, placed above the header or beside it, 1752 bytes of CSS and 4090 of script; a page without explainers pays nothing) and its usage 900; skillMd 12250 to 12400 for the explainer's index line (113 bytes; the file is 12352). Each cap is the measured bytes rounded up to the next 50. Raised in table-sort-3's fix pass (Astra's review): explainer 5850 to 6900 (+18%: 5842 to 6864 bytes; the gap between the header and the card kept while a pointer crosses it, the close when its header leaves the view whatever has focus, the dismissal held until pointer and focus have both left, and its page-wide listeners and timers scoped to an open card and stopped when the table leaves the page, 1,022 bytes of script). Raised in cimip-gaps-2 batch B5 (the touch sizes under 720 whatever the pointer: each coarse-pointer target rule also answers a window under 720, about 20 bytes a rule; forms merged its three into one and stays under 3500): select 9000 to 9100 (measured 9064), selection 1480 to 1500 (1486), filter 17450 to 17500 (17473), option-chips 6850 to 6900 (6853), menu 8900 to 8950 (8902). B5 fix pass 1 (Astra): core 34550 to 34950 (measured 34911: 30762 CSS and 4149 JS) for stacked links in a column, each giving up the side of its 44px box that meets a neighbour, so a tap on a link's words is always that link's; core had 12 bytes free. DECISIONS 274 (the owner's pick: under 720 the toast stack hangs from the bar): toast 15700 to 16050 (measured 16035; 8 bytes were free; the stack's direction became one sign variable, trimming 585 of the 920 bytes the phone form first took). B5 merged with main (5ad5345a): main's own core measured 34930 against its 34550 cap before B5; with B5 (the touch sizes under 720 and stacked links in a column) it is 35331, so core is 35350; nav 5350 to 5400 (measured 5364: B4's nav plus the touch size under 720). The full run after the stream (DECISIONS 246): the site footer's links keep their own flex column under 720, as React's, out of the bare-link touch rule (26 bytes), so core is 35400 (measured 35357); sheet 5250 to 5400 (measured 5368: React's B5 ring room, ported: the held actions reach space-1-5 above their band, clipped, and the body keeps space-1-5 at each end). Raised for diagram motion and service marks (DECISIONS 292): skillMd 12550 to 12650 for the diagram-motion module's one line; diagram 87200 to 91000 for what a still diagram now carries (a card's mark and its seat, the pending frame, the comparison that writes a drawing only when it changed, and the print rule), and its usage 2600 to 4300 for the decision's four lines and the list of mark ids; the new diagram-motion module (the motion engine, its stylesheet and the motion tokens, in a page only when a diagram is animated) at 26200. Raised when the diagram tests were first run (DECISIONS 298): diagram 91000 to 91250 and diagram-motion 26200 to 26850. Raised in batch A of the diagrams backlog (DECISIONS 301): diagram 91250 to 92400, for the engine fixes it bundles (a decision kept no taller than it is wide, labels on whole pixels, slots beside a straight line, a one-column schema's turn-back); the skill keeps the development checks a production React build now drops. Raised again in that batch's review fixes: diagram 92400 to 92650, for the drawn layout refusing two lines laid on one another (Neon's blocking finding 1 on #126). Fix round 1 of #124 had already taken them to 91205 and 26621 with the tests unrun; this round added 1 byte (every focal node prints its fill; a one-form mark's dark form falls back to its light one) and 180 (the entrance keeps its own clock when it is drawn again while paused). DECISIONS 320 (versions and release notes): the release module is new (budget 15900 at first, usage 2400); topbar, app-shell and tab-bar gain the version link's classes (budgets: topbar 17700 to 19900, app-shell 4300 to 5200 with the rail's tooltip for it, tab-bar 4850 to 5200), their usage caps rising 2900 to 3100, 2600 to 2850 and 2250 to 2400 for its one line each; skillMd rose 12650 to 12800 for the release module's line and .version-link in topbar's. The code review of round 68 adds data-focus-self to the popover module (its Tab walk; budget 4950 to 5600, usage cap 950 to 1100) and logical start and end for its alignment; the release module's header grid and the Sources panel's touch rows take it to 16900. The spacing sweep of round 68 (DECISIONS 326: Copy link's words on the edge, the callout's last change, its reference column, the last release, the touch rows' end and the whole code chip) takes the release module to 17400. The ruling on where a release ends (DECISIONS 331: no padding under the last change in a release, a release-ending fold's hang, an arrived change keeping its padding, the panel holding its first margin, Build details 44 on touch and a closed Fixed panel taking no room) takes it to 19000. The code recheck of round 68 (recheck 5) has the popover's Tab walk follow Safari's own rule (Tab skips links on Apple's WebKit, Option-Tab reaches them): popover 5600 to 5900. The pixel recheck of round 68 has the Sources panel's touch rows keep their 20px lines with the link's box as hit area, space-3 rows and space-6 between two linked values (recheck-pixels 4), and the release's whole header take the arrival's plate: release 19000 to 19600. Merging #127 (stages, DECISIONS 316 and 328) into the versioning branch: both had raised skillMd from 12650 to 12800 for their own module's line, and together they came to 12886; SKILL.md was tightened in its wording (no rule dropped) to stay within 12800. Raised in diagram batch B's fix round (DECISIONS 318, the owner's diagram raise; and 326's sweep), each to its measured size: diagram 137700 to 144100 (the two reviews' fixes in the shared engine: right to left frames and self-calls, the corridors' and lanes' development words, the unusable-placement check, the transcript's hanging lines, the text art's frame widening, the frame-side fit check, the sequence's layers, the stacked group's turn room), diagram-motion 28450 to 30450 (the text sequence's build by ink and its colour-only run, moved into the motion module), diagram-zoom 17000 to 17600 (a linked card closes the viewer; the text art's own width; a placed model for the key hint), diagram-export 7850 to 10450 (an export at rest: sized drawing SVGs, no reveal masks, the pseudo-element rules, the lines under the cards, a viewer's figure read at 100% with its head and key, the rim's lit top). Raised at the batch B re-check (the decider's four rulings): diagram 144100 to 145100 (5.1's first list reported as errors apart from the warnings, a turn's label lines on the group entered by it and the seats beside its turn, the bare stack applied, the text art's reset of the core's inline code chip). Merging main (#127 and #128) into diagram batch B: skillMd keeps main's 12800 (batch B had raised it to 12950 for its diagram lines); SKILL.md was tightened in its wording to stay within it, no rule dropped; core takes main's 35550.Raised in the repo review (23 Nov 2026; budgets are soft, the owner's word): notifications 12450 to 12700 (a link is written only when relative, http, https or mailto, and side and align are checked before they reach the markup), combobox 11200 to 11350 (a disabled field's hidden input is disabled too, now and later), tooltip 3200 to 3550 (the gap to the opener is the tooltip's own, and hover and keyboard focus each hold it open; WCAG 1.4.13), chart 34750 to 34800 (the scale's step search and gridlines are bounded, so extreme values cannot hang the page), spinner 650 to 720 (its held rule moved in from loops, so a ring-only page keeps a stored hold), kbd 2900 to 2950, palette 11400 to 11500 (and its usage text 1350 to 1400, for the Mod line) and toast 16050 to 16200 (Mod in a palette item's keys is bound as it is drawn, and a toast action's aria-keyshortcuts resolves Mod). The safe-sinks rule (decided by the owner, Fable, Astra and Muse, 23 Nov 2026): skillMd 12650 to 12900, and 13050 with main's own raise merged in (one line: data goes in as textContent, a link passes Basalt.safeHref, an option comes from a fixed list), core 35400 to 35650, and 35800 with main's own raise merged in, and its usage 2950 to 3200 (one safeHref, published as Basalt.safeHref, and _.pick, in place of a copy in each module; esc escapes the apostrophe), link-tabs 5750 to 5900 (a refused link dispatches no event), diagram 92650 to 93000 (a card's mark is a relative path, https or a data: image). Merging #129 into diagram batch B: diagram keeps batch B's 145100 plus #129's mark check, set to its measure, and batch B's usage 4600. The fix round after both reviews of 421348e8 sets them to the measured sizes again: core 38950 to 39600 (every room says all three forms, and a hung word's box grows by a short room's shortfall), search to 5700 (it places its top again on a resize and with the keyboard; an empty list holds no padding), command-list to 14700 (it keeps the taller of its two heights), notifications to 12950 (the bell's edge), pane to 1950 (the page column's room), chart to 34950 (the date line's reason), and code, diagram-zoom, filter, links, sheet, still-table, tab-bar and topbar each by under 150 bytes (the three forms of a room; the selection column's width however given). Merged with main at db0bc418 (#129 to #131), DECISIONS 336's caps are set to the measured sizes again: core 35800 to 38950 and its usage 3200 to 3650, toast 16200 to 16750, terminal to 12700 (13050 with the open items' ruling: both copy buttons draw their three glyphs once, so a refused copy shows the close with no markup written after), diagram-zoom 17600 to 17750 (its viewer's Close and Zoom out hung, and the foot's room). Raised in DECISIONS 336 (reserved room across every component, claude/reserved-room), each to its measured size: core 35550 to 38700 (the edge rule a ghost .btn hangs by at a head, its ring and touch hit area, the side insets by direction, the .panel-head and page section-head that hang their last button by themselves) and its usage 2950 to 3450 (how data-edge and --basalt-edge-room are written); search 4400 to 5200 (search.js, the held top), terminal 11950 to 12550 (the close glyph for a refused copy, the edge on both copies), links 2750 to 3300 (the first icon link hung, the card room, the 20px glyph), toast 16050 to 16650 (the 46px hit areas on touch), selection 1500 to 1650 and still-table 14650 to 15000 (the 44px select column), command-list 14000 to 14350 (the panel hugs, the room is page), menu 8950 to 9150 (the column every row keeps when any row has a check or a glyph), notifications 12450 to 12600, filter 17500 to 17600, forms 3500 to 3550, sheet 5400 to 5450, topbar-nav 7550 to 7600 and app-shell 5200 to 5250 (logical sides, the edge and the room); topbar's usage 3100 to 3200 (a bar's last ghost control takes data-edge); command-list's usage 2150 to 2300 (the panel hugs; the room is page, and only on the page); dialog-form's usage 1300 to 1350 (its Close is written data-icon-only data-edge=\"end\"). Raised in the polish ruling of 336 (the selection box keeps to the cell's line): selection 1650 to 1750 (the box's start margin, min(space-4, half the spare room): 1710 measured) and its usage 1150 to 1350 (the rule's sentence: 1313 measured). Merging main (#130, #131) into claude/diagram-interop: diagram usage 4600 to 4850 (+5.4%: Batch B's diagram usage plus the basalt-diagram-export rule line, measured 4806), then 4850 to 5050 (noting that .lucid is for Lucid's REST API only and to use .vsdx in Lucid's UI, measured 4999). Raised for right to left (diagrams-rtl): diagram 145450 to 146000 (the stacked figure mirrors, its snap and whole-pixel labels with it; a drawn schema takes its turn-backs, its one-column room and its gutter lanes from the end side); then 146000 to 148000 for Fable's ruling on the stacked group label (the stem gives way, the label slides, the last resort's warning) and the author's strings isolated in ).", "budgets": { "skillMd": 13050, "core": 39600 @@ -820,7 +820,7 @@ "art", "kbd" ], - "budget": 145450, + "budget": 148000, "usage": 5050, "builds": [ "kbd"