@bitcobblers/wod-wiki-ui 0.62.2262 → 0.62.2263

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.
@@ -850,6 +850,15 @@ function formatMMSS(ms) {
850
850
  const s = totalSec % 60;
851
851
  return `${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
852
852
  }
853
+ function formatOffsetMMSS(deltaMs) {
854
+ if (!Number.isFinite(deltaMs)) return "+00:00";
855
+ if (deltaMs < 0) {
856
+ const absSec = Math.floor(-deltaMs / 1e3);
857
+ if (absSec === 0) return "+00:00";
858
+ return `-${formatMMSS(-deltaMs)}`;
859
+ }
860
+ return `+${formatMMSS(deltaMs)}`;
861
+ }
853
862
  function formatClockTime(d) {
854
863
  return d.toLocaleTimeString("en-US", {
855
864
  hour12: false,
@@ -944,10 +953,146 @@ function formatOutputTypeLabel(outputType) {
944
953
  if (!raw) return "System";
945
954
  return OUTPUT_TYPE_LABEL[raw] ?? raw.charAt(0).toUpperCase() + raw.slice(1);
946
955
  }
947
- function formatOutputRowTitle(outputType, elapsedStr) {
948
- const label = formatOutputTypeLabel(outputType);
956
+ var ACRONYMS = {
957
+ c2b: "C2B",
958
+ t2b: "T2B",
959
+ ghd: "GHD",
960
+ hspu: "HSPU",
961
+ amrap: "AMRAP",
962
+ emom: "EMOM",
963
+ rft: "RFT"
964
+ };
965
+ function humanizeSlug(slug) {
966
+ return slug.trim().split(/[-_\s]+/).filter(Boolean).map((word) => {
967
+ const lower = word.toLowerCase();
968
+ return ACRONYMS[lower] ?? word.charAt(0).toUpperCase() + word.slice(1);
969
+ }).join(" ");
970
+ }
971
+ var GENERIC_LABELS = /* @__PURE__ */ new Set(["segment", "statement", "completed", "system"]);
972
+ function resolveOutputRowLabel(out) {
973
+ const explicitLabel = out.label?.trim();
974
+ if (explicitLabel && !GENERIC_LABELS.has(explicitLabel.toLowerCase())) {
975
+ return explicitLabel;
976
+ }
977
+ const all = out.metrics ? Array.from(out.metrics) : [];
978
+ for (const m of all) {
979
+ const t = String(m.type ?? "").toLowerCase();
980
+ if (t === "effort" || t === "action" || t === "label" || t === "text") {
981
+ const rawText = typeof m.image === "string" && m.image.trim() || typeof m.value === "string" && m.value.trim() || "";
982
+ if (!rawText) continue;
983
+ const lower = rawText.toLowerCase();
984
+ if (lower === "ready to start") return "Start";
985
+ if (lower === "session" || lower === "session completed") return "Session";
986
+ if (!GENERIC_LABELS.has(lower)) return rawText;
987
+ }
988
+ }
989
+ if (out.effortSlug && out.effortSlug.trim()) {
990
+ return humanizeSlug(out.effortSlug);
991
+ }
992
+ const rawStatement = (out.statement ?? out.text ?? "").trim();
993
+ if (rawStatement) {
994
+ const firstLine = rawStatement.split("\n")[0]?.trim() ?? "";
995
+ if (firstLine && !GENERIC_LABELS.has(firstLine.toLowerCase())) {
996
+ return firstLine;
997
+ }
998
+ }
999
+ for (const m of all) {
1000
+ const t = String(m.type ?? "").toLowerCase();
1001
+ if (t === "current-round" || t === "rounds") {
1002
+ const img = typeof m.image === "string" ? m.image.trim() : "";
1003
+ if (/^completed\b/i.test(img)) return img;
1004
+ const n = typeof m.value === "number" ? m.value : Number(m.value);
1005
+ if (Number.isFinite(n) && n > 0) {
1006
+ return t === "current-round" ? `Round ${n}` : `${n} ${n === 1 ? "Round" : "Rounds"}`;
1007
+ }
1008
+ }
1009
+ }
1010
+ const blockKey = String(out.sourceBlockKey ?? "").trim().toLowerCase();
1011
+ if (blockKey.startsWith("waiting-to-start")) return "Start";
1012
+ if (blockKey.startsWith("session-root") || blockKey === "root") return "Session";
1013
+ if (blockKey.startsWith("rest")) return "Rest";
1014
+ const roundMatch = /^round[-_:\s]*(\d+)/i.exec(blockKey);
1015
+ if (roundMatch) return `Round ${roundMatch[1]}`;
1016
+ if (blockKey.startsWith("rounds")) return "Rounds";
1017
+ if (String(out.outputType ?? "").toLowerCase() === "analytics" && all.length > 0) {
1018
+ const first = all[0];
1019
+ const meta = first.metadata;
1020
+ const summaryName = typeof meta?.originalKey === "string" && meta.originalKey || typeof meta?.canonicalKey === "string" && meta.canonicalKey || String(first.type ?? "");
1021
+ if (summaryName) return summaryName;
1022
+ }
1023
+ return formatOutputTypeLabel(out.outputType);
1024
+ }
1025
+ function resolveOutputTypeBadgeLabel(out) {
1026
+ const rawType = String(out.outputType ?? "system").trim().toLowerCase();
1027
+ if (rawType !== "segment") return formatOutputTypeLabel(out.outputType);
1028
+ const blockKey = String(out.sourceBlockKey ?? "").trim().toLowerCase();
1029
+ if (blockKey.startsWith("waiting-to-start")) return "Start";
1030
+ if (blockKey.startsWith("session-root") || blockKey === "root") return "Session";
1031
+ if (blockKey.startsWith("rest")) return "Rest";
1032
+ const all = out.metrics ? Array.from(out.metrics) : [];
1033
+ const hasEffort = Boolean(out.effortSlug) || all.some((m) => String(m.type ?? "").toLowerCase() === "effort");
1034
+ if (!hasEffort) {
1035
+ const hasRoundMetric = all.some((m) => {
1036
+ const t = String(m.type ?? "").toLowerCase();
1037
+ return t === "rounds" || t === "current-round";
1038
+ });
1039
+ if (hasRoundMetric || blockKey.startsWith("round")) return "Rounds";
1040
+ }
1041
+ return "Segment";
1042
+ }
1043
+ function formatOutputRowTitle(out, elapsedStr) {
1044
+ const label = resolveOutputRowLabel(out);
949
1045
  return elapsedStr ? `${label} (${elapsedStr})` : label;
950
1046
  }
1047
+ function resolveTimeOrigin(outputs, timeOrigin) {
1048
+ let minStarted;
1049
+ let maxStarted;
1050
+ for (const o of outputs) {
1051
+ const s = o.timeSpan?.started;
1052
+ if (typeof s !== "number" || !Number.isFinite(s)) continue;
1053
+ minStarted = minStarted === void 0 ? s : Math.min(minStarted, s);
1054
+ maxStarted = maxStarted === void 0 ? s : Math.max(maxStarted, s);
1055
+ }
1056
+ if (typeof timeOrigin === "number" && Number.isFinite(timeOrigin)) {
1057
+ if (minStarted !== void 0 && timeOrigin > minStarted && (maxStarted === void 0 || timeOrigin >= maxStarted)) {
1058
+ return minStarted;
1059
+ }
1060
+ return timeOrigin;
1061
+ }
1062
+ return minStarted;
1063
+ }
1064
+ function metricDurationToMs(m) {
1065
+ const rawVal = typeof m.value === "number" ? m.value : Number(m.value);
1066
+ if (!Number.isFinite(rawVal) || rawVal <= 0) return void 0;
1067
+ const unit = "unit" in m && typeof m.unit === "string" ? m.unit.trim().toLowerCase() : "";
1068
+ if (unit === "s" || unit === "sec" || unit === "secs" || unit === "second" || unit === "seconds") {
1069
+ return rawVal * 1e3;
1070
+ }
1071
+ if (unit === "min" || unit === "mins" || unit === "minute" || unit === "minutes") {
1072
+ return rawVal * 6e4;
1073
+ }
1074
+ return rawVal;
1075
+ }
1076
+ function resolveRowDurationMs(out) {
1077
+ const started = out.timeSpan?.started;
1078
+ const ended = out.timeSpan?.ended;
1079
+ if (started !== void 0 && ended !== void 0 && ended > started) {
1080
+ return ended - started;
1081
+ }
1082
+ if (out.metrics) {
1083
+ for (const m of out.metrics) {
1084
+ const t = String(m.type ?? "").toLowerCase();
1085
+ if (t === "elapsed" || t === "duration") {
1086
+ const ms = metricDurationToMs(m);
1087
+ if (ms !== void 0 && ms > 0) return ms;
1088
+ }
1089
+ }
1090
+ }
1091
+ if (started !== void 0 && ended !== void 0) {
1092
+ return Math.max(0, ended - started);
1093
+ }
1094
+ return void 0;
1095
+ }
951
1096
  var EFFORT_TYPES = /* @__PURE__ */ new Set(["effort", "text", "action", "label"]);
952
1097
  var LOAD_TYPES = /* @__PURE__ */ new Set([
953
1098
  "resistance",
@@ -1153,13 +1298,11 @@ function extractMetricsForColumn(out, col, dynamicLowerTypes) {
1153
1298
  case "effort": {
1154
1299
  const explicitEfforts = all.filter((m) => EFFORT_TYPES.has(String(m.type).toLowerCase()));
1155
1300
  if (explicitEfforts.length > 0) return explicitEfforts;
1156
- if (String(out.outputType ?? "").toLowerCase() === "analytics" && all.length > 0) {
1157
- const first = all[0];
1158
- const meta = first.metadata;
1159
- const summaryName = typeof meta?.originalKey === "string" && meta.originalKey || typeof meta?.canonicalKey === "string" && meta.canonicalKey || String(first.type ?? "");
1160
- if (summaryName) {
1161
- return [{ type: "label", value: summaryName, image: summaryName, origin: first.origin }];
1162
- }
1301
+ const resolved = resolveOutputRowLabel(out);
1302
+ const genericType = formatOutputTypeLabel(out.outputType);
1303
+ if (resolved && resolved !== genericType) {
1304
+ const origin = all[0]?.origin ?? "runtime";
1305
+ return [{ type: "label", value: resolved, image: resolved, origin }];
1163
1306
  }
1164
1307
  return [];
1165
1308
  }
@@ -1279,13 +1422,20 @@ function StatementCards({
1279
1422
  }
1280
1423
  return /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "flex flex-col", "data-testid": "output-statements-cards", children: rows.map((out, idx) => {
1281
1424
  const cats = extractMetricsByCategory(out.metrics);
1425
+ if (cats.efforts.length === 0) {
1426
+ const resolved = resolveOutputRowLabel(out);
1427
+ const genericType = formatOutputTypeLabel(out.outputType);
1428
+ if (resolved && resolved !== genericType) {
1429
+ cats.efforts.push({ type: "label", value: resolved, image: resolved, origin: "runtime" });
1430
+ }
1431
+ }
1282
1432
  const started = out.timeSpan?.started;
1283
- const ended = out.timeSpan?.ended;
1284
- const elapsedStr = ended !== void 0 && started !== void 0 ? formatMMSS(ended - started) : "running";
1285
- const offsetStr = started !== void 0 && t0 !== void 0 ? `+${formatMMSS(started - t0)}` : "+00:00";
1433
+ const durationMs = resolveRowDurationMs(out);
1434
+ const elapsedStr = durationMs !== void 0 ? formatMMSS(durationMs) : "running";
1435
+ const offsetStr = started !== void 0 && t0 !== void 0 ? formatOffsetMMSS(started - t0) : "+00:00";
1286
1436
  const typeKey = String(out.outputType);
1287
- const typeLabel = formatOutputTypeLabel(out.outputType);
1288
- const rowTitle = formatOutputRowTitle(out.outputType, elapsedStr);
1437
+ const typeLabel = resolveOutputTypeBadgeLabel(out);
1438
+ const rowTitle = formatOutputRowTitle(out, elapsedStr);
1289
1439
  const pr = lookupPrHighlight(out, prHighlights);
1290
1440
  const bodyMetrics = [...cats.reps, ...cats.loads, ...cats.rounds, ...cats.durations, ...cats.distances];
1291
1441
  const hasBody = bodyMetrics.length > 0;
@@ -1406,7 +1556,7 @@ function OutputStatementsTable({
1406
1556
  onEditMetric,
1407
1557
  prHighlights
1408
1558
  }) {
1409
- const t0 = timeOrigin ?? (outputs.length > 0 ? outputs[0].timeSpan?.started : void 0);
1559
+ const t0 = React2.useMemo(() => resolveTimeOrigin(outputs, timeOrigin), [outputs, timeOrigin]);
1410
1560
  const [internalSort, setInternalSort] = React2.useState(
1411
1561
  controlledSort ? [...controlledSort] : []
1412
1562
  );
@@ -1573,11 +1723,12 @@ function OutputStatementsTable({
1573
1723
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border/40", children: rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: activeColumns.length, className: "p-8 text-center text-muted-foreground font-sans text-xs", children: outputs.length === 0 ? "No output statements recorded for this run." : "No output statements match the current filter." }) }) : rows.map((out, idx) => {
1574
1724
  const started = out.timeSpan?.started;
1575
1725
  const ended = out.timeSpan?.ended;
1576
- const elapsedStr = ended !== void 0 && started !== void 0 ? formatMMSS(ended - started) : "running";
1577
- const wallTimeStr = formatClockTime(new Date(ended ?? started ?? 0));
1578
- const offsetStr = started !== void 0 && t0 !== void 0 ? `+${formatMMSS(started - t0)}` : "+00:00";
1579
- const typeLabel = formatOutputTypeLabel(out.outputType);
1580
- const rowTitle = formatOutputRowTitle(out.outputType, elapsedStr);
1726
+ const durationMs = resolveRowDurationMs(out);
1727
+ const elapsedStr = durationMs !== void 0 ? formatMMSS(durationMs) : "running";
1728
+ const wallTimeStr = ended !== void 0 || started !== void 0 ? formatClockTime(new Date(ended ?? started ?? 0)) : "\u2014";
1729
+ const offsetStr = started !== void 0 && t0 !== void 0 ? formatOffsetMMSS(started - t0) : "+00:00";
1730
+ const typeLabel = resolveOutputTypeBadgeLabel(out);
1731
+ const rowTitle = formatOutputRowTitle(out, elapsedStr);
1581
1732
  const rowKey = String(out.id ?? `${out.sourceBlockKey ?? "row"}-${idx}`);
1582
1733
  const pr = lookupPrHighlight(out, prHighlights);
1583
1734
  const canInlineEditRow = Boolean(onEditMetric) && String(out.outputType ?? "").toLowerCase() === "segment" && Boolean(out.sourceBlockKey);
@@ -3599,7 +3750,7 @@ function normalizePaceToSecPerKm(value, unit) {
3599
3750
  if (u === "km/h" || u === "kph") return 3600 / value;
3600
3751
  return null;
3601
3752
  }
3602
- function humanizeSlug(slug) {
3753
+ function humanizeSlug2(slug) {
3603
3754
  return slug.split(/[-_\s]+/).filter(Boolean).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
3604
3755
  }
3605
3756
  function normalizePrLookup(prHighlights) {
@@ -3651,25 +3802,7 @@ function extractVisibleMetrics(row) {
3651
3802
  }
3652
3803
  function buildSpreadsheetRows(run, prHighlights) {
3653
3804
  const prMap = normalizePrLookup(prHighlights);
3654
- const rawSegments = (run.events ?? []).filter((e) => {
3655
- if (e.outputType !== "segment") return false;
3656
- const key = String(e.sourceBlockKey ?? "").toLowerCase();
3657
- return !key.startsWith("waiting-to-start") && key !== "session-root" && key !== "root";
3658
- });
3659
- const maxStackLevel = rawSegments.reduce((max, e) => Math.max(max, e.stackLevel ?? 0), 0);
3660
- const hasEffortLeaves = rawSegments.some((e) => {
3661
- const metrics = extractVisibleMetrics(e);
3662
- return Boolean(e.effortSlug) || metrics.some((m) => String(m.type ?? "").toLowerCase() === "effort");
3663
- });
3664
- const segmentEvents = hasEffortLeaves ? rawSegments.filter((e) => {
3665
- if ((e.stackLevel ?? 0) >= maxStackLevel) return true;
3666
- const metrics = extractVisibleMetrics(e);
3667
- const hasMovement = Boolean(e.effortSlug) || metrics.some((m) => {
3668
- const t = String(m.type ?? "").toLowerCase();
3669
- return t === "effort" || t === "rep" || t === "reps" || t === "distance";
3670
- });
3671
- return hasMovement;
3672
- }) : rawSegments;
3805
+ const segmentEvents = wodWikiWql.selectSplitSegmentEvents(run.events ?? []);
3673
3806
  const sessionStart = segmentEvents.reduce(
3674
3807
  (min, e) => e.timeSpan?.started !== void 0 ? Math.min(min, e.timeSpan.started) : min,
3675
3808
  run.timestamp
@@ -3708,7 +3841,7 @@ function buildSpreadsheetRows(run, prHighlights) {
3708
3841
  if (lower === "effort" || canon === "effort") {
3709
3842
  const slugVal = typeof m.metadata?.effortSlug === "string" ? String(m.metadata.effortSlug) : typeof m.value === "string" ? m.value : "";
3710
3843
  if (!effortSlug && slugVal) effortSlug = slugVal;
3711
- movement = String(m.image ?? (slugVal ? humanizeSlug(slugVal) : m.value ?? "")).trim();
3844
+ movement = String(m.image ?? (slugVal ? humanizeSlug2(slugVal) : m.value ?? "")).trim();
3712
3845
  continue;
3713
3846
  }
3714
3847
  if (typeof m.value !== "number" || !Number.isFinite(m.value)) continue;
@@ -3771,7 +3904,7 @@ function buildSpreadsheetRows(run, prHighlights) {
3771
3904
  } else if (!KNOWN_CANONICAL_KEYS.has(canon) && !KNOWN_CANONICAL_KEYS.has(lower)) {
3772
3905
  const key = canon || lower;
3773
3906
  custom[key] = {
3774
- label: humanizeSlug(mType),
3907
+ label: humanizeSlug2(mType),
3775
3908
  value: m.value,
3776
3909
  ...m.unit ? { unit: m.unit } : {},
3777
3910
  modified: isUser
@@ -3779,7 +3912,7 @@ function buildSpreadsheetRows(run, prHighlights) {
3779
3912
  }
3780
3913
  }
3781
3914
  if (!movement) {
3782
- movement = effortSlug ? humanizeSlug(effortSlug) : `Split ${index + 1}`;
3915
+ movement = effortSlug ? humanizeSlug2(effortSlug) : `Split ${index + 1}`;
3783
3916
  }
3784
3917
  if (splitSec === null && ev.timeSpan?.started !== void 0 && ev.timeSpan?.ended !== void 0) {
3785
3918
  splitSec = Math.max(0, (ev.timeSpan.ended - ev.timeSpan.started) / 1e3);
@@ -4922,27 +5055,42 @@ function ResultsSpreadsheetGrid({
4922
5055
  );
4923
5056
  }) })
4924
5057
  ] }) }),
4925
- activeTab === "raw" && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": "results-tab-panel-raw", className: "space-y-2.5", children: [
4926
- /* @__PURE__ */ jsxRuntime.jsx(
4927
- OutputFilterPills,
4928
- {
4929
- presets: DEFAULT_OUTPUT_FILTERS.map(normalizeOutputFilter),
4930
- filter: rawFilter,
4931
- onChange: setRawFilter
4932
- }
4933
- ),
4934
- /* @__PURE__ */ jsxRuntime.jsx(
4935
- OutputStatementsTable,
4936
- {
4937
- outputs: run.events,
4938
- filter: rawFilter,
4939
- timeOrigin: run.timestamp,
4940
- onClearFilter: () => setRawFilter(""),
4941
- onEditMetric: onEditMetric ? (p) => onEditMetric(run.resultId, p) : void 0,
4942
- prHighlights
5058
+ activeTab === "raw" && (() => {
5059
+ const events = run.events ?? [];
5060
+ let activeMinStart;
5061
+ let anyMinStart;
5062
+ for (const e of events) {
5063
+ const s = e.timeSpan?.started;
5064
+ if (typeof s !== "number" || !Number.isFinite(s)) continue;
5065
+ anyMinStart = anyMinStart === void 0 ? s : Math.min(anyMinStart, s);
5066
+ const key = String(e.sourceBlockKey ?? "").toLowerCase();
5067
+ if (e.outputType === "segment" && !key.startsWith("waiting-to-start")) {
5068
+ activeMinStart = activeMinStart === void 0 ? s : Math.min(activeMinStart, s);
4943
5069
  }
4944
- )
4945
- ] }),
5070
+ }
5071
+ const rawTimeOrigin = activeMinStart ?? anyMinStart ?? run.timestamp;
5072
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": "results-tab-panel-raw", className: "space-y-2.5", children: [
5073
+ /* @__PURE__ */ jsxRuntime.jsx(
5074
+ OutputFilterPills,
5075
+ {
5076
+ presets: DEFAULT_OUTPUT_FILTERS.map(normalizeOutputFilter),
5077
+ filter: rawFilter,
5078
+ onChange: setRawFilter
5079
+ }
5080
+ ),
5081
+ /* @__PURE__ */ jsxRuntime.jsx(
5082
+ OutputStatementsTable,
5083
+ {
5084
+ outputs: events,
5085
+ filter: rawFilter,
5086
+ timeOrigin: rawTimeOrigin,
5087
+ onClearFilter: () => setRawFilter(""),
5088
+ onEditMetric: onEditMetric ? (p) => onEditMetric(run.resultId, p) : void 0,
5089
+ prHighlights
5090
+ }
5091
+ )
5092
+ ] });
5093
+ })(),
4946
5094
  /* @__PURE__ */ jsxRuntime.jsx(
4947
5095
  EditorDialog,
4948
5096
  {
@@ -12679,6 +12827,26 @@ function createCloseIcon(size = "md") {
12679
12827
  function isAliasProperty(key) {
12680
12828
  return ["alias", "aliases"].includes(key.trim().toLowerCase());
12681
12829
  }
12830
+ function isSelfReferenceHref(docKind, meta, matchSlug, href, referenceProvider) {
12831
+ const normMatch = matchSlug.trim().toLowerCase();
12832
+ if (meta) {
12833
+ const metaSlug = typeof meta.slug === "string" ? meta.slug.trim().toLowerCase() : "";
12834
+ if (metaSlug && metaSlug === normMatch) return true;
12835
+ if (docKind === "effort" || docKind === "equipment") {
12836
+ const ownName = typeof meta.label === "string" && meta.label.trim() || typeof meta.title === "string" && meta.title.trim() || "";
12837
+ if (ownName) {
12838
+ const ownMatch = docKind === "effort" ? referenceProvider.resolveEffort(ownName) : referenceProvider.resolveEquipment(ownName);
12839
+ if (ownMatch && ownMatch.slug.trim().toLowerCase() === normMatch) return true;
12840
+ }
12841
+ }
12842
+ }
12843
+ if (typeof window !== "undefined" && window.location?.pathname) {
12844
+ const currentPath = window.location.pathname.replace(/\/+$/, "");
12845
+ const targetPath = href.split(/[?#]/)[0].replace(/\/+$/, "");
12846
+ if (currentPath && targetPath && currentPath === targetPath) return true;
12847
+ }
12848
+ return false;
12849
+ }
12682
12850
  function createSummaryPill(value, hash2, href) {
12683
12851
  const pill = document.createElement("span");
12684
12852
  pill.className = "inline-flex max-w-full items-center rounded-md border border-border/60 bg-muted/40 px-2 py-0.5 text-xs text-foreground";
@@ -12697,7 +12865,7 @@ function createSummaryPill(value, hash2, href) {
12697
12865
  pill.appendChild(label);
12698
12866
  return pill;
12699
12867
  }
12700
- function createFrontmatterSummary(entries, onShowDetails, docKind, referenceProvider) {
12868
+ function createFrontmatterSummary(entries, onShowDetails, docKind, referenceProvider, meta) {
12701
12869
  const summary = document.createElement("div");
12702
12870
  summary.dataset.frontmatterSummary = "true";
12703
12871
  summary.className = "divide-y divide-border/60";
@@ -12777,7 +12945,12 @@ function createFrontmatterSummary(entries, onShowDetails, docKind, referenceProv
12777
12945
  let href;
12778
12946
  if (referenceProvider && (docKind === "effort" || docKind === "equipment")) {
12779
12947
  const match = docKind === "effort" ? referenceProvider.resolveEffort(val) : referenceProvider.resolveEquipment(val);
12780
- if (match) href = referenceProvider.openHref(docKind, match.slug);
12948
+ if (match) {
12949
+ const candidateHref = referenceProvider.openHref(docKind, match.slug);
12950
+ if (!isSelfReferenceHref(docKind, meta, match.slug, candidateHref, referenceProvider)) {
12951
+ href = candidateHref;
12952
+ }
12953
+ }
12781
12954
  }
12782
12955
  aliasItems.push({ text: val, hash: false, href });
12783
12956
  }
@@ -12905,7 +13078,7 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
12905
13078
  persistedDetailed.set(view.dom, true);
12906
13079
  view.dispatch({ effects: setFrontmatterDetailed.of(true) });
12907
13080
  view.dom.querySelector('[aria-label="Show property summary"]')?.focus();
12908
- }, docKind, referenceProvider));
13081
+ }, docKind, referenceProvider, meta));
12909
13082
  } else {
12910
13083
  box.appendChild(createColumnHeader());
12911
13084
  if (entries.length === 0) {
@@ -13062,9 +13235,11 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
13062
13235
  const pill = document.createElement("span");
13063
13236
  pill.className = match ? "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-muted/50 text-foreground border border-border/60" : chipIsReference ? "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-destructive/10 text-destructive border border-destructive/30" : "group/pill inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-muted/40 text-foreground/90 border border-border/60";
13064
13237
  const pillText = document.createElement("span");
13065
- if (isAliasRow && match && referenceProvider) {
13238
+ const aliasHref = isAliasRow && match && referenceProvider ? referenceProvider.openHref(valueKind, match.slug) : void 0;
13239
+ const isSelfAlias = isAliasRow && match && referenceProvider && aliasHref ? isSelfReferenceHref(docKind, meta, match.slug, aliasHref, referenceProvider) : false;
13240
+ if (isAliasRow && match && referenceProvider && aliasHref && !isSelfAlias) {
13066
13241
  const aliasLink = document.createElement("a");
13067
- aliasLink.href = referenceProvider.openHref(valueKind, match.slug);
13242
+ aliasLink.href = aliasHref;
13068
13243
  aliasLink.textContent = chip;
13069
13244
  aliasLink.className = "hover:underline cursor-pointer";
13070
13245
  pillText.appendChild(aliasLink);
@@ -13072,7 +13247,7 @@ var DefaultFrontmatterWidget = class extends view.WidgetType {
13072
13247
  pillText.textContent = isAliasRow ? chip : match ? match.label : chip;
13073
13248
  }
13074
13249
  pill.appendChild(pillText);
13075
- if (match && referenceProvider && (!isAliasRow || idx === 0)) {
13250
+ if (match && referenceProvider && (!isAliasRow || idx === 0 && !isSelfAlias)) {
13076
13251
  const openLink = document.createElement("a");
13077
13252
  openLink.href = referenceProvider.openHref(valueKind, match.slug);
13078
13253
  openLink.title = `Open ${match.label} page`;