labull-framework 0.1.12 → 0.1.16

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