@action-state-group/capsule-viewer 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -1
- package/dist/compliance-view.js +4 -1
- package/dist/compliance-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +1349 -13
- package/dist/history-view.d.ts +290 -0
- package/dist/history-view.iife.js +1278 -0
- package/dist/history-view.iife.js.sha256 +1 -0
- package/dist/history-view.js +940 -0
- package/dist/history-view.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/outcome-report-view.js +15 -5
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/report-front-styles.js +1 -0
- package/dist/report-front-styles.js.map +1 -1
- package/dist/report-levels.d.ts +37 -4
- package/dist/report-levels.js +127 -8
- package/dist/report-levels.js.map +1 -1
- package/dist/viewer-build.js +1 -1
- package/dist/wording/history-view.en.json +147 -0
- package/package.json +5 -1
|
@@ -4407,7 +4407,7 @@ var EvidenceGraph = (() => {
|
|
|
4407
4407
|
toMontgomerySecret: "function"
|
|
4408
4408
|
});
|
|
4409
4409
|
const { prehash } = opts;
|
|
4410
|
-
const { BASE, Fp: Fp2, Fn } = Point2;
|
|
4410
|
+
const { BASE: BASE2, Fp: Fp2, Fn } = Point2;
|
|
4411
4411
|
const outputLen = hash2.outputLen;
|
|
4412
4412
|
const expectedLen = 2 * Fp2.BYTES;
|
|
4413
4413
|
if (outputLen !== void 0) {
|
|
@@ -4439,7 +4439,7 @@ var EvidenceGraph = (() => {
|
|
|
4439
4439
|
}
|
|
4440
4440
|
function getExtendedPublicKey(secretKey) {
|
|
4441
4441
|
const { head: head2, prefix, scalar } = getPrivateScalar(secretKey);
|
|
4442
|
-
const point =
|
|
4442
|
+
const point = BASE2.multiply(scalar);
|
|
4443
4443
|
const pointBytes = point.toBytes();
|
|
4444
4444
|
return { head: head2, prefix, scalar, point, pointBytes };
|
|
4445
4445
|
}
|
|
@@ -4457,7 +4457,7 @@ var EvidenceGraph = (() => {
|
|
|
4457
4457
|
msg = prehash(msg);
|
|
4458
4458
|
const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey);
|
|
4459
4459
|
const r = hashDomainToScalar(options.context, prefix, msg);
|
|
4460
|
-
const R =
|
|
4460
|
+
const R = BASE2.multiply(r).toBytes();
|
|
4461
4461
|
const k = hashDomainToScalar(options.context, R, pointBytes, msg);
|
|
4462
4462
|
const s = Fn.create(r + k * scalar);
|
|
4463
4463
|
if (!Fn.isValid(s))
|
|
@@ -4487,7 +4487,7 @@ var EvidenceGraph = (() => {
|
|
|
4487
4487
|
try {
|
|
4488
4488
|
A = Point2.fromBytes(publicKey, zip215);
|
|
4489
4489
|
R = Point2.fromBytes(r, zip215);
|
|
4490
|
-
SB =
|
|
4490
|
+
SB = BASE2.multiplyUnsafe(s);
|
|
4491
4491
|
} catch (error) {
|
|
4492
4492
|
return false;
|
|
4493
4493
|
}
|
|
@@ -5084,6 +5084,8 @@ var EvidenceGraph = (() => {
|
|
|
5084
5084
|
createSectionRegistry: () => createSectionRegistry,
|
|
5085
5085
|
disclosureOf: () => disclosureOf,
|
|
5086
5086
|
ed25519Available: () => ed25519Available,
|
|
5087
|
+
historyViewHtml: () => historyViewHtml,
|
|
5088
|
+
historyViewStyles: () => historyViewStyles,
|
|
5087
5089
|
mountPresentation: () => mountPresentation,
|
|
5088
5090
|
mountPresentationFragment: () => mountPresentationFragment,
|
|
5089
5091
|
obligationStatus: () => obligationStatus,
|
|
@@ -5099,6 +5101,7 @@ var EvidenceGraph = (() => {
|
|
|
5099
5101
|
renderCompliancePage: () => renderCompliancePage,
|
|
5100
5102
|
renderContractReport: () => renderContractReport,
|
|
5101
5103
|
renderEvidenceGraph: () => renderEvidenceGraph,
|
|
5104
|
+
renderHistoryView: () => renderHistoryView,
|
|
5102
5105
|
renderOutcomeReportPage: () => renderOutcomeReportPage,
|
|
5103
5106
|
renderUnableToVerify: () => renderUnableToVerify,
|
|
5104
5107
|
resolvePresentation: () => resolvePresentation,
|
|
@@ -14636,6 +14639,7 @@ ${s} [data-src="producer"]:not(.cv-src){font-style:italic}
|
|
|
14636
14639
|
pendingToggles.delete(details);
|
|
14637
14640
|
details.dataset.body = "built";
|
|
14638
14641
|
into.append(build());
|
|
14642
|
+
anchorCases(into);
|
|
14639
14643
|
openBuiltToDepth(into);
|
|
14640
14644
|
};
|
|
14641
14645
|
details.addEventListener("toggle", () => {
|
|
@@ -14647,11 +14651,13 @@ ${s} [data-src="producer"]:not(.cv-src){font-style:italic}
|
|
|
14647
14651
|
return;
|
|
14648
14652
|
}
|
|
14649
14653
|
pendingToggles.set(details, fill2);
|
|
14654
|
+
if (into !== details) bodyOwners.set(into, details);
|
|
14650
14655
|
details.addEventListener("toggle", () => {
|
|
14651
14656
|
if (details.open) fill2();
|
|
14652
14657
|
});
|
|
14653
14658
|
}
|
|
14654
14659
|
var pendingToggles = /* @__PURE__ */ new WeakMap();
|
|
14660
|
+
var bodyOwners = /* @__PURE__ */ new WeakMap();
|
|
14655
14661
|
function openBuiltToDepth(body) {
|
|
14656
14662
|
if (body.closest("[data-open-all]") === null) return;
|
|
14657
14663
|
for (const toggle of body.querySelectorAll("details.lv"))
|
|
@@ -14994,20 +15000,85 @@ ${s} [data-src="producer"]:not(.cv-src){font-style:italic}
|
|
|
14994
15000
|
if (!at.open) openToggle(at);
|
|
14995
15001
|
target.scrollIntoView?.();
|
|
14996
15002
|
}
|
|
15003
|
+
function caseAddress(caseId) {
|
|
15004
|
+
return `case-${caseId}`;
|
|
15005
|
+
}
|
|
15006
|
+
var toggleCases = /* @__PURE__ */ new WeakMap();
|
|
15007
|
+
function listsCases(details, caseIds) {
|
|
15008
|
+
toggleCases.set(details, new Set(caseIds));
|
|
15009
|
+
}
|
|
15010
|
+
function revealCase(from, caseId) {
|
|
15011
|
+
const doc = from.nodeType === 9 ? from : from.ownerDocument;
|
|
15012
|
+
let target = doc.getElementById(caseAddress(caseId));
|
|
15013
|
+
if (target === null) {
|
|
15014
|
+
const home = [
|
|
15015
|
+
...doc.querySelectorAll(
|
|
15016
|
+
'details[data-body="pending"]'
|
|
15017
|
+
)
|
|
15018
|
+
].find(
|
|
15019
|
+
(details) => pendingToggles.has(details) && toggleCases.get(details)?.has(caseId) === true
|
|
15020
|
+
);
|
|
15021
|
+
if (home === void 0) return;
|
|
15022
|
+
pendingToggles.get(home)();
|
|
15023
|
+
target = doc.getElementById(caseAddress(caseId));
|
|
15024
|
+
if (target === null) return;
|
|
15025
|
+
}
|
|
15026
|
+
const shows = [];
|
|
15027
|
+
for (let at = target.parentElement; at !== null; at = at.parentElement) {
|
|
15028
|
+
if (at.localName === "details") shows.push(at);
|
|
15029
|
+
const owner = bodyOwners.get(at);
|
|
15030
|
+
if (owner !== void 0) shows.push(owner);
|
|
15031
|
+
}
|
|
15032
|
+
for (const toggle of shows.reverse()) if (!toggle.open) openToggle(toggle);
|
|
15033
|
+
target.scrollIntoView?.();
|
|
15034
|
+
}
|
|
15035
|
+
function anchorCases(root) {
|
|
15036
|
+
const cards = root.querySelectorAll("[data-case]");
|
|
15037
|
+
if (cards.length === 0) return 0;
|
|
15038
|
+
const top = root.getRootNode();
|
|
15039
|
+
let held2;
|
|
15040
|
+
if (top.nodeType !== 9) {
|
|
15041
|
+
held2 = treeAddresses.get(top);
|
|
15042
|
+
if (held2 === void 0) {
|
|
15043
|
+
held2 = new Set(
|
|
15044
|
+
[
|
|
15045
|
+
...top.querySelectorAll(
|
|
15046
|
+
"[data-case][id]"
|
|
15047
|
+
)
|
|
15048
|
+
].map((e) => e.id)
|
|
15049
|
+
);
|
|
15050
|
+
treeAddresses.set(top, held2);
|
|
15051
|
+
}
|
|
15052
|
+
}
|
|
15053
|
+
let anchored = 0;
|
|
15054
|
+
for (const card2 of cards) {
|
|
15055
|
+
const address = caseAddress(card2.dataset.case);
|
|
15056
|
+
if (card2.id !== "") continue;
|
|
15057
|
+
if (held2 === void 0 ? top.getElementById(address) !== null : held2.has(address))
|
|
15058
|
+
continue;
|
|
15059
|
+
card2.id = address;
|
|
15060
|
+
held2?.add(address);
|
|
15061
|
+
anchored++;
|
|
15062
|
+
}
|
|
15063
|
+
return anchored;
|
|
15064
|
+
}
|
|
15065
|
+
var treeAddresses = /* @__PURE__ */ new WeakMap();
|
|
14997
15066
|
var hashWatched = /* @__PURE__ */ new WeakSet();
|
|
14998
15067
|
function revealRecordsByHash(doc) {
|
|
14999
15068
|
const view = doc.defaultView;
|
|
15000
15069
|
if (view === null) return;
|
|
15001
15070
|
const go = () => {
|
|
15002
15071
|
const hash2 = view.location.hash;
|
|
15003
|
-
|
|
15072
|
+
const prefix = hash2.startsWith("#record-") ? "#record-" : hash2.startsWith("#case-") ? "#case-" : void 0;
|
|
15073
|
+
if (prefix === void 0) return;
|
|
15004
15074
|
let id;
|
|
15005
15075
|
try {
|
|
15006
|
-
id = decodeURIComponent(hash2.slice(
|
|
15076
|
+
id = decodeURIComponent(hash2.slice(prefix.length));
|
|
15007
15077
|
} catch {
|
|
15008
15078
|
return;
|
|
15009
15079
|
}
|
|
15010
|
-
revealRecord(doc, id);
|
|
15080
|
+
if (prefix === "#record-") revealRecord(doc, id);
|
|
15081
|
+
else revealCase(doc, id);
|
|
15011
15082
|
};
|
|
15012
15083
|
go();
|
|
15013
15084
|
if (hashWatched.has(doc)) return;
|
|
@@ -16663,6 +16734,7 @@ ${s} tr.x{cursor:pointer}
|
|
|
16663
16734
|
${s} tr.x:hover > td{background:#FAF8F4}
|
|
16664
16735
|
${s} tr.x-detail{display:none}
|
|
16665
16736
|
${s} tr.x:has(details.rx[open]) + tr.x-detail{display:table-row}
|
|
16737
|
+
body:has(.aac-static-notice) ${s} tr.x-detail:has(:target){display:table-row}
|
|
16666
16738
|
${s} tr.x-detail > td{padding:0 10px 12px;border-bottom:1px solid var(--line)}
|
|
16667
16739
|
${s} details.rx{display:inline;border:0;margin:0;padding:0;background:transparent}
|
|
16668
16740
|
${s} details.rx > summary{display:inline;padding:0;font-size:inherit;font-weight:inherit;color:inherit}
|
|
@@ -17412,13 +17484,13 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
|
|
|
17412
17484
|
}
|
|
17413
17485
|
function builtCommit() {
|
|
17414
17486
|
if (false) return void 0;
|
|
17415
|
-
return commitPrefix("
|
|
17487
|
+
return commitPrefix("2e651ba8a3ffc4916a3afe51e88056c8a2b29edb");
|
|
17416
17488
|
}
|
|
17417
17489
|
var commit = builtCommit();
|
|
17418
17490
|
var unreleased = false;
|
|
17419
17491
|
var VIEWER_BUILD = {
|
|
17420
17492
|
viewer: "@action-state-group/capsule-viewer",
|
|
17421
|
-
viewerVersion: "0.
|
|
17493
|
+
viewerVersion: "0.14.0",
|
|
17422
17494
|
verifier: "@action-state-group/agent-action-capsule",
|
|
17423
17495
|
verifierVersion: "0.13.1",
|
|
17424
17496
|
cllVersion: "0.3.0",
|
|
@@ -21335,6 +21407,7 @@ ${key}`);
|
|
|
21335
21407
|
const status2 = conversationStatus(conversation, model.gating);
|
|
21336
21408
|
const item = el8("article", "conv");
|
|
21337
21409
|
item.dataset.conversation = conversation.conversationId;
|
|
21410
|
+
item.dataset.case = conversation.conversationId;
|
|
21338
21411
|
const inAnswer = counted(conversation, model.gating);
|
|
21339
21412
|
item.dataset.conversationVerdict = inAnswer.verdict;
|
|
21340
21413
|
item.dataset.status = status2;
|
|
@@ -21723,11 +21796,16 @@ ${key}`);
|
|
|
21723
21796
|
return details;
|
|
21724
21797
|
}
|
|
21725
21798
|
function conversationsDrill(label, conversations, model, runInfo, key, w) {
|
|
21726
|
-
|
|
21799
|
+
const details = drill(
|
|
21727
21800
|
label,
|
|
21728
21801
|
() => renderConversationList(conversations, model, runInfo, key, w),
|
|
21729
21802
|
key
|
|
21730
21803
|
);
|
|
21804
|
+
listsCases(
|
|
21805
|
+
details,
|
|
21806
|
+
conversations.map((c) => c.conversationId)
|
|
21807
|
+
);
|
|
21808
|
+
return details;
|
|
21731
21809
|
}
|
|
21732
21810
|
function missedReasonLabel(terms, checkId, criterionId, w) {
|
|
21733
21811
|
const check = terms.checks.find((c) => c.id === checkId);
|
|
@@ -22020,9 +22098,27 @@ ${key}`);
|
|
|
22020
22098
|
n: fmtCount(line2.behind.length)
|
|
22021
22099
|
});
|
|
22022
22100
|
const behind = line2.behind;
|
|
22023
|
-
|
|
22024
|
-
|
|
22025
|
-
|
|
22101
|
+
let details;
|
|
22102
|
+
if (line2.key === "missed") {
|
|
22103
|
+
details = drill(
|
|
22104
|
+
label,
|
|
22105
|
+
() => whyMissed(behind, model, runInfo, w),
|
|
22106
|
+
line2.key
|
|
22107
|
+
);
|
|
22108
|
+
listsCases(
|
|
22109
|
+
details,
|
|
22110
|
+
behind.map((c) => c.conversationId)
|
|
22111
|
+
);
|
|
22112
|
+
} else
|
|
22113
|
+
details = conversationsDrill(
|
|
22114
|
+
label,
|
|
22115
|
+
behind,
|
|
22116
|
+
model,
|
|
22117
|
+
runInfo,
|
|
22118
|
+
line2.key,
|
|
22119
|
+
w
|
|
22120
|
+
);
|
|
22121
|
+
desc.append(details);
|
|
22026
22122
|
}
|
|
22027
22123
|
tr.append(desc, el8("td", "n", line2.shown));
|
|
22028
22124
|
tbody.append(tr);
|
|
@@ -22242,6 +22338,10 @@ ${key}`);
|
|
|
22242
22338
|
`rule-${ref}`
|
|
22243
22339
|
);
|
|
22244
22340
|
toggle.dataset.drill = `rule:${ref}`;
|
|
22341
|
+
listsCases(
|
|
22342
|
+
toggle,
|
|
22343
|
+
problems.map((c) => c.conversationId)
|
|
22344
|
+
);
|
|
22245
22345
|
tbody.append(drillRow);
|
|
22246
22346
|
}
|
|
22247
22347
|
}
|
|
@@ -23260,6 +23360,7 @@ ${key}`);
|
|
|
23260
23360
|
);
|
|
23261
23361
|
toggle.dataset.records = "sessions";
|
|
23262
23362
|
toggle.dataset.drill = test.criterionId;
|
|
23363
|
+
listsCases(toggle, sessionIds);
|
|
23263
23364
|
tbody.append(drillRow);
|
|
23264
23365
|
}
|
|
23265
23366
|
}
|
|
@@ -23348,6 +23449,7 @@ ${key}`);
|
|
|
23348
23449
|
const parts = caseParts(session.conversationId, w);
|
|
23349
23450
|
const item = el9("article", "conv session");
|
|
23350
23451
|
item.dataset.session = session.conversationId;
|
|
23452
|
+
item.dataset.case = session.conversationId;
|
|
23351
23453
|
const head2 = el9("div", "conv-h");
|
|
23352
23454
|
head2.append(el9("span", "cid", parts.label));
|
|
23353
23455
|
head2.append(
|
|
@@ -28536,6 +28638,1240 @@ ${pad.repeat(depth)}`;
|
|
|
28536
28638
|
}
|
|
28537
28639
|
return result2("NOT_CHECKED");
|
|
28538
28640
|
}
|
|
28641
|
+
|
|
28642
|
+
// src/wording/history-view.en.json
|
|
28643
|
+
var history_view_en_default = {
|
|
28644
|
+
wording_pack_version: "0",
|
|
28645
|
+
id: "capsuleviewer.history-view.wording/v0",
|
|
28646
|
+
locale: "en",
|
|
28647
|
+
provenance: {
|
|
28648
|
+
_comment: "Entries copied from actionstate-muse's packs name their source key; the snapshot test (test/history-view.test.ts) holds them to test/fixtures/history-view/muse-source.json. Once actionstate-muse deletes its history.page.* words, this pack is the source.",
|
|
28649
|
+
muse_commit: "79cc01cfbae59536e690fd6c8e68192b6cf7a12a",
|
|
28650
|
+
sources: {
|
|
28651
|
+
"header.title.owner": "plugin.json history.page.title",
|
|
28652
|
+
"badge.private": "plugin.json history.page.private",
|
|
28653
|
+
"built.owner": "plugin.json history.page.built",
|
|
28654
|
+
"hero.none.deals": "plugin.json history.page.none",
|
|
28655
|
+
"hero.deals.one": "plugin.json history.page.count.one",
|
|
28656
|
+
"hero.deals.other": "plugin.json history.page.count.other",
|
|
28657
|
+
"row.opened": "plugin.json history.page.row.opened",
|
|
28658
|
+
"row.last": "plugin.json history.page.row.last",
|
|
28659
|
+
"stamp.recorded": "plugin.json history.page.stamp.recorded",
|
|
28660
|
+
"stamp.timestamped": "plugin.json history.page.stamp.timestamped",
|
|
28661
|
+
"slot.timestamped.none": "plugin.json history.page.stamp.timestamped.not",
|
|
28662
|
+
"slot.part": "plugin.json history.page.stamp.timestamped.part",
|
|
28663
|
+
"slot.unchecked": "plugin.json history.page.stamp.timestamped.unchecked",
|
|
28664
|
+
"slot.failed": "plugin.json history.page.stamp.timestamped.failed",
|
|
28665
|
+
"seal.deals": "receipt.json seal.text.unpostmarked",
|
|
28666
|
+
"seal.directory": "plugin.json history.page.checked.directory"
|
|
28667
|
+
}
|
|
28668
|
+
},
|
|
28669
|
+
entries: {
|
|
28670
|
+
"header.title.node": "History \xB7 node {node}",
|
|
28671
|
+
"header.title.stream": "History \xB7 node {node} \xB7 {stream} log",
|
|
28672
|
+
"header.title.owner": "Your History",
|
|
28673
|
+
"header.title.shared": "History \xB7 shared by {name}",
|
|
28674
|
+
"header.title.person": "History \xB7 {name}",
|
|
28675
|
+
"badge.private": "PRIVATE \xB7 for you only. Never send this page.",
|
|
28676
|
+
"badge.shared": "SHARED COPY \xB7 for {who}",
|
|
28677
|
+
"badge.anyone": "What this node gives anyone who asks",
|
|
28678
|
+
"scope.period": "{from} to {to}",
|
|
28679
|
+
"built.owner": "Built {at}. It is a snapshot from when you asked, not a page that updates itself.",
|
|
28680
|
+
"built.recipient": "Built {at}. It is a snapshot from when it was built, not a page that updates itself.",
|
|
28681
|
+
"hero.checkpoints.one": "1 checkpoint \xB7 {entries} \xB7 last cut {at} \xB7 {verdict}",
|
|
28682
|
+
"hero.checkpoints.other": "{n} checkpoints \xB7 {entries} \xB7 last cut {at} \xB7 {verdict}",
|
|
28683
|
+
"hero.entries.one": "1 entry",
|
|
28684
|
+
"hero.entries.other": "{n} entries",
|
|
28685
|
+
"verdict.pass": "every checkpoint signature checks",
|
|
28686
|
+
"verdict.pass.all": "every signature checks, including the answer's own, by the node's published key",
|
|
28687
|
+
"verdict.unchecked": "signatures not checked here",
|
|
28688
|
+
"hero.failed": "This history didn't verify, so this page shows none of it.",
|
|
28689
|
+
"hero.none.checkpoints": "No checkpoints yet.",
|
|
28690
|
+
"hero.refused": "The node declined to answer.",
|
|
28691
|
+
"hero.refused.reason": "Its reason, in its own words: \u201C{reason}\u201D",
|
|
28692
|
+
"hero.unreadable": "This page could not read the answer, so it shows none of it.",
|
|
28693
|
+
"hero.deals.one": "{n} deal, newest first",
|
|
28694
|
+
"hero.deals.other": "{n} deals, newest first",
|
|
28695
|
+
"hero.deals.picked.one": "1 deal {name} picked \xB7 steps recorded, not outcomes",
|
|
28696
|
+
"hero.deals.picked.other": "{n} deals {name} picked \xB7 steps recorded, not outcomes",
|
|
28697
|
+
"hero.none.deals": "There are no deals in this store yet.",
|
|
28698
|
+
"chip.signatures.pass": "Checkpoint signatures check",
|
|
28699
|
+
"chip.signatures.pass.all": "Every signature checks",
|
|
28700
|
+
"chip.signatures.unchecked": "Signatures not checked here",
|
|
28701
|
+
"chip.timestamped.all": "Time-stamped: all {n}",
|
|
28702
|
+
"chip.timestamped.some": "Time-stamped: {k} of {n}",
|
|
28703
|
+
"chip.timestamped.none": "Time-stamped: none yet",
|
|
28704
|
+
"chip.timestamped.unchecked": "Time stamps not checked here",
|
|
28705
|
+
"chip.timestamped.failed": "Time stamps didn't verify",
|
|
28706
|
+
"chip.started": "Started {date}",
|
|
28707
|
+
"chip.recorded": "Each step recorded as it happened",
|
|
28708
|
+
"rows.heading.checkpoints": "Checkpoints",
|
|
28709
|
+
"rows.heading.deals": "Deals",
|
|
28710
|
+
"row.cut": "Cut {at}",
|
|
28711
|
+
"row.entries.one": "1 entry in the log",
|
|
28712
|
+
"row.entries.other": "{n} entries in the log",
|
|
28713
|
+
"row.opened": "Opened {at}",
|
|
28714
|
+
"row.last": "Last step {at}",
|
|
28715
|
+
"proof.checkpoint": "\u{1F50F} checkpoint {id}\u2026",
|
|
28716
|
+
"proof.node": "\u{1F50F} node key {id}\u2026",
|
|
28717
|
+
"proof.record": "\u{1F50F} record {id}\u2026",
|
|
28718
|
+
"stamp.recorded": "RECORDED",
|
|
28719
|
+
"stamp.timestamped": "TIME-STAMPED",
|
|
28720
|
+
"stamp.second": "SECOND SIGNATURE",
|
|
28721
|
+
"stamp.signature.unchecked": "Signature not checked here",
|
|
28722
|
+
"slot.timestamped.at": "{at}",
|
|
28723
|
+
"slot.timestamped.by": "{at} \xB7 by {by}",
|
|
28724
|
+
"slot.part": "through step {k} of {n}",
|
|
28725
|
+
"slot.timestamped.none": "Not time-stamped yet",
|
|
28726
|
+
"slot.second.by": "{by} signed this record too \xB7 {at}, by their clock",
|
|
28727
|
+
"slot.second.none": "None yet",
|
|
28728
|
+
"slot.unchecked": "Not checked here",
|
|
28729
|
+
"slot.failed": "Didn't verify",
|
|
28730
|
+
"periods.heading": "Service History: exchanges served in each closed week",
|
|
28731
|
+
"periods.row": "{from} to {to}",
|
|
28732
|
+
"periods.cell": "{what}: {value}",
|
|
28733
|
+
"periods.cell.withheld": "{what}: fewer than 5",
|
|
28734
|
+
"callout.heading": "What this does not show",
|
|
28735
|
+
"callout.checkpoints": "These checkpoints show when this node's log was cut and how much it holds. They don't show what any exchange said or how it went, and this is not a judgment of the node.",
|
|
28736
|
+
"callout.deals": "\u201CSteps recorded\u201D is this side's record of each deal, not a confirmed outcome.",
|
|
28737
|
+
"callout.deals.picked": "{name} picked these; it isn't every deal. \u201CSteps recorded\u201D is {name}'s side's record, not a confirmed outcome.",
|
|
28738
|
+
"shares.heading": "What this node shares",
|
|
28739
|
+
"shares.summary": "With anyone who asks: a summary of its checkpoints, meaning how much it has recorded and when, and nothing about any exchange.",
|
|
28740
|
+
"shares.standard.on": "With anyone: the Service History.",
|
|
28741
|
+
"shares.standard.off": "The Service History: only the other side of an exchange gets it (off for anyone else on this node).",
|
|
28742
|
+
"shares.segments.counterparties": "Only with the other side of an exchange, when they ask: that exchange's record.",
|
|
28743
|
+
"shares.segments.peers": "With any node that signs its request: an exchange's record.",
|
|
28744
|
+
"shares.segments.off": "The other side of an exchange can't ask for its record (off on this node).",
|
|
28745
|
+
"shares.segments.off.sealed": "They still get the sealed record when it completes.",
|
|
28746
|
+
"shares.corroboration.on": "With any node that asks by an exchange's id: whether this node holds its half (ids and digests only).",
|
|
28747
|
+
"shares.completion.on": "Sent on its own: the sealed record when an exchange completes.",
|
|
28748
|
+
"shares.completion.off": "The sealed record isn't sent when an exchange completes (off on this node).",
|
|
28749
|
+
"shares.adjudications.on": "If this node judges an exchange, its verdict goes to the node judged.",
|
|
28750
|
+
"shares.adjudications.off": "Verdicts this node reaches aren't sent to the nodes judged (off on this node).",
|
|
28751
|
+
"shares.twins.on": "When two copies of a model answer differently, this node sends the question and both answers to a referee.",
|
|
28752
|
+
"shares.twins.unstated": "Whether this node sends differing answers to a referee: this node's settings don't say.",
|
|
28753
|
+
"shares.witnesses": "Signed checkpoints go to the witnesses named here: {witnesses}",
|
|
28754
|
+
"shares.witnesses.none": "No witnesses named.",
|
|
28755
|
+
"shares.witnesses.unstated": "Which witnesses get its checkpoints: this node's settings don't say.",
|
|
28756
|
+
"shares.never": "Never: a record to anyone who doesn't prove who they are.",
|
|
28757
|
+
"shares.as_of": "As this node was set when this page was built, {at}.",
|
|
28758
|
+
"seal.title": "Locked as it happened.",
|
|
28759
|
+
"seal.checkpoints": "Each checkpoint is signed and extends the one before, so a change to what it covers shows.",
|
|
28760
|
+
"seal.deals": "Each step was saved as it happened. Any change to a saved step shows.",
|
|
28761
|
+
"seal.unchecked": "This page did not check how these records were locked.",
|
|
28762
|
+
"seal.second.label": "Second signature",
|
|
28763
|
+
"seal.second.rows": "See each row",
|
|
28764
|
+
"seal.directory": "Signers are looked up at {directory} on every read, so that site can see each time you look.",
|
|
28765
|
+
"checked.heading": "How this was checked",
|
|
28766
|
+
"checked.where.page": "These checks ran in this browser when the page opened ({by}).",
|
|
28767
|
+
"checked.where.builder": "These checks ran when the page was built, {at} ({by}).",
|
|
28768
|
+
"check.line": "{status}: {name}",
|
|
28769
|
+
"status.pass": "Checked",
|
|
28770
|
+
"status.fail": "Didn't verify",
|
|
28771
|
+
"status.not_run": "Not checked here",
|
|
28772
|
+
"check.readable": "The answer can be read",
|
|
28773
|
+
"check.refusal": "The refusal is signed by the key that answered",
|
|
28774
|
+
"check.artifact_digest": "The answer's file is the bytes its digest names",
|
|
28775
|
+
"check.card_digest": "The history card (history_card/1) matches its digest",
|
|
28776
|
+
"check.checkpoint_signatures": "Every checkpoint is signed by the key that answered",
|
|
28777
|
+
"check.checkpoint_chain": "Each checkpoint names the one before",
|
|
28778
|
+
"check.consistency": "The log only grew between checkpoints: nothing removed or changed",
|
|
28779
|
+
"check.anchor": "The last checkpoint is the one the answer names",
|
|
28780
|
+
"check.period_counts": "The Service History's counts (service_history/1) match its checkpoints",
|
|
28781
|
+
"check.envelope_signature": "The answer itself is signed by the key that answered",
|
|
28782
|
+
"check.key_is_node": "The signing key is the node's published key",
|
|
28783
|
+
"check.reply_bound": "The answer is bound to the request it answers",
|
|
28784
|
+
"check.witness": "A witness time-stamped these records",
|
|
28785
|
+
"check.second_signature": "A second party signed this record",
|
|
28786
|
+
"check.deal_report": "Each deal was read with its own report, which writes nothing",
|
|
28787
|
+
refused: "This page can't show this history: {reasons}"
|
|
28788
|
+
}
|
|
28789
|
+
};
|
|
28790
|
+
|
|
28791
|
+
// src/history-view.ts
|
|
28792
|
+
var HISTORY_VIEW = "history-view/v0";
|
|
28793
|
+
var HISTORY_CHECK_IDS = [
|
|
28794
|
+
"readable",
|
|
28795
|
+
"refusal",
|
|
28796
|
+
"artifact_digest",
|
|
28797
|
+
"card_digest",
|
|
28798
|
+
"checkpoint_signatures",
|
|
28799
|
+
"checkpoint_chain",
|
|
28800
|
+
"consistency",
|
|
28801
|
+
"anchor",
|
|
28802
|
+
"period_counts",
|
|
28803
|
+
"envelope_signature",
|
|
28804
|
+
"key_is_node",
|
|
28805
|
+
"reply_bound",
|
|
28806
|
+
"witness",
|
|
28807
|
+
"second_signature",
|
|
28808
|
+
"deal_report"
|
|
28809
|
+
];
|
|
28810
|
+
var SLOT_CHECKS = /* @__PURE__ */ new Set([
|
|
28811
|
+
"witness",
|
|
28812
|
+
"second_signature"
|
|
28813
|
+
]);
|
|
28814
|
+
var BASE = history_view_en_default.entries;
|
|
28815
|
+
var HistoryViewRefused = class extends Error {
|
|
28816
|
+
reasons;
|
|
28817
|
+
constructor(reasons) {
|
|
28818
|
+
super(`history-view refused: ${reasons.join("; ")}`);
|
|
28819
|
+
this.name = "HistoryViewRefused";
|
|
28820
|
+
this.reasons = reasons;
|
|
28821
|
+
}
|
|
28822
|
+
};
|
|
28823
|
+
var TOKEN = /^[a-z0-9 _.-]*$/u;
|
|
28824
|
+
function el13(tag, attrs, ...children) {
|
|
28825
|
+
const pairs = Object.entries(attrs ?? {});
|
|
28826
|
+
for (const [name, value] of pairs)
|
|
28827
|
+
if (!TOKEN.test(name) || !TOKEN.test(value))
|
|
28828
|
+
throw new Error(
|
|
28829
|
+
`history-view: attribute ${name}=${value} is not a view token`
|
|
28830
|
+
);
|
|
28831
|
+
return {
|
|
28832
|
+
tag,
|
|
28833
|
+
attrs: pairs,
|
|
28834
|
+
children: children.filter(
|
|
28835
|
+
(c) => c !== null && c !== false
|
|
28836
|
+
)
|
|
28837
|
+
};
|
|
28838
|
+
}
|
|
28839
|
+
function escapeText(text2) {
|
|
28840
|
+
return text2.replace(
|
|
28841
|
+
/[&<> ]/gu,
|
|
28842
|
+
(c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : " "
|
|
28843
|
+
);
|
|
28844
|
+
}
|
|
28845
|
+
function serializeHistoryElement(node) {
|
|
28846
|
+
if (typeof node === "string") return escapeText(node);
|
|
28847
|
+
const attrs = node.attrs.map(([n, v]) => ` ${n}="${v}"`).join("");
|
|
28848
|
+
return `<${node.tag}${attrs}>${node.children.map(serializeHistoryElement).join("")}</${node.tag}>`;
|
|
28849
|
+
}
|
|
28850
|
+
function historyElementToDom(node, doc) {
|
|
28851
|
+
if (typeof node === "string") return doc.createTextNode(node);
|
|
28852
|
+
const out = doc.createElement(node.tag);
|
|
28853
|
+
for (const [n, v] of node.attrs) out.setAttribute(n, v);
|
|
28854
|
+
for (const child of node.children)
|
|
28855
|
+
out.appendChild(historyElementToDom(child, doc));
|
|
28856
|
+
return out;
|
|
28857
|
+
}
|
|
28858
|
+
var Reader2 = class {
|
|
28859
|
+
reasons = [];
|
|
28860
|
+
refuse(path2, why) {
|
|
28861
|
+
this.reasons.push(`${path2}: ${why}`);
|
|
28862
|
+
}
|
|
28863
|
+
object(v, path2, allowed, required) {
|
|
28864
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) {
|
|
28865
|
+
this.refuse(path2, "is not an object");
|
|
28866
|
+
return null;
|
|
28867
|
+
}
|
|
28868
|
+
const o = v;
|
|
28869
|
+
for (const k of Object.keys(o))
|
|
28870
|
+
if (!allowed.includes(k))
|
|
28871
|
+
this.refuse(`${path2}.${k}`, "is not a member of history-view/v0");
|
|
28872
|
+
for (const k of required)
|
|
28873
|
+
if (!(k in o)) this.refuse(`${path2}.${k}`, "is missing");
|
|
28874
|
+
return o;
|
|
28875
|
+
}
|
|
28876
|
+
string(v, path2, max = 2e3) {
|
|
28877
|
+
if (typeof v !== "string" || v.length === 0 || v.length > max) {
|
|
28878
|
+
this.refuse(path2, `is not a string of 1 to ${max} characters`);
|
|
28879
|
+
return void 0;
|
|
28880
|
+
}
|
|
28881
|
+
return v;
|
|
28882
|
+
}
|
|
28883
|
+
oneOf(v, path2, values) {
|
|
28884
|
+
if (typeof v !== "string" || !values.includes(v)) {
|
|
28885
|
+
this.refuse(path2, `is not one of ${values.join(", ")}`);
|
|
28886
|
+
return void 0;
|
|
28887
|
+
}
|
|
28888
|
+
return v;
|
|
28889
|
+
}
|
|
28890
|
+
bool(v, path2) {
|
|
28891
|
+
if (typeof v !== "boolean") {
|
|
28892
|
+
this.refuse(path2, "is not true or false");
|
|
28893
|
+
return void 0;
|
|
28894
|
+
}
|
|
28895
|
+
return v;
|
|
28896
|
+
}
|
|
28897
|
+
count(v, path2) {
|
|
28898
|
+
if (typeof v !== "number" || !Number.isSafeInteger(v) || v < 0) {
|
|
28899
|
+
this.refuse(path2, "is not a whole number of 0 or more");
|
|
28900
|
+
return void 0;
|
|
28901
|
+
}
|
|
28902
|
+
return v;
|
|
28903
|
+
}
|
|
28904
|
+
time(v, path2) {
|
|
28905
|
+
const s = this.string(v, path2, 64);
|
|
28906
|
+
if (s === void 0) return void 0;
|
|
28907
|
+
const t = parseInstant(s);
|
|
28908
|
+
if (t === void 0) this.refuse(path2, "is not an RFC 3339 time");
|
|
28909
|
+
return t;
|
|
28910
|
+
}
|
|
28911
|
+
date(v, path2) {
|
|
28912
|
+
const s = this.string(v, path2, 64);
|
|
28913
|
+
if (s === void 0) return void 0;
|
|
28914
|
+
const t = /^\d{4}-\d{2}-\d{2}$/u.test(s) ? parseInstant(`${s}T00:00:00Z`) : parseInstant(s);
|
|
28915
|
+
if (t === void 0)
|
|
28916
|
+
this.refuse(path2, "is not a date (YYYY-MM-DD) or an RFC 3339 time");
|
|
28917
|
+
return t;
|
|
28918
|
+
}
|
|
28919
|
+
};
|
|
28920
|
+
function parseInstant(s) {
|
|
28921
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?([Zz]|[+-]\d{2}:\d{2})$/u.exec(
|
|
28922
|
+
s
|
|
28923
|
+
);
|
|
28924
|
+
if (!m) return void 0;
|
|
28925
|
+
const [, y, mo, d, h, mi, se, frac = "", zone = "Z"] = m;
|
|
28926
|
+
const month = Number(mo);
|
|
28927
|
+
const day = Number(d);
|
|
28928
|
+
if (month < 1 || month > 12 || day < 1 || day > 31 || Number(h) > 23 || Number(mi) > 59 || Number(se) > 59)
|
|
28929
|
+
return void 0;
|
|
28930
|
+
let ms = Date.UTC(
|
|
28931
|
+
Number(y),
|
|
28932
|
+
month - 1,
|
|
28933
|
+
day,
|
|
28934
|
+
Number(h),
|
|
28935
|
+
Number(mi),
|
|
28936
|
+
Number(se)
|
|
28937
|
+
);
|
|
28938
|
+
if (new Date(ms).getUTCDate() !== day) return void 0;
|
|
28939
|
+
if (zone !== "Z" && zone !== "z") {
|
|
28940
|
+
const sign = zone.startsWith("-") ? -1 : 1;
|
|
28941
|
+
ms -= sign * (Number(zone.slice(1, 3)) * 60 + Number(zone.slice(4, 6))) * 6e4;
|
|
28942
|
+
}
|
|
28943
|
+
return { ms, fraction: frac };
|
|
28944
|
+
}
|
|
28945
|
+
var MONTHS = [
|
|
28946
|
+
"Jan",
|
|
28947
|
+
"Feb",
|
|
28948
|
+
"Mar",
|
|
28949
|
+
"Apr",
|
|
28950
|
+
"May",
|
|
28951
|
+
"Jun",
|
|
28952
|
+
"Jul",
|
|
28953
|
+
"Aug",
|
|
28954
|
+
"Sep",
|
|
28955
|
+
"Oct",
|
|
28956
|
+
"Nov",
|
|
28957
|
+
"Dec"
|
|
28958
|
+
];
|
|
28959
|
+
var two = (n) => String(n).padStart(2, "0");
|
|
28960
|
+
function dateOf(t) {
|
|
28961
|
+
const d = new Date(t.ms);
|
|
28962
|
+
return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}, ${d.getUTCFullYear()}`;
|
|
28963
|
+
}
|
|
28964
|
+
function minuteOf(t) {
|
|
28965
|
+
const d = new Date(t.ms);
|
|
28966
|
+
return `${dateOf(t)}, ${two(d.getUTCHours())}:${two(d.getUTCMinutes())} UTC`;
|
|
28967
|
+
}
|
|
28968
|
+
function shortMinuteOf(t) {
|
|
28969
|
+
const d = new Date(t.ms);
|
|
28970
|
+
return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}, ${two(d.getUTCHours())}:${two(d.getUTCMinutes())} UTC`;
|
|
28971
|
+
}
|
|
28972
|
+
function secondOf(t, withFraction) {
|
|
28973
|
+
const d = new Date(t.ms);
|
|
28974
|
+
const frac = withFraction && t.fraction ? `.${t.fraction}` : "";
|
|
28975
|
+
return `${dateOf(t)}, ${two(d.getUTCHours())}:${two(d.getUTCMinutes())}:${two(d.getUTCSeconds())}${frac} UTC`;
|
|
28976
|
+
}
|
|
28977
|
+
var PLACEHOLDER2 = /\{([a-z_]+)\}/gu;
|
|
28978
|
+
function placeholders2(text2) {
|
|
28979
|
+
return [...text2.matchAll(PLACEHOLDER2)].map((m) => m[1] ?? "").sort();
|
|
28980
|
+
}
|
|
28981
|
+
function readOverlay(r, v) {
|
|
28982
|
+
const o = r.object(v, "overlay", ["id", "entries"], ["id", "entries"]);
|
|
28983
|
+
if (!o) return {};
|
|
28984
|
+
r.string(o["id"], "overlay.id", 200);
|
|
28985
|
+
const e = r.object(o["entries"], "overlay.entries", Object.keys(BASE), []);
|
|
28986
|
+
const out = {};
|
|
28987
|
+
if (!e) return out;
|
|
28988
|
+
for (const [k, text2] of Object.entries(e)) {
|
|
28989
|
+
const base = BASE[k];
|
|
28990
|
+
const s = r.string(text2, `overlay.entries.${k}`);
|
|
28991
|
+
if (base === void 0 || s === void 0) continue;
|
|
28992
|
+
if (placeholders2(base).join(",") !== placeholders2(s).join(","))
|
|
28993
|
+
r.refuse(
|
|
28994
|
+
`overlay.entries.${k}`,
|
|
28995
|
+
`must use the placeholders ${JSON.stringify(placeholders2(base))}`
|
|
28996
|
+
);
|
|
28997
|
+
else out[k] = s;
|
|
28998
|
+
}
|
|
28999
|
+
return out;
|
|
29000
|
+
}
|
|
29001
|
+
function readSlot(r, v, path2, needBy) {
|
|
29002
|
+
const o = r.object(v, path2, ["state", "by", "at", "through"], ["state"]);
|
|
29003
|
+
const state = o ? r.oneOf(o["state"], `${path2}.state`, [
|
|
29004
|
+
"passed",
|
|
29005
|
+
"failed",
|
|
29006
|
+
"none",
|
|
29007
|
+
"not_checked"
|
|
29008
|
+
]) ?? "not_checked" : "not_checked";
|
|
29009
|
+
const by = o && "by" in o ? r.string(o["by"], `${path2}.by`, 200) : void 0;
|
|
29010
|
+
const at = o && "at" in o ? r.time(o["at"], `${path2}.at`) : void 0;
|
|
29011
|
+
let through;
|
|
29012
|
+
if (o && "through" in o) {
|
|
29013
|
+
const t = r.object(o["through"], `${path2}.through`, ["k", "n"], ["k", "n"]);
|
|
29014
|
+
const k = t ? r.count(t["k"], `${path2}.through.k`) : void 0;
|
|
29015
|
+
const n = t ? r.count(t["n"], `${path2}.through.n`) : void 0;
|
|
29016
|
+
if (k !== void 0 && n !== void 0) {
|
|
29017
|
+
if (k > n || n === 0)
|
|
29018
|
+
r.refuse(`${path2}.through`, "k must be at most n, and n more than 0");
|
|
29019
|
+
else through = { k, n };
|
|
29020
|
+
}
|
|
29021
|
+
}
|
|
29022
|
+
if (state === "passed") {
|
|
29023
|
+
if (!o || !("at" in o)) r.refuse(path2, "a passed slot needs at");
|
|
29024
|
+
if (needBy && !(o && "by" in o))
|
|
29025
|
+
r.refuse(path2, "a passed second-signature slot needs by");
|
|
29026
|
+
}
|
|
29027
|
+
return { state, by, at, through };
|
|
29028
|
+
}
|
|
29029
|
+
var EPOCH = { ms: 0, fraction: "" };
|
|
29030
|
+
function readRow2(r, v, path2, kind) {
|
|
29031
|
+
if (kind === "checkpoint") {
|
|
29032
|
+
const o2 = r.object(
|
|
29033
|
+
v,
|
|
29034
|
+
path2,
|
|
29035
|
+
[
|
|
29036
|
+
"kind",
|
|
29037
|
+
"cut_at",
|
|
29038
|
+
"log_size",
|
|
29039
|
+
"anchor",
|
|
29040
|
+
"signature",
|
|
29041
|
+
"witness",
|
|
29042
|
+
"second_signature"
|
|
29043
|
+
],
|
|
29044
|
+
[
|
|
29045
|
+
"kind",
|
|
29046
|
+
"cut_at",
|
|
29047
|
+
"log_size",
|
|
29048
|
+
"anchor",
|
|
29049
|
+
"signature",
|
|
29050
|
+
"witness",
|
|
29051
|
+
"second_signature"
|
|
29052
|
+
]
|
|
29053
|
+
);
|
|
29054
|
+
if (!o2) return void 0;
|
|
29055
|
+
if (o2["kind"] !== "checkpoint")
|
|
29056
|
+
r.refuse(`${path2}.kind`, "must be the page's kind, checkpoint");
|
|
29057
|
+
return {
|
|
29058
|
+
kind,
|
|
29059
|
+
cut: r.time(o2["cut_at"], `${path2}.cut_at`) ?? EPOCH,
|
|
29060
|
+
logSize: r.count(o2["log_size"], `${path2}.log_size`) ?? 0,
|
|
29061
|
+
anchor: r.string(o2["anchor"], `${path2}.anchor`, 200) ?? "",
|
|
29062
|
+
signature: r.oneOf(o2["signature"], `${path2}.signature`, [
|
|
29063
|
+
"pass",
|
|
29064
|
+
"fail",
|
|
29065
|
+
"not_run"
|
|
29066
|
+
]) ?? "not_run",
|
|
29067
|
+
witness: readSlot(r, o2["witness"], `${path2}.witness`, false),
|
|
29068
|
+
second: readSlot(
|
|
29069
|
+
r,
|
|
29070
|
+
o2["second_signature"],
|
|
29071
|
+
`${path2}.second_signature`,
|
|
29072
|
+
true
|
|
29073
|
+
)
|
|
29074
|
+
};
|
|
29075
|
+
}
|
|
29076
|
+
const o = r.object(
|
|
29077
|
+
v,
|
|
29078
|
+
path2,
|
|
29079
|
+
[
|
|
29080
|
+
"kind",
|
|
29081
|
+
"asked",
|
|
29082
|
+
"outcome",
|
|
29083
|
+
"money",
|
|
29084
|
+
"opened_at",
|
|
29085
|
+
"last_at",
|
|
29086
|
+
"record",
|
|
29087
|
+
"witness",
|
|
29088
|
+
"second_signature"
|
|
29089
|
+
],
|
|
29090
|
+
[
|
|
29091
|
+
"kind",
|
|
29092
|
+
"asked",
|
|
29093
|
+
"outcome",
|
|
29094
|
+
"opened_at",
|
|
29095
|
+
"last_at",
|
|
29096
|
+
"record",
|
|
29097
|
+
"witness",
|
|
29098
|
+
"second_signature"
|
|
29099
|
+
]
|
|
29100
|
+
);
|
|
29101
|
+
if (!o) return void 0;
|
|
29102
|
+
if (o["kind"] !== "deal")
|
|
29103
|
+
r.refuse(`${path2}.kind`, "must be the page's kind, deal");
|
|
29104
|
+
return {
|
|
29105
|
+
kind,
|
|
29106
|
+
asked: r.string(o["asked"], `${path2}.asked`) ?? "",
|
|
29107
|
+
outcome: r.string(o["outcome"], `${path2}.outcome`, 200) ?? "",
|
|
29108
|
+
money: "money" in o ? r.string(o["money"], `${path2}.money`, 200) : void 0,
|
|
29109
|
+
opened: r.time(o["opened_at"], `${path2}.opened_at`) ?? EPOCH,
|
|
29110
|
+
last: r.time(o["last_at"], `${path2}.last_at`) ?? EPOCH,
|
|
29111
|
+
record: r.string(o["record"], `${path2}.record`, 200) ?? "",
|
|
29112
|
+
witness: readSlot(r, o["witness"], `${path2}.witness`, false),
|
|
29113
|
+
second: readSlot(
|
|
29114
|
+
r,
|
|
29115
|
+
o["second_signature"],
|
|
29116
|
+
`${path2}.second_signature`,
|
|
29117
|
+
true
|
|
29118
|
+
)
|
|
29119
|
+
};
|
|
29120
|
+
}
|
|
29121
|
+
var TOP = [
|
|
29122
|
+
"view",
|
|
29123
|
+
"kind",
|
|
29124
|
+
"surface",
|
|
29125
|
+
"reader",
|
|
29126
|
+
"holder",
|
|
29127
|
+
"audience",
|
|
29128
|
+
"built_at",
|
|
29129
|
+
"checked",
|
|
29130
|
+
"outcome",
|
|
29131
|
+
"picked",
|
|
29132
|
+
"rows",
|
|
29133
|
+
"checks",
|
|
29134
|
+
"periods",
|
|
29135
|
+
"sharing",
|
|
29136
|
+
"signer_directory",
|
|
29137
|
+
"period"
|
|
29138
|
+
];
|
|
29139
|
+
function buildHistoryView(input, overlay) {
|
|
29140
|
+
const r = new Reader2();
|
|
29141
|
+
const o = r.object(input, "input", TOP, [
|
|
29142
|
+
"view",
|
|
29143
|
+
"kind",
|
|
29144
|
+
"surface",
|
|
29145
|
+
"reader",
|
|
29146
|
+
"holder",
|
|
29147
|
+
"audience",
|
|
29148
|
+
"built_at",
|
|
29149
|
+
"checked",
|
|
29150
|
+
"rows",
|
|
29151
|
+
"checks"
|
|
29152
|
+
]);
|
|
29153
|
+
if (!o) return { ok: false, reasons: r.reasons };
|
|
29154
|
+
if (o["view"] !== HISTORY_VIEW)
|
|
29155
|
+
r.refuse("input.view", `is not ${HISTORY_VIEW}`);
|
|
29156
|
+
const kind = r.oneOf(o["kind"], "input.kind", ["checkpoint", "deal"]) ?? "checkpoint";
|
|
29157
|
+
const surface = r.oneOf(o["surface"], "input.surface", ["neutral", "product"]) ?? "neutral";
|
|
29158
|
+
const reader = r.oneOf(o["reader"], "input.reader", ["owner", "recipient"]) ?? "recipient";
|
|
29159
|
+
let words = {};
|
|
29160
|
+
if (overlay !== void 0) {
|
|
29161
|
+
if (surface !== "product")
|
|
29162
|
+
r.refuse("overlay", "a neutral page takes no overlay");
|
|
29163
|
+
else words = readOverlay(r, overlay);
|
|
29164
|
+
}
|
|
29165
|
+
const ho = r.object(
|
|
29166
|
+
o["holder"],
|
|
29167
|
+
"input.holder",
|
|
29168
|
+
["node", "name", "stream"],
|
|
29169
|
+
[]
|
|
29170
|
+
);
|
|
29171
|
+
const node = ho && "node" in ho ? r.string(ho["node"], "input.holder.node", 200) : void 0;
|
|
29172
|
+
const name = ho && "name" in ho ? r.string(ho["name"], "input.holder.name", 200) : void 0;
|
|
29173
|
+
const stream = ho && "stream" in ho ? r.string(ho["stream"], "input.holder.stream", 200) : void 0;
|
|
29174
|
+
if (kind === "checkpoint" && node === void 0 && ho)
|
|
29175
|
+
r.refuse(
|
|
29176
|
+
"input.holder.node",
|
|
29177
|
+
"is missing (a checkpoint page names its node)"
|
|
29178
|
+
);
|
|
29179
|
+
const au = r.object(
|
|
29180
|
+
o["audience"],
|
|
29181
|
+
"input.audience",
|
|
29182
|
+
["kind", "for"],
|
|
29183
|
+
["kind"]
|
|
29184
|
+
);
|
|
29185
|
+
const audienceKind = au ? r.oneOf(au["kind"], "input.audience.kind", [
|
|
29186
|
+
"private",
|
|
29187
|
+
"shared",
|
|
29188
|
+
"anyone"
|
|
29189
|
+
]) ?? "anyone" : "anyone";
|
|
29190
|
+
const audienceFor = audienceKind === "shared" && au ? r.string(au["for"], "input.audience.for", 200) : void 0;
|
|
29191
|
+
if (audienceKind !== "shared" && au && "for" in au)
|
|
29192
|
+
r.refuse("input.audience.for", "is only for a shared audience");
|
|
29193
|
+
const built = r.time(o["built_at"], "input.built_at") ?? EPOCH;
|
|
29194
|
+
const ck = r.object(
|
|
29195
|
+
o["checked"],
|
|
29196
|
+
"input.checked",
|
|
29197
|
+
["where", "by"],
|
|
29198
|
+
["where", "by"]
|
|
29199
|
+
);
|
|
29200
|
+
const where = ck ? r.oneOf(ck["where"], "input.checked.where", [
|
|
29201
|
+
"page",
|
|
29202
|
+
"builder"
|
|
29203
|
+
]) ?? "builder" : "builder";
|
|
29204
|
+
const checkedBy = ck ? r.string(ck["by"], "input.checked.by", 200) ?? "" : "";
|
|
29205
|
+
let outcome = "answered";
|
|
29206
|
+
let refusedReason;
|
|
29207
|
+
if ("outcome" in o) {
|
|
29208
|
+
if (kind !== "checkpoint")
|
|
29209
|
+
r.refuse("input.outcome", "is only for a checkpoint page");
|
|
29210
|
+
const oc = r.object(
|
|
29211
|
+
o["outcome"],
|
|
29212
|
+
"input.outcome",
|
|
29213
|
+
["kind", "reason"],
|
|
29214
|
+
["kind"]
|
|
29215
|
+
);
|
|
29216
|
+
if (oc) {
|
|
29217
|
+
outcome = r.oneOf(oc["kind"], "input.outcome.kind", [
|
|
29218
|
+
"answered",
|
|
29219
|
+
"refused",
|
|
29220
|
+
"unreadable"
|
|
29221
|
+
]) ?? "answered";
|
|
29222
|
+
if (outcome === "refused")
|
|
29223
|
+
refusedReason = r.string(oc["reason"], "input.outcome.reason", 200);
|
|
29224
|
+
else if ("reason" in oc)
|
|
29225
|
+
r.refuse("input.outcome.reason", "is only for a refused answer");
|
|
29226
|
+
}
|
|
29227
|
+
}
|
|
29228
|
+
const picked = "picked" in o ? r.bool(o["picked"], "input.picked") === true : false;
|
|
29229
|
+
if (picked && kind !== "deal")
|
|
29230
|
+
r.refuse("input.picked", "is only for a deal page");
|
|
29231
|
+
if (kind === "deal" && reader === "recipient" && name === void 0)
|
|
29232
|
+
r.refuse(
|
|
29233
|
+
"input.holder.name",
|
|
29234
|
+
"is missing (a deal page shown to someone else names whose it is)"
|
|
29235
|
+
);
|
|
29236
|
+
else if (picked && name === void 0)
|
|
29237
|
+
r.refuse(
|
|
29238
|
+
"input.holder.name",
|
|
29239
|
+
"is missing (a picked selection names who picked it)"
|
|
29240
|
+
);
|
|
29241
|
+
const rows = [];
|
|
29242
|
+
if (Array.isArray(o["rows"])) {
|
|
29243
|
+
if (o["rows"].length > 1e4)
|
|
29244
|
+
r.refuse("input.rows", "has more than 10000 rows");
|
|
29245
|
+
o["rows"].forEach((row2, i) => {
|
|
29246
|
+
const read = readRow2(r, row2, `input.rows[${i}]`, kind);
|
|
29247
|
+
if (read) rows.push(read);
|
|
29248
|
+
});
|
|
29249
|
+
if (outcome !== "answered" && o["rows"].length > 0)
|
|
29250
|
+
r.refuse("input.rows", "must be empty unless the node answered");
|
|
29251
|
+
} else r.refuse("input.rows", "is not a list");
|
|
29252
|
+
const checks = [];
|
|
29253
|
+
if (Array.isArray(o["checks"])) {
|
|
29254
|
+
o["checks"].forEach((c, i) => {
|
|
29255
|
+
const path2 = `input.checks[${i}]`;
|
|
29256
|
+
const co = r.object(
|
|
29257
|
+
c,
|
|
29258
|
+
path2,
|
|
29259
|
+
["id", "status", "values"],
|
|
29260
|
+
["id", "status"]
|
|
29261
|
+
);
|
|
29262
|
+
if (!co) return;
|
|
29263
|
+
const id = r.oneOf(co["id"], `${path2}.id`, HISTORY_CHECK_IDS);
|
|
29264
|
+
const status2 = r.oneOf(co["status"], `${path2}.status`, [
|
|
29265
|
+
"pass",
|
|
29266
|
+
"fail",
|
|
29267
|
+
"not_run"
|
|
29268
|
+
]);
|
|
29269
|
+
if ("values" in co) {
|
|
29270
|
+
const vo = r.object(co["values"], `${path2}.values`, [], []);
|
|
29271
|
+
if (vo && Object.keys(vo).length > 0)
|
|
29272
|
+
r.refuse(
|
|
29273
|
+
`${path2}.values`,
|
|
29274
|
+
"names a placeholder the check's words do not have"
|
|
29275
|
+
);
|
|
29276
|
+
}
|
|
29277
|
+
if (id && checks.some((x) => x.id === id))
|
|
29278
|
+
r.refuse(`${path2}.id`, "is listed twice");
|
|
29279
|
+
if (id && status2) checks.push({ id, status: status2 });
|
|
29280
|
+
});
|
|
29281
|
+
} else r.refuse("input.checks", "is not a list");
|
|
29282
|
+
const periods = [];
|
|
29283
|
+
if ("periods" in o) {
|
|
29284
|
+
if (kind !== "checkpoint")
|
|
29285
|
+
r.refuse("input.periods", "is only for a checkpoint page");
|
|
29286
|
+
if (Array.isArray(o["periods"]))
|
|
29287
|
+
o["periods"].forEach((p, i) => {
|
|
29288
|
+
const path2 = `input.periods[${i}]`;
|
|
29289
|
+
const po = r.object(
|
|
29290
|
+
p,
|
|
29291
|
+
path2,
|
|
29292
|
+
["from", "to", "cells"],
|
|
29293
|
+
["from", "to", "cells"]
|
|
29294
|
+
);
|
|
29295
|
+
if (!po) return;
|
|
29296
|
+
const from = r.date(po["from"], `${path2}.from`);
|
|
29297
|
+
const to = r.date(po["to"], `${path2}.to`);
|
|
29298
|
+
const cells = [];
|
|
29299
|
+
if (Array.isArray(po["cells"]))
|
|
29300
|
+
po["cells"].forEach((c, j) => {
|
|
29301
|
+
const co = r.object(
|
|
29302
|
+
c,
|
|
29303
|
+
`${path2}.cells[${j}]`,
|
|
29304
|
+
["what", "value", "withheld"],
|
|
29305
|
+
["what"]
|
|
29306
|
+
);
|
|
29307
|
+
const what = co ? r.string(co["what"], `${path2}.cells[${j}].what`, 200) : void 0;
|
|
29308
|
+
const withheld = co !== null && "withheld" in co;
|
|
29309
|
+
if (withheld && co["withheld"] !== true)
|
|
29310
|
+
r.refuse(`${path2}.cells[${j}].withheld`, "is not true");
|
|
29311
|
+
if (co && withheld === "value" in co)
|
|
29312
|
+
r.refuse(
|
|
29313
|
+
`${path2}.cells[${j}]`,
|
|
29314
|
+
"carries either a value or withheld: true"
|
|
29315
|
+
);
|
|
29316
|
+
const value = co && "value" in co ? r.string(co["value"], `${path2}.cells[${j}].value`, 40) : void 0;
|
|
29317
|
+
if (what !== void 0) cells.push({ what, value });
|
|
29318
|
+
});
|
|
29319
|
+
else r.refuse(`${path2}.cells`, "is not a list");
|
|
29320
|
+
if (from && to) periods.push({ from, to, cells });
|
|
29321
|
+
});
|
|
29322
|
+
else r.refuse("input.periods", "is not a list");
|
|
29323
|
+
}
|
|
29324
|
+
let sharing;
|
|
29325
|
+
if (kind === "checkpoint" && !("sharing" in o))
|
|
29326
|
+
r.refuse(
|
|
29327
|
+
"input.sharing",
|
|
29328
|
+
"is missing (a checkpoint page says what its node shares)"
|
|
29329
|
+
);
|
|
29330
|
+
if ("sharing" in o) {
|
|
29331
|
+
if (kind !== "checkpoint")
|
|
29332
|
+
r.refuse("input.sharing", "is only for a checkpoint page");
|
|
29333
|
+
const keys = [
|
|
29334
|
+
"standard_history",
|
|
29335
|
+
"history_segments",
|
|
29336
|
+
"record_at_completion",
|
|
29337
|
+
"adjudications",
|
|
29338
|
+
"exchange_corroboration",
|
|
29339
|
+
"adjudicate_differing_twins",
|
|
29340
|
+
"witnesses"
|
|
29341
|
+
];
|
|
29342
|
+
const so = r.object(o["sharing"], "input.sharing", keys, keys.slice(0, 5));
|
|
29343
|
+
if (so) {
|
|
29344
|
+
let witnesses;
|
|
29345
|
+
if ("witnesses" in so) {
|
|
29346
|
+
witnesses = [];
|
|
29347
|
+
if (Array.isArray(so["witnesses"]))
|
|
29348
|
+
for (const [i, w] of so["witnesses"].entries()) {
|
|
29349
|
+
const s2 = r.string(w, `input.sharing.witnesses[${i}]`, 300);
|
|
29350
|
+
if (s2 !== void 0) witnesses.push(s2);
|
|
29351
|
+
}
|
|
29352
|
+
else r.refuse("input.sharing.witnesses", "is not a list");
|
|
29353
|
+
}
|
|
29354
|
+
const twins = "adjudicate_differing_twins" in so ? r.bool(
|
|
29355
|
+
so["adjudicate_differing_twins"],
|
|
29356
|
+
"input.sharing.adjudicate_differing_twins"
|
|
29357
|
+
) : void 0;
|
|
29358
|
+
const s = {
|
|
29359
|
+
standard_history: r.bool(
|
|
29360
|
+
so["standard_history"],
|
|
29361
|
+
"input.sharing.standard_history"
|
|
29362
|
+
),
|
|
29363
|
+
history_segments: r.oneOf(
|
|
29364
|
+
so["history_segments"],
|
|
29365
|
+
"input.sharing.history_segments",
|
|
29366
|
+
["off", "counterparties", "peers"]
|
|
29367
|
+
),
|
|
29368
|
+
record_at_completion: r.oneOf(
|
|
29369
|
+
so["record_at_completion"],
|
|
29370
|
+
"input.sharing.record_at_completion",
|
|
29371
|
+
["counterparty", "off"]
|
|
29372
|
+
),
|
|
29373
|
+
adjudications: r.oneOf(
|
|
29374
|
+
so["adjudications"],
|
|
29375
|
+
"input.sharing.adjudications",
|
|
29376
|
+
["deliver_to_subjects", "off"]
|
|
29377
|
+
),
|
|
29378
|
+
exchange_corroboration: r.bool(
|
|
29379
|
+
so["exchange_corroboration"],
|
|
29380
|
+
"input.sharing.exchange_corroboration"
|
|
29381
|
+
)
|
|
29382
|
+
};
|
|
29383
|
+
if (Object.values(s).every((x) => x !== void 0))
|
|
29384
|
+
sharing = {
|
|
29385
|
+
...s,
|
|
29386
|
+
...twins !== void 0 ? { adjudicate_differing_twins: twins } : {},
|
|
29387
|
+
...witnesses !== void 0 ? { witnesses } : {}
|
|
29388
|
+
};
|
|
29389
|
+
}
|
|
29390
|
+
}
|
|
29391
|
+
let directory;
|
|
29392
|
+
if ("signer_directory" in o) {
|
|
29393
|
+
if (kind !== "deal")
|
|
29394
|
+
r.refuse("input.signer_directory", "is only for a deal page");
|
|
29395
|
+
directory = r.string(o["signer_directory"], "input.signer_directory", 300);
|
|
29396
|
+
if (directory !== void 0 && !directory.startsWith("https://"))
|
|
29397
|
+
r.refuse("input.signer_directory", "is not an https:// address");
|
|
29398
|
+
}
|
|
29399
|
+
let period;
|
|
29400
|
+
if ("period" in o) {
|
|
29401
|
+
const po = r.object(
|
|
29402
|
+
o["period"],
|
|
29403
|
+
"input.period",
|
|
29404
|
+
["from", "to"],
|
|
29405
|
+
["from", "to"]
|
|
29406
|
+
);
|
|
29407
|
+
const from = po ? r.date(po["from"], "input.period.from") : void 0;
|
|
29408
|
+
const to = po ? r.date(po["to"], "input.period.to") : void 0;
|
|
29409
|
+
if (from && to) period = { from, to };
|
|
29410
|
+
}
|
|
29411
|
+
if (r.reasons.length > 0) return { ok: false, reasons: r.reasons };
|
|
29412
|
+
const say = (key, values = {}) => {
|
|
29413
|
+
const text2 = words[key] ?? BASE[key];
|
|
29414
|
+
if (text2 === void 0)
|
|
29415
|
+
throw new Error(`history-view: no words for ${key}`);
|
|
29416
|
+
return text2.replace(PLACEHOLDER2, (_, p) => {
|
|
29417
|
+
const v = values[p];
|
|
29418
|
+
if (v === void 0) throw new Error(`history-view: ${key} needs {${p}}`);
|
|
29419
|
+
return v;
|
|
29420
|
+
});
|
|
29421
|
+
};
|
|
29422
|
+
const plural = (key, n, values = {}) => say(`${key}.${n === 1 ? "one" : "other"}`, { n: String(n), ...values });
|
|
29423
|
+
const short2 = (id) => id.length > 12 ? id.slice(0, 12) : id;
|
|
29424
|
+
const failedCheck = checks.some(
|
|
29425
|
+
(c) => c.status === "fail" && !SLOT_CHECKS.has(c.id)
|
|
29426
|
+
);
|
|
29427
|
+
const failedRow = rows.some(
|
|
29428
|
+
(x) => x.kind === "checkpoint" && x.signature === "fail"
|
|
29429
|
+
);
|
|
29430
|
+
const failed2 = failedCheck || failedRow;
|
|
29431
|
+
const allPass = rows.length > 0 && rows.every((x) => x.kind !== "checkpoint" || x.signature === "pass") && checks.filter((c) => !SLOT_CHECKS.has(c.id) && c.status !== "not_run").every((c) => c.status === "pass") && (kind === "deal" || checks.some(
|
|
29432
|
+
(c) => c.id === "checkpoint_signatures" && c.status === "pass"
|
|
29433
|
+
));
|
|
29434
|
+
const passed = (id) => checks.some((c) => c.id === id && c.status === "pass");
|
|
29435
|
+
const everySignature = allPass && passed("envelope_signature") && passed("key_is_node");
|
|
29436
|
+
const verdictKey = everySignature ? "verdict.pass.all" : "verdict.pass";
|
|
29437
|
+
const chipKey = everySignature ? "chip.signatures.pass.all" : "chip.signatures.pass";
|
|
29438
|
+
const statusOf = (id) => checks.find((c) => c.id === id)?.status;
|
|
29439
|
+
const dealRecorded = statusOf("deal_report") === "pass";
|
|
29440
|
+
const witnessFailed = statusOf("witness") === "fail";
|
|
29441
|
+
const secondFailed = statusOf("second_signature") === "fail";
|
|
29442
|
+
const lockChecked = kind === "checkpoint" ? statusOf("checkpoint_signatures") === "pass" && statusOf("checkpoint_chain") === "pass" && statusOf("consistency") === "pass" : dealRecorded;
|
|
29443
|
+
let title;
|
|
29444
|
+
if (kind === "checkpoint")
|
|
29445
|
+
title = stream !== void 0 ? say("header.title.stream", { node: short2(node ?? ""), stream }) : say("header.title.node", { node: short2(node ?? "") });
|
|
29446
|
+
else if (reader === "owner") title = say("header.title.owner");
|
|
29447
|
+
else
|
|
29448
|
+
title = audienceKind === "shared" ? say("header.title.shared", { name: name ?? "" }) : say("header.title.person", { name: name ?? "" });
|
|
29449
|
+
const badge = audienceKind === "private" ? say("badge.private") : audienceKind === "shared" ? say("badge.shared", { who: audienceFor ?? "" }) : say("badge.anyone");
|
|
29450
|
+
const header = el13(
|
|
29451
|
+
"header",
|
|
29452
|
+
{ class: "cvh-header", "data-history": "header" },
|
|
29453
|
+
el13("h1", { class: "cvh-title" }, title),
|
|
29454
|
+
node !== void 0 ? el13(
|
|
29455
|
+
"details",
|
|
29456
|
+
{ class: "cvh-proof" },
|
|
29457
|
+
el13("summary", null, say("proof.node", { id: short2(node) })),
|
|
29458
|
+
el13("code", null, node)
|
|
29459
|
+
) : null,
|
|
29460
|
+
period ? el13(
|
|
29461
|
+
"p",
|
|
29462
|
+
{ class: "cvh-scope" },
|
|
29463
|
+
say("scope.period", {
|
|
29464
|
+
from: dateOf(period.from),
|
|
29465
|
+
to: dateOf(period.to)
|
|
29466
|
+
})
|
|
29467
|
+
) : null,
|
|
29468
|
+
el13("p", { class: "cvh-badge", "data-audience": audienceKind }, badge),
|
|
29469
|
+
el13(
|
|
29470
|
+
"p",
|
|
29471
|
+
{ class: "cvh-built" },
|
|
29472
|
+
say(reader === "owner" ? "built.owner" : "built.recipient", {
|
|
29473
|
+
at: minuteOf(built)
|
|
29474
|
+
})
|
|
29475
|
+
)
|
|
29476
|
+
);
|
|
29477
|
+
const heroLines = [];
|
|
29478
|
+
let drawRows = false;
|
|
29479
|
+
if (outcome === "refused") {
|
|
29480
|
+
heroLines.push(say("hero.refused"));
|
|
29481
|
+
if (refusedReason !== void 0)
|
|
29482
|
+
heroLines.push(say("hero.refused.reason", { reason: refusedReason }));
|
|
29483
|
+
} else if (outcome === "unreadable") heroLines.push(say("hero.unreadable"));
|
|
29484
|
+
else if (failed2) heroLines.push(say("hero.failed"));
|
|
29485
|
+
else if (rows.length === 0)
|
|
29486
|
+
heroLines.push(
|
|
29487
|
+
say(kind === "checkpoint" ? "hero.none.checkpoints" : "hero.none.deals")
|
|
29488
|
+
);
|
|
29489
|
+
else {
|
|
29490
|
+
drawRows = true;
|
|
29491
|
+
if (kind === "checkpoint") {
|
|
29492
|
+
const cps = rows;
|
|
29493
|
+
const last = cps.reduce((a, b) => b.cut.ms > a.cut.ms ? b : a);
|
|
29494
|
+
const entries = Math.max(...cps.map((c) => c.logSize));
|
|
29495
|
+
heroLines.push(
|
|
29496
|
+
plural("hero.checkpoints", cps.length, {
|
|
29497
|
+
entries: plural("hero.entries", entries),
|
|
29498
|
+
at: shortMinuteOf(last.cut),
|
|
29499
|
+
verdict: say(allPass ? verdictKey : "verdict.unchecked")
|
|
29500
|
+
})
|
|
29501
|
+
);
|
|
29502
|
+
} else
|
|
29503
|
+
heroLines.push(
|
|
29504
|
+
picked ? plural("hero.deals.picked", rows.length, { name: name ?? "" }) : plural("hero.deals", rows.length)
|
|
29505
|
+
);
|
|
29506
|
+
}
|
|
29507
|
+
const hero = el13(
|
|
29508
|
+
"section",
|
|
29509
|
+
{ class: "cvh-hero", "data-history": "hero" },
|
|
29510
|
+
...heroLines.map(
|
|
29511
|
+
(line, i) => el13("p", { class: i === 0 ? "cvh-hero-line" : "cvh-hero-note" }, line)
|
|
29512
|
+
)
|
|
29513
|
+
);
|
|
29514
|
+
let chips = null;
|
|
29515
|
+
if (drawRows) {
|
|
29516
|
+
const stamped = rows.filter((x) => x.witness.state === "passed").length;
|
|
29517
|
+
const stampChip = witnessFailed ? say("chip.timestamped.failed") : stamped === 0 && rows.some((x) => x.witness.state === "not_checked") ? say("chip.timestamped.unchecked") : stamped === 0 ? say("chip.timestamped.none") : stamped === rows.length ? say("chip.timestamped.all", { n: String(rows.length) }) : say("chip.timestamped.some", {
|
|
29518
|
+
k: String(stamped),
|
|
29519
|
+
n: String(rows.length)
|
|
29520
|
+
});
|
|
29521
|
+
const items = [];
|
|
29522
|
+
if (kind === "checkpoint") {
|
|
29523
|
+
items.push(
|
|
29524
|
+
say(allPass ? chipKey : "chip.signatures.unchecked"),
|
|
29525
|
+
stampChip
|
|
29526
|
+
);
|
|
29527
|
+
const first = rows.reduce(
|
|
29528
|
+
(a, b) => b.cut.ms < a.cut.ms ? b : a
|
|
29529
|
+
);
|
|
29530
|
+
items.push(say("chip.started", { date: dateOf(first.cut) }));
|
|
29531
|
+
} else {
|
|
29532
|
+
if (dealRecorded) items.push(say("chip.recorded"));
|
|
29533
|
+
items.push(stampChip);
|
|
29534
|
+
}
|
|
29535
|
+
chips = el13(
|
|
29536
|
+
"ul",
|
|
29537
|
+
{ class: "cvh-chips", "data-history": "chips" },
|
|
29538
|
+
...items.map((t) => el13("li", { class: "cvh-chip" }, t))
|
|
29539
|
+
);
|
|
29540
|
+
}
|
|
29541
|
+
const slotLine = (s, second) => {
|
|
29542
|
+
if (s.state === "passed") {
|
|
29543
|
+
const at = s.at ? minuteOf(s.at) : "";
|
|
29544
|
+
let line = second ? say("slot.second.by", { by: s.by ?? "", at }) : s.by !== void 0 ? say("slot.timestamped.by", { at, by: s.by }) : say("slot.timestamped.at", { at });
|
|
29545
|
+
if (s.through && s.through.k < s.through.n)
|
|
29546
|
+
line += ` \xB7 ${say("slot.part", { k: String(s.through.k), n: String(s.through.n) })}`;
|
|
29547
|
+
return line;
|
|
29548
|
+
}
|
|
29549
|
+
if (s.state === "failed") return say("slot.failed");
|
|
29550
|
+
if (s.state === "none")
|
|
29551
|
+
return say(second ? "slot.second.none" : "slot.timestamped.none");
|
|
29552
|
+
return say("slot.unchecked");
|
|
29553
|
+
};
|
|
29554
|
+
const stamp = (nameKey, filled, state, line) => el13(
|
|
29555
|
+
"li",
|
|
29556
|
+
{
|
|
29557
|
+
class: "cvh-stamp",
|
|
29558
|
+
"data-filled": filled ? "yes" : "no",
|
|
29559
|
+
"data-state": state
|
|
29560
|
+
},
|
|
29561
|
+
el13("span", { class: "cvh-stamp-name" }, say(nameKey)),
|
|
29562
|
+
line !== null ? el13("span", { class: "cvh-stamp-line" }, line) : null
|
|
29563
|
+
);
|
|
29564
|
+
const slotStamps = (row2) => [
|
|
29565
|
+
stamp(
|
|
29566
|
+
"stamp.timestamped",
|
|
29567
|
+
row2.witness.state === "passed",
|
|
29568
|
+
row2.witness.state,
|
|
29569
|
+
slotLine(row2.witness, false)
|
|
29570
|
+
),
|
|
29571
|
+
stamp(
|
|
29572
|
+
"stamp.second",
|
|
29573
|
+
row2.second.state === "passed",
|
|
29574
|
+
row2.second.state,
|
|
29575
|
+
slotLine(row2.second, true)
|
|
29576
|
+
)
|
|
29577
|
+
];
|
|
29578
|
+
const proof = (key, id) => el13(
|
|
29579
|
+
"details",
|
|
29580
|
+
{ class: "cvh-proof" },
|
|
29581
|
+
el13("summary", null, say(key, { id: short2(id) })),
|
|
29582
|
+
el13("code", null, id)
|
|
29583
|
+
);
|
|
29584
|
+
let rowList = null;
|
|
29585
|
+
if (drawRows) {
|
|
29586
|
+
const seconds = /* @__PURE__ */ new Map();
|
|
29587
|
+
if (kind === "checkpoint")
|
|
29588
|
+
for (const x of rows)
|
|
29589
|
+
seconds.set(
|
|
29590
|
+
Math.floor(x.cut.ms / 1e3),
|
|
29591
|
+
(seconds.get(Math.floor(x.cut.ms / 1e3)) ?? 0) + 1
|
|
29592
|
+
);
|
|
29593
|
+
const items = rows.map((x) => {
|
|
29594
|
+
if (x.kind === "checkpoint") {
|
|
29595
|
+
const tie = (seconds.get(Math.floor(x.cut.ms / 1e3)) ?? 0) > 1;
|
|
29596
|
+
return el13(
|
|
29597
|
+
"li",
|
|
29598
|
+
{ class: "cvh-row", "data-history": "row" },
|
|
29599
|
+
el13(
|
|
29600
|
+
"p",
|
|
29601
|
+
{ class: "cvh-row-title" },
|
|
29602
|
+
say("row.cut", { at: secondOf(x.cut, tie) })
|
|
29603
|
+
),
|
|
29604
|
+
el13(
|
|
29605
|
+
"p",
|
|
29606
|
+
{ class: "cvh-row-detail" },
|
|
29607
|
+
plural("row.entries", x.logSize)
|
|
29608
|
+
),
|
|
29609
|
+
proof("proof.checkpoint", x.anchor),
|
|
29610
|
+
el13(
|
|
29611
|
+
"ul",
|
|
29612
|
+
{ class: "cvh-stamps" },
|
|
29613
|
+
stamp(
|
|
29614
|
+
"stamp.recorded",
|
|
29615
|
+
x.signature === "pass",
|
|
29616
|
+
x.signature,
|
|
29617
|
+
x.signature === "pass" ? null : say("stamp.signature.unchecked")
|
|
29618
|
+
),
|
|
29619
|
+
...slotStamps(x)
|
|
29620
|
+
)
|
|
29621
|
+
);
|
|
29622
|
+
}
|
|
29623
|
+
const detail = [
|
|
29624
|
+
x.outcome,
|
|
29625
|
+
...x.money !== void 0 ? [x.money] : [],
|
|
29626
|
+
say("row.opened", { at: minuteOf(x.opened) }),
|
|
29627
|
+
say("row.last", { at: minuteOf(x.last) })
|
|
29628
|
+
].join(" \xB7 ");
|
|
29629
|
+
return el13(
|
|
29630
|
+
"li",
|
|
29631
|
+
{ class: "cvh-row", "data-history": "row" },
|
|
29632
|
+
el13("p", { class: "cvh-row-title" }, x.asked),
|
|
29633
|
+
el13("p", { class: "cvh-row-detail" }, detail),
|
|
29634
|
+
proof("proof.record", x.record),
|
|
29635
|
+
el13(
|
|
29636
|
+
"ul",
|
|
29637
|
+
{ class: "cvh-stamps" },
|
|
29638
|
+
dealRecorded ? stamp("stamp.recorded", true, "passed", null) : stamp(
|
|
29639
|
+
"stamp.recorded",
|
|
29640
|
+
false,
|
|
29641
|
+
"not_checked",
|
|
29642
|
+
say("slot.unchecked")
|
|
29643
|
+
),
|
|
29644
|
+
...slotStamps(x)
|
|
29645
|
+
)
|
|
29646
|
+
);
|
|
29647
|
+
});
|
|
29648
|
+
rowList = el13(
|
|
29649
|
+
"section",
|
|
29650
|
+
{ class: "cvh-rows-block" },
|
|
29651
|
+
el13(
|
|
29652
|
+
"h2",
|
|
29653
|
+
null,
|
|
29654
|
+
say(
|
|
29655
|
+
kind === "checkpoint" ? "rows.heading.checkpoints" : "rows.heading.deals"
|
|
29656
|
+
)
|
|
29657
|
+
),
|
|
29658
|
+
el13("ol", { class: "cvh-rows", "data-history": "rows" }, ...items)
|
|
29659
|
+
);
|
|
29660
|
+
}
|
|
29661
|
+
const periodBlock = drawRows && periods.length > 0 ? el13(
|
|
29662
|
+
"section",
|
|
29663
|
+
{ class: "cvh-periods", "data-history": "periods" },
|
|
29664
|
+
el13("h2", null, say("periods.heading")),
|
|
29665
|
+
el13(
|
|
29666
|
+
"ul",
|
|
29667
|
+
null,
|
|
29668
|
+
...periods.map(
|
|
29669
|
+
(p) => el13(
|
|
29670
|
+
"li",
|
|
29671
|
+
null,
|
|
29672
|
+
el13(
|
|
29673
|
+
"p",
|
|
29674
|
+
null,
|
|
29675
|
+
say("periods.row", {
|
|
29676
|
+
from: dateOf(p.from),
|
|
29677
|
+
to: dateOf(p.to)
|
|
29678
|
+
})
|
|
29679
|
+
),
|
|
29680
|
+
el13(
|
|
29681
|
+
"ul",
|
|
29682
|
+
null,
|
|
29683
|
+
...p.cells.map(
|
|
29684
|
+
(c) => el13(
|
|
29685
|
+
"li",
|
|
29686
|
+
null,
|
|
29687
|
+
c.value === void 0 ? say("periods.cell.withheld", { what: c.what }) : say("periods.cell", { what: c.what, value: c.value })
|
|
29688
|
+
)
|
|
29689
|
+
)
|
|
29690
|
+
)
|
|
29691
|
+
)
|
|
29692
|
+
)
|
|
29693
|
+
)
|
|
29694
|
+
) : null;
|
|
29695
|
+
const callout = outcome === "answered" && !failed2 ? el13(
|
|
29696
|
+
"aside",
|
|
29697
|
+
{ class: "cvh-callout", "data-history": "does-not-show" },
|
|
29698
|
+
el13("h2", null, say("callout.heading")),
|
|
29699
|
+
el13(
|
|
29700
|
+
"p",
|
|
29701
|
+
null,
|
|
29702
|
+
kind === "checkpoint" ? say("callout.checkpoints") : picked ? say("callout.deals.picked", { name: name ?? "" }) : say("callout.deals")
|
|
29703
|
+
)
|
|
29704
|
+
) : null;
|
|
29705
|
+
let shares = null;
|
|
29706
|
+
if (sharing) {
|
|
29707
|
+
const lines = [say("shares.summary")];
|
|
29708
|
+
lines.push(
|
|
29709
|
+
say(
|
|
29710
|
+
sharing.standard_history ? "shares.standard.on" : "shares.standard.off"
|
|
29711
|
+
)
|
|
29712
|
+
);
|
|
29713
|
+
if (sharing.history_segments === "counterparties")
|
|
29714
|
+
lines.push(say("shares.segments.counterparties"));
|
|
29715
|
+
else if (sharing.history_segments === "peers")
|
|
29716
|
+
lines.push(say("shares.segments.peers"));
|
|
29717
|
+
else
|
|
29718
|
+
lines.push(
|
|
29719
|
+
sharing.record_at_completion === "counterparty" ? `${say("shares.segments.off")} ${say("shares.segments.off.sealed")}` : say("shares.segments.off")
|
|
29720
|
+
);
|
|
29721
|
+
if (sharing.exchange_corroboration)
|
|
29722
|
+
lines.push(say("shares.corroboration.on"));
|
|
29723
|
+
lines.push(
|
|
29724
|
+
say(
|
|
29725
|
+
sharing.record_at_completion === "counterparty" ? "shares.completion.on" : "shares.completion.off"
|
|
29726
|
+
)
|
|
29727
|
+
);
|
|
29728
|
+
lines.push(
|
|
29729
|
+
say(
|
|
29730
|
+
sharing.adjudications === "deliver_to_subjects" ? "shares.adjudications.on" : "shares.adjudications.off"
|
|
29731
|
+
)
|
|
29732
|
+
);
|
|
29733
|
+
if (sharing.adjudicate_differing_twins === void 0)
|
|
29734
|
+
lines.push(say("shares.twins.unstated"));
|
|
29735
|
+
else if (sharing.adjudicate_differing_twins)
|
|
29736
|
+
lines.push(say("shares.twins.on"));
|
|
29737
|
+
if (sharing.witnesses === void 0)
|
|
29738
|
+
lines.push(say("shares.witnesses.unstated"));
|
|
29739
|
+
else
|
|
29740
|
+
lines.push(
|
|
29741
|
+
sharing.witnesses.length > 0 ? say("shares.witnesses", { witnesses: sharing.witnesses.join(", ") }) : say("shares.witnesses.none")
|
|
29742
|
+
);
|
|
29743
|
+
lines.push(say("shares.never"));
|
|
29744
|
+
shares = el13(
|
|
29745
|
+
"section",
|
|
29746
|
+
{ class: "cvh-shares", "data-history": "shares" },
|
|
29747
|
+
el13("h2", null, say("shares.heading")),
|
|
29748
|
+
el13("ul", null, ...lines.map((l) => el13("li", null, l))),
|
|
29749
|
+
el13(
|
|
29750
|
+
"p",
|
|
29751
|
+
{ class: "cvh-note" },
|
|
29752
|
+
say("shares.as_of", { at: minuteOf(built) })
|
|
29753
|
+
)
|
|
29754
|
+
);
|
|
29755
|
+
}
|
|
29756
|
+
let seal = null;
|
|
29757
|
+
{
|
|
29758
|
+
const states = drawRows ? rows.map((x) => x.second.state) : [];
|
|
29759
|
+
const sealState = secondFailed || states.some((s) => s === "failed") ? "failed" : states.length === 0 || states.some((s) => s === "not_checked") ? "not_checked" : states.every((s) => s === "none") ? "none" : "mixed";
|
|
29760
|
+
const sealLine = sealState === "failed" ? say("slot.failed") : sealState === "none" ? say("slot.second.none") : sealState === "not_checked" ? say("slot.unchecked") : say("seal.second.rows");
|
|
29761
|
+
seal = el13(
|
|
29762
|
+
"section",
|
|
29763
|
+
{ class: "cvh-seal", "data-history": "seal" },
|
|
29764
|
+
drawRows && lockChecked ? el13("p", { class: "cvh-seal-title" }, say("seal.title")) : null,
|
|
29765
|
+
drawRows && lockChecked ? el13(
|
|
29766
|
+
"p",
|
|
29767
|
+
null,
|
|
29768
|
+
say(kind === "checkpoint" ? "seal.checkpoints" : "seal.deals")
|
|
29769
|
+
) : drawRows ? el13("p", null, say("seal.unchecked")) : null,
|
|
29770
|
+
el13(
|
|
29771
|
+
"p",
|
|
29772
|
+
{
|
|
29773
|
+
class: "cvh-seal-slot",
|
|
29774
|
+
"data-filled": "no",
|
|
29775
|
+
"data-state": sealState
|
|
29776
|
+
},
|
|
29777
|
+
el13("span", { class: "cvh-stamp-name" }, say("seal.second.label")),
|
|
29778
|
+
el13("span", { class: "cvh-stamp-line" }, sealLine)
|
|
29779
|
+
),
|
|
29780
|
+
directory !== void 0 ? el13(
|
|
29781
|
+
"p",
|
|
29782
|
+
{ class: "cvh-note", "data-history": "directory" },
|
|
29783
|
+
say("seal.directory", { directory })
|
|
29784
|
+
) : null
|
|
29785
|
+
);
|
|
29786
|
+
}
|
|
29787
|
+
const checkedAttrs = {
|
|
29788
|
+
class: "cvh-checked",
|
|
29789
|
+
"data-history": "checked"
|
|
29790
|
+
};
|
|
29791
|
+
if (failed2 || outcome !== "answered") checkedAttrs["open"] = "";
|
|
29792
|
+
const panel = el13(
|
|
29793
|
+
"details",
|
|
29794
|
+
checkedAttrs,
|
|
29795
|
+
el13("summary", null, say("checked.heading")),
|
|
29796
|
+
el13(
|
|
29797
|
+
"ul",
|
|
29798
|
+
null,
|
|
29799
|
+
...checks.map(
|
|
29800
|
+
(c) => el13(
|
|
29801
|
+
"li",
|
|
29802
|
+
{ class: "cvh-check", "data-status": c.status },
|
|
29803
|
+
say("check.line", {
|
|
29804
|
+
status: say(`status.${c.status}`),
|
|
29805
|
+
name: say(`check.${c.id}`)
|
|
29806
|
+
})
|
|
29807
|
+
)
|
|
29808
|
+
)
|
|
29809
|
+
),
|
|
29810
|
+
el13(
|
|
29811
|
+
"p",
|
|
29812
|
+
{ class: "cvh-note" },
|
|
29813
|
+
where === "page" ? say("checked.where.page", { by: checkedBy }) : say("checked.where.builder", { at: minuteOf(built), by: checkedBy })
|
|
29814
|
+
)
|
|
29815
|
+
);
|
|
29816
|
+
const tree = el13(
|
|
29817
|
+
"section",
|
|
29818
|
+
{
|
|
29819
|
+
class: "cv-history",
|
|
29820
|
+
"data-history": "view",
|
|
29821
|
+
"data-kind": kind,
|
|
29822
|
+
"data-surface": surface,
|
|
29823
|
+
"data-verdict": failed2 ? "failed" : allPass ? "pass" : "unchecked"
|
|
29824
|
+
},
|
|
29825
|
+
header,
|
|
29826
|
+
el13("div", { class: "cvh-main" }, hero, chips, rowList, periodBlock),
|
|
29827
|
+
el13("div", { class: "cvh-side" }, callout, shares, seal, panel)
|
|
29828
|
+
);
|
|
29829
|
+
return { ok: true, tree };
|
|
29830
|
+
}
|
|
29831
|
+
function historyViewHtml(input, overlay) {
|
|
29832
|
+
const built = buildHistoryView(input, overlay);
|
|
29833
|
+
if (!built.ok) throw new HistoryViewRefused(built.reasons);
|
|
29834
|
+
return serializeHistoryElement(built.tree);
|
|
29835
|
+
}
|
|
29836
|
+
function renderHistoryView(input, container, overlay) {
|
|
29837
|
+
const doc = container.ownerDocument;
|
|
29838
|
+
const built = buildHistoryView(input, overlay);
|
|
29839
|
+
const node = built.ok ? historyElementToDom(built.tree, doc) : historyElementToDom(
|
|
29840
|
+
el13(
|
|
29841
|
+
"p",
|
|
29842
|
+
{ class: "cvh-refused", "data-history": "refused" },
|
|
29843
|
+
(BASE["refused"] ?? "").replace(
|
|
29844
|
+
"{reasons}",
|
|
29845
|
+
() => built.reasons.join("; ")
|
|
29846
|
+
)
|
|
29847
|
+
),
|
|
29848
|
+
doc
|
|
29849
|
+
);
|
|
29850
|
+
container.replaceChildren(node);
|
|
29851
|
+
return built.ok;
|
|
29852
|
+
}
|
|
29853
|
+
var historyViewStyles = `.cv-history{--cvh-ink:#1f2733;--cvh-slate:#6b7482;--cvh-line:#e3ded3;--cvh-cream:#f6f2ea;--cvh-navy:#232f42;--cvh-ok:#2e7d5b;--cvh-bad:#b5462f;font:16px/1.45 system-ui,sans-serif;color:var(--cvh-ink);max-width:1120px;margin:0 auto;padding:16px;display:grid;gap:16px}
|
|
29854
|
+
.cv-history h1{font-size:22px;margin:0}.cv-history h2{font-size:15px;margin:0 0 8px;color:var(--cvh-navy)}
|
|
29855
|
+
.cvh-header p{margin:4px 0}.cvh-badge{display:inline-block;border:1px solid var(--cvh-line);border-radius:6px;padding:2px 8px;font-size:12px;font-weight:700;letter-spacing:.02em}
|
|
29856
|
+
.cvh-badge[data-audience=private]{background:#fbefd9;border-color:#e8a33d}.cvh-built,.cvh-note{color:var(--cvh-slate);font-size:13px}
|
|
29857
|
+
.cvh-hero-line{font-size:20px;font-weight:700;margin:0}.cvh-hero-note{margin:6px 0 0;color:var(--cvh-slate)}
|
|
29858
|
+
.cvh-chips{list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:8px}.cvh-chip{background:var(--cvh-cream);border-radius:999px;padding:3px 10px;font-size:13px}
|
|
29859
|
+
.cvh-rows{list-style:none;padding:0;margin:0}.cvh-row{border:1px solid var(--cvh-line);border-radius:10px;padding:10px 12px;margin:0 0 10px}
|
|
29860
|
+
.cvh-row p{margin:0 0 4px}.cvh-row-title{font-weight:700}.cvh-row-detail{color:var(--cvh-slate);font-size:14px}
|
|
29861
|
+
.cvh-proof summary{cursor:pointer;font-size:13px;color:var(--cvh-slate)}.cvh-proof code{font-size:12px;word-break:break-all}
|
|
29862
|
+
.cvh-stamps{list-style:none;padding:0;margin:8px 0 0;display:flex;flex-wrap:wrap;gap:8px}
|
|
29863
|
+
.cvh-stamp,.cvh-seal-slot{border:2px solid var(--cvh-navy);border-radius:999px;padding:2px 10px;font-size:12px;color:var(--cvh-navy)}
|
|
29864
|
+
.cvh-stamp[data-filled=no],.cvh-seal-slot[data-filled=no]{border-style:dotted;border-color:#9aa1ab;color:var(--cvh-slate)}
|
|
29865
|
+
.cvh-stamp[data-state=failed]{border-color:var(--cvh-bad);color:var(--cvh-bad)}
|
|
29866
|
+
.cvh-stamp-name{font-weight:800}.cvh-stamp-line{margin-left:6px}
|
|
29867
|
+
.cvh-callout,.cvh-shares,.cvh-seal,.cvh-periods{border:1px solid var(--cvh-line);border-radius:10px;padding:12px}
|
|
29868
|
+
.cvh-callout{background:var(--cvh-cream)}.cvh-callout p,.cvh-seal p{margin:0 0 6px}.cvh-shares ul,.cvh-periods ul{margin:0;padding-left:18px}
|
|
29869
|
+
.cvh-seal-title{font-weight:700}.cvh-checked summary{cursor:pointer;font-weight:700;color:var(--cvh-navy)}
|
|
29870
|
+
.cvh-check[data-status=fail]{color:var(--cvh-bad)}.cvh-check[data-status=pass]{color:var(--cvh-ok)}
|
|
29871
|
+
.cvh-main,.cvh-side{display:grid;gap:16px;align-content:start}.cvh-refused{border:1px solid var(--cvh-bad);color:var(--cvh-bad);padding:8px 12px;border-radius:8px}
|
|
29872
|
+
@media (min-width:900px){.cv-history{grid-template-columns:minmax(0,3fr) minmax(0,2fr)}.cvh-header{grid-column:1/-1}}
|
|
29873
|
+
@media print{.cv-history{max-width:none;grid-template-columns:1fr}.cvh-proof code{display:block}}
|
|
29874
|
+
`;
|
|
28539
29875
|
return __toCommonJS(browser_exports2);
|
|
28540
29876
|
})();
|
|
28541
29877
|
/*! Bundled license information:
|