@preventive/triage 1.0.0-alpha.73 → 1.0.0-alpha.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/bundle-compare-diff.d.ts +4 -1
- package/common/bundle-compare-diff.js +4 -3
- package/common/bundle-sources.js +4 -2
- package/common/finding-duplicates.js +4 -4
- package/common/finding-filters.js +11 -13
- package/common/managed/roles.ts +6 -0
- package/common/managed/routes.js +4 -3
- package/common/managed/team-app.d.ts +2 -0
- package/common/managed/team-app.js +31 -14
- package/out/activity.js +1 -1
- package/out/{chunk-5NUDNLJA.js → chunk-62QT2RXR.js} +2 -2
- package/out/{chunk-ROHACH7V.js → chunk-EYTPAODY.js} +2 -2
- package/out/{chunk-PX5DLFSD.js → chunk-HLMQ7QYS.js} +1 -1
- package/out/chunk-ITUKKCCK.js +10 -0
- package/out/{chunk-BLPHP4U3.js → chunk-IVDE66N5.js} +1 -1
- package/out/{chunk-CXVBTUK3.js → chunk-NMC7P5AA.js} +2 -2
- package/out/chunk-O6FA2R5G.js +53 -0
- package/out/{chunk-RLLA4GHZ.js → chunk-PLF4LBLE.js} +1 -1
- package/out/{chunk-RGNF4OH6.js → chunk-RHOQDAU4.js} +1 -1
- package/out/{chunk-GV5U7OLP.js → chunk-SZHJZVBL.js} +1 -1
- package/out/{chunk-2IHCVA3Y.js → chunk-T6EXDRB7.js} +1 -1
- package/out/chunk-VOJBPNPL.js +255 -0
- package/out/{chunk-ROWUGPID.js → chunk-VSVFMSGI.js} +1 -1
- package/out/{chunk-TD7RVUTT.js → chunk-W5PRH5D7.js} +1 -1
- package/out/chunk-WGQ7D5DB.js +1 -0
- package/out/client-managed-import.js +1 -1
- package/out/client-managed.js +30 -30
- package/out/compare.js +4 -4
- package/out/dialogs.js +1 -1
- package/out/graph.js +1 -1
- package/out/index.html +10 -10
- package/out/prism.js +1 -1
- package/out/scan.js +1 -1
- package/out/view.css +1 -1
- package/out/view.js +4 -4
- package/package.json +4 -3
- package/risk/files/characters.js +142 -8
- package/risk/files/hosts.js +4 -3
- package/risk/files/readability.js +18 -13
- package/risk/files/runs-code.js +41 -80
- package/risk/files/script.js +210 -48
- package/risk/index.d.ts +6 -4
- package/risk/npm/assess.js +1 -1
- package/risk/npm/tarball.js +41 -25
- package/server-managed/comparison.ts +6 -5
- package/server-managed/http.ts +71 -28
- package/server-managed/locked-packages.ts +62 -5
- package/server-managed/npm-loads.ts +2 -2
- package/server-managed/npm-packages.ts +12 -6
- package/server-managed/npm-patch-paths.ts +57 -0
- package/server-managed/npm-patch.ts +71 -76
- package/server-managed/repository-code.ts +12 -8
- package/server-managed/repository-risk-read.ts +42 -15
- package/server-managed/team-app-summaries.ts +3 -1
- package/server-managed/team-app.ts +4 -2
- package/server-managed/team-reports.ts +8 -3
- package/out/chunk-5YP7P5KA.js +0 -1
- package/out/chunk-74AEKRES.js +0 -10
- package/out/chunk-BIWPZT4E.js +0 -52
- package/out/chunk-YCEMQETS.js +0 -255
- /package/out/{chunk-Y2XGV3RC.js → chunk-S5HSDGTP.js} +0 -0
|
@@ -6,14 +6,18 @@
|
|
|
6
6
|
// to the hash the lockfile names it by, as pnpm 10 and later hash it
|
|
7
7
|
// (hashOfPatch; one pnpm 9 names by an md5 isn't read), by which it is kept
|
|
8
8
|
// for good, read of GitHub once; and applied to the version's files as pnpm applies
|
|
9
|
-
// it as it installs it (patch-package's applyPatch, which pnpm 10
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
9
|
+
// it as it installs it (patch-package's applyPatch, which pnpm 10 bundles):
|
|
10
|
+
// each file it deletes, creates, renames or changes, a change's hunks each
|
|
11
|
+
// found in the file as it was, where its header says, else as many as FUZZ
|
|
12
|
+
// lines either side, its lines the same but for the space they end in, and
|
|
13
|
+
// those it keeps kept as the file has them. pnpm 10, 11 and 12 each read a
|
|
14
|
+
// patch their own way, so one is read only where none installs other than
|
|
15
|
+
// it shows (parsePatch): a line outside what git writes, paths that
|
|
16
|
+
// disagree, a rename that also creates or deletes, or a hunk whose missing
|
|
17
|
+
// final newline the file doesn't bear out, isn't read. A file it makes
|
|
18
|
+
// executable, or no longer, is so, as every pnpm makes it. Nor is a patch of
|
|
19
|
+
// a file's bytes (git's binary patch) or of a mode but 644 and 755, or of a
|
|
20
|
+
// file outside the package, read; and one that doesn't apply fails as a whole.
|
|
17
21
|
import { Buffer } from 'node:buffer'
|
|
18
22
|
import { createHash } from 'node:crypto'
|
|
19
23
|
import { YamlError, parseYaml } from '@preventive/lockfile/yaml.js'
|
|
@@ -27,6 +31,7 @@ import { type Lru, lru } from './lru.ts'
|
|
|
27
31
|
import type { KeptStore } from './npm-kept.ts'
|
|
28
32
|
import { plainObject } from './npm-manifest.ts'
|
|
29
33
|
import { NpmPackageError, type NpmPackageFile, npmFileText, pathOrder } from './npm-packages.ts'
|
|
34
|
+
import { gitPath, namesBoth, sidePath, unquoted } from './npm-patch-paths.ts'
|
|
30
35
|
import { type GithubAsked, type PullDependencies, lockfileFormat, repositoryFile } from './pull-dependencies.ts'
|
|
31
36
|
import { eachOf } from './queue.ts'
|
|
32
37
|
|
|
@@ -77,55 +82,14 @@ const patchFileAt = (fullName: string, token: string, path: string, commit: stri
|
|
|
77
82
|
// first's index, as it reads `-0`, the first line), how many it finds
|
|
78
83
|
// (`length`), and its lines, each without its LF, in runs of a kind
|
|
79
84
|
// (`parts`): those it keeps, removes or adds, the last of a side told where
|
|
80
|
-
// the file has no LF after it (`unended`)
|
|
85
|
+
// the file has no LF after it (`unended`); and whether it makes the file
|
|
86
|
+
// executable, or no longer (`executable`), where it says.
|
|
81
87
|
export interface HunkPart { kind: 'context' | 'deletion' | 'insertion'; lines: string[]; unended?: true }
|
|
82
88
|
export interface PatchHunk { at: number; length: number; parts: HunkPart[] }
|
|
83
|
-
export interface PatchedFile { path: string; from?: string; deleted?: true; created?: true; hunks: PatchHunk[] }
|
|
89
|
+
export interface PatchedFile { path: string; from?: string; deleted?: true; created?: true; executable?: boolean; hunks: PatchHunk[] }
|
|
84
90
|
|
|
85
91
|
const unreadable = () => new NpmPackageError(422, 'patch-unreadable')
|
|
86
92
|
|
|
87
|
-
// A path as git writes it, unquoted where quoted (as C writes a string, its
|
|
88
|
-
// bytes past ASCII in octal); null where it is quoted otherwise.
|
|
89
|
-
const ESCAPES: Record<string, number> = { a: 7, b: 8, t: 9, n: 10, v: 11, f: 12, r: 13, '"': 34, '\\': 92 }
|
|
90
|
-
function unquoted(path: string): string | null {
|
|
91
|
-
if (!path.startsWith('"')) return path
|
|
92
|
-
const bytes: number[] = []
|
|
93
|
-
for (let at = 1; at < path.length; at++) {
|
|
94
|
-
const char = path[at]!
|
|
95
|
-
if (char === '"') return at === path.length - 1 ? new TextDecoder().decode(Uint8Array.from(bytes)) : null
|
|
96
|
-
if (char !== '\\') { bytes.push(...Buffer.from(char)); continue }
|
|
97
|
-
const next = path[++at] ?? ''
|
|
98
|
-
const octal = /^[0-3][0-7]{2}/u.exec(path.slice(at))?.[0]
|
|
99
|
-
if (octal) { bytes.push(Number.parseInt(octal, 8)); at += 2 }
|
|
100
|
-
else if (next in ESCAPES) bytes.push(ESCAPES[next]!)
|
|
101
|
-
else return null
|
|
102
|
-
}
|
|
103
|
-
return null
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// A side's path in the package, as a `---` or `+++` line names it after its
|
|
107
|
-
// prefix (`a/` or `b/`), git's tab after one with a space in it left out;
|
|
108
|
-
// null for none (`/dev/null`).
|
|
109
|
-
function sidePath(named: string, prefix: string): string | null {
|
|
110
|
-
const path = unquoted(named.endsWith('\t') ? named.slice(0, -1) : named)
|
|
111
|
-
if (path === '/dev/null') return null
|
|
112
|
-
if (path === null || !path.startsWith(prefix)) throw unreadable()
|
|
113
|
-
return path.slice(prefix.length)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// The paths a `diff --git` line names, where they are the same, as git
|
|
117
|
-
// writes them for a file neither renamed nor copied: `a/<path> b/<path>`.
|
|
118
|
-
function gitPath(named: string): string | null {
|
|
119
|
-
if (named.startsWith('"')) {
|
|
120
|
-
const quoted = /^("(?:[^"\\]|\\.)*") ("(?:[^"\\]|\\.)*")$/u.exec(named)
|
|
121
|
-
const [a, b] = quoted ? [unquoted(quoted[1]!), unquoted(quoted[2]!)] : []
|
|
122
|
-
return a?.startsWith('a/') && b?.startsWith('b/') && a.slice(2) === b.slice(2) ? a.slice(2) : null
|
|
123
|
-
}
|
|
124
|
-
const length = (named.length - 5) / 2
|
|
125
|
-
const path = named.slice(2, 2 + length)
|
|
126
|
-
return Number.isInteger(length) && named.startsWith('a/') && named.slice(2 + length) === ` b/${path}` ? path : null
|
|
127
|
-
}
|
|
128
|
-
|
|
129
93
|
// The hunk whose `@@` line is at `at` of `lines`, those before `end` read,
|
|
130
94
|
// and the line after it, as patch-package reads it: a line of its own
|
|
131
95
|
// kind, else of those it keeps where it is empty, or a CR alone.
|
|
@@ -156,11 +120,16 @@ function readHunk(lines: string[], at: number, end: number): { hunk: PatchHunk;
|
|
|
156
120
|
}
|
|
157
121
|
|
|
158
122
|
// A patch's files as git's diff writes them, as pnpm writes a patch: a file's
|
|
159
|
-
// `diff --git` line, its headers, the paths its sides have, and its hunks
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
//
|
|
123
|
+
// `diff --git` line, its headers, the paths its sides have, and its hunks.
|
|
124
|
+
// One whose own lines end in CRLFs, as an editor or git's autocrlf leaves
|
|
125
|
+
// one, is read as patch-package reads it: its headers but their CRs, its
|
|
126
|
+
// hunks' lines with them. pnpm 10 and 11 also read hunks where git puts none
|
|
127
|
+
// (with no `diff --git` line, past a blank or `index` line, after another
|
|
128
|
+
// file's hunks) and pnpm 12 doesn't, so a line git doesn't write is refused,
|
|
129
|
+
// but blank lines at the end. So are a `diff --git` line naming other paths
|
|
130
|
+
// than its sides (pnpm 10 and 11 take one, pnpm 12 the other), a rename that
|
|
131
|
+
// also creates or deletes, and a `new mode` line without its `old mode`
|
|
132
|
+
// (pnpm 12 alone reads one). Throws for one it can't read, or of bytes.
|
|
164
133
|
export function parsePatch(patch: string): PatchedFile[] {
|
|
165
134
|
const lines = patch.split('\n')
|
|
166
135
|
// The lines read: those but the empty one past the patch's last ending.
|
|
@@ -170,37 +139,47 @@ export function parsePatch(patch: string): PatchedFile[] {
|
|
|
170
139
|
const files: PatchedFile[] = []
|
|
171
140
|
for (let at = 0; at < lines.length;) {
|
|
172
141
|
const head = headerAt(at++)
|
|
173
|
-
if (
|
|
174
|
-
|
|
142
|
+
if (head === '' && lines.slice(at, end).every((_, i) => headerAt(at + i) === '')) break
|
|
143
|
+
if (!head.startsWith('diff --git ')) throw unreadable()
|
|
144
|
+
let created = false, deleted = false, executable: boolean | undefined, from: string | null = null, to: string | null = null
|
|
175
145
|
let sides: [string | null, string | null] | null = null
|
|
176
|
-
|
|
146
|
+
const seen = new Set<string>()
|
|
147
|
+
for (; at < end && !/^(?:diff --git |@@ |--- )/u.test(lines[at]!); at++) {
|
|
177
148
|
const header = headerAt(at)
|
|
178
149
|
if (header === 'GIT binary patch' || header.startsWith('Binary files ')) throw new NpmPackageError(422, 'patch-unsupported')
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
150
|
+
const kind = /^(?:index|similarity index|dissimilarity index|deleted file mode|new file mode|rename from|rename to|old mode|new mode|copy from|copy to) /u.exec(header)?.[0]
|
|
151
|
+
if (kind === undefined || seen.has(kind)) throw unreadable()
|
|
152
|
+
seen.add(kind)
|
|
153
|
+
// A mode it names: `100644`, or `100755` (executable).
|
|
154
|
+
const mode = kind.endsWith('mode ') ? header.slice(kind.length) : undefined
|
|
155
|
+
if (kind.startsWith('copy ') || (mode !== undefined && mode !== '100644' && mode !== '100755')) throw new NpmPackageError(422, 'patch-unsupported')
|
|
156
|
+
if (kind === 'deleted file mode ') deleted = true
|
|
157
|
+
else if (kind === 'new file mode ') { created = true; executable = mode === '100755' }
|
|
158
|
+
else if (kind === 'new mode ') executable = mode === '100755'
|
|
159
|
+
else if (kind === 'rename from ') from = unquoted(header.slice(kind.length))
|
|
160
|
+
else if (kind === 'rename to ') to = unquoted(header.slice(kind.length))
|
|
184
161
|
}
|
|
185
162
|
if (lines[at]?.startsWith('--- ')) {
|
|
186
163
|
if (!lines[at + 1]?.startsWith('+++ ')) throw unreadable()
|
|
187
164
|
sides = [sidePath(headerAt(at).slice(4), 'a/'), sidePath(headerAt(at + 1).slice(4), 'b/')]
|
|
188
165
|
at += 2
|
|
189
166
|
}
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
195
|
-
|| (
|
|
167
|
+
if ((from === null) !== (to === null) || (deleted && created) || (from !== null && (deleted || created)) || seen.has('old mode ') !== seen.has('new mode ')) throw unreadable()
|
|
168
|
+
const rest = head.slice('diff --git '.length)
|
|
169
|
+
const path = sides ? (created ? sides[1] : sides[0]) : gitPath(rest)
|
|
170
|
+
const after = to ?? path, before = from ?? path
|
|
171
|
+
if (before == null || after == null || ![before, after].every(isPatchPath) || !namesBoth(rest, before, after)
|
|
172
|
+
|| (sides && (sides[0] !== (created ? null : before) || sides[1] !== (deleted ? null : after)))) throw unreadable()
|
|
196
173
|
const hunks: PatchHunk[] = []
|
|
197
174
|
while (lines[at]?.startsWith('@@ ')) {
|
|
198
175
|
const { hunk, next } = readHunk(lines, at, end)
|
|
199
176
|
hunks.push(hunk)
|
|
200
177
|
at = next
|
|
201
178
|
}
|
|
202
|
-
|
|
203
|
-
|
|
179
|
+
// A file created is its one hunk's lines, as git writes it, which pnpm 10 alone writes of a hunk otherwise.
|
|
180
|
+
if (created && (hunks.length > 1 || hunks.some(hunk => hunk.parts.some(part => part.kind !== 'insertion')))) throw unreadable()
|
|
181
|
+
files.push({ path: deleted ? before : after, ...from === null ? {} : { from: before }, ...deleted ? { deleted: true as const } : {},
|
|
182
|
+
...created ? { created: true as const } : {}, ...executable === undefined || deleted ? {} : { executable }, hunks: deleted ? [] : hunks })
|
|
204
183
|
}
|
|
205
184
|
return files
|
|
206
185
|
}
|
|
@@ -233,6 +212,18 @@ function changesAt(hunk: PatchHunk, lines: string[], at: number): LineChange[] |
|
|
|
233
212
|
return changes
|
|
234
213
|
}
|
|
235
214
|
|
|
215
|
+
// Whether `hunk`, found at `at` of `lines`, may say a side ends with no LF
|
|
216
|
+
// (`unended`): pnpm versions apply that mark alike only where the hunk ends
|
|
217
|
+
// where the file does, and the file agrees: no LF at its end for the old
|
|
218
|
+
// side's mark; one, or the old side's mark, for the new side's.
|
|
219
|
+
function endsAgree(hunk: PatchHunk, lines: string[], at: number): boolean {
|
|
220
|
+
const unended = lines.at(-1) !== ''
|
|
221
|
+
const ending = at + hunk.length === lines.length - (unended ? 0 : 1)
|
|
222
|
+
const pushes = hunk.parts.some(part => part.kind === 'deletion' && part.unended)
|
|
223
|
+
const pops = hunk.parts.some(part => part.kind === 'insertion' && part.unended)
|
|
224
|
+
return (!pushes || (ending && unended)) && (!pops || (ending && (pushes || !unended)))
|
|
225
|
+
}
|
|
226
|
+
|
|
236
227
|
// `text` with `hunks` applied as patch-package applies them (applyPatch):
|
|
237
228
|
// each one's lines found in the text as it was, where its header says, else
|
|
238
229
|
// as near as FUZZ lines either side, the nearer first, and the earlier of
|
|
@@ -243,6 +234,8 @@ function applied(text: string, hunks: PatchHunk[]): string {
|
|
|
243
234
|
const changes = hunks.flatMap(hunk => {
|
|
244
235
|
for (let offset = 0; Math.abs(offset) <= FUZZ; offset = offset < 0 ? -offset : -offset - 1) {
|
|
245
236
|
const found = changesAt(hunk, lines, hunk.at + offset)
|
|
237
|
+
// Where pnpm finds it, whatever its marks say, lest another place be shown changed than it changes.
|
|
238
|
+
if (found && !endsAgree(hunk, lines, hunk.at + offset)) throw doesNotApply()
|
|
246
239
|
if (found) return found
|
|
247
240
|
}
|
|
248
241
|
throw doesNotApply()
|
|
@@ -262,14 +255,16 @@ function applied(text: string, hunks: PatchHunk[]): string {
|
|
|
262
255
|
// A version's `files` with `patch` applied, in the order of their paths, as
|
|
263
256
|
// its tarball's are read; a file it changes the text of must be text. One it
|
|
264
257
|
// creates holds its first hunk's first lines, in place of any there, as
|
|
265
|
-
// patch-package writes it. A
|
|
258
|
+
// patch-package writes it. A file keeps its mode but where the patch says
|
|
259
|
+
// otherwise. A symlink, which pnpm never installs, is none to patch.
|
|
266
260
|
export function patchedFiles(files: NpmPackageFile[], patch: PatchedFile[]): NpmPackageFile[] {
|
|
267
261
|
const byPath = new Map(files.map(file => [file.path, file]))
|
|
268
262
|
const encoder = new TextEncoder()
|
|
269
263
|
for (const file of patch) {
|
|
270
264
|
if (file.created) {
|
|
271
265
|
const first = file.hunks[0]?.parts[0]
|
|
272
|
-
byPath.set(file.path, { path: file.path, bytes: encoder.encode(first ? `${first.lines.join('\n')}${first.unended ? '' : '\n'}` : '')
|
|
266
|
+
byPath.set(file.path, { path: file.path, bytes: encoder.encode(first ? `${first.lines.join('\n')}${first.unended ? '' : '\n'}` : ''),
|
|
267
|
+
...file.executable ? { executable: true as const } : {} })
|
|
273
268
|
continue
|
|
274
269
|
}
|
|
275
270
|
const source = file.from ?? file.path
|
|
@@ -286,7 +281,7 @@ export function patchedFiles(files: NpmPackageFile[], patch: PatchedFile[]): Npm
|
|
|
286
281
|
if (byPath.has(file.path)) throw doesNotApply()
|
|
287
282
|
byPath.delete(source)
|
|
288
283
|
}
|
|
289
|
-
byPath.set(file.path, { path: file.path, bytes: next })
|
|
284
|
+
byPath.set(file.path, { path: file.path, bytes: next, ...(file.executable ?? was.executable) ? { executable: true as const } : {} })
|
|
290
285
|
}
|
|
291
286
|
return [...byPath.values()].toSorted((a, b) => pathOrder(a.path, b.path))
|
|
292
287
|
}
|
|
@@ -13,7 +13,7 @@ import { CacheMissError, type CacheStorage } from './cache-storage.ts'
|
|
|
13
13
|
import { SHA } from './github-values.ts'
|
|
14
14
|
import type { KeptStore } from './npm-kept.ts'
|
|
15
15
|
import { plainObject } from './npm-manifest.ts'
|
|
16
|
-
import { MAX_NPM_JSON_LENGTH, NpmPackageError, npmFileRows } from './npm-packages.ts'
|
|
16
|
+
import { MAX_NPM_JSON_LENGTH, NpmPackageError, npmExecutablePaths, npmFileRows } from './npm-packages.ts'
|
|
17
17
|
import { type NpmLoad, loadPlaces, readTarballFiles, sharedLoad } from './npm-loads.ts'
|
|
18
18
|
|
|
19
19
|
// What a directory may hold, bounded apart from a package's (npm-packages.ts),
|
|
@@ -22,8 +22,9 @@ export const MAX_REPOSITORY_CODE_FILES = 80_000
|
|
|
22
22
|
export const MAX_REPOSITORY_CODE_BYTES = 256 * 1024 * 1024
|
|
23
23
|
// The tarball they come in, bounded in proportion as a package's is: its tar
|
|
24
24
|
// stream, headers and padding included, and its entries, as many again as
|
|
25
|
-
// files, as GitHub's has one for each directory too.
|
|
26
|
-
|
|
25
|
+
// files, as GitHub's has one for each directory too. Its paths are compared
|
|
26
|
+
// as git holds them, which may differ only in case.
|
|
27
|
+
const REPOSITORY_TAR = { maxFiles: MAX_REPOSITORY_CODE_FILES, maxBytes: MAX_REPOSITORY_CODE_BYTES, maxEntries: 2 * MAX_REPOSITORY_CODE_FILES, maxTarBytes: 384 * 1024 * 1024, foldPaths: false }
|
|
27
28
|
// What the files may take as the viewer's JSON, written as one string: short
|
|
28
29
|
// of the longest V8 holds (2^29 - 24 characters).
|
|
29
30
|
const MAX_REPOSITORY_CODE_JSON_LENGTH = 384 * 1024 * 1024
|
|
@@ -72,16 +73,19 @@ export function loadRepositoryCodeBody(input: RepositoryCodeInput, tarball: (sym
|
|
|
72
73
|
const places = loadPlaces(listed)
|
|
73
74
|
const maxLength = Math.min(MAX_REPOSITORY_CODE_JSON_LENGTH, places * MAX_NPM_JSON_LENGTH)
|
|
74
75
|
return sharedLoad(`repository ${repoId} ${repo} ${commit} ${path} ${tree}`, async () => {
|
|
75
|
-
let files
|
|
76
|
-
try {
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
let executable, files
|
|
77
|
+
try {
|
|
78
|
+
const read = await readTarballFiles(await tarball(symlinksAbove), { ...REPOSITORY_TAR, symlinksAbove })
|
|
79
|
+
files = npmFileRows(read, maxLength)
|
|
80
|
+
executable = npmExecutablePaths(read)
|
|
81
|
+
} catch (err) { throw directoryError(err) }
|
|
82
|
+
return encodeBrotli(Buffer.from(JSON.stringify({ repoId, repo, commit, path, tree, files, executable })))
|
|
79
83
|
}, 'repository-busy', { places })
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
// The form of the bodies kept, bumped as what a body holds changes
|
|
83
87
|
// (npmFileRows): one kept in another is none to read.
|
|
84
|
-
const KEPT_CODE_VERSION =
|
|
88
|
+
const KEPT_CODE_VERSION = 3
|
|
85
89
|
// The largest body kept. Source text runs, as brotli's JSON, to a third of
|
|
86
90
|
// its bytes or less, and a directory's binary files are named, not held, so
|
|
87
91
|
// this keeps one of some 200 MiB of text: nearly every directory that opens
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
// instance's memory, and the source's `listings`, `actionFiles` and
|
|
13
13
|
// `lockfiles` for SCAN_READ_KEPT_MS, so that only opening a repository and
|
|
14
14
|
// checking access to it again ask GitHub where all else is kept.
|
|
15
|
+
import { createHash } from 'node:crypto'
|
|
15
16
|
import type { LockfileFormat, RepoLockfile } from '@preventive/upstream/github.js'
|
|
16
17
|
import type { AlertsRead } from './dependabot-access.ts'
|
|
17
18
|
import type { DependabotAlert } from './dependabot-alerts.ts'
|
|
18
|
-
import { type LockedPackage, isTestFixture, lockedPackages } from './locked-packages.ts'
|
|
19
|
+
import { type LockedPackage, isTestFixture, lockedPackages, yarnManifests } from './locked-packages.ts'
|
|
19
20
|
import type { Lru } from './lru.ts'
|
|
20
21
|
import type { KeptStore } from './npm-kept.ts'
|
|
21
22
|
import { inTurns } from './queue.ts'
|
|
@@ -49,7 +50,9 @@ export type RepositoryFailure = Extract<RepositoryRiskLine, { type: 'repo'; erro
|
|
|
49
50
|
// build of it tells (stasis-dependencies.ts): the versions it installs
|
|
50
51
|
// (`dependencies`), that its build is still to be made (`pending`), or why it
|
|
51
52
|
// failed.
|
|
52
|
-
|
|
53
|
+
// `lockfiles`, those its `lockfiles` names, from the repository's root,
|
|
54
|
+
// where it names some: those its builds install from (namedLockfiles).
|
|
55
|
+
export type StasisConfigRow = { path: string; lockfiles?: string[] } & ({ dependencies: StasisDependency[] } | { pending: true } | RiskFailure)
|
|
53
56
|
// A repository's stasis.config.json files, those of its `paths` alone, each
|
|
54
57
|
// what Stasis reaches of it, or why they couldn't be listed.
|
|
55
58
|
export type StasisConfigsRead = { configs: StasisConfigRow[] } | RiskFailure
|
|
@@ -104,8 +107,9 @@ export interface RepositoryRead {
|
|
|
104
107
|
recheck(): Promise<void>
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
// Whether a lockfile at `path` is of `paths` (RepositoryRiskRepo)
|
|
108
|
-
|
|
110
|
+
// Whether a lockfile at `path` is of `paths` (RepositoryRiskRepo), as a
|
|
111
|
+
// stasis.config.json is.
|
|
112
|
+
export function lockfileOf(path: string, paths: readonly string[] | undefined) {
|
|
109
113
|
const dir = path.slice(0, Math.max(path.lastIndexOf('/'), 0))
|
|
110
114
|
return !paths || paths.some(scope => dir === '' || dir === scope || dir.startsWith(`${scope}/`) || scope.startsWith(`${dir}/`))
|
|
111
115
|
}
|
|
@@ -125,19 +129,23 @@ async function keptRead<T>(memory: Lru<T>, store: KeptStore<T> | undefined, key:
|
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
// A lockfile's line, its packages or why they couldn't be had: as kept by its
|
|
128
|
-
// blob, else read from GitHub and kept
|
|
132
|
+
// blob, else read from GitHub and kept; with the `sha` it is kept by, a
|
|
133
|
+
// yarn.lock's with its package.json files' (yarnManifests), which alone say
|
|
134
|
+
// what only devDependencies need, and change while it may not.
|
|
129
135
|
async function readLockfile({ source, caches }: RepositoryReading<RepositoryRiskRepo>, repo: number, opened: OpenedRepository,
|
|
130
|
-
{ path, format, sha }: ListedLockfile): Promise<LockfileLine> {
|
|
136
|
+
{ path, format, sha }: ListedLockfile): Promise<{ sha: string; line: LockfileLine }> {
|
|
131
137
|
const at = { type: 'lockfile', repo, path, format } as const
|
|
132
|
-
if (!READ_FORMATS.has(format)) return { ...at, error: 'unsupported-format' }
|
|
138
|
+
if (!READ_FORMATS.has(format)) return { sha, line: { ...at, error: 'unsupported-format' } }
|
|
133
139
|
try {
|
|
134
|
-
|
|
140
|
+
const manifests = format === 'yarn' ? await yarnManifests(path, file => opened.file(file), opened.files) : null
|
|
141
|
+
const kept = manifests ? `${sha}+${createHash('sha256').update(JSON.stringify(manifests)).digest('hex').slice(0, 16)}` : sha
|
|
142
|
+
return { sha: kept, line: { ...at, ...await keptRead(caches.lockfiles, source.lockfiles, `${format}\0${kept}`, async (): Promise<LockfileRead> => {
|
|
135
143
|
const text = await opened.file(path)
|
|
136
|
-
try { return { packages: lockedPackages(format, text) } } catch (error) {
|
|
144
|
+
try { return { packages: lockedPackages(format, text, { manifests }) } } catch (error) {
|
|
137
145
|
return { error: 'lockfile-unreadable', ...error instanceof Error ? { detail: error.message.slice(0, 500) } : {} }
|
|
138
146
|
}
|
|
139
|
-
}) }
|
|
140
|
-
} catch (error) { return { ...at, ...failureOf(error) } }
|
|
147
|
+
}) } }
|
|
148
|
+
} catch (error) { return { sha, line: { ...at, ...failureOf(error) } } }
|
|
141
149
|
}
|
|
142
150
|
|
|
143
151
|
// A repository opened and its lockfiles of npm's ecosystem listed, as kept
|
|
@@ -182,10 +190,29 @@ async function readStasis(opened: OpenedRepository, paths: readonly string[] | u
|
|
|
182
190
|
}
|
|
183
191
|
if (configs.length === 0) return null
|
|
184
192
|
return { configs: await Promise.all(configs.map(async path => {
|
|
185
|
-
|
|
193
|
+
const lockfiles = await opened.file(path).then(namedLockfiles(path), () => null)
|
|
194
|
+
try { return { ...stasisConfigRow(path, await stasis(path)), ...lockfiles && { lockfiles } } } catch (error) { return { path, ...failureOf(error) } }
|
|
186
195
|
})) }
|
|
187
196
|
}
|
|
188
197
|
|
|
198
|
+
// The lockfiles a stasis.config.json at `path` names (`lockfiles`), from its
|
|
199
|
+
// directory, as Stasis installs from those alone, each from the repository's
|
|
200
|
+
// root; null where it names none, or isn't JSON, or one is out of the
|
|
201
|
+
// repository.
|
|
202
|
+
export const namedLockfiles = (path: string) => (text: string): string[] | null => {
|
|
203
|
+
let named: unknown
|
|
204
|
+
try { named = (JSON.parse(text) as { lockfiles?: unknown } | null)?.lockfiles } catch { return null }
|
|
205
|
+
if (!Array.isArray(named) || named.length === 0 || !named.every(each => typeof each === 'string' && each !== '')) return null
|
|
206
|
+
const resolved = (named as string[]).map(each => {
|
|
207
|
+
const parts = path.split('/').slice(0, -1)
|
|
208
|
+
for (const part of each.split('/')) {
|
|
209
|
+
if (part === '..') { if (parts.pop() === undefined) return null } else if (part !== '' && part !== '.') parts.push(part)
|
|
210
|
+
}
|
|
211
|
+
return parts.join('/')
|
|
212
|
+
})
|
|
213
|
+
return resolved.every(Boolean) ? resolved as string[] : null
|
|
214
|
+
}
|
|
215
|
+
|
|
189
216
|
// A repository read: its lockfiles listed and read, a few at once, its
|
|
190
217
|
// Dependabot alerts asked, its Actions read and its stasis.config.json files
|
|
191
218
|
// asked meanwhile; its line telling why where listing
|
|
@@ -205,9 +232,9 @@ export async function readRepository<R extends RepositoryRiskRepo>(reading: Repo
|
|
|
205
232
|
const inTurn = inTurns(LOCKFILES_AT_ONCE)
|
|
206
233
|
const lines = await Promise.all(listed.lockfiles.map(lockfile => inTurn(() => (reading.signal.aborted ? Promise.resolve(null) : readLockfile(reading, repo.repoId, opened, lockfile)))))
|
|
207
234
|
const lockfiles: RepositoryRead['lockfiles'] = []
|
|
208
|
-
for (const
|
|
209
|
-
if (!
|
|
210
|
-
if (!('error' in line && line.error === 'lockfile-unreadable' && isTestFixture(line.path))) lockfiles.push(
|
|
235
|
+
for (const read of lines) {
|
|
236
|
+
if (!read) return null
|
|
237
|
+
if (!('error' in read.line && read.line.error === 'lockfile-unreadable' && isTestFixture(read.line.path))) lockfiles.push(read)
|
|
211
238
|
}
|
|
212
239
|
const dependabot = await alerting
|
|
213
240
|
const actions = await acting
|
|
@@ -28,7 +28,9 @@ export interface TeamAppSummaryStore {
|
|
|
28
28
|
// How a summary is worked out (common/workspace-app.js, team-app.js), which a
|
|
29
29
|
// deployment may change: one stored by another deployment, or before this
|
|
30
30
|
// is raised, is worked out again.
|
|
31
|
-
|
|
31
|
+
// 2: a report that opens as an App view on its own holds its team off it with
|
|
32
|
+
// none of its findings (common/managed/team-app.js).
|
|
33
|
+
const SUMMARY_VERSION = 2
|
|
32
34
|
const DEPLOYMENT = process.env['VERCEL_DEPLOYMENT_ID'] ?? null
|
|
33
35
|
|
|
34
36
|
export const teamAppSummaryKey = (key: string): string => createHash('sha256').update(JSON.stringify([SUMMARY_VERSION, DEPLOYMENT, key])).digest('base64url')
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
// on their own, and its findings for the badge it collapses to. None is as
|
|
14
14
|
// uniform as an App team, and collapses like one. A team mixing App and non-App
|
|
15
15
|
// reports stays expanded, and so does one whose reports each open as App but
|
|
16
|
-
// whose combined workspace does not (contradicting verdicts
|
|
17
|
-
// findings, and only expanded does it show that they fail to combine.
|
|
16
|
+
// whose combined workspace does not (contradicting verdicts): it has App
|
|
17
|
+
// findings, and only expanded does it show that they fail to combine. A report
|
|
18
|
+
// that opens as App alone holds its team off with none of its findings
|
|
19
|
+
// (common/managed/team-app.js), so nothing else keeps such reports apart.
|
|
18
20
|
import type { TeamAppMetadata } from '../common/managed/team-app.js'
|
|
19
21
|
import type { BlobStore } from './blob-store.ts'
|
|
20
22
|
import type { ManagedDb, TeamReportAccessSnapshot, UserTeam } from './db.ts'
|
|
@@ -20,9 +20,12 @@ import { MAX_REPORT_QUERY_BYTES, MAX_REPORT_QUERY_COUNT } from './report-query.t
|
|
|
20
20
|
import { ourRepoSlugs } from '../common/finding-repo.js'
|
|
21
21
|
|
|
22
22
|
type Finding = Record<string, unknown>
|
|
23
|
-
// `confirmedDefault` where a manager switched the report to open on Confirmed
|
|
24
|
-
//
|
|
25
|
-
|
|
23
|
+
// `confirmedDefault` where a manager switched the report to open on Confirmed,
|
|
24
|
+
// and `opensAsApp` where it opens as an App view on its own, so switched or by
|
|
25
|
+
// its rows (common/managed/team-app.js), which its team's view counts as
|
|
26
|
+
// holding it off Confirmed none of its findings (common/finding-filters.js
|
|
27
|
+
// confirmedCoverage); each left out otherwise.
|
|
28
|
+
type TeamReport = { id: string; filename: string; data: unknown; repo: { github: string | null; directory: string }; confirmedDefault?: true; opensAsApp?: true }
|
|
26
29
|
type ReportVisibility = { ids: Set<string>; sourcePaths: Set<string> }
|
|
27
30
|
type Visibility = Map<string, ReportVisibility>
|
|
28
31
|
const VISIBILITY_CACHE_MAX_ITEMS = 250_000
|
|
@@ -214,6 +217,8 @@ async function buildTeamWorkspace(db: ManagedDb, store: BlobStore, snapshot: Tea
|
|
|
214
217
|
// their detail, and in App mode its rows as the App view shows them
|
|
215
218
|
// (common/managed/finding-detail.js).
|
|
216
219
|
const view = managedTeamView(Object.assign(reports.map(({ filename, data, confirmedDefault }) => ({ filename, data, confirmedDefault })), { links }))
|
|
220
|
+
// As the reader's own grants leave each report, which they would open alone.
|
|
221
|
+
view.opensAsApp.forEach((opens, index) => { if (opens) reports[index]!.opensAsApp = true })
|
|
217
222
|
const lite = liteWorkspace(reports, links, view)
|
|
218
223
|
const restricted = snapshot.reports.some(report => !report.permissions.dependencies || !report.permissions.security)
|
|
219
224
|
const encoded = {
|
package/out/chunk-5YP7P5KA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./chunk-QRKFPLA4.js";var t=new Set([`overview`,`graph`,`treemap`,`compare`,`advisories`,`issues`,`code`,`search`,`terminal`]),n=/^\d+$/u;function r(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n<32||n===127)return!0}return!1}var i=512;function a(e){return typeof e==`string`&&e.length>0&&e.length<=i&&!r(e)}function o(e){return a(e)&&!n.test(e)}function s(e){return e===`completed`||e===`not_planned`||e===`duplicate`?e:`unknown`}function c(e){let[t,n,r]=e.split(`/`);return r===void 0&&t!==void 0&&n!==void 0&&t.length<=39&&/^[a-zA-Z\d](?:-?[a-zA-Z\d])*$/u.test(t)&&n.length<=100&&n!==`.`&&n!==`..`&&/^[a-zA-Z\d._-]+$/u.test(n)}function l(e,t){if(typeof e!=`string`||e.length>2048)return null;let n;try{n=new URL(e)}catch{return null}if(n.href!==e||n.origin!==`https://github.com`||n.username||n.password)return null;let r=t.exec(n.pathname);if(!r)return null;let i=`${r[1]}/${r[2]}`,a=Number(r[3]);return!c(i)||!Number.isSafeInteger(a)||a<=0?null:{repo:i,number:a}}function u(e){return l(e,/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/(?:files|commits|checks))?\/?$/u)}function d(e){return l(e,/^\/([^/]+)\/([^/]+)\/issues\/(\d+)\/?$/u)}function f(e){let t=u(e);if(t)return{...t,kind:`pull`};let n=d(e);return n?{...n,kind:`issue`}:null}function p(e){return`${e.repo.toLowerCase()}#${e.kind}:${e.number}`}var m=/^(?=.{1,214}$)(?:@[\w.-]+\/[\w-]|[\dA-Za-z])[\w.-]*$/u,h=/^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u,ee=/^@[\da-z~-][\w.~-]*$/u,g=/^[\da-f]{64}$/u;function _(e){return typeof e==`string`&&m.test(e)}function v(e){return typeof e==`string`&&h.test(e)}function y(e){return typeof e==`string`&&g.test(e)}function b(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}function te(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase(),n=t.startsWith(`@`)?t:`@${t}`;return n.length<=214&&ee.test(n)?n:null}var x=Object.freeze({all:`all`,team:`team`,repo:`repository`}),S=(e,t)=>e===`team`?typeof t==`string`&&/^[A-Za-z0-9_-]+$/u.test(t):e===`repo`&&Number.isSafeInteger(t)&&t>0;function ne(e){let t=e.riskScope??`team`,n=e.riskTarget??null;return!Object.hasOwn(x,t)||n!=null&&!S(t,n)?null:`/manage/risk/${x[t]}${n==null?``:`/${n}`}`}function C(e){if(e===`/manage/risk/team`||e===`/manage/repositories/risk`)return{view:`manage-repo-risk`};if(!e.startsWith(`/manage/risk/`))return;let t=/^\/manage\/risk\/(?:(all)|(team)\/([A-Za-z0-9_-]+)|repository(?:\/([1-9]\d*))?)$/u.exec(e);if(!t)return null;if(t[1])return{view:`manage-repo-risk`,riskScope:`all`};let[n,r]=t[2]?[`team`,t[3]]:[`repo`,t[4]==null?null:Number(t[4])];return r!=null&&!S(n,r)?null:{view:`manage-repo-risk`,riskScope:n,...r==null?{}:{riskTarget:r}}}var w=[[`whitespace`,`hideWhitespace`],[`type-only`,`hideTypes`]],T=[[`on`,`indented`],[`folded`,`folded`]];function E(e){let t=w.filter(([,t])=>e[t]===!0).map(([e])=>e),n=T.find(([,t])=>t===e.pretty)?.[0];return[...t.length>0?[`hide=${t.join(`,`)}`]:[],...n?[`pretty=${n}`]:[]]}function D(e){let t=new Set(e.getAll(`hide`).flatMap(e=>e.split(`,`))),n=T.find(([t])=>t===e.get(`pretty`))?.[1];return{...Object.fromEntries(w.filter(([e])=>t.has(e)).map(([,e])=>[e,!0])),...n?{pretty:n}:{}}}var O=e=>typeof e==`string`&&e.length>0&&e.length<=256&&!/[\p{Cc}]/u.test(e);function re(t){let n=t.get(`repo`),r=new Set((t.get(`severity`)??``).split(`,`)),i=e.filter(e=>r.has(e)),a={...O(n)?{repo:n}:{},...i.length>0?{severities:i}:{}};return Object.keys(a).length>0?{filters:a}:{}}function ie(t){let n=e.filter(e=>t?.severities?.includes(e)),r=[...O(t?.repo)?[`repo=${encodeURIComponent(t.repo).replaceAll(`%2F`,`/`)}`]:[],...n.length>0?[`severity=${n.join(`,`)}`]:[]];return r.length>0?`?${r.join(`&`)}`:``}var k=new Set([`code`,`diff`]),A=e=>k.has(e)?`code`:`overview`,j=e=>k.has(e)?{compareMode:`code`}:{},M=e=>k.has(e)?`/code`:``,N=Object.freeze({manage:`/manage`,"manage-bundles":`/manage/bundle`,"manage-scans":`/manage/scans`,"manage-reports":`/manage/report`,"manage-repos":`/manage/repositories`,"manage-repo-risk":`/manage/risk`,"admin-users":`/manage/users`,"manage-teams":`/manage/team`,"manage-import":`/manage/import`,"manage-links":`/manage/links`,"manage-deduplication":`/manage/deduplication`,"manage-history":`/manage/history`}),P=new Set([`workspace-reports`,`workspace-bundles`,`workspace-repositories`,`workspace-dependencies`]),F=new Set([`pulls`,`versions`,`branch`,`reviews`]),I=e=>e.view===`workspace-dependencies`&&e.dependencyTab!=null?{dependencyTab:e.dependencyTab}:{};function L(e){if(!o(e)||e===`.`||e===`..`)return null;try{return`/finding/${encodeURIComponent(e)}`}catch{return null}}function ae(e){if(!e)return null;if(e.view===`home`)return`/`;if(e.view===`reviews`)return`/my/reviews`;if(e.view===`profile`)return`/my/profile`;if(e.view===`npm`)return B(e);if(e.view===`repository-code`)return se(e);if(P.has(e.view)){let t=I(e).dependencyTab??`pulls`;return!/^[A-Za-z0-9_-]+$/u.test(e.teamSlug??``)||!F.has(t)?null:`/team/${e.teamSlug}/${e.view.slice(10)}${t===`pulls`?``:`/${t}`}`}if(e.view===`bundles`){if(!/^[A-Za-z0-9_-]+$/u.test(e.bundleSlug??``)||[e.teamSlug,e.compareSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=e.bundleTab??`overview`;if(!t.has(n))return null;let r=e.teamSlug?`/team/${e.teamSlug}`:`/manage`,i=n===`code`&&Z(e.file)?`/${e.file}`:``,a=i&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,o=n===`compare`&&e.compareSlug!=null?`/${e.compareSlug}${M(e.compareMode)}`:``;return`${r}/bundle/${e.bundleSlug}${n===`overview`?``:`/${n}`}${i}${o}${a}`}if(e.view===`manage-repo-risk`)return ne(e);if(Object.hasOwn(N,e.view)){let t=N[e.view];return e.view===`manage-deduplication`&&e.linkId?`${t}?report=${encodeURIComponent(e.linkId)}`:e.view===`manage-bundles`&&Number.isSafeInteger(e.createRepoId)&&e.createRepoId>0?`${t}?createRepo=${e.createRepoId}`:e.view===`manage-scans`&&e.scanMode===`link`?`${t}?mode=link`:e.view===`manage-scans`&&e.bundleId?`${t}?bundle=${encodeURIComponent(e.bundleId)}${e.scanMode===`dependencies`?`&mode=dependencies`:``}`:e.view===`manage-history`&&e.actor?`${t}?actor=${encodeURIComponent(e.actor)}`:t}if(![`findings`,`files`].includes(e.view)||!e.teamSlug||[e.teamSlug,e.reportSlug].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e)))return null;let n=`/team/${encodeURIComponent(e.teamSlug)}`,r=e.reportSlug?`/report/${encodeURIComponent(e.reportSlug)}`:``;if(e.finding){let t=L(e.finding.id);return e.view===`findings`&&t?`${n}${r}${t}`:null}return e.view===`files`?`${n}${r}/files`:`${n}${r}${r?``:ie(e.filters)}`}var R=new Set([`overview`,`code`,`search`,`compare`,`review`,`treemap`]),z=e=>y(e?.hash)&&(e.repoId==null?e.commit==null&&e.path==null:(J(e.repoId)||typeof e.repoId==`string`&&c(e.repoId))&&q.test(e.commit??``)&&(e.path==null||b(e.path)));function B(e){if(e.packageName==null)return`/npm`;let t=e.bundleTab??`overview`;if(!_(e.packageName)||e.packageSpec!=null&&!v(e.packageSpec)||!R.has(t)||e.compareSpec!=null&&!v(e.compareSpec))return null;if(t===`review`){if(e.reviewPackage!=null&&!_(e.reviewPackage)||e.reviewSpec!=null&&!v(e.reviewSpec)||e.patch!=null&&!z(e.patch)||e.basePatch!=null&&(!y(e.basePatch)||e.reviewPackage==null))return null;let t=e.reviewPackage==null?``:`/${e.reviewPackage}${e.reviewSpec==null?``:`@${e.reviewSpec}`}`,{patch:n}=e,r=[...n==null?[]:[`patch=${n.hash}`],...n?.repoId==null?[]:[`repo=${n.repoId}&commit=${n.commit}`],...n?.path==null?[]:[`path=${n.path.split(`/`).map(encodeURIComponent).join(`/`)}`],...e.basePatch==null?[]:[`basePatch=${e.basePatch}`],...E(e)].join(`&`);return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}/review${t}${r?`?${r}`:``}`}let n=t===`code`&&Z(e.file)?`/${e.file}`:``,r=n&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``,i=t===`compare`&&e.compareSpec!=null?`/${e.compareSpec}${M(e.compareMode)}`:``;return`/npm/${e.packageName}${e.packageSpec==null?``:`@${e.packageSpec}`}${t===`overview`?``:`/${t}`}${n}${i}${r}`}function V(e,t,n){let r=/^\/npm\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?\/review(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?)?$/u.exec(e);if(r){if(!_(r[1])||r[2]!=null&&!v(r[2])||r[3]!=null&&!_(r[3])||r[4]!=null&&!v(r[4]))return null;let e=r[3]&&/^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(r[3])&&r[4]==null,t=[`repo`,`commit`,`path`].some(e=>n.has(e))?{repoId:/^[1-9]\d*$/u.test(n.get(`repo`)??``)?Number(n.get(`repo`)):n.get(`repo`),commit:n.get(`commit`)}:{},i=n.has(`patch`)?{hash:n.get(`patch`),...t,...n.has(`path`)?{path:n.get(`path`)}:{}}:null,a=n.get(`basePatch`);return i&&!z(i)||a!==null&&(!y(a)||!r[3])?null:{view:`npm`,packageName:r[1],packageSpec:r[2]??null,bundleTab:`review`,...r[3]?{reviewPackage:e?r[1]:r[3],reviewSpec:e?r[3]:r[4]??null}:{},...i?{patch:i}:{},...a?{basePatch:a}:{},...D(n)}}let i=/^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e);if(!i)return;if(i[1]==null)return{view:`npm`};if(!_(i[1])||i[2]!=null&&!v(i[2]))return null;let a={view:`npm`,packageName:i[1],packageSpec:i[2]??null,bundleTab:i[3]??`overview`};if(i[4]==null)return a;if(a.bundleTab===`compare`)return v(i[4])&&(i[5]==null||k.has(i[5]))?{...a,compareSpec:i[4],...j(i[5])}:null;if(a.bundleTab!==`code`)return null;let o=Number(i[4]);return!i[5]&&/^[1-9]\d*$/u.test(i[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(t)}:null}var H=new Set([`code`,`search`,`treemap`,`compare`,`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),U=new Set([`commits`,`issues`,`pulls`,`agents`,`pulse`,`replay`]),W=new Map([[`issues`,new Set([`closed`])],[`pulls`,new Set([`closed`])],[`pulse`,new Set([`week`,`quarter`,`year`])],[`replay`,new Set([`100`,`1000`])]]),G=/^[a-z][a-z\d-]{0,31}$/u,K=(e,t)=>e===`agents`?typeof t==`string`&&G.test(t)&&t!==`all`:W.get(e)?.has(t)===!0,q=/^[a-f\d]{40}$/u,oe=500,J=e=>Number.isSafeInteger(e)&&e>0;function Y(e){return typeof e==`string`&&(e===``||e.length<=oe&&!/[\p{Cc}\\]/u.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e===e.trim()))}function se(e){let t=e.bundleTab??`code`,n=e.path??``;if(!J(e.repoId)||e.commit!=null&&!q.test(e.commit)||!Y(n)||!H.has(t)||e.compareCommit!=null&&!q.test(e.compareCommit))return null;let r=n?`?path=${n.split(`/`).map(encodeURIComponent).join(`/`)}`:``;if(e.commit==null)return`/repo/${e.repoId}${r}`;let i=t===`code`&&Z(e.file)?`/code/${e.file}`:t===`code`?``:`/${t}`,a=t===`compare`&&e.compareCommit!=null?`/${e.compareCommit}${M(e.compareMode)}`:``,o=K(t,e.subtab)?`/${e.subtab}`:``,s=t===`code`&&Z(e.file)&&Z(e.line)?`#L${e.line}${Z(e.endLine)&&e.endLine>e.line?`-L${e.endLine}`:``}`:``;return`/repo/${e.repoId}/${e.commit}${i}${a}${o}${r}${s}`}function X(e){let t=/^\/(?:repo|manage\/code)\/([1-9]\d*)(?:\/([a-f\d]{40})(?:\/(code|search|treemap|compare|commits|history|issues|pulls|agents|pulse|replay)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(e.pathname.replace(/\/$/u,``));if(!t)return;let n=Number(t[1]),r=e.searchParams.get(`path`)??``,i=t[3]===`history`?`commits`:t[3]??`code`;if(!J(n)||!Y(r))return null;let a={view:`repository-code`,repoId:n,commit:t[2]??null,path:r,bundleTab:i};if(t[4]==null)return a;if(i===`compare`)return q.test(t[4])&&(t[5]==null||k.has(t[5]))?{...a,compareCommit:t[4],...j(t[5])}:null;if(U.has(i))return t[5]==null&&K(i,t[4])?{...a,subtab:t[4]}:null;let o=Number(t[4]);return i===`code`&&t[5]==null&&/^[1-9]\d*$/u.test(t[4])&&Number.isSafeInteger(o)?{...a,file:o,...Q(e.hash)}:null}function Z(e){return Number.isSafeInteger(e)&&e>0}function Q(e){let t=/^#L([1-9]\d*)(?:-L([1-9]\d*))?$/u.exec(e),[n,r]=t?[Number(t[1]),Number(t[2]??t[1])]:[];return!Z(n)||!Z(r)?{}:n===r?{line:n}:{line:Math.min(n,r),endLine:Math.max(n,r)}}function ce(e){let n=e.pathname.replace(/\/$/u,``)||`/`;if(n===`/`||n===`/index.html`)return{view:`home`};if(n===`/my/reviews`)return{view:`reviews`};if(n===`/my/profile`){let t=e.searchParams.get(`link-error`);return{view:`profile`,...t&&/^[a-z-]{1,64}$/u.test(t)?{linkError:t}:{}}}let r=Object.keys(N).find(e=>N[e]===n);if(r){let t=Number(e.searchParams.get(`createRepo`));return{view:r,...r===`manage-deduplication`&&e.searchParams.get(`report`)?{linkId:e.searchParams.get(`report`)}:{},...r===`manage-bundles`&&Number.isSafeInteger(t)&&t>0?{createRepoId:t}:{},...r===`manage-history`&&e.searchParams.get(`actor`)?{actor:e.searchParams.get(`actor`)}:{},...r===`manage-scans`?e.searchParams.get(`mode`)===`link`?{scanMode:`link`}:e.searchParams.get(`bundle`)?{bundleId:e.searchParams.get(`bundle`),...e.searchParams.get(`mode`)===`dependencies`?{scanMode:`dependencies`}:{}}:{}:{}}}let a=/^(?:\/team\/([A-Za-z0-9_-]+)|\/manage)\/bundle\/([A-Za-z0-9_-]+)(?:\/([a-z]+)(?:\/([A-Za-z0-9_-]+)(?:\/([a-z]+))?)?)?$/u.exec(n);if(a){let n=a[3]??`overview`;if(!t.has(n))return null;let r={view:`bundles`,teamSlug:a[1]??null,bundleSlug:a[2],bundleTab:n};if(a[4]==null)return r;if(n===`compare`)return a[5]==null||k.has(a[5])?{...r,compareSlug:a[4],...j(a[5])}:null;let i=Number(a[4]);return n!==`code`||a[5]||!/^[1-9]\d*$/u.test(a[4])||!Number.isSafeInteger(i)?null:{...r,file:i,...Q(e.hash)}}let o=V(n,e.hash,e.searchParams);if(o!==void 0)return o;let s=X(e);if(s!==void 0)return s;let c=/^\/team\/([A-Za-z0-9_-]+)\/(reports|bundles|repositories|dependencies)$/u.exec(n);if(c)return{view:`workspace-${c[2]}`,teamSlug:c[1]};let l=/^\/team\/([A-Za-z0-9_-]+)\/dependencies\/([a-z]+)$/u.exec(n);if(l)return F.has(l[2])?{view:`workspace-dependencies`,teamSlug:l[1],dependencyTab:l[2]}:null;let u=/^\/team\/([^/]+)(?:\/report\/([^/]+))?(?:\/(files)|\/finding\/([^/]+))?$/u.exec(n);if(!u)return C(n)??null;try{let t=decodeURIComponent(u[1]),n=u[2]?decodeURIComponent(u[2]):null;if([t,n].some(e=>e!=null&&!/^[A-Za-z0-9_-]+$/u.test(e))||u[4]?.length>i*9)return null;let r=u[4]?decodeURIComponent(u[4]):null;return r!=null&&!L(r)?null:u[3]?{view:`files`,teamSlug:t,reportSlug:n}:r==null?{view:`findings`,teamSlug:t,reportSlug:n,...n==null?re(e.searchParams):{}}:{view:`findings`,teamSlug:t,reportSlug:n,finding:{id:r}}}catch{return null}}function $(e,t,n=[]){if(P.has(e.view)){let n=t.filter(t=>t.slug===e.teamSlug);return n.length===1?{view:e.view,teamId:n[0].id,...I(e)}:null}if(e.view===`bundles`){let{teamSlug:r,bundleSlug:i,compareSlug:a,compareMode:o,...s}=e,c=r==null?[]:t.filter(e=>e.slug===r);if(r!=null&&c.length!==1)return null;let l=c[0],u=r==null?n:t.flatMap(e=>e.bundles??[]),d=e=>new Set(u.filter(t=>t.slug===e).map(e=>e.id)),f=d(i),p=(l?.bundles??n).find(e=>e.slug===i);if(!i||!p||f.size!==1)return null;let m=a==null?null:d(a),h=m?.size===1?{compareId:[...m][0],...j(o)}:{};return{...s,teamId:l?.id??null,bundleId:p.id,...h}}if(![`findings`,`files`].includes(e.view))return e;let{teamSlug:r,reportSlug:i,...a}=e,o=t.filter(e=>e.slug===r),s=r&&o.length===1?o[0]:null,c=new Set(t.flatMap(e=>e.reports??[]).filter(e=>e.slug===i).map(e=>e.id)),l=i!=null&&c.size===1?[...c][0]:null;return a.finding?{...a,teamId:s?.id??null,reportId:l,teamOnly:i==null}:s?i==null?{...a,teamId:s.id,reportId:null}:(s.reports??[]).some(e=>e.id===l)?{...a,teamId:s.id,reportId:l}:null:null}function le(e,t,n=[]){if(P.has(e.view)){let n=t.find(t=>t.id===e.teamId),r={view:e.view,teamSlug:n?.slug,...I(e)};return n?.slug&&$(r,t)?r:null}if(e.view===`bundles`){let{teamId:r,bundleId:i,compareId:a,compareMode:o,...s}=e,c=t.find(e=>e.id===r);if(r!=null&&!c?.slug)return null;let l=(c?.bundles??n).find(e=>e.id===i);if(!l?.slug)return null;let u=a==null?null:(r==null?n:t.flatMap(e=>e.bundles??[])).find(e=>e.id===a),d={...s,teamSlug:c?.slug??null,bundleSlug:l.slug,...u?.slug?{compareSlug:u.slug,...j(o)}:{}},f=$(d,t,n);if(!f)return null;if(d.compareSlug!=null&&f.compareId!==a){let{compareSlug:e,compareMode:t,...n}=d;return n}return d}if(![`findings`,`files`].includes(e.view))return e;let{teamId:r,reportId:i,...a}=e,o=t.find(e=>e.id===r),s=i==null?null:o?.reports?.find(e=>e.id===i);if(!o?.slug||i!=null&&!s?.slug)return null;let c={...a,teamSlug:o.slug,reportSlug:s?.slug??null},l=$(c,t);return l?.teamId===o.id&&l.reportId===(s?.id??null)?c:null}export{t as a,i as b,o as c,s as d,u as e,d as f,f as g,p as h,_ as i,v as j,y as k,b as l,te as m,A as n,j as o,N as p,F as q,ae as r,R as s,H as t,U as u,K as v,ce as w,$ as x,le as y};
|
package/out/chunk-74AEKRES.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as e,b as t,c as n}from"./chunk-C4Z6ZBXV.js";import{f as r,g as i}from"./chunk-2XUEZHIP.js";var a=class extends n{constructor(t){if(super(t),this.it=i,t.type!==e.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(e){if(e===i||e==null)return this._t=void 0,this.it=e;if(e===r)return e;if(typeof e!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};a.directiveName=`unsafeHTML`,a.resultType=1;var o=t(a),s=/^/u,c=/^true$/u,l=/^[\w .,#%()-]*$/u,u=Object.fromEntries([`fill`,`fill-opacity`,`fill-rule`,`clip-rule`,`stroke`,`stroke-width`,`stroke-linecap`,`stroke-linejoin`,`stroke-opacity`,`stroke-dasharray`,`opacity`,`transform`].map(e=>[e,l])),d=(...e)=>({...u,...Object.fromEntries(e.map(e=>[e,l]))}),f=new Set;function p(e){for(let t of e)f.add(t)}var m=e=>{let[t,...n]=e.split(` `);return t===`token`&&n.every(e=>f.has(e)||/^language-[\w-]+$/u.test(e))},h={__proto__:null,span:{class:{test:e=>m(e)||/^(?:code-control|evd-lineno|report-logo brand-[\w-]+)$/u.test(e)},title:s,"data-tooltip":s,"aria-hidden":c},mark:{class:/^diff-word$/u},code:{class:/^evd-line$/u},button:{type:/^button$/u,class:/^bundle-source-link$/u,"data-bundle-source-link":s},a:{class:/^source-node-doc$/u,href:/^https:\/\/nodejs\.org\/api\/[\w/-]+\.html(?:#[\w-]*)?$/u,target:/^_blank$/u,rel:/^noopener noreferrer$/u,"aria-label":s},svg:{...d(`viewBox`,`width`,`height`),class:/^file-icon(?: brand-[\w-]+)?$/u,"aria-hidden":c},g:u,path:{...d(`d`),class:/^(?:bg|fg)$/u},rect:d(`x`,`y`,`width`,`height`,`rx`,`ry`),circle:d(`cx`,`cy`,`r`),ellipse:d(`cx`,`cy`,`rx`,`ry`),line:d(`x1`,`y1`,`x2`,`y2`),polyline:d(`points`),polygon:d(`points`)},g=/<(?:([a-z]+)((?:[\t\n\f\r ]+[a-zA-Z][\w-]*="[^"]*")*)[\t\n\f\r ]*\/?|\/([a-z]+)[\t\n\f\r ]*)>/uy,_=/([a-zA-Z][\w-]*)="([^"]*)"/gu;function v(e){if(typeof e!=`string`)return!1;for(let t=e.indexOf(`<`);t!==-1;t=e.indexOf(`<`,g.lastIndex)){g.lastIndex=t;let[,n,r,i]=g.exec(e)??[],a=h[n??i];if(!a)return!1;for(let[,e,t]of r?.matchAll(_)??[])if(!Object.hasOwn(a,e)||!a[e].test(t))return!1}return!0}function y(e){return console.error(`Not markup this app writes, shown as text instead:`,e.length>300?`${e.slice(0,300)}\u2026`:e),e}var b=new Set;function x(e){return e==null||e===i?e:b.has(e)?o(e):v(e)?(b.size>=256&&b.clear(),b.add(e),o(e)):y(String(e))}var S=`m5.875 10.154 1.376-.772.023-.067-.023-.037h-.067l-.23-.015-.787-.02-.681-.03-.661-.035-.166-.035-.156-.205.016-.103.14-.094.2.018.442.03.665.046.481.028.714.075h.113l.016-.047-.039-.028-.03-.028-.687-.466-.744-.492-.39-.284-.21-.143-.106-.135-.046-.294.19-.21.258.017.065.018.26.2.557.43.726.535.106.089.042-.03.006-.022-.048-.08-.395-.713-.422-.726-.187-.301-.05-.18a1 1 0 0 1-.03-.213l.218-.296.12-.039.29.039.123.106.18.413.293.65.453.884.133.262.07.242.027.075h.046v-.043l.038-.497.069-.611.067-.787.023-.221.11-.266.218-.143.17.081.14.2-.02.13-.083.54-.163.846-.106.567h.062l.07-.07.287-.382.482-.602.213-.239.248-.264.159-.125h.301l.221.329-.099.34-.31.393-.256.333-.369.496-.23.397.021.032.055-.006.832-.177.45-.081.537-.092.243.113.026.115-.096.236-.573.141-.673.135-1.003.237-.012.01.014.017.452.042.193.01h.473l.88.066.23.153.138.186-.023.141-.354.181-.478-.113-1.116-.266-.383-.096h-.053v.032l.32.312.584.528.731.68.037.168-.094.133-.099-.014-.643-.484-.248-.218-.561-.472H9.08v.05l.129.189.684 1.027.035.315-.05.103-.177.062-.194-.036-.4-.561-.413-.632-.333-.567-.041.023-.197 2.116-.092.108-.212.082-.177-.135-.094-.218.094-.43.113-.561.092-.447.083-.554.05-.184-.004-.013-.04.006-.418.574-.636.858-.503.539-.12.048-.21-.108.02-.193.117-.172.696-.886.42-.549.27-.317-.001-.046h-.016l-1.85 1.201-.328.042-.142-.132.018-.218.067-.071.556-.383Z`,C=`M11.04 8.364a1.72 1.72 0 0 0-.152-1.432 1.8 1.8 0 0 0-1.925-.846 1.8 1.8 0 0 0-.778-.498 1.8 1.8 0 0 0-.927-.05 1.8 1.8 0 0 0-.827.414 1.77 1.77 0 0 0-.507.767 1.8 1.8 0 0 0-.683.297 1.75 1.75 0 0 0-.499.549 1.75 1.75 0 0 0 .22 2.07 1.72 1.72 0 0 0 .151 1.432 1.8 1.8 0 0 0 1.926.846 1.77 1.77 0 0 0 1.333.587c.78 0 1.47-.496 1.707-1.227a1.8 1.8 0 0 0 .684-.298 1.75 1.75 0 0 0 .499-.548 1.75 1.75 0 0 0-.222-2.063m-2.667 3.678a1.33 1.33 0 0 1-.851-.304l.042-.024 1.413-.804a.23.23 0 0 0 .116-.199V8.747l.597.34q.01.005.011.015v1.629a1.323 1.323 0 0 1-1.328 1.31m-2.857-1.203a1.3 1.3 0 0 1-.158-.879l.042.025 1.414.805a.23.23 0 0 0 .23 0l1.729-.982v.68a.02.02 0 0 1-.01.018l-1.431.814a1.34 1.34 0 0 1-1.816-.48m-.372-3.037a1.32 1.32 0 0 1 .7-.574v1.656a.22.22 0 0 0 .114.197l1.72.979-.598.34a.02.02 0 0 1-.021 0L5.63 9.587a1.304 1.304 0 0 1-.487-1.791zm4.907 1.125L8.327 7.94l.596-.34a.02.02 0 0 1 .02 0l1.43.814a1.3 1.3 0 0 1 .512.528 1.3 1.3 0 0 1-.118 1.4 1.33 1.33 0 0 1-.595.436V9.122a.23.23 0 0 0-.12-.195m.594-.881-.042-.025-1.411-.812a.23.23 0 0 0-.232 0l-1.727.983v-.68a.02.02 0 0 1 .008-.018l1.429-.813a1.34 1.34 0 0 1 1.425.061 1.3 1.3 0 0 1 .55 1.298zM6.908 9.252l-.597-.34a.02.02 0 0 1-.012-.016V7.271c0-.249.073-.493.209-.703s.329-.378.557-.483a1.35 1.35 0 0 1 1.415.18l-.042.023-1.413.804a.23.23 0 0 0-.116.2zm.324-.69.77-.438.77.438v.875l-.768.437-.77-.437z`,w=`M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z`,T=`M11.998 24c-.321 0-.641-.084-.922-.247l-2.936-1.737c-.438-.245-.224-.332-.08-.383c.585-.203.703-.25 1.328-.604c.065-.037.151-.023.218.017l2.256 1.339c.082.045.197.045.272 0l8.795-5.076c.082-.047.134-.141.134-.238V6.921c0-.099-.053-.192-.137-.242l-8.791-5.072c-.081-.047-.189-.047-.271 0L3.075 6.68C2.99 6.729 2.936 6.825 2.936 6.921v10.15c0 .097.054.189.139.235l2.409 1.392c1.307.654 2.108-.116 2.108-.89V7.787c0-.142.114-.253.256-.253h1.115c.139 0 .255.112.255.253v10.021c0 1.745-.95 2.745-2.604 2.745c-.508 0-.909 0-2.026-.551L2.28 18.675c-.57-.329-.922-.945-.922-1.604V6.921c0-.659.353-1.275.922-1.603l8.795-5.082c.557-.315 1.296-.315 1.848 0l8.794 5.082c.57.329.924.944.924 1.603v10.15c0 .659-.354 1.273-.924 1.604l-8.794 5.078C12.643 23.916 12.324 24 11.998 24zM19.099 13.993c0-1.9-1.284-2.406-3.987-2.763c-2.731-.361-3.009-.548-3.009-1.187c0-.528.235-1.233 2.258-1.233c1.807 0 2.473.389 2.747 1.607c.024.115.129.199.247.199h1.141c.071 0 .138-.031.186-.081c.048-.054.074-.123.067-.196c-.177-2.098-1.571-3.076-4.388-3.076c-2.508 0-4.004 1.058-4.004 2.833c0 1.925 1.488 2.457 3.895 2.695c2.88.282 3.103.703 3.103 1.269c0 .983-.789 1.402-2.642 1.402c-2.327 0-2.839-.584-3.011-1.742c-.02-.124-.126-.215-.253-.215h-1.137c-.141 0-.254.112-.254.253c0 1.482.806 3.248 4.655 3.248C17.501 17.007 19.099 15.91 19.099 13.993z`,E=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 2 2 5v6l6 3 6-3V5L8 2Z"/><path d="M2 5l6 3 6-3"/><path d="M8 8v6"/></svg>`,D=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M1 1h14v14H1Zm3 3v8h4V6h2v6h2V4Z"/></svg>`,O=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="4" width="11" height="9" rx="1.2"/><path d="M6 4V3h4v1"/></svg>`,k=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" aria-hidden="true"><path d="m4.5 4.5 7 2-5 5z"/><circle cx="4.5" cy="4.5" r="2" fill="currentColor"/><circle cx="11.5" cy="6.5" r="2" fill="currentColor"/><circle cx="6.5" cy="11.5" r="2" fill="currentColor"/></svg>`,A=`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><rect x="1" y="1.5" width="14" height="3" rx=".5"/><rect x="1" y="6.5" width="8" height="3" rx=".5"/><rect x="11" y="6.5" width="4" height="3" rx=".5"/><rect x="1" y="11.5" width="4" height="3" rx=".5"/><rect x="7" y="11.5" width="8" height="3" rx=".5"/></svg>`,j=`<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M1 1h4v4H1zm5 5h4v4H6zm5 5h4v4h-4z"/><path d="M6 1h4v4H6zm5 0h4v4h-4zM1 6h4v4H1zm10 0h4v4h-4zM1 11h4v4H1zm5 0h4v4H6z" opacity=".35"/></svg>`,M=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" aria-hidden="true"><rect x="1" y="1" width="14" height="2.5" rx=".5" fill="currentColor" stroke="none"/><rect x="1" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><rect x="6.25" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><rect x="11.5" y="12" width="3.5" height="3" rx=".5" fill="currentColor" stroke="none"/><path d="M4 3.5c0 4.5-1.25 4-1.25 8.5M8 3.5v8.5M12 3.5c0 4.5 1.25 4 1.25 8.5"/></svg>`,N=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="8" cy="2.5" r="1.5" fill="currentColor"/><circle cx="3" cy="13" r="1.5" fill="currentColor"/><circle cx="8" cy="13" r="1.5" fill="currentColor"/><circle cx="13" cy="13" r="1.5" fill="currentColor"/><path d="M8 4v3M8 7H3m5 0h5M3 7v4M8 7v4M13 7v4"/></svg>`,P=`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>`,F=`<svg class="file-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.67 8.67a3.33 3.33 0 0 0 5.03.36l2-2a3.33 3.33 0 0 0-4.71-4.71l-1.15 1.14"/><path d="M9.33 7.33a3.33 3.33 0 0 0-5.03-.36l-2 2a3.33 3.33 0 0 0 4.71 4.71l1.14-1.14"/></svg>`,I=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 1.5H2.5a1 1 0 0 0-1 1V5m9.5-3.5h2.5a1 1 0 0 1 1 1V5M1.5 11v2.5a1 1 0 0 0 1 1H5m6 0h2.5a1 1 0 0 0 1-1V11"/><circle cx="7.25" cy="7.25" r="2.75"/><path d="m9.25 9.25 2.25 2.25"/></svg>`,L=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 1.5H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5.5L9 1.5ZM9 1.5v4h4M5.5 8h5m-5 3h3.5"/></svg>`,R=`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V2H6.5A2.5 2.5 0 0 0 4 4.5zM4 19.5A2.5 2.5 0 0 0 6.5 22H20v-5"/></svg>`,z=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m4.5 4.5-3 3.5 3 3.5m7-7 3 3.5-3 3.5M9.5 2l-3 12"/></svg>`,B=`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6.5 3.5 1.6 3.9L12 9l-3.9 1.6-1.6 3.9-1.6-3.9L1 9l3.9-1.6 1.6-3.9ZM12 1.5v4m-2-2h4"/></svg>`,V=`<svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>`,H=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.5v2"/><rect x="2" y="3.5" width="12" height="10" rx="2.5"/><path d="M6 7.5v2m4-2v2"/></svg>`,U=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true"><path d="M1 8h3.5m7 0H15"/><circle cx="8" cy="8" r="3.5"/></svg>`,W=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4" cy="3.5" r="1.5"/><circle cx="4" cy="12.5" r="1.5"/><circle cx="12" cy="12.5" r="1.5"/><path d="M4 5v6M12 11V6a2 2 0 0 0-2-2H7m1.5-1.5L7 4l1.5 1.5"/></svg>`,G=`<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round" aria-hidden="true"><path d="M2 2h5.5l6.5 6.5-5.5 5.5L2 7.5Z"/><circle cx="5" cy="5" r="1"/></svg>`,K=`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m10 2 4 4-8 8H2v-4l8-8Zm-1 1 4 4"/></svg>`,q=`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 4h12M6 4V2h4v2M4 4l.6 10h6.8L12 4M6.5 7v4m3-4v4"/></svg>`;export{p as a,v as b,y as c,x as d,S as e,C as f,w as g,T as h,E as i,D as j,O as k,k as l,A as m,j as n,M as o,N as p,P as q,F as r,I as s,L as t,R as u,z as v,B as w,V as x,H as y,U as z,W as A,G as B,K as C,q as D};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
lit-html/directives/unsafe-html.js:
|
|
5
|
-
(**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*)
|
|
10
|
-
*/
|