artifactuse 0.1.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/LICENSE +21 -0
- package/README.md +771 -0
- package/dist/core/bridge.d.ts +37 -0
- package/dist/core/detector.d.ts +134 -0
- package/dist/core/highlight.d.ts +53 -0
- package/dist/core/index.d.ts +124 -0
- package/dist/core/processors/audio.d.ts +36 -0
- package/dist/core/processors/audioPlayer.d.ts +39 -0
- package/dist/core/processors/codeEmbed.d.ts +58 -0
- package/dist/core/processors/dataViz.d.ts +28 -0
- package/dist/core/processors/design.d.ts +50 -0
- package/dist/core/processors/document.d.ts +38 -0
- package/dist/core/processors/image.d.ts +23 -0
- package/dist/core/processors/index.d.ts +62 -0
- package/dist/core/processors/interactive.d.ts +57 -0
- package/dist/core/processors/map.d.ts +29 -0
- package/dist/core/processors/math.d.ts +75 -0
- package/dist/core/processors/mermaid.d.ts +72 -0
- package/dist/core/processors/social.d.ts +63 -0
- package/dist/core/processors/table.d.ts +43 -0
- package/dist/core/processors/video.d.ts +69 -0
- package/dist/core/state.d.ts +37 -0
- package/dist/core/theme.d.ts +109 -0
- package/dist/index-_nD5FZzs.js +4300 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +115 -0
- package/dist/jszip.min-CdmYyw5L.js +2324 -0
- package/dist/react/ArtifactuseAgentMessage.d.ts +31 -0
- package/dist/react/ArtifactuseCard.d.ts +13 -0
- package/dist/react/ArtifactuseInlineForm.d.ts +16 -0
- package/dist/react/ArtifactusePanel.d.ts +12 -0
- package/dist/react/ArtifactusePanelToggle.d.ts +8 -0
- package/dist/react/ArtifactuseSocialPreview.d.ts +6 -0
- package/dist/react/ArtifactuseViewer.d.ts +14 -0
- package/dist/react/index.d.ts +108 -0
- package/dist/react/index.js +1387 -0
- package/dist/svelte/index.d.ts +439 -0
- package/dist/svelte/index.js +2556 -0
- package/dist/vue/index.d.ts +296 -0
- package/dist/vue/index.js +2745 -0
- package/dist/vue2/composables.d.ts +291 -0
- package/dist/vue2/index.d.ts +10 -0
- package/dist/vue2/index.js +27979 -0
- package/package.json +127 -0
|
@@ -0,0 +1,4300 @@
|
|
|
1
|
+
var gr = Object.defineProperty;
|
|
2
|
+
var mr = (e, t, r) => t in e ? gr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var _ = (e, t, r) => mr(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
const me = {
|
|
5
|
+
CODE: "code",
|
|
6
|
+
FORM: "form",
|
|
7
|
+
SOCIAL: "social"
|
|
8
|
+
}, wr = [
|
|
9
|
+
// Code languages
|
|
10
|
+
"html",
|
|
11
|
+
"htm",
|
|
12
|
+
"svg",
|
|
13
|
+
"markdown",
|
|
14
|
+
"md",
|
|
15
|
+
"jsx",
|
|
16
|
+
"vue",
|
|
17
|
+
"diff",
|
|
18
|
+
"patch",
|
|
19
|
+
"json",
|
|
20
|
+
"javascript",
|
|
21
|
+
"js",
|
|
22
|
+
"python",
|
|
23
|
+
"py",
|
|
24
|
+
// Visual editors
|
|
25
|
+
"canvas",
|
|
26
|
+
"whiteboard",
|
|
27
|
+
"drawing",
|
|
28
|
+
"video",
|
|
29
|
+
"videoeditor",
|
|
30
|
+
"timeline",
|
|
31
|
+
// Structured artifacts
|
|
32
|
+
"form",
|
|
33
|
+
"social"
|
|
34
|
+
], br = [
|
|
35
|
+
// Visual editors (always panel)
|
|
36
|
+
"video",
|
|
37
|
+
"videoeditor",
|
|
38
|
+
"timeline",
|
|
39
|
+
"canvas",
|
|
40
|
+
"whiteboard",
|
|
41
|
+
"drawing",
|
|
42
|
+
// Code (panel for preview)
|
|
43
|
+
"json",
|
|
44
|
+
"svg",
|
|
45
|
+
"diff",
|
|
46
|
+
"patch",
|
|
47
|
+
"javascript",
|
|
48
|
+
"js",
|
|
49
|
+
"python",
|
|
50
|
+
"py",
|
|
51
|
+
"jsx",
|
|
52
|
+
"vue",
|
|
53
|
+
"html",
|
|
54
|
+
"htm",
|
|
55
|
+
// Structured artifacts (form can be panel based on complexity)
|
|
56
|
+
"form"
|
|
57
|
+
];
|
|
58
|
+
function Nt(e) {
|
|
59
|
+
return wr.includes(e == null ? void 0 : e.toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
function vr(e) {
|
|
62
|
+
return br.includes(e == null ? void 0 : e.toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
function yr(e) {
|
|
65
|
+
return {
|
|
66
|
+
// Code languages
|
|
67
|
+
html: "HTML",
|
|
68
|
+
htm: "HTML",
|
|
69
|
+
css: "CSS",
|
|
70
|
+
javascript: "JavaScript",
|
|
71
|
+
js: "JavaScript",
|
|
72
|
+
typescript: "TypeScript",
|
|
73
|
+
ts: "TypeScript",
|
|
74
|
+
jsx: "React JSX",
|
|
75
|
+
tsx: "React TSX",
|
|
76
|
+
vue: "Vue Component",
|
|
77
|
+
python: "Python",
|
|
78
|
+
py: "Python",
|
|
79
|
+
java: "Java",
|
|
80
|
+
csharp: "C#",
|
|
81
|
+
cs: "C#",
|
|
82
|
+
cpp: "C++",
|
|
83
|
+
c: "C",
|
|
84
|
+
go: "Go",
|
|
85
|
+
rust: "Rust",
|
|
86
|
+
ruby: "Ruby",
|
|
87
|
+
rb: "Ruby",
|
|
88
|
+
php: "PHP",
|
|
89
|
+
swift: "Swift",
|
|
90
|
+
kotlin: "Kotlin",
|
|
91
|
+
scala: "Scala",
|
|
92
|
+
sql: "SQL",
|
|
93
|
+
bash: "Bash",
|
|
94
|
+
shell: "Shell",
|
|
95
|
+
sh: "Shell",
|
|
96
|
+
powershell: "PowerShell",
|
|
97
|
+
ps1: "PowerShell",
|
|
98
|
+
json: "JSON",
|
|
99
|
+
xml: "XML",
|
|
100
|
+
yaml: "YAML",
|
|
101
|
+
yml: "YAML",
|
|
102
|
+
markdown: "Markdown",
|
|
103
|
+
md: "Markdown",
|
|
104
|
+
svg: "SVG",
|
|
105
|
+
graphql: "GraphQL",
|
|
106
|
+
dockerfile: "Dockerfile",
|
|
107
|
+
docker: "Docker",
|
|
108
|
+
diff: "Diff",
|
|
109
|
+
patch: "Patch",
|
|
110
|
+
// Visual editors
|
|
111
|
+
canvas: "Canvas",
|
|
112
|
+
video: "Video Editor",
|
|
113
|
+
videoeditor: "Video Editor",
|
|
114
|
+
timeline: "Timeline",
|
|
115
|
+
whiteboard: "Whiteboard",
|
|
116
|
+
drawing: "Drawing",
|
|
117
|
+
// Structured artifacts
|
|
118
|
+
form: "Form",
|
|
119
|
+
social: "Social Preview"
|
|
120
|
+
}[e == null ? void 0 : e.toLowerCase()] || (e == null ? void 0 : e.toUpperCase()) || "Code";
|
|
121
|
+
}
|
|
122
|
+
function ws(e) {
|
|
123
|
+
return {
|
|
124
|
+
html: "html",
|
|
125
|
+
htm: "html",
|
|
126
|
+
css: "css",
|
|
127
|
+
javascript: "js",
|
|
128
|
+
js: "js",
|
|
129
|
+
typescript: "ts",
|
|
130
|
+
ts: "ts",
|
|
131
|
+
jsx: "jsx",
|
|
132
|
+
tsx: "tsx",
|
|
133
|
+
vue: "vue",
|
|
134
|
+
python: "py",
|
|
135
|
+
py: "py",
|
|
136
|
+
java: "java",
|
|
137
|
+
csharp: "cs",
|
|
138
|
+
cs: "cs",
|
|
139
|
+
cpp: "cpp",
|
|
140
|
+
c: "c",
|
|
141
|
+
go: "go",
|
|
142
|
+
rust: "rs",
|
|
143
|
+
ruby: "rb",
|
|
144
|
+
rb: "rb",
|
|
145
|
+
php: "php",
|
|
146
|
+
swift: "swift",
|
|
147
|
+
kotlin: "kt",
|
|
148
|
+
scala: "scala",
|
|
149
|
+
sql: "sql",
|
|
150
|
+
bash: "sh",
|
|
151
|
+
shell: "sh",
|
|
152
|
+
sh: "sh",
|
|
153
|
+
json: "json",
|
|
154
|
+
xml: "xml",
|
|
155
|
+
yaml: "yml",
|
|
156
|
+
yml: "yml",
|
|
157
|
+
markdown: "md",
|
|
158
|
+
md: "md",
|
|
159
|
+
svg: "svg",
|
|
160
|
+
form: "json",
|
|
161
|
+
social: "json"
|
|
162
|
+
}[e == null ? void 0 : e.toLowerCase()] || "txt";
|
|
163
|
+
}
|
|
164
|
+
function bs(e) {
|
|
165
|
+
return {
|
|
166
|
+
html: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
|
|
167
|
+
htm: '<path d="M12 17.56l4.07-1.13.55-6.1H9.38l-.16-1.7h7.78l.16-1.7H6.85l.48 5.1h6.3l-.25 2.9-2.38.63-2.38-.63-.15-1.7H6.76l.3 3.2L12 17.56M4.07 3h15.86L18.5 19.2 12 21l-6.5-1.8L4.07 3z"/>',
|
|
168
|
+
css: '<path d="M5 3l.65 3.34h12.59l-.44 2.16H6.11l.65 3.34h11.04l-.78 3.86-5.02 1.67-4.96-1.67-.33-1.69H4.38l.65 3.35L12 19.31l7.02-2.31L20.93 3H5z"/>',
|
|
169
|
+
javascript: '<path d="M3 3h18v18H3V3m4.73 15.04c.4.85 1.19 1.55 2.54 1.55 1.5 0 2.53-.8 2.53-2.55v-5.78h-1.7V17c0 .86-.35 1.08-.9 1.08-.58 0-.82-.4-1.09-.87l-1.38.83m5.98-.18c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.8z"/>',
|
|
170
|
+
js: '<path d="M3 3h18v18H3V3m4.73 15.04c.4.85 1.19 1.55 2.54 1.55 1.5 0 2.53-.8 2.53-2.55v-5.78h-1.7V17c0 .86-.35 1.08-.9 1.08-.58 0-.82-.4-1.09-.87l-1.38.83m5.98-.18c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.8z"/>',
|
|
171
|
+
typescript: '<path d="M3 3h18v18H3V3m10.71 14.86c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.8M10 17V9H6v8"/>',
|
|
172
|
+
ts: '<path d="M3 3h18v18H3V3m10.71 14.86c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.8M10 17V9H6v8"/>',
|
|
173
|
+
python: '<path d="M12 2C9.2 2 7.5 3.2 7.5 5.5v2.3H12v.7H5.5C3.4 8.5 2 10.4 2 12.8c0 2.4 1.4 4.3 3.5 4.3H7v-2.5c0-2.3 1.9-4.3 4.2-4.3h4.6c1.9 0 3.5-1.6 3.5-3.5V5.5C19.3 3.2 17.6 2 14.8 2h-2.8zM9 3.8c.6 0 1 .5 1 1s-.4 1-1 1-1-.5-1-1 .4-1 1-1z"/><path d="M12 22c2.8 0 4.5-1.2 4.5-3.5v-2.3H12v-.7h6.5c2.1 0 3.5-1.9 3.5-4.3 0-2.4-1.4-4.3-3.5-4.3H17v2.5c0 2.3-1.9 4.3-4.2 4.3H8.2c-1.9 0-3.5 1.6-3.5 3.5v1.3c0 2.3 1.7 3.5 4.5 3.5h2.8zm3-1.8c-.6 0-1-.5-1-1s.4-1 1-1 1 .5 1 1-.4 1-1 1z"/>',
|
|
174
|
+
py: '<path d="M12 2C9.2 2 7.5 3.2 7.5 5.5v2.3H12v.7H5.5C3.4 8.5 2 10.4 2 12.8c0 2.4 1.4 4.3 3.5 4.3H7v-2.5c0-2.3 1.9-4.3 4.2-4.3h4.6c1.9 0 3.5-1.6 3.5-3.5V5.5C19.3 3.2 17.6 2 14.8 2h-2.8zM9 3.8c.6 0 1 .5 1 1s-.4 1-1 1-1-.5-1-1 .4-1 1-1z"/><path d="M12 22c2.8 0 4.5-1.2 4.5-3.5v-2.3H12v-.7h6.5c2.1 0 3.5-1.9 3.5-4.3 0-2.4-1.4-4.3-3.5-4.3H17v2.5c0 2.3-1.9 4.3-4.2 4.3H8.2c-1.9 0-3.5 1.6-3.5 3.5v1.3c0 2.3 1.7 3.5 4.5 3.5h2.8zm3-1.8c-.6 0-1-.5-1-1s.4-1 1-1 1 .5 1 1-.4 1-1 1z"/>',
|
|
175
|
+
vue: '<path d="M2 3h3.5L12 14.5 18.5 3H22L12 21 2 3m4.5 0h3L12 7.58 14.5 3h3L12 13.08 6.5 3z"/>',
|
|
176
|
+
jsx: '<circle cx="12" cy="12" r="2.5"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(60 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(120 12 12)"/>',
|
|
177
|
+
tsx: '<circle cx="12" cy="12" r="2.5"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(60 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" fill="none" stroke="currentColor" stroke-width="1" transform="rotate(120 12 12)"/>',
|
|
178
|
+
json: '<path d="M5 3h2v2H5v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5h2v2H5c-1.07-.27-2-.9-2-2v-4a2 2 0 0 0-2-2H0v-2h1a2 2 0 0 0 2-2V5a2 2 0 0 1 2-2m14 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2 2 2 0 0 1-2-2V5h-2V3h2m-7 12a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m-4 0a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m8 0a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1z"/>',
|
|
179
|
+
markdown: '<path d="M2 4h20v16H2V4m2 2v12h16V6H4m2 2h3l1.5 3 1.5-3h3v8h-2v-5l-2.5 4-2.5-4v5H6V8m11 0h2v4h2l-3 4-3-4h2V8z"/>',
|
|
180
|
+
md: '<path d="M2 4h20v16H2V4m2 2v12h16V6H4m2 2h3l1.5 3 1.5-3h3v8h-2v-5l-2.5 4-2.5-4v5H6V8m11 0h2v4h2l-3 4-3-4h2V8z"/>',
|
|
181
|
+
svg: '<path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 2v14h14V5H5m3 4a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 2-2m8 0l3 8h-2l-.5-1.5h-3L13 17h-2l3-8h2m-.5 2.5l-1 3h2l-1-3z"/>',
|
|
182
|
+
bash: '<path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 2v12h16V6H4m2 2l4 3-4 3V8m5 5h5v2h-5v-2z"/>',
|
|
183
|
+
shell: '<path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 2v12h16V6H4m2 2l4 3-4 3V8m5 5h5v2h-5v-2z"/>',
|
|
184
|
+
sh: '<path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 2v12h16V6H4m2 2l4 3-4 3V8m5 5h5v2h-5v-2z"/>',
|
|
185
|
+
sql: '<path d="M12 3C7.58 3 4 4.79 4 7v10c0 2.21 3.58 4 8 4s8-1.79 8-4V7c0-2.21-3.58-4-8-4m0 2c3.87 0 6 1.5 6 2s-2.13 2-6 2-6-1.5-6-2 2.13-2 6-2M6 17v-2.7c1.56.84 3.67 1.36 6 1.36s4.44-.52 6-1.36V17c0 .5-2.13 2-6 2s-6-1.5-6-2m0-5v-2.7c1.56.84 3.67 1.36 6 1.36s4.44-.52 6-1.36V12c0 .5-2.13 2-6 2s-6-1.5-6-2z"/>',
|
|
186
|
+
diff: '<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"/>',
|
|
187
|
+
patch: '<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"/>',
|
|
188
|
+
canvas: '<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="9" y1="21" x2="9" y2="9"/>',
|
|
189
|
+
whiteboard: '<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="9" y1="21" x2="9" y2="9"/>',
|
|
190
|
+
drawing: '<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/>',
|
|
191
|
+
video: '<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/>',
|
|
192
|
+
videoeditor: '<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/>',
|
|
193
|
+
timeline: '<line x1="2" y1="12" x2="22" y2="12"/><circle cx="6" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="18" cy="12" r="2"/>',
|
|
194
|
+
form: '<path d="M4 4h16v2H4V4zm0 4h10v2H4V8zm0 4h16v2H4v-2zm0 4h10v2H4v-2z"/><rect x="16" y="8" width="4" height="4" rx="1"/><rect x="16" y="16" width="4" height="4" rx="1"/>',
|
|
195
|
+
social: '<path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/>'
|
|
196
|
+
}[e == null ? void 0 : e.toLowerCase()] || '<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>';
|
|
197
|
+
}
|
|
198
|
+
function vs(e) {
|
|
199
|
+
if (e === 0) return "0 Bytes";
|
|
200
|
+
const t = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(e) / Math.log(t));
|
|
201
|
+
return parseFloat((e / Math.pow(t, a)).toFixed(2)) + " " + r[a];
|
|
202
|
+
}
|
|
203
|
+
function Ut(e) {
|
|
204
|
+
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&").replace(/ /g, `
|
|
205
|
+
`).replace(/ /g, "\r").replace(/	/g, " ").replace(/ /g, " ");
|
|
206
|
+
}
|
|
207
|
+
function kr(e) {
|
|
208
|
+
const t = JSON.stringify(e);
|
|
209
|
+
return typeof btoa == "function" ? btoa(unescape(encodeURIComponent(t))) : typeof Buffer < "u" ? Buffer.from(t, "utf-8").toString("base64") : t.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
210
|
+
}
|
|
211
|
+
function xr(e, t) {
|
|
212
|
+
const r = t == null ? void 0 : t.toLowerCase();
|
|
213
|
+
if (r === "form" || r === "social")
|
|
214
|
+
try {
|
|
215
|
+
const c = JSON.parse(e);
|
|
216
|
+
if (r === "form")
|
|
217
|
+
return c.title || "Form";
|
|
218
|
+
if (r === "social")
|
|
219
|
+
return `Social Preview - ${c.platform || "twitter"}`;
|
|
220
|
+
} catch {
|
|
221
|
+
}
|
|
222
|
+
const a = e.match(/(?:\/\/|\/\*|<!--)\s*(?:filename|file):\s*([^\n*\->\s]+)/i);
|
|
223
|
+
if (a) return a[1].trim();
|
|
224
|
+
const s = e.match(/^#!.*\/(node|python|bash|sh|ruby|perl)/);
|
|
225
|
+
if (s)
|
|
226
|
+
return `${{ node: "Node", python: "Python", bash: "Bash", sh: "Shell", ruby: "Ruby", perl: "Perl" }[s[1]] || s[1]} Script`;
|
|
227
|
+
const i = e.match(/name:\s*['"]([^'"]+)['"]/);
|
|
228
|
+
if (i) return i[1];
|
|
229
|
+
const o = e.match(/(?:export\s+default\s+)?(?:function|class)\s+([A-Z][a-zA-Z0-9]+)/);
|
|
230
|
+
if (o) return o[1];
|
|
231
|
+
const n = e.match(/(?:export\s+)?const\s+([A-Z][a-zA-Z0-9]+)\s*=\s*(?:\([^)]*\)|[a-zA-Z]+)\s*=>/);
|
|
232
|
+
if (n) return n[1];
|
|
233
|
+
if (r === "python" || r === "py") {
|
|
234
|
+
const c = e.match(/class\s+([A-Z][a-zA-Z0-9_]+)/);
|
|
235
|
+
if (c) return c[1];
|
|
236
|
+
const u = e.match(/def\s+([a-z_][a-zA-Z0-9_]+)\s*\(/);
|
|
237
|
+
if (u && u[1] !== "main") return u[1];
|
|
238
|
+
}
|
|
239
|
+
const l = e.match(/<title>([^<]+)<\/title>/i);
|
|
240
|
+
return l ? l[1].trim() : e.includes("<template>") && e.includes("<script>") ? "Vue Component" : e.includes("import React") || e.includes('from "react"') ? "React Component" : e.includes("<!DOCTYPE html>") || e.includes("<html") ? "HTML Document" : e.includes("@app.route") || e.includes("Flask") ? "Flask App" : e.includes("express()") ? "Express Server" : e.includes("CREATE TABLE") ? "SQL Schema" : e.includes("SELECT") && e.includes("FROM") ? "SQL Query" : `${yr(t)} Code`;
|
|
241
|
+
}
|
|
242
|
+
function $r(e, t = "panel") {
|
|
243
|
+
const r = kr(e);
|
|
244
|
+
return `<div class="${`artifactuse-placeholder artifactuse-${t}`}" data-artifact-id="${e.id}" data-artifact-type="${e.type}" data-artifact="${r}"></div>`;
|
|
245
|
+
}
|
|
246
|
+
function Gt(e) {
|
|
247
|
+
try {
|
|
248
|
+
return JSON.parse(e);
|
|
249
|
+
} catch {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function Rr(e) {
|
|
254
|
+
var s;
|
|
255
|
+
const t = Gt(e);
|
|
256
|
+
if (!t || t.display === "inline") return !0;
|
|
257
|
+
if (t.display === "panel" || t.variant === "wizard") return !1;
|
|
258
|
+
if (t.variant === "buttons") return !0;
|
|
259
|
+
const r = ((s = t.data) == null ? void 0 : s.fields) || [];
|
|
260
|
+
if (r.some((i) => i.type === "file")) return !1;
|
|
261
|
+
const a = ["multiselect", "rating", "color", "range"];
|
|
262
|
+
return !(r.some((i) => a.includes(i.type)) || r.filter((i) => i.type !== "buttons" && i.type !== "divider" && i.type !== "heading").length > 4 || r.some((i) => i.type === "textarea" && (i.rows || 3) > 4));
|
|
263
|
+
}
|
|
264
|
+
function Ar(e, t) {
|
|
265
|
+
const r = e == null ? void 0 : e.toLowerCase();
|
|
266
|
+
return r === "social" ? !0 : r === "form" ? Rr(t) : !1;
|
|
267
|
+
}
|
|
268
|
+
function zr(e) {
|
|
269
|
+
const t = e == null ? void 0 : e.toLowerCase();
|
|
270
|
+
return t === "form" ? me.FORM : t === "social" ? me.SOCIAL : me.CODE;
|
|
271
|
+
}
|
|
272
|
+
function ye(e, t, r, a) {
|
|
273
|
+
const s = t == null ? void 0 : t.toLowerCase(), i = zr(s), o = Ar(s, e);
|
|
274
|
+
return {
|
|
275
|
+
id: `${r}-${i}-${a}`,
|
|
276
|
+
messageId: r,
|
|
277
|
+
type: i,
|
|
278
|
+
language: s,
|
|
279
|
+
title: xr(e, s),
|
|
280
|
+
code: e,
|
|
281
|
+
isInline: o,
|
|
282
|
+
isPreviewable: Nt(s),
|
|
283
|
+
isPanelArtifact: vr(s),
|
|
284
|
+
size: e.length,
|
|
285
|
+
lineCount: e.split(`
|
|
286
|
+
`).length,
|
|
287
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function ys(e, t) {
|
|
291
|
+
const r = [], a = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
292
|
+
let s, i = 0;
|
|
293
|
+
for (; (s = a.exec(e)) !== null; ) {
|
|
294
|
+
const o = s[1], n = Ut(s[2]);
|
|
295
|
+
let l = o.toLowerCase();
|
|
296
|
+
if ((["xml", "markup", "html", "htm"].includes(l) || !l) && (n.trim().startsWith("<svg") || n.includes("<svg ") || n.includes("<svg>")) && (l = "svg"), (l === "form" || l === "social") && !Gt(n)) {
|
|
297
|
+
r.push(ye(n, "json", t, i)), i++;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
r.push(ye(n, l, t, i)), i++;
|
|
301
|
+
}
|
|
302
|
+
return r;
|
|
303
|
+
}
|
|
304
|
+
function Sr(e, t, r = {}) {
|
|
305
|
+
const {
|
|
306
|
+
minLines: a = 3,
|
|
307
|
+
minLength: s = 50,
|
|
308
|
+
extractAll: i = !1
|
|
309
|
+
} = r, o = [], n = /<pre><code class="language-(\w+)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
310
|
+
let l = 0;
|
|
311
|
+
const c = e.replace(n, (u, f, y) => {
|
|
312
|
+
const d = Ut(y).trim(), b = d.split(`
|
|
313
|
+
`).length;
|
|
314
|
+
let h = f.toLowerCase();
|
|
315
|
+
(["xml", "markup", "html", "htm"].includes(h) || !h) && (d.trim().startsWith("<svg") || d.includes("<svg ") || d.includes("<svg>")) && (h = "svg");
|
|
316
|
+
const w = Nt(h);
|
|
317
|
+
let g = !1;
|
|
318
|
+
if (i ? g = !0 : h === "diff" || h === "patch" ? g = b > 10 : w ? g = !0 : g = d.length >= s && b >= a, g) {
|
|
319
|
+
const p = ye(d, h, t, l);
|
|
320
|
+
l++, o.push(p);
|
|
321
|
+
let v = "panel";
|
|
322
|
+
return p.isInline && (v = p.type === "social" ? "inline-social" : "inline-form"), $r(p, v);
|
|
323
|
+
}
|
|
324
|
+
return l++, u;
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
artifacts: o,
|
|
328
|
+
html: c
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function Lr() {
|
|
332
|
+
let e = {
|
|
333
|
+
artifacts: [],
|
|
334
|
+
activeArtifactId: null,
|
|
335
|
+
isPanelOpen: !1,
|
|
336
|
+
viewMode: "preview",
|
|
337
|
+
// 'preview' | 'code' | 'split'
|
|
338
|
+
isFullscreen: !1
|
|
339
|
+
};
|
|
340
|
+
const t = /* @__PURE__ */ new Set();
|
|
341
|
+
function r() {
|
|
342
|
+
t.forEach((m) => {
|
|
343
|
+
try {
|
|
344
|
+
m(e);
|
|
345
|
+
} catch (x) {
|
|
346
|
+
console.error("Artifactuse state subscriber error:", x);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
function a(m) {
|
|
351
|
+
return t.add(m), m(e), () => {
|
|
352
|
+
t.delete(m);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function s() {
|
|
356
|
+
return { ...e };
|
|
357
|
+
}
|
|
358
|
+
function i(m) {
|
|
359
|
+
const x = e.artifacts.findIndex((k) => k.id === m.id);
|
|
360
|
+
if (x === -1)
|
|
361
|
+
e = {
|
|
362
|
+
...e,
|
|
363
|
+
artifacts: [...e.artifacts, m]
|
|
364
|
+
};
|
|
365
|
+
else {
|
|
366
|
+
const k = [...e.artifacts];
|
|
367
|
+
k[x] = { ...k[x], ...m }, e = {
|
|
368
|
+
...e,
|
|
369
|
+
artifacts: k
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
r();
|
|
373
|
+
}
|
|
374
|
+
function o(m) {
|
|
375
|
+
m.forEach(i);
|
|
376
|
+
}
|
|
377
|
+
function n(m) {
|
|
378
|
+
e = {
|
|
379
|
+
...e,
|
|
380
|
+
artifacts: e.artifacts.filter((x) => x.id !== m),
|
|
381
|
+
activeArtifactId: e.activeArtifactId === m ? null : e.activeArtifactId,
|
|
382
|
+
isPanelOpen: e.activeArtifactId === m ? !1 : e.isPanelOpen
|
|
383
|
+
}, r();
|
|
384
|
+
}
|
|
385
|
+
function l(m) {
|
|
386
|
+
return e.artifacts.find((x) => x.id === m) || null;
|
|
387
|
+
}
|
|
388
|
+
function c() {
|
|
389
|
+
return e.activeArtifactId ? l(e.activeArtifactId) : null;
|
|
390
|
+
}
|
|
391
|
+
function u(m) {
|
|
392
|
+
const x = l(m);
|
|
393
|
+
e = {
|
|
394
|
+
...e,
|
|
395
|
+
activeArtifactId: m,
|
|
396
|
+
// Set view mode based on artifact type
|
|
397
|
+
viewMode: (x == null ? void 0 : x.isPreviewable) === !1 ? "code" : "preview"
|
|
398
|
+
}, r();
|
|
399
|
+
}
|
|
400
|
+
function f() {
|
|
401
|
+
e = {
|
|
402
|
+
...e,
|
|
403
|
+
activeArtifactId: null
|
|
404
|
+
}, r();
|
|
405
|
+
}
|
|
406
|
+
function y(m) {
|
|
407
|
+
e = {
|
|
408
|
+
...e,
|
|
409
|
+
isPanelOpen: m,
|
|
410
|
+
isFullscreen: m ? e.isFullscreen : !1
|
|
411
|
+
}, r();
|
|
412
|
+
}
|
|
413
|
+
function d(m) {
|
|
414
|
+
if (!["preview", "code", "split"].includes(m)) {
|
|
415
|
+
console.warn(`Invalid view mode: ${m}`);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
e = {
|
|
419
|
+
...e,
|
|
420
|
+
viewMode: m
|
|
421
|
+
}, r();
|
|
422
|
+
}
|
|
423
|
+
function b(m) {
|
|
424
|
+
e = {
|
|
425
|
+
...e,
|
|
426
|
+
isFullscreen: m
|
|
427
|
+
}, r();
|
|
428
|
+
}
|
|
429
|
+
function h(m) {
|
|
430
|
+
return e.artifacts.filter((x) => x.messageId === m);
|
|
431
|
+
}
|
|
432
|
+
function w(m) {
|
|
433
|
+
return e.artifacts.filter((x) => x.type === m);
|
|
434
|
+
}
|
|
435
|
+
function g() {
|
|
436
|
+
return e.artifacts.length;
|
|
437
|
+
}
|
|
438
|
+
function p() {
|
|
439
|
+
e = {
|
|
440
|
+
artifacts: [],
|
|
441
|
+
activeArtifactId: null,
|
|
442
|
+
isPanelOpen: !1,
|
|
443
|
+
viewMode: "preview",
|
|
444
|
+
isFullscreen: !1
|
|
445
|
+
}, r();
|
|
446
|
+
}
|
|
447
|
+
function v(m) {
|
|
448
|
+
const x = r;
|
|
449
|
+
let k = !1;
|
|
450
|
+
const A = () => {
|
|
451
|
+
k = !0;
|
|
452
|
+
};
|
|
453
|
+
try {
|
|
454
|
+
Object.defineProperty(window, "__artifactuse_notify__", {
|
|
455
|
+
value: A,
|
|
456
|
+
configurable: !0
|
|
457
|
+
}), m();
|
|
458
|
+
} finally {
|
|
459
|
+
delete window.__artifactuse_notify__, k && x();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
// State access
|
|
464
|
+
getState: s,
|
|
465
|
+
subscribe: a,
|
|
466
|
+
// Artifacts
|
|
467
|
+
addArtifact: i,
|
|
468
|
+
addArtifacts: o,
|
|
469
|
+
removeArtifact: n,
|
|
470
|
+
getArtifact: l,
|
|
471
|
+
getActiveArtifact: c,
|
|
472
|
+
getArtifactsByMessageId: h,
|
|
473
|
+
getArtifactsByType: w,
|
|
474
|
+
getArtifactCount: g,
|
|
475
|
+
// Panel state
|
|
476
|
+
setActiveArtifact: u,
|
|
477
|
+
clearActiveArtifact: f,
|
|
478
|
+
setPanelOpen: y,
|
|
479
|
+
setViewMode: d,
|
|
480
|
+
setFullscreen: b,
|
|
481
|
+
// Utilities
|
|
482
|
+
clear: p,
|
|
483
|
+
batch: v
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function _r(e) {
|
|
487
|
+
const t = /* @__PURE__ */ new Map();
|
|
488
|
+
let r = null, a = !1;
|
|
489
|
+
const s = [];
|
|
490
|
+
function i(p) {
|
|
491
|
+
if (!p.origin.includes(new URL(e).hostname))
|
|
492
|
+
return;
|
|
493
|
+
const { type: v, action: m, data: x, requestId: k } = p.data || {};
|
|
494
|
+
if (v !== "artifactuse") return;
|
|
495
|
+
if (m === "ready") {
|
|
496
|
+
a = !0, s.forEach((M) => n(M)), s.length = 0;
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
(t.get(m) || []).forEach((M) => {
|
|
500
|
+
try {
|
|
501
|
+
M(x, k);
|
|
502
|
+
} catch (P) {
|
|
503
|
+
console.error(`Artifactuse bridge handler error (${m}):`, P);
|
|
504
|
+
}
|
|
505
|
+
}), (t.get("*") || []).forEach((M) => {
|
|
506
|
+
try {
|
|
507
|
+
M({ action: m, data: x, requestId: k });
|
|
508
|
+
} catch (P) {
|
|
509
|
+
console.error("Artifactuse bridge wildcard handler error:", P);
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
window.addEventListener("message", i);
|
|
514
|
+
function o(p) {
|
|
515
|
+
r = p, a = !1;
|
|
516
|
+
}
|
|
517
|
+
function n(p) {
|
|
518
|
+
if (!(r != null && r.contentWindow))
|
|
519
|
+
return console.warn("Artifactuse: No panel iframe available"), !1;
|
|
520
|
+
try {
|
|
521
|
+
return r.contentWindow.postMessage(p, e), !0;
|
|
522
|
+
} catch (v) {
|
|
523
|
+
return console.error("Artifactuse bridge send error:", v), !1;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function l(p, v, m = null) {
|
|
527
|
+
const x = {
|
|
528
|
+
type: "artifactuse",
|
|
529
|
+
action: p,
|
|
530
|
+
data: v,
|
|
531
|
+
requestId: m || Oe(),
|
|
532
|
+
timestamp: Date.now()
|
|
533
|
+
};
|
|
534
|
+
return a ? (n(x), x.requestId) : (s.push(x), x.requestId);
|
|
535
|
+
}
|
|
536
|
+
function c(p, v, m = 3e4) {
|
|
537
|
+
return new Promise((x, k) => {
|
|
538
|
+
const A = Oe(), z = setTimeout(() => {
|
|
539
|
+
f(`${p}:response`, M), k(new Error(`Artifactuse bridge request timeout: ${p}`));
|
|
540
|
+
}, m), M = (P, $) => {
|
|
541
|
+
$ === A && (clearTimeout(z), f(`${p}:response`, M), x(P));
|
|
542
|
+
};
|
|
543
|
+
u(`${p}:response`, M), l(p, v, A);
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
function u(p, v) {
|
|
547
|
+
return t.has(p) || t.set(p, []), t.get(p).push(v), () => f(p, v);
|
|
548
|
+
}
|
|
549
|
+
function f(p, v) {
|
|
550
|
+
const m = t.get(p);
|
|
551
|
+
if (m) {
|
|
552
|
+
const x = m.indexOf(v);
|
|
553
|
+
x > -1 && m.splice(x, 1);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function y(p) {
|
|
557
|
+
return l("load:artifact", p);
|
|
558
|
+
}
|
|
559
|
+
function d(p, v) {
|
|
560
|
+
return l("update:artifact", { artifactId: p, updates: v });
|
|
561
|
+
}
|
|
562
|
+
function b() {
|
|
563
|
+
return c("save", {});
|
|
564
|
+
}
|
|
565
|
+
function h(p = "default") {
|
|
566
|
+
return c("export", { format: p });
|
|
567
|
+
}
|
|
568
|
+
function w(p, v) {
|
|
569
|
+
return l("ai:response", p, v);
|
|
570
|
+
}
|
|
571
|
+
function g() {
|
|
572
|
+
window.removeEventListener("message", i), t.clear(), r = null, a = !1, s.length = 0;
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
setIframe: o,
|
|
576
|
+
send: l,
|
|
577
|
+
request: c,
|
|
578
|
+
on: u,
|
|
579
|
+
off: f,
|
|
580
|
+
loadArtifact: y,
|
|
581
|
+
updateArtifact: d,
|
|
582
|
+
requestSave: b,
|
|
583
|
+
requestExport: h,
|
|
584
|
+
sendAIResponse: w,
|
|
585
|
+
destroy: g,
|
|
586
|
+
// State
|
|
587
|
+
get isReady() {
|
|
588
|
+
return a;
|
|
589
|
+
},
|
|
590
|
+
get iframe() {
|
|
591
|
+
return r;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function Oe() {
|
|
596
|
+
return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
597
|
+
}
|
|
598
|
+
function Cr(e) {
|
|
599
|
+
if (!e) return null;
|
|
600
|
+
if (typeof e == "string" && e.includes(","))
|
|
601
|
+
return e.trim();
|
|
602
|
+
let t = String(e).replace(/^#/, "");
|
|
603
|
+
if (t.length === 3 && (t = t.split("").map((i) => i + i).join("")), t.length !== 6 || !/^[0-9a-fA-F]+$/.test(t))
|
|
604
|
+
return console.warn(`Invalid color format: ${e}`), null;
|
|
605
|
+
const r = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16);
|
|
606
|
+
return `${r}, ${a}, ${s}`;
|
|
607
|
+
}
|
|
608
|
+
function Mr(e) {
|
|
609
|
+
return e ? Cr(e) : null;
|
|
610
|
+
}
|
|
611
|
+
function ae(e) {
|
|
612
|
+
if (!e || typeof e != "object") return {};
|
|
613
|
+
const t = {};
|
|
614
|
+
for (const [r, a] of Object.entries(e))
|
|
615
|
+
if (r === "gradientOpacity" || typeof a == "number")
|
|
616
|
+
t[r] = a;
|
|
617
|
+
else {
|
|
618
|
+
const s = Mr(a);
|
|
619
|
+
s && (t[r] = s);
|
|
620
|
+
}
|
|
621
|
+
return t;
|
|
622
|
+
}
|
|
623
|
+
const Fe = {
|
|
624
|
+
// Dark theme
|
|
625
|
+
dark: {
|
|
626
|
+
primary: "99, 102, 241",
|
|
627
|
+
// #6366f1 Indigo-500
|
|
628
|
+
primaryHover: "79, 70, 229",
|
|
629
|
+
// #4f46e5 Indigo-600
|
|
630
|
+
background: "40, 40, 40",
|
|
631
|
+
// #111827 Gray-900
|
|
632
|
+
surface: "40, 40, 40",
|
|
633
|
+
// #1f2937 Gray-800
|
|
634
|
+
surfaceHover: "55, 65, 81",
|
|
635
|
+
// #374151 Gray-700
|
|
636
|
+
text: "243, 244, 246",
|
|
637
|
+
// #f3f4f6 Gray-100
|
|
638
|
+
textSecondary: "156, 163, 175",
|
|
639
|
+
// #9ca3af Gray-400
|
|
640
|
+
textMuted: "107, 114, 128",
|
|
641
|
+
// #6b7280 Gray-500
|
|
642
|
+
border: "61, 61, 61",
|
|
643
|
+
// #4b5563 Gray-600
|
|
644
|
+
borderLight: "55, 65, 81",
|
|
645
|
+
// #374151 Gray-700
|
|
646
|
+
success: "34, 197, 94",
|
|
647
|
+
// #22c55e Green-500
|
|
648
|
+
warning: "234, 179, 8",
|
|
649
|
+
// #eab308 Yellow-500
|
|
650
|
+
error: "239, 68, 68",
|
|
651
|
+
// #ef4444 Red-500
|
|
652
|
+
info: "59, 130, 246",
|
|
653
|
+
// #3b82f6 Blue-500
|
|
654
|
+
gradient: "99, 102, 241",
|
|
655
|
+
// Indigo for gradients
|
|
656
|
+
gradientOpacity: "0.38"
|
|
657
|
+
},
|
|
658
|
+
// Light theme
|
|
659
|
+
light: {
|
|
660
|
+
primary: "79, 70, 229",
|
|
661
|
+
// #4f46e5 Indigo-600
|
|
662
|
+
primaryHover: "67, 56, 202",
|
|
663
|
+
// #4338ca Indigo-700
|
|
664
|
+
background: "255, 255, 255",
|
|
665
|
+
// #ffffff White
|
|
666
|
+
surface: "249, 250, 251",
|
|
667
|
+
// #f9fafb Gray-50
|
|
668
|
+
surfaceHover: "243, 244, 246",
|
|
669
|
+
// #f3f4f6 Gray-100
|
|
670
|
+
text: "17, 24, 39",
|
|
671
|
+
// #111827 Gray-900
|
|
672
|
+
textSecondary: "75, 85, 99",
|
|
673
|
+
// #4b5563 Gray-600
|
|
674
|
+
textMuted: "156, 163, 175",
|
|
675
|
+
// #9ca3af Gray-400
|
|
676
|
+
border: "229, 231, 235",
|
|
677
|
+
// #e5e7eb Gray-200
|
|
678
|
+
borderLight: "243, 244, 246",
|
|
679
|
+
// #f3f4f6 Gray-100
|
|
680
|
+
success: "22, 163, 74",
|
|
681
|
+
// #16a34a Green-600
|
|
682
|
+
warning: "202, 138, 4",
|
|
683
|
+
// #ca8a04 Yellow-600
|
|
684
|
+
error: "220, 38, 38",
|
|
685
|
+
// #dc2626 Red-600
|
|
686
|
+
info: "37, 99, 235",
|
|
687
|
+
// #2563eb Blue-600
|
|
688
|
+
gradient: "79, 70, 229",
|
|
689
|
+
// Indigo for gradients
|
|
690
|
+
gradientOpacity: "0.25"
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
function Tr(e = "auto", t = {}) {
|
|
694
|
+
let r = e, a = {
|
|
695
|
+
dark: { ...Fe.dark },
|
|
696
|
+
light: { ...Fe.light }
|
|
697
|
+
};
|
|
698
|
+
t.dark && (a.dark = { ...a.dark, ...ae(t.dark) }), t.light && (a.light = { ...a.light, ...ae(t.light) });
|
|
699
|
+
const s = { ...t };
|
|
700
|
+
if (delete s.dark, delete s.light, Object.keys(s).length > 0) {
|
|
701
|
+
const b = ae(s);
|
|
702
|
+
a.dark = { ...a.dark, ...b }, a.light = { ...a.light, ...b };
|
|
703
|
+
}
|
|
704
|
+
function i() {
|
|
705
|
+
return r === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : r;
|
|
706
|
+
}
|
|
707
|
+
function o() {
|
|
708
|
+
return a[i()];
|
|
709
|
+
}
|
|
710
|
+
function n() {
|
|
711
|
+
const b = o();
|
|
712
|
+
return Object.entries(b).map(([h, w]) => `--artifactuse-${X(h)}: ${w};`).join(`
|
|
713
|
+
`);
|
|
714
|
+
}
|
|
715
|
+
function l(b = document.documentElement) {
|
|
716
|
+
const h = o(), w = i();
|
|
717
|
+
Object.entries(h).forEach(([g, p]) => {
|
|
718
|
+
b.style.setProperty(`--artifactuse-${X(g)}`, p);
|
|
719
|
+
}), b.setAttribute("data-artifactuse-theme", w), b.classList.remove("artifactuse-dark", "artifactuse-light"), b.classList.add(`artifactuse-${w}`);
|
|
720
|
+
}
|
|
721
|
+
function c(b) {
|
|
722
|
+
if (!["dark", "light", "auto"].includes(b)) {
|
|
723
|
+
console.warn(`Invalid theme: ${b}`);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
r = b, l();
|
|
727
|
+
}
|
|
728
|
+
function u() {
|
|
729
|
+
const b = i();
|
|
730
|
+
c(b === "dark" ? "light" : "dark");
|
|
731
|
+
}
|
|
732
|
+
function f(b, h = null) {
|
|
733
|
+
const w = ae(b);
|
|
734
|
+
h ? a[h] = { ...a[h], ...w } : (a.dark = { ...a.dark, ...w }, a.light = { ...a.light, ...w }), l();
|
|
735
|
+
}
|
|
736
|
+
function y(b) {
|
|
737
|
+
const h = window.matchMedia("(prefers-color-scheme: dark)"), w = (g) => {
|
|
738
|
+
r === "auto" && (l(), b && b(g.matches ? "dark" : "light"));
|
|
739
|
+
};
|
|
740
|
+
return h.addEventListener("change", w), () => {
|
|
741
|
+
h.removeEventListener("change", w);
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
function d() {
|
|
745
|
+
return `
|
|
746
|
+
:root,
|
|
747
|
+
[data-artifactuse-theme="dark"] {
|
|
748
|
+
${Object.entries(a.dark).map(([b, h]) => `--artifactuse-${X(b)}: ${h};`).join(`
|
|
749
|
+
`)}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
[data-artifactuse-theme="light"] {
|
|
753
|
+
${Object.entries(a.light).map(([b, h]) => `--artifactuse-${X(b)}: ${h};`).join(`
|
|
754
|
+
`)}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
@media (prefers-color-scheme: light) {
|
|
758
|
+
:root:not([data-artifactuse-theme]) {
|
|
759
|
+
${Object.entries(a.light).map(([b, h]) => `--artifactuse-${X(b)}: ${h};`).join(`
|
|
760
|
+
`)}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
`;
|
|
764
|
+
}
|
|
765
|
+
return {
|
|
766
|
+
get current() {
|
|
767
|
+
return r;
|
|
768
|
+
},
|
|
769
|
+
get resolved() {
|
|
770
|
+
return i();
|
|
771
|
+
},
|
|
772
|
+
get colors() {
|
|
773
|
+
return o();
|
|
774
|
+
},
|
|
775
|
+
getResolvedTheme: i,
|
|
776
|
+
getColors: o,
|
|
777
|
+
getCSSVariables: n,
|
|
778
|
+
getCSS: d,
|
|
779
|
+
apply: l,
|
|
780
|
+
set: c,
|
|
781
|
+
toggle: u,
|
|
782
|
+
setColors: f,
|
|
783
|
+
watchSystemTheme: y
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
function X(e) {
|
|
787
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
788
|
+
}
|
|
789
|
+
function Ee() {
|
|
790
|
+
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
791
|
+
}
|
|
792
|
+
var U = Ee();
|
|
793
|
+
function Xt(e) {
|
|
794
|
+
U = e;
|
|
795
|
+
}
|
|
796
|
+
var ee = { exec: () => null };
|
|
797
|
+
function S(e, t = "") {
|
|
798
|
+
let r = typeof e == "string" ? e : e.source, a = { replace: (s, i) => {
|
|
799
|
+
let o = typeof i == "string" ? i : i.source;
|
|
800
|
+
return o = o.replace(T.caret, "$1"), r = r.replace(s, o), a;
|
|
801
|
+
}, getRegex: () => new RegExp(r, t) };
|
|
802
|
+
return a;
|
|
803
|
+
}
|
|
804
|
+
var Er = (() => {
|
|
805
|
+
try {
|
|
806
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
807
|
+
} catch {
|
|
808
|
+
return !1;
|
|
809
|
+
}
|
|
810
|
+
})(), T = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (e) => new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}#`), htmlBeginRegex: (e) => new RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i") }, Pr = /^(?:[ \t]*(?:\n|$))+/, Ir = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Zr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, te = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, qr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Pe = /(?:[*+-]|\d{1,9}[.)])/, Wt = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Qt = S(Wt).replace(/bull/g, Pe).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Hr = S(Wt).replace(/bull/g, Pe).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Ie = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, jr = /^[^\n]+/, Ze = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Dr = S(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ze).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Vr = S(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Pe).getRegex(), fe = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", qe = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Br = S("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", qe).replace("tag", fe).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Kt = S(Ie).replace("hr", te).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", fe).getRegex(), Or = S(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Kt).getRegex(), He = { blockquote: Or, code: Ir, def: Dr, fences: Zr, heading: qr, hr: te, html: Br, lheading: Qt, list: Vr, newline: Pr, paragraph: Kt, table: ee, text: jr }, Ne = S("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", te).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", fe).getRegex(), Fr = { ...He, lheading: Hr, table: Ne, paragraph: S(Ie).replace("hr", te).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Ne).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", fe).getRegex() }, Nr = { ...He, html: S(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", qe).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: ee, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: S(Ie).replace("hr", te).replace("heading", ` *#{1,6} *[^
|
|
811
|
+
]`).replace("lheading", Qt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ur = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Gr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Jt = /^( {2,}|\\)\n(?!\s*$)/, Xr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, he = /[\p{P}\p{S}]/u, je = /[\s\p{P}\p{S}]/u, Yt = /[^\s\p{P}\p{S}]/u, Wr = S(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, je).getRegex(), er = /(?!~)[\p{P}\p{S}]/u, Qr = /(?!~)[\s\p{P}\p{S}]/u, Kr = /(?:[^\s\p{P}\p{S}]|~)/u, Jr = S(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Er ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), tr = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Yr = S(tr, "u").replace(/punct/g, he).getRegex(), ea = S(tr, "u").replace(/punct/g, er).getRegex(), rr = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", ta = S(rr, "gu").replace(/notPunctSpace/g, Yt).replace(/punctSpace/g, je).replace(/punct/g, he).getRegex(), ra = S(rr, "gu").replace(/notPunctSpace/g, Kr).replace(/punctSpace/g, Qr).replace(/punct/g, er).getRegex(), aa = S("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Yt).replace(/punctSpace/g, je).replace(/punct/g, he).getRegex(), sa = S(/\\(punct)/, "gu").replace(/punct/g, he).getRegex(), ia = S(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), na = S(qe).replace("(?:-->|$)", "-->").getRegex(), oa = S("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", na).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), oe = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, ca = S(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", oe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ar = S(/^!?\[(label)\]\[(ref)\]/).replace("label", oe).replace("ref", Ze).getRegex(), sr = S(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ze).getRegex(), la = S("reflink|nolink(?!\\()", "g").replace("reflink", ar).replace("nolink", sr).getRegex(), Ue = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, De = { _backpedal: ee, anyPunctuation: sa, autolink: ia, blockSkip: Jr, br: Jt, code: Gr, del: ee, emStrongLDelim: Yr, emStrongRDelimAst: ta, emStrongRDelimUnd: aa, escape: Ur, link: ca, nolink: sr, punctuation: Wr, reflink: ar, reflinkSearch: la, tag: oa, text: Xr, url: ee }, ua = { ...De, link: S(/^!?\[(label)\]\((.*?)\)/).replace("label", oe).getRegex(), reflink: S(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", oe).getRegex() }, ke = { ...De, emStrongRDelimAst: ra, emStrongLDelim: ea, url: S(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Ue).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: S(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Ue).getRegex() }, pa = { ...ke, br: S(Jt).replace("{2,}", "*").getRegex(), text: S(ke.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, se = { normal: He, gfm: Fr, pedantic: Nr }, W = { normal: De, gfm: ke, breaks: pa, pedantic: ua }, da = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Ge = (e) => da[e];
|
|
812
|
+
function j(e, t) {
|
|
813
|
+
if (t) {
|
|
814
|
+
if (T.escapeTest.test(e)) return e.replace(T.escapeReplace, Ge);
|
|
815
|
+
} else if (T.escapeTestNoEncode.test(e)) return e.replace(T.escapeReplaceNoEncode, Ge);
|
|
816
|
+
return e;
|
|
817
|
+
}
|
|
818
|
+
function Xe(e) {
|
|
819
|
+
try {
|
|
820
|
+
e = encodeURI(e).replace(T.percentDecode, "%");
|
|
821
|
+
} catch {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
return e;
|
|
825
|
+
}
|
|
826
|
+
function We(e, t) {
|
|
827
|
+
var i;
|
|
828
|
+
let r = e.replace(T.findPipe, (o, n, l) => {
|
|
829
|
+
let c = !1, u = n;
|
|
830
|
+
for (; --u >= 0 && l[u] === "\\"; ) c = !c;
|
|
831
|
+
return c ? "|" : " |";
|
|
832
|
+
}), a = r.split(T.splitPipe), s = 0;
|
|
833
|
+
if (a[0].trim() || a.shift(), a.length > 0 && !((i = a.at(-1)) != null && i.trim()) && a.pop(), t) if (a.length > t) a.splice(t);
|
|
834
|
+
else for (; a.length < t; ) a.push("");
|
|
835
|
+
for (; s < a.length; s++) a[s] = a[s].trim().replace(T.slashPipe, "|");
|
|
836
|
+
return a;
|
|
837
|
+
}
|
|
838
|
+
function Q(e, t, r) {
|
|
839
|
+
let a = e.length;
|
|
840
|
+
if (a === 0) return "";
|
|
841
|
+
let s = 0;
|
|
842
|
+
for (; s < a && e.charAt(a - s - 1) === t; )
|
|
843
|
+
s++;
|
|
844
|
+
return e.slice(0, a - s);
|
|
845
|
+
}
|
|
846
|
+
function fa(e, t) {
|
|
847
|
+
if (e.indexOf(t[1]) === -1) return -1;
|
|
848
|
+
let r = 0;
|
|
849
|
+
for (let a = 0; a < e.length; a++) if (e[a] === "\\") a++;
|
|
850
|
+
else if (e[a] === t[0]) r++;
|
|
851
|
+
else if (e[a] === t[1] && (r--, r < 0)) return a;
|
|
852
|
+
return r > 0 ? -2 : -1;
|
|
853
|
+
}
|
|
854
|
+
function Qe(e, t, r, a, s) {
|
|
855
|
+
let i = t.href, o = t.title || null, n = e[1].replace(s.other.outputLinkReplace, "$1");
|
|
856
|
+
a.state.inLink = !0;
|
|
857
|
+
let l = { type: e[0].charAt(0) === "!" ? "image" : "link", raw: r, href: i, title: o, text: n, tokens: a.inlineTokens(n) };
|
|
858
|
+
return a.state.inLink = !1, l;
|
|
859
|
+
}
|
|
860
|
+
function ha(e, t, r) {
|
|
861
|
+
let a = e.match(r.other.indentCodeCompensation);
|
|
862
|
+
if (a === null) return t;
|
|
863
|
+
let s = a[1];
|
|
864
|
+
return t.split(`
|
|
865
|
+
`).map((i) => {
|
|
866
|
+
let o = i.match(r.other.beginningSpace);
|
|
867
|
+
if (o === null) return i;
|
|
868
|
+
let [n] = o;
|
|
869
|
+
return n.length >= s.length ? i.slice(s.length) : i;
|
|
870
|
+
}).join(`
|
|
871
|
+
`);
|
|
872
|
+
}
|
|
873
|
+
var ce = class {
|
|
874
|
+
constructor(e) {
|
|
875
|
+
_(this, "options");
|
|
876
|
+
_(this, "rules");
|
|
877
|
+
_(this, "lexer");
|
|
878
|
+
this.options = e || U;
|
|
879
|
+
}
|
|
880
|
+
space(e) {
|
|
881
|
+
let t = this.rules.block.newline.exec(e);
|
|
882
|
+
if (t && t[0].length > 0) return { type: "space", raw: t[0] };
|
|
883
|
+
}
|
|
884
|
+
code(e) {
|
|
885
|
+
let t = this.rules.block.code.exec(e);
|
|
886
|
+
if (t) {
|
|
887
|
+
let r = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
888
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : Q(r, `
|
|
889
|
+
`) };
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
fences(e) {
|
|
893
|
+
let t = this.rules.block.fences.exec(e);
|
|
894
|
+
if (t) {
|
|
895
|
+
let r = t[0], a = ha(r, t[3] || "", this.rules);
|
|
896
|
+
return { type: "code", raw: r, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: a };
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
heading(e) {
|
|
900
|
+
let t = this.rules.block.heading.exec(e);
|
|
901
|
+
if (t) {
|
|
902
|
+
let r = t[2].trim();
|
|
903
|
+
if (this.rules.other.endingHash.test(r)) {
|
|
904
|
+
let a = Q(r, "#");
|
|
905
|
+
(this.options.pedantic || !a || this.rules.other.endingSpaceChar.test(a)) && (r = a.trim());
|
|
906
|
+
}
|
|
907
|
+
return { type: "heading", raw: t[0], depth: t[1].length, text: r, tokens: this.lexer.inline(r) };
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
hr(e) {
|
|
911
|
+
let t = this.rules.block.hr.exec(e);
|
|
912
|
+
if (t) return { type: "hr", raw: Q(t[0], `
|
|
913
|
+
`) };
|
|
914
|
+
}
|
|
915
|
+
blockquote(e) {
|
|
916
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
917
|
+
if (t) {
|
|
918
|
+
let r = Q(t[0], `
|
|
919
|
+
`).split(`
|
|
920
|
+
`), a = "", s = "", i = [];
|
|
921
|
+
for (; r.length > 0; ) {
|
|
922
|
+
let o = !1, n = [], l;
|
|
923
|
+
for (l = 0; l < r.length; l++) if (this.rules.other.blockquoteStart.test(r[l])) n.push(r[l]), o = !0;
|
|
924
|
+
else if (!o) n.push(r[l]);
|
|
925
|
+
else break;
|
|
926
|
+
r = r.slice(l);
|
|
927
|
+
let c = n.join(`
|
|
928
|
+
`), u = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
929
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
930
|
+
a = a ? `${a}
|
|
931
|
+
${c}` : c, s = s ? `${s}
|
|
932
|
+
${u}` : u;
|
|
933
|
+
let f = this.lexer.state.top;
|
|
934
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, i, !0), this.lexer.state.top = f, r.length === 0) break;
|
|
935
|
+
let y = i.at(-1);
|
|
936
|
+
if ((y == null ? void 0 : y.type) === "code") break;
|
|
937
|
+
if ((y == null ? void 0 : y.type) === "blockquote") {
|
|
938
|
+
let d = y, b = d.raw + `
|
|
939
|
+
` + r.join(`
|
|
940
|
+
`), h = this.blockquote(b);
|
|
941
|
+
i[i.length - 1] = h, a = a.substring(0, a.length - d.raw.length) + h.raw, s = s.substring(0, s.length - d.text.length) + h.text;
|
|
942
|
+
break;
|
|
943
|
+
} else if ((y == null ? void 0 : y.type) === "list") {
|
|
944
|
+
let d = y, b = d.raw + `
|
|
945
|
+
` + r.join(`
|
|
946
|
+
`), h = this.list(b);
|
|
947
|
+
i[i.length - 1] = h, a = a.substring(0, a.length - y.raw.length) + h.raw, s = s.substring(0, s.length - d.raw.length) + h.raw, r = b.substring(i.at(-1).raw.length).split(`
|
|
948
|
+
`);
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return { type: "blockquote", raw: a, tokens: i, text: s };
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
list(e) {
|
|
956
|
+
var r, a;
|
|
957
|
+
let t = this.rules.block.list.exec(e);
|
|
958
|
+
if (t) {
|
|
959
|
+
let s = t[1].trim(), i = s.length > 1, o = { type: "list", raw: "", ordered: i, start: i ? +s.slice(0, -1) : "", loose: !1, items: [] };
|
|
960
|
+
s = i ? `\\d{1,9}\\${s.slice(-1)}` : `\\${s}`, this.options.pedantic && (s = i ? s : "[*+-]");
|
|
961
|
+
let n = this.rules.other.listItemRegex(s), l = !1;
|
|
962
|
+
for (; e; ) {
|
|
963
|
+
let u = !1, f = "", y = "";
|
|
964
|
+
if (!(t = n.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
965
|
+
f = t[0], e = e.substring(f.length);
|
|
966
|
+
let d = t[2].split(`
|
|
967
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (g) => " ".repeat(3 * g.length)), b = e.split(`
|
|
968
|
+
`, 1)[0], h = !d.trim(), w = 0;
|
|
969
|
+
if (this.options.pedantic ? (w = 2, y = d.trimStart()) : h ? w = t[1].length + 1 : (w = t[2].search(this.rules.other.nonSpaceChar), w = w > 4 ? 1 : w, y = d.slice(w), w += t[1].length), h && this.rules.other.blankLine.test(b) && (f += b + `
|
|
970
|
+
`, e = e.substring(b.length + 1), u = !0), !u) {
|
|
971
|
+
let g = this.rules.other.nextBulletRegex(w), p = this.rules.other.hrRegex(w), v = this.rules.other.fencesBeginRegex(w), m = this.rules.other.headingBeginRegex(w), x = this.rules.other.htmlBeginRegex(w);
|
|
972
|
+
for (; e; ) {
|
|
973
|
+
let k = e.split(`
|
|
974
|
+
`, 1)[0], A;
|
|
975
|
+
if (b = k, this.options.pedantic ? (b = b.replace(this.rules.other.listReplaceNesting, " "), A = b) : A = b.replace(this.rules.other.tabCharGlobal, " "), v.test(b) || m.test(b) || x.test(b) || g.test(b) || p.test(b)) break;
|
|
976
|
+
if (A.search(this.rules.other.nonSpaceChar) >= w || !b.trim()) y += `
|
|
977
|
+
` + A.slice(w);
|
|
978
|
+
else {
|
|
979
|
+
if (h || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(d) || m.test(d) || p.test(d)) break;
|
|
980
|
+
y += `
|
|
981
|
+
` + b;
|
|
982
|
+
}
|
|
983
|
+
!h && !b.trim() && (h = !0), f += k + `
|
|
984
|
+
`, e = e.substring(k.length + 1), d = A.slice(w);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
o.loose || (l ? o.loose = !0 : this.rules.other.doubleBlankLine.test(f) && (l = !0)), o.items.push({ type: "list_item", raw: f, task: !!this.options.gfm && this.rules.other.listIsTask.test(y), loose: !1, text: y, tokens: [] }), o.raw += f;
|
|
988
|
+
}
|
|
989
|
+
let c = o.items.at(-1);
|
|
990
|
+
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
991
|
+
else return;
|
|
992
|
+
o.raw = o.raw.trimEnd();
|
|
993
|
+
for (let u of o.items) {
|
|
994
|
+
if (this.lexer.state.top = !1, u.tokens = this.lexer.blockTokens(u.text, []), u.task) {
|
|
995
|
+
if (u.text = u.text.replace(this.rules.other.listReplaceTask, ""), ((r = u.tokens[0]) == null ? void 0 : r.type) === "text" || ((a = u.tokens[0]) == null ? void 0 : a.type) === "paragraph") {
|
|
996
|
+
u.tokens[0].raw = u.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), u.tokens[0].text = u.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
997
|
+
for (let y = this.lexer.inlineQueue.length - 1; y >= 0; y--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[y].src)) {
|
|
998
|
+
this.lexer.inlineQueue[y].src = this.lexer.inlineQueue[y].src.replace(this.rules.other.listReplaceTask, "");
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
let f = this.rules.other.listTaskCheckbox.exec(u.raw);
|
|
1003
|
+
if (f) {
|
|
1004
|
+
let y = { type: "checkbox", raw: f[0] + " ", checked: f[0] !== "[ ]" };
|
|
1005
|
+
u.checked = y.checked, o.loose ? u.tokens[0] && ["paragraph", "text"].includes(u.tokens[0].type) && "tokens" in u.tokens[0] && u.tokens[0].tokens ? (u.tokens[0].raw = y.raw + u.tokens[0].raw, u.tokens[0].text = y.raw + u.tokens[0].text, u.tokens[0].tokens.unshift(y)) : u.tokens.unshift({ type: "paragraph", raw: y.raw, text: y.raw, tokens: [y] }) : u.tokens.unshift(y);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
if (!o.loose) {
|
|
1009
|
+
let f = u.tokens.filter((d) => d.type === "space"), y = f.length > 0 && f.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
1010
|
+
o.loose = y;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
if (o.loose) for (let u of o.items) {
|
|
1014
|
+
u.loose = !0;
|
|
1015
|
+
for (let f of u.tokens) f.type === "text" && (f.type = "paragraph");
|
|
1016
|
+
}
|
|
1017
|
+
return o;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
html(e) {
|
|
1021
|
+
let t = this.rules.block.html.exec(e);
|
|
1022
|
+
if (t) return { type: "html", block: !0, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
|
|
1023
|
+
}
|
|
1024
|
+
def(e) {
|
|
1025
|
+
let t = this.rules.block.def.exec(e);
|
|
1026
|
+
if (t) {
|
|
1027
|
+
let r = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), a = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
1028
|
+
return { type: "def", tag: r, raw: t[0], href: a, title: s };
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
table(e) {
|
|
1032
|
+
var o;
|
|
1033
|
+
let t = this.rules.block.table.exec(e);
|
|
1034
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1035
|
+
let r = We(t[1]), a = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (o = t[3]) != null && o.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1036
|
+
`) : [], i = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
1037
|
+
if (r.length === a.length) {
|
|
1038
|
+
for (let n of a) this.rules.other.tableAlignRight.test(n) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(n) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(n) ? i.align.push("left") : i.align.push(null);
|
|
1039
|
+
for (let n = 0; n < r.length; n++) i.header.push({ text: r[n], tokens: this.lexer.inline(r[n]), header: !0, align: i.align[n] });
|
|
1040
|
+
for (let n of s) i.rows.push(We(n, i.header.length).map((l, c) => ({ text: l, tokens: this.lexer.inline(l), header: !1, align: i.align[c] })));
|
|
1041
|
+
return i;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
lheading(e) {
|
|
1045
|
+
let t = this.rules.block.lheading.exec(e);
|
|
1046
|
+
if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
|
|
1047
|
+
}
|
|
1048
|
+
paragraph(e) {
|
|
1049
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
1050
|
+
if (t) {
|
|
1051
|
+
let r = t[1].charAt(t[1].length - 1) === `
|
|
1052
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
1053
|
+
return { type: "paragraph", raw: t[0], text: r, tokens: this.lexer.inline(r) };
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
text(e) {
|
|
1057
|
+
let t = this.rules.block.text.exec(e);
|
|
1058
|
+
if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
1059
|
+
}
|
|
1060
|
+
escape(e) {
|
|
1061
|
+
let t = this.rules.inline.escape.exec(e);
|
|
1062
|
+
if (t) return { type: "escape", raw: t[0], text: t[1] };
|
|
1063
|
+
}
|
|
1064
|
+
tag(e) {
|
|
1065
|
+
let t = this.rules.inline.tag.exec(e);
|
|
1066
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: t[0] };
|
|
1067
|
+
}
|
|
1068
|
+
link(e) {
|
|
1069
|
+
let t = this.rules.inline.link.exec(e);
|
|
1070
|
+
if (t) {
|
|
1071
|
+
let r = t[2].trim();
|
|
1072
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
1073
|
+
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
1074
|
+
let i = Q(r.slice(0, -1), "\\");
|
|
1075
|
+
if ((r.length - i.length) % 2 === 0) return;
|
|
1076
|
+
} else {
|
|
1077
|
+
let i = fa(t[2], "()");
|
|
1078
|
+
if (i === -2) return;
|
|
1079
|
+
if (i > -1) {
|
|
1080
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
1081
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
let a = t[2], s = "";
|
|
1085
|
+
if (this.options.pedantic) {
|
|
1086
|
+
let i = this.rules.other.pedanticHrefTitle.exec(a);
|
|
1087
|
+
i && (a = i[1], s = i[3]);
|
|
1088
|
+
} else s = t[3] ? t[3].slice(1, -1) : "";
|
|
1089
|
+
return a = a.trim(), this.rules.other.startAngleBracket.test(a) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), Qe(t, { href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
reflink(e, t) {
|
|
1093
|
+
let r;
|
|
1094
|
+
if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) {
|
|
1095
|
+
let a = (r[2] || r[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = t[a.toLowerCase()];
|
|
1096
|
+
if (!s) {
|
|
1097
|
+
let i = r[0].charAt(0);
|
|
1098
|
+
return { type: "text", raw: i, text: i };
|
|
1099
|
+
}
|
|
1100
|
+
return Qe(r, s, r[0], this.lexer, this.rules);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
emStrong(e, t, r = "") {
|
|
1104
|
+
let a = this.rules.inline.emStrongLDelim.exec(e);
|
|
1105
|
+
if (!(!a || a[3] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(a[1] || a[2]) || !r || this.rules.inline.punctuation.exec(r))) {
|
|
1106
|
+
let s = [...a[0]].length - 1, i, o, n = s, l = 0, c = a[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1107
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (a = c.exec(t)) != null; ) {
|
|
1108
|
+
if (i = a[1] || a[2] || a[3] || a[4] || a[5] || a[6], !i) continue;
|
|
1109
|
+
if (o = [...i].length, a[3] || a[4]) {
|
|
1110
|
+
n += o;
|
|
1111
|
+
continue;
|
|
1112
|
+
} else if ((a[5] || a[6]) && s % 3 && !((s + o) % 3)) {
|
|
1113
|
+
l += o;
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
if (n -= o, n > 0) continue;
|
|
1117
|
+
o = Math.min(o, o + n + l);
|
|
1118
|
+
let u = [...a[0]][0].length, f = e.slice(0, s + a.index + u + o);
|
|
1119
|
+
if (Math.min(s, o) % 2) {
|
|
1120
|
+
let d = f.slice(1, -1);
|
|
1121
|
+
return { type: "em", raw: f, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
1122
|
+
}
|
|
1123
|
+
let y = f.slice(2, -2);
|
|
1124
|
+
return { type: "strong", raw: f, text: y, tokens: this.lexer.inlineTokens(y) };
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
codespan(e) {
|
|
1129
|
+
let t = this.rules.inline.code.exec(e);
|
|
1130
|
+
if (t) {
|
|
1131
|
+
let r = t[2].replace(this.rules.other.newLineCharGlobal, " "), a = this.rules.other.nonSpaceChar.test(r), s = this.rules.other.startingSpaceChar.test(r) && this.rules.other.endingSpaceChar.test(r);
|
|
1132
|
+
return a && s && (r = r.substring(1, r.length - 1)), { type: "codespan", raw: t[0], text: r };
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
br(e) {
|
|
1136
|
+
let t = this.rules.inline.br.exec(e);
|
|
1137
|
+
if (t) return { type: "br", raw: t[0] };
|
|
1138
|
+
}
|
|
1139
|
+
del(e) {
|
|
1140
|
+
let t = this.rules.inline.del.exec(e);
|
|
1141
|
+
if (t) return { type: "del", raw: t[0], text: t[2], tokens: this.lexer.inlineTokens(t[2]) };
|
|
1142
|
+
}
|
|
1143
|
+
autolink(e) {
|
|
1144
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
1145
|
+
if (t) {
|
|
1146
|
+
let r, a;
|
|
1147
|
+
return t[2] === "@" ? (r = t[1], a = "mailto:" + r) : (r = t[1], a = r), { type: "link", raw: t[0], text: r, href: a, tokens: [{ type: "text", raw: r, text: r }] };
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
url(e) {
|
|
1151
|
+
var r;
|
|
1152
|
+
let t;
|
|
1153
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
1154
|
+
let a, s;
|
|
1155
|
+
if (t[2] === "@") a = t[0], s = "mailto:" + a;
|
|
1156
|
+
else {
|
|
1157
|
+
let i;
|
|
1158
|
+
do
|
|
1159
|
+
i = t[0], t[0] = ((r = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : r[0]) ?? "";
|
|
1160
|
+
while (i !== t[0]);
|
|
1161
|
+
a = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
1162
|
+
}
|
|
1163
|
+
return { type: "link", raw: t[0], text: a, href: s, tokens: [{ type: "text", raw: a, text: a }] };
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
inlineText(e) {
|
|
1167
|
+
let t = this.rules.inline.text.exec(e);
|
|
1168
|
+
if (t) {
|
|
1169
|
+
let r = this.lexer.state.inRawBlock;
|
|
1170
|
+
return { type: "text", raw: t[0], text: t[0], escaped: r };
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}, Z = class xe {
|
|
1174
|
+
constructor(t) {
|
|
1175
|
+
_(this, "tokens");
|
|
1176
|
+
_(this, "options");
|
|
1177
|
+
_(this, "state");
|
|
1178
|
+
_(this, "inlineQueue");
|
|
1179
|
+
_(this, "tokenizer");
|
|
1180
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || U, this.options.tokenizer = this.options.tokenizer || new ce(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1181
|
+
let r = { other: T, block: se.normal, inline: W.normal };
|
|
1182
|
+
this.options.pedantic ? (r.block = se.pedantic, r.inline = W.pedantic) : this.options.gfm && (r.block = se.gfm, this.options.breaks ? r.inline = W.breaks : r.inline = W.gfm), this.tokenizer.rules = r;
|
|
1183
|
+
}
|
|
1184
|
+
static get rules() {
|
|
1185
|
+
return { block: se, inline: W };
|
|
1186
|
+
}
|
|
1187
|
+
static lex(t, r) {
|
|
1188
|
+
return new xe(r).lex(t);
|
|
1189
|
+
}
|
|
1190
|
+
static lexInline(t, r) {
|
|
1191
|
+
return new xe(r).inlineTokens(t);
|
|
1192
|
+
}
|
|
1193
|
+
lex(t) {
|
|
1194
|
+
t = t.replace(T.carriageReturn, `
|
|
1195
|
+
`), this.blockTokens(t, this.tokens);
|
|
1196
|
+
for (let r = 0; r < this.inlineQueue.length; r++) {
|
|
1197
|
+
let a = this.inlineQueue[r];
|
|
1198
|
+
this.inlineTokens(a.src, a.tokens);
|
|
1199
|
+
}
|
|
1200
|
+
return this.inlineQueue = [], this.tokens;
|
|
1201
|
+
}
|
|
1202
|
+
blockTokens(t, r = [], a = !1) {
|
|
1203
|
+
var s, i, o;
|
|
1204
|
+
for (this.options.pedantic && (t = t.replace(T.tabCharGlobal, " ").replace(T.spaceLine, "")); t; ) {
|
|
1205
|
+
let n;
|
|
1206
|
+
if ((i = (s = this.options.extensions) == null ? void 0 : s.block) != null && i.some((c) => (n = c.call({ lexer: this }, t, r)) ? (t = t.substring(n.raw.length), r.push(n), !0) : !1)) continue;
|
|
1207
|
+
if (n = this.tokenizer.space(t)) {
|
|
1208
|
+
t = t.substring(n.raw.length);
|
|
1209
|
+
let c = r.at(-1);
|
|
1210
|
+
n.raw.length === 1 && c !== void 0 ? c.raw += `
|
|
1211
|
+
` : r.push(n);
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1214
|
+
if (n = this.tokenizer.code(t)) {
|
|
1215
|
+
t = t.substring(n.raw.length);
|
|
1216
|
+
let c = r.at(-1);
|
|
1217
|
+
(c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1218
|
+
`) ? "" : `
|
|
1219
|
+
`) + n.raw, c.text += `
|
|
1220
|
+
` + n.text, this.inlineQueue.at(-1).src = c.text) : r.push(n);
|
|
1221
|
+
continue;
|
|
1222
|
+
}
|
|
1223
|
+
if (n = this.tokenizer.fences(t)) {
|
|
1224
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
if (n = this.tokenizer.heading(t)) {
|
|
1228
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1231
|
+
if (n = this.tokenizer.hr(t)) {
|
|
1232
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1233
|
+
continue;
|
|
1234
|
+
}
|
|
1235
|
+
if (n = this.tokenizer.blockquote(t)) {
|
|
1236
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
if (n = this.tokenizer.list(t)) {
|
|
1240
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1241
|
+
continue;
|
|
1242
|
+
}
|
|
1243
|
+
if (n = this.tokenizer.html(t)) {
|
|
1244
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
if (n = this.tokenizer.def(t)) {
|
|
1248
|
+
t = t.substring(n.raw.length);
|
|
1249
|
+
let c = r.at(-1);
|
|
1250
|
+
(c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1251
|
+
`) ? "" : `
|
|
1252
|
+
`) + n.raw, c.text += `
|
|
1253
|
+
` + n.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = { href: n.href, title: n.title }, r.push(n));
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
if (n = this.tokenizer.table(t)) {
|
|
1257
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
if (n = this.tokenizer.lheading(t)) {
|
|
1261
|
+
t = t.substring(n.raw.length), r.push(n);
|
|
1262
|
+
continue;
|
|
1263
|
+
}
|
|
1264
|
+
let l = t;
|
|
1265
|
+
if ((o = this.options.extensions) != null && o.startBlock) {
|
|
1266
|
+
let c = 1 / 0, u = t.slice(1), f;
|
|
1267
|
+
this.options.extensions.startBlock.forEach((y) => {
|
|
1268
|
+
f = y.call({ lexer: this }, u), typeof f == "number" && f >= 0 && (c = Math.min(c, f));
|
|
1269
|
+
}), c < 1 / 0 && c >= 0 && (l = t.substring(0, c + 1));
|
|
1270
|
+
}
|
|
1271
|
+
if (this.state.top && (n = this.tokenizer.paragraph(l))) {
|
|
1272
|
+
let c = r.at(-1);
|
|
1273
|
+
a && (c == null ? void 0 : c.type) === "paragraph" ? (c.raw += (c.raw.endsWith(`
|
|
1274
|
+
`) ? "" : `
|
|
1275
|
+
`) + n.raw, c.text += `
|
|
1276
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : r.push(n), a = l.length !== t.length, t = t.substring(n.raw.length);
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1279
|
+
if (n = this.tokenizer.text(t)) {
|
|
1280
|
+
t = t.substring(n.raw.length);
|
|
1281
|
+
let c = r.at(-1);
|
|
1282
|
+
(c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1283
|
+
`) ? "" : `
|
|
1284
|
+
`) + n.raw, c.text += `
|
|
1285
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : r.push(n);
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
if (t) {
|
|
1289
|
+
let c = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1290
|
+
if (this.options.silent) {
|
|
1291
|
+
console.error(c);
|
|
1292
|
+
break;
|
|
1293
|
+
} else throw new Error(c);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return this.state.top = !0, r;
|
|
1297
|
+
}
|
|
1298
|
+
inline(t, r = []) {
|
|
1299
|
+
return this.inlineQueue.push({ src: t, tokens: r }), r;
|
|
1300
|
+
}
|
|
1301
|
+
inlineTokens(t, r = []) {
|
|
1302
|
+
var l, c, u, f, y;
|
|
1303
|
+
let a = t, s = null;
|
|
1304
|
+
if (this.tokens.links) {
|
|
1305
|
+
let d = Object.keys(this.tokens.links);
|
|
1306
|
+
if (d.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(a)) != null; ) d.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (a = a.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1307
|
+
}
|
|
1308
|
+
for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(a)) != null; ) a = a.slice(0, s.index) + "++" + a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1309
|
+
let i;
|
|
1310
|
+
for (; (s = this.tokenizer.rules.inline.blockSkip.exec(a)) != null; ) i = s[2] ? s[2].length : 0, a = a.slice(0, s.index + i) + "[" + "a".repeat(s[0].length - i - 2) + "]" + a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1311
|
+
a = ((c = (l = this.options.hooks) == null ? void 0 : l.emStrongMask) == null ? void 0 : c.call({ lexer: this }, a)) ?? a;
|
|
1312
|
+
let o = !1, n = "";
|
|
1313
|
+
for (; t; ) {
|
|
1314
|
+
o || (n = ""), o = !1;
|
|
1315
|
+
let d;
|
|
1316
|
+
if ((f = (u = this.options.extensions) == null ? void 0 : u.inline) != null && f.some((h) => (d = h.call({ lexer: this }, t, r)) ? (t = t.substring(d.raw.length), r.push(d), !0) : !1)) continue;
|
|
1317
|
+
if (d = this.tokenizer.escape(t)) {
|
|
1318
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1319
|
+
continue;
|
|
1320
|
+
}
|
|
1321
|
+
if (d = this.tokenizer.tag(t)) {
|
|
1322
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1323
|
+
continue;
|
|
1324
|
+
}
|
|
1325
|
+
if (d = this.tokenizer.link(t)) {
|
|
1326
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1327
|
+
continue;
|
|
1328
|
+
}
|
|
1329
|
+
if (d = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1330
|
+
t = t.substring(d.raw.length);
|
|
1331
|
+
let h = r.at(-1);
|
|
1332
|
+
d.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += d.raw, h.text += d.text) : r.push(d);
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
if (d = this.tokenizer.emStrong(t, a, n)) {
|
|
1336
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1337
|
+
continue;
|
|
1338
|
+
}
|
|
1339
|
+
if (d = this.tokenizer.codespan(t)) {
|
|
1340
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
if (d = this.tokenizer.br(t)) {
|
|
1344
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
if (d = this.tokenizer.del(t)) {
|
|
1348
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1351
|
+
if (d = this.tokenizer.autolink(t)) {
|
|
1352
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1353
|
+
continue;
|
|
1354
|
+
}
|
|
1355
|
+
if (!this.state.inLink && (d = this.tokenizer.url(t))) {
|
|
1356
|
+
t = t.substring(d.raw.length), r.push(d);
|
|
1357
|
+
continue;
|
|
1358
|
+
}
|
|
1359
|
+
let b = t;
|
|
1360
|
+
if ((y = this.options.extensions) != null && y.startInline) {
|
|
1361
|
+
let h = 1 / 0, w = t.slice(1), g;
|
|
1362
|
+
this.options.extensions.startInline.forEach((p) => {
|
|
1363
|
+
g = p.call({ lexer: this }, w), typeof g == "number" && g >= 0 && (h = Math.min(h, g));
|
|
1364
|
+
}), h < 1 / 0 && h >= 0 && (b = t.substring(0, h + 1));
|
|
1365
|
+
}
|
|
1366
|
+
if (d = this.tokenizer.inlineText(b)) {
|
|
1367
|
+
t = t.substring(d.raw.length), d.raw.slice(-1) !== "_" && (n = d.raw.slice(-1)), o = !0;
|
|
1368
|
+
let h = r.at(-1);
|
|
1369
|
+
(h == null ? void 0 : h.type) === "text" ? (h.raw += d.raw, h.text += d.text) : r.push(d);
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
if (t) {
|
|
1373
|
+
let h = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1374
|
+
if (this.options.silent) {
|
|
1375
|
+
console.error(h);
|
|
1376
|
+
break;
|
|
1377
|
+
} else throw new Error(h);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
return r;
|
|
1381
|
+
}
|
|
1382
|
+
}, le = class {
|
|
1383
|
+
constructor(e) {
|
|
1384
|
+
_(this, "options");
|
|
1385
|
+
_(this, "parser");
|
|
1386
|
+
this.options = e || U;
|
|
1387
|
+
}
|
|
1388
|
+
space(e) {
|
|
1389
|
+
return "";
|
|
1390
|
+
}
|
|
1391
|
+
code({ text: e, lang: t, escaped: r }) {
|
|
1392
|
+
var i;
|
|
1393
|
+
let a = (i = (t || "").match(T.notSpaceStart)) == null ? void 0 : i[0], s = e.replace(T.endingNewline, "") + `
|
|
1394
|
+
`;
|
|
1395
|
+
return a ? '<pre><code class="language-' + j(a) + '">' + (r ? s : j(s, !0)) + `</code></pre>
|
|
1396
|
+
` : "<pre><code>" + (r ? s : j(s, !0)) + `</code></pre>
|
|
1397
|
+
`;
|
|
1398
|
+
}
|
|
1399
|
+
blockquote({ tokens: e }) {
|
|
1400
|
+
return `<blockquote>
|
|
1401
|
+
${this.parser.parse(e)}</blockquote>
|
|
1402
|
+
`;
|
|
1403
|
+
}
|
|
1404
|
+
html({ text: e }) {
|
|
1405
|
+
return e;
|
|
1406
|
+
}
|
|
1407
|
+
def(e) {
|
|
1408
|
+
return "";
|
|
1409
|
+
}
|
|
1410
|
+
heading({ tokens: e, depth: t }) {
|
|
1411
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1412
|
+
`;
|
|
1413
|
+
}
|
|
1414
|
+
hr(e) {
|
|
1415
|
+
return `<hr>
|
|
1416
|
+
`;
|
|
1417
|
+
}
|
|
1418
|
+
list(e) {
|
|
1419
|
+
let t = e.ordered, r = e.start, a = "";
|
|
1420
|
+
for (let o = 0; o < e.items.length; o++) {
|
|
1421
|
+
let n = e.items[o];
|
|
1422
|
+
a += this.listitem(n);
|
|
1423
|
+
}
|
|
1424
|
+
let s = t ? "ol" : "ul", i = t && r !== 1 ? ' start="' + r + '"' : "";
|
|
1425
|
+
return "<" + s + i + `>
|
|
1426
|
+
` + a + "</" + s + `>
|
|
1427
|
+
`;
|
|
1428
|
+
}
|
|
1429
|
+
listitem(e) {
|
|
1430
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
1431
|
+
`;
|
|
1432
|
+
}
|
|
1433
|
+
checkbox({ checked: e }) {
|
|
1434
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1435
|
+
}
|
|
1436
|
+
paragraph({ tokens: e }) {
|
|
1437
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
1438
|
+
`;
|
|
1439
|
+
}
|
|
1440
|
+
table(e) {
|
|
1441
|
+
let t = "", r = "";
|
|
1442
|
+
for (let s = 0; s < e.header.length; s++) r += this.tablecell(e.header[s]);
|
|
1443
|
+
t += this.tablerow({ text: r });
|
|
1444
|
+
let a = "";
|
|
1445
|
+
for (let s = 0; s < e.rows.length; s++) {
|
|
1446
|
+
let i = e.rows[s];
|
|
1447
|
+
r = "";
|
|
1448
|
+
for (let o = 0; o < i.length; o++) r += this.tablecell(i[o]);
|
|
1449
|
+
a += this.tablerow({ text: r });
|
|
1450
|
+
}
|
|
1451
|
+
return a && (a = `<tbody>${a}</tbody>`), `<table>
|
|
1452
|
+
<thead>
|
|
1453
|
+
` + t + `</thead>
|
|
1454
|
+
` + a + `</table>
|
|
1455
|
+
`;
|
|
1456
|
+
}
|
|
1457
|
+
tablerow({ text: e }) {
|
|
1458
|
+
return `<tr>
|
|
1459
|
+
${e}</tr>
|
|
1460
|
+
`;
|
|
1461
|
+
}
|
|
1462
|
+
tablecell(e) {
|
|
1463
|
+
let t = this.parser.parseInline(e.tokens), r = e.header ? "th" : "td";
|
|
1464
|
+
return (e.align ? `<${r} align="${e.align}">` : `<${r}>`) + t + `</${r}>
|
|
1465
|
+
`;
|
|
1466
|
+
}
|
|
1467
|
+
strong({ tokens: e }) {
|
|
1468
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
1469
|
+
}
|
|
1470
|
+
em({ tokens: e }) {
|
|
1471
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1472
|
+
}
|
|
1473
|
+
codespan({ text: e }) {
|
|
1474
|
+
return `<code>${j(e, !0)}</code>`;
|
|
1475
|
+
}
|
|
1476
|
+
br(e) {
|
|
1477
|
+
return "<br>";
|
|
1478
|
+
}
|
|
1479
|
+
del({ tokens: e }) {
|
|
1480
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1481
|
+
}
|
|
1482
|
+
link({ href: e, title: t, tokens: r }) {
|
|
1483
|
+
let a = this.parser.parseInline(r), s = Xe(e);
|
|
1484
|
+
if (s === null) return a;
|
|
1485
|
+
e = s;
|
|
1486
|
+
let i = '<a href="' + e + '"';
|
|
1487
|
+
return t && (i += ' title="' + j(t) + '"'), i += ">" + a + "</a>", i;
|
|
1488
|
+
}
|
|
1489
|
+
image({ href: e, title: t, text: r, tokens: a }) {
|
|
1490
|
+
a && (r = this.parser.parseInline(a, this.parser.textRenderer));
|
|
1491
|
+
let s = Xe(e);
|
|
1492
|
+
if (s === null) return j(r);
|
|
1493
|
+
e = s;
|
|
1494
|
+
let i = `<img src="${e}" alt="${r}"`;
|
|
1495
|
+
return t && (i += ` title="${j(t)}"`), i += ">", i;
|
|
1496
|
+
}
|
|
1497
|
+
text(e) {
|
|
1498
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : j(e.text);
|
|
1499
|
+
}
|
|
1500
|
+
}, Ve = class {
|
|
1501
|
+
strong({ text: e }) {
|
|
1502
|
+
return e;
|
|
1503
|
+
}
|
|
1504
|
+
em({ text: e }) {
|
|
1505
|
+
return e;
|
|
1506
|
+
}
|
|
1507
|
+
codespan({ text: e }) {
|
|
1508
|
+
return e;
|
|
1509
|
+
}
|
|
1510
|
+
del({ text: e }) {
|
|
1511
|
+
return e;
|
|
1512
|
+
}
|
|
1513
|
+
html({ text: e }) {
|
|
1514
|
+
return e;
|
|
1515
|
+
}
|
|
1516
|
+
text({ text: e }) {
|
|
1517
|
+
return e;
|
|
1518
|
+
}
|
|
1519
|
+
link({ text: e }) {
|
|
1520
|
+
return "" + e;
|
|
1521
|
+
}
|
|
1522
|
+
image({ text: e }) {
|
|
1523
|
+
return "" + e;
|
|
1524
|
+
}
|
|
1525
|
+
br() {
|
|
1526
|
+
return "";
|
|
1527
|
+
}
|
|
1528
|
+
checkbox({ raw: e }) {
|
|
1529
|
+
return e;
|
|
1530
|
+
}
|
|
1531
|
+
}, q = class $e {
|
|
1532
|
+
constructor(t) {
|
|
1533
|
+
_(this, "options");
|
|
1534
|
+
_(this, "renderer");
|
|
1535
|
+
_(this, "textRenderer");
|
|
1536
|
+
this.options = t || U, this.options.renderer = this.options.renderer || new le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Ve();
|
|
1537
|
+
}
|
|
1538
|
+
static parse(t, r) {
|
|
1539
|
+
return new $e(r).parse(t);
|
|
1540
|
+
}
|
|
1541
|
+
static parseInline(t, r) {
|
|
1542
|
+
return new $e(r).parseInline(t);
|
|
1543
|
+
}
|
|
1544
|
+
parse(t) {
|
|
1545
|
+
var a, s;
|
|
1546
|
+
let r = "";
|
|
1547
|
+
for (let i = 0; i < t.length; i++) {
|
|
1548
|
+
let o = t[i];
|
|
1549
|
+
if ((s = (a = this.options.extensions) == null ? void 0 : a.renderers) != null && s[o.type]) {
|
|
1550
|
+
let l = o, c = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1551
|
+
if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
1552
|
+
r += c || "";
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
let n = o;
|
|
1557
|
+
switch (n.type) {
|
|
1558
|
+
case "space": {
|
|
1559
|
+
r += this.renderer.space(n);
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
case "hr": {
|
|
1563
|
+
r += this.renderer.hr(n);
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
case "heading": {
|
|
1567
|
+
r += this.renderer.heading(n);
|
|
1568
|
+
break;
|
|
1569
|
+
}
|
|
1570
|
+
case "code": {
|
|
1571
|
+
r += this.renderer.code(n);
|
|
1572
|
+
break;
|
|
1573
|
+
}
|
|
1574
|
+
case "table": {
|
|
1575
|
+
r += this.renderer.table(n);
|
|
1576
|
+
break;
|
|
1577
|
+
}
|
|
1578
|
+
case "blockquote": {
|
|
1579
|
+
r += this.renderer.blockquote(n);
|
|
1580
|
+
break;
|
|
1581
|
+
}
|
|
1582
|
+
case "list": {
|
|
1583
|
+
r += this.renderer.list(n);
|
|
1584
|
+
break;
|
|
1585
|
+
}
|
|
1586
|
+
case "checkbox": {
|
|
1587
|
+
r += this.renderer.checkbox(n);
|
|
1588
|
+
break;
|
|
1589
|
+
}
|
|
1590
|
+
case "html": {
|
|
1591
|
+
r += this.renderer.html(n);
|
|
1592
|
+
break;
|
|
1593
|
+
}
|
|
1594
|
+
case "def": {
|
|
1595
|
+
r += this.renderer.def(n);
|
|
1596
|
+
break;
|
|
1597
|
+
}
|
|
1598
|
+
case "paragraph": {
|
|
1599
|
+
r += this.renderer.paragraph(n);
|
|
1600
|
+
break;
|
|
1601
|
+
}
|
|
1602
|
+
case "text": {
|
|
1603
|
+
r += this.renderer.text(n);
|
|
1604
|
+
break;
|
|
1605
|
+
}
|
|
1606
|
+
default: {
|
|
1607
|
+
let l = 'Token with "' + n.type + '" type was not found.';
|
|
1608
|
+
if (this.options.silent) return console.error(l), "";
|
|
1609
|
+
throw new Error(l);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
return r;
|
|
1614
|
+
}
|
|
1615
|
+
parseInline(t, r = this.renderer) {
|
|
1616
|
+
var s, i;
|
|
1617
|
+
let a = "";
|
|
1618
|
+
for (let o = 0; o < t.length; o++) {
|
|
1619
|
+
let n = t[o];
|
|
1620
|
+
if ((i = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && i[n.type]) {
|
|
1621
|
+
let c = this.options.extensions.renderers[n.type].call({ parser: this }, n);
|
|
1622
|
+
if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(n.type)) {
|
|
1623
|
+
a += c || "";
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
let l = n;
|
|
1628
|
+
switch (l.type) {
|
|
1629
|
+
case "escape": {
|
|
1630
|
+
a += r.text(l);
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
case "html": {
|
|
1634
|
+
a += r.html(l);
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
case "link": {
|
|
1638
|
+
a += r.link(l);
|
|
1639
|
+
break;
|
|
1640
|
+
}
|
|
1641
|
+
case "image": {
|
|
1642
|
+
a += r.image(l);
|
|
1643
|
+
break;
|
|
1644
|
+
}
|
|
1645
|
+
case "checkbox": {
|
|
1646
|
+
a += r.checkbox(l);
|
|
1647
|
+
break;
|
|
1648
|
+
}
|
|
1649
|
+
case "strong": {
|
|
1650
|
+
a += r.strong(l);
|
|
1651
|
+
break;
|
|
1652
|
+
}
|
|
1653
|
+
case "em": {
|
|
1654
|
+
a += r.em(l);
|
|
1655
|
+
break;
|
|
1656
|
+
}
|
|
1657
|
+
case "codespan": {
|
|
1658
|
+
a += r.codespan(l);
|
|
1659
|
+
break;
|
|
1660
|
+
}
|
|
1661
|
+
case "br": {
|
|
1662
|
+
a += r.br(l);
|
|
1663
|
+
break;
|
|
1664
|
+
}
|
|
1665
|
+
case "del": {
|
|
1666
|
+
a += r.del(l);
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
case "text": {
|
|
1670
|
+
a += r.text(l);
|
|
1671
|
+
break;
|
|
1672
|
+
}
|
|
1673
|
+
default: {
|
|
1674
|
+
let c = 'Token with "' + l.type + '" type was not found.';
|
|
1675
|
+
if (this.options.silent) return console.error(c), "";
|
|
1676
|
+
throw new Error(c);
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
return a;
|
|
1681
|
+
}
|
|
1682
|
+
}, ne, J = (ne = class {
|
|
1683
|
+
constructor(e) {
|
|
1684
|
+
_(this, "options");
|
|
1685
|
+
_(this, "block");
|
|
1686
|
+
this.options = e || U;
|
|
1687
|
+
}
|
|
1688
|
+
preprocess(e) {
|
|
1689
|
+
return e;
|
|
1690
|
+
}
|
|
1691
|
+
postprocess(e) {
|
|
1692
|
+
return e;
|
|
1693
|
+
}
|
|
1694
|
+
processAllTokens(e) {
|
|
1695
|
+
return e;
|
|
1696
|
+
}
|
|
1697
|
+
emStrongMask(e) {
|
|
1698
|
+
return e;
|
|
1699
|
+
}
|
|
1700
|
+
provideLexer() {
|
|
1701
|
+
return this.block ? Z.lex : Z.lexInline;
|
|
1702
|
+
}
|
|
1703
|
+
provideParser() {
|
|
1704
|
+
return this.block ? q.parse : q.parseInline;
|
|
1705
|
+
}
|
|
1706
|
+
}, _(ne, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), _(ne, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), ne), ga = class {
|
|
1707
|
+
constructor(...e) {
|
|
1708
|
+
_(this, "defaults", Ee());
|
|
1709
|
+
_(this, "options", this.setOptions);
|
|
1710
|
+
_(this, "parse", this.parseMarkdown(!0));
|
|
1711
|
+
_(this, "parseInline", this.parseMarkdown(!1));
|
|
1712
|
+
_(this, "Parser", q);
|
|
1713
|
+
_(this, "Renderer", le);
|
|
1714
|
+
_(this, "TextRenderer", Ve);
|
|
1715
|
+
_(this, "Lexer", Z);
|
|
1716
|
+
_(this, "Tokenizer", ce);
|
|
1717
|
+
_(this, "Hooks", J);
|
|
1718
|
+
this.use(...e);
|
|
1719
|
+
}
|
|
1720
|
+
walkTokens(e, t) {
|
|
1721
|
+
var a, s;
|
|
1722
|
+
let r = [];
|
|
1723
|
+
for (let i of e) switch (r = r.concat(t.call(this, i)), i.type) {
|
|
1724
|
+
case "table": {
|
|
1725
|
+
let o = i;
|
|
1726
|
+
for (let n of o.header) r = r.concat(this.walkTokens(n.tokens, t));
|
|
1727
|
+
for (let n of o.rows) for (let l of n) r = r.concat(this.walkTokens(l.tokens, t));
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
case "list": {
|
|
1731
|
+
let o = i;
|
|
1732
|
+
r = r.concat(this.walkTokens(o.items, t));
|
|
1733
|
+
break;
|
|
1734
|
+
}
|
|
1735
|
+
default: {
|
|
1736
|
+
let o = i;
|
|
1737
|
+
(s = (a = this.defaults.extensions) == null ? void 0 : a.childTokens) != null && s[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((n) => {
|
|
1738
|
+
let l = o[n].flat(1 / 0);
|
|
1739
|
+
r = r.concat(this.walkTokens(l, t));
|
|
1740
|
+
}) : o.tokens && (r = r.concat(this.walkTokens(o.tokens, t)));
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
return r;
|
|
1744
|
+
}
|
|
1745
|
+
use(...e) {
|
|
1746
|
+
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1747
|
+
return e.forEach((r) => {
|
|
1748
|
+
let a = { ...r };
|
|
1749
|
+
if (a.async = this.defaults.async || a.async || !1, r.extensions && (r.extensions.forEach((s) => {
|
|
1750
|
+
if (!s.name) throw new Error("extension name required");
|
|
1751
|
+
if ("renderer" in s) {
|
|
1752
|
+
let i = t.renderers[s.name];
|
|
1753
|
+
i ? t.renderers[s.name] = function(...o) {
|
|
1754
|
+
let n = s.renderer.apply(this, o);
|
|
1755
|
+
return n === !1 && (n = i.apply(this, o)), n;
|
|
1756
|
+
} : t.renderers[s.name] = s.renderer;
|
|
1757
|
+
}
|
|
1758
|
+
if ("tokenizer" in s) {
|
|
1759
|
+
if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1760
|
+
let i = t[s.level];
|
|
1761
|
+
i ? i.unshift(s.tokenizer) : t[s.level] = [s.tokenizer], s.start && (s.level === "block" ? t.startBlock ? t.startBlock.push(s.start) : t.startBlock = [s.start] : s.level === "inline" && (t.startInline ? t.startInline.push(s.start) : t.startInline = [s.start]));
|
|
1762
|
+
}
|
|
1763
|
+
"childTokens" in s && s.childTokens && (t.childTokens[s.name] = s.childTokens);
|
|
1764
|
+
}), a.extensions = t), r.renderer) {
|
|
1765
|
+
let s = this.defaults.renderer || new le(this.defaults);
|
|
1766
|
+
for (let i in r.renderer) {
|
|
1767
|
+
if (!(i in s)) throw new Error(`renderer '${i}' does not exist`);
|
|
1768
|
+
if (["options", "parser"].includes(i)) continue;
|
|
1769
|
+
let o = i, n = r.renderer[o], l = s[o];
|
|
1770
|
+
s[o] = (...c) => {
|
|
1771
|
+
let u = n.apply(s, c);
|
|
1772
|
+
return u === !1 && (u = l.apply(s, c)), u || "";
|
|
1773
|
+
};
|
|
1774
|
+
}
|
|
1775
|
+
a.renderer = s;
|
|
1776
|
+
}
|
|
1777
|
+
if (r.tokenizer) {
|
|
1778
|
+
let s = this.defaults.tokenizer || new ce(this.defaults);
|
|
1779
|
+
for (let i in r.tokenizer) {
|
|
1780
|
+
if (!(i in s)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
1781
|
+
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
1782
|
+
let o = i, n = r.tokenizer[o], l = s[o];
|
|
1783
|
+
s[o] = (...c) => {
|
|
1784
|
+
let u = n.apply(s, c);
|
|
1785
|
+
return u === !1 && (u = l.apply(s, c)), u;
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
a.tokenizer = s;
|
|
1789
|
+
}
|
|
1790
|
+
if (r.hooks) {
|
|
1791
|
+
let s = this.defaults.hooks || new J();
|
|
1792
|
+
for (let i in r.hooks) {
|
|
1793
|
+
if (!(i in s)) throw new Error(`hook '${i}' does not exist`);
|
|
1794
|
+
if (["options", "block"].includes(i)) continue;
|
|
1795
|
+
let o = i, n = r.hooks[o], l = s[o];
|
|
1796
|
+
J.passThroughHooks.has(i) ? s[o] = (c) => {
|
|
1797
|
+
if (this.defaults.async && J.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1798
|
+
let f = await n.call(s, c);
|
|
1799
|
+
return l.call(s, f);
|
|
1800
|
+
})();
|
|
1801
|
+
let u = n.call(s, c);
|
|
1802
|
+
return l.call(s, u);
|
|
1803
|
+
} : s[o] = (...c) => {
|
|
1804
|
+
if (this.defaults.async) return (async () => {
|
|
1805
|
+
let f = await n.apply(s, c);
|
|
1806
|
+
return f === !1 && (f = await l.apply(s, c)), f;
|
|
1807
|
+
})();
|
|
1808
|
+
let u = n.apply(s, c);
|
|
1809
|
+
return u === !1 && (u = l.apply(s, c)), u;
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
a.hooks = s;
|
|
1813
|
+
}
|
|
1814
|
+
if (r.walkTokens) {
|
|
1815
|
+
let s = this.defaults.walkTokens, i = r.walkTokens;
|
|
1816
|
+
a.walkTokens = function(o) {
|
|
1817
|
+
let n = [];
|
|
1818
|
+
return n.push(i.call(this, o)), s && (n = n.concat(s.call(this, o))), n;
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1821
|
+
this.defaults = { ...this.defaults, ...a };
|
|
1822
|
+
}), this;
|
|
1823
|
+
}
|
|
1824
|
+
setOptions(e) {
|
|
1825
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1826
|
+
}
|
|
1827
|
+
lexer(e, t) {
|
|
1828
|
+
return Z.lex(e, t ?? this.defaults);
|
|
1829
|
+
}
|
|
1830
|
+
parser(e, t) {
|
|
1831
|
+
return q.parse(e, t ?? this.defaults);
|
|
1832
|
+
}
|
|
1833
|
+
parseMarkdown(e) {
|
|
1834
|
+
return (t, r) => {
|
|
1835
|
+
let a = { ...r }, s = { ...this.defaults, ...a }, i = this.onError(!!s.silent, !!s.async);
|
|
1836
|
+
if (this.defaults.async === !0 && a.async === !1) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1837
|
+
if (typeof t > "u" || t === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1838
|
+
if (typeof t != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1839
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
1840
|
+
let o = s.hooks ? await s.hooks.preprocess(t) : t, n = await (s.hooks ? await s.hooks.provideLexer() : e ? Z.lex : Z.lexInline)(o, s), l = s.hooks ? await s.hooks.processAllTokens(n) : n;
|
|
1841
|
+
s.walkTokens && await Promise.all(this.walkTokens(l, s.walkTokens));
|
|
1842
|
+
let c = await (s.hooks ? await s.hooks.provideParser() : e ? q.parse : q.parseInline)(l, s);
|
|
1843
|
+
return s.hooks ? await s.hooks.postprocess(c) : c;
|
|
1844
|
+
})().catch(i);
|
|
1845
|
+
try {
|
|
1846
|
+
s.hooks && (t = s.hooks.preprocess(t));
|
|
1847
|
+
let o = (s.hooks ? s.hooks.provideLexer() : e ? Z.lex : Z.lexInline)(t, s);
|
|
1848
|
+
s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
|
|
1849
|
+
let n = (s.hooks ? s.hooks.provideParser() : e ? q.parse : q.parseInline)(o, s);
|
|
1850
|
+
return s.hooks && (n = s.hooks.postprocess(n)), n;
|
|
1851
|
+
} catch (o) {
|
|
1852
|
+
return i(o);
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
onError(e, t) {
|
|
1857
|
+
return (r) => {
|
|
1858
|
+
if (r.message += `
|
|
1859
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1860
|
+
let a = "<p>An error occurred:</p><pre>" + j(r.message + "", !0) + "</pre>";
|
|
1861
|
+
return t ? Promise.resolve(a) : a;
|
|
1862
|
+
}
|
|
1863
|
+
if (t) return Promise.reject(r);
|
|
1864
|
+
throw r;
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
}, F = new ga();
|
|
1868
|
+
function L(e, t) {
|
|
1869
|
+
return F.parse(e, t);
|
|
1870
|
+
}
|
|
1871
|
+
L.options = L.setOptions = function(e) {
|
|
1872
|
+
return F.setOptions(e), L.defaults = F.defaults, Xt(L.defaults), L;
|
|
1873
|
+
};
|
|
1874
|
+
L.getDefaults = Ee;
|
|
1875
|
+
L.defaults = U;
|
|
1876
|
+
L.use = function(...e) {
|
|
1877
|
+
return F.use(...e), L.defaults = F.defaults, Xt(L.defaults), L;
|
|
1878
|
+
};
|
|
1879
|
+
L.walkTokens = function(e, t) {
|
|
1880
|
+
return F.walkTokens(e, t);
|
|
1881
|
+
};
|
|
1882
|
+
L.parseInline = F.parseInline;
|
|
1883
|
+
L.Parser = q;
|
|
1884
|
+
L.parser = q.parse;
|
|
1885
|
+
L.Renderer = le;
|
|
1886
|
+
L.TextRenderer = Ve;
|
|
1887
|
+
L.Lexer = Z;
|
|
1888
|
+
L.lexer = Z.lex;
|
|
1889
|
+
L.Tokenizer = ce;
|
|
1890
|
+
L.Hooks = J;
|
|
1891
|
+
L.parse = L;
|
|
1892
|
+
L.options;
|
|
1893
|
+
L.setOptions;
|
|
1894
|
+
L.use;
|
|
1895
|
+
L.walkTokens;
|
|
1896
|
+
L.parseInline;
|
|
1897
|
+
q.parse;
|
|
1898
|
+
Z.lex;
|
|
1899
|
+
const ma = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "avif"];
|
|
1900
|
+
function wa(e) {
|
|
1901
|
+
const t = [];
|
|
1902
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (i) => {
|
|
1903
|
+
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
1904
|
+
return t.push(i), o;
|
|
1905
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (i) => {
|
|
1906
|
+
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
1907
|
+
return t.push(i), o;
|
|
1908
|
+
}), e = e.replace(/<img[^>]*>/gi, (i) => {
|
|
1909
|
+
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
1910
|
+
return t.push(i), o;
|
|
1911
|
+
}), e = e.replace(/<div class="(?:artifactuse-)?image-container">[\s\S]*?<\/div>\s*<\/div>/gi, (i) => {
|
|
1912
|
+
const o = `__IMG_PROTECTED_${t.length}__`;
|
|
1913
|
+
return t.push(i), o;
|
|
1914
|
+
});
|
|
1915
|
+
const r = ma.join("|"), a = new RegExp(
|
|
1916
|
+
`<a[^>]*href="(https?:\\/\\/[^"]+\\.(?:${r})(?:\\?[^"]*)?)"[^>]*>([^<]*)<\\/a>`,
|
|
1917
|
+
"gi"
|
|
1918
|
+
);
|
|
1919
|
+
e = e.replace(a, (i, o, n) => {
|
|
1920
|
+
const l = n && !n.match(/^(view|see|open|click|image|photo|picture)$/i) ? n : "";
|
|
1921
|
+
return Re(o, l, l);
|
|
1922
|
+
});
|
|
1923
|
+
const s = new RegExp(
|
|
1924
|
+
`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(?:${r})(\\?[^\\s<>"]*)?)(?!["'])`,
|
|
1925
|
+
"gi"
|
|
1926
|
+
);
|
|
1927
|
+
e = e.replace(s, (i, o) => Re(o, "", ""));
|
|
1928
|
+
for (let i = t.length - 1; i >= 0; i--)
|
|
1929
|
+
e = e.replace(`__IMG_PROTECTED_${i}__`, t[i]);
|
|
1930
|
+
return e;
|
|
1931
|
+
}
|
|
1932
|
+
function Re(e, t, r) {
|
|
1933
|
+
const a = t || r || "";
|
|
1934
|
+
let s = "artifactuse-image";
|
|
1935
|
+
e.includes("large2x") || e.includes("large") || r != null && r.toLowerCase().includes("hero") ? s = "artifactuse-hero-image" : e.includes("small") || e.includes("tiny") ? s = "artifactuse-inline-image" : (r != null && r.toLowerCase().includes("aerial") || r != null && r.toLowerCase().includes("view")) && (s = "artifactuse-hero-image");
|
|
1936
|
+
let i = '<div class="artifactuse-image-container">';
|
|
1937
|
+
return i += `<img src="${e}" alt="${r || ""}" class="${s}" data-lightbox="true" data-caption="${a}" loading="lazy" />`, a && (i += `<div class="artifactuse-image-caption">${a}</div>`), i += "</div>", i;
|
|
1938
|
+
}
|
|
1939
|
+
function ba(e) {
|
|
1940
|
+
const t = e.split(`
|
|
1941
|
+
`), r = [];
|
|
1942
|
+
let a = [], s = !1;
|
|
1943
|
+
for (let i = 0; i < t.length; i++) {
|
|
1944
|
+
const o = t[i].trim();
|
|
1945
|
+
if (o.includes('<div class="artifactuse-image-container">')) {
|
|
1946
|
+
s || (s = !0, a = []);
|
|
1947
|
+
let n = "", l = i, c = 0;
|
|
1948
|
+
for (; l < t.length; ) {
|
|
1949
|
+
const u = t[l];
|
|
1950
|
+
if (n += u + `
|
|
1951
|
+
`, c += (u.match(/<div/g) || []).length, c -= (u.match(/<\/div>/g) || []).length, c === 0) break;
|
|
1952
|
+
l++;
|
|
1953
|
+
}
|
|
1954
|
+
a.push(n.trim()), i = l;
|
|
1955
|
+
} else if (o === "" || o.match(/^\s*$/)) {
|
|
1956
|
+
if (s) continue;
|
|
1957
|
+
r.push(t[i]);
|
|
1958
|
+
} else {
|
|
1959
|
+
if (s && a.length >= 2) {
|
|
1960
|
+
const n = Ke(a);
|
|
1961
|
+
r.push(n);
|
|
1962
|
+
} else s && a.length === 1 && r.push(a[0]);
|
|
1963
|
+
s = !1, a = [], r.push(t[i]);
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
if (s && a.length >= 2) {
|
|
1967
|
+
const i = Ke(a);
|
|
1968
|
+
r.push(i);
|
|
1969
|
+
} else s && a.length === 1 && r.push(a[0]);
|
|
1970
|
+
return r.join(`
|
|
1971
|
+
`);
|
|
1972
|
+
}
|
|
1973
|
+
function Ke(e) {
|
|
1974
|
+
return `<div class="artifactuse-image-gallery">
|
|
1975
|
+
${e.map((r) => r.replace("artifactuse-image-container", "artifactuse-gallery-item").replace("artifactuse-image-caption", "artifactuse-gallery-caption").replace("artifactuse-image", "artifactuse-gallery-image").replace("artifactuse-hero-image", "artifactuse-gallery-image").replace("artifactuse-inline-image", "artifactuse-gallery-image")).join(`
|
|
1976
|
+
`)}
|
|
1977
|
+
</div>`;
|
|
1978
|
+
}
|
|
1979
|
+
const ir = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
|
|
1980
|
+
function va(e) {
|
|
1981
|
+
if (!e) return !1;
|
|
1982
|
+
const t = ir.join("|");
|
|
1983
|
+
return !!(new RegExp(`\\.(${t})(\\?.*)?$`, "i").test(e) || /(?:youtube\.com\/watch\?v=|youtu\.be\/)[a-zA-Z0-9_-]+/.test(e) || /vimeo\.com\/\d+/.test(e) || /loom\.com\/share\/[a-zA-Z0-9]+/.test(e) || /dailymotion\.com\/video\/[a-zA-Z0-9]+/.test(e));
|
|
1984
|
+
}
|
|
1985
|
+
function ya(e) {
|
|
1986
|
+
if (!e) return null;
|
|
1987
|
+
let t = e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
|
|
1988
|
+
if (t) return { type: "youtube", id: t[1] };
|
|
1989
|
+
if (t = e.match(/vimeo\.com\/(\d+)/), t) return { type: "vimeo", id: t[1] };
|
|
1990
|
+
if (t = e.match(/loom\.com\/share\/([a-zA-Z0-9]+)/), t) return { type: "loom", id: t[1] };
|
|
1991
|
+
if (t = e.match(/dailymotion\.com\/video\/([a-zA-Z0-9]+)/), t) return { type: "dailymotion", id: t[1] };
|
|
1992
|
+
const r = ir.join("|");
|
|
1993
|
+
return new RegExp(`\\.(${r})(\\?.*)?$`, "i").test(e) ? { type: "direct", id: e } : null;
|
|
1994
|
+
}
|
|
1995
|
+
function ka(e) {
|
|
1996
|
+
const t = ya(e);
|
|
1997
|
+
if (!t) return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
|
|
1998
|
+
switch (t.type) {
|
|
1999
|
+
case "youtube":
|
|
2000
|
+
return ze(t.id);
|
|
2001
|
+
case "vimeo":
|
|
2002
|
+
return Se(t.id);
|
|
2003
|
+
case "loom":
|
|
2004
|
+
return Le(t.id);
|
|
2005
|
+
case "dailymotion":
|
|
2006
|
+
return _e(t.id);
|
|
2007
|
+
case "direct":
|
|
2008
|
+
return Ae(t.id);
|
|
2009
|
+
default:
|
|
2010
|
+
return `<a href="${e}" target="_blank" rel="noopener noreferrer">${e}</a>`;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
function xa(e) {
|
|
2014
|
+
const t = [];
|
|
2015
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (d) => {
|
|
2016
|
+
const b = `__PROTECTED_${t.length}__`;
|
|
2017
|
+
return t.push(d), b;
|
|
2018
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (d) => {
|
|
2019
|
+
const b = `__PROTECTED_${t.length}__`;
|
|
2020
|
+
return t.push(d), b;
|
|
2021
|
+
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (d) => {
|
|
2022
|
+
const b = `__PROTECTED_${t.length}__`;
|
|
2023
|
+
return t.push(d), b;
|
|
2024
|
+
});
|
|
2025
|
+
const r = /\[([^\]]+)\]\((https:\/\/www\.pexels\.com\/video\/[^)]+)\)\s*(?:<\/p>)?\s*(?:<p>)?\s*(?:Preview image:\s*)?!\[([^\]]*)\]\((https:\/\/images\.pexels\.com\/videos\/[^)]+)\)/gi;
|
|
2026
|
+
e = e.replace(r, (d, b, h, w, g) => Ra(b, h, g, w));
|
|
2027
|
+
const a = /<a[^>]*href="(https?:\/\/[^"]+\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2028
|
+
e = e.replace(a, (d, b) => Ae(b));
|
|
2029
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp4|webm|mov|avi|mkv|flv|wmv|m4v)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2030
|
+
e = e.replace(s, (d, b) => Ae(b));
|
|
2031
|
+
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2032
|
+
e = e.replace(i, (d, b, h) => ze(h));
|
|
2033
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2034
|
+
e = e.replace(o, (d, b, h) => ze(h));
|
|
2035
|
+
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?vimeo\.com\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2036
|
+
e = e.replace(n, (d, b, h) => Se(h));
|
|
2037
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?vimeo\\.com\\/(\\d+))(?!["'])`, "gi");
|
|
2038
|
+
e = e.replace(l, (d, b, h) => Se(h));
|
|
2039
|
+
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?loom\.com\/share\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2040
|
+
e = e.replace(c, (d, b, h) => Le(h));
|
|
2041
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?loom\\.com\\/share\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2042
|
+
e = e.replace(u, (d, b, h) => Le(h));
|
|
2043
|
+
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?dailymotion\.com\/video\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2044
|
+
e = e.replace(f, (d, b, h) => _e(h));
|
|
2045
|
+
const y = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?dailymotion\\.com\\/video\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2046
|
+
e = e.replace(y, (d, b, h) => _e(h));
|
|
2047
|
+
for (let d = t.length - 1; d >= 0; d--)
|
|
2048
|
+
e = e.replace(`__PROTECTED_${d}__`, t[d]);
|
|
2049
|
+
return e;
|
|
2050
|
+
}
|
|
2051
|
+
function $a(e) {
|
|
2052
|
+
const t = e.split("?")[0].split(".").pop().toLowerCase();
|
|
2053
|
+
return {
|
|
2054
|
+
mp4: "video/mp4",
|
|
2055
|
+
m4v: "video/mp4",
|
|
2056
|
+
webm: "video/webm",
|
|
2057
|
+
mov: "video/quicktime",
|
|
2058
|
+
avi: "video/x-msvideo",
|
|
2059
|
+
mkv: "video/x-matroska",
|
|
2060
|
+
flv: "video/x-flv",
|
|
2061
|
+
wmv: "video/x-ms-wmv"
|
|
2062
|
+
}[t] || "video/mp4";
|
|
2063
|
+
}
|
|
2064
|
+
function Ae(e) {
|
|
2065
|
+
const t = $a(e);
|
|
2066
|
+
return `<div class="artifactuse-video-wrapper"><video controls preload="metadata" class="artifactuse-video"><source src="${e}" type="${t}">Your browser does not support the video tag.</video></div>`;
|
|
2067
|
+
}
|
|
2068
|
+
function Ra(e, t, r, a) {
|
|
2069
|
+
return `<div class="artifactuse-video-preview-container"><div class="artifactuse-video-preview-wrapper" data-video-url="${t}"><img src="${r}" alt="${a}" class="artifactuse-video-preview-image" loading="lazy" /><div class="artifactuse-video-play-overlay"><svg class="artifactuse-play-icon" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></div><div class="artifactuse-video-info-overlay"><h4 class="artifactuse-video-title">${e}</h4><p class="artifactuse-video-alt">${a}</p></div></div><div class="artifactuse-video-actions"><a href="${t}" target="_blank" rel="noopener" class="artifactuse-video-link">Watch on Pexels</a></div></div>`;
|
|
2070
|
+
}
|
|
2071
|
+
function ze(e) {
|
|
2072
|
+
const t = `https://i.ytimg.com/vi/${e}/hqdefault.jpg`, a = `this.parentElement.innerHTML='<iframe src=\\'${`https://www.youtube.com/embed/${e}?autoplay=1`}\\' frameborder=\\'0\\' allow=\\'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2073
|
+
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="youtube" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play YouTube video" onclick="${a}"><img src="${t}" alt="YouTube video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" /><div class="artifactuse-video-play-button artifactuse-youtube-play"><svg viewBox="0 0 68 48" width="68" height="48"><path class="artifactuse-youtube-play-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"/><path d="M 45,24 27,14 27,34" fill="#fff"/></svg></div></button></div>`;
|
|
2074
|
+
}
|
|
2075
|
+
function Se(e) {
|
|
2076
|
+
const t = `https://player.vimeo.com/video/${e}?autoplay=1`, r = `https://vumbnail.com/${e}.jpg`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allow=\\'autoplay; fullscreen; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2077
|
+
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="vimeo" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Vimeo video" onclick="${a}"><img src="${r}" alt="Vimeo video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-vimeo-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#1ab7ea"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2078
|
+
}
|
|
2079
|
+
function Le(e) {
|
|
2080
|
+
const t = `https://www.loom.com/embed/${e}?autoplay=1`, r = `https://cdn.loom.com/sessions/thumbnails/${e}-with-play.gif`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2081
|
+
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="loom" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Loom video" onclick="${a}"><img src="${r}" alt="Loom video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-loom-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#625df5"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2082
|
+
}
|
|
2083
|
+
function _e(e) {
|
|
2084
|
+
const t = `https://www.dailymotion.com/embed/video/${e}?autoplay=1`, r = `https://www.dailymotion.com/thumbnail/video/${e}`, a = `this.parentElement.innerHTML='<iframe src=\\'${t}\\' frameborder=\\'0\\' allow=\\'autoplay; fullscreen; picture-in-picture\\' allowfullscreen class=\\'artifactuse-video-iframe\\'></iframe>'`;
|
|
2085
|
+
return `<div class="artifactuse-video-wrapper artifactuse-video-lazy" data-video-type="dailymotion" data-video-id="${e}"><button type="button" class="artifactuse-video-facade" aria-label="Play Dailymotion video" onclick="${a}"><img src="${r}" alt="Dailymotion video thumbnail" class="artifactuse-video-thumbnail" loading="lazy" onerror="this.style.display='none'" /><div class="artifactuse-video-play-button artifactuse-dailymotion-play"><svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="31" fill="#0066dc"/><path d="M26 20 L26 44 L46 32 Z" fill="#fff"/></svg></div></button></div>`;
|
|
2086
|
+
}
|
|
2087
|
+
function Aa(e) {
|
|
2088
|
+
let t = e.replace(/<\/p>/g, "").replace(/<p>/g, "").replace(/<br\s*\/?>/g, "").replace(/<strong>.*?<\/strong>/g, "").replace(/<em>.*?<\/em>/g, "").replace(/<b>.*?<\/b>/g, "").replace(/<i>.*?<\/i>/g, "").replace(/\n/g, "").replace(/\s+/g, "").trim();
|
|
2089
|
+
return /<(?!\/)[^>]+>/.test(t) ? !1 : t.length < 200;
|
|
2090
|
+
}
|
|
2091
|
+
function we(e) {
|
|
2092
|
+
let t = e.match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
|
|
2093
|
+
if (t) {
|
|
2094
|
+
const r = t[1].trim(), a = r.replace(/<[^>]*>/g, "").trim();
|
|
2095
|
+
if (a.length > 0 && a.length < 200)
|
|
2096
|
+
return r;
|
|
2097
|
+
}
|
|
2098
|
+
if (t = e.match(/<p>((?:[^<]|<(?!\/p>|p>))*?)(?:<br\s*\/?>)?\s*$/), t) {
|
|
2099
|
+
const r = t[1].trim(), a = r.replace(/<[^>]*>/g, "").trim();
|
|
2100
|
+
if (a.length > 0 && a.length < 200)
|
|
2101
|
+
return r;
|
|
2102
|
+
}
|
|
2103
|
+
return "";
|
|
2104
|
+
}
|
|
2105
|
+
function za(e) {
|
|
2106
|
+
const t = /<div class="artifactuse-video-(wrapper|preview-container)/g, r = [];
|
|
2107
|
+
let a;
|
|
2108
|
+
for (; (a = t.exec(e)) !== null; ) {
|
|
2109
|
+
const l = a.index;
|
|
2110
|
+
let c = 0, u = l;
|
|
2111
|
+
for (let f = l; f < e.length; f++)
|
|
2112
|
+
if (e.substring(f, f + 4) === "<div")
|
|
2113
|
+
c++;
|
|
2114
|
+
else if (e.substring(f, f + 6) === "</div>" && (c--, c === 0)) {
|
|
2115
|
+
u = f + 6;
|
|
2116
|
+
break;
|
|
2117
|
+
}
|
|
2118
|
+
r.push({
|
|
2119
|
+
start: l,
|
|
2120
|
+
end: u,
|
|
2121
|
+
html: e.substring(l, u)
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
if (r.length < 2)
|
|
2125
|
+
return e.replace(/<p>\s*<\/p>/g, "");
|
|
2126
|
+
const s = [];
|
|
2127
|
+
let i = [{
|
|
2128
|
+
...r[0],
|
|
2129
|
+
caption: we(e.substring(0, r[0].start))
|
|
2130
|
+
}];
|
|
2131
|
+
for (let l = 1; l < r.length; l++) {
|
|
2132
|
+
const c = r[l - 1], u = r[l], f = e.substring(c.end, u.start);
|
|
2133
|
+
Aa(f) ? i.push({
|
|
2134
|
+
...u,
|
|
2135
|
+
caption: we(f)
|
|
2136
|
+
}) : (s.push([...i]), i = [{
|
|
2137
|
+
...u,
|
|
2138
|
+
caption: we(e.substring(c.end, u.start))
|
|
2139
|
+
}]);
|
|
2140
|
+
}
|
|
2141
|
+
s.push(i);
|
|
2142
|
+
let o = "", n = 0;
|
|
2143
|
+
for (const l of s) {
|
|
2144
|
+
if (l.length === 0) continue;
|
|
2145
|
+
const c = l[0];
|
|
2146
|
+
let u = c.start;
|
|
2147
|
+
const y = e.substring(n, c.start).match(/<p>((?:[^<]|<(?!\/p>))*?)(?:<br\s*\/?>)?\s*<\/p>\s*$/);
|
|
2148
|
+
if (y && (u = c.start - y[0].length, l[0].caption = y[1].trim()), o += e.substring(n, u), l.length >= 2)
|
|
2149
|
+
o += Sa(l);
|
|
2150
|
+
else {
|
|
2151
|
+
const d = l[0];
|
|
2152
|
+
d.caption ? o += `<div class="artifactuse-video-container">${d.html}<div class="artifactuse-video-caption">${d.caption}</div></div>` : o += d.html;
|
|
2153
|
+
}
|
|
2154
|
+
n = l[l.length - 1].end;
|
|
2155
|
+
}
|
|
2156
|
+
return o += e.substring(n), o = o.replace(/<p>\s*<\/p>/g, ""), o;
|
|
2157
|
+
}
|
|
2158
|
+
function Sa(e) {
|
|
2159
|
+
return `<div class="artifactuse-video-gallery">
|
|
2160
|
+
${e.map(({ html: r, caption: a }) => {
|
|
2161
|
+
let s = r.replace(
|
|
2162
|
+
/class="artifactuse-video-wrapper/g,
|
|
2163
|
+
'class="artifactuse-video-gallery-item artifactuse-video-wrapper'
|
|
2164
|
+
);
|
|
2165
|
+
return s = s.replace(
|
|
2166
|
+
/class="artifactuse-video-preview-container/g,
|
|
2167
|
+
'class="artifactuse-video-gallery-item artifactuse-video-preview-container'
|
|
2168
|
+
), a ? `<div class="artifactuse-video-item-container">${s}<div class="artifactuse-video-caption">${a}</div></div>` : s;
|
|
2169
|
+
}).join(`
|
|
2170
|
+
`)}
|
|
2171
|
+
</div>`;
|
|
2172
|
+
}
|
|
2173
|
+
function La() {
|
|
2174
|
+
return `audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
2175
|
+
}
|
|
2176
|
+
function _a(e, t = {}) {
|
|
2177
|
+
const r = t.theme || "dark", a = [];
|
|
2178
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (k) => {
|
|
2179
|
+
const A = `__PROTECTED_${a.length}__`;
|
|
2180
|
+
return a.push(k), A;
|
|
2181
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (k) => {
|
|
2182
|
+
const A = `__PROTECTED_${a.length}__`;
|
|
2183
|
+
return a.push(k), A;
|
|
2184
|
+
}), e = e.replace(/<(video|audio|iframe)[^>]*>[\s\S]*?<\/\1>/gi, (k) => {
|
|
2185
|
+
const A = `__PROTECTED_${a.length}__`;
|
|
2186
|
+
return a.push(k), A;
|
|
2187
|
+
});
|
|
2188
|
+
const s = /<a[^>]*href="(https?:\/\/[^"]+\.(mp3|wav|flac|aac|ogg|m4a|wma)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2189
|
+
e = e.replace(s, (k, A) => Je(A));
|
|
2190
|
+
const i = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mp3|wav|flac|aac|ogg|m4a|wma)(\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2191
|
+
e = e.replace(i, (k, A) => Je(A));
|
|
2192
|
+
const o = /<a[^>]*href="(https?:\/\/(?:www\.)?soundcloud\.com\/[^"]+)"[^>]*>[^<]*<\/a>/gi;
|
|
2193
|
+
e = e.replace(o, (k, A) => Ye(A));
|
|
2194
|
+
const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?soundcloud\\.com\\/[^\\s<>"]+)(?!["'])`, "gi");
|
|
2195
|
+
e = e.replace(n, (k, A) => Ye(A));
|
|
2196
|
+
const l = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2197
|
+
e = e.replace(l, (k, A, z) => E("track", z, r));
|
|
2198
|
+
const c = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/track\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2199
|
+
e = e.replace(c, (k, A, z) => E("track", z, r));
|
|
2200
|
+
const u = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2201
|
+
e = e.replace(u, (k, A, z) => E("album", z, r));
|
|
2202
|
+
const f = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/album\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2203
|
+
e = e.replace(f, (k, A, z) => E("album", z, r));
|
|
2204
|
+
const y = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2205
|
+
e = e.replace(y, (k, A, z) => E("playlist", z, r));
|
|
2206
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/playlist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2207
|
+
e = e.replace(d, (k, A, z) => E("playlist", z, r));
|
|
2208
|
+
const b = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/artist\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2209
|
+
e = e.replace(b, (k, A, z) => E("artist", z, r));
|
|
2210
|
+
const h = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/artist\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2211
|
+
e = e.replace(h, (k, A, z) => E("artist", z, r));
|
|
2212
|
+
const w = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/episode\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2213
|
+
e = e.replace(w, (k, A, z) => E("episode", z, r));
|
|
2214
|
+
const g = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/episode\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2215
|
+
e = e.replace(g, (k, A, z) => E("episode", z, r));
|
|
2216
|
+
const p = /<a[^>]*href="(https?:\/\/open\.spotify\.com\/show\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2217
|
+
e = e.replace(p, (k, A, z) => E("show", z, r));
|
|
2218
|
+
const v = new RegExp(`(?<!["'=])(https?:\\/\\/open\\.spotify\\.com\\/show\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2219
|
+
e = e.replace(v, (k, A, z) => E("show", z, r));
|
|
2220
|
+
const m = /<a[^>]*href="(https?:\/\/music\.apple\.com\/([a-z]{2})\/([a-z-]+)\/[^\/]+\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2221
|
+
e = e.replace(m, (k, A, z, M, P) => et(z, M, P));
|
|
2222
|
+
const x = new RegExp(`(?<!["'=])(https?:\\/\\/music\\.apple\\.com\\/([a-z]{2})\\/([a-z-]+)\\/[^\\/\\s]+\\/(\\d+))(?!["'])`, "gi");
|
|
2223
|
+
e = e.replace(x, (k, A, z, M, P) => et(z, M, P));
|
|
2224
|
+
for (let k = a.length - 1; k >= 0; k--)
|
|
2225
|
+
e = e.replace(`__PROTECTED_${k}__`, a[k]);
|
|
2226
|
+
return e;
|
|
2227
|
+
}
|
|
2228
|
+
function Ca(e) {
|
|
2229
|
+
const t = e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);
|
|
2230
|
+
return t ? t[1].toUpperCase() : "AUDIO";
|
|
2231
|
+
}
|
|
2232
|
+
function K(e) {
|
|
2233
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2234
|
+
}
|
|
2235
|
+
function Je(e) {
|
|
2236
|
+
const t = La(), r = decodeURIComponent(e.split("/").pop().split("?")[0]), a = Ca(e);
|
|
2237
|
+
return `
|
|
2238
|
+
<div class="artifactuse-audio-player" data-player-id="${t}" data-audio-src="${K(e)}">
|
|
2239
|
+
<!-- Hidden audio element -->
|
|
2240
|
+
<audio preload="metadata" class="artifactuse-audio-element">
|
|
2241
|
+
<source src="${K(e)}" type="audio/mpeg">
|
|
2242
|
+
</audio>
|
|
2243
|
+
|
|
2244
|
+
<!-- Header -->
|
|
2245
|
+
<div class="artifactuse-audio-header">
|
|
2246
|
+
<div class="artifactuse-audio-icon">
|
|
2247
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2248
|
+
<path d="M9 18V5l12-2v13"></path>
|
|
2249
|
+
<circle cx="6" cy="18" r="3"></circle>
|
|
2250
|
+
<circle cx="18" cy="16" r="3"></circle>
|
|
2251
|
+
</svg>
|
|
2252
|
+
</div>
|
|
2253
|
+
<div class="artifactuse-audio-meta">
|
|
2254
|
+
<span class="artifactuse-audio-filename" title="${K(r)}">${K(r)}</span>
|
|
2255
|
+
<span class="artifactuse-audio-format">${a}</span>
|
|
2256
|
+
</div>
|
|
2257
|
+
<span class="artifactuse-audio-duration">--:--</span>
|
|
2258
|
+
</div>
|
|
2259
|
+
|
|
2260
|
+
<!-- Waveform -->
|
|
2261
|
+
<div class="artifactuse-audio-waveform-container">
|
|
2262
|
+
<div class="artifactuse-audio-waveform">
|
|
2263
|
+
<canvas class="artifactuse-audio-waveform-canvas"></canvas>
|
|
2264
|
+
<div class="artifactuse-audio-waveform-progress"></div>
|
|
2265
|
+
<div class="artifactuse-audio-waveform-hover"></div>
|
|
2266
|
+
</div>
|
|
2267
|
+
</div>
|
|
2268
|
+
|
|
2269
|
+
<!-- Controls -->
|
|
2270
|
+
<div class="artifactuse-audio-controls">
|
|
2271
|
+
<div class="artifactuse-audio-controls-left">
|
|
2272
|
+
<!-- Play/Pause -->
|
|
2273
|
+
<button class="artifactuse-audio-btn artifactuse-audio-play-btn" aria-label="Play">
|
|
2274
|
+
<svg class="artifactuse-audio-icon-play" viewBox="0 0 24 24" fill="currentColor">
|
|
2275
|
+
<polygon points="5 3 19 12 5 21 5 3"></polygon>
|
|
2276
|
+
</svg>
|
|
2277
|
+
<svg class="artifactuse-audio-icon-pause" viewBox="0 0 24 24" fill="currentColor" style="display: none;">
|
|
2278
|
+
<rect x="6" y="4" width="4" height="16"></rect>
|
|
2279
|
+
<rect x="14" y="4" width="4" height="16"></rect>
|
|
2280
|
+
</svg>
|
|
2281
|
+
</button>
|
|
2282
|
+
|
|
2283
|
+
<!-- Time -->
|
|
2284
|
+
<div class="artifactuse-audio-time">
|
|
2285
|
+
<span class="artifactuse-audio-current">0:00</span>
|
|
2286
|
+
</div>
|
|
2287
|
+
</div>
|
|
2288
|
+
|
|
2289
|
+
<div class="artifactuse-audio-controls-right">
|
|
2290
|
+
<!-- Playback Speed -->
|
|
2291
|
+
<button class="artifactuse-audio-btn artifactuse-audio-speed-btn" aria-label="Playback speed">
|
|
2292
|
+
<span>1x</span>
|
|
2293
|
+
</button>
|
|
2294
|
+
|
|
2295
|
+
<!-- Volume -->
|
|
2296
|
+
<div class="artifactuse-audio-volume">
|
|
2297
|
+
<button class="artifactuse-audio-btn artifactuse-audio-mute-btn" aria-label="Mute">
|
|
2298
|
+
<svg class="artifactuse-audio-icon-volume" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2299
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
|
|
2300
|
+
<path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
|
|
2301
|
+
<path d="M19.07 4.93a10 10 0 0 1 0 14.14"></path>
|
|
2302
|
+
</svg>
|
|
2303
|
+
<svg class="artifactuse-audio-icon-muted" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="display: none;">
|
|
2304
|
+
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
|
|
2305
|
+
<line x1="23" y1="9" x2="17" y2="15"></line>
|
|
2306
|
+
<line x1="17" y1="9" x2="23" y2="15"></line>
|
|
2307
|
+
</svg>
|
|
2308
|
+
</button>
|
|
2309
|
+
<div class="artifactuse-audio-volume-slider-container">
|
|
2310
|
+
<input type="range" class="artifactuse-audio-volume-slider" min="0" max="100" value="100" aria-label="Volume">
|
|
2311
|
+
</div>
|
|
2312
|
+
</div>
|
|
2313
|
+
|
|
2314
|
+
<!-- Download -->
|
|
2315
|
+
<a href="${K(e)}" download class="artifactuse-audio-btn artifactuse-audio-download-btn" aria-label="Download">
|
|
2316
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2317
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
2318
|
+
<polyline points="7 10 12 15 17 10"></polyline>
|
|
2319
|
+
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
2320
|
+
</svg>
|
|
2321
|
+
</a>
|
|
2322
|
+
</div>
|
|
2323
|
+
</div>
|
|
2324
|
+
</div>
|
|
2325
|
+
`;
|
|
2326
|
+
}
|
|
2327
|
+
function Ye(e) {
|
|
2328
|
+
return `
|
|
2329
|
+
<div class="artifactuse-soundcloud-wrapper">
|
|
2330
|
+
<iframe
|
|
2331
|
+
src="https://w.soundcloud.com/player/?url=${encodeURIComponent(e)}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"
|
|
2332
|
+
frameborder="0"
|
|
2333
|
+
class="artifactuse-soundcloud-embed"
|
|
2334
|
+
loading="lazy">
|
|
2335
|
+
</iframe>
|
|
2336
|
+
</div>
|
|
2337
|
+
`;
|
|
2338
|
+
}
|
|
2339
|
+
function E(e, t, r = "dark") {
|
|
2340
|
+
const s = {
|
|
2341
|
+
track: 152,
|
|
2342
|
+
album: 352,
|
|
2343
|
+
playlist: 352,
|
|
2344
|
+
artist: 352,
|
|
2345
|
+
episode: 152,
|
|
2346
|
+
show: 352
|
|
2347
|
+
}[e] || 152;
|
|
2348
|
+
return `
|
|
2349
|
+
<div class="artifactuse-spotify-wrapper">
|
|
2350
|
+
<iframe
|
|
2351
|
+
src="https://open.spotify.com/embed/${e}/${t}?utm_source=generator&theme=${r === "light" ? "1" : "0"}"
|
|
2352
|
+
frameborder="0"
|
|
2353
|
+
allowfullscreen
|
|
2354
|
+
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
|
|
2355
|
+
class="artifactuse-spotify-embed"
|
|
2356
|
+
style="height: ${s}px;"
|
|
2357
|
+
loading="lazy">
|
|
2358
|
+
</iframe>
|
|
2359
|
+
</div>
|
|
2360
|
+
`;
|
|
2361
|
+
}
|
|
2362
|
+
function et(e, t, r) {
|
|
2363
|
+
return `
|
|
2364
|
+
<div class="artifactuse-apple-music-wrapper">
|
|
2365
|
+
<iframe
|
|
2366
|
+
src="https://embed.music.apple.com/${e}/${t}/${r}"
|
|
2367
|
+
frameborder="0"
|
|
2368
|
+
allow="autoplay *; encrypted-media *; fullscreen *"
|
|
2369
|
+
class="artifactuse-apple-music-embed"
|
|
2370
|
+
sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
|
|
2371
|
+
loading="lazy">
|
|
2372
|
+
</iframe>
|
|
2373
|
+
</div>
|
|
2374
|
+
`;
|
|
2375
|
+
}
|
|
2376
|
+
const N = /* @__PURE__ */ new Map(), be = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
2377
|
+
function Ma(e = document) {
|
|
2378
|
+
e.querySelectorAll(".artifactuse-audio-player:not([data-initialized])").forEach((r) => {
|
|
2379
|
+
Ta(r);
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
function Ta(e) {
|
|
2383
|
+
const t = e.dataset.playerId, r = e.dataset.audioSrc;
|
|
2384
|
+
if (!t || !r) return;
|
|
2385
|
+
const a = e.querySelector(".artifactuse-audio-element"), s = e.querySelector(".artifactuse-audio-play-btn"), i = e.querySelector(".artifactuse-audio-icon-play"), o = e.querySelector(".artifactuse-audio-icon-pause"), n = e.querySelector(".artifactuse-audio-current"), l = e.querySelector(".artifactuse-audio-duration"), c = e.querySelector(".artifactuse-audio-waveform"), u = e.querySelector(".artifactuse-audio-waveform-canvas"), f = e.querySelector(".artifactuse-audio-waveform-progress"), y = e.querySelector(".artifactuse-audio-waveform-hover"), d = e.querySelector(".artifactuse-audio-mute-btn"), b = e.querySelector(".artifactuse-audio-icon-volume"), h = e.querySelector(".artifactuse-audio-icon-muted"), w = e.querySelector(".artifactuse-audio-volume-slider"), g = e.querySelector(".artifactuse-audio-speed-btn");
|
|
2386
|
+
if (!a) return;
|
|
2387
|
+
const p = {
|
|
2388
|
+
isPlaying: !1,
|
|
2389
|
+
isMuted: !1,
|
|
2390
|
+
volume: 1,
|
|
2391
|
+
playbackRate: 1,
|
|
2392
|
+
duration: 0,
|
|
2393
|
+
currentTime: 0,
|
|
2394
|
+
waveformData: null
|
|
2395
|
+
};
|
|
2396
|
+
N.set(t, { playerEl: e, audio: a, state: p }), Ea(u, t), s == null || s.addEventListener("click", () => {
|
|
2397
|
+
p.isPlaying ? it(t) : st(t);
|
|
2398
|
+
}), a.addEventListener("loadedmetadata", () => {
|
|
2399
|
+
p.duration = a.duration, l.textContent = at(a.duration);
|
|
2400
|
+
}), a.addEventListener("timeupdate", () => {
|
|
2401
|
+
p.currentTime = a.currentTime, n.textContent = at(a.currentTime);
|
|
2402
|
+
const v = a.currentTime / a.duration * 100;
|
|
2403
|
+
f.style.width = `${v}%`;
|
|
2404
|
+
}), a.addEventListener("ended", () => {
|
|
2405
|
+
p.isPlaying = !1, i.style.display = "", o.style.display = "none", e.classList.remove("is-playing"), f.style.width = "0%";
|
|
2406
|
+
}), a.addEventListener("play", () => {
|
|
2407
|
+
p.isPlaying = !0, i.style.display = "none", o.style.display = "", e.classList.add("is-playing"), Pa(t);
|
|
2408
|
+
}), a.addEventListener("pause", () => {
|
|
2409
|
+
p.isPlaying = !1, i.style.display = "", o.style.display = "none", e.classList.remove("is-playing");
|
|
2410
|
+
}), c == null || c.addEventListener("click", (v) => {
|
|
2411
|
+
const m = c.getBoundingClientRect(), A = (v.clientX - m.left) / m.width * a.duration;
|
|
2412
|
+
isNaN(A) || (a.currentTime = A);
|
|
2413
|
+
}), c == null || c.addEventListener("mousemove", (v) => {
|
|
2414
|
+
const m = c.getBoundingClientRect(), k = (v.clientX - m.left) / m.width * 100;
|
|
2415
|
+
y.style.width = `${k}%`;
|
|
2416
|
+
}), c == null || c.addEventListener("mouseleave", () => {
|
|
2417
|
+
y.style.width = "0%";
|
|
2418
|
+
}), d == null || d.addEventListener("click", () => {
|
|
2419
|
+
p.isMuted = !p.isMuted, a.muted = p.isMuted, b.style.display = p.isMuted ? "none" : "", h.style.display = p.isMuted ? "" : "none", p.isMuted ? w.value = 0 : w.value = p.volume * 100;
|
|
2420
|
+
}), w == null || w.addEventListener("input", (v) => {
|
|
2421
|
+
const m = parseInt(v.target.value, 10) / 100;
|
|
2422
|
+
p.volume = m, a.volume = m, m === 0 ? (p.isMuted = !0, b.style.display = "none", h.style.display = "") : (p.isMuted = !1, a.muted = !1, b.style.display = "", h.style.display = "none");
|
|
2423
|
+
}), g == null || g.addEventListener("click", () => {
|
|
2424
|
+
const m = (be.indexOf(p.playbackRate) + 1) % be.length;
|
|
2425
|
+
p.playbackRate = be[m], a.playbackRate = p.playbackRate, g.querySelector("span").textContent = `${p.playbackRate}x`;
|
|
2426
|
+
}), e.addEventListener("keydown", (v) => {
|
|
2427
|
+
switch (v.key) {
|
|
2428
|
+
case " ":
|
|
2429
|
+
case "k":
|
|
2430
|
+
v.preventDefault(), p.isPlaying ? it(t) : st(t);
|
|
2431
|
+
break;
|
|
2432
|
+
case "ArrowLeft":
|
|
2433
|
+
v.preventDefault(), a.currentTime = Math.max(0, a.currentTime - 5);
|
|
2434
|
+
break;
|
|
2435
|
+
case "ArrowRight":
|
|
2436
|
+
v.preventDefault(), a.currentTime = Math.min(a.duration, a.currentTime + 5);
|
|
2437
|
+
break;
|
|
2438
|
+
case "ArrowUp":
|
|
2439
|
+
v.preventDefault(), p.volume = Math.min(1, p.volume + 0.1), a.volume = p.volume, w.value = p.volume * 100;
|
|
2440
|
+
break;
|
|
2441
|
+
case "ArrowDown":
|
|
2442
|
+
v.preventDefault(), p.volume = Math.max(0, p.volume - 0.1), a.volume = p.volume, w.value = p.volume * 100;
|
|
2443
|
+
break;
|
|
2444
|
+
case "m":
|
|
2445
|
+
v.preventDefault(), d == null || d.click();
|
|
2446
|
+
break;
|
|
2447
|
+
}
|
|
2448
|
+
}), e.setAttribute("data-initialized", "true"), e.setAttribute("tabindex", "0");
|
|
2449
|
+
}
|
|
2450
|
+
function Ea(e, t) {
|
|
2451
|
+
if (!e) return;
|
|
2452
|
+
const r = e.getContext("2d"), a = window.devicePixelRatio || 1, s = e.parentElement.getBoundingClientRect();
|
|
2453
|
+
e.width = s.width * a, e.height = s.height * a, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`, r.scale(a, a);
|
|
2454
|
+
const i = s.width, o = s.height, n = Math.floor(i / 4), l = tt(n, t);
|
|
2455
|
+
rt(r, l, i, o), new ResizeObserver(() => {
|
|
2456
|
+
const u = e.parentElement.getBoundingClientRect();
|
|
2457
|
+
e.width = u.width * a, e.height = u.height * a, e.style.width = `${u.width}px`, e.style.height = `${u.height}px`, r.scale(a, a);
|
|
2458
|
+
const f = Math.floor(u.width / 4), y = tt(f, t);
|
|
2459
|
+
rt(r, y, u.width, u.height);
|
|
2460
|
+
}).observe(e.parentElement);
|
|
2461
|
+
}
|
|
2462
|
+
function tt(e, t) {
|
|
2463
|
+
const r = [];
|
|
2464
|
+
let a = 0;
|
|
2465
|
+
for (let i = 0; i < t.length; i++) {
|
|
2466
|
+
const o = t.charCodeAt(i);
|
|
2467
|
+
a = (a << 5) - a + o, a = a & a;
|
|
2468
|
+
}
|
|
2469
|
+
const s = () => (a = (a * 9301 + 49297) % 233280, a / 233280);
|
|
2470
|
+
for (let i = 0; i < e; i++) {
|
|
2471
|
+
const o = i / e;
|
|
2472
|
+
let n = 0.3 + 0.2 * Math.sin(o * Math.PI * 4 + s() * Math.PI) + 0.15 * Math.sin(o * Math.PI * 8 + s() * Math.PI) + 0.1 * Math.sin(o * Math.PI * 16 + s() * Math.PI);
|
|
2473
|
+
n += (s() - 0.5) * 0.3;
|
|
2474
|
+
const l = Math.sin(o * Math.PI);
|
|
2475
|
+
n *= 0.5 + 0.5 * l, n = Math.max(0.1, Math.min(1, n)), r.push(n);
|
|
2476
|
+
}
|
|
2477
|
+
return r;
|
|
2478
|
+
}
|
|
2479
|
+
function rt(e, t, r, a) {
|
|
2480
|
+
e.clearRect(0, 0, r, a);
|
|
2481
|
+
const s = 2, o = s + 2, n = a / 2, c = getComputedStyle(document.documentElement).getPropertyValue("--artifactuse-text-muted").trim() || "107, 114, 128";
|
|
2482
|
+
e.fillStyle = `rgba(${c}, 0.4)`, t.forEach((u, f) => {
|
|
2483
|
+
const y = f * o, d = u * (a * 0.8), b = d / 2, h = s / 2;
|
|
2484
|
+
e.beginPath(), e.roundRect(y, n - b, s, d, h), e.fill();
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
function at(e) {
|
|
2488
|
+
if (!e || isNaN(e)) return "0:00";
|
|
2489
|
+
const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), a = Math.floor(e % 60);
|
|
2490
|
+
return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}` : `${r}:${a.toString().padStart(2, "0")}`;
|
|
2491
|
+
}
|
|
2492
|
+
function st(e) {
|
|
2493
|
+
const t = N.get(e);
|
|
2494
|
+
t && t.audio.play();
|
|
2495
|
+
}
|
|
2496
|
+
function it(e) {
|
|
2497
|
+
const t = N.get(e);
|
|
2498
|
+
t && t.audio.pause();
|
|
2499
|
+
}
|
|
2500
|
+
function Pa(e) {
|
|
2501
|
+
N.forEach((t, r) => {
|
|
2502
|
+
r !== e && t.state.isPlaying && t.audio.pause();
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
function Ia(e) {
|
|
2506
|
+
const t = N.get(e);
|
|
2507
|
+
t && (t.audio.pause(), t.audio.src = "", N.delete(e));
|
|
2508
|
+
}
|
|
2509
|
+
function Za() {
|
|
2510
|
+
N.forEach((e, t) => {
|
|
2511
|
+
Ia(t);
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
function qa(e) {
|
|
2515
|
+
const t = [];
|
|
2516
|
+
e = e.replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, (w) => {
|
|
2517
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
2518
|
+
return t.push(w), g;
|
|
2519
|
+
}), e = e.replace(/<code[^>]*>[\s\S]*?<\/code>/gi, (w) => {
|
|
2520
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
2521
|
+
return t.push(w), g;
|
|
2522
|
+
}), e = e.replace(/<iframe[^>]*>[\s\S]*?<\/iframe>/gi, (w) => {
|
|
2523
|
+
const g = `__PROTECTED_MAP_${t.length}__`;
|
|
2524
|
+
return t.push(w), g;
|
|
2525
|
+
});
|
|
2526
|
+
const r = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/embed\?pb=[^"]+)"[^>]*>[^<]*<\/a>/gi;
|
|
2527
|
+
e = e.replace(r, (w, g) => {
|
|
2528
|
+
const p = `__PROTECTED_MAP_${t.length}__`;
|
|
2529
|
+
return t.push(nt(g)), p;
|
|
2530
|
+
});
|
|
2531
|
+
const a = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/embed\\?pb=[^\\s<>"]+)(?!["'])`, "gi");
|
|
2532
|
+
e = e.replace(a, (w, g) => {
|
|
2533
|
+
const p = `__PROTECTED_MAP_${t.length}__`;
|
|
2534
|
+
return t.push(nt(g)), p;
|
|
2535
|
+
});
|
|
2536
|
+
const s = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/place\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2537
|
+
e = e.replace(s, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2538
|
+
const i = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/place\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
|
|
2539
|
+
e = e.replace(i, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2540
|
+
const o = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/@([0-9.-]+),([0-9.-]+),([0-9]+)z[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2541
|
+
e = e.replace(o, (w, g, p, v, m) => Ce(p, v, m));
|
|
2542
|
+
const n = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/@([0-9.-]+),([0-9.-]+),([0-9]+)z)(?!["'])`, "gi");
|
|
2543
|
+
e = e.replace(n, (w, g, p, v, m) => Ce(p, v, m));
|
|
2544
|
+
const l = /<a[^>]*href="(https?:\/\/maps\.google\.com\/\?q=([^\s"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2545
|
+
e = e.replace(l, (w, g, p) => V(decodeURIComponent(p)));
|
|
2546
|
+
const c = new RegExp(`(?<!["'=])(https?:\\/\\/maps\\.google\\.com\\/\\?q=([^\\s"&]+))(?!["'])`, "gi");
|
|
2547
|
+
e = e.replace(c, (w, g, p) => V(decodeURIComponent(p)));
|
|
2548
|
+
const u = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/([^\/\?"]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2549
|
+
e = e.replace(u, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2550
|
+
const f = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/([^\\/\\?\\s]+))(?!["'])`, "gi");
|
|
2551
|
+
e = e.replace(f, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2552
|
+
const y = /<a[^>]*href="(https?:\/\/(?:www\.)?google\.com\/maps\/search\/\?[^"]*query=([^"&]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2553
|
+
e = e.replace(y, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2554
|
+
const d = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?google\\.com\\/maps\\/search\\/\\?[^\\s"]*query=([^\\s"&]+))(?!["'])`, "gi");
|
|
2555
|
+
e = e.replace(d, (w, g, p) => V(decodeURIComponent(p.replace(/\+/g, " "))));
|
|
2556
|
+
const b = /<a[^>]*href="(https?:\/\/(?:www\.)?openstreetmap\.org\/[^"]*mlat=([0-9.-]+)[^"]*mlon=([0-9.-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2557
|
+
e = e.replace(b, (w, g, p, v) => {
|
|
2558
|
+
const m = g.match(/#map=(\d+)/), x = m ? m[1] : 15;
|
|
2559
|
+
return ot(p, v, x);
|
|
2560
|
+
});
|
|
2561
|
+
const h = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?openstreetmap\\.org\\/[^\\s]*mlat=([0-9.-]+)[^\\s]*mlon=([0-9.-]+))(?!["'])`, "gi");
|
|
2562
|
+
e = e.replace(h, (w, g, p, v) => {
|
|
2563
|
+
const m = g.match(/#map=(\d+)/), x = m ? m[1] : 15;
|
|
2564
|
+
return ot(p, v, x);
|
|
2565
|
+
});
|
|
2566
|
+
for (let w = t.length - 1; w >= 0; w--)
|
|
2567
|
+
e = e.replace(`__PROTECTED_MAP_${w}__`, t[w]);
|
|
2568
|
+
return e;
|
|
2569
|
+
}
|
|
2570
|
+
function nt(e) {
|
|
2571
|
+
const t = e.match(/pb=([^&]+)/);
|
|
2572
|
+
if (t) {
|
|
2573
|
+
const r = decodeURIComponent(t[1]), a = r.match(/!3d(-?[\d.]+).*?!2d(-?[\d.]+)/), s = r.match(/!2d(-?[\d.]+).*?!3d(-?[\d.]+)/);
|
|
2574
|
+
let i, o;
|
|
2575
|
+
if (a ? (i = a[1], o = a[2]) : s && (o = s[1], i = s[2]), i && o) {
|
|
2576
|
+
const n = r.match(/!1d([\d.]+)/);
|
|
2577
|
+
let l = 15;
|
|
2578
|
+
if (n) {
|
|
2579
|
+
const c = parseFloat(n[1]);
|
|
2580
|
+
c > 1e4 ? l = 10 : c > 5e3 ? l = 12 : c > 1e3 ? l = 14 : c > 500 ? l = 16 : l = 18;
|
|
2581
|
+
}
|
|
2582
|
+
return Ce(i, o, l);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
return `
|
|
2586
|
+
<div class="artifactuse-map-wrapper">
|
|
2587
|
+
<iframe
|
|
2588
|
+
src="${e}"
|
|
2589
|
+
frameborder="0"
|
|
2590
|
+
allowfullscreen
|
|
2591
|
+
loading="lazy"
|
|
2592
|
+
referrerpolicy="no-referrer-when-downgrade"
|
|
2593
|
+
class="artifactuse-map-iframe">
|
|
2594
|
+
</iframe>
|
|
2595
|
+
</div>
|
|
2596
|
+
`;
|
|
2597
|
+
}
|
|
2598
|
+
function V(e) {
|
|
2599
|
+
const t = encodeURIComponent(e);
|
|
2600
|
+
return `
|
|
2601
|
+
<div class="artifactuse-map-wrapper">
|
|
2602
|
+
<iframe
|
|
2603
|
+
src="https://www.google.com/maps?q=${t}&output=embed"
|
|
2604
|
+
frameborder="0"
|
|
2605
|
+
allowfullscreen
|
|
2606
|
+
loading="lazy"
|
|
2607
|
+
referrerpolicy="no-referrer-when-downgrade"
|
|
2608
|
+
class="artifactuse-map-iframe">
|
|
2609
|
+
</iframe>
|
|
2610
|
+
<div class="artifactuse-map-actions">
|
|
2611
|
+
<a href="https://www.google.com/maps/search/${t}" target="_blank" rel="noopener" class="artifactuse-map-link">
|
|
2612
|
+
Open in Google Maps
|
|
2613
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="artifactuse-map-icon">
|
|
2614
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
|
|
2615
|
+
<polyline points="15 3 21 3 21 9"></polyline>
|
|
2616
|
+
<line x1="10" y1="14" x2="21" y2="3"></line>
|
|
2617
|
+
</svg>
|
|
2618
|
+
</a>
|
|
2619
|
+
</div>
|
|
2620
|
+
</div>
|
|
2621
|
+
`;
|
|
2622
|
+
}
|
|
2623
|
+
function Ce(e, t, r) {
|
|
2624
|
+
return `
|
|
2625
|
+
<div class="artifactuse-map-wrapper">
|
|
2626
|
+
<iframe
|
|
2627
|
+
src="https://www.google.com/maps?q=${e},${t}&z=${r}&output=embed"
|
|
2628
|
+
frameborder="0"
|
|
2629
|
+
allowfullscreen
|
|
2630
|
+
loading="lazy"
|
|
2631
|
+
referrerpolicy="no-referrer-when-downgrade"
|
|
2632
|
+
class="artifactuse-map-iframe">
|
|
2633
|
+
</iframe>
|
|
2634
|
+
<div class="artifactuse-map-actions">
|
|
2635
|
+
<a href="https://www.google.com/maps/@${e},${t},${r}z" target="_blank" rel="noopener" class="artifactuse-map-link">
|
|
2636
|
+
Open in Google Maps
|
|
2637
|
+
</a>
|
|
2638
|
+
</div>
|
|
2639
|
+
</div>
|
|
2640
|
+
`;
|
|
2641
|
+
}
|
|
2642
|
+
function ot(e, t, r = 15) {
|
|
2643
|
+
return `
|
|
2644
|
+
<div class="artifactuse-map-wrapper">
|
|
2645
|
+
<iframe
|
|
2646
|
+
src="https://www.openstreetmap.org/export/embed.html?bbox=${`${parseFloat(t) - 0.01},${parseFloat(e) - 0.01},${parseFloat(t) + 0.01},${parseFloat(e) + 0.01}`}&layer=mapnik&marker=${e},${t}"
|
|
2647
|
+
class="artifactuse-map-iframe"
|
|
2648
|
+
loading="lazy">
|
|
2649
|
+
</iframe>
|
|
2650
|
+
<div class="artifactuse-map-actions">
|
|
2651
|
+
<a href="https://www.openstreetmap.org/?mlat=${e}&mlon=${t}#map=${r}/${e}/${t}" target="_blank" rel="noopener" class="artifactuse-map-link">
|
|
2652
|
+
View larger map
|
|
2653
|
+
</a>
|
|
2654
|
+
</div>
|
|
2655
|
+
</div>
|
|
2656
|
+
`;
|
|
2657
|
+
}
|
|
2658
|
+
function Ha(e, t = {}) {
|
|
2659
|
+
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2660
|
+
e = e.replace(a, (v, m, x, k) => ct(x, k, r));
|
|
2661
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?(?:twitter\\.com|x\\.com)\\/([a-zA-Z0-9_]+)\\/status\\/(\\d+))(?!["'])`, "gi");
|
|
2662
|
+
e = e.replace(s, (v, m, x, k) => ct(x, k, r));
|
|
2663
|
+
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/p\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2664
|
+
e = e.replace(i, (v, m, x) => lt(x));
|
|
2665
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/p\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2666
|
+
e = e.replace(o, (v, m, x) => lt(x));
|
|
2667
|
+
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?instagram\.com\/reel\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2668
|
+
e = e.replace(n, (v, m, x) => ut(x));
|
|
2669
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?instagram\\.com\\/reel\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2670
|
+
e = e.replace(l, (v, m, x) => ut(x));
|
|
2671
|
+
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?tiktok\.com\/@([a-zA-Z0-9_.]+)\/video\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2672
|
+
e = e.replace(c, (v, m, x, k) => pt(k));
|
|
2673
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?tiktok\\.com\\/@([a-zA-Z0-9_.]+)\\/video\\/(\\d+))(?!["'])`, "gi");
|
|
2674
|
+
e = e.replace(u, (v, m, x, k) => pt(k));
|
|
2675
|
+
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?linkedin\.com\/(?:posts|feed\/update)\/([a-zA-Z0-9_:-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2676
|
+
e = e.replace(f, (v, m, x) => dt(x, m));
|
|
2677
|
+
const y = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?linkedin\\.com\\/(?:posts|feed\\/update)\\/([a-zA-Z0-9_:-]+))(?!["'])`, "gi");
|
|
2678
|
+
e = e.replace(y, (v, m, x) => dt(x, m));
|
|
2679
|
+
const d = /<a[^>]*href="(https?:\/\/(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2680
|
+
e = e.replace(d, (v, m, x, k) => ft(x, k, m));
|
|
2681
|
+
const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?reddit\\.com\\/r\\/([a-zA-Z0-9_]+)\\/comments\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2682
|
+
e = e.replace(b, (v, m, x, k) => ft(x, k, m));
|
|
2683
|
+
const h = /<a[^>]*href="(https?:\/\/(?:www\.)?facebook\.com\/[a-zA-Z0-9.]+\/posts\/\d+[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2684
|
+
e = e.replace(h, (v, m) => ht(m));
|
|
2685
|
+
const w = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?facebook\\.com\\/[a-zA-Z0-9.]+\\/posts\\/\\d+)(?!["'])`, "gi");
|
|
2686
|
+
e = e.replace(w, (v, m) => ht(m));
|
|
2687
|
+
const g = /<a[^>]*href="(https?:\/\/(?:www\.)?pinterest\.com\/pin\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2688
|
+
e = e.replace(g, (v, m, x) => gt(x));
|
|
2689
|
+
const p = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?pinterest\\.com\\/pin\\/(\\d+))(?!["'])`, "gi");
|
|
2690
|
+
return e = e.replace(p, (v, m, x) => gt(x)), e;
|
|
2691
|
+
}
|
|
2692
|
+
function ct(e, t, r = "dark") {
|
|
2693
|
+
return `
|
|
2694
|
+
<div class="artifactuse-twitter-wrapper">
|
|
2695
|
+
<blockquote class="twitter-tweet" data-dnt="true" data-theme="${r}">
|
|
2696
|
+
<a href="https://twitter.com/${e}/status/${t}">Loading tweet...</a>
|
|
2697
|
+
</blockquote>
|
|
2698
|
+
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>
|
|
2699
|
+
</div>
|
|
2700
|
+
`;
|
|
2701
|
+
}
|
|
2702
|
+
function lt(e) {
|
|
2703
|
+
return `
|
|
2704
|
+
<div class="artifactuse-instagram-wrapper">
|
|
2705
|
+
<iframe
|
|
2706
|
+
src="https://www.instagram.com/p/${e}/embed"
|
|
2707
|
+
frameborder="0"
|
|
2708
|
+
scrolling="no"
|
|
2709
|
+
allowtransparency="true"
|
|
2710
|
+
class="artifactuse-instagram-embed"
|
|
2711
|
+
loading="lazy">
|
|
2712
|
+
</iframe>
|
|
2713
|
+
</div>
|
|
2714
|
+
`;
|
|
2715
|
+
}
|
|
2716
|
+
function ut(e) {
|
|
2717
|
+
return `
|
|
2718
|
+
<div class="artifactuse-instagram-wrapper">
|
|
2719
|
+
<iframe
|
|
2720
|
+
src="https://www.instagram.com/reel/${e}/embed"
|
|
2721
|
+
frameborder="0"
|
|
2722
|
+
scrolling="no"
|
|
2723
|
+
allowtransparency="true"
|
|
2724
|
+
class="artifactuse-instagram-embed artifactuse-instagram-reel"
|
|
2725
|
+
loading="lazy">
|
|
2726
|
+
</iframe>
|
|
2727
|
+
</div>
|
|
2728
|
+
`;
|
|
2729
|
+
}
|
|
2730
|
+
function pt(e) {
|
|
2731
|
+
return `
|
|
2732
|
+
<div class="artifactuse-tiktok-wrapper">
|
|
2733
|
+
<iframe
|
|
2734
|
+
src="https://www.tiktok.com/embed/v2/${e}"
|
|
2735
|
+
frameborder="0"
|
|
2736
|
+
allowfullscreen
|
|
2737
|
+
class="artifactuse-tiktok-embed"
|
|
2738
|
+
loading="lazy">
|
|
2739
|
+
</iframe>
|
|
2740
|
+
</div>
|
|
2741
|
+
`;
|
|
2742
|
+
}
|
|
2743
|
+
function dt(e, t) {
|
|
2744
|
+
return `
|
|
2745
|
+
<div class="artifactuse-linkedin-wrapper">
|
|
2746
|
+
<iframe
|
|
2747
|
+
src="https://www.linkedin.com/embed/feed/update/${e}"
|
|
2748
|
+
frameborder="0"
|
|
2749
|
+
allowfullscreen
|
|
2750
|
+
class="artifactuse-linkedin-embed"
|
|
2751
|
+
loading="lazy">
|
|
2752
|
+
</iframe>
|
|
2753
|
+
<div class="artifactuse-embed-fallback">
|
|
2754
|
+
<a href="${t}" target="_blank" rel="noopener">View on LinkedIn</a>
|
|
2755
|
+
</div>
|
|
2756
|
+
</div>
|
|
2757
|
+
`;
|
|
2758
|
+
}
|
|
2759
|
+
function ft(e, t, r) {
|
|
2760
|
+
return `
|
|
2761
|
+
<div class="artifactuse-reddit-wrapper">
|
|
2762
|
+
<iframe
|
|
2763
|
+
src="https://www.redditmedia.com/r/${e}/comments/${t}/?ref_source=embed&ref=share&embed=true"
|
|
2764
|
+
sandbox="allow-scripts allow-same-origin allow-popups"
|
|
2765
|
+
class="artifactuse-reddit-embed"
|
|
2766
|
+
loading="lazy">
|
|
2767
|
+
</iframe>
|
|
2768
|
+
<div class="artifactuse-embed-fallback">
|
|
2769
|
+
<a href="${r}" target="_blank" rel="noopener">View on Reddit</a>
|
|
2770
|
+
</div>
|
|
2771
|
+
</div>
|
|
2772
|
+
`;
|
|
2773
|
+
}
|
|
2774
|
+
function ht(e) {
|
|
2775
|
+
return `
|
|
2776
|
+
<div class="artifactuse-facebook-wrapper">
|
|
2777
|
+
<iframe
|
|
2778
|
+
src="https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(e)}&show_text=true&width=500"
|
|
2779
|
+
width="500"
|
|
2780
|
+
height="400"
|
|
2781
|
+
style="border:none;overflow:hidden"
|
|
2782
|
+
scrolling="no"
|
|
2783
|
+
frameborder="0"
|
|
2784
|
+
allowfullscreen="true"
|
|
2785
|
+
allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"
|
|
2786
|
+
class="artifactuse-facebook-embed"
|
|
2787
|
+
loading="lazy">
|
|
2788
|
+
</iframe>
|
|
2789
|
+
</div>
|
|
2790
|
+
`;
|
|
2791
|
+
}
|
|
2792
|
+
function gt(e) {
|
|
2793
|
+
return `
|
|
2794
|
+
<div class="artifactuse-pinterest-wrapper">
|
|
2795
|
+
<a data-pin-do="embedPin" data-pin-width="large" href="https://www.pinterest.com/pin/${e}/"></a>
|
|
2796
|
+
<script async defer src="https://assets.pinterest.com/js/pinit.js"><\/script>
|
|
2797
|
+
</div>
|
|
2798
|
+
`;
|
|
2799
|
+
}
|
|
2800
|
+
function ja(e) {
|
|
2801
|
+
const t = /<a[^>]*href="(https?:\/\/[^"]+\.pdf(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2802
|
+
e = e.replace(t, (a, s) => mt(s));
|
|
2803
|
+
const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.pdf(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2804
|
+
return e = e.replace(r, (a, s) => mt(s)), e;
|
|
2805
|
+
}
|
|
2806
|
+
function mt(e) {
|
|
2807
|
+
return `
|
|
2808
|
+
<div class="artifactuse-pdf-wrapper">
|
|
2809
|
+
<div class="artifactuse-pdf-header">
|
|
2810
|
+
<svg class="artifactuse-pdf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2811
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
2812
|
+
<polyline points="14 2 14 8 20 8"></polyline>
|
|
2813
|
+
<line x1="16" y1="13" x2="8" y2="13"></line>
|
|
2814
|
+
<line x1="16" y1="17" x2="8" y2="17"></line>
|
|
2815
|
+
<polyline points="10 9 9 9 8 9"></polyline>
|
|
2816
|
+
</svg>
|
|
2817
|
+
<span class="artifactuse-pdf-filename">${e.split("/").pop().split("?")[0]}</span>
|
|
2818
|
+
<a href="${e}" target="_blank" class="artifactuse-pdf-download" title="Download PDF">
|
|
2819
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2820
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
2821
|
+
<polyline points="7 10 12 15 17 10"></polyline>
|
|
2822
|
+
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
2823
|
+
</svg>
|
|
2824
|
+
</a>
|
|
2825
|
+
</div>
|
|
2826
|
+
<iframe src="${e}#view=FitH&toolbar=1" class="artifactuse-pdf-iframe" loading="lazy"></iframe>
|
|
2827
|
+
</div>
|
|
2828
|
+
`;
|
|
2829
|
+
}
|
|
2830
|
+
function Da(e) {
|
|
2831
|
+
const t = /<a[^>]*href="(https?:\/\/docs\.google\.com\/document\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2832
|
+
e = e.replace(t, (c, u, f) => G(f, "document"));
|
|
2833
|
+
const r = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2834
|
+
e = e.replace(r, (c, u, f) => G(f, "document"));
|
|
2835
|
+
const a = /<a[^>]*href="(https?:\/\/docs\.google\.com\/spreadsheets\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2836
|
+
e = e.replace(a, (c, u, f) => G(f, "spreadsheets"));
|
|
2837
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2838
|
+
e = e.replace(s, (c, u, f) => G(f, "spreadsheets"));
|
|
2839
|
+
const i = /<a[^>]*href="(https?:\/\/docs\.google\.com\/presentation\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2840
|
+
e = e.replace(i, (c, u, f) => G(f, "presentation"));
|
|
2841
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2842
|
+
e = e.replace(o, (c, u, f) => G(f, "presentation"));
|
|
2843
|
+
const n = /<a[^>]*href="(https?:\/\/docs\.google\.com\/forms\/d\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2844
|
+
e = e.replace(n, (c, u, f) => wt(f));
|
|
2845
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/docs\\.google\\.com\\/forms\\/d\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2846
|
+
return e = e.replace(l, (c, u, f) => wt(f)), e;
|
|
2847
|
+
}
|
|
2848
|
+
function G(e, t) {
|
|
2849
|
+
const r = {
|
|
2850
|
+
document: "Google Doc",
|
|
2851
|
+
spreadsheets: "Google Sheet",
|
|
2852
|
+
presentation: "Google Slides"
|
|
2853
|
+
}, a = {
|
|
2854
|
+
document: `https://docs.google.com/document/d/${e}/preview`,
|
|
2855
|
+
spreadsheets: `https://docs.google.com/spreadsheets/d/${e}/preview`,
|
|
2856
|
+
presentation: `https://docs.google.com/presentation/d/${e}/embed?start=false&loop=false&delayms=3000`
|
|
2857
|
+
}, s = {
|
|
2858
|
+
document: "600px",
|
|
2859
|
+
spreadsheets: "500px",
|
|
2860
|
+
presentation: "480px"
|
|
2861
|
+
};
|
|
2862
|
+
return `
|
|
2863
|
+
<div class="artifactuse-google-doc-wrapper">
|
|
2864
|
+
<div class="artifactuse-google-doc-header">
|
|
2865
|
+
<span class="artifactuse-google-doc-type">${r[t]}</span>
|
|
2866
|
+
<a href="https://docs.google.com/${t === "presentation" ? "presentation" : t}/d/${e}" target="_blank" class="artifactuse-google-doc-link">
|
|
2867
|
+
Open in new tab
|
|
2868
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2869
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
|
|
2870
|
+
<polyline points="15 3 21 3 21 9"></polyline>
|
|
2871
|
+
<line x1="10" y1="14" x2="21" y2="3"></line>
|
|
2872
|
+
</svg>
|
|
2873
|
+
</a>
|
|
2874
|
+
</div>
|
|
2875
|
+
<iframe src="${a[t]}" class="artifactuse-google-doc-iframe" style="height: ${s[t]};" loading="lazy" allowfullscreen></iframe>
|
|
2876
|
+
</div>
|
|
2877
|
+
`;
|
|
2878
|
+
}
|
|
2879
|
+
function wt(e) {
|
|
2880
|
+
return `
|
|
2881
|
+
<div class="artifactuse-google-form-wrapper">
|
|
2882
|
+
<iframe
|
|
2883
|
+
src="https://docs.google.com/forms/d/${e}/viewform?embedded=true"
|
|
2884
|
+
class="artifactuse-google-form-iframe"
|
|
2885
|
+
loading="lazy">
|
|
2886
|
+
</iframe>
|
|
2887
|
+
</div>
|
|
2888
|
+
`;
|
|
2889
|
+
}
|
|
2890
|
+
function Va(e) {
|
|
2891
|
+
const t = /<a[^>]*href="(https?:\/\/[^"]+\.(docx?|xlsx?|pptx?)(?:\?[^"]*)?)"[^>]*>[^<]*<\/a>/gi;
|
|
2892
|
+
e = e.replace(t, (a, s) => bt(s));
|
|
2893
|
+
const r = new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(docx?|xlsx?|pptx?)(?:\\?[^\\s<>"]*)?)(?!["'])`, "gi");
|
|
2894
|
+
return e = e.replace(r, (a, s) => bt(s)), e;
|
|
2895
|
+
}
|
|
2896
|
+
function bt(e) {
|
|
2897
|
+
const t = encodeURIComponent(e), r = e.split("/").pop().split("?")[0], a = r.split(".").pop().toLowerCase();
|
|
2898
|
+
return `
|
|
2899
|
+
<div class="artifactuse-office-wrapper">
|
|
2900
|
+
<div class="artifactuse-office-header">
|
|
2901
|
+
<span class="artifactuse-office-type">${{
|
|
2902
|
+
doc: "Word Document",
|
|
2903
|
+
docx: "Word Document",
|
|
2904
|
+
xls: "Excel Spreadsheet",
|
|
2905
|
+
xlsx: "Excel Spreadsheet",
|
|
2906
|
+
ppt: "PowerPoint",
|
|
2907
|
+
pptx: "PowerPoint"
|
|
2908
|
+
}[a] || "Office Document"}</span>
|
|
2909
|
+
<span class="artifactuse-office-filename">${r}</span>
|
|
2910
|
+
<a href="${e}" target="_blank" class="artifactuse-office-download" title="Download">
|
|
2911
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
2912
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
2913
|
+
<polyline points="7 10 12 15 17 10"></polyline>
|
|
2914
|
+
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
2915
|
+
</svg>
|
|
2916
|
+
</a>
|
|
2917
|
+
</div>
|
|
2918
|
+
<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=${t}" class="artifactuse-office-iframe" loading="lazy"></iframe>
|
|
2919
|
+
</div>
|
|
2920
|
+
`;
|
|
2921
|
+
}
|
|
2922
|
+
function Ba(e) {
|
|
2923
|
+
return `${e}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
2924
|
+
}
|
|
2925
|
+
function Oa(e, t = {}) {
|
|
2926
|
+
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/gist\.github\.com\/([a-zA-Z0-9_-]+)\/([a-f0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2927
|
+
e = e.replace(a, (h, w, g, p) => vt(g, p));
|
|
2928
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/gist\\.github\\.com\\/([a-zA-Z0-9_-]+)\\/([a-f0-9]+))(?!["'])`, "gi");
|
|
2929
|
+
e = e.replace(s, (h, w, g, p) => vt(g, p));
|
|
2930
|
+
const i = /<a[^>]*href="(https?:\/\/codepen\.io\/([a-zA-Z0-9_-]+)\/(?:pen|full|details)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2931
|
+
e = e.replace(i, (h, w, g, p) => yt(g, p, r));
|
|
2932
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/codepen\\.io\\/([a-zA-Z0-9_-]+)\\/(?:pen|full|details)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2933
|
+
e = e.replace(o, (h, w, g, p) => yt(g, p, r));
|
|
2934
|
+
const n = /<a[^>]*href="(https?:\/\/codesandbox\.io\/(?:s|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2935
|
+
e = e.replace(n, (h, w, g) => kt(g, r));
|
|
2936
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/codesandbox\\.io\\/(?:s|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
2937
|
+
e = e.replace(l, (h, w, g) => kt(g, r));
|
|
2938
|
+
const c = /<a[^>]*href="(https?:\/\/jsfiddle\.net\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2939
|
+
e = e.replace(c, (h, w, g, p) => xt(g, p, r));
|
|
2940
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/jsfiddle\\.net\\/([a-zA-Z0-9_]+)\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
2941
|
+
e = e.replace(u, (h, w, g, p) => xt(g, p, r));
|
|
2942
|
+
const f = /<a[^>]*href="(https?:\/\/stackblitz\.com\/(?:edit|embed)\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2943
|
+
e = e.replace(f, (h, w, g) => $t(g, r));
|
|
2944
|
+
const y = new RegExp(`(?<!["'=])(https?:\\/\\/stackblitz\\.com\\/(?:edit|embed)\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
2945
|
+
e = e.replace(y, (h, w, g) => $t(g, r));
|
|
2946
|
+
const d = /<a[^>]*href="(https?:\/\/replit\.com\/@([a-zA-Z0-9_]+)\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
2947
|
+
e = e.replace(d, (h, w, g, p) => Rt(g, p, r));
|
|
2948
|
+
const b = new RegExp(`(?<!["'=])(https?:\\/\\/replit\\.com\\/@([a-zA-Z0-9_]+)\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
2949
|
+
return e = e.replace(b, (h, w, g, p) => Rt(g, p, r)), e;
|
|
2950
|
+
}
|
|
2951
|
+
function vt(e, t) {
|
|
2952
|
+
return `
|
|
2953
|
+
<div class="artifactuse-gist-wrapper" id="${Ba("gist")}">
|
|
2954
|
+
<script src="https://gist.github.com/${e}/${t}.js"><\/script>
|
|
2955
|
+
</div>
|
|
2956
|
+
`;
|
|
2957
|
+
}
|
|
2958
|
+
function yt(e, t, r = "dark") {
|
|
2959
|
+
return `
|
|
2960
|
+
<div class="artifactuse-codepen-wrapper">
|
|
2961
|
+
<iframe
|
|
2962
|
+
height="400"
|
|
2963
|
+
style="width: 100%;"
|
|
2964
|
+
scrolling="no"
|
|
2965
|
+
src="https://codepen.io/${e}/embed/${t}?default-tab=html%2Cresult&theme-id=${r}"
|
|
2966
|
+
frameborder="no"
|
|
2967
|
+
loading="lazy"
|
|
2968
|
+
allowtransparency="true"
|
|
2969
|
+
allowfullscreen="true"
|
|
2970
|
+
class="artifactuse-codepen-embed">
|
|
2971
|
+
</iframe>
|
|
2972
|
+
</div>
|
|
2973
|
+
`;
|
|
2974
|
+
}
|
|
2975
|
+
function kt(e, t = "dark") {
|
|
2976
|
+
return `
|
|
2977
|
+
<div class="artifactuse-codesandbox-wrapper">
|
|
2978
|
+
<iframe
|
|
2979
|
+
src="https://codesandbox.io/embed/${e}?fontsize=14&hidenavigation=1&theme=${t}"
|
|
2980
|
+
style="width:100%; height:500px; border:0; border-radius:8px; overflow:hidden;"
|
|
2981
|
+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
|
|
2982
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
2983
|
+
loading="lazy"
|
|
2984
|
+
class="artifactuse-codesandbox-embed">
|
|
2985
|
+
</iframe>
|
|
2986
|
+
</div>
|
|
2987
|
+
`;
|
|
2988
|
+
}
|
|
2989
|
+
function xt(e, t, r = "dark") {
|
|
2990
|
+
return `
|
|
2991
|
+
<div class="artifactuse-jsfiddle-wrapper">
|
|
2992
|
+
<iframe
|
|
2993
|
+
width="100%"
|
|
2994
|
+
height="400"
|
|
2995
|
+
src="https://jsfiddle.net/${e}/${t}/embedded/result,js,html,css/${r}/"
|
|
2996
|
+
allowfullscreen="allowfullscreen"
|
|
2997
|
+
frameborder="0"
|
|
2998
|
+
loading="lazy"
|
|
2999
|
+
class="artifactuse-jsfiddle-embed">
|
|
3000
|
+
</iframe>
|
|
3001
|
+
</div>
|
|
3002
|
+
`;
|
|
3003
|
+
}
|
|
3004
|
+
function $t(e, t = "dark") {
|
|
3005
|
+
return `
|
|
3006
|
+
<div class="artifactuse-stackblitz-wrapper">
|
|
3007
|
+
<iframe
|
|
3008
|
+
src="https://stackblitz.com/edit/${e}?embed=1&file=index.js&theme=${t}"
|
|
3009
|
+
style="width:100%; height:500px; border:0; border-radius:8px; overflow:hidden;"
|
|
3010
|
+
loading="lazy"
|
|
3011
|
+
class="artifactuse-stackblitz-embed">
|
|
3012
|
+
</iframe>
|
|
3013
|
+
</div>
|
|
3014
|
+
`;
|
|
3015
|
+
}
|
|
3016
|
+
function Rt(e, t, r = "dark") {
|
|
3017
|
+
return `
|
|
3018
|
+
<div class="artifactuse-replit-wrapper">
|
|
3019
|
+
<iframe
|
|
3020
|
+
src="https://replit.com/@${e}/${t}?embed=true&theme=${r}"
|
|
3021
|
+
style="width:100%; height:500px; border:0; border-radius:8px; overflow:hidden;"
|
|
3022
|
+
loading="lazy"
|
|
3023
|
+
class="artifactuse-replit-embed">
|
|
3024
|
+
</iframe>
|
|
3025
|
+
</div>
|
|
3026
|
+
`;
|
|
3027
|
+
}
|
|
3028
|
+
function Fa(e) {
|
|
3029
|
+
const t = /<a[^>]*href="(https?:\/\/public\.tableau\.com\/(?:views|profile)\/([^\s"]+))"[^>]*>[^<]*<\/a>/gi;
|
|
3030
|
+
e = e.replace(t, (c, u, f) => At(f));
|
|
3031
|
+
const r = new RegExp(`(?<!["'=])(https?:\\/\\/public\\.tableau\\.com\\/(?:views|profile)\\/([^\\s<>"]+))(?!["'])`, "gi");
|
|
3032
|
+
e = e.replace(r, (c, u, f) => At(f));
|
|
3033
|
+
const a = /<a[^>]*href="(https?:\/\/(?:public\.)?flourish\.studio\/visualisation\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3034
|
+
e = e.replace(a, (c, u, f) => zt(f));
|
|
3035
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:public\\.)?flourish\\.studio\\/visualisation\\/(\\d+))(?!["'])`, "gi");
|
|
3036
|
+
e = e.replace(s, (c, u, f) => zt(f));
|
|
3037
|
+
const i = /<a[^>]*href="(https?:\/\/datawrapper\.dwcdn\.net\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3038
|
+
e = e.replace(i, (c, u, f) => St(f));
|
|
3039
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/datawrapper\\.dwcdn\\.net\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3040
|
+
e = e.replace(o, (c, u, f) => St(f));
|
|
3041
|
+
const n = /<a[^>]*href="(https?:\/\/(?:e\.)?infogram\.com\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3042
|
+
e = e.replace(n, (c, u, f) => Lt(f));
|
|
3043
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:e\\.)?infogram\\.com\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3044
|
+
return e = e.replace(l, (c, u, f) => Lt(f)), e;
|
|
3045
|
+
}
|
|
3046
|
+
function At(e) {
|
|
3047
|
+
return `
|
|
3048
|
+
<div class="artifactuse-tableau-wrapper">
|
|
3049
|
+
<iframe
|
|
3050
|
+
src="https://public.tableau.com/views/${e}?:embed=y&:display_count=yes&:showVizHome=no"
|
|
3051
|
+
class="artifactuse-tableau-iframe"
|
|
3052
|
+
loading="lazy"
|
|
3053
|
+
allowfullscreen>
|
|
3054
|
+
</iframe>
|
|
3055
|
+
</div>
|
|
3056
|
+
`;
|
|
3057
|
+
}
|
|
3058
|
+
function zt(e) {
|
|
3059
|
+
return `
|
|
3060
|
+
<div class="artifactuse-flourish-wrapper">
|
|
3061
|
+
<iframe
|
|
3062
|
+
src="https://flo.uri.sh/visualisation/${e}/embed"
|
|
3063
|
+
class="artifactuse-flourish-iframe"
|
|
3064
|
+
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
3065
|
+
loading="lazy">
|
|
3066
|
+
</iframe>
|
|
3067
|
+
</div>
|
|
3068
|
+
`;
|
|
3069
|
+
}
|
|
3070
|
+
function St(e) {
|
|
3071
|
+
return `
|
|
3072
|
+
<div class="artifactuse-datawrapper-wrapper">
|
|
3073
|
+
<iframe
|
|
3074
|
+
src="https://datawrapper.dwcdn.net/${e}/"
|
|
3075
|
+
class="artifactuse-datawrapper-iframe"
|
|
3076
|
+
scrolling="no"
|
|
3077
|
+
loading="lazy">
|
|
3078
|
+
</iframe>
|
|
3079
|
+
</div>
|
|
3080
|
+
`;
|
|
3081
|
+
}
|
|
3082
|
+
function Lt(e) {
|
|
3083
|
+
return `
|
|
3084
|
+
<div class="artifactuse-infogram-wrapper">
|
|
3085
|
+
<iframe
|
|
3086
|
+
src="https://e.infogram.com/${e}?src=embed"
|
|
3087
|
+
class="artifactuse-infogram-iframe"
|
|
3088
|
+
scrolling="no"
|
|
3089
|
+
allowfullscreen
|
|
3090
|
+
loading="lazy">
|
|
3091
|
+
</iframe>
|
|
3092
|
+
</div>
|
|
3093
|
+
`;
|
|
3094
|
+
}
|
|
3095
|
+
function Na(e, t = {}) {
|
|
3096
|
+
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/sketchfab\.com\/(?:3d-)?models\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3097
|
+
e = e.replace(a, (h, w, g) => _t(g, r));
|
|
3098
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/sketchfab\\.com\\/(?:3d-)?models\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3099
|
+
e = e.replace(s, (h, w, g) => _t(g, r));
|
|
3100
|
+
const i = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)(?:\/[^?\s"]*)?(?:\?node-id=([^&\s"]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3101
|
+
e = e.replace(i, (h, w, g, p) => Ct(g, p));
|
|
3102
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/(?:file|design)\\/([a-zA-Z0-9]+)(?:\\/[^?\\s]*)?(?:\\?node-id=([^&\\s]+))?)(?!["'])`, "gi");
|
|
3103
|
+
e = e.replace(o, (h, w, g, p) => Ct(g, p));
|
|
3104
|
+
const n = /<a[^>]*href="(https?:\/\/(?:www\.)?figma\.com\/proto\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3105
|
+
e = e.replace(n, (h, w, g) => Mt(g, w));
|
|
3106
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?figma\\.com\\/proto\\/([a-zA-Z0-9]+)[^\\s]*)(?!["'])`, "gi");
|
|
3107
|
+
e = e.replace(l, (h, w, g) => Mt(g, w));
|
|
3108
|
+
const c = /<a[^>]*href="(https?:\/\/(?:www\.)?canva\.com\/design\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3109
|
+
e = e.replace(c, (h, w, g) => Tt(g, w));
|
|
3110
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?canva\\.com\\/design\\/([a-zA-Z0-9_-]+)[^\\s]*)(?!["'])`, "gi");
|
|
3111
|
+
e = e.replace(u, (h, w, g) => Tt(g, w));
|
|
3112
|
+
const f = /<a[^>]*href="(https?:\/\/dribbble\.com\/shots\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3113
|
+
e = e.replace(f, (h, w, g) => Et(g));
|
|
3114
|
+
const y = new RegExp(`(?<!["'=])(https?:\\/\\/dribbble\\.com\\/shots\\/(\\d+))(?!["'])`, "gi");
|
|
3115
|
+
e = e.replace(y, (h, w, g) => Et(g));
|
|
3116
|
+
const d = /<a[^>]*href="(https?:\/\/(?:www\.)?behance\.net\/gallery\/(\d+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3117
|
+
e = e.replace(d, (h, w, g) => Pt(g, w));
|
|
3118
|
+
const b = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?behance\\.net\\/gallery\\/(\\d+)[^\\s]*)(?!["'])`, "gi");
|
|
3119
|
+
return e = e.replace(b, (h, w, g) => Pt(g, w)), e;
|
|
3120
|
+
}
|
|
3121
|
+
function _t(e, t = "dark") {
|
|
3122
|
+
return `
|
|
3123
|
+
<div class="artifactuse-sketchfab-wrapper">
|
|
3124
|
+
<iframe
|
|
3125
|
+
src="https://sketchfab.com/models/${e}/embed?autostart=1&ui_theme=${t}"
|
|
3126
|
+
frameborder="0"
|
|
3127
|
+
allow="autoplay; fullscreen; xr-spatial-tracking"
|
|
3128
|
+
mozallowfullscreen="true"
|
|
3129
|
+
webkitallowfullscreen="true"
|
|
3130
|
+
class="artifactuse-sketchfab-iframe"
|
|
3131
|
+
loading="lazy">
|
|
3132
|
+
</iframe>
|
|
3133
|
+
</div>
|
|
3134
|
+
`;
|
|
3135
|
+
}
|
|
3136
|
+
function Ct(e, t) {
|
|
3137
|
+
const r = t ? `&node-id=${t}` : "";
|
|
3138
|
+
return `
|
|
3139
|
+
<div class="artifactuse-figma-wrapper">
|
|
3140
|
+
<iframe
|
|
3141
|
+
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/${e}${r}"
|
|
3142
|
+
class="artifactuse-figma-iframe"
|
|
3143
|
+
allowfullscreen
|
|
3144
|
+
loading="lazy">
|
|
3145
|
+
</iframe>
|
|
3146
|
+
</div>
|
|
3147
|
+
`;
|
|
3148
|
+
}
|
|
3149
|
+
function Mt(e, t) {
|
|
3150
|
+
return `
|
|
3151
|
+
<div class="artifactuse-figma-wrapper">
|
|
3152
|
+
<iframe
|
|
3153
|
+
src="https://www.figma.com/embed?embed_host=share&url=${encodeURIComponent(t)}"
|
|
3154
|
+
class="artifactuse-figma-iframe"
|
|
3155
|
+
allowfullscreen
|
|
3156
|
+
loading="lazy">
|
|
3157
|
+
</iframe>
|
|
3158
|
+
</div>
|
|
3159
|
+
`;
|
|
3160
|
+
}
|
|
3161
|
+
function Tt(e, t) {
|
|
3162
|
+
return `
|
|
3163
|
+
<div class="artifactuse-canva-wrapper">
|
|
3164
|
+
<div class="artifactuse-canva-preview">
|
|
3165
|
+
<div class="artifactuse-canva-placeholder">
|
|
3166
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="artifactuse-canva-icon">
|
|
3167
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
3168
|
+
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
3169
|
+
<polyline points="21 15 16 10 5 21"></polyline>
|
|
3170
|
+
</svg>
|
|
3171
|
+
<p>Canva Design</p>
|
|
3172
|
+
<a href="${t}" target="_blank" rel="noopener" class="artifactuse-canva-link">View on Canva</a>
|
|
3173
|
+
</div>
|
|
3174
|
+
</div>
|
|
3175
|
+
</div>
|
|
3176
|
+
`;
|
|
3177
|
+
}
|
|
3178
|
+
function Et(e) {
|
|
3179
|
+
return `
|
|
3180
|
+
<div class="artifactuse-dribbble-wrapper">
|
|
3181
|
+
<iframe
|
|
3182
|
+
src="https://dribbble.com/shots/${e}/embed"
|
|
3183
|
+
class="artifactuse-dribbble-iframe"
|
|
3184
|
+
allowfullscreen
|
|
3185
|
+
loading="lazy">
|
|
3186
|
+
</iframe>
|
|
3187
|
+
</div>
|
|
3188
|
+
`;
|
|
3189
|
+
}
|
|
3190
|
+
function Pt(e, t) {
|
|
3191
|
+
return `
|
|
3192
|
+
<div class="artifactuse-behance-wrapper">
|
|
3193
|
+
<iframe
|
|
3194
|
+
src="https://www.behance.net/embed/project/${e}?ilo0=1"
|
|
3195
|
+
class="artifactuse-behance-iframe"
|
|
3196
|
+
allowfullscreen
|
|
3197
|
+
loading="lazy">
|
|
3198
|
+
</iframe>
|
|
3199
|
+
<div class="artifactuse-embed-fallback">
|
|
3200
|
+
<a href="${t}" target="_blank" rel="noopener">View on Behance</a>
|
|
3201
|
+
</div>
|
|
3202
|
+
</div>
|
|
3203
|
+
`;
|
|
3204
|
+
}
|
|
3205
|
+
function Ua(e, t = {}) {
|
|
3206
|
+
const r = t.theme || "dark", a = /<a[^>]*href="(https?:\/\/(?:[a-zA-Z0-9-]+\.)?typeform\.com\/to\/([a-zA-Z0-9]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3207
|
+
e = e.replace(a, (g, p, v) => It(v));
|
|
3208
|
+
const s = new RegExp(`(?<!["'=])(https?:\\/\\/(?:[a-zA-Z0-9-]+\\.)?typeform\\.com\\/to\\/([a-zA-Z0-9]+))(?!["'])`, "gi");
|
|
3209
|
+
e = e.replace(s, (g, p, v) => It(v));
|
|
3210
|
+
const i = /<a[^>]*href="(https?:\/\/calendly\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3211
|
+
e = e.replace(i, (g, p, v, m) => Zt(v, m));
|
|
3212
|
+
const o = new RegExp(`(?<!["'=])(https?:\\/\\/calendly\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
|
|
3213
|
+
e = e.replace(o, (g, p, v, m) => Zt(v, m));
|
|
3214
|
+
const n = /<a[^>]*href="(https?:\/\/calendar\.google\.com\/calendar\/appointments\/schedules\/([a-zA-Z0-9_-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3215
|
+
e = e.replace(n, (g, p, v) => qt(v));
|
|
3216
|
+
const l = new RegExp(`(?<!["'=])(https?:\\/\\/calendar\\.google\\.com\\/calendar\\/appointments\\/schedules\\/([a-zA-Z0-9_-]+))(?!["'])`, "gi");
|
|
3217
|
+
e = e.replace(l, (g, p, v) => qt(v));
|
|
3218
|
+
const c = /<a[^>]*href="(https?:\/\/cal\.com\/([a-zA-Z0-9_-]+)(?:\/([a-zA-Z0-9_-]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3219
|
+
e = e.replace(c, (g, p, v, m) => Ht(v, m, r));
|
|
3220
|
+
const u = new RegExp(`(?<!["'=])(https?:\\/\\/cal\\.com\\/([a-zA-Z0-9_-]+)(?:\\/([a-zA-Z0-9_-]+))?)(?!["'])`, "gi");
|
|
3221
|
+
e = e.replace(u, (g, p, v, m) => Ht(v, m, r));
|
|
3222
|
+
const f = /<a[^>]*href="(https?:\/\/(?:www\.)?notion\.so\/([a-zA-Z0-9-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3223
|
+
e = e.replace(f, (g, p, v) => jt(v));
|
|
3224
|
+
const y = new RegExp(`(?<!["'=])(https?:\\/\\/(?:www\\.)?notion\\.so\\/([a-zA-Z0-9-]+))(?!["'])`, "gi");
|
|
3225
|
+
e = e.replace(y, (g, p, v) => jt(v));
|
|
3226
|
+
const d = /<a[^>]*href="(https?:\/\/airtable\.com\/(?:embed\/)?([a-zA-Z0-9]+)(?:\/([a-zA-Z0-9]+))?[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3227
|
+
e = e.replace(d, (g, p, v, m) => Dt(v, m));
|
|
3228
|
+
const b = new RegExp(`(?<!["'=])(https?:\\/\\/airtable\\.com\\/(?:embed\\/)?([a-zA-Z0-9]+)(?:\\/([a-zA-Z0-9]+))?)(?!["'])`, "gi");
|
|
3229
|
+
e = e.replace(b, (g, p, v, m) => Dt(v, m));
|
|
3230
|
+
const h = /<a[^>]*href="(https?:\/\/miro\.com\/app\/board\/([a-zA-Z0-9_=-]+)[^"]*)"[^>]*>[^<]*<\/a>/gi;
|
|
3231
|
+
e = e.replace(h, (g, p, v) => Vt(v));
|
|
3232
|
+
const w = new RegExp(`(?<!["'=])(https?:\\/\\/miro\\.com\\/app\\/board\\/([a-zA-Z0-9_=-]+))(?!["'])`, "gi");
|
|
3233
|
+
return e = e.replace(w, (g, p, v) => Vt(v)), e;
|
|
3234
|
+
}
|
|
3235
|
+
function It(e) {
|
|
3236
|
+
return `
|
|
3237
|
+
<div class="artifactuse-typeform-wrapper">
|
|
3238
|
+
<iframe
|
|
3239
|
+
src="https://form.typeform.com/to/${e}"
|
|
3240
|
+
class="artifactuse-typeform-iframe"
|
|
3241
|
+
loading="lazy">
|
|
3242
|
+
</iframe>
|
|
3243
|
+
</div>
|
|
3244
|
+
`;
|
|
3245
|
+
}
|
|
3246
|
+
function Zt(e, t = "") {
|
|
3247
|
+
return `
|
|
3248
|
+
<div class="artifactuse-calendly-wrapper">
|
|
3249
|
+
<iframe
|
|
3250
|
+
src="${t ? `https://calendly.com/${e}/${t}` : `https://calendly.com/${e}`}?embed_domain=localhost&embed_type=Inline"
|
|
3251
|
+
class="artifactuse-calendly-iframe"
|
|
3252
|
+
loading="lazy">
|
|
3253
|
+
</iframe>
|
|
3254
|
+
</div>
|
|
3255
|
+
`;
|
|
3256
|
+
}
|
|
3257
|
+
function qt(e) {
|
|
3258
|
+
return `
|
|
3259
|
+
<div class="artifactuse-google-calendar-wrapper">
|
|
3260
|
+
<iframe
|
|
3261
|
+
src="https://calendar.google.com/calendar/appointments/schedules/${e}?gv=true"
|
|
3262
|
+
class="artifactuse-google-calendar-iframe"
|
|
3263
|
+
loading="lazy">
|
|
3264
|
+
</iframe>
|
|
3265
|
+
</div>
|
|
3266
|
+
`;
|
|
3267
|
+
}
|
|
3268
|
+
function Ht(e, t = "", r = "dark") {
|
|
3269
|
+
return `
|
|
3270
|
+
<div class="artifactuse-calcom-wrapper">
|
|
3271
|
+
<iframe
|
|
3272
|
+
src="https://cal.com/${t ? `${e}/${t}` : e}?embed=true&theme=${r}"
|
|
3273
|
+
class="artifactuse-calcom-iframe"
|
|
3274
|
+
loading="lazy">
|
|
3275
|
+
</iframe>
|
|
3276
|
+
</div>
|
|
3277
|
+
`;
|
|
3278
|
+
}
|
|
3279
|
+
function jt(e) {
|
|
3280
|
+
return `
|
|
3281
|
+
<div class="artifactuse-notion-wrapper">
|
|
3282
|
+
<iframe
|
|
3283
|
+
src="https://notion.so/${e}"
|
|
3284
|
+
class="artifactuse-notion-iframe"
|
|
3285
|
+
loading="lazy"
|
|
3286
|
+
allowfullscreen>
|
|
3287
|
+
</iframe>
|
|
3288
|
+
</div>
|
|
3289
|
+
`;
|
|
3290
|
+
}
|
|
3291
|
+
function Dt(e, t) {
|
|
3292
|
+
return `
|
|
3293
|
+
<div class="artifactuse-airtable-wrapper">
|
|
3294
|
+
<iframe
|
|
3295
|
+
src="${t ? `https://airtable.com/embed/${e}/${t}` : `https://airtable.com/embed/${e}`}?backgroundColor=purple"
|
|
3296
|
+
class="artifactuse-airtable-iframe"
|
|
3297
|
+
loading="lazy">
|
|
3298
|
+
</iframe>
|
|
3299
|
+
</div>
|
|
3300
|
+
`;
|
|
3301
|
+
}
|
|
3302
|
+
function Vt(e) {
|
|
3303
|
+
return `
|
|
3304
|
+
<div class="artifactuse-miro-wrapper">
|
|
3305
|
+
<iframe
|
|
3306
|
+
src="https://miro.com/app/embed/${e}/?autoplay=yep"
|
|
3307
|
+
class="artifactuse-miro-iframe"
|
|
3308
|
+
allowfullscreen
|
|
3309
|
+
loading="lazy">
|
|
3310
|
+
</iframe>
|
|
3311
|
+
</div>
|
|
3312
|
+
`;
|
|
3313
|
+
}
|
|
3314
|
+
let B = null, ue = !1, Be = !1;
|
|
3315
|
+
function nr(e) {
|
|
3316
|
+
const t = /<pre><code class="language-mermaid">([\s\S]*?)<\/code><\/pre>/gi;
|
|
3317
|
+
return e = e.replace(t, (r, a) => {
|
|
3318
|
+
const s = Ga(a).trim();
|
|
3319
|
+
return Xa(s);
|
|
3320
|
+
}), e;
|
|
3321
|
+
}
|
|
3322
|
+
function Ga(e) {
|
|
3323
|
+
return e.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ");
|
|
3324
|
+
}
|
|
3325
|
+
function Xa(e) {
|
|
3326
|
+
const t = or(e);
|
|
3327
|
+
return `
|
|
3328
|
+
<div class="artifactuse-mermaid-container" data-mermaid-id="${`mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`}" data-mermaid-diagram="${t}">
|
|
3329
|
+
<div class="artifactuse-mermaid-loading">Loading diagram...</div>
|
|
3330
|
+
</div>
|
|
3331
|
+
`;
|
|
3332
|
+
}
|
|
3333
|
+
function or(e) {
|
|
3334
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
3335
|
+
}
|
|
3336
|
+
function cr(e) {
|
|
3337
|
+
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
3338
|
+
}
|
|
3339
|
+
function lr(e = {}) {
|
|
3340
|
+
return typeof mermaid > "u" ? ue ? (console.warn("Mermaid loading previously failed. Diagram rendering disabled."), Promise.resolve()) : (console.debug("Mermaid library not loaded. Attempting to load..."), Qa().then(() => (console.log("Mermaid loaded, rendering diagrams..."), Bt(e), pe())).catch((t) => {
|
|
3341
|
+
console.error("Failed to load Mermaid library:", t), ue = !0, Wa();
|
|
3342
|
+
})) : (Be || Bt(e), pe());
|
|
3343
|
+
}
|
|
3344
|
+
function Bt(e = {}) {
|
|
3345
|
+
if (typeof mermaid > "u") return;
|
|
3346
|
+
const r = {
|
|
3347
|
+
dark: "dark",
|
|
3348
|
+
light: "default"
|
|
3349
|
+
}[e.theme] || "default", a = {
|
|
3350
|
+
startOnLoad: !1,
|
|
3351
|
+
theme: r,
|
|
3352
|
+
securityLevel: "loose",
|
|
3353
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
3354
|
+
flowchart: {
|
|
3355
|
+
useMaxWidth: !0,
|
|
3356
|
+
htmlLabels: !0,
|
|
3357
|
+
curve: "basis"
|
|
3358
|
+
},
|
|
3359
|
+
sequence: {
|
|
3360
|
+
useMaxWidth: !0,
|
|
3361
|
+
diagramMarginX: 50,
|
|
3362
|
+
diagramMarginY: 10
|
|
3363
|
+
},
|
|
3364
|
+
gantt: {
|
|
3365
|
+
useMaxWidth: !0
|
|
3366
|
+
},
|
|
3367
|
+
// Allow config overrides but ensure theme is applied
|
|
3368
|
+
...e,
|
|
3369
|
+
theme: r
|
|
3370
|
+
// Ensure theme is not overridden by spread
|
|
3371
|
+
};
|
|
3372
|
+
mermaid.initialize(a), Be = !0;
|
|
3373
|
+
}
|
|
3374
|
+
async function pe() {
|
|
3375
|
+
if (typeof mermaid > "u") {
|
|
3376
|
+
console.warn("renderAllMermaid called but Mermaid is not available");
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
const e = document.querySelectorAll(".artifactuse-mermaid-container");
|
|
3380
|
+
for (const t of e) {
|
|
3381
|
+
if (t.dataset.rendered === "true") continue;
|
|
3382
|
+
const r = cr(t.dataset.mermaidDiagram), a = t.dataset.mermaidId;
|
|
3383
|
+
try {
|
|
3384
|
+
if (await mermaid.parse(r)) {
|
|
3385
|
+
const { svg: i } = await mermaid.render(a, r);
|
|
3386
|
+
t.innerHTML = i, t.classList.add("artifactuse-mermaid-rendered"), t.dataset.rendered = "true";
|
|
3387
|
+
}
|
|
3388
|
+
} catch (s) {
|
|
3389
|
+
console.error("Mermaid rendering error:", s), t.innerHTML = `
|
|
3390
|
+
<div class="artifactuse-mermaid-error">
|
|
3391
|
+
<div class="artifactuse-mermaid-error-title">Diagram Error</div>
|
|
3392
|
+
<pre class="artifactuse-mermaid-error-message">${Me(s.message || "Invalid diagram syntax")}</pre>
|
|
3393
|
+
<details class="artifactuse-mermaid-error-details">
|
|
3394
|
+
<summary>View source</summary>
|
|
3395
|
+
<pre>${Me(r)}</pre>
|
|
3396
|
+
</details>
|
|
3397
|
+
</div>
|
|
3398
|
+
`, t.dataset.rendered = "true", t.classList.add("artifactuse-mermaid-error-container");
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
function Wa() {
|
|
3403
|
+
document.querySelectorAll(".artifactuse-mermaid-container").forEach((e) => {
|
|
3404
|
+
if (e.dataset.rendered === "true") return;
|
|
3405
|
+
const t = cr(e.dataset.mermaidDiagram);
|
|
3406
|
+
e.innerHTML = `
|
|
3407
|
+
<div class="artifactuse-mermaid-fallback">
|
|
3408
|
+
<div class="artifactuse-mermaid-fallback-title">Mermaid Diagram</div>
|
|
3409
|
+
<pre class="artifactuse-mermaid-fallback-source">${Me(t)}</pre>
|
|
3410
|
+
</div>
|
|
3411
|
+
`, e.dataset.rendered = "true", e.classList.add("artifactuse-mermaid-fallback-container");
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
function Me(e) {
|
|
3415
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3416
|
+
}
|
|
3417
|
+
function Qa() {
|
|
3418
|
+
return B || (typeof mermaid < "u" ? Promise.resolve() : (B = new Promise((e, t) => {
|
|
3419
|
+
const r = setTimeout(() => {
|
|
3420
|
+
B = null, t(new Error("Mermaid loading timed out after 15 seconds"));
|
|
3421
|
+
}, 15e3), a = document.createElement("script");
|
|
3422
|
+
a.src = "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js", a.crossOrigin = "anonymous", a.onload = () => {
|
|
3423
|
+
clearTimeout(r), console.log("Mermaid script loaded successfully"), e();
|
|
3424
|
+
}, a.onerror = (s) => {
|
|
3425
|
+
clearTimeout(r), B = null, console.error("Mermaid script failed to load:", s), t(new Error("Failed to load Mermaid script from CDN"));
|
|
3426
|
+
}, document.head.appendChild(a);
|
|
3427
|
+
}), B));
|
|
3428
|
+
}
|
|
3429
|
+
function ks() {
|
|
3430
|
+
B = null, ue = !1, Be = !1;
|
|
3431
|
+
}
|
|
3432
|
+
function xs() {
|
|
3433
|
+
return typeof mermaid < "u";
|
|
3434
|
+
}
|
|
3435
|
+
function $s() {
|
|
3436
|
+
return ue;
|
|
3437
|
+
}
|
|
3438
|
+
function Rs(e, t = {}) {
|
|
3439
|
+
if (!e) return Promise.resolve();
|
|
3440
|
+
let r = e.innerHTML;
|
|
3441
|
+
return r = nr(r), e.innerHTML = r, lr(t);
|
|
3442
|
+
}
|
|
3443
|
+
async function As(e) {
|
|
3444
|
+
const t = document.querySelector(`[data-mermaid-id="${e}"]`);
|
|
3445
|
+
t && (t.dataset.rendered = "false", t.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await pe());
|
|
3446
|
+
}
|
|
3447
|
+
async function zs(e, t) {
|
|
3448
|
+
const r = document.querySelector(`[data-mermaid-id="${e}"]`);
|
|
3449
|
+
r && (r.dataset.mermaidDiagram = or(t), r.dataset.rendered = "false", r.innerHTML = '<div class="artifactuse-mermaid-loading">Loading diagram...</div>', await pe());
|
|
3450
|
+
}
|
|
3451
|
+
function Ka(e) {
|
|
3452
|
+
const t = /<table([^>]*)>([\s\S]*?)<\/table>/gi;
|
|
3453
|
+
let r = 0;
|
|
3454
|
+
return e = e.replace(t, (a, s, i) => {
|
|
3455
|
+
const o = `artifactuse-table-${r++}`;
|
|
3456
|
+
return Ja(o, s, i);
|
|
3457
|
+
}), e;
|
|
3458
|
+
}
|
|
3459
|
+
function Ja(e, t, r) {
|
|
3460
|
+
const a = /<thead/i.test(r) || /<th/i.test(r), s = (r.match(/<tr/gi) || []).length;
|
|
3461
|
+
if (!a || s < 3)
|
|
3462
|
+
return `<table${t} class="artifactuse-table">${r}</table>`;
|
|
3463
|
+
const i = Ya(r);
|
|
3464
|
+
return `
|
|
3465
|
+
<div class="artifactuse-table-container" data-table-id="${e}">
|
|
3466
|
+
<div class="artifactuse-table-controls">
|
|
3467
|
+
<div class="artifactuse-table-search">
|
|
3468
|
+
<input
|
|
3469
|
+
type="text"
|
|
3470
|
+
placeholder="Search table..."
|
|
3471
|
+
class="artifactuse-table-search-input"
|
|
3472
|
+
data-table-search="${e}"
|
|
3473
|
+
/>
|
|
3474
|
+
<svg class="artifactuse-table-search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3475
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
3476
|
+
<path d="m21 21-4.35-4.35"></path>
|
|
3477
|
+
</svg>
|
|
3478
|
+
</div>
|
|
3479
|
+
<div class="artifactuse-table-actions">
|
|
3480
|
+
<button class="artifactuse-table-action-btn" data-table-export="${e}" data-format="csv" title="Export CSV">
|
|
3481
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3482
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
3483
|
+
<polyline points="7 10 12 15 17 10"></polyline>
|
|
3484
|
+
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
3485
|
+
</svg>
|
|
3486
|
+
<span>CSV</span>
|
|
3487
|
+
</button>
|
|
3488
|
+
<button class="artifactuse-table-action-btn" data-table-copy="${e}" title="Copy to clipboard">
|
|
3489
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3490
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
|
3491
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
|
3492
|
+
</svg>
|
|
3493
|
+
<span>Copy</span>
|
|
3494
|
+
</button>
|
|
3495
|
+
</div>
|
|
3496
|
+
</div>
|
|
3497
|
+
<div class="artifactuse-table-wrapper">
|
|
3498
|
+
<table${t} class="artifactuse-table artifactuse-enhanced-table" id="${e}">${i}</table>
|
|
3499
|
+
</div>
|
|
3500
|
+
<div class="artifactuse-table-footer">
|
|
3501
|
+
<span class="artifactuse-table-row-count" data-table-count="${e}"></span>
|
|
3502
|
+
</div>
|
|
3503
|
+
</div>
|
|
3504
|
+
`;
|
|
3505
|
+
}
|
|
3506
|
+
function Ya(e) {
|
|
3507
|
+
let t = 0;
|
|
3508
|
+
return e = e.replace(/<th(\s[^>]*)?>([\s\S]*?)<\/th>/gi, (r, a, s) => {
|
|
3509
|
+
const i = t++;
|
|
3510
|
+
return a = a || "", `
|
|
3511
|
+
<th${a} class="artifactuse-sortable-header" data-sort-col="${i}">
|
|
3512
|
+
<div class="artifactuse-th-content">
|
|
3513
|
+
<span>${s}</span>
|
|
3514
|
+
<span class="artifactuse-sort-indicator">
|
|
3515
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
3516
|
+
<path d="M7 15l5 5 5-5"></path>
|
|
3517
|
+
<path d="M7 9l5-5 5 5"></path>
|
|
3518
|
+
</svg>
|
|
3519
|
+
</span>
|
|
3520
|
+
</div>
|
|
3521
|
+
</th>
|
|
3522
|
+
`;
|
|
3523
|
+
}), e;
|
|
3524
|
+
}
|
|
3525
|
+
function es(e) {
|
|
3526
|
+
const t = e.querySelectorAll("tr"), r = [];
|
|
3527
|
+
return t.forEach((a) => {
|
|
3528
|
+
const s = a.querySelectorAll("th, td"), i = [];
|
|
3529
|
+
s.forEach((o) => {
|
|
3530
|
+
let n = o.textContent.trim();
|
|
3531
|
+
n = n.replace(/"/g, '""'), (n.includes(",") || n.includes(`
|
|
3532
|
+
`) || n.includes('"')) && (n = `"${n}"`), i.push(n);
|
|
3533
|
+
}), r.push(i.join(","));
|
|
3534
|
+
}), r.join(`
|
|
3535
|
+
`);
|
|
3536
|
+
}
|
|
3537
|
+
function ts(e, t = "table-data.csv") {
|
|
3538
|
+
const r = new Blob([e], { type: "text/csv;charset=utf-8;" }), a = URL.createObjectURL(r), s = document.createElement("a");
|
|
3539
|
+
s.href = a, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(a);
|
|
3540
|
+
}
|
|
3541
|
+
function rs(e) {
|
|
3542
|
+
const t = e.querySelectorAll("tr"), r = [];
|
|
3543
|
+
return t.forEach((a) => {
|
|
3544
|
+
const s = a.querySelectorAll("th, td"), i = [];
|
|
3545
|
+
s.forEach((o) => {
|
|
3546
|
+
i.push(o.textContent.trim());
|
|
3547
|
+
}), r.push(i.join(" "));
|
|
3548
|
+
}), r.join(`
|
|
3549
|
+
`);
|
|
3550
|
+
}
|
|
3551
|
+
function as(e, t, r = !0) {
|
|
3552
|
+
const a = e.querySelector("tbody") || e, s = Array.from(a.querySelectorAll("tr")).filter((i) => !i.querySelector("th"));
|
|
3553
|
+
s.sort((i, o) => {
|
|
3554
|
+
const n = i.cells[t], l = o.cells[t];
|
|
3555
|
+
if (!n || !l) return 0;
|
|
3556
|
+
let c = n.textContent.trim(), u = l.textContent.trim();
|
|
3557
|
+
const f = parseFloat(c.replace(/[,$%]/g, "")), y = parseFloat(u.replace(/[,$%]/g, ""));
|
|
3558
|
+
if (!isNaN(f) && !isNaN(y))
|
|
3559
|
+
return r ? f - y : y - f;
|
|
3560
|
+
const d = new Date(c), b = new Date(u);
|
|
3561
|
+
return !isNaN(d.getTime()) && !isNaN(b.getTime()) ? r ? d - b : b - d : r ? c.localeCompare(u) : u.localeCompare(c);
|
|
3562
|
+
}), s.forEach((i) => a.appendChild(i));
|
|
3563
|
+
}
|
|
3564
|
+
function ss(e, t) {
|
|
3565
|
+
const r = e.querySelectorAll("tbody tr, tr:not(:first-child)"), a = t.toLowerCase().trim();
|
|
3566
|
+
let s = 0;
|
|
3567
|
+
return r.forEach((i) => {
|
|
3568
|
+
if (i.querySelector("th")) {
|
|
3569
|
+
i.style.display = "";
|
|
3570
|
+
return;
|
|
3571
|
+
}
|
|
3572
|
+
const o = i.textContent.toLowerCase(), n = !a || o.includes(a);
|
|
3573
|
+
i.style.display = n ? "" : "none", n && s++;
|
|
3574
|
+
}), s;
|
|
3575
|
+
}
|
|
3576
|
+
function is() {
|
|
3577
|
+
document.querySelectorAll("[data-table-search]").forEach((e) => {
|
|
3578
|
+
const t = e.dataset.tableSearch, r = document.getElementById(t), a = document.querySelector(`[data-table-count="${t}"]`);
|
|
3579
|
+
if (r) {
|
|
3580
|
+
const s = r.querySelectorAll("tbody tr, tr:not(:first-child)"), i = Array.from(s).filter((o) => !o.querySelector("th")).length;
|
|
3581
|
+
a && (a.textContent = `${i} rows`), e.addEventListener("input", (o) => {
|
|
3582
|
+
const n = ss(r, o.target.value);
|
|
3583
|
+
a && (a.textContent = o.target.value ? `${n} of ${i} rows` : `${i} rows`);
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
}), document.querySelectorAll(".artifactuse-sortable-header").forEach((e) => {
|
|
3587
|
+
e.addEventListener("click", () => {
|
|
3588
|
+
const t = e.closest("table"), r = parseInt(e.dataset.sortCol), s = e.dataset.sortDir !== "asc";
|
|
3589
|
+
t.querySelectorAll(".artifactuse-sortable-header").forEach((i) => {
|
|
3590
|
+
i.dataset.sortDir = "", i.classList.remove("sort-asc", "sort-desc");
|
|
3591
|
+
}), e.dataset.sortDir = s ? "asc" : "desc", e.classList.add(s ? "sort-asc" : "sort-desc"), as(t, r, s);
|
|
3592
|
+
});
|
|
3593
|
+
}), document.querySelectorAll("[data-table-export]").forEach((e) => {
|
|
3594
|
+
e.addEventListener("click", () => {
|
|
3595
|
+
const t = e.dataset.tableExport, r = document.getElementById(t);
|
|
3596
|
+
if (r) {
|
|
3597
|
+
const a = es(r);
|
|
3598
|
+
ts(a, `${t}.csv`);
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
}), document.querySelectorAll("[data-table-copy]").forEach((e) => {
|
|
3602
|
+
e.addEventListener("click", async () => {
|
|
3603
|
+
const t = e.dataset.tableCopy, r = document.getElementById(t);
|
|
3604
|
+
if (r) {
|
|
3605
|
+
const a = rs(r);
|
|
3606
|
+
try {
|
|
3607
|
+
await navigator.clipboard.writeText(a);
|
|
3608
|
+
const s = e.querySelector("span"), i = s ? s.textContent : "";
|
|
3609
|
+
s && (s.textContent = "Copied!"), e.classList.add("copied"), setTimeout(() => {
|
|
3610
|
+
s && (s.textContent = i), e.classList.remove("copied");
|
|
3611
|
+
}, 2e3);
|
|
3612
|
+
} catch (s) {
|
|
3613
|
+
console.error("Failed to copy:", s);
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
});
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
let O = null, de = !1;
|
|
3620
|
+
function ur(e) {
|
|
3621
|
+
return e = ns(e), e = e.replace(/\$\$([\s\S]*?)\$\$/g, (t, r) => Y(r.trim(), !0)), e = e.replace(/\\\[([\s\S]*?)\\\]/g, (t, r) => Y(r.trim(), !0)), e = e.replace(new RegExp("(?<!\\$)\\$(?!\\$)((?:[^$\\\\]|\\\\.)+?)\\$(?!\\$)", "g"), (t, r) => Y(r.trim(), !1)), e = e.replace(/\\\(([\s\S]*?)\\\)/g, (t, r) => Y(r.trim(), !1)), e;
|
|
3622
|
+
}
|
|
3623
|
+
function ns(e) {
|
|
3624
|
+
const t = /<pre><code class="language-(math|latex)">([\s\S]*?)<\/code><\/pre>/gi;
|
|
3625
|
+
return e = e.replace(t, (r, a, s) => {
|
|
3626
|
+
const i = os(s).trim();
|
|
3627
|
+
return Y(i, !0);
|
|
3628
|
+
}), e;
|
|
3629
|
+
}
|
|
3630
|
+
function os(e) {
|
|
3631
|
+
return e.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ");
|
|
3632
|
+
}
|
|
3633
|
+
function Y(e, t = !1) {
|
|
3634
|
+
const r = cs(e);
|
|
3635
|
+
return `<span class="artifactuse-math-container ${t ? "artifactuse-math-display" : "artifactuse-math-inline"}" data-tex="${r}" data-display="${t ? "true" : "false"}"></span>`;
|
|
3636
|
+
}
|
|
3637
|
+
function cs(e) {
|
|
3638
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
3639
|
+
}
|
|
3640
|
+
function pr(e) {
|
|
3641
|
+
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
3642
|
+
}
|
|
3643
|
+
function dr() {
|
|
3644
|
+
return typeof katex > "u" ? de ? (console.warn("KaTeX loading previously failed. Math rendering disabled."), Promise.resolve()) : (console.debug("KaTeX library not loaded. Attempting to load..."), us().then(() => {
|
|
3645
|
+
console.log("KaTeX loaded, rendering math..."), Ot();
|
|
3646
|
+
}).catch((e) => {
|
|
3647
|
+
console.error("Failed to load KaTeX library:", e), de = !0, ls();
|
|
3648
|
+
})) : (Ot(), Promise.resolve());
|
|
3649
|
+
}
|
|
3650
|
+
function ls() {
|
|
3651
|
+
document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
|
|
3652
|
+
if (e.dataset.rendered === "true") return;
|
|
3653
|
+
const t = pr(e.dataset.tex);
|
|
3654
|
+
e.innerHTML = `<code class="artifactuse-math-fallback" title="Math rendering unavailable">${Te(t)}</code>`, e.dataset.rendered = "true", e.classList.add("artifactuse-math-fallback-container");
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
function Ot() {
|
|
3658
|
+
if (typeof katex > "u") {
|
|
3659
|
+
console.warn("renderAllMath called but KaTeX is not available");
|
|
3660
|
+
return;
|
|
3661
|
+
}
|
|
3662
|
+
document.querySelectorAll(".artifactuse-math-container").forEach((e) => {
|
|
3663
|
+
if (e.dataset.rendered === "true") return;
|
|
3664
|
+
const t = pr(e.dataset.tex), r = e.dataset.display === "true";
|
|
3665
|
+
try {
|
|
3666
|
+
katex.render(t, e, {
|
|
3667
|
+
displayMode: r,
|
|
3668
|
+
throwOnError: !1,
|
|
3669
|
+
errorColor: "#dc2626",
|
|
3670
|
+
trust: !0,
|
|
3671
|
+
strict: !1,
|
|
3672
|
+
macros: {
|
|
3673
|
+
// Common macros
|
|
3674
|
+
"\\R": "\\mathbb{R}",
|
|
3675
|
+
"\\N": "\\mathbb{N}",
|
|
3676
|
+
"\\Z": "\\mathbb{Z}",
|
|
3677
|
+
"\\Q": "\\mathbb{Q}",
|
|
3678
|
+
"\\C": "\\mathbb{C}",
|
|
3679
|
+
"\\vec": "\\mathbf",
|
|
3680
|
+
"\\norm": "\\left\\|#1\\right\\|",
|
|
3681
|
+
"\\abs": "\\left|#1\\right|"
|
|
3682
|
+
}
|
|
3683
|
+
}), e.dataset.rendered = "true";
|
|
3684
|
+
} catch (a) {
|
|
3685
|
+
console.error("KaTeX rendering error:", a), e.innerHTML = `<span class="artifactuse-math-error" title="${Te(a.message)}">${Te(t)}</span>`, e.dataset.rendered = "true";
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
function Te(e) {
|
|
3690
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3691
|
+
}
|
|
3692
|
+
function us() {
|
|
3693
|
+
return O || (typeof katex < "u" ? Promise.resolve() : (O = new Promise((e, t) => {
|
|
3694
|
+
const r = setTimeout(() => {
|
|
3695
|
+
O = null, t(new Error("KaTeX loading timed out after 10 seconds"));
|
|
3696
|
+
}, 1e4), a = document.createElement("link");
|
|
3697
|
+
a.rel = "stylesheet", a.href = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css", a.crossOrigin = "anonymous", a.onerror = () => {
|
|
3698
|
+
console.warn("KaTeX CSS failed to load, math may not render correctly");
|
|
3699
|
+
}, document.head.appendChild(a);
|
|
3700
|
+
const s = document.createElement("script");
|
|
3701
|
+
s.src = "https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js", s.crossOrigin = "anonymous", s.onload = () => {
|
|
3702
|
+
clearTimeout(r), console.log("KaTeX script loaded successfully"), e();
|
|
3703
|
+
}, s.onerror = (i) => {
|
|
3704
|
+
clearTimeout(r), O = null, console.error("KaTeX script failed to load:", i), t(new Error("Failed to load KaTeX script from CDN"));
|
|
3705
|
+
}, document.head.appendChild(s);
|
|
3706
|
+
}), O));
|
|
3707
|
+
}
|
|
3708
|
+
function Ss() {
|
|
3709
|
+
O = null, de = !1;
|
|
3710
|
+
}
|
|
3711
|
+
function Ls() {
|
|
3712
|
+
return typeof katex < "u";
|
|
3713
|
+
}
|
|
3714
|
+
function _s() {
|
|
3715
|
+
return de;
|
|
3716
|
+
}
|
|
3717
|
+
function Cs(e) {
|
|
3718
|
+
if (!e) return Promise.resolve();
|
|
3719
|
+
let t = e.innerHTML;
|
|
3720
|
+
return t = ur(t), e.innerHTML = t, dr();
|
|
3721
|
+
}
|
|
3722
|
+
const Ms = {
|
|
3723
|
+
// Fractions
|
|
3724
|
+
fraction: (e, t) => `\\frac{${e}}{${t}}`,
|
|
3725
|
+
// Square root
|
|
3726
|
+
sqrt: (e, t = null) => t ? `\\sqrt[${t}]{${e}}` : `\\sqrt{${e}}`,
|
|
3727
|
+
// Exponents and subscripts
|
|
3728
|
+
power: (e, t) => `${e}^{${t}}`,
|
|
3729
|
+
subscript: (e, t) => `${e}_{${t}}`,
|
|
3730
|
+
// Greek letters (common ones)
|
|
3731
|
+
alpha: "\\alpha",
|
|
3732
|
+
beta: "\\beta",
|
|
3733
|
+
gamma: "\\gamma",
|
|
3734
|
+
delta: "\\delta",
|
|
3735
|
+
theta: "\\theta",
|
|
3736
|
+
lambda: "\\lambda",
|
|
3737
|
+
pi: "\\pi",
|
|
3738
|
+
sigma: "\\sigma",
|
|
3739
|
+
omega: "\\omega",
|
|
3740
|
+
// Operators
|
|
3741
|
+
sum: (e, t, r) => `\\sum_{${e}}^{${t}} ${r}`,
|
|
3742
|
+
product: (e, t, r) => `\\prod_{${e}}^{${t}} ${r}`,
|
|
3743
|
+
integral: (e, t, r) => `\\int_{${e}}^{${t}} ${r}`,
|
|
3744
|
+
limit: (e, t, r) => `\\lim_{${e} \\to ${t}} ${r}`,
|
|
3745
|
+
// Matrices
|
|
3746
|
+
matrix: (e) => `\\begin{pmatrix} ${e.map((t) => t.join(" & ")).join(" \\\\ ")} \\end{pmatrix}`,
|
|
3747
|
+
determinant: (e) => `\\begin{vmatrix} ${e.map((t) => t.join(" & ")).join(" \\\\ ")} \\end{vmatrix}`,
|
|
3748
|
+
// Common equations
|
|
3749
|
+
quadratic: "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}",
|
|
3750
|
+
pythagorean: "a^2 + b^2 = c^2",
|
|
3751
|
+
euler: "e^{i\\pi} + 1 = 0",
|
|
3752
|
+
derivative: (e, t) => `\\frac{d${e}}{d${t}}`,
|
|
3753
|
+
partialDerivative: (e, t) => `\\frac{\\partial ${e}}{\\partial ${t}}`
|
|
3754
|
+
};
|
|
3755
|
+
function re() {
|
|
3756
|
+
return typeof window < "u" && window.Prism;
|
|
3757
|
+
}
|
|
3758
|
+
function fr(e) {
|
|
3759
|
+
if (!re()) {
|
|
3760
|
+
console.warn("Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.");
|
|
3761
|
+
return;
|
|
3762
|
+
}
|
|
3763
|
+
const t = typeof e == "string" ? document.querySelector(e) : e;
|
|
3764
|
+
if (!t) return;
|
|
3765
|
+
t.querySelectorAll("pre code").forEach((a) => {
|
|
3766
|
+
if (a.classList.contains("prism-highlighted")) return;
|
|
3767
|
+
const s = ps(a);
|
|
3768
|
+
s && (a.className.includes(`language-${s}`) || a.classList.add(`language-${s}`), window.Prism.highlightElement(a), a.classList.add("prism-highlighted"));
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
function Ts(e, t) {
|
|
3772
|
+
re() && (t && !e.className.includes(`language-${t}`) && e.classList.add(`language-${t}`), window.Prism.highlightElement(e), e.classList.add("prism-highlighted"));
|
|
3773
|
+
}
|
|
3774
|
+
function Es(e, t) {
|
|
3775
|
+
if (!re()) return Ft(e);
|
|
3776
|
+
const r = window.Prism.languages[t];
|
|
3777
|
+
return r ? window.Prism.highlight(e, r, t) : Ft(e);
|
|
3778
|
+
}
|
|
3779
|
+
function ps(e) {
|
|
3780
|
+
const t = e.className.split(/\s+/);
|
|
3781
|
+
for (const s of t) {
|
|
3782
|
+
const i = s.match(/^(?:language-|lang-)(.+)$/);
|
|
3783
|
+
if (i)
|
|
3784
|
+
return ve(i[1]);
|
|
3785
|
+
}
|
|
3786
|
+
const r = e.closest("pre");
|
|
3787
|
+
if (r) {
|
|
3788
|
+
const s = r.className.split(/\s+/);
|
|
3789
|
+
for (const i of s) {
|
|
3790
|
+
const o = i.match(/^(?:language-|lang-)(.+)$/);
|
|
3791
|
+
if (o)
|
|
3792
|
+
return ve(o[1]);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
const a = e.dataset.language || (r == null ? void 0 : r.dataset.language);
|
|
3796
|
+
return a ? ve(a) : null;
|
|
3797
|
+
}
|
|
3798
|
+
function ve(e) {
|
|
3799
|
+
const t = {
|
|
3800
|
+
js: "javascript",
|
|
3801
|
+
ts: "typescript",
|
|
3802
|
+
py: "python",
|
|
3803
|
+
rb: "ruby",
|
|
3804
|
+
sh: "bash",
|
|
3805
|
+
shell: "bash",
|
|
3806
|
+
zsh: "bash",
|
|
3807
|
+
yml: "yaml",
|
|
3808
|
+
md: "markdown",
|
|
3809
|
+
html: "markup",
|
|
3810
|
+
xml: "markup",
|
|
3811
|
+
svg: "markup",
|
|
3812
|
+
vue: "markup",
|
|
3813
|
+
jsx: "jsx",
|
|
3814
|
+
tsx: "tsx",
|
|
3815
|
+
"c++": "cpp",
|
|
3816
|
+
"c#": "csharp",
|
|
3817
|
+
cs: "csharp",
|
|
3818
|
+
"f#": "fsharp",
|
|
3819
|
+
"objective-c": "objectivec",
|
|
3820
|
+
objc: "objectivec"
|
|
3821
|
+
}, r = e.toLowerCase();
|
|
3822
|
+
return t[r] || r;
|
|
3823
|
+
}
|
|
3824
|
+
function Ft(e) {
|
|
3825
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3826
|
+
}
|
|
3827
|
+
function Ps(e) {
|
|
3828
|
+
if (!re())
|
|
3829
|
+
return console.warn("Artifactuse: Prism.js not found. Auto-highlighting disabled."), null;
|
|
3830
|
+
const t = new MutationObserver((r) => {
|
|
3831
|
+
let a = !1;
|
|
3832
|
+
for (const s of r)
|
|
3833
|
+
if (s.type === "childList") {
|
|
3834
|
+
for (const i of s.addedNodes)
|
|
3835
|
+
if (i.nodeType === Node.ELEMENT_NODE && (i.matches("pre code") || i.querySelector("pre code"))) {
|
|
3836
|
+
a = !0;
|
|
3837
|
+
break;
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
a && fr(e);
|
|
3841
|
+
});
|
|
3842
|
+
return t.observe(e, {
|
|
3843
|
+
childList: !0,
|
|
3844
|
+
subtree: !0
|
|
3845
|
+
}), t;
|
|
3846
|
+
}
|
|
3847
|
+
function Is() {
|
|
3848
|
+
return re() ? Object.keys(window.Prism.languages).filter(
|
|
3849
|
+
(e) => typeof window.Prism.languages[e] == "object"
|
|
3850
|
+
) : [];
|
|
3851
|
+
}
|
|
3852
|
+
function ie(e) {
|
|
3853
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3854
|
+
}
|
|
3855
|
+
function ds() {
|
|
3856
|
+
const e = {
|
|
3857
|
+
image(a) {
|
|
3858
|
+
const s = typeof a == "string" ? a : a.href, i = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
|
|
3859
|
+
return Re(s || "", i || "", o || "");
|
|
3860
|
+
}
|
|
3861
|
+
}, t = {
|
|
3862
|
+
link(a) {
|
|
3863
|
+
const s = typeof a == "string" ? a : a.href, i = typeof a == "string" ? arguments[1] : a.title, o = typeof a == "string" ? arguments[2] : a.text;
|
|
3864
|
+
if (va(s))
|
|
3865
|
+
return ka(s);
|
|
3866
|
+
const n = i ? ` title="${ie(i)}"` : "";
|
|
3867
|
+
return `<a href="${ie(s || "")}" target="_blank" rel="noopener noreferrer"${n}>${o || ""}</a>`;
|
|
3868
|
+
}
|
|
3869
|
+
}, r = {
|
|
3870
|
+
code(a) {
|
|
3871
|
+
const s = typeof a == "string" ? a : a.text, o = (typeof a == "string" ? arguments[1] : a.lang) || "", n = ie(s || "");
|
|
3872
|
+
return o ? `<pre><code class="language-${ie(o)}">${n}</code></pre>` : `<pre><code>${n}</code></pre>`;
|
|
3873
|
+
}
|
|
3874
|
+
};
|
|
3875
|
+
L.use({
|
|
3876
|
+
renderer: {
|
|
3877
|
+
...e,
|
|
3878
|
+
...t,
|
|
3879
|
+
...r
|
|
3880
|
+
},
|
|
3881
|
+
gfm: !0,
|
|
3882
|
+
breaks: !0
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
ds();
|
|
3886
|
+
const fs = {
|
|
3887
|
+
// Structured artifact types
|
|
3888
|
+
form: "form-panel",
|
|
3889
|
+
// Visual editors
|
|
3890
|
+
video: "editor-panel/video",
|
|
3891
|
+
videoeditor: "editor-panel/video",
|
|
3892
|
+
timeline: "editor-panel/video",
|
|
3893
|
+
canvas: "editor-panel/canvas",
|
|
3894
|
+
whiteboard: "editor-panel/canvas",
|
|
3895
|
+
drawing: "editor-panel/canvas",
|
|
3896
|
+
// Data/config formats
|
|
3897
|
+
json: "json-panel",
|
|
3898
|
+
// Graphics
|
|
3899
|
+
svg: "svg-panel",
|
|
3900
|
+
// Diff/patches
|
|
3901
|
+
diff: "diff-panel",
|
|
3902
|
+
patch: "diff-panel",
|
|
3903
|
+
// Programming languages
|
|
3904
|
+
javascript: "code-panel",
|
|
3905
|
+
js: "code-panel",
|
|
3906
|
+
python: "code-panel",
|
|
3907
|
+
py: "code-panel",
|
|
3908
|
+
// Frontend frameworks
|
|
3909
|
+
jsx: "react-panel",
|
|
3910
|
+
react: "react-panel",
|
|
3911
|
+
vue: "vue-panel",
|
|
3912
|
+
// Markup
|
|
3913
|
+
html: "html-panel",
|
|
3914
|
+
htm: "html-panel",
|
|
3915
|
+
markdown: "html-panel",
|
|
3916
|
+
md: "html-panel",
|
|
3917
|
+
// Diagrams
|
|
3918
|
+
mermaid: "mermaid-panel"
|
|
3919
|
+
}, hs = {
|
|
3920
|
+
// CDN URL for panel artifacts (video editor, canvas, etc.)
|
|
3921
|
+
cdnUrl: "https://cdn.artifactuse.com",
|
|
3922
|
+
// Theme: 'dark' | 'light' | 'auto'
|
|
3923
|
+
theme: "auto",
|
|
3924
|
+
// Custom theme colors (optional - theme.js has defaults)
|
|
3925
|
+
// Can be flat (applies to both) or nested { dark: {...}, light: {...} }
|
|
3926
|
+
colors: null,
|
|
3927
|
+
// Show "Powered by Artifactuse" branding in panel footer
|
|
3928
|
+
// Set to false to hide (requires paid license)
|
|
3929
|
+
branding: !0,
|
|
3930
|
+
// Panel configuration
|
|
3931
|
+
// Users can add/override/disable panels here
|
|
3932
|
+
//
|
|
3933
|
+
// Format:
|
|
3934
|
+
// 'type': 'panel-path' - Uses default cdnUrl
|
|
3935
|
+
// 'type': 'https://...' - Full URL (different CDN)
|
|
3936
|
+
// 'type': null - Disable this panel type
|
|
3937
|
+
// 'type': { path: '...', cdn: '...' } - Explicit path + cdn
|
|
3938
|
+
//
|
|
3939
|
+
// Example:
|
|
3940
|
+
// panels: {
|
|
3941
|
+
// 'my-custom': 'custom-panel', // Uses cdnUrl
|
|
3942
|
+
// 'video': 'https://my-cdn.com/video-panel', // Full URL override
|
|
3943
|
+
// 'canvas': null, // Disable canvas panel
|
|
3944
|
+
// 'chart': { path: 'chart-panel', cdn: 'https://charts.example.com' }
|
|
3945
|
+
// }
|
|
3946
|
+
panels: {},
|
|
3947
|
+
// Processor options
|
|
3948
|
+
processors: {
|
|
3949
|
+
codeBlocks: !0,
|
|
3950
|
+
images: !0,
|
|
3951
|
+
imageGalleries: !0,
|
|
3952
|
+
videos: !0,
|
|
3953
|
+
videoGalleries: !0,
|
|
3954
|
+
audio: !0,
|
|
3955
|
+
maps: !0,
|
|
3956
|
+
social: !0,
|
|
3957
|
+
documents: !0,
|
|
3958
|
+
codeEmbeds: !0,
|
|
3959
|
+
dataViz: !0,
|
|
3960
|
+
design: !0,
|
|
3961
|
+
interactive: !0,
|
|
3962
|
+
tables: !0,
|
|
3963
|
+
math: !0,
|
|
3964
|
+
mermaid: !0
|
|
3965
|
+
},
|
|
3966
|
+
// Minimum lines/length for code block extraction
|
|
3967
|
+
codeExtraction: {
|
|
3968
|
+
minLines: 3,
|
|
3969
|
+
minLength: 50
|
|
3970
|
+
},
|
|
3971
|
+
// Syntax highlighting (requires Prism.js)
|
|
3972
|
+
syntaxHighlight: !0
|
|
3973
|
+
};
|
|
3974
|
+
function gs(e) {
|
|
3975
|
+
const t = { ...fs };
|
|
3976
|
+
if (e.panels)
|
|
3977
|
+
for (const [n, l] of Object.entries(e.panels))
|
|
3978
|
+
if (Array.isArray(n))
|
|
3979
|
+
n.forEach((c) => {
|
|
3980
|
+
const u = c == null ? void 0 : c.toLowerCase();
|
|
3981
|
+
u && (t[u] = l);
|
|
3982
|
+
});
|
|
3983
|
+
else {
|
|
3984
|
+
const c = n == null ? void 0 : n.toLowerCase();
|
|
3985
|
+
c && (t[c] = l);
|
|
3986
|
+
}
|
|
3987
|
+
function r(n, l = {}) {
|
|
3988
|
+
const c = n == null ? void 0 : n.toLowerCase();
|
|
3989
|
+
if (!c) return null;
|
|
3990
|
+
const u = t[c];
|
|
3991
|
+
if (u === null || u === void 0) return null;
|
|
3992
|
+
let f;
|
|
3993
|
+
if (typeof u == "string")
|
|
3994
|
+
u.startsWith("http://") || u.startsWith("https://") ? f = u : f = `${e.cdnUrl}/${u}`;
|
|
3995
|
+
else if (typeof u == "object" && u.path)
|
|
3996
|
+
f = `${u.cdn || e.cdnUrl}/${u.path}`;
|
|
3997
|
+
else
|
|
3998
|
+
return null;
|
|
3999
|
+
f.endsWith("/") || (f += "/");
|
|
4000
|
+
const y = new URLSearchParams();
|
|
4001
|
+
l.theme && y.set("theme", l.theme), l.accent && y.set("accent", l.accent), l.params && Object.entries(l.params).forEach(([b, h]) => {
|
|
4002
|
+
y.set(b, h);
|
|
4003
|
+
});
|
|
4004
|
+
const d = y.toString();
|
|
4005
|
+
return d ? `${f}?${d}` : f;
|
|
4006
|
+
}
|
|
4007
|
+
function a(n) {
|
|
4008
|
+
const l = n == null ? void 0 : n.toLowerCase();
|
|
4009
|
+
return l && t[l] !== void 0 && t[l] !== null;
|
|
4010
|
+
}
|
|
4011
|
+
function s() {
|
|
4012
|
+
return Object.keys(t).filter((n) => t[n] !== null);
|
|
4013
|
+
}
|
|
4014
|
+
function i(n, l) {
|
|
4015
|
+
(Array.isArray(n) ? n : [n]).forEach((u) => {
|
|
4016
|
+
const f = u == null ? void 0 : u.toLowerCase();
|
|
4017
|
+
f && (t[f] = l);
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
function o(n) {
|
|
4021
|
+
(Array.isArray(n) ? n : [n]).forEach((c) => {
|
|
4022
|
+
const u = c == null ? void 0 : c.toLowerCase();
|
|
4023
|
+
u && (t[u] = null);
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4026
|
+
return {
|
|
4027
|
+
resolve: r,
|
|
4028
|
+
has: a,
|
|
4029
|
+
getTypes: s,
|
|
4030
|
+
register: i,
|
|
4031
|
+
unregister: o,
|
|
4032
|
+
// Expose raw panels for debugging
|
|
4033
|
+
get panels() {
|
|
4034
|
+
return { ...t };
|
|
4035
|
+
}
|
|
4036
|
+
};
|
|
4037
|
+
}
|
|
4038
|
+
function Zs(e = {}) {
|
|
4039
|
+
const t = hr(hs, e), r = Lr(), a = _r(t.cdnUrl), s = Tr(t.theme, t.colors || {}), i = gs(t);
|
|
4040
|
+
function o($, C) {
|
|
4041
|
+
let R = L.parse($);
|
|
4042
|
+
const D = [], I = { theme: s.resolved };
|
|
4043
|
+
if (t.processors.codeBlocks) {
|
|
4044
|
+
const H = Sr(R, C, t.codeExtraction);
|
|
4045
|
+
R = H.html, D.push(...H.artifacts);
|
|
4046
|
+
}
|
|
4047
|
+
return t.processors.images && (R = wa(R)), t.processors.imageGalleries && (R = ba(R)), t.processors.videos && (R = xa(R)), t.processors.videoGalleries && (R = za(R)), t.processors.audio && (R = _a(R, I)), t.processors.maps && (R = qa(R)), t.processors.social && (R = Ha(R, I)), t.processors.documents && (R = ja(R), R = Da(R), R = Va(R)), t.processors.codeEmbeds && (R = Oa(R, I)), t.processors.dataViz && (R = Fa(R)), t.processors.design && (R = Na(R, I)), t.processors.interactive && (R = Ua(R, I)), t.processors.tables && (R = Ka(R)), t.processors.math && (R = ur(R)), t.processors.mermaid && (R = nr(R)), D.forEach((H) => {
|
|
4048
|
+
r.addArtifact(H);
|
|
4049
|
+
}), {
|
|
4050
|
+
html: R,
|
|
4051
|
+
artifacts: D
|
|
4052
|
+
};
|
|
4053
|
+
}
|
|
4054
|
+
async function n($ = document) {
|
|
4055
|
+
const C = [], R = { theme: s.resolved };
|
|
4056
|
+
t.processors.math && C.push(dr()), t.processors.mermaid && C.push(lr(R)), t.processors.tables && is(), t.processors.audio && Ma($), t.syntaxHighlight && fr($), await Promise.all(C);
|
|
4057
|
+
}
|
|
4058
|
+
function l($) {
|
|
4059
|
+
if ($.isInline) {
|
|
4060
|
+
console.warn("Attempted to open inline artifact in panel:", $.id);
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
r.setActiveArtifact($.id), r.setPanelOpen(!0), k("artifact:opened", $);
|
|
4064
|
+
}
|
|
4065
|
+
function c() {
|
|
4066
|
+
r.setPanelOpen(!1), r.setFullscreen(!1), k("panel:closed");
|
|
4067
|
+
}
|
|
4068
|
+
function u() {
|
|
4069
|
+
const $ = !r.getState().isPanelOpen;
|
|
4070
|
+
r.clearActiveArtifact(), r.setPanelOpen($), $ || r.setFullscreen(!1), k("panel:toggled", { isOpen: $ });
|
|
4071
|
+
}
|
|
4072
|
+
function f() {
|
|
4073
|
+
const $ = !r.getState().isFullscreen;
|
|
4074
|
+
r.setFullscreen($), k("fullscreen:toggled", { isFullscreen: $ });
|
|
4075
|
+
}
|
|
4076
|
+
function y($) {
|
|
4077
|
+
r.setViewMode($), k("viewMode:changed", { mode: $ });
|
|
4078
|
+
}
|
|
4079
|
+
function d($, C = {}) {
|
|
4080
|
+
if (!$) return null;
|
|
4081
|
+
const { type: R, language: D } = $, I = {
|
|
4082
|
+
theme: C.theme || s.resolved
|
|
4083
|
+
}, H = s.colors;
|
|
4084
|
+
H != null && H.primary && (I.accent = H.primary);
|
|
4085
|
+
let ge = i.resolve(R, I);
|
|
4086
|
+
return !ge && D && (ge = i.resolve(D, I)), ge;
|
|
4087
|
+
}
|
|
4088
|
+
function b($) {
|
|
4089
|
+
return $ ? i.has($.type) || i.has($.language) : !1;
|
|
4090
|
+
}
|
|
4091
|
+
function h($, C) {
|
|
4092
|
+
i.register($, C);
|
|
4093
|
+
}
|
|
4094
|
+
function w($) {
|
|
4095
|
+
i.unregister($);
|
|
4096
|
+
}
|
|
4097
|
+
function g() {
|
|
4098
|
+
return i.getTypes();
|
|
4099
|
+
}
|
|
4100
|
+
function p($, C) {
|
|
4101
|
+
a.send($, C);
|
|
4102
|
+
}
|
|
4103
|
+
const v = /* @__PURE__ */ new Map();
|
|
4104
|
+
function m($, C) {
|
|
4105
|
+
return v.has($) || v.set($, /* @__PURE__ */ new Set()), v.get($).add(C), () => {
|
|
4106
|
+
var R;
|
|
4107
|
+
(R = v.get($)) == null || R.delete(C);
|
|
4108
|
+
};
|
|
4109
|
+
}
|
|
4110
|
+
function x($, C) {
|
|
4111
|
+
var R;
|
|
4112
|
+
(R = v.get($)) == null || R.delete(C);
|
|
4113
|
+
}
|
|
4114
|
+
function k($, C) {
|
|
4115
|
+
var R;
|
|
4116
|
+
(R = v.get($)) == null || R.forEach((D) => {
|
|
4117
|
+
try {
|
|
4118
|
+
D(C);
|
|
4119
|
+
} catch (I) {
|
|
4120
|
+
console.error(`Artifactuse event handler error (${$}):`, I);
|
|
4121
|
+
}
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
a.on("ai:request", ($) => k("ai:request", $)), a.on("save:request", ($) => k("save:request", $)), a.on("export:complete", ($) => k("export:complete", $)), a.on("form:submit", ($) => k("form:submit", $)), a.on("form:cancel", ($) => k("form:cancel", $)), a.on("form:step", ($) => k("form:step", $)), a.on("social:copy", ($) => k("social:copy", $));
|
|
4125
|
+
function A() {
|
|
4126
|
+
s.apply();
|
|
4127
|
+
}
|
|
4128
|
+
function z($) {
|
|
4129
|
+
s.set($);
|
|
4130
|
+
}
|
|
4131
|
+
function M() {
|
|
4132
|
+
return s.resolved;
|
|
4133
|
+
}
|
|
4134
|
+
function P() {
|
|
4135
|
+
a.destroy(), v.clear(), r.clear(), Za();
|
|
4136
|
+
}
|
|
4137
|
+
return {
|
|
4138
|
+
// Config
|
|
4139
|
+
config: t,
|
|
4140
|
+
// State
|
|
4141
|
+
state: r,
|
|
4142
|
+
getState: () => r.getState(),
|
|
4143
|
+
subscribe: r.subscribe,
|
|
4144
|
+
// Processing
|
|
4145
|
+
processMessage: o,
|
|
4146
|
+
initializeContent: n,
|
|
4147
|
+
// Panel control
|
|
4148
|
+
openArtifact: l,
|
|
4149
|
+
closePanel: c,
|
|
4150
|
+
togglePanel: u,
|
|
4151
|
+
toggleFullscreen: f,
|
|
4152
|
+
setViewMode: y,
|
|
4153
|
+
getPanelUrl: d,
|
|
4154
|
+
sendToPanel: p,
|
|
4155
|
+
// Panel management (new)
|
|
4156
|
+
hasPanel: b,
|
|
4157
|
+
registerPanel: h,
|
|
4158
|
+
unregisterPanel: w,
|
|
4159
|
+
getPanelTypes: g,
|
|
4160
|
+
panelResolver: i,
|
|
4161
|
+
// Expose for advanced use
|
|
4162
|
+
// Theme
|
|
4163
|
+
theme: s,
|
|
4164
|
+
applyTheme: A,
|
|
4165
|
+
setTheme: z,
|
|
4166
|
+
getTheme: M,
|
|
4167
|
+
// Events
|
|
4168
|
+
on: m,
|
|
4169
|
+
off: x,
|
|
4170
|
+
emit: k,
|
|
4171
|
+
// Bridge (for advanced use)
|
|
4172
|
+
bridge: a,
|
|
4173
|
+
// Cleanup
|
|
4174
|
+
destroy: P
|
|
4175
|
+
};
|
|
4176
|
+
}
|
|
4177
|
+
function hr(e, t) {
|
|
4178
|
+
const r = { ...e };
|
|
4179
|
+
for (const a in t)
|
|
4180
|
+
t[a] !== void 0 && t[a] !== null && (typeof t[a] == "object" && !Array.isArray(t[a]) ? r[a] = hr(e[a] || {}, t[a]) : r[a] = t[a]);
|
|
4181
|
+
return r;
|
|
4182
|
+
}
|
|
4183
|
+
export {
|
|
4184
|
+
wt as $,
|
|
4185
|
+
Le as A,
|
|
4186
|
+
_e as B,
|
|
4187
|
+
_a as C,
|
|
4188
|
+
fs as D,
|
|
4189
|
+
Je as E,
|
|
4190
|
+
Ye as F,
|
|
4191
|
+
E as G,
|
|
4192
|
+
et as H,
|
|
4193
|
+
Ma as I,
|
|
4194
|
+
Za as J,
|
|
4195
|
+
qa as K,
|
|
4196
|
+
V as L,
|
|
4197
|
+
Ce as M,
|
|
4198
|
+
ot as N,
|
|
4199
|
+
Ha as O,
|
|
4200
|
+
ct as P,
|
|
4201
|
+
lt as Q,
|
|
4202
|
+
ut as R,
|
|
4203
|
+
pt as S,
|
|
4204
|
+
dt as T,
|
|
4205
|
+
ft as U,
|
|
4206
|
+
ht as V,
|
|
4207
|
+
gt as W,
|
|
4208
|
+
ja as X,
|
|
4209
|
+
mt as Y,
|
|
4210
|
+
Da as Z,
|
|
4211
|
+
G as _,
|
|
4212
|
+
bs as a,
|
|
4213
|
+
Va as a0,
|
|
4214
|
+
bt as a1,
|
|
4215
|
+
Oa as a2,
|
|
4216
|
+
vt as a3,
|
|
4217
|
+
yt as a4,
|
|
4218
|
+
kt as a5,
|
|
4219
|
+
xt as a6,
|
|
4220
|
+
$t as a7,
|
|
4221
|
+
Rt as a8,
|
|
4222
|
+
Fa as a9,
|
|
4223
|
+
Rs as aA,
|
|
4224
|
+
As as aB,
|
|
4225
|
+
zs as aC,
|
|
4226
|
+
Ka as aD,
|
|
4227
|
+
Ja as aE,
|
|
4228
|
+
es as aF,
|
|
4229
|
+
ts as aG,
|
|
4230
|
+
rs as aH,
|
|
4231
|
+
as as aI,
|
|
4232
|
+
ss as aJ,
|
|
4233
|
+
is as aK,
|
|
4234
|
+
ur as aL,
|
|
4235
|
+
Y as aM,
|
|
4236
|
+
dr as aN,
|
|
4237
|
+
us as aO,
|
|
4238
|
+
Ss as aP,
|
|
4239
|
+
Ls as aQ,
|
|
4240
|
+
_s as aR,
|
|
4241
|
+
Cs as aS,
|
|
4242
|
+
Ms as aT,
|
|
4243
|
+
fr as aU,
|
|
4244
|
+
Ts as aV,
|
|
4245
|
+
Es as aW,
|
|
4246
|
+
ps as aX,
|
|
4247
|
+
Ps as aY,
|
|
4248
|
+
Is as aZ,
|
|
4249
|
+
At as aa,
|
|
4250
|
+
zt as ab,
|
|
4251
|
+
St as ac,
|
|
4252
|
+
Lt as ad,
|
|
4253
|
+
Na as ae,
|
|
4254
|
+
_t as af,
|
|
4255
|
+
Ct as ag,
|
|
4256
|
+
Mt as ah,
|
|
4257
|
+
Tt as ai,
|
|
4258
|
+
Et as aj,
|
|
4259
|
+
Pt as ak,
|
|
4260
|
+
Ua as al,
|
|
4261
|
+
It as am,
|
|
4262
|
+
Zt as an,
|
|
4263
|
+
qt as ao,
|
|
4264
|
+
Ht as ap,
|
|
4265
|
+
jt as aq,
|
|
4266
|
+
Dt as ar,
|
|
4267
|
+
Vt as as,
|
|
4268
|
+
nr as at,
|
|
4269
|
+
Xa as au,
|
|
4270
|
+
lr as av,
|
|
4271
|
+
Qa as aw,
|
|
4272
|
+
ks as ax,
|
|
4273
|
+
xs as ay,
|
|
4274
|
+
$s as az,
|
|
4275
|
+
ws as b,
|
|
4276
|
+
Zs as c,
|
|
4277
|
+
Ar as d,
|
|
4278
|
+
Sr as e,
|
|
4279
|
+
vs as f,
|
|
4280
|
+
yr as g,
|
|
4281
|
+
Lr as h,
|
|
4282
|
+
re as i,
|
|
4283
|
+
_r as j,
|
|
4284
|
+
Tr as k,
|
|
4285
|
+
wa as l,
|
|
4286
|
+
ba as m,
|
|
4287
|
+
ve as n,
|
|
4288
|
+
Ke as o,
|
|
4289
|
+
ys as p,
|
|
4290
|
+
xa as q,
|
|
4291
|
+
Re as r,
|
|
4292
|
+
va as s,
|
|
4293
|
+
ka as t,
|
|
4294
|
+
Ae as u,
|
|
4295
|
+
za as v,
|
|
4296
|
+
Sa as w,
|
|
4297
|
+
Ra as x,
|
|
4298
|
+
ze as y,
|
|
4299
|
+
Se as z
|
|
4300
|
+
};
|