@preventive/triage 1.0.0-alpha.13 → 1.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/brotli-fallback.js +3 -3
- package/out/client-admin.js +2 -2
- package/out/client-sync.js +14 -14
- package/out/graph.js +30 -5
- package/out/index.html +47 -7
- package/out/prism.js +2 -2
- package/out/stasis.svg +45 -0
- package/out/terminal.js +255 -43
- package/out/view.css +1 -1
- package/out/view.js +147 -110
- package/package.json +27 -4
- package/report/index.js +253 -0
- package/report/src/finding-id.js +80 -0
- package/report/src/finding.js +300 -0
- package/report/src/labels.js +33 -0
- package/report/src/md-structure.js +471 -0
- package/report/src/md-text.js +167 -0
- package/report/src/meta.js +51 -0
- package/report/src/parse-codex.js +147 -0
- package/report/src/parse-deepsec.js +197 -0
- package/report/src/parse-deepview-fields.js +375 -0
- package/report/src/parse-deepview-md.js +185 -0
- package/report/src/parse-md-id.js +137 -0
- package/report/src/parse-md.js +253 -0
- package/report/src/parse-piolium-id.js +79 -0
- package/report/src/parse-piolium-rows.js +131 -0
- package/report/src/parse-piolium-tokens.js +175 -0
- package/report/src/parse-piolium.js +400 -0
- package/report/src/utf8.js +21 -0
- package/report/src/write-md-finding.js +273 -0
- package/report/src/write-md.js +291 -0
- package/server-e2e/bus-receiver.ts +1 -0
- package/server-e2e/hub.ts +37 -6
- package/server-e2e/index.ts +3 -2
- package/server-e2e/objstore/handlers.ts +6 -5
- package/server-e2e/objstore/init.ts +1 -1
- package/server-e2e/objstore/rest-mint.ts +2 -2
- package/server-e2e/objstore/rest.ts +2 -2
- package/server-e2e/pubsub.ts +8 -5
- package/server-e2e/sync-handlers.ts +54 -28
package/out/graph.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
var Pt=globalThis[Symbol.for("@rray/frontend")];if(!Pt)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:Lt,html:q,nothing:eo,unsafeCSS:ct,render:Ge,StateElement:wo,classMap:Ce,repeat:Et,styleMap:Qe}=Pt;var It=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:.6rem .75rem;font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:5px;background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}& svg{display:block}}.g2-path-filter-wrap{position:relative;flex:0 0 14rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:50%;color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-topbar-toggle{display:inline-flex;align-items:center;height:30px;box-sizing:border-box;gap:8px;padding:5px 10px;background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:6px;color:var(--muted);font:500 11px/1 inherit;font-family:inherit;white-space:nowrap;&:hover{color:var(--text)}&.on{color:var(--text)}&.on .g2-switch{background:color-mix(in srgb,var(--accent) 22%,transparent)}&.on .g2-switch:after{transform:translate(12px);background:var(--accent)}}.g2-trash-btn.on{background:color-mix(in srgb,var(--accent) 16%,transparent);border-color:var(--accent);color:var(--accent)}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-count{color:var(--muted);opacity:.6;font-weight:400;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;text-transform:none;letter-spacing:0;font-size:10px}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-divider);border-radius:4px;overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent)}}.g2-switch{width:26px;height:14px;background:var(--border);border-radius:8px;position:relative;transition:background .15s;flex-shrink:0;&:after{content:"";position:absolute;top:2px;left:2px;width:10px;height:10px;border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:grab;&:active{cursor:grabbing}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-zoom-ctrl{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;z-index:3;box-shadow:var(--shadow-glass);& button{width:28px;height:28px;background:transparent;border:0;color:var(--muted);border-bottom:1px solid var(--graph-divider);display:grid;place-items:center;font-family:inherit;font-size:13px;&:last-child{border-bottom:0}&:hover{color:var(--accent);background:var(--surface-active)}}}.g2-zoom-pct{font:500 9px/1 ui-monospace,monospace;color:var(--muted);padding:5px 0;text-align:center;border-bottom:1px solid var(--graph-divider)}.g2-zoom-ctrl .g2-zoom-fit-btn{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:9px;line-height:1;letter-spacing:-.02em;text-transform:lowercase}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:7px;padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tt-badge{display:inline-block;font-size:8px;padding:2px 4px;background:color-mix(in srgb,var(--accent) 22%,transparent);color:var(--accent);border-radius:3px;text-transform:uppercase;letter-spacing:.08em;font-weight:600}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:8px;overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:4px;padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:3px;padding:3px 6px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:8px;padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:2px;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}.g2-dist-item{display:grid;grid-template-columns:8px 1fr auto auto;gap:8px;align-items:center;font-size:10px;padding:4px 6px;margin:0 -6px;background:transparent;border:0;border-radius:4px;font-family:inherit;text-align:left;width:calc(100% + 12px);&:hover{background:var(--graph-hover-bg)}&.on{background:var(--surface-active);.g2-dist-name{color:var(--accent)}}.g2-dist-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-dist-name{color:var(--muted);font-family:ui-monospace,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-dist-count{font-family:ui-monospace,monospace;color:var(--text)}.g2-dist-pct{font-family:ui-monospace,monospace;color:var(--muted);width:36px;text-align:right;opacity:.85}}@media print{:host{display:none!important}}
|
|
2
|
-
`;var
|
|
3
|
-
`;var Ft=`.toolbar{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem;padding:.6rem .75rem;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;box-shadow:var(--shadow-glass);font-size:.825rem;& label{color:var(--muted);margin-right:.15rem}& select{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .4rem;font-size:.8rem;&:focus{border-color:var(--accent);outline:none}}& select.sort-select{padding:.3rem 1.7rem .3rem .55rem;min-width:8.5rem;font-weight:500;appearance:none;-webkit-appearance:none;background:transparent}:is(repo-filter,revalidate-filter,findings-sort){position:relative;display:inline-block;&:after{content:"";position:absolute;right:.7rem;top:50%;width:.35rem;height:.35rem;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-70%) rotate(45deg);pointer-events:none}}& analyzer-select{position:relative;display:inline-block}.analyzer-btn{display:inline-flex;align-items:center;gap:.45rem;height:30px;box-sizing:border-box;padding:.3rem .55rem;min-width:8.5rem;background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;font-family:inherit;font-size:.8rem;font-weight:500;&:hover{border-color:var(--accent)}&:focus-visible{border-color:var(--accent);outline:none}&.active{color:var(--accent)}.analyzer-btn-label{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:18rem}& svg{color:var(--muted);flex-shrink:0}}& range-slider{color:var(--accent);margin:0 .25rem}.conf-vals{color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-variant-numeric:tabular-nums;.dash{color:var(--muted);margin:0 .15rem}}& conf-filter{position:relative;display:inline-flex;align-items:center;height:30px;box-sizing:border-box;padding:0 .55rem;gap:.5rem;background:transparent;border:1px solid var(--border);border-radius:4px;.conf-range-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}& range-slider{margin:0}.conf-range{display:inline-flex;align-items:center;gap:.5rem}:is(.conf-range,.conf-range-label).replaced{visibility:hidden}:is(.conf-range,.conf-range-label).disabled{opacity:.35}& revalidate-filter{position:relative;display:inline-flex;align-items:center;flex:none;width:1.4rem;.sort-select{width:100%;border:0;height:auto;min-width:0;padding:0 .95rem 0 .2rem;font-size:.72rem;color:var(--muted);cursor:pointer;&:hover{color:var(--text)}}&:after{right:.25rem}&.replaces{position:static;.sort-select{position:absolute;inset:0 .55rem;width:auto;padding-left:0;color:var(--text)}&:after{right:.8rem}}.partial-cycle{position:absolute;right:1.75rem;top:50%;transform:translateY(-50%);z-index:1;padding:.1rem .3rem;border-radius:3px;font:inherit;font-size:.66rem;line-height:1.4;white-space:nowrap;cursor:pointer;--chip: var(--muted);color:var(--chip);border:1px solid rgb(from var(--chip) r g b / .45);background:rgb(from var(--chip) r g b / .1);&.included{--chip: var(--green)}&.excluded{--chip: var(--critical)}&.only{--chip: var(--yellow)}&:hover{background:rgb(from var(--chip) r g b / .22)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px}}}}& input[type=text]{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .4rem;font-size:.8rem;flex:1;min-width:8rem;&:focus{border-color:var(--accent);outline:none}}.result-count{color:var(--muted);margin-left:auto}.checkbox-label{display:inline-flex;align-items:center;gap:.25rem;color:var(--muted);& input{margin:0}}}.analyzer-menu[popover]{position:fixed;inset:auto;margin:0;align-items:stretch;gap:.35rem;padding:.3rem;background:var(--bg);border:1px solid var(--border);border-radius:6px;box-shadow:0 4px 12px #00000040;font-size:.825rem;-webkit-app-region:no-drag;app-region:no-drag}.analyzer-menu[popover]:not(:popover-open){display:none}.analyzer-menu[popover]:popover-open{display:flex}.analyzer-menu-sep{border-left:1px solid var(--border)}.analyzer-menu-col{display:flex;flex-direction:column;gap:1px;min-width:9rem;max-height:60vh;overflow-y:auto}.analyzer-menu-head{padding:.25rem .5rem .2rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}.analyzer-menu-item{display:flex;align-items:center;gap:.45rem;background:transparent;border:0;border-radius:3px;padding:.3rem .5rem;color:var(--text);text-align:left;font-family:inherit;font-size:.78rem;&:before{content:"";width:.8rem;flex-shrink:0}&.active:before{content:"\\2713";color:var(--accent)}&:hover{background:var(--surface)}&.zero{opacity:.45}.analyzer-menu-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:16rem}.analyzer-menu-count{color:var(--muted);font-size:.7rem;font-weight:600;font-variant-numeric:tabular-nums}}.trash-btn{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .55rem;font-size:.8rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--critical);color:var(--critical)}}.toolbar .trash-btn{margin-left:auto}triage-selector,slide-triage-tabs{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.toolbar triage-selector{margin-left:auto}triage-selector.is-empty{display:none}.triage-state-btn{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.8rem;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{background:var(--surface-active)}}.triage-state-btn.active.triage-state-deleted{color:var(--critical)}.triage-state-btn.active.triage-state-fixed{color:var(--green, #4ade80)}.triage-state-btn.active.triage-state-inprogress{color:var(--warning, #d97706)}.triage-state-btn.active.triage-state-invalid{color:var(--muted)}.triage-state-btn.active.triage-state-ignored{color:var(--accent, #2563eb)}entity-search{display:contents}view-mode-buttons{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.view-mode-btn{background:transparent;border:none;color:var(--muted);padding:.28rem .5rem;display:inline-flex;align-items:center;justify-content:center;transition:background .12s,color .12s;font-family:inherit;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}& svg{display:block}}}source-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.source-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}severity-mode-switch{display:inline-flex;align-items:center;gap:.4rem;height:30px;box-sizing:border-box;.severity-mode-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}.severity-mode-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.severity-mode-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;cursor:pointer;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}annotation-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.annotation-chip{position:relative;background:transparent;border:none;color:var(--muted);padding:0 .45rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;cursor:pointer;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.sel-with,&.sel-without{color:var(--accent);background:var(--surface-active)}&.sel-with .flag-cloth{fill:var(--accent)}&.sel-without:after{content:"";position:absolute;left:18%;right:18%;top:50%;height:1.5px;background:currentcolor;border-radius:1px;transform:rotate(-20deg);transform-origin:center;pointer-events:none}& svg{display:block}}}.toolbar-row{display:flex;gap:.75rem;flex-wrap:wrap;align-items:center}.search-row{display:inline-flex;align-items:center;gap:.65rem;flex:1 1 14rem;min-width:12rem}toolbar-search,.toolbar-search{display:inline-flex;align-items:center;gap:.5rem;flex:1;min-width:0;height:30px;box-sizing:border-box;padding:0 .65rem;background:var(--bg);border:1px solid var(--border);border-radius:6px;&:has(input:focus){border-color:var(--accent)}>svg{color:var(--muted);flex-shrink:0}&[kind] input[type=text],&.toolbar-search input[type=text]{flex:1;min-width:0;background:transparent;border:0;outline:none;color:var(--text);font:inherit;font-size:.8rem;padding:0;&:focus{border:0}&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}.search-negate-btn{flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;transition:background .12s,color .12s;& svg{width:13px;height:13px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}}@media(width<=1200px){.toolbar-row.sev-row .search-row{flex-basis:100%}}.findings-content.with-details .toolbar{max-width:1200px}severity-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.sev-chip{display:inline-flex;align-items:center;gap:.4rem;background:transparent;border:0;padding:0 .6rem;color:var(--muted);font-family:inherit;font-size:.8rem;transition:background .12s,color .12s;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.sd{width:8px;height:8px;border-radius:2px;flex-shrink:0;background:currentcolor}.n{align-self:flex-start;margin:1px -5px 0;color:var(--muted);font-variant-numeric:tabular-nums;font-size:8.5px;font-weight:600;background:var(--bg);border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px}&.active{color:var(--text);.n{color:var(--text)}}&.critical .sd{background:var(--critical)}&.high .sd{background:var(--high)}&.medium .sd{background:var(--medium)}&.low .sd{background:var(--low)}&.high_bug .sd{background:var(--high-bug)}&.bug .sd{background:var(--bug)}&.informational .sd{background:var(--info)}&.critical.active{background:rgb(from var(--critical) r g b / .25)}&.high.active{background:rgb(from var(--high) r g b / .25)}&.medium.active{background:rgb(from var(--medium) r g b / .25)}&.low.active{background:rgb(from var(--low) r g b / .25)}&.high_bug.active{background:rgb(from var(--high-bug) r g b / .25)}&.bug.active{background:rgb(from var(--bug) r g b / .25)}&.informational.active{background:rgb(from var(--info) r g b / .25)}}triage-filter{display:inline-flex;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:3px;height:30px;gap:1px;& button{width:22px;height:22px;background:transparent;border:0;border-radius:4px;padding:0;display:grid;place-items:center;position:relative;transition:background .12s;&:hover{background:rgb(from var(--text) r g b / .06)}&.active{background:rgb(from var(--text) r g b / .08);box-shadow:0 0 0 1px var(--border)}}.td{width:12px;height:12px;border-radius:50%;border:1.5px solid currentcolor;background:transparent;transition:background .12s}& button.active .td{background:currentcolor}.td.none{border-style:dashed;color:var(--muted)}.td.r{color:#fc5855}.td.b{color:#30aff8}.td.g{color:#68c36d}.td.x{color:#6e7278}.count{position:absolute;top:-2px;right:-2px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums}}
|
|
4
|
-
`;var Co=new TextEncoder,_o=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});var ke=["critical","high","medium","low","high_bug","bug","informational"];var ro=["revalidation","refuted","unreachable","confirmed","partial","unknown"],Do=new Set(ro);function gt(t){return new RegExp(`(^|/)${t}/`,"u")}function io(t){return new RegExp(`^(?:.*/)?${t}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var jo=gt("node_modules"),qo=gt("vendor"),ht="node_modules",Vo=gt(ht),Go=io(ht);function dt(){return ht}function et(t){return typeof t!="number"||!Number.isFinite(t)?null:`${t.toLocaleString()} B`}function so(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var _e=so(),k=new Proxy(_e,{get(t,o){return _e[o]},set(t,o,i){return _e[o]=i,!0},has(t,o){return o in _e},deleteProperty(t,o){return delete _e[o]},ownKeys(){return Reflect.ownKeys(_e)},getOwnPropertyDescriptor(t,o){return Object.getOwnPropertyDescriptor(_e,o)}});function Ht(){k.graphState?._cleanup&&k.graphState._cleanup(),k.graphState=null}function ao(t){t&&(_e=t)}function ut(t){if(!t)return null;let o=dt(),i=new RegExp(`^(?:.*/)?${o}/(@[^/]+/[^/]+|[^/]+)`,"u"),l=t.match(i);if(l)return l[1];let y=t.indexOf("/");return y>0?t.slice(0,y):"/"}var lo=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Tt=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function co(){if(typeof document>"u")return!1;let t=document.body?.classList;return!!t&&(t.contains("theme-light")||t.contains("theme-pink"))}var bt=new Map;function ne(t){let o=co()?Tt:lo,l=`${o===Tt?"l":"d"}:${t??"__own__"}`;if(bt.has(l))return bt.get(l);let y=t??"__own__",x=0;for(let $ of y)x=x*37+$.codePointAt(0)|0;let c=((x%o.length+o.length)%o.length*7+3)%o.length,v=o[c];return bt.set(l,v),v}function Bt(t){if(!t)return 0;let o=0;for(let i of ke)o+=t[i]??0;return o}function Ot(t){if(!t)return null;for(let o of ke)if((t[o]??0)>0)return o;return null}function Nt(t,o,i,l,y,x,h,c={}){let v=c.pkgOf??ut,$=new Set(o),e=new Map,R=new Map;for(let g of o){let _=(t[g].imports??[]).filter(K=>$.has(K));e.set(g,_);for(let K of _)R.has(K)||R.set(K,[]),R.get(K).push(g)}let P=o.map(g=>{let _=i.get(g),K=l?.get(g)??null,ee=Bt(_),H=v(g)??"__own__",J=Ot(_);return{id:g,file:g,pkg:H,x:0,y:0,deg:0,issue:J,totalIssues:ee,own:_,subtree:K,size:typeof t[g]?.size=="number"?t[g].size:null,severitySet:y?.get(g)??null,colorSet:x?.get(g)??null,findings:h?.get(g)??null,isHub:!1,label:g.split("/").pop()??g}}),L=new Map(P.map(g=>[g.file,g])),d=new Map;for(let g of o)for(let _ of e.get(g)??[]){let[K,ee]=g<_?[g,_]:[_,g],H=`${K}\0${ee}`,J=d.get(H);if(!J){let T=L.get(K),B=L.get(ee);if(!T||!B)continue;J={a:K,b:ee,cross:T.pkg!==B.pkg,fromLo:!1,fromHi:!1},d.set(H,J),T.deg++,B.deg++}g===K?J.fromLo=!0:J.fromHi=!0}let N=[...d.values()],a=new Map;for(let g=0;g<N.length;g++){let _=N[g];a.has(_.a)||a.set(_.a,[]),a.has(_.b)||a.set(_.b,[]),a.get(_.a).push(g),a.get(_.b).push(g)}let u=new Map;for(let g of P)u.set(g.pkg,(u.get(g.pkg)??0)+1);let F=[...u.entries()].toSorted((g,_)=>_[1]-g[1]).map(([g])=>g),I=new Map;for(let g of P)I.has(g.pkg)||I.set(g.pkg,[]),I.get(g.pkg).push(g);let W={files:o,nodes:P,nodeByFile:L,edges:N,adj:a,importsOf:e,importedBy:R,packages:F,pkgCount:u,byPkg:I};return uo(W),W}function uo(t){for(let o of t.nodes)o.isHub=!1;for(let o of t.edges)o.cross&&(o.fromLo&&(t.nodeByFile.get(o.b).isHub=!0),o.fromHi&&(t.nodeByFile.get(o.a).isHub=!0));for(let o of t.nodes){let i=t.importedBy.get(o.file);(!i||i.length===0)&&(o.isHub=!0)}}function Dt(t){let o=t.packages.map(c=>{let v=t.byPkg.get(c)??[],$={};for(let a of ke)$[a]=0;let e=new Set,R=new Set,P=[],L=0,d=0,N=!1;for(let a of v){if(L+=a.totalIssues,a.own)for(let u of ke)$[u]+=a.own[u]??0;if(a.severitySet)for(let u of a.severitySet)e.add(u);if(a.colorSet)for(let u of a.colorSet)R.add(u);typeof a.size=="number"&&(d+=a.size,N=!0),P.push(a.file)}return{file:c,pkg:c,label:c==="__own__"?"own source":c,fileCount:v.length,size:N?d:null,own:$,totalIssues:L,issue:Ot($),severitySet:e.size>0?e:null,colorSet:R.size>0?R:null,pathText:P.join(`
|
|
5
|
-
`).toLowerCase(),isHub:!0,x:0,y:0,deg:0}}),i=new Map(o.map(c=>[c.pkg,c])),l=new Map;for(let c of t.edges){if(!c.cross)continue;let v=t.nodeByFile.get(c.a)?.pkg,$=t.nodeByFile.get(c.b)?.pkg;if(!v||!$||v===$)continue;let[e,R]=v<$?[v,$]:[$,v],P=`${e}\0${R}`,L=l.get(P);L||(L={a:e,b:R,cross:!0,count:0,fromLo:!1,fromHi:!1},l.set(P,L),i.get(e).deg++,i.get(R).deg++),L.count++;let d=v===e;c.fromLo&&(d?L.fromLo=!0:L.fromHi=!0),c.fromHi&&(d?L.fromHi=!0:L.fromLo=!0)}let y=[...l.values()],x=new Map;for(let c=0;c<y.length;c++){let v=y[c];x.has(v.a)||x.set(v.a,[]),x.has(v.b)||x.set(v.b,[]),x.get(v.a).push(c),x.get(v.b).push(c)}let h=new Map(o.map(c=>[c.pkg,[]]));for(let c of y)c.fromLo&&h.get(c.a).push(c.b),c.fromHi&&h.get(c.b).push(c.a);return{nodes:o,byPkg:i,nodeByFile:i,edges:y,adj:x,importsOf:h}}function ft(t,o){if(!o||o==="/"||o==="__own__")return t;for(let i of["node_modules","dependencies",dt()]){let l=i+"/"+o+"/",y=t.indexOf(l);if(y>=0)return t.slice(y+l.length)}return t.startsWith(o+"/")?t.slice(o.length+1):t}function jt(t,o){let i=o.extraTopRow,l=o.hideAllFiles??!1,y=o.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0},x=o.triageStates??["inprogress","fixed","invalid","deleted"],h={};for(let u of ke)h[u]=0;for(let u of t.nodes)if(u.severitySet)for(let F of u.severitySet)h[F]!==void 0&&h[F]++;let c=ke.some(u=>h[u]>0||k.selectedSeverities.has(u)),v=["none","red","blue","green","gray"],$={none:0,red:0,blue:0,green:0,gray:0};for(let u of t.nodes)if(u.colorSet)for(let F of u.colorSet)$[F]!==void 0&&$[F]++;let e=v.some(u=>$[u]>0||k.selectedColors.has(u)),R=q`<triage-selector variant="graph" .counts="${y}" .states="${x}"></triage-selector>`,P=l?null:q`<button type="button" class="${Ce({"g2-topbar-toggle":!0,on:k.showAll})}" data-g2-show-all aria-pressed="${String(k.showAll)}"><span>All files</span><span class="g2-switch"></span></button>`,d=o.showSplitOwnDirs??!1?q`<button type="button" class="${Ce({"g2-topbar-toggle":!0,on:k.splitOwnDirs})}" data-g2-split-own aria-pressed="${String(k.splitOwnDirs)}" title="Split your own source into a group per top-level directory (off: one 'own source' group)"><span>Split dirs</span><span class="g2-switch"></span></button>`:null,a=o.showPackagesView??!1?q`<button type="button" class="${Ce({"g2-topbar-toggle":!0,on:k.packagesView})}" data-g2-packages-view aria-pressed="${String(k.packagesView)}" title="Show one node per package with aggregated import edges (off: one node per file)"><span>Packages</span><span class="g2-switch"></span></button>`:null;return q`<div class="graph2-topbar">${i?q`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${i} ${P} ${d} ${a}<div class="g2-spacer"></div>${R}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${c?q`<severity-chips .counts="${h}" .selected="${[...k.selectedSeverities]}" kind="graph"></severity-chips>`:null} ${e?q`<triage-filter .counts="${$}" .selected="${[...k.selectedColors]}" kind="graph"></triage-filter>`:null}<div class="toolbar-search g2-path-filter-wrap"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> <input type="text" class="g2-path-filter" id="g2-path-filter" placeholder="filter path/package…" .value="${k.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" title="Clear filter" aria-label="Clear filter">✕</button></div>${i?null:P} ${i?null:d} ${i?null:a}<div class="g2-spacer"></div>${i?null:R} <button type="button" class="g2-icon-btn" id="g2-fullscreen" title="Toggle fullscreen">⛶</button></div></div>`}function fo(t,o){let i=t.split("/").filter(Boolean),l=o.split("/").filter(Boolean),y=0;for(;y<i.length&&y<l.length&&i[y]===l[y];)y++;let x=i.length-y,h=l.slice(y).join("/");return x===0?"./"+h:"../".repeat(x)+h}function po(t,o){if(!o&&o!=="")return t;let i=fo(o,t);return i.length<t.length?i:t}function mt(t,o,i,l){let y=i.length;if(y===0)return q`<div class="g2-sel-section"><div class="g2-sel-section-label">${o} (${y})</div><div class="g2-sel-section-empty">none</div></div>`;let x=i.map(h=>({file:h,display:po(h,l)}));return x.sort((h,c)=>h.display.localeCompare(c.display)),q`<div class="g2-sel-section"><div class="g2-sel-section-label">${o} (${y})</div><ul class="g2-sel-file-list">${x.map(({file:h,display:c})=>{let v=t.nodeByFile.get(h),$=v?ne(v.pkg):"#666";return q`<li><button type="button" class="g2-sel-file-link" data-g2-select="${h}" title="${h}"><span class="g2-sel-file-dot" style="${Qe({background:$})}"></span> <span class="g2-sel-file-path">${c}</span></button></li>`})}</ul></div>`}function tt(t){if(!t)return q`<div class="g2-sel-section-empty">none</div>`;let i=["critical","high","medium","low","high_bug","bug","informational"].filter(l=>(t[l]??0)>0);return i.length===0?q`<div class="g2-sel-section-empty">none</div>`:q`<div class="tree-count-chips">${i.map(l=>q`<span class="${`tree-count-chip ${l}`}">${t[l]} ${l.replaceAll("_"," ")}</span>`)}</div>`}function qt(t){let o=0;for(let h of t.edges)h.cross&&o++;let i=t.edges.length-o,l=0;for(let h of t.nodes)l+=h.totalIssues;let y=t.nodes.length===0?"0.0":(t.edges.length*2/t.nodes.length).toFixed(1),x=k.focusedPkg==="__own__"?"own source":k.focusedPkg;return q`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${k.focusedPkg?q`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full" title="Back to the full graph">← ${x}</button></div>`:null}<div id="g2-focus-overlay-slot" class="g2-stage-overlay-tr"></div><div class="g2-stage-stats"><span><b>${t.nodes.length}</b> files</span> <span><b>${t.packages.length}</b> packages</span> <span><b>${t.edges.length}</b> edges (${i} intra · ${o} cross)</span> <span><b>${l}</b> issues</span> <span>avg degree <b>${y}</b></span></div><div class="g2-zoom-ctrl"><button id="g2-zoom-in" title="Zoom in">+</button><div class="g2-zoom-pct" id="g2-zoom-pct">100%</div><button id="g2-zoom-out" title="Zoom out">−</button> <button id="g2-zoom-fit" class="g2-zoom-fit-btn" title="Fit to view">fit</button></div><div class="g2-tooltip" id="g2-tooltip"></div></main>`}function Vt(t){let o=null;if(k.selected){let l=t.nodeByFile.get(k.selected);l&&(o=l.pkg)}else k.solo&&(o=k.solo);return!o||(t.pkgCount.get(o)??0)<=1||k.focusedPkg===o?null:q`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${o}" title="${`Focus on ${o==="__own__"?"own source":o}'s graph`}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 4.6 L4 11 M8 4.6 L12 11 M5 11.4 L11 11.4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><circle cx="8" cy="3.6" r="2" fill="currentColor"/><circle cx="3.6" cy="11.4" r="2" fill="currentColor"/><circle cx="12.4" cy="11.4" r="2" fill="currentColor"/></svg></button>`}function Gt(){return q`<aside class="graph2-right"><div class="g2-panel-title">Selection</div><div id="g2-selection-area"></div><div id="g2-top-pkgs-block"></div></aside>`}function Ut(t){let o=k.showAll&&t.nodes.length>0&&t.nodes.every(y=>typeof y.size=="number"),i=t.nodes.some(y=>y.totalIssues>0),l=k.topPkgsTab;return l==="size"&&!o&&(l="files"),l==="issues"&&!i&&(l="files"),q`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${i?q`<button type="button" class="${Ce({"g2-mini-tab":!0,on:l==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${Ce({"g2-mini-tab":!0,on:l==="files"})}" data-g2-top-pkgs="files">Files</button> ${o?q`<button type="button" class="${Ce({"g2-mini-tab":!0,on:l==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${bo(t,l)}`}function Wt(t,o={}){let i=k.selected;if(i){let l=t.nodeByFile.get(i);return l?go(t,l,i,o):q`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return k.solo?ho(t,k.solo):q`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function go(t,o,i,l){let y=ne(o.pkg),x=o.pkg==="__own__"?"own source":o.pkg,h=ft(i,o.pkg),c=t.importedBy.get(i)??[],v=t.importsOf.get(i)??[],$=i.lastIndexOf("/"),e=$>=0?i.slice(0,$):"";return q`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${h}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${Qe({"--dot":y,background:y})}"></span> <span class="g2-sel-pkg">${x}</span></div></div><div class="g2-sel-fullpath" title="${i}">${i}</div>${et(o.size)?q`<div class="g2-sel-size">${et(o.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${tt(o.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${tt(o.subtree)}</div><div class="g2-sel-jumps">${o.totalIssues>0?q`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${i}">Findings →</button>`:null} ${l.isBundleContext?o.origFile?q`<button type="button" class="g2-sel-jump" data-bundle-view-source="${o.origFile}">View source →</button>`:null:q`<button type="button" class="g2-sel-jump" data-g2-jump-file="${i}">Files →</button>`}</div>${mt(t,"Imported by",c,e)} ${mt(t,"Imports",v,e)}</div>`}function ho(t,o){let i=t.nodes.filter(R=>R.pkg===o),l=i.length;if(l===0)return q`<div class="g2-empty-state"><strong>Package has no files in view</strong> Toggle "All files" to widen the file set, or pick another package.</div>`;let y=ne(o),x=o==="__own__"?"own source":o,h={};for(let R of ke)h[R]=0;for(let R of i)if(R.own)for(let P of ke)h[P]+=R.own[P]??0;let c=0,v=0;for(let R of t.edges){let P=t.nodeByFile.get(R.a),L=t.nodeByFile.get(R.b);!P||!L||(P.pkg===o&&L.pkg===o?v++:(P.pkg===o||L.pkg===o)&&c++)}let $=0;for(let R of i)R.isHub&&$++;let e=new Set;for(let R of i)for(let P of t.importedBy.get(R.file)??[]){let L=t.nodeByFile.get(P);L&&L.pkg!==o&&e.add(P)}return q`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${Qe({"--dot":y,background:y})}"></span> <span class="g2-sel-id">${x}</span> <span class="g2-sel-grp">package</span></div><div class="g2-sel-body"><div class="g2-sel-row"><span class="k">Files</span><span class="v">${l}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${$}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${v}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${c}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${tt(h)}</div>${mt(t,"Imported by",[...e])}</div>`}function bo(t,o){let i=t.nodes.length||1,l=o??k.topPkgsTab,y=k.selectedSeverities,x=k.selectedColors,h=y.size>0,c=x.size>0,v=h||c,$=new Map,e=new Map,R=0,P=0;for(let a of t.nodes){let u;if(v){if(u=0,a.findings)for(let F of a.findings)h&&!y.has(F.severity)||c&&!x.has(F.color)||u++}else u=a.totalIssues;$.set(a.pkg,($.get(a.pkg)??0)+u),R+=u,typeof a.size=="number"&&(e.set(a.pkg,(e.get(a.pkg)??0)+a.size),P+=a.size)}let L;l==="issues"?L=t.packages.filter(a=>($.get(a)??0)>0).toSorted((a,u)=>{let F=$.get(a)??0,I=$.get(u)??0;return I!==F?I-F:(t.pkgCount.get(u)??0)-(t.pkgCount.get(a)??0)}):l==="size"?L=t.packages.filter(a=>(e.get(a)??0)>0).toSorted((a,u)=>{let F=e.get(a)??0,I=e.get(u)??0;return I!==F?I-F:(t.pkgCount.get(u)??0)-(t.pkgCount.get(a)??0)}):L=[...t.packages].toSorted((a,u)=>{let F=t.pkgCount.get(a)??0,I=t.pkgCount.get(u)??0;return I!==F?I-F:($.get(u)??0)-($.get(a)??0)});let d=a=>l==="issues"?R>0?(($.get(a)??0)/R*100).toFixed(2):"0":l==="size"?P>0?((e.get(a)??0)/P*100).toFixed(2):"0":(t.pkgCount.get(a)/i*100).toFixed(2),N=l==="issues"?"No packages with issues":l==="size"?"No packages with size":"No packages";return q`<div class="g2-dist-bar">${t.packages.map(a=>{let u=ne(a);return q`<span style="${Qe({background:u,width:`${d(a)}%`})}"></span>`})}</div><div class="g2-dist-list">${L.length===0?q`<div class="g2-dist-empty">${N}</div>`:null} ${Et(L,a=>a,a=>{let u=ne(a),F=t.pkgCount.get(a)??0,I=$.get(a)??0,W=e.get(a)??0,g=l==="issues"?I:l==="size"?et(W):F,_=l==="issues"?R>0?(I/R*100).toFixed(1):"0.0":l==="size"?P>0?(W/P*100).toFixed(1):"0.0":(F/i*100).toFixed(1),K=a==="__own__"?"own source":a,ee=k.solo===a;return q`<button type="button" class="${Ce({"g2-dist-item":!0,on:ee})}" data-g2-pkg="${a}" title="${K}"><span class="g2-dist-dot" style="${Qe({background:u})}"></span><span class="g2-dist-name">${K}</span><span class="g2-dist-count">${g}</span><span class="g2-dist-pct">${_}%</span></button>`})}</div>`}var xt=class extends Lt{static properties={graph:{attribute:!1},options:{attribute:!1}};static styles=[ct(Ft),ct(At),ct(It)];constructor(){super(),this.graph=null,this.options={}}render(){return this.graph?q`<div class="graph2-layout">${jt(this.graph,this.options)} ${qt(this.graph)} ${Gt()}</div>`:q``}};customElements.define("graph-layout",xt);function mo(t){let o=new Map;for(let[i,l]of t.importsOf){let y=t.nodeByFile.get(i);if(y)for(let x of l){let h=t.nodeByFile.get(x);h&&y.pkg!==h.pkg&&(o.set(y.pkg,(o.get(y.pkg)??0)+1),o.set(h.pkg,(o.get(h.pkg)??0)+1))}}return o}function xo(t){if(t.packages.length===0)return null;let o=new Set;for(let[i,l]of t.importedBy){let y=t.nodeByFile.get(i);if(y)for(let x of l){let h=t.nodeByFile.get(x);if(h&&h.pkg!==y.pkg){o.add(y.pkg);break}}}for(let i of t.packages)if(!o.has(i))return i;return null}var vo=5;function Kt(t,o){let i=new Map;for(let x of t.nodes)o.has(x.pkg)&&(i.has(x.pkg)||i.set(x.pkg,[]),i.get(x.pkg).push(x));for(let x of i.values())x.sort((h,c)=>h.isHub!==c.isHub?h.isHub?-1:1:c.deg-h.deg);let l=new Map,y=new Map;for(let[x,h]of o){let c=i.get(x);if(!c||c.length===0)continue;let v=c.length,$=0;for(let u of c)if(u.isHub)$++;else break;let e=$>0&&$<=vo,R=e?$:0,P=v-R,L=h.groupR,d=Array.from({length:v}),N=Array.from({length:v});for(let u=0;u<v;u++){let F=u*137.508*Math.PI/180,I;if(u<R)I=R<=1?0:Math.sqrt(u/(R-1))*.3*L;else{let W=u-R;I=P<=1?.4*L:(.4+Math.sqrt(W/(P-1))*.6)*L}d[u]=h.x+Math.cos(F)*I,N[u]=h.y+Math.sin(F)*I}let a=Array.from({length:v},()=>!1);for(let u=0;u<v;u++){let F=c[u],I,W;e&&F.isHub?(W=0,I=R):e?(W=R,I=v):(W=0,I=v);let g=0,_=0,K=0,ee=t.importsOf.get(F.file);if(ee)for(let B of ee){let A=l.get(B);A!==void 0&&(g+=A,_+=y.get(B),K++)}let H=t.importedBy.get(F.file);if(H)for(let B of H){let A=l.get(B);A!==void 0&&(g+=A,_+=y.get(B),K++)}let J=!1;if(K>0){g/=K,_/=K;let B=g-h.x,A=_-h.y;B*B+A*A>1&&(J=!0)}let T=-1;if(J){let B=1/0;for(let A=W;A<I;A++){if(a[A])continue;let f=d[A]-g,E=N[A]-_,U=f*f+E*E;U<B&&(B=U,T=A)}}else for(let B=W;B<I;B++)if(!a[B]){T=B;break}a[T]=!0,F.x=d[T],F.y=N[T],l.set(F.file,F.x),y.set(F.file,F.y)}}}function Yt(t,o,i){let l=o/2,y=i/2,x=Math.min(o,i)/2;if(t.packages.length===0)return;let c=xo(t),v=mo(t),$=(c?t.packages.filter(f=>f!==c):[...t.packages]).toSorted((f,E)=>{let U=(v.get(E)??0)-(v.get(f)??0);return U!==0?U:(t.pkgCount.get(E)??0)-(t.pkgCount.get(f)??0)}),e=$.length,R;e<=0?R=0:e<=6?R=.65:e<=20?R=.82:R=.95;let P=Math.max(1,Math.sqrt(50/Math.max(1,e))),L=.22,d=.12,N=.04,a=new Map,u;if(c){let f=t.pkgCount.get(c)??0,E=Math.min(L,(.012+Math.sqrt(f)*.004)*P);u=Math.max(e<=6?.4:e<=20?.36:.34,E+d+N),a.set(c,{x:l,y,size:f,groupR:E*x})}else e<=1?u=0:e<=6?u=.4:e<=20?u=.32:u=.3;if(e===0){Kt(t,a);return}let F=new Map;for(let f of t.edges){if(!f.cross)continue;let E=t.nodeByFile.get(f.a)?.pkg,U=t.nodeByFile.get(f.b)?.pkg;if(!E||!U||E===U)continue;F.has(E)||F.set(E,new Map),F.has(U)||F.set(U,new Map);let te=F.get(E),re=F.get(U);te.set(U,(te.get(U)??0)+1),re.set(E,(re.get(E)??0)+1)}let I=Math.max(1,Math.min(10,Math.round(Math.sqrt(e)/1.2))),W=Array.from({length:I+1});for(let f=0;f<=I;f++)W[f]=Math.floor(f*f/(I*I)*e);W[I]=e;let g=.2,_=Array.from({length:I}),K=Array.from({length:I});for(let f=0;f<I;f++){let E=W[f],U=W[f+1];_[f]=U-E;let te=0;for(let re=E;re<U;re++)te+=t.pkgCount.get($[re])??0;K[f]=te}let ee=Array.from({length:I});for(let f=0;f<I;f++){let E=(W[f]+W[f+1]-1)/2/Math.max(1,e-1);ee[f]=Math.sqrt(Math.max(0,E))}let H=Array.from({length:I});H[0]=ee[0];for(let f=1;f<I;f++){let E=_[f-1],U=K[f-1],te=E>0?U/E:1,re=1+g*Math.sqrt(Math.max(0,te-1));H[f]=H[f-1]+(ee[f]-ee[f-1])*re}let J=Array.from({length:I});for(let f=0;f<I;f++)J[f]=H[f]-ee[f];let T=Array.from({length:e}),B=Array.from({length:e}),A=0;for(let f=0;f<e;f++){for(;A<I-1&&f>=W[A+1];)A++;let E=f*137.508%360*Math.PI/180,te=(e<=1?0:Math.sqrt(f/(e-1)))+J[A],re=e===1?c?u:0:u+te*(R-u);T[f]=l+Math.cos(E)*re*x,B[f]=y+Math.sin(E)*re*x}for(let f=0;f<I;f++){let E=W[f],U=W[f+1],te=U-E;if(te===0)continue;let re=Array.from({length:te},()=>!1);for(let Pe=E;Pe<U;Pe++){let Le=$[Pe],ue=F.get(Le),Ue=0,We=0,Ke=0;if(ue)for(let[fe,se]of ue){let me=a.get(fe);me&&(Ue+=me.x*se,We+=me.y*se,Ke+=se)}let we=!1;if(Ke>0){Ue/=Ke,We/=Ke;let fe=Ue-l,se=We-y;fe*fe+se*se>1&&(we=!0)}let Ye=-1;if(we){let fe=1/0;for(let se=0;se<te;se++){if(re[se])continue;let me=E+se,Re=T[me]-Ue,Xe=B[me]-We,nt=Re*Re+Xe*Xe;nt<fe&&(fe=nt,Ye=se)}}else for(let fe=0;fe<te;fe++)if(!re[fe]){Ye=fe;break}re[Ye]=!0;let ot=E+Ye,st=t.pkgCount.get(Le)??0,pt=Math.min(d,(.012+Math.sqrt(st)*.004)*P);a.set(Le,{x:T[ot],y:B[ot],size:st,groupR:pt*x})}}Kt(t,a)}function vt(t,o,i){let l=o/2,y=i/2,x=Math.min(o,i)/2,h=t.nodes.length;if(h===0)return;let c=[...t.nodes].toSorted((v,$)=>$.deg-v.deg);for(let v=0;v<h;v++){let $=c[v],e=v*137.508%360*Math.PI/180,R=h<=1?0:Math.sqrt(v/(h-1));$.x=l+Math.cos(e)*R*.85*x,$.y=y+Math.sin(e)*R*.85*x}}function yt(t,o,i,l,{groupOf:y=ut}={}){let x=t.length,h=l||760,c=i||1100,v=Math.sqrt(c*h/Math.max(x,1))*1.1,$=g=>{let _=0;for(let K of g)_=_*31+K.codePointAt(0)|0;return _},e=Math.ceil(Math.sqrt(x*c/h)),R=Math.ceil(x/e),P=h/(R+1),L=c/(e+1),d=t.map((g,_)=>{let K=_%e,ee=Math.floor(_/e),H=$(g);return{file:g,x:(K+1)*L+(H%100-50)*L*.4,y:(ee+1)*P+((H>>7)%100-50)*P*.4,dx:0,dy:0}}),N=new Map(d.map((g,_)=>[g.file,_])),a=[];for(let g of t)for(let _ of o.get(g)??[])N.has(_)&&a.push([N.get(g),N.get(_)]);let u=new Map;for(let g=0;g<x;g++){let _=y(d[g].file)??"__own__";u.has(_)||u.set(_,[]),u.get(_).push(g)}let F=Math.min(500,Math.max(180,100+x*3)),I=Math.min(c,h)/6,W=.3;for(let g=0;g<F;g++){let _=I*Math.pow(W/I,g/F);for(let H of d)H.dx=0,H.dy=0;for(let H=0;H<x;H++)for(let J=H+1;J<x;J++){let T=d[H],B=d[J],A=T.x-B.x,f=T.y-B.y,E=Math.sqrt(A*A+f*f);if(E<.01){let te=$(T.file+B.file);A=(te%100-50)*.01||.5,f=((te>>7)%100-50)*.01||.5,E=Math.sqrt(A*A+f*f)}let U=v*v/E;T.dx+=A/E*U,T.dy+=f/E*U,B.dx-=A/E*U,B.dy-=f/E*U}for(let[H,J]of a){let T=d[H],B=d[J],A=T.x-B.x,f=T.y-B.y,E=Math.sqrt(A*A+f*f)||.01,U=E*E/v;T.dx-=A/E*U,T.dy-=f/E*U,B.dx+=A/E*U,B.dy+=f/E*U}let K=.055*Math.min(1,_/(I*.3));for(let[,H]of u){if(H.length<2)continue;let J=0,T=0;for(let B of H)J+=d[B].x,T+=d[B].y;J/=H.length,T/=H.length;for(let B of H)d[B].dx+=(J-d[B].x)*K,d[B].dy+=(T-d[B].y)*K}let ee=50;for(let H of d){let J=Math.sqrt(H.dx*H.dx+H.dy*H.dy)||.01;H.x+=H.dx/J*Math.min(J,_),H.y+=H.dy/J*Math.min(J,_),H.x=Math.max(ee,Math.min(c-ee,H.x)),H.y=Math.max(ee,Math.min(h-ee,H.y))}}return d}var kt={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},wt={dark:{bg:"#0c0c0c",grid:"rgba(255, 255, 255, 0.022)",selectRing:"#ffffff",edgeIntra:"rgba(180, 195, 215, ALPHA)",hubRing:"rgba(255, 255, 255, ALPHA)",labelFill:"rgba(230, 233, 238, 0.78)",labelShadow:"rgba(12, 12, 12, 0.98)",labelOutline:"rgba(12, 12, 12, 0.9)",labelDefault:"rgba(200, 210, 225, 0.78)",labelHover:"rgba(230, 237, 243, 0.95)",labelSelected:"#fff"},light:{bg:"#f6f8fa",grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:"rgba(50, 70, 100, ALPHA)",hubRing:"rgba(0, 0, 0, ALPHA)",labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"},pink:{bg:"#fff0f7",grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:"rgba(50, 70, 100, ALPHA)",hubRing:"rgba(0, 0, 0, ALPHA)",labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"}};function yo(){let t=document.body.classList;return t.contains("theme-pink")?wt.pink:t.contains("theme-light")?wt.light:wt.dark}function be(t){return Math.max(0,Math.min(255,Math.round(t*255))).toString(16).padStart(2,"0")}function ko(t,o,i,l){let x=t.querySelector("graph-layout")?.shadowRoot;if(!x)return;let h=x.querySelector("#g2-canvas"),c=x.querySelector("#g2-tooltip"),v=x.querySelector(".graph2-stage"),$=x.querySelector("#g2-zoom-pct");if(!h)return;Ht();let e=h.getContext("2d"),R=window.devicePixelRatio||1,P=0,L=0,d={tx:0,ty:0,k:1},N=null,a=0,u=0,F=!0,I=!0,W=()=>k.packagesView&&(o.canPackagesView??!1)&&!k.focusedPkg,g=null;function _(){return g||(g=Dt(o)),g}function K(r,b,p){if(r.nodes.length>50){vt(r,b,p);return}let w=yt(r.nodes.map(S=>S.pkg),r.importsOf,b,p,{groupOf:S=>S}),m=new Map(w.map(S=>[S.file,S]));for(let S of r.nodes){let M=m.get(S.pkg);M&&(S.x=M.x,S.y=M.y)}}function ee(){if(!F)return;let r=k.layoutCache,b=k.focusedPkg,p=W(),w=p?_().nodes:o.nodes;if(r&&r.files===o.files&&r.w===u&&r.h===a&&r.focused===b&&(r.pkgView??!1)===p)for(let m of w){let S=r.pos.get(m.file);S&&(m.x=S.x,m.y=S.y)}else{if(p)K(_(),u,a);else if(b)if(o.nodes.length>50)vt(o,u,a);else{let S=yt(o.files,o.importsOf,u,a),M=new Map(S.map(G=>[G.file,G]));for(let G of o.nodes){let V=M.get(G.file);V&&(G.x=V.x,G.y=V.y)}}else Yt(o,u,a);let m=new Map;for(let S of w)m.set(S.file,{x:S.x,y:S.y});k.layoutCache={files:o.files,w:u,h:a,pos:m,focused:b,pkgView:p}}F=!1}function H(){let r=W()?_().nodes:o.nodes;if(r.length===0)return{k:1,tx:L/2,ty:P/2};let b=-1/0,p=-1/0,w=1/0,m=1/0;for(let s of r)s.x<w&&(w=s.x),s.y<m&&(m=s.y),s.x>b&&(b=s.x),s.y>p&&(p=s.y);let S=Math.max(20,p-m),M=Math.max(20,b-w),G=(w+b)/2,V=(m+p)/2,D=Math.min(L,P)*.1,Y=Math.min((L-D*2)/M,(P-D*2)/S,4),n=Math.max(.05,Y);return{k:n,tx:L/2-G*n,ty:P/2-V*n}}function J(){let r=H();d.k=r.k,d.tx=r.tx,d.ty=r.ty}function T(r,b){return[r*d.k+d.tx,b*d.k+d.ty]}function B(r,b){return[(r-d.tx)/d.k,(b-d.ty)/d.k]}function A(r){return!k.hidden.has(r.pkg)}function f(r){if(k.selectedSeverities.size>0){let p=r.severitySet;if(!p)return!0;let w=!1;for(let m of k.selectedSeverities)if(p.has(m)){w=!0;break}if(!w)return!0}if(k.selectedColors.size>0){let p=r.colorSet;if(!p)return!0;let w=!1;for(let m of k.selectedColors)if(p.has(m)){w=!0;break}if(!w)return!0}if(k.solo&&r.pkg!==k.solo&&!W())return!0;let b=k.pathFilter;if(b){let p=b.toLowerCase(),w=r.pathText?r.pathText.includes(p):r.file.toLowerCase().includes(p),m=r.pkg&&r.pkg.toLowerCase().includes(p),S=r.label&&r.label.toLowerCase().includes(p);if(!w&&!m&&!S)return!0}return!1}function E(r){let b=(r.isHub?4.9:3.5)*k.nodeSize,p=Math.max(.6,Math.min(1.6,d.k));return b*p}function U(){let r=v.getBoundingClientRect(),b=P,p=L;L=Math.max(80,r.width),P=Math.max(80,r.height),R=window.devicePixelRatio||1,h.width=L*R,h.height=P*R,h.style.width=L+"px",h.style.height=P+"px",e.setTransform(R,0,0,R,0,0),(u===0||a===0)&&(u=L,a=P,F=!0),ee();let w=p>0&&(Math.abs(L-p)/p>.15||Math.abs(P-b)/b>.15);(I||w)&&(J(),I=!1),ue()}let te=null,re=!0,Pe=!1,Le=!1;function ue(){re=!0,!(Pe||Le)&&(Pe=!0,te=requestAnimationFrame(()=>{Pe=!1,re&&!Le&&(re=!1,Ue())}))}function Ue(){let r=yo();e.fillStyle=r.bg,e.fillRect(0,0,L,P),We(r);let b=W(),p=b?_():o,w=b?k.solo:k.selected,m=w?p.nodeByFile.get(w):null,S=m?w:null;if(b&&p.nodes.length<=50){Ye(r);return}if(k.focusedPkg&&p.nodes.length<=50){Ke(r,S,m);return}for(let M of p.edges){let G=p.nodeByFile.get(M.a),V=p.nodeByFile.get(M.b);if(!G||!V||!A(G)||!A(V))continue;let D=k.edgeOpacity;S?D=M.a===S||M.b===S?.85:k.edgeOpacity*.25:N&&(M.a===N||M.b===N)&&(D=Math.min(.9,D+.5)),f(G)&&f(V)&&(D=Math.min(D,.04));let[Y,n]=T(G.x,G.y),[s,C]=T(V.x,V.y);if(M.cross){let O=e.createLinearGradient(Y,n,s,C);O.addColorStop(0,ne(G.pkg)+be(D)),O.addColorStop(1,ne(V.pkg)+be(D)),e.strokeStyle=O,e.lineWidth=.85}else e.strokeStyle=r.edgeIntra.replace("ALPHA",String(D*.7)),e.lineWidth=.55;e.beginPath(),e.moveTo(Y,n),e.lineTo(s,C),e.stroke()}for(let M of p.nodes){if(!A(M))continue;let G=M.file===N,V=M.file===S;if(!M.isHub&&!G&&!V||f(M)&&!G&&!V)continue;let[D,Y]=T(M.x,M.y),s=E(M)*(V?6:G?4.5:3),C=e.createRadialGradient(D,Y,0,D,Y,s),O=ne(M.pkg);C.addColorStop(0,O+"55"),C.addColorStop(1,O+"00"),e.fillStyle=C,e.beginPath(),e.arc(D,Y,s,0,Math.PI*2),e.fill()}for(let M of p.nodes){if(!A(M))continue;let[G,V]=T(M.x,M.y),D=E(M),Y=1,n=S&&M.file===S;if(S&&!n&&(Y=(p.adj.get(S)??[]).some(C=>{let O=p.edges[C];return O.a===M.file||O.b===M.file})?1:.25),!n&&f(M)&&(Y=Math.min(Y,.1)),e.fillStyle=ne(M.pkg)+be(Y),e.beginPath(),e.arc(G,V,D,0,Math.PI*2),e.fill(),M.isHub&&(e.strokeStyle=r.hubRing.replace("ALPHA",String(.55*Y)),e.lineWidth=.8,e.stroke()),M.issue){let s=kt[M.issue],C=D+(M.issue==="critical"?4.2:M.issue==="high"?3.4:2.8),O=M.issue==="critical"?1.8:M.issue==="high"?1.5:M.issue==="medium"?1.3:1.1;e.strokeStyle=s,e.globalAlpha=Y,e.lineWidth=O,e.beginPath(),e.arc(G,V,C,0,Math.PI*2),e.stroke(),e.globalAlpha=1}}if(d.k>1.4){let G=0;if(d.k<9&&!k.showLabels)for(let D of p.nodes){if(!A(D))continue;let[Y,n]=T(D.x,D.y);if(!(Y<0||Y>L||n<0||n>P)&&(G++,G>=50))break}let V=d.k>=9||G<50;if(k.showLabels||V){e.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",e.fillStyle=r.labelFill,e.textAlign="left",e.textBaseline="middle";let D=11,Y=2,n=250,s=(z,j)=>z>-n&&z<L+n&&j>-n&&j<P+n,C=[];for(let z of p.nodes){if(!A(z))continue;let[j,X]=T(z.x,z.y);if(!s(j,X))continue;let oe=E(z);C.push({file:z.file,x0:j-oe,x1:j+oe,y0:X-oe,y1:X+oe})}let O=[];for(let z of p.nodes){if(!A(z)||!z.isHub&&d.k<2.4)continue;let[j,X]=T(z.x,z.y);if(!s(j,X))continue;let oe=E(z),xe=j+oe+4,Se=X+1,Ee=e.measureText(z.label).width+Y,Ie=z.file===S,Ae=z.file===N,Fe=Ie?3:Ae?2:z.isHub?1:0;O.push({file:z.file,n:z,tx:xe,ty:Se,prio:Fe,x0:xe-Y,x1:xe+Ee,y0:Se-D/2,y1:Se+D/2})}O.sort((z,j)=>j.prio-z.prio);let Q=[],Z=(z,j)=>z.x0<j.x1&&j.x0<z.x1&&z.y0<j.y1&&j.y0<z.y1;for(let z of O){let j=!1;for(let X of C)if(X.file!==z.file&&Z(z,X)){j=!0;break}if(!j){for(let X of Q)if(Z(z,X)){j=!0;break}}j||Q.push(z)}for(let z of Q)e.fillText(z.n.label,z.tx,z.ty)}}if(m&&A(m)){let[M,G]=T(m.x,m.y),V=E(m);e.strokeStyle=r.selectRing,e.lineWidth=1.5,e.beginPath(),e.arc(M,G,V+5,0,Math.PI*2),e.stroke()}$&&($.textContent=`${Math.round(d.k*100)}%`)}function We(r){if(d.k<.4)return;let b=80,p=(d.tx%b+b)%b,w=(d.ty%b+b)%b;e.strokeStyle=r.grid,e.lineWidth=1,e.beginPath();for(let m=p;m<L;m+=b)e.moveTo(m,0),e.lineTo(m,P);for(let m=w;m<P;m+=b)e.moveTo(0,m),e.lineTo(L,m);e.stroke()}function Ke(r,b,p){let w=ne(k.focusedPkg),m=new Set;if(N){m.add(N);for(let n of o.adj.get(N)??[]){let s=o.edges[n];m.add(s.a),m.add(s.b)}}let S=n=>(n.isHub?6:4)*k.nodeSize;for(let n of o.edges){let s=o.nodeByFile.get(n.a),C=o.nodeByFile.get(n.b);if(!s||!C||!A(s)||!A(C))continue;let O=n.fromLo&&n.fromHi,Q=!O&&n.fromHi,Z=Q?C:s,z=Q?s:C,j=N&&(n.a===N||n.b===N),X=b&&(n.a===b||n.b===b),oe=(b||N)&&!j&&!X,xe=S(Z),Se=S(z),[Ee,Ie]=T(Z.x,Z.y),[Ae,Fe]=T(z.x,z.y),He=Ae-Ee,Te=Fe-Ie,Be=Math.sqrt(He*He+Te*Te)||1,Oe=He/Be,Ne=Te/Be,ae=Ee+Oe*(xe+1.5),le=Ie+Ne*(xe+1.5),ce=Ae-Oe*(Se+3.5),de=Fe-Ne*(Se+3.5),rt=Math.min(Be*.15,30),ve=(ae+ce)/2-Ne*rt,ye=(le+de)/2+Oe*rt;e.beginPath(),e.moveTo(ae,le),e.quadraticCurveTo(ve,ye,ce,de);let pe;if(X?pe=.9:j?pe=.85:oe?pe=.05:pe=Math.min(.85,k.edgeOpacity*3),e.strokeStyle=w+be(pe),e.lineWidth=X||j?1.5:.85,e.stroke(),oe)continue;let ge=Math.max(5,7),ie=ge*.42,he=.9,ze=2*(1-he)*(ve-ae)+2*he*(ce-ve),De=2*(1-he)*(ye-le)+2*he*(de-ye),Ze=Math.sqrt(ze*ze+De*De)||1,je=ze/Ze,$e=De/Ze;if(e.beginPath(),e.moveTo(ce,de),e.lineTo(ce-je*ge+$e*ie,de-$e*ge-je*ie),e.lineTo(ce-je*ge-$e*ie,de-$e*ge+je*ie),e.closePath(),e.fillStyle=w+be(Math.min(1,pe+.15)),e.fill(),O){let at=1.8*(ve-ae)+.2*(ce-ve),qe=2*(1-.1)*(ye-le)+2*.1*(de-ye),Je=Math.sqrt(at*at+qe*qe)||1,Ve=at/Je,Me=qe/Je;e.beginPath(),e.moveTo(ae,le),e.lineTo(ae+Ve*ge-Me*ie,le+Me*ge+Ve*ie),e.lineTo(ae+Ve*ge+Me*ie,le+Me*ge-Ve*ie),e.closePath(),e.fill()}}for(let n of o.nodes){if(!A(n))continue;let[s,C]=T(n.x,n.y),O=S(n),Q=n.file===N,Z=n.file===b,z=(b||N)&&!m.has(n.file)&&!Z?.15:1;if(e.globalAlpha=z,Z||Q||n.isHub){let j=O*(Z?4:Q?3:2.4),X=e.createRadialGradient(s,C,O*.6,s,C,j);X.addColorStop(0,w+be(Z?.4:.25)),X.addColorStop(1,w+"00"),e.fillStyle=X,e.beginPath(),e.arc(s,C,j,0,Math.PI*2),e.fill()}if(e.fillStyle=w,e.beginPath(),e.arc(s,C,O,0,Math.PI*2),e.fill(),n.isHub&&(e.strokeStyle=r.hubRing.replace("ALPHA","0.55"),e.lineWidth=.9,e.stroke()),n.issue){let j=kt[n.issue],X=O+(n.issue==="critical"?4.2:n.issue==="high"?3.4:2.8),oe=n.issue==="critical"?1.8:n.issue==="high"?1.5:n.issue==="medium"?1.3:1.1;e.strokeStyle=j,e.lineWidth=oe,e.beginPath(),e.arc(s,C,X,0,Math.PI*2),e.stroke()}e.globalAlpha=1}e.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",e.textAlign="center",e.textBaseline="top",e.lineJoin="round";let M=13,G=2,V=[];for(let n of o.nodes){if(!A(n))continue;let[s,C]=T(n.x,n.y),O=S(n),Q=C+O+4,Z=e.measureText(n.label).width/2+G,z=n.file===b,j=n.file===N,X=z?3:j?2:n.isHub?1:0;V.push({n,sx:s,ty:Q,halfW:Z,isSel:z,isHov:j,prio:X,x0:s-Z,x1:s+Z,y0:Q,y1:Q+M})}V.sort((n,s)=>s.prio-n.prio);let D=[],Y=(n,s)=>n.x0<s.x1&&s.x0<n.x1&&n.y0<s.y1&&s.y0<n.y1;for(let n of V){let s=!1;for(let C of D)if(Y(n,C)){s=!0;break}s||D.push(n)}for(let n of D){let{n:s,sx:C,ty:O,isSel:Q,isHov:Z}=n,z=(b||N)&&!m.has(s.file)&&!Q?.2:1;e.globalAlpha=z,e.shadowColor=r.labelShadow,e.shadowBlur=4,e.strokeStyle=r.labelOutline,e.lineWidth=3,e.strokeText(s.label,C,O),e.shadowBlur=0,e.fillStyle=Q?r.labelSelected:Z?r.labelHover:r.labelDefault,e.fillText(s.label,C,O),e.globalAlpha=1}if(p&&A(p)){let[n,s]=T(p.x,p.y),C=S(p);e.strokeStyle=r.selectRing,e.lineWidth=1.8,e.beginPath(),e.arc(n,s,C+4,0,Math.PI*2),e.stroke()}$&&($.textContent=`${Math.round(d.k*100)}%`)}function we(r){return Math.min(26,5+Math.sqrt(r.fileCount)*1.7)*k.nodeSize}function Ye(r){let b=_(),p=k.solo&&b.byPkg.has(k.solo)?k.solo:null,w=N??p,m=new Set;if(w){m.add(w);for(let n of b.edges)n.a===w?m.add(n.b):n.b===w&&m.add(n.a)}let S=n=>{if(n.pkg===p||n.pkg===N)return 1;let s=1;return w&&!m.has(n.pkg)&&(s=.2),f(n)&&(s=Math.min(s,.1)),s};for(let n of b.edges){let s=b.byPkg.get(n.a),C=b.byPkg.get(n.b);if(!s||!C||!A(s)||!A(C))continue;let O=n.fromLo&&n.fromHi,Q=!O&&n.fromHi,Z=Q?C:s,z=Q?s:C,j=w!==null&&(n.a===w||n.b===w),X=f(s)&&f(C),oe=w!==null&&!j||X,xe=we(Z),Se=we(z),[Ee,Ie]=T(Z.x,Z.y),[Ae,Fe]=T(z.x,z.y),He=Ae-Ee,Te=Fe-Ie,Be=Math.sqrt(He*He+Te*Te)||1,Oe=He/Be,Ne=Te/Be,ae=Ee+Oe*(xe+1.5),le=Ie+Ne*(xe+1.5),ce=Ae-Oe*(Se+3.5),de=Fe-Ne*(Se+3.5),rt=Math.min(Be*.15,30),ve=(ae+ce)/2-Ne*rt,ye=(le+de)/2+Oe*rt,pe;X?pe=.05:j?pe=.9:oe?pe=.06:pe=.5;let ge=e.createLinearGradient(ae,le,ce,de);if(ge.addColorStop(0,ne(Z.pkg)+be(pe)),ge.addColorStop(1,ne(z.pkg)+be(pe)),e.beginPath(),e.moveTo(ae,le),e.quadraticCurveTo(ve,ye,ce,de),e.strokeStyle=ge,e.lineWidth=Math.min(3.5,.8+Math.sqrt(n.count)*.3)*(j?1.3:1),e.stroke(),oe)continue;let ie=7,he=ie*.42,ze=.9,De=2*(1-ze)*(ve-ae)+2*ze*(ce-ve),Ze=2*(1-ze)*(ye-le)+2*ze*(de-ye),je=Math.sqrt(De*De+Ze*Ze)||1,$e=De/je,it=Ze/je;if(e.beginPath(),e.moveTo(ce,de),e.lineTo(ce-$e*ie+it*he,de-it*ie-$e*he),e.lineTo(ce-$e*ie-it*he,de-it*ie+$e*he),e.closePath(),e.fillStyle=ne(z.pkg)+be(Math.min(1,pe+.15)),e.fill(),O){let qe=1.8*(ve-ae)+.2*(ce-ve),Je=2*(1-.1)*(ye-le)+2*.1*(de-ye),Ve=Math.sqrt(qe*qe+Je*Je)||1,Me=qe/Ve,lt=Je/Ve;e.beginPath(),e.moveTo(ae,le),e.lineTo(ae+Me*ie-lt*he,le+lt*ie+Me*he),e.lineTo(ae+Me*ie+lt*he,le+lt*ie-Me*he),e.closePath(),e.fillStyle=ne(Z.pkg)+be(Math.min(1,pe+.15)),e.fill()}}for(let n of b.nodes){if(!A(n))continue;let[s,C]=T(n.x,n.y),O=we(n),Q=n.pkg===N,Z=n.pkg===p,z=ne(n.pkg),j=S(n);if(Z||Q){let X=O*(Z?2.6:2.2),oe=e.createRadialGradient(s,C,O*.6,s,C,X);oe.addColorStop(0,z+be(Z?.4:.25)),oe.addColorStop(1,z+"00"),e.fillStyle=oe,e.beginPath(),e.arc(s,C,X,0,Math.PI*2),e.fill()}if(e.fillStyle=z+be(j),e.beginPath(),e.arc(s,C,O,0,Math.PI*2),e.fill(),n.issue){let X=kt[n.issue],oe=O+(n.issue==="critical"?4.2:n.issue==="high"?3.4:2.8),xe=n.issue==="critical"?1.8:n.issue==="high"?1.5:n.issue==="medium"?1.3:1.1;e.strokeStyle=X,e.globalAlpha=j,e.lineWidth=xe,e.beginPath(),e.arc(s,C,oe,0,Math.PI*2),e.stroke(),e.globalAlpha=1}}e.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",e.textAlign="center",e.textBaseline="top",e.lineJoin="round";let M=13,G=2,V=[];for(let n of b.nodes){if(!A(n))continue;let[s,C]=T(n.x,n.y),O=we(n),Q=C+O+4,Z=e.measureText(n.label).width/2+G,z=n.pkg===p,j=n.pkg===N,X=z?1/0:j?1e9:n.fileCount;V.push({p:n,sx:s,ty:Q,isSel:z,isHov:j,prio:X,x0:s-Z,x1:s+Z,y0:Q,y1:Q+M})}V.sort((n,s)=>s.prio-n.prio);let D=[],Y=(n,s)=>n.x0<s.x1&&s.x0<n.x1&&n.y0<s.y1&&s.y0<n.y1;for(let n of V){let s=!1;for(let C of D)if(Y(n,C)){s=!0;break}s||D.push(n)}for(let n of D){let{p:s,sx:C,ty:O,isSel:Q,isHov:Z}=n;e.globalAlpha=Math.max(.25,S(s)),e.shadowColor=r.labelShadow,e.shadowBlur=4,e.strokeStyle=r.labelOutline,e.lineWidth=3,e.strokeText(s.label,C,O),e.shadowBlur=0,e.fillStyle=Q?r.labelSelected:Z?r.labelHover:r.labelDefault,e.fillText(s.label,C,O),e.globalAlpha=1}if(p){let n=b.byPkg.get(p),[s,C]=T(n.x,n.y);e.strokeStyle=r.selectRing,e.lineWidth=1.8,e.beginPath(),e.arc(s,C,we(n)+4,0,Math.PI*2),e.stroke()}$&&($.textContent=`${Math.round(d.k*100)}%`)}function ot(r,b){let p=W(),w=p?_():o,m=p&&w.nodes.length<=50,S=null,M=1/0,G=6;for(let V of w.nodes){if(!A(V))continue;let[D,Y]=T(V.x,V.y),n=D-r,s=Y-b,C=n*n+s*s,O=(m?we(V):E(V))+G;C<O*O&&C<M&&(M=C,S=V)}return S}function st(r,b,p){if(!c)return;let w=ne(r.pkg),m=r.pkg==="__own__"?"own source":r.pkg,S=ft(r.file,r.pkg);Ge(q`<div class="g2-tt-path">${S}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${w}`}"></span> <span class="g2-tt-pkg">${m}</span></div>${r.totalIssues>0?tt(r.own):null}`,c),fe(b,p)}function pt(r,b,p){if(!c)return;let w=ne(r.pkg),m=et(r.size);Ge(q`<div class="g2-tt-path">${r.label}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${w}`}"></span> <span class="g2-tt-pkg">${r.fileCount} ${r.fileCount===1?"file":"files"}${m?` \xB7 ${m}`:""}</span></div>${r.totalIssues>0?tt(r.own):null}`,c),fe(b,p)}function fe(r,b){let p=v.getBoundingClientRect();c.classList.add("show");let w=c.offsetWidth,m=c.offsetHeight,S=r-p.left,M=b-p.top,G=p.width,V=p.height,D=12,Y=S+D;Y+w>G-4&&(Y=S-w-D),Y<4&&(Y=4);let n=M+D;n+m>V-4&&(n=M-m-D),n<4&&(n=4),c.style.left=`${Y}px`,c.style.top=`${n}px`}function se(){c&&c.classList.remove("show")}let me=!1,Re=null,Xe=!1,nt=r=>{r.button===0&&(r.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||(me=!0,Xe=!1,Re={x:r.clientX,y:r.clientY,tx:d.tx,ty:d.ty}))},St=r=>{let b=v.getBoundingClientRect(),p=r.clientX-b.left,w=r.clientY-b.top;if(me){let M=r.clientX-Re.x,G=r.clientY-Re.y;Math.abs(M)+Math.abs(G)>3&&(Xe=!0),d.tx=Re.tx+M,d.ty=Re.ty+G,se(),ue();return}let m=ot(p,w),S=N;N=m?.file??null,h.style.cursor=m?"default":"grab",m?W()?pt(m,r.clientX,r.clientY):st(m,r.clientX,r.clientY):S&&se(),N!==S&&ue()},$t=r=>{if(me&&!Xe){let b=v.getBoundingClientRect(),p=r.clientX-b.left,w=r.clientY-b.top,m=ot(p,w);W()?(k.solo=m&&k.solo!==m.pkg?m.pkg:null,k.selected=null,i(),l?.()):(k.selected=m?.file??null,i()),ue()}me=!1},Mt=()=>{let r=N!==null;N=null,se(),r&&ue()},Rt=r=>{r.preventDefault();let b=v.getBoundingClientRect(),p=r.clientX-b.left,w=r.clientY-b.top,m=Math.exp(-r.deltaY*.0015),S=H();if(m<1&&d.k<=S.k*1.0001){d.k=S.k;let D=Math.min(.4,(1-m)*3);d.tx+=(S.tx-d.tx)*D,d.ty+=(S.ty-d.ty)*D,ue();return}let[M,G]=B(p,w),V=Math.max(S.k,Math.min(9.99,d.k*m));d.k=V,d.tx=p-M*d.k,d.ty=w-G*d.k,ue()};v.addEventListener("mousedown",nt),window.addEventListener("mousemove",St),window.addEventListener("mouseup",$t),v.addEventListener("mouseleave",Mt),v.addEventListener("wheel",Rt,{passive:!1});function zt(r){let b=H().k;r=Math.max(b,Math.min(9.99,r));let p=L/2,w=P/2,[m,S]=B(p,w);d.k=r,d.tx=p-m*d.k,d.ty=w-S*d.k,ue()}let Zt=x.querySelector("#g2-zoom-in"),Jt=x.querySelector("#g2-zoom-out"),Qt=x.querySelector("#g2-zoom-fit");Zt?.addEventListener("click",()=>zt(d.k*1.4)),Jt?.addEventListener("click",()=>zt(d.k/1.4)),Qt?.addEventListener("click",()=>{J(),ue()}),U();let Ct=new ResizeObserver(()=>U());Ct.observe(v);let _t=new MutationObserver(r=>{for(let b of r){let p=(b.oldValue||"").includes("report-fullscreen"),w=document.body.classList.contains("report-fullscreen");if(p!==w){u=0,a=0,F=!0,I=!0,k.layoutCache=null,setTimeout(()=>U(),80);return}ue()}});_t.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),ue(),k.graphState={requestDraw:ue,_cleanup:()=>{Le=!0,cancelAnimationFrame(te),Ct.disconnect(),_t.disconnect(),v.removeEventListener("mousedown",nt),window.removeEventListener("mousemove",St),window.removeEventListener("mouseup",$t),v.removeEventListener("mouseleave",Mt),v.removeEventListener("wheel",Rt)}}}function Ln(t,o){let i=document.querySelector("graph-layout")?.shadowRoot;if(!i)return;let l=Xt(t),y=i.querySelector("#g2-selection-area");y&&Ge(Wt(l,o),y);let x=i.querySelector("#g2-focus-overlay-slot");x&&Ge(Vt(l),x)}function En(t){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let i=o.querySelector("#g2-top-pkgs-block");i&&Ge(Ut(Xt(t)),i)}function Xt(t){let o=Nt(t.treeData,t.files,t.ownCounts,t.transitiveCounts,t.severitySets,t.colorSets,t.fileFindings,t.options);if(t.strippedToOrig)for(let i of o.nodes)i.origFile=t.strippedToOrig.get(i.file);return o.canPackagesView=t.canPackagesView??!1,o}export{ao as _swapGraph2Impl,ko as attachGraph2Interaction,Xt as buildGraphFromPrep,Ln as refreshSidebar,En as refreshTopPkgs};
|
|
1
|
+
var wo=globalThis[Symbol.for("@rray/frontend")];if(!wo)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:it,html:z,nothing:Dn,unsafeCSS:Re,render:We,StateElement:Vi,classMap:dt,repeat:ko,styleMap:rt}=wo;var $o=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{display:grid;grid-template-columns:1fr 300px;grid-template-rows:auto 1fr;grid-template-areas:"topbar right" "stage right";min-height:0;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--graph-canvas-bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,sans-serif;font-size:12px}.graph2-layout{display:contents}:host([matrix]){grid-template-columns:minmax(0,1fr) 320px}.graph2-topbar{grid-area:topbar;display:flex;flex-direction:column;gap:.5rem;padding:.6rem .75rem;font-size:.825rem;background:var(--surface);backdrop-filter:var(--glass-blur);border-bottom:1px solid var(--graph-divider)}.graph2-topbar-row{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem;padding:0}.graph2-topbar .g2-spacer{flex:1}.g2-matrix-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:11px;& button{height:30px;padding:4px 7px;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--text);font:inherit}& button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}}.graph2-topbar triage-selector{margin-left:auto}.g2-icon-btn{width:28px;height:28px;border-radius:5px;background:var(--graph-hover-bg);border:1px solid var(--border);color:var(--muted);display:grid;place-items:center;font-family:inherit;&:hover{color:var(--accent);border-color:var(--accent)}}.g2-path-filter-wrap{position:relative;flex:0 0 12rem;padding-right:22px}.g2-path-filter-wrap .g2-path-filter-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:18px;height:18px;background:transparent;border:0;border-radius:50%;color:var(--muted);font:400 10px/1 inherit;font-family:inherit;&:hover{color:var(--text);background:var(--surface-active)}}.g2-path-filter:placeholder-shown~.g2-path-filter-clear{display:none}.g2-layout-tabs{display:inline-flex;flex-shrink:0;border:1px solid var(--border);border-radius:6px;padding:2px;gap:2px;& button{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:11px;padding:5px 7px}& button[aria-pressed=true]{background:var(--graph-hover-bg);color:var(--text);box-shadow:inset 0 0 0 1px var(--border)}}.g2-reason-filter{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:11px;& select{min-width:0;max-width:12rem;height:30px;padding:3px 6px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--text);font:inherit}}.graph2-right{grid-area:right;border-left:1px solid var(--graph-divider);background:var(--surface);backdrop-filter:var(--glass-blur);display:flex;flex-direction:column;overflow:hidden;padding:14px}.g2-panel-title{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);opacity:.85;margin:14px 0 8px;display:flex;align-items:baseline;gap:6px;&:first-child{margin-top:0}}.g2-panel-title-row{justify-content:space-between;gap:8px}#g2-top-pkgs-block{margin-top:14px;flex:1 1 0;min-height:0;display:flex;flex-direction:column}.g2-mini-tabs{display:flex;gap:1px;background:var(--graph-divider);border-radius:4px;overflow:hidden}.g2-mini-tab{background:transparent;border:0;color:var(--muted);font-family:inherit;font-weight:500;font-size:11px;line-height:1.4;text-transform:none;letter-spacing:0;padding:2px 7px;&:hover{color:var(--text);background:var(--graph-hover-bg)}&.on{background:var(--surface-active);color:var(--accent)}}.graph2-stage{grid-area:stage;position:relative;background:var(--graph-canvas-bg);overflow:hidden;cursor:grab;&:active{cursor:grabbing}& canvas{position:absolute;inset:0;width:100%;height:100%;display:block}}.g2-stage-overlay{position:absolute;top:12px;left:12px;z-index:3;display:flex;flex-direction:column;gap:4px;pointer-events:none;max-width:calc(100% - 60px)}.g2-stage-overlay>*{pointer-events:auto}.g2-stage-stats{position:absolute;bottom:10px;left:12px;z-index:2;display:flex;flex-wrap:wrap;gap:2px 14px;font:500 10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--muted);opacity:.7;text-transform:uppercase;letter-spacing:.06em;pointer-events:none;max-width:calc(100% - 80px);& b{font-weight:600;color:var(--text);opacity:1}}.g2-stage-overlay-tr{position:absolute;top:12px;right:12px;z-index:3;pointer-events:auto}.g2-focus-pkg-btn{width:28px;height:28px;display:grid;place-items:center;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;color:var(--accent);box-shadow:var(--shadow-glass);&:hover{border-color:var(--accent);background:var(--surface-active)}& svg{display:block}}.g2-back-btn{display:inline-flex;align-items:center;gap:4px;padding:6px 11px;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;color:var(--accent);font:500 11px/1 inherit;font-family:inherit;box-shadow:var(--shadow-glass);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;align-self:flex-start;&:hover{border-color:var(--accent);background:var(--surface-active)}}.g2-zoom-ctrl{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:6px;overflow:hidden;z-index:3;box-shadow:var(--shadow-glass);& button{width:28px;height:28px;background:transparent;border:0;color:var(--muted);border-bottom:1px solid var(--graph-divider);display:grid;place-items:center;font-family:inherit;font-size:13px;&:last-child{border-bottom:0}&:hover{color:var(--accent);background:var(--surface-active)}}}.g2-zoom-pct{font:500 9px/1 ui-monospace,monospace;color:var(--muted);padding:5px 0;text-align:center;border-bottom:1px solid var(--graph-divider)}.g2-zoom-ctrl .g2-zoom-fit-btn{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:9px;line-height:1;letter-spacing:-.02em;text-transform:lowercase}.g2-tooltip{position:absolute;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:7px;padding:9px 11px;pointer-events:none;min-width:170px;max-width:260px;opacity:0;transition:opacity .12s;z-index:10;box-shadow:var(--shadow-glass);&.show{opacity:1}}.g2-tt-path{font:500 11px/1.3 ui-monospace,monospace;color:var(--text);word-break:break-all;margin-bottom:4px}.g2-tt-head{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.g2-tt-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-tt-pkg{font-size:10px;color:var(--muted);word-break:break-all}.g2-tooltip .tree-count-chips{margin-top:6px}:host-context(body.theme-light) .graph2-right .tree-count-chip.medium,:host-context(body.theme-light) .g2-tooltip .tree-count-chip.medium{color:#fff}.g2-selection-card{background:var(--graph-hover-bg);border:1px solid var(--border);border-radius:8px;overflow:hidden}.g2-sel-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;align-items:center;gap:8px}.g2-sel-file-head{padding:11px 13px;border-bottom:1px solid var(--graph-divider);display:flex;flex-direction:column;gap:6px}.g2-sel-path{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-weight:600;font-size:12px;line-height:1.3;color:var(--text);word-break:break-all}.g2-sel-pkg-row{display:flex;align-items:center;gap:6px;min-width:0}.g2-sel-pkg{font-size:11px;color:var(--muted);word-break:break-all;min-width:0}.g2-sel-fullpath{padding:7px 13px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-sel-size{padding:5px 13px 7px;border-bottom:1px solid var(--graph-divider);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;font-size:10px;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums}.g2-sel-dot{width:11px;height:11px;border-radius:50%;box-shadow:0 0 0 3px color-mix(in srgb,var(--dot) 22%,transparent);flex-shrink:0}.g2-sel-id{font:600 12px/1 ui-monospace,monospace;color:var(--text);word-break:break-all;flex:1;min-width:0}.g2-sel-grp{font:500 9px/1 ui-monospace,monospace;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.g2-sel-body{padding:11px 13px}.g2-sel-row{display:flex;justify-content:space-between;gap:12px;font-size:11px;padding:5px 0;border-bottom:1px solid var(--graph-divider);&:last-child{border-bottom:0}.k{color:var(--muted);flex-shrink:0}.v{color:var(--text);font-family:ui-monospace,monospace;word-break:break-all;text-align:right;min-width:0}}.g2-sel-section{padding:9px 13px;border-top:1px solid var(--graph-divider)}.g2-sel-section-label{font-family:inherit;font-weight:600;font-size:11px;line-height:1;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);opacity:.85;margin-bottom:5px}.g2-sel-section-empty{color:var(--muted);opacity:.55;font-size:11px;font-style:italic}.g2-sel-jumps{padding:11px 13px;display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--graph-divider)}.g2-sel-jump{background:var(--surface-active);border:1px solid var(--border);color:var(--accent);border-radius:4px;padding:2px 8px;font-family:inherit;font-weight:500;font-size:11px;line-height:1.3;&:hover{border-color:var(--accent)}}.g2-sel-file-list{list-style:none;margin:0;padding:0;max-height:110px;overflow:hidden auto;-webkit-app-region:no-drag;app-region:no-drag;&::-webkit-scrollbar{width:4px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}& li{padding:0}}.g2-sel-file-link{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:3px;padding:2px 6px;min-height:20.5px;font:400 11px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,monospace;color:var(--accent);text-align:left;&:hover{background:var(--graph-hover-bg)}.g2-sel-file-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.g2-sel-file-path{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}.g2-empty-state{background:var(--graph-hover-bg);border:1px dashed var(--border);border-radius:8px;padding:18px 14px;text-align:center;color:var(--muted);font-size:11px;line-height:1.5;& strong{color:var(--text);display:block;margin-bottom:4px;font-weight:500}}.g2-dist-bar{width:100%;height:5px;border-radius:3px;overflow:hidden;display:flex;background:var(--surface-active);margin-bottom:8px;>span{display:block;height:100%}}.g2-dist-list{display:flex;flex-direction:column;gap:0;flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--border) transparent;&::-webkit-scrollbar{width:5px}&::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}}.g2-dist-empty{color:var(--muted);opacity:.55;font-size:10px;font-style:italic;padding:6px 0;text-align:center}@media print{:host{display:none!important}}
|
|
2
|
+
`;var yt=`.g2-dist-item{display:grid;grid-template-columns:8px 1fr auto auto;gap:8px;align-items:center;font-size:10px;padding:2px 6px;min-height:20.5px;margin:0 -6px;background:transparent;border:0;border-radius:4px;font-family:inherit;text-align:left;width:calc(100% + 12px);&:hover{background:var(--graph-hover-bg)}&.on{background:var(--surface-active);.g2-dist-name{color:var(--accent)}}.g2-dist-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}.g2-dist-name{color:var(--muted);font-family:ui-monospace,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.g2-dist-count{font-family:ui-monospace,monospace;color:var(--text)}.g2-dist-pct{font-family:ui-monospace,monospace;color:var(--muted);width:36px;text-align:right;opacity:.85}}
|
|
3
|
+
`;var Mo=`.tree-count-chips{display:inline-flex;gap:.25rem;flex-wrap:wrap}.tree-count-chip{display:inline-block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em;padding:.1rem .4rem;border-radius:3px;line-height:1.3;&.critical{background:var(--critical);color:#fff}&.high{background:var(--high);color:#fff}&.medium{background:var(--medium);color:#000}&.low{background:var(--low);color:#000}&.high_bug{background:var(--high-bug);color:#fff}&.bug{background:var(--bug);color:#fff}&.informational{background:var(--info);color:#fff}}
|
|
4
|
+
`;var So=`.toolbar{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem;padding:.6rem .75rem;background:var(--surface);backdrop-filter:var(--glass-blur);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-glass);font-size:.825rem;& label{color:var(--muted);margin-right:.15rem}& select{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .4rem;font-size:.8rem;&:focus{border-color:var(--accent);outline:none}}& select.sort-select{padding:.3rem 1.7rem .3rem .55rem;min-width:8.5rem;font-weight:500;appearance:none;-webkit-appearance:none;background:transparent}:is(repo-filter,revalidate-filter,findings-sort){position:relative;display:inline-block;&:after{content:"";position:absolute;right:.7rem;top:50%;width:.35rem;height:.35rem;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-70%) rotate(45deg);pointer-events:none}}& analyzer-select{position:relative;display:inline-block}.analyzer-btn{display:inline-flex;align-items:center;gap:.45rem;height:30px;box-sizing:border-box;padding:.3rem .55rem;min-width:8.5rem;background:transparent;color:var(--text);border:1px solid var(--border);border-radius:4px;font-family:inherit;font-size:.8rem;font-weight:500;&:hover{border-color:var(--accent)}&:focus-visible{border-color:var(--accent);outline:none}&.active{color:var(--accent)}.analyzer-btn-label{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:18rem}& svg{color:var(--muted);flex-shrink:0}}& range-slider{color:var(--accent);margin:0 .25rem}.conf-vals{color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;font-variant-numeric:tabular-nums;.dash{color:var(--muted);margin:0 .15rem}}& conf-filter{position:relative;display:inline-flex;align-items:center;height:30px;box-sizing:border-box;padding:0 .55rem;gap:.5rem;background:transparent;border:1px solid var(--border);border-radius:4px;.conf-range-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}& range-slider{margin:0}.conf-range{display:inline-flex;align-items:center;gap:.5rem}:is(.conf-range,.conf-range-label).replaced{visibility:hidden}:is(.conf-range,.conf-range-label).disabled{opacity:.35}& revalidate-filter{position:relative;display:inline-flex;align-items:center;flex:none;width:1.4rem;.sort-select{width:100%;border:0;height:auto;min-width:0;padding:0 .95rem 0 .2rem;font-size:.72rem;color:var(--muted);cursor:pointer;&:hover{color:var(--text)}}&:after{right:.25rem}&.replaces{position:static;.sort-select{position:absolute;inset:0 .55rem;width:auto;padding-left:0;color:var(--text)}&:after{right:.8rem}}.partial-cycle{position:absolute;right:1.75rem;top:50%;transform:translateY(-50%);z-index:1;padding:.1rem .3rem;border-radius:3px;font:inherit;font-size:.66rem;line-height:1.4;white-space:nowrap;cursor:pointer;--chip: var(--muted);color:var(--chip);border:1px solid rgb(from var(--chip) r g b / .45);background:rgb(from var(--chip) r g b / .1);&.included{--chip: var(--green)}&.excluded{--chip: var(--critical)}&.only{--chip: var(--yellow)}&:hover{background:rgb(from var(--chip) r g b / .22)}&:focus-visible{outline:1px solid var(--accent);outline-offset:1px}}}}& input[type=text]{background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .4rem;font-size:.8rem;flex:1;min-width:8rem;&:focus{border-color:var(--accent);outline:none}}.result-count{color:var(--muted);margin-left:auto}.checkbox-label{display:inline-flex;align-items:center;gap:.25rem;color:var(--muted);& input{margin:0}}}.analyzer-menu[popover]{position:fixed;inset:auto;margin:0;align-items:stretch;gap:.35rem;padding:.3rem;background:var(--bg);border:1px solid var(--border);border-radius:6px;box-shadow:0 4px 12px #00000040;font-size:.825rem;-webkit-app-region:no-drag;app-region:no-drag}.analyzer-menu[popover]:not(:popover-open){display:none}.analyzer-menu[popover]:popover-open{display:flex}.analyzer-menu-sep{border-left:1px solid var(--border)}.analyzer-menu-col{display:flex;flex-direction:column;gap:1px;min-width:9rem;max-height:60vh;overflow-y:auto}.analyzer-menu-head{padding:.25rem .5rem .2rem;color:var(--muted);font-size:.68rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase}.analyzer-menu-item{display:flex;align-items:center;gap:.45rem;background:transparent;border:0;border-radius:3px;padding:.3rem .5rem;color:var(--text);text-align:left;font-family:inherit;font-size:.78rem;&:before{content:"";width:.8rem;flex-shrink:0}&.active:before{content:"\\2713";color:var(--accent)}&:hover{background:var(--surface)}&.zero{opacity:.45}.analyzer-menu-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:16rem}.analyzer-menu-count{color:var(--muted);font-size:.7rem;font-weight:600;font-variant-numeric:tabular-nums}}download-button{display:contents}.toolbar-export-btn{height:30px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;padding:0 .55rem;background:transparent;color:var(--muted);border:1px solid var(--border);border-radius:4px;font-family:inherit;transition:background .12s,color .12s;&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}& svg{display:block}}.trash-btn{height:30px;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:.25rem .55rem;font-size:.8rem;font-family:inherit;&:hover{border-color:var(--accent)}&.active{border-color:var(--critical);color:var(--critical)}}.toolbar .trash-btn{margin-left:auto}triage-selector,slide-triage-tabs{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.toolbar triage-selector{margin-left:auto}.toolbar-end{display:flex;align-items:center;gap:.75rem;margin-left:auto;&:not(:has(.toolbar-export-btn,annotation-filter,revalidation-switch)){display:none}}revalidation-switch{display:inline-flex;align-items:center;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.revalidation-toggle{height:100%;&:has(+.revalidation-detail){border-right:1px solid var(--border)}}.revalidation-conflicts{padding:0 .6rem;background:transparent;border:none;color:var(--text);font:inherit;font-size:.78rem;cursor:default;&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-detail{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s,opacity .12s;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.revalidation-upstream{display:inline-flex;align-items:center;justify-content:center;width:30px;height:100%;box-sizing:border-box;padding:0;background:transparent;border:none;color:var(--muted);cursor:default;transition:background .12s,color .12s;&:not(:first-child){border-left:1px solid var(--border)}&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .06)}&.on{color:var(--accent);background:var(--surface-active)}&:disabled{opacity:.4;cursor:default}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}triage-selector.is-empty{display:none}.triage-state-btn{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;gap:.35rem;transition:background .12s,color .12s;font-family:inherit;font-size:.8rem;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{background:var(--surface-active)}}.triage-state-btn.active.triage-state-deleted{color:var(--critical)}.triage-state-btn.active.triage-state-fixed{color:var(--green, #4ade80)}.triage-state-btn.active.triage-state-inprogress{color:var(--warning, #d97706)}.triage-state-btn.active.triage-state-invalid{color:var(--muted)}.triage-state-btn.active.triage-state-ignored{color:var(--accent, #2563eb)}entity-search{display:contents}view-mode-buttons{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.view-mode-btn{background:transparent;border:none;color:var(--muted);padding:.28rem .5rem;display:inline-flex;align-items:center;justify-content:center;transition:background .12s,color .12s;font-family:inherit;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}& svg{display:block}}}source-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.source-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}severity-mode-switch{display:inline-flex;align-items:center;gap:.4rem;height:30px;box-sizing:border-box;.severity-mode-label{color:var(--muted);font-size:.7rem;font-weight:500;letter-spacing:.04em}.severity-mode-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}.severity-mode-chip{background:transparent;border:none;color:var(--muted);padding:0 .55rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;font-family:inherit;font-size:.75rem;cursor:pointer;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.active{color:var(--accent);background:var(--surface-active)}}}annotation-filter{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden;.annotation-chip{position:relative;background:transparent;border:none;color:var(--muted);padding:0 .45rem;display:inline-flex;align-items:center;transition:background .12s,color .12s;cursor:default;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}&.sel-with,&.sel-without{color:var(--accent);background:var(--surface-active)}&.sel-with .flag-cloth{fill:var(--accent)}&.sel-without:after{content:"";position:absolute;left:18%;right:18%;top:50%;height:1.5px;background:currentcolor;border-radius:1px;transform:rotate(-20deg);transform-origin:center;pointer-events:none}& svg{display:block}}}.toolbar-row{display:flex;gap:.75rem;flex-wrap:wrap;align-items:center}.search-row{display:inline-flex;align-items:center;gap:.65rem;flex:1 1 14rem;min-width:12rem}toolbar-search,.toolbar-search{display:inline-flex;align-items:center;gap:.5rem;flex:1;min-width:0;height:30px;box-sizing:border-box;padding:0 .65rem;background:var(--bg);border:1px solid var(--border);border-radius:6px;&:has(input:focus){border-color:var(--accent)}>svg{color:var(--muted);flex-shrink:0}&[kind] input[type=text],&.toolbar-search input[type=text]{flex:1;min-width:0;background:transparent;border:0;outline:none;color:var(--text);font:inherit;font-size:.8rem;padding:0;&:focus{border:0}&::placeholder{color:var(--muted)}&:focus::placeholder{color:transparent}&::-webkit-search-cancel-button{display:none}}}.search-negate-btn{flex-shrink:0;width:20px;height:20px;display:grid;place-items:center;background:transparent;color:var(--muted);border:0;border-radius:3px;padding:0;transition:background .12s,color .12s;& svg{width:13px;height:13px}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .08)}&.active{color:var(--accent);background:rgb(from var(--text) r g b / .1)}}@media(width<=1200px){.toolbar-row.sev-row .search-row{flex-basis:100%}}severity-chips{display:inline-flex;height:30px;box-sizing:border-box;border:1px solid var(--border);border-radius:4px;overflow:hidden}severity-chips>.sev-chip{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:0;padding:0 .4rem;color:var(--muted);font-family:inherit;font-size:.8rem;transition:background .12s,color .12s;&:not(:last-child){border-right:1px solid var(--border)}&:hover{color:var(--text);background:rgb(from var(--text) r g b / .06)}.sd{width:8px;height:8px;border-radius:2px;flex-shrink:0;background:currentcolor}}:is(.sev-chip,.triage-state-btn){.n{align-self:flex-start;margin:1px -5px 0;color:var(--muted);font-variant-numeric:tabular-nums;font-size:8.5px;font-weight:600;background:var(--bg);border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px}&.active .n{color:var(--text)}}severity-chips>button.sev-chip{&.active{color:var(--text)}&.critical .sd{background:var(--critical)}&.high .sd{background:var(--high)}&.medium .sd{background:var(--medium)}&.low .sd{background:var(--low)}&.high_bug .sd{background:var(--high-bug)}&.bug .sd{background:var(--bug)}&.informational .sd{background:var(--info)}&.critical.active{background:rgb(from var(--critical) r g b / .25)}&.high.active{background:rgb(from var(--high) r g b / .25)}&.medium.active{background:rgb(from var(--medium) r g b / .25)}&.low.active{background:rgb(from var(--low) r g b / .25)}&.high_bug.active{background:rgb(from var(--high-bug) r g b / .25)}&.bug.active{background:rgb(from var(--bug) r g b / .25)}&.informational.active{background:rgb(from var(--info) r g b / .25)}}triage-filter{display:inline-flex;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:3px;height:30px;gap:1px;& button{width:22px;height:22px;background:transparent;border:0;border-radius:4px;padding:0;display:grid;place-items:center;position:relative;transition:background .12s;&:hover{background:rgb(from var(--text) r g b / .06)}&.active{background:rgb(from var(--text) r g b / .08);box-shadow:0 0 0 1px var(--border)}}.td{width:12px;height:12px;border-radius:50%;border:1.5px solid currentcolor;background:transparent;transition:background .12s}& button.active .td{background:currentcolor}.td.none{border-style:dashed;color:var(--muted)}.td.r{color:#fc5855}.td.b{color:#30aff8}.td.g{color:#68c36d}.td.x{color:#6e7278}.count{position:absolute;top:-2px;right:-2px;background:var(--bg);color:var(--muted);font-size:8.5px;font-weight:600;border-radius:999px;padding:0 3px;min-width:11px;text-align:center;line-height:11px;font-variant-numeric:tabular-nums}}
|
|
5
|
+
`;var Nt=globalThis,_o=e=>e,wt=Nt.trustedTypes,Ao=wt?wt.createPolicy("lit-html",{createHTML:e=>e}):void 0,Dt="$lit$",Fe=`lit$${Math.random().toFixed(9).slice(2)}$`,Ut="?"+Fe,qn=`<${Ut}>`,Ze=document,kt=()=>Ze.createComment(""),pt=e=>e===null||typeof e!="object"&&typeof e!="function",Vt=Array.isArray,Eo=e=>Vt(e)||typeof e?.[Symbol.iterator]=="function",Bt=`[
|
|
6
|
+
\f\r]`,ut=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ro=/-->/g,To=/>/g,Ye=RegExp(`>|${Bt}(?:([^\\s"'>=/]+)(${Bt}*=${Bt}*(?:[^
|
|
7
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,Io=/"/g,Po=/^(?:script|style|textarea|title)$/i,Xt=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),Yi=Xt(1),Ki=Xt(2),Zi=Xt(3),_e=Symbol.for("lit-noChange"),ie=Symbol.for("lit-nothing"),Lo=new WeakMap,Ke=Ze.createTreeWalker(Ze,129);function zo(e,t){if(!Vt(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ao!==void 0?Ao.createHTML(t):t}var Oo=(e,t)=>{let o=e.length-1,n=[],i,s=t===2?"<svg>":t===3?"<math>":"",c=ut;for(let h=0;h<o;h++){let d=e[h],u,l,r=-1,M=0;for(;M<d.length&&(c.lastIndex=M,l=c.exec(d),l!==null);)M=c.lastIndex,c===ut?l[1]==="!--"?c=Ro:l[1]!==void 0?c=To:l[2]!==void 0?(Po.test(l[2])&&(i=RegExp("</"+l[2],"g")),c=Ye):l[3]!==void 0&&(c=Ye):c===Ye?l[0]===">"?(c=i??ut,r=-1):l[1]===void 0?r=-2:(r=c.lastIndex-l[2].length,u=l[1],c=l[3]===void 0?Ye:l[3]==='"'?Io:Co):c===Io||c===Co?c=Ye:c===Ro||c===To?c=ut:(c=Ye,i=void 0);let y=c===Ye&&e[h+1].startsWith("/>")?" ":"";s+=c===ut?d+qn:r>=0?(n.push(u),d.slice(0,r)+Dt+d.slice(r)+Fe+y):d+Fe+(r===-2?h:y)}return[zo(e,s+(e[o]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),n]},ft=class e{constructor({strings:t,_$litType$:o},n){let i;this.parts=[];let s=0,c=0,h=t.length-1,d=this.parts,[u,l]=Oo(t,o);if(this.el=e.createElement(u,n),Ke.currentNode=this.el.content,o===2||o===3){let r=this.el.content.firstChild;r.replaceWith(...r.childNodes)}for(;(i=Ke.nextNode())!==null&&d.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(let r of i.getAttributeNames())if(r.endsWith(Dt)){let M=l[c++],y=i.getAttribute(r).split(Fe),m=/([.?@])?(.*)/.exec(M);d.push({type:1,index:s,name:m[2],strings:y,ctor:m[1]==="."?Mt:m[1]==="?"?St:m[1]==="@"?_t:Qe}),i.removeAttribute(r)}else r.startsWith(Fe)&&(d.push({type:6,index:s}),i.removeAttribute(r));if(Po.test(i.tagName)){let r=i.textContent.split(Fe),M=r.length-1;if(M>0){i.textContent=wt?wt.emptyScript:"";for(let y=0;y<M;y++)i.append(r[y],kt()),Ke.nextNode(),d.push({type:2,index:++s});i.append(r[M],kt())}}}else if(i.nodeType===8)if(i.data===Ut)d.push({type:2,index:s});else{let r=-1;for(;(r=i.data.indexOf(Fe,r+1))!==-1;)d.push({type:7,index:s}),r+=Fe.length-1}s++}}static createElement(t,o){let n=Ze.createElement("template");return n.innerHTML=t,n}};function Je(e,t,o=e,n){if(t===_e)return t;let i=n!==void 0?o._$Co?.[n]:o._$Cl,s=pt(t)?void 0:t._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(e),i._$AT(e,o,n)),n!==void 0?(o._$Co??=[])[n]=i:o._$Cl=i),i!==void 0&&(t=Je(e,i._$AS(e,t.values),i,n)),t}var $t=class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:o},parts:n}=this._$AD,i=(t?.creationScope??Ze).importNode(o,!0);Ke.currentNode=i;let s=Ke.nextNode(),c=0,h=0,d=n[0];for(;d!==void 0;){if(c===d.index){let u;d.type===2?u=new gt(s,s.nextSibling,this,t):d.type===1?u=new d.ctor(s,d.name,d.strings,this,t):d.type===6&&(u=new At(s,this,t)),this._$AV.push(u),d=n[++h]}c!==d?.index&&(s=Ke.nextNode(),c++)}return Ke.currentNode=Ze,i}p(t){let o=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,o),o+=n.strings.length-2):n._$AI(t[o])),o++}},gt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,n,i){this.type=2,this._$AH=ie,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,o=this._$AM;return o!==void 0&&t?.nodeType===11&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=Je(this,t,o),pt(t)?t===ie||t==null||t===""?(this._$AH!==ie&&this._$AR(),this._$AH=ie):t!==this._$AH&&t!==_e&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Eo(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==ie&&pt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ze.createTextNode(t)),this._$AH=t}$(t){let{values:o,_$litType$:n}=t,i=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=ft.createElement(zo(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(o);else{let s=new $t(i,this),c=s.u(this.options);s.p(o),this.T(c),this._$AH=s}}_$AC(t){let o=Lo.get(t.strings);return o===void 0&&Lo.set(t.strings,o=new ft(t)),o}k(t){Vt(this._$AH)||(this._$AH=[],this._$AR());let o=this._$AH,n,i=0;for(let s of t)i===o.length?o.push(n=new e(this.O(kt()),this.O(kt()),this,this.options)):n=o[i],n._$AI(s),i++;i<o.length&&(this._$AR(n&&n._$AB.nextSibling,i),o.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t!==this._$AB;){let n=_o(t).nextSibling;_o(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Qe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,n,i,s){this.type=1,this._$AH=ie,this._$AN=void 0,this.element=t,this.name=o,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ie}_$AI(t,o=this,n,i){let s=this.strings,c=!1;if(s===void 0)t=Je(this,t,o,0),c=!pt(t)||t!==this._$AH&&t!==_e,c&&(this._$AH=t);else{let h=t,d,u;for(t=s[0],d=0;d<s.length-1;d++)u=Je(this,h[n+d],o,d),u===_e&&(u=this._$AH[d]),c||=!pt(u)||u!==this._$AH[d],u===ie?t=ie:t!==ie&&(t+=(u??"")+s[d+1]),this._$AH[d]=u}c&&!i&&this.j(t)}j(t){t===ie?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Mt=class extends Qe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ie?void 0:t}},St=class extends Qe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ie)}},_t=class extends Qe{constructor(t,o,n,i,s){super(t,o,n,i,s),this.type=5}_$AI(t,o=this){if((t=Je(this,t,o,0)??ie)===_e)return;let n=this._$AH,i=t===ie&&n!==ie||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==ie&&(n===ie||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},At=class{constructor(t,o,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Je(this,t)}},Fo={M:Dt,P:Fe,A:Ut,C:1,L:Oo,R:$t,D:Eo,V:Je,I:gt,H:Qe,N:St,U:_t,B:Mt,F:At},Gn=Nt.litHtmlPolyfillSupport;Gn?.(ft,gt),(Nt.litHtmlVersions??=[]).push("3.3.3");var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Rt=e=>(...t)=>({_$litDirective$:e,values:t}),st=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,o,n){this._$Ct=t,this._$AM=o,this._$Ci=n}_$AS(t,o){return this.update(t,o)}update(t,o){return this.render(...o)}};var{I:tr}=Fo;var Ho=e=>e.strings===void 0;var Wn={},Bo=(e,t=Wn)=>e._$AH=t;var No=Rt(class extends st{constructor(e){if(super(e),e.type!==He.PROPERTY&&e.type!==He.ATTRIBUTE&&e.type!==He.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ho(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===_e||t===ie)return t;let o=e.element,n=e.name;if(e.type===He.PROPERTY){if(t===o[n])return _e}else if(e.type===He.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(n))return _e}else if(e.type===He.ATTRIBUTE&&o.getAttribute(n)===t+"")return _e;return Bo(e),t}});var ht=class extends st{constructor(t){if(super(t),this.it=ie,t.type!==He.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===ie||t==null)return this._t=void 0,this.it=t;if(t===_e)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let o=[t];return o.raw=o,this._t={_$litType$:this.constructor.resultType,strings:o,values:[]}}};ht.directiveName="unsafeHTML",ht.resultType=1;var Tt=Rt(ht);var Do='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>',Uo='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1" y="1.5" width="14" height="3" rx=".5"/><rect x="1" y="6.5" width="8" height="3" rx=".5"/><rect x="11" y="6.5" width="4" height="3" rx=".5"/><rect x="1" y="11.5" width="4" height="3" rx=".5"/><rect x="7" y="11.5" width="8" height="3" rx=".5"/></svg>',Vo='<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M1 1h4v4H1zm5 5h4v4H6zm5 5h4v4h-4z"/><path d="M6 1h4v4H6zm5 0h4v4h-4zM1 6h4v4H1zm10 0h4v4h-4zM1 11h4v4H1zm5 0h4v4H6z" opacity=".35"/></svg>';var ye=["critical","high","medium","low","high_bug","bug","informational"];var jt=["revalidation","refuted","unreachable","confirmed","partial","unknown"],mr=new Set(jt);var wr=new TextEncoder,kr=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function qt(e){return new RegExp(`(^|/)${e}/`,"u")}function ui(e){return new RegExp(`^(?:.*/)?${e}/(?:@[^/]+/[^/]+|[^/]+)/(.*)$`,"u")}var zr=qt("node_modules"),Or=qt("vendor"),Gt="node_modules",Fr=qt(Gt),Hr=ui(Gt);function Ct(){return Gt}function Be(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function pi(){return{showAll:!1,splitOwnDirs:!1,packagesView:!1,bundleLayout:"graph",bundleReason:null,bundleReasonFor:null,selected:null,focusedPkg:null,topPkgsTab:"issues",edgeOpacity:.22,nodeSize:1,showLabels:!1,selectedSeverities:new Set,selectedColors:new Set,pathFilter:"",hidden:new Set,solo:null,graphState:null,layoutCache:null}}var Ue=pi(),k=new Proxy(Ue,{get(e,t){return Ue[t]},set(e,t,o){return Ue[t]=o,!0},has(e,t){return t in Ue},deleteProperty(e,t){return delete Ue[t]},ownKeys(){return Reflect.ownKeys(Ue)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(Ue,t)}});function jo(){k.graphState?._cleanup&&k.graphState._cleanup(),k.graphState=null}function fi(e){e&&(Ue=e)}function It(e){if(!e)return null;let t=Ct(),o=new RegExp(`^(?:.*/)?${t}/(@[^/]+/[^/]+|[^/]+)`,"u"),n=e.match(o);if(n)return n[1];let i=e.indexOf("/");return i>0?e.slice(0,i):"/"}var gi=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],hi=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function mi(){if(typeof document>"u")return!1;let e=document.body?.classList;return!!e&&(e.contains("theme-light")||e.contains("theme-pink"))}var Wt=new Map;function le(e){let t=mi(),o=t?hi:gi,n=e??"__own__",i=`${t?"l":"d"}:${n}`;if(Wt.has(i))return Wt.get(i);let s=0;for(let u of n)s=s*37+u.codePointAt(0)|0;let h=((s%o.length+o.length)%o.length*7+3)%o.length,d=o[h];return Wt.set(i,d),d}function qo(e){if(!e)return 0;let t=0;for(let o of ye)t+=e[o]??0;return t}function Go(e){let t=new Map;for(let o=0;o<e.length;o++){let n=e[o];t.has(n.a)||t.set(n.a,[]),t.has(n.b)||t.set(n.b,[]),t.get(n.a).push(o),t.get(n.b).push(o)}return t}function Wo(e){if(!e)return null;for(let t of ye)if((e[t]??0)>0)return t;return null}function Yo(e,t,o,n,i,s,c,h={}){let d=h.pkgOf??It,u=new Set(t),l=new Map,r=new Map;for(let v of t){let S=(e[v].imports??[]).filter(H=>u.has(H));l.set(v,S);for(let H of S)r.has(H)||r.set(H,[]),r.get(H).push(v)}let M=t.map(v=>{let S=o.get(v),H=n?.get(v)??null,X=qo(S),T=d(v)??"__own__",x=Wo(S);return{id:v,file:v,pkg:T,x:0,y:0,deg:0,issue:x,totalIssues:X,own:S,subtree:H,size:typeof e[v]?.size=="number"?e[v].size:null,severitySet:i?.get(v)??null,colorSet:s?.get(v)??null,findings:c?.get(v)??null,isHub:!1,label:v.split("/").pop()??v}}),y=new Map(M.map(v=>[v.file,v])),m=new Map;for(let v of t)for(let S of l.get(v)??[]){let[H,X]=v<S?[v,S]:[S,v],T=`${H}\0${X}`,x=m.get(T);if(!x){let B=y.get(H),E=y.get(X);if(!B||!E)continue;x={a:H,b:X,cross:B.pkg!==E.pkg,fromLo:!1,fromHi:!1},m.set(T,x),B.deg++,E.deg++}v===H?x.fromLo=!0:x.fromHi=!0}let F=[...m.values()],a=Go(F),b=new Map;for(let v of M)b.set(v.pkg,(b.get(v.pkg)??0)+1);let A=[...b.entries()].toSorted((v,S)=>S[1]-v[1]).map(([v])=>v),f=new Map;for(let v of M)f.has(v.pkg)||f.set(v.pkg,[]),f.get(v.pkg).push(v);let w={files:t,nodes:M,nodeByFile:y,edges:F,adj:a,importsOf:l,importedBy:r,packages:A,pkgCount:b,byPkg:f};return bi(w),w}function bi(e){for(let t of e.nodes)t.isHub=!1;for(let t of e.edges)t.cross&&(t.fromLo&&(e.nodeByFile.get(t.b).isHub=!0),t.fromHi&&(e.nodeByFile.get(t.a).isHub=!0));for(let t of e.nodes){let o=e.importedBy.get(t.file);(!o||o.length===0)&&(t.isHub=!0)}}function Ko(e){let t=e.packages.map(h=>{let d=e.byPkg.get(h)??[],u={};for(let a of ye)u[a]=0;let l=new Set,r=new Set,M=[],y=0,m=0,F=!1;for(let a of d){if(y+=a.totalIssues,a.own)for(let b of ye)u[b]+=a.own[b]??0;if(a.severitySet)for(let b of a.severitySet)l.add(b);if(a.colorSet)for(let b of a.colorSet)r.add(b);typeof a.size=="number"&&(m+=a.size,F=!0),M.push(a.file)}return{file:h,pkg:h,label:Te(h),fileCount:d.length,size:F?m:null,own:u,totalIssues:y,issue:Wo(u),severitySet:l.size>0?l:null,colorSet:r.size>0?r:null,pathText:M.join(`
|
|
8
|
+
`).toLowerCase(),isHub:!0,x:0,y:0,deg:0}}),o=new Map(t.map(h=>[h.pkg,h])),n=new Map;for(let h of e.edges){if(!h.cross)continue;let d=e.nodeByFile.get(h.a)?.pkg,u=e.nodeByFile.get(h.b)?.pkg;if(!d||!u||d===u)continue;let[l,r]=d<u?[d,u]:[u,d],M=`${l}\0${r}`,y=n.get(M);y||(y={a:l,b:r,cross:!0,count:0,fromLo:!1,fromHi:!1},n.set(M,y),o.get(l).deg++,o.get(r).deg++),y.count++;let m=d===l;h.fromLo&&(m?y.fromLo=!0:y.fromHi=!0),h.fromHi&&(m?y.fromHi=!0:y.fromLo=!0)}let i=[...n.values()],s=Go(i),c=new Map(t.map(h=>[h.pkg,[]]));for(let h of i)h.fromLo&&c.get(h.a).push(h.b),h.fromHi&&c.get(h.b).push(h.a);return{nodes:t,byPkg:o,nodeByFile:o,edges:i,adj:s,importsOf:c}}function Te(e){return e==="__own__"?"own source":e}function Lt(e,t){if(!t||t==="/"||t==="__own__")return e;for(let o of["node_modules","dependencies",Ct()]){let n=o+"/"+t+"/",i=e.indexOf(n);if(i>=0)return e.slice(i+n.length)}return e.startsWith(t+"/")?e.slice(t.length+1):e}function Kt(e,t,o=null){let n=t.showBundleLayouts&&k.bundleLayout==="layers",i=t.showBundleLayouts&&k.bundleLayout==="matrix",s=t.showBundleLayouts?z`<div class="g2-layout-tabs" role="group" aria-label="Bundle layout"><button type="button" data-g2-layout="graph" aria-label="Graph" aria-pressed="${String(!n&&!i)}">${Tt(Do)}</button> <button type="button" data-g2-layout="layers" aria-label="Layers" aria-pressed="${String(!!n)}">${Tt(Uo)}</button> <button type="button" data-g2-layout="matrix" aria-label="Matrix" aria-pressed="${String(!!i)}">${Tt(Vo)}</button></div>`:null,c=t.extraTopRow,h=t.hideAllFiles??!1,d=t.triageCounts??{inprogress:0,fixed:0,invalid:0,deleted:0},u=t.triageStates??["inprogress","fixed","invalid","deleted"],l={};for(let S of ye)l[S]=0;for(let S of e.nodes)if(S.severitySet)for(let H of S.severitySet)l[H]!==void 0&&l[H]++;let r=ye.some(S=>l[S]>0||k.selectedSeverities.has(S)),M=["none","red","blue","green","gray"],y={none:0,red:0,blue:0,green:0,gray:0};for(let S of e.nodes)if(S.colorSet)for(let H of S.colorSet)y[H]!==void 0&&y[H]++;let m=M.some(S=>y[S]>0||k.selectedColors.has(S)),F=z`<triage-selector variant="graph" .counts="${d}" .states="${u}"></triage-selector>`,a=h?null:z`<mode-switch label="All files" .checked="${k.showAll}" data-g2-show-all></mode-switch>`,A=t.showSplitOwnDirs??!1?z`<mode-switch label="Split dirs" .checked="${k.splitOwnDirs}" data-g2-split-own></mode-switch>`:null,w=!n&&!i&&(t.showPackagesView??!1)?z`<mode-switch label="Packages" .checked="${k.packagesView}" data-g2-packages-view></mode-switch>`:null,v=e.reasons?.length>0?z`<label class="g2-reason-filter"><select aria-label="Reason" .value="${No(k.bundleReason??"")}" @change="${S=>S.currentTarget.dispatchEvent(new CustomEvent("bundle-graph-reason-change",{detail:{reason:S.currentTarget.value||null},bubbles:!0,composed:!0}))}"><option value="" ?selected="${k.bundleReason===null}">All</option>${e.reasons.map(S=>z`<option value="${S}" ?selected="${S===k.bundleReason}">${S}</option>`)}</select></label>`:null;return z`<div class="graph2-topbar">${c?z`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${c} ${a} ${A} ${w}<div class="g2-spacer"></div>${F}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${s} ${v} ${c?null:A} ${r?z`<severity-chips .counts="${l}" .selected="${[...k.selectedSeverities]}" kind="graph"></severity-chips>`:null} ${m?z`<triage-filter .counts="${y}" .selected="${[...k.selectedColors]}" kind="graph"></triage-filter>`:null}<div class="toolbar-search g2-path-filter-wrap"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> <input type="text" class="g2-path-filter" id="g2-path-filter" placeholder="filter path/package…" .value="${k.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" aria-label="Clear filter">✕</button></div>${c?null:a} ${c?null:w} ${o}<div class="g2-spacer"></div>${c?null:F} <button type="button" class="g2-icon-btn" id="g2-fullscreen" aria-label="Toggle fullscreen">⛶</button></div></div>`}function xi(e,t){let o=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean),i=0;for(;i<o.length&&i<n.length&&o[i]===n[i];)i++;let s=o.length-i,c=n.slice(i).join("/");return s===0?"./"+c:"../".repeat(s)+c}function vi(e,t){if(!t&&t!=="")return e;let o=xi(t,e);return o.length<e.length?o:e}function Yt(e,t,o,n){let i=o.length;if(i===0)return z`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><div class="g2-sel-section-empty">none</div></div>`;let s=o.map(c=>({file:c,display:vi(c,n)}));return s.sort((c,h)=>c.display.localeCompare(h.display)),z`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${i})</div><ul class="g2-sel-file-list">${s.map(({file:c,display:h})=>{let d=e.nodeByFile.get(c),u=d?le(d.pkg):"#666";return z`<li><button type="button" class="g2-sel-file-link" data-g2-select="${c}" data-tooltip="${c}"><span class="g2-sel-file-dot" style="${rt({background:u})}"></span> <span class="g2-sel-file-path">${h}</span></button></li>`})}</ul></div>`}function at(e){if(!e)return z`<div class="g2-sel-section-empty">none</div>`;let o=["critical","high","medium","low","high_bug","bug","informational"].filter(n=>(e[n]??0)>0);return o.length===0?z`<div class="g2-sel-section-empty">none</div>`:z`<div class="tree-count-chips">${o.map(n=>z`<span class="${`tree-count-chip ${n}`}">${e[n]} ${n.replaceAll("_"," ")}</span>`)}</div>`}function Zo(e){let t=0;for(let c of e.edges)c.cross&&t++;let o=e.edges.length-t,n=0;for(let c of e.nodes)n+=c.totalIssues;let i=e.nodes.length===0?"0.0":(e.edges.length*2/e.nodes.length).toFixed(1),s=Te(k.focusedPkg);return z`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${k.focusedPkg?z`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full">← ${s}</button></div>`:null}<div id="g2-focus-overlay-slot" class="g2-stage-overlay-tr"></div><div class="g2-stage-stats"><span><b>${e.nodes.length}</b> files</span> <span><b>${e.packages.length}</b> packages</span> <span><b>${e.edges.length}</b> edges (${o} intra · ${t} cross)</span> <span><b>${n}</b> issues</span> <span>avg degree <b>${i}</b></span></div><div class="g2-zoom-ctrl"><button id="g2-zoom-in" aria-label="Zoom in">+</button><div class="g2-zoom-pct" id="g2-zoom-pct">100%</div><button id="g2-zoom-out" aria-label="Zoom out">−</button> <button id="g2-zoom-fit" class="g2-zoom-fit-btn" aria-label="Fit to view">fit</button></div><div class="g2-tooltip" id="g2-tooltip"></div></main>`}function Jo(e){let t=null;if(k.selected){let n=e.nodeByFile.get(k.selected);n&&(t=n.pkg)}else k.solo&&(t=k.solo);if(!t||(e.pkgCount.get(t)??0)<=1||k.focusedPkg===t)return null;let o=Te(t);return z`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${t}" aria-label="${`Focus on ${o}'s graph`}" data-tooltip="${`Focus on ${o}'s graph`}"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M8 4.6 L4 11 M8 4.6 L12 11 M5 11.4 L11 11.4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/><circle cx="8" cy="3.6" r="2" fill="currentColor"/><circle cx="3.6" cy="11.4" r="2" fill="currentColor"/><circle cx="12.4" cy="11.4" r="2" fill="currentColor"/></svg></button>`}function Qo(){return z`<aside class="graph2-right"><div class="g2-panel-title">Selection</div><div id="g2-selection-area"></div><div id="g2-top-pkgs-block"></div></aside>`}function en(e){let t=k.showAll&&e.nodes.length>0&&e.nodes.every(i=>typeof i.size=="number"),o=e.nodes.some(i=>i.totalIssues>0),n=k.topPkgsTab;return n==="size"&&!t&&(n="files"),n==="issues"&&!o&&(n="files"),z`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${o?z`<button type="button" class="${dt({"g2-mini-tab":!0,on:n==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${dt({"g2-mini-tab":!0,on:n==="files"})}" data-g2-top-pkgs="files">Files</button> ${t?z`<button type="button" class="${dt({"g2-mini-tab":!0,on:n==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${ki(e,n)}`}function tn(e,t={}){let o=k.selected;if(o){let n=e.nodeByFile.get(o);return n?yi(e,n,o,t):z`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return k.solo?k.solo==="__own__"&&!e.pkgCount.has("__own__")&&e.layerRoots?.appImports.length>0?z`<div class="g2-empty-state"><strong>App</strong>App source is not included in this view. Connections come from its recorded imports.</div>`:wi(e,k.solo):z`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function yi(e,t,o,n){let i=le(t.pkg),s=Te(t.pkg),c=Lt(o,t.pkg),h=e.importedBy.get(o)??[],d=e.importsOf.get(o)??[],u=o.lastIndexOf("/"),l=u>=0?o.slice(0,u):"";return z`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${c}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${rt({"--dot":i,background:i})}"></span> <span class="g2-sel-pkg">${s}</span></div></div><div class="g2-sel-fullpath" data-tooltip="${o}">${o}</div>${Be(t.size)?z`<div class="g2-sel-size">${Be(t.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${at(t.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${at(t.subtree)}</div><div class="g2-sel-jumps">${t.totalIssues>0?z`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${o}">Findings →</button>`:null} ${n.isBundleContext?t.origFile?z`<button type="button" class="g2-sel-jump" data-bundle-view-source="${t.origFile}">View source →</button>`:null:z`<button type="button" class="g2-sel-jump" data-g2-jump-file="${o}">Files →</button>`}</div>${Yt(e,"Imported by",h,l)} ${Yt(e,"Imports",d,l)}</div>`}function wi(e,t){let o=e.nodes.filter(r=>r.pkg===t),n=o.length;if(n===0)return z`<div class="g2-empty-state"><strong>Package has no files in view</strong> Toggle "All files" to widen the file set, or pick another package.</div>`;let i=le(t),s=Te(t),c={};for(let r of ye)c[r]=0;for(let r of o)if(r.own)for(let M of ye)c[M]+=r.own[M]??0;let h=0,d=0;for(let r of e.edges){let M=e.nodeByFile.get(r.a),y=e.nodeByFile.get(r.b);!M||!y||(M.pkg===t&&y.pkg===t?d++:(M.pkg===t||y.pkg===t)&&h++)}let u=0;for(let r of o)r.isHub&&u++;let l=new Set;for(let r of o)for(let M of e.importedBy.get(r.file)??[]){let y=e.nodeByFile.get(M);y&&y.pkg!==t&&l.add(M)}return z`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${rt({"--dot":i,background:i})}"></span> <span class="g2-sel-id">${s}</span> <span class="g2-sel-grp">package</span></div><div class="g2-sel-body"><div class="g2-sel-row"><span class="k">Files</span><span class="v">${n}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${u}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${d}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${h}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${at(c)}</div>${Yt(e,"Imported by",[...l])}</div>`}function ki(e,t){let o=e.nodes.length||1,n=t??k.topPkgsTab,i=k.selectedSeverities,s=k.selectedColors,c=i.size>0,h=s.size>0,d=c||h,u=new Map,l=new Map,r=0,M=0;for(let a of e.nodes){let b;if(d){if(b=0,a.findings)for(let A of a.findings)c&&!i.has(A.severity)||h&&!s.has(A.color)||b++}else b=a.totalIssues;u.set(a.pkg,(u.get(a.pkg)??0)+b),r+=b,typeof a.size=="number"&&(l.set(a.pkg,(l.get(a.pkg)??0)+a.size),M+=a.size)}let y;n==="issues"?y=e.packages.filter(a=>(u.get(a)??0)>0).toSorted((a,b)=>{let A=u.get(a)??0,f=u.get(b)??0;return f!==A?f-A:(e.pkgCount.get(b)??0)-(e.pkgCount.get(a)??0)}):n==="size"?y=e.packages.filter(a=>(l.get(a)??0)>0).toSorted((a,b)=>{let A=l.get(a)??0,f=l.get(b)??0;return f!==A?f-A:(e.pkgCount.get(b)??0)-(e.pkgCount.get(a)??0)}):y=[...e.packages].toSorted((a,b)=>{let A=e.pkgCount.get(a)??0,f=e.pkgCount.get(b)??0;return f!==A?f-A:(u.get(b)??0)-(u.get(a)??0)});let m=a=>n==="issues"?r>0?((u.get(a)??0)/r*100).toFixed(2):"0":n==="size"?M>0?((l.get(a)??0)/M*100).toFixed(2):"0":(e.pkgCount.get(a)/o*100).toFixed(2),F=n==="issues"?"No packages with issues":n==="size"?"No packages with size":"No packages";return z`<div class="g2-dist-bar">${e.packages.map(a=>{let b=le(a);return z`<span style="${rt({background:b,width:`${m(a)}%`})}"></span>`})}</div><div class="g2-dist-list">${y.length===0?z`<div class="g2-dist-empty">${F}</div>`:null} ${ko(y,a=>a,a=>{let b=le(a),A=e.pkgCount.get(a)??0,f=u.get(a)??0,w=l.get(a)??0,v=n==="issues"?f:n==="size"?Be(w):A,S=n==="issues"?r>0?(f/r*100).toFixed(1):"0.0":n==="size"?M>0?(w/M*100).toFixed(1):"0.0":(A/o*100).toFixed(1),H=Te(a),X=k.solo===a;return z`<button type="button" class="${dt({"g2-dist-item":!0,on:X})}" data-g2-pkg="${a}" data-tooltip="${H}"><span class="g2-dist-dot" style="${rt({background:b})}"></span><span class="g2-dist-name">${H}</span><span class="g2-dist-count">${v}</span><span class="g2-dist-pct">${S}%</span></button>`})}</div>`}var Ve;function $i(){return Ve||(Ve=document.createElement("div"),Ve.id="styled-tooltip",document.body.append(Ve),Ve)}var Et=null,Pt=null,an=0,ln=0;document.addEventListener("mousemove",e=>{an=e.clientX,ln=e.clientY},{passive:!0});var Mi=100,Si=14,_i=8,on=8;function Ai(e,{placement:t="cursor"}={}){let o=$i(),n=e.dataset.tooltip??"";if(n&&!(Et===e&&o.textContent===n)){if(o.textContent=n,t==="right"){let i=e.getBoundingClientRect();o.style.top=`${Math.round(i.top+i.height/2)}px`,o.style.left=`${Math.round(i.right+_i)}px`,o.style.transform="translateY(-50%)"}else{o.style.transform="none",o.style.top=`${ln+Si}px`,o.style.left="0px",o.classList.add("visible");let i=o.offsetWidth,s=window.innerWidth-i-on,c=Math.max(on,Math.min(an,s));o.style.left=`${Math.round(c)}px`}o.classList.add("visible"),Et=e}}function nn(){clearTimeout(Pt),Pt=null,Ve&&Ve.classList.remove("visible"),Et=null}function Ri(e,{gate:t,placement:o}={}){t&&!t(e)||(clearTimeout(Pt),Pt=setTimeout(()=>{Ai(e,{placement:o})},Mi))}var rn=new WeakSet;function sn(e,t){for(let o of e.composedPath()){if(o===t)break;if(o.nodeType===1&&Object.hasOwn(o.dataset,"tooltip"))return o}return null}function cn(e,t){!e||rn.has(e)||(rn.add(e),e.addEventListener("mouseover",o=>{let n=sn(o,e);if(!n){nn();return}n!==Et&&Ri(n,t)}),e.addEventListener("mouseout",o=>{let n=sn(o,e),i=o.relatedTarget?.closest?.("[data-tooltip]")??null;n&&n===i||nn()}))}var Zt=class{constructor(t){this.nodes=[...t];for(let[o,n]of this.nodes.entries())n.position=o;for(let o=(this.nodes.length>>1)-1;o>=0;o--)this.down(o)}before(t,o){return Math.abs(t.balance)>Math.abs(o.balance)||Math.abs(t.balance)===Math.abs(o.balance)&&(t.balance>o.balance||t.balance===o.balance&&t.tie<o.tie)}swap(t,o){let n=this.nodes,i=n[t];n[t]=n[o],n[o]=i,n[t].position=t,n[o].position=o}down(t){let o=this.nodes;for(;2*t+1<o.length;){let n=2*t+1;if(n+1<o.length&&this.before(o[n+1],o[n])&&n++,!this.before(o[n],o[t]))break;this.swap(t,n),t=n}}update(t){if(t.position<0)return;let o=t.position;for(;o>0;){let n=o-1>>1;if(!this.before(t,this.nodes[n]))break;this.swap(o,n),o=n}this.down(o)}take(){let t=this.nodes[0],o=this.nodes.pop();return t.position=-1,this.nodes.length>0&&(this.nodes[0]=o,o.position=0,this.down(0)),t}};function Ti(e,t){for(let o=0;o<8;o++){let n=!1;for(let i=0;i<e.length-1;i++){let s=o%2?e.length-2-i:i,c=e[s],h=e[s+1];(t.get(h)?.get(c)?.count??0)<=(t.get(c)?.get(h)?.count??0)||(e[s]=h,e[s+1]=c,n=!0)}if(!n)break}return e}function Ci(e){let t=[],o=new Set;for(let n of e.values())n.outgoing.sort((i,s)=>s[1]-i[1]||i[0].tie-s[0].tie);for(let n of e.values()){if(o.has(n))continue;let i=[{node:n,next:0}];for(o.add(n);i.length>0;){let s=i.at(-1);if(s.next===s.node.outgoing.length){t.push(s.node.id),i.pop();continue}let c=s.node.outgoing[s.next++][0];o.has(c)||(o.add(c),i.push({node:c,next:0}))}}return t.toReversed()}function Jt(e,t){let o=new Map(e.map((i,s)=>[i,s])),n=0;for(let i of t.values())for(let[s,c]of i.outgoing)o.get(i.id)<o.get(s.id)&&(n+=c);return n}function Ii(e,t){let o=Jt(e,t),n=o,i=0;for(let s=0;s<e.length-1;s++)o-=t.get(e[s]).originalBalance,o>n&&(n=o,i=s+1);return[...e.slice(i),...e.slice(0,i)]}function dn(e,t){if(e.length<2)return e;let o=new Map(e.map((d,u)=>[d,{id:d,tie:u,balance:0,incoming:[],outgoing:[]}]));for(let d of o.values())for(let u of t.get(d.id)?.values()??[]){let l=o.get(u.to);!l||l===d||(d.outgoing.push([l,u.count]),l.incoming.push([d,u.count]),d.balance+=u.count,l.balance-=u.count)}for(let d of o.values())d.originalBalance=d.balance;let n=[],i=new Zt(o.values()),s=[];for(;i.nodes.length>0;){let d=i.take();d.balance>=0?n.push(d.id):s.push(d.id);for(let[u,l]of d.outgoing)u.position<0||(u.balance+=l,i.update(u));for(let[u,l]of d.incoming)u.position<0||(u.balance-=l,i.update(u))}let c=e,h=Jt(e,o);for(let d of[[...n,...s.toReversed()],Ci(o),e,e.toReversed()]){let u=Ti(Ii(d,o),t),l=Jt(u,o);l>h&&(c=u,h=l)}return c}function Li(e,t){let o=new Set(e),n=new Map(e.map(d=>[d,[]]));for(let[d,u]of t)for(let l of u)o.has(d)&&o.has(l)&&n.get(l).push(d);let i=[],s=new Set;for(let d of e){if(s.has(d))continue;s.add(d);let u=[[d,(t.get(d)??[])[Symbol.iterator]()]];for(;u.length>0;){let[l,r]=u.at(-1),M=r.next();if(M.done){i.push(l),u.pop();continue}o.has(M.value)&&!s.has(M.value)&&(s.add(M.value),u.push([M.value,(t.get(M.value)??[])[Symbol.iterator]()]))}}let c=new Map,h=[];for(let d of i.toReversed()){if(c.has(d))continue;let u=[],l=h.length,r=[d];for(c.set(d,l);r.length>0;){let M=r.pop();u.push(M);for(let y of n.get(M))c.has(y)||(c.set(y,l),r.push(y))}h.push(u.toSorted())}return{groups:h,componentOf:c}}function Qt(e,{expanded:t=new Set,order:o="structure",query:n="",neighborhood:i=null,cyclesOnly:s=!1}={}){let c=new Map,h=new Map;for(let p of e.nodes){let R=t.has(p.pkg),P=`${R?"f":"p"}:${R?p.file:p.pkg}`;c.has(P)||c.set(P,{id:P,pkg:p.pkg,file:R?p.file:null,label:R?p.file:p.pkg==="__own__"?"own source":p.pkg,files:[],size:0,issues:0,incoming:0,outgoing:0});let J=c.get(P);J.files.push(p.file),J.size+=p.size??0,J.issues+=p.totalIssues??0,h.set(p.file,P)}let d=new Map,u=new Set,l=new Map([...c.keys()].map(p=>[p,new Set])),r=new Set,M=0;for(let[p,R]of e.importsOf){let P=h.get(p);if(P)for(let J of new Set(R)){let K=h.get(J);if(!K)continue;d.has(P)||d.set(P,new Map),d.get(P).has(K)||d.get(P).set(K,{from:P,to:K,count:0,examples:[]});let me=d.get(P).get(K);me.count++,me.examples.length<80&&me.examples.push([p,J]),M++,c.get(P).outgoing++,c.get(K).incoming++,P!==K&&(r.add(P),u.add(K)),(P!==K||c.get(P).file)&&l.get(P).add(K)}}let y=[...c.keys()].toSorted(),{groups:m,componentOf:F}=Li(y,l),a=new Set(m.flatMap(p=>p.length>1||l.get(p[0]).has(p[0])?p:[]));for(let p of c.values())p.cyclic=a.has(p.id),p.component=F.get(p.id);let b=e.ownSourcePackages??new Set(e.layerRoots?.roots??[]),A=p=>p.pkg==="__own__"?0:b.has(p.pkg)?1:2,f=p=>u.has(p.id)&&r.has(p.id)?0:1,w=new Map(m.map((p,R)=>[R,p.reduce((P,J)=>Math.min(P,A(c.get(J))),2)])),v=(p,R)=>p.pkg.localeCompare(R.pkg)||p.label.localeCompare(R.label),S=new Map;if(o==="structure"){for(let p of m)if(!(p.length<2))for(let R of Map.groupBy(p,P=>A(c.get(P))).values()){let P=R.toSorted((J,K)=>v(c.get(J),c.get(K)));dn(P,d).forEach((J,K)=>S.set(J,K))}}for(let[p,R]of d)for(let P of R.values())P.cyclic=a.has(p)&&F.get(p)===F.get(P.to)&&(p!==P.to||c.get(p).file!==null);let H=n.trim().toLowerCase(),X=new Set(y.filter(p=>!H||c.get(p).files.some(R=>R.toLowerCase().includes(H))||c.get(p).label.toLowerCase().includes(H))),T=new Set(i?[i]:X);if(H||i)for(let[p,R]of l)for(let P of R)(i?p===i:X.has(p))&&T.add(P),(i?P===i:X.has(P))&&T.add(p);let x=(p,R)=>{if(o==="structure"){let K=w.get(p.component)-w.get(R.component);if(K)return K;let me=f(p)-f(R);if(me)return me;let ze=p.component-R.component;if(ze)return ze}let P=A(p)-A(R);if(P)return P;let J=f(p)-f(R);if(J)return J;if(o==="structure"&&p.component===R.component){let K=(S.get(p.id)??0)-(S.get(R.id)??0);if(K)return K}return o==="importers"&&p.incoming!==R.incoming?R.incoming-p.incoming:o==="imports"&&p.outgoing!==R.outgoing?R.outgoing-p.outgoing:v(p,R)},B=[...c.values()].filter(p=>T.has(p.id)&&(!s||p.cyclic)).toSorted(x),E=new Map(B.map((p,R)=>[p.id,R])),U=[];for(let[p,R]of d)if(E.has(p))for(let P of R.values())E.has(P.to)&&U.push({...P,row:E.get(p),col:E.get(P.to)});return{rows:B,byId:c,cells:d,visibleCells:U,index:E,matches:X,importCount:M,totalRows:c.size,cycleCount:m.filter(p=>a.has(p[0])).length}}function eo(e,t,o){return Math.min(24,Math.max(1,t-196-12)/Math.max(1,e),Math.max(1,o-118-12)/Math.max(1,e))}function to(e,t,o,n){return Math.max(Math.min(18,eo(t,o,n)),Math.min(27,e))}function pn(e,t,o,n){let i=Math.floor((e-196+n.x)/n.cell),s=Math.floor((t-118+n.y)/n.cell);return e<196&&t>=118&&s>=0&&s<o.rows.length?{row:s,col:null}:t<118&&e>=196&&i>=0&&i<o.rows.length?{row:i,col:null}:e>=196&&t>=118&&s>=0&&i>=0&&s<o.rows.length&&i<o.rows.length?{row:s,col:i}:null}function un(e){if(!e.file)return e.label;let t=`node_modules/${e.pkg}/`;return e.file.includes(t)?e.file.slice(e.file.indexOf(t)+t.length):e.file}function fn(e,t,o,{width:n,height:i,theme:s,colorOf:c,hover:h,selected:d,dimmed:u}){let{cell:l,x:r,y:M}=o,{rows:y}=t,m=x=>196+x*l-r,F=x=>118+x*l-M,a=Math.max(0,Math.floor(M/l)),b=Math.min(y.length,Math.ceil((i-118+M)/l)),A=Math.max(0,Math.floor(r/l)),f=Math.min(y.length,Math.ceil((n-196+r)/l)),w=h??d;e.clearRect(0,0,n,i),e.fillStyle=s.bg,e.fillRect(0,0,n,i),e.save(),e.beginPath(),e.rect(196,118,n-196,i-118),e.clip();let v=[];for(let x=0;x<y.length;x++){let B=v.at(-1),E=y[x];B&&B.component===E.component?B.end=x+1:v.push({component:E.component,start:x,end:x+1,cyclic:E.cyclic})}for(let x of v)x.cyclic&&(e.strokeStyle=s.cycle+"85",e.lineWidth=1,e.strokeRect(m(x.start),F(x.start),(x.end-x.start)*l,(x.end-x.start)*l));if(w&&(e.fillStyle=s.highlight,e.fillRect(196,F(w.row),n-196,l),e.fillRect(m(w.col??w.row),118,l,i-118)),e.strokeStyle=s.grid,e.lineWidth=1,l>=9){e.beginPath();for(let x=a;x<=b;x++)e.moveTo(196,F(x)+.5),e.lineTo(n,F(x)+.5);for(let x=A;x<=f;x++)e.moveTo(m(x)+.5,118),e.lineTo(m(x)+.5,i);e.stroke()}let S=t.visibleCells.reduce((x,B)=>Math.max(x,B.count),1),H=l>=8?2:.25;for(let x of t.visibleCells)x.row<a||x.row>=b||x.col<A||x.col>=f||(e.globalAlpha=u(y[x.row])&&u(y[x.col])?.12:.35+.65*Math.log1p(x.count)/Math.log1p(S),e.fillStyle=x.cyclic&&l<10?s.cycle:c(y[x.row].pkg),e.fillRect(m(x.col)+H,F(x.row)+H,Math.max(1,l-2*H),Math.max(1,l-2*H)),x.cyclic&&x.from!==x.to&&l>=10&&(e.fillStyle=s.cycle,e.fillRect(m(x.col)+l-5,F(x.row)+2,3,3)));e.globalAlpha=1,d&&(e.strokeStyle=s.text,e.lineWidth=2,d.col===null?e.strokeRect(197,F(d.row)+1,n-196-2,l-2):e.strokeRect(m(d.col)+1,F(d.row)+1,l-2,l-2)),e.restore(),e.fillStyle=s.surface,e.fillRect(0,0,n,118),e.fillRect(0,0,196,i),e.font="11px ui-monospace, monospace",e.textBaseline="middle";let X=Math.max(1,Math.ceil(14/l));for(let x=a;x<b;x++){if(x%X&&x!==w?.row)continue;e.save(),e.beginPath(),e.rect(5,111,186,i-118+7),e.clip();let B=F(x)+l/2;x===w?.row&&(e.fillStyle=s.highlight,e.fillRect(0,F(x),196,Math.max(l,14))),e.fillStyle=c(y[x].pkg),e.fillRect(8,B-3,5,6),e.fillStyle=x===w?.row||t.matches.size<t.totalRows&&t.matches.has(y[x].id)?s.text:s.muted,e.fillText(`${y[x].file?" ":""}${un(y[x])}`,20,B),e.restore()}let T=Math.max(1,Math.ceil(17/l));for(let x=A;x<f;x++)x%T&&x!==(w?.col??w?.row)||(e.save(),e.beginPath(),e.rect(189,22,n-196+7,96),e.clip(),e.translate(m(x)+l/2,108),e.rotate(-Math.PI/4),e.fillStyle=x===(w?.col??w?.row)?s.text:s.muted,e.fillText(un(y[x]),0,0,115),e.restore(),e.fillStyle=c(y[x].pkg),e.fillRect(m(x)+1,114,Math.max(1,l-2),3));e.fillStyle=s.muted,e.font="10px ui-monospace, monospace",e.fillText("IMPORTERS \u2193",14,104),e.fillText("DEPENDENCIES \u2192",204,12),e.strokeStyle=s.border,e.beginPath(),e.moveTo(196-.5,118),e.lineTo(196-.5,i),e.moveTo(196,118-.5),e.lineTo(n,118-.5),e.stroke(),y.length===0&&(e.fillStyle=s.muted,e.fillText("No matching dependencies",216,148))}var Xe=e=>e.toLocaleString("en-US");function zt(e,t,o){return z`<button class="g2-dist-item matrix-row-link" @click="${()=>o(e.id)}" data-tooltip="${e.label}"><span class="g2-dist-dot" style="${`background:${le(e.pkg)}`}"></span><span class="g2-dist-name">${e.label}</span><span class="g2-dist-count">${Xe(t)}</span></button>`}function gn(e,t,o,{select:n,expand:i,expanded:s,neighborhood:c,focus:h,clear:d}){let u=e.byId.get(o?.from),l=e.byId.get(o?.to);if(!u){let a=[...e.rows].toSorted((b,A)=>A.incoming-b.incoming).slice(0,15);return z`<div class="matrix-metrics"><span><b>${Xe(t.nodes.length)}</b>files</span><span><b>${Xe(t.packages.length)}</b>packages</span><span><b>${Xe(e.importCount)}</b>imports</span></div><p class="matrix-empty">Select a row to inspect a package.<br>Select a cell to see the files behind a dependency.</p><h4>Most imported</h4>${a.map(b=>zt(b,b.incoming,n))} ${e.cycleCount?z`<h4>Cyclic groups <b>${e.cycleCount}</b></h4>${e.rows.filter(b=>b.cyclic).slice(0,12).map(b=>zt(b,b.outgoing,n))}`:null}`}let r=l?e.cells.get(u.id)?.get(l.id):null,M=Map.groupBy(r?.examples??[],([,a])=>a),y=u.cyclic?[...e.byId.values()].filter(a=>a.component===u.component).length:0,m=[...e.cells.get(u.id)?.values()??[]].filter(a=>a.to!==u.id).toSorted((a,b)=>b.count-a.count),F=[...e.cells.values()].map(a=>a.get(u.id)).filter(a=>a&&a.from!==u.id).toSorted((a,b)=>b.count-a.count);return z`<div class="matrix-panel-head"><button class="matrix-selected-name" @click="${()=>n(u.id)}">${u.label}</button><button type="button" class="detail-action" @click="${d}" aria-label="Clear matrix selection">×</button></div>${l?z`<div class="matrix-direction">imports →</div><button class="matrix-selected-name" @click="${()=>n(l.id)}">${l.label}</button>`:null} ${(l?r?.cyclic:u.cyclic)?z`<span class="matrix-cycle-label">${l?"Import participates in a cycle":`Cyclic group \xB7 ${y} members`}</span>`:null}<div class="matrix-metrics"><span><b>${Xe(l?r?.count??0:u.files.length)}</b>${l?"file imports":"files"}</span><span><b>${Be(u.size)}</b>source size</span></div><div class="matrix-actions">${u.file?z`<button @click="${()=>i(u.pkg)}">Collapse package</button><button data-bundle-view-source="${t.nodeByFile.get(u.file)?.origFile??u.file}">View source</button>`:z`<button @click="${()=>i(u.pkg)}">${s.has(u.pkg)?"Collapse files":"Expand files"}</button>`} <button aria-pressed="${String(c===u.id)}" @click="${()=>h(u.id)}">Neighborhood</button></div>${l?z`<h4>File imports</h4>${M.size>0?[...M].map(([a,b])=>z`<div class="matrix-import-group"><button class="matrix-import-target" data-bundle-view-source="${t.nodeByFile.get(a)?.origFile??a}" data-tooltip="${a}">${a}</button><ul class="matrix-import-sources" aria-label="Imported by">${b.map(([A])=>z`<li><button data-bundle-view-source="${t.nodeByFile.get(A)?.origFile??A}" data-tooltip="${A}"><span aria-hidden="true">←</span><span>${A}</span></button></li>`)}</ul></div>`):z`<p class="matrix-empty">No direct imports in this direction.</p>`} ${r&&r.count>r.examples.length?z`<p class="matrix-empty">Showing ${r.examples.length} of ${Xe(r.count)} imports.</p>`:null} ${l.id!==u.id&&e.cells.get(l.id)?.has(u.id)?z`<h4>Reverse direction</h4><button class="g2-dist-item matrix-reverse-link" @click="${()=>n(l.id,u.id)}">← ${Xe(e.cells.get(l.id).get(u.id).count)} file imports</button>`:null}`:z`<h4>Imports <b>${m.length}</b></h4>${m.slice(0,60).map(a=>zt(e.byId.get(a.to),a.count,b=>n(u.id,b)))} ${m.length>60?z`<p class="matrix-empty">Showing the 60 strongest of ${m.length} dependencies.</p>`:null}<h4>Imported by <b>${F.length}</b></h4>${F.slice(0,60).map(a=>zt(e.byId.get(a.from),a.count,b=>n(b,u.id)))} ${F.length>60?z`<p class="matrix-empty">Showing the 60 strongest of ${F.length} importers.</p>`:null}`}`}var hn=`:host{display:contents}*{box-sizing:border-box}button,select{font:inherit;color:var(--text);border:1px solid var(--border);background:var(--surface);border-radius:4px;padding:4px 7px;cursor:pointer}button:hover,button[aria-pressed=true]{background:var(--graph-hover-bg);border-color:var(--muted)}button:focus-visible,select:focus-visible,canvas:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.matrix-layout{display:contents;color:var(--text);font-size:12px}.matrix-stage{grid-area:stage;position:relative;overflow:hidden;min-width:0;min-height:0;background:var(--graph-canvas-bg)}.matrix-order{position:absolute;top:12px;left:14px;max-width:calc(var(--matrix-label-width) - 28px);height:30px;padding:3px 6px;border-radius:6px;font-size:11px}canvas{display:block;width:100%;height:100%;touch-action:none}.matrix-zoom{position:absolute;bottom:10px;right:10px;display:flex;align-items:center;gap:3px;padding:3px;border:1px solid var(--border);border-radius:5px;background:var(--surface)}.matrix-zoom span{min-width:35px;text-align:center;font-size:11px;color:var(--muted)}.matrix-hover{position:absolute;bottom:10px;left:calc(var(--matrix-label-width) + 10px);max-width:max(0px,calc(100% - var(--matrix-label-width) - 160px));padding:5px 8px;border:1px solid var(--border);border-radius:4px;background:var(--surface);pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.matrix-panel{grid-area:right;min-height:0;overflow:auto;padding:12px;border-left:1px solid var(--border);background:var(--surface)}.matrix-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-right:var(--graph-fullscreen-inset, 0)}h4{margin:20px 0 7px;font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;display:flex;justify-content:space-between}.matrix-metrics{display:flex;gap:14px;margin:15px 0;color:var(--muted);font-size:10px}.matrix-metrics:first-child{margin-top:0;padding-right:var(--graph-fullscreen-inset, 0)}.matrix-metrics b{display:block;font-size:16px;font-weight:500;color:var(--text);font-variant-numeric:tabular-nums;margin-bottom:3px}.matrix-empty{color:var(--muted);font-size:11px;line-height:1.6}.matrix-row-link{grid-template-columns:6px minmax(0,1fr) auto}.matrix-row-link .g2-dist-dot{width:6px;height:6px;border-radius:2px}.matrix-row-link .g2-dist-name{color:var(--text)}.matrix-row-link .g2-dist-count{color:var(--muted)}.matrix-reverse-link{grid-template-columns:1fr}.matrix-selected-name{display:block;background:transparent;border:0;text-align:left;padding:0;margin:14px 0 6px;font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere}.matrix-panel-head .matrix-selected-name{min-width:0;margin:0}.matrix-panel-head button:last-child{flex-shrink:0}.matrix-direction{color:var(--muted);font-size:10px}.matrix-cycle-label{display:block;color:var(--matrix-cycle, #e879c7);font-size:10px;margin-top:10px}.matrix-actions{display:flex;gap:5px;margin:12px 0;font-size:11px}.matrix-actions button{white-space:nowrap}.matrix-import-group{padding:6px 0;border-bottom:1px solid var(--border)}.matrix-import-group button{display:flex;align-items:baseline;gap:6px;width:100%;min-height:20.5px;background:transparent;border:0;padding:2px 0;font:10px/1.6 ui-monospace,monospace;text-align:left;overflow-wrap:anywhere;color:var(--text)}.matrix-import-group .matrix-import-target{font-weight:600}.matrix-import-sources{margin:0 0 0 10px;padding:0;list-style:none}.matrix-import-sources button{color:var(--muted)}.matrix-import-sources span:last-child{min-width:0}
|
|
9
|
+
`;var mn=`.detail-action{width:22px;height:22px;display:grid;place-items:center;padding:0;background:transparent;border:0;border-radius:4px;color:var(--muted);font:500 16px/1 ui-monospace,monospace;cursor:pointer;&:hover{color:var(--accent);background:var(--surface-active)}&:focus-visible{outline:2px solid var(--accent);outline-offset:1px}}
|
|
10
|
+
`;var oo=class extends it{static properties={graph:{attribute:!1}};static styles=[Re(yt),Re(hn),Re(mn)];constructor(){super(),this.expanded=new Set,this.order="structure",this.cyclesOnly=!1,this.neighborhood=null,this.selection=null,this.hover=null,this.view={cell:18,x:0,y:0},this.width=0,this.height=0,this.dirty=!0,this.needsFit=!0,this.bridge={requestDraw:()=>this.requestUpdate(),_cleanup:()=>{}}}willUpdate(t){this.graph&&(t.has("graph")||this.query!==k.pathFilter||this.dirty)&&(this.query=k.pathFilter,this.model=Qt(this.graph,{expanded:this.expanded,order:this.order,query:this.query,neighborhood:this.neighborhood,cyclesOnly:this.cyclesOnly}),this.neighborhood&&!this.model.byId.has(this.neighborhood)&&(this.neighborhood=null,this.model=Qt(this.graph,{expanded:this.expanded,order:this.order,query:this.query,cyclesOnly:this.cyclesOnly})),this.selection&&!this.model.byId.has(this.selection.from)&&(this.selection=null),this.hover=null,this.dirty=!1,this.needsFit=!0)}firstUpdated(){let t=this.renderRoot.querySelector("canvas");this.canvas=t,this.resizeObserver=new ResizeObserver(()=>{let o=t.parentElement.getBoundingClientRect();this.width=o.width,this.height=o.height;let n=window.devicePixelRatio||1;t.width=Math.round(this.width*n),t.height=Math.round(this.height*n),this.clamp(),this.paint()}),this.resizeObserver.observe(t.parentElement),this.themeObserver=new MutationObserver(()=>this.requestUpdate()),this.themeObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.events=new AbortController,t.addEventListener("wheel",o=>{o.preventDefault(),o.ctrlKey||o.metaKey?this.zoom(Math.exp(-o.deltaY*.005),o.offsetX,o.offsetY):(this.view.x+=o.shiftKey?o.deltaY:o.deltaX,this.view.y+=o.shiftKey?0:o.deltaY,this.clamp(),this.hover=null,this.paint())},{passive:!1,signal:this.events.signal})}updated(){k.graphState=this.bridge;let t=JSON.stringify([this.cyclesOnly,this.model.cycleCount,this.expanded.size,!!this.neighborhood]);t!==this.controlsKey&&(this.controlsKey=t,this.dispatchEvent(new CustomEvent("matrix-controls-change",{detail:this.renderControls(),bubbles:!0,composed:!0}))),cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(()=>this.paint())}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.themeObserver?.disconnect(),this.events?.abort(),cancelAnimationFrame(this.frame),k.graphState===this.bridge&&(k.graphState=null)}clamp(){this.view.cell=to(this.view.cell,this.model.rows.length,this.width,this.height);let t=this.model.rows.length*this.view.cell;this.view.x=Math.max(0,Math.min(this.view.x,Math.max(0,t-this.width+196+12))),this.view.y=Math.max(0,Math.min(this.view.y,Math.max(0,t-this.height+118+12)))}fit(){this.view={cell:eo(this.model.rows.length,this.width,this.height),x:0,y:0},this.needsFit=!1,this.requestUpdate()}zoom(t,o=(this.width+196)/2,n=(this.height+118)/2){let i=this.view.cell,s=to(i*t,this.model.rows.length,this.width,this.height);this.view.x=(this.view.x+o-196)*s/i-o+196,this.view.y=(this.view.y+n-118)*s/i-n+118,this.view.cell=s,this.clamp(),this.hover=null,this.requestUpdate()}select(t,o=null,n=!0){this.selection={from:t,to:o},n&&this.model.index.has(t)&&(this.view.cell=Math.max(16,this.view.cell),this.view.y=this.model.index.get(t)*this.view.cell-(this.height-118)/2,this.view.x=(this.model.index.get(o??t)??0)*this.view.cell-(this.width-196)/2,this.clamp()),this.requestUpdate()}expand(t){this.expanded.has(t)?this.expanded.delete(t):this.expanded.add(t),this.revealPkg=t,this.selection=null,this.neighborhood=null,this.dirty=!0,this.requestUpdate()}pointer(t){let o=this.canvas.getBoundingClientRect();return pn(t.clientX-o.left,t.clientY-o.top,this.model,this.view)}move(t){if(this.drag){let n=t.clientX-this.drag.x,i=t.clientY-this.drag.y;if(Math.abs(n)+Math.abs(i)>3&&(this.drag.moved=!0),this.drag.moved){this.view.x=this.drag.ox-n,this.view.y=this.drag.oy-i,this.clamp(),this.hover=null,this.paint();return}}let o=this.pointer(t);(o?.row!==this.hover?.row||o?.col!==this.hover?.col)&&(this.hover=o,this.requestUpdate())}key(t){if(t.key==="Escape"){this.selection=null,this.hover=null,this.requestUpdate();return}if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter"].includes(t.key)||this.model.rows.length===0)return;t.preventDefault();let o=this.model.index.get(this.selection?.from)??0,n=this.model.index.get(this.selection?.to)??o;if(t.key==="Enter"){this.expand(this.model.rows[o].pkg);return}t.key==="ArrowDown"&&o++,t.key==="ArrowUp"&&o--,t.key==="ArrowRight"&&n++,t.key==="ArrowLeft"&&n--;let i=s=>Math.max(0,Math.min(this.model.rows.length-1,s));this.select(this.model.rows[i(o)].id,this.model.rows[i(n)].id)}paint(){if(!this.canvas||!this.model||this.width<=196||this.height<=118)return;if(this.needsFit&&this.fit(),this.revealPkg){let u=this.model.rows.find(l=>l.pkg===this.revealPkg);this.revealPkg=null,u&&this.select(u.id)}let t=this.canvas.getContext("2d"),o=window.devicePixelRatio||1;t.setTransform(o,0,0,o,0,0);let n=getComputedStyle(this),i=u=>n.getPropertyValue(u).trim(),s=document.body.classList.contains("theme-light")||document.body.classList.contains("theme-pink"),c={bg:i("--graph-canvas-bg")||"#0c0c0c",surface:i("--surface"),text:i("--text"),muted:i("--muted"),border:i("--border"),grid:s?"#0000000b":"#ffffff0b",highlight:s?"#0969da18":"#ffffff12",cycle:s?"#a21caf":"#e879c7"};this.style.setProperty("--matrix-cycle",c.cycle);let h=this.model.index.get(this.selection?.to),d=this.model.index.get(this.selection?.from);fn(t,this.model,this.view,{width:this.width,height:this.height,theme:c,colorOf:le,hover:this.hover,selected:d===void 0?null:{row:d,col:h??null},dimmed:u=>!u.files.some(l=>{let r=this.graph.nodeByFile.get(l);return(k.selectedSeverities.size===0||[...k.selectedSeverities].some(M=>r.severitySet?.has(M)))&&(k.selectedColors.size===0||[...k.selectedColors].some(M=>r.colorSet?.has(M)))})})}renderControls(){return z`<div class="g2-matrix-controls"><mode-switch label="${`${this.model.cycleCount} ${this.model.cycleCount===1?"cycle":"cycles"}`}" .checked="${this.cyclesOnly}" @click="${()=>{this.cyclesOnly=!this.cyclesOnly,this.dirty=!0,this.requestUpdate()}}"></mode-switch>${this.expanded.size>0?z`<button @click="${()=>{this.expanded.clear(),this.selection=null,this.dirty=!0,this.requestUpdate()}}">Collapse all</button>`:null} ${this.neighborhood?z`<button @click="${()=>{this.neighborhood=null,this.dirty=!0,this.requestUpdate()}}">All dependencies</button>`:null}</div>`}render(){if(!this.model)return null;let t=this.model.rows[this.hover?.col],o=this.model.rows[this.hover?.row],n=t&&o?this.model.cells.get(o.id)?.get(t.id)?.count??0:0;return z`<div class="matrix-layout"><div class="matrix-stage" style="${`--matrix-label-width: ${196}px`}"><select class="matrix-order" aria-label="Matrix order" @change="${i=>{this.order=i.target.value,this.dirty=!0,this.requestUpdate()}}"><option value="structure" ?selected="${this.order==="structure"}">Structure ↓</option><option value="name" ?selected="${this.order==="name"}">Name ↓</option><option value="importers" ?selected="${this.order==="importers"}">Most imported ↓</option><option value="imports" ?selected="${this.order==="imports"}">Most imports ↓</option></select><canvas tabindex="0" role="img" aria-label="Dependency matrix. Rows import columns. Arrow keys select cells; Enter expands a package." @keydown="${i=>this.key(i)}" @pointermove="${i=>this.move(i)}" @pointerleave="${()=>{this.drag||(this.hover=null,this.requestUpdate())}}" @pointerdown="${i=>{i.button===0&&(this.canvas.setPointerCapture(i.pointerId),this.drag={x:i.clientX,y:i.clientY,ox:this.view.x,oy:this.view.y,moved:!1})}}" @pointercancel="${()=>{this.drag=null}}" @pointerup="${i=>{if(this.drag){if(!this.drag.moved){let s=this.pointer(i);s&&this.select(this.model.rows[s.row].id,s.col===null?null:this.model.rows[s.col].id,!1)}this.drag=null}}}" @dblclick="${i=>{let s=this.pointer(i);s&&this.expand(this.model.rows[s.row].pkg)}}"></canvas>${o&&(!t||n>0)?z`<div class="matrix-hover">${o.label}${t?` \u2192 ${t.label} \xB7 ${n} imports`:` \xB7 ${o.files.length} files`}</div>`:null}<div class="matrix-zoom"><button aria-label="Zoom out" @click="${()=>this.zoom(1/1.5)}">−</button><span>${Math.round(this.view.cell/18*100)}%</span><button aria-label="Zoom in" @click="${()=>this.zoom(1.5)}">+</button><button @click="${()=>this.fit()}">Fit</button></div></div><aside class="matrix-panel" aria-label="Matrix details" aria-live="polite">${gn(this.model,this.graph,this.selection,{select:(i,s)=>this.select(i,s),expand:i=>this.expand(i),expanded:this.expanded,neighborhood:this.neighborhood,focus:i=>{this.neighborhood=this.neighborhood===i?null:i,this.dirty=!0,this.requestUpdate()},clear:()=>{this.selection=null,this.requestUpdate()}})}</aside></div>`}};customElements.define("dependency-matrix",oo);var bn=`:host{display:inline-flex;flex-shrink:0;vertical-align:middle;--switch-track-width: 26px;--switch-track-height: 14px}button{display:inline-flex;align-items:center;gap:8px;box-sizing:border-box;height:30px;margin:0;padding:0 .6rem;border:1px solid var(--border);border-radius:4px;background:transparent;color:var(--muted);font:inherit;font-size:.78rem;font-weight:500;line-height:1;white-space:nowrap;cursor:default;&:hover:not(:disabled){color:var(--text);background:rgb(from var(--text) r g b / .04)}&[aria-pressed=true]{color:var(--text)}&:disabled{opacity:.4}&:focus-visible{outline:1px solid var(--accent);outline-offset:-2px}}.track{position:relative;flex-shrink:0;width:var(--switch-track-width);height:var(--switch-track-height);background:var(--border);border-radius:8px;transition:background .15s;&:after{content:"";position:absolute;top:2px;left:2px;width:calc(var(--switch-track-height) - 4px);height:calc(var(--switch-track-height) - 4px);border-radius:50%;background:var(--muted);transition:transform .15s,background .15s}}button[aria-pressed=true] .track{background:color-mix(in oklch,var(--accent) 22%,transparent);&:after{transform:translate(calc(var(--switch-track-width) - var(--switch-track-height)));background:var(--accent)}}:host([borderless]) button{height:100%;border:0;border-radius:0}:host([compact]){--switch-track-width: 22px;--switch-track-height: 12px}:host([compact]) button{height:auto;gap:7px;padding:2px 8px;border-radius:6px;font-size:.68rem;line-height:1.2}
|
|
11
|
+
`;var no=class extends it{static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},label:{type:String},accessibleLabel:{type:String,attribute:"accessible-label"}};static styles=Re(bn);constructor(){super(),this.checked=!1,this.disabled=!1,this.label="",this.accessibleLabel=""}render(){return z`<button type="button" part="button" aria-pressed="${String(this.checked)}" aria-label="${this.accessibleLabel||this.label}" ?disabled="${this.disabled}"><span>${this.label}</span><span class="track" part="track" aria-hidden="true"></span></button>`}};customElements.get("mode-switch")||customElements.define("mode-switch",no);var io=class extends it{static properties={graph:{attribute:!1},options:{attribute:!1},matrixControls:{state:!0}};static styles=[Re(So),Re(Mo),Re($o),Re(yt)];constructor(){super(),this.graph=null,this.options={},this.matrixControls=null}connectedCallback(){super.connectedCallback(),cn(this.renderRoot)}willUpdate(){(!this.options.showBundleLayouts||k.bundleLayout!=="matrix")&&(this.matrixControls=null)}updated(){this.toggleAttribute("matrix",!!this.options.showBundleLayouts&&k.bundleLayout==="matrix")}render(){return this.graph?this.options.showBundleLayouts&&k.bundleLayout==="matrix"?z`<div class="graph2-layout g2-matrix-layout">${Kt(this.graph,this.options,this.matrixControls)}<dependency-matrix .graph="${this.graph}" @matrix-controls-change="${t=>{this.matrixControls=t.detail}}"></dependency-matrix></div>`:z`<div class="graph2-layout">${Kt(this.graph,this.options)} ${Zo(this.graph)} ${Qo()}</div>`:z``}};customElements.define("graph-layout",io);function Oi(e){let t=new Map;for(let[o,n]of e.importsOf){let i=e.nodeByFile.get(o);if(i)for(let s of n){let c=e.nodeByFile.get(s);c&&i.pkg!==c.pkg&&(t.set(i.pkg,(t.get(i.pkg)??0)+1),t.set(c.pkg,(t.get(c.pkg)??0)+1))}}return t}function Fi(e){if(e.packages.length===0)return null;let t=new Set;for(let[o,n]of e.importedBy){let i=e.nodeByFile.get(o);if(i)for(let s of n){let c=e.nodeByFile.get(s);if(c&&c.pkg!==i.pkg){t.add(i.pkg);break}}}for(let o of e.packages)if(!t.has(o))return o;return null}var Hi=5;function xn(e,t){let o=new Map;for(let s of e.nodes)t.has(s.pkg)&&(o.has(s.pkg)||o.set(s.pkg,[]),o.get(s.pkg).push(s));for(let s of o.values())s.sort((c,h)=>c.isHub!==h.isHub?c.isHub?-1:1:h.deg-c.deg);let n=new Map,i=new Map;for(let[s,c]of t){let h=o.get(s);if(!h||h.length===0)continue;let d=h.length,u=0;for(let b of h)if(b.isHub)u++;else break;let l=u>0&&u<=Hi,r=l?u:0,M=d-r,y=c.groupR,m=Array.from({length:d}),F=Array.from({length:d});for(let b=0;b<d;b++){let A=b*137.508*Math.PI/180,f;if(b<r)f=r<=1?0:Math.sqrt(b/(r-1))*.3*y;else{let w=b-r;f=M<=1?.4*y:(.4+Math.sqrt(w/(M-1))*.6)*y}m[b]=c.x+Math.cos(A)*f,F[b]=c.y+Math.sin(A)*f}let a=Array.from({length:d},()=>!1);for(let b=0;b<d;b++){let A=h[b],f,w;l&&A.isHub?(w=0,f=r):l?(w=r,f=d):(w=0,f=d);let v=0,S=0,H=0,X=e.importsOf.get(A.file);if(X)for(let E of X){let U=n.get(E);U!==void 0&&(v+=U,S+=i.get(E),H++)}let T=e.importedBy.get(A.file);if(T)for(let E of T){let U=n.get(E);U!==void 0&&(v+=U,S+=i.get(E),H++)}let x=!1;if(H>0){v/=H,S/=H;let E=v-c.x,U=S-c.y;E*E+U*U>1&&(x=!0)}let B=-1;if(x){let E=1/0;for(let U=w;U<f;U++){if(a[U])continue;let p=m[U]-v,R=F[U]-S,P=p*p+R*R;P<E&&(E=P,B=U)}}else for(let E=w;E<f;E++)if(!a[E]){B=E;break}a[B]=!0,A.x=m[B],A.y=F[B],n.set(A.file,A.x),i.set(A.file,A.y)}}}function vn(e,t,o){let n=t/2,i=o/2,s=Math.min(t,o)/2;if(e.packages.length===0)return;let h=Fi(e),d=Oi(e),u=(h?e.packages.filter(p=>p!==h):[...e.packages]).toSorted((p,R)=>{let P=(d.get(R)??0)-(d.get(p)??0);return P!==0?P:(e.pkgCount.get(R)??0)-(e.pkgCount.get(p)??0)}),l=u.length,r;l<=0?r=0:l<=6?r=.65:l<=20?r=.82:r=.95;let M=Math.max(1,Math.sqrt(50/Math.max(1,l))),y=.22,m=.12,F=.04,a=new Map,b;if(h){let p=e.pkgCount.get(h)??0,R=Math.min(y,(.012+Math.sqrt(p)*.004)*M);b=Math.max(l<=6?.4:l<=20?.36:.34,R+m+F),a.set(h,{x:n,y:i,size:p,groupR:R*s})}else l<=1?b=0:l<=6?b=.4:l<=20?b=.32:b=.3;if(l===0){xn(e,a);return}let A=new Map;for(let p of e.edges){if(!p.cross)continue;let R=e.nodeByFile.get(p.a)?.pkg,P=e.nodeByFile.get(p.b)?.pkg;if(!R||!P||R===P)continue;A.has(R)||A.set(R,new Map),A.has(P)||A.set(P,new Map);let J=A.get(R),K=A.get(P);J.set(P,(J.get(P)??0)+1),K.set(R,(K.get(R)??0)+1)}let f=Math.max(1,Math.min(10,Math.round(Math.sqrt(l)/1.2))),w=Array.from({length:f+1});for(let p=0;p<=f;p++)w[p]=Math.floor(p*p/(f*f)*l);w[f]=l;let v=.2,S=Array.from({length:f}),H=Array.from({length:f});for(let p=0;p<f;p++){let R=w[p],P=w[p+1];S[p]=P-R;let J=0;for(let K=R;K<P;K++)J+=e.pkgCount.get(u[K])??0;H[p]=J}let X=Array.from({length:f});for(let p=0;p<f;p++){let R=(w[p]+w[p+1]-1)/2/Math.max(1,l-1);X[p]=Math.sqrt(Math.max(0,R))}let T=Array.from({length:f});T[0]=X[0];for(let p=1;p<f;p++){let R=S[p-1],P=H[p-1],J=R>0?P/R:1,K=1+v*Math.sqrt(Math.max(0,J-1));T[p]=T[p-1]+(X[p]-X[p-1])*K}let x=Array.from({length:f});for(let p=0;p<f;p++)x[p]=T[p]-X[p];let B=Array.from({length:l}),E=Array.from({length:l}),U=0;for(let p=0;p<l;p++){for(;U<f-1&&p>=w[U+1];)U++;let R=p*137.508%360*Math.PI/180,J=(l<=1?0:Math.sqrt(p/(l-1)))+x[U],K=l===1?h?b:0:b+J*(r-b);B[p]=n+Math.cos(R)*K*s,E[p]=i+Math.sin(R)*K*s}for(let p=0;p<f;p++){let R=w[p],P=w[p+1],J=P-R;if(J===0)continue;let K=Array.from({length:J},()=>!1);for(let me=R;me<P;me++){let ze=u[me],pe=A.get(ze),Ne=0,ae=0,De=0;if(pe)for(let[fe,ge]of pe){let Le=a.get(fe);Le&&(Ne+=Le.x*ge,ae+=Le.y*ge,De+=ge)}let je=!1;if(De>0){Ne/=De,ae/=De;let fe=Ne-n,ge=ae-i;fe*fe+ge*ge>1&&(je=!0)}let Ce=-1;if(je){let fe=1/0;for(let ge=0;ge<J;ge++){if(K[ge])continue;let Le=R+ge,he=B[Le]-Ne,bt=E[Le]-ae,xt=he*he+bt*bt;xt<fe&&(fe=xt,Ce=ge)}}else for(let fe=0;fe<J;fe++)if(!K[fe]){Ce=fe;break}K[Ce]=!0;let Ie=R+Ce,tt=e.pkgCount.get(ze)??0,mt=Math.min(m,(.012+Math.sqrt(tt)*.004)*M);a.set(ze,{x:B[Ie],y:E[Ie],size:tt,groupR:mt*s})}}xn(e,a)}function ro(e,t,o){let n=t/2,i=o/2,s=Math.min(t,o)/2,c=e.nodes.length;if(c===0)return;let h=[...e.nodes].toSorted((d,u)=>u.deg-d.deg);for(let d=0;d<c;d++){let u=h[d],l=d*137.508%360*Math.PI/180,r=c<=1?0:Math.sqrt(d/(c-1));u.x=n+Math.cos(l)*r*.85*s,u.y=i+Math.sin(l)*r*.85*s}}function so(e,t,o,n,{groupOf:i=It}={}){let s=e.length,c=n||760,h=o||1100,d=Math.sqrt(h*c/Math.max(s,1))*1.1,u=v=>{let S=0;for(let H of v)S=S*31+H.codePointAt(0)|0;return S},l=Math.ceil(Math.sqrt(s*h/c)),r=Math.ceil(s/l),M=c/(r+1),y=h/(l+1),m=e.map((v,S)=>{let H=S%l,X=Math.floor(S/l),T=u(v);return{file:v,x:(H+1)*y+(T%100-50)*y*.4,y:(X+1)*M+((T>>7)%100-50)*M*.4,dx:0,dy:0}}),F=new Map(m.map((v,S)=>[v.file,S])),a=[];for(let v of e)for(let S of t.get(v)??[])F.has(S)&&a.push([F.get(v),F.get(S)]);let b=new Map;for(let v=0;v<s;v++){let S=i(m[v].file)??"__own__";b.has(S)||b.set(S,[]),b.get(S).push(v)}let A=Math.min(500,Math.max(180,100+s*3)),f=Math.min(h,c)/6,w=.3;for(let v=0;v<A;v++){let S=f*Math.pow(w/f,v/A);for(let T of m)T.dx=0,T.dy=0;for(let T=0;T<s;T++)for(let x=T+1;x<s;x++){let B=m[T],E=m[x],U=B.x-E.x,p=B.y-E.y,R=Math.sqrt(U*U+p*p);if(R<.01){let J=u(B.file+E.file);U=(J%100-50)*.01||.5,p=((J>>7)%100-50)*.01||.5,R=Math.sqrt(U*U+p*p)}let P=d*d/R;B.dx+=U/R*P,B.dy+=p/R*P,E.dx-=U/R*P,E.dy-=p/R*P}for(let[T,x]of a){let B=m[T],E=m[x],U=B.x-E.x,p=B.y-E.y,R=Math.sqrt(U*U+p*p)||.01,P=R*R/d;B.dx-=U/R*P,B.dy-=p/R*P,E.dx+=U/R*P,E.dy+=p/R*P}let H=.055*Math.min(1,S/(f*.3));for(let[,T]of b){if(T.length<2)continue;let x=0,B=0;for(let E of T)x+=m[E].x,B+=m[E].y;x/=T.length,B/=T.length;for(let E of T)m[E].dx+=(x-m[E].x)*H,m[E].dy+=(B-m[E].y)*H}let X=50;for(let T of m){let x=Math.sqrt(T.dx*T.dx+T.dy*T.dy)||.01;T.x+=T.dx/x*Math.min(x,S),T.y+=T.dy/x*Math.min(x,S),T.x=Math.max(X,Math.min(h-X,T.x)),T.y=Math.max(X,Math.min(c-X,T.y))}}return m}function yn(e,t,o,{width:n=900,rowHeight:i=52,gap:s=42}={}){let c=new Map(e.map(f=>[f.id,f])),h=new Map,d=[];for(let f of o)c.has(f)&&!h.has(f)&&(h.set(f,0),d.push(f));for(let f=0;f<d.length;f++){let w=d[f];for(let v of t.get(w)??[])!c.has(v)||h.has(v)||(h.set(v,h.get(w)+1),d.push(v))}let u=new Map;for(let f of e){let w=h.get(f.id)??null;u.has(w)||u.set(w,[]),u.get(w).push(f)}let l=new Map(e.map(f=>[f.id,[]]));for(let[f,w]of t)if(c.has(f))for(let v of new Set(w))l.get(v)?.push(f);let r=[],M=new Map,y=[...u.keys()].toSorted((f,w)=>(f??1/0)-(w??1/0)),m=f=>Number.isFinite(f.size)&&f.size>0?f.size:0;for(let f of y){let w=u.get(f).slice(),v=new Map(w.map(x=>{let B=l.get(x.id).map(E=>M.get(E)).filter(E=>E&&f!==null&&E.level===f-1);return[x.id,B.length>0?B.reduce((E,U)=>E+U.x+U.width/2,0)/B.length:n/2]}));w.sort((x,B)=>v.get(x.id)-v.get(B.id)||String(x.id).localeCompare(String(B.id)));let S=0;for(let x=1;x<w.length;x++)m(w[x])>m(w[S])&&(S=x);S>0&&w.unshift(w.splice(S,1)[0]);let H=w.reduce((x,B)=>x+m(B),0),X=r.length*(i+s),T=0;for(let x of w){let B=n*(H>0?m(x)/H:1/w.length);M.set(x.id,{id:x.id,level:f,x:T,y:X,width:B,height:i}),T+=B}r.push({level:f,y:X,size:H,proportional:H>0,ids:w.map(x=>x.id)})}let F=[];for(let[f,w]of t)if(M.has(f))for(let v of new Set(w))f!==v&&M.has(v)&&F.push({from:f,to:v});F.sort((f,w)=>String(f.from).localeCompare(String(w.from))||String(f.to).localeCompare(String(w.to)));let a=new Map,b=new Map;for(let f of F)b.has(f.from)||b.set(f.from,[]),a.has(f.to)||a.set(f.to,[]),b.get(f.from).push(f),a.get(f.to).push(f);for(let f of b.values())f.sort((w,v)=>M.get(w.to).x-M.get(v.to).x);for(let f of a.values())f.sort((w,v)=>M.get(w.from).x-M.get(v.from).x);for(let f of b.values())f.forEach((w,v)=>{w.sourcePort=(v+1)/(f.length+1)});for(let f of a.values())f.forEach((w,v)=>{w.targetPort=(v+1)/(f.length+1)});let A=r.reduce((f,w)=>f+w.size,0);for(let f of r)f.share=A>0?f.size/A:null;return{levels:r,rects:M,edges:F,depth:h,totalSize:A,width:n,height:r.length>0?r.length*(i+s)-s:0,gap:s}}function Bi(e){let t=[1,3,5].map(n=>{let i=parseInt(e.slice(n,n+2),16)/255;return i<=.04045?i/12.92:((i+.055)/1.055)**2.4});return t[0]*.2126+t[1]*.7152+t[2]*.0722>.18?"#000":"#fff"}function wn(e,t,{theme:o,scale:n,colorOf:i,labelOf:s,sizeLabel:c,dimmed:h,selected:d,hovered:u}){let l=u??d,r=new Set([l]);for(let m of t.edges)m.from===l&&r.add(m.to),m.to===l&&r.add(m.from);let M=m=>m===l||m===d?1:h(m)?.13:l&&!r.has(m)?.22:1;e.save(),e.lineJoin="round";for(let m of t.edges){let F=t.rects.get(m.from),a=t.rects.get(m.to),b=m.from===l||m.to===l;e.globalAlpha=Math.min(M(m.from),M(m.to))*(b?.9:.5),e.strokeStyle=i(m.from),e.fillStyle=i(m.from),e.lineWidth=(b?1.6:1)/n;let A=F.x+F.width*m.sourcePort,f=F.y+F.height,w=a.x+a.width*m.targetPort,v=a.y,S=0,H=1;if(e.beginPath(),e.moveTo(A,f),a.y>F.y){let T=(f+v)/2;e.bezierCurveTo(A,T,w,T,w,v)}else if(a.y===F.y){v=a.y+a.height;let T=f+t.gap*.65;e.bezierCurveTo(A,T,w,T,w,v),H=-1}else{w=a.x+a.width,v=a.y+a.height*m.targetPort;let T=t.width+16+m.sourcePort*20;e.bezierCurveTo(A,f+t.gap/2,T,f+t.gap/2,T,f),e.lineTo(T,v+8),e.quadraticCurveTo(T,v,w,v),S=-1,H=0}e.stroke();let X=3/n;e.beginPath(),e.moveTo(w,v),e.lineTo(w-S*X-H*X,v-H*X+S*X),e.lineTo(w-S*X+H*X,v-H*X-S*X),e.closePath(),e.fill()}e.globalAlpha=1,e.textBaseline="middle",e.textAlign="right",e.fillStyle=o.labelDefault,e.font="11px system-ui, sans-serif";let y=o.edgeIntra(.16);for(let m of t.levels){let a=m.y+26,b=18;e.strokeStyle=y,e.lineWidth=3,e.beginPath(),e.arc(-112,a,b,0,Math.PI*2),e.stroke(),m.share!==null&&m.share>0&&(e.strokeStyle=o.labelDefault,e.beginPath(),e.arc(-112,a,b,-Math.PI/2,-Math.PI/2+m.share*Math.PI*2),e.stroke()),e.textAlign="center",e.font="9px system-ui, sans-serif";let A=m.share===null?"\u2014":m.share>0&&m.share<.001?"<0.1%":`${Number((m.share*100).toFixed(1))}%`;e.fillText(A,-112,a),e.textAlign="right",e.font="11px system-ui, sans-serif",e.fillText(m.level===null?"Unreached":m.level===0?"App":`Level ${m.level}`,-12,m.y+19),e.font="10px system-ui, sans-serif",e.fillText(m.proportional?c(m.size):"No size data",-12,m.y+35),e.font="11px system-ui, sans-serif"}e.textAlign="left";for(let m of t.rects.values()){let{id:F,x:a,y:b,width:A,height:f}=m;if(A<=0)continue;let w=i(F),v=Bi(w);if(e.globalAlpha=M(F),e.fillStyle=w,e.fillRect(a,b,A,f),e.strokeStyle=o.bg,e.lineWidth=1/n,e.strokeRect(a,b,A,f),F===d||F===u){e.strokeStyle=o.selectRing,e.lineWidth=1.5/n;let S=Math.min(A/2,.75/n);e.strokeRect(a+S,b+S,Math.max(0,A-S*2),f-S*2)}A*n<28||(e.save(),e.beginPath(),e.rect(a+7,b+4,Math.max(0,A-14),f-8),e.clip(),e.fillStyle=v,e.font="500 12px system-ui, sans-serif",e.fillText(s(F),a+9,b+21),e.fillStyle=v,e.font="10px system-ui, sans-serif",e.fillText(c(F),a+9,b+38),e.restore())}e.restore()}function kn(e){let t=e.nodes.map(i=>({node:i})),o=new Map(t.map(i=>[i.node.file,i])),n=e.edges.flatMap(i=>{let s=o.get(i.a),c=o.get(i.b);return s&&c?[{edge:i,a:s,b:c}]:[]});return{nodes:t,edges:n,graph:e,selected:void 0,neighbors:new Set}}function $n(e,{viewport:t,selected:o,visible:n,dimmed:i,radius:s,color:c,paintKey:h}){if(h===void 0||e.paintKey!==h){let d=new Map;for(let u of e.nodes){let l=u.node;u.visible=n(l),u.visible&&(u.x=l.x*t.k+t.tx,u.y=l.y*t.k+t.ty,u.radius=s(l),u.dimmed=i(l),d.has(l.pkg)||d.set(l.pkg,c(l.pkg)),u.color=d.get(l.pkg))}e.paintKey=h}if(e.selected!==o){e.selected=o,e.neighbors.clear();for(let d of e.graph.adj.get(o)??[]){let u=e.graph.edges[d];e.neighbors.add(u.a),e.neighbors.add(u.b)}}}function Mn(e,t,o,n){if(e.paints&&e.edgeOpacity===t&&e.neutral===o&&e.edgeSelected===n)return e.paints;let i=h=>({opacity:Math.max(0,Math.min(255,Math.round(h*255)))/255,neutral:o(h*.7)}),s=n?t*.25:t,c=n?.85:Math.min(.9,t+.5);return e.paints={base:i(s),emphasis:i(c),baseDim:i(Math.min(s,.04)),emphasisDim:i(Math.min(c,.04))},e.edgeOpacity=t,e.neutral=o,e.edgeSelected=n,e.paints}function Sn(e,t){let{a:o,b:n}=e;return(!e.gradient||e.ax!==o.node.x||e.ay!==o.node.y||e.bx!==n.node.x||e.by!==n.node.y||e.colorA!==o.color||e.colorB!==n.color)&&(e.gradient=t.createLinearGradient(o.node.x,o.node.y,n.node.x,n.node.y),e.gradient.addColorStop(0,o.color),e.gradient.addColorStop(1,n.color),e.ax=o.node.x,e.ay=o.node.y,e.bx=n.node.x,e.by=n.node.y,e.colorA=o.color,e.colorB=n.color),e.gradient}function _n(e,t,o){return(!e.halo||e.haloX!==e.x||e.haloY!==e.y||e.haloRadius!==t||e.haloColor!==e.color)&&(e.halo=o.createRadialGradient(e.x,e.y,0,e.x,e.y,t),e.halo.addColorStop(0,e.color+"55"),e.halo.addColorStop(1,e.color+"00"),e.haloX=e.x,e.haloY=e.y,e.haloRadius=t,e.haloColor=e.color),e.halo}function An(e,t,o,n){return e.x<-2&&t.x<-2||e.x>o+2&&t.x>o+2||e.y<-2&&t.y<-2||e.y>n+2&&t.y>n+2}function ao(e,t,o,n,i){return e+o<-2||e-o>n+2||t+o<-2||t-o>i+2}function Rn(e){let o=new Map;for(let[n,i]of e.entries()){let s=Math.floor(i.x/32),c=Math.floor(i.y/32);o.has(s)||o.set(s,new Map);let h=o.get(s);h.has(c)||h.set(c,[]),h.get(c).push({node:i,index:n})}return(n,i,s,c,h,d)=>{let{k:u,tx:l,ty:r}=s,M=(c+6)/u+1e-7,y=(n-l)/u,m=(i-r)/u,F=Math.floor((y-M)/32),a=Math.floor((y+M)/32),b=Math.floor((m-M)/32),A=Math.floor((m+M)/32),f=null,w=1/0,v=1/0;for(let S=F;S<=a;S++){let H=o.get(S);if(H)for(let X=b;X<=A;X++)for(let{node:T,index:x}of H.get(X)??[]){if(!d(T))continue;let B=T.x*u+l-n,E=T.y*u+r-i,U=B*B+E*E,p=h(T)+6;U<p*p&&(U<w||U===w&&x<v)&&(f=T,w=U,v=x)}}return f}}function Tn(e,t,o,n,i){if(!e||e.key!==t.key)return null;let s=(t.tx-e.tx)*i,c=(t.ty-e.ty)*i;if(!Number.isInteger(s)||!Number.isInteger(c)||!Number.isInteger(s/i)||!Number.isInteger(c/i)||!s&&!c||Math.abs(s)>=o*i||Math.abs(c)>=n*i)return null;let h=s/i,d=c/i,u=[],l=2;return h>0&&u.push({x:0,y:0,w:Math.min(o,h+l),h:n}),h<0&&u.push({x:Math.max(0,o+h-l),y:0,w:Math.min(o,-h+l),h:n}),d>0&&u.push({x:0,y:0,w:o,h:Math.min(n,d+l)}),d<0&&u.push({x:0,y:Math.max(0,n+d-l),w:o,h:Math.min(n,-d+l)}),{dx:s,dy:c,rects:u}}function Ot(e,t,o,n,i){return e&&e.rects.every(s=>n<s.x||t>s.x+s.w||i<s.y||o>s.y+s.h)}var Ni={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},lo={dark:{bg:"#0c0c0c",grid:"rgba(255, 255, 255, 0.022)",selectRing:"#ffffff",edgeIntra:e=>`rgba(180, 195, 215, ${e})`,hubRing:e=>`rgba(255, 255, 255, ${e})`,labelFill:"rgba(230, 233, 238, 0.78)",labelShadow:"rgba(12, 12, 12, 0.98)",labelOutline:"rgba(12, 12, 12, 0.9)",labelDefault:"rgba(200, 210, 225, 0.78)",labelHover:"rgba(230, 237, 243, 0.95)",labelSelected:"#fff"},light:{bg:"#f6f8fa",grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:e=>`rgba(50, 70, 100, ${e})`,hubRing:e=>`rgba(0, 0, 0, ${e})`,labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"},pink:{bg:"#fff0f7",grid:"rgba(0, 0, 0, 0.04)",selectRing:"#0969da",edgeIntra:e=>`rgba(50, 70, 100, ${e})`,hubRing:e=>`rgba(0, 0, 0, ${e})`,labelFill:"rgba(40, 50, 70, 0.85)",labelShadow:"rgba(255, 255, 255, 0.95)",labelOutline:"rgba(255, 255, 255, 0.9)",labelDefault:"rgba(50, 60, 80, 0.85)",labelHover:"rgba(20, 25, 35, 0.95)",labelSelected:"#000"}};function Cn(){let e=document.body.classList;return e.contains("theme-pink")?lo.pink:e.contains("theme-light")?lo.light:lo.dark}var In=(e,t)=>e.x0<t.x1&&t.x0<e.x1&&e.y0<t.y1&&t.y0<e.y1;function co(e){e.sort((o,n)=>n.prio-o.prio);let t=[];for(let o of e){let n=!1;for(let i of t)if(In(o,i)){n=!0;break}n||t.push(o)}return t}var Di=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pe(e){let t=Math.max(0,Math.min(255,Math.round(e*255)));return Di[t]}function Ui(e,t,o,n){let s=e.querySelector("graph-layout")?.shadowRoot;if(!s)return;let c=s.querySelector("#g2-canvas"),h=s.querySelector("#g2-tooltip"),d=s.querySelector(".graph2-stage"),u=s.querySelector(".g2-stage-stats"),l=s.querySelector("#g2-zoom-pct");if(!c)return;jo();let r=c.getContext("2d"),M=window.devicePixelRatio||1,y=0,m=0,F=0,a={tx:0,ty:0,k:1},b=null,A=0,f=0,w=!0,v=!0,S=new WeakMap,H=null,X=null,T=null,x=()=>t.supportsLayers&&k.bundleLayout==="layers"&&!k.focusedPkg,B=()=>x()||k.packagesView&&(t.canPackagesView??!1)&&!k.focusedPkg,E=null,U=null;function p(){if(!U&&(U=Ko(t),x()&&t.layerRoots?.appImports.length>0)){if(!U.byPkg.has("__own__")){let g={file:"__own__",pkg:"__own__",label:"App (source not bundled)",size:null,fileCount:0,totalIssues:0};U.nodes.push(g),U.byPkg.set("__own__",g)}U.importsOf.set("__own__",[...new Set([...U.importsOf.get("__own__")??[],...t.layerRoots.appImports])])}return U}let R=g=>g==="__own__"?"App":E?.depth.get(g)===0?`App \xB7 ${Te(g)}`:Te(g);function P(g,$,I){if(g.nodes.length>50){ro(g,$,I);return}let _=so(g.nodes.map(L=>L.pkg),g.importsOf,$,I,{groupOf:L=>L});J(g.nodes,new Map(_.map(L=>[L.file,L])))}function J(g,$){for(let I of g){let _=$.get(I.file);_&&(I.x=_.x,I.y=_.y)}}function K(){if(!w)return;if(X=null,T=null,H=null,x()){let L=p();E=yn(L.nodes.map(N=>({id:N.pkg,size:N.size})),L.importsOf,t.layerRoots?.roots??["__own__"],{width:Math.max(360,f-190)}),w=!1;return}let g=k.layoutCache,$=k.focusedPkg,I=B(),_=I?p().nodes:t.nodes;if(g&&g.files===t.files&&g.w===f&&g.h===A&&g.focused===$&&(g.pkgView??!1)===I)J(_,g.pos);else{if(I)P(p(),f,A);else if($)if(t.nodes.length>50)ro(t,f,A);else{let N=so(t.files,t.importsOf,f,A);J(t.nodes,new Map(N.map(q=>[q.file,q])))}else vn(t,f,A);let L=new Map;for(let N of _)L.set(N.file,{x:N.x,y:N.y});k.layoutCache={files:t.files,w:f,h:A,pos:L,focused:$,pkgView:I}}w=!1}function me(){if(x()&&E){let D=Math.min((m-24)/(E.width+185),(y-70)/(E.height+E.gap),1.5),j=Math.max(.05,D);return{k:j,tx:(m-(E.width+185)*j)/2+145*j,ty:24+Math.max(0,(y-70-(E.height+E.gap)*j)/2)}}let g=B()?p().nodes:t.nodes;if(g.length===0)return{k:1,tx:m/2,ty:(y-F)/2};let $=-1/0,I=-1/0,_=1/0,L=1/0;for(let D of g)D.x<_&&(_=D.x),D.y<L&&(L=D.y),D.x>$&&($=D.x),D.y>I&&(I=D.y);let N=Math.max(20,I-L),q=Math.max(20,$-_),re=(_+$)/2,ne=(L+I)/2,ee=Math.max(20,Math.min(m,y)*.03),O=Math.min((m-ee*2)/q,(y-ee*2-F)/N,4),C=Math.max(.05,O);return{k:C,tx:m/2-re*C,ty:(y-F)/2-ne*C}}function ze(){let g=me();a.k=g.k,a.tx=g.tx,a.ty=g.ty}function pe(g,$){return[g*a.k+a.tx,$*a.k+a.ty]}function Ne(g,$){return[(g-a.tx)/a.k,($-a.ty)/a.k]}function ae(g){return!k.hidden.has(g.pkg)}function De(g,$,I,_,L){let N=I+(_==="critical"?4.2:_==="high"?3.4:2.8),q=_==="critical"?1.8:_==="high"?1.5:_==="medium"?1.3:1.1;r.strokeStyle=Ni[_],r.globalAlpha=L,r.lineWidth=q,r.beginPath(),r.arc(g,$,N,0,Math.PI*2),r.stroke(),r.globalAlpha=1}function je(g,$,I,_,L,N,q){let ee=q?.1:.9,O=2*(1-ee)*(I-g)+2*ee*(L-I),C=2*(1-ee)*(_-$)+2*ee*(N-_),D=Math.sqrt(O*O+C*C)||1,j=O/D,Z=C/D;r.beginPath(),q?(r.moveTo(g,$),r.lineTo(g+j*7-Z*2.94,$+Z*7+j*2.94),r.lineTo(g+j*7+Z*2.94,$+Z*7-j*2.94)):(r.moveTo(L,N),r.lineTo(L-j*7+Z*2.94,N-Z*7-j*2.94),r.lineTo(L-j*7-Z*2.94,N-Z*7+j*2.94)),r.closePath()}function Ce(g){if(k.selectedSeverities.size>0){let I=g.severitySet;if(!I)return!0;let _=!1;for(let L of k.selectedSeverities)if(I.has(L)){_=!0;break}if(!_)return!0}if(k.selectedColors.size>0){let I=g.colorSet;if(!I)return!0;let _=!1;for(let L of k.selectedColors)if(I.has(L)){_=!0;break}if(!_)return!0}if(k.solo&&g.pkg!==k.solo&&!B())return!0;let $=k.pathFilter;if($){let I=$.toLowerCase(),_=g.pathText?g.pathText.includes(I):g.file.toLowerCase().includes(I),L=g.pkg&&g.pkg.toLowerCase().includes(I),N=g.label&&g.label.toLowerCase().includes(I);if(!_&&!L&&!N)return!0}return!1}function Ie(g){let $=(g.isHub?4.9:3.5)*k.nodeSize,I=Math.max(.6,Math.min(1.6,a.k));return $*I}function tt(){let g=d.getBoundingClientRect(),$=y,I=m;m=Math.max(80,g.width),y=Math.max(80,g.height),F=u?(parseFloat(getComputedStyle(u).lineHeight)||0)+8:0,M=window.devicePixelRatio||1,c.width=m*M,c.height=y*M,X=null,S.delete(t),U&&S.delete(U),c.style.width=m+"px",c.style.height=y+"px",r.setTransform(M,0,0,M,0,0),(f===0||A===0)&&(f=m,A=y,w=!0),K();let _=I>0&&(Math.abs(m-I)/I>.15||Math.abs(y-$)/$>.15);(v||_)&&(ze(),v=!1),he()}let mt=null,fe=!0,ge=!1,Le=!1;function he(){fe=!0,!(ge||Le)&&(ge=!0,mt=requestAnimationFrame(()=>{ge=!1,fe&&!Le&&(fe=!1,bt())}))}function bt(){let g=B()?p():t;if(T?.graph!==g){T={graph:g,x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let q of g.nodes)T.x0=Math.min(T.x0,q.x),T.x1=Math.max(T.x1,q.x),T.y0=Math.min(T.y0,q.y),T.y1=Math.max(T.y1,q.y)}let $=Ie({isHub:!0})*6+8,_=T.x0*a.k+a.tx>$&&T.y0*a.k+a.ty>$&&T.x1*a.k+a.tx<m-$&&T.y1*a.k+a.ty<y-$&&a.k<=1.4&&g.nodes.length>50&&!x(),L={tx:a.tx,ty:a.ty,key:JSON.stringify([a.k,Cn().bg,k.nodeSize,k.edgeOpacity,b,k.selected,k.solo,k.focusedPkg,B(),k.showAll,k.pathFilter,[...k.selectedSeverities],[...k.selectedColors],[...k.hidden]])},N=_?Tn(X,L,m,y,M):null;r.save();try{if(N){r.save(),r.setTransform(1,0,0,1,0,0),r.globalCompositeOperation="copy",r.drawImage(c,N.dx,N.dy),r.restore(),r.beginPath();for(let q of N.rects)r.rect(q.x,q.y,q.w,q.h);r.clip()}xt(N),X=_?L:null}finally{r.restore()}}function xt(g){let $=Cn();r.fillStyle=$.bg,r.fillRect(0,0,m,y),En($);let I=B(),_=I?p():t,L=I?k.solo:k.selected,N=L?_.nodeByFile.get(L):null,q=N?L:null;if(x()){r.save(),r.translate(a.tx,a.ty),r.scale(a.k,a.k),wn(r,E,{theme:$,scale:a.k,selected:q,hovered:b,colorOf:le,labelOf:R,sizeLabel:V=>Be(typeof V=="number"?V:_.byPkg.get(V).size)||"Size unknown",dimmed:V=>Ce(_.byPkg.get(V))}),r.restore(),l&&(l.textContent=`${Math.round(a.k*100)}%`);return}if(I&&_.nodes.length<=50){zn($);return}if(k.focusedPkg&&_.nodes.length<=50){Pn($,q,N);return}S.has(_)||S.set(_,kn(_));let re=S.get(_),ne=JSON.stringify([a.k,a.tx,a.ty,k.nodeSize,$.bg,k.solo,k.pathFilter,[...k.selectedSeverities],[...k.selectedColors],[...k.hidden]]);$n(re,{viewport:a,selected:q,paintKey:ne,visible:ae,dimmed:Ce,radius:Ie,color:le});let ee=Mn(re,k.edgeOpacity,$.edgeIntra,!!q),O=q||b,C=.85/a.k,D=.55/a.k,j=null,Z=null,te=null;r.save(),r.translate(a.tx,a.ty),r.scale(a.k,a.k);for(let V of re.edges){let{edge:G,a:W,b:Y}=V;if(!W.visible||!Y.visible||An(W,Y,m,y)||Ot(g,Math.min(W.x,Y.x)-2,Math.min(W.y,Y.y)-2,Math.max(W.x,Y.x)+2,Math.max(W.y,Y.y)+2))continue;let se=O&&(G.a===O||G.b===O),oe=W.dimmed&&Y.dimmed?se?ee.emphasisDim:ee.baseDim:se?ee.emphasis:ee.base,ce=G.cross?Sn(V,r):oe.neutral,de=G.cross?oe.opacity:1,we=G.cross?C:D;ce!==Z&&(r.strokeStyle=ce,Z=ce),de!==j&&(r.globalAlpha=de,j=de),we!==te&&(r.lineWidth=we,te=we),r.beginPath(),r.moveTo(W.node.x,W.node.y),r.lineTo(Y.node.x,Y.node.y),r.stroke()}r.restore();for(let V of re.nodes){if(!V.visible)continue;let G=V.node,W=G.file===b,Y=G.file===q;if(!G.isHub&&!W&&!Y||V.dimmed&&!W&&!Y)continue;let se=V.radius,oe=V.x,ce=V.y,de=se*(Y?6:W?4.5:3);ao(oe,ce,de,m,y)||Ot(g,oe-de-2,ce-de-2,oe+de+2,ce+de+2)||(r.fillStyle=_n(V,de,r),r.beginPath(),r.arc(oe,ce,de,0,Math.PI*2),r.fill())}for(let V of re.nodes){if(!V.visible)continue;let G=V.node,W=V.radius,Y=V.x,se=V.y;if(ao(Y,se,W+6,m,y)||Ot(g,Y-W-8,se-W-8,Y+W+8,se+W+8))continue;let oe=1,ce=q&&G.file===q;q&&!ce&&(oe=re.neighbors.has(G.file)?1:.25),!ce&&V.dimmed&&(oe=Math.min(oe,.1)),r.fillStyle=V.color+Pe(oe),r.beginPath(),r.arc(Y,se,W,0,Math.PI*2),r.fill(),G.isHub&&(r.strokeStyle=$.hubRing(.55*oe),r.lineWidth=.8,r.stroke()),G.issue&&De(Y,se,W,G.issue,oe)}if(a.k>1.4){let G=0;if(a.k<9&&!k.showLabels)for(let Y of _.nodes){if(!ae(Y))continue;let[se,oe]=pe(Y.x,Y.y);if(!(se<0||se>m||oe<0||oe>y)&&(G++,G>=50))break}let W=a.k>=9||G<50;if(k.showLabels||W){r.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.fillStyle=$.labelFill,r.textAlign="left",r.textBaseline="middle";let Y=11,se=2,oe=250,ce=(Q,ue)=>Q>-oe&&Q<m+oe&&ue>-oe&&ue<y+oe,de=[];for(let Q of _.nodes){if(!ae(Q))continue;let[ue,be]=pe(Q.x,Q.y);if(!ce(ue,be))continue;let xe=Ie(Q);de.push({file:Q.file,x0:ue-xe,x1:ue+xe,y0:be-xe,y1:be+xe})}let we=[];for(let Q of _.nodes){if(!ae(Q)||!Q.isHub&&a.k<2.4)continue;let[ue,be]=pe(Q.x,Q.y);if(!ce(ue,be))continue;let xe=Ie(Q),Ae=ue+xe+4,ve=be+1,ke=r.measureText(Q.label).width+se,$e=Q.file===q,Me=Q.file===b,Oe=$e?3:Me?2:Q.isHub?1:0;we.push({file:Q.file,n:Q,tx:Ae,ty:ve,prio:Oe,x0:Ae-se,x1:Ae+ke,y0:ve-Y/2,y1:ve+Y/2})}let qe=co(we.filter(Q=>!de.some(ue=>ue.file!==Q.file&&In(Q,ue))));for(let Q of qe)r.fillText(Q.n.label,Q.tx,Q.ty)}}if(N&&ae(N)){let[V,G]=pe(N.x,N.y),W=Ie(N);r.strokeStyle=$.selectRing,r.lineWidth=1.5,r.beginPath(),r.arc(V,G,W+5,0,Math.PI*2),r.stroke()}l&&(l.textContent=`${Math.round(a.k*100)}%`)}function En(g){if(a.k<.4)return;let $=80,I=(a.tx%$+$)%$,_=(a.ty%$+$)%$;r.strokeStyle=g.grid,r.lineWidth=1,r.beginPath();for(let L=I;L<m;L+=$)r.moveTo(L,0),r.lineTo(L,y);for(let L=_;L<y;L+=$)r.moveTo(0,L),r.lineTo(m,L);r.stroke()}function Pn(g,$,I){let _=le(k.focusedPkg),L=g.hubRing(.55),N=new Set;if(b){N.add(b);for(let C of t.adj.get(b)??[]){let D=t.edges[C];N.add(D.a),N.add(D.b)}}let q=C=>(C.isHub?6:4)*k.nodeSize;for(let C of t.edges){let D=t.nodeByFile.get(C.a),j=t.nodeByFile.get(C.b);if(!D||!j||!ae(D)||!ae(j))continue;let Z=C.fromLo&&C.fromHi,te=!Z&&C.fromHi,V=te?j:D,G=te?D:j,W=b&&(C.a===b||C.b===b),Y=$&&(C.a===$||C.b===$),se=($||b)&&!W&&!Y,oe=q(V),ce=q(G),[de,we]=pe(V.x,V.y),[qe,Q]=pe(G.x,G.y),ue=qe-de,be=Q-we,xe=Math.sqrt(ue*ue+be*be)||1,Ae=ue/xe,ve=be/xe,ke=de+Ae*(oe+1.5),$e=we+ve*(oe+1.5),Me=qe-Ae*(ce+3.5),Oe=Q-ve*(ce+3.5),nt=Math.min(xe*.15,30),Ge=(ke+Me)/2-ve*nt,Se=($e+Oe)/2+Ae*nt;r.beginPath(),r.moveTo(ke,$e),r.quadraticCurveTo(Ge,Se,Me,Oe);let Ee;Y?Ee=.9:W?Ee=.85:se?Ee=.05:Ee=Math.min(.85,k.edgeOpacity*3),r.strokeStyle=_+Pe(Ee),r.lineWidth=Y||W?1.5:.85,r.stroke(),!se&&(je(ke,$e,Ge,Se,Me,Oe,!1),r.fillStyle=_+Pe(Math.min(1,Ee+.15)),r.fill(),Z&&(je(ke,$e,Ge,Se,Me,Oe,!0),r.fill()))}for(let C of t.nodes){if(!ae(C))continue;let[D,j]=pe(C.x,C.y),Z=q(C),te=C.file===b,V=C.file===$,G=($||b)&&!N.has(C.file)&&!V?.15:1;if(r.globalAlpha=G,V||te||C.isHub){let W=Z*(V?4:te?3:2.4),Y=r.createRadialGradient(D,j,Z*.6,D,j,W);Y.addColorStop(0,_+Pe(V?.4:.25)),Y.addColorStop(1,_+"00"),r.fillStyle=Y,r.beginPath(),r.arc(D,j,W,0,Math.PI*2),r.fill()}r.fillStyle=_,r.beginPath(),r.arc(D,j,Z,0,Math.PI*2),r.fill(),C.isHub&&(r.strokeStyle=L,r.lineWidth=.9,r.stroke()),C.issue&&De(D,j,Z,C.issue,G),r.globalAlpha=1}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let re=13,ne=2,ee=[];for(let C of t.nodes){if(!ae(C))continue;let[D,j]=pe(C.x,C.y),Z=q(C),te=j+Z+4,V=r.measureText(C.label).width/2+ne,G=C.file===$,W=C.file===b,Y=G?3:W?2:C.isHub?1:0;ee.push({n:C,sx:D,ty:te,halfW:V,isSel:G,isHov:W,prio:Y,x0:D-V,x1:D+V,y0:te,y1:te+re})}let O=co(ee);for(let C of O){let{n:D,sx:j,ty:Z,isSel:te,isHov:V}=C,G=($||b)&&!N.has(D.file)&&!te?.2:1;r.globalAlpha=G,r.shadowColor=g.labelShadow,r.shadowBlur=4,r.strokeStyle=g.labelOutline,r.lineWidth=3,r.strokeText(D.label,j,Z),r.shadowBlur=0,r.fillStyle=te?g.labelSelected:V?g.labelHover:g.labelDefault,r.fillText(D.label,j,Z),r.globalAlpha=1}if(I&&ae(I)){let[C,D]=pe(I.x,I.y),j=q(I);r.strokeStyle=g.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(C,D,j+4,0,Math.PI*2),r.stroke()}l&&(l.textContent=`${Math.round(a.k*100)}%`)}function ot(g){return Math.min(26,5+Math.sqrt(g.fileCount)*1.7)*k.nodeSize}function zn(g){let $=p(),I=k.solo&&$.byPkg.has(k.solo)?k.solo:null,_=b??I,L=new Set;if(_){L.add(_);for(let O of $.edges)O.a===_?L.add(O.b):O.b===_&&L.add(O.a)}let N=O=>{if(O.pkg===I||O.pkg===b)return 1;let C=1;return _&&!L.has(O.pkg)&&(C=.2),Ce(O)&&(C=Math.min(C,.1)),C};for(let O of $.edges){let C=$.byPkg.get(O.a),D=$.byPkg.get(O.b);if(!C||!D||!ae(C)||!ae(D))continue;let j=O.fromLo&&O.fromHi,Z=!j&&O.fromHi,te=Z?D:C,V=Z?C:D,G=_!==null&&(O.a===_||O.b===_),W=Ce(C)&&Ce(D),Y=_!==null&&!G||W,se=ot(te),oe=ot(V),[ce,de]=pe(te.x,te.y),[we,qe]=pe(V.x,V.y),Q=we-ce,ue=qe-de,be=Math.sqrt(Q*Q+ue*ue)||1,xe=Q/be,Ae=ue/be,ve=ce+xe*(se+1.5),ke=de+Ae*(se+1.5),$e=we-xe*(oe+3.5),Me=qe-Ae*(oe+3.5),Oe=Math.min(be*.15,30),nt=(ve+$e)/2-Ae*Oe,Ge=(ke+Me)/2+xe*Oe,Se;W?Se=.05:G?Se=.9:Y?Se=.06:Se=.5;let Ee=r.createLinearGradient(ve,ke,$e,Me);Ee.addColorStop(0,le(te.pkg)+Pe(Se)),Ee.addColorStop(1,le(V.pkg)+Pe(Se)),r.beginPath(),r.moveTo(ve,ke),r.quadraticCurveTo(nt,Ge,$e,Me),r.strokeStyle=Ee,r.lineWidth=Math.min(3.5,.8+Math.sqrt(O.count)*.3)*(G?1.3:1),r.stroke(),!Y&&(je(ve,ke,nt,Ge,$e,Me,!1),r.fillStyle=le(V.pkg)+Pe(Math.min(1,Se+.15)),r.fill(),j&&(je(ve,ke,nt,Ge,$e,Me,!0),r.fillStyle=le(te.pkg)+Pe(Math.min(1,Se+.15)),r.fill()))}for(let O of $.nodes){if(!ae(O))continue;let[C,D]=pe(O.x,O.y),j=ot(O),Z=O.pkg===b,te=O.pkg===I,V=le(O.pkg),G=N(O);if(te||Z){let W=j*(te?2.6:2.2),Y=r.createRadialGradient(C,D,j*.6,C,D,W);Y.addColorStop(0,V+Pe(te?.4:.25)),Y.addColorStop(1,V+"00"),r.fillStyle=Y,r.beginPath(),r.arc(C,D,W,0,Math.PI*2),r.fill()}r.fillStyle=V+Pe(G),r.beginPath(),r.arc(C,D,j,0,Math.PI*2),r.fill(),O.issue&&De(C,D,j,O.issue,G)}r.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",r.textAlign="center",r.textBaseline="top",r.lineJoin="round";let q=13,re=2,ne=[];for(let O of $.nodes){if(!ae(O))continue;let[C,D]=pe(O.x,O.y),j=ot(O),Z=D+j+4,te=r.measureText(O.label).width/2+re,V=O.pkg===I,G=O.pkg===b,W=V?1/0:G?1e9:O.fileCount;ne.push({p:O,sx:C,ty:Z,isSel:V,isHov:G,prio:W,x0:C-te,x1:C+te,y0:Z,y1:Z+q})}let ee=co(ne);for(let O of ee){let{p:C,sx:D,ty:j,isSel:Z,isHov:te}=O;r.globalAlpha=Math.max(.25,N(C)),r.shadowColor=g.labelShadow,r.shadowBlur=4,r.strokeStyle=g.labelOutline,r.lineWidth=3,r.strokeText(C.label,D,j),r.shadowBlur=0,r.fillStyle=Z?g.labelSelected:te?g.labelHover:g.labelDefault,r.fillText(C.label,D,j),r.globalAlpha=1}if(I){let O=$.byPkg.get(I),[C,D]=pe(O.x,O.y);r.strokeStyle=g.selectRing,r.lineWidth=1.8,r.beginPath(),r.arc(C,D,ot(O)+4,0,Math.PI*2),r.stroke()}l&&(l.textContent=`${Math.round(a.k*100)}%`)}function uo(g,$){if(x()){let[ne,ee]=Ne(g,$);for(let O of E.rects.values())if(O.width>0&&ne>=O.x&&ne<O.x+O.width&&ee>=O.y&&ee<=O.y+O.height)return p().byPkg.get(O.id);return null}let I=B(),_=I?p():t,L=I&&_.nodes.length<=50;if(_.nodes.length>50){H??=Rn(_.nodes);let ne=4.9*k.nodeSize*Math.max(.6,Math.min(1.6,a.k));return H(g,$,a,ne,Ie,ae)}let N=null,q=1/0,re=6;for(let ne of _.nodes){if(!ae(ne))continue;let[ee,O]=pe(ne.x,ne.y),C=ee-g,D=O-$,j=C*C+D*D,Z=(L?ot(ne):Ie(ne))+re;j<Z*Z&&j<q&&(q=j,N=ne)}return N}function On(g,$,I){if(!h)return;let _=le(g.pkg),L=Te(g.pkg),N=Lt(g.file,g.pkg);We(z`<div class="g2-tt-path">${N}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${_}`}"></span> <span class="g2-tt-pkg">${L}</span></div>${g.totalIssues>0?at(g.own):null}`,h),po($,I)}function Fn(g,$,I){if(!h)return;let _=le(g.pkg),L=Be(g.size);We(z`<div class="g2-tt-path">${x()?R(g.pkg):g.label}</div>${x()?z`<div class="g2-tt-pkg">${E.depth.has(g.pkg)?`Level ${E.depth.get(g.pkg)} \xB7 shortest import distance from App`:"No known import path from App"}</div>`:null}<div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${_}`}"></span> <span class="g2-tt-pkg">${g.fileCount} ${g.fileCount===1?"file":"files"}${L?` \xB7 ${L}`:""}</span></div>${g.totalIssues>0?at(g.own):null}`,h),po($,I)}function po(g,$){let I=d.getBoundingClientRect();h.classList.add("show");let _=h.offsetWidth,L=h.offsetHeight,N=g-I.left,q=$-I.top,re=I.width,ne=I.height,ee=12,O=N+ee;O+_>re-4&&(O=N-_-ee),O<4&&(O=4);let C=q+ee;C+L>ne-4&&(C=q-L-ee),C<4&&(C=4),h.style.left=`${O}px`,h.style.top=`${C}px`}function Ft(){h&&h.classList.remove("show")}let vt=!1,ct=null,Ht=!1,fo=g=>{g.button===0&&(g.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||(vt=!0,Ht=!1,ct={x:g.clientX,y:g.clientY,tx:a.tx,ty:a.ty}))},go=g=>{let $=d.getBoundingClientRect(),I=g.clientX-$.left,_=g.clientY-$.top;if(vt){let q=g.clientX-ct.x,re=g.clientY-ct.y;Math.abs(q)+Math.abs(re)>3&&(Ht=!0),a.tx=ct.tx+q,a.ty=ct.ty+re,Ft(),he();return}let L=uo(I,_),N=b;b=L?.file??null,c.style.cursor=L?"default":"grab",L?B()?Fn(L,g.clientX,g.clientY):On(L,g.clientX,g.clientY):N&&Ft(),b!==N&&he()},ho=g=>{if(vt&&!Ht){let $=d.getBoundingClientRect(),I=g.clientX-$.left,_=g.clientY-$.top,L=uo(I,_);B()?(k.solo=L&&k.solo!==L.pkg?L.pkg:null,k.selected=null,o(),n?.()):(k.selected=L?.file??null,o()),he()}vt=!1},mo=()=>{let g=b!==null;b=null,Ft(),g&&he()},bo=g=>{g.preventDefault();let $=d.getBoundingClientRect(),I=g.clientX-$.left,_=g.clientY-$.top,L=Math.exp(-g.deltaY*.0015),N=me();if(L<1&&a.k<=N.k*1.0001){a.k=N.k;let ee=Math.min(.4,(1-L)*3);a.tx+=(N.tx-a.tx)*ee,a.ty+=(N.ty-a.ty)*ee,he();return}let[q,re]=Ne(I,_),ne=Math.max(N.k,Math.min(9.99,a.k*L));a.k=ne,a.tx=I-q*a.k,a.ty=_-re*a.k,he()};d.addEventListener("mousedown",fo),window.addEventListener("mousemove",go),window.addEventListener("mouseup",ho),d.addEventListener("mouseleave",mo),d.addEventListener("wheel",bo,{passive:!1});function xo(g){let $=me().k;g=Math.max($,Math.min(9.99,g));let I=m/2,_=y/2,[L,N]=Ne(I,_);a.k=g,a.tx=I-L*a.k,a.ty=_-N*a.k,he()}let Hn=s.querySelector("#g2-zoom-in"),Bn=s.querySelector("#g2-zoom-out"),Nn=s.querySelector("#g2-zoom-fit");Hn?.addEventListener("click",()=>xo(a.k*1.4)),Bn?.addEventListener("click",()=>xo(a.k/1.4)),Nn?.addEventListener("click",()=>{ze(),he()}),tt();let vo=new ResizeObserver(()=>tt());vo.observe(d);let yo=new MutationObserver(g=>{for(let $ of g){let I=($.oldValue||"").includes("report-fullscreen"),_=document.body.classList.contains("report-fullscreen");if(I!==_){f=0,A=0,w=!0,v=!0,k.layoutCache=null,setTimeout(()=>tt(),80);return}he()}});yo.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),he(),k.graphState={requestDraw:he,_cleanup:()=>{Le=!0,cancelAnimationFrame(mt),vo.disconnect(),yo.disconnect(),d.removeEventListener("mousedown",fo),window.removeEventListener("mousemove",go),window.removeEventListener("mouseup",ho),d.removeEventListener("mouseleave",mo),d.removeEventListener("wheel",bo)}}}function ca(e,t){let o=document.querySelector("graph-layout")?.shadowRoot;if(!o)return;let n=Ln(e),i=o.querySelector("#g2-selection-area");i&&We(tn(n,t),i);let s=o.querySelector("#g2-focus-overlay-slot");s&&We(Jo(n),s)}function da(e){let t=document.querySelector("graph-layout")?.shadowRoot;if(!t)return;let o=t.querySelector("#g2-top-pkgs-block");o&&We(en(Ln(e)),o)}function Ln(e){let t=Yo(e.treeData,e.files,e.ownCounts,e.transitiveCounts,e.severitySets,e.colorSets,e.fileFindings,e.options);if(e.strippedToOrig)for(let o of t.nodes)o.origFile=e.strippedToOrig.get(o.file);return t.canPackagesView=e.canPackagesView??!1,t.supportsLayers=e.supportsLayers??!1,t.layerRoots=e.layerRoots,t.ownSourcePackages=e.ownSourcePackages,t.reasons=e.reasons??[],t}export{fi as _swapGraph2Impl,Ui as attachGraph2Interaction,Ln as buildGraphFromPrep,ca as refreshSidebar,da as refreshTopPkgs};
|
|
12
|
+
/*! Bundled license information:
|
|
13
|
+
|
|
14
|
+
lit-html/lit-html.js:
|
|
15
|
+
lit-html/directive.js:
|
|
16
|
+
lit-html/directives/unsafe-html.js:
|
|
17
|
+
(**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2017 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*)
|
|
22
|
+
|
|
23
|
+
lit-html/directive-helpers.js:
|
|
24
|
+
lit-html/directives/live.js:
|
|
25
|
+
(**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2020 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*)
|
|
30
|
+
*/
|