@beeintel/batch-image 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -184
- package/dist/chunks/{AdjustToolPanel-BELqYSUR.js → AdjustToolPanel-DCNhkuE4.js} +29 -28
- package/dist/chunks/BackgroundToolPanel-D3TILm-m.js +43 -0
- package/dist/chunks/{BatchMaterials-niGKrga3.js → BatchMaterials-BPJeE3y9.js} +1 -1
- package/dist/chunks/BatchModeChoices-BuP83uOq.js +118 -0
- package/dist/chunks/{BatchOutputColorPicker-CCvmIF-b.js → BatchOutputColorPicker-CZoQzBII.js} +1 -1
- package/dist/chunks/BatchReferenceFields-B7SL__lu.js +308 -0
- package/dist/chunks/BeautifyToolPanel-DsTOjndh.js +220 -0
- package/dist/chunks/{BrandMarkToolPanel-FKxXth_3.js → BrandMarkToolPanel-Cob9bPYT.js} +319 -333
- package/dist/chunks/{ContentTrimControl-BQfigZPq.js → ContentTrimControl-CKNfHz_u.js} +1 -1
- package/dist/chunks/{CropToolPanel-BhSuHkYm.js → CropToolPanel-6MiynTP2.js} +60 -56
- package/dist/chunks/CutoutToolPanel-V-AUrbwz.js +78 -0
- package/dist/chunks/DisclosureToolPanel-DvouSIbA.js +72 -0
- package/dist/chunks/ExpandToolPanel-C98UZmBx.js +69 -0
- package/dist/chunks/{ImageEffectsToolPanel-BRLPIt4q.js → ImageEffectsToolPanel-hA0TlEix.js} +63 -52
- package/dist/chunks/{IpAuditToolPanel-DfY-mBSe.js → IpAuditToolPanel-BCQ8Kewh.js} +15 -13
- package/dist/chunks/{ListingToolPanel-B9Yh3LBK.js → ListingToolPanel-DH-xpvLp.js} +170 -184
- package/dist/chunks/{MaterialSelectionPlate-DhioUjdW.js → MaterialSelectionPlate-CQBIf6ZJ.js} +4 -4
- package/dist/chunks/MetadataToolPanel-z4RK3JCb.js +116 -0
- package/dist/chunks/{OrientToolPanel-BTrwaWBm.js → OrientToolPanel-BwtT0xKI.js} +2 -2
- package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-DIRuJ1De.js +122 -0
- package/dist/chunks/ResizeToolPanel-BVeZbKJl.js +1171 -0
- package/dist/chunks/RetouchToolPanel-CqSzWVOK.js +358 -0
- package/dist/chunks/ShadowToolPanel-BgsCgLay.js +258 -0
- package/dist/chunks/SvgExportToolPanel-CdCXYYHF.js +208 -0
- package/dist/chunks/TranslationToolPanel-D4ETI6sf.js +102 -0
- package/dist/chunks/{UpscaleToolPanel-D0H-j2Tr.js → UpscaleToolPanel-D_hmQLEi.js} +44 -39
- package/dist/chunks/arrow-up-C1vBvuff.js +18 -0
- package/dist/chunks/{entry-DK9FjQZ_.js → entry-DVV89YMR.js} +7504 -7389
- package/dist/chunks/{loader-circle-UFoEem2a.js → loader-circle-GPucRX_4.js} +1 -1
- package/dist/chunks/{motionFeatures-D4miwXxc.js → motionFeatures-_pQ-ZW4p.js} +1 -1
- package/dist/chunks/{search-BjTSm1KS.js → search-CUAg5uDr.js} +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -5
- package/dist/resources.json +104 -94
- package/dist/slots.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/tool-links.d.ts +10 -0
- package/dist/types/batch/public/config.d.ts +6 -0
- package/package.json +95 -95
- package/dist/chunks/BackgroundToolPanel-Dy_l8KFl.js +0 -41
- package/dist/chunks/BatchModeChoices-BRqn6zNI.js +0 -111
- package/dist/chunks/BatchReferenceFields-C4t7OSTw.js +0 -316
- package/dist/chunks/BeautifyToolPanel-Dc-ddaBC.js +0 -215
- package/dist/chunks/CutoutToolPanel-BfaZZSE_.js +0 -73
- package/dist/chunks/DisclosureToolPanel-B_oc5fld.js +0 -76
- package/dist/chunks/ExpandToolPanel-D_ZODTUZ.js +0 -67
- package/dist/chunks/MetadataToolPanel-KVrtb3K0.js +0 -104
- package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-C2kJCYeA.js +0 -102
- package/dist/chunks/ResizeToolPanel-Ch_-WR74.js +0 -1178
- package/dist/chunks/RetouchToolPanel-BTS33Dsd.js +0 -350
- package/dist/chunks/ShadowToolPanel-DxJE4eyV.js +0 -254
- package/dist/chunks/SvgExportToolPanel-RHmuQARH.js +0 -219
- package/dist/chunks/TranslationToolPanel-B_qTA1hM.js +0 -125
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { a6 as ge, a7 as _e, a8 as ie, a9 as
|
|
3
|
-
import { L as
|
|
4
|
-
import { C as
|
|
5
|
-
import { a as
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
1
|
+
import { defineComponent as $e, inject as va, ref as j, onMounted as ze, watch as J, onUnmounted as Ke, computed as K, openBlock as I, createElementBlock as L, withModifiers as Ue, unref as n, createElementVNode as P, Fragment as de, renderList as ve, toDisplayString as w, createBlock as he, createCommentVNode as z, createVNode as ce, createTextVNode as re, nextTick as Me, withCtx as xe } from "vue";
|
|
2
|
+
import { a6 as ge, a7 as _e, a8 as ie, a9 as ka, F as Fe, aa as fa, ab as ha, ac as je, ad as ya, ae as wa, af as ke, ag as _a, ah as Pa, a3 as Ge, ai as Ia, P as Ea, R as La, aj as Ve, ak as $, al as Ma, am as We, an as He, ao as xa, ap as Va, aq as fe, _ as Aa, G as Ba, ar as qa } from "./entry-DVV89YMR.js";
|
|
3
|
+
import { L as Sa, n as Z, r as ue, a_ as ne, a1 as ye } from "./hosted-resources-COzZ7nZY.js";
|
|
4
|
+
import { C as Ca } from "./ContentTrimControl-CKNfHz_u.js";
|
|
5
|
+
import { a as Oa } from "./static-logo-2F9ORZWc.js";
|
|
6
|
+
import { u as Ra, a as Ta, _ as Na, n as Da } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-DIRuJ1De.js";
|
|
7
|
+
const za = "" + new URL("../assets/logo-preparation.worker-D9oa7SME.js", import.meta.url).href;
|
|
8
|
+
function Je(i) {
|
|
9
9
|
const s = new OffscreenCanvas(i.width, i.height), a = s.getContext("2d");
|
|
10
10
|
if (!a) throw new Error("浏览器不支持本机 Logo 处理");
|
|
11
11
|
a.drawImage(i, 0, 0);
|
|
@@ -16,7 +16,7 @@ function Ye(i) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
const Ae = () => new DOMException("Logo 准备已取消", "AbortError");
|
|
19
|
-
function
|
|
19
|
+
function Ka(i) {
|
|
20
20
|
let s, a, c = !1, t = 0, g;
|
|
21
21
|
function u() {
|
|
22
22
|
s?.dispose(), s = void 0, a?.terminate(), a = void 0;
|
|
@@ -32,9 +32,9 @@ function ja(i) {
|
|
|
32
32
|
run(l, p) {
|
|
33
33
|
const R = ["intelligent", "isnet_fp16", "birefnet_quality"].includes(
|
|
34
34
|
p.method
|
|
35
|
-
),
|
|
36
|
-
return new Promise((
|
|
37
|
-
if (c ||
|
|
35
|
+
), y = p.crop?.kind === "alpha", { signal: k, onProgress: V } = p;
|
|
36
|
+
return new Promise((f, M) => {
|
|
37
|
+
if (c || k?.aborted) {
|
|
38
38
|
M(Ae());
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -46,9 +46,9 @@ function ja(i) {
|
|
|
46
46
|
M(new Error("Logo 需为5MiB以内的PNG、JPEG或WebP"));
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
g?.id ===
|
|
51
|
-
}, h = () => b(Ae()),
|
|
49
|
+
const E = ++t, b = (C) => {
|
|
50
|
+
g?.id === E && (g.cleanup(), g = void 0, u(), M(C));
|
|
51
|
+
}, h = () => b(Ae()), S = setTimeout(
|
|
52
52
|
() => b(
|
|
53
53
|
Object.assign(new Error("Logo 准备超时,请保留原图或更换素材"), {
|
|
54
54
|
reason: "local-transient"
|
|
@@ -56,15 +56,15 @@ function ja(i) {
|
|
|
56
56
|
),
|
|
57
57
|
p.method === "birefnet_quality" ? 20 * 6e4 + 3e4 : R ? 21e4 : 3e4
|
|
58
58
|
);
|
|
59
|
-
g = { id:
|
|
60
|
-
clearTimeout(
|
|
61
|
-
} },
|
|
59
|
+
g = { id: E, reject: M, resolve: f, cleanup: () => {
|
|
60
|
+
clearTimeout(S), k?.removeEventListener("abort", h);
|
|
61
|
+
} }, k?.addEventListener("abort", h, { once: !0 });
|
|
62
62
|
try {
|
|
63
|
-
a ??=
|
|
63
|
+
a ??= Sa(za, {
|
|
64
64
|
type: "module"
|
|
65
|
-
}), a.onmessage = async (
|
|
66
|
-
if (g?.id !==
|
|
67
|
-
const _ =
|
|
65
|
+
}), a.onmessage = async (C) => {
|
|
66
|
+
if (g?.id !== C.data.id) return;
|
|
67
|
+
const _ = C.data;
|
|
68
68
|
if (_.error) {
|
|
69
69
|
b(Object.assign(new Error(_.error), { reason: _.reason }));
|
|
70
70
|
return;
|
|
@@ -80,7 +80,7 @@ function ja(i) {
|
|
|
80
80
|
if (!i || i.supports?.(T) === !1)
|
|
81
81
|
throw new Error("Logo 本机抠图资源尚未配置");
|
|
82
82
|
const Y = await crypto.subtle.digest("SHA-256", await _.blob.arrayBuffer());
|
|
83
|
-
if (g?.id !==
|
|
83
|
+
if (g?.id !== E || k?.aborted) return;
|
|
84
84
|
s = i.createExecutor();
|
|
85
85
|
const v = await s.run(
|
|
86
86
|
{
|
|
@@ -98,12 +98,12 @@ function ja(i) {
|
|
|
98
98
|
},
|
|
99
99
|
_.blob,
|
|
100
100
|
{
|
|
101
|
-
signal:
|
|
101
|
+
signal: k ?? new AbortController().signal,
|
|
102
102
|
readAsset: async () => {
|
|
103
103
|
throw new Error("Logo cutout does not reference additional assets");
|
|
104
104
|
},
|
|
105
105
|
progress: (d) => {
|
|
106
|
-
g?.id ===
|
|
106
|
+
g?.id === E && !k?.aborted && V?.(d.total ? d.completed / d.total : void 0);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
).catch((d) => {
|
|
@@ -112,9 +112,9 @@ function ja(i) {
|
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
if (v.kind !== "image") throw new Error("Logo 处理结果无效");
|
|
115
|
-
if (g?.id !==
|
|
115
|
+
if (g?.id !== E || k?.aborted) return;
|
|
116
116
|
s.dispose(), s = void 0, A = {
|
|
117
|
-
id:
|
|
117
|
+
id: E,
|
|
118
118
|
blob: v.blob,
|
|
119
119
|
width: _.width,
|
|
120
120
|
height: _.height,
|
|
@@ -131,25 +131,25 @@ function ja(i) {
|
|
|
131
131
|
throw new Error("Logo PNG 无效");
|
|
132
132
|
const T = await createImageBitmap(A.blob);
|
|
133
133
|
try {
|
|
134
|
-
if (
|
|
134
|
+
if (Je(T), !y && (T.width !== _.width || T.height !== _.height) || T.width !== A.width || T.height !== A.height || T.width * T.height > _e)
|
|
135
135
|
throw new Error("Logo 处理结果尺寸无效");
|
|
136
136
|
} finally {
|
|
137
137
|
T.close();
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
if (g?.id !==
|
|
141
|
-
g.cleanup(), g = void 0, u(),
|
|
140
|
+
if (g?.id !== E || k?.aborted) return;
|
|
141
|
+
g.cleanup(), g = void 0, u(), f(A);
|
|
142
142
|
} catch (A) {
|
|
143
143
|
b(A);
|
|
144
144
|
}
|
|
145
145
|
}, a.onerror = () => b(new Error("Logo 准备失败,原图保留")), a.onmessageerror = () => b(new Error("无法读取 Logo 处理结果")), a.postMessage({
|
|
146
|
-
id:
|
|
146
|
+
id: E,
|
|
147
147
|
blob: l,
|
|
148
148
|
normalizeOnly: R || p.method === "original",
|
|
149
149
|
crop: p.crop
|
|
150
150
|
});
|
|
151
|
-
} catch (
|
|
152
|
-
b(
|
|
151
|
+
} catch (C) {
|
|
152
|
+
b(C);
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
}
|
|
@@ -160,7 +160,7 @@ function we(i) {
|
|
|
160
160
|
return { clientRequestId: s, operationId: a, itemId: c, inputVersionId: t };
|
|
161
161
|
}
|
|
162
162
|
function Be(i) {
|
|
163
|
-
const s = ue(i), a = ie(s.source), c =
|
|
163
|
+
const s = ue(i), a = ie(s.source), c = ka(s.settings), t = ue(s.request), g = ue(t.source), u = ue(t.params), l = ue(s.outcome);
|
|
164
164
|
if (g.kind !== "asset" || g.assetId !== a.assetId || g.assetVersionId !== a.assetVersionId || t.toolId !== "cutout" || t.toolVersion !== "1" || u.model !== c.background || !["picwish", "ideogram"].includes(c.background))
|
|
165
165
|
throw new Error("Logo receipt identity invalid");
|
|
166
166
|
const p = {
|
|
@@ -181,24 +181,24 @@ function Be(i) {
|
|
|
181
181
|
};
|
|
182
182
|
if (l.kind === "reserved" || l.kind === "unknown")
|
|
183
183
|
return { ...R, outcome: { kind: l.kind } };
|
|
184
|
-
const
|
|
185
|
-
if (l.kind === "receipt") return { ...R, outcome: { kind: "receipt", receipt:
|
|
186
|
-
if (l.kind === "ready" &&
|
|
184
|
+
const y = ye(l.receipt, we(p));
|
|
185
|
+
if (l.kind === "receipt") return { ...R, outcome: { kind: "receipt", receipt: y } };
|
|
186
|
+
if (l.kind === "ready" && y.status === "succeeded")
|
|
187
187
|
return {
|
|
188
188
|
...R,
|
|
189
|
-
outcome: { kind: "ready", receipt:
|
|
189
|
+
outcome: { kind: "ready", receipt: y, master: ie(l.master) }
|
|
190
190
|
};
|
|
191
191
|
throw new Error("Logo receipt state invalid");
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function qe() {
|
|
194
194
|
return new Promise((i, s) => {
|
|
195
195
|
const a = indexedDB.open("batch-logo-attempts-v2", 1);
|
|
196
196
|
a.onupgradeneeded = () => a.result.createObjectStore("attempts", { keyPath: "key" }), a.onerror = () => s(a.error), a.onsuccess = () => i(a.result);
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
const
|
|
199
|
+
const Ua = {
|
|
200
200
|
async reserve(i) {
|
|
201
|
-
const s = await
|
|
201
|
+
const s = await qe();
|
|
202
202
|
return new Promise((a, c) => {
|
|
203
203
|
const t = s.transaction("attempts", "readwrite"), g = t.objectStore("attempts");
|
|
204
204
|
let u = { attempt: i, submit: !1 };
|
|
@@ -220,7 +220,7 @@ const Ga = {
|
|
|
220
220
|
});
|
|
221
221
|
},
|
|
222
222
|
async save(i) {
|
|
223
|
-
const s = await
|
|
223
|
+
const s = await qe();
|
|
224
224
|
return new Promise((a, c) => {
|
|
225
225
|
const t = s.transaction("attempts", "readwrite"), g = t.objectStore("attempts"), u = g.get(i.key);
|
|
226
226
|
u.onsuccess = () => {
|
|
@@ -240,8 +240,8 @@ const Ga = {
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
|
-
async function
|
|
244
|
-
const s = await
|
|
243
|
+
async function ja(i) {
|
|
244
|
+
const s = await qe();
|
|
245
245
|
return new Promise((a, c) => {
|
|
246
246
|
const t = s.transaction("attempts", "readonly"), g = t.objectStore("attempts").openCursor(), u = [];
|
|
247
247
|
g.onsuccess = () => {
|
|
@@ -261,18 +261,18 @@ async function Wa(i) {
|
|
|
261
261
|
};
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
function
|
|
264
|
+
const Xe = "logo-v2";
|
|
265
|
+
function Ye(i, s, a) {
|
|
266
266
|
return JSON.stringify([
|
|
267
267
|
i,
|
|
268
268
|
s.assetId,
|
|
269
269
|
s.assetVersionId,
|
|
270
270
|
s.sha256,
|
|
271
271
|
a.background,
|
|
272
|
-
|
|
272
|
+
Xe
|
|
273
273
|
]);
|
|
274
274
|
}
|
|
275
|
-
async function
|
|
275
|
+
async function Ga(i, s) {
|
|
276
276
|
const a = () => {
|
|
277
277
|
throw new Error("Logo cloud services not configured");
|
|
278
278
|
}, { document: c, signal: t, ownerBatchId: g } = i, u = c.desired, l = c.original;
|
|
@@ -281,12 +281,12 @@ async function $a(i, s) {
|
|
|
281
281
|
if (t.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
282
282
|
};
|
|
283
283
|
p();
|
|
284
|
-
const R = u.background === "original" ? void 0 : c.masters.find((
|
|
285
|
-
let
|
|
286
|
-
if (!
|
|
284
|
+
const R = u.background === "original" ? void 0 : c.masters.find((f) => f.background === u.background);
|
|
285
|
+
let y = R?.asset;
|
|
286
|
+
if (!y && u.background === "original" && (y = l), !y && (u.background === "picwish" || u.background === "ideogram")) {
|
|
287
287
|
i.onStage?.("cloud");
|
|
288
|
-
const
|
|
289
|
-
key:
|
|
288
|
+
const f = s.journal ?? Ua, M = {
|
|
289
|
+
key: Ye(g, l, u),
|
|
290
290
|
ownerBatchId: g,
|
|
291
291
|
source: l,
|
|
292
292
|
settings: u,
|
|
@@ -301,17 +301,17 @@ async function $a(i, s) {
|
|
|
301
301
|
params: { execution: "python", model: u.background, background: "transparent" }
|
|
302
302
|
},
|
|
303
303
|
outcome: { kind: "reserved" }
|
|
304
|
-
},
|
|
305
|
-
let b =
|
|
306
|
-
if (b.outcome.kind === "ready")
|
|
304
|
+
}, E = await f.reserve(M);
|
|
305
|
+
let b = E.attempt;
|
|
306
|
+
if (b.outcome.kind === "ready") y = ie(b.outcome.master);
|
|
307
307
|
else
|
|
308
308
|
try {
|
|
309
309
|
p();
|
|
310
|
-
let h =
|
|
310
|
+
let h = E.submit ? await (s.submit ?? a)(b.request) : b.outcome.kind === "receipt" ? await (s.queryTask ?? a)(b.outcome.receipt.taskId, "python-ai") : await (s.queryRequest ?? a)(
|
|
311
311
|
b.request.clientRequestId,
|
|
312
312
|
"python-ai"
|
|
313
313
|
);
|
|
314
|
-
h = ye(h, we(b.request)), !
|
|
314
|
+
h = ye(h, we(b.request)), !E.submit && h.status === "failed" && [
|
|
315
315
|
"PROVIDER_PENDING",
|
|
316
316
|
"PROVIDER_ACCEPTANCE_UNKNOWN",
|
|
317
317
|
"GATEWAY_UNAVAILABLE",
|
|
@@ -319,113 +319,110 @@ async function $a(i, s) {
|
|
|
319
319
|
].includes(h.error?.code ?? "") && (h = ye(
|
|
320
320
|
await (s.queryOriginal ?? a)(h.taskId),
|
|
321
321
|
we(b.request)
|
|
322
|
-
)), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await
|
|
323
|
-
const
|
|
324
|
-
for (; ["accepted", "queued", "running"].includes(h.status) && Date.now() <
|
|
322
|
+
)), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await f.save(b);
|
|
323
|
+
const S = Date.now() + 3e4;
|
|
324
|
+
for (; ["accepted", "queued", "running"].includes(h.status) && Date.now() < S && !t.aborted && (await new Promise(
|
|
325
325
|
(G) => setTimeout(G, Math.min(h.pollAfterMs ?? 1500, 3e3))
|
|
326
326
|
), !t.aborted); )
|
|
327
327
|
h = ye(
|
|
328
328
|
await (s.queryTask ?? a)(h.taskId, "python-ai"),
|
|
329
329
|
we(b.request)
|
|
330
|
-
), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await
|
|
330
|
+
), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await f.save(b);
|
|
331
331
|
if (h.status === "succeeded" && h.result?.kind === "image") {
|
|
332
|
-
|
|
332
|
+
y = ie(h.result.asset);
|
|
333
333
|
const G = l.orientation && l.orientation >= 5 ? [l.height, l.width] : [l.width, l.height];
|
|
334
|
-
if (
|
|
334
|
+
if (y.width !== G[0] || y.height !== G[1] || y.mime !== "image/png")
|
|
335
335
|
throw new Error("Logo 处理结果尺寸无效");
|
|
336
|
-
const
|
|
336
|
+
const C = await s.read(y, AbortSignal.timeout(3e4)), _ = new Uint8Array(await C.slice(0, 8).arrayBuffer());
|
|
337
337
|
if (![137, 80, 78, 71, 13, 10, 26, 10].every((U, T) => _[T] === U))
|
|
338
338
|
throw new Error("Logo PNG 无效");
|
|
339
|
-
const A = await createImageBitmap(
|
|
339
|
+
const A = await createImageBitmap(C);
|
|
340
340
|
try {
|
|
341
|
-
if (
|
|
341
|
+
if (Je(A), A.width !== y.width || A.height !== y.height)
|
|
342
342
|
throw new Error("Logo 处理结果尺寸无效");
|
|
343
343
|
} finally {
|
|
344
344
|
A.close();
|
|
345
345
|
}
|
|
346
|
-
await
|
|
346
|
+
await f.save({ ...b, outcome: { kind: "ready", receipt: h, master: y } });
|
|
347
347
|
} else
|
|
348
348
|
throw Object.assign(new Error("Logo 云端任务尚未完成,请查询原任务"), {
|
|
349
349
|
reason: "cloud-unknown"
|
|
350
350
|
});
|
|
351
351
|
} catch (h) {
|
|
352
|
-
throw b.outcome.kind === "reserved" && await
|
|
352
|
+
throw b.outcome.kind === "reserved" && await f.save({ ...b, outcome: { kind: "unknown" } }), Object.assign(h instanceof Error ? h : new Error(String(h)), {
|
|
353
353
|
reason: "cloud-unknown"
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
if (!
|
|
357
|
+
if (!y) {
|
|
358
358
|
i.onStage?.("model");
|
|
359
|
-
const
|
|
359
|
+
const f = await s.read(l, t);
|
|
360
360
|
if (p(), u.background === "picwish" || u.background === "ideogram")
|
|
361
361
|
throw new Error("Logo cloud result missing");
|
|
362
|
-
const M = await s.preparer.run(
|
|
362
|
+
const M = await s.preparer.run(f, {
|
|
363
363
|
method: u.background,
|
|
364
364
|
signal: t,
|
|
365
365
|
onProgress: i.onProgress
|
|
366
366
|
});
|
|
367
|
-
p(), i.onStage?.("save"),
|
|
367
|
+
p(), i.onStage?.("save"), y = ie(await s.save(M.blob, "brand-logo-master.png")), p();
|
|
368
368
|
}
|
|
369
369
|
p();
|
|
370
|
-
const
|
|
370
|
+
const k = {
|
|
371
371
|
background: u.background,
|
|
372
|
-
processorVersion: R?.processorVersion ??
|
|
373
|
-
asset:
|
|
372
|
+
processorVersion: R?.processorVersion ?? Xe,
|
|
373
|
+
asset: y
|
|
374
374
|
};
|
|
375
|
-
await i.onMaster?.(
|
|
376
|
-
let
|
|
375
|
+
await i.onMaster?.(k), p();
|
|
376
|
+
let V = y;
|
|
377
377
|
if (u.crop.kind === "alpha") {
|
|
378
378
|
i.onStage?.("derive");
|
|
379
|
-
const
|
|
379
|
+
const f = await s.read(y, t);
|
|
380
380
|
p();
|
|
381
|
-
const M = await s.preparer.run(
|
|
381
|
+
const M = await s.preparer.run(f, {
|
|
382
382
|
method: "original",
|
|
383
383
|
crop: u.crop,
|
|
384
384
|
signal: t
|
|
385
385
|
});
|
|
386
|
-
p(), i.onStage?.("save"),
|
|
386
|
+
p(), i.onStage?.("save"), V = ie(await s.save(M.blob, "brand-logo.png")), p();
|
|
387
387
|
}
|
|
388
388
|
return p(), {
|
|
389
389
|
...c,
|
|
390
|
-
applied: { settings: u, asset:
|
|
391
|
-
masters: [...c.masters.filter((
|
|
390
|
+
applied: { settings: u, asset: V },
|
|
391
|
+
masters: [...c.masters.filter((f) => f.background !== u.background), k],
|
|
392
392
|
state: { kind: "idle" }
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const Wa = ["disabled", "aria-label"], $a = ["aria-label"], Fa = ["aria-label", "aria-checked", "tabindex", "onClick", "onKeydown"], Ha = ["aria-label"], Ja = ["aria-label", "disabled"], Xa = ["src", "alt"], Ya = { key: 2 }, Qa = ["aria-label"], Za = { class: "logo-background-select" }, eo = ["value", "disabled"], ao = { value: "original" }, oo = { value: "solid" }, to = ["value", "disabled"], ro = {
|
|
396
396
|
key: 1,
|
|
397
397
|
class: "hint"
|
|
398
|
-
},
|
|
398
|
+
}, no = {
|
|
399
399
|
key: 2,
|
|
400
400
|
class: "hint",
|
|
401
401
|
role: "status"
|
|
402
|
-
},
|
|
402
|
+
}, io = {
|
|
403
403
|
key: 3,
|
|
404
|
-
class: "hint"
|
|
405
|
-
}, uo = {
|
|
406
|
-
key: 4,
|
|
407
404
|
class: "hint logo-progress",
|
|
408
405
|
role: "status",
|
|
409
406
|
"aria-live": "polite"
|
|
410
|
-
},
|
|
407
|
+
}, so = { class: "logo-progress-label" }, lo = ["value"], uo = ["aria-label", "title"], co = {
|
|
408
|
+
key: 4,
|
|
409
|
+
class: "logo-actions"
|
|
410
|
+
}, go = ["disabled"], mo = {
|
|
411
411
|
key: 5,
|
|
412
412
|
class: "logo-actions"
|
|
413
|
-
},
|
|
413
|
+
}, bo = ["disabled"], po = {
|
|
414
414
|
key: 6,
|
|
415
|
-
class: "logo-actions"
|
|
416
|
-
}, ko = ["disabled"], fo = {
|
|
417
|
-
key: 7,
|
|
418
415
|
class: "logo-error",
|
|
419
416
|
role: "alert"
|
|
420
|
-
},
|
|
417
|
+
}, vo = { class: "brand-field-label" }, ko = ["aria-label"], fo = ["aria-label", "aria-pressed", "onClick"], ho = ["aria-label", "min", "max", "value", "onInput"], yo = ["aria-label", "title", "aria-valuetext", "min", "max", "value", "onInput"], wo = {
|
|
421
418
|
key: 0,
|
|
422
419
|
class: "brand-density-ticks",
|
|
423
420
|
"aria-hidden": "true"
|
|
424
|
-
},
|
|
425
|
-
key:
|
|
421
|
+
}, _o = {
|
|
422
|
+
key: 8,
|
|
426
423
|
class: "logo-error",
|
|
427
424
|
role: "alert"
|
|
428
|
-
},
|
|
425
|
+
}, Po = ["aria-label"], Io = /* @__PURE__ */ $e({
|
|
429
426
|
__name: "BrandMarkPanel",
|
|
430
427
|
props: {
|
|
431
428
|
modelValue: {},
|
|
@@ -439,26 +436,26 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
439
436
|
},
|
|
440
437
|
emits: ["update:modelValue", "validity"],
|
|
441
438
|
setup(i, { emit: s }) {
|
|
442
|
-
const { ui: a, uiText: c } =
|
|
439
|
+
const { ui: a, uiText: c } = Fe(), t = i, g = s, u = fa(), l = va(ha, void 0), p = je(() => t.modelValue.logo ?? t.modelValue.originalLogo);
|
|
443
440
|
function R(e) {
|
|
444
441
|
if (!t.uploadReference) throw Error("参考素材注册能力尚未配置");
|
|
445
442
|
return t.uploadReference(e);
|
|
446
443
|
}
|
|
447
|
-
const
|
|
448
|
-
let
|
|
444
|
+
const y = j(), k = j(!1), V = j(""), f = j(""), M = j({});
|
|
445
|
+
let E = 0, b, h, S, G, C;
|
|
449
446
|
const _ = j([]);
|
|
450
447
|
async function A() {
|
|
451
448
|
const e = t.scopeKey ?? "";
|
|
452
449
|
try {
|
|
453
|
-
const r = await
|
|
450
|
+
const r = await ja(e);
|
|
454
451
|
U && (t.scopeKey ?? "") === e && (_.value = r);
|
|
455
452
|
} catch {
|
|
456
453
|
U && (t.scopeKey ?? "") === e && (_.value = []);
|
|
457
454
|
}
|
|
458
455
|
}
|
|
459
|
-
|
|
456
|
+
ze(A), J(() => t.scopeKey, A);
|
|
460
457
|
let U = !0;
|
|
461
|
-
|
|
458
|
+
Ke(() => {
|
|
462
459
|
U = !1;
|
|
463
460
|
});
|
|
464
461
|
const T = [
|
|
@@ -471,20 +468,20 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
471
468
|
["bottom-left", "左下", "↙"],
|
|
472
469
|
["bottom", "底部", "↓"],
|
|
473
470
|
["bottom-right", "右下", "↘"]
|
|
474
|
-
], Y = j(), v =
|
|
475
|
-
function
|
|
471
|
+
], Y = j(), v = K(() => ya(t.modelValue)), d = K(() => wa(v.value)), B = K(() => d.value.desired), Qe = K(() => ["picwish", "ideogram"].includes(B.value.background)), W = j("");
|
|
472
|
+
function Ze(e) {
|
|
476
473
|
const r = d.value;
|
|
477
474
|
if (r.kind !== "loaded") return !1;
|
|
478
475
|
if (r.masters.some((m) => m.background === e)) return !0;
|
|
479
476
|
const o = r.original;
|
|
480
477
|
return !!o && _.value.some(
|
|
481
|
-
(m) => m.key ===
|
|
478
|
+
(m) => m.key === Ye(t.scopeKey ?? "", o, { ...r.desired, background: e })
|
|
482
479
|
);
|
|
483
480
|
}
|
|
484
481
|
function ee(e) {
|
|
485
482
|
if (e === "original" || e === "solid" || d.value.kind === "loaded" && d.value.masters.some((o) => o.background === e))
|
|
486
483
|
return !0;
|
|
487
|
-
if (!
|
|
484
|
+
if (!Ze(e) && !(t.availableCutoutModes ?? []).includes(e))
|
|
488
485
|
return !1;
|
|
489
486
|
if (e === "picwish" || e === "ideogram") {
|
|
490
487
|
const o = l?.services;
|
|
@@ -497,49 +494,46 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
497
494
|
background: "transparent"
|
|
498
495
|
}) !== !1;
|
|
499
496
|
}
|
|
500
|
-
const Se =
|
|
501
|
-
const e = B.value.background;
|
|
502
|
-
return qe(e) || e === "original" || e === "solid" ? 0 : Pa(e, 1);
|
|
503
|
-
}), ae = j(!0), me = j(0), X = D(() => B.value.crop.kind !== "alpha" || ae.value), Oe = D(() => {
|
|
497
|
+
const ae = j(!0), me = j(0), X = K(() => B.value.crop.kind !== "alpha" || ae.value), Se = K(() => {
|
|
504
498
|
const e = d.value;
|
|
505
499
|
if (e.kind !== "loaded") return;
|
|
506
500
|
const r = e.masters.find((o) => o.background === e.desired.background);
|
|
507
501
|
return e.desired.background === "original" ? e.original : r?.asset ?? e.original;
|
|
508
|
-
}),
|
|
509
|
-
const e = d.value, r =
|
|
502
|
+
}), Ce = je(() => Se.value), Pe = K(() => {
|
|
503
|
+
const e = d.value, r = Se.value;
|
|
510
504
|
if (!(e.kind !== "loaded" || !r))
|
|
511
505
|
return {
|
|
512
|
-
source:
|
|
513
|
-
url:
|
|
506
|
+
source: Ce.value ? {
|
|
507
|
+
url: Ce.value,
|
|
514
508
|
versionId: JSON.stringify([r.assetId, r.assetVersionId, r.sha256])
|
|
515
509
|
} : void 0,
|
|
516
510
|
approximate: e.desired.background !== "original" && !e.masters.some((o) => o.background === e.desired.background)
|
|
517
511
|
};
|
|
518
512
|
});
|
|
519
|
-
function
|
|
513
|
+
function ea(e) {
|
|
520
514
|
be({
|
|
521
515
|
...B.value,
|
|
522
516
|
crop: e ? { kind: "alpha", padding: 0 } : { kind: "none" }
|
|
523
517
|
});
|
|
524
518
|
}
|
|
525
|
-
function
|
|
519
|
+
function aa(e) {
|
|
526
520
|
be({ ...B.value, crop: { kind: "alpha", padding: e } });
|
|
527
521
|
}
|
|
528
522
|
function be(e) {
|
|
529
|
-
if (t.disabled ||
|
|
530
|
-
|
|
523
|
+
if (t.disabled || k.value && (B.value.background !== "original" || S !== void 0) || e.crop.kind === "alpha" && (!Number.isInteger(e.crop.padding) || e.crop.padding < 0 || e.crop.padding > 1024) || ae.value && Ve(e, B.value)) return;
|
|
524
|
+
V.value = "", W.value = "";
|
|
531
525
|
const r = d.value;
|
|
532
|
-
|
|
526
|
+
D(
|
|
533
527
|
$(
|
|
534
528
|
v.value,
|
|
535
529
|
r.kind === "loaded" ? { ...r, desired: e, state: { kind: "idle" } } : { ...r, desired: e }
|
|
536
530
|
)
|
|
537
531
|
);
|
|
538
532
|
}
|
|
539
|
-
function
|
|
540
|
-
me.value++, ae.value = !0, F(),
|
|
533
|
+
function oa() {
|
|
534
|
+
me.value++, ae.value = !0, F(), V.value = "", W.value = "";
|
|
541
535
|
const e = d.value;
|
|
542
|
-
e.kind === "loaded" &&
|
|
536
|
+
e.kind === "loaded" && D(
|
|
543
537
|
$(v.value, {
|
|
544
538
|
...e,
|
|
545
539
|
desired: e.applied.settings,
|
|
@@ -547,13 +541,13 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
547
541
|
})
|
|
548
542
|
);
|
|
549
543
|
}
|
|
550
|
-
function
|
|
551
|
-
const r = e.target.value, o = ["original", "solid",
|
|
544
|
+
function ta(e) {
|
|
545
|
+
const r = e.target.value, o = ["original", "solid", ...Ge.map((m) => m.model)].find(
|
|
552
546
|
(m) => m === r
|
|
553
547
|
);
|
|
554
548
|
o && ee(o) && be({ ...B.value, background: o });
|
|
555
549
|
}
|
|
556
|
-
const se =
|
|
550
|
+
const se = K(() => t.modelValue.mode ?? "single");
|
|
557
551
|
J(
|
|
558
552
|
[
|
|
559
553
|
() => t.resetEpoch,
|
|
@@ -566,29 +560,29 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
566
560
|
me.value++, ae.value = !0;
|
|
567
561
|
}
|
|
568
562
|
);
|
|
569
|
-
const
|
|
563
|
+
const ra = [
|
|
570
564
|
{ key: "sizePercent", label: "Logo 大小", min: 1, max: 50, unit: "%" },
|
|
571
565
|
{ key: "marginPercent", label: "边距", min: 0, max: 20, unit: "%" },
|
|
572
566
|
{ key: "density", label: "疏密", min: 0, max: 100, unit: "" },
|
|
573
567
|
{ key: "angle", label: "角度", min: -90, max: 90, unit: "°" },
|
|
574
568
|
{ key: "opacity", label: "不透明度", min: 0, max: 100, unit: "%" }
|
|
575
|
-
], Ie =
|
|
576
|
-
() =>
|
|
569
|
+
], Ie = K(
|
|
570
|
+
() => ra.filter(
|
|
577
571
|
(e) => se.value === "tile" ? e.key !== "marginPercent" : e.key !== "density" && e.key !== "angle"
|
|
578
572
|
)
|
|
579
573
|
);
|
|
580
574
|
function Ee(e) {
|
|
581
575
|
return e === "opacity" ? Math.round(v.value.opacity * 100) : v.value[e] ?? (e === "density" ? 50 : -30);
|
|
582
576
|
}
|
|
583
|
-
const
|
|
577
|
+
const Oe = K(
|
|
584
578
|
() => Ie.value.every((e) => {
|
|
585
579
|
const r = M.value[e.key];
|
|
586
580
|
if (r === void 0) return !0;
|
|
587
581
|
const o = Number(r);
|
|
588
582
|
return r.trim() !== "" && Number.isInteger(o) && o >= e.min && o <= e.max;
|
|
589
583
|
})
|
|
590
|
-
),
|
|
591
|
-
() => ke(v.value).kind === "ready" && !
|
|
584
|
+
), na = K(
|
|
585
|
+
() => ke(v.value).kind === "ready" && !k.value && !V.value && Oe.value && X.value
|
|
592
586
|
);
|
|
593
587
|
J(
|
|
594
588
|
() => [
|
|
@@ -600,8 +594,8 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
600
594
|
],
|
|
601
595
|
(e, r) => {
|
|
602
596
|
const o = ["sizePercent", "marginPercent", "opacity", "density", "angle"], m = { ...M.value };
|
|
603
|
-
o.forEach((
|
|
604
|
-
e[
|
|
597
|
+
o.forEach((x, q) => {
|
|
598
|
+
e[q] !== r[q] && delete m[x];
|
|
605
599
|
}), M.value = m;
|
|
606
600
|
}
|
|
607
601
|
), J(
|
|
@@ -611,45 +605,45 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
611
605
|
}
|
|
612
606
|
), J(se, () => {
|
|
613
607
|
M.value = {};
|
|
614
|
-
}), J(
|
|
615
|
-
function
|
|
608
|
+
}), J(na, (e) => g("validity", e), { immediate: !0 });
|
|
609
|
+
function D(e) {
|
|
616
610
|
t.disabled || g("update:modelValue", { ...v.value, ...e });
|
|
617
611
|
}
|
|
618
|
-
function
|
|
619
|
-
t.disabled || (M.value = {}, g("update:modelValue",
|
|
612
|
+
function Re(e) {
|
|
613
|
+
t.disabled || (M.value = {}, g("update:modelValue", Ma(t.modelValue, e)));
|
|
620
614
|
}
|
|
621
|
-
function
|
|
615
|
+
function ia(e, r, o, m) {
|
|
622
616
|
if (t.disabled || e.defaultPrevented) return;
|
|
623
|
-
let
|
|
624
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown")
|
|
617
|
+
let x;
|
|
618
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") x = (r + 1) % o.length;
|
|
625
619
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
626
|
-
|
|
627
|
-
else if (e.key === "Home")
|
|
628
|
-
else if (e.key === "End")
|
|
620
|
+
x = (r + o.length - 1) % o.length;
|
|
621
|
+
else if (e.key === "Home") x = 0;
|
|
622
|
+
else if (e.key === "End") x = o.length - 1;
|
|
629
623
|
else return;
|
|
630
624
|
e.preventDefault(), e.stopPropagation();
|
|
631
|
-
const
|
|
632
|
-
m(o[
|
|
625
|
+
const q = e.currentTarget.parentElement;
|
|
626
|
+
m(o[x]), Me(() => q?.querySelectorAll("[role=radio]")[x]?.focus());
|
|
633
627
|
}
|
|
634
628
|
function F() {
|
|
635
|
-
clearTimeout(G), G = void 0,
|
|
629
|
+
clearTimeout(G), G = void 0, S = void 0, E++, b?.abort(), b = void 0, h?.dispose(), h = void 0, k.value = !1, f.value = "", Y.value = void 0;
|
|
636
630
|
}
|
|
637
631
|
J(
|
|
638
632
|
() => [t.disabled, t.scopeKey, t.resetEpoch],
|
|
639
633
|
() => {
|
|
640
|
-
F(),
|
|
634
|
+
F(), V.value = "", M.value = {};
|
|
641
635
|
},
|
|
642
636
|
{ flush: "sync" }
|
|
643
|
-
),
|
|
644
|
-
function
|
|
637
|
+
), Ke(F);
|
|
638
|
+
function Te(e) {
|
|
645
639
|
if (!e.width || !e.height || e.width * e.height > _e || e.bytes > ge || !["image/png", "image/jpeg", "image/webp"].includes(e.mime))
|
|
646
640
|
throw new Error("Logo 需为5MiB、400万像素以内的静态图片");
|
|
647
641
|
}
|
|
648
|
-
async function
|
|
642
|
+
async function sa(e, r) {
|
|
649
643
|
if (!l) throw Error("参考素材读取能力尚未配置");
|
|
650
|
-
return
|
|
644
|
+
return Te(e), xa(l, e, r);
|
|
651
645
|
}
|
|
652
|
-
const Q =
|
|
646
|
+
const Q = K(() => {
|
|
653
647
|
const e = d.value, r = e.kind === "loaded" ? e.original : void 0;
|
|
654
648
|
return JSON.stringify([
|
|
655
649
|
t.scopeKey,
|
|
@@ -667,16 +661,16 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
667
661
|
});
|
|
668
662
|
function pe() {
|
|
669
663
|
const e = d.value;
|
|
670
|
-
if (!U || t.disabled ||
|
|
664
|
+
if (!U || t.disabled || k.value || !X.value || e.kind !== "loaded" || !e.original || e.desired.background !== "original")
|
|
671
665
|
return;
|
|
672
666
|
const r = Q.value;
|
|
673
|
-
if (ke(v.value).kind === "ready" ||
|
|
667
|
+
if (ke(v.value).kind === "ready" || C === r) return;
|
|
674
668
|
if (e.state.kind === "failed") {
|
|
675
|
-
|
|
669
|
+
C = r;
|
|
676
670
|
return;
|
|
677
671
|
}
|
|
678
|
-
if (
|
|
679
|
-
|
|
672
|
+
if (C = r, V.value = "", W.value = "", e.desired.crop.kind === "none") {
|
|
673
|
+
D(
|
|
680
674
|
$(v.value, {
|
|
681
675
|
...e,
|
|
682
676
|
applied: { settings: fe(), asset: e.original },
|
|
@@ -697,7 +691,7 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
697
691
|
Q,
|
|
698
692
|
() => {
|
|
699
693
|
const e = d.value;
|
|
700
|
-
|
|
694
|
+
S?.generation === E && Ve(e.desired, S.expected.desired) && (e.kind === "empty" && S.expected.kind === "empty" || e.kind === "loaded" && S.expected.kind === "loaded" && e.original && S.expected.original && We(e.original, S.expected.original)) || (F(), C = void 0, V.value = "", W.value = "", pe());
|
|
701
695
|
},
|
|
702
696
|
{ flush: "sync" }
|
|
703
697
|
), J(
|
|
@@ -706,53 +700,53 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
706
700
|
d.value.kind === "loaded" && d.value.state.kind
|
|
707
701
|
],
|
|
708
702
|
([e, r], [o, m]) => {
|
|
709
|
-
e !== o || m !== "failed" || r !== "idle" || B.value.background !== "original" || (
|
|
703
|
+
e !== o || m !== "failed" || r !== "idle" || B.value.background !== "original" || (C = void 0, pe());
|
|
710
704
|
},
|
|
711
705
|
{ flush: "post" }
|
|
712
|
-
),
|
|
713
|
-
function
|
|
706
|
+
), ze(pe);
|
|
707
|
+
function la() {
|
|
714
708
|
const e = d.value;
|
|
715
|
-
e.kind !== "loaded" || e.desired.background !== "original" || (
|
|
709
|
+
e.kind !== "loaded" || e.desired.background !== "original" || (C = Q.value, Le({ ...e, desired: { background: "original", crop: { ...e.desired.crop } } }));
|
|
716
710
|
}
|
|
717
711
|
async function Le(e) {
|
|
718
712
|
const r = e ?? d.value;
|
|
719
|
-
if (!U || t.disabled ||
|
|
713
|
+
if (!U || t.disabled || k.value || !X.value || r.kind !== "loaded" || !ee(r.desired.background)) return;
|
|
720
714
|
F();
|
|
721
|
-
const o =
|
|
715
|
+
const o = E, m = t.scopeKey, x = Q.value;
|
|
722
716
|
b = new AbortController();
|
|
723
|
-
const
|
|
717
|
+
const q = b.signal, H = () => {
|
|
724
718
|
const O = d.value;
|
|
725
|
-
return U && o ===
|
|
719
|
+
return U && o === E && !t.disabled && !q.aborted && t.scopeKey === m && Q.value === x && X.value && O.kind === "loaded" && !!O.original && !!r.original && We(O.original, r.original) && Ve(O.desired, r.desired);
|
|
726
720
|
}, oe = d.value;
|
|
727
721
|
if (!(!H() || oe.kind !== "loaded")) {
|
|
728
|
-
|
|
722
|
+
V.value = "", W.value = "", k.value = !0, f.value = r.desired.background === "original" ? a("tools.brand_mark.trimLogo") : Qe.value ? "logo-cloud-progress" : "logo-local-progress", D($(v.value, { ...oe, state: { kind: "running" } })), h ??= Ka(l?.execution?.local?.cutout);
|
|
729
723
|
try {
|
|
730
|
-
const O = await
|
|
724
|
+
const O = await Ga(
|
|
731
725
|
{
|
|
732
726
|
document: r,
|
|
733
727
|
ownerBatchId: m ?? "",
|
|
734
|
-
signal:
|
|
728
|
+
signal: q,
|
|
735
729
|
onMaster: async (N) => {
|
|
736
730
|
const le = d.value;
|
|
737
|
-
!H() || le.kind !== "loaded" || (
|
|
731
|
+
!H() || le.kind !== "loaded" || (D(
|
|
738
732
|
$(v.value, {
|
|
739
733
|
...le,
|
|
740
734
|
masters: [
|
|
741
|
-
...le.masters.filter((
|
|
735
|
+
...le.masters.filter((pa) => pa.background !== N.background),
|
|
742
736
|
N
|
|
743
737
|
]
|
|
744
738
|
})
|
|
745
|
-
), await
|
|
739
|
+
), await Me());
|
|
746
740
|
},
|
|
747
741
|
onStage: (N) => {
|
|
748
|
-
H() && (
|
|
742
|
+
H() && (f.value = N === "cloud" ? "logo-cloud-progress" : N === "model" ? "logo-local-progress" : N === "derive" ? a("tools.brand_mark.trimLogo") : "正在保存去底 Logo…");
|
|
749
743
|
},
|
|
750
744
|
onProgress: (N) => {
|
|
751
745
|
H() && (Y.value = N);
|
|
752
746
|
}
|
|
753
747
|
},
|
|
754
748
|
{
|
|
755
|
-
read:
|
|
749
|
+
read: sa,
|
|
756
750
|
save: (N, le) => R(new File([N], le, { type: N.type })),
|
|
757
751
|
preparer: h,
|
|
758
752
|
submit: u.submitTask,
|
|
@@ -762,7 +756,7 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
762
756
|
}
|
|
763
757
|
), te = d.value;
|
|
764
758
|
if (!H() || te.kind !== "loaded") return;
|
|
765
|
-
|
|
759
|
+
D(
|
|
766
760
|
$(v.value, {
|
|
767
761
|
...te,
|
|
768
762
|
applied: O.applied,
|
|
@@ -775,36 +769,36 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
775
769
|
);
|
|
776
770
|
} catch (O) {
|
|
777
771
|
const te = d.value;
|
|
778
|
-
H() && te.kind === "loaded" && (
|
|
772
|
+
H() && te.kind === "loaded" && (V.value = O instanceof Error ? O.message : "Logo 准备失败", W.value = O instanceof Error && "reason" in O && typeof O.reason == "string" ? O.reason : "", D($(v.value, { ...te, state: { kind: "failed" } })));
|
|
779
773
|
} finally {
|
|
780
|
-
o ===
|
|
774
|
+
o === E && (k.value = !1, f.value = "", h?.dispose(), h = void 0), A();
|
|
781
775
|
}
|
|
782
776
|
}
|
|
783
777
|
}
|
|
784
|
-
async function
|
|
778
|
+
async function Ne(e) {
|
|
785
779
|
if (t.disabled || !e) return;
|
|
786
780
|
F();
|
|
787
|
-
const r =
|
|
788
|
-
|
|
789
|
-
const o = b.signal, m = d.value.desired,
|
|
790
|
-
|
|
781
|
+
const r = E;
|
|
782
|
+
C = void 0, V.value = "", k.value = !0, f.value = "正在准备 Logo…", b = new AbortController();
|
|
783
|
+
const o = b.signal, m = d.value.desired, x = t.scopeKey;
|
|
784
|
+
S = { generation: r, expected: { version: 2, kind: "empty", desired: m } }, D({
|
|
791
785
|
logo: void 0,
|
|
792
786
|
originalLogo: void 0,
|
|
793
787
|
logoPreparation: { version: 2, kind: "empty", desired: m },
|
|
794
788
|
preparedLogoVariants: void 0,
|
|
795
789
|
logoName: e.name,
|
|
796
|
-
ownerBatchId:
|
|
790
|
+
ownerBatchId: x
|
|
797
791
|
});
|
|
798
792
|
try {
|
|
799
793
|
if (!["image/png", "image/jpeg", "image/webp"].includes(e.type) || !e.size || e.size > ge)
|
|
800
794
|
throw new Error("请选择5MiB以内的PNG、JPEG或WebP Logo");
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
const H =
|
|
795
|
+
const q = new Uint8Array(await e.arrayBuffer());
|
|
796
|
+
Oa(q);
|
|
797
|
+
const H = Va(q);
|
|
804
798
|
if (H.width * H.height > _e) throw Error("Logo 超过400万像素");
|
|
805
|
-
if (r !==
|
|
799
|
+
if (r !== E || t.disabled) return;
|
|
806
800
|
const oe = await R(e);
|
|
807
|
-
if (r !==
|
|
801
|
+
if (r !== E || t.disabled || (Te(oe), t.scopeKey !== x)) return;
|
|
808
802
|
const O = {
|
|
809
803
|
version: 2,
|
|
810
804
|
kind: "loaded",
|
|
@@ -814,29 +808,29 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
814
808
|
masters: [],
|
|
815
809
|
state: { kind: "idle" }
|
|
816
810
|
};
|
|
817
|
-
|
|
811
|
+
S = { generation: r, expected: O }, D({
|
|
818
812
|
...$(v.value, O),
|
|
819
813
|
logoName: e.name,
|
|
820
|
-
ownerBatchId:
|
|
814
|
+
ownerBatchId: x
|
|
821
815
|
});
|
|
822
|
-
} catch (
|
|
823
|
-
r ===
|
|
816
|
+
} catch (q) {
|
|
817
|
+
r === E && !o.aborted && (V.value = q instanceof Error ? q.message : "Logo 准备失败", D({ logo: void 0 }));
|
|
824
818
|
} finally {
|
|
825
|
-
r ===
|
|
819
|
+
r === E && (k.value = !1, f.value = "", await Me(), r === E && (S = void 0, pe()));
|
|
826
820
|
}
|
|
827
821
|
}
|
|
828
|
-
function
|
|
822
|
+
function da(e) {
|
|
829
823
|
const r = e.target;
|
|
830
|
-
|
|
824
|
+
Ne(r.files?.[0]), r.value = "";
|
|
831
825
|
}
|
|
832
|
-
function
|
|
833
|
-
t.disabled ||
|
|
826
|
+
function ua(e) {
|
|
827
|
+
t.disabled || Ne(e.dataTransfer?.files[0]);
|
|
834
828
|
}
|
|
835
|
-
function
|
|
829
|
+
function ca() {
|
|
836
830
|
if (t.disabled) return;
|
|
837
|
-
F(),
|
|
831
|
+
F(), V.value = "", W.value = "";
|
|
838
832
|
const e = d.value;
|
|
839
|
-
e.kind === "loaded" && e.original &&
|
|
833
|
+
e.kind === "loaded" && e.original && D(
|
|
840
834
|
$(v.value, {
|
|
841
835
|
...e,
|
|
842
836
|
desired: fe(),
|
|
@@ -845,8 +839,8 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
845
839
|
})
|
|
846
840
|
);
|
|
847
841
|
}
|
|
848
|
-
function
|
|
849
|
-
t.disabled || (F(),
|
|
842
|
+
function ga() {
|
|
843
|
+
t.disabled || (F(), V.value = "", D({
|
|
850
844
|
logo: void 0,
|
|
851
845
|
originalLogo: void 0,
|
|
852
846
|
preparedLogoVariants: void 0,
|
|
@@ -855,12 +849,12 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
855
849
|
removeBackground: !1
|
|
856
850
|
}));
|
|
857
851
|
}
|
|
858
|
-
function
|
|
852
|
+
function De(e, r) {
|
|
859
853
|
if (t.disabled) return;
|
|
860
|
-
const o = r.target.value, m = Number(o),
|
|
861
|
-
|
|
854
|
+
const o = r.target.value, m = Number(o), x = Ie.value.find((q) => q.key === e);
|
|
855
|
+
x && (M.value = { ...M.value, [e]: o }, o.trim() !== "" && Number.isInteger(m) && m >= x.min && m <= x.max && D({ [e]: e === "opacity" ? m / 100 : m }));
|
|
862
856
|
}
|
|
863
|
-
function
|
|
857
|
+
function ma(e) {
|
|
864
858
|
[
|
|
865
859
|
"ArrowLeft",
|
|
866
860
|
"ArrowRight",
|
|
@@ -872,105 +866,105 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
872
866
|
"PageDown"
|
|
873
867
|
].includes(e.key) && e.stopPropagation();
|
|
874
868
|
}
|
|
875
|
-
function
|
|
869
|
+
function ba() {
|
|
876
870
|
if (t.disabled) return;
|
|
877
|
-
const e =
|
|
871
|
+
const e = k.value || G !== void 0;
|
|
878
872
|
F(), me.value++, ae.value = !0, M.value = {};
|
|
879
873
|
const r = d.value, o = e && r.kind === "loaded" ? $(v.value, {
|
|
880
874
|
...r,
|
|
881
875
|
desired: r.applied.settings,
|
|
882
876
|
state: { kind: "idle" }
|
|
883
877
|
}) : v.value;
|
|
884
|
-
|
|
878
|
+
V.value = "", W.value = "", g("update:modelValue", He(o));
|
|
885
879
|
}
|
|
886
|
-
return (e, r) => (
|
|
880
|
+
return (e, r) => (I(), L("fieldset", {
|
|
887
881
|
class: "brand-mark-panel",
|
|
888
882
|
disabled: i.disabled,
|
|
889
883
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_bfd3cc8f"),
|
|
890
|
-
onDragover: r[4] || (r[4] =
|
|
884
|
+
onDragover: r[4] || (r[4] = Ue(() => {
|
|
891
885
|
}, ["stop", "prevent"])),
|
|
892
|
-
onDrop:
|
|
886
|
+
onDrop: Ue(ua, ["stop", "prevent"])
|
|
893
887
|
}, [
|
|
894
888
|
P("div", {
|
|
895
889
|
class: "brand-mode",
|
|
896
890
|
role: "radiogroup",
|
|
897
891
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_b2722cb0")
|
|
898
892
|
}, [
|
|
899
|
-
(
|
|
893
|
+
(I(!0), L(de, null, ve([
|
|
900
894
|
["single", n(a)("tools.brand_mark.singleMark")],
|
|
901
895
|
["tile", n(a)("common.toolPanel_e415d1fe")]
|
|
902
|
-
].filter((o) => !i.allowedModes || i.allowedModes.includes(o[0])), (o, m) => (
|
|
896
|
+
].filter((o) => !i.allowedModes || i.allowedModes.includes(o[0])), (o, m) => (I(), L("button", {
|
|
903
897
|
key: o[0],
|
|
904
898
|
type: "button",
|
|
905
899
|
role: "radio",
|
|
906
900
|
"aria-label": o[1],
|
|
907
901
|
"aria-checked": se.value === o[0],
|
|
908
902
|
tabindex: se.value === o[0] ? 0 : -1,
|
|
909
|
-
onClick: (
|
|
910
|
-
onKeydown: (
|
|
911
|
-
|
|
903
|
+
onClick: (x) => Re(o[0]),
|
|
904
|
+
onKeydown: (x) => ia(
|
|
905
|
+
x,
|
|
912
906
|
m,
|
|
913
|
-
["single", "tile"].filter((
|
|
914
|
-
(
|
|
907
|
+
["single", "tile"].filter((q) => !i.allowedModes || i.allowedModes.includes(q)),
|
|
908
|
+
(q) => Re(q)
|
|
915
909
|
)
|
|
916
|
-
},
|
|
917
|
-
], 8,
|
|
910
|
+
}, w(o[1]), 41, Fa))), 128))
|
|
911
|
+
], 8, $a),
|
|
918
912
|
P("input", {
|
|
919
913
|
ref_key: "picker",
|
|
920
|
-
ref:
|
|
914
|
+
ref: y,
|
|
921
915
|
class: "logo-file-input",
|
|
922
916
|
hidden: "",
|
|
923
917
|
type: "file",
|
|
924
918
|
accept: "image/png,image/jpeg,image/webp",
|
|
925
919
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_78f4cf57"),
|
|
926
|
-
onChange:
|
|
927
|
-
}, null, 40,
|
|
920
|
+
onChange: da
|
|
921
|
+
}, null, 40, Ha),
|
|
928
922
|
P("button", {
|
|
929
923
|
class: "logo-upload",
|
|
930
924
|
type: "button",
|
|
931
925
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_b7603312"),
|
|
932
926
|
disabled: i.disabled,
|
|
933
|
-
onClick: r[0] || (r[0] = (o) =>
|
|
927
|
+
onClick: r[0] || (r[0] = (o) => y.value?.click())
|
|
934
928
|
}, [
|
|
935
|
-
n(p) ? (
|
|
929
|
+
n(p) ? (I(), L("img", {
|
|
936
930
|
key: 0,
|
|
937
931
|
src: n(p),
|
|
938
932
|
alt: n(a)("tools.brand_mark.brandMarkPanel_baacf60a"),
|
|
939
933
|
decoding: "async"
|
|
940
|
-
}, null, 8,
|
|
934
|
+
}, null, 8, Xa)) : (I(), he(n(_a), {
|
|
941
935
|
key: 1,
|
|
942
936
|
size: 24
|
|
943
937
|
})),
|
|
944
|
-
n(p) ? z("", !0) : (
|
|
945
|
-
P("small", null,
|
|
946
|
-
], 8,
|
|
947
|
-
i.modelValue.originalLogo ||
|
|
938
|
+
n(p) ? z("", !0) : (I(), L("strong", Ya, w(i.modelValue.logoName || n(a)("tools.brand_mark.brandMarkPanel_7dcf64ca")), 1)),
|
|
939
|
+
P("small", null, w(k.value ? f.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.cloudWaiting") : f.value === "logo-local-progress" ? n(a)("tools.brand_mark.localProgress") : n(c)(f.value) : n(a)("tools.brand_mark.brandMarkPanel_204bfba6")), 1)
|
|
940
|
+
], 8, Ja),
|
|
941
|
+
i.modelValue.originalLogo || k.value ? (I(), L("button", {
|
|
948
942
|
key: 0,
|
|
949
943
|
class: "logo-remove",
|
|
950
944
|
type: "button",
|
|
951
945
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_731cdce5"),
|
|
952
|
-
onClick:
|
|
946
|
+
onClick: ga
|
|
953
947
|
}, [
|
|
954
|
-
ce(n(
|
|
955
|
-
re(
|
|
956
|
-
], 8,
|
|
957
|
-
P("label",
|
|
958
|
-
re(
|
|
948
|
+
ce(n(Pa), { size: 14 }),
|
|
949
|
+
re(w(n(a)("tools.brand_mark.brandMarkPanel_731cdce5")), 1)
|
|
950
|
+
], 8, Qa)) : z("", !0),
|
|
951
|
+
P("label", Za, [
|
|
952
|
+
re(w(n(a)("tools.brand_mark.backgroundMode")) + " ", 1),
|
|
959
953
|
P("select", {
|
|
960
954
|
value: B.value.background,
|
|
961
|
-
disabled:
|
|
962
|
-
onChange:
|
|
955
|
+
disabled: k.value && (B.value.background !== "original" || n(S) !== void 0),
|
|
956
|
+
onChange: ta
|
|
963
957
|
}, [
|
|
964
|
-
P("option",
|
|
965
|
-
P("option",
|
|
966
|
-
(
|
|
958
|
+
P("option", ao, w(n(a)("tools.brand_mark.originalMode")), 1),
|
|
959
|
+
P("option", oo, w(n(a)("tools.brand_mark.solidRemoval")), 1),
|
|
960
|
+
(I(!0), L(de, null, ve(n(Ge), (o) => (I(), L("option", {
|
|
967
961
|
key: o.model,
|
|
968
962
|
value: o.model,
|
|
969
963
|
disabled: !ee(o.model)
|
|
970
|
-
},
|
|
971
|
-
], 40,
|
|
964
|
+
}, w(n(c)(o.label)) + w(ee(o.model) ? "" : n(a)("common.toolPanel_14a718cd")), 9, to))), 128))
|
|
965
|
+
], 40, eo)
|
|
972
966
|
]),
|
|
973
|
-
(
|
|
967
|
+
(I(), he(Ca, {
|
|
974
968
|
key: me.value,
|
|
975
969
|
enabled: B.value.crop.kind === "alpha",
|
|
976
970
|
padding: B.value.crop.kind === "alpha" ? B.value.crop.padding : 0,
|
|
@@ -978,87 +972,86 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
978
972
|
hint: n(a)("tools.brand_mark.trimHint"),
|
|
979
973
|
source: Pe.value?.source,
|
|
980
974
|
"estimate-applied": Pe.value?.approximate,
|
|
981
|
-
disabled: i.disabled ||
|
|
982
|
-
onEnabled:
|
|
983
|
-
onPadding:
|
|
975
|
+
disabled: i.disabled || k.value && (B.value.background !== "original" || n(S) !== void 0),
|
|
976
|
+
onEnabled: ea,
|
|
977
|
+
onPadding: aa,
|
|
984
978
|
onValidity: r[1] || (r[1] = (o) => ae.value = o)
|
|
985
979
|
}, null, 8, ["enabled", "padding", "hint", "source", "estimate-applied", "disabled"])),
|
|
986
|
-
B.value.crop.kind === "alpha" && Pe.value?.approximate ? (
|
|
987
|
-
n(ke)(v.value).kind === "pending" ? (
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
P("span", co, [
|
|
980
|
+
B.value.crop.kind === "alpha" && Pe.value?.approximate ? (I(), L("p", ro, w(n(a)("tools.brand_mark.approximateTrim")), 1)) : z("", !0),
|
|
981
|
+
n(ke)(v.value).kind === "pending" ? (I(), L("p", no, w(B.value.background !== "original" ? n(a)("tools.brand_mark.settingsPending") : d.value.kind === "loaded" && !d.value.original ? n(a)("tools.brand_mark.uploadOriginal") : d.value.kind === "loaded" && d.value.state.kind === "failed" ? n(a)("tools.brand_mark.preparationFailed") : n(a)("tools.brand_mark.previewPending")), 1)) : z("", !0),
|
|
982
|
+
k.value ? (I(), L("div", io, [
|
|
983
|
+
P("span", so, [
|
|
991
984
|
r[5] || (r[5] = P("span", {
|
|
992
985
|
class: "logo-activity",
|
|
993
986
|
"aria-hidden": "true"
|
|
994
987
|
}, null, -1)),
|
|
995
|
-
re(" " +
|
|
988
|
+
re(" " + w(f.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.cloudWaiting") : f.value === "logo-local-progress" ? n(a)("tools.brand_mark.localProgress") : n(c)(f.value)), 1)
|
|
996
989
|
]),
|
|
997
990
|
P("progress", {
|
|
998
991
|
value: Y.value,
|
|
999
992
|
max: "1"
|
|
1000
|
-
}, null, 8,
|
|
993
|
+
}, null, 8, lo),
|
|
1001
994
|
P("button", {
|
|
1002
995
|
type: "button",
|
|
1003
996
|
class: "logo-cancel",
|
|
1004
|
-
"aria-label":
|
|
1005
|
-
title:
|
|
1006
|
-
onClick:
|
|
997
|
+
"aria-label": f.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.stopWaiting") : n(a)("tools.brand_mark.cancelPreparation"),
|
|
998
|
+
title: f.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.stopWaiting") : n(a)("tools.brand_mark.cancelPreparation"),
|
|
999
|
+
onClick: oa
|
|
1007
1000
|
}, [
|
|
1008
|
-
ce(n(
|
|
1001
|
+
ce(n(Ia), {
|
|
1009
1002
|
size: 16,
|
|
1010
1003
|
"aria-hidden": "true"
|
|
1011
1004
|
})
|
|
1012
|
-
], 8,
|
|
1013
|
-
])) : B.value.background === "original" && d.value.kind === "loaded" && d.value.state.kind === "failed" && d.value.original ? (
|
|
1005
|
+
], 8, uo)
|
|
1006
|
+
])) : B.value.background === "original" && d.value.kind === "loaded" && d.value.state.kind === "failed" && d.value.original ? (I(), L("div", co, [
|
|
1014
1007
|
P("button", {
|
|
1015
1008
|
type: "button",
|
|
1016
1009
|
disabled: !X.value,
|
|
1017
|
-
onClick:
|
|
1018
|
-
},
|
|
1019
|
-
])) : B.value.background !== "original" && n(ke)(v.value).kind !== "ready" ? (
|
|
1010
|
+
onClick: la
|
|
1011
|
+
}, w(n(a)("tools.brand_mark.retryPreview")), 9, go)
|
|
1012
|
+
])) : B.value.background !== "original" && n(ke)(v.value).kind !== "ready" ? (I(), L("div", mo, [
|
|
1020
1013
|
P("button", {
|
|
1021
1014
|
type: "button",
|
|
1022
|
-
disabled: !X.value || !ee(B.value.background) || d.value.kind !== "loaded" || !d.value.original || !!
|
|
1015
|
+
disabled: !X.value || !ee(B.value.background) || d.value.kind !== "loaded" || !d.value.original || !!V.value && !["local-transient", "cloud-unknown"].includes(W.value),
|
|
1023
1016
|
onClick: r[2] || (r[2] = (o) => Le())
|
|
1024
|
-
},
|
|
1017
|
+
}, w(W.value === "local-transient" ? n(a)("tools.brand_mark.retryPreparation") : n(a)("tools.brand_mark.processLogo")), 9, bo)
|
|
1025
1018
|
])) : z("", !0),
|
|
1026
|
-
|
|
1027
|
-
P("p", null,
|
|
1019
|
+
V.value ? (I(), L("div", po, [
|
|
1020
|
+
P("p", null, w(n(c)(V.value)), 1),
|
|
1028
1021
|
P("button", {
|
|
1029
1022
|
type: "button",
|
|
1030
|
-
onClick:
|
|
1031
|
-
},
|
|
1032
|
-
ee("isnet_fp16") && ["inconsistent_corners", "noisy_background", "no_foreground"].includes(W.value) ? (
|
|
1023
|
+
onClick: ca
|
|
1024
|
+
}, w(n(a)("tools.brand_mark.brandMarkPanel_a3728699")), 1),
|
|
1025
|
+
ee("isnet_fp16") && ["inconsistent_corners", "noisy_background", "no_foreground"].includes(W.value) ? (I(), L("button", {
|
|
1033
1026
|
key: 0,
|
|
1034
1027
|
type: "button",
|
|
1035
1028
|
onClick: r[3] || (r[3] = (o) => be({ ...B.value, background: "isnet_fp16" }))
|
|
1036
|
-
},
|
|
1029
|
+
}, w(n(a)("tools.brand_mark.switchFast")), 1)) : z("", !0)
|
|
1037
1030
|
])) : z("", !0),
|
|
1038
|
-
se.value === "single" ? (
|
|
1039
|
-
P("span",
|
|
1031
|
+
se.value === "single" ? (I(), L(de, { key: 7 }, [
|
|
1032
|
+
P("span", vo, w(n(a)("tools.brand_mark.brandMarkPanel_1fb4d574")), 1),
|
|
1040
1033
|
P("div", {
|
|
1041
1034
|
class: "brand-anchors",
|
|
1042
1035
|
role: "group",
|
|
1043
1036
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_1c3852e5")
|
|
1044
1037
|
}, [
|
|
1045
|
-
(
|
|
1038
|
+
(I(), L(de, null, ve(T, ([o, m, x]) => P("button", {
|
|
1046
1039
|
key: o,
|
|
1047
1040
|
type: "button",
|
|
1048
1041
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_9c441f43", { p0: n(c)(m) }),
|
|
1049
1042
|
"aria-pressed": i.modelValue.anchor === o,
|
|
1050
|
-
onClick: (
|
|
1051
|
-
},
|
|
1052
|
-
], 8,
|
|
1043
|
+
onClick: (q) => D({ anchor: o })
|
|
1044
|
+
}, w(x), 9, fo)), 64))
|
|
1045
|
+
], 8, ko)
|
|
1053
1046
|
], 64)) : z("", !0),
|
|
1054
|
-
(
|
|
1047
|
+
(I(!0), L(de, null, ve(Ie.value, (o) => (I(), L("div", {
|
|
1055
1048
|
key: o.key,
|
|
1056
1049
|
class: "brand-field"
|
|
1057
1050
|
}, [
|
|
1058
1051
|
P("label", null, [
|
|
1059
1052
|
P("span", null, [
|
|
1060
|
-
re(
|
|
1061
|
-
["sizePercent", "marginPercent", "angle"].includes(o.key) ? (
|
|
1053
|
+
re(w(n(c)(o.label)), 1),
|
|
1054
|
+
["sizePercent", "marginPercent", "angle"].includes(o.key) ? (I(), he(Ea, {
|
|
1062
1055
|
key: 0,
|
|
1063
1056
|
text: o.key === "angle" ? n(a)("tools.brand_mark.brandMarkPanel_0d6bb2f4") : n(a)(
|
|
1064
1057
|
o.key === "marginPercent" ? "common.audit.marginHelp" : "common.audit.logoSizeHelp"
|
|
@@ -1076,9 +1069,9 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
1076
1069
|
max: o.max,
|
|
1077
1070
|
step: "1",
|
|
1078
1071
|
value: M.value[o.key] ?? Ee(o.key),
|
|
1079
|
-
onInput: (m) =>
|
|
1080
|
-
}, null, 40,
|
|
1081
|
-
re(
|
|
1072
|
+
onInput: (m) => De(o.key, m)
|
|
1073
|
+
}, null, 40, ho),
|
|
1074
|
+
re(w(o.unit), 1)
|
|
1082
1075
|
])
|
|
1083
1076
|
]),
|
|
1084
1077
|
P("input", {
|
|
@@ -1090,84 +1083,77 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
1090
1083
|
max: o.max,
|
|
1091
1084
|
step: "1",
|
|
1092
1085
|
value: Ee(o.key),
|
|
1093
|
-
onInput: (m) =>
|
|
1094
|
-
onKeydown:
|
|
1095
|
-
}, null, 40,
|
|
1096
|
-
o.key === "density" ? (
|
|
1097
|
-
P("span", null,
|
|
1098
|
-
P("span", null,
|
|
1099
|
-
P("span", null,
|
|
1086
|
+
onInput: (m) => De(o.key, m),
|
|
1087
|
+
onKeydown: ma
|
|
1088
|
+
}, null, 40, yo),
|
|
1089
|
+
o.key === "density" ? (I(), L("div", wo, [
|
|
1090
|
+
P("span", null, w(n(a)("tools.brand_mark.brandMarkPanel_7812011c")), 1),
|
|
1091
|
+
P("span", null, w(n(a)("tools.brand_mark.brandMarkPanel_6bea77ac")), 1),
|
|
1092
|
+
P("span", null, w(n(a)("tools.brand_mark.brandMarkPanel_0e3d8855")), 1)
|
|
1100
1093
|
])) : z("", !0)
|
|
1101
1094
|
]))), 128)),
|
|
1102
|
-
|
|
1103
|
-
i.hideReset ? z("", !0) : (
|
|
1104
|
-
key:
|
|
1095
|
+
Oe.value ? z("", !0) : (I(), L("p", _o, w(n(a)("tools.brand_mark.brandMarkPanel_b7a07d1e")), 1)),
|
|
1096
|
+
i.hideReset ? z("", !0) : (I(), L("button", {
|
|
1097
|
+
key: 9,
|
|
1105
1098
|
type: "button",
|
|
1106
1099
|
class: "brand-reset",
|
|
1107
1100
|
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_3086a0b9"),
|
|
1108
|
-
onClick:
|
|
1101
|
+
onClick: ba
|
|
1109
1102
|
}, [
|
|
1110
|
-
ce(n(
|
|
1111
|
-
re(
|
|
1112
|
-
], 8,
|
|
1113
|
-
], 40,
|
|
1103
|
+
ce(n(La), { size: 14 }),
|
|
1104
|
+
re(w(n(a)("tools.brand_mark.brandMarkPanel_7fe8ee7c")), 1)
|
|
1105
|
+
], 8, Po))
|
|
1106
|
+
], 40, Wa));
|
|
1114
1107
|
}
|
|
1115
|
-
}),
|
|
1108
|
+
}), Eo = /* @__PURE__ */ Aa(Io, [["__scopeId", "data-v-e5420143"]]), Lo = { class: "hint" }, Mo = {
|
|
1116
1109
|
key: 0,
|
|
1117
1110
|
class: "hint"
|
|
1118
|
-
},
|
|
1111
|
+
}, xo = {
|
|
1119
1112
|
key: 1,
|
|
1120
1113
|
class: "hint"
|
|
1121
|
-
},
|
|
1114
|
+
}, Oo = /* @__PURE__ */ $e({
|
|
1122
1115
|
__name: "BrandMarkToolPanel",
|
|
1123
1116
|
props: {
|
|
1124
1117
|
context: {}
|
|
1125
1118
|
},
|
|
1126
1119
|
setup(i) {
|
|
1127
|
-
const { ui: s } =
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
p1: c.value.brandMark.mode === "tile" ? s("common.toolPanel_e415d1fe") : s("common.toolPanel_aa9f217c"),
|
|
1131
|
-
p2: a.context.view.count
|
|
1132
|
-
})
|
|
1133
|
-
);
|
|
1134
|
-
function p() {
|
|
1135
|
-
g.value++, a.context.resetDraft({ brandMark: Xe(c.value.brandMark) });
|
|
1120
|
+
const { ui: s } = Fe(), a = i, c = Ra(() => a.context), t = j(!1), g = j(0), u = K(() => c.value.brandMark.opacity === 0);
|
|
1121
|
+
function l() {
|
|
1122
|
+
g.value++, a.context.resetDraft({ brandMark: He(c.value.brandMark) });
|
|
1136
1123
|
}
|
|
1137
|
-
const
|
|
1138
|
-
return (
|
|
1124
|
+
const p = Ta(() => a.context, "brandMark");
|
|
1125
|
+
return (R, y) => (I(), he(Ba, {
|
|
1139
1126
|
context: i.context,
|
|
1140
1127
|
layout: "contained",
|
|
1141
|
-
changed: n(
|
|
1142
|
-
onReset:
|
|
1128
|
+
changed: n(qa)(n(c).brandMark),
|
|
1129
|
+
onReset: l
|
|
1143
1130
|
}, {
|
|
1144
|
-
actions:
|
|
1145
|
-
ce(
|
|
1131
|
+
actions: xe(() => [
|
|
1132
|
+
ce(Na, {
|
|
1146
1133
|
context: i.context,
|
|
1147
|
-
available: n(
|
|
1148
|
-
ready: t.value && !!n(c).brandMark.logo && !u.value
|
|
1149
|
-
label: l.value
|
|
1134
|
+
available: n(Da)(i.context),
|
|
1135
|
+
ready: t.value && !!n(c).brandMark.logo && !u.value
|
|
1150
1136
|
}, {
|
|
1151
|
-
default:
|
|
1152
|
-
P("p",
|
|
1153
|
-
i.context.view.appliedCount ? (
|
|
1154
|
-
u.value ? (
|
|
1137
|
+
default: xe(() => [
|
|
1138
|
+
P("p", Lo, w(n(s)("common.audit.saveVersion")), 1),
|
|
1139
|
+
i.context.view.appliedCount ? (I(), L("p", Mo, w(n(s)("common.toolPanel_1c5c7944", { p0: i.context.view.appliedCount })), 1)) : z("", !0),
|
|
1140
|
+
u.value ? (I(), L("p", xo, w(n(s)("common.toolPanel_6cc00dda")), 1)) : z("", !0)
|
|
1155
1141
|
]),
|
|
1156
1142
|
_: 1
|
|
1157
|
-
}, 8, ["context", "available", "ready"
|
|
1143
|
+
}, 8, ["context", "available", "ready"])
|
|
1158
1144
|
]),
|
|
1159
|
-
default:
|
|
1160
|
-
ce(
|
|
1145
|
+
default: xe(() => [
|
|
1146
|
+
ce(Eo, {
|
|
1161
1147
|
"model-value": n(c).brandMark,
|
|
1162
1148
|
"hide-reset": !0,
|
|
1163
|
-
"allowed-modes": ["single", "tile"].filter((
|
|
1149
|
+
"allowed-modes": ["single", "tile"].filter((k) => i.context.modeAllowed?.(k) !== !1),
|
|
1164
1150
|
disabled: i.context.readonly,
|
|
1165
1151
|
"scope-key": i.context.view.batchId,
|
|
1166
1152
|
"reset-epoch": g.value,
|
|
1167
1153
|
"available-cutout-modes": i.context.view.availableCutoutModes,
|
|
1168
1154
|
"upload-reference": i.context.uploadReference,
|
|
1169
|
-
"onUpdate:modelValue": n(
|
|
1170
|
-
onValidity:
|
|
1155
|
+
"onUpdate:modelValue": n(p),
|
|
1156
|
+
onValidity: y[0] || (y[0] = (k) => t.value = k)
|
|
1171
1157
|
}, null, 8, ["model-value", "allowed-modes", "disabled", "scope-key", "reset-epoch", "available-cutout-modes", "upload-reference", "onUpdate:modelValue"])
|
|
1172
1158
|
]),
|
|
1173
1159
|
_: 1
|
|
@@ -1175,5 +1161,5 @@ const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label",
|
|
|
1175
1161
|
}
|
|
1176
1162
|
});
|
|
1177
1163
|
export {
|
|
1178
|
-
|
|
1164
|
+
Oo as default
|
|
1179
1165
|
};
|