Merge pull request #984 from tdurieux/feat/viewer-toc-pr-layout

feat(viewer): outlines for gists and Markdown, rebuilt pull request page
This commit is contained in:
Thomas Durieux authored and GitHub committed 2026-11-29 04:47:32 -08:00
commit de283d936a
26 files changed
+2095 -324

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
{
"core.min.js": "core.d23af1c652.min.js",
"vendor.min.js": "vendor.a28ff63e90.min.js",
"vendor.min.js": "vendor.375d384758.min.js",
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
"all.min.css": "all.55b8fff331.min.css",
"all.min.css": "all.38119ba6ea.min.css",
"markdown.min.js": "markdown.6c8dfb7b1d.min.js",
"pdf.min.js": "pdf.4d9cc6ff49.min.js",
"notebook.min.js": "notebook.c3144c18ae.min.js",
+1 -1
View File
@@ -6,4 +6,4 @@
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]){color:inherit;text-decoration:none}a:not([href]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-weight:500;line-height:1.2}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-unsLine truncated
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{contentLine truncated
*/.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{contentLine truncated
+263
View File
@@ -14823,6 +14823,269 @@ body.dark-mode .reviewer-preview .rp-preserved-tag { background: rgba(251, 191,
.repo-picker-list > .repo-picker-row { border-bottom: 0; border-top: 1px solid var(--border-soft, var(--border-color)); }
.repo-picker-list > .repo-picker-row:first-child { border-top: 0; }
/* ===== Round 19: outlines (Markdown, gists) and the pull request page ===== */
/* R19.1 Markdown outline: h1-h3 (a third level indents once more), redaction chips, and the
"On this page" menu from 768 to 1199px too, where the rail does not fit. */
.readme-toc a.lvl-4 { padding-left: 45px !important; font-size: 12.5px !important; }
.tb-toc-menu > button.tb-menu-toc.lvl-4 { padding-left: 48px !important; }
@media (min-width: 768px) and (max-width: 1199px) {
.tb-toc-m { display: inline-flex; }
.tb-toc-m .tb-menu { min-width: 280px; right: 0 !important; left: auto !important; }
}
/* R19.2 Reviewer pages with an outline: content + sticky rail (right for gists, left file list
for a pull request's changes); below 1100px the rail becomes a sticky "On this page" menu. */
.review-page .pr-page-inner { max-width: 1240px; }
.toc-layout { display: block; }
.page-toc { display: none; }
@media (min-width: 1100px) {
.toc-layout.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 40px; align-items: start; }
.toc-layout.has-toc.is-left { grid-template-columns: 264px minmax(0, 1fr); gap: 28px; }
.toc-layout.has-toc > .page-toc { display: block; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; padding: 16px 0 24px; }
.toc-layout.has-toc .toc-bar .toc-menu { display: none; }
}
.page-toc-head { font-size: 12.5px; font-weight: 600; color: var(--color); margin: 0 0 10px; }
.toc-rail { display: grid; border-left: 1px solid var(--border-color); font-size: 13px; }
.toc-rail a { display: block; margin-left: -1px; padding: 5px 8px 5px 13px; color: var(--ink-soft); text-decoration: none; line-height: 1.4; border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.toc-rail a:hover { color: var(--color); background: var(--hover-bg-color); box-shadow: inset 1px 0 0 var(--ink-muted); }
.toc-rail a.is-active { color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.toc-rail a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toc-rail .toc-file { display: grid; gap: 1px; padding-top: 7px; padding-bottom: 7px; }
.toc-rail .toc-file + .toc-file, .toc-rail .toc-heading + .toc-file { margin-top: 2px; }
.toc-file-name { font-weight: 500; color: var(--color); }
.toc-file.is-current .toc-file-name, .toc-file.is-active .toc-file-name { font-weight: 600; }
.toc-file.is-active .toc-file-name { color: var(--accent); }
.toc-file-meta { font-size: 12px; color: var(--ink-muted); }
.toc-rail .toc-heading { font-size: 12.5px; padding-top: 3px; padding-bottom: 3px; padding-left: 25px; }
.toc-rail .toc-heading.depth-1 { padding-left: 37px; }
.toc-rail .toc-heading.depth-2 { padding-left: 49px; color: var(--ink-muted); }
.toc-rail .toc-heading.is-active { color: var(--accent); }
.toc-bar { display: flex; align-items: center; gap: 12px; min-height: 0; }
.toc-menu { position: relative; min-width: 0; }
.toc-menu-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px; padding: 0 10px !important; border: 1px solid var(--border-color) !important; border-radius: var(--radius-control, 8px) !important; background: var(--paper-card) !important; color: var(--color) !important; font-size: 13px !important; font-weight: 500; }
.toc-menu-btn.is-on { border-color: var(--accent) !important; }
.toc-menu-label { flex-shrink: 0; }
.toc-menu-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-weight: 400; }
.toc-menu-current::before { content: "·"; margin-right: 8px; }
.toc-menu-chevron { flex-shrink: 0; width: 14px; height: 14px; color: var(--ink-muted); }
.toc-menu-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: min(340px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow: auto; padding: 8px 8px 8px 0; border: 1px solid var(--border-color); border-left-width: 1px; border-radius: 10px; background: var(--paper-card); box-shadow: var(--card-shadow); }
.toc-menu-pop a { text-align: left; border-radius: 0 6px 6px 0; padding-top: 9px !important; padding-bottom: 9px !important; }
.toc-rail { text-align: left; justify-items: stretch; }
.toc-menu-pop.toc-rail { border-left: 1px solid var(--border-color); }
@media (max-width: 1099px) {
.toc-layout.has-toc .toc-bar { position: sticky; top: 0; z-index: 30; margin: 0 -4px 12px; padding: 10px 4px; background: var(--canvas-bg-color); }
}
/* R19.3 Gist files: one card per file, headings sized for reading inside a card. */
.gist-file-card { margin: 0 0 20px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--paper-card); scroll-margin-top: 72px; overflow: hidden; }
.toc-layout:not(.has-toc) .toc-main, .toc-layout .toc-main { min-width: 0; padding-top: 16px; }
.gist-file-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border-color); background: var(--paper-bg-alt); }
.gist-file-head > .ui-icon { color: var(--ink-muted); flex-shrink: 0; }
.gist-file-name { flex: 1 1 auto; min-width: 0; margin: 0; font: 600 14px/1.4 var(--font-mono); color: var(--color); overflow-wrap: anywhere; }
.gist-file-meta { flex-shrink: 0; font-size: 12.5px; color: var(--ink-muted); }
.gist-file-meta .sep { margin: 0 6px; }
.gist-file-body { padding: 0; }
.gist-file-body pre { margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
.gist-file-body.is-markdown { padding: 8px 28px 24px; }
.gist-file-body .markdown-body { font-size: 15px; line-height: 1.65; }
.gist-file-body .markdown-body h1, .gist-file-body .markdown-body h2, .gist-file-body .markdown-body h3 { scroll-margin-top: 72px; border-bottom: 0 !important; padding-bottom: 0 !important; }
.gist-file-body .markdown-body h1 { font-size: 26px !important; margin: 20px 0 10px !important; font-weight: 600; letter-spacing: -.01em; }
.gist-file-body .markdown-body h2 { font-size: 20px !important; margin: 32px 0 8px !important; font-weight: 600; }
.gist-file-body .markdown-body h3 { font-size: 16px !important; margin: 22px 0 6px !important; font-weight: 600; }
@media (max-width: 767px) {
.gist-file-body.is-markdown { padding: 4px 16px 18px; }
.gist-file-head { padding: 10px 12px; }
}
/* R19.4 Pull request header: state chip, "who merges what into where", quiet meta line. */
.review-page .pr-title { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 4px 0 12px; }
.pr-state-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 10px; }
.pr-state { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #fff; background: #2F6B3E; }
.pr-state .ui-icon { width: 15px; height: 15px; }
.pr-state.is-merged { background: #6E4FA3; }
.pr-state.is-closed { background: var(--status-error); }
.pr-state.is-draft { background: var(--ink-muted); }
.dark-mode .pr-state { color: #161412; background: #7FC48F; }
.dark-mode .pr-state.is-merged { background: #B9A2E0; }
.dark-mode .pr-state.is-closed { background: var(--status-error); }
.dark-mode .pr-state.is-draft { background: var(--ink-muted); }
.pr-summary { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.6; min-width: 0; }
.pr-summary-author { font-weight: 600; color: var(--color); }
.pr-branch { padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 500 12.5px/1.4 var(--font-mono); overflow-wrap: anywhere; }
.review-page .pr-header-meta { font-family: var(--font-sans); font-size: 12.5px; gap: 6px 16px; }
.review-page .pr-header-meta .ui-icon { width: 14px; height: 14px; }
.pr-tabs { align-items: center; margin-top: 8px; }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--paper-bg-alt); border: 1px solid var(--border-color); font-size: 12px; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.paper-tab.active .tab-count { color: var(--color); }
.pr-tabs-stat { margin-left: auto; display: inline-flex; gap: 8px; padding: 0 4px; font: 600 13px/1 var(--font-mono); }
.stat-add { color: #2F6B3E; font-variant-numeric: tabular-nums; }
.stat-del { color: var(--status-error); font-variant-numeric: tabular-nums; }
.dark-mode .stat-add { color: #8FD19E; }
/* R19.5 Conversation: description, comments and review threads as one timeline. */
.pr-timeline { list-style: none; margin: 20px 0 0; padding: 0 0 0 0; display: grid; gap: 16px; position: relative; max-width: 880px; }
.pr-timeline-item { position: relative; }
.pr-avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--paper-bg-alt); border: 1px solid var(--border-color); color: var(--ink-muted); flex-shrink: 0; }
.pr-avatar .ui-icon { width: 13px; height: 13px; }
.pr-comment-action { color: var(--ink-muted); }
.pr-thread-body .markdown-body { font-size: inherit; }
.pr-thread-body .markdown-body h1, .pr-thread-body .markdown-body h2 { font-size: 17px !important; margin: 18px 0 6px !important; border: 0 !important; padding: 0 !important; font-weight: 600; }
.pr-thread-body .markdown-body h3 { font-size: 15px !important; margin: 14px 0 4px !important; }
.pr-thread-body .markdown-body > :first-child { margin-top: 0 !important; }
.pr-thread-body .markdown-body > :last-child { margin-bottom: 0 !important; }
.pr-timeline-item.is-description .pr-thread { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-color)); }
.pr-review-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px 2px; font-size: 13px; color: var(--ink-muted); }
.pr-review-head .ui-icon { width: 14px; height: 14px; }
.pr-review-file { padding: 0; border: 0; background: none; color: var(--link-color); font: 500 12.5px/1.4 var(--font-mono); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pr-review-file:hover { color: var(--link-hover-color); }
.pr-comments .pr-timeline-item { list-style: none; margin-bottom: 14px; }
@media (max-width: 767px) {
}
/* R19.6 Commits: grouped by day, numbered (no SHAs: they identify the repository). */
.pr-commit-group { margin: 20px 0 0; max-width: 880px; }
.pr-commit-day { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 500 13px/1.4 var(--font-sans); color: var(--ink-muted); }
.pr-commit-day .ui-icon { width: 15px; height: 15px; }
.pr-commit-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-color); border-radius: 10px; background: var(--paper-card); overflow: hidden; }
.pr-commit { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 16px; }
.pr-commit + .pr-commit { border-top: 1px solid var(--border-color); }
.pr-commit-index { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); background: var(--paper-bg-alt); border: 1px solid var(--border-color); font-variant-numeric: tabular-nums; }
.pr-commit-headline { margin: 2px 0 0; font-size: 14.5px; font-weight: 500; color: var(--color); overflow-wrap: anywhere; }
.pr-commit-detail { margin: 4px 0 0; font-size: 13px; color: var(--ink-muted); white-space: pre-line; }
.pr-commit-author { font-size: 13px; color: var(--ink-soft); white-space: nowrap; padding-top: 3px; }
@media (max-width: 767px) {
.pr-commit { grid-template-columns: 24px minmax(0, 1fr); padding: 12px; }
.pr-commit-author { grid-column: 2; padding-top: 0; }
}
/* R19.7 Files changed: file list, per-file collapse, +/- counts and bars, inline review threads. */
.pr-files-bar { justify-content: flex-start; flex-wrap: wrap; padding: 0 0 12px; }
.pr-files-summary { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); }
.pr-files-summary .stat-add, .pr-files-summary .stat-del { font: 600 12.5px/1 var(--font-mono); }
.pr-collapse-all { margin-left: auto; min-height: 32px; font-size: 13px !important; }
@media (min-width: 1100px) { .toc-layout.has-toc .pr-files-bar .toc-menu { display: none; } }
@media (max-width: 1099px) { .toc-layout.has-toc .pr-files-summary { display: none; } }
.pr-file-toc .toc-rail { border-left: 0; }
.toc-diff-file { display: grid !important; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; border-radius: 6px !important; padding: 6px 8px !important; margin-left: 0 !important; }
.toc-diff-file.is-active { background: var(--accent-soft); box-shadow: none !important; }
.toc-diff-file.is-active .toc-file-name { color: var(--color); }
.toc-diff-file .toc-file-name { font: 500 12.5px/1.45 var(--font-mono); overflow-wrap: anywhere; }
.toc-file-dir { color: var(--ink-muted); font-weight: 400; }
.toc-file-stat { display: inline-flex; gap: 6px; font: 600 11.5px/1 var(--font-mono); }
.diff-status-dot { width: 8px; height: 8px; border-radius: 2px; align-self: center; background: var(--ink-muted); }
.diff-status-dot.is-added { background: #2F6B3E; }
.diff-status-dot.is-deleted { background: var(--status-error); }
.diff-status-dot.is-renamed { background: var(--status-progress); }
.dark-mode .diff-status-dot.is-added { background: #8FD19E; }
.review-page .diff-file-block { margin: 0 0 16px; scroll-margin-top: 72px; overflow: visible; }
.review-page .diff-file-header { position: sticky; top: 0; z-index: 5; gap: 10px; padding: 8px 12px 8px 6px; border-radius: 10px 10px 0 0; font-family: var(--font-sans); }
.review-page .diff-file-block.is-collapsed .diff-file-header { border-bottom: 0; border-radius: 10px; }
.diff-file-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-muted); cursor: pointer; }
.diff-file-toggle:hover { background: var(--hover-bg-color); color: var(--color); }
.diff-file-toggle .ui-icon { width: 16px; height: 16px; transition: transform .15s ease; }
.is-collapsed .diff-file-toggle .ui-icon { transform: rotate(-90deg); }
.review-page .diff-file-name { font: 600 13px/1.4 var(--font-mono); white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.diff-file-dir { color: var(--ink-muted); font-weight: 400; }
.diff-file-threads { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: 12px; color: var(--ink-soft); }
.diff-file-threads .ui-icon { width: 13px; height: 13px; }
.diff-file-stat { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; font: 600 12px/1 var(--font-mono); }
.diff-bar { display: inline-flex; gap: 2px; }
.diff-bar i { width: 8px; height: 8px; border-radius: 2px; background: var(--border-color); }
.diff-bar i.is-add { background: #3F8A52; }
.diff-bar i.is-del { background: var(--status-error); }
.dark-mode .diff-bar i.is-add { background: #8FD19E; }
.diff-file-body { overflow-x: auto; border-radius: 0 0 10px 10px; }
.review-page .diff-file-table .diff-code { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: calc(10px + var(--hang, 4ch)); text-indent: calc(-1 * var(--hang, 4ch)); }
.diff-loose-threads { padding: 12px; border-top: 1px solid var(--border-color); background: var(--paper-bg-alt); display: grid; gap: 12px; }
@media (max-width: 767px) {
.pr-tabs-stat { display: none; }
.review-page .diff-file-header { flex-wrap: wrap; row-gap: 2px; }
.review-page .diff-file-name { flex-basis: calc(100% - 40px); }
.diff-bar { display: none; }
.review-page .paper-tabs .paper-tab { padding: 10px 10px; gap: 6px; font-size: 13.5px; }
.review-page .paper-tabs .paper-tab > .ui-icon { display: none; }
.pr-collapse-all { margin-left: 0; }
}
.gist-file-body pre { overflow-x: auto; }
.review-page .pr-header-meta .paper-pill { font-family: var(--font-sans); }
@media (max-width: 767px) { .pr-tabs .tab-long { display: none; } }
@media (max-width: 767px) { .pr-comment-action { display: none; } }
.gist-file-body pre { padding: 14px 18px !important; background: var(--paper-bg-alt) !important; line-height: 1.6 !important; font-size: 13px !important; }
.toc-bar .toc-menu .btn.toc-menu-btn { border: 1px solid var(--border-color) !important; background: var(--paper-card) !important; }
.toc-bar .toc-menu .btn.toc-menu-btn.is-on { border-color: var(--accent) !important; }
.diff-file-meta { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
@media (max-width: 767px) {
.review-page .diff-file-name { flex-basis: calc(100% - 40px); }
.diff-file-meta { margin-left: 34px; }
.diff-file-stat { margin-left: 0; }
.review-page .diff-file-table .diff-gutter { width: 30px; padding: 0 4px; font-size: 11px; }
.review-page .diff-file-table .diff-sign { width: 14px; padding: 0 2px; }
.review-page .diff-file-table .diff-code { word-break: break-all; padding-left: calc(6px + var(--hang, 4ch)); }
}
/* ===== Round 20: review feedback on #984 ===== */
/* R20.1 Threads like GitHub's: one container, comments stacked with a rule between
them, replies at the first comment's indent; a 20px avatar, author and date row. */
.pr-thread { border: 1px solid var(--border-color); border-radius: 8px; background: var(--paper-card); overflow: hidden; }
.pr-thread-comment { padding: 12px 16px 14px; }
.pr-thread-comment + .pr-thread-comment { border-top: 1px solid var(--border-color); }
.pr-thread-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 20px; margin: 0 0 6px; font: 400 13px/20px var(--font-sans); }
.pr-thread-head .pr-avatar { width: 20px; height: 20px; }
.pr-thread-head .pr-avatar .ui-icon { width: 12px; height: 12px; }
.pr-thread-head .pr-comment-action { color: var(--ink-muted); }
.pr-thread-date { color: var(--ink-muted); font-size: 12.5px; }
.pr-thread-date::before { content: "·"; margin-right: 8px; }
.pr-thread-body { padding-left: 28px; font-size: 14px; line-height: 1.6; color: var(--color); }
.pr-thread-body .markdown-body { font-size: inherit; }
.diff-thread-row > td { padding: 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); background: var(--paper-bg-alt); font-family: var(--font-sans); white-space: normal; }
.review-page .diff-file-table .diff-thread-row > .diff-thread-gutter { border-right: 1px solid var(--border-color); }
.review-page .diff-file-table .diff-thread-row > .diff-thread-cell { padding: 10px 12px 10px 10px; text-indent: 0; }
.diff-loose-threads .pr-thread, .pr-timeline .pr-thread { width: 100%; }
@media (max-width: 767px) {
.pr-thread-comment { padding: 10px 12px 12px; }
.pr-thread-body { padding-left: 0; }
.review-page .diff-file-table .diff-thread-row > .diff-thread-cell { padding: 8px 8px 8px 6px; }
}
/* R20.2 An author is one unit: "@name", or a redacted login's slot alone, centred on the
avatar and date row. */
.pr-author { display: inline-flex; align-items: center; gap: 0; font-weight: 600; color: var(--color); white-space: nowrap; }
.pr-author.is-hidden { font-weight: 500; color: var(--ink-muted); }
.pr-thread-head .pr-author .redact-slot, .pr-header-meta .pr-author .redact-slot { vertical-align: middle !important; margin: 0 !important; }
.pr-summary .pr-author, .pr-commit-author.pr-author { display: inline; }
/* R20.3 Slots outside rendered Markdown use the explorer's slot (.redact-slot) and sit like
the slots in Markdown running text (vertical-align .04em), at the text's size. */
.review-page .redact-slot, .readme-toc .redact-slot, .tb-menu-toc .redact-slot, .page-toc .redact-slot, .toc-menu .redact-slot { vertical-align: .04em !important; }
.diff-code .redact-slot { text-indent: 0; }
/* R20.4 PR and gist tabs: the shared indicator (#949). No 2px transparent border, so the
line overlaps the bar's rule instead of floating 2px above it. The line spans the label and its
count: --tab-inset equals the tab's side padding, and tabs reach the bar's rule. */
.review-page .paper-tabs { align-items: stretch; }
.review-page .paper-tabs .paper-tab { padding-left: 16px; padding-right: 16px; --tab-inset: 16px; border-bottom: 0 !important; }
.review-page .pr-tabs-stat { align-self: center; }
@media (max-width: 767px) {
.review-page .paper-tabs .paper-tab { padding-left: 10px; padding-right: 10px; --tab-inset: 10px; }
}
/* R20.5 Gist files: view toggle and Raw / copy / download, like the explorer's file bar. */
.gist-file-head { flex-wrap: wrap; row-gap: 8px; }
.gist-file-tools { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.gist-file-tools .seg-filter { padding: 2px; }
.gist-file-tools .seg-chip { height: 26px; padding: 0 10px; font-size: 12.5px; }
.gist-file-tools .tb-file { margin-left: 0 !important; }
.gist-file-head .gist-file-meta { order: 0; }
.gist-file-body.is-csv .csv-table-wrap { max-height: 520px; border: 0; border-radius: 0; }
.gist-file-body.is-image .media-stage, .gist-file-body.is-svg .media-stage, .gist-file-body.is-video .media-stage, .gist-file-body.is-audio .media-stage { min-height: 0; padding: 24px; }
.gist-file-body.is-notebook .notebook-body { padding: 12px 20px 20px; }
.gist-file-body .file-state { padding: 36px 20px; }
.gist-file-body .pdf-viewer, .gist-file-body pdfviewer { display: block; max-height: 720px; overflow: auto; }
@media (max-width: 767px) {
.gist-file-tools { width: 100%; margin-left: 0; justify-content: space-between; }
}
/* ===== Round 19: workspace polish ===== */
/* R19.1 Lists keep their tab bar while they load. The first load holds the tab
row with placeholders; a reload keeps the tabs, counts and current rows,
+72 -25
View File
@@ -1,4 +1,4 @@
<div class="pr-page">
<div class="pr-page review-page">
<div class="container paper-page pr-page-inner">
<div class="paper-crumbs">
<a href="/dashboard">Reviewer</a> &nbsp;/&nbsp;
@@ -8,7 +8,7 @@
<header class="pr-header">
<div class="pr-title-row">
<h1 class="paper-page-title pr-title">
<span v-if="details?.description" v-text="details?.description"></span>
<span v-if="details?.description"><template v-for="(seg, si) in redactParts(details.description)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
<span class="text-muted" v-if="!details?.description">Untitled gist</span>
</h1>
<a class="btn btn-sm" aria-label="Edit" v-if="options?.isAdmin || options?.isOwner" :href="safeUrl(&quot;/gist-anonymize/&quot; + (gistId))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-edit"></use></svg><span class="d-none d-md-inline"> Edit</span></a>
@@ -18,7 +18,7 @@
{{ details?.isPublic ? 'Public' : 'Secret' }}
</span>
<span class="pr-meta-item" v-if="details?.ownerLogin">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-user"></use></svg> @<span v-text="details?.ownerLogin"></span>
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-user"></use></svg> <span class="pr-author" :class="{ 'is-redacted': isRedactedName(details.ownerLogin) }"><template v-if="!isRedactedName(details.ownerLogin)">@</template><template v-for="(seg, si) in redactParts(details.ownerLogin)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
</span>
<span class="pr-meta-item" v-if="details?.updatedDate">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-clock"></use></svg> <span v-text="fmt?.date(details?.updatedDate)"></span>
@@ -42,33 +42,80 @@
<div class="paper-tab-content">
<div role="tabpanel" id="gist-files-panel" aria-labelledby="gist-files-tab" v-if="details?.files &amp;&amp; tabState?.active ==&#x27;files&#x27;">
<ul class="pr-comments">
<li class="pr-comment" v-for="(file, index) in details?.files">
<div class="pr-comment-head">
<strong v-text="file?.filename"></strong>
<span class="pr-comment-date" v-if="file?.language">{{ file?.language }}</span>
<div class="toc-layout" :class="{ 'has-toc': showGistToc() }">
<div class="toc-main">
<div class="toc-bar" v-if="showGistToc()">
<div class="toc-menu">
<button type="button" class="btn btn-sm btn-ghost toc-menu-btn" :class="{ 'is-on': tocOpen }" aria-haspopup="true" :aria-expanded="tocOpen ? 'true' : 'false'" @click.stop="tocOpen = !tocOpen"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-outline"></use></svg><span class="toc-menu-label">In this gist</span><span class="toc-menu-current" v-if="gistToc()[activeFileIndex()]"><template v-for="(seg, si) in gistToc()[activeFileIndex()].parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><svg class="ui-icon toc-menu-chevron" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
<nav class="toc-menu-pop toc-rail" v-if="tocOpen" aria-label="In this gist"><template v-for="f in gistToc()" :key="f.id"><a :href="'#' + f.id" class="toc-file" :class="{ 'is-current': activeFileIndex() === f.index, 'is-active': activeFileIndex() === f.index &amp;&amp; !f.headings.some(h => h.id === activeAnchor) }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToAnchor(f.id)"><span class="toc-file-name"><template v-for="(seg, si) in f.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-meta">{{ f.language }} · {{ f.lines != null ? fmt.plural(f.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(f.size || 0) }}</span></a><a v-for="h in f.headings" :key="h.id" :href="'#' + h.id" :class="['toc-heading', 'depth-' + h.depth, { 'is-active': activeAnchor === h.id }]" :aria-current="activeAnchor === h.id ? 'location' : null" @click.prevent="jumpToAnchor(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></template></nav>
</div>
</div>
<gist-file :file="file"></gist-file>
</li>
<li class="paper-table-empty" v-if="!details?.files?.length">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<span>No files in this gist.</span>
</li>
</ul>
<section class="gist-file-card" v-for="(file, index) in details?.files" :key="index" :id="gistFileId(index)" :aria-labelledby="gistFileId(index) + '-name'">
<header class="gist-file-head">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<h2 class="gist-file-name" :id="gistFileId(index) + '-name'"><template v-for="(seg, si) in redactParts(file?.filename)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></h2>
<span class="gist-file-meta">{{ gistToc()[index]?.language }}<span class="sep">·</span>{{ gistToc()[index]?.lines != null ? fmt.plural(gistToc()[index]?.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(file?.size || 0) }}</span>
<div class="gist-file-tools">
<div class="seg-filter gist-view-toggle" role="radiogroup" :aria-label="'View of ' + file?.filename" v-if="gistHasRendered(index)"><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'rendered' }" :aria-checked="gistView(index) === 'rendered' ? 'true' : 'false'" @click="setGistView(index, 'rendered')">{{ gistKind(index) === 'csv' ? 'Table' : 'Preview' }}</button><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'raw' }" :aria-checked="gistView(index) === 'raw' ? 'true' : 'false'" @click="setGistView(index, 'raw')">Source</button></div>
<div class="tb-file gist-file-actions" role="group" aria-label="File actions" v-if="!['too-large', 'hidden', 'empty', 'binary'].includes(gistKind(index))">
<a class="tb-seg-btn" :href="safeUrl(gistRawUrl(file))" target="_blank" rel="noopener" :title="file?.encoding === 'base64' ? 'Open the file' : 'Open the raw file'">Raw</a>
<button type="button" class="tb-seg-btn tb-seg-icon" v-if="file?.encoding !== 'base64'" :aria-label="gistCopied === index ? 'Copied' : 'Copy file contents'" :title="gistCopied === index ? 'Copied' : 'Copy file contents'" @click="copyGistFile(index)"><svg class="ui-icon" aria-hidden="true"><use :href="gistCopied === index ? '#ui-icon-check' : '#project-icon-copy'"></use></svg></button>
<a class="tb-seg-btn tb-seg-icon" :href="safeUrl(gistRawUrl(file))" :download="file?.filename" aria-label="Download file" title="Download file"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-download"></use></svg></a>
</div>
</div>
</header>
<div class="gist-file-body" :class="'is-' + (gistView(index) === 'raw' &amp;&amp; gistHasRendered(index) ? 'code' : gistKind(index))">
<gist-file v-if="gistKind(index) === 'markdown' &amp;&amp; gistView(index) === 'rendered'" :file="file" :reader="true" :id-prefix="gistFileId(index) + '-'" @outline="setFileOutline(index, $event)"></gist-file>
<gist-file v-else-if="gistKind(index) === 'code' || (gistHasRendered(index) &amp;&amp; gistView(index) === 'raw')" :file="gistSourceFile(index)" :reader="true"></gist-file>
<div class="notebook-body" v-else-if="gistKind(index) === 'notebook'"><notebook class="markdown-body" :content="file.content"></notebook></div>
<div class="csv-table-wrap" v-else-if="gistKind(index) === 'csv'" tabindex="0" role="region" :aria-label="'Table view of ' + file?.filename">
<table class="csv-table">
<thead><tr><th class="csv-rownum" scope="col"><span class="sr-only">Row</span></th><th scope="col" v-for="(cell, ci) in (gistCsvRows(file)[0] || [])" :key="ci" :class="{ 'is-num': gistCsvNumeric(file, ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></th></tr></thead>
<tbody><tr v-for="(row, ri) in gistCsvRows(file).slice(1)" :key="ri"><td class="csv-rownum">{{ ri + 1 }}</td><td v-for="(cell, ci) in row" :key="ci" :class="{ 'is-num': gistCsvNumeric(file, ci) }"><template v-for="(seg, si) in redactParts(cell)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></td></tr></tbody>
</table>
</div>
<div class="media-stage" v-else-if="gistKind(index) === 'image' || gistKind(index) === 'svg'"><img class="image-content" :src="safeUrl(gistMediaUrl(file))" :alt="file?.filename"></div>
<div class="media-stage" v-else-if="gistKind(index) === 'video'"><video class="video-content" controls preload="metadata" playsinline :src="safeUrl(gistMediaUrl(file))"></video></div>
<div class="media-stage is-audio" v-else-if="gistKind(index) === 'audio'"><audio controls preload="metadata" :src="safeUrl(gistMediaUrl(file))"></audio></div>
<pdfviewer v-else-if="gistKind(index) === 'pdf'" :src="safeUrl(gistMediaUrl(file))"></pdfviewer>
<div class="file-state" v-else-if="gistKind(index) === 'binary'">
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<h3 class="file-state-title">This file isn't shared</h3>
<p class="file-state-msg">Binary files other than images can carry author details that anonymization can't remove, so anonymized gists don't include them.</p>
</div>
<div class="file-state" v-else-if="gistKind(index) === 'too-large'" role="note">
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#ui-icon-warning"></use></svg>
<h3 class="file-state-title">This file is too large to preview</h3>
<p class="file-state-msg">It is over the size limit for anonymized gist files, so it can't be shown or downloaded from this link.</p>
</div>
<div class="file-state" v-else-if="gistKind(index) === 'hidden'" role="note">
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<h3 class="file-state-title">Image not shown</h3>
<p class="file-state-msg">The author chose not to display images in this anonymized gist.</p>
</div>
<div class="file-state" v-else>
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<h3 class="file-state-title">This file is empty</h3>
<p class="file-state-msg">It has no content in this snapshot.</p>
</div>
</div>
</section>
<div class="paper-table-empty" v-if="!details?.files?.length">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
<span>No files in this gist.</span>
</div>
</div>
<aside class="page-toc" v-if="showGistToc()" aria-label="In this gist">
<div class="page-toc-head">In this gist</div>
<nav class="toc-rail"><template v-for="f in gistToc()" :key="f.id"><a :href="'#' + f.id" class="toc-file" :class="{ 'is-current': activeFileIndex() === f.index, 'is-active': activeFileIndex() === f.index &amp;&amp; !f.headings.some(h => h.id === activeAnchor) }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToAnchor(f.id)"><span class="toc-file-name"><template v-for="(seg, si) in f.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-meta">{{ f.language }} · {{ f.lines != null ? fmt.plural(f.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(f.size || 0) }}</span></a><a v-for="h in f.headings" :key="h.id" :href="'#' + h.id" :class="['toc-heading', 'depth-' + h.depth, { 'is-active': activeAnchor === h.id }]" :aria-current="activeAnchor === h.id ? 'location' : null" @click.prevent="jumpToAnchor(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></template></nav>
</aside>
</div>
</div>
<div role="tabpanel" id="gist-comments-panel" aria-labelledby="gist-comments-tab" v-if="details?.comments &amp;&amp; tabState?.active ==&#x27;comments&#x27;">
<ul class="pr-comments">
<li class="pr-comment" v-for="(comment, index) in details?.comments">
<div class="pr-comment-head">
<span class="pr-comment-author" v-if="comment?.author">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-user"></use></svg> @<span v-text="comment?.author"></span>
</span>
<span class="pr-comment-date" v-if="comment?.updatedDate" v-text="fmt?.date(comment?.updatedDate)"></span>
</div>
<div class="pr-comment-body" v-if="comment?.body">
<markdown :content="comment?.body"></markdown>
</div>
<li class="pr-timeline-item" v-for="(comment, index) in details?.comments" :key="index">
<pr-thread :comments="[comment]" :fmt="fmt"></pr-thread>
</li>
<li class="paper-table-empty" v-if="!details?.comments?.length">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>
+3
View File
@@ -59,6 +59,9 @@
<symbol id="ui-icon-outline" viewBox="0 0 24 24"><path d="M4 6h16M8 12h12M8 18h12M4 12h.01M4 18h.01"/></symbol>
<symbol id="ui-icon-list" viewBox="0 0 24 24"><path d="M9 5h12M9 12h12M9 19h12m-18-14 1 1 2-2m-3 8 1 1 2-2m-3 8 1 1 2-2"/></symbol>
<symbol id="ui-icon-bug" viewBox="0 0 24 24"><rect x="7" y="7" width="10" height="14" rx="5"/><path d="M9 7V5a3 3 0 0 1 6 0v2M12 7v14M3 8l4 2m-4 5h4m-4 7 4-4M21 8l-4 2m4 5h-4m4 7-4-4"/></symbol>
<symbol id="ui-icon-chevron-down" viewBox="0 0 24 24"><path d="m5 9 7 7 7-7"/></symbol>
<symbol id="ui-icon-commit" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3.5"/><path d="M2.5 12h6M15.5 12h6"/></symbol>
<symbol id="ui-icon-branch" viewBox="0 0 24 24"><circle cx="6" cy="5" r="2.2"/><circle cx="6" cy="19" r="2.2"/><circle cx="18" cy="7" r="2.2"/><path d="M6 7.2v9.6M18 9.2c0 5-12 3-12 7.6"/></symbol>
<symbol id="ui-icon-chevron-left" viewBox="0 0 24 24"><path d="m15 5-7 7 7 7"/></symbol>
<symbol id="ui-icon-chevron-right" viewBox="0 0 24 24"><path d="m9 5 7 7-7 7"/></symbol>
<symbol id="ui-icon-download" viewBox="0 0 24 24"><path d="M12 3v12m-5-5 5 5 5-5M3 16v5h18v-5"/></symbol>

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

+5 -5
View File
@@ -54,12 +54,12 @@
<a :target="preview ? '_blank' : '_self'" class="tb-seg-btn tb-seg-icon" aria-label="Download file" title="Download file" :href="safeUrl(downloadUrl())" :download="preview ? paths[paths.length - 1] : null"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-download"></use></svg></a>
</div>
<button type="button" class="btn btn-sm btn-icon-only btn-ghost tb-copy-m" v-if="typeof content === 'string'" :aria-label="contentCopied ? 'Copied' : 'Copy file contents'" @click="copyContent()"><svg class="ui-icon" aria-hidden="true"><use :href="contentCopied ? '#ui-icon-check' : '#project-icon-copy'"></use></svg></button>
<div class="tb-toc-m" v-if="type == 'html' &amp;&amp; readmeToc().length &gt;= 3">
<div class="tb-toc-m" v-if="type == 'html' &amp;&amp; tocCount() &gt;= 3">
<button type="button" class="btn btn-sm btn-icon-only btn-ghost tb-toc-btn" :class="{ 'is-on': tocOpen }" aria-label="On this page" title="On this page" aria-haspopup="true" :aria-expanded="tocOpen ? 'true' : 'false'" @click.stop="tocOpen = !tocOpen; moreOpen = false"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-outline"></use></svg></button>
<div class="tb-menu tb-toc-menu" v-if="tocOpen" role="menu" @click="tocOpen = false">
<div class="tb-menu-label">On this page</div>
<button type="button" role="menuitem" :class="['tb-menu-toc', 'lvl-2', { 'is-active': !activeHeading }]" @click="scrollToHeading(null)">Introduction</button>
<button type="button" role="menuitem" v-for="h in readmeToc()" :key="'m-' + h.id" :class="['tb-menu-toc', 'lvl-' + h.level, { 'is-active': activeHeading === h.id }]" @click="scrollToHeading(h.id)">{{ h.text }}</button>
<button type="button" role="menuitem" :class="['tb-menu-toc', 'lvl-2', 'toc-title', { 'is-active': !activeHeading || activeHeading === tocTitle()?.id }]" @click="scrollToHeading(null)"><template v-if="tocTitle()"><template v-for="(seg, si) in tocTitle().parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></template><template v-else>Introduction</template></button>
<button type="button" role="menuitem" v-for="h in readmeToc()" :key="'m-' + h.id" :class="['tb-menu-toc', 'lvl-' + (h.depth + 2), { 'is-active': activeHeading === h.id }]" :aria-current="activeHeading === h.id ? 'location' : null" @click="scrollToHeading(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></button>
</div>
</div>
<div class="tb-more">
@@ -110,9 +110,9 @@
</div>
<div class="reading-layout" v-if="type == 'html'">
<div class="file-content markdown-body" v-html="renderReadme(sanitize(content))"></div>
<aside class="readme-toc" v-if="readmeToc().length &gt;= 3" aria-label="On this page">
<aside class="readme-toc" v-if="tocCount() &gt;= 3" aria-label="On this page">
<div class="readme-toc-head">On this page</div>
<nav class="toc-rail"><a href="#" class="lvl-2 toc-top" :class="{ 'is-active': !activeHeading }" @click.prevent="scrollToHeading(null)">Introduction</a><a v-for="(h, i) in readmeToc()" :key="h.id" :href="'#' + h.id" :class="['lvl-' + h.level, { 'is-active': activeHeading === h.id }]" @click.prevent="scrollToHeading(h.id)">{{ h.text }}</a></nav>
<nav class="toc-rail"><a href="#" class="lvl-2 toc-top" :class="{ 'is-active': !activeHeading || activeHeading === tocTitle()?.id }" @click.prevent="scrollToHeading(null)"><template v-if="tocTitle()"><template v-for="(seg, si) in tocTitle().parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></template><template v-else>Introduction</template></a><a v-for="(h, i) in readmeToc()" :key="h.id" :href="'#' + h.id" :class="['lvl-' + (h.depth + 2), { 'is-active': activeHeading === h.id }]" :aria-current="activeHeading === h.id ? 'location' : null" @click.prevent="scrollToHeading(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></nav>
</aside>
</div>
</section>
+106 -49
View File
@@ -1,4 +1,4 @@
<div class="pr-page">
<div class="pr-page review-page">
<div class="container paper-page pr-page-inner">
<div class="paper-crumbs">
<a href="/dashboard">Reviewer</a> &nbsp;/&nbsp;
@@ -7,67 +7,124 @@
<header class="pr-header">
<div class="pr-title-row">
<h1 class="paper-page-title pr-title">
<span v-if="details?.title" v-text="details?.title"></span>
<span class="text-muted" v-if="!details?.title">Untitled pull request</span>
</h1>
<h1 class="paper-page-title pr-title">
<span v-if="details?.title"><template v-for="(seg, si) in redactParts(details.title)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
<span class="text-muted" v-if="details &amp;&amp; !details?.title">Untitled pull request</span>
</h1>
<a class="btn btn-sm" aria-label="Edit" v-if="options?.isAdmin || options?.isOwner" :href="safeUrl(&quot;/pull-request-anonymize/&quot; + (pullRequestId))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-edit"></use></svg><span class="d-none d-md-inline"> Edit</span></a>
</div>
<div class="pr-header-meta">
<span class="paper-pill" :class="{&#x27;good&#x27;: details?.merged, &#x27;warn&#x27;: details?.state == &#x27;open&#x27;, &#x27;bad&#x27;: details?.state == &#x27;closed&#x27; &amp;&amp; !details?.merged}">
<span class="status-dot" :class="{&#x27;status-ready&#x27;: details?.merged, &#x27;status-error&#x27;: details?.state == &#x27;closed&#x27; &amp;&amp; !details?.merged}"></span>
{{ details?.merged ? 'Merged' : fmt.title(details?.state) }}
</span>
<span class="pr-meta-item" v-if="details?.baseRepositoryFullName">
<i class="fab fa-github"></i> <span v-text="details?.baseRepositoryFullName"></span>
</span>
<span class="pr-meta-item" v-if="details?.updatedDate">
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-clock"></use></svg> <span v-text="fmt?.date(details?.updatedDate)"></span>
</span>
<span class="pr-meta-item" v-if="details?.anonymizeDate">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-shield"></use></svg> Anonymized <span v-text="fmt?.date(details?.anonymizeDate)"></span>
</span>
<div class="pr-state-line" v-if="details">
<span class="pr-state" :class="'is-' + prState()"><svg class="ui-icon" aria-hidden="true"><use :href="prState() === 'merged' ? '#ui-icon-branch' : prState() === 'closed' ? '#project-icon-close' : '#project-type-pr'"></use></svg>{{ prStateLabel() }}</span>
<p class="pr-summary">
<span class="pr-author pr-summary-author" :class="{ 'is-redacted': isRedactedName(details.author) }" v-if="details?.author"><template v-if="!isRedactedName(details.author)">@</template><template v-for="(seg, si) in redactParts(details.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="pr-summary-author is-hidden" v-else>The author</span>
{{ prState() === 'merged' ? ' merged' : ' wants to merge' }}
<template v-if="details?.commits?.length"> {{ fmt.plural(details.commits.length, {'one': '1 commit', 'other': '{} commits'}) }}</template>
<template v-if="details?.baseRef"> into <code class="pr-branch"><template v-for="(seg, si) in redactParts(details.baseRef)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code></template>
<template v-if="details?.headRef"> from <code class="pr-branch"><template v-for="(seg, si) in redactParts(details.headRef)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code></template>
</p>
</div>
<div class="pr-header-meta" v-if="details">
<span class="pr-meta-item" v-if="details?.baseRepositoryFullName"><i class="fab fa-github"></i> <span v-text="details?.baseRepositoryFullName"></span></span>
<span class="pr-meta-item" v-if="details?.creationDate"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-clock"></use></svg> Opened {{ fmt?.date(details.creationDate) }}</span>
<span class="pr-meta-item" v-if="details?.mergedDate &amp;&amp; details?.merged">Merged {{ fmt?.date(details.mergedDate) }}</span>
<span class="pr-meta-item" v-else-if="details?.updatedDate">Updated {{ fmt?.date(details.updatedDate) }}</span>
<span class="pr-meta-item" v-if="details?.anonymizeDate"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-shield"></use></svg> Anonymized {{ fmt?.date(details.anonymizeDate) }}</span>
</div>
</header>
<section class="pr-body-card" v-if="details?.body">
<div class="paper-section-eyebrow">Description</div>
<markdown :content="details?.body"></markdown>
</section>
<nav class="paper-tabs" role="tablist" v-if="details?.diff || details?.comments">
<button class="paper-tab" type="button" role="tab" v-if="details?.diff" :class="{&#x27;active&#x27;: tabState?.active == &#x27;diff&#x27;}" id="pr-diff-tab" :aria-selected="tabState?.active === 'diff'" aria-controls="pr-diff-panel" :tabindex="tabState?.active === 'diff' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="tabState.active = &#x27;diff&#x27;">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg> Diff
<nav class="paper-tabs pr-tabs" role="tablist" aria-label="Pull request" v-if="details">
<button class="paper-tab" type="button" role="tab" :class="{ active: tabState?.active == 'conversation' }" id="pr-conversation-tab" :aria-selected="tabState?.active === 'conversation'" aria-controls="pr-conversation-panel" :tabindex="tabState?.active === 'conversation' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('conversation')">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>Conversation<span class="tab-count" v-if="conversationCount()">{{ conversationCount() }}</span>
</button>
<button class="paper-tab" type="button" role="tab" v-if="details?.comments" :class="{&#x27;active&#x27;: tabState?.active == &#x27;comments&#x27;}" id="pr-comments-tab" :aria-selected="tabState?.active === 'comments'" aria-controls="pr-comments-panel" :tabindex="tabState?.active === 'comments' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="tabState.active = &#x27;comments&#x27;">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>
<span v-text="fmt.plural(details?.comments?.length, {&#x27;0&#x27;: &#x27;No comments&#x27;, &#x27;one&#x27;: &#x27;1 comment&#x27;, &#x27;other&#x27;: &#x27;{} comments&#x27;})"></span>
<button class="paper-tab" type="button" role="tab" v-if="details?.commits?.length" :class="{ active: tabState?.active == 'commits' }" id="pr-commits-tab" :aria-selected="tabState?.active === 'commits'" aria-controls="pr-commits-panel" :tabindex="tabState?.active === 'commits' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('commits')">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-commit"></use></svg>Commits<span class="tab-count">{{ details.commits.length }}</span>
</button>
<button class="paper-tab" type="button" role="tab" v-if="details?.diff" :class="{ active: tabState?.active == 'files' }" id="pr-files-tab" :aria-selected="tabState?.active === 'files'" aria-controls="pr-files-panel" :tabindex="tabState?.active === 'files' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="openTab('files')">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg><span>Files<span class="tab-long"> changed</span></span><span class="tab-count">{{ prStats().files }}</span>
</button>
<span class="pr-tabs-stat" v-if="details?.diff" :aria-label="prStats().additions + ' additions, ' + prStats().deletions + ' deletions'"><span class="stat-add">+{{ fmt.number(prStats().additions) }}</span><span class="stat-del">−{{ fmt.number(prStats().deletions) }}</span></span>
</nav>
<div class="paper-tab-content">
<div role="tabpanel" id="pr-diff-panel" aria-labelledby="pr-diff-tab" v-if="details?.diff &amp;&amp; tabState?.active ==&#x27;diff&#x27;">
<div class="pr-diff" v-html="sanitize(fmt?.diff(details?.diff))"></div>
<div role="tabpanel" id="pr-conversation-panel" aria-labelledby="pr-conversation-tab" v-if="details &amp;&amp; tabState?.active == 'conversation'">
<ol class="pr-timeline">
<li class="pr-timeline-item is-description">
<div class="pr-thread">
<article class="pr-thread-comment">
<header class="pr-thread-head">
<span class="pr-avatar" aria-hidden="true"><svg class="ui-icon"><use href="#ui-icon-user"></use></svg></span>
<span class="pr-author" :class="{ 'is-redacted': isRedactedName(details.author) }" v-if="details?.author"><template v-if="!isRedactedName(details.author)">@</template><template v-for="(seg, si) in redactParts(details.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="pr-author is-hidden" v-else>Author</span>
<span class="pr-comment-action">opened this pull request</span>
<time class="pr-thread-date" v-if="details?.creationDate">{{ fmt?.date(details.creationDate) }}</time>
</header>
<div class="pr-thread-body" v-if="details?.body"><markdown :content="details.body" :reader="true"></markdown></div>
<p class="pr-thread-body text-muted" v-else>No description.</p>
</article>
</div>
</li>
<li class="pr-timeline-item" v-for="item in prTimeline()" :key="item.key" :class="'is-' + item.kind">
<div class="pr-review-head" v-if="item.kind === 'review'">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg>
<span>Review on <button type="button" class="pr-review-file" v-if="item.file" @click="showInDiff(item.file)"><template v-for="(seg, si) in redactParts(item.thread.path)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></button><code v-else><template v-for="(seg, si) in redactParts(item.thread.path)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></code><template v-if="item.thread.line"> · line {{ item.thread.line }}</template></span>
</div>
<pr-thread :comments="item.comments" :fmt="fmt"></pr-thread>
</li>
</ol>
</div>
<div role="tabpanel" id="pr-comments-panel" aria-labelledby="pr-comments-tab" v-if="details?.comments &amp;&amp; tabState?.active ==&#x27;comments&#x27;">
<ul class="pr-comments">
<li class="pr-comment" v-for="(comment, index) in details?.comments">
<div class="pr-comment-head">
<span class="pr-comment-author" v-if="comment?.author">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-user"></use></svg> @<span v-text="comment?.author"></span>
</span>
<span class="pr-comment-date" v-if="comment?.updatedDate" v-text="fmt?.date(comment?.updatedDate)"></span>
<div role="tabpanel" id="pr-commits-panel" aria-labelledby="pr-commits-tab" v-if="details?.commits?.length &amp;&amp; tabState?.active == 'commits'">
<section class="pr-commit-group" v-for="(group, gi) in commitGroups()" :key="gi">
<h2 class="pr-commit-day" v-if="group.day"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-commit"></use></svg>Commits on {{ group.day }}</h2>
<ol class="pr-commit-list">
<li class="pr-commit" v-for="commit in group.commits" :key="commit.index">
<span class="pr-commit-index" :aria-label="'Commit ' + commit.index">{{ commit.index }}</span>
<div class="pr-commit-text">
<p class="pr-commit-headline"><template v-for="(seg, si) in redactParts(commit.headline)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></p>
<p class="pr-commit-detail" v-if="commit.detail"><template v-for="(seg, si) in redactParts(commit.detail)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></p>
</div>
<span class="pr-author pr-commit-author" :class="{ 'is-redacted': isRedactedName(commit.author) }" v-if="commit.author"><template v-if="!isRedactedName(commit.author)">@</template><template v-for="(seg, si) in redactParts(commit.author)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
</li>
</ol>
</section>
</div>
<div role="tabpanel" id="pr-files-panel" aria-labelledby="pr-files-tab" v-if="details?.diff &amp;&amp; tabState?.active == 'files'">
<div class="toc-layout is-left" :class="{ 'has-toc': showFileToc() }">
<aside class="page-toc pr-file-toc" v-if="showFileToc()" aria-label="Changed files">
<div class="page-toc-head">{{ fmt.plural(prStats().files, {'one': '1 file changed', 'other': '{} files changed'}) }}</div>
<nav class="toc-rail"><a v-for="f in prFiles()" :key="f.id" :href="'#' + f.id" class="toc-file toc-diff-file" :class="{ 'is-active': activeFileIndex() === f.index }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToFile(f)"><span class="diff-status-dot" :class="'is-' + f.status" :title="fmt.title(f.status)"><span class="sr-only">{{ f.status }}</span></span><span class="toc-file-name"><span class="toc-file-dir" v-if="f.dir"><template v-for="(seg, si) in redactParts(f.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(f.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-stat"><span class="stat-add" v-if="f.additions">+{{ f.additions }}</span><span class="stat-del" v-if="f.deletions">−{{ f.deletions }}</span></span></a></nav>
</aside>
<div class="toc-main">
<div class="toc-bar pr-files-bar">
<div class="toc-menu" v-if="showFileToc()">
<button type="button" class="btn btn-sm btn-ghost toc-menu-btn" :class="{ 'is-on': tocOpen }" aria-haspopup="true" :aria-expanded="tocOpen ? 'true' : 'false'" @click.stop="tocOpen = !tocOpen"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-outline"></use></svg><span class="toc-menu-label">{{ fmt.plural(prStats().files, {'one': '1 file', 'other': '{} files'}) }}</span><span class="toc-menu-current" v-if="prFiles()[activeFileIndex()]"><template v-for="(seg, si) in redactParts(prFiles()[activeFileIndex()].name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><svg class="ui-icon toc-menu-chevron" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
<nav class="toc-menu-pop toc-rail" v-if="tocOpen" aria-label="Changed files"><a v-for="f in prFiles()" :key="f.id" :href="'#' + f.id" class="toc-file toc-diff-file" :class="{ 'is-active': activeFileIndex() === f.index }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToFile(f)"><span class="diff-status-dot" :class="'is-' + f.status" :title="fmt.title(f.status)"><span class="sr-only">{{ f.status }}</span></span><span class="toc-file-name"><span class="toc-file-dir" v-if="f.dir"><template v-for="(seg, si) in redactParts(f.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(f.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-stat"><span class="stat-add" v-if="f.additions">+{{ f.additions }}</span><span class="stat-del" v-if="f.deletions">−{{ f.deletions }}</span></span></a></nav>
</div>
<span class="pr-files-summary">{{ fmt.plural(prStats().files, {'one': '1 file changed', 'other': '{} files changed'}) }}<span class="stat-add">+{{ fmt.number(prStats().additions) }}</span><span class="stat-del">−{{ fmt.number(prStats().deletions) }}</span></span>
<button type="button" class="btn btn-sm btn-ghost pr-collapse-all" @click="toggleAllFiles()">{{ allCollapsed() ? 'Expand all' : 'Collapse all' }}</button>
</div>
<div class="pr-comment-body" v-if="comment?.body">
<markdown :content="comment?.body"></markdown>
</div>
</li>
<li class="paper-table-empty" v-if="!details?.comments?.length">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>
<span>No comments on this pull request.</span>
</li>
</ul>
<section class="diff-file-block" v-for="file in prFiles()" :key="file.id" :id="file.id" :class="{ 'is-collapsed': collapsedFiles[file.index] }" :aria-label="file.path">
<header class="diff-file-header">
<button type="button" class="diff-file-toggle" :aria-expanded="collapsedFiles[file.index] ? 'false' : 'true'" :aria-controls="file.id + '-body'" :aria-label="(collapsedFiles[file.index] ? 'Expand ' : 'Collapse ') + file.path" @click="toggleFile(file.index)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
<span class="diff-file-name" :title="file.path"><span class="diff-file-dir" v-if="file.dir"><template v-for="(seg, si) in redactParts(file.dir)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><template v-for="(seg, si) in redactParts(file.name)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
<span class="diff-file-meta">
<span class="diff-file-status" :class="'diff-file-status-' + file.status" v-if="file.status !== 'modified'">{{ file.status }}</span>
<span class="diff-file-threads" v-if="file.threads" :title="fmt.plural(file.threads, {'one': '1 review thread', 'other': '{} review threads'})"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>{{ file.threads }}</span>
<span class="diff-file-stat" :aria-label="file.additions + ' additions, ' + file.deletions + ' deletions'"><span class="stat-add" v-if="file.additions">+{{ file.additions }}</span><span class="stat-del" v-if="file.deletions">−{{ file.deletions }}</span><span class="diff-bar" aria-hidden="true"><i v-for="(b, bi) in diffBar(file)" :key="bi" :class="'is-' + b"></i></span></span>
</span>
</header>
<div class="diff-file-body" :id="file.id + '-body'" v-if="!collapsedFiles[file.index]">
<diff-table :file="file" :fmt="fmt"></diff-table>
<div class="diff-loose-threads" v-if="file.looseThreads.length">
<div class="diff-loose-thread" v-for="(thread, ti) in file.looseThreads" :key="ti">
<div class="pr-review-head"><span>Comment on line {{ thread.line || '—' }} (outside this diff)</span></div>
<pr-thread :comments="thread.comments" :fmt="fmt"></pr-thread>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
+6 -1
View File
@@ -1,6 +1,7 @@
import { setupBilling, readBilling, isRepositoryAddon } from "./billing.js";
import { reactive, nextTick, markRaw } from "vue";
import { setupFileViewer } from "./file-viewer.js";
import { setupGistPage, setupPullRequestPage, defaultPullRequestTab } from "./review-pages.js";
import { loadEditor } from "./lazy-assets.js";
import { createPageState, createTimers, createListeners } from "./state.js";
import { formDraft } from "./drafts.js";
@@ -4165,7 +4166,7 @@ export const pullRequestController = function (state, http, location, params, ht
http.get(`/api/pr/${state.pullRequestId}/content`).then(
(res) => {
state.details = res.data;
state.tabState = { active: res.data.diff ? "diff" : "comments" };
state.tabState = { active: defaultPullRequestTab(res.data) };
if (callback) {
callback(res.data);
}
@@ -4180,6 +4181,8 @@ export const pullRequestController = function (state, http, location, params, ht
function init() {
state.pullRequestId = params.pullRequestId;
state.type = "loading";
setupPullRequestPage(state);
installPrismRedactionSlots();
getOption((_) => {
getPullRequest();
@@ -4225,6 +4228,8 @@ export const gistController = function (state, http, location, params, html) {
function init() {
state.gistId = params.gistId;
state.type = "loading";
setupGistPage(state);
installPrismRedactionSlots();
getOption(() => { getGist(); });
}
+83 -6
View File
@@ -3,6 +3,8 @@ import { h, ref, watch, onMounted, onBeforeUnmount, nextTick, defineAsyncCompone
import HtmlDoc from "./html-doc.js";
import PdfViewer from "./pdf-viewer.js";
import { slotRedactions } from "./app.js";
import { headingOutline, redactParts } from "./outline.js";
import { hangIndent } from "./formatters.js";
import { render as quotaUsageTemplate } from "../partials/quotaUsage.htm";
const QuotaUsage = {
@@ -51,21 +53,96 @@ export const hangCodeLines = (root) => {
}).join("\n");
});
};
const headingSlug = (t) => t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").slice(0, 60) || "section";
// Reader mode (gist and pull request pages): redaction slots like the explorer,
// heading ids under idPrefix, and the h1-h3 outline reported through onOutline.
const Markdown = {
props: ["content", "terms", "options"],
props: ["content", "terms", "options", "reader", "idPrefix", "onOutline"],
setup(props) {
const host = ref(null);
const render = () => {
host.value.innerHTML = renderMD(props.content || "", window.location.pathname + "/../");
const html = renderMD(props.content || "", window.location.pathname + "/../");
host.value.innerHTML = props.reader ? slotRedactions(html) : html;
tintDiffBlocks(host.value);
hangCodeLines(host.value);
if (props.idPrefix != null) {
const seen = {};
host.value.querySelectorAll("h1, h2, h3").forEach((heading) => {
let id = props.idPrefix + (heading.id || headingSlug(heading.textContent));
if (seen[id]) id += "-" + (++seen[id]); else seen[id] = 1;
heading.id = id;
});
}
props.onOutline?.(headingOutline(host.value));
};
onMounted(() => { render(); watch(() => [props.content, props.terms, props.options], render, { deep: true }); });
return () => h("markdown", { ref: host });
return () => h("markdown", { ref: host, class: props.reader ? "markdown-body" : null });
},
};
const slotted = (text) => redactParts(text).map((seg) => seg.n
? h("span", { class: "redact-slot", role: "img", "aria-label": "Redacted term " + seg.n }, h("i", seg.n))
: seg.t);
const isRedactedName = (text) => /^XXXX-\d+$/.test(String(text || "").trim());
// A comment author as one inline unit: a fully redacted login is its slot alone (no stray "@").
export const authorTag = (author, fallback = "Reviewer") => !author
? h("span", { class: "pr-author is-hidden" }, fallback)
: h("span", { class: ["pr-author", { "is-redacted": isRedactedName(author) }], title: isRedactedName(author) ? "Redacted author" : null },
isRedactedName(author) ? slotted(author) : ["@", ...slotted(author)]);
// A pull request comment, or a review thread: comments stacked in one container,
// divided by rules, replies at the same indent as the first comment (like GitHub).
const PrThread = {
props: ["comments", "fmt"],
setup(props) {
return () => h("div", { class: "pr-thread" }, (props.comments || []).map((comment, i) =>
h("article", { class: ["pr-thread-comment", { "is-reply": i > 0 }], key: i }, [
h("header", { class: "pr-thread-head" }, [
h("span", { class: "pr-avatar", "aria-hidden": "true" }, h("svg", { class: "ui-icon" }, h("use", { href: "#ui-icon-user" }))),
authorTag(comment.author),
comment.creationDate || comment.updatedDate ? h("time", { class: "pr-thread-date", datetime: comment.creationDate || comment.updatedDate }, props.fmt?.date(comment.creationDate || comment.updatedDate)) : null,
]),
comment.body ? h("div", { class: "pr-thread-body" }, h(Markdown, { content: comment.body, reader: true })) : null,
])));
},
};
// One file of a pull request diff. Plain lines are one escaped HTML string per
// run, so a 20,000-line diff is a few DOM writes rather than 100,000 vnodes, and
// as its own component it does not re-render when the page state (scroll spy,
// collapsed files, menus) changes.
const escapeHtml = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
const DIFF_KINDS = new Set(["add", "remove", "ctx", "hunk"]);
const diffRowHtml = (line) => {
const kind = DIFF_KINDS.has(line.kind) ? line.kind : "ctx";
const code = redactParts(line.text).map((seg) => seg.n
? `<span class="redact-slot" role="img" aria-label="Redacted term ${Number(seg.n)}"><i>${Number(seg.n)}</i></span>`
: escapeHtml(seg.t)).join("");
return `<tr class="diff-row diff-row-${kind}"><td class="diff-gutter diff-gutter-old">${Number(line.oldNo) || ""}</td>`
+ `<td class="diff-gutter diff-gutter-new">${Number(line.newNo) || ""}</td>`
+ `<td class="diff-sign">${kind === "add" ? "+" : kind === "remove" ? "−" : ""}</td>`
+ `<td class="diff-code" style="--hang: ${hangIndent(line.text)}ch">${code}</td></tr>`;
};
const DiffTable = {
props: ["file", "fmt"],
setup(props) {
return () => {
const bodies = [];
let run = "";
const flush = () => { if (run) bodies.push(h("tbody", { key: "r" + bodies.length, innerHTML: run })); run = ""; };
(props.file?.lines || []).forEach((line) => {
run += diffRowHtml(line);
if (!line.threads?.length) return;
flush();
bodies.push(h("tbody", { key: "t" + bodies.length }, line.threads.map((thread, ti) => h("tr", { class: "diff-thread-row", key: ti }, [
h("td", { class: "diff-thread-gutter", colspan: 3 }),
h("td", { class: "diff-thread-cell" }, h(PrThread, { comments: thread.comments, fmt: props.fmt })),
]))));
});
flush();
return h("table", { class: "diff-file-table" }, bodies);
};
},
};
const GistFile = {
props: ["file", "terms", "options"],
props: ["file", "terms", "options", "reader", "idPrefix", "onOutline"],
setup(props) {
const host = ref(null);
const highlight = () => nextTick(() => { host.value?.querySelectorAll("pre code").forEach(el => window.Prism?.highlightElement(el)); tintDiffBlocks(host.value); hangCodeLines(host.value); });
@@ -75,7 +152,7 @@ const GistFile = {
const file = props.file || {};
const extension = (file.filename || "").split(".").pop().toLowerCase();
if (["md", "markdown"].includes(extension) || file.language === "Markdown") {
return h("gist-file", { ref: host }, h(Markdown, { content: file.content, terms: props.terms, options: props.options }));
return h("gist-file", { ref: host }, h(Markdown, { content: file.content, terms: props.terms, options: props.options, reader: props.reader, idPrefix: props.idPrefix, onOutline: props.onOutline }));
}
const aliases = { js: "javascript", jsx: "javascript", ts: "javascript", typescript: "javascript", py: "python", html: "markup", xml: "markup", svg: "markup", sh: "bash" };
const language = (file.language || extension || "none").toLowerCase();
@@ -141,7 +218,7 @@ const Loc = {
};
},
};
export const components = { Markdown, GistFile, Notebook, Loc, HtmlDoc, QuotaUsage, Pdfviewer: defineAsyncComponent(async () => {
export const components = { Markdown, GistFile, PrThread, DiffTable, Notebook, Loc, HtmlDoc, QuotaUsage, Pdfviewer: defineAsyncComponent(async () => {
await loadLibrary("pdf");
pdfjsLib.GlobalWorkerOptions.workerSrc = "/script/external/pdf.worker.js";
return PdfViewer;
+27 -48
View File
@@ -1,3 +1,5 @@
import { activeSection, headingOutline, jumpTo, redactParts } from "./outline.js";
import { parseDelimited } from "./formatters.js";
import { nextTick, markRaw } from "vue";
import { createTimers, createListeners } from "./state.js";
import { slotRedactions } from "./app.js";
@@ -281,31 +283,33 @@ export const setupFileViewer = function (state, events = state) {
});
return doc.body.firstChild.innerHTML;
};
let tocCache = { content: null, list: [] };
state.readmeToc = function () {
if (state.type !== "html" || typeof state.content !== "string") return [];
if (tocCache.content === state.content) return tocCache.list;
const doc = new window.DOMParser().parseFromString("<div>" + state.renderReadme(state.sanitize ? state.sanitize(state.content) : state.content) + "</div>", "text/html");
const list = [...doc.querySelectorAll("h2, h3")].map((h) => ({ id: h.id, text: h.textContent.trim(), level: h.tagName === "H3" ? 3 : 2 })).slice(0, 40);
tocCache = { content: state.content, list };
return list;
let tocCache = { content: null, list: [], title: null, count: 0 };
// h1-h3 with their redaction slots; the rail and the phone menu show it from 3 headings.
// A lone opening h1 is the document's title: it takes the "Introduction" slot (back to
// the top) and the sections under it start at the first level.
const outline = () => {
if (state.type !== "html" || typeof state.content !== "string") return { list: [], title: null, count: 0 };
if (tocCache.content === state.content) return tocCache;
let list = headingOutline(state.renderReadme(state.sanitize ? state.sanitize(state.content) : state.content));
const count = list.length;
let title = null;
if (list[0]?.level === 1 && list.filter((h) => h.level === 1).length === 1) {
title = list[0];
list = list.slice(1);
const top = Math.min(...list.map((h) => h.level));
list = list.map((h) => ({ ...h, depth: h.level - top }));
}
tocCache = { content: state.content, list, title, count };
return tocCache;
};
state.readmeToc = () => outline().list;
state.tocTitle = () => outline().title;
state.tocCount = () => outline().count;
state.activeHeading = null;
listen(window, "scroll", () => {
const toc = state.readmeToc ? state.readmeToc() : [];
if (!toc.length) return;
// Active = the first heading visible below the sticky chrome; if none is on screen,
// the last heading already scrolled past (the reader is inside that section).
const chrome = 150;
let current = "", firstVisible = "";
for (const h of toc) {
const el = window.document.getElementById(h.id);
if (!el) continue;
const top = el.getBoundingClientRect().top;
if (top < chrome) current = h.id;
else if (!firstVisible && top < window.innerHeight - 80) firstVisible = h.id;
}
if (firstVisible) current = firstVisible;
if (state.tocCount() < 3) return;
const current = activeSection(toc.map((h) => h.id), { offset: 120, scroller: window.document.querySelector(".explorer-content") });
if (state.activeHeading !== current) state.activeHeading = current;
}, { capture: true, passive: true });
state.scrollToHeading = function (id) {
@@ -315,32 +319,13 @@ export const setupFileViewer = function (state, events = state) {
state.activeHeading = "";
return;
}
const el = window.document.getElementById(id);
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
jumpTo(id);
state.activeHeading = id;
};
// CSV/TSV files up to 1 MB render as a table (sticky header, rules, tabular
// figures) with a Raw toggle back to the code view.
state.csvView = "table";
let csvCache = { content: null, rows: [] };
const parseDelimited = (text, sep) => {
const rows = [];
let row = [], cell = "", quoted = false;
for (let i = 0; i < text.length; i++) {
const ch = text[i];
if (quoted) {
if (ch === '"') { if (text[i + 1] === '"') { cell += '"'; i++; } else quoted = false; }
else cell += ch;
} else if (ch === '"' && cell === "") quoted = true;
else if (ch === sep) { row.push(cell); cell = ""; }
else if (ch === "\n" || ch === "\r") {
if (ch === "\r" && text[i + 1] === "\n") i++;
row.push(cell); rows.push(row); row = []; cell = "";
} else cell += ch;
}
if (cell !== "" || row.length) { row.push(cell); rows.push(row); }
return rows.filter((r) => r.length > 1 || r[0] !== "");
};
state.isCsv = () => typeof state.content === "string" && state.type !== "html"
&& /\.(csv|tsv)$/i.test(state.filePath || "") && state.content.length <= 1024 * 1024;
state.csvRows = () => {
@@ -355,13 +340,7 @@ export const setupFileViewer = function (state, events = state) {
return rows.length > 0 && rows.every((v) => state.csvNumeric(v));
};
state.csvNumeric = (value) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(value) && /\d/.test(value);
state.redactParts = function (text) {
const out = []; let last = 0; let m; const re = /\bXXXX-(\d+)\b/g;
text = String(text || "");
while ((m = re.exec(text))) { if (m.index > last) out.push({ t: text.slice(last, m.index) }); out.push({ n: m[1] }); last = m.index + m[0].length; }
if (last < text.length) out.push({ t: text.slice(last) });
return out;
};
state.redactParts = redactParts;
state.pathCopied = false;
state.copyPath = async function () {
if (!window.navigator.clipboard?.writeText) return;
+86 -121
View File
@@ -140,139 +140,104 @@ export const statusMsg = (function () {
return msg;
};
})();
export const diff = (function (html) {
// A unified diff split into files: paths, status, +/- counts and numbered lines.
export function parseDiff(str) {
const files = [];
if (!str) return files;
// oldLeft/newLeft: lines still due in the current hunk. Inside a hunk a
// removed "-- x" or added "++ x" line is content, not a "---"/"+++" header.
let file = null, oldNo = 0, newNo = 0, oldLeft = 0, newLeft = 0;
const finish = () => {
if (!file || !(file.lines.length || file.oldPath || file.newPath)) { file = null; return; }
file.status = file.oldPath === "/dev/null" ? "added" : file.newPath === "/dev/null" ? "deleted"
: file.oldPath && file.newPath && file.oldPath !== file.newPath ? "renamed" : "modified";
file.path = file.newPath && file.newPath !== "/dev/null" ? file.newPath : file.oldPath || "";
file.additions = file.lines.filter((l) => l.kind === "add").length;
file.deletions = file.lines.filter((l) => l.kind === "remove").length;
files.push(file);
file = null;
};
const ensureFile = () => (file = file || { oldPath: "", newPath: "", lines: [] });
// The diff's final newline is not a context line.
const lines = str.replace(/\n$/, "").split("\n");
for (const ln of lines) {
if (file && (oldLeft > 0 || newLeft > 0) && /^([-+ ]|$)/.test(ln)) {
if (ln.startsWith("+")) { file.lines.push({ kind: "add", oldNo: "", newNo: newNo++, text: ln.slice(1) }); newLeft--; }
else if (ln.startsWith("-")) { file.lines.push({ kind: "remove", oldNo: oldNo++, newNo: "", text: ln.slice(1) }); oldLeft--; }
else { file.lines.push({ kind: "ctx", oldNo: oldNo++, newNo: newNo++, text: ln.slice(1) }); oldLeft--; newLeft--; }
continue;
}
if (ln.startsWith("diff --git")) { finish(); ensureFile(); continue; }
if (ln.startsWith("--- ")) {
// New file boundary if the previous file already had lines.
if (file && file.lines.length) finish();
ensureFile().oldPath = ln.replace(/^--- (a\/)?/, "").trim();
continue;
}
if (ln.startsWith("+++ ")) { ensureFile().newPath = ln.replace(/^\+\+\+ (b\/)?/, "").trim(); continue; }
if (/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(ln)) continue;
if (ln.startsWith("@@")) {
const m = ln.match(/@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);
if (m) {
oldNo = parseInt(m[1], 10); newNo = parseInt(m[3], 10);
oldLeft = m[2] == null ? 1 : parseInt(m[2], 10); newLeft = m[4] == null ? 1 : parseInt(m[4], 10);
}
ensureFile().lines.push({ kind: "hunk", oldNo: "", newNo: "", text: ln });
continue;
}
if (!file) continue;
if (ln.startsWith("+")) file.lines.push({ kind: "add", oldNo: "", newNo: newNo++, text: ln.slice(1) });
else if (ln.startsWith("-")) file.lines.push({ kind: "remove", oldNo: oldNo++, newNo: "", text: ln.slice(1) });
else if (ln.startsWith("\\")) continue; // "\ No newline at end of file"
else file.lines.push({ kind: "ctx", oldNo: oldNo++, newNo: newNo++, text: ln.startsWith(" ") ? ln.slice(1) : ln });
}
finish();
return files;
}
// CSV/TSV text as rows of cells (quoted fields, doubled quotes, CRLF).
export const parseDelimited = (text, sep) => {
const rows = [];
let row = [], cell = "", quoted = false;
for (let i = 0; i < text.length; i++) {
const ch = text[i];
if (quoted) {
if (ch === '"') { if (text[i + 1] === '"') { cell += '"'; i++; } else quoted = false; }
else cell += ch;
} else if (ch === '"' && cell === "") quoted = true;
else if (ch === sep) { row.push(cell); cell = ""; }
else if (ch === "\n" || ch === "\r") {
if (ch === "\r" && text[i + 1] === "\n") i++;
row.push(cell); rows.push(row); row = []; cell = "";
} else cell += ch;
}
if (cell !== "" || row.length) { row.push(cell); rows.push(row); }
return rows.filter((r) => r.length > 1 || r[0] !== "");
};
export const hangIndent = (text) => Math.min(((text || "").match(/^[ \t]*/)[0] || "").replace(/\t/g, " ").length + 4, 24);
export const diff = (function () {
const esc = (s) =>
s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
function flushFile(out, file) {
if (!file) return;
const headerName =
file.newPath && file.newPath !== "/dev/null"
? file.newPath
: file.oldPath || "";
const status =
file.oldPath === "/dev/null"
? "added"
: file.newPath === "/dev/null"
? "deleted"
: file.oldPath && file.newPath && file.oldPath !== file.newPath
? "renamed"
: "modified";
out.push('<div class="diff-file-block">');
out.push(
const renderFile = (file) => {
const out = ['<div class="diff-file-block">',
'<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span>' +
'<span class="diff-file-name">' +
esc(headerName) +
"</span>" +
'<span class="diff-file-status diff-file-status-' +
status +
'">' +
status +
"</span></div>"
);
'<span class="diff-file-name">' + esc(file.path) + "</span>" +
'<span class="diff-file-status diff-file-status-' + file.status + '">' + file.status + "</span></div>"];
if (file.lines.length) {
out.push('<table class="diff-file-table"><tbody>');
for (const line of file.lines) {
out.push(
'<tr class="diff-row diff-row-' +
line.kind +
'">' +
'<td class="diff-gutter diff-gutter-old">' +
(line.oldNo || "") +
"</td>" +
'<td class="diff-gutter diff-gutter-new">' +
(line.newNo || "") +
"</td>" +
'<td class="diff-sign">' +
(line.kind === "add"
? "+"
: line.kind === "remove"
? "-"
: "") +
"</td>" +
'<td class="diff-code" style="--hang:' +
Math.min(((line.text || "").match(/^[ \t]*/)[0] || "").replace(/\t/g, " ").length + 4, 24) +
'ch">' +
esc(line.text) +
"</td>" +
"</tr>"
);
out.push('<tr class="diff-row diff-row-' + line.kind + '">' +
'<td class="diff-gutter diff-gutter-old">' + (line.oldNo || "") + "</td>" +
'<td class="diff-gutter diff-gutter-new">' + (line.newNo || "") + "</td>" +
'<td class="diff-sign">' + (line.kind === "add" ? "+" : line.kind === "remove" ? "-" : "") + "</td>" +
'<td class="diff-code" style="--hang:' + hangIndent(line.text) + 'ch">' + esc(line.text) + "</td></tr>");
}
out.push("</tbody></table>");
}
out.push("</div>");
}
return function (str) {
if (!str) return str;
const out = [];
let file = null;
let oldNo = 0;
let newNo = 0;
const ensureFile = () => {
if (!file) file = { oldPath: "", newPath: "", lines: [] };
return file;
};
const startNewFileIfNeeded = () => {
if (file && (file.lines.length || file.oldPath || file.newPath)) {
flushFile(out, file);
file = null;
}
};
const lines = str.split("\n");
for (let i = 0; i < lines.length; i++) {
const ln = lines[i];
if (ln.startsWith("diff --git")) {
startNewFileIfNeeded();
ensureFile();
continue;
}
if (ln.startsWith("--- ")) {
// New file boundary if the previous file already had lines.
if (file && file.lines.length) startNewFileIfNeeded();
ensureFile().oldPath = ln.replace(/^--- (a\/)?/, "").trim();
continue;
}
if (ln.startsWith("+++ ")) {
ensureFile().newPath = ln.replace(/^\+\+\+ (b\/)?/, "").trim();
continue;
}
if (
ln.startsWith("index ") ||
ln.startsWith("similarity index") ||
ln.startsWith("rename ") ||
ln.startsWith("new file mode") ||
ln.startsWith("deleted file mode") ||
ln.startsWith("Binary files")
) {
continue;
}
if (ln.startsWith("@@")) {
const m = ln.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);
if (m) {
oldNo = parseInt(m[1], 10);
newNo = parseInt(m[2], 10);
}
ensureFile().lines.push({ kind: "hunk", oldNo: "", newNo: "", text: ln });
continue;
}
if (!file) continue;
if (ln.startsWith("+")) {
file.lines.push({ kind: "add", oldNo: "", newNo: newNo, text: ln.slice(1) });
newNo++;
} else if (ln.startsWith("-")) {
file.lines.push({ kind: "remove", oldNo: oldNo, newNo: "", text: ln.slice(1) });
oldNo++;
} else {
file.lines.push({ kind: "ctx", oldNo: oldNo, newNo: newNo, text: ln.startsWith(" ") ? ln.slice(1) : ln });
oldNo++;
newNo++;
}
}
flushFile(out, file);
return out.join("");
};
})({ trustAsHtml: value => value });
return (str) => (str ? parseDiff(str).map(renderFile).join("") : str);
})();
export function number(value, digits) {
return value == null ? "" : Number(value).toLocaleString(undefined, digits == null ? {} : { minimumFractionDigits: digits, maximumFractionDigits: digits });
+81
View File
@@ -0,0 +1,81 @@
// "On this page" outlines shared by the Markdown viewer, gists and pull requests.
// Text split around XXXX-n masks, so templates can draw each one as a slot.
export function redactParts(text) {
const out = [];
const re = /\bXXXX-(\d+)\b/g;
let last = 0, m;
text = String(text ?? "");
while ((m = re.exec(text))) {
if (m.index > last) out.push({ t: text.slice(last, m.index) });
out.push({ n: m[1] });
last = m.index + m[0].length;
}
if (last < text.length) out.push({ t: text.slice(last) });
return out;
}
// A heading's text with its redaction chips read back as XXXX-n.
const headingText = (h) => {
const copy = h.cloneNode(true);
copy.querySelectorAll("mark.redact-chip[data-term]").forEach((m) => m.replaceWith(m.dataset.term));
copy.querySelectorAll("a.anchor, .heading-anchor").forEach((a) => a.remove());
return copy.textContent.replace(/\s+/g, " ").trim();
};
/**
* h1-h3 of rendered Markdown (a DOM node or an HTML string) as outline items:
* { id, level, depth, parts }. depth is relative to the shallowest heading, so a
* document without an h1 still starts at depth 0.
*/
export function headingOutline(root, { max = 40 } = {}) {
if (typeof root === "string") {
if (typeof window.DOMParser !== "function") return [];
root = new window.DOMParser().parseFromString("<div>" + root + "</div>", "text/html").body;
}
if (!root?.querySelectorAll) return [];
const list = [...root.querySelectorAll("h1[id], h2[id], h3[id]")].slice(0, max)
.map((h) => ({ id: h.id, level: Number(h.tagName[1]), parts: redactParts(headingText(h)) }))
.filter((h) => h.parts.length);
const top = Math.min(...list.map((h) => h.level));
list.forEach((h) => { h.depth = h.level - top; });
return list;
}
/**
* Scroll spy: the last section whose anchor has crossed the reading line (a
* fifth of the way down the viewport, below any sticky chrome). At the end of
* the page the last anchor on screen wins, so a short final section can be
* highlighted. Returns "" before the first anchor.
*/
export function activeSection(ids, { offset = 0, doc = window.document, view = window, scroller = null } = {}) {
const line = Math.max(offset + 24, view.innerHeight * 0.2);
let current = "";
const tops = [];
for (const id of ids) {
const el = doc.getElementById(id);
if (!el) continue;
const top = el.getBoundingClientRect().top;
tops.push([id, top]);
if (top <= line) current = id;
}
// The page scrolls, or an inner pane does (the explorer's content column).
const box = scroller && scroller.scrollHeight > scroller.clientHeight + 4 ? scroller : doc.scrollingElement || doc.documentElement;
const atEnd = !!box && box.scrollTop > 0 && box.scrollTop + box.clientHeight >= box.scrollHeight - 4;
if (atEnd) {
const onScreen = tops.filter(([, top]) => top < view.innerHeight - 40);
if (onScreen.length) current = onScreen[onScreen.length - 1][0];
}
return current;
}
// Smoothly bring an anchor under the sticky chrome and move focus there for
// keyboard and screen-reader users.
export function jumpTo(id, doc = window.document) {
const el = id && doc.getElementById(id);
if (!el) return false;
el.scrollIntoView({ behavior: "smooth", block: "start" });
if (!el.hasAttribute("tabindex")) el.setAttribute("tabindex", "-1");
el.focus?.({ preventScroll: true });
return true;
}
+249
View File
@@ -0,0 +1,249 @@
// Reviewer pages for an anonymized gist (/gist/:id) and pull request (/pr/:id):
// outlines, scroll spy, the parsed diff and the conversation timeline.
import { nextTick, onScopeDispose } from "vue";
import { activeSection, jumpTo, redactParts } from "./outline.js";
import { parseDiff, hangIndent, parseDelimited } from "./formatters.js";
import { createListeners } from "./state.js";
export const lineCount = (text) => (text ? String(text).replace(/\n$/, "").split("\n").length : 0);
export const isMarkdownFile = (file) => /\.(md|markdown|mdx)$/i.test(file?.filename || "") || file?.language === "Markdown";
// Shared by both pages: slots, the narrow-screen menu and the scroll spy.
function setupOutline(state, anchors) {
const listen = createListeners();
state.redactParts = redactParts;
state.hangIndent = hangIndent;
state.isRedactedName = (text) => /^XXXX-\d+$/.test(String(text || "").trim());
state.tocOpen = false;
state.activeAnchor = "";
const update = () => {
const ids = anchors();
if (!ids.length) return;
const current = activeSection(ids, { offset: 64, scroller: window.document.querySelector("main.app-view") });
if (state.activeAnchor !== current) state.activeAnchor = current;
};
// Capture: the page may scroll inside the app's main element rather than the window.
listen(window, "scroll", update, { capture: true, passive: true });
listen(window, "resize", update, { passive: true });
listen(window.document, "click", (e) => { if (state.tocOpen && !e.target.closest?.(".toc-menu")) state.tocOpen = false; });
listen(window.document, "keydown", (e) => { if (e.key === "Escape" && state.tocOpen) state.tocOpen = false; });
state.jumpToAnchor = (id) => {
state.tocOpen = false;
if (jumpTo(id)) state.activeAnchor = id;
};
return update;
}
const extension = (name) => (String(name || "").split(".").pop() || "").toLowerCase();
const KIND_BY_EXTENSION = {
md: "markdown", markdown: "markdown", mdx: "markdown", ipynb: "notebook", csv: "csv", tsv: "csv", svg: "svg",
png: "image", jpg: "image", jpeg: "image", gif: "image", webp: "image", bmp: "image", ico: "image", avif: "image",
pdf: "pdf", mp4: "video", webm: "video", mov: "video", m4v: "video", ogv: "video",
mp3: "audio", wav: "audio", ogg: "audio", oga: "audio", m4a: "audio", flac: "audio", aac: "audio",
};
const MIME = {
svg: "image/svg+xml", png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp", bmp: "image/bmp",
ico: "image/x-icon", avif: "image/avif", pdf: "application/pdf", mp4: "video/mp4", webm: "video/webm", mov: "video/quicktime",
m4v: "video/mp4", ogv: "video/ogg", mp3: "audio/mpeg", wav: "audio/wav", ogg: "audio/ogg", oga: "audio/ogg", m4a: "audio/mp4",
flac: "audio/flac", aac: "audio/aac",
};
const CSV_LIMIT = 1024 * 1024;
// Which of the explorer's viewers shows a gist file. Binary files arrive as base64.
export function gistFileKind(file) {
if (file?.tooLarge) return "too-large";
if (file?.hidden) return "hidden";
const kind = KIND_BY_EXTENSION[extension(file?.filename)] || (file?.language === "Markdown" ? "markdown" : null);
if (file?.encoding === "base64") return ["image", "pdf", "video", "audio"].includes(kind) && file.content ? kind : "binary";
if (!file?.content) return "empty";
if (kind === "csv" && file.content.length > CSV_LIMIT) return "code";
return ["markdown", "notebook", "csv", "svg"].includes(kind) ? kind : "code";
}
// Formats with a rendered view as well as their source.
export const hasRenderedView = (kind) => ["markdown", "notebook", "csv", "svg"].includes(kind);
const KIND_LABEL = { markdown: "Markdown", notebook: "Jupyter notebook", csv: "Table", svg: "SVG", image: "Image", pdf: "PDF", video: "Video", audio: "Audio", binary: "Binary", "too-large": "Too large", hidden: "Image" };
// The Prism language of a file's source view.
export function gistSourceLanguage(file, kind) {
if (kind === "markdown") return "markdown";
if (kind === "notebook") return "json";
if (kind === "svg") return "markup";
if (kind === "csv") return "none";
return file?.language || extension(file?.filename) || "none";
}
const decodeBase64 = (text) => {
const bin = window.atob(text || "");
const bytes = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
return bytes;
};
export function setupGistPage(state) {
// Rendered or raw, per file; the file's bytes as blob URLs for media, Raw and Download.
state.gistViews = {};
state.gistKind = (index) => gistFileKind(state.details?.files?.[index]);
state.gistHasRendered = (index) => hasRenderedView(state.gistKind(index));
state.gistView = (index) => (state.gistHasRendered(index) && state.gistViews[index] !== "raw" ? "rendered" : "raw");
state.setGistView = (index, view) => { state.gistViews = { ...state.gistViews, [index]: view }; };
state.gistSourceFile = (index) => {
const file = state.details?.files?.[index];
return { ...file, language: gistSourceLanguage(file, state.gistKind(index)), filename: "source.txt" };
};
const urls = new Map();
onScopeDispose(() => { urls.forEach((url) => window.URL.revokeObjectURL?.(url)); urls.clear(); });
const blobUrl = (file, raw) => {
if (!file || !window.URL?.createObjectURL) return null;
const binary = file.encoding === "base64";
const mime = !raw || binary ? MIME[extension(file.filename)] || (binary ? "application/octet-stream" : "text/plain") : "text/plain";
const key = (file.filename || "") + "\0" + mime + "\0" + (file.content || "").length;
if (!urls.has(key)) {
const body = binary ? decodeBase64(file.content) : file.content || "";
urls.set(key, window.URL.createObjectURL(new window.Blob([body], { type: mime + (binary ? "" : ";charset=utf-8") })));
}
return urls.get(key);
};
state.gistMediaUrl = (file) => blobUrl(file, false);
state.gistRawUrl = (file) => blobUrl(file, true);
let csvCache = { content: null, rows: [] };
state.gistCsvRows = (file) => {
if (csvCache.content !== file?.content) csvCache = { content: file?.content, rows: parseDelimited(file?.content || "", extension(file?.filename) === "tsv" ? "\t" : ",") };
return csvCache.rows;
};
state.gistCsvNumeric = (file, ci) => {
const values = state.gistCsvRows(file).slice(1).map((r) => r[ci]).filter((v) => v != null && String(v).trim() !== "");
return values.length > 0 && values.every((v) => /^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(v) && /\d/.test(v));
};
state.gistCopied = null;
state.copyGistFile = async (index) => {
const file = state.details?.files?.[index];
if (!file || file.encoding === "base64" || !window.navigator.clipboard?.writeText) return;
await window.navigator.clipboard.writeText(file.content || "");
state.gistCopied = index;
window.setTimeout(() => { if (state.gistCopied === index) state.gistCopied = null; }, 1600);
};
state.fileOutlines = {};
state.gistFileId = (index) => "file-" + (index + 1);
state.setFileOutline = (index, list) => {
const prev = state.fileOutlines[index];
if (prev && prev.map((h) => h.id).join() === list.map((h) => h.id).join()) return;
state.fileOutlines = { ...state.fileOutlines, [index]: list };
};
// Each file (name, language, lines), with a Markdown file's headings nested under it.
state.gistToc = () => (state.details?.files || []).map((file, index) => ({
id: state.gistFileId(index),
index,
parts: redactParts(file.filename),
kind: gistFileKind(file),
language: KIND_LABEL[gistFileKind(file)] && gistFileKind(file) !== "csv" ? KIND_LABEL[gistFileKind(file)] : file.language || (gistFileKind(file) === "csv" ? "CSV" : "Text"),
lines: file.encoding === "base64" ? null : lineCount(file.content),
size: file.size,
headings: isMarkdownFile(file) && state.gistView(index) === "rendered" ? state.fileOutlines[index] || [] : [],
}));
const anchors = () => state.gistToc().flatMap((f) => [f.id, ...f.headings.map((h) => h.id)]);
// Worth an outline from two files, or one Markdown file with three headings.
state.showGistToc = () => {
const toc = state.gistToc();
return state.tabState?.active === "files" && (toc.length >= 2 || (toc[0]?.headings.length || 0) >= 3);
};
state.activeFileIndex = () => {
const toc = state.gistToc();
const hit = toc.find((f) => f.id === state.activeAnchor || f.headings.some((h) => h.id === state.activeAnchor));
return hit ? hit.index : 0;
};
setupOutline(state, anchors);
}
const stateOf = (d) => d?.merged ? "merged" : d?.draft && d?.state === "open" ? "draft" : d?.state === "closed" ? "closed" : "open";
export function setupPullRequestPage(state) {
let diffCache = { diff: null, threads: null, files: [] };
// Files of the diff; review threads hang under the line they were left on, or
// at the end of the file when that line is not in the diff.
state.prFiles = () => {
const diff = state.details?.diff, threads = state.details?.reviewComments || [];
if (diffCache.diff === diff && diffCache.threads === threads) return diffCache.files;
const files = parseDiff(diff).map((file, index) => {
const own = threads.filter((t) => t.path === file.path);
const placed = new Set();
const lines = file.lines.map((line) => {
// RIGHT threads use the new numbering, LEFT ones the old: the same
// number can name a removed line and an unrelated added line.
const at = own.filter((t) => !placed.has(t) && t.line != null
&& (t.side === "LEFT" ? line.kind === "remove" && t.line === line.oldNo : line.kind !== "remove" && line.kind !== "hunk" && t.line === line.newNo));
at.forEach((t) => placed.add(t));
return at.length ? { ...line, threads: at } : line;
});
return { ...file, index, id: "diff-" + (index + 1), lines, parts: redactParts(file.path),
dir: file.path.includes("/") ? file.path.slice(0, file.path.lastIndexOf("/") + 1) : "",
name: file.path.slice(file.path.lastIndexOf("/") + 1),
threads: own.length, looseThreads: own.filter((t) => !placed.has(t)) };
});
diffCache = { diff, threads, files };
return files;
};
state.prStats = () => state.prFiles().reduce((s, f) => ({ files: s.files + 1, additions: s.additions + f.additions, deletions: s.deletions + f.deletions }), { files: 0, additions: 0, deletions: 0 });
// GitHub's five-square bar: green for additions, red for deletions.
state.diffBar = (file) => {
const total = file.additions + file.deletions;
const add = total ? Math.round((file.additions / total) * 5) : 0;
const del = total ? Math.min(5 - add, Math.round((file.deletions / total) * 5)) : 0;
return [...Array(add).fill("add"), ...Array(del).fill("del"), ...Array(5 - add - del).fill("none")];
};
state.prState = () => stateOf(state.details);
state.prStateLabel = () => ({ merged: "Merged", draft: "Draft", closed: "Closed", open: "Open" })[state.prState()];
state.collapsedFiles = {};
state.toggleFile = (index) => { state.collapsedFiles = { ...state.collapsedFiles, [index]: !state.collapsedFiles[index] }; };
state.allCollapsed = () => state.prFiles().length > 0 && state.prFiles().every((f) => state.collapsedFiles[f.index]);
state.toggleAllFiles = () => {
const collapse = !state.allCollapsed();
state.collapsedFiles = Object.fromEntries(state.prFiles().map((f) => [f.index, collapse]));
};
state.reviewThreadCount = () => (state.details?.reviewComments || []).length;
state.conversationCount = () => (state.details?.comments?.length || 0) + state.reviewThreadCount();
// Comments and review threads in date order (undated items keep their order).
state.prTimeline = () => {
const items = [
...(state.details?.comments || []).map((c, i) => ({ key: "c" + i, kind: "comment", date: c.creationDate || c.updatedDate, comments: [c] })),
...(state.details?.reviewComments || []).map((t, i) => ({ key: "r" + i, kind: "review", date: t.comments?.[0]?.creationDate, thread: t, comments: t.comments || [],
file: state.prFiles().find((f) => f.path === t.path) })),
];
if (items.every((i) => i.date)) items.sort((a, b) => new Date(a.date) - new Date(b.date));
return items;
};
// Commits grouped by day like GitHub; no SHAs (they identify the repository).
state.commitGroups = () => {
const groups = [];
(state.details?.commits || []).forEach((commit, index) => {
const [headline, ...rest] = String(commit.message || "").split("\n");
const day = commit.date ? state.fmt?.date(commit.date) : "";
let group = groups[groups.length - 1];
if (!group || group.day !== day) groups.push((group = { day, commits: [] }));
group.commits.push({ ...commit, index: index + 1, headline, detail: rest.join("\n").trim() });
});
return groups;
};
state.showFileToc = () => state.tabState?.active === "files" && state.prFiles().length >= 2;
state.activeFileIndex = () => {
const hit = state.prFiles().find((f) => f.id === state.activeAnchor);
return hit ? hit.index : 0;
};
state.openTab = (tab) => { state.tabState = { active: tab }; state.tocOpen = false; };
// A review thread's "View in diff": switch tab, expand the file, scroll to it.
state.showInDiff = (file) => {
if (!file) return;
state.openTab("files");
state.collapsedFiles = { ...state.collapsedFiles, [file.index]: false };
nextTick(() => state.jumpToAnchor(file.id));
};
state.jumpToFile = (file) => {
state.collapsedFiles = { ...state.collapsedFiles, [file.index]: false };
state.jumpToAnchor(file.id);
};
setupOutline(state, () => (state.tabState?.active === "files" ? state.prFiles().map((f) => f.id) : []));
}
// The tab a pull request opens on: its conversation when there is one.
export function defaultPullRequestTab(details) {
if (details?.body || details?.comments?.length || details?.reviewComments?.length) return "conversation";
if (details?.diff) return "files";
return details?.commits?.length ? "commits" : "conversation";
}
+57 -54
View File
@@ -1,55 +1,58 @@
"use strict";(()=>{var vl=Object.defineProperty;var yl=e=>{throw TypeError(e)};var Sf=(e,t,s)=>t in e?vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Ef=(e,t)=>{for(var s in t)vl(e,s,{get:t[s],enumerable:!0})};var tt=(e,t,s)=>Sf(e,typeof t!="symbol"?t+"":t,s),Ar=(e,t,s)=>t.has(e)||yl("Cannot "+s);var ae=(e,t,s)=>(Ar(e,t,"read from private field"),s?s.call(e):t.get(e)),Le=(e,t,s)=>t.has(e)?yl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ue=(e,t,s,i)=>(Ar(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),qe=(e,t,s)=>(Ar(e,t,"access private method"),s);var bl=(e,t,s,i)=>({set _(o){Ue(e,t,o,s)},get _(){return ae(e,t,i)}});var ve=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ye={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function wl(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(u=>!["clientId","intentId","token"].includes(u)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function kl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,f,c,v,h,y,g=!0,C,w=i.defer(),S=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>g&&e.user?.username===y;function b(){g=!1,r=f=c=void 0,w.resolve(),o.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let T=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,f=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(C),h||(h=S());try{let H=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let oe=(await s.post("/api/review-consent/preview",{repositoryId:_,intent:{...r,requestId:h}},T())).data;if(!N())return;if(!oe||typeof oe.ticket!="string"||!oe.ticket||oe.ticket.length>8192||typeof oe.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[bn]=Bo(o);let r=i||o.props&&o.props.type==="number";Fn(e,t?"change":"input",u=>{u.target.composing||e[bn](ga(e.value,s,r))}),(s||r)&&Fn(e,"change",()=>{e.value=ga(e.value,s,r)}),t||(Fn(e,"compositionstart",Th),Fn(e,"compositionend",au),Fn(e,"change",au))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[Hi];delete e[Hi],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[bn](ga(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[bn]=Bo(u),e.composing)return;let f=(r||e.type==="number")&&!/^0\d/.test(e.value)?Vo(e.value):e.value,c=t??"";if(f===c)return;let v=e.getRootNode();(v instanceof Document||v instanceof ShadowRoot)&&v.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===c)||(e.value=c)}},ya={deep:!0,created(e,t,s){e[bn]=Bo(s),Fn(e,"change",()=>{let i=e._modelValue,o=Fs(e),r=e.checked,u=e[bn];if(Ee(i)){let f=vi(i,o),c=f!==-1;if(r&&!c)u(i.concat(o));else if(!r&&c){let v=[...i];v.splice(f,1),u(v)}}else if(Zt(i)){let f=new Set(i);r?f.add(o):f.delete(o),u(f)}else u(fu(e,r))})},mounted:lu,beforeUpdate(e,t,s){e[bn]=Bo(s),lu(e,t,s)}};function lu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Ee(t))o=vi(t,i.props.value)>-1;else if(Zt(t))o=t.has(i.props.value);else{if(t===s)return;o=xt(t,fu(e,!0))}e.checked!==o&&(e.checked=o)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Fn(e,"change",()=>{let o=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>s?Vo(Fs(c)):Fs(c)),r=e.multiple,u=r?Zt(e._modelValue)?new Set(o):o:o[0],f=e._pendingValue=[r,r?Ee(u)?o.slice():o:u];try{e[bn](u)}finally{ze(()=>{e._pendingValue===f&&(e._pendingValue=void 0)})}}),e[bn]=Bo(i)},mounted(e,{value:t}){du(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[bn]=Bo(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!Ph(t,s[1],s[0]))&&du(e,t)}};function Ph(e,t,s){if(!s)return xt(e,t);if(Ee(e))return xt(e,t);if(Zt(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function du(e,t){let s=e.multiple,i=Ee(t);if(!(s&&!i&&!Zt(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],f=Fs(u);if(s)if(i){let c=typeof f;c==="string"||c==="number"?u.selected=t.some(v=>String(v)===String(f)):u.selected=vi(t,f)>-1}else u.selected=t.has(f);else if(xt(Fs(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fs(e){return"_value"in e?e._value:e.value}function fu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var Dh=["ctrl","shift","alt","meta"],Ah={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Dh.some(s=>e[`${s}Key`]&&!t.includes(s))},de=(e,t)=>{if(!e)return e;let s=e._withMods||(e._withMods={}),i=t.join(".");return s[i]||(s[i]=((o,...r)=>{for(let u=0;u<t.length;u++){let f=Ah[t[u]];if(f&&f(o,t))return}return e(o,...r)}))},Ih={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},$t=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=dn(o.key);if(t.some(u=>u===r||Ih[u]===r))return e(o)}))},Oh=pt({patchProp:Eh},lh),uu;function Mh(){return uu||(uu=Hd(Oh))}var mu=((...e)=>{let t=Mh().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Lh(i);if(!o)return;let r=t._component;!Ae(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,Vh(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function Vh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Lh(e){return at(e)?document.querySelector(e):e}var co=typeof document<"u";function gu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function qh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&gu(e.default)}var Ze=Object.assign;function Gi(e,t){let s={};for(let i in t){let o=t[i];s[i]=Xt(o)?o.map(e):e(o)}return s}var Ho=()=>{},Xt=Array.isArray;function ka(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var vu=/#/g,$h=/&/g,Fh=/\//g,_h=/=/g,Uh=/\?/g,yu=/\+/g,Bh=/%5B/g,zh=/%5D/g,bu=/%5E/g,Hh=/%60/g,wu=/%7B/g,jh=/%7C/g,ku=/%7D/g,Gh=/%20/g;function Ca(e){return e==null?"":encodeURI(""+e).replace(jh,"|").replace(Bh,"[").replace(zh,"]")}function Cu(e){return Ca(e).replace(wu,"{").replace(ku,"}").replace(bu,"^")}function ba(e){return Ca(e).replace(yu,"%2B").replace(Gh,"+").replace(vu,"%23").replace($h,"%26").replace(Hh,"`").replace(wu,"{").replace(ku,"}").replace(bu,"^")}function Wh(e){return ba(e).replace(_h,"%3D")}function Kh(e){return CLine truncated
"use strict";(()=>{var Dl=Object.defineProperty;var Al=e=>{throw TypeError(e)};var Uf=(e,t,o)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var Bf=(e,t)=>{for(var o in t)Dl(e,o,{get:t[o],enumerable:!0})};var tt=(e,t,o)=>Uf(e,typeof t!="symbol"?t+"":t,o),Ur=(e,t,o)=>t.has(e)||Al("Cannot "+o);var le=(e,t,o)=>(Ur(e,t,"read from private field"),o?o.call(e):t.get(e)),Le=(e,t,o)=>t.has(e)?Al("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),Ue=(e,t,o,r)=>(Ur(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o),qe=(e,t,o)=>(Ur(e,t,"access private method"),o);var Il=(e,t,o,r)=>({set _(s){Ue(e,t,s,o)},get _(){return le(e,t,r)}});var ve=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ye={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function Ol(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let o=new URLSearchParams(t);if([...o.keys()].length!==3||[...o.keys()].some(d=>!["clientId","intentId","token"].includes(d)))return null;let r=o.get("clientId"),s=o.get("intentId"),i=o.get("token");return!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{32}$/.test(s||"")||!/^[a-f0-9]{64}$/.test(i||"")?null:{contract:"4open.artifacts/1",clientId:r,intentId:s,token:i}}function Ml(e,t){let{http:o,promises:r,window:s}=t,i=t.takeReviewHandoff(),d=i?{clientId:i.clientId,intentId:i.intentId}:null,p,c,v,m,y,g=!0,C,w=r.defer(),S=()=>[...s.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:i?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>g&&e.user?.username===y;function b(){g=!1,i=p=c=void 0,w.resolve(),s.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let P=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),V=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!i||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,p=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,s.clearTimeout(C),m||(m=S());try{let j=(await o.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=j.csrf,e.handoffEnabled=j.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let ne=(await o.post("/api/review-consent/preview",{repositoryId:_,intent:{...i,requestId:m}},P())).data;if(!N())return;if(!ne||typeof ne.ticket!="string"||!ne.ticket||ne.ticket.length>8192||typeof ne.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
`))),e[bn]=zo(s);let i=r||s.props&&s.props.type==="number";Un(e,t?"change":"input",d=>{d.target.composing||e[bn](Ra(e.value,o,i))}),(o||i)&&Un(e,"change",()=>{e.value=Ra(e.value,o,i)}),t||(Un(e,"compositionstart",jh),Un(e,"compositionend",bu),Un(e,"change",bu))},mounted(e,{value:t,modifiers:{trim:o,number:r}}){let s=t??"",i=e[Ki];delete e[Ki],i!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==i?e[bn](Ra(e.value,o,r)):e.value=s},beforeUpdate(e,{value:t,oldValue:o,modifiers:{lazy:r,trim:s,number:i}},d){if(e[bn]=zo(d),e.composing)return;let p=(i||e.type==="number")&&!/^0\d/.test(e.value)?Lo(e.value):e.value,c=t??"";if(p===c)return;let v=e.getRootNode();(v instanceof Document||v instanceof ShadowRoot)&&v.activeElement===e&&e.type!=="range"&&(r&&t===o||s&&e.value.trim()===c)||(e.value=c)}},Pa={deep:!0,created(e,t,o){e[bn]=zo(o),Un(e,"change",()=>{let r=e._modelValue,s=zs(e),i=e.checked,d=e[bn];if(Ne(r)){let p=ki(r,s),c=p!==-1;if(i&&!c)d(r.concat(s));else if(!i&&c){let v=[...r];v.splice(p,1),d(v)}}else if(Zt(r)){let p=new Set(r);i?p.add(s):p.delete(s),d(p)}else d(Nu(e,i))})},mounted:wu,beforeUpdate(e,t,o){e[bn]=zo(o),wu(e,t,o)}};function wu(e,{value:t,oldValue:o},r){e._modelValue=t;let s;if(Ne(t))s=ki(t,r.props.value)>-1;else if(Zt(t))s=t.has(r.props.value);else{if(t===o)return;s=xt(t,Nu(e,!0))}e.checked!==s&&(e.checked=s)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:o}},r){e._modelValue=t,Un(e,"change",()=>{let s=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>o?Lo(zs(c)):zs(c)),i=e.multiple,d=i?Zt(e._modelValue)?new Set(s):s:s[0],p=e._pendingValue=[i,i?Ne(d)?s.slice():s:d];try{e[bn](d)}finally{Be(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[bn]=zo(r)},mounted(e,{value:t}){ku(e,t)},beforeUpdate(e,{value:t},o){e._modelValue=t,e[bn]=zo(o)},updated(e,{value:t}){let o=e._pendingValue;e._pendingValue=void 0,(!o||o[0]!==e.multiple||!Gh(t,o[1],o[0]))&&ku(e,t)}};function Gh(e,t,o){if(!o)return xt(e,t);if(Ne(e))return xt(e,t);if(Zt(e)){if(e.size!==t.length)return!1;for(let r of t)if(!e.has(r))return!1;return!0}return!1}function ku(e,t){let o=e.multiple,r=Ne(t);if(!(o&&!r&&!Zt(t))){for(let s=0,i=e.options.length;s<i;s++){let d=e.options[s],p=zs(d);if(o)if(r){let c=typeof p;c==="string"||c==="number"?d.selected=t.some(v=>String(v)===String(p)):d.selected=ki(t,p)>-1}else d.selected=t.has(p);else if(xt(zs(d),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!o&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function zs(e){return"_value"in e?e._value:e.value}function Nu(e,t){let o=t?"_trueValue":"_falseValue";return o in e?e[o]:t}var Wh=["ctrl","shift","alt","meta"],Kh={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Wh.some(o=>e[`${o}Key`]&&!t.includes(o))},ae=(e,t)=>{if(!e)return e;let o=e._withMods||(e._withMods={}),r=t.join(".");return o[r]||(o[r]=((s,...i)=>{for(let d=0;d<t.length;d++){let p=Kh[t[d]];if(p&&p(s,t))return}return e(s,...i)}))},Yh={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},_t=(e,t)=>{let o=e._withKeys||(e._withKeys={}),r=t.join(".");return o[r]||(o[r]=(s=>{if(!("key"in s))return;let i=dn(s.key);if(t.some(d=>d===i||Yh[d]===i))return e(s)}))},Jh=pt({patchProp:Bh},Nh),Cu;function Xh(){return Cu||(Cu=tu(Jh))}var Ru=((...e)=>{let t=Xh().createApp(...e),{mount:o}=t;return t.mount=r=>{let s=Zh(r);if(!s)return;let i=t._component;!Ae(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");let d=o(s,!1,Qh(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),d},t});function Qh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Zh(e){return at(e)?document.querySelector(e):e}var po=typeof document<"u";function Pu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function xh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Pu(e.default)}var Ze=Object.assign;function Ji(e,t){let o={};for(let r in t){let s=t[r];o[r]=Xt(s)?s.map(e):e(s)}return o}var jo=()=>{},Xt=Array.isArray;function Ia(e,t){let o={};for(let r in e)o[r]=r in t?t[r]:e[r];return o}var Du=/#/g,eg=/&/g,tg=/\//g,ng=/=/g,og=/\?/g,Au=/\+/g,sg=/%5B/g,ig=/%5D/g,Iu=/%5E/g,rg=/%60/g,Ou=/%7B/g,ag=/%7C/g,Mu=/%7D/g,lg=/%20/g;function Oa(e){return e==null?"":encodeURI(""+e).replace(ag,"|").replace(sg,"[").replace(ig,"]")}function Vu(e){return Oa(e).replace(Ou,"{").replace(Mu,"}").replace(Iu,"^")}function Da(e){return Oa(e).replace(Au,"%2B").replace(lg,"+").replace(Du,"%23").replace(eg,"%26").replace(rg,"`").replace(Ou,"{").replace(Mu,"}").replace(Iu,"^")}function dg(e){return Da(e).replace(ng,"%3D")}function ug(e){return OLine truncated
${JSON.stringify(e)}${t?`
while being at
`+JSON.stringify(t):""}`},[ut.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${ng(t)}" via a navigation guard.`},[ut.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[ut.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[ut.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function uo(e,t){return Ze(new Error,{type:e,[Iu]:!0},t)}function wn(e,t){return e instanceof Error&&Iu in e&&(t==null||!!(e.type&t))}var tg=["params","query","hash"];function ng(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of tg)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Ou(e){let t={};if(e===""||e==="?")return t;let s=(e[0]==="?"?e.slice(1):e).split("&");for(let i=0;i<s.length;++i){let o=s[i].replace(yu," "),r=o.indexOf("="),u=zo(r<0?o:o.slice(0,r)),f=r<0?null:zo(o.slice(r+1));if(u in t){let c=t[u];Xt(c)||(c=t[u]=[c]),c.push(f)}else t[u]=f}return t}function Ta(e){let t="";for(let s in e){let i=e[s];if(s=Wh(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(Xt(i)?i.map(o=>o&&ba(o)):[i&&ba(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function Mu(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=Xt(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}var Vu=Symbol(""),Pa=Symbol(""),Ji=Symbol(""),Xi=Symbol(""),Qi=Symbol("");function jo(){let e=[];function t(i){return e.push(i),()=>{let o=e.indexOf(i);o>-1&&e.splice(o,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function In(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((f,c)=>{let v=g=>{g===!1?c(uo(ut.NAVIGATION_ABORTED,{from:s,to:t})):g instanceof Error?c(g):eg(g)?c(uo(ut.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(u&&i.enterCallbacks[o]===u&&typeof g=="function"&&u.push(g),f())},h=r(()=>e.call(i&&i.instances[o],t,s,v)),y=Promise.resolve(h);e.length<3&&(y=y.then(v)),y.catch(g=>c(g))})}function Zi(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let f in u.components){let c=u.components[f];if(!(t!=="beforeRouteEnter"&&!u.instances[f]))if(gu(c)){let v=(c.__vccOpts||c)[t];v&&r.push(In(v,s,i,u,f,o))}else{let v=c();r.push(()=>v.then(h=>{if(!h)throw new Error(`Couldn't resolve component "${f}" at "${u.path}"`);let y=qh(h)?h.default:h;u.mods[f]=h,u.components[f]=y;let g=(y.__vccOpts||y)[t];return g&&In(g,s,i,u,f,o)()}))}}return r}function Lu(e,t){let s=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let u=0;u<r;u++){let f=t.matched[u];f&&(e.matched.find(v=>lo(v,f))?i.push(f):s.push(f));let c=e.matched[u];c&&(t.matched.find(v=>lo(v,c))||o.push(c))}return[s,i,o]}var og=()=>location.protocol+"//"+location.host;function Wu(e,t){let{pathname:s,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let u=o.includes(e.slice(r))?e.slice(r).length:1,f=o.slice(u);return f[0]!=="/"&&(f="/"+f),Sa(f,"")}return Sa(s,e)+i+o}function sg(e,t,s,i){let o=[],r=[],u=null,f=({state:g})=>{let C=Wu(e,location),w=s.value,S=t.value,N=0;if(g){if(s.value=C,t.value=g,u&&u===w){u=null;return}N=S?g.position-S.position:0}else i(C);o.forEach(b=>{b(s.value,w,{delta:N,type:Ki.pop,direction:N?N>0?Yi.forward:Yi.back:Yi.unknown})})};function c(){u=s.value}function v(g){o.push(g);let C=()=>{let w=o.indexOf(g);w>-1&&o.splice(w,1)};return r.push(C),C}function h(){if(document.visibilityState==="hidden"){let{history:g}=window;if(!g.state)return;g.replaceState(Ze({},g.state,{scroll:_s()}),"")}}function y(){for(let g of r)g();r=[],window.removeEventListener("popstate",f),window.removeEventListener("pagehide",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("popstate",f),window.addEventListener("pagehide",h),document.addEventListener("visibilitychange",h),{pauseListeners:c,listen:v,destroy:y}}function qu(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?_s():null}}function ig(e){let{history:t,location:s}=window,i={value:Wu(e,s)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(c,v,h){let y=e.indexOf("#"),g=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+c:og()+e+c;try{t[h?"replaceState":"pushState"](v,"",g),o.value=v}catch(C){console.error(C),s[h?"replace":"assign"](g)}}function u(c,v){r(c,Ze({},t.state,qu(o.value.back,c,o.value.forward,!0),v,{position:o.value.position}),!0),i.value=c}function f(c,v){let h=Ze({},o.value,t.state,{forward:c,scroll:_s()});r(h.current,h,!0),r(c,Ze({},qu(i.value,c,null),{position:h.position+1},v),!1),i.value=c}return{location:i,state:o,push:f,replace:u}}function Ku(e){e=Ru(e);let t=ig(e),s=sg(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=Ze({locatLine truncated
`).forEach((F,E)=>{for(let[L,W]of C){let j=L.exec(F);if(j&&!/^(if|for|while|switch|return|catch)$/.test(j[1])){I.push({name:j[1],kind:W,line:E+1});break}}}),w={content:e.content,list:I.slice(0,300)},w.list},e.goToSymbol=function(I){e.symbolsOpen=!1;let F=e.codeEditor;F&&(F.scrollToLine(I-1,!0,!0,()=>{}),F.gotoLine(I,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+I),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let I=window.document.getElementById("goto-input");I&&(I.focus(),I.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let I=e.codeEditor;if(!I)return;let F=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),E=I.session.getLength();if(!F||+F[1]<1||+F[1]>E){e.gotoError="Enter a line from 1 to "+E;return}I.gotoLine(+F[1],F[2]?Math.max(0,+F[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",I.focus()},e.rootEntries=function(){return[...e.files||[]].sort((I,F)=>{let E=I.size==null,L=F.size==null;return E!==L?E?-1:1:I.name.localeCompare(F.name)})},e.formatSize=function(I){if(I==null)return"";if(I<1024)return I+" B";let F=I/1024,E=L=>L.toFixed(1).replace(/\.0$/,"");return F<1024?E(F)+" KB":F<1024*1024?E(F/1024)+" MB":E(F/1024/1024)+" GB"},e.fileSize=function(I){if(!I)return null;let F=I.replace(/^\/+/,""),E=(e.files||[]).find(L=>(L.path?L.path+"/":"")+L.name===F);return E&&E.size!=null?E.size:null},e.revealFolder=function(I){e.sidebarHidden=!1,e.sidebarCollapsed=!1,ze(()=>{let F=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(I):I)+'"]');F&&(F.closest("li")?.classList.contains("open")||F.click(),F.scrollIntoView({block:"nearest"}),F.focus())})};let S={content:null,n:0},N=I=>{if(S.content===I)return S.n;let F=I;if(typeof F=="string")try{F=JSON.parse(F)}catch{F=null}let E=[],L=j=>{Array.isArray(j)?E.push(j.join("")):typeof j=="string"&&E.push(j)};(F&&(F.cells||(F.worksheets||[]).flatMap(j=>j.cells||[]))||[]).forEach(j=>{L(j?.source??j?.input),(j?.outputs||[]).forEach(Y=>{L(Y?.text),Y?.data&&(L(Y.data["text/plain"]),L(Y.data["text/markdown"]),L(Y.data["text/html"])),L(Y?.traceback)})});let W=E.reduce((j,Y)=>j+(Y.match(s)||[]).length,0);return S={content:I,n:W},W};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(s)||[]).length},e.renderRedacted=Bs;let b=I=>I.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(I){let F=e.renderRedacted(I);if(!F||typeof window.DOMParser!="function")return F;let E=new window.DOMParser().parseFromString("<div>"+F+"</div>","text/html"),L={};return E.querySelectorAll("h1, h2, h3").forEach(W=>{let j=W.id||b(W.textContent);L[j]?j+="-"+ ++L[j]:L[j]=1,W.id=j}),E.body.firstChild.innerHTML};let T={content:null,list:[]};e.readmeToc=function(){if(e.type!=="html"||typeof e.content!="string")return[];if(T.content===e.content)return T.list;let F=[...new window.DOMParser().parseFromString("<div>"+e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)+"</div>","text/html").querySelectorAll("h2, h3")].map(E=>({id:E.id,text:E.textContent.trim(),level:E.tagName==="H3"?3:2})).slice(0,40);return T={content:e.content,list:F},F},e.activeHeading=null,o(window,"scroll",()=>{let I=e.readmeToc?e.readmeToc():[];if(!I.length)return;let F=150,E="",L="";for(let W of I){let j=window.document.getElementById(W.id);if(!j)continue;let Y=j.getBoundingClientRect().top;Y<F?E=W.id:!L&&Y<window.innerHeight-80&&(L=W.id)}L&&(E=L),e.activeHeading!==E&&(e.activeHeading=E)},{capture:!0,passive:!0}),e.scrollToHeading=function(I){if(!I){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}let F=window.document.getElementById(I);F&&F.scrollIntoView({behavior:"smooth",block:"start"}),e.activeHeading=I},e.csvView="table";let M={content:null,rows:[]},_=(I,F)=>{let E=[],L=[],W="",j=!1;for(let Y=0;Y<I.length;Y++){let te=I[Y];j?te==='"'?I[Y+1]==='"'?(W+='"',Y++):j=!1:W+=te:te==='"'&&W===""?j=!0:te===F?(L.push(W),W=""):te===`
`||te==="\r"?(te==="\r"&&I[Y+1]===`
`&&Y++,L.push(W),E.push(L),L=[],W=""):W+=te}return(W!==""||L.length)&&(L.push(W),E.push(L)),E.filter(Y=>Y.length>1||Y[0]!=="")};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(M.content!==e.content){let I=/\.tsv$/i.test(e.filePath||"")?" ":",";M={content:e.content,rows:_(e.content,I)}}return M.rows},e.csvNumCol=I=>{let F=e.csvRows().slice(1).map(E=>E[I]).filter(E=>E!=null&&String(E).trim()!=="");return F.length>0&&F.every(E=>e.csvNumeric(E))},e.csvNumeric=I=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(I)&&/\d/.test(I),e.redactParts=function(I){let F=[],E=0,L,W=/\bXXXX-(\d+)\b/g;for(I=String(I||"");L=W.exec(I);)L.index>E&&F.push({t:I.slice(E,L.index)}),F.push({n:L[1]}),E=L.index+L[0].length;return E<I.length&&F.push({t:I.slice(E)}),F},e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let I=e.content;if(e.type==="html"&&e.url)if(e.preview)I=e.sourceContent;else try{I=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigator.clipboard.writeText(I),e.contentCopied=!0,setTimeout(()=>{e.contentCopied=!1},1600)};function H(I){return r[I]?r[I]:I}function oe(I){return I=="pdf"?"pdf":I=="html"||I=="htm"?"html-doc":["md","markdown","mdown","mkdn","mdx"].includes(I)?"md":I=="org"?"org":I=="ipynb"?"IPython":u.indexOf(I)>-1?"text":f.indexOf(I)>-1?"image":v.indexOf(I)>-1?"media":c.indexOf(I)>-1?"audio":"code"}e.downloadUrl=()=>e.preview?e.url:e.url+"&download=true",e.prepareFile=function(I){e.showSource=!1,e.allowScripts=!1,e.imageSize="",e.filePath=I,e.paths=I.split("/").filter(Boolean);let F=e.filePath.toLowerCase(),E=F.lastIndexOf(".");E>-1&&(F=F.substring(E+1));let L={javascript:"JavaScript",typescript:"TypeScript",tsx:"TSX",jsx:"JSX",python:"Python",java:"Java",c_cpp:"C/C++",csharp:"C#",golang:"Go",rust:"Rust",ruby:"Ruby",php:"PHP",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",yaml:"YAML",markdown:"Markdown",sh:"Shell",dockerfile:"Dockerfile",xml:"XML",sql:"SQL",kotlin:"Kotlin",swift:"Swift",scala:"Scala",r:"R",julia:"Julia",latex:"LaTeX",toml:"TOML",csv:"CSV",tsv:"TSV",text:""},W=H(F);e.languageName=L[W]??(W?W.charAt(0).toUpperCase()+W.slice(1):""),e.aceOption={readOnly:!0,useWrapMode:!0,showGutter:!0,theme:"chrome",useSoftTab:!0,tabSize:2,fontSize:window.matchMedia?.("(max-width: 767px)").matches?12:13,keyBinding:"vscode",fullLineSelection:!0,highlightActiveLine:!1,highlightGutterLine:!1,cursor:"hide",showInvisibles:!1,showIndentGuides:!1,showPrintMargin:!1,highlightSelectedWord:!1,enableBehaviours:!0,fadeFoldWidgets:!1,mode:H(F),onLoad:function(j){e.codeEditor=mn(j);{let Ne=j.session,_e=Ne.getTokens.bind(Ne),X=/\bXXXX-\d+\b/g;if(Ne.getTokens=function(pe){let se=_e(pe);if(!se.some(be=>be.value.indexOf("XXXX-")!==-1))return se;let me=[];for(let be of se){if(be.value.indexOf("XXXX-")===-1){me.push(be);continue}let Ie=0;X.lastIndex=0;let D;for(;D=X.exec(be.value);)D.index>Ie&&me.push({type:be.type,value:be.value.slice(Ie,D.index)}),me.push({type:"redacted.n"+D[0].slice(5),value:D[0]}),Ie=D.index+D[0].length;Ie<be.value.length&&me.push({type:be.type,value:be.value.slice(Ie)})}return me},!window.document.getElementById("redact-index-rules")){let pe=window.document.createElement("style");pe.id="redact-index-rules",pe.textContent=Array.from({length:99},(se,me)=>`.ace_redacted.ace_n${me+1}::after{content:"${me+1}"}`).join(""),window.document.head.appendChild(pe)}j.renderer.updateFull(!0)}j.session.setUseWrapMode(e.wrapLines!==!1);let Y=j.container.closest?.(".file-card"),te=()=>{if(!Y)return;let Ne=j.renderer,_e=(Ne.layerConfig?.width||0)-(Ne.$size?.scrollerWidth||0);Y.classList.toggle("at-right-edge",_e<=2||Ne.getScrollLeft()>=_e-2)};j.session.on("changeScrollLeft",te),j.renderer.on("afterRender",te),window.matchMedia?.("(max-width: 767px)").matches&&j.setOption("hScrollBarAlwaysVisible",!0);let ee=ace.require("ace/range").Range,fe=null;function ge(Ne,_e){fe!==null&&(j.session.removeMarker(fe),fe=null),Ne!=null&&(fe=j.session.addMarker(new ee(Ne,0,_e,1),"highlighted-line","fullLine"))}function Fe(Ne){let _e=!e.preview&&window.location.hash.match(/^#L(\d+)(?:-L(\d+))?/);if(!_e){ge(null);return}let X=parseInt(_e[1])-1,pe=_e[2]?parseInt(_e[2])-1:X;ge(X,pe),Ne&&i.timeout(()=>{j.scrollToLine(X,!0,!0,function(){})},100)}Fe(!0);let He=null;j.on("guttermousedown",function(Ne){let _e=Ne.getDocumentPosition().row,X=Ne.domEvent&&Ne.domEvent.shiftKey,pe=_e,se=_e;X&&He!==null?(pe=Math.min(He,_e),se=Math.max(He,_e)):He=_e;let me=pe===se?`#L${pe+1}`:`#L${pe+1}-L${se+1}`,be=window.location.pathname+window.location.search+me;e.preview||window.history.replaceState(null,"",be),ge(pe,se),Ne.stop()});let Ke=o(window,"hashc Line truncated
`);for(let y=0;y<h.length;y++){let g=h[y];if(g.startsWith("diff --git")){v(),c();continue}if(g.startsWith("--- ")){r&&r.lines.length&&v(),c().oldPath=g.replace(/^--- (a\/)?/,"").trim();continue}if(g.startsWith("+++ ")){c().newPath=g.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!(g.startsWith("index ")||g.startsWith("similarity index")||g.startsWith("rename ")||g.startsWith("new file mode")||g.startsWith("deleted file mode")||g.startsWith("Binary files"))){if(g.startsWith("@@")){let C=g.match(/@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);C&&(u=parseInt(C[1],10),f=parseInt(C[2],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:g});continue}r&&(g.startsWith("+")?(r.lines.push({kind:"add",oldNo:"",newNo:f,text:g.slice(1)}),f++):g.startsWith("-")?(r.lines.push({kind:"remove",oldNo:u,newNo:"",text:g.slice(1)}),u++):(r.lines.push({kind:"ctx",oldNo:u,newNo:f,text:g.startsWith(" ")?g.slice(1):g}),u++,f++))}}return s(o,r),o.join("")}})({trustAsHtml:e=>e});function Ma(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Ig(e,t="EUR"){let s=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:s%1?2:0,maximumFractionDigits:2}).format(s)}function Og(e){return String(e??"").toUpperCase()}function Mg(e,t,s=0){return(e||[]).slice(s,s+t)}function Vg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function Lg(e,t){if(!t)return e||[];let s=Array.isArray(t)?t:[t];return[...e||[]].sort((i,o)=>{for(let r of s){let u=r[0]==="-"?-1:1;r=r.replace(/^[+-]/,"");let f=r.split(".").reduce((v,h)=>v?.[h],i),c=r.split(".").reduce((v,h)=>v?.[h],o);if(typeof f=="string"&&(f=f.toLowerCase()),typeof c=="string"&&(c=c.toLowerCase()),f!==c)return(f==null?-1:c==null?1:f<c?-1:1)*u}return 0})}function sr(e,t){if(!e)return"";let s=new Date(e);if(isNaN(s))return String(e);if(!t||t==="mediumDate")return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let i={yyyy:s.getFullYear(),MMM:s.toLocaleDateString(void 0,{month:"short"}),MM:String(s.getMonth()+1).padStart(2,"0"),dd:String(s.getDate()).padStart(2,"0"),d:s.getDate(),HH:String(s.getHours()).padStart(2,"0"),mm:String(s.getMinutes()).padStart(2,"0"),ss:String(s.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,o=>i[o])}function qg(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function ir(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),s=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(s))return"";let i=s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),o=new Date;o.setHours(0,0,0,0);let r=Math.round((s-o)/864e5),u;if(r===0)u="today";else if(r===1)u="tomorrow";else if(r===-1)u="yesterday";else{let f=Math.abs(r),c=Math.round(f/30.44),v=f<14?[f,"day"]:f<60?[Math.round(f/7),"week"]:c<18?[c,"month"]:[Math.round(f/365.25),"year"],h=v[0]+" "+v[1]+(v[0]===1?"":"s");u=r>0?"in "+h:h+" ago"}return i+" \xB7 "+u}function _n(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let s=e/1e3;if(s<60)return+(s<10?s.toFixed(2):s.toFixed(1))+t+"s";let i=r=>String(r).padStart(2,"0"),o=Math.round(s);return o<3600?Math.floor(o/60)+"m "+i(o%60)+"s":Math.floor(o/3600)+"h "+i(Math.floor(o%3600/60))+"m"}function rr(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let s={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(s.year="numeric"),t.toLocaleDateString(void 0,s)}function Go(e){e.listLoading=!0,e.listLoaded===void 0&&(e.listLoaded=!1)}function La(e){e.listLoading=!1,e.listLoaded=!0}var lr=e=>["preparing","download","downloading","downloaded","queue","anonymizing"].includes(e)?"preparing":e==="expiring"?"expired":e==="removing"?"removed":e;function dr(e,{flags:t,keys:s,count:i,onChange:o=()=>{}}){if(e.segView=()=>{let r=t()||{};if(s.every(f=>!!r[f]))return"all";let u=s.filter(f=>!!r[f]);return u.length===1?u[0]:"custom"},e.setSegView=r=>{let u=t();if(u){for(let f of s)u[f]=r==="all"?!0:f===r;o()}},e.segCount=r=>r==="all"?s.reduce((u,f)=>u+i(f),0):i(r),t()&&e.segView()==="custom")for(let r of s)t()[r]=!0}var ec=function(e,t,s){let i=yt(),o=zt();ac(i,o),e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.repositories=[],e.total=-1,e.listLoaded=!1,e.listLoading=!0,e.totalPage=0,e.statusCounts=[],e.totalSize=0,e.selected={},e.allSelected=!1;let r=S=>{if(S.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){S.preventDefault();let N=document.querySelector('.admin-filter-toolbar input[type="search"]');N&&N.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=S=>{S==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[S]="",e.query.page=1},e.chips=[];let u=()=>{let S=[];e.query.owner&&S.push({key:" Line truncated
`+JSON.stringify(t):""}`},[ut.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${bg(t)}" via a navigation guard.`},[ut.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[ut.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[ut.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function co(e,t){return Ze(new Error,{type:e,[Hu]:!0},t)}function wn(e,t){return e instanceof Error&&Hu in e&&(t==null||!!(e.type&t))}var yg=["params","query","hash"];function bg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let o of yg)o in e&&(t[o]=e[o]);return JSON.stringify(t,null,2)}function ju(e){let t={};if(e===""||e==="?")return t;let o=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<o.length;++r){let s=o[r].replace(Au," "),i=s.indexOf("="),d=Ho(i<0?s:s.slice(0,i)),p=i<0?null:Ho(s.slice(i+1));if(d in t){let c=t[d];Xt(c)||(c=t[d]=[c]),c.push(p)}else t[d]=p}return t}function Fa(e){let t="";for(let o in e){let r=e[o];if(o=dg(o),r==null){r!==void 0&&(t+=(t.length?"&":"")+o);continue}(Xt(r)?r.map(s=>s&&Da(s)):[r&&Da(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+o,s!=null&&(t+="="+s))})}return t}function Gu(e){let t={};for(let o in e){let r=e[o];r!==void 0&&(t[o]=Xt(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}var Wu=Symbol(""),$a=Symbol(""),xi=Symbol(""),er=Symbol(""),tr=Symbol("");function Go(){let e=[];function t(r){return e.push(r),()=>{let s=e.indexOf(r);s>-1&&e.splice(s,1)}}function o(){e=[]}return{add:t,list:()=>e.slice(),reset:o}}function Mn(e,t,o,r,s,i=d=>d()){let d=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((p,c)=>{let v=g=>{g===!1?c(co(ut.NAVIGATION_ABORTED,{from:o,to:t})):g instanceof Error?c(g):vg(g)?c(co(ut.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(d&&r.enterCallbacks[s]===d&&typeof g=="function"&&d.push(g),p())},m=i(()=>e.call(r&&r.instances[s],t,o,v)),y=Promise.resolve(m);e.length<3&&(y=y.then(v)),y.catch(g=>c(g))})}function nr(e,t,o,r,s=i=>i()){let i=[];for(let d of e)for(let p in d.components){let c=d.components[p];if(!(t!=="beforeRouteEnter"&&!d.instances[p]))if(Pu(c)){let v=(c.__vccOpts||c)[t];v&&i.push(Mn(v,o,r,d,p,s))}else{let v=c();i.push(()=>v.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${d.path}"`);let y=xh(m)?m.default:m;d.mods[p]=m,d.components[p]=y;let g=(y.__vccOpts||y)[t];return g&&Mn(g,o,r,d,p,s)()}))}}return i}function Ku(e,t){let o=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let d=0;d<i;d++){let p=t.matched[d];p&&(e.matched.find(v=>uo(v,p))?r.push(p):o.push(p));let c=e.matched[d];c&&(t.matched.find(v=>uo(v,c))||s.push(c))}return[o,r,s]}var wg=()=>location.protocol+"//"+location.host;function sc(e,t){let{pathname:o,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let d=s.includes(e.slice(i))?e.slice(i).length:1,p=s.slice(d);return p[0]!=="/"&&(p="/"+p),Ma(p,"")}return Ma(o,e)+r+s}function kg(e,t,o,r){let s=[],i=[],d=null,p=({state:g})=>{let C=sc(e,location),w=o.value,S=t.value,N=0;if(g){if(o.value=C,t.value=g,d&&d===w){d=null;return}N=S?g.position-S.position:0}else r(C);s.forEach(b=>{b(o.value,w,{delta:N,type:Qi.pop,direction:N?N>0?Zi.forward:Zi.back:Zi.unknown})})};function c(){d=o.value}function v(g){s.push(g);let C=()=>{let w=s.indexOf(g);w>-1&&s.splice(w,1)};return i.push(C),C}function m(){if(document.visibilityState==="hidden"){let{history:g}=window;if(!g.state)return;g.replaceState(Ze({},g.state,{scroll:Hs()}),"")}}function y(){for(let g of i)g();i=[],window.removeEventListener("popstate",p),window.removeEventListener("pagehide",m),document.removeEventListener("visibilitychange",m)}return window.addEventListener("popstate",p),window.addEventListener("pagehide",m),document.addEventListener("visibilitychange",m),{pauseListeners:c,listen:v,destroy:y}}function Yu(e,t,o,r=!1,s=!1){return{back:e,current:t,forward:o,replaced:r,position:window.history.length,scroll:s?Hs():null}}function Cg(e){let{history:t,location:o}=window,r={value:sc(e,o)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(c,v,m){let y=e.indexOf("#"),g=y>-1?(o.host&&document.querySelector("base")?e:e.slice(y))+c:wg()+e+c;try{t[m?"replaceState":"pushState"](v,"",g),s.value=v}catch(C){console.error(C),o[m?"replace":"assign"](g)}}function d(c,v){i(c,Ze({},t.state,Yu(s.value.back,c,s.value.forward,!0),v,{position:s.value.position}),!0),r.value=c}function p(c,v){let m=Ze({},s.value,t.state,{forward:c,scroll:Hs()});i(m.current,m,!0),i(c,Ze({},Yu(r.value,c,null),{position:m.position+1},v),!1),r.value=c}return{location:r,state:s,push:p,replace:d}}function ic(e){e=$u(e);let t=Cg(e),o=kg(e,t.state,t.location,t.replace);function r(i,d=!0){d||o.pauseListeners(),history.go(i)}let s=Ze({locatLine truncated
`);for(let m of v){if(o&&(i>0||d>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)}),d--):m.startsWith("-")?(o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)}),i--):(o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.slice(1)}),i--,d--);continue}if(m.startsWith("diff --git")){p(),c();continue}if(m.startsWith("--- ")){o&&o.lines.length&&p(),c().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){c().newPath=m.replace(/^\+\+\+ (b\/)?/,"").trim();continue}if(!/^(index |similarity index|rename |new file mode|deleted file mode|Binary files)/.test(m)){if(m.startsWith("@@")){let y=m.match(/@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);y&&(r=parseInt(y[1],10),s=parseInt(y[3],10),i=y[2]==null?1:parseInt(y[2],10),d=y[4]==null?1:parseInt(y[4],10)),c().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(o)if(m.startsWith("+"))o.lines.push({kind:"add",oldNo:"",newNo:s++,text:m.slice(1)});else if(m.startsWith("-"))o.lines.push({kind:"remove",oldNo:r++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;o.lines.push({kind:"ctx",oldNo:r++,newNo:s++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var js=(e,t)=>{let o=[],r=[],s="",i=!1;for(let d=0;d<e.length;d++){let p=e[d];i?p==='"'?e[d+1]==='"'?(s+='"',d++):i=!1:s+=p:p==='"'&&s===""?i=!0:p===t?(r.push(s),s=""):p===`
`||p==="\r"?(p==="\r"&&e[d+1]===`
`&&d++,r.push(s),o.push(r),r=[],s=""):s+=p}return(s!==""||r.length)&&(r.push(s),o.push(r)),o.filter(d=>d.length>1||d[0]!=="")},Wo=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Yg=(function(){let e=o=>o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=o=>{let r=['<div class="diff-file-block">','<div class="diff-file-header"><span class="diff-file-icon"><i class="far fa-file-code"></i></span><span class="diff-file-name">'+e(o.path)+'</span><span class="diff-file-status diff-file-status-'+o.status+'">'+o.status+"</span></div>"];if(o.lines.length){r.push('<table class="diff-file-table"><tbody>');for(let s of o.lines)r.push('<tr class="diff-row diff-row-'+s.kind+'"><td class="diff-gutter diff-gutter-old">'+(s.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(s.newNo||"")+'</td><td class="diff-sign">'+(s.kind==="add"?"+":s.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Wo(s.text)+'ch">'+e(s.text)+"</td></tr>");r.push("</tbody></table>")}return r.push("</div>"),r.join("")};return o=>o&&cr(o).map(t).join("")})();function Ba(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function Jg(e,t="EUR"){let o=Number(e)||0;return new Intl.NumberFormat(void 0,{style:"currency",currency:t,minimumFractionDigits:o%1?2:0,maximumFractionDigits:2}).format(o)}function Xg(e){return String(e??"").toUpperCase()}function Qg(e,t,o=0){return(e||[]).slice(o,o+t)}function Zg(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function xg(e,t){if(!t)return e||[];let o=Array.isArray(t)?t:[t];return[...e||[]].sort((r,s)=>{for(let i of o){let d=i[0]==="-"?-1:1;i=i.replace(/^[+-]/,"");let p=i.split(".").reduce((v,m)=>v?.[m],r),c=i.split(".").reduce((v,m)=>v?.[m],s);if(typeof p=="string"&&(p=p.toLowerCase()),typeof c=="string"&&(c=c.toLowerCase()),p!==c)return(p==null?-1:c==null?1:p<c?-1:1)*d}return 0})}function pr(e,t){if(!e)return"";let o=new Date(e);if(isNaN(o))return String(e);if(!t||t==="mediumDate")return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});let r={yyyy:o.getFullYear(),MMM:o.toLocaleDateString(void 0,{month:"short"}),MM:String(o.getMonth()+1).padStart(2,"0"),dd:String(o.getDate()).padStart(2,"0"),d:o.getDate(),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),ss:String(o.getSeconds()).padStart(2,"0")};return t.replace(/yyyy|MMM|MM|dd|HH|mm|ss|d/g,s=>r[s])}function ev(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function fr(e){if(!e)return"";let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e)),o=t?new Date(+t[1],+t[2]-1,+t[3]):new Date(e);if(isNaN(o))return"";let r=o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),s=new Date;s.setHours(0,0,0,0);let i=Math.round((o-s)/864e5),d;if(i===0)d="today";else if(i===1)d="tomorrow";else if(i===-1)d="yesterday";else{let p=Math.abs(i),c=Math.round(p/30.44),v=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:c<18?[c,"month"]:[Math.round(p/365.25),"year"],m=v[0]+" "+v[1]+(v[0]===1?"":"s");d=i>0?"in "+m:m+" ago"}return r+" \xB7 "+d}function Bn(e){if(e==null||e===""||isNaN(e))return"";e=Number(e);let t="\u202F";if(e<1e3)return+(e<10?e.toFixed(2):e<100?e.toFixed(1):Math.round(e))+t+"ms";let o=e/1e3;if(o<60)return+(o<10?o.toFixed(2):o.toFixed(1))+t+"s";let r=i=>String(i).padStart(2,"0"),s=Math.round(o);return s<3600?Math.floor(s/60)+"m "+r(s%60)+"s":Math.floor(s/3600)+"h "+r(Math.floor(s%3600/60))+"m"}function mr(e){if(!e)return"";let t=new Date(e);if(isNaN(t))return"";let o={day:"numeric",month:"short"};return t.getFullYear()!==new Date().getFullYear()&&(o.year="numeric"),t.toLocaleDateString(void 0,o)}function uc(e,t){return t?.split(".").reduce((o,r)=>o?.[r],e)}function Gs(e=null,t=new Map){let o=rt({}),r=[],s=!1,i=new Proxy(o,{get(d,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(d,p)?Reflect.get(d,p):e?.[p]}});return Object.defineProperty(o,"parent",{value:e,configurable:!0}),Object.defineProperty(o,"viewState",{get:()=>i}),i.watch=(d,p,c=!1,v=!0)=>{let m=typeof d=="function"?()=>d(i):()=>uc(i,d),y=dt(m,p,{deep:c,flush:"post"});return r.push(y),v&&Be(()=>{s||p(m(),m())}),y},i.watchGroup=(d,p,c=!0)=>i.watch(()=>d.map(v=>uc(i,v)),p,!0,c),i.on=(d,p)=>{if(d==="dispose")return r.push(p),()=>{};t.has(d)||t.set(d,new Set),t.get(d).add(p);let c=()=>t.get(d)?.delete(p);return r.push(c),c},i.emit=(d,...p)=>{for(let c of[...t.get(d)||[]])c({},...p)},i.dispose=()=>{s=!0,r.splice(0).reverse().forEach(d=>d())},Pn(i.dispose),i}function yt(){let e=new Set,t=new Set,o=!1,r=(i,d=0)=>{if(o)return;let p=setTimeout(()=>{e.delete(p),i()},d);return e.add(p),p};r.cancel=i=>{clearTimeout(i),e.delete(i)};let s=(i,d)=>{if(o)return;let p=setInterval(i,d);return t.add(p),p};return s.cancel=i=>{clearInterval(i),t.delete(i)},Pn(()=>{o=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:r,interval:s}}function Ot(){let e=new Set;return P Line truncated
`).forEach((q,E)=>{for(let[F,Y]of C){let G=F.exec(q);if(G&&!/^(if|for|while|switch|return|catch)$/.test(G[1])){O.push({name:G[1],kind:Y,line:E+1});break}}}),w={content:e.content,list:O.slice(0,300)},w.list},e.goToSymbol=function(O){e.symbolsOpen=!1;let q=e.codeEditor;q&&(q.scrollToLine(O-1,!0,!0,()=>{}),q.gotoLine(O,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+O),window.dispatchEvent(new HashChangeEvent("hashchange")))},e.gotoLine=function(){e.codeEditor&&(e.moreOpen=!1,e.gotoError="",e.gotoValue=String(e.codeEditor.getCursorPosition().row+1),e.gotoOpen=!0,setTimeout(()=>{let O=window.document.getElementById("goto-input");O&&(O.focus(),O.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let O=e.codeEditor;if(!O)return;let q=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),E=O.session.getLength();if(!q||+q[1]<1||+q[1]>E){e.gotoError="Enter a line from 1 to "+E;return}O.gotoLine(+q[1],q[2]?Math.max(0,+q[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",O.focus()},e.rootEntries=function(){return[...e.files||[]].sort((O,q)=>{let E=O.size==null,F=q.size==null;return E!==F?E?-1:1:O.name.localeCompare(q.name)})},e.formatSize=function(O){if(O==null)return"";if(O<1024)return O+" B";let q=O/1024,E=F=>F.toFixed(1).replace(/\.0$/,"");return q<1024?E(q)+" KB":q<1024*1024?E(q/1024)+" MB":E(q/1024/1024)+" GB"},e.fileSize=function(O){if(!O)return null;let q=O.replace(/^\/+/,""),E=(e.files||[]).find(F=>(F.path?F.path+"/":"")+F.name===q);return E&&E.size!=null?E.size:null},e.revealFolder=function(O){e.sidebarHidden=!1,e.sidebarCollapsed=!1,Be(()=>{let q=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(O):O)+'"]');q&&(q.closest("li")?.classList.contains("open")||q.click(),q.scrollIntoView({block:"nearest"}),q.focus())})};let S={content:null,n:0},N=O=>{if(S.content===O)return S.n;let q=O;if(typeof q=="string")try{q=JSON.parse(q)}catch{q=null}let E=[],F=G=>{Array.isArray(G)?E.push(G.join("")):typeof G=="string"&&E.push(G)};(q&&(q.cells||(q.worksheets||[]).flatMap(G=>G.cells||[]))||[]).forEach(G=>{F(G?.source??G?.input),(G?.outputs||[]).forEach(x=>{F(x?.text),x?.data&&(F(x.data["text/plain"]),F(x.data["text/markdown"]),F(x.data["text/html"])),F(x?.traceback)})});let Y=E.reduce((G,x)=>G+(x.match(o)||[]).length,0);return S={content:O,n:Y},Y};e.redactionCount=function(){return e.type==="IPython"?N(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(o)||[]).length},e.renderRedacted=Ko;let b=O=>O.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(O){let q=e.renderRedacted(O);if(!q||typeof window.DOMParser!="function")return q;let E=new window.DOMParser().parseFromString("<div>"+q+"</div>","text/html"),F={};return E.querySelectorAll("h1, h2, h3").forEach(Y=>{let G=Y.id||b(Y.textContent);F[G]?G+="-"+ ++F[G]:F[G]=1,Y.id=G}),E.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},V=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let O=ar(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),q=O.length,E=null;if(O[0]?.level===1&&O.filter(F=>F.level===1).length===1){E=O[0],O=O.slice(1);let F=Math.min(...O.map(Y=>Y.level));O=O.map(Y=>({...Y,depth:Y.level-F}))}return P={content:e.content,list:O,title:E,count:q},P};e.readmeToc=()=>V().list,e.tocTitle=()=>V().title,e.tocCount=()=>V().count,e.activeHeading=null,s(window,"scroll",()=>{let O=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let q=lr(O.map(E=>E.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==q&&(e.activeHeading=q)},{capture:!0,passive:!0}),e.scrollToHeading=function(O){if(!O){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}dr(O),e.activeHeading=O},e.csvView="table";let _={content:null,rows:[]};e.isCsv=()=>typeof e.content=="string"&&e.type!=="html"&&/\.(csv|tsv)$/i.test(e.filePath||"")&&e.content.length<=1024*1024,e.csvRows=()=>{if(_.content!==e.content){let O=/\.tsv$/i.test(e.filePath||"")?" ":",";_={content:e.content,rows:js(e.content,O)}}return _.rows},e.csvNumCol=O=>{let q=e.csvRows().slice(1).map(E=>E[O]).filter(E=>E!=null&&String(E).trim()!=="");return q.length>0&&q.every(E=>e.csvNumeric(E))},e.csvNumeric=O=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(O)&&/\d/.test(O),e.redactParts=kn,e.pathCopied=!1,e.copyPath=async function(){window.navigator.clipboard?.writeText&&(await window.navigator.clipboard.writeText(e.filePath||""),e.pathCopied=!0,setTimeout(()=>{e.pathCopied=!1},1600))},e.contentCopied=!1,e.copyContent=async function(){if(typeof e.content!="string"||!window.navigator.clipboard?.writeText)return;let O=e.content;if(e.type== Line truncated
`).length:0,nv=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function pc(e,t){let o=Ot();e.redactParts=kn,e.hangIndent=Wo,e.isRedactedName=s=>/^XXXX-\d+$/.test(String(s||"").trim()),e.tocOpen=!1,e.activeAnchor="";let r=()=>{let s=t();if(!s.length)return;let i=lr(s,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==i&&(e.activeAnchor=i)};return o(window,"scroll",r,{capture:!0,passive:!0}),o(window,"resize",r,{passive:!0}),o(window.document,"click",s=>{e.tocOpen&&!s.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),o(window.document,"keydown",s=>{s.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=s=>{e.tocOpen=!1,dr(s)&&(e.activeAnchor=s)},r}var hr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),ov={md:"markdown",markdown:"markdown",mdx:"markdown",ipynb:"notebook",csv:"csv",tsv:"csv",svg:"svg",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",bmp:"image",ico:"image",avif:"image",pdf:"pdf",mp4:"video",webm:"video",mov:"video",m4v:"video",ogv:"video",mp3:"audio",wav:"audio",ogg:"audio",oga:"audio",m4a:"audio",flac:"audio",aac:"audio"},sv={svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",ico:"image/x-icon",avif:"image/avif",pdf:"application/pdf",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",m4v:"video/mp4",ogv:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",ogg:"audio/ogg",oga:"audio/ogg",m4a:"audio/mp4",flac:"audio/flac",aac:"audio/aac"},iv=1024*1024;function Yo(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=ov[hr(e?.filename)]||(e?.language==="Markdown"?"markdown":null);return e?.encoding==="base64"?["image","pdf","video","audio"].includes(t)&&e.content?t:"binary":e?.content?t==="csv"&&e.content.length>iv?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var rv=e=>["markdown","notebook","csv","svg"].includes(e),cc={markdown:"Markdown",notebook:"Jupyter notebook",csv:"Table",svg:"SVG",image:"Image",pdf:"PDF",video:"Video",audio:"Audio",binary:"Binary","too-large":"Too large",hidden:"Image"};function av(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||hr(e?.filename)||"none"}var lv=e=>{let t=window.atob(e||""),o=new Uint8Array(t.length);for(let r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o};function fc(e){e.gistViews={},e.gistKind=i=>Yo(e.details?.files?.[i]),e.gistHasRendered=i=>rv(e.gistKind(i)),e.gistView=i=>e.gistHasRendered(i)&&e.gistViews[i]!=="raw"?"rendered":"raw",e.setGistView=(i,d)=>{e.gistViews={...e.gistViews,[i]:d}},e.gistSourceFile=i=>{let d=e.details?.files?.[i];return{...d,language:av(d,e.gistKind(i)),filename:"source.txt"}};let t=new Map;Pn(()=>{t.forEach(i=>window.URL.revokeObjectURL?.(i)),t.clear()});let o=(i,d)=>{if(!i||!window.URL?.createObjectURL)return null;let p=i.encoding==="base64",c=!d||p?sv[hr(i.filename)]||(p?"application/octet-stream":"text/plain"):"text/plain",v=(i.filename||"")+"\0"+c+"\0"+(i.content||"").length;if(!t.has(v)){let m=p?lv(i.content):i.content||"";t.set(v,window.URL.createObjectURL(new window.Blob([m],{type:c+(p?"":";charset=utf-8")})))}return t.get(v)};e.gistMediaUrl=i=>o(i,!1),e.gistRawUrl=i=>o(i,!0);let r={content:null,rows:[]};e.gistCsvRows=i=>(r.content!==i?.content&&(r={content:i?.content,rows:js(i?.content||"",hr(i?.filename)==="tsv"?" ":",")}),r.rows),e.gistCsvNumeric=(i,d)=>{let p=e.gistCsvRows(i).slice(1).map(c=>c[d]).filter(c=>c!=null&&String(c).trim()!=="");return p.length>0&&p.every(c=>/^\s*[-+]?(\d[\d,]*)?(\.\d+)?(e[-+]?\d+)?%?\s*$/i.test(c)&&/\d/.test(c))},e.gistCopied=null,e.copyGistFile=async i=>{let d=e.details?.files?.[i];!d||d.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(d.content||""),e.gistCopied=i,window.setTimeout(()=>{e.gistCopied===i&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=i=>"file-"+(i+1),e.setFileOutline=(i,d)=>{let p=e.fileOutlines[i];p&&p.map(c=>c.id).join()===d.map(c=>c.id).join()||(e.fileOutlines={...e.fileOutlines,[i]:d})},e.gistToc=()=>(e.details?.files||[]).map((i,d)=>({id:e.gistFileId(d),index:d,parts:kn(i.filename),kind:Yo(i),language:cc[Yo(i)]&&Yo(i)!=="csv"?cc[Yo(i)]:i.language||(Yo(i)==="csv"?"CSV":"Text"),lines:i.encoding==="base64"?null:tv(i.content),size:i.size,headings:nv(i)&&e.gistView(d)==="rendered"?e.fileOutlines[d]||[]:[]}));let s=()=>e.gistToc().flatMap(i=>[i.id,...i.headings.map(d=>d.id)]);e.showGistToc=()=>{let i=e.gistToc();return e.tabState?.active==="files"&&(i.length>=2||(i[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let d=e.gistToc().find(p=>p.id===e.activeAnchor||p.headings.some(c=>c.id===e.activeAnchor));return d?d.index:0},pc(e,s)}var dv=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function mc(e){let t={diff:null,threads:null,files:[]};e.prFiles=()=>{let o=e.details?.diff,r=e.details?.reviewComments| Line truncated
`),p=r.date?e.fmt?.date(r.date):"",c=o[o.length-1];(!c||c.day!==p)&&o.push(c={day:p,commits:[]}),c.commits.push({...r,index:s+1,headline:i,detail:d.join(`
`).trim()})}),o},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let o=e.prFiles().find(r=>r.id===e.activeAnchor);return o?o.index:0},e.openTab=o=>{e.tabState={active:o},e.tocOpen=!1},e.showInDiff=o=>{o&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},Be(()=>e.jumpToAnchor(o.id)))},e.jumpToFile=o=>{e.collapsedFiles={...e.collapsedFiles,[o.index]:!1},e.jumpToAnchor(o.id)},pc(e,()=>e.tabState?.active==="files"?e.prFiles().map(o=>o.id):[])}function hc(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function ja(e,t,o){let r,s=!1,i="form-draft:"+o,d=()=>Object.fromEntries(t.map(g=>[g,e[g]])),p=()=>JSON.stringify(d()),c=g=>{for(let C of t)Object.prototype.hasOwnProperty.call(g,C)&&(e[C]=g[C]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},v=()=>{try{window.sessionStorage.removeItem(i)}catch{}},m=(g=!1)=>{if(r!==void 0){if(g&&document.querySelectorAll("input, select, textarea").forEach(C=>{C._field?.binding.state===e&&C._field.timer&&C._field.commit()}),e.unsavedChanges=p()!==r,e.draftSaved=!1,!e.unsavedChanges){v();return}try{window.sessionStorage.setItem(i,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:d()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){r=p();let g;try{g=JSON.parse(window.sessionStorage.getItem(i)||"null")}catch{}let C=g&&g.account===(e.user?.username||null)&&Date.now()-g.savedAt<30*6e4&&g.values;return C&&(c(g.values),e.draftRestored=!0),s||(s=!0,e.watch(()=>d(),()=>m(),!0)),e.unsavedChanges=p()!==r,!!C},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state===e&&g._field.timer&&g._field.commit()}),JSON.parse(p())},accept(g){r=JSON.stringify(g),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(g=>{g._field?.binding.state!==e||!g._field.timer||(clearTimeout(g._field.timer),g._field.timer=null,g.value=g._field.binding.value??"")}),r!==void 0&&c(JSON.parse(r)),e.draftRestored=!1,m()},clear(){r=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,v()}}}function gc(e,t){e.errorSource="central",e.logView={search:"",severity:"",sort:"recent"},e.selectedLog=null,e.logDetailTab="overview",e.logSeverity=y=>Number(y?.status||y?.httpStatus)>=500||["error","fatal"].includes(y?.severity)?"error":y?.severity==="warn"?"warn":"info",e.filteredLogGroups=()=>{let y=e.logView.search.trim().toLowerCase();return(e.logData?.groups||[]).filter(g=>(!e.logView.severity||e.logSeverity(g.sample)===e.logView.severity)&&(!y||Object.values(g.sample).join(" ").toLowerCase().includes(y))).slice().sort((g,C)=>e.logView.sort==="count"?C.count-g.count:Date.parse(C.last)-Date.parse(g.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,g)=>typeof g=="string"&&g.length>16&&/(?:id|sha|release)$/i.test(y),e.compactLogValue=y=>String(y).slice(0,8)+"\u2026"+String(y).slice(-4),e.logCopyStatus="",e.copyLogValue=async y=>{try{await navigator.clipboard.writeText(String(y)),e.logCopyStatus="Full value copied"}catch{e.logCopyStatus="Copy unavailable. Expand the value to select it."}},e.logExplanation=y=>{let g=y.service||"The application",C={job_failed:"reported a failed job",request_failed:"reported a failed request",request_aborted:"reported an aborted request",edge_request:"recorded an edge request",http_access:"recorded an HTTP request"}[y.event]||"recorded \u201C"+(y.event||"application event")+"\u201D",w=Number(y.status||y.httpStatus),S={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[w];return g+" "+C+(w?" with HTTP "+w+(S?" ("+S+")":""):"")+"."},e.logEvidence=y=>[y.errorCode?"Recorded error code: "+y.errorCode+".":"No error code was included in this sample.",y.ms!==void 0?"Recorded duration: "+y.ms+" ms.":"",y.attempt!==void 0?"Recorded attempt: "+y.attempt+".":"",y.queue?"Queue: "+y.queue+".":""].filter(Boolean).join(" "),e.occurrenceTime=y=>Number.isFinite(Date.parse(y))?new Date(y).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"medium"}):"Time not captured",e.historyOccurrences=y=>(y?._related||[]).slice().sort((g,C)=>Date.parse(C.ts)-Date.parse(g.ts)),e.historyDetailFields=y=>{try{let g=JSON.parse(y?._detailJson||"{}");return g&&typeof g=="object"?Object.entries(g):[["value",g]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let g=[];for(let C=y?.parentElement;C;C=C.parentElement)g.push({element:C,top:C.scrollTop,left:C.scrollLeft});return g},e.restoreErrorScroll=y=>y.forEach(({element:g,top:C,left:w})=>{g.isConnected&&(g.scrollTop=C,g.scrollLeft=w)});let o=null,r=null,s=null,i=[];e.selectLog=async(y,g)=>{if(r=g||document.activeElement, Line truncated
`+S.join(`
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=i.username+"-repositories.csv",b.click()},e.showStatusMessage=g=>{let C=g.statusMessage||"(no message)";window.prompt(`Status message for ${g.repoId} (${g.status}):`,C)},e.fetchGithubInfo=g=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+g.repoId+"...</pre>"),t.get("/api/admin/repos/"+g.repoId+"/github").then(w=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,S=>S==="<"?"&lt;":"&gt;")+"</pre>"),C.document.close())},w=>{let S=w&&w.data?JSON.stringify(w.data,null,2):String(w);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+S+"</pre>")})};function c(g){t.get("/api/admin/users/"+g+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function v(g){t.get("/api/admin/users/"+g,{}).then(C=>{e.userInfo=C.data},C=>{console.error(C)})}v(i.username),c(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>v(i.username),g=>console.error(g))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>v(i.username),g=>console.error(g))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>v(i.username),g=>console.error(g))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>v(i.username),g=>console.error(g))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function h(){t.get("/api/admin/tokens").then(g=>{e.tokens=g.data||[]},g=>{g.status!==401&&g.status!==403&&console.error(g)})}h(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(g=>{e.tokenForm.plaintext=g.data.token,e.tokenForm.name="",h()},g=>console.error(g))},e.revokeToken=g=>{confirm(`Revoke token "${g.name}"?`)&&t.delete("/api/admin/tokens/"+g.id).then(()=>h(),C=>console.error(C))},e.removeCache=g=>{confirm("Remove cached files for "+g.repoId+"?")&&t.delete("/api/admin/repos/"+g.repoId).then(()=>c(i.username),C=>console.error(C))},e.removeRepository=g=>{confirm("Remove repository "+g.repoId+"?")&&t.delete("/api/repo/"+g.repoId+"/").then(()=>c(i.username),C=>console.error(C))},e.updateRepository=g=>{let C=rt({title:`Refreshing ${g.repoId}...`,date:new Date,body:`The repository ${g.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${g.repoId}/refresh`).then(w=>{w.data.status=="ready"?C.title=`${g.repoId} is refreshed.`:C.title=`Refreshing of ${g.repoId}.`},w=>{C.title=`Error during the refresh of ${g.repoId}.`,C.body=w.body})},e.getGitHubRepositories=g=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{c(i.username)},500)},!0)},oc=function(e,t,s){let i=yt(),o=zt();e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),e.conferences=[],e.total=-1,e.listLoaded=!1,e.listLoading=!0,e.totalPage=0,e.statusCounts=[];let r=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let S=document.querySelector('.admin-filter-toolbar input[type="search"]');S&&S.focus()}};o(document,"keydown",r),e.on("dispose",()=>document.removeEventListener("keydown",r)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let u=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let S=(e.statusCounts||[]).find(N=>N._id===w);return S?S.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let f="admin.conferences.filterPrefs",c={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},v=loadFilterPrefs(f)||{};e.query=Object.assign({},c,v,{page:1,search:""});let h=s.search();h.search&&(e.query.search=h.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let S=Object.assign({},e.query);delete S.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:S}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(S=>S.name!== Line truncated
`):typeof z.stack=="string"?z.stack:null;for(var I=[z.cause,z.err].filter(Boolean),F=0;!L&&F<I.length;F++)for(var E=I[F];!L&&E&&typeof E=="object";)typeof E.stack=="string"&&(L=E.stack),E=E.cause;q._stack=L}else q.displayMessage=q.message,q._status=null,q._url=null,q._stack=null;return q._bucket=g(z,q.level),q._detailJson=w(q,z),q}function w(q,z){let I=[],F=(j,Y)=>{Y==null||Y===""||I.push([j,Y])};for(let j of["service","event","severity","requestId","jobId"])F(j,z&&z[j]);F("name",z&&z.name),F("code",q.displayMessage||z&&z.message),q._bucket&&F("kind",q._bucket),F("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&F("status",z.status),F("module",q.module);let E=z&&z.detail;if(typeof E=="string"){let j=E.trim();if(j[0]==="{"||j[0]==="[")try{E=JSON.parse(E)}catch{}}if(F("detail",E),F("repoId",z&&z.repoId),F("filePath",z&&z.filePath),F("upstreamStatus",z&&z.upstreamStatus),F("upstreamBody",z&&z.upstreamBody),F("url",q._url),F("err",z&&z.err),F("cause",z&&!z.err&&z.cause),F("ts",q.ts),!I.length)return JSON.stringify(q,null,2);let L=I.reduce((j,Y)=>Math.max(j,Y[0].length),0),W=["{"];return I.forEach(([j,Y],te)=>{let fe=` ${`"${j}":`.padEnd(L+3," ")} `,ge=te<I.length-1?",":"",Fe;if(Y&&typeof Y=="object"){let He=" ".repeat(fe.length);Fe=JSON.stringify(Y,null,2).split(`
`).map((Ke,Be)=>Be===0?Ke:He+Ke).join(`
`)}else typeof Y=="number"||typeof Y=="boolean"?Fe=String(Y):Fe=JSON.stringify(Y);W.push(`${fe}${Fe}${ge}`)}),W.push("}"),W.join(`
`)}function S(q){let z=[],I="",F=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,L;for(;L=F.exec(q);)I+=q.slice(E,L.index),E=F.lastIndex,z.push({key:L[1],op:L[2]||"=",val:L[3]});return I+=q.slice(E),{filters:z,free:I.trim().toLowerCase()}}function N(q,z){for(let I of z.filters){let F=(L,W,j)=>{let Y=parseFloat(L),te=parseFloat(W);return j==="="?String(L)===String(W):j==="!="?String(L)!==String(W):j===">="?Y>=te:j==="<="?Y<=te:j===">"?Y>te:j==="<"?Y<te:!0},E;if(I.key==="code")E=q.displayMessage;else if(I.key==="module")E=q.module;else if(I.key==="status")E=q._status;else if(I.key==="url")E=q._url;else if(I.key==="repo")E=q._repoId;else if(I.key==="level")E=q.level;else continue;if(E==null||!F(E,I.val,I.op))return!1}return!(z.free&&((q.displayMessage||"")+" "+(q.module||"")+" "+(q._url||"")+" "+JSON.stringify(q.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let q=S(e.query.search||"");e.parsedFilterCount=q.filters.length;let z=e.query.bucket,I=e.entries.filter(j=>z&&j._bucket!==z?!1:N(j,q)),F=e.query.group;if(F){let j=ee=>JSON.stringify(F==="module"?[ee.module,ee._bucket]:[ee.raw?.[0]?.service||"unknown",ee.module,ee.displayMessage||ee.message||"_",ee._bucket,ee._status]),Y=new Map;for(let ee of I){let fe=j(ee);if(Y.has(fe)){let ge=Y.get(fe);ge.count++,ge._related.push(ee),new Date(ee.ts)>new Date(ge.ts)&&(ge.ts=ee.ts,ge._url=ee._url,ge._status=ee._status),new Date(ee.ts)<new Date(ge._firstSeen)&&(ge._firstSeen=ee.ts)}else{let ge=Object.assign({},ee);ge._key=`${F}:${fe}`,ge._related=[ee],ge._firstSeen=ee.ts,ge._lastHourCount=0,ge.count=1,Y.set(fe,ge)}}let te=Date.now()-3600*1e3;for(let ee of Y.values())ee._lastHourCount=ee._related.filter(fe=>new Date(fe.ts).getTime()>=te).length;I=Array.from(Y.values())}else I=I.map((j,Y)=>(j._key="row:"+Y+":"+j.ts,j._related=[j],j._firstSeen=j.ts,j._lastHourCount=0,j.count=1,j));let E=j=>({error:0,warn:1,info:2})[j._bucket]??1;e.query.sort==="count"?I.sort((j,Y)=>E(j)-E(Y)||Y.count-j.count||new Date(Y.ts)-new Date(j.ts)):I.sort((j,Y)=>E(j)-E(Y)||new Date(Y.ts)-new Date(j.ts)),e.visible=I;let L=!!(e.query.bucket||(e.query.search||"").trim()),W=!L&&(e.stats?.severity?.error||0)>0&&!I.some(j=>j._bucket==="error")&&e.entries.length<1500;(L&&!I.length||W)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,T(!0))}function T(q){if(q&&e.redisLoading)return;let z=++o;e.redisLoading=!0;let I=q?e.redisNextOffset||e.entries.length:0,F=q?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:I,limit:F}}).then(E=>{if(f||z!==o)return;e.redisLoading=!1;let L=(E.data.entries||[]).map(C);e.entries=q?e.entries.concat(L):L,e.redisRedacted=(q&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??I+(E.data.entries||[]).length,e.available=!!E.data.available,e.redisCollecting=E.data.redisCollecting!==!1,e.cap=E.data.max||e.cap,e.total=E.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{f||z!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>T(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function M(q=!1){if(q&&u)return;let z=++r;u=!0,t.get("/api/admin/errors/stats").then(I=>{if(f||z!==r)return;u=!1;let F=I.data||{};e.redisStatsState=F.available===!1?"unavailable":"ready";let E=F.prev24h?Math.round((F.last24h-F.prev24h)/F.prev24h*100):0;e.stats={last24h:F.last24h||0,prev24h:F.prev24h||0,delta:E,severity:F.severity||{error:0,warn:0,info:0},unique:F.unique||{error:0,warn:0,info:0},buckets:F.buckets||[],dropped:F.dropped||0},b()},()=>{!f&&z===r&&(u=!1,e.redisStatsState="unavailable")})}function _(q=!1){(!q||!e.redisLoading)&&T(),M(q)}e.barPx=(q,z)=>{let I=e.stats.buckets||[],F=0,E=0;for(let Y of I)F=Math.max(F,(Y.error||0)+(Y.warn||0)),E=Math.max(E,Y.info||0);let L=q[z]||0;if(!L)return 0;if(z==="info")return E?Math.max(2,Math.round(L/E*(F?16:60))):0;let W=(q.error||0)+(q.warn||0),j=Math.round(W/F*44);return Math.max(4,Math.round(L/W*j))},e.bucketTitle=q=>`${new Date(q.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${q.error||0} err \xB7 ${q.warn||0} warn \xB7 ${q.info||0} info`,e.toggle=async(q,z)=>{v=z||document.activeElement,h=e.captureErrorScroll(v),e.historySelected=q,e.historyView="overview",e.expanded={[q._key]:!0},await ze(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=q=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(I=>e.logTraceId(e.historySelected,I));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),q,e.historySelected)},e.closeHistory=async()=>{let q=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await ze(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(I=>I.dataset.historyKey===q))?.focus({preventScroll:!0}),e.restoreError Line truncated
`)],{type:"text/csv;charset=utf-8"}),F=URL.createObjectURL(I),E=document.createElement("a");E.href=F,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(F)};function H(q){e.copyHint=`${q} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=q=>{navigator.clipboard.writeText(q._rawJson).then(()=>H("JSON"))},e.copyCurl=q=>{if(!q._url)return;let I=`curl -X ${q._method||"GET"} '${window.location.origin}${q._url}'`;navigator.clipboard.writeText(I).then(()=>H("curl"))},_();let oe=i(()=>{e.query.autoRefresh&&_(!0)},15e3);e.on("dispose",()=>{f=!0,o++,r++,i.cancel(oe)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},rc=function(e,t,s,i){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null){s.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(b){e.ovView=b;try{window.history.replaceState(null,"",b==="summary"?window.location.pathname:"#"+b)}catch{}};var o=!1;e.loadCache=function(){if(!o){o=!0;var b=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:b}}).then(function(T){b===e.cacheMinutes&&(e.cacheReport=T.data,e.cacheError=T.data.available?null:T.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){o=!1,b!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(b){return e.cacheTraffic==="all"||b.traffic===e.cacheTraffic})},e.cacheRate=function(b,T){var M=e.cacheRows(),_=function(q){return M.filter(function(z){return z.name===q}).reduce(function(z,I){return z+I[T]},0)},H=_(b+"_hit"),oe=_(b+"_miss");return H+oe?(100*H/(H+oe)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var T=0,M=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var _=0;_<=M.length;_++)if(T+=b["b"+_]||0,T>=Math.ceil(b.count*.95))return _<M.length?"\u2264 "+_n(M[_]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},T=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,_])=>_>90);return T.length?T.map(([_,H])=>_+" is at "+H+"%").join(" and ")+". New anonymizations may fail until "+(T.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":_n(b)},e.latencyBound=function(b,T){return b.count?b[T]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[T]):"No samples"},e.firstByteBound=function(b){return e.latencyBound({count:b.firstByteCount,p95UpperMs:b.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(b){return Math.max(0,Math.round((Date.now()-b.sampledAt)/1e3))},e.peakRss=function(b){return(e.performance.runtimeSeries||[]).filter(function(T){return T.instance===b.instance}).reduce(function(T,M){return Math.max(T,M.rss)},b.memory.rss)},e.performanceWarning=function(b){return e.sampleAge(b)>45||b.droppedBatches||b.droppedMetrics||b.sockets?.closeWait>0||b.eventLoop?.p95Ms>100||b.memoryLimitBytes&&b.memory.rss>b.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var b=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==b&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:b}}).then(function(T){b===e.performanceMinutes&&(e.performance=T.data,e.performanceError=T.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){b===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,b!==e.performanceMinutes&&e.loadPerformance()}))};function u(b){if(b==null)return"\u2014";for(var T=["B","KB","MB","GB","TB"],M=0,_=b;_>=1024&&M<T.length-1;)_/=1024,M++;return _.toFixed(M>0?1:0).replace(/\.0$/,"")+" "+T[M]}e.humanBytes=u;function f(b){if(!b)return"\u2014";var T=Math.floor(b/86400),M=Math.floor(b%86400/3600),_=Math.floor(b%3600/60);return T>0?T+"d "+(M<10?"0":"")+M+"h":M>0?M+"h "+(_<10?"0":"")+_+"m":_+"m"}e.humanDuration=f;function c(b){return b==null?"\u2014":b>=1e6?(b/1e6).toFixed(1)+"M":b>=1e3?(b/1e3).toFixed(1)+"K":String(b)}e.humanNum=c,e.queueTotal=function(b){return b?(b.waiting||0)+(b.active||0)+(b.delayed||0)+(b.failed||0):0},e.statusCount=function(b){if(!e.data||!e.data.repos)return 0;for(var T=e.data.repos.statusBreakdown||[],M=0;M<T.length;M++)if(T[M]._id===b)return T[M].count;return 0},e.barPct=function(b){var T=e.data&&e.data.repos?e.data.repos.total:0;if(!T)return 0;var M=[b];b==="expired"&&M.push("expiring"),b==="remov Line truncated
`)},e.tipSide=w=>{let S=(e.summary?.series||[]).length;return S<3?"":w<S/4?"tip-start":w>=S*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,S)=>w+e.bucketTotal(S),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>(ar.find(S=>S.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(S=>S.family===w),e.familySum=(w,S)=>e.familyPlans(w).reduce((N,b)=>N+(b[S]||0),0),e.familyMoney=(w,S,N)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(w);return b.some(T=>T[N]===!1)?"Incomplete":e.moneyText(b.reduce((T,M)=>r(T,M[S]),{}))},e.planTotals=()=>{let w=S=>(e.summary?.plans||[]).reduce((N,b)=>N+(b[S]||0),0);return{active:w("active"),sales:w("sales"),allTimeSales:w("allTimeSales")}},e.webhookState=()=>{let w=e.summary?.webhooks;return w?w.failed||w.reconciliationFailed?"bad":w.oldestPendingSeconds>900||w.unreviewedRevocations?"warn":"ok":"ok"},e.age=w=>w?_n(w*1e3):"\u2014";let u=0;e.loadSummary=()=>{let w=++u;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(S=>{if(w!==u)return;e.summaryLoading=!1;let N=S.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},S=>{w===u&&(e.summaryLoading=!1,e.summaryError=S&&S.data&&S.data.error||"Could not load billing figures.")})},e.setPeriod=w=>{if(e.period!==w){e.period=w;try{localStorage.setItem("admin.billing.period",w)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let f=s.search();f.search&&(e.query.search=f.search),e.stateView=()=>e.query.state||"all",e.setStateView=w=>{e.query.state=w==="all"?"":w,e.query.page=1},e.stateCount=w=>w==="all"?["active","expired","revoked"].reduce((S,N)=>S+(e.stateCounts[N]||0),0):e.stateCounts[w]||0,e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let c=()=>{let w=[];e.query.plan&&w.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&w.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&w.push({key:"period",label:"Started",value:"last "+((e.periods.find(S=>S.id===e.query.period)||{}).label||e.query.period)}),e.chips=w};e.clearFilter=w=>{e.query[w]="",e.query.page=1},e.filterPlan=w=>{Object.assign(e.query,{plan:w,page:1});let S=document.getElementById("bl-grants");S&&S.scrollIntoView&&S.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",period:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state||e.query.period),e.filterCount=()=>["plan","status","period"].filter(w=>e.query[w]).length,e.amountText=w=>{if(!w.amount)return"\u2014";let S=fo({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return S;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return S+" / "+N},e.amountTitle=w=>w.amount?"Stripe list price"+(w.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[w.amountMissing]||"Revenue unavailable.",e.endText=w=>{if(w.never)return"Never ends";if(!w.until)return"\u2014";let S=sr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+S:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+S:"Until "+S},e.packNote=w=>{let S=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!S||!S.until?"":(new Date(S.until)<new Date?"Updates ended ":"Updates until ")+sr(S.until)};let v={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(S=>v[S.planId]||e.planName(S.planId)).join(", ").replace(/^./,S=>S.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(S=>e.planName(S.planId)).join(", "),e.statusText=w=>(w.status||"unknown").replace(/_/g," "),e.revocationText=w=>w==="dispute"?"Disputed":w==="full_refund"?"Refunded":"Revoked",e.scopeHref=w=>w?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(w.id):w?.kind==="conference"?"/conference/"+encodeURIComponent(w.id):null;let h=0;function y(){let w=++h;e.grantsError=null;let S=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:S}).then(N=>{w===h&&( Line truncated
`)},Ha=class{constructor(t){tt(this,"gen");tt(this,"threads",[]);tt(this,"match",!1);tt(this,"runs",[]);tt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Ec=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((s,i)=>s!==t.ids[i])?!1:e.runs.every(s=>t.runs.some(i=>i.neg===s.neg&&Ec(i.state,s.state))),vc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),ho,Gn,ja,Ga,Gs=class{constructor(t,s,i){Le(this,Gn);tt(this,"dots");tt(this,"dotStart");Le(this,ho);this.dots=t,this.dotStart=s,Ue(this,ho,i)}state(){return new Ha(++ae(this,ho).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(za.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!qe(this,Gn,ja).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!qe(this,Gn,ja).call(this,t,s))return;let r=this.state();return this.add(r,s.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:s,state:r},i,o);case"star":if(this.restricted(i,o))return;qe(this,Gn,Ga).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:qe(this,Gn,Ga).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&Ec(r.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,o)}step(t,s,i,o){let r=this.state();for(let u of t.threads)switch(u.t){case"lit":Ya(u,s)&&this.add(r,u.next,i+1,o);break;case"any":this.restricted(i,o)||this.add(r,u.next,i+1,o);break;case"class":!this.restricted(i,o)&&u.re.test(s)&&this.add(r,u.next,i+1,o);break;case"star":this.restricted(i,o)||this.add(r,u,i+1,o)}if(!this.restricted(i,o))for(let u of t.runs){if(u.state.dead){this.addRun(r,u,i+1,o);continue}let f=this.step(u.state,s,i,!1);this.addRun(r,{t:"run",neg:u.neg,state:f},i+1,o)}return this.done(r)}};ho=new WeakMap,Gn=new WeakSet,ja=function(t,s){let{seen:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Ga=function(t,s){let{has:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var Nc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${Nc(i.state)})`);return`${t}|${s.sort().join("|")}`},vv=1<<18,Wo,Ko,Un,go,Bn,zn,Hn,an,Ka,pr,Rc,Wa=class{constructor(t,s){Le(this,an);Le(this,Wo);Le(this,Ko,new Map);Le(this,Un,0);Le(this,go);Le(this,Bn);Le(this,zn);Le(this,Hn);Ue(this,Wo,t),Ue(this,zn,new Gs(!1,!1,s)),Ue(this,Hn,new Gs(!1,!0,s))}start(t){if(t){if(ae(this,Bn))return ae(this,Bn);let i=ae(this,Hn).state();return ae(this,Hn).add(i,ae(this,Wo),0,!0),Ue(this,Bn,qe(this,an,Ka).call(this,ae(this,Hn).done(i)))}if(ae(this,go))return ae(this,go);let s=ae(this,zn).state();return ae(this,zn).add(s,ae(this,Wo),0,!0),Ue(this,go,qe(this,an,pr).call(this,ae(this,zn).done(s)))}next(t,s){let i=s.charCodeAt(0),o=i<128?void 0:t.next.get(s);if(o)return o;let r=t===ae(this,Bn)?qe(this,an,pr).call(this,ae(this,Hn).step(t.state,s,0,!0)):qe(this,an,pr).call(this,ae(this,zn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ue(this,Un,ae(this,Un)+128)),t.ascii[i]=r):t.next.set(s,r),bl(this,Un)._++,r}};Wo=new WeakMap,Ko=new WeakMap,Un=new WeakMap,go=new WeakMap,Bn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,an=new WeakSet,Ka=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},pr=function(t){let s=Nc(t),i=ae(this,Ko).get(s);if(i)return i;ae(this,Un)>vv&&qe(this,an,Rc).call(this);let o=qe(this,an,Ka).call(this,t);return ae(this,Ko).set(s,o),Ue(this,Un,ae(this,Un)+(s.length+1)),o},Rc=function(){ae(this,Ko).clear(),Ue(this,Un,0),Ue(this,go,void 0),Ue(this,Bn,void 0)};var yv=e=>{let t=[];for(let s=e;s.t!=="match";s=s.next){if(s.t==="split"||s.t==="neg")return;t.push(s)}return t},bv=(e,t,s,i)=>{let o=0,r=s,u=-1,f=0;for(;r<i;){let c=e[o];if(c?.t==="star"){u=o++,f=r;continue}let v=t[r];if(c&&(c.t==="any"||c.t==="lit"&&Ya(c,v)||c.t==="class"&&c.re.test(v))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++f}for(;e[o]?.t==="star";)o++;return o===e.length},Tc=e=>{let t=0,s=0;for(let i of e){let[o,r]=wv(i);t+=o,s+=r}return[t,s]},wv=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(Tc),s=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),o=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,o]:[s,o]},yc=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Ya(e[i],t[s+i]))return!1;return!0},kv=/[/\ud800-\udfff]/,Cv=/[\ud800-\udfff]/,cr=e=>Cv.test(e)?[...e]:e,bc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},jn,Yo,vo,fr,yo,Ks,mr,bo,Ys,Js,Xs,Mn,kn,Jo,Xo,Qs,hr,rn,wo,js,Ws=class{constructor(t,s={}){Le(this,wo);tt(this,"pattern");tt(this,"options");Le(this,jn);Le(this,Yo);Le(this,vo);Le(this,fr);Le(this,yo);Le(this,Ks,!1);Le(this,mr);Le(this,bo);Le(this,Ys,!1);Le(this,Js,0);Le(this,Xs,1/0);Le(this,Mn,[]);Le(this,kn,[]);Le(this,Jo);Le(this,Xo);Le(this,Qs,!1);Le(this,hr);Le(this,rn);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:o}=rl(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}jc.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function Wc(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:o}=rl(i.trim());if(!o)return e;let r="";for(let f=0;f<o.length;f++){if(o[f]==="\\"){r+=o.slice(f,f+2),f++;continue}r+=jc.has(o[f])||o[f]==="."?"\\"+o[f]:o[f]}let u=i.indexOf(o);return s[t]=i.slice(0,u)+r+i.slice(u+o.length),s.join(`
`)}var Qn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",cache_miss:"This file is not cached yet. Please try again.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_no Line truncated
`)),e.options=Object.assign({},e.options,y.options),f.restore()})}c();let v=null;e.saveDefault=h=>{if(h&&h.preventDefault&&h.preventDefault(),e.saving)return;let y=f.checkpoint(),g={terms:e.terms.split(`
`).map(C=>C.trim()).filter(C=>C.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",g).then(()=>{f.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",v&&i.cancel(v),v=i(()=>{e.message=null},2500)},C=>{e.saving=!1;let w=C&&C.data&&C.data.error,S="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+w),s("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?N:S},()=>{e.error=S})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},xc=function(e,t,s){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(i=>{s.url("/dashboard")},i=>{e.error=i.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},ep=function(e,t,s,i,o){e.user&&!e.user.status&&s.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&s.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(f){e.feature=f},e.featureHref=function(f){return f.needsUser&&!e.user?"/signin":f.href},e.featureTarget=function(f){return f.needsUser&&!e.user?"_self":f.target||void 0},e.featureKeydown=function(f,c){let v={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[f.key];if(v===void 0)return;f.preventDefault();let h=e.features.length,y=v==="first"?0:v==="last"?h-1:(c+v+h)%h;e.feature=e.features[y].key,o(()=>{let g=i.document.getElementById("feature-tab-"+e.feature);g&&g.focus()})},e.demoText=`# DeepLearnUtils
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=r.username+"-repositories.csv",b.click()},e.showStatusMessage=g=>{let C=g.statusMessage||"(no message)";window.prompt(`Status message for ${g.repoId} (${g.status}):`,C)},e.fetchGithubInfo=g=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+g.repoId+"...</pre>"),t.get("/api/admin/repos/"+g.repoId+"/github").then(w=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,S=>S==="<"?"&lt;":"&gt;")+"</pre>"),C.document.close())},w=>{let S=w&&w.data?JSON.stringify(w.data,null,2):String(w);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+S+"</pre>")})};function c(g){t.get("/api/admin/users/"+g+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function v(g){t.get("/api/admin/users/"+g,{}).then(C=>{e.userInfo=C.data},C=>{console.error(C)})}v(r.username),c(r.username),e.banUser=()=>{confirm(`Ban user ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/ban`).then(()=>v(r.username),g=>console.error(g))},e.activateUser=()=>{t.post(`/api/admin/users/${r.username}/activate`).then(()=>v(r.username),g=>console.error(g))},e.promoteUser=()=>{confirm(`Promote ${r.username} to admin?`)&&t.post(`/api/admin/users/${r.username}/promote`).then(()=>v(r.username),g=>console.error(g))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${r.username}?`)&&t.post(`/api/admin/users/${r.username}/demote`).then(()=>v(r.username),g=>console.error(g))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(g=>{e.tokens=g.data||[]},g=>{g.status!==401&&g.status!==403&&console.error(g)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(g=>{e.tokenForm.plaintext=g.data.token,e.tokenForm.name="",m()},g=>console.error(g))},e.revokeToken=g=>{confirm(`Revoke token "${g.name}"?`)&&t.delete("/api/admin/tokens/"+g.id).then(()=>m(),C=>console.error(C))},e.removeCache=g=>{confirm("Remove cached files for "+g.repoId+"?")&&t.delete("/api/admin/repos/"+g.repoId).then(()=>c(r.username),C=>console.error(C))},e.removeRepository=g=>{confirm("Remove repository "+g.repoId+"?")&&t.delete("/api/repo/"+g.repoId+"/").then(()=>c(r.username),C=>console.error(C))},e.updateRepository=g=>{let C=rt({title:`Refreshing ${g.repoId}...`,date:new Date,body:`The repository ${g.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${g.repoId}/refresh`).then(w=>{w.data.status=="ready"?C.title=`${g.repoId} is refreshed.`:C.title=`Refreshing of ${g.repoId}.`},w=>{C.title=`Error during the refresh of ${g.repoId}.`,C.body=w.body})},e.getGitHubRepositories=g=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let y=null;e.watch("query",()=>{s.timeout.cancel(y),y=s.timeout(()=>{c(r.username)},500)},!0)},wc=function(e,t,o){let r=yt(),s=Ot();e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),e.conferences=[],e.total=-1,e.listLoaded=!1,e.listLoading=!0,e.totalPage=0,e.statusCounts=[];let i=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let S=document.querySelector('.admin-filter-toolbar input[type="search"]');S&&S.focus()}};s(document,"keydown",i),e.on("dispose",()=>document.removeEventListener("keydown",i)),e.clearFilter=w=>{w==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[w]="",e.query.page=1},e.chips=[];let d=()=>{let w=[];(e.query.dateFrom||e.query.dateTo)&&w.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=w};e.statusCountFor=w=>{let S=(e.statusCounts||[]).find(N=>N._id===w);return S?S.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",c={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},v=loadFilterPrefs(p)||{};e.query=Object.assign({},c,v,{page:1,search:""});let m=o.search();m.search&&(e.query.search=m.search);let y="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(y)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let S=Object.assign({},e.query);delete S.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:S}),localStorage.setItem(y,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(S=>S.name!== Line truncated
`):typeof z.stack=="string"?z.stack:null;for(var O=[z.cause,z.err].filter(Boolean),q=0;!F&&q<O.length;q++)for(var E=O[q];!F&&E&&typeof E=="object";)typeof E.stack=="string"&&(F=E.stack),E=E.cause;L._stack=F}else L.displayMessage=L.message,L._status=null,L._url=null,L._stack=null;return L._bucket=g(z,L.level),L._detailJson=w(L,z),L}function w(L,z){let O=[],q=(G,x)=>{x==null||x===""||O.push([G,x])};for(let G of["service","event","severity","requestId","jobId"])q(G,z&&z[G]);q("name",z&&z.name),q("code",L.displayMessage||z&&z.message),L._bucket&&q("kind",L._bucket),q("httpStatus",z&&z.httpStatus),z&&z.status&&!z.httpStatus&&q("status",z.status),q("module",L.module);let E=z&&z.detail;if(typeof E=="string"){let G=E.trim();if(G[0]==="{"||G[0]==="[")try{E=JSON.parse(E)}catch{}}if(q("detail",E),q("repoId",z&&z.repoId),q("filePath",z&&z.filePath),q("upstreamStatus",z&&z.upstreamStatus),q("upstreamBody",z&&z.upstreamBody),q("url",L._url),q("err",z&&z.err),q("cause",z&&!z.err&&z.cause),q("ts",L.ts),!O.length)return JSON.stringify(L,null,2);let F=O.reduce((G,x)=>Math.max(G,x[0].length),0),Y=["{"];return O.forEach(([G,x],re)=>{let fe=` ${`"${G}":`.padEnd(F+3," ")} `,ge=re<O.length-1?",":"",$e;if(x&&typeof x=="object"){let He=" ".repeat(fe.length);$e=JSON.stringify(x,null,2).split(`
`).map((Ye,ze)=>ze===0?Ye:He+Ye).join(`
`)}else typeof x=="number"||typeof x=="boolean"?$e=String(x):$e=JSON.stringify(x);Y.push(`${fe}${$e}${ge}`)}),Y.push("}"),Y.join(`
`)}function S(L){let z=[],O="",q=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,F;for(;F=q.exec(L);)O+=L.slice(E,F.index),E=q.lastIndex,z.push({key:F[1],op:F[2]||"=",val:F[3]});return O+=L.slice(E),{filters:z,free:O.trim().toLowerCase()}}function N(L,z){for(let O of z.filters){let q=(F,Y,G)=>{let x=parseFloat(F),re=parseFloat(Y);return G==="="?String(F)===String(Y):G==="!="?String(F)!==String(Y):G===">="?x>=re:G==="<="?x<=re:G===">"?x>re:G==="<"?x<re:!0},E;if(O.key==="code")E=L.displayMessage;else if(O.key==="module")E=L.module;else if(O.key==="status")E=L._status;else if(O.key==="url")E=L._url;else if(O.key==="repo")E=L._repoId;else if(O.key==="level")E=L.level;else continue;if(E==null||!q(E,O.val,O.op))return!1}return!(z.free&&((L.displayMessage||"")+" "+(L.module||"")+" "+(L._url||"")+" "+JSON.stringify(L.raw||[])).toLowerCase().indexOf(z.free)===-1)}function b(){let L=S(e.query.search||"");e.parsedFilterCount=L.filters.length;let z=e.query.bucket,O=e.entries.filter(G=>z&&G._bucket!==z?!1:N(G,L)),q=e.query.group;if(q){let G=ee=>JSON.stringify(q==="module"?[ee.module,ee._bucket]:[ee.raw?.[0]?.service||"unknown",ee.module,ee.displayMessage||ee.message||"_",ee._bucket,ee._status]),x=new Map;for(let ee of O){let fe=G(ee);if(x.has(fe)){let ge=x.get(fe);ge.count++,ge._related.push(ee),new Date(ee.ts)>new Date(ge.ts)&&(ge.ts=ee.ts,ge._url=ee._url,ge._status=ee._status),new Date(ee.ts)<new Date(ge._firstSeen)&&(ge._firstSeen=ee.ts)}else{let ge=Object.assign({},ee);ge._key=`${q}:${fe}`,ge._related=[ee],ge._firstSeen=ee.ts,ge._lastHourCount=0,ge.count=1,x.set(fe,ge)}}let re=Date.now()-3600*1e3;for(let ee of x.values())ee._lastHourCount=ee._related.filter(fe=>new Date(fe.ts).getTime()>=re).length;O=Array.from(x.values())}else O=O.map((G,x)=>(G._key="row:"+x+":"+G.ts,G._related=[G],G._firstSeen=G.ts,G._lastHourCount=0,G.count=1,G));let E=G=>({error:0,warn:1,info:2})[G._bucket]??1;e.query.sort==="count"?O.sort((G,x)=>E(G)-E(x)||x.count-G.count||new Date(x.ts)-new Date(G.ts)):O.sort((G,x)=>E(G)-E(x)||new Date(x.ts)-new Date(G.ts)),e.visible=O;let F=!!(e.query.bucket||(e.query.search||"").trim()),Y=!F&&(e.stats?.severity?.error||0)>0&&!O.some(G=>G._bucket==="error")&&e.entries.length<1500;(F&&!O.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(L){if(L&&e.redisLoading)return;let z=++s;e.redisLoading=!0;let O=L?e.redisNextOffset||e.entries.length:0,q=L?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:O,limit:q}}).then(E=>{if(p||z!==s)return;e.redisLoading=!1;let F=(E.data.entries||[]).map(C);e.entries=L?e.entries.concat(F):F,e.redisRedacted=(L&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??O+(E.data.entries||[]).length,e.available=!!E.data.available,e.redisCollecting=E.data.redisCollecting!==!1,e.cap=E.data.max||e.cap,e.total=E.data.total||e.entries.length,e._autoLoading=!1,b()},()=>{p||z!==s||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function V(L=!1){if(L&&d)return;let z=++i;d=!0,t.get("/api/admin/errors/stats").then(O=>{if(p||z!==i)return;d=!1;let q=O.data||{};e.redisStatsState=q.available===!1?"unavailable":"ready";let E=q.prev24h?Math.round((q.last24h-q.prev24h)/q.prev24h*100):0;e.stats={last24h:q.last24h||0,prev24h:q.prev24h||0,delta:E,severity:q.severity||{error:0,warn:0,info:0},unique:q.unique||{error:0,warn:0,info:0},buckets:q.buckets||[],dropped:q.dropped||0},b()},()=>{!p&&z===i&&(d=!1,e.redisStatsState="unavailable")})}function _(L=!1){(!L||!e.redisLoading)&&P(),V(L)}e.barPx=(L,z)=>{let O=e.stats.buckets||[],q=0,E=0;for(let x of O)q=Math.max(q,(x.error||0)+(x.warn||0)),E=Math.max(E,x.info||0);let F=L[z]||0;if(!F)return 0;if(z==="info")return E?Math.max(2,Math.round(F/E*(q?16:60))):0;let Y=(L.error||0)+(L.warn||0),G=Math.round(Y/q*44);return Math.max(4,Math.round(F/Y*G))},e.bucketTitle=L=>`${new Date(L.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${L.error||0} err \xB7 ${L.warn||0} warn \xB7 ${L.info||0} info`,e.toggle=async(L,z)=>{v=z||document.activeElement,m=e.captureErrorScroll(v),e.historySelected=L,e.historyView="overview",e.expanded={[L._key]:!0},await Be(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=L=>{if(e.historyView="timeline",e.traceSelection)return;let z=["requestId","jobId"].find(O=>e.logTraceId(e.historySelected,O));z&&e.lookupTrace(z,e.logTraceId(e.historySelected,z),L,e.historySelected)},e.closeHistory=async()=>{let L=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await Be(),(v?.isConnected?v:[...document.querySelectorAll("[data-history-key]")].find(O=>O.dataset.historyKey===L))?.focus({preventScroll:!0}),e.restoreError Line truncated
`)],{type:"text/csv;charset=utf-8"}),q=URL.createObjectURL(O),E=document.createElement("a");E.href=q,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(q)};function j(L){e.copyHint=`${L} copied`,c.timeout(()=>{e.copyHint=""},1500)}e.copyJson=L=>{navigator.clipboard.writeText(L._rawJson).then(()=>j("JSON"))},e.copyCurl=L=>{if(!L._url)return;let O=`curl -X ${L._method||"GET"} '${window.location.origin}${L._url}'`;navigator.clipboard.writeText(O).then(()=>j("curl"))},_();let ne=r(()=>{e.query.autoRefresh&&_(!0)},15e3);e.on("dispose",()=>{p=!0,s++,i++,r.cancel(ne)}),e.watch("query.search",b),e.watch("query.bucket",b),e.watch("query.sort",b),e.watch("query.group",b)},Sc=function(e,t,o,r){if(e.Math=Math,e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null){o.url("/");return}e.data=null,e.loading=!0,e.error=null,e.performance=null,e.performanceMinutes=15,e.performanceTab="routes",e.cacheReport=null,e.cacheError=null,e.cacheMinutes=60,e.cacheTraffic="all",e.ovView=["performance","cache"].includes((window.location.hash||"").slice(1))?window.location.hash.slice(1):"summary",e.setOvView=function(b){e.ovView=b;try{window.history.replaceState(null,"",b==="summary"?window.location.pathname:"#"+b)}catch{}};var s=!1;e.loadCache=function(){if(!s){s=!0;var b=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:b}}).then(function(P){b===e.cacheMinutes&&(e.cacheReport=P.data,e.cacheError=P.data.available?null:P.data.reason||"Cache monitoring is unavailable.")},function(){e.cacheError="Could not refresh cache monitoring. Displayed values may be stale."}).finally(function(){s=!1,b!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(b){return e.cacheTraffic==="all"||b.traffic===e.cacheTraffic})},e.cacheRate=function(b,P){var V=e.cacheRows(),_=function(L){return V.filter(function(z){return z.name===L}).reduce(function(z,O){return z+O[P]},0)},j=_(b+"_hit"),ne=_(b+"_miss");return j+ne?(100*j/(j+ne)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(b){return b.replaceAll("_"," ")},e.cacheP95=function(b){var P=0,V=e.cacheReport?.latencyBucketsMs||[];if(!b.count)return"No samples";if(!b.ms)return"Not timed";for(var _=0;_<=V.length;_++)if(P+=b["b"+_]||0,P>=Math.ceil(b.count*.95))return _<V.length?"\u2264 "+Bn(V[_]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let b=e.data&&e.data.system||{},P=[["Memory",b.memPercent],["Disk",b.diskPercent]].filter(([,_])=>_>90);return P.length?P.map(([_,j])=>_+" is at "+j+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(b){return b==null?"":Bn(b)},e.latencyBound=function(b,P){return b.count?b[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(b[P]):"No samples"},e.firstByteBound=function(b){return e.latencyBound({count:b.firstByteCount,p95UpperMs:b.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(b){return Math.max(0,Math.round((Date.now()-b.sampledAt)/1e3))},e.peakRss=function(b){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===b.instance}).reduce(function(P,V){return Math.max(P,V.rss)},b.memory.rss)},e.performanceWarning=function(b){return e.sampleAge(b)>45||b.droppedBatches||b.droppedMetrics||b.sockets?.closeWait>0||b.eventLoop?.p95Ms>100||b.memoryLimitBytes&&b.memory.rss>b.memoryLimitBytes*.8};var i=!1;e.loadPerformance=function(){var b=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==b&&(e.performance=null),!i&&(i=!0,t.get("/api/admin/performance",{params:{minutes:b}}).then(function(P){b===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){b===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){i=!1,b!==e.performanceMinutes&&e.loadPerformance()}))};function d(b){if(b==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],V=0,_=b;_>=1024&&V<P.length-1;)_/=1024,V++;return _.toFixed(V>0?1:0).replace(/\.0$/,"")+" "+P[V]}e.humanBytes=d;function p(b){if(!b)return"\u2014";var P=Math.floor(b/86400),V=Math.floor(b%86400/3600),_=Math.floor(b%3600/60);return P>0?P+"d "+(V<10?"0":"")+V+"h":V>0?V+"h "+(_<10?"0":"")+_+"m":_+"m"}e.humanDuration=p;function c(b){return b==null?"\u2014":b>=1e6?(b/1e6).toFixed(1)+"M":b>=1e3?(b/1e3).toFixed(1)+"K":String(b)}e.humanNum=c,e.queueTotal=function(b){return b?(b.waiting||0)+(b.active||0)+(b.delayed||0)+(b.failed||0):0},e.statusCount=function(b){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],V=0;V<P.length;V++)if(P[V]._id===b)return P[V].count;return 0},e.barPct=function(b){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var V=[b];b==="expired"&&V.push("expiring"),b==="remov Line truncated
`)},e.tipSide=w=>{let S=(e.summary?.series||[]).length;return S<3?"":w<S/4?"tip-start":w>=S*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,S)=>w+e.bucketTotal(S),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>(gr.find(S=>S.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(S=>S.family===w),e.familySum=(w,S)=>e.familyPlans(w).reduce((N,b)=>N+(b[S]||0),0),e.familyMoney=(w,S,N)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(w);return b.some(P=>P[N]===!1)?"Incomplete":e.moneyText(b.reduce((P,V)=>i(P,V[S]),{}))},e.planTotals=()=>{let w=S=>(e.summary?.plans||[]).reduce((N,b)=>N+(b[S]||0),0);return{active:w("active"),sales:w("sales"),allTimeSales:w("allTimeSales")}},e.webhookState=()=>{let w=e.summary?.webhooks;return w?w.failed||w.reconciliationFailed?"bad":w.oldestPendingSeconds>900||w.unreviewedRevocations?"warn":"ok":"ok"},e.age=w=>w?Bn(w*1e3):"\u2014";let d=0;e.loadSummary=()=>{let w=++d;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(S=>{if(w!==d)return;e.summaryLoading=!1;let N=S.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},S=>{w===d&&(e.summaryLoading=!1,e.summaryError=S&&S.data&&S.data.error||"Could not load billing figures.")})},e.setPeriod=w=>{if(e.period!==w){e.period=w;try{localStorage.setItem("admin.billing.period",w)}catch{}e.loadSummary()}},e.grants=[],e.total=-1,e.totalPage=0,e.stateCounts={},e.statuses=[],e.grantsError=null,e.filtersOpen=!1,e.query={page:1,limit:25,search:"",plan:"",status:"",state:"",period:"",sort:"purchasedAt",direction:"desc"};let p=o.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=w=>{e.query.state=w==="all"?"":w,e.query.page=1},e.stateCount=w=>w==="all"?["active","expired","revoked"].reduce((S,N)=>S+(e.stateCounts[N]||0),0):e.stateCounts[w]||0,e.sortBy=w=>{e.query.sort===w?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=w,e.query.direction="desc"),e.query.page=1},e.sortIcon=w=>e.query.sort===w?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let c=()=>{let w=[];e.query.plan&&w.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&w.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&w.push({key:"period",label:"Started",value:"last "+((e.periods.find(S=>S.id===e.query.period)||{}).label||e.query.period)}),e.chips=w};e.clearFilter=w=>{e.query[w]="",e.query.page=1},e.filterPlan=w=>{Object.assign(e.query,{plan:w,page:1});let S=document.getElementById("bl-grants");S&&S.scrollIntoView&&S.scrollIntoView({behavior:"smooth",block:"start"})},e.clearFilters=()=>Object.assign(e.query,{search:"",plan:"",status:"",state:"",period:"",page:1}),e.hasFilters=()=>!!(e.query.search||e.query.plan||e.query.status||e.query.state||e.query.period),e.filterCount=()=>["plan","status","period"].filter(w=>e.query[w]).length,e.amountText=w=>{if(!w.amount)return"\u2014";let S=mo({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return S;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return S+" / "+N},e.amountTitle=w=>w.amount?"Stripe list price"+(w.pack?" of the whole pack":""):{stripe_not_configured:"Revenue unavailable: Stripe is not configured on this server.",unresolved:"Revenue unavailable: this Stripe price could not be looked up.",unrecorded:"Revenue unavailable: no sale price was recorded for this subscription."}[w.amountMissing]||"Revenue unavailable.",e.endText=w=>{if(w.never)return"Never ends";if(!w.until)return"\u2014";let S=pr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+S:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+S:"Until "+S},e.packNote=w=>{let S=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!S||!S.until?"":(new Date(S.until)<new Date?"Updates ended ":"Updates until ")+pr(S.until)};let v={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(S=>v[S.planId]||e.planName(S.planId)).join(", ").replace(/^./,S=>S.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(S=>e.planName(S.planId)).join(", "),e.statusText=w=>(w.status||"unknown").replace(/_/g," "),e.revocationText=w=>w==="dispute"?"Disputed":w==="full_refund"?"Refunded":"Revoked",e.scopeHref=w=>w?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(w.id):w?.kind==="conference"?"/conference/"+encodeURIComponent(w.id):null;let m=0;function y(){let w=++m;e.grantsError=null;let S=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:S}).then(N=>{w===m&&( Line truncated
`)},xa=class{constructor(t){tt(this,"gen");tt(this,"threads",[]);tt(this,"match",!1);tt(this,"runs",[]);tt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Bc=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((o,r)=>o!==t.ids[r])?!1:e.runs.every(o=>t.runs.some(r=>r.neg===o.neg&&Bc(r.state,o.state))),Vc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),go,Kn,el,tl,Js=class{constructor(t,o,r){Le(this,Kn);tt(this,"dots");tt(this,"dotStart");Le(this,go);this.dots=t,this.dotStart=o,Ue(this,go,r)}state(){return new xa(++le(this,go).gen)}done(t){return t.ids=t.threads.map(o=>o.id).sort((o,r)=>o-r),t.match&&t.ids.unshift(Za.id),t}restricted(t,o){return o&&(this.dots||this.dotStart&&t===0)}add(t,o,r,s){switch(o.t){case"split":if(!qe(this,Kn,el).call(this,t,o))return;for(let d of o.out)this.add(t,d,r,s);return;case"neg":if(!qe(this,Kn,el).call(this,t,o))return;let i=this.state();return this.add(i,o.sub,r,!1),this.done(i),this.addRun(t,{t:"run",neg:o,state:i},r,s);case"star":if(this.restricted(r,s))return;qe(this,Kn,tl).call(this,t,o)&&this.add(t,o.next,r,s);return;case"match":t.match=!0;return;default:qe(this,Kn,tl).call(this,t,o)}}addRun(t,o,r,s){for(let i of t.runs)if(i.neg===o.neg&&Bc(i.state,o.state))return;t.runs.push(o),o.state.match||this.add(t,o.neg.next,r,s)}step(t,o,r,s){let i=this.state();for(let d of t.threads)switch(d.t){case"lit":sl(d,o)&&this.add(i,d.next,r+1,s);break;case"any":this.restricted(r,s)||this.add(i,d.next,r+1,s);break;case"class":!this.restricted(r,s)&&d.re.test(o)&&this.add(i,d.next,r+1,s);break;case"star":this.restricted(r,s)||this.add(i,d,r+1,s)}if(!this.restricted(r,s))for(let d of t.runs){if(d.state.dead){this.addRun(i,d,r+1,s);continue}let p=this.step(d.state,o,r,!1);this.addRun(i,{t:"run",neg:d.neg,state:p},r+1,s)}return this.done(i)}};go=new WeakMap,Kn=new WeakSet,el=function(t,o){let{seen:r}=le(this,go);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,!0)},tl=function(t,o){let{has:r}=le(this,go);return r[o.id]===t.gen?!1:(r[o.id]=t.gen,t.threads.push(o),!0)};var zc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let o=e.runs.map(r=>`${r.neg.id}(${zc(r.state)})`);return`${t}|${o.sort().join("|")}`},jv=1<<18,Xo,Qo,zn,vo,Hn,jn,Gn,an,ol,kr,Hc,nl=class{constructor(t,o){Le(this,an);Le(this,Xo);Le(this,Qo,new Map);Le(this,zn,0);Le(this,vo);Le(this,Hn);Le(this,jn);Le(this,Gn);Ue(this,Xo,t),Ue(this,jn,new Js(!1,!1,o)),Ue(this,Gn,new Js(!1,!0,o))}start(t){if(t){if(le(this,Hn))return le(this,Hn);let r=le(this,Gn).state();return le(this,Gn).add(r,le(this,Xo),0,!0),Ue(this,Hn,qe(this,an,ol).call(this,le(this,Gn).done(r)))}if(le(this,vo))return le(this,vo);let o=le(this,jn).state();return le(this,jn).add(o,le(this,Xo),0,!0),Ue(this,vo,qe(this,an,kr).call(this,le(this,jn).done(o)))}next(t,o){let r=o.charCodeAt(0),s=r<128?void 0:t.next.get(o);if(s)return s;let i=t===le(this,Hn)?qe(this,an,kr).call(this,le(this,Gn).step(t.state,o,0,!0)):qe(this,an,kr).call(this,le(this,jn).step(t.state,o,1,!0));return r<128?(t.ascii||(t.ascii=new Array(128),Ue(this,zn,le(this,zn)+128)),t.ascii[r]=i):t.next.set(o,i),Il(this,zn)._++,i}};Xo=new WeakMap,Qo=new WeakMap,zn=new WeakMap,vo=new WeakMap,Hn=new WeakMap,jn=new WeakMap,Gn=new WeakMap,an=new WeakSet,ol=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},kr=function(t){let o=zc(t),r=le(this,Qo).get(o);if(r)return r;le(this,zn)>jv&&qe(this,an,Hc).call(this);let s=qe(this,an,ol).call(this,t);return le(this,Qo).set(o,s),Ue(this,zn,le(this,zn)+(o.length+1)),s},Hc=function(){le(this,Qo).clear(),Ue(this,zn,0),Ue(this,vo,void 0),Ue(this,Hn,void 0)};var Gv=e=>{let t=[];for(let o=e;o.t!=="match";o=o.next){if(o.t==="split"||o.t==="neg")return;t.push(o)}return t},Wv=(e,t,o,r)=>{let s=0,i=o,d=-1,p=0;for(;i<r;){let c=e[s];if(c?.t==="star"){d=s++,p=i;continue}let v=t[i];if(c&&(c.t==="any"||c.t==="lit"&&sl(c,v)||c.t==="class"&&c.re.test(v))){s++,i++;continue}if(d===-1)return!1;s=d+1,i=++p}for(;e[s]?.t==="star";)s++;return s===e.length},jc=e=>{let t=0,o=0;for(let r of e){let[s,i]=Kv(r);t+=s,o+=i}return[t,o]},Kv=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(jc),o=Math.min(...t.map(i=>i[0])),r=Math.max(...t.map(i=>i[1])),s=r===0?0:1/0;return e.type==="@"?[o,r]:e.type==="?"?[0,r]:e.type==="*"?[0,s]:[o,s]},Lc=(e,t,o)=>{for(let r=0;r<e.length;r++)if(!sl(e[r],t[o+r]))return!1;return!0},Yv=/[/\ud800-\udfff]/,Jv=/[\ud800-\udfff]/,wr=e=>Jv.test(e)?[...e]:e,qc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},Wn,Zo,yo,Cr,bo,Qs,Sr,wo,Zs,xs,ei,Ln,Cn,xo,es,ti,Er,rn,ko,Ys,Xs=class{constructor(t,o={}){Le(this,ko);tt(this,"pattern");tt(this,"options");Le(this,Wn);Le(this,Zo);Le(this,yo);Le(this,Cr);Le(this,bo);Le(this,Qs,!1);Le(this,Sr);Le(this,wo);Le(this,Zs,!1);Le(this,xs,0);Le(this,ei,1/0);Le(this,Ln,[]);Le(this,Cn,[]);Le(this,xo);Le(this,es);Le(this,ti,!1);Le(this,Er);Le(this,rn);if(t.includes Line truncated
`).forEach((o,r)=>{let{term:s}=gl(o.trim());if(!s)return;let i=[];for(let d=0;d<s.length;d++){if(s[d]==="\\"){d++;continue}ap.has(s[d])&&!i.includes(s[d])&&i.push(s[d])}i.length&&t.push({line:r,term:s,symbols:i})}),t}function dp(e,t){let o=String(e||"").split(`
`),r=o[t];if(r===void 0)return e;let{term:s}=gl(r.trim());if(!s)return e;let i="";for(let p=0;p<s.length;p++){if(s[p]==="\\"){i+=s.slice(p,p+2),p++;continue}i+=ap.has(s[p])||s[p]==="."?"\\"+s[p]:s[p]}let d=r.indexOf(s);return o[t]=r.slice(0,d)+i+r.slice(d+s.length),o.join(`
`)}var xn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",cache_miss:"This file is not cached yet. Please try again.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_no Line truncated
`)),e.options=Object.assign({},e.options,y.options),p.restore()})}c();let v=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.preventDefault(),e.saving)return;let y=p.checkpoint(),g={terms:e.terms.split(`
`).map(C=>C.trim()).filter(C=>C.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",g).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",v&&r.cancel(v),v=r(()=>{e.message=null},2500)},C=>{e.saving=!1;let w=C&&C.data&&C.data.error,S="Unable to save your defaults. Please try again.";Promise.all([o("ERRORS."+w),o("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?N:S},()=>{e.error=S})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},hp=function(e,t,o){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(r=>{o.url("/dashboard")},r=>{e.error=r.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},gp=function(e,t,o,r,s){e.user&&!e.user.status&&o.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&o.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(p){e.feature=p},e.featureHref=function(p){return p.needsUser&&!e.user?"/signin":p.href},e.featureTarget=function(p){return p.needsUser&&!e.user?"_self":p.target||void 0},e.featureKeydown=function(p,c){let v={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(v===void 0)return;p.preventDefault();let m=e.features.length,y=v==="first"?0:v==="last"?m-1:(c+v+m)%m;e.feature=e.features[y].key,s(()=>{let g=r.document.getElementById("feature-tab-"+e.feature);g&&g.focus()})},e.demoText=`# DeepLearnUtils
Developed by Jane Smith at MIT CSAIL.
See Smith et al., "Attention That Works," 2026.
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let f=(e.demoTerms||"").split(/[,\n]/).map(g=>g.trim()).filter(Boolean).sort((g,C)=>C.length-g.length),c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!f.length)return[{text:e.demoText}];let v=new RegExp("("+f.map(c).join("|")+")","gi"),h={},y=0;return(e.demoText||"").split(v).filter(g=>g!=="").map(g=>{let C=f.find(w=>w.toLowerCase()===g.toLowerCase());return C?(h[C.toLowerCase()]||(h[C.toLowerCase()]=++y),{text:String(h[C.toLowerCase()]),redacted:!0,original:g}):{text:g}})},e.demoCount=()=>e.demoParts().filter(f=>f.redacted).length,e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}],e.statsEmpty=()=>!!e.stat&&e.cards.every(f=>!f.total);function r(){t.get("/api/stat/").then(f=>{e.stat=f.data,e.cards[0].total=f.data.nbRepositories,e.cards[1].total=f.data.nbUsers,e.cards[2].total=f.data.nbPageViews,e.cards[3].total=f.data.nbPullRequests}).catch(()=>{})}r();function u(f){let c={series:f,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!f||f.length<2)return c;let v=new Array(f.length-1);for(let S=1;S<f.length;S++)v[S-1]=f[S]-f[S-1];let h=v.length,y=Math.max.apply(null,v),g=Math.min.apply(null,v),C=Math.min(0,g),w=y-C||1;c.viewW=h*2,c.bars=new Array(h);for(let S=0;S<h;S++){let N=(v[S]-C)/w,b=Math.max(1.5,N*34);c.bars[S]={x:(S*2+.25).toFixed(2),y:(36-b).toFixed(2),w:"1.5",h:b.toFixed(2)}}if(c.deltaToday=v[h-1],h>=2){let S=v[h-2];S&&(c.pctChange=(c.deltaToday-S)/S*100)}return c.pctAbs=Math.round(Math.abs(c.pctChange)),c.isUp=c.pctChange>=0,c}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(f=>{let c=f.data||[];e.history={repositories:u(c.map(v=>v.nbRepositories||0)),users:u(c.map(v=>v.nbUsers||0)),pageViews:u(c.map(v=>v.nbPageViews||0)),pullRequests:u(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},tp=function(e,t,s,i,o,r){let u=yt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&s.url("/")}),e.user==null&&s.url("/"),u.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,ze(()=>document.querySelector(".dashboard-quota > summary")?.focus())},zt()(document,"click",E=>{e.quotaExpanded&&!E.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=E=>E.status==="error"||E._broken||c(E.status)==="progress"&&E._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=E=>{e.projectView=E,E==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=E=>{let L=Oa(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(L)?"No activity for "+L.replace(/ ago$/,""):"No activity since "+L.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=E=>"project-details-"+encodeURIComponent(E._type+":"+(E._id||E._source||"unknown")),e.showProjectDetails=async E=>{e.selectedProject=E,e.projectName=E.projectName||"",e.nameError="",e.nameMessage="",await ze();let L=document.getElementById(e.projectDetailsId(E));L?.focus(),L?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,ze(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let L=e.projectName.trim();if(L.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let W=await t.post("/api/user/project-name",{type:E._type,id:E._id,name:L});E.projectName=W.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=L?"Project name saved.":"Default project name restored."),T||(e.dashboardCursor=null,await _(),e.selectedProject===E&&(e.selectedProject=e.items.find(j=>j._type===E._type&&j._id===E._id)||null))}catch{e.selectedProject===E&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async E=>{if(!E._viewUrl||e.copyingId)return;let L=new URL(E._viewUrl,o.location.origin).href;e.copyingId=E._type+":"+E._id;try{await al(L),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:L})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let f=["queue","download","downloaded","preparing","anonymizing"];function Line truncated
`)),e.options=Object.assign({},e.options,U.options),e.options.expirationDate=U.options&&U.options.expirationDate?new Date(U.options.expirationDate):q(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),k&&k()})}function se(k,O,U){e.anonymize&&e.anonymize[k]&&e.anonymize[k].setValidity(O,U)}function me(k){try{let O=parseGithubUrl(k);if(O&&O.owner&&O.repo)return O.owner+"/"+O.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||me(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let k=g();try{let O=await t.get("/github/connections");if(e.githubConnections=O.data,!O.data.appEnabled)return;let U=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":O.data.csrf}});if(!y(k))return;e.error=null,U.data.fullName&&(e._originalFullName=U.data.fullName,e.source.fullName=U.data.fullName,e.sourceUrl="https://github.com/"+U.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(k)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,C(k)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[],jt.cancel(),Cn.cancel(),Sn.cancel(),e.previewStatus="idle",e.anonymize_readme="",pl();try{await A()}catch{}}};function be(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:me(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function Ie(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function D(){let k=new URLSearchParams(window.location.search).get("billingDraft");if(k){N.restore();try{let U=(await t.get("/api/billing/draft/"+encodeURIComponent(k))).data;if(U.path!==o.path())throw new Error("Wrong task");b=U.values.conference||null;for(let G of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(U.values,G)&&(e[G]=U.values[G]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),T=U.id,M=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await Ie(),o.replace?.(o.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let O;try{O=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!O||O.path!==o.path()||Date.now()-O.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await Ie(),!0):!1;N.restore();for(let U of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(O.draft,U)&&(e[U]=O.draft[U]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await Ie(),sessionStorage.removeItem("github-access-draft"),!0}pe(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(D,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async k=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(k.data.status),e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.fullName,e._originalFullName=k.data.source.fullName,e.terms=k.data.options.terms.filter(O=>O).join(`
`),e.source=k.data.source,e.role=k.data.role||"owner",e._existingNever=k.data.options.expirationMode==="never",e._savedExpirationDate=k.data.options.expirationDate?new Date(k.data.options.expirationDate):null,e.coauthors=k.data.coauthors||[],e._originalBranch=k.data.source.branch,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,e.repositoryID=k.data.source.repositoryID,e._originalRepositoryID=k.data.source.repositoryID,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await D()&&(await Promise.all([A(),B()]),No())},()=>{o.url("/404")})),i.pullRequestId&&i.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=i.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async k=>{if(e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.repositoryFullName+"/pull/"+k.data.source.pullRequestId,e.terms=k.data.options.terms.filter(O=>O).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await D())try{await hl()}catch{}},()=>{o.url("/404")})),i.gistId&&i.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=i.gistId,t.get("/api/gist/"+e.gistId).then(async k=>{e.sourceUrl="https://gist.github.com/"+k.data.source.gistId,e.terms=k.data.options.terms.filter(O=>O).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await D()&&await gl()},()=>{o.url("/404")}))}),t.get("/github/connections").then(k=>{e.githubConnections=k.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&k.data.appEnabled&&k.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&Ie())}).catch(()=>{}).finally(()=>{!v&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(k=!1)=>{let O=++c;e.previousConfigurations=[],e.previousConfigurationId="";let U;try{U=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,st(),jt.cancel(),Cn.cancel(),Sn.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",se("sourceUrl","github",!1);return}let G=S(U),le=k||w===G;w=G,e.sourceUrlError="",se("sourceUrl","github",!0),st();let he=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let je=window.document.getElementById("sourceUrl");if(je){try{je.setSelectionRange(0,0)}catch{}je.scrollLeft=0}},50),he&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!le&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],le||(e.source={type:"GitHubStream",branch:"",commit:""}),jt.cancel(),Cn.cancel(),Sn.cancel(),Ro.clear(),To.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",pl(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=le;try{U.gistId&&!U.repo?(e.detectedType="gist",e.source={gistId:U.gistId},await gl()):U.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:U.owner+"/"+U.repo,pullRequestId:U.pullRequestId},await hl()):(e.detectedType="repo",He(),await Promise.all([A(),B()]),No())}catch{}finally{O===c&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let k=e.branches.filter(U=>U.name==e.source.branch)[0];if(!k)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=k.commit),e.readme=k.readme,await B(),No()}),e.getBranches=async k=>{let O=parseGithubUrl(e.sourceUrl),U=g();try{if(!e.details){await A(k);return}let G=await t.get(`/api/repo/${O.owner}/${O.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&me(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:k===!0||e.reconnectingSource?"1":"0",repositoryID:be()}});if(!y(U))return;e.branches=G.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let le=e.branches.filter(he=>he.name==e.source.branch);le.length>0&&(!(!e.reconnectingSource&&!k&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=le[0].commit),e.readme=le[0].readme,await B(k))}catch(G){if(!y(U))return;e.branches=[],e.sourceUnreachable=G&&(G.status===404||G.data&&G.data.error==="repo_not_found"),e.details=null,Be(G)}finally{C(U)}};async function A(k=!1){let O=parseGithubUrl(e.sourceUrl),U=g();try{Po(),st();let G=await t.get(`/api/repo/${O.owner}/${O.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&me(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:be(),force:"1"}});if(!y(U))return;e.details=G.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(k||e.reconnectingSource)}catch(G){if(!y(U))return;throw Be(G),G}finally{C(U)}}async function B(k){if(e.readme&&!k)return e.readme;let O=parseGithubUrl(e.sourceUrl),U=g();try{let G=await t.get(`/api/repo/${O.owner}/${O.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&me(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:k===!0?"1":"0",branch:e.source.branch,repositoryID:be()}});y(U,!0)&&(e.readme=G.data)}catch{y(U,!0)&&(e.readme="")}finally{C(U)}}let Z={magicalBraces:!0},K=k=>k.startsWith("/")&&!k.endsWith("/")&&Wn(ko(k.slice(1),Z),Z)===k.slice(1),ne=()=>Object.keys(e.preserve.picked).filter(k=>e.preserve.picked[k]).sort().map(k=>"/"+Wn(k,Z)),ue=k=>"/"+Wn(k,Z)+"/**",re=k=>"!/"+Wn(k,Z)+"/",ie=()=>String(e.preserve.patterns||"").split(`
`).map(k=>k.trim()).filter(Boolean),Q=null,we=null,ce=new Set,Se=0,Re=null,Me=()=>!1;function Ye(){let k=Se+"\0"+e.preserve.patterns;if(k!==Re){Re=k;try{Me=il(sl([...ne(),...ie()]))}catch{Me=()=>!1}}return Me}function Ge(k){let O=new Map([["",{dirs:[],files:[]}]]);for(let U of k){let G=U.split("/"),le="";for(let he=0;he<G.length-1;he++){let je=G.slice(0,he+1).join("/");O.has(je)||(O.set(je,{dirs:[],files:[]}),O.get(le).dirs.push(je)),le=je}O.get(le).files.push(U)}for(let U of O.values())U.dirs.sort();return{files:k,dirs:O,descendants:new Map}}function ke(k){return Q.descendants.has(k)||Q.descendants.set(k,Q.files.filter(O=>O.startsWith(k+"/"))),Q.descendants.get(k)}let Ve=k=>Ye()(k);function it(k){let O=ke(k),U=0;for(let G of O)Ve(G)&&U++;return U===0?"none":U===O.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let k=(e.options?.preserveFiles||[]).map(O=>String(O).trim()).filter(Boolean).map(O=>K(O)?ko(O.slice(1),Z):O);return k.length?k.slice(0,2).join(", ")+(k.length>2?` and ${k.length-2} more`:""):"None. Every file is redacted."};async function ct(){let k=e.source?.commit;if(!(Q&&e.preserve.commit===k)){e.preserve.loading=!0,e.preserve.error="",Q=null,we=null;try{let O=parseGithubUrl(e.sourceUrl),U=await t.get(`/api/repo/${O.owner}/${O.repo}/tree`,{params:{commit:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&me(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:be()}});if(e.source?.commit!==k)return;let G=Array.isArray(U.data.binaryFiles)?U.data.binaryFiles:[];Q=mn(Ge(U.data.files||[])),we=G.length?mn(Ge([...U.data.files||[],...G])):Q,ce=mn(new Set(G)),e.preserve.commit=k,e.preserve.truncated=!!U.data.truncated,e.previewFile||jt()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",k=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&k&&e.sourceUrl&&ct().catch(()=>{})}),e.openPreserveFiles=()=>{let k={},O=[];for(let G of e.options?.preserveFiles||[]){let le=String(G).trim();le&&(!O.length&&K(le)?k[ko(le.slice(1),Z)]=!0:O.push(le))}let U={};for(let G of Object.keys(k)){let le=G.split("/");for(let he=1;he<le.length;he++)U[le.slice(0,he).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:k,expanded:U,patterns:O.join(`
`),patternsOpen:O.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Se++,u(()=>{let G=document.getElementById("preserve-files-dialog");G?.showModal&&!G.open&&G.showModal(),document.getElementById("preserve-files-search")?.focus()},0),ct()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=sl([...ne(),...ie()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!Q)return[];let k=Ye(),O=(he,je,Ot)=>{let mt=!!e.preserve.picked[he],Rt=k(he);return{kind:"file",path:he,label:Ot,depth:je,state:Rt?"all":"none",locked:!mt&&Rt,note:!mt&&Rt?"matched by a pattern":mt&&!Rt?"excluded by a pattern":""}},U=String(e.preserve.search||"").trim().toLowerCase();if(U)return Q.files.filter(he=>he.toLowerCase().includes(U)).slice(0,300).map(he=>O(he,0,he));let G=[],le=(he,je)=>{let Ot=Q.dirs.get(he);for(let mt of Ot.dirs){let Rt=!!e.preserve.expanded[mt],Gt=ie().includes(ue(mt));G.push({kind:"dir",path:mt,label:mt.slice(he?he.length+1:0)+"/",depth:je,open:Rt,state:it(mt),locked:!1,note:Gt?"whole folder":""}),Rt&&le(mt,je+1)}for(let mt of Ot.files)G.push(O(mt,je,mt.slice(he?he.length+1:0)))};return le("",0),G},e.preserveCount=()=>Q?Q.files.filter(Ve).length:0,e.togglePreserveDir=k=>{e.preserve.expanded[k]=!e.preserve.expanded[k]},e.togglePreserveFile=k=>{e.preserve.picked[k]=!e.preserve.picked[k],Se++},e.togglePreserveFolder=k=>{let O=ue(k),U=re(k),G=ie().filter(he=>he!==O&&he!==U),le=it(k)==="all"||ie().includes(O);for(let he of ke(k))e.preserve.picked[he]=!1;Se++,e.preserve.patterns=(le?G:[...G,O]).join(`
`),le&&ke(k).some(Ve)&&(e.preserve.patterns=[...G,U].join(`
`))};let It=/^readme(\.[^/]*)?$/i,Tt=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],lt=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],ft=k=>{let O=_e(k),U=O.indexOf("."),G=Tt.indexOf(U===-1?"":O.slice(U).toLowerCase());return G===-1?Tt.length:G},Qt=()=>!!Q&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!Qt())return"";for(let k of[".github","","docs"]){let O=(Q.dirs.get(k)?.files||[]).filter(U=>It.test(_e(U)));if(O.length)return O.sort((U,G)=>ft(U)-ft(G)||Ne(U,G))[0]}return""},e.readmeName=()=>_e(e.readmePath())||"README.md";let So={key:null,fn:()=>!1},cl=()=>{let k=(e.options?.preserveFiles||[]).map(U=>String(U).trim()).filter(Boolean),O=k.join(`
`);if(O!==So.key){let U=()=>!1;try{k.length&&(U=il(k))}catch{}So={key:O,fn:U}}return So.fn};e.pathPreserved=k=>!!k&&cl()(k),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let k=cl();if(Qt()){let O=e.readmePath();return!!O&&k(O)}return lt.some(O=>k(O))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function si(){let k={terms:e.terms?e.terms.split(`
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(k.branchName=e.source.branch);try{let O=parseGithubUrl(e.sourceUrl);k.repoName=`${O.owner}/${O.repo}`}catch{}return k}function Er(k,O,U){let G=null,le=0,he=()=>{if(e.detectedType!==k)return;G&&u.cancel(G);let je=++le;e.previewStatus="loading",G=u(()=>{G=null;let Ot=O();if(!Ot){e.previewStatus="idle";return}t.post("/api/anonymize-preview",Ot).then(mt=>{je===le&&(U(mt.data,Ot),e.previewStatus="ready")}).catch(()=>{je===le&&(e.previewStatus="error")})},200)};return he.cancel=()=>{le++,G&&u.cancel(G),G=null},e.on("dispose",he.cancel),he}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof ln!="string"?fl(e.previewFile):jt()),e.detectedType==="pr"&&Cn(),e.detectedType==="gist"&&Sn()};let et=mn(Us(e));Object.defineProperty(e,"previewViewer",{get:()=>et}),Aa(et,e),Object.assign(et,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),et.preview=!0,et.fileSize=k=>k===et.filePath&&typeof ln=="string"?new Blob([ln]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,et.openPreserveFiles=()=>e.openPreserveFiles(),et.previewPreserved=()=>e.previewPreserved(),et.retryContent=()=>e.retryPreview();let gf=k=>ce.has(k)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(k),Nr=(k="")=>({path:k,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=Nr();let os=0,ln=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=k=>{if(k=k||"",k&&k===e.readmePath()&&(k=""),os++,ln=null,ri(),jt.cancel(),e.previewFile=k,e.previewDoc=Nr(k),et.sidebarCollapsed=!0,et.content=null,!k){e.readme?jt():e.previewStatus="idle";return}if(gf(k)){Rr("binary"),e.previewStatus="ready";return}fl(k)};function pl(){os++,ln=null,e.previewFile="",e.previewDoc=Nr(),et.sidebarCollapsed=!0,et.content=null}function fl(k){let O=++os;ln=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let U;try{U=parseGithubUrl(e.sourceUrl)}catch{U=null}if(!U||!e.source?.commit){Object.assign(e.previewDoc,{loading:!1,loadError:"The repository is still loading. Try again in a moment."}),e.previewStatus="error";return}t.get(`/api/repo/${U.owner}/${U.repo}/file`,{params:{commit:e.source.commit,path:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&me(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:be()},transformResponse:G=>G}).then(G=>{if(O!==os)return;e.previewDoc.loading=!1;let le=typeof G.headers=="function"&&G.headers("content-type")||"";if(/json/i.test(le)){let he=null;try{he=JSON.parse(G.data)}catch{}if(he&&he.binary===!0){Rr("binary"),e.previewStatus="ready";return}}ln=typeof G.data=="string"?G.data:"",jt()},G=>{if(O!==os)return;e.previewDoc.loading=!1;let le=wr(G);if(le==="file_too_big"){Rr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=Qn.ERRORS[le]||"GitHub did not return this file.",e.previewStatus="error"})}let ii;function ri(){ii&&window.URL.revokeObjectURL(ii),ii=void 0,et.url=void 0}e.on("dispose",ri);function Rr(k){ri(),e.previewDoc.note=k,et.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),et.type=k==="too_big"?"error":"binary",et.content=k==="too_big"?"file_too_big":"binary"}function vf(k){try{let O=parseGithubUrl(e.sourceUrl),U=e.source.branch||e.details&&e.details.defaultBranch||"main",G=k&&k.includes("/")?k.slice(0,k.lastIndexOf("/")+1):"";return`https://github.com/${O.owner}/${O.repo}/raw/${U}/${G}`}catch{return""}}let ml=Er("repo",()=>e.previewFile?typeof ln!="string"?null:{content:ln,options:si()}:e.readme?{content:e.readme,options:si()}:null,k=>{if(typeof k?.content!="string")throw Error("Invalid preview response");ri(),window.URL?.createObjectURL&&(et.url=ii=window.URL.createObjectURL(new Blob([k.content],{type:"text/plain"})));let O=e.previewOpenPath()||e.readmeName();et.prepareFile(e.previewPathName(O)),et.fileBaseUrl=vf(O),et.renderFileContent(k.content,et.type,et.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=k.content)}),jt=()=>{e.previewFile&&typeof ln!="string"||ml()};jt.cancel=ml.cancel;let Eo=rt(new Map),Tr=new Set,Pr=new Set,ss="",is=null,ai=()=>String(e.terms||"").split(`
`).filter(k=>k.trim());function yf(){is=null;let k=ai(),O=k.join(`
`);O!==ss&&(Eo.clear(),Pr.clear(),ss=O);let U=[...Tr].filter(G=>!Eo.has(G));if(Tr.clear(),!(!U.length||!k.length))for(let G=0;G<U.length;G+=400){let le=U.slice(G,G+400);t.post("/api/anonymize-preview",{contents:le,options:{terms:k,image:!0,link:!0}}).then(he=>{if(ss!==O||ai().join(`
`)!==O)return;let je=he.data?.contents;if(!Array.isArray(je)||je.length!==le.length)throw Error("Invalid preview response");le.forEach((Ot,mt)=>Eo.set(Ot,typeof je[mt]=="string"?je[mt]:Ot))}).catch(()=>{ss===O&&le.forEach(he=>Pr.add(he))})}}e.previewName=k=>{if(!k||!ai().length)return k;if(ss===ai().join(`
`)){if(Eo.has(k))return Eo.get(k);if(Pr.has(k))return k}return Tr.add(k),is||(is=u(yf,120)),k},e.previewPathName=k=>{k=String(k||"");let O=k.lastIndexOf("/");return O<0?e.previewName(k):e.previewName(k.slice(0,O))+"/"+e.previewName(k.slice(O+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{et.repoId=e.repoId||"repository",et.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),et.paths=et.filePath.split("/"),et.files=e.previewTreeFiles(),et.loadedFolders=Object.fromEntries([...we?.dirs.keys()||[]].map(k=>[e.previewName(k),!0]))},!0),e.on("dispose",()=>{is&&u.cancel(is)});function No(){!e.anonymize||!e.anonymize.terms||jt()}async function hl(){let k=parseGithubUrl(e.sourceUrl),O=g();try{Po(),st();let U=await t.get(`/api/pr/${k.owner}/${k.repo}/${k.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(O))return;e.details=U.data,e.pullRequestId||(e.pullRequestId=k.repo+"-PR"+k.pullRequestId+"-"+generateRandomId(4))}catch(U){if(!y(O))return;throw Be(U),U}finally{C(O)}}let Ro=rt(new Map);function bf(){let k=new Set,O=e.details&&e.details.pullRequest;if(!O)return k;typeof O.title=="string"&&k.add(O.title),typeof O.body=="string"&&k.add(O.body),typeof O.diff=="string"&&k.add(O.diff);let U=O.comments||[];for(let G of U)typeof G.author=="string"&&k.add(G.author),typeof G.body=="string"&&k.add(G.body);return k}let Cn=Er("pr",()=>{let k=bf(),O=Array.from(k);return O.length===0?null:{contents:O,options:si()}},(k,O)=>{if(!Array.isArray(k?.contents)||k.contents.length!==O.contents.length||k.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let U=O.contents,G=new Map;for(let le=0;le<U.length&&le<k.contents.length;le++)G.set(U[le],k.contents[le]);Ro.clear(),G.forEach((le,he)=>Ro.set(he,le))});e.anonymizePrContent=function(k){return k&&(Ro.has(k)?Ro.get(k):"")};async function gl(){let k=parseGithubUrl(e.sourceUrl),O=g();try{Po(),st(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let U=await t.get(`/api/gist/source/${k.gistId}`);if(!y(O))return;e.details=U.data,e.gistId||(e.gistId="gist-"+k.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(U){if(!y(O))return;if(U.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,se("sourceUrl","missing",!1);return}if(U.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,se("sourceUrl","missing",!1);return}throw Be(U),U}finally{C(O)}}let To=rt(new Map);function wf(){let k=new Set,O=e.details&&e.details.gist;if(!O)return k;typeof O.description=="string"&&k.add(O.description),typeof O.ownerLogin=="string"&&k.add(O.ownerLogin);let U=O.files||[];for(let le of U)typeof le.filename=="string"&&k.add(le.filename),typeof le.content=="string"&&k.add(le.content);let G=O.comments||[];for(let le of G)typeof le.author=="string"&&k.add(le.author),typeof le.body=="string"&&k.add(le.body);return k}let Sn=Er("gist",()=>{let k=wf(),O=Array.from(k);return O.length===0?null:{contents:O,options:si()}},(k,O)=>{if(!Array.isArray(k?.contents)||k.contents.length!==O.contents.length||k.contents.some(le=>typeof le!="string"))throw Error("Invalid preview response");let U=O.contents,G=new Map;for(let le=0;le<U.length&&le<k.contents.length;le++)G.set(U[le],k.contents[le]);To.clear(),G.forEach((le,he)=>To.set(he,le)),Dr()});e.anonymizeGistContent=function(k){return k&&(To.has(k)?To.get(k):"")},e.previewGistFiles=[];function Dr(){let k=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=k.map(O=>({filename:e.anonymizeGistContent(O.filename),content:e.anonymizeGistContent(O.content),language:O.language}))}e.watch("details.gist.files",Dr,!0),e.watch("terms",Dr);function kf(){let k=e.conference;if(e.conference_data=null,!k)return;let O=k===b||e.isUpdate&&k===e._originalConference;k!==b&&(b=null),t.get("/api/conferences/"+k).then(U=>{e.conference===k&&(e.conference_data=U.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!O&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===k&&(e.conference_data=null)})}function Po(){se("repoId","used",!0),se("repoId","format",!0),se("pullRequestId","used",!0),se("pullRequestId","format",!0),se("gistId","used",!0),se("gistId","format",!0),se("sourceUrl","used",!0),se("sourceUrl","missing",!0),se("sourceUrl","access",!0),se("sourceUrl","github",!0),se("commit","exists",!0),se("conference","activated",!0),se("terms","format",!0),e.termHints=[]}function li(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let k=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||k&&k.invalid?(k&&k.setDirty&&k.setDirty(),e.error= Line truncated
`).filter(he=>he),connection:e.githubConnection,fullName:`${U.owner}/${U.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(G.options.pageSource=e.details.pageSource),Po();let le=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(le,G,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},he=>{if(he.data){let je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(he.data.error);je||r("ERRORS."+he.data.error).then(Ot=>{e.error=Ot},console.error),di(he.data.error),je&&(he.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,ze(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{O.disabled=!1})},e.anonymizeGist=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(li())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let O=k.currentTarget||k.target.closest?.("button")||k.target;O.disabled=!0;let U=parseGithubUrl(e.sourceUrl),G={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(he=>he),source:{gistId:U.gistId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(le,G,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},he=>{he.data&&(r("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),di(he.data.error))}).finally(()=>{O.disabled=!1})},e.anonymizePullRequest=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(li())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let O=k.currentTarget||k.target.closest?.("button")||k.target;O.disabled=!0;let U=parseGithubUrl(e.sourceUrl),G={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(he=>he),source:{repositoryFullName:`${U.owner}/${U.repo}`,pullRequestId:U.pullRequestId},options:e.options,conference:e.conference};Po();let le=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(le,G,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},he=>{he.data&&(r("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),di(he.data.error))}).finally(()=>{O.disabled=!1})},e.watch("conference",()=>{kf()}),e.termHints=[],e.matchTermAsWritten=k=>{e.terms=Wc(e.terms,k)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&jt()}),e.watch("terms",()=>{e.termHints=Gc(e.terms),e.detectedType==="repo"&&No(),e.detectedType==="pr"&&Cn(),e.detectedType==="gist"&&Sn()}),e.watch("options.image",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&Cn(),e.detectedType==="gist"&&Sn()}),e.watch("options.link",()=>{e.detectedType==="repo"&&No(),e.detectedType==="pr"&&Cn(),e.detectedType==="gist"&&Sn()}),e.watch("details",()=>{e.detectedType==="pr"&&Cn(),e.detectedType==="gist"&&Sn()},!0)},ll=function(e,t,s,i,o,r){Aa(e);let u=yt();Yc();let f=zt(),c=0,v=null,h=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),h&&(u.timeout.cancel(h),h=null)}let g=!1;e.on("dispose",()=>{g=!0,c++,y(),C&&C.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,f(document,"click",I=>{e.symbolsOpen&&!I.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!I.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!I.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&I.target.isConnected&&!I.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!I.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!I.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),f(document,"keydown",I=>{I.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(I.ctrlKey||I.metaKey)&&!I.altKey&&I.key&&I.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(I.preventDefault(),e.toggleMdFind(!0))}),f(document,"keydown",function(I){if((I.metaKey||I.ctrlKey)&&I.key==="k"){I.preventDefault();var F=document.querySelector(".tree-search-input");F&&(F.focus(),F.select())}});var C=null;e.onFileSearchChange=function(){C&&(C.resolve(),C=null);let I=e.fileSearchQuery;if(!I||I.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let F=r.defer();C=F,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(I)}`,{timeout:F.promise}).then(function(E){if(!(g||C!==F)){C=null,e.fileSearchLoading=!1;var L={};e.files.forEach(function(_e){L[(_e.path||"")+"/"+_e.name]=!0});for(var W=[],j={},Y=0;Y<E.data.length;Y++){var te=E.data[Y];if(te.path)for(var ee=te.path.split("/"),fe="",ge=0;ge<ee.length;ge++){var Fe=fe;fe=fe?fe+"/"+ee[ge]:ee[ge];var He=Fe+"/"+ee[ge];!L[He]&&!j[He]&&(j[He]=!0,W.push({name:ee[ge],path:Fe}))}}W.sort(function(_e,X){return(_e.path||"").split("/").length-(X.path||"").split("/").length}),W.length>0&&e.files.push.apply(e.files,W);for(var Ke=[],Be=0;Be<E.data.length;Be++){var st=E.data[Be],Ne=(st.path||"")+"/"+st.name;!L[Ne]&&st.size!=null&&(Ke.push(st),L[Ne]=!0)}Ke.length>0&&e.files.push.apply(e.files,Ke),e.fileSearchResults=E.data}},function(){!g&&C===F&&(C=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(I,F){if(e.repoId!=i.repoId)return z();if((i.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=i.path||"",e.paths=e.filePath.split("/").filter(E=>E&&E.trim().length>0),q();for(let E=0;E<e.paths.length-1;E++){let L=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(j=>j.path===L)||e.getFiles(L)}}});function w(){if(e.paths[0]!="")return;let I=["readme.md","readme.txt","readme.org","readme.1st","readme"],F={};for(let L of e.files)L.name.toLowerCase().indexOf("readme")>-1&&(F[L.name.toLowerCase()]=L.name);let E=null;for(let L of I)if(F[L]){E=L;break}if(!E&&Object.keys(F).length>0&&(E=Object.keys(F)[0]),E){let L=s.url();L[L.length-1]!="/"&&(L+="/"),s.url(L+encodePathForUrl(F[E]))}}e.fileCounts=null;let S=0,N=new Set,b=!1;e.getFiles=function(I,F=!1){let E=e.repoId,L=S;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(I)}&v=${e.options.lastUpdateDate}`).then(function(W){if(g||E!==e.repoId||L!==S)return[];let j=I||"";return e.files=e.files.filter(Y=>Y.path!==j),e.files.push(...W.data),e.loadedFolders={...e.loadedFolders,[j]:!0},T(j,L),W.data},function(W){if(g||E!==e.repoId||L!==S)return[];F||(e.type="error",e.content=wr(W),e.files=[])})};function T(I,F){if(b||N.has(I))return;N.add(I);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(I)}`).then(function(L){g||E!==e.repoId||F!==S||(e.fileCounts={...e.fileCounts,...L.data})},function(){ Line truncated
Contact: jane.smith@mit.edu`,e.demoTerms="Jane Smith, Smith, MIT CSAIL, jane.smith@mit.edu",e.demoParts=function(){let p=(e.demoTerms||"").split(/[,\n]/).map(g=>g.trim()).filter(Boolean).sort((g,C)=>C.length-g.length),c=g=>g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let v=new RegExp("("+p.map(c).join("|")+")","gi"),m={},y=0;return(e.demoText||"").split(v).filter(g=>g!=="").map(g=>{let C=p.find(w=>w.toLowerCase()===g.toLowerCase());return C?(m[C.toLowerCase()]||(m[C.toLowerCase()]=++y),{text:String(m[C.toLowerCase()]),redacted:!0,original:g}):{text:g}})},e.demoCount=()=>e.demoParts().filter(p=>p.redacted).length,e.cards=[{key:"repositories",total:0,label:"repositories anonymized"},{key:"users",total:0,label:"researchers"},{key:"pageViews",total:0,label:"page views"},{key:"pullRequests",total:0,label:"pull requests"}],e.statsEmpty=()=>!!e.stat&&e.cards.every(p=>!p.total);function i(){t.get("/api/stat/").then(p=>{e.stat=p.data,e.cards[0].total=p.data.nbRepositories,e.cards[1].total=p.data.nbUsers,e.cards[2].total=p.data.nbPageViews,e.cards[3].total=p.data.nbPullRequests}).catch(()=>{})}i();function d(p){let c={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return c;let v=new Array(p.length-1);for(let S=1;S<p.length;S++)v[S-1]=p[S]-p[S-1];let m=v.length,y=Math.max.apply(null,v),g=Math.min.apply(null,v),C=Math.min(0,g),w=y-C||1;c.viewW=m*2,c.bars=new Array(m);for(let S=0;S<m;S++){let N=(v[S]-C)/w,b=Math.max(1.5,N*34);c.bars[S]={x:(S*2+.25).toFixed(2),y:(36-b).toFixed(2),w:"1.5",h:b.toFixed(2)}}if(c.deltaToday=v[m-1],m>=2){let S=v[m-2];S&&(c.pctChange=(c.deltaToday-S)/S*100)}return c.pctAbs=Math.round(Math.abs(c.pctChange)),c.isUp=c.pctChange>=0,c}e.history={repositories:d([]),users:d([]),pageViews:d([]),pullRequests:d([])},t.get("/api/stat/history?days=60").then(p=>{let c=p.data||[];e.history={repositories:d(c.map(v=>v.nbRepositories||0)),users:d(c.map(v=>v.nbUsers||0)),pageViews:d(c.map(v=>v.nbPageViews||0)),pullRequests:d(c.map(v=>v.nbPullRequests||0))}}).catch(()=>{})},vp=function(e,t,o,r,s,i){let d=yt();e.on("routeLeave",function(){$('[data-toggle="tooltip"]').tooltip("dispose")}),e.watch("user.status",()=>{e.user==null&&o.url("/")}),e.user==null&&o.url("/"),d.timeout(()=>{$('[data-toggle="tooltip"]').tooltip()},250),e.quotaExpanded=!1,e.closeQuota=()=>{e.quotaExpanded=!1,Be(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Ot()(document,"click",E=>{e.quotaExpanded&&!E.target.closest?.(".dashboard-quota")&&(e.quotaExpanded=!1)}),e.filtersExpanded=!1,e.projectView="all",e.selectedProject=null,e.projectName="",e.nameSaving=!1,e.nameError="",e.nameMessage="",e.needsAttention=E=>E.status==="error"||E._broken||c(E.status)==="progress"&&E._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=E=>{e.projectView=E,E==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=E=>{let F=Ua(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(F)?"No activity for "+F.replace(/ ago$/,""):"No activity since "+F.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=E=>"project-details-"+encodeURIComponent(E._type+":"+(E._id||E._source||"unknown")),e.showProjectDetails=async E=>{e.selectedProject=E,e.projectName=E.projectName||"",e.nameError="",e.nameMessage="",await Be();let F=document.getElementById(e.projectDetailsId(E));F?.focus(),F?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,Be(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let F=e.projectName.trim();if(F.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let Y=await t.post("/api/user/project-name",{type:E._type,id:E._id,name:F});E.projectName=Y.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=F?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await _(),e.selectedProject===E&&(e.selectedProject=e.items.find(G=>G._type===E._type&&G._id===E._id)||null))}catch{e.selectedProject===E&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async E=>{if(!E._viewUrl||e.copyingId)return;let F=new URL(E._viewUrl,s.location.origin).href;e.copyingId=E._type+":"+E._id;try{await vl(F),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:F})}finally{e.copyingId=null}},e.items=[],e.search="",e.loading=!0,e.statusKeyLabels={ready:"Ready",progress:"Preparing",error:"Error",expired:"Expiring / expired",removed:"Removing / removed"};let p=["queue","download","downloaded","preparing","anonymizing"];function Line truncated
`)),e.options=Object.assign({},e.options,U.options),e.options.expirationDate=U.options&&U.options.expirationDate?new Date(U.options.expirationDate):L(),!r.repoId&&!r.pullRequestId&&!r.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),k&&k()})}function oe(k,M,U){e.anonymize&&e.anonymize[k]&&e.anonymize[k].setValidity(M,U)}function me(k){try{let M=parseGithubUrl(k);if(M&&M.owner&&M.repo)return M.owner+"/"+M.repo}catch{}return null}e.accessRepairAllowed=!1,e.repairingGitHubAccess=!1,e.accessRepairMessage="",e.repairGitHubAccess=async()=>{if(!e.accessRepairAllowed||e.repairingGitHubAccess||!e.githubConnections?.appEnabled||!r.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||me(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let k=g();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let U=await t.post("/github/connections/migrate",{type:"repository",id:r.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!y(k))return;e.error=null,U.data.fullName&&(e._originalFullName=U.data.fullName,e.source.fullName=U.data.fullName,e.sourceUrl="https://github.com/"+U.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(k)&&(e.accessRepairMessage="Unable to repair GitHub access. Check the App's repository permissions in Manage access, then retry. Your published snapshot has not been replaced.")}finally{e.repairingGitHubAccess=!1,C(k)}},e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,e.reconnectSource=async()=>{if(confirm("Reconnect to the repository currently at this GitHub URL? Review its branch and commit before saving. Saving will replace the published snapshot.")){e.reconnectingSource=!0,e.reconnectRepositoryId=void 0,e.details=null,e.source.commit="",e.source.branch="",e.readme="",e.branches=[],Gt.cancel(),Sn.cancel(),En.cancel(),e.previewStatus="idle",e.anonymize_readme="",El();try{await I()}catch{}}};function be(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:me(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function Oe(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function A(){let k=new URLSearchParams(window.location.search).get("billingDraft");if(k){N.restore();try{let U=(await t.get("/api/billing/draft/"+encodeURIComponent(k))).data;if(U.path!==s.path())throw new Error("Wrong task");b=U.values.conference||null;for(let W of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(U.values,W)&&(e[W]=U.values[W]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=U.id,V=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await Oe(),s.replace?.(s.path()),!0}catch{e.billingError="The checkout draft could not be restored. Retry by reloading this page; any local draft is still available."}}let M;try{M=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!M||M.path!==s.path()||Date.now()-M.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await Oe(),!0):!1;N.restore();for(let U of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(M.draft,U)&&(e[U]=M.draft[U]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await Oe(),sessionStorage.removeItem("github-access-draft"),!0}pe(()=>{!r.repoId&&!r.pullRequestId&&!r.gistId&&d(A,0),r.repoId&&r.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=r.repoId,t.get("/api/repo/"+e.repoId).then(async k=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(k.data.status),e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.fullName,e._originalFullName=k.data.source.fullName,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.role=k.data.role||"owner",e._existingNever=k.data.options.expirationMode==="never",e._savedExpirationDate=k.data.options.expirationDate?new Date(k.data.options.expirationDate):null,e.coauthors=k.data.coauthors||[],e._originalBranch=k.data.source.branch,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,e.repositoryID=k.data.source.repositoryID,e._originalRepositoryID=k.data.source.repositoryID,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A()&&(await Promise.all([I(),B()]),Ro())},()=>{s.url("/404")})),r.pullRequestId&&r.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=r.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async k=>{if(e.githubConnection=k.data.connection||"oauth",e.sourceUrl="https://github.com/"+k.data.source.repositoryFullName+"/pull/"+k.data.source.pullRequestId,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A())try{await Tl()}catch{}},()=>{s.url("/404")})),r.gistId&&r.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=r.gistId,t.get("/api/gist/"+e.gistId).then(async k=>{e.sourceUrl="https://gist.github.com/"+k.data.source.gistId,e.terms=k.data.options.terms.filter(M=>M).join(`
`),e.source=k.data.source,e.options=Object.assign({},e.options,k.data.options),e.conference=k.data.conference,e._originalConference=k.data.conference,k.data.options.expirationDate&&(e.options.expirationDate=new Date(k.data.options.expirationDate)),w=S(parseGithubUrl(e.sourceUrl)),!await A()&&await Pl()},()=>{s.url("/404")}))}),t.get("/github/connections").then(k=>{e.githubConnections=k.data,!r.repoId&&!r.pullRequestId&&!r.gistId&&e.githubConnection===void 0&&k.data.appEnabled&&k.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&Oe())}).catch(()=>{}).finally(()=>{!v&&!r.repoId&&!r.pullRequestId&&!r.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(k=!1)=>{let M=++c;e.previousConfigurations=[],e.previousConfigurationId="";let U;try{U=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,st(),Gt.cancel(),Sn.cancel(),En.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",oe("sourceUrl","github",!1);return}let W=S(U),de=k||w===W;w=W,e.sourceUrlError="",oe("sourceUrl","github",!0),st();let he=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let je=window.document.getElementById("sourceUrl");if(je){try{je.setSelectionRange(0,0)}catch{}je.scrollLeft=0}},50),he&&d(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!de&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],de||(e.source={type:"GitHubStream",branch:"",commit:""}),Gt.cancel(),Sn.cancel(),En.cancel(),To.clear(),Po.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",El(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=de;try{U.gistId&&!U.repo?(e.detectedType="gist",e.source={gistId:U.gistId},await Pl()):U.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:U.owner+"/"+U.repo,pullRequestId:U.pullRequestId},await Tl()):(e.detectedType="repo",He(),await Promise.all([I(),B()]),Ro())}catch{}finally{M===c&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let k=e.branches.filter(U=>U.name==e.source.branch)[0];if(!k)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=k.commit),e.readme=k.readme,await B(),Ro()}),e.getBranches=async k=>{let M=parseGithubUrl(e.sourceUrl),U=g();try{if(!e.details){await I(k);return}let W=await t.get(`/api/repo/${M.owner}/${M.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:k===!0||e.reconnectingSource?"1":"0",repositoryID:be()}});if(!y(U))return;e.branches=W.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let de=e.branches.filter(he=>he.name==e.source.branch);de.length>0&&(!(!e.reconnectingSource&&!k&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=de[0].commit),e.readme=de[0].readme,await B(k))}catch(W){if(!y(U))return;e.branches=[],e.sourceUnreachable=W&&(W.status===404||W.data&&W.data.error==="repo_not_found"),e.details=null,ze(W)}finally{C(U)}};async function I(k=!1){let M=parseGithubUrl(e.sourceUrl),U=g();try{Do(),st();let W=await t.get(`/api/repo/${M.owner}/${M.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,repositoryID:be(),force:"1"}});if(!y(U))return;e.details=W.data,e.reconnectingSource&&(e.reconnectRepositoryId=e.details.externalId),e.details&&e.details.id&&(e.repositoryID=e.details.id),e.repoId||(e.repoId=e.details.repo+"-"+generateRandomId(4)),await e.getBranches(k||e.reconnectingSource)}catch(W){if(!y(U))return;throw ze(W),W}finally{C(U)}}async function B(k){if(e.readme&&!k)return e.readme;let M=parseGithubUrl(e.sourceUrl),U=g();try{let W=await t.get(`/api/repo/${M.owner}/${M.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,connection:e.githubConnection,force:k===!0?"1":"0",branch:e.source.branch,repositoryID:be()}});y(U,!0)&&(e.readme=W.data)}catch{y(U,!0)&&(e.readme="")}finally{C(U)}}let Q={magicalBraces:!0},K=k=>k.startsWith("/")&&!k.endsWith("/")&&Yn(Co(k.slice(1),Q),Q)===k.slice(1),te=()=>Object.keys(e.preserve.picked).filter(k=>e.preserve.picked[k]).sort().map(k=>"/"+Yn(k,Q)),ue=k=>"/"+Yn(k,Q)+"/**",ie=k=>"!/"+Yn(k,Q)+"/",se=()=>String(e.preserve.patterns||"").split(`
`).map(k=>k.trim()).filter(Boolean),X=null,ke=null,ce=new Set,Ee=0,Te=null,Me=()=>!1;function Je(){let k=Ee+"\0"+e.preserve.patterns;if(k!==Te){Te=k;try{Me=hl(ml([...te(),...se()]))}catch{Me=()=>!1}}return Me}function Ge(k){let M=new Map([["",{dirs:[],files:[]}]]);for(let U of k){let W=U.split("/"),de="";for(let he=0;he<W.length-1;he++){let je=W.slice(0,he+1).join("/");M.has(je)||(M.set(je,{dirs:[],files:[]}),M.get(de).dirs.push(je)),de=je}M.get(de).files.push(U)}for(let U of M.values())U.dirs.sort();return{files:k,dirs:M,descendants:new Map}}function Ce(k){return X.descendants.has(k)||X.descendants.set(k,X.files.filter(M=>M.startsWith(k+"/"))),X.descendants.get(k)}let Ve=k=>Je()(k);function it(k){let M=Ce(k),U=0;for(let W of M)Ve(W)&&U++;return U===0?"none":U===M.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let k=(e.options?.preserveFiles||[]).map(M=>String(M).trim()).filter(Boolean).map(M=>K(M)?Co(M.slice(1),Q):M);return k.length?k.slice(0,2).join(", ")+(k.length>2?` and ${k.length-2} more`:""):"None. Every file is redacted."};async function ct(){let k=e.source?.commit;if(!(X&&e.preserve.commit===k)){e.preserve.loading=!0,e.preserve.error="",X=null,ke=null;try{let M=parseGithubUrl(e.sourceUrl),U=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:be()}});if(e.source?.commit!==k)return;let W=Array.isArray(U.data.binaryFiles)?U.data.binaryFiles:[];X=mn(Ge(U.data.files||[])),ke=W.length?mn(Ge([...U.data.files||[],...W])):X,ce=mn(new Set(W)),e.preserve.commit=k,e.preserve.truncated=!!U.data.truncated,e.previewFile||Gt()}catch{e.preserve.error="The file list could not be loaded from GitHub. You can still use patterns.",e.preserve.patternsOpen=!0}finally{e.preserve.loading=!1}}}e.watch("source.commit",k=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&k&&e.sourceUrl&&ct().catch(()=>{})}),e.openPreserveFiles=()=>{let k={},M=[];for(let W of e.options?.preserveFiles||[]){let de=String(W).trim();de&&(!M.length&&K(de)?k[Co(de.slice(1),Q)]=!0:M.push(de))}let U={};for(let W of Object.keys(k)){let de=W.split("/");for(let he=1;he<de.length;he++)U[de.slice(0,he).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:k,expanded:U,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Ee++,d(()=>{let W=document.getElementById("preserve-files-dialog");W?.showModal&&!W.open&&W.showModal(),document.getElementById("preserve-files-search")?.focus()},0),ct()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=ml([...te(),...se()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!X)return[];let k=Je(),M=(he,je,Vt)=>{let mt=!!e.preserve.picked[he],Rt=k(he);return{kind:"file",path:he,label:Vt,depth:je,state:Rt?"all":"none",locked:!mt&&Rt,note:!mt&&Rt?"matched by a pattern":mt&&!Rt?"excluded by a pattern":""}},U=String(e.preserve.search||"").trim().toLowerCase();if(U)return X.files.filter(he=>he.toLowerCase().includes(U)).slice(0,300).map(he=>M(he,0,he));let W=[],de=(he,je)=>{let Vt=X.dirs.get(he);for(let mt of Vt.dirs){let Rt=!!e.preserve.expanded[mt],Wt=se().includes(ue(mt));W.push({kind:"dir",path:mt,label:mt.slice(he?he.length+1:0)+"/",depth:je,open:Rt,state:it(mt),locked:!1,note:Wt?"whole folder":""}),Rt&&de(mt,je+1)}for(let mt of Vt.files)W.push(M(mt,je,mt.slice(he?he.length+1:0)))};return de("",0),W},e.preserveCount=()=>X?X.files.filter(Ve).length:0,e.togglePreserveDir=k=>{e.preserve.expanded[k]=!e.preserve.expanded[k]},e.togglePreserveFile=k=>{e.preserve.picked[k]=!e.preserve.picked[k],Ee++},e.togglePreserveFolder=k=>{let M=ue(k),U=ie(k),W=se().filter(he=>he!==M&&he!==U),de=it(k)==="all"||se().includes(M);for(let he of Ce(k))e.preserve.picked[he]=!1;Ee++,e.preserve.patterns=(de?W:[...W,M]).join(`
`),de&&Ce(k).some(Ve)&&(e.preserve.patterns=[...W,U].join(`
`))};let Mt=/^readme(\.[^/]*)?$/i,Pt=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],lt=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],ft=k=>{let M=_e(k),U=M.indexOf("."),W=Pt.indexOf(U===-1?"":M.slice(U).toLowerCase());return W===-1?Pt.length:W},Qt=()=>!!X&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!Qt())return"";for(let k of[".github","","docs"]){let M=(X.dirs.get(k)?.files||[]).filter(U=>Mt.test(_e(U)));if(M.length)return M.sort((U,W)=>ft(U)-ft(W)||Re(U,W))[0]}return""},e.readmeName=()=>_e(e.readmePath())||"README.md";let Eo={key:null,fn:()=>!1},Sl=()=>{let k=(e.options?.preserveFiles||[]).map(U=>String(U).trim()).filter(Boolean),M=k.join(`
`);if(M!==Eo.key){let U=()=>!1;try{k.length&&(U=hl(k))}catch{}Eo={key:M,fn:U}}return Eo.fn};e.pathPreserved=k=>!!k&&Sl()(k),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let k=Sl();if(Qt()){let M=e.readmePath();return!!M&&k(M)}return lt.some(M=>k(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function li(){let k={terms:e.terms?e.terms.split(`
`):[],filePath:e.previewOpenPath()||"README.md",preserveFiles:e.options.preserveFiles||[],image:!!e.options.image,link:!!e.options.link,repoId:e.repoId};e.source&&e.source.branch&&(k.branchName=e.source.branch);try{let M=parseGithubUrl(e.sourceUrl);k.repoName=`${M.owner}/${M.repo}`}catch{}return k}function Vr(k,M,U){let W=null,de=0,he=()=>{if(e.detectedType!==k)return;W&&d.cancel(W);let je=++de;e.previewStatus="loading",W=d(()=>{W=null;let Vt=M();if(!Vt){e.previewStatus="idle";return}t.post("/api/anonymize-preview",Vt).then(mt=>{je===de&&(U(mt.data,Vt),e.previewStatus="ready")}).catch(()=>{je===de&&(e.previewStatus="error")})},200)};return he.cancel=()=>{de++,W&&d.cancel(W),W=null},e.on("dispose",he.cancel),he}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof ln!="string"?Nl(e.previewFile):Gt()),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()};let et=mn(Gs(e));Object.defineProperty(e,"previewViewer",{get:()=>et}),Ha(et,e),Object.assign(et,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),et.preview=!0,et.fileSize=k=>k===et.filePath&&typeof ln=="string"?new Blob([ln]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,et.openPreserveFiles=()=>e.openPreserveFiles(),et.previewPreserved=()=>e.previewPreserved(),et.retryContent=()=>e.retryPreview();let Mf=k=>ce.has(k)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(k),Lr=(k="")=>({path:k,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=Lr();let as=0,ln=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=k=>{if(k=k||"",k&&k===e.readmePath()&&(k=""),as++,ln=null,ui(),Gt.cancel(),e.previewFile=k,e.previewDoc=Lr(k),et.sidebarCollapsed=!0,et.content=null,!k){e.readme?Gt():e.previewStatus="idle";return}if(Mf(k)){qr("binary"),e.previewStatus="ready";return}Nl(k)};function El(){as++,ln=null,e.previewFile="",e.previewDoc=Lr(),et.sidebarCollapsed=!0,et.content=null}function Nl(k){let M=++as;ln=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let U;try{U=parseGithubUrl(e.sourceUrl)}catch{U=null}if(!U||!e.source?.commit){Object.assign(e.previewDoc,{loading:!1,loadError:"The repository is still loading. Try again in a moment."}),e.previewStatus="error";return}t.get(`/api/repo/${U.owner}/${U.repo}/file`,{params:{commit:e.source.commit,path:k,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&r.repoId&&me(e.sourceUrl)===e._originalFullName?r.repoId:void 0,repositoryID:be()},transformResponse:W=>W}).then(W=>{if(M!==as)return;e.previewDoc.loading=!1;let de=typeof W.headers=="function"&&W.headers("content-type")||"";if(/json/i.test(de)){let he=null;try{he=JSON.parse(W.data)}catch{}if(he&&he.binary===!0){qr("binary"),e.previewStatus="ready";return}}ln=typeof W.data=="string"?W.data:"",Gt()},W=>{if(M!==as)return;e.previewDoc.loading=!1;let de=Dr(W);if(de==="file_too_big"){qr("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=xn.ERRORS[de]||"GitHub did not return this file.",e.previewStatus="error"})}let di;function ui(){di&&window.URL.revokeObjectURL(di),di=void 0,et.url=void 0}e.on("dispose",ui);function qr(k){ui(),e.previewDoc.note=k,et.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),et.type=k==="too_big"?"error":"binary",et.content=k==="too_big"?"file_too_big":"binary"}function Vf(k){try{let M=parseGithubUrl(e.sourceUrl),U=e.source.branch||e.details&&e.details.defaultBranch||"main",W=k&&k.includes("/")?k.slice(0,k.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${U}/${W}`}catch{return""}}let Rl=Vr("repo",()=>e.previewFile?typeof ln!="string"?null:{content:ln,options:li()}:e.readme?{content:e.readme,options:li()}:null,k=>{if(typeof k?.content!="string")throw Error("Invalid preview response");ui(),window.URL?.createObjectURL&&(et.url=di=window.URL.createObjectURL(new Blob([k.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();et.prepareFile(e.previewPathName(M)),et.fileBaseUrl=Vf(M),et.renderFileContent(k.content,et.type,et.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=k.content)}),Gt=()=>{e.previewFile&&typeof ln!="string"||Rl()};Gt.cancel=Rl.cancel;let No=rt(new Map),Fr=new Set,$r=new Set,ls="",ds=null,ci=()=>String(e.terms||"").split(`
`).filter(k=>k.trim());function Lf(){ds=null;let k=ci(),M=k.join(`
`);M!==ls&&(No.clear(),$r.clear(),ls=M);let U=[...Fr].filter(W=>!No.has(W));if(Fr.clear(),!(!U.length||!k.length))for(let W=0;W<U.length;W+=400){let de=U.slice(W,W+400);t.post("/api/anonymize-preview",{contents:de,options:{terms:k,image:!0,link:!0}}).then(he=>{if(ls!==M||ci().join(`
`)!==M)return;let je=he.data?.contents;if(!Array.isArray(je)||je.length!==de.length)throw Error("Invalid preview response");de.forEach((Vt,mt)=>No.set(Vt,typeof je[mt]=="string"?je[mt]:Vt))}).catch(()=>{ls===M&&de.forEach(he=>$r.add(he))})}}e.previewName=k=>{if(!k||!ci().length)return k;if(ls===ci().join(`
`)){if(No.has(k))return No.get(k);if($r.has(k))return k}return Fr.add(k),ds||(ds=d(Lf,120)),k},e.previewPathName=k=>{k=String(k||"");let M=k.lastIndexOf("/");return M<0?e.previewName(k):e.previewName(k.slice(0,M))+"/"+e.previewName(k.slice(M+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{et.repoId=e.repoId||"repository",et.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),et.paths=et.filePath.split("/"),et.files=e.previewTreeFiles(),et.loadedFolders=Object.fromEntries([...ke?.dirs.keys()||[]].map(k=>[e.previewName(k),!0]))},!0),e.on("dispose",()=>{ds&&d.cancel(ds)});function Ro(){!e.anonymize||!e.anonymize.terms||Gt()}async function Tl(){let k=parseGithubUrl(e.sourceUrl),M=g();try{Do(),st();let U=await t.get(`/api/pr/${k.owner}/${k.repo}/${k.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(M))return;e.details=U.data,e.pullRequestId||(e.pullRequestId=k.repo+"-PR"+k.pullRequestId+"-"+generateRandomId(4))}catch(U){if(!y(M))return;throw ze(U),U}finally{C(M)}}let To=rt(new Map);function qf(){let k=new Set,M=e.details&&e.details.pullRequest;if(!M)return k;typeof M.title=="string"&&k.add(M.title),typeof M.body=="string"&&k.add(M.body),typeof M.diff=="string"&&k.add(M.diff);let U=M.comments||[];for(let W of U)typeof W.author=="string"&&k.add(W.author),typeof W.body=="string"&&k.add(W.body);return k}let Sn=Vr("pr",()=>{let k=qf(),M=Array.from(k);return M.length===0?null:{contents:M,options:li()}},(k,M)=>{if(!Array.isArray(k?.contents)||k.contents.length!==M.contents.length||k.contents.some(de=>typeof de!="string"))throw Error("Invalid preview response");let U=M.contents,W=new Map;for(let de=0;de<U.length&&de<k.contents.length;de++)W.set(U[de],k.contents[de]);To.clear(),W.forEach((de,he)=>To.set(he,de))});e.anonymizePrContent=function(k){return k&&(To.has(k)?To.get(k):"")};async function Pl(){let k=parseGithubUrl(e.sourceUrl),M=g();try{Do(),st(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let U=await t.get(`/api/gist/source/${k.gistId}`);if(!y(M))return;e.details=U.data,e.gistId||(e.gistId="gist-"+k.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(U){if(!y(M))return;if(U.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,oe("sourceUrl","missing",!1);return}if(U.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,oe("sourceUrl","missing",!1);return}throw ze(U),U}finally{C(M)}}let Po=rt(new Map);function Ff(){let k=new Set,M=e.details&&e.details.gist;if(!M)return k;typeof M.description=="string"&&k.add(M.description),typeof M.ownerLogin=="string"&&k.add(M.ownerLogin);let U=M.files||[];for(let de of U)typeof de.filename=="string"&&k.add(de.filename),typeof de.content=="string"&&k.add(de.content);let W=M.comments||[];for(let de of W)typeof de.author=="string"&&k.add(de.author),typeof de.body=="string"&&k.add(de.body);return k}let En=Vr("gist",()=>{let k=Ff(),M=Array.from(k);return M.length===0?null:{contents:M,options:li()}},(k,M)=>{if(!Array.isArray(k?.contents)||k.contents.length!==M.contents.length||k.contents.some(de=>typeof de!="string"))throw Error("Invalid preview response");let U=M.contents,W=new Map;for(let de=0;de<U.length&&de<k.contents.length;de++)W.set(U[de],k.contents[de]);Po.clear(),W.forEach((de,he)=>Po.set(he,de)),_r()});e.anonymizeGistContent=function(k){return k&&(Po.has(k)?Po.get(k):"")},e.previewGistFiles=[];function _r(){let k=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=k.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",_r,!0),e.watch("terms",_r);function $f(){let k=e.conference;if(e.conference_data=null,!k)return;let M=k===b||e.isUpdate&&k===e._originalConference;k!==b&&(b=null),t.get("/api/conferences/"+k).then(U=>{e.conference===k&&(e.conference_data=U.data,e.conference_data.startDate=new Date(e.conference_data.startDate),e.conference_data.endDate=new Date(e.conference_data.endDate),!M&&(e.options.expirationDate=new Date(e.conference_data.endDate),e.options.expirationMode="remove",e.options.update=e.conference_data.options.update,e.options.image=e.conference_data.options.image,e.options.pdf=e.conference_data.options.pdf,e.options.notebook=e.conference_data.options.notebook,e.options.link=e.conference_data.options.link))},()=>{e.conference===k&&(e.conference_data=null)})}function Do(){oe("repoId","used",!0),oe("repoId","format",!0),oe("pullRequestId","used",!0),oe("pullRequestId","format",!0),oe("gistId","used",!0),oe("gistId","format",!0),oe("sourceUrl","used",!0),oe("sourceUrl","missing",!0),oe("sourceUrl","access",!0),oe("sourceUrl","github",!0),oe("commit","exists",!0),oe("conference","activated",!0),oe("terms","format",!0),e.termHints=[]}function pi(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let k=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||k&&k.invalid?(k&&k.setDirty&&k.setDirty(),e.error= Line truncated
`).filter(he=>he),connection:e.githubConnection,fullName:`${U.owner}/${U.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(W.options.pageSource=e.details.pageSource),Do();let de=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},he=>{if(he.data){let je=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(he.data.error);je||i("ERRORS."+he.data.error).then(Vt=>{e.error=Vt},console.error),fi(he.data.error),je&&(he.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,Be(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{M.disabled=!1})},e.anonymizeGist=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(pi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=k.currentTarget||k.target.closest?.("button")||k.target;M.disabled=!0;let U=parseGithubUrl(e.sourceUrl),W={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(he=>he),source:{gistId:U.gistId},options:e.options,conference:e.conference};Do();let de=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},he=>{he.data&&(i("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),fi(he.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=k=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(pi())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=k.currentTarget||k.target.closest?.("button")||k.target;M.disabled=!0;let U=parseGithubUrl(e.sourceUrl),W={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(he=>he),source:{repositoryFullName:`${U.owner}/${U.repo}`,pullRequestId:U.pullRequestId},options:e.options,conference:e.conference};Do();let de=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(de,W,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},he=>{he.data&&(i("ERRORS."+he.data.error).then(je=>{e.error=je},console.error),fi(he.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{$f()}),e.termHints=[],e.matchTermAsWritten=k=>{e.terms=dp(e.terms,k)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&Gt()}),e.watch("terms",()=>{e.termHints=lp(e.terms),e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Ro(),e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()}),e.watch("details",()=>{e.detectedType==="pr"&&Sn(),e.detectedType==="gist"&&En()},!0)},yl=function(e,t,o,r,s,i){Ha(e);let d=yt();Ir();let p=Ot(),c=0,v=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){v&&(v.resolve(),v=null),m&&(d.timeout.cancel(m),m=null)}let g=!1;e.on("dispose",()=>{g=!0,c++,y(),C&&C.resolve()}),e.files=[],e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent),e.fileSearchQuery="",e.fileSearchResults=null,e.fileSearchLoading=!1,p(document,"click",O=>{e.symbolsOpen&&!O.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!O.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!O.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&O.target.isConnected&&!O.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!O.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!O.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",O=>{O.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(O.ctrlKey||O.metaKey)&&!O.altKey&&O.key&&O.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(O.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(O){if((O.metaKey||O.ctrlKey)&&O.key==="k"){O.preventDefault();var q=document.querySelector(".tree-search-input");q&&(q.focus(),q.select())}});var C=null;e.onFileSearchChange=function(){C&&(C.resolve(),C=null);let O=e.fileSearchQuery;if(!O||O.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let q=i.defer();C=q,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(O)}`,{timeout:q.promise}).then(function(E){if(!(g||C!==q)){C=null,e.fileSearchLoading=!1;var F={};e.files.forEach(function(_e){F[(_e.path||"")+"/"+_e.name]=!0});for(var Y=[],G={},x=0;x<E.data.length;x++){var re=E.data[x];if(re.path)for(var ee=re.path.split("/"),fe="",ge=0;ge<ee.length;ge++){var $e=fe;fe=fe?fe+"/"+ee[ge]:ee[ge];var He=$e+"/"+ee[ge];!F[He]&&!G[He]&&(G[He]=!0,Y.push({name:ee[ge],path:$e}))}}Y.sort(function(_e,J){return(_e.path||"").split("/").length-(J.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var Ye=[],ze=0;ze<E.data.length;ze++){var st=E.data[ze],Re=(st.path||"")+"/"+st.name;!F[Re]&&st.size!=null&&(Ye.push(st),F[Re]=!0)}Ye.length>0&&e.files.push.apply(e.files,Ye),e.fileSearchResults=E.data}},function(){!g&&C===q&&(C=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(O,q){if(e.repoId!=r.repoId)return z();if((r.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=r.path||"",e.paths=e.filePath.split("/").filter(E=>E&&E.trim().length>0),L();for(let E=0;E<e.paths.length-1;E++){let F=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(G=>G.path===F)||e.getFiles(F)}}});function w(){if(e.paths[0]!="")return;let O=["readme.md","readme.txt","readme.org","readme.1st","readme"],q={};for(let F of e.files)F.name.toLowerCase().indexOf("readme")>-1&&(q[F.name.toLowerCase()]=F.name);let E=null;for(let F of O)if(q[F]){E=F;break}if(!E&&Object.keys(q).length>0&&(E=Object.keys(q)[0]),E){let F=o.url();F[F.length-1]!="/"&&(F+="/"),o.url(F+encodePathForUrl(q[E]))}}e.fileCounts=null;let S=0,N=new Set,b=!1;e.getFiles=function(O,q=!1){let E=e.repoId,F=S;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(O)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(g||E!==e.repoId||F!==S)return[];let G=O||"";return e.files=e.files.filter(x=>x.path!==G),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[G]:!0},P(G,F),Y.data},function(Y){if(g||E!==e.repoId||F!==S)return[];q||(e.type="error",e.content=Dr(Y),e.files=[])})};function P(O,q){if(b||N.has(O))return;N.add(O);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(O)}`).then(function(F){g||E!==e.repoId||q!==S||(e.fileCounts={...e.fileCounts,...F.data})},function(){ Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,10,s8),[[u,{state:e.viewState,set:c=>{e.terms=c},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[132]||(t[132]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",i8,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=m()),n("small",r8,[t[121]||(t[121]=m("Regex is supported. Replaced by ",-1)),n("code",null,d(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[122]||(t[122]=m(", or use ",-1)),t[123]||(t[123]=n("code",null,"term=>replacement",-1)),t[124]||(t[124]=m(" to pick your own (e.g. ",-1)),t[125]||(t[125]=n("code",null,"Anonymous=>ABC",-1)),t[126]||(t[126]=m(").",-1))])]),(a(!0),l(V,null,J((e.termHints||[]).slice(0,3),c=>(a(),l("div",{class:"term-hint",key:c.line},[n("span",null,[t[129]||(t[129]=m("In ",-1)),n("code",null,d(c.term),1),t[130]||(t[130]=m(", ",-1)),n("code",null,d(c.symbols.join(" ")),1),m(" "+d(c.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:v=>e.matchTermAsWritten(c.line)},"Match as written",8,a8)]))),128)),(e.termHints||[]).length>3?(a(),l("div",l8,d(e.termHints.length-3)+" more "+d(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):p("v-if",!0),P(n("div",d8,"Terms are in an invalid format.",512),[[x,e.anonymize?.terms?.errors?.format]])]),P(n("div",u8,[n("div",c8,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",p8,d(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[26]||(t[26]=c=>e.openPreserveFiles())},d((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,f8)],512),[[x,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[31]||(t[31]=de(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=de(c=>e.savePreserveFiles(),["prevent"]))},[t[137]||(t[137]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[138]||(t[138]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),P(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[27]||(t[27]=c=>e.preserve.search=c)},null,512),[[nt,e.preserve.search]]),n("div",m8,[e.preserve.loading?(a(),l("p",h8,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",g8,d(e.preserve.error),1)):(a(),l(V,{key:2},[(a(!0),l(V,null,J(e.preserveRows(),(c,v)=>(a(),l("div",{class:"preserve-item",key:c.kind+":"+c.path,style:De({paddingLeft:c.depth*18+6+"px"})},[c.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":c.open?"true":"false","aria-label":(c.open?"Collapse ":"Expand ")+c.label,onClick:h=>e.togglePreserveDir(c.path)},d(c.open?"\u25BE":"\u25B8"),9,v8)):(a(),l("span",y8)),n("input",{type:"checkbox",id:"pf-"+v,"aria-label":c.kind==="dir"?"Leave folder "+c.path+" unredacted":null,checked:c.state==="all",".indeterminate":c.state==="some",disabled:c.locked,onChange:h=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,b8),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:h=>c.kind==="dir"&&e.togglePreserveDir(c.path)},d(c.label),9,w8),c.note?(a(),l("span",k8,d(c.note),1)):p("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",C8,d(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):p("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",S8,"This repository has too many files to list them all. Use a pattern for files you cannot find.")):p("v-if",!0),n("details",{class:"preserve-patterns",open:e.preserve.patternsOpen},[t[134]||(t[134]=n("summary",null,"Patterns",-1)),P(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=c=>e.preserve.patterns=c)},null,512),[[nt,e.preserve.patterns]]),t[135]||(t[135]=n("small",{class:"form-text text-muted"},[m("One per line, as in .gitignore: "),n("code",null,"*.bib"),m(" matches in any folder; "),n("code",null,"/refs.bib"),m(" and "),n("code",null,"paper/refs.bib"),m(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),m(" covers everything inside it; "),n("code",null,"!private.bib"),m(" excludes again.")],-1))],8,E8),n("div",N8,[n("span",R8,d(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",T8,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=c=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):p("v-if",!0)],512),[[x,e.detectedType&&e.sourceReady()]]),P(n("section",P8,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),P(n("div",null,[n("div",D8,[P(n("input",A8,null,512),[[u,{state:e.viewState,set:c=>{e.options.link=c},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",I8,[P(n("input",O8,null,512),[[u,{state:e.viewState,set:c=>{e.options.image=c},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",M8,[P(n("input",V8,null,512),[[u,{state:e.viewState,set:c=>{e.options.pdf=c},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",L8,[P(n("input",q8,null,512),[[u,{state:e.viewState,set:c=>{e.options.notebook=c},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",$8,[P(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,F8),[[u,{state:e.viewState,set:c=>{e.options.page=c},value:e.options?.page,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?p("v-if",!0):(a(),l("small",_8,d(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",U8,d(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):p("v-if",!0)])],512),[[x,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",B8,[...t[145]||(t[145]=[m("Images and PDFs are served unchanged. Review their contents and metadata before sharing. ",-1),n("a",{href:"/faq#formats"},"Supported formats",-1)])])):p("v-if",!0),P(n("div",null,[n("div",z8,[P(n("input",H8,null,512),[[u,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",j8,[P(n("input",G8,null,512),[[u,{state:e.viewState,set:c=>{e.options.content=c},value:e.options?.content,form:"anonymize",options:{}}]]),t[147]||(t[147]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",W8,[P(n("input",K8,null,512),[[u,{state:e.viewState,set:c=>{e.options.comments=c},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",Y8,[P(n("input",J8,null,512),[[u,{state:e.viewState,set:c=>{e.options.username=c},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",X8,[P(n("input",Q8,null,512),[[u,{state:e.viewState,set:c=>{e.options.date=c},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",Z8,[P(n("input",x8,null,512),[[u,{state:e.viewState,set:c=>{e.options.origin=c},value:e.options?.origin,form:"anonymize",options:{}}]]),t[151]||(t[151]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[x,e.detectedType==="gist"]]),P(n("div",null,[n("div",e6,[P(n("input",t6,null,512),[[u,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",n6,[P(n("input",o6,null,512),[[u,{state:e.viewState,set:c=>{e.options.body=c},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]),n( Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(V,null,J([1,2,3,4],(r,u)=>(a(),l(V,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",T7,[...t[63]||(t[63]=[n("div",{class:"cell-anon",role:"cell"},[n("span",{class:"skeleton skeleton-badge"}),n("div",{class:"anon-text"},[n("span",{class:"skeleton skeleton-line",style:{width:"38%"}}),n("span",{class:"skeleton skeleton-line skeleton-line-sm",style:{width:"56%"}})])],-1),n("div",{class:"cell-status",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"60%"}})],-1),n("div",{class:"cell-views num",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"40%"}})],-1),n("div",{class:"cell-expires",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"55%"}})],-1),n("div",{class:"cell-actions",role:"cell"},null,-1)])])):p("v-if",!0)],64))),64)),(a(!0),l(V,null,J(e.filteredItems,(r,u)=>(a(),l(V,{key:r?._type+":"+(r?._id||u)},[e.loading?p("v-if",!0):(a(),l("div",{key:0,class:R(["paper-table-row",{"repo-inactive":r?._statusKey=="expired"||r?._statusKey=="removed","repo-error":r?.status=="error","row-clickable":!!r?._viewUrl}]),role:"row",onClick:f=>e.openItem(r,f)},[n("div",D7,[n("span",{class:"project-type-icon",role:"img","aria-label":r?._type==="repo"?"Repository":r?._type==="pr"?"Pull request":"Gist",title:r?._type==="repo"?"Repository":r?._type==="pr"?"Pull request":"Gist"},[(a(),l("svg",I7,[n("use",{href:"#project-type-"+r._type},null,8,O7)]))],8,A7),n("div",M7,[n("div",V7,[r?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:r._label,href:e.safeUrl(r?._viewUrl)},[(r?._label||"").indexOf("/")>0?(a(),l(V,{key:0},[n("span",q7,d(r._label.slice(0,r._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",$7,d(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(V,{key:1},[m(d(r?._label),1)],64))],8,L7)):p("v-if",!0),r?._viewUrl?p("v-if",!0):(a(),l("span",F7,[(r?._label||"").indexOf("/")>0?(a(),l(V,{key:0},[n("span",_7,d(r._label.slice(0,r._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",U7,d(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(V,{key:1},[m(d(r?._label),1)],64))])),r?.role==="coauthor"?(a(),l("span",B7,"Co-author")):p("v-if",!0)]),r?._id||r?._type==="repo"&&r?.source?.commit||r?.conference?(a(),l("div",z7,[r?._id?(a(),l("code",{key:0,class:"anonymous-id",title:r._id},[r._id.length>14?(a(),l(V,{key:0},[n("span",j7,d(r._id.slice(0,-6)),1),n("span",G7,d(r._id.slice(-6)),1)],64)):(a(),l(V,{key:1},[m(d(r._id),1)],64))],8,H7)):p("v-if",!0),r?._type==="repo"&&r?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:r.source.commit},d(r.source.commit.substring(0,7)),9,W7)):p("v-if",!0),r?.conference?(a(),l("span",{key:2,class:"cell-conf conf-tag",title:"Conference: "+r.conference},[t[66]||(t[66]=n("svg",{class:"project-type-svg","aria-hidden":"true"},[n("use",{href:"#project-icon-conference"})],-1)),n("span",{class:"conf-name",textContent:d(r?.conference)},null,8,Y7)],8,K7)):p("v-if",!0)])):p("v-if",!0)])]),n("div",J7,[n("div",X7,[n("div",Q7,[n("span",{class:R(["status-dot","status-"+r?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:d(e.fmt?.statusLabel(r?.status))},null,8,Z7),r?.status=="removed"?(a(),l(V,{key:0},[t[67]||(t[67]=n("span",{class:"seg-sep status-removed-sep","aria-hidden":"true"},"\xB7",-1)),n("button",{type:"button",class:"project-attention-action status-enable",onClick:de(f=>e.refreshItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,x7)],64)):p("v-if",!0)]),r?.status=="error"&&r?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:d(e.fmt?.statusMsg(r?.statusMessage)),title:r?.statusMessage},null,8,eU)):p("v-if",!0),r?._stale?(a(),l("div",{key:1,class:"status-sub status-sub-warn",title:"Last activity "+e.fmt?.humanTime(r?.anonymizeDate||r?.lastView)},d(e.idleText(r)),9,tU)):p("v-if",!0),r.status==="error"&&r._editUrl?(a(),l("a",{key:2,class:"project-attention-action",href:e.safeUrl(r._editUrl)},"Fix source",8,nU)):p("v-if",!0),r._stale||r._broken?(a(),l("div",oU,[r._stale&&!r._broken?(a(),l("span",sU,[...t[68]||(t[68]=[m("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):p("v-if",!0),r._stale||r._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:de(f=>e.showProjectDetails(r),["stop"]),"data-project-actions":r._broken?encodeURIComponent(r._type+":"+r._id):null,"aria-controls":r._broken?e.projectDetailsId(r):null,"aria-expanded":r._broken?e.selectedProject===r:null},d(r._broken?"Review details":"Check progress"),9,iU)):p("v-if",!0)])):p("v-if",!0),r?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:de(f=>e.extendItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,rU)):p("v-if",!0),r?.status=="removed"&&r?.anonymizeDate?(a(),l("div",aU,"anonymized Line truncated
anonymous_github`)])])])])]),p(" Limitations "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-warning"})]),m("Limitations ")]),n("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),n("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[n("div",{class:"panel-body p-3"},[n("ul",null,[n("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),n("li",null," Files larger than 8 MB are not supported. "),n("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),n("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),p(" Privacy and security "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-shield"})]),m("Privacy and security ")]),n("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),n("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[n("div",{class:"panel-body p-3"},[n("p",null," Repository data is used to provide the anonymization service. If you purchase a plan, Stripe processes payment and billing information. When a repository is removed or expires, only its configuration is retained. This makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),n("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[n("div",{class:"panel-body p-3"},[n("p",null,[m("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),n("a",{href:"/connections"},"GitHub connections"),m(" page.")]),n("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),n("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),n("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[n("div",{class:"panel-body p-3"},[n("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),p(" Self-hosting "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#project-icon-storage"})]),m("Self"),n("span",{class:"serif-hy"},"-"),m("hosting ")]),n("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),n("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[n("div",{cla Line truncated
jane.smith@example.org`},null,10,I5),[[d,{state:e.viewState,set:c=>{e.terms=c},value:e.terms,form:"anonymize",options:{debounce:250}}]]),t[132]||(t[132]=n("small",{class:"form-text text-muted"},"One term per line.",-1)),n("details",O5,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=h()),n("small",M5,[t[121]||(t[121]=h("Regex is supported. Replaced by ",-1)),n("code",null,u(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[122]||(t[122]=h(", or use ",-1)),t[123]||(t[123]=n("code",null,"term=>replacement",-1)),t[124]||(t[124]=h(" to pick your own (e.g. ",-1)),t[125]||(t[125]=n("code",null,"Anonymous=>ABC",-1)),t[126]||(t[126]=h(").",-1))])]),(a(!0),l(T,null,H((e.termHints||[]).slice(0,3),c=>(a(),l("div",{class:"term-hint",key:c.line},[n("span",null,[t[129]||(t[129]=h("In ",-1)),n("code",null,u(c.term),1),t[130]||(t[130]=h(", ",-1)),n("code",null,u(c.symbols.join(" ")),1),h(" "+u(c.symbols.length>1?"are regex symbols":"is a regex symbol")+", so it may not match the text as written.",1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm",onClick:v=>e.matchTermAsWritten(c.line)},"Match as written",8,V5)]))),128)),(e.termHints||[]).length>3?(a(),l("div",L5,u(e.termHints.length-3)+" more "+u(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),D(n("div",q5,"Terms are in an invalid format.",512),[[Z,e.anonymize?.terms?.errors?.format]])]),D(n("div",F5,[n("div",$5,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",_5,u(e.preserveSummary()),1)]),n("button",{type:"button",class:"btn btn-outline-ink btn-sm","aria-describedby":"preserve-files-label",disabled:!e.source?.commit,onClick:t[26]||(t[26]=c=>e.openPreserveFiles())},u((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,U5)],512),[[Z,e.detectedType==="repo"]]),e.preserve?.open?(a(),l("dialog",{key:0,id:"preserve-files-dialog",class:"preserve-dialog","aria-labelledby":"preserve-files-title",onCancel:t[31]||(t[31]=ae(c=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=ae(c=>e.savePreserveFiles(),["prevent"]))},[t[137]||(t[137]=n("h2",{id:"preserve-files-title"},"Leave files unredacted",-1)),t[138]||(t[138]=n("p",{class:"preserve-intro"},"Checked files are shown exactly as written, for example a bibliography where redacted self-citations would reveal you. File names are still redacted.",-1)),D(n("input",{type:"search",id:"preserve-files-search",class:"form-control",placeholder:"Search files","aria-label":"Search files",autocomplete:"off","onUpdate:modelValue":t[27]||(t[27]=c=>e.preserve.search=c)},null,512),[[nt,e.preserve.search]]),n("div",B5,[e.preserve.loading?(a(),l("p",z5,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",H5,u(e.preserve.error),1)):(a(),l(T,{key:2},[(a(!0),l(T,null,H(e.preserveRows(),(c,v)=>(a(),l("div",{class:"preserve-item",key:c.kind+":"+c.path,style:De({paddingLeft:c.depth*18+6+"px"})},[c.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":c.open?"true":"false","aria-label":(c.open?"Collapse ":"Expand ")+c.label,onClick:m=>e.togglePreserveDir(c.path)},u(c.open?"\u25BE":"\u25B8"),9,j5)):(a(),l("span",G5)),n("input",{type:"checkbox",id:"pf-"+v,"aria-label":c.kind==="dir"?"Leave folder "+c.path+" unredacted":null,checked:c.state==="all",".indeterminate":c.state==="some",disabled:c.locked,onChange:m=>c.kind==="dir"?e.togglePreserveFolder(c.path):e.togglePreserveFile(c.path)},null,40,W5),n("label",{for:c.kind==="file"?"pf-"+v:null,class:"preserve-name",onClick:m=>c.kind==="dir"&&e.togglePreserveDir(c.path)},u(c.label),9,K5),c.note?(a(),l("span",Y5,u(c.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",J5,u(e.preserve.search?"No file matches your search.":"No text files in this commit."),1)):f("v-if",!0)],64))]),e.preserve.truncated?(a(),l("p",X5,"This repository has too many files to list them all. Use a pattern for files you cannot find.")):f("v-if",!0),n("details",{class:"preserve-patterns",open:e.preserve.patternsOpen},[t[134]||(t[134]=n("summary",null,"Patterns",-1)),D(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=c=>e.preserve.patterns=c)},null,512),[[nt,e.preserve.patterns]]),t[135]||(t[135]=n("small",{class:"form-text text-muted"},[h("One per line, as in .gitignore: "),n("code",null,"*.bib"),h(" matches in any folder; "),n("code",null,"/refs.bib"),h(" and "),n("code",null,"paper/refs.bib"),h(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),h(" covers everything inside it; "),n("code",null,"!private.bib"),h(" excludes again.")],-1))],8,Q5),n("div",Z5,[n("span",x5,u(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",e6,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=c=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[Z,e.detectedType&&e.sourceReady()]]),D(n("section",t6,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),D(n("div",null,[n("div",n6,[D(n("input",o6,null,512),[[d,{state:e.viewState,set:c=>{e.options.link=c},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",s6,[D(n("input",i6,null,512),[[d,{state:e.viewState,set:c=>{e.options.image=c},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",r6,[D(n("input",a6,null,512),[[d,{state:e.viewState,set:c=>{e.options.pdf=c},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",l6,[D(n("input",d6,null,512),[[d,{state:e.viewState,set:c=>{e.options.notebook=c},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",u6,[D(n("input",{class:"form-check-input",type:"checkbox",id:"page",name:"page",disabled:!e.details?.hasPage||e.details?.pageSource&&e.details?.pageSource?.branch!==e.source?.branch},null,8,c6),[[d,{state:e.viewState,set:c=>{e.options.page=c},value:e.options?.page,form:"anonymize",options:{}}]]),t[144]||(t[144]=n("label",{class:"form-check-label",for:"page"},"GitHub Pages",-1)),e.details?.hasPage?f("v-if",!0):(a(),l("small",p6,u(e.fmt?.translate("WARNINGS.page_not_enabled_on_repo")),1)),e.details?.hasPage&&e.details?.pageSource?.branch&&e.source?.branch&&e.details.pageSource.branch!==e.source.branch?(a(),l("small",f6,u(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[Z,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",m6,[...t[145]||(t[145]=[h("Images and PDFs are served unchanged. Review their contents and metadata before sharing. ",-1),n("a",{href:"/faq#formats"},"Supported formats",-1)])])):f("v-if",!0),D(n("div",null,[n("div",h6,[D(n("input",g6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[146]||(t[146]=n("label",{class:"form-check-label",for:"title-gist"},"Gist description",-1))]),n("div",v6,[D(n("input",y6,null,512),[[d,{state:e.viewState,set:c=>{e.options.content=c},value:e.options?.content,form:"anonymize",options:{}}]]),t[147]||(t[147]=n("label",{class:"form-check-label",for:"content-gist"},"File contents",-1))]),n("div",b6,[D(n("input",w6,null,512),[[d,{state:e.viewState,set:c=>{e.options.comments=c},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",k6,[D(n("input",C6,null,512),[[d,{state:e.viewState,set:c=>{e.options.username=c},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",S6,[D(n("input",E6,null,512),[[d,{state:e.viewState,set:c=>{e.options.date=c},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",N6,[D(n("input",R6,null,512),[[d,{state:e.viewState,set:c=>{e.options.origin=c},value:e.options?.origin,form:"anonymize",options:{}}]]),t[151]||(t[151]=n("label",{class:"form-check-label",for:"origin-gist"},"Source gist ID",-1))])],512),[[Z,e.detectedType==="gist"]]),D(n("div",null,[n("div",T6,[D(n("input",P6,null,512),[[d,{state:e.viewState,set:c=>{e.options.title=c},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",D6,[D(n("input",A6,null,512),[[d,{state:e.viewState,set:c=>{e.options.body=c},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]),n( Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(T,null,H([1,2,3,4],(i,d)=>(a(),l(T,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",eU,[...t[63]||(t[63]=[n("div",{class:"cell-anon",role:"cell"},[n("span",{class:"skeleton skeleton-badge"}),n("div",{class:"anon-text"},[n("span",{class:"skeleton skeleton-line",style:{width:"38%"}}),n("span",{class:"skeleton skeleton-line skeleton-line-sm",style:{width:"56%"}})])],-1),n("div",{class:"cell-status",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"60%"}})],-1),n("div",{class:"cell-views num",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"40%"}})],-1),n("div",{class:"cell-expires",role:"cell"},[n("span",{class:"skeleton skeleton-line",style:{width:"55%"}})],-1),n("div",{class:"cell-actions",role:"cell"},null,-1)])])):f("v-if",!0)],64))),64)),(a(!0),l(T,null,H(e.filteredItems,(i,d)=>(a(),l(T,{key:i?._type+":"+(i?._id||d)},[e.loading?f("v-if",!0):(a(),l("div",{key:0,class:R(["paper-table-row",{"repo-inactive":i?._statusKey=="expired"||i?._statusKey=="removed","repo-error":i?.status=="error","row-clickable":!!i?._viewUrl}]),role:"row",onClick:p=>e.openItem(i,p)},[n("div",nU,[n("span",{class:"project-type-icon",role:"img","aria-label":i?._type==="repo"?"Repository":i?._type==="pr"?"Pull request":"Gist",title:i?._type==="repo"?"Repository":i?._type==="pr"?"Pull request":"Gist"},[(a(),l("svg",sU,[n("use",{href:"#project-type-"+i._type},null,8,iU)]))],8,oU),n("div",rU,[n("div",aU,[i?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:i._label,href:e.safeUrl(i?._viewUrl)},[(i?._label||"").indexOf("/")>0?(a(),l(T,{key:0},[n("span",dU,u(i._label.slice(0,i._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",uU,u(i._label.slice(i._label.indexOf("/")+1)),1)],64)):(a(),l(T,{key:1},[h(u(i?._label),1)],64))],8,lU)):f("v-if",!0),i?._viewUrl?f("v-if",!0):(a(),l("span",cU,[(i?._label||"").indexOf("/")>0?(a(),l(T,{key:0},[n("span",pU,u(i._label.slice(0,i._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",fU,u(i._label.slice(i._label.indexOf("/")+1)),1)],64)):(a(),l(T,{key:1},[h(u(i?._label),1)],64))])),i?.role==="coauthor"?(a(),l("span",mU,"Co-author")):f("v-if",!0)]),i?._id||i?._type==="repo"&&i?.source?.commit||i?.conference?(a(),l("div",hU,[i?._id?(a(),l("code",{key:0,class:"anonymous-id",title:i._id},[i._id.length>14?(a(),l(T,{key:0},[n("span",vU,u(i._id.slice(0,-6)),1),n("span",yU,u(i._id.slice(-6)),1)],64)):(a(),l(T,{key:1},[h(u(i._id),1)],64))],8,gU)):f("v-if",!0),i?._type==="repo"&&i?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:i.source.commit},u(i.source.commit.substring(0,7)),9,bU)):f("v-if",!0),i?.conference?(a(),l("span",{key:2,class:"cell-conf conf-tag",title:"Conference: "+i.conference},[t[66]||(t[66]=n("svg",{class:"project-type-svg","aria-hidden":"true"},[n("use",{href:"#project-icon-conference"})],-1)),n("span",{class:"conf-name",textContent:u(i?.conference)},null,8,kU)],8,wU)):f("v-if",!0)])):f("v-if",!0)])]),n("div",CU,[n("div",SU,[n("div",EU,[n("span",{class:R(["status-dot","status-"+i?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:u(e.fmt?.statusLabel(i?.status))},null,8,NU),i?.status=="removed"?(a(),l(T,{key:0},[t[67]||(t[67]=n("span",{class:"seg-sep status-removed-sep","aria-hidden":"true"},"\xB7",-1)),n("button",{type:"button",class:"project-attention-action status-enable",onClick:ae(p=>e.refreshItem(i),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,RU)],64)):f("v-if",!0)]),i?.status=="error"&&i?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:u(e.fmt?.statusMsg(i?.statusMessage)),title:i?.statusMessage},null,8,TU)):f("v-if",!0),i?._stale?(a(),l("div",{key:1,class:"status-sub status-sub-warn",title:"Last activity "+e.fmt?.humanTime(i?.anonymizeDate||i?.lastView)},u(e.idleText(i)),9,PU)):f("v-if",!0),i.status==="error"&&i._editUrl?(a(),l("a",{key:2,class:"project-attention-action",href:e.safeUrl(i._editUrl)},"Fix source",8,DU)):f("v-if",!0),i._stale||i._broken?(a(),l("div",AU,[i._stale&&!i._broken?(a(),l("span",IU,[...t[68]||(t[68]=[h("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):f("v-if",!0),i._stale||i._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:ae(p=>e.showProjectDetails(i),["stop"]),"data-project-actions":i._broken?encodeURIComponent(i._type+":"+i._id):null,"aria-controls":i._broken?e.projectDetailsId(i):null,"aria-expanded":i._broken?e.selectedProject===i:null},u(i._broken?"Review details":"Check progress"),9,OU)):f("v-if",!0)])):f("v-if",!0),i?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:ae(p=>e.extendItem(i),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,MU)):f("v-if",!0),i?.status=="removed"&&i?.anonymizeDate?(a(),l("div",VU,"anonymized Line truncated
anonymous_github`)])])])])]),f(" Limitations "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-warning"})]),h("Limitations ")]),n("div",{class:"panel-group",id:"faq-limitations",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingLimitation"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-limitations",href:"#limitation","aria-expanded":"false","aria-controls":"limitation"}," What are the limitations of Anonymous GitHub? ")])]),n("div",{id:"limitation",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingLimitation"},[n("div",{class:"panel-body p-3"},[n("ul",null,[n("li",null," Anonymous GitHub only anonymizes text-based files. Binary files (compiled executables, archives, etc.) are served as-is without anonymization. "),n("li",null," Files larger than 8 MB are not supported. "),n("li",null," Static site generators (such as Jekyll) used with GitHub Pages are not fully supported, although Markdown files are converted to HTML. "),n("li",null," The anonymization of terms within source code may change the behavior of the program (e.g., if a replaced term appears in a string literal or identifier). ")])])])])]),f(" Privacy and security "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#ui-icon-shield"})]),h("Privacy and security ")]),n("div",{class:"panel-group",id:"faq-privacy",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingData"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#data","aria-expanded":"false","aria-controls":"data"}," How is my data handled? ")])]),n("div",{id:"data",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingData"},[n("div",{class:"panel-body p-3"},[n("p",null," Repository data is used to provide the anonymization service. If you purchase a plan, Stripe processes payment and billing information. When a repository is removed or expires, only its configuration is retained. This makes it easy to restore the repository if needed and ensures that no future repository reuses the same ID. ")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingPermissions"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#permissions","aria-expanded":"false","aria-controls":"permissions"}," Why does GitHub say Anonymous GitHub asks for write access? ")])]),n("div",{id:"permissions",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingPermissions"},[n("div",{class:"panel-body p-3"},[n("p",null,[h("The GitHub App has read-only access to the repositories you choose. You can change repository access on your "),n("a",{href:"/connections"},"GitHub connections"),h(" page.")]),n("p",null,"Legacy GitHub OAuth includes write access to private repositories because GitHub's OAuth scopes do not offer a read-only option for them. Existing OAuth anonymizations and gists can still use this connection."),n("p",null,"Anonymous GitHub reads repository content. It never pushes, modifies, or deletes files on GitHub.")])])]),n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingViewer"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-privacy",href:"#viewer","aria-expanded":"false","aria-controls":"viewer"}," Can repository owners see who viewed their anonymized repository? ")])]),n("div",{id:"viewer",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingViewer"},[n("div",{class:"panel-body p-3"},[n("p",null," No. Only the total number of views is tracked as an incremental counter. It is not possible for the repository owner or for Anonymous GitHub to identify individual viewers. Reviewer anonymity is fully preserved. ")])])])]),f(" Self-hosting "),n("h4",{class:"faq-cat"},[n("svg",{class:"ui-icon mr-2","aria-hidden":"true"},[n("use",{href:"#project-icon-storage"})]),h("Self"),n("span",{class:"serif-hy"},"-"),h("hosting ")]),n("div",{class:"panel-group",id:"faq-hosting",role:"tablist","aria-multiselectable":"true"},[n("div",{class:"panel panel-default mb-3"},[n("div",{class:"panel-heading p-3",role:"tab",id:"headingDeploy"},[n("h3",{class:"panel-title"},[n("a",{class:"collapsed",role:"button","data-toggle":"collapse","data-parent":"#faq-hosting",href:"#deploy","aria-expanded":"false","aria-controls":"deploy"}," Can I deploy my own instance? ")])]),n("div",{id:"deploy",class:"panel-collapse collapse",role:"tabpanel","aria-labelledby":"headingDeploy"},[n("div",{cla Line truncated
anonymized repository often think it is about the paper, so the
label names the service and the tooltip says who to contact. `),n("li",{class:R(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),m("Report a bug ")],-1)])],2),n("li",{class:R(["nav-item nav-support-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[20]||(t[20]=[n("a",{class:"nav-link nav-support-inline",href:"https://ko-fi.com/tdurieux",target:"_blank",rel:"noopener",title:"Donate on Ko-fi to help cover hosting costs"},[n("svg",{class:"ui-icon nav-heart","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})]),m("Support ")],-1)])],2),e.isDarkMode?p("v-if",!0):(a(),l("li",kz,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to dark mode","aria-label":"Switch to dark mode",onClick:t[1]||(t[1]=s=>{e.darkMode(!0)})},[...t[21]||(t[21]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(a(),l("li",Cz,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to light mode","aria-label":"Switch to light mode",onClick:t[2]||(t[2]=s=>{e.darkMode(!1)})},[...t[22]||(t[22]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sun"})],-1)])])])):p("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",Sz,[...t[23]||(t[23]=[n("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[n("i",{class:"fab fa-github mr-1"}),m(" Sign in ")],-1)])])):p("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",Ez,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=de(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):p("v-if",!0),e.user?(a(),l("li",Nz,[n("a",Rz,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,Tz)):p("v-if",!0),n("span",Pz,d(e.user?.username),1)]),n("div",Dz,[n("h6",Az,"Signed in as @"+d(e.user?.username),1),t[25]||(t[25]=Ce('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item um-extra" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a>',6)),e.headerShowSupport?(a(),l("a",Iz,[...t[24]||(t[24]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})],-1),n("span",null,"Support the project",-1)])])):p("v-if",!0),t[26]||(t[26]=n("div",{class:"dropdown-divider"},null,-1)),t[27]||(t[27]=n("a",{class:"dropdown-item",href:"/api/user/logout",target:"_self"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-logout"})]),n("span",null,"Sign out")],-1))])])):p("v-if",!0)])])],2),e.generalMessage?(a(),l("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,Oz)):p("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=de(s=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=de(s=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),P(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=s=>e.emailPromptAddress=s),disabled:e.emailPromptBusy},null,8,Mz),[[nt,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p Line truncated
python experiments/run.py`),n("p",null,[m("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),p(" Live stats "),n("section",{class:R(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",Gz,[e.statsEmpty()?p("v-if",!0):(a(),l("div",Wz,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),m(),n("span",null,[m("Live \xB7 last 60 days"),n("span",{class:"paper-stats-daily"}," \xB7 updated daily")],-1)])])),t[12]||(t[12]=n("div",{class:"paper-stats-meta-right"},"Used by authors at ICSE \xB7 FSE \xB7 OOPSLA",-1))]),e.statsEmpty()?p("v-if",!0):(a(),l("div",Kz,[(a(!0),l(V,null,J(e.cards,(i,o)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:R(["paper-stat-value",{"is-pending":!e.stat}])},d(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",Yz,d(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",Jz," +"+d(e.fmt?.number(e.history[i?.key].deltaToday))+" today ",1)):p("v-if",!0)]))),128))]))],2),p(" Before / after "),t[22]||(t[22]=n("section",{class:"paper-section-head paper-wrap"},[n("div",null,[n("div",{class:"paper-eyebrow"},"Try it"),n("h2",null,[m("The same repository, "),n("em",null,"minus you.")])]),n("p",null," Names, affiliations, emails, and any term you list are replaced across the README, source files, notebooks, and PDF links. Reviewers browse the real thing, not a zip. ")],-1)),n("div",Xz,[n("div",Qz,[t[13]||(t[13]=n("label",{for:"demo-terms"},[m("Terms to redact "),n("span",null,[m("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),P(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=i=>e.demoTerms=i),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=$t(de(()=>{},["prevent"]),["enter"]))},null,544),[[nt,e.demoTerms]])]),n("div",Zz,[n("div",xz,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[m("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",eH,[n("div",tH,[(a(!0),l(V,null,J(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("mark",nH,d(i.original),1)):(a(),l(V,{key:1},[m(d(i.text),1)],64))],64))),128)),t[14]||(t[14]=m("\u200B",-1))]),P(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=i=>e.demoText=i),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[nt,e.demoText]])])]),n("div",oH,[n("div",sH,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",iH,[n("span",rH,d(e.demoCount())+" redacted",1)])]),n("div",aH,[(a(!0),l(V,null,J(e.demoParts(),(i,o)=>(a(),l(V,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},d(i.text),9,lH)):(a(),l(V,{key:1},[m(d(i.text),1)],64))],64))),128))])])])]),p(" What you get: one screenshot, three tabs "),t[23]||(t[23]=n("section",{class:"paper-section-head paper-wrap",id:"about"},[n("div",null,[n("div",{class:"paper-eyebrow"},"What you get"),n("h2",null,"Anonymize, review, manage.")]),n("p",null," Terms are redacted in text files. Enabled images and PDFs are served unchanged, so review them for identifying content before sharing. Monitor your mirror, update it, or remove it when the review is over. ")],-1)),n("section",dH,[n("div",uH,[(a(!0),l(V,null,J(e.features,(i,o)=>(a(),l("div",{class:R(["paper-feature",{"is-on":e.feature===i?.key}]),key:i?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:r=>e.selectFeature(i.key),onKeydown:r=>e.featureKeydown(r,o),id:"feature-tab-"+i?.key,"aria-controls":"feature-panel-"+i?.key,"aria-selected":e.feature===i?.key,tabindex:e.feature===i?.key?0:-1},[n("span",pH,[n("span",fH,d(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",mH,d(i?.eyebrow),1)]),n("span",hH,[m(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",gH,"-")):p("v-if",!0),m(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)])],40,cH),n("div",vH,[n("span",yH,[m(d(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",bH,"-")):p("v-if",!0),m(d(i?.title.split("-").slice(1).join("-"))+" "+d(i?.accent),1)]),n("p",null,d(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},d(i?.cta)+" \u2192",9,wH)])],2))),128))]),n("div",kH,[(a(!0),l(V,null,J(e.features,(i,o)=>P((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:i?.key,id:"feature-panel-"+i?.key,"aria-labelledby":"feature-tab-"+i?.key},[n("div",SH,[n("div",EH,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",NH,d(i?.url),1)]),n("div",{class:R(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",TH,[...t[19]||(t[19]=[Ce('<div class="fm-label">GitHub reposit Line truncated
label names the service and the tooltip says who to contact. `),n("li",{class:R(["nav-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[19]||(t[19]=[n("a",{class:"nav-link",target:"_blank",rel:"noopener",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",title:"Report a problem with the Anonymous GitHub service. Questions about an anonymized repository or paper go to its authors.","data-offset":"30"},[n("svg",{class:"ui-icon d-lg-none mr-1","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),h("Report a bug ")],-1)])],2),n("li",{class:R(["nav-item nav-support-item nav-extra-item d-none d-lg-block",{"in-user-menu":!!e.user?.username}])},[...t[20]||(t[20]=[n("a",{class:"nav-link nav-support-inline",href:"https://ko-fi.com/tdurieux",target:"_blank",rel:"noopener",title:"Donate on Ko-fi to help cover hosting costs"},[n("svg",{class:"ui-icon nav-heart","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})]),h("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",qH,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to dark mode","aria-label":"Switch to dark mode",onClick:t[1]||(t[1]=o=>{e.darkMode(!0)})},[...t[21]||(t[21]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-moon"})],-1)])])])),e.isDarkMode?(a(),l("li",FH,[n("button",{type:"button",class:"nav-link nav-icon",title:"Switch to light mode","aria-label":"Switch to light mode",onClick:t[2]||(t[2]=o=>{e.darkMode(!1)})},[...t[22]||(t[22]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sun"})],-1)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",$H,[...t[23]||(t[23]=[n("a",{class:"nav-link btn-signin",target:"_self",href:"/signin","data-offset":"30"},[n("i",{class:"fab fa-github mr-1"}),h(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",_H,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=ae(o=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",UH,[n("a",BH,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,zH)):f("v-if",!0),n("span",HH,u(e.user?.username),1)]),n("div",jH,[n("h6",GH,"Signed in as @"+u(e.user?.username),1),t[25]||(t[25]=Se('<a class="dropdown-item" href="/profile"><svg class="ui-icon" aria-hidden="true"><use href="#project-icon-filter"></use></svg><span>Settings<small>Defaults, quotas, account</small></span></a><a class="dropdown-item" href="/connections"><i class="fab fa-github" aria-hidden="true"></i><span>GitHub connections<small>Repository access and OAuth</small></span></a><a class="dropdown-item" href="/claim"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-link"></use></svg><span>Claim an anonymization<small>Attach an existing mirror to your account</small></span></a><div class="dropdown-divider"></div><a class="dropdown-item" href="https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml" target="_blank" rel="noopener"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg><span>Report a bug<small>About this service, not a paper</small></span></a><a class="dropdown-item um-extra" href="https://github.com/tdurieux/anonymous_github/" target="_blank" rel="noopener"><i class="fab fa-github" aria-hidden="true"></i><span>Source code</span></a>',6)),e.headerShowSupport?(a(),l("a",WH,[...t[24]||(t[24]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-heart"})],-1),n("span",null,"Support the project",-1)])])):f("v-if",!0),t[26]||(t[26]=n("div",{class:"dropdown-divider"},null,-1)),t[27]||(t[27]=n("a",{class:"dropdown-item",href:"/api/user/logout",target:"_self"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-logout"})]),n("span",null,"Sign out")],-1))])])):f("v-if",!0)])])],2),e.generalMessage?(a(),l("div",{key:0,class:"navbar shadow generalMessage",innerHTML:e.sanitize(e.generalMessage)},null,8,KH)):f("v-if",!0),e.emailPromptOpen?(a(),l("dialog",{key:1,id:"email-prompt",class:"email-prompt","aria-labelledby":"email-prompt-title","aria-describedby":"email-prompt-reason",onCancel:t[8]||(t[8]=ae(o=>e.respondToEmailPrompt("later"),["prevent"]))},[n("form",{onSubmit:t[7]||(t[7]=ae(o=>e.respondToEmailPrompt("save"),["prevent"]))},[t[30]||(t[30]=n("h2",{id:"email-prompt-title"},"Stay informed about access problems",-1)),t[31]||(t[31]=n("p",{id:"email-prompt-reason"},"Get email alerts when your GitHub token or repository access fails.",-1)),t[32]||(t[32]=n("label",{for:"email-prompt-address"},"Email address",-1)),D(n("input",{id:"email-prompt-address",class:"form-control",type:"email",autocomplete:"email",maxlength:"254",required:"","onUpdate:modelValue":t[4]||(t[4]=o=>e.emailPromptAddress=o),disabled:e.emailPromptBusy},null,8,YH),[[nt,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p Line truncated
python experiments/run.py`),n("p",null,[h("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),f(" Live stats "),n("section",{class:R(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",rj,[e.statsEmpty()?f("v-if",!0):(a(),l("div",aj,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),h(),n("span",null,[h("Live \xB7 last 60 days"),n("span",{class:"paper-stats-daily"}," \xB7 updated daily")],-1)])])),t[12]||(t[12]=n("div",{class:"paper-stats-meta-right"},"Used by authors at ICSE \xB7 FSE \xB7 OOPSLA",-1))]),e.statsEmpty()?f("v-if",!0):(a(),l("div",lj,[(a(!0),l(T,null,H(e.cards,(r,s)=>(a(),l("div",{class:"paper-stat-card",key:r?.key},[n("div",{class:R(["paper-stat-value",{"is-pending":!e.stat}])},u(e.stat?e.fmt?.bigNum(r?.total):"\u2014"),3),n("div",dj,u(r?.label),1),e.history[r?.key].bars?.length>1&&e.history[r?.key].deltaToday>0?(a(),l("div",uj," +"+u(e.fmt?.number(e.history[r?.key].deltaToday))+" today ",1)):f("v-if",!0)]))),128))]))],2),f(" Before / after "),t[22]||(t[22]=n("section",{class:"paper-section-head paper-wrap"},[n("div",null,[n("div",{class:"paper-eyebrow"},"Try it"),n("h2",null,[h("The same repository, "),n("em",null,"minus you.")])]),n("p",null," Names, affiliations, emails, and any term you list are replaced across the README, source files, notebooks, and PDF links. Reviewers browse the real thing, not a zip. ")],-1)),n("div",cj,[n("div",pj,[t[13]||(t[13]=n("label",{for:"demo-terms"},[h("Terms to redact "),n("span",null,[h("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),D(n("textarea",{id:"demo-terms",class:"demo-terms-input",rows:"1","onUpdate:modelValue":t[0]||(t[0]=r=>e.demoTerms=r),spellcheck:"false",autocomplete:"off",onKeydown:t[1]||(t[1]=_t(ae(()=>{},["prevent"]),["enter"]))},null,544),[[nt,e.demoTerms]])]),n("div",fj,[n("div",mj,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[h("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",hj,[n("div",gj,[(a(!0),l(T,null,H(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("mark",vj,u(r.original),1)):(a(),l(T,{key:1},[h(u(r.text),1)],64))],64))),128)),t[14]||(t[14]=h("\u200B",-1))]),D(n("textarea",{class:"pane-body demo-input","onUpdate:modelValue":t[2]||(t[2]=r=>e.demoText=r),spellcheck:"false","aria-label":"Sample README to anonymize"},null,512),[[nt,e.demoText]])])]),n("div",yj,[n("div",bj,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",wj,[n("span",kj,u(e.demoCount())+" redacted",1)])]),n("div",Cj,[(a(!0),l(T,null,H(e.demoParts(),(r,s)=>(a(),l(T,{key:s},[r.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+r.original+"\u201D"},u(r.text),9,Sj)):(a(),l(T,{key:1},[h(u(r.text),1)],64))],64))),128))])])])]),f(" What you get: one screenshot, three tabs "),t[23]||(t[23]=n("section",{class:"paper-section-head paper-wrap",id:"about"},[n("div",null,[n("div",{class:"paper-eyebrow"},"What you get"),n("h2",null,"Anonymize, review, manage.")]),n("p",null," Terms are redacted in text files. Enabled images and PDFs are served unchanged, so review them for identifying content before sharing. Monitor your mirror, update it, or remove it when the review is over. ")],-1)),n("section",Ej,[n("div",Nj,[(a(!0),l(T,null,H(e.features,(r,s)=>(a(),l("div",{class:R(["paper-feature",{"is-on":e.feature===r?.key}]),key:r?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:i=>e.selectFeature(r.key),onKeydown:i=>e.featureKeydown(i,s),id:"feature-tab-"+r?.key,"aria-controls":"feature-panel-"+r?.key,"aria-selected":e.feature===r?.key,tabindex:e.feature===r?.key?0:-1},[n("span",Tj,[n("span",Pj,u(r?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",Dj,u(r?.eyebrow),1)]),n("span",Aj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",Ij,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)])],40,Rj),n("div",Oj,[n("span",Mj,[h(u(r?.title.split("-")[0]),1),r?.title.includes("-")?(a(),l("span",Vj,"-")):f("v-if",!0),h(u(r?.title.split("-").slice(1).join("-"))+" "+u(r?.accent),1)]),n("p",null,u(r?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(r)),target:e.featureTarget(r)},u(r?.cta)+" \u2192",9,Lj)])],2))),128))]),n("div",qj,[(a(!0),l(T,null,H(e.features,(r,s)=>D((a(),l("div",{class:"paper-feature-panel",role:"tabpanel",key:r?.key,id:"feature-panel-"+r?.key,"aria-labelledby":"feature-tab-"+r?.key},[n("div",$j,[n("div",_j,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",Uj,u(r?.url),1)]),n("div",{class:R(["feat-mock","is-"+r?.key]),role:"img","aria-label":r?.alt},[r?.key==="anonymize"?(a(),l("div",zj,[...t[19]||(t[19]=[Se('<div class="fm-label">GitHub reposit Line truncated
<span class="ln">2</span><span class="c"># Author: <span class="redact">XXXX-1</span>, <span class="redact">XXXX-2</span></span>
<span class="ln">3</span><span class="k">import</span> torch
<span class="ln">4</span><span class="k">from</span> utils <span class="k">import</span> load_config
@@ -58,18 +61,18 @@ python experiments/run.py`),n("p",null,[m("Contact: "),n("span",{class:"redact",
<span class="ln">7</span> model = build_model(config)
<span class="ln">8</span> <span class="k">for</span> epoch <span class="k">in</span> range(config.epochs):
<span class="ln">9</span> loss = step(model)
<span class="ln">10</span> log(<span class="s">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",DH,[...t[21]||(t[21]=[Ce('<div class="fm-dash-head"><span>Project</span><span>Status</span><span>Views</span><span>Expires</span></div><div class="fm-dash-row"><span><b>DeepLearnUtils</b><i>paper-7f2a \xB7 ICSE 2027</i></span><span class="st is-ready">Ready</span><span>41</span><span>Mar 31, 2027</span></div><div class="fm-dash-row"><span><b>vision-bench#212</b><i>pull request \xB7 FSE 2027</i></span><span class="st is-ready">Ready</span><span>12</span><span>Never</span></div><div class="fm-dash-row"><span><b>graph-repair</b><i>gr-91ab</i></span><span class="st is-progress">Updating</span><span>5</span><span>Jan 5, 2027</span></div><div class="fm-dash-row is-muted"><span><b>JarSift</b><i>OOPSLA 2025</i></span><span class="st is-expired">Expired</span><span>72</span><span>Sep 28, 2026</span></div>',5)])]))],10,RH)])],8,CH)),[[x,e.feature===i?.key]])),128))])]),p(" FAQ teaser "),t[24]||(t[24]=Ce('<section class="paper-qa paper-qa-r3 paper-wrap" aria-labelledby="qa-heading"><div class="qa-head"><div><div class="paper-eyebrow">Before you sign in</div><h2 id="qa-heading">The questions that come up most.</h2></div><a class="paper-link-arrow" href="/faq">Read the full FAQ \u2192</a></div><div class="qa-grid"><div class="q"><a href="/faq#permissions">What access does GitHub sign-in require?</a><p> The GitHub App has read-only access to gists and the repositories you choose. Legacy OAuth uses broader permissions. Anonymous GitHub never writes to your repositories. </p></div><div class="q"><a href="/faq#formats">Which file formats are supported?</a><p> Source code with syntax highlighting, Markdown, Jupyter notebooks, PDFs, images, and GitHub Pages sites. Text files are anonymized; enabled images and PDFs are served unchanged. </p></div><div class="q"><a href="/faq#expiration">What happens when an anonymized repository expires?</a><p> You choose: the mirror is removed, or visitors are redirected to the original GitHub repository once the review is over. </p></div></div></section><section class="paper-cta paper-wrap" aria-labelledby="cta-heading"><div><h2 id="cta-heading">Ready for review?</h2><p>Create an anonymous mirror in a couple of minutes. Reviewers just open the link.</p></div><div class="paper-cta-actions"><a class="btn-hero" href="/signin" target="_self"><i class="fab fa-github" aria-hidden="true"></i> Sign in with GitHub</a><a class="paper-link-arrow" target="_self" href="https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/">See an anonymized repository \u2192</a></div></section>',2)),Oe(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var AH={class:"paper-empty"},IH={class:"paper-empty-inner"},OH={key:0,class:"paper-eyebrow"},MH={key:1,class:"paper-eyebrow"},VH={key:2,class:"paper-empty-title"},LH=["textContent"];function Vp(e,t){return a(),l("div",AH,[n("div",IH,[e.error?p("v-if",!0):(a(),l("div",OH,"Working")),e.error?(a(),l("div",MH,"Error")):p("v-if",!0),e.error?p("v-if",!0):(a(),l("h1",VH,[...t[0]||(t[0]=[m(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:d(e.fmt.translate(e.error))},null,8,LH)):p("v-if",!0)])])}var qH={class:"container paper-page paper-settings"},$H={class:"paper-crumbs"},FH={class:"here"},_H={class:"paper-page-title"},UH={class:"paper-settings-body"},BH={class:"paper-settings-toc"},zH={href:"#conf-billing"},HH={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},jH={id:"conf-basics",class:"paper-settings-section"},GH={class:"form-group"},WH={class:"invalid-feedback"},KH={class:"invalid-feedback"},YH={class:"form-group"},JH={class:"invalid-feedback"},XH={class:"form-group"},QH={class:"invalid-feedback"},ZH={class:"invalid-feedback"},xH={id:"conf-window",class:"paper-settings-section"},ej={class:"form-grid-2"},tj={class:"form-group"},nj={class:"invalid-feedback"},oj={class:"invalid-feedback"},sj={class:"form-group"},ij={class:"invalid-feedback"},rj={class:"invalid-feedback"},aj={id:"conf-rendering",class:"paper-settings-section"},lj={class:"form-check"},dj={class:"form-check-input",type:"checkbox",id:"link",name:"link"},uj={class:"form-check"},cj={class:"form-check-input",type:"checkbox",id:"image",name:"image"},pj={class:"form-check"},fj={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},mj={class:"form-check"},hj={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},gj={id:"conf-features",class:"paper-settings-section"},vj={class:"form-check"},yj={class:"form-check-input",type:"checkbox",id:"update",name:"update"},bj={class:"form-check"},wj={class:"form-check-input",type:"checkbox",id:"page",name:"page"},kj={id:"conf-plan",class:"paper-settings-section"},Cj={key:0,class:"paper-section-copy"},Sj={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):p("v-if",!0)]),P(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=u=>e.copyPath())},[(a(),l("svg",gG,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,vG)]))],8,hG),[[x,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",yG,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(d(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,bG),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):p("v-if",!0),m(d(e.languageName||"Text"),1),n("span",wG,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),m(d(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),m(d(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):p("v-if",!0),e.type=="html"?(a(),l("span",kG,[e.redactionCount()?(a(),l(V,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[m(d(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,CG),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):p("v-if",!0),t[56]||(t[56]=m("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(V,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),m(d(e.formatSize(e.fileSize(e.filePath))),1)],64)):p("v-if",!0)])):p("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=u=>e.openPreserveFiles())},"Left unredacted")):p("v-if",!0),n("div",SG,[e.isCsv()?(a(),l("div",EG,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=u=>e.csvView="table")},"Table",10,NG),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=u=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,RG)])):p("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",TG,[n("button",{type:"button",class:R(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[6]||(t[6]=u=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,PG),e.symbolsOpen?(a(),l("div",DG,[n("div",AG,d(e.symbols().length)+" "+d(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(V,null,J(e.symbols(),u=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:u.line+u.name,onClick:f=>e.goToSymbol(u.line)},[n("span",{class:R(["symbols-kind","is-"+u.kind])},d(u.kind==="class"?"C":u.kind==="function"?"\u0192":"v"),3),n("span",OG,d(u.name),1),n("span",MG,d(u.line),1)],8,IG))),128))])):p("v-if",!0)])):p("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:R(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[7]||(t[7]=u=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,VG)):p("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",LG,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[8]||(t[8]=u=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,qG)):p("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[9]||(t[9]=u=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,$G)):p("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[10]||(t[10]=u=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,FG)):p("v-if",!0)])):p("v-if",!0),!e.preview||e.url?(a(),l("div",_G,[n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn",title:e.type=="html"?"Open the Markdown source":"Open the raw file",href:e.safeUrl(e.url)},"Raw",8,UG),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[11]||(t[11]=u=>e.copyContent())},[(a(),l("svg",zG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,HG)]))],8,BG)):p("v-if",!0),n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn tb-seg-icon","aria-label":"Download file",title:"Download file",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[62]||(t[62]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1)])],8,jG)])):p("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=u=>e.copyContent())},[(a(),l("svg",WG,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,KG)]))],8,GG)):p("v-if",!0),e.type=="html"&&e.r Line truncated
`).length))+" lines",1)],64)):p("v-if",!0)])):p("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",nW)):p("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=u=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),m("Find in file",-1)])])):p("v-if",!0),e.type=="html"?(a(),l("div",oW)):p("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=u=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),m("Find in file",-1)])])):p("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[19]||(t[19]=u=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),m("Go to line",-1)])])):p("v-if",!0),e.type!="html"?(a(),l("button",{key:7,type:"button",role:"menuitemcheckbox","aria-checked":e.wrapLines?"true":"false",onClick:t[20]||(t[20]=u=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=m("Wrap lines",-1)),e.wrapLines?(a(),l("span",iW,"\u2713")):p("v-if",!0)],8,sW)):p("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=u=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",rW,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,aW)])),m(d(e.csvView==="table"?"Show as text":"Show as table"),1)])):p("v-if",!0),e.type!="html"?(a(),l("div",lW)):p("v-if",!0),e.type=="html"&&(!e.preview||e.url)?(a(),l("a",{key:10,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[72]||(t[72]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),m("View raw",-1)])],8,dW)):p("v-if",!0),e.type!="html"&&(!e.preview||e.url)?(a(),l("a",{key:11,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[73]||(t[73]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),m("View raw",-1)])],8,uW)):p("v-if",!0),!e.preview||e.url?(a(),l("a",{key:12,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[74]||(t[74]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1),m("Download file",-1)])],8,cW)):p("v-if",!0),e.options?.hasWebsite?(a(),l("a",{key:13,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/w/"+e.repoId+"/")},[...t[75]||(t[75]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-globe"})],-1),m("Open website",-1)])],8,pW)):p("v-if",!0),e.options?.isAdmin||e.options?.isOwner?(a(),l("a",{key:14,role:"menuitem",href:e.safeUrl("/anonymize/"+e.repoId)},[...t[76]||(t[76]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-edit"})],-1),m("Edit anonymization",-1)])],8,fW)):p("v-if",!0),e.options?.download?(a(),l("a",{key:15,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/api/repo/"+e.repoId+"/zip")},[...t[77]||(t[77]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-archive"})],-1),m("Download ZIP",-1)])],8,mW)):p("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=u=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),m("Copy file path",-1)])]),t[79]||(t[79]=n("div",{class:"tb-menu-sep"},null,-1)),t[80]||(t[80]=n("a",{role:"menuitem",href:"/faq"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-help"})]),m("FAQ")],-1)),t[81]||(t[81]=n("a",{role:"menuitem",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",target:"_blank",rel:"noopener"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),m("Report a bug")],-1))])):p("v-if",!0)])]),e.gotoOpen&&e.type!="html"?(a(),l("form",{key:3,class:"goto-pop",role:"dialog","aria-label":"Go to line",onSubmit:t[26]||(t[26]=de(u=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),P(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=u=>e.gotoValue=u),onKeydown:t[25]||(t[25]=$t(de(u=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,hW),[[nt,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},d(e.gotoError||"Line, or line:column"),3)],32)):p("v-if",!0)]),e.isCsv()&&e.csvView==="table"?(a(),l("div",{key:0,class:"csv-table-wrap",tabindex:"0",role:"region","aria-label":"Table view of "+(e.paths?.[e.paths.length-1]||"file")},[n("table",vW,[n("thead",null,[n("tr",null,[t[83]||(t[83]=n("th",{class:"csv-rownum",scope:"col"},[n("span",{class:"sr-only"},"Row")],-1)),(a(!0),l(V,null,J(e.csvRows()[0]||[],(u,f)=>(a(),l("th",{scope:"col",key:f,class:R({"is-num":e.csvNumCol(f)})},[(a(!0),l(V,null,J(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,yW)):(a(),l(V,{key:1},[m(d(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(V,null,J(e.csvRows().slice(1),(u,f)=>(a(),l("tr",{key:f},[n("td",bW,d(f+1),1),(a(!0),l(V,null,J(u,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(V,null,J(e.redactParts(c),(h,y)=>(a(),l(V,{key:y},[h.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+h.n},[n("i",null,d(h.n),1)],8,wW)):(a(),l(V,{key:1},[m(d(h.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,gW)):p("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?P((a(),l("div",kW,null,512)),[[r,{content:e.content,options:e.aceOption}]]):p("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",CW,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=u=>{e.mdFindQuery=u.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=$t(de(u=>u.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=$t(de(u=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,SW),n("span",EW,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=u=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,NW),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=u=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[85]||(t[85]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,RW)]),n("span",TW,d(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:R(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=u=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,PW),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=u=>e.toggleMdFind(!1))},"\xD7")])):p("v-if",!0),e.type=="html"?(a(),l("div",DW,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,AW),e.readmeToc().length>=3?(a(),l("aside",IW,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",OW,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading}]),onClick:t[34]||(t[34]=de(u=>e.scrollToHeading(null),["prevent"]))},"Introduction",2),(a(!0),l(V,null,J(e.readmeToc(),(u,f)=>(a(),l("a",{key:u.id,href:"#"+u.id,class:R(["lvl-"+u.level,{"is-active":e.activeHeading===u.id}]),onClick:de(c=>e.scrollToHeading(u.id),["prevent"])},d(u.text),11,MW))),128))])])):p("v-if",!0)])):p("v-if",!0)],2)):p("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Jt(s,{key:2,content:e.content,"base-url":e.fileBaseUrl,"allow-scripts":e.allowScripts},null,8,["content","base-url","allow-scripts"])):p("v-if",!0),e.fileFrame()?(a(),l("section",{key:3,class:R(["file-card file-card-media","view-"+e.type])},[n("header",VW,[n("div",LW,[n("button",{type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=u=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[87]||(t[87]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2),n("ol",qW,[n("li",$W,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:d(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,FW)]),(a(!0),l(V,null,J(e.paths,(u,f)=>(a(),l("li",{class:"breadcrumb-item","aria-current":f===e.paths.length-1?"page":null},[(a(!0),l(V,null,J(e.redactParts(u),(c,v)=>(a(),l(V,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,d(c.n),1)],8,UW)):(a(),l(V,{key:1},[m(d(c.t),1)],64))],64))),128))],8,_W))),256))]),n("span",BW,[e.type=="IPython Line truncated
<span class="ln">10</span> log(<span class="s">&quot;epoch %d: %.3f&quot;</span>, epoch, loss)</pre></div>`,2)])])):(a(),l("div",jj,[...t[21]||(t[21]=[Se('<div class="fm-dash-head"><span>Project</span><span>Status</span><span>Views</span><span>Expires</span></div><div class="fm-dash-row"><span><b>DeepLearnUtils</b><i>paper-7f2a \xB7 ICSE 2027</i></span><span class="st is-ready">Ready</span><span>41</span><span>Mar 31, 2027</span></div><div class="fm-dash-row"><span><b>vision-bench#212</b><i>pull request \xB7 FSE 2027</i></span><span class="st is-ready">Ready</span><span>12</span><span>Never</span></div><div class="fm-dash-row"><span><b>graph-repair</b><i>gr-91ab</i></span><span class="st is-progress">Updating</span><span>5</span><span>Jan 5, 2027</span></div><div class="fm-dash-row is-muted"><span><b>JarSift</b><i>OOPSLA 2025</i></span><span class="st is-expired">Expired</span><span>72</span><span>Sep 28, 2026</span></div>',5)])]))],10,Bj)])],8,Fj)),[[Z,e.feature===r?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Se('<section class="paper-qa paper-qa-r3 paper-wrap" aria-labelledby="qa-heading"><div class="qa-head"><div><div class="paper-eyebrow">Before you sign in</div><h2 id="qa-heading">The questions that come up most.</h2></div><a class="paper-link-arrow" href="/faq">Read the full FAQ \u2192</a></div><div class="qa-grid"><div class="q"><a href="/faq#permissions">What access does GitHub sign-in require?</a><p> The GitHub App has read-only access to gists and the repositories you choose. Legacy OAuth uses broader permissions. Anonymous GitHub never writes to your repositories. </p></div><div class="q"><a href="/faq#formats">Which file formats are supported?</a><p> Source code with syntax highlighting, Markdown, Jupyter notebooks, PDFs, images, and GitHub Pages sites. Text files are anonymized; enabled images and PDFs are served unchanged. </p></div><div class="q"><a href="/faq#expiration">What happens when an anonymized repository expires?</a><p> You choose: the mirror is removed, or visitors are redirected to the original GitHub repository once the review is over. </p></div></div></section><section class="paper-cta paper-wrap" aria-labelledby="cta-heading"><div><h2 id="cta-heading">Ready for review?</h2><p>Create an anonymous mirror in a couple of minutes. Reviewers just open the link.</p></div><div class="paper-cta-actions"><a class="btn-hero" href="/signin" target="_self"><i class="fab fa-github" aria-hidden="true"></i> Sign in with GitHub</a><a class="paper-link-arrow" target="_self" href="https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/">See an anonymized repository \u2192</a></div></section>',2)),Ie(o,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var Gj={class:"paper-empty"},Wj={class:"paper-empty-inner"},Kj={key:0,class:"paper-eyebrow"},Yj={key:1,class:"paper-eyebrow"},Jj={key:2,class:"paper-empty-title"},Xj=["textContent"];function Xp(e,t){return a(),l("div",Gj,[n("div",Wj,[e.error?f("v-if",!0):(a(),l("div",Kj,"Working")),e.error?(a(),l("div",Yj,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",Jj,[...t[0]||(t[0]=[h(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:u(e.fmt.translate(e.error))},null,8,Xj)):f("v-if",!0)])])}var Qj={class:"container paper-page paper-settings"},Zj={class:"paper-crumbs"},xj={class:"here"},eG={class:"paper-page-title"},tG={class:"paper-settings-body"},nG={class:"paper-settings-toc"},oG={href:"#conf-billing"},sG={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},iG={id:"conf-basics",class:"paper-settings-section"},rG={class:"form-group"},aG={class:"invalid-feedback"},lG={class:"invalid-feedback"},dG={class:"form-group"},uG={class:"invalid-feedback"},cG={class:"form-group"},pG={class:"invalid-feedback"},fG={class:"invalid-feedback"},mG={id:"conf-window",class:"paper-settings-section"},hG={class:"form-grid-2"},gG={class:"form-group"},vG={class:"invalid-feedback"},yG={class:"invalid-feedback"},bG={class:"form-group"},wG={class:"invalid-feedback"},kG={class:"invalid-feedback"},CG={id:"conf-rendering",class:"paper-settings-section"},SG={class:"form-check"},EG={class:"form-check-input",type:"checkbox",id:"link",name:"link"},NG={class:"form-check"},RG={class:"form-check-input",type:"checkbox",id:"image",name:"image"},TG={class:"form-check"},PG={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},DG={class:"form-check"},AG={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},IG={id:"conf-features",class:"paper-settings-section"},OG={class:"form-check"},MG={class:"form-check-input",type:"checkbox",id:"update",name:"update"},VG={class:"form-check"},LG={class:"form-check-input",type:"checkbox",id:"page",name:"page"},qG={id:"conf-plan",class:"paper-settings-section"},FG={key:0,class:"paper-section-copy"},$G={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"},Line truncated
`).length))+" lines",1)):f("v-if",!0)]),D(n("button",{type:"button",class:"btn btn-sm btn-icon-only btn-ghost copy-path-btn","aria-label":e.pathCopied?"Path copied":"Copy file path",title:e.pathCopied?"Path copied":"Copy file path",onClick:t[2]||(t[2]=d=>e.copyPath())},[(a(),l("svg",IW,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,OW)]))],8,AW),[[Z,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",MW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,VW),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),h(u(e.languageName||"Text"),1),n("span",LW,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.content.length<1024?e.content.length+" B":(e.content.length/1024).toFixed(1)+" KB"),1)]),t[52]||(t[52]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",qW,[e.redactionCount()?(a(),l(T,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(u(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,FW),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=h("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(T,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),h(u(e.formatSize(e.fileSize(e.filePath))),1)],64)):f("v-if",!0)])):f("v-if",!0),e.preview&&e.previewPreserved()?(a(),l("button",{key:2,type:"button",class:"rp-preserved-tag",onClick:t[3]||(t[3]=d=>e.openPreserveFiles())},"Left unredacted")):f("v-if",!0),n("div",$W,[e.isCsv()?(a(),l("div",_W,[n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,UW),n("button",{type:"button",role:"radio",class:R(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[5]||(t[5]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,BW)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",zW,[n("button",{type:"button",class:R(["btn btn-sm btn-ghost btn-symbols",{"is-on":e.symbolsOpen}]),"aria-expanded":e.symbolsOpen?"true":"false","aria-haspopup":"true",title:"Symbols in this file",onClick:t[6]||(t[6]=d=>e.symbolsOpen=!e.symbolsOpen)},[...t[57]||(t[57]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-list"})],-1),n("span",{class:"btn-find-label"},"Symbols",-1)])],10,HW),e.symbolsOpen?(a(),l("div",jW,[n("div",GW,u(e.symbols().length)+" "+u(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(T,null,H(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:p=>e.goToSymbol(d.line)},[n("span",{class:R(["symbols-kind","is-"+d.kind])},u(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",KW,u(d.name),1),n("span",YW,u(d.line),1)],8,WW))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:R(["btn btn-sm btn-ghost btn-icon-only btn-find btn-md-find",{"is-on":e.mdFindOpen}]),"aria-label":"Find on this page",title:"Find on this page ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[7]||(t[7]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,JW)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?(a(),l("div",XW,[e.type!="html"?(a(),l("button",{key:0,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-goto","aria-label":"Go to line",title:"Go to line ("+(e.isMac?"\u2318":"Ctrl+")+"G)",onClick:t[8]||(t[8]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,QW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost btn-toggle",{"is-on":e.wrapLines}]),"aria-pressed":e.wrapLines?"true":"false","aria-label":"Wrap lines",title:"Wrap lines (Alt+Z)",onClick:t[9]||(t[9]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,ZW)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:2,type:"button",class:"btn btn-sm btn-ghost btn-icon-only btn-find","aria-label":"Find in file",title:"Find in file ("+(e.isMac?"\u2318":"Ctrl+")+"F)",onClick:t[10]||(t[10]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,xW)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",eK,[n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn",title:e.type=="html"?"Open the Markdown source":"Open the raw file",href:e.safeUrl(e.url)},"Raw",8,tK),typeof e.content=="string"?(a(),l("button",{key:0,type:"button",class:"tb-seg-btn tb-seg-icon","aria-label":e.contentCopied?"Copied":"Copy file contents",title:e.contentCopied?"Copied":"Copy file contents",onClick:t[11]||(t[11]=d=>e.copyContent())},[(a(),l("svg",oK,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,sK)]))],8,nK)):f("v-if",!0),n("a",{target:e.preview?"_blank":"_self",class:"tb-seg-btn tb-seg-icon","aria-label":"Download file",title:"Download file",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[62]||(t[62]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1)])],8,iK)])):f("v-if",!0),typeof e.content=="string"?(a(),l("button",{key:5,type:"button",class:"btn btn-sm btn-icon-only btn-ghost tb-copy-m","aria-label":e.contentCopied?"Copied":"Copy file contents",onClick:t[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",aK,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,lK)]))],8,rK)):f("v-if",!0),e.type=="html"&&e.t Line truncated
`).length))+" lines",1)],64)):f("v-if",!0)])):f("v-if",!0),e.options?.publishedAt||e.options?.sourceCommitDate||e.options?.anonymizedAt||e.options?.lastUpdateDate?(a(),l("div",bK)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[17]||(t[17]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",wK)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),h("Find in file",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[19]||(t[19]=d=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),h("Go to line",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:7,type:"button",role:"menuitemcheckbox","aria-checked":e.wrapLines?"true":"false",onClick:t[20]||(t[20]=d=>e.toggleWrap())},[t[70]||(t[70]=n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)),t[71]||(t[71]=h("Wrap lines",-1)),e.wrapLines?(a(),l("span",CK,"\u2713")):f("v-if",!0)],8,kK)):f("v-if",!0),e.isCsv()?(a(),l("button",{key:8,type:"button",role:"menuitem",class:"tb-csv-view",onClick:t[21]||(t[21]=d=>{e.csvView=e.csvView==="table"?"raw":"table",e.moreOpen=!1})},[(a(),l("svg",SK,[n("use",{href:e.csvView==="table"?"#ui-icon-code":"#ui-icon-list"},null,8,EK)])),h(u(e.csvView==="table"?"Show as text":"Show as table"),1)])):f("v-if",!0),e.type!="html"?(a(),l("div",NK)):f("v-if",!0),e.type=="html"&&(!e.preview||e.url)?(a(),l("a",{key:10,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[72]||(t[72]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),h("View raw",-1)])],8,RK)):f("v-if",!0),e.type!="html"&&(!e.preview||e.url)?(a(),l("a",{key:11,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.url)},[...t[73]||(t[73]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-code"})],-1),h("View raw",-1)])],8,TK)):f("v-if",!0),!e.preview||e.url?(a(),l("a",{key:12,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl(e.downloadUrl()),download:e.preview?e.paths[e.paths.length-1]:null},[...t[74]||(t[74]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-download"})],-1),h("Download file",-1)])],8,PK)):f("v-if",!0),e.options?.hasWebsite?(a(),l("a",{key:13,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/w/"+e.repoId+"/")},[...t[75]||(t[75]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-globe"})],-1),h("Open website",-1)])],8,DK)):f("v-if",!0),e.options?.isAdmin||e.options?.isOwner?(a(),l("a",{key:14,role:"menuitem",href:e.safeUrl("/anonymize/"+e.repoId)},[...t[76]||(t[76]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-edit"})],-1),h("Edit anonymization",-1)])],8,AK)):f("v-if",!0),e.options?.download?(a(),l("a",{key:15,role:"menuitem",target:e.preview?"_blank":"_self",href:e.safeUrl("/api/repo/"+e.repoId+"/zip")},[...t[77]||(t[77]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-archive"})],-1),h("Download ZIP",-1)])],8,IK)):f("v-if",!0),n("button",{type:"button",role:"menuitem",onClick:t[22]||(t[22]=d=>e.copyPath())},[...t[78]||(t[78]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-link"})],-1),h("Copy file path",-1)])]),t[79]||(t[79]=n("div",{class:"tb-menu-sep"},null,-1)),t[80]||(t[80]=n("a",{role:"menuitem",href:"/faq"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-help"})]),h("FAQ")],-1)),t[81]||(t[81]=n("a",{role:"menuitem",href:"https://github.com/tdurieux/anonymous_github/issues/new?template=issue_report.yml",target:"_blank",rel:"noopener"},[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-bug"})]),h("Report a bug")],-1))])):f("v-if",!0)])]),e.gotoOpen&&e.type!="html"?(a(),l("form",{key:3,class:"goto-pop",role:"dialog","aria-label":"Go to line",onSubmit:t[26]||(t[26]=ae(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),D(n("input",{id:"goto-input",class:"goto-input",type:"text",inputmode:"numeric",autocomplete:"off",spellcheck:"false",placeholder:"1\u2013"+e.fmt?.number(typeof e.content=="string"?e.content.split(`
`).length:1),"aria-invalid":e.gotoError?"true":"false","onUpdate:modelValue":t[24]||(t[24]=d=>e.gotoValue=d),onKeydown:t[25]||(t[25]=_t(ae(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,OK),[[nt,e.gotoValue]]),n("span",{class:R(["goto-hint",{"is-error":e.gotoError}])},u(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView==="table"?(a(),l("div",{key:0,class:"csv-table-wrap",tabindex:"0",role:"region","aria-label":"Table view of "+(e.paths?.[e.paths.length-1]||"file")},[n("table",VK,[n("thead",null,[n("tr",null,[t[83]||(t[83]=n("th",{class:"csv-rownum",scope:"col"},[n("span",{class:"sr-only"},"Row")],-1)),(a(!0),l(T,null,H(e.csvRows()[0]||[],(d,p)=>(a(),l("th",{scope:"col",key:p,class:R({"is-num":e.csvNumCol(p)})},[(a(!0),l(T,null,H(e.redactParts(d),(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,LK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],2))),128))])]),n("tbody",null,[(a(!0),l(T,null,H(e.csvRows().slice(1),(d,p)=>(a(),l("tr",{key:p},[n("td",qK,u(p+1),1),(a(!0),l(T,null,H(d,(c,v)=>(a(),l("td",{key:v,class:R({"is-num":e.csvNumCol(v)})},[(a(!0),l(T,null,H(e.redactParts(c),(m,y)=>(a(),l(T,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,u(m.n),1)],8,FK)):(a(),l(T,{key:1},[h(u(m.t),1)],64))],64))),128))],2))),128))]))),128))])])],8,MK)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView==="table")?D((a(),l("div",$K,null,512)),[[i,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",_K,[n("input",{type:"search",class:"md-find-input",placeholder:"Find on this page","aria-label":"Find on this page",value:e.mdFindQuery,onInput:t[27]||(t[27]=d=>{e.mdFindQuery=d.target.value,e.runMdFind()}),onKeydown:[t[28]||(t[28]=_t(ae(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=_t(ae(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,UK),n("span",BK,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[84]||(t[84]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,zK),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=d=>e.stepMdFind(1)),disabled:!e.mdFindTotal},[...t[85]||(t[85]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-right"})],-1)])],8,HK)]),n("span",jK,u(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:R(["md-find-opt",{"is-on":e.mdFindCase}]),"aria-pressed":e.mdFindCase?"true":"false",title:"Match case","aria-label":"Match case",onClick:t[32]||(t[32]=d=>{e.mdFindCase=!e.mdFindCase,e.runMdFind()})},"Aa",10,GK),n("button",{type:"button",class:"md-find-close","aria-label":"Close find",onClick:t[33]||(t[33]=d=>e.toggleMdFind(!1))},"\xD7")])):f("v-if",!0),e.type=="html"?(a(),l("div",WK,[n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,KK),e.tocCount()>=3?(a(),l("aside",YK,[t[86]||(t[86]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",JK,[n("a",{href:"#",class:R(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=ae(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(T,{key:0},H(e.tocTitle().parts,(d,p)=>(a(),l(T,{key:p},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,u(d.n),1)],8,XK)):(a(),l(T,{key:1},[h(u(d.t),1)],64))],64))),128)):(a(),l(T,{key:1},[h("Introduction")],64))],2),(a(!0),l(T,null,H(e.readmeToc(),(d,p)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:R(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:ae(c=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(T,null,H(d.parts,(c,v)=>(a(),l(T,{key:v},[c.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+c.n},[n("i",null,u(c.n),1)],8,ZK)):(a(),l(T,{key:1},[h(u(c.t),1)],64))],64))),128))],10,QK))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Tt(o,{key:2,content:e.content,"base-url":e.fileBaseUrl,"allow-scripts":e.allowScripts},null,8,["content","base-url","allow-scripts"])):f("v-if",!0),e.fileFrame()?(a(),l("section",{key:3,class:R(["file-card file-card-media","view-"+e.type])},[n("header",xK,[n("div",eY,[n("button",{type:"button",class:R(["btn btn-sm btn-icon-only btn-ghost card-files-btn",{"is-needed":e.sidebarHidden}]),title:"Show file tree",onClick:t[35]||(t[35]=d=>e.sidebarHidden?e.sidebarHidden=!1:e.sidebarCollapsed=!1)},[...t[87]||(t[87]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-sidebar"})],-1),n("span",{class:"card-files-label"},"Files",-1)])],2 Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,8,QY),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",ZY,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=m("Matches become ",-1)),n("code",null,d(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=m(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=m(" for a custom replacement. Regex is supported.",-1))])]),P(n("div",xY,"Terms are in an invalid format.",512),[[x,e.defaultsForm?.terms?.errors?.format]])])]),n("section",eJ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",tJ,[n("label",nJ,[P(n("input",oJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=m("Keep links",-1))]),n("label",sJ,[P(n("input",iJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=m("Display images",-1))]),n("label",rJ,[P(n("input",aJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=m("Display PDFs",-1))]),n("label",lJ,[P(n("input",dJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=m("Display notebooks",-1))]),n("label",uJ,[P(n("input",cJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=m("Show line counts",-1))]),n("label",pJ,[P(n("input",fJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=m("GitHub Pages",-1))])]),t[33]||(t[33]=n("p",{class:"settings-help"},"Images and PDFs are not anonymized.",-1)),t[34]||(t[34]=n("p",{class:"settings-help"},"GitHub Pages must use the anonymized branch.",-1))])]),n("section",mJ,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",hJ,[P(n("input",gJ,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=m("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",vJ,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[P((a(),l("select",yJ,[...t[39]||(t[39]=[n("option",{value:"redirect"},"Redirect visitors to the GitHub repository",-1),n("option",{value:"remove",selected:""},"Remove the anonymized repository",-1)])])),[[i,{state:e.viewState,set:r=>{e.options.expirationMode=r},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",bJ,d(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",wJ,[n("div",kJ,[e.draftRestored?(a(),l("span",CJ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",SJ,"Unsaved changes"+d(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",EJ,d(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=r=>e.discardDraft())},"Discard changes")):p("v-if",!0),n("button",{id:"save",type:"submit",class:R(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},d(e.saving?"Saving\u2026":"Save defaults"),11,NJ),e.error?(a(),l("div",RJ,d(e.error),1)):p("v-if",!0)])],32)),[[o,e.viewState]])],512),[[x,e.settingsTab==="defaults"]]),P(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",PJ,"Loading billing\u2026")):p("v-if",!0),e.billingError?(a(),l("div",DJ,[m(d(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=r=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,AJ)])):p("v-if",!0),e.billingNotice?(a(),l("p",IJ,d(e.billingNotice),1)):p("v-if",!0),e.billingPending?(a(),l("div",OJ,[t[42]||(t[42]=n("strong",null,"Confirming your payment",-1)),t[43]||(t[43]=n("p",null,"Your allowance will update after confirmation. Please do not pay again.",-1)),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[4]||(t[4]=r=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,MJ)])):p("v-if",!0),n("section",VJ,[n("div",LJ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",qJ,d(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",$J,[m(d(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u Line truncated
`);t.innerHTML=s.map(i=>{let o=i.replace(/^(<[^>]+>)+/,"").charAt(0),r=i.startsWith("@@")?"hunk":o==="+"?"add":o==="-"?"remove":"";return`<span class="md-diff-line${r?" is-"+r:""}">${i||" "}</span>`}).join(`
`)}),Qp=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},ef=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let s=t.querySelectorAll(".md-diff-line");if(s.length){s.forEach(o=>{o.classList.contains("is-hunk")||o.style.setProperty("--hang",Qp(o.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let i=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(o=>{let r=i.join("");o.replace(/<\/?span\b[^>]*>/g,f=>(f.startsWith("</")?i.pop():i.push(f),f));let u=o.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${Qp(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},tf={props:["content","terms","options"],setup(e){let t=Ct(null),s=()=>{t.value.innerHTML=renderMD(e.content||"",window.location.pathname+"/../"),xp(t.value),ef(t.value)};return yn(()=>{s(),dt(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>Pe("markdown",{ref:t})}},Ete={props:["file","terms","options"],setup(e){let t=Ct(null),s=()=>ze(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),xp(t.value),ef(t.value)});return yn(s),dt(()=>[e.file?.content,e.terms,e.options],s,{deep:!0}),()=>{let i=e.file||{},o=(i.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(o)||i.language==="Markdown")return Pe("gist-file",{ref:t},Pe(tf,{content:i.content,terms:e.terms,options:e.options}));let r={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},u=(i.language||o||"none").toLowerCase();return Pe("gist-file",{ref:t},Pe("pre",{class:"line-numbers"},Pe("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},Nte=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let s=document.createElement("div");s.className="nb-code-scroll",t.replaceWith(s),s.appendChild(t);let i=()=>{let o=t.scrollWidth-t.clientWidth>1;if(s.classList.toggle("is-overflowing",o),s.classList.toggle("is-at-end",o&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!o)return;let r=t.clientWidth-16,u=Math.max(24,r*t.clientWidth/t.scrollWidth);s.style.setProperty("--thumb-w",u+"px"),s.style.setProperty("--thumb-x",(r-u)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",i,{passive:!0}),window.ResizeObserver?new ResizeObserver(i).observe(t):i(),i()}),Rte={props:["file","content"],setup(e){let t=Ct(null),s=0,i,o=async()=>{let r=++s;i?.abort(),i=new AbortController;try{let u=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:i.signal}).then(f=>{if(!f.ok)throw Error("Notebook request failed");return f.json()});if(await Zn("notebook"),r!==s)return;t.value.innerHTML=Bs(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(f=>window.Prism?.highlightElement(f)),Nte(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return yn(()=>{o(),dt(()=>[e.file,e.content],o)}),ao(()=>{s++,i?.abort()}),()=>Pe("notebook",{ref:t})}},Tte={props:["stats"],setup(e){return()=>{let t=Object.entries(e.stats||{}).filter(([,i])=>i.code),s=t.reduce((i,[,o])=>i+o.code,0);return Pe("loc",t.map(([i,o])=>Pe("div",{class:"lang",title:`${i}: ${o.code.toLocaleString()} lines`,style:{width:o.code*100/s+"%",background:langColors[i]}})))}}},nf={Markdown:tf,GistFile:Ete,Notebook:Rte,Loc:Tte,HtmlDoc:Yp,QuotaUsage:Cte,Pdfviewer:Cd(async()=>(await Zn("pdf"),pdfjsLib.GlobalWorkerOptions.workerSrc="/script/external/pdf.worker.js",Jp))},of={async mounted(e,{value:t}){e._editorValue=t;try{if(await ci(),e._editorDisposed)return;let s=e._editorValue,i=ace.edit(e);e._editor=i,i.setValue(String(s.content??""),-1),Zp(e,s.options),e._editorCleanup=s.options?.onLoad?.(i)}catch(s){e._editorDisposed||(e.textContent=s.message)}},updated(e,{value:t}){e._editorValue=t,e._editor&&(e._editor.getValue()!==String(t.content??"")&&e._editor.setValue(String(t.content??""),-1),Zp(e,t.options))},beforeUnmount(e){e._editorDisposed=!0,e._editorCleanup?.(),e._editor?.destroy()}};function Zp(e,t={}){let s=Ste.has(t.mode)?t.mode:"text";e._editor.session.setMode("ace/mode/"+s),t.theme&&e._editor.setTheme("ace/theme/"+t.theme),e._editor.setReadOnly(t.readOnly!==!1)}var sf={mounted(e){if(!window.IntersectionObserver)return;let t=[...e.querySelectorAll('a[href^="#"]')],s=new Set,i=new IntersectionObserver(o=>{o.forEach(u=>u.isIntersecting?s.add(u.target.id):s.delete(u.target.id));let r=t.find(u=>s.has(u.hash.slice(1)));r&&t.forEach(u=>u.classList.toggle("active",u===r))},{rootMargin:"-20% 0px -60% 0px",threshold:0});ze(()=>{t.forEach(o=>{let r=document.getElementById(o.hash.slice(1));r&&i.observe(r)}),t[0]&&!t.some(o=>o.classList.contains("active"))&&t[0].classList.add("active")}),e._observer=i},beforeUnmount(e){e._observer?.disconnect()}};function rf(e){let t=[],s=0,i=/\bXXXX-(\d+)\b/g,o;for(;o=i.exec(e);)o.index>s&&t.push(e.slice(s,o.index)),t.push(Pe("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+o[1]},[Pe("i",null,o[1])])),s=o.index+o[0].length;return t.length?(s<e.length&&t.push(e.slice(s)),t):e}function Pte(e){let t=rf(e),s=[];for(let i of Array.isArray(t)?t:[t]){if(typeof i!="string"){s.push(i);continue}let o=i.split(/(?<=[._-])/);o.forEach((r,u)=>{s.push(r),u<o.length-1&&s.push(Pe("wbr"))})}return s}function Dte(e){if(e<1024)return`${e} B`;let t=["KB","MB","GB"],s=e/1024,i=0;for(;s>=1024&&i<t.length-1;)s/=1024,i++;return`${s.toFixed(1)} ${t[i]}`}function Ate(e){let t={children:[]},s=new Map([["",t]]);function i(o){if(s.has(o))return s.get(o);let r=o Line truncated
jane.smith@example.org`},null,8,gX),[[r,{state:e.viewState,set:i=>{e.terms=i},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",vX,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=h("Matches become ",-1)),n("code",null,u(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=h(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=h(" for a custom replacement. Regex is supported.",-1))])]),D(n("div",yX,"Terms are in an invalid format.",512),[[Z,e.defaultsForm?.terms?.errors?.format]])])]),n("section",bX,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",wX,[n("label",kX,[D(n("input",CX,null,512),[[r,{state:e.viewState,set:i=>{e.options.link=i},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=h("Keep links",-1))]),n("label",SX,[D(n("input",EX,null,512),[[r,{state:e.viewState,set:i=>{e.options.image=i},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=h("Display images",-1))]),n("label",NX,[D(n("input",RX,null,512),[[r,{state:e.viewState,set:i=>{e.options.pdf=i},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=h("Display PDFs",-1))]),n("label",TX,[D(n("input",PX,null,512),[[r,{state:e.viewState,set:i=>{e.options.notebook=i},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=h("Display notebooks",-1))]),n("label",DX,[D(n("input",AX,null,512),[[r,{state:e.viewState,set:i=>{e.options.loc=i},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=h("Show line counts",-1))]),n("label",IX,[D(n("input",OX,null,512),[[r,{state:e.viewState,set:i=>{e.options.page=i},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=h("GitHub Pages",-1))])]),t[33]||(t[33]=n("p",{class:"settings-help"},"Images and PDFs are not anonymized.",-1)),t[34]||(t[34]=n("p",{class:"settings-help"},"GitHub Pages must use the anonymized branch.",-1))])]),n("section",MX,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",VX,[D(n("input",LX,null,512),[[r,{state:e.viewState,set:i=>{e.options.update=i},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=h("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",qX,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[D((a(),l("select",FX,[...t[39]||(t[39]=[n("option",{value:"redirect"},"Redirect visitors to the GitHub repository",-1),n("option",{value:"remove",selected:""},"Remove the anonymized repository",-1)])])),[[r,{state:e.viewState,set:i=>{e.options.expirationMode=i},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",$X,u(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",_X,[n("div",UX,[e.draftRestored?(a(),l("span",BX,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",zX,"Unsaved changes"+u(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",HX,u(e.message?"Defaults saved":"No unsaved changes"),1))]),e.draftRestored||e.unsavedChanges?(a(),l("button",{key:0,type:"button",class:"draft-discard",onClick:t[0]||(t[0]=i=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:R(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},u(e.saving?"Saving\u2026":"Save defaults"),11,jX),e.error?(a(),l("div",GX,u(e.error),1)):f("v-if",!0)])],32)),[[s,e.viewState]])],512),[[Z,e.settingsTab==="defaults"]]),D(n("section",{id:"settings-billing","aria-busy":e.billingLoading||e.billingBusy},[t[95]||(t[95]=n("p",{class:"settings-scope"},"Your plan and usage. Reviewer access is always free.",-1)),e.billingLoading?(a(),l("p",KX,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",YX,[h(u(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=i=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,JX)])):f("v-if",!0),e.billingNotice?(a(),l("p",XX,u(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",QX,[t[42]||(t[42]=n("strong",null,"Confirming your payment",-1)),t[43]||(t[43]=n("p",null,"Your allowance will update after confirmation. Please do not pay again.",-1)),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[4]||(t[4]=i=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,ZX)])):f("v-if",!0),n("section",xX,[n("div",eQ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",tQ,u(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",nQ,[h(u(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access u Line truncated
`);t.innerHTML=o.map(r=>{let s=r.replace(/^(<[^>]+>)+/,"").charAt(0),i=r.startsWith("@@")?"hunk":s==="+"?"add":s==="-"?"remove":"";return`<span class="md-diff-line${i?" is-"+i:""}">${r||" "}</span>`}).join(`
`)}),mf=(e,t=0)=>{let o=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+o+4,24)},yf=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let o=t.querySelectorAll(".md-diff-line");if(o.length){o.forEach(s=>{s.classList.contains("is-hunk")||s.style.setProperty("--hang",mf(s.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let r=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(s=>{let i=r.join("");s.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?r.pop():r.push(p),p));let d=s.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${mf(d)}ch">${i}${s||" "}${"</span>".repeat(r.length)}</span>`}).join(`
`)})},vse=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",kl={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>{let r=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?Ko(r):r,vf(t.value),yf(t.value),e.idPrefix!=null){let s={};t.value.querySelectorAll("h1, h2, h3").forEach(i=>{let d=e.idPrefix+(i.id||vse(i.textContent));s[d]?d+="-"+ ++s[d]:s[d]=1,i.id=d})}e.onOutline?.(ar(t.value))};return yn(()=>{o(),dt(()=>[e.content,e.terms,e.options],o,{deep:!0})}),()=>we("markdown",{ref:t,class:e.reader?"markdown-body":null})}},hf=e=>kn(e).map(t=>t.n?we("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},we("i",t.n)):t.t),wl=e=>/^XXXX-\d+$/.test(String(e||"").trim()),yse=(e,t="Reviewer")=>e?we("span",{class:["pr-author",{"is-redacted":wl(e)}],title:wl(e)?"Redacted author":null},wl(e)?hf(e):["@",...hf(e)]):we("span",{class:"pr-author is-hidden"},t),bf={props:["comments","fmt"],setup(e){return()=>we("div",{class:"pr-thread"},(e.comments||[]).map((t,o)=>we("article",{class:["pr-thread-comment",{"is-reply":o>0}],key:o},[we("header",{class:"pr-thread-head"},[we("span",{class:"pr-avatar","aria-hidden":"true"},we("svg",{class:"ui-icon"},we("use",{href:"#ui-icon-user"}))),yse(t.author),t.creationDate||t.updatedDate?we("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?we("div",{class:"pr-thread-body"},we(kl,{content:t.body,reader:!0})):null])))}},bse=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),wse=new Set(["add","remove","ctx","hunk"]),kse=e=>{let t=wse.has(e.kind)?e.kind:"ctx",o=kn(e.text).map(r=>r.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(r.n)}"><i>${Number(r.n)}</i></span>`:bse(r.t)).join("");return`<tr class="diff-row diff-row-${t}"><td class="diff-gutter diff-gutter-old">${Number(e.oldNo)||""}</td><td class="diff-gutter diff-gutter-new">${Number(e.newNo)||""}</td><td class="diff-sign">${t==="add"?"+":t==="remove"?"\u2212":""}</td><td class="diff-code" style="--hang: ${Wo(e.text)}ch">${o}</td></tr>`},Cse={props:["file","fmt"],setup(e){return()=>{let t=[],o="",r=()=>{o&&t.push(we("tbody",{key:"r"+t.length,innerHTML:o})),o=""};return(e.file?.lines||[]).forEach(s=>{o+=kse(s),s.threads?.length&&(r(),t.push(we("tbody",{key:"t"+t.length},s.threads.map((i,d)=>we("tr",{class:"diff-thread-row",key:d},[we("td",{class:"diff-thread-gutter",colspan:3}),we("td",{class:"diff-thread-cell"},we(bf,{comments:i.comments,fmt:e.fmt}))])))))}),r(),we("table",{class:"diff-file-table"},t)}}},Sse={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=Ct(null),o=()=>Be(()=>{t.value?.querySelectorAll("pre code").forEach(r=>window.Prism?.highlightElement(r)),vf(t.value),yf(t.value)});return yn(o),dt(()=>[e.file?.content,e.terms,e.options],o,{deep:!0}),()=>{let r=e.file||{},s=(r.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(s)||r.language==="Markdown")return we("gist-file",{ref:t},we(kl,{content:r.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let i={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},d=(r.language||s||"none").toLowerCase();return we("gist-file",{ref:t},we("pre",{class:"line-numbers"},we("code",{class:"language-"+(i[d]||d),key:r.content},r.content||"")))}}},Ese=e=>e?.querySelectorAll(".nb-input pre").forEach(t=>{if(t.parentElement?.classList.contains("nb-code-scroll"))return;let o=document.createElement("div");o.className="nb-code-scroll",t.replaceWith(o),o.appendChild(t);let r=()=>{let s=t.scrollWidth-t.clientWidth>1;if(o.classList.toggle("is-overflowing",s),o.classList.toggle("is-at-end",s&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!s)return;let i=t.clientWidth-16,d=Math.max(24,i*t.clientWidth/t.scrollWidth);o.style.setProperty("--thumb-w",d+"px"),o.style.setProperty("--thumb-x",(i-d)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",r,{passive:!0}),window.ResizeObserver?new ResizeObserver(r).observe(t):r(),r()}),Nse={props:["file","content"],setup(e){let t=Ct(null),o=0,r,s=async()=>{let i=++o;r?.abort(),r=new AbortController;try{let d=e.content?JSON.parse(e.content):await fetch(e.file?.download_url||e.file,{signal:r.signal}).then(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await eo("notebook"),i!==o)return;t.value.innerHTML=Ko(DOMPurify.sanitize(nb.parse(d).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),Ese(t.value)}catch(d){i===o&&d.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return yn(()=>{s(),dt(()=>[e.file,e.content],s)}),lo(()=>{o++,r?.abort()}),()=>we("notebook",{ref:t})}},RsLine truncated
/*! Bundled license information:
@vue/shared/dist/shared.esm-bundler.js:
+273 -1
View File
@@ -342,6 +342,7 @@ app.get("/api/conferences/:id", (req, res) => {
const explorerFiles = {
"": [
{ name: "src", path: "" },
{ name: "docs", path: "" },
{ name: "README.md", path: "", size: 640, sha: "a1" },
{ name: "LICENSE", path: "", size: 1070, sha: "a2" },
{ name: "requirements.txt", path: "", size: 40, sha: "a3" },
@@ -351,13 +352,80 @@ const explorerFiles = {
{ name: "train.py", path: "src", size: 900, sha: "b1" },
],
"src/utils": [{ name: "data.py", path: "src/utils", size: 300, sha: "c1" }],
docs: [
{ name: "REPRODUCING.md", path: "docs", size: 3400, sha: "d1" },
{ name: "NOTES.md", path: "docs", size: 120, sha: "d2" },
],
};
// A long guide (h1-h3, a redacted heading) for the Markdown outline, and a short
// note with two headings, which shows no outline.
const reproducingGuide = [
"# Reproducing the results",
"",
"This guide walks through every experiment in the paper by XXXX-1, from a clean machine to the numbers in Table 2. Each step lists the command, how long it takes on one GPU, and what the output should look like.",
"",
"## Requirements",
"",
"A Linux machine with Python 3.11, 32 GB of RAM and one GPU with at least 16 GB of memory. The scripts also run on CPU, about twenty times slower.",
"",
"### Python packages",
"",
"```bash\npip install -r requirements.txt\n```",
"",
"### Datasets",
"",
"The three datasets are mirrored on Zenodo. `scripts/fetch.sh` downloads them into `data/` and checks their hashes; nothing else needs a network connection.",
"",
"## Training",
"",
"Training reads `configs/base.yaml`. The defaults reproduce the main model; the ablations override one key each.",
"",
"```bash\npython src/train.py --config configs/base.yaml --seed 1\n```",
"",
"A full run takes about six hours. Checkpoints are written to `out/checkpoints/` every epoch, so an interrupted run resumes where it stopped.",
"",
"### Seeds",
"",
"The paper reports the mean of five seeds (1 to 5). Pass `--seed` to choose one; `scripts/sweep.sh` runs all five in sequence.",
"",
"## Evaluation",
"",
"`src/evaluate.py` loads a checkpoint and writes one JSON line per benchmark task to `out/results.jsonl`. The aggregate table is built from that file.",
"",
"| Benchmark | Tasks | Time |",
"| --- | --- | --- |",
"| Defects4J | 395 | 40 min |",
"| QuixBugs | 40 | 5 min |",
"| Bears | 251 | 30 min |",
"",
"### Expected numbers",
"",
"Within one point of Table 2 on every benchmark. Larger gaps usually mean a different PyTorch version; see the troubleshooting section.",
"",
"## Results from XXXX-2 cluster",
"",
"The original runs used the XXXX-2 cluster. Their logs are in `logs/` so the numbers can be checked without retraining.",
"",
"## Troubleshooting",
"",
"**Out of memory.** Lower `batch_size` in the config; accuracy is unchanged down to 8.",
"",
"**Different numbers.** Check `pip freeze` against `requirements.lock`. Contact XXXX-1 through the conference system if the gap persists.",
"",
"## License",
"",
"Code under MIT, data under CC BY 4.0.",
"",
].join("\n");
const explorerContent = {
"README.md": "# DeepLearnUtils\n\nDeveloped by XXXX-1 at XXXX-2.\n\nUtilities for reproducing the paper's experiments. Every script in `src/` reads its configuration from `configs/` and writes results to `out/`, so a full run of the evaluation only needs the two commands below. The long sentence here checks the reading width of rendered Markdown.\n\n## Quick start\n\n```bash\n# maintained by XXXX-1\npip install -r requirements.txt\npython src/train.py --config configs/base.yaml\n```\n\n```mermaid\ngraph LR; XXXX-2 --> Paper\n```\n\n| Model | Accuracy |\n| --- | --- |\n| Baseline | 71.2 |\n| Ours | 78.9 |\n\nContact: XXXX-3\n",
LICENSE: "MIT License\n\nCopyright (c) 2026 XXXX-1\n",
"requirements.txt": "torch>=2.3\nnumpy\npyyaml\n",
"src/train.py": '# Copyright 2026 XXXX-1, XXXX-2\nimport argparse\nimport yaml\n\nfrom utils.data import load_dataset\n\n\ndef main():\n parser = argparse.ArgumentParser(description="Train the model")\n parser.add_argument("--config", required=True)\n args = parser.parse_args()\n with open(args.config) as f:\n config = yaml.safe_load(f)\n dataset = load_dataset(config["data"])\n print(f"Loaded {len(dataset)} examples")\n\n\nif __name__ == "__main__":\n main()\n',
"src/utils/data.py": "def load_dataset(path):\n with open(path) as f:\n return [line.strip() for line in f]\n",
"docs/REPRODUCING.md": reproducingGuide,
"docs/NOTES.md": "# Notes\n\nScratch notes.\n\n## Open questions\n\nNone yet.\n",
};
const EXPLORER_ID = "anonymous_github-C72C";
app.get("/api/repo/missing-repo/{*rest}", (req, res) =>
@@ -379,7 +447,7 @@ app.get(`/api/repo/${EXPLORER_ID}/options`, (req, res) =>
})
);
app.get(`/api/repo/${EXPLORER_ID}/files/counts`, (req, res) =>
res.json({ "": 6, src: 2, "src/utils": 1 })
res.json({ "": 9, src: 2, "src/utils": 1, docs: 2 })
);
app.get(`/api/repo/${EXPLORER_ID}/files`, (req, res) =>
res.json(explorerFiles[req.query.path || ""] || [])
@@ -1368,6 +1436,210 @@ app.get("/api/admin/billing/grants", (req, res) => {
res.json({ page: pageNo, limit, total: rows.length, results, stateCounts, statuses: [...new Set(billingGrants.map((g) => g.status))].sort() });
});
// Reviewer pages for an anonymized pull request and gist: several files, a long
// diff, issue and review comments, and redacted terms in the title, body and diff.
const PR_ID = "robust-repair-pr-1F3A";
const longEvalBody = Array.from({ length: 46 }, (_, i) => `+ rows.append(score_task(model, tasks[${i}], seed=seed)) # task ${i + 1}`).join("\n");
const prDiff = [
"diff --git a/src/evaluate.py b/src/evaluate.py",
"index 3f2a1c0..8b9d4e2 100644",
"--- a/src/evaluate.py",
"+++ b/src/evaluate.py",
"@@ -1,18 +1,24 @@",
" # Evaluation harness for the XXXX-1 repair model.",
" import argparse",
" import json",
"+import statistics",
" ",
" from utils.data import load_dataset",
"+from utils.seeds import SEEDS",
" ",
" ",
"-def evaluate(model, tasks):",
"- return [score_task(model, t) for t in tasks]",
"+def evaluate(model, tasks, seeds=SEEDS):",
"+ \"\"\"Score every task once per seed and keep the per-seed rows.\"\"\"",
"+ rows = []",
"+ for seed in seeds:",
"+ rows.extend(score_task(model, t, seed=seed) for t in tasks)",
"+ return rows",
" ",
" ",
" def main():",
" parser = argparse.ArgumentParser(description=\"Evaluate a checkpoint\")",
" parser.add_argument(\"--checkpoint\", required=True)",
"+ parser.add_argument(\"--seeds\", type=int, nargs=\"+\", default=SEEDS)",
" args = parser.parse_args()",
"- rows = evaluate(load_model(args.checkpoint), load_dataset(\"data/test.jsonl\"))",
"+ rows = evaluate(load_model(args.checkpoint), load_dataset(\"data/test.jsonl\"), args.seeds)",
"+ print(\"mean accuracy\", statistics.mean(r[\"accuracy\"] for r in rows))",
" with open(\"out/results.jsonl\", \"w\") as f:",
" for row in rows:",
" f.write(json.dumps(row) + \"\\n\")",
"@@ -40,6 +46,58 @@ def score_task(model, task):",
" return {\"task\": task[\"id\"], \"accuracy\": acc}",
" ",
" ",
"+def score_all(model, tasks, seed):",
"+ rows = []",
longEvalBody,
"+ return rows",
"+",
"+",
" if __name__ == \"__main__\":",
" main()",
"diff --git a/src/utils/seeds.py b/src/utils/seeds.py",
"new file mode 100644",
"index 0000000..1d2c3b4",
"--- /dev/null",
"+++ b/src/utils/seeds.py",
"@@ -0,0 +1,6 @@",
"+\"\"\"Seeds used for every number in the paper (see XXXX-2 lab notes).\"\"\"",
"+",
"+SEEDS = [1, 2, 3, 4, 5]",
"+",
"+# Seed 6 diverged on the XXXX-2 cluster; keep it out of the mean.",
"+EXCLUDED = [6]",
"diff --git a/configs/base.yaml b/configs/base.yaml",
"index 6a7b8c9..0d1e2f3 100644",
"--- a/configs/base.yaml",
"+++ b/configs/base.yaml",
"@@ -1,5 +1,6 @@",
"-# Base configuration (XXXX-1)",
"+# Base configuration",
" data: data/train.jsonl",
" model: transformer-small",
"-seed: 1",
"+seeds: [1, 2, 3, 4, 5]",
"+batch_size: 16",
" output: /home/XXXX-3/out",
"diff --git a/scripts/sweep.sh b/scripts/sweep.sh",
"new file mode 100755",
"index 0000000..aa11bb2",
"--- /dev/null",
"+++ b/scripts/sweep.sh",
"@@ -0,0 +1,7 @@",
"+#!/usr/bin/env bash",
"+# Run the five seeds of Table 2 in sequence.",
"+set -euo pipefail",
"+for seed in 1 2 3 4 5; do",
"+ python src/train.py --config configs/base.yaml --seed \"$seed\"",
"+done",
"+python src/evaluate.py --checkpoint out/checkpoints/last.pt",
"diff --git a/README.md b/README.md",
"index 1234567..89abcde 100644",
"--- a/README.md",
"+++ b/README.md",
"@@ -8,9 +8,12 @@ Utilities for reproducing the paper's experiments.",
" ## Quick start",
" ",
" ```bash",
"-# maintained by XXXX-1",
" pip install -r requirements.txt",
" python src/train.py --config configs/base.yaml",
"+# all five seeds, then the evaluation",
"+bash scripts/sweep.sh",
" ```",
" ",
"+Results are the mean of five seeds; see `src/utils/seeds.py`.",
"+",
" Contact: XXXX-3",
"diff --git a/scripts/old_eval.sh b/scripts/old_eval.sh",
"deleted file mode 100644",
"index 5566778..0000000",
"--- a/scripts/old_eval.sh",
"+++ /dev/null",
"@@ -1,3 +0,0 @@",
"-#!/usr/bin/env bash",
"-# Single-seed evaluation used before the camera-ready.",
"-python src/evaluate.py --checkpoint out/checkpoints/last.pt",
].join("\n") + "\n";
const prContent = {
anonymizeDate: ago(1), merged: false, state: "open", draft: false,
title: "Average Table 2 over five seeds in the XXXX-1 evaluation harness",
body: "This replaces the single-seed evaluation with the five-seed protocol described in Section 5 of the paper.\n\n## Changes\n\n- `evaluate()` scores every task once per seed and keeps the per-seed rows.\n- New `src/utils/seeds.py` lists the seeds; seed 6 is excluded (it diverged on the XXXX-2 cluster).\n- `scripts/sweep.sh` trains and evaluates all five seeds.\n\n## How to test\n\n```bash\nbash scripts/sweep.sh\n```\n\nThe mean accuracy should be within one point of Table 2. cc @XXXX-3",
author: "XXXX-3", baseRef: "main", headRef: "XXXX-3/five-seeds",
diff: prDiff,
creationDate: ago(9), updatedDate: ago(2),
commits: [
{ message: "Score every task once per seed", author: "XXXX-3", date: ago(9) },
{ message: "Add the seed list and exclude seed 6\n\nSeed 6 diverged on the XXXX-2 cluster.", author: "XXXX-3", date: ago(8) },
{ message: "Add scripts/sweep.sh for the five-seed protocol", author: "XXXX-3", date: ago(6) },
{ message: "Drop the single-seed evaluation script", author: "XXXX-3", date: ago(5) },
{ message: "Document the sweep in the README", author: "XXXX-4", date: ago(3) },
],
comments: [
{ author: "XXXX-4", body: "Thanks! I ran the sweep on a second machine and got 78.7 mean accuracy, which matches Table 2 within 0.2.", creationDate: ago(7), updatedDate: ago(7) },
{ author: "XXXX-3", body: "Great, I also added `scripts/sweep.sh` so reviewers can run the same protocol. The README points to it now.", creationDate: ago(4), updatedDate: ago(4) },
],
reviewComments: [
{ path: "src/evaluate.py", line: 15, comments: [
{ author: "XXXX-4", body: "Should the default come from the config instead of `SEEDS`? Otherwise `configs/base.yaml` and this list can drift.", creationDate: ago(6), updatedDate: ago(6) },
{ author: "XXXX-3", body: "Good point. The config now has `seeds:` and the CLI flag overrides it; `SEEDS` is only the fallback.", creationDate: ago(5), updatedDate: ago(5) },
] },
{ path: "src/utils/seeds.py", line: 5, comments: [
{ author: "XXXX-4", body: "Can we say why seed 6 diverged? A reviewer will ask.", creationDate: ago(6), updatedDate: ago(6) },
] },
],
};
app.get(`/api/pr/${PR_ID}/options`, (req, res) => res.json({ url: null, lastUpdateDate: ago(1), isAdmin: false, isOwner: false }));
app.get(`/api/pr/${PR_ID}/content`, (req, res) => res.json(prContent));
const GIST_ID = "robust-repair-gist-8D2E";
const gistContent = {
anonymizeDate: ago(2), isPublic: false,
description: "Five-seed evaluation notes for the XXXX-1 replication",
ownerLogin: "XXXX-3", creationDate: ago(20), updatedDate: ago(3),
files: [
{ filename: "PROTOCOL.md", language: "Markdown", type: "text/markdown", size: 1480, content: "# Evaluation protocol\n\nHow the numbers in Table 2 were produced, written for the artifact reviewers.\n\n## Setup\n\nOne GPU with 16 GB of memory. Install the pinned packages from `requirements.lock`.\n\n### Data\n\nThe three benchmarks are mirrored on Zenodo; `fetch.sh` downloads and checks them.\n\n## Running the sweep\n\nRun `sweep.sh` below. It trains five seeds in sequence and then evaluates the last checkpoint of each.\n\n### Seeds\n\nSeeds 1 to 5. Seed 6 diverged on the XXXX-2 cluster and is excluded.\n\n## Results from XXXX-2\n\nMean accuracy 78.9 over the five seeds, standard deviation 0.3.\n\n## Contact\n\nQuestions go through the conference system, not to XXXX-1 directly.\n" },
{ filename: "sweep.sh", language: "Shell", type: "application/x-sh", size: 240, content: "#!/usr/bin/env bash\n# Run the five seeds of Table 2 in sequence.\nset -euo pipefail\nfor seed in 1 2 3 4 5; do\n python src/train.py --config configs/base.yaml --seed \"$seed\"\ndone\npython src/evaluate.py --checkpoint out/checkpoints/last.pt\n" },
{ filename: "aggregate.py", language: "Python", type: "application/x-python", size: 980, content: "\"\"\"Aggregate per-seed rows into Table 2 (XXXX-1, 2026).\"\"\"\nimport json\nimport statistics\nimport sys\n\n\ndef load(path):\n with open(path) as f:\n return [json.loads(line) for line in f if line.strip()]\n\n\ndef table(rows):\n by_bench = {}\n for row in rows:\n by_bench.setdefault(row[\"benchmark\"], []).append(row[\"accuracy\"])\n return {name: (statistics.mean(v), statistics.pstdev(v)) for name, v in sorted(by_bench.items())}\n\n\nif __name__ == \"__main__\":\n for name, (mean, sd) in table(load(sys.argv[1])).items():\n print(f\"{name:12} {mean:5.1f} ± {sd:.1f}\")\n" },
{ filename: "results.json", language: "JSON", type: "application/json", size: 310, content: "{\n \"Defects4J\": { \"mean\": 78.9, \"sd\": 0.3 },\n \"QuixBugs\": { \"mean\": 82.5, \"sd\": 1.1 },\n \"Bears\": { \"mean\": 61.2, \"sd\": 0.8 }\n}\n" },
],
comments: [
{ author: "XXXX-4", body: "Ran `sweep.sh` on a second machine: Defects4J 78.7, within the reported deviation.", creationDate: ago(4), updatedDate: ago(4) },
],
};
app.get(`/api/gist/${GIST_ID}/options`, (req, res) => res.json({ url: null, lastUpdateDate: ago(2), isAdmin: false, isOwner: false }));
app.get(`/api/gist/${GIST_ID}/content`, (req, res) => res.json(gistContent));
// A gist with every format the explorer renders, for the per-file viewers and the
// Rendered/Raw toggle. Binary files are base64, as the gist content route returns them.
const FORMATS_GIST_ID = "replication-gist-formats-5B71";
const b64 = (buf) => Buffer.from(buf).toString("base64");
const toneWav = (() => {
const rate = 8000, n = rate; // one second, 440 Hz
const data = Buffer.alloc(n * 2);
for (let i = 0; i < n; i++) data.writeInt16LE(Math.round(Math.sin((2 * Math.PI * 440 * i) / rate) * 8000), i * 2);
const head = Buffer.alloc(44);
head.write("RIFF", 0); head.writeUInt32LE(36 + data.length, 4); head.write("WAVE", 8); head.write("fmt ", 12);
head.writeUInt32LE(16, 16); head.writeUInt16LE(1, 20); head.writeUInt16LE(1, 22); head.writeUInt32LE(rate, 24);
head.writeUInt32LE(rate * 2, 28); head.writeUInt16LE(2, 32); head.writeUInt16LE(16, 34); head.write("data", 36); head.writeUInt32LE(data.length, 40);
return Buffer.concat([head, data]);
})();
const galleryBytes = (name) => fs.readFileSync(path.join(GALLERY_DIR, name));
const formatsGist = {
anonymizeDate: ago(2), isPublic: true, description: "Replication files for the XXXX-1 artifact, one of each format",
ownerLogin: "XXXX-3", creationDate: ago(12), updatedDate: ago(2),
files: [
{ filename: "README.md", language: "Markdown", type: "text/markdown", size: 320, content: "# Replication files\n\nOne file of each kind the reviewer page renders, prepared by XXXX-1.\n\n## Contents\n\n- `results.csv`: the per-seed table\n- `analysis.ipynb`: the notebook behind Figure 1\n\n## Contact\n\nThrough the conference system.\n" },
{ filename: "results.csv", language: "CSV", type: "text/csv", size: galleryText["results.csv"].length, content: galleryText["results.csv"].replace("Baseline,1", "XXXX-2 baseline,1") },
{ filename: "analysis.ipynb", language: "Jupyter Notebook", type: "application/x-ipynb+json", size: galleryNotebook.length, content: galleryNotebook },
{ filename: "train.py", language: "Python", type: "application/x-python", size: 160, content: "# Copyright 2026 XXXX-1\nimport argparse\n\n\ndef main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--seed\", type=int, default=1)\n print(parser.parse_args())\n" },
{ filename: "pipeline.svg", language: "SVG", type: "image/svg+xml", size: galleryText["figures/pipeline.svg"].length, content: galleryText["figures/pipeline.svg"] },
{ filename: "accuracy.png", type: "image/png", size: galleryPng.length, encoding: "base64", content: b64(galleryPng) },
{ filename: "paper.pdf", type: "application/pdf", size: galleryBytes("paper.pdf").length, encoding: "base64", content: b64(galleryBytes("paper.pdf")) },
{ filename: "demo.mp4", type: "video/mp4", size: galleryBytes("demo/demo.mp4").length, encoding: "base64", content: b64(galleryBytes("demo/demo.mp4")) },
{ filename: "tone.wav", type: "audio/wav", size: toneWav.length, encoding: "base64", content: b64(toneWav) },
{ filename: "checkpoint.bin", type: "application/octet-stream", size: galleryCheckpoint.length, encoding: "base64", content: b64(galleryCheckpoint) },
{ filename: "train.parquet", type: "application/octet-stream", size: 312 * 1024 * 1024, encoding: "base64", tooLarge: true },
],
comments: [],
};
app.get(`/api/gist/${FORMATS_GIST_ID}/options`, (req, res) => res.json({ url: null, lastUpdateDate: ago(2), isAdmin: false, isOwner: false }));
app.get(`/api/gist/${FORMATS_GIST_ID}/content`, (req, res) => res.json(formatsGist));
app.all("/api/{*rest}", (req, res) => res.status(404).json({ error: "not mocked: " + req.path }));
app.use((req, res, next) => {
+60 -8
View File
@@ -15,7 +15,16 @@ import { IAnonymizedGistDocument } from "./model/anonymizedGists/anonymizedGists
import AnonymizedGistModel from "./model/anonymizedGists/anonymizedGists.model";
import config from "../config";
import { octokit, ownerGitHubAccessRequired } from "./GitHubUtils";
import { ContentAnonimizer } from "./anonymize-utils";
import { ContentAnonimizer, classifyByName } from "./anonymize-utils";
// Images are the only binary gist files kept: other binaries (PDF, Office,
// archives) carry metadata the text anonymizer cannot reach, so they are
// listed but never stored or served. The whole gist is one MongoDB document
// (16 MB max, base64 adds a third), so images share one budget.
const GIST_IMAGE_LIMIT = 4 * 1024 * 1024;
const GIST_IMAGE_BUDGET = 8 * 1024 * 1024;
const GIST_RAW_ORIGIN = "https://gist.githubusercontent.com/";
const isImageFile = (name: string) => /\.(png|jpe?g|gif|webp|bmp|ico|avif|tiff?)$/i.test(name || "");
import { createLogger } from "./logger";
const logger = createLogger("gist");
@@ -32,6 +41,8 @@ type GistPayload = {
language?: string;
size: number;
type?: string;
encoding?: "base64";
tooLarge?: boolean;
}[];
comments: {
body: string;
@@ -107,9 +118,32 @@ export default class Gist {
}),
]);
let imageBudget = GIST_IMAGE_BUDGET;
const files = await Promise.all(Object.values(gistInfo.data.files || {})
.filter((f): f is NonNullable<typeof f> => !!f)
.map(async (f) => {
// Binary files cannot be anonymized as text, and UTF-8 decoding
// corrupts them: images keep their bytes as base64, others none.
if (f.filename && classifyByName(f.filename) === false) {
const size = f.size || 0;
const meta = { filename: f.filename, language: f.language || undefined, size, type: f.type || undefined, encoding: "base64" as const, content: "" };
if (!isImageFile(f.filename)) return meta;
// Reserve before the await so concurrent downloads share the budget.
if (size > GIST_IMAGE_LIMIT || size > imageBudget) return { ...meta, tooLarge: true };
imageBudget -= size;
if (!f.raw_url?.startsWith(GIST_RAW_ORIGIN)) return meta;
try {
const raw = await fetch(f.raw_url, { signal: AbortSignal.timeout(30000) });
if (!raw.ok) throw new Error(`status ${raw.status}`);
const bytes = Buffer.from(await raw.arrayBuffer());
if (bytes.length > GIST_IMAGE_LIMIT) return { ...meta, tooLarge: true };
return { ...meta, content: bytes.toString("base64") };
} catch (error) {
// One unreadable image must not make the whole gist unavailable.
logger.warn("gist image unavailable", { code: "gist_file_unavailable", errorType: error instanceof Error ? error.name : undefined });
return meta;
}
}
let content = (f as typeof f & { encoding?: string }).encoding === "base64"
? Buffer.from(f.content || "", "base64").toString("utf8")
: f.content || "";
@@ -335,13 +369,29 @@ export default class Gist {
output.ownerLogin = anonymizer.anonymize(g?.ownerLogin || "");
}
if (this.options.content) {
output.files = (g?.files || []).map((f) => ({
filename: anonymizer.anonymize(f.filename),
content: anonymizer.anonymize(f.content),
language: f.language,
size: f.size,
type: f.type,
}));
output.files = (g?.files || []).map((f) => {
if (f.encoding !== "base64") return {
filename: anonymizer.anonymize(f.filename),
content: anonymizer.anonymize(f.content),
language: f.language,
size: f.size,
type: f.type,
};
// Images follow "Display images" as in repositories (off unless set);
// other binaries are never served, even if stored by an older version.
const image = isImageFile(f.filename);
const hidden = image && !this.options.image;
return {
filename: anonymizer.anonymize(f.filename),
content: f.tooLarge || hidden || !image || !f.content ? undefined : f.content,
language: f.language,
size: f.size,
type: f.type,
encoding: "base64",
tooLarge: f.tooLarge || undefined,
hidden: hidden || undefined,
};
});
}
if (this.options.comments) {
output.comments = g?.comments?.map((comment) => {
@@ -417,6 +467,8 @@ export default class Gist {
language: f.language,
size: f.size,
type: f.type,
encoding: f.encoding,
tooLarge: f.tooLarge,
})),
comments: (g.comments || []).map((c) => ({
body: c.body,
+136 -1
View File
@@ -17,6 +17,48 @@ import { createLogger } from "./logger";
const logger = createLogger("pull-request");
type ReviewComment = NonNullable<IAnonymizedPullRequestDocument["pullRequest"]["reviewComments"]>[number];
/**
* Group inline review comments into threads: each reply joins the thread of the
* comment it answers. Threads keep the order of their first comment; GitHub
* comment ids never leave the server.
*/
export function reviewThreads(comments: ReviewComment[]) {
const threads: { path: string; line?: number; side?: "LEFT" | "RIGHT"; comments: ReviewComment[] }[] = [];
const byId = new Map<number, (typeof threads)[number]>();
const sorted = [...comments].sort((a, b) => new Date(a.creationDate).getTime() - new Date(b.creationDate).getTime());
for (const comment of sorted) {
let thread = comment.inReplyTo != null ? byId.get(comment.inReplyTo) : undefined;
if (!thread) {
thread = { path: comment.path, line: comment.line ?? undefined, side: comment.side, comments: [] };
threads.push(thread);
}
thread.comments.push(comment);
if (comment.commentId != null) byId.set(comment.commentId, thread);
}
return threads;
}
/**
* Remove what identifies people from a commit message before the term
* anonymizer runs: trailers (Signed-off-by, Co-authored-by, ...), e-mail
* addresses, and the fork owner in merge headlines. Without the origin option,
* merge headlines also lose their branch names.
*/
export function commitMessage(message: string, opts: { origin: boolean }) {
const lines = message.split(/\r?\n/)
.filter((line) => !/^\s*[A-Za-z][A-Za-z-]*-by\s*:/i.test(line))
.map((line) => line.replace(/<?[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+>?/g, "").replace(/\s+$/, ""));
const merge = lines[0]?.match(/^Merge pull request (#\d+) from (\S+)/);
if (merge) lines[0] = opts.origin ? `Merge pull request ${merge[1]} from ${merge[2].replace(/^[^/]+\//, "")}` : `Merge pull request ${merge[1]}`;
else if (/^Merge (remote-tracking )?branch/.test(lines[0] || "")) {
lines[0] = opts.origin ? lines[0].replace(/ of \S+/, "") : "Merge branch";
}
while (lines.length && !lines[lines.length - 1].trim()) lines.pop();
return lines.join("\n");
}
export default class PullRequest {
private _model: IAnonymizedPullRequestDocument;
owner: User;
@@ -101,7 +143,40 @@ export default class PullRequest {
mediaType: { format: "diff" },
});
const [comments, diff] = await Promise.all([commentsPromise, diffPromise]);
// Commits and inline review comments are optional extras: a failure keeps
// the pull request readable without them.
const optional = <T>(label: string, promise: Promise<T[]>) =>
promise.catch((err): T[] => {
logger.warn(`PR ${label} unavailable, continuing without them`, {
code: `pr_${label.replace(/ /g, "_")}_unavailable`,
httpStatus: (err as { status?: number }).status,
pr: `${owner}/${repo}#${pull_number}`,
});
return [];
});
const commitsPromise = optional<{
commit?: { message?: string; author?: { date?: string } | null };
author?: { login?: string } | null;
}>("commits", oct.paginate("GET /repos/{owner}/{repo}/pulls/{pull_number}/commits", {
owner, repo, pull_number, per_page: 100,
}));
const reviewCommentsPromise = optional<{
id: number;
in_reply_to_id?: number;
path?: string;
line?: number | null;
side?: "LEFT" | "RIGHT" | null;
body?: string;
created_at: string;
updated_at: string;
user?: { login?: string } | null;
}>("review comments", oct.paginate("GET /repos/{owner}/{repo}/pulls/{pull_number}/comments", {
owner, repo, pull_number, per_page: 100,
}));
const [comments, diff, commits, reviewComments] = await Promise.all([
commentsPromise, diffPromise, commitsPromise, reviewCommentsPromise,
]);
this._model.pullRequest = {
diff: diff.data as unknown as string,
@@ -117,6 +192,28 @@ export default class PullRequest {
state: prInfo.data.state,
baseRepositoryFullName: prInfo.data.base.repo.full_name,
headRepositoryFullName: prInfo.data.head.repo?.full_name,
author: prInfo.data.user?.login || "",
baseRef: prInfo.data.base.ref,
headRef: prInfo.data.head.ref,
commits: commits.map((c) => ({
message: c.commit?.message || "",
author: c.author?.login || "",
date: c.commit?.author?.date ? new Date(c.commit.author.date) : undefined,
})),
reviewComments: reviewComments.map((c) => ({
commentId: c.id,
inReplyTo: c.in_reply_to_id,
path: c.path || "",
// An outdated comment has no line in the current diff; its
// original_line would point at an unrelated line, so it goes at the
// end of its file instead.
line: c.line ?? undefined,
side: c.line != null && c.side ? c.side : undefined,
body: c.body || "",
author: c.user?.login || "",
creationDate: new Date(c.created_at),
updatedDate: new Date(c.updated_at),
})),
comments: comments.map((comment) => ({
body: comment.body || "",
creationDate: new Date(comment.created_at),
@@ -362,8 +459,46 @@ export default class PullRequest {
return o;
});
}
if (this.options.username && this._model.pullRequest.author) {
output.author = anonymizer.anonymize(this._model.pullRequest.author);
}
// Branch names often carry a username or lab name ("asmith/fix"), so they
// are part of the origin, like the repository names.
if (this.options.origin) {
if (this._model.pullRequest.baseRef) output.baseRef = anonymizer.anonymize(this._model.pullRequest.baseRef);
if (this._model.pullRequest.headRef) output.headRef = anonymizer.anonymize(this._model.pullRequest.headRef);
}
if (this.options.diff) {
output.diff = anonymizer.anonymize(this._model.pullRequest.diff);
// Pull requests downloaded before commits were stored have none.
if (this._model.pullRequest.commits?.length) {
// No SHAs: a commit hash identifies the source repository.
output.commits = this._model.pullRequest.commits.map((commit) => {
const o: Record<string, unknown> = {
message: anonymizer.anonymize(commitMessage(commit.message || "", { origin: !!this.options.origin })),
};
if (this.options.username) o.author = anonymizer.anonymize(commit.author || "");
if (this.options.date) o.date = commit.date;
return o;
});
}
}
if (this.options.comments && this._model.pullRequest.reviewComments?.length) {
output.reviewComments = reviewThreads(this._model.pullRequest.reviewComments).map((thread) => ({
path: anonymizer.anonymize(thread.path),
line: thread.line,
side: thread.side,
comments: thread.comments.map((comment) => {
const o: Record<string, unknown> = {};
if (this.options.body) o.body = anonymizer.anonymize(comment.body);
if (this.options.username) o.author = anonymizer.anonymize(comment.author);
if (this.options.date) {
o.updatedDate = comment.updatedDate;
o.creationDate = comment.creationDate;
}
return o;
}),
}));
}
if (this.options.origin) {
output.baseRepositoryFullName =
@@ -60,6 +60,9 @@ const AnonymizedGistSchema = new Schema({
// nested `{ type: String }` the whole object is compiled as an array
// of strings and file objects are silently dropped on save.
type: { type: String },
// Binary files are listed; only images keep their bytes, as base64.
encoding: String,
tooLarge: Boolean,
},
],
comments: [
@@ -42,6 +42,8 @@ export interface IAnonymizedGist {
language?: string;
size?: number;
type?: string;
encoding?: "base64";
tooLarge?: boolean;
}[];
comments?: {
body: string;
@@ -59,6 +59,32 @@ const AnonymizedPullRequestSchema = new Schema({
state: String,
baseRepositoryFullName: String,
headRepositoryFullName: String,
author: String,
baseRef: String,
headRef: String,
commits: [
{
_id: false,
message: String,
author: String,
date: Date,
},
],
reviewComments: [
{
_id: false,
commentId: Number,
inReplyTo: Number,
path: String,
line: Number,
/** LEFT: a removed line (old numbering); RIGHT: an added or context line. */
side: String,
body: String,
author: String,
creationDate: Date,
updatedDate: Date,
},
],
comments: [
{
body: String,
@@ -45,6 +45,25 @@ export interface IAnonymizedPullRequest {
state?: string;
baseRepositoryFullName?: string;
headRepositoryFullName?: string;
author?: string;
baseRef?: string;
headRef?: string;
commits?: {
message: string;
author: string;
date?: Date;
}[];
reviewComments?: {
commentId: number;
inReplyTo?: number;
path: string;
line?: number;
side?: "LEFT" | "RIGHT";
body: string;
author: string;
creationDate: Date;
updatedDate: Date;
}[];
comments?: {
body: string;
creationDate: Date;
+9 -2
View File
@@ -29,6 +29,13 @@ function harness(date) {
context.createListeners = () => (target, name, callback) => target.addEventListener(name, callback);
vm.runInNewContext(fs.readFileSync(path.join(__dirname, "../public/script/billing.js"), "utf8").replaceAll("export function", "function"), context);
context.createPageState = parent => Object.create(parent);
context.nextTick = fn => Promise.resolve().then(fn);
context.window.document = context.document;
// Modules the controllers import: outline helpers, the diff parser and the reviewer pages.
for (const name of ["outline.js", "formatters.js", "review-pages.js"]) {
const moduleSource = fs.readFileSync(path.join(__dirname, "../public/script", name), "utf8");
vm.runInNewContext(moduleSource.replace(/^import .*;$/gm, "").replace(/export function/g, "function").replace(/export const/g, "var"), context);
}
const viewerSource = fs.readFileSync(path.join(__dirname, "../public/script/file-viewer.js"), "utf8");
vm.runInNewContext(viewerSource.replace(/^import .*;$/gm, "").replace(/export const/g, "var"), context);
const names = [...source.matchAll(/export const (\w+)/g)].map(match => match[1]);
@@ -358,11 +365,11 @@ describe("frontend production regressions", function () {
request.resolve({ data: { contents: ["title", "MASK", "MASK comment"] } }); await h.flush();
expect(h.scope.anonymizePrContent("Alice")).to.equal("MASK");
});
it("selects the diff tab after asynchronous PR loading", async function () {
it("selects the files tab after asynchronous PR loading when there is no conversation", async function () {
const h = harness(); h.defs.pullRequestController(h.scope, h.http, {}, { pullRequestId: "pr" }, {});
h.requests[0].resolve({ data: {} }); await h.flush();
h.requests[1].resolve({ data: { diff: "patch" } }); await h.flush();
expect(h.scope.tabState.active).to.equal("diff");
expect(h.scope.tabState.active).to.equal("files");
const template = fs.readFileSync(path.join(__dirname, "../public/partials/pullRequest.htm"), "utf8");
expect(template).not.to.include('ng-init="tabState');
});
+85
View File
@@ -0,0 +1,85 @@
const { expect } = require("chai");
require("ts-node/register/transpile-only");
const { default: Gist } = require("../src/core/Gist");
function makeGist(options) {
return new Gist({
gistId: "g-test",
owner: "000000000000000000000001",
source: { gistId: "abc" },
options: { terms: ["Alice"], content: true, title: true, image: true, ...options },
gist: {
description: "By Alice",
files: [
{ filename: "notes-Alice.md", content: "Written by Alice", language: "Markdown", size: 16 },
{ filename: "plot-Alice.png", content: "iVBORw0KGgoAlice==", encoding: "base64", size: 12, type: "image/png" },
{ filename: "paper.pdf", content: "JVBERi0xLjQK", encoding: "base64", size: 9, type: "application/pdf" },
{ filename: "huge.bin", content: "", encoding: "base64", size: 99999999, tooLarge: true },
],
},
});
}
describe("Gist.content() binary files", function () {
it("anonymizes text files and names, passes image bytes through, and never serves other binaries", function () {
const [md, png, pdf, huge] = makeGist().content().files;
expect(md).to.include({ filename: "notes-XXXX-1.md", content: "Written by XXXX-1" });
expect(md).to.not.have.property("encoding");
expect(png).to.include({ filename: "plot-XXXX-1.png", encoding: "base64", content: "iVBORw0KGgoAlice==" });
// A PDF stored by an older version keeps its author metadata: never served.
expect(pdf).to.include({ encoding: "base64" });
expect(pdf.content).to.be.undefined;
expect(huge).to.include({ tooLarge: true, encoding: "base64" });
expect(huge.content).to.be.undefined;
});
it("withholds images unless images are displayed, as for repositories", function () {
for (const image of [false, undefined]) {
const [, png] = makeGist({ image }).content().files;
expect(png.content).to.be.undefined;
expect(png.hidden).to.equal(true);
}
});
});
describe("Gist download of binary files", function () {
const GitHubUtils = require("../src/core/GitHubUtils");
let originalOctokit, originalFetch, fetched;
beforeEach(() => { originalOctokit = GitHubUtils.octokit; originalFetch = global.fetch; fetched = []; });
afterEach(() => { GitHubUtils.octokit = originalOctokit; global.fetch = originalFetch; });
async function download(files, respond) {
GitHubUtils.octokit = () => ({
rest: { gists: { get: async () => ({ data: { files, owner: { login: "alice" } } }) } },
paginate: async () => [],
});
global.fetch = async (url) => { fetched.push(url); return respond(url); };
const gist = makeGist();
gist._model.set = () => {}; gist._model.markModified = () => {};
await gist["downloadContent"]("token");
return Object.fromEntries(gist._gistPayload.files.map((f) => [f.filename, f]));
}
const raw = (name) => `https://gist.githubusercontent.com/alice/abc/raw/1/${name}`;
const ok = (bytes) => ({ ok: true, status: 200, arrayBuffer: async () => bytes });
it("stores images only, within the per-gist budget, and skips unreadable ones", async function () {
const MB = 1024 * 1024;
const files = {
"paper.pdf": { filename: "paper.pdf", size: 10, raw_url: raw("paper.pdf") },
"a.png": { filename: "a.png", size: 3 * MB, raw_url: raw("a.png") },
"b.png": { filename: "b.png", size: 3 * MB, raw_url: raw("b.png") },
"c.png": { filename: "c.png", size: 3 * MB, raw_url: raw("c.png") },
"big.png": { filename: "big.png", size: 5 * MB, raw_url: raw("big.png") },
"gone.png": { filename: "gone.png", size: 10, raw_url: raw("gone.png") },
"elsewhere.png": { filename: "elsewhere.png", size: 10, raw_url: "http://169.254.169.254/x.png" },
};
const stored = await download(files, (url) => url.endsWith("gone.png") ? { ok: false, status: 404 } : ok(new Uint8Array(8)));
expect(fetched.some((u) => u.endsWith("paper.pdf"))).to.equal(false);
expect(fetched.some((u) => u.includes("169.254"))).to.equal(false);
expect(stored["paper.pdf"]).to.include({ encoding: "base64", content: "" });
expect(stored["big.png"].tooLarge).to.equal(true);
// 8 MB budget: two 3 MB images fit, the third does not.
expect(["a.png", "b.png", "c.png"].filter((n) => stored[n].tooLarge)).to.have.length(1);
expect(stored["gone.png"]).to.include({ content: "" });
});
});
+122
View File
@@ -0,0 +1,122 @@
const { expect } = require("chai");
require("ts-node/register/transpile-only");
const { default: PullRequest, reviewThreads, commitMessage } = require("../src/core/PullRequest");
const at = (day) => new Date(`2026-03-${String(day).padStart(2, "0")}T10:00:00Z`);
function makePullRequest(options) {
return new PullRequest({
pullRequestId: "pr-test",
owner: "000000000000000000000001",
anonymizeDate: at(20),
source: { pullRequestId: 12, repositoryFullName: "alice/secret-project" },
options: { terms: ["Alice", "secret-project"], image: true, link: true, ...options },
pullRequest: {
title: "Fix by Alice",
body: "Body",
diff: "--- a/x\n+++ b/x\n@@ -1 +1 @@\n-Alice\n+Bob\n",
state: "open",
author: "Alice",
baseRef: "main",
headRef: "Alice/fix-secret-project",
creationDate: at(1),
updatedDate: at(2),
comments: [],
commits: [
{ message: "First commit by Alice\n\nDetails for secret-project", author: "Alice", date: at(3) },
{ message: "Second", author: "bob", date: at(4) },
],
reviewComments: [
{ commentId: 11, path: "src/Alice.py", line: 4, body: "Why Alice?", author: "bob", creationDate: at(5), updatedDate: at(5) },
{ commentId: 13, inReplyTo: 11, path: "src/Alice.py", line: 4, body: "Because", author: "Alice", creationDate: at(7), updatedDate: at(7) },
{ commentId: 12, path: "README.md", line: 1, body: "Typo", author: "carol", creationDate: at(6), updatedDate: at(6) },
],
},
});
}
const all = { title: true, body: true, comments: true, diff: true, username: true, date: true, origin: false };
describe("PullRequest.content() commits, branches and review threads", function () {
it("anonymizes the author, and shows branch names only with the origin", function () {
const out = makePullRequest(all).content();
expect(out.author).to.equal("XXXX-1");
expect(out).to.not.have.property("baseRef");
expect(out).to.not.have.property("headRef");
const withOrigin = makePullRequest({ ...all, origin: true }).content();
expect(withOrigin.baseRef).to.equal("main");
expect(withOrigin.headRef).to.equal("XXXX-1/fix-XXXX-2");
});
it("strips people from commit messages even without matching terms", function () {
const message = "Merge pull request #3 from asmith/fix-x\n\nFix x <asmith@uni.edu>\n\nSigned-off-by: Ann Smith <ann@uni.edu>\nCo-authored-by: Bo <bo@x.org>\n";
expect(commitMessage(message, { origin: false })).to.equal("Merge pull request #3\n\nFix x");
expect(commitMessage(message, { origin: true })).to.equal("Merge pull request #3 from fix-x\n\nFix x");
expect(commitMessage("Merge branch 'main' of github.com:asmith/repo into dev", { origin: true })).to.equal("Merge branch 'main' into dev");
expect(commitMessage("Merge branch 'asmith/x'", { origin: false })).to.equal("Merge branch");
expect(commitMessage("Plain message", { origin: false })).to.equal("Plain message");
const pr = makePullRequest(all);
pr.model.pullRequest.commits = [{ message: "Merge pull request #3 from asmith/fix\n\nSigned-off-by: Ann Smith <ann@uni.edu>", author: "asmith", date: at(3) }];
expect(pr.content().commits[0].message).to.equal("Merge pull request #3");
});
it("hides the author without the username option", function () {
const out = makePullRequest({ ...all, username: false }).content();
expect(out.author).to.be.undefined;
expect(out.commits[0]).to.not.have.property("author");
expect(out.reviewComments[0].comments[0]).to.not.have.property("author");
});
it("lists commits with anonymized messages and no SHA", function () {
const out = makePullRequest(all).content();
expect(out.commits).to.have.length(2);
expect(out.commits[0].message).to.equal("First commit by XXXX-1\n\nDetails for XXXX-2");
expect(out.commits[0].author).to.equal("XXXX-1");
expect(out.commits[0].date).to.deep.equal(at(3));
expect(Object.keys(out.commits[0])).to.have.members(["message", "author", "date"]);
});
it("drops commits when the diff is hidden, and dates when dates are hidden", function () {
expect(makePullRequest({ ...all, diff: false }).content().commits).to.be.undefined;
expect(makePullRequest({ ...all, date: false }).content().commits[0]).to.not.have.property("date");
});
it("groups review comments into threads without GitHub ids", function () {
const out = makePullRequest(all).content();
expect(out.reviewComments).to.have.length(2);
const [first, second] = out.reviewComments;
expect(first.path).to.equal("src/XXXX-1.py");
expect(first.line).to.equal(4);
expect(first.comments.map((c) => c.body)).to.deep.equal(["Why XXXX-1?", "Because"]);
expect(first.comments[1].author).to.equal("XXXX-1");
expect(second.path).to.equal("README.md");
expect(JSON.stringify(out.reviewComments)).to.not.match(/commentId|inReplyTo|"1[123]"/);
});
it("omits review threads without the comments option", function () {
expect(makePullRequest({ ...all, comments: false }).content().reviewComments).to.be.undefined;
});
it("keeps pull requests stored before commits and review comments readable", function () {
const pr = makePullRequest(all);
delete pr.model.pullRequest.commits;
delete pr.model.pullRequest.reviewComments;
const out = pr.content();
expect(out.commits).to.be.undefined;
expect(out.reviewComments).to.be.undefined;
expect(out.diff).to.include("XXXX-1");
});
});
describe("reviewThreads()", function () {
it("attaches replies to their thread even when they arrive out of order", function () {
const threads = reviewThreads([
{ commentId: 3, inReplyTo: 1, path: "a", line: 2, body: "reply 2", author: "x", creationDate: at(9), updatedDate: at(9) },
{ commentId: 1, path: "a", line: 2, body: "root", author: "x", creationDate: at(1), updatedDate: at(1) },
{ commentId: 2, inReplyTo: 1, path: "a", line: 2, body: "reply 1", author: "y", creationDate: at(2), updatedDate: at(2) },
{ commentId: 4, inReplyTo: 99, path: "b", line: 5, body: "orphan", author: "z", creationDate: at(3), updatedDate: at(3) },
]);
expect(threads.map((t) => t.comments.map((c) => c.body))).to.deep.equal([["root", "reply 1", "reply 2"], ["orphan"]]);
expect(threads[1]).to.include({ path: "b", line: 5 });
});
});
+166
View File
@@ -0,0 +1,166 @@
const { expect } = require("chai");
const { JSDOM } = require("jsdom");
const path = require("path");
const { pathToFileURL } = require("url");
const load = (name) => import(pathToFileURL(path.join(__dirname, "../public/script", name)).href);
describe("Reviewer page outlines and diffs", function () {
let outline, formatters, pages, dom, vue;
// The pages register their scroll listeners in the controller's effect scope.
const inScope = (fn) => { const scope = vue.effectScope(); scope.run(fn); return scope; };
before(async () => {
dom = new JSDOM("<!doctype html><body></body>", { pretendToBeVisual: true });
global.window = dom.window;
outline = await load("outline.js");
formatters = await load("formatters.js");
pages = await load("review-pages.js");
vue = await import("vue");
});
after(() => { delete global.window; dom.window.close(); });
it("splits redaction masks into slot parts", () => {
expect(outline.redactParts("Results from XXXX-2 cluster")).to.deep.equal([{ t: "Results from " }, { n: "2" }, { t: " cluster" }]);
expect(outline.redactParts("")).to.deep.equal([]);
});
it("outlines h1-h3 with redaction slots read back from the chips", () => {
const html = '<h1 id="t">Guide</h1><h2 id="a">Setup</h2><h3 id="b">Data</h3><h4 id="c">Skip</h4>'
+ '<h2 id="r">Results from <mark class="redact-chip" data-term="XXXX-2"><i>2</i></mark> cluster</h2>';
const list = outline.headingOutline(html);
expect(list.map((h) => [h.id, h.level, h.depth])).to.deep.equal([["t", 1, 0], ["a", 2, 1], ["b", 3, 2], ["r", 2, 1]]);
expect(list[3].parts).to.deep.equal([{ t: "Results from " }, { n: "2" }, { t: " cluster" }]);
});
it("starts depth at the shallowest heading", () => {
const list = outline.headingOutline('<h2 id="a">A</h2><h3 id="b">B</h3>');
expect(list.map((h) => h.depth)).to.deep.equal([0, 1]);
});
it("highlights the last section above the reading line", () => {
const doc = dom.window.document;
doc.body.innerHTML = '<h2 id="one">1</h2><h2 id="two">2</h2><h2 id="three">3</h2>';
const tops = { one: -400, two: 120, three: 700 };
for (const id of Object.keys(tops)) doc.getElementById(id).getBoundingClientRect = () => ({ top: tops[id] });
const view = { innerHeight: 900, scrollY: 400 };
expect(outline.activeSection(["one", "two", "three"], { doc, view })).to.equal("two");
tops.two = 400;
expect(outline.activeSection(["one", "two", "three"], { doc, view })).to.equal("one");
tops.one = 50;
tops.two = 300; tops.three = 600;
expect(outline.activeSection(["one", "two", "three"], { doc, view: { innerHeight: 900, scrollY: 0 } })).to.equal("one");
});
it("parses a diff into files with status and counts, without a phantom last line", () => {
const files = formatters.parseDiff([
"diff --git a/a.py b/a.py", "--- a/a.py", "+++ b/a.py", "@@ -1,2 +1,2 @@", " keep", "-old", "+new",
"diff --git a/gone.sh b/gone.sh", "deleted file mode 100644", "--- a/gone.sh", "+++ /dev/null", "@@ -1,2 +0,0 @@", "-x", "-y",
"diff --git a/new.md b/new.md", "new file mode 100644", "--- /dev/null", "+++ b/new.md", "@@ -0,0 +1 @@", "+hi",
"\\ No newline at end of file", "",
].join("\n"));
expect(files.map((f) => [f.path, f.status, f.additions, f.deletions, f.lines.length])).to.deep.equal([
["a.py", "modified", 1, 1, 4], ["gone.sh", "deleted", 0, 2, 3], ["new.md", "added", 1, 0, 2],
]);
expect(files[0].lines[3]).to.include({ kind: "add", newNo: 2 });
});
it("keeps removed '-- ' and added '++ ' lines inside a hunk as content", () => {
const files = formatters.parseDiff([
"diff --git a/q.sql b/q.sql", "--- a/q.sql", "+++ b/q.sql", "@@ -1,3 +1,3 @@", " select 1;", "--- old comment", "+++ new counter", " end;",
"diff --git a/b.txt b/b.txt", "--- a/b.txt", "+++ b/b.txt", "@@ -1 +1 @@", "-x", "+y",
].join("\n"));
expect(files.map((f) => [f.path, f.additions, f.deletions])).to.deep.equal([["q.sql", 1, 1], ["b.txt", 1, 1]]);
expect(files[0].lines.map((l) => l.text)).to.deep.equal(["@@ -1,3 +1,3 @@", "select 1;", "-- old comment", "++ new counter", "end;"]);
});
it("places a LEFT thread on the removed line and a RIGHT one on the new line with the same number", () => {
const state = { details: {
diff: "--- a/a.py\n+++ b/a.py\n@@ -1,2 +1,2 @@\n-gone\n+added\n keep\n",
reviewComments: [{ path: "a.py", line: 1, side: "LEFT", comments: [{ body: "old" }] }, { path: "a.py", line: 1, side: "RIGHT", comments: [{ body: "new" }] }],
}, fmt: { date: (d) => d } };
const scope = inScope(() => pages.setupPullRequestPage(state));
const [file] = state.prFiles();
expect(file.lines.filter((l) => l.threads).map((l) => [l.kind, l.threads[0].comments[0].body])).to.deep.equal([["remove", "old"], ["add", "new"]]);
scope.stop();
});
it("renders the legacy diff HTML from the same parser", () => {
const html = formatters.diff("--- a/x\n+++ b/x\n@@ -1 +1 @@\n-a<b\n+b\n");
expect(html).to.include('diff-file-status-modified').and.include("a&lt;b");
expect((html.match(/<tr/g) || []).length).to.equal(3);
});
it("places review threads on their diff line and keeps the rest at the end of the file", () => {
const state = { details: {
diff: "--- a/src/a.py\n+++ b/src/a.py\n@@ -1,2 +1,3 @@\n one\n+two\n three\n",
reviewComments: [{ path: "src/a.py", line: 2, comments: [{ body: "here" }] }, { path: "src/a.py", line: 40, comments: [{ body: "elsewhere" }] }, { path: "other", line: 1, comments: [] }],
comments: [{ body: "c", creationDate: "2026-03-02" }],
commits: [{ message: "First\n\nBody", date: "2026-03-01" }, { message: "Second", date: "2026-03-01" }],
}, fmt: { date: (d) => d.slice(0, 10) } };
const scope = inScope(() => pages.setupPullRequestPage(state));
const [file] = state.prFiles();
expect(file).to.include({ path: "src/a.py", dir: "src/", name: "a.py", threads: 2, id: "diff-1" });
expect(file.lines.find((l) => l.threads)).to.include({ newNo: 2, text: "two" });
expect(file.looseThreads.map((t) => t.line)).to.deep.equal([40]);
expect(state.prStats()).to.deep.equal({ files: 1, additions: 1, deletions: 0 });
expect(state.diffBar(file)).to.deep.equal(["add", "add", "add", "add", "add"]);
expect(state.commitGroups()).to.deep.equal([{ day: "2026-03-01", commits: [
{ message: "First\n\nBody", date: "2026-03-01", index: 1, headline: "First", detail: "Body" },
{ message: "Second", date: "2026-03-01", index: 2, headline: "Second", detail: "" },
] }]);
expect(state.prTimeline().map((i) => i.kind)).to.deep.equal(["comment", "review", "review", "review"]);
state.toggleAllFiles();
expect(state.allCollapsed()).to.equal(true);
scope.stop();
});
it("opens a pull request on its conversation, or on the files without one", () => {
expect(pages.defaultPullRequestTab({ body: "x", diff: "d" })).to.equal("conversation");
expect(pages.defaultPullRequestTab({ diff: "d", comments: [] })).to.equal("files");
expect(pages.defaultPullRequestTab({ commits: [{}] })).to.equal("commits");
});
it("lists gist files with language, lines and nested Markdown headings", () => {
const state = { tabState: { active: "files" }, details: { files: [
{ filename: "NOTES-XXXX-1.md", language: "Markdown", content: "# A\n\n## B\n" },
{ filename: "run.sh", language: "Shell", content: "a\nb\nc\n" },
] } };
const scope = inScope(() => pages.setupGistPage(state));
state.setFileOutline(0, [{ id: "file-1-a", level: 1, depth: 0, parts: [{ t: "A" }] }]);
const toc = state.gistToc();
expect(toc.map((f) => [f.id, f.language, f.lines, f.headings.length])).to.deep.equal([["file-1", "Markdown", 3, 1], ["file-2", "Shell", 3, 0]]);
expect(toc[0].parts).to.deep.equal([{ t: "NOTES-" }, { n: "1" }, { t: ".md" }]);
expect(state.showGistToc()).to.equal(true);
state.activeAnchor = "file-1-a";
expect(state.activeFileIndex()).to.equal(0);
state.details.files.pop();
expect(state.showGistToc()).to.equal(false);
scope.stop();
});
it("chooses the explorer viewer for each gist file and a source language", () => {
const kind = (file) => pages.gistFileKind(file);
expect(kind({ filename: "a.md", content: "# x" })).to.equal("markdown");
expect(kind({ filename: "notes", language: "Markdown", content: "x" })).to.equal("markdown");
expect(kind({ filename: "a.ipynb", content: "{}" })).to.equal("notebook");
expect(kind({ filename: "a.tsv", content: "a\tb" })).to.equal("csv");
expect(kind({ filename: "a.csv", content: "x".repeat(1024 * 1024 + 1) })).to.equal("code");
expect(kind({ filename: "a.svg", content: "<svg/>" })).to.equal("svg");
expect(kind({ filename: "a.py", content: "x" })).to.equal("code");
expect(kind({ filename: "a.png", encoding: "base64", content: "AA==" })).to.equal("image");
expect(kind({ filename: "a.pdf", encoding: "base64", content: "AA==" })).to.equal("pdf");
expect(kind({ filename: "a.webm", encoding: "base64", content: "AA==" })).to.equal("video");
expect(kind({ filename: "a.mp3", encoding: "base64", content: "AA==" })).to.equal("audio");
expect(kind({ filename: "a.bin", encoding: "base64", content: "AA==" })).to.equal("binary");
expect(kind({ filename: "a.png", encoding: "base64", hidden: true })).to.equal("hidden");
expect(kind({ filename: "a.bin", encoding: "base64", tooLarge: true })).to.equal("too-large");
expect(kind({ filename: "a.txt", content: "" })).to.equal("empty");
expect(["markdown", "notebook", "csv", "svg", "code", "image"].map(pages.hasRenderedView)).to.deep.equal([true, true, true, true, false, false]);
expect(pages.gistSourceLanguage({ filename: "a.ipynb" }, "notebook")).to.equal("json");
expect(pages.gistSourceLanguage({ filename: "a.py", language: "Python" }, "code")).to.equal("Python");
});
it("parses quoted CSV cells with the explorer's parser", () => {
expect(formatters.parseDelimited('a,"b ""q"", c"\r\n1,2\n', ",")).to.deep.equal([["a", 'b "q", c'], ["1", "2"]]);
});
});
+153
View File
@@ -2984,6 +2984,159 @@ describe("Vue 3 UI", function () {
expect(ui.app.router.currentRoute.value.path).to.equal("/");
});
it("renders the pull request header, threaded conversation, commits and collapsible files", async function () {
const diff = "diff --git a/src/a.py b/src/a.py\n--- a/src/a.py\n+++ b/src/a.py\n@@ -1,2 +1,3 @@\n one\n+two by XXXX-1\n three\n"
+ "diff --git a/old.sh b/old.sh\ndeleted file mode 100644\n--- a/old.sh\n+++ /dev/null\n@@ -1 +0,0 @@\n-gone\n";
ui = await browser("/pr/pr-1/", {
"/api/pr/pr-1/options": { url: null },
"/api/pr/pr-1/content": {
state: "open", title: "Fix XXXX-1 harness", author: "XXXX-2", baseRef: "main", headRef: "XXXX-2/fix", diff,
comments: [{ author: "XXXX-3", body: "Looks good", creationDate: "2026-03-03" }],
reviewComments: [{ path: "src/a.py", line: 2, comments: [{ author: "XXXX-3", body: "Why?", creationDate: "2026-03-02" }, { author: "XXXX-2", body: "Because", creationDate: "2026-03-04" }] }],
commits: [{ message: "First", author: "XXXX-2", date: "2026-03-01" }],
},
});
await delay(60);
const doc = ui.window.document;
expect(doc.querySelector(".pr-title").textContent.replace(/\s+/g, " ").trim()).to.equal("Fix 1 harness");
expect(doc.querySelectorAll(".pr-title .redact-slot")).to.have.length(1);
// A fully redacted author is one unit: its slot, without a stray "@".
const author = doc.querySelector(".pr-summary .pr-author");
expect(author.classList.contains("is-redacted")).to.equal(true);
expect(author.textContent.trim()).to.equal("2");
expect(doc.querySelector(".pr-state").textContent.trim()).to.equal("Open");
expect(doc.querySelector(".pr-summary").textContent.replace(/\s+/g, " ")).to.include("wants to merge 1 commit into main from 2/fix");
const tabs = [...doc.querySelectorAll(".pr-tabs [role=tab]")].map((t) => t.textContent.replace(/\s+/g, " ").trim());
expect(tabs).to.deep.equal(["Conversation2", "Commits1", "Files changed2"]);
expect(doc.querySelector(".pr-tabs [aria-selected=true]").id).to.equal("pr-conversation-tab");
expect(doc.querySelectorAll(".pr-timeline-item")).to.have.length(3);
expect(doc.querySelectorAll(".pr-timeline-item.is-review .pr-thread-comment.is-reply")).to.have.length(1);
doc.querySelector("#pr-commits-tab").click(); await delay(20);
expect(doc.querySelector(".pr-commit-headline").textContent).to.equal("First");
doc.querySelector("#pr-files-tab").click(); await delay(20);
const blocks = doc.querySelectorAll(".diff-file-block");
expect(blocks).to.have.length(2);
expect(doc.querySelectorAll(".pr-file-toc .toc-diff-file")).to.have.length(2);
expect(blocks[0].querySelector(".diff-file-stat").textContent).to.include("+1");
expect(blocks[0].querySelectorAll(".diff-thread-row")).to.have.length(1);
expect(blocks[0].querySelector(".diff-row-add .redact-slot")).to.not.equal(null);
// The thread sits in the code column; its comments share one container.
const threadRow = blocks[0].querySelector(".diff-thread-row");
expect(threadRow.querySelector(".diff-thread-gutter").getAttribute("colspan")).to.equal("3");
expect(threadRow.querySelectorAll(".diff-thread-cell > .pr-thread > .pr-thread-comment")).to.have.length(2);
expect(threadRow.querySelectorAll(".pr-thread .pr-thread")).to.have.length(0);
expect(blocks[1].querySelector(".diff-file-status").textContent).to.equal("deleted");
blocks[0].querySelector(".diff-file-toggle").click(); await delay(20);
expect(blocks[0].querySelector(".diff-file-body")).to.equal(null);
expect(blocks[0].querySelector(".diff-file-toggle").getAttribute("aria-expanded")).to.equal("false");
expect(ui.errors).to.deep.equal([]);
});
it("outlines a gist's files on the files tab", async function () {
ui = await browser("/gist/g-1/", {
"/api/gist/g-1/options": { url: null },
"/api/gist/g-1/content": { description: "Notes", files: [
{ filename: "a-XXXX-1.py", language: "Python", content: "x = 1\ny = 2\n" },
{ filename: "b.json", language: "JSON", content: "{}\n" },
] },
});
await delay(60);
const doc = ui.window.document;
const items = [...doc.querySelectorAll(".page-toc .toc-file")];
expect(items.map((a) => a.getAttribute("href"))).to.deep.equal(["#file-1", "#file-2"]);
expect(items[0].querySelector(".toc-file-meta").textContent).to.equal("Python · 2 lines");
expect(items[0].querySelector(".redact-slot")).to.not.equal(null);
expect(items[0].classList.contains("is-active")).to.equal(true);
expect(doc.querySelectorAll(".gist-file-card")).to.have.length(2);
expect(doc.getElementById("file-2")).to.not.equal(null);
expect(ui.errors).to.deep.equal([]);
});
it("outlines Markdown h1-h3 with redaction slots and hides short outlines", async function () {
const doc = "# Guide\n\nIntro.\n\n## Setup\n\nText.\n\n### Data\n\nText.\n\n## Results from XXXX-2\n\nText.\n";
ui = await browser("/r/test/GUIDE.md", {
"/api/repo/test/files/": [{ name: "GUIDE.md", path: "", sha: "1", size: 80 }, { name: "SHORT.md", path: "", sha: "2", size: 20 }],
"/api/repo/test/file/GUIDE.md": doc,
"/api/repo/test/file/SHORT.md": "# Short\n\n## Only\n",
});
await delay(150);
const document = ui.window.document;
const rail = [...document.querySelectorAll(".readme-toc .toc-rail a")];
expect(rail.map((a) => a.textContent.trim())).to.deep.equal(["Guide", "Setup", "Data", "Results from 2"]);
expect(rail.map((a) => a.className.match(/lvl-\d/)[0])).to.deep.equal(["lvl-2", "lvl-2", "lvl-3", "lvl-2"]);
expect(rail[3].querySelector(".redact-slot")).to.not.equal(null);
expect(rail[1].getAttribute("href")).to.equal("#" + document.querySelector(".markdown-body h2").id);
expect(document.querySelectorAll(".tb-toc-menu, .tb-toc-m")).to.have.length(1);
await ui.go("/r/test/SHORT.md");
await delay(150);
expect(document.querySelector(".readme-toc")).to.equal(null);
expect(document.querySelector(".tb-toc-m")).to.equal(null);
expect(ui.errors).to.deep.equal([]);
});
it("renders each gist format with the explorer's viewers and toggles a file's source", async function () {
const png = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
const files = [
{ filename: "README.md", language: "Markdown", content: "# Notes by XXXX-1\n\nText.\n" },
{ filename: "data.csv", content: "name,score\nXXXX-2,3\nb,4\n" },
{ filename: "run.ipynb", content: JSON.stringify({ nbformat: 4, nbformat_minor: 5, metadata: {}, cells: [{ cell_type: "markdown", metadata: {}, source: ["# Cell"] }] }) },
{ filename: "plot.svg", content: "<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'/>" },
{ filename: "train.py", language: "Python", content: "print(1)\n" },
{ filename: "fig.png", encoding: "base64", size: 70, content: png },
// The API never sends bytes for binaries other than images.
{ filename: "talk.mp4", encoding: "base64", size: 4 },
{ filename: "beep.wav", encoding: "base64", size: 4 },
{ filename: "model.bin", encoding: "base64", size: 4 },
{ filename: "big.parquet", encoding: "base64", size: 400000000, tooLarge: true },
{ filename: "photo.jpg", encoding: "base64", size: 10, hidden: true },
{ filename: "empty.txt", content: "" },
];
let blobs = 0;
ui = await browser("/gist/g-2/", { "/api/gist/g-2/options": { url: null }, "/api/gist/g-2/content": { description: "Formats", files } });
ui.window.URL.createObjectURL = () => "blob:http://localhost/" + (++blobs);
ui.window.URL.revokeObjectURL = () => {};
const copied = [];
Object.defineProperty(ui.window.navigator, "clipboard", { value: { writeText: async (text) => copied.push(text) }, configurable: true });
await ui.go("/faq"); await ui.go("/gist/g-2/");
await delay(150);
const doc = ui.window.document;
const body = (i) => doc.querySelectorAll(".gist-file-card")[i].querySelector(".gist-file-body");
expect(body(0).querySelector("markdown.markdown-body h1")).to.not.equal(null);
expect(body(1).querySelectorAll(".csv-table tbody tr")).to.have.length(2);
expect(body(1).querySelector(".csv-table tbody .redact-slot")).to.not.equal(null);
expect(body(2).querySelector("notebook")).to.not.equal(null);
expect(body(3).querySelector("img.image-content").getAttribute("src")).to.match(/^blob:/);
expect(body(4).querySelector("pre code")).to.not.equal(null);
expect(body(5).querySelector("img.image-content")).to.not.equal(null);
for (const i of [6, 7, 8]) {
expect(body(i).querySelector(".file-state-title").textContent).to.equal("This file isn't shared");
expect(body(i).querySelector("a[download]")).to.equal(null);
expect(doc.querySelectorAll(".gist-file-card")[i].querySelector(".gist-file-actions")).to.equal(null);
}
expect(body(9).querySelector(".file-state-title").textContent).to.equal("This file is too large to preview");
expect(body(10).querySelector(".file-state-title").textContent).to.equal("Image not shown");
expect(body(11).querySelector(".file-state-title").textContent).to.equal("This file is empty");
// Preview/Source only where the two differ; Raw and copy on every readable file.
const toggles = [...doc.querySelectorAll(".gist-file-card")].map((card) => !!card.querySelector(".gist-view-toggle"));
expect(toggles).to.deep.equal([true, true, true, true, false, false, false, false, false, false, false, false]);
const card = doc.querySelectorAll(".gist-file-card")[0];
expect(card.querySelector(".gist-file-actions a[target=_blank]").getAttribute("href")).to.match(/^blob:/);
card.querySelector(".gist-file-actions button").click(); await delay(20);
expect(copied).to.deep.equal([files[0].content]);
const [preview, source] = card.querySelectorAll(".gist-view-toggle .seg-chip");
source.click(); await delay(60);
expect(source.getAttribute("aria-checked")).to.equal("true");
expect(body(0).querySelector("markdown")).to.equal(null);
expect(body(0).querySelector("pre code").textContent).to.equal(files[0].content);
expect(doc.querySelector(".page-toc .toc-heading")).to.equal(null);
preview.click(); await delay(60);
expect(body(0).querySelector("markdown h1")).to.not.equal(null);
doc.querySelectorAll(".gist-file-card")[1].querySelectorAll(".gist-view-toggle .seg-chip")[1].click(); await delay(40);
expect(body(1).querySelector(".csv-table")).to.equal(null);
expect(body(1).querySelector("pre code").textContent).to.equal(files[1].content);
expect(ui.errors).to.deep.equal([]);
});
describe("workspace polish (r19)", () => {
it("keeps the dashboard tabs and counts rendered while a tab reloads", async () => {
const item = (repoId, status) => ({ _type: "repo", repoId, status, source: { fullName: "owner/" + repoId }, options: {} });