tempest-react-sdk 0.76.0 → 0.78.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.
- package/README.md +2 -2
- package/bin/create-tempest-app.e2e.test.mjs +112 -0
- package/bin/create-tempest-app.mjs +69 -28
- package/bin/lib/alias/collect.mjs +20 -3
- package/bin/lib/alias/index.mjs +12 -1
- package/bin/lib/alias/index.test.mjs +24 -0
- package/bin/lib/component/generate.mjs +191 -0
- package/bin/lib/component/generate.test.mjs +336 -0
- package/bin/lib/css/analyze.test.mjs +21 -1
- package/bin/lib/css/collect.mjs +14 -0
- package/bin/lib/css/extract.mjs +63 -5
- package/bin/lib/css/extract.test.mjs +110 -1
- package/bin/lib/css/fix.e2e.test.mjs +50 -0
- package/bin/lib/css/index.mjs +6 -1
- package/bin/lib/fs/contain.mjs +50 -0
- package/bin/lib/icons/generate.mjs +28 -3
- package/bin/lib/icons/generate.test.mjs +57 -1
- package/bin/lib/openapi/escape.mjs +224 -0
- package/bin/lib/openapi/generate.encode.test.mjs +120 -0
- package/bin/lib/openapi/generate.hostile.test.mjs +621 -0
- package/bin/lib/openapi/generate.mjs +129 -18
- package/bin/lib/openapi/generate.test.mjs +7 -2
- package/bin/lib/openapi/schema-to-zod.mjs +43 -4
- package/bin/tempest-gen.test.mjs +188 -0
- package/bin/tempest.mjs +263 -6
- package/dist/auth/create-tempest-auth.cjs +1 -1
- package/dist/auth/create-tempest-auth.cjs.map +1 -1
- package/dist/auth/create-tempest-auth.js +203 -58
- package/dist/auth/create-tempest-auth.js.map +1 -1
- package/dist/auth/refresh-queue.cjs +1 -1
- package/dist/auth/refresh-queue.cjs.map +1 -1
- package/dist/auth/refresh-queue.js +13 -6
- package/dist/auth/refresh-queue.js.map +1 -1
- package/dist/br/pix.cjs +1 -1
- package/dist/br/pix.cjs.map +1 -1
- package/dist/br/pix.js +85 -72
- package/dist/br/pix.js.map +1 -1
- package/dist/br.d.ts +19 -4
- package/dist/components/Chat/ChatAttachments.cjs +1 -1
- package/dist/components/Chat/ChatAttachments.cjs.map +1 -1
- package/dist/components/Chat/ChatAttachments.js +46 -38
- package/dist/components/Chat/ChatAttachments.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.js +1 -1
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlock/tokenize.cjs +1 -1
- package/dist/components/CodeBlock/tokenize.cjs.map +1 -1
- package/dist/components/CodeBlock/tokenize.js +54 -25
- package/dist/components/CodeBlock/tokenize.js.map +1 -1
- package/dist/components/Markdown/markdown-parse.cjs +7 -5
- package/dist/components/Markdown/markdown-parse.cjs.map +1 -1
- package/dist/components/Markdown/markdown-parse.js +171 -90
- package/dist/components/Markdown/markdown-parse.js.map +1 -1
- package/dist/components/Toast/Toast.module.cjs +1 -1
- package/dist/components/Toast/Toast.module.cjs.map +1 -1
- package/dist/components/Toast/Toast.module.js +7 -3
- package/dist/components/Toast/Toast.module.js.map +1 -1
- package/dist/components/Toast/ToastProvider.cjs +1 -1
- package/dist/components/Toast/ToastProvider.cjs.map +1 -1
- package/dist/components/Toast/ToastProvider.js +77 -51
- package/dist/components/Toast/ToastProvider.js.map +1 -1
- package/dist/data/create-data-provider.cjs +1 -1
- package/dist/data/create-data-provider.cjs.map +1 -1
- package/dist/data/create-data-provider.js +32 -21
- package/dist/data/create-data-provider.js.map +1 -1
- package/dist/http/api-client.cjs +1 -1
- package/dist/http/api-client.cjs.map +1 -1
- package/dist/http/api-client.js +81 -73
- package/dist/http/api-client.js.map +1 -1
- package/dist/http/errors.cjs +1 -1
- package/dist/http/errors.cjs.map +1 -1
- package/dist/http/errors.js +39 -35
- package/dist/http/errors.js.map +1 -1
- package/dist/http/resumable-upload.cjs +1 -1
- package/dist/http/resumable-upload.cjs.map +1 -1
- package/dist/http/resumable-upload.js +141 -105
- package/dist/http/resumable-upload.js.map +1 -1
- package/dist/http/retry.cjs +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js +5 -6
- package/dist/http/retry.js.map +1 -1
- package/dist/oauth/callback.cjs +2 -0
- package/dist/oauth/callback.cjs.map +1 -0
- package/dist/oauth/callback.js +42 -0
- package/dist/oauth/callback.js.map +1 -0
- package/dist/oauth/use-oauth-callback.cjs +1 -1
- package/dist/oauth/use-oauth-callback.cjs.map +1 -1
- package/dist/oauth/use-oauth-callback.js +13 -20
- package/dist/oauth/use-oauth-callback.js.map +1 -1
- package/dist/push/use-push-subscription.cjs +1 -1
- package/dist/push/use-push-subscription.cjs.map +1 -1
- package/dist/push/use-push-subscription.js +42 -42
- package/dist/push/use-push-subscription.js.map +1 -1
- package/dist/push/web-push-client.cjs +1 -1
- package/dist/push/web-push-client.cjs.map +1 -1
- package/dist/push/web-push-client.js +23 -3
- package/dist/push/web-push-client.js.map +1 -1
- package/dist/query/offline-persistence.cjs +1 -1
- package/dist/query/offline-persistence.cjs.map +1 -1
- package/dist/query/offline-persistence.js +68 -23
- package/dist/query/offline-persistence.js.map +1 -1
- package/dist/styles/component/Toast.css +6 -1
- package/dist/styles/feedback.css +6 -1
- package/dist/styles.css +1 -1
- package/dist/sw/background-sync.cjs +1 -1
- package/dist/sw/background-sync.cjs.map +1 -1
- package/dist/sw/background-sync.js +272 -60
- package/dist/sw/background-sync.js.map +1 -1
- package/dist/sw/cache-inspect.cjs.map +1 -1
- package/dist/sw/cache-inspect.js.map +1 -1
- package/dist/sw/cache.cjs +1 -1
- package/dist/sw/cache.cjs.map +1 -1
- package/dist/sw/cache.js +91 -64
- package/dist/sw/cache.js.map +1 -1
- package/dist/sw/credential-headers.cjs +2 -0
- package/dist/sw/credential-headers.cjs.map +1 -0
- package/dist/sw/credential-headers.js +17 -0
- package/dist/sw/credential-headers.js.map +1 -0
- package/dist/sw/session-data.cjs +2 -0
- package/dist/sw/session-data.cjs.map +1 -0
- package/dist/sw/session-data.js +17 -0
- package/dist/sw/session-data.js.map +1 -0
- package/dist/sw.cjs +1 -1
- package/dist/sw.d.ts +309 -23
- package/dist/sw.js +7 -5
- package/dist/telemetry/app-error-queue.cjs +1 -1
- package/dist/telemetry/app-error-queue.cjs.map +1 -1
- package/dist/telemetry/app-error-queue.js +19 -14
- package/dist/telemetry/app-error-queue.js.map +1 -1
- package/dist/telemetry/app-error-reporter.cjs +1 -1
- package/dist/telemetry/app-error-reporter.cjs.map +1 -1
- package/dist/telemetry/app-error-reporter.js +75 -34
- package/dist/telemetry/app-error-reporter.js.map +1 -1
- package/dist/telemetry/app-error-transport.cjs +1 -1
- package/dist/telemetry/app-error-transport.cjs.map +1 -1
- package/dist/telemetry/app-error-transport.js +16 -3
- package/dist/telemetry/app-error-transport.js.map +1 -1
- package/dist/tempest-react-sdk.cjs +1 -1
- package/dist/tempest-react-sdk.d.ts +1183 -64
- package/dist/tempest-react-sdk.js +160 -156
- package/dist/utils/csv.cjs +3 -3
- package/dist/utils/csv.cjs.map +1 -1
- package/dist/utils/csv.js +18 -14
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/owner-fingerprint.cjs +2 -0
- package/dist/utils/owner-fingerprint.cjs.map +1 -0
- package/dist/utils/owner-fingerprint.js +18 -0
- package/dist/utils/owner-fingerprint.js.map +1 -0
- package/dist/utils/safe-url.cjs +2 -0
- package/dist/utils/safe-url.cjs.map +1 -0
- package/dist/utils/safe-url.js +39 -0
- package/dist/utils/safe-url.js.map +1 -0
- package/dist/vite/tempest-csp.cjs +2 -2
- package/dist/vite/tempest-csp.cjs.map +1 -1
- package/dist/vite/tempest-csp.js +130 -64
- package/dist/vite/tempest-csp.js.map +1 -1
- package/dist/vite.d.ts +23 -5
- package/dist/webrtc/peer-link.cjs +1 -1
- package/dist/webrtc/peer-link.cjs.map +1 -1
- package/dist/webrtc/peer-link.js +2 -10
- package/dist/webrtc/peer-link.js.map +1 -1
- package/dist/webrtc/peer-mesh.cjs +1 -1
- package/dist/webrtc/peer-mesh.cjs.map +1 -1
- package/dist/webrtc/peer-mesh.js +110 -72
- package/dist/webrtc/peer-mesh.js.map +1 -1
- package/package.json +1 -1
- package/template-pwa/src/pwa.tsx +22 -0
- package/template-pwa/src/sw.ts +27 -14
- package/dist/components/Markdown/markdown-url.cjs +0 -2
- package/dist/components/Markdown/markdown-url.cjs.map +0 -1
- package/dist/components/Markdown/markdown-url.js +0 -28
- package/dist/components/Markdown/markdown-url.js.map +0 -1
|
@@ -1,121 +1,158 @@
|
|
|
1
|
-
import { safeImageUrl as e, safeLinkUrl as t } from "
|
|
1
|
+
import { safeImageUrl as e, safeLinkUrl as t } from "../../utils/safe-url.js";
|
|
2
2
|
//#region src/components/Markdown/markdown-parse.ts
|
|
3
|
-
var n = /^\s{0,3}(`{3,}|~{3,})\s*([\w+-]*)
|
|
3
|
+
var n = /^\s{0,3}(`{3,}|~{3,})\s*([\w+-]*)$/, r = /^\s{0,3}(#{1,6})\s+/, i = /^\s{0,3}([-*_])\s*(?:\1\s*){2,}$/, a = /^\s{0,3}>\s?(.*)$/, o = /^([^\S\n\r]*)([-*+])[^\S\n\r]+/, s = /^([^\S\n\r]*)(\d{1,9})[.)][^\S\n\r]+/;
|
|
4
|
+
function c(e, t) {
|
|
5
|
+
let n = e.exec(t);
|
|
6
|
+
if (!n) return null;
|
|
7
|
+
let r = t.slice(n[0].length);
|
|
8
|
+
return r.includes("\u2028") || r.includes("\u2029") ? null : {
|
|
9
|
+
indent: n[1],
|
|
10
|
+
marker: n[2],
|
|
11
|
+
content: r
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function l(e) {
|
|
15
|
+
return c(o, e);
|
|
16
|
+
}
|
|
4
17
|
function u(e) {
|
|
5
|
-
return
|
|
18
|
+
return c(s, e);
|
|
19
|
+
}
|
|
20
|
+
var d = /^\s{0,3}\|[\s|:-]*$|^\s{0,3}:?-+:?(\s*\|\s*:?-+:?)+\s*\|?$/, f = 32;
|
|
21
|
+
function p(e) {
|
|
22
|
+
let t = r.exec(e);
|
|
23
|
+
if (!t) return null;
|
|
24
|
+
let n = e.slice(t[0].length).trimEnd(), i = n.length;
|
|
25
|
+
for (; i > 0 && n[i - 1] === "#";) --i;
|
|
26
|
+
return n = n.slice(0, i).trimEnd(), {
|
|
27
|
+
level: t[1].length,
|
|
28
|
+
text: n
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function m(e) {
|
|
32
|
+
return e.endsWith(" ");
|
|
33
|
+
}
|
|
34
|
+
function h(e) {
|
|
35
|
+
return g(e.replace(/\r\n?/g, "\n").split("\n"), 0);
|
|
6
36
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
37
|
+
function g(e, t) {
|
|
38
|
+
if (t >= f) {
|
|
39
|
+
let t = e.map((e) => e.trim()).filter(Boolean).join("\n");
|
|
40
|
+
return t ? [{
|
|
41
|
+
type: "paragraph",
|
|
42
|
+
children: C(t)
|
|
43
|
+
}] : [];
|
|
44
|
+
}
|
|
45
|
+
let r = [], o = 0;
|
|
46
|
+
for (; o < e.length;) {
|
|
47
|
+
let s = e[o];
|
|
48
|
+
if (s.trim() === "") {
|
|
49
|
+
o += 1;
|
|
13
50
|
continue;
|
|
14
51
|
}
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
let
|
|
18
|
-
for (
|
|
19
|
-
|
|
52
|
+
let c = n.exec(s.trimEnd());
|
|
53
|
+
if (c) {
|
|
54
|
+
let t = c[1][0], n = [];
|
|
55
|
+
for (o += 1; o < e.length && !RegExp(`^\\s{0,3}${t}{3,}\\s*$`).test(e[o]);) n.push(e[o]), o += 1;
|
|
56
|
+
o += 1, r.push({
|
|
20
57
|
type: "code",
|
|
21
|
-
language:
|
|
22
|
-
value:
|
|
58
|
+
language: c[2] || null,
|
|
59
|
+
value: n.join("\n")
|
|
23
60
|
});
|
|
24
61
|
continue;
|
|
25
62
|
}
|
|
26
|
-
let
|
|
27
|
-
if (
|
|
28
|
-
|
|
63
|
+
let f = p(s);
|
|
64
|
+
if (f) {
|
|
65
|
+
r.push({
|
|
29
66
|
type: "heading",
|
|
30
|
-
level:
|
|
31
|
-
children:
|
|
32
|
-
}),
|
|
67
|
+
level: f.level,
|
|
68
|
+
children: C(f.text)
|
|
69
|
+
}), o += 1;
|
|
33
70
|
continue;
|
|
34
71
|
}
|
|
35
|
-
if (i.test(
|
|
36
|
-
|
|
72
|
+
if (i.test(s)) {
|
|
73
|
+
r.push({ type: "rule" }), o += 1;
|
|
37
74
|
continue;
|
|
38
75
|
}
|
|
39
|
-
if (a.test(
|
|
76
|
+
if (a.test(s)) {
|
|
40
77
|
let n = [];
|
|
41
|
-
for (;
|
|
42
|
-
let t = a.exec(e[
|
|
78
|
+
for (; o < e.length;) {
|
|
79
|
+
let t = a.exec(e[o]);
|
|
43
80
|
if (t) {
|
|
44
|
-
n.push(t[1]),
|
|
81
|
+
n.push(t[1]), o += 1;
|
|
45
82
|
continue;
|
|
46
83
|
}
|
|
47
|
-
if (e[
|
|
48
|
-
n.push(e[
|
|
84
|
+
if (e[o].trim() === "") break;
|
|
85
|
+
n.push(e[o]), o += 1;
|
|
49
86
|
}
|
|
50
|
-
|
|
87
|
+
r.push({
|
|
51
88
|
type: "quote",
|
|
52
|
-
children:
|
|
89
|
+
children: g(n, t + 1)
|
|
53
90
|
});
|
|
54
91
|
continue;
|
|
55
92
|
}
|
|
56
|
-
if (
|
|
57
|
-
let [n,
|
|
58
|
-
|
|
93
|
+
if (l(s) || u(s)) {
|
|
94
|
+
let [n, i] = v(e, o, t);
|
|
95
|
+
r.push(n), o = i;
|
|
59
96
|
continue;
|
|
60
97
|
}
|
|
61
|
-
if (
|
|
62
|
-
let [
|
|
63
|
-
|
|
98
|
+
if (o + 1 < e.length && s.includes("|") && d.test(e[o + 1].trimEnd())) {
|
|
99
|
+
let [t, n] = b(e, o);
|
|
100
|
+
r.push(t), o = n;
|
|
64
101
|
continue;
|
|
65
102
|
}
|
|
66
|
-
let
|
|
67
|
-
for (;
|
|
68
|
-
let t = e[
|
|
69
|
-
if (
|
|
70
|
-
|
|
103
|
+
let h = [], y = [];
|
|
104
|
+
for (; o < e.length && e[o].trim() !== "";) {
|
|
105
|
+
let t = e[o];
|
|
106
|
+
if (p(t) || i.test(t) || n.test(t.trimEnd()) || a.test(t) || l(t) || u(t)) break;
|
|
107
|
+
h.push(t.trim()), y.push(m(t)), o += 1;
|
|
71
108
|
}
|
|
72
|
-
|
|
109
|
+
h.length > 0 && r.push({
|
|
73
110
|
type: "paragraph",
|
|
74
|
-
children: _(
|
|
111
|
+
children: C(_(h, y))
|
|
75
112
|
});
|
|
76
113
|
}
|
|
77
|
-
return
|
|
114
|
+
return r;
|
|
78
115
|
}
|
|
79
|
-
function
|
|
116
|
+
function _(e, t) {
|
|
80
117
|
return e.map((n, r) => t[r] && r < e.length - 1 ? `${n} ` : n).join("\n");
|
|
81
118
|
}
|
|
82
|
-
function
|
|
83
|
-
let
|
|
84
|
-
|
|
119
|
+
function v(e, t, n) {
|
|
120
|
+
let r = l(e[t]), i = u(e[t]), a = i !== null, o = (i ?? r)?.indent.length ?? 0, s = a ? Number(i?.marker ?? 1) : 1, c = [], d = [], f = t, p = () => {
|
|
121
|
+
d.length !== 0 && (c.push(g(d, n + 1)), d = []);
|
|
85
122
|
};
|
|
86
123
|
for (; f < e.length;) {
|
|
87
124
|
let t = e[f];
|
|
88
125
|
if (t.trim() === "") {
|
|
89
126
|
if (f + 1 < e.length && e[f + 1].trim() !== "") {
|
|
90
|
-
|
|
127
|
+
d.push(""), f += 1;
|
|
91
128
|
continue;
|
|
92
129
|
}
|
|
93
130
|
break;
|
|
94
131
|
}
|
|
95
|
-
let n =
|
|
96
|
-
if (
|
|
97
|
-
if (!(
|
|
98
|
-
p(),
|
|
132
|
+
let n = l(t), r = u(t), i = n ?? r;
|
|
133
|
+
if (i && i.indent.length <= o) {
|
|
134
|
+
if (!(a ? r : n)) break;
|
|
135
|
+
p(), d.push(i.content), f += 1;
|
|
99
136
|
continue;
|
|
100
137
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
138
|
+
if (i) {
|
|
139
|
+
d.push(t.slice(o)), f += 1;
|
|
103
140
|
continue;
|
|
104
141
|
}
|
|
105
|
-
if (t.search(/\S/) >
|
|
106
|
-
|
|
142
|
+
if (t.search(/\S/) > o) {
|
|
143
|
+
d.push(t.trim()), f += 1;
|
|
107
144
|
continue;
|
|
108
145
|
}
|
|
109
146
|
break;
|
|
110
147
|
}
|
|
111
148
|
return p(), [{
|
|
112
149
|
type: "list",
|
|
113
|
-
ordered:
|
|
114
|
-
start:
|
|
115
|
-
items:
|
|
150
|
+
ordered: a,
|
|
151
|
+
start: s,
|
|
152
|
+
items: c
|
|
116
153
|
}, f];
|
|
117
154
|
}
|
|
118
|
-
function
|
|
155
|
+
function y(e) {
|
|
119
156
|
let t = e.trim().replace(/^\|/, "").replace(/\|$/, ""), n = [], r = "";
|
|
120
157
|
for (let e = 0; e < t.length; e += 1) {
|
|
121
158
|
if (t[e] === "\\" && t[e + 1] === "|") {
|
|
@@ -130,21 +167,26 @@ function m(e) {
|
|
|
130
167
|
}
|
|
131
168
|
return n.push(r), n.map((e) => e.trim());
|
|
132
169
|
}
|
|
133
|
-
function
|
|
134
|
-
let n =
|
|
170
|
+
function b(e, t) {
|
|
171
|
+
let n = y(e[t]), r = y(e[t + 1]).map((e) => {
|
|
135
172
|
let t = e.startsWith(":"), n = e.endsWith(":");
|
|
136
173
|
return t && n ? "center" : n ? "right" : t ? "left" : null;
|
|
137
174
|
}), i = [], a = t + 2;
|
|
138
|
-
for (; a < e.length && e[a].trim() !== "" && e[a].includes("|");) i.push(
|
|
175
|
+
for (; a < e.length && e[a].trim() !== "" && e[a].includes("|");) i.push(y(e[a]).map(C)), a += 1;
|
|
139
176
|
return [{
|
|
140
177
|
type: "table",
|
|
141
178
|
align: r,
|
|
142
|
-
head: n.map(
|
|
179
|
+
head: n.map(C),
|
|
143
180
|
rows: i
|
|
144
181
|
}, a];
|
|
145
182
|
}
|
|
146
|
-
var
|
|
183
|
+
var x = [
|
|
147
184
|
{
|
|
185
|
+
guard: {
|
|
186
|
+
kind: "link",
|
|
187
|
+
opener: "!["
|
|
188
|
+
},
|
|
189
|
+
first: "!",
|
|
148
190
|
pattern: /^!\[([^\]]*)\]\(((?:[^()\s]|\([^()\s]*\))+)(?:\s+"[^"]*")?\)/,
|
|
149
191
|
build: (t) => {
|
|
150
192
|
let n = e(t[2]);
|
|
@@ -159,9 +201,14 @@ var g = [
|
|
|
159
201
|
}
|
|
160
202
|
},
|
|
161
203
|
{
|
|
204
|
+
guard: {
|
|
205
|
+
kind: "link",
|
|
206
|
+
opener: "["
|
|
207
|
+
},
|
|
208
|
+
first: "[",
|
|
162
209
|
pattern: /^\[([^\]]*)\]\(((?:[^()\s]|\([^()\s]*\))+)(?:\s+"[^"]*")?\)/,
|
|
163
210
|
build: (e) => {
|
|
164
|
-
let n = t(e[2]), r =
|
|
211
|
+
let n = t(e[2]), r = C(e[1]);
|
|
165
212
|
return n ? {
|
|
166
213
|
type: "link",
|
|
167
214
|
href: n,
|
|
@@ -173,6 +220,7 @@ var g = [
|
|
|
173
220
|
}
|
|
174
221
|
},
|
|
175
222
|
{
|
|
223
|
+
first: "`",
|
|
176
224
|
pattern: /^`([^`]+)`/,
|
|
177
225
|
build: (e) => ({
|
|
178
226
|
type: "code",
|
|
@@ -180,41 +228,51 @@ var g = [
|
|
|
180
228
|
})
|
|
181
229
|
},
|
|
182
230
|
{
|
|
231
|
+
first: "*",
|
|
183
232
|
pattern: /^\*\*([\s\S]+?)\*\*/,
|
|
184
233
|
build: (e) => ({
|
|
185
234
|
type: "strong",
|
|
186
|
-
children:
|
|
235
|
+
children: C(e[1])
|
|
187
236
|
})
|
|
188
237
|
},
|
|
189
238
|
{
|
|
239
|
+
first: "_",
|
|
190
240
|
pattern: /^__([\s\S]+?)__/,
|
|
191
241
|
build: (e) => ({
|
|
192
242
|
type: "strong",
|
|
193
|
-
children:
|
|
243
|
+
children: C(e[1])
|
|
194
244
|
})
|
|
195
245
|
},
|
|
196
246
|
{
|
|
247
|
+
first: "~",
|
|
197
248
|
pattern: /^~~([\s\S]+?)~~/,
|
|
198
249
|
build: (e) => ({
|
|
199
250
|
type: "del",
|
|
200
|
-
children:
|
|
251
|
+
children: C(e[1])
|
|
201
252
|
})
|
|
202
253
|
},
|
|
203
254
|
{
|
|
255
|
+
first: "*",
|
|
204
256
|
pattern: /^\*([^*\n]+)\*/,
|
|
205
257
|
build: (e) => ({
|
|
206
258
|
type: "em",
|
|
207
|
-
children:
|
|
259
|
+
children: C(e[1])
|
|
208
260
|
})
|
|
209
261
|
},
|
|
210
262
|
{
|
|
263
|
+
first: "_",
|
|
211
264
|
pattern: /^_([^_\n]+)_/,
|
|
212
265
|
build: (e) => ({
|
|
213
266
|
type: "em",
|
|
214
|
-
children:
|
|
267
|
+
children: C(e[1])
|
|
215
268
|
})
|
|
216
269
|
},
|
|
217
270
|
{
|
|
271
|
+
guard: {
|
|
272
|
+
kind: "autolink",
|
|
273
|
+
opener: "<"
|
|
274
|
+
},
|
|
275
|
+
first: "<",
|
|
218
276
|
pattern: /^<((?:https?:\/\/|mailto:)[^>\s]+)>/,
|
|
219
277
|
build: (e) => {
|
|
220
278
|
let n = t(e[1]);
|
|
@@ -232,41 +290,64 @@ var g = [
|
|
|
232
290
|
}
|
|
233
291
|
},
|
|
234
292
|
{
|
|
235
|
-
|
|
236
|
-
build: () => ({ type: "break" })
|
|
237
|
-
},
|
|
238
|
-
{
|
|
293
|
+
first: "\\",
|
|
239
294
|
pattern: /^\\\n/,
|
|
240
295
|
build: () => ({ type: "break" })
|
|
241
296
|
}
|
|
242
|
-
];
|
|
243
|
-
function
|
|
244
|
-
let t = [], n = "", r = 0, i = () => {
|
|
297
|
+
], S = new Set(x.map((e) => e.first));
|
|
298
|
+
function C(e) {
|
|
299
|
+
let t = [], n = "", r = 0, i = -1, a = -1, o = -1, s = /[>\s]/g, c = () => {
|
|
245
300
|
n && t.push({
|
|
246
301
|
type: "text",
|
|
247
302
|
value: n
|
|
248
303
|
}), n = "";
|
|
304
|
+
}, l = (t) => {
|
|
305
|
+
if (i < t) {
|
|
306
|
+
let n = e.indexOf("]", t);
|
|
307
|
+
i = n === -1 ? e.length : n;
|
|
308
|
+
}
|
|
309
|
+
return i;
|
|
310
|
+
}, u = (t) => (o < t && (s.lastIndex = t, o = s.exec(e)?.index ?? e.length), o), d = (t) => {
|
|
311
|
+
if (!t) return !0;
|
|
312
|
+
if (!e.startsWith(t.opener, r)) return !1;
|
|
313
|
+
if (t.kind === "autolink") return e[u(r + 1)] === ">";
|
|
314
|
+
let n = l(r + t.opener.length);
|
|
315
|
+
return e[n + 1] === "(" && n !== a;
|
|
249
316
|
};
|
|
250
317
|
for (; r < e.length;) {
|
|
251
318
|
if (e[r] === "\\" && r + 1 < e.length && e[r + 1] !== "\n") {
|
|
252
319
|
n += e[r + 1], r += 2;
|
|
253
320
|
continue;
|
|
254
321
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
322
|
+
if (e[r] === " ") {
|
|
323
|
+
let i = r;
|
|
324
|
+
for (; e[i] === " ";) i += 1;
|
|
325
|
+
i - r >= 2 && e[i] === "\n" ? (c(), t.push({ type: "break" }), r = i + 1) : (n += e.slice(r, i), r = i);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (!S.has(e[r])) {
|
|
329
|
+
n += e[r], r += 1;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
let i = e.slice(r), o = !1;
|
|
333
|
+
for (let n of x) {
|
|
334
|
+
if (n.first !== e[r] || !d(n.guard)) continue;
|
|
335
|
+
let s = n.pattern.exec(i);
|
|
336
|
+
if (!s) {
|
|
337
|
+
n.guard?.kind === "link" && (a = l(r + n.guard.opener.length));
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
let u = n.build(s);
|
|
341
|
+
if (u) {
|
|
342
|
+
c(), t.push(u), r += s[0].length, o = !0;
|
|
262
343
|
break;
|
|
263
344
|
}
|
|
264
345
|
}
|
|
265
346
|
o || (n += e[r], r += 1);
|
|
266
347
|
}
|
|
267
|
-
return
|
|
348
|
+
return c(), t;
|
|
268
349
|
}
|
|
269
350
|
//#endregion
|
|
270
|
-
export {
|
|
351
|
+
export { C as parseInline, h as parseMarkdown };
|
|
271
352
|
|
|
272
353
|
//# sourceMappingURL=markdown-parse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-parse.js","names":[],"sources":["../../../src/components/Markdown/markdown-parse.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — a Markdown block parser is a state\n * machine over line kinds: paragraph, heading, fence, list, quote, table and\n * thematic break each need to see the lines around them to know where they end.\n * parseBlocks is that loop, and cutting it into per-kind functions would hand each\n * one the same lookahead cursor.\n */\n// A small Markdown parser for the subset an app actually renders from untrusted\n// text: comments, ticket bodies, release notes, a product description.\n//\n// It produces a node tree, never an HTML string, and the renderer turns that into\n// React elements. No `dangerouslySetInnerHTML` exists anywhere in this component —\n// which is the property that makes rendering somebody else's Markdown safe, and it\n// is structural rather than a promise about escaping.\n//\n// Raw HTML in the input is therefore not \"sanitized\", it is **text**: `<script>` in\n// a comment renders as the four characters somebody typed. That is the whole point,\n// and it is also the documented limit — this is not a CommonMark implementation and\n// does not try to be.\n\nimport { safeImageUrl, safeLinkUrl } from \"./markdown-url\";\n\n/** Inline content. */\nexport type MarkdownInline =\n | { type: \"text\"; value: string }\n | { type: \"strong\"; children: MarkdownInline[] }\n | { type: \"em\"; children: MarkdownInline[] }\n | { type: \"del\"; children: MarkdownInline[] }\n | { type: \"code\"; value: string }\n | { type: \"link\"; href: string; children: MarkdownInline[] }\n | { type: \"image\"; src: string; alt: string }\n | { type: \"break\" };\n\n/** Column alignment of a table, from the delimiter row. */\nexport type MarkdownAlign = \"left\" | \"center\" | \"right\" | null;\n\n/** Block content. */\nexport type MarkdownBlock =\n | { type: \"heading\"; level: number; children: MarkdownInline[] }\n | { type: \"paragraph\"; children: MarkdownInline[] }\n | { type: \"code\"; language: string | null; value: string }\n | { type: \"quote\"; children: MarkdownBlock[] }\n | { type: \"list\"; ordered: boolean; start: number; items: MarkdownBlock[][] }\n | {\n type: \"table\";\n align: MarkdownAlign[];\n head: MarkdownInline[][];\n rows: MarkdownInline[][][];\n }\n | { type: \"rule\" };\n\nconst FENCE = /^\\s{0,3}(`{3,}|~{3,})\\s*([\\w+-]*)\\s*$/;\nconst HEADING = /^\\s{0,3}(#{1,6})\\s+(.*?)\\s*#*\\s*$/;\nconst RULE = /^\\s{0,3}([-*_])\\s*(?:\\1\\s*){2,}$/;\nconst QUOTE = /^\\s{0,3}>\\s?(.*)$/;\nconst BULLET = /^(\\s*)([-*+])\\s+(.*)$/;\nconst ORDERED = /^(\\s*)(\\d{1,9})[.)]\\s+(.*)$/;\nconst HARD_BREAK = / {2,}$/;\n/**\n * A table's delimiter row.\n *\n * The `|` is required somewhere in the line, and that is what tells a one-column\n * table (`| --- |`) apart from a thematic break (`---`) — a single column is a\n * legitimate table, and the first version of this regex demanded two.\n */\nconst TABLE_DELIMITER = /^\\s{0,3}\\|[\\s|:-]*$|^\\s{0,3}:?-+:?(\\s*\\|\\s*:?-+:?)+\\s*\\|?\\s*$/;\n\n/**\n * Parse a Markdown document into blocks.\n *\n * @param source - Raw Markdown.\n * @returns Block nodes in document order.\n */\nexport function parseMarkdown(source: string): MarkdownBlock[] {\n const lines = source.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n return parseBlocks(lines);\n}\n\n/** Parse a run of lines into blocks. */\nfunction parseBlocks(lines: string[]): MarkdownBlock[] {\n const blocks: MarkdownBlock[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (line.trim() === \"\") {\n i += 1;\n continue;\n }\n\n const fence = FENCE.exec(line);\n if (fence) {\n const marker = fence[1][0];\n const body: string[] = [];\n i += 1;\n while (i < lines.length && !new RegExp(`^\\\\s{0,3}${marker}{3,}\\\\s*$`).test(lines[i])) {\n body.push(lines[i]);\n i += 1;\n }\n // An unterminated fence still yields a code block: the alternative is to\n // render the rest of the document as prose full of backticks.\n i += 1;\n blocks.push({ type: \"code\", language: fence[2] || null, value: body.join(\"\\n\") });\n continue;\n }\n\n const heading = HEADING.exec(line);\n if (heading) {\n blocks.push({\n type: \"heading\",\n level: heading[1].length,\n children: parseInline(heading[2]),\n });\n i += 1;\n continue;\n }\n\n if (RULE.test(line)) {\n blocks.push({ type: \"rule\" });\n i += 1;\n continue;\n }\n\n if (QUOTE.test(line)) {\n const inner: string[] = [];\n while (i < lines.length) {\n const match = QUOTE.exec(lines[i]);\n if (match) {\n inner.push(match[1]);\n i += 1;\n continue;\n }\n // A blank line ends the quote; a plain line continues it (lazy\n // continuation), which is how people actually write quotes.\n if (lines[i].trim() === \"\") break;\n inner.push(lines[i]);\n i += 1;\n }\n blocks.push({ type: \"quote\", children: parseBlocks(inner) });\n continue;\n }\n\n if (BULLET.test(line) || ORDERED.test(line)) {\n const [list, next] = parseList(lines, i);\n blocks.push(list);\n i = next;\n continue;\n }\n\n if (i + 1 < lines.length && line.includes(\"|\") && TABLE_DELIMITER.test(lines[i + 1])) {\n const [table, next] = parseTable(lines, i);\n blocks.push(table);\n i = next;\n continue;\n }\n\n const paragraph: string[] = [];\n const hardBreaks: boolean[] = [];\n while (i < lines.length && lines[i].trim() !== \"\") {\n const current = lines[i];\n if (\n HEADING.test(current) ||\n RULE.test(current) ||\n FENCE.test(current) ||\n QUOTE.test(current) ||\n BULLET.test(current) ||\n ORDERED.test(current)\n ) {\n break;\n }\n paragraph.push(current.trim());\n hardBreaks.push(HARD_BREAK.test(current));\n i += 1;\n }\n if (paragraph.length > 0) {\n blocks.push({\n type: \"paragraph\",\n children: parseInline(joinParagraph(paragraph, hardBreaks)),\n });\n }\n }\n\n return blocks;\n}\n\n/**\n * Re-join the lines of a paragraph, keeping the two-space hard break.\n *\n * Every line is trimmed before it is parsed, because leading indentation is not\n * content and a trailing space is invisible noise in almost every line. The one\n * exception is the CommonMark hard break: two or more trailing spaces mean\n * \"break the line here\", so trimming first would delete the only mark that says\n * so and the ` \\n` inline rule could never match. The flag is recorded before\n * the trim and the marker put back here, on every line but the last — a break\n * after the final line of a paragraph would break into nothing.\n *\n * @param lines - The trimmed lines, in order.\n * @param hardBreaks - Whether each line ended in two or more spaces.\n * @returns The paragraph source the inline parser reads.\n */\nfunction joinParagraph(lines: readonly string[], hardBreaks: readonly boolean[]): string {\n return lines\n .map((line, index) => (hardBreaks[index] && index < lines.length - 1 ? `${line} ` : line))\n .join(\"\\n\");\n}\n\n/**\n * Parse a list, including nested lists and multi-line items.\n *\n * Nesting is decided by indentation relative to the **first** item's marker, so a\n * list indented inside a quote or another list still reads correctly.\n *\n * @returns The list node and the index of the first line after it.\n */\nfunction parseList(lines: string[], start: number): [MarkdownBlock, number] {\n const bulletStart = BULLET.exec(lines[start]);\n const orderedStart = ORDERED.exec(lines[start]);\n // The two markers are mutually exclusive — `-*+` versus digits — so whichever\n // matched decides the list kind.\n const ordered = orderedStart !== null;\n const first = orderedStart ?? bulletStart;\n const baseIndent = (first?.[1] ?? \"\").length;\n const startNumber = ordered ? Number(orderedStart?.[2] ?? 1) : 1;\n\n const items: MarkdownBlock[][] = [];\n let buffer: string[] = [];\n let i = start;\n\n const flush = (): void => {\n if (buffer.length === 0) return;\n items.push(parseBlocks(buffer));\n buffer = [];\n };\n\n while (i < lines.length) {\n const line = lines[i];\n if (line.trim() === \"\") {\n // A single blank line inside a list is a loose item, not the end. Two in\n // a row end it, which is what a blank-then-paragraph document means.\n if (i + 1 < lines.length && lines[i + 1].trim() !== \"\") {\n buffer.push(\"\");\n i += 1;\n continue;\n }\n break;\n }\n const bullet = BULLET.exec(line);\n const numbered = ORDERED.exec(line);\n const match = bullet ?? numbered;\n\n if (match && match[1].length <= baseIndent) {\n const sameKind = ordered ? Boolean(numbered) : Boolean(bullet);\n if (!sameKind) break;\n flush();\n buffer.push(match[3]);\n i += 1;\n continue;\n }\n if (match) {\n // Deeper marker: keep the indentation so the recursive call sees a list.\n buffer.push(line.slice(baseIndent));\n i += 1;\n continue;\n }\n if (line.search(/\\S/) > baseIndent) {\n buffer.push(line.trim());\n i += 1;\n continue;\n }\n break;\n }\n flush();\n\n return [{ type: \"list\", ordered, start: startNumber, items }, i];\n}\n\n/** Split a table row on unescaped pipes. */\nfunction splitRow(line: string): string[] {\n const trimmed = line.trim().replace(/^\\|/, \"\").replace(/\\|$/, \"\");\n const cells: string[] = [];\n let current = \"\";\n for (let i = 0; i < trimmed.length; i += 1) {\n if (trimmed[i] === \"\\\\\" && trimmed[i + 1] === \"|\") {\n current += \"|\";\n i += 1;\n continue;\n }\n if (trimmed[i] === \"|\") {\n cells.push(current);\n current = \"\";\n continue;\n }\n current += trimmed[i];\n }\n cells.push(current);\n return cells.map((cell) => cell.trim());\n}\n\n/**\n * Parse a GFM pipe table.\n *\n * @returns The table node and the index of the first line after it.\n */\nfunction parseTable(lines: string[], start: number): [MarkdownBlock, number] {\n const head = splitRow(lines[start]);\n const align: MarkdownAlign[] = splitRow(lines[start + 1]).map((cell) => {\n const left = cell.startsWith(\":\");\n const right = cell.endsWith(\":\");\n if (left && right) return \"center\";\n if (right) return \"right\";\n if (left) return \"left\";\n return null;\n });\n\n const rows: MarkdownInline[][][] = [];\n let i = start + 2;\n while (i < lines.length && lines[i].trim() !== \"\" && lines[i].includes(\"|\")) {\n rows.push(splitRow(lines[i]).map(parseInline));\n i += 1;\n }\n\n return [{ type: \"table\", align, head: head.map(parseInline), rows }, i];\n}\n\n/** Inline delimiters, longest marker first so `**` wins over `*`. */\nconst INLINE_RULES: Array<{\n pattern: RegExp;\n build: (match: RegExpExecArray) => MarkdownInline | null;\n}> = [\n {\n pattern: /^!\\[([^\\]]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)(?:\\s+\"[^\"]*\")?\\)/,\n build: (match) => {\n const src = safeImageUrl(match[2]);\n return src ? { type: \"image\", src, alt: match[1] } : { type: \"text\", value: match[1] };\n },\n },\n {\n pattern: /^\\[([^\\]]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)(?:\\s+\"[^\"]*\")?\\)/,\n build: (match) => {\n const href = safeLinkUrl(match[2]);\n const children = parseInline(match[1]);\n // A rejected URL keeps the label as plain text: dropping the text too\n // would silently delete words somebody wrote.\n return href ? { type: \"link\", href, children } : { type: \"text\", value: match[1] };\n },\n },\n { pattern: /^`([^`]+)`/, build: (match) => ({ type: \"code\", value: match[1] }) },\n {\n pattern: /^\\*\\*([\\s\\S]+?)\\*\\*/,\n build: (match) => ({ type: \"strong\", children: parseInline(match[1]) }),\n },\n {\n pattern: /^__([\\s\\S]+?)__/,\n build: (match) => ({ type: \"strong\", children: parseInline(match[1]) }),\n },\n {\n pattern: /^~~([\\s\\S]+?)~~/,\n build: (match) => ({ type: \"del\", children: parseInline(match[1]) }),\n },\n {\n pattern: /^\\*([^*\\n]+)\\*/,\n build: (match) => ({ type: \"em\", children: parseInline(match[1]) }),\n },\n {\n pattern: /^_([^_\\n]+)_/,\n build: (match) => ({ type: \"em\", children: parseInline(match[1]) }),\n },\n {\n pattern: /^<((?:https?:\\/\\/|mailto:)[^>\\s]+)>/,\n build: (match) => {\n const href = safeLinkUrl(match[1]);\n return href\n ? { type: \"link\", href, children: [{ type: \"text\", value: match[1] }] }\n : { type: \"text\", value: match[1] };\n },\n },\n { pattern: /^ {2,}\\n/, build: () => ({ type: \"break\" }) },\n { pattern: /^\\\\\\n/, build: () => ({ type: \"break\" }) },\n];\n\n/**\n * Parse inline Markdown.\n *\n * A backslash escapes the next character, so `\\*not italic\\*` renders with the\n * asterisks. Anything that matches no rule is text — an unclosed `**` is two\n * asterisks, not a bold run to the end of the paragraph.\n *\n * @param source - One block's text.\n * @returns Inline nodes.\n */\nexport function parseInline(source: string): MarkdownInline[] {\n const nodes: MarkdownInline[] = [];\n let text = \"\";\n let i = 0;\n\n const flush = (): void => {\n if (text) nodes.push({ type: \"text\", value: text });\n text = \"\";\n };\n\n while (i < source.length) {\n if (source[i] === \"\\\\\" && i + 1 < source.length && source[i + 1] !== \"\\n\") {\n text += source[i + 1];\n i += 2;\n continue;\n }\n\n const rest = source.slice(i);\n let matched = false;\n for (const rule of INLINE_RULES) {\n const match = rule.pattern.exec(rest);\n if (!match) continue;\n const node = rule.build(match);\n if (!node) continue;\n flush();\n nodes.push(node);\n i += match[0].length;\n matched = true;\n break;\n }\n if (matched) continue;\n\n text += source[i];\n i += 1;\n }\n\n flush();\n return nodes;\n}\n"],"mappings":";;AAmDA,IAAM,IAAQ,yCACR,IAAU,qCACV,IAAO,oCACP,IAAQ,qBACR,IAAS,yBACT,IAAU,+BACV,IAAa,UAQb,IAAkB;AAQxB,SAAgB,EAAc,GAAiC;CAE3D,OAAO,EADO,EAAO,QAAQ,UAAU,IAAI,CAAC,CAAC,MAAM,IAChC,CAAK;AAC5B;AAGA,SAAS,EAAY,GAAkC;CACnD,IAAM,IAA0B,CAAC,GAC7B,IAAI;CAER,OAAO,IAAI,EAAM,SAAQ;EACrB,IAAM,IAAO,EAAM;EAEnB,IAAI,EAAK,KAAK,MAAM,IAAI;GACpB,KAAK;GACL;EACJ;EAEA,IAAM,IAAQ,EAAM,KAAK,CAAI;EAC7B,IAAI,GAAO;GACP,IAAM,IAAS,EAAM,EAAE,CAAC,IAClB,IAAiB,CAAC;GAExB,KADA,KAAK,GACE,IAAI,EAAM,UAAU,CAAK,OAAO,YAAY,EAAO,UAAU,CAAC,CAAC,KAAK,EAAM,EAAE,IAE/E,AADA,EAAK,KAAK,EAAM,EAAE,GAClB,KAAK;GAKT,AADA,KAAK,GACL,EAAO,KAAK;IAAE,MAAM;IAAQ,UAAU,EAAM,MAAM;IAAM,OAAO,EAAK,KAAK,IAAI;GAAE,CAAC;GAChF;EACJ;EAEA,IAAM,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AAY,EAAM,EAAE;GACjC,OAAO,IACD;IAAE,MAAM;IAAQ;IAAM,UAAU,CAAC;KAAE,MAAM;KAAQ,OAAO,EAAM;IAAG,CAAC;GAAE,IACpE;IAAE,MAAM;IAAQ,OAAO,EAAM;GAAG;EAC1C;CACJ;CACA;EAAE,SAAS;EAAY,cAAc,EAAE,MAAM,QAAQ;CAAG;CACxD;EAAE,SAAS;EAAS,cAAc,EAAE,MAAM,QAAQ;CAAG;AACzD;AAYA,SAAgB,EAAY,GAAkC;CAC1D,IAAM,IAA0B,CAAC,GAC7B,IAAO,IACP,IAAI,GAEF,UAAoB;EAEtB,AADI,KAAM,EAAM,KAAK;GAAE,MAAM;GAAQ,OAAO;EAAK,CAAC,GAClD,IAAO;CACX;CAEA,OAAO,IAAI,EAAO,SAAQ;EACtB,IAAI,EAAO,OAAO,QAAQ,IAAI,IAAI,EAAO,UAAU,EAAO,IAAI,OAAO,MAAM;GAEvE,AADA,KAAQ,EAAO,IAAI,IACnB,KAAK;GACL;EACJ;EAEA,IAAM,IAAO,EAAO,MAAM,CAAC,GACvB,IAAU;EACd,KAAK,IAAM,KAAQ,GAAc;GAC7B,IAAM,IAAQ,EAAK,QAAQ,KAAK,CAAI;GACpC,IAAI,CAAC,GAAO;GACZ,IAAM,IAAO,EAAK,MAAM,CAAK;GACxB,OAIL;IAHA,EAAM,GACN,EAAM,KAAK,CAAI,GACf,KAAK,EAAM,EAAE,CAAC,QACd,IAAU;IACV;GADU;EAEd;EACI,MAEJ,KAAQ,EAAO,IACf,KAAK;CACT;CAGA,OADA,EAAM,GACC;AACX"}
|
|
1
|
+
{"version":3,"file":"markdown-parse.js","names":[],"sources":["../../../src/components/Markdown/markdown-parse.ts"],"sourcesContent":["/**\n * @tempest-limits file-lines, function-lines — a Markdown block parser is a state\n * machine over line kinds: paragraph, heading, fence, list, quote, table and\n * thematic break each need to see the lines around them to know where they end.\n * parseBlocks is that loop, and cutting it into per-kind functions would hand each\n * one the same lookahead cursor.\n */\n// A small Markdown parser for the subset an app actually renders from untrusted\n// text: comments, ticket bodies, release notes, a product description.\n//\n// It produces a node tree, never an HTML string, and the renderer turns that into\n// React elements. No `dangerouslySetInnerHTML` exists anywhere in this component —\n// which is the property that makes rendering somebody else's Markdown safe, and it\n// is structural rather than a promise about escaping.\n//\n// Raw HTML in the input is therefore not \"sanitized\", it is **text**: `<script>` in\n// a comment renders as the four characters somebody typed. That is the whole point,\n// and it is also the documented limit — this is not a CommonMark implementation and\n// does not try to be.\n\nimport { safeImageUrl, safeLinkUrl } from \"@/utils/safe-url\";\n\n/** Inline content. */\nexport type MarkdownInline =\n | { type: \"text\"; value: string }\n | { type: \"strong\"; children: MarkdownInline[] }\n | { type: \"em\"; children: MarkdownInline[] }\n | { type: \"del\"; children: MarkdownInline[] }\n | { type: \"code\"; value: string }\n | { type: \"link\"; href: string; children: MarkdownInline[] }\n | { type: \"image\"; src: string; alt: string }\n | { type: \"break\" };\n\n/** Column alignment of a table, from the delimiter row. */\nexport type MarkdownAlign = \"left\" | \"center\" | \"right\" | null;\n\n/** Block content. */\nexport type MarkdownBlock =\n | { type: \"heading\"; level: number; children: MarkdownInline[] }\n | { type: \"paragraph\"; children: MarkdownInline[] }\n | { type: \"code\"; language: string | null; value: string }\n | { type: \"quote\"; children: MarkdownBlock[] }\n | { type: \"list\"; ordered: boolean; start: number; items: MarkdownBlock[][] }\n | {\n type: \"table\";\n align: MarkdownAlign[];\n head: MarkdownInline[][];\n rows: MarkdownInline[][][];\n }\n | { type: \"rule\" };\n\n/**\n * A fence opener, matched against the line **after** `trimEnd()`.\n *\n * The trailing `\\s*` lives in the `trimEnd()` rather than in the pattern: with it,\n * `\\s*([\\w+-]*)\\s*$` is two whitespace quantifiers separated by one that may be\n * empty, and a fence followed by 20 000 spaces and a stray `!` took 0.36 s (#437).\n */\nconst FENCE = /^\\s{0,3}(`{3,}|~{3,})\\s*([\\w+-]*)$/;\n/**\n * The opening marker of an ATX heading. The text and the optional closing `#` run\n * are cut by {@link matchHeading} with string operations, not by this pattern.\n */\nconst HEADING_OPEN = /^\\s{0,3}(#{1,6})\\s+/;\nconst RULE = /^\\s{0,3}([-*_])\\s*(?:\\1\\s*){2,}$/;\nconst QUOTE = /^\\s{0,3}>\\s?(.*)$/;\n/**\n * The opener of a list item: indentation, marker and the whitespace that\n * separates the marker from the content.\n *\n * The content is sliced off with a string operation rather than captured,\n * because it may not hold U+2028/U+2029. Those are line terminators the old\n * `(.*)$` could not cross, so a line with one after the marker was a paragraph\n * and has to stay one. Capturing the content with a regex that stops at them (a\n * `[^\\u2028\\u2029]*`) would put the separator and the content back to racing for\n * a run of spaces — quadratic, 3.6 s for a bullet padded with 80 000 spaces\n * (#478). Matching only the opener and slicing sidesteps that entirely.\n *\n * The separator is `[^\\S\\n\\r]`: every whitespace character except CR and LF,\n * which a line never contains. That keeps a separator a person pastes from Word\n * or Docs — NBSP, a form feed, a leading BOM — reading as a list, exactly as the\n * old `\\s+` did, instead of silently turning the line into a paragraph.\n */\nconst BULLET_OPENER = /^([^\\S\\n\\r]*)([-*+])[^\\S\\n\\r]+/;\nconst ORDERED_OPENER = /^([^\\S\\n\\r]*)(\\d{1,9})[.)][^\\S\\n\\r]+/;\n\n/** A list item's opener: how far it is indented, its marker and its content. */\ninterface ListOpener {\n indent: string;\n marker: string;\n content: string;\n}\n\n/**\n * Read a list item's opener, or `null` when the line is not one.\n *\n * A line whose content holds U+2028/U+2029 is not a list item: the old `(.*)$`\n * stopped at the separator, never reached `$`, and left the line a paragraph,\n * and {@link parseMarkdown} still splits only on `\\n` and `\\r`. Keeping that\n * here is what lets the opener stay a plain pattern with no `.*` to race.\n *\n * @param pattern - {@link BULLET_OPENER} or {@link ORDERED_OPENER}.\n * @param line - One source line.\n * @returns The opener, or `null` when the line is not a list item.\n */\nfunction matchListOpener(pattern: RegExp, line: string): ListOpener | null {\n const match = pattern.exec(line);\n if (!match) return null;\n const content = line.slice(match[0].length);\n if (content.includes(\"\\u2028\") || content.includes(\"\\u2029\")) return null;\n return { indent: match[1], marker: match[2], content };\n}\n\n/** {@link matchListOpener} for a bullet. */\nfunction matchBullet(line: string): ListOpener | null {\n return matchListOpener(BULLET_OPENER, line);\n}\n\n/** {@link matchListOpener} for an ordered marker. */\nfunction matchOrdered(line: string): ListOpener | null {\n return matchListOpener(ORDERED_OPENER, line);\n}\n/**\n * A table's delimiter row, matched against the line **after** `trimEnd()`.\n *\n * The `|` is required somewhere in the line, and that is what tells a one-column\n * table (`| --- |`) apart from a thematic break (`---`) — a single column is a\n * legitimate table, and the first version of this regex demanded two. The trailing\n * whitespace is trimmed before the test for the same reason as {@link FENCE}: a\n * `\\s*\\|?\\s*$` tail backtracked quadratically on `- |` plus 50 000 spaces (#437).\n */\nconst TABLE_DELIMITER = /^\\s{0,3}\\|[\\s|:-]*$|^\\s{0,3}:?-+:?(\\s*\\|\\s*:?-+:?)+\\s*\\|?$/;\n\n/**\n * How deep quotes and lists may nest before the rest is read as a paragraph.\n *\n * Each level is one recursive {@link parseBlocks} call and one nested element in\n * the render, so `\"- \".repeat(20000)` used to throw `RangeError: Maximum call stack\n * size exceeded` out of the component (#437). Real documents stop at a handful of\n * levels; past this cap the words are kept, only the nesting is dropped.\n */\nconst MAX_NESTING_DEPTH = 32;\n\n/**\n * Match an ATX heading in linear time.\n *\n * The regex this replaces, `/^\\s{0,3}(#{1,6})\\s+(.*?)\\s*#*\\s*$/`, let a lazy `.*?`\n * and two `\\s*` race for the same run of spaces: `\"# a\" + \" \".repeat(4000) + \"b\"`\n * took about 4.7 s, cubic in the run (#437). Only the opening marker is a regex\n * now. The text is the rest of the line minus the longest suffix shaped like\n * `\\s*#*\\s*` — exactly what the lazy group left behind, so `# título #`,\n * `# título#` and `# #` read as before.\n *\n * @param line - One source line.\n * @returns The level and raw text, or `null` when the line is not a heading.\n */\nfunction matchHeading(line: string): { level: number; text: string } | null {\n const open = HEADING_OPEN.exec(line);\n if (!open) return null;\n let text = line.slice(open[0].length).trimEnd();\n let end = text.length;\n while (end > 0 && text[end - 1] === \"#\") end -= 1;\n text = text.slice(0, end).trimEnd();\n return { level: open[1].length, text };\n}\n\n/**\n * Whether a paragraph line ends in a hard break: two or more trailing spaces.\n *\n * `/ {2,}$/` was quadratic on a line with a long inner run of spaces — it retried\n * the run from every space and failed at the next word each time (0.57 s for\n * 50 000 spaces, #437).\n */\nfunction endsWithHardBreak(line: string): boolean {\n return line.endsWith(\" \");\n}\n\n/**\n * Parse a Markdown document into blocks.\n *\n * @param source - Raw Markdown.\n * @returns Block nodes in document order.\n */\nexport function parseMarkdown(source: string): MarkdownBlock[] {\n const lines = source.replace(/\\r\\n?/g, \"\\n\").split(\"\\n\");\n return parseBlocks(lines, 0);\n}\n\n/**\n * Parse a run of lines into blocks.\n *\n * @param lines - The lines of this container.\n * @param depth - How many quotes and lists enclose them. At\n * {@link MAX_NESTING_DEPTH} the lines become one paragraph instead of more\n * containers, so a hostile document cannot exhaust the stack.\n * @returns The blocks.\n */\nfunction parseBlocks(lines: string[], depth: number): MarkdownBlock[] {\n if (depth >= MAX_NESTING_DEPTH) {\n const source = lines\n .map((line) => line.trim())\n .filter(Boolean)\n .join(\"\\n\");\n return source ? [{ type: \"paragraph\", children: parseInline(source) }] : [];\n }\n const blocks: MarkdownBlock[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n\n if (line.trim() === \"\") {\n i += 1;\n continue;\n }\n\n const fence = FENCE.exec(line.trimEnd());\n if (fence) {\n const marker = fence[1][0];\n const body: string[] = [];\n i += 1;\n while (i < lines.length && !new RegExp(`^\\\\s{0,3}${marker}{3,}\\\\s*$`).test(lines[i])) {\n body.push(lines[i]);\n i += 1;\n }\n // An unterminated fence still yields a code block: the alternative is to\n // render the rest of the document as prose full of backticks.\n i += 1;\n blocks.push({ type: \"code\", language: fence[2] || null, value: body.join(\"\\n\") });\n continue;\n }\n\n const heading = matchHeading(line);\n if (heading) {\n blocks.push({\n type: \"heading\",\n level: heading.level,\n children: parseInline(heading.text),\n });\n i += 1;\n continue;\n }\n\n if (RULE.test(line)) {\n blocks.push({ type: \"rule\" });\n i += 1;\n continue;\n }\n\n if (QUOTE.test(line)) {\n const inner: string[] = [];\n while (i < lines.length) {\n const match = QUOTE.exec(lines[i]);\n if (match) {\n inner.push(match[1]);\n i += 1;\n continue;\n }\n // A blank line ends the quote; a plain line continues it (lazy\n // continuation), which is how people actually write quotes.\n if (lines[i].trim() === \"\") break;\n inner.push(lines[i]);\n i += 1;\n }\n blocks.push({ type: \"quote\", children: parseBlocks(inner, depth + 1) });\n continue;\n }\n\n if (matchBullet(line) || matchOrdered(line)) {\n const [list, next] = parseList(lines, i, depth);\n blocks.push(list);\n i = next;\n continue;\n }\n\n if (\n i + 1 < lines.length &&\n line.includes(\"|\") &&\n TABLE_DELIMITER.test(lines[i + 1].trimEnd())\n ) {\n const [table, next] = parseTable(lines, i);\n blocks.push(table);\n i = next;\n continue;\n }\n\n const paragraph: string[] = [];\n const hardBreaks: boolean[] = [];\n while (i < lines.length && lines[i].trim() !== \"\") {\n const current = lines[i];\n if (\n matchHeading(current) ||\n RULE.test(current) ||\n FENCE.test(current.trimEnd()) ||\n QUOTE.test(current) ||\n matchBullet(current) ||\n matchOrdered(current)\n ) {\n break;\n }\n paragraph.push(current.trim());\n hardBreaks.push(endsWithHardBreak(current));\n i += 1;\n }\n if (paragraph.length > 0) {\n blocks.push({\n type: \"paragraph\",\n children: parseInline(joinParagraph(paragraph, hardBreaks)),\n });\n }\n }\n\n return blocks;\n}\n\n/**\n * Re-join the lines of a paragraph, keeping the two-space hard break.\n *\n * Every line is trimmed before it is parsed, because leading indentation is not\n * content and a trailing space is invisible noise in almost every line. The one\n * exception is the CommonMark hard break: two or more trailing spaces mean\n * \"break the line here\", so trimming first would delete the only mark that says\n * so and the ` \\n` inline rule could never match. The flag is recorded before\n * the trim and the marker put back here, on every line but the last — a break\n * after the final line of a paragraph would break into nothing.\n *\n * @param lines - The trimmed lines, in order.\n * @param hardBreaks - Whether each line ended in two or more spaces.\n * @returns The paragraph source the inline parser reads.\n */\nfunction joinParagraph(lines: readonly string[], hardBreaks: readonly boolean[]): string {\n return lines\n .map((line, index) => (hardBreaks[index] && index < lines.length - 1 ? `${line} ` : line))\n .join(\"\\n\");\n}\n\n/**\n * Parse a list, including nested lists and multi-line items.\n *\n * Nesting is decided by indentation relative to the **first** item's marker, so a\n * list indented inside a quote or another list still reads correctly.\n *\n * @param lines - The lines of the enclosing container.\n * @param start - Index of the first item's line.\n * @param depth - Nesting depth of the enclosing container.\n * @returns The list node and the index of the first line after it.\n */\nfunction parseList(lines: string[], start: number, depth: number): [MarkdownBlock, number] {\n const bulletStart = matchBullet(lines[start]);\n const orderedStart = matchOrdered(lines[start]);\n // The two markers are mutually exclusive — `-*+` versus digits — so whichever\n // matched decides the list kind.\n const ordered = orderedStart !== null;\n const first = orderedStart ?? bulletStart;\n const baseIndent = first?.indent.length ?? 0;\n const startNumber = ordered ? Number(orderedStart?.marker ?? 1) : 1;\n\n const items: MarkdownBlock[][] = [];\n let buffer: string[] = [];\n let i = start;\n\n const flush = (): void => {\n if (buffer.length === 0) return;\n items.push(parseBlocks(buffer, depth + 1));\n buffer = [];\n };\n\n while (i < lines.length) {\n const line = lines[i];\n if (line.trim() === \"\") {\n // A single blank line inside a list is a loose item, not the end. Two in\n // a row end it, which is what a blank-then-paragraph document means.\n if (i + 1 < lines.length && lines[i + 1].trim() !== \"\") {\n buffer.push(\"\");\n i += 1;\n continue;\n }\n break;\n }\n const bullet = matchBullet(line);\n const numbered = matchOrdered(line);\n const match = bullet ?? numbered;\n\n if (match && match.indent.length <= baseIndent) {\n const sameKind = ordered ? Boolean(numbered) : Boolean(bullet);\n if (!sameKind) break;\n flush();\n buffer.push(match.content);\n i += 1;\n continue;\n }\n if (match) {\n // Deeper marker: keep the indentation so the recursive call sees a list.\n buffer.push(line.slice(baseIndent));\n i += 1;\n continue;\n }\n if (line.search(/\\S/) > baseIndent) {\n buffer.push(line.trim());\n i += 1;\n continue;\n }\n break;\n }\n flush();\n\n return [{ type: \"list\", ordered, start: startNumber, items }, i];\n}\n\n/** Split a table row on unescaped pipes. */\nfunction splitRow(line: string): string[] {\n const trimmed = line.trim().replace(/^\\|/, \"\").replace(/\\|$/, \"\");\n const cells: string[] = [];\n let current = \"\";\n for (let i = 0; i < trimmed.length; i += 1) {\n if (trimmed[i] === \"\\\\\" && trimmed[i + 1] === \"|\") {\n current += \"|\";\n i += 1;\n continue;\n }\n if (trimmed[i] === \"|\") {\n cells.push(current);\n current = \"\";\n continue;\n }\n current += trimmed[i];\n }\n cells.push(current);\n return cells.map((cell) => cell.trim());\n}\n\n/**\n * Parse a GFM pipe table.\n *\n * @returns The table node and the index of the first line after it.\n */\nfunction parseTable(lines: string[], start: number): [MarkdownBlock, number] {\n const head = splitRow(lines[start]);\n const align: MarkdownAlign[] = splitRow(lines[start + 1]).map((cell) => {\n const left = cell.startsWith(\":\");\n const right = cell.endsWith(\":\");\n if (left && right) return \"center\";\n if (right) return \"right\";\n if (left) return \"left\";\n return null;\n });\n\n const rows: MarkdownInline[][][] = [];\n let i = start + 2;\n while (i < lines.length && lines[i].trim() !== \"\" && lines[i].includes(\"|\")) {\n rows.push(splitRow(lines[i]).map(parseInline));\n i += 1;\n }\n\n return [{ type: \"table\", align, head: head.map(parseInline), rows }, i];\n}\n\n/**\n * The precheck a rule needs before its pattern may run, keyed by the opener the\n * pattern starts with.\n *\n * `link` covers links and images, whose label ends at the first `]`; `autolink`\n * covers `<scheme:...>`, which ends at the first `>` or whitespace. Without the\n * precheck each pattern scanned to the end of the text from every opener, and\n * `\"[\".repeat(50000)` took 0.6 s (#437).\n */\ntype InlineGuard = { kind: \"link\"; opener: \"[\" | \"![\" } | { kind: \"autolink\"; opener: \"<\" };\n\n/** Inline delimiters, longest marker first so `**` wins over `*`. */\nconst INLINE_RULES: Array<{\n first: string;\n pattern: RegExp;\n guard?: InlineGuard;\n build: (match: RegExpExecArray) => MarkdownInline | null;\n}> = [\n {\n guard: { kind: \"link\", opener: \"![\" },\n first: \"!\",\n pattern: /^!\\[([^\\]]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)(?:\\s+\"[^\"]*\")?\\)/,\n build: (match) => {\n const src = safeImageUrl(match[2]);\n return src ? { type: \"image\", src, alt: match[1] } : { type: \"text\", value: match[1] };\n },\n },\n {\n guard: { kind: \"link\", opener: \"[\" },\n first: \"[\",\n pattern: /^\\[([^\\]]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)(?:\\s+\"[^\"]*\")?\\)/,\n build: (match) => {\n const href = safeLinkUrl(match[2]);\n const children = parseInline(match[1]);\n // A rejected URL keeps the label as plain text: dropping the text too\n // would silently delete words somebody wrote.\n return href ? { type: \"link\", href, children } : { type: \"text\", value: match[1] };\n },\n },\n { first: \"`\", pattern: /^`([^`]+)`/, build: (match) => ({ type: \"code\", value: match[1] }) },\n {\n first: \"*\",\n pattern: /^\\*\\*([\\s\\S]+?)\\*\\*/,\n build: (match) => ({ type: \"strong\", children: parseInline(match[1]) }),\n },\n {\n first: \"_\",\n pattern: /^__([\\s\\S]+?)__/,\n build: (match) => ({ type: \"strong\", children: parseInline(match[1]) }),\n },\n {\n first: \"~\",\n pattern: /^~~([\\s\\S]+?)~~/,\n build: (match) => ({ type: \"del\", children: parseInline(match[1]) }),\n },\n {\n first: \"*\",\n pattern: /^\\*([^*\\n]+)\\*/,\n build: (match) => ({ type: \"em\", children: parseInline(match[1]) }),\n },\n {\n first: \"_\",\n pattern: /^_([^_\\n]+)_/,\n build: (match) => ({ type: \"em\", children: parseInline(match[1]) }),\n },\n {\n guard: { kind: \"autolink\", opener: \"<\" },\n first: \"<\",\n pattern: /^<((?:https?:\\/\\/|mailto:)[^>\\s]+)>/,\n build: (match) => {\n const href = safeLinkUrl(match[1]);\n return href\n ? { type: \"link\", href, children: [{ type: \"text\", value: match[1] }] }\n : { type: \"text\", value: match[1] };\n },\n },\n { first: \"\\\\\", pattern: /^\\\\\\n/, build: () => ({ type: \"break\" }) },\n];\n\n/** Characters some inline rule can start with; any other character is text. */\nconst INLINE_FIRST = new Set(INLINE_RULES.map((rule) => rule.first));\n\n/**\n * Parse inline Markdown.\n *\n * A backslash escapes the next character, so `\\*not italic\\*` renders with the\n * asterisks. Anything that matches no rule is text — an unclosed `**` is two\n * asterisks, not a bold run to the end of the paragraph.\n *\n * The parse is linear in the text, which matters because the text is somebody\n * else's (#437):\n *\n * - A run of spaces is consumed whole: it is a hard break when two or more of them\n * end at a newline, and text otherwise. Matching `^ {2,}\\n` from every space\n * rescanned the run each time.\n * - A link or image label ends at the first `]` after the opener, so every opener\n * before the same `]` shares the same `](...)` tail. The position of that `]` is\n * cached, an opener whose `]` is not followed by `(` is skipped without running\n * the pattern, and once a tail has failed no later opener retries it.\n * - An autolink ends at the first `>` or whitespace, also cached; when that stop\n * is not `>` the pattern cannot match and is not run.\n * - A rule runs only at its own first character, so a run of `[` costs one set\n * lookup per character instead of every pattern in the table.\n *\n * @param source - One block's text.\n * @returns Inline nodes.\n */\nexport function parseInline(source: string): MarkdownInline[] {\n const nodes: MarkdownInline[] = [];\n let text = \"\";\n let i = 0;\n\n let bracketAt = -1;\n let deadTailAt = -1;\n let stopAt = -1;\n const stops = /[>\\s]/g;\n\n const flush = (): void => {\n if (text) nodes.push({ type: \"text\", value: text });\n text = \"\";\n };\n\n const closingBracket = (from: number): number => {\n if (bracketAt < from) {\n const found = source.indexOf(\"]\", from);\n bracketAt = found === -1 ? source.length : found;\n }\n return bracketAt;\n };\n\n const autolinkStop = (from: number): number => {\n if (stopAt < from) {\n stops.lastIndex = from;\n stopAt = stops.exec(source)?.index ?? source.length;\n }\n return stopAt;\n };\n\n const allowed = (guard: InlineGuard | undefined): boolean => {\n if (!guard) return true;\n if (!source.startsWith(guard.opener, i)) return false;\n if (guard.kind === \"autolink\") return source[autolinkStop(i + 1)] === \">\";\n const close = closingBracket(i + guard.opener.length);\n return source[close + 1] === \"(\" && close !== deadTailAt;\n };\n\n while (i < source.length) {\n if (source[i] === \"\\\\\" && i + 1 < source.length && source[i + 1] !== \"\\n\") {\n text += source[i + 1];\n i += 2;\n continue;\n }\n\n if (source[i] === \" \") {\n let end = i;\n while (source[end] === \" \") end += 1;\n if (end - i >= 2 && source[end] === \"\\n\") {\n flush();\n nodes.push({ type: \"break\" });\n i = end + 1;\n } else {\n text += source.slice(i, end);\n i = end;\n }\n continue;\n }\n\n if (!INLINE_FIRST.has(source[i])) {\n text += source[i];\n i += 1;\n continue;\n }\n\n const rest = source.slice(i);\n let matched = false;\n for (const rule of INLINE_RULES) {\n if (rule.first !== source[i] || !allowed(rule.guard)) continue;\n const match = rule.pattern.exec(rest);\n if (!match) {\n if (rule.guard?.kind === \"link\") {\n deadTailAt = closingBracket(i + rule.guard.opener.length);\n }\n continue;\n }\n const node = rule.build(match);\n if (!node) continue;\n flush();\n nodes.push(node);\n i += match[0].length;\n matched = true;\n break;\n }\n if (matched) continue;\n\n text += source[i];\n i += 1;\n }\n\n flush();\n return nodes;\n}\n"],"mappings":";;AA0DA,IAAM,IAAQ,sCAKR,IAAe,uBACf,IAAO,oCACP,IAAQ,qBAkBR,IAAgB,kCAChB,IAAiB;AAqBvB,SAAS,EAAgB,GAAiB,GAAiC;CACvE,IAAM,IAAQ,EAAQ,KAAK,CAAI;CAC/B,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAU,EAAK,MAAM,EAAM,EAAE,CAAC,MAAM;CAE1C,OADI,EAAQ,SAAS,QAAQ,KAAK,EAAQ,SAAS,QAAQ,IAAU,OAC9D;EAAE,QAAQ,EAAM;EAAI,QAAQ,EAAM;EAAI;CAAQ;AACzD;AAGA,SAAS,EAAY,GAAiC;CAClD,OAAO,EAAgB,GAAe,CAAI;AAC9C;AAGA,SAAS,EAAa,GAAiC;CACnD,OAAO,EAAgB,GAAgB,CAAI;AAC/C;AAUA,IAAM,IAAkB,8DAUlB,IAAoB;AAe1B,SAAS,EAAa,GAAsD;CACxE,IAAM,IAAO,EAAa,KAAK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`,n=`tempest_positionTopLeft_Z-tMJ`,r=`tempest_positionTopCenter_A4Ze4`,i=`tempest_positionBottomRight_MGo19`,a=`tempest_positionBottomLeft_DpiNe`,o=`tempest_positionBottomCenter_XUdok`,s=`tempest_toast_FLdHz`,c=`tempest_tempest-toast-in_E2d-A`,l=`tempest_success_Oy694`,u=`tempest_warning_84GC8`,d=`tempest_error_hrQAA`,f=`tempest_info_eq5bQ`,p=`tempest_title_-H6R2`,m=`tempest_description_-QwfC`,h=`tempest_close_i10-s`,
|
|
2
|
+
var e=`tempest_container_x4-Qm`,t=`tempest_positionTopRight_gbUCQ`,n=`tempest_positionTopLeft_Z-tMJ`,r=`tempest_positionTopCenter_A4Ze4`,i=`tempest_positionBottomRight_MGo19`,a=`tempest_positionBottomLeft_DpiNe`,o=`tempest_positionBottomCenter_XUdok`,s=`tempest_toast_FLdHz`,c=`tempest_tempest-toast-in_E2d-A`,l=`tempest_success_Oy694`,u=`tempest_warning_84GC8`,d=`tempest_error_hrQAA`,f=`tempest_info_eq5bQ`,p=`tempest_title_-H6R2`,m=`tempest_description_-QwfC`,h=`tempest_content_U6Xwq`,g=`tempest_withIcon_2Z8Sz`,_=`tempest_alignCenter_GpnzD`,v=`tempest_leading_L3de1`,y=`tempest_close_i10-s`,b={container:e,positionTopRight:t,positionTopLeft:n,positionTopCenter:r,positionBottomRight:i,positionBottomLeft:a,positionBottomCenter:o,toast:s,tempestToastIn:c,success:l,warning:u,error:d,info:f,title:p,description:m,content:h,withIcon:g,alignCenter:_,leading:v,close:y};exports.alignCenter=_,exports.close=y,exports.container=e,exports.content=h,exports.default=b,exports.description=m,exports.error=d,exports.info=f,exports.leading=v,exports.positionBottomCenter=o,exports.positionBottomLeft=a,exports.positionBottomRight=i,exports.positionTopCenter=r,exports.positionTopLeft=n,exports.positionTopRight=t,exports.success=l,exports.tempestToastIn=c,exports.title=p,exports.toast=s,exports.warning=u,exports.withIcon=g;
|
|
3
3
|
//# sourceMappingURL=Toast.module.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.module.cjs","names":[],"sources":["../../../src/components/Toast/Toast.module.css"],"sourcesContent":[".container {\n position: fixed;\n display: flex;\n flex-direction: column;\n gap: var(--tempest-space-2);\n z-index: var(--tempest-z-toast);\n pointer-events: none;\n max-width: 100%;\n}\n\n/* Top */\n.positionTopRight {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionTopLeft {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionTopCenter {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Bottom */\n.positionBottomRight {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionBottomLeft {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionBottomCenter {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Mobile — stretch full width and respect safe areas. */\n@media (max-width: 480px) {\n .container {\n left: max(var(--tempest-space-3), var(--tempest-safe-area-left)) !important;\n right: max(var(--tempest-space-3), var(--tempest-safe-area-right)) !important;\n transform: none !important;\n }\n .positionTopRight,\n .positionTopLeft,\n .positionTopCenter {\n top: max(var(--tempest-space-3), var(--tempest-safe-area-top));\n }\n .positionBottomRight,\n .positionBottomLeft,\n .positionBottomCenter {\n bottom: max(var(--tempest-space-3), var(--tempest-safe-area-bottom));\n }\n .toast {\n min-width: 0;\n max-width: 100%;\n }\n}\n\n.toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: var(--tempest-space-3);\n padding: var(--tempest-space-3) var(--tempest-space-4);\n border-radius: var(--tempest-radius-lg);\n background-color: var(--tempest-bg);\n border: 1px solid var(--tempest-border);\n box-shadow: var(--tempest-shadow-lg);\n min-width: 280px;\n max-width: 420px;\n animation: tempest-toast-in var(--tempest-duration-base) var(--tempest-ease-emphasized);\n}\n\n.success {\n border-left: 4px solid var(--tempest-success-solid);\n}\n.warning {\n border-left: 4px solid var(--tempest-warning-solid);\n}\n.error {\n border-left: 4px solid var(--tempest-danger-solid);\n}\n.info {\n border-left: 4px solid var(--tempest-info-solid);\n}\n\n.title {\n font-family: var(--tempest-font-sans);\n font-weight: var(--tempest-weight-semibold);\n font-size: var(--tempest-text-base);\n color: var(--tempest-text);\n line-height: var(--tempest-leading-snug);\n margin: 0;\n}\n\n.description {\n font-size: var(--tempest-text-sm);\n color: var(--tempest-text-muted);\n line-height: var(--tempest-leading-snug);\n margin: 2px 0 0 0;\n}\n\n.close {\n margin-left: auto;\n background: none;\n border: none;\n color: var(--tempest-text-muted);\n padding: 4px;\n border-radius: var(--tempest-radius-sm);\n display: flex;\n align-items: center;\n transition: var(--tempest-transition-color);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .close:hover {\n background-color: var(--tempest-surface);\n color: var(--tempest-text);\n }\n}\n\n.close:focus-visible {\n outline: var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);\n outline-offset: var(--tempest-focus-ring-offset);\n}\n\n@keyframes tempest-toast-in {\n from {\n transform: translateX(24px);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n}\n"],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Toast.module.cjs","names":[],"sources":["../../../src/components/Toast/Toast.module.css"],"sourcesContent":[".container {\n position: fixed;\n display: flex;\n flex-direction: column;\n gap: var(--tempest-space-2);\n z-index: var(--tempest-z-toast);\n pointer-events: none;\n max-width: 100%;\n}\n\n/* Top */\n.positionTopRight {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionTopLeft {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionTopCenter {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Bottom */\n.positionBottomRight {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionBottomLeft {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionBottomCenter {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Mobile — stretch full width and respect safe areas. */\n@media (max-width: 480px) {\n .container {\n left: max(var(--tempest-space-3), var(--tempest-safe-area-left)) !important;\n right: max(var(--tempest-space-3), var(--tempest-safe-area-right)) !important;\n transform: none !important;\n }\n .positionTopRight,\n .positionTopLeft,\n .positionTopCenter {\n top: max(var(--tempest-space-3), var(--tempest-safe-area-top));\n }\n .positionBottomRight,\n .positionBottomLeft,\n .positionBottomCenter {\n bottom: max(var(--tempest-space-3), var(--tempest-safe-area-bottom));\n }\n .toast {\n min-width: 0;\n max-width: 100%;\n }\n}\n\n.toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: var(--tempest-space-3);\n padding: var(--tempest-space-3) var(--tempest-space-4);\n border-radius: var(--tempest-radius-lg);\n background-color: var(--tempest-bg);\n border: 1px solid var(--tempest-border);\n box-shadow: var(--tempest-shadow-lg);\n min-width: 280px;\n max-width: 420px;\n animation: tempest-toast-in var(--tempest-duration-base) var(--tempest-ease-emphasized);\n}\n\n.success {\n border-left: 4px solid var(--tempest-success-solid);\n}\n.warning {\n border-left: 4px solid var(--tempest-warning-solid);\n}\n.error {\n border-left: 4px solid var(--tempest-danger-solid);\n}\n.info {\n border-left: 4px solid var(--tempest-info-solid);\n}\n\n.title {\n font-family: var(--tempest-font-sans);\n font-weight: var(--tempest-weight-semibold);\n font-size: var(--tempest-text-base);\n color: var(--tempest-text);\n line-height: var(--tempest-leading-snug);\n margin: 0;\n}\n\n.description {\n font-size: var(--tempest-text-sm);\n color: var(--tempest-text-muted);\n line-height: var(--tempest-leading-snug);\n margin: 2px 0 0 0;\n}\n\n.content {\n flex: 1 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.withIcon .content {\n align-self: center;\n}\n\n.alignCenter .content {\n text-align: center;\n}\n\n.leading {\n flex: 0 0 auto;\n align-self: center;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--tempest-text);\n}\n\n.leading img,\n.leading svg {\n display: block;\n max-width: var(--tempest-space-8);\n max-height: var(--tempest-space-8);\n object-fit: contain;\n}\n\n.close {\n flex: 0 0 auto;\n margin-left: auto;\n background: none;\n border: none;\n color: var(--tempest-text-muted);\n padding: 4px;\n border-radius: var(--tempest-radius-sm);\n display: flex;\n align-items: center;\n transition: var(--tempest-transition-color);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .close:hover {\n background-color: var(--tempest-surface);\n color: var(--tempest-text);\n }\n}\n\n.close:focus-visible {\n outline: var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);\n outline-offset: var(--tempest-focus-ring-offset);\n}\n\n@keyframes tempest-toast-in {\n from {\n transform: translateX(24px);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n}\n"],"mappings":";"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../styles/component/Toast.css";
|
|
2
2
|
//#region src/components/Toast/Toast.module.css
|
|
3
|
-
var e = "tempest_container_x4-Qm", t = "tempest_positionTopRight_gbUCQ", n = "tempest_positionTopLeft_Z-tMJ", r = "tempest_positionTopCenter_A4Ze4", i = "tempest_positionBottomRight_MGo19", a = "tempest_positionBottomLeft_DpiNe", o = "tempest_positionBottomCenter_XUdok", s = "tempest_toast_FLdHz", c = "tempest_tempest-toast-in_E2d-A", l = "tempest_success_Oy694", u = "tempest_warning_84GC8", d = "tempest_error_hrQAA", f = "tempest_info_eq5bQ", p = "tempest_title_-H6R2", m = "tempest_description_-QwfC", h = "tempest_close_i10-s",
|
|
3
|
+
var e = "tempest_container_x4-Qm", t = "tempest_positionTopRight_gbUCQ", n = "tempest_positionTopLeft_Z-tMJ", r = "tempest_positionTopCenter_A4Ze4", i = "tempest_positionBottomRight_MGo19", a = "tempest_positionBottomLeft_DpiNe", o = "tempest_positionBottomCenter_XUdok", s = "tempest_toast_FLdHz", c = "tempest_tempest-toast-in_E2d-A", l = "tempest_success_Oy694", u = "tempest_warning_84GC8", d = "tempest_error_hrQAA", f = "tempest_info_eq5bQ", p = "tempest_title_-H6R2", m = "tempest_description_-QwfC", h = "tempest_content_U6Xwq", g = "tempest_withIcon_2Z8Sz", _ = "tempest_alignCenter_GpnzD", v = "tempest_leading_L3de1", y = "tempest_close_i10-s", b = {
|
|
4
4
|
container: e,
|
|
5
5
|
positionTopRight: t,
|
|
6
6
|
positionTopLeft: n,
|
|
@@ -16,9 +16,13 @@ var e = "tempest_container_x4-Qm", t = "tempest_positionTopRight_gbUCQ", n = "te
|
|
|
16
16
|
info: f,
|
|
17
17
|
title: p,
|
|
18
18
|
description: m,
|
|
19
|
-
|
|
19
|
+
content: h,
|
|
20
|
+
withIcon: g,
|
|
21
|
+
alignCenter: _,
|
|
22
|
+
leading: v,
|
|
23
|
+
close: y
|
|
20
24
|
};
|
|
21
25
|
//#endregion
|
|
22
|
-
export {
|
|
26
|
+
export { _ as alignCenter, y as close, e as container, h as content, b as default, m as description, d as error, f as info, v as leading, o as positionBottomCenter, a as positionBottomLeft, i as positionBottomRight, r as positionTopCenter, n as positionTopLeft, t as positionTopRight, l as success, c as tempestToastIn, p as title, s as toast, u as warning, g as withIcon };
|
|
23
27
|
|
|
24
28
|
//# sourceMappingURL=Toast.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.module.js","names":[],"sources":["../../../src/components/Toast/Toast.module.css"],"sourcesContent":[".container {\n position: fixed;\n display: flex;\n flex-direction: column;\n gap: var(--tempest-space-2);\n z-index: var(--tempest-z-toast);\n pointer-events: none;\n max-width: 100%;\n}\n\n/* Top */\n.positionTopRight {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionTopLeft {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionTopCenter {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Bottom */\n.positionBottomRight {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionBottomLeft {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionBottomCenter {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Mobile — stretch full width and respect safe areas. */\n@media (max-width: 480px) {\n .container {\n left: max(var(--tempest-space-3), var(--tempest-safe-area-left)) !important;\n right: max(var(--tempest-space-3), var(--tempest-safe-area-right)) !important;\n transform: none !important;\n }\n .positionTopRight,\n .positionTopLeft,\n .positionTopCenter {\n top: max(var(--tempest-space-3), var(--tempest-safe-area-top));\n }\n .positionBottomRight,\n .positionBottomLeft,\n .positionBottomCenter {\n bottom: max(var(--tempest-space-3), var(--tempest-safe-area-bottom));\n }\n .toast {\n min-width: 0;\n max-width: 100%;\n }\n}\n\n.toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: var(--tempest-space-3);\n padding: var(--tempest-space-3) var(--tempest-space-4);\n border-radius: var(--tempest-radius-lg);\n background-color: var(--tempest-bg);\n border: 1px solid var(--tempest-border);\n box-shadow: var(--tempest-shadow-lg);\n min-width: 280px;\n max-width: 420px;\n animation: tempest-toast-in var(--tempest-duration-base) var(--tempest-ease-emphasized);\n}\n\n.success {\n border-left: 4px solid var(--tempest-success-solid);\n}\n.warning {\n border-left: 4px solid var(--tempest-warning-solid);\n}\n.error {\n border-left: 4px solid var(--tempest-danger-solid);\n}\n.info {\n border-left: 4px solid var(--tempest-info-solid);\n}\n\n.title {\n font-family: var(--tempest-font-sans);\n font-weight: var(--tempest-weight-semibold);\n font-size: var(--tempest-text-base);\n color: var(--tempest-text);\n line-height: var(--tempest-leading-snug);\n margin: 0;\n}\n\n.description {\n font-size: var(--tempest-text-sm);\n color: var(--tempest-text-muted);\n line-height: var(--tempest-leading-snug);\n margin: 2px 0 0 0;\n}\n\n.close {\n margin-left: auto;\n background: none;\n border: none;\n color: var(--tempest-text-muted);\n padding: 4px;\n border-radius: var(--tempest-radius-sm);\n display: flex;\n align-items: center;\n transition: var(--tempest-transition-color);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .close:hover {\n background-color: var(--tempest-surface);\n color: var(--tempest-text);\n }\n}\n\n.close:focus-visible {\n outline: var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);\n outline-offset: var(--tempest-focus-ring-offset);\n}\n\n@keyframes tempest-toast-in {\n from {\n transform: translateX(24px);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n}\n"],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Toast.module.js","names":[],"sources":["../../../src/components/Toast/Toast.module.css"],"sourcesContent":[".container {\n position: fixed;\n display: flex;\n flex-direction: column;\n gap: var(--tempest-space-2);\n z-index: var(--tempest-z-toast);\n pointer-events: none;\n max-width: 100%;\n}\n\n/* Top */\n.positionTopRight {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionTopLeft {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionTopCenter {\n top: max(var(--tempest-space-4), var(--tempest-safe-area-top));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Bottom */\n.positionBottomRight {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n right: max(var(--tempest-space-4), var(--tempest-safe-area-right));\n}\n.positionBottomLeft {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: max(var(--tempest-space-4), var(--tempest-safe-area-left));\n}\n.positionBottomCenter {\n bottom: max(var(--tempest-space-4), var(--tempest-safe-area-bottom));\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n/* Mobile — stretch full width and respect safe areas. */\n@media (max-width: 480px) {\n .container {\n left: max(var(--tempest-space-3), var(--tempest-safe-area-left)) !important;\n right: max(var(--tempest-space-3), var(--tempest-safe-area-right)) !important;\n transform: none !important;\n }\n .positionTopRight,\n .positionTopLeft,\n .positionTopCenter {\n top: max(var(--tempest-space-3), var(--tempest-safe-area-top));\n }\n .positionBottomRight,\n .positionBottomLeft,\n .positionBottomCenter {\n bottom: max(var(--tempest-space-3), var(--tempest-safe-area-bottom));\n }\n .toast {\n min-width: 0;\n max-width: 100%;\n }\n}\n\n.toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: var(--tempest-space-3);\n padding: var(--tempest-space-3) var(--tempest-space-4);\n border-radius: var(--tempest-radius-lg);\n background-color: var(--tempest-bg);\n border: 1px solid var(--tempest-border);\n box-shadow: var(--tempest-shadow-lg);\n min-width: 280px;\n max-width: 420px;\n animation: tempest-toast-in var(--tempest-duration-base) var(--tempest-ease-emphasized);\n}\n\n.success {\n border-left: 4px solid var(--tempest-success-solid);\n}\n.warning {\n border-left: 4px solid var(--tempest-warning-solid);\n}\n.error {\n border-left: 4px solid var(--tempest-danger-solid);\n}\n.info {\n border-left: 4px solid var(--tempest-info-solid);\n}\n\n.title {\n font-family: var(--tempest-font-sans);\n font-weight: var(--tempest-weight-semibold);\n font-size: var(--tempest-text-base);\n color: var(--tempest-text);\n line-height: var(--tempest-leading-snug);\n margin: 0;\n}\n\n.description {\n font-size: var(--tempest-text-sm);\n color: var(--tempest-text-muted);\n line-height: var(--tempest-leading-snug);\n margin: 2px 0 0 0;\n}\n\n.content {\n flex: 1 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.withIcon .content {\n align-self: center;\n}\n\n.alignCenter .content {\n text-align: center;\n}\n\n.leading {\n flex: 0 0 auto;\n align-self: center;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--tempest-text);\n}\n\n.leading img,\n.leading svg {\n display: block;\n max-width: var(--tempest-space-8);\n max-height: var(--tempest-space-8);\n object-fit: contain;\n}\n\n.close {\n flex: 0 0 auto;\n margin-left: auto;\n background: none;\n border: none;\n color: var(--tempest-text-muted);\n padding: 4px;\n border-radius: var(--tempest-radius-sm);\n display: flex;\n align-items: center;\n transition: var(--tempest-transition-color);\n}\n\n@media (hover: hover) and (pointer: fine) {\n .close:hover {\n background-color: var(--tempest-surface);\n color: var(--tempest-text);\n }\n}\n\n.close:focus-visible {\n outline: var(--tempest-focus-ring-width) solid var(--tempest-focus-ring-color);\n outline-offset: var(--tempest-focus-ring-offset);\n}\n\n@keyframes tempest-toast-in {\n from {\n transform: translateX(24px);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast {\n animation: none;\n }\n}\n"],"mappings":";"}
|