termdock 1.0.0 → 1.0.2
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/dist/client/assets/{abnfDiagram-VRR7QNED-D0NxeSHA.js → abnfDiagram-VRR7QNED-BjNCcQvm.js} +1 -1
- package/dist/client/assets/{arc-B7GoKc6u.js → arc-xcCAKMnT.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZJ3FMSHR-BQPW-wUx.js → architectureDiagram-ZJ3FMSHR-ijtAKPsW.js} +1 -1
- package/dist/client/assets/{blockDiagram-677ZJIJ3-CX_hbcgG.js → blockDiagram-677ZJIJ3-GVIbuo6R.js} +1 -1
- package/dist/client/assets/{c4Diagram-LMCZKHZV-BwOMQA4x.js → c4Diagram-LMCZKHZV-B3IbU0ga.js} +1 -1
- package/dist/client/assets/channel-Fzeh-Sl6.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-BLJzEQXz.js → chunk-2Q5K7J3B-DEwVqhvo.js} +1 -1
- package/dist/client/assets/{chunk-32BRIVSS-CjBDr_gz.js → chunk-32BRIVSS-CGNuIJuG.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-lddvv0x2.js → chunk-5VM5RSS4-DliA2ku3.js} +1 -1
- package/dist/client/assets/{chunk-EX3LRPZG-Dtsq1Stg.js → chunk-EX3LRPZG-DzFXj1M3.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BG3PZx4j.js → chunk-JWPE2WC7-h3s-pxcn.js} +1 -1
- package/dist/client/assets/{chunk-MOJQB5TN-CMtlCuQg.js → chunk-MOJQB5TN-CQST9jsX.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-uplKqw64.js → chunk-RYQCIY6F-CXjnUh8k.js} +1 -1
- package/dist/client/assets/{chunk-V7JOEXUC-CpteLsY3.js → chunk-V7JOEXUC-CI7QyRAs.js} +1 -1
- package/dist/client/assets/{chunk-VR4S4FIN-1zYOJQXL.js → chunk-VR4S4FIN-DYQ8EokS.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C0wXH91I.js → chunk-XXDRQBXY-BM9jxTTb.js} +1 -1
- package/dist/client/assets/classDiagram-OUVF2IWQ-DzF9pacK.js +1 -0
- package/dist/client/assets/classDiagram-v2-EOCWNBFH-DzF9pacK.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-BceT5ki2.js → cose-bilkent-JH36ORCC-C4nYmp4I.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-BqCIkNeC.js → cynefin-VYW2F7L2-DnlhMeVt.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-TSTJHNR4-Dm7y-tsN.js → cynefinDiagram-TSTJHNR4-DJuHDI6A.js} +1 -1
- package/dist/client/assets/{dagre-VKFMJZFB-Bn8eh0lE.js → dagre-VKFMJZFB-CsBEz_S1.js} +1 -1
- package/dist/client/assets/{diagram-FQU43EPY-DmZGMAsX.js → diagram-FQU43EPY-BDNTGROP.js} +1 -1
- package/dist/client/assets/{diagram-G47NLZAW-BLWSm_Rn.js → diagram-G47NLZAW-CJJwi6PP.js} +1 -1
- package/dist/client/assets/{diagram-NH7WQ7WH-C2-HK8pv.js → diagram-NH7WQ7WH-CXJWffic.js} +1 -1
- package/dist/client/assets/{diagram-OA4YK3LP-8Ex4XIU5.js → diagram-OA4YK3LP-wOtL7NBA.js} +1 -1
- package/dist/client/assets/{diagram-WEI45ONY-MRNIpBXG.js → diagram-WEI45ONY-ClOt2G7I.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-CCIWWBDH-D7Z6wZi_.js → ebnfDiagram-CCIWWBDH-DoXhiNjK.js} +1 -1
- package/dist/client/assets/{erDiagram-Q63AITRT-C96Q5x9y.js → erDiagram-Q63AITRT-DB5a-Aw4.js} +1 -1
- package/dist/client/assets/{flowDiagram-23GEKE2U-DzQp40QH.js → flowDiagram-23GEKE2U-Cz9w-F5K.js} +1 -1
- package/dist/client/assets/{ganttDiagram-NO4QXBWP-ZzkchZJ8.js → ganttDiagram-NO4QXBWP-CDykkj3o.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-IHSO6WYX-CFacEf54.js → gitGraphDiagram-IHSO6WYX-CNkfDkzA.js} +1 -1
- package/dist/client/assets/{index-XktPMm51.js → index-0d_16SRD.js} +80 -80
- package/dist/client/assets/{infoDiagram-FWYZ7A6U-CVRXs5rF.js → infoDiagram-FWYZ7A6U-CfrwrocT.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-FXEZZL3T-B8FP_wzM.js → ishikawaDiagram-FXEZZL3T-C2AD_Ae2.js} +1 -1
- package/dist/client/assets/{journeyDiagram-5HDEW3XC-BR__4Hbd.js → journeyDiagram-5HDEW3XC-DzQvMG3N.js} +1 -1
- package/dist/client/assets/{kanban-definition-HUTT4EX6-v39oZe6X.js → kanban-definition-HUTT4EX6-CUVhWmNF.js} +1 -1
- package/dist/client/assets/{linear-jlTiHqO6.js → linear-D5qZ3q5c.js} +1 -1
- package/dist/client/assets/{mermaid.core-DiiIN0EC.js → mermaid.core-D-e_wdPJ.js} +4 -4
- package/dist/client/assets/{mindmap-definition-LN4V7U3C-AeUxAZeq.js → mindmap-definition-LN4V7U3C-CDHLWnzb.js} +1 -1
- package/dist/client/assets/{pegDiagram-2B236MQR-Dh-bgAbv.js → pegDiagram-2B236MQR-9_bnKT8u.js} +1 -1
- package/dist/client/assets/{pieDiagram-ENE6RG2P-De7Si7Tm.js → pieDiagram-ENE6RG2P-gw-xIG1b.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-ABIIQ3AL-CgWfHqy0.js → quadrantDiagram-ABIIQ3AL-Cn_lstJf.js} +1 -1
- package/dist/client/assets/{railroadDiagram-RFXS5EU6-BXnQW-pI.js → railroadDiagram-RFXS5EU6-yZM8qXUp.js} +1 -1
- package/dist/client/assets/{requirementDiagram-TGXJPOKE-CU1nnpUM.js → requirementDiagram-TGXJPOKE-WQ1iDS_X.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-HTMAVEWB-DFK-AXY6.js → sankeyDiagram-HTMAVEWB-UVz3wsFF.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-DBY2YBRQ-D_bVDWgq.js → sequenceDiagram-DBY2YBRQ-BuJBBGcB.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-nh89ExHT.js → sizeCapture-X5ZJPWSS-CysR04La.js} +1 -1
- package/dist/client/assets/{stateDiagram-2N3HPSRC-DUvT6Ruk.js → stateDiagram-2N3HPSRC-DYC8TYxP.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-6OUMAXLB-Cru4nzfa.js +1 -0
- package/dist/client/assets/{swimlanes-5IMT3BWC-ZYa52gjG.js → swimlanes-5IMT3BWC-FT83sDlI.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-G3AALYLV-DUvRCWFX.js +8 -0
- package/dist/client/assets/{timeline-definition-FHXFAJF6-Bp6A49KQ.js → timeline-definition-FHXFAJF6-C-o8uRSU.js} +1 -1
- package/dist/client/assets/{vennDiagram-L72KCM5P-CDDUmLOI.js → vennDiagram-L72KCM5P-Cw-g3-Li.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-EHGQE667-CRc2ptu7.js → wardleyDiagram-EHGQE667-B_JEirkb.js} +1 -1
- package/dist/client/assets/{xychartDiagram-FW5EYKEG-ht_S0LUA.js → xychartDiagram-FW5EYKEG-B1LkJSxz.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/sw.js +1 -1
- package/dist/client/workbox-abeb32eb.js +1 -0
- package/dist/server/routes/terminal.js +9 -1
- package/package.json +5 -3
- package/scripts/inspect-diff-trace.mjs +148 -0
- package/scripts/inspect-fs-io.mjs +107 -0
- package/scripts/patch-termdock-font.py +134 -0
- package/scripts/postinstall.mjs +80 -0
- package/dist/client/assets/channel-C2gUFcyU.js +0 -1
- package/dist/client/assets/classDiagram-OUVF2IWQ-BTOnA9HS.js +0 -1
- package/dist/client/assets/classDiagram-v2-EOCWNBFH-BTOnA9HS.js +0 -1
- package/dist/client/assets/stateDiagram-v2-6OUMAXLB-Dz-3r-Yq.js +0 -1
- package/dist/client/assets/swimlanesDiagram-G3AALYLV-DXR_9lf9.js +0 -8
- package/dist/client/workbox-e4022e15.js +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
const logPath = path.join(os.homedir(), '.termdock', 'fs-io.log');
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const query = args.find((arg) => !arg.startsWith('--')) ?? '';
|
|
9
|
+
const sinceMinutesArg = args.find((arg) => arg.startsWith('--since-min='));
|
|
10
|
+
const slowMsArg = args.find((arg) => arg.startsWith('--slow-ms='));
|
|
11
|
+
const sinceMinutes = sinceMinutesArg ? Number(sinceMinutesArg.split('=')[1]) : 30;
|
|
12
|
+
const slowMs = slowMsArg ? Number(slowMsArg.split('=')[1]) : 500;
|
|
13
|
+
const sinceTs = Number.isFinite(sinceMinutes) && sinceMinutes > 0
|
|
14
|
+
? Date.now() - sinceMinutes * 60_000
|
|
15
|
+
: 0;
|
|
16
|
+
|
|
17
|
+
if (!fs.existsSync(logPath)) {
|
|
18
|
+
console.error(`No fs-io log found at ${logPath}`);
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const records = [];
|
|
23
|
+
for (const line of fs.readFileSync(logPath, 'utf8').trimEnd().split('\n').filter(Boolean)) {
|
|
24
|
+
try {
|
|
25
|
+
const item = JSON.parse(line);
|
|
26
|
+
const ts = Date.parse(item.ts);
|
|
27
|
+
if (sinceTs && Number.isFinite(ts) && ts < sinceTs) continue;
|
|
28
|
+
const haystack = [
|
|
29
|
+
item.op,
|
|
30
|
+
item.action,
|
|
31
|
+
item.event,
|
|
32
|
+
item.status,
|
|
33
|
+
item.path,
|
|
34
|
+
item.cwd,
|
|
35
|
+
item.repoRoot,
|
|
36
|
+
item.code,
|
|
37
|
+
item.error,
|
|
38
|
+
item.requestSlotId,
|
|
39
|
+
item.previousRequestId,
|
|
40
|
+
].filter(Boolean).join(' ');
|
|
41
|
+
if (query && !haystack.includes(query)) continue;
|
|
42
|
+
records.push({ ...item, _time: Number.isFinite(ts) ? ts : 0 });
|
|
43
|
+
} catch {
|
|
44
|
+
// Ignore malformed lines.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (records.length === 0) {
|
|
49
|
+
console.log(`No fs-io records matched "${query}" in the last ${sinceMinutes} minute(s).`);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
records.sort((a, b) => a._time - b._time);
|
|
54
|
+
|
|
55
|
+
function short(value) {
|
|
56
|
+
if (!value || typeof value !== 'string') return '';
|
|
57
|
+
const home = os.homedir();
|
|
58
|
+
const normalized = value.startsWith(home) ? `~${value.slice(home.length)}` : value;
|
|
59
|
+
return normalized.length > 120 ? `...${normalized.slice(-117)}` : normalized;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function important(item) {
|
|
63
|
+
const duration = typeof item.durationMs === 'number' ? item.durationMs : 0;
|
|
64
|
+
return (
|
|
65
|
+
item.event === 'slot-cancel-previous'
|
|
66
|
+
|| item.event === 'git-child-abort-kill'
|
|
67
|
+
|| item.event === 'git-child-timeout-kill'
|
|
68
|
+
|| item.event === 'git-child-byte-limit-kill'
|
|
69
|
+
|| item.status === 'error'
|
|
70
|
+
|| item.code
|
|
71
|
+
|| item.error
|
|
72
|
+
|| duration >= slowMs
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const byOp = new Map();
|
|
77
|
+
for (const item of records) {
|
|
78
|
+
if (!item.op || item.event) continue;
|
|
79
|
+
const stat = byOp.get(item.op) ?? { count: 0, errors: 0, slow: 0, maxMs: 0 };
|
|
80
|
+
stat.count += 1;
|
|
81
|
+
if (item.status === 'error' || item.code || item.error) stat.errors += 1;
|
|
82
|
+
if ((item.durationMs ?? 0) >= slowMs) stat.slow += 1;
|
|
83
|
+
stat.maxMs = Math.max(stat.maxMs, item.durationMs ?? 0);
|
|
84
|
+
byOp.set(item.op, stat);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(`fs-io records: ${records.length}; since=${sinceMinutes}m; slow>=${slowMs}ms`);
|
|
88
|
+
if (byOp.size > 0) {
|
|
89
|
+
console.log('\nSummary by op:');
|
|
90
|
+
for (const [op, stat] of [...byOp.entries()].sort((a, b) => b[1].maxMs - a[1].maxMs)) {
|
|
91
|
+
console.log(` ${op.padEnd(14)} count=${String(stat.count).padStart(3)} slow=${String(stat.slow).padStart(3)} errors=${String(stat.errors).padStart(3)} max=${Math.round(stat.maxMs)}ms`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const notable = records.filter(important);
|
|
96
|
+
console.log(`\nNotable events: ${notable.length}`);
|
|
97
|
+
for (const item of notable.slice(-200)) {
|
|
98
|
+
const duration = item.durationMs !== undefined ? ` duration=${Math.round(item.durationMs)}ms` : '';
|
|
99
|
+
const count = item.count !== undefined ? ` count=${item.count}` : '';
|
|
100
|
+
const total = item.total !== undefined ? ` total=${item.total}` : '';
|
|
101
|
+
const slot = item.requestSlotId ? ` slot=${item.requestSlotId}` : '';
|
|
102
|
+
const previous = item.previousRequestId !== undefined ? ` previous=${item.previousRequestId}` : '';
|
|
103
|
+
const code = item.code ? ` code=${item.code}` : '';
|
|
104
|
+
const error = item.error ? ` error=${JSON.stringify(item.error)}` : '';
|
|
105
|
+
const target = item.path ? ` path=${short(item.path)}` : item.cwd ? ` cwd=${short(item.cwd)}` : '';
|
|
106
|
+
console.log(`${item.ts} ${String(item.op ?? '').padEnd(14)} ${String(item.event ?? item.status ?? '').padEnd(24)}${duration}${count}${total}${slot}${previous}${code}${error}${target}`);
|
|
107
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import copy
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from fontTools.ttLib import TTFont
|
|
9
|
+
from fontTools.ttLib.tables._g_l_y_f import Glyph, GlyphComponent
|
|
10
|
+
|
|
11
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
12
|
+
PATCH_FILE = ROOT / 'tools/font/termdock-glyph-patches.json'
|
|
13
|
+
FONT_DIR = ROOT / 'public/fonts'
|
|
14
|
+
WEIGHTS = ['Regular', 'Bold', 'Italic', 'BoldItalic']
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def parse_cp(value: str) -> int:
|
|
18
|
+
return int(value.replace('U+', ''), 16)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def build_cmap(font: TTFont) -> dict[int, str]:
|
|
22
|
+
cmap: dict[int, str] = {}
|
|
23
|
+
for table in font['cmap'].tables:
|
|
24
|
+
cmap.update(table.cmap)
|
|
25
|
+
return cmap
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def add_post_name(post, glyph_name: str) -> None:
|
|
29
|
+
if post and hasattr(post, 'extraNames') and hasattr(post, 'mapping'):
|
|
30
|
+
post.extraNames.append(glyph_name)
|
|
31
|
+
post.mapping[glyph_name] = glyph_name
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def add_unicode_mapping(font: TTFont, codepoint: int, glyph_name: str) -> None:
|
|
35
|
+
for table in font['cmap'].tables:
|
|
36
|
+
if table.isUnicode():
|
|
37
|
+
table.cmap[codepoint] = glyph_name
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def make_component(glyph_name: str, x: int, y: int, scale: float) -> GlyphComponent:
|
|
41
|
+
component = GlyphComponent()
|
|
42
|
+
component.glyphName = glyph_name
|
|
43
|
+
component.x = x
|
|
44
|
+
component.y = y
|
|
45
|
+
component.transform = ((scale, 0), (0, scale))
|
|
46
|
+
component.flags = 4
|
|
47
|
+
return component
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def add_black_diamond_minus_white_x(font: TTFont, cmap: dict[int, str], glyph_order: list[str], post) -> int:
|
|
51
|
+
dst_cp = 0x2756
|
|
52
|
+
if dst_cp in cmap:
|
|
53
|
+
return 0
|
|
54
|
+
src_name = cmap.get(0x25C6)
|
|
55
|
+
if not src_name:
|
|
56
|
+
print('missing source U+25C6 for U+2756', file=sys.stderr)
|
|
57
|
+
return 0
|
|
58
|
+
dst_name = 'termdock_uni2756'
|
|
59
|
+
if dst_name in glyph_order:
|
|
60
|
+
return 0
|
|
61
|
+
|
|
62
|
+
glyph = Glyph()
|
|
63
|
+
glyph.numberOfContours = -1
|
|
64
|
+
# Four small black diamonds arranged around the center. The source diamond
|
|
65
|
+
# is 600 units wide; scale 0.34 keeps the composite visually distinct from
|
|
66
|
+
# U+25C6 while staying inside a single terminal cell.
|
|
67
|
+
scale = 0.34
|
|
68
|
+
glyph.components = [
|
|
69
|
+
make_component(src_name, 198, 436, scale),
|
|
70
|
+
make_component(src_name, 198, 100, scale),
|
|
71
|
+
make_component(src_name, 30, 268, scale),
|
|
72
|
+
make_component(src_name, 366, 268, scale),
|
|
73
|
+
]
|
|
74
|
+
glyph_order.append(dst_name)
|
|
75
|
+
font['glyf'].glyphs[dst_name] = glyph
|
|
76
|
+
font['hmtx'].metrics[dst_name] = copy.deepcopy(font['hmtx'].metrics[src_name])
|
|
77
|
+
add_post_name(post, dst_name)
|
|
78
|
+
add_unicode_mapping(font, dst_cp, dst_name)
|
|
79
|
+
cmap[dst_cp] = dst_name
|
|
80
|
+
return 1
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def patch_font(path: Path, aliases: dict[int, int]) -> int:
|
|
84
|
+
font = TTFont(path)
|
|
85
|
+
cmap = build_cmap(font)
|
|
86
|
+
glyph_order = font.getGlyphOrder()
|
|
87
|
+
glyf = font['glyf']
|
|
88
|
+
hmtx = font['hmtx']
|
|
89
|
+
post = font['post'] if 'post' in font else None
|
|
90
|
+
patched = add_black_diamond_minus_white_x(font, cmap, glyph_order, post)
|
|
91
|
+
|
|
92
|
+
for dst_cp, src_cp in aliases.items():
|
|
93
|
+
if dst_cp in cmap:
|
|
94
|
+
continue
|
|
95
|
+
src_name = cmap.get(src_cp)
|
|
96
|
+
if not src_name:
|
|
97
|
+
print(f'{path.name}: missing source U+{src_cp:04X}', file=sys.stderr)
|
|
98
|
+
continue
|
|
99
|
+
dst_name = f'termdock_uni{dst_cp:04X}'
|
|
100
|
+
if dst_name in glyph_order:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
glyph_order.append(dst_name)
|
|
104
|
+
glyf.glyphs[dst_name] = copy.deepcopy(glyf[src_name])
|
|
105
|
+
hmtx.metrics[dst_name] = copy.deepcopy(hmtx.metrics[src_name])
|
|
106
|
+
add_post_name(post, dst_name)
|
|
107
|
+
add_unicode_mapping(font, dst_cp, dst_name)
|
|
108
|
+
patched += 1
|
|
109
|
+
|
|
110
|
+
if patched:
|
|
111
|
+
font.setGlyphOrder(glyph_order)
|
|
112
|
+
font['maxp'].numGlyphs = len(glyph_order)
|
|
113
|
+
font.save(path)
|
|
114
|
+
return patched
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def main() -> int:
|
|
118
|
+
config = json.loads(PATCH_FILE.read_text())
|
|
119
|
+
aliases = {parse_cp(k): parse_cp(v) for k, v in config.get('aliases', {}).items()}
|
|
120
|
+
total = 0
|
|
121
|
+
for weight in WEIGHTS:
|
|
122
|
+
path = FONT_DIR / f'JetBrainsMonoNLNerdFontMono-{weight}.ttf'
|
|
123
|
+
if not path.exists():
|
|
124
|
+
print(f'missing font: {path}', file=sys.stderr)
|
|
125
|
+
return 1
|
|
126
|
+
count = patch_font(path, aliases)
|
|
127
|
+
total += count
|
|
128
|
+
print(f'{path.name}: patched {count} glyphs')
|
|
129
|
+
print(f'total patched: {total}')
|
|
130
|
+
return 0
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if __name__ == '__main__':
|
|
134
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Termdock postinstall — 确保原生模块编译 + tmux 可用
|
|
5
|
+
*
|
|
6
|
+
* 执行时机:每次 `npm install -g termdock`(含首次安装和更新)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
import { existsSync } from 'fs';
|
|
11
|
+
import { createRequire } from 'module';
|
|
12
|
+
|
|
13
|
+
const require_ = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
function run(cmd, opts = {}) {
|
|
16
|
+
console.log(` $ ${cmd}`);
|
|
17
|
+
return execSync(cmd, { stdio: 'inherit', ...opts });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function runOk(cmd) {
|
|
21
|
+
try { run(cmd); return true; } catch { return false; }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function which(bin) {
|
|
25
|
+
try { execSync(`which ${bin}`, { stdio: 'pipe' }); return true; } catch { return false; }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// —— native modules ——
|
|
29
|
+
console.log('\n=== Rebuilding native modules ===');
|
|
30
|
+
const pkgRoot = new URL('..', import.meta.url).pathname;
|
|
31
|
+
|
|
32
|
+
for (const mod of ['node-pty', '@parcel/watcher']) {
|
|
33
|
+
try {
|
|
34
|
+
require_(`${mod}`);
|
|
35
|
+
console.log(` ${mod} already usable, skip rebuild`);
|
|
36
|
+
} catch {
|
|
37
|
+
console.log(` ${mod} needs rebuild...`);
|
|
38
|
+
const modDir = require_.resolve(`${mod}/package.json`, { paths: [pkgRoot] });
|
|
39
|
+
const modRoot = modDir.replace('/package.json', '');
|
|
40
|
+
// 删掉预编译二进制,强制从源码构建
|
|
41
|
+
runOk(`rm -rf ${modRoot}/prebuilds/*`);
|
|
42
|
+
run(`cd ${modRoot} && npx --yes node-gyp rebuild`, { timeout: 120_000 });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// —— tmux ——
|
|
47
|
+
console.log('\n=== Checking tmux ===');
|
|
48
|
+
if (!which('tmux')) {
|
|
49
|
+
console.log(' tmux not found, attempting auto-install...');
|
|
50
|
+
const platform = process.platform;
|
|
51
|
+
let installed = false;
|
|
52
|
+
|
|
53
|
+
if (platform === 'darwin') {
|
|
54
|
+
// macOS: try brew first, then fallback message
|
|
55
|
+
if (which('brew')) {
|
|
56
|
+
installed = runOk('brew install tmux');
|
|
57
|
+
} else {
|
|
58
|
+
console.log(' Homebrew not found. Install it: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
|
|
59
|
+
}
|
|
60
|
+
} else if (platform === 'linux') {
|
|
61
|
+
if (runOk('apt-get install -y tmux 2>/dev/null')) {
|
|
62
|
+
installed = true;
|
|
63
|
+
} else if (runOk('yum install -y tmux 2>/dev/null')) {
|
|
64
|
+
installed = true;
|
|
65
|
+
} else if (runOk('apk add tmux 2>/dev/null')) {
|
|
66
|
+
installed = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (installed) {
|
|
71
|
+
console.log(' ✓ tmux installed successfully');
|
|
72
|
+
} else if (!which('tmux')) {
|
|
73
|
+
console.log(' ⚠ Could not auto-install tmux. Termdock works without it (shell mode will be default).');
|
|
74
|
+
console.log(' To use tmux features: install tmux then restart termdock.');
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
console.log(` ✓ tmux already available: ${execSync('tmux -V', { encoding: 'utf-8' }).trim()}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log('\n✓ Termdock postinstall complete\n');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-DiiIN0EC.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,a as s,c as t,C as e}from"./chunk-V7JOEXUC-CpteLsY3.js";import{b as i}from"./mermaid.core-DiiIN0EC.js";import"./chunk-5VM5RSS4-lddvv0x2.js";import"./chunk-XXDRQBXY-C0wXH91I.js";import"./chunk-VR4S4FIN-1zYOJQXL.js";import"./chunk-32BRIVSS-CjBDr_gz.js";import"./purify.es-CC4Brkr_.js";import"./index-XktPMm51.js";import"./react-XDCjal2T.js";import"./dnd-BCFAPC0L.js";import"./terminal-C7X98Amf.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,a as s,c as t,C as e}from"./chunk-V7JOEXUC-CpteLsY3.js";import{b as i}from"./mermaid.core-DiiIN0EC.js";import"./chunk-5VM5RSS4-lddvv0x2.js";import"./chunk-XXDRQBXY-C0wXH91I.js";import"./chunk-VR4S4FIN-1zYOJQXL.js";import"./chunk-32BRIVSS-CjBDr_gz.js";import"./purify.es-CC4Brkr_.js";import"./index-XktPMm51.js";import"./react-XDCjal2T.js";import"./dnd-BCFAPC0L.js";import"./terminal-C7X98Amf.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as r,a as e,s as a,S as i}from"./chunk-EX3LRPZG-Dtsq1Stg.js";import{b as s}from"./mermaid.core-DiiIN0EC.js";import"./chunk-XXDRQBXY-C0wXH91I.js";import"./chunk-VR4S4FIN-1zYOJQXL.js";import"./chunk-32BRIVSS-CjBDr_gz.js";import"./purify.es-CC4Brkr_.js";import"./index-XktPMm51.js";import"./react-XDCjal2T.js";import"./dnd-BCFAPC0L.js";import"./terminal-C7X98Amf.js";var g={parser:a,get db(){return new i(2)},renderer:e,styles:r,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-23GEKE2U-DzQp40QH.js";import{b as o}from"./mermaid.core-DiiIN0EC.js";import"./chunk-5VM5RSS4-lddvv0x2.js";import"./chunk-XXDRQBXY-C0wXH91I.js";import"./chunk-VR4S4FIN-1zYOJQXL.js";import"./chunk-32BRIVSS-CjBDr_gz.js";import"./purify.es-CC4Brkr_.js";import"./channel-C2gUFcyU.js";import"./index-XktPMm51.js";import"./react-XDCjal2T.js";import"./dnd-BCFAPC0L.js";import"./terminal-C7X98Amf.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,v=r({defaultLayout:"swimlane",styles:m});export{v as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
define(["exports"],function(t){"use strict";try{self["workbox:core:7.4.0"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:7.4.0"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class i{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class r extends i{constructor(t,e,s){super(({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)},e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map(e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})}));t.waitUntil(s),t.ports&&t.ports[0]&&s.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:i,route:r}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=r&&r.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:i})}catch(t){c=Promise.reject(t)}const h=r&&r.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch(async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:i})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n})),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const i=this.t.get(s.method)||[];for(const r of i){let i;const a=r.match({url:t,sameOrigin:e,request:s,event:n});if(a)return i=a,(Array.isArray(i)&&0===i.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(i=void 0),{route:r,params:i}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new i(({url:t})=>t.href===s.href,e,n)}else if(t instanceof RegExp)a=new r(t,e,n);else if("function"==typeof t)a=new i(t,e,n);else{if(!(t instanceof i))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}const u={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},l=t=>[u.prefix,t,u.suffix].filter(t=>t&&t.length>0).join("-"),f=t=>t||l(u.precache),w=t=>t||l(u.runtime);function d(t){t.then(()=>{})}const p=new Set;function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},y.apply(null,arguments)}let m,g;const R=new WeakMap,v=new WeakMap,b=new WeakMap,q=new WeakMap,D=new WeakMap;let U={get(t,e,s){if(t instanceof IDBTransaction){if("done"===e)return v.get(t);if("objectStoreNames"===e)return t.objectStoreNames||b.get(t);if("store"===e)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return L(t[e])},set:(t,e,s)=>(t[e]=s,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function x(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(g||(g=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(E(this),e),L(R.get(this))}:function(...e){return L(t.apply(E(this),e))}:function(e,...s){const n=t.call(E(this),e,...s);return b.set(n,e.sort?e.sort():[e]),L(n)}}function I(t){return"function"==typeof t?x(t):(t instanceof IDBTransaction&&function(t){if(v.has(t))return;const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",r),t.removeEventListener("abort",r)},i=()=>{e(),n()},r=()=>{s(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",i),t.addEventListener("error",r),t.addEventListener("abort",r)});v.set(t,e)}(t),e=t,(m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,U):t);var e}function L(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("success",i),t.removeEventListener("error",r)},i=()=>{e(L(t.result)),n()},r=()=>{s(t.error),n()};t.addEventListener("success",i),t.addEventListener("error",r)});return e.then(e=>{e instanceof IDBCursor&&R.set(e,t)}).catch(()=>{}),D.set(e,t),e}(t);if(q.has(t))return q.get(t);const e=I(t);return e!==t&&(q.set(t,e),D.set(e,t)),e}const E=t=>D.get(t);const C=["get","getKey","getAll","getAllKeys","count"],N=["put","add","delete","clear"],O=new Map;function k(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(O.get(e))return O.get(e);const s=e.replace(/FromIndex$/,""),n=e!==s,i=N.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!C.includes(s))return;const r=async function(t,...e){const r=this.transaction(t,i?"readwrite":"readonly");let a=r.store;return n&&(a=a.index(e.shift())),(await Promise.all([a[s](...e),i&&r.done]))[0]};return O.set(e,r),r}U=(t=>y({},t,{get:(e,s,n)=>k(e,s)||t.get(e,s,n),has:(e,s)=>!!k(e,s)||t.has(e,s)}))(U);try{self["workbox:expiration:7.4.0"]&&_()}catch(t){}const B="cache-entries",T=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class P{constructor(t){this.h=null,this.u=t}l(t){const e=t.createObjectStore(B,{keyPath:"id"});e.createIndex("cacheName","cacheName",{unique:!1}),e.createIndex("timestamp","timestamp",{unique:!1})}p(t){this.l(t),this.u&&function(t,{blocked:e}={}){const s=indexedDB.deleteDatabase(t);e&&s.addEventListener("blocked",t=>e(t.oldVersion,t)),L(s).then(()=>{})}(this.u)}async setTimestamp(t,e){const s={url:t=T(t),timestamp:e,cacheName:this.u,id:this.m(t)},n=(await this.getDb()).transaction(B,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(t){const e=await this.getDb(),s=await e.get(B,this.m(t));return null==s?void 0:s.timestamp}async expireEntries(t,e){const s=await this.getDb();let n=await s.transaction(B).store.index("timestamp").openCursor(null,"prev");const i=[];let r=0;for(;n;){const s=n.value;s.cacheName===this.u&&(t&&s.timestamp<t||e&&r>=e?i.push(n.value):r++),n=await n.continue()}const a=[];for(const t of i)await s.delete(B,t.id),a.push(t.url);return a}m(t){return this.u+"|"+T(t)}async getDb(){return this.h||(this.h=await function(t,e,{blocked:s,upgrade:n,blocking:i,terminated:r}={}){const a=indexedDB.open(t,e),o=L(a);return n&&a.addEventListener("upgradeneeded",t=>{n(L(a.result),t.oldVersion,t.newVersion,L(a.transaction),t)}),s&&a.addEventListener("blocked",t=>s(t.oldVersion,t.newVersion,t)),o.then(t=>{r&&t.addEventListener("close",()=>r()),i&&t.addEventListener("versionchange",t=>i(t.oldVersion,t.newVersion,t))}).catch(()=>{}),o}("workbox-expiration",1,{upgrade:this.p.bind(this)})),this.h}}class M{constructor(t,e={}){this.R=!1,this.v=!1,this.q=e.maxEntries,this.D=e.maxAgeSeconds,this.U=e.matchOptions,this.u=t,this._=new P(t)}async expireEntries(){if(this.R)return void(this.v=!0);this.R=!0;const t=this.D?Date.now()-1e3*this.D:0,e=await this._.expireEntries(t,this.q),s=await self.caches.open(this.u);for(const t of e)await s.delete(t,this.U);this.R=!1,this.v&&(this.v=!1,d(this.expireEntries()))}async updateTimestamp(t){await this._.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.D){const e=await this._.getTimestamp(t),s=Date.now()-1e3*this.D;return void 0===e||e<s}return!1}async delete(){this.v=!1,await this._.expireEntries(1/0)}}try{self["workbox:strategies:7.4.0"]&&_()}catch(t){}const W={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};function j(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class S{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}function K(t){return"string"==typeof t?new Request(t):t}class A{constructor(t,e){this.I={},Object.assign(this,e),this.event=e.event,this.L=t,this.C=new S,this.N=[],this.O=[...t.plugins],this.k=new Map;for(const t of this.O)this.k.set(t,{});this.event.waitUntil(this.C.promise)}async fetch(t){const{event:e}=this;let n=K(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const i=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const r=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.L.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:r,response:t});return t}catch(t){throw i&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:i.clone(),request:r.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=K(t);let s;const{cacheName:n,matchOptions:i}=this.L,r=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},i),{cacheName:n});s=await caches.match(r,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:n,matchOptions:i,cachedResponse:s,request:r,event:this.event})||void 0;return s}async cachePut(t,e){const n=K(t);var i;await(i=0,new Promise(t=>setTimeout(t,i)));const r=await this.getCacheKey(n,"write");if(!e)throw new s("cache-put-with-no-response",{url:(a=r.url,new URL(String(a),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var a;const o=await this.B(e);if(!o)return!1;const{cacheName:c,matchOptions:h}=this.L,u=await self.caches.open(c),l=this.hasCallback("cacheDidUpdate"),f=l?await async function(t,e,s,n){const i=j(e.url,s);if(e.url===i)return t.match(e,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),a=await t.keys(e,r);for(const e of a)if(i===j(e.url,s))return t.match(e,n)}(u,r.clone(),["__WB_REVISION__"],h):null;try{await u.put(r,l?o.clone():o)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await async function(){for(const t of p)await t()}(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:c,oldResponse:f,newResponse:o.clone(),request:r,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.I[s]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=K(await t({mode:e,request:n,event:this.event,params:this.params}));this.I[s]=n}return this.I[s]}hasCallback(t){for(const e of this.L.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.L.plugins)if("function"==typeof e[t]){const s=this.k.get(e),n=n=>{const i=Object.assign(Object.assign({},n),{state:s});return e[t](i)};yield n}}waitUntil(t){return this.N.push(t),t}async doneWaiting(){for(;this.N.length;){const t=this.N.splice(0),e=(await Promise.allSettled(t)).find(t=>"rejected"===t.status);if(e)throw e.reason}}destroy(){this.C.resolve(null)}async B(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class F{constructor(t={}){this.cacheName=w(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,n="params"in t?t.params:void 0,i=new A(this,{event:e,request:s,params:n}),r=this.T(i,s,e);return[r,this.P(r,i,s,e)]}async T(t,e,n){let i;await t.runCallbacks("handlerWillStart",{event:n,request:e});try{if(i=await this.M(e,t),!i||"error"===i.type)throw new s("no-response",{url:e.url})}catch(s){if(s instanceof Error)for(const r of t.iterateCallbacks("handlerDidError"))if(i=await r({error:s,event:n,request:e}),i)break;if(!i)throw s}for(const s of t.iterateCallbacks("handlerWillRespond"))i=await s({event:n,request:e,response:i});return i}async P(t,e,s,n){let i,r;try{i=await t}catch(r){}try{await e.runCallbacks("handlerDidRespond",{event:n,request:s,response:i}),await e.doneWaiting()}catch(t){t instanceof Error&&(r=t)}if(await e.runCallbacks("handlerDidComplete",{event:n,request:s,response:i,error:r}),e.destroy(),r)throw r}}function H(t,e){const s=e();return t.waitUntil(s),s}try{self["workbox:precaching:7.4.0"]&&_()}catch(t){}function $(t){if(!t)throw new s("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:n}=t;if(!n)throw new s("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(n,location.href),r=new URL(n,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:r.href}}class G{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type&&e&&e.originalRequest&&e.originalRequest instanceof Request){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class V{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=(null==e?void 0:e.cacheKey)||this.W.getCacheKeyForURL(t.url);return s?new Request(s,{headers:t.headers}):t},this.W=t}}let J,Q;async function z(t,e){let n=null;if(t.url){n=new URL(t.url).origin}if(n!==self.location.origin)throw new s("cross-origin-copy-response",{origin:n});const i=t.clone(),r={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},a=function(){if(void 0===J){const t=new Response("");if("body"in t)try{new Response(t.body),J=!0}catch(t){J=!1}J=!1}return J}()?i.body:await i.blob();return new Response(a,r)}class X extends F{constructor(t={}){t.cacheName=f(t.cacheName),super(t),this.j=!1!==t.fallbackToNetwork,this.plugins.push(X.copyRedirectedCacheableResponsesPlugin)}async M(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.S(t,e):await this.K(t,e))}async K(t,e){let n;const i=e.params||{};if(!this.j)throw new s("missing-precache-entry",{cacheName:this.cacheName,url:t.url});{const s=i.integrity,r=t.integrity,a=!r||r===s;n=await e.fetch(new Request(t,{integrity:"no-cors"!==t.mode?r||s:void 0})),s&&a&&"no-cors"!==t.mode&&(this.A(),await e.cachePut(t,n.clone()))}return n}async S(t,e){this.A();const n=await e.fetch(t);if(!await e.cachePut(t,n.clone()))throw new s("bad-precaching-response",{url:t.url,status:n.status});return n}A(){let t=null,e=0;for(const[s,n]of this.plugins.entries())n!==X.copyRedirectedCacheableResponsesPlugin&&(n===X.defaultPrecacheCacheabilityPlugin&&(t=s),n.cacheWillUpdate&&e++);0===e?this.plugins.push(X.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}X.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:t})=>!t||t.status>=400?null:t},X.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:t})=>t.redirected?await z(t):t};class Y{constructor({cacheName:t,plugins:e=[],fallbackToNetwork:s=!0}={}){this.F=new Map,this.H=new Map,this.$=new Map,this.L=new X({cacheName:f(t),plugins:[...e,new V({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.L}precache(t){this.addToCacheList(t),this.G||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.G=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:i}=$(n),r="string"!=typeof n&&n.revision?"reload":"default";if(this.F.has(i)&&this.F.get(i)!==t)throw new s("add-to-cache-list-conflicting-entries",{firstEntry:this.F.get(i),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.$.has(t)&&this.$.get(t)!==n.integrity)throw new s("add-to-cache-list-conflicting-integrities",{url:i});this.$.set(t,n.integrity)}if(this.F.set(i,t),this.H.set(i,r),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}install(t){return H(t,async()=>{const e=new G;this.strategy.plugins.push(e);for(const[e,s]of this.F){const n=this.$.get(s),i=this.H.get(e),r=new Request(e,{integrity:n,cache:i,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:r,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}})}activate(t){return H(t,async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.F.values()),n=[];for(const i of e)s.has(i.url)||(await t.delete(i),n.push(i.url));return{deletedURLs:n}})}getURLsToCacheKeys(){return this.F}getCachedURLs(){return[...this.F.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.F.get(e.href)}getIntegrityForCacheKey(t){return this.$.get(t)}async matchPrecache(t){const e=t instanceof Request?t.url:t,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=Object.assign({cacheKey:e},s.params),this.strategy.handle(s))}}const Z=()=>(Q||(Q=new Y),Q);class tt extends i{constructor(t,e){super(({request:s})=>{const n=t.getURLsToCacheKeys();for(const i of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:i}={}){const r=new URL(t,location.href);r.hash="",yield r.href;const a=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some(t=>t.test(s))&&t.searchParams.delete(s);return t}(r,e);if(yield a.href,s&&a.pathname.endsWith("/")){const t=new URL(a.href);t.pathname+=s,yield t.href}if(n){const t=new URL(a.href);t.pathname+=".html",yield t.href}if(i){const t=i({url:r});for(const e of t)yield e.href}}(s.url,e)){const e=n.get(i);if(e){return{cacheKey:e,integrity:t.getIntegrityForCacheKey(e)}}}},t.strategy)}}t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:s,cachedResponse:n})=>{if(!n)return null;const i=this.V(n),r=this.J(s);d(r.expireEntries());const a=r.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(t){}return i?n:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const s=this.J(t);await s.updateTimestamp(e.url),await s.expireEntries()},this.X=t,this.D=t.maxAgeSeconds,this.Y=new Map,t.purgeOnQuotaError&&function(t){p.add(t)}(()=>this.deleteCacheAndMetadata())}J(t){if(t===w())throw new s("expire-custom-caches-only");let e=this.Y.get(t);return e||(e=new M(t,this.X),this.Y.set(t,e)),e}V(t){if(!this.D)return!0;const e=this.Z(t);if(null===e)return!0;return e>=Date.now()-1e3*this.D}Z(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),s=new Date(e).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[t,e]of this.Y)await self.caches.delete(t),await e.delete();this.Y=new Map}},t.NavigationRoute=class extends i{constructor(t,{allowlist:e=[/./],denylist:s=[]}={}){super(t=>this.tt(t),t),this.et=e,this.st=s}tt({url:t,request:e}){if(e&&"navigate"!==e.mode)return!1;const s=t.pathname+t.search;for(const t of this.st)if(t.test(s))return!1;return!!this.et.some(t=>t.test(s))}},t.NetworkFirst=class extends F{constructor(t={}){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(W),this.nt=t.networkTimeoutSeconds||0}async M(t,e){const n=[],i=[];let r;if(this.nt){const{id:s,promise:a}=this.it({request:t,logs:n,handler:e});r=s,i.push(a)}const a=this.rt({timeoutId:r,request:t,logs:n,handler:e});i.push(a);const o=await e.waitUntil((async()=>await e.waitUntil(Promise.race(i))||await a)());if(!o)throw new s("no-response",{url:t.url});return o}it({request:t,logs:e,handler:s}){let n;return{promise:new Promise(e=>{n=setTimeout(async()=>{e(await s.cacheMatch(t))},1e3*this.nt)}),id:n}}async rt({timeoutId:t,request:e,logs:s,handler:n}){let i,r;try{r=await n.fetchAndCachePut(e)}catch(t){t instanceof Error&&(i=t)}return t&&clearTimeout(t),!i&&r||(r=await n.cacheMatch(e)),r}},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",t=>{const e=f();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter(s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t);return await Promise.all(s.map(t=>self.caches.delete(t))),s})(e).then(t=>{}))})},t.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},t.createHandlerBoundToURL=function(t){return Z().createHandlerBoundToURL(t)},t.precacheAndRoute=function(t,e){!function(t){Z().precache(t)}(t),function(t){const e=Z();h(new tt(e,t))}(e)},t.registerRoute=h});
|