@blogmcp/sdk 0.3.1 → 0.6.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/dist/core/client-types.d.ts +7 -1
  3. package/dist/core/client.d.ts +25 -1
  4. package/dist/core/client.js +38 -34
  5. package/dist/core/consultation-adapter.d.ts +90 -0
  6. package/dist/core/consultation-adapter.js +200 -0
  7. package/dist/core/consultations.d.ts +108 -0
  8. package/dist/core/consultations.js +95 -0
  9. package/dist/core/errors.d.ts +52 -0
  10. package/dist/core/errors.js +73 -0
  11. package/dist/core/index.d.ts +7 -1
  12. package/dist/core/index.js +80 -64
  13. package/dist/core/queries.d.ts +16 -1
  14. package/dist/core/queries.js +198 -61
  15. package/dist/core/review/format.d.ts +30 -0
  16. package/dist/core/review/format.js +78 -0
  17. package/dist/core/review/index.d.ts +6 -0
  18. package/dist/core/review/index.js +9 -0
  19. package/dist/core/review/types.d.ts +176 -0
  20. package/dist/core/review/types.js +9 -0
  21. package/dist/core/server-only.d.ts +12 -0
  22. package/dist/core/server-only.js +11 -0
  23. package/dist/core/types.d.ts +295 -0
  24. package/dist/packages/mdx-render-vue/dist/composables/useTripMap.js +21 -25
  25. package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue.js +1 -0
  26. package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +105 -94
  27. package/dist/packages/mdx-schema/dist/metadata/index.js +12 -3
  28. package/dist/packages/mdx-schema/dist/styles/index.js +9 -1
  29. package/dist/packages/mdx-schema/dist/tripmap.js +81 -35
  30. package/dist/packages/tripmap-core/dist/attribution.js +121 -6
  31. package/dist/packages/tripmap-core/dist/css.js +149 -20
  32. package/dist/packages/tripmap-core/dist/detail.js +51 -0
  33. package/dist/packages/tripmap-core/dist/engine.js +367 -174
  34. package/dist/packages/tripmap-core/dist/export.js +72 -0
  35. package/dist/packages/tripmap-core/dist/filmstrip.js +30 -17
  36. package/dist/packages/tripmap-core/dist/framing.js +30 -30
  37. package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
  38. package/dist/packages/tripmap-core/dist/heading.js +8 -0
  39. package/dist/packages/tripmap-core/dist/href.js +18 -0
  40. package/dist/packages/tripmap-core/dist/index.js +60 -36
  41. package/dist/packages/tripmap-core/dist/lightbox.js +96 -0
  42. package/dist/packages/tripmap-core/dist/line.js +6 -6
  43. package/dist/packages/tripmap-core/dist/markers.js +60 -51
  44. package/dist/packages/tripmap-core/dist/nodes.js +56 -43
  45. package/dist/packages/tripmap-core/dist/playback.js +20 -16
  46. package/dist/packages/tripmap-core/dist/preload.js +44 -0
  47. package/dist/packages/tripmap-core/dist/theme.js +21 -21
  48. package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl.js +2006 -1791
  49. package/dist/{node_modules → packages/tripmap-core/node_modules}/pmtiles/dist/esm/index.js +1 -1
  50. package/package.json +8 -3
  51. package/src/core/client-types.ts +13 -2
  52. package/src/core/client.ts +40 -5
  53. package/src/core/consultation-adapter.ts +408 -0
  54. package/src/core/consultations.ts +224 -0
  55. package/src/core/errors.ts +145 -0
  56. package/src/core/index.ts +68 -0
  57. package/src/core/queries.ts +167 -3
  58. package/src/core/review/format.ts +138 -0
  59. package/src/core/review/index.ts +22 -0
  60. package/src/core/review/types.ts +168 -0
  61. package/src/core/server-only.ts +20 -0
  62. package/src/core/types.ts +337 -0
  63. /package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
@@ -1,8 +1,8 @@
1
- import { defineComponent as O, ref as g, onMounted as V, onBeforeUnmount as L, createElementBlock as n, openBlock as u, normalizeClass as a, unref as e, createCommentVNode as p, createElementVNode as d, toDisplayString as f, Fragment as B, renderList as E, normalizeStyle as P } from "vue";
1
+ import { defineComponent as H, ref as f, onMounted as L, onBeforeUnmount as P, createElementBlock as n, openBlock as s, normalizeClass as i, unref as e, createCommentVNode as d, createElementVNode as p, toDisplayString as v, Fragment as B, renderList as F, normalizeStyle as j } from "vue";
2
2
  import { tripMapStyles as r } from "../../../../mdx-schema/dist/styles/index.js";
3
- import { useTripMap as $ } from "../../composables/useTripMap.js";
4
- import { tripMapFormatTime as j } from "../../../../mdx-schema/dist/tripmap.js";
5
- const D = ["aria-label"], G = ["src"], K = /* @__PURE__ */ O({
3
+ import { useTripMap as D } from "../../composables/useTripMap.js";
4
+ import { tripMapFormatTime as G } from "../../../../mdx-schema/dist/tripmap.js";
5
+ const W = ["aria-label"], $ = ["src", "alt"], R = /* @__PURE__ */ H({
6
6
  __name: "TripMapDefault",
7
7
  props: {
8
8
  slugs: {},
@@ -14,156 +14,167 @@ const D = ["aria-label"], G = ["src"], K = /* @__PURE__ */ O({
14
14
  playback: { type: Boolean, default: !0 },
15
15
  cluster: { type: Boolean, default: !0 },
16
16
  theme: { default: "auto" },
17
+ detail: { default: "popup" },
17
18
  styleUrl: {},
18
19
  center: {},
19
20
  zoom: {},
20
21
  title: {}
21
22
  },
22
- setup(v) {
23
- const c = v, { handNodes: h, facadeThumbs: U, heightStyle: F, geoUrl: z, isConfigOnly: S, labels: _, texts: b } = $(c), x = g(null), k = g(null), i = g("facade"), A = g(0);
24
- let T = null, m = null, w = !1;
25
- async function C() {
23
+ setup(y) {
24
+ const l = y, { handNodes: S, facadeThumbs: w, facadeStops: U, heightStyle: _, geoUrl: z, isConfigOnly: I, labels: A, texts: g } = D(l), N = f(null), h = f(null), x = f(null), u = f("facade"), C = f(0);
25
+ let T = null, m = null, k = !1;
26
+ async function O() {
26
27
  try {
27
28
  const t = await fetch(z.value, { headers: { accept: "application/json" } });
28
29
  if (!t.ok) throw new Error(`media/geo ${t.status}`);
29
30
  return await t.json();
30
31
  } catch (t) {
31
- if (S.value) return { nodes: [] };
32
+ if (I.value) return { nodes: [] };
32
33
  throw t;
33
34
  }
34
35
  }
35
- async function M() {
36
- if (!w) {
37
- w = !0, i.value = "loading";
36
+ async function E() {
37
+ if (!k) {
38
+ k = !0, u.value = "loading";
38
39
  try {
39
- const [t, o] = await Promise.all([import("../../../../tripmap-core/dist/index.js"), C()]), l = (o.nodes ?? []).filter((s) => typeof s.latitude == "number" && typeof s.longitude == "number").map((s) => ({
40
- id: s.slug,
41
- lat: s.latitude,
42
- lng: s.longitude,
43
- capturedAt: s.capturedAt ?? void 0,
44
- thumbnailUrl: s.thumbnailUrl ?? void 0,
45
- imageUrl: s.url ?? void 0,
46
- altText: s.altText ?? void 0,
47
- title: s.placeName ?? void 0
48
- })), y = t.buildTripNodes(l, h.value);
49
- if (A.value = o.skipped ?? 0, y.length === 0 || !k.value) {
50
- i.value = "empty";
40
+ const [t, c] = await Promise.all([import("../../../../tripmap-core/dist/index.js"), O()]), a = (c.nodes ?? []).filter((o) => typeof o.latitude == "number" && typeof o.longitude == "number").map((o) => ({
41
+ id: o.slug,
42
+ lat: o.latitude,
43
+ lng: o.longitude,
44
+ capturedAt: o.capturedAt ?? void 0,
45
+ thumbnailUrl: o.thumbnailUrl ?? void 0,
46
+ imageUrl: o.url ?? void 0,
47
+ largeImageUrl: o.largeUrl ?? void 0,
48
+ altText: o.altText ?? void 0,
49
+ title: o.placeName ?? void 0
50
+ })), M = t.buildTripNodes(a, S.value);
51
+ if (C.value = c.skipped ?? 0, M.length === 0 || !h.value) {
52
+ u.value = "empty";
51
53
  return;
52
54
  }
53
- const N = new t.TripMap(k.value, {
54
- styleUrl: c.styleUrl || o.config?.styleUrl || "",
55
- darkStyleUrl: o.config?.darkStyleUrl,
56
- theme: c.theme,
57
- cluster: c.cluster,
58
- showLine: c.line,
59
- showFilmstrip: c.filmstrip,
60
- showPlayback: c.playback,
61
- extraAttribution: o.config?.attribution,
62
- labels: _.value,
63
- initialView: I(),
55
+ const b = new t.TripMap(h.value, {
56
+ styleUrl: l.styleUrl || c.config?.styleUrl || "",
57
+ darkStyleUrl: c.config?.darkStyleUrl,
58
+ theme: l.theme,
59
+ cluster: l.cluster,
60
+ showLine: l.line,
61
+ showFilmstrip: l.filmstrip,
62
+ showPlayback: l.playback,
63
+ title: l.title,
64
+ detail: l.detail,
65
+ detailHost: l.detail === "panel" ? x.value ?? void 0 : void 0,
66
+ extraAttribution: c.config?.attribution,
67
+ labels: A.value,
68
+ initialView: V(),
64
69
  events: {}
65
70
  });
66
- N.setNodes(y), await N.init(), T = () => N.destroy(), i.value = "live";
71
+ b.setNodes(M), await b.init(), T = () => b.destroy(), u.value = "live";
67
72
  } catch {
68
- i.value = w && i.value === "loading" ? "facade" : i.value;
73
+ u.value = k && u.value === "loading" ? "facade" : u.value;
69
74
  }
70
75
  }
71
76
  }
72
- function I() {
73
- if (!c.center) return;
74
- const [t, o] = c.center.split(",").map((l) => Number.parseFloat(l.trim()));
75
- if (!(!Number.isFinite(t) || !Number.isFinite(o)))
76
- return { center: [o, t], zoom: c.zoom };
77
+ function V() {
78
+ if (!l.center) return;
79
+ const [t, c] = l.center.split(",").map((a) => Number.parseFloat(a.trim()));
80
+ if (!(!Number.isFinite(t) || !Number.isFinite(c)))
81
+ return { center: [c, t], zoom: l.zoom };
77
82
  }
78
- return V(() => {
79
- const t = x.value;
83
+ return L(() => {
84
+ const t = N.value;
80
85
  if (t) {
81
86
  if (typeof IntersectionObserver > "u") {
82
- M();
87
+ E();
83
88
  return;
84
89
  }
85
90
  m = new IntersectionObserver(
86
- (o) => {
87
- o.some((l) => l.isIntersecting) && (m?.disconnect(), m = null, M());
91
+ (c) => {
92
+ c.some((a) => a.isIntersecting) && (m?.disconnect(), m = null, E());
88
93
  },
89
94
  { rootMargin: "300px" }
90
95
  ), m.observe(t);
91
96
  }
92
- }), L(() => {
97
+ }), P(() => {
93
98
  m?.disconnect(), T?.();
94
- }), (t, o) => (u(), n("div", {
99
+ }), (t, c) => (s(), n("div", {
95
100
  ref_key: "rootEl",
96
- ref: x,
97
- class: a(e(r).container),
101
+ ref: N,
102
+ class: i(e(r).container),
98
103
  "data-mdx-component": "TripMap",
99
- "aria-label": v.title
104
+ "aria-label": y.title
100
105
  }, [
101
- v.title ? (u(), n("p", {
106
+ y.title ? (s(), n("p", {
102
107
  key: 0,
103
- class: a(e(r).head)
104
- }, f(v.title), 3)) : p("", !0),
105
- e(U).length && i.value !== "live" ? (u(), n("ol", {
108
+ class: i(e(r).head)
109
+ }, v(y.title), 3)) : d("", !0),
110
+ e(w).length && u.value !== "live" ? (s(), n("ol", {
106
111
  key: 1,
107
- class: a(e(r).strip)
112
+ class: i(e(r).strip)
108
113
  }, [
109
- (u(!0), n(B, null, E(e(U), (l) => (u(), n("li", {
110
- key: l.slug,
111
- class: a(e(r).stripItem)
114
+ (s(!0), n(B, null, F(e(w), (a) => (s(), n("li", {
115
+ key: a.slug,
116
+ class: i(e(r).stripItem)
112
117
  }, [
113
- d("img", {
114
- src: l.src,
115
- alt: "",
118
+ p("img", {
119
+ src: a.src,
120
+ alt: a.alt,
116
121
  width: "80",
117
122
  height: "80",
118
123
  loading: "lazy",
119
124
  decoding: "async",
120
- class: a(e(r).stripImg)
121
- }, null, 10, G)
125
+ class: i(e(r).stripImg)
126
+ }, null, 10, $)
122
127
  ], 2))), 128))
123
- ], 2)) : p("", !0),
124
- d("div", {
125
- class: a(e(r).mapWrap),
126
- style: P(e(F))
128
+ ], 2)) : d("", !0),
129
+ p("div", {
130
+ class: i(e(r).mapWrap),
131
+ style: j(e(_))
127
132
  }, [
128
- d("div", {
133
+ p("div", {
129
134
  ref_key: "mapEl",
130
- ref: k,
135
+ ref: h,
131
136
  class: "absolute inset-0"
132
137
  }, null, 512),
133
- i.value !== "live" ? (u(), n("div", {
138
+ u.value !== "live" ? (s(), n("div", {
134
139
  key: 0,
135
- class: a([e(r).mapOverlay])
140
+ class: i([e(r).mapOverlay])
136
141
  }, [
137
- d("div", {
138
- class: a(e(r).mapBox)
142
+ p("div", {
143
+ class: i(e(r).mapBox)
139
144
  }, [
140
- d("span", {
141
- class: a(e(r).mapHint)
142
- }, f(i.value === "empty" ? e(b).empty : e(b).hint), 3)
145
+ p("span", {
146
+ class: i(e(r).mapHint)
147
+ }, v(u.value === "empty" ? e(g).empty : e(g).hint), 3)
143
148
  ], 2)
144
- ], 2)) : p("", !0)
149
+ ], 2)) : d("", !0)
145
150
  ], 6),
146
- e(h).length && i.value !== "live" ? (u(), n("ol", {
151
+ l.detail === "panel" ? (s(), n("div", {
147
152
  key: 2,
148
- class: a(e(r).stopList)
153
+ ref_key: "detailEl",
154
+ ref: x,
155
+ class: i(e(r).detailHost)
156
+ }, null, 2)) : d("", !0),
157
+ e(U).length && u.value !== "live" ? (s(), n("ol", {
158
+ key: 3,
159
+ class: i(e(r).stopList)
149
160
  }, [
150
- (u(!0), n(B, null, E(e(h), (l, y) => (u(), n("li", {
151
- key: l.id || y
161
+ (s(!0), n(B, null, F(e(U), (a) => (s(), n("li", {
162
+ key: a.key
152
163
  }, [
153
- l.capturedAt ? (u(), n("span", {
164
+ a.capturedAt ? (s(), n("span", {
154
165
  key: 0,
155
- class: a(e(r).stopTime)
156
- }, f(e(j)(l.capturedAt)), 3)) : p("", !0),
157
- d("span", null, f(l.title || `${l.lat}, ${l.lng}`), 1)
166
+ class: i(e(r).stopTime)
167
+ }, v(e(G)(a.capturedAt)), 3)) : d("", !0),
168
+ p("span", null, v(a.title), 1)
158
169
  ]))), 128))
159
- ], 2)) : p("", !0),
160
- i.value !== "live" ? (u(), n("p", {
161
- key: 3,
162
- class: a(e(r).note)
163
- }, f(e(b).unavailable), 3)) : p("", !0)
164
- ], 10, D));
170
+ ], 2)) : d("", !0),
171
+ u.value !== "live" ? (s(), n("p", {
172
+ key: 4,
173
+ class: i(e(r).note)
174
+ }, v(e(g).unavailable), 3)) : d("", !0)
175
+ ], 10, W));
165
176
  }
166
177
  });
167
178
  export {
168
- K as default
179
+ R as default
169
180
  };
@@ -403,7 +403,7 @@ Read this carefully.
403
403
  },
404
404
  {
405
405
  name: "TripMap",
406
- description: "Interactive trip map built from photo GPS + capture time: thumbnail markers, chronological route line, synced photo filmstrip, fly-through playback. Without props it maps every geotagged media attached to or embedded in the article (auto mode); only media with exposed location (geoExposed) appear. In article previews it renders as a static photo strip + stop list — the live map loads on the published page.",
406
+ description: "Interactive trip map built from photo GPS + capture time: thumbnail markers, chronological route line, synced photo filmstrip, fly-through playback. Without props it maps every geotagged media attached to or embedded in the article (auto mode); only media with exposed location (geoExposed) appear. Article previews load the same live map; where its engine cannot load, a static photo strip + stop list stays in its place.",
407
407
  icon: "🗺",
408
408
  category: "media",
409
409
  aliases: ["tripmap", "map", "trip", "route", "travelmap", "hike"],
@@ -424,7 +424,7 @@ Read this carefully.
424
424
  name: "nodes",
425
425
  type: "array",
426
426
  required: !1,
427
- description: 'Hand-made nodes merged chronologically with the photos. STRICT JSON with quoted keys: [{"lat": 49.35, "lng": 16.31, "title": "Níhov, nádraží", "capturedAt": "2025-04-20T08:52:00"}]. Entries without capturedAt render as markers but stay off the route line. Unquoted keys silently break the prop.'
427
+ description: 'Hand-made stops merged with the photos — a STRICT JSON array inside braces, keys quoted: nodes={[{"id": "eiffel-tower", "lat": 48.8582, "lng": 2.2945, "title": "Eiffel Tower", "capturedAt": "2025-04-20T07:30:00Z"}]}. lat/lng are JSON numbers, never strings. An id (optional) must be unique and must not equal a media slug — a clashing node is dropped. capturedAt is the local wall-clock time at the stop marked Z, the way photo capture times are stored (reached at 09:40 → "2025-04-20T09:40:00Z") — always write the Z; a real offset such as +02:00 shifts the stop against the photos by that offset. Timed nodes join the route line and the GPX track, untimed ones stay off both. Distance (km) and place labels are never derived from hand nodes. Unquoted keys or invalid JSON silently drop the whole prop.'
428
428
  },
429
429
  {
430
430
  name: "height",
@@ -469,6 +469,15 @@ Read this carefully.
469
469
  description: 'Map color scheme; "auto" follows the reader’s system preference.',
470
470
  enum: ["light", "dark", "auto"]
471
471
  },
472
+ {
473
+ name: "detail",
474
+ type: "string",
475
+ required: !1,
476
+ default: '"popup"',
477
+ description: 'Where the selected photo opens: "popup" on the map, or "panel" below the filmstrip at full width (larger photos; the map keeps its height). Both open the photo full-screen on click.',
478
+ enum: ["popup", "panel"],
479
+ addedIn: "0.4.0"
480
+ },
472
481
  {
473
482
  name: "styleUrl",
474
483
  type: "string",
@@ -499,7 +508,7 @@ Read this carefully.
499
508
  selfClosing: !0,
500
509
  defaultProps: 'title="Trasa výletu"',
501
510
  defaultChildren: "",
502
- example: '<TripMap title="Trasa údolím Libochovky" nodes={[{"lat": 49.3641, "lng": 16.3143, "title": "Níhov, nádraží", "capturedAt": "2025-04-20T08:52:00"}]} />',
511
+ example: '<TripMap title="Paris walk" nodes={[{"id": "eiffel-tower", "lat": 48.8582, "lng": 2.2945, "title": "Eiffel Tower", "capturedAt": "2025-04-20T07:30:00Z"}, {"id": "arc-de-triomphe", "lat": 48.8736, "lng": 2.295, "title": "Arc de Triomphe", "capturedAt": "2025-04-20T08:15:00Z"}]} />',
503
512
  addedIn: "0.3.0",
504
513
  deprecated: []
505
514
  }
@@ -1,5 +1,11 @@
1
1
  const t = {
2
- container: "my-6 flex flex-col gap-3 rounded-xl border border-gray-200 bg-white p-3",
2
+ /**
3
+ * `not-prose` is load-bearing: every host puts the article inside Tailwind Typography's
4
+ * `.prose` (both blogs, md-editor, the article-review MCP app), whose `img { margin: 2em 0 }`
5
+ * / `li` / `ol` rules would otherwise leak into the facade strip — an 80 px thumb pushed
6
+ * 32 px down inside an overflow-hidden 80 px tile (seen in the claude.ai preview, 2026-09-06).
7
+ */
8
+ container: "not-prose my-6 flex flex-col gap-3 rounded-xl border border-gray-200 bg-white p-3",
3
9
  head: "text-sm font-medium text-gray-700 m-0",
4
10
  /**
5
11
  * Sized wrapper that hosts BOTH the engine div and the facade overlay.
@@ -8,6 +14,8 @@ const t = {
8
14
  * own container would clobber the classes the engine adds to it).
9
15
  */
10
16
  mapWrap: "relative w-full overflow-hidden rounded-lg",
17
+ /** detail="panel": engine-owned photo panel host below the map box (empty until a photo is picked). */
18
+ detailHost: "w-full",
11
19
  mapOverlay: "absolute inset-0",
12
20
  mapBox: "flex h-full w-full items-center justify-center overflow-hidden rounded-lg bg-gray-100",
13
21
  mapHint: "text-sm text-gray-500",
@@ -1,37 +1,37 @@
1
- const s = "420px";
2
- function r(t) {
3
- return (t ?? "").split(",").map((e) => e.trim()).filter(Boolean);
1
+ const b = "420px";
2
+ function u(o) {
3
+ return (o ?? "").split(",").map((t) => t.trim()).filter(Boolean);
4
4
  }
5
- function p(t) {
6
- let e = t;
7
- if (typeof e == "string")
5
+ function f(o) {
6
+ let t = o;
7
+ if (typeof t == "string")
8
8
  try {
9
- e = JSON.parse(e);
9
+ t = JSON.parse(t);
10
10
  } catch {
11
11
  return typeof console < "u" && console.warn('[TripMap] `nodes` prop is not valid JSON — use quoted keys: [{"lat":49.3,"lng":16.3}]'), [];
12
12
  }
13
- return Array.isArray(e) ? e.filter((a) => !!a && typeof a == "object" && typeof a.lat == "number" && typeof a.lng == "number") : [];
14
- }
15
- function u(t) {
16
- const e = /T(\d{2}):(\d{2})/.exec(t);
17
- return e ? `${e[1]}:${e[2]}` : "";
18
- }
19
- function l(t, e) {
20
- const a = new URLSearchParams();
21
- e?.language && a.set("lang", e.language);
22
- const n = r(t.slugs);
23
- if (n.length > 0)
24
- return a.set("slugs", n.join(",")), `/api/media/geo?${a.toString()}`;
25
- if (e?.filename) {
26
- a.set("article", e.filename);
27
- const o = r(t.exclude);
28
- return o.length > 0 && a.set("exclude", o.join(",")), `/api/media/geo?${a.toString()}`;
13
+ return Array.isArray(t) ? t.filter((n) => !!n && typeof n == "object" && typeof n.lat == "number" && typeof n.lng == "number") : [];
14
+ }
15
+ function v(o) {
16
+ const t = /T(\d{2}):(\d{2})/.exec(o);
17
+ return t ? `${t[1]}:${t[2]}` : "";
18
+ }
19
+ function x(o, t) {
20
+ const n = new URLSearchParams();
21
+ t?.language && n.set("lang", t.language);
22
+ const a = u(o.slugs);
23
+ if (a.length > 0)
24
+ return n.set("slugs", a.join(",")), `/api/media/geo?${n.toString()}`;
25
+ if (t?.filename) {
26
+ n.set("article", t.filename);
27
+ const r = u(o.exclude);
28
+ return r.length > 0 && n.set("exclude", r.join(",")), t.previewToken && n.set("preview", t.previewToken), `/api/media/geo?${n.toString()}`;
29
29
  }
30
- const i = a.toString();
30
+ const i = n.toString();
31
31
  return i ? `/api/media/geo?${i}` : "/api/media/geo";
32
32
  }
33
- function c(t) {
34
- return (t ?? "").toLowerCase().startsWith("cs") ? {
33
+ function y(o) {
34
+ return (o ?? "").toLowerCase().startsWith("cs") ? {
35
35
  hint: "Interaktivní mapa výletu",
36
36
  empty: "Žádná z fotek nemá zveřejněnou polohu.",
37
37
  unavailable: "Mapa se zobrazí na publikovaném webu."
@@ -41,15 +41,61 @@ function c(t) {
41
41
  unavailable: "The map is shown on the published page."
42
42
  };
43
43
  }
44
- function f(t) {
45
- return (t ?? "").toLowerCase().startsWith("cs") ? { play: "Přehrát trasu", stop: "Zastavit" } : void 0;
44
+ function T(o) {
45
+ return (o ?? "").toLowerCase().startsWith("cs") ? {
46
+ play: "Přehrát trasu",
47
+ stop: "Zastavit",
48
+ fullscreen: "Celá obrazovka",
49
+ exitFullscreen: "Ukončit celou obrazovku",
50
+ export: "Export trasy",
51
+ exportGpx: "Stáhnout GPX",
52
+ exportGpxHint: "hodinky, Garmin, Strava, Komoot",
53
+ openInMapy: "Otevřít v Mapy.com",
54
+ openInGoogleMaps: "Otevřít v Google Maps",
55
+ lightboxClose: "Zavřít",
56
+ lightboxPrev: "Předchozí fotka",
57
+ lightboxNext: "Další fotka",
58
+ zoomImage: "Zobrazit na celou obrazovku"
59
+ } : void 0;
60
+ }
61
+ const c = (o) => `/api/media/thumb/${encodeURIComponent(o)}?width=192`, g = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/, h = (o) => {
62
+ if (typeof o != "string" || !o)
63
+ return null;
64
+ const t = g.exec(o.trim()), n = Date.parse(t ? `${t[1]}T${t[2]}Z` : o);
65
+ return Number.isNaN(n) ? null : n;
66
+ };
67
+ function m(o) {
68
+ const t = [], n = [];
69
+ for (const a of o) {
70
+ const i = h(a.capturedAt);
71
+ i === null ? n.push(a) : t.push({ item: a, t: i });
72
+ }
73
+ return t.sort((a, i) => a.t - i.t), [...t.map((a) => a.item), ...n];
74
+ }
75
+ function M(o, t) {
76
+ const n = (t?.media ?? []).filter((e) => !!e.slug), a = new Map(n.map((e) => [e.slug, e])), i = u(o.slugs), r = new Set(u(o.exclude));
77
+ let s, p;
78
+ i.length > 0 ? (p = i.map((e) => {
79
+ const l = a.get(e);
80
+ return { slug: e, src: l?.thumbnailUrl || c(e), alt: l?.altText ?? "" };
81
+ }), s = i.map((e) => a.get(e)).filter((e) => !!e)) : (s = m(n.filter((e) => !r.has(e.slug))), p = s.map((e) => ({ slug: e.slug, src: e.thumbnailUrl || c(e.slug), alt: e.altText ?? "" })));
82
+ const d = m([
83
+ ...s.filter((e) => e.placeName).map((e) => ({ key: `m:${e.slug}`, title: e.placeName, capturedAt: e.capturedAt ?? void 0 })),
84
+ ...f(o.nodes).map((e, l) => ({
85
+ key: `n:${e.id || l}`,
86
+ title: e.title || `${e.lat}, ${e.lng}`,
87
+ capturedAt: e.capturedAt
88
+ }))
89
+ ]);
90
+ return { thumbs: p, stops: d };
46
91
  }
47
92
  export {
48
- s as TRIPMAP_DEFAULT_HEIGHT,
49
- l as buildTripMapGeoUrl,
50
- p as parseTripMapHandNodes,
51
- r as splitTripMapList,
52
- u as tripMapFormatTime,
53
- f as tripMapPlaybackLabels,
54
- c as tripMapUiTexts
93
+ b as TRIPMAP_DEFAULT_HEIGHT,
94
+ x as buildTripMapGeoUrl,
95
+ f as parseTripMapHandNodes,
96
+ u as splitTripMapList,
97
+ M as tripMapFacade,
98
+ v as tripMapFormatTime,
99
+ T as tripMapPlaybackLabels,
100
+ y as tripMapUiTexts
55
101
  };
@@ -1,9 +1,124 @@
1
- const n = '© <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap</a> contributors';
2
- function o(e) {
3
- const t = [n], r = e?.trim();
4
- return r && t.push(r), t;
1
+ import { safeNodeHref as u } from "./href.js";
2
+ const d = '© <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap</a> contributors';
3
+ function N(r) {
4
+ const t = [d], e = r?.trim();
5
+ return e && t.push(e), t;
6
+ }
7
+ const f = /* @__PURE__ */ new Set([
8
+ "script",
9
+ "style",
10
+ "template",
11
+ "iframe",
12
+ "frame",
13
+ "frameset",
14
+ "object",
15
+ "embed",
16
+ "noscript",
17
+ "noembed",
18
+ "noframes",
19
+ "svg",
20
+ "math",
21
+ "textarea",
22
+ "select",
23
+ "button",
24
+ "title",
25
+ "xmp"
26
+ ]), p = 1, m = 3, h = /^https?:/i;
27
+ function b(r) {
28
+ const t = u(r);
29
+ return t !== null && h.test(t) ? t : null;
30
+ }
31
+ function a(r, t, e) {
32
+ for (const n of Array.from(r.childNodes)) {
33
+ if (n.nodeType === m) {
34
+ t.appendChild(e.createTextNode(n.nodeValue ?? ""));
35
+ continue;
36
+ }
37
+ if (n.nodeType !== p) continue;
38
+ const o = n, i = o.localName.toLowerCase();
39
+ if (f.has(i)) continue;
40
+ const s = i === "a" ? b(o.getAttribute("href")) : null;
41
+ if (s === null) {
42
+ a(o, t, e);
43
+ continue;
44
+ }
45
+ const c = e.createElement("a");
46
+ c.setAttribute("href", s), c.setAttribute("target", "_blank"), c.setAttribute("rel", "noopener"), a(o, c, e), t.appendChild(c);
47
+ }
48
+ }
49
+ function T(r, t) {
50
+ const e = r.ownerDocument, n = e.implementation.createHTMLDocument("").createElement("template");
51
+ n.innerHTML = t, a(n.content, r, e);
52
+ }
53
+ function g(r, t) {
54
+ const e = r.ownerDocument;
55
+ r.textContent = "", t.forEach((n, o) => {
56
+ o > 0 && r.appendChild(e.createTextNode(" | ")), T(r, n);
57
+ });
58
+ }
59
+ function y(r, t) {
60
+ const e = [];
61
+ for (const n of [...r, ...t])
62
+ typeof n == "string" && n.trim() && !e.includes(n) && e.push(n);
63
+ return e.sort((n, o) => n.length - o.length), e.filter((n, o) => !e.slice(o + 1).some((i) => i.includes(n)));
64
+ }
65
+ function E(r) {
66
+ const t = r.getZoom(), e = /* @__PURE__ */ new Set();
67
+ for (const i of r.getLayersOrder()) {
68
+ const s = r.getLayer(i);
69
+ s?.source && !s.isHidden?.(t) && e.add(s.source);
70
+ }
71
+ const n = r.getTerrain?.()?.source;
72
+ n && e.add(n);
73
+ const o = [];
74
+ for (const i of e) {
75
+ const s = r.getSource(i)?.attribution;
76
+ typeof s == "string" && o.push(s);
77
+ }
78
+ return o;
79
+ }
80
+ const l = ["styledata", "sourcedata", "terrain"];
81
+ class A {
82
+ custom;
83
+ map = null;
84
+ container = null;
85
+ inner = null;
86
+ rendered = null;
87
+ constructor(t) {
88
+ this.custom = t;
89
+ }
90
+ getDefaultPosition() {
91
+ return "bottom-right";
92
+ }
93
+ onAdd(t) {
94
+ const e = t.getContainer().ownerDocument, n = e.createElement("div");
95
+ n.className = "maplibregl-ctrl maplibregl-ctrl-attrib";
96
+ const o = e.createElement("div");
97
+ o.className = "maplibregl-ctrl-attrib-inner", n.appendChild(o), this.map = t, this.container = n, this.inner = o, this.rendered = null, this.refresh();
98
+ for (const i of l) t.on(i, this.onMapData);
99
+ return n;
100
+ }
101
+ onRemove() {
102
+ const t = this.map;
103
+ if (t) for (const e of l) t.off(e, this.onMapData);
104
+ this.container?.remove(), this.map = null, this.container = null, this.inner = null, this.rendered = null;
105
+ }
106
+ onMapData = (t) => {
107
+ t && (t.type === "terrain" || t.dataType === "style" || t.dataType === "source" && (t.sourceDataType === "metadata" || t.sourceDataType === "visibility")) && this.refresh();
108
+ };
109
+ refresh() {
110
+ const { map: t, container: e, inner: n } = this;
111
+ if (!t || !e || !n) return;
112
+ const o = y(this.custom, E(t)), i = o.join(" | ");
113
+ i !== this.rendered && (this.rendered = i, g(n, o), e.classList.toggle("maplibregl-attrib-empty", o.length === 0));
114
+ }
5
115
  }
6
116
  export {
7
- n as OSM_ATTRIBUTION,
8
- o as buildAttributions
117
+ d as OSM_ATTRIBUTION,
118
+ A as TripMapAttributionControl,
119
+ T as appendCredit,
120
+ N as buildAttributions,
121
+ y as mergeAttributions,
122
+ g as renderAttributions,
123
+ E as usedSourceAttributions
9
124
  };