labull-framework 0.1.20 → 0.1.22

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