@commentkit/comment-kit 1.6.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +298 -590
- package/README.md +421 -145
- package/SECURITY.md +47 -46
- package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
- package/dist/node/browser.js +17 -0
- package/dist/node/cli/api.js +226 -0
- package/dist/node/cli/bin.js +18 -0
- package/dist/node/cli/credentials.js +268 -0
- package/dist/node/cli/doctor.js +789 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +686 -0
- package/dist/node/cli/main.js +537 -0
- package/dist/node/cli/mcp.js +295 -0
- package/dist/node/cli/open.js +20 -0
- package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
- package/dist/node/plugins/astro.js +26 -0
- package/dist/node/plugins/git-BIXLbL3f.js +92 -0
- package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
- package/dist/node/plugins/next.js +48 -0
- package/dist/node/plugins/options-THop1K92.js +71 -0
- package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
- package/dist/node/plugins/vite-BdAYUW10.js +74 -0
- package/dist/node/plugins/vite.js +1 -0
- package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
- package/dist/node/plugins/webpack-loader.cjs +21 -0
- package/dist/node/plugins/webpack-loader.js +18 -0
- package/dist/node/plugins/webpack.js +1 -0
- package/dist/node/shared/dashboard-places.js +33 -0
- package/dist/node/shared/endpoint.js +26 -0
- package/dist/node/shared/format.js +63 -0
- package/dist/node/types/astro.d.ts +11 -0
- package/dist/node/types/next.d.ts +34 -0
- package/dist/node/types/options.d.ts +59 -0
- package/dist/node/types/vite.d.ts +11 -0
- package/dist/node/types/webpack-loader.d.ts +22 -0
- package/dist/node/types/webpack.d.ts +27 -0
- package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
- package/dist/npm/chunks/AgentSend-DOy3jhyF.js +68 -0
- package/dist/npm/chunks/Checklist-CW_SwMpS.js +282 -0
- package/dist/npm/chunks/Composer-Bveq5QrK.js +727 -0
- package/dist/npm/chunks/Guest-7hcN765o.js +270 -0
- package/dist/npm/chunks/MarkupEditor-6bJGpWGO.js +345 -0
- package/dist/npm/chunks/Panel-ChPUB68C.js +1211 -0
- package/dist/npm/chunks/Settings-CB5eEKnf.js +231 -0
- package/dist/npm/chunks/Shortcuts-eAyjJ89P.js +62 -0
- package/dist/npm/chunks/StyleEditor-CZTdAA5c.js +46 -0
- package/dist/npm/chunks/StylePanel-B4pHQUL9.js +199 -0
- package/dist/npm/chunks/TaskFields-C8BX0Sgg.js +289 -0
- package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +1160 -0
- package/dist/npm/chunks/Viewer-DY6zb90M.js +114 -0
- package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-MTQHr9ei.js} +9 -9
- package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
- package/dist/npm/chunks/{ar-8tPch6W4.js → ar-L5cQ-NPe.js} +71 -19
- package/dist/npm/chunks/card-bits-CTdrkYn8.js +53 -0
- package/dist/npm/chunks/{client-EFTWxHbJ.js → client-7eVxvg5j.js} +282 -290
- package/dist/npm/chunks/confetti-BIs5s14P.js +49 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/context-Cf6khm7A.js +20 -0
- package/dist/npm/chunks/{de-C63897uD.js → de-D0C-v6tP.js} +62 -18
- package/dist/npm/chunks/dialog-DvdIkCW0.js +3 -0
- package/dist/npm/chunks/dpop-0A76OPa9.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-CI2bSpvB.js → es-Bw4Dj9tN.js} +62 -18
- package/dist/npm/chunks/extension-DFVOvciD.js +62 -0
- package/dist/npm/chunks/{extension-BST6LH1q.js → extension-SmoH5AA4.js} +20 -12
- package/dist/npm/chunks/files-4lV9YQIX.js +114 -0
- package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-TkuQaIAa.js} +120 -76
- package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-DXSH2U8d.js} +63 -19
- package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-aVSu9TcJ.js} +136 -92
- package/dist/npm/chunks/identify-BGYh2dVo.js +106 -0
- package/dist/npm/chunks/{it-C8tnV0BF.js → it-CiWA_bch.js} +81 -37
- package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-C-QmR3yz.js} +60 -16
- package/dist/npm/chunks/late-words-80_VWt8S.js +14 -0
- package/dist/npm/chunks/live-BExWHzQ7.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-CEmZRqjX.js} +63 -19
- package/dist/npm/chunks/page-key-HSY3Lze5.js +62 -0
- package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-B3sR7jtS.js} +45 -44
- package/dist/npm/chunks/pkce-CfZhiNBi.js +8 -0
- package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
- package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
- package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-b-a8sxO8.js} +62 -18
- package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
- package/dist/npm/chunks/report-DaVuoRYS.js +44 -0
- package/dist/npm/chunks/show-BoN8AC-F.js +97 -0
- package/dist/npm/chunks/signin-BOWr_WCo.js +75 -0
- package/dist/npm/chunks/{source-CS7C6wJA.js → source-mk3rGBBQ.js} +1 -1
- package/dist/npm/chunks/src-C8rZFyL_.js +215 -0
- package/dist/npm/chunks/start-CV4j78_q.js +1894 -0
- package/dist/npm/chunks/states-b9Bv3Ci7.js +3 -0
- package/dist/npm/chunks/upload-B2mkgMeJ.js +42 -0
- package/dist/npm/chunks/uploads-8AxyRq7g.js +1147 -0
- package/dist/npm/chunks/wrap-DW6EFbVQ.js +69 -0
- package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-JTscW8u8.js} +61 -17
- package/dist/npm/element.js +58 -21
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +18 -11
- package/dist/npm/svelte.js +28 -12
- package/dist/npm/types/adapters/react.d.ts +4 -1
- package/dist/npm/types/adapters/svelte.d.ts +4 -1
- package/dist/npm/types/adapters/vue.d.ts +35 -2
- package/dist/npm/types/anchor/index.d.ts +19 -0
- package/dist/npm/types/capture/privacy.d.ts +14 -0
- package/dist/npm/types/core/api.d.ts +20 -1
- package/dist/npm/types/core/auth.d.ts +40 -21
- package/dist/npm/types/core/client.d.ts +60 -4
- package/dist/npm/types/core/page-key.d.ts +42 -0
- package/dist/npm/types/core/types.d.ts +87 -4
- package/dist/npm/types/element.d.ts +17 -7
- package/dist/npm/types/headless.d.ts +2 -1
- package/dist/npm/types/index.d.ts +16 -6
- package/dist/npm/vue.js +44 -9
- package/package.json +90 -14
- package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
- package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
- package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
- package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
- package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
- package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
- package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
- package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
- package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
- package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
- package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
- package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
- package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
- package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
- package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
- package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
- package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
- package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
- package/dist/npm/chunks/report-BBrT3r89.js +0 -27
- package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
- package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
- package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
- package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
import { l as e, n as t, o as n } from "./options-THop1K92.js";
|
|
2
|
+
import { createRequire as r } from "node:module";
|
|
3
|
+
import { dirname as i, join as a } from "node:path";
|
|
4
|
+
import { pathToFileURL as o } from "node:url";
|
|
5
|
+
// plugins/peers.ts
|
|
6
|
+
var s = /* @__PURE__ */ new Map();
|
|
7
|
+
function c(e, t) {
|
|
8
|
+
try {
|
|
9
|
+
return r(a(e, "noop.js")).resolve(t);
|
|
10
|
+
} catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function l(e, t, n) {
|
|
15
|
+
let r = `${t}\0${e.join(",")}\0${n ?? ""}`, a = s.get(r);
|
|
16
|
+
return a || (a = (async () => {
|
|
17
|
+
for (let r of e) {
|
|
18
|
+
let e = c(t, r);
|
|
19
|
+
if (!e && n) {
|
|
20
|
+
let a = c(t, `${n}/package.json`);
|
|
21
|
+
a && (e = c(i(a), r));
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return await (e ? import(o(e).href) : import(r));
|
|
25
|
+
} catch {}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
})(), s.set(r, a)), a;
|
|
29
|
+
}
|
|
30
|
+
// node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
31
|
+
var u = 44, d = 59, f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", p = /* @__PURE__ */ new Uint8Array(64), m = /* @__PURE__ */ new Uint8Array(128);
|
|
32
|
+
for (let e = 0; e < f.length; e++) {
|
|
33
|
+
let t = f.charCodeAt(e);
|
|
34
|
+
p[e] = t, m[t] = e;
|
|
35
|
+
}
|
|
36
|
+
function h(e, t) {
|
|
37
|
+
do {
|
|
38
|
+
let n = t & 31;
|
|
39
|
+
t >>>= 5, t > 0 && (n |= 32), e.write(p[n]);
|
|
40
|
+
} while (t > 0);
|
|
41
|
+
}
|
|
42
|
+
function g(e) {
|
|
43
|
+
return e < 0 ? -e << 1 | 1 : e << 1;
|
|
44
|
+
}
|
|
45
|
+
var _ = 16384, v = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? { decode(e) {
|
|
46
|
+
return Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString();
|
|
47
|
+
} } : { decode(e) {
|
|
48
|
+
let t = "";
|
|
49
|
+
for (let n = 0; n < e.length; n++) t += String.fromCharCode(e[n]);
|
|
50
|
+
return t;
|
|
51
|
+
} }, y = class {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.pos = 0, this.out = "", this.buffer = new Uint8Array(_);
|
|
54
|
+
}
|
|
55
|
+
write(e) {
|
|
56
|
+
let { buffer: t } = this;
|
|
57
|
+
t[this.pos++] = e, this.pos === _ && (this.out += v.decode(t), this.pos = 0);
|
|
58
|
+
}
|
|
59
|
+
flush() {
|
|
60
|
+
let { buffer: e, out: t, pos: n } = this;
|
|
61
|
+
return n > 0 ? t + v.decode(e.subarray(0, n)) : t;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function b(e) {
|
|
65
|
+
if (e.length === 0) return "";
|
|
66
|
+
let t = new y();
|
|
67
|
+
for (let n = 0; n < e.length; n++) {
|
|
68
|
+
let r = e[n];
|
|
69
|
+
n > 0 && t.write(d);
|
|
70
|
+
let i = 0;
|
|
71
|
+
for (let e = 0; e < r.length; e++) {
|
|
72
|
+
let n = r[e];
|
|
73
|
+
h(t, n - i), i = n;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return t.flush();
|
|
77
|
+
}
|
|
78
|
+
function x(e) {
|
|
79
|
+
let t = new y(), n = 0, r = 0, i = 0, a = 0;
|
|
80
|
+
for (let o = 0; o < e.length; o++) {
|
|
81
|
+
let s = e[o];
|
|
82
|
+
if (o > 0 && t.write(d), s.length === 0) continue;
|
|
83
|
+
let c = 0;
|
|
84
|
+
for (let e = 0; e < s.length; e++) {
|
|
85
|
+
let o = s[e];
|
|
86
|
+
e > 0 && t.write(u), h(t, g(o[0] - c)), c = o[0], o.length !== 1 && (h(t, g(o[1] - n)), h(t, g(o[2] - r)), h(t, g(o[3] - i)), n = o[1], r = o[2], i = o[3], o.length !== 4 && (h(t, g(o[4] - a)), a = o[4]));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return t.flush();
|
|
90
|
+
}
|
|
91
|
+
// node_modules/magic-string/dist/index.mjs
|
|
92
|
+
var S = class e {
|
|
93
|
+
constructor(t) {
|
|
94
|
+
this.bits = t instanceof e ? t.bits.slice() : [];
|
|
95
|
+
}
|
|
96
|
+
add(e) {
|
|
97
|
+
this.bits[e >> 5] |= 1 << (e & 31);
|
|
98
|
+
}
|
|
99
|
+
has(e) {
|
|
100
|
+
return !!(this.bits[e >> 5] & 1 << (e & 31));
|
|
101
|
+
}
|
|
102
|
+
forEach(e) {
|
|
103
|
+
let t = this.bits;
|
|
104
|
+
for (let n = 0; n < t.length; n++) {
|
|
105
|
+
let r = t[n];
|
|
106
|
+
for (; r;) {
|
|
107
|
+
let t = r & -r;
|
|
108
|
+
e((n << 5) + 31 - Math.clz32(t)), r ^= t;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, C = class e {
|
|
113
|
+
constructor(e, t, n) {
|
|
114
|
+
this.start = e, this.end = t, this.original = n, this.intro = "", this.outro = "", this.content = n, this.storeName = !1, this.edited = !1, this.replacesUntil = -1, this.replacedFrom = -1, this.previous = null, this.next = null;
|
|
115
|
+
}
|
|
116
|
+
appendLeft(e) {
|
|
117
|
+
this.outro += e;
|
|
118
|
+
}
|
|
119
|
+
appendRight(e) {
|
|
120
|
+
this.intro += e;
|
|
121
|
+
}
|
|
122
|
+
clone() {
|
|
123
|
+
let t = new e(this.start, this.end, this.original);
|
|
124
|
+
return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t.replacesUntil = this.replacesUntil, t.replacedFrom = this.replacedFrom, t;
|
|
125
|
+
}
|
|
126
|
+
contains(e) {
|
|
127
|
+
return this.start < e && e < this.end;
|
|
128
|
+
}
|
|
129
|
+
eachNext(e) {
|
|
130
|
+
e(this);
|
|
131
|
+
let t = this.next;
|
|
132
|
+
for (; t;) e(t), t = t.next;
|
|
133
|
+
}
|
|
134
|
+
eachPrevious(e) {
|
|
135
|
+
e(this);
|
|
136
|
+
let t = this.previous;
|
|
137
|
+
for (; t;) e(t), t = t.previous;
|
|
138
|
+
}
|
|
139
|
+
edit(e, t, n) {
|
|
140
|
+
return this.content = e, n || (this.intro = "", this.outro = ""), this.storeName = t, this.edited = !0, this;
|
|
141
|
+
}
|
|
142
|
+
prependLeft(e) {
|
|
143
|
+
this.outro = e + this.outro;
|
|
144
|
+
}
|
|
145
|
+
prependRight(e) {
|
|
146
|
+
this.intro = e + this.intro;
|
|
147
|
+
}
|
|
148
|
+
reset() {
|
|
149
|
+
this.intro = "", this.outro = "", this.replacesUntil = -1, this.replacedFrom = -1, this.edited &&= (this.content = this.original, this.storeName = !1, !1);
|
|
150
|
+
}
|
|
151
|
+
split(t) {
|
|
152
|
+
let n = t - this.start, r = this.original.slice(0, n), i = this.original.slice(n);
|
|
153
|
+
this.original = r;
|
|
154
|
+
let a = new e(t, this.end, i);
|
|
155
|
+
return a.outro = this.outro, this.outro = "", this.end = t, this.edited ? (a.edit("", !1, !0), a.replacedFrom = this.replacedFrom) : this.content = r, a.next = this.next, a.next && (a.next.previous = a), a.previous = this, this.next = a, a;
|
|
156
|
+
}
|
|
157
|
+
toString() {
|
|
158
|
+
return this.intro + this.content + this.outro;
|
|
159
|
+
}
|
|
160
|
+
trimEnd(e) {
|
|
161
|
+
if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
|
|
162
|
+
let t = this.content.replace(e, "");
|
|
163
|
+
if (t.length) return t !== this.content && (this.edited ? this.edit(t, this.storeName, !0) : this.split(this.start + t.length).edit("", void 0, !0)), !0;
|
|
164
|
+
if (this.edit("", void 0, !0), this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
|
|
165
|
+
}
|
|
166
|
+
trimStart(e) {
|
|
167
|
+
if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
|
|
168
|
+
let t = this.content.replace(e, "");
|
|
169
|
+
if (t.length) return t !== this.content && (this.edited ? this.edit(t, this.storeName, !0) : (this.split(this.end - t.length), this.edit("", void 0, !0))), !0;
|
|
170
|
+
if (this.edit("", void 0, !0), this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
|
|
171
|
+
}
|
|
172
|
+
}, w = class extends Error {
|
|
173
|
+
name = "MagicStringError";
|
|
174
|
+
constructor(e, t) {
|
|
175
|
+
super(`[MagicString] ${e}`, t);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
function T() {
|
|
179
|
+
/* v8 ignore next -- environment fallback, unreachable when `btoa` is present */
|
|
180
|
+
if (typeof globalThis < "u" && typeof globalThis.btoa == "function") return (e) => globalThis.btoa(unescape(encodeURIComponent(e)));
|
|
181
|
+
let e = globalThis.Buffer;
|
|
182
|
+
return e ? (t) => e.from(t, "utf-8").toString("base64") : () => {
|
|
183
|
+
throw new w("unsupported environment: `btoa` or `Buffer` is required");
|
|
184
|
+
};
|
|
185
|
+
/* v8 ignore stop */
|
|
186
|
+
}
|
|
187
|
+
var E = /* #__PURE__ */ T(), D = class {
|
|
188
|
+
constructor(e) {
|
|
189
|
+
if (this.version = 3, this.file = e.file, this.sources = e.sources, this.sourcesContent = e.sourcesContent, this.names = e.names, this.mappings = typeof e.mappings == "string" ? e.mappings : x(e.mappings), e.x_google_ignoreList !== void 0 && (this.x_google_ignoreList = e.x_google_ignoreList), e.debugId !== void 0 && (this.debugId = e.debugId), e.rangeMappings !== void 0) {
|
|
190
|
+
let t = !1;
|
|
191
|
+
for (let n of e.rangeMappings) if (n.length !== 0) {
|
|
192
|
+
t = !0;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
t && (this.rangeMappings = b(e.rangeMappings));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
toString() {
|
|
199
|
+
return JSON.stringify(this);
|
|
200
|
+
}
|
|
201
|
+
toUrl() {
|
|
202
|
+
return `data:application/json;charset=utf-8;base64,${E(this.toString())}`;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
function O(e) {
|
|
206
|
+
let t = [0];
|
|
207
|
+
for (let n = e.indexOf("\n"); n !== -1; n = e.indexOf("\n", n + 1)) t.push(n + 1);
|
|
208
|
+
return function(e) {
|
|
209
|
+
let n = 0, r = t.length;
|
|
210
|
+
for (; n < r;) {
|
|
211
|
+
let i = n + r >> 1;
|
|
212
|
+
e < t[i] ? r = i : n = i + 1;
|
|
213
|
+
}
|
|
214
|
+
let i = n - 1;
|
|
215
|
+
return {
|
|
216
|
+
line: i,
|
|
217
|
+
column: e - t[i]
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function k(e, t) {
|
|
222
|
+
let n = e.split(/[/\\]/), r = t.split(/[/\\]/);
|
|
223
|
+
for (n.pop(); n[0] === r[0];) n.shift(), r.shift();
|
|
224
|
+
if (n.length) {
|
|
225
|
+
let e = n.length;
|
|
226
|
+
for (; e--;) n[e] = "..";
|
|
227
|
+
}
|
|
228
|
+
return n.concat(r).join("/");
|
|
229
|
+
}
|
|
230
|
+
function A(e) {
|
|
231
|
+
let t = e.split("\n"), n = t.filter((e) => /^\t+/.test(e)), r = t.filter((e) => /^ {2,}/.test(e));
|
|
232
|
+
if (n.length === 0 && r.length === 0) return null;
|
|
233
|
+
if (n.length >= r.length) return " ";
|
|
234
|
+
let i = r.reduce((e, t) => {
|
|
235
|
+
let n = /^ +/.exec(t)[0].length;
|
|
236
|
+
return Math.min(n, e);
|
|
237
|
+
}, Infinity);
|
|
238
|
+
return " ".repeat(i);
|
|
239
|
+
}
|
|
240
|
+
var j = Object.prototype.toString;
|
|
241
|
+
function ee(e) {
|
|
242
|
+
return j.call(e) === "[object Object]";
|
|
243
|
+
}
|
|
244
|
+
var te = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ne = /* #__PURE__ */ (() => {
|
|
245
|
+
let e = /* @__PURE__ */ new Uint8Array(64);
|
|
246
|
+
for (let t = 0; t < 64; t++) e[t] = te.charCodeAt(t);
|
|
247
|
+
return e;
|
|
248
|
+
})(), re = 44, ie = 59, ae = 16384, M = 16348, N = /* #__PURE__ */ new Uint8Array(ae);
|
|
249
|
+
function P(e, t) {
|
|
250
|
+
t = t < 0 ? -t << 1 | 1 : t << 1;
|
|
251
|
+
do {
|
|
252
|
+
let n = t & 31;
|
|
253
|
+
t >>>= 5, t > 0 && (n |= 32), N[e++] = ne[n];
|
|
254
|
+
} while (t > 0);
|
|
255
|
+
return e;
|
|
256
|
+
}
|
|
257
|
+
var F = /* #__PURE__ */ new TextDecoder(), I = class {
|
|
258
|
+
constructor() {
|
|
259
|
+
this.out = "", this.pos = 0, this.lines = [], this.buffered = 0, this.needsComma = !1, this.prevGenColumn = 0, this.prevSourceIndex = 0, this.prevSourceLine = 0, this.prevSourceColumn = 0, this.prevNameIndex = 0;
|
|
260
|
+
}
|
|
261
|
+
endLine(e) {
|
|
262
|
+
this.lines.push(e), this.buffered += e.length + 1, this.buffered >= 4096 && this.drain(null);
|
|
263
|
+
}
|
|
264
|
+
segments(e) {
|
|
265
|
+
this.drain(e);
|
|
266
|
+
}
|
|
267
|
+
finish(e) {
|
|
268
|
+
return this.drain(e), this.flush(), this.out;
|
|
269
|
+
}
|
|
270
|
+
drain(e) {
|
|
271
|
+
let t = this.lines, n = t.length;
|
|
272
|
+
for (let r = 0; r <= n; r++) {
|
|
273
|
+
let i = r < n ? t[r] : e;
|
|
274
|
+
if (i === null) break;
|
|
275
|
+
for (let e = 0; e < i.length; e++) {
|
|
276
|
+
this.pos > M && this.flush();
|
|
277
|
+
let t = i[e];
|
|
278
|
+
this.needsComma && (N[this.pos++] = re), this.needsComma = !0, this.pos = P(this.pos, t[0] - this.prevGenColumn), this.prevGenColumn = t[0], this.pos = P(this.pos, t[1] - this.prevSourceIndex), this.prevSourceIndex = t[1], this.pos = P(this.pos, t[2] - this.prevSourceLine), this.prevSourceLine = t[2], this.pos = P(this.pos, t[3] - this.prevSourceColumn), this.prevSourceColumn = t[3], t.length === 5 && (this.pos = P(this.pos, t[4] - this.prevNameIndex), this.prevNameIndex = t[4]);
|
|
279
|
+
}
|
|
280
|
+
r < n && (this.pos > M && this.flush(), N[this.pos++] = ie, this.needsComma = !1, this.prevGenColumn = 0);
|
|
281
|
+
}
|
|
282
|
+
t.length = 0, this.buffered = 0, this.flush();
|
|
283
|
+
}
|
|
284
|
+
flush() {
|
|
285
|
+
this.out += F.decode(N.subarray(0, this.pos)), this.pos = 0;
|
|
286
|
+
}
|
|
287
|
+
}, L = 10;
|
|
288
|
+
function R(e) {
|
|
289
|
+
return e >= 97 && e <= 122 || e >= 65 && e <= 90 || e >= 48 && e <= 57 || e === 95;
|
|
290
|
+
}
|
|
291
|
+
var z = class {
|
|
292
|
+
constructor(e, t = null) {
|
|
293
|
+
this.hires = e, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.rawRangeMappingsIndices = [], this.rawRangeMappings = e === "experimental-range" ? [this.rawRangeMappingsIndices] : void 0, this.encoder = t;
|
|
294
|
+
}
|
|
295
|
+
nextLine() {
|
|
296
|
+
this.encoder === null ? (this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = []) : (this.encoder.endLine(this.rawSegments), this.rawSegments = [], this.generatedCodeLine += 1), this.generatedCodeColumn = 0, this.rawRangeMappings && (this.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = []);
|
|
297
|
+
}
|
|
298
|
+
addMagicString(e, t, n) {
|
|
299
|
+
let { original: r } = e, i = O(r);
|
|
300
|
+
e.intro && this.advance(e.intro), e.firstChunk.eachNext((a) => {
|
|
301
|
+
if (a.intro.length && this.advance(a.intro), t === -1) this.advance(a.content);
|
|
302
|
+
else if (a.edited) {
|
|
303
|
+
let e = a.storeName ? n.get(r.slice(a.start, a.replacesUntil)) : void 0;
|
|
304
|
+
this.addEdit(t, a.content, i(a.start), e ?? -1);
|
|
305
|
+
} else this.addUneditedChunk(t, a, r, i(a.start), e.sourcemapLocations);
|
|
306
|
+
a.outro.length && this.advance(a.outro);
|
|
307
|
+
}), e.outro && this.advance(e.outro);
|
|
308
|
+
}
|
|
309
|
+
addEdit(e, t, n, r) {
|
|
310
|
+
if (t.length) {
|
|
311
|
+
let i = t.length - 1, a = t.indexOf("\n", 0), o = -1;
|
|
312
|
+
for (; a >= 0 && i > a;) {
|
|
313
|
+
let i = [
|
|
314
|
+
this.generatedCodeColumn,
|
|
315
|
+
e,
|
|
316
|
+
n.line,
|
|
317
|
+
n.column
|
|
318
|
+
];
|
|
319
|
+
r >= 0 && i.push(r), this.rawSegments.push(i), this.nextLine(), o = a, a = t.indexOf("\n", a + 1);
|
|
320
|
+
}
|
|
321
|
+
let s = [
|
|
322
|
+
this.generatedCodeColumn,
|
|
323
|
+
e,
|
|
324
|
+
n.line,
|
|
325
|
+
n.column
|
|
326
|
+
];
|
|
327
|
+
r >= 0 && s.push(r), this.rawSegments.push(s), this.advance(t.slice(o + 1));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
addUneditedChunk(e, t, n, r, i) {
|
|
331
|
+
let a = t.end, o = t.start;
|
|
332
|
+
if (this.hires) {
|
|
333
|
+
let i = this.hires === "boundary", s = this.hires === "experimental-range", c = s ? null : this.encoder, l = !1;
|
|
334
|
+
for (; o < a;) {
|
|
335
|
+
c !== null && this.rawSegments.length >= 4096 && (c.segments(this.rawSegments), this.rawSegments.length = 0), s && o + 1 >= a && this.rawSegments.push([
|
|
336
|
+
this.generatedCodeColumn,
|
|
337
|
+
e,
|
|
338
|
+
r.line,
|
|
339
|
+
r.column
|
|
340
|
+
]);
|
|
341
|
+
let u = n.charCodeAt(o);
|
|
342
|
+
u === L ? (r.line += 1, r.column = 0, this.nextLine(), l = !1) : (i ? R(u) ? l ||= (this.rawSegments.push([
|
|
343
|
+
this.generatedCodeColumn,
|
|
344
|
+
e,
|
|
345
|
+
r.line,
|
|
346
|
+
r.column
|
|
347
|
+
]), !0) : (this.rawSegments.push([
|
|
348
|
+
this.generatedCodeColumn,
|
|
349
|
+
e,
|
|
350
|
+
r.line,
|
|
351
|
+
r.column
|
|
352
|
+
]), l = !1) : s ? o === t.start && (this.rawRangeMappingsIndices.push(this.rawSegments.length), this.rawSegments.push([
|
|
353
|
+
this.generatedCodeColumn,
|
|
354
|
+
e,
|
|
355
|
+
r.line,
|
|
356
|
+
r.column
|
|
357
|
+
])) : this.rawSegments.push([
|
|
358
|
+
this.generatedCodeColumn,
|
|
359
|
+
e,
|
|
360
|
+
r.line,
|
|
361
|
+
r.column
|
|
362
|
+
]), r.column += 1, this.generatedCodeColumn += 1), o += 1;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
let t = i.bits;
|
|
366
|
+
for (; o < a;) {
|
|
367
|
+
let i = n.indexOf("\n", o);
|
|
368
|
+
if ((i === -1 || i > a) && (i = a), i > o) {
|
|
369
|
+
this.rawSegments.push([
|
|
370
|
+
this.generatedCodeColumn,
|
|
371
|
+
e,
|
|
372
|
+
r.line,
|
|
373
|
+
r.column
|
|
374
|
+
]);
|
|
375
|
+
for (let n = o + 1 >> 5, a = i - 1 >> 5; n <= a; n++) {
|
|
376
|
+
let a = t[n];
|
|
377
|
+
if (!a) continue;
|
|
378
|
+
let s = n << 5;
|
|
379
|
+
for (; a;) {
|
|
380
|
+
let t = a & -a, n = s + 31 - Math.clz32(t);
|
|
381
|
+
if (n > o && n < i) {
|
|
382
|
+
let t = n - o;
|
|
383
|
+
this.rawSegments.push([
|
|
384
|
+
this.generatedCodeColumn + t,
|
|
385
|
+
e,
|
|
386
|
+
r.line,
|
|
387
|
+
r.column + t
|
|
388
|
+
]);
|
|
389
|
+
}
|
|
390
|
+
a ^= t;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
r.column += i - o, this.generatedCodeColumn += i - o;
|
|
394
|
+
}
|
|
395
|
+
if (i === a) break;
|
|
396
|
+
r.line += 1, r.column = 0, this.nextLine(), o = i + 1;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
advance(e) {
|
|
401
|
+
if (!e) return;
|
|
402
|
+
let t = e.lastIndexOf("\n");
|
|
403
|
+
for (let t = e.indexOf("\n"); t !== -1; t = e.indexOf("\n", t + 1)) this.nextLine();
|
|
404
|
+
this.generatedCodeColumn += e.length - t - 1;
|
|
405
|
+
}
|
|
406
|
+
}, B = "\n", V = 10, H = 13, U = {
|
|
407
|
+
insertLeft: !1,
|
|
408
|
+
insertRight: !1,
|
|
409
|
+
storeName: !1
|
|
410
|
+
};
|
|
411
|
+
function W(e, t, n, r, i, a) {
|
|
412
|
+
if (!e.includes("$")) return e;
|
|
413
|
+
let o = "", s = 0;
|
|
414
|
+
for (; s < e.length;) {
|
|
415
|
+
let c = e.indexOf("$", s);
|
|
416
|
+
if (c === -1) {
|
|
417
|
+
o += e.slice(s);
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
o += e.slice(s, c);
|
|
421
|
+
let l = e[c + 1], u = "$", d = 1;
|
|
422
|
+
if (l === "$") d = 2;
|
|
423
|
+
else if (l === "&") u = t, d = 2;
|
|
424
|
+
else if (l === "`") u = r.slice(0, n), d = 2;
|
|
425
|
+
else if (l === "'") u = r.slice(n + t.length), d = 2;
|
|
426
|
+
else if (l === "<" && a !== void 0) {
|
|
427
|
+
let t = e.indexOf(">", c + 2);
|
|
428
|
+
t !== -1 && (u = a[e.slice(c + 2, t)] ?? "", d = t + 1 - c);
|
|
429
|
+
} else if (l >= "0" && l <= "9") {
|
|
430
|
+
let t = e[c + 2], n = t >= "0" && t <= "9" ? Number(l + t) : NaN, r = Number(l);
|
|
431
|
+
n >= 1 && n <= i.length ? (u = i[n - 1] ?? "", d = 3) : r >= 1 && r <= i.length && (u = i[r - 1] ?? "", d = 2);
|
|
432
|
+
}
|
|
433
|
+
o += u, s = c + d;
|
|
434
|
+
}
|
|
435
|
+
return o;
|
|
436
|
+
}
|
|
437
|
+
var G = class e {
|
|
438
|
+
constructor(e, t = {}) {
|
|
439
|
+
let n = new C(0, e.length, e);
|
|
440
|
+
Object.defineProperties(this, {
|
|
441
|
+
original: {
|
|
442
|
+
writable: !0,
|
|
443
|
+
value: e
|
|
444
|
+
},
|
|
445
|
+
outro: {
|
|
446
|
+
writable: !0,
|
|
447
|
+
value: ""
|
|
448
|
+
},
|
|
449
|
+
intro: {
|
|
450
|
+
writable: !0,
|
|
451
|
+
value: ""
|
|
452
|
+
},
|
|
453
|
+
firstChunk: {
|
|
454
|
+
writable: !0,
|
|
455
|
+
value: n
|
|
456
|
+
},
|
|
457
|
+
lastChunk: {
|
|
458
|
+
writable: !0,
|
|
459
|
+
value: n
|
|
460
|
+
},
|
|
461
|
+
lastSearchedChunk: {
|
|
462
|
+
writable: !0,
|
|
463
|
+
value: n
|
|
464
|
+
},
|
|
465
|
+
byStart: {
|
|
466
|
+
writable: !0,
|
|
467
|
+
value: /* @__PURE__ */ new Map([[0, n]])
|
|
468
|
+
},
|
|
469
|
+
byEnd: {
|
|
470
|
+
writable: !0,
|
|
471
|
+
value: /* @__PURE__ */ new Map([[e.length, n]])
|
|
472
|
+
},
|
|
473
|
+
filename: {
|
|
474
|
+
writable: !0,
|
|
475
|
+
value: t.filename
|
|
476
|
+
},
|
|
477
|
+
indentExclusionRanges: {
|
|
478
|
+
writable: !0,
|
|
479
|
+
value: t.indentExclusionRanges
|
|
480
|
+
},
|
|
481
|
+
sourcemapLocations: {
|
|
482
|
+
writable: !0,
|
|
483
|
+
value: new S()
|
|
484
|
+
},
|
|
485
|
+
storedNames: {
|
|
486
|
+
writable: !0,
|
|
487
|
+
value: /* @__PURE__ */ new Set()
|
|
488
|
+
},
|
|
489
|
+
indentStr: {
|
|
490
|
+
writable: !0,
|
|
491
|
+
value: void 0
|
|
492
|
+
},
|
|
493
|
+
ignoreList: {
|
|
494
|
+
writable: !0,
|
|
495
|
+
value: t.ignoreList
|
|
496
|
+
},
|
|
497
|
+
offset: {
|
|
498
|
+
writable: !0,
|
|
499
|
+
value: t.offset || 0
|
|
500
|
+
},
|
|
501
|
+
hasMovedChunks: {
|
|
502
|
+
writable: !0,
|
|
503
|
+
value: !1
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
addSourcemapLocation(e) {
|
|
508
|
+
this.sourcemapLocations.add(e);
|
|
509
|
+
}
|
|
510
|
+
append(e) {
|
|
511
|
+
if (typeof e != "string") throw new w(`content must be a string, got ${typeof e}`);
|
|
512
|
+
return this.outro += e, this;
|
|
513
|
+
}
|
|
514
|
+
appendLeft(e, t) {
|
|
515
|
+
if (e = this._resolveIndex(e), e < 0 || e > this.original.length) throw new w(`index ${e} is out of bounds`);
|
|
516
|
+
if (typeof t != "string") throw new w(`content must be a string, got ${typeof t}`);
|
|
517
|
+
this._split(e);
|
|
518
|
+
let n = this.byEnd.get(e);
|
|
519
|
+
return n ? n.appendLeft(t) : this.intro += t, this;
|
|
520
|
+
}
|
|
521
|
+
appendRight(e, t) {
|
|
522
|
+
if (e = this._resolveIndex(e), e < 0 || e > this.original.length) throw new w(`index ${e} is out of bounds`);
|
|
523
|
+
if (typeof t != "string") throw new w(`content must be a string, got ${typeof t}`);
|
|
524
|
+
this._split(e);
|
|
525
|
+
let n = this.byStart.get(e);
|
|
526
|
+
return n ? n.appendRight(t) : this.outro += t, this;
|
|
527
|
+
}
|
|
528
|
+
clone() {
|
|
529
|
+
let t = new e(this.original, {
|
|
530
|
+
filename: this.filename,
|
|
531
|
+
ignoreList: this.ignoreList,
|
|
532
|
+
offset: this.offset
|
|
533
|
+
}), n = this.firstChunk, r = t.firstChunk = t.lastSearchedChunk = n.clone();
|
|
534
|
+
for (; n;) {
|
|
535
|
+
t.byStart.set(r.start, r), t.byEnd.set(r.end, r);
|
|
536
|
+
let e = n.next, i = e && e.clone();
|
|
537
|
+
i && (r.next = i, i.previous = r, r = i), n = e;
|
|
538
|
+
}
|
|
539
|
+
return t.lastChunk = r, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new S(this.sourcemapLocations), t.storedNames = new Set(this.storedNames), t.intro = this.intro, t.outro = this.outro, t.hasMovedChunks = this.hasMovedChunks, t;
|
|
540
|
+
}
|
|
541
|
+
generateDecodedMap(e) {
|
|
542
|
+
e ||= {};
|
|
543
|
+
let t = new z(e.hires), n = this._generateMappings(t);
|
|
544
|
+
return {
|
|
545
|
+
...this._mapProperties(e, n),
|
|
546
|
+
mappings: t.raw,
|
|
547
|
+
rangeMappings: t.rawRangeMappings
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
generateMap(e) {
|
|
551
|
+
e ||= {};
|
|
552
|
+
let t = new I(), n = new z(e.hires, t), r = this._generateMappings(n);
|
|
553
|
+
return new D({
|
|
554
|
+
...this._mapProperties(e, r),
|
|
555
|
+
mappings: t.finish(n.rawSegments),
|
|
556
|
+
rangeMappings: n.rawRangeMappings
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
_generateMappings(e) {
|
|
560
|
+
let t = [...this.storedNames];
|
|
561
|
+
return e.addMagicString(this, 0, new Map(t.map((e, t) => [e, t]))), t;
|
|
562
|
+
}
|
|
563
|
+
_mapProperties(e, t) {
|
|
564
|
+
return {
|
|
565
|
+
file: e.file ? e.file.split(/[/\\]/).pop() : void 0,
|
|
566
|
+
sources: [e.source ? k(e.file || "", e.source) : e.file || ""],
|
|
567
|
+
sourcesContent: e.includeContent ? [this.original] : void 0,
|
|
568
|
+
names: t,
|
|
569
|
+
x_google_ignoreList: this.ignoreList ? [0] : void 0
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
_ensureindentStr() {
|
|
573
|
+
this.indentStr === void 0 && (this.indentStr = A(this.original));
|
|
574
|
+
}
|
|
575
|
+
_getRawIndentString() {
|
|
576
|
+
return this._ensureindentStr(), this.indentStr;
|
|
577
|
+
}
|
|
578
|
+
getIndentString() {
|
|
579
|
+
return this._ensureindentStr(), this.indentStr ?? " ";
|
|
580
|
+
}
|
|
581
|
+
indent(e, t) {
|
|
582
|
+
let n = /^[^\r\n]/gm;
|
|
583
|
+
if (ee(e) && (t = e, e = void 0), e === void 0 && (this._ensureindentStr(), e = this.indentStr || " "), e === "") return this;
|
|
584
|
+
let r = e;
|
|
585
|
+
t ||= {};
|
|
586
|
+
let i = new S();
|
|
587
|
+
t.exclude && (typeof t.exclude[0] == "number" ? [t.exclude] : t.exclude).forEach((e) => {
|
|
588
|
+
for (let t = e[0]; t < e[1]; t += 1) i.add(t);
|
|
589
|
+
});
|
|
590
|
+
let a = t.indentStart !== !1, o = (e) => {
|
|
591
|
+
if (e === "") return e;
|
|
592
|
+
let t = e.replace(n, (e, t) => t > 0 || a ? `${r}${e}` : e);
|
|
593
|
+
return a = e[e.length - 1] === "\n", t;
|
|
594
|
+
};
|
|
595
|
+
this.intro = o(this.intro);
|
|
596
|
+
let s = 0, c = this.firstChunk, l = (e) => {
|
|
597
|
+
a = !1, e === c.start ? c.appendRight(r) : (this._splitChunk(c, e), c = c.next, c.prependRight(r));
|
|
598
|
+
};
|
|
599
|
+
for (; c;) {
|
|
600
|
+
let e = c.end;
|
|
601
|
+
if (i.has(c.start) || (c.intro = o(c.intro)), c.edited) i.has(c.start) ? c.content && (a = c.content[c.content.length - 1] === "\n") : c.content = o(c.content);
|
|
602
|
+
else if (t.exclude) for (s = c.start; s < e;) {
|
|
603
|
+
if (!i.has(s)) {
|
|
604
|
+
let e = this.original.charCodeAt(s);
|
|
605
|
+
e === V ? a = !0 : e !== H && a && l(s);
|
|
606
|
+
}
|
|
607
|
+
s += 1;
|
|
608
|
+
}
|
|
609
|
+
else for (s = c.start; s < e;) {
|
|
610
|
+
if (!a) {
|
|
611
|
+
let t = this.original.indexOf(B, s);
|
|
612
|
+
if (t === -1 || t >= e) break;
|
|
613
|
+
a = !0, s = t + 1;
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
let t = this.original.charCodeAt(s);
|
|
617
|
+
t === V || t === H || l(s), s += 1;
|
|
618
|
+
}
|
|
619
|
+
i.has(c.end - 1) || (c.outro = o(c.outro)), s = c.end, c = c.next;
|
|
620
|
+
}
|
|
621
|
+
return this.outro = o(this.outro), this;
|
|
622
|
+
}
|
|
623
|
+
insert() {
|
|
624
|
+
throw new w("insert() is deprecated, use appendLeft() or prependRight()");
|
|
625
|
+
}
|
|
626
|
+
insertLeft(e, t) {
|
|
627
|
+
return U.insertLeft ||= (console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"), !0), this.appendLeft(e, t);
|
|
628
|
+
}
|
|
629
|
+
insertRight(e, t) {
|
|
630
|
+
return U.insertRight ||= (console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"), !0), this.prependRight(e, t);
|
|
631
|
+
}
|
|
632
|
+
move(e, t, n, r = "right") {
|
|
633
|
+
if (e = this._resolveIndex(e), t = this._resolveIndex(t), n = this._resolveIndex(n), e === t) return this;
|
|
634
|
+
if (e < 0 || t > this.original.length || n < 0 || n > this.original.length) throw new w(`range ${e}–${t} is out of bounds`);
|
|
635
|
+
if (e > t) throw new w(`end must be greater than start (start: ${e}, end: ${t})`);
|
|
636
|
+
if (n >= e && n <= t) throw new w("cannot move a selection inside itself");
|
|
637
|
+
this._split(e), this._split(t), this._split(n);
|
|
638
|
+
let i = this.byStart.get(e), a = this.byEnd.get(t);
|
|
639
|
+
if (!i || !a) throw new w(`range ${e}–${t} is out of bounds`);
|
|
640
|
+
if (this.hasMovedChunks) {
|
|
641
|
+
let n = i;
|
|
642
|
+
for (; n !== a;) if (n = n.next, !n || n.start < e || n.end > t) throw new w(`cannot move ${e} to ${t} because an earlier move split that range`);
|
|
643
|
+
}
|
|
644
|
+
let o = i.previous, s = a.next, c, l;
|
|
645
|
+
if (r === "left") {
|
|
646
|
+
if (c = this.byEnd.get(n) ?? null, c) {
|
|
647
|
+
if (c.next === i) return this;
|
|
648
|
+
l = c.next;
|
|
649
|
+
} else {
|
|
650
|
+
if (i === this.firstChunk) return this;
|
|
651
|
+
l = this.firstChunk;
|
|
652
|
+
}
|
|
653
|
+
} else if (l = this.byStart.get(n) ?? null, l) {
|
|
654
|
+
if (l.previous === a) return this;
|
|
655
|
+
c = l.previous;
|
|
656
|
+
} else {
|
|
657
|
+
if (a === this.lastChunk) return this;
|
|
658
|
+
c = this.lastChunk;
|
|
659
|
+
}
|
|
660
|
+
return o && (o.next = s), s && (s.previous = o), c && (c.next = i), l && (l.previous = a), o || (this.firstChunk = s), s || (this.lastChunk = o, this.lastChunk.next = null), i.previous = c, a.next = l || null, c || (this.firstChunk = i), l || (this.lastChunk = a), this.hasMovedChunks = !0, this;
|
|
661
|
+
}
|
|
662
|
+
overwrite(e, t, n, r) {
|
|
663
|
+
if (r === !0) return U.storeName ||= (console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"), !0), this.update(e, t, n, {
|
|
664
|
+
storeName: !0,
|
|
665
|
+
overwrite: !0
|
|
666
|
+
});
|
|
667
|
+
let i = typeof r == "object" && r ? r : {};
|
|
668
|
+
return this.update(e, t, n, {
|
|
669
|
+
...i,
|
|
670
|
+
overwrite: !i.contentOnly
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
update(e, t, n, r) {
|
|
674
|
+
if (e = this._resolveIndex(e), t = this._resolveIndex(t), typeof n != "string") throw new w(`content must be a string, got ${typeof n}`);
|
|
675
|
+
if (e < 0) throw new w(`start ${e} is out of bounds`);
|
|
676
|
+
if (t > this.original.length) throw new w(`end ${t} is out of bounds`);
|
|
677
|
+
if (e === t) throw new w(`cannot overwrite a zero-length range at ${e}, use appendLeft() or prependRight()`);
|
|
678
|
+
if (e > t) throw new w(`end must be greater than start (start: ${e}, end: ${t})`);
|
|
679
|
+
this._split(e), this._split(t), r === !0 && (U.storeName ||= (console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"), !0), r = { storeName: !0 });
|
|
680
|
+
let i = typeof r == "object" && r ? r : {}, a = i.storeName || !1, o = i.overwrite || !1;
|
|
681
|
+
a && this.storedNames.add(this.original.slice(e, t));
|
|
682
|
+
let s = this.byStart.get(e);
|
|
683
|
+
for (let e = s; e.end < t;) {
|
|
684
|
+
let t = e.next;
|
|
685
|
+
if (t === null || t !== this.byStart.get(e.end)) throw new w("cannot overwrite across a split point");
|
|
686
|
+
e = t;
|
|
687
|
+
}
|
|
688
|
+
for (let n = s.next; n !== null && n.start < t; n = n.next) n.edit("", !1, !o), n.replacesUntil = -1, n.replacedFrom = e;
|
|
689
|
+
return s.edit(n, a, !o), s.replacesUntil = t, s.replacedFrom = -1, this;
|
|
690
|
+
}
|
|
691
|
+
prepend(e) {
|
|
692
|
+
if (typeof e != "string") throw new w(`content must be a string, got ${typeof e}`);
|
|
693
|
+
return this.intro = e + this.intro, this;
|
|
694
|
+
}
|
|
695
|
+
prependLeft(e, t) {
|
|
696
|
+
if (e = this._resolveIndex(e), e < 0 || e > this.original.length) throw new w(`index ${e} is out of bounds`);
|
|
697
|
+
if (typeof t != "string") throw new w(`content must be a string, got ${typeof t}`);
|
|
698
|
+
this._split(e);
|
|
699
|
+
let n = this.byEnd.get(e);
|
|
700
|
+
return n ? n.prependLeft(t) : this.intro = t + this.intro, this;
|
|
701
|
+
}
|
|
702
|
+
prependRight(e, t) {
|
|
703
|
+
if (e = this._resolveIndex(e), e < 0 || e > this.original.length) throw new w(`index ${e} is out of bounds`);
|
|
704
|
+
if (typeof t != "string") throw new w(`content must be a string, got ${typeof t}`);
|
|
705
|
+
this._split(e);
|
|
706
|
+
let n = this.byStart.get(e);
|
|
707
|
+
return n ? n.prependRight(t) : this.outro = t + this.outro, this;
|
|
708
|
+
}
|
|
709
|
+
remove(e, t) {
|
|
710
|
+
if (e = this._resolveIndex(e), t = this._resolveIndex(t), e === t) return this;
|
|
711
|
+
if (e < 0 || t > this.original.length) throw new w(`range ${e}–${t} is out of bounds`);
|
|
712
|
+
if (e > t) throw new w(`end must be greater than start (start: ${e}, end: ${t})`);
|
|
713
|
+
this._split(e), this._split(t);
|
|
714
|
+
let n = this.byStart.get(e);
|
|
715
|
+
for (; n;) n.start > e && (n.intro = ""), n.end < t && (n.outro = ""), n.edit("", !1, !0), n.replacesUntil = -1, n.replacedFrom = -1, n = t > n.end ? this.byStart.get(n.end) : void 0;
|
|
716
|
+
return this;
|
|
717
|
+
}
|
|
718
|
+
reset(e, t) {
|
|
719
|
+
if (e = this._resolveIndex(e), t = this._resolveIndex(t), e === t) return this;
|
|
720
|
+
if (e < 0 || t > this.original.length) throw new w(`range ${e}–${t} is out of bounds`);
|
|
721
|
+
if (e > t) throw new w(`end must be greater than start (start: ${e}, end: ${t})`);
|
|
722
|
+
this._split(e), this._split(t);
|
|
723
|
+
let n = this.byStart.get(e);
|
|
724
|
+
for (; n;) n.reset(), n = t > n.end ? this.byStart.get(n.end) : void 0;
|
|
725
|
+
return this;
|
|
726
|
+
}
|
|
727
|
+
lastChar() {
|
|
728
|
+
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
729
|
+
let e = this.lastChunk;
|
|
730
|
+
for (; e;) {
|
|
731
|
+
if (e.outro.length) return e.outro[e.outro.length - 1];
|
|
732
|
+
if (e.content.length) return e.content[e.content.length - 1];
|
|
733
|
+
if (e.intro.length) return e.intro[e.intro.length - 1];
|
|
734
|
+
e = e.previous;
|
|
735
|
+
}
|
|
736
|
+
return this.intro.length ? this.intro[this.intro.length - 1] : "";
|
|
737
|
+
}
|
|
738
|
+
lastLine() {
|
|
739
|
+
let e = this.outro.lastIndexOf(B);
|
|
740
|
+
if (e !== -1) return this.outro.slice(e + 1);
|
|
741
|
+
let t = this.outro, n = this.lastChunk;
|
|
742
|
+
for (; n;) {
|
|
743
|
+
if (n.outro.length > 0) {
|
|
744
|
+
if (e = n.outro.lastIndexOf(B), e !== -1) return n.outro.slice(e + 1) + t;
|
|
745
|
+
t = n.outro + t;
|
|
746
|
+
}
|
|
747
|
+
if (n.content.length > 0) {
|
|
748
|
+
if (e = n.content.lastIndexOf(B), e !== -1) return n.content.slice(e + 1) + t;
|
|
749
|
+
t = n.content + t;
|
|
750
|
+
}
|
|
751
|
+
if (n.intro.length > 0) {
|
|
752
|
+
if (e = n.intro.lastIndexOf(B), e !== -1) return n.intro.slice(e + 1) + t;
|
|
753
|
+
t = n.intro + t;
|
|
754
|
+
}
|
|
755
|
+
n = n.previous;
|
|
756
|
+
}
|
|
757
|
+
return e = this.intro.lastIndexOf(B), e === -1 ? this.intro + t : this.intro.slice(e + 1) + t;
|
|
758
|
+
}
|
|
759
|
+
slice(e = 0, t = this.original.length - this.offset) {
|
|
760
|
+
e = this._resolveIndex(e), t = this._resolveIndex(t);
|
|
761
|
+
let n = "", r;
|
|
762
|
+
if (this.hasMovedChunks) for (r = this.firstChunk; r && (r.start > e || r.end <= e);) {
|
|
763
|
+
if (r.start < t && r.end >= t || t === 0 && r.start === 0) return n;
|
|
764
|
+
r = r.next;
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
if (e >= t) return n;
|
|
768
|
+
r = this._chunkAt(e);
|
|
769
|
+
}
|
|
770
|
+
if (r && r.edited && r.start !== e) throw new w(`cannot use edited character ${e} as slice start anchor`);
|
|
771
|
+
let i = r;
|
|
772
|
+
for (; r && (t !== 0 || r.start !== 0);) {
|
|
773
|
+
r.intro && (i !== r || r.start === e) && (n += r.intro);
|
|
774
|
+
let a = r.start < t && r.end >= t;
|
|
775
|
+
if (a && r.edited && r.end !== t) throw new w(`cannot use edited character ${t} as slice end anchor`);
|
|
776
|
+
let o = i === r ? e - r.start : 0, s = a ? r.content.length + t - r.end : r.content.length;
|
|
777
|
+
if (n += r.content.slice(o, s), r.outro && (!a || r.end === t) && (n += r.outro), a) break;
|
|
778
|
+
r = r.next;
|
|
779
|
+
}
|
|
780
|
+
return n;
|
|
781
|
+
}
|
|
782
|
+
snip(e, t) {
|
|
783
|
+
let n = this.clone();
|
|
784
|
+
return n.remove(-n.offset, e), n.remove(t, n.original.length - n.offset), n;
|
|
785
|
+
}
|
|
786
|
+
_resolveIndex(e) {
|
|
787
|
+
let t = e + this.offset;
|
|
788
|
+
if (!Number.isInteger(t)) throw new w(`index must be an integer, got ${e}`);
|
|
789
|
+
return t < 0 && this.original.length !== 0 ? Math.max(0, t + this.original.length) : t;
|
|
790
|
+
}
|
|
791
|
+
_chunkAt(e) {
|
|
792
|
+
let t = this.byStart.get(e);
|
|
793
|
+
if (t) return t;
|
|
794
|
+
t = this.lastSearchedChunk;
|
|
795
|
+
let n = e >= t.end;
|
|
796
|
+
for (; t && !t.contains(e);) t = n ? this.byStart.get(t.end) : this.byEnd.get(t.start);
|
|
797
|
+
return t && (this.lastSearchedChunk = t), t;
|
|
798
|
+
}
|
|
799
|
+
_split(e) {
|
|
800
|
+
if (this.byStart.get(e) || this.byEnd.get(e)) return;
|
|
801
|
+
let t = this.lastSearchedChunk, n = t, r = e > t.end;
|
|
802
|
+
for (; t;) {
|
|
803
|
+
if (t.contains(e)) return this._splitChunk(t, e);
|
|
804
|
+
if (t = r ? this.byStart.get(t.end) : this.byEnd.get(t.start), t === n) return;
|
|
805
|
+
n = t;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
_splitChunk(e, t) {
|
|
809
|
+
if (e.edited && e.content.length) {
|
|
810
|
+
let n = O(this.original)(t);
|
|
811
|
+
throw new w(`cannot split a chunk that has already been edited (${n.line}:${n.column} – "${e.original}")`);
|
|
812
|
+
}
|
|
813
|
+
let n = e.split(t);
|
|
814
|
+
return this.byEnd.set(t, e), this.byStart.set(t, n), this.byEnd.set(n.end, n), e === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = e, !0;
|
|
815
|
+
}
|
|
816
|
+
toString() {
|
|
817
|
+
let e = this.intro, t = this.firstChunk;
|
|
818
|
+
for (; t;) e += t.toString(), t = t.next;
|
|
819
|
+
return e + this.outro;
|
|
820
|
+
}
|
|
821
|
+
isEmpty() {
|
|
822
|
+
if (this.intro.length && this.intro.trim()) return !1;
|
|
823
|
+
let e = this.firstChunk;
|
|
824
|
+
for (; e;) {
|
|
825
|
+
if (e.intro.length && e.intro.trim() || e.content.length && e.content.trim() || e.outro.length && e.outro.trim()) return !1;
|
|
826
|
+
e = e.next;
|
|
827
|
+
}
|
|
828
|
+
return !(this.outro.length && this.outro.trim());
|
|
829
|
+
}
|
|
830
|
+
length() {
|
|
831
|
+
let e = this.firstChunk, t = 0;
|
|
832
|
+
for (; e;) t += e.intro.length + e.content.length + e.outro.length, e = e.next;
|
|
833
|
+
return t;
|
|
834
|
+
}
|
|
835
|
+
trimLines() {
|
|
836
|
+
return this.trim("[\\r\\n]");
|
|
837
|
+
}
|
|
838
|
+
trim(e) {
|
|
839
|
+
return this.trimStart(e).trimEnd(e);
|
|
840
|
+
}
|
|
841
|
+
trimEndAborted(e) {
|
|
842
|
+
let t = RegExp(`${e || "\\s"}+$`);
|
|
843
|
+
if (this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
|
|
844
|
+
let n = this.lastChunk;
|
|
845
|
+
do {
|
|
846
|
+
let e = n.end, r = n.trimEnd(t);
|
|
847
|
+
if (n.end !== e) {
|
|
848
|
+
let e = n.next;
|
|
849
|
+
this.lastChunk === n && (this.lastChunk = e), this.byEnd.set(n.end, n), this.byStart.set(e.start, e), this.byEnd.set(e.end, e);
|
|
850
|
+
}
|
|
851
|
+
if (r) return !0;
|
|
852
|
+
n = n.previous;
|
|
853
|
+
} while (n);
|
|
854
|
+
return this.intro = this.intro.replace(t, ""), this.intro.length > 0;
|
|
855
|
+
}
|
|
856
|
+
trimEnd(e) {
|
|
857
|
+
return this.trimEndAborted(e), this;
|
|
858
|
+
}
|
|
859
|
+
trimStartAborted(e) {
|
|
860
|
+
let t = RegExp(`^${e || "\\s"}+`);
|
|
861
|
+
if (this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
|
|
862
|
+
let n = this.firstChunk;
|
|
863
|
+
do {
|
|
864
|
+
let e = n.end, r = n.trimStart(t);
|
|
865
|
+
if (n.end !== e) {
|
|
866
|
+
let e = n.next;
|
|
867
|
+
n === this.lastChunk && (this.lastChunk = e), this.byEnd.set(n.end, n), this.byStart.set(e.start, e), this.byEnd.set(e.end, e);
|
|
868
|
+
}
|
|
869
|
+
if (r) return !0;
|
|
870
|
+
n = n.next;
|
|
871
|
+
} while (n);
|
|
872
|
+
return this.outro = this.outro.replace(t, ""), this.outro.length > 0;
|
|
873
|
+
}
|
|
874
|
+
trimStart(e) {
|
|
875
|
+
return this.trimStartAborted(e), this;
|
|
876
|
+
}
|
|
877
|
+
hasChanged() {
|
|
878
|
+
if (this.intro || this.outro) return !0;
|
|
879
|
+
let e = 0, t = this.firstChunk;
|
|
880
|
+
for (; t;) {
|
|
881
|
+
if (t.intro || t.outro) return !0;
|
|
882
|
+
if (!t.edited && t.start === e) e = t.end;
|
|
883
|
+
else {
|
|
884
|
+
if (!this.original.startsWith(t.content, e)) return !0;
|
|
885
|
+
e += t.content.length;
|
|
886
|
+
}
|
|
887
|
+
t = t.next;
|
|
888
|
+
}
|
|
889
|
+
return e !== this.original.length;
|
|
890
|
+
}
|
|
891
|
+
_hasRemovedContent(e, t) {
|
|
892
|
+
let n = this.byStart.get(e);
|
|
893
|
+
if (n && e === t) {
|
|
894
|
+
let t = this.byEnd.get(e);
|
|
895
|
+
return !!t && t.content === "" && n.content === "";
|
|
896
|
+
}
|
|
897
|
+
let r = this._chunkAt(e);
|
|
898
|
+
for (; r && r.start < t;) {
|
|
899
|
+
if (r.content === "" && (r.replacedFrom < e || this.byStart.get(r.replacedFrom).replacesUntil < r.end)) return !0;
|
|
900
|
+
r = this.byStart.get(r.end);
|
|
901
|
+
}
|
|
902
|
+
return !1;
|
|
903
|
+
}
|
|
904
|
+
_replaceRegexp(e, t) {
|
|
905
|
+
function n(e, n, r) {
|
|
906
|
+
return typeof t == "string" ? W(t, e[0], n, r, e.slice(1), e.groups) : e.groups === void 0 ? t(e[0], ...e.slice(1), n, r) : t(e[0], ...e.slice(1), n, r, e.groups);
|
|
907
|
+
}
|
|
908
|
+
let r = (e) => {
|
|
909
|
+
if (e.index == null || this._hasRemovedContent(e.index, e.index + e[0].length)) return !1;
|
|
910
|
+
let t = n(e, e.index, this.original);
|
|
911
|
+
return t === e[0] || (e[0].length === 0 ? this.appendRight(e.index - this.offset, t) : this.overwrite(e.index - this.offset, e.index + e[0].length - this.offset, t)), !0;
|
|
912
|
+
};
|
|
913
|
+
if (e.global) {
|
|
914
|
+
e.lastIndex = 0;
|
|
915
|
+
for (let t of this.original.matchAll(e)) r(t);
|
|
916
|
+
} else {
|
|
917
|
+
let t = this.original.match(e);
|
|
918
|
+
if (t && !r(t)) {
|
|
919
|
+
let t = new RegExp(e.source, `${e.flags}g`);
|
|
920
|
+
for (let e of this.original.matchAll(t)) if (r(e)) break;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return this;
|
|
924
|
+
}
|
|
925
|
+
_replaceString(e, t) {
|
|
926
|
+
let { original: n } = this, r = n.indexOf(e);
|
|
927
|
+
for (; r !== -1;) if (this._hasRemovedContent(r, r + e.length)) r = n.indexOf(e, r + e.length);
|
|
928
|
+
else {
|
|
929
|
+
t = typeof t == "function" ? t(e, r, n) : W(t, e, r, n, [], void 0), e !== t && (e.length === 0 ? this.appendRight(r - this.offset, t) : this.overwrite(r - this.offset, r + e.length - this.offset, t));
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
return this;
|
|
933
|
+
}
|
|
934
|
+
replace(e, t) {
|
|
935
|
+
return typeof e == "string" ? this._replaceString(e, t) : this._replaceRegexp(e, t);
|
|
936
|
+
}
|
|
937
|
+
_replaceAllString(e, t) {
|
|
938
|
+
let { original: n } = this, r = e.length;
|
|
939
|
+
if (r === 0) {
|
|
940
|
+
for (let e = 0; e <= n.length; e += 1) {
|
|
941
|
+
if (this._hasRemovedContent(e, e)) continue;
|
|
942
|
+
let r = typeof t == "function" ? t("", e, n) : W(t, "", e, n, [], void 0);
|
|
943
|
+
r !== "" && this.appendRight(e - this.offset, r);
|
|
944
|
+
}
|
|
945
|
+
return this;
|
|
946
|
+
}
|
|
947
|
+
for (let i = n.indexOf(e); i !== -1; i = n.indexOf(e, i + r)) {
|
|
948
|
+
if (this._hasRemovedContent(i, i + r)) continue;
|
|
949
|
+
let e = n.slice(i, i + r), a = typeof t == "function" ? t(e, i, n) : W(t, e, i, n, [], void 0);
|
|
950
|
+
e !== a && this.overwrite(i - this.offset, i + r - this.offset, a);
|
|
951
|
+
}
|
|
952
|
+
return this;
|
|
953
|
+
}
|
|
954
|
+
replaceAll(e, t) {
|
|
955
|
+
if (typeof e == "string") return this._replaceAllString(e, t);
|
|
956
|
+
if (!e.global) throw new w("replaceAll() requires a global RegExp");
|
|
957
|
+
return this._replaceRegexp(e, t);
|
|
958
|
+
}
|
|
959
|
+
}, K = "data-ck-src", q = 500, J = /* @__PURE__ */ new Set([
|
|
960
|
+
"html",
|
|
961
|
+
"head",
|
|
962
|
+
"body",
|
|
963
|
+
"template",
|
|
964
|
+
"slot",
|
|
965
|
+
"script",
|
|
966
|
+
"style",
|
|
967
|
+
"noscript",
|
|
968
|
+
"meta",
|
|
969
|
+
"link",
|
|
970
|
+
"title",
|
|
971
|
+
"base"
|
|
972
|
+
]), Y = /* @__PURE__ */ new Set(["svg", "math"]), oe = /[\p{L}\p{N}_./@+~()[\]$,=!#-]/u, se = new TextEncoder();
|
|
973
|
+
function ce(e) {
|
|
974
|
+
let t = "";
|
|
975
|
+
for (let n of e) t += oe.test(n) ? n : [...se.encode(n)].map((e) => `%${e.toString(16).toUpperCase().padStart(2, "0")}`).join("");
|
|
976
|
+
return t;
|
|
977
|
+
}
|
|
978
|
+
var le = class {
|
|
979
|
+
code;
|
|
980
|
+
file;
|
|
981
|
+
s;
|
|
982
|
+
lineStarts = null;
|
|
983
|
+
count = 0;
|
|
984
|
+
constructor(e, t) {
|
|
985
|
+
this.code = e, this.file = t, this.s = new G(e);
|
|
986
|
+
}
|
|
987
|
+
location(e) {
|
|
988
|
+
if (!this.lineStarts) {
|
|
989
|
+
let e = [0];
|
|
990
|
+
for (let t = 0; t < this.code.length; t++) this.code.charCodeAt(t) === 10 && e.push(t + 1);
|
|
991
|
+
this.lineStarts = e;
|
|
992
|
+
}
|
|
993
|
+
let t = this.lineStarts, n = 0, r = t.length - 1;
|
|
994
|
+
for (; n < r;) {
|
|
995
|
+
let i = n + r + 1 >> 1;
|
|
996
|
+
t[i] <= e ? n = i : r = i - 1;
|
|
997
|
+
}
|
|
998
|
+
return {
|
|
999
|
+
line: n + 1,
|
|
1000
|
+
column: e - t[n] + 1
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
add(e, t) {
|
|
1004
|
+
let { line: n, column: r } = this.location(e), i = `${ce(this.file)}:${n}:${r}`;
|
|
1005
|
+
i.length > q || (this.s.appendLeft(t, ` ${K}="${i}"`), this.count++);
|
|
1006
|
+
}
|
|
1007
|
+
verify(e, t) {
|
|
1008
|
+
return this.code.charCodeAt(e) === 60 && this.code.startsWith(t, e + 1);
|
|
1009
|
+
}
|
|
1010
|
+
result() {
|
|
1011
|
+
if (!this.count) return null;
|
|
1012
|
+
let e = this.file.slice(this.file.lastIndexOf("/") + 1);
|
|
1013
|
+
return {
|
|
1014
|
+
code: this.s.toString(),
|
|
1015
|
+
map: this.s.generateMap({
|
|
1016
|
+
hires: !0,
|
|
1017
|
+
source: e,
|
|
1018
|
+
includeContent: !0
|
|
1019
|
+
})
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
}, ue = /* @__PURE__ */ new Set(["RegularElement", "Element"]), de = /* @__PURE__ */ new Set([
|
|
1023
|
+
"SvelteHead",
|
|
1024
|
+
"Head",
|
|
1025
|
+
"SvelteOptions",
|
|
1026
|
+
"Options",
|
|
1027
|
+
"Script",
|
|
1028
|
+
"Style",
|
|
1029
|
+
"StyleSheet"
|
|
1030
|
+
]), fe = /* @__PURE__ */ new Set([
|
|
1031
|
+
"metadata",
|
|
1032
|
+
"expression",
|
|
1033
|
+
"loc",
|
|
1034
|
+
"name_loc",
|
|
1035
|
+
"start",
|
|
1036
|
+
"end",
|
|
1037
|
+
"instance",
|
|
1038
|
+
"module",
|
|
1039
|
+
"css",
|
|
1040
|
+
"attributes",
|
|
1041
|
+
"test",
|
|
1042
|
+
"context",
|
|
1043
|
+
"key",
|
|
1044
|
+
"index",
|
|
1045
|
+
"parameters",
|
|
1046
|
+
"tag"
|
|
1047
|
+
]);
|
|
1048
|
+
function pe(e) {
|
|
1049
|
+
return !!e.attributes?.some((e) => e.type === "Attribute" && e.name === "data-ck-src");
|
|
1050
|
+
}
|
|
1051
|
+
function me(e, t, n) {
|
|
1052
|
+
let r = t.parse(e, { modern: !0 }), i = r.fragment ?? r.html, a = (e, t) => {
|
|
1053
|
+
if (!e || typeof e != "object") return;
|
|
1054
|
+
if (Array.isArray(e)) {
|
|
1055
|
+
for (let n of e) a(n, t);
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
let r = e;
|
|
1059
|
+
if (de.has(r.type)) return;
|
|
1060
|
+
let i = t;
|
|
1061
|
+
if (ue.has(r.type) && r.name && !r.name.includes(":")) {
|
|
1062
|
+
let e = r.name, a = r.start;
|
|
1063
|
+
!t && typeof a == "number" && !J.has(e) && !pe(r) && n.verify(a, e) && n.add(a, a + 1 + e.length), (Y.has(e) || e === "head") && (i = !0);
|
|
1064
|
+
}
|
|
1065
|
+
for (let e in r) {
|
|
1066
|
+
if (fe.has(e)) continue;
|
|
1067
|
+
let t = r[e];
|
|
1068
|
+
t && typeof t == "object" && a(t, i);
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
a(i, !1);
|
|
1072
|
+
}
|
|
1073
|
+
// plugins/transform/vue.ts
|
|
1074
|
+
var he = 1, ge = 9, X = 11, _e = 0, ve = 6, ye = 7;
|
|
1075
|
+
function be(e) {
|
|
1076
|
+
return !!e.props?.some((e) => e.type === ve && e.name === "data-ck-src" || e.type === ye && e.name === "bind" && e.arg?.content === "data-ck-src");
|
|
1077
|
+
}
|
|
1078
|
+
function xe(e, t, n) {
|
|
1079
|
+
let { descriptor: r, errors: i } = t.parse(e, {
|
|
1080
|
+
sourceMap: !1,
|
|
1081
|
+
ignoreEmpty: !0
|
|
1082
|
+
});
|
|
1083
|
+
if (i.length) throw i[0] instanceof Error ? i[0] : Error(String(i[0]));
|
|
1084
|
+
let a = r.template;
|
|
1085
|
+
if (!a?.ast || a.src || a.lang && a.lang !== "html") return;
|
|
1086
|
+
let o = (e, t) => {
|
|
1087
|
+
for (let r of e ?? []) if (r.type === he) {
|
|
1088
|
+
let e = r.tag ?? "", i = t;
|
|
1089
|
+
if (r.tagType === _e) {
|
|
1090
|
+
let a = r.loc.start.offset;
|
|
1091
|
+
!t && !J.has(e) && !be(r) && n.verify(a, e) && n.add(a, a + 1 + e.length), (Y.has(e) || e === "head") && (i = !0);
|
|
1092
|
+
}
|
|
1093
|
+
o(r.children, i);
|
|
1094
|
+
} else r.type === ge ? o(r.branches, t) : (r.type === X || r.children) && o(r.children, t);
|
|
1095
|
+
};
|
|
1096
|
+
o(a.ast.children, !1);
|
|
1097
|
+
}
|
|
1098
|
+
// plugins/transform/index.ts
|
|
1099
|
+
var Z = /* @__PURE__ */ new Set();
|
|
1100
|
+
function Q(e, t) {
|
|
1101
|
+
Z.has(e) || (Z.add(e), console.warn(`[CommentKit] ${t}`));
|
|
1102
|
+
}
|
|
1103
|
+
function $(e) {
|
|
1104
|
+
return (e instanceof Error ? e.message : String(e)).split("\n", 1)[0].slice(0, 200);
|
|
1105
|
+
}
|
|
1106
|
+
async function Se(r, i, a) {
|
|
1107
|
+
if (!r.includes("<") || !e()) return null;
|
|
1108
|
+
let o = t(i);
|
|
1109
|
+
if (o.includes("/node_modules/")) return null;
|
|
1110
|
+
let s = n(a.root, o);
|
|
1111
|
+
if (!s || s === ".." || s.startsWith("../")) return null;
|
|
1112
|
+
let c = /\.([a-z]+)$/.exec(o)?.[1], u = new le(r, s);
|
|
1113
|
+
try {
|
|
1114
|
+
switch (c) {
|
|
1115
|
+
case "jsx":
|
|
1116
|
+
case "tsx":
|
|
1117
|
+
case "js":
|
|
1118
|
+
case "mjs":
|
|
1119
|
+
if ((c === "js" || c === "mjs") && !/<[a-zA-Z]/.test(r)) return null;
|
|
1120
|
+
{
|
|
1121
|
+
let { tagJsx: e } = await import("./jsx-Bg4BdSph.js"), t = e(r, o, u);
|
|
1122
|
+
if (t) return Q("jsx-parse", `Could not parse ${s} (${$(t)}), so its elements have no data-ck-src. If the file has a syntax error, your bundler reports it too. If it uses syntax this parser does not read (Flow, for example), leave such files out with the \`exclude\` option. This warning is shown once; other files may be skipped the same way.`), null;
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
case "vue": {
|
|
1126
|
+
let e = await l(["@vue/compiler-sfc", "vue/compiler-sfc"], a.root, "vue");
|
|
1127
|
+
if (!e?.parse) return Q("vue", "Could not load @vue/compiler-sfc; .vue files are not tagged."), null;
|
|
1128
|
+
xe(r, e, u);
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
case "svelte": {
|
|
1132
|
+
let e = await l(["svelte/compiler"], a.root);
|
|
1133
|
+
if (!e?.parse) return Q("svelte", "Could not load svelte/compiler; .svelte files are not tagged."), null;
|
|
1134
|
+
me(r, e, u);
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
case "astro": {
|
|
1138
|
+
let { tagAstroGo: e, tagAstroRust: t } = await import("./astro-B5y1Gtbf.js"), n = await l(["@astrojs/compiler-rs"], a.root, "astro");
|
|
1139
|
+
if (n?.parse) {
|
|
1140
|
+
t(r, n, u);
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
let i = await l(["@astrojs/compiler"], a.root, "astro");
|
|
1144
|
+
if (!i?.parse) return Q("astro", "Could not load the Astro compiler; .astro files are not tagged."), null;
|
|
1145
|
+
await e(r, i, u);
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
default: return null;
|
|
1149
|
+
}
|
|
1150
|
+
} catch (e) {
|
|
1151
|
+
return Q(`error:${c}`, `Could not add source locations to ${s} (${$(e)}); .${c} files that fail this way are left as they are. If the file builds without CommentKit, update @commentkit/comment-kit and your framework compiler, and report the error if it stays. To silence it, leave the file out with the \`exclude\` option. This warning is shown once per file type.`), null;
|
|
1152
|
+
}
|
|
1153
|
+
return u.result();
|
|
1154
|
+
}
|
|
1155
|
+
export { J as i, K as n, Y as r, Se as t };
|