ropegeo-common 1.24.1 → 1.25.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.
Files changed (35) hide show
  1. package/dist/models/betaSections/betaSection.d.ts +2 -1
  2. package/dist/models/betaSections/betaSection.d.ts.map +1 -1
  3. package/dist/models/betaSections/betaSection.js +8 -5
  4. package/dist/models/betaSections/betaSectionExcerpt.d.ts +10 -3
  5. package/dist/models/betaSections/betaSectionExcerpt.d.ts.map +1 -1
  6. package/dist/models/betaSections/betaSectionExcerpt.js +19 -10
  7. package/dist/models/betaSections/boldRelevantPhrase.d.ts +8 -0
  8. package/dist/models/betaSections/boldRelevantPhrase.d.ts.map +1 -0
  9. package/dist/models/betaSections/boldRelevantPhrase.js +62 -0
  10. package/dist/models/index.d.ts +4 -2
  11. package/dist/models/index.d.ts.map +1 -1
  12. package/dist/models/index.js +8 -2
  13. package/dist/models/minimap/legend/concrete/imageContext.d.ts +5 -3
  14. package/dist/models/minimap/legend/concrete/imageContext.d.ts.map +1 -1
  15. package/dist/models/minimap/legend/concrete/imageContext.js +11 -11
  16. package/dist/models/minimap/legend/concrete/measurementContext.d.ts +3 -3
  17. package/dist/models/minimap/legend/concrete/measurementContext.d.ts.map +1 -1
  18. package/dist/models/minimap/legend/concrete/measurementContext.js +7 -11
  19. package/dist/models/minimap/legend/concrete/relevantContext.d.ts +4 -3
  20. package/dist/models/minimap/legend/concrete/relevantContext.d.ts.map +1 -1
  21. package/dist/models/minimap/legend/concrete/relevantContext.js +7 -19
  22. package/dist/models/pageViews/offlinePageView.d.ts +9 -6
  23. package/dist/models/pageViews/offlinePageView.d.ts.map +1 -1
  24. package/dist/models/pageViews/offlineRopewikiPageView.d.ts +2 -1
  25. package/dist/models/pageViews/offlineRopewikiPageView.d.ts.map +1 -1
  26. package/dist/models/pageViews/offlineRopewikiPageView.js +12 -8
  27. package/dist/models/pageViews/onlinePageView.d.ts +10 -8
  28. package/dist/models/pageViews/onlinePageView.d.ts.map +1 -1
  29. package/dist/models/pageViews/onlineRopewikiPageView.d.ts +2 -1
  30. package/dist/models/pageViews/onlineRopewikiPageView.d.ts.map +1 -1
  31. package/dist/models/pageViews/onlineRopewikiPageView.js +12 -8
  32. package/dist/models/relevanceStrength.d.ts +9 -0
  33. package/dist/models/relevanceStrength.d.ts.map +1 -0
  34. package/dist/models/relevanceStrength.js +24 -0
  35. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { FetchType } from '../fetchType';
2
+ import type { RelevanceStrength } from '../relevanceStrength';
2
3
  import { BetaSectionExcerpt } from './betaSectionExcerpt';
3
4
  import { BetaSectionImage } from './betaSectionImage';
4
5
  /**
@@ -27,7 +28,7 @@ export declare abstract class BetaSection {
27
28
  * Builds a {@link BetaSectionExcerpt} for a verbatim excerpt from this section's text.
28
29
  * When the excerpt cannot be located, `start` and `end` are left undefined.
29
30
  */
30
- toExcerpt(excerptText: string, confidence: number): BetaSectionExcerpt;
31
+ toExcerpt(excerptText: string, relevanceStrength: RelevanceStrength, relevantPhrase: string): BetaSectionExcerpt;
31
32
  /**
32
33
  * Renders an excerpt with nearby section context when its offsets still
33
34
  * match this section, otherwise falls back to the excerpt alone.
@@ -1 +1 @@
1
- {"version":3,"file":"betaSection.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAUtD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,CAAC,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7 @@ exports.BetaSection = void 0;
4
4
  exports.registerBetaSectionParser = registerBetaSectionParser;
5
5
  const betaSectionExcerpt_1 = require("./betaSectionExcerpt");
6
6
  const betaSectionImage_1 = require("./betaSectionImage");
7
+ const boldRelevantPhrase_1 = require("./boldRelevantPhrase");
7
8
  const formatExcerptHtml_1 = require("./formatExcerptHtml");
8
9
  const normalizeExcerptHtml_1 = require("./normalizeExcerptHtml");
9
10
  const betaSectionParsers = new Map();
@@ -22,15 +23,15 @@ class BetaSection {
22
23
  * Builds a {@link BetaSectionExcerpt} for a verbatim excerpt from this section's text.
23
24
  * When the excerpt cannot be located, `start` and `end` are left undefined.
24
25
  */
25
- toExcerpt(excerptText, confidence) {
26
+ toExcerpt(excerptText, relevanceStrength, relevantPhrase) {
26
27
  if (excerptText.length === 0) {
27
- return new betaSectionExcerpt_1.BetaSectionExcerpt(undefined, undefined, undefined, confidence);
28
+ return new betaSectionExcerpt_1.BetaSectionExcerpt(undefined, undefined, undefined, relevanceStrength, relevantPhrase);
28
29
  }
29
30
  const start = this.text.indexOf(excerptText);
30
31
  if (start === -1) {
31
- return new betaSectionExcerpt_1.BetaSectionExcerpt(excerptText, undefined, undefined, confidence);
32
+ return new betaSectionExcerpt_1.BetaSectionExcerpt(excerptText, undefined, undefined, relevanceStrength, relevantPhrase);
32
33
  }
33
- return new betaSectionExcerpt_1.BetaSectionExcerpt(excerptText, start, start + excerptText.length, confidence);
34
+ return new betaSectionExcerpt_1.BetaSectionExcerpt(excerptText, start, start + excerptText.length, relevanceStrength, relevantPhrase);
34
35
  }
35
36
  /**
36
37
  * Renders an excerpt with nearby section context when its offsets still
@@ -64,7 +65,9 @@ class BetaSection {
64
65
  // We have the source list here, so keep ordered lists ordered; their
65
66
  // `start` ordinals are already aligned to the source by `listContext`.
66
67
  const options = { preserveOrderedLists: true };
67
- const result = { body: (0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(parts.body, options) };
68
+ const result = {
69
+ body: (0, boldRelevantPhrase_1.boldRelevantPhraseInHtml)((0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(parts.body, options), excerpt.relevantPhrase),
70
+ };
68
71
  const before = (0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(parts.before, options);
69
72
  if (before.trim().length > 0)
70
73
  result.before = before;
@@ -1,14 +1,21 @@
1
+ import { type RelevanceStrength } from '../relevanceStrength';
1
2
  export declare class BetaSectionExcerpt {
2
3
  readonly text?: string;
3
4
  readonly start?: number;
4
5
  readonly end?: number;
5
- readonly confidence: number;
6
- constructor(text: string | undefined, start: number | undefined, end: number | undefined, confidence: number);
6
+ readonly relevanceStrength: RelevanceStrength;
7
+ /**
8
+ * Verbatim substring of the text block’s title and/or body that connects
9
+ * this excerpt to the map feature. Required even for title-only relevance
10
+ * (when `text` is omitted).
11
+ */
12
+ readonly relevantPhrase: string;
13
+ constructor(text: string | undefined, start: number | undefined, end: number | undefined, relevanceStrength: RelevanceStrength, relevantPhrase: string);
7
14
  toPlain(): Record<string, unknown>;
8
15
  /** Returns displayable excerpt HTML when the owning beta section is unavailable. */
9
16
  toHtml(): string;
10
17
  static fromResult(result: unknown): BetaSectionExcerpt;
11
- private static assertConfidence;
18
+ private static assertNonEmptyString;
12
19
  private static assertNonNegativeInteger;
13
20
  }
14
21
  //# sourceMappingURL=betaSectionExcerpt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"betaSectionExcerpt.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSectionExcerpt.ts"],"names":[],"mappings":"AAEA,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAGxB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,UAAU,EAAE,MAAM;IAStB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAclC,oFAAoF;IACpF,MAAM,IAAI,MAAM;IAIhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;IAgCtD,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAQ/B,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAK1C"}
1
+ {"version":3,"file":"betaSectionExcerpt.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSectionExcerpt.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;gBAG5B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,MAAM;IAc1B,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBlC,oFAAoF;IACpF,MAAM,IAAI,MAAM;IAOhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;IA6CtD,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAK1C"}
@@ -2,16 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BetaSectionExcerpt = void 0;
4
4
  const normalizeExcerptHtml_1 = require("./normalizeExcerptHtml");
5
+ const boldRelevantPhrase_1 = require("./boldRelevantPhrase");
6
+ const relevanceStrength_1 = require("../relevanceStrength");
5
7
  class BetaSectionExcerpt {
6
- constructor(text, start, end, confidence) {
7
- BetaSectionExcerpt.assertConfidence(confidence);
8
+ constructor(text, start, end, relevanceStrength, relevantPhrase) {
9
+ (0, relevanceStrength_1.assertRelevanceStrength)(relevanceStrength, 'BetaSectionExcerpt.relevanceStrength');
10
+ BetaSectionExcerpt.assertNonEmptyString(relevantPhrase, 'BetaSectionExcerpt.relevantPhrase');
8
11
  this.text = text;
9
12
  this.start = start;
10
13
  this.end = end;
11
- this.confidence = confidence;
14
+ this.relevanceStrength = relevanceStrength;
15
+ this.relevantPhrase = relevantPhrase;
12
16
  }
13
17
  toPlain() {
14
- const out = { confidence: this.confidence };
18
+ const out = {
19
+ relevanceStrength: this.relevanceStrength,
20
+ relevantPhrase: this.relevantPhrase,
21
+ };
15
22
  if (this.text !== undefined) {
16
23
  out.text = this.text;
17
24
  }
@@ -25,14 +32,15 @@ class BetaSectionExcerpt {
25
32
  }
26
33
  /** Returns displayable excerpt HTML when the owning beta section is unavailable. */
27
34
  toHtml() {
28
- return (0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(this.text ?? '');
35
+ return (0, boldRelevantPhrase_1.boldRelevantPhraseInHtml)((0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(this.text ?? ''), this.relevantPhrase);
29
36
  }
30
37
  static fromResult(result) {
31
38
  if (result == null || typeof result !== 'object' || Array.isArray(result)) {
32
39
  throw new Error('BetaSectionExcerpt result must be an object');
33
40
  }
34
41
  const r = result;
35
- BetaSectionExcerpt.assertConfidence(r.confidence);
42
+ const relevanceStrength = (0, relevanceStrength_1.assertRelevanceStrength)(r.relevanceStrength, 'BetaSectionExcerpt.relevanceStrength');
43
+ const relevantPhrase = BetaSectionExcerpt.assertNonEmptyString(r.relevantPhrase, 'BetaSectionExcerpt.relevantPhrase');
36
44
  let text;
37
45
  if (r.text !== undefined) {
38
46
  if (typeof r.text !== 'string') {
@@ -50,12 +58,13 @@ class BetaSectionExcerpt {
50
58
  BetaSectionExcerpt.assertNonNegativeInteger(r.end, 'BetaSectionExcerpt.end');
51
59
  end = r.end;
52
60
  }
53
- return new BetaSectionExcerpt(text, start, end, r.confidence);
61
+ return new BetaSectionExcerpt(text, start, end, relevanceStrength, relevantPhrase);
54
62
  }
55
- static assertConfidence(value) {
56
- if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {
57
- throw new Error(`BetaSectionExcerpt.confidence must be a number from 0 to 1, got: ${JSON.stringify(value)}`);
63
+ static assertNonEmptyString(value, context) {
64
+ if (typeof value !== 'string' || value.trim().length === 0) {
65
+ throw new Error(`${context} must be a non-empty string`);
58
66
  }
67
+ return value;
59
68
  }
60
69
  static assertNonNegativeInteger(value, context) {
61
70
  if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || !Number.isInteger(value)) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Wraps the first contiguous text-run occurrence of `phrase` in `<b>…</b>`
3
+ * without splitting HTML tags. If the phrase already sits fully inside a
4
+ * `<b>`/`<strong>` element, or spans multiple text runs (tags in between),
5
+ * returns `html` unchanged.
6
+ */
7
+ export declare function boldRelevantPhraseInHtml(html: string, phrase: string): string;
8
+ //# sourceMappingURL=boldRelevantPhrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boldRelevantPhrase.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/boldRelevantPhrase.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAuB7E"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boldRelevantPhraseInHtml = boldRelevantPhraseInHtml;
4
+ /**
5
+ * Wraps the first contiguous text-run occurrence of `phrase` in `<b>…</b>`
6
+ * without splitting HTML tags. If the phrase already sits fully inside a
7
+ * `<b>`/`<strong>` element, or spans multiple text runs (tags in between),
8
+ * returns `html` unchanged.
9
+ */
10
+ function boldRelevantPhraseInHtml(html, phrase) {
11
+ if (html.length === 0 || phrase.length === 0)
12
+ return html;
13
+ const tokens = tokenizeHtml(html);
14
+ for (let i = 0; i < tokens.length; i++) {
15
+ const token = tokens[i];
16
+ if (token.kind !== 'text')
17
+ continue;
18
+ const at = token.value.indexOf(phrase);
19
+ if (at === -1)
20
+ continue;
21
+ if (isInsideBold(tokens, i))
22
+ return html;
23
+ tokens[i] = {
24
+ kind: 'text',
25
+ value: token.value.slice(0, at) +
26
+ '<b>' +
27
+ phrase +
28
+ '</b>' +
29
+ token.value.slice(at + phrase.length),
30
+ };
31
+ return tokens.map((t) => t.value).join('');
32
+ }
33
+ return html;
34
+ }
35
+ function tokenizeHtml(html) {
36
+ const tokens = [];
37
+ for (const part of html.split(/(<[^>]+>)/g)) {
38
+ if (part.length === 0)
39
+ continue;
40
+ if (part.startsWith('<') && part.endsWith('>')) {
41
+ tokens.push({ kind: 'tag', value: part });
42
+ }
43
+ else {
44
+ tokens.push({ kind: 'text', value: part });
45
+ }
46
+ }
47
+ return tokens;
48
+ }
49
+ function isInsideBold(tokens, textTokenIndex) {
50
+ let depth = 0;
51
+ for (let i = 0; i < textTokenIndex; i++) {
52
+ const token = tokens[i];
53
+ if (token.kind !== 'tag')
54
+ continue;
55
+ if (/^<\s*(b|strong)\b[^>]*>$/i.test(token.value))
56
+ depth += 1;
57
+ else if (/^<\s*\/\s*(b|strong)\s*>$/i.test(token.value)) {
58
+ depth = Math.max(0, depth - 1);
59
+ }
60
+ }
61
+ return depth > 0;
62
+ }
@@ -57,6 +57,8 @@ export { OfflineBetaSectionImage } from './betaSections/offlineBetaSectionImage'
57
57
  export { DownloadBytes } from './betaSections/downloadBytes';
58
58
  export { BetaSection, type ExcerptHtml } from './betaSections/betaSection';
59
59
  export { BetaSectionExcerpt } from './betaSections/betaSectionExcerpt';
60
+ export { boldRelevantPhraseInHtml } from './betaSections/boldRelevantPhrase';
61
+ export { RELEVANCE_STRENGTHS, assertRelevanceStrength, isRelevanceStrength, type RelevanceStrength, } from './relevanceStrength';
60
62
  export { OnlineBetaSection } from './betaSections/onlineBetaSection';
61
63
  export { OfflineBetaSection } from './betaSections/offlineBetaSection';
62
64
  export { Bounds } from './minimap/bounds';
@@ -88,8 +90,8 @@ export { PageView } from './pageViews/pageView';
88
90
  export { RopewikiPageView as BaseRopewikiPageView } from './pageViews/ropewikiPageView';
89
91
  export { OnlineRopewikiPageView } from './pageViews/onlineRopewikiPageView';
90
92
  export { OfflineRopewikiPageView } from './pageViews/offlineRopewikiPageView';
91
- export type { OnlinePageView, OnlineBetaSectionLookup, OnlineBetaSectionLookupEntry, } from './pageViews/onlinePageView';
92
- export type { OfflinePageView, OfflineBetaSectionLookup, OfflineBetaSectionLookupEntry, } from './pageViews/offlinePageView';
93
+ export type { OnlinePageView, OnlineBetaSectionLookup, OnlineImageLookup, OnlineImageLookupEntry, } from './pageViews/onlinePageView';
94
+ export type { OfflinePageView, OfflineBetaSectionLookup, OfflineImageLookup, OfflineImageLookupEntry, } from './pageViews/offlinePageView';
93
95
  export { formatMeasurementValue } from './measurements/measurementValue';
94
96
  export { Measurement, FREEDOM_MEASUREMENT_SYSTEM } from './measurements/measurement';
95
97
  export type { MeasurementUnit } from './measurements/measurement';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,8CAA8C,CAAC;AACtD,OAAO,kDAAkD,CAAC;AAC1D,OAAO,8CAA8C,CAAC;AACtD,OAAO,2CAA2C,CAAC;AACnD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,qCAAqC,CAAC;AAE7C,OAAO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AC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,YAAY,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACH,SAAS,EACT,uBAAuB,EACvB,qCAAqC,EACrC,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,GACzC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Preview = exports.RopewikiVehicleType = exports.PermitStatus = exports.SavedFilters = exports.SavedPagesFilter = exports.SearchFilter = exports.RouteFilter = exports.RiskMinMax = exports.TimeMinMax = exports.WaterMinMax = exports.TechnicalMinMax = exports.AcaDifficultyFilterOptions = exports.registerDifficultyFilterOptionsParser = exports.DifficultyFilterOptions = exports.Q_ACA_RISK = exports.Q_ACA_TIME = exports.Q_ACA_WATER = exports.Q_ACA_TECHNICAL = exports.Q_DIFFICULTY_TYPE = exports.AcaDifficultyParams = exports.isDifficultyParamsActive = exports.registerDifficultyParamsQueryParser = exports.registerDifficultyParamsQueryInference = exports.DifficultyParams = exports.AcaRiskRating = exports.AcaTimeRating = exports.AcaWaterRating = exports.AcaTechnicalRating = exports.AcaDifficulty = exports.Difficulty = exports.DifficultyType = exports.DifficultyRisk = exports.DifficultyTime = exports.DifficultyWater = exports.DifficultyTechnical = exports.AcaDifficultyRating = exports.RISK_ORDER = exports.AcaWaterSubRating = exports.AcaTimeSubRating = exports.AcaTechnicalSubRating = exports.AcaRiskSubRating = exports.ACA_WATER_ORDER = exports.ACA_TIME_ORDER = exports.ACA_TECHNICAL_ORDER = exports.ACA_RISK_ORDER = exports.resolveDifficultyRatingFromRecord = exports.registerDifficultyParser = exports.DifficultyRating = exports.DifficultyRatingSystem = exports.PageDataSource = void 0;
4
- exports.Measurement = exports.formatMeasurementValue = exports.OfflineRopewikiPageView = exports.OnlineRopewikiPageView = exports.BaseRopewikiPageView = exports.PageView = exports.PageViewType = exports.RopewikiPageViewResult = exports.RopewikiPageView = exports.OfflineCenteredRegionMiniMap = exports.OnlineCenteredRegionMiniMap = exports.OfflineRegionMiniMap = exports.OnlineRegionMiniMap = exports.OfflinePageMiniMap = exports.OnlinePageMiniMap = exports.CenteredRegionMiniMap = exports.PageMiniMap = exports.RegionMiniMap = exports.MiniMap = exports.MiniMapType = exports.ImageContext = exports.MeasurementContext = exports.RelevantContext = exports.PolygonLegendItem = exports.LineLegendItem = exports.PointLegendItem = exports.registerLegendItemParser = exports.LegendItem = exports.LEGEND_FEATURE_TYPES = exports.LegendFeatureType = exports.Bounds = exports.OfflineBetaSection = exports.OnlineBetaSection = exports.BetaSectionExcerpt = exports.BetaSection = exports.DownloadBytes = exports.OfflineBetaSectionImage = exports.OnlineBetaSectionImage = exports.BetaSectionImage = exports.RoutesParams = exports.RouteResult = exports.RoutesGeojson = exports.RouteType = exports.RouteGeoJsonFeature = exports.Route = exports.RegionPreview = exports.OfflinePagePreview = exports.OnlinePagePreview = exports.PagePreview = exports.PreviewType = void 0;
5
- exports.DOWNLOADED_ROUTE_PREVIEWS_STORAGE_KEY = exports.SAVED_PAGES_STORAGE_KEY = exports.SavedPage = exports.ImageVersions = exports.VERSION_FORMAT = exports.ImageVersion = exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = exports.RopewikiRegionImageView = exports.RegionImagesCursor = exports.RopewikiRegionPreviewsResult = exports.RopewikiRegionPreviewsParams = exports.RegionPreviewsCursor = exports.RopewikiRegionViewResult = exports.RopewikiRegionView = exports.SearchResults = exports.SearchParams = exports.SearchCursor = exports.MapDataTileKeysResults = exports.registerPaginationParser = exports.PaginationResultType = exports.PaginationResults = exports.registerCursorPaginationParser = exports.CursorPaginationResultType = exports.CursorPaginationResults = exports.registerResultParser = exports.ResultType = exports.Result = exports.PaginationParams = exports.CursorPaginationParams = exports.CursorType = exports.Cursor = exports.RopewikiPageLinkPreviewResult = exports.LinkPreviewImage = exports.LinkPreview = exports.DAYS = exports.HOURS = exports.MINUTES = exports.TimeMeasurement = exports.FEET = exports.MILES = exports.LengthMeasurement = exports.MinMax = exports.FREEDOM_MEASUREMENT_SYSTEM = void 0;
4
+ exports.BaseRopewikiPageView = exports.PageView = exports.PageViewType = exports.RopewikiPageViewResult = exports.RopewikiPageView = exports.OfflineCenteredRegionMiniMap = exports.OnlineCenteredRegionMiniMap = exports.OfflineRegionMiniMap = exports.OnlineRegionMiniMap = exports.OfflinePageMiniMap = exports.OnlinePageMiniMap = exports.CenteredRegionMiniMap = exports.PageMiniMap = exports.RegionMiniMap = exports.MiniMap = exports.MiniMapType = exports.ImageContext = exports.MeasurementContext = exports.RelevantContext = exports.PolygonLegendItem = exports.LineLegendItem = exports.PointLegendItem = exports.registerLegendItemParser = exports.LegendItem = exports.LEGEND_FEATURE_TYPES = exports.LegendFeatureType = exports.Bounds = exports.OfflineBetaSection = exports.OnlineBetaSection = exports.isRelevanceStrength = exports.assertRelevanceStrength = exports.RELEVANCE_STRENGTHS = exports.boldRelevantPhraseInHtml = exports.BetaSectionExcerpt = exports.BetaSection = exports.DownloadBytes = exports.OfflineBetaSectionImage = exports.OnlineBetaSectionImage = exports.BetaSectionImage = exports.RoutesParams = exports.RouteResult = exports.RoutesGeojson = exports.RouteType = exports.RouteGeoJsonFeature = exports.Route = exports.RegionPreview = exports.OfflinePagePreview = exports.OnlinePagePreview = exports.PagePreview = exports.PreviewType = void 0;
5
+ exports.DOWNLOADED_ROUTE_PREVIEWS_STORAGE_KEY = exports.SAVED_PAGES_STORAGE_KEY = exports.SavedPage = exports.ImageVersions = exports.VERSION_FORMAT = exports.ImageVersion = exports.RoutePreviewResult = exports.RopewikiRegionImagesResult = exports.RopewikiRegionImagesParams = exports.RopewikiRegionImageView = exports.RegionImagesCursor = exports.RopewikiRegionPreviewsResult = exports.RopewikiRegionPreviewsParams = exports.RegionPreviewsCursor = exports.RopewikiRegionViewResult = exports.RopewikiRegionView = exports.SearchResults = exports.SearchParams = exports.SearchCursor = exports.MapDataTileKeysResults = exports.registerPaginationParser = exports.PaginationResultType = exports.PaginationResults = exports.registerCursorPaginationParser = exports.CursorPaginationResultType = exports.CursorPaginationResults = exports.registerResultParser = exports.ResultType = exports.Result = exports.PaginationParams = exports.CursorPaginationParams = exports.CursorType = exports.Cursor = exports.RopewikiPageLinkPreviewResult = exports.LinkPreviewImage = exports.LinkPreview = exports.DAYS = exports.HOURS = exports.MINUTES = exports.TimeMeasurement = exports.FEET = exports.MILES = exports.LengthMeasurement = exports.MinMax = exports.FREEDOM_MEASUREMENT_SYSTEM = exports.Measurement = exports.formatMeasurementValue = exports.OfflineRopewikiPageView = exports.OnlineRopewikiPageView = void 0;
6
6
  require("./api/results/registerAllResultParsers");
7
7
  require("./difficulty/registerDifficultyRatingParsers");
8
8
  require("./filters/registerDifficultyFilterOptionsParsers");
@@ -129,6 +129,12 @@ var betaSection_1 = require("./betaSections/betaSection");
129
129
  Object.defineProperty(exports, "BetaSection", { enumerable: true, get: function () { return betaSection_1.BetaSection; } });
130
130
  var betaSectionExcerpt_1 = require("./betaSections/betaSectionExcerpt");
131
131
  Object.defineProperty(exports, "BetaSectionExcerpt", { enumerable: true, get: function () { return betaSectionExcerpt_1.BetaSectionExcerpt; } });
132
+ var boldRelevantPhrase_1 = require("./betaSections/boldRelevantPhrase");
133
+ Object.defineProperty(exports, "boldRelevantPhraseInHtml", { enumerable: true, get: function () { return boldRelevantPhrase_1.boldRelevantPhraseInHtml; } });
134
+ var relevanceStrength_1 = require("./relevanceStrength");
135
+ Object.defineProperty(exports, "RELEVANCE_STRENGTHS", { enumerable: true, get: function () { return relevanceStrength_1.RELEVANCE_STRENGTHS; } });
136
+ Object.defineProperty(exports, "assertRelevanceStrength", { enumerable: true, get: function () { return relevanceStrength_1.assertRelevanceStrength; } });
137
+ Object.defineProperty(exports, "isRelevanceStrength", { enumerable: true, get: function () { return relevanceStrength_1.isRelevanceStrength; } });
132
138
  var onlineBetaSection_1 = require("./betaSections/onlineBetaSection");
133
139
  Object.defineProperty(exports, "OnlineBetaSection", { enumerable: true, get: function () { return onlineBetaSection_1.OnlineBetaSection; } });
134
140
  var offlineBetaSection_1 = require("./betaSections/offlineBetaSection");
@@ -1,10 +1,12 @@
1
+ import { type RelevanceStrength } from '../../../relevanceStrength';
1
2
  export declare class ImageContext {
2
3
  readonly id: string;
3
- readonly confidence: number;
4
- constructor(id: string, confidence: number);
4
+ readonly relevanceStrength: RelevanceStrength;
5
+ /** Verbatim substring of the image caption and/or file URL. */
6
+ readonly relevantPhrase: string;
7
+ constructor(id: string, relevanceStrength: RelevanceStrength, relevantPhrase: string);
5
8
  toPlain(): Record<string, unknown>;
6
9
  static fromResult(result: unknown): ImageContext;
7
10
  private static assertNonEmptyString;
8
- private static assertConfidence;
9
11
  }
10
12
  //# sourceMappingURL=imageContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imageContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/imageContext.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAO1C,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY;IAUhD,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAOlC"}
1
+ {"version":3,"file":"imageContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/imageContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,YAAY;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;gBAEpB,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM;IASpF,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY;IAiBhD,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAMtC"}
@@ -1,17 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ImageContext = void 0;
4
+ const relevanceStrength_1 = require("../../../relevanceStrength");
4
5
  class ImageContext {
5
- constructor(id, confidence) {
6
+ constructor(id, relevanceStrength, relevantPhrase) {
6
7
  ImageContext.assertNonEmptyString(id, 'ImageContext.id');
7
- ImageContext.assertConfidence(confidence);
8
+ (0, relevanceStrength_1.assertRelevanceStrength)(relevanceStrength, 'ImageContext.relevanceStrength');
9
+ ImageContext.assertNonEmptyString(relevantPhrase, 'ImageContext.relevantPhrase');
8
10
  this.id = id;
9
- this.confidence = confidence;
11
+ this.relevanceStrength = relevanceStrength;
12
+ this.relevantPhrase = relevantPhrase;
10
13
  }
11
14
  toPlain() {
12
15
  return {
13
16
  id: this.id,
14
- confidence: this.confidence,
17
+ relevanceStrength: this.relevanceStrength,
18
+ relevantPhrase: this.relevantPhrase,
15
19
  };
16
20
  }
17
21
  static fromResult(result) {
@@ -20,8 +24,9 @@ class ImageContext {
20
24
  }
21
25
  const r = result;
22
26
  const id = ImageContext.assertNonEmptyString(r.id, 'ImageContext.id');
23
- ImageContext.assertConfidence(r.confidence);
24
- return new ImageContext(id, r.confidence);
27
+ const relevanceStrength = (0, relevanceStrength_1.assertRelevanceStrength)(r.relevanceStrength, 'ImageContext.relevanceStrength');
28
+ const relevantPhrase = ImageContext.assertNonEmptyString(r.relevantPhrase, 'ImageContext.relevantPhrase');
29
+ return new ImageContext(id, relevanceStrength, relevantPhrase);
25
30
  }
26
31
  static assertNonEmptyString(value, context) {
27
32
  if (typeof value !== 'string' || value.trim().length === 0) {
@@ -29,10 +34,5 @@ class ImageContext {
29
34
  }
30
35
  return value;
31
36
  }
32
- static assertConfidence(value) {
33
- if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {
34
- throw new Error(`ImageContext.confidence must be a number from 0 to 1, got: ${JSON.stringify(value)}`);
35
- }
36
- }
37
37
  }
38
38
  exports.ImageContext = ImageContext;
@@ -1,13 +1,13 @@
1
1
  import { Measurement } from '../../../measurements/measurement';
2
+ import { type RelevanceStrength } from '../../../relevanceStrength';
2
3
  export declare class MeasurementContext {
3
4
  readonly label: string;
4
5
  readonly measurement: Measurement;
5
- readonly confidence: number;
6
- constructor(label: string, measurement: Measurement, confidence: number);
6
+ readonly relevanceStrength: RelevanceStrength;
7
+ constructor(label: string, measurement: Measurement, relevanceStrength: RelevanceStrength);
7
8
  toPlain(): Record<string, unknown>;
8
9
  static fromResult(result: unknown): MeasurementContext;
9
10
  private static parseMeasurement;
10
11
  private static assertNonEmptyString;
11
- private static assertConfidence;
12
12
  }
13
13
  //# sourceMappingURL=measurementContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"measurementContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/measurementContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGhE,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM;IAQvE,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;IAWtD,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgB/B,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAOlC"}
1
+ {"version":3,"file":"measurementContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/measurementContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;gBAElC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB;IAQzF,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;IActD,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgB/B,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAMtC"}
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MeasurementContext = void 0;
4
4
  const lengthMeasurement_1 = require("../../../measurements/lengthMeasurement");
5
5
  const timeMeasurement_1 = require("../../../measurements/timeMeasurement");
6
+ const relevanceStrength_1 = require("../../../relevanceStrength");
6
7
  class MeasurementContext {
7
- constructor(label, measurement, confidence) {
8
+ constructor(label, measurement, relevanceStrength) {
8
9
  MeasurementContext.assertNonEmptyString(label, 'MeasurementContext.label');
9
- MeasurementContext.assertConfidence(confidence);
10
+ (0, relevanceStrength_1.assertRelevanceStrength)(relevanceStrength, 'MeasurementContext.relevanceStrength');
10
11
  this.label = label;
11
12
  this.measurement = measurement;
12
- this.confidence = confidence;
13
+ this.relevanceStrength = relevanceStrength;
13
14
  }
14
15
  toPlain() {
15
16
  return {
16
17
  label: this.label,
17
18
  measurement: this.measurement.toJSON(),
18
- confidence: this.confidence,
19
+ relevanceStrength: this.relevanceStrength,
19
20
  };
20
21
  }
21
22
  static fromResult(result) {
@@ -24,9 +25,9 @@ class MeasurementContext {
24
25
  }
25
26
  const r = result;
26
27
  const label = MeasurementContext.assertNonEmptyString(r.label, 'MeasurementContext.label');
27
- MeasurementContext.assertConfidence(r.confidence);
28
+ const relevanceStrength = (0, relevanceStrength_1.assertRelevanceStrength)(r.relevanceStrength, 'MeasurementContext.relevanceStrength');
28
29
  const measurement = MeasurementContext.parseMeasurement(r.measurement);
29
- return new MeasurementContext(label, measurement, r.confidence);
30
+ return new MeasurementContext(label, measurement, relevanceStrength);
30
31
  }
31
32
  static parseMeasurement(value) {
32
33
  if (value == null || typeof value !== 'object') {
@@ -47,10 +48,5 @@ class MeasurementContext {
47
48
  }
48
49
  return value;
49
50
  }
50
- static assertConfidence(value) {
51
- if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1) {
52
- throw new Error(`MeasurementContext.confidence must be a number from 0 to 1, got: ${JSON.stringify(value)}`);
53
- }
54
- }
55
51
  }
56
52
  exports.MeasurementContext = MeasurementContext;
@@ -4,12 +4,13 @@ import { MeasurementContext } from './measurementContext';
4
4
  export declare class RelevantContext {
5
5
  readonly measurements: MeasurementContext[];
6
6
  readonly betaSectionExcerpts: Record<string, BetaSectionExcerpt[]>;
7
- readonly images: Record<string, ImageContext[]>;
8
- constructor(measurements: MeasurementContext[], betaSectionExcerpts: Record<string, BetaSectionExcerpt[]>, images: Record<string, ImageContext[]>);
7
+ /** Flat list of relevant images; owning section is resolved via `toImageLookup()`. */
8
+ readonly images: ImageContext[];
9
+ constructor(measurements: MeasurementContext[], betaSectionExcerpts: Record<string, BetaSectionExcerpt[]>, images: ImageContext[]);
9
10
  toPlain(): Record<string, unknown>;
10
11
  static fromResult(result: unknown): RelevantContext;
11
12
  private static parseMeasurementsArray;
12
13
  private static parseBetaSectionExcerptsRecord;
13
- private static parseImagesRecord;
14
+ private static parseImagesArray;
14
15
  }
15
16
  //# sourceMappingURL=relevantContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"relevantContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/relevantContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AA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YAAY,EAAE,kBAAkB,EAAE,EAClC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,EACzD,MAAM,EAAE,YAAY,EAAE;IAO1B,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAalC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe;IAenD,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAYrC,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAwB7C,OAAO,CAAC,MAAM,CAAC,gBAAgB;CASlC"}
@@ -15,14 +15,10 @@ class RelevantContext {
15
15
  for (const [key, excerpts] of Object.entries(this.betaSectionExcerpts)) {
16
16
  betaSectionExcerpts[key] = excerpts.map((excerpt) => excerpt.toPlain());
17
17
  }
18
- const images = {};
19
- for (const [key, imageContexts] of Object.entries(this.images)) {
20
- images[key] = imageContexts.map((image) => image.toPlain());
21
- }
22
18
  return {
23
19
  measurements: this.measurements.map((measurement) => measurement.toPlain()),
24
20
  betaSectionExcerpts,
25
- images,
21
+ images: this.images.map((image) => image.toPlain()),
26
22
  };
27
23
  }
28
24
  static fromResult(result) {
@@ -32,7 +28,7 @@ class RelevantContext {
32
28
  const r = result;
33
29
  const measurements = RelevantContext.parseMeasurementsArray(r.measurements);
34
30
  const betaSectionExcerpts = RelevantContext.parseBetaSectionExcerptsRecord(r.betaSectionExcerpts);
35
- const images = RelevantContext.parseImagesRecord(r.images);
31
+ const images = RelevantContext.parseImagesArray(r.images);
36
32
  return new RelevantContext(measurements, betaSectionExcerpts, images);
37
33
  }
38
34
  static parseMeasurementsArray(value) {
@@ -61,22 +57,14 @@ class RelevantContext {
61
57
  }
62
58
  return out;
63
59
  }
64
- static parseImagesRecord(value) {
60
+ static parseImagesArray(value) {
65
61
  if (value === undefined || value === null) {
66
- return {};
67
- }
68
- if (typeof value !== 'object' || Array.isArray(value)) {
69
- throw new Error(`RelevantContext.images must be an object, got: ${typeof value}`);
62
+ return [];
70
63
  }
71
- const raw = value;
72
- const out = {};
73
- for (const [key, imageContexts] of Object.entries(raw)) {
74
- if (!Array.isArray(imageContexts)) {
75
- throw new Error(`RelevantContext.images["${key}"] must be an array, got: ${typeof imageContexts}`);
76
- }
77
- out[key] = imageContexts.map((entry) => imageContext_1.ImageContext.fromResult(entry));
64
+ if (!Array.isArray(value)) {
65
+ throw new Error(`RelevantContext.images must be an array, got: ${typeof value}`);
78
66
  }
79
- return out;
67
+ return value.map((entry) => imageContext_1.ImageContext.fromResult(entry));
80
68
  }
81
69
  }
82
70
  exports.RelevantContext = RelevantContext;
@@ -4,19 +4,22 @@ import type { Bounds } from '../minimap/bounds';
4
4
  import { PageViewType } from './pageViewType';
5
5
  import type { OfflineBetaSection } from '../betaSections/offlineBetaSection';
6
6
  import type { OfflineBetaSectionImage } from '../betaSections/offlineBetaSectionImage';
7
- export type OfflineBetaSectionLookupEntry = {
8
- /** Null for page-level images, which use the empty relevant-context key. */
9
- section: OfflineBetaSection | null;
10
- imagesById: Record<string, OfflineBetaSectionImage>;
7
+ /** Relevant-context section lookup keyed by non-null beta-section id. */
8
+ export type OfflineBetaSectionLookup = Record<string, OfflineBetaSection>;
9
+ export type OfflineImageLookupEntry = {
10
+ image: OfflineBetaSectionImage;
11
+ /** Omitted for page-level banner images. */
12
+ betaSectionId?: string;
11
13
  };
12
- /** Relevant-context lookup keyed by beta-section id (`""` for page-level images). */
13
- export type OfflineBetaSectionLookup = Record<string, OfflineBetaSectionLookupEntry>;
14
+ /** Image id image (+ optional owning beta section). */
15
+ export type OfflineImageLookup = Record<string, OfflineImageLookupEntry>;
14
16
  export interface OfflinePageView {
15
17
  readonly fetchType: 'offline';
16
18
  readonly id: string;
17
19
  readonly routeType: RouteType;
18
20
  readonly pageViewType: PageViewType;
19
21
  toBetaSectionLookup(): OfflineBetaSectionLookup;
22
+ toImageLookup(): OfflineImageLookup;
20
23
  toPagePreview(): OfflinePagePreview;
21
24
  /** Bounds for Mapbox offline pack when this page uses a page minimap; otherwise null. */
22
25
  getMapboxPackBounds(): Bounds | null;
@@ -1 +1 @@
1
- {"version":3,"file":"offlinePageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/offlinePageView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAEvF,MAAM,MAAM,6BAA6B,GAAG;IACxC,4EAA4E;IAC5E,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACvD,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAErF,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,mBAAmB,IAAI,wBAAwB,CAAC;IAChD,aAAa,IAAI,kBAAkB,CAAC;IACpC,yFAAyF;IACzF,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAAC;CACxC"}
1
+ {"version":3,"file":"offlinePageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/offlinePageView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAEvF,yEAAyE;AACzE,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG;IAClC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,mBAAmB,IAAI,wBAAwB,CAAC;IAChD,aAAa,IAAI,kBAAkB,CAAC;IACpC,aAAa,IAAI,kBAAkB,CAAC;IACpC,yFAAyF;IACzF,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAAC;CACxC"}
@@ -3,7 +3,7 @@ import { OfflineBetaSectionImage } from '../betaSections/offlineBetaSectionImage
3
3
  import { OfflineCenteredRegionMiniMap } from '../minimap/concrete/offlineCenteredRegionMiniMap';
4
4
  import { OfflinePageMiniMap } from '../minimap/concrete/offlinePageMiniMap';
5
5
  import { OfflinePagePreview } from '../previews/offlinePagePreview';
6
- import { type OfflineBetaSectionLookup, OfflinePageView } from './offlinePageView';
6
+ import { type OfflineBetaSectionLookup, type OfflineImageLookup, OfflinePageView } from './offlinePageView';
7
7
  import { RopewikiPageView } from './ropewikiPageView';
8
8
  import { RouteType } from '../routes/routeType';
9
9
  import { RopewikiVehicleType } from '../ropewikiVehicleType';
@@ -23,6 +23,7 @@ export declare class OfflineRopewikiPageView extends RopewikiPageView implements
23
23
  lon: number;
24
24
  } | null, authors?: string[] | null);
25
25
  toBetaSectionLookup(): OfflineBetaSectionLookup;
26
+ toImageLookup(): OfflineImageLookup;
26
27
  toPagePreview(): OfflinePagePreview;
27
28
  getMapboxPackBounds(): import('../minimap/bounds').Bounds | null;
28
29
  static fromResult(result: unknown, pageRoot?: string | null): OfflineRopewikiPageView;
@@ -1 +1 @@
1
- {"version":3,"file":"offlineRopewikiPageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/offlineRopewikiPageView.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EACH,KAAK,wBAAwB,EAC7B,eAAe,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAkC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,qBAAa,uBAAwB,SAAQ,gBAAiB,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IAAI,EAC7D,YAAY,EAAE,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAC9D,WAAW,EAAE,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAC7D,QAAQ,EAAE,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,IAAI,EAC1D,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,EAC1C,eAAe,EAAE,iBAAiB,GAAG,IAAI,EACzC,YAAY,EAAE,iBAAiB,GAAG,IAAI,EACtC,MAAM,EAAE,MAAM,EAAE,EAChB,kBAAkB,EAAE,IAAI,EACxB,WAAW,EAAE,uBAAuB,GAAG,IAAI,EAC3C,YAAY,EAAE,kBAAkB,EAAE,EAClC,OAAO,EAAE,kBAAkB,GAAG,4BAA4B,GAAG,IAAI,EACjE,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,EAChD,OAAO,GAAE,MAAM,EAAE,GAAG,IAAW;IAuCnC,mBAAmB,IAAI,wBAAwB;IAQ/C,aAAa,IAAI,kBAAkB;IAcnC,aAAa,IAAI,kBAAkB;IAqBnC,mBAAmB,IAAI,OAAO,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAOhE,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,uBAAuB;CA+CxF"}
@@ -23,15 +23,19 @@ class OfflineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
23
23
  }
24
24
  toBetaSectionLookup() {
25
25
  const identifiedSections = this.betaSections.filter((section) => section.id != null);
26
- const lookup = (0, lodash_1.mapValues)((0, lodash_1.keyBy)(identifiedSections, (section) => section.id), (section) => ({
27
- section,
28
- imagesById: (0, lodash_1.keyBy)(section.images, (image) => image.id),
29
- }));
26
+ return (0, lodash_1.keyBy)(identifiedSections, (section) => section.id);
27
+ }
28
+ toImageLookup() {
29
+ const lookup = {};
30
+ for (const section of this.betaSections) {
31
+ if (section.id == null)
32
+ continue;
33
+ for (const image of section.images) {
34
+ lookup[image.id] = { image, betaSectionId: section.id };
35
+ }
36
+ }
30
37
  if (this.bannerImage != null) {
31
- lookup[''] = {
32
- section: null,
33
- imagesById: { [this.bannerImage.id]: this.bannerImage },
34
- };
38
+ lookup[this.bannerImage.id] = { image: this.bannerImage };
35
39
  }
36
40
  return lookup;
37
41
  }
@@ -9,13 +9,15 @@ import type { DownloadJobConfig, DownloadPlatformHarness, DownloadTaskDependency
9
9
  import type { OnlineMiniMap } from '../minimap/abstract/onlineMiniMap';
10
10
  import type { OnlineBetaSection } from '../betaSections/onlineBetaSection';
11
11
  import type { OnlineBetaSectionImage } from '../betaSections/onlineBetaSectionImage';
12
- export type OnlineBetaSectionLookupEntry = {
13
- /** Null for page-level images, which use the empty relevant-context key. */
14
- section: OnlineBetaSection | null;
15
- imagesById: Record<string, OnlineBetaSectionImage>;
12
+ /** Relevant-context section lookup keyed by non-null beta-section id. */
13
+ export type OnlineBetaSectionLookup = Record<string, OnlineBetaSection>;
14
+ export type OnlineImageLookupEntry = {
15
+ image: OnlineBetaSectionImage;
16
+ /** Omitted for page-level banner images. */
17
+ betaSectionId?: string;
16
18
  };
17
- /** Relevant-context lookup keyed by beta-section id (`""` for page-level images). */
18
- export type OnlineBetaSectionLookup = Record<string, OnlineBetaSectionLookupEntry>;
19
+ /** Image id image (+ optional owning beta section). */
20
+ export type OnlineImageLookup = Record<string, OnlineImageLookupEntry>;
19
21
  export interface OnlinePageView {
20
22
  readonly fetchType: 'online';
21
23
  readonly id: string;
@@ -24,12 +26,12 @@ export interface OnlinePageView {
24
26
  readonly miniMap: OnlineMiniMap | null;
25
27
  readonly downloadFolder: string | null;
26
28
  toBetaSectionLookup(): OnlineBetaSectionLookup;
29
+ toImageLookup(): OnlineImageLookup;
27
30
  planDownloadPhases(): DownloadPhase[];
28
31
  getDependenciesForPhases(phases: DownloadPhase[]): Record<string, DownloadTaskDependency>;
29
32
  toOfflineFromExtractedBundle(pageRoot: string, platformHarness: DownloadPlatformHarness): Promise<OfflinePageView>;
30
33
  toOffline(downloadedImageVersions: Record<string, import('../mobile/imageVersions').ImageVersions>, downloadedMiniMap?: import('../minimap/concrete/offlinePageMiniMap').OfflinePageMiniMap | import('../minimap/concrete/offlineCenteredRegionMiniMap').OfflineCenteredRegionMiniMap | null): OfflinePageView;
31
34
  toPagePreview(): PagePreview;
32
- toSavedPage(): SavedPage;
33
- toDownloadJob(config: DownloadJobConfig): DownloadJob;
35
+ toSavedPage(downloadJob: DownloadJob, config: DownloadJobConfig): SavedPage;
34
36
  }
35
37
  //# sourceMappingURL=onlinePageView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onlinePageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/onlinePageView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAErF,MAAM,MAAM,4BAA4B,GAAG;IACvC,4E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,MAAM,GAAG,IAAI,CAAC;IACvC,mBAAmB,IAAI,uBAAuB,CAAC;IAC/C,aAAa,IAAI,iBAAiB,CAAC;IACnC,kBAAkB,IAAI,aAAa,EAAE,CAAC;IACtC,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC1F,4BAA4B,CACxB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,uBAAuB,GACzC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC5B,SAAS,CACL,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC,EACxF,iBAAiB,CAAC,EAAE,OAAO,wCAAwC,EAAE,kBAAkB,GAAG,OAAO,kDAAkD,EAAE,4BAA4B,GAAG,IAAI,GACzL,eAAe,CAAC;IACnB,aAAa,IAAI,WAAW,CAAC;IAC7B,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC/E"}
@@ -15,7 +15,7 @@ import { DownloadJob } from '../../download/downloadJob';
15
15
  import { DownloadPhase } from '../../download/downloadPhase';
16
16
  import type { DownloadJobConfig, DownloadPlatformHarness, DownloadTaskDependency } from '../../download/types';
17
17
  import type { OfflinePageView } from './offlinePageView';
18
- import { type OnlineBetaSectionLookup, OnlinePageView } from './onlinePageView';
18
+ import { type OnlineBetaSectionLookup, type OnlineImageLookup, OnlinePageView } from './onlinePageView';
19
19
  export declare class OnlineRopewikiPageView extends RopewikiPageView implements OnlinePageView {
20
20
  readonly fetchType: "online";
21
21
  bannerImage: OnlineBetaSectionImage | null;
@@ -45,6 +45,7 @@ export declare class OnlineRopewikiPageView extends RopewikiPageView implements
45
45
  lon: number;
46
46
  } | null, downloadFolder?: string | null, authors?: string[] | null);
47
47
  toBetaSectionLookup(): OnlineBetaSectionLookup;
48
+ toImageLookup(): OnlineImageLookup;
48
49
  planDownloadPhases(): DownloadPhase[];
49
50
  getDependenciesForPhases(phases: DownloadPhase[]): Record<string, DownloadTaskDependency>;
50
51
  toOfflineFromExtractedBundle(pageRoot: string, platformHarness: DownloadPlatformHarness): Promise<OfflinePageView>;
@@ -1 +1 @@
1
- {"version":3,"file":"onlineRopewikiPageView.d.ts","sourceRoot":"","sources":["../../../src/models/pageViews/onlineRopewikiPageView.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAgB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAkC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAK7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EACR,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EAEzB,MAAM,sBAAsB,CAAC;AAuB9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACH,KAAK,uBAAuB,EAC5B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AQ,EAAE,MAAM,EAChB,eAAe,EAAE,uBAAuB,GACzC,OAAO,CAAC,eAAe,CAAC;IAS3B,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW;IAWrD,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQlC,SAAS,CACL,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACtD,iBAAiB,CAAC,EAAE,kBAAkB,GAAG,4BAA4B,GAAG,IAAI,GAC7E,uBAAuB;IA0E1B,aAAa,IAAI,iBAAiB;IAsBlC,WAAW,IAAI,SAAS;IAIxB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,sBAAsB;IAuD1D,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,4BAA4B;IASpC,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,wBAAwB;IAqEhC,OAAO,CAAC,8BAA8B;YA8BxB,uCAAuC;IA+BrD,OAAO,CAAC,wCAAwC;CAuCnD"}
@@ -48,15 +48,19 @@ class OnlineRopewikiPageView extends ropewikiPageView_1.RopewikiPageView {
48
48
  }
49
49
  toBetaSectionLookup() {
50
50
  const identifiedSections = this.betaSections.filter((section) => section.id != null);
51
- const lookup = (0, lodash_1.mapValues)((0, lodash_1.keyBy)(identifiedSections, (section) => section.id), (section) => ({
52
- section,
53
- imagesById: (0, lodash_1.keyBy)(section.images, (image) => image.id),
54
- }));
51
+ return (0, lodash_1.keyBy)(identifiedSections, (section) => section.id);
52
+ }
53
+ toImageLookup() {
54
+ const lookup = {};
55
+ for (const section of this.betaSections) {
56
+ if (section.id == null)
57
+ continue;
58
+ for (const image of section.images) {
59
+ lookup[image.id] = { image, betaSectionId: section.id };
60
+ }
61
+ }
55
62
  if (this.bannerImage != null) {
56
- lookup[''] = {
57
- section: null,
58
- imagesById: { [this.bannerImage.id]: this.bannerImage },
59
- };
63
+ lookup[this.bannerImage.id] = { image: this.bannerImage };
60
64
  }
61
65
  return lookup;
62
66
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * How strongly a measurement, text excerpt, or image is tied to a map feature.
3
+ * Values match the AI model / Zod enum exactly (spaced strings).
4
+ */
5
+ export declare const RELEVANCE_STRENGTHS: readonly ["Maybe Relevant", "Somewhat Relevant", "Definitely Relevant"];
6
+ export type RelevanceStrength = (typeof RELEVANCE_STRENGTHS)[number];
7
+ export declare function isRelevanceStrength(value: unknown): value is RelevanceStrength;
8
+ export declare function assertRelevanceStrength(value: unknown, context: string): RelevanceStrength;
9
+ //# sourceMappingURL=relevanceStrength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relevanceStrength.d.ts","sourceRoot":"","sources":["../../src/models/relevanceStrength.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,yEAItB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAK9E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAO1F"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RELEVANCE_STRENGTHS = void 0;
4
+ exports.isRelevanceStrength = isRelevanceStrength;
5
+ exports.assertRelevanceStrength = assertRelevanceStrength;
6
+ /**
7
+ * How strongly a measurement, text excerpt, or image is tied to a map feature.
8
+ * Values match the AI model / Zod enum exactly (spaced strings).
9
+ */
10
+ exports.RELEVANCE_STRENGTHS = [
11
+ 'Maybe Relevant',
12
+ 'Somewhat Relevant',
13
+ 'Definitely Relevant',
14
+ ];
15
+ function isRelevanceStrength(value) {
16
+ return (typeof value === 'string' &&
17
+ exports.RELEVANCE_STRENGTHS.includes(value));
18
+ }
19
+ function assertRelevanceStrength(value, context) {
20
+ if (!isRelevanceStrength(value)) {
21
+ throw new Error(`${context} must be one of ${exports.RELEVANCE_STRENGTHS.map((s) => JSON.stringify(s)).join(', ')}, got: ${JSON.stringify(value)}`);
22
+ }
23
+ return value;
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropegeo-common",
3
- "version": "1.24.1",
3
+ "version": "1.25.0",
4
4
  "description": "Shared domain models and helpers for RopeGeo and WebScraper",
5
5
  "license": "ISC",
6
6
  "repository": {