@blogmcp/sdk 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/queries.d.ts +2 -2
- package/dist/core/queries.js +10 -4
- package/dist/core/types.d.ts +9 -0
- package/dist/node_modules/fflate/esm/browser.js +284 -0
- package/dist/node_modules/maplibre-gl/dist/maplibre-gl-shared.js +11606 -0
- package/dist/node_modules/maplibre-gl/dist/maplibre-gl.js +12289 -0
- package/dist/node_modules/pmtiles/dist/esm/index.js +441 -0
- package/dist/packages/mdx-render-vue/dist/composables/useTripMap.js +31 -0
- package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue.js +43 -0
- package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue2.js +4 -0
- package/dist/packages/mdx-render-vue/dist/registry.js +29 -22
- package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +169 -0
- package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue2.js +4 -0
- package/dist/packages/mdx-schema/dist/composables/useMdxParsing.js +330 -80
- package/dist/packages/mdx-schema/dist/metadata/index.js +108 -6
- package/dist/packages/mdx-schema/dist/styles/index.js +29 -9
- package/dist/packages/mdx-schema/dist/tripmap.js +55 -0
- package/dist/packages/tripmap-core/dist/attribution.js +9 -0
- package/dist/packages/tripmap-core/dist/css.js +74 -0
- package/dist/packages/tripmap-core/dist/engine.js +255 -0
- package/dist/packages/tripmap-core/dist/filmstrip.js +46 -0
- package/dist/packages/tripmap-core/dist/framing.js +44 -0
- package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +4 -0
- package/dist/packages/tripmap-core/dist/index.js +90 -0
- package/dist/packages/tripmap-core/dist/line.js +34 -0
- package/dist/packages/tripmap-core/dist/markers.js +90 -0
- package/dist/packages/tripmap-core/dist/node_modules/maplibre-gl/dist/maplibre-gl.css.js +4 -0
- package/dist/packages/tripmap-core/dist/nodes.js +55 -0
- package/dist/packages/tripmap-core/dist/playback.js +25 -0
- package/dist/packages/tripmap-core/dist/theme.js +42 -0
- package/dist/react/KbMdxContent.d.ts +3 -3
- package/dist/react/KbMdxContent.js +60 -68
- package/dist/sdk.css +1 -1
- package/dist/vue/components/KbMdxContent.vue.js +2 -2
- package/dist/vue/components/KbMdxContent.vue2.js +50 -53
- package/package.json +3 -3
- package/src/core/queries.ts +6 -0
- package/src/core/types.ts +9 -0
- package/src/react/KbMdxContent.tsx +25 -39
- package/src/vue/components/KbMdxContent.vue +43 -40
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { decompressSync as k } from "../../../fflate/esm/browser.js";
|
|
2
|
+
var K = Object.defineProperty, F = Math.pow, h = (i, t) => K(i, "name", { value: t, configurable: !0 }), g = (i, t, e) => new Promise((r, n) => {
|
|
3
|
+
var s = (l) => {
|
|
4
|
+
try {
|
|
5
|
+
o(e.next(l));
|
|
6
|
+
} catch (c) {
|
|
7
|
+
n(c);
|
|
8
|
+
}
|
|
9
|
+
}, a = (l) => {
|
|
10
|
+
try {
|
|
11
|
+
o(e.throw(l));
|
|
12
|
+
} catch (c) {
|
|
13
|
+
n(c);
|
|
14
|
+
}
|
|
15
|
+
}, o = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(s, a);
|
|
16
|
+
o((e = e.apply(i, t)).next());
|
|
17
|
+
});
|
|
18
|
+
h((i, t) => {
|
|
19
|
+
let e = !1, r = "", n = L.GridLayer.extend({ createTile: h((s, a) => {
|
|
20
|
+
let o = document.createElement("img"), l = new AbortController(), c = l.signal;
|
|
21
|
+
return o.cancel = () => {
|
|
22
|
+
l.abort();
|
|
23
|
+
}, e || (i.getHeader().then((d) => {
|
|
24
|
+
d.tileType === 1 || d.tileType === 6 ? console.error("Error: archive contains vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details.") : d.tileType === 2 ? r = "image/png" : d.tileType === 3 ? r = "image/jpeg" : d.tileType === 4 ? r = "image/webp" : d.tileType === 5 && (r = "image/avif");
|
|
25
|
+
}), e = !0), i.getZxy(s.z, s.x, s.y, c).then((d) => {
|
|
26
|
+
if (d) {
|
|
27
|
+
let u = new Blob([d.data], { type: r }), f = window.URL.createObjectURL(u);
|
|
28
|
+
o.src = f;
|
|
29
|
+
} else o.style.display = "none";
|
|
30
|
+
o.cancel = void 0, a(void 0, o);
|
|
31
|
+
}).catch((d) => {
|
|
32
|
+
if (d.name !== "AbortError") throw d;
|
|
33
|
+
}), o;
|
|
34
|
+
}, "createTile"), _removeTile: h(function(s) {
|
|
35
|
+
let a = this._tiles[s];
|
|
36
|
+
a && (a.el.cancel && a.el.cancel(), a.el.src && window.URL.revokeObjectURL(a.el.src), a.el.width = 0, a.el.height = 0, a.el.deleted = !0, L.DomUtil.remove(a.el), delete this._tiles[s], this.fire("tileunload", { tile: a.el, coords: this._keyToTileCoords(s) }));
|
|
37
|
+
}, "_removeTile") });
|
|
38
|
+
return new n(t);
|
|
39
|
+
}, "leafletRasterLayer");
|
|
40
|
+
var W = h((i) => (t, e) => {
|
|
41
|
+
if (e instanceof AbortController) return i(t, e);
|
|
42
|
+
let r = new AbortController();
|
|
43
|
+
return i(t, r).then((n) => e(void 0, n.data, n.cacheControl || "", n.expires || ""), (n) => e(n)).catch((n) => e(n)), { cancel: h(() => r.abort(), "cancel") };
|
|
44
|
+
}, "v3compat"), A = class {
|
|
45
|
+
constructor(t) {
|
|
46
|
+
this.tilev4 = h((e, r) => g(this, null, function* () {
|
|
47
|
+
if (e.type === "json") {
|
|
48
|
+
let y = e.url.substr(10), v = this.tiles.get(y);
|
|
49
|
+
if (v || (v = new M(y), this.tiles.set(y, v)), this.metadata) {
|
|
50
|
+
let j = yield v.getTileJson(e.url);
|
|
51
|
+
return r.signal.throwIfAborted(), { data: j };
|
|
52
|
+
}
|
|
53
|
+
let m = yield v.getHeader();
|
|
54
|
+
return r.signal.throwIfAborted(), (m.minLon >= m.maxLon || m.minLat >= m.maxLat) && console.error(`Bounds of PMTiles archive ${m.minLon},${m.minLat},${m.maxLon},${m.maxLat} are not valid.`), { data: { tiles: [`${e.url}/{z}/{x}/{y}`], minzoom: m.minZoom, maxzoom: m.maxZoom, bounds: [m.minLon, m.minLat, m.maxLon, m.maxLat] } };
|
|
55
|
+
}
|
|
56
|
+
let n = new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/), s = e.url.match(n);
|
|
57
|
+
if (!s) throw new Error("Invalid PMTiles protocol URL");
|
|
58
|
+
let a = s[1], o = this.tiles.get(a);
|
|
59
|
+
o || (o = new M(a), this.tiles.set(a, o));
|
|
60
|
+
let l = s[2], c = s[3], d = s[4], u = yield o?.getZxy(+l, +c, +d, r.signal);
|
|
61
|
+
if (r.signal.throwIfAborted(), u) return { data: new Uint8Array(u.data), cacheControl: u.cacheControl, expires: u.expires };
|
|
62
|
+
let f = yield o.getHeader();
|
|
63
|
+
if (f.tileType === 1 || f.tileType === 6) {
|
|
64
|
+
if (this.errorOnMissingTile) throw new Error("Tile not found.");
|
|
65
|
+
return { data: new Uint8Array() };
|
|
66
|
+
}
|
|
67
|
+
return { data: null };
|
|
68
|
+
}), "tilev4"), this.tile = W(this.tilev4), this.tiles = /* @__PURE__ */ new Map(), this.metadata = t?.metadata || !1, this.errorOnMissingTile = t?.errorOnMissingTile || !1;
|
|
69
|
+
}
|
|
70
|
+
add(t) {
|
|
71
|
+
this.tiles.set(t.source.getKey(), t);
|
|
72
|
+
}
|
|
73
|
+
get(t) {
|
|
74
|
+
return this.tiles.get(t);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
h(A, "Protocol");
|
|
78
|
+
var te = A;
|
|
79
|
+
function D(i, t) {
|
|
80
|
+
return (t >>> 0) * 4294967296 + (i >>> 0);
|
|
81
|
+
}
|
|
82
|
+
h(D, "toNum");
|
|
83
|
+
function $(i, t) {
|
|
84
|
+
let e = t.buf, r = e[t.pos++], n = (r & 112) >> 4;
|
|
85
|
+
if (r < 128 || (r = e[t.pos++], n |= (r & 127) << 3, r < 128) || (r = e[t.pos++], n |= (r & 127) << 10, r < 128) || (r = e[t.pos++], n |= (r & 127) << 17, r < 128) || (r = e[t.pos++], n |= (r & 127) << 24, r < 128) || (r = e[t.pos++], n |= (r & 1) << 31, r < 128)) return D(i, n);
|
|
86
|
+
throw new Error("Expected varint not more than 10 bytes");
|
|
87
|
+
}
|
|
88
|
+
h($, "readVarintRemainder");
|
|
89
|
+
function w(i) {
|
|
90
|
+
let t = i.buf, e = t[i.pos++], r = e & 127;
|
|
91
|
+
return e < 128 || (e = t[i.pos++], r |= (e & 127) << 7, e < 128) || (e = t[i.pos++], r |= (e & 127) << 14, e < 128) || (e = t[i.pos++], r |= (e & 127) << 21, e < 128) ? r : (e = t[i.pos], r |= (e & 15) << 28, $(r, i));
|
|
92
|
+
}
|
|
93
|
+
h(w, "readVarint");
|
|
94
|
+
function b(i, t, e, r, n) {
|
|
95
|
+
return n === 0 ? r !== 0 ? [i - 1 - e, i - 1 - t] : [e, t] : [t, e];
|
|
96
|
+
}
|
|
97
|
+
h(b, "rotate");
|
|
98
|
+
function H(i, t, e) {
|
|
99
|
+
if (i > 26) throw new Error("Tile zoom level exceeds max safe number limit (26)");
|
|
100
|
+
if (t >= 1 << i || e >= 1 << i) throw new Error("tile x/y outside zoom level bounds");
|
|
101
|
+
let r = ((1 << i) * (1 << i) - 1) / 3, n = i - 1, [s, a] = [t, e];
|
|
102
|
+
for (let o = 1 << n; o > 0; o >>= 1) {
|
|
103
|
+
let l = s & o, c = a & o;
|
|
104
|
+
r += (3 * l ^ c) * (1 << n), [s, a] = b(o, s, a, l, c), n--;
|
|
105
|
+
}
|
|
106
|
+
return r;
|
|
107
|
+
}
|
|
108
|
+
h(H, "zxyToTileId");
|
|
109
|
+
function z(i) {
|
|
110
|
+
let t = 3 * i + 1;
|
|
111
|
+
return t < 4294967296 ? 31 - Math.clz32(t) : 63 - Math.clz32(t / 4294967296);
|
|
112
|
+
}
|
|
113
|
+
h(z, "tileIdToZ");
|
|
114
|
+
function N(i) {
|
|
115
|
+
let t = z(i) >> 1;
|
|
116
|
+
if (t > 26) throw new Error("Tile zoom level exceeds max safe number limit (26)");
|
|
117
|
+
let e = ((1 << t) * (1 << t) - 1) / 3, r = i - e, n = 0, s = 0, a = 1 << t;
|
|
118
|
+
for (let o = 1; o < a; o <<= 1) {
|
|
119
|
+
let l = o & r / 2, c = o & (r ^ l);
|
|
120
|
+
[n, s] = b(o, n, s, l, c), r = r / 2, n += l, s += c;
|
|
121
|
+
}
|
|
122
|
+
return [t, n, s];
|
|
123
|
+
}
|
|
124
|
+
h(N, "tileIdToZxy");
|
|
125
|
+
var V = ((i) => (i[i.Unknown = 0] = "Unknown", i[i.None = 1] = "None", i[i.Gzip = 2] = "Gzip", i[i.Brotli = 3] = "Brotli", i[i.Zstd = 4] = "Zstd", i))(V || {});
|
|
126
|
+
function x(i, t) {
|
|
127
|
+
return g(this, null, function* () {
|
|
128
|
+
if (t === 1 || t === 0) return i;
|
|
129
|
+
if (t === 2) {
|
|
130
|
+
if (typeof globalThis.DecompressionStream > "u") return k(new Uint8Array(i));
|
|
131
|
+
let e = new Response(i).body;
|
|
132
|
+
if (!e) throw new Error("Failed to read response stream");
|
|
133
|
+
let r = e.pipeThrough(new globalThis.DecompressionStream("gzip"));
|
|
134
|
+
return new Response(r).arrayBuffer();
|
|
135
|
+
}
|
|
136
|
+
throw new Error("Compression method not supported");
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
h(x, "defaultDecompress");
|
|
140
|
+
var _ = ((i) => (i[i.Unknown = 0] = "Unknown", i[i.Mvt = 1] = "Mvt", i[i.Png = 2] = "Png", i[i.Jpeg = 3] = "Jpeg", i[i.Webp = 4] = "Webp", i[i.Avif = 5] = "Avif", i[i.Mlt = 6] = "Mlt", i))(_ || {});
|
|
141
|
+
function I(i) {
|
|
142
|
+
return i === 1 ? ".mvt" : i === 2 ? ".png" : i === 3 ? ".jpg" : i === 4 ? ".webp" : i === 5 ? ".avif" : i === 6 ? ".mlt" : "";
|
|
143
|
+
}
|
|
144
|
+
h(I, "tileTypeExt");
|
|
145
|
+
var J = 127;
|
|
146
|
+
function P(i, t) {
|
|
147
|
+
let e = 0, r = i.length - 1;
|
|
148
|
+
for (; e <= r; ) {
|
|
149
|
+
let n = r + e >> 1, s = t - i[n].tileId;
|
|
150
|
+
if (s > 0) e = n + 1;
|
|
151
|
+
else if (s < 0) r = n - 1;
|
|
152
|
+
else return i[n];
|
|
153
|
+
}
|
|
154
|
+
return r >= 0 && (i[r].runLength === 0 || t - i[r].tileId < i[r].runLength) ? i[r] : null;
|
|
155
|
+
}
|
|
156
|
+
h(P, "findTile");
|
|
157
|
+
var G = class {
|
|
158
|
+
constructor(t) {
|
|
159
|
+
this.file = t;
|
|
160
|
+
}
|
|
161
|
+
getKey() {
|
|
162
|
+
return this.file.name;
|
|
163
|
+
}
|
|
164
|
+
getBytes(t, e) {
|
|
165
|
+
return g(this, null, function* () {
|
|
166
|
+
return { data: yield this.file.slice(t, t + e).arrayBuffer() };
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
h(G, "FileSource");
|
|
171
|
+
var Z = class {
|
|
172
|
+
constructor(t, e = new Headers(), r = void 0) {
|
|
173
|
+
var n, s;
|
|
174
|
+
this.url = t, this.customHeaders = e, this.credentials = r, this.mustReload = !1;
|
|
175
|
+
let a = "";
|
|
176
|
+
"navigator" in globalThis && (a = (s = (n = globalThis.navigator) == null ? void 0 : n.userAgent) != null ? s : "");
|
|
177
|
+
let o = a.indexOf("Windows") > -1, l = /Chrome|Chromium|Edg|OPR|Brave/.test(a);
|
|
178
|
+
this.chromeWindowsNoCache = !1, o && l && (this.chromeWindowsNoCache = !0);
|
|
179
|
+
}
|
|
180
|
+
getKey() {
|
|
181
|
+
return this.url;
|
|
182
|
+
}
|
|
183
|
+
setHeaders(t) {
|
|
184
|
+
this.customHeaders = t;
|
|
185
|
+
}
|
|
186
|
+
getBytes(t, e, r, n) {
|
|
187
|
+
return g(this, null, function* () {
|
|
188
|
+
let s, a;
|
|
189
|
+
r ? a = r : (s = new AbortController(), a = s.signal);
|
|
190
|
+
let o = new Headers(this.customHeaders);
|
|
191
|
+
o.set("range", `bytes=${t}-${t + e - 1}`);
|
|
192
|
+
let l;
|
|
193
|
+
this.mustReload ? l = "reload" : this.chromeWindowsNoCache && (l = "no-store");
|
|
194
|
+
let c = yield fetch(this.url, { signal: a, cache: l, headers: o, credentials: this.credentials });
|
|
195
|
+
if (t === 0 && c.status === 416) {
|
|
196
|
+
let f = c.headers.get("Content-Range");
|
|
197
|
+
if (!f || !f.startsWith("bytes */")) throw new Error("Missing content-length on 416 response");
|
|
198
|
+
let y = +f.substr(8);
|
|
199
|
+
o.set("range", `bytes=0-${y - 1}`), c = yield fetch(this.url, { signal: a, cache: "reload", headers: o, credentials: this.credentials });
|
|
200
|
+
}
|
|
201
|
+
let d = c.headers.get("Etag");
|
|
202
|
+
if (d != null && d.startsWith("W/") && (d = null), c.status === 416 || n && d && d !== n) throw this.mustReload = !0, new T(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);
|
|
203
|
+
if (c.status >= 300) throw new Error(`Bad response code: ${c.status}`);
|
|
204
|
+
let u = c.headers.get("Content-Length");
|
|
205
|
+
if (c.status === 200 && (!u || +u > e)) throw s && s.abort(), new Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");
|
|
206
|
+
return { data: yield c.arrayBuffer(), etag: d || void 0, cacheControl: c.headers.get("Cache-Control") || void 0, expires: c.headers.get("Expires") || void 0 };
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
h(Z, "FetchSource");
|
|
211
|
+
var q = Z;
|
|
212
|
+
function p(i, t) {
|
|
213
|
+
let e = i.getUint32(t + 4, !0), r = i.getUint32(t + 0, !0);
|
|
214
|
+
return e * F(2, 32) + r;
|
|
215
|
+
}
|
|
216
|
+
h(p, "getUint64");
|
|
217
|
+
function O(i, t) {
|
|
218
|
+
let e = new DataView(i), r = e.getUint8(7);
|
|
219
|
+
if (r > 3) throw new Error(`Archive is spec version ${r} but this library supports up to spec version 3`);
|
|
220
|
+
return { specVersion: r, rootDirectoryOffset: p(e, 8), rootDirectoryLength: p(e, 16), jsonMetadataOffset: p(e, 24), jsonMetadataLength: p(e, 32), leafDirectoryOffset: p(e, 40), leafDirectoryLength: p(e, 48), tileDataOffset: p(e, 56), tileDataLength: p(e, 64), numAddressedTiles: p(e, 72), numTileEntries: p(e, 80), numTileContents: p(e, 88), clustered: e.getUint8(96) === 1, internalCompression: e.getUint8(97), tileCompression: e.getUint8(98), tileType: e.getUint8(99), minZoom: e.getUint8(100), maxZoom: e.getUint8(101), minLon: e.getInt32(102, !0) / 1e7, minLat: e.getInt32(106, !0) / 1e7, maxLon: e.getInt32(110, !0) / 1e7, maxLat: e.getInt32(114, !0) / 1e7, centerZoom: e.getUint8(118), centerLon: e.getInt32(119, !0) / 1e7, centerLat: e.getInt32(123, !0) / 1e7, etag: t };
|
|
221
|
+
}
|
|
222
|
+
h(O, "bytesToHeader");
|
|
223
|
+
function U(i) {
|
|
224
|
+
let t = { buf: new Uint8Array(i), pos: 0 }, e = w(t), r = [], n = 0;
|
|
225
|
+
for (let s = 0; s < e; s++) {
|
|
226
|
+
let a = w(t);
|
|
227
|
+
r.push({ tileId: n + a, offset: 0, length: 0, runLength: 1 }), n += a;
|
|
228
|
+
}
|
|
229
|
+
for (let s = 0; s < e; s++) r[s].runLength = w(t);
|
|
230
|
+
for (let s = 0; s < e; s++) r[s].length = w(t);
|
|
231
|
+
for (let s = 0; s < e; s++) {
|
|
232
|
+
let a = w(t);
|
|
233
|
+
a === 0 && s > 0 ? r[s].offset = r[s - 1].offset + r[s - 1].length : r[s].offset = a - 1;
|
|
234
|
+
}
|
|
235
|
+
return r;
|
|
236
|
+
}
|
|
237
|
+
h(U, "deserializeIndex");
|
|
238
|
+
var R = class extends Error {
|
|
239
|
+
};
|
|
240
|
+
h(R, "EtagMismatch");
|
|
241
|
+
var T = R;
|
|
242
|
+
function C(i, t) {
|
|
243
|
+
return g(this, null, function* () {
|
|
244
|
+
let e = yield i.getBytes(0, 16384);
|
|
245
|
+
if (new DataView(e.data).getUint16(0, !0) !== 19792) throw new Error("Wrong magic number for PMTiles archive");
|
|
246
|
+
let r = e.data.slice(0, J), n = O(r, e.etag), s = e.data.slice(n.rootDirectoryOffset, n.rootDirectoryOffset + n.rootDirectoryLength), a = `${i.getKey()}|${n.etag || ""}|${n.rootDirectoryOffset}|${n.rootDirectoryLength}`, o = U(yield t(s, n.internalCompression));
|
|
247
|
+
return [n, [a, o.length, o]];
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
h(C, "getHeaderAndRoot");
|
|
251
|
+
function E(i, t, e, r, n, s) {
|
|
252
|
+
return g(this, null, function* () {
|
|
253
|
+
let a = yield i.getBytes(e, r, s, n.etag), o = yield t(a.data, n.internalCompression), l = U(o);
|
|
254
|
+
if (l.length === 0) throw new Error("Empty directory is invalid");
|
|
255
|
+
return l;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
h(E, "getDirectory");
|
|
259
|
+
var Q = class {
|
|
260
|
+
constructor(t = 100, e = !0, r = x) {
|
|
261
|
+
this.cache = /* @__PURE__ */ new Map(), this.maxCacheEntries = t, this.counter = 1, this.decompress = r;
|
|
262
|
+
}
|
|
263
|
+
getHeader(t) {
|
|
264
|
+
return g(this, null, function* () {
|
|
265
|
+
let e = t.getKey(), r = this.cache.get(e);
|
|
266
|
+
if (r) return r.lastUsed = this.counter++, r.data;
|
|
267
|
+
let n = yield C(t, this.decompress);
|
|
268
|
+
return n[1] && this.cache.set(n[1][0], { lastUsed: this.counter++, data: n[1][2] }), this.cache.set(e, { lastUsed: this.counter++, data: n[0] }), this.prune(), n[0];
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
getDirectory(t, e, r, n, s) {
|
|
272
|
+
return g(this, null, function* () {
|
|
273
|
+
let a = `${t.getKey()}|${n.etag || ""}|${e}|${r}`, o = this.cache.get(a);
|
|
274
|
+
if (o) return o.lastUsed = this.counter++, o.data;
|
|
275
|
+
let l = yield E(t, this.decompress, e, r, n, s);
|
|
276
|
+
return this.cache.set(a, { lastUsed: this.counter++, data: l }), this.prune(), l;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
prune() {
|
|
280
|
+
if (this.cache.size > this.maxCacheEntries) {
|
|
281
|
+
let t = 1 / 0, e;
|
|
282
|
+
this.cache.forEach((r, n) => {
|
|
283
|
+
r.lastUsed < t && (t = r.lastUsed, e = n);
|
|
284
|
+
}), e && this.cache.delete(e);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
invalidate(t) {
|
|
288
|
+
return g(this, null, function* () {
|
|
289
|
+
this.cache.delete(t.getKey());
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
h(Q, "ResolvedValueCache");
|
|
294
|
+
var B = class {
|
|
295
|
+
constructor(t = 100, e = !0, r = x) {
|
|
296
|
+
this.cache = /* @__PURE__ */ new Map(), this.invalidations = /* @__PURE__ */ new Map(), this.pendingFetches = /* @__PURE__ */ new Map(), this.maxCacheEntries = t, this.counter = 1, this.decompress = r;
|
|
297
|
+
}
|
|
298
|
+
getHeader(t) {
|
|
299
|
+
return g(this, null, function* () {
|
|
300
|
+
let e = t.getKey(), r = this.cache.get(e);
|
|
301
|
+
if (r) return r.lastUsed = this.counter++, yield r.data;
|
|
302
|
+
let n = new Promise((s, a) => {
|
|
303
|
+
C(t, this.decompress).then((o) => {
|
|
304
|
+
o[1] && this.cache.set(o[1][0], { lastUsed: this.counter++, data: Promise.resolve(o[1][2]) }), s(o[0]), this.prune();
|
|
305
|
+
}).catch((o) => {
|
|
306
|
+
a(o);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
return this.cache.set(e, { lastUsed: this.counter++, data: n }), n;
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
trackSignal(t, e, r) {
|
|
313
|
+
e.refs++, r.addEventListener("abort", () => {
|
|
314
|
+
--e.refs <= 0 && this.pendingFetches.get(t) === e && (e.controller.abort(), this.cache.delete(t), this.pendingFetches.delete(t));
|
|
315
|
+
}, { once: !0 });
|
|
316
|
+
}
|
|
317
|
+
getDirectory(t, e, r, n, s) {
|
|
318
|
+
return g(this, null, function* () {
|
|
319
|
+
let a = `${t.getKey()}|${n.etag || ""}|${e}|${r}`, o = this.cache.get(a);
|
|
320
|
+
if (o) {
|
|
321
|
+
o.lastUsed = this.counter++;
|
|
322
|
+
let u = this.pendingFetches.get(a);
|
|
323
|
+
return u && this.trackSignal(a, u, s ?? new AbortController().signal), yield o.data;
|
|
324
|
+
}
|
|
325
|
+
let l = new AbortController(), c = { controller: l, refs: 0 };
|
|
326
|
+
this.trackSignal(a, c, s ?? new AbortController().signal), this.pendingFetches.set(a, c);
|
|
327
|
+
let d = new Promise((u, f) => {
|
|
328
|
+
E(t, this.decompress, e, r, n, l.signal).then((y) => {
|
|
329
|
+
this.pendingFetches.delete(a), u(y), this.prune();
|
|
330
|
+
}).catch((y) => {
|
|
331
|
+
f(y);
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
return this.cache.set(a, { lastUsed: this.counter++, data: d }), d;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
prune() {
|
|
338
|
+
if (this.cache.size >= this.maxCacheEntries) {
|
|
339
|
+
let t = 1 / 0, e;
|
|
340
|
+
this.cache.forEach((r, n) => {
|
|
341
|
+
r.lastUsed < t && (t = r.lastUsed, e = n);
|
|
342
|
+
}), e && this.cache.delete(e);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
invalidate(t) {
|
|
346
|
+
return g(this, null, function* () {
|
|
347
|
+
let e = t.getKey();
|
|
348
|
+
if (this.invalidations.get(e)) return yield this.invalidations.get(e);
|
|
349
|
+
this.cache.delete(t.getKey());
|
|
350
|
+
let r = new Promise((n, s) => {
|
|
351
|
+
this.getHeader(t).then((a) => {
|
|
352
|
+
n(), this.invalidations.delete(e);
|
|
353
|
+
}).catch((a) => {
|
|
354
|
+
s(a);
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
this.invalidations.set(e, r);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
h(B, "SharedPromiseCache");
|
|
362
|
+
var X = B, S = class {
|
|
363
|
+
constructor(t, e, r) {
|
|
364
|
+
typeof t == "string" ? this.source = new q(t) : this.source = t, r ? this.decompress = r : this.decompress = x, e ? this.cache = e : this.cache = new X();
|
|
365
|
+
}
|
|
366
|
+
getHeader() {
|
|
367
|
+
return g(this, null, function* () {
|
|
368
|
+
return yield this.cache.getHeader(this.source);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
getZxyAttempt(t, e, r, n) {
|
|
372
|
+
return g(this, null, function* () {
|
|
373
|
+
let s = H(t, e, r), a = yield this.cache.getHeader(this.source);
|
|
374
|
+
if (n?.throwIfAborted(), t < a.minZoom || t > a.maxZoom) return;
|
|
375
|
+
let o = a.rootDirectoryOffset, l = a.rootDirectoryLength;
|
|
376
|
+
for (let c = 0; c <= 3; c++) {
|
|
377
|
+
let d = yield this.cache.getDirectory(this.source, o, l, a, n);
|
|
378
|
+
n?.throwIfAborted();
|
|
379
|
+
let u = P(d, s);
|
|
380
|
+
if (u) {
|
|
381
|
+
if (u.runLength > 0) {
|
|
382
|
+
let f = yield this.source.getBytes(a.tileDataOffset + u.offset, u.length, n, a.etag);
|
|
383
|
+
return { data: yield this.decompress(f.data, a.tileCompression), cacheControl: f.cacheControl, expires: f.expires };
|
|
384
|
+
}
|
|
385
|
+
o = a.leafDirectoryOffset + u.offset, l = u.length;
|
|
386
|
+
} else return;
|
|
387
|
+
}
|
|
388
|
+
throw new Error("Maximum directory depth exceeded");
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
getZxy(t, e, r, n) {
|
|
392
|
+
return g(this, null, function* () {
|
|
393
|
+
try {
|
|
394
|
+
return yield this.getZxyAttempt(t, e, r, n);
|
|
395
|
+
} catch (s) {
|
|
396
|
+
if (s instanceof T) return this.cache.invalidate(this.source), yield this.getZxyAttempt(t, e, r, n);
|
|
397
|
+
throw s;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
getMetadataAttempt() {
|
|
402
|
+
return g(this, null, function* () {
|
|
403
|
+
let t = yield this.cache.getHeader(this.source), e = yield this.source.getBytes(t.jsonMetadataOffset, t.jsonMetadataLength, void 0, t.etag), r = yield this.decompress(e.data, t.internalCompression), n = new TextDecoder("utf-8");
|
|
404
|
+
return JSON.parse(n.decode(r));
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
getMetadata() {
|
|
408
|
+
return g(this, null, function* () {
|
|
409
|
+
try {
|
|
410
|
+
return yield this.getMetadataAttempt();
|
|
411
|
+
} catch (t) {
|
|
412
|
+
if (t instanceof T) return this.cache.invalidate(this.source), yield this.getMetadataAttempt();
|
|
413
|
+
throw t;
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
getTileJson(t) {
|
|
418
|
+
return g(this, null, function* () {
|
|
419
|
+
let e = yield this.getHeader(), r = yield this.getMetadata(), n = I(e.tileType);
|
|
420
|
+
return { tilejson: "3.0.0", scheme: "xyz", tiles: [`${t}/{z}/{x}/{y}${n}`], vector_layers: r.vector_layers, attribution: r.attribution, description: r.description, name: r.name, version: r.version, bounds: [e.minLon, e.minLat, e.maxLon, e.maxLat], center: [e.centerLon, e.centerLat, e.centerZoom], minzoom: e.minZoom, maxzoom: e.maxZoom };
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
h(S, "PMTiles");
|
|
425
|
+
var M = S;
|
|
426
|
+
export {
|
|
427
|
+
V as Compression,
|
|
428
|
+
T as EtagMismatch,
|
|
429
|
+
q as FetchSource,
|
|
430
|
+
M as PMTiles,
|
|
431
|
+
te as Protocol,
|
|
432
|
+
X as SharedPromiseCache,
|
|
433
|
+
_ as TileType,
|
|
434
|
+
O as bytesToHeader,
|
|
435
|
+
P as findTile,
|
|
436
|
+
p as getUint64,
|
|
437
|
+
w as readVarint,
|
|
438
|
+
N as tileIdToZxy,
|
|
439
|
+
I as tileTypeExt,
|
|
440
|
+
H as zxyToTileId
|
|
441
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { inject as T, computed as t } from "vue";
|
|
2
|
+
import { splitTripMapList as i, parseTripMapHandNodes as h, TRIPMAP_DEFAULT_HEIGHT as M, buildTripMapGeoUrl as x, tripMapPlaybackLabels as b, tripMapUiTexts as f } from "../../../mdx-schema/dist/tripmap.js";
|
|
3
|
+
import { tripMapFormatTime as A } from "../../../mdx-schema/dist/tripmap.js";
|
|
4
|
+
const L = /* @__PURE__ */ Symbol.for("blogmcp:mdx-article-context");
|
|
5
|
+
function U(e) {
|
|
6
|
+
const o = T(L, null), a = t(() => i(e.slugs)), s = t(() => i(e.exclude)), l = t(() => h(e.nodes)), c = t(() => a.value.length === 0), r = t(() => a.value.length === 0 && !o?.filename), p = t(
|
|
7
|
+
() => a.value.map((n) => ({
|
|
8
|
+
slug: n,
|
|
9
|
+
src: `/api/media/thumb/${encodeURIComponent(n)}?width=192`
|
|
10
|
+
}))
|
|
11
|
+
), d = t(() => ({ height: e.height || M })), m = t(() => x(e, o)), u = t(() => b(o?.language)), g = t(() => f(o?.language));
|
|
12
|
+
return {
|
|
13
|
+
slugList: a,
|
|
14
|
+
excludeList: s,
|
|
15
|
+
handNodes: l,
|
|
16
|
+
facadeThumbs: p,
|
|
17
|
+
heightStyle: d,
|
|
18
|
+
articleContext: o,
|
|
19
|
+
isAutoMode: c,
|
|
20
|
+
isConfigOnly: r,
|
|
21
|
+
geoUrl: m,
|
|
22
|
+
labels: u,
|
|
23
|
+
texts: g
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
L as MDX_ARTICLE_CONTEXT_KEY,
|
|
28
|
+
h as parseHandNodes,
|
|
29
|
+
A as tripMapFormatTime,
|
|
30
|
+
U as useTripMap
|
|
31
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent as u, computed as m, createElementBlock as e, openBlock as t, createElementVNode as o, toDisplayString as n, createCommentVNode as y, Fragment as a, createTextVNode as s } from "vue";
|
|
2
|
+
import { parseTripMapHandNodes as g } from "../../../mdx-schema/dist/tripmap.js";
|
|
3
|
+
const f = {
|
|
4
|
+
class: "flex items-center gap-3 rounded-lg border border-blue-500/40 bg-blue-500/5 px-3 py-2",
|
|
5
|
+
"data-mdx-component": "TripMap"
|
|
6
|
+
}, h = { class: "font-medium" }, x = { class: "text-sm opacity-70" }, k = /* @__PURE__ */ u({
|
|
7
|
+
__name: "TripMapEdit",
|
|
8
|
+
props: {
|
|
9
|
+
slugs: {},
|
|
10
|
+
exclude: {},
|
|
11
|
+
nodes: {},
|
|
12
|
+
height: {},
|
|
13
|
+
line: { type: Boolean },
|
|
14
|
+
filmstrip: { type: Boolean },
|
|
15
|
+
playback: { type: Boolean },
|
|
16
|
+
cluster: { type: Boolean },
|
|
17
|
+
theme: {},
|
|
18
|
+
styleUrl: {},
|
|
19
|
+
center: {},
|
|
20
|
+
zoom: {},
|
|
21
|
+
title: {}
|
|
22
|
+
},
|
|
23
|
+
setup(l) {
|
|
24
|
+
const r = l, p = m(() => (r.slugs ?? "").split(",").filter((d) => d.trim()).length), i = m(() => g(r.nodes).length);
|
|
25
|
+
return (d, c) => (t(), e("div", f, [
|
|
26
|
+
c[0] || (c[0] = o("span", { "aria-hidden": "true" }, "🗺", -1)),
|
|
27
|
+
o("span", h, n(l.title || "TripMap"), 1),
|
|
28
|
+
o("span", x, [
|
|
29
|
+
p.value > 0 ? (t(), e(a, { key: 0 }, [
|
|
30
|
+
s(n(p.value) + " photos", 1)
|
|
31
|
+
], 64)) : (t(), e(a, { key: 1 }, [
|
|
32
|
+
s("auto (article media)")
|
|
33
|
+
], 64)),
|
|
34
|
+
i.value > 0 ? (t(), e(a, { key: 2 }, [
|
|
35
|
+
s(" · " + n(i.value) + " waypoints", 1)
|
|
36
|
+
], 64)) : y("", !0)
|
|
37
|
+
])
|
|
38
|
+
]));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
k as default
|
|
43
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineAsyncComponent as m, defineComponent as u, h as
|
|
2
|
-
import { componentMetadata as
|
|
3
|
-
import { getComponentMetadata as
|
|
1
|
+
import { defineAsyncComponent as m, defineComponent as u, h as b } from "vue";
|
|
2
|
+
import { componentMetadata as f } from "../../mdx-schema/dist/metadata/index.js";
|
|
3
|
+
import { getComponentMetadata as N, getComponentNames as W } from "../../mdx-schema/dist/metadata/index.js";
|
|
4
4
|
import { prepareProps as g } from "../../mdx-schema/dist/prepareProps.js";
|
|
5
5
|
import "../../../_virtual/index3.js";
|
|
6
6
|
const s = "__mdxPreparePropsAppliedFor", C = {
|
|
@@ -82,9 +82,16 @@ const s = "__mdxPreparePropsAppliedFor", C = {
|
|
|
82
82
|
default: () => import("./render/tooltip/Tooltip.vue.js")
|
|
83
83
|
},
|
|
84
84
|
edit: () => import("./edit/TooltipEdit.vue.js")
|
|
85
|
+
},
|
|
86
|
+
TripMap: {
|
|
87
|
+
editor: { icon: "map", color: "#3b82f6", borderColor: "#3b82f6", bgColor: "rgba(59, 130, 246, 0.08)" },
|
|
88
|
+
render: {
|
|
89
|
+
default: () => import("./render/tripmap/TripMapDefault.vue2.js")
|
|
90
|
+
},
|
|
91
|
+
edit: () => import("./edit/TripMapEdit.vue2.js")
|
|
85
92
|
}
|
|
86
93
|
}, d = Object.fromEntries(
|
|
87
|
-
|
|
94
|
+
f.map((o) => {
|
|
88
95
|
const r = C[o.name];
|
|
89
96
|
if (!r)
|
|
90
97
|
throw new Error(
|
|
@@ -93,11 +100,11 @@ const s = "__mdxPreparePropsAppliedFor", C = {
|
|
|
93
100
|
return [o.name, { metadata: o, ...r }];
|
|
94
101
|
})
|
|
95
102
|
);
|
|
96
|
-
function
|
|
103
|
+
function M(o) {
|
|
97
104
|
const r = d[o];
|
|
98
105
|
return r ? Object.keys(r.render) : [];
|
|
99
106
|
}
|
|
100
|
-
async function
|
|
107
|
+
async function P(o, r = "default") {
|
|
101
108
|
const e = d[o];
|
|
102
109
|
if (!e) return;
|
|
103
110
|
const t = e.render[r] || e.render.default;
|
|
@@ -108,7 +115,7 @@ function y(o, r, e = "default") {
|
|
|
108
115
|
name: `MdxPrepared${r.name}${e === "default" ? "" : `_${e}`}`,
|
|
109
116
|
inheritAttrs: !1,
|
|
110
117
|
setup(n, { attrs: i, slots: c }) {
|
|
111
|
-
return () =>
|
|
118
|
+
return () => b(
|
|
112
119
|
o,
|
|
113
120
|
g(i, r),
|
|
114
121
|
c
|
|
@@ -117,21 +124,21 @@ function y(o, r, e = "default") {
|
|
|
117
124
|
});
|
|
118
125
|
return t[s] = r.name, t;
|
|
119
126
|
}
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
const e = `${o}:${r}`, t =
|
|
127
|
+
const p = /* @__PURE__ */ new Map();
|
|
128
|
+
function R(o, r = "default") {
|
|
129
|
+
const e = `${o}:${r}`, t = p.get(e);
|
|
123
130
|
if (t) return t;
|
|
124
131
|
const n = d[o];
|
|
125
132
|
if (!n) return;
|
|
126
133
|
const i = n.render[r] || n.render.default;
|
|
127
134
|
if (!i) return;
|
|
128
|
-
const c = m(() => i().then((
|
|
129
|
-
return
|
|
135
|
+
const c = m(() => i().then((l) => l.default)), a = y(c, n.metadata, r);
|
|
136
|
+
return p.set(e, a), a;
|
|
130
137
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
138
|
+
function _() {
|
|
139
|
+
p.clear();
|
|
133
140
|
}
|
|
134
|
-
async function
|
|
141
|
+
async function x(o) {
|
|
135
142
|
const r = d[o];
|
|
136
143
|
return r ? (await r.edit()).default : void 0;
|
|
137
144
|
}
|
|
@@ -140,15 +147,15 @@ function $(o) {
|
|
|
140
147
|
}
|
|
141
148
|
export {
|
|
142
149
|
s as MDX_PREPARED_SENTINEL,
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
_ as _resetWrappedRenderCacheForTests,
|
|
151
|
+
f as componentMetadata,
|
|
145
152
|
d as componentRegistry,
|
|
146
|
-
|
|
153
|
+
N as getComponentMetadata,
|
|
147
154
|
W as getComponentNames,
|
|
148
|
-
|
|
149
|
-
|
|
155
|
+
M as getComponentVariants,
|
|
156
|
+
x as getEditComponentAsync,
|
|
150
157
|
$ as getEditorConfig,
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
P as getRenderComponentAsync,
|
|
159
|
+
R as getWrappedRenderComponent,
|
|
153
160
|
y as wrapVueComponentForMdx
|
|
154
161
|
};
|