Merge pull request #992 from tdurieux/feat/admin-errors-ux

feat(admin): errors page built around issues, linked to repositories and users
This commit is contained in:
Thomas Durieux authored and GitHub committed 2026-11-29 08:46:53 -08:00
commit 351ed12b28
21 files changed
+2180 -2326

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
{
"core.min.js": "core.d23af1c652.min.js",
"vendor.min.js": "vendor.5b10aef44d.min.js",
"vendor.min.js": "vendor.723e6ba548.min.js",
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
"all.min.css": "all.062d856a9f.min.css",
"all.min.css": "all.65e547042d.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
+307 -912
View File
File diff suppressed because it is too large. Load diff
+25
View File
@@ -0,0 +1,25 @@
<section class="errs-entity" aria-labelledby="errs-entity-title" :aria-busy="entityErrors.loading ? 'true' : 'false'" v-if="entityErrors.key">
<div class="errs-entity-banner" role="status" v-if="entityFailingNow().length">
<span class="errs-now">Failing now</span>
<span>{{ errPlural(entityFailingNow().reduce((sum, issue) => sum + issue.count, 0), 'failure') }} in the last 24 h, the latest {{ errRelTime(entityFailingNow()[0].last) }}: <a :href="errIssueHref(entityFailingNow()[0].id)">{{ entityFailingNow()[0].title }}</a><template v-if="entityFailingNow().length &gt; 1"> and {{ entityFailingNow().length - 1 }} more</template>.</span>
</div>
<div class="errs-card-head"><h2 id="errs-entity-title">Errors <span class="errs-count" v-if="entityIssues().length">{{ entityIssues().length }}</span></h2></div>
<p class="errs-muted" role="status" v-if="entityErrors.loading">Loading errors…</p>
<p class="errs-muted" role="status" v-else-if="entityErrors.failed">Could not load errors. <button type="button" class="errs-link-button" @click="loadEntityErrors(true)">Retry</button></p>
<template v-else-if="entityErrors.data">
<ul class="errs-entity-list" v-if="entityIssues().length || entityExpected().length">
<li v-for="issue in entityIssues()" :key="issue.id">
<span class="errs-entity-main"><a :href="errIssueHref(issue.id)">{{ issue.title }}</a><span class="errs-muted"><code>{{ issue.code }}</code><template v-if="issue.route"> · {{ issue.method }} {{ issue.route }}<template v-if="issue.routeCount &gt; 1"> +{{ issue.routeCount - 1 }}</template></template><template v-else-if="issue.queue"> · job {{ issue.queue }}</template></span></span>
<span class="errs-entity-count">{{ errNumber(issue.count) }}</span>
<time :datetime="issue.last" :title="errDayTime(issue.last)">{{ issue.failingNow ? 'now' : errRelTime(issue.last) }}</time>
</li>
<li v-for="entry in entityExpected().slice(0, 5)" :key="'x' + entry.code + entry.status" class="is-expected">
<span class="errs-entity-main"><span><code>{{ entry.code }}</code> <span class="errs-tag">expected</span></span><span class="errs-muted">HTTP {{ entry.status || '—' }}</span></span>
<span class="errs-entity-count">{{ errNumber(entry.count) }}</span>
<time :datetime="entry.last">{{ errRelTime(entry.last) }}</time>
</li>
</ul>
<p class="errs-muted" v-else>No errors recorded in the last 24 h.</p>
<p class="errs-muted errs-entity-source">{{ entityErrors.data.source === 'central' ? 'From central logs' : 'From application history' }} · last 24 h · <a :href="'/admin/errors?q=' + (entityErrors.data.filters?.repoId ? 'repo:' + entityErrors.data.filters.repoId : 'user:' + (entityErrors.data.filters?.userId || ''))">Open in Errors</a></p>
</template>
</section>
+309 -297
View File
@@ -1,6 +1,17 @@
<div class="container paper-page admin-page overview-page errors-page">
<header class="page-head"><div class="paper-crumbs"><a href="/admin/">Admin</a> &nbsp;/&nbsp; <span class="here">Errors</span></div><div class="ov-header page-head-main"><h1 class="paper-page-title">Errors</h1></div></header>
<nav class="admin-nav">
<div class="container paper-page admin-page errs-page" :class="'errs-view-' + errView">
<header class="page-head">
<nav class="paper-crumbs" aria-label="Breadcrumb">
<a href="/admin/">Admin</a> &nbsp;/&nbsp;
<span class="here" v-if="errView === 'list'">Errors</span>
<template v-else>
<a href="/admin/errors">Errors</a> &nbsp;/&nbsp;
<span class="here" v-if="errView === 'issue'">{{ selectedIssue?.code || 'Issue' }}</span>
<template v-else><a :href="errIssueHref(selectedIssue?.id)">{{ selectedIssue?.code }}</a> &nbsp;/&nbsp; <span class="here">{{ traceKind() === 'job' ? 'job' : 'request' }} {{ currentOccurrence()?.requestId ? currentOccurrence().requestId.slice(0, 4) + '…' + currentOccurrence().requestId.slice(-4) : '#' + (occurrenceIndex + 1) }}</span></template>
</template>
</nav>
<div class="ov-header page-head-main" v-if="errView === 'list'"><h1 class="paper-page-title">Errors</h1></div>
</header>
<nav class="admin-nav" v-if="errView === 'list'">
<a href="/admin/"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-chart"></use></svg> Overview</a>
<a href="/admin/repositories"><svg class="ui-icon" aria-hidden="true"><use href="#project-type-repo"></use></svg> Repositories</a>
<a href="/admin/users"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-users"></use></svg> Users</a>
@@ -11,327 +22,328 @@
<a href="/admin/errors" class="active" aria-current="page"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-bug"></use></svg> Errors</a>
</nav>
<div class="error-source-toolbar">
<div class="error-source-switch seg-filter" role="group" aria-label="Log source">
<button id="error-source-central" type="button" class="seg-chip" :class="{active:errorSource==='central'}" :aria-pressed="errorSource==='central'" @click="errorSource='central'">Central logs</button>
<button id="error-source-history" type="button" class="seg-chip" :class="{active:errorSource==='history'}" :aria-pressed="errorSource==='history'" @click="errorSource='history'">Application history</button>
</div>
<div class="error-health-strip">
<p class="log-state" role="status" aria-live="polite">{{ errorSource === 'history' ? (redisLoading ? 'Loading application history…' : available === null ? 'Checking Redis…' : available ? 'Redis history is reachable.' : 'Redis history is unavailable. Previously loaded rows may be stale.') : logFailure || (logLoading ? 'Loading central logs…' : logSnapshotStale ? 'This snapshot is stale. Refresh before assessing current health.' : logStateText(logData?.state)) }}</p>
<button type="button" class="btn btn-sm" :disabled="errorSource === 'central' ? logLoading : redisLoading" @click="errorSource === 'central' ? refreshLogs() : refreshNow()">{{ (errorSource === 'central' ? logLoading : redisLoading) ? 'Refreshing…' : 'Refresh' }}<span class="sr-only">{{ errorSource === 'central' ? ' central logs' : ' history' }}</span></button>
<button v-if="errorSource === 'central' &amp;&amp; (logFailure || ['disabled','misconfigured','unreachable','busy'].includes(logData?.state))" type="button" class="btn btn-sm" @click="errorSource = 'history'">Open application history</button>
</div>
</div>
<section v-show="errorSource==='central'" class="log-investigation" aria-labelledby="central-logs-title" :aria-busy="logLoading">
<div class="volume-head"><h2 class="sr-only" id="central-logs-title">Central logs</h2><a v-if="logData?.grafanaUrl" :href="safeUrl(logData.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a></div>
<section class="log-inspector" v-if="selectedLog" aria-labelledby="log-detail-title">
<button type="button" class="log-back" @click="closeLogDetail()"><span aria-hidden="true">←</span> Back to events</button>
<div class="log-inspector-heading"><div><p class="log-inspector-eyebrow">{{ selectedLog.sample.service }} / {{ selectedLog.sample.module }} · Event sample</p><h2 id="log-detail-title" tabindex="-1">{{ selectedLog.sample.errorCode || selectedLog.sample.errorType || selectedLog.sample.event }}</h2></div><span class="log-severity" :class="'log-severity-'+logSeverity(selectedLog.sample)">{{ logSeverity(selectedLog.sample)==='error' ? 'Failure' : logSeverity(selectedLog.sample)==='warn' ? 'Warning' : 'Info' }}<span v-if="selectedLog.sample.status || selectedLog.sample.httpStatus"> · HTTP {{ selectedLog.sample.status || selectedLog.sample.httpStatus }}</span></span></div>
<div class="log-facts-strip"><span><strong>{{ selectedLog.count }}</strong> returned occurrences</span><span>First <time :datetime="selectedLog.first">{{ absTimeShort(selectedLog.first) }}</time></span><span>Last <time :datetime="selectedLog.last">{{ absTimeShort(selectedLog.last) }}</time></span></div>
<div class="log-detail log-investigation-body" id="log-detail">
<div class="log-related-main"><div class="log-correlation-selector" role="group" aria-label="Related events correlation"><span>Follow</span><button type="button" class="log-trace-button" v-for="kind in ['requestId','jobId'].filter(key=>logTraceId(selectedLog,key))" :key="kind" :id="'trace-selector-'+kind" :aria-label="'Follow '+(kind==='requestId' ? 'request ' : 'job ')+selectedLog.sample[kind]" :aria-pressed="traceSelection?.kind===kind" @click="lookupTrace(kind,selectedLog.sample[kind],$event.currentTarget,selectedLog.sample)">{{ kind==='requestId' ? 'Request' : 'Job' }} <span class="log-selector-mark" aria-hidden="true">{{ traceSelection?.kind===kind ? '✓' : '→' }}</span></button><span class="log-meta" v-if="!logTraceId(selectedLog,'requestId') &amp;&amp; !logTraceId(selectedLog,'jobId')">No correlation ID recorded</span><span class="log-correlation-window">{{ logData?.window || logAppliedFilters.window }} window</span></div>
<section class="log-timeline" v-if="traceSelection" aria-labelledby="log-timeline-title" :aria-busy="traceLoading">
<div class="volume-head"><h3 id="log-timeline-title" tabindex="-1">Related events</h3><button type="button" class="btn btn-sm" @click="closeTrace()">Hide events</button></div>
<p role="status" v-if="traceLoading || trace?.state !== 'ready'">{{ traceLoading ? 'Loading related events…' : trace?.state === 'empty' ? 'No related events returned in this window.' : logStateText(trace?.state) }}</p>
<p class="log-coverage" v-if="trace &amp;&amp; !traceLoading">{{ trace.events?.length || 0 }} events returned · {{ absTime(trace.start) }} – {{ absTime(trace.end) }} · 200-event cap. All services and releases.</p>
<ol class="log-events" v-if="trace?.events?.length"><li v-for="(event,index) in trace.events" :key="index"><time :datetime="event.timestamp" :title="event.timestamp">{{ absTimeShort(event.timestamp) }}</time><div class="log-timeline-event"><div class="log-timeline-event-title"><strong>{{ event.errorCode || event.errorType || event.event }}</strong><span class="log-severity" :class="'log-severity-'+logSeverity(event)">{{ (event.status || event.httpStatus) ? 'HTTP '+(event.status || event.httpStatus) : event.severity || 'Event' }}</span></div><p>{{ event.service }}<span v-if="event.module"> / {{ event.module }}</span><span v-if="event.ms !== undefined"> · {{ event.ms }} ms</span><span v-if="event.attempt !== undefined"> · attempt {{ event.attempt }}</span></p><p class="log-request-route" v-if="event.route"><code>{{ event.method }} {{ event.requestPath || event.route }}</code></p><details class="log-error-stack" v-if="event.errorStack || event.causeStack"><summary>Exception frames<span v-if="event.errorType"> · {{ event.errorType }}</span></summary><pre v-if="event.errorStack">{{ event.errorStack }}</pre><p v-if="event.causeType">Caused by {{ event.causeType }}</p><pre v-if="event.causeStack">{{ event.causeStack }}</pre></details><details class="log-event-fields"><summary>Event fields</summary><pre>{{ JSON.stringify(event,null,2) }}</pre><button type="button" class="btn btn-sm" @click="copyLogValue(JSON.stringify(event,null,2))">Copy JSON</button></details></div></li></ol>
<details class="log-timeline-scope"><summary>Query scope</summary><p>Earliest matching events for the selected {{ traceSelection.kind==='jobId' ? 'job' : 'request' }} ID. Service and release filters do not narrow this timeline.</p></details>
<a v-if="trace?.grafanaUrl" :href="safeUrl(trace.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a>
</section>
<div class="log-no-trace" v-if="!traceSelection"><h3>{{ logTraceId(selectedLog,'requestId') || logTraceId(selectedLog,'jobId') ? 'Related events hidden' : 'This sample has no correlation ID' }}</h3><p>{{ logExplanation(selectedLog.sample) }}</p><p class="log-evidence">{{ logEvidence(selectedLog.sample) }}</p><p class="log-coverage">{{ logTraceId(selectedLog,'requestId') || logTraceId(selectedLog,'jobId') ? 'Choose Request or Job above to load related events.' : 'The recorded fields are available in the sample panel. Related events cannot be looked up for this record.' }}</p></div>
</div>
<aside class="log-sample-panel"><h3>Event sample</h3><p class="log-coverage">One of {{ selectedLog.count }} returned occurrences. IDs can differ across the group.</p><p class="log-request-route" v-if="selectedLog.sample.route"><code>{{ selectedLog.sample.method }} {{ selectedLog.sample.route }}</code></p><section class="log-reproduction" v-if="selectedLog.sample.requestPath"><h3>Reproduce this request</h3><dl><div><dt>Anonymous repository ID</dt><dd><code>{{ selectedLog.sample.repoId }}</code></dd></div><div><dt>Request path · query excluded</dt><dd><code>{{ selectedLog.sample.requestPath }}</code></dd></div></dl><button type="button" class="btn btn-sm" @click="copyLogValue(selectedLog.sample.requestPath)">Copy request path</button></section><details class="log-error-stack" v-if="selectedLog.sample.errorStack || selectedLog.sample.causeStack"><summary>Exception frames · {{ selectedLog.sample.errorType }}</summary><pre v-if="selectedLog.sample.errorStack">{{ selectedLog.sample.errorStack }}</pre><p v-if="selectedLog.sample.causeType">Caused by {{ selectedLog.sample.causeType }}</p><pre v-if="selectedLog.sample.causeStack">{{ selectedLog.sample.causeStack }}</pre></details><dl class="log-sample-facts"><div v-if="selectedLog.sample.repoId"><dt>Repository</dt><dd><a :href="safeUrl('/admin/repositories?search=' + selectedLog.sample.repoId)">{{ selectedLog.sample.repoId }}</a></dd></div><div v-if="selectedLog.sample.pullRequestId"><dt>Pull request</dt><dd><code>{{ selectedLog.sample.pullRequestId }}</code></dd></div><div v-if="selectedLog.sample.gistId"><dt>Gist</dt><dd><code>{{ selectedLog.sample.gistId }}</code></dd></div><div v-if="selectedLog.sample.userId"><dt>User</dt><dd><a :href="safeUrl('/admin/users/' + selectedLog.sample.userId)">{{ selectedLog.sample.userId }}</a></dd></div><div v-if="selectedLog.sample.viewer"><dt>Viewer</dt><dd>{{ selectedLog.sample.viewer }}</dd></div><div><dt>Service</dt><dd>{{ selectedLog.sample.service }}</dd></div><div><dt>Module</dt><dd>{{ selectedLog.sample.module || 'Not recorded' }}</dd></div><div><dt>Event</dt><dd>{{ selectedLog.sample.event }}</dd></div><div v-if="selectedLog.sample.release"><dt>Release</dt><dd>{{ selectedLog.sample.release }}</dd></div></dl>
<dl class="log-detail-identifiers"><template v-for="kind in ['requestId','jobId']" :key="kind"><div v-if="logTraceId(selectedLog,kind)"><dt>{{ kind==='requestId' ? 'Request ID' : 'Job ID' }}</dt><dd><details class="log-value-reveal"><summary>{{ compactLogValue(selectedLog.sample[kind]) }}</summary><span>{{ selectedLog.sample[kind] }}</span></details><button type="button" class="log-copy-value" @click="copyLogValue(selectedLog.sample[kind])">Copy full ID</button></dd></div></template></dl>
<details class="log-all-fields"><summary>All sample fields <span>{{ Object.keys(selectedLog.sample).length }}</span></summary><p class="log-coverage">Admin API fields only. Failed file requests may include their anonymous repository ID and pathname. Query strings are excluded; exception frames include recognized application code only.</p><dl><div v-for="(value,key) in selectedLog.sample" :key="key" v-show="!['requestId','jobId'].includes(key)"><dt>{{ key }}</dt><dd>{{ value }}</dd></div></dl><details class="log-raw-sample"><summary>Raw sample</summary><pre>{{ JSON.stringify(selectedLog.sample,null,2) }}</pre><button class="btn btn-sm" type="button" @click="copyLogValue(JSON.stringify(selectedLog.sample,null,2))">Copy JSON</button></details></details></aside>
<p class="sr-only" role="status" aria-live="polite">{{ issueLoading ? 'Loading errors…' : traceLoading ? 'Loading the request timeline…' : '' }}</p>
<p class="errs-copy-status" role="status" aria-live="polite">{{ copyStatus }}</p>
<!-- ===== 1. Issue list ===== -->
<section class="errs-list" v-show="errView === 'list'" aria-labelledby="errs-list-title" :aria-busy="issueLoading ? 'true' : 'false'">
<h2 class="sr-only" id="errs-list-title">Issues</h2>
<div class="errs-summary" v-if="issueData &amp;&amp; !issueFailure">
<div class="errs-stat" :class="{ 'is-alert': issueData.summary.failingNow }"><strong>{{ errNumber(issueData.summary.failingNow) }}</strong><span>{{ issueData.summary.failingNow === 1 ? 'Issue' : 'Issues' }} failing now (last 15 min)</span></div>
<div class="errs-stat"><strong>{{ errNumber(issueData.summary.failedRecords) }}</strong><span>Failures · {{ windowLabels[issueData.window] }}</span></div>
<div class="errs-stat"><strong v-if="issueData.summary.repositories || issueData.summary.users">{{ errNumber(issueData.summary.repositories) }} <small>{{ issueData.summary.repositories === 1 ? 'repo' : 'repos' }}</small> · {{ errNumber(issueData.summary.users) }} <small>{{ issueData.summary.users === 1 ? 'user' : 'users' }}</small></strong><strong class="errs-not-recorded" v-else>not recorded</strong><span>Affected · {{ windowLabels[issueData.window] }}</span></div>
<div class="errs-stat" :class="{ 'is-upstream': issueData.summary.upstreamShare }"><strong>{{ issueData.summary.upstreamShare }}%</strong><span>Caused by GitHub or storage</span></div>
</div>
<form class="errs-toolbar" role="search" aria-label="Filter issues" @submit.prevent="applyFilters()">
<div class="search-wrap errs-search">
<svg class="ui-icon search-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg>
<input id="errs-search" type="search" class="form-control" v-model="issueSearch" aria-label="Search issues" placeholder="Search code, route… or repo:&lt;id&gt; user:&lt;id&gt;" autocomplete="off" spellcheck="false">
</div>
</section>
<div class="log-list-view" v-show="!selectedLog">
<details class="log-query"><summary>Window: {{ logAppliedFilters.window }} · {{ logAppliedFilters.service || 'All services' }}<span v-if="logAppliedFilters.release"> · {{ logAppliedFilters.release }}</span><span class="log-query-hint">Time &amp; service</span></summary> <form class="errors-toolbar log-filters" @submit.prevent="refreshLogs()">
<label>Time window
<select class="form-control" v-model="logFilters.window" id="log-window">
<label class="errs-select"><span class="sr-only">Time window</span>
<select class="form-control" id="errs-window" v-model="issueFilters.window">
<option value="15m">Last 15 minutes</option><option value="1h">Last hour</option><option value="6h">Last 6 hours</option><option value="24h">Last 24 hours</option>
</select>
</label>
<label>Service
<select class="form-control" v-model="logFilters.service" id="log-service">
<label class="errs-select"><span class="sr-only">Service</span>
<select class="form-control" id="errs-service" v-model="issueFilters.service">
<option value="">All services</option><option value="api">API</option><option value="streamer">Streamer</option><option value="worker">Worker</option><option value="nginx">Nginx</option><option value="mongodb">MongoDB</option><option value="redis">Redis</option><option value="backup">Backup</option>
</select>
</label>
<label>Release SHA
<input class="form-control" id="log-release" v-model="logFilters.release" maxlength="40" placeholder="All releases" pattern="[a-f0-9]{7,40}|unknown" autocomplete="off">
</label>
<button class="btn btn-sm" type="submit" :disabled="logLoading">{{ logLoading ? 'Loading…' : 'Refresh logs' }}</button>
</form>
<p class="log-coverage" v-if="logData?.captured !== undefined">{{ logData.captured }} records returned · 1,000-record cap · {{ absTime(logData.start) }} to {{ absTime(logData.end) }}</p>
</details>
<div class="log-local-filters">
<label class="log-search">Search returned groups<input class="form-control" type="search" v-model="logView.search" placeholder="Event, service, code or sample ID"></label>
<label>Severity<select class="form-control" v-model="logView.severity"><option value="">All severities</option><option value="error">Failure / HTTP 5xx</option><option value="warn">Warning</option><option value="info">Info</option></select></label>
<label>Sort<select class="form-control" v-model="logView.sort"><option value="recent">Most recent</option><option value="count">Most frequent</option></select></label>
</div>
<p class="log-coverage" role="status" title="Counts and first/last dates apply only to returned records, not all matching events.">{{ filteredLogGroups().length }} of {{ logData?.groups?.length || 0 }} returned groups · {{ logData?.captured ?? 0 }} records · 1,000-record cap.</p>
<div class="log-loading" v-if="logLoading">Loading event groups…</div>
<div class="log-workspace" v-else>
<div class="log-results">
<div class="log-table-scroll" v-if="filteredLogGroups().length"><table class="log-table" role="table">
<caption class="sr-only">Returned events grouped by service, module, code, severity and status. Select an event for sample details.</caption>
<thead><tr><th scope="col">Event</th><th scope="col">Severity</th><th scope="col">Count</th><th scope="col">Last seen</th></tr></thead>
<tbody><template v-for="group in filteredLogGroups()" :key="group.fingerprint"><tr :class="{'log-selected':selectedLog?.fingerprint===group.fingerprint}">
<td><button class="log-event-button" type="button" :aria-label="'Inspect ' + (group.sample.errorCode || group.sample.errorType || group.sample.event)" @click="selectLog(group, $event.currentTarget)" :aria-expanded="selectedLog?.fingerprint===group.fingerprint" aria-controls="log-detail"><span class="log-event-title"><strong>{{ group.sample.errorCode || group.sample.errorType || group.sample.event }}</strong><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-arrow-right"></use></svg></span><span class="log-meta"><span class="log-service">{{ group.sample.service }}</span><span class="log-module"> / {{ group.sample.module }}</span></span></button></td>
<td class="log-level"><span class="log-severity" :class="'log-severity-'+logSeverity(group.sample)">{{ logSeverity(group.sample)==='error' ? 'Failure' : logSeverity(group.sample)==='warn' ? 'Warning' : 'Info' }}</span><span class="log-http" v-if="group.sample.status || group.sample.httpStatus">HTTP {{ group.sample.status || group.sample.httpStatus }}</span></td>
<td class="log-count"><span class="sr-only">Count </span>{{ group.count }}</td>
<td><time :datetime="group.last" :title="absTime(group.last)">{{ relTime(group.last) }}</time></td>
<p class="errs-search-hint" id="errs-search-hint" v-if="searchFilters().invalid || issueData?.filters?.repoId || issueData?.filters?.userId"><template v-if="searchFilters().invalid">“{{ searchFilters().invalid }}” is not a repository ID or a 24-character user ID.</template><template v-else-if="issueData?.filters?.repoId || issueData?.filters?.userId">Showing records for <a v-if="issueData.filters.repoId" :href="errRepoHref(issueData.filters.repoId)">repository {{ issueData.filters.repoId }}</a><template v-if="issueData.filters.repoId &amp;&amp; issueData.filters.userId"> and </template><a v-if="issueData.filters.userId" :href="errUserHref(issueData.filters.userId)">user {{ userName(issueData.filters.userId) || issueData.filters.userId }}</a>.</template></p>
</tr>
</template></tbody>
</table></div>
<div class="admin-empty" v-else-if="logData?.groups?.length">No returned groups match these filters. <button class="btn btn-sm" @click="logView.search='';logView.severity=''">Reset filters</button></div>
<div class="admin-empty" v-else>{{ logData?.state==='empty' ? 'No warnings, errors or HTTP 5xx returned in this window.' : 'No central events available. Refresh logs or open Application history.' }}</div>
</div>
</div>
<details class="log-health" v-if="logData?.telemetry">
<summary>Telemetry details <span>90 seconds before last check</span></summary>
<p v-if="logData.telemetry.missing?.length">Missing or stale: {{ logData.telemetry.missing.join(', ') }}. Expected one API, four streamers and three queues.</p>
<p v-else>Expected API, streamer and queue heartbeats were present at the last check.</p>
<p v-if="logData.telemetry.partial">Telemetry coverage is partial; absence and drop totals may be incomplete.</p>
<p>Collector: {{ logData.telemetry.collector.state }} · dropped events since collector start: {{ logData.telemetry.collector.dropped ?? 'unknown' }}. Intentional filtering is excluded.</p>
<details>
<summary>Application drop counters and last telemetry</summary>
<ul><li v-for="(instance, i) in logData.telemetry.instances" :key="i">{{ instance.service }} · {{ instance.instance || 'unknown instance' }} · {{ instance.dropped ?? 'unknown' }} dropped since process start · last seen {{ absTime(instance.last) }}</li></ul>
</details>
</details>
</div>
</section>
<p class="log-copy-status" role="status" v-if="logCopyStatus">{{ logCopyStatus }}</p>
<section v-show="errorSource==='history'" class="history-source" :aria-busy="redisLoading">
<h2 class="sr-only">Application history</h2>
<p class="history-warning" role="status" v-if="redisCollecting !== true">{{ redisCollecting === false ? 'Collection is off; retained history is not receiving new events.' : 'Collection status is unknown.' }}</p>
<div class="log-inspector" v-if="historySelected"><button type="button" class="log-back" @click="closeHistory()">← Back to history</button><div class="log-inspector-heading"><div><p class="log-inspector-eyebrow">{{ historySelected.module }} · Application history</p><h2 id="history-inspector-title" tabindex="-1">{{ historySelected.displayMessage }}</h2></div><span class="log-severity" :class="'log-severity-'+historySelected._bucket">{{ historySelected._bucket }}<span v-if="historySelected._status"> · HTTP {{ historySelected._status }}</span></span></div><div class="log-inspector-tabs detail-tabs" role="group" aria-label="History event view"><button type="button" :aria-pressed="historyView==='overview' &amp;&amp; (!detailTab[historySelected._key] || detailTab[historySelected._key]==='summary')" :class="{active:historyView==='overview' &amp;&amp; (!detailTab[historySelected._key] || detailTab[historySelected._key]==='summary')}" @click="historyView='overview';detailTab[historySelected._key]='summary'">Overview</button><button type="button" :aria-pressed="historyView==='timeline'" :class="{active:historyView==='timeline'}" @click="showHistoryTimeline($event.currentTarget)">Timeline</button><button type="button" :aria-pressed="historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='raw'" :class="{active:historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='raw'}" @click="historyView='overview';detailTab[historySelected._key]='raw'">Raw</button><button type="button" v-if="historySelected._stack" :aria-pressed="historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='stack'" :class="{active:historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='stack'}" @click="historyView='overview';detailTab[historySelected._key]='stack'">Stack</button><button type="button" v-if="historySelected.count>1" :aria-pressed="historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='related'" :class="{active:historyView==='overview' &amp;&amp; detailTab[historySelected._key]==='related'}" @click="historyView='overview';detailTab[historySelected._key]='related'">Occurrences ({{ historySelected.count }})</button></div></div>
<div v-show="!historySelected">
<form class="errors-toolbar" aria-label="Error filters" v-form="viewState">
<div class="seg-filter" role="group" aria-label="Filter by severity">
<button type="button" class="seg-chip" :class="{ active: (query?.bucket || '') === '' }" :aria-pressed="(query?.bucket || '') === ''" @click="setBucket('')">All </button>
<button type="button" class="seg-chip" :class="{ active: (query?.bucket || '') === 'error', 'is-empty': !(stats?.severity?.error) }" :aria-pressed="(query?.bucket || '') === 'error'" @click="setBucket('error')"><span class="seg-dot bad" aria-hidden="true"></span>Error </button>
<button type="button" class="seg-chip" :class="{ active: (query?.bucket || '') === 'warn', 'is-empty': !(stats?.severity?.warn) }" :aria-pressed="(query?.bucket || '') === 'warn'" @click="setBucket('warn')"><span class="seg-dot warn" aria-hidden="true"></span>Warning </button>
<button type="button" class="seg-chip" :class="{ active: (query?.bucket || '') === 'info', 'is-empty': !(stats?.severity?.info) }" :aria-pressed="(query?.bucket || '') === 'info'" @click="setBucket('info')"><span class="seg-dot off" aria-hidden="true"></span>Info </button>
</div>
<div class="search-wrap">
<svg class="ui-icon search-icon" aria-hidden="true"><use href="#ui-icon-search"></use></svg>
<input type="search" class="form-control" aria-label="Search application history" placeholder="Search history…" title="Search messages, or filter with code:repo_not_found module:route status:&gt;=400" autocomplete="off" v-field="{ state: viewState, set: value =&gt; { query.search = value }, value: query?.search, form: null, options: {} }">
<span class="filter-count" v-if="parsedFilterCount">{{ parsedFilterCount }} filter{{ parsedFilterCount > 1 ? 's' : '' }}</span>
</div>
<details class="history-view-options"><summary>View options</summary><div class="history-view-controls">
<div class="select-wrap">
<label for="history-sort">Sort</label>
<select id="history-sort" class="form-control form-control-sm" v-field="{ state: viewState, set: value =&gt; { query.sort = value }, value: query?.sort, form: null, options: {} }">
<option value="recent">Most recent</option>
<option value="count">Most frequent</option>
</select>
</div>
<div class="select-wrap">
<label for="history-merge" title="Rows are always sectioned by severity. This merges repeated events inside each section.">Merge</label>
<select id="history-merge" class="form-control form-control-sm" v-field="{ state: viewState, set: value =&gt; { query.group = value }, value: query?.group, form: null, options: {} }">
<option value="">Don't merge</option>
<option value="code">Same error</option>
<option value="module">Same module</option>
</select>
</div>
<label class="autoref">
<input type="checkbox" v-field="{ state: viewState, set: value =&gt; { query.autoRefresh = value }, value: query?.autoRefresh, form: null, options: {} }">
<span class="auto-refresh-label">Auto-refresh</span>
</label>
</div></details>
</form>
<p role="status" v-if="redisLoading">Loading application history…</p>
<div class="admin-empty" v-if="!redisLoading &amp;&amp; !visible?.length &amp;&amp; available === true">No matching entries in the loaded Redis history.</div>
<p v-if="redisRedacted">{{ redisRedacted }} invalid legacy records were omitted. Older valid records may still be available.</p>
<div class="errors-pager" v-if="entries?.length || canLoadMore()">
<span>{{ query?.group &amp;&amp; visible?.length !== entries?.length ? fmt?.number(visible?.length) + (visible?.length === 1 ? ' group' : ' groups') + ' from ' : '' }}{{ fmt?.number(entries?.length) }} safe entries loaded · {{ fmt?.number(redisNextOffset || entries?.length) }} of {{ fmt?.number(total) }} stored records scanned</span>
<button class="btn btn-sm" type="button" v-if="canLoadMore()" @click="loadMore()" :disabled="redisLoading">Load 250 older</button>
</div>
</div>
<div class="errors-list" :class="{'history-inspector':historySelected}" v-if="visible?.length || historySelected" v-show="historyView!=='timeline' || !historySelected">
<div class="errors-list-head" v-if="!historySelected">
<span class="col-when">When</span>
<span class="col-sev">Severity</span>
<span class="col-mod">Module</span>
<span class="col-msg">Message</span>
<span class="col-count" title="Total occurrences since first seen">Total</span>
<span class="col-status">Status</span>
<div class="errs-source" v-if="issueData">
<span class="errs-source-dot" :class="'is-' + issueData.source" aria-hidden="true"></span>
<span>{{ sourceLine() }}</span><span class="errs-source-note" v-if="sourceNote()"> · {{ sourceNote() }}</span>
<button type="button" class="errs-link-button" v-if="issueData.source === 'central'" @click="setSource('history')">Use application history</button>
<button type="button" class="errs-link-button" v-else-if="issueFilters.source === 'history'" @click="setSource('auto')">Use central logs</button>
<button type="button" class="errs-link-button" :disabled="issueLoading" @click="refreshIssues()">{{ issueLoading ? 'Refreshing…' : 'Refresh' }}</button>
</div>
<template v-for="(row, index) in (historySelected ? [historySelected] : visible)" :key="row?._key">
<div class="errors-group-head" v-if="!historySelected &amp;&amp; (index === 0 || visible[index - 1]?._bucket !== row?._bucket)"><span class="sev-dot" :class="'sev-' + row?._bucket"></span>{{ row?._bucket === 'error' ? 'Error' : row?._bucket === 'warn' ? 'Warning' : 'Info' }}<span class="errors-group-count">{{ fmt?.number(visible.filter(r =&gt; r?._bucket === row?._bucket).length) }}</span><span class="errors-group-note" v-if="index === 0">By severity · {{ query?.group === 'code' ? 'repeats merged by error · ' : query?.group === 'module' ? 'repeats merged by module · ' : '' }}{{ query?.sort === 'count' ? 'most frequent first' : 'most recent first' }}</span></div>
<div class="errors-row" :class="{open: expanded[row?._key]}">
<button type="button" class="errors-row-main" v-show="!historySelected" :data-history-key="row?._key" :aria-expanded="!!expanded[row?._key]" :aria-controls="'history-detail-' + index" @click="toggle(row,$event.currentTarget)">
<span class="col-when">
<span class="when-rel">{{ relTime(row?.ts) }}</span>
<span class="when-abs">{{ absTimeShort(row?.ts) }}</span>
</span>
<span class="col-sev">
<span class="sev-dot" :class="&#x27;sev-&#x27; + row?._bucket"></span>
<span class="sev-label">{{ row?._bucket === 'error' ? 'Error' : row?._bucket === 'warn' ? 'Warning' : 'Info' }}</span>
</span>
<span class="col-mod"><span class="pill pill-module">{{ row?.module }}</span></span>
<span class="col-msg">
<strong class="msg-code">{{ row?.displayMessage }}</strong>
<span class="msg-context" v-if="row?.displayContext &amp;&amp; row?.displayContext !== row?.displayMessage">{{ row?.displayContext }}</span>
<span class="msg-detail" v-if="row?._detail">{{ row?._detail }}</span>
<span class="msg-url" v-if="row?._url" :title="row?._url">{{ row?._url }}</span>
</span>
<span class="col-count">
<span class="count-pill" v-if="row?.count &gt; 1">×{{ row?.count }}</span>
<span class="count-pill count-pill-muted" v-if="row?.count === 1">×1</span>
</span>
<span class="col-status">
<span class="status-pill" v-if="row?._status" :class="String(row?._status).match(/^[23]/) ? 'status-neutral' : (&#x27;status-&#x27; + row?._bucket)" :title="String(row?._status).match(/^2/) &amp;&amp; row?._bucket === 'warn' ? 'Client closed the connection' : null">{{ String(row?._status).match(/^2/) &amp;&amp; row?._bucket === 'warn' ? '—' : row?._status }}</span>
<span class="status-empty" v-if="!row?._status" title="No HTTP status for this event">—</span>
</span>
</button>
<div class="errs-state errs-state-error" role="alert" v-if="issueFailure">
<strong>{{ issueFailure }}</strong>
<span v-if="issueData">The list below is from {{ errClock(issueData.end) }} and may be out of date.</span>
<button type="button" class="btn btn-sm" @click="refreshIssues()">Retry</button>
</div>
<div class="errors-row-detail" :id="'history-detail-' + index" v-if="expanded[row?._key]">
<div class="detail-body">
<div class="detail-main">
<div v-if="!detailTab[row?._key] || detailTab[row?._key] === 'summary'"><h3>What happened</h3><p class="log-request-route" v-if="row.raw?.[0]?.route"><code>{{ row.raw[0].method }} {{ row.raw[0].route }}</code></p><section class="log-reproduction" v-if="row.raw?.[0]?.requestPath"><h3>Reproduce this request</h3><dl><div><dt>Anonymous repository ID</dt><dd><code>{{ row.raw[0].repoId }}</code></dd></div><div><dt>Request path · query excluded</dt><dd><code>{{ row.raw[0].requestPath }}</code></dd></div></dl><button type="button" class="btn btn-sm" @click="copyLogValue(row.raw[0].requestPath)">Copy request path</button></section><p v-if="row.raw?.[0]?.errorType">{{ row.raw[0].errorType }}<span v-if="row.raw[0].causeType"> · caused by {{ row.raw[0].causeType }}</span></p><p class="log-explanation-lead">{{ logExplanation(row.raw?.[0] || {}) }}</p><p class="log-evidence">{{ logEvidence(row.raw?.[0] || {}) }}</p><details class="history-technical"><summary>Technical fields</summary> <dl class="history-fields" v-if="!detailTab[row?._key] || detailTab[row?._key] === 'summary'"><div v-for="[key,value] in historyDetailFields(row)" :key="key"><dt>{{ key }}</dt><dd><template v-if="isLogIdentifier(key,value)"><details class="log-value-reveal"><summary>{{ compactLogValue(value) }}</summary><span>{{ value }}</span></details><button type="button" class="log-copy-value" @click="copyLogValue(value)">Copy full {{ key }}</button></template><template v-else>{{ logFieldText(value) }}</template></dd></div></dl></details></div>
<pre v-if="detailTab[row?._key] === &#x27;raw&#x27;">{{ row?._rawJson }}</pre>
<pre class="stack-pre" v-if="detailTab[row?._key] === &#x27;stack&#x27;">{{ row?._stack }}</pre>
<section class="history-occurrences" v-if="detailTab[row?._key] === 'related'" aria-label="Stored occurrences">
<h3>Stored occurrences</h3>
<p class="log-evidence">{{ row._related.length }} matching records in the loaded Redis snapshot. Most recent first.</p>
<ol class="history-occurrence-list">
<li v-for="(r, index) in historyOccurrences(row)" :key="index">
<details class="history-occurrence">
<summary><span class="history-occurrence-heading"><time :datetime="r.ts">{{ occurrenceTime(r.ts) }}</time><span class="log-severity" :class="'log-severity-'+r._bucket">{{ r._status ? 'HTTP '+r._status : r._bucket }}</span></span><span class="history-occurrence-context">{{ r.raw?.[0]?.service || 'Application' }} · {{ r.module || 'Unknown module' }}<span v-if="r.raw?.[0]?.route"> · {{ r.raw[0].method }} <code>{{ r.raw[0].requestPath || r.raw[0].route }}</code></span><span v-else> · Route not captured</span></span></summary>
<p v-if="r.raw?.[0]?.errorType">{{ r.raw[0].errorType }}</p>
<pre v-if="r._stack">{{ r._stack }}</pre>
<p class="log-evidence" v-else>Exception frames were not captured.</p>
<p class="log-evidence" v-if="!r.raw?.[0]?.route">Request route was not captured.</p>
<details class="history-occurrence-record"><summary>Stored record</summary><pre>{{ r._rawJson }}</pre></details>
</details>
</li>
</ol>
</section>
<div class="detail-actions">
<button class="btn btn-sm" type="button" v-if="logTraceId(row, 'requestId')" @click="lookupTrace('requestId', logTraceId(row, 'requestId'), $event.currentTarget, row)">Request timeline →</button>
<button class="btn btn-sm" type="button" v-if="logTraceId(row, 'jobId')" @click="lookupTrace('jobId', logTraceId(row, 'jobId'), $event.currentTarget, row)">Job timeline →</button>
<button class="btn btn-sm" type="button" v-if="row?._url" title="Copy a curl that reproduces the request" @click="copyCurl(row)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-code"></use></svg> Copy curl</button>
<button class="btn btn-sm" type="button" @click="copyJson(row)"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-clipboard"></use></svg> Copy JSON</button>
<span class="copy-hint" v-if="copyHint">{{ copyHint }}</span>
</div>
<div class="errs-table" role="table" aria-label="Issues" aria-describedby="errs-table-note" v-if="issueLoading &amp;&amp; !issueData">
<div class="errs-head" role="row"><span role="columnheader">Issue</span><span role="columnheader">Impact</span><span role="columnheader">Trend</span><span role="columnheader">Last seen</span></div>
<div class="errs-row errs-row-skeleton" role="row" aria-hidden="true" v-for="i in [1, 2, 3]" :key="i"><span class="skeleton skeleton-line"></span><span class="skeleton skeleton-line"></span><span class="skeleton skeleton-line"></span><span class="skeleton skeleton-line"></span></div>
</div>
<div class="errs-table" role="table" aria-label="Issues" v-else-if="visibleIssues().length" :class="{ 'is-refreshing': issueLoading }">
<div class="errs-head" role="row"><span role="columnheader">Issue</span><span role="columnheader">Impact</span><span role="columnheader">Trend · {{ windowLabels[issueData.window] }}</span><span role="columnheader">Last seen</span></div>
<div class="errs-row" role="row" v-for="issue in visibleIssues()" :key="issue.id" :class="{ 'is-now': issue.failingNow }">
<div class="errs-cell-issue" role="cell">
<a class="errs-title" :href="errIssueHref(issue.id)" :data-issue-link="issue.id">{{ issue.title }}</a>
<div class="errs-meta">
<span class="errs-status" :class="errStatusClass(issue.status)" v-if="issue.status">{{ issue.status }}</span>
<code class="errs-code">{{ issue.code }}</code>
<span class="errs-meta-part">{{ issue.service || 'unknown service' }}</span>
<span class="errs-meta-part errs-route" v-if="issue.route || issue.queue">{{ issue.route ? issue.method + ' ' + issue.route : 'job ' + issue.queue }}</span>
<span class="errs-meta-part errs-more-routes" v-if="issue.routeCount &gt; 1">+{{ issue.routeCount - 1 }} {{ issue.routeCount === 2 ? 'route' : 'routes' }}</span>
<span class="errs-new" v-if="issue.newInRelease">New in release {{ issue.newInRelease.slice(0, 7) }}</span>
</div>
<aside class="detail-aside">
<div class="aside-block">
<div class="aside-label">First seen</div>
<div class="aside-value" :title="(absTime(row?._firstSeen))">{{ relTime(row?._firstSeen) }}</div>
</div>
<div class="aside-block">
<div class="aside-label">Last seen</div>
<div class="aside-value" :title="(absTime(row?.ts))">{{ relTime(row?.ts) }}</div>
</div>
<div class="aside-block">
<div class="aside-label">Occurrences</div>
<div class="aside-value">{{ row?.count }}<span class="aside-sub" v-if="row?._lastHourCount"> · {{ row?._lastHourCount }} this hour</span></div>
</div>
<div class="aside-block" v-if="row?._repoId">
<div class="aside-label">Repository</div>
<a class="aside-value" :href="safeUrl(&quot;/admin/repositories?search=&quot; + (row?._repoId))">{{ isLogIdentifier('repoId',row?._repoId) ? compactLogValue(row?._repoId) : row?._repoId }}</a><details class="log-value-reveal" v-if="isLogIdentifier('repoId',row?._repoId)"><summary>Full repository ID</summary>{{ row?._repoId }}</details><button type="button" class="log-copy-value" @click="copyLogValue(row?._repoId)">Copy full repository ID</button>
</div>
<div class="aside-block" v-if="row?._userId">
<div class="aside-label">User<span class="aside-sub" v-if="row?._viewer"> · {{ row?._viewer }}</span></div>
<a class="aside-value mono" :href="safeUrl(&quot;/admin/users/id:&quot; + (row?._userId))">{{ row?._userId }}</a>
</div>
<div class="aside-block" v-else-if="row?._viewer">
<div class="aside-label">Viewer</div>
<div class="aside-value">{{ row?._viewer }}</div>
</div>
<div class="aside-block" v-if="row?._url">
<div class="aside-label">URL</div>
<div class="aside-value mono">{{ row?._url }}</div>
</div>
</aside>
<p class="errs-cause-line"><span class="errs-cause-chip" :class="'cause-' + issue.cause.source">Cause: {{ issue.cause.label }}</span> <span>{{ issue.cause.summary }}</span></p>
</div>
<div class="errs-cell-impact" role="cell">
<span><strong>{{ errNumber(issue.count) }}</strong> {{ issue.requests ? (issue.count === 1 ? 'failure' : 'failures') : issue.jobs ? (issue.count === 1 ? 'job failure' : 'job failures') : (issue.count === 1 ? 'record' : 'records') }}</span>
<span v-if="issue.repoCount || issue.userCount"><strong>{{ errNumber(issue.repoCount) }}</strong> {{ issue.repoCount === 1 ? 'repository' : 'repositories' }} · <strong>{{ errNumber(issue.userCount) }}</strong> {{ issue.userCount === 1 ? 'user' : 'users' }}</span>
<span class="errs-not-recorded" v-else>repositories, users not recorded</span>
</div>
<div class="errs-cell-trend" role="cell">
<span class="errs-spark" :aria-label="'Failures over the ' + windowLabels[issueData.window] + ', peak ' + errTrendMax(issue.trend) + ' per bucket'" role="img"><span v-for="(n, i) in issue.trend" :key="i" :style="{ height: (n ? Math.max(2, Math.round(n / errTrendMax(issue.trend) * 24)) : 1) + 'px' }" :class="{ 'is-zero': !n }"></span></span>
</div>
<div class="errs-cell-last" role="cell">
<span class="errs-now" v-if="issue.failingNow">Now</span><time v-else :datetime="issue.last" :title="errDayTime(issue.last)">{{ errRelTime(issue.last) }}</time>
<span class="errs-since">since {{ errClock(issue.first) }}</span>
</div>
</div>
</div>
</template>
</div>
<div class="errs-state" v-else-if="issueData &amp;&amp; issueData.issues.length">
<strong>No issue matches “{{ issueSearch }}”.</strong>
<button type="button" class="btn btn-sm" @click="issueSearch = ''">Clear search</button>
</div>
<div class="errs-state errs-state-empty" v-else-if="issueData &amp;&amp; !issueFailure">
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-check-circle"></use></svg>
<strong>No errors in the {{ windowLabels[issueData.window] }}.</strong>
<span>{{ issueData.source === 'central' ? 'Central logs' : 'The application history' }} recorded no failures<template v-if="issueData.filters.repoId || issueData.filters.userId"> for this filter</template>.<template v-if="issueData.expected.count"> Expected responses are listed below.</template></span>
</div>
<details class="history-management" v-show="!historySelected"><summary>History settings, export and diagnostics</summary>
<div class="volume-head"><div class="errors-actions"><button class="btn btn-sm" type="button" @click="exportCsv()">Export Redis CSV</button><button class="btn btn-sm btn-outline-danger" type="button" @click="clearAll()">Clear Redis history</button></div></div>
<p role="status">{{ redisCollecting === false ? 'Collection is OFF (LOG_REDIS_MIRROR=off); retained history is not receiving new events.' : redisCollecting === true ? 'The application is configured to mirror warnings and errors.' : 'Collection status is unknown.' }}</p>
<p class="log-coverage">Redis mirror: hourly counters cover 24 hours; stored rows are a rotating snapshot and may cover a shorter or longer period. Counts are not combined with central logs.</p>
<p v-if="redisStatsState !== 'ready' || available !== true">Redis counters are {{ redisStatsState === 'loading' ? 'loading' : 'unavailable' }}.</p>
<p class="errs-noise" id="errs-table-note" v-if="issueData">
<template v-if="issueData.excluded.slow || issueData.excluded.interrupted"><strong>{{ errNumber(issueData.excluded.slow + issueData.excluded.interrupted) }}</strong> slow or interrupted requests are not errors and are left out. <a href="/admin/#performance">Open Performance</a></template>
<template v-else>Slow and interrupted requests are left out; they are on the <a href="/admin/#performance">Performance</a> page.</template>
</p>
<details class="history-summary"><summary>24-hour counters and volume</summary> <section class="kpi-grid" v-if="redisStatsState === 'ready' && available === true">
<div class="kpi-card">
<div class="kpi-label">Occurrences · 24h</div>
<div class="kpi-value">{{ fmt?.number(stats?.last24h ?? 0) }}</div>
<div class="kpi-sub" :class="{up: stats?.delta &gt; 0, down: stats?.delta &lt; 0}">
<span v-if="stats?.prev24h &gt;= 20">{{ (stats?.last24h ?? 0) - (stats?.prev24h ?? 0) &gt;= 0 ? '+' : '' }}{{ Math.round(((stats?.last24h ?? 0) - (stats?.prev24h ?? 0)) / stats.prev24h * 100) }}% vs yesterday</span><span v-else-if="stats?.prev24h !== undefined">{{ fmt?.number(stats?.prev24h ?? 0) }} in prior 24h</span>
<span v-if="!stats?.prev24h">no prior baseline</span>
<details class="errs-expected" v-if="issueData?.expected?.count">
<summary><span>Expected responses</span> <span class="errs-count">{{ errNumber(issueData.expected.count) }}</span> <span class="errs-summary-note">not found, not authorized, expired and other 4xx answers visitors get. No action needed.</span></summary>
<ul>
<li v-for="entry in issueData.expected.groups" :key="entry.code + entry.status"><code>{{ entry.code }}</code><span class="errs-status is-neutral" v-if="entry.status">{{ entry.status }}</span><span class="errs-expected-count">{{ errNumber(entry.count) }}</span><time :datetime="entry.last">{{ errRelTime(entry.last) }}</time></li>
</ul>
</details>
<details class="errs-settings" @toggle="toggleSettings($event)">
<summary>Settings and diagnostics</summary>
<div class="errs-settings-body">
<section aria-labelledby="errs-settings-source">
<h3 id="errs-settings-source">Source</h3>
<div class="seg-filter" role="group" aria-label="Error source">
<button type="button" class="seg-chip" :class="{ active: issueFilters.source === 'auto' }" :aria-pressed="issueFilters.source === 'auto'" @click="setSource('auto')">Central logs, history as fallback</button>
<button type="button" class="seg-chip" :class="{ active: issueFilters.source === 'history' }" :aria-pressed="issueFilters.source === 'history'" @click="setSource('history')">Application history only</button>
</div>
<p class="errs-muted">Central logs keep every service for weeks; the application history is a Redis copy of the last 5,000 warnings and errors. Counts are never combined.</p>
<p class="errs-muted" v-if="issueData">{{ errNumber(issueData.captured) }} records read for this list. <a v-if="issueData.grafanaUrl" :href="safeUrl(issueData.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a></p>
</section>
<section aria-labelledby="errs-settings-history">
<h3 id="errs-settings-history">Application history</h3>
<p class="errs-muted" role="status">{{ redisCollecting === false ? 'Collection is off (LOG_REDIS_MIRROR=off): the history receives no new records.' : redisCollecting === true ? 'The application copies warnings and errors to Redis.' : 'Collection status is unknown.' }}</p>
<div class="errs-actions"><button type="button" class="btn btn-sm" @click="exportHistory()">Export Redis CSV</button><button type="button" class="btn btn-sm btn-outline-danger" @click="clearHistory()">Clear Redis history</button></div>
</section>
<section aria-labelledby="errs-settings-counters">
<h3 id="errs-settings-counters">24-hour counters</h3>
<p class="errs-muted" role="status" v-if="statsState !== 'ready'">{{ statsState === 'loading' ? 'Loading counters…' : 'Redis counters are unavailable.' }}</p>
<template v-else>
<dl class="errs-counters"><div><dt>Records · 24 h</dt><dd>{{ errNumber(stats.last24h) }}</dd></div><div><dt>Error</dt><dd>{{ errNumber(stats.severity?.error) }}</dd></div><div><dt>Warning</dt><dd>{{ errNumber(stats.severity?.warn) }}</dd></div><div><dt>Info</dt><dd>{{ errNumber(stats.severity?.info) }}</dd></div><div><dt>Dropped</dt><dd>{{ errNumber(stats.dropped) }}</dd></div></dl>
<div class="errs-counter-bars" role="img" :aria-label="'Records per hour over 24 hours: ' + errNumber(stats.last24h) + ' in total'"><span v-for="(bucket, i) in stats.buckets" :key="i" :title="errClock(bucket.hour) + ' · ' + bucket.error + ' error · ' + bucket.warn + ' warning · ' + bucket.info + ' info'"><i class="seg-error" :style="{ height: statBarHeight(bucket, 'error') + 'px' }"></i><i class="seg-warn" :style="{ height: statBarHeight(bucket, 'warn') + 'px' }"></i><i class="seg-info" :style="{ height: statBarHeight(bucket, 'info') + 'px' }"></i></span></div>
</template>
</section>
<section aria-labelledby="errs-settings-telemetry">
<h3 id="errs-settings-telemetry">Telemetry</h3>
<p class="errs-muted" role="status" v-if="telemetryState !== 'ready'">{{ telemetryState === 'loading' ? 'Checking central logs…' : 'Central log status is unavailable.' }}</p>
<template v-else>
<p class="errs-muted">{{ telemetryText(telemetry.state) }}</p>
<template v-if="telemetry.telemetry">
<p class="errs-muted" v-if="telemetry.telemetry.missing?.length">Missing or stale: {{ telemetry.telemetry.missing.join(', ') }}. Expected one API, four streamers and three queues.</p>
<p class="errs-muted" v-else>API, streamer and queue heartbeats were present at the last check.</p>
<p class="errs-muted">Collector: {{ telemetry.telemetry.collector?.state }} · dropped events since collector start: {{ telemetry.telemetry.collector?.dropped ?? 'unknown' }}.</p>
<ul class="errs-instances"><li v-for="(instance, i) in telemetry.telemetry.instances" :key="i">{{ instance.service }} · {{ instance.instance || 'unknown instance' }} · {{ instance.dropped ?? 'unknown' }} dropped · last seen {{ errClock(instance.last, true) }}</li></ul>
</template>
</template>
</section>
</div>
</details>
</section>
<!-- ===== Issue not in this window ===== -->
<section class="errs-detail" v-if="errView !== 'list' &amp;&amp; !selectedIssue" aria-labelledby="errs-detail-title">
<h1 class="paper-page-title errs-detail-title" id="errs-detail-title" tabindex="-1">{{ issueLoading ? 'Loading issue…' : 'Issue not found' }}</h1>
<div class="errs-state" v-if="!issueLoading"><strong>This issue has no records in the {{ windowLabels[issueFilters.window] }}.</strong><span>It may be older, or recorded by another source.</span><a class="btn btn-sm" href="/admin/errors">All errors</a></div>
</section>
<!-- ===== 2. Issue page ===== -->
<section class="errs-detail" v-if="errView === 'issue' &amp;&amp; selectedIssue" aria-labelledby="errs-detail-title">
<div class="errs-detail-head">
<h1 class="paper-page-title errs-detail-title" id="errs-detail-title" tabindex="-1">{{ selectedIssue.title }}</h1>
<a class="btn btn-sm" href="/admin/errors"><span aria-hidden="true">←</span> All errors</a>
</div>
<div class="kpi-card kpi-error">
<div class="kpi-label">Error</div>
<div class="kpi-value">{{ fmt?.number(stats?.severity?.error ?? 0) }}</div>
<div class="kpi-sub">5xx · {{ stats?.unique?.error }} unique</div>
<div class="errs-chips">
<span class="errs-chip errs-status" :class="errStatusClass(selectedIssue.status)" v-if="selectedIssue.status">HTTP {{ selectedIssue.status }}{{ selectedIssue.route ? ' to the visitor' : '' }}</span>
<code class="errs-chip">{{ selectedIssue.code }}</code>
<span class="errs-chip">{{ selectedIssue.service || 'unknown service' }}<template v-if="selectedIssue.routeCount &gt; 1"> · {{ selectedIssue.routeCount }} routes</template><template v-else-if="selectedIssue.route"> · <code>{{ selectedIssue.method }} {{ selectedIssue.route }}</code></template><template v-else-if="selectedIssue.queue"> · job {{ selectedIssue.queue }}</template></span>
<span class="errs-chip">First seen {{ errDayTime(selectedIssue.first) }}<template v-if="selectedIssue.firstRelease"> · release <code>{{ selectedIssue.firstRelease.slice(0, 7) }}</code></template></span>
<span class="errs-chip errs-placeholder" v-if="!selectedIssue.firstRelease">release not recorded</span>
<span class="errs-chip errs-new" v-if="selectedIssue.newInRelease">New in release {{ selectedIssue.newInRelease.slice(0, 7) }}</span>
</div>
<div class="kpi-card kpi-warn">
<div class="kpi-label">Warning</div>
<div class="kpi-value">{{ fmt?.number(stats?.severity?.warn ?? 0) }}</div>
<div class="kpi-sub">4xx, aborted · {{ stats?.unique?.warn }} unique</div>
</div>
<div class="kpi-card kpi-info">
<div class="kpi-label">Info</div>
<div class="kpi-value">{{ fmt?.number(stats?.severity?.info ?? 0) }}</div>
<div class="kpi-sub">Auth, 404 · {{ stats?.unique?.info }} unique</div>
</div>
<div class="kpi-card" :class="{&#x27;kpi-error&#x27;: stats?.dropped &gt; 0}">
<div class="kpi-label">Entries stored</div>
<div class="kpi-value">{{ fmt?.number(total) }}</div>
<div class="kpi-sub">
rotating history · cap {{ fmt?.number(cap) }}
<span class="dropped-warn" v-if="stats?.dropped &gt; 0"> · {{ stats?.dropped }} dropped</span>
<div class="errs-detail-grid">
<div class="errs-detail-main">
<section class="errs-cause" :class="'cause-' + selectedIssue.cause.source" aria-labelledby="errs-cause-title">
<h2 class="sr-only" id="errs-cause-title">Likely cause</h2>
<p class="errs-cause-head"><span class="errs-cause-chip" :class="'cause-' + selectedIssue.cause.source">Likely cause: {{ selectedIssue.cause.label }}</span> <span class="errs-muted">from {{ errPlural(selectedIssue.count, 'record') }}</span></p>
<p class="errs-cause-summary"><strong>{{ selectedIssue.cause.summary }}</strong> <span v-if="selectedIssue.cause.detail">{{ selectedIssue.cause.detail }}</span></p>
<ul class="errs-evidence" v-if="selectedIssue.cause.evidence.length"><li v-for="(line, i) in selectedIssue.cause.evidence" :key="i">{{ line }}</li></ul>
<div class="errs-actions">
<a class="btn btn-sm" v-if="selectedIssue.repos.length === 1" :href="errRepoHref(selectedIssue.repos[0].id)">Open repository</a>
<a class="btn btn-sm" href="/admin/#performance">Open Performance</a>
<button type="button" class="btn btn-sm" v-if="curlFor(selectedIssue.occurrences[0])" @click="copyValue(curlFor(selectedIssue.occurrences[0]), 'curl command')">Copy curl</button>
<a class="btn btn-sm" v-if="issueData.grafanaUrl" :href="safeUrl(issueData.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a>
</div>
</section>
<section class="errs-card" aria-labelledby="errs-routes-title" v-if="selectedIssue.routes?.length">
<div class="errs-card-head"><h2 id="errs-routes-title">Routes that failed</h2><span class="errs-muted">{{ errNumber(selectedIssue.routeCount) }}</span></div>
<ul class="errs-routes" :class="errStatusClass(selectedIssue.status)">
<li v-for="route in selectedIssue.routes.slice(0, 10)" :key="route.method + route.route">
<code>{{ route.method }} {{ route.route }}</code>
<span class="errs-route-bar" aria-hidden="true"><span :style="{ width: Math.max(2, Math.round(route.count / selectedIssue.routes[0].count * 100)) + '%' }"></span></span>
<span class="errs-num">{{ errNumber(route.count) }}<span class="sr-only"> failures</span></span>
</li>
</ul>
<p class="errs-muted errs-more" v-if="selectedIssue.routeCount &gt; 10">+ {{ errNumber(selectedIssue.routeCount - 10) }} more routes</p>
<p class="errs-muted errs-more" v-if="selectedIssue.routeKnown &lt; selectedIssue.count">Route not recorded for {{ errPlural(selectedIssue.count - selectedIssue.routeKnown, 'record') }}.</p>
</section>
<section class="errs-card" aria-labelledby="errs-repos-title">
<div class="errs-card-head"><h2 id="errs-repos-title">Affected repositories</h2><span class="errs-muted" v-if="selectedIssue.repoCount">{{ errNumber(selectedIssue.repoCount) }}</span></div>
<div class="errs-repos" role="table" aria-labelledby="errs-repos-title" v-if="selectedIssue.repos.length">
<div class="errs-repos-head" role="row"><span role="columnheader">Repository</span><span role="columnheader">Owner</span><span role="columnheader">Failures</span><span role="columnheader">Last</span></div>
<div class="errs-repos-row" role="row" v-for="repo in selectedIssue.repos.slice(0, 10)" :key="repo.id">
<span role="cell" class="errs-repo-cell"><a class="errs-mono" :href="errRepoHref(repo.id)">{{ repo.id }}</a><span class="errs-muted" v-if="ownerOf(repo.id)?.source">{{ ownerOf(repo.id).source }}</span></span>
<span role="cell"><a v-if="ownerOf(repo.id)?.ownerId" :href="errUserHref(ownerOf(repo.id).ownerId)">{{ ownerOf(repo.id).owner ? '@' + ownerOf(repo.id).owner : ownerOf(repo.id).ownerId }}</a><span class="errs-placeholder" v-else>not resolved</span></span>
<span role="cell" class="errs-num">{{ errNumber(repo.count) }}</span>
<span role="cell"><time :datetime="repo.last" :title="errDayTime(repo.last)">{{ errRelTime(repo.last) }}</time></span>
</div>
<p class="errs-muted errs-more" v-if="selectedIssue.repoCount > 10">+ {{ errNumber(selectedIssue.repoCount - 10) }} more repositories</p>
</div>
<p class="errs-placeholder-box" v-else><strong>Not recorded.</strong> These records carry no repository ID<template v-if="selectedIssue.route &amp;&amp; /:owner/.test(selectedIssue.route)">: the route names the GitHub owner, so the ID is not kept</template>.</p>
<div class="errs-who">
<h3>Who hit it</h3>
<p class="errs-placeholder" v-if="selectedIssue.viewers.notRecorded === selectedIssue.count">not recorded on these records</p>
<p v-else><strong>{{ errNumber(selectedIssue.viewers.signedIn) }}</strong> by owners, coauthors or admins · <strong>{{ errNumber(selectedIssue.viewers.visitors) }}</strong> by signed-in visitors · <strong>{{ errNumber(selectedIssue.viewers.anonymous || 0) }}</strong> not signed in<template v-if="selectedIssue.viewers.notRecorded"> · <span class="errs-placeholder">{{ errNumber(selectedIssue.viewers.notRecorded) }} not recorded</span></template></p>
<p v-if="selectedIssue.users.length" class="errs-user-list">Users affected (counted separately from the repositories above; see the occurrences for which record carried which): <template v-for="(user, i) in selectedIssue.users.slice(0, 8)" :key="user.id"><template v-if="i">, </template><a :href="errUserHref(user.id)">{{ userName(user.id) ? '@' + userName(user.id) : user.id }}</a> <span class="errs-muted">({{ user.count }})</span></template><template v-if="selectedIssue.userCount > 8"> and {{ selectedIssue.userCount - 8 }} more</template></p>
</div>
</section>
</div>
<aside class="errs-detail-side">
<section class="errs-card" aria-labelledby="errs-hist-title">
<h2 id="errs-hist-title">Failures · {{ windowLabels[issueData.window] }}</h2>
<div class="errs-histogram" role="img" :aria-label="errPlural(selectedIssue.count, 'failure') + ' over the ' + windowLabels[issueData.window] + ', peak ' + errTrendMax(selectedIssue.trend) + ' per bucket'"><span v-for="(n, i) in selectedIssue.trend" :key="i" :style="{ height: (n ? Math.max(3, Math.round(n / errTrendMax(selectedIssue.trend) * 56)) : 2) + 'px' }" :class="{ 'is-zero': !n }" :title="n + ' failures'"></span></div>
<div class="errs-hist-axis" aria-hidden="true"><span>{{ errClock(issueData.start) }}</span><span>now</span></div>
</section>
<section class="errs-card" aria-labelledby="errs-occ-title">
<div class="errs-card-head"><h2 id="errs-occ-title">Occurrences</h2><span class="errs-muted">{{ selectedIssue.occurrences.length &lt; selectedIssue.count ? 'latest ' + selectedIssue.occurrences.length + ' of ' : '' }}{{ errNumber(selectedIssue.count) }}</span></div>
<ol class="errs-occurrences">
<li v-for="(o, index) in (showAllOccurrences ? selectedIssue.occurrences : selectedIssue.occurrences.slice(0, 10))" :key="index">
<a :href="occurrenceHref(index)" :data-occurrence="index">
<time :datetime="o.timestamp">{{ errClock(o.timestamp, true) }}</time>
<span class="errs-occ-main"><span class="errs-mono" v-if="o.repoId">{{ o.repoId }}</span><span class="errs-placeholder" v-else>no repository</span><span class="errs-occ-sub">{{ o.viewer ? (o.viewer === 'anonymous' ? 'not signed in' : o.viewer === 'visitor' ? 'signed-in visitor' : (userName(o.userId) ? '@' + userName(o.userId) : o.viewer)) : 'viewer not recorded' }}<template v-if="o.ms !== undefined"> · {{ errNumber(o.ms) }} ms</template></span></span>
<span class="errs-status" :class="errStatusClass(o.status || o.httpStatus)" v-if="o.status || o.httpStatus">{{ o.status || o.httpStatus }}</span>
</a>
</li>
</ol>
<button type="button" class="btn btn-sm errs-show-all" v-if="!showAllOccurrences &amp;&amp; selectedIssue.occurrences.length &gt; 10" @click="showAllOccurrences = true">Show all {{ selectedIssue.occurrences.length }}<template v-if="selectedIssue.occurrences.length &lt; selectedIssue.count"> latest</template></button>
</section>
</aside>
</div>
</section>
<section class="volume-chart" v-if="redisStatsState === 'ready' && available === true">
<div class="volume-head">
<span class="volume-title">Volume · 24h · 1h buckets</span>
<span class="volume-legend">
<span v-if="stats?.severity?.error"><span class="dot dot-error"></span>Error</span>
<span v-if="stats?.severity?.warn"><span class="dot dot-warn"></span>Warning</span>
<span v-if="stats?.severity?.info"><span class="dot dot-info"></span>Info</span>
</span>
<!-- ===== 3. Request view ===== -->
<section class="errs-detail errs-request" v-if="errView === 'request' &amp;&amp; selectedIssue &amp;&amp; currentOccurrence()" aria-labelledby="errs-detail-title">
<div class="errs-detail-head">
<h1 class="errs-request-title" id="errs-detail-title" tabindex="-1">{{ requestTitle() }}</h1>
<div class="errs-actions errs-pager">
<a class="btn btn-sm" :href="errIssueHref(selectedIssue.id)"><span aria-hidden="true">←</span> Issue</a>
<a class="btn btn-sm" v-if="occurrenceIndex &gt; 0" :href="occurrenceHref(occurrenceIndex - 1)" aria-label="Newer occurrence">Newer</a>
<a class="btn btn-sm" v-if="occurrenceIndex &lt; selectedIssue.occurrences.length - 1" :href="occurrenceHref(occurrenceIndex + 1)" aria-label="Older occurrence">Older</a>
<button type="button" class="btn btn-sm" v-if="curlFor(currentOccurrence())" @click="copyValue(curlFor(currentOccurrence()), 'curl command')">Copy curl</button>
</div>
</div>
<div class="volume-bars">
<div class="volume-bar" v-for="(b, index) in stats?.buckets" :key="index" :title="(bucketTitle(b))">
<span class="seg seg-error" :style="{height: barPx(b, &#x27;error&#x27;) + &#x27;px&#x27;}"></span>
<span class="seg seg-warn" :style="{height: barPx(b, &#x27;warn&#x27;) + &#x27;px&#x27;}"></span>
<span class="seg seg-info" :style="{height: barPx(b, &#x27;info&#x27;) + &#x27;px&#x27;}"></span>
<div class="errs-chips">
<span class="errs-chip errs-status" :class="errStatusClass(currentOccurrence().status || currentOccurrence().httpStatus)" v-if="currentOccurrence().status || currentOccurrence().httpStatus">{{ currentOccurrence().status || currentOccurrence().httpStatus }}<template v-if="requestMs() !== null"> in {{ errNumber(requestMs()) }} ms</template></span>
<span class="errs-chip"><time :datetime="currentOccurrence().timestamp">{{ errDayTime(currentOccurrence().timestamp) }}</time></span>
<span class="errs-chip" v-if="currentOccurrence().repoId">Repository <a class="errs-mono" :href="errRepoHref(currentOccurrence().repoId)">{{ currentOccurrence().repoId }}</a></span><span class="errs-chip errs-placeholder" v-else>repository not recorded</span>
<span class="errs-chip" v-if="ownerOf(currentOccurrence().repoId)?.ownerId">Owner <a :href="errUserHref(ownerOf(currentOccurrence().repoId).ownerId)">{{ ownerOf(currentOccurrence().repoId).owner ? '@' + ownerOf(currentOccurrence().repoId).owner : ownerOf(currentOccurrence().repoId).ownerId }}</a></span>
<span class="errs-chip" v-if="currentOccurrence().viewer">{{ viewerChip(currentOccurrence().viewer) }}<template v-if="currentOccurrence().userId &amp;&amp; currentOccurrence().userId !== ownerOf(currentOccurrence().repoId)?.ownerId"> · <a :href="errUserHref(currentOccurrence().userId)">{{ userName(currentOccurrence().userId) ? '@' + userName(currentOccurrence().userId) : 'user' }}</a></template></span><span class="errs-chip errs-placeholder" v-else>viewer not recorded</span>
<span class="errs-muted errs-position">{{ occurrenceIndex + 1 }} of {{ selectedIssue.occurrences.length }}</span>
</div>
<div class="errs-card errs-tabs-card">
<div class="errs-tabs" role="tablist" aria-label="Request details">
<button type="button" role="tab" v-for="[key, label] in requestTabs" :key="key" :id="'errs-tab-' + key" :aria-selected="requestTab === key ? 'true' : 'false'" :aria-controls="'errs-panel-' + key" :tabindex="requestTab === key ? 0 : -1" :class="{ active: requestTab === key }" @click="selectRequestTab(key)" @keydown="requestTabKey($event, key)">{{ label }}</button>
</div>
<div class="errs-panel" role="tabpanel" id="errs-panel-timeline" aria-labelledby="errs-tab-timeline" v-if="requestTab === 'timeline'" tabindex="0">
<p class="errs-muted" role="status" v-if="traceLoading">Loading every record with this {{ traceKind() }} ID…</p>
<template v-else>
<div class="errs-legend"><span><i class="k-app"></i>App</span><span><i class="k-external"></i>External (GitHub, storage)</span><span><i class="k-data"></i>Database / cache</span><span><i class="k-failure"></i>Failure</span><span class="errs-legend-scale">0 – {{ errNumber(waterfall().span) }} ms</span></div>
<ol class="errs-waterfall">
<li v-for="row in waterfall().rows" :key="row.key" :class="['k-' + row.kind, { 'is-failure': row.failure }]">
<button type="button" class="errs-step" :aria-expanded="expandedSteps[row.key] ? 'true' : 'false'" :aria-controls="'errs-step-' + row.key" @click="toggleStep(row.key)">
<span class="errs-step-dot" aria-hidden="true"></span>
<span class="errs-step-label"><strong>{{ row.label }}</strong><span>{{ row.sub || 'no route recorded' }}</span></span>
<span class="errs-step-track" aria-hidden="true"><span class="errs-step-bar" :style="{ left: row.left + '%', width: row.width + '%' }"></span></span>
<span class="errs-step-status" :class="{ 'is-bad': row.failed }">{{ row.status || '—' }}</span>
<span class="errs-step-ms">{{ row.ms === null ? '—' : errNumber(row.ms) }}<span class="sr-only"> ms, starts at {{ row.offset }} ms</span></span>
</button>
<div class="errs-step-detail" :id="'errs-step-' + row.key" v-if="expandedSteps[row.key]">
<pre v-if="row.event.errorStack">{{ row.event.errorType }}
{{ row.event.errorStack }}<template v-if="row.event.causeType">
Caused by {{ row.event.causeType }}
{{ row.event.causeStack || '' }}</template></pre>
<pre>{{ recordJson(row.event) }}</pre>
</div>
</li>
</ol>
<p class="errs-muted errs-trace-note" v-if="trace?.events?.length">{{ errPlural(trace.events.length, 'record') }} with this {{ traceKind() }} ID<template v-if="trace.state === 'partial'"> (partial)</template>. External calls come from <code>external_request</code> records; no URLs or tokens are stored. <a v-if="trace.grafanaUrl" :href="safeUrl(trace.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a></p>
<p class="errs-placeholder-box" v-else><strong>Timeline not recorded.</strong> <template v-if="!traceKind()">This record has no request or job ID, so its other records cannot be found.</template><template v-else-if="issueData.source !== 'central'">The application history keeps single records; the timeline needs central logs.</template><template v-else-if="trace?.state === 'unreachable'">Central logs did not answer. Retry later.</template><template v-else>Central logs returned no other record for this {{ traceKind() }}.</template> Only this record is shown.</p>
</template>
</div>
<div class="errs-panel" role="tabpanel" id="errs-panel-request" aria-labelledby="errs-tab-request" v-if="requestTab === 'request'" tabindex="0">
<dl class="errs-fields">
<div><dt>Method · route</dt><dd><code v-if="currentOccurrence().route || selectedIssue.route">{{ currentOccurrence().method || selectedIssue.method }} {{ currentOccurrence().route || selectedIssue.route }}</code><span class="errs-placeholder" v-else>not recorded</span></dd></div>
<div><dt>Path</dt><dd><code v-if="currentOccurrence().requestPath" class="errs-break">{{ currentOccurrence().requestPath }}</code><span class="errs-placeholder" v-else>not recorded</span></dd></div>
<div><dt>Query</dt><dd><span class="errs-placeholder">excluded: query strings are never logged</span></dd></div>
<div><dt>Body</dt><dd><span class="errs-placeholder">{{ ['GET', 'HEAD'].includes(currentOccurrence().method || selectedIssue.method) ? 'none (' + (currentOccurrence().method || selectedIssue.method) + ')' : 'not recorded' }}</span></dd></div>
<div><dt>Viewer</dt><dd><template v-if="currentOccurrence().viewer">{{ viewerLabel(currentOccurrence().viewer) }}<span class="errs-muted" v-if="currentOccurrence().viewer === 'visitor' || currentOccurrence().viewer === 'anonymous'"> · reviewers are never identified</span></template><span class="errs-placeholder" v-else>not recorded</span></dd></div>
<div><dt>Repository</dt><dd><a v-if="currentOccurrence().repoId" class="errs-mono" :href="errRepoHref(currentOccurrence().repoId)">{{ currentOccurrence().repoId }}</a><span class="errs-placeholder" v-else>not recorded</span><span class="errs-muted" v-if="ownerOf(currentOccurrence().repoId)?.source"> · {{ ownerOf(currentOccurrence().repoId).source }}</span></dd></div>
<div><dt>User</dt><dd><a v-if="currentOccurrence().userId" :href="errUserHref(currentOccurrence().userId)">{{ userName(currentOccurrence().userId) ? '@' + userName(currentOccurrence().userId) : currentOccurrence().userId }}</a><span class="errs-placeholder" v-else>not recorded</span></dd></div>
<div><dt>Service · release</dt><dd>{{ currentOccurrence().service || selectedIssue.service || 'unknown' }} · <code v-if="currentOccurrence().release &amp;&amp; currentOccurrence().release !== 'unknown'">{{ currentOccurrence().release.slice(0, 7) }}</code><span class="errs-placeholder" v-else>release not recorded</span></dd></div>
<div v-for="kind in ['requestId', 'jobId']" :key="kind"><dt>{{ kind === 'requestId' ? 'Request ID' : 'Job ID' }}</dt><dd><template v-if="currentOccurrence()[kind]"><code class="errs-break">{{ currentOccurrence()[kind] }}</code> <button type="button" class="errs-link-button" @click="copyValue(currentOccurrence()[kind], kind === 'requestId' ? 'Request ID' : 'Job ID')">Copy</button></template><span class="errs-placeholder" v-else>not recorded</span></dd></div>
</dl>
</div>
<div class="errs-panel" role="tabpanel" id="errs-panel-exception" aria-labelledby="errs-tab-exception" v-if="requestTab === 'exception'" tabindex="0">
<template v-if="exceptionRecord().record">
<p class="errs-muted" v-if="exceptionRecord().fromSample">This occurrence has no stack of its own; showing the latest occurrence's.</p>
<dl class="errs-fields">
<div><dt>Type</dt><dd><code>{{ exceptionRecord().record.errorType || 'not recorded' }}</code></dd></div>
<div><dt>Code</dt><dd><code v-if="exceptionRecord().record.errorCode">{{ exceptionRecord().record.errorCode }}</code><span class="errs-placeholder" v-else>not recorded</span></dd></div>
<div><dt>Cause</dt><dd><code v-if="exceptionRecord().record.causeType">{{ exceptionRecord().record.causeType }}</code><span class="errs-placeholder" v-else>not recorded</span></dd></div>
</dl>
<h3 class="errs-subhead">Stack</h3>
<pre class="errs-pre" v-if="exceptionRecord().record.errorStack">{{ exceptionRecord().record.errorStack }}</pre><p class="errs-placeholder" v-else>not recorded</p>
<template v-if="exceptionRecord().record.causeStack"><h3 class="errs-subhead">Cause stack</h3><pre class="errs-pre">{{ exceptionRecord().record.causeStack }}</pre></template>
<p class="errs-muted">Frames list recognized application code only.</p>
</template>
<p class="errs-placeholder-box" v-else><strong>No exception recorded.</strong> The failure was returned as a status code without an exception, type or stack.</p>
</div>
<div class="errs-panel" role="tabpanel" id="errs-panel-fields" aria-labelledby="errs-tab-fields" v-if="requestTab === 'fields'" tabindex="0">
<div class="errs-fields-head"><p class="errs-muted">Admin API fields only. Query strings, bodies, URLs and tokens are never stored.</p><button type="button" class="btn btn-sm" @click="copyValue(recordJson(occurrenceRecord()), 'JSON')">Copy JSON</button></div>
<pre class="errs-pre">{{ recordJson(occurrenceRecord()) }}</pre>
</div>
</div>
<div class="volume-axis" aria-hidden="true"><span>24h ago</span><span>12h ago</span><span>now</span></div>
</section>
</details>
</details>
</section>
<div v-if="errorSource === 'history' &amp;&amp; historyView==='timeline'"><div class="admin-empty" v-if="!traceSelection">No request or job ID was recorded for this entry.</div><section class="log-timeline" v-if="traceSelection" aria-labelledby="log-timeline-title" :aria-busy="traceLoading">
<div class="volume-head"><h3 id="log-timeline-title" tabindex="-1">{{ traceSelection.kind === 'jobId' ? 'Job' : 'Request' }} timeline</h3><button type="button" class="btn btn-sm" @click="closeTrace()">Close timeline</button></div>
<p class="log-origin" v-if="traceSelection.context">{{ traceSelection.context.event }} · {{ traceSelection.context.service }}</p>
<p role="status" v-if="traceLoading || trace?.state !== 'ready'">{{ traceLoading ? 'Loading related events…' : trace?.state === 'empty' ? 'No related events returned in this window.' : logStateText(trace?.state) }}</p>
<p class="log-coverage" v-if="trace &amp;&amp; !traceLoading">{{ trace.events?.length || 0 }} events returned · {{ absTime(trace.start) }} – {{ absTime(trace.end) }} · 200-event cap. All services and releases.</p>
<ol class="log-events" v-if="trace?.events?.length"><li v-for="(event,index) in trace.events" :key="index"><time :datetime="event.timestamp" :title="event.timestamp">{{ absTimeShort(event.timestamp) }}</time><div class="log-timeline-event"><div class="log-timeline-event-title"><strong>{{ event.errorCode || event.errorType || event.event }}</strong><span class="log-severity" :class="'log-severity-'+logSeverity(event)">{{ (event.status || event.httpStatus) ? 'HTTP '+(event.status || event.httpStatus) : event.severity || 'Event' }}</span></div><p>{{ event.service }}<span v-if="event.module"> / {{ event.module }}</span><span v-if="event.ms !== undefined"> · {{ event.ms }} ms</span><span v-if="event.attempt !== undefined"> · attempt {{ event.attempt }}</span></p><p class="log-request-route" v-if="event.route"><code>{{ event.method }} {{ event.requestPath || event.route }}</code></p><details class="log-error-stack" v-if="event.errorStack || event.causeStack"><summary>Exception frames<span v-if="event.errorType"> · {{ event.errorType }}</span></summary><pre v-if="event.errorStack">{{ event.errorStack }}</pre><p v-if="event.causeType">Caused by {{ event.causeType }}</p><pre v-if="event.causeStack">{{ event.causeStack }}</pre></details><details class="log-event-fields"><summary>Event fields</summary><pre>{{ JSON.stringify(event,null,2) }}</pre><button type="button" class="btn btn-sm" @click="copyLogValue(JSON.stringify(event,null,2))">Copy JSON</button></details></div></li></ol>
<details class="log-timeline-scope"><summary>Correlation ID and query scope</summary><code>{{ traceSelection.id }}</code><button type="button" class="log-copy-value" @click="copyLogValue(traceSelection.id)">Copy full ID</button><p>Earliest matching events in the selected window. Service and release filters do not narrow this timeline.</p></details>
<a v-if="trace?.grafanaUrl" :href="safeUrl(trace.grafanaUrl)" target="_blank" rel="noopener noreferrer">Open in Grafana</a>
</section></div>
</div>
+2
View File
@@ -67,6 +67,8 @@
<button class="btn btn-sm" type="button" @click="clearSelection()">Clear</button>
</div>
<partial-view name="partials/admin/entityErrors.htm" :state="viewState"></partial-view>
<div class="paper-table paper-table-repos has-bulk w-100" role="table" aria-label="Repositories" :aria-busy="listLoading ? 'true' : 'false'" :class="{ 'is-refreshing': listLoading &amp;&amp; listLoaded }">
<div class="paper-table-head" role="row">
<div role="columnheader" style="width: 28px;">
+2
View File
@@ -89,6 +89,8 @@
</div>
</div>
<partial-view name="partials/admin/entityErrors.htm" :state="viewState"></partial-view>
<div class="admin-section-header" v-if="userInfo &amp;&amp; userInfo?.isAdmin &amp;&amp; user &amp;&amp; user?.username == userInfo?.username">
<h2><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-key"></use></svg> API tokens</h2>
<span class="section-count">{{ tokens?.length }}</span>
+450
View File
@@ -0,0 +1,450 @@
import { nextTick } from "vue";
// Admin › Errors: one list of issues built server-side (GET /api/admin/errors/issues)
// from central logs, or from the Redis history when central logs do not answer.
// The page has three views in one route, driven by the URL query so they are
// deep-linkable and the browser Back button works:
// /admin/errors the issue list
// /admin/errors?issue=<id> one issue
// /admin/errors?issue=<id>&occurrence=n one occurrence (request view)
export const WINDOW_LABELS = { "15m": "last 15 min", "1h": "last hour", "6h": "last 6 h", "24h": "last 24 h" };
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
const REPO_ID = /^[A-Za-z0-9_-]{3,200}$/;
const USER_ID = /^[a-f0-9]{24}$/;
const SIGNED_IN = { owner: "Owner", coauthor: "Co-author", admin: "Admin" };
/** Splits the search box into server filters (repo:<id>, user:<id>) and free text. */
export function parseIssueSearch(text) {
const out = { repoId: "", userId: "", free: "", invalid: "" };
const rest = [];
for (const token of String(text || "").trim().split(/\s+/).filter(Boolean)) {
const match = token.match(/^(repo|user):(.*)$/i);
if (!match) { rest.push(token); continue; }
const value = match[2];
if (match[1].toLowerCase() === "repo" && REPO_ID.test(value)) out.repoId = value;
else if (match[1].toLowerCase() === "user" && USER_ID.test(value)) out.userId = value;
else out.invalid = token;
}
out.free = rest.join(" ").toLowerCase();
return out;
}
export function issueMatches(issue, free) {
if (!free) return true;
const hay = [issue.title, issue.code, issue.service, issue.route, issue.method, issue.queue, issue.status, issue.cause?.label, issue.cause?.summary]
.filter(value => value !== null && value !== undefined).join(" ").toLowerCase();
return free.split(" ").every(word => hay.includes(word));
}
const statusOf = event => Number(event?.status || event?.httpStatus) || 0;
const time = value => Date.parse(value);
const isExternal = event => event?.event === "external_request";
const DATA = new Set(["mongodb", "redis"]);
/** Rows for the request waterfall: one per recorded event, positioned by timestamp and duration. */
export function waterfall(events, issue) {
const rows = (events || []).filter(event => Number.isFinite(time(event.timestamp))).map((event, index) => {
const end = time(event.timestamp);
const ms = Number(event.ms);
const start = Number.isFinite(ms) && ms >= 0 ? end - ms : end;
const external = isExternal(event);
const host = String(event.upstreamHost || "");
const kind = external ? "external" : DATA.has(event.service) ? "data" : event.service === "nginx" ? "edge" : "app";
const label = external ? `${host === "storage" ? "Storage" : /github/.test(host) ? "GitHub" : "External"}${event.upstreamMethod ? " · " + event.upstreamMethod : ""}`
: event.errorCode || event.errorType || String(event.event || "event").replace(/_/g, " ");
const sub = external ? (event.upstreamEndpoint || host || "endpoint not recorded")
: [event.service, event.route || (event.queue ? "job " + event.queue : "")].filter(Boolean).join(" · ");
const status = external ? Number(event.upstreamStatus) || event.errorCode || "" : statusOf(event) || "";
const failed = external ? Number(event.upstreamStatus) >= 400 || !!event.errorCode : statusOf(event) >= 500 || event.severity === "error";
const failure = !external && !!issue && !["edge_request", "request_completed"].includes(event.event) &&
((issue.errorCode && event.errorCode === issue.errorCode) || (!issue.errorCode && issue.errorType && event.errorType === issue.errorType));
return { key: index, event, start, end, ms: Number.isFinite(ms) ? ms : null, kind, label, sub, status, failed, failure };
});
if (!rows.length) return { rows, span: 0 };
// Start order; at equal starts the enclosing (longer) step first.
rows.sort((a, b) => a.start - b.start || (b.end - b.start) - (a.end - a.start));
rows.forEach((row, index) => { row.key = index; });
const min = Math.min(...rows.map(row => row.start)), max = Math.max(...rows.map(row => row.end));
const span = Math.max(1, max - min);
for (const row of rows) {
row.left = ((row.start - min) / span) * 100;
row.width = Math.max(0.6, ((row.end - row.start) / span) * 100);
if (row.left + row.width > 100) row.left = Math.max(0, 100 - row.width);
row.offset = Math.round(row.start - min);
}
if (!rows.some(row => row.failure)) {
const last = [...rows].reverse().find(row => row.failed && row.kind === "app");
if (last) last.failure = true;
}
return { rows, span: Math.round(span) };
}
/** Role-only chip for the request header: the owner is already linked beside it. */
export function viewerChip(viewer) {
if (!viewer) return "";
if (viewer === "anonymous") return "Viewer not signed in";
if (viewer === "visitor") return "Viewer: signed-in visitor";
return `Viewer: ${(SIGNED_IN[viewer] || viewer).toLowerCase()}`;
}
/** Plain-language viewer label for #991's viewer field. */
export function viewerLabel(viewer) {
if (!viewer) return "";
if (SIGNED_IN[viewer]) return `Signed in as ${SIGNED_IN[viewer].toLowerCase()}`;
if (viewer === "visitor") return "Signed-in visitor (no role on the repository)";
return "Viewer not signed in";
}
const relTime = (iso, now = Date.now()) => {
const t = time(iso);
if (!Number.isFinite(t)) return "";
const s = Math.max(0, Math.floor((now - t) / 1000));
if (s < 60) return "just now";
const m = Math.floor(s / 60);
if (m < 60) return `${m} min ago`;
const h = Math.floor(m / 60);
if (h < 24) return `${h} h ago`;
return `${Math.floor(h / 24)} d ago`;
};
const clock = (iso, seconds = false) => {
const d = new Date(iso);
return Number.isNaN(d.getTime()) ? "" : d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", ...(seconds ? { second: "2-digit" } : {}), hour12: false });
};
const dayTime = iso => {
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return "";
const today = new Date().toDateString() === d.toDateString();
return (today ? "Today " : d.toLocaleDateString(undefined, { month: "short", day: "numeric" }) + " · ") + clock(iso, true);
};
// Fills the fields the page reads, so a partial or unexpected answer renders as empty.
export function normalizeIssues(data) {
const value = data && typeof data === "object" && !Array.isArray(data) ? data : {};
return { source: "central", window: "24h", filters: {}, names: { repos: {}, users: {} }, captured: 0, ...value,
issues: Array.isArray(value.issues) ? value.issues : [],
expected: { count: 0, groups: [], ...(value.expected || {}) }, excluded: { slow: 0, interrupted: 0, ...(value.excluded || {}) },
summary: { issues: 0, failingNow: 0, failedRecords: 0, repositories: 0, users: 0, upstreamShare: 0, ...(value.summary || {}) } };
}
const fmtNumber = n => Number(n || 0).toLocaleString("en-US");
// Shared by the Errors page and the repository/user admin pages.
function installFormatters(state) {
state.errRelTime = iso => relTime(iso);
state.errClock = (iso, seconds) => clock(iso, seconds);
state.errDayTime = iso => dayTime(iso);
state.errNumber = fmtNumber;
state.errPlural = (n, word, many) => `${fmtNumber(n)} ${n === 1 ? word : (many || word + "s")}`;
state.errStatusClass = status => Number(status) >= 500 ? "is-error" : Number(status) >= 400 ? "is-warn" : "is-neutral";
state.errIssueHref = (id, extra = "") => `/admin/errors?issue=${encodeURIComponent(id)}${extra}`;
state.errRepoHref = id => `/admin/repositories?search=${encodeURIComponent(id)}`;
// Log records carry the internal _id; the admin user page takes it as "id:<_id>".
state.errUserHref = id => `/admin/users/id:${encodeURIComponent(id)}`;
state.errTrendMax = trend => Math.max(1, ...(trend || [0]));
state.viewerLabel = viewerLabel;
state.viewerChip = viewerChip;
}
/**
* Errors for one repository or user, shown on the admin Repositories (filtered to
* one repository) and User pages. `filter()` returns { repoId } or { userId } or null.
*/
export function installEntityErrors(state, http, filter, { onScopeDispose } = {}) {
installFormatters(state);
state.entityErrors = { loading: false, failed: false, data: null, key: "" };
let version = 0, disposed = false;
state.loadEntityErrors = async (force = false) => {
const params = filter();
const key = params ? JSON.stringify(params) : "";
if (!force && key === state.entityErrors.key) return;
const current = ++version;
state.entityErrors = { loading: !!params, failed: false, data: null, key };
if (!params) return;
try {
const response = await http.get("/api/admin/errors/issues", { params: { window: "24h", ...params } });
if (disposed || current !== version) return;
state.entityErrors = { loading: false, failed: false, data: normalizeIssues(response.data), key };
} catch {
if (!disposed && current === version) state.entityErrors = { loading: false, failed: true, data: null, key };
}
};
// Issues for this entity, the expected ones last and marked.
state.entityIssues = () => state.entityErrors.data?.issues || [];
state.entityFailingNow = () => state.entityIssues().filter(issue => issue.failingNow);
state.entityExpected = () => state.entityErrors.data?.expected?.groups || [];
const dispose = () => { disposed = true; version++; };
if (onScopeDispose) onScopeDispose(dispose); else state.on?.("dispose", dispose);
}
export const errorsAdminController = function (state, http, location, interval) {
state.watch("user.status", () => { if (state.user == null) location.url("/"); });
if (state.user == null) location.url("/");
installFormatters(state);
let version = 0, traceVersion = 0, statsVersion = 0, disposed = false;
let lastIssueId = null, lastOccurrence = null;
state.issueData = null;
state.issueLoading = true;
state.issueFailure = "";
state.issueFilters = { window: "24h", service: "", source: "auto" };
// ?q= pre-fills the search, so repository and user pages can link here filtered.
const initialQuery = location.search?.() || {};
state.issueSearch = typeof initialQuery.q === "string" ? initialQuery.q.slice(0, 200) : "";
state.errView = "list";
state.selectedIssue = null;
state.missingIssue = "";
state.showAllOccurrences = false;
state.occurrenceIndex = -1;
state.requestTab = "timeline";
state.trace = null;
state.traceLoading = false;
state.expandedSteps = {};
state.copyStatus = "";
state.settingsOpen = false;
state.telemetry = null;
state.telemetryState = "idle";
state.stats = null;
state.statsState = "idle";
state.redisCollecting = null;
state.windowLabels = WINDOW_LABELS;
const searchFilters = () => parseIssueSearch(state.issueSearch);
state.searchFilters = searchFilters;
state.visibleIssues = () => {
const { free } = searchFilters();
return (state.issueData?.issues || []).filter(issue => issueMatches(issue, free));
};
state.sourceLine = () => {
const data = state.issueData;
if (!data) return "";
const from = data.source === "central" ? "From central logs" : "From application history (Redis)";
return `${from} · ${WINDOW_LABELS[data.window] || data.window}`;
};
state.sourceNote = () => {
const data = state.issueData;
if (!data) return "";
if (data.source === "history" && data.centralState === "skipped") return "Central logs are not used while this switch is on.";
if (data.source === "history") return ({ disabled: "Central logs are not configured.", unreachable: "Central logs did not answer.", busy: "Central logs are busy.", misconfigured: "Central log configuration is invalid." })[data.centralState] || "";
if (data.faultLimitReached) return "Showing the newest 2,000 failures: older issues in this window may be missing. Narrow the window or filter by service.";
if (data.state === "partial") return "Partial: a record limit or an invalid record reduced coverage.";
return "";
};
state.ownerOf = repoId => state.issueData?.names?.repos?.[repoId] || state.entityErrors?.data?.names?.repos?.[repoId] || null;
state.userName = userId => state.issueData?.names?.users?.[userId] || null;
async function load({ quiet = false } = {}) {
const current = ++version;
const search = searchFilters();
const params = { window: state.issueFilters.window };
if (state.issueFilters.service) params.service = state.issueFilters.service;
if (state.issueFilters.source === "history") params.source = "history";
if (search.repoId) params.repoId = search.repoId;
if (search.userId) params.userId = search.userId;
if (!quiet) state.issueLoading = true;
state.issueFailure = "";
try {
const response = await http.get("/api/admin/errors/issues", { params });
if (disposed || current !== version) return;
state.issueData = normalizeIssues(response.data);
state.redisCollecting = response.data?.redisCollecting !== false;
state.issueLoading = false;
syncFromRoute(false);
} catch (error) {
if (disposed || current !== version) return;
state.issueFailure = error?.status === 400 ? "These filters are not valid. Check repo: and user: values." : "Could not load errors. Check the connection and retry.";
} finally { if (!disposed && current === version) state.issueLoading = false; }
}
state.refreshIssues = () => load();
let serverKey = "";
const serverFilterKey = () => { const s = searchFilters(); return [state.issueFilters.window, state.issueFilters.service, state.issueFilters.source, s.repoId, s.userId].join("|"); };
state.applyFilters = () => { const key = serverFilterKey(); if (key !== serverKey) { serverKey = key; load(); } };
serverKey = serverFilterKey();
state.setSource = source => { state.issueFilters.source = source; state.applyFilters(); };
state.watch("issueFilters.window", () => state.applyFilters(), false, false);
state.watch("issueFilters.service", () => state.applyFilters(), false, false);
// repo:<id> and user:<id> are server filters; free text filters the loaded issues.
let searchTimer = null;
state.watch("issueSearch", () => { window.clearTimeout(searchTimer); searchTimer = window.setTimeout(() => { if (!disposed) state.applyFilters(); }, 300); }, false, false);
// ---- Views and routing -------------------------------------------------
const query = () => location.search?.() || {};
function syncFromRoute(moveFocus = true) {
const q = query();
const issueId = typeof q.issue === "string" ? q.issue : "";
if (!issueId) {
const was = state.errView;
state.errView = "list"; state.selectedIssue = null; state.occurrenceIndex = -1; state.missingIssue = "";
clearTrace();
if (moveFocus && was !== "list") focusRow();
return;
}
const issue = (state.issueData?.issues || []).find(item => item.id === issueId) || null;
if (issue?.id !== state.selectedIssue?.id) state.showAllOccurrences = false;
state.selectedIssue = issue;
state.missingIssue = issue || state.issueLoading ? "" : issueId;
const index = Number.parseInt(q.occurrence, 10);
const occurrence = issue && Number.isInteger(index) && index >= 0 && index < issue.occurrences.length ? index : -1;
const view = occurrence >= 0 ? "request" : "issue";
const changed = view !== state.errView || issueId !== lastIssueId || occurrence !== state.occurrenceIndex;
state.errView = view;
lastIssueId = issueId;
if (occurrence !== state.occurrenceIndex) { state.occurrenceIndex = occurrence; state.expandedSteps = {}; if (occurrence >= 0) loadTrace(); else clearTrace(); }
if (view === "request" && ["timeline", "request", "exception", "fields"].includes(q.tab)) state.requestTab = q.tab;
if (moveFocus && changed) focusHeading();
}
async function focusHeading() {
await nextTick();
if (disposed) return;
const heading = document.getElementById("errs-detail-title");
heading?.focus({ preventScroll: true });
const view = document.querySelector(".app-view");
if (view) view.scrollTop = 0;
}
async function focusRow() {
await nextTick();
if (disposed) return;
const link = lastIssueId && document.querySelector(`[data-issue-link="${lastIssueId}"]`);
if (link) { link.focus({ preventScroll: true }); link.scrollIntoView?.({ block: "nearest" }); }
else document.getElementById("errs-search")?.focus();
}
state.on("routeUpdate", () => syncFromRoute(true));
state.currentOccurrence = () => state.selectedIssue?.occurrences?.[state.occurrenceIndex] || null;
state.occurrenceHref = index => state.errIssueHref(state.selectedIssue?.id || "", `&occurrence=${index}`);
state.openOccurrence = index => { if (state.selectedIssue) { lastOccurrence = index; location.url(state.occurrenceHref(index)); } };
state.lastOccurrence = () => lastOccurrence;
// ---- Request view ------------------------------------------------------
function clearTrace() { traceVersion++; state.trace = null; state.traceLoading = false; }
async function loadTrace() {
const occurrence = state.currentOccurrence();
clearTrace();
const kind = UUID.test(occurrence?.requestId || "") ? "requestId" : UUID.test(occurrence?.jobId || "") ? "jobId" : "";
if (!kind || state.issueData?.source !== "central") return;
const current = traceVersion;
state.traceLoading = true;
try {
const response = await http.get("/api/admin/errors/correlation", { params: { kind, id: occurrence[kind], window: state.issueData?.window || "24h" } });
if (!disposed && current === traceVersion) state.trace = response.data;
} catch {
if (!disposed && current === traceVersion) state.trace = { state: "unreachable", events: [] };
} finally { if (!disposed && current === traceVersion) state.traceLoading = false; }
}
state.traceKind = () => {
const occurrence = state.currentOccurrence();
return UUID.test(occurrence?.requestId || "") ? "request" : UUID.test(occurrence?.jobId || "") ? "job" : "";
};
state.waterfall = () => waterfall(state.trace?.events?.length ? state.trace.events : [state.occurrenceRecord()].filter(Boolean), state.selectedIssue);
// The fullest record of this occurrence: the matching trace event, else the occurrence projection.
state.occurrenceRecord = () => {
const occurrence = state.currentOccurrence();
if (!occurrence) return null;
const issue = state.selectedIssue;
const events = state.trace?.events || [];
const match = events.find(event => event.timestamp === occurrence.timestamp && event.service === occurrence.service)
|| events.find(event => !["edge_request", "request_completed", "external_request"].includes(event.event) &&
((issue?.errorCode && event.errorCode === issue.errorCode) || (!issue?.errorCode && issue?.errorType && event.errorType === issue.errorType)));
if (match) return match;
return state.occurrenceIndex === 0 && issue?.sample ? issue.sample : occurrence;
};
state.exceptionRecord = () => {
const record = state.occurrenceRecord();
if (record?.errorStack || record?.errorType) return { record, fromSample: false };
const sample = state.selectedIssue?.sample;
return sample?.errorStack || sample?.errorType ? { record: sample, fromSample: true } : { record: null, fromSample: false };
};
state.toggleStep = key => { state.expandedSteps = { ...state.expandedSteps, [key]: !state.expandedSteps[key] }; };
state.requestTabs = [["timeline", "Timeline"], ["request", "Request"], ["exception", "Exception"], ["fields", "All fields"]];
state.selectRequestTab = (tab, focus = false) => {
state.requestTab = tab;
if (focus) nextTick(() => document.getElementById("errs-tab-" + tab)?.focus());
};
state.requestTabKey = (event, tab) => {
const keys = state.requestTabs.map(([key]) => key);
const index = keys.indexOf(tab);
const next = { ArrowRight: index + 1, ArrowLeft: index - 1, Home: 0, End: keys.length - 1 }[event.key];
if (next === undefined) return;
event.preventDefault();
state.selectRequestTab(keys[(next + keys.length) % keys.length], true);
};
state.requestTitle = () => {
const o = state.currentOccurrence();
if (!o) return "";
const where = o.requestPath || o.route || state.selectedIssue?.route;
if (!where) return o.jobId ? `Job ${state.selectedIssue?.queue || ""}`.trim() : `${state.selectedIssue?.code || "Record"} · route not recorded`;
return `${o.method || state.selectedIssue?.method || ""} ${where}`.trim();
};
// The failing record rarely carries a duration; the request's own records do.
state.requestMs = () => {
const o = state.currentOccurrence();
if (Number.isFinite(Number(o?.ms)) && o.ms !== undefined) return Number(o.ms);
const envelope = (state.trace?.events || []).find(event => event.event === "request_completed" && Number.isFinite(Number(event.ms)));
return envelope ? Number(envelope.ms) : null;
};
state.curlFor = occurrence => occurrence?.requestPath && ["GET", "HEAD"].includes(occurrence.method || "GET")
? `curl -i ${occurrence.method === "HEAD" ? "-I " : ""}'${window.location.origin}${occurrence.requestPath}'` : "";
state.copyValue = async (value, label) => {
try { await navigator.clipboard.writeText(String(value)); state.copyStatus = `${label} copied.`; }
catch { state.copyStatus = "Copy is not available in this browser. Select the text instead."; }
};
state.recordJson = record => JSON.stringify(record || {}, null, 2);
// ---- Settings and diagnostics (lazy) -----------------------------------
state.toggleSettings = event => {
state.settingsOpen = !!event?.target?.open;
if (!state.settingsOpen) return;
if (state.statsState === "idle") loadStats();
if (state.telemetryState === "idle") loadTelemetry();
};
async function loadStats() {
const current = ++statsVersion;
state.statsState = "loading";
try {
const response = await http.get("/api/admin/errors/stats");
if (disposed || current !== statsVersion) return;
state.stats = response.data;
state.statsState = response.data?.available === false ? "unavailable" : "ready";
} catch { if (!disposed && current === statsVersion) state.statsState = "unavailable"; }
}
async function loadTelemetry() {
state.telemetryState = "loading";
try {
const response = await http.get("/api/admin/errors/investigation", { params: { window: "1h" } });
if (disposed) return;
state.telemetry = response.data;
state.telemetryState = "ready";
} catch { if (!disposed) state.telemetryState = "unavailable"; }
}
state.telemetryText = value => ({
ready: "Central logs answer.", empty: "Central logs answer; nothing to report in the last hour.", partial: "Central logs answer with partial coverage.",
stale: "Central logs answer, but expected application telemetry is stale or missing.", disabled: "Central logs are not configured.",
misconfigured: "Central log configuration is invalid.", unreachable: "Central logs did not answer.", busy: "Central logs are busy. Retry shortly.",
})[value] || "Central log status is unknown.";
state.statBarHeight = (bucket, key) => {
const max = Math.max(1, ...(state.stats?.buckets || []).map(b => (b.error || 0) + (b.warn || 0) + (b.info || 0)));
return Math.round(((bucket[key] || 0) / max) * 40);
};
state.clearHistory = async () => {
if (!window.confirm("Clear the Redis error history? Central logs are not affected.")) return;
try { await http.delete("/api/admin/errors"); state.copyStatus = "Redis history cleared."; state.statsState = "idle"; loadStats(); load(); }
catch { state.copyStatus = "Could not clear the Redis history."; }
};
state.exportHistory = async () => {
try {
const response = await http.get("/api/admin/errors", { params: { offset: 0, limit: 5000 } });
const cols = ["ts", "level", "module", "message", "service", "status", "route", "repoId", "userId", "viewer", "requestId"];
const lines = [cols.join(",")];
for (const entry of response.data?.entries || []) {
const row = { ...(entry.raw?.[0] || {}), ...entry };
lines.push(cols.map(col => { const v = row[col] == null ? "" : String(row[col]); return /[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v; }).join(","));
}
const url = URL.createObjectURL(new Blob([lines.join("\n")], { type: "text/csv;charset=utf-8" }));
const a = document.createElement("a");
a.href = url; a.download = `errors-${new Date().toISOString().slice(0, 19)}.csv`;
document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url);
state.copyStatus = "Redis history exported.";
} catch { state.copyStatus = "Could not export the Redis history."; }
};
load().then(() => { if (state.errView !== "list") focusHeading(); });
const poll = interval(() => { if (state.errView === "list" && !state.issueLoading && document.visibilityState !== "hidden") load({ quiet: true }); }, 60000);
state.on("dispose", () => { disposed = true; window.clearTimeout(searchTimer); version++; traceVersion++; statsVersion++; interval.cancel(poll); });
};
-156
View File
@@ -1,156 +0,0 @@
import { nextTick } from "vue";
// Central counts never include the separately displayed Redis mirror.
export function installLogInvestigation(state, http) {
state.errorSource = "central";
state.logView = { search: "", severity: "", sort: "recent" };
state.selectedLog = null;
state.logDetailTab = "overview";
state.logSeverity = (sample) => Number(sample?.status || sample?.httpStatus) >= 500 || ["error", "fatal"].includes(sample?.severity) ? "error" : sample?.severity === "warn" ? "warn" : "info";
state.filteredLogGroups = () => {
const search = state.logView.search.trim().toLowerCase();
return (state.logData?.groups || []).filter(group =>
(!state.logView.severity || state.logSeverity(group.sample) === state.logView.severity) &&
(!search || Object.values(group.sample).join(" ").toLowerCase().includes(search))
).slice().sort((a, b) => state.logView.sort === "count" ? b.count - a.count : Date.parse(b.last) - Date.parse(a.last));
};
state.shortLogId = id => id ? id.slice(0, 8) : "";
state.isLogIdentifier = (key, value) => typeof value === "string" && value.length > 16 && /(?:id|sha|release)$/i.test(key);
state.compactLogValue = value => String(value).slice(0, 8) + "…" + String(value).slice(-4);
state.logCopyStatus = "";
state.copyLogValue = async value => {
try { await navigator.clipboard.writeText(String(value)); state.logCopyStatus = "Full value copied"; }
catch { state.logCopyStatus = "Copy unavailable. Expand the value to select it."; }
};
state.logExplanation = sample => {
const service = sample.service || "The application";
const event = ({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"})[sample.event] || ("recorded “" + (sample.event || "application event") + "”");
const status = Number(sample.status || sample.httpStatus);
const meaning = ({502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"})[status];
return service + " " + event + (status ? " with HTTP " + status + (meaning ? " (" + meaning + ")" : "") : "") + ".";
};
state.logEvidence = sample => [
sample.errorCode ? "Recorded error code: " + sample.errorCode + "." : "No error code was included in this sample.",
sample.ms !== undefined ? "Recorded duration: " + sample.ms + " ms." : "",
sample.attempt !== undefined ? "Recorded attempt: " + sample.attempt + "." : "",
sample.queue ? "Queue: " + sample.queue + "." : "",
].filter(Boolean).join(" ");
state.occurrenceTime = value => Number.isFinite(Date.parse(value)) ? new Date(value).toLocaleString(undefined, {dateStyle:"medium",timeStyle:"medium"}) : "Time not captured";
state.historyOccurrences = row => (row?._related || []).slice().sort((a,b) => Date.parse(b.ts)-Date.parse(a.ts));
state.historyDetailFields = row => {
try { const value = JSON.parse(row?._detailJson || "{}"); return value && typeof value === "object" ? Object.entries(value) : [["value", value]]; }
catch { return [["record", row?._detailJson || ""]]; }
};
state.logFieldText = value => typeof value === "object" ? JSON.stringify(value) : String(value ?? "");
state.captureErrorScroll = origin => {
const positions = [];
for (let element = origin?.parentElement; element; element = element.parentElement) positions.push({element,top:element.scrollTop,left:element.scrollLeft});
return positions;
};
state.restoreErrorScroll = positions => positions.forEach(({element,top,left}) => { if(element.isConnected) {element.scrollTop=top;element.scrollLeft=left;} });
let traceOrigin = null, detailOrigin = null, traceSource = null, listScroll = [];
state.selectLog = async (group, origin) => {
detailOrigin = origin || document.activeElement;
listScroll = state.captureErrorScroll(detailOrigin);
traceVersion++; state.trace = null; state.traceSelection = null; state.traceLoading = false;
state.logDetailTab = "overview";
state.selectedLog = group;
await nextTick();
if (disposed || state.selectedLog !== group || state.errorSource !== "central") return;
document.getElementById("log-detail-title")?.focus({ preventScroll: true });
document.querySelector(".log-inspector")?.scrollIntoView?.({ block: "start" });
const kind = ["requestId","jobId"].find(key=>state.logTraceId(group,key));
if (kind) state.lookupTrace(kind,group.sample[kind],document.getElementById("trace-selector-"+kind),group.sample,true);
};
state.closeLogDetail = async () => {
state.selectedLog = null;
traceVersion++; state.trace = null; state.traceSelection = null; state.traceLoading = false;
await nextTick();
if (detailOrigin?.isConnected) { detailOrigin.focus({preventScroll:true}); state.restoreErrorScroll(listScroll); }
else document.getElementById("error-source-central")?.focus();
};
state.logFilters = { window: "1h", service: "", release: "" };
state.logAppliedFilters = { ...state.logFilters };
state.logData = null;
state.logLoading = false;
state.logFailure = "";
state.logSnapshotStale = false;
state.trace = null;
state.traceLoading = false;
state.traceSelection = null;
const uuid = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
let version = 0, traceVersion = 0, disposed = false;
state.logStateText = (value) => ({
ready: "Central logs available", empty: "No warnings, errors or HTTP 5xx returned in this window",
disabled: "Central lookup is not configured. Application history is available in the other source.",
misconfigured: "Central lookup configuration is invalid. Ask an operator to check it.",
unreachable: "Central logging is unreachable. Application history is available in the other source.",
busy: "Central lookup is busy. Retry shortly.", partial: "Partial results: a result limit or invalid record reduced coverage.",
stale: "Central logging responds, but expected application telemetry is stale or missing.",
}[value] || "Central log status has not been checked");
state.refreshLogs = async () => {
const current = ++version;
const filters = { ...state.logFilters };
state.logLoading = true; state.logFailure = "";
state.trace = null; state.traceSelection = null; state.traceLoading = false; state.selectedLog = null; traceVersion++;
try {
const response = await http.get("/api/admin/errors/investigation", { params: filters });
if (disposed || current !== version) return;
state.logData = response.data;
state.logAppliedFilters = filters;
state.logSnapshotStale = !!response.data?.end && Date.now() - Date.parse(response.data.end) > 90000;
} catch (error) {
if (disposed || current !== version) return;
state.logData = null;
state.logFailure = error?.status === 400 ? "Use a Git release SHA or ‘unknown’ and retry." : "Could not load central log status. Retry or open Application history.";
} finally { if (!disposed && current === version) state.logLoading = false; }
};
state.lookupTrace = async (kind, id, origin, sample, preserveFocus = false) => {
if (!["requestId", "jobId"].includes(kind) || !uuid.test(id || "")) return;
if (state.errorSource === "central" && state.selectedLog) state.logDetailTab = "timeline";
if (state.errorSource === "history") state.historyView = "timeline";
traceSource = state.errorSource;
traceOrigin = origin || document.activeElement;
const current = ++traceVersion;
state.traceSelection = { kind, id, context: sample ? {
event: sample.errorCode || sample.event || sample.displayMessage || sample.message,
service: sample.service || sample.module,
} : null }; state.trace = null; state.traceLoading = true;
await nextTick();
if (disposed || current !== traceVersion) return;
const heading = document.getElementById("log-timeline-title");
if (!preserveFocus) { heading?.focus(); heading?.scrollIntoView?.({ block: "nearest" }); }
try {
const response = await http.get("/api/admin/errors/correlation", { params: { kind, id, window: state.logData?.window || state.logAppliedFilters.window } });
if (!disposed && current === traceVersion) state.trace = response.data;
} catch {
if (!disposed && current === traceVersion) state.trace = { state: "unreachable", events: [] };
} finally { if (!disposed && current === traceVersion) state.traceLoading = false; }
};
state.showLogTimeline = origin => {
state.logDetailTab = "timeline";
if (state.traceSelection) return;
const kind = ["requestId","jobId"].find(key=>state.logTraceId(state.selectedLog,key));
if (kind) state.lookupTrace(kind,state.selectedLog.sample[kind],origin,state.selectedLog.sample);
};
state.closeTrace = async () => {
state.logDetailTab = "overview";
state.historyView = "overview";
traceVersion++; state.trace = null; state.traceSelection = null; state.traceLoading = false;
await nextTick();
if (traceOrigin?.isConnected && traceSource === state.errorSource) traceOrigin.focus();
else document.getElementById("error-source-" + state.errorSource)?.focus();
};
state.logTraceId = (row, kind) => {
const value = row?.sample?.[kind] || row?.raw?.find(value => value && typeof value === "object")?.[kind];
return uuid.test(value || "") ? value : null;
};
state.watch("errorSource", () => {
traceVersion++; state.trace = null; state.traceSelection = null; state.traceLoading = false; state.selectedLog = null; state.historySelected = null; state.historyView = "overview"; state.expanded = {};
}, false, false);
const freshnessTimer = window.setInterval(() => {
state.logSnapshotStale = !!state.logData?.end && Date.now() - Date.parse(state.logData.end) > 90000;
}, 15000);
state.on("dispose", () => { disposed = true; version++; traceVersion++; window.clearInterval(freshnessTimer); });
state.refreshLogs();
}
+13 -501
View File
@@ -1,4 +1,5 @@
import { installLogInvestigation } from "./admin-log-investigation.js";
import { installEntityErrors } from "./admin-errors.js";
export { errorsAdminController } from "./admin-errors.js";
import { reactive, onScopeDispose, nextTick } from "vue";
import { createTimers, createListeners } from "./state.js";
import { duration, statusMsg, number as formatNumber, date as formatDate } from "./formatters.js";
@@ -299,6 +300,7 @@ export const repositoriesAdminController = function (state, http, location) {
state.totalPage = Math.ceil(res.data.total / state.query.limit);
state.repositories = res.data.results;
state.allSelected = false;
state.loadEntityErrors();
},
(err) => {
state.fetchError = (err && err.data && err.data.error) || "Failed to load repositories";
@@ -325,6 +327,13 @@ export const repositoriesAdminController = function (state, http, location) {
: state.statusCountFor(k),
onChange: () => { state.query.page = 1; },
});
// A search that names exactly one repository (as the Errors page links do)
// shows that repository's issues above the list.
state.errorRepoId = () => {
const search = String(state.query.search || "").trim();
return /^[A-Za-z0-9_-]{3,200}$/.test(search) && (state.repositories || []).some((repo) => repo.repoId === search) ? search : "";
};
installEntityErrors(state, http, () => state.errorRepoId() ? { repoId: state.errorRepoId() } : null);
getRepositories();
getStatusCounts();
@@ -682,12 +691,15 @@ export const userAdminController = function (state, http, location, params) {
http.get("/api/admin/users/" + username, {}).then(
(res) => {
state.userInfo = res.data;
state.loadEntityErrors();
},
(err) => {
console.error(err);
}
);
}
// Issues whose records carry this user's internal _id (#991).
installEntityErrors(state, http, () => /^[a-f0-9]{24}$/.test(state.userInfo?._id || "") ? { userId: state.userInfo._id } : null);
getUser(params.username);
getUserRepositories(params.username);
@@ -1421,506 +1433,6 @@ export const queuesAdminController = function (state, http, location, interval,
});
};
export const errorsAdminController = function (state, http, location, interval) {
installLogInvestigation(state, http);
state.redisCollecting = null;
state.redisLoading = false;
let historyVersion = 0, statsVersion = 0, statsPending = false, disposed = false;
state.redisStatsState = "loading";
const timers = createTimers();
state.watch("user.status", () => {
if (state.user == null) {
location.url("/");
}
});
if (state.user == null) {
location.url("/");
}
state.entries = [];
state.visible = [];
state.available = null;
state.cap = 1000;
state.total = 0;
state.pageSize = 250;
state.expanded = {};
state.historySelected = null;
state.historyView = "overview";
let historyOrigin = null, historyScroll = [];
state.detailTab = {};
state.copyHint = "";
state.parsedFilterCount = 0;
state.stats = { last24h: 0, prev24h: 0, delta: 0, severity: { error: 0, warn: 0, info: 0 }, unique: { error: 0, warn: 0, info: 0 }, buckets: [], dropped: 0 };
state.query = {
search: "",
bucket: "",
sort: "recent",
group: "code",
autoRefresh: true,
};
state.relTime = (iso) => {
if (!iso) return "";
const t = new Date(iso).getTime();
if (isNaN(t)) return iso;
const diff = Math.max(0, Date.now() - t);
const s = Math.floor(diff / 1000);
if (s < 5) return "just now";
if (s < 60) return `${s}s ago`;
const m = Math.floor(s / 60);
if (m < 60) return `${m}m ago`;
const h = Math.floor(m / 60);
if (h < 24) return `${h}h ago`;
const d = Math.floor(h / 24);
if (d < 7) return `${d}d ago`;
return new Date(iso).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" });
};
state.absTime = (iso) => {
if (!iso) return "";
const d = new Date(iso);
if (isNaN(d.getTime())) return iso;
return d.toLocaleString(undefined, { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" });
};
state.absTimeShort = (iso) => {
if (!iso) return "";
const d = new Date(iso);
if (isNaN(d.getTime())) return iso;
return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false });
};
// Decorate each entry once with derived display fields. Pre-computing
// avoids returning new arrays from template functions each digest
// cycle (which trips Angular's $rootScope:infdig).
// snake_case-ish identifier looking like an error key. Accepts both
// pure lowercase ("repo_not_found") and the mixed-case style this
// codebase uses ("repoId_already_used", "invalid_repoId").
const errorKeyRe = /^[a-zA-Z][a-zA-Z0-9]*(?:_[a-zA-Z0-9]+)+$/;
function bucketFor(detail, level) {
const s =
(detail && (detail.httpStatus || detail.status)) || null;
if (typeof s === "number") {
if (s >= 500) return "error";
if (s === 401 || s === 403 || s === 404) return "info";
if (s >= 400) return "warn";
}
if (level === "error") return "error";
if (level === "warn") return "warn";
return "info";
}
function decorate(e) {
// Preserve the API's safe record before adding UI-only fields. Raw and
// Copy JSON must not silently omit fields through the summary projection.
e._rawJson = JSON.stringify(e, null, 2);
const detail = (e.raw || []).find(
(a) => a && typeof a === "object" && !Array.isArray(a)
);
if (detail) {
if (detail.message && errorKeyRe.test(detail.message)) {
e.displayMessage = detail.message;
e.displayContext = e.message;
} else if (detail.code && errorKeyRe.test(String(detail.code))) {
e.displayMessage = String(detail.code);
e.displayContext = e.message;
} else if (
detail.name &&
detail.name !== "AnonymousError" &&
detail.name !== "Error"
) {
// Plain JS errors (SyntaxError, TypeError, RangeError, ...) — use
// the class name as the visible code; the original message is
// shown as italic context.
e.displayMessage = detail.name;
e.displayContext = detail.message || e.message;
} else {
e.displayMessage = e.message;
}
e._status = detail.httpStatus || detail.status || null;
e._url = detail.url || null;
e._method = detail.method || null;
e._repoId = detail.repoId || detail.detail || null;
e._userId = /^[a-f0-9]{24}$/.test(String(detail.userId || "")) ? detail.userId : null;
e._viewer = ["owner", "coauthor", "admin", "visitor", "anonymous"].includes(detail.viewer) ? detail.viewer : null;
e._detail = detail.detail && detail.detail !== e._repoId ? detail.detail : null;
// Walk into `cause` (and `err` for streamer-style entries) to
// surface the deepest stack.
let s = detail.errorStack || detail.causeStack ? [detail.errorType, detail.errorStack, detail.causeType ? "Caused by " + detail.causeType : null, detail.causeStack].filter(Boolean).join("\n") : (typeof detail.stack === "string" ? detail.stack : null);
var roots = [detail.cause, detail.err].filter(Boolean);
for (var ri = 0; !s && ri < roots.length; ri++) {
var c = roots[ri];
while (!s && c && typeof c === "object") {
if (typeof c.stack === "string") s = c.stack;
c = c.cause;
}
}
e._stack = s;
} else {
e.displayMessage = e.message;
e._status = null;
e._url = null;
e._stack = null;
}
e._bucket = bucketFor(detail, e.level);
e._detailJson = renderDisplayPayload(e, detail);
return e;
}
// Build a curated, column-aligned payload for the readable Details tab. Mirrors
// the reference admin design: name / code / kind / httpStatus / module /
// detail / url / ts on aligned colons. We can't just JSON.stringify the
// raw entry because it includes the human "anonymous error" wrapper
// arg and the keys aren't column-aligned.
function renderDisplayPayload(entry, detail) {
const fields = [];
const push = (k, v) => {
if (v === undefined || v === null || v === "") return;
fields.push([k, v]);
};
for (const key of ["service", "event", "severity", "requestId", "jobId"]) push(key, detail && detail[key]);
push("name", detail && detail.name);
push("code", entry.displayMessage || (detail && detail.message));
if (entry._bucket) push("kind", entry._bucket);
push("httpStatus", detail && detail.httpStatus);
if (detail && detail.status && !(detail.httpStatus)) push("status", detail.status);
push("module", entry.module);
// AnonymousError.detail() can return a JSON-encoded string for
// structured payloads (e.g. {"repoId":"...","terms":[],"fullName":...}).
// Try to parse it so the renderer can pretty-print it multi-line
// instead of dumping an unreadable escape-soup blob.
let detailValue = detail && detail.detail;
if (typeof detailValue === "string") {
const trimmed = detailValue.trim();
if (trimmed[0] === "{" || trimmed[0] === "[") {
try {
detailValue = JSON.parse(detailValue);
} catch {
/* leave as string */
}
}
}
push("detail", detailValue);
push("repoId", detail && detail.repoId);
push("filePath", detail && detail.filePath);
push("upstreamStatus", detail && detail.upstreamStatus);
push("upstreamBody", detail && detail.upstreamBody);
push("url", entry._url);
push("err", detail && detail.err);
push("cause", detail && !detail.err && detail.cause);
push("ts", entry.ts);
if (!fields.length) return JSON.stringify(entry, null, 2);
const keyW = fields.reduce((w, f) => Math.max(w, f[0].length), 0);
const lines = ["{"];
fields.forEach(([k, v], i) => {
const key = `"${k}":`.padEnd(keyW + 3, " ");
const prefix = ` ${key} `;
const comma = i < fields.length - 1 ? "," : "";
let val;
if (v && typeof v === "object") {
// Indent continuation lines under the value column so the nested
// object reads like a column instead of breaking flow.
const pad = " ".repeat(prefix.length);
val = JSON.stringify(v, null, 2)
.split("\n")
.map((ln, idx) => (idx === 0 ? ln : pad + ln))
.join("\n");
} else if (typeof v === "number" || typeof v === "boolean") {
val = String(v);
} else {
val = JSON.stringify(v);
}
lines.push(`${prefix}${val}${comma}`);
});
lines.push("}");
return lines.join("\n");
}
// Lightweight filter parser. Pulls `key:value` and `status:>=400` style
// tokens out of the search box; everything else falls back to a free
// text contains-match against the rendered fields.
function parseFilter(input) {
const filters = [];
let free = "";
const re = /(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g;
let lastEnd = 0;
let m;
while ((m = re.exec(input))) {
free += input.slice(lastEnd, m.index);
lastEnd = re.lastIndex;
filters.push({ key: m[1], op: m[2] || "=", val: m[3] });
}
free += input.slice(lastEnd);
return { filters, free: free.trim().toLowerCase() };
}
function matchFilter(row, parsed) {
for (const f of parsed.filters) {
const cmp = (a, b, op) => {
const an = parseFloat(a);
const bn = parseFloat(b);
if (op === "=") return String(a) === String(b);
if (op === "!=") return String(a) !== String(b);
if (op === ">=") return an >= bn;
if (op === "<=") return an <= bn;
if (op === ">") return an > bn;
if (op === "<") return an < bn;
return true;
};
let v;
if (f.key === "code") v = row.displayMessage;
else if (f.key === "module") v = row.module;
else if (f.key === "status") v = row._status;
else if (f.key === "url") v = row._url;
else if (f.key === "repo") v = row._repoId;
else if (f.key === "level") v = row.level;
else continue;
if (v == null) return false;
if (!cmp(v, f.val, f.op)) return false;
}
if (parsed.free) {
const hay = (
(row.displayMessage || "") + " " +
(row.module || "") + " " +
(row._url || "") + " " +
JSON.stringify(row.raw || [])
).toLowerCase();
if (hay.indexOf(parsed.free) === -1) return false;
}
return true;
}
function recompute() {
const parsed = parseFilter(state.query.search || "");
state.parsedFilterCount = parsed.filters.length;
const bucket = state.query.bucket;
let rows = state.entries.filter((e) => {
if (bucket && e._bucket !== bucket) return false;
return matchFilter(e, parsed);
});
const group = state.query.group;
if (group) {
const keyOf = (r) =>
group === "module" ? JSON.stringify([r.module, r._bucket]) : JSON.stringify([r.raw?.[0]?.service || "unknown", r.module, r.displayMessage || r.message || "_", r._bucket, r._status]);
const map = new Map();
for (const r of rows) {
const k = keyOf(r);
if (!map.has(k)) {
const seed = Object.assign({}, r);
seed._key = `${group}:${k}`;
seed._related = [r];
seed._firstSeen = r.ts;
seed._lastHourCount = 0;
seed.count = 1;
map.set(k, seed);
} else {
const g = map.get(k);
g.count++;
g._related.push(r);
if (new Date(r.ts) > new Date(g.ts)) {
g.ts = r.ts;
g._url = r._url;
g._status = r._status;
}
if (new Date(r.ts) < new Date(g._firstSeen)) g._firstSeen = r.ts;
}
}
// count "this hour"
const cutoffH = Date.now() - 3600 * 1000;
for (const g of map.values()) {
g._lastHourCount = g._related.filter((r) => new Date(r.ts).getTime() >= cutoffH).length;
}
rows = Array.from(map.values());
} else {
rows = rows.map((r, i) => {
r._key = "row:" + i + ":" + r.ts;
r._related = [r];
r._firstSeen = r.ts;
r._lastHourCount = 0;
r.count = 1;
return r;
});
}
// Errors surface first, then warnings, then routine info; within a level, the chosen order.
const rank = (r) => ({ error: 0, warn: 1, info: 2 })[r._bucket] ?? 1;
if (state.query.sort === "count") {
rows.sort((a, b) => rank(a) - rank(b) || b.count - a.count || new Date(b.ts) - new Date(a.ts));
} else {
rows.sort((a, b) => rank(a) - rank(b) || new Date(b.ts) - new Date(a.ts));
}
state.visible = rows;
// A filter that matches nothing in the loaded window keeps reading older pages
// (bounded) so a 5xx counted in the tiles is not reported as "No errors captured".
const filtering = !!(state.query.bucket || (state.query.search || "").trim());
// The default view also reads on until the server errors counted in the tiles appear.
const errorsHidden = !filtering && (state.stats?.severity?.error || 0) > 0 && !rows.some((r) => r._bucket === "error") && state.entries.length < 1500;
if (((filtering && !rows.length) || errorsHidden) && state.canLoadMore?.() && !state._autoLoading && state.entries.length < 2500) {
state._autoLoading = true;
loadEntries(true);
}
}
function loadEntries(append) {
if (append && state.redisLoading) return;
const current = ++historyVersion;
state.redisLoading = true;
// On auto-refresh after the user has paginated ("Load older"),
// request the SAME-sized window from the head so we don't blow away
// their loaded tail. Newer entries take the top, the oldest visible
// ones drop off naturally as the redis list rotates.
const offset = append ? (state.redisNextOffset || state.entries.length) : 0;
const limit = append
? state.pageSize
: Math.max(state.pageSize, state.redisNextOffset || state.entries.length || state.pageSize);
http
.get("/api/admin/errors", { params: { offset, limit } })
.then(
(res) => {
if (disposed || current !== historyVersion) return;
state.redisLoading = false;
const next = (res.data.entries || []).map(decorate);
state.entries = append ? state.entries.concat(next) : next;
state.redisRedacted = (append ? state.redisRedacted || 0 : 0) + (res.data.redactedEntries || 0);
state.redisNextOffset = res.data.nextOffset ?? (offset + (res.data.entries || []).length);
state.available = !!res.data.available;
state.redisCollecting = res.data.redisCollecting !== false;
state.cap = res.data.max || state.cap;
state.total = res.data.total || state.entries.length;
state._autoLoading = false;
recompute();
},
() => { if (disposed || current !== historyVersion) return; state.redisLoading = false; state._autoLoading = false; state.available = false; }
);
}
state.loadMore = () => loadEntries(true);
state.canLoadMore = () => (state.redisNextOffset || state.entries.length) < state.total;
function loadStats(background = false) {
if (background && statsPending) return;
const current = ++statsVersion;
statsPending = true;
http.get("/api/admin/errors/stats").then(
(res) => {
if (disposed || current !== statsVersion) return;
statsPending = false;
const s = res.data || {};
state.redisStatsState = s.available === false ? "unavailable" : "ready";
const delta = s.prev24h ? Math.round(((s.last24h - s.prev24h) / s.prev24h) * 100) : 0;
state.stats = {
last24h: s.last24h || 0,
prev24h: s.prev24h || 0,
delta,
severity: s.severity || { error: 0, warn: 0, info: 0 },
unique: s.unique || { error: 0, warn: 0, info: 0 },
buckets: s.buckets || [],
dropped: s.dropped || 0,
};
recompute();
},
() => { if (!disposed && current === statsVersion) { statsPending = false; state.redisStatsState = "unavailable"; } }
);
}
function load(background = false) {
// Polls must not invalidate a slow head or pagination request. Explicit
// refreshes still supersede it; stats refresh independently of entries.
if (!background || !state.redisLoading) loadEntries();
loadStats(background);
}
// Volume chart: errors and warnings carry the height (scaled to their own peak, up to 44px);
// routine info traffic is a faint band on top, capped at 16px. Exact counts are in the tooltip.
state.barPx = (b, key) => {
const all = state.stats.buckets || [];
let maxEW = 0, maxInfo = 0;
for (const x of all) { maxEW = Math.max(maxEW, (x.error || 0) + (x.warn || 0)); maxInfo = Math.max(maxInfo, x.info || 0); }
const part = b[key] || 0;
if (!part) return 0;
if (key === "info") return maxInfo ? Math.max(2, Math.round((part / maxInfo) * (maxEW ? 16 : 60))) : 0;
const ew = (b.error || 0) + (b.warn || 0);
const h = Math.round((ew / maxEW) * 44);
return Math.max(4, Math.round((part / ew) * h));
};
state.bucketTitle = (b) => {
const t = new Date(b.hour);
return `${t.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })} · ${b.error || 0} err · ${b.warn || 0} warn · ${b.info || 0} info`;
};
state.toggle = async (row, origin) => {
historyOrigin = origin || document.activeElement;
historyScroll = state.captureErrorScroll(historyOrigin);
state.historySelected = row;
state.historyView = "overview";
state.expanded = {[row._key]:true};
await nextTick();
document.getElementById("history-inspector-title")?.focus({preventScroll:true});
document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"});
};
state.showHistoryTimeline = origin => {
state.historyView = "timeline";
if(state.traceSelection) return;
const kind=["requestId","jobId"].find(key=>state.logTraceId(state.historySelected,key));
if(kind) state.lookupTrace(kind,state.logTraceId(state.historySelected,kind),origin,state.historySelected);
};
state.closeHistory = async () => {
const key = state.historySelected?._key;
state.historySelected = null; state.expanded = {};
if (state.traceSelection) await state.closeTrace();
await nextTick();
const target = historyOrigin?.isConnected ? historyOrigin : [...document.querySelectorAll('[data-history-key]')].find(node=>node.dataset.historyKey===key);
target?.focus({preventScroll:true});
state.restoreErrorScroll(historyScroll);
};
state.setBucket = (b) => {
state.query.bucket = b;
};
state.refreshNow = () => { state.historySelected = null; state.historyView = "overview"; state.expanded = {}; if (state.traceSelection) state.closeTrace(); load(); };
state.clearAll = () => {
if (!confirm("Clear Redis error history? Central logs are unaffected.")) return;
http.delete("/api/admin/errors").then(() => state.refreshNow(), (err) => console.error(err));
};
state.exportCsv = () => {
const cols = ["ts", "level", "module", "displayMessage", "_status", "_url", "_repoId"];
const lines = [cols.join(",")];
for (const r of state.visible) {
lines.push(cols.map((c) => {
const v = r[c] == null ? "" : String(r[c]);
return /[",\n]/.test(v) ? `"${v.replace(/"/g, '""')}"` : v;
}).join(","));
}
const blob = new Blob([lines.join("\n")], { type: "text/csv;charset=utf-8" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `errors-${new Date().toISOString().slice(0, 19)}.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
};
function flashCopy(label) {
state.copyHint = `${label} copied`;
timers.timeout(() => { state.copyHint = ""; }, 1500);
}
state.copyJson = (row) => {
navigator.clipboard.writeText(row._rawJson).then(() => flashCopy("JSON"));
};
state.copyCurl = (row) => {
if (!row._url) return;
const method = row._method || "GET";
const cmd = `curl -X ${method} '${window.location.origin}${row._url}'`;
navigator.clipboard.writeText(cmd).then(() => flashCopy("curl"));
};
load();
const stop = interval(() => {
if (state.query.autoRefresh) load(true);
}, 15000);
state.on("dispose", () => { disposed = true; historyVersion++; statsVersion++; interval.cancel(stop); });
state.watch("query.search", recompute);
state.watch("query.bucket", recompute);
state.watch("query.sort", recompute);
state.watch("query.group", recompute);
};
export const overviewAdminController = function (state, http, location, interval) {
state.Math = Math;
state.watch("user.status", () => {
+2
View File
@@ -5,6 +5,7 @@ import { render as signinTemplate } from "../partials/signin.htm";
import { render as template0 } from "../partials/404.htm";
import { render as template1 } from "../partials/admin/conferences.htm";
import { render as template2 } from "../partials/admin/errors.htm";
import { render as adminEntityErrorsTemplate } from "../partials/admin/entityErrors.htm";
import { render as template3 } from "../partials/admin/overview.htm";
import { render as template4 } from "../partials/admin/queues.htm";
import { render as template5 } from "../partials/admin/repositories.htm";
@@ -39,6 +40,7 @@ export const templates = {
"partials/admin/emails.htm": adminEmailsTemplate,
"partials/admin/conferences.htm": template1,
"partials/admin/errors.htm": template2,
"partials/admin/entityErrors.htm": adminEntityErrorsTemplate,
"partials/admin/overview.htm": template3,
"partials/admin/queues.htm": template4,
"partials/admin/repositories.htm": template5,
+58 -59
View File
@@ -1,62 +1,61 @@
"use strict";(()=>{var dd=Object.defineProperty;var ud=e=>{throw TypeError(e)};var jm=(e,t,s)=>t in e?dd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Gm=(e,t)=>{for(var s in t)dd(e,s,{get:t[s],enumerable:!0})};var lt=(e,t,s)=>jm(e,typeof t!="symbol"?t+"":t,s),la=(e,t,s)=>t.has(e)||ud("Cannot "+s);var ce=(e,t,s)=>(la(e,t,"read from private field"),s?s.call(e):t.get(e)),je=(e,t,s)=>t.has(e)?ud("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ye=(e,t,s,i)=>(la(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Ge=(e,t,s)=>(la(e,t,"access private method"),s);var cd=(e,t,s,i)=>({set _(o){Ye(e,t,o,s)},get _(){return ce(e,t,i)}});var we=["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 ke={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 pd(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 fd(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,p,d,h,m,y,v=!0,b,w=i.defer(),C=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(F=>F.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=()=>v&&e.user?.username===y;function k(){v=!1,r=p=d=void 0,w.resolve(),o.clearTimeout(b)}e.on("dispose",k),e.on("routeLeave",k),e.watch(()=>e.user?.username,F=>{!y&&F?y=F:y&&F!==y&&(k(),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":d}}),D=F=>F?.status===404?"Artifact linking is not available on this server.":F?.status===401?"Sign in, then open a new artifact link from your submission.":F?.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(!v||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let F=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(F)){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,o.clearTimeout(b),m||(m=C());try{let z=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(d=z.csrf,e.handoffEnabled=z.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(d||""))throw new Error("invalid_csrf");let K=(await s.post("/api/review-consent/preview",{repositoryId:F,intent:{...r,requestId:m}},P())).data;if(!N())return;if(!K||typeof K.ticket!="string"||!K.ticket||K.ticket.length>8192||typeof K.repositoryName!="string"||!["restricted-review","anonymous-link"].iLine truncated
`))),e[Nn]=Ys(o);let r=i||o.props&&o.props.type==="number";Yn(e,t?"change":"input",u=>{u.target.composing||e[Nn](Ya(e.value,s,r))}),(s||r)&&Yn(e,"change",()=>{e.value=Ya(e.value,s,r)}),t||(Yn(e,"compositionstart",Yg),Yn(e,"compositionend",xu),Yn(e,"change",xu))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[lr];delete e[lr],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[Nn](Ya(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[Nn]=Ys(u),e.composing)return;let p=(r||e.type==="number")&&!/^0\d/.test(e.value)?_s(e.value):e.value,d=t??"";if(p===d)return;let h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===d)||(e.value=d)}},Ja={deep:!0,created(e,t,s){e[Nn]=Ys(s),Yn(e,"change",()=>{let i=e._modelValue,o=Zo(e),r=e.checked,u=e[Nn];if(Ve(i)){let p=qi(i,o),d=p!==-1;if(r&&!d)u(i.concat(o));else if(!r&&d){let h=[...i];h.splice(p,1),u(h)}}else if(rn(i)){let p=new Set(i);r?p.add(o):p.delete(o),u(p)}else u(ic(e,r))})},mounted:ec,beforeUpdate(e,t,s){e[Nn]=Ys(s),ec(e,t,s)}};function ec(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Ve(t))o=qi(t,i.props.value)>-1;else if(rn(t))o=t.has(i.props.value);else{if(t===s)return;o=an(t,ic(e,!0))}e.checked!==o&&(e.checked=o)}var It={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Yn(e,"change",()=>{let o=Array.prototype.filter.call(e.options,d=>d.selected).map(d=>s?_s(Zo(d)):Zo(d)),r=e.multiple,u=r?rn(e._modelValue)?new Set(o):o:o[0],p=e._pendingValue=[r,r?Ve(u)?o.slice():o:u];try{e[Nn](u)}finally{Ke(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[Nn]=Ys(i)},mounted(e,{value:t}){tc(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[Nn]=Ys(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!Xg(t,s[1],s[0]))&&tc(e,t)}};function Xg(e,t,s){if(!s)return an(e,t);if(Ve(e))return an(e,t);if(rn(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function tc(e,t){let s=e.multiple,i=Ve(t);if(!(s&&!i&&!rn(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],p=Zo(u);if(s)if(i){let d=typeof p;d==="string"||d==="number"?u.selected=t.some(h=>String(h)===String(p)):u.selected=qi(t,p)>-1}else u.selected=t.has(p);else if(an(Zo(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Zo(e){return"_value"in e?e._value:e.value}function ic(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var Jg=["ctrl","shift","alt","meta"],Qg={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)=>Jg.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 p=Qg[t[u]];if(p&&p(o,t))return}return e(o,...r)}))},Zg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Pt=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=gn(o.key);if(t.some(u=>u===r||Zg[u]===r))return e(o)}))},xg=yt({patchProp:Gg},Ag),nc;function ev(){return nc||(nc=Lu(xg))}var ur=((...e)=>{let t=ev().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=nv(i);if(!o)return;let r=t._component;!$e(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,tv(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function tv(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function nv(e){return ht(e)?document.querySelector(e):e}var bs=typeof document<"u";function ac(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function sv(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&ac(e.default)}var ot=Object.assign;function cr(e,t){let s={};for(let i in t){let o=t[i];s[i]=on(o)?o.map(e):e(o)}return s}var Js=()=>{},on=Array.isArray;function xa(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var lc=/#/g,ov=/&/g,iv=/\//g,rv=/=/g,av=/\?/g,dc=/\+/g,lv=/%5B/g,dv=/%5D/g,uc=/%5E/g,uv=/%60/g,cc=/%7B/g,cv=/%7C/g,pc=/%7D/g,pv=/%20/g;function el(e){return e==null?"":encodeURI(""+e).replace(cv,"|").replace(lv,"[").replace(dv,"]")}function fc(e){return el(e).replace(cc,"{").replace(pc,"}").replace(uc,"^")}function Qa(e){return el(e).replace(dc,"%2B").replace(pv,"+").replace(lc,"%23").replace(ov,"%26").replace(uv,"`").replace(cc,"{").replace(pc,"}").replace(uc,"^")}function fv(e){return Qa(e).replace(rv,"%3D")}function mv(e){return eLine truncated
"use strict";(()=>{var md=Object.defineProperty;var hd=e=>{throw TypeError(e)};var eh=(e,t,s)=>t in e?md(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var th=(e,t)=>{for(var s in t)md(e,s,{get:t[s],enumerable:!0})};var lt=(e,t,s)=>eh(e,typeof t!="symbol"?t+"":t,s),da=(e,t,s)=>t.has(e)||hd("Cannot "+s);var ce=(e,t,s)=>(da(e,t,"read from private field"),s?s.call(e):t.get(e)),He=(e,t,s)=>t.has(e)?hd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ke=(e,t,s,i)=>(da(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),ze=(e,t,s)=>(da(e,t,"access private method"),s);var gd=(e,t,s,i)=>({set _(r){Ke(e,t,r,s)},get _(){return ce(e,t,i)}});var be=["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 we={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",editor:"/script/editor.4f142d3adc.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js"};function yd(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"),r=s.get("intentId"),o=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(r||"")||!/^[a-f0-9]{64}$/.test(o||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:r,token:o}}function vd(e,t){let{http:s,promises:i,window:r}=t,o=t.takeReviewHandoff(),u=o?{clientId:o.clientId,intentId:o.intentId}:null,p,d,g,m,v,y=!0,C,k=i.defer(),w=()=>[...r.crypto.getRandomValues(new Uint8Array(16))].map(L=>L.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:o?"":"Open a new artifact link from your submission. This link is missing or invalid."});let R=()=>y&&e.user?.username===v;function b(){y=!1,o=p=d=void 0,k.resolve(),r.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,L=>{!v&&L?v=L:v&&L!==v&&(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:k.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":d}}),D=L=>L?.status===404?"Artifact linking is not available on this server.":L?.status===401?"Sign in, then open a new artifact link from your submission.":L?.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(!y||!o||e.busy||e.uncertain||e.saved||!e.user?.username)return;v=e.user.username;let L=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(L)){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,r.clearTimeout(C),m||(m=w());try{let H=(await s.get("/api/review-consent/csrf",{timeout:k.promise})).data;if(!R())return;if(d=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(d||""))throw new Error("invalid_csrf");let _=(await s.post("/api/review-consent/preview",{repositoryId:L,intent:{...o,requestId:m}},P())).data;if(!R())return;if(!_||typeof _.ticket!="string"||!_.ticket||_.ticket.length>8192||typeof _.repositoryName!="string"||!["restricted-review","anonymous-link"].iLine truncated
`))),e[Nn]=Ys(r);let o=i||r.props&&r.props.type==="number";Yn(e,t?"change":"input",u=>{u.target.composing||e[Nn](Xa(e.value,s,o))}),(s||o)&&Yn(e,"change",()=>{e.value=Xa(e.value,s,o)}),t||(Yn(e,"compositionstart",oy),Yn(e,"compositionend",oc),Yn(e,"change",oc))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let r=t??"",o=e[lr];delete e[lr],o!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==o?e[Nn](Xa(e.value,s,i)):e.value=r},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:r,number:o}},u){if(e[Nn]=Ys(u),e.composing)return;let p=(o||e.type==="number")&&!/^0\d/.test(e.value)?Hs(e.value):e.value,d=t??"";if(p===d)return;let g=e.getRootNode();(g instanceof Document||g instanceof ShadowRoot)&&g.activeElement===e&&e.type!=="range"&&(i&&t===s||r&&e.value.trim()===d)||(e.value=d)}},Ja={deep:!0,created(e,t,s){e[Nn]=Ys(s),Yn(e,"change",()=>{let i=e._modelValue,r=Zo(e),o=e.checked,u=e[Nn];if(Ve(i)){let p=Li(i,r),d=p!==-1;if(o&&!d)u(i.concat(r));else if(!o&&d){let g=[...i];g.splice(p,1),u(g)}}else if(rn(i)){let p=new Set(i);o?p.add(r):p.delete(r),u(p)}else u(uc(e,o))})},mounted:ic,beforeUpdate(e,t,s){e[Nn]=Ys(s),ic(e,t,s)}};function ic(e,{value:t,oldValue:s},i){e._modelValue=t;let r;if(Ve(t))r=Li(t,i.props.value)>-1;else if(rn(t))r=t.has(i.props.value);else{if(t===s)return;r=an(t,uc(e,!0))}e.checked!==r&&(e.checked=r)}var Vt={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Yn(e,"change",()=>{let r=Array.prototype.filter.call(e.options,d=>d.selected).map(d=>s?Hs(Zo(d)):Zo(d)),o=e.multiple,u=o?rn(e._modelValue)?new Set(r):r:r[0],p=e._pendingValue=[o,o?Ve(u)?r.slice():r:u];try{e[Nn](u)}finally{xe(()=>{e._pendingValue===p&&(e._pendingValue=void 0)})}}),e[Nn]=Ys(i)},mounted(e,{value:t}){rc(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[Nn]=Ys(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!iy(t,s[1],s[0]))&&rc(e,t)}};function iy(e,t,s){if(!s)return an(e,t);if(Ve(e))return an(e,t);if(rn(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function rc(e,t){let s=e.multiple,i=Ve(t);if(!(s&&!i&&!rn(t))){for(let r=0,o=e.options.length;r<o;r++){let u=e.options[r],p=Zo(u);if(s)if(i){let d=typeof p;d==="string"||d==="number"?u.selected=t.some(g=>String(g)===String(p)):u.selected=Li(t,p)>-1}else u.selected=t.has(p);else if(an(Zo(u),t)){e.selectedIndex!==r&&(e.selectedIndex=r);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Zo(e){return"_value"in e?e._value:e.value}function uc(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var ry=["ctrl","shift","alt","meta"],ay={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)=>ry.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]=((r,...o)=>{for(let u=0;u<t.length;u++){let p=ay[t[u]];if(p&&p(r,t))return}return e(r,...o)}))},ly={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Tt=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(r=>{if(!("key"in r))return;let o=gn(r.key);if(t.some(u=>u===o||ly[u]===o))return e(r)}))},dy=vt({patchProp:ty},Ug),ac;function uy(){return ac||(ac=Bu(dy))}var ur=((...e)=>{let t=uy().createApp(...e),{mount:s}=t;return t.mount=i=>{let r=py(i);if(!r)return;let o=t._component;!Fe(o)&&!o.render&&!o.template&&(o.template=r.innerHTML),r.nodeType===1&&(r.textContent="");let u=s(r,!1,cy(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),u},t});function cy(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function py(e){return ht(e)?document.querySelector(e):e}var bs=typeof document<"u";function pc(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function fy(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&pc(e.default)}var ot=Object.assign;function cr(e,t){let s={};for(let i in t){let r=t[i];s[i]=on(r)?r.map(e):e(r)}return s}var Qs=()=>{},on=Array.isArray;function el(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var fc=/#/g,my=/&/g,hy=/\//g,gy=/=/g,yy=/\?/g,mc=/\+/g,vy=/%5B/g,by=/%5D/g,hc=/%5E/g,wy=/%60/g,gc=/%7B/g,ky=/%7C/g,yc=/%7D/g,Cy=/%20/g;function tl(e){return e==null?"":encodeURI(""+e).replace(ky,"|").replace(vy,"[").replace(by,"]")}function vc(e){return tl(e).replace(gc,"{").replace(yc,"}").replace(hc,"^")}function Za(e){return tl(e).replace(mc,"%2B").replace(Cy,"+").replace(fc,"%23").replace(my,"%26").replace(wy,"`").replace(gc,"{").replace(yc,"}").replace(hc,"^")}function Ey(e){return Za(e).replace(gy,"%3D")}function Sy(e){return tLine truncated
${JSON.stringify(e)}${t?`
while being at
`+JSON.stringify(t):""}`},[vt.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${Sv(t)}" via a navigation guard.`},[vt.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[vt.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[vt.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function ys(e,t){return ot(new Error,{type:e,[Cc]:!0},t)}function Rn(e,t){return e instanceof Error&&Cc in e&&(t==null||!!(e.type&t))}var Cv=["params","query","hash"];function Sv(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of Cv)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Sc(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(dc," "),r=o.indexOf("="),u=Xs(r<0?o:o.slice(0,r)),p=r<0?null:Xs(o.slice(r+1));if(u in t){let d=t[u];on(d)||(d=t[u]=[d]),d.push(p)}else t[u]=p}return t}function il(e){let t="";for(let s in e){let i=e[s];if(s=fv(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(on(i)?i.map(o=>o&&Qa(o)):[i&&Qa(i)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+s,o!=null&&(t+="="+o))})}return t}function Ec(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=on(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}var Nc=Symbol(""),rl=Symbol(""),hr=Symbol(""),gr=Symbol(""),vr=Symbol("");function Qs(){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 _n(e,t,s,i,o,r=u=>u()){let u=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((p,d)=>{let h=v=>{v===!1?d(ys(vt.NAVIGATION_ABORTED,{from:s,to:t})):v instanceof Error?d(v):kv(v)?d(ys(vt.NAVIGATION_GUARD_REDIRECT,{from:t,to:v})):(u&&i.enterCallbacks[o]===u&&typeof v=="function"&&u.push(v),p())},m=r(()=>e.call(i&&i.instances[o],t,s,h)),y=Promise.resolve(m);e.length<3&&(y=y.then(h)),y.catch(v=>d(v))})}function yr(e,t,s,i,o=r=>r()){let r=[];for(let u of e)for(let p in u.components){let d=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(ac(d)){let h=(d.__vccOpts||d)[t];h&&r.push(_n(h,s,i,u,p,o))}else{let h=d();r.push(()=>h.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let y=sv(m)?m.default:m;u.mods[p]=m,u.components[p]=y;let v=(y.__vccOpts||y)[t];return v&&_n(v,s,i,u,p,o)()}))}}return r}function Rc(e,t){let s=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let u=0;u<r;u++){let p=t.matched[u];p&&(e.matched.find(h=>vs(h,p))?i.push(p):s.push(p));let d=e.matched[u];d&&(t.matched.find(h=>vs(h,d))||o.push(d))}return[s,i,o]}var Ev=()=>location.protocol+"//"+location.host;function $c(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,p=o.slice(u);return p[0]!=="/"&&(p="/"+p),tl(p,"")}return tl(s,e)+i+o}function Nv(e,t,s,i){let o=[],r=[],u=null,p=({state:v})=>{let b=$c(e,location),w=s.value,C=t.value,N=0;if(v){if(s.value=b,t.value=v,u&&u===w){u=null;return}N=C?v.position-C.position:0}else i(b);o.forEach(k=>{k(s.value,w,{delta:N,type:fr.pop,direction:N?N>0?mr.forward:mr.back:mr.unknown})})};function d(){u=s.value}function h(v){o.push(v);let b=()=>{let w=o.indexOf(v);w>-1&&o.splice(w,1)};return r.push(b),b}function m(){if(document.visibilityState==="hidden"){let{history:v}=window;if(!v.state)return;v.replaceState(ot({},v.state,{scroll:xo()}),"")}}function y(){for(let v of r)v();r=[],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:d,listen:h,destroy:y}}function Tc(e,t,s,i=!1,o=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:o?xo():null}}function Rv(e){let{history:t,location:s}=window,i={value:$c(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(d,h,m){let y=e.indexOf("#"),v=y>-1?(s.host&&document.querySelector("base")?e:e.slice(y))+d:Ev()+e+d;try{t[m?"replaceState":"pushState"](h,"",v),o.value=h}catch(b){console.error(b),s[m?"replace":"assign"](v)}}function u(d,h){r(d,ot({},t.state,Tc(o.value.back,d,o.value.forward,!0),h,{position:o.value.position}),!0),i.value=d}function p(d,h){let m=ot({},o.value,t.state,{forward:d,scroll:xo()});r(m.current,m,!0),r(d,ot({},Tc(i.value,d,null),{position:m.position+1},h),!1),i.value=d}return{location:i,state:o,push:p,replace:u}}function Fc(e){e=vc(e);let t=Rv(e),s=Nv(e,t.state,t.location,t.replace);function i(r,u=!0){u||s.pauseListeners(),history.go(r)}let o=ot({locatLine truncated
`);for(let m of h){if(s&&(r>0||u>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(s.lines.push({kind:"add",oldNo:"",newNo:o++,text:m.slice(1)}),u--):m.startsWith("-")?(s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)}),r--):(s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:m.slice(1)}),r--,u--);continue}if(m.startsWith("diff --git")){p(),d();continue}if(m.startsWith("--- ")){s&&s.lines.length&&p(),d().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){d().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&&(i=parseInt(y[1],10),o=parseInt(y[3],10),r=y[2]==null?1:parseInt(y[2],10),u=y[4]==null?1:parseInt(y[4],10)),d().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(s)if(m.startsWith("+"))s.lines.push({kind:"add",oldNo:"",newNo:o++,text:m.slice(1)});else if(m.startsWith("-"))s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;s.lines.push({kind:"ctx",oldNo:i++,newNo:o++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var ei=(e,t)=>{let s=[],i=[],o="",r=!1;for(let u=0;u<e.length;u++){let p=e[u];r?p==='"'?e[u+1]==='"'?(o+='"',u++):r=!1:o+=p:p==='"'&&o===""?r=!0:p===t?(i.push(o),o=""):p===`
`+JSON.stringify(t):""}`},[yt.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${My(t)}" via a navigation guard.`},[yt.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[yt.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[yt.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function vs(e,t){return ot(new Error,{type:e,[Tc]:!0},t)}function Rn(e,t){return e instanceof Error&&Tc in e&&(t==null||!!(e.type&t))}var Oy=["params","query","hash"];function My(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;let t={};for(let s of Oy)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Pc(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 r=s[i].replace(mc," "),o=r.indexOf("="),u=Xs(o<0?r:r.slice(0,o)),p=o<0?null:Xs(r.slice(o+1));if(u in t){let d=t[u];on(d)||(d=t[u]=[d]),d.push(p)}else t[u]=p}return t}function rl(e){let t="";for(let s in e){let i=e[s];if(s=Ey(s),i==null){i!==void 0&&(t+=(t.length?"&":"")+s);continue}(on(i)?i.map(r=>r&&Za(r)):[i&&Za(i)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+s,r!=null&&(t+="="+r))})}return t}function Dc(e){let t={};for(let s in e){let i=e[s];i!==void 0&&(t[s]=on(i)?i.map(r=>r==null?null:""+r):i==null?i:""+i)}return t}var Ac=Symbol(""),al=Symbol(""),hr=Symbol(""),gr=Symbol(""),yr=Symbol("");function Js(){let e=[];function t(i){return e.push(i),()=>{let r=e.indexOf(i);r>-1&&e.splice(r,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function Hn(e,t,s,i,r,o=u=>u()){let u=i&&(i.enterCallbacks[r]=i.enterCallbacks[r]||[]);return()=>new Promise((p,d)=>{let g=y=>{y===!1?d(vs(yt.NAVIGATION_ABORTED,{from:s,to:t})):y instanceof Error?d(y):Iy(y)?d(vs(yt.NAVIGATION_GUARD_REDIRECT,{from:t,to:y})):(u&&i.enterCallbacks[r]===u&&typeof y=="function"&&u.push(y),p())},m=o(()=>e.call(i&&i.instances[r],t,s,g)),v=Promise.resolve(m);e.length<3&&(v=v.then(g)),v.catch(y=>d(y))})}function vr(e,t,s,i,r=o=>o()){let o=[];for(let u of e)for(let p in u.components){let d=u.components[p];if(!(t!=="beforeRouteEnter"&&!u.instances[p]))if(pc(d)){let g=(d.__vccOpts||d)[t];g&&o.push(Hn(g,s,i,u,p,r))}else{let g=d();o.push(()=>g.then(m=>{if(!m)throw new Error(`Couldn't resolve component "${p}" at "${u.path}"`);let v=fy(m)?m.default:m;u.mods[p]=m,u.components[p]=v;let y=(v.__vccOpts||v)[t];return y&&Hn(y,s,i,u,p,r)()}))}}return o}function Ic(e,t){let s=[],i=[],r=[],o=Math.max(t.matched.length,e.matched.length);for(let u=0;u<o;u++){let p=t.matched[u];p&&(e.matched.find(g=>ys(g,p))?i.push(p):s.push(p));let d=e.matched[u];d&&(t.matched.find(g=>ys(g,d))||r.push(d))}return[s,i,r]}var Vy=()=>location.protocol+"//"+location.host;function zc(e,t){let{pathname:s,search:i,hash:r}=t,o=e.indexOf("#");if(o>-1){let u=r.includes(e.slice(o))?e.slice(o).length:1,p=r.slice(u);return p[0]!=="/"&&(p="/"+p),nl(p,"")}return nl(s,e)+i+r}function qy(e,t,s,i){let r=[],o=[],u=null,p=({state:y})=>{let C=zc(e,location),k=s.value,w=t.value,R=0;if(y){if(s.value=C,t.value=y,u&&u===k){u=null;return}R=w?y.position-w.position:0}else i(C);r.forEach(b=>{b(s.value,k,{delta:R,type:fr.pop,direction:R?R>0?mr.forward:mr.back:mr.unknown})})};function d(){u=s.value}function g(y){r.push(y);let C=()=>{let k=r.indexOf(y);k>-1&&r.splice(k,1)};return o.push(C),C}function m(){if(document.visibilityState==="hidden"){let{history:y}=window;if(!y.state)return;y.replaceState(ot({},y.state,{scroll:xo()}),"")}}function v(){for(let y of o)y();o=[],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:d,listen:g,destroy:v}}function Oc(e,t,s,i=!1,r=!1){return{back:e,current:t,forward:s,replaced:i,position:window.history.length,scroll:r?xo():null}}function Ly(e){let{history:t,location:s}=window,i={value:zc(e,s)},r={value:t.state};r.value||o(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(d,g,m){let v=e.indexOf("#"),y=v>-1?(s.host&&document.querySelector("base")?e:e.slice(v))+d:Vy()+e+d;try{t[m?"replaceState":"pushState"](g,"",y),r.value=g}catch(C){console.error(C),s[m?"replace":"assign"](y)}}function u(d,g){o(d,ot({},t.state,Oc(r.value.back,d,r.value.forward,!0),g,{position:r.value.position}),!0),i.value=d}function p(d,g){let m=ot({},r.value,t.state,{forward:d,scroll:xo()});o(m.current,m,!0),o(d,ot({},Oc(i.value,d,null),{position:m.position+1},g),!1),i.value=d}return{location:i,state:r,push:p,replace:u}}function jc(e){e=Cc(e);let t=Ly(e),s=qy(e,t.state,t.location,t.replace);function i(o,u=!0){u||s.pauseListeners(),history.go(o)}let r=ot({locatLine truncated
`);for(let m of g){if(s&&(o>0||u>0)&&/^([-+ ]|$)/.test(m)){m.startsWith("+")?(s.lines.push({kind:"add",oldNo:"",newNo:r++,text:m.slice(1)}),u--):m.startsWith("-")?(s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)}),o--):(s.lines.push({kind:"ctx",oldNo:i++,newNo:r++,text:m.slice(1)}),o--,u--);continue}if(m.startsWith("diff --git")){p(),d();continue}if(m.startsWith("--- ")){s&&s.lines.length&&p(),d().oldPath=m.replace(/^--- (a\/)?/,"").trim();continue}if(m.startsWith("+++ ")){d().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 v=m.match(/@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);v&&(i=parseInt(v[1],10),r=parseInt(v[3],10),o=v[2]==null?1:parseInt(v[2],10),u=v[4]==null?1:parseInt(v[4],10)),d().lines.push({kind:"hunk",oldNo:"",newNo:"",text:m});continue}if(s)if(m.startsWith("+"))s.lines.push({kind:"add",oldNo:"",newNo:r++,text:m.slice(1)});else if(m.startsWith("-"))s.lines.push({kind:"remove",oldNo:i++,newNo:"",text:m.slice(1)});else{if(m.startsWith("\\"))continue;s.lines.push({kind:"ctx",oldNo:i++,newNo:r++,text:m.startsWith(" ")?m.slice(1):m})}}}return p(),t}var ei=(e,t)=>{let s=[],i=[],r="",o=!1;for(let u=0;u<e.length;u++){let p=e[u];o?p==='"'?e[u+1]==='"'?(r+='"',u++):o=!1:r+=p:p==='"'&&r===""?o=!0:p===t?(i.push(r),r=""):p===`
`||p==="\r"?(p==="\r"&&e[u+1]===`
`&&u++,i.push(o),s.push(i),i=[],o=""):o+=p}return(o!==""||i.length)&&(i.push(o),s.push(i)),s.filter(u=>u.length>1||u[0]!=="")},Zs=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),Zv=(function(){let e=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=s=>{let i=['<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(s.path)+'</span><span class="diff-file-status diff-file-status-'+s.status+'">'+s.status+"</span></div>"];if(s.lines.length){i.push('<table class="diff-file-table"><tbody>');for(let o of s.lines)i.push('<tr class="diff-row diff-row-'+o.kind+'"><td class="diff-gutter diff-gutter-old">'+(o.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(o.newNo||"")+'</td><td class="diff-sign">'+(o.kind==="add"?"+":o.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Zs(o.text)+'ch">'+e(o.text)+"</td></tr>");i.push("</tbody></table>")}return i.push("</div>"),i.join("")};return s=>s&&Tr(s).map(t).join("")})();function dl(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function xv(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 ey(e){return String(e??"").toUpperCase()}function ty(e,t,s=0){return(e||[]).slice(s,s+t)}function ny(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function sy(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 p=r.split(".").reduce((h,m)=>h?.[m],i),d=r.split(".").reduce((h,m)=>h?.[m],o);if(typeof p=="string"&&(p=p.toLowerCase()),typeof d=="string"&&(d=d.toLowerCase()),p!==d)return(p==null?-1:d==null?1:p<d?-1:1)*u}return 0})}function Pr(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 oy(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function Ar(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 p=Math.abs(r),d=Math.round(p/30.44),h=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:d<18?[d,"month"]:[Math.round(p/365.25),"year"],m=h[0]+" "+h[1]+(h[0]===1?"":"s");u=r>0?"in "+m:m+" ago"}return i+" \xB7 "+u}function Xn(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 Dr(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 Hc(e,t){return t?.split(".").reduce((s,i)=>s?.[i],e)}function ti(e=null,t=new Map){let s=ut({}),i=[],o=!1,r=new Proxy(s,{get(u,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(u,p)?Reflect.get(u,p):e?.[p]}});return Object.defineProperty(s,"parent",{value:e,configurable:!0}),Object.defineProperty(s,"viewState",{get:()=>r}),r.watch=(u,p,d=!1,h=!0)=>{let m=typeof u=="function"?()=>u(r):()=>Hc(r,u),y=dt(m,p,{deep:d,flush:"post"});return i.push(y),h&&Ke(()=>{o||p(m(),m())}),y},r.watchGroup=(u,p,d=!0)=>r.watch(()=>u.map(h=>Hc(r,h)),p,!0,d),r.on=(u,p)=>{if(u==="dispose")return i.push(p),()=>{};t.has(u)||t.set(u,new Set),t.get(u).add(p);let d=()=>t.get(u)?.delete(p);return i.push(d),d},r.emit=(u,...p)=>{for(let d of[...t.get(u)||[]])d({},...p)},r.dispose=()=>{o=!0,i.splice(0).reverse().forEach(u=>u())},Ln(r.dispose),r}function Et(){let e=new Set,t=new Set,s=!1,i=(r,u=0)=>{if(s)return;let p=setTimeout(()=>{e.delete(p),r()},u);return e.add(p),p};i.cancel=r=>{clearTimeout(r),e.delete(r)};let o=(r,u)=>{if(s)return;let p=setInterval(r,u);return t.add(p),p};return o.cancel=r=>{clearInterval(r),t.delete(r)},Ln(()=>{s=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:i,interval:o}}function qt(){let e=new Set;return L Line truncated
`&&u++,i.push(r),s.push(i),i=[],r=""):r+=p}return(r!==""||i.length)&&(i.push(r),s.push(i)),s.filter(u=>u.length>1||u[0]!=="")},Zs=e=>Math.min(((e||"").match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length+4,24),lv=(function(){let e=s=>s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t=s=>{let i=['<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(s.path)+'</span><span class="diff-file-status diff-file-status-'+s.status+'">'+s.status+"</span></div>"];if(s.lines.length){i.push('<table class="diff-file-table"><tbody>');for(let r of s.lines)i.push('<tr class="diff-row diff-row-'+r.kind+'"><td class="diff-gutter diff-gutter-old">'+(r.oldNo||"")+'</td><td class="diff-gutter diff-gutter-new">'+(r.newNo||"")+'</td><td class="diff-sign">'+(r.kind==="add"?"+":r.kind==="remove"?"-":"")+'</td><td class="diff-code" style="--hang:'+Zs(r.text)+'ch">'+e(r.text)+"</td></tr>");i.push("</tbody></table>")}return i.push("</div>"),i.join("")};return s=>s&&Tr(s).map(t).join("")})();function ul(e,t){return e==null?"":Number(e).toLocaleString(void 0,t==null?{}:{minimumFractionDigits:t,maximumFractionDigits:t})}function dv(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 uv(e){return String(e??"").toUpperCase()}function cv(e,t,s=0){return(e||[]).slice(s,s+t)}function pv(e,t){return Array.isArray(e)?typeof t=="function"?e.filter(t):e:[]}function fv(e,t){if(!t)return e||[];let s=Array.isArray(t)?t:[t];return[...e||[]].sort((i,r)=>{for(let o of s){let u=o[0]==="-"?-1:1;o=o.replace(/^[+-]/,"");let p=o.split(".").reduce((g,m)=>g?.[m],i),d=o.split(".").reduce((g,m)=>g?.[m],r);if(typeof p=="string"&&(p=p.toLowerCase()),typeof d=="string"&&(d=d.toLowerCase()),p!==d)return(p==null?-1:d==null?1:p<d?-1:1)*u}return 0})}function Pr(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,r=>i[r])}function mv(e,t){return(t?.[e]??t?.[e===1?"one":"other"]??"").replace(/\{\}/g,e??0)}function Dr(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"}),r=new Date;r.setHours(0,0,0,0);let o=Math.round((s-r)/864e5),u;if(o===0)u="today";else if(o===1)u="tomorrow";else if(o===-1)u="yesterday";else{let p=Math.abs(o),d=Math.round(p/30.44),g=p<14?[p,"day"]:p<60?[Math.round(p/7),"week"]:d<18?[d,"month"]:[Math.round(p/365.25),"year"],m=g[0]+" "+g[1]+(g[0]===1?"":"s");u=o>0?"in "+m:m+" ago"}return i+" \xB7 "+u}function Xn(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=o=>String(o).padStart(2,"0"),r=Math.round(s);return r<3600?Math.floor(r/60)+"m "+i(r%60)+"s":Math.floor(r/3600)+"h "+i(Math.floor(r%3600/60))+"m"}function Ar(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 Yc(e,t){return t?.split(".").reduce((s,i)=>s?.[i],e)}function ti(e=null,t=new Map){let s=ut({}),i=[],r=!1,o=new Proxy(s,{get(u,p){return typeof p=="string"&&p.startsWith("__v_")||Reflect.has(u,p)?Reflect.get(u,p):e?.[p]}});return Object.defineProperty(s,"parent",{value:e,configurable:!0}),Object.defineProperty(s,"viewState",{get:()=>o}),o.watch=(u,p,d=!1,g=!0)=>{let m=typeof u=="function"?()=>u(o):()=>Yc(o,u),v=dt(m,p,{deep:d,flush:"post"});return i.push(v),g&&xe(()=>{r||p(m(),m())}),v},o.watchGroup=(u,p,d=!0)=>o.watch(()=>u.map(g=>Yc(o,g)),p,!0,d),o.on=(u,p)=>{if(u==="dispose")return i.push(p),()=>{};t.has(u)||t.set(u,new Set),t.get(u).add(p);let d=()=>t.get(u)?.delete(p);return i.push(d),d},o.emit=(u,...p)=>{for(let d of[...t.get(u)||[]])d({},...p)},o.dispose=()=>{r=!0,i.splice(0).reverse().forEach(u=>u())},qn(o.dispose),o}function Pt(){let e=new Set,t=new Set,s=!1,i=(o,u=0)=>{if(s)return;let p=setTimeout(()=>{e.delete(p),o()},u);return e.add(p),p};i.cancel=o=>{clearTimeout(o),e.delete(o)};let r=(o,u)=>{if(s)return;let p=setInterval(o,u);return t.add(p),p};return r.cancel=o=>{clearInterval(o),t.delete(o)},qn(()=>{s=!0,e.forEach(clearTimeout),t.forEach(clearInterval)}),{timeout:i,interval:r}}function Lt(){let e=new Set;return q Line truncated
`)+`
`,Kc=e=>String(e??"").replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function ep(e,t,s=[]){return["| "+e.map(Kc).join(" | ")+" |","| "+e.map((o,r)=>s[r]?"---:":"---").join(" | ")+" |",...t.map(o=>"| "+e.map((r,u)=>Kc(o[u])).join(" | ")+" |")].join(`
`,Zc=e=>String(e??"").replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function ip(e,t,s=[]){return["| "+e.map(Zc).join(" | ")+" |","| "+e.map((r,o)=>s[o]?"---:":"---").join(" | ")+" |",...t.map(r=>"| "+e.map((o,u)=>Zc(r[u])).join(" | ")+" |")].join(`
`)+`
`}var yy=Object.freeze({view:"table",query:"",sort:null,group:null,agg:"mean",sum:"mean",ranges:{},values:{},sums:{},numeric:[],chart:null,x:null,y:[]});function by(e){let t=new URLSearchParams;e.view&&e.view!=="table"&&t.set("view",e.view),e.query&&t.set("q",e.query),e.sort?.column&&t.set("sort",e.sort.column+(e.sort.dir==="desc"?":desc":"")),e.group&&t.set("group",e.group),e.group&&e.agg&&e.agg!=="mean"&&t.set("agg",e.agg);for(let[s,[i,o]]of Object.entries(e.ranges||{}))(i!=null||o!=null)&&t.set("range."+s,(i??"")+"~"+(o??""));for(let[s,i]of Object.entries(e.values||{}))for(let o of i||[])t.append("in."+s,o);e.sum&&e.sum!=="mean"&&t.set("sum",e.sum);for(let[s,i]of Object.entries(e.sums||{}))i&&i!==(e.sum||"mean")&&t.set("sum."+s,i);return e.numeric?.length&&t.set("num",e.numeric.join("|")),e.chart&&t.set("chart",e.chart),e.x&&t.set("x",e.x),e.y?.length&&t.set("y",e.y.join("|")),t.toString()}function wy(e){var d,h;let t=new URLSearchParams(e||""),s={...yy,ranges:{},values:{},sums:{},numeric:[],y:[]},i=t.get("view");["table","chart","raw"].includes(i)&&(s.view=i),s.query=t.get("q")||"";let o=t.get("sort");if(o){let m=/^(.*?)(?::(asc|desc))?$/.exec(o);s.sort={column:m[1],dir:m[2]||"asc"}}s.group=t.get("group")||null;let r=t.get("agg");r&&ni[r]&&(s.agg=r);for(let[m,y]of t.entries())if(m.startsWith("range.")){let[v,b]=y.split("~").map(w=>w===""||w==null?null:Number(w));s.ranges[m.slice(6)]=[Number.isFinite(v)?v:null,Number.isFinite(b)?b:null]}else m.startsWith("in.")?((d=s.values)[h=m.slice(3)]||(d[h]=[])).push(y):m.startsWith("sum.")&&ni[y]&&(s.sums[m.slice(4)]=y);let u=t.get("sum");u&&ni[u]&&(s.sum=u),s.numeric=(t.get("num")||"").split("|").filter(Boolean);let p=t.get("chart");return["bar","line","scatter"].includes(p)&&(s.chart=p),s.x=t.get("x")||null,s.y=(t.get("y")||"").split("|").filter(Boolean),s}var ml=e=>"#"+e+":";function eo(e,t){if(!t||typeof e!="string"||!e.startsWith(ml(t)))return null;try{return wy(e.slice(ml(t).length))}catch{return null}}function tp(e,t){let s=by(t);return s?ml(e)+s.replace(/%3A/gi,":").replace(/%7C/gi,"|").replace(/%7E/gi,"~").replace(/%2C/gi,","):""}var vl=e=>/^#table(?:-\d+)?:/.test(e||"");var yl=function(e,t=e){let s=/\bXXXX-\d+\b/g;t.on("dark-mode",(L,E)=>{e.aceOption&&(e.aceOption.theme=E?"nord_dark":"chrome")});let i=Et(),o=qt();e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);let r={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},u=["license","txt"],p=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],d=["wav","mp3","ogg","wma","flac","aac","m4a"],h=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.toggleSource=function(){e.showSource=!e.showSource},e.toggleAllowScripts=function(){e.allowScripts=!e.allowScripts};let m=(()=>{try{return window.localStorage?.getItem("wrapLines")}catch{return null}})();e.wrapLines=(m??(window.matchMedia?.("(max-width: 767px)").matches?"false":"true"))!=="false",e.toggleWrap=function(){e.wrapLines=!e.wrapLines;try{window.localStorage?.setItem("wrapLines",String(e.wrapLines))}catch{}e.codeEditor?.session.setUseWrapMode(e.wrapLines)};function y(){return window.document.querySelector(".reading-layout .markdown-body")}function v(){let L=y();L&&(L.querySelectorAll("mark.md-find").forEach(E=>{E.replaceWith(window.document.createTextNode(E.textContent))}),L.normalize())}e.runMdFind=function(){v(),e.mdFindTotal=0,e.mdFindIndex=0;let L=(e.mdFindQuery||"").trim(),E=y();if(!L||!E)return;let q=!!e.mdFindCase,Y=q?L:L.toLowerCase(),X=window.document.createTreeWalker(E,4),j=[];for(;X.nextNode();)(q?X.currentNode.nodeValue:X.currentNode.nodeValue.toLowerCase()).includes(Y)&&j.push(X.currentNode);let se=0;for(let te of j){let he=te.nodeValue,Se=q?he:he.toLowerCase(),_e=window.document.createDocumentFragment(),et=0,ze;for(;(ze=Se.indexOf(Y,et))!==-1;){_e.appendChild(window.document.createTextNode(he.slice(et,ze)));let He=window.document.createElement("mark");He.className="md-find",He.textContent=he.slice(ze,ze+L.length),_e.appendChild(He),se++,et=ze+L.length}_e.appendChild(window.document.createTextNode(he.slice(et))),te.parentNode.replaceChild(_e,te)}e.mdFindTotal=se,se&&e.stepMdFind(0)},e.stepMdFind=function(L){let E=y();if(!E||!e.mdFindTotal)return;let q=E.querySelectorAll("mark.md-find");e.mdFindIndex=(e.mdFindIndex+L+q.length)%q.length,q.forEach((Y,X)=>Y.classList.toggle("is-current",X===e.mdFindIndex)),q[e.mdFindIndex]?.scrollIntoView({block:"center",behavior:"smooth"})},e.toggleMdFind=function(L){if(e.mdFindOpen=L===void 0?!e.mdFindOpen:L,!e.mdFindOpen){v(),e.mdFindTotal=0;return}Ke(()=>window.document.querySelector(".md-find-input")?.focus())},e.findInFile=function(){let L=e.codeEditor;if(!L)return;L.focus(),L.execCommand("find");let E=()=>{let q=L.searchBox?.element;q&&(L.renderer.setScrollMargin(52,12,0,0),!q._dockObserver&&(q._dockObserver=new MutationObserver(()=>{L.renderer.setScrollMargin(q.style.display!=="none" Line truncated
`).forEach((E,q)=>{for(let[Y,X]of b){let j=Y.exec(E);if(j&&!/^(if|for|while|switch|return|catch)$/.test(j[1])){L.push({name:j[1],kind:X,line:q+1});break}}}),w={content:e.content,list:L.slice(0,300)},w.list},e.goToSymbol=function(L){e.symbolsOpen=!1;let E=e.codeEditor;E&&(E.scrollToLine(L-1,!0,!0,()=>{}),E.gotoLine(L,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+L),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 L=window.document.getElementById("goto-input");L&&(L.focus(),L.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let L=e.codeEditor;if(!L)return;let E=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),q=L.session.getLength();if(!E||+E[1]<1||+E[1]>q){e.gotoError="Enter a line from 1 to "+q;return}L.gotoLine(+E[1],E[2]?Math.max(0,+E[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",L.focus()},e.rootEntries=function(){return[...e.files||[]].sort((L,E)=>{let q=L.size==null,Y=E.size==null;return q!==Y?q?-1:1:L.name.localeCompare(E.name)})},e.formatSize=function(L){if(L==null)return"";if(L<1024)return L+" B";let E=L/1024,q=Y=>Y.toFixed(1).replace(/\.0$/,"");return E<1024?q(E)+" KB":E<1024*1024?q(E/1024)+" MB":q(E/1024/1024)+" GB"},e.fileSize=function(L){if(!L)return null;let E=L.replace(/^\/+/,""),q=(e.files||[]).find(Y=>(Y.path?Y.path+"/":"")+Y.name===E);return q&&q.size!=null?q.size:null},e.revealFolder=function(L){e.sidebarHidden=!1,e.sidebarCollapsed=!1,Ke(()=>{let E=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(L):L)+'"]');E&&(E.closest("li")?.classList.contains("open")||E.click(),E.scrollIntoView({block:"nearest"}),E.focus())})};let C={content:null,n:0},N=L=>{if(C.content===L)return C.n;let E=L;if(typeof E=="string")try{E=JSON.parse(E)}catch{E=null}let q=[],Y=j=>{Array.isArray(j)?q.push(j.join("")):typeof j=="string"&&q.push(j)};(E&&(E.cells||(E.worksheets||[]).flatMap(j=>j.cells||[]))||[]).forEach(j=>{Y(j?.source??j?.input),(j?.outputs||[]).forEach(se=>{Y(se?.text),se?.data&&(Y(se.data["text/plain"]),Y(se.data["text/markdown"]),Y(se.data["text/html"])),Y(se?.traceback)})});let X=q.reduce((j,se)=>j+(se.match(s)||[]).length,0);return C={content:L,n:X},X};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=to;let k=L=>L.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(L){let E=e.renderRedacted(L);if(!E||typeof window.DOMParser!="function")return E;let q=new window.DOMParser().parseFromString("<div>"+E+"</div>","text/html"),Y={};return q.querySelectorAll("h1, h2, h3").forEach(X=>{let j=X.id||k(X.textContent);Y[j]?j+="-"+ ++Y[j]:Y[j]=1,X.id=j}),q.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},D=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let L=Sr(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),E=L.length,q=null;if(L[0]?.level===1&&L.filter(Y=>Y.level===1).length===1){q=L[0],L=L.slice(1);let Y=Math.min(...L.map(X=>X.level));L=L.map(X=>({...X,depth:X.level-Y}))}return P={content:e.content,list:L,title:q,count:E},P};e.readmeToc=()=>D().list,e.tocTitle=()=>D().title,e.tocCount=()=>D().count,e.activeHeading=null,o(window,"scroll",()=>{let L=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let E=Er(L.map(q=>q.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==E&&(e.activeHeading=E)},{capture:!0,passive:!0}),e.scrollToHeading=function(L){if(!L){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}Nr(L),e.activeHeading=L};let F=()=>!e.preview&&eo(window.location.hash,"table")?.view||"table";e.csvView=F();let z={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(z.content!==e.content){let L=/\.tsv$/i.test(e.filePath||"")?" ":",";z={content:e.content,rows:ei(e.content,L)}}return z.rows},e.redactParts=Qt,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 L=e.content;if(e.type==="html"&&e.url)if(e.preview)L=e.sourceContent;else try{L=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await window.navigato Line truncated
`).length:0,Cy=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function sp(e,t){let s=qt();e.redactParts=Qt,e.hangIndent=Zs,e.isRedactedName=o=>/^XXXX-\d+$/.test(String(o||"").trim()),e.tocOpen=!1,e.activeAnchor="";let i=()=>{let o=t();if(!o.length)return;let r=Er(o,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==r&&(e.activeAnchor=r)};return s(window,"scroll",i,{capture:!0,passive:!0}),s(window,"resize",i,{passive:!0}),s(window.document,"click",o=>{e.tocOpen&&!o.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),s(window.document,"keydown",o=>{o.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=o=>{e.tocOpen=!1,Nr(o)&&(e.activeAnchor=o)},i}var qr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),Sy={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"},Ey={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"},Ny=1024*1024;function no(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=Sy[qr(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>Ny?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var Ry=e=>["markdown","notebook","csv","svg"].includes(e),np={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 Ty(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||qr(e?.filename)||"none"}var Py=e=>{let t=window.atob(e||""),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s};function op(e){e.gistViews={};let t=/^#table-(\d+):/.exec(window.location.hash||"");if(t){let u=eo(window.location.hash,"table-"+t[1])?.view;(u==="chart"||u==="raw")&&(e.gistViews[+t[1]-1]=u)}e.gistKind=u=>no(e.details?.files?.[u]),e.gistHasRendered=u=>Ry(e.gistKind(u)),e.gistView=u=>!e.gistHasRendered(u)||e.gistViews[u]==="raw"?"raw":e.gistViews[u]==="chart"&&e.gistKind(u)==="csv"?"chart":"rendered",e.setGistView=(u,p)=>{e.gistViews={...e.gistViews,[u]:p}},e.gistSourceFile=u=>{let p=e.details?.files?.[u];return{...p,language:Ty(p,e.gistKind(u)),filename:"source.txt"}};let s=new Map;Ln(()=>{s.forEach(u=>window.URL.revokeObjectURL?.(u)),s.clear()});let i=(u,p)=>{if(!u||!window.URL?.createObjectURL)return null;let d=u.encoding==="base64",h=!p||d?Ey[qr(u.filename)]||(d?"application/octet-stream":"text/plain"):"text/plain",m=(u.filename||"")+"\0"+h+"\0"+(u.content||"").length;if(!s.has(m)){let y=d?Py(u.content):u.content||"";s.set(m,window.URL.createObjectURL(new window.Blob([y],{type:h+(d?"":";charset=utf-8")})))}return s.get(m)};e.gistMediaUrl=u=>i(u,!1),e.gistRawUrl=u=>i(u,!0);let o=new WeakMap;e.gistCsvRows=u=>{if(!u)return[];let p=o.get(u);return(!p||p.content!==u.content||p.filename!==u.filename)&&(p={content:u.content,filename:u.filename,rows:ei(u.content||"",qr(u.filename)==="tsv"?" ":",")},o.set(u,p)),p.rows},e.gistCopied=null,e.copyGistFile=async u=>{let p=e.details?.files?.[u];!p||p.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(p.content||""),e.gistCopied=u,window.setTimeout(()=>{e.gistCopied===u&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=u=>"file-"+(u+1),e.setFileOutline=(u,p)=>{let d=e.fileOutlines[u];d&&d.map(h=>h.id).join()===p.map(h=>h.id).join()||(e.fileOutlines={...e.fileOutlines,[u]:p})},e.gistToc=()=>(e.details?.files||[]).map((u,p)=>({id:e.gistFileId(p),index:p,parts:Qt(u.filename),kind:no(u),language:np[no(u)]&&no(u)!=="csv"?np[no(u)]:u.language||(no(u)==="csv"?"CSV":"Text"),lines:u.encoding==="base64"?null:ky(u.content),size:u.size,headings:Cy(u)&&e.gistView(p)==="rendered"?e.fileOutlines[p]||[]:[]}));let r=()=>e.gistToc().flatMap(u=>[u.id,...u.headings.map(p=>p.id)]);e.showGistToc=()=>{let u=e.gistToc();return e.tabState?.active==="files"&&(u.length>=2||(u[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let p=e.gistToc().find(d=>d.id===e.activeAnchor||d.headings.some(h=>h.id===e.activeAnchor));return p?p.index:0},sp(e,r)}var Ay=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function ip(e){let t={diff:null,th Line truncated
`),p=i.date?e.fmt?.date(i.date):"",d=s[s.length-1];(!d||d.day!==p)&&s.push(d={day:p,commits:[]}),d.commits.push({...i,index:o+1,headline:r,detail:u.join(`
`).trim()})}),s},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let s=e.prFiles().find(i=>i.id===e.activeAnchor);return s?s.index:0},e.openTab=s=>{e.tabState={active:s},e.tocOpen=!1},e.showInDiff=s=>{s&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},Ke(()=>e.jumpToAnchor(s.id)))},e.jumpToFile=s=>{e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},e.jumpToAnchor(s.id)},sp(e,()=>e.tabState?.active==="files"?e.prFiles().map(s=>s.id):[])}function rp(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function bl(e,t,s){let i,o=!1,r="form-draft:"+s,u=()=>Object.fromEntries(t.map(v=>[v,e[v]])),p=()=>JSON.stringify(u()),d=v=>{for(let b of t)Object.prototype.hasOwnProperty.call(v,b)&&(e[b]=v[b]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},h=()=>{try{window.sessionStorage.removeItem(r)}catch{}},m=(v=!1)=>{if(i!==void 0){if(v&&document.querySelectorAll("input, select, textarea").forEach(b=>{b._field?.binding.state===e&&b._field.timer&&b._field.commit()}),e.unsavedChanges=p()!==i,e.draftSaved=!1,!e.unsavedChanges){h();return}try{window.sessionStorage.setItem(r,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:u()})),e.draftSaved=!0}catch{}}},y=()=>m(!0);return e.on("routeLeave",y),window.addEventListener("beforeunload",y),e.on("dispose",()=>window.removeEventListener("beforeunload",y)),{restore(){i=p();let v;try{v=JSON.parse(window.sessionStorage.getItem(r)||"null")}catch{}let b=v&&v.account===(e.user?.username||null)&&Date.now()-v.savedAt<30*6e4&&v.values;return b&&(d(v.values),e.draftRestored=!0),o||(o=!0,e.watch(()=>u(),()=>m(),!0)),e.unsavedChanges=p()!==i,!!b},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state===e&&v._field.timer&&v._field.commit()}),JSON.parse(p())},accept(v){i=JSON.stringify(v),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(v=>{v._field?.binding.state!==e||!v._field.timer||(clearTimeout(v._field.timer),v._field.timer=null,v.value=v._field.binding.value??"")}),i!==void 0&&d(JSON.parse(i)),e.draftRestored=!1,m()},clear(){i=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,h()}}}function ap(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(v=>(!e.logView.severity||e.logSeverity(v.sample)===e.logView.severity)&&(!y||Object.values(v.sample).join(" ").toLowerCase().includes(y))).slice().sort((v,b)=>e.logView.sort==="count"?b.count-v.count:Date.parse(b.last)-Date.parse(v.last))},e.shortLogId=y=>y?y.slice(0,8):"",e.isLogIdentifier=(y,v)=>typeof v=="string"&&v.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 v=y.service||"The application",b={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),C={502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"}[w];return v+" "+b+(w?" with HTTP "+w+(C?" ("+C+")":""):"")+"."},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((v,b)=>Date.parse(b.ts)-Date.parse(v.ts)),e.historyDetailFields=y=>{try{let v=JSON.parse(y?._detailJson||"{}");return v&&typeof v=="object"?Object.entries(v):[["value",v]]}catch{return[["record",y?._detailJson||""]]}},e.logFieldText=y=>typeof y=="object"?JSON.stringify(y):String(y??""),e.captureErrorScroll=y=>{let v=[];for(let b=y?.parentElement;b;b=b.parentElement)v.push({element:b,top:b.scrollTop,left:b.scrollLeft});return v},e.restoreErrorScroll=y=>y.forEach(({element:v,top:b,left:w})=>{v.isConnected&&(v.scrollTop=b,v.scrollLeft=w)});let s=null,i=null,o=null,r=[];e.selectLog=async(y,v)=>{if(i=v||document.activeElement, Line truncated
`+C.join(`
`)],{type:"text/csv"}),k=document.createElement("a");k.href=URL.createObjectURL(N),k.download=i.username+"-repositories.csv",k.click()},e.showStatusMessage=v=>{let b=v.statusMessage||"(no message)";window.prompt(`Status message for ${v.repoId} (${v.status}):`,b)},e.fetchGithubInfo=v=>{let b=window.open("","_blank");b&&b.document.write("<pre>Loading GitHub info for "+v.repoId+"...</pre>"),t.get("/api/admin/repos/"+v.repoId+"/github").then(w=>{b&&(b.document.open(),b.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(w.data,null,2).replace(/[<>]/g,C=>C==="<"?"&lt;":"&gt;")+"</pre>"),b.document.close())},w=>{let C=w&&w.data?JSON.stringify(w.data,null,2):String(w);b&&(b.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+C+"</pre>")})};function d(v){t.get("/api/admin/users/"+v+"/repos",{}).then(b=>{e.repositories=b.data},b=>{console.error(b)})}function h(v){t.get("/api/admin/users/"+v,{}).then(b=>{e.userInfo=b.data},b=>{console.error(b)})}h(i.username),d(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>h(i.username),v=>console.error(v))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>h(i.username),v=>console.error(v))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>h(i.username),v=>console.error(v))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>h(i.username),v=>console.error(v))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(v=>{e.tokens=v.data||[]},v=>{v.status!==401&&v.status!==403&&console.error(v)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(v=>{e.tokenForm.plaintext=v.data.token,e.tokenForm.name="",m()},v=>console.error(v))},e.revokeToken=v=>{confirm(`Revoke token "${v.name}"?`)&&t.delete("/api/admin/tokens/"+v.id).then(()=>m(),b=>console.error(b))},e.removeCache=v=>{confirm("Remove cached files for "+v.repoId+"?")&&t.delete("/api/admin/repos/"+v.repoId).then(()=>d(i.username),b=>console.error(b))},e.removeRepository=v=>{confirm("Remove repository "+v.repoId+"?")&&t.delete("/api/repo/"+v.repoId+"/").then(()=>d(i.username),b=>console.error(b))},e.updateRepository=v=>{let b=ut({title:`Refreshing ${v.repoId}...`,date:new Date,body:`The repository ${v.repoId} is going to be refreshed.`});e.toasts.push(b),t.post(`/api/repo/${v.repoId}/refresh`).then(w=>{w.data.status=="ready"?b.title=`${v.repoId} is refreshed.`:b.title=`Refreshing of ${v.repoId}.`},w=>{b.title=`Error during the refresh of ${v.repoId}.`,b.body=w.body})},e.getGitHubRepositories=v=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(b=>{e.userInfo.repositories=b.data})};let y=null;e.watch("query",()=>{o.timeout.cancel(y),y=o.timeout(()=>{d(i.username)},500)},!0)},cp=function(e,t,s){let i=Et(),o=qt();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 C=document.querySelector('.admin-filter-toolbar input[type="search"]');C&&C.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 C=(e.statusCounts||[]).find(N=>N._id===w);return C?C.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",d={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},h=loadFilterPrefs(p)||{};e.query=Object.assign({},d,h,{page:1,search:""});let m=s.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 C=Object.assign({},e.query);delete C.page,e.presets=(e.presets||[]).filter(N=>N.name!==w),e.presets.push({name:w,query:C}),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(C=>C.name!== Line truncated
`):typeof U.stack=="string"?U.stack:null;for(var G=[U.cause,U.err].filter(Boolean),L=0;!q&&L<G.length;L++)for(var E=G[L];!q&&E&&typeof E=="object";)typeof E.stack=="string"&&(q=E.stack),E=E.cause;V._stack=q}else V.displayMessage=V.message,V._status=null,V._url=null,V._stack=null;return V._bucket=v(U,V.level),V._detailJson=w(V,U),V}function w(V,U){let G=[],L=(X,j)=>{j==null||j===""||G.push([X,j])};for(let X of["service","event","severity","requestId","jobId"])L(X,U&&U[X]);L("name",U&&U.name),L("code",V.displayMessage||U&&U.message),V._bucket&&L("kind",V._bucket),L("httpStatus",U&&U.httpStatus),U&&U.status&&!U.httpStatus&&L("status",U.status),L("module",V.module);let E=U&&U.detail;if(typeof E=="string"){let X=E.trim();if(X[0]==="{"||X[0]==="[")try{E=JSON.parse(E)}catch{}}if(L("detail",E),L("repoId",U&&U.repoId),L("filePath",U&&U.filePath),L("upstreamStatus",U&&U.upstreamStatus),L("upstreamBody",U&&U.upstreamBody),L("url",V._url),L("err",U&&U.err),L("cause",U&&!U.err&&U.cause),L("ts",V.ts),!G.length)return JSON.stringify(V,null,2);let q=G.reduce((X,j)=>Math.max(X,j[0].length),0),Y=["{"];return G.forEach(([X,j],se)=>{let he=` ${`"${X}":`.padEnd(q+3," ")} `,Se=se<G.length-1?",":"",_e;if(j&&typeof j=="object"){let et=" ".repeat(he.length);_e=JSON.stringify(j,null,2).split(`
`).map((ze,He)=>He===0?ze:et+ze).join(`
`)}else typeof j=="number"||typeof j=="boolean"?_e=String(j):_e=JSON.stringify(j);Y.push(`${he}${_e}${Se}`)}),Y.push("}"),Y.join(`
`)}function C(V){let U=[],G="",L=/(\w+):(>=|<=|!=|>|<|=)?([^\s]+)/g,E=0,q;for(;q=L.exec(V);)G+=V.slice(E,q.index),E=L.lastIndex,U.push({key:q[1],op:q[2]||"=",val:q[3]});return G+=V.slice(E),{filters:U,free:G.trim().toLowerCase()}}function N(V,U){for(let G of U.filters){let L=(q,Y,X)=>{let j=parseFloat(q),se=parseFloat(Y);return X==="="?String(q)===String(Y):X==="!="?String(q)!==String(Y):X===">="?j>=se:X==="<="?j<=se:X===">"?j>se:X==="<"?j<se:!0},E;if(G.key==="code")E=V.displayMessage;else if(G.key==="module")E=V.module;else if(G.key==="status")E=V._status;else if(G.key==="url")E=V._url;else if(G.key==="repo")E=V._repoId;else if(G.key==="level")E=V.level;else continue;if(E==null||!L(E,G.val,G.op))return!1}return!(U.free&&((V.displayMessage||"")+" "+(V.module||"")+" "+(V._url||"")+" "+JSON.stringify(V.raw||[])).toLowerCase().indexOf(U.free)===-1)}function k(){let V=C(e.query.search||"");e.parsedFilterCount=V.filters.length;let U=e.query.bucket,G=e.entries.filter(X=>U&&X._bucket!==U?!1:N(X,V)),L=e.query.group;if(L){let X=te=>JSON.stringify(L==="module"?[te.module,te._bucket]:[te.raw?.[0]?.service||"unknown",te.module,te.displayMessage||te.message||"_",te._bucket,te._status]),j=new Map;for(let te of G){let he=X(te);if(j.has(he)){let Se=j.get(he);Se.count++,Se._related.push(te),new Date(te.ts)>new Date(Se.ts)&&(Se.ts=te.ts,Se._url=te._url,Se._status=te._status),new Date(te.ts)<new Date(Se._firstSeen)&&(Se._firstSeen=te.ts)}else{let Se=Object.assign({},te);Se._key=`${L}:${he}`,Se._related=[te],Se._firstSeen=te.ts,Se._lastHourCount=0,Se.count=1,j.set(he,Se)}}let se=Date.now()-3600*1e3;for(let te of j.values())te._lastHourCount=te._related.filter(he=>new Date(he.ts).getTime()>=se).length;G=Array.from(j.values())}else G=G.map((X,j)=>(X._key="row:"+j+":"+X.ts,X._related=[X],X._firstSeen=X.ts,X._lastHourCount=0,X.count=1,X));let E=X=>({error:0,warn:1,info:2})[X._bucket]??1;e.query.sort==="count"?G.sort((X,j)=>E(X)-E(j)||j.count-X.count||new Date(j.ts)-new Date(X.ts)):G.sort((X,j)=>E(X)-E(j)||new Date(j.ts)-new Date(X.ts)),e.visible=G;let q=!!(e.query.bucket||(e.query.search||"").trim()),Y=!q&&(e.stats?.severity?.error||0)>0&&!G.some(X=>X._bucket==="error")&&e.entries.length<1500;(q&&!G.length||Y)&&e.canLoadMore?.()&&!e._autoLoading&&e.entries.length<2500&&(e._autoLoading=!0,P(!0))}function P(V){if(V&&e.redisLoading)return;let U=++o;e.redisLoading=!0;let G=V?e.redisNextOffset||e.entries.length:0,L=V?e.pageSize:Math.max(e.pageSize,e.redisNextOffset||e.entries.length||e.pageSize);t.get("/api/admin/errors",{params:{offset:G,limit:L}}).then(E=>{if(p||U!==o)return;e.redisLoading=!1;let q=(E.data.entries||[]).map(b);e.entries=V?e.entries.concat(q):q,e.redisRedacted=(V&&e.redisRedacted||0)+(E.data.redactedEntries||0),e.redisNextOffset=E.data.nextOffset??G+(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,k()},()=>{p||U!==o||(e.redisLoading=!1,e._autoLoading=!1,e.available=!1)})}e.loadMore=()=>P(!0),e.canLoadMore=()=>(e.redisNextOffset||e.entries.length)<e.total;function D(V=!1){if(V&&u)return;let U=++r;u=!0,t.get("/api/admin/errors/stats").then(G=>{if(p||U!==r)return;u=!1;let L=G.data||{};e.redisStatsState=L.available===!1?"unavailable":"ready";let E=L.prev24h?Math.round((L.last24h-L.prev24h)/L.prev24h*100):0;e.stats={last24h:L.last24h||0,prev24h:L.prev24h||0,delta:E,severity:L.severity||{error:0,warn:0,info:0},unique:L.unique||{error:0,warn:0,info:0},buckets:L.buckets||[],dropped:L.dropped||0},k()},()=>{!p&&U===r&&(u=!1,e.redisStatsState="unavailable")})}function F(V=!1){(!V||!e.redisLoading)&&P(),D(V)}e.barPx=(V,U)=>{let G=e.stats.buckets||[],L=0,E=0;for(let j of G)L=Math.max(L,(j.error||0)+(j.warn||0)),E=Math.max(E,j.info||0);let q=V[U]||0;if(!q)return 0;if(U==="info")return E?Math.max(2,Math.round(q/E*(L?16:60))):0;let Y=(V.error||0)+(V.warn||0),X=Math.round(Y/L*44);return Math.max(4,Math.round(q/Y*X))},e.bucketTitle=V=>`${new Date(V.hour).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} \xB7 ${V.error||0} err \xB7 ${V.warn||0} warn \xB7 ${V.info||0} info`,e.toggle=async(V,U)=>{h=U||document.activeElement,m=e.captureErrorScroll(h),e.historySelected=V,e.historyView="overview",e.expanded={[V._key]:!0},await Ke(),document.getElementById("history-inspector-title")?.focus({preventScroll:!0}),document.getElementById("history-inspector-title")?.scrollIntoView?.({block:"nearest"})},e.showHistoryTimeline=V=>{if(e.historyView="timeline",e.traceSelection)return;let U=["requestId","jobId"].find(G=>e.logTraceId(e.historySelected,G));U&&e.lookupTrace(U,e.logTraceId(e.historySelected,U),V,e.historySelected)},e.closeHistory=async()=>{let V=e.historySelected?._key;e.historySelected=null,e.expanded={},e.traceSelection&&await e.closeTrace(),await Ke(),(h?.isConnected?h:[...document.querySelectorAll("[data-history-key]")].find(G=>G.dataset.historyKey===V))?.focus({preventScroll:!0}),e.restoreError Line truncated
`)],{type:"text/csv;charset=utf-8"}),L=URL.createObjectURL(G),E=document.createElement("a");E.href=L,E.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(L)};function z(V){e.copyHint=`${V} copied`,d.timeout(()=>{e.copyHint=""},1500)}e.copyJson=V=>{navigator.clipboard.writeText(V._rawJson).then(()=>z("JSON"))},e.copyCurl=V=>{if(!V._url)return;let G=`curl -X ${V._method||"GET"} '${window.location.origin}${V._url}'`;navigator.clipboard.writeText(G).then(()=>z("curl"))},F();let K=i(()=>{e.query.autoRefresh&&F(!0)},15e3);e.on("dispose",()=>{p=!0,o++,r++,i.cancel(K)}),e.watch("query.search",k),e.watch("query.bucket",k),e.watch("query.sort",k),e.watch("query.group",k)},mp=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(k){e.ovView=k;try{window.history.replaceState(null,"",k==="summary"?window.location.pathname:"#"+k)}catch{}};var o=!1;e.loadCache=function(){if(!o){o=!0;var k=e.cacheMinutes;t.get("/api/admin/cache",{params:{minutes:k}}).then(function(P){k===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(){o=!1,k!==e.cacheMinutes&&e.loadCache()})}},e.cacheRows=function(){return(e.cacheReport?.rows||[]).filter(function(k){return e.cacheTraffic==="all"||k.traffic===e.cacheTraffic})},e.cacheRate=function(k,P){var D=e.cacheRows(),F=function(V){return D.filter(function(U){return U.name===V}).reduce(function(U,G){return U+G[P]},0)},z=F(k+"_hit"),K=F(k+"_miss");return z+K?(100*z/(z+K)).toFixed(1)+"%":"No samples"},e.cacheEventName=function(k){return k.replaceAll("_"," ")},e.cacheP95=function(k){var P=0,D=e.cacheReport?.latencyBucketsMs||[];if(!k.count)return"No samples";if(!k.ms)return"Not timed";for(var F=0;F<=D.length;F++)if(P+=k["b"+F]||0,P>=Math.ceil(k.count*.95))return F<D.length?"\u2264 "+Xn(D[F]):"> 10\u202Fs";return"No samples"},e.healthAlert=function(){let k=e.data&&e.data.system||{},P=[["Memory",k.memPercent],["Disk",k.diskPercent]].filter(([,F])=>F>90);return P.length?P.map(([F,z])=>F+" is at "+z+"%").join(" and ")+". New anonymizations may fail until "+(P.length>1?"they drop.":"it drops."):""},e.performanceError=null,e.formatMs=function(k){return k==null?"":Xn(k)},e.latencyBound=function(k,P){return k.count?k[P]==null?"> 60\u202Fs":"\u2264 "+e.formatMs(k[P]):"No samples"},e.firstByteBound=function(k){return e.latencyBound({count:k.firstByteCount,p95UpperMs:k.firstByteP95UpperMs},"p95UpperMs")},e.sampleAge=function(k){return Math.max(0,Math.round((Date.now()-k.sampledAt)/1e3))},e.peakRss=function(k){return(e.performance.runtimeSeries||[]).filter(function(P){return P.instance===k.instance}).reduce(function(P,D){return Math.max(P,D.rss)},k.memory.rss)},e.performanceWarning=function(k){return e.sampleAge(k)>45||k.droppedBatches||k.droppedMetrics||k.sockets?.closeWait>0||k.eventLoop?.p95Ms>100||k.memoryLimitBytes&&k.memory.rss>k.memoryLimitBytes*.8};var r=!1;e.loadPerformance=function(){var k=e.performanceMinutes;e.performance?.windowMinutes&&e.performance.windowMinutes!==k&&(e.performance=null),!r&&(r=!0,t.get("/api/admin/performance",{params:{minutes:k}}).then(function(P){k===e.performanceMinutes&&(e.performance=P.data,e.performanceError=P.data.available?null:"Performance monitoring is unavailable. Request history may be incomplete.")},function(){k===e.performanceMinutes&&(e.performanceError="Could not refresh performance monitoring. Displayed samples may be stale.")}).finally(function(){r=!1,k!==e.performanceMinutes&&e.loadPerformance()}))};function u(k){if(k==null)return"\u2014";for(var P=["B","KB","MB","GB","TB"],D=0,F=k;F>=1024&&D<P.length-1;)F/=1024,D++;return F.toFixed(D>0?1:0).replace(/\.0$/,"")+" "+P[D]}e.humanBytes=u;function p(k){if(!k)return"\u2014";var P=Math.floor(k/86400),D=Math.floor(k%86400/3600),F=Math.floor(k%3600/60);return P>0?P+"d "+(D<10?"0":"")+D+"h":D>0?D+"h "+(F<10?"0":"")+F+"m":F+"m"}e.humanDuration=p;function d(k){return k==null?"\u2014":k>=1e6?(k/1e6).toFixed(1)+"M":k>=1e3?(k/1e3).toFixed(1)+"K":String(k)}e.humanNum=d,e.queueTotal=function(k){return k?(k.waiting||0)+(k.active||0)+(k.delayed||0)+(k.failed||0):0},e.statusCount=function(k){if(!e.data||!e.data.repos)return 0;for(var P=e.data.repos.statusBreakdown||[],D=0;D<P.length;D++)if(P[D]._id===k)return P[D].count;return 0},e.barPct=function(k){var P=e.data&&e.data.repos?e.data.repos.total:0;if(!P)return 0;var D=[k];k==="expired"&&D.push("expiring"),k==="removed"&& Line truncated
`)},e.tipSide=w=>{let C=(e.summary?.series||[]).length;return C<3?"":w<C/4?"tip-start":w>=C*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((w,C)=>w+e.bucketTotal(C),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(w=>w.active||w.allTimeSales||w.sales),e.familyLabel=w=>($r.find(C=>C.id===w)||{}).label||"",e.familyPlans=w=>(e.summary?.plans||[]).filter(C=>C.family===w),e.familySum=(w,C)=>e.familyPlans(w).reduce((N,k)=>N+(k[C]||0),0),e.familyMoney=(w,C,N)=>{if(!e.revenueOn())return"\u2014";let k=e.familyPlans(w);return k.some(P=>P[N]===!1)?"Incomplete":e.moneyText(k.reduce((P,D)=>r(P,D[C]),{}))},e.planTotals=()=>{let w=C=>(e.summary?.plans||[]).reduce((N,k)=>N+(k[C]||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?Xn(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(C=>{if(w!==u)return;e.summaryLoading=!1;let N=C.data;if(!N||!N.subscriptions||!N.sales||!Array.isArray(N.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=N},C=>{w===u&&(e.summaryLoading=!1,e.summaryError=C&&C.data&&C.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=s.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((C,N)=>C+(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 d=()=>{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(C=>C.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 C=document.getElementById("bl-grants");C&&C.scrollIntoView&&C.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 C=ks({[w.amount.currency]:w.amount.value})[0]||"\u2014";if(!w.amount.interval)return C;let N=w.amount.intervalCount>1?w.amount.intervalCount+" "+w.amount.interval+"s":w.amount.interval;return C+" / "+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 C=Pr(w.until);return w.state!=="active"?(new Date(w.until)<new Date?"Ended ":"Ends ")+C:w.subscription?(w.cancelAtPeriodEnd?"Ends ":"Renews ")+C:"Until "+C},e.packNote=w=>{let C=(w.parts||[]).find(N=>N.planId==="author_pass");return!w.pack||!C||!C.until?"":(new Date(C.until)<new Date?"Updates ended ":"Updates until ")+Pr(C.until)};let h={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=w=>(w.parts||[]).map(C=>h[C.planId]||e.planName(C.planId)).join(", ").replace(/^./,C=>C.toUpperCase()),e.packPartsTitle=w=>"Paper pack: "+(w.parts||[]).map(C=>e.planName(C.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 C=Object.fromEntries(Object.entries(e.query).filter(([,N])=>N!==""&&N!=null));t.get("/api/admin/billing/grants",{params:C}).then(N=>{w===m&&( Line truncated
`)},Pl=class{constructor(t){lt(this,"gen");lt(this,"threads",[]);lt(this,"match",!1);lt(this,"runs",[]);lt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Op=(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&&Op(i.state,s.state))),Np=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),Ss,ns,Al,Dl,li=class{constructor(t,s,i){je(this,ns);lt(this,"dots");lt(this,"dotStart");je(this,Ss);this.dots=t,this.dotStart=s,Ye(this,Ss,i)}state(){return new Pl(++ce(this,Ss).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(Tl.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!Ge(this,ns,Al).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!Ge(this,ns,Al).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;Ge(this,ns,Dl).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:Ge(this,ns,Dl).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&Op(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":Ml(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 p=this.step(u.state,s,i,!1);this.addRun(r,{t:"run",neg:u.neg,state:p},i+1,o)}return this.done(r)}};Ss=new WeakMap,ns=new WeakSet,Al=function(t,s){let{seen:i}=ce(this,Ss);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Dl=function(t,s){let{has:i}=ce(this,Ss);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var Mp=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${Mp(i.state)})`);return`${t}|${s.sort().join("|")}`},cb=1<<18,oo,io,Qn,Es,Zn,xn,es,mn,Ol,zr,Vp,Il=class{constructor(t,s){je(this,mn);je(this,oo);je(this,io,new Map);je(this,Qn,0);je(this,Es);je(this,Zn);je(this,xn);je(this,es);Ye(this,oo,t),Ye(this,xn,new li(!1,!1,s)),Ye(this,es,new li(!1,!0,s))}start(t){if(t){if(ce(this,Zn))return ce(this,Zn);let i=ce(this,es).state();return ce(this,es).add(i,ce(this,oo),0,!0),Ye(this,Zn,Ge(this,mn,Ol).call(this,ce(this,es).done(i)))}if(ce(this,Es))return ce(this,Es);let s=ce(this,xn).state();return ce(this,xn).add(s,ce(this,oo),0,!0),Ye(this,Es,Ge(this,mn,zr).call(this,ce(this,xn).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===ce(this,Zn)?Ge(this,mn,zr).call(this,ce(this,es).step(t.state,s,0,!0)):Ge(this,mn,zr).call(this,ce(this,xn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ye(this,Qn,ce(this,Qn)+128)),t.ascii[i]=r):t.next.set(s,r),cd(this,Qn)._++,r}};oo=new WeakMap,io=new WeakMap,Qn=new WeakMap,Es=new WeakMap,Zn=new WeakMap,xn=new WeakMap,es=new WeakMap,mn=new WeakSet,Ol=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},zr=function(t){let s=Mp(t),i=ce(this,io).get(s);if(i)return i;ce(this,Qn)>cb&&Ge(this,mn,Vp).call(this);let o=Ge(this,mn,Ol).call(this,t);return ce(this,io).set(s,o),Ye(this,Qn,ce(this,Qn)+(s.length+1)),o},Vp=function(){ce(this,io).clear(),Ye(this,Qn,0),Ye(this,Es,void 0),Ye(this,Zn,void 0)};var pb=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},fb=(e,t,s,i)=>{let o=0,r=s,u=-1,p=0;for(;r<i;){let d=e[o];if(d?.t==="star"){u=o++,p=r;continue}let h=t[r];if(d&&(d.t==="any"||d.t==="lit"&&Ml(d,h)||d.t==="class"&&d.re.test(h))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++p}for(;e[o]?.t==="star";)o++;return o===e.length},Lp=e=>{let t=0,s=0;for(let i of e){let[o,r]=mb(i);t+=o,s+=r}return[t,s]},mb=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(Lp),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]},Rp=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Ml(e[i],t[s+i]))return!1;return!0},hb=/[/\ud800-\udfff]/,gb=/[\ud800-\udfff]/,_r=e=>gb.test(e)?[...e]:e,Tp=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},ts,ro,Ns,Hr,Rs,ui,jr,Ts,ci,pi,fi,Hn,Tn,ao,lo,mi,Gr,fn,Ps,ai,di=class{constructor(t,s={}){je(this,Ps);lt(this,"pattern");lt(this,"options");je(this,ts);je(this,ro);je(this,Ns);je(this,Hr);je(this,Rs);je(this,ui,!1);je(this,jr);je(this,Ts);je(this,ci,!1);je(this,pi,0);je(this,fi,1/0);je(this,Hn,[]);je(this,Tn,[]);je(this,ao);je(this,lo);je(this,mi,!1);je(this,Gr);je(this,fn);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:o}=Gl(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}Zp.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function ef(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:o}=Gl(i.trim());if(!o)return e;let r="";for(let p=0;p<o.length;p++){if(o[p]==="\\"){r+=o.slice(p,p+2),p++;continue}r+=Zp.has(o[p])||o[p]==="."?"\\"+o[p]:o[p]}let u=i.indexOf(o);return s[t]=i.slice(0,u)+r+i.slice(u+o.length),s.join(`
`)}var ls={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()})}d();let h=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.preventDefault(),e.saving)return;let y=p.checkpoint(),v={terms:e.terms.split(`
`).map(b=>b.trim()).filter(b=>b.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",v).then(()=>{p.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",h&&i.cancel(h),h=i(()=>{e.message=null},2500)},b=>{e.saving=!1;let w=b&&b.data&&b.data.error,C="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+w),s("ERRORS.unknown_error")]).then(([N,k])=>{e.error=w&&N!==k?N:C},()=>{e.error=C})})},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."}))}},af=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)})}},lf=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(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,d){let h={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(h===void 0)return;p.preventDefault();let m=e.features.length,y=h==="first"?0:h==="last"?m-1:(d+h+m)%m;e.feature=e.features[y].key,o(()=>{let v=i.document.getElementById("feature-tab-"+e.feature);v&&v.focus()})},e.demoText=`# DeepLearnUtils
`}var Pv=Object.freeze({view:"table",query:"",sort:null,group:null,agg:"mean",sum:"mean",ranges:{},values:{},sums:{},numeric:[],chart:null,x:null,y:[]});function Dv(e){let t=new URLSearchParams;e.view&&e.view!=="table"&&t.set("view",e.view),e.query&&t.set("q",e.query),e.sort?.column&&t.set("sort",e.sort.column+(e.sort.dir==="desc"?":desc":"")),e.group&&t.set("group",e.group),e.group&&e.agg&&e.agg!=="mean"&&t.set("agg",e.agg);for(let[s,[i,r]]of Object.entries(e.ranges||{}))(i!=null||r!=null)&&t.set("range."+s,(i??"")+"~"+(r??""));for(let[s,i]of Object.entries(e.values||{}))for(let r of i||[])t.append("in."+s,r);e.sum&&e.sum!=="mean"&&t.set("sum",e.sum);for(let[s,i]of Object.entries(e.sums||{}))i&&i!==(e.sum||"mean")&&t.set("sum."+s,i);return e.numeric?.length&&t.set("num",e.numeric.join("|")),e.chart&&t.set("chart",e.chart),e.x&&t.set("x",e.x),e.y?.length&&t.set("y",e.y.join("|")),t.toString()}function Av(e){var d,g;let t=new URLSearchParams(e||""),s={...Pv,ranges:{},values:{},sums:{},numeric:[],y:[]},i=t.get("view");["table","chart","raw"].includes(i)&&(s.view=i),s.query=t.get("q")||"";let r=t.get("sort");if(r){let m=/^(.*?)(?::(asc|desc))?$/.exec(r);s.sort={column:m[1],dir:m[2]||"asc"}}s.group=t.get("group")||null;let o=t.get("agg");o&&ni[o]&&(s.agg=o);for(let[m,v]of t.entries())if(m.startsWith("range.")){let[y,C]=v.split("~").map(k=>k===""||k==null?null:Number(k));s.ranges[m.slice(6)]=[Number.isFinite(y)?y:null,Number.isFinite(C)?C:null]}else m.startsWith("in.")?((d=s.values)[g=m.slice(3)]||(d[g]=[])).push(v):m.startsWith("sum.")&&ni[v]&&(s.sums[m.slice(4)]=v);let u=t.get("sum");u&&ni[u]&&(s.sum=u),s.numeric=(t.get("num")||"").split("|").filter(Boolean);let p=t.get("chart");return["bar","line","scatter"].includes(p)&&(s.chart=p),s.x=t.get("x")||null,s.y=(t.get("y")||"").split("|").filter(Boolean),s}var hl=e=>"#"+e+":";function eo(e,t){if(!t||typeof e!="string"||!e.startsWith(hl(t)))return null;try{return Av(e.slice(hl(t).length))}catch{return null}}function rp(e,t){let s=Dv(t);return s?hl(e)+s.replace(/%3A/gi,":").replace(/%7C/gi,"|").replace(/%7E/gi,"~").replace(/%2C/gi,","):""}var vl=e=>/^#table(?:-\d+)?:/.test(e||"");var bl=function(e,t=e){let s=/\bXXXX-\d+\b/g;t.on("dark-mode",(V,S)=>{e.aceOption&&(e.aceOption.theme=S?"nord_dark":"chrome")});let i=Pt(),r=Lt();e.isMac=/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent);let o={yml:"yaml",txt:"text",py:"python",js:"javascript",ts:"typescript"},u=["license","txt"],p=["png","jpg","jpeg","gif","svg","ico","bmp","tiff","tif","webp","avif","heif","heic"],d=["wav","mp3","ogg","wma","flac","aac","m4a"],g=["mp4","avi","webm","mov","mpg","mpeg","mkv","flv","wmv","3gp","3g2","m4v","f4v","f4p","f4a","f4b"];e.toggleSource=function(){e.showSource=!e.showSource},e.toggleAllowScripts=function(){e.allowScripts=!e.allowScripts};let m=(()=>{try{return window.localStorage?.getItem("wrapLines")}catch{return null}})();e.wrapLines=(m??(window.matchMedia?.("(max-width: 767px)").matches?"false":"true"))!=="false",e.toggleWrap=function(){e.wrapLines=!e.wrapLines;try{window.localStorage?.setItem("wrapLines",String(e.wrapLines))}catch{}e.codeEditor?.session.setUseWrapMode(e.wrapLines)};function v(){return window.document.querySelector(".reading-layout .markdown-body")}function y(){let V=v();V&&(V.querySelectorAll("mark.md-find").forEach(S=>{S.replaceWith(window.document.createTextNode(S.textContent))}),V.normalize())}e.runMdFind=function(){y(),e.mdFindTotal=0,e.mdFindIndex=0;let V=(e.mdFindQuery||"").trim(),S=v();if(!V||!S)return;let q=!!e.mdFindCase,G=q?V:V.toLowerCase(),oe=window.document.createTreeWalker(S,4),K=[];for(;oe.nextNode();)(q?oe.currentNode.nodeValue:oe.currentNode.nodeValue.toLowerCase()).includes(G)&&K.push(oe.currentNode);let ne=0;for(let le of K){let ye=le.nodeValue,Ae=q?ye:ye.toLowerCase(),Xe=window.document.createDocumentFragment(),tt=0,Ge;for(;(Ge=Ae.indexOf(G,tt))!==-1;){Xe.appendChild(window.document.createTextNode(ye.slice(tt,Ge)));let We=window.document.createElement("mark");We.className="md-find",We.textContent=ye.slice(Ge,Ge+V.length),Xe.appendChild(We),ne++,tt=Ge+V.length}Xe.appendChild(window.document.createTextNode(ye.slice(tt))),le.parentNode.replaceChild(Xe,le)}e.mdFindTotal=ne,ne&&e.stepMdFind(0)},e.stepMdFind=function(V){let S=v();if(!S||!e.mdFindTotal)return;let q=S.querySelectorAll("mark.md-find");e.mdFindIndex=(e.mdFindIndex+V+q.length)%q.length,q.forEach((G,oe)=>G.classList.toggle("is-current",oe===e.mdFindIndex)),q[e.mdFindIndex]?.scrollIntoView({block:"center",behavior:"smooth"})},e.toggleMdFind=function(V){if(e.mdFindOpen=V===void 0?!e.mdFindOpen:V,!e.mdFindOpen){y(),e.mdFindTotal=0;return}xe(()=>window.document.querySelector(".md-find-input")?.focus())},e.findInFile=function(){let V=e.codeEditor;if(!V)return;V.focus(),V.execCommand("find");let S=()=>{let q=V.searchBox?.element;q&&(V.renderer.setScrollMargin(52,12,0,0),!q._dockObserver&&(q._dockObserver=new MutationObserver(()=>{V.renderer.setScrollMargin(q.style.display!= Line truncated
`).forEach((S,q)=>{for(let[G,oe]of C){let K=G.exec(S);if(K&&!/^(if|for|while|switch|return|catch)$/.test(K[1])){V.push({name:K[1],kind:oe,line:q+1});break}}}),k={content:e.content,list:V.slice(0,300)},k.list},e.goToSymbol=function(V){e.symbolsOpen=!1;let S=e.codeEditor;S&&(S.scrollToLine(V-1,!0,!0,()=>{}),S.gotoLine(V,0,!0),window.history.replaceState(null,"",window.location.pathname+window.location.search+"#L"+V),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 V=window.document.getElementById("goto-input");V&&(V.focus(),V.select())},0))},e.closeGoto=function(){e.gotoOpen=!1,e.gotoError="",e.codeEditor?.focus()},e.submitGoto=function(){let V=e.codeEditor;if(!V)return;let S=/^\s*:?\s*(\d+)\s*(?:[:,]\s*(\d+))?\s*$/.exec(e.gotoValue||""),q=V.session.getLength();if(!S||+S[1]<1||+S[1]>q){e.gotoError="Enter a line from 1 to "+q;return}V.gotoLine(+S[1],S[2]?Math.max(0,+S[2]-1):0,!0),e.gotoOpen=!1,e.gotoError="",V.focus()},e.rootEntries=function(){return[...e.files||[]].sort((V,S)=>{let q=V.size==null,G=S.size==null;return q!==G?q?-1:1:V.name.localeCompare(S.name)})},e.formatSize=function(V){if(V==null)return"";if(V<1024)return V+" B";let S=V/1024,q=G=>G.toFixed(1).replace(/\.0$/,"");return S<1024?q(S)+" KB":S<1024*1024?q(S/1024)+" MB":q(S/1024/1024)+" GB"},e.fileSize=function(V){if(!V)return null;let S=V.replace(/^\/+/,""),q=(e.files||[]).find(G=>(G.path?G.path+"/":"")+G.name===S);return q&&q.size!=null?q.size:null},e.revealFolder=function(V){e.sidebarHidden=!1,e.sidebarCollapsed=!1,xe(()=>{let S=window.document.querySelector('.files a[data-path="/'+(window.CSS?.escape?window.CSS.escape(V):V)+'"]');S&&(S.closest("li")?.classList.contains("open")||S.click(),S.scrollIntoView({block:"nearest"}),S.focus())})};let w={content:null,n:0},R=V=>{if(w.content===V)return w.n;let S=V;if(typeof S=="string")try{S=JSON.parse(S)}catch{S=null}let q=[],G=K=>{Array.isArray(K)?q.push(K.join("")):typeof K=="string"&&q.push(K)};(S&&(S.cells||(S.worksheets||[]).flatMap(K=>K.cells||[]))||[]).forEach(K=>{G(K?.source??K?.input),(K?.outputs||[]).forEach(ne=>{G(ne?.text),ne?.data&&(G(ne.data["text/plain"]),G(ne.data["text/markdown"]),G(ne.data["text/html"])),G(ne?.traceback)})});let oe=q.reduce((K,ne)=>K+(ne.match(s)||[]).length,0);return w={content:V,n:oe},oe};e.redactionCount=function(){return e.type==="IPython"?R(e.content):typeof e.content!="string"?0:((e.type==="html"?e.content.replace(/<[^>]*>/g," "):e.content).match(s)||[]).length},e.renderRedacted=to;let b=V=>V.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section";e.renderReadme=function(V){let S=e.renderRedacted(V);if(!S||typeof window.DOMParser!="function")return S;let q=new window.DOMParser().parseFromString("<div>"+S+"</div>","text/html"),G={};return q.querySelectorAll("h1, h2, h3").forEach(oe=>{let K=oe.id||b(oe.textContent);G[K]?K+="-"+ ++G[K]:G[K]=1,oe.id=K}),q.body.firstChild.innerHTML};let P={content:null,list:[],title:null,count:0},D=()=>{if(e.type!=="html"||typeof e.content!="string")return{list:[],title:null,count:0};if(P.content===e.content)return P;let V=Er(e.renderReadme(e.sanitize?e.sanitize(e.content):e.content)),S=V.length,q=null;if(V[0]?.level===1&&V.filter(G=>G.level===1).length===1){q=V[0],V=V.slice(1);let G=Math.min(...V.map(oe=>oe.level));V=V.map(oe=>({...oe,depth:oe.level-G}))}return P={content:e.content,list:V,title:q,count:S},P};e.readmeToc=()=>D().list,e.tocTitle=()=>D().title,e.tocCount=()=>D().count,e.activeHeading=null,r(window,"scroll",()=>{let V=e.readmeToc?e.readmeToc():[];if(e.tocCount()<3)return;let S=Sr(V.map(q=>q.id),{offset:120,scroller:window.document.querySelector(".explorer-content")});e.activeHeading!==S&&(e.activeHeading=S)},{capture:!0,passive:!0}),e.scrollToHeading=function(V){if(!V){(window.document.querySelector(".explorer-content, .file-card-body, .main-pane")||window).scrollTo({top:0,behavior:"smooth"}),e.activeHeading="";return}Nr(V),e.activeHeading=V};let L=()=>!e.preview&&eo(window.location.hash,"table")?.view||"table";e.csvView=L();let H={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(H.content!==e.content){let V=/\.tsv$/i.test(e.filePath||"")?" ":",";H={content:e.content,rows:ei(e.content,V)}}return H.rows},e.redactParts=Jt,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 V=e.content;if(e.type==="html"&&e.url)if(e.preview)V=e.sourceContent;else try{V=await(await window.fetch(e.url,{credentials:"same-origin"})).text()}catch{return}await w Line truncated
`).length:0,Ov=e=>/\.(md|markdown|mdx)$/i.test(e?.filename||"")||e?.language==="Markdown";function lp(e,t){let s=Lt();e.redactParts=Jt,e.hangIndent=Zs,e.isRedactedName=r=>/^XXXX-\d+$/.test(String(r||"").trim()),e.tocOpen=!1,e.activeAnchor="";let i=()=>{let r=t();if(!r.length)return;let o=Sr(r,{offset:64,scroller:window.document.querySelector("main.app-view")});e.activeAnchor!==o&&(e.activeAnchor=o)};return s(window,"scroll",i,{capture:!0,passive:!0}),s(window,"resize",i,{passive:!0}),s(window.document,"click",r=>{e.tocOpen&&!r.target.closest?.(".toc-menu")&&(e.tocOpen=!1)}),s(window.document,"keydown",r=>{r.key==="Escape"&&e.tocOpen&&(e.tocOpen=!1)}),e.jumpToAnchor=r=>{e.tocOpen=!1,Nr(r)&&(e.activeAnchor=r)},i}var Lr=e=>(String(e||"").split(".").pop()||"").toLowerCase(),Mv={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"},Vv={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"},qv=1024*1024;function no(e){if(e?.tooLarge)return"too-large";if(e?.hidden)return"hidden";let t=Mv[Lr(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>qv?"code":["markdown","notebook","csv","svg"].includes(t)?t:"code":"empty"}var Lv=e=>["markdown","notebook","csv","svg"].includes(e),ap={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 $v(e,t){return t==="markdown"?"markdown":t==="notebook"?"json":t==="svg"?"markup":t==="csv"?"none":e?.language||Lr(e?.filename)||"none"}var Fv=e=>{let t=window.atob(e||""),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s};function dp(e){e.gistViews={};let t=/^#table-(\d+):/.exec(window.location.hash||"");if(t){let u=eo(window.location.hash,"table-"+t[1])?.view;(u==="chart"||u==="raw")&&(e.gistViews[+t[1]-1]=u)}e.gistKind=u=>no(e.details?.files?.[u]),e.gistHasRendered=u=>Lv(e.gistKind(u)),e.gistView=u=>!e.gistHasRendered(u)||e.gistViews[u]==="raw"?"raw":e.gistViews[u]==="chart"&&e.gistKind(u)==="csv"?"chart":"rendered",e.setGistView=(u,p)=>{e.gistViews={...e.gistViews,[u]:p}},e.gistSourceFile=u=>{let p=e.details?.files?.[u];return{...p,language:$v(p,e.gistKind(u)),filename:"source.txt"}};let s=new Map;qn(()=>{s.forEach(u=>window.URL.revokeObjectURL?.(u)),s.clear()});let i=(u,p)=>{if(!u||!window.URL?.createObjectURL)return null;let d=u.encoding==="base64",g=!p||d?Vv[Lr(u.filename)]||(d?"application/octet-stream":"text/plain"):"text/plain",m=(u.filename||"")+"\0"+g+"\0"+(u.content||"").length;if(!s.has(m)){let v=d?Fv(u.content):u.content||"";s.set(m,window.URL.createObjectURL(new window.Blob([v],{type:g+(d?"":";charset=utf-8")})))}return s.get(m)};e.gistMediaUrl=u=>i(u,!1),e.gistRawUrl=u=>i(u,!0);let r=new WeakMap;e.gistCsvRows=u=>{if(!u)return[];let p=r.get(u);return(!p||p.content!==u.content||p.filename!==u.filename)&&(p={content:u.content,filename:u.filename,rows:ei(u.content||"",Lr(u.filename)==="tsv"?" ":",")},r.set(u,p)),p.rows},e.gistCopied=null,e.copyGistFile=async u=>{let p=e.details?.files?.[u];!p||p.encoding==="base64"||!window.navigator.clipboard?.writeText||(await window.navigator.clipboard.writeText(p.content||""),e.gistCopied=u,window.setTimeout(()=>{e.gistCopied===u&&(e.gistCopied=null)},1600))},e.fileOutlines={},e.gistFileId=u=>"file-"+(u+1),e.setFileOutline=(u,p)=>{let d=e.fileOutlines[u];d&&d.map(g=>g.id).join()===p.map(g=>g.id).join()||(e.fileOutlines={...e.fileOutlines,[u]:p})},e.gistToc=()=>(e.details?.files||[]).map((u,p)=>({id:e.gistFileId(p),index:p,parts:Jt(u.filename),kind:no(u),language:ap[no(u)]&&no(u)!=="csv"?ap[no(u)]:u.language||(no(u)==="csv"?"CSV":"Text"),lines:u.encoding==="base64"?null:Iv(u.content),size:u.size,headings:Ov(u)&&e.gistView(p)==="rendered"?e.fileOutlines[p]||[]:[]}));let o=()=>e.gistToc().flatMap(u=>[u.id,...u.headings.map(p=>p.id)]);e.showGistToc=()=>{let u=e.gistToc();return e.tabState?.active==="files"&&(u.length>=2||(u[0]?.headings.length||0)>=3)},e.activeFileIndex=()=>{let p=e.gistToc().find(d=>d.id===e.activeAnchor||d.headings.some(g=>g.id===e.activeAnchor));return p?p.index:0},lp(e,o)}var Uv=e=>e?.merged?"merged":e?.draft&&e?.state==="open"?"draft":e?.state==="closed"?"closed":"open";function up(e){let t={diff:null,th Line truncated
`),p=i.date?e.fmt?.date(i.date):"",d=s[s.length-1];(!d||d.day!==p)&&s.push(d={day:p,commits:[]}),d.commits.push({...i,index:r+1,headline:o,detail:u.join(`
`).trim()})}),s},e.showFileToc=()=>e.tabState?.active==="files"&&e.prFiles().length>=2,e.activeFileIndex=()=>{let s=e.prFiles().find(i=>i.id===e.activeAnchor);return s?s.index:0},e.openTab=s=>{e.tabState={active:s},e.tocOpen=!1},e.showInDiff=s=>{s&&(e.openTab("files"),e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},xe(()=>e.jumpToAnchor(s.id)))},e.jumpToFile=s=>{e.collapsedFiles={...e.collapsedFiles,[s.index]:!1},e.jumpToAnchor(s.id)},lp(e,()=>e.tabState?.active==="files"?e.prFiles().map(s=>s.id):[])}function cp(e){return e?.body||e?.comments?.length||e?.reviewComments?.length?"conversation":e?.diff?"files":e?.commits?.length?"commits":"conversation"}function wl(e,t,s){let i,r=!1,o="form-draft:"+s,u=()=>Object.fromEntries(t.map(y=>[y,e[y]])),p=()=>JSON.stringify(u()),d=y=>{for(let C of t)Object.prototype.hasOwnProperty.call(y,C)&&(e[C]=y[C]);e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate))},g=()=>{try{window.sessionStorage.removeItem(o)}catch{}},m=(y=!1)=>{if(i!==void 0){if(y&&document.querySelectorAll("input, select, textarea").forEach(C=>{C._field?.binding.state===e&&C._field.timer&&C._field.commit()}),e.unsavedChanges=p()!==i,e.draftSaved=!1,!e.unsavedChanges){g();return}try{window.sessionStorage.setItem(o,JSON.stringify({account:e.user?.username||null,savedAt:Date.now(),values:u()})),e.draftSaved=!0}catch{}}},v=()=>m(!0);return e.on("routeLeave",v),window.addEventListener("beforeunload",v),e.on("dispose",()=>window.removeEventListener("beforeunload",v)),{restore(){i=p();let y;try{y=JSON.parse(window.sessionStorage.getItem(o)||"null")}catch{}let C=y&&y.account===(e.user?.username||null)&&Date.now()-y.savedAt<30*6e4&&y.values;return C&&(d(y.values),e.draftRestored=!0),r||(r=!0,e.watch(()=>u(),()=>m(),!0)),e.unsavedChanges=p()!==i,!!C},checkpoint(){return document.querySelectorAll("input, select, textarea").forEach(y=>{y._field?.binding.state===e&&y._field.timer&&y._field.commit()}),JSON.parse(p())},accept(y){i=JSON.stringify(y),e.draftRestored=!1,m()},discard(){document.querySelectorAll("input, select, textarea").forEach(y=>{y._field?.binding.state!==e||!y._field.timer||(clearTimeout(y._field.timer),y._field.timer=null,y.value=y._field.binding.value??"")}),i!==void 0&&d(JSON.parse(i)),e.draftRestored=!1,m()},clear(){i=p(),e.unsavedChanges=!1,e.draftRestored=!1,e.draftSaved=!1,g()}}}var pp={"15m":"last 15 min","1h":"last hour","6h":"last 6 h","24h":"last 24 h"},$r=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i,Bv=/^[A-Za-z0-9_-]{3,200}$/,Hv=/^[a-f0-9]{24}$/,kl={owner:"Owner",coauthor:"Co-author",admin:"Admin"};function zv(e){let t={repoId:"",userId:"",free:"",invalid:""},s=[];for(let i of String(e||"").trim().split(/\s+/).filter(Boolean)){let r=i.match(/^(repo|user):(.*)$/i);if(!r){s.push(i);continue}let o=r[2];r[1].toLowerCase()==="repo"&&Bv.test(o)?t.repoId=o:r[1].toLowerCase()==="user"&&Hv.test(o)?t.userId=o:t.invalid=i}return t.free=s.join(" ").toLowerCase(),t}function jv(e,t){if(!t)return!0;let s=[e.title,e.code,e.service,e.route,e.method,e.queue,e.status,e.cause?.label,e.cause?.summary].filter(i=>i!=null).join(" ").toLowerCase();return t.split(" ").every(i=>s.includes(i))}var fp=e=>Number(e?.status||e?.httpStatus)||0,Cl=e=>Date.parse(e),_v=e=>e?.event==="external_request",Gv=new Set(["mongodb","redis"]);function Wv(e,t){let s=(e||[]).filter(u=>Number.isFinite(Cl(u.timestamp))).map((u,p)=>{let d=Cl(u.timestamp),g=Number(u.ms),m=Number.isFinite(g)&&g>=0?d-g:d,v=_v(u),y=String(u.upstreamHost||""),C=v?"external":Gv.has(u.service)?"data":u.service==="nginx"?"edge":"app",k=v?`${y==="storage"?"Storage":/github/.test(y)?"GitHub":"External"}${u.upstreamMethod?" \xB7 "+u.upstreamMethod:""}`:u.errorCode||u.errorType||String(u.event||"event").replace(/_/g," "),w=v?u.upstreamEndpoint||y||"endpoint not recorded":[u.service,u.route||(u.queue?"job "+u.queue:"")].filter(Boolean).join(" \xB7 "),R=v?Number(u.upstreamStatus)||u.errorCode||"":fp(u)||"",b=v?Number(u.upstreamStatus)>=400||!!u.errorCode:fp(u)>=500||u.severity==="error",P=!v&&!!t&&!["edge_request","request_completed"].includes(u.event)&&(t.errorCode&&u.errorCode===t.errorCode||!t.errorCode&&t.errorType&&u.errorType===t.errorType);return{key:p,event:u,start:m,end:d,ms:Number.isFinite(g)?g:null,kind:C,label:k,sub:w,status:R,failed:b,failure:P}});if(!s.length)return{rows:s,span:0};s.sort((u,p)=>u.start-p.start||p.end-p.start-(u.end-u.start)),s.forEach((u,p)=>{u.key=p});let i=Math.min(...s.map(u=>u.start)),r=Math.max(...s.map(u=>u.end)),o=Math.max(1,r-i);for(let u of s)u.left=(u.start-i)/o*100,u.width=Math.max(.6,(u.end-u.start)/o*100),u.left+u.width>100&&(u.left=Math.max(0,100-u.width)),u.offset=Math.round(u.start-i);if(!s.some(u=>u.failure)){let u=[...s].reverse().find(p=>p.failed&&p.kind==="app");u&&(u.failure=!0)}return{rows:s,span:Math.round(o)}}function Kv(e){return e?e==="anonymous"?"Viewer not signed in":e==="visitor"?"Viewer: signed-in visitor":`Viewer: ${(kl[e]||e).toLowerCase()}`:""}funct Line truncated
`)],{type:"text/csv;charset=utf-8"})),G=document.createElement("a");G.href=q,G.download=`errors-${new Date().toISOString().slice(0,19)}.csv`,document.body.appendChild(G),G.click(),G.remove(),URL.revokeObjectURL(q),e.copyStatus="Redis history exported."}catch{e.copyStatus="Could not export the Redis history."}},y().then(()=>{e.errView!=="list"&&P()});let ae=i(()=>{e.errView==="list"&&!e.issueLoading&&document.visibilityState!=="hidden"&&y({quiet:!0})},6e4);e.on("dispose",()=>{p=!0,window.clearTimeout(w),r++,o++,u++,i.cancel(ae)})};function so(e){e.listLoading=!0,e.listLoaded===void 0&&(e.listLoaded=!1)}function Nl(e){e.listLoading=!1,e.listLoaded=!0}var Ur=e=>["preparing","download","downloading","downloaded","queue","anonymizing"].includes(e)?"preparing":e==="expiring"?"expired":e==="removing"?"removed":e;function Br(e,{flags:t,keys:s,count:i,onChange:r=()=>{}}){if(e.segView=()=>{let o=t()||{};if(s.every(p=>!!o[p]))return"all";let u=s.filter(p=>!!o[p]);return u.length===1?u[0]:"custom"},e.setSegView=o=>{let u=t();if(u){for(let p of s)u[p]=o==="all"?!0:p===o;r()}},e.segCount=o=>o==="all"?s.reduce((u,p)=>u+i(p),0):i(o),t()&&e.segView()==="custom")for(let o of s)t()[o]=!0}var vp=function(e,t,s){let i=Pt(),r=Lt();Sp(i,r),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 o=w=>{if(w.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){w.preventDefault();let R=document.querySelector('.admin-filter-toolbar input[type="search"]');R&&R.focus()}};r(document,"keydown",o),e.on("dispose",()=>document.removeEventListener("keydown",o)),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.owner&&w.push({key:"owner",label:"Owner",value:e.query.owner}),e.query.conference&&w.push({key:"conference",label:"Conference",value:e.query.conference}),e.chips=w};e.showStatusMessage=w=>{let R=w.statusMessage||"(no message)";window.prompt(`Status message for ${w.repoId} (${w.status}):`,R)},e.fetchGithubInfo=w=>{let R=window.open("","_blank");R&&R.document.write("<pre>Loading GitHub info for "+w.repoId+"...</pre>"),t.get("/api/admin/repos/"+w.repoId+"/github").then(b=>{R&&(R.document.open(),R.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(b.data,null,2).replace(/[<>]/g,P=>P==="<"?"&lt;":"&gt;")+"</pre>"),R.document.close())},b=>{let P=b&&b.data?JSON.stringify(b.data,null,2):String(b);R&&(R.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+P+"</pre>")})},e.statusCountFor=w=>{let R=(e.statusCounts||[]).find(b=>b._id===w);return R?R.count:0},e.statusStorageFor=w=>{let R=(e.statusCounts||[]).find(b=>b._id===w);return R?R.storage:0},e.isErrorsOnly=()=>e.query&&e.query.error&&!e.query.ready&&!e.query.preparing&&!e.query.expired&&!e.query.removed,e.toggleErrorsOnly=()=>{e.isErrorsOnly()?Object.assign(e.query,{ready:!1,preparing:!0,expired:!1,removed:!1,error:!0}):Object.assign(e.query,{ready:!1,preparing:!1,expired:!1,removed:!1,error:!0}),e.query.page=1},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.repos.filterPrefs",d={page:1,limit:25,sort:"lastView",direction:"desc",search:"",owner:"",conference:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},g=loadFilterPrefs(p)||{};e.query=Object.assign({},d,g,{page:1,search:""});let m=s.search();m.owner&&(e.query.owner=m.owner),m.conference&&(e.query.conference=m.conference),m.search&&(e.query.search=m.search);let v="admin.repos.presets";e.presets=JSON.parse(localStorage.getItem(v)||"[]"),e.savePreset=()=>{let w=window.prompt("Preset name:");if(!w)return;let R=Object.assign({},e.query);delete R.page,e.presets=(e.presets||[]).filter(b=>b.name!==w),e.presets.push({name:w,query:R}),localStorage.setItem(v,JSON.stringify(e.presets))},e.applyPreset=w=>{Object.assign(e.query,w.query,{page:1})},e.deletePreset=w=>{e.presets=(e.presets||[]).filter(R=>R.name!==w.name),localStorage.setItem(v,JSON.stringify(e.presets))},e.selectAllOnPage=()=>{e.allSelected=!e.allSelected,e.repositories.forEach(w=>{e.selected[w.repoId]=e.allSelected})},e.selectedCount=()=>Object.values(e.selected||{}).filter(Boolean).length,e.selectedRepos=()=>e.repositories.filter(w=>e.selected[w.repoId]),e.bulkRefresh=()=>{let w=e.selectedRepos();w.length&&confirm(`Force refresh ${w.length} repositories?`)&&w.forEach(R=>e.updateRepository(R))},e.bulkRemoveCache=()=>{let w=e.selectedRepos();w.length&&confirm(`Purge cache for ${w.length} repositories?`)&&w.forEach(R=>e.r Line truncated
`+w.join(`
`)],{type:"text/csv"}),b=document.createElement("a");b.href=URL.createObjectURL(R),b.download=i.username+"-repositories.csv",b.click()},e.showStatusMessage=y=>{let C=y.statusMessage||"(no message)";window.prompt(`Status message for ${y.repoId} (${y.status}):`,C)},e.fetchGithubInfo=y=>{let C=window.open("","_blank");C&&C.document.write("<pre>Loading GitHub info for "+y.repoId+"...</pre>"),t.get("/api/admin/repos/"+y.repoId+"/github").then(k=>{C&&(C.document.open(),C.document.write('<pre style="font:13px monospace;padding:16px;white-space:pre-wrap">'+JSON.stringify(k.data,null,2).replace(/[<>]/g,w=>w==="<"?"&lt;":"&gt;")+"</pre>"),C.document.close())},k=>{let w=k&&k.data?JSON.stringify(k.data,null,2):String(k);C&&(C.document.body.innerHTML='<pre style="color:#B42318;padding:16px">'+w+"</pre>")})};function d(y){t.get("/api/admin/users/"+y+"/repos",{}).then(C=>{e.repositories=C.data},C=>{console.error(C)})}function g(y){t.get("/api/admin/users/"+y,{}).then(C=>{e.userInfo=C.data,e.loadEntityErrors()},C=>{console.error(C)})}El(e,t,()=>/^[a-f0-9]{24}$/.test(e.userInfo?._id||"")?{userId:e.userInfo._id}:null),g(i.username),d(i.username),e.banUser=()=>{confirm(`Ban user ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/ban`).then(()=>g(i.username),y=>console.error(y))},e.activateUser=()=>{t.post(`/api/admin/users/${i.username}/activate`).then(()=>g(i.username),y=>console.error(y))},e.promoteUser=()=>{confirm(`Promote ${i.username} to admin?`)&&t.post(`/api/admin/users/${i.username}/promote`).then(()=>g(i.username),y=>console.error(y))},e.demoteUser=()=>{confirm(`Remove admin privileges from ${i.username}?`)&&t.post(`/api/admin/users/${i.username}/demote`).then(()=>g(i.username),y=>console.error(y))},e.tokens=[],e.tokenForm={name:"",plaintext:null};function m(){t.get("/api/admin/tokens").then(y=>{e.tokens=y.data||[]},y=>{y.status!==401&&y.status!==403&&console.error(y)})}m(),e.createToken=()=>{e.tokenForm.name&&t.post("/api/admin/tokens",{name:e.tokenForm.name}).then(y=>{e.tokenForm.plaintext=y.data.token,e.tokenForm.name="",m()},y=>console.error(y))},e.revokeToken=y=>{confirm(`Revoke token "${y.name}"?`)&&t.delete("/api/admin/tokens/"+y.id).then(()=>m(),C=>console.error(C))},e.removeCache=y=>{confirm("Remove cached files for "+y.repoId+"?")&&t.delete("/api/admin/repos/"+y.repoId).then(()=>d(i.username),C=>console.error(C))},e.removeRepository=y=>{confirm("Remove repository "+y.repoId+"?")&&t.delete("/api/repo/"+y.repoId+"/").then(()=>d(i.username),C=>console.error(C))},e.updateRepository=y=>{let C=ut({title:`Refreshing ${y.repoId}...`,date:new Date,body:`The repository ${y.repoId} is going to be refreshed.`});e.toasts.push(C),t.post(`/api/repo/${y.repoId}/refresh`).then(k=>{k.data.status=="ready"?C.title=`${y.repoId} is refreshed.`:C.title=`Refreshing of ${y.repoId}.`},k=>{C.title=`Error during the refresh of ${y.repoId}.`,C.body=k.body})},e.getGitHubRepositories=y=>{t.get(`/api/user/${e.userInfo.username}/all_repositories`,{params:{force:"1"}}).then(C=>{e.userInfo.repositories=C.data})};let v=null;e.watch("query",()=>{r.timeout.cancel(v),v=r.timeout(()=>{d(i.username)},500)},!0)},kp=function(e,t,s){let i=Pt(),r=Lt();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 o=k=>{if(k.key==="/"&&!["INPUT","TEXTAREA","SELECT"].includes(document.activeElement?.tagName)){k.preventDefault();let w=document.querySelector('.admin-filter-toolbar input[type="search"]');w&&w.focus()}};r(document,"keydown",o),e.on("dispose",()=>document.removeEventListener("keydown",o)),e.clearFilter=k=>{k==="dateRange"?(e.query.dateFrom="",e.query.dateTo=""):e.query[k]="",e.query.page=1},e.chips=[];let u=()=>{let k=[];(e.query.dateFrom||e.query.dateTo)&&k.push({key:"dateRange",label:"Date",value:(e.query.dateFrom||"\u2026")+" \u2013 "+(e.query.dateTo||"\u2026")}),e.chips=k};e.statusCountFor=k=>{let w=(e.statusCounts||[]).find(R=>R._id===k);return w?w.count:0},e.toggleSortDirection=()=>{e.query.direction=e.query.direction==="asc"?"desc":"asc"},e.sortBy=k=>{e.query.sort===k?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=k,e.query.direction="desc"),e.query.page=1},e.sortIcon=k=>e.query.sort===k?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"";let p="admin.conferences.filterPrefs",d={page:1,limit:25,sort:"name",direction:"asc",search:"",dateFrom:"",dateTo:"",ready:!0,expired:!0,removed:!0,error:!0,preparing:!0},g=loadFilterPrefs(p)||{};e.query=Object.assign({},d,g,{page:1,search:""});let m=s.search();m.search&&(e.query.search=m.search);let v="admin.conferences.presets";e.presets=JSON.parse(localStorage.getItem(v)||"[]"),e.savePreset=()=>{let k=window.prompt("Preset name:");if(!k)return;let w=Object.assign({},e.query);delete w.page,e.presets=(e.presets||[]).filter(R=>R.name!==k),e.presets.push({name:k,query:w}),localStorage.setItem(v,JSON.stringify(e.presets))},e.applyPreset=k=>{ Line truncated
`)},e.tipSide=k=>{let w=(e.summary?.series||[]).length;return w<3?"":k<w/4?"tip-start":k>=w*3/4?"tip-end":""},e.bucketName=()=>({day:"day",week:"week",month:"month"})[e.summary?.bucket]||"day",e.seriesSales=()=>(e.summary?.series||[]).reduce((k,w)=>k+e.bucketTotal(w),0),e.plansWithActivity=()=>(e.summary?.plans||[]).filter(k=>k.active||k.allTimeSales||k.sales),e.familyLabel=k=>(Fr.find(w=>w.id===k)||{}).label||"",e.familyPlans=k=>(e.summary?.plans||[]).filter(w=>w.family===k),e.familySum=(k,w)=>e.familyPlans(k).reduce((R,b)=>R+(b[w]||0),0),e.familyMoney=(k,w,R)=>{if(!e.revenueOn())return"\u2014";let b=e.familyPlans(k);return b.some(P=>P[R]===!1)?"Incomplete":e.moneyText(b.reduce((P,D)=>o(P,D[w]),{}))},e.planTotals=()=>{let k=w=>(e.summary?.plans||[]).reduce((R,b)=>R+(b[w]||0),0);return{active:k("active"),sales:k("sales"),allTimeSales:k("allTimeSales")}},e.webhookState=()=>{let k=e.summary?.webhooks;return k?k.failed||k.reconciliationFailed?"bad":k.oldestPendingSeconds>900||k.unreviewedRevocations?"warn":"ok":"ok"},e.age=k=>k?Xn(k*1e3):"\u2014";let u=0;e.loadSummary=()=>{let k=++u;e.summaryLoading=!0,e.summaryError=null,t.get("/api/admin/billing/summary",{params:{period:e.period}}).then(w=>{if(k!==u)return;e.summaryLoading=!1;let R=w.data;if(!R||!R.subscriptions||!R.sales||!Array.isArray(R.plans)){e.summaryError="The billing summary had an unexpected format.";return}e.summary=R},w=>{k===u&&(e.summaryLoading=!1,e.summaryError=w&&w.data&&w.data.error||"Could not load billing figures.")})},e.setPeriod=k=>{if(e.period!==k){e.period=k;try{localStorage.setItem("admin.billing.period",k)}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=s.search();p.search&&(e.query.search=p.search),e.stateView=()=>e.query.state||"all",e.setStateView=k=>{e.query.state=k==="all"?"":k,e.query.page=1},e.stateCount=k=>k==="all"?["active","expired","revoked"].reduce((w,R)=>w+(e.stateCounts[R]||0),0):e.stateCounts[k]||0,e.sortBy=k=>{e.query.sort===k?e.query.direction=e.query.direction==="asc"?"desc":"asc":(e.query.sort=k,e.query.direction="desc"),e.query.page=1},e.sortIcon=k=>e.query.sort===k?e.query.direction==="asc"?"fa-arrow-up":"fa-arrow-down":"",e.chips=[];let d=()=>{let k=[];e.query.plan&&k.push({key:"plan",label:"Plan",value:e.planName(e.query.plan)}),e.query.status&&k.push({key:"status",label:"Stripe status",value:e.query.status.replace(/_/g," ")}),e.query.period&&k.push({key:"period",label:"Started",value:"last "+((e.periods.find(w=>w.id===e.query.period)||{}).label||e.query.period)}),e.chips=k};e.clearFilter=k=>{e.query[k]="",e.query.page=1},e.filterPlan=k=>{Object.assign(e.query,{plan:k,page:1});let w=document.getElementById("bl-grants");w&&w.scrollIntoView&&w.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(k=>e.query[k]).length,e.amountText=k=>{if(!k.amount)return"\u2014";let w=ks({[k.amount.currency]:k.amount.value})[0]||"\u2014";if(!k.amount.interval)return w;let R=k.amount.intervalCount>1?k.amount.intervalCount+" "+k.amount.interval+"s":k.amount.interval;return w+" / "+R},e.amountTitle=k=>k.amount?"Stripe list price"+(k.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."}[k.amountMissing]||"Revenue unavailable.",e.endText=k=>{if(k.never)return"Never ends";if(!k.until)return"\u2014";let w=Pr(k.until);return k.state!=="active"?(new Date(k.until)<new Date?"Ended ":"Ends ")+w:k.subscription?(k.cancelAtPeriodEnd?"Ends ":"Renews ")+w:"Until "+w},e.packNote=k=>{let w=(k.parts||[]).find(R=>R.planId==="author_pass");return!k.pack||!w||!w.until?"":(new Date(w.until)<new Date?"Updates ended ":"Updates until ")+Pr(w.until)};let g={repo_slot:"repository",author_pass:"updates",repo_extend:"+1 year"};e.packParts=k=>(k.parts||[]).map(w=>g[w.planId]||e.planName(w.planId)).join(", ").replace(/^./,w=>w.toUpperCase()),e.packPartsTitle=k=>"Paper pack: "+(k.parts||[]).map(w=>e.planName(w.planId)).join(", "),e.statusText=k=>(k.status||"unknown").replace(/_/g," "),e.revocationText=k=>k==="dispute"?"Disputed":k==="full_refund"?"Refunded":"Revoked",e.scopeHref=k=>k?.kind==="repo"?"/admin/repositories?search="+encodeURIComponent(k.id):k?.kind==="conference"?"/conference/"+encodeURIComponent(k.id):null;let m=0;function v(){let k=++m;e.grantsError=null;let w=Object.fromEntries(Object.entries(e.query).filter(([,R])=>R!==""&&R!=null));t.get("/api/admin/billing/grants",{params:w}).then(R=>{k===m&&( Line truncated
`)},Ml=class{constructor(t){lt(this,"gen");lt(this,"threads",[]);lt(this,"match",!1);lt(this,"runs",[]);lt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Hp=(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&&Hp(i.state,s.state))),Vp=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),Es,ns,Vl,ql,li=class{constructor(t,s,i){He(this,ns);lt(this,"dots");lt(this,"dotStart");He(this,Es);this.dots=t,this.dotStart=s,Ke(this,Es,i)}state(){return new Ml(++ce(this,Es).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(Ol.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,r){switch(s.t){case"split":if(!ze(this,ns,Vl).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,r);return;case"neg":if(!ze(this,ns,Vl).call(this,t,s))return;let o=this.state();return this.add(o,s.sub,i,!1),this.done(o),this.addRun(t,{t:"run",neg:s,state:o},i,r);case"star":if(this.restricted(i,r))return;ze(this,ns,ql).call(this,t,s)&&this.add(t,s.next,i,r);return;case"match":t.match=!0;return;default:ze(this,ns,ql).call(this,t,s)}}addRun(t,s,i,r){for(let o of t.runs)if(o.neg===s.neg&&Hp(o.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,r)}step(t,s,i,r){let o=this.state();for(let u of t.threads)switch(u.t){case"lit":Fl(u,s)&&this.add(o,u.next,i+1,r);break;case"any":this.restricted(i,r)||this.add(o,u.next,i+1,r);break;case"class":!this.restricted(i,r)&&u.re.test(s)&&this.add(o,u.next,i+1,r);break;case"star":this.restricted(i,r)||this.add(o,u,i+1,r)}if(!this.restricted(i,r))for(let u of t.runs){if(u.state.dead){this.addRun(o,u,i+1,r);continue}let p=this.step(u.state,s,i,!1);this.addRun(o,{t:"run",neg:u.neg,state:p},i+1,r)}return this.done(o)}};Es=new WeakMap,ns=new WeakSet,Vl=function(t,s){let{seen:i}=ce(this,Es);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},ql=function(t,s){let{has:i}=ce(this,Es);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var zp=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${zp(i.state)})`);return`${t}|${s.sort().join("|")}`},Ob=1<<18,oo,io,Jn,Ss,Zn,xn,es,mn,$l,jr,jp,Ll=class{constructor(t,s){He(this,mn);He(this,oo);He(this,io,new Map);He(this,Jn,0);He(this,Ss);He(this,Zn);He(this,xn);He(this,es);Ke(this,oo,t),Ke(this,xn,new li(!1,!1,s)),Ke(this,es,new li(!1,!0,s))}start(t){if(t){if(ce(this,Zn))return ce(this,Zn);let i=ce(this,es).state();return ce(this,es).add(i,ce(this,oo),0,!0),Ke(this,Zn,ze(this,mn,$l).call(this,ce(this,es).done(i)))}if(ce(this,Ss))return ce(this,Ss);let s=ce(this,xn).state();return ce(this,xn).add(s,ce(this,oo),0,!0),Ke(this,Ss,ze(this,mn,jr).call(this,ce(this,xn).done(s)))}next(t,s){let i=s.charCodeAt(0),r=i<128?void 0:t.next.get(s);if(r)return r;let o=t===ce(this,Zn)?ze(this,mn,jr).call(this,ce(this,es).step(t.state,s,0,!0)):ze(this,mn,jr).call(this,ce(this,xn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ke(this,Jn,ce(this,Jn)+128)),t.ascii[i]=o):t.next.set(s,o),gd(this,Jn)._++,o}};oo=new WeakMap,io=new WeakMap,Jn=new WeakMap,Ss=new WeakMap,Zn=new WeakMap,xn=new WeakMap,es=new WeakMap,mn=new WeakSet,$l=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},jr=function(t){let s=zp(t),i=ce(this,io).get(s);if(i)return i;ce(this,Jn)>Ob&&ze(this,mn,jp).call(this);let r=ze(this,mn,$l).call(this,t);return ce(this,io).set(s,r),Ke(this,Jn,ce(this,Jn)+(s.length+1)),r},jp=function(){ce(this,io).clear(),Ke(this,Jn,0),Ke(this,Ss,void 0),Ke(this,Zn,void 0)};var Mb=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},Vb=(e,t,s,i)=>{let r=0,o=s,u=-1,p=0;for(;o<i;){let d=e[r];if(d?.t==="star"){u=r++,p=o;continue}let g=t[o];if(d&&(d.t==="any"||d.t==="lit"&&Fl(d,g)||d.t==="class"&&d.re.test(g))){r++,o++;continue}if(u===-1)return!1;r=u+1,o=++p}for(;e[r]?.t==="star";)r++;return r===e.length},_p=e=>{let t=0,s=0;for(let i of e){let[r,o]=qb(i);t+=r,s+=o}return[t,s]},qb=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(_p),s=Math.min(...t.map(o=>o[0])),i=Math.max(...t.map(o=>o[1])),r=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,r]:[s,r]},qp=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Fl(e[i],t[s+i]))return!1;return!0},Lb=/[/\ud800-\udfff]/,$b=/[\ud800-\udfff]/,zr=e=>$b.test(e)?[...e]:e,Lp=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},ts,ro,Ns,_r,Rs,ui,Gr,Ts,ci,pi,fi,jn,Tn,ao,lo,mi,Wr,fn,Ps,ai,di=class{constructor(t,s={}){He(this,Ps);lt(this,"pattern");lt(this,"options");He(this,ts);He(this,ro);He(this,Ns);He(this,_r);He(this,Rs);He(this,ui,!1);He(this,Gr);He(this,Ts);He(this,ci,!1);He(this,pi,0);He(this,fi,1/0);He(this,jn,[]);He(this,Tn,[]);He(this,ao);He(this,lo);He(this,mi,!1);He(this,Wr);He(this,fn);if(t.includes Line truncated
`).forEach((s,i)=>{let{term:r}=Ql(s.trim());if(!r)return;let o=[];for(let u=0;u<r.length;u++){if(r[u]==="\\"){u++;continue}lf.has(r[u])&&!o.includes(r[u])&&o.push(r[u])}o.length&&t.push({line:i,term:r,symbols:o})}),t}function uf(e,t){let s=String(e||"").split(`
`),i=s[t];if(i===void 0)return e;let{term:r}=Ql(i.trim());if(!r)return e;let o="";for(let p=0;p<r.length;p++){if(r[p]==="\\"){o+=r.slice(p,p+2),p++;continue}o+=lf.has(r[p])||r[p]==="."?"\\"+r[p]:r[p]}let u=i.indexOf(r);return s[t]=i.slice(0,u)+o+i.slice(u+r.length),s.join(`
`)}var ls={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,v.options),p.restore()})}d();let g=null;e.saveDefault=m=>{if(m&&m.preventDefault&&m.preventDefault(),e.saving)return;let v=p.checkpoint(),y={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",y).then(()=>{p.accept(v),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",g&&i.cancel(g),g=i(()=>{e.message=null},2500)},C=>{e.saving=!1;let k=C&&C.data&&C.data.error,w="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+k),s("ERRORS.unknown_error")]).then(([R,b])=>{e.error=k&&R!==b?R:w},()=>{e.error=w})})},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."}))}},gf=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)})}},yf=function(e,t,s,i,r){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(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,d){let g={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[p.key];if(g===void 0)return;p.preventDefault();let m=e.features.length,v=g==="first"?0:g==="last"?m-1:(d+g+m)%m;e.feature=e.features[v].key,r(()=>{let y=i.document.getElementById("feature-tab-"+e.feature);y&&y.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 p=(e.demoTerms||"").split(/[,\n]/).map(v=>v.trim()).filter(Boolean).sort((v,b)=>b.length-v.length),d=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let h=new RegExp("("+p.map(d).join("|")+")","gi"),m={},y=0;return(e.demoText||"").split(h).filter(v=>v!=="").map(v=>{let b=p.find(w=>w.toLowerCase()===v.toLowerCase());return b?(m[b.toLowerCase()]||(m[b.toLowerCase()]=++y),{text:String(m[b.toLowerCase()]),redacted:!0,original:v}):{text:v}})},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 r(){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(()=>{})}r();function u(p){let d={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return d;let h=new Array(p.length-1);for(let C=1;C<p.length;C++)h[C-1]=p[C]-p[C-1];let m=h.length,y=Math.max.apply(null,h),v=Math.min.apply(null,h),b=Math.min(0,v),w=y-b||1;d.viewW=m*2,d.bars=new Array(m);for(let C=0;C<m;C++){let N=(h[C]-b)/w,k=Math.max(1.5,N*34);d.bars[C]={x:(C*2+.25).toFixed(2),y:(36-k).toFixed(2),w:"1.5",h:k.toFixed(2)}}if(d.deltaToday=h[m-1],m>=2){let C=h[m-2];C&&(d.pctChange=(d.deltaToday-C)/C*100)}return d.pctAbs=Math.round(Math.abs(d.pctChange)),d.isUp=d.pctChange>=0,d}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let d=p.data||[];e.history={repositories:u(d.map(h=>h.nbRepositories||0)),users:u(d.map(h=>h.nbUsers||0)),pageViews:u(d.map(h=>h.nbPageViews||0)),pullRequests:u(d.map(h=>h.nbPullRequests||0))}}).catch(()=>{})},df=function(e,t,s,i,o,r){let u=Et();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,Ke(()=>document.querySelector(".dashboard-quota > summary")?.focus())},qt()(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||d(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 q=ll(E?.anonymizeDate||E?.lastView)||"";return/ ago$/.test(q)?"No activity for "+q.replace(/ ago$/,""):"No activity since "+q.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 Ke();let q=document.getElementById(e.projectDetailsId(E));q?.focus(),q?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=E=>{e.selectedProject=null,Ke(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(E._type+":"+E._id)}"]`)?.focus())},e.saveProjectName=async E=>{if(e.nameSaving||!E._id)return;let q=e.projectName.trim();if(q.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:q});E.projectName=Y.data.name,E._label=E.projectName||E._fallbackLabel,e.selectedProject===E&&(e.nameMessage=q?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await F(),e.selectedProject===E&&(e.selectedProject=e.items.find(X=>X._type===E._type&&X._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 q=new URL(E._viewUrl,o.location.origin).href;e.copyingId=E._type+":"+E._id;try{await Wl(q),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:q})}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,B.options),e.options.expirationDate=B.options&&B.options.expirationDate?new Date(B.options.expirationDate):V(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),S&&S()})}function oe(S,M,B){e.anonymize&&e.anonymize[S]&&e.anonymize[S].setValidity(M,B)}function ve(S){try{let M=parseGithubUrl(S);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||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||ve(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let S=v();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!y(S))return;e.error=null,B.data.fullName&&(e._originalFullName=B.data.fullName,e.source.fullName=B.data.fullName,e.sourceUrl="https://github.com/"+B.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{y(S)&&(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,b(S)}},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=[],en.cancel(),Dn.cancel(),In.cancel(),e.previewStatus="idle",e.anonymize_readme="",od();try{await O()}catch{}}};function Ne(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:ve(e.sourceUrl)===e._originalFullName?e._originalRepositoryID:void 0}async function De(){e._preservingDraft=!0;try{await e.urlSelected(!0)}finally{e._preservingDraft=!1}}async function I(){let S=new URLSearchParams(window.location.search).get("billingDraft");if(S){N.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(S))).data;if(B.path!==o.path())throw new Error("Wrong task");k=B.values.conference||null;for(let J of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(B.values,J)&&(e[J]=B.values[J]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=B.id,D=JSON.stringify(N.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await De(),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 M;try{M=JSON.parse(sessionStorage.getItem("github-access-draft")||"null")}catch{return!1}if(!M||M.path!==o.path()||Date.now()-M.savedAt>=30*6e4)return N.restore()?(e.sourceUrl&&await De(),!0):!1;N.restore();for(let B of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(M.draft,B)&&(e[B]=M.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await De(),sessionStorage.removeItem("github-access-draft"),!0}ge(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(I,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async S=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(S.data.status),e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.fullName,e._originalFullName=S.data.source.fullName,e.terms=S.data.options.terms.filter(M=>M).join(`
`),e.source=S.data.source,e.role=S.data.role||"owner",e._existingNever=S.data.options.expirationMode==="never",e._savedExpirationDate=S.data.options.expirationDate?new Date(S.data.options.expirationDate):null,e.coauthors=S.data.coauthors||[],e._originalBranch=S.data.source.branch,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,e.repositoryID=S.data.source.repositoryID,e._originalRepositoryID=S.data.source.repositoryID,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I()&&(await Promise.all([O(),ie().then(An)]),An())},()=>{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 S=>{if(e.githubConnection=S.data.connection||"oauth",e.sourceUrl="https://github.com/"+S.data.source.repositoryFullName+"/pull/"+S.data.source.pullRequestId,e.terms=S.data.options.terms.filter(M=>M).join(`
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I())try{await ad()}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 S=>{e.sourceUrl="https://gist.github.com/"+S.data.source.gistId,e.terms=S.data.options.terms.filter(M=>M).join(`
`),e.source=S.data.source,e.options=Object.assign({},e.options,S.data.options),e.conference=S.data.conference,e._originalConference=S.data.conference,S.data.options.expirationDate&&(e.options.expirationDate=new Date(S.data.options.expirationDate)),w=C(parseGithubUrl(e.sourceUrl)),!await I()&&await ld()},()=>{o.url("/404")}))}),t.get("/github/connections").then(S=>{e.githubConnections=S.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&S.data.appEnabled&&S.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&De())}).catch(()=>{}).finally(()=>{!h&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(S=!1)=>{let M=++d;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,it(),en.cancel(),Dn.cancel(),In.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",oe("sourceUrl","github",!1);return}let J=C(B),pe=S||w===J;w=J,e.sourceUrlError="",oe("sourceUrl","github",!0),it();let Ce=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let Ze=window.document.getElementById("sourceUrl");if(Ze){try{Ze.setSelectionRange(0,0)}catch{}Ze.scrollLeft=0}},50),Ce&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!pe&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],pe||(e.source={type:"GitHubStream",branch:"",commit:""}),en.cancel(),Dn.cancel(),In.cancel(),Ms.clear(),Vs.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",od(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=pe;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await ld()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await ad()):(e.detectedType="repo",et(),await Promise.all([O(),ie().then(An)]),An())}catch{}finally{M===d&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let S=e.branches.filter(B=>B.name==e.source.branch)[0];if(!S)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=S.commit),Q(S),await ie(),An()}),e.getBranches=async S=>{let M=parseGithubUrl(e.sourceUrl),B=v();try{if(!e.details){await O(S);return}let J=await t.get(`/api/repo/${M.owner}/${M.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:S===!0||e.reconnectingSource?"1":"0",repositoryID:Ne()}});if(!y(B))return;e.branches=J.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let pe=e.branches.filter(Ce=>Ce.name==e.source.branch);pe.length>0&&(!(!e.reconnectingSource&&!S&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=pe[0].commit),Q(pe[0]),await ie(S))}catch(J){if(!y(B))return;e.branches=[],e.sourceUnreachable=J&&(J.status===404||J.data&&J.data.error==="repo_not_found"),e.details=null,He(J)}finally{b(B)}};async function O(S=!1){let M=parseGithubUrl(e.sourceUrl),B=v();try{Ls(),it();let J=await t.get(`/api/repo/${M.owner}/${M.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:Ne(),force:"1"}});if(!y(B))return;e.details=J.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(S||e.reconnectingSource)}catch(J){if(!y(B))return;throw He(J),J}finally{b(B)}}let H=null,ne=S=>H!==null&&(H===S||H===""&&!!S&&S===e.details?.defaultBranch);function Q(S){e.readme&&ne(S.name)||(e.readme=S.readme,H=S.readme?S.name:null)}async function ie(S){if(e.readme&&!S)return e.readme;let M=parseGithubUrl(e.sourceUrl),B=v(),J=()=>y(B)&&(B.branch===e.source.branch||!B.branch&&e.source.branch===e.details?.defaultBranch);try{let pe=await t.get(`/api/repo/${M.owner}/${M.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:S===!0?"1":"0",branch:B.branch,repositoryID:Ne()}});J()&&(e.readme=pe.data,H=B.branch)}catch{J()&&(e.readme="",H=null)}finally{b(B)}}let ue={magicalBraces:!0},le=S=>S.startsWith("/")&&!S.endsWith("/")&&ss(As(S.slice(1),ue),ue)===S.slice(1),ae=()=>Object.keys(e.preserve.picked).filter( Line truncated
`).map(S=>S.trim()).filter(Boolean),Ee=null,Ie=null,Ue=new Set,Je=0,Qe=null,Te=()=>!1;function Be(){let S=Je+"\0"+e.preserve.patterns;if(S!==Qe){Qe=S;try{Te=jl(Hl([...ae(),...fe()]))}catch{Te=()=>!1}}return Te}function W(S){let M=new Map([["",{dirs:[],files:[]}]]);for(let B of S){let J=B.split("/"),pe="";for(let Ce=0;Ce<J.length-1;Ce++){let Ze=J.slice(0,Ce+1).join("/");M.has(Ze)||(M.set(Ze,{dirs:[],files:[]}),M.get(pe).dirs.push(Ze)),pe=Ze}M.get(pe).files.push(B)}for(let B of M.values())B.dirs.sort();return{files:S,dirs:M,descendants:new Map}}function x(S){return Ee.descendants.has(S)||Ee.descendants.set(S,Ee.files.filter(M=>M.startsWith(S+"/"))),Ee.descendants.get(S)}let me=S=>Be()(S);function Re(S){let M=x(S),B=0;for(let J of M)me(J)&&B++;return B===0?"none":B===M.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let S=(e.options?.preserveFiles||[]).map(M=>String(M).trim()).filter(Boolean).map(M=>le(M)?As(M.slice(1),ue):M);return S.length?S.slice(0,2).join(", ")+(S.length>2?` and ${S.length-2} more`:""):"None. Every file is redacted."};async function ye(){let S=e.source?.commit;if(!(Ee&&e.preserve.commit===S)){e.preserve.loading=!0,e.preserve.error="",Ee=null,Ie=null;try{let M=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()}});if(e.source?.commit!==S)return;let J=Array.isArray(B.data.binaryFiles)?B.data.binaryFiles:[];Ee=kn(W(B.data.files||[])),Ie=J.length?kn(W([...B.data.files||[],...J])):Ee,Ue=kn(new Set(J)),e.preserve.commit=S,e.preserve.truncated=!!B.data.truncated,e.previewFile||en()}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",S=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&S&&e.sourceUrl&&ye().catch(()=>{})}),e.openPreserveFiles=()=>{let S={},M=[];for(let J of e.options?.preserveFiles||[]){let pe=String(J).trim();pe&&(!M.length&&le(pe)?S[As(pe.slice(1),ue)]=!0:M.push(pe))}let B={};for(let J of Object.keys(S)){let pe=J.split("/");for(let Ce=1;Ce<pe.length;Ce++)B[pe.slice(0,Ce).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:S,expanded:B,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Je++,u(()=>{let J=document.getElementById("preserve-files-dialog");J?.showModal&&!J.open&&J.showModal(),document.getElementById("preserve-files-search")?.focus()},0),ye()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=Hl([...ae(),...fe()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!Ee)return[];let S=Be(),M=(Ce,Ze,Gt)=>{let mt=!!e.preserve.picked[Ce],wt=S(Ce);return{kind:"file",path:Ce,label:Gt,depth:Ze,state:wt?"all":"none",locked:!mt&&wt,note:!mt&&wt?"matched by a pattern":mt&&!wt?"excluded by a pattern":""}},B=String(e.preserve.search||"").trim().toLowerCase();if(B)return Ee.files.filter(Ce=>Ce.toLowerCase().includes(B)).slice(0,300).map(Ce=>M(Ce,0,Ce));let J=[],pe=(Ce,Ze)=>{let Gt=Ee.dirs.get(Ce);for(let mt of Gt.dirs){let wt=!!e.preserve.expanded[mt],Bt=fe().includes(re(mt));J.push({kind:"dir",path:mt,label:mt.slice(Ce?Ce.length+1:0)+"/",depth:Ze,open:wt,state:Re(mt),locked:!1,note:Bt?"whole folder":""}),wt&&pe(mt,Ze+1)}for(let mt of Gt.files)J.push(M(mt,Ze,mt.slice(Ce?Ce.length+1:0)))};return pe("",0),J},e.preserveCount=()=>Ee?Ee.files.filter(me).length:0,e.togglePreserveDir=S=>{e.preserve.expanded[S]=!e.preserve.expanded[S]},e.togglePreserveFile=S=>{e.preserve.picked[S]=!e.preserve.picked[S],Je++},e.togglePreserveFolder=S=>{let M=re(S),B=Pe(S),J=fe().filter(Ce=>Ce!==M&&Ce!==B),pe=Re(S)==="all"||fe().includes(M);for(let Ce of x(S))e.preserve.picked[Ce]=!1;Je++,e.preserve.patterns=(pe?J:[...J,M]).join(`
`),pe&&x(S).some(me)&&(e.preserve.patterns=[...J,B].join(`
`))};let qe=/^readme(\.[^/]*)?$/i,pt=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Ft=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],Ut=S=>{let M=Oe(S),B=M.indexOf("."),J=pt.indexOf(B===-1?"":M.slice(B).toLowerCase());return J===-1?pt.length:J},xt=()=>!!Ee&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!xt())return"";for(let S of[".github","","docs"]){let M=(Ee.dirs.get(S)?.files||[]).filter(B=>qe.test(Oe(B)));if(M.length)return M.sort((B,J)=>Ut(B)-Ut(J)||gt(B,J))[0]}return""},e.readmeName=()=>Oe(e.readmePath())||"README.md";let Pn={key:null,fn:()=>!1},sd=()=>{let S=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),M=S.join(`
`);if(M!==Pn.key){let B=()=>!1;try{S.length&&(B=jl(S))}catch{}Pn={key:M,fn:B}}return Pn.fn};e.pathPreserved=S=>!!S&&sd()(S),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let S=sd();if(xt()){let M=e.readmePath();return!!M&&S(M)}return Ft.some(M=>S(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function go(){let S={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},M=e.source?.branch||e.details?.defaultBranch;M&&(S.branchName=M);try{let B=parseGithubUrl(e.sourceUrl);S.repoName=`${B.owner}/${B.repo}`}catch{}return S}function na(S,M,B){let J=null,pe=0,Ce=null,Ze=()=>{if(e.detectedType!==S)return;J&&u.cancel(J);let Gt=++pe;e.previewStatus="loading",J=u(()=>{J=null;let mt=M();if(!mt){e.previewStatus="idle";return}if(mt.wait){e.previewStatus=e.sourceLoading?"loading":"idle";return}let wt=JSON.stringify(mt);if(wt===Ce){e.previewStatus="ready";return}Ce=null,t.post("/api/anonymize-preview",mt).then(Bt=>{Gt===pe&&(B(Bt.data,mt),Ce=wt,e.previewStatus="ready")}).catch(()=>{Gt===pe&&(e.previewStatus="error")})},200)};return Ze.cancel=()=>{pe++,Ce=null,J&&u.cancel(J),J=null},e.on("dispose",Ze.cancel),Ze}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof hn!="string"?id(e.previewFile):en()),e.detectedType==="pr"&&Dn(),e.detectedType==="gist"&&In()};let at=kn(ti(e));Object.defineProperty(e,"previewViewer",{get:()=>at}),yl(at,e),Object.assign(at,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),at.preview=!0,at.fileSize=S=>S===at.filePath&&typeof hn=="string"?new Blob([hn]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,at.openPreserveFiles=()=>e.openPreserveFiles(),at.previewPreserved=()=>e.previewPreserved(),at.retryContent=()=>e.retryPreview();let $m=S=>Ue.has(S)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(S),sa=(S="")=>({path:S,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=sa();let vo=0,hn=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=S=>{if(S=S||"",S&&S===e.readmePath()&&(S=""),vo++,hn=null,Ni(),en.cancel(),e.previewFile=S,e.previewDoc=sa(S),at.sidebarCollapsed=!0,at.content=null,!S){e.readme?en():e.previewStatus="idle";return}if($m(S)){oa("binary"),e.previewStatus="ready";return}id(S)};function od(){vo++,hn=null,e.previewFile="",e.previewDoc=sa(),at.sidebarCollapsed=!0,at.content=null}function id(S){let M=++vo;hn=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let B;try{B=parseGithubUrl(e.sourceUrl)}catch{B=null}if(!B||!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/${B.owner}/${B.repo}/file`,{params:{commit:e.source.commit,path:S,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ve(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Ne()},transformResponse:J=>J}).then(J=>{if(M!==vo)return;e.previewDoc.loading=!1;let pe=typeof J.headers=="function"&&J.headers("content-type")||"";if(/json/i.test(pe)){let Ce=null;try{Ce=JSON.parse(J.data)}catch{}if(Ce&&Ce.binary===!0){oa("binary"),e.previewStatus="ready";return}}hn=typeof J.data=="string"?J.data:"",en()},J=>{if(M!==vo)return;e.previewDoc.loading=!1;let pe=Jr(J);if(pe==="file_too_big"){oa("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=ls.ERRORS[pe]||"GitHub did not return this file.",e.previewStatus="error"})}let Ei;function Ni(){Ei&&window.URL.revokeObjectURL(Ei),Ei=void 0,at.url=void 0}e.on("dispose",Ni);function oa(S){Ni(),e.previewDoc.note=S,at.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),at.type=S==="too_big"?"error":"binary",at.content=S==="too_big"?"file_too_big":"binary"}function Fm(S){try{let M=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",J=S&&S.includes("/")?S.slice(0,S.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${B}/${J}`}catch{return""}}let rd=na("repo",()=>{if(e.previewFile)return typeof hn!="string"?null:{content:hn,options:go()};if(!e.readme)return null;let S=go();return!S.branchName||!S.repoId?{wait:!0}:{content:e.readme,options:S}},S=>{if(typeof S?.content!="string")throw Error("Invalid preview response");Ni(),window.URL?.createObjectURL&&(at.url=Ei=window.URL.createObjectURL(new Blob([S.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();at.prepareFile(e.previewPathName(M)),at.fileBaseUrl=Fm(M),at.renderFileContent(S.content,at.type,at.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=S.content)}),en=()=>{e.previewFile&&typeof hn!="string"||rd()};en.cancel=rd.cancel;let Os=ut(new Map),ia=new Set,ra=new Set,yo="",bo=null,Ri=()=>String(e.terms||"").split(`
`).filter(S=>S.trim());function Um(){bo=null;let S=Ri(),M=S.join(`
`);M!==yo&&(Os.clear(),ra.clear(),yo=M);let B=[...ia].filter(J=>!Os.has(J));if(ia.clear(),!(!B.length||!S.length))for(let J=0;J<B.length;J+=400){let pe=B.slice(J,J+400);t.post("/api/anonymize-preview",{contents:pe,options:{terms:S,image:!0,link:!0}}).then(Ce=>{if(yo!==M||Ri().join(`
`)!==M)return;let Ze=Ce.data?.contents;if(!Array.isArray(Ze)||Ze.length!==pe.length)throw Error("Invalid preview response");pe.forEach((Gt,mt)=>Os.set(Gt,typeof Ze[mt]=="string"?Ze[mt]:Gt))}).catch(()=>{yo===M&&pe.forEach(Ce=>ra.add(Ce))})}}e.previewName=S=>{if(!S||!Ri().length)return S;if(yo===Ri().join(`
`)){if(Os.has(S))return Os.get(S);if(ra.has(S))return S}return ia.add(S),bo||(bo=u(Um,120)),S},e.previewPathName=S=>{S=String(S||"");let M=S.lastIndexOf("/");return M<0?e.previewName(S):e.previewName(S.slice(0,M))+"/"+e.previewName(S.slice(M+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{at.repoId=e.repoId||"repository",at.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),at.paths=at.filePath.split("/"),at.files=e.previewTreeFiles(),at.loadedFolders=Object.fromEntries([...Ie?.dirs.keys()||[]].map(S=>[e.previewName(S),!0]))},!0),e.on("dispose",()=>{bo&&u.cancel(bo)});function An(){if(!e.anonymize||!e.anonymize.terms)return;let S=go();!S.branchName||!S.repoId||en()}async function ad(){let S=parseGithubUrl(e.sourceUrl),M=v();try{Ls(),it();let B=await t.get(`/api/pr/${S.owner}/${S.repo}/${S.pullRequestId}`,{params:{connection:e.githubConnection}});if(!y(M))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=S.repo+"-PR"+S.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!y(M))return;throw He(B),B}finally{b(M)}}let Ms=ut(new Map);function Bm(){let S=new Set,M=e.details&&e.details.pullRequest;if(!M)return S;typeof M.title=="string"&&S.add(M.title),typeof M.body=="string"&&S.add(M.body),typeof M.diff=="string"&&S.add(M.diff);let B=M.comments||[];for(let J of B)typeof J.author=="string"&&S.add(J.author),typeof J.body=="string"&&S.add(J.body);return S}let Dn=na("pr",()=>{let S=Bm(),M=Array.from(S);return M.length===0?null:{contents:M,options:go()}},(S,M)=>{if(!Array.isArray(S?.contents)||S.contents.length!==M.contents.length||S.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let B=M.contents,J=new Map;for(let pe=0;pe<B.length&&pe<S.contents.length;pe++)J.set(B[pe],S.contents[pe]);Ms.clear(),J.forEach((pe,Ce)=>Ms.set(Ce,pe))});e.anonymizePrContent=function(S){return S&&(Ms.has(S)?Ms.get(S):"")};async function ld(){let S=parseGithubUrl(e.sourceUrl),M=v();try{Ls(),it(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${S.gistId}`);if(!y(M))return;e.details=B.data,e.gistId||(e.gistId="gist-"+S.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!y(M))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,oe("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,oe("sourceUrl","missing",!1);return}throw He(B),B}finally{b(M)}}let Vs=ut(new Map);function _m(){let S=new Set,M=e.details&&e.details.gist;if(!M)return S;typeof M.description=="string"&&S.add(M.description),typeof M.ownerLogin=="string"&&S.add(M.ownerLogin);let B=M.files||[];for(let pe of B)typeof pe.filename=="string"&&S.add(pe.filename),typeof pe.content=="string"&&S.add(pe.content);let J=M.comments||[];for(let pe of J)typeof pe.author=="string"&&S.add(pe.author),typeof pe.body=="string"&&S.add(pe.body);return S}let In=na("gist",()=>{let S=_m(),M=Array.from(S);return M.length===0?null:{contents:M,options:go()}},(S,M)=>{if(!Array.isArray(S?.contents)||S.contents.length!==M.contents.length||S.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let B=M.contents,J=new Map;for(let pe=0;pe<B.length&&pe<S.contents.length;pe++)J.set(B[pe],S.contents[pe]);Vs.clear(),J.forEach((pe,Ce)=>Vs.set(Ce,pe)),aa()});e.anonymizeGistContent=function(S){return S&&(Vs.has(S)?Vs.get(S):"")},e.previewGistFiles=[];function aa(){let S=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=S.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",aa,!0),e.watch("terms",aa);function zm(){let S=e.conference;if(e.conference_data=null,!S)return;let M=S===k||e.isUpdate&&S===e._originalConference;S!==k&&(k=null),t.get("/api/conferences/"+S).then(B=>{e.conference===S&&(e.conference_data=B.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===S&&(e.conference_data=null)})}function Ls(){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 Ti(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let S=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||S&&S Line truncated
`).filter(Ce=>Ce),connection:e.githubConnection,fullName:`${B.owner}/${B.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(J.options.pageSource=e.details.pageSource),Ls();let pe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/status/"+e.repoId},Ce=>{if(Ce.data){let Ze=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(Ce.data.error);Ze||r("ERRORS."+Ce.data.error).then(Gt=>{e.error=Gt},console.error),Pi(Ce.data.error),Ze&&(Ce.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,Ke(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{M.disabled=!1})},e.anonymizeGist=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ti())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=S.currentTarget||S.target.closest?.("button")||S.target;M.disabled=!0;let B=parseGithubUrl(e.sourceUrl),J={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(Ce=>Ce),source:{gistId:B.gistId},options:e.options,conference:e.conference};Ls();let pe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/gist/"+e.gistId},Ce=>{Ce.data&&(r("ERRORS."+Ce.data.error).then(Ze=>{e.error=Ze},console.error),Pi(Ce.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=S=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ti())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=S.currentTarget||S.target.closest?.("button")||S.target;M.disabled=!0;let B=parseGithubUrl(e.sourceUrl),J={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(Ce=>Ce),source:{repositoryFullName:`${B.owner}/${B.repo}`,pullRequestId:B.pullRequestId},options:e.options,conference:e.conference};Ls();let pe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(pe,J,{headers:{"Content-Type":"application/json"}}).then(()=>{N.clear(),window.location.href="/pr/"+e.pullRequestId},Ce=>{Ce.data&&(r("ERRORS."+Ce.data.error).then(Ze=>{e.error=Ze},console.error),Pi(Ce.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{zm()}),e.termHints=[],e.matchTermAsWritten=S=>{e.terms=ef(e.terms,S)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&en()}),e.watch("terms",()=>{e.termHints=xp(e.terms),e.detectedType==="repo"&&An(),e.detectedType==="pr"&&Dn(),e.detectedType==="gist"&&In()}),e.watch("options.image",()=>{e.detectedType==="repo"&&An(),e.detectedType==="pr"&&Dn(),e.detectedType==="gist"&&In()}),e.watch("options.link",()=>{e.detectedType==="repo"&&An(),e.detectedType==="pr"&&Dn(),e.detectedType==="gist"&&In()}),e.watch("details",()=>{e.detectedType==="repo"&&An(),e.detectedType==="pr"&&Dn(),e.detectedType==="gist"&&In()},!0)},Kl=function(e,t,s,i,o,r){yl(e);let u=Et();Zr();let p=qt(),d=0,h=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function y(){h&&(h.resolve(),h=null),m&&(u.timeout.cancel(m),m=null)}let v=!1;e.on("dispose",()=>{v=!0,d++,y(),b&&b.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",G=>{e.symbolsOpen&&!G.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!G.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!G.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&G.target.isConnected&&!G.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!G.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!G.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",G=>{G.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(G.ctrlKey||G.metaKey)&&!G.altKey&&G.key&&G.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(G.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(G){if((G.metaKey||G.ctrlKey)&&G.key==="k"){G.preventDefault();var L=document.querySelector(".tree-search-input");L&&(L.focus(),L.select())}});var b=null;e.onFileSearchChange=function(){b&&(b.resolve(),b=null);let G=e.fileSearchQuery;if(!G||G.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let L=r.defer();b=L,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(G)}`,{timeout:L.promise}).then(function(E){if(!(v||b!==L)){b=null,e.fileSearchLoading=!1;var q={};e.files.forEach(function(Oe){q[(Oe.path||"")+"/"+Oe.name]=!0});for(var Y=[],X={},j=0;j<E.data.length;j++){var se=E.data[j];if(se.path)for(var te=se.path.split("/"),he="",Se=0;Se<te.length;Se++){var _e=he;he=he?he+"/"+te[Se]:te[Se];var et=_e+"/"+te[Se];!q[et]&&!X[et]&&(X[et]=!0,Y.push({name:te[Se],path:_e}))}}Y.sort(function(Oe,Z){return(Oe.path||"").split("/").length-(Z.path||"").split("/").length}),Y.length>0&&e.files.push.apply(e.files,Y);for(var ze=[],He=0;He<E.data.length;He++){var it=E.data[He],gt=(it.path||"")+"/"+it.name;!q[gt]&&it.size!=null&&(ze.push(it),q[gt]=!0)}ze.length>0&&e.files.push.apply(e.files,ze),e.fileSearchResults=E.data}},function(){!v&&b===L&&(b=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(G,L){if(e.repoId!=i.repoId)return U();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),V();for(let E=0;E<e.paths.length-1;E++){let q=E>0?e.paths.slice(0,E).join("/"):"";e.files.some(X=>X.path===q)||e.getFiles(q)}}});function w(){if(e.paths[0]!="")return;let G=["readme.md","readme.txt","readme.org","readme.1st","readme"],L={};for(let q of e.files)q.name.toLowerCase().indexOf("readme")>-1&&(L[q.name.toLowerCase()]=q.name);let E=null;for(let q of G)if(L[q]){E=q;break}if(!E&&Object.keys(L).length>0&&(E=Object.keys(L)[0]),E){let q=s.url();q[q.length-1]!="/"&&(q+="/"),s.url(q+encodePathForUrl(L[E]))}}e.fileCounts=null;let C=0,N=new Set,k=!1;e.getFiles=function(G,L=!1){let E=e.repoId,q=C;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(G)}&v=${e.options.lastUpdateDate}`).then(function(Y){if(v||E!==e.repoId||q!==C)return[];let X=G||"";return e.files=e.files.filter(j=>j.path!==X),e.files.push(...Y.data),e.loadedFolders={...e.loadedFolders,[X]:!0},P(X,q),Y.data},function(Y){if(v||E!==e.repoId||q!==C)return[];L||(e.type="error",e.content=Jr(Y),e.files=[])})};function P(G,L){if(k||N.has(G))return;N.add(G);let E=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(G)}`).then(function(q){v||E!==e.repoId||L!==C||(e.fileCounts={...e.fileC 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(y=>y.trim()).filter(Boolean).sort((y,C)=>C.length-y.length),d=y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!p.length)return[{text:e.demoText}];let g=new RegExp("("+p.map(d).join("|")+")","gi"),m={},v=0;return(e.demoText||"").split(g).filter(y=>y!=="").map(y=>{let C=p.find(k=>k.toLowerCase()===y.toLowerCase());return C?(m[C.toLowerCase()]||(m[C.toLowerCase()]=++v),{text:String(m[C.toLowerCase()]),redacted:!0,original:y}):{text:y}})},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 o(){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(()=>{})}o();function u(p){let d={series:p,bars:[],viewW:100,deltaToday:0,pctChange:0,pctAbs:0,isUp:!0};if(!p||p.length<2)return d;let g=new Array(p.length-1);for(let w=1;w<p.length;w++)g[w-1]=p[w]-p[w-1];let m=g.length,v=Math.max.apply(null,g),y=Math.min.apply(null,g),C=Math.min(0,y),k=v-C||1;d.viewW=m*2,d.bars=new Array(m);for(let w=0;w<m;w++){let R=(g[w]-C)/k,b=Math.max(1.5,R*34);d.bars[w]={x:(w*2+.25).toFixed(2),y:(36-b).toFixed(2),w:"1.5",h:b.toFixed(2)}}if(d.deltaToday=g[m-1],m>=2){let w=g[m-2];w&&(d.pctChange=(d.deltaToday-w)/w*100)}return d.pctAbs=Math.round(Math.abs(d.pctChange)),d.isUp=d.pctChange>=0,d}e.history={repositories:u([]),users:u([]),pageViews:u([]),pullRequests:u([])},t.get("/api/stat/history?days=60").then(p=>{let d=p.data||[];e.history={repositories:u(d.map(g=>g.nbRepositories||0)),users:u(d.map(g=>g.nbUsers||0)),pageViews:u(d.map(g=>g.nbPageViews||0)),pullRequests:u(d.map(g=>g.nbPullRequests||0))}}).catch(()=>{})},vf=function(e,t,s,i,r,o){let u=Pt();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,xe(()=>document.querySelector(".dashboard-quota > summary")?.focus())},Lt()(document,"click",S=>{e.quotaExpanded&&!S.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=S=>S.status==="error"||S._broken||d(S.status)==="progress"&&S._stale,e.attentionCount=()=>e.dashboardTotals?.attention??e.items.filter(e.needsAttention).length,e.hasProjects=()=>(e.dashboardTotals?.total??e.items.length)>0,e.setProjectView=S=>{e.projectView=S,S==="attention"&&(e.filters.status.error=!0,e.filters.status.progress=!0)},e.idleText=S=>{let q=dl(S?.anonymizeDate||S?.lastView)||"";return/ ago$/.test(q)?"No activity for "+q.replace(/ ago$/,""):"No activity since "+q.replace(", "+new Date().getFullYear(),"")},e.projectDetailsId=S=>"project-details-"+encodeURIComponent(S._type+":"+(S._id||S._source||"unknown")),e.showProjectDetails=async S=>{e.selectedProject=S,e.projectName=S.projectName||"",e.nameError="",e.nameMessage="",await xe();let q=document.getElementById(e.projectDetailsId(S));q?.focus(),q?.scrollIntoView?.({block:"nearest"})},e.closeProjectDetails=S=>{e.selectedProject=null,xe(()=>document.querySelector(`[data-project-actions="${encodeURIComponent(S._type+":"+S._id)}"]`)?.focus())},e.saveProjectName=async S=>{if(e.nameSaving||!S._id)return;let q=e.projectName.trim();if(q.length>100){e.nameError="Use 100 characters or fewer.";return}e.nameSaving=!0,e.nameError="",e.nameMessage="";try{let G=await t.post("/api/user/project-name",{type:S._type,id:S._id,name:q});S.projectName=G.data.name,S._label=S.projectName||S._fallbackLabel,e.selectedProject===S&&(e.nameMessage=q?"Project name saved.":"Default project name restored."),P||(e.dashboardCursor=null,await L(),e.selectedProject===S&&(e.selectedProject=e.items.find(oe=>oe._type===S._type&&oe._id===S._id)||null))}catch{e.selectedProject===S&&(e.nameError="The project name could not be saved. Try again.")}finally{e.nameSaving=!1}},e.copyingId=null,e.copyLink=async S=>{if(!S._viewUrl||e.copyingId)return;let q=new URL(S._viewUrl,r.location.origin).href;e.copyingId=S._type+":"+S._id;try{await Jl(q),e.addToast({title:"Link copied",body:"The anonymous link is ready to share."})}catch{e.addToast({title:"Copy this anonymous link",body:q})}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"];functi Line truncated
`)),e.options=Object.assign({},e.options,B.options),e.options.expirationDate=B.options&&B.options.expirationDate?new Date(B.options.expirationDate):W(),!i.repoId&&!i.pullRequestId&&!i.gistId&&!e.anonymize?.terms?.dirty&&(e.terms=e.defaultTerms),E&&E()})}function x(E,M,B){e.anonymize&&e.anonymize[E]&&e.anonymize[E].setValidity(M,B)}function ge(E){try{let M=parseGithubUrl(E);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||!i.repoId||e.role!=="owner"||e.githubConnection!=="github-app"||ge(e.sourceUrl)!==e._originalFullName)return;e.repairingGitHubAccess=!0,e.accessRepairMessage="";let E=y();try{let M=await t.get("/github/connections");if(e.githubConnections=M.data,!M.data.appEnabled)return;let B=await t.post("/github/connections/migrate",{type:"repository",id:i.repoId,connection:"github-app"},{headers:{"X-CSRF-Token":M.data.csrf}});if(!v(E))return;e.error=null,B.data.fullName&&(e._originalFullName=B.data.fullName,e.source.fullName=B.data.fullName,e.sourceUrl="https://github.com/"+B.data.fullName),e.accessRepairMessage="GitHub access repaired. Your anonymous URL and published commit are unchanged.",await e.urlSelected(!0)}catch{v(E)&&(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(E)}},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=[],en.cancel(),An.cancel(),In.cancel(),e.previewStatus="idle",e.anonymize_readme="",dd();try{await I()}catch{}}};function Se(){return e.reconnectingSource||!e.isUpdate||!e._originalRepositoryID?void 0:ge(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 A(){let E=new URLSearchParams(window.location.search).get("billingDraft");if(E){R.restore();try{let B=(await t.get("/api/billing/draft/"+encodeURIComponent(E))).data;if(B.path!==r.path())throw new Error("Wrong task");b=B.values.conference||null;for(let Y of["sourceUrl","terms","repoId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(B.values,Y)&&(e[Y]=B.values[Y]);return e.options?.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),P=B.id,D=JSON.stringify(R.checkpoint()),e.draftRestored=!0,e.hostingReview=!0,e.sourceUrl&&await Ie(),r.replace?.(r.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!==r.path()||Date.now()-M.savedAt>=30*6e4)return R.restore()?(e.sourceUrl&&await Ie(),!0):!1;R.restore();for(let B of["sourceUrl","terms","repoId","pullRequestId","gistId","source","options","conference","githubConnection"])Object.prototype.hasOwnProperty.call(M.draft,B)&&(e[B]=M.draft[B]);return e.options.expirationDate&&(e.options.expirationDate=new Date(e.options.expirationDate)),await Ie(),sessionStorage.removeItem("github-access-draft"),!0}he(()=>{!i.repoId&&!i.pullRequestId&&!i.gistId&&u(A,0),i.repoId&&i.repoId!=""&&(e.isUpdate=!0,e.detectedType="repo",e.repoId=i.repoId,t.get("/api/repo/"+e.repoId).then(async E=>{e.accessRepairAllowed=!["removed","archived","preparing","queue","download","removing","expiring"].includes(E.data.status),e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.fullName,e._originalFullName=E.data.source.fullName,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.role=E.data.role||"owner",e._existingNever=E.data.options.expirationMode==="never",e._savedExpirationDate=E.data.options.expirationDate?new Date(E.data.options.expirationDate):null,e.coauthors=E.data.coauthors||[],e._originalBranch=E.data.source.branch,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,e.repositoryID=E.data.source.repositoryID,e._originalRepositoryID=E.data.source.repositoryID,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),k=w(parseGithubUrl(e.sourceUrl)),!await A()&&(await Promise.all([I(),ee().then(Dn)]),Dn())},()=>{r.url("/404")})),i.pullRequestId&&i.pullRequestId!=""&&(e.isUpdate=!0,e.detectedType="pr",e.pullRequestId=i.pullRequestId,t.get("/api/pr/"+e.pullRequestId).then(async E=>{if(e.githubConnection=E.data.connection||"oauth",e.sourceUrl="https://github.com/"+E.data.source.repositoryFullName+"/pull/"+E.data.source.pullRequestId,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),k=w(parseGithubUrl(e.sourceUrl)),!await A())try{await pd()}catch{}},()=>{r.url("/404")})),i.gistId&&i.gistId!=""&&(e.isUpdate=!0,e.detectedType="gist",e.gistId=i.gistId,t.get("/api/gist/"+e.gistId).then(async E=>{e.sourceUrl="https://gist.github.com/"+E.data.source.gistId,e.terms=E.data.options.terms.filter(M=>M).join(`
`),e.source=E.data.source,e.options=Object.assign({},e.options,E.data.options),e.conference=E.data.conference,e._originalConference=E.data.conference,E.data.options.expirationDate&&(e.options.expirationDate=new Date(E.data.options.expirationDate)),k=w(parseGithubUrl(e.sourceUrl)),!await A()&&await fd()},()=>{r.url("/404")}))}),t.get("/github/connections").then(E=>{e.githubConnections=E.data,!i.repoId&&!i.pullRequestId&&!i.gistId&&e.githubConnection===void 0&&E.data.appEnabled&&E.data.appConnected&&(e.githubConnection="github-app",e.sourceUrl&&e.workspaceOpen&&Ie())}).catch(()=>{}).finally(()=>{!g&&!i.repoId&&!i.pullRequestId&&!i.gistId&&e.userReposStatus==="idle"&&e.loadUserRepos()}),e.urlSelected=async(E=!1)=>{let M=++d;e.previousConfigurations=[],e.previousConfigurationId="";let B;try{B=parseGithubUrl(e.sourceUrl.trim())}catch{e.sourceLoading=!1,e.details=null,it(),en.cancel(),An.cancel(),In.cancel(),e.previewStatus="idle",e.sourceUrlError=e.sourceUrl?"Please provide a valid GitHub URL.":"",x("sourceUrl","github",!1);return}let Y=w(B),pe=E||k===Y;k=Y,e.sourceUrlError="",x("sourceUrl","github",!0),it();let Ce=document.activeElement?.id==="sourceUrl-landing";e.workspaceOpen=!0,setTimeout(()=>{let Ze=window.document.getElementById("sourceUrl");if(Ze){try{Ze.setSelectionRange(0,0)}catch{}Ze.scrollLeft=0}},50),Ce&&u(()=>document.getElementById("sourceUrl")?.focus(),0),e.reconnectingSource=!1,e.reconnectRepositoryId=void 0,!pe&&!e.isUpdate&&(e.repoId="",e.pullRequestId="",e.gistId=""),e.details=null,e.branches=[],pe||(e.source={type:"GitHubStream",branch:"",commit:""}),en.cancel(),An.cancel(),In.cancel(),Ms.clear(),Vs.clear(),e.previewStatus="idle",e.anonymize_readme="",e.readme="",dd(),e.detectedType=null,e.gistOAuthRequired=!1,e.gistAppRequired=!1,e._preservingDraft=pe;try{B.gistId&&!B.repo?(e.detectedType="gist",e.source={gistId:B.gistId},await fd()):B.pullRequestId?(e.detectedType="pr",e.source={repositoryFullName:B.owner+"/"+B.repo,pullRequestId:B.pullRequestId},await pd()):(e.detectedType="repo",tt(),await Promise.all([I(),ee().then(Dn)]),Dn())}catch{}finally{M===d&&(e._preservingDraft=!1)}$('[data-toggle="tooltip"]').tooltip()},$('[data-toggle="tooltip"]').tooltip(),e.watch("source.branch",async()=>{if(e.detectedType!=="repo")return;let E=e.branches.filter(B=>B.name==e.source.branch)[0];if(!E)return;!(!e.reconnectingSource&&e.isUpdate&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=E.commit),X(E),await ee(),Dn()}),e.getBranches=async E=>{let M=parseGithubUrl(e.sourceUrl),B=y();try{if(!e.details){await I(E);return}let Y=await t.get(`/api/repo/${M.owner}/${M.repo}/branches`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ge(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0||e.reconnectingSource?"1":"0",repositoryID:Se()}});if(!v(B))return;e.branches=Y.data,e.sourceUnreachable=!1,e.source.branch||(e.source.branch=e.details.defaultBranch);let pe=e.branches.filter(Ce=>Ce.name==e.source.branch);pe.length>0&&(!(!e.reconnectingSource&&!E&&e.isUpdate&&!e.options.update&&e._originalBranch===e.source.branch&&e.source.commit)&&!(e._preservingDraft&&e.source.commit)&&(e.source.commit=pe[0].commit),X(pe[0]),await ee(E))}catch(Y){if(!v(B))return;e.branches=[],e.sourceUnreachable=Y&&(Y.status===404||Y.data&&Y.data.error==="repo_not_found"),e.details=null,We(Y)}finally{C(B)}};async function I(E=!1){let M=parseGithubUrl(e.sourceUrl),B=y();try{qs(),it();let Y=await t.get(`/api/repo/${M.owner}/${M.repo}/`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ge(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,repositoryID:Se(),force:"1"}});if(!v(B))return;e.details=Y.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(E||e.reconnectingSource)}catch(Y){if(!v(B))return;throw We(Y),Y}finally{C(B)}}let z=null,Z=E=>z!==null&&(z===E||z===""&&!!E&&E===e.details?.defaultBranch);function X(E){e.readme&&Z(E.name)||(e.readme=E.readme,z=E.readme?E.name:null)}async function ee(E){if(e.readme&&!E)return e.readme;let M=parseGithubUrl(e.sourceUrl),B=y(),Y=()=>v(B)&&(B.branch===e.source.branch||!B.branch&&e.source.branch===e.details?.defaultBranch);try{let pe=await t.get(`/api/repo/${M.owner}/${M.repo}/readme`,{params:{reconnect:e.reconnectingSource?"1":void 0,anonymizedRepoId:e.isUpdate&&i.repoId&&ge(e.sourceUrl)===e._originalFullName?i.repoId:void 0,connection:e.githubConnection,force:E===!0?"1":"0",branch:B.branch,repositoryID:Se()}});Y()&&(e.readme=pe.data,z=B.branch)}catch{Y()&&(e.readme="",z=null)}finally{C(B)}}let ue={magicalBraces:!0},re=E=>E.startsWith("/")&&!E.endsWith("/")&&ss(Ds(E.slice(1),ue),ue)===E.slice(1),ie=()=>Object.keys(e.preserve.picked).filter(E=>e Line truncated
`).map(E=>E.trim()).filter(Boolean),Ee=null,Oe=null,Ue=new Set,Qe=0,Je=null,Re=()=>!1;function Be(){let E=Qe+"\0"+e.preserve.patterns;if(E!==Je){Je=E;try{Re=Xl(Yl([...ie(),...fe()]))}catch{Re=()=>!1}}return Re}function j(E){let M=new Map([["",{dirs:[],files:[]}]]);for(let B of E){let Y=B.split("/"),pe="";for(let Ce=0;Ce<Y.length-1;Ce++){let Ze=Y.slice(0,Ce+1).join("/");M.has(Ze)||(M.set(Ze,{dirs:[],files:[]}),M.get(pe).dirs.push(Ze)),pe=Ze}M.get(pe).files.push(B)}for(let B of M.values())B.dirs.sort();return{files:E,dirs:M,descendants:new Map}}function J(E){return Ee.descendants.has(E)||Ee.descendants.set(E,Ee.files.filter(M=>M.startsWith(E+"/"))),Ee.descendants.get(E)}let me=E=>Be()(E);function Ne(E){let M=J(E),B=0;for(let Y of M)me(Y)&&B++;return B===0?"none":B===M.length?"all":"some"}e.preserve={open:!1,loading:!1,error:"",truncated:!1,commit:"",search:"",expanded:{},picked:{},patterns:"",patternsOpen:!1},e.preserveSummary=()=>{let E=(e.options?.preserveFiles||[]).map(M=>String(M).trim()).filter(Boolean).map(M=>re(M)?Ds(M.slice(1),ue):M);return E.length?E.slice(0,2).join(", ")+(E.length>2?` and ${E.length-2} more`:""):"None. Every file is redacted."};async function ve(){let E=e.source?.commit;if(!(Ee&&e.preserve.commit===E)){e.preserve.loading=!0,e.preserve.error="",Ee=null,Oe=null;try{let M=parseGithubUrl(e.sourceUrl),B=await t.get(`/api/repo/${M.owner}/${M.repo}/tree`,{params:{commit:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ge(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Se()}});if(e.source?.commit!==E)return;let Y=Array.isArray(B.data.binaryFiles)?B.data.binaryFiles:[];Ee=kn(j(B.data.files||[])),Oe=Y.length?kn(j([...B.data.files||[],...Y])):Ee,Ue=kn(new Set(Y)),e.preserve.commit=E,e.preserve.truncated=!!B.data.truncated,e.previewFile||en()}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",E=>{e.previewFile&&e.openPreviewFile(""),e.detectedType==="repo"&&E&&e.sourceUrl&&ve().catch(()=>{})}),e.openPreserveFiles=()=>{let E={},M=[];for(let Y of e.options?.preserveFiles||[]){let pe=String(Y).trim();pe&&(!M.length&&re(pe)?E[Ds(pe.slice(1),ue)]=!0:M.push(pe))}let B={};for(let Y of Object.keys(E)){let pe=Y.split("/");for(let Ce=1;Ce<pe.length;Ce++)B[pe.slice(0,Ce).join("/")]=!0}Object.assign(e.preserve,{open:!0,search:"",picked:E,expanded:B,patterns:M.join(`
`),patternsOpen:M.length>0}),e.mobileWorkspace&&(e.mobilePane="settings"),Qe++,u(()=>{let Y=document.getElementById("preserve-files-dialog");Y?.showModal&&!Y.open&&Y.showModal(),document.getElementById("preserve-files-search")?.focus()},0),ve()},e.closePreserveFiles=()=>{document.getElementById("preserve-files-dialog")?.close?.(),e.preserve.open=!1},e.savePreserveFiles=()=>{e.options.preserveFiles=Yl([...ie(),...fe()]),e.closePreserveFiles()},e.preserveRows=()=>{if(!Ee)return[];let E=Be(),M=(Ce,Ze,Gt)=>{let mt=!!e.preserve.picked[Ce],wt=E(Ce);return{kind:"file",path:Ce,label:Gt,depth:Ze,state:wt?"all":"none",locked:!mt&&wt,note:!mt&&wt?"matched by a pattern":mt&&!wt?"excluded by a pattern":""}},B=String(e.preserve.search||"").trim().toLowerCase();if(B)return Ee.files.filter(Ce=>Ce.toLowerCase().includes(B)).slice(0,300).map(Ce=>M(Ce,0,Ce));let Y=[],pe=(Ce,Ze)=>{let Gt=Ee.dirs.get(Ce);for(let mt of Gt.dirs){let wt=!!e.preserve.expanded[mt],Bt=fe().includes(se(mt));Y.push({kind:"dir",path:mt,label:mt.slice(Ce?Ce.length+1:0)+"/",depth:Ze,open:wt,state:Ne(mt),locked:!1,note:Bt?"whole folder":""}),wt&&pe(mt,Ze+1)}for(let mt of Gt.files)Y.push(M(mt,Ze,mt.slice(Ce?Ce.length+1:0)))};return pe("",0),Y},e.preserveCount=()=>Ee?Ee.files.filter(me).length:0,e.togglePreserveDir=E=>{e.preserve.expanded[E]=!e.preserve.expanded[E]},e.togglePreserveFile=E=>{e.preserve.picked[E]=!e.preserve.picked[E],Qe++},e.togglePreserveFolder=E=>{let M=se(E),B=Te(E),Y=fe().filter(Ce=>Ce!==M&&Ce!==B),pe=Ne(E)==="all"||fe().includes(M);for(let Ce of J(E))e.preserve.picked[Ce]=!1;Qe++,e.preserve.patterns=(pe?Y:[...Y,M]).join(`
`),pe&&J(E).some(me)&&(e.preserve.patterns=[...Y,B].join(`
`))};let qe=/^readme(\.[^/]*)?$/i,ct=[".md",".markdown",".mdown",".mkdn",".rst",".txt",""],Ft=["README.md","README","README.markdown","README.rst","README.txt","readme.md"],Ut=E=>{let M=Me(E),B=M.indexOf("."),Y=ct.indexOf(B===-1?"":M.slice(B).toLowerCase());return Y===-1?ct.length:Y},xt=()=>!!Ee&&!!e.preserve.commit&&e.preserve.commit===e.source?.commit;e.readmePath=()=>{if(!xt())return"";for(let E of[".github","","docs"]){let M=(Ee.dirs.get(E)?.files||[]).filter(B=>qe.test(Me(B)));if(M.length)return M.sort((B,Y)=>Ut(B)-Ut(Y)||gt(B,Y))[0]}return""},e.readmeName=()=>Me(e.readmePath())||"README.md";let Pn={key:null,fn:()=>!1},ld=()=>{let E=(e.options?.preserveFiles||[]).map(B=>String(B).trim()).filter(Boolean),M=E.join(`
`);if(M!==Pn.key){let B=()=>!1;try{E.length&&(B=Xl(E))}catch{}Pn={key:M,fn:B}}return Pn.fn};e.pathPreserved=E=>!!E&&ld()(E),e.readmePreserved=()=>{if(e.detectedType!=="repo")return!1;let E=ld();if(xt()){let M=e.readmePath();return!!M&&E(M)}return Ft.some(M=>E(M))},e.previewPreserved=()=>e.detectedType==="repo"&&(e.previewFile?e.pathPreserved(e.previewFile):e.readmePreserved());function go(){let E={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},M=e.source?.branch||e.details?.defaultBranch;M&&(E.branchName=M);try{let B=parseGithubUrl(e.sourceUrl);E.repoName=`${B.owner}/${B.repo}`}catch{}return E}function sa(E,M,B){let Y=null,pe=0,Ce=null,Ze=()=>{if(e.detectedType!==E)return;Y&&u.cancel(Y);let Gt=++pe;e.previewStatus="loading",Y=u(()=>{Y=null;let mt=M();if(!mt){e.previewStatus="idle";return}if(mt.wait){e.previewStatus=e.sourceLoading?"loading":"idle";return}let wt=JSON.stringify(mt);if(wt===Ce){e.previewStatus="ready";return}Ce=null,t.post("/api/anonymize-preview",mt).then(Bt=>{Gt===pe&&(B(Bt.data,mt),Ce=wt,e.previewStatus="ready")}).catch(()=>{Gt===pe&&(e.previewStatus="error")})},200)};return Ze.cancel=()=>{pe++,Ce=null,Y&&u.cancel(Y),Y=null},e.on("dispose",Ze.cancel),Ze}e.retryPreview=()=>{e.detectedType==="repo"&&(e.previewFile&&typeof hn!="string"?ud(e.previewFile):en()),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&In()};let at=kn(ti(e));Object.defineProperty(e,"previewViewer",{get:()=>at}),bl(at,e),Object.assign(at,{options:{},files:[],paths:[],content:null,type:"loading",sidebarHidden:!1,sidebarCollapsed:!0,moreOpen:!1,tocOpen:!1,gotoOpen:!1,mdFindOpen:!1,mdFindQuery:"",mdFindTotal:0,mdFindIndex:0}),at.preview=!0,at.fileSize=E=>E===at.filePath&&typeof hn=="string"?new Blob([hn]).size:!e.previewFile&&e.readme?new Blob([e.readme]).size:null,at.openPreserveFiles=()=>e.openPreserveFiles(),at.previewPreserved=()=>e.previewPreserved(),at.retryContent=()=>e.retryPreview();let Km=E=>Ue.has(E)||/\.(pdf|png|jpe?g|gif|svg|ico|bmp|tiff?|webp|avif|heic|heif|mp4|webm|mp3|wav|zip|bin)$/i.test(E),oa=(E="")=>({path:E,loading:!1,note:"",loadError:""});e.previewFile="",e.previewDoc=oa();let yo=0,hn=null;e.previewOpenPath=()=>e.previewFile||e.readmePath(),e.openPreviewFile=E=>{if(E=E||"",E&&E===e.readmePath()&&(E=""),yo++,hn=null,Ni(),en.cancel(),e.previewFile=E,e.previewDoc=oa(E),at.sidebarCollapsed=!0,at.content=null,!E){e.readme?en():e.previewStatus="idle";return}if(Km(E)){ia("binary"),e.previewStatus="ready";return}ud(E)};function dd(){yo++,hn=null,e.previewFile="",e.previewDoc=oa(),at.sidebarCollapsed=!0,at.content=null}function ud(E){let M=++yo;hn=null,Object.assign(e.previewDoc,{loading:!0,loadError:""}),e.previewStatus="loading";let B;try{B=parseGithubUrl(e.sourceUrl)}catch{B=null}if(!B||!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/${B.owner}/${B.repo}/file`,{params:{commit:e.source.commit,path:E,connection:e.githubConnection,anonymizedRepoId:e.isUpdate&&i.repoId&&ge(e.sourceUrl)===e._originalFullName?i.repoId:void 0,repositoryID:Se()},transformResponse:Y=>Y}).then(Y=>{if(M!==yo)return;e.previewDoc.loading=!1;let pe=typeof Y.headers=="function"&&Y.headers("content-type")||"";if(/json/i.test(pe)){let Ce=null;try{Ce=JSON.parse(Y.data)}catch{}if(Ce&&Ce.binary===!0){ia("binary"),e.previewStatus="ready";return}}hn=typeof Y.data=="string"?Y.data:"",en()},Y=>{if(M!==yo)return;e.previewDoc.loading=!1;let pe=Jr(Y);if(pe==="file_too_big"){ia("too_big"),e.previewStatus="ready";return}e.previewDoc.loadError=ls.ERRORS[pe]||"GitHub did not return this file.",e.previewStatus="error"})}let Si;function Ni(){Si&&window.URL.revokeObjectURL(Si),Si=void 0,at.url=void 0}e.on("dispose",Ni);function ia(E){Ni(),e.previewDoc.note=E,at.prepareFile(e.previewPathName(e.previewOpenPath()||e.readmeName())),at.type=E==="too_big"?"error":"binary",at.content=E==="too_big"?"file_too_big":"binary"}function Ym(E){try{let M=parseGithubUrl(e.sourceUrl),B=e.source.branch||e.details&&e.details.defaultBranch||"main",Y=E&&E.includes("/")?E.slice(0,E.lastIndexOf("/")+1):"";return`https://github.com/${M.owner}/${M.repo}/raw/${B}/${Y}`}catch{return""}}let cd=sa("repo",()=>{if(e.previewFile)return typeof hn!="string"?null:{content:hn,options:go()};if(!e.readme)return null;let E=go();return!E.branchName||!E.repoId?{wait:!0}:{content:e.readme,options:E}},E=>{if(typeof E?.content!="string")throw Error("Invalid preview response");Ni(),window.URL?.createObjectURL&&(at.url=Si=window.URL.createObjectURL(new Blob([E.content],{type:"text/plain"})));let M=e.previewOpenPath()||e.readmeName();at.prepareFile(e.previewPathName(M)),at.fileBaseUrl=Ym(M),at.renderFileContent(E.content,at.type,at.fileBaseUrl,"text/plain"),e.previewFile||(e.anonymize_readme=E.content)}),en=()=>{e.previewFile&&typeof hn!="string"||cd()};en.cancel=cd.cancel;let Os=ut(new Map),ra=new Set,aa=new Set,vo="",bo=null,Ri=()=>String(e.terms||"").split(`
`).filter(E=>E.trim());function Xm(){bo=null;let E=Ri(),M=E.join(`
`);M!==vo&&(Os.clear(),aa.clear(),vo=M);let B=[...ra].filter(Y=>!Os.has(Y));if(ra.clear(),!(!B.length||!E.length))for(let Y=0;Y<B.length;Y+=400){let pe=B.slice(Y,Y+400);t.post("/api/anonymize-preview",{contents:pe,options:{terms:E,image:!0,link:!0}}).then(Ce=>{if(vo!==M||Ri().join(`
`)!==M)return;let Ze=Ce.data?.contents;if(!Array.isArray(Ze)||Ze.length!==pe.length)throw Error("Invalid preview response");pe.forEach((Gt,mt)=>Os.set(Gt,typeof Ze[mt]=="string"?Ze[mt]:Gt))}).catch(()=>{vo===M&&pe.forEach(Ce=>aa.add(Ce))})}}e.previewName=E=>{if(!E||!Ri().length)return E;if(vo===Ri().join(`
`)){if(Os.has(E))return Os.get(E);if(aa.has(E))return E}return ra.add(E),bo||(bo=u(Xm,120)),E},e.previewPathName=E=>{E=String(E||"");let M=E.lastIndexOf("/");return M<0?e.previewName(E):e.previewName(E.slice(0,M))+"/"+e.previewName(E.slice(M+1))},e.watch(()=>[e.repoId,e.previewPathName(e.previewOpenPath()||e.readmeName()),e.previewTreeFiles()],()=>{at.repoId=e.repoId||"repository",at.filePath=e.previewPathName(e.previewOpenPath()||e.readmeName()),at.paths=at.filePath.split("/"),at.files=e.previewTreeFiles(),at.loadedFolders=Object.fromEntries([...Oe?.dirs.keys()||[]].map(E=>[e.previewName(E),!0]))},!0),e.on("dispose",()=>{bo&&u.cancel(bo)});function Dn(){if(!e.anonymize||!e.anonymize.terms)return;let E=go();!E.branchName||!E.repoId||en()}async function pd(){let E=parseGithubUrl(e.sourceUrl),M=y();try{qs(),it();let B=await t.get(`/api/pr/${E.owner}/${E.repo}/${E.pullRequestId}`,{params:{connection:e.githubConnection}});if(!v(M))return;e.details=B.data,e.pullRequestId||(e.pullRequestId=E.repo+"-PR"+E.pullRequestId+"-"+generateRandomId(4))}catch(B){if(!v(M))return;throw We(B),B}finally{C(M)}}let Ms=ut(new Map);function Qm(){let E=new Set,M=e.details&&e.details.pullRequest;if(!M)return E;typeof M.title=="string"&&E.add(M.title),typeof M.body=="string"&&E.add(M.body),typeof M.diff=="string"&&E.add(M.diff);let B=M.comments||[];for(let Y of B)typeof Y.author=="string"&&E.add(Y.author),typeof Y.body=="string"&&E.add(Y.body);return E}let An=sa("pr",()=>{let E=Qm(),M=Array.from(E);return M.length===0?null:{contents:M,options:go()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let B=M.contents,Y=new Map;for(let pe=0;pe<B.length&&pe<E.contents.length;pe++)Y.set(B[pe],E.contents[pe]);Ms.clear(),Y.forEach((pe,Ce)=>Ms.set(Ce,pe))});e.anonymizePrContent=function(E){return E&&(Ms.has(E)?Ms.get(E):"")};async function fd(){let E=parseGithubUrl(e.sourceUrl),M=y();try{qs(),it(),e.gistOAuthRequired=!1,e.gistAppRequired=!1;let B=await t.get(`/api/gist/source/${E.gistId}`);if(!v(M))return;e.details=B.data,e.gistId||(e.gistId="gist-"+E.gistId.substring(0,6)+"-"+generateRandomId(4))}catch(B){if(!v(M))return;if(B.data?.error==="github_app_reconnect_required"){e.gistAppRequired=!0,x("sourceUrl","missing",!1);return}if(B.data?.error==="github_oauth_required"){e.gistOAuthRequired=!0,x("sourceUrl","missing",!1);return}throw We(B),B}finally{C(M)}}let Vs=ut(new Map);function Jm(){let E=new Set,M=e.details&&e.details.gist;if(!M)return E;typeof M.description=="string"&&E.add(M.description),typeof M.ownerLogin=="string"&&E.add(M.ownerLogin);let B=M.files||[];for(let pe of B)typeof pe.filename=="string"&&E.add(pe.filename),typeof pe.content=="string"&&E.add(pe.content);let Y=M.comments||[];for(let pe of Y)typeof pe.author=="string"&&E.add(pe.author),typeof pe.body=="string"&&E.add(pe.body);return E}let In=sa("gist",()=>{let E=Jm(),M=Array.from(E);return M.length===0?null:{contents:M,options:go()}},(E,M)=>{if(!Array.isArray(E?.contents)||E.contents.length!==M.contents.length||E.contents.some(pe=>typeof pe!="string"))throw Error("Invalid preview response");let B=M.contents,Y=new Map;for(let pe=0;pe<B.length&&pe<E.contents.length;pe++)Y.set(B[pe],E.contents[pe]);Vs.clear(),Y.forEach((pe,Ce)=>Vs.set(Ce,pe)),la()});e.anonymizeGistContent=function(E){return E&&(Vs.has(E)?Vs.get(E):"")},e.previewGistFiles=[];function la(){let E=e.details&&e.details.gist&&e.details.gist.files||[];e.previewGistFiles=E.map(M=>({filename:e.anonymizeGistContent(M.filename),content:e.anonymizeGistContent(M.content),language:M.language}))}e.watch("details.gist.files",la,!0),e.watch("terms",la);function Zm(){let E=e.conference;if(e.conference_data=null,!E)return;let M=E===b||e.isUpdate&&E===e._originalConference;E!==b&&(b=null),t.get("/api/conferences/"+E).then(B=>{e.conference===E&&(e.conference_data=B.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===E&&(e.conference_data=null)})}function qs(){x("repoId","used",!0),x("repoId","format",!0),x("pullRequestId","used",!0),x("pullRequestId","format",!0),x("gistId","used",!0),x("gistId","format",!0),x("sourceUrl","used",!0),x("sourceUrl","missing",!0),x("sourceUrl","access",!0),x("sourceUrl","github",!0),x("commit","exists",!0),x("conference","activated",!0),x("terms","format",!0),e.termHints=[]}function Ti(){if(e.detectedType==="repo"&&e.options.expirationMode==="never")return!1;let E=e.anonymize&&e.anonymize.expirationDate;return!e.options.expirationDate||E&&E.invalid?(E&&E. Line truncated
`).filter(Ce=>Ce),connection:e.githubConnection,fullName:`${B.owner}/${B.repo}`,repository:e.sourceUrl,reconnectRepositoryId:e.reconnectRepositoryId,options:e.options,source:e.source,conference:e.conference};e.details&&(Y.options.pageSource=e.details.pageSource),qs();let pe=e.isUpdate?"/api/repo/"+e.repoId:"/api/repo/";t.post(pe,Y,{headers:{"Content-Type":"application/json"}}).then(()=>{R.clear(),window.location.href="/status/"+e.repoId},Ce=>{if(Ce.data){let Ze=["quota_exceeded","quota_repository_limit","quota_storage_limit","subscription_required_for_never_expiration"].includes(Ce.data.error);Ze||o("ERRORS."+Ce.data.error).then(Gt=>{e.error=Gt},console.error),Pi(Ce.data.error),Ze&&(Ce.data.error==="subscription_required_for_never_expiration"&&(e._existingNever=!1),e.hostingQuotaBlocked=!0,e.hostingReview=!0,xe(()=>document.getElementById("repository-hosting")?.scrollIntoView({block:"center"})))}}).finally(()=>{M.disabled=!1})},e.anonymizeGist=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ti())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.disabled=!0;let B=parseGithubUrl(e.sourceUrl),Y={gistId:e.gistId,terms:e.terms.trim().split(`
`).filter(Ce=>Ce),source:{gistId:B.gistId},options:e.options,conference:e.conference};qs();let pe=e.isUpdate?"/api/gist/"+e.gistId:"/api/gist/";t.post(pe,Y,{headers:{"Content-Type":"application/json"}}).then(()=>{R.clear(),window.location.href="/gist/"+e.gistId},Ce=>{Ce.data&&(o("ERRORS."+Ce.data.error).then(Ze=>{e.error=Ze},console.error),Pi(Ce.data.error))}).finally(()=>{M.disabled=!1})},e.anonymizePullRequest=E=>{if(e.sourceLoading){e.error="Wait for the source to finish loading before saving.";return}if(Ti())return;if(e.anonymize?.invalid||e.sourceUrlError){e.error="Please correct the highlighted fields before saving.";return}let M=E.currentTarget||E.target.closest?.("button")||E.target;M.disabled=!0;let B=parseGithubUrl(e.sourceUrl),Y={pullRequestId:e.pullRequestId,connection:e.githubConnection,terms:e.terms.trim().split(`
`).filter(Ce=>Ce),source:{repositoryFullName:`${B.owner}/${B.repo}`,pullRequestId:B.pullRequestId},options:e.options,conference:e.conference};qs();let pe=e.isUpdate?"/api/pr/"+e.pullRequestId:"/api/pr/";t.post(pe,Y,{headers:{"Content-Type":"application/json"}}).then(()=>{R.clear(),window.location.href="/pr/"+e.pullRequestId},Ce=>{Ce.data&&(o("ERRORS."+Ce.data.error).then(Ze=>{e.error=Ze},console.error),Pi(Ce.data.error))}).finally(()=>{M.disabled=!1})},e.watch("conference",()=>{Zm()}),e.termHints=[],e.matchTermAsWritten=E=>{e.terms=uf(e.terms,E)},e.watch("options.preserveFiles",()=>{e.detectedType==="repo"&&en()}),e.watch("terms",()=>{e.termHints=df(e.terms),e.detectedType==="repo"&&Dn(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&In()}),e.watch("options.image",()=>{e.detectedType==="repo"&&Dn(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&In()}),e.watch("options.link",()=>{e.detectedType==="repo"&&Dn(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&In()}),e.watch("details",()=>{e.detectedType==="repo"&&Dn(),e.detectedType==="pr"&&An(),e.detectedType==="gist"&&In()},!0)},Zl=function(e,t,s,i,r,o){bl(e);let u=Pt();xr();let p=Lt(),d=0,g=null,m=null;e.fileLoadingSlow=!1,e.fileReceivedBytes=0;function v(){g&&(g.resolve(),g=null),m&&(u.timeout.cancel(m),m=null)}let y=!1;e.on("dispose",()=>{y=!0,d++,v(),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",F=>{e.symbolsOpen&&!F.target.closest?.(".symbols")&&(e.symbolsOpen=!1),e.moreOpen&&!F.target.closest?.(".tb-more")&&(e.moreOpen=!1),e.tocOpen&&!F.target.closest?.(".tb-toc-m")&&(e.tocOpen=!1),e.gotoOpen&&F.target.isConnected&&!F.target.closest?.(".goto-pop, .btn-goto, .tb-more")&&(e.gotoOpen=!1),e.accountOpen&&!F.target.closest?.(".acct")&&(e.accountOpen=!1),e.helpOpen&&!F.target.closest?.(".vb-help")&&(e.helpOpen=!1)}),p(document,"keydown",F=>{F.key==="Escape"&&(e.symbolsOpen=!1,e.moreOpen=!1,e.tocOpen=!1,e.gotoOpen=!1,e.accountOpen=!1,e.helpOpen=!1),(F.ctrlKey||F.metaKey)&&!F.altKey&&F.key&&F.key.toLowerCase()==="f"&&e.type==="html"&&window.document.querySelector(".reading-layout")&&(F.preventDefault(),e.toggleMdFind(!0))}),p(document,"keydown",function(F){if((F.metaKey||F.ctrlKey)&&F.key==="k"){F.preventDefault();var V=document.querySelector(".tree-search-input");V&&(V.focus(),V.select())}});var C=null;e.onFileSearchChange=function(){C&&(C.resolve(),C=null);let F=e.fileSearchQuery;if(!F||F.length<2){e.fileSearchResults=null,e.fileSearchLoading=!1;return}e.fileSearchLoading=!0;let V=o.defer();C=V,t.get(`/api/repo/${e.repoId}/files/search?q=${encodeURIComponent(F)}`,{timeout:V.promise}).then(function(S){if(!(y||C!==V)){C=null,e.fileSearchLoading=!1;var q={};e.files.forEach(function(Me){q[(Me.path||"")+"/"+Me.name]=!0});for(var G=[],oe={},K=0;K<S.data.length;K++){var ne=S.data[K];if(ne.path)for(var le=ne.path.split("/"),ye="",Ae=0;Ae<le.length;Ae++){var Xe=ye;ye=ye?ye+"/"+le[Ae]:le[Ae];var tt=Xe+"/"+le[Ae];!q[tt]&&!oe[tt]&&(oe[tt]=!0,G.push({name:le[Ae],path:Xe}))}}G.sort(function(Me,Q){return(Me.path||"").split("/").length-(Q.path||"").split("/").length}),G.length>0&&e.files.push.apply(e.files,G);for(var Ge=[],We=0;We<S.data.length;We++){var it=S.data[We],gt=(it.path||"")+"/"+it.name;!q[gt]&&it.size!=null&&(Ge.push(it),q[gt]=!0)}Ge.length>0&&e.files.push.apply(e.files,Ge),e.fileSearchResults=S.data}},function(){!y&&C===V&&(C=null,e.fileSearchLoading=!1,e.fileSearchResults=[])})},e.on("routeUpdate",function(F,V){if(e.repoId!=i.repoId)return ae();if((i.path||"")!=e.filePath){window.matchMedia?.("(max-width: 767px)").matches&&(e.sidebarCollapsed=!0),e.filePath=i.path||"",e.paths=e.filePath.split("/").filter(S=>S&&S.trim().length>0),W();for(let S=0;S<e.paths.length-1;S++){let q=S>0?e.paths.slice(0,S).join("/"):"";e.files.some(oe=>oe.path===q)||e.getFiles(q)}}});function k(){if(e.paths[0]!="")return;let F=["readme.md","readme.txt","readme.org","readme.1st","readme"],V={};for(let q of e.files)q.name.toLowerCase().indexOf("readme")>-1&&(V[q.name.toLowerCase()]=q.name);let S=null;for(let q of F)if(V[q]){S=q;break}if(!S&&Object.keys(V).length>0&&(S=Object.keys(V)[0]),S){let q=s.url();q[q.length-1]!="/"&&(q+="/"),s.url(q+encodePathForUrl(V[S]))}}e.fileCounts=null;let w=0,R=new Set,b=!1;e.getFiles=function(F,V=!1){let S=e.repoId,q=w;return t.get(`/api/repo/${e.repoId}/files/?path=${encodeURIComponent(F)}&v=${e.options.lastUpdateDate}`).then(function(G){if(y||S!==e.repoId||q!==w)return[];let oe=F||"";return e.files=e.files.filter(K=>K.path!==oe),e.files.push(...G.data),e.loadedFolders={...e.loadedFolders,[oe]:!0},P(oe,q),G.data},function(G){if(y||S!==e.repoId||q!==w)return[];V||(e.type="error",e.content=Jr(G),e.files=[])})};function P(F,V){if(b||R.has(F))return;R.add(F);let S=e.repoId;t.get(`/api/repo/${e.repoId}/files/counts?path=${encodeURIComponent(F)}`).then(function(q){y||S!==e.repoId||V!==w||(e.fileCounts={ Line truncated
`+c(s.event.errorStack),1),s.event.causeType?(a(),l(N,{key:0},[h(`
Caused by `+c(s.event.causeType)+`
`+c(s.event.causeStack||""),1)],64)):f("v-if",!0)])):f("v-if",!0),n("pre",null,c(e.recordJson(s.event)),1)],8,jE)):f("v-if",!0)],2))),128))]),e.trace?.events?.length?(a(),l("p",GE,[h(c(e.errPlural(e.trace.events.length,"record"))+" with this "+c(e.traceKind())+" ID",1),e.trace.state==="partial"?(a(),l(N,{key:0},[h(" (partial)")],64)):f("v-if",!0),t[96]||(t[96]=h(". External calls come from ",-1)),t[97]||(t[97]=n("code",null,"external_request",-1)),t[98]||(t[98]=h(" records; no URLs or tokens are stored. ",-1)),e.trace.grafanaUrl?(a(),l("a",{key:1,href:e.safeUrl(e.trace.grafanaUrl),target:"_blank",rel:"noopener noreferrer"},"Open in Grafana",8,WE)):f("v-if",!0)])):(a(),l("p",KE,[t[99]||(t[99]=n("strong",null,"Timeline not recorded.",-1)),t[100]||(t[100]=h()),e.traceKind()?e.issueData.source!=="central"?(a(),l(N,{key:1},[h("The application history keeps single records; the timeline needs central logs.")],64)):e.trace?.state==="unreachable"?(a(),l(N,{key:2},[h("Central logs did not answer. Retry later.")],64)):(a(),l(N,{key:3},[h("Central logs returned no other record for this "+c(e.traceKind())+".",1)],64)):(a(),l(N,{key:0},[h("This record has no request or job ID, so its other records cannot be found.")],64)),t[101]||(t[101]=h(" Only this record is shown.",-1))]))],64))])):f("v-if",!0),e.requestTab==="request"?(a(),l("div",YE,[n("dl",XE,[n("div",null,[t[102]||(t[102]=n("dt",null,"Method \xB7 route",-1)),n("dd",null,[e.currentOccurrence().route||e.selectedIssue.route?(a(),l("code",QE,c(e.currentOccurrence().method||e.selectedIssue.method)+" "+c(e.currentOccurrence().route||e.selectedIssue.route),1)):(a(),l("span",JE,"not recorded"))])]),n("div",null,[t[103]||(t[103]=n("dt",null,"Path",-1)),n("dd",null,[e.currentOccurrence().requestPath?(a(),l("code",ZE,c(e.currentOccurrence().requestPath),1)):(a(),l("span",xE,"not recorded"))])]),t[110]||(t[110]=n("div",null,[n("dt",null,"Query"),n("dd",null,[n("span",{class:"errs-placeholder"},"excluded: query strings are never logged")])],-1)),n("div",null,[t[104]||(t[104]=n("dt",null,"Body",-1)),n("dd",null,[n("span",eS,c(["GET","HEAD"].includes(e.currentOccurrence().method||e.selectedIssue.method)?"none ("+(e.currentOccurrence().method||e.selectedIssue.method)+")":"not recorded"),1)])]),n("div",null,[t[105]||(t[105]=n("dt",null,"Viewer",-1)),n("dd",null,[e.currentOccurrence().viewer?(a(),l(N,{key:0},[h(c(e.viewerLabel(e.currentOccurrence().viewer)),1),e.currentOccurrence().viewer==="visitor"||e.currentOccurrence().viewer==="anonymous"?(a(),l("span",tS," \xB7 reviewers are never identified")):f("v-if",!0)],64)):(a(),l("span",nS,"not recorded"))])]),n("div",null,[t[106]||(t[106]=n("dt",null,"Repository",-1)),n("dd",null,[e.currentOccurrence().repoId?(a(),l("a",{key:0,class:"errs-mono",href:e.errRepoHref(e.currentOccurrence().repoId)},c(e.currentOccurrence().repoId),9,sS)):(a(),l("span",oS,"not recorded")),e.ownerOf(e.currentOccurrence().repoId)?.source?(a(),l("span",iS," \xB7 "+c(e.ownerOf(e.currentOccurrence().repoId).source),1)):f("v-if",!0)])]),n("div",null,[t[107]||(t[107]=n("dt",null,"User",-1)),n("dd",null,[e.currentOccurrence().userId?(a(),l("a",{key:0,href:e.errUserHref(e.currentOccurrence().userId)},c(e.userName(e.currentOccurrence().userId)?"@"+e.userName(e.currentOccurrence().userId):e.currentOccurrence().userId),9,rS)):(a(),l("span",aS,"not recorded"))])]),n("div",null,[t[108]||(t[108]=n("dt",null,"Service \xB7 release",-1)),n("dd",null,[h(c(e.currentOccurrence().service||e.selectedIssue.service||"unknown")+" \xB7 ",1),e.currentOccurrence().release&&e.currentOccurrence().release!=="unknown"?(a(),l("code",lS,c(e.currentOccurrence().release.slice(0,7)),1)):(a(),l("span",dS,"release not recorded"))])]),(a(),l(N,null,U(["requestId","jobId"],s=>n("div",{key:s},[n("dt",null,c(s==="requestId"?"Request ID":"Job ID"),1),n("dd",null,[e.currentOccurrence()[s]?(a(),l(N,{key:0},[n("code",uS,c(e.currentOccurrence()[s]),1),t[109]||(t[109]=h()),n("button",{type:"button",class:"errs-link-button",onClick:i=>e.copyValue(e.currentOccurrence()[s],s==="requestId"?"Request ID":"Job ID")},"Copy",8,cS)],64)):(a(),l("span",pS,"not recorded"))])])),64))])])):f("v-if",!0),e.requestTab==="exception"?(a(),l("div",fS,[e.exceptionRecord().record?(a(),l(N,{key:0},[e.exceptionRecord().fromSample?(a(),l("p",mS,"This occurrence has no stack of its own; showing the latest occurrence's.")):f("v-if",!0),n("dl",hS,[n("div",null,[t[111]||(t[111]=n("dt",null,"Type",-1)),n("dd",null,[n("code",null,c(e.exceptionRecord().record.errorType||"not recorded"),1)])]),n("div",null,[t[112]||(t[112]=n("dt",null,"Code",-1)),n("dd",null,[e.exceptionRecord().record.errorCode?(a(),l("code",gS,c(e.exceptionRecord().record.errorCode),1)):(a(),l("span",yS,"not recorded"))])]),n("div",null,[t[113]||(t[113]=n("dt",null,"Cause",-1)),n("dd",null,[e.exceptionRecord().record.causeType?(a(),l("code",vS,c(e.exceptionRecord().record.causeType),1)):(a(),l("span",bS,"not recorded"))])])]),t[115]||(t[115]=n("h3",{class:"errs-subhead Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,10,uM),[[u,{state:e.viewState,set:d=>{e.terms=d},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",cM,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=g()),n("small",pM,[t[121]||(t[121]=g("Regex is supported. Replaced by ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK)+"-[N]",1),t[122]||(t[122]=g(", or use ",-1)),t[123]||(t[123]=n("code",null,"term=>replacement",-1)),t[124]||(t[124]=g(" to pick your own (e.g. ",-1)),t[125]||(t[125]=n("code",null,"Anonymous=>ABC",-1)),t[126]||(t[126]=g(").",-1))])]),(a(!0),l(R,null,_((e.termHints||[]).slice(0,3),d=>(a(),l("div",{class:"term-hint",key:d.line},[n("span",null,[t[129]||(t[129]=g("In ",-1)),n("code",null,c(d.term),1),t[130]||(t[130]=g(", ",-1)),n("code",null,c(d.symbols.join(" ")),1),g(" "+c(d.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:h=>e.matchTermAsWritten(d.line)},"Match as written",8,fM)]))),128)),(e.termHints||[]).length>3?(a(),l("div",mM,c(e.termHints.length-3)+" more "+c(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),A(n("div",hM,"Terms are in an invalid format.",512),[[ee,e.anonymize?.terms?.errors?.format]])]),A(n("div",gM,[n("div",vM,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",yM,c(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]=d=>e.openPreserveFiles())},c((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,bM)],512),[[ee,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(d=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=de(d=>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)),A(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]=d=>e.preserve.search=d)},null,512),[[ct,e.preserve.search]]),n("div",wM,[e.preserve.loading?(a(),l("p",kM,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",CM,c(e.preserve.error),1)):(a(),l(R,{key:2},[(a(!0),l(R,null,_(e.preserveRows(),(d,h)=>(a(),l("div",{class:"preserve-item",key:d.kind+":"+d.path,style:Me({paddingLeft:d.depth*18+6+"px"})},[d.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":d.open?"true":"false","aria-label":(d.open?"Collapse ":"Expand ")+d.label,onClick:m=>e.togglePreserveDir(d.path)},c(d.open?"\u25BE":"\u25B8"),9,SM)):(a(),l("span",EM)),n("input",{type:"checkbox",id:"pf-"+h,"aria-label":d.kind==="dir"?"Leave folder "+d.path+" unredacted":null,checked:d.state==="all",".indeterminate":d.state==="some",disabled:d.locked,onChange:m=>d.kind==="dir"?e.togglePreserveFolder(d.path):e.togglePreserveFile(d.path)},null,40,NM),n("label",{for:d.kind==="file"?"pf-"+h:null,class:"preserve-name",onClick:m=>d.kind==="dir"&&e.togglePreserveDir(d.path)},c(d.label),9,RM),d.note?(a(),l("span",TM,c(d.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",PM,c(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",AM,"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)),A(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=d=>e.preserve.patterns=d)},null,512),[[ct,e.preserve.patterns]]),t[135]||(t[135]=n("small",{class:"form-text text-muted"},[g("One per line, as in .gitignore: "),n("code",null,"*.bib"),g(" matches in any folder; "),n("code",null,"/refs.bib"),g(" and "),n("code",null,"paper/refs.bib"),g(" match from the repository root; a folder name such as "),n("code",null,"drafts/"),g(" covers everything inside it; "),n("code",null,"!private.bib"),g(" excludes again.")],-1))],8,DM),n("div",IM,[n("span",OM,c(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",MM,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=d=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[ee,e.detectedType&&e.sourceReady()]]),A(n("section",VM,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),A(n("div",null,[n("div",LM,[A(n("input",qM,null,512),[[u,{state:e.viewState,set:d=>{e.options.link=d},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",$M,[A(n("input",FM,null,512),[[u,{state:e.viewState,set:d=>{e.options.image=d},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",UM,[A(n("input",BM,null,512),[[u,{state:e.viewState,set:d=>{e.options.pdf=d},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",_M,[A(n("input",zM,null,512),[[u,{state:e.viewState,set:d=>{e.options.notebook=d},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",HM,[A(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,jM),[[u,{state:e.viewState,set:d=>{e.options.page=d},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",GM,c(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",WM,c(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[ee,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",KM,[...t[145]||(t[145]=[g("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),A(n("div",null,[n("div",YM,[A(n("input",XM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},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",JM,[A(n("input",QM,null,512),[[u,{state:e.viewState,set:d=>{e.options.content=d},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",ZM,[A(n("input",xM,null,512),[[u,{state:e.viewState,set:d=>{e.options.comments=d},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",eV,[A(n("input",tV,null,512),[[u,{state:e.viewState,set:d=>{e.options.username=d},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",nV,[A(n("input",sV,null,512),[[u,{state:e.viewState,set:d=>{e.options.date=d},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",oV,[A(n("input",iV,null,512),[[u,{state:e.viewState,set:d=>{e.options.origin=d},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),[[ee,e.detectedType==="gist"]]),A(n("div",null,[n("div",rV,[A(n("input",aV,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",lV,[A(n("input",dV,null,512),[[u,{state:e.viewState,set:d=>{e.options.body=d},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]) Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(R,null,_([1,2,3,4],(r,u)=>(a(),l(R,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",MB,[...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(R,null,_(e.filteredItems,(r,u)=>(a(),l(R,{key:r?._type+":"+(r?._id||u)},[e.loading?f("v-if",!0):(a(),l("div",{key:0,class:T(["paper-table-row",{"repo-inactive":r?._statusKey=="expired"||r?._statusKey=="removed","repo-error":r?.status=="error","row-clickable":!!r?._viewUrl}]),role:"row",onClick:p=>e.openItem(r,p)},[n("div",LB,[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",$B,[n("use",{href:"#project-type-"+r._type},null,8,FB)]))],8,qB),n("div",UB,[n("div",BB,[r?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:r._label,href:e.safeUrl(r?._viewUrl)},[(r?._label||"").indexOf("/")>0?(a(),l(R,{key:0},[n("span",zB,c(r._label.slice(0,r._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",HB,c(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(R,{key:1},[g(c(r?._label),1)],64))],8,_B)):f("v-if",!0),r?._viewUrl?f("v-if",!0):(a(),l("span",jB,[(r?._label||"").indexOf("/")>0?(a(),l(R,{key:0},[n("span",GB,c(r._label.slice(0,r._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",WB,c(r._label.slice(r._label.indexOf("/")+1)),1)],64)):(a(),l(R,{key:1},[g(c(r?._label),1)],64))])),r?.role==="coauthor"?(a(),l("span",KB,"Co-author")):f("v-if",!0)]),r?._id||r?._type==="repo"&&r?.source?.commit||r?.conference?(a(),l("div",YB,[r?._id?(a(),l("code",{key:0,class:"anonymous-id",title:r._id},[r._id.length>14?(a(),l(R,{key:0},[n("span",JB,c(r._id.slice(0,-6)),1),n("span",QB,c(r._id.slice(-6)),1)],64)):(a(),l(R,{key:1},[g(c(r._id),1)],64))],8,XB)):f("v-if",!0),r?._type==="repo"&&r?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:r.source.commit},c(r.source.commit.substring(0,7)),9,ZB)):f("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:c(r?.conference)},null,8,e_)],8,xB)):f("v-if",!0)])):f("v-if",!0)])]),n("div",t_,[n("div",n_,[n("div",s_,[n("span",{class:T(["status-dot","status-"+r?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:c(e.fmt?.statusLabel(r?.status))},null,8,o_),r?.status=="removed"?(a(),l(R,{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(p=>e.refreshItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,i_)],64)):f("v-if",!0)]),r?.status=="error"&&r?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:c(e.fmt?.statusMsg(r?.statusMessage)),title:r?.statusMessage},null,8,r_)):f("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)},c(e.idleText(r)),9,a_)):f("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,l_)):f("v-if",!0),r._stale||r._broken?(a(),l("div",d_,[r._stale&&!r._broken?(a(),l("span",u_,[...t[68]||(t[68]=[g("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):f("v-if",!0),r._stale||r._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:de(p=>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},c(r._broken?"Review details":"Check progress"),9,c_)):f("v-if",!0)])):f("v-if",!0),r?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:de(p=>e.extendItem(r),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,p_)):f("v-if",!0),r?.status=="removed"&&r?.anonymizeDate?(a(),l("div",f_,"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"})]),g("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"})]),g("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,[g("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"),g(" 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"})]),g("Self"),n("span",{class:"serif-hy"},"-"),g("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,W6),[[u,{state:e.viewState,set:d=>{e.terms=d},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",K6,[t[127]||(t[127]=n("summary",null,"Regex & replacement syntax",-1)),t[128]||(t[128]=h()),n("small",Y6,[t[121]||(t[121]=h("Regex is supported. Replaced by ",-1)),n("code",null,c(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(N,null,U((e.termHints||[]).slice(0,3),d=>(a(),l("div",{class:"term-hint",key:d.line},[n("span",null,[t[129]||(t[129]=h("In ",-1)),n("code",null,c(d.term),1),t[130]||(t[130]=h(", ",-1)),n("code",null,c(d.symbols.join(" ")),1),h(" "+c(d.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:g=>e.matchTermAsWritten(d.line)},"Match as written",8,X6)]))),128)),(e.termHints||[]).length>3?(a(),l("div",Q6,c(e.termHints.length-3)+" more "+c(e.termHints.length-3===1?"term uses":"terms use")+" regex symbols.",1)):f("v-if",!0),O(n("div",J6,"Terms are in an invalid format.",512),[[te,e.anonymize?.terms?.errors?.format]])]),O(n("div",Z6,[n("div",x6,[t[133]||(t[133]=n("span",{class:"paper-field-label",id:"preserve-files-label"},"Unredacted files",-1)),n("span",eM,c(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]=d=>e.openPreserveFiles())},c((e.options?.preserveFiles||[]).length?"Edit":"Choose files"),9,tM)],512),[[te,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(d=>e.closePreserveFiles(),["prevent"]))},[n("form",{onSubmit:t[30]||(t[30]=de(d=>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)),O(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]=d=>e.preserve.search=d)},null,512),[[ft,e.preserve.search]]),n("div",nM,[e.preserve.loading?(a(),l("p",sM,"Loading files from GitHub\u2026")):e.preserve.error?(a(),l("p",oM,c(e.preserve.error),1)):(a(),l(N,{key:2},[(a(!0),l(N,null,U(e.preserveRows(),(d,g)=>(a(),l("div",{class:"preserve-item",key:d.kind+":"+d.path,style:De({paddingLeft:d.depth*18+6+"px"})},[d.kind==="dir"?(a(),l("button",{key:0,type:"button",class:"preserve-caret","aria-expanded":d.open?"true":"false","aria-label":(d.open?"Collapse ":"Expand ")+d.label,onClick:m=>e.togglePreserveDir(d.path)},c(d.open?"\u25BE":"\u25B8"),9,iM)):(a(),l("span",rM)),n("input",{type:"checkbox",id:"pf-"+g,"aria-label":d.kind==="dir"?"Leave folder "+d.path+" unredacted":null,checked:d.state==="all",".indeterminate":d.state==="some",disabled:d.locked,onChange:m=>d.kind==="dir"?e.togglePreserveFolder(d.path):e.togglePreserveFile(d.path)},null,40,aM),n("label",{for:d.kind==="file"?"pf-"+g:null,class:"preserve-name",onClick:m=>d.kind==="dir"&&e.togglePreserveDir(d.path)},c(d.label),9,lM),d.note?(a(),l("span",dM,c(d.note),1)):f("v-if",!0)],4))),128)),!e.preserve.loading&&!e.preserveRows().length?(a(),l("p",uM,c(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",cM,"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)),O(n("textarea",{class:"form-control",rows:"3","aria-label":"Patterns",placeholder:`*.bib
paper/appendix/**`,"onUpdate:modelValue":t[28]||(t[28]=d=>e.preserve.patterns=d)},null,512),[[ft,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,pM),n("div",fM,[n("span",mM,c(e.preserve.loading||e.preserve.error?"":e.preserveCount()+(e.preserveCount()===1?" file":" files")+" will be shown as written"),1),n("span",hM,[n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[29]||(t[29]=d=>e.closePreserveFiles())},"Cancel"),t[136]||(t[136]=n("button",{type:"submit",class:"btn btn-ink"},"Save",-1))])])],32)],32)):f("v-if",!0)],512),[[te,e.detectedType&&e.sourceReady()]]),O(n("section",gM,[t[159]||(t[159]=n("h2",{class:"paper-section-eyebrow"},"Display",-1)),O(n("div",null,[n("div",yM,[O(n("input",vM,null,512),[[u,{state:e.viewState,set:d=>{e.options.link=d},value:e.options?.link,form:"anonymize",options:{}}]]),t[140]||(t[140]=n("label",{class:"form-check-label",for:"link"},"Keep links",-1))]),n("div",bM,[O(n("input",wM,null,512),[[u,{state:e.viewState,set:d=>{e.options.image=d},value:e.options?.image,form:"anonymize",options:{}}]]),t[141]||(t[141]=n("label",{class:"form-check-label",for:"image"},"Display images",-1))]),n("div",kM,[O(n("input",CM,null,512),[[u,{state:e.viewState,set:d=>{e.options.pdf=d},value:e.options?.pdf,form:"anonymize",options:{}}]]),t[142]||(t[142]=n("label",{class:"form-check-label",for:"pdf"},"Display PDFs",-1))]),n("div",EM,[O(n("input",SM,null,512),[[u,{state:e.viewState,set:d=>{e.options.notebook=d},value:e.options?.notebook,form:"anonymize",options:{}}]]),t[143]||(t[143]=n("label",{class:"form-check-label",for:"notebook"},"Display notebooks",-1))]),n("div",NM,[O(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,RM),[[u,{state:e.viewState,set:d=>{e.options.page=d},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",TM,c(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",PM,c(e.fmt?.translate("WARNINGS.page_branch_mismatch",{pageBranch:e.details?.pageSource?.branch,selectedBranch:e.source?.branch})),1)):f("v-if",!0)])],512),[[te,e.detectedType==="repo"]]),e.detectedType==="repo"&&(e.options.image||e.options.pdf)?(a(),l("p",DM,[...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),O(n("div",null,[n("div",AM,[O(n("input",IM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},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",OM,[O(n("input",MM,null,512),[[u,{state:e.viewState,set:d=>{e.options.content=d},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",VM,[O(n("input",qM,null,512),[[u,{state:e.viewState,set:d=>{e.options.comments=d},value:e.options?.comments,form:"anonymize",options:{}}]]),t[148]||(t[148]=n("label",{class:"form-check-label",for:"comments-gist"},"Comments",-1))]),n("div",LM,[O(n("input",$M,null,512),[[u,{state:e.viewState,set:d=>{e.options.username=d},value:e.options?.username,form:"anonymize",options:{}}]]),t[149]||(t[149]=n("label",{class:"form-check-label",for:"username-gist"},"Usernames",-1))]),n("div",FM,[O(n("input",UM,null,512),[[u,{state:e.viewState,set:d=>{e.options.date=d},value:e.options?.date,form:"anonymize",options:{}}]]),t[150]||(t[150]=n("label",{class:"form-check-label",for:"date-gist"},"Dates",-1))]),n("div",BM,[O(n("input",HM,null,512),[[u,{state:e.viewState,set:d=>{e.options.origin=d},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),[[te,e.detectedType==="gist"]]),O(n("div",null,[n("div",zM,[O(n("input",jM,null,512),[[u,{state:e.viewState,set:d=>{e.options.title=d},value:e.options?.title,form:"anonymize",options:{}}]]),t[152]||(t[152]=n("label",{class:"form-check-label",for:"title"},"PR title",-1))]),n("div",_M,[O(n("input",GM,null,512),[[u,{state:e.viewState,set:d=>{e.options.body=d},value:e.options?.body,form:"anonymize",options:{}}]]),t[153]||(t[153]=n("label",{class:"form-check-label",for:"body"},"PR body",-1))]) Line truncated
for the rows when a reload (tab, search, filter) has none of the new rows yet `),(a(),l(N,null,U([1,2,3,4],(o,u)=>(a(),l(N,null,[e.loading||e.refreshing&&e.filteredItems?.length==0?(a(),l("div",hB,[...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(N,null,U(e.filteredItems,(o,u)=>(a(),l(N,{key:o?._type+":"+(o?._id||u)},[e.loading?f("v-if",!0):(a(),l("div",{key:0,class:T(["paper-table-row",{"repo-inactive":o?._statusKey=="expired"||o?._statusKey=="removed","repo-error":o?.status=="error","row-clickable":!!o?._viewUrl}]),role:"row",onClick:p=>e.openItem(o,p)},[n("div",yB,[n("span",{class:"project-type-icon",role:"img","aria-label":o?._type==="repo"?"Repository":o?._type==="pr"?"Pull request":"Gist",title:o?._type==="repo"?"Repository":o?._type==="pr"?"Pull request":"Gist"},[(a(),l("svg",bB,[n("use",{href:"#project-type-"+o._type},null,8,wB)]))],8,vB),n("div",kB,[n("div",CB,[o?._viewUrl?(a(),l("a",{key:0,class:"repo-name",title:o._label,href:e.safeUrl(o?._viewUrl)},[(o?._label||"").indexOf("/")>0?(a(),l(N,{key:0},[n("span",SB,c(o._label.slice(0,o._label.indexOf("/")+1)),1),t[64]||(t[64]=n("wbr",null,null,-1)),n("span",NB,c(o._label.slice(o._label.indexOf("/")+1)),1)],64)):(a(),l(N,{key:1},[h(c(o?._label),1)],64))],8,EB)):f("v-if",!0),o?._viewUrl?f("v-if",!0):(a(),l("span",RB,[(o?._label||"").indexOf("/")>0?(a(),l(N,{key:0},[n("span",TB,c(o._label.slice(0,o._label.indexOf("/")+1)),1),t[65]||(t[65]=n("wbr",null,null,-1)),n("span",PB,c(o._label.slice(o._label.indexOf("/")+1)),1)],64)):(a(),l(N,{key:1},[h(c(o?._label),1)],64))])),o?.role==="coauthor"?(a(),l("span",DB,"Co-author")):f("v-if",!0)]),o?._id||o?._type==="repo"&&o?.source?.commit||o?.conference?(a(),l("div",AB,[o?._id?(a(),l("code",{key:0,class:"anonymous-id",title:o._id},[o._id.length>14?(a(),l(N,{key:0},[n("span",OB,c(o._id.slice(0,-6)),1),n("span",MB,c(o._id.slice(-6)),1)],64)):(a(),l(N,{key:1},[h(c(o._id),1)],64))],8,IB)):f("v-if",!0),o?._type==="repo"&&o?.source?.commit?(a(),l("span",{key:1,class:"commit-hash",title:o.source.commit},c(o.source.commit.substring(0,7)),9,VB)):f("v-if",!0),o?.conference?(a(),l("span",{key:2,class:"cell-conf conf-tag",title:"Conference: "+o.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:c(o?.conference)},null,8,LB)],8,qB)):f("v-if",!0)])):f("v-if",!0)])]),n("div",$B,[n("div",FB,[n("div",UB,[n("span",{class:T(["status-dot","status-"+o?._statusKey]),"aria-hidden":"true"},null,2),n("span",{class:"status-word",textContent:c(e.fmt?.statusLabel(o?.status))},null,8,BB),o?.status=="removed"?(a(),l(N,{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(p=>e.refreshItem(o),["stop"]),title:"Reviewers can no longer open this link"},"Enable again",8,HB)],64)):f("v-if",!0)]),o?.status=="error"&&o?.statusMessage?(a(),l("div",{key:0,class:"status-sub status-sub-error",textContent:c(e.fmt?.statusMsg(o?.statusMessage)),title:o?.statusMessage},null,8,zB)):f("v-if",!0),o?._stale?(a(),l("div",{key:1,class:"status-sub status-sub-warn",title:"Last activity "+e.fmt?.humanTime(o?.anonymizeDate||o?.lastView)},c(e.idleText(o)),9,jB)):f("v-if",!0),o.status==="error"&&o._editUrl?(a(),l("a",{key:2,class:"project-attention-action",href:e.safeUrl(o._editUrl)},"Fix source",8,_B)):f("v-if",!0),o._stale||o._broken?(a(),l("div",GB,[o._stale&&!o._broken?(a(),l("span",WB,[...t[68]||(t[68]=[h("May be stuck",-1),n("span",{"aria-hidden":"true"}," \xB7 ",-1)])])):f("v-if",!0),o._stale||o._broken?(a(),l("button",{key:1,type:"button",class:"project-attention-action",onClick:de(p=>e.showProjectDetails(o),["stop"]),"data-project-actions":o._broken?encodeURIComponent(o._type+":"+o._id):null,"aria-controls":o._broken?e.projectDetailsId(o):null,"aria-expanded":o._broken?e.selectedProject===o:null},c(o._broken?"Review details":"Check progress"),9,KB)):f("v-if",!0)])):f("v-if",!0),o?.status=="expired"?(a(),l("button",{key:4,type:"button",class:"project-attention-action",onClick:de(p=>e.extendItem(o),["stop"]),title:"Reviewers can no longer open this link"},"Extend 6 months",8,YB)):f("v-if",!0),o?.status=="removed"&&o?.anonymizeDate?(a(),l("div",XB,"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:T(["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"})]),g("Report a bug ")],-1)])],2),n("li",{class:T(["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"})]),g("Support ")],-1)])],2),e.isDarkMode?f("v-if",!0):(a(),l("li",cG,[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",pG,[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)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",fG,[...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"}),g(" Sign in ")],-1)])])):f("v-if",!0),e.user?.username&&e.headerCanUpgrade&&!e.headerBillingPending?(a(),l("li",mG,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=de(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",hG,[n("a",gG,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,vG)):f("v-if",!0),n("span",yG,c(e.user?.username),1)]),n("div",bG,[n("h6",wG,"Signed in as @"+c(e.user?.username),1),t[25]||(t[25]=Ae('<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",kG,[...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,CG)):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]=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)),A(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,SG),[[ct,e.emailPromptAddress]]),e.emailPromptError?(a(),l("p Line truncated
python experiments/run.py`),n("p",null,[g("Contact: "),n("span",{class:"redact",role:"img","aria-label":"Redacted term 3"},[n("i",null,"3")])])])])])])],-1))]),f(" Live stats "),n("section",{class:T(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",LG,[e.statsEmpty()?f("v-if",!0):(a(),l("div",qG,[...t[11]||(t[11]=[n("span",{class:"paper-stats-dot","aria-hidden":"true"},null,-1),g(),n("span",null,[g("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",$G,[(a(!0),l(R,null,_(e.cards,(i,o)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:T(["paper-stat-value",{"is-pending":!e.stat}])},c(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",FG,c(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",UG," +"+c(e.fmt?.number(e.history[i?.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,[g("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",BG,[n("div",_G,[t[13]||(t[13]=n("label",{for:"demo-terms"},[g("Terms to redact "),n("span",null,[g("comma-separated"),n("span",{class:"dt-try"},", try adding your own")])],-1)),A(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]=Pt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ct,e.demoTerms]])]),n("div",zG,[n("div",HG,[t[15]||(t[15]=n("div",{class:"pane-header"},[n("span",{class:"pane-label"},[g("Your repository "),n("span",{class:"pane-edit-hint"},"\xB7 editable")]),n("span",{class:"pane-url"},"github.com/jane-smith/DeepLearnUtils")],-1)),n("div",jG,[n("div",GG,[(a(!0),l(R,null,_(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("mark",WG,c(i.original),1)):(a(),l(R,{key:1},[g(c(i.text),1)],64))],64))),128)),t[14]||(t[14]=g("\u200B",-1))]),A(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),[[ct,e.demoText]])])]),n("div",KG,[n("div",YG,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",XG,[n("span",JG,c(e.demoCount())+" redacted",1)])]),n("div",QG,[(a(!0),l(R,null,_(e.demoParts(),(i,o)=>(a(),l(R,{key:o},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},c(i.text),9,ZG)):(a(),l(R,{key:1},[g(c(i.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",xG,[n("div",eW,[(a(!0),l(R,null,_(e.features,(i,o)=>(a(),l("div",{class:T(["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",nW,[n("span",sW,c(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",oW,c(i?.eyebrow),1)]),n("span",iW,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",rW,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)])],40,tW),n("div",aW,[n("span",lW,[g(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",dW,"-")):f("v-if",!0),g(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)]),n("p",null,c(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},c(i?.cta)+" \u2192",9,uW)])],2))),128))]),n("div",cW,[(a(!0),l(R,null,_(e.features,(i,o)=>A((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",fW,[n("div",mW,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",hW,c(i?.url),1)]),n("div",{class:T(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",vW,[...t[19]||(t[19]=[Ae('<div class="fm-label">GitHub reposit Line truncated
label names the service and the tooltip says who to contact. `),n("li",{class:T(["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:T(["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",K_,[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",Y_,[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)])])])):f("v-if",!0),!e.user&&!e.isReviewerRoute?(a(),l("li",X_,[...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",Q_,[n("a",{class:"nav-link nav-upgrade",href:"/profile?upgrade=1",onClick:t[3]||(t[3]=de(s=>e.openHeaderUpgrade(),["prevent"]))},"Upgrade")])):f("v-if",!0),e.user?(a(),l("li",J_,[n("a",Z_,[e.user?.photo?(a(),l("img",{key:0,width:"22",height:"22",class:"rounded-circle",src:e.safeUrl(e.user?.photo)},null,8,x_)):f("v-if",!0),n("span",eG,c(e.user?.username),1)]),n("div",tG,[n("h6",nG,"Signed in as @"+c(e.user?.username),1),t[25]||(t[25]=Pe('<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",sG,[...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,oG)):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]=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)),O(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,iG),[[ft,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:T(["paper-stats paper-wrap",{"is-empty":e.statsEmpty()}]),id:"metrics","aria-label":"Usage over the last 60 days"},[n("div",yG,[e.statsEmpty()?f("v-if",!0):(a(),l("div",vG,[...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",bG,[(a(!0),l(N,null,U(e.cards,(i,r)=>(a(),l("div",{class:"paper-stat-card",key:i?.key},[n("div",{class:T(["paper-stat-value",{"is-pending":!e.stat}])},c(e.stat?e.fmt?.bigNum(i?.total):"\u2014"),3),n("div",wG,c(i?.label),1),e.history[i?.key].bars?.length>1&&e.history[i?.key].deltaToday>0?(a(),l("div",kG," +"+c(e.fmt?.number(e.history[i?.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",CG,[n("div",EG,[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)),O(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]=Tt(de(()=>{},["prevent"]),["enter"]))},null,544),[[ft,e.demoTerms]])]),n("div",SG,[n("div",NG,[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",RG,[n("div",TG,[(a(!0),l(N,null,U(e.demoParts(),(i,r)=>(a(),l(N,{key:r},[i.redacted?(a(),l("mark",PG,c(i.original),1)):(a(),l(N,{key:1},[h(c(i.text),1)],64))],64))),128)),t[14]||(t[14]=h("\u200B",-1))]),O(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),[[ft,e.demoText]])])]),n("div",DG,[n("div",AG,[t[16]||(t[16]=n("span",{class:"pane-label"},"What reviewers see",-1)),n("span",IG,[n("span",OG,c(e.demoCount())+" redacted",1)])]),n("div",MG,[(a(!0),l(N,null,U(e.demoParts(),(i,r)=>(a(),l(N,{key:r},[i.redacted?(a(),l("span",{key:0,class:"redact-chip",title:"Replaces \u201C"+i.original+"\u201D"},c(i.text),9,VG)):(a(),l(N,{key:1},[h(c(i.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",qG,[n("div",LG,[(a(!0),l(N,null,U(e.features,(i,r)=>(a(),l("div",{class:T(["paper-feature",{"is-on":e.feature===i?.key}]),key:i?.key},[n("button",{type:"button",class:"paper-feature-tab",role:"tab",onClick:o=>e.selectFeature(i.key),onKeydown:o=>e.featureKeydown(o,r),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",FG,[n("span",UG,c(i?.num),1),t[17]||(t[17]=n("span",{class:"pf-sep"}," \xB7 ",-1)),n("span",BG,c(i?.eyebrow),1)]),n("span",HG,[h(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",zG,"-")):f("v-if",!0),h(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)])],40,$G),n("div",jG,[n("span",_G,[h(c(i?.title.split("-")[0]),1),i?.title.includes("-")?(a(),l("span",GG,"-")):f("v-if",!0),h(c(i?.title.split("-").slice(1).join("-"))+" "+c(i?.accent),1)]),n("p",null,c(i?.text),1),n("a",{class:"paper-link-arrow",href:e.safeUrl(e.featureHref(i)),target:e.featureTarget(i)},c(i?.cta)+" \u2192",9,WG)])],2))),128))]),n("div",KG,[(a(!0),l(N,null,U(e.features,(i,r)=>O((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",XG,[n("div",QG,[t[18]||(t[18]=n("span",{class:"dots"},[n("i"),n("i"),n("i")],-1)),n("span",JG,c(i?.url),1)]),n("div",{class:T(["feat-mock","is-"+i?.key]),role:"img","aria-label":i?.alt},[i?.key==="anonymize"?(a(),l("div",xG,[...t[19]||(t[19]=[Pe('<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
@@ -65,18 +64,18 @@ python experiments/run.py`),n("p",null,[g("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",bW,[...t[21]||(t[21]=[Ae('<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,gW)])],8,pW)),[[ee,e.feature===i?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Ae('<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)),Fe(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var wW={class:"paper-empty"},kW={class:"paper-empty-inner"},CW={key:0,class:"paper-eyebrow"},SW={key:1,class:"paper-eyebrow"},EW={key:2,class:"paper-empty-title"},NW=["textContent"];function zf(e,t){return a(),l("div",wW,[n("div",kW,[e.error?f("v-if",!0):(a(),l("div",CW,"Working")),e.error?(a(),l("div",SW,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",EW,[...t[0]||(t[0]=[g(" Loading",-1),n("span",{class:"dot-anim"},"\u2026",-1)])])),e.error?(a(),l("h1",{key:3,class:"paper-empty-title",textContent:c(e.fmt.translate(e.error))},null,8,NW)):f("v-if",!0)])])}var RW={class:"container paper-page paper-settings"},TW={class:"paper-crumbs"},PW={class:"here"},AW={class:"paper-page-title"},DW={class:"paper-settings-body"},IW={class:"paper-settings-toc"},OW={href:"#conf-billing"},MW={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},VW={id:"conf-basics",class:"paper-settings-section"},LW={class:"form-group"},qW={class:"invalid-feedback"},$W={class:"invalid-feedback"},FW={class:"form-group"},UW={class:"invalid-feedback"},BW={class:"form-group"},_W={class:"invalid-feedback"},zW={class:"invalid-feedback"},HW={id:"conf-window",class:"paper-settings-section"},jW={class:"form-grid-2"},GW={class:"form-group"},WW={class:"invalid-feedback"},KW={class:"invalid-feedback"},YW={class:"form-group"},XW={class:"invalid-feedback"},JW={class:"invalid-feedback"},QW={id:"conf-rendering",class:"paper-settings-section"},ZW={class:"form-check"},xW={class:"form-check-input",type:"checkbox",id:"link",name:"link"},eK={class:"form-check"},tK={class:"form-check-input",type:"checkbox",id:"image",name:"image"},nK={class:"form-check"},sK={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},oK={class:"form-check"},iK={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},rK={id:"conf-features",class:"paper-settings-section"},aK={class:"form-check"},lK={class:"form-check-input",type:"checkbox",id:"update",name:"update"},dK={class:"form-check"},uK={class:"form-check-input",type:"checkbox",id:"page",name:"page"},cK={id:"conf-plan",class:"paper-settings-section"},pK={key:0,class:"paper-section-copy"},fK={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"}Line truncated
`).length))+" lines",1)):f("v-if",!0)]),A(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",rY,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,aY)]))],8,iY),[[ee,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",lY,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,dY),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),g(c(e.languageName||"Text"),1),n("span",uY,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),g(c(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)),g(c(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",cY,[e.redactionCount()?(a(),l(R,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,pY),t[54]||(t[54]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),t[56]||(t[56]=g("Markdown",-1)),e.fileSize(e.filePath)!=null?(a(),l(R,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),g(c(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",fY,[e.isCsv()?(a(),l("div",mY,[n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,hY),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="chart"}]),"aria-checked":e.csvView==="chart",onClick:t[5]||(t[5]=d=>e.csvView="chart"),title:"Chart the table"},"Chart",10,gY),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[6]||(t[6]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,vY)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",yY,[n("button",{type:"button",class:T(["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[7]||(t[7]=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,bY),e.symbolsOpen?(a(),l("div",wY,[n("div",kY,c(e.symbols().length)+" "+c(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(R,null,_(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:h=>e.goToSymbol(d.line)},[n("span",{class:T(["symbols-kind","is-"+d.kind])},c(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",SY,c(d.name),1),n("span",EY,c(d.line),1)],8,CY))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:T(["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[8]||(t[8]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,NY)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?(a(),l("div",RY,[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[9]||(t[9]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,TY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:T(["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[10]||(t[10]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,PY)):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[11]||(t[11]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,AY)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",DY,[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,IY),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[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",MY,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,VY)]))],8,OY)):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,LY)])):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 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",XY)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[18]||(t[18]=d=>e.toggleMdFind())},[...t[67]||(t[67]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type=="html"?(a(),l("div",JY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[19]||(t[19]=d=>e.findInFile())},[...t[68]||(t[68]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1),g("Find in file",-1)])])):f("v-if",!0),e.type!="html"?(a(),l("button",{key:6,type:"button",role:"menuitem",onClick:t[20]||(t[20]=d=>e.gotoLine())},[...t[69]||(t[69]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1),g("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[21]||(t[21]=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]=g("Wrap lines",-1)),e.wrapLines?(a(),l("span",ZY,"\u2713")):f("v-if",!0)],8,QY)):f("v-if",!0),e.isCsv()?(a(),l(R,{key:8},_(["table","chart","raw"],d=>n("button",{type:"button",role:"menuitemradio",class:"tb-csv-view",key:d,"aria-checked":e.csvView===d?"true":"false",onClick:h=>{e.csvView=d,e.moreOpen=!1}},[(a(),l("svg",eX,[n("use",{href:d==="raw"?"#ui-icon-code":d==="chart"?"#ui-icon-chart":"#ui-icon-list"},null,8,tX)])),g(c(d==="raw"?"Show as text":d==="chart"?"Show as chart":"Show as table"),1),e.csvView===d?(a(),l("span",nX,"\u2713")):f("v-if",!0)],8,xY)),64)):f("v-if",!0),e.type!="html"?(a(),l("div",sX)):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),g("View raw",-1)])],8,oX)):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),g("View raw",-1)])],8,iX)):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),g("Download file",-1)])],8,rX)):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),g("Open website",-1)])],8,aX)):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),g("Edit anonymization",-1)])],8,lX)):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),g("Download ZIP",-1)])],8,dX)):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),g("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"})]),g("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"})]),g("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]=de(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),A(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]=Pt(de(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,uX),[[ct,e.gotoValue]]),n("span",{class:T(["goto-hint",{"is-error":e.gotoError}])},c(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView!=="raw"?(a(),Tt(s,{key:e.paths?.join("/"),rows:e.csvRows(),name:e.paths?.[e.paths.length-1],"state-key":e.preview?null:"table",view:e.csvView},null,8,["rows","name","state-key","view"])):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?A((a(),l("div",cX,null,512)),[[u,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",pX,[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]=Pt(de(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Pt(de(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,fX),n("span",mX,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[83]||(t[83]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,hX),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=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-right"})],-1)])],8,gX)]),n("span",vX,c(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:T(["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,yX),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",bX,[A(n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,wX),[[p]]),e.tocCount()>=3?(a(),l("aside",kX,[t[85]||(t[85]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",CX,[n("a",{href:"#",class:T(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=de(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(R,{key:0},_(e.tocTitle().parts,(d,h)=>(a(),l(R,{key:h},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,c(d.n),1)],8,SX)):(a(),l(R,{key:1},[g(c(d.t),1)],64))],64))),128)):(a(),l(R,{key:1},[g("Introduction")],64))],2),(a(!0),l(R,null,_(e.readmeToc(),(d,h)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:T(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:de(m=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(R,null,_(d.parts,(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,NX)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],10,EX))),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(i,{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:T(["file-card file-card-media","view-"+e.type])},[n("header",RX,[n("div",TX,[n("button",{type:"button",class:T(["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[86]||(t[86]=[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",PX,[n("li",AX,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:c(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,DX)]),(a(!0),l(R,null,_(e.paths,(d,h)=>(a(),l("li",{class:"breadcrumb-item","aria-current":h===e.paths.length-1?"page":null},[(a(!0),l(R,null,_(e.redactParts(d),(m,y)=>(a(),l(R,{key:y},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,OX)):(a(),l(R,{key:1},[g(c(m.t),1)],64))],64))),128))],8,IX))),256))]),n("span",MX,[e.type=="IPython"&&e.redactionCount()?(a(),l("b",{key:0,class:"ms-item ms-redact",title:e.redactionCount()+" redacted terms"},[g(c(e.redactionCount()),1),t[87]||(t[87]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,VX)):f("v-if",!0),n("span",LX,c(e.fileKind()),1),e.imageSize?(a(),l("span",qX,c(e.imageSize),1)):f("v-if",!0),e.fileSi 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",tW,[...t[21]||(t[21]=[Pe('<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,ZG)])],8,YG)),[[te,e.feature===i?.key]])),128))])]),f(" FAQ teaser "),t[24]||(t[24]=Pe('<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)),$e(s,{name:"partials/footer.htm",state:e.viewState},null,8,["state"])])}var nW={class:"paper-empty"},sW={class:"paper-empty-inner"},oW={key:0,class:"paper-eyebrow"},iW={key:1,class:"paper-eyebrow"},rW={key:2,class:"paper-empty-title"},aW=["textContent"];function Zf(e,t){return a(),l("div",nW,[n("div",sW,[e.error?f("v-if",!0):(a(),l("div",oW,"Working")),e.error?(a(),l("div",iW,"Error")):f("v-if",!0),e.error?f("v-if",!0):(a(),l("h1",rW,[...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:c(e.fmt.translate(e.error))},null,8,aW)):f("v-if",!0)])])}var lW={class:"container paper-page paper-settings"},dW={class:"paper-crumbs"},uW={class:"here"},cW={class:"paper-page-title"},pW={class:"paper-settings-body"},fW={class:"paper-settings-toc"},mW={href:"#conf-billing"},hW={class:"form needs-validation paper-settings-main",name:"conference",novalidate:""},gW={id:"conf-basics",class:"paper-settings-section"},yW={class:"form-group"},vW={class:"invalid-feedback"},bW={class:"invalid-feedback"},wW={class:"form-group"},kW={class:"invalid-feedback"},CW={class:"form-group"},EW={class:"invalid-feedback"},SW={class:"invalid-feedback"},NW={id:"conf-window",class:"paper-settings-section"},RW={class:"form-grid-2"},TW={class:"form-group"},PW={class:"invalid-feedback"},DW={class:"invalid-feedback"},AW={class:"form-group"},IW={class:"invalid-feedback"},OW={class:"invalid-feedback"},MW={id:"conf-rendering",class:"paper-settings-section"},VW={class:"form-check"},qW={class:"form-check-input",type:"checkbox",id:"link",name:"link"},LW={class:"form-check"},$W={class:"form-check-input",type:"checkbox",id:"image",name:"image"},FW={class:"form-check"},UW={class:"form-check-input",type:"checkbox",id:"pdf",name:"pdf"},BW={class:"form-check"},HW={class:"form-check-input",type:"checkbox",id:"notebook",name:"notebook"},zW={id:"conf-features",class:"paper-settings-section"},jW={class:"form-check"},_W={class:"form-check-input",type:"checkbox",id:"update",name:"update"},GW={class:"form-check"},WW={class:"form-check-input",type:"checkbox",id:"page",name:"page"},KW={id:"conf-plan",class:"paper-settings-section"},YW={key:0,class:"paper-section-copy"},XW={class:"conference-tiers",role:"radiogroup","aria-label":"Review package size"}Line truncated
`).length))+" lines",1)):f("v-if",!0)]),O(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",zK,[n("use",{href:e.pathCopied?"#ui-icon-check":"#ui-icon-link"},null,8,jK)]))],8,HK),[[te,e.filePath]])]),e.type!="html"&&typeof e.content=="string"?(a(),l("span",_K,[e.redactionCount()?(a(),l(N,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(c(e.redactionCount()),1),t[49]||(t[49]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,GK),t[50]||(t[50]=n("span",{class:"sep"},"\xB7",-1))],64)):f("v-if",!0),h(c(e.languageName||"Text"),1),n("span",WK,[t[51]||(t[51]=n("span",{class:"sep"},"\xB7",-1)),h(c(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(c(e.fmt?.number(e.content.split(`
`).length))+" lines",1)])):f("v-if",!0),e.type=="html"?(a(),l("span",KK,[e.redactionCount()?(a(),l(N,{key:0},[n("span",{class:"meta-redact",title:e.redactionCount()+" redacted terms"},[h(c(e.redactionCount()),1),t[53]||(t[53]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,YK),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(N,{key:1},[t[55]||(t[55]=n("span",{class:"sep"},"\xB7",-1)),h(c(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",XK,[e.isCsv()?(a(),l("div",QK,[n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="table"}]),"aria-checked":e.csvView==="table",onClick:t[4]||(t[4]=d=>e.csvView="table")},"Table",10,JK),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="chart"}]),"aria-checked":e.csvView==="chart",onClick:t[5]||(t[5]=d=>e.csvView="chart"),title:"Chart the table"},"Chart",10,ZK),n("button",{type:"button",role:"radio",class:T(["seg-chip",{active:e.csvView==="raw"}]),"aria-checked":e.csvView==="raw",onClick:t[6]||(t[6]=d=>e.csvView="raw"),title:"Show the file as text with line numbers"},"Text",10,xK)])):f("v-if",!0),e.type!="html"&&e.symbols().length>1?(a(),l("div",eY,[n("button",{type:"button",class:T(["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[7]||(t[7]=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,tY),e.symbolsOpen?(a(),l("div",nY,[n("div",sY,c(e.symbols().length)+" "+c(e.symbols().length===1?"symbol":"symbols"),1),(a(!0),l(N,null,U(e.symbols(),d=>(a(),l("button",{type:"button",class:"symbols-item",role:"menuitem",key:d.line+d.name,onClick:g=>e.goToSymbol(d.line)},[n("span",{class:T(["symbols-kind","is-"+d.kind])},c(d.kind==="class"?"C":d.kind==="function"?"\u0192":"v"),3),n("span",iY,c(d.name),1),n("span",rY,c(d.line),1)],8,oY))),128))])):f("v-if",!0)])):f("v-if",!0),e.type=="html"?(a(),l("button",{key:2,type:"button",class:T(["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[8]||(t[8]=d=>e.toggleMdFind())},[...t[58]||(t[58]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],10,aY)):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?(a(),l("div",lY,[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[9]||(t[9]=d=>e.gotoLine())},[...t[59]||(t[59]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-goto"})],-1)])],8,dY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:1,type:"button",class:T(["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[10]||(t[10]=d=>e.toggleWrap())},[...t[60]||(t[60]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-wrap"})],-1)])],10,uY)):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[11]||(t[11]=d=>e.findInFile())},[...t[61]||(t[61]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-search"})],-1)])],8,cY)):f("v-if",!0)])):f("v-if",!0),!e.preview||e.url?(a(),l("div",pY,[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,fY),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[12]||(t[12]=d=>e.copyContent())},[(a(),l("svg",hY,[n("use",{href:e.contentCopied?"#ui-icon-check":"#project-icon-copy"},null,8,gY)]))],8,mY)):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,yY)])):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 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",IY)):f("v-if",!0),e.type=="html"?(a(),l("button",{key:3,type:"button",role:"menuitem",onClick:t[18]||(t[18]=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",OY)):f("v-if",!0),e.type!="html"?(a(),l("button",{key:5,type:"button",role:"menuitem",onClick:t[19]||(t[19]=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[20]||(t[20]=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[21]||(t[21]=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",VY,"\u2713")):f("v-if",!0)],8,MY)):f("v-if",!0),e.isCsv()?(a(),l(N,{key:8},U(["table","chart","raw"],d=>n("button",{type:"button",role:"menuitemradio",class:"tb-csv-view",key:d,"aria-checked":e.csvView===d?"true":"false",onClick:g=>{e.csvView=d,e.moreOpen=!1}},[(a(),l("svg",LY,[n("use",{href:d==="raw"?"#ui-icon-code":d==="chart"?"#ui-icon-chart":"#ui-icon-list"},null,8,$Y)])),h(c(d==="raw"?"Show as text":d==="chart"?"Show as chart":"Show as table"),1),e.csvView===d?(a(),l("span",FY,"\u2713")):f("v-if",!0)],8,qY)),64)):f("v-if",!0),e.type!="html"?(a(),l("div",UY)):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,BY)):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,HY)):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,zY)):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,jY)):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,_Y)):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,GY)):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]=de(d=>e.submitGoto(),["prevent"]))},[t[82]||(t[82]=n("label",{class:"goto-label",for:"goto-input"},"Go to line",-1)),O(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]=Tt(de(d=>e.closeGoto(),["prevent","stop"]),["esc"]))},null,40,WY),[[ft,e.gotoValue]]),n("span",{class:T(["goto-hint",{"is-error":e.gotoError}])},c(e.gotoError||"Line, or line:column"),3)],32)):f("v-if",!0)]),e.isCsv()&&e.csvView!=="raw"?(a(),Rt(s,{key:e.paths?.join("/"),rows:e.csvRows(),name:e.paths?.[e.paths.length-1],"state-key":e.preview?null:"table",view:e.csvView},null,8,["rows","name","state-key","view"])):f("v-if",!0),e.type!="html"&&!(e.isCsv()&&e.csvView!=="raw")?O((a(),l("div",KY,null,512)),[[u,{content:e.content,options:e.aceOption}]]):f("v-if",!0),e.type=="html"&&e.mdFindOpen?(a(),l("div",YY,[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]=Tt(de(d=>d.shiftKey?e.stepMdFind(-1):e.stepMdFind(1),["prevent"]),["enter"])),t[29]||(t[29]=Tt(de(d=>e.toggleMdFind(!1),["prevent"]),["esc"]))]},null,40,XY),n("span",QY,[n("button",{type:"button","aria-label":"Previous match",onClick:t[30]||(t[30]=d=>e.stepMdFind(-1)),disabled:!e.mdFindTotal},[...t[83]||(t[83]=[n("svg",{class:"ui-icon","aria-hidden":"true"},[n("use",{href:"#ui-icon-chevron-left"})],-1)])],8,JY),n("button",{type:"button","aria-label":"Next match",onClick:t[31]||(t[31]=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-right"})],-1)])],8,ZY)]),n("span",xY,c(e.mdFindQuery?e.mdFindTotal?e.mdFindIndex+1+" of "+e.mdFindTotal:"No results":""),1),n("button",{type:"button",class:T(["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,eX),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",tX,[O(n("div",{class:"file-content markdown-body",innerHTML:e.renderReadme(e.sanitize(e.content))},null,8,nX),[[p]]),e.tocCount()>=3?(a(),l("aside",sX,[t[85]||(t[85]=n("div",{class:"readme-toc-head"},"On this page",-1)),n("nav",oX,[n("a",{href:"#",class:T(["lvl-2 toc-top",{"is-active":!e.activeHeading||e.activeHeading===e.tocTitle()?.id}]),onClick:t[34]||(t[34]=de(d=>e.scrollToHeading(null),["prevent"]))},[e.tocTitle()?(a(!0),l(N,{key:0},U(e.tocTitle().parts,(d,g)=>(a(),l(N,{key:g},[d.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+d.n},[n("i",null,c(d.n),1)],8,iX)):(a(),l(N,{key:1},[h(c(d.t),1)],64))],64))),128)):(a(),l(N,{key:1},[h("Introduction")],64))],2),(a(!0),l(N,null,U(e.readmeToc(),(d,g)=>(a(),l("a",{key:d.id,href:"#"+d.id,class:T(["lvl-"+(d.depth+2),{"is-active":e.activeHeading===d.id}]),"aria-current":e.activeHeading===d.id?"location":null,onClick:de(m=>e.scrollToHeading(d.id),["prevent"])},[(a(!0),l(N,null,U(d.parts,(m,v)=>(a(),l(N,{key:v},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,aX)):(a(),l(N,{key:1},[h(c(m.t),1)],64))],64))),128))],10,rX))),128))])])):f("v-if",!0)])):f("v-if",!0)],2)):f("v-if",!0),e.type=="html-doc"&&!e.showSource&&e.content!=null?(a(),Rt(i,{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:T(["file-card file-card-media","view-"+e.type])},[n("header",lX,[n("div",dX,[n("button",{type:"button",class:T(["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[86]||(t[86]=[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",uX,[n("li",cX,[n("a",{href:e.safeUrl("/r/"+e.repoId+"/"),title:e.repoId,textContent:c(/^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e.repoId||"")?"repository":e.repoId)},null,8,pX)]),(a(!0),l(N,null,U(e.paths,(d,g)=>(a(),l("li",{class:"breadcrumb-item","aria-current":g===e.paths.length-1?"page":null},[(a(!0),l(N,null,U(e.redactParts(d),(m,v)=>(a(),l(N,{key:v},[m.n?(a(),l("span",{key:0,class:"redact-slot",role:"img","aria-label":"Redacted term "+m.n},[n("i",null,c(m.n),1)],8,mX)):(a(),l(N,{key:1},[h(c(m.t),1)],64))],64))),128))],8,fX))),256))]),n("span",hX,[e.type=="IPython"&&e.redactionCount()?(a(),l("b",{key:0,class:"ms-item ms-redact",title:e.redactionCount()+" redacted terms"},[h(c(e.redactionCount()),1),t[87]||(t[87]=n("span",{class:"meta-redact-word"}," redacted",-1))],8,gX)):f("v-if",!0),n("span",yX,c(e.fileKind()),1),e.imageSize?(a(),l("span",vX,c(e.imageSize),1)):f("v-if",!0),e.fileSi Line truncated
`).length+1)),placeholder:`Jane Smith
MIT CSAIL
jane.smith@example.org`},null,8,HQ),[[i,{state:e.viewState,set:r=>{e.terms=r},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",jQ,[t[25]||(t[25]=n("summary",null,"Regex & replacement syntax",-1)),n("p",null,[t[21]||(t[21]=g("Matches become ",-1)),n("code",null,c(e.site_options?.ANONYMIZATION_MASK||"XXX")+"-[N]",1),t[22]||(t[22]=g(". Use ",-1)),t[23]||(t[23]=n("code",null,"term=>replacement",-1)),t[24]||(t[24]=g(" for a custom replacement. Regex is supported.",-1))])]),A(n("div",GQ,"Terms are in an invalid format.",512),[[ee,e.defaultsForm?.terms?.errors?.format]])])]),n("section",WQ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",KQ,[n("label",YQ,[A(n("input",XQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.link=r},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=g("Keep links",-1))]),n("label",JQ,[A(n("input",QQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.image=r},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=g("Display images",-1))]),n("label",ZQ,[A(n("input",xQ,null,512),[[i,{state:e.viewState,set:r=>{e.options.pdf=r},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=g("Display PDFs",-1))]),n("label",eZ,[A(n("input",tZ,null,512),[[i,{state:e.viewState,set:r=>{e.options.notebook=r},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=g("Display notebooks",-1))]),n("label",nZ,[A(n("input",sZ,null,512),[[i,{state:e.viewState,set:r=>{e.options.loc=r},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=g("Show line counts",-1))]),n("label",oZ,[A(n("input",iZ,null,512),[[i,{state:e.viewState,set:r=>{e.options.page=r},value:e.options?.page,form:"defaultsForm",options:{}}]]),t[32]||(t[32]=g("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",rZ,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",aZ,[A(n("input",lZ,null,512),[[i,{state:e.viewState,set:r=>{e.options.update=r},value:e.options?.update,form:"defaultsForm",options:{}}]]),t[36]||(t[36]=g("Auto-update from GitHub",-1))]),t[37]||(t[37]=n("p",{class:"settings-help"},"Latest commit, at most once an hour.",-1))])]),n("section",dZ,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[A((a(),l("select",uZ,[...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",cZ,c(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",pZ,[n("div",fZ,[e.draftRestored?(a(),l("span",mZ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",hZ,"Unsaved changes"+c(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",gZ,c(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")):f("v-if",!0),n("button",{id:"save",type:"submit",class:T(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},c(e.saving?"Saving\u2026":"Save defaults"),11,vZ),e.error?(a(),l("div",yZ,c(e.error),1)):f("v-if",!0)])],32)),[[o,e.viewState]])],512),[[ee,e.settingsTab==="defaults"]]),A(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",wZ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",kZ,[g(c(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,CZ)])):f("v-if",!0),e.billingNotice?(a(),l("p",SZ,c(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",EZ,[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,NZ)])):f("v-if",!0),n("section",RZ,[n("div",TZ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",PZ,c(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",AZ,[g(c(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access 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(`
`)}),ym=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},Cm=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",ym(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,p=>(p.startsWith("</")?i.pop():i.push(p),p));let u=o.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${ym(u)}ch">${r}${o||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},yle=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",td={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>{let i=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?to(i):i,km(t.value),Cm(t.value),e.idPrefix!=null){let o={};t.value.querySelectorAll("h1, h2, h3").forEach(r=>{let u=e.idPrefix+(r.id||yle(r.textContent));o[u]?u+="-"+ ++o[u]:o[u]=1,r.id=u})}Ci(t.value),e.onOutline?.(Sr(t.value))};return Jt(()=>{s(),dt(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>be("markdown",{ref:t,class:e.reader?"markdown-body":null})}},bm=e=>Qt(e).map(t=>t.n?be("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},be("i",t.n)):t.t),ed=e=>/^XXXX-\d+$/.test(String(e||"").trim()),ble=(e,t="Reviewer")=>e?be("span",{class:["pr-author",{"is-redacted":ed(e)}],title:ed(e)?"Redacted author":null},ed(e)?bm(e):["@",...bm(e)]):be("span",{class:"pr-author is-hidden"},t),Sm={props:["comments","fmt"],setup(e){return()=>be("div",{class:"pr-thread"},(e.comments||[]).map((t,s)=>be("article",{class:["pr-thread-comment",{"is-reply":s>0}],key:s},[be("header",{class:"pr-thread-head"},[be("span",{class:"pr-avatar","aria-hidden":"true"},be("svg",{class:"ui-icon"},be("use",{href:"#ui-icon-user"}))),ble(t.author),t.creationDate||t.updatedDate?be("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?be("div",{class:"pr-thread-body"},be(td,{content:t.body,reader:!0})):null])))}},wle=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),kle=new Set(["add","remove","ctx","hunk"]),Cle=e=>{let t=kle.has(e.kind)?e.kind:"ctx",s=Qt(e.text).map(i=>i.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(i.n)}"><i>${Number(i.n)}</i></span>`:wle(i.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: ${Zs(e.text)}ch">${s}</td></tr>`},Sle={props:["file","fmt"],setup(e){return()=>{let t=[],s="",i=()=>{s&&t.push(be("tbody",{key:"r"+t.length,innerHTML:s})),s=""};return(e.file?.lines||[]).forEach(o=>{s+=Cle(o),o.threads?.length&&(i(),t.push(be("tbody",{key:"t"+t.length},o.threads.map((r,u)=>be("tr",{class:"diff-thread-row",key:u},[be("td",{class:"diff-thread-gutter",colspan:3}),be("td",{class:"diff-thread-cell"},be(Sm,{comments:r.comments,fmt:e.fmt}))])))))}),i(),be("table",{class:"diff-file-table"},t)}}},Ele={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>Ke(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),km(t.value),Cm(t.value)});return Jt(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 be("gist-file",{ref:t},be(td,{content:i.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));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 be("gist-file",{ref:t},be("pre",{class:"line-numbers"},be("code",{class:"language-"+(r[u]||u),key:i.content},i.content||"")))}}},Nle=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()}),Rle={props:["file","content"],setup(e){let t=bt(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(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await ds("notebook"),r!==s)return;t.value.innerHTML=to(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),Nle(t.value),Ci(t.value)}catch(u){r===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return Jt(()=>{o(),dt(()=>[e.file,e.content],o)}),Un(()=>{s++,i?.abort()}),()=>be(Line truncated
jane.smith@example.org`},null,8,NJ),[[i,{state:e.viewState,set:o=>{e.terms=o},value:e.terms,form:"defaultsForm",options:{debounce:250}}]]),n("details",RJ,[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,c(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))])]),O(n("div",TJ,"Terms are in an invalid format.",512),[[te,e.defaultsForm?.terms?.errors?.format]])])]),n("section",PJ,[t[35]||(t[35]=n("h2",null,"Reviewer display",-1)),n("div",null,[n("div",DJ,[n("label",AJ,[O(n("input",IJ,null,512),[[i,{state:e.viewState,set:o=>{e.options.link=o},value:e.options?.link,form:"defaultsForm",options:{}}]]),t[27]||(t[27]=h("Keep links",-1))]),n("label",OJ,[O(n("input",MJ,null,512),[[i,{state:e.viewState,set:o=>{e.options.image=o},value:e.options?.image,form:"defaultsForm",options:{}}]]),t[28]||(t[28]=h("Display images",-1))]),n("label",VJ,[O(n("input",qJ,null,512),[[i,{state:e.viewState,set:o=>{e.options.pdf=o},value:e.options?.pdf,form:"defaultsForm",options:{}}]]),t[29]||(t[29]=h("Display PDFs",-1))]),n("label",LJ,[O(n("input",$J,null,512),[[i,{state:e.viewState,set:o=>{e.options.notebook=o},value:e.options?.notebook,form:"defaultsForm",options:{}}]]),t[30]||(t[30]=h("Display notebooks",-1))]),n("label",FJ,[O(n("input",UJ,null,512),[[i,{state:e.viewState,set:o=>{e.options.loc=o},value:e.options?.loc,form:"defaultsForm",options:{}}]]),t[31]||(t[31]=h("Show line counts",-1))]),n("label",BJ,[O(n("input",HJ,null,512),[[i,{state:e.viewState,set:o=>{e.options.page=o},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",zJ,[t[38]||(t[38]=n("h2",null,"Source updates",-1)),n("div",null,[n("label",jJ,[O(n("input",_J,null,512),[[i,{state:e.viewState,set:o=>{e.options.update=o},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",GJ,[t[40]||(t[40]=n("label",{class:"settings-label",for:"expiration"},"On expiration",-1)),n("div",null,[O((a(),l("select",WJ,[...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:o=>{e.options.expirationMode=o},value:e.options?.expirationMode,form:"defaultsForm",options:{}}]]),n("p",KJ,c(e.options.expirationMode==="redirect"?"Redirecting reveals the original repository. Choose the date per anonymization.":"Set the expiration date for each repository."),1)])]),n("footer",YJ,[n("div",XJ,[e.draftRestored?(a(),l("span",QJ,"Your unsaved draft was restored.")):e.unsavedChanges?(a(),l("span",JJ,"Unsaved changes"+c(e.draftSaved?" \xB7 Draft saved in this tab":""),1)):(a(),l("span",ZJ,c(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]=o=>e.discardDraft())},"Discard changes")):f("v-if",!0),n("button",{id:"save",type:"submit",class:T(["btn btn-ink",{"is-saving":e.saving}]),disabled:e.saving||!(e.unsavedChanges||e.draftRestored)},c(e.saving?"Saving\u2026":"Save defaults"),11,xJ),e.error?(a(),l("div",eZ,c(e.error),1)):f("v-if",!0)])],32)),[[r,e.viewState]])],512),[[te,e.settingsTab==="defaults"]]),O(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",nZ,"Loading billing\u2026")):f("v-if",!0),e.billingError?(a(),l("div",sZ,[h(c(e.billingError)+" ",1),n("button",{type:"button",class:"btn btn-outline-ink",onClick:t[3]||(t[3]=o=>e.loadBilling()),disabled:e.billingBusy},"Try again",8,oZ)])):f("v-if",!0),e.billingNotice?(a(),l("p",iZ,c(e.billingNotice),1)):f("v-if",!0),e.billingPending?(a(),l("div",rZ,[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]=o=>e.refreshBilling()),disabled:e.billingBusy},"Check payment status",8,aZ)])):f("v-if",!0),n("section",lZ,[n("div",dZ,[n("div",null,[t[44]||(t[44]=n("p",{class:"billing-eyebrow"},"Current plan",-1)),n("h2",uZ,c(e.profileAuthorGrant()?e.profileGrantName(e.profileAuthorGrant()):e.billing?.enabled?"Free":"Account allowance"),1),e.profileAuthorGrant()?(a(),l("p",cZ,[h(c(e.profileAuthorGrant().cancelAtPeriodEnd?"Renewal cancelled \xB7 access Line truncated
`);t.innerHTML=s.map(i=>{let r=i.replace(/^(<[^>]+>)+/,"").charAt(0),o=i.startsWith("@@")?"hunk":r==="+"?"add":r==="-"?"remove":"";return`<span class="md-diff-line${o?" is-"+o:""}">${i||" "}</span>`}).join(`
`)}),Pm=(e,t=0)=>{let s=(String(e).slice(t).match(/^[ \t]*/)[0]||"").replace(/\t/g," ").length;return Math.min(t+s+4,24)},Om=e=>{e?.closest?.(".reviewer-preview")&&e.querySelectorAll("pre code").forEach(t=>{let s=t.querySelectorAll(".md-diff-line");if(s.length){s.forEach(r=>{r.classList.contains("is-hunk")||r.style.setProperty("--hang",Pm(r.textContent,1)+"ch")});return}if(t.querySelector(".code-line"))return;let i=[];t.innerHTML=t.innerHTML.replace(/\n$/,"").split(`
`).map(r=>{let o=i.join("");r.replace(/<\/?span\b[^>]*>/g,p=>(p.startsWith("</")?i.pop():i.push(p),p));let u=r.replace(/<[^>]+>/g,"");return`<span class="code-line" style="--hang:${Pm(u)}ch">${o}${r||" "}${"</span>".repeat(i.length)}</span>`}).join(`
`)})},ele=e=>e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").slice(0,60)||"section",rd={props:["content","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>{let i=renderMD(e.content||"",window.location.pathname+"/../");if(t.value.innerHTML=e.reader?to(i):i,Im(t.value),Om(t.value),e.idPrefix!=null){let r={};t.value.querySelectorAll("h1, h2, h3").forEach(o=>{let u=e.idPrefix+(o.id||ele(o.textContent));r[u]?u+="-"+ ++r[u]:r[u]=1,o.id=u})}Ci(t.value),e.onOutline?.(Er(t.value))};return Qt(()=>{s(),dt(()=>[e.content,e.terms,e.options],s,{deep:!0})}),()=>ke("markdown",{ref:t,class:e.reader?"markdown-body":null})}},Dm=e=>Jt(e).map(t=>t.n?ke("span",{class:"redact-slot",role:"img","aria-label":"Redacted term "+t.n},ke("i",t.n)):t.t),id=e=>/^XXXX-\d+$/.test(String(e||"").trim()),tle=(e,t="Reviewer")=>e?ke("span",{class:["pr-author",{"is-redacted":id(e)}],title:id(e)?"Redacted author":null},id(e)?Dm(e):["@",...Dm(e)]):ke("span",{class:"pr-author is-hidden"},t),Mm={props:["comments","fmt"],setup(e){return()=>ke("div",{class:"pr-thread"},(e.comments||[]).map((t,s)=>ke("article",{class:["pr-thread-comment",{"is-reply":s>0}],key:s},[ke("header",{class:"pr-thread-head"},[ke("span",{class:"pr-avatar","aria-hidden":"true"},ke("svg",{class:"ui-icon"},ke("use",{href:"#ui-icon-user"}))),tle(t.author),t.creationDate||t.updatedDate?ke("time",{class:"pr-thread-date",datetime:t.creationDate||t.updatedDate},e.fmt?.date(t.creationDate||t.updatedDate)):null]),t.body?ke("div",{class:"pr-thread-body"},ke(rd,{content:t.body,reader:!0})):null])))}},nle=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),sle=new Set(["add","remove","ctx","hunk"]),ole=e=>{let t=sle.has(e.kind)?e.kind:"ctx",s=Jt(e.text).map(i=>i.n?`<span class="redact-slot" role="img" aria-label="Redacted term ${Number(i.n)}"><i>${Number(i.n)}</i></span>`:nle(i.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: ${Zs(e.text)}ch">${s}</td></tr>`},ile={props:["file","fmt"],setup(e){return()=>{let t=[],s="",i=()=>{s&&t.push(ke("tbody",{key:"r"+t.length,innerHTML:s})),s=""};return(e.file?.lines||[]).forEach(r=>{s+=ole(r),r.threads?.length&&(i(),t.push(ke("tbody",{key:"t"+t.length},r.threads.map((o,u)=>ke("tr",{class:"diff-thread-row",key:u},[ke("td",{class:"diff-thread-gutter",colspan:3}),ke("td",{class:"diff-thread-cell"},ke(Mm,{comments:o.comments,fmt:e.fmt}))])))))}),i(),ke("table",{class:"diff-file-table"},t)}}},rle={props:["file","terms","options","reader","idPrefix","onOutline"],setup(e){let t=bt(null),s=()=>xe(()=>{t.value?.querySelectorAll("pre code").forEach(i=>window.Prism?.highlightElement(i)),Im(t.value),Om(t.value)});return Qt(s),dt(()=>[e.file?.content,e.terms,e.options],s,{deep:!0}),()=>{let i=e.file||{},r=(i.filename||"").split(".").pop().toLowerCase();if(["md","markdown"].includes(r)||i.language==="Markdown")return ke("gist-file",{ref:t},ke(rd,{content:i.content,terms:e.terms,options:e.options,reader:e.reader,idPrefix:e.idPrefix,onOutline:e.onOutline}));let o={js:"javascript",jsx:"javascript",ts:"javascript",typescript:"javascript",py:"python",html:"markup",xml:"markup",svg:"markup",sh:"bash"},u=(i.language||r||"none").toLowerCase();return ke("gist-file",{ref:t},ke("pre",{class:"line-numbers"},ke("code",{class:"language-"+(o[u]||u),key:i.content},i.content||"")))}}},ale=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 r=t.scrollWidth-t.clientWidth>1;if(s.classList.toggle("is-overflowing",r),s.classList.toggle("is-at-end",r&&t.scrollLeft+t.clientWidth>=t.scrollWidth-2),!r)return;let o=t.clientWidth-16,u=Math.max(24,o*t.clientWidth/t.scrollWidth);s.style.setProperty("--thumb-w",u+"px"),s.style.setProperty("--thumb-x",(o-u)*t.scrollLeft/(t.scrollWidth-t.clientWidth)+"px")};t.addEventListener("scroll",i,{passive:!0}),window.ResizeObserver?new ResizeObserver(i).observe(t):i(),i()}),lle={props:["file","content"],setup(e){let t=bt(null),s=0,i,r=async()=>{let o=++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(p=>{if(!p.ok)throw Error("Notebook request failed");return p.json()});if(await ds("notebook"),o!==s)return;t.value.innerHTML=to(DOMPurify.sanitize(nb.parse(u).render())),t.value.querySelectorAll("pre code").forEach(p=>window.Prism?.highlightElement(p)),ale(t.value),Ci(t.value)}catch(u){o===s&&u.name!=="AbortError"&&(t.value.textContent="Unable to render the notebook.")}};return Qt(()=>{r(),dt(()=>[e.file,e.content],r)}),Un(()=>{s++,i?.abort()}),()=>ke(Line truncated
/*! Bundled license information:
@vue/shared/dist/shared.esm-bundler.js:
+25 -28
View File
@@ -1028,32 +1028,13 @@ const metricsPoints = (queue, range) => {
});
};
// ---- Errors (logger ring entries: { ts, level, module, message, raw })
const errorEntries = [
[0.02, "error", "streamer", "anonymous error", { name: "AnonymousError", message: "file_not_found", httpStatus: 500, detail: "dl-benchmark-2026", url: "/api/repo/dl-benchmark-2026/file/data/train/part-00031.parquet", cause: { name: "Error", message: "ENOENT: no such file or directory, open '/data/repos/dl-benchmark-2026/data/train/part-00031.parquet'", stack: "Error: ENOENT: no such file or directory, open '/data/repos/dl-benchmark-2026/data/train/part-00031.parquet'\n at async open (node:internal/fs/promises:639:25)\n at async FileSystem.read (/app/build/core/storage/FileSystem.js:58:22)\n at async AnonymizedFile.content (/app/build/core/AnonymizedFile.js:301:24)" } }],
[0.05, "warn", "github", "GitHub API rate limit low", { name: "HttpError", message: "API rate limit exceeded for installation ID 41234567.", status: 403, url: "https://api.github.com/repos/bob-lab/graph-mining/git/trees/c40da900ab12?recursive=1", method: "GET" }],
[0.1, "error", "download", "anonymous error", { name: "AnonymousError", message: "repository_too_big", httpStatus: 500, detail: JSON.stringify({ repoId: "dl-benchmark-2026", size: 12241827840, limit: 8589934592, fullName: "alice-research/dl-benchmark" }) }],
[0.3, "error", "streamer", "anonymous error", { name: "AnonymousError", message: "file_not_found", httpStatus: 500, detail: "dl-benchmark-2026", url: "/api/repo/dl-benchmark-2026/file/data/train/part-00032.parquet" }],
[0.4, "error", "api", "unhandled error", { name: "TypeError", message: "Cannot read properties of undefined (reading 'repositoryName')", stack: "TypeError: Cannot read properties of undefined (reading 'repositoryName')\n at Repository.toJSON (/app/build/core/Repository.js:1127:38)\n at JSON.stringify (<anonymous>)\n at ServerResponse.json (/app/node_modules/express/lib/response.js:263:14)\n at /app/build/server/routes/admin.js:912:17\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)" }],
[0.8, "warn", "api", "anonymous error", { name: "AnonymousError", message: "invalid_terms_format", httpStatus: 400, url: "/api/repo/new-paper/", method: "POST", detail: "Terms must be an array of non-empty strings; received a single string of 2,048 characters containing newlines, which usually means the terms were pasted into the wrong field." }],
[1.5, "error", "streamer", "anonymous error", { name: "AnonymousError", message: "file_not_found", httpStatus: 500, detail: "dl-benchmark-2026", url: "/api/repo/dl-benchmark-2026/file/README.md" }],
[2, "error", "queue", "job failed", { name: "AnonymousError", message: "branch_not_found", httpStatus: 404, detail: "b4751b8e-6139-4a94-84f8-646106435809" }],
[3.4, "warn", "mongo", "slow query", { name: "MongoServerSelectionError", message: "Server selection timed out after 30000 ms", code: "ETIMEDOUT" }],
[5, "error", "storage", "s3 put failed", { name: "S3ServiceException", message: "SlowDown: Please reduce your request rate.", status: 503, url: "https://s3.eu-west-1.amazonaws.com/anon-cache/repos/graph-mining-A91B/src/main.py" }],
[6, "warn", "github", "GitHub API rate limit low", { name: "HttpError", message: "API rate limit exceeded for installation ID 41234567.", status: 403, url: "https://api.github.com/repos/bob-lab/fuzz-harness", method: "GET" }],
[9, "error", "api", "anonymous error", { name: "AnonymousError", message: "repository_expired", httpStatus: 410, detail: "JarSift", url: "/api/repo/JarSift/files" }],
[14, "warn", "streamer", "client aborted", { name: "Error", message: "aborted", code: "ECONNRESET", url: "/api/repo/runtime-repair-experiments-very-long-identifier-for-the-icse-artifact-track-2ff4/zip" }],
[20, "error", "api", "unhandled error", { name: "RangeError", message: "Maximum call stack size exceeded", stack: "RangeError: Maximum call stack size exceeded\n at anonymizeContent (/app/build/core/anonymize-utils.js:88:18)\n at anonymizeContent (/app/build/core/anonymize-utils.js:102:16)\n at anonymizeContent (/app/build/core/anonymize-utils.js:102:16)\n at anonymizeContent (/app/build/core/anonymize-utils.js:102:16)" }],
[23, "warn", "conference", "billing webhook", { message: "Stripe webhook signature mismatch for event evt_1Q2w3E4r5T6y7U8i (conference ICSE26-AE)" }],
[23.5, "error", "streamer", "anonymous error", { name: "AnonymousError", message: "file_not_found", httpStatus: 500, detail: "graph-mining-A91B", url: "/api/repo/graph-mining-A91B/file/docs/very/deeply/nested/folder/structure/that/keeps/going/and/going/index.html" }],
].map(([hoursAgo, level, module, message, detail]) => ({
ts: new Date(Date.now() - hoursAgo * HOUR).toISOString(),
level,
module,
message,
raw: [message, detail],
}));
// ---- Errors: synthetic records grouped by the real buildIssues() (scripts/fixtures/error-issues.js).
// Cookie mock_errors=empty|offline|loading|history simulates the other states.
const errorFixtures = require("./fixtures/error-issues");
const errorFixture = errorFixtures.errorFixture({ repos: ["anonymous_github-C72C", "dl-benchmark-2026", "graph-mining-A91B", "smart-contract-audit"], users: [oid(1), oid(2)],
owners: { "anonymous_github-C72C": oid(1), "dl-benchmark-2026": oid(2), "graph-mining-A91B": oid(3), "smart-contract-audit": oid(2) } });
const errorEntries = errorFixtures.historyEntries(errorFixture);
const errorScenario = (req) => (/(?:^|;\s*)mock_errors=(\w+)/.exec(req.headers.cookie || "") || [])[1] || "";
const errorStats = (() => {
const hourNow = Math.floor(Date.now() / HOUR) * HOUR;
const buckets = Array.from({ length: 24 }, (_, i) => {
@@ -1119,6 +1100,7 @@ app.get("/api/admin/repos", (req, res) => {
rows = u ? rows.filter((r) => r.owner === u._id) : [];
}
if (req.query.conference) rows = rows.filter((r) => r.conference === req.query.conference);
if (req.query.search) rows = rows.filter((r) => [r.repoId, r.source.repositoryName, r.conference].some((v) => String(v || "").toLowerCase().includes(String(req.query.search).toLowerCase())));
res.json(page(req, rows, true));
});
app.get("/api/admin/repos/:repoId/github", (req, res) => {
@@ -1140,12 +1122,12 @@ app.get("/api/admin/users", (req, res) => {
res.json(page(req, rows, false));
});
app.get("/api/admin/users/:username/repos", (req, res) => {
const u = adminUsers.find((x) => x.username === req.params.username);
const u = adminUsers.find((x) => x.username === req.params.username || "id:" + x._id === req.params.username);
if (!u) return res.status(404).json({ error: "user_not_found" });
res.json(adminRepos.filter((r) => r.owner === u._id).map(repoView));
});
app.get("/api/admin/users/:username", (req, res) => {
const u = adminUsers.find((x) => x.username === req.params.username);
const u = adminUsers.find((x) => x.username === req.params.username || "id:" + x._id === req.params.username);
if (!u) return res.status(404).json({ error: "user_not_found" });
res.json(Object.assign({}, u, { repositories: githubRepos(u) }));
});
@@ -1285,6 +1267,21 @@ app.get("/api/admin/emails", (req, res) => {
res.json({ entries, nextCursor: rows.length > 50 ? `${last.createdAt}|${last._id}` : null });
} catch { res.status(400).json({ error: "Invalid email history filters." }); }
});
app.use("/api/admin/errors", async (req, res, next) => {
const scenario = errorScenario(req);
if (scenario === "loading") await new Promise((resolve) => global.setTimeout(resolve, 20000));
if (scenario === "offline") return res.status(503).json({ error: "Simulated outage" });
next();
});
app.get("/api/admin/errors/issues", (req, res) => {
const names = { repos: {}, users: {} };
for (const u of adminUsers) names.users[u._id] = u.username;
for (const r of adminRepos) names.repos[r.repoId] = { ownerId: r.owner, owner: names.users[r.owner], source: r.source.repositoryName, status: r.status };
res.json(errorFixtures.issuesResponse(errorFixture, req.query, { scenario: errorScenario(req), names }));
});
app.get("/api/admin/errors/correlation", (req, res) => res.json(errorFixtures.correlationResponse(errorFixture, req.query)));
app.get("/api/admin/errors/investigation", (req, res) => res.json({ state: "ready", window: req.query.window || "1h", groups: [], telemetry: { missing: [], streamers: 4, queues: 3, partial: false,
instances: [{ service: "api", instance: "synthetic-api", last: new Date().toISOString(), dropped: 0 }, { service: "streamer", instance: "synthetic-streamer-1", last: new Date().toISOString(), dropped: 2 }], collector: { state: "reachable", dropped: 0 } } }));
app.get("/api/admin/errors", (req, res) => {
const offset = Math.max(0, parseInt(req.query.offset, 10) || 0);
const limit = Math.min(5000, Math.max(1, parseInt(req.query.limit, 10) || 250));
+121
View File
@@ -0,0 +1,121 @@
// Synthetic admin Errors fixtures, shared by scripts/dev-mock.js and
// scripts/preview-errors.js. Generated records only: no production data.
// The records have the shape the admin API returns after its projection
// (src/server/admin-log-investigation.ts), so the mocks can group them with the
// real buildIssues() and answer GET /api/admin/errors/issues like the server.
require("ts-node/register/transpile-only");
const { buildIssues, filterRows } = require("../../src/server/admin-error-issues");
const MIN = 60 * 1000;
const uuid = (n) => `aaaaaaaa-aaaa-4aaa-8aaa-${String(n).padStart(12, "0")}`;
const pick = (list, i) => list[i % list.length];
/**
* @param {object} ids repository IDs and user _ids to attach, so admin links resolve in the mock
* @param {number} now reference time (ms)
*/
function errorFixture({ repos, users, owners = {}, release = "4b2c1e9a7d", previous = "9e1d0a2c55", now = Date.now() }) {
const at = (minutesAgo) => new Date(now - minutesAgo * MIN).toISOString();
const records = [], external = [], traces = {};
let n = 1;
const add = (row, trace = []) => { records.push(row); if (row.requestId) traces[row.requestId] = [...trace, row]; return row; };
// 1. GitHub 502 incident on the file route: failing now, with external_request records (#990).
for (let i = 0; i < 46; i++) {
const requestId = uuid(n++);
const minutesAgo = i < 30 ? i * 2.3 : 75 + i * 4;
const repoId = pick(repos.slice(0, 4), i % 7 === 0 ? 3 : i % 3);
const signedIn = i % 6 === 0;
const end = now - minutesAgo * MIN;
const ts = (ms) => new Date(end - 2412 + ms).toISOString();
const calls = [0, 1, 2].map((attempt) => ({ timestamp: ts(40 + attempt * 760 + 620), service: "api", module: "external-request", event: "external_request", severity: "info",
requestId, upstreamHost: "api.github.com", upstreamMethod: "GET", upstreamEndpoint: "/repos/{owner}/{repo}/contents/*", upstreamStatus: 502, ms: 600 + attempt * 50, release }));
external.push(...calls);
const base = { service: "api", module: "route", method: "GET", route: "/api/repo/:repoId/file/:path", repoId, requestId, release: i < 30 ? release : previous,
requestPath: `/api/repo/${repoId}/file/${pick(["src/model.py", "README.md", "data/cfg.yaml", "eval.py"], i)}`,
...(signedIn && owners[repoId] ? { viewer: "owner", userId: owners[repoId] } : { viewer: "visitor" }) };
add({ ...base, timestamp: ts(2405), event: "application_log", severity: "error", errorCode: "upstream_error", errorType: "AnonymousError", status: 502 }, [
{ timestamp: ts(2412), service: "nginx", module: "proxy", event: "edge_request", severity: "info", status: 502, ms: 2412, requestId, method: "GET", route: base.route, release: "unknown" },
...calls,
{ ...base, timestamp: ts(2410), event: "request_completed", severity: "info", status: 502, ms: 2398 },
]);
}
// 2. A 429 burst: answered from the app's remembered limit state in a few ms. Route names
// the GitHub owner, so no repository ID is kept: the "not recorded" state.
for (let i = 0; i < 34; i++) {
add({ timestamp: at(380 + i * 0.6), service: "api", module: "route", event: "application_log", severity: "warn", errorCode: "github_rate_limit_exceeded",
status: 429, method: "GET", route: pick(["/api/repo/:owner/:repo", "/api/user/all_repositories", "/api/repo/:owner/:repo", "/api/repo/:owner/:repo/readme", "/api/gist/source/:id"], i), requestId: uuid(n++), ms: i % 11 === 0 ? 180 : 5 + (i % 9), release: previous });
}
// 3. An internal TypeError with a stack, first seen in the newest release.
for (let i = 0; i < 9; i++) {
const requestId = uuid(n++);
add({ timestamp: at(8 + i * 17), service: "streamer", module: "zip-stream", event: "application_log", severity: "error", errorType: "TypeError",
errorStack: "at ZipStream.entry (build/core/zipStream.js:212:31)\nat ZipStream.next (build/core/zipStream.js:188:12)\nat process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
causeType: "RangeError", causeStack: "at Archive.readEntry (build/core/archive-entry.js:44:9)",
status: 500, method: "GET", route: "/api/repo/:repoId/zip", repoId: repos[1], requestId, requestPath: `/api/repo/${repos[1]}/zip`,
viewer: "visitor", ms: 840 + i * 12, release });
}
// 4. Storage failures with a storage external call.
for (let i = 0; i < 3; i++) {
const requestId = uuid(n++);
external.push({ timestamp: at(120 + i * 30), service: "streamer", module: "external-request", event: "external_request", severity: "info", requestId,
upstreamHost: "storage", upstreamMethod: "PUT", errorCode: "ECONNRESET", ms: 4100, release: previous });
add({ timestamp: at(120 + i * 30), service: "streamer", module: "s3", event: "application_log", severity: "error", errorCode: "storage_write_size_mismatch",
status: 500, method: "GET", route: "/api/repo/:repoId/file/:path", repoId: pick([repos[2], repos[0]], i), requestId, viewer: "visitor", ms: 4180, release: previous });
}
// 5. Background job failures carry a job ID, repository and owner.
for (let i = 0; i < 4; i++) {
add({ timestamp: at(200 + i * 45), service: "worker", module: "queue", event: "job_failed", severity: "error", errorCode: "unable_to_download",
queue: "download", jobId: uuid(n++), repoId: repos[3], userId: users[1], attempt: i + 1, ms: 30000, release: previous });
}
// 6. An error with nothing else recorded: no route, no request ID, no stack.
for (let i = 0; i < 5; i++) {
add({ timestamp: at(900 + i * 40), service: "api", module: "application", event: "application_log", severity: "error", status: 500, errorCode: "server_error", release: "unknown" });
}
// 7. Expected 4xx: visitors asking for something gone or invalid.
for (let i = 0; i < 48; i++) {
const [code, status] = pick([["file_not_found", 404], ["repository_expired", 410], ["invalid_request", 400], ["repo_not_found", 404]], i);
add({ timestamp: at(5 + i * 21), service: "api", module: "route", event: "application_log", severity: i % 3 ? "info" : "warn", errorCode: code, status,
method: "GET", route: "/api/repo/:repoId/file/:path", repoId: pick(repos, i), requestId: uuid(n++), viewer: "visitor", release });
}
// 8. Slow and interrupted requests: performance, not errors.
for (let i = 0; i < 37; i++) {
add({ timestamp: at(3 + i * 30), service: i % 2 ? "streamer" : "api", module: "requests", event: i % 4 ? "request_slow" : "request_cancelled", severity: "warn",
status: 200, outcome: i % 4 ? "completed" : "interrupted", method: "GET", route: "/api/repo/:repoId/zip", requestId: uuid(n++), ms: 12000 + i * 100, release });
}
return { records, external, traces };
}
const WINDOWS = { "15m": 15, "1h": 60, "6h": 360, "24h": 1440 };
/** The /api/admin/errors/issues answer for a synthetic scenario. */
function issuesResponse(fixture, query, { scenario = "", names = { repos: {}, users: {} }, now = Date.now() } = {}) {
const window = WINDOWS[query.window] ? query.window : "24h";
const start = new Date(now - WINDOWS[window] * MIN).toISOString(), end = new Date(now).toISOString();
const history = query.source === "history" || scenario === "history";
const rows = scenario === "empty" ? [] : filterRows(fixture.records, { service: query.service || "", repoId: query.repoId || "", userId: query.userId || "" });
const built = buildIssues(history ? rows.filter((row) => row.severity !== "info") : rows, { start, end, external: history ? [] : fixture.external });
return { source: history ? "history" : "central", state: rows.length ? "ready" : "empty", centralState: history ? (query.source === "history" ? "skipped" : "disabled") : "ready",
grafanaUrl: history ? null : "https://grafana.example.test/d/synthetic", window, start, end,
filters: { service: query.service || "", repoId: query.repoId || "", userId: query.userId || "" }, captured: rows.length, redisCollecting: true, ...built, names };
}
/** The /api/admin/errors/correlation answer: every record with the request ID, in time order. */
function correlationResponse(fixture, query) {
const events = (fixture.traces[query.id] || []).slice().sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
return { state: events.length ? "ready" : "empty", source: "victorialogs", events, limit: 200, grafanaUrl: "https://grafana.example.test/d/synthetic?var-request_id=" + query.id };
}
/** Legacy Redis entries ({ ts, level, module, message, raw }) for export and the 24-hour counters. */
function historyEntries(fixture) {
return fixture.records.filter((row) => row.severity !== "info").map((row) => ({ ts: row.timestamp, level: row.severity, module: row.module,
message: row.errorCode || row.errorType || row.event, raw: [row] }));
}
module.exports = { errorFixture, issuesResponse, correlationResponse, historyEntries };
+26 -30
View File
@@ -1,41 +1,37 @@
// Local synthetic fixtures only. No production proxy or credentials.
// Run: node scripts/preview-errors.js, then /admin/errors?scenario=disabled|offline|empty|stale
// Run: PORT=4173 node scripts/preview-errors.js, then open /admin/errors.
// Add ?scenario=empty|offline|loading|history to any page to see the other states.
const express = require('express');
const fs = require('node:fs');
const { setTimeout } = require('node:timers');
const path = require('node:path');
const { errorFixture, issuesResponse, correlationResponse, historyEntries } = require('./fixtures/error-issues');
const app = express();
let historyCleared = false;
const root = path.resolve(__dirname, '../public');
const id = 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa';
const port = Number(process.env.PORT) || 4173;
const oid = n => '65f0c0de' + String(n).padStart(16, '0');
const repos = ['neurips-2026-a91f', 'icse27-replication', 'anon-7c2e0b', 'eval-harness-3d1c'];
const users = [oid(1), oid(2)];
const names = { users: { [oid(1)]: 'alice-l', [oid(2)]: 'tmorris' }, repos: {} };
repos.forEach((repoId, i) => { names.repos[repoId] = { ownerId: users[i % 2], owner: names.users[users[i % 2]], source: ['acme-lab/diffusion-bench', 'tmorris/flaky-tests', 'acme-lab/eval-harness', 'tmorris/eval'][i], status: 'ready' }; });
const fixture = errorFixture({ repos, users, owners: Object.fromEntries(repos.map((repoId, i) => [repoId, users[i % 2]])) });
let historyCleared = false;
app.use('/api', async (req, res) => {
const scenario = new URL(req.headers.referer || 'http://localhost').searchParams.get('scenario');
if (scenario === 'loading') await new Promise(resolve => setTimeout(resolve, 1500));
const now = new Date().toISOString(), start = new Date(Date.now()-3600000).toISOString();
if (req.path === '/user') return res.json({username:'Synthetic preview',isAdmin:true,status:'ready'});
if (req.path === '/user/default') return res.json({options:{},terms:[]});
if (req.path === '/admin/emails/summary') return res.json({total:2,counts:{accepted:1,rejected:1,unknown:0,sending:0},chartDays:7,series:[{date:now.slice(0,10),accepted:1,rejected:1,unknown:0,sending:0}]});
if (req.path === '/admin/emails') return res.json({entries:[{_id:'synthetic-attempt',recipient:'fixture@example.test',kind:'repository-expiration',state:'rejected',createdAt:now,httpStatus:503}],nextCursor:null});
if (req.path === '/admin/billing/summary') return res.json({period:'30d',bucket:'day',subscriptions:{active:3,monthly:2,annual:1,cancelling:0,mrr:{eur:1400}},sales:{count:4,revenue:{eur:3000}},allTime:{count:9,revenue:{eur:5000}},reversals:{refunds:0,disputes:0,amount:{}},plans:[],series:[{date:now,subscription:1,repository:2,conference:1}],revenue:{available:true,missingSales:0},webhooks:{pending:0,failed:0}});
if (req.path === '/admin/billing/grants') return res.json({results:[],total:0,stateCounts:{active:0,expired:0,revoked:0},statuses:[]});
const scenario = new URL(req.headers.referer || 'http://localhost').searchParams.get('scenario') || '';
if (scenario === 'loading') await new Promise(resolve => setTimeout(resolve, 20000));
const now = new Date().toISOString();
if (req.path === '/user') return res.json({ username: 'Synthetic preview', isAdmin: true, status: 'ready' });
if (req.path === '/user/default') return res.json({ options: {}, terms: [] });
if (scenario === 'offline' && req.path.startsWith('/admin/errors')) return res.status(503).json({});
let samples = [
{service:'worker',module:'queue',event:'job_failed',errorCode:'upstream_error',severity:'error',status:502,jobId:id,requestId:id},
{service:'nginx',module:'proxy',event:'edge_request',severity:'info',status:504,requestId:id},
{service:'streamer',module:'download',event:'request_aborted',severity:'warn',requestId:id},
{service:'api',module:'route',event:'request_failed',errorCode:'repository_unavailable',severity:'error',status:503,requestId:id},
];
if (scenario === 'diagnostics') samples = [{service:'api',module:'route',event:'application_log',severity:'error',httpStatus:500,requestId:id,method:'GET',route:'/api/repo/:repoId/file/:path',repoId:'demo-123',requestPath:'/api/repo/demo-123/file/docs/reproduce%20issue.md',errorType:'TypeError',errorStack:'at printError (build/server/routes/route-utils.js:200:7)\nat <anonymous> (build/server/routes/repository-public.js:312:11)',causeType:'RangeError',causeStack:'at <anonymous> (build/core/repository.js:410:9)'},{service:'api',module:'requests',event:'request_completed',severity:'info',status:500,requestId:id,method:'GET',route:'/api/repo/:repoId/file/:path',ms:283}];
if (scenario === 'occurrences') samples = Array.from({length:50}, (_,i) => ({service:'api',module:'route',event:'application_log',severity:'error',httpStatus:500,requestId:id,...(i%2?{method:'GET',route:'/api/repo/:repoId/file/:path'}:{})}));
if (scenario === 'many') samples = Array.from({length:50}, (_,i) => ({...samples[i%4],errorCode:'synthetic_event_'+(i+1)}));
if (req.path === '/admin/errors/investigation') return res.json({state:scenario === 'unreachable' ? 'unreachable' : scenario === 'disabled' ? 'disabled' : scenario === 'empty' ? 'empty':'ready',window:req.query.window||'1h',start,end:scenario==='stale'?start:now,captured:['disabled','unreachable','empty'].includes(scenario)?0:samples.reduce((sum,_,i)=>sum+[18,9,5,2][i%4],0),groups:['disabled','unreachable','empty'].includes(scenario)?[]:samples.map((sample,i)=>({fingerprint:String(i),sample:{...sample,release:'abcdef1234567'},count:[18,9,5,2][i%4],first:start,last:now})),telemetry:{missing:[],instances:[{service:'api',instance:'synthetic-api',last:now,dropped:0}],collector:{state:'reachable',dropped:0}}});
if (req.path === '/admin/errors/correlation') return res.json({state:'ready',start,end:now,events:samples.map(sample=>({...sample,timestamp:now}))});
if (req.path === '/admin/errors/stats') return res.json({available:true,last24h:34,prev24h:20,severity:{error:29,warn:5,info:0},unique:{error:3,warn:1,info:0},buckets:[],dropped:0});
if (req.path === '/admin/errors' && req.method === 'DELETE') historyCleared = true;
if (req.path === '/admin/errors') return res.json({available:true,redisCollecting:true,total:historyCleared?0:samples.length,max:1000,entries:historyCleared?[]:samples.map((sample,i)=>({ts:scenario==='occurrences'?new Date(Date.now()-i*11000).toISOString():now,level:sample.severity,module:sample.module,message:sample.errorCode||sample.errorType||sample.event,count:i+1,raw:[sample]}))});
if (req.path === '/admin/errors/issues') return res.json(issuesResponse(fixture, req.query, { scenario, names }));
if (req.path === '/admin/errors/correlation') return res.json(correlationResponse(fixture, req.query));
if (req.path === '/admin/errors/investigation') return res.json({ state: 'ready', window: req.query.window || '1h', groups: [], telemetry: { missing: [], instances: [{ service: 'api', instance: 'synthetic-api', last: now, dropped: 0 }], collector: { state: 'reachable', dropped: 0 } } });
if (req.path === '/admin/errors/stats') return res.json({ available: true, last24h: 34, prev24h: 20, severity: { error: 29, warn: 5, info: 0 }, unique: { error: 3, warn: 1, info: 0 }, buckets: [], dropped: 0 });
if (req.path === '/admin/errors' && req.method === 'DELETE') { historyCleared = true; return res.json({ ok: true }); }
if (req.path === '/admin/errors') { const entries = historyCleared ? [] : historyEntries(fixture); return res.json({ available: true, redisCollecting: true, total: entries.length, max: 5000, entries }); }
return res.json([]);
});
app.use((req,res,next)=>{ req.url=req.url.replace(/\.[a-f0-9]{10}\.min\./,'.min.'); next(); });
app.use(express.static(root,{index:false}));
app.get('/{*path}', (req,res)=>res.type('html').send(fs.readFileSync(path.join(root,'index.html'),'utf8').replace(/__([A-Z]+)_JS__/g,(_,name)=>`${name.toLowerCase()}.min.js`).replace('__ALL_CSS__','all.min.css').replace('<body ', '<body data-synthetic-preview="true" ').replace('<div id="app"', '<div style="padding:6px 16px;background:#fff3cd;color:#493800;text-align:center;font:13px sans-serif">Synthetic preview · generated fixtures only · no production connection</div><div id="app"')));
app.listen(4173,'0.0.0.0',()=>console.log('Synthetic Errors preview: http://localhost:4173/admin/errors'));
app.use((req, res, next) => { req.url = req.url.replace(/\.[a-f0-9]{10}\.min\./, '.min.'); next(); });
app.use(express.static(root, { index: false }));
app.get('/{*path}', (req, res) => res.type('html').send(fs.readFileSync(path.join(root, 'index.html'), 'utf8').replace(/__([A-Z]+)_JS__/g, (_, name) => `${name.toLowerCase()}.min.js`).replace('__ALL_CSS__', 'all.min.css').replace('<body ', '<body data-synthetic-preview="true" ').replace('<div id="app"', '<div style="padding:6px 16px;background:#fff3cd;color:#493800;text-align:center;font:13px sans-serif">Synthetic preview · generated fixtures only · no production connection</div><div id="app"')));
app.listen(port, '127.0.0.1', () => console.log(`Synthetic Errors preview: http://localhost:${port}/admin/errors`));
+14 -1
View File
@@ -7,7 +7,8 @@ const { execFileSync } = require('node:child_process');
const { randomUUID } = require('node:crypto');
const fs = require('node:fs');
const assert = require('node:assert/strict');
const { investigateLogs, logOptions } = require('../src/server/admin-log-investigation');
const { investigateLogs, logOptions, issueRecords } = require('../src/server/admin-log-investigation');
const { buildIssues } = require('../src/server/admin-error-issues');
const name = 'admin-logs-test-' + randomUUID().slice(0,8);
const image = fs.readFileSync('deploy/logging/compose.yml','utf8').match(/image: (victoriametrics\/victoria-logs:[^\s]+)/)[1];
const docker = (...args) => execFileSync('docker', args, {encoding:'utf8',stdio:['ignore','pipe','pipe']}).trim();
@@ -32,6 +33,18 @@ const sleep = ms => new Promise(resolve=>setTimeout(resolve,ms));
const timeline=await investigateLogs(logOptions({kind:'jobId',id:jobId},true),true);
assert.equal(timeline.state,'ready'); assert.deepEqual([...new Set(timeline.events.map(row=>row.service))].sort(),['api','streamer','worker']);
console.log('PASS real filtered grouping, privacy projection and job→request cross-service correlation');
// Issue list queries: identity filter, failed external calls and the slow/interrupted counts are valid LogsQL.
const issueId=randomUUID(), now=Date.now();
const issueRows=[{timestamp:new Date(now-3000).toISOString(),severity:'error',service:'api',event:'application_log',module:'route',errorCode:'upstream_error',status:502,release:'fedcba9',requestId:issueId,repoId:'issue-repo',route:'/api/repo/:repoId/file/:path'},
{timestamp:new Date(now-3100).toISOString(),severity:'info',service:'api',event:'external_request',module:'external-request',requestId:issueId,upstreamHost:'api.github.com',upstreamStatus:502,ms:600,release:'fedcba9'},
{timestamp:new Date(now-3200).toISOString(),severity:'warn',service:'api',event:'request_slow',module:'requests',status:200,requestId:randomUUID(),repoId:'issue-repo',release:'fedcba9'},
{timestamp:new Date(now-3300).toISOString(),severity:'info',service:'api',event:'application_log',module:'route',errorCode:'file_not_found',status:404,repoId:'issue-repo',release:'fedcba9'}];
assert((await fetch(process.env.ADMIN_LOG_URL+'/insert/jsonline?_time_field=timestamp',{method:'POST',body:issueRows.map(JSON.stringify).join('\n'),headers:{'Content-Type':'application/stream+json'}})).ok); await sleep(2000);
const issueSource=await issueRecords({window:'1h',start:new Date(now-3600000).toISOString(),end:new Date().toISOString(),service:'',repoId:'issue-repo',userId:''});
assert.equal(issueSource.state,'ready'); assert.deepEqual(issueSource.noise,{slow:1,interrupted:0}); assert.equal(issueSource.external.length,1);
const issueList=buildIssues(issueSource.records,{start:issueSource.start,end:issueSource.end,external:issueSource.external});
assert.equal(issueList.issues.length,1); assert.equal(issueList.issues[0].cause.source,'github'); assert.equal(issueList.expected.count,1);
console.log('PASS issue list: repoId filter, external calls, expected responses and noise counts');
// Run the deployed collector program in its pinned Vector image, then ingest
// its real output alongside historical absent/explicit-unknown releases.
const vectorImage = fs.readFileSync('deploy/logging/compose.yml','utf8').match(/image: (timberio\/vector:[^\s]+)/)[1];
+288
View File
@@ -0,0 +1,288 @@
import { createHash } from "crypto";
import { validProjectId, validTraceId, validUserId } from "../core/log-context";
import { EXPECTED_CLIENT_ERRORS } from "./routes/route-utils";
// Groups safe admin log rows (already projected by admin-log-investigation) into
// issues: one per error code (or exception type), service and route. Pure and
// bounded so the central-log and Redis-history paths share it.
export type Row = Record<string, string | number>;
export type CauseSource = "github" | "limit" | "storage" | "network" | "code" | "configuration" | "unknown";
export interface Cause { source: CauseSource; label: string; summary: string; detail: string; evidence: string[] }
const TITLES: Record<string, string> = {
github_rate_limit_exceeded: "GitHub rate limit reached",
rate_limited: "Request rate limit reached",
github_unavailable: "GitHub did not answer",
upstream_error: "GitHub returned an error",
upstream_timeout: "GitHub took too long to answer",
github_token_invalid: "GitHub token is no longer valid",
token_refresh_failed: "GitHub token could not be refreshed",
token_expired: "Owner's GitHub token expired",
github_app_reconnect_required: "GitHub App needs to be reconnected",
github_app_disabled: "GitHub App disabled",
repo_not_accessible: "Repository not accessible on GitHub",
repo_access_limited: "GitHub limits access to the repository",
unable_to_download: "Repository download failed",
repository_tree_too_large: "Repository tree too large",
repository_tree_incomplete: "Repository tree incomplete",
file_listing_too_large: "File listing too large",
storage_write_size_mismatch: "Storage write size mismatch",
storage_delete_failed: "Storage could not delete files",
zip_not_available: "ZIP download not available",
zip_unsafe_entry_path: "ZIP entry with an unsafe path",
preparation_interrupted: "Repository preparation interrupted",
quota_exceeded: "Quota exceeded",
server_error: "Internal error with no detail",
invalid_signature: "Webhook signature rejected",
webhook_processing_failed: "Webhook processing failed",
ECONNRESET: "Connection reset", ECONNREFUSED: "Connection refused", ETIMEDOUT: "Connection timed out",
ENOTFOUND: "Host not found", EPIPE: "Connection closed while writing", ABORT_ERR: "Request aborted",
};
const GITHUB_CODES = new Set(["github_unavailable", "upstream_error", "upstream_timeout", "repo_not_accessible", "repo_access_limited", "unable_to_download"]);
const LIMIT_CODES = new Set(["github_rate_limit_exceeded", "rate_limited"]);
const CONFIG_CODES = new Set(["github_token_invalid", "token_refresh_failed", "token_expired", "github_app_reconnect_required", "github_app_disabled", "invalid_signature"]);
const NETWORK_CODES = new Set(["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "ENOTFOUND", "EPIPE"]);
const IGNORED = new Set(["process_heartbeat", "queue_heartbeat", "process_started", "job_started", "job_completed", "deployment"]);
// Request envelopes repeat a failure that a more specific record of the same request describes.
const ENVELOPES = new Set(["edge_request", "request_completed"]);
const ACCOUNT_ROLES = new Set(["owner", "coauthor", "admin"]);
export const statusOf = (row: Row) => Number(row.status || row.httpStatus) || 0;
const codeOf = (row: Row) => String(row.errorCode || row.errorType || (row.event === "edge_request" ? `edge_${statusOf(row) || "5xx"}` : row.event) || "unknown");
export type RecordKind = "issue" | "expected" | "slow" | "interrupted" | "external" | "ignored";
export function recordKind(row: Row): RecordKind {
if (row.event === "request_slow") return "slow";
if (row.event === "request_cancelled" || row.outcome === "interrupted") return "interrupted";
if (row.event === "external_request") return "external";
if (IGNORED.has(String(row.event))) return "ignored";
const status = statusOf(row);
if (status >= 500) return "issue";
if (status >= 400 && status !== 429) return "expected";
if (EXPECTED_CLIENT_ERRORS.has(String(row.errorCode))) return "expected";
if (row.severity === "info" || row.severity === "debug") return row.errorCode ? "expected" : "ignored";
return "issue";
}
/**
* Without an error code, the code or type alone says little: every TypeError in
* the API would share one issue. The first app stack frame (or the module that
* logged it) tells those crash sites apart.
*/
function uncodedSite(row: Row) {
if (row.errorCode || row.event === "edge_request") return "";
return firstFrame(row.errorStack) || String(row.module || "");
}
export function issueTitle(row: Row) {
const code = codeOf(row);
if (TITLES[code]) return TITLES[code];
if (row.event === "edge_request") return `Edge proxy returned ${statusOf(row) || "5xx"}`;
const site = uncodedSite(row);
const at = site ? ` in ${site}` : "";
if (!row.errorCode && row.errorType) return `Code crashed: ${row.errorType}${at}`;
if (row.event === "job_failed" && !row.errorCode) return `Background job failed${at}`;
return code.replace(/_/g, " ").replace(/^./, c => c.toUpperCase()) + at;
}
export function issueId(row: Row) {
// One cause (a GitHub limit, an outage) hits many routes: routes are listed inside the issue.
return createHash("sha256").update(JSON.stringify([codeOf(row), String(row.service || ""), uncodedSite(row)])).digest("hex").slice(0, 16);
}
const time = (row: Row) => Date.parse(String(row.timestamp));
const median = (values: number[]) => { const s = values.slice().sort((a, b) => a - b); return s.length ? s[Math.floor(s.length / 2)] : 0; };
const seconds = (ms: number) => ms >= 1000 ? `${(ms / 1000).toFixed(1).replace(/\.0$/, "")} s` : `${Math.round(ms)} ms`;
const plural = (n: number, word: string) => `${n.toLocaleString("en-US")} ${word}${n === 1 ? "" : "s"}`;
const hostLabel = (host: string) => host === "storage" ? "Storage" : /github/.test(host) ? "GitHub" : host === "other" ? "An external service" : host;
function firstFrame(stack: unknown) {
// The first frame in our code: dependencies and Node internals say little about the crash site.
const line = String(stack || "").split("\n").find(value => /\(?[\w./-]+\.[jt]s:\d+/.test(value) && !/node_modules|node:/.test(value));
const match = line?.match(/([\w-]+\.[jt]s):(\d+)/);
return match ? `${match[1]}:${match[2]}` : "";
}
/** Derives a likely cause from the error code, status, timings and the request's external calls. */
export function deriveCause(rows: Row[], external: Row[] = []): Cause {
const sample = rows[0] || {};
const code = String(sample.errorCode || "");
const status = statusOf(sample);
const requests = new Set(rows.map(row => row.requestId).filter(validTraceId));
const failedCalls = external.filter(row => validTraceId(row.requestId) && requests.has(row.requestId as string) && (Number(row.upstreamStatus) >= 400 || row.errorCode));
const durations = rows.map(row => Number(row.ms)).filter(Number.isFinite);
const evidence: string[] = [];
if (durations.length > 1) evidence.push(`Durations ${seconds(Math.min(...durations))} – ${seconds(Math.max(...durations))}, median ${seconds(median(durations))}.`);
if (failedCalls.length) {
const groups = new Map<string, { host: string; status: number; method: string; endpoint: string; code: string; requests: Set<string>; calls: number }>();
for (const call of failedCalls) {
const key = [call.upstreamHost, call.upstreamStatus, call.upstreamMethod, call.upstreamEndpoint, call.errorCode].join(" ");
const group = groups.get(key) || { host: String(call.upstreamHost || "other"), status: Number(call.upstreamStatus) || 0, method: String(call.upstreamMethod || ""),
endpoint: String(call.upstreamEndpoint || ""), code: String(call.errorCode || ""), requests: new Set(), calls: 0 };
group.requests.add(call.requestId as string); group.calls++; groups.set(key, group);
}
const top = [...groups.values()].sort((a, b) => b.requests.size - a.requests.size || b.calls - a.calls)[0];
const who = hostLabel(top.host);
const what = top.status ? `answered ${top.status}` : `failed with ${top.code || "a connection error"}`;
const where = top.endpoint ? ` on ${top.method ? top.method + " " : ""}${top.endpoint}` : "";
const retries = top.calls > top.requests.size ? ` Retries (${Math.round(top.calls / top.requests.size)} calls per request) also failed.` : "";
const source: CauseSource = top.host === "storage" ? "storage" : /github/.test(top.host) ? (top.status === 429 || top.status === 403 ? "limit" : "github") : "network";
evidence.unshift(`${plural(failedCalls.length, "failed external call")} recorded for these requests.`);
return { source, label: source === "storage" ? "Storage" : source === "limit" ? "GitHub limit" : source === "github" ? "GitHub" : "Network",
summary: `${who} ${what}${where} in ${top.requests.size} of ${requests.size} failures.`,
detail: `${retries.trim()}${retries ? " " : ""}${source === "github" ? "This points at GitHub, not at the app." : source === "storage" ? "This points at the storage backend." : ""}`.trim(), evidence };
}
if (LIMIT_CODES.has(code) || status === 429) {
const fast = durations.filter(ms => ms < 20).length;
if (durations.length && fast * 2 >= durations.length) {
return { source: "limit", label: "GitHub limit", summary: `${fast} of ${rows.length} requests returned 429 in under 20 ms.`,
detail: "That is too fast for a GitHub call: the app answered from its remembered limit state without calling GitHub.", evidence };
}
return { source: "limit", label: "GitHub limit", summary: "GitHub's rate limit for the token or installation was exhausted.",
detail: "The records do not say which token or installation ran out.", evidence };
}
if (CONFIG_CODES.has(code)) return { source: "configuration", label: "Configuration", summary: `The app recorded ${code}: a credential or app setting needs attention.`, detail: "", evidence };
if (/^storage_/.test(code) || sample.module === "s3" || sample.upstreamHost === "storage") {
return { source: "storage", label: "Storage", summary: `The storage backend failed (${code || sample.errorType || "no code"}).`, detail: "", evidence };
}
if (GITHUB_CODES.has(code)) {
const subject = rows.some(row => row.jobId) && !rows.some(row => row.requestId) ? "Jobs" : "Requests";
const low = Math.min(...durations), high = Math.max(...durations);
const waited = durations.length ? ` ${subject} waited ${low === high ? seconds(low) : `${seconds(low)} – ${seconds(high)}`}, then gave up.` : "";
return { source: "github", label: "GitHub", summary: `The app recorded ${code} for ${plural(rows.length, "record")}.${waited}`,
detail: "No external call records were found for these requests, so GitHub's own answer is not known.", evidence };
}
if (NETWORK_CODES.has(code)) return { source: "network", label: "Network", summary: `A connection to another service failed (${code}).`, detail: "", evidence };
const frame = firstFrame(sample.errorStack);
if (sample.errorType && (frame || sample.errorStack)) {
return { source: "code", label: "Our code", summary: `${sample.errorType}${frame ? ` thrown at ${frame}` : " thrown"}.`,
detail: sample.causeType ? `Caused by ${sample.causeType}.` : "", evidence };
}
return { source: "unknown", label: "Unknown", summary: "No cause recorded: the records have no exception, stack or external call.", detail: "", evidence };
}
export interface IssueOptions { start: string; end: string; external?: Row[]; buckets?: number; occurrences?: number }
type Bucket = { rows: Row[]; first: number; last: number };
const occurrence = (row: Row) => Object.fromEntries(["timestamp", "requestId", "jobId", "repoId", "userId", "viewer", "requestPath", "method", "route", "status", "httpStatus", "ms", "release", "service", "errorCode", "errorType"]
.filter(key => row[key] !== undefined && row[key] !== "").map(key => [key, row[key]]));
function countBy(rows: Row[], key: "repoId" | "userId", valid: (value: unknown) => boolean) {
const map = new Map<string, { id: string; count: number; last: string }>();
for (const row of rows) {
const id = row[key];
if (!valid(id)) continue;
const entry = map.get(id as string) || { id: id as string, count: 0, last: String(row.timestamp) };
entry.count++; if (time(row) > Date.parse(entry.last)) entry.last = String(row.timestamp);
map.set(id as string, entry);
}
return [...map.values()].sort((a, b) => b.count - a.count || Date.parse(b.last) - Date.parse(a.last));
}
/** Splits rows into issues, expected responses and excluded noise. */
export function buildIssues(rows: Row[], options: IssueOptions) {
const start = Date.parse(options.start), end = Date.parse(options.end);
const size = options.buckets || 24, step = Math.max(1, (end - start) / size);
const inWindow = rows.filter(row => { const t = time(row); return Number.isFinite(t) && t >= start && t <= end; });
const excluded = { slow: 0, interrupted: 0 };
const expected = new Map<string, { code: string; status: number; count: number; last: string }>();
const external = [...(options.external || [])];
const candidates: Row[] = [];
for (const row of inWindow) {
const kind = recordKind(row);
if (kind === "slow" || kind === "interrupted") excluded[kind]++;
else if (kind === "external") external.push(row);
else if (kind === "expected") {
const key = `${codeOf(row)}:${statusOf(row)}`;
const entry = expected.get(key) || { code: codeOf(row), status: statusOf(row), count: 0, last: String(row.timestamp) };
entry.count++; if (time(row) > Date.parse(entry.last)) entry.last = String(row.timestamp);
expected.set(key, entry);
} else if (kind === "issue") candidates.push(row);
}
const specific = new Set(candidates.filter(row => !ENVELOPES.has(String(row.event))).map(row => row.requestId).filter(validTraceId));
const issueRows = candidates.filter(row => !(ENVELOPES.has(String(row.event)) && specific.has(row.requestId as string)));
const releases = issueRows.filter(row => row.release && row.release !== "unknown").sort((a, b) => time(b) - time(a)).map(row => String(row.release));
const newest = releases[0];
const mixedReleases = new Set(releases).size > 1;
const groups = new Map<string, Bucket>();
for (const row of issueRows) {
const id = issueId(row);
const group = groups.get(id) || { rows: [], first: Infinity, last: -Infinity };
group.rows.push(row); group.first = Math.min(group.first, time(row)); group.last = Math.max(group.last, time(row));
groups.set(id, group);
}
const issues = [...groups.entries()].map(([id, group]) => {
const sorted = group.rows.sort((a, b) => time(b) - time(a));
const sample = sorted[0];
const firstRow = sorted[sorted.length - 1];
const trend = Array.from({ length: size }, () => 0);
for (const row of sorted) trend[Math.min(size - 1, Math.max(0, Math.floor((time(row) - start) / step)))]++;
const requests = new Set(sorted.map(row => row.requestId).filter(validTraceId));
const jobs = new Set(sorted.map(row => row.jobId).filter(validTraceId));
const repos = countBy(sorted, "repoId", validProjectId);
const users = countBy(sorted, "userId", validUserId);
// "visitor" is signed in without a role on the repository; "anonymous" has no session.
const viewers = { signedIn: 0, visitors: 0, anonymous: 0, notRecorded: 0 };
for (const row of sorted) viewers[ACCOUNT_ROLES.has(String(row.viewer)) ? "signedIn" : row.viewer === "visitor" ? "visitors" : row.viewer === "anonymous" ? "anonymous" : "notRecorded"]++;
const routeCounts = new Map<string, { route: string; method: string; count: number; last: string }>();
for (const row of sorted) {
const route = String(row.route || (row.queue ? `job ${row.queue}` : ""));
if (!route) continue;
const key = `${row.method || ""} ${route}`;
const entry = routeCounts.get(key) || { route, method: String(row.method || ""), count: 0, last: String(row.timestamp) };
entry.count++; routeCounts.set(key, entry);
}
const routes = [...routeCounts.values()].sort((a, b) => b.count - a.count || Date.parse(b.last) - Date.parse(a.last));
const top = routes[0];
return {
id, title: issueTitle(sample), code: codeOf(sample), errorCode: sample.errorCode || null, errorType: sample.errorType || null,
status: statusOf(sample) || null, service: sample.service || null, route: top && !top.route.startsWith("job ") ? top.route : null, method: top?.method || sample.method || null,
queue: sample.queue || null, event: sample.event, severity: sample.severity,
count: sorted.length, requests: requests.size, jobs: jobs.size, routeKnown: sorted.filter(row => row.route).length, routeCount: routes.length, routes: routes.slice(0, 20),
repoCount: repos.length, repos: repos.slice(0, 50), userCount: users.length, users: users.slice(0, 50), viewers,
first: new Date(group.first).toISOString(), last: new Date(group.last).toISOString(),
firstRelease: firstRow.release && firstRow.release !== "unknown" ? firstRow.release : null,
newInRelease: mixedReleases && newest && firstRow.release === newest ? newest : null,
failingNow: end - group.last <= 15 * 60000,
trend, cause: deriveCause(sorted, external),
occurrences: sorted.slice(0, options.occurrences || 50).map(occurrence), sample,
};
}).sort((a, b) => Number(b.failingNow) - Number(a.failingNow) || Date.parse(b.last) - Date.parse(a.last));
const repoIds = new Set(issues.flatMap(issue => issue.repos.map(repo => repo.id)));
const userIds = new Set(issues.flatMap(issue => issue.users.map(user => user.id)));
const failed = issues.reduce((sum, issue) => sum + issue.count, 0);
const upstream = issues.filter(issue => ["github", "limit", "storage"].includes(issue.cause.source)).reduce((sum, issue) => sum + issue.count, 0);
const expectedList = [...expected.values()].sort((a, b) => b.count - a.count);
return {
issues,
expected: { count: expectedList.reduce((sum, entry) => sum + entry.count, 0), groups: expectedList.slice(0, 20) },
excluded,
summary: { issues: issues.length, failingNow: issues.filter(issue => issue.failingNow).length, failedRecords: failed,
repositories: repoIds.size, users: userIds.size, upstreamShare: failed ? Math.round(upstream / failed * 100) : 0 },
};
}
export class InvalidIssueQuery extends Error {}
const ISSUE_WINDOWS: Record<string, number> = { "15m": 15, "1h": 60, "6h": 360, "24h": 1440 };
const ISSUE_SERVICES = ["api", "streamer", "worker", "nginx", "mongodb", "redis", "backup"];
/** Validated options for GET /api/admin/errors/issues. Unknown keys are rejected. */
export function issueOptions(query: Record<string, unknown>, now = Date.now()) {
const permitted = ["window", "service", "repoId", "userId", "source"];
if (Object.keys(query).some(key => !permitted.includes(key)) || Object.values(query).some(value => typeof value !== "string")) throw new InvalidIssueQuery();
const window = (query.window as string) || "24h";
if (!Object.hasOwn(ISSUE_WINDOWS, window)) throw new InvalidIssueQuery();
const service = (query.service as string) || "";
if (service && !ISSUE_SERVICES.includes(service)) throw new InvalidIssueQuery();
const repoId = (query.repoId as string) || "";
if (repoId && !validProjectId(repoId)) throw new InvalidIssueQuery();
const userId = (query.userId as string) || "";
if (userId && !validUserId(userId)) throw new InvalidIssueQuery();
const source = (query.source as string) || "auto";
if (!["auto", "history"].includes(source)) throw new InvalidIssueQuery();
return { window, service, repoId, userId, source, start: new Date(now - ISSUE_WINDOWS[window] * 60000).toISOString(), end: new Date(now).toISOString() };
}
export type IssueQuery = ReturnType<typeof issueOptions>;
/** Keeps only rows that match the validated service, repository and user filters. */
export function filterRows(rows: Row[], query: Pick<IssueQuery, "service" | "repoId" | "userId">) {
return rows.filter(row => (!query.service || row.service === query.service) && (!query.repoId || row.repoId === query.repoId) && (!query.userId || row.userId === query.userId));
}
+67 -6
View File
@@ -1,6 +1,6 @@
import { createHash } from "crypto";
import { logRecord, LOG_NUMBERS, LOG_STAGES } from "../core/log-record";
import { LogContext, logContext, validTraceId } from "../core/log-context";
import { LogContext, logContext, validProjectId, validTraceId, validUserId } from "../core/log-context";
import { LOG_EVENTS } from "../core/log-schema";
import { LOG_ROUTES } from "../core/log-diagnostic-schema";
@@ -10,7 +10,7 @@ const windows: Record<string, number> = { "15m": 15, "1h": 60, "6h": 360, "24h":
let active = 0;
export class InvalidLogQuery extends Error {}
export function logOptions(query: Record<string, unknown>, correlation = false) {
const permitted = correlation ? ["window", "kind", "id"] : ["window", "service", "release"];
const permitted = correlation ? ["window", "kind", "id"] : ["window", "service", "release", "repoId", "userId"];
if (Object.keys(query).some(key => !permitted.includes(key)) || Object.values(query).some(value => typeof value !== "string")) throw new InvalidLogQuery();
const window = (query.window as string) || "1h";
if (!Object.hasOwn(windows, window)) throw new InvalidLogQuery();
@@ -19,9 +19,11 @@ export function logOptions(query: Record<string, unknown>, correlation = false)
if (service && !services.includes(service)) throw new InvalidLogQuery();
if (release && !/^(?:[a-f0-9]{7,40}|unknown)$/.test(release)) throw new InvalidLogQuery();
if (correlation && (!validTraceId(query.id) || !["requestId", "jobId"].includes(String(query.kind)))) throw new InvalidLogQuery();
const repoId = (query.repoId as string) || "", userId = (query.userId as string) || "";
if ((repoId && !validProjectId(repoId)) || (userId && !validUserId(userId))) throw new InvalidLogQuery();
const end = new Date().toISOString();
const start = new Date(Date.now() - windows[window] * 60000).toISOString();
return { window, start, end, service, release, id: query.id as string, kind: query.kind as "requestId" | "jobId" };
return { window, start, end, service, release, repoId, userId, id: query.id as string, kind: query.kind as "requestId" | "jobId" };
}
type Options = ReturnType<typeof logOptions>;
type Row = Record<string, string | number>;
@@ -52,7 +54,8 @@ function safeRow(input: Record<string, unknown>): Row | null {
if (typeof time !== "string" || !Number.isFinite(Date.parse(time))) return null;
// Reuse the application's reviewed projection. Never return raw backend data.
const numeric = [...LOG_NUMBERS, ...LOG_STAGES.flatMap(stage => [`stage_${stage}_ms`, `stage_${stage}_count`, `stage_${stage}_open`])];
const data: Record<string, unknown> = { ...input, code: input.errorCode };
// #990 stores the external host as upstreamHost; logRecord revalidates it from hostname.
const data: Record<string, unknown> = { ...input, code: input.errorCode, hostname: input.upstreamHost };
for (const key of numeric) if (typeof input[key] === "string" && /^-?\d+(?:\.\d+)?$/.test(input[key] as string)) data[key] = Number(input[key]);
for (const [field, suffix] of [["stages", "ms"], ["stageCounts", "count"], ["stageOpen", "open"]]) {
data[field] = Object.fromEntries(LOG_STAGES.map(stage => [stage, data[`stage_${stage}_${suffix}`]]));
@@ -65,7 +68,7 @@ function safeRow(input: Record<string, unknown>): Row | null {
for (const key of keys) if (typeof input[key] === "string") (identity as Record<string, unknown>)[key] = input[key];
const projected = logContext.run(identity, () => logRecord(["error", "warn", "info", "debug"].includes(String(input.severity)) ? String(input.severity) : "info", String(input.module || "application"), ["", data]));
const result: Row = { timestamp: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/.test(time) ? time : new Date(time).toISOString(), severity: String(projected.severity), service: services.includes(String(input.service)) ? String(input.service) : "unknown", event: events.has(String(input.event)) ? String(input.event) : "application_log", module: String(projected.module), release: /^(?:[a-f0-9]{7,40}|unknown)$/.test(String(input.release)) ? String(input.release) : "unknown" };
for (const key of [...numeric, "deploymentId", "deploymentOperation", "deploymentPhase", "deploymentOutcome", "outcome", "endpointKind", "cancellationOrigin", "cancellationEvidence", "hopId", "parentHopId", "errorCode", "requestId", "jobId", "queue", "route", "method", "errorType", "errorStack", "causeType", "causeStack", "repoId", "pullRequestId", "gistId", "userId", "viewer", "requestPath"]) if (typeof projected[key] === "string" || typeof projected[key] === "number") result[key] = projected[key] as string | number;
for (const key of [...numeric, "deploymentId", "deploymentOperation", "deploymentPhase", "deploymentOutcome", "outcome", "endpointKind", "cancellationOrigin", "cancellationEvidence", "hopId", "parentHopId", "errorCode", "requestId", "jobId", "queue", "route", "method", "errorType", "errorStack", "causeType", "causeStack", "repoId", "pullRequestId", "gistId", "userId", "viewer", "requestPath", "upstreamHost", "upstreamMethod", "upstreamEndpoint"]) if (typeof projected[key] === "string" || typeof projected[key] === "number") result[key] = projected[key] as string | number;
if (validTraceId(input.instance)) result.instance = input.instance;
return result;
}
@@ -86,6 +89,8 @@ async function rows(base: string, query: string, limit: number, signal: AbortSig
return { records, partial: lines.length >= limit || rejected > 0 };
}
const range = (o: Options) => `_time:[${o.start}, ${o.end}]`;
// Values are validated (validProjectId / validUserId) before they reach a query.
const identity = (o: { repoId?: string; userId?: string }) => `${o.repoId ? ` repoId:"${o.repoId}"` : ""}${o.userId ? ` userId:"${o.userId}"` : ""}`;
function grafana(o: Options) {
try {
const value = process.env.ADMIN_LOG_GRAFANA_URL;
@@ -171,7 +176,7 @@ export async function investigateLogs(options: Options, correlation = false) {
}
// Historical collector output omits unknown releases and keeps edge 5xx at info.
const release = options.release === "unknown" ? ' (release:unknown OR release:"")' : options.release ? ` release:${options.release}` : "";
const filter = `${range(options)} (severity:error OR severity:warn OR (service:nginx event:edge_request status:>=500 status:<600))${options.service ? ` service:${options.service}` : ""}${release}`;
const filter = `${range(options)} (severity:error OR severity:warn OR (service:nginx event:edge_request status:>=500 status:<600))${options.service ? ` service:${options.service}` : ""}${release}${identity(options)}`;
const baselineStart = new Date(Date.parse(options.start) - 24 * 60 * 60 * 1000).toISOString();
const compareRelease = options.release && options.release !== "unknown";
const [errors, heartbeat, drops, baseline] = await Promise.all([
@@ -195,3 +200,59 @@ export async function investigateLogs(options: Options, correlation = false) {
} catch { return { ...common, state: "unreachable", groups: [], events: [] }; }
finally { controller.abort(); clearTimeout(timer); active--; }
}
type IssueSource = { window: string; start: string; end: string; service: string; repoId: string; userId: string };
const FAULTS = "(severity:error OR severity:warn OR (service:nginx event:edge_request status:>=500 status:<600))";
async function noiseCounts(base: string, query: string, signal: AbortSignal) {
const text = await read(base + "/select/logsql/query", signal, new URLSearchParams({ query }));
const counts = { slow: 0, interrupted: 0 };
for (const line of text.split("\n").filter(Boolean).slice(0, 10)) {
try {
const row = JSON.parse(line); const n = Number(row.n);
if (Number.isSafeInteger(n) && n >= 0) { if (row.event === "request_slow") counts.slow = n; if (row.event === "request_cancelled") counts.interrupted = n; }
} catch { /* A malformed stats line only loses the count. */ }
}
return counts;
}
/**
* Records for the admin issue list: faults (slow and interrupted requests excluded
* and only counted), expected responses logged at info, and failed external calls
* that explain them. Same bounds and projection as investigateLogs.
*/
export async function issueRecords(options: IssueSource) {
const o = { ...options, release: "", id: "", kind: "requestId" as const };
const common = { source: "central", window: o.window, start: o.start, end: o.end, grafanaUrl: grafana(o) };
let base: string | null;
try { base = endpoint(process.env.ADMIN_LOG_URL); } catch { return { ...common, state: "misconfigured", records: [], external: [], noise: null }; }
if (!base) return { ...common, state: "disabled", records: [], external: [], noise: null };
if (active >= 2) return { ...common, state: "busy", records: [], external: [], noise: null };
active++;
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 4000); timer.unref();
try {
const scope = `${range(o)}${o.service ? ` service:${o.service}` : ""}${identity(o)}`;
const noise = "(event:request_slow OR event:request_cancelled)";
const failedCalls = `${range(o)} event:external_request (upstreamStatus:>=400 OR errorCode:*)`;
const filtered = Boolean(o.service || o.repoId || o.userId);
const [faults, expected, unscoped, counts] = await Promise.all([
rows(base, `${scope} ${FAULTS} NOT ${noise} NOT event:external_request | sort by (_time) desc`, 2001, controller.signal),
rows(base, `${scope} severity:info errorCode:* NOT event:external_request | sort by (_time) desc`, 501, controller.signal),
filtered ? Promise.resolve(null) : rows(base, `${failedCalls} | sort by (_time) desc`, 2001, controller.signal).catch(() => ({ records: [], partial: true })),
noiseCounts(base, `${scope} ${noise} | stats by (event) count() n`, controller.signal).catch(() => null),
]);
// With a filter, the newest 2000 failed calls overall can miss the ones behind
// the filtered faults: external calls carry no user and often no repository,
// so look them up by the faults' request IDs instead.
let external = unscoped;
if (!external) {
const ids = [...new Set(faults.records.map(row => row.requestId).filter(validTraceId))].slice(0, 200);
external = ids.length
? await rows(base, `${failedCalls} requestId:in(${ids.map(id => `"${id}"`).join(",")}) | sort by (_time) desc`, 2001, controller.signal).catch(() => ({ records: [], partial: true }))
: { records: [], partial: false };
}
const records = [...faults.records.slice(0, 2000), ...expected.records.slice(0, 500)];
return { ...common, state: faults.partial || expected.partial ? "partial" : records.length ? "ready" : "empty", records, external: external.records.slice(0, 2000),
externalPartial: external.partial, noise: counts, captured: records.length, limit: 2500, faultLimit: 2000, faultLimitReached: faults.records.length >= 2000 };
} catch { return { ...common, state: "unreachable", records: [], external: [], noise: null }; }
finally { controller.abort(); clearTimeout(timer); active--; }
}
+53 -1
View File
@@ -1,4 +1,5 @@
import { investigateLogs, logOptions, safeRedisLog } from "../admin-log-investigation";
import { investigateLogs, issueRecords, logOptions, safeRedisLog } from "../admin-log-investigation";
import { buildIssues, filterRows, issueOptions, IssueQuery, Row } from "../admin-error-issues";
import { jobTrace } from "../../core/log-context";
import { cacheMetricsReport } from "../../core/cache-observability";
import { sharedBlobCache, resultBlobCache } from "../../core/blob-cache";
@@ -113,6 +114,57 @@ for (const [path, correlation] of [["/errors/investigation", false], ["/errors/c
});
}
// Repository owners and user names for the issue pages. Bounded, and skipped
// when the database is not connected so the error page never waits on it.
async function issueNames(repoIds: string[], userIds: string[]) {
const repos: Record<string, { ownerId?: string; owner?: string; source?: string; status?: string }> = {};
const users: Record<string, string> = {};
if (AnonymizedRepositoryModel.db.readyState !== 1 || (!repoIds.length && !userIds.length)) return { repos, users };
try {
const found = repoIds.length ? await AnonymizedRepositoryModel.find({ repoId: { $in: repoIds.slice(0, 100) } }, { repoId: 1, owner: 1, status: 1, "source.repositoryName": 1 }).lean().maxTimeMS(2000) : [];
const owners = [...new Set([...found.map(repo => String(repo.owner || "")).filter(id => /^[a-f0-9]{24}$/.test(id)), ...userIds.slice(0, 100)])];
const named = owners.length ? await UserModel.find({ _id: { $in: owners } }, { username: 1 }).lean().maxTimeMS(2000) : [];
for (const user of named) users[String(user._id)] = String(user.username);
for (const repo of found) {
const ownerId = repo.owner ? String(repo.owner) : undefined;
repos[repo.repoId] = { ownerId, owner: ownerId ? users[ownerId] : undefined, source: (repo.source as { repositoryName?: string } | undefined)?.repositoryName, status: repo.status };
}
} catch { /* Names are a convenience; IDs stay usable without them. */ }
return { repos, users };
}
async function historyRows(query: IssueQuery) {
if (errorLogActive >= ERROR_LOG_CONCURRENCY) return { state: "busy", rows: [] as Row[] };
errorLogActive++;
try {
const client = await getErrorLogClient();
if (!client) return { state: "unavailable", rows: [] as Row[] };
const raw = await client.lRange(ERROR_LOG_KEY, 0, ERROR_LOG_MAX - 1);
const rows = raw.flatMap(text => { try { const row = safeRedisLog(JSON.parse(text))?.raw?.[0]; return row ? [row as Row] : []; } catch { return []; } });
return { state: "ready", rows: filterRows(rows, query) };
} catch { return { state: "unavailable", rows: [] as Row[] }; }
finally { errorLogActive--; }
}
// One list of issues: central logs when they answer, the Redis history otherwise.
router.get("/errors/issues", async (req, res) => {
res.setHeader("Cache-Control", "no-store");
let query: IssueQuery;
try { query = issueOptions(req.query as Record<string, unknown>); }
catch { return res.status(400).json({ error: "invalid_request" }); }
const central = query.source === "history" ? null : await issueRecords(query);
const useCentral = central && ["ready", "partial", "empty"].includes(central.state);
const history = useCentral ? null : await historyRows(query);
const rows = useCentral ? central.records as Row[] : history!.rows;
const built = buildIssues(rows, { start: query.start, end: query.end, external: useCentral ? central.external as Row[] : [] });
if (useCentral && central.noise) built.excluded = central.noise;
const names = await issueNames([...new Set(built.issues.flatMap(issue => issue.repos.map(repo => repo.id)))], [...new Set(built.issues.flatMap(issue => issue.users.map(user => user.id)))]);
res.json({
source: useCentral ? "central" : "history", state: useCentral ? central.state : history!.state,
centralState: central?.state || "skipped", grafanaUrl: central?.grafanaUrl || null,
window: query.window, start: query.start, end: query.end, filters: { service: query.service, repoId: query.repoId, userId: query.userId },
captured: rows.length, faultLimitReached: Boolean(useCentral && "faultLimitReached" in central && central.faultLimitReached), redisCollecting: process.env.LOG_REDIS_MIRROR !== "off", ...built, names,
});
});
router.use("/tokens", adminTokensRouter);
router.use("/billing", adminBillingRouter);
router.use("/emails", adminEmailsRouter);
+228
View File
@@ -0,0 +1,228 @@
const { expect } = require('chai');
const { Response, fetch } = globalThis;
require('ts-node/register/transpile-only');
const { buildIssues, deriveCause, recordKind, issueOptions, filterRows, issueId } = require('../src/server/admin-error-issues');
const { issueRecords, logOptions, investigateLogs } = require('../src/server/admin-log-investigation');
const NOW = Date.parse('2026-11-29T12:00:00Z');
const at = minutes => new Date(NOW - minutes * 60000).toISOString();
const rid = n => `aaaaaaaa-aaaa-4aaa-8aaa-${String(n).padStart(12, '0')}`;
const USER = '65f0c0de0000000000000001';
const window = { start: at(1440), end: at(0) };
const fault = extra => ({ timestamp: at(5), service: 'api', module: 'route', event: 'application_log', severity: 'error', errorCode: 'upstream_error', status: 502,
method: 'GET', route: '/api/repo/:repoId/file/:path', release: 'abcdef1', ...extra });
describe('admin error issues', () => {
describe('grouping', () => {
it('groups by code and service, and counts requests, repositories, users and viewers', () => {
const rows = [
fault({ requestId: rid(1), repoId: 'repo-one', viewer: 'visitor' }),
fault({ requestId: rid(2), repoId: 'repo-one', viewer: 'owner', userId: USER, timestamp: at(30) }),
fault({ requestId: rid(3), repoId: 'repo-two', viewer: 'visitor', timestamp: at(60) }),
fault({ requestId: rid(5), service: 'streamer' }),
fault({ requestId: rid(6), errorCode: undefined, errorType: 'TypeError', status: 500 }),
];
const { issues, summary } = buildIssues(rows, window);
expect(issues).to.have.length(3);
const file = issues.find(issue => issue.code === 'upstream_error' && issue.service === 'api');
expect(file).to.include({ count: 3, requests: 3, repoCount: 2, userCount: 1, title: 'GitHub returned an error', failingNow: true, routeCount: 1, route: '/api/repo/:repoId/file/:path' });
expect(file.repos[0]).to.include({ id: 'repo-one', count: 2 });
expect(file.viewers).to.deep.equal({ signedIn: 1, visitors: 2, anonymous: 0, notRecorded: 0 });
expect(file.occurrences.map(o => o.requestId)).to.deep.equal([rid(1), rid(2), rid(3)]);
expect(file.trend.reduce((a, b) => a + b, 0)).to.equal(3);
expect(issues.find(issue => issue.code === 'TypeError').title).to.equal('Code crashed: TypeError in route');
expect(summary).to.include({ issues: 3, failingNow: 3, failedRecords: 5, repositories: 2, users: 1 });
expect(issueId(rows[0])).to.equal(file.id);
});
it('splits uncoded crashes by their first app frame, and uncoded warnings by module', () => {
const crash = (n, stack) => fault({ requestId: rid(n), errorCode: undefined, errorType: 'TypeError', status: 500,
errorStack: `TypeError: x\n at f (/app/node_modules/mongoose/lib/query.js:10:2)\n at node:internal/process/task_queues:95:5\n ${stack}` });
const warn = (n, module) => fault({ requestId: rid(n), errorCode: undefined, status: undefined, severity: 'warn', module });
const rows = [crash(1, 'at a (/app/build/core/Repository.js:42:7)'), crash(2, 'at a (/app/build/core/Repository.js:42:7)'),
crash(3, 'at b (/app/build/server/routes/file.js:9:3)'), warn(4, 'storage'), warn(5, 'zip'),
fault({ requestId: rid(6) }), fault({ requestId: rid(7), errorStack: 'at c (/app/build/x.js:1:1)' })];
const { issues } = buildIssues(rows, window);
const titles = issues.map(issue => [issue.title, issue.count]).sort();
expect(titles).to.deep.equal([
['Application log in storage', 1], ['Application log in zip', 1],
['Code crashed: TypeError in Repository.js:42', 2], ['Code crashed: TypeError in file.js:9', 1],
['GitHub returned an error', 2],
]);
});
it('labels signed-in visitors apart from viewers without a session', () => {
const rows = [fault({ requestId: rid(1), viewer: 'visitor' }), fault({ requestId: rid(2), viewer: 'anonymous' }), fault({ requestId: rid(3), viewer: 'coauthor' }), fault({ requestId: rid(4) })];
expect(buildIssues(rows, window).issues[0].viewers).to.deep.equal({ signedIn: 1, visitors: 1, anonymous: 1, notRecorded: 1 });
});
it('keeps one cause across routes in one issue and lists its routes, most frequent first', () => {
const routes = ['/api/user/all_repositories', '/api/repo/:owner/:repo', '/api/repo/:owner/:repo/readme', '/api/gist/source/:id', '/api/pr/:owner/:repo/:id'];
const limited = Array.from({ length: 102 }, (_, i) => fault({ requestId: rid(i), errorCode: 'github_rate_limit_exceeded', status: 429, severity: 'warn', ms: 7,
route: routes[i < 28 ? 0 : i < 53 ? 1 : i < 78 ? 2 : i < 90 ? 3 : 4], timestamp: at(30 + i * 0.3) }));
const other = fault({ requestId: rid(500), errorCode: 'upstream_error', route: routes[0] });
const { issues } = buildIssues([...limited, other], window);
expect(issues).to.have.length(2);
const limit = issues.find(issue => issue.code === 'github_rate_limit_exceeded');
expect(limit).to.include({ count: 102, routeCount: 5, route: '/api/user/all_repositories', method: 'GET' });
expect(limit.routes.map(route => route.count)).to.deep.equal([28, 25, 25, 12, 12]);
expect(limit.id).to.equal(issueId({ errorCode: 'github_rate_limit_exceeded', service: 'api', route: '/anything/else' }));
expect(issues.find(issue => issue.code === 'upstream_error').id).to.not.equal(limit.id);
});
it('drops request envelopes already described by a more specific record, keeps lone edge 5xx', () => {
const rows = [
fault({ requestId: rid(1) }),
{ timestamp: at(5), service: 'nginx', event: 'edge_request', severity: 'info', status: 502, requestId: rid(1) },
{ timestamp: at(9), service: 'nginx', event: 'edge_request', severity: 'info', status: 504, requestId: rid(2) },
];
const { issues } = buildIssues(rows, window);
expect(issues.map(issue => issue.title).sort()).to.deep.equal(['Edge proxy returned 504', 'GitHub returned an error']);
});
it('marks an issue new in the newest release only when older releases appear in the window', () => {
const rows = [fault({ release: 'abcdef1', timestamp: at(100) }), fault({ errorCode: 'storage_write_size_mismatch', status: 500, release: 'bbbbbb2', timestamp: at(2) })];
const issues = buildIssues(rows, window).issues;
expect(issues.find(i => i.code === 'storage_write_size_mismatch').newInRelease).to.equal('bbbbbb2');
expect(issues.find(i => i.code === 'upstream_error').newInRelease).to.equal(null);
expect(buildIssues([fault({})], window).issues[0].newInRelease).to.equal(null);
});
});
describe('noise split', () => {
it('keeps slow and interrupted requests and expected 4xx out of the issues', () => {
expect(recordKind({ event: 'request_slow', severity: 'warn', status: 200 })).to.equal('slow');
expect(recordKind({ event: 'request_cancelled', severity: 'warn' })).to.equal('interrupted');
expect(recordKind({ event: 'request_completed', outcome: 'interrupted', status: 500 })).to.equal('interrupted');
expect(recordKind({ event: 'application_log', severity: 'warn', status: 404, errorCode: 'file_not_found' })).to.equal('expected');
expect(recordKind({ event: 'application_log', severity: 'warn', status: 400, errorCode: 'invalid_request' })).to.equal('expected');
expect(recordKind({ event: 'application_log', severity: 'info', errorCode: 'repository_expired' })).to.equal('expected');
expect(recordKind({ event: 'application_log', severity: 'warn', status: 429, errorCode: 'github_rate_limit_exceeded' })).to.equal('issue');
expect(recordKind({ event: 'external_request', severity: 'info', upstreamStatus: 502 })).to.equal('external');
expect(recordKind({ event: 'process_heartbeat', severity: 'info' })).to.equal('ignored');
const rows = [fault({}), fault({ event: 'request_slow', severity: 'warn', status: 200 }), fault({ event: 'request_cancelled', severity: 'warn' }),
fault({ errorCode: 'file_not_found', status: 404, severity: 'info' }), fault({ errorCode: 'file_not_found', status: 404, severity: 'warn' }), fault({ errorCode: 'invalid_request', status: 400, severity: 'warn' })];
const built = buildIssues(rows, window);
expect(built.issues).to.have.length(1);
expect(built.excluded).to.deep.equal({ slow: 1, interrupted: 1 });
expect(built.expected.count).to.equal(3);
expect(built.expected.groups[0]).to.include({ code: 'file_not_found', status: 404, count: 2 });
});
it('ignores records outside the window', () => {
expect(buildIssues([fault({ timestamp: at(2000) })], window).issues).to.have.length(0);
});
});
describe('cause derivation', () => {
it('names the failing GitHub endpoint from external_request records of the same requests', () => {
const rows = [fault({ requestId: rid(1) }), fault({ requestId: rid(2) })];
const call = n => ({ event: 'external_request', requestId: rid(n), upstreamHost: 'api.github.com', upstreamMethod: 'GET', upstreamEndpoint: '/repos/{owner}/{repo}/contents/*', upstreamStatus: 502 });
const cause = deriveCause(rows, [call(1), call(1), call(1), call(2), call(2), call(2), { ...call(9), upstreamStatus: 500 }]);
expect(cause).to.include({ source: 'github', label: 'GitHub', summary: 'GitHub answered 502 on GET /repos/{owner}/{repo}/contents/* in 2 of 2 failures.' });
expect(cause.detail).to.include('Retries (3 calls per request) also failed');
});
it('recognizes storage and connection failures of external calls', () => {
const cause = deriveCause([fault({ requestId: rid(1), errorCode: 'storage_write_size_mismatch' })], [{ event: 'external_request', requestId: rid(1), upstreamHost: 'storage', errorCode: 'ECONNRESET' }]);
expect(cause).to.include({ source: 'storage', summary: 'Storage failed with ECONNRESET in 1 of 1 failures.' });
});
it('reads fast 429s as the app answering from its remembered limit state', () => {
const rows = [5, 7, 9, 180].map((ms, i) => fault({ requestId: rid(i), errorCode: 'github_rate_limit_exceeded', status: 429, severity: 'warn', ms }));
const cause = deriveCause(rows);
expect(cause).to.include({ source: 'limit', summary: '3 of 4 requests returned 429 in under 20 ms.' });
expect(cause.detail).to.include('without calling GitHub');
expect(deriveCause(rows.map(row => ({ ...row, ms: 900 }))).summary).to.include('rate limit');
});
it('points at our code with the first application frame', () => {
const cause = deriveCause([fault({ errorCode: undefined, errorType: 'TypeError', errorStack: 'at ZipStream.entry (build/core/zipStream.js:212:31)\nat next (build/core/zipStream.js:188:12)', causeType: 'RangeError' })]);
expect(cause).to.include({ source: 'code', summary: 'TypeError thrown at zipStream.js:212.', detail: 'Caused by RangeError.' });
});
it('says plainly when nothing is known', () => {
const cause = deriveCause([{ timestamp: at(1), service: 'api', event: 'application_log', severity: 'error', status: 500, errorCode: 'server_error' }]);
expect(cause.source).to.equal('unknown');
expect(cause.summary).to.match(/^No cause recorded/);
expect(deriveCause([fault({ ms: 4800 }), fault({ ms: 500 })]).summary).to.include('waited 500 ms – 4.8 s');
});
});
describe('repoId and userId filters', () => {
it('validates the query and rejects anything else', () => {
const ok = issueOptions({ window: '6h', service: 'api', repoId: 'repo-one', userId: USER, source: 'history' }, NOW);
expect(ok).to.include({ window: '6h', repoId: 'repo-one', userId: USER, source: 'history', end: at(0) });
expect(issueOptions({}, NOW)).to.include({ window: '24h', source: 'auto' });
for (const query of [{ repoId: 'a" OR *' }, { repoId: 'x' }, { userId: 'alice' }, { userId: [USER] }, { window: '7d' }, { source: 'central' }, { q: '*' }, { service: 'api OR *' }]) {
expect(() => issueOptions(query), JSON.stringify(query)).to.throw();
}
expect(() => logOptions({ repoId: 'repo-one', userId: USER })).not.to.throw();
expect(() => logOptions({ repoId: 'a"b' })).to.throw();
});
it('filters rows by repository, user and service', () => {
const rows = [fault({ repoId: 'repo-one' }), fault({ repoId: 'repo-two', userId: USER }), fault({ repoId: 'repo-one', service: 'streamer' })];
expect(filterRows(rows, { repoId: 'repo-one', userId: '', service: '' })).to.have.length(2);
expect(filterRows(rows, { repoId: '', userId: USER, service: '' })).to.have.length(1);
expect(filterRows(rows, { repoId: 'repo-one', userId: '', service: 'api' })).to.have.length(1);
});
describe('central queries', () => {
let saved, originalFetch, queries;
beforeEach(() => { saved = process.env.ADMIN_LOG_URL; originalFetch = global.fetch; queries = []; process.env.ADMIN_LOG_URL = 'http://logging.test'; });
afterEach(() => { global.fetch = originalFetch; if (saved === undefined) delete process.env.ADMIN_LOG_URL; else process.env.ADMIN_LOG_URL = saved; });
it('adds validated repoId and userId terms, counts noise and keeps it out of the fault query', async () => {
global.fetch = async (url, options) => {
const query = options.body.get('query'); queries.push(query);
if (query.includes('stats by (event)')) return new Response('{"event":"request_slow","n":"12"}\n{"event":"request_cancelled","n":"3"}\n');
if (query.includes('event:external_request (')) return new Response(JSON.stringify({ _time: at(1), event: 'external_request', severity: 'info', service: 'api', requestId: rid(1), upstreamHost: 'api.github.com', upstreamStatus: '502', upstreamMethod: 'GET' }) + '\n');
if (query.includes('severity:info')) return new Response('');
return new Response(JSON.stringify({ _time: at(1), ...fault({ requestId: rid(1), repoId: 'repo-one', userId: USER, viewer: 'owner' }), status: '502' }) + '\n');
};
const result = await issueRecords({ window: '24h', start: at(1440), end: at(0), service: 'api', repoId: 'repo-one', userId: USER });
expect(result.state).to.equal('ready');
expect(result.noise).to.deep.equal({ slow: 12, interrupted: 3 });
expect(result.external[0]).to.include({ event: 'external_request', upstreamHost: 'api.github.com', upstreamStatus: 502 });
// Filtered: external calls are looked up by the faults' request IDs, not the newest calls overall.
expect(queries.find(q => q.includes('event:external_request ('))).to.include(`requestId:in("${rid(1)}")`);
expect(result.faultLimitReached).to.equal(false);
const faults = queries.find(q => q.includes('severity:error'));
expect(faults).to.include('service:api repoId:"repo-one" userId:"' + USER + '"').and.include('NOT (event:request_slow OR event:request_cancelled)');
expect(result.records[0]).to.include({ repoId: 'repo-one', userId: USER, viewer: 'owner' });
const investigation = await investigateLogs(logOptions({ repoId: 'repo-one' }));
expect(investigation.state).to.not.equal('misconfigured');
expect(queries.at(-1) + queries.at(-2) + queries.at(-3)).to.include('repoId:"repo-one"');
});
it('reports disabled central logs without backend calls', async () => {
delete process.env.ADMIN_LOG_URL;
global.fetch = async () => { throw new Error('no call expected'); };
expect((await issueRecords({ window: '1h', start: at(60), end: at(0), service: '', repoId: '', userId: '' })).state).to.equal('disabled');
});
});
it('serves issues only to admins and validates filters on the route', async () => {
const express = require('express');
const utils = require('../src/server/routes/route-utils');
const previous = utils.getUser, savedUrl = process.env.ADMIN_LOG_URL;
delete process.env.ADMIN_LOG_URL;
utils.getUser = async req => ({ id: 'fixture', model: { id: 'fixture' }, isAdmin: req.headers['x-admin'] === 'yes' });
const app = express(); app.use((req, res, next) => { req.isAuthenticated = () => req.headers['x-login'] === 'yes'; next(); });
app.use('/api/admin', require('../src/server/routes/admin').default);
const server = app.listen(0, '127.0.0.1'); await new Promise(resolve => server.once('listening', resolve));
const address = `http://127.0.0.1:${server.address().port}/api/admin/errors/issues`;
const admin = { headers: { 'x-login': 'yes', 'x-admin': 'yes' } };
try {
expect((await fetch(address)).status).to.equal(401);
expect((await fetch(address, { headers: { 'x-login': 'yes' } })).status).to.equal(401);
expect((await fetch(address + '?repoId=a%22%20OR%20*', admin)).status).to.equal(400);
expect((await fetch(address + '?userId=alice', admin)).status).to.equal(400);
} finally {
utils.getUser = previous; if (savedUrl !== undefined) process.env.ADMIN_LOG_URL = savedUrl;
await new Promise(resolve => server.close(resolve));
}
});
});
});
+187 -332
View File
@@ -81,361 +81,216 @@ describe("Vue 3 UI", function () {
let ui;
afterEach(() => ui?.close());
it("renders useful history occurrences with visible times and selected tabs", async () => {
const entries=[0,2,1].map(n=>({ts:new Date(Date.UTC(2026,10,14,12,n)).toISOString(),level:'error',module:'route',message:'application_log',raw:[{event:'application_log',service:'api',httpStatus:500,...(n===2?{method:'GET',route:'/api/repo/:repoId/file/:path'}:{})}]}));
ui=await browser('/',{'/api/user':{username:'admin',isAdmin:true,status:'ready'},'/api/admin/errors':{available:true,total:3,entries},'/api/admin/errors/investigation':{state:'disabled',groups:[]}});
await ui.go('/admin/errors'); const doc=ui.window.document;
doc.querySelector('#error-source-history').click();await delay(20);
doc.querySelector('button.errors-row-main').click();await delay(20);
const tab=[...doc.querySelectorAll('.history-source .detail-tabs button')].find(b=>b.textContent.startsWith('Occurrences'));
tab.click();await delay(20);
expect(tab.getAttribute('aria-pressed')).equal('true');expect(tab.classList.contains('active')).equal(true);
const items=[...doc.querySelectorAll('.history-occurrence-list li')];expect(items).length(3);
expect(items.map(item=>item.querySelector('time').getAttribute('datetime'))).deep.equal([entries[1].ts,entries[2].ts,entries[0].ts]);
expect(items[0].textContent).include('GET /api/repo/:repoId/file/:path');
expect(items[1].textContent).include('Request route was not captured.').and.include('Exception frames were not captured.');
expect(items[0].querySelector('time').classList.contains('when-abs')).equal(false);
const record=items[0].querySelector('details');record.querySelector('summary').click();expect(record.open).equal(true);
expect(record.querySelector('.history-occurrence-record pre').textContent).include('application_log');expect(ui.errors).deep.equal([]);
});
it("shows normalized request routes and exception frames in both admin sources", async () => {
const now=new Date().toISOString(), requestId='aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa';
const sample={event:'application_log',service:'api',module:'route',severity:'error',httpStatus:500,method:'GET',route:'/api/repo/:repoId/file/:path',repoId:'demo-123',requestPath:'/api/repo/demo-123/file/docs/reproduce%20issue.md',errorType:'TypeError',errorStack:'at printError (build/server/routes/route-utils.js:200:7)',causeType:'RangeError',causeStack:'at <anonymous> (build/core/repository.js:410:9)',requestId};
ui=await browser('/',{
'/api/user':{username:'admin',isAdmin:true,status:'ready'},
'/api/admin/errors/investigation':{state:'ready',window:'1h',groups:[{fingerprint:'diagnostic',count:1,sample,first:now,last:now}]},
'/api/admin/errors/correlation':{state:'ready',events:[{...sample,timestamp:now}]},
'/api/admin/errors':{available:true,total:1,entries:[{ts:now,level:'error',module:'route',message:'TypeError',raw:[sample]}]},
});
await ui.go('/admin/errors');const doc=ui.window.document;
doc.querySelector('.log-event-button').click();await delay(30);
expect(doc.querySelector('#log-detail-title').textContent).equal('TypeError');
expect(doc.querySelector('.log-timeline .log-request-route').textContent).include('GET '+sample.requestPath);
expect(doc.querySelector('.log-reproduction').textContent).include('demo-123').and.include(sample.requestPath);
let copiedPath;Object.defineProperty(ui.window.navigator,'clipboard',{configurable:true,value:{writeText:async value=>{copiedPath=value;}}});
doc.querySelector('.log-reproduction button').click();await delay(10);expect(copiedPath).equal(sample.requestPath);
const frames=doc.querySelector('.log-timeline .log-error-stack');expect(frames.open).equal(false);
frames.querySelector('summary').click();expect(frames.open).equal(true);
expect(frames.textContent).include(sample.errorStack).and.include('RangeError').and.include(sample.causeStack);
doc.querySelector('#error-source-history').click();await delay(20);
doc.querySelector('button.errors-row-main').click();await delay(20);
expect(doc.querySelector('.history-source .log-request-route').textContent).include(sample.route);
[...doc.querySelectorAll('.history-source .detail-tabs button')].find(b=>b.textContent==='Stack').click();await delay(20);
expect(doc.querySelector('.stack-pre').textContent).include(sample.errorStack).and.include(sample.causeStack);
expect(ui.errors).deep.equal([]);
});
it("investigates grouped admin logs with bounded filters and a safe correlated timeline", async () => {
const requestId = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
// ---- Admin › Errors: one list of issues, issue page, request view ----
const ERR_REQ = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
const errIssue = (extra = {}) => {
const now = new Date().toISOString();
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors": {entries:[],available:true,redisCollecting:false,total:0},
"/api/admin/errors/investigation": {state:"partial",window:"1h",start:now,end:now,captured:3,groups:[{fingerprint:"fixture",count:3,first:now,last:now,sample:{service:"worker",release:"abcdef1",event:"job_failed",severity:"error",module:"queue",errorCode:"<img src=x onerror=evil>",requestId}}],telemetry:{missing:["streamers"],partial:true,instances:[],collector:{state:"unreachable",dropped:null}}},
"/api/admin/errors/correlation": {state:"ready",start:now,end:now,events:[{timestamp:now,service:"api",event:"request_completed",requestId},{timestamp:now,service:"worker",event:"job_failed",requestId,ms:25}]},
});
return { id: "issue-1", title: "GitHub returned an error", code: "upstream_error", errorCode: "upstream_error", status: 502, service: "api", route: "/api/repo/:repoId/file/:path", method: "GET",
count: 3, requests: 3, jobs: 0, repoCount: 1, repos: [{ id: "repo-one", count: 3, last: now }], userCount: 1, users: [{ id: "65f0c0de0000000000000001", count: 1, last: now }],
viewers: { signedIn: 1, visitors: 2, anonymous: 0, notRecorded: 0 }, first: now, last: now, firstRelease: "abcdef1", newInRelease: null, failingNow: true, trend: [0, 1, 2],
routeCount: 2, routes: [{ route: "/api/repo/:repoId/file/:path", method: "GET", count: 2, last: now }, { route: "/api/repo/:repoId/zip", method: "GET", count: 1, last: now }], routeKnown: 3,
cause: { source: "github", label: "GitHub", summary: "GitHub answered 502 on GET /repos/{owner}/{repo}/contents/* in 3 of 3 failures.", detail: "", evidence: [] },
occurrences: [{ timestamp: now, requestId: ERR_REQ, repoId: "repo-one", viewer: "visitor", requestPath: "/api/repo/repo-one/file/a.py", method: "GET", route: "/api/repo/:repoId/file/:path", status: 502, service: "api" },
{ timestamp: now, repoId: "repo-one", viewer: "owner", userId: "65f0c0de0000000000000001", status: 502, service: "api" }],
sample: { timestamp: now, service: "api", errorCode: "upstream_error", status: 502, requestId: ERR_REQ }, ...extra };
};
const errData = (extra = {}) => ({ source: "central", state: "ready", centralState: "ready", window: "24h", start: new Date(Date.now() - 86400000).toISOString(), end: new Date().toISOString(),
filters: { service: "", repoId: "", userId: "" }, captured: 9, redisCollecting: true, issues: [errIssue()],
expected: { count: 4, groups: [{ code: "file_not_found", status: 404, count: 4, last: new Date().toISOString() }] }, excluded: { slow: 7, interrupted: 2 },
summary: { issues: 1, failingNow: 1, failedRecords: 3, repositories: 1, users: 1, upstreamShare: 100 },
names: { repos: { "repo-one": { ownerId: "65f0c0de0000000000000001", owner: "alice", source: "alice/private-source" } }, users: { "65f0c0de0000000000000001": "alice" } }, ...extra });
const admin = { username: "admin", isAdmin: true, status: "ready" };
it("lists issues with impact, cause and the noise kept out, without rendering markup", async () => {
const evil = errIssue({ id: "evil", title: "<img src=x onerror=evil>", code: "<img src=x onerror=evil>", failingNow: false });
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": errData({ issues: [errIssue(), evil] }) });
await ui.go("/admin/errors");
const doc = ui.window.document;
expect(doc.body.textContent).to.include("Partial results").and.include("Collection is off").and.include("dropped events since collector start: unknown");
expect(doc.querySelector(".log-table img")).to.equal(null);
doc.querySelector(".log-event-button").click(); await delay(20);
await delay(50);
expect(doc.querySelectorAll(".log-events li")).to.have.length(2);
expect(doc.activeElement.id).to.equal("log-detail-title");
expect(ui.requests.filter(r=>r.url.pathname==="/api/admin/errors/correlation")).to.have.length(1);
const request = ui.requests.find(r=>r.url.pathname==="/api/admin/errors/correlation");
expect(request.url.searchParams.get("id")).to.equal(requestId);
expect(request.url.searchParams.get("kind")).to.equal("requestId");
await ui.input("#log-service","worker","change");
await ui.input("#log-window","6h","change");
doc.querySelector(".log-filters").dispatchEvent(new ui.window.Event("submit",{bubbles:true,cancelable:true})); await delay(40);
const last = ui.requests.filter(r=>r.url.pathname==="/api/admin/errors/investigation").at(-1);
expect(last.url.searchParams.get("service")).to.equal("worker"); expect(last.url.searchParams.get("window")).to.equal("6h");
const rows = doc.querySelectorAll(".errs-row:not(.errs-row-skeleton)");
expect(rows).to.have.length(2);
expect(doc.querySelector(".errs-table img")).to.equal(null);
expect(rows[0].querySelector("a.errs-title").getAttribute("href")).to.equal("/admin/errors?issue=issue-1");
expect(rows[0].querySelector(".errs-more-routes").textContent).to.equal("+1 route");
expect(rows[0].textContent).to.include("GitHub returned an error").and.include("502").and.include("Cause: GitHub").and.include("1 repository").and.include("Now");
expect(doc.querySelector(".errs-summary").textContent).to.include("100%").and.include("failing now (last 15 min)");
expect(doc.querySelector(".errs-source").textContent).to.include("From central logs · last 24 h");
expect(doc.querySelector(".errs-noise").textContent).to.include("9").and.include("slow or interrupted");
expect(doc.querySelector(".errs-noise a").getAttribute("href")).to.equal("/admin/#performance");
expect(doc.querySelector(".errs-expected").open).to.equal(false);
expect(doc.querySelector(".errs-expected").textContent).to.include("file_not_found");
expect(doc.body.textContent).not.to.include("private-source/");
const request = ui.requests.find(r => r.url.pathname === "/api/admin/errors/issues");
expect(request.url.searchParams.get("window")).to.equal("24h");
await ui.input("#errs-search", "upstream");
expect(doc.querySelectorAll(".errs-row")).to.have.length(1);
await ui.input("#errs-search", "nothing-like-this");
expect(doc.querySelector(".errs-list").textContent).to.include("No issue matches");
expect(ui.errors).to.deep.equal([]);
});
it("filters returned groups without hiding edge 5xx and restores investigation focus", async () => {
const requestId = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
const now = new Date().toISOString();
const historySample = {requestId, jobId:"bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb", service:"worker", event:"job_failed", severity:"error", status:502};
const historyEntry = {ts:now,level:"error",module:"queue",message:"history_only",raw:[historySample]};
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors": {entries:[historyEntry],available:true,total:1},
"/api/admin/errors/investigation": {state:"ready",window:"1h",captured:12,end:now,groups:[
{fingerprint:"edge",count:9,last:now,first:now,sample:{event:"http_access",service:"nginx",severity:"info",status:504,requestId}},
{fingerprint:"warn",count:3,last:now,first:now,sample:{event:"retry",service:"worker",severity:"warn"}},
]},
"/api/admin/errors/correlation": {state:"empty",events:[]},
});
it("sends repo: and user: searches and the window to the server as validated filters", async () => {
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": request => errData({ filters: { service: "", repoId: request.url.searchParams.get("repoId") || "", userId: request.url.searchParams.get("userId") || "" } }) });
await ui.go("/admin/errors");
const doc = ui.window.document;
expect(doc.querySelector('.history-source').style.display).to.equal('none');
await ui.input('.log-local-filters select', 'error', 'change');
expect(doc.querySelectorAll('.log-table tbody tr')).to.have.length(1);
expect(doc.querySelector('.log-table').textContent).to.include('http_access').and.include('Failure');
expect(doc.querySelector('.log-local-filters + p').textContent).to.include('1 of 2 returned groups');
await ui.input('.log-search input', 'absent');
expect(doc.querySelector('.log-results').textContent).to.include('No returned groups match');
doc.querySelector('.log-results button').click(); await delay(30);
const detail = doc.querySelector('.log-event-button'); detail.focus(); detail.click(); await delay(30);
expect(doc.activeElement.id).to.equal('log-detail-title');
expect(doc.querySelector('.log-detail').textContent).to.include(requestId).and.include('info');
expect(doc.querySelector('.log-list-view').style.display).to.equal('none');
expect(doc.querySelector('#log-detail-title').textContent).to.equal('http_access');
expect(doc.querySelector('.log-sample-panel').textContent).to.include('http_access').and.include('nginx');
expect(doc.querySelector('#trace-selector-requestId').getAttribute('aria-pressed')).to.equal('true');
const identifier = doc.querySelector('.log-detail .log-value-reveal');
expect(identifier.open).to.equal(false);
expect(identifier.querySelector('summary').textContent).not.to.include(requestId);
expect(identifier.querySelector('span').textContent).to.equal(requestId);
let copiedIdentifier;
Object.defineProperty(ui.window.navigator, 'clipboard', {configurable:true,value:{writeText:async value => { copiedIdentifier = value; }}});
doc.querySelector('.log-detail .log-copy-value').click(); await delay(30);
expect(copiedIdentifier).to.equal(requestId);
expect(doc.querySelector(".log-table").textContent).not.to.include("aaaaaaaa");
doc.querySelector('.log-back').click(); await delay(30);
expect(doc.activeElement).to.equal(detail);
expect(doc.querySelector('.log-list-view').style.display).not.to.equal('none');
detail.click(); await delay(30);
const trigger = doc.querySelector('.log-trace-button'); trigger.focus(); trigger.click(); await delay(30);
expect(doc.activeElement.id).to.equal('log-timeline-title');
expect(doc.querySelector('#log-timeline-title').textContent).to.equal('Related events');
doc.querySelector('.log-timeline button').click(); await delay(30);
expect(doc.activeElement).to.equal(trigger);
doc.querySelector('#error-source-history').click(); await delay(30);
const row = doc.querySelector('button.errors-row-main');
expect(row.getAttribute('aria-expanded')).to.equal('false'); row.click(); await delay(30);
expect(row.getAttribute('aria-expanded')).to.equal('true');
expect(doc.getElementById(row.getAttribute('aria-controls'))).not.to.equal(null);
expect(doc.querySelector('.history-fields')).not.to.equal(null);
expect(doc.querySelector('.detail-main pre')).to.equal(null);
[...doc.querySelectorAll('.detail-tabs button')].find(button => button.textContent === 'Raw').click(); await delay(30);
expect(JSON.parse(doc.querySelector('.detail-main pre').textContent)).to.deep.equal(historyEntry);
[...doc.querySelectorAll('.detail-actions button')].find(button => button.textContent.includes('Copy JSON')).click(); await delay(30);
expect(JSON.parse(copiedIdentifier)).to.deep.equal(historyEntry);
expect(doc.querySelector('.history-management').open).to.equal(false);
expect(ui.requests.filter(r=>r.url.pathname==='/api/admin/errors/investigation')).to.have.length(1);
await ui.input("#errs-search", "repo:repo-one user:65f0c0de0000000000000001 upstream"); await delay(400);
const last = () => ui.requests.filter(r => r.url.pathname === "/api/admin/errors/issues").at(-1);
expect(last().url.searchParams.get("repoId")).to.equal("repo-one");
expect(last().url.searchParams.get("userId")).to.equal("65f0c0de0000000000000001");
expect(doc.querySelector(".errs-search-hint").textContent).to.include("repository repo-one").and.include("alice");
await ui.input("#errs-search", "user:alice"); await delay(400);
expect(doc.querySelector(".errs-search-hint").textContent).to.include("not a repository ID or a 24-character user ID");
expect(last().url.searchParams.get("userId")).to.equal(null);
await ui.input("#errs-window", "6h", "change"); await delay(40);
expect(last().url.searchParams.get("window")).to.equal("6h");
expect(ui.errors).to.deep.equal([]);
});
it("ignores superseded central requests and closed timeline responses", async () => {
it("opens an issue from its link, moves focus to the heading and back to the row", async () => {
const many = errIssue();
many.occurrences = Array.from({ length: 12 }, (_, i) => ({ ...many.occurrences[0], timestamp: new Date(Date.now() - i * 60000).toISOString() }));
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": errData({ issues: [many] }) });
await ui.go("/admin/errors");
const doc = ui.window.document;
doc.querySelector("a.errs-title").click(); await delay(60);
const routes = [...doc.querySelectorAll(".errs-routes li")];
expect(routes.map(li => [li.querySelector("code").textContent, li.querySelector(".errs-num").textContent])).to.deep.equal([["GET /api/repo/:repoId/file/:path", "2 failures"], ["GET /api/repo/:repoId/zip", "1 failures"]]);
expect(doc.querySelectorAll(".errs-occurrences li")).to.have.length(10);
doc.querySelector(".errs-show-all").click(); await delay(20);
expect(doc.querySelectorAll(".errs-occurrences li")).to.have.length(12);
expect(doc.querySelector(".errs-show-all")).to.equal(null);
expect(ui.window.location.search).to.equal("?issue=issue-1");
expect(doc.activeElement.id).to.equal("errs-detail-title");
expect(doc.activeElement.textContent).to.equal("GitHub returned an error");
expect(doc.querySelector(".errs-cause").textContent).to.include("Likely cause: GitHub").and.include("in 3 of 3 failures");
const repoLink = doc.querySelector(".errs-repos a[href='/admin/repositories?search=repo-one']");
expect(repoLink).to.not.equal(null);
expect(doc.querySelector(".errs-repos a[href='/admin/users/id:65f0c0de0000000000000001']").textContent).to.equal("@alice");
expect(doc.querySelector(".errs-who").textContent).to.include("1 by owners, coauthors or admins").and.include("2 by signed-in visitors").and.include("0 not signed in");
expect(doc.querySelector(".errs-list").style.display).to.equal("none");
[...doc.querySelectorAll(".errs-detail a.btn")].find(a => a.textContent.includes("All errors")).click(); await delay(60);
expect(doc.activeElement.getAttribute("data-issue-link")).to.equal("issue-1");
expect(ui.errors).to.deep.equal([]);
});
it("shows one occurrence as a request waterfall with keyboard-operable tabs and not-recorded placeholders", async () => {
const now = Date.now(), iso = ms => new Date(now - ms).toISOString();
ui = await browser("/", {
"/api/user": admin, "/api/admin/errors/issues": errData(),
"/api/admin/errors/correlation": { state: "ready", events: [
{ timestamp: iso(0), service: "nginx", event: "edge_request", status: 502, ms: 2400, requestId: ERR_REQ },
{ timestamp: iso(900), service: "api", event: "external_request", upstreamHost: "api.github.com", upstreamMethod: "GET", upstreamEndpoint: "/repos/{owner}/{repo}/contents/*", upstreamStatus: 502, ms: 600, requestId: ERR_REQ },
{ timestamp: iso(5), service: "api", event: "application_log", errorCode: "upstream_error", status: 502, requestId: ERR_REQ, errorType: "AnonymousError", errorStack: "at get (build/core/source/GitHubStream.js:10:2)" },
] },
});
await ui.go("/admin/errors?issue=issue-1&occurrence=0"); await delay(60);
const doc = ui.window.document;
const trace = ui.requests.find(r => r.url.pathname === "/api/admin/errors/correlation");
expect(trace.url.searchParams.get("kind")).to.equal("requestId");
expect(trace.url.searchParams.get("id")).to.equal(ERR_REQ);
expect(trace.url.searchParams.get("window")).to.equal("24h");
expect(doc.querySelector("#errs-detail-title").textContent).to.equal("GET /api/repo/repo-one/file/a.py");
expect(doc.querySelector(".errs-chips").textContent).to.include("Viewer: signed-in visitor").and.include("repo-one").and.include("@alice");
const steps = [...doc.querySelectorAll(".errs-waterfall li")];
expect(steps.map(li => li.querySelector("strong").textContent)).to.deep.equal(["edge request", "GitHub · GET", "upstream_error"]);
expect(steps[1].classList.contains("k-external")).to.equal(true);
expect(steps[2].classList.contains("is-failure")).to.equal(true);
const step = steps[2].querySelector("button");
expect(step.getAttribute("aria-expanded")).to.equal("false");
step.click(); await delay(20);
expect(doc.querySelector(".errs-step-detail").textContent).to.include("GitHubStream.js:10");
const tab = doc.querySelector("#errs-tab-timeline");
expect(tab.getAttribute("aria-selected")).to.equal("true");
tab.dispatchEvent(new ui.window.KeyboardEvent("keydown", { key: "ArrowRight", bubbles: true })); await delay(30);
expect(doc.activeElement.id).to.equal("errs-tab-request");
expect(doc.querySelector("#errs-panel-request").textContent).to.include("excluded: query strings are never logged").and.include("/api/repo/repo-one/file/a.py");
doc.querySelector("#errs-tab-exception").click(); await delay(20);
expect(doc.querySelector("#errs-panel-exception").textContent).to.include("AnonymousError");
doc.querySelector("#errs-tab-fields").click(); await delay(20);
let copied; Object.defineProperty(ui.window.navigator, "clipboard", { configurable: true, value: { writeText: async value => { copied = value; } } });
doc.querySelector("#errs-panel-fields button").click(); await delay(20);
expect(JSON.parse(copied)).to.include({ errorCode: "upstream_error", requestId: ERR_REQ });
// The second occurrence has no request ID, path or exception: quiet placeholders, no lookup.
[...doc.querySelectorAll(".errs-pager a")].find(a => a.textContent === "Older").click(); await delay(60);
expect(ui.requests.filter(r => r.url.pathname === "/api/admin/errors/correlation")).to.have.length(1);
doc.querySelector("#errs-tab-timeline").click(); await delay(20);
expect(doc.querySelector("#errs-panel-timeline").textContent).to.include("no request or job ID");
doc.querySelector("#errs-tab-request").click(); await delay(20);
expect(doc.querySelectorAll("#errs-panel-request .errs-placeholder").length).to.be.greaterThan(2);
expect(doc.querySelector(".errs-chips").textContent).to.include("Viewer: owner");
expect(doc.querySelectorAll(".errs-chips a[href='/admin/users/id:65f0c0de0000000000000001']")).to.have.length(1);
expect(ui.errors).to.deep.equal([]);
});
it("falls back to the application history and lets the admin choose it", async () => {
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": request => errData(request.url.searchParams.get("source") === "history"
? { source: "history", centralState: "skipped" } : { source: "history", centralState: "unreachable" }) });
await ui.go("/admin/errors");
const doc = ui.window.document;
expect(doc.querySelector(".errs-source").textContent).to.include("From application history (Redis)").and.include("Central logs did not answer");
doc.querySelector("details.errs-settings").open = true;
[...doc.querySelectorAll(".errs-settings .seg-chip")].find(b => b.textContent.includes("history only")).click(); await delay(40);
expect(ui.requests.filter(r => r.url.pathname === "/api/admin/errors/issues").at(-1).url.searchParams.get("source")).to.equal("history");
expect(doc.querySelector(".errs-source").textContent).to.include("not used while this switch is on");
expect(ui.errors).to.deep.equal([]);
});
it("ignores superseded list responses and timelines that arrive after leaving the request", async () => {
const pending = [], traces = [];
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors/investigation": () => new Promise(resolve => pending.push(resolve)),
"/api/admin/errors/correlation": () => new Promise(resolve => traces.push(resolve)),
});
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": () => new Promise(resolve => pending.push(resolve)), "/api/admin/errors/correlation": () => new Promise(resolve => traces.push(resolve)) });
await ui.go("/admin/errors");
const doc = ui.window.document;
doc.querySelector('.log-filters').dispatchEvent(new ui.window.Event('submit', {bubbles:true,cancelable:true}));
await delay(20);
const sample = {event:'latest_event',severity:'error',requestId:'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa'};
pending[1]({state:'ready',groups:[{fingerprint:'latest',sample,count:1}]}); await delay(30);
pending[0]({state:'disabled',groups:[]}); await delay(30);
expect(doc.querySelector('.log-results').textContent).to.include('latest_event');
doc.querySelector('.log-event-button').click(); await delay(20);
expect(doc.querySelector(".errs-list").getAttribute("aria-busy")).to.equal("true");
expect(doc.querySelectorAll(".errs-row-skeleton").length).to.be.greaterThan(0);
await ui.input("#errs-window", "1h", "change"); await delay(30);
pending[1](errData({ window: "1h", issues: [errIssue({ title: "latest_issue" })] })); await delay(30);
pending[0](errData({ issues: [errIssue({ title: "obsolete_issue" })] })); await delay(30);
expect(doc.querySelector(".errs-table").textContent).to.include("latest_issue").and.not.include("obsolete_issue");
await ui.go("/admin/errors?issue=issue-1&occurrence=0"); await delay(30);
expect(traces).to.have.length(1);
doc.querySelector('.log-timeline button').click(); await delay(30);
traces[0]({state:'ready',events:[{event:'late_event'}]}); await delay(30);
expect(doc.querySelector('.log-timeline')).to.equal(null);
await ui.go("/admin/errors?issue=issue-1"); await delay(30);
traces[0]({ state: "ready", events: [{ timestamp: new Date().toISOString(), event: "late_event" }] }); await delay(30);
await ui.go("/admin/errors?issue=issue-1&occurrence=1"); await delay(30);
expect(doc.body.textContent).not.to.include("late_event");
expect(ui.errors).to.deep.equal([]);
});
it("automatically follows one sample ID and isolates late events across inspectors", async () => {
const requestId = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa", jobId = "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb";
const traces = [];
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors/investigation": {state:"ready",window:"6h",groups:[
{fingerprint:"both",count:1,sample:{event:"both_ids",requestId,jobId,severity:"error"}},
{fingerprint:"job",count:1,sample:{event:"job_only",jobId,severity:"error"}},
{fingerprint:"none",count:1,sample:{event:"no_id",service:"nginx",status:504,severity:"info"}},
]},
"/api/admin/errors/correlation": request => new Promise(resolve => traces.push({request,resolve})),
});
await ui.go('/admin/errors');
const doc=ui.window.document, open=index=>doc.querySelectorAll('.log-event-button')[index].click();
open(0); await delay(30);
expect(traces).to.have.length(1);
expect(traces[0].request.url.searchParams.get('kind')).to.equal('requestId');
expect(traces[0].request.url.searchParams.get('id')).to.equal(requestId);
expect(traces[0].request.url.searchParams.get('window')).to.equal('6h');
doc.querySelector('.log-all-fields summary').click();
doc.querySelector('.log-value-reveal summary').click(); await delay(30);
expect(traces).to.have.length(1); // Native disclosure must never trigger another lookup.
doc.querySelector('.log-back').click(); await delay(20);
open(1); await delay(30);
expect(traces).to.have.length(2);
expect(traces[1].request.url.searchParams.get('kind')).to.equal('jobId');
expect(traces[1].request.url.searchParams.get('id')).to.equal(jobId);
traces[1].resolve({state:'ready',events:[{event:'current_job_event'}]}); await delay(30);
traces[0].resolve({state:'ready',events:[{event:'obsolete_request_event'}]}); await delay(30);
expect(doc.querySelector('.log-events').textContent).to.include('current_job_event').and.not.include('obsolete_request_event');
doc.querySelector('.log-back').click(); await delay(20);
open(2); await delay(30);
expect(traces).to.have.length(2);
expect(doc.querySelector('.log-no-trace').textContent).to.include('no correlation ID').and.include('HTTP 504').and.include('recorded');
expect(doc.querySelector('.log-sample-panel').textContent).to.include('nginx');
expect(doc.querySelector('.log-timeline')).to.equal(null);
doc.querySelector('.log-back').click(); await delay(20);
open(0); await delay(30);
doc.querySelector('#error-source-history').click(); await delay(20);
traces[2].resolve({state:'ready',events:[{event:'obsolete_source_event'}]}); await delay(30);
expect(doc.querySelector('.log-inspector')).to.equal(null);
expect(doc.querySelector('.log-events')).to.equal(null);
expect(ui.errors).to.deep.equal([]);
});
it("keeps Redis history usable when admin central lookup is disabled or unreachable", async () => {
let state = "disabled";
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors": {entries:[{ts:new Date().toISOString(),level:"error",module:"queue",message:"upstream_error",raw:[{code:"upstream_error",status:502}]}],available:true,redisCollecting:true,total:1},
"/api/admin/errors/investigation": () => ({state,groups:[]}),
});
await ui.go("/admin/errors");
expect(ui.window.document.body.textContent).to.include("Central lookup is not configured").and.include("upstream_error");
state = "unreachable";
ui.window.document.querySelector(".log-filters").dispatchEvent(new ui.window.Event("submit",{bubbles:true,cancelable:true})); await delay(40);
expect(ui.window.document.body.textContent).to.include("Central logging is unreachable");
ui.window.document.querySelector('#error-source-history').click(); await delay(30);
expect(ui.window.document.querySelector('.log-state').textContent).to.include("Redis history is reachable");
expect(ui.window.document.querySelector('.error-health-strip button').textContent).to.equal("Refresh history");
expect(ui.errors).to.deep.equal([]);
});
it("loads older safe Redis records when a whole page was rejected", async () => {
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors/investigation": {state:"disabled",groups:[]},
"/api/admin/errors": request => request.url.searchParams.get("offset") === "250" || Number(request.url.searchParams.get("limit")) >= 251
? {entries:[{ts:new Date().toISOString(),level:"error",module:"queue",message:"upstream_error",raw:[{code:"upstream_error",status:502}]}],available:true,total:251,nextOffset:251}
: {entries:[],available:true,total:251,nextOffset:250,redactedEntries:250},
});
await ui.go("/admin/errors");
const button=ui.window.document.querySelector(".errors-pager button");
expect(button).not.to.equal(null); button.click(); await delay(40);
expect(ui.window.document.body.textContent).to.include("upstream_error").and.include("invalid legacy records were omitted");
ui.window.document.querySelector('#error-source-history').click(); await delay(30);
ui.window.document.querySelector('.error-health-strip button').click(); await delay(40);
expect(ui.requests.filter(r => r.url.pathname === "/api/admin/errors").at(-1).url.searchParams.get("limit")).to.equal("251");
expect(ui.window.document.body.textContent).to.include("upstream_error");
expect(ui.errors).to.deep.equal([]);
});
it("preserves inspector list filters and clears details on source change and refresh", async () => {
const now = new Date().toISOString(), requestId = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
const row = {ts:now,level:"error",module:"queue",message:"history_failure",raw:[{requestId,status:502}]};
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors": {entries:[row],available:true,total:1},
"/api/admin/errors/investigation": {state:"ready",groups:[{fingerprint:"one",sample:{event:"job_failed",errorCode:"fixture_failure",severity:"error",requestId},count:2,first:now,last:now}]},
"/api/admin/errors/correlation": {state:"empty",events:[]},
});
await ui.go('/admin/errors');
const doc=ui.window.document;
await ui.input('.log-search input','fixture');
const open=doc.querySelector('.log-event-button'); open.click(); await delay(20);
expect(doc.querySelector('.log-list-view').style.display).to.equal('none');
expect(doc.querySelector('.log-all-fields').open).to.equal(false);
doc.querySelector('.log-back').click(); await delay(20);
expect(doc.activeElement).to.equal(open);
expect(doc.querySelector('.log-search input').value).to.equal('fixture');
open.click(); await delay(20);
doc.querySelector('#error-source-history').click(); await delay(20);
expect(doc.querySelector('.log-inspector')).to.equal(null);
doc.querySelector('button.errors-row-main').click(); await delay(20);
expect(doc.activeElement.id).to.equal('history-inspector-title');
doc.querySelector('.history-source .log-back').click(); await delay(20);
expect(doc.activeElement.matches('button.errors-row-main')).to.equal(true);
doc.querySelector('button.errors-row-main').click(); await delay(20);
doc.querySelector('.error-health-strip button').click(); await delay(30);
expect(doc.querySelector('#history-inspector-title')).to.equal(null);
doc.querySelector('#error-source-central').click(); await delay(20);
doc.querySelector('.log-event-button').click(); await delay(20);
doc.querySelector('.error-health-strip button').click(); await delay(30);
expect(doc.querySelector('#log-detail-title')).to.equal(null);
expect(ui.errors).to.deep.equal([]);
});
it("lets slow Redis history finish across polls and protects pending older pages", async () => {
const pending = [], polls = [];
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors": request => new Promise(resolve => pending.push({request,resolve})),
"/api/admin/errors/investigation": {state:"disabled",groups:[]},
});
const nativeInterval = ui.window.setInterval.bind(ui.window);
ui.window.setInterval = (callback, ms) => ms === 15000 ? (polls.push(callback), -polls.length) : nativeInterval(callback, ms);
it("shows offline and empty states and loads diagnostics only when opened", async () => {
let fail = true;
ui = await browser("/", { "/api/user": admin,
"/api/admin/errors/issues": () => fail ? { __status: 503, body: {} } : errData({ issues: [], expected: { count: 0, groups: [] }, excluded: { slow: 0, interrupted: 0 }, redisCollecting: false, summary: { issues: 0, failingNow: 0, failedRecords: 0, repositories: 0, users: 0, upstreamShare: 0 } }),
"/api/admin/errors/stats": { available: true, last24h: 7, severity: { error: 1, warn: 6, info: 0 }, buckets: [{ hour: Date.now(), error: 1, warn: 6, info: 0 }], dropped: 0 },
"/api/admin/errors/investigation": { state: "stale", telemetry: { missing: ["streamers"], instances: [], collector: { state: "unreachable", dropped: null } } } });
await ui.go("/admin/errors");
const doc = ui.window.document;
doc.querySelector('#error-source-history').click(); await delay(10);
const poll = async () => { polls.forEach(callback => callback()); await delay(20); };
expect(polls).to.have.length(2); // History polling and central snapshot freshness.
await poll(); await poll(); await poll(); // 15s, 30s, 45s, while request is pending.
expect(pending).to.have.length(1);
expect(doc.querySelector('.error-health-strip button').disabled).to.equal(true);
expect(ui.requests.filter(r=>r.url.pathname==='/api/admin/errors/stats')).to.have.length(4);
const entry = message => ({ts:new Date().toISOString(),level:"error",module:"queue",message,raw:[{status:502}]});
pending[0].resolve({entries:[entry('slow_success')],available:true,total:251,nextOffset:250}); await delay(30);
expect(doc.querySelector('.history-source').textContent).to.include('slow_success');
expect(doc.querySelector('.error-health-strip button').disabled).to.equal(false);
await poll();
expect(pending).to.have.length(2);
pending[1].resolve({entries:[entry('next_poll_success')],available:true,total:251,nextOffset:250}); await delay(30);
doc.querySelector('.errors-pager button').click(); await delay(20);
expect(pending[2].request.url.searchParams.get('offset')).to.equal('250');
await poll(); await poll();
expect(pending).to.have.length(3);
pending[2].resolve({entries:[entry('older_success')],available:true,total:251,nextOffset:251}); await delay(30);
expect(doc.querySelector('.history-source').textContent).to.include('next_poll_success').and.include('older_success');
await poll();
expect(pending).to.have.length(4);
expect(pending[3].request.url.searchParams.get('limit')).to.equal('251');
await ui.go('/');
pending[3].resolve({entries:[entry('disposed_response')],available:true,total:1}); await delay(30);
expect(doc.body.textContent).not.to.include('disposed_response');
expect(doc.querySelector(".errs-state-error").textContent).to.include("Could not load errors");
expect(ui.requests.some(r => r.url.pathname === "/api/admin/errors/stats")).to.equal(false);
fail = false;
doc.querySelector(".errs-state-error button").click(); await delay(40);
expect(doc.querySelector(".errs-state-empty").textContent).to.include("No errors in the last 24 h");
const settings = doc.querySelector("details.errs-settings");
settings.open = true; settings.dispatchEvent(new ui.window.Event("toggle")); await delay(40);
expect(settings.textContent).to.include("Collection is off").and.include("Missing or stale: streamers").and.include("dropped events since collector start: unknown");
expect(settings.querySelector(".errs-counters").textContent).to.include("7");
expect(ui.errors).to.deep.equal([]);
});
it("lets slow statistics finish independently and discover older history failures", async () => {
const pending = [], polls = [];
const entry = (message,status) => ({ts:new Date().toISOString(),level:status>=500?"error":"warn",module:"queue",message,raw:[{status}]});
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors/investigation": {state:"disabled",groups:[]},
"/api/admin/errors/stats": () => new Promise(resolve=>pending.push(resolve)),
"/api/admin/errors": request => ({entries:[entry(request.url.searchParams.get('offset')==='250'?'older_failure':'recent_warning',request.url.searchParams.get('offset')==='250'?502:400)],available:true,total:251,nextOffset:request.url.searchParams.get('offset')==='250'?251:250}),
});
const nativeInterval=ui.window.setInterval.bind(ui.window);
ui.window.setInterval=(callback,ms)=>ms===15000?(polls.push(callback),-polls.length):nativeInterval(callback,ms);
await ui.go('/admin/errors');
const poll=async()=>{polls.forEach(callback=>callback());await delay(25);};
await poll();await poll();await poll();
expect(pending).to.have.length(1);
expect(ui.requests.filter(r=>r.url.pathname==='/api/admin/errors')).to.have.length(4);
pending[0]({available:true,last24h:7,severity:{error:1,warn:6,info:0}});await delay(40);
expect(ui.window.document.querySelector('.history-source').textContent).to.include('older_failure');
expect(ui.window.document.querySelector('.kpi-value').textContent).to.equal('7');
await poll();
expect(pending).to.have.length(2);
pending[1]({__status:503,body:{}});await delay(25);
expect(ui.window.document.querySelector('.history-management').textContent).to.include('Redis counters are unavailable');
await poll();expect(pending).to.have.length(3);
pending[2]({available:true,last24h:9,severity:{error:1,warn:8,info:0}});await delay(30);
expect(ui.window.document.querySelector('.kpi-value').textContent).to.equal('9');
expect(ui.errors).to.deep.equal([]);
});
it("marks an old central health snapshot stale without claiming current health", async () => {
ui = await browser("/", {
"/api/user": {username:"admin",isAdmin:true,status:"ready"},
"/api/admin/errors/investigation": {state:"ready",end:new Date(Date.now()-120000).toISOString(),groups:[]},
});
await ui.go("/admin/errors");
expect(ui.window.document.querySelector(".log-state").textContent).to.include("snapshot is stale");
it("shows a repository's and a user's issues on their admin pages", async () => {
const issues = request => errData({ filters: { service: "", repoId: request.url.searchParams.get("repoId") || "", userId: request.url.searchParams.get("userId") || "" } });
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": issues,
"/api/admin/repos": { total: 1, results: [{ repoId: "repo-one", status: "ready", source: { repositoryName: "alice/repo" }, options: {} }], statusCounts: [] } });
await ui.go("/admin/repositories?search=repo-one"); await delay(60);
const doc = ui.window.document;
const req = ui.requests.filter(r => r.url.pathname === "/api/admin/errors/issues").at(-1);
expect(req.url.searchParams.get("repoId")).to.equal("repo-one");
expect(doc.querySelector(".errs-entity-banner").textContent).to.include("Failing now").and.include("GitHub returned an error");
expect(doc.querySelector(".errs-entity-list a").getAttribute("href")).to.equal("/admin/errors?issue=issue-1");
expect(doc.querySelector(".errs-entity-list").textContent).to.include("file_not_found").and.include("expected");
ui.close();
ui = await browser("/", { "/api/user": admin, "/api/admin/errors/issues": issues, "/api/admin/users/alice": { _id: "65f0c0de0000000000000001", username: "alice", status: "active", repositories: [] } });
await ui.go("/admin/users/alice"); await delay(60);
const userReq = ui.requests.filter(r => r.url.pathname === "/api/admin/errors/issues").at(-1);
expect(userReq.url.searchParams.get("userId")).to.equal("65f0c0de0000000000000001");
expect(ui.window.document.querySelector(".errs-entity").textContent).to.include("GitHub returned an error");
expect(ui.errors).to.deep.equal([]);
});