@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,169 @@
|
|
|
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";
|
|
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({
|
|
6
|
+
__name: "TripMapDefault",
|
|
7
|
+
props: {
|
|
8
|
+
slugs: {},
|
|
9
|
+
exclude: {},
|
|
10
|
+
nodes: {},
|
|
11
|
+
height: {},
|
|
12
|
+
line: { type: Boolean, default: !0 },
|
|
13
|
+
filmstrip: { type: Boolean, default: !0 },
|
|
14
|
+
playback: { type: Boolean, default: !0 },
|
|
15
|
+
cluster: { type: Boolean, default: !0 },
|
|
16
|
+
theme: { default: "auto" },
|
|
17
|
+
styleUrl: {},
|
|
18
|
+
center: {},
|
|
19
|
+
zoom: {},
|
|
20
|
+
title: {}
|
|
21
|
+
},
|
|
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() {
|
|
26
|
+
try {
|
|
27
|
+
const t = await fetch(z.value, { headers: { accept: "application/json" } });
|
|
28
|
+
if (!t.ok) throw new Error(`media/geo ${t.status}`);
|
|
29
|
+
return await t.json();
|
|
30
|
+
} catch (t) {
|
|
31
|
+
if (S.value) return { nodes: [] };
|
|
32
|
+
throw t;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function M() {
|
|
36
|
+
if (!w) {
|
|
37
|
+
w = !0, i.value = "loading";
|
|
38
|
+
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";
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
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(),
|
|
64
|
+
events: {}
|
|
65
|
+
});
|
|
66
|
+
N.setNodes(y), await N.init(), T = () => N.destroy(), i.value = "live";
|
|
67
|
+
} catch {
|
|
68
|
+
i.value = w && i.value === "loading" ? "facade" : i.value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
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
|
+
}
|
|
78
|
+
return V(() => {
|
|
79
|
+
const t = x.value;
|
|
80
|
+
if (t) {
|
|
81
|
+
if (typeof IntersectionObserver > "u") {
|
|
82
|
+
M();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
m = new IntersectionObserver(
|
|
86
|
+
(o) => {
|
|
87
|
+
o.some((l) => l.isIntersecting) && (m?.disconnect(), m = null, M());
|
|
88
|
+
},
|
|
89
|
+
{ rootMargin: "300px" }
|
|
90
|
+
), m.observe(t);
|
|
91
|
+
}
|
|
92
|
+
}), L(() => {
|
|
93
|
+
m?.disconnect(), T?.();
|
|
94
|
+
}), (t, o) => (u(), n("div", {
|
|
95
|
+
ref_key: "rootEl",
|
|
96
|
+
ref: x,
|
|
97
|
+
class: a(e(r).container),
|
|
98
|
+
"data-mdx-component": "TripMap",
|
|
99
|
+
"aria-label": v.title
|
|
100
|
+
}, [
|
|
101
|
+
v.title ? (u(), n("p", {
|
|
102
|
+
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", {
|
|
106
|
+
key: 1,
|
|
107
|
+
class: a(e(r).strip)
|
|
108
|
+
}, [
|
|
109
|
+
(u(!0), n(B, null, E(e(U), (l) => (u(), n("li", {
|
|
110
|
+
key: l.slug,
|
|
111
|
+
class: a(e(r).stripItem)
|
|
112
|
+
}, [
|
|
113
|
+
d("img", {
|
|
114
|
+
src: l.src,
|
|
115
|
+
alt: "",
|
|
116
|
+
width: "80",
|
|
117
|
+
height: "80",
|
|
118
|
+
loading: "lazy",
|
|
119
|
+
decoding: "async",
|
|
120
|
+
class: a(e(r).stripImg)
|
|
121
|
+
}, null, 10, G)
|
|
122
|
+
], 2))), 128))
|
|
123
|
+
], 2)) : p("", !0),
|
|
124
|
+
d("div", {
|
|
125
|
+
class: a(e(r).mapWrap),
|
|
126
|
+
style: P(e(F))
|
|
127
|
+
}, [
|
|
128
|
+
d("div", {
|
|
129
|
+
ref_key: "mapEl",
|
|
130
|
+
ref: k,
|
|
131
|
+
class: "absolute inset-0"
|
|
132
|
+
}, null, 512),
|
|
133
|
+
i.value !== "live" ? (u(), n("div", {
|
|
134
|
+
key: 0,
|
|
135
|
+
class: a([e(r).mapOverlay])
|
|
136
|
+
}, [
|
|
137
|
+
d("div", {
|
|
138
|
+
class: a(e(r).mapBox)
|
|
139
|
+
}, [
|
|
140
|
+
d("span", {
|
|
141
|
+
class: a(e(r).mapHint)
|
|
142
|
+
}, f(i.value === "empty" ? e(b).empty : e(b).hint), 3)
|
|
143
|
+
], 2)
|
|
144
|
+
], 2)) : p("", !0)
|
|
145
|
+
], 6),
|
|
146
|
+
e(h).length && i.value !== "live" ? (u(), n("ol", {
|
|
147
|
+
key: 2,
|
|
148
|
+
class: a(e(r).stopList)
|
|
149
|
+
}, [
|
|
150
|
+
(u(!0), n(B, null, E(e(h), (l, y) => (u(), n("li", {
|
|
151
|
+
key: l.id || y
|
|
152
|
+
}, [
|
|
153
|
+
l.capturedAt ? (u(), n("span", {
|
|
154
|
+
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)
|
|
158
|
+
]))), 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));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export {
|
|
168
|
+
K as default
|
|
169
|
+
};
|
|
@@ -1,70 +1,74 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
1
|
+
const d = /<[A-Z][a-zA-Z]*[\s/>]/, A = /<([A-Z][a-zA-Z]*)\s*([^>]*)>([\s\S]*?)<\/\1>|<([A-Z][a-zA-Z]*)\s*((?:[^/]|\/(?!>))*)\/>/g;
|
|
2
|
+
function g(t, i) {
|
|
3
|
+
if (t[i] !== "{")
|
|
4
4
|
return null;
|
|
5
|
-
let e = 0,
|
|
6
|
-
for (let
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
if (
|
|
10
|
-
|
|
5
|
+
let e = 0, n = null;
|
|
6
|
+
for (let u = i; u < t.length; u++) {
|
|
7
|
+
const s = t[u];
|
|
8
|
+
if (n) {
|
|
9
|
+
if (s === "\\") {
|
|
10
|
+
u++;
|
|
11
11
|
continue;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
s === n && (n = null);
|
|
14
14
|
continue;
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
if (s === '"' || s === "'") {
|
|
17
|
+
n = s;
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
20
|
+
if (s === "{") {
|
|
21
21
|
e++;
|
|
22
22
|
continue;
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
25
|
-
return { content:
|
|
24
|
+
if (s === "}" && (e--, e === 0))
|
|
25
|
+
return { content: t.slice(i + 1, u), endIndex: u + 1 };
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function x(t) {
|
|
30
30
|
const i = {};
|
|
31
|
-
if (!
|
|
31
|
+
if (!t.trim())
|
|
32
32
|
return i;
|
|
33
33
|
let e = 0;
|
|
34
|
-
const
|
|
35
|
-
for (; e <
|
|
36
|
-
for (; e <
|
|
34
|
+
const n = t;
|
|
35
|
+
for (; e < n.length; ) {
|
|
36
|
+
for (; e < n.length && /\s/.test(n[e]); )
|
|
37
37
|
e++;
|
|
38
|
-
if (e >=
|
|
38
|
+
if (e >= n.length)
|
|
39
39
|
break;
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
40
|
+
const u = n.slice(e).match(/^(\w+)/);
|
|
41
|
+
if (!u) {
|
|
42
42
|
e++;
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
for (e +=
|
|
45
|
+
const s = u[1];
|
|
46
|
+
for (e += s.length; e < n.length && /\s/.test(n[e]); )
|
|
47
47
|
e++;
|
|
48
|
-
if (
|
|
49
|
-
i[
|
|
48
|
+
if (n[e] !== "=") {
|
|
49
|
+
i[s] = !0;
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
for (e++; e <
|
|
52
|
+
for (e++; e < n.length && /\s/.test(n[e]); )
|
|
53
53
|
e++;
|
|
54
|
-
if (
|
|
55
|
-
const l =
|
|
54
|
+
if (n[e] === '"') {
|
|
55
|
+
const l = n.indexOf('"', e + 1);
|
|
56
56
|
if (l === -1) {
|
|
57
|
-
i[
|
|
57
|
+
i[s] = "";
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
|
-
i[
|
|
61
|
-
} else if (
|
|
62
|
-
const l =
|
|
60
|
+
i[s] = n.slice(e + 1, l), e = l + 1;
|
|
61
|
+
} else if (n[e] === "{") {
|
|
62
|
+
const l = g(n, e);
|
|
63
63
|
if (l) {
|
|
64
64
|
try {
|
|
65
|
-
i[
|
|
65
|
+
i[s] = JSON.parse(l.content);
|
|
66
66
|
} catch {
|
|
67
|
-
|
|
67
|
+
try {
|
|
68
|
+
i[s] = JSON.parse(l.content.replace(/'/g, '"'));
|
|
69
|
+
} catch {
|
|
70
|
+
i[s] = l.content;
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
e = l.endIndex;
|
|
70
74
|
} else
|
|
@@ -74,66 +78,312 @@ function h(n) {
|
|
|
74
78
|
}
|
|
75
79
|
return i;
|
|
76
80
|
}
|
|
77
|
-
function
|
|
81
|
+
function O(t) {
|
|
78
82
|
const i = [];
|
|
79
|
-
for (const [e,
|
|
80
|
-
|
|
83
|
+
for (const [e, n] of Object.entries(t))
|
|
84
|
+
n != null && (n === !0 ? i.push(e) : typeof n == "string" ? i.push(n.includes('"') ? `${e}={${JSON.stringify(n)}}` : `${e}="${n}"`) : typeof n == "number" ? i.push(`${e}={${n}}`) : typeof n == "boolean" ? i.push(`${e}={${n}}`) : i.push(`${e}={${JSON.stringify(n)}}`));
|
|
81
85
|
return i.join(" ");
|
|
82
86
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
return e ? `<${
|
|
87
|
+
function b(t, i, e) {
|
|
88
|
+
const n = O(i), u = n ? ` ${n}` : "";
|
|
89
|
+
return e ? `<${t}${u}>
|
|
86
90
|
${e}
|
|
87
|
-
</${
|
|
91
|
+
</${t}>` : `<${t}${u} />`;
|
|
88
92
|
}
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
91
|
-
const i =
|
|
93
|
+
function _(t) {
|
|
94
|
+
if (t.startsWith("---")) {
|
|
95
|
+
const i = t.indexOf("---", 3);
|
|
92
96
|
if (i !== -1)
|
|
93
|
-
return
|
|
97
|
+
return t.substring(i + 3).trim();
|
|
94
98
|
}
|
|
95
|
-
return
|
|
99
|
+
return t;
|
|
96
100
|
}
|
|
97
|
-
function
|
|
98
|
-
if (
|
|
99
|
-
const i =
|
|
101
|
+
function Z(t) {
|
|
102
|
+
if (t.startsWith("---")) {
|
|
103
|
+
const i = t.indexOf("---", 3);
|
|
100
104
|
if (i !== -1)
|
|
101
|
-
return
|
|
105
|
+
return t.substring(3, i).trim();
|
|
102
106
|
}
|
|
103
107
|
return null;
|
|
104
108
|
}
|
|
105
|
-
function
|
|
106
|
-
if (!
|
|
107
|
-
return
|
|
108
|
-
const i =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
function M(t) {
|
|
110
|
+
if (!t || !t.startsWith("---"))
|
|
111
|
+
return 0;
|
|
112
|
+
const i = t.indexOf("---", 3);
|
|
113
|
+
if (i === -1)
|
|
114
|
+
return 0;
|
|
115
|
+
const e = i + 3, n = t.slice(e);
|
|
116
|
+
return e + (n.length - n.trimStart().length);
|
|
117
|
+
}
|
|
118
|
+
function z(t, i) {
|
|
119
|
+
if (i <= 0)
|
|
120
|
+
return 1;
|
|
121
|
+
const e = Math.min(i, t.length);
|
|
122
|
+
let n = 1;
|
|
123
|
+
for (let u = 0; u < e; u++)
|
|
124
|
+
t[u] === `
|
|
125
|
+
` && n++;
|
|
126
|
+
return n;
|
|
127
|
+
}
|
|
128
|
+
const m = 0, E = 1, w = 2, y = /^ {0,3}(`{3,}|~{3,})(.*)$/, S = /^ {0,3}(`{3,}|~{3,})[ \t]*$/;
|
|
129
|
+
function $(t) {
|
|
130
|
+
const i = new Uint8Array(t.length);
|
|
131
|
+
if (!t || !t.includes("`") && !t.includes("~"))
|
|
132
|
+
return i;
|
|
133
|
+
const e = [], n = [];
|
|
134
|
+
for (let l = 0; l <= t.length; ) {
|
|
135
|
+
const o = t.indexOf(`
|
|
136
|
+
`, l);
|
|
137
|
+
if (e.push(l), n.push(o === -1 ? t.length : o), o === -1)
|
|
138
|
+
break;
|
|
139
|
+
l = o + 1;
|
|
140
|
+
}
|
|
141
|
+
const u = (l) => {
|
|
142
|
+
const o = t.slice(e[l], n[l]);
|
|
143
|
+
return o.endsWith("\r") ? o.slice(0, -1) : o;
|
|
144
|
+
}, s = new Array(e.length).fill(!1);
|
|
145
|
+
for (let l = 0; l < e.length; ) {
|
|
146
|
+
const o = y.exec(u(l));
|
|
147
|
+
if (!o) {
|
|
148
|
+
l++;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const c = o[1], f = c[0];
|
|
152
|
+
if (f === "`" && o[2].includes("`")) {
|
|
153
|
+
l++;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
let r = -1;
|
|
157
|
+
for (let h = l + 1; h < e.length; h++) {
|
|
158
|
+
const a = S.exec(u(h));
|
|
159
|
+
if (a && a[1][0] === f && a[1].length >= c.length) {
|
|
160
|
+
r = h;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (r === -1) {
|
|
165
|
+
l++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
i.fill(E, e[l], n[r]);
|
|
169
|
+
for (let h = l; h <= r; h++)
|
|
170
|
+
s[h] = !0;
|
|
171
|
+
l = r + 1;
|
|
172
|
+
}
|
|
173
|
+
for (let l = 0; l < e.length; l++) {
|
|
174
|
+
if (s[l])
|
|
175
|
+
continue;
|
|
176
|
+
const o = e[l], c = n[l];
|
|
177
|
+
let f = o;
|
|
178
|
+
for (; f < c; ) {
|
|
179
|
+
if (t[f] !== "`") {
|
|
180
|
+
f++;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
let r = 0;
|
|
184
|
+
for (; f + r < c && t[f + r] === "`"; )
|
|
185
|
+
r++;
|
|
186
|
+
if (r >= 3 && t.slice(o, f).trim() === "") {
|
|
187
|
+
f += r;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
let h = f + r, a = -1;
|
|
191
|
+
for (; h < c; ) {
|
|
192
|
+
if (t[h] !== "`") {
|
|
193
|
+
h++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
let p = 0;
|
|
197
|
+
for (; h + p < c && t[h + p] === "`"; )
|
|
198
|
+
p++;
|
|
199
|
+
if (p === r) {
|
|
200
|
+
a = h;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
h += p;
|
|
204
|
+
}
|
|
205
|
+
if (a === -1) {
|
|
206
|
+
f += r;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
i.fill(w, f, a + r), f = a + r;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return i;
|
|
213
|
+
}
|
|
214
|
+
function k(t, i) {
|
|
215
|
+
if (t[i] !== "<")
|
|
216
|
+
return null;
|
|
217
|
+
const e = t[i + 1];
|
|
218
|
+
if (e === void 0 || e < "A" || e > "Z")
|
|
219
|
+
return null;
|
|
220
|
+
let n = i + 2;
|
|
221
|
+
for (; n < t.length && /[a-zA-Z]/.test(t[n]); )
|
|
222
|
+
n++;
|
|
223
|
+
const u = t.slice(i + 1, n), s = t[n];
|
|
224
|
+
if (s === void 0 || s !== ">" && s !== "/" && !/\s/.test(s))
|
|
225
|
+
return null;
|
|
226
|
+
for (; n < t.length && /\s/.test(t[n]); )
|
|
227
|
+
n++;
|
|
228
|
+
const l = n, o = (f) => {
|
|
229
|
+
let r = f + 1;
|
|
230
|
+
for (; r < t.length && (t[r] === " " || t[r] === " " || t[r] === "\r"); )
|
|
231
|
+
r++;
|
|
232
|
+
return r >= t.length || t[r] === `
|
|
233
|
+
`;
|
|
234
|
+
};
|
|
235
|
+
let c = null;
|
|
236
|
+
for (; n < t.length; ) {
|
|
237
|
+
const f = t[n];
|
|
238
|
+
if (c) {
|
|
239
|
+
if (f === `
|
|
240
|
+
` && o(n))
|
|
241
|
+
return null;
|
|
242
|
+
f === c && (c = null), n++;
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
if (f === '"' || f === "'") {
|
|
246
|
+
c = f, n++;
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (f === "{") {
|
|
250
|
+
const r = g(t, n);
|
|
251
|
+
if (!r)
|
|
252
|
+
return null;
|
|
253
|
+
n = r.endIndex;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (f === "/" && t[n + 1] === ">")
|
|
257
|
+
return { name: u, propsSource: t.slice(l, n), tagEnd: n + 2, selfClosing: !0 };
|
|
258
|
+
if (f === ">")
|
|
259
|
+
return { name: u, propsSource: t.slice(l, n), tagEnd: n + 1, selfClosing: !1 };
|
|
260
|
+
if (f === "<")
|
|
261
|
+
return null;
|
|
262
|
+
if (f === `
|
|
263
|
+
`) {
|
|
264
|
+
if (o(n)) {
|
|
265
|
+
let r = n - 1;
|
|
266
|
+
for (; r >= i && /\s/.test(t[r]); )
|
|
267
|
+
r--;
|
|
268
|
+
if (t[r] === "=")
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
n++;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
n++;
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
function C(t, i, e, n, u) {
|
|
279
|
+
const s = `</${i}`;
|
|
280
|
+
let l = null;
|
|
281
|
+
const o = u?.has(i) ?? !1, c = (r) => {
|
|
282
|
+
const h = `<${i}`;
|
|
283
|
+
let a = t.indexOf(h, e);
|
|
284
|
+
for (; a !== -1 && a < r; ) {
|
|
285
|
+
const p = t[a + h.length];
|
|
286
|
+
if (p === void 0 || !/[a-zA-Z]/.test(p))
|
|
287
|
+
return !0;
|
|
288
|
+
a = t.indexOf(h, a + 1);
|
|
289
|
+
}
|
|
290
|
+
return !1;
|
|
291
|
+
};
|
|
292
|
+
let f = e;
|
|
293
|
+
for (; f < t.length; ) {
|
|
294
|
+
const r = t.indexOf(s, f);
|
|
295
|
+
if (r === -1)
|
|
296
|
+
break;
|
|
297
|
+
let h = r + s.length;
|
|
298
|
+
for (; h < t.length && /\s/.test(t[h]); )
|
|
299
|
+
h++;
|
|
300
|
+
if (t[h] === ">") {
|
|
301
|
+
const a = { start: r, end: h + 1 };
|
|
302
|
+
if (n[r] === m && !c(r))
|
|
303
|
+
return a;
|
|
304
|
+
if (!l && (l = a, o))
|
|
305
|
+
return l;
|
|
306
|
+
}
|
|
307
|
+
f = r + s.length;
|
|
308
|
+
}
|
|
309
|
+
return l && u?.add(i), l;
|
|
310
|
+
}
|
|
311
|
+
function N(t) {
|
|
312
|
+
if (!t)
|
|
313
|
+
return [];
|
|
314
|
+
if (!d.test(t))
|
|
315
|
+
return [{ type: "html", content: t, start: 0, end: t.length }];
|
|
316
|
+
const i = $(t), e = [], n = /* @__PURE__ */ new Set();
|
|
317
|
+
let u = 0, s = 0, l = !1;
|
|
318
|
+
for (; s < t.length; ) {
|
|
319
|
+
const o = t.indexOf("<", s);
|
|
320
|
+
if (o === -1)
|
|
321
|
+
break;
|
|
322
|
+
if (i[o] !== m) {
|
|
323
|
+
s = o + 1;
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const c = k(t, o);
|
|
327
|
+
if (!c) {
|
|
328
|
+
s = o + 1;
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
if (i[c.tagEnd - 1] === E) {
|
|
332
|
+
s = o + 1;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
let f, r;
|
|
336
|
+
if (c.selfClosing)
|
|
337
|
+
f = c.tagEnd;
|
|
338
|
+
else {
|
|
339
|
+
const h = C(t, c.name, c.tagEnd, i, n);
|
|
340
|
+
if (!h) {
|
|
341
|
+
s = c.tagEnd;
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
r = t.slice(c.tagEnd, h.start).trim(), f = h.end;
|
|
345
|
+
}
|
|
346
|
+
if (o > u) {
|
|
347
|
+
const h = t.slice(u, o);
|
|
348
|
+
h.trim() && e.push({ type: "html", content: h, start: u, end: o });
|
|
349
|
+
}
|
|
116
350
|
e.push({
|
|
117
351
|
type: "component",
|
|
118
|
-
name:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
352
|
+
name: c.name,
|
|
353
|
+
propsSource: c.propsSource,
|
|
354
|
+
props: x(c.propsSource),
|
|
355
|
+
children: r,
|
|
356
|
+
start: o,
|
|
357
|
+
end: f
|
|
358
|
+
}), l = !0, u = f, s = f;
|
|
122
359
|
}
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
|
|
360
|
+
if (u < t.length) {
|
|
361
|
+
const o = t.slice(u);
|
|
362
|
+
o.trim() && e.push({ type: "html", content: o, start: u, end: t.length });
|
|
126
363
|
}
|
|
127
|
-
return
|
|
364
|
+
return l ? e : t.trim() ? [{ type: "html", content: t, start: 0, end: t.length }] : [];
|
|
365
|
+
}
|
|
366
|
+
function I(t) {
|
|
367
|
+
if (!d.test(t))
|
|
368
|
+
return [{ type: "html", content: t }];
|
|
369
|
+
const i = N(t).map((e) => e.type === "html" ? { type: "html", content: e.content } : { type: "component", name: e.name, props: e.props, children: e.children });
|
|
370
|
+
return i.length === 0 && t.trim() ? [{ type: "html", content: t }] : i;
|
|
128
371
|
}
|
|
129
372
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
373
|
+
E as CODE_FENCE,
|
|
374
|
+
w as CODE_INLINE,
|
|
375
|
+
m as CODE_NONE,
|
|
376
|
+
d as HAS_MDX_RE,
|
|
377
|
+
A as MDX_COMPONENT_PATTERN,
|
|
378
|
+
M as computeBodyOffset,
|
|
379
|
+
$ as computeCodeMask,
|
|
380
|
+
g as extractBraceExpression,
|
|
381
|
+
Z as extractFrontmatter,
|
|
382
|
+
I as extractMdxComponents,
|
|
383
|
+
z as lineAtOffset,
|
|
384
|
+
x as parseJsxProps,
|
|
385
|
+
N as scanMdxNodes,
|
|
386
|
+
b as serializeComponent,
|
|
387
|
+
O as serializeProps,
|
|
388
|
+
_ as stripFrontmatter
|
|
139
389
|
};
|