@preventive/triage 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/common/save-error-reason.ts +53 -0
  3. package/common/utf8.d.ts +13 -0
  4. package/common/utf8.js +57 -0
  5. package/out/brotli-fallback.js +3 -0
  6. package/out/client-sync.js +15 -0
  7. package/out/graph.js +4 -0
  8. package/out/icon-maskable.svg +5 -0
  9. package/out/icon.svg +5 -0
  10. package/out/index.html +78 -0
  11. package/out/manifest.webmanifest +30 -0
  12. package/out/prism.js +14 -0
  13. package/out/terminal.js +39 -0
  14. package/out/view.css +1 -0
  15. package/out/view.html +12 -0
  16. package/out/view.js +138 -0
  17. package/package.json +129 -0
  18. package/server/auth.ts +99 -0
  19. package/server/config.example.json +3 -0
  20. package/server/config.ts +196 -0
  21. package/server/db-neon.ts +374 -0
  22. package/server/db-revision-sql.ts +152 -0
  23. package/server/db-stmt.ts +53 -0
  24. package/server/db.ts +577 -0
  25. package/server/http.ts +142 -0
  26. package/server/hub.ts +98 -0
  27. package/server/index.ts +353 -0
  28. package/server/lifecycle.ts +177 -0
  29. package/server/neon-driver.ts +26 -0
  30. package/server/objstore/blob-fs.ts +164 -0
  31. package/server/objstore/blob-vercel.ts +508 -0
  32. package/server/objstore/blob.ts +169 -0
  33. package/server/objstore/fs.ts +67 -0
  34. package/server/objstore/handlers.ts +235 -0
  35. package/server/objstore/init.ts +118 -0
  36. package/server/objstore/reaper.ts +199 -0
  37. package/server/objstore/rest.ts +484 -0
  38. package/server/objstore/sign.ts +164 -0
  39. package/server/objstore/store-neon.ts +351 -0
  40. package/server/objstore/store.ts +799 -0
  41. package/server/objstore/tokens.ts +168 -0
  42. package/server/origin.ts +68 -0
  43. package/server/peer.ts +38 -0
  44. package/server/sign.ts +231 -0
  45. package/server/static.ts +374 -0
  46. package/server/sync-handlers.ts +311 -0
  47. package/server/util.ts +27 -0
  48. package/server/validation.ts +36 -0
  49. package/server/ws-server.ts +245 -0
package/out/graph.js ADDED
@@ -0,0 +1,4 @@
1
+ var he=globalThis[Symbol.for("@rray/frontend")];if(!he)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:me,html:A,nothing:Oe,unsafeCSS:Vt,render:St,StateElement:ao,classMap:vt,repeat:xe,styleMap:$t}=he;var ve=`*,*: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);border-color:var(--accent)}&.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 ye=`.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}}
3
+ `;var ke=`.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}.sort-wrapper{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}}& 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{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}}& 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}}.sep{border-left:1px solid var(--border);height:1.2rem}.result-count{color:var(--muted);margin-left:auto}.checkbox-label{display:inline-flex;align-items:center;gap:.25rem;color:var(--muted);& input{margin:0}}}.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{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-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-invalid{color:var(--muted)}.triage-state-btn.active.triage-state-ignored{color:var(--accent, #2563eb)}view-mode-buttons{display:contents}.view-mode-group{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-toggle{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:.8rem;&: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)}}}.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{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;&:focus-within{border-color:var(--accent)}& svg{color:var(--muted);flex-shrink:0}& 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}}}@media(width<=1200px){.toolbar-row.sev-row .search-row{flex-basis:100%}}.findings-content.with-details .toolbar{max-width:1200px}.sev-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 ct=["critical","high","medium","low","high_bug","bug","informational"],Ne="node_modules";function Ut(){return Ne}function Yt(e){return typeof e!="number"||!Number.isFinite(e)?null:`${e.toLocaleString()} B`}function We(){return{showAll:!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 gt=We(),S=new Proxy(gt,{get(e,t){return gt[t]},set(e,t,r){return gt[t]=r,!0},has(e,t){return t in gt},deleteProperty(e,t){return delete gt[t]},ownKeys(){return Reflect.ownKeys(gt)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(gt,t)}});function we(){S.graphState?._cleanup&&S.graphState._cleanup(),S.graphState=null}function Ge(e){e&&(gt=e)}function Kt(e){if(!e)return null;let t=Ut()==="node_modules"?/^(?:.*\/)?node_modules\/(@[^/]+\/[^/]+|[^/]+)/u:/^(?:.*\/)?dependencies\/(@[^/]+\/[^/]+|[^/]+)/u,r=e.match(t);if(r)return r[1];let d=e.indexOf("/");return d>0?e.slice(0,d):"/"}var Ve=["#4e9af1","#f28e2b","#59a14f","#e15759","#76b7b2","#edc948","#b07aa1","#ff9da7","#9c755f","#5cd1e5","#f1ce63","#d37295","#a0cbe8","#86bcb6","#8cd17d","#b6992d","#499894","#e15759","#e879c7","#d4a6c8"],Me=["#2f8aef","#d2691e","#2ea043","#e63946","#2e9a92","#b88817","#9560e8","#d24a9c","#8a5d40","#0891b2","#a07a14","#c14e8e","#1f7ad0","#549b94","#3fb95f","#a07a14","#2a8278","#cb2c40","#c026d3","#965f93"];function Ue(){return typeof document<"u"&&document.body?.classList.contains("theme-light")}var ie=new Map;function st(e){let t=Ue()?Me:Ve,d=`${t===Me?"l":"d"}:${e??"__own__"}`;if(ie.has(d))return ie.get(d);let p=e??"__own__",m=0;for(let o of p)m=m*37+o.codePointAt(0)|0;let w=((m%t.length+t.length)%t.length*7+3)%t.length,R=t[w];return ie.set(d,R),R}function Se(e){if(!e)return 0;let t=0;for(let r of ct)t+=e[r]??0;return t}function Ye(e){if(!e)return null;for(let t of ct)if((e[t]??0)>0)return t;return null}function $e(e,t,r,d,p,m,g,w={}){let R=w.pkgOf??Kt,o=new Set(t),y=new Map,b=new Map;for(let f of t){let $=(e[f].imports??[]).filter(W=>o.has(W));y.set(f,$);for(let W of $)b.has(W)||b.set(W,[]),b.get(W).push(f)}let _=t.map(f=>{let $=r.get(f),W=d?.get(f)??null,h=Se($),V=R(f)??"__own__",N=Ye($);return{id:f,file:f,pkg:V,x:0,y:0,deg:0,issue:N,totalIssues:h,own:$,subtree:W,size:typeof e[f]?.size=="number"?e[f].size:null,severitySet:p?.get(f)??null,colorSet:m?.get(f)??null,findings:g?.get(f)??null,isHub:!1,label:f.split("/").pop()??f}}),i=new Map(_.map(f=>[f.file,f])),B=new Map;for(let f of t)for(let $ of y.get(f)??[]){let[W,h]=f<$?[f,$]:[$,f],V=`${W}\0${h}`,N=B.get(V);if(!N){let j=i.get(W),H=i.get(h);if(!j||!H)continue;N={a:W,b:h,cross:j.pkg!==H.pkg,fromLo:!1,fromHi:!1},B.set(V,N),j.deg++,H.deg++}f===W?N.fromLo=!0:N.fromHi=!0}let C=[...B.values()],l=new Map;for(let f=0;f<C.length;f++){let $=C[f];l.has($.a)||l.set($.a,[]),l.has($.b)||l.set($.b,[]),l.get($.a).push(f),l.get($.b).push(f)}let v=new Map;for(let f of _)v.set(f.pkg,(v.get(f.pkg)??0)+1);let I=[...v.entries()].toSorted((f,$)=>$[1]-f[1]).map(([f])=>f),P=new Map;for(let f of _)P.has(f.pkg)||P.set(f.pkg,[]),P.get(f.pkg).push(f);let F={files:t,nodes:_,nodeByFile:i,edges:C,adj:l,importsOf:y,importedBy:b,packages:I,pkgCount:v,byPkg:P};return Ke(F),F}function Ke(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 r=e.importedBy.get(t.file);(!r||r.length===0)&&(t.isHub=!0)}}function Xt(e,t){if(!t||t==="/"||t==="__own__")return e;for(let r of["node_modules","dependencies",Ut()]){let d=r+"/"+t+"/",p=e.indexOf(d);if(p>=0)return e.slice(p+d.length)}return e.startsWith(t+"/")?e.slice(t.length+1):e}function ze(e,t){let r=t.extraTopRow,d=t.hideAllFiles??!1,p=t.triageCounts??{fixed:0,invalid:0,deleted:0},m=t.triageStates??["fixed","invalid","deleted"],g=t.shownTriage??null,w={};for(let C of ct)w[C]=0;for(let C of e.nodes)if(C.severitySet)for(let l of C.severitySet)w[l]!==void 0&&w[l]++;let R=ct.some(C=>w[C]>0||S.selectedSeverities.has(C)),o=["none","red","blue","green","gray"],y={none:0,red:0,blue:0,green:0,gray:0};for(let C of e.nodes)if(C.colorSet)for(let l of C.colorSet)y[l]!==void 0&&y[l]++;let b=o.some(C=>y[C]>0||S.selectedColors.has(C)),i=m.reduce((C,l)=>C+(p[l]??0),0)>0||g?A`<div class="triage-selector graph2-triage-selector" role="group" aria-label="Triage view">${m.map(C=>{let l=p[C]??0,v=g===C;return l===0&&!v?null:A`<button type="button" class="${vt({"triage-state-btn":!0,[`triage-state-${C}`]:!0,active:v})}" data-triage-show="${C}" title="${v?`Exit ${C} view`:`Show ${C} (${l})`}" aria-pressed="${String(v)}">${C.charAt(0).toUpperCase()+C.slice(1)} (${l})</button>`})}</div>`:null,B=d?null:A`<button type="button" class="${vt({"g2-topbar-toggle":!0,on:S.showAll})}" data-g2-show-all aria-pressed="${String(S.showAll)}"><span>All files</span><span class="g2-switch"></span></button>`;return A`<div class="graph2-topbar">${r?A`<div class="graph2-topbar-row graph2-topbar-row-extra toolbar-row">${r} ${B}<div class="g2-spacer"></div>${i}</div>`:null}<div class="graph2-topbar-row graph2-topbar-row-main toolbar-row sev-row">${R?A`<severity-chips counts="${JSON.stringify(w)}" selected="${JSON.stringify([...S.selectedSeverities])}" kind="graph"></severity-chips>`:null} ${b?A`<triage-filter counts="${JSON.stringify(y)}" selected="${JSON.stringify([...S.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="${S.pathFilter}"> <button type="button" class="g2-path-filter-clear" id="g2-path-filter-clear" title="Clear filter" aria-label="Clear filter">✕</button></div>${r?null:B}<div class="g2-spacer"></div>${r?null:i} <button type="button" class="g2-icon-btn" id="g2-fullscreen" title="Toggle fullscreen">⛶</button></div></div>`}function Xe(e,t){let r=e.split("/").filter(Boolean),d=t.split("/").filter(Boolean),p=0;for(;p<r.length&&p<d.length&&r[p]===d[p];)p++;let m=r.length-p,g=d.slice(p).join("/");return m===0?"./"+g:"../".repeat(m)+g}function Je(e,t){if(!t&&t!=="")return e;let r=Xe(t,e);return r.length<e.length?r:e}function ae(e,t,r,d){let p=r.length;if(p===0)return A`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${p})</div><div class="g2-sel-section-empty">none</div></div>`;let m=r.map(g=>({file:g,display:Je(g,d)}));return m.sort((g,w)=>g.display.localeCompare(w.display)),A`<div class="g2-sel-section"><div class="g2-sel-section-label">${t} (${p})</div><ul class="g2-sel-file-list">${m.map(({file:g,display:w})=>{let R=e.nodeByFile.get(g),o=R?st(R.pkg):"#666";return A`<li><button type="button" class="g2-sel-file-link" data-g2-select="${g}" title="${g}"><span class="g2-sel-file-dot" style="${$t({background:o})}"></span> <span class="g2-sel-file-path">${w}</span></button></li>`})}</ul></div>`}function Rt(e){if(!e)return A`<div class="g2-sel-section-empty">none</div>`;let r=["critical","high","medium","low","high_bug","bug","informational"].filter(d=>(e[d]??0)>0);return r.length===0?A`<div class="g2-sel-section-empty">none</div>`:A`<div class="tree-count-chips">${r.map(d=>A`<span class="${`tree-count-chip ${d}`}">${e[d]} ${d.replaceAll("_"," ")}</span>`)}</div>`}function Ce(e){let t=0;for(let g of e.edges)g.cross&&t++;let r=e.edges.length-t,d=0;for(let g of e.nodes)d+=g.totalIssues;let p=e.nodes.length===0?"0.0":(e.edges.length*2/e.nodes.length).toFixed(1),m=S.focusedPkg==="__own__"?"own source":S.focusedPkg;return A`<main class="graph2-stage"><canvas id="g2-canvas"></canvas>${S.focusedPkg?A`<div class="g2-stage-overlay"><button type="button" class="g2-back-btn" id="g2-back-to-full" title="Back to the full graph">← ${m}</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 (${r} intra · ${t} cross)</span> <span><b>${d}</b> issues</span> <span>avg degree <b>${p}</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 Pe(e){let t=null;if(S.selected){let d=e.nodeByFile.get(S.selected);d&&(t=d.pkg)}else S.solo&&(t=S.solo);return!t||(e.pkgCount.get(t)??0)<=1||S.focusedPkg===t?null:A`<button type="button" class="g2-focus-pkg-btn" data-g2-focus-pkg="${t}" title="${`Focus on ${t==="__own__"?"own source":t}'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 _e(){return A`<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 Fe(e){let t=S.showAll&&e.nodes.length>0&&e.nodes.every(p=>typeof p.size=="number"),r=e.nodes.some(p=>p.totalIssues>0),d=S.topPkgsTab;return d==="size"&&!t&&(d="files"),d==="issues"&&!r&&(d="files"),A`<div class="g2-panel-title g2-panel-title-row"><span>Packages</span><div class="g2-mini-tabs">${r?A`<button type="button" class="${vt({"g2-mini-tab":!0,on:d==="issues"})}" data-g2-top-pkgs="issues">Issues</button>`:null} <button type="button" class="${vt({"g2-mini-tab":!0,on:d==="files"})}" data-g2-top-pkgs="files">Files</button> ${t?A`<button type="button" class="${vt({"g2-mini-tab":!0,on:d==="size"})}" data-g2-top-pkgs="size">Size</button>`:null}</div></div>${to(e,d)}`}function Le(e,t={}){let r=S.selected;if(r){let d=e.nodeByFile.get(r);return d?Ze(e,d,r,t):A`<div class="g2-empty-state"><strong>File not in current view</strong>Adjust filters or pick another file.</div>`}return S.solo?Qe(e,S.solo):A`<div class="g2-empty-state">Click a node or a package row to inspect.</div>`}function Ze(e,t,r,d){let p=st(t.pkg),m=t.pkg==="__own__"?"own source":t.pkg,g=Xt(r,t.pkg),w=e.importedBy.get(r)??[],R=e.importsOf.get(r)??[],o=r.lastIndexOf("/"),y=o>=0?r.slice(0,o):"";return A`<div class="g2-selection-card"><div class="g2-sel-file-head"><div class="g2-sel-path">${g}</div><div class="g2-sel-pkg-row"><span class="g2-sel-dot" style="${$t({"--dot":p,background:p})}"></span> <span class="g2-sel-pkg">${m}</span></div></div><div class="g2-sel-fullpath" title="${r}">${r}</div>${Yt(t.size)?A`<div class="g2-sel-size">${Yt(t.size)}</div>`:null}<div class="g2-sel-section"><div class="g2-sel-section-label">Own findings</div>${Rt(t.own)}</div><div class="g2-sel-section"><div class="g2-sel-section-label">Subtree findings</div>${Rt(t.subtree)}</div><div class="g2-sel-jumps">${t.totalIssues>0?A`<button type="button" class="g2-sel-jump" data-g2-jump-findings="${r}">Findings →</button>`:null} ${d.isBundleContext?t.origFile?A`<button type="button" class="g2-sel-jump" data-bundle-view-source="${t.origFile}">View source →</button>`:null:A`<button type="button" class="g2-sel-jump" data-g2-jump-file="${r}">Files →</button>`}</div>${ae(e,"Imported by",w,y)} ${ae(e,"Imports",R,y)}</div>`}function Qe(e,t){let r=e.nodes.filter(b=>b.pkg===t),d=r.length;if(d===0)return A`<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 p=st(t),m=t==="__own__"?"own source":t,g={};for(let b of ct)g[b]=0;for(let b of r)if(b.own)for(let _ of ct)g[_]+=b.own[_]??0;let w=0,R=0;for(let b of e.edges){let _=e.nodeByFile.get(b.a),i=e.nodeByFile.get(b.b);!_||!i||(_.pkg===t&&i.pkg===t?R++:(_.pkg===t||i.pkg===t)&&w++)}let o=0;for(let b of r)b.isHub&&o++;let y=new Set;for(let b of r)for(let _ of e.importedBy.get(b.file)??[]){let i=e.nodeByFile.get(_);i&&i.pkg!==t&&y.add(_)}return A`<div class="g2-selection-card"><div class="g2-sel-head"><span class="g2-sel-dot" style="${$t({"--dot":p,background:p})}"></span> <span class="g2-sel-id">${m}</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">${d}</span></div><div class="g2-sel-row"><span class="k">Hubs</span><span class="v">${o}</span></div><div class="g2-sel-row"><span class="k">Intra edges</span><span class="v">${R}</span></div><div class="g2-sel-row"><span class="k">Cross edges</span><span class="v">${w}</span></div></div><div class="g2-sel-section"><div class="g2-sel-section-label">Findings</div>${Rt(g)}</div>${ae(e,"Imported by",[...y])}</div>`}function to(e,t){let r=e.nodes.length||1,d=t??S.topPkgsTab,p=S.selectedSeverities,m=S.selectedColors,g=p.size>0,w=m.size>0,R=g||w,o=new Map,y=new Map,b=0,_=0;for(let l of e.nodes){let v;if(R){if(v=0,l.findings)for(let I of l.findings)g&&!p.has(I.severity)||w&&!m.has(I.color)||v++}else v=l.totalIssues;o.set(l.pkg,(o.get(l.pkg)??0)+v),b+=v,typeof l.size=="number"&&(y.set(l.pkg,(y.get(l.pkg)??0)+l.size),_+=l.size)}let i;d==="issues"?i=e.packages.filter(l=>(o.get(l)??0)>0).toSorted((l,v)=>{let I=o.get(l)??0,P=o.get(v)??0;return P!==I?P-I:(e.pkgCount.get(v)??0)-(e.pkgCount.get(l)??0)}):d==="size"?i=e.packages.filter(l=>(y.get(l)??0)>0).toSorted((l,v)=>{let I=y.get(l)??0,P=y.get(v)??0;return P!==I?P-I:(e.pkgCount.get(v)??0)-(e.pkgCount.get(l)??0)}):i=[...e.packages].toSorted((l,v)=>{let I=e.pkgCount.get(l)??0,P=e.pkgCount.get(v)??0;return P!==I?P-I:(o.get(v)??0)-(o.get(l)??0)});let B=l=>d==="issues"?b>0?((o.get(l)??0)/b*100).toFixed(2):"0":d==="size"?_>0?((y.get(l)??0)/_*100).toFixed(2):"0":(e.pkgCount.get(l)/r*100).toFixed(2),C=d==="issues"?"No packages with issues":d==="size"?"No packages with size":"No packages";return A`<div class="g2-dist-bar">${e.packages.map(l=>{let v=st(l);return A`<span style="${$t({background:v,width:`${B(l)}%`})}"></span>`})}</div><div class="g2-dist-list">${i.length===0?A`<div class="g2-dist-empty">${C}</div>`:null} ${xe(i,l=>l,l=>{let v=st(l),I=e.pkgCount.get(l)??0,P=o.get(l)??0,F=y.get(l)??0,f=d==="issues"?P:d==="size"?Yt(F):I,$=d==="issues"?b>0?(P/b*100).toFixed(1):"0.0":d==="size"?_>0?(F/_*100).toFixed(1):"0.0":(I/r*100).toFixed(1),W=l==="__own__"?"own source":l,h=S.solo===l;return A`<button type="button" class="${vt({"g2-dist-item":!0,on:h})}" data-g2-pkg="${l}" title="${W}"><span class="g2-dist-dot" style="${$t({background:v})}"></span><span class="g2-dist-name">${W}</span><span class="g2-dist-count">${f}</span><span class="g2-dist-pct">${$}%</span></button>`})}</div>`}var le=class extends me{static properties={graph:{attribute:!1},options:{attribute:!1}};static styles=[Vt(ke),Vt(ye),Vt(ve)];constructor(){super(),this.graph=null,this.options={}}render(){return this.graph?A`<div class="graph2-layout">${ze(this.graph,this.options)} ${Ce(this.graph)} ${_e()}</div>`:A``}};customElements.define("graph-layout",le);function eo(e){let t=new Map;for(let[r,d]of e.importsOf){let p=e.nodeByFile.get(r);if(p)for(let m of d){let g=e.nodeByFile.get(m);g&&p.pkg!==g.pkg&&(t.set(p.pkg,(t.get(p.pkg)??0)+1),t.set(g.pkg,(t.get(g.pkg)??0)+1))}}return t}function oo(e){if(e.packages.length===0)return null;let t=new Set;for(let[r,d]of e.importedBy){let p=e.nodeByFile.get(r);if(p)for(let m of d){let g=e.nodeByFile.get(m);if(g&&g.pkg!==p.pkg){t.add(p.pkg);break}}}for(let r of e.packages)if(!t.has(r))return r;return null}var ro=5;function Ie(e,t){let r=new Map;for(let m of e.nodes)t.has(m.pkg)&&(r.has(m.pkg)||r.set(m.pkg,[]),r.get(m.pkg).push(m));for(let m of r.values())m.sort((g,w)=>g.isHub!==w.isHub?g.isHub?-1:1:w.deg-g.deg);let d=new Map,p=new Map;for(let[m,g]of t){let w=r.get(m);if(!w||w.length===0)continue;let R=w.length,o=0;for(let v of w)if(v.isHub)o++;else break;let y=o>0&&o<=ro,b=y?o:0,_=R-b,i=g.groupR,B=Array.from({length:R}),C=Array.from({length:R});for(let v=0;v<R;v++){let I=v*137.508*Math.PI/180,P;if(v<b)P=b<=1?0:Math.sqrt(v/(b-1))*.3*i;else{let F=v-b;P=_<=1?.4*i:(.4+Math.sqrt(F/(_-1))*.6)*i}B[v]=g.x+Math.cos(I)*P,C[v]=g.y+Math.sin(I)*P}let l=Array.from({length:R},()=>!1);for(let v=0;v<R;v++){let I=w[v],P,F;y&&I.isHub?(F=0,P=b):y?(F=b,P=R):(F=0,P=R);let f=0,$=0,W=0,h=e.importsOf.get(I.file);if(h)for(let H of h){let D=d.get(H);D!==void 0&&(f+=D,$+=p.get(H),W++)}let V=e.importedBy.get(I.file);if(V)for(let H of V){let D=d.get(H);D!==void 0&&(f+=D,$+=p.get(H),W++)}let N=!1;if(W>0){f/=W,$/=W;let H=f-g.x,D=$-g.y;H*H+D*D>1&&(N=!0)}let j=-1;if(N){let H=1/0;for(let D=F;D<P;D++){if(l[D])continue;let c=B[D]-f,L=C[D]-$,q=c*c+L*L;q<H&&(H=q,j=D)}}else for(let H=F;H<P;H++)if(!l[H]){j=H;break}l[j]=!0,I.x=B[j],I.y=C[j],d.set(I.file,I.x),p.set(I.file,I.y)}}}function Re(e,t,r){let d=t/2,p=r/2,m=Math.min(t,r)/2;if(e.packages.length===0)return;let w=oo(e),R=eo(e),o=(w?e.packages.filter(c=>c!==w):[...e.packages]).toSorted((c,L)=>{let q=(R.get(L)??0)-(R.get(c)??0);return q!==0?q:(e.pkgCount.get(L)??0)-(e.pkgCount.get(c)??0)}),y=o.length,b;y<=0?b=0:y<=6?b=.65:y<=20?b=.82:b=.95;let _=Math.max(1,Math.sqrt(50/Math.max(1,y))),i=.22,B=.12,C=.04,l=new Map,v;if(w){let c=e.pkgCount.get(w)??0,L=Math.min(i,(.012+Math.sqrt(c)*.004)*_);v=Math.max(y<=6?.4:y<=20?.36:.34,L+B+C),l.set(w,{x:d,y:p,size:c,groupR:L*m})}else y<=1?v=0:y<=6?v=.4:y<=20?v=.32:v=.3;if(y===0){Ie(e,l);return}let I=new Map;for(let c of e.edges){if(!c.cross)continue;let L=e.nodeByFile.get(c.a)?.pkg,q=e.nodeByFile.get(c.b)?.pkg;if(!L||!q||L===q)continue;I.has(L)||I.set(L,new Map),I.has(q)||I.set(q,new Map);let tt=I.get(L),Z=I.get(q);tt.set(q,(tt.get(q)??0)+1),Z.set(L,(Z.get(L)??0)+1)}let P=Math.max(1,Math.min(10,Math.round(Math.sqrt(y)/1.2))),F=Array.from({length:P+1});for(let c=0;c<=P;c++)F[c]=Math.floor(c*c/(P*P)*y);F[P]=y;let f=.2,$=Array.from({length:P}),W=Array.from({length:P});for(let c=0;c<P;c++){let L=F[c],q=F[c+1];$[c]=q-L;let tt=0;for(let Z=L;Z<q;Z++)tt+=e.pkgCount.get(o[Z])??0;W[c]=tt}let h=Array.from({length:P});for(let c=0;c<P;c++){let L=(F[c]+F[c+1]-1)/2/Math.max(1,y-1);h[c]=Math.sqrt(Math.max(0,L))}let V=Array.from({length:P});V[0]=h[0];for(let c=1;c<P;c++){let L=$[c-1],q=W[c-1],tt=L>0?q/L:1,Z=1+f*Math.sqrt(Math.max(0,tt-1));V[c]=V[c-1]+(h[c]-h[c-1])*Z}let N=Array.from({length:P});for(let c=0;c<P;c++)N[c]=V[c]-h[c];let j=Array.from({length:y}),H=Array.from({length:y}),D=0;for(let c=0;c<y;c++){for(;D<P-1&&c>=F[D+1];)D++;let L=c*137.508%360*Math.PI/180,tt=(y<=1?0:Math.sqrt(c/(y-1)))+N[D],Z=y===1?w?v:0:v+tt*(b-v);j[c]=d+Math.cos(L)*Z*m,H[c]=p+Math.sin(L)*Z*m}for(let c=0;c<P;c++){let L=F[c],q=F[c+1],tt=q-L;if(tt===0)continue;let Z=Array.from({length:tt},()=>!1);for(let Ct=L;Ct<q;Ct++){let yt=o[Ct],Bt=I.get(yt),dt=0,at=0,it=0;if(Bt)for(let[et,ot]of Bt){let ft=l.get(et);ft&&(dt+=ft.x*ot,at+=ft.y*ot,it+=ot)}let kt=!1;if(it>0){dt/=it,at/=it;let et=dt-d,ot=at-p;et*et+ot*ot>1&&(kt=!0)}let ut=-1;if(kt){let et=1/0;for(let ot=0;ot<tt;ot++){if(Z[ot])continue;let ft=L+ot,Ht=j[ft]-dt,Tt=H[ft]-at,Ft=Ht*Ht+Tt*Tt;Ft<et&&(et=Ft,ut=ot)}}else for(let et=0;et<tt;et++)if(!Z[et]){ut=et;break}Z[ut]=!0;let Pt=L+ut,_t=e.pkgCount.get(yt)??0,At=Math.min(B,(.012+Math.sqrt(_t)*.004)*_);l.set(yt,{x:j[Pt],y:H[Pt],size:_t,groupR:At*m})}}Ie(e,l)}function Be(e,t,r){let d=t/2,p=r/2,m=Math.min(t,r)/2,g=e.nodes.length;if(g===0)return;let w=[...e.nodes].toSorted((R,o)=>o.deg-R.deg);for(let R=0;R<g;R++){let o=w[R],y=R*137.508%360*Math.PI/180,b=g<=1?0:Math.sqrt(R/(g-1));o.x=d+Math.cos(y)*b*.85*m,o.y=p+Math.sin(y)*b*.85*m}}function Ae(e,t,r,d){let p=e.length,m=d||760,g=r||1100,w=Math.sqrt(g*m/Math.max(p,1))*1.1,R=F=>{let f=0;for(let $ of F)f=f*31+$.codePointAt(0)|0;return f},o=Math.ceil(Math.sqrt(p*g/m)),y=Math.ceil(p/o),b=m/(y+1),_=g/(o+1),i=e.map((F,f)=>{let $=f%o,W=Math.floor(f/o),h=R(F);return{file:F,x:($+1)*_+(h%100-50)*_*.4,y:(W+1)*b+((h>>7)%100-50)*b*.4,dx:0,dy:0}}),B=new Map(i.map((F,f)=>[F.file,f])),C=[];for(let F of e)for(let f of t.get(F)??[])B.has(f)&&C.push([B.get(F),B.get(f)]);let l=new Map;for(let F=0;F<p;F++){let f=Kt(i[F].file)??"__own__";l.has(f)||l.set(f,[]),l.get(f).push(F)}let v=Math.min(500,Math.max(180,100+p*3)),I=Math.min(g,m)/6,P=.3;for(let F=0;F<v;F++){let f=I*Math.pow(P/I,F/v);for(let h of i)h.dx=0,h.dy=0;for(let h=0;h<p;h++)for(let V=h+1;V<p;V++){let N=i[h],j=i[V],H=N.x-j.x,D=N.y-j.y,c=Math.sqrt(H*H+D*D);if(c<.01){let q=R(N.file+j.file);H=(q%100-50)*.01||.5,D=((q>>7)%100-50)*.01||.5,c=Math.sqrt(H*H+D*D)}let L=w*w/c;N.dx+=H/c*L,N.dy+=D/c*L,j.dx-=H/c*L,j.dy-=D/c*L}for(let[h,V]of C){let N=i[h],j=i[V],H=N.x-j.x,D=N.y-j.y,c=Math.sqrt(H*H+D*D)||.01,L=c*c/w;N.dx-=H/c*L,N.dy-=D/c*L,j.dx+=H/c*L,j.dy+=D/c*L}let $=.055*Math.min(1,f/(I*.3));for(let[,h]of l){if(h.length<2)continue;let V=0,N=0;for(let j of h)V+=i[j].x,N+=i[j].y;V/=h.length,N/=h.length;for(let j of h)i[j].dx+=(V-i[j].x)*$,i[j].dy+=(N-i[j].y)*$}let W=50;for(let h of i){let V=Math.sqrt(h.dx*h.dx+h.dy*h.dy)||.01;h.x+=h.dx/V*Math.min(V,f),h.y+=h.dy/V*Math.min(V,f),h.x=Math.max(W,Math.min(g-W,h.x)),h.y=Math.max(W,Math.min(m-W,h.y))}}return i}var He={critical:"#ff5470",high:"#ff9d4a",medium:"#f4d35e",low:"#67c2ff",high_bug:"#a06c3f",bug:"#7a6d62",informational:"#218bff"},Te={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"}};function no(){return document.body.classList.contains("theme-light")?Te.light:Te.dark}function zt(e){return Math.max(0,Math.min(255,Math.round(e*255))).toString(16).padStart(2,"0")}function so(e,t,r){let p=e.querySelector("graph-layout")?.shadowRoot;if(!p)return;let m=p.querySelector("#g2-canvas"),g=p.querySelector("#g2-tooltip"),w=p.querySelector(".graph2-stage"),R=p.querySelector("#g2-zoom-pct");if(!m)return;we();let o=m.getContext("2d"),y=window.devicePixelRatio||1,b=0,_=0,i={tx:0,ty:0,k:1},B=null,C=0,l=0,v=!0,I=!0;function P(){if(!v)return;let s=S.layoutCache,u=S.focusedPkg;if(s&&s.files===t.files&&s.w===l&&s.h===C&&s.focused===u)for(let k of t.nodes){let n=s.pos.get(k.file);n&&(k.x=n.x,k.y=n.y)}else{if(u)if(t.nodes.length>50)Be(t,l,C);else{let n=Ae(t.files,t.importsOf,l,C),x=new Map(n.map(z=>[z.file,z]));for(let z of t.nodes){let O=x.get(z.file);O&&(z.x=O.x,z.y=O.y)}}else Re(t,l,C);let k=new Map;for(let n of t.nodes)k.set(n.file,{x:n.x,y:n.y});S.layoutCache={files:t.files,w:l,h:C,pos:k,focused:u}}v=!1}function F(){if(t.nodes.length===0)return{k:1,tx:_/2,ty:b/2};let s=-1/0,u=-1/0,k=1/0,n=1/0;for(let a of t.nodes)a.x<k&&(k=a.x),a.y<n&&(n=a.y),a.x>s&&(s=a.x),a.y>u&&(u=a.y);let x=Math.max(20,u-n),z=Math.max(20,s-k),O=(k+s)/2,G=(n+u)/2,U=Math.min(_,b)*.1,K=Math.min((_-U*2)/z,(b-U*2)/x,4),X=Math.max(.05,K);return{k:X,tx:_/2-O*X,ty:b/2-G*X}}function f(){let s=F();i.k=s.k,i.tx=s.tx,i.ty=s.ty}function $(s,u){return[s*i.k+i.tx,u*i.k+i.ty]}function W(s,u){return[(s-i.tx)/i.k,(u-i.ty)/i.k]}function h(s){return!S.hidden.has(s.pkg)}function V(s){if(S.selectedSeverities.size>0){let k=s.severitySet;if(!k)return!0;let n=!1;for(let x of S.selectedSeverities)if(k.has(x)){n=!0;break}if(!n)return!0}if(S.selectedColors.size>0){let k=s.colorSet;if(!k)return!0;let n=!1;for(let x of S.selectedColors)if(k.has(x)){n=!0;break}if(!n)return!0}if(S.solo&&s.pkg!==S.solo)return!0;let u=S.pathFilter;if(u){let k=u.toLowerCase(),n=s.file.toLowerCase().includes(k),x=s.pkg&&s.pkg.toLowerCase().includes(k);if(!n&&!x)return!0}return!1}function N(s){let u=(s.isHub?4.9:3.5)*S.nodeSize,k=Math.max(.6,Math.min(1.6,i.k));return u*k}function j(){let s=w.getBoundingClientRect(),u=b,k=_;_=Math.max(80,s.width),b=Math.max(80,s.height),y=window.devicePixelRatio||1,m.width=_*y,m.height=b*y,m.style.width=_+"px",m.style.height=b+"px",o.setTransform(y,0,0,y,0,0),(l===0||C===0)&&(l=_,C=b,v=!0),P();let n=k>0&&(Math.abs(_-k)/k>.15||Math.abs(b-u)/u>.15);(I||n)&&(f(),I=!1),q()}let H=null,D=!0,c=!1,L=!1;function q(){D=!0,!(c||L)&&(c=!0,H=requestAnimationFrame(()=>{c=!1,D&&!L&&(D=!1,tt())}))}function tt(){let s=no();o.fillStyle=s.bg,o.fillRect(0,0,_,b),Z(s);let u=S.selected,k=u?t.nodeByFile.get(u):null;if(S.focusedPkg&&t.nodes.length<=50){Ct(s,u,k);return}for(let n of t.edges){let x=t.nodeByFile.get(n.a),z=t.nodeByFile.get(n.b);if(!x||!z||!h(x)||!h(z))continue;let O=S.edgeOpacity;u?O=n.a===u||n.b===u?.85:S.edgeOpacity*.25:B&&(n.a===B||n.b===B)&&(O=Math.min(.9,O+.5)),V(x)&&V(z)&&(O=Math.min(O,.04));let[G,U]=$(x.x,x.y),[K,X]=$(z.x,z.y);if(n.cross){let a=o.createLinearGradient(G,U,K,X);a.addColorStop(0,st(x.pkg)+zt(O)),a.addColorStop(1,st(z.pkg)+zt(O)),o.strokeStyle=a,o.lineWidth=.85}else o.strokeStyle=s.edgeIntra.replace("ALPHA",String(O*.7)),o.lineWidth=.55;o.beginPath(),o.moveTo(G,U),o.lineTo(K,X),o.stroke()}for(let n of t.nodes){if(!h(n))continue;let x=n.file===B,z=n.file===u;if(!n.isHub&&!x&&!z||V(n)&&!x&&!z)continue;let[O,G]=$(n.x,n.y),K=N(n)*(z?6:x?4.5:3),X=o.createRadialGradient(O,G,0,O,G,K),a=st(n.pkg);X.addColorStop(0,a+"55"),X.addColorStop(1,a+"00"),o.fillStyle=X,o.beginPath(),o.arc(O,G,K,0,Math.PI*2),o.fill()}for(let n of t.nodes){if(!h(n))continue;let[x,z]=$(n.x,n.y),O=N(n),G=1,U=u&&n.file===u;if(u&&!U&&(G=(t.adj.get(u)??[]).some(X=>{let a=t.edges[X];return a.a===n.file||a.b===n.file})?1:.25),!U&&V(n)&&(G=Math.min(G,.1)),o.fillStyle=st(n.pkg)+zt(G),o.beginPath(),o.arc(x,z,O,0,Math.PI*2),o.fill(),n.isHub&&(o.strokeStyle=s.hubRing.replace("ALPHA",String(.55*G)),o.lineWidth=.8,o.stroke()),n.issue){let K=He[n.issue],X=O+(n.issue==="critical"?4.2:n.issue==="high"?3.4:2.8),a=n.issue==="critical"?1.8:n.issue==="high"?1.5:n.issue==="medium"?1.3:1.1;o.strokeStyle=K,o.globalAlpha=G,o.lineWidth=a,o.beginPath(),o.arc(x,z,X,0,Math.PI*2),o.stroke(),o.globalAlpha=1}}if(i.k>1.4){let x=0;if(i.k<9&&!S.showLabels)for(let O of t.nodes){if(!h(O))continue;let[G,U]=$(O.x,O.y);if(!(G<0||G>_||U<0||U>b)&&(x++,x>=50))break}let z=i.k>=9||x<50;if(S.showLabels||z){o.font="10px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",o.fillStyle=s.labelFill,o.textAlign="left",o.textBaseline="middle";let O=11,G=2,U=250,K=(M,E)=>M>-U&&M<_+U&&E>-U&&E<b+U,X=[];for(let M of t.nodes){if(!h(M))continue;let[E,J]=$(M.x,M.y);if(!K(E,J))continue;let Q=N(M);X.push({file:M.file,x0:E-Q,x1:E+Q,y0:J-Q,y1:J+Q})}let a=[];for(let M of t.nodes){if(!h(M)||!M.isHub&&i.k<2.4)continue;let[E,J]=$(M.x,M.y);if(!K(E,J))continue;let Q=N(M),rt=E+Q+4,nt=J+1,wt=o.measureText(M.label).width+G,Et=M.file===S.selected,Ot=M.file===B,qt=Et?3:Ot?2:M.isHub?1:0;a.push({file:M.file,n:M,tx:rt,ty:nt,prio:qt,x0:rt-G,x1:rt+wt,y0:nt-O/2,y1:nt+O/2})}a.sort((M,E)=>E.prio-M.prio);let T=[],Y=(M,E)=>M.x0<E.x1&&E.x0<M.x1&&M.y0<E.y1&&E.y0<M.y1;for(let M of a){let E=!1;for(let J of X)if(J.file!==M.file&&Y(M,J)){E=!0;break}if(!E){for(let J of T)if(Y(M,J)){E=!0;break}}E||T.push(M)}for(let M of T)o.fillText(M.n.label,M.tx,M.ty)}}if(k&&h(k)){let[n,x]=$(k.x,k.y),z=N(k);o.strokeStyle=s.selectRing,o.lineWidth=1.5,o.beginPath(),o.arc(n,x,z+5,0,Math.PI*2),o.stroke()}R&&(R.textContent=`${Math.round(i.k*100)}%`)}function Z(s){if(i.k<.4)return;let u=80,k=(i.tx%u+u)%u,n=(i.ty%u+u)%u;o.strokeStyle=s.grid,o.lineWidth=1,o.beginPath();for(let x=k;x<_;x+=u)o.moveTo(x,0),o.lineTo(x,b);for(let x=n;x<b;x+=u)o.moveTo(0,x),o.lineTo(_,x);o.stroke()}function Ct(s,u,k){let n=st(S.focusedPkg),x=new Set;if(B){x.add(B);for(let a of t.adj.get(B)??[]){let T=t.edges[a];x.add(T.a),x.add(T.b)}}let z=a=>(a.isHub?6:4)*S.nodeSize;for(let a of t.edges){let T=t.nodeByFile.get(a.a),Y=t.nodeByFile.get(a.b);if(!T||!Y||!h(T)||!h(Y))continue;let M=a.fromLo&&a.fromHi,E=!M&&a.fromHi,J=E?Y:T,Q=E?T:Y,rt=B&&(a.a===B||a.b===B),nt=u&&(a.a===u||a.b===u),wt=(u||B)&&!rt&&!nt,Et=z(J),Ot=z(Q),[qt,de]=$(J.x,J.y),[fe,pe]=$(Q.x,Q.y),Jt=fe-qt,Zt=pe-de,Qt=Math.sqrt(Jt*Jt+Zt*Zt)||1,te=Jt/Qt,ee=Zt/Qt,bt=qt+te*(Et+1.5),ht=de+ee*(Et+1.5),mt=fe-te*(Ot+3.5),xt=pe-ee*(Ot+3.5),ge=Math.min(Qt*.15,30),Lt=(bt+mt)/2-ee*ge,It=(ht+xt)/2+te*ge;o.beginPath(),o.moveTo(bt,ht),o.quadraticCurveTo(Lt,It,mt,xt);let Mt;if(nt?Mt=.9:rt?Mt=.85:wt?Mt=.05:Mt=Math.min(.85,S.edgeOpacity*3),o.strokeStyle=n+zt(Mt),o.lineWidth=nt||rt?1.5:.85,o.stroke(),wt)continue;let lt=Math.max(5,7),pt=lt*.42,Dt=.9,oe=2*(1-Dt)*(Lt-bt)+2*Dt*(mt-Lt),re=2*(1-Dt)*(It-ht)+2*Dt*(xt-It),ue=Math.sqrt(oe*oe+re*re)||1,jt=oe/ue,Nt=re/ue;if(o.beginPath(),o.moveTo(mt,xt),o.lineTo(mt-jt*lt+Nt*pt,xt-Nt*lt-jt*pt),o.lineTo(mt-jt*lt-Nt*pt,xt-Nt*lt+jt*pt),o.closePath(),o.fillStyle=n+zt(Math.min(1,Mt+.15)),o.fill(),M){let ne=1.8*(Lt-bt)+.2*(mt-Lt),se=2*(1-.1)*(It-ht)+2*.1*(xt-It),be=Math.sqrt(ne*ne+se*se)||1,Wt=ne/be,Gt=se/be;o.beginPath(),o.moveTo(bt,ht),o.lineTo(bt+Wt*lt-Gt*pt,ht+Gt*lt+Wt*pt),o.lineTo(bt+Wt*lt+Gt*pt,ht+Gt*lt-Wt*pt),o.closePath(),o.fill()}}for(let a of t.nodes){if(!h(a))continue;let[T,Y]=$(a.x,a.y),M=z(a),E=a.file===B,J=a.file===u,Q=(u||B)&&!x.has(a.file)&&!J?.15:1;if(o.globalAlpha=Q,J||E||a.isHub){let rt=M*(J?4:E?3:2.4),nt=o.createRadialGradient(T,Y,M*.6,T,Y,rt);nt.addColorStop(0,n+zt(J?.4:.25)),nt.addColorStop(1,n+"00"),o.fillStyle=nt,o.beginPath(),o.arc(T,Y,rt,0,Math.PI*2),o.fill()}if(o.fillStyle=n,o.beginPath(),o.arc(T,Y,M,0,Math.PI*2),o.fill(),a.isHub&&(o.strokeStyle=s.hubRing.replace("ALPHA","0.55"),o.lineWidth=.9,o.stroke()),a.issue){let rt=He[a.issue],nt=M+(a.issue==="critical"?4.2:a.issue==="high"?3.4:2.8),wt=a.issue==="critical"?1.8:a.issue==="high"?1.5:a.issue==="medium"?1.3:1.1;o.strokeStyle=rt,o.lineWidth=wt,o.beginPath(),o.arc(T,Y,nt,0,Math.PI*2),o.stroke()}o.globalAlpha=1}o.font="600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, monospace",o.textAlign="center",o.textBaseline="top",o.lineJoin="round";let O=13,G=2,U=[];for(let a of t.nodes){if(!h(a))continue;let[T,Y]=$(a.x,a.y),M=z(a),E=Y+M+4,J=o.measureText(a.label).width/2+G,Q=a.file===u,rt=a.file===B,nt=Q?3:rt?2:a.isHub?1:0;U.push({n:a,sx:T,ty:E,halfW:J,isSel:Q,isHov:rt,prio:nt,x0:T-J,x1:T+J,y0:E,y1:E+O})}U.sort((a,T)=>T.prio-a.prio);let K=[],X=(a,T)=>a.x0<T.x1&&T.x0<a.x1&&a.y0<T.y1&&T.y0<a.y1;for(let a of U){let T=!1;for(let Y of K)if(X(a,Y)){T=!0;break}T||K.push(a)}for(let a of K){let{n:T,sx:Y,ty:M,isSel:E,isHov:J}=a,Q=(u||B)&&!x.has(T.file)&&!E?.2:1;o.globalAlpha=Q,o.shadowColor=s.labelShadow,o.shadowBlur=4,o.strokeStyle=s.labelOutline,o.lineWidth=3,o.strokeText(T.label,Y,M),o.shadowBlur=0,o.fillStyle=E?s.labelSelected:J?s.labelHover:s.labelDefault,o.fillText(T.label,Y,M),o.globalAlpha=1}if(k&&h(k)){let[a,T]=$(k.x,k.y),Y=z(k);o.strokeStyle=s.selectRing,o.lineWidth=1.8,o.beginPath(),o.arc(a,T,Y+4,0,Math.PI*2),o.stroke()}R&&(R.textContent=`${Math.round(i.k*100)}%`)}function yt(s,u){let k=null,n=1/0,x=6;for(let z of t.nodes){if(!h(z))continue;let[O,G]=$(z.x,z.y),U=O-s,K=G-u,X=U*U+K*K,a=N(z)+x;X<a*a&&X<n&&(n=X,k=z)}return k}function Bt(s,u,k){if(!g)return;let n=w.getBoundingClientRect(),x=st(s.pkg),z=s.pkg==="__own__"?"own source":s.pkg,O=Xt(s.file,s.pkg);St(A`<div class="g2-tt-path">${O}</div><div class="g2-tt-head"><span class="g2-tt-dot" style="${`background:${x}`}"></span> <span class="g2-tt-pkg">${z}</span></div>${s.totalIssues>0?Rt(s.own):null}`,g),g.classList.add("show");let G=g.offsetWidth,U=g.offsetHeight,K=u-n.left,X=k-n.top,a=n.width,T=n.height,Y=12,M=K+Y;M+G>a-4&&(M=K-G-Y),M<4&&(M=4);let E=X+Y;E+U>T-4&&(E=X-U-Y),E<4&&(E=4),g.style.left=`${M}px`,g.style.top=`${E}px`}function dt(){g&&g.classList.remove("show")}let at=!1,it=null,kt=!1,ut=s=>{s.button===0&&(s.target.closest(".g2-stage-overlay, .g2-stage-overlay-tr, .g2-zoom-ctrl")||(at=!0,kt=!1,it={x:s.clientX,y:s.clientY,tx:i.tx,ty:i.ty}))},Pt=s=>{let u=w.getBoundingClientRect(),k=s.clientX-u.left,n=s.clientY-u.top;if(at){let O=s.clientX-it.x,G=s.clientY-it.y;Math.abs(O)+Math.abs(G)>3&&(kt=!0),i.tx=it.tx+O,i.ty=it.ty+G,dt(),q();return}let x=yt(k,n),z=B;B=x?.file??null,m.style.cursor=x?"default":"grab",x?Bt(x,s.clientX,s.clientY):z&&dt(),B!==z&&q()},_t=s=>{if(at&&!kt){let u=w.getBoundingClientRect(),k=s.clientX-u.left,n=s.clientY-u.top,x=yt(k,n);S.selected=x?.file??null,r(),q()}at=!1},At=()=>{let s=B!==null;B=null,dt(),s&&q()},et=s=>{s.preventDefault();let u=w.getBoundingClientRect(),k=s.clientX-u.left,n=s.clientY-u.top,x=Math.exp(-s.deltaY*.0015),z=F();if(x<1&&i.k<=z.k*1.0001){i.k=z.k;let K=Math.min(.4,(1-x)*3);i.tx+=(z.tx-i.tx)*K,i.ty+=(z.ty-i.ty)*K,q();return}let[O,G]=W(k,n),U=Math.max(z.k,Math.min(9.99,i.k*x));i.k=U,i.tx=k-O*i.k,i.ty=n-G*i.k,q()};w.addEventListener("mousedown",ut),window.addEventListener("mousemove",Pt),window.addEventListener("mouseup",_t),w.addEventListener("mouseleave",At),w.addEventListener("wheel",et,{passive:!1});function ot(s){let u=F().k;s=Math.max(u,Math.min(9.99,s));let k=_/2,n=b/2,[x,z]=W(k,n);i.k=s,i.tx=k-x*i.k,i.ty=n-z*i.k,q()}let ft=p.querySelector("#g2-zoom-in"),Ht=p.querySelector("#g2-zoom-out"),Tt=p.querySelector("#g2-zoom-fit");ft?.addEventListener("click",()=>ot(i.k*1.4)),Ht?.addEventListener("click",()=>ot(i.k/1.4)),Tt?.addEventListener("click",()=>{f(),q()}),j();let Ft=new ResizeObserver(()=>j());Ft.observe(w);let ce=new MutationObserver(s=>{for(let u of s){let k=(u.oldValue||"").includes("report-fullscreen"),n=document.body.classList.contains("report-fullscreen");if(k!==n){l=0,C=0,v=!0,I=!0,S.layoutCache=null,setTimeout(()=>j(),80);return}q()}});ce.observe(document.body,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0}),q(),S.graphState={requestDraw:q,_cleanup:()=>{L=!0,cancelAnimationFrame(H),Ft.disconnect(),ce.disconnect(),w.removeEventListener("mousedown",ut),window.removeEventListener("mousemove",Pt),window.removeEventListener("mouseup",_t),w.removeEventListener("mouseleave",At),w.removeEventListener("wheel",et)}}}function Xo(e,t){let r=document.querySelector("graph-layout")?.shadowRoot;if(!r)return;let d=Ee(e),p=r.querySelector("#g2-selection-area");p&&St(Le(d,t),p);let m=r.querySelector("#g2-focus-overlay-slot");m&&St(Pe(d),m)}function Jo(e){let t=document.querySelector("graph-layout")?.shadowRoot;if(!t)return;let r=t.querySelector("#g2-top-pkgs-block");r&&St(Fe(Ee(e)),r)}function Ee(e){let t=$e(e.treeData,e.files,e.ownCounts,e.transitiveCounts,e.severitySets,e.colorSets,e.fileFindings,e.options);if(e.strippedToOrig)for(let r of t.nodes)r.origFile=e.strippedToOrig.get(r.file);return t}export{Ge as _swapGraph2Impl,so as attachGraph2Interaction,Ee as buildGraphFromPrep,Xo as refreshSidebar,Jo as refreshTopPkgs};
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" role="img" aria-label="DeepView">
2
+ <title>DeepView</title>
3
+ <rect width="16" height="16" fill="#1e3a8a"/>
4
+ <path transform="matrix(1.4 0 0 1.4 -2.987 -4.240)" fill="#fff" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/>
5
+ </svg>
package/out/icon.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" role="img" aria-label="DeepView">
2
+ <title>DeepView</title>
3
+ <rect width="16" height="16" rx="3" fill="#1e3a8a"/>
4
+ <path transform="matrix(1.5 0 0 1.5 -3.772 -5.114)" fill="#fff" d="M7.843 6.719c-1.605 0-2.926 1.292-3.477 1.947.466.58 1.872 2.024 3.496 2.024s2.907-1.292 3.486-2.005c-.627-.703-1.88-1.966-3.505-1.966m.019 3.857c-1.51 0-2.802-1.263-3.353-1.9.55-.617 1.814-1.852 3.334-1.852 1.51 0 2.698 1.12 3.335 1.852-.533.618-1.787 1.9-3.316 1.9m-.019-3.42c-.826 0-1.577.694-1.577 1.596 0 .789.599 1.577 1.577 1.577.893 0 1.587-.684 1.587-1.577-.01-.779-.627-1.596-1.587-1.596m0 3.069a1.476 1.476 0 0 1-1.482-1.473c0-.722.599-1.491 1.482-1.491.846 0 1.482.693 1.492 1.491 0 .808-.618 1.473-1.492 1.473m.01-2.727c-.637 0-1.264.532-1.264 1.244 0 .627.475 1.235 1.245 1.245.684 0 1.254-.522 1.254-1.244 0-.58-.475-1.236-1.235-1.245m-.02 2.403a1.167 1.167 0 0 1-1.149-1.159c0-.532.456-1.14 1.169-1.149.56 0 1.149.427 1.159 1.15 0 .636-.485 1.158-1.179 1.158m-.769-1.833c-.19.238-.275.494-.237.864l.74.057zm1.026-.294c-.295-.057-.665 0-.912.228l.323.607zm.133.047-.38.56.988.114c-.057-.275-.323-.579-.608-.674m-.124.741.456.912c.21-.209.352-.484.314-.836zm-1.225.504a.97.97 0 0 0 .57.617l.399-.551zm.713.664c.313.076.636.01.845-.161l-.295-.618zm-.637 1.55c0 .028-.028.066-.066.066h-.59c-.028 0-.066-.028-.066-.066s.029-.066.067-.066h.579c.048 0 .076.028.076.066m.712 0c0 .028-.028.066-.066.066h-.437c-.028 0-.066-.028-.066-.066s.028-.066.066-.066h.437c.038 0 .066.028.066.066m.666 0c0 .028-.029.066-.067.066h-.37c-.029 0-.067-.028-.067-.066s.029-.066.067-.066h.37c.038 0 .067.028.067.066m-1.672.351c0 .029-.029.067-.067.067h-.295c-.028 0-.066-.028-.066-.066 0-.029.029-.067.067-.067h.294c.038 0 .066.028.066.066m.694 0c0 .029-.028.067-.066.067h-.409c-.028 0-.066-.028-.066-.066 0-.029.028-.067.066-.067h.399c.038 0 .076.028.076.066m.732 0c0 .029-.029.067-.067.067h-.465c-.029 0-.067-.028-.067-.066 0-.029.029-.067.067-.067h.465c.038 0 .067.028.067.066m-1.093.371a.065.065 0 0 1-.067.066h-.627c-.028 0-.075-.028-.066-.066 0-.028.029-.066.067-.066h.627c.038 0 .066.028.066.066m.684 0a.065.065 0 0 1-.066.066h-.39c-.028 0-.076-.028-.066-.066 0-.028.028-.066.066-.066h.39c.038 0 .066.028.066.066M5.088 6.263c-.019-.105-.114-.19-.237-.19s-.257.104-.257.237.105.238.247.238c.105 0 .218-.076.238-.18h.864v.826l.095-.048V6.31c0-.028-.019-.057-.048-.057h-.902zm-.237.19c-.076 0-.143-.066-.143-.143s.066-.142.143-.142.142.066.142.143c.01.076-.066.142-.143.142m2.89-.323H6.38l.418-.475v-.332a.255.255 0 0 0 .218-.248c0-.123-.114-.256-.256-.256s-.266.114-.266.257c0 .123.095.228.209.247v.284l-.456.523v.893l.095-.047v-.742h1.396c.029 0 .067-.009.067-.057 0-.028-.019-.047-.067-.047m-1.13-1.054c0-.076.066-.152.152-.152s.152.066.152.151c0 .076-.066.152-.152.152s-.152-.066-.152-.152m-.836 5.264h-.874c-.019-.105-.114-.219-.247-.219s-.256.105-.256.257c0 .132.114.275.266.275.104 0 .218-.076.237-.19h.827v.608l-.257.285a.3.3 0 0 0-.095-.019c-.133 0-.256.105-.256.228 0 .133.104.238.237.238.124 0 .247-.105.247-.238a.23.23 0 0 0-.057-.152l.285-.304v-.712c0-.029-.019-.058-.057-.058m-1.121.219a.16.16 0 0 1-.152-.161c0-.077.066-.162.152-.162s.152.066.152.152-.066.171-.152.171m.713 1.14c-.076 0-.143-.066-.143-.143s.066-.133.143-.133.142.067.142.143c0 .066-.066.133-.143.133m5.472-1.377a.24.24 0 0 0-.237.208h-1.13c-.029 0-.038.02-.038.048v.712l-.323.39h-.029a.245.245 0 0 0-.247.247c0 .133.114.256.247.256s.247-.113.247-.256a.26.26 0 0 0-.123-.219l.313-.38v-.674h1.083c.019.105.114.2.238.2.133 0 .266-.105.266-.257 0-.133-.105-.276-.266-.276m-1.758 1.767a.15.15 0 0 1-.143-.152c0-.075.067-.142.143-.142s.152.066.152.143a.15.15 0 0 1-.152.151m1.758-1.33a.15.15 0 0 1-.143-.152.147.147 0 0 1 .294.001.15.15 0 0 1-.152.151M8.917 5.55h-.399a.075.075 0 0 1-.076-.076c0-.028.029-.066.067-.066h.418c.028 0 .066.028.066.066s-.038.076-.076.076m.742 0H9.22c-.038 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.437c.038 0 .066.028.066.066s-.028.076-.066.076m.883 0h-.598c-.029 0-.067-.028-.067-.076 0-.028.029-.066.067-.066h.598c.028 0 .066.028.066.066s-.028.076-.066.076m-1.282.4h-.741c-.038 0-.076-.029-.076-.067s.028-.076.066-.076h.75c.039 0 .067.038.067.076 0 .029-.028.067-.066.067m.797 0h-.503c-.038 0-.076-.029-.076-.067s.028-.066.066-.066h.513c.038 0 .067.028.067.066 0 .029-.029.067-.067.067m.476 0h-.19c-.039 0-.067-.029-.067-.067s.028-.066.066-.066h.2c.028 0 .066.028.066.066 0 .029-.028.067-.075.067m-1.682.398h-.332c-.039 0-.077-.028-.077-.066s.029-.066.067-.066h.342c.038 0 .076.028.076.066s-.028.066-.076.066m.789 0h-.494c-.038 0-.067-.028-.067-.066s.029-.066.067-.066h.494c.038 0 .066.028.066.066s-.028.066-.066.066m.893 0h-.599c-.038 0-.076-.028-.076-.066s.028-.066.066-.066h.618c.028 0 .066.028.066.066s-.028.066-.076.066m.418.305a.69.69 0 0 0-.674.712c0 .086.019.18.048.257l.085.066c-.028-.085-.057-.171-.057-.304 0-.285.228-.646.598-.646.295 0 .599.228.599.636a.58.58 0 0 1-.599.59.8.8 0 0 1-.237-.048l.123.114a.4.4 0 0 0 .114.01c.39 0 .684-.276.684-.666 0-.313-.266-.712-.684-.722m.353.552-.019-.01-.161.19-.143-.01-.057-.047-.019-.133.19-.2a.28.28 0 0 0-.361.077c-.076.095-.076.209-.038.351l-.247.304.171.152.266-.266c.142.038.285.019.38-.095a.31.31 0 0 0 .038-.313"/>
5
+ </svg>
package/out/index.html ADDED
@@ -0,0 +1,78 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self'; manifest-src 'self'; form-action 'none'; connect-src 'self'">
7
+ <title>deepview results</title>
8
+ <link rel="icon" href="./icon.svg" type="image/svg+xml" />
9
+ <link rel="apple-touch-icon" href="./icon.svg" />
10
+ <link rel="manifest" href="./manifest.webmanifest" />
11
+ <meta name="theme-color" content="#1a1a1b" />
12
+ <meta name="mobile-web-app-capable" content="yes" />
13
+ <meta name="apple-mobile-web-app-capable" content="yes" />
14
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
15
+ <meta name="apple-mobile-web-app-title" content="DeepView" />
16
+ <link rel="preload" href="./view.css" as="style" />
17
+ <link rel="modulepreload" href="./view.js" />
18
+ <link href="./view.css" rel="stylesheet" />
19
+ <script src="./view.js" type="module" defer></script>
20
+ </head>
21
+ <body>
22
+
23
+ <theme-toggle></theme-toggle>
24
+ <button id="print-btn" type="button" title="print this report" aria-label="print">
25
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
26
+ <path d="M6 9V2h12v7"/>
27
+ <path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/>
28
+ <rect x="6" y="14" width="12" height="8"/>
29
+ </svg>
30
+ </button>
31
+ <button id="download-btn" type="button" title="download this report" aria-label="download">
32
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
33
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
34
+ <polyline points="7 10 12 15 17 10"/>
35
+ <line x1="12" x2="12" y1="15" y2="3"/>
36
+ </svg>
37
+ </button>
38
+
39
+ <!-- WCO duplicate of the sidebar-header. Hidden by default; shown
40
+ via CSS only when `@media (display-mode: window-controls-overlay)`
41
+ matches. Lives outside #sidebar so it escapes #sidebar's stacking
42
+ context (which is trapped under the page-level fixed backdrops
43
+ by the sidebar's own backdrop-filter). Only the brand is
44
+ duplicated — the interactive buttons (sidebar-toggle,
45
+ encryption-toggle) stay single-instance in the in-sidebar
46
+ header. The drag-handle / OS-controls-landing strip is what
47
+ this duplicate exists to provide; the actual lock + hamburger
48
+ buttons are still functional through the regular sidebar
49
+ header (visible underneath since both occupy the same column
50
+ position). -->
51
+ <div class="sidebar-header sidebar-header-wco" aria-hidden="true">
52
+ <h2 class="brand">
53
+ <span class="brand-name">DeepView</span>
54
+ <span class="brand-tag">dev</span>
55
+ </h2>
56
+ </div>
57
+
58
+ <app-sidebar role="complementary" aria-label="Reports and workspaces"></app-sidebar>
59
+
60
+ <main id="main-content">
61
+ <div id="drop-zone" role="button" tabindex="0" aria-label="Drop reports here or click to browse for files">
62
+ <div class="drop-prompt">
63
+ <h1>deepview results viewer</h1>
64
+ <p>Drop a JSON results file here, <span class="drop-prompt-action">click to browse</span>, or pick one from the sidebar</p>
65
+ </div>
66
+ </div>
67
+ <div id="report"></div>
68
+ </main>
69
+
70
+ <!-- Bundle source viewer overlay — rendered globally (sibling of
71
+ #main-content) so the [Code →] shortcut on a finding can pop
72
+ the same modal regardless of which view the user is on,
73
+ without having to switch them to the bundles view first.
74
+ Kept empty until render() puts the modal HTML in. -->
75
+ <div id="bundle-source-overlay-slot"></div>
76
+
77
+ </body>
78
+ </html>
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "/",
3
+ "name": "DeepView",
4
+ "short_name": "DeepView",
5
+ "description": "Local-first viewer for deepview analyzer results — drop a JSON report and explore findings without uploading anywhere.",
6
+ "start_url": "/",
7
+ "scope": "/",
8
+ "display": "standalone",
9
+ "display_override": ["window-controls-overlay", "standalone", "browser"],
10
+ "launch_handler": { "client_mode": "focus-existing" },
11
+ "orientation": "any",
12
+ "background_color": "#1a1a1b",
13
+ "theme_color": "#1a1a1b",
14
+ "lang": "en",
15
+ "dir": "ltr",
16
+ "icons": [
17
+ {
18
+ "src": "./icon.svg",
19
+ "sizes": "any",
20
+ "type": "image/svg+xml",
21
+ "purpose": "any"
22
+ },
23
+ {
24
+ "src": "./icon-maskable.svg",
25
+ "sizes": "any",
26
+ "type": "image/svg+xml",
27
+ "purpose": "maskable"
28
+ }
29
+ ]
30
+ }
package/out/prism.js ADDED
@@ -0,0 +1,14 @@
1
+ var J=Object.create;var q=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var ne=(e,u)=>()=>(u||e((u={exports:{}}).exports,u),u.exports);var re=(e,u,g,m)=>{if(u&&typeof u=="object"||typeof u=="function")for(let r of ee(u))!ae.call(e,r)&&r!==g&&q(e,r,{get:()=>u[r],enumerable:!(m=Q(u,r))||m.enumerable});return e};var se=(e,u,g)=>(g=e!=null?J(te(e)):{},re(u||!e||!e.__esModule?q(g,"default",{value:e,enumerable:!0}):g,e));var X=ne((oe,j)=>{var ie=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var o=(function(e){var u=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,g=0,m={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function t(a){return a instanceof v?new v(a.type,t(a.content),a.alias):Array.isArray(a)?a.map(t):a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(t){return Object.prototype.toString.call(t).slice(8,-1)},objId:function(t){return t.__id||Object.defineProperty(t,"__id",{value:++g}),t.__id},clone:function t(a,n){n=n||{};var s,i;switch(r.util.type(a)){case"Object":if(i=r.util.objId(a),n[i])return n[i];s={},n[i]=s;for(var c in a)a.hasOwnProperty(c)&&(s[c]=t(a[c],n));return s;case"Array":return i=r.util.objId(a),n[i]?n[i]:(s=[],n[i]=s,a.forEach(function(b,l){s[l]=t(b,n)}),s);default:return a}},getLanguage:function(t){for(;t;){var a=u.exec(t.className);if(a)return a[1].toLowerCase();t=t.parentElement}return"none"},setLanguage:function(t,a){t.className=t.className.replace(RegExp(u,"gi"),""),t.classList.add("language-"+a)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(s){var t=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(s.stack)||[])[1];if(t){var a=document.getElementsByTagName("script");for(var n in a)if(a[n].src==t)return a[n]}return null}},isActive:function(t,a,n){for(var s="no-"+a;t;){var i=t.classList;if(i.contains(a))return!0;if(i.contains(s))return!1;t=t.parentElement}return!!n}},languages:{plain:m,plaintext:m,text:m,txt:m,extend:function(t,a){var n=r.util.clone(r.languages[t]);for(var s in a)n[s]=a[s];return n},insertBefore:function(t,a,n,s){s=s||r.languages;var i=s[t],c={};for(var b in i)if(i.hasOwnProperty(b)){if(b==a)for(var l in n)n.hasOwnProperty(l)&&(c[l]=n[l]);n.hasOwnProperty(b)||(c[b]=i[b])}var S=s[t];return s[t]=c,r.languages.DFS(r.languages,function(w,T){T===S&&w!=t&&(this[w]=c)}),c},DFS:function t(a,n,s,i){i=i||{};var c=r.util.objId;for(var b in a)if(a.hasOwnProperty(b)){n.call(a,b,a[b],s||b);var l=a[b],S=r.util.type(l);S==="Object"&&!i[c(l)]?(i[c(l)]=!0,t(l,n,null,i)):S==="Array"&&!i[c(l)]&&(i[c(l)]=!0,t(l,n,b,i))}}},plugins:{},highlightAll:function(t,a){r.highlightAllUnder(document,t,a)},highlightAllUnder:function(t,a,n){var s={callback:n,container:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",s),s.elements=Array.prototype.slice.apply(s.container.querySelectorAll(s.selector)),r.hooks.run("before-all-elements-highlight",s);for(var i=0,c;c=s.elements[i++];)r.highlightElement(c,a===!0,s.callback)},highlightElement:function(t,a,n){var s=r.util.getLanguage(t),i=r.languages[s];r.util.setLanguage(t,s);var c=t.parentElement;c&&c.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(c,s);var b=t.textContent,l={element:t,language:s,grammar:i,code:b};function S(T){l.highlightedCode=T,r.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,r.hooks.run("after-highlight",l),r.hooks.run("complete",l),n&&n.call(l.element)}if(r.hooks.run("before-sanity-check",l),c=l.element.parentElement,c&&c.nodeName.toLowerCase()==="pre"&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","0"),!l.code){r.hooks.run("complete",l),n&&n.call(l.element);return}if(r.hooks.run("before-highlight",l),!l.grammar){S(r.util.encode(l.code));return}if(a&&e.Worker){var w=new Worker(r.filename);w.onmessage=function(T){S(T.data)},w.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else S(r.highlight(l.code,l.grammar,l.language))},highlight:function(t,a,n){var s={code:t,grammar:a,language:n};if(r.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=r.tokenize(s.code,s.grammar),r.hooks.run("after-tokenize",s),v.stringify(r.util.encode(s.tokens),s.language)},tokenize:function(t,a){var n=a.rest;if(n){for(var s in n)a[s]=n[s];delete a.rest}var i=new f;return F(i,i.head,t),E(t,i,a,i.head,0),d(i)},hooks:{all:{},add:function(t,a){var n=r.hooks.all;n[t]=n[t]||[],n[t].push(a)},run:function(t,a){var n=r.hooks.all[t];if(!(!n||!n.length))for(var s=0,i;i=n[s++];)i(a)}},Token:v};e.Prism=r;function v(t,a,n,s){this.type=t,this.content=a,this.alias=n,this.length=(s||"").length|0}v.stringify=function t(a,n){if(typeof a=="string")return a;if(Array.isArray(a)){var s="";return a.forEach(function(S){s+=t(S,n)}),s}var i={type:a.type,content:t(a.content,n),tag:"span",classes:["token",a.type],attributes:{},language:n},c=a.alias;c&&(Array.isArray(c)?Array.prototype.push.apply(i.classes,c):i.classes.push(c)),r.hooks.run("wrap",i);var b="";for(var l in i.attributes)b+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+b+">"+i.content+"</"+i.tag+">"};function x(t,a,n,s){t.lastIndex=a;var i=t.exec(n);if(i&&s&&i[1]){var c=i[1].length;i.index+=c,i[0]=i[0].slice(c)}return i}function E(t,a,n,s,i,c){for(var b in n)if(!(!n.hasOwnProperty(b)||!n[b])){var l=n[b];l=Array.isArray(l)?l:[l];for(var S=0;S<l.length;++S){if(c&&c.cause==b+","+S)return;var w=l[S],T=w.inside,B=!!w.lookbehind,G=!!w.greedy,Y=w.alias;if(G&&!w.pattern.global){var W=w.pattern.toString().match(/[imsuy]*$/)[0];w.pattern=RegExp(w.pattern.source,W+"g")}for(var U=w.pattern||w,k=s.next,_=i;k!==a.tail&&!(c&&_>=c.reach);_+=k.value.length,k=k.next){var R=k.value;if(a.length>t.length)return;if(!(R instanceof v)){var P=1,$;if(G){if($=x(U,_,t,B),!$||$.index>=t.length)break;var D=$.index,K=$.index+$[0].length,I=_;for(I+=k.value.length;D>=I;)k=k.next,I+=k.value.length;if(I-=k.value.length,_=I,k.value instanceof v)continue;for(var O=k;O!==a.tail&&(I<K||typeof O.value=="string");O=O.next)P++,I+=O.value.length;P--,R=t.slice(_,I),$.index-=_}else if($=x(U,0,R,B),!$)continue;var D=$.index,L=$[0],M=R.slice(0,D),Z=R.slice(D+L.length),z=_+R.length;c&&z>c.reach&&(c.reach=z);var N=k.prev;M&&(N=F(a,N,M),_+=M.length),h(a,N,P);var V=new v(b,T?r.tokenize(L,T):L,Y,L);if(k=F(a,N,V),Z&&F(a,k,Z),P>1){var H={cause:b+","+S,reach:z};E(t,a,n,k.prev,_,H),c&&H.reach>c.reach&&(c.reach=H.reach)}}}}}}function f(){var t={value:null,prev:null,next:null},a={value:null,prev:t,next:null};t.next=a,this.head=t,this.tail=a,this.length=0}function F(t,a,n){var s=a.next,i={value:n,prev:a,next:s};return a.next=i,s.prev=i,t.length++,i}function h(t,a,n){for(var s=a.next,i=0;i<n&&s!==t.tail;i++)s=s.next;a.next=s,s.prev=a,t.length-=i}function d(t){for(var a=[],n=t.head.next;n!==t.tail;)a.push(n.value),n=n.next;return a}if(!e.document)return e.addEventListener&&(r.disableWorkerMessageHandler||e.addEventListener("message",function(t){var a=JSON.parse(t.data),n=a.language,s=a.code,i=a.immediateClose;e.postMessage(r.highlight(s,r.languages[n],n)),i&&e.close()},!1)),r;var y=r.util.currentScript();y&&(r.filename=y.src,y.hasAttribute("data-manual")&&(r.manual=!0));function p(){r.manual||r.highlightAll()}if(!r.manual){var A=document.readyState;A==="loading"||A==="interactive"&&y&&y.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return r})(ie);typeof j<"u"&&j.exports&&(j.exports=o);typeof global<"u"&&(global.Prism=o);o.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};o.languages.markup.tag.inside["attr-value"].inside.entity=o.languages.markup.entity;o.languages.markup.doctype.inside["internal-subset"].inside=o.languages.markup;o.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&amp;/,"&"))});Object.defineProperty(o.languages.markup.tag,"addInlined",{value:function(u,g){var m={};m["language-"+g]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:o.languages[g]},m.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:m}};r["language-"+g]={pattern:/[\s\S]+/,inside:o.languages[g]};var v={};v[u]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return u}),"i"),lookbehind:!0,greedy:!0,inside:r},o.languages.insertBefore("markup","cdata",v)}});Object.defineProperty(o.languages.markup.tag,"addAttribute",{value:function(e,u){o.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[u,"language-"+u],inside:o.languages[u]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});o.languages.html=o.languages.markup;o.languages.mathml=o.languages.markup;o.languages.svg=o.languages.markup;o.languages.xml=o.languages.extend("markup",{});o.languages.ssml=o.languages.xml;o.languages.atom=o.languages.xml;o.languages.rss=o.languages.xml;(function(e){var u=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+u.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+u.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+u.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+u.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:u,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var g=e.languages.markup;g&&(g.tag.addInlined("style","css"),g.tag.addAttribute("style","css"))})(o);o.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};o.languages.javascript=o.languages.extend("clike",{"class-name":[o.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});o.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;o.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:o.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:o.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:o.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:o.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:o.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});o.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:o.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});o.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});o.languages.markup&&(o.languages.markup.tag.addInlined("script","javascript"),o.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));o.languages.js=o.languages.javascript;(function(){if(typeof o>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e="Loading\u2026",u=function(y,p){return"\u2716 Error "+y+" while fetching file: "+p},g="\u2716 Error: File does not exist or is empty",m={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",v="loading",x="loaded",E="failed",f="pre[data-src]:not(["+r+'="'+x+'"]):not(['+r+'="'+v+'"])';function F(y,p,A){var t=new XMLHttpRequest;t.open("GET",y,!0),t.onreadystatechange=function(){t.readyState==4&&(t.status<400&&t.responseText?p(t.responseText):t.status>=400?A(u(t.status,t.statusText)):A(g))},t.send(null)}function h(y){var p=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(y||"");if(p){var A=Number(p[1]),t=p[2],a=p[3];return t?a?[A,Number(a)]:[A,void 0]:[A,A]}}o.hooks.add("before-highlightall",function(y){y.selector+=", "+f}),o.hooks.add("before-sanity-check",function(y){var p=y.element;if(p.matches(f)){y.code="",p.setAttribute(r,v);var A=p.appendChild(document.createElement("CODE"));A.textContent=e;var t=p.getAttribute("data-src"),a=y.language;if(a==="none"){var n=(/\.(\w+)$/.exec(t)||[,"none"])[1];a=m[n]||n}o.util.setLanguage(A,a),o.util.setLanguage(p,a);var s=o.plugins.autoloader;s&&s.loadLanguages(a),F(t,function(i){p.setAttribute(r,x);var c=h(p.getAttribute("data-range"));if(c){var b=i.split(/\r\n?|\n/g),l=c[0],S=c[1]==null?b.length:c[1];l<0&&(l+=b.length),l=Math.max(0,Math.min(l-1,b.length)),S<0&&(S+=b.length),S=Math.max(0,Math.min(S,b.length)),i=b.slice(l,S).join(`
2
+ `),p.hasAttribute("data-start")||p.setAttribute("data-start",String(l+1))}A.textContent=i,o.highlightElement(A)},function(i){p.setAttribute(r,E),A.textContent=i})}}),o.plugins.fileHighlight={highlight:function(p){for(var A=(p||document).querySelectorAll(f),t=0,a;a=A[t++];)o.highlightElement(a)}};var d=!1;o.fileHighlight=function(){d||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),d=!0),o.plugins.fileHighlight.highlight.apply(this,arguments)}})()});var C=se(X(),1);Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(u,g){var m={};m["language-"+g]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[g]},m.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:m}};r["language-"+g]={pattern:/[\s\S]+/,inside:Prism.languages[g]};var v={};v[u]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return u}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",v)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,u){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[u,"language-"+u],inside:Prism.languages[u]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(e){var u=e.util.clone(e.languages.javascript),g=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,m=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function v(f,F){return f=f.replace(/<S>/g,function(){return g}).replace(/<BRACES>/g,function(){return m}).replace(/<SPREAD>/g,function(){return r}),RegExp(f,F)}r=v(r).source,e.languages.jsx=e.languages.extend("markup",u),e.languages.jsx.tag.pattern=v(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=u.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:v(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:v(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var x=function(f){return f?typeof f=="string"?f:typeof f.content=="string"?f.content:f.content.map(x).join(""):""},E=function(f){for(var F=[],h=0;h<f.length;h++){var d=f[h],y=!1;if(typeof d!="string"&&(d.type==="tag"&&d.content[0]&&d.content[0].type==="tag"?d.content[0].content[0].content==="</"?F.length>0&&F[F.length-1].tagName===x(d.content[0].content[1])&&F.pop():d.content[d.content.length-1].content==="/>"||F.push({tagName:x(d.content[0].content[1]),openedBraces:0}):F.length>0&&d.type==="punctuation"&&d.content==="{"?F[F.length-1].openedBraces++:F.length>0&&F[F.length-1].openedBraces>0&&d.type==="punctuation"&&d.content==="}"?F[F.length-1].openedBraces--:y=!0),(y||typeof d=="string")&&F.length>0&&F[F.length-1].openedBraces===0){var p=x(d);h<f.length-1&&(typeof f[h+1]=="string"||f[h+1].type==="plain-text")&&(p+=x(f[h+1]),f.splice(h+1,1)),h>0&&(typeof f[h-1]=="string"||f[h-1].type==="plain-text")&&(p=x(f[h-1])+p,f.splice(h-1,1),h--),f[h]=new e.Token("plain-text",p,null,p)}d.content&&typeof d.content!="string"&&E(d.content)}};e.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||E(f.tokens)})})(Prism);(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var u=e.languages.extend("typescript",{});delete u["class-name"],e.languages.typescript["class-name"].inside=u,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:u}}}}),e.languages.ts=e.languages.typescript})(Prism);(function(e){var u=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",u),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var g=e.languages.tsx.tag;g.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+g.pattern.source+")",g.pattern.flags),g.lookbehind=!0})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var u=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+u.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+u.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+u.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+u.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:u,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var g=e.languages.markup;g&&(g.tag.addInlined("style","css"),g.tag.addAttribute("style","css"))})(Prism);(function(e){var u=/[*&][^\s[\]{},]+/,g=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,m="(?:"+g.source+"(?:[ ]+"+u.source+")?|"+u.source+"(?:[ ]+"+g.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),v=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function x(E,f){f=(f||"").replace(/m/g,"")+"m";var F=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return m}).replace(/<<value>>/g,function(){return E});return RegExp(F,f)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return m})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return m}).replace(/<<key>>/g,function(){return"(?:"+r+"|"+v+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:x(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:x(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:x(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:x(v),lookbehind:!0,greedy:!0},number:{pattern:x(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:g,important:u,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);(function(e){var u="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",g={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},m={bash:g,environment:{pattern:RegExp("\\$"+u),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+u),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+u),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:m},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:g}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:m},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:m.entity}}],environment:{pattern:RegExp("\\$?"+u),alias:"constant"},variable:m.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},g.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],v=m.variable[1].inside,x=0;x<r.length;x++)v[r[x]]=e.languages.bash[r[x]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);(function(e){var u=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function g(h){return h=h.replace(/<inner>/g,function(){return u}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var m=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return m}),v=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+v+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+v+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(m),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+v+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(m),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:g(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:g(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:g(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:g(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(d){h!==d&&(e.languages.markdown[h].inside.content.inside[d]=e.languages.markdown[d])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function d(y){if(!(!y||typeof y=="string"))for(var p=0,A=y.length;p<A;p++){var t=y[p];if(t.type!=="code"){d(t.content);continue}var a=t.content[1],n=t.content[3];if(a&&n&&a.type==="code-language"&&n.type==="code-block"&&typeof a.content=="string"){var s=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");s=(/[a-z][\w-]*/i.exec(s)||[""])[0].toLowerCase();var i="language-"+s;n.alias?typeof n.alias=="string"?n.alias=[n.alias,i]:n.alias.push(i):n.alias=[i]}}}d(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var d="",y=0,p=h.classes.length;y<p;y++){var A=h.classes[y],t=/language-(.+)/.exec(A);if(t){d=t[1];break}}var a=e.languages[d];if(a)h.content=e.highlight(F(h.content),a,d);else if(d&&d!=="none"&&e.plugins.autoloader){var n="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=n,e.plugins.autoloader.loadLanguages(d,function(){var s=document.getElementById(n);s&&(s.innerHTML=e.highlight(s.textContent,e.languages[d],d))})}}});var x=RegExp(e.languages.markup.tag.pattern.source,"gi"),E={amp:"&",lt:"<",gt:">",quot:'"'},f=String.fromCodePoint||String.fromCharCode;function F(h){var d=h.replace(x,"");return d=d.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(y,p){if(p=p.toLowerCase(),p[0]==="#"){var A;return p[1]==="x"?A=parseInt(p.slice(2),16):A=Number(p.slice(1)),f(A)}else{var t=E[p];return t||y}}),d}e.languages.md=e.languages.markdown})(Prism);Prism.languages.solidity=Prism.languages.extend("clike",{"class-name":{pattern:/(\b(?:contract|enum|interface|library|new|struct|using)\s+)(?!\d)[\w$]+/,lookbehind:!0},keyword:/\b(?:_|anonymous|as|assembly|assert|break|calldata|case|constant|constructor|continue|contract|default|delete|do|else|emit|enum|event|external|for|from|function|if|import|indexed|inherited|interface|internal|is|let|library|mapping|memory|modifier|new|payable|pragma|private|public|pure|require|returns?|revert|selfdestruct|solidity|storage|struct|suicide|switch|this|throw|using|var|view|while)\b/,operator:/=>|->|:=|=:|\*\*|\+\+|--|\|\||&&|<<=?|>>=?|[-+*/%^&|<>!=]=?|[~?]/});Prism.languages.insertBefore("solidity","keyword",{builtin:/\b(?:address|bool|byte|u?int(?:8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|string|bytes(?:[1-9]|[12]\d|3[0-2])?)\b/});Prism.languages.insertBefore("solidity","number",{version:{pattern:/([<>]=?|\^)\d+\.\d+\.\d+\b/,lookbehind:!0,alias:"number"}});Prism.languages.sol=Prism.languages.solidity;C.default.manual=!0;function Ae(e,u){let g=C.default.languages[u];return g?C.default.highlight(e,g,u):null}function xe(e){return!!C.default.languages[e]}export{Ae as highlight,xe as supports};
3
+ /*! Bundled license information:
4
+
5
+ prismjs/prism.js:
6
+ (**
7
+ * Prism: Lightweight, robust, elegant syntax highlighting
8
+ *
9
+ * @license MIT <https://opensource.org/licenses/MIT>
10
+ * @author Lea Verou <https://lea.verou.me>
11
+ * @namespace
12
+ * @public
13
+ *)
14
+ */
@@ -0,0 +1,39 @@
1
+ var Z=globalThis[Symbol.for("@rray/frontend")];if(!Z)throw new Error("@rray/frontend global not installed; view.js must run before lazy bundles import this wrapper");var{LitElement:Q,html:C,nothing:q,unsafeCSS:J,render:Sn,StateElement:vn,classMap:yn,repeat:$n,styleMap:kn}=Z;function tt(t,e){if(t.length===0)return{argv:[],quoted:new Set};let r=[t[0]],n=new Set;e.has(0)&&n.add(0);for(let s=1;s<t.length;s++){let i=t[s];if(e.has(s)){n.add(r.length),r.push(i);continue}for(let o of et(i))r.push(o)}return{argv:r,quoted:n}}function et(t){for(let e=0;e<t.length;e++){if(t[e]!=="{")continue;let r=Pt(t,e);if(r===-1)continue;let n=Bt(t.slice(e+1,r));if(n.length<2)continue;let s=t.slice(0,e),i=t.slice(r+1),o=[];for(let u of n)o.push(...et(s+u+i));return o}return[t]}function Pt(t,e){let r=1;for(let n=e+1;n<t.length;n++)if(t[n]==="{")r++;else if(t[n]==="}"&&(r--,r===0))return n;return-1}function Bt(t){let e=[],r=0,n=0;for(let s=0;s<t.length;s++)t[s]==="{"?r++:t[s]==="}"?r--:t[s]===","&&r===0&&(e.push(t.slice(n,s)),n=s+1);return e.push(t.slice(n)),e}function nt(t){let e=Xt(t);for(let s of e)if(s.kind==="amp")throw new Error("background processes (`&`) are not supported");for(;e.length>0&&e.at(-1).kind==="semi";)e.pop();let{steps:r,consumed:n}=st(e,0,!1);if(n!==e.length)throw new Error("unexpected `)`");return rt(r),r}function rt(t){for(let e of t){if(e.stages.length===0)throw new Error("empty pipeline stage");for(let r of e.stages)if(r.group)rt(r.group);else if(r.argv.length===0)throw new Error("empty pipeline stage")}}function st(t,e,r){let n=[{gate:"first",stages:[]}],s={argv:[],quoted:new Set},i=e;for(;i<t.length;){let o=t[i];if(o.kind==="paren_close"){if(!r)throw new Error("unexpected `)`");return Ht(n,s,i+1)}if(o.kind==="paren_open"){if(s.group||s.argv.length>0)throw new Error("unexpected `(`");let u=st(t,i+1,!0);s.group=u.steps,i=u.consumed;continue}if(o.kind==="pipe"||o.kind==="and"||o.kind==="or"||o.kind==="semi"){n.at(-1).stages.push(s),s={argv:[],quoted:new Set},o.kind==="and"?n.push({gate:"and",stages:[]}):o.kind==="or"?n.push({gate:"or",stages:[]}):o.kind==="semi"&&n.push({gate:"seq",stages:[]}),i++;continue}if(o.kind==="redir"){i=zt(s,t,i)+1;continue}if(s.group)throw new Error("unexpected token after `)`");o.quoted&&s.quoted.add(s.argv.length),s.argv.push(o.value),i++}if(r)throw new Error("unmatched `(`");return n.at(-1).stages.push(s),{steps:n,consumed:i}}function Ht(t,e,r){let n=t.at(-1);if(!e.group&&e.argv.length===0&&!Gt(e)&&n.stages.length===0){if(t.length===1)throw new Error("empty subshell `()`");t.pop()}else n.stages.push(e);return{steps:t,consumed:r}}function Gt(t){return!!(t.stdoutToNull||t.stderrToNull||t.mergeStderrToStdout||t.mergeStdoutToStderr)}function zt(t,e,r){let n=e[r],s=n.fd==="1"?"":n.fd;if(n.toFd)return n.fd==="2"&&n.toFd==="1"?t.mergeStderrToStdout=!0:n.fd==="1"&&n.toFd==="2"&&(t.mergeStdoutToStderr=!0),r;let i=e[r+1],o=s+">"+(n.append?">":"");if(n.append)throw new Error(`filesystem is read-only \u2014 \`${o}\` append is not supported; use \`|\` to pipe or \`${s}>/dev/null\` to discard`);if(!i||i.kind!=="word")throw new Error(`redirect \`${o}\` requires a target`);if(i.value!=="/dev/null")throw new Error(`filesystem is read-only \u2014 use \`|\` to pipe between commands, or \`${o}/dev/null\` to discard`);return n.fd==="1"?t.stdoutToNull=!0:t.stderrToNull=!0,r+1}function Xt(t){let e=[],r="",n=null,s=!1,i=!1,o=()=>{s&&e.push({kind:"word",value:r,quoted:i}),r="",s=!1,i=!1};for(let u=0;u<t.length;u++){let c=t[u];if(n){c===n?n=null:r+=c;continue}if(c==="'"||c==='"'){n=c,s=!0,i=!0;continue}if(!s&&(c==="1"||c==="2")&&t[u+1]===">"){if(o(),t[u+2]==="&"){let l=t[u+3],f=t[u+4];if((l==="1"||l==="2")&&(f===void 0||/[\s|&>;()]/u.test(f))){e.push({kind:"redir",fd:c,toFd:l}),u+=3;continue}throw new Error(`redirect \`${c}>&\` requires fd 1 or 2 followed by a token boundary`)}t[u+2]===">"?(e.push({kind:"redir",fd:c,append:!0}),u+=2):(e.push({kind:"redir",fd:c,append:!1}),u+=1);continue}if(c==="|"){o(),t[u+1]==="|"?(e.push({kind:"or"}),u++):e.push({kind:"pipe"});continue}if(c==="&"){o(),t[u+1]==="&"?(e.push({kind:"and"}),u++):e.push({kind:"amp"});continue}if(c===">"){o(),t[u+1]===">"?(e.push({kind:"redir",fd:"1",append:!0}),u++):e.push({kind:"redir",fd:"1",append:!1});continue}if(c===";"){o(),e.push({kind:"semi"});continue}if(c==="("){o(),e.push({kind:"paren_open"});continue}if(c===")"){o(),e.push({kind:"paren_close"});continue}if(/\s/u.test(c)){o();continue}r+=c,s=!0}if(n)throw new Error(`unterminated ${n==="'"?"single":"double"} quote`);return o(),e}function p(t,e={}){let r=D(e.short),n=D(e.long),s=D(e.valueShort),i=D(e.valueLong),o=D(e.repeatable),u=e.stopAtFirstPositional??!1,c=new Set,l=new Map,f=[];for(let a=0;a<t.length;a++){let d=t[a];if(d==="--"){f.push(...t.slice(a+1));break}if(/^-+$/u.test(d)){f.push(d);continue}if(d.startsWith("--")&&d.length>2){let m=d.slice(2);if(i.has(m)||o.has(m))O(l,o,m,it(t,++a,`--${m}`));else if(n.has(m))c.add(m);else throw new Error(`unknown option: --${m}`);continue}if(d.startsWith("-")&&d.length>1&&!/^-\d/u.test(d)){a=Vt(t,a,r,s,o,c,l);continue}if(u){f.push(...t.slice(a));break}f.push(d)}return{flags:c,values:l,positional:f}}function D(t){return t instanceof Set?t:new Set(t??[])}function it(t,e,r){if(e>=t.length)throw new Error(`${r} requires an argument`);return t[e]}function O(t,e,r,n){if(!e.has(r)){t.set(r,n);return}let s=t.get(r);s?s.push(n):t.set(r,[n])}function Vt(t,e,r,n,s,i,o){let u=t[e].slice(1);for(let c=0;c<u.length;c++){let l=u[c];if(n.has(l)||s.has(l))return c+1<u.length?(O(o,s,l,u.slice(c+1)),e):(O(o,s,l,it(t,++e,`-${l}`)),e);if(!r.has(l))throw new Error(`unknown option: -${l}`);i.add(l)}return e}function M(t){let e=t.startsWith("/"),r=t.split("/").filter(Boolean),n=[];for(let s of r)if(s!=="."){if(s===".."){n.length>0&&n.at(-1)!==".."?n.pop():e||n.push("..");continue}n.push(s)}return e?"/"+n.join("/"):n.length===0?".":n.join("/")}function w(t,e){return e.startsWith("/")?M(e):M(t+"/"+e)}function I(t){let e=M(t);if(e==="/")return"/";let r=e.lastIndexOf("/");return r<0?".":r===0?"/":e.slice(0,r)}function F(t){let e=M(t);if(e==="/")return"/";let r=e.lastIndexOf("/");return e.slice(r+1)}function A(t,e){return t==="/"?"/"+e:t+"/"+e}function L(t,e){return t==="/"?e.slice(1):e.slice(t.length+1)}function ot(t){let e=new Map,r=t instanceof Map?t.entries():Object.entries(t??{});for(let[i,o]of r)typeof o=="string"&&e.set(M("/"+String(i)),o);let n=new Map([["/",{dirs:[],files:[]}]]);for(let i of e.keys()){let o=I(i);Kt(n,o),n.get(o).files.push(F(i))}for(let i of n.values())i.dirs.sort(),i.files.sort();let s={isFile:i=>e.has(i),isDir:i=>n.has(i),readFile:i=>e.get(i),listDir:i=>{let o=n.get(i);if(!o)throw new Error(`not a directory: ${i}`);return o},walkFiles:i=>Ut(s,i)};return s}function*P(t,e,r=Number.POSITIVE_INFINITY){if(t.isFile(e)){yield{path:e,kind:"file",depth:0};return}if(!t.isDir(e))return;yield{path:e,kind:"dir",depth:0};let n=[{path:e,depth:0}];for(let s=0;s<n.length;s++){let i=n[s];if(i.depth>=r)continue;let{dirs:o,files:u}=t.listDir(i.path),c=i.depth+1;for(let l of o){let f=A(i.path,l);yield{path:f,kind:"dir",depth:c},n.push({path:f,depth:c})}for(let l of u)yield{path:A(i.path,l),kind:"file",depth:c}}}function*Ut(t,e){for(let r of P(t,e))r.kind==="file"&&(yield r.path)}function Kt(t,e){let r=[],n=e;for(;n!=="/"&&!t.has(n);)r.push(n),n=I(n);for(let s=r.length-1;s>=0;s--){let i=r[s];t.set(i,{dirs:[],files:[]}),t.get(I(i)).dirs.push(F(i))}}var g=(t="")=>({stdout:t,stderr:"",exitCode:0}),h=(t,e=1)=>({stdout:"",stderr:t.endsWith(`
2
+ `)?t:t+`
3
+ `,exitCode:e}),k=t=>h(`usage: ${t}`,2);function S(t){if(t==="")return[];let e=t.split(`
4
+ `);return e.at(-1)===""&&e.pop(),e}var v=t=>t.length===0?"":t.join(`
5
+ `)+`
6
+ `;function B(t,e,r){let n=[],s="",i=!1;for(let o of e){let u=w(r.cwd,o);if(r.fs.isDir(u)){s+=`${t}: ${o}: is a directory
7
+ `,i=!0;continue}if(!r.fs.isFile(u)){s+=`${t}: ${o}: no such file or directory
8
+ `,i=!0;continue}n.push({name:o,content:r.fs.readFile(u)})}return{inputs:n,stderr:s,failed:i}}function E(t,e,r,n){return e.length===0?{inputs:[{name:null,content:r}],stderr:"",failed:!1}:B(t,e,n)}function W(t,e,r,n){let s=E(t,e,r,n);return{content:s.inputs.map(i=>i.content).join(""),stderr:s.stderr,failed:s.failed}}var y=(t,e)=>({stdout:t,stderr:e.stderr,exitCode:e.failed?1:0});function T(t,e){if(typeof t!="string"||!/^\d+$/u.test(t))return{error:h(`${e}: invalid count: ${t}`)};let r=Number(t);return Number.isSafeInteger(r)?{value:r}:{error:h(`${e}: out of range: ${t}`)}}function Yt(t,e,r){let{positional:n}=p(e),s=E("tac",n,t,r),i=[];for(let{content:o}of s.inputs)i.push(...S(o).toReversed());return y(v(i),s)}var ut=1e6;function Zt(t,e){let{positional:r}=p(e);if(r.length===0||r.length>3)return k("seq LAST | seq FIRST LAST | seq FIRST INCR LAST");let n=[];for(let f of r){if(!/^-?\d+$/u.test(f))return h(`seq: invalid integer: ${f}`);n.push(Number(f))}let s,i,o;if(n.length===1?(s=1,i=1,o=n[0]):n.length===2?(s=n[0],o=n[1],i=s<=o?1:-1):[s,i,o]=n,i===0)return h("seq: increment must be non-zero");let c=(i>0?s<=o:s>=o)?Math.floor(Math.abs(o-s)/Math.abs(i))+1:0;if(c>ut)return h(`seq: range too large: ${c} elements exceeds limit of ${ut}`);let l=[];if(i>0)for(let f=s;f<=o;f+=i)l.push(String(f));else for(let f=s;f>=o;f+=i)l.push(String(f));return g(v(l))}function Qt(t,e,r){let{values:n,positional:s}=p(e,{valueShort:["b"]}),i=n.get("b")??"t";if(i!=="a"&&i!=="t")return h(`nl: -b: only \`a\` and \`t\` are supported (got \`${i}\`)`);let o=E("nl",s,t,r),u=[],c=0;for(let{content:l}of o.inputs)for(let f of S(l))i==="a"||f!==""?(c++,u.push(`${String(c).padStart(6)} ${f}`)):u.push(f);return y(v(u),o)}function Jt(t,e,r){let{values:n,positional:s}=p(e,{valueShort:["d","f","c"]}),i=n.has("f"),o=n.has("c");if(i===o)return k("cut -f LIST [-d DELIM] [file...] | cut -c LIST [file...]");if(o&&n.has("d"))return h("cut: -d is only valid with -f");let u=te(i?n.get("f"):n.get("c"));if(u.error)return u.error;let c=n.get("d")??" ";if(i&&c.length!==1)return h("cut: -d delimiter must be a single character");let l=E("cut",s,t,r),f=[];for(let{content:a}of l.inputs)for(let d of S(a))f.push(i?ee(d,c,u.ranges):lt([...d],u.ranges).join(""));return y(v(f),l)}function te(t){let e=[];for(let r of t.split(",")){if(r==="")return{error:h(`cut: empty list item in \`${t}\``)};if(/^\d+$/u.test(r)){let o=Number(r);if(o<1)return{error:h("cut: list items must be >= 1")};e.push([o,o]);continue}let n=r.match(/^(\d*)-(\d*)$/u);if(!n||n[1]===""&&n[2]==="")return{error:h(`cut: invalid list item: ${r}`)};let s=n[1]===""?1:Number(n[1]),i=n[2]===""?Number.POSITIVE_INFINITY:Number(n[2]);if(s<1)return{error:h("cut: list items must be >= 1")};if(i<s)return{error:h(`cut: reversed range: ${r}`)};e.push([s,i])}return{ranges:e}}function lt(t,e){let r=new Set,n=[];for(let[s,i]of e)for(let o=s;o<=Math.min(i,t.length);o++)r.has(o)||(r.add(o),n.push(o));return n.sort((s,i)=>s-i),n.map(s=>t[s-1])}function ee(t,e,r){let n=t.split(e);return n.length===1?t:lt(n,r).join(e)}function ne(t,e){let{flags:r,positional:n}=p(e,{short:["d","s"]}),s=r.has("d"),i=r.has("s");if(s&&i)return h("tr: -d combined with -s is not supported");let o=s||i?1:2;if(n.length!==o)return k("tr SET1 SET2 | tr -d SET | tr -s SET");let u=ct(n[0]);if(u.error)return u.error;if(s){let a=new Set(u.chars);return g([...t].filter(d=>!a.has(d)).join(""))}if(i)return g(re(t,new Set(u.chars)));let c=ct(n[1]);if(c.error)return c.error;if(c.chars.length===0)return h("tr: SET2 must not be empty");let l=new Map,f=c.chars.at(-1);for(let a=0;a<u.chars.length;a++)l.set(u.chars[a],c.chars[a]??f);return g([...t].map(a=>l.get(a)??a).join(""))}function ct(t){let e=[...t],r=[],n=0,s=()=>{if(e[n]!=="\\")return e[n++];if(n+1>=e.length)return null;let i=e[n+1];return n+=2,i==="n"?`
9
+ `:i==="t"?" ":i==="\\"?"\\":i==="0"?"\0":i};for(;n<e.length;){let i=s();if(i===null)return{error:h("tr: trailing backslash in set")};if(e[n]==="-"&&n+1<e.length){n++;let o=s();if(o===null)return{error:h("tr: trailing backslash in set")};let u=i.codePointAt(0),c=o.codePointAt(0);if(c<u)return{error:h(`tr: reversed range: ${i}-${o}`)};for(let l=u;l<=c;l++)r.push(String.fromCodePoint(l))}else r.push(i)}return{chars:r}}function re(t,e){let r="",n=null;for(let s of t)e.has(s)&&s===n||(r+=s,n=s);return r}function se(t,e,r){let{positional:n}=p(e);if(n.length===0)return k("which COMMAND...");let s=[],i=0;for(let o of n)r.hasCommand(o)?s.push(`/usr/bin/${o}`):(s.push(`${o} not found`),i=1);return{stdout:v(s),stderr:"",exitCode:i}}var ft={cut:Jt,tac:Yt,tr:ne,seq:Zt,nl:Qt,which:se};var at=/[*?]/u;function G(t){return new RegExp("^"+t.replace(/[.+^${}()|[\]\\]/gu,"\\$&").replace(/\*/gu,".*").replace(/\?/gu,".")+"$","u")}function ht(t,e,r){if(t.length===0)return[];let n=[t[0]];for(let s=1;s<t.length;s++){let i=t[s];if(e.has(s)||!at.test(i)){n.push(i);continue}let o=ie(i,r);o.length>0?n.push(...o):n.push(i)}return n}function ie(t,e){let r=t.startsWith("/"),n=t.startsWith("./"),s=t.endsWith("/")&&t.length>1,i=t.split("/").filter(Boolean);if(i.length===0)return r?["/"]:[];let o=[r?"/":"."];for(let u=0;u<i.length;u++){let c=i[u];if(!at.test(c)){o=o.map(l=>H(l,c));continue}o=ue(o,c,u===i.length-1,e)}return s?o=o.filter(u=>e.fs.isDir(w(e.cwd,u))).map(u=>u==="/"?u:u+"/"):o=o.filter(u=>oe(u,e)),n&&(o=o.map(u=>u.startsWith("./")?u:"./"+u)),o.sort(),o}function oe(t,e){let r=w(e.cwd,t);return e.fs.isFile(r)||e.fs.isDir(r)}function ue(t,e,r,n){let s=G(e),i=e.startsWith("."),o=c=>!i&&c.startsWith(".")?!1:s.test(c),u=[];for(let c of t){let l=w(n.cwd,c);if(!n.fs.isDir(l))continue;let{dirs:f,files:a}=n.fs.listDir(l);for(let d of f)o(d)&&u.push(H(c,d));if(r)for(let d of a)o(d)&&u.push(H(c,d))}return u}function H(t,e){return t==="."?e:A(t,e)}var dt=new Set(["name","type","path","mindepth","maxdepth"]);function pt(t,e,r){let n=ce(e);if(n.error)return n.error;let{starts:s,minDepth:i,maxDepth:o,groups:u}=n,c=[];for(let l of s){let f=w(r.cwd,l);if(!r.fs.isDir(f)&&!r.fs.isFile(f))return h(`find: ${l}: no such file or directory`);for(let a of P(r.fs,f,o)){if(a.depth<i)continue;let d=ge(l,f,a.path);de(u,{kind:a.kind,path:d})&&c.push(d)}}return g(c.length===0?"":c.join(`
10
+ `)+`
11
+ `)}function ce(t){let e=le(t);return e.error?e:fe(e.tokens,e.minDepth,e.maxDepth)}function le(t){let e=[],r=0,n=Number.POSITIVE_INFINITY;for(let s=0;s<t.length;s++){let i=t[s],o=i==="-mindepth"||i==="--mindepth"?"mindepth":i==="-maxdepth"||i==="--maxdepth"?"maxdepth":null;if(o){if(s+1>=t.length)return{error:h(`find: -${o} requires a value`)};let u=T(t[s+1],`find: -${o}`);if(u.error)return u;o==="mindepth"?r=u.value:n=u.value,s++;continue}if(i==="--"){e.push(...t.slice(s));break}e.push(i)}return{tokens:e,minDepth:r,maxDepth:n}}function fe(t,e,r){let n=[[]],s=[],i=!1,o=!1,u=!1,c=null;for(let l=0;l<t.length;l++){let f=t[l];if(o){s.push(f);continue}if(f==="-not"||f==="!"){if(i)return{error:h("find: `-not` cannot precede another `-not`")};i=!0,u=!0;continue}if(f==="-a"||f==="-and"||f==="--and"){if(i)return{error:h("find: `-not` must be followed by a primary")};if(c)return{error:h(`find: \`${c}\` with no right-hand expression`)};if(n.at(-1).length===0)return{error:h("find: `-a` with no left-hand expression")};c="-a",u=!0;continue}if(f==="-o"||f==="-or"||f==="--or"){if(i)return{error:h("find: `-not` must be followed by a primary")};if(c)return{error:h(`find: \`${c}\` with no right-hand expression`)};if(n.at(-1).length===0)return{error:h("find: `-o` with no left-hand expression")};n.push([]),c="-o",u=!0;continue}let a=ae(f);if(a!==null){if(l+1>=t.length)return{error:h(`find: ${f} requires a value`)};let d=t[l+1],m=he(a,d);if(m.error)return m;let x={kind:a,value:d,negate:i};(a==="name"||a==="path")&&(x.re=G(d)),n.at(-1).push(x),i=!1,c=null,u=!0,l++;continue}if(f==="--"){o=!0;continue}if(i)return{error:h(`find: \`-not\` must be followed by a primary, got: ${f}`)};if(f.startsWith("-")&&f!=="-"&&!/^-\d/u.test(f))return{error:h(`find: unknown option: ${f}`)};if(u)return{error:h(`find: paths must precede expression: ${f}`)};s.push(f)}return i?{error:h("find: trailing `-not` with no primary")}:c?{error:h(`find: \`${c}\` with no right-hand expression`)}:{starts:s.length>0?s:["."],minDepth:e,maxDepth:r,groups:n}}function ae(t){return/^--?(?:min|max)depth$/u.test(t)?null:t.startsWith("--")&&dt.has(t.slice(2))?t.slice(2):t.startsWith("-")&&dt.has(t.slice(1))?t.slice(1):null}function he(t,e){return t==="type"&&e!=="f"&&e!=="d"?{error:h(`find: -type/--type expects 'f' or 'd', got: ${e}`)}:{}}function de(t,e){return t.some(r=>r.every(n=>pe(n,e)))}function pe(t,e){let r=me(t,e);return t.negate?!r:r}function me(t,e){return t.kind==="type"?t.value==="f"?e.kind==="file":e.kind==="dir":t.kind==="name"?t.re.test(F(e.path)):t.kind==="path"?t.re.test(e.path):!1}function ge(t,e,r){if(r===e)return t;let n=L(e,r);return t.endsWith("/")?t+n:t+"/"+n}function we(t,e,r){return p(e),g(r.cwd+`
12
+ `)}function xe(t,e,r){let{positional:n}=p(e),s=n[0]??"/",i=w(r.cwd,s);return r.fs.isDir(i)?(r.cwd=i,g()):h(`cd: not a directory: ${s}`)}function be(t,e,r){let{flags:n,positional:s}=p(Se(e),{short:["l","a"]}),i={long:n.has("l"),all:n.has("a")},o=s.length>0?s:["."],u=[],c=[],l=0;for(let f=0;f<o.length;f++){let a=ve(o[f],o.length>1,i,r);if(a.error){l=1,c.push(a.error);continue}f>0&&o.length>1&&u.push(""),u.push(...a.lines)}return{stdout:u.length===0?"":u.join(`
13
+ `)+`
14
+ `,stderr:c.length===0?"":c.join(`
15
+ `)+`
16
+ `,exitCode:l}}function Se(t){let e=[],r=!1;for(let n of t){if(r){e.push(n);continue}if(n==="--"){e.push(n),r=!0;continue}if(n!=="-1"){if(/^-[a-zA-Z0-9]+$/u.test(n)&&n.includes("1")&&/[a-zA-Z]/u.test(n)){e.push("-"+n.slice(1).replaceAll("1",""));continue}e.push(n)}}return e}function ve(t,e,r,n){let s=w(n.cwd,t);if(n.fs.isFile(s))return{lines:[z(t,n.fs.readFile(s).length,!1,r.long)]};if(!n.fs.isDir(s))return{error:`ls: ${t}: no such file or directory`};let i=e?[`${t}:`]:[],{dirs:o,files:u}=n.fs.listDir(s);for(let c of o)!r.all&&c.startsWith(".")||i.push(z(c,0,!0,r.long));for(let c of u){if(!r.all&&c.startsWith("."))continue;let l=A(s,c);i.push(z(c,n.fs.readFile(l).length,!1,r.long))}return{lines:i}}function z(t,e,r,n){let s=t+(r?"/":"");return n?`${r?"d":"-"} ${String(e).padStart(8)} ${s}`:s}function ye(t,e,r){let{positional:n}=p(e),s=n[0]??".",i=w(r.cwd,s);if(!r.fs.isDir(i))return h(`tree: ${s}: not a directory`);let o=[s];return $e(r.fs,i,o),g(o.join(`
17
+ `)+`
18
+ `)}function $e(t,e,r){let n=[{dir:e,prefix:"",items:mt(t,e),i:0}];for(;n.length>0;){let s=n.at(-1);if(s.i>=s.items.length){n.pop();continue}let{n:i,isDir:o}=s.items[s.i],u=s.i===s.items.length-1;if(r.push(s.prefix+(u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+i+(o?"/":"")),s.i++,!o)continue;let c=A(s.dir,i);n.push({dir:c,prefix:s.prefix+(u?" ":"\u2502 "),items:mt(t,c),i:0})}}function mt(t,e){let{dirs:r,files:n}=t.listDir(e);return[...r.map(s=>({n:s,isDir:!0})),...n.map(s=>({n:s,isDir:!1}))]}function ke(t,e){let{positional:r}=p(e);return r.length===0?k("basename PATH"):g(F(r[0])+`
19
+ `)}function Ee(t,e){let{positional:r}=p(e);return r.length===0?k("dirname PATH"):g(I(r[0])+`
20
+ `)}var gt={pwd:we,cd:xe,ls:be,find:pt,tree:ye,basename:ke,dirname:Ee};var Te=/^(\d+)(?:,(\d+))?p$/u;function wt(t,e,r){let n;try{n=p(e,{short:["n"]})}catch{return X()}let{flags:s,positional:i}=n;if(!s.has("n")||i.length===0)return X();let o=Te.exec(i[0]);if(!o)return X();let u=Number(o[1]),c=o[2]===void 0?u:Number(o[2]);if(u<1||c<1)return h("sed: line numbers must be >= 1");if(c<u)return h(`sed: reversed range: ${u},${c}`);let l=i.slice(1);if(l.length>1)return h("sed: at most one input file is supported");let f=E("sed",l,t,r),a=f.inputs[0]?.content??"",m=S(a).slice(u-1,c);return y(m.length>0?m.join(`
21
+ `)+`
22
+ `:"",f)}function X(){return h("sed: only `-n 'X[,Y]p'` (line range print) is supported")}function xt(t,e){let r=t[e+1];if(r===void 0)return-1;if("^$\\.*+?()[]{}|/bBdDsSwW".includes(r)||r>="1"&&r<="9")return 2;let n=i=>i!==void 0&&/[0-9A-Fa-f]/u.test(i),s=(i,o)=>{if(t[e+2]!==i)return 0;let u=t.indexOf(o,e+3);return u>e+3?u-e+1:0};if(r==="x")return n(t[e+2])&&n(t[e+3])?4:0;if(r==="u"){if(t[e+2]==="{"){let i=s("{","}"),o=i?t.slice(e+3,e+i-1):"";return o.length>=1&&o.length<=6&&[...o].every(n)&&parseInt(o,16)<=1114111?i:0}return[2,3,4,5].every(i=>n(t[e+i]))?6:0}return r==="p"||r==="P"?s("{","}"):r==="c"?/[A-Za-z]/u.test(t[e+2]??"")?3:0:r==="k"?s("<",">"):0}function St(t){let e="(){}+?|",r="",n=!1;for(let s=0;s<t.length;s++){let i=t[s];if(n){if(i==="\\"){let o=xt(t,s);if(o===-1)return{error:"trailing backslash (\\)"};if(o>0){r+=t.slice(s,s+o),s+=o-1;continue}r+=t[s+1],s++;continue}r+=i,i==="]"&&(n=!1);continue}if(i==="["){r+=i,n=!0,t[s+1]==="^"&&(r+="^",s++),t[s+1]==="]"&&(r+="\\]",s++);continue}if(i==="\\"){if(s+1>=t.length)return{error:"trailing backslash (\\)"};let o=t[s+1];if(e.includes(o)){r+=o,s++;continue}if(o==="<"||o===">"){r+="\\b",s++;continue}let u=xt(t,s);if(u>0){r+=t.slice(s,s+u),s+=u-1;continue}r+=o,s++;continue}if(i==="*"&&(s===0||t[s-1]==="^"&&bt(t,s-1))){r+="\\*";continue}if(i==="^"&&!bt(t,s)){r+="\\^";continue}if(i==="$"&&!(s===t.length-1||t[s+1]==="\\"&&(t[s+2]===")"||t[s+2]==="|"))){r+="\\$";continue}if(e.includes(i)){r+="\\"+i;continue}r+=i}return{source:r}}function bt(t,e){return e===0?!0:e>=2&&t[e-2]==="\\"&&(t[e-1]==="("||t[e-1]==="|")}var vt="[-i] [-v] [-n] [-r] [-w] [-o] [-E|-F|-G] [-l] [-L] [-c] [-h] [-H] [-A N] [-B N] [-C N]",_e=`grep ${vt} PATTERN [PATH...]
23
+ or: grep ${vt} -e PATTERN ... [PATH...]`,Ce=["i","v","n","r","l","L","c","w","h","H","o","E","F","G"],Ne=["A","B","C"];function $t(t,e,r){let n;try{n=p(e,{short:Ce,valueShort:Ne,repeatable:["e"]})}catch(Ot){return h(`grep: ${Ot.message}`,2)}let{flags:s,values:i,positional:o}=n,u=i.get("e")??[],c,l;if(u.length>0)c=u,l=o;else if(o.length>0)c=[o[0]],l=o.slice(1);else return k(_e);let f=Ae(s);if(f)return f;let a=Fe(c,s);if(a.error)return a.error;let d=De(i);if(d.error)return d.error;let m=s.has("r"),x=Ie(m,t,l,r),b=Me(s,m,l.length),_=s.has("v"),$={showName:b,invert:_,showLine:s.has("n"),only:s.has("o"),after:d.after,before:d.before},N=s.has("l")?yt(x.inputs,a.res,_,!1):s.has("L")?yt(x.inputs,a.res,_,!0):s.has("c")?Oe(x.inputs,a.res,_,b):Re(x.inputs,a.res,$);return x.failed?{stdout:N.stdout,stderr:x.stderr+N.stderr,exitCode:2}:N}function Ae(t){if(t.has("h")&&t.has("H"))return h("grep: -h and -H are mutually exclusive");let e=["l","L","c"].filter(n=>t.has(n));if(e.length>1)return h(`grep: ${e.map(n=>`-${n}`).join(" / ")} are mutually exclusive`);let r=["E","F","G"].filter(n=>t.has(n));return r.length>1?h(`grep: ${r.map(n=>`-${n}`).join(" / ")} are mutually exclusive`):null}function Fe(t,e){let r=[],n=e.has("i")?"iu":"u";for(let s of t){let i;if(e.has("F"))i=RegExp.escape(s);else if(e.has("E"))i=s;else{let o=St(s);if(o.error)return{error:h(`grep: ${o.error}`,2)};i=o.source}e.has("w")&&(i=`\\b(?:${i})\\b`);try{r.push(new RegExp(i,n))}catch(o){let u=e.has("F")?`fixed-string /${n}`:e.has("E")?`ERE / ECMAScript /${n}`:`BRE /${n}`;return{error:h(`grep: invalid pattern (${u}): ${o.message}`,2)}}}return{res:r}}function R(t,e){return t.some(r=>r.test(e))}var V=()=>({stdout:"",stderr:"",exitCode:1});function De(t){let e=t.get("C"),r=e===void 0?null:T(e,"grep: -C");if(r?.error)return r;let n=T(t.get("A")??e??"0","grep: -A");if(n.error)return n;let s=T(t.get("B")??e??"0","grep: -B");return s.error?s:{after:n.value,before:s.value}}function Me(t,e,r){return t.has("h")?!1:t.has("H")?!0:e||r>1}function Ie(t,e,r,n){return t?Le("grep",r.length>0?r:["."],n):r.length>0?B("grep",r,n):{inputs:[{name:null,content:e}],stderr:"",failed:!1}}function Le(t,e,r){let n=[],s="",i=!1;for(let o of e){let u=w(r.cwd,o);if(r.fs.isFile(u)){n.push({name:o,content:r.fs.readFile(u)});continue}if(!r.fs.isDir(u)){s+=`${t}: ${o}: no such file or directory
24
+ `,i=!0;continue}for(let c of r.fs.walkFiles(u))n.push({name:We(o,u,c),content:r.fs.readFile(c)})}return{inputs:n,stderr:s,failed:i}}function We(t,e,r){let n=L(e,r);return t==="."?n:t.endsWith("/")?t+n:t+"/"+n}function Re(t,e,r){let n=[],s=!1;for(let{name:o,content:u}of t){let c=S(u),l=je(c,e,o,r);l.matched&&(s=!0),l.lines.length>0&&n.push(l.lines.join(`
25
+ `))}let i=n.join(`
26
+ `);return s?g(i+(i?`
27
+ `:"")):V()}function je(t,e,r,n){let{invert:s,after:i,before:o,only:u}=n,c=o>0||i>0,l=[],f=!1,a=-1;for(let d=0;d<t.length;d++){if(R(e,t[d])===s)continue;if(f=!0,u){l.push(...qe(t[d],r,d+1,e,n));continue}let m=Math.max(0,d-o),x=Math.min(t.length-1,d+i);c&&a>=0&&m>a+1&&l.push("--");for(let b=Math.max(m,a+1);b<=x;b++){let _=b===d||R(e,t[b])!==s;l.push(kt(t[b],r,b+1,_,n))}a=x}return{lines:l,matched:f}}function qe(t,e,r,n,s){let i=[];for(let c of n){let l=new RegExp(c.source,c.flags+"g");for(let f of t.matchAll(l))f[0].length>0&&i.push({index:f.index,text:f[0]})}i.sort((c,l)=>c.index-l.index||l.text.length-c.text.length);let o=[],u=0;for(let c of i)c.index<u||(o.push(kt(c.text,e,r,!0,s)),u=c.index+c.text.length);return o}function kt(t,e,r,n,s){let{showName:i,showLine:o}=s,u=n?":":"-",c=[];return i&&c.push(e??"(standard input)"),o&&c.push(String(r)),c.length>0?c.join(u)+u+t:t}function yt(t,e,r,n){let s=[];for(let{name:i,content:o}of t){let c=S(o).some(l=>R(e,l)!==r);(n?!c:c)&&s.push(i??"(standard input)")}return s.length>0?g(v(s)):V()}function Oe(t,e,r,n){let s=[],i=!1;for(let{name:o,content:u}of t){let c=S(u),l=0;for(let f of c)R(e,f)!==r&&l++;l>0&&(i=!0),n?s.push(`${o??"(standard input)"}:${l}`):s.push(String(l))}return s.length===0?V():{stdout:v(s),stderr:"",exitCode:i?0:1}}function Pe(t,e,r){let{flags:n,positional:s}=p(e,{short:["n"]}),i=W("cat",s,t,r);return y(n.has("n")?Be(i.content):i.content,i)}function Be(t){if(t==="")return"";let e=t.endsWith(`
28
+ `)?`
29
+ `:"";return(e?t.slice(0,-1).split(`
30
+ `):t.split(`
31
+ `)).map((n,s)=>`${String(s+1).padStart(6)} ${n}`).join(`
32
+ `)+e}function He(t,e,r){let{values:n,positional:s}=p(e,{valueShort:["n"]});Ct(n,s);let i=T(n.get("n")??"10","head: -n");return i.error?i.error:Nt("head",t,s,r,o=>o.slice(0,i.value))}function Ge(t,e,r){let{values:n,positional:s}=p(e,{valueShort:["n"]});Ct(n,s);let i=T(n.get("n")??"10","tail: -n");return i.error?i.error:Nt("tail",t,s,r,o=>i.value===0?[]:o.slice(-i.value))}function Ct(t,e){t.has("n")||e[0]&&/^-\d+$/u.test(e[0])&&t.set("n",e.shift().slice(1))}function Nt(t,e,r,n,s){let i=E(t,r,e,n),o=i.inputs.length>1,u=[];for(let c=0;c<i.inputs.length;c++){let{name:l,content:f}=i.inputs[c],a=s(S(f)).join(`
33
+ `);o?u.push(`${c>0?`
34
+ `:""}==> ${l} <==
35
+ ${a}${a?`
36
+ `:""}`):a.length>0&&u.push(a+`
37
+ `)}return y(u.join(""),i)}function ze(t,e,r){let{flags:n,positional:s}=p(e,{short:["l","w","c"]}),i=Xe(n),o=E("wc",s,t,r),u=[],c={l:0,w:0,c:0};for(let{name:l,content:f}of o.inputs){let a=Ue(f);u.push(Et(a,l,i)),c.l+=a.l,c.w+=a.w,c.c+=a.c}return o.inputs.length>1&&u.push(Et(c,"total",i)),y(v(u),o)}function Xe(t){return t.has("l")||t.has("w")||t.has("c")?{l:t.has("l"),w:t.has("w"),c:t.has("c")}:{l:!0,w:!0,c:!0}}var Ve=new TextEncoder;function Ue(t){return{l:(t.match(/\n/gu)??[]).length,w:(t.match(/\S+/gu)??[]).length,c:Ve.encode(t).length}}function Et(t,e,r){let n=[];return r.l&&n.push(String(t.l).padStart(7)),r.w&&n.push(String(t.w).padStart(7)),r.c&&n.push(String(t.c).padStart(7)),n.join(" ")+(e?" "+e:"")}function Ke(t,e,r){let{flags:n,positional:s}=p(e,{short:["n","r","u"]}),i=W("sort",s,t,r),o=S(i.content),u=n.has("n"),c=n.has("u");if(u){let l=o.map(f=>({line:f,key:Tt(f)}));l.sort(c?(f,a)=>f.key-a.key:(f,a)=>f.key-a.key||(f.line<a.line?-1:f.line>a.line?1:0)),o=l.map(f=>f.line)}else o.sort();if(c){let l=new Set;o=o.filter(f=>{let a=u?Tt(f):f;return l.has(a)?!1:(l.add(a),!0)})}return n.has("r")&&o.reverse(),y(v(o),i)}function Tt(t){let e=/^[ \t]*(-?(?:\d+\.?\d*|\.\d+))/u.exec(t);return e?Number(e[1]):0}function Ye(t,e,r){let{flags:n,positional:s}=p(e,{short:["c","d","u","i"]}),i=W("uniq",s,t,r),o=n.has("c"),u=n.has("d"),c=n.has("u"),l=n.has("i"),f=$=>l?$.toLowerCase():$,a=S(i.content),d=[],m=null,x=null,b=0,_=()=>{if(m===null)return;let $=b>=2;!(u&&c)&&(u?$:!c||!$)&&d.push(o?`${String(b).padStart(7)} ${m}`:m)};for(let $ of a){let N=f($);if(N===x){b++;continue}_(),m=$,x=N,b=1}return _(),y(v(d),i)}function Ze(t,e){let{flags:r,positional:n}=p(e,{short:["n","e","E"]}),s=n.join(" "),i=!r.has("n");if(r.has("e")){let o=Qe(s);s=o.text,o.stop&&(i=!1)}return g(i?s+`
38
+ `:s)}function Qe(t){let e={a:7,b:8,e:27,f:12,n:10,r:13,t:9,v:11,"\\":92},r="";for(let n=0;n<t.length;n++){if(t[n]!=="\\"||n+1>=t.length){r+=t[n];continue}let s=t[++n];if(s==="c")return{text:r,stop:!0};if(s in e){r+=String.fromCodePoint(e[s]);continue}if(s==="0"){let i="";for(;i.length<3&&/[0-7]/u.test(t[n+1]??"");)i+=t[++n];r+=String.fromCodePoint(i===""?0:parseInt(i,8));continue}if(s==="x"&&/[0-9a-fA-F]/u.test(t[n+1]??"")){let i="";for(;i.length<2&&/[0-9a-fA-F]/u.test(t[n+1]??"");)i+=t[++n];r+=String.fromCodePoint(parseInt(i,16));continue}r+="\\"+s}return{text:r,stop:!1}}function Je(t,e,r){let{flags:n,values:s,positional:i}=p(e,{short:["r"],valueShort:["n"],stopAtFirstPositional:!0}),[o="echo",...u]=i,c=t.split(/\s+/u).filter(Boolean);if(c.length===0)return n.has("r")?g():r.dispatch(o,u,"");let l=s.has("n")?T(s.get("n"),"xargs: -n"):{value:c.length};return l.error?l.error:s.has("n")&&l.value===0?h("xargs: -n: must be at least 1"):tn(r,o,u,c,l.value)}function tn(t,e,r,n,s){let i="",o="",u=0;for(let c=0;c<n.length;c+=s){let l=t.dispatch(e,[...r,...n.slice(c,c+s)],"");i+=l.stdout,o+=l.stderr,l.exitCode!==0&&(u=l.exitCode)}return{stdout:i,stderr:o,exitCode:u}}function _t(){return g()}function en(){return{stdout:"",stderr:"",exitCode:1}}var At={cat:Pe,grep:$t,head:He,tail:Ge,wc:ze,sort:Ke,uniq:Ye,echo:Ze,xargs:Je},Ft={true:_t,false:en,":":_t};function Dt(t,e,r){let{index:n,pipe:s}=rn(t),i=t.slice(n),o=sn(i),u=i.slice(o),c=i.slice(0,o).trim(),l=c==="",f=l?"":r.resolveCommand(c.split(/\s+/u)[0]),a=t.slice(0,n+o),d=s&&a.endsWith("|")?" ":"";return nn(u,l,s,f,e,r).map(m=>a+d+m)}function nn(t,e,r,n,s,i){if(!e)return r?[]:on(t,s,n==="cd");let o=r?i.pipeNames:i.names;for(let u of i.binPrefixes)if(t.startsWith(u)){let c=t.slice(u.length);return o.filter(l=>l.startsWith(c)).map(l=>u+l)}return t.startsWith("/")||t.startsWith("./")?[]:o.filter(u=>u.startsWith(t))}function rn(t){let e=0,r=!1,n=0;for(;n<t.length;){let s=t[n];if(s==="|"){let i=t[n+1]==="|";n+=i?2:1,e=n,r=!i}else s==="&"&&t[n+1]==="&"?(n+=2,e=n,r=!1):s===";"?(n++,e=n,r=!1):n++}return{index:e,pipe:r}}function sn(t){for(let e=t.length-1;e>=0;e--)if(/\s/u.test(t[e]))return e+1;return 0}function on(t,e,r=!1){let n=t.lastIndexOf("/"),s=t.slice(0,n+1),i=t.slice(n+1),o=w(e.cwd,s);if(!e.fs.isDir(o))return[];let{dirs:u,files:c}=e.fs.listDir(o),l=i.startsWith("."),f=[];for(let a of u)!l&&a.startsWith(".")||a.startsWith(i)&&f.push(s+a+"/");if(r)return f;for(let a of c)!l&&a.startsWith(".")||a.startsWith(i)&&f.push(s+a);return f}var j={__proto__:null,...At,...gt,...ft},U={__proto__:null,sed:wt,...Ft},un=["ls","cd","cat","grep","find","head","tail","wc","tree","sort","uniq","cut","tr","nl","tac","xargs","echo","pwd","seq","which","basename","dirname"],Mt=fn(),cn=Mt.join(", "),ln=["grep","head","tail","wc","sort","uniq","cut","xargs","tr","nl","tac","cat"];function fn(){let t=new Set(Object.keys(j)),e=[];for(let r of un)t.delete(r)&&e.push(r);return e.push(...[...t].sort()),e}function It(t,e={}){let r=ot(t),s={cwd:e.cwd===void 0?"/":w("/",e.cwd),fs:r};if(s.dispatch=(i,o,u)=>Rt(i,o,u,s),s.hasCommand=i=>!!(j[i]||U[i]),!r.isDir(s.cwd))throw new Error(`createTerminal: cwd is not a directory: ${s.cwd}`);return{run:i=>an(i,s),cwd:()=>s.cwd,complete:i=>Dt(i,s,{names:Mt,pipeNames:ln,binPrefixes:Lt,resolveCommand:Wt})}}var Lt=["/usr/local/bin/","/usr/bin/","/bin/","/sbin/"];function Wt(t){for(let e of Lt)if(t.startsWith(e)){let r=t.slice(e.length);if(j[r]||U[r])return r}return t}function Rt(t,e,r,n){let s=Wt(t),i=j[s]??U[s];if(!i)return mn(t);try{return i(r,e,n)}catch(o){return h(`${t}: ${o.message}`)}}function an(t,e){try{let r=t.trim();if(r==="")return{stdout:"",stderr:"",exitCode:0,cwd:e.cwd};let n=nt(r);return{...jt(n,e,""),cwd:e.cwd}}catch(r){return{...h(`error: ${r.message}`),cwd:e.cwd}}}function jt(t,e,r){let n="",s="",i=0,o=!1;for(let u=0;u<t.length;u++){let c=t[u];if(c.gate==="and"&&i!==0||c.gate==="or"&&i===0)continue;let l=hn(c.stages,e,u===0?r:"");n+=l.stdout,s+=l.stderr,i=l.exitCode,o=!0}return o||(i=0),{stdout:n,stderr:s,exitCode:i}}function hn(t,e,r){let n=r,s="";for(let i=0;i<t.length;i++){let o=t[i],u=o.group?pn(o.group,e,n):dn(o,e,n),c=u.stdout,l=u.stderr;if(o.mergeStderrToStdout&&(c+=l,l=""),o.mergeStdoutToStderr&&(l+=c,c=""),o.stdoutToNull&&(c=""),o.stderrToNull&&(l=""),s+=l,i===t.length-1)return{stdout:c,stderr:s,exitCode:u.exitCode};n=c}return{stdout:"",stderr:s,exitCode:0}}function dn(t,e,r){let n=tt(t.argv,t.quoted??new Set),s=ht(n.argv,n.quoted,e);return Rt(s[0],s.slice(1),r,e)}function pn(t,e,r){let n=e.cwd;try{return jt(t,e,r)}finally{e.cwd=n}}function mn(t){return h(`${t}: command not found. Available: ${cn}`,127)}var qt=`:host{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--bg, #0c0c0c);color:var(--text, #e6edf3);font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:13px;line-height:1.45}.output{flex:1 1 auto;overflow-y:auto;overscroll-behavior:none;-webkit-app-region:no-drag;app-region:no-drag;scrollbar-gutter:stable;padding:12px 14px 6px;cursor:text}.banner{color:var(--muted, #8b949e);margin-bottom:8px}.banner .cmd{color:var(--accent, #58a6ff)}.banner .cmd:hover{text-decoration:underline}.line{white-space:pre-wrap;overflow-wrap:break-word}.cwd{color:var(--accent, #58a6ff)}.sigil{color:var(--muted, #8b949e);margin:0 6px 0 4px}.stdout,.stderr{margin:0 0 4px;font:inherit;white-space:pre-wrap;overflow-wrap:break-word}.stderr{color:var(--critical, #d8413a)}.form{flex:0 0 auto;display:flex;align-items:center;padding:8px 14px 10px;border-top:1px solid var(--border, #2c2c2c)}.form:focus-within{border-top-color:var(--accent, #58a6ff)}.form .cwd{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:none}.form .sigil{flex:0 0 auto;user-select:none}.input-wrap{flex:1 1 auto;min-width:0;position:relative;display:flex;align-items:center}.input{width:100%;background:transparent;border:none;outline:none;color:inherit;font:inherit;padding:0;position:relative}.ghost{position:absolute;inset:0;display:flex;align-items:center;font:inherit;white-space:pre;overflow:hidden;pointer-events:none;user-select:none;color:var(--muted, #8b949e);opacity:.55}.ghost-pad{color:transparent}
39
+ `;function wn(t){let r=["ls","find /",`grep -r ${xn(t)} .`];if(!t||t.size===0)return r;let n=null;for(let s of t.keys()){let i=bn(s);(n===null||i.length<n.length)&&(n=i)}return n&&r.push(`cat ${n} | head -n 20`),r}var K=["TODO","FIXME","XXX","HACK","NOTE","BUG","export","import","require","//"];function xn(t){if(!t||t.size===0)return K[0];for(let e of K)for(let r of t.values())if(r.includes(e))return e;return K[0]}function bn(t){return t.startsWith("./")?t.slice(2):t.startsWith("/")?t.slice(1):t}var Y=class t extends Q{static properties={sources:{attribute:!1},_lines:{state:!0},_input:{state:!0},_cwd:{state:!0},_ghost:{state:!0}};static styles=J(qt);#n=null;#c=null;#e=[];#t=-1;#s="";#r=null;#i=null;static#a=200;constructor(){super(),this.sources=null,this._lines=[],this._input="",this._cwd="/",this._ghost=""}willUpdate(e){e.has("sources")&&this.sources!==this.#c&&(this.#n=this.sources?It(this.sources):null,this._cwd=this.#n?this.#n.cwd():"/",this._lines=[{kind:"banner",commands:wn(this.sources)}],this.#e=[],this.#t=-1,this.#s="",this.#r=null,this._input="",this.#c=this.sources),e.has("_input")&&(this.#u(),this.#f())}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#l())}disconnectedCallback(){super.disconnectedCallback(),this.#u()}firstUpdated(){this.#o()}updated(e){(e.has("_lines")||e.has("sources"))&&this.#l()}#o(){let e=this.renderRoot.querySelector(".input");e&&e.focus()}#l(){let e=this.renderRoot.querySelector(".output");e&&(e.scrollTop=e.scrollHeight)}#h=e=>{if(e.preventDefault(),!this.#n)return;let r=this._input,n=r.trim();if(n==="clear"){this._lines=[],this._input="",n.length>0&&(this.#e=[...this.#e,r]),this.#t=-1;return}let s=this._cwd,i=this.#n.run(r);this._cwd=i.cwd;let o=[...this._lines,{kind:"prompt",cwd:s,text:r}];i.stdout&&o.push({kind:"stdout",text:i.stdout}),i.stderr&&o.push({kind:"stderr",text:i.stderr}),this._lines=o,n.length>0&&(this.#e=[...this.#e,r]),this.#t=-1,this._input=""};#d=e=>{if(e.key==="Tab"&&!e.shiftKey){e.preventDefault(),this.#p();return}this.#r=null,e.key==="ArrowUp"?(e.preventDefault(),this.#g()):e.key==="ArrowDown"&&(e.preventDefault(),this.#w()),this.#u(),this.#f()};#p(){if(!this.#n)return;let e=this.#r;if(e&&e.items[e.index]===this._input){e.index=(e.index+1)%e.items.length,this._input=e.items[e.index];return}let r=this.#n.complete(this._input);if(r.length===0){this.#r=null;return}this._input=r[0],this.#r=r.length>1?{items:r,index:0}:null}#u(){this._ghost="",this.#i!==null&&(clearTimeout(this.#i),this.#i=null)}#f(){this.#i=setTimeout(()=>{this.#i=null,this.#m()},t.#a)}#m(){if(!this.#n||this.#r)return;let e=this._input,r=e.slice(-1),n=e===""||r===" "||r==="|",s=/[\w./]/u.test(r);if(!n&&!s)return;let i=this.#n.complete(e);if(i.length===0)return;let o=i[0];!o.startsWith(e)||o===e||s&&i.includes(e)||(this._ghost=o.slice(e.length))}#g(){this.#e.length!==0&&(this.#t<0?(this.#s=this._input,this.#t=this.#e.length-1):this.#t=Math.max(0,this.#t-1),this._input=this.#e[this.#t])}#w(){if(this.#t<0)return;let e=this.#t+1;e>=this.#e.length?(this.#t=-1,this._input=this.#s,this.#s=""):(this.#t=e,this._input=this.#e[e])}#x=e=>{this._input=e.target.value};#b=e=>{this._input=e,this.#t=-1,this.#s="",this.#o()};#S=()=>{let e=this.renderRoot.getSelection?.()??document.getSelection();e&&!e.isCollapsed||this.#o()};render(){return C`<div class="output" @click="${this.#S}">${this._lines.map(e=>this.#v(e))}</div><form class="form" @submit="${this.#h}"><span class="cwd">${this._cwd}</span><span class="sigil">$</span><div class="input-wrap">${this._ghost?C`<div class="ghost" aria-hidden="true"><span class="ghost-pad">${this._input}</span>${this._ghost}</div>`:q} <input class="input" type="text" aria-label="Terminal command" autocomplete="off" autocapitalize="off" autocorrect="off" spellcheck="false" .value="${this._input}" @input="${this.#x}" @keydown="${this.#d}"></div></form>`}#v(e){return e.kind==="banner"?C`<div class="banner">Virtual shell over the bundle source tree. Try ${e.commands.map((r,n)=>C`${n>0?", ":""}\`<span class="cmd" @click="${()=>this.#b(r)}">${r}</span>\``)}. ↑/↓ for history, Tab to complete.</div>`:e.kind==="prompt"?C`<div class="line"><span class="cwd">${e.cwd}</span><span class="sigil">$</span>${e.text}</div>`:e.kind==="stdout"?C`<pre class="stdout">${e.text}</pre>`:e.kind==="stderr"?C`<pre class="stderr">${e.text}</pre>`:q}};customElements.define("bundle-terminal",Y);function vr(t,e){let r=document.createElement("bundle-terminal");return r.dataset.integrity=e??"",r.sources=t,r}export{vr as createTerminalElement};