labull-framework 0.1.19 → 0.1.20

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.
@@ -1,8 +1,8 @@
1
- import { defineComponent as ue, ref as k, computed as P, watch as $t, nextTick as _e, onMounted as Se, onBeforeUnmount as Be, openBlock as c, createElementBlock as d, normalizeStyle as Me, normalizeClass as Y, unref as Tt, createElementVNode as l, toDisplayString as p, createCommentVNode as x, Fragment as E, renderList as O, withModifiers as Ae, createBlock as gn, withDirectives as Yt, vModelText as Zt, createTextVNode as C, withKeys as _n } from "vue";
2
- import { useRouter as Re } from "vue-router";
3
- import { A as yn, b as Z, c as Ft, u as je } from "./chunk-index-BWpDbB19.js";
4
- import { u as kn, o as oe, b as Oe, _ as Pe, d as $n } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-BpRKKThg.js";
5
- const et = "__mb", Le = "call", se = "reply", Ie = "host-ready", Ne = "height", wn = "html, body { overflow: hidden !important; }", xn = `
1
+ import { defineComponent as fe, ref as k, computed as P, watch as $t, nextTick as xe, onMounted as Re, onBeforeUnmount as je, openBlock as u, createElementBlock as c, normalizeStyle as Pe, normalizeClass as W, unref as Bt, createElementVNode as l, toDisplayString as m, createCommentVNode as x, Fragment as T, renderList as j, withModifiers as Le, createBlock as wn, withDirectives as te, vModelText as ee, createTextVNode as C, withKeys as xn } from "vue";
2
+ import { useRouter as Ie } from "vue-router";
3
+ import { A as Cn, b as Y, c as Ut, u as Ne } from "./chunk-index-BWpDbB19.js";
4
+ import { u as En, o as ie, b as De, _ as Fe, d as Tn } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-BpRKKThg.js";
5
+ const et = "__mb", ze = "call", re = "reply", He = "host-ready", Ue = "height", Sn = "html, body { overflow: hidden !important; }", Bn = `
6
6
  (function () {
7
7
  var seq = 0, waiting = {}, queue = [], ready = false, last = -1;
8
8
  function call(method, args) {
@@ -10,7 +10,7 @@ const et = "__mb", Le = "call", se = "reply", Ie = "host-ready", Ne = "height",
10
10
  function run() {
11
11
  var id = ++seq;
12
12
  waiting[id] = { resolve: resolve, reject: reject };
13
- parent.postMessage({ '${et}': '${Le}', id: id, method: method, args: args }, '*');
13
+ parent.postMessage({ '${et}': '${ze}', id: id, method: method, args: args }, '*');
14
14
  }
15
15
  if (ready) run(); else queue.push(run);
16
16
  });
@@ -18,8 +18,8 @@ const et = "__mb", Le = "call", se = "reply", Ie = "host-ready", Ne = "height",
18
18
  window.addEventListener('message', function (event) {
19
19
  var data = event.data, pending;
20
20
  if (!data || data['${et}'] === undefined) return;
21
- if (data['${et}'] === '${Ie}') { ready = true; queue.splice(0).forEach(function (run) { run(); }); return; }
22
- if (data['${et}'] !== '${se}') return;
21
+ if (data['${et}'] === '${He}') { ready = true; queue.splice(0).forEach(function (run) { run(); }); return; }
22
+ if (data['${et}'] !== '${re}') return;
23
23
  if (!(pending = waiting[data.id])) return;
24
24
  delete waiting[data.id];
25
25
  if (data.ok) pending.resolve(data.value); else pending.reject(new Error(data.error || '调用失败'));
@@ -60,7 +60,7 @@ const et = "__mb", Le = "call", se = "reply", Ie = "host-ready", Ne = "height",
60
60
  if (height > 0) height += 1;
61
61
  if (height === last) return; /* 一样高就不再发:否则「宿主改高度 → 触发观察 → 又发一次」会转个不停 */
62
62
  last = height;
63
- parent.postMessage({ '${et}': '${Ne}', height: height }, '*');
63
+ parent.postMessage({ '${et}': '${Ue}', height: height }, '*');
64
64
  }
65
65
  function start() {
66
66
  report();
@@ -69,30 +69,30 @@ const et = "__mb", Le = "call", se = "reply", Ie = "host-ready", Ne = "height",
69
69
  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
70
70
  setInterval(report, 500);
71
71
  })();
72
- `, Cn = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
73
- function De(s) {
72
+ `, An = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
73
+ function Ke(s) {
74
74
  const o = typeof window > "u" ? "http://localhost" : window.location.href;
75
- return new URL(`${yn}${s}`, o);
75
+ return new URL(`${Cn}${s}`, o);
76
76
  }
77
- const ye = (() => {
77
+ const Ce = (() => {
78
78
  try {
79
- return De("").origin;
79
+ return Ke("").origin;
80
80
  } catch {
81
81
  return typeof window > "u" ? "" : window.location.origin;
82
82
  }
83
83
  })();
84
- async function En(s, o, a) {
85
- if (!Cn.test(o)) throw new Error(`路由名不合法:${o}(要写成 类名.方法名,例如 Customer.create)`);
86
- const r = De(`/bx/${s}/${o}`);
87
- if (r.origin !== ye) throw new Error(`后端地址必须是本应用的(${ye}):${r.origin}`);
88
- const u = a instanceof Blob ? a : null, b = await fetch(r.toString(), {
84
+ async function Mn(s, o, a) {
85
+ if (!An.test(o)) throw new Error(`路由名不合法:${o}(要写成 类名.方法名,例如 Customer.create)`);
86
+ const r = Ke(`/bx/${s}/${o}`);
87
+ if (r.origin !== Ce) throw new Error(`后端地址必须是本应用的(${Ce}):${r.origin}`);
88
+ const d = a instanceof Blob ? a : null, h = await fetch(r.toString(), {
89
89
  method: "POST",
90
90
  credentials: "include",
91
91
  // 带上 HttpOnly 会话 cookie;authHeaders('POST') 给 CSRF 头(缺了 403)
92
- headers: u ? { "Content-Type": u.type || "application/octet-stream", ...Ft("POST") } : { "Content-Type": "application/json", ...Ft("POST") },
93
- body: u ?? JSON.stringify(a ?? {})
94
- }), f = await b.text().catch(() => "");
95
- if (b.ok) {
92
+ headers: d ? { "Content-Type": d.type || "application/octet-stream", ...Ut("POST") } : { "Content-Type": "application/json", ...Ut("POST") },
93
+ body: d ?? JSON.stringify(a ?? {})
94
+ }), f = await h.text().catch(() => "");
95
+ if (h.ok) {
96
96
  if (!f) return null;
97
97
  try {
98
98
  return JSON.parse(f);
@@ -100,84 +100,84 @@ async function En(s, o, a) {
100
100
  return f;
101
101
  }
102
102
  }
103
- let m = f;
103
+ let p = f;
104
104
  try {
105
- const v = JSON.parse(f);
106
- typeof v?.message == "string" && (m = v.message);
105
+ const b = JSON.parse(f);
106
+ typeof b?.message == "string" && (p = b.message);
107
107
  } catch {
108
- m = f;
108
+ p = f;
109
109
  }
110
- throw new Error(m ? `${o} 调用失败:${m.slice(0, 300)}` : `${o} 调用失败(${b.status})`);
110
+ throw new Error(p ? `${o} 调用失败:${p.slice(0, 300)}` : `${o} 调用失败(${h.status})`);
111
111
  }
112
- function Tn(s, o) {
112
+ function On(s, o) {
113
113
  const a = (f) => {
114
114
  try {
115
115
  s.contentWindow?.postMessage(f, "*");
116
- } catch (m) {
117
- console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):", m);
116
+ } catch (p) {
117
+ console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):", p);
118
118
  }
119
119
  };
120
- async function r(f, m) {
121
- if (f === "getMe") return await Z("/auth/me");
120
+ async function r(f, p) {
121
+ if (f === "getMe") return await Y("/auth/me");
122
122
  if (f === "navigateTab") {
123
- const v = typeof m[0] == "string" ? m[0].trim() : "";
124
- if (!v || !o.onNavigateTab) throw new Error(`跳不了 ${v || "(空地址)"}:这个页面没有把宿主接到路由上`);
125
- return await o.onNavigateTab(v);
123
+ const b = typeof p[0] == "string" ? p[0].trim() : "";
124
+ if (!b || !o.onNavigateTab) throw new Error(`跳不了 ${b || "(空地址)"}:这个页面没有把宿主接到路由上`);
125
+ return await o.onNavigateTab(b);
126
126
  }
127
127
  if (f === "context") return o.context ? o.context() : {};
128
128
  if (f === "setTabTitle") {
129
- const v = typeof m[0] == "string" ? m[0].trim() : "", h = typeof m[1] == "string" ? m[1].trim() : "";
130
- if (!v) throw new Error("setTabTitle 要给一个非空的名字");
131
- return o.onTabTitle?.(v, h || void 0), !0;
129
+ const b = typeof p[0] == "string" ? p[0].trim() : "", v = typeof p[1] == "string" ? p[1].trim() : "";
130
+ if (!b) throw new Error("setTabTitle 要给一个非空的名字");
131
+ return o.onTabTitle?.(b, v || void 0), !0;
132
132
  }
133
133
  if (f === "backend") {
134
- const v = typeof m[0] == "string" ? m[0].trim() : "", h = m[1];
135
- if (!v) throw new Error("后端调用的路由名是空的:要写成 magicBackendApi.类名.方法名(参数)");
136
- if (!h || typeof h != "object" || Array.isArray(h)) throw new Error(`magicBackendApi.${v}(params) 的参数要么是一个对象,要么是一个文件(File / Blob)`);
137
- return await En(o.uuid, v, h);
134
+ const b = typeof p[0] == "string" ? p[0].trim() : "", v = p[1];
135
+ if (!b) throw new Error("后端调用的路由名是空的:要写成 magicBackendApi.类名.方法名(参数)");
136
+ if (!v || typeof v != "object" || Array.isArray(v)) throw new Error(`magicBackendApi.${b}(params) 的参数要么是一个对象,要么是一个文件(File / Blob)`);
137
+ return await Mn(o.uuid, b, v);
138
138
  }
139
139
  throw new Error(`不认识的方法:${String(f)}(这块桥只有 getMe / navigateTab / context / setTabTitle / backend 五个)`);
140
140
  }
141
- const u = (f) => {
141
+ const d = (f) => {
142
142
  if (f.source !== s.contentWindow) return;
143
- const m = f.data;
144
- if (!m) return;
145
- if (m[et] === Ne) {
146
- const h = typeof m.height == "number" ? m.height : NaN;
147
- Number.isFinite(h) && h > 0 && o.onHeight?.(h);
143
+ const p = f.data;
144
+ if (!p) return;
145
+ if (p[et] === Ue) {
146
+ const v = typeof p.height == "number" ? p.height : NaN;
147
+ Number.isFinite(v) && v > 0 && o.onHeight?.(v);
148
148
  return;
149
149
  }
150
- if (m[et] !== Le) return;
151
- const v = m.id;
150
+ if (p[et] !== ze) return;
151
+ const b = p.id;
152
152
  (async () => {
153
153
  try {
154
- a({ [et]: se, id: v, ok: !0, value: await r(String(m.method), m.args ?? []) });
155
- } catch (h) {
156
- a({ [et]: se, id: v, ok: !1, error: h instanceof Error ? h.message : String(h) });
154
+ a({ [et]: re, id: b, ok: !0, value: await r(String(p.method), p.args ?? []) });
155
+ } catch (v) {
156
+ a({ [et]: re, id: b, ok: !1, error: v instanceof Error ? v.message : String(v) });
157
157
  }
158
158
  })();
159
159
  };
160
- window.addEventListener("message", u);
161
- const b = () => a({ [et]: Ie });
162
- return b(), s.addEventListener("load", b), () => {
163
- window.removeEventListener("message", u), s.removeEventListener("load", b);
160
+ window.addEventListener("message", d);
161
+ const h = () => a({ [et]: He });
162
+ return h(), s.addEventListener("load", h), () => {
163
+ window.removeEventListener("message", d), s.removeEventListener("load", h);
164
164
  };
165
165
  }
166
- const Bt = "index.open.html", Xt = "magic-block.open.yaml", It = ["id", "module", "name", "brief"], ce = 40, Sn = /^(?![A-Za-z]:)(?!\/)[A-Za-z0-9._\-/]+$/, Bn = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, Mn = /^[a-z][a-z0-9]*$/, An = /^[A-Za-z_][A-Za-z0-9_]*$/;
167
- function Rn(s) {
168
- return s.length > 0 && s.length <= ce && !/[\u0000-\u001f\u007f]/.test(s);
166
+ const Mt = "index.open.html", ne = "magic-block.open.yaml", Ft = ["id", "module", "name", "brief"], me = 40, Rn = /^(?![A-Za-z]:)(?!\/)[A-Za-z0-9._\-/]+$/, jn = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, Pn = /^[a-z][a-z0-9]*$/, Ln = /^[A-Za-z_][A-Za-z0-9_]*$/;
167
+ function In(s) {
168
+ return s.length > 0 && s.length <= me && !/[\u0000-\u001f\u007f]/.test(s);
169
169
  }
170
- const jn = {
170
+ const Nn = {
171
171
  id: "块的 uuid,必须与页面里挂载它时写死的那个 uuid 逐字一致",
172
172
  module: "模块名(小写字母与数字,必须以字母开头),例如 home",
173
- name: `可读名:可以用中文,不超过 ${ce} 个字符`,
173
+ name: `可读名:可以用中文,不超过 ${me} 个字符`,
174
174
  brief: "一句话说明这个块解决什么问题"
175
175
  };
176
- function ke(s) {
176
+ function Ee(s) {
177
177
  const o = Object.keys(s);
178
178
  return o.length > 0 ? `现在包里有:${o.join(" / ")}` : "现在这个包是空的";
179
179
  }
180
- function On(s) {
180
+ function Dn(s) {
181
181
  let o = "";
182
182
  for (let a = 0; a < s.length; a += 1) {
183
183
  const r = s[a];
@@ -188,7 +188,7 @@ function On(s) {
188
188
  }
189
189
  return s;
190
190
  }
191
- function Pn(s) {
191
+ function Fn(s) {
192
192
  let o = "";
193
193
  for (let a = 0; a < s.length; a += 1) {
194
194
  const r = s[a];
@@ -199,206 +199,206 @@ function Pn(s) {
199
199
  }
200
200
  return -1;
201
201
  }
202
- function Ln(s) {
202
+ function zn(s) {
203
203
  return !s || s[0] !== '"' && s[0] !== "'" ? s : s.length >= 2 && s[s.length - 1] === s[0] ? s.slice(1, -1).trim() : s;
204
204
  }
205
- function In(s) {
205
+ function Hn(s) {
206
206
  const o = [], a = {}, r = {};
207
- s.split(/\r?\n/).forEach((u, b) => {
208
- const f = b + 1, m = On(u).trim();
209
- if (!m) return;
210
- if (m.startsWith("-")) {
211
- o.push(`第 ${f} 行是列表写法(${m}):清单只认「键: 值」,四个键各占一行 —— 例如 name: 客户档案`);
207
+ s.split(/\r?\n/).forEach((d, h) => {
208
+ const f = h + 1, p = Dn(d).trim();
209
+ if (!p) return;
210
+ if (p.startsWith("-")) {
211
+ o.push(`第 ${f} 行是列表写法(${p}):清单只认「键: 值」,四个键各占一行 —— 例如 name: 客户档案`);
212
212
  return;
213
213
  }
214
- const v = Pn(m);
215
- if (v < 0) {
216
- o.push(`第 ${f} 行不是「键: 值」(${m}):清单只认「键: 值」与 # 注释 —— 要么删掉这一行,要么照 name: 客户档案 写`);
214
+ const b = Fn(p);
215
+ if (b < 0) {
216
+ o.push(`第 ${f} 行不是「键: 值」(${p}):清单只认「键: 值」与 # 注释 —— 要么删掉这一行,要么照 name: 客户档案 写`);
217
217
  return;
218
218
  }
219
- const h = m.slice(0, v).trim();
220
- if (!An.test(h)) {
221
- o.push(`第 ${f} 行的键名不合法(${h}):键名只许字母或下划线开头,认得的键只有 ${It.join(" / ")}`);
219
+ const v = p.slice(0, b).trim();
220
+ if (!Ln.test(v)) {
221
+ o.push(`第 ${f} 行的键名不合法(${v}):键名只许字母或下划线开头,认得的键只有 ${Ft.join(" / ")}`);
222
222
  return;
223
223
  }
224
- if (!It.includes(h)) {
225
- o.push(`第 ${f} 行的键不认识(${h}):清单只有 ${It.join(" / ")} 这四个键`);
224
+ if (!Ft.includes(v)) {
225
+ o.push(`第 ${f} 行的键不认识(${v}):清单只有 ${Ft.join(" / ")} 这四个键`);
226
226
  return;
227
227
  }
228
- if (h in r) {
229
- o.push(`第 ${f} 行重复写了 ${h}(第 ${r[h]} 行已经写过):一个键只许出现一次`);
228
+ if (v in r) {
229
+ o.push(`第 ${f} 行重复写了 ${v}(第 ${r[v]} 行已经写过):一个键只许出现一次`);
230
230
  return;
231
231
  }
232
- r[h] = f, a[h] = Ln(m.slice(v + 1).trim());
232
+ r[v] = f, a[v] = zn(p.slice(b + 1).trim());
233
233
  });
234
- for (const u of It) {
235
- const b = a[u] ?? "";
236
- if (b === "") {
237
- o.push(`清单里缺少 ${u}(或者是空的):${jn[u]}`);
234
+ for (const d of Ft) {
235
+ const h = a[d] ?? "";
236
+ if (h === "") {
237
+ o.push(`清单里缺少 ${d}(或者是空的):${Nn[d]}`);
238
238
  continue;
239
239
  }
240
- u === "id" && !Bn.test(b) ? o.push(`清单里的 id 不是 uuid:${b} —— 要 8-4-4-4-12 那种十六进制`) : u === "module" && !Mn.test(b) ? o.push(
241
- `清单里的 module 不合法:${b} —— 它同时是 Django 的 app label,所以只许小写字母与数字、必须以字母开头(不能有横线与下划线),例如 home / orders`
242
- ) : u === "name" && !Rn(b) && o.push(`清单里的 name 不合法:${b} —— 不能超过 ${ce} 个字符、不能含控制字符(中文可以)`);
240
+ d === "id" && !jn.test(h) ? o.push(`清单里的 id 不是 uuid:${h} —— 要 8-4-4-4-12 那种十六进制`) : d === "module" && !Pn.test(h) ? o.push(
241
+ `清单里的 module 不合法:${h} —— 它同时是 Django 的 app label,所以只许小写字母与数字、必须以字母开头(不能有横线与下划线),例如 home / orders`
242
+ ) : d === "name" && !In(h) && o.push(`清单里的 name 不合法:${h} —— 不能超过 ${me} 个字符、不能含控制字符(中文可以)`);
243
243
  }
244
244
  return [a, o];
245
245
  }
246
- function Nn(s) {
247
- return Sn.test(s) && !s.split("/").includes("..");
246
+ function Un(s) {
247
+ return Rn.test(s) && !s.split("/").includes("..");
248
248
  }
249
- function Dn(s) {
250
- const o = [], a = s[Bt];
251
- a === void 0 ? o.push(`包里缺入口:必须有 ${Bt}(${ke(s)})`) : a.trim() || o.push(`${Bt} 不能是空文件`);
252
- const r = s[Xt];
253
- let u = {};
249
+ function Kn(s) {
250
+ const o = [], a = s[Mt];
251
+ a === void 0 ? o.push(`包里缺入口:必须有 ${Mt}(${Ee(s)})`) : a.trim() || o.push(`${Mt} 不能是空文件`);
252
+ const r = s[ne];
253
+ let d = {};
254
254
  if (r === void 0)
255
- o.push(`包里缺清单:必须有 ${Xt}(${ke(s)})`);
255
+ o.push(`包里缺清单:必须有 ${ne}(${Ee(s)})`);
256
256
  else if (!r.trim())
257
- o.push(`${Xt} 不能是空文件`);
257
+ o.push(`${ne} 不能是空文件`);
258
258
  else {
259
- const [b, f] = In(r);
260
- u = b, o.push(...f);
259
+ const [h, f] = Hn(r);
260
+ d = h, o.push(...f);
261
261
  }
262
- for (const b of Object.keys(s))
263
- Nn(b) || o.push(`文件名不合法:${b}(只许字母数字与 . _ - /,且不许 .. 与绝对路径)`);
264
- return { manifest: u, issues: o };
262
+ for (const h of Object.keys(s))
263
+ Un(h) || o.push(`文件名不合法:${h}(只许字母数字与 . _ - /,且不许 .. 与绝对路径)`);
264
+ return { manifest: d, issues: o };
265
265
  }
266
- function Fn(s) {
266
+ function qn(s) {
267
267
  const o = [];
268
268
  if (s.length === 0)
269
269
  return o.push("一个块都没勾:请在「读回改动」的结果里勾上要保存的块"), { selected: 0, issues: o };
270
270
  for (const a of s) {
271
271
  const r = a.name?.trim() || "(没有名字的块)";
272
- for (const u of Dn(a.files ?? {}).issues) o.push(`${r}:${u}`);
272
+ for (const d of Kn(a.files ?? {}).issues) o.push(`${r}:${d}`);
273
273
  }
274
274
  return { selected: s.length, issues: o };
275
275
  }
276
- const zn = "backend_open.py", Hn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
277
- function $e(s, o) {
278
- if (Hn.test(s)) return;
276
+ const Vn = "backend_open.py", Gn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
277
+ function Te(s, o) {
278
+ if (Gn.test(s)) return;
279
279
  const a = (s.split(/[?#]/)[0] ?? "").replace(/^\.\//, "").replace(/^\/+/, "");
280
280
  if (a in o) return a;
281
281
  const r = a.split("/").pop() ?? "";
282
- return r ? Object.keys(o).find((u) => (u.split("/").pop() ?? "") === r) : void 0;
282
+ return r ? Object.keys(o).find((d) => (d.split("/").pop() ?? "") === r) : void 0;
283
283
  }
284
- const Fe = "\0mb:";
285
- function Un(s) {
286
- return `${Fe}${s}\0`;
284
+ const qe = "\0mb:";
285
+ function Jn(s) {
286
+ return `${qe}${s}\0`;
287
287
  }
288
- const Kn = /<script\b([^>]*?)\bsrc\s*=\s*(["'])(.*?)\2([^>]*)>\s*<\/script\s*>/gi, qn = /<link\b([^>]*?)\bhref\s*=\s*(["'])(.*?)\2([^>]*?)\/?>/gi;
289
- function Vn(s, o) {
290
- const a = [], r = (f) => (a.push(f), Un(a.length - 1));
291
- return { html: s.replace(Kn, (f, m, v, h, T) => {
292
- const g = $e(h, o);
293
- return g === void 0 ? f : r(`<script${m}${T}>
294
- ${ze(o[g] ?? "")}
288
+ const Wn = /<script\b([^>]*?)\bsrc\s*=\s*(["'])(.*?)\2([^>]*)>\s*<\/script\s*>/gi, Yn = /<link\b([^>]*?)\bhref\s*=\s*(["'])(.*?)\2([^>]*?)\/?>/gi;
289
+ function Zn(s, o) {
290
+ const a = [], r = (f) => (a.push(f), Jn(a.length - 1));
291
+ return { html: s.replace(Wn, (f, p, b, v, E) => {
292
+ const g = Te(v, o);
293
+ return g === void 0 ? f : r(`<script${p}${E}>
294
+ ${Ve(o[g] ?? "")}
295
295
  <\/script>`);
296
- }).replace(qn, (f, m, v, h, T) => {
297
- if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${m}${T}`)) return f;
298
- const g = $e(h, o);
296
+ }).replace(Yn, (f, p, b, v, E) => {
297
+ if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${p}${E}`)) return f;
298
+ const g = Te(v, o);
299
299
  return g === void 0 ? f : r(`<style>
300
300
  ${o[g]}
301
301
  </style>`);
302
302
  }), slots: a };
303
303
  }
304
- function ze(s) {
304
+ function Ve(s) {
305
305
  return s.replace(/<\/(script)/gi, "<\\/$1");
306
306
  }
307
- function He(s, o) {
307
+ function Ge(s, o) {
308
308
  const a = /<\/head\s*>/i.exec(s);
309
309
  return a ? `${s.slice(0, a.index)}${o}${s.slice(a.index)}` : `${o}${s}`;
310
310
  }
311
- function Jn(s, o) {
312
- return o ? He(s, `<script>
313
- ${ze(o)}
311
+ function Xn(s, o) {
312
+ return o ? Ge(s, `<script>
313
+ ${Ve(o)}
314
314
  <\/script>
315
315
  `) : s;
316
316
  }
317
- function we(s, o) {
318
- return o ? He(s, `<style data-magic-block="host">
317
+ function Se(s, o) {
318
+ return o ? Ge(s, `<style data-magic-block="host">
319
319
  ${o}
320
320
  </style>
321
321
  `) : s;
322
322
  }
323
- function Gn(s, o = {}) {
324
- const a = o.bootstrap ?? "", r = o.css ?? "", u = o.themeCss ?? "", b = s[Bt];
325
- if (b === void 0) return "";
326
- const { html: f, slots: m } = Vn(b, s), v = Jn(we(we(f, u), r), a), h = v.split(Fe);
327
- if (h.length === 1) return v;
328
- let T = h[0] ?? "";
329
- for (let g = 1; g < h.length; g += 1) {
330
- const S = h[g] ?? "", F = S.indexOf("\0"), H = Number(S.slice(0, F));
331
- T += (m[H] ?? "") + S.slice(F + 1);
323
+ function Qn(s, o = {}) {
324
+ const a = o.bootstrap ?? "", r = o.css ?? "", d = o.themeCss ?? "", h = s[Mt];
325
+ if (h === void 0) return "";
326
+ const { html: f, slots: p } = Zn(h, s), b = Xn(Se(Se(f, d), r), a), v = b.split(qe);
327
+ if (v.length === 1) return b;
328
+ let E = v[0] ?? "";
329
+ for (let g = 1; g < v.length; g += 1) {
330
+ const S = v[g] ?? "", L = S.indexOf("\0"), q = Number(S.slice(0, L));
331
+ E += (p[q] ?? "") + S.slice(L + 1);
332
332
  }
333
- return T;
333
+ return E;
334
334
  }
335
- const St = /* @__PURE__ */ new Map();
335
+ const At = /* @__PURE__ */ new Map();
336
336
  let wt = null;
337
- const ae = /* @__PURE__ */ new Set();
338
- function Wn(s) {
339
- return ae.add(s), () => {
340
- ae.delete(s);
337
+ const ue = /* @__PURE__ */ new Set();
338
+ function to(s) {
339
+ return ue.add(s), () => {
340
+ ue.delete(s);
341
341
  };
342
342
  }
343
- function Yn() {
344
- St.clear(), wt = null;
345
- for (const s of ae) s();
343
+ function eo() {
344
+ At.clear(), wt = null;
345
+ for (const s of ue) s();
346
346
  }
347
- async function Zn(s) {
347
+ async function no(s) {
348
348
  const o = [...new Set(s)].filter(Boolean);
349
- if (o.some((a) => !St.has(a))) {
349
+ if (o.some((a) => !At.has(a))) {
350
350
  wt && await wt.catch(() => {
351
351
  });
352
- const a = o.filter((r) => !St.has(r));
353
- a.length > 0 && (wt = Z(`/magic-blocks/render?ids=${a.map(encodeURIComponent).join(",")}`).then((r) => {
354
- for (const u of r) u?.id && St.set(u.id, u);
352
+ const a = o.filter((r) => !At.has(r));
353
+ a.length > 0 && (wt = Y(`/magic-blocks/render?ids=${a.map(encodeURIComponent).join(",")}`).then((r) => {
354
+ for (const d of r) d?.id && At.set(d.id, d);
355
355
  return r;
356
356
  }).catch(() => []).finally(() => {
357
357
  wt = null;
358
358
  }), await wt.catch(() => {
359
359
  }));
360
360
  }
361
- return o.map((a) => St.get(a)).filter((a) => !!a);
361
+ return o.map((a) => At.get(a)).filter((a) => !!a);
362
362
  }
363
- const pt = "labull.css", Dt = "CONTROLS.lock.html";
364
- function Xn(s, o) {
363
+ const pt = "labull.css", Ht = "CONTROLS.lock.html";
364
+ function oo(s, o) {
365
365
  const a = String(o || "");
366
366
  if (/@font-face|@keyframes/i.test(a)) return !0;
367
367
  const r = String(s || "");
368
368
  return /(^|[\s,>+~])(\.p-|\.pi(?![a-z])|\.pi-|\.labull-|:root|html(?![a-z-])|body(?![a-z-])|\*|:where\()/.test(r) ? !0 : /--(?:sp|surface|primary|text-color|content|highlight|focus-ring|p-)/.test(a);
369
369
  }
370
- function Ue(s, o, a) {
370
+ function Je(s, o, a) {
371
371
  for (let r = 0; r < s.length; r += 1) {
372
- const u = s[r], b = String(u.cssText || ""), f = String(u.selectorText || "");
373
- if (u.cssRules && u.cssRules.length > 0) {
374
- const m = [];
375
- if (Ue(u.cssRules, m, a), m.length === 0) continue;
376
- const v = b.slice(0, b.indexOf("{")).trim();
377
- o.push(`${v} {
378
- ${m.map((h) => " " + h).join(`
372
+ const d = s[r], h = String(d.cssText || ""), f = String(d.selectorText || "");
373
+ if (d.cssRules && d.cssRules.length > 0) {
374
+ const p = [];
375
+ if (Je(d.cssRules, p, a), p.length === 0) continue;
376
+ const b = h.slice(0, h.indexOf("{")).trim();
377
+ o.push(`${b} {
378
+ ${p.map((v) => " " + v).join(`
379
379
  `)}
380
380
  }`);
381
381
  continue;
382
382
  }
383
- Xn(f, b) && (o.push(b), a.n += 1);
383
+ oo(f, h) && (o.push(h), a.n += 1);
384
384
  }
385
385
  }
386
- function Ke() {
386
+ function We() {
387
387
  const s = [], o = [], a = { n: 0 };
388
388
  let r = 0;
389
- const u = typeof document > "u" ? [] : Array.from(document.styleSheets);
390
- for (const f of u) {
391
- const m = f.href || "(内联 <style>)";
392
- let v = null;
389
+ const d = typeof document > "u" ? [] : Array.from(document.styleSheets);
390
+ for (const f of d) {
391
+ const p = f.href || "(内联 <style>)";
392
+ let b = null;
393
393
  try {
394
- v = f.cssRules;
394
+ b = f.cssRules;
395
395
  } catch {
396
- o.push(m);
396
+ o.push(p);
397
397
  continue;
398
398
  }
399
- if (!v || v.length === 0) continue;
400
- const h = [];
401
- Ue(v, h, a), h.length !== 0 && (r += 1, s.push(`/* ── ${m} ── */`, ...h));
399
+ if (!b || b.length === 0) continue;
400
+ const v = [];
401
+ Je(b, v, a), v.length !== 0 && (r += 1, s.push(`/* ── ${p} ── */`, ...v));
402
402
  }
403
403
  return { css: [
404
404
  "/* 生成物:每次导出都会重写,别手改。",
@@ -409,7 +409,7 @@ function Ke() {
409
409
  " *",
410
410
  " * 怎么用(块里):**什么都不用加** —— 宿主会把这一份注入每个块的 iframe(`MagicBlockHost` 的 `theme` prop),",
411
411
  ' * 所以直接写类名就行:`<button class="p-button">` / `<input class="p-inputtext">` / `<span class="p-tag">`。',
412
- " * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" + Dt + "` 里的每一块 markup 都能直接用)。",
412
+ " * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" + Ht + "` 里的每一块 markup 都能直接用)。",
413
413
  " * ⚠️ 别把它当块包文件塞进块里:它 500 KB 上下,而且宿主已经注入了一份(重复只会更慢)。",
414
414
  " * ⚠️ 块里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为,",
415
415
  " * 这里能用的是类名(按钮、输入框、标签、面板、表格、图标)。",
@@ -420,7 +420,7 @@ function Ke() {
420
420
  `) + `
421
421
  `, sheets: r, skipped: o, rules: a.n };
422
422
  }
423
- function Qn() {
423
+ function so() {
424
424
  const a = [
425
425
  ["按钮", '<button class="p-button" type="button">主要按钮</button>'],
426
426
  ["次要按钮", '<button class="p-button p-button-outlined" type="button">次要按钮</button>'],
@@ -438,10 +438,10 @@ function Qn() {
438
438
  ["面板 + 标题", '<div class="labull-panel"><h2 class="labull-subject-title"><i class="pi pi-list"></i> 面板标题</h2><p>面板正文。</p></div>'],
439
439
  ["表格", "<table><thead><tr><th>列 A</th><th>列 B</th></tr></thead><tbody><tr><td>值</td><td>值</td></tr></tbody></table>"]
440
440
  ].map(
441
- ([r, u]) => ` <section>
441
+ ([r, d]) => ` <section>
442
442
  <h3>${r}</h3>
443
- <div class="demo">${u}</div>
444
- <pre>${u.replace(/&/g, "&amp;").replace(/</g, "&lt;")}</pre>
443
+ <div class="demo">${d}</div>
444
+ <pre>${d.replace(/&/g, "&amp;").replace(/</g, "&lt;")}</pre>
445
445
  </section>`
446
446
  ).join(`
447
447
  `);
@@ -481,60 +481,60 @@ ${a}
481
481
  </html>
482
482
  `;
483
483
  }
484
- const bt = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Set(), to = 4e3;
485
- let ie = "", Nt = null;
486
- function xe() {
487
- for (const s of le) s();
484
+ const ft = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Set(), ao = 4e3;
485
+ let de = "", zt = null;
486
+ function Be() {
487
+ for (const s of ce) s();
488
488
  }
489
- function eo(s) {
490
- return le.add(s), () => {
491
- le.delete(s);
489
+ function lo(s) {
490
+ return ce.add(s), () => {
491
+ ce.delete(s);
492
492
  };
493
493
  }
494
- function Qt() {
495
- return ie;
494
+ function oe() {
495
+ return de;
496
496
  }
497
- function no(s, o) {
497
+ function io(s, o) {
498
498
  const a = String(s || "").trim(), r = String(o || "").trim();
499
499
  if (!a || !r) return () => {
500
500
  };
501
- let u = bt.get(a);
502
- return u || (u = /* @__PURE__ */ new Set(), bt.set(a, u)), u.add(r), () => {
503
- const b = bt.get(a);
504
- b && (b.delete(r), b.size === 0 && bt.delete(a));
501
+ let d = ft.get(a);
502
+ return d || (d = /* @__PURE__ */ new Set(), ft.set(a, d)), d.add(r), () => {
503
+ const h = ft.get(a);
504
+ h && (h.delete(r), h.size === 0 && ft.delete(a));
505
505
  };
506
506
  }
507
- function re(s, o, a) {
508
- const r = bt.get(String(s || ""));
507
+ function pe(s, o, a) {
508
+ const r = ft.get(String(s || ""));
509
509
  if (!r) return null;
510
- for (const u of r)
511
- if (u !== o && !(a && !a(u)))
512
- return u;
510
+ for (const d of r)
511
+ if (d !== o && !(a && !a(d)))
512
+ return d;
513
513
  return null;
514
514
  }
515
- function oo(s) {
516
- return [...bt.get(String(s || "")) ?? []];
515
+ function ro(s) {
516
+ return [...ft.get(String(s || "")) ?? []];
517
517
  }
518
- function so(s, o, a) {
519
- const r = bt.get(String(s || ""));
520
- return !r || r.size === 0 || r.has(o) ? null : re(s, o, a);
518
+ function uo(s, o, a) {
519
+ const r = ft.get(String(s || ""));
520
+ return !r || r.size === 0 || r.has(o) ? null : pe(s, o, a);
521
521
  }
522
- function qe(s, o = to) {
523
- ie = String(s || ""), Nt !== null && clearTimeout(Nt), Nt = setTimeout(() => {
524
- Nt = null, ie = "", xe();
525
- }, Math.max(1, o)), xe();
522
+ function Ye(s, o = ao) {
523
+ de = String(s || ""), zt !== null && clearTimeout(zt), zt = setTimeout(() => {
524
+ zt = null, de = "", Be();
525
+ }, Math.max(1, o)), Be();
526
526
  }
527
- const ao = ["data-magic-block", "data-magic-module"], lo = ["srcdoc", "title"], io = { class: "mb__state" }, ro = { class: "mb__brief" }, uo = {
527
+ const co = ["data-magic-block", "data-magic-module"], po = ["srcdoc", "title"], fo = { class: "mb__state" }, mo = { class: "mb__brief" }, bo = {
528
528
  key: 0,
529
529
  class: "mb__reason"
530
- }, co = {
530
+ }, vo = {
531
531
  key: 1,
532
532
  class: "mb__issues"
533
- }, po = {
533
+ }, ho = {
534
534
  key: 2,
535
535
  class: "mb__ring",
536
536
  "aria-hidden": "true"
537
- }, bo = ["title", "aria-label"], fo = ["title", "aria-label"], mo = ["title", "aria-label"], vo = ["title", "aria-label"], ho = /* @__PURE__ */ ue({
537
+ }, go = ["title", "aria-label"], _o = ["title", "aria-label"], yo = ["title", "aria-label"], ko = ["title", "aria-label"], $o = /* @__PURE__ */ fe({
538
538
  __name: "MagicBlockHost",
539
539
  props: {
540
540
  uuid: {},
@@ -543,74 +543,74 @@ const ao = ["data-magic-block", "data-magic-module"], lo = ["srcdoc", "title"],
543
543
  theme: { type: Boolean, default: !0 }
544
544
  },
545
545
  setup(s) {
546
- const o = s, a = kn(), r = Re(), { isStaff: u } = je(), b = k(null), f = k(null), m = k(null), v = k(!1), h = k(0), T = k(0);
547
- let g = null, S = null, F = null, H = null, V = null, nt = null;
548
- const rt = P(() => o.name.trim() || o.uuid), M = P(() => m.value?.state ?? ""), $ = P(() => M.value === "invalid" ? "校验不通过" : M.value === "draft" ? "未开发" : rt.value), xt = P(() => (m.value?.brief ?? "").trim() || (m.value?.name ?? "").trim() || rt.value), X = P(() => (m.value?.reason ?? "").trim()), ft = P(() => m.value?.issues ?? []), Ct = P(() => Math.max(T.value, h.value, 1)), z = P(() => ({ height: `${Ct.value}px` })), L = P(() => {
546
+ const o = s, a = En(), r = Ie(), { isStaff: d } = Ne(), h = k(null), f = k(null), p = k(null), b = k(!1), v = k(0), E = k(0);
547
+ let g = null, S = null, L = null, q = null, V = null, nt = null;
548
+ const it = P(() => o.name.trim() || o.uuid), A = P(() => p.value?.state ?? ""), $ = P(() => A.value === "invalid" ? "校验不通过" : A.value === "draft" ? "未开发" : it.value), Ct = P(() => (p.value?.brief ?? "").trim() || (p.value?.name ?? "").trim() || it.value), Z = P(() => (p.value?.reason ?? "").trim()), mt = P(() => p.value?.issues ?? []), Et = P(() => Math.max(E.value, v.value, 1)), z = P(() => ({ height: `${Et.value}px` })), I = P(() => {
549
549
  const y = {};
550
- for (const [_, N] of Object.entries(m.value?.files ?? {})) _ !== zn && (y[_] = N);
550
+ for (const [_, D] of Object.entries(p.value?.files ?? {})) _ !== Vn && (y[_] = D);
551
551
  return y;
552
- }), U = P(() => M.value === "ok" && typeof L.value[Bt] == "string");
553
- let J = null;
552
+ }), H = P(() => A.value === "ok" && typeof I.value[Mt] == "string");
553
+ let G = null;
554
554
  function ot() {
555
555
  if (!o.theme) return "";
556
- if (J !== null || (J = "", typeof document > "u")) return J;
556
+ if (G !== null || (G = "", typeof document > "u")) return G;
557
557
  try {
558
- J = Ke().css;
558
+ G = We().css;
559
559
  } catch {
560
- J = "";
560
+ G = "";
561
561
  }
562
- return J;
562
+ return G;
563
563
  }
564
- const mt = P(() => {
565
- if (!U.value) return "";
566
- const y = { bootstrap: xn, css: wn }, _ = ot();
567
- return _ && (y.themeCss = _), Gn(L.value, y);
564
+ const bt = P(() => {
565
+ if (!H.value) return "";
566
+ const y = { bootstrap: Bn, css: Sn }, _ = ot();
567
+ return _ && (y.themeCss = _), Qn(I.value, y);
568
568
  });
569
- function At() {
569
+ function Rt() {
570
570
  return { key: a.key, path: a.path, params: a.params, query: a.query };
571
571
  }
572
- async function Ht(y) {
572
+ async function qt(y) {
573
573
  const _ = r.resolve(y);
574
574
  if (_.matched.length === 0) {
575
- const N = r.getRoutes().map((tt) => tt.path);
576
- throw new Error(`这个应用里没有页面 ${y}。能跳的页面只有:${N.length > 0 ? N.join(" / ") : "(还没有配路由)"}`);
575
+ const D = r.getRoutes().map((Q) => Q.path);
576
+ throw new Error(`这个应用里没有页面 ${y}。能跳的页面只有:${D.length > 0 ? D.join(" / ") : "(还没有配路由)"}`);
577
577
  }
578
- return oe(y) || _.fullPath;
578
+ return ie(y) || _.fullPath;
579
579
  }
580
580
  function st() {
581
- F?.(), F = null;
581
+ L?.(), L = null;
582
582
  const y = f.value;
583
- y && (F = Tn(y, {
583
+ y && (L = On(y, {
584
584
  uuid: o.uuid,
585
585
  onHeight: (_) => {
586
- h.value = _;
586
+ v.value = _;
587
587
  },
588
- onNavigateTab: Ht,
589
- context: At,
588
+ onNavigateTab: qt,
589
+ context: Rt,
590
590
  /* 🔴 块给**自己所属那条标签**起名:整页就是一个块时(`MagicBlockPage`),标签栏上那条
591
591
  * 默认只有路由的 `meta.title`("订单详情"),而"订单 SO-42"只有块自己知道。 */
592
- onTabTitle: (_, N) => a.setTitle(_, N)
592
+ onTabTitle: (_, D) => a.setTitle(_, D)
593
593
  }));
594
594
  }
595
- async function Q() {
596
- const y = o.uuid, _ = await Zn([y]);
597
- y === o.uuid && (m.value = _.find((N) => N.id === y) ?? null);
595
+ async function X() {
596
+ const y = o.uuid, _ = await no([y]);
597
+ y === o.uuid && (p.value = _.find((D) => D.id === y) ?? null);
598
598
  }
599
- function I() {
599
+ function N() {
600
600
  window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid: o.uuid } }));
601
601
  }
602
602
  function at(y = !1) {
603
- y && V?.(), V = no(o.uuid, a.key);
603
+ y && V?.(), V = io(o.uuid, a.key);
604
604
  }
605
- const lt = (y) => !Oe(y, r), K = P(() => {
606
- if (!u.value) return "";
607
- const y = re(o.uuid, a.key, lt);
605
+ const lt = (y) => !De(y, r), U = P(() => {
606
+ if (!d.value) return "";
607
+ const y = pe(o.uuid, a.key, lt);
608
608
  return y ? `管理员:切到还挂着这个块的标签 ${y}(点一下这一块会亮红框)` : "管理员:这个块只在这一条标签里挂着 —— 点一下会亮几秒红框";
609
609
  });
610
- function G() {
611
- if (!u.value) return;
612
- const y = re(o.uuid, a.key, lt);
613
- qe(o.uuid), y && oe(y);
610
+ function J() {
611
+ if (!d.value) return;
612
+ const y = pe(o.uuid, a.key, lt);
613
+ Ye(o.uuid), y && ie(y);
614
614
  }
615
615
  function vt(y) {
616
616
  let _ = y.parentElement;
@@ -620,111 +620,111 @@ const ao = ["data-magic-block", "data-magic-module"], lo = ["srcdoc", "title"],
620
620
  }
621
621
  return document.documentElement;
622
622
  }
623
- function ut() {
624
- const y = b.value;
623
+ function rt() {
624
+ const y = h.value;
625
625
  if (!y) return 0;
626
- const _ = vt(y), N = getComputedStyle(_), tt = parseFloat(N.paddingTop) || 0, Rt = parseFloat(N.paddingBottom) || 0, Ut = parseFloat(N.borderTopWidth) || 0, R = _ === document.documentElement, B = R ? Math.max(0, window.innerHeight - tt - Rt) : Math.max(0, _.clientHeight - tt - Rt), Kt = R ? tt : _.getBoundingClientRect().top + Ut + tt, W = R ? window.scrollY || 0 : _.scrollTop, it = y.getBoundingClientRect().top - Kt + W;
627
- return Math.max(0, Math.floor(B - it));
626
+ const _ = vt(y), D = getComputedStyle(_), Q = parseFloat(D.paddingTop) || 0, jt = parseFloat(D.paddingBottom) || 0, Vt = parseFloat(D.borderTopWidth) || 0, O = _ === document.documentElement, B = O ? Math.max(0, window.innerHeight - Q - jt) : Math.max(0, _.clientHeight - Q - jt), Gt = O ? Q : _.getBoundingClientRect().top + Vt + Q, Tt = O ? window.scrollY || 0 : _.scrollTop, Pt = y.getBoundingClientRect().top - Gt + Tt;
627
+ return Math.max(0, Math.floor(B - Pt));
628
628
  }
629
- function ct() {
630
- if (!a.active.value || !b.value) return;
631
- const y = ut();
632
- y > 0 && Math.abs(y - T.value) > 1 && (T.value = y);
629
+ function ut() {
630
+ if (!a.active.value || !h.value) return;
631
+ const y = rt();
632
+ y > 0 && Math.abs(y - E.value) > 1 && (E.value = y);
633
633
  }
634
634
  function ht() {
635
- if (!b.value) return;
636
- const y = vt(b.value);
637
- g !== y && (g = y, S?.disconnect(), S = null), ct(), !(S || typeof ResizeObserver > "u") && (S = new ResizeObserver(() => ct()), S.observe(y));
635
+ if (!h.value) return;
636
+ const y = vt(h.value);
637
+ g !== y && (g = y, S?.disconnect(), S = null), ut(), !(S || typeof ResizeObserver > "u") && (S = new ResizeObserver(() => ut()), S.observe(y));
638
638
  }
639
- return $t(f, () => st()), $t(mt, () => {
640
- h.value = 0, T.value = 0, ht();
639
+ return $t(f, () => st()), $t(bt, () => {
640
+ v.value = 0, E.value = 0, ht();
641
641
  }, { flush: "post" }), $t(() => o.uuid, () => {
642
- _e().then(() => ht());
642
+ xe().then(() => ht());
643
643
  }), $t(() => a.active.value, (y) => {
644
- y && _e().then(() => {
644
+ y && xe().then(() => {
645
645
  ht();
646
- const _ = b.value;
647
- !_ || !_.isConnected || _.offsetParent === null || v.value && _.scrollIntoView({ behavior: "smooth", block: "center" });
646
+ const _ = h.value;
647
+ !_ || !_.isConnected || _.offsetParent === null || b.value && _.scrollIntoView({ behavior: "smooth", block: "center" });
648
648
  });
649
649
  }), $t(() => o.uuid, () => {
650
- h.value = 0, m.value = null, at(!0), v.value = Qt() === o.uuid, Q();
651
- }), Se(() => {
652
- H = Wn(() => void Q()), nt = eo(() => {
653
- v.value = Qt() === o.uuid;
654
- }), v.value = Qt() === o.uuid, at(), ht(), Q();
655
- }), Be(() => {
656
- S?.disconnect(), S = null, H?.(), H = null, nt?.(), nt = null, V?.(), V = null, F?.(), F = null;
657
- }), (y, _) => (c(), d("div", {
650
+ v.value = 0, p.value = null, at(!0), b.value = oe() === o.uuid, X();
651
+ }), Re(() => {
652
+ q = to(() => void X()), nt = lo(() => {
653
+ b.value = oe() === o.uuid;
654
+ }), b.value = oe() === o.uuid, at(), ht(), X();
655
+ }), je(() => {
656
+ S?.disconnect(), S = null, q?.(), q = null, nt?.(), nt = null, V?.(), V = null, L?.(), L = null;
657
+ }), (y, _) => (u(), c("div", {
658
658
  ref_key: "el",
659
- ref: b,
660
- class: Y(["mb", { "mb--admin": Tt(u), "mb--lit": Tt(u) && v.value }]),
661
- style: Me(z.value),
659
+ ref: h,
660
+ class: W(["mb", { "mb--admin": Bt(d), "mb--lit": Bt(d) && b.value }]),
661
+ style: Pe(z.value),
662
662
  "data-magic-block": s.uuid,
663
663
  "data-magic-module": s.module
664
664
  }, [
665
- U.value ? (c(), d("iframe", {
665
+ H.value ? (u(), c("iframe", {
666
666
  key: 0,
667
667
  ref_key: "frame",
668
668
  ref: f,
669
669
  class: "mb__frame",
670
- srcdoc: mt.value,
671
- title: rt.value,
670
+ srcdoc: bt.value,
671
+ title: it.value,
672
672
  scrolling: "no",
673
673
  sandbox: "allow-scripts allow-forms allow-modals allow-popups allow-downloads"
674
- }, null, 8, lo)) : (c(), d("div", {
674
+ }, null, 8, po)) : (u(), c("div", {
675
675
  key: 1,
676
- class: Y(["mb__empty", { "mb__empty--off": M.value === "invalid", "mb__empty--draft": M.value === "draft" }]),
677
- onClick: G
676
+ class: W(["mb__empty", { "mb__empty--off": A.value === "invalid", "mb__empty--draft": A.value === "draft" }]),
677
+ onClick: J
678
678
  }, [
679
- l("p", io, p($.value), 1),
680
- l("p", ro, p(xt.value), 1),
681
- M.value === "invalid" && X.value ? (c(), d("p", uo, p(X.value), 1)) : x("", !0),
682
- M.value === "invalid" && ft.value.length > 0 ? (c(), d("ul", co, [
683
- (c(!0), d(E, null, O(ft.value, (N, tt) => (c(), d("li", {
684
- key: tt,
679
+ l("p", fo, m($.value), 1),
680
+ l("p", mo, m(Ct.value), 1),
681
+ A.value === "invalid" && Z.value ? (u(), c("p", bo, m(Z.value), 1)) : x("", !0),
682
+ A.value === "invalid" && mt.value.length > 0 ? (u(), c("ul", vo, [
683
+ (u(!0), c(T, null, j(mt.value, (D, Q) => (u(), c("li", {
684
+ key: Q,
685
685
  class: "mb__issue"
686
- }, p(N.message), 1))), 128))
686
+ }, m(D.message), 1))), 128))
687
687
  ])) : x("", !0),
688
688
  l("button", {
689
689
  class: "mb__go",
690
690
  type: "button",
691
- onClick: Ae(I, ["stop"])
691
+ onClick: Le(N, ["stop"])
692
692
  }, "去控制台")
693
693
  ], 2)),
694
- Tt(u) ? (c(), d("span", po)) : x("", !0),
695
- Tt(u) && U.value ? (c(), d(E, { key: 3 }, [
694
+ Bt(d) ? (u(), c("span", ho)) : x("", !0),
695
+ Bt(d) && H.value ? (u(), c(T, { key: 3 }, [
696
696
  l("button", {
697
697
  class: "mb__grab mb__grab--top",
698
698
  type: "button",
699
- title: K.value,
700
- "aria-label": K.value,
701
- onClick: G
702
- }, null, 8, bo),
699
+ title: U.value,
700
+ "aria-label": U.value,
701
+ onClick: J
702
+ }, null, 8, go),
703
703
  l("button", {
704
704
  class: "mb__grab mb__grab--right",
705
705
  type: "button",
706
- title: K.value,
707
- "aria-label": K.value,
708
- onClick: G
709
- }, null, 8, fo),
706
+ title: U.value,
707
+ "aria-label": U.value,
708
+ onClick: J
709
+ }, null, 8, _o),
710
710
  l("button", {
711
711
  class: "mb__grab mb__grab--bottom",
712
712
  type: "button",
713
- title: K.value,
714
- "aria-label": K.value,
715
- onClick: G
716
- }, null, 8, mo),
713
+ title: U.value,
714
+ "aria-label": U.value,
715
+ onClick: J
716
+ }, null, 8, yo),
717
717
  l("button", {
718
718
  class: "mb__grab mb__grab--left",
719
719
  type: "button",
720
- title: K.value,
721
- "aria-label": K.value,
722
- onClick: G
723
- }, null, 8, vo)
720
+ title: U.value,
721
+ "aria-label": U.value,
722
+ onClick: J
723
+ }, null, 8, ko)
724
724
  ], 64)) : x("", !0)
725
- ], 14, ao));
725
+ ], 14, co));
726
726
  }
727
- }), go = /* @__PURE__ */ Pe(ho, [["__scopeId", "data-v-8e1e849f"]]), Ya = /* @__PURE__ */ ue({
727
+ }), wo = /* @__PURE__ */ Fe($o, [["__scopeId", "data-v-8e1e849f"]]), ol = /* @__PURE__ */ fe({
728
728
  __name: "MagicBlockPage",
729
729
  props: {
730
730
  uuid: {},
@@ -733,21 +733,21 @@ const ao = ["data-magic-block", "data-magic-module"], lo = ["srcdoc", "title"],
733
733
  theme: { type: Boolean, default: !0 }
734
734
  },
735
735
  setup(s) {
736
- return (o, a) => (c(), gn(go, {
736
+ return (o, a) => (u(), wn(wo, {
737
737
  uuid: s.uuid,
738
738
  name: s.name,
739
739
  module: s.module,
740
740
  theme: s.theme
741
741
  }, null, 8, ["uuid", "name", "module", "theme"]));
742
742
  }
743
- }), te = "pages.lock.ts";
744
- function _o(s, o) {
743
+ }), se = "pages.lock.ts";
744
+ function xo(s, o) {
745
745
  const a = String(s || "").split(/[^A-Za-z0-9]+/).filter(Boolean);
746
746
  if (a.length === 0) return `Page${o + 1}`;
747
- const r = a.map((u) => u[0].toUpperCase() + u.slice(1)).join("");
747
+ const r = a.map((d) => d[0].toUpperCase() + d.slice(1)).join("");
748
748
  return /^[0-9]/.test(r) ? `P${r}` : r;
749
749
  }
750
- function yo(s, o) {
750
+ function Co(s, o) {
751
751
  if (!o.has(s))
752
752
  return o.add(s), s;
753
753
  let a = 2;
@@ -755,14 +755,14 @@ function yo(s, o) {
755
755
  const r = `${s}${a}`;
756
756
  return o.add(r), r;
757
757
  }
758
- function ko(s) {
759
- const o = (s ?? []).filter((b) => b && typeof b.path == "string" && b.path.trim() !== ""), a = /* @__PURE__ */ new Set(), r = [];
760
- o.forEach((b, f) => {
761
- const m = b.group?.trim() || "(没写 meta.group)";
762
- let v = r.find((h) => h.title === m);
763
- v || (v = { title: m, rows: [] }, r.push(v)), v.rows.push({ key: yo(_o(b.path, f), a), row: b });
758
+ function Eo(s) {
759
+ const o = (s ?? []).filter((h) => h && typeof h.path == "string" && h.path.trim() !== ""), a = /* @__PURE__ */ new Set(), r = [];
760
+ o.forEach((h, f) => {
761
+ const p = h.group?.trim() || "(没写 meta.group)";
762
+ let b = r.find((v) => v.title === p);
763
+ b || (b = { title: p, rows: [] }, r.push(b)), b.rows.push({ key: Co(xo(h.path, f), a), row: h });
764
764
  });
765
- const u = [
765
+ const d = [
766
766
  "/* 生成物:**每次导出都会重写**,别手改 —— 改了下次导出就没了。",
767
767
  " *",
768
768
  " * 这个文件回答「块的前端(index.open.html 那一侧)里我能跳哪些页面、能调什么」。",
@@ -788,17 +788,17 @@ function ko(s) {
788
788
  ""
789
789
  ];
790
790
  if (r.length === 0)
791
- u.push("/* ⚠️ 这次导出没拿到路由表(这个应用没装 vue-router,或者一条页面路由都没有)。 */", "export const Page = {} as const", "");
791
+ d.push("/* ⚠️ 这次导出没拿到路由表(这个应用没装 vue-router,或者一条页面路由都没有)。 */", "export const Page = {} as const", "");
792
792
  else {
793
- u.push("export const Page = {");
794
- for (const b of r) {
795
- u.push(` // ── ${b.title} ──`);
796
- for (const f of b.rows)
797
- u.push(` /** ${f.row.title?.trim() || f.row.path}(${f.row.path}) */`), u.push(` ${f.key}: '${f.row.path}',`);
793
+ d.push("export const Page = {");
794
+ for (const h of r) {
795
+ d.push(` // ── ${h.title} ──`);
796
+ for (const f of h.rows)
797
+ d.push(` /** ${f.row.title?.trim() || f.row.path}(${f.row.path}) */`), d.push(` ${f.key}: '${f.row.path}',`);
798
798
  }
799
- u.push("} as const", "");
799
+ d.push("} as const", "");
800
800
  }
801
- return u.push(
801
+ return d.push(
802
802
  "/** `Page` 里那些路径的联合类型(只想收页面路径的参数可以写它)。 */",
803
803
  "export type PagePath = (typeof Page)[keyof typeof Page]",
804
804
  "",
@@ -850,327 +850,343 @@ function ko(s) {
850
850
  "",
851
851
  "export {}",
852
852
  ""
853
- ), u.join(`
853
+ ), d.join(`
854
854
  `);
855
855
  }
856
- function Ve() {
856
+ function Ze() {
857
857
  return typeof window < "u" && typeof window.showDirectoryPicker == "function";
858
858
  }
859
- const $o = "这个浏览器没法直接写你本机的文件夹(少了 File System Access API):请用 Chrome / Edge,并且从 https 或 http://localhost 打开这个页面(内网 http 会更少 API)。";
860
- async function ee() {
861
- if (!Ve()) throw new Error($o);
859
+ const To = "这个浏览器没法直接写你本机的文件夹(少了 File System Access API):请用 Chrome / Edge,并且从 https 或 http://localhost 打开这个页面(内网 http 会更少 API)。";
860
+ async function ae() {
861
+ if (!Ze()) throw new Error(To);
862
862
  try {
863
863
  const s = await window.showDirectoryPicker({ mode: "readwrite", id: "labull-magic-block" });
864
864
  return { name: s.name, handle: s };
865
865
  } catch (s) {
866
866
  const o = s instanceof Error ? s.name : "";
867
- throw o === "AbortError" ? new Error("取消选目录了:想导出就再点一次「选择文件夹」") : o === "SecurityError" ? new Error(`选不了这个目录:浏览器不让(${zt(s)})—— 换一个目录,或确认页面是 https / localhost`) : new Error(`选目录失败:${zt(s)}`);
867
+ throw o === "AbortError" ? new Error("取消选目录了:想导出就再点一次「选择文件夹」") : o === "SecurityError" ? new Error(`选不了这个目录:浏览器不让(${Kt(s)})—— 换一个目录,或确认页面是 https / localhost`) : new Error(`选目录失败:${Kt(s)}`);
868
868
  }
869
869
  }
870
- function zt(s) {
870
+ function Kt(s) {
871
871
  return (s instanceof Error ? s.message.trim() : String(s)) || "没有说原因";
872
872
  }
873
- function Je(s) {
873
+ function Xe(s) {
874
874
  const o = String(s ?? "").split("/");
875
875
  for (const a of o)
876
876
  if (!a || a === "." || a === ".." || a.includes("\\") || /^[A-Za-z]:/.test(a))
877
877
  throw new Error(`路径不合法:${s}(要相对路径,不许 .. / 盘符 / 反斜杠)`);
878
878
  return o;
879
879
  }
880
- const wo = 8;
881
- function xo(s) {
880
+ const So = 8;
881
+ async function xt(s, o) {
882
+ let a = 0;
883
+ const r = async () => {
884
+ for (; ; ) {
885
+ const d = a;
886
+ if (a += 1, d >= s.length) return;
887
+ await o(s[d], d);
888
+ }
889
+ };
890
+ await Promise.all(Array.from({ length: Math.max(1, Math.min(So, s.length)) }, () => r()));
891
+ }
892
+ function Bo(s) {
882
893
  const o = /* @__PURE__ */ new Map();
883
894
  return (a) => {
884
- const r = a.join("\0"), u = o.get(r);
885
- if (u) return u;
886
- let b = Promise.resolve(s);
895
+ const r = a.join("\0"), d = o.get(r);
896
+ if (d) return d;
897
+ let h = Promise.resolve(s);
887
898
  for (let f = 0; f < a.length; f += 1) {
888
- const m = a[f], v = a.slice(0, f + 1).join("\0"), h = o.get(v);
889
- b = h ?? b.then((T) => T.getDirectoryHandle(m, { create: !0 })), h || o.set(v, b);
899
+ const p = a[f], b = a.slice(0, f + 1).join("\0"), v = o.get(b);
900
+ h = v ?? h.then((E) => E.getDirectoryHandle(p, { create: !0 })), v || o.set(b, h);
890
901
  }
891
- return b;
902
+ return h;
892
903
  };
893
904
  }
894
- async function Co(s, o, a) {
895
- const r = Object.entries(o ?? {}).map(([T, g]) => ({ path: T, parts: Je(T), body: String(g ?? "") })), u = r.length, b = [], f = xo(s.handle);
896
- let m = 0, v = 0;
897
- a?.(0, u);
898
- const h = async () => {
899
- for (; ; ) {
900
- const T = m;
901
- m += 1;
902
- const g = r[T];
903
- if (!g) return;
905
+ async function Ao(s, o, a) {
906
+ const r = Object.entries(o ?? {}).map(([b, v]) => ({ path: b, parts: Xe(b), body: String(v ?? "") })), d = r.length, h = [], f = Bo(s.handle);
907
+ let p = 0;
908
+ return a?.(0, d), await xt(r, async (b) => {
909
+ try {
910
+ const g = await (await (await f(b.parts.slice(0, -1))).getFileHandle(b.parts[b.parts.length - 1], { create: !0 })).createWritable();
904
911
  try {
905
- const H = await (await (await f(g.parts.slice(0, -1))).getFileHandle(g.parts[g.parts.length - 1], { create: !0 })).createWritable();
906
- try {
907
- await H.write(g.body);
908
- } finally {
909
- await H.close();
910
- }
911
- v += 1;
912
- } catch (S) {
913
- b.push({ path: g.path, message: zt(S) });
912
+ await g.write(b.body);
913
+ } finally {
914
+ await g.close();
914
915
  }
915
- a?.(v + b.length, u);
916
+ p += 1;
917
+ } catch (v) {
918
+ h.push({ path: b.path, message: Kt(v) });
916
919
  }
917
- };
918
- return await Promise.all(Array.from({ length: Math.max(1, Math.min(wo, u)) }, () => h())), b.sort((T, g) => T.path < g.path ? -1 : T.path > g.path ? 1 : 0), { written: v, failed: b, total: u };
920
+ a?.(p + h.length, d);
921
+ }), h.sort((b, v) => b.path < v.path ? -1 : b.path > v.path ? 1 : 0), { written: p, failed: h, total: d };
919
922
  }
920
- async function Ce(s, o) {
921
- const a = { items: [], topCount: 0, files: 0, dirs: 0 }, r = async (u, b) => {
922
- for (const f of await Mt(u)) {
923
- if (f.kind === "file") {
923
+ async function Ae(s, o) {
924
+ const a = { items: [], topCount: 0, files: 0, dirs: 0 }, r = async (f, p) => {
925
+ const b = [];
926
+ for (const v of await Ot(f)) {
927
+ if (v.kind === "file") {
924
928
  a.files += 1;
925
929
  continue;
926
930
  }
927
- a.dirs += 1, !(b >= o.maxDepth) && (o.skipDirs.includes(f.name) || await r(f, b + 1));
931
+ a.dirs += 1, !(p >= o.maxDepth) && (o.skipDirs.includes(v.name) || b.push(v));
928
932
  }
929
- };
930
- for (const u of await Mt(s.handle))
931
- if (a.items.push({ name: u.name, dir: u.kind === "directory" }), u.kind === "file") a.files += 1;
933
+ await xt(b, (v) => r(v, p + 1));
934
+ }, d = await Ot(s.handle), h = [];
935
+ for (const f of d)
936
+ if (a.items.push({ name: f.name, dir: f.kind === "directory" }), f.kind === "file") a.files += 1;
932
937
  else {
933
- if (a.dirs += 1, o.skipDirs.includes(u.name) || o.maxDepth <= 0) continue;
934
- await r(u, 1);
938
+ if (a.dirs += 1, o.skipDirs.includes(f.name) || o.maxDepth <= 0) continue;
939
+ h.push(f);
935
940
  }
936
- return a.topCount = a.items.length, a;
941
+ return await xt(h, (f) => r(f, 1)), a.topCount = a.items.length, a;
937
942
  }
938
- async function Ee(s) {
943
+ async function Me(s) {
939
944
  const o = [];
940
- for (const r of await Mt(s.handle)) o.push(r.name);
945
+ for (const r of await Ot(s.handle)) o.push(r.name);
941
946
  let a = 0;
942
- for (const r of o)
947
+ return await xt(o, async (r) => {
943
948
  await s.handle.removeEntry(r, { recursive: !0 }), a += 1;
944
- return a;
949
+ }), a;
945
950
  }
946
- function Eo(s, o) {
951
+ function Mo(s, o) {
947
952
  if (s.name === o.blocksDir)
948
953
  throw new Error(
949
954
  `你选中的是「${o.blocksDir}」这一层(它就是放代码的那一层):导出会铺成 ${o.blocksDir}/${o.blocksDir}/…。请选它**上面**那一层 —— 也就是开发目录本身。`
950
955
  );
951
956
  }
952
- async function Mt(s) {
957
+ async function Ot(s) {
953
958
  const o = [];
954
959
  for await (const a of s.values()) o.push(a);
955
960
  return o.sort((a, r) => a.name < r.name ? -1 : a.name > r.name ? 1 : 0), o;
956
961
  }
957
- function To(s) {
962
+ function Oo(s) {
958
963
  return s.charCodeAt(0) === 65279 ? s.slice(1) : s;
959
964
  }
960
- function So(s) {
965
+ function Ro(s) {
961
966
  const o = s.lastIndexOf(".");
962
967
  return o <= 0 ? "" : s.slice(o).toLowerCase();
963
968
  }
964
- async function Ge(s, o, a, r) {
965
- const u = {};
966
- for (const b of await Mt(s)) {
967
- const f = o ? `${o}/${b.name}` : b.name;
968
- if (b.kind === "directory") {
969
- if (a.skipDirs.includes(b.name)) continue;
970
- const m = b;
971
- for (const [v, h] of Object.entries(await Ge(m, f, a, r)))
972
- u[`${b.name}/${v}`] = h;
973
- continue;
969
+ const jo = { folders: [], failures: [], truncated: !1 };
970
+ async function Qe(s, o, a) {
971
+ const r = await Ot(s), d = new Array(r.length);
972
+ await xt(r, async (p, b) => {
973
+ const v = o ? `${o}/${p.name}` : p.name, E = { files: {}, failures: [] };
974
+ if (d[b] = E, p.kind === "directory") {
975
+ if (a.skipDirs.includes(p.name)) return;
976
+ const S = await Qe(p, v, a);
977
+ for (const [L, q] of Object.entries(S.files))
978
+ E.files[`${p.name}/${L}`] = q;
979
+ E.failures.push(...S.failures);
980
+ return;
974
981
  }
975
- if (!a.platformFiles.includes(b.name)) {
976
- if (!a.textExt.includes(So(b.name))) {
977
- r.failures.push({
982
+ if (!a.platformFiles.includes(p.name)) {
983
+ if (!a.textExt.includes(Ro(p.name))) {
984
+ E.failures.push({
978
985
  kind: "file",
979
- where: f,
986
+ where: v,
980
987
  message: `不是文本文件(认得的扩展名:${a.textExt.join(" ")}),已跳过`
981
988
  });
982
- continue;
989
+ return;
983
990
  }
984
991
  try {
985
- const m = await b.getFile();
986
- if (m.size > a.maxFileBytes) {
987
- r.failures.push({
992
+ const g = await p.getFile();
993
+ if (g.size > a.maxFileBytes) {
994
+ E.failures.push({
988
995
  kind: "file",
989
- where: f,
990
- message: `文件 ${Math.round(m.size / 1024)} KB 超过上限 ${Math.floor(a.maxFileBytes / 1024)} KB,已跳过`
996
+ where: v,
997
+ message: `文件 ${Math.round(g.size / 1024)} KB 超过上限 ${Math.floor(a.maxFileBytes / 1024)} KB,已跳过`
991
998
  });
992
- continue;
999
+ return;
993
1000
  }
994
- u[b.name] = To(await m.text());
995
- } catch (m) {
996
- r.failures.push({ kind: "file", where: f, message: `读不了这个文件:${zt(m)}` });
1001
+ E.files[p.name] = Oo(await g.text());
1002
+ } catch (g) {
1003
+ E.failures.push({ kind: "file", where: v, message: `读不了这个文件:${Kt(g)}` });
997
1004
  }
998
1005
  }
999
- }
1000
- return u;
1006
+ });
1007
+ const h = {}, f = [];
1008
+ for (const p of d)
1009
+ p && (Object.assign(h, p.files), f.push(...p.failures));
1010
+ return { files: h, failures: f };
1001
1011
  }
1002
- async function We(s, o, a, r, u) {
1003
- const b = await Mt(s), f = b.filter((v) => v.kind === "directory"), m = b.filter((v) => v.kind === "file");
1004
- if (f.length === 0 || m.some((v) => v.name === r.entry)) {
1005
- u.folders.push({ where: o.join("/"), files: await Ge(s, o.join("/"), r, u) });
1006
- return;
1012
+ async function tn(s, o, a, r) {
1013
+ const d = await Ot(s), h = d.filter((g) => g.kind === "directory"), f = d.filter((g) => g.kind === "file"), p = o.join("/"), b = { folders: [], failures: [], truncated: !1 };
1014
+ if (h.length === 0 || f.some((g) => g.name === r.entry)) {
1015
+ const g = await Qe(s, p, r);
1016
+ return b.folders.push({ where: p, files: g.files }), b.failures.push(...g.failures), b;
1007
1017
  }
1008
- for (const v of m)
1009
- o.length === 0 && r.rootSkipFiles.includes(v.name.toLowerCase()) || u.failures.push({
1018
+ for (const g of f)
1019
+ o.length === 0 && r.rootSkipFiles.includes(g.name.toLowerCase()) || b.failures.push({
1010
1020
  kind: "file",
1011
- where: [...o, v.name].join("/"),
1021
+ where: [...o, g.name].join("/"),
1012
1022
  message: `这一层直接放着一份文件,但它自己不是块文件夹、也没有 ${r.entry},文件没有归属`
1013
1023
  });
1014
- for (const v of f)
1015
- if (!r.skipDirs.includes(v.name)) {
1016
- if (a >= r.maxDepth) {
1017
- u.truncated = !0, u.failures.push({
1018
- kind: "dir",
1019
- where: [...o, v.name].join("/"),
1020
- message: `超过最大层数 ${r.maxDepth} 层还没见到 ${r.entry},没有继续往下找`
1021
- });
1022
- continue;
1023
- }
1024
- await We(v, [...o, v.name], a + 1, r, u);
1025
- }
1024
+ const v = h.map((g) => async () => r.skipDirs.includes(g.name) ? jo : a >= r.maxDepth ? {
1025
+ folders: [],
1026
+ failures: [{
1027
+ kind: "dir",
1028
+ where: [...o, g.name].join("/"),
1029
+ message: `超过最大层数 ${r.maxDepth} 层还没见到 ${r.entry},没有继续往下找`
1030
+ }],
1031
+ truncated: !0
1032
+ } : tn(g, [...o, g.name], a + 1, r)), E = new Array(v.length);
1033
+ await xt(v, async (g, S) => {
1034
+ E[S] = await g();
1035
+ });
1036
+ for (const g of E)
1037
+ g && (b.folders.push(...g.folders), b.failures.push(...g.failures), g.truncated && (b.truncated = !0));
1038
+ return b;
1026
1039
  }
1027
- function Te(s) {
1040
+ function Oe(s) {
1028
1041
  return s >= 1024 * 1024 ? `${(s / 1024 / 1024).toFixed(1)} MB` : `${Math.max(1, Math.round(s / 1024))} KB`;
1029
1042
  }
1030
- async function Bo(s, o) {
1031
- const a = { root: s.name, folders: [], failures: [], truncated: !1 };
1032
- await We(s.handle, [], 0, o, a);
1033
- const r = a.folders.reduce(
1034
- (u, b) => u + Object.values(b.files).reduce((f, m) => f + m.length, 0),
1043
+ async function Po(s, o) {
1044
+ const a = await tn(s.handle, [], 0, o), r = {
1045
+ root: s.name,
1046
+ folders: a.folders,
1047
+ failures: a.failures,
1048
+ truncated: a.truncated
1049
+ }, d = r.folders.reduce(
1050
+ (h, f) => h + Object.values(f.files).reduce((p, b) => p + b.length, 0),
1035
1051
  0
1036
1052
  );
1037
- if (r > o.maxBodyBytes)
1053
+ if (d > o.maxBodyBytes)
1038
1054
  throw new Error(
1039
- `这个目录读到的正文有 ${Te(r)},超过一次读回的上限 ${Te(o.maxBodyBytes)}:请先只留要改的那几个块,或者把大文件挪走。`
1055
+ `这个目录读到的正文有 ${Oe(d)},超过一次读回的上限 ${Oe(o.maxBodyBytes)}:请先只留要改的那几个块,或者把大文件挪走。`
1040
1056
  );
1041
- return a;
1057
+ return r;
1042
1058
  }
1043
- const Mo = {
1059
+ const Lo = {
1044
1060
  key: 0,
1045
1061
  class: "mbc__shell"
1046
- }, Ao = { class: "mbc__head" }, Ro = ["title"], jo = ["disabled"], Oo = { class: "mbc__panel" }, Po = { class: "mbc__title" }, Lo = {
1062
+ }, Io = { class: "mbc__head" }, No = ["title"], Do = ["disabled"], Fo = { class: "mbc__panel" }, zo = { class: "mbc__title" }, Ho = {
1047
1063
  key: 0,
1048
1064
  class: "mbc__tagbar"
1049
- }, Io = ["title", "onClick"], No = { class: "mbc__list" }, Do = ["title", "onClick"], Fo = { class: "mbc__module" }, zo = { class: "mbc__name" }, Ho = ["title"], Uo = {
1065
+ }, Uo = ["title", "onClick"], Ko = { class: "mbc__list" }, qo = ["title", "onClick"], Vo = { class: "mbc__module" }, Go = { class: "mbc__name" }, Jo = ["title"], Wo = {
1050
1066
  key: 0,
1051
1067
  class: "mbc__where"
1052
- }, Ko = {
1068
+ }, Yo = {
1053
1069
  key: 0,
1054
1070
  class: "mbc__detail"
1055
- }, qo = {
1071
+ }, Zo = {
1056
1072
  key: 0,
1057
1073
  class: "mbc__hint"
1058
- }, Vo = { class: "mbc__meta" }, Jo = { class: "mbc__hint" }, Go = {
1074
+ }, Xo = { class: "mbc__meta" }, Qo = { class: "mbc__hint" }, ts = {
1059
1075
  key: 0,
1060
1076
  class: "mbc__hint"
1061
- }, Wo = ["disabled", "onClick"], Yo = ["onKeyup"], Zo = ["disabled", "onClick"], Xo = ["disabled"], Qo = {
1077
+ }, es = ["disabled", "onClick"], ns = ["onKeyup"], os = ["disabled", "onClick"], ss = ["disabled"], as = {
1062
1078
  key: 0,
1063
1079
  class: "mbc__tagbar"
1064
- }, ts = ["title", "onClick"], es = {
1080
+ }, ls = ["title", "onClick"], is = {
1065
1081
  key: 1,
1066
1082
  class: "mbc__tagbar"
1067
- }, ns = ["title", "onClick"], os = { class: "mbc__mono" }, ss = { class: "mbc__actions" }, as = ["disabled", "onClick"], ls = { class: "mbc__versions" }, is = { class: "mbc__versions-head" }, rs = ["disabled", "onClick"], us = {
1083
+ }, rs = ["title", "onClick"], us = { class: "mbc__mono" }, cs = { class: "mbc__actions" }, ds = ["disabled", "onClick"], ps = { class: "mbc__versions" }, fs = { class: "mbc__versions-head" }, ms = ["disabled", "onClick"], bs = {
1068
1084
  key: 0,
1069
1085
  class: "mbc__hint"
1070
- }, cs = {
1086
+ }, vs = {
1071
1087
  key: 1,
1072
1088
  class: "mbc__versions-list"
1073
- }, ds = { class: "mbc__mono" }, ps = { class: "mbc__hint" }, bs = { class: "mbc__actions" }, fs = ["disabled", "onClick", "title"], ms = ["disabled", "onClick", "title"], vs = ["disabled", "onClick", "title"], hs = ["disabled", "onClick", "title"], gs = {
1089
+ }, hs = { class: "mbc__mono" }, gs = { class: "mbc__hint" }, _s = { class: "mbc__actions" }, ys = ["disabled", "onClick", "title"], ks = ["disabled", "onClick", "title"], $s = ["disabled", "onClick", "title"], ws = ["disabled", "onClick", "title"], xs = {
1074
1090
  key: 2,
1075
1091
  class: "mbc__hint"
1076
- }, _s = {
1092
+ }, Cs = {
1077
1093
  key: 3,
1078
1094
  class: "mbc__viewer"
1079
- }, ys = { class: "mbc__versions-head" }, ks = { class: "mbc__mono" }, $s = { class: "mbc__viewer-body" }, ws = { class: "mbc__panel" }, xs = { class: "mbc__field" }, Cs = { class: "mbc__radio" }, Es = ["checked"], Ts = { class: "mbc__radio" }, Ss = ["checked"], Bs = ["value", "disabled"], Ms = {
1095
+ }, Es = { class: "mbc__versions-head" }, Ts = { class: "mbc__mono" }, Ss = { class: "mbc__viewer-body" }, Bs = { class: "mbc__panel" }, As = { class: "mbc__field" }, Ms = { class: "mbc__radio" }, Os = ["checked"], Rs = { class: "mbc__radio" }, js = ["checked"], Ps = ["value", "disabled"], Ls = {
1080
1096
  key: 0,
1081
1097
  value: ""
1082
- }, As = ["value"], Rs = { class: "mbc__field" }, js = ["value"], Os = ["disabled"], Ps = ["disabled", "title"], Ls = { class: "mbc__hint" }, Is = {
1098
+ }, Is = ["value"], Ns = { class: "mbc__field" }, Ds = ["value"], Fs = ["disabled"], zs = ["disabled", "title"], Hs = { class: "mbc__hint" }, Us = {
1083
1099
  key: 0,
1084
1100
  class: "mbc__hint"
1085
- }, Ns = ["aria-valuenow"], Ds = {
1101
+ }, Ks = ["aria-valuenow"], qs = {
1086
1102
  key: 3,
1087
1103
  class: "mbc__confirm"
1088
- }, Fs = { class: "mbc__confirm-title" }, zs = { class: "mbc__confirm-body" }, Hs = {
1104
+ }, Vs = { class: "mbc__confirm-title" }, Gs = { class: "mbc__confirm-body" }, Js = {
1089
1105
  key: 0,
1090
1106
  class: "mbc__mono"
1091
- }, Us = { class: "mbc__actions" }, Ks = ["disabled"], qs = ["disabled"], Vs = ["disabled"], Js = {
1107
+ }, Ws = { class: "mbc__actions" }, Ys = ["disabled"], Zs = ["disabled"], Xs = ["disabled"], Qs = {
1092
1108
  key: 4,
1093
1109
  class: "mbc__confirm"
1094
- }, Gs = { class: "mbc__confirm-title" }, Ws = { class: "mbc__confirm-body" }, Ys = { class: "mbc__mono" }, Zs = { class: "mbc__actions" }, Xs = ["disabled"], Qs = ["disabled"], ta = { class: "mbc__panel" }, ea = { class: "mbc__field" }, na = ["value"], oa = ["disabled"], sa = ["disabled"], aa = {
1110
+ }, ta = { class: "mbc__confirm-title" }, ea = { class: "mbc__confirm-body" }, na = { class: "mbc__mono" }, oa = { class: "mbc__actions" }, sa = ["disabled"], aa = ["disabled"], la = { class: "mbc__panel" }, ia = { class: "mbc__field" }, ra = ["value"], ua = ["disabled"], ca = ["disabled"], da = {
1095
1111
  key: 0,
1096
1112
  class: "mbc__hint"
1097
- }, la = {
1113
+ }, pa = {
1098
1114
  key: 1,
1099
1115
  class: "mbc__hint"
1100
- }, ia = {
1116
+ }, fa = {
1101
1117
  key: 0,
1102
1118
  class: "mbc__hint"
1103
- }, ra = ["disabled"], ua = ["disabled"], ca = {
1119
+ }, ma = ["disabled"], ba = ["disabled"], va = {
1104
1120
  key: 1,
1105
1121
  class: "mbc__scan"
1106
- }, da = { class: "mbc__pick" }, pa = ["disabled", "checked", "onChange"], ba = { class: "mbc__name" }, fa = { class: "mbc__module" }, ma = { class: "mbc__hint" }, va = { class: "mbc__mono" }, ha = {
1122
+ }, ha = { class: "mbc__pick" }, ga = ["disabled", "checked", "onChange"], _a = { class: "mbc__name" }, ya = { class: "mbc__module" }, ka = { class: "mbc__hint" }, $a = { class: "mbc__mono" }, wa = {
1107
1123
  key: 0,
1108
1124
  class: "mbc__problem"
1109
- }, ga = { class: "mbc__hint mbc__mono" }, _a = {
1125
+ }, xa = { class: "mbc__hint mbc__mono" }, Ca = {
1110
1126
  key: 2,
1111
1127
  class: "mbc__hint"
1112
- }, ya = {
1128
+ }, Ea = {
1113
1129
  key: 3,
1114
1130
  class: "mbc__problem"
1115
- }, ka = {
1131
+ }, Ta = {
1116
1132
  key: 4,
1117
1133
  class: "mbc__hint"
1118
- }, $a = {
1134
+ }, Sa = {
1119
1135
  key: 5,
1120
1136
  class: "mbc__failures"
1121
- }, wa = { class: "mbc__field mbc__field--end" }, xa = ["disabled"], Ca = {
1137
+ }, Ba = { class: "mbc__field mbc__field--end" }, Aa = ["disabled"], Ma = {
1122
1138
  key: 0,
1123
1139
  class: "mbc__panel"
1124
- }, Ea = { class: "mbc__title" }, Ta = {
1140
+ }, Oa = { class: "mbc__title" }, Ra = {
1125
1141
  key: 0,
1126
1142
  class: "mbc__failures"
1127
- }, Sa = {
1143
+ }, ja = {
1128
1144
  key: 1,
1129
1145
  class: "mbc__failures"
1130
- }, Ba = { key: 0 }, Ma = {
1146
+ }, Pa = { key: 0 }, La = {
1131
1147
  key: 1,
1132
1148
  class: "mbc__failures mbc__failures--nested"
1133
- }, Aa = { class: "mbc__foot" }, Ra = ["title"], ja = {
1149
+ }, Ia = { class: "mbc__foot" }, Na = ["title"], Da = {
1134
1150
  key: 1,
1135
1151
  class: "mbc__error"
1136
- }, Oa = {
1152
+ }, Fa = {
1137
1153
  key: 2,
1138
1154
  class: "mbc__notice"
1139
- }, Pa = {
1155
+ }, za = {
1140
1156
  key: 3,
1141
1157
  class: "mbc__hint mbc__foot-idle"
1142
- }, La = { class: "mbc__modal-box" }, Ia = { class: "mbc__modal-head" }, Na = { class: "mbc__modal-body" }, Da = { class: "mbc__reports" }, Fa = { class: "mbc__report-head" }, za = { class: "mbc__mono" }, Ha = { class: "mbc__report-text" }, Ua = {
1158
+ }, Ha = { class: "mbc__modal-box" }, Ua = { class: "mbc__modal-head" }, Ka = { class: "mbc__modal-body" }, qa = { class: "mbc__reports" }, Va = { class: "mbc__report-head" }, Ga = { class: "mbc__mono" }, Ja = { class: "mbc__report-text" }, Wa = {
1143
1159
  key: 0,
1144
1160
  class: "mbc__hint"
1145
- }, Ka = { class: "mbc__modal-foot" }, ne = 2, qa = /* @__PURE__ */ ue({
1161
+ }, Ya = { class: "mbc__modal-foot" }, le = 2, Za = 250, Xa = /* @__PURE__ */ fe({
1146
1162
  __name: "MagicBlockConsole",
1147
1163
  setup(s) {
1148
- const o = { modified: "有改动", unchanged: "没改动", missing: "目录里没有" }, { isStaff: a } = je(), r = Re(), { active: u } = $n(), b = (n) => !Oe(n, r), f = k(!1), m = k(""), v = k([]), h = k(""), T = k(""), g = k(""), S = k([]), F = k(!1), H = k(!1), V = k(""), nt = k([]), rt = k(""), M = k(""), $ = k(!1), xt = k(!1), X = k(!1), ft = k(!1), Ct = k(!1), z = k(null), L = k(null), U = k("one"), J = k(Ht()), ot = P(() => v.value.find((n) => n.id === J.value) ?? null), mt = () => U.value === "all" ? {} : { blocks: [J.value] };
1149
- function At(n) {
1150
- J.value = n;
1164
+ const o = { modified: "有改动", unchanged: "没改动", missing: "目录里没有" }, { isStaff: a } = Ne(), r = Ie(), { active: d } = Tn(), h = (n) => !De(n, r), f = k(!1), p = k(""), b = k([]), v = k(""), E = k(""), g = k(""), S = k([]), L = k(!1), q = k(!1), V = k(""), nt = k([]), it = k(""), A = k(""), $ = k(!1), Ct = k(!1), Z = k(!1), mt = k(!1), Et = k(!1), z = k(null), I = k(null), H = k("one"), G = k(qt()), ot = P(() => b.value.find((n) => n.id === G.value) ?? null), bt = () => H.value === "all" ? {} : { blocks: [G.value] };
1165
+ function Rt(n) {
1166
+ G.value = n;
1151
1167
  try {
1152
1168
  window.localStorage.setItem("mb:export-block", n);
1153
1169
  } catch {
1154
1170
  }
1155
1171
  }
1156
- function Ht() {
1172
+ function qt() {
1157
1173
  try {
1158
1174
  return window.localStorage.getItem("mb:export-block") ?? "";
1159
1175
  } catch {
1160
1176
  return "";
1161
1177
  }
1162
1178
  }
1163
- $t(v, (n) => {
1164
- n.length !== 0 && (n.some((t) => t.id === J.value) || At(n[0].id));
1179
+ $t(b, (n) => {
1180
+ n.length !== 0 && (n.some((t) => t.id === G.value) || Rt(n[0].id));
1165
1181
  });
1166
- const st = k(null), Q = k(""), I = k(null), at = k({}), lt = k([]), K = k([]), G = k({}), vt = k(""), ut = k(null);
1167
- async function ct(n) {
1182
+ const st = k(null), X = k(""), N = k(null), at = k({}), lt = k([]), U = k([]), J = k({}), vt = k(""), rt = k(null);
1183
+ async function ut(n) {
1168
1184
  vt.value = n;
1169
1185
  try {
1170
- const t = await Z(`/magic-blocks/${encodeURIComponent(n)}/versions`);
1171
- G.value = { ...G.value, [n]: t.versions ?? [] };
1186
+ const t = await Y(`/magic-blocks/${encodeURIComponent(n)}/versions`);
1187
+ J.value = { ...J.value, [n]: t.versions ?? [] };
1172
1188
  } catch (t) {
1173
- Lt(t, "读版本列表");
1189
+ Dt(t, "读版本列表");
1174
1190
  } finally {
1175
1191
  vt.value = "";
1176
1192
  }
@@ -1183,69 +1199,77 @@ const Mo = {
1183
1199
  return n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
1184
1200
  }
1185
1201
  const _ = k(null);
1186
- function N(n, t) {
1202
+ function D(n, t) {
1187
1203
  return `${String(t || "").replace(/[\\/:*?"<>|]/g, "").trim() || "block"}-${n}`;
1188
1204
  }
1189
- const tt = (n) => q(async () => {
1190
- const t = N(n.id, n.name || n.module);
1205
+ const Q = (n) => K(async () => {
1206
+ const t = D(n.id, n.name || n.module);
1191
1207
  let e = z.value, i = null;
1192
1208
  if (e)
1193
1209
  try {
1194
- i = await Ce(e, st.value ?? await Jt());
1210
+ i = await Ae(e, st.value ?? await Zt());
1195
1211
  } catch {
1196
1212
  e = null, i = null;
1197
1213
  }
1198
1214
  _.value = { row: n, target: e, folder: t, inventory: i };
1199
- }, $), Rt = () => q(async () => {
1215
+ }, $), jt = () => K(async () => {
1200
1216
  const n = _.value;
1201
1217
  if (_.value = null, !n) return;
1202
1218
  const t = `「${n.row.module} / ${n.row.name || n.row.id}」`;
1203
- B.value = { active: !0, percent: 0, stage: "清本机那个文件夹…", failed: !1 };
1219
+ be(), B.value = { active: !0, percent: 0, stage: "清本机那个文件夹…", failed: !1 };
1204
1220
  let e = "";
1205
1221
  if (n.target)
1206
1222
  try {
1207
- const i = await Ut(n.target, n.folder), w = await Ee(i);
1223
+ const i = await Vt(n.target, n.folder), w = await Me(i);
1208
1224
  e = `清掉了本机「${n.target.name}/${n.folder}」里的 ${w} 项`;
1209
1225
  } catch (i) {
1210
1226
  e = `本机那份没清成(${gt(i)})`;
1211
1227
  }
1212
1228
  else
1213
1229
  e = "没选开发目录 ⇒ 本机那份没动";
1214
- W(60, "清库里那份代码…");
1230
+ tt(60, "清库里那份代码…");
1215
1231
  try {
1216
- await Z(`/magic-blocks/${n.row.id}`, { method: "DELETE" });
1232
+ await Y(`/magic-blocks/${n.row.id}`, { method: "DELETE" });
1217
1233
  } catch (i) {
1218
- throw it(!1, "本机清了,但库里那份代码没清成"), new Error(`${e};但**库里那份代码没清成**(${gt(i)})—— 再点一次「删除代码文件」`);
1234
+ throw ct(!1, "本机清了,但库里那份代码没清成"), new Error(`${e};但**库里那份代码没清成**(${gt(i)})—— 再点一次「删除代码文件」`);
1219
1235
  }
1220
- await yt(), Q.value = `${t}的代码文件已删除:${e};库里那一份也清空了 ——**块还在**(页面上会显示成占位框),想找回来点「回滚上一版」`, g.value = `删掉了${t}的代码文件(块本身还在)`, it(!0, "完成");
1236
+ await yt(), X.value = `${t}的代码文件已删除:${e};库里那一份也清空了 ——**块还在**(页面上会显示成占位框),想找回来点「回滚上一版」`, g.value = `删掉了${t}的代码文件(块本身还在)`, ct(!0, "完成");
1221
1237
  }, $);
1222
- async function Ut(n, t) {
1238
+ async function Vt(n, t) {
1223
1239
  let e = n.handle;
1224
- for (const i of Je(t))
1240
+ for (const i of Xe(t))
1225
1241
  e = await e.getDirectoryHandle(i, { create: !0 });
1226
1242
  return { handle: e, name: `${n.name}/${t}` };
1227
1243
  }
1228
- const R = k(null), B = k({ active: !1, percent: 0, stage: "", failed: !1 }), Kt = P(() => ({
1244
+ const O = k(null), B = k({ active: !1, percent: 0, stage: "", failed: !1 }), Gt = P(() => ({
1229
1245
  width: `${Math.max(0, Math.min(100, B.value.percent))}%`,
1230
1246
  background: B.value.failed ? "var(--sp-color-danger)" : "var(--sp-color-primary, var(--primary-color))"
1231
1247
  }));
1232
- function W(n, t) {
1233
- B.value = { active: !0, percent: Math.max(B.value.percent, n), stage: t, failed: !1 };
1234
- try {
1235
- const e = window.localStorage.getItem("mb:progress") ?? "[]", i = JSON.parse(e);
1236
- i.push({ p: B.value.percent, s: t, t: Math.round(performance.now()) }), window.localStorage.setItem("mb:progress", JSON.stringify(i));
1237
- } catch {
1248
+ let Tt = [], Pt = 0;
1249
+ function Jt(n = !1) {
1250
+ if (!(!n && performance.now() - Pt < Za)) {
1251
+ Pt = performance.now();
1252
+ try {
1253
+ window.localStorage.setItem("mb:progress", JSON.stringify(Tt));
1254
+ } catch {
1255
+ }
1238
1256
  }
1239
1257
  }
1240
- function it(n, t) {
1241
- W(n ? 100 : B.value.percent, t), B.value = { active: !n, percent: n ? 100 : B.value.percent, stage: t, failed: !n };
1258
+ function tt(n, t) {
1259
+ B.value = { active: !0, percent: Math.max(B.value.percent, n), stage: t, failed: !1 }, Tt.push({ p: B.value.percent, s: t, t: Math.round(performance.now()) }), Jt();
1260
+ }
1261
+ function ct(n, t) {
1262
+ tt(n ? 100 : B.value.percent, t), B.value = { active: !n, percent: n ? 100 : B.value.percent, stage: t, failed: !n }, Jt(!0);
1263
+ }
1264
+ function be() {
1265
+ Tt = [], Jt(!0);
1242
1266
  }
1243
- const de = (n) => (n.disabledReason ?? "").trim(), qt = (n) => (n.issues ?? []).map((t) => String(t?.message ?? "")).filter(Boolean), jt = (n) => oo(n.id);
1244
- function Ye(n) {
1245
- h.value = h.value === n.id ? "" : n.id, h.value === n.id && ct(n.id);
1246
- const t = u.value;
1247
- qe(n.id);
1248
- const e = n.name || n.id, i = jt(n);
1267
+ const ve = (n) => (n.disabledReason ?? "").trim(), Wt = (n) => (n.issues ?? []).map((t) => String(t?.message ?? "")).filter(Boolean), Lt = (n) => ro(n.id);
1268
+ function en(n) {
1269
+ v.value = v.value === n.id ? "" : n.id, v.value === n.id && ut(n.id);
1270
+ const t = d.value;
1271
+ Ye(n.id);
1272
+ const e = n.name || n.id, i = Lt(n);
1249
1273
  if (i.length === 0) {
1250
1274
  g.value = `「${e}」这次会话里还没在哪条标签上露过面:先打开挂着它的那一页,再点一次`;
1251
1275
  return;
@@ -1254,79 +1278,79 @@ const Mo = {
1254
1278
  g.value = `「${e}」就在这一条标签上(${i.join(" / ")}):已经把它标红`;
1255
1279
  return;
1256
1280
  }
1257
- const w = so(n.id, t, b);
1281
+ const w = uo(n.id, t, h);
1258
1282
  if (w) {
1259
- g.value = `「${e}」不在这一条标签上:正在切到 ${w} 那条标签`, oe(w);
1283
+ g.value = `「${e}」不在这一条标签上:正在切到 ${w} 那条标签`, ie(w);
1260
1284
  return;
1261
1285
  }
1262
1286
  g.value = `「${e}」只挂在带参数的实例标签上(${i.join(" / ")}):不替你挑一单 —— 自己打开要看的那一页再点`;
1263
1287
  }
1264
- const Ze = (n, t) => q(async () => {
1265
- const e = await Z(
1288
+ const nn = (n, t) => K(async () => {
1289
+ const e = await Y(
1266
1290
  `/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`
1267
1291
  );
1268
- ut.value = { id: n.id, number: t, files: e.files ?? {} }, g.value = `正在看「${n.name || n.id}」的 v${t}(只读:不会改库里任何东西)`;
1269
- }, $), Xe = (n, t) => q(async () => {
1292
+ rt.value = { id: n.id, number: t, files: e.files ?? {} }, g.value = `正在看「${n.name || n.id}」的 v${t}(只读:不会改库里任何东西)`;
1293
+ }, $), on = (n, t) => K(async () => {
1270
1294
  window.confirm(`把「${n.name || n.id}」切回 v${t}?
1271
1295
 
1272
- 这会把那一版的代码变成**当前版**,并且记成一个**新版本**(号继续 +1):历史只追加,旧版本一个都不会没。`) && (await _t(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { updatedBy: "" }), g.value = `「${n.name || n.id}」已切回 v${t}(并记成了一个新版本)`, await yt(), await ct(n.id));
1273
- }, $), Qe = (n, t) => q(async () => {
1296
+ 这会把那一版的代码变成**当前版**,并且记成一个**新版本**(号继续 +1):历史只追加,旧版本一个都不会没。`) && (await _t(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { updatedBy: "" }), g.value = `「${n.name || n.id}」已切回 v${t}(并记成了一个新版本)`, await yt(), await ut(n.id));
1297
+ }, $), sn = (n, t) => K(async () => {
1274
1298
  window.confirm(`删掉「${n.name || n.id}」的 v${t}?
1275
1299
 
1276
- 这一版的代码就找不回来了(别的版本不受影响)。`) && (await Z(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { method: "DELETE" }), g.value = `删掉了「${n.name || n.id}」的 v${t}`, await ct(n.id));
1277
- }, $), tn = (n, t) => q(async () => {
1300
+ 这一版的代码就找不回来了(别的版本不受影响)。`) && (await Y(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { method: "DELETE" }), g.value = `删掉了「${n.name || n.id}」的 v${t}`, await ut(n.id));
1301
+ }, $), an = (n, t) => K(async () => {
1278
1302
  const e = await fetch(
1279
1303
  `http://localhost:3000/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}?download=1`,
1280
- { credentials: "include", headers: Ft("GET", !1) }
1304
+ { credentials: "include", headers: Ut("GET", !1) }
1281
1305
  );
1282
1306
  if (!e.ok) throw new Error(`下载失败(HTTP ${e.status})`);
1283
1307
  const i = await e.blob(), w = URL.createObjectURL(i);
1284
1308
  try {
1285
- const A = document.createElement("a");
1286
- A.href = w, A.download = `magic-block-${n.name || n.id}-v${t}.zip`, document.body.appendChild(A), A.click(), A.remove();
1309
+ const M = document.createElement("a");
1310
+ M.href = w, M.download = `magic-block-${n.name || n.id}-v${t}.zip`, document.body.appendChild(M), M.click(), M.remove();
1287
1311
  } finally {
1288
1312
  setTimeout(() => URL.revokeObjectURL(w), 0);
1289
1313
  }
1290
1314
  g.value = `已下载「${n.name || n.id}」的 v${t}`;
1291
1315
  }, $);
1292
- function en(n) {
1293
- rt.value = n.id, M.value = (n.tags ?? []).join(", ");
1316
+ function ln(n) {
1317
+ it.value = n.id, A.value = (n.tags ?? []).join(", ");
1294
1318
  }
1295
- const pe = (n) => q(async () => {
1296
- const t = M.value.split(/[,,\s]+/).map((i) => i.trim()).filter(Boolean), e = await _t(`/magic-blocks/${encodeURIComponent(n.id)}/tags`, { tags: t });
1297
- rt.value = "", g.value = `「${n.name || n.id}」的标签已存:${(e.tags ?? []).join(" / ") || "(一个都不剩)"}`, await yt();
1319
+ const he = (n) => K(async () => {
1320
+ const t = A.value.split(/[,,\s]+/).map((i) => i.trim()).filter(Boolean), e = await _t(`/magic-blocks/${encodeURIComponent(n.id)}/tags`, { tags: t });
1321
+ it.value = "", g.value = `「${n.name || n.id}」的标签已存:${(e.tags ?? []).join(" / ") || "(一个都不剩)"}`, await yt();
1298
1322
  }, $, "存标签");
1299
- function nn(n) {
1300
- const t = M.value.split(/[,,\s]+/).map((e) => e.trim()).filter(Boolean);
1301
- t.some((e) => e.toLowerCase() === n.toLowerCase()) || t.push(n), M.value = t.join(", ");
1323
+ function rn(n) {
1324
+ const t = A.value.split(/[,,\s]+/).map((e) => e.trim()).filter(Boolean);
1325
+ t.some((e) => e.toLowerCase() === n.toLowerCase()) || t.push(n), A.value = t.join(", ");
1302
1326
  }
1303
- function on(n) {
1304
- M.value = M.value.split(/[,,\s]+/).map((t) => t.trim()).filter((t) => t && t.toLowerCase() !== n.toLowerCase()).join(", ");
1327
+ function un(n) {
1328
+ A.value = A.value.split(/[,,\s]+/).map((t) => t.trim()).filter((t) => t && t.toLowerCase() !== n.toLowerCase()).join(", ");
1305
1329
  }
1306
- function sn(n) {
1330
+ function cn(n) {
1307
1331
  const t = V.value.trim().toLowerCase();
1308
1332
  return t ? (n.tags ?? []).some((e) => e.toLowerCase().includes(t)) : !0;
1309
1333
  }
1310
- function an(n) {
1311
- const t = jt(n), e = t.length === 0 ? "点一下:这次会话里它还没在哪条标签上露过面" : `点一下:把「${n.name || n.id}」标红,并在需要时切到挂着它的标签(${t.join(" / ")})`, i = de(n);
1334
+ function dn(n) {
1335
+ const t = Lt(n), e = t.length === 0 ? "点一下:这次会话里它还没在哪条标签上露过面" : `点一下:把「${n.name || n.id}」标红,并在需要时切到挂着它的标签(${t.join(" / ")})`, i = ve(n);
1312
1336
  return i ? `${i}
1313
1337
  ${e}` : e;
1314
1338
  }
1315
- const be = P(() => {
1316
- const n = m.value.trim().toLowerCase();
1317
- return v.value.filter((t) => sn(t) ? n ? `${t.module} ${t.name} ${t.brief} ${t.id} v${t.version ?? ""} ${(t.tags ?? []).join(" ")}`.toLowerCase().includes(n) : !0 : !1);
1318
- }), Ot = P(() => (I.value?.blocks ?? []).filter((n) => n.canApply)), Pt = P(() => Ot.value.filter((n) => at.value[n.id] === !0));
1319
- function ln() {
1339
+ const ge = P(() => {
1340
+ const n = p.value.trim().toLowerCase();
1341
+ return b.value.filter((t) => cn(t) ? n ? `${t.module} ${t.name} ${t.brief} ${t.id} v${t.version ?? ""} ${(t.tags ?? []).join(" ")}`.toLowerCase().includes(n) : !0 : !1);
1342
+ }), It = P(() => (N.value?.blocks ?? []).filter((n) => n.canApply)), Nt = P(() => It.value.filter((n) => at.value[n.id] === !0));
1343
+ function pn() {
1320
1344
  const n = r?.getRoutes?.() ?? [], t = /* @__PURE__ */ new Set(), e = [];
1321
1345
  for (const i of n) {
1322
1346
  const w = typeof i?.path == "string" ? i.path.trim() : "";
1323
1347
  if (!w || t.has(w) || w.includes(":") || w.includes("*") || i.redirect || !i.components?.default || i.meta?.tab === !1) continue;
1324
1348
  t.add(w);
1325
- const A = i.meta?.title ?? i.meta?.sub, j = i.meta?.group;
1349
+ const M = i.meta?.title ?? i.meta?.sub, R = i.meta?.group;
1326
1350
  e.push({
1327
1351
  path: w,
1328
- title: typeof A == "string" && A.trim() ? A.trim() : w,
1329
- group: typeof j == "string" ? j.trim() : ""
1352
+ title: typeof M == "string" && M.trim() ? M.trim() : w,
1353
+ group: typeof R == "string" ? R.trim() : ""
1330
1354
  });
1331
1355
  }
1332
1356
  return e;
@@ -1334,27 +1358,27 @@ ${e}` : e;
1334
1358
  function gt(n) {
1335
1359
  return (n instanceof Error ? n.message.trim() : String(n)) || "请求没有到达后端(网络或登录态的问题),请重试";
1336
1360
  }
1337
- function rn(n) {
1361
+ function fn(n) {
1338
1362
  const t = n?.issues;
1339
1363
  return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : String(e?.message ?? "")).filter(Boolean) : [];
1340
1364
  }
1341
1365
  async function _t(n, t) {
1342
1366
  const e = JSON.stringify(t);
1343
1367
  try {
1344
- return await Z(n, { method: "POST", body: e });
1368
+ return await Y(n, { method: "POST", body: e });
1345
1369
  } catch (i) {
1346
- const w = gt(i), A = await fetch(`http://localhost:3000${n}`, {
1370
+ const w = gt(i), M = await fetch(`http://localhost:3000${n}`, {
1347
1371
  method: "POST",
1348
1372
  credentials: "include",
1349
- headers: { "Content-Type": "application/json", ...Ft("POST", !0) },
1373
+ headers: { "Content-Type": "application/json", ...Ut("POST", !0) },
1350
1374
  body: e
1351
- }).then((kt) => kt.json()).catch(() => null), j = rn(A);
1352
- throw j.length === 0 ? new Error(w) : new Error(`${String(A?.message ?? w)}
1353
- - ${j.join(`
1375
+ }).then((kt) => kt.json()).catch(() => null), R = fn(M);
1376
+ throw R.length === 0 ? new Error(w) : new Error(`${String(M?.message ?? w)}
1377
+ - ${R.join(`
1354
1378
  - `)}`);
1355
1379
  }
1356
1380
  }
1357
- async function un() {
1381
+ async function mn() {
1358
1382
  const n = S.value.map((t) => `[${t.at}] ${t.where}
1359
1383
  ${t.text}`).join(`
1360
1384
 
@@ -1362,441 +1386,441 @@ ${t.text}`).join(`
1362
1386
  try {
1363
1387
  await navigator.clipboard.writeText(n), g.value = `已复制 ${S.value.length} 条报错`;
1364
1388
  } catch (t) {
1365
- Lt(t, "复制报错");
1389
+ Dt(t, "复制报错");
1366
1390
  }
1367
1391
  }
1368
- function Lt(n, t) {
1392
+ function Dt(n, t) {
1369
1393
  const e = gt(n);
1370
- T.value = e, S.value = [...S.value, { at: (/* @__PURE__ */ new Date()).toLocaleTimeString(), where: t, text: e }];
1394
+ E.value = e, S.value = [...S.value, { at: (/* @__PURE__ */ new Date()).toLocaleTimeString(), where: t, text: e }];
1371
1395
  }
1372
- function Vt() {
1373
- T.value = "", S.value = [];
1396
+ function Yt() {
1397
+ E.value = "", S.value = [];
1374
1398
  }
1375
1399
  async function yt() {
1376
1400
  try {
1377
- const n = await Z("/magic-blocks/index");
1378
- v.value = n.blocks ?? [], nt.value = n.tags ?? [];
1401
+ const n = await Y("/magic-blocks/index");
1402
+ b.value = n.blocks ?? [], nt.value = n.tags ?? [];
1379
1403
  } catch (n) {
1380
- Lt(n, "读块清单");
1404
+ Dt(n, "读块清单");
1381
1405
  }
1382
1406
  }
1383
- async function q(n, t, e = "") {
1384
- t.value = !0, Vt();
1407
+ async function K(n, t, e = "") {
1408
+ t.value = !0, Yt();
1385
1409
  try {
1386
- await n(), Yn();
1410
+ await n(), eo();
1387
1411
  } catch (i) {
1388
- Lt(i, e || "这个动作");
1412
+ Dt(i, e || "这个动作");
1389
1413
  } finally {
1390
1414
  t.value = !1;
1391
1415
  }
1392
1416
  }
1393
- const cn = () => q(async () => {
1394
- xt.value = !0;
1417
+ const bn = () => K(async () => {
1418
+ Ct.value = !0;
1395
1419
  try {
1396
- await Z("/magic-blocks/check", { method: "POST", body: JSON.stringify({}) }), g.value = "全部魔法块重新校验完了", await yt();
1420
+ await Y("/magic-blocks/check", { method: "POST", body: JSON.stringify({}) }), g.value = "全部魔法块重新校验完了", await yt();
1397
1421
  } finally {
1398
- xt.value = !1;
1422
+ Ct.value = !1;
1399
1423
  }
1400
- }, $), fe = (n) => q(async () => {
1401
- const t = await ee();
1402
- n === "export" ? (z.value = t, L.value || (L.value = t)) : (L.value = t, z.value || (z.value = t)), g.value = n === "export" ? `导出目录:${t.name}${L.value === t ? "(读回目录也填成它了)" : ""}` : `读回目录:${t.name}`;
1424
+ }, $), _e = (n) => K(async () => {
1425
+ const t = await ae();
1426
+ n === "export" ? (z.value = t, I.value || (I.value = t)) : (I.value = t, z.value || (z.value = t)), g.value = n === "export" ? `导出目录:${t.name}${I.value === t ? "(读回目录也填成它了)" : ""}` : `读回目录:${t.name}`;
1403
1427
  }, $);
1404
- async function Jt() {
1428
+ async function Zt() {
1405
1429
  if (st.value) return st.value;
1406
- const n = await Z("/magic-blocks/rules");
1430
+ const n = await Y("/magic-blocks/rules");
1407
1431
  return st.value = n.rules, n.rules;
1408
1432
  }
1409
- const dn = () => q(async () => {
1410
- if (!Ve()) throw new Error("这个浏览器没法直接写你本机的文件夹:请用 Chrome / Edge,并从 https 或 localhost 打开");
1411
- if (U.value === "one" && !ot.value)
1433
+ const vn = () => K(async () => {
1434
+ if (!Ze()) throw new Error("这个浏览器没法直接写你本机的文件夹:请用 Chrome / Edge,并从 https 或 localhost 打开");
1435
+ if (H.value === "one" && !ot.value)
1412
1436
  throw new Error("还没挑块:上面选「仅这一个块」时要先在下拉里挑一个块(或者把范围改成「全部块」)");
1413
- X.value = !0, g.value = "", Q.value = "", Vt(), B.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
1437
+ Z.value = !0, g.value = "", X.value = "", Yt(), be(), B.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
1414
1438
  try {
1415
- const n = z.value ?? await ee();
1416
- z.value = n, L.value || (L.value = n);
1417
- const t = await _t("/magic-blocks/export", mt());
1418
- st.value = t.rules, Eo(n, t.rules);
1419
- const e = await Ce(n, t.rules);
1439
+ const n = z.value ?? await ae();
1440
+ z.value = n, I.value || (I.value = n);
1441
+ const t = await _t("/magic-blocks/export", bt());
1442
+ st.value = t.rules, Mo(n, t.rules);
1443
+ const e = await Ae(n, t.rules);
1420
1444
  if (e.topCount > 0) {
1421
- W(5, "等你确认要不要先清空"), R.value = { target: n, inventory: e };
1445
+ tt(5, "等你确认要不要先清空"), O.value = { target: n, inventory: e };
1422
1446
  return;
1423
1447
  }
1424
- await Gt(n, t, !1);
1448
+ await Xt(n, t, !1);
1425
1449
  } catch (n) {
1426
- throw it(!1, "导出失败"), n;
1450
+ throw ct(!1, "导出失败"), n;
1427
1451
  } finally {
1428
- X.value = !1;
1452
+ Z.value = !1;
1429
1453
  }
1430
1454
  }, $);
1431
- async function Gt(n, t, e) {
1455
+ async function Xt(n, t, e) {
1432
1456
  try {
1433
- W(20, "收主题与控件清单…");
1457
+ tt(20, "收主题与控件清单…");
1434
1458
  const i = { ...t.files };
1435
1459
  let w = "";
1436
- await new Promise((D) => {
1437
- setTimeout(D, 0);
1460
+ await new Promise((F) => {
1461
+ setTimeout(F, 0);
1438
1462
  });
1439
- const A = ko(ln());
1440
- i[te] = A;
1463
+ const M = Eo(pn());
1464
+ i[se] = M;
1441
1465
  try {
1442
- const D = Ke(), Et = Qn();
1443
- i[pt] = D.css, i[Dt] = Et, t.exampleDir && (i[`${t.exampleDir}/${te}`] = A, i[`${t.exampleDir}/${pt}`] = D.css, i[`${t.exampleDir}/${Dt}`] = Et), w = D.skipped.length > 0 ? `;⚠️ 有 ${D.skipped.length} 张样式表读不到规则(跨源):${D.skipped.join(" / ")}` : "";
1444
- } catch (D) {
1445
- w = `;主题 CSS 没收成(${gt(D)}):${pt} 没写,其余照旧`;
1466
+ const F = We(), St = so();
1467
+ i[pt] = F.css, i[Ht] = St, t.exampleDir && (i[`${t.exampleDir}/${se}`] = M, i[`${t.exampleDir}/${pt}`] = F.css, i[`${t.exampleDir}/${Ht}`] = St), w = F.skipped.length > 0 ? `;⚠️ 有 ${F.skipped.length} 张样式表读不到规则(跨源):${F.skipped.join(" / ")}` : "";
1468
+ } catch (F) {
1469
+ w = `;主题 CSS 没收成(${gt(F)}):${pt} 没写,其余照旧`;
1446
1470
  }
1447
- let j = "";
1448
- e && (W(35, "清空目录…"), j = `,先清掉了 ${await Ee(n)} 项`);
1449
- const kt = Object.keys(i).length, Wt = e ? 45 : 30;
1450
- W(Wt, `写文件 0/${kt}…`);
1451
- const dt = await Co(n, i, (D, Et) => {
1452
- W(Wt + Math.round(D / Math.max(1, Et) * (95 - Wt)), `写文件 ${D}/${Et}…`);
1471
+ let R = "";
1472
+ e && (tt(35, "清空目录…"), R = `,先清掉了 ${await Me(n)} 项`);
1473
+ const kt = Object.keys(i).length, Qt = e ? 45 : 30;
1474
+ tt(Qt, `写文件 0/${kt}…`);
1475
+ const dt = await Ao(n, i, (F, St) => {
1476
+ tt(Qt + Math.round(F / Math.max(1, St) * (95 - Qt)), `写文件 ${F}/${St}…`);
1453
1477
  });
1454
- W(98, "收尾…");
1455
- const hn = dt.failed.length > 0 ? `;⚠️ ${dt.failed.length} 个文件没写成:${dt.failed.slice(0, 3).map((D) => `${D.path}(${D.message})`).join("、")}` + (dt.failed.length > 3 ? ` 等 ${dt.failed.length} 条` : "") : "";
1456
- Q.value = `铺到「${n.name}」:${t.blocks} 个块、${dt.written} 个文件(含 ${te} / ${pt} / ${Dt})${j}${hn}${w}`, g.value = dt.failed.length > 0 ? "导出完了,但有文件没写成(见下面那句)" : "导出完了:用你自己的编辑器改,改完回这里「读回改动」", it(!0, "完成");
1478
+ tt(98, "收尾…");
1479
+ const $n = dt.failed.length > 0 ? `;⚠️ ${dt.failed.length} 个文件没写成:${dt.failed.slice(0, 3).map((F) => `${F.path}(${F.message})`).join("、")}` + (dt.failed.length > 3 ? ` 等 ${dt.failed.length} 条` : "") : "";
1480
+ X.value = `铺到「${n.name}」:${t.blocks} 个块、${dt.written} 个文件(含 ${se} / ${pt} / ${Ht})${R}${$n}${w}`, g.value = dt.failed.length > 0 ? "导出完了,但有文件没写成(见下面那句)" : "导出完了:用你自己的编辑器改,改完回这里「读回改动」", ct(!0, "完成");
1457
1481
  } catch (i) {
1458
- throw it(!1, "导出中途失败(已经铺进去的文件不会自己删掉)"), i;
1482
+ throw ct(!1, "导出中途失败(已经铺进去的文件不会自己删掉)"), i;
1459
1483
  }
1460
1484
  }
1461
- const pn = () => q(async () => {
1462
- const n = R.value;
1463
- if (R.value = null, !!n) {
1464
- X.value = !0;
1485
+ const hn = () => K(async () => {
1486
+ const n = O.value;
1487
+ if (O.value = null, !!n) {
1488
+ Z.value = !0;
1465
1489
  try {
1466
- W(15, "重新取一份开发包…");
1467
- const t = await _t("/magic-blocks/export", mt());
1468
- st.value = t.rules, await Gt(n.target, t, !0);
1490
+ tt(15, "重新取一份开发包…");
1491
+ const t = await _t("/magic-blocks/export", bt());
1492
+ st.value = t.rules, await Xt(n.target, t, !0);
1469
1493
  } catch (t) {
1470
- throw it(!1, "导出失败"), t;
1494
+ throw ct(!1, "导出失败"), t;
1471
1495
  } finally {
1472
- X.value = !1;
1496
+ Z.value = !1;
1473
1497
  }
1474
1498
  }
1475
- }, $), bn = () => q(async () => {
1476
- const n = R.value;
1477
- if (R.value = null, !!n) {
1478
- X.value = !0;
1499
+ }, $), gn = () => K(async () => {
1500
+ const n = O.value;
1501
+ if (O.value = null, !!n) {
1502
+ Z.value = !0;
1479
1503
  try {
1480
- W(15, "重新取一份开发包…");
1481
- const t = await _t("/magic-blocks/export", mt());
1482
- st.value = t.rules, await Gt(n.target, t, !1);
1504
+ tt(15, "重新取一份开发包…");
1505
+ const t = await _t("/magic-blocks/export", bt());
1506
+ st.value = t.rules, await Xt(n.target, t, !1);
1483
1507
  } catch (t) {
1484
- throw it(!1, "导出失败"), t;
1508
+ throw ct(!1, "导出失败"), t;
1485
1509
  } finally {
1486
- X.value = !1;
1510
+ Z.value = !1;
1487
1511
  }
1488
1512
  }
1489
1513
  }, $);
1490
- function fn() {
1491
- R.value = null, B.value = { active: !1, percent: 0, stage: "", failed: !1 }, g.value = "这次没有导出(目录里的东西一个字节都没动)", Q.value = "";
1514
+ function _n() {
1515
+ O.value = null, B.value = { active: !1, percent: 0, stage: "", failed: !1 }, g.value = "这次没有导出(目录里的东西一个字节都没动)", X.value = "";
1492
1516
  }
1493
- const me = () => q(async () => {
1494
- const n = L.value ?? await ee();
1495
- L.value = n, z.value || (z.value = n), ft.value = !0, g.value = "", lt.value = [], K.value = [];
1517
+ const ye = () => K(async () => {
1518
+ const n = I.value ?? await ae();
1519
+ I.value = n, z.value || (z.value = n), mt.value = !0, g.value = "", lt.value = [], U.value = [];
1496
1520
  try {
1497
- const t = await Jt().catch((j) => {
1498
- throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${gt(j)}`);
1499
- }), e = await Bo(n, t), i = await Z("/magic-blocks/read", {
1521
+ const t = await Zt().catch((R) => {
1522
+ throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${gt(R)}`);
1523
+ }), e = await Po(n, t), i = await Y("/magic-blocks/read", {
1500
1524
  method: "POST",
1501
1525
  body: JSON.stringify({ ...e, includeMissing: !1 })
1502
1526
  });
1503
- I.value = i;
1527
+ N.value = i;
1504
1528
  const w = {};
1505
- for (const j of i.blocks ?? []) w[j.id] = j.status === "modified" && j.canApply;
1529
+ for (const R of i.blocks ?? []) w[R.id] = R.status === "modified" && R.canApply;
1506
1530
  at.value = w;
1507
- const A = (i.blocks ?? []).reduce((j, kt) => ({ ...j, [kt.status]: (j[kt.status] ?? 0) + 1 }), {});
1508
- g.value = `扫到 ${i.folders} 个文件夹、${i.files} 个文件:有改动 ${A.modified ?? 0} / 没改动 ${A.unchanged ?? 0}` + (i.complete ? "" : "(层数到了上限,没走完,可能还有块没扫到)");
1531
+ const M = (i.blocks ?? []).reduce((R, kt) => ({ ...R, [kt.status]: (R[kt.status] ?? 0) + 1 }), {});
1532
+ g.value = `扫到 ${i.folders} 个文件夹、${i.files} 个文件:有改动 ${M.modified ?? 0} / 没改动 ${M.unchanged ?? 0}` + (i.complete ? "" : "(层数到了上限,没走完,可能还有块没扫到)");
1509
1533
  } finally {
1510
- ft.value = !1;
1534
+ mt.value = !1;
1511
1535
  }
1512
- }, $), mn = () => q(async () => {
1513
- const n = Pt.value, t = Fn(n);
1514
- if (lt.value = t.issues, K.value = [], t.issues.length > 0)
1536
+ }, $), yn = () => K(async () => {
1537
+ const n = Nt.value, t = qn(n);
1538
+ if (lt.value = t.issues, U.value = [], t.issues.length > 0)
1515
1539
  throw g.value = "", new Error(`前端校验没过(${t.issues.length} 条),没有发请求:
1516
1540
  - ${t.issues.join(`
1517
1541
  - `)}`);
1518
- Ct.value = !0, g.value = "";
1542
+ Et.value = !0, g.value = "";
1519
1543
  try {
1520
1544
  const e = await _t("/magic-blocks/import", { updatedBy: "", blocks: n });
1521
- K.value = e.results ?? [], g.value = `保存:成功 ${e.saved} 个、失败 ${e.failed} 个`, await yt();
1545
+ U.value = e.results ?? [], g.value = `保存:成功 ${e.saved} 个、失败 ${e.failed} 个`, await yt();
1522
1546
  const i = g.value;
1523
- await me(), g.value = `${i};已重新读回该目录`;
1547
+ await ye(), g.value = `${i};已重新读回该目录`;
1524
1548
  } finally {
1525
- Ct.value = !1;
1549
+ Et.value = !1;
1526
1550
  }
1527
1551
  }, $);
1528
- function vn(n, t) {
1552
+ function kn(n, t) {
1529
1553
  const e = t.target;
1530
1554
  at.value[n] = e?.checked === !0;
1531
1555
  }
1532
- function ve(n) {
1556
+ function ke(n) {
1533
1557
  const t = { ...at.value };
1534
- for (const e of Ot.value) t[e.id] = n;
1558
+ for (const e of It.value) t[e.id] = n;
1535
1559
  at.value = t;
1536
1560
  }
1537
- function he(n) {
1561
+ function $e(n) {
1538
1562
  const t = n.detail?.uuid ?? "";
1539
- f.value = !0, h.value = t;
1563
+ f.value = !0, v.value = t;
1540
1564
  }
1541
- function ge(n) {
1565
+ function we(n) {
1542
1566
  n.key === "Escape" && f.value && (f.value = !1);
1543
1567
  }
1544
- return Se(() => {
1545
- window.addEventListener("magic-block:open-console", he), window.addEventListener("keydown", ge), yt(), Jt().catch(() => {
1568
+ return Re(() => {
1569
+ window.addEventListener("magic-block:open-console", $e), window.addEventListener("keydown", we), yt(), Zt().catch(() => {
1546
1570
  });
1547
- }), Be(() => {
1548
- window.removeEventListener("magic-block:open-console", he), window.removeEventListener("keydown", ge);
1549
- }), (n, t) => Tt(a) ? (c(), d("div", Mo, [
1571
+ }), je(() => {
1572
+ window.removeEventListener("magic-block:open-console", $e), window.removeEventListener("keydown", we);
1573
+ }), (n, t) => Bt(a) ? (u(), c("div", Lo, [
1550
1574
  l("button", {
1551
1575
  class: "fab",
1552
1576
  type: "button",
1553
1577
  title: "magic block 控制台",
1554
1578
  onClick: t[0] || (t[0] = (e) => f.value = !0)
1555
1579
  }, "块"),
1556
- f.value ? (c(), d("aside", {
1580
+ f.value ? (u(), c("aside", {
1557
1581
  key: 0,
1558
- class: Y(["mbc", { "is-wide": H.value }])
1582
+ class: W(["mbc", { "is-wide": q.value }])
1559
1583
  }, [
1560
- l("header", Ao, [
1584
+ l("header", Io, [
1561
1585
  t[32] || (t[32] = l("strong", null, "magic block", -1)),
1562
- Yt(l("input", {
1563
- "onUpdate:modelValue": t[1] || (t[1] = (e) => m.value = e),
1586
+ te(l("input", {
1587
+ "onUpdate:modelValue": t[1] || (t[1] = (e) => p.value = e),
1564
1588
  class: "p-inputtext p-component mbc__grow",
1565
1589
  type: "search",
1566
1590
  placeholder: "筛选 module / 名字 / 备注 / id / 版本号 / 标签"
1567
1591
  }, null, 512), [
1568
- [Zt, m.value]
1592
+ [ee, p.value]
1569
1593
  ]),
1570
1594
  l("button", {
1571
1595
  class: "p-button p-button-sm p-button-text",
1572
1596
  type: "button",
1573
- title: H.value ? "收起(回到窄抽屉)" : "展开:更宽、块清单两列,看长名字与标签更舒服",
1574
- onClick: t[2] || (t[2] = (e) => H.value = !H.value)
1575
- }, p(H.value ? "收起" : "展开"), 9, Ro),
1597
+ title: q.value ? "收起(回到窄抽屉)" : "展开:更宽、块清单两列,看长名字与标签更舒服",
1598
+ onClick: t[2] || (t[2] = (e) => q.value = !q.value)
1599
+ }, m(q.value ? "收起" : "展开"), 9, No),
1576
1600
  l("button", {
1577
1601
  class: "p-button p-button-sm",
1578
1602
  type: "button",
1579
1603
  disabled: $.value,
1580
- onClick: t[3] || (t[3] = (e) => cn())
1581
- }, p(xt.value ? "校验中…" : "校验全部魔法块"), 9, jo),
1604
+ onClick: t[3] || (t[3] = (e) => bn())
1605
+ }, m(Ct.value ? "校验中…" : "校验全部魔法块"), 9, Do),
1582
1606
  l("button", {
1583
1607
  class: "p-button p-button-sm p-button-text",
1584
1608
  type: "button",
1585
1609
  onClick: t[4] || (t[4] = (e) => f.value = !1)
1586
1610
  }, "关闭")
1587
1611
  ]),
1588
- l("section", Oo, [
1589
- l("h3", Po, "库里的块(" + p(be.value.length) + " / " + p(v.value.length) + ")", 1),
1590
- nt.value.length > 0 ? (c(), d("div", Lo, [
1612
+ l("section", Fo, [
1613
+ l("h3", zo, "库里的块(" + m(ge.value.length) + " / " + m(b.value.length) + ")", 1),
1614
+ nt.value.length > 0 ? (u(), c("div", Ho, [
1591
1615
  t[33] || (t[33] = l("span", { class: "mbc__label" }, "标签", -1)),
1592
- Yt(l("input", {
1616
+ te(l("input", {
1593
1617
  "onUpdate:modelValue": t[5] || (t[5] = (e) => V.value = e),
1594
1618
  class: "p-inputtext p-component mbc__tagfilter",
1595
1619
  type: "search",
1596
1620
  placeholder: "只看贴了…的块"
1597
1621
  }, null, 512), [
1598
- [Zt, V.value]
1622
+ [ee, V.value]
1599
1623
  ]),
1600
- (c(!0), d(E, null, O(nt.value.slice(0, 24), (e) => (c(), d("button", {
1624
+ (u(!0), c(T, null, j(nt.value.slice(0, 24), (e) => (u(), c("button", {
1601
1625
  key: e.tag,
1602
- class: Y(["p-tag mbc__tag", { "is-on": V.value.trim().toLowerCase() === e.tag.toLowerCase() }]),
1626
+ class: W(["p-tag mbc__tag", { "is-on": V.value.trim().toLowerCase() === e.tag.toLowerCase() }]),
1603
1627
  type: "button",
1604
1628
  title: `只看贴了「${e.tag}」的块(${e.count} 个)`,
1605
1629
  onClick: (i) => V.value = V.value.trim().toLowerCase() === e.tag.toLowerCase() ? "" : e.tag
1606
- }, p(e.tag) + " " + p(e.count), 11, Io))), 128)),
1607
- V.value ? (c(), d("button", {
1630
+ }, m(e.tag) + " " + m(e.count), 11, Uo))), 128)),
1631
+ V.value ? (u(), c("button", {
1608
1632
  key: 0,
1609
1633
  class: "p-button p-button-sm p-button-text",
1610
1634
  type: "button",
1611
1635
  onClick: t[6] || (t[6] = (e) => V.value = "")
1612
1636
  }, "清掉标签筛选")) : x("", !0)
1613
1637
  ])) : x("", !0),
1614
- l("ul", No, [
1615
- (c(!0), d(E, null, O(be.value, (e) => (c(), d("li", {
1638
+ l("ul", Ko, [
1639
+ (u(!0), c(T, null, j(ge.value, (e) => (u(), c("li", {
1616
1640
  key: e.id
1617
1641
  }, [
1618
1642
  l("button", {
1619
1643
  type: "button",
1620
- class: Y(["mbc__row", { "is-active": e.id === h.value }]),
1621
- title: an(e),
1622
- onClick: (i) => Ye(e)
1644
+ class: W(["mbc__row", { "is-active": e.id === v.value }]),
1645
+ title: dn(e),
1646
+ onClick: (i) => en(e)
1623
1647
  }, [
1624
- l("span", Fo, p(e.module || "unassigned"), 1),
1625
- l("span", zo, p(e.name || e.id), 1),
1648
+ l("span", Vo, m(e.module || "unassigned"), 1),
1649
+ l("span", Go, m(e.name || e.id), 1),
1626
1650
  l("span", {
1627
1651
  class: "mbc__version-badge",
1628
1652
  title: `当前是第 ${e.version || 1} 版,一共留着 ${e.versionCount ?? 1} 版`
1629
1653
  }, [
1630
- C("v" + p(e.version || 1), 1),
1631
- (e.versionCount ?? 1) > 1 ? (c(), d(E, { key: 0 }, [
1632
- C("/" + p(e.versionCount), 1)
1654
+ C("v" + m(e.version || 1), 1),
1655
+ (e.versionCount ?? 1) > 1 ? (u(), c(T, { key: 0 }, [
1656
+ C("/" + m(e.versionCount), 1)
1633
1657
  ], 64)) : x("", !0)
1634
- ], 8, Ho),
1635
- (c(!0), d(E, null, O(e.tags ?? [], (i) => (c(), d("span", {
1658
+ ], 8, Jo),
1659
+ (u(!0), c(T, null, j(e.tags ?? [], (i) => (u(), c("span", {
1636
1660
  key: i,
1637
1661
  class: "p-tag mbc__tag mbc__tag--on-row"
1638
- }, p(i), 1))), 128)),
1639
- jt(e).length > 0 ? (c(), d("span", Uo, p(jt(e).join(" / ")), 1)) : x("", !0),
1662
+ }, m(i), 1))), 128)),
1663
+ Lt(e).length > 0 ? (u(), c("span", Wo, m(Lt(e).join(" / ")), 1)) : x("", !0),
1640
1664
  l("em", {
1641
- class: Y({ "is-off": e.enabled === !1 })
1642
- }, p(e.enabled === !1 ? de(e) || "校验失败已停用" : "可用"), 3)
1643
- ], 10, Do),
1644
- h.value === e.id ? (c(), d("div", Ko, [
1645
- (c(!0), d(E, null, O(qt(e).slice(0, ne), (i, w) => (c(), d("p", {
1665
+ class: W({ "is-off": e.enabled === !1 })
1666
+ }, m(e.enabled === !1 ? ve(e) || "校验失败已停用" : "可用"), 3)
1667
+ ], 10, qo),
1668
+ v.value === e.id ? (u(), c("div", Yo, [
1669
+ (u(!0), c(T, null, j(Wt(e).slice(0, le), (i, w) => (u(), c("p", {
1646
1670
  key: w,
1647
1671
  class: "mbc__problem"
1648
- }, p(i), 1))), 128)),
1649
- qt(e).length > ne ? (c(), d("p", qo, "还有 " + p(qt(e).length - ne) + " 条问题没显示出来:点上面的「校验全部魔法块」重算一遍(这几条是上次校验的结论)", 1)) : x("", !0),
1650
- l("dl", Vo, [
1672
+ }, m(i), 1))), 128)),
1673
+ Wt(e).length > le ? (u(), c("p", Zo, "还有 " + m(Wt(e).length - le) + " 条问题没显示出来:点上面的「校验全部魔法块」重算一遍(这几条是上次校验的结论)", 1)) : x("", !0),
1674
+ l("dl", Xo, [
1651
1675
  t[36] || (t[36] = l("dt", null, "文件", -1)),
1652
- l("dd", null, p((e.fileNames || []).join(" / ") || "(没有文件)"), 1),
1676
+ l("dd", null, m((e.fileNames || []).join(" / ") || "(没有文件)"), 1),
1653
1677
  t[37] || (t[37] = l("dt", null, "版本", -1)),
1654
1678
  l("dd", null, [
1655
- C("v" + p(e.version || 1), 1),
1656
- l("span", Jo, "(一共留着 " + p(e.versionCount ?? G.value[e.id]?.length ?? 1) + " 版)", 1)
1679
+ C("v" + m(e.version || 1), 1),
1680
+ l("span", Qo, "(一共留着 " + m(e.versionCount ?? J.value[e.id]?.length ?? 1) + " 版)", 1)
1657
1681
  ]),
1658
1682
  t[38] || (t[38] = l("dt", null, "标签", -1)),
1659
1683
  l("dd", null, [
1660
- rt.value !== e.id ? (c(), d(E, { key: 0 }, [
1661
- (c(!0), d(E, null, O(e.tags ?? [], (i) => (c(), d("span", {
1684
+ it.value !== e.id ? (u(), c(T, { key: 0 }, [
1685
+ (u(!0), c(T, null, j(e.tags ?? [], (i) => (u(), c("span", {
1662
1686
  key: i,
1663
1687
  class: "p-tag mbc__tag"
1664
- }, p(i), 1))), 128)),
1665
- (e.tags ?? []).length === 0 ? (c(), d("span", Go, "(没贴标签)")) : x("", !0),
1688
+ }, m(i), 1))), 128)),
1689
+ (e.tags ?? []).length === 0 ? (u(), c("span", ts, "(没贴标签)")) : x("", !0),
1666
1690
  l("button", {
1667
1691
  class: "p-button p-button-sm p-button-text",
1668
1692
  type: "button",
1669
1693
  disabled: $.value,
1670
- onClick: (i) => en(e)
1671
- }, "改标签", 8, Wo)
1672
- ], 64)) : (c(), d(E, { key: 1 }, [
1673
- Yt(l("input", {
1674
- "onUpdate:modelValue": t[7] || (t[7] = (i) => M.value = i),
1694
+ onClick: (i) => ln(e)
1695
+ }, "改标签", 8, es)
1696
+ ], 64)) : (u(), c(T, { key: 1 }, [
1697
+ te(l("input", {
1698
+ "onUpdate:modelValue": t[7] || (t[7] = (i) => A.value = i),
1675
1699
  class: "p-inputtext p-component mbc__taginput",
1676
1700
  type: "text",
1677
1701
  placeholder: "逗号分隔,例如:订单, 报表",
1678
- onKeyup: _n((i) => pe(e), ["enter"])
1679
- }, null, 40, Yo), [
1680
- [Zt, M.value]
1702
+ onKeyup: xn((i) => he(e), ["enter"])
1703
+ }, null, 40, ns), [
1704
+ [ee, A.value]
1681
1705
  ]),
1682
1706
  l("button", {
1683
1707
  class: "p-button p-button-sm",
1684
1708
  type: "button",
1685
1709
  disabled: $.value,
1686
- onClick: (i) => pe(e)
1687
- }, "存标签", 8, Zo),
1710
+ onClick: (i) => he(e)
1711
+ }, "存标签", 8, os),
1688
1712
  l("button", {
1689
1713
  class: "p-button p-button-sm p-button-text",
1690
1714
  type: "button",
1691
1715
  disabled: $.value,
1692
- onClick: t[8] || (t[8] = (i) => rt.value = "")
1693
- }, "取消", 8, Xo),
1694
- nt.value.length > 0 ? (c(), d("div", Qo, [
1716
+ onClick: t[8] || (t[8] = (i) => it.value = "")
1717
+ }, "取消", 8, ss),
1718
+ nt.value.length > 0 ? (u(), c("div", as, [
1695
1719
  t[34] || (t[34] = l("span", { class: "mbc__hint" }, "点现成的加进去:", -1)),
1696
- (c(!0), d(E, null, O(nt.value.slice(0, 16), (i) => (c(), d("button", {
1720
+ (u(!0), c(T, null, j(nt.value.slice(0, 16), (i) => (u(), c("button", {
1697
1721
  key: i.tag,
1698
1722
  class: "p-tag mbc__tag",
1699
1723
  type: "button",
1700
1724
  title: `把「${i.tag}」加进去`,
1701
- onClick: (w) => nn(i.tag)
1702
- }, p(i.tag), 9, ts))), 128))
1725
+ onClick: (w) => rn(i.tag)
1726
+ }, m(i.tag), 9, ls))), 128))
1703
1727
  ])) : x("", !0),
1704
- M.value.trim() ? (c(), d("div", es, [
1728
+ A.value.trim() ? (u(), c("div", is, [
1705
1729
  t[35] || (t[35] = l("span", { class: "mbc__hint" }, "这一块会贴:", -1)),
1706
- (c(!0), d(E, null, O(M.value.split(/[,,\s]+/).filter(Boolean), (i) => (c(), d("button", {
1730
+ (u(!0), c(T, null, j(A.value.split(/[,,\s]+/).filter(Boolean), (i) => (u(), c("button", {
1707
1731
  key: i,
1708
1732
  class: "p-tag mbc__tag",
1709
1733
  type: "button",
1710
1734
  title: `从这一块上摘掉「${i}」`,
1711
- onClick: (w) => on(i)
1712
- }, p(i) + " ×", 9, ns))), 128))
1735
+ onClick: (w) => un(i)
1736
+ }, m(i) + " ×", 9, rs))), 128))
1713
1737
  ])) : x("", !0)
1714
1738
  ], 64))
1715
1739
  ]),
1716
1740
  t[39] || (t[39] = l("dt", null, "更新", -1)),
1717
- l("dd", null, p(e.updatedAt || "—"), 1),
1741
+ l("dd", null, m(e.updatedAt || "—"), 1),
1718
1742
  t[40] || (t[40] = l("dt", null, "id", -1)),
1719
- l("dd", os, p(e.id), 1)
1743
+ l("dd", us, m(e.id), 1)
1720
1744
  ]),
1721
- l("div", ss, [
1745
+ l("div", cs, [
1722
1746
  l("button", {
1723
1747
  class: "p-button p-button-sm p-button-outlined",
1724
1748
  type: "button",
1725
1749
  disabled: $.value,
1726
- onClick: (i) => tt(e),
1750
+ onClick: (i) => Q(e),
1727
1751
  title: "删掉这一块的代码文件:本机的文件夹 + 库里那份代码正文(点下去会先问你确认)。块本身留着,页面上会显示成占位框"
1728
- }, "删除代码文件", 8, as)
1752
+ }, "删除代码文件", 8, ds)
1729
1753
  ]),
1730
- l("div", ls, [
1731
- l("div", is, [
1754
+ l("div", ps, [
1755
+ l("div", fs, [
1732
1756
  t[41] || (t[41] = l("strong", null, "版本(每次上传 +1,旧的都留着)", -1)),
1733
1757
  l("button", {
1734
1758
  class: "p-button p-button-sm p-button-text",
1735
1759
  type: "button",
1736
1760
  disabled: $.value,
1737
- onClick: (i) => ct(e.id)
1738
- }, p(vt.value === e.id ? "读版本中…" : "刷新版本"), 9, rs)
1761
+ onClick: (i) => ut(e.id)
1762
+ }, m(vt.value === e.id ? "读版本中…" : "刷新版本"), 9, ms)
1739
1763
  ]),
1740
- G.value[e.id] ? G.value[e.id].length > 0 ? (c(), d("ul", cs, [
1741
- (c(!0), d(E, null, O(G.value[e.id], (i) => (c(), d("li", {
1764
+ J.value[e.id] ? J.value[e.id].length > 0 ? (u(), c("ul", vs, [
1765
+ (u(!0), c(T, null, j(J.value[e.id], (i) => (u(), c("li", {
1742
1766
  key: i.number,
1743
- class: Y({ "is-current": i.current })
1767
+ class: W({ "is-current": i.current })
1744
1768
  }, [
1745
- l("span", ds, p(ht(i)), 1),
1746
- l("span", ps, [
1747
- C(p(i.fileCount) + " 个文件 · " + p(y(i.sizeBytes)), 1),
1748
- i.createdBy ? (c(), d(E, { key: 0 }, [
1749
- C(" · " + p(i.createdBy), 1)
1769
+ l("span", hs, m(ht(i)), 1),
1770
+ l("span", gs, [
1771
+ C(m(i.fileCount) + " 个文件 · " + m(y(i.sizeBytes)), 1),
1772
+ i.createdBy ? (u(), c(T, { key: 0 }, [
1773
+ C(" · " + m(i.createdBy), 1)
1750
1774
  ], 64)) : x("", !0),
1751
- C(" · " + p(i.createdAt || "—"), 1)
1775
+ C(" · " + m(i.createdAt || "—"), 1)
1752
1776
  ]),
1753
- l("span", bs, [
1777
+ l("span", _s, [
1754
1778
  l("button", {
1755
1779
  class: "p-button p-button-sm p-button-text",
1756
1780
  type: "button",
1757
1781
  disabled: $.value || i.empty,
1758
- onClick: (w) => Ze(e, i.number),
1782
+ onClick: (w) => nn(e, i.number),
1759
1783
  title: i.empty ? "这一版是空包(代码被删过),没有正文可看" : "看这一版的正文(只读)"
1760
- }, "查看", 8, fs),
1784
+ }, "查看", 8, ys),
1761
1785
  l("button", {
1762
1786
  class: "p-button p-button-sm p-button-text",
1763
1787
  type: "button",
1764
1788
  disabled: $.value || i.current || i.empty,
1765
- onClick: (w) => Xe(e, i.number),
1789
+ onClick: (w) => on(e, i.number),
1766
1790
  title: i.current ? "这一版正在跑" : "把这一版变成当前版(会记成一个新版本)"
1767
- }, "切回", 8, ms),
1791
+ }, "切回", 8, ks),
1768
1792
  l("button", {
1769
1793
  class: "p-button p-button-sm p-button-text",
1770
1794
  type: "button",
1771
1795
  disabled: $.value || i.empty,
1772
- onClick: (w) => tn(e, i.number),
1796
+ onClick: (w) => an(e, i.number),
1773
1797
  title: i.empty ? "空包没什么可下的" : "下载这一版(一个 zip)"
1774
- }, "下载", 8, vs),
1798
+ }, "下载", 8, $s),
1775
1799
  l("button", {
1776
1800
  class: "p-button p-button-sm p-button-text",
1777
1801
  type: "button",
1778
1802
  disabled: $.value || i.current,
1779
- onClick: (w) => Qe(e, i.number),
1803
+ onClick: (w) => sn(e, i.number),
1780
1804
  title: i.current ? "当前那一版不许删:先切到别的版本" : "删掉这一版(别的版本不受影响)"
1781
- }, "删", 8, hs)
1805
+ }, "删", 8, ws)
1782
1806
  ])
1783
1807
  ], 2))), 128))
1784
- ])) : (c(), d("p", gs, "这个块还没有版本记录(它从没被保存过)。")) : (c(), d("p", us, "正在读版本…(没读到时点「刷新版本」)")),
1785
- ut.value && ut.value.id === e.id ? (c(), d("div", _s, [
1786
- l("div", ys, [
1787
- l("strong", null, "看 v" + p(ut.value.number) + " 的正文(只读)", 1),
1808
+ ])) : (u(), c("p", xs, "这个块还没有版本记录(它从没被保存过)。")) : (u(), c("p", bs, "正在读版本…(没读到时点「刷新版本」)")),
1809
+ rt.value && rt.value.id === e.id ? (u(), c("div", Cs, [
1810
+ l("div", Es, [
1811
+ l("strong", null, "看 v" + m(rt.value.number) + " 的正文(只读)", 1),
1788
1812
  l("button", {
1789
1813
  class: "p-button p-button-sm p-button-text",
1790
1814
  type: "button",
1791
- onClick: t[9] || (t[9] = (i) => ut.value = null)
1815
+ onClick: t[9] || (t[9] = (i) => rt.value = null)
1792
1816
  }, "收起")
1793
1817
  ]),
1794
- (c(!0), d(E, null, O(ut.value.files, (i, w) => (c(), d("details", {
1818
+ (u(!0), c(T, null, j(rt.value.files, (i, w) => (u(), c("details", {
1795
1819
  key: w,
1796
1820
  class: "mbc__viewer-file"
1797
1821
  }, [
1798
- l("summary", ks, p(w) + "(" + p(y(i.length)) + ")", 1),
1799
- l("pre", $s, p(i), 1)
1822
+ l("summary", Ts, m(w) + "(" + m(y(i.length)) + ")", 1),
1823
+ l("pre", Ss, m(i), 1)
1800
1824
  ]))), 128))
1801
1825
  ])) : x("", !0)
1802
1826
  ])
@@ -1804,45 +1828,45 @@ ${t.text}`).join(`
1804
1828
  ]))), 128))
1805
1829
  ])
1806
1830
  ]),
1807
- l("section", ws, [
1831
+ l("section", Bs, [
1808
1832
  t[68] || (t[68] = l("h3", { class: "mbc__title" }, "导出去改(用你自己的编辑器)", -1)),
1809
- l("div", xs, [
1833
+ l("div", As, [
1810
1834
  t[43] || (t[43] = l("span", { class: "mbc__label" }, "导出范围", -1)),
1811
- l("label", Cs, [
1835
+ l("label", Ms, [
1812
1836
  l("input", {
1813
1837
  type: "radio",
1814
1838
  name: "mbc-scope",
1815
1839
  value: "one",
1816
- checked: U.value === "one",
1817
- onChange: t[10] || (t[10] = (e) => U.value = "one")
1818
- }, null, 40, Es),
1840
+ checked: H.value === "one",
1841
+ onChange: t[10] || (t[10] = (e) => H.value = "one")
1842
+ }, null, 40, Os),
1819
1843
  t[42] || (t[42] = C(" 仅这一个块 ", -1))
1820
1844
  ]),
1821
- l("label", Ts, [
1845
+ l("label", Rs, [
1822
1846
  l("input", {
1823
1847
  type: "radio",
1824
1848
  name: "mbc-scope",
1825
1849
  value: "all",
1826
- checked: U.value === "all",
1827
- onChange: t[11] || (t[11] = (e) => U.value = "all")
1828
- }, null, 40, Ss),
1829
- C(" 全部块(" + p(v.value.length) + " 个) ", 1)
1850
+ checked: H.value === "all",
1851
+ onChange: t[11] || (t[11] = (e) => H.value = "all")
1852
+ }, null, 40, js),
1853
+ C(" 全部块(" + m(b.value.length) + " 个) ", 1)
1830
1854
  ]),
1831
- U.value === "one" ? (c(), d("select", {
1855
+ H.value === "one" ? (u(), c("select", {
1832
1856
  key: 0,
1833
1857
  class: "p-inputtext p-component mbc__grow",
1834
- value: J.value,
1835
- disabled: $.value || v.value.length === 0,
1836
- onChange: t[12] || (t[12] = (e) => At(e.target.value))
1858
+ value: G.value,
1859
+ disabled: $.value || b.value.length === 0,
1860
+ onChange: t[12] || (t[12] = (e) => Rt(e.target.value))
1837
1861
  }, [
1838
- v.value.length === 0 ? (c(), d("option", Ms, "(库里还没有块)")) : x("", !0),
1839
- (c(!0), d(E, null, O(v.value, (e) => (c(), d("option", {
1862
+ b.value.length === 0 ? (u(), c("option", Ls, "(库里还没有块)")) : x("", !0),
1863
+ (u(!0), c(T, null, j(b.value, (e) => (u(), c("option", {
1840
1864
  key: e.id,
1841
1865
  value: e.id
1842
- }, p(e.module) + " / " + p(e.name || e.id), 9, As))), 128))
1843
- ], 40, Bs)) : x("", !0)
1866
+ }, m(e.module) + " / " + m(e.name || e.id), 9, Is))), 128))
1867
+ ], 40, Ps)) : x("", !0)
1844
1868
  ]),
1845
- l("div", Rs, [
1869
+ l("div", Ns, [
1846
1870
  t[44] || (t[44] = l("label", { for: "mbc-dir" }, "导出目录", -1)),
1847
1871
  l("input", {
1848
1872
  id: "mbc-dir",
@@ -1850,32 +1874,32 @@ ${t.text}`).join(`
1850
1874
  type: "text",
1851
1875
  readonly: "",
1852
1876
  value: z.value ? z.value.name : "(还没选:点右边那个按钮选一个文件夹)"
1853
- }, null, 8, js),
1877
+ }, null, 8, Ds),
1854
1878
  l("button", {
1855
1879
  class: "p-button p-button-sm p-button-outlined",
1856
1880
  type: "button",
1857
1881
  disabled: $.value,
1858
- onClick: t[13] || (t[13] = (e) => fe("export"))
1859
- }, "选择文件夹", 8, Os),
1882
+ onClick: t[13] || (t[13] = (e) => _e("export"))
1883
+ }, "选择文件夹", 8, Fs),
1860
1884
  l("button", {
1861
1885
  class: "p-button p-button-sm mbc__act-export",
1862
1886
  type: "button",
1863
- disabled: $.value || U.value === "one" && !ot.value,
1864
- title: U.value === "one" && !ot.value ? "先在左边挑一个块(或者把范围改成「全部块」)" : "把库里的块铺到你选的文件夹",
1865
- onClick: t[14] || (t[14] = (e) => dn())
1866
- }, p(X.value ? "导出中…" : "导出"), 9, Ps)
1887
+ disabled: $.value || H.value === "one" && !ot.value,
1888
+ title: H.value === "one" && !ot.value ? "先在左边挑一个块(或者把范围改成「全部块」)" : "把库里的块铺到你选的文件夹",
1889
+ onClick: t[14] || (t[14] = (e) => vn())
1890
+ }, m(Z.value ? "导出中…" : "导出"), 9, zs)
1867
1891
  ]),
1868
- l("p", Ls, [
1869
- C(p(U.value === "all" ? `这一趟铺全部 ${v.value.length} 个块` : ot.value ? `这一趟只铺「${ot.value.module} / ${ot.value.name || ot.value.id}」` : "先挑一个块") + " ⇒ ", 1),
1892
+ l("p", Hs, [
1893
+ C(m(H.value === "all" ? `这一趟铺全部 ${b.value.length} 个块` : ot.value ? `这一趟只铺「${ot.value.module} / ${ot.value.name || ot.value.id}」` : "先挑一个块") + " ⇒ ", 1),
1870
1894
  t[45] || (t[45] = l("span", { class: "mbc__mono" }, "workspace/<可读名>-<块 uuid>/", -1)),
1871
1895
  t[46] || (t[46] = C(",顶层另附开发说明与 ", -1)),
1872
1896
  t[47] || (t[47] = l("span", { class: "mbc__mono" }, "example/", -1)),
1873
1897
  t[48] || (t[48] = C("。 ", -1))
1874
1898
  ]),
1875
- Q.value ? (c(), d("p", Is, p(Q.value), 1)) : x("", !0),
1876
- B.value.active ? (c(), d("div", {
1899
+ X.value ? (u(), c("p", Us, m(X.value), 1)) : x("", !0),
1900
+ B.value.active ? (u(), c("div", {
1877
1901
  key: 1,
1878
- class: Y(["mbc__progress", { "is-failed": B.value.failed }]),
1902
+ class: W(["mbc__progress", { "is-failed": B.value.failed }]),
1879
1903
  role: "progressbar",
1880
1904
  "aria-valuenow": B.value.percent,
1881
1905
  "aria-valuemin": "0",
@@ -1883,60 +1907,60 @@ ${t.text}`).join(`
1883
1907
  }, [
1884
1908
  l("div", {
1885
1909
  class: "mbc__progress-bar",
1886
- style: Me(Kt.value)
1910
+ style: Pe(Gt.value)
1887
1911
  }, null, 4)
1888
- ], 10, Ns)) : x("", !0),
1889
- B.value.active ? (c(), d("p", {
1912
+ ], 10, Ks)) : x("", !0),
1913
+ B.value.active ? (u(), c("p", {
1890
1914
  key: 2,
1891
- class: Y(["mbc__hint", { "mbc__progress-note": B.value.failed }])
1892
- }, p(B.value.failed ? "✗" : "") + " " + p(B.value.percent) + "% · " + p(B.value.stage), 3)) : x("", !0),
1893
- R.value ? (c(), d("div", Ds, [
1894
- l("p", Fs, "「" + p(R.value.target.name) + "」里现在有 " + p(R.value.inventory.dirs) + " 个文件夹 / " + p(R.value.inventory.files) + " 个文件", 1),
1895
- l("p", zs, [
1915
+ class: W(["mbc__hint", { "mbc__progress-note": B.value.failed }])
1916
+ }, m(B.value.failed ? "✗" : "") + " " + m(B.value.percent) + "% · " + m(B.value.stage), 3)) : x("", !0),
1917
+ O.value ? (u(), c("div", qs, [
1918
+ l("p", Vs, "「" + m(O.value.target.name) + "」里现在有 " + m(O.value.inventory.dirs) + " 个文件夹 / " + m(O.value.inventory.files) + " 个文件", 1),
1919
+ l("p", Gs, [
1896
1920
  t[49] || (t[49] = C(" 接下来会", -1)),
1897
1921
  t[50] || (t[50] = l("b", null, "先全部删掉", -1)),
1898
1922
  t[51] || (t[51] = C("再铺一遍 —— 包括你改过、还没读回库的东西。 清空只动这个目录", -1)),
1899
1923
  t[52] || (t[52] = l("b", null, "里面", -1)),
1900
1924
  t[53] || (t[53] = C("的子项:目录本身、以及它外面的任何东西都不会被碰。", -1)),
1901
- R.value.inventory.items.length > 0 ? (c(), d("span", Hs, "(" + p(R.value.inventory.items.slice(0, 6).map((e) => e.name).join(" / ")) + p(R.value.inventory.items.length > 6 ? " …" : "") + ")", 1)) : x("", !0)
1925
+ O.value.inventory.items.length > 0 ? (u(), c("span", Js, "(" + m(O.value.inventory.items.slice(0, 6).map((e) => e.name).join(" / ")) + m(O.value.inventory.items.length > 6 ? " …" : "") + ")", 1)) : x("", !0)
1902
1926
  ]),
1903
- l("div", Us, [
1927
+ l("div", Ws, [
1904
1928
  l("button", {
1905
1929
  class: "p-button p-button-sm",
1906
1930
  type: "button",
1907
1931
  disabled: $.value,
1908
- onClick: t[15] || (t[15] = (e) => pn())
1909
- }, "清空并导出", 8, Ks),
1932
+ onClick: t[15] || (t[15] = (e) => hn())
1933
+ }, "清空并导出", 8, Ys),
1910
1934
  l("button", {
1911
1935
  class: "p-button p-button-sm p-button-outlined",
1912
1936
  type: "button",
1913
1937
  disabled: $.value,
1914
- onClick: t[16] || (t[16] = (e) => bn())
1915
- }, "只覆盖", 8, qs),
1938
+ onClick: t[16] || (t[16] = (e) => gn())
1939
+ }, "只覆盖", 8, Zs),
1916
1940
  l("button", {
1917
1941
  class: "p-button p-button-sm p-button-text",
1918
1942
  type: "button",
1919
1943
  disabled: $.value,
1920
- onClick: t[17] || (t[17] = (e) => fn())
1921
- }, "取消", 8, Vs)
1944
+ onClick: t[17] || (t[17] = (e) => _n())
1945
+ }, "取消", 8, Xs)
1922
1946
  ])
1923
1947
  ])) : x("", !0),
1924
- _.value ? (c(), d("div", Js, [
1925
- l("p", Gs, "删掉「" + p(_.value.row.module) + " / " + p(_.value.row.name || _.value.row.id) + "」的代码文件", 1),
1926
- l("p", Ws, [
1948
+ _.value ? (u(), c("div", Qs, [
1949
+ l("p", ta, "删掉「" + m(_.value.row.module) + " / " + m(_.value.row.name || _.value.row.id) + "」的代码文件", 1),
1950
+ l("p", ea, [
1927
1951
  t[62] || (t[62] = l("b", null, "库里那一份代码正文会被清空", -1)),
1928
1952
  t[63] || (t[63] = C("(入口 / 清单 / 后端一起); ", -1)),
1929
- _.value.target ? (c(), d(E, { key: 0 }, [
1953
+ _.value.target ? (u(), c(T, { key: 0 }, [
1930
1954
  t[54] || (t[54] = C(" 同时清掉你本机那个块文件夹 ", -1)),
1931
- l("span", Ys, p(_.value.target.name) + "/" + p(_.value.folder), 1),
1932
- _.value.inventory && _.value.inventory.items.some((e) => e.name === _.value?.folder) ? (c(), d(E, { key: 0 }, [
1955
+ l("span", na, m(_.value.target.name) + "/" + m(_.value.folder), 1),
1956
+ _.value.inventory && _.value.inventory.items.some((e) => e.name === _.value?.folder) ? (u(), c(T, { key: 0 }, [
1933
1957
  C(" (它现在在顶层,里面有东西:本次会先清空)。 ")
1934
1958
  ], 64)) : x("", !0),
1935
1959
  t[55] || (t[55] = l("b", null, "只动这一个块的文件夹", -1)),
1936
1960
  t[56] || (t[56] = C(":别的块、", -1)),
1937
1961
  t[57] || (t[57] = l("span", { class: "mbc__mono" }, "example/", -1)),
1938
1962
  t[58] || (t[58] = C("、以及目录外面的一切都不会被碰。 ", -1))
1939
- ], 64)) : (c(), d(E, { key: 1 }, [
1963
+ ], 64)) : (u(), c(T, { key: 1 }, [
1940
1964
  t[59] || (t[59] = C(" 现在没有选中开发目录 / 或者读不到它,所以", -1)),
1941
1965
  t[60] || (t[60] = l("b", null, "本机那份不动", -1)),
1942
1966
  t[61] || (t[61] = C(",只清库里那份。 ", -1))
@@ -1946,202 +1970,202 @@ ${t.text}`).join(`
1946
1970
  t[66] || (t[66] = l("b", null, "块本身留着", -1)),
1947
1971
  t[67] || (t[67] = C('(这一行不动):页面上那块会显示成占位框,而不是"库里没有这个块"; 删错了也能用「回滚上一版」找回来(不过那个按钮**不在这个控制台里**,走管理后台 / 接口)。 ', -1))
1948
1972
  ]),
1949
- l("div", Zs, [
1973
+ l("div", oa, [
1950
1974
  l("button", {
1951
1975
  class: "p-button p-button-sm",
1952
1976
  type: "button",
1953
1977
  disabled: $.value,
1954
- onClick: t[18] || (t[18] = (e) => Rt())
1955
- }, "确认删除代码文件", 8, Xs),
1978
+ onClick: t[18] || (t[18] = (e) => jt())
1979
+ }, "确认删除代码文件", 8, sa),
1956
1980
  l("button", {
1957
1981
  class: "p-button p-button-sm p-button-text",
1958
1982
  type: "button",
1959
1983
  disabled: $.value,
1960
1984
  onClick: t[19] || (t[19] = (e) => _.value = null)
1961
- }, "取消", 8, Qs)
1985
+ }, "取消", 8, aa)
1962
1986
  ])
1963
1987
  ])) : x("", !0)
1964
1988
  ]),
1965
- l("section", ta, [
1989
+ l("section", la, [
1966
1990
  t[74] || (t[74] = l("h3", { class: "mbc__title" }, "读回改动", -1)),
1967
- l("div", ea, [
1991
+ l("div", ia, [
1968
1992
  t[69] || (t[69] = l("label", { for: "mbc-read-dir" }, "读回目录", -1)),
1969
1993
  l("input", {
1970
1994
  id: "mbc-read-dir",
1971
1995
  class: "p-inputtext p-component mbc__grow mbc__mono",
1972
1996
  type: "text",
1973
1997
  readonly: "",
1974
- value: L.value ? L.value.name : "(还没选:导出会自动填上,也可以自己选一个)"
1975
- }, null, 8, na),
1998
+ value: I.value ? I.value.name : "(还没选:导出会自动填上,也可以自己选一个)"
1999
+ }, null, 8, ra),
1976
2000
  l("button", {
1977
2001
  class: "p-button p-button-sm p-button-outlined",
1978
2002
  type: "button",
1979
2003
  disabled: $.value,
1980
- onClick: t[20] || (t[20] = (e) => fe("read"))
1981
- }, "选择文件夹", 8, oa),
2004
+ onClick: t[20] || (t[20] = (e) => _e("read"))
2005
+ }, "选择文件夹", 8, ua),
1982
2006
  l("button", {
1983
2007
  class: "p-button p-button-sm p-button-outlined",
1984
2008
  type: "button",
1985
2009
  disabled: $.value,
1986
- onClick: t[21] || (t[21] = (e) => me())
1987
- }, p(ft.value ? "读回中…" : "读回改动"), 9, sa)
2010
+ onClick: t[21] || (t[21] = (e) => ye())
2011
+ }, m(mt.value ? "读回中…" : "读回改动"), 9, ca)
1988
2012
  ]),
1989
- L.value && z.value && L.value.name !== z.value.name ? (c(), d("p", aa, " 读回的是「" + p(L.value.name) + "」(与导出目录「" + p(z.value.name) + "」不是同一个 —— 想同步就再选一次)。 ", 1)) : (c(), d("p", la, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
1990
- I.value ? (c(), d(E, { key: 2 }, [
1991
- Ot.value.length > 0 ? (c(), d("p", ia, [
1992
- C(" 扫到 " + p(I.value.blocks.length) + " 个块,其中 " + p(Ot.value.length) + " 个可以存;已经勾了 ", 1),
1993
- l("b", null, p(Pt.value.length), 1),
2013
+ I.value && z.value && I.value.name !== z.value.name ? (u(), c("p", da, " 读回的是「" + m(I.value.name) + "」(与导出目录「" + m(z.value.name) + "」不是同一个 —— 想同步就再选一次)。 ", 1)) : (u(), c("p", pa, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
2014
+ N.value ? (u(), c(T, { key: 2 }, [
2015
+ It.value.length > 0 ? (u(), c("p", fa, [
2016
+ C(" 扫到 " + m(N.value.blocks.length) + " 个块,其中 " + m(It.value.length) + " 个可以存;已经勾了 ", 1),
2017
+ l("b", null, m(Nt.value.length), 1),
1994
2018
  t[70] || (t[70] = C(" 个。 ", -1)),
1995
2019
  l("button", {
1996
2020
  class: "p-button p-button-sm p-button-text",
1997
2021
  type: "button",
1998
2022
  disabled: $.value,
1999
- onClick: t[22] || (t[22] = (e) => ve(!0))
2000
- }, "全选可存的", 8, ra),
2023
+ onClick: t[22] || (t[22] = (e) => ke(!0))
2024
+ }, "全选可存的", 8, ma),
2001
2025
  l("button", {
2002
2026
  class: "p-button p-button-sm p-button-text",
2003
2027
  type: "button",
2004
- disabled: $.value || Pt.value.length === 0,
2005
- onClick: t[23] || (t[23] = (e) => ve(!1))
2006
- }, "全不选", 8, ua)
2028
+ disabled: $.value || Nt.value.length === 0,
2029
+ onClick: t[23] || (t[23] = (e) => ke(!1))
2030
+ }, "全不选", 8, ba)
2007
2031
  ])) : x("", !0),
2008
- I.value.blocks.length > 0 ? (c(), d("ul", ca, [
2009
- (c(!0), d(E, null, O(I.value.blocks, (e) => (c(), d("li", {
2032
+ N.value.blocks.length > 0 ? (u(), c("ul", va, [
2033
+ (u(!0), c(T, null, j(N.value.blocks, (e) => (u(), c("li", {
2010
2034
  key: e.id,
2011
2035
  class: "mbc__block"
2012
2036
  }, [
2013
- l("label", da, [
2037
+ l("label", ha, [
2014
2038
  l("span", {
2015
- class: Y(["p-checkbox p-component", { "p-disabled": !e.canApply }])
2039
+ class: W(["p-checkbox p-component", { "p-disabled": !e.canApply }])
2016
2040
  }, [
2017
2041
  l("input", {
2018
2042
  class: "p-checkbox-input",
2019
2043
  type: "checkbox",
2020
2044
  disabled: !e.canApply,
2021
2045
  checked: at.value[e.id] === !0,
2022
- onChange: (i) => vn(e.id, i)
2023
- }, null, 40, pa),
2046
+ onChange: (i) => kn(e.id, i)
2047
+ }, null, 40, ga),
2024
2048
  t[71] || (t[71] = l("span", { class: "p-checkbox-box" }, null, -1))
2025
2049
  ], 2),
2026
- l("span", ba, p(e.name || e.id), 1),
2050
+ l("span", _a, m(e.name || e.id), 1),
2027
2051
  l("span", {
2028
- class: Y(["p-tag", e.status === "modified" ? "p-tag-success" : e.status === "missing" ? "p-tag-warning" : ""])
2029
- }, p(o[e.status]), 3),
2030
- l("span", fa, p(e.module || "—"), 1)
2052
+ class: W(["p-tag", e.status === "modified" ? "p-tag-success" : e.status === "missing" ? "p-tag-warning" : ""])
2053
+ }, m(o[e.status]), 3),
2054
+ l("span", ya, m(e.module || "—"), 1)
2031
2055
  ]),
2032
- l("p", ma, [
2033
- e.status === "missing" ? (c(), d(E, { key: 0 }, [
2056
+ l("p", ka, [
2057
+ e.status === "missing" ? (u(), c(T, { key: 0 }, [
2034
2058
  C("目录里没有这一块,勾不上")
2035
- ], 64)) : e.changedFiles.length > 0 ? (c(), d(E, { key: 1 }, [
2059
+ ], 64)) : e.changedFiles.length > 0 ? (u(), c(T, { key: 1 }, [
2036
2060
  t[72] || (t[72] = C("改了:", -1)),
2037
- l("span", va, p(e.changedFiles.join(" / ")), 1)
2038
- ], 64)) : (c(), d(E, { key: 2 }, [
2061
+ l("span", $a, m(e.changedFiles.join(" / ")), 1)
2062
+ ], 64)) : (u(), c(T, { key: 2 }, [
2039
2063
  C("内容与库里一致")
2040
2064
  ], 64))
2041
2065
  ]),
2042
- e.blockedWhy ? (c(), d("p", ha, "不能存:" + p(e.blockedWhy), 1)) : x("", !0),
2043
- l("p", ga, p(e.folder || e.where), 1)
2066
+ e.blockedWhy ? (u(), c("p", wa, "不能存:" + m(e.blockedWhy), 1)) : x("", !0),
2067
+ l("p", xa, m(e.folder || e.where), 1)
2044
2068
  ]))), 128))
2045
- ])) : (c(), d("p", _a, "这个目录里没有认出任何块。")),
2046
- I.value.unmatched.length > 0 ? (c(), d("p", ya, "认不出归属的文件夹(" + p(I.value.unmatched.length) + "):" + p(I.value.unmatched.join(" / ")), 1)) : x("", !0),
2047
- (I.value.skipped ?? []).length > 0 ? (c(), d("p", ka, [
2048
- C(" 忽略了 " + p((I.value.skipped ?? []).length) + " 个文件夹(名字里没有 uuid,当测试文件处理 —— 与忽略 ", 1),
2069
+ ])) : (u(), c("p", Ca, "这个目录里没有认出任何块。")),
2070
+ N.value.unmatched.length > 0 ? (u(), c("p", Ea, "认不出归属的文件夹(" + m(N.value.unmatched.length) + "):" + m(N.value.unmatched.join(" / ")), 1)) : x("", !0),
2071
+ (N.value.skipped ?? []).length > 0 ? (u(), c("p", Ta, [
2072
+ C(" 忽略了 " + m((N.value.skipped ?? []).length) + " 个文件夹(名字里没有 uuid,当测试文件处理 —— 与忽略 ", 1),
2049
2073
  t[73] || (t[73] = l("span", { class: "mbc__mono" }, "example/", -1)),
2050
- C(" 同一个规矩):" + p((I.value.skipped ?? []).join(" / ")), 1)
2074
+ C(" 同一个规矩):" + m((N.value.skipped ?? []).join(" / ")), 1)
2051
2075
  ])) : x("", !0),
2052
- I.value.failures.length > 0 ? (c(), d("ul", $a, [
2053
- (c(!0), d(E, null, O(I.value.failures, (e, i) => (c(), d("li", { key: i }, p(e.where || e.kind) + ":" + p(e.message), 1))), 128))
2076
+ N.value.failures.length > 0 ? (u(), c("ul", Sa, [
2077
+ (u(!0), c(T, null, j(N.value.failures, (e, i) => (u(), c("li", { key: i }, m(e.where || e.kind) + ":" + m(e.message), 1))), 128))
2054
2078
  ])) : x("", !0),
2055
- l("div", wa, [
2079
+ l("div", Ba, [
2056
2080
  l("button", {
2057
2081
  class: "p-button p-button-sm mbc__act-import",
2058
2082
  type: "button",
2059
2083
  disabled: $.value,
2060
- onClick: t[24] || (t[24] = (e) => mn())
2061
- }, p(Ct.value ? "保存中…" : `保存选中的块(${Pt.value.length})`), 9, xa)
2084
+ onClick: t[24] || (t[24] = (e) => yn())
2085
+ }, m(Et.value ? "保存中…" : `保存选中的块(${Nt.value.length})`), 9, Aa)
2062
2086
  ])
2063
2087
  ], 64)) : x("", !0)
2064
2088
  ]),
2065
- lt.value.length > 0 || K.value.length > 0 ? (c(), d("section", Ca, [
2066
- l("h3", Ea, p(lt.value.length > 0 ? "前端校验拦下的问题" : "保存结果"), 1),
2067
- lt.value.length > 0 ? (c(), d("ul", Ta, [
2068
- (c(!0), d(E, null, O(lt.value, (e, i) => (c(), d("li", { key: i }, p(e), 1))), 128))
2069
- ])) : (c(), d("ul", Sa, [
2070
- (c(!0), d(E, null, O(K.value, (e) => (c(), d("li", {
2089
+ lt.value.length > 0 || U.value.length > 0 ? (u(), c("section", Ma, [
2090
+ l("h3", Oa, m(lt.value.length > 0 ? "前端校验拦下的问题" : "保存结果"), 1),
2091
+ lt.value.length > 0 ? (u(), c("ul", Ra, [
2092
+ (u(!0), c(T, null, j(lt.value, (e, i) => (u(), c("li", { key: i }, m(e), 1))), 128))
2093
+ ])) : (u(), c("ul", ja, [
2094
+ (u(!0), c(T, null, j(U.value, (e) => (u(), c("li", {
2071
2095
  key: e.id,
2072
- class: Y({ "is-ok": e.ok })
2096
+ class: W({ "is-ok": e.ok })
2073
2097
  }, [
2074
- l("strong", null, p(e.name || e.id) + ":" + p(e.ok ? "已保存" : "没保存"), 1),
2075
- !e.ok && e.error ? (c(), d("span", Ba, p(e.error), 1)) : x("", !0),
2076
- !e.ok && (e.issues ?? []).length > 0 ? (c(), d("ul", Ma, [
2077
- (c(!0), d(E, null, O(e.issues, (i, w) => (c(), d("li", { key: w }, p(i), 1))), 128))
2098
+ l("strong", null, m(e.name || e.id) + ":" + m(e.ok ? "已保存" : "没保存"), 1),
2099
+ !e.ok && e.error ? (u(), c("span", Pa, m(e.error), 1)) : x("", !0),
2100
+ !e.ok && (e.issues ?? []).length > 0 ? (u(), c("ul", La, [
2101
+ (u(!0), c(T, null, j(e.issues, (i, w) => (u(), c("li", { key: w }, m(i), 1))), 128))
2078
2102
  ])) : x("", !0)
2079
2103
  ], 2))), 128))
2080
2104
  ]))
2081
2105
  ])) : x("", !0),
2082
- l("footer", Aa, [
2083
- S.value.length > 0 ? (c(), d("button", {
2106
+ l("footer", Ia, [
2107
+ S.value.length > 0 ? (u(), c("button", {
2084
2108
  key: 0,
2085
2109
  class: "p-button p-button-sm mbc__report-btn",
2086
2110
  type: "button",
2087
2111
  title: "点开看全部报错(" + S.value.length + " 条)",
2088
- onClick: t[25] || (t[25] = (e) => F.value = !0)
2089
- }, "查看报错(" + p(S.value.length) + " 条)⚠", 9, Ra)) : x("", !0),
2090
- T.value ? (c(), d("p", ja, p(T.value), 1)) : g.value ? (c(), d("p", Oa, p(g.value), 1)) : (c(), d("p", Pa, "—"))
2112
+ onClick: t[25] || (t[25] = (e) => L.value = !0)
2113
+ }, "查看报错(" + m(S.value.length) + " 条)⚠", 9, Na)) : x("", !0),
2114
+ E.value ? (u(), c("p", Da, m(E.value), 1)) : g.value ? (u(), c("p", Fa, m(g.value), 1)) : (u(), c("p", za, "—"))
2091
2115
  ]),
2092
2116
  t[75] || (t[75] = l("div", {
2093
2117
  class: "mbc__tailspace",
2094
2118
  "aria-hidden": "true"
2095
2119
  }, null, -1))
2096
2120
  ], 2)) : x("", !0),
2097
- f.value && F.value ? (c(), d("div", {
2121
+ f.value && L.value ? (u(), c("div", {
2098
2122
  key: 1,
2099
2123
  class: "mbc__modal",
2100
2124
  role: "dialog",
2101
2125
  "aria-modal": "true",
2102
- onClick: t[30] || (t[30] = Ae((e) => F.value = !1, ["self"]))
2126
+ onClick: t[30] || (t[30] = Le((e) => L.value = !1, ["self"]))
2103
2127
  }, [
2104
- l("div", La, [
2105
- l("header", Ia, [
2106
- l("strong", null, "报错(" + p(S.value.length) + " 条)", 1),
2128
+ l("div", Ha, [
2129
+ l("header", Ua, [
2130
+ l("strong", null, "报错(" + m(S.value.length) + " 条)", 1),
2107
2131
  l("button", {
2108
2132
  class: "p-button p-button-sm p-button-text",
2109
2133
  type: "button",
2110
- onClick: t[26] || (t[26] = (e) => F.value = !1)
2134
+ onClick: t[26] || (t[26] = (e) => L.value = !1)
2111
2135
  }, "收起")
2112
2136
  ]),
2113
- l("div", Na, [
2114
- l("ol", Da, [
2115
- (c(!0), d(E, null, O(S.value, (e, i) => (c(), d("li", { key: i }, [
2116
- l("div", Fa, [
2117
- l("span", za, p(e.at), 1),
2118
- C(" · " + p(e.where), 1)
2137
+ l("div", Ka, [
2138
+ l("ol", qa, [
2139
+ (u(!0), c(T, null, j(S.value, (e, i) => (u(), c("li", { key: i }, [
2140
+ l("div", Va, [
2141
+ l("span", Ga, m(e.at), 1),
2142
+ C(" · " + m(e.where), 1)
2119
2143
  ]),
2120
- l("pre", Ha, p(e.text), 1)
2144
+ l("pre", Ja, m(e.text), 1)
2121
2145
  ]))), 128))
2122
2146
  ]),
2123
- S.value.length === 0 ? (c(), d("p", Ua, "这一轮没有报错。")) : x("", !0)
2147
+ S.value.length === 0 ? (u(), c("p", Wa, "这一轮没有报错。")) : x("", !0)
2124
2148
  ]),
2125
- l("footer", Ka, [
2149
+ l("footer", Ya, [
2126
2150
  l("button", {
2127
2151
  class: "p-button p-button-sm p-button-outlined",
2128
2152
  type: "button",
2129
- onClick: t[27] || (t[27] = (e) => un())
2153
+ onClick: t[27] || (t[27] = (e) => mn())
2130
2154
  }, "复制全部"),
2131
2155
  l("button", {
2132
2156
  class: "p-button p-button-sm p-button-text",
2133
2157
  type: "button",
2134
- onClick: t[28] || (t[28] = (e) => Vt())
2158
+ onClick: t[28] || (t[28] = (e) => Yt())
2135
2159
  }, "清空报错"),
2136
2160
  l("button", {
2137
2161
  class: "p-button p-button-sm",
2138
2162
  type: "button",
2139
- onClick: t[29] || (t[29] = (e) => F.value = !1)
2163
+ onClick: t[29] || (t[29] = (e) => L.value = !1)
2140
2164
  }, "知道了")
2141
2165
  ])
2142
2166
  ])
2143
2167
  ])) : x("", !0),
2144
- f.value ? (c(), d("button", {
2168
+ f.value ? (u(), c("button", {
2145
2169
  key: 2,
2146
2170
  class: "mbc__close",
2147
2171
  type: "button",
@@ -2150,25 +2174,25 @@ ${t.text}`).join(`
2150
2174
  }, "×")) : x("", !0)
2151
2175
  ])) : x("", !0);
2152
2176
  }
2153
- }), Za = /* @__PURE__ */ Pe(qa, [["__scopeId", "data-v-8327a21b"]]);
2177
+ }), sl = /* @__PURE__ */ Fe(Xa, [["__scopeId", "data-v-d37cf71b"]]);
2154
2178
  export {
2155
- yn as API_BASE,
2156
- zn as BLOCK_BACKEND_FILE,
2157
- Bt as BLOCK_ENTRY,
2158
- Xt as BLOCK_MANIFEST,
2159
- xn as CLIENT_SOURCE,
2160
- It as MANIFEST_KEYS,
2161
- Za as MagicBlockConsole,
2162
- Ya as MagicBlockPage,
2163
- ce as NAME_MAX,
2164
- Gn as buildPreview,
2165
- Fn as checkSelection,
2166
- Tn as installBridge,
2167
- Zn as loadBlockRender,
2168
- Wn as onBlockRenderRefresh,
2169
- In as parseManifest,
2170
- Yn as refreshBlockRender,
2171
- Nn as validFileName,
2172
- Rn as validName,
2173
- Dn as validateBlock
2179
+ Cn as API_BASE,
2180
+ Vn as BLOCK_BACKEND_FILE,
2181
+ Mt as BLOCK_ENTRY,
2182
+ ne as BLOCK_MANIFEST,
2183
+ Bn as CLIENT_SOURCE,
2184
+ Ft as MANIFEST_KEYS,
2185
+ sl as MagicBlockConsole,
2186
+ ol as MagicBlockPage,
2187
+ me as NAME_MAX,
2188
+ Qn as buildPreview,
2189
+ qn as checkSelection,
2190
+ On as installBridge,
2191
+ no as loadBlockRender,
2192
+ to as onBlockRenderRefresh,
2193
+ Hn as parseManifest,
2194
+ eo as refreshBlockRender,
2195
+ Un as validFileName,
2196
+ In as validName,
2197
+ Kn as validateBlock
2174
2198
  };