light-chain-open-ui 1.0.5 → 1.0.6
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/dist/{button-BnE0JWRX.js → button-KoRq6mAW.js} +62 -41
- package/dist/{button-DGQ4b8f2.cjs → button-hUFCfzUP.cjs} +8 -4
- package/dist/{client-Dt9_oZey.cjs → client-CJ8X0sFi.cjs} +1 -1
- package/dist/{client-C5AgfBeT.js → client-jorIw6pH.js} +1 -1
- package/dist/constants-Bdlwi9VJ.cjs +1 -0
- package/dist/{constants-DmzJOR2G.js → constants-CdudjmSn.js} +1 -0
- package/dist/contants.cjs +1 -1
- package/dist/contants.mjs +3 -3
- package/dist/core-D0DpSeAr.cjs +1 -0
- package/dist/core-rH2gpxTB.js +1 -0
- package/dist/lightchain-ui.cjs +1 -1
- package/dist/lightchain-ui.mjs +4 -4
- package/dist/options.cjs +1 -1
- package/dist/options.mjs +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +124 -52
- package/dist/types/components/task-workflow/task-workflow.d.ts +3 -0
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/react/index.d.ts +24 -9
- package/package.json +2 -17
- package/dist/constants-BTXokn3H.cjs +0 -1
- package/dist/core-C5cKUOSx.js +0 -1
- package/dist/core-DkseUrte.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as e, t } from "./client-
|
|
2
|
-
import { N as n, P as r, o as i } from "./constants-
|
|
1
|
+
import { l as e, t } from "./client-jorIw6pH.js";
|
|
2
|
+
import { N as n, P as r, o as i } from "./constants-CdudjmSn.js";
|
|
3
3
|
import { LitElement as a, css as o, html as s, nothing as c } from "lit";
|
|
4
4
|
//#region src/styles/register-theme.ts
|
|
5
5
|
var l = "light-chain-open-ui-theme", u = "\n:root {\n --lc-color-blue-50: #eff6ff;\n --lc-color-blue-100: #dbeafe;\n --lc-color-blue-500: #3b82f6;\n --lc-color-blue-600: #2563eb;\n --lc-color-blue-700: #1d4ed8;\n --lc-color-gray-50: #f9fafb;\n --lc-color-gray-100: #f3f4f6;\n --lc-color-gray-200: #e5e7eb;\n --lc-color-gray-300: #d1d5db;\n --lc-color-gray-500: #6b7280;\n --lc-color-gray-700: #374151;\n --lc-color-gray-900: #111827;\n --lc-color-success: #10b981;\n --lc-color-warning: #f59e0b;\n --lc-color-error: #ef4444;\n --lc-spacing-1: 4px;\n --lc-spacing-2: 8px;\n --lc-spacing-3: 12px;\n --lc-spacing-4: 16px;\n --lc-spacing-5: 20px;\n --lc-spacing-6: 24px;\n --lc-font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --lc-font-size-xs: 12px;\n --lc-font-size-sm: 14px;\n --lc-font-size-base: 16px;\n --lc-font-size-lg: 18px;\n --lc-font-size-xl: 20px;\n --lc-line-height: 1.5;\n --lc-radius-sm: 4px;\n --lc-radius-md: 8px;\n --lc-radius-lg: 12px;\n --lc-radius-full: 9999px;\n --lc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --lc-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);\n --lc-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);\n --lc-transition-fast: 150ms ease;\n --lc-transition-normal: 200ms ease;\n --lc-color-primary: var(--lc-color-blue-600);\n --lc-color-primary-hover: var(--lc-color-blue-700);\n --lc-color-primary-light: var(--lc-color-blue-50);\n --lc-color-bg: #ffffff;\n --lc-color-bg-secondary: var(--lc-color-gray-50);\n --lc-color-border: var(--lc-color-gray-200);\n --lc-color-text: var(--lc-color-gray-900);\n --lc-color-text-secondary: var(--lc-color-gray-500);\n --lc-color-text-placeholder: var(--lc-color-gray-300);\n --lc-radius-component: var(--lc-radius-md);\n --lc-spacing-component: var(--lc-spacing-4);\n}\n";
|
|
@@ -9,42 +9,42 @@ function d() {
|
|
|
9
9
|
e.id = l, e.textContent = u, document.head.append(e);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region node_modules/@lit/reactive-element/decorators/custom-element.js
|
|
12
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/custom-element.js
|
|
13
13
|
var f = (e) => (t, n) => {
|
|
14
14
|
n === void 0 ? customElements.define(e, t) : n.addInitializer(() => {
|
|
15
15
|
customElements.define(e, t);
|
|
16
16
|
});
|
|
17
|
-
}, p = globalThis,
|
|
17
|
+
}, p = globalThis, m = p.ShadowRoot && (p.ShadyCSS === void 0 || p.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ee = Symbol(), te = /* @__PURE__ */ new WeakMap(), ne = class {
|
|
18
18
|
constructor(e, t, n) {
|
|
19
|
-
if (this._$cssResult$ = !0, n !==
|
|
19
|
+
if (this._$cssResult$ = !0, n !== ee) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
20
20
|
this.cssText = e, this.t = t;
|
|
21
21
|
}
|
|
22
22
|
get styleSheet() {
|
|
23
23
|
let e = this.o, t = this.t;
|
|
24
|
-
if (
|
|
24
|
+
if (m && e === void 0) {
|
|
25
25
|
let n = t !== void 0 && t.length === 1;
|
|
26
|
-
n && (e =
|
|
26
|
+
n && (e = te.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && te.set(t, e));
|
|
27
27
|
}
|
|
28
28
|
return e;
|
|
29
29
|
}
|
|
30
30
|
toString() {
|
|
31
31
|
return this.cssText;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
33
|
+
}, re = (e) => new ne(typeof e == "string" ? e : e + "", void 0, ee), ie = (e, t) => {
|
|
34
|
+
if (m) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
35
35
|
else for (let n of t) {
|
|
36
36
|
let t = document.createElement("style"), r = p.litNonce;
|
|
37
37
|
r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t);
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, ae = m ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
40
40
|
let t = "";
|
|
41
41
|
for (let n of e.cssRules) t += n.cssText;
|
|
42
|
-
return
|
|
43
|
-
})(e) : e, { is:
|
|
42
|
+
return re(t);
|
|
43
|
+
})(e) : e, { is: oe, defineProperty: se, getOwnPropertyDescriptor: ce, getOwnPropertyNames: le, getOwnPropertySymbols: ue, getPrototypeOf: de } = Object, h = globalThis, fe = h.trustedTypes, pe = fe ? fe.emptyScript : "", me = h.reactiveElementPolyfillSupport, g = (e, t) => e, _ = {
|
|
44
44
|
toAttribute(e, t) {
|
|
45
45
|
switch (t) {
|
|
46
46
|
case Boolean:
|
|
47
|
-
e = e ?
|
|
47
|
+
e = e ? pe : null;
|
|
48
48
|
break;
|
|
49
49
|
case Object:
|
|
50
50
|
case Array: e = e == null ? e : JSON.stringify(e);
|
|
@@ -69,15 +69,15 @@ var f = (e) => (t, n) => {
|
|
|
69
69
|
}
|
|
70
70
|
return n;
|
|
71
71
|
}
|
|
72
|
-
},
|
|
72
|
+
}, he = (e, t) => !oe(e, t), ge = {
|
|
73
73
|
attribute: !0,
|
|
74
74
|
type: String,
|
|
75
|
-
converter:
|
|
75
|
+
converter: _,
|
|
76
76
|
reflect: !1,
|
|
77
77
|
useDefault: !1,
|
|
78
|
-
hasChanged:
|
|
78
|
+
hasChanged: he
|
|
79
79
|
};
|
|
80
|
-
Symbol.metadata ??= Symbol("metadata"),
|
|
80
|
+
Symbol.metadata ??= Symbol("metadata"), h.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
81
81
|
var v = class extends HTMLElement {
|
|
82
82
|
static addInitializer(e) {
|
|
83
83
|
this._$Ei(), (this.l ??= []).push(e);
|
|
@@ -88,11 +88,11 @@ var v = class extends HTMLElement {
|
|
|
88
88
|
static createProperty(e, t = ge) {
|
|
89
89
|
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
90
90
|
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
91
|
-
r !== void 0 &&
|
|
91
|
+
r !== void 0 && se(this.prototype, e, r);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
static getPropertyDescriptor(e, t, n) {
|
|
95
|
-
let { get: r, set: i } =
|
|
95
|
+
let { get: r, set: i } = ce(this.prototype, e) ?? {
|
|
96
96
|
get() {
|
|
97
97
|
return this[t];
|
|
98
98
|
},
|
|
@@ -114,14 +114,14 @@ var v = class extends HTMLElement {
|
|
|
114
114
|
return this.elementProperties.get(e) ?? ge;
|
|
115
115
|
}
|
|
116
116
|
static _$Ei() {
|
|
117
|
-
if (this.hasOwnProperty(
|
|
118
|
-
let e =
|
|
117
|
+
if (this.hasOwnProperty(g("elementProperties"))) return;
|
|
118
|
+
let e = de(this);
|
|
119
119
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
120
120
|
}
|
|
121
121
|
static finalize() {
|
|
122
|
-
if (this.hasOwnProperty(
|
|
123
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
124
|
-
let e = this.properties, t = [...
|
|
122
|
+
if (this.hasOwnProperty(g("finalized"))) return;
|
|
123
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(g("properties"))) {
|
|
124
|
+
let e = this.properties, t = [...le(e), ...ue(e)];
|
|
125
125
|
for (let n of t) this.createProperty(n, e[n]);
|
|
126
126
|
}
|
|
127
127
|
let e = this[Symbol.metadata];
|
|
@@ -140,8 +140,8 @@ var v = class extends HTMLElement {
|
|
|
140
140
|
let t = [];
|
|
141
141
|
if (Array.isArray(e)) {
|
|
142
142
|
let n = new Set(e.flat(Infinity).reverse());
|
|
143
|
-
for (let e of n) t.unshift(
|
|
144
|
-
} else e !== void 0 && t.push(
|
|
143
|
+
for (let e of n) t.unshift(ae(e));
|
|
144
|
+
} else e !== void 0 && t.push(ae(e));
|
|
145
145
|
return t;
|
|
146
146
|
}
|
|
147
147
|
static _$Eu(e, t) {
|
|
@@ -167,7 +167,7 @@ var v = class extends HTMLElement {
|
|
|
167
167
|
}
|
|
168
168
|
createRenderRoot() {
|
|
169
169
|
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
170
|
-
return
|
|
170
|
+
return ie(e, this.constructor.elementStyles), e;
|
|
171
171
|
}
|
|
172
172
|
connectedCallback() {
|
|
173
173
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
@@ -182,14 +182,14 @@ var v = class extends HTMLElement {
|
|
|
182
182
|
_$ET(e, t) {
|
|
183
183
|
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
|
|
184
184
|
if (r !== void 0 && !0 === n.reflect) {
|
|
185
|
-
let i = (n.converter?.toAttribute === void 0 ?
|
|
185
|
+
let i = (n.converter?.toAttribute === void 0 ? _ : n.converter).toAttribute(t, n.type);
|
|
186
186
|
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
_$AK(e, t) {
|
|
190
190
|
let n = this.constructor, r = n._$Eh.get(e);
|
|
191
191
|
if (r !== void 0 && this._$Em !== r) {
|
|
192
|
-
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ?
|
|
192
|
+
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? _ : e.converter;
|
|
193
193
|
this._$Em = r;
|
|
194
194
|
let a = i.fromAttribute(t, e.type);
|
|
195
195
|
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
@@ -198,7 +198,7 @@ var v = class extends HTMLElement {
|
|
|
198
198
|
requestUpdate(e, t, n, r = !1, i) {
|
|
199
199
|
if (e !== void 0) {
|
|
200
200
|
let a = this.constructor;
|
|
201
|
-
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ??
|
|
201
|
+
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? he)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
|
|
202
202
|
this.C(e, t, n);
|
|
203
203
|
}
|
|
204
204
|
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
@@ -262,15 +262,15 @@ var v = class extends HTMLElement {
|
|
|
262
262
|
updated(e) {}
|
|
263
263
|
firstUpdated(e) {}
|
|
264
264
|
};
|
|
265
|
-
v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[
|
|
265
|
+
v.elementStyles = [], v.shadowRootOptions = { mode: "open" }, v[g("elementProperties")] = /* @__PURE__ */ new Map(), v[g("finalized")] = /* @__PURE__ */ new Map(), me?.({ ReactiveElement: v }), (h.reactiveElementVersions ??= []).push("2.1.2");
|
|
266
266
|
//#endregion
|
|
267
|
-
//#region node_modules/@lit/reactive-element/decorators/property.js
|
|
267
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/property.js
|
|
268
268
|
var _e = {
|
|
269
269
|
attribute: !0,
|
|
270
270
|
type: String,
|
|
271
|
-
converter:
|
|
271
|
+
converter: _,
|
|
272
272
|
reflect: !1,
|
|
273
|
-
hasChanged:
|
|
273
|
+
hasChanged: he
|
|
274
274
|
}, ve = (e = _e, t, n) => {
|
|
275
275
|
let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
|
|
276
276
|
if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
|
|
@@ -301,7 +301,7 @@ function y(e) {
|
|
|
301
301
|
})(e, t, n);
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
|
-
//#region node_modules/@lit/reactive-element/decorators/state.js
|
|
304
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/state.js
|
|
305
305
|
function b(e) {
|
|
306
306
|
return y({
|
|
307
307
|
...e,
|
|
@@ -310,10 +310,10 @@ function b(e) {
|
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
|
-
//#region node_modules/@lit/reactive-element/decorators/base.js
|
|
313
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/base.js
|
|
314
314
|
var ye = (e, t, n) => (n.configurable = !0, n.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(e, t, n), n);
|
|
315
315
|
//#endregion
|
|
316
|
-
//#region node_modules/@lit/reactive-element/decorators/query.js
|
|
316
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/query.js
|
|
317
317
|
function be(e, t) {
|
|
318
318
|
return (n, r, i) => {
|
|
319
319
|
let a = (t) => t.renderRoot?.querySelector(e) ?? null;
|
|
@@ -1476,7 +1476,7 @@ var T = class extends a {
|
|
|
1476
1476
|
};
|
|
1477
1477
|
x([y({ type: String })], T.prototype, "value", void 0), x([y({ type: String })], T.prototype, "name", void 0), x([y({ type: String })], T.prototype, "label", void 0), x([y({ type: String })], T.prototype, "placeholder", void 0), x([y({ type: Number })], T.prototype, "maxLength", void 0), x([y({ type: Boolean })], T.prototype, "required", void 0), x([y({ type: Boolean })], T.prototype, "disabled", void 0), T = x([f("lc-prompt-input")], T);
|
|
1478
1478
|
//#endregion
|
|
1479
|
-
//#region node_modules/lit-html/lit-html.js
|
|
1479
|
+
//#region ../../node_modules/lit-html/lit-html.js
|
|
1480
1480
|
var E = globalThis, xe = (e) => e, D = E.trustedTypes, Se = D ? D.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, O = "$lit$", k = `lit$${Math.random().toFixed(9).slice(2)}$`, A = "?" + k, Ce = `<${A}>`, j = document, M = () => j.createComment(""), N = (e) => e === null || typeof e != "object" && typeof e != "function", P = Array.isArray, we = (e) => P(e) || typeof e?.[Symbol.iterator] == "function", F = "[ \n\f\r]", I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Te = /-->/g, Ee = />/g, L = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), De = /'/g, Oe = /"/g, ke = /^(?:script|style|textarea|title)$/i, R = Symbol.for("lit-noChange"), z = Symbol.for("lit-nothing"), Ae = /* @__PURE__ */ new WeakMap(), B = j.createTreeWalker(j, 129);
|
|
1481
1481
|
function je(e, t) {
|
|
1482
1482
|
if (!P(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
@@ -1709,7 +1709,7 @@ var Pe = class {
|
|
|
1709
1709
|
}, Ve = E.litHtmlPolyfillSupport;
|
|
1710
1710
|
Ve?.(Ne, Fe), (E.litHtmlVersions ??= []).push("3.3.3");
|
|
1711
1711
|
//#endregion
|
|
1712
|
-
//#region node_modules/lit-html/directive-helpers.js
|
|
1712
|
+
//#region ../../node_modules/lit-html/directive-helpers.js
|
|
1713
1713
|
var { I: He } = Be, Ue = (e) => e.strings === void 0, We = {
|
|
1714
1714
|
ATTRIBUTE: 1,
|
|
1715
1715
|
CHILD: 2,
|
|
@@ -2370,6 +2370,12 @@ var X = r, Z = i, Q = class extends a {
|
|
|
2370
2370
|
constructor(...e) {
|
|
2371
2371
|
super(...e), this.type = "", this.submitEndpoint = "", this.pollEndpoint = n.POLL_ENDPOINT, this.pollInterval = n.POLL_INTERVAL, this.maxPollAttempts = n.MAX_POLL_ATTEMPTS, this.phase = X.IDLE, this.taskId = "", this.progress = 0, this.result = null, this.error = "", this._defaultClient = new t();
|
|
2372
2372
|
}
|
|
2373
|
+
connectedCallback() {
|
|
2374
|
+
super.connectedCallback(), this.addEventListener(Z.REQUEST_SUBMIT, this._handleRequestSubmit);
|
|
2375
|
+
}
|
|
2376
|
+
disconnectedCallback() {
|
|
2377
|
+
this.removeEventListener(Z.REQUEST_SUBMIT, this._handleRequestSubmit), super.disconnectedCallback();
|
|
2378
|
+
}
|
|
2373
2379
|
get typeDef() {
|
|
2374
2380
|
return this._syncClientConfig(), this._activeClient.typeDef;
|
|
2375
2381
|
}
|
|
@@ -2385,6 +2391,9 @@ var X = r, Z = i, Q = class extends a {
|
|
|
2385
2391
|
async _handleFormSubmit(e) {
|
|
2386
2392
|
e.preventDefault(), await this.submit(this.collectFormData());
|
|
2387
2393
|
}
|
|
2394
|
+
_handleRequestSubmit(e) {
|
|
2395
|
+
e.preventDefault(), this.submit(this.collectFormData());
|
|
2396
|
+
}
|
|
2388
2397
|
_handleClick(e) {
|
|
2389
2398
|
e.composedPath().find((e) => e instanceof HTMLElement ? (e.type || e.getAttribute("type")) === "submit" : !1) && (e.preventDefault(), this.submit(this.collectFormData()));
|
|
2390
2399
|
}
|
|
@@ -2459,7 +2468,11 @@ var X = r, Z = i, Q = class extends a {
|
|
|
2459
2468
|
}
|
|
2460
2469
|
render() {
|
|
2461
2470
|
return s`
|
|
2462
|
-
<form
|
|
2471
|
+
<form
|
|
2472
|
+
@submit=${this._handleFormSubmit}
|
|
2473
|
+
@click=${this._handleClick}
|
|
2474
|
+
@change=${this._handleChildChange}
|
|
2475
|
+
>
|
|
2463
2476
|
<slot></slot>
|
|
2464
2477
|
</form>
|
|
2465
2478
|
`;
|
|
@@ -2554,7 +2567,15 @@ var $ = class extends a {
|
|
|
2554
2567
|
e.preventDefault(), e.stopPropagation();
|
|
2555
2568
|
return;
|
|
2556
2569
|
}
|
|
2557
|
-
this.type
|
|
2570
|
+
if (this.type === "submit") {
|
|
2571
|
+
e.preventDefault(), e.stopPropagation(), this.dispatchEvent(new CustomEvent(i.REQUEST_SUBMIT, {
|
|
2572
|
+
bubbles: !0,
|
|
2573
|
+
composed: !0,
|
|
2574
|
+
cancelable: !0
|
|
2575
|
+
}));
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
this.dispatchEvent(new MouseEvent("click", {
|
|
2558
2579
|
bubbles: !0,
|
|
2559
2580
|
composed: !0,
|
|
2560
2581
|
cancelable: !0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./client-
|
|
1
|
+
const e=require(`./client-CJ8X0sFi.cjs`),t=require(`./constants-Bdlwi9VJ.cjs`);require(`./react.cjs`);let n=require(`lit`);var r=`light-chain-open-ui-theme`,i=`
|
|
2
2
|
:root {
|
|
3
3
|
--lc-color-blue-50: #eff6ff;
|
|
4
4
|
--lc-color-blue-100: #dbeafe;
|
|
@@ -1098,8 +1098,12 @@ const e=require(`./client-Dt9_oZey.cjs`),t=require(`./constants-BTXokn3H.cjs`);r
|
|
|
1098
1098
|
<span class="label label-before">${this.beforeLabel}</span>
|
|
1099
1099
|
<span class="label label-after">${this.afterLabel}</span>
|
|
1100
1100
|
</div>
|
|
1101
|
-
`}};y([_({type:String})],Y.prototype,`beforeSrc`,void 0),y([_({type:String})],Y.prototype,`afterSrc`,void 0),y([_({type:String})],Y.prototype,`beforeLabel`,void 0),y([_({type:String})],Y.prototype,`afterLabel`,void 0),y([v()],Y.prototype,`_position`,void 0),Y=y([o(`lc-image-compare-slider`)],Y);var X=t.P,Z=t.o,Q=class extends n.LitElement{constructor(...n){super(...n),this.type=``,this.submitEndpoint=``,this.pollEndpoint=t.N.POLL_ENDPOINT,this.pollInterval=t.N.POLL_INTERVAL,this.maxPollAttempts=t.N.MAX_POLL_ATTEMPTS,this.phase=X.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this._defaultClient=new e.t}get typeDef(){return this._syncClientConfig(),this._activeClient.typeDef}get taskFields(){return this.typeDef?.fields??[]}async submit(e){this.phase===X.SUBMITTING||this.phase===X.POLLING||(this._syncClientConfig(),this.phase=X.SUBMITTING,this.error=``,this.progress=0,this.result=null,await this._activeClient.submit(this.type||this._activeClient.type,e),this._syncStateFromClient())}reset(){this._activeClient.reset(),this._syncStateFromClient()}async _handleFormSubmit(e){e.preventDefault(),await this.submit(this.collectFormData())}_handleClick(e){e.composedPath().find(e=>e instanceof HTMLElement?(e.type||e.getAttribute(`type`))===`submit`:!1)&&(e.preventDefault(),this.submit(this.collectFormData()))}_handleChildChange(e){let t=e.target;if(!(t instanceof HTMLElement))return;let n=Ze(t);if(!n)return;let r=et(e)??Qe(t);r!==void 0&&(t.value=r,this._syncMaskSources(n,r))}_syncMaskSources(e,t){this.taskFields.find(t=>t.name===e)?.type===`image`&&(typeof t!=`string`||!t||this.querySelectorAll(`lc-mask-editor`).forEach(e=>{let n=e;n.source||=t}))}collectFormData(){let e={},t=this.querySelectorAll(`*`),n=new Map(this.taskFields.map(e=>[e.name,e]));return t.forEach(t=>{let r=Ze(t);if(!r)return;let i=$e(t);n.get(r)?.type===`images`&&typeof i==`string`&&i&&(i=[i]),n.get(r)?.type===`multiEnum`&&typeof i==`string`&&i&&(i=tt(i)),i!==void 0&&(e[r]=i)}),e}get _activeClient(){return this.client??this._defaultClient}_syncClientConfig(){let e={customRequest:this.customRequest,customUploadRequest:this.customUploadRequest,onSubmit:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.SUBMIT,{detail:e,bubbles:!0,composed:!0}))},onPoll:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.POLL,{detail:e,bubbles:!0,composed:!0}))},onSuccess:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.SUCCESS,{detail:e,bubbles:!0,composed:!0}))},onError:e=>this._fail(e.message,e.phase)};this.client?(this.type&&(e.type=this.type),this.submitEndpoint&&(e.submitEndpoint=this.submitEndpoint),this.pollEndpoint!==t.N.POLL_ENDPOINT&&(e.pollEndpoint=this.pollEndpoint),this.pollInterval!==t.N.POLL_INTERVAL&&(e.pollInterval=this.pollInterval),this.maxPollAttempts!==t.N.MAX_POLL_ATTEMPTS&&(e.maxPollAttempts=this.maxPollAttempts)):(e.type=this.type,this.submitEndpoint&&(e.submitEndpoint=this.submitEndpoint),e.pollEndpoint=this.pollEndpoint,e.pollInterval=this.pollInterval,e.maxPollAttempts=this.maxPollAttempts),this._activeClient.configure(e)}_syncStateFromClient(){let e=this._activeClient;this.phase=e.phase,this.taskId=e.taskId,this.progress=e.progress,this.result=e.result,this.error=e.error}_fail(e,t){this.phase=X.ERROR,this.error=e,this.dispatchEvent(new CustomEvent(Z.ERROR,{detail:{message:e,phase:t},bubbles:!0,composed:!0}))}render(){return n.html`
|
|
1102
|
-
<form
|
|
1101
|
+
`}};y([_({type:String})],Y.prototype,`beforeSrc`,void 0),y([_({type:String})],Y.prototype,`afterSrc`,void 0),y([_({type:String})],Y.prototype,`beforeLabel`,void 0),y([_({type:String})],Y.prototype,`afterLabel`,void 0),y([v()],Y.prototype,`_position`,void 0),Y=y([o(`lc-image-compare-slider`)],Y);var X=t.P,Z=t.o,Q=class extends n.LitElement{constructor(...n){super(...n),this.type=``,this.submitEndpoint=``,this.pollEndpoint=t.N.POLL_ENDPOINT,this.pollInterval=t.N.POLL_INTERVAL,this.maxPollAttempts=t.N.MAX_POLL_ATTEMPTS,this.phase=X.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this._defaultClient=new e.t}connectedCallback(){super.connectedCallback(),this.addEventListener(Z.REQUEST_SUBMIT,this._handleRequestSubmit)}disconnectedCallback(){this.removeEventListener(Z.REQUEST_SUBMIT,this._handleRequestSubmit),super.disconnectedCallback()}get typeDef(){return this._syncClientConfig(),this._activeClient.typeDef}get taskFields(){return this.typeDef?.fields??[]}async submit(e){this.phase===X.SUBMITTING||this.phase===X.POLLING||(this._syncClientConfig(),this.phase=X.SUBMITTING,this.error=``,this.progress=0,this.result=null,await this._activeClient.submit(this.type||this._activeClient.type,e),this._syncStateFromClient())}reset(){this._activeClient.reset(),this._syncStateFromClient()}async _handleFormSubmit(e){e.preventDefault(),await this.submit(this.collectFormData())}_handleRequestSubmit(e){e.preventDefault(),this.submit(this.collectFormData())}_handleClick(e){e.composedPath().find(e=>e instanceof HTMLElement?(e.type||e.getAttribute(`type`))===`submit`:!1)&&(e.preventDefault(),this.submit(this.collectFormData()))}_handleChildChange(e){let t=e.target;if(!(t instanceof HTMLElement))return;let n=Ze(t);if(!n)return;let r=et(e)??Qe(t);r!==void 0&&(t.value=r,this._syncMaskSources(n,r))}_syncMaskSources(e,t){this.taskFields.find(t=>t.name===e)?.type===`image`&&(typeof t!=`string`||!t||this.querySelectorAll(`lc-mask-editor`).forEach(e=>{let n=e;n.source||=t}))}collectFormData(){let e={},t=this.querySelectorAll(`*`),n=new Map(this.taskFields.map(e=>[e.name,e]));return t.forEach(t=>{let r=Ze(t);if(!r)return;let i=$e(t);n.get(r)?.type===`images`&&typeof i==`string`&&i&&(i=[i]),n.get(r)?.type===`multiEnum`&&typeof i==`string`&&i&&(i=tt(i)),i!==void 0&&(e[r]=i)}),e}get _activeClient(){return this.client??this._defaultClient}_syncClientConfig(){let e={customRequest:this.customRequest,customUploadRequest:this.customUploadRequest,onSubmit:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.SUBMIT,{detail:e,bubbles:!0,composed:!0}))},onPoll:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.POLL,{detail:e,bubbles:!0,composed:!0}))},onSuccess:e=>{this._syncStateFromClient(),this.dispatchEvent(new CustomEvent(Z.SUCCESS,{detail:e,bubbles:!0,composed:!0}))},onError:e=>this._fail(e.message,e.phase)};this.client?(this.type&&(e.type=this.type),this.submitEndpoint&&(e.submitEndpoint=this.submitEndpoint),this.pollEndpoint!==t.N.POLL_ENDPOINT&&(e.pollEndpoint=this.pollEndpoint),this.pollInterval!==t.N.POLL_INTERVAL&&(e.pollInterval=this.pollInterval),this.maxPollAttempts!==t.N.MAX_POLL_ATTEMPTS&&(e.maxPollAttempts=this.maxPollAttempts)):(e.type=this.type,this.submitEndpoint&&(e.submitEndpoint=this.submitEndpoint),e.pollEndpoint=this.pollEndpoint,e.pollInterval=this.pollInterval,e.maxPollAttempts=this.maxPollAttempts),this._activeClient.configure(e)}_syncStateFromClient(){let e=this._activeClient;this.phase=e.phase,this.taskId=e.taskId,this.progress=e.progress,this.result=e.result,this.error=e.error}_fail(e,t){this.phase=X.ERROR,this.error=e,this.dispatchEvent(new CustomEvent(Z.ERROR,{detail:{message:e,phase:t},bubbles:!0,composed:!0}))}render(){return n.html`
|
|
1102
|
+
<form
|
|
1103
|
+
@submit=${this._handleFormSubmit}
|
|
1104
|
+
@click=${this._handleClick}
|
|
1105
|
+
@change=${this._handleChildChange}
|
|
1106
|
+
>
|
|
1103
1107
|
<slot></slot>
|
|
1104
1108
|
</form>
|
|
1105
1109
|
`}};y([_({type:String})],Q.prototype,`type`,void 0),y([_({type:String,attribute:`submit-endpoint`})],Q.prototype,`submitEndpoint`,void 0),y([_({type:String,attribute:`poll-endpoint`})],Q.prototype,`pollEndpoint`,void 0),y([_({type:Number})],Q.prototype,`pollInterval`,void 0),y([_({type:Number})],Q.prototype,`maxPollAttempts`,void 0),y([_({attribute:!1})],Q.prototype,`client`,void 0),y([_({attribute:!1})],Q.prototype,`customRequest`,void 0),y([_({attribute:!1})],Q.prototype,`customUploadRequest`,void 0),y([v()],Q.prototype,`phase`,void 0),y([v()],Q.prototype,`taskId`,void 0),y([v()],Q.prototype,`progress`,void 0),y([v()],Q.prototype,`result`,void 0),y([v()],Q.prototype,`error`,void 0),Q=y([o(`lc-task-workflow`)],Q);function Ze(e){return e.name||e.getAttribute(`name`)||``}function Qe(e){let t=e.value;if(t!==void 0)return t;if(e.hasAttribute(`value`))return e.getAttribute(`value`)??``}function $e(e){return e.file||Qe(e)}function et(e){let t=e.detail;if(t){if(`value`in t)return t.value;if(`file`in t)return t.file}}function tt(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.map(String)}catch{}return e.split(`,`).map(e=>e.trim()).filter(Boolean)}var $=class extends n.LitElement{constructor(...e){super(...e),this.type=`button`,this.variant=`primary`,this.disabled=!1}static{this.styles=n.css`
|
|
@@ -1145,7 +1149,7 @@ const e=require(`./client-Dt9_oZey.cjs`),t=require(`./constants-BTXokn3H.cjs`);r
|
|
|
1145
1149
|
--lc-button-color: var(--lc-color-text);
|
|
1146
1150
|
--lc-button-border: 1px solid var(--lc-color-border);
|
|
1147
1151
|
}
|
|
1148
|
-
`}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.type
|
|
1152
|
+
`}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}if(this.type===`submit`){e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(t.o.REQUEST_SUBMIT,{bubbles:!0,composed:!0,cancelable:!0}));return}this.dispatchEvent(new MouseEvent(`click`,{bubbles:!0,composed:!0,cancelable:!0}))}render(){return n.html`
|
|
1149
1153
|
<button type=${this.type} ?disabled=${this.disabled} part="button" @click=${this.handleClick}>
|
|
1150
1154
|
<slot></slot>
|
|
1151
1155
|
</button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./constants-BTXokn3H.cjs`);var t={RUNNING:`running`,DONE:`done`},n={DONE:`done`,EXCEPTION:`exception`},r={MAX_SIZE_MB:10,MAX_WIDTH:2048,MAX_HEIGHT:2048,ASPECT_RATIO_MIN:1/3,ASPECT_RATIO_MAX:3},i=[`1:1`,`2:3`,`3:4`,`3:2`,`4:3`,`9:16`,`16:9`];function a(e){let t=[];e.size>r.MAX_SIZE_MB*1024*1024&&t.push(`图片大小不能超过10MB`),(e.width>r.MAX_WIDTH||e.height>r.MAX_HEIGHT)&&t.push(`图片分辨率不能超过2048x2048`);let n=e.width/e.height;return(n<r.ASPECT_RATIO_MIN||n>r.ASPECT_RATIO_MAX)&&t.push(`宽高比必须在1:3到3:1之间`),{valid:t.length===0,errors:t}}function o(e,t){let n=[];return(e.width!==t.width||e.height!==t.height)&&n.push(`蒙版尺寸必须与原图尺寸相同`),{valid:n.length===0,errors:n}}async function s(e){let t=e.size<=r.MAX_SIZE_MB*1024*1024;return new Promise(n=>{let i=new Image,a=URL.createObjectURL(e);i.onload=()=>{URL.revokeObjectURL(a);let e=[];(i.width>r.MAX_WIDTH||i.height>r.MAX_HEIGHT)&&e.push(`图片分辨率不能超过2048x2048`);let o=i.width/i.height;(o<r.ASPECT_RATIO_MIN||o>r.ASPECT_RATIO_MAX)&&e.push(`宽高比必须在1:3到3:1之间`),t||e.push(`图片大小不能超过10MB`),n({valid:e.length===0,errors:e})},i.onerror=()=>{URL.revokeObjectURL(a),n({valid:!1,errors:[`无法加载图片`]})},i.src=a})}var c={GeneratePrinting:{key:`GeneratePrinting`,title:`图案设计`,description:`上传1-2张灵感素材图进行融合发散设计`,fields:[{name:`imgUrlList`,label:`灵感素材图`,type:`images`,required:!0,hint:`上传1-2张灵感素材图`},{name:`prompt`,label:`图案风格`,type:`text`,required:!0,placeholder:`描述想要的图案风格`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},VirtualFitting:{key:`VirtualFitting`,title:`AI试衣`,description:`上传服装图片生成模特上身效果图`,fields:[{name:`imgUrl`,label:`上装图片`,type:`image`,required:!0,hint:`挂拍图/人台图/平铺图`},{name:`lowerImgUrl`,label:`下装图片`,type:`image`},{name:`prompt`,label:`试衣需求`,type:`text`,placeholder:`描述试衣需求`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},FixFace:{key:`FixFace`,title:`面部优化`,description:`智能修复模特脸部畸形`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0}]},ChangeFace:{key:`ChangeFace`,title:`面部替换`,description:`上传指定面部图片替换模特面容`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考面部图`,type:`image`,required:!0}]},MultiPerspective:{key:`MultiPerspective`,title:`多视角`,description:`生成不同角度的展示效果图`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`perspective`,label:`视角`,type:`enum`,required:!0,options:e.b}]},PrintingTiling:{key:`PrintingTiling`,title:`图案印染上身`,description:`将指定图案虚拟印染到款式图上`,fields:[{name:`imgUrl`,label:`款式图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`printingImgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`prompt`,label:`印染需求`,type:`text`,placeholder:`描述印染需求`}]},ChangeDesignPoint:{key:`ChangeDesignPoint`,title:`设计点修改`,description:`通过参考图实现设计点修改或融合`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`prompt`,label:`修改需求`,type:`text`,placeholder:`描述修改需求`}]},ChangeColor:{key:`ChangeColor`,title:`服装改色`,description:`自定义区域一键换色`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`改色区域蒙版`,type:`mask`,required:!0},{name:`hexCode`,label:`目标颜色`,type:`color`,required:!0}]},ChangeFabric:{key:`ChangeFabric`,title:`面料上身`,description:`将指定面料一键上身到款式图`,fields:[{name:`imgUrl`,label:`款式图/模特图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`,required:!0},{name:`fabricImgUrl`,label:`面料图`,type:`image`,required:!0}]},Sr:{key:`Sr`,title:`高清放大`,description:`无损高清放大与细节强化`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`scale`,label:`放大倍数`,type:`enum`,required:!0,options:e.T}]},VectorConvert:{key:`VectorConvert`,title:`矢量图转换`,description:`生成可编辑的矢量格式文件`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`patternType`,label:`图案类型`,type:`enum`,required:!0,options:e.y}]},ChangeModel:{key:`ChangeModel`,title:`模特更换`,description:`一键更换模特并支持自定义选择`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`gender`,label:`性别`,type:`enum`,options:e.g},{name:`age`,label:`年龄`,type:`enum`,options:e.u},{name:`race`,label:`人种`,type:`enum`,options:e.S}]},GenerateSketch:{key:`GenerateSketch`,title:`平铺图转线稿`,description:`上传平铺图生成线稿`,fields:[{name:`imgUrl`,label:`平铺图`,type:`image`,required:!0}]},ModelGenerateSketch:{key:`ModelGenerateSketch`,title:`模特图转线稿`,description:`上传模特图生成线稿`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`position`,label:`服装位置`,type:`enum`,options:e.x}]},Eliminate:{key:`Eliminate`,title:`AI消除`,description:`一键消除指定元素`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`消除区域蒙版`,type:`mask`,required:!0}]},ExpandImage:{key:`ExpandImage`,title:`AI扩图`,description:`一键扩充人物或背景`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`扩图区域蒙版`,type:`mask`,required:!0}]},ClothingDesign:{key:`ClothingDesign`,title:`AI创款`,description:`根据灵感图快速创款`,fields:[{name:`imgUrlList`,label:`灵感款式图`,type:`images`,hint:`上传1-3张灵感图`},{name:`fabricImgUrl`,label:`面料图`,type:`image`,hint:`上传面料图进行面料创款`},{name:`words`,label:`创款需求`,type:`text`,placeholder:`描述创款需求`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},ChangePattern:{key:`ChangePattern`,title:`服装改版`,description:`通过选择部位和版型修改服装版型`,fields:[{name:`imgUrl`,label:`服装图`,type:`image`,required:!0},{name:`detailList`,label:`改版部位`,type:`multiEnum`,required:!0,options:e.m}]},GenerateModel:{key:`GenerateModel`,title:`定制模特`,description:`生成符合需求的虚拟模特`,fields:[{name:`imgUrlList`,label:`参考图片`,type:`images`,required:!0,hint:`上传1-10张带面容的图片`},{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`race`,label:`人种`,type:`enum`,options:e.S}]},ModifyPrinting:{key:`ModifyPrinting`,title:`图案修改`,description:`上传图案和参考图AI修改`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`prompt`,label:`修改需求`,type:`text`,placeholder:`描述修改需求`}]},CutOut:{key:`CutOut`,title:`智能抠图`,description:`一键抠图修边`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`recognitionType`,label:`识别类型`,type:`enum`,required:!0,options:e.C}]},LineArtToReal:{key:`LineArtToReal`,title:`线稿转实物`,description:`线稿图生成实物效果平铺图`,fields:[{name:`imgUrl`,label:`线稿图`,type:`image`,required:!0},{name:`imageType`,label:`图片类型`,type:`enum`,required:!0,options:e._},{name:`prompt`,label:`款式特征`,type:`text`,placeholder:`描述款式特征`}]},FixPartial:{key:`FixPartial`,title:`局部修复`,description:`修复或重新创造指定区域`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`修复区域蒙版`,type:`mask`,required:!0},{name:`prompt`,label:`修复需求`,type:`text`,placeholder:`描述修复需求`}]},DetailCompensation:{key:`DetailCompensation`,title:`细节补偿`,description:`精准还原服装细节`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`refImgUrl`,label:`参考图`,type:`image`}]},ChangeClothesByImg:{key:`ChangeClothesByImg`,title:`服装穿搭调整`,description:`上下装搭配调整`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`changeImgUrl`,label:`搭配服装图`,type:`image`,required:!0}]}},l={ChangeAccessoriesByImg:{key:`ChangeAccessoriesByImg`,title:`配饰穿搭调整`,description:`背包鞋子首饰等搭配调整`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`changeImgUrl`,label:`搭配物品图`,type:`image`,required:!0},{name:`accessoryType`,label:`配件类型`,type:`enum`,required:!0,options:e.l}]},VirtualFittingReference:{key:`VirtualFittingReference`,title:`AI试衣参考图模式`,description:`上传模特参考图生成试衣效果`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`refImgUrl`,label:`模特参考图`,type:`image`,required:!0}]},VirtualFittingTemplate:{key:`VirtualFittingTemplate`,title:`AI试衣模板模式`,description:`选择试衣场景模板`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`templateId`,label:`试衣模板`,type:`enum`,required:!0,options:e.k}]},FixDeformities:{key:`FixDeformities`,title:`畸形修复`,description:`修复手部脚部脸部畸形`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`maskUrl`,label:`修复区域蒙版`,type:`mask`,required:!0}]},IntelligentCropping:{key:`IntelligentCropping`,title:`AI智能裁图`,description:`自定义像素或比例裁图`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`mode`,label:`裁剪模式`,type:`enum`,required:!0,options:e.p},{name:`x`,label:`X坐标`,type:`number`},{name:`y`,label:`Y坐标`,type:`number`},{name:`width`,label:`宽度`,type:`number`},{name:`height`,label:`高度`,type:`number`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},ModelToFlat:{key:`ModelToFlat`,title:`模特转平铺`,description:`模特图生成平铺图效果`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`position`,label:`服装位置`,type:`enum`,required:!0,options:e.x}]},GenerateShortVideo:{key:`GenerateShortVideo`,title:`短视频生成`,description:`上传图片生成短视频`,fields:[{name:`imgUrl`,label:`首帧图片`,type:`image`,required:!0},{name:`tailImgUrl`,label:`尾帧图片`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述视频内容`},{name:`duration`,label:`时长`,type:`enum`,required:!0,options:e.h}]},OneClickModifyPrinting:{key:`OneClickModifyPrinting`,title:`一键改图案`,description:`通过文本或参考图一键更改图案`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述图案修改需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},OrientationDesign:{key:`OrientationDesign`,title:`服装定向设计`,description:`通过设计点对服装进行定向设计`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版1`,type:`mask`},{name:`refImgUrl`,label:`参考图1`,type:`image`},{name:`prompt`,label:`文本指令1`,type:`text`,placeholder:`描述设计需求`}]},DirectionalIntegration:{key:`DirectionalIntegration`,title:`定向融合`,description:`通过融合设计点对服装进行融合设计`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版1`,type:`mask`},{name:`refImgUrl`,label:`参考图1`,type:`image`,required:!0}]},OneClickIntegration:{key:`OneClickIntegration`,title:`一键融合`,description:`通过参考图和文本指令一键融合`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述融合需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},ChangeFabricV2:{key:`ChangeFabricV2`,title:`面料上身2.0`,description:`支持文本指令的面料上身`,fields:[{name:`imgUrl`,label:`款式图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`,required:!0},{name:`fabricImgUrl`,label:`面料图`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述调整需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},VirtualFittingReferenceV2:{key:`VirtualFittingReferenceV2`,title:`AI试衣参考图2.0`,description:`支持姿势和背景的试衣`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`refImgUrl`,label:`模特参考图`,type:`image`,required:!0},{name:`poseImgUrl`,label:`姿势图`,type:`image`},{name:`bgImgUrl`,label:`背景图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述试衣需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FlowerShapedDesign:{key:`FlowerShapedDesign`,title:`花型创款`,description:`将印花上身到指定款式效果图`,fields:[{name:`imgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,required:!0,placeholder:`描述上身效果需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FlowerShapedVirtualPrinting:{key:`FlowerShapedVirtualPrinting`,title:`花型上身`,description:`将图案上身到款式图指定区域`,fields:[{name:`imgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`bodyImgUrl`,label:`上身图`,type:`image`,required:!0},{name:`bodyMaskImgUrl`,label:`目标区域蒙版`,type:`mask`,required:!0},{name:`removePattern`,label:`是否去除参考图印花`,type:`enum`,options:e.w}]},OneClickChangeColor:{key:`OneClickChangeColor`,title:`一键改色`,description:`整合智能识别与自定义改色`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`hexCode`,label:`目标颜色`,type:`color`},{name:`hexImgUrl`,label:`颜色参考图`,type:`image`},{name:`changeColorArea`,label:`改色区域`,type:`text`,placeholder:`如:上衣`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelWithLabels:{key:`FittingModelWithLabels`,title:`模特定制标签模式`,description:`通过标签选择生成虚拟模特`,fields:[{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`age`,label:`年龄`,type:`enum`,options:e.u},{name:`nationality`,label:`国籍`,type:`enum`,options:e.v},{name:`skinColor`,label:`肤色`,type:`enum`,options:e.O},{name:`bodyShape`,label:`身材`,type:`enum`,options:e.f}]},FittingModelCustom:{key:`FittingModelCustom`,title:`模特定制自定义模式`,description:`根据参考图生成虚拟模特`,fields:[{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`faceRefImgUrl`,label:`脸部参考图`,type:`image`,required:!0},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`bodyShapeRefImgUrl`,label:`身材参考图`,type:`image`},{name:`additionalDescription`,label:`附加描述`,type:`text`,placeholder:`附加描述`}]},FittingModelChangeFace:{key:`FittingModelChangeFace`,title:`模特换脸`,description:`对模特图换脸操作`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考面部图`,type:`image`,required:!0},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeModel:{key:`FittingModelChangeModel`,title:`模特替换`,description:`随机或指定模特替换`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`gender`,label:`性别`,type:`enum`,options:e.g},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeBodyShape:{key:`FittingModelChangeBodyShape`,title:`模特身材调整`,description:`通过标签或参考图调整身材`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`bodyShapeRefImgUrl`,label:`身材参考图`,type:`image`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeClothingSize:{key:`FittingModelChangeClothingSize`,title:`模特尺码调整`,description:`调整模特服装尺码`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`size`,label:`尺码`,type:`enum`,required:!0,options:e.D},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangePosture:{key:`FittingModelChangePosture`,title:`模特姿势调整`,description:`调整模特姿势`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`poseImgUrl`,label:`姿势参考图`,type:`image`,required:!0},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeBackground:{key:`FittingModelChangeBackground`,title:`模特换背景`,description:`替换模特背景`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`bgImgUrl`,label:`背景参考图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述背景需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangePerspective:{key:`FittingModelChangePerspective`,title:`模特视角调整`,description:`调整模特视角`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`perspective`,label:`视角`,type:`enum`,required:!0,options:e.b},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},TrainClothingModel:{key:`TrainClothingModel`,title:`服装风格模型训练`,description:`训练自定义服装风格模型`,fields:[{name:`imgUrlList`,label:`训练图片`,type:`images`,required:!0,hint:`建议上传30-50张正面/斜侧面模特图`},{name:`clothingModelName`,label:`模型名称`,type:`text`,required:!0},{name:`enhanceWordList`,label:`加强词`,type:`text`}]}},u={...c,...l};function d(e){return u[e]}function f(){return Object.values(u)}function p(e,t){let n=[];for(let r of t){let t=e[r.name],i=m(r,t);i&&n.push(i)}return{valid:n.length===0,errors:n}}function m(t,n){let r=n==null||n===``;if(t.required&&r)return{field:t.name,label:t.label,message:e.a.FIELD_REQUIRED(t.label)};if(n==null)return null;let i=e=>({field:t.name,label:t.label,message:e(t.label)});switch(t.type){case`image`:case`mask`:if(typeof n!=`string`&&!h(n))return i(e.a.FIELD_STRING);break;case`images`:if(!Array.isArray(n)||n.length===0)return i(e.a.FIELD_ARRAY);if(n.some(e=>(typeof e!=`string`||e===``)&&!h(e)))return i(e.a.FIELD_ARRAY_ELEMENTS);break;case`text`:if(typeof n!=`string`)return i(e.a.FIELD_STRING);if(t.maxLength&&n.length>t.maxLength)return i(n=>e.a.FIELD_MAX_LENGTH(n,t.maxLength));break;case`enum`:if(typeof n!=`string`)return i(e.a.FIELD_STRING);if(t.options&&!t.options.some(e=>e.value===n))return i(e.a.FIELD_ENUM_INVALID);break;case`multiEnum`:if(!Array.isArray(n)||n.length===0)return i(e.a.FIELD_ARRAY);if(n.some(e=>typeof e!=`string`||e===``))return i(e.a.FIELD_ARRAY_ELEMENTS);if(t.options&&n.some(e=>!t.options?.some(t=>t.value===e)))return i(e.a.FIELD_ENUM_INVALID);break;case`color`:if(typeof n!=`string`||!/^#[0-9A-Fa-f]{6}$/.test(n))return i(e.a.FIELD_COLOR_FORMAT);break;case`number`:if(typeof n!=`number`||Number.isNaN(n))return i(e.a.FIELD_NUMBER);break;case`aspectRatio`:case`strength`:break}return null}function h(e){return typeof File<`u`&&e instanceof File}var g=class{constructor(t={}){this.type=``,this.submitEndpoint=`/task/submit`,this.submitEndpointMode=`prefix`,this.pollEndpoint=`/task/progress`,this.pollInterval=1e3,this.maxPollAttempts=120,this.phase=e.P.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this.activeTasks=new Map,this.pollTimer=null,this.isPollingBatch=!1,this.configure(t)}configure(e){e.type!==void 0&&(this.type=e.type),e.submitEndpoint!==void 0&&(this.submitEndpoint=e.submitEndpoint),e.submitEndpointMode!==void 0&&(this.submitEndpointMode=e.submitEndpointMode),e.pollEndpoint!==void 0&&(this.pollEndpoint=e.pollEndpoint),e.pollInterval!==void 0&&(this.pollInterval=e.pollInterval),e.maxPollAttempts!==void 0&&(this.maxPollAttempts=e.maxPollAttempts),e.customRequest!==void 0&&(this.customRequest=e.customRequest),e.customUploadRequest!==void 0&&(this.customUploadRequest=e.customUploadRequest),e.customUploadRequert!==void 0&&(this.customUploadRequest=e.customUploadRequert),e.onSubmit!==void 0&&(this.onSubmit=e.onSubmit),e.onPoll!==void 0&&(this.onPoll=e.onPoll),e.onSuccess!==void 0&&(this.onSuccess=e.onSuccess),e.onError!==void 0&&(this.onError=e.onError)}get typeDef(){let e=this.resolvedTaskTypeKey;return e?d(e):void 0}get taskFields(){return this.typeDef?.fields??[]}async submit(t,n){let r=this.createRequestUri(t);if(!r){this.fail(e.a.MISSING_ENDPOINT,e.P.IDLE);return}let i=this.getTaskFields(t);if(i.length>0){let t=p(n,i);if(!t.valid){this.fail(t.errors.map(e=>e.message).join(`; `),e.P.IDLE);return}}this.phase=e.P.SUBMITTING,this.error=``,this.progress=0,this.result=null;try{let e=await this.resolveUploads(n,i),t=(await this.request(r,{method:`POST`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}})).data.taskId;this.taskId=t;let a={taskId:t,endpoint:r,formData:e};this.onSubmit?.(a),await this.trackTask(t)}catch(t){this.fail(t instanceof Error?t.message:e.a.SUBMIT_FAILED,this.phase)}}reset(){this.phase=e.P.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this.activeTasks.clear(),this.pollTimer&&=(clearTimeout(this.pollTimer),null)}createRequestUri(e=this.type){return this.submitEndpointMode===`full`?this.submitEndpoint:e?`${this.submitEndpoint}/${e}`:this.submitEndpoint}get resolvedTaskTypeKey(){return _(this.type)}getTaskFields(e){let t=_(e);return t?d(t)?.fields??[]:[]}async resolveUploads(e,t){let n=t.length>0?t.filter(e=>e.type===`image`||e.type===`mask`||e.type===`images`):Object.keys(e).map(e=>({name:e,type:`image`}));if(!n.length)return e;let r={...e};for(let e of n){let t=r[e.name];Array.isArray(t)?r[e.name]=await Promise.all(t.map(t=>this.resolveUploadValue(t,e))):r[e.name]=await this.resolveUploadValue(t,e)}return r}async resolveUploadValue(e,t){if(!v(e))return e;if(!this.customUploadRequest)throw Error(`customUploadRequest is required to upload ${t.name}`);let n=new FormData;return n.append(t.name||`file`,e),y(await this.customUploadRequest({file:e,name:t.name,formData:n,field:t}))}trackTask(t){this.phase=e.P.POLLING;let n=new Promise(e=>{this.activeTasks.set(t,{taskId:t,attempts:0,resolve:e})});return this.ensurePolling(0),n}ensurePolling(e=this.pollInterval){this.pollTimer||this.isPollingBatch||!this.activeTasks.size||(this.pollTimer=setTimeout(()=>{this.pollTimer=null,this.pollActiveTasks()},this.pollInterval))}async pollActiveTasks(){if(!this.activeTasks.size)return;this.isPollingBatch=!0;let t=[...this.activeTasks.keys()];try{let n=`${this.pollEndpoint}?taskIds=${t.map(encodeURIComponent).join(`,`)}`,r=await this.request(n,{method:`GET`}),i=new Map(r.data.map(e=>[e.aiTaskId,e]));t.forEach(t=>{let n=this.activeTasks.get(t);if(!n)return;n.attempts+=1;let r=i.get(t);if(!r){this.failTask(n,e.a.TASK_NOT_FOUND(t));return}this.taskId=t,this.progress=r.taskProgress;let a={taskId:t,progress:r.taskProgress,status:r.aiTaskStatus,queuePos:r.queuePos};if(this.onPoll?.(a),r.aiTaskStatus===`done`){this.result=r;let e={taskId:t,images:r.imgInfo?[{index:0,url:r.imgInfo}]:[],result:r};this.onSuccess?.(e),this.completeTask(n);return}n.attempts>=this.maxPollAttempts&&this.failTask(n,e.a.POLL_TIMEOUT(t))})}catch(t){let n=t instanceof Error?t.message:e.a.POLL_FAILED;[...this.activeTasks.values()].forEach(e=>this.failTask(e,n))}finally{this.isPollingBatch=!1,this.activeTasks.size?(this.phase=e.P.POLLING,this.ensurePolling(this.pollInterval)):this.phase===e.P.POLLING&&(this.phase=this.error?e.P.ERROR:e.P.SUCCESS)}}completeTask(e){this.activeTasks.delete(e.taskId),e.resolve()}failTask(t,n){this.activeTasks.delete(t.taskId),this.fail(n,e.P.POLLING,t.taskId),t.resolve()}async request(e,t){let n=await(this.customRequest??fetch)(e,t);return n&&typeof n.json==`function`?n.json():n}fail(t,n,r){this.phase=e.P.ERROR,this.error=t;let i={message:t,phase:n,taskId:r};this.onError?.(i)}};function _(e){if(!e)return``;if(u[e])return e;let t=e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toUpperCase();return u[t]?t:``}function v(e){return typeof File<`u`&&e instanceof File}async function y(e){return e?typeof e==`string`?e:e instanceof Response?y(await e.json()):typeof e.data==`string`?e.data:e.data?e.data.value||e.data.url||``:e.value||e.url||``:``}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return o}});
|
|
1
|
+
const e=require(`./constants-Bdlwi9VJ.cjs`);var t={RUNNING:`running`,DONE:`done`},n={DONE:`done`,EXCEPTION:`exception`},r={MAX_SIZE_MB:10,MAX_WIDTH:2048,MAX_HEIGHT:2048,ASPECT_RATIO_MIN:1/3,ASPECT_RATIO_MAX:3},i=[`1:1`,`2:3`,`3:4`,`3:2`,`4:3`,`9:16`,`16:9`];function a(e){let t=[];e.size>r.MAX_SIZE_MB*1024*1024&&t.push(`图片大小不能超过10MB`),(e.width>r.MAX_WIDTH||e.height>r.MAX_HEIGHT)&&t.push(`图片分辨率不能超过2048x2048`);let n=e.width/e.height;return(n<r.ASPECT_RATIO_MIN||n>r.ASPECT_RATIO_MAX)&&t.push(`宽高比必须在1:3到3:1之间`),{valid:t.length===0,errors:t}}function o(e,t){let n=[];return(e.width!==t.width||e.height!==t.height)&&n.push(`蒙版尺寸必须与原图尺寸相同`),{valid:n.length===0,errors:n}}async function s(e){let t=e.size<=r.MAX_SIZE_MB*1024*1024;return new Promise(n=>{let i=new Image,a=URL.createObjectURL(e);i.onload=()=>{URL.revokeObjectURL(a);let e=[];(i.width>r.MAX_WIDTH||i.height>r.MAX_HEIGHT)&&e.push(`图片分辨率不能超过2048x2048`);let o=i.width/i.height;(o<r.ASPECT_RATIO_MIN||o>r.ASPECT_RATIO_MAX)&&e.push(`宽高比必须在1:3到3:1之间`),t||e.push(`图片大小不能超过10MB`),n({valid:e.length===0,errors:e})},i.onerror=()=>{URL.revokeObjectURL(a),n({valid:!1,errors:[`无法加载图片`]})},i.src=a})}var c={GeneratePrinting:{key:`GeneratePrinting`,title:`图案设计`,description:`上传1-2张灵感素材图进行融合发散设计`,fields:[{name:`imgUrlList`,label:`灵感素材图`,type:`images`,required:!0,hint:`上传1-2张灵感素材图`},{name:`prompt`,label:`图案风格`,type:`text`,required:!0,placeholder:`描述想要的图案风格`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},VirtualFitting:{key:`VirtualFitting`,title:`AI试衣`,description:`上传服装图片生成模特上身效果图`,fields:[{name:`imgUrl`,label:`上装图片`,type:`image`,required:!0,hint:`挂拍图/人台图/平铺图`},{name:`lowerImgUrl`,label:`下装图片`,type:`image`},{name:`prompt`,label:`试衣需求`,type:`text`,placeholder:`描述试衣需求`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},FixFace:{key:`FixFace`,title:`面部优化`,description:`智能修复模特脸部畸形`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0}]},ChangeFace:{key:`ChangeFace`,title:`面部替换`,description:`上传指定面部图片替换模特面容`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考面部图`,type:`image`,required:!0}]},MultiPerspective:{key:`MultiPerspective`,title:`多视角`,description:`生成不同角度的展示效果图`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`perspective`,label:`视角`,type:`enum`,required:!0,options:e.b}]},PrintingTiling:{key:`PrintingTiling`,title:`图案印染上身`,description:`将指定图案虚拟印染到款式图上`,fields:[{name:`imgUrl`,label:`款式图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`printingImgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`prompt`,label:`印染需求`,type:`text`,placeholder:`描述印染需求`}]},ChangeDesignPoint:{key:`ChangeDesignPoint`,title:`设计点修改`,description:`通过参考图实现设计点修改或融合`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`prompt`,label:`修改需求`,type:`text`,placeholder:`描述修改需求`}]},ChangeColor:{key:`ChangeColor`,title:`服装改色`,description:`自定义区域一键换色`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`改色区域蒙版`,type:`mask`,required:!0},{name:`hexCode`,label:`目标颜色`,type:`color`,required:!0}]},ChangeFabric:{key:`ChangeFabric`,title:`面料上身`,description:`将指定面料一键上身到款式图`,fields:[{name:`imgUrl`,label:`款式图/模特图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`,required:!0},{name:`fabricImgUrl`,label:`面料图`,type:`image`,required:!0}]},Sr:{key:`Sr`,title:`高清放大`,description:`无损高清放大与细节强化`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`scale`,label:`放大倍数`,type:`enum`,required:!0,options:e.T}]},VectorConvert:{key:`VectorConvert`,title:`矢量图转换`,description:`生成可编辑的矢量格式文件`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`patternType`,label:`图案类型`,type:`enum`,required:!0,options:e.y}]},ChangeModel:{key:`ChangeModel`,title:`模特更换`,description:`一键更换模特并支持自定义选择`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`gender`,label:`性别`,type:`enum`,options:e.g},{name:`age`,label:`年龄`,type:`enum`,options:e.u},{name:`race`,label:`人种`,type:`enum`,options:e.S}]},GenerateSketch:{key:`GenerateSketch`,title:`平铺图转线稿`,description:`上传平铺图生成线稿`,fields:[{name:`imgUrl`,label:`平铺图`,type:`image`,required:!0}]},ModelGenerateSketch:{key:`ModelGenerateSketch`,title:`模特图转线稿`,description:`上传模特图生成线稿`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`position`,label:`服装位置`,type:`enum`,options:e.x}]},Eliminate:{key:`Eliminate`,title:`AI消除`,description:`一键消除指定元素`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`消除区域蒙版`,type:`mask`,required:!0}]},ExpandImage:{key:`ExpandImage`,title:`AI扩图`,description:`一键扩充人物或背景`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`扩图区域蒙版`,type:`mask`,required:!0}]},ClothingDesign:{key:`ClothingDesign`,title:`AI创款`,description:`根据灵感图快速创款`,fields:[{name:`imgUrlList`,label:`灵感款式图`,type:`images`,hint:`上传1-3张灵感图`},{name:`fabricImgUrl`,label:`面料图`,type:`image`,hint:`上传面料图进行面料创款`},{name:`words`,label:`创款需求`,type:`text`,placeholder:`描述创款需求`},{name:`aspectRatio`,label:`比例`,type:`aspectRatio`}]},ChangePattern:{key:`ChangePattern`,title:`服装改版`,description:`通过选择部位和版型修改服装版型`,fields:[{name:`imgUrl`,label:`服装图`,type:`image`,required:!0},{name:`detailList`,label:`改版部位`,type:`multiEnum`,required:!0,options:e.m}]},GenerateModel:{key:`GenerateModel`,title:`定制模特`,description:`生成符合需求的虚拟模特`,fields:[{name:`imgUrlList`,label:`参考图片`,type:`images`,required:!0,hint:`上传1-10张带面容的图片`},{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`race`,label:`人种`,type:`enum`,options:e.S}]},ModifyPrinting:{key:`ModifyPrinting`,title:`图案修改`,description:`上传图案和参考图AI修改`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`prompt`,label:`修改需求`,type:`text`,placeholder:`描述修改需求`}]},CutOut:{key:`CutOut`,title:`智能抠图`,description:`一键抠图修边`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`recognitionType`,label:`识别类型`,type:`enum`,required:!0,options:e.C}]},LineArtToReal:{key:`LineArtToReal`,title:`线稿转实物`,description:`线稿图生成实物效果平铺图`,fields:[{name:`imgUrl`,label:`线稿图`,type:`image`,required:!0},{name:`imageType`,label:`图片类型`,type:`enum`,required:!0,options:e._},{name:`prompt`,label:`款式特征`,type:`text`,placeholder:`描述款式特征`}]},FixPartial:{key:`FixPartial`,title:`局部修复`,description:`修复或重新创造指定区域`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`修复区域蒙版`,type:`mask`,required:!0},{name:`prompt`,label:`修复需求`,type:`text`,placeholder:`描述修复需求`}]},DetailCompensation:{key:`DetailCompensation`,title:`细节补偿`,description:`精准还原服装细节`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`},{name:`refImgUrl`,label:`参考图`,type:`image`}]},ChangeClothesByImg:{key:`ChangeClothesByImg`,title:`服装穿搭调整`,description:`上下装搭配调整`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`changeImgUrl`,label:`搭配服装图`,type:`image`,required:!0}]}},l={ChangeAccessoriesByImg:{key:`ChangeAccessoriesByImg`,title:`配饰穿搭调整`,description:`背包鞋子首饰等搭配调整`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`changeImgUrl`,label:`搭配物品图`,type:`image`,required:!0},{name:`accessoryType`,label:`配件类型`,type:`enum`,required:!0,options:e.l}]},VirtualFittingReference:{key:`VirtualFittingReference`,title:`AI试衣参考图模式`,description:`上传模特参考图生成试衣效果`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`refImgUrl`,label:`模特参考图`,type:`image`,required:!0}]},VirtualFittingTemplate:{key:`VirtualFittingTemplate`,title:`AI试衣模板模式`,description:`选择试衣场景模板`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`templateId`,label:`试衣模板`,type:`enum`,required:!0,options:e.k}]},FixDeformities:{key:`FixDeformities`,title:`畸形修复`,description:`修复手部脚部脸部畸形`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`maskUrl`,label:`修复区域蒙版`,type:`mask`,required:!0}]},IntelligentCropping:{key:`IntelligentCropping`,title:`AI智能裁图`,description:`自定义像素或比例裁图`,fields:[{name:`imgUrl`,label:`图片`,type:`image`,required:!0},{name:`mode`,label:`裁剪模式`,type:`enum`,required:!0,options:e.p},{name:`x`,label:`X坐标`,type:`number`},{name:`y`,label:`Y坐标`,type:`number`},{name:`width`,label:`宽度`,type:`number`},{name:`height`,label:`高度`,type:`number`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},ModelToFlat:{key:`ModelToFlat`,title:`模特转平铺`,description:`模特图生成平铺图效果`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`position`,label:`服装位置`,type:`enum`,required:!0,options:e.x}]},GenerateShortVideo:{key:`GenerateShortVideo`,title:`短视频生成`,description:`上传图片生成短视频`,fields:[{name:`imgUrl`,label:`首帧图片`,type:`image`,required:!0},{name:`tailImgUrl`,label:`尾帧图片`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述视频内容`},{name:`duration`,label:`时长`,type:`enum`,required:!0,options:e.h}]},OneClickModifyPrinting:{key:`OneClickModifyPrinting`,title:`一键改图案`,description:`通过文本或参考图一键更改图案`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述图案修改需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},OrientationDesign:{key:`OrientationDesign`,title:`服装定向设计`,description:`通过设计点对服装进行定向设计`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版1`,type:`mask`},{name:`refImgUrl`,label:`参考图1`,type:`image`},{name:`prompt`,label:`文本指令1`,type:`text`,placeholder:`描述设计需求`}]},DirectionalIntegration:{key:`DirectionalIntegration`,title:`定向融合`,description:`通过融合设计点对服装进行融合设计`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版1`,type:`mask`},{name:`refImgUrl`,label:`参考图1`,type:`image`,required:!0}]},OneClickIntegration:{key:`OneClickIntegration`,title:`一键融合`,description:`通过参考图和文本指令一键融合`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考图`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述融合需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},ChangeFabricV2:{key:`ChangeFabricV2`,title:`面料上身2.0`,description:`支持文本指令的面料上身`,fields:[{name:`imgUrl`,label:`款式图`,type:`image`,required:!0},{name:`maskUrl`,label:`蒙版`,type:`mask`,required:!0},{name:`fabricImgUrl`,label:`面料图`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述调整需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},VirtualFittingReferenceV2:{key:`VirtualFittingReferenceV2`,title:`AI试衣参考图2.0`,description:`支持姿势和背景的试衣`,fields:[{name:`imgUrl`,label:`服装图片`,type:`image`,required:!0},{name:`refImgUrl`,label:`模特参考图`,type:`image`,required:!0},{name:`poseImgUrl`,label:`姿势图`,type:`image`},{name:`bgImgUrl`,label:`背景图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述试衣需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FlowerShapedDesign:{key:`FlowerShapedDesign`,title:`花型创款`,description:`将印花上身到指定款式效果图`,fields:[{name:`imgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`prompt`,label:`文本指令`,type:`text`,required:!0,placeholder:`描述上身效果需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FlowerShapedVirtualPrinting:{key:`FlowerShapedVirtualPrinting`,title:`花型上身`,description:`将图案上身到款式图指定区域`,fields:[{name:`imgUrl`,label:`印花图案`,type:`image`,required:!0},{name:`bodyImgUrl`,label:`上身图`,type:`image`,required:!0},{name:`bodyMaskImgUrl`,label:`目标区域蒙版`,type:`mask`,required:!0},{name:`removePattern`,label:`是否去除参考图印花`,type:`enum`,options:e.w}]},OneClickChangeColor:{key:`OneClickChangeColor`,title:`一键改色`,description:`整合智能识别与自定义改色`,fields:[{name:`imgUrl`,label:`原图`,type:`image`,required:!0},{name:`hexCode`,label:`目标颜色`,type:`color`},{name:`hexImgUrl`,label:`颜色参考图`,type:`image`},{name:`changeColorArea`,label:`改色区域`,type:`text`,placeholder:`如:上衣`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelWithLabels:{key:`FittingModelWithLabels`,title:`模特定制标签模式`,description:`通过标签选择生成虚拟模特`,fields:[{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`age`,label:`年龄`,type:`enum`,options:e.u},{name:`nationality`,label:`国籍`,type:`enum`,options:e.v},{name:`skinColor`,label:`肤色`,type:`enum`,options:e.O},{name:`bodyShape`,label:`身材`,type:`enum`,options:e.f}]},FittingModelCustom:{key:`FittingModelCustom`,title:`模特定制自定义模式`,description:`根据参考图生成虚拟模特`,fields:[{name:`gender`,label:`性别`,type:`enum`,required:!0,options:e.g},{name:`faceRefImgUrl`,label:`脸部参考图`,type:`image`,required:!0},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`bodyShapeRefImgUrl`,label:`身材参考图`,type:`image`},{name:`additionalDescription`,label:`附加描述`,type:`text`,placeholder:`附加描述`}]},FittingModelChangeFace:{key:`FittingModelChangeFace`,title:`模特换脸`,description:`对模特图换脸操作`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`refImgUrl`,label:`参考面部图`,type:`image`,required:!0},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeModel:{key:`FittingModelChangeModel`,title:`模特替换`,description:`随机或指定模特替换`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`gender`,label:`性别`,type:`enum`,options:e.g},{name:`similarity`,label:`相似度`,type:`enum`,options:e.E},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeBodyShape:{key:`FittingModelChangeBodyShape`,title:`模特身材调整`,description:`通过标签或参考图调整身材`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`bodyShapeRefImgUrl`,label:`身材参考图`,type:`image`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeClothingSize:{key:`FittingModelChangeClothingSize`,title:`模特尺码调整`,description:`调整模特服装尺码`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`size`,label:`尺码`,type:`enum`,required:!0,options:e.D},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangePosture:{key:`FittingModelChangePosture`,title:`模特姿势调整`,description:`调整模特姿势`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`poseImgUrl`,label:`姿势参考图`,type:`image`,required:!0},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangeBackground:{key:`FittingModelChangeBackground`,title:`模特换背景`,description:`替换模特背景`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`bgImgUrl`,label:`背景参考图`,type:`image`},{name:`prompt`,label:`文本指令`,type:`text`,placeholder:`描述背景需求`},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},FittingModelChangePerspective:{key:`FittingModelChangePerspective`,title:`模特视角调整`,description:`调整模特视角`,fields:[{name:`imgUrl`,label:`模特图`,type:`image`,required:!0},{name:`perspective`,label:`视角`,type:`enum`,required:!0,options:e.b},{name:`aspectRatio`,label:`宽高比`,type:`aspectRatio`}]},TrainClothingModel:{key:`TrainClothingModel`,title:`服装风格模型训练`,description:`训练自定义服装风格模型`,fields:[{name:`imgUrlList`,label:`训练图片`,type:`images`,required:!0,hint:`建议上传30-50张正面/斜侧面模特图`},{name:`clothingModelName`,label:`模型名称`,type:`text`,required:!0},{name:`enhanceWordList`,label:`加强词`,type:`text`}]}},u={...c,...l};function d(e){return u[e]}function f(){return Object.values(u)}function p(e,t){let n=[];for(let r of t){let t=e[r.name],i=m(r,t);i&&n.push(i)}return{valid:n.length===0,errors:n}}function m(t,n){let r=n==null||n===``;if(t.required&&r)return{field:t.name,label:t.label,message:e.a.FIELD_REQUIRED(t.label)};if(n==null)return null;let i=e=>({field:t.name,label:t.label,message:e(t.label)});switch(t.type){case`image`:case`mask`:if(typeof n!=`string`&&!h(n))return i(e.a.FIELD_STRING);break;case`images`:if(!Array.isArray(n)||n.length===0)return i(e.a.FIELD_ARRAY);if(n.some(e=>(typeof e!=`string`||e===``)&&!h(e)))return i(e.a.FIELD_ARRAY_ELEMENTS);break;case`text`:if(typeof n!=`string`)return i(e.a.FIELD_STRING);if(t.maxLength&&n.length>t.maxLength)return i(n=>e.a.FIELD_MAX_LENGTH(n,t.maxLength));break;case`enum`:if(typeof n!=`string`)return i(e.a.FIELD_STRING);if(t.options&&!t.options.some(e=>e.value===n))return i(e.a.FIELD_ENUM_INVALID);break;case`multiEnum`:if(!Array.isArray(n)||n.length===0)return i(e.a.FIELD_ARRAY);if(n.some(e=>typeof e!=`string`||e===``))return i(e.a.FIELD_ARRAY_ELEMENTS);if(t.options&&n.some(e=>!t.options?.some(t=>t.value===e)))return i(e.a.FIELD_ENUM_INVALID);break;case`color`:if(typeof n!=`string`||!/^#[0-9A-Fa-f]{6}$/.test(n))return i(e.a.FIELD_COLOR_FORMAT);break;case`number`:if(typeof n!=`number`||Number.isNaN(n))return i(e.a.FIELD_NUMBER);break;case`aspectRatio`:case`strength`:break}return null}function h(e){return typeof File<`u`&&e instanceof File}var g=class{constructor(t={}){this.type=``,this.submitEndpoint=`/task/submit`,this.submitEndpointMode=`prefix`,this.pollEndpoint=`/task/progress`,this.pollInterval=1e3,this.maxPollAttempts=120,this.phase=e.P.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this.activeTasks=new Map,this.pollTimer=null,this.isPollingBatch=!1,this.configure(t)}configure(e){e.type!==void 0&&(this.type=e.type),e.submitEndpoint!==void 0&&(this.submitEndpoint=e.submitEndpoint),e.submitEndpointMode!==void 0&&(this.submitEndpointMode=e.submitEndpointMode),e.pollEndpoint!==void 0&&(this.pollEndpoint=e.pollEndpoint),e.pollInterval!==void 0&&(this.pollInterval=e.pollInterval),e.maxPollAttempts!==void 0&&(this.maxPollAttempts=e.maxPollAttempts),e.customRequest!==void 0&&(this.customRequest=e.customRequest),e.customUploadRequest!==void 0&&(this.customUploadRequest=e.customUploadRequest),e.customUploadRequert!==void 0&&(this.customUploadRequest=e.customUploadRequert),e.onSubmit!==void 0&&(this.onSubmit=e.onSubmit),e.onPoll!==void 0&&(this.onPoll=e.onPoll),e.onSuccess!==void 0&&(this.onSuccess=e.onSuccess),e.onError!==void 0&&(this.onError=e.onError)}get typeDef(){let e=this.resolvedTaskTypeKey;return e?d(e):void 0}get taskFields(){return this.typeDef?.fields??[]}async submit(t,n){let r=this.createRequestUri(t);if(!r){this.fail(e.a.MISSING_ENDPOINT,e.P.IDLE);return}let i=this.getTaskFields(t);if(i.length>0){let t=p(n,i);if(!t.valid){this.fail(t.errors.map(e=>e.message).join(`; `),e.P.IDLE);return}}this.phase=e.P.SUBMITTING,this.error=``,this.progress=0,this.result=null;try{let e=await this.resolveUploads(n,i),t=(await this.request(r,{method:`POST`,body:JSON.stringify(e),headers:{"Content-Type":`application/json`}})).data.taskId;this.taskId=t;let a={taskId:t,endpoint:r,formData:e};this.onSubmit?.(a),await this.trackTask(t)}catch(t){this.fail(t instanceof Error?t.message:e.a.SUBMIT_FAILED,this.phase)}}reset(){this.phase=e.P.IDLE,this.taskId=``,this.progress=0,this.result=null,this.error=``,this.activeTasks.clear(),this.pollTimer&&=(clearTimeout(this.pollTimer),null)}createRequestUri(e=this.type){return this.submitEndpointMode===`full`?this.submitEndpoint:e?`${this.submitEndpoint}/${e}`:this.submitEndpoint}get resolvedTaskTypeKey(){return _(this.type)}getTaskFields(e){let t=_(e);return t?d(t)?.fields??[]:[]}async resolveUploads(e,t){let n=t.length>0?t.filter(e=>e.type===`image`||e.type===`mask`||e.type===`images`):Object.keys(e).map(e=>({name:e,type:`image`}));if(!n.length)return e;let r={...e};for(let e of n){let t=r[e.name];Array.isArray(t)?r[e.name]=await Promise.all(t.map(t=>this.resolveUploadValue(t,e))):r[e.name]=await this.resolveUploadValue(t,e)}return r}async resolveUploadValue(e,t){if(!v(e))return e;if(!this.customUploadRequest)throw Error(`customUploadRequest is required to upload ${t.name}`);let n=new FormData;return n.append(t.name||`file`,e),y(await this.customUploadRequest({file:e,name:t.name,formData:n,field:t}))}trackTask(t){this.phase=e.P.POLLING;let n=new Promise(e=>{this.activeTasks.set(t,{taskId:t,attempts:0,resolve:e})});return this.ensurePolling(0),n}ensurePolling(e=this.pollInterval){this.pollTimer||this.isPollingBatch||!this.activeTasks.size||(this.pollTimer=setTimeout(()=>{this.pollTimer=null,this.pollActiveTasks()},this.pollInterval))}async pollActiveTasks(){if(!this.activeTasks.size)return;this.isPollingBatch=!0;let t=[...this.activeTasks.keys()];try{let n=`${this.pollEndpoint}?taskIds=${t.map(encodeURIComponent).join(`,`)}`,r=await this.request(n,{method:`GET`}),i=new Map(r.data.map(e=>[e.aiTaskId,e]));t.forEach(t=>{let n=this.activeTasks.get(t);if(!n)return;n.attempts+=1;let r=i.get(t);if(!r){this.failTask(n,e.a.TASK_NOT_FOUND(t));return}this.taskId=t,this.progress=r.taskProgress;let a={taskId:t,progress:r.taskProgress,status:r.aiTaskStatus,queuePos:r.queuePos};if(this.onPoll?.(a),r.aiTaskStatus===`done`){this.result=r;let e={taskId:t,images:r.imgInfo?[{index:0,url:r.imgInfo}]:[],result:r};this.onSuccess?.(e),this.completeTask(n);return}n.attempts>=this.maxPollAttempts&&this.failTask(n,e.a.POLL_TIMEOUT(t))})}catch(t){let n=t instanceof Error?t.message:e.a.POLL_FAILED;[...this.activeTasks.values()].forEach(e=>this.failTask(e,n))}finally{this.isPollingBatch=!1,this.activeTasks.size?(this.phase=e.P.POLLING,this.ensurePolling(this.pollInterval)):this.phase===e.P.POLLING&&(this.phase=this.error?e.P.ERROR:e.P.SUCCESS)}}completeTask(e){this.activeTasks.delete(e.taskId),e.resolve()}failTask(t,n){this.activeTasks.delete(t.taskId),this.fail(n,e.P.POLLING,t.taskId),t.resolve()}async request(e,t){let n=await(this.customRequest??fetch)(e,t);return n&&typeof n.json==`function`?n.json():n}fail(t,n,r){this.phase=e.P.ERROR,this.error=t;let i={message:t,phase:n,taskId:r};this.onError?.(i)}};function _(e){if(!e)return``;if(u[e])return e;let t=e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/[-\s]+/g,`_`).toUpperCase();return u[t]?t:``}function v(e){return typeof File<`u`&&e instanceof File}async function y(e){return e?typeof e==`string`?e:e instanceof Response?y(await e.json()):typeof e.data==`string`?e.data:e.data?e.data.value||e.data.url||``:e.value||e.url||``:``}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return o}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, O as r, P as i, S as a, T as o, _ as s, a as c, b as l, f as u, g as d, h as f, k as p, l as m, m as h, p as g, u as _, v, w as y, x as b, y as x } from "./constants-
|
|
1
|
+
import { C as e, D as t, E as n, O as r, P as i, S as a, T as o, _ as s, a as c, b as l, f as u, g as d, h as f, k as p, l as m, m as h, p as g, u as _, v, w as y, x as b, y as x } from "./constants-CdudjmSn.js";
|
|
2
2
|
//#region src/core/types.ts
|
|
3
3
|
var S = {
|
|
4
4
|
RUNNING: "running",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`https://api.lightchainai.com`,t=`client-secret`,n=`/task/progress`,r=`/task/submit`,i={BAD_REQUEST:400,UNAUTHORIZED:401,RATE_LIMIT:429,SERVER_ERROR:500},a={GENERATE_PRINTING:`GeneratePrinting`,VIRTUAL_FITTING:`VirtualFitting`,FIX_FACE:`FixFace`,CHANGE_FACE:`ChangeFace`,MULTI_PERSPECTIVE:`MultiPerspective`,PRINTING_TILING:`PrintingTiling`,CHANGE_DESIGN_POINT:`ChangeDesignPoint`,CHANGE_COLOR:`ChangeColor`,CHANGE_FABRIC:`ChangeFabric`,SR:`Sr`,VECTOR_CONVERT:`VectorConvert`,CHANGE_MODEL:`ChangeModel`,GENERATE_SKETCH:`GenerateSketch`,MODEL_GENERATE_SKETCH:`ModelGenerateSketch`,ELIMINATE:`Eliminate`,EXPAND_IMAGE:`ExpandImage`,CLOTHING_DESIGN:`ClothingDesign`,CHANGE_PATTERN:`ChangePattern`,GENERATE_MODEL:`GenerateModel`,MODIFY_PRINTING:`ModifyPrinting`,CUT_OUT:`CutOut`,LINE_ART_TO_REAL:`LineArtToReal`,FIX_PARTIAL:`FixPartial`,DETAIL_COMPENSATION:`DetailCompensation`,CHANGE_CLOTHES_BY_IMG:`ChangeClothesByImg`,CHANGE_ACCESSORIES_BY_IMG:`ChangeAccessoriesByImg`,VIRTUAL_FITTING_REFERENCE:`VirtualFittingReference`,VIRTUAL_FITTING_TEMPLATE:`VirtualFittingTemplate`,FIX_DEFORMITIES:`FixDeformities`,INTELLIGENT_CROPPING:`IntelligentCropping`,MODEL_TO_FLAT:`ModelToFlat`,GENERATE_SHORT_VIDEO:`GenerateShortVideo`,ONE_CLICK_MODIFY_PRINTING:`OneClickModifyPrinting`,ORIENTATION_DESIGN:`OrientationDesign`,DIRECTIONAL_INTEGRATION:`DirectionalIntegration`,ONE_CLICK_INTEGRATION:`OneClickIntegration`,CHANGE_FABRIC_V2:`ChangeFabricV2`,VIRTUAL_FITTING_REFERENCE_V2:`VirtualFittingReferenceV2`,FLOWER_SHAPED_DESIGN:`FlowerShapedDesign`,FLOWER_SHAPED_VIRTUAL_PRINTING:`FlowerShapedVirtualPrinting`,ONE_CLICK_CHANGE_COLOR:`OneClickChangeColor`,FITTING_MODEL_WITH_LABELS:`FittingModelWithLabels`,FITTING_MODEL_CUSTOM:`FittingModelCustom`,FITTING_MODEL_CHANGE_FACE:`FittingModelChangeFace`,FITTING_MODEL_CHANGE_MODEL:`FittingModelChangeModel`,FITTING_MODEL_CHANGE_BODY_SHAPE:`FittingModelChangeBodyShape`,FITTING_MODEL_CHANGE_CLOTHING_SIZE:`FittingModelChangeClothingSize`,FITTING_MODEL_CHANGE_POSTURE:`FittingModelChangePosture`,FITTING_MODEL_CHANGE_BACKGROUND:`FittingModelChangeBackground`,FITTING_MODEL_CHANGE_PERSPECTIVE:`FittingModelChangePerspective`,TRAIN_CLOTHING_MODEL:`TrainClothingModel`},o={IMAGE:`image`,MASK:`mask`,IMAGES:`images`,TEXT:`text`,ENUM:`enum`,MULTI_ENUM:`multiEnum`,ASPECT_RATIO:`aspectRatio`,COLOR:`color`,STRENGTH:`strength`,NUMBER:`number`},s={IDLE:`idle`,SUBMITTING:`submitting`,POLLING:`polling`,SUCCESS:`success`,ERROR:`error`},c={POLL_INTERVAL:1e3,MAX_POLL_ATTEMPTS:120,POLL_ENDPOINT:`/task/progress`},l={CHANGE:`change`,SUBMIT:`submit`,REQUEST_SUBMIT:`lc-request-submit`,POLL:`poll`,SUCCESS:`success`,ERROR:`error`,IMAGE_CLICK:`image-click`,COMPARE:`compare`},u={MISSING_ENDPOINT:`未指定提交端点或任务类型`,POLL_TIMEOUT:e=>`轮询超时: ${e}`,POLL_FAILED:`轮询失败`,TASK_NOT_FOUND:e=>`未找到任务: ${e}`,SUBMIT_FAILED:`提交失败`,FIELD_REQUIRED:e=>`${e}为必填项`,FIELD_STRING:e=>`${e}必须为字符串`,FIELD_ARRAY:e=>`${e}必须为非空数组`,FIELD_ARRAY_ELEMENTS:e=>`${e}数组元素必须为非空字符串`,FIELD_MAX_LENGTH:(e,t)=>`${e}不能超过${t}个字符`,FIELD_ENUM_INVALID:e=>`${e}值不在可选项中`,FIELD_COLOR_FORMAT:e=>`${e}必须为#RRGGBB格式`,FIELD_NUMBER:e=>`${e}必须为数字`},d={IMAGE:[`image/jpeg`,`image/png`,`image/webp`]},f={MAX_IMAGE_SIZE:10*1024*1024},p=[{label:`1:1`,value:`1:1`},{label:`2:3`,value:`2:3`},{label:`3:4`,value:`3:4`},{label:`3:2`,value:`3:2`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],m=[{label:`正面`,value:`front`},{label:`背面`,value:`back`},{label:`左侧`,value:`left`},{label:`右侧`,value:`right`}],h=[{label:`2倍`,value:`2`},{label:`3倍`,value:`3`},{label:`4倍`,value:`4`}],g=[{label:`线稿`,value:`line`},{label:`印花`,value:`printing`}],_=[{label:`女`,value:`female`},{label:`男`,value:`male`}],v=[{label:`青年`,value:`young`},{label:`中年`,value:`middle`}],y=[{label:`亚洲`,value:`asian`},{label:`欧洲`,value:`european`},{label:`非洲`,value:`african`}],b=[{label:`上装`,value:`upper`},{label:`下装`,value:`lower`},{label:`连身装`,value:`dress`}],x=[{label:`袖型`,value:`sleeve`},{label:`领型`,value:`collar`},{label:`裤型`,value:`pants`},{label:`裙型`,value:`skirt`}],S=[{label:`全身`,value:`full`},{label:`半身`,value:`half`},{label:`服装`,value:`clothing`}],C=[{label:`黑白线稿`,value:`bw`},{label:`彩色线稿`,value:`color`}],w=[{label:`背包`,value:`bag`},{label:`鞋子`,value:`shoes`},{label:`首饰`,value:`jewelry`},{label:`腰带`,value:`belt`},{label:`帽子`,value:`hat`}],T=[{label:`棚内瑜伽`,value:`yoga`},{label:`极简棚拍`,value:`minimal`}],E=[{label:`自定义像素`,value:`1`},{label:`比例裁剪`,value:`2`}],D=[{label:`3秒`,value:`3`},{label:`5秒`,value:`5`}],O=[{label:`是`,value:`true`},{label:`否`,value:`false`}],k=[{label:`中国`,value:`china`},{label:`美国`,value:`usa`},{label:`英国`,value:`uk`},{label:`法国`,value:`france`},{label:`德国`,value:`germany`},{label:`意大利`,value:`italy`},{label:`西班牙`,value:`spain`},{label:`俄罗斯`,value:`russia`},{label:`日本`,value:`japan`},{label:`韩国`,value:`korea`},{label:`泰国`,value:`thailand`},{label:`印度`,value:`india`},{label:`越南`,value:`vietnam`},{label:`其他`,value:`other`}],A=[{label:`白皙`,value:`fair`},{label:`中等`,value:`medium`},{label:`小麦色`,value:`wheatish`},{label:`深色`,value:`dark`},{label:`其他`,value:`other`}],j=[{label:`偏瘦`,value:`slim`},{label:`标准`,value:`standard`},{label:`微胖`,value:`chubby`},{label:`肥胖`,value:`fat`}],M=[{label:`一致`,value:`same`},{label:`相似`,value:`similar`}],N=[{label:`偏小`,value:`smaller`},{label:`偏大`,value:`larger`}];Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return g}});
|
package/dist/contants.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./client-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./client-CJ8X0sFi.cjs`),t=require(`./constants-Bdlwi9VJ.cjs`);require(`./core-D0DpSeAr.cjs`),exports.ACCEPTED_FILE_TYPES=t.t,exports.API_BASE_URL=t.n,exports.ASPECT_RATIOS=e.d,exports.AUTH_HEADER_KEY=t.r,exports.CallbackStatus=e.f,exports.ERROR_CODES=t.i,exports.ERROR_MESSAGES=t.a,exports.EVENT_NAMES=t.o,exports.FIELD_TYPES=t.s,exports.FILE_SIZE_LIMITS=t.c,exports.IMAGE_LIMITS=e.p,exports.TASK_PROGRESS_PATH=t.A,exports.TASK_SUBMIT_PREFIX=t.j,exports.TASK_TYPES=e.r,exports.TASK_TYPES_PART_A=e.s,exports.TASK_TYPES_PART_B=e.o,exports.TASK_WORKFLOW_TYPES=t.M,exports.TaskStatus=e.m,exports.WORKFLOW_DEFAULTS=t.N,exports.WORKFLOW_PHASES=t.P,exports.getAllTaskTypes=e.i,exports.getTaskTypeDef=e.a;
|
package/dist/contants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, d as t, f as n, i as r, m as i, o as a, p as o, r as s, s as c } from "./client-
|
|
2
|
-
import { A as l, M as u, N as d, P as f, a as p, c as m, i as h, j as g, n as _, o as v, r as y, s as b, t as x } from "./constants-
|
|
3
|
-
import "./core-
|
|
1
|
+
import { a as e, d as t, f as n, i as r, m as i, o as a, p as o, r as s, s as c } from "./client-jorIw6pH.js";
|
|
2
|
+
import { A as l, M as u, N as d, P as f, a as p, c as m, i as h, j as g, n as _, o as v, r as y, s as b, t as x } from "./constants-CdudjmSn.js";
|
|
3
|
+
import "./core-rH2gpxTB.js";
|
|
4
4
|
export { x as ACCEPTED_FILE_TYPES, _ as API_BASE_URL, t as ASPECT_RATIOS, y as AUTH_HEADER_KEY, n as CallbackStatus, h as ERROR_CODES, p as ERROR_MESSAGES, v as EVENT_NAMES, b as FIELD_TYPES, m as FILE_SIZE_LIMITS, o as IMAGE_LIMITS, l as TASK_PROGRESS_PATH, g as TASK_SUBMIT_PREFIX, s as TASK_TYPES, c as TASK_TYPES_PART_A, a as TASK_TYPES_PART_B, u as TASK_WORKFLOW_TYPES, i as TaskStatus, d as WORKFLOW_DEFAULTS, f as WORKFLOW_PHASES, r as getAllTaskTypes, e as getTaskTypeDef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./client-CJ8X0sFi.cjs`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./client-jorIw6pH.js";
|
package/dist/lightchain-ui.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./button-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./button-hUFCfzUP.cjs`),t=require(`./client-CJ8X0sFi.cjs`),n=require(`./constants-Bdlwi9VJ.cjs`);require(`./core-D0DpSeAr.cjs`),e.f();function r(){}exports.ACCEPTED_FILE_TYPES=n.t,exports.API_BASE_URL=n.n,exports.ASPECT_RATIOS=t.d,exports.AUTH_HEADER_KEY=n.r,exports.CallbackStatus=t.f,exports.ERROR_CODES=n.i,exports.ERROR_MESSAGES=n.a,exports.EVENT_NAMES=n.o,exports.FIELD_TYPES=n.s,exports.FILE_SIZE_LIMITS=n.c,exports.IMAGE_LIMITS=t.p,Object.defineProperty(exports,`LcButton`,{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,`LcColorPicker`,{enumerable:!0,get:function(){return e.s}}),Object.defineProperty(exports,`LcEnumSelector`,{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(exports,`LcImageCompareSlider`,{enumerable:!0,get:function(){return e.r}}),Object.defineProperty(exports,`LcImageUploader`,{enumerable:!0,get:function(){return e.d}}),Object.defineProperty(exports,`LcMaskEditor`,{enumerable:!0,get:function(){return e.u}}),Object.defineProperty(exports,`LcPromptInput`,{enumerable:!0,get:function(){return e.c}}),Object.defineProperty(exports,`LcResultGallery`,{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(exports,`LcStrengthSlider`,{enumerable:!0,get:function(){return e.o}}),Object.defineProperty(exports,`LcTaskProgressCard`,{enumerable:!0,get:function(){return e.a}}),Object.defineProperty(exports,`LcTaskWorkflow`,{enumerable:!0,get:function(){return e.n}}),exports.LightChainClient=t.t,exports.OPTIONS_ACCESSORY_TYPE=n.l,exports.OPTIONS_AGE=n.u,exports.OPTIONS_ASPECT_RATIO=n.d,exports.OPTIONS_BODY_SHAPE=n.f,exports.OPTIONS_CROP_MODE=n.p,exports.OPTIONS_DETAIL_LIST=n.m,exports.OPTIONS_DURATION=n.h,exports.OPTIONS_GENDER=n.g,exports.OPTIONS_IMAGE_TYPE=n._,exports.OPTIONS_NATIONALITY=n.v,exports.OPTIONS_PATTERN_TYPE=n.y,exports.OPTIONS_PERSPECTIVE=n.b,exports.OPTIONS_POSITION=n.x,exports.OPTIONS_RACE=n.S,exports.OPTIONS_RECOGNITION_TYPE=n.C,exports.OPTIONS_REMOVE_PATTERN=n.w,exports.OPTIONS_SCALE=n.T,exports.OPTIONS_SIMILARITY=n.E,exports.OPTIONS_SIZE=n.D,exports.OPTIONS_SKIN_COLOR=n.O,exports.OPTIONS_TEMPLATE_ID=n.k,exports.TASK_PROGRESS_PATH=n.A,exports.TASK_SUBMIT_PREFIX=n.j,exports.TASK_TYPES=t.r,exports.TASK_TYPES_PART_A=t.s,exports.TASK_TYPES_PART_B=t.o,exports.TASK_WORKFLOW_TYPES=n.M,exports.TaskStatus=t.m,exports.WORKFLOW_DEFAULTS=n.N,exports.WORKFLOW_PHASES=n.P,exports.getAllTaskTypes=t.i,exports.getTaskTypeDef=t.a,exports.registerAllComponents=r,exports.validateFormData=t.n,exports.validateImage=t.c,exports.validateImageFile=t.l,exports.validateMask=t.u;
|
package/dist/lightchain-ui.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./button-
|
|
2
|
-
import { a as f, c as p, d as m, f as h, i as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T } from "./client-
|
|
3
|
-
import { A as E, C as D, D as O, E as k, M as A, N as j, O as M, P as N, S as P, T as F, _ as I, a as L, b as R, c as z, d as B, f as V, g as H, h as U, i as W, j as G, k as K, l as q, m as J, n as Y, o as X, p as Z, r as Q, s as $, t as ee, u as te, v as ne, w as re, x as ie, y as ae } from "./constants-
|
|
4
|
-
import "./core-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./button-KoRq6mAW.js";
|
|
2
|
+
import { a as f, c as p, d as m, f as h, i as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T } from "./client-jorIw6pH.js";
|
|
3
|
+
import { A as E, C as D, D as O, E as k, M as A, N as j, O as M, P as N, S as P, T as F, _ as I, a as L, b as R, c as z, d as B, f as V, g as H, h as U, i as W, j as G, k as K, l as q, m as J, n as Y, o as X, p as Z, r as Q, s as $, t as ee, u as te, v as ne, w as re, x as ie, y as ae } from "./constants-CdudjmSn.js";
|
|
4
|
+
import "./core-rH2gpxTB.js";
|
|
5
5
|
//#region src/index.ts
|
|
6
6
|
r();
|
|
7
7
|
function oe() {}
|
package/dist/options.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./constants-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./constants-Bdlwi9VJ.cjs`);exports.OPTIONS_ACCESSORY_TYPE=e.l,exports.OPTIONS_AGE=e.u,exports.OPTIONS_ASPECT_RATIO=e.d,exports.OPTIONS_BODY_SHAPE=e.f,exports.OPTIONS_CROP_MODE=e.p,exports.OPTIONS_DETAIL_LIST=e.m,exports.OPTIONS_DURATION=e.h,exports.OPTIONS_GENDER=e.g,exports.OPTIONS_IMAGE_TYPE=e._,exports.OPTIONS_NATIONALITY=e.v,exports.OPTIONS_PATTERN_TYPE=e.y,exports.OPTIONS_PERSPECTIVE=e.b,exports.OPTIONS_POSITION=e.x,exports.OPTIONS_RACE=e.S,exports.OPTIONS_RECOGNITION_TYPE=e.C,exports.OPTIONS_REMOVE_PATTERN=e.w,exports.OPTIONS_SCALE=e.T,exports.OPTIONS_SIMILARITY=e.E,exports.OPTIONS_SIZE=e.D,exports.OPTIONS_SKIN_COLOR=e.O,exports.OPTIONS_TEMPLATE_ID=e.k;
|
package/dist/options.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, b as s, d as c, f as l, g as u, h as d, k as f, l as p, m, p as h, u as g, v as _, w as v, x as y, y as b } from "./constants-
|
|
1
|
+
import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, b as s, d as c, f as l, g as u, h as d, k as f, l as p, m, p as h, u as g, v as _, w as v, x as y, y as b } from "./constants-CdudjmSn.js";
|
|
2
2
|
export { p as OPTIONS_ACCESSORY_TYPE, g as OPTIONS_AGE, c as OPTIONS_ASPECT_RATIO, l as OPTIONS_BODY_SHAPE, h as OPTIONS_CROP_MODE, m as OPTIONS_DETAIL_LIST, d as OPTIONS_DURATION, u as OPTIONS_GENDER, o as OPTIONS_IMAGE_TYPE, _ as OPTIONS_NATIONALITY, b as OPTIONS_PATTERN_TYPE, s as OPTIONS_PERSPECTIVE, y as OPTIONS_POSITION, i as OPTIONS_RACE, e as OPTIONS_RECOGNITION_TYPE, v as OPTIONS_REMOVE_PATTERN, a as OPTIONS_SCALE, n as OPTIONS_SIMILARITY, t as OPTIONS_SIZE, r as OPTIONS_SKIN_COLOR, f as OPTIONS_TEMPLATE_ID };
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./button-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./button-hUFCfzUP.cjs`),l=require(`./constants-Bdlwi9VJ.cjs`);let u=require(`@lit/react`),d=require(`react`);d=s(d,1);var f=l.o;c.f();var p=(0,u.createComponent)({react:d.default,tagName:`lc-image-uploader`,elementClass:c.d,events:{onChange:f.CHANGE}}),m=(0,u.createComponent)({react:d.default,tagName:`lc-mask-editor`,elementClass:c.u,events:{onChange:f.CHANGE}}),h=(0,u.createComponent)({react:d.default,tagName:`lc-enum-selector`,elementClass:c.l,events:{onChange:f.CHANGE}}),g=(0,u.createComponent)({react:d.default,tagName:`lc-prompt-input`,elementClass:c.c,events:{onChange:f.CHANGE}}),_=(0,u.createComponent)({react:d.default,tagName:`lc-color-picker`,elementClass:c.s,events:{onChange:f.CHANGE}}),v=(0,u.createComponent)({react:d.default,tagName:`lc-strength-slider`,elementClass:c.o,events:{onChange:f.CHANGE}}),y=(0,u.createComponent)({react:d.default,tagName:`lc-task-progress-card`,elementClass:c.a,events:{}}),b=(0,u.createComponent)({react:d.default,tagName:`lc-result-gallery`,elementClass:c.i,events:{onImageClick:f.IMAGE_CLICK,onCompare:f.COMPARE}}),x=(0,u.createComponent)({react:d.default,tagName:`lc-image-compare-slider`,elementClass:c.r,events:{}});function S(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function C(e,t,n){d.default.useLayoutEffect(()=>{let r=e.current;if(!(!r||!n))return r.addEventListener(t,n),()=>r.removeEventListener(t,n)},[t,n,e])}function w(e,t){e.type=t.type??``,t.submitEndpoint!==void 0&&(e.submitEndpoint=t.submitEndpoint),t.pollEndpoint!==void 0&&(e.pollEndpoint=t.pollEndpoint),t.pollInterval!==void 0&&(e.pollInterval=t.pollInterval),t.maxPollAttempts!==void 0&&(e.maxPollAttempts=t.maxPollAttempts),e.client=t.client,e.customRequest=t.customRequest,e.customUploadRequest=t.customUploadRequest}var T=d.default.forwardRef((e,t)=>{let{children:n,className:r,type:i,submitEndpoint:a,pollEndpoint:o,pollInterval:s,maxPollAttempts:c,client:l,customRequest:u,customUploadRequest:p,onSubmit:m,onPoll:h,onPolling:g,onSuccess:_,onError:v,...y}=e,b=d.default.useRef(null),x={type:i,submitEndpoint:a,pollEndpoint:o,pollInterval:s,maxPollAttempts:c,client:l,customRequest:u,customUploadRequest:p},T=d.default.useCallback(e=>{b.current=e,e&&w(e,x),S(t,e)},[t,i,a,o,s,c,l,u,p]);return d.default.useLayoutEffect(()=>{b.current&&w(b.current,x)},[i,a,o,s,c,l,u,p]),C(b,f.SUBMIT,m),C(b,f.POLL,h),C(b,f.POLL,g),C(b,f.SUCCESS,_),C(b,f.ERROR,v),d.default.createElement(`lc-task-workflow`,{...y,class:r,ref:T,suppressHydrationWarning:!0},n)});T.displayName=`LcTaskWorkflowReact`;function E(e,t){e.type=t.type??`button`,e.variant=t.variant??`primary`,e.disabled=!!t.disabled}var D=d.default.forwardRef((e,t)=>{let{children:n,className:r,type:i,variant:a,disabled:o,...s}=e,c=d.default.useRef(null),l={type:i,variant:a,disabled:o},u=d.default.useCallback(e=>{c.current=e,e&&E(e,l),S(t,e)},[t,i,a,o]);return d.default.useLayoutEffect(()=>{c.current&&E(c.current,l)},[i,a,o]),d.default.createElement(`lc-button`,{...s,class:r,ref:u,suppressHydrationWarning:!0},n)});D.displayName=`LcButtonReact`,exports.LcButtonReact=D,exports.LcColorPickerReact=_,exports.LcEnumSelectorReact=h,exports.LcImageCompareSliderReact=x,exports.LcImageUploaderReact=p,exports.LcMaskEditorReact=m,exports.LcPromptInputReact=g,exports.LcResultGalleryReact=b,exports.LcStrengthSliderReact=v,exports.LcTaskProgressCardReact=y,exports.LcTaskWorkflowReact=T,exports.t=s;
|
package/dist/react.mjs
CHANGED
|
@@ -1,74 +1,146 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a,
|
|
2
|
-
import { o as
|
|
3
|
-
import { createComponent as
|
|
4
|
-
import
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, o, r as s, s as c, u as l } from "./button-KoRq6mAW.js";
|
|
2
|
+
import { o as u } from "./constants-CdudjmSn.js";
|
|
3
|
+
import { createComponent as d } from "@lit/react";
|
|
4
|
+
import f from "react";
|
|
5
5
|
//#region src/react/index.ts
|
|
6
|
-
var
|
|
6
|
+
var p = u;
|
|
7
7
|
r();
|
|
8
|
-
var
|
|
9
|
-
react:
|
|
8
|
+
var m = d({
|
|
9
|
+
react: f,
|
|
10
10
|
tagName: "lc-image-uploader",
|
|
11
11
|
elementClass: n,
|
|
12
|
-
events: { onChange:
|
|
13
|
-
}),
|
|
14
|
-
react:
|
|
12
|
+
events: { onChange: p.CHANGE }
|
|
13
|
+
}), h = d({
|
|
14
|
+
react: f,
|
|
15
15
|
tagName: "lc-mask-editor",
|
|
16
|
-
elementClass:
|
|
17
|
-
events: { onChange:
|
|
18
|
-
}),
|
|
19
|
-
react:
|
|
16
|
+
elementClass: l,
|
|
17
|
+
events: { onChange: p.CHANGE }
|
|
18
|
+
}), g = d({
|
|
19
|
+
react: f,
|
|
20
20
|
tagName: "lc-enum-selector",
|
|
21
21
|
elementClass: a,
|
|
22
|
-
events: { onChange:
|
|
23
|
-
}),
|
|
24
|
-
react:
|
|
22
|
+
events: { onChange: p.CHANGE }
|
|
23
|
+
}), _ = d({
|
|
24
|
+
react: f,
|
|
25
25
|
tagName: "lc-prompt-input",
|
|
26
26
|
elementClass: t,
|
|
27
|
-
events: { onChange:
|
|
28
|
-
}),
|
|
29
|
-
react:
|
|
27
|
+
events: { onChange: p.CHANGE }
|
|
28
|
+
}), v = d({
|
|
29
|
+
react: f,
|
|
30
30
|
tagName: "lc-color-picker",
|
|
31
|
-
elementClass:
|
|
32
|
-
events: { onChange:
|
|
33
|
-
}),
|
|
34
|
-
react:
|
|
31
|
+
elementClass: c,
|
|
32
|
+
events: { onChange: p.CHANGE }
|
|
33
|
+
}), y = d({
|
|
34
|
+
react: f,
|
|
35
35
|
tagName: "lc-strength-slider",
|
|
36
|
-
elementClass:
|
|
37
|
-
events: { onChange:
|
|
38
|
-
}),
|
|
39
|
-
react:
|
|
36
|
+
elementClass: o,
|
|
37
|
+
events: { onChange: p.CHANGE }
|
|
38
|
+
}), b = d({
|
|
39
|
+
react: f,
|
|
40
40
|
tagName: "lc-task-progress-card",
|
|
41
41
|
elementClass: e,
|
|
42
42
|
events: {}
|
|
43
|
-
}),
|
|
44
|
-
react:
|
|
43
|
+
}), x = d({
|
|
44
|
+
react: f,
|
|
45
45
|
tagName: "lc-result-gallery",
|
|
46
46
|
elementClass: i,
|
|
47
47
|
events: {
|
|
48
|
-
onImageClick:
|
|
49
|
-
onCompare:
|
|
48
|
+
onImageClick: p.IMAGE_CLICK,
|
|
49
|
+
onCompare: p.COMPARE
|
|
50
50
|
}
|
|
51
|
-
}),
|
|
52
|
-
react:
|
|
51
|
+
}), S = d({
|
|
52
|
+
react: f,
|
|
53
53
|
tagName: "lc-image-compare-slider",
|
|
54
|
-
elementClass:
|
|
55
|
-
events: {}
|
|
56
|
-
}), T = p({
|
|
57
|
-
react: m,
|
|
58
|
-
tagName: "lc-task-workflow",
|
|
59
|
-
elementClass: o,
|
|
60
|
-
events: {
|
|
61
|
-
onSubmit: h.SUBMIT,
|
|
62
|
-
onPoll: h.POLL,
|
|
63
|
-
onPolling: h.POLL,
|
|
64
|
-
onSuccess: h.SUCCESS,
|
|
65
|
-
onError: h.ERROR
|
|
66
|
-
}
|
|
67
|
-
}), E = p({
|
|
68
|
-
react: m,
|
|
69
|
-
tagName: "lc-button",
|
|
70
|
-
elementClass: u,
|
|
54
|
+
elementClass: s,
|
|
71
55
|
events: {}
|
|
72
56
|
});
|
|
57
|
+
function C(e, t) {
|
|
58
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
59
|
+
}
|
|
60
|
+
function w(e, t, n) {
|
|
61
|
+
f.useLayoutEffect(() => {
|
|
62
|
+
let r = e.current;
|
|
63
|
+
if (!(!r || !n)) return r.addEventListener(t, n), () => r.removeEventListener(t, n);
|
|
64
|
+
}, [
|
|
65
|
+
t,
|
|
66
|
+
n,
|
|
67
|
+
e
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
function T(e, t) {
|
|
71
|
+
e.type = t.type ?? "", t.submitEndpoint !== void 0 && (e.submitEndpoint = t.submitEndpoint), t.pollEndpoint !== void 0 && (e.pollEndpoint = t.pollEndpoint), t.pollInterval !== void 0 && (e.pollInterval = t.pollInterval), t.maxPollAttempts !== void 0 && (e.maxPollAttempts = t.maxPollAttempts), e.client = t.client, e.customRequest = t.customRequest, e.customUploadRequest = t.customUploadRequest;
|
|
72
|
+
}
|
|
73
|
+
var E = f.forwardRef((e, t) => {
|
|
74
|
+
let { children: n, className: r, type: i, submitEndpoint: a, pollEndpoint: o, pollInterval: s, maxPollAttempts: c, client: l, customRequest: u, customUploadRequest: d, onSubmit: m, onPoll: h, onPolling: g, onSuccess: _, onError: v, ...y } = e, b = f.useRef(null), x = {
|
|
75
|
+
type: i,
|
|
76
|
+
submitEndpoint: a,
|
|
77
|
+
pollEndpoint: o,
|
|
78
|
+
pollInterval: s,
|
|
79
|
+
maxPollAttempts: c,
|
|
80
|
+
client: l,
|
|
81
|
+
customRequest: u,
|
|
82
|
+
customUploadRequest: d
|
|
83
|
+
}, S = f.useCallback((e) => {
|
|
84
|
+
b.current = e, e && T(e, x), C(t, e);
|
|
85
|
+
}, [
|
|
86
|
+
t,
|
|
87
|
+
i,
|
|
88
|
+
a,
|
|
89
|
+
o,
|
|
90
|
+
s,
|
|
91
|
+
c,
|
|
92
|
+
l,
|
|
93
|
+
u,
|
|
94
|
+
d
|
|
95
|
+
]);
|
|
96
|
+
return f.useLayoutEffect(() => {
|
|
97
|
+
b.current && T(b.current, x);
|
|
98
|
+
}, [
|
|
99
|
+
i,
|
|
100
|
+
a,
|
|
101
|
+
o,
|
|
102
|
+
s,
|
|
103
|
+
c,
|
|
104
|
+
l,
|
|
105
|
+
u,
|
|
106
|
+
d
|
|
107
|
+
]), w(b, p.SUBMIT, m), w(b, p.POLL, h), w(b, p.POLL, g), w(b, p.SUCCESS, _), w(b, p.ERROR, v), f.createElement("lc-task-workflow", {
|
|
108
|
+
...y,
|
|
109
|
+
class: r,
|
|
110
|
+
ref: S,
|
|
111
|
+
suppressHydrationWarning: !0
|
|
112
|
+
}, n);
|
|
113
|
+
});
|
|
114
|
+
E.displayName = "LcTaskWorkflowReact";
|
|
115
|
+
function D(e, t) {
|
|
116
|
+
e.type = t.type ?? "button", e.variant = t.variant ?? "primary", e.disabled = !!t.disabled;
|
|
117
|
+
}
|
|
118
|
+
var O = f.forwardRef((e, t) => {
|
|
119
|
+
let { children: n, className: r, type: i, variant: a, disabled: o, ...s } = e, c = f.useRef(null), l = {
|
|
120
|
+
type: i,
|
|
121
|
+
variant: a,
|
|
122
|
+
disabled: o
|
|
123
|
+
}, u = f.useCallback((e) => {
|
|
124
|
+
c.current = e, e && D(e, l), C(t, e);
|
|
125
|
+
}, [
|
|
126
|
+
t,
|
|
127
|
+
i,
|
|
128
|
+
a,
|
|
129
|
+
o
|
|
130
|
+
]);
|
|
131
|
+
return f.useLayoutEffect(() => {
|
|
132
|
+
c.current && D(c.current, l);
|
|
133
|
+
}, [
|
|
134
|
+
i,
|
|
135
|
+
a,
|
|
136
|
+
o
|
|
137
|
+
]), f.createElement("lc-button", {
|
|
138
|
+
...s,
|
|
139
|
+
class: r,
|
|
140
|
+
ref: u,
|
|
141
|
+
suppressHydrationWarning: !0
|
|
142
|
+
}, n);
|
|
143
|
+
});
|
|
144
|
+
O.displayName = "LcButtonReact";
|
|
73
145
|
//#endregion
|
|
74
|
-
export {
|
|
146
|
+
export { O as LcButtonReact, v as LcColorPickerReact, g as LcEnumSelectorReact, S as LcImageCompareSliderReact, m as LcImageUploaderReact, h as LcMaskEditorReact, _ as LcPromptInputReact, x as LcResultGalleryReact, y as LcStrengthSliderReact, b as LcTaskProgressCardReact, E as LcTaskWorkflowReact };
|
|
@@ -34,11 +34,14 @@ export declare class LcTaskWorkflow extends LitElement {
|
|
|
34
34
|
result: TaskProgressResult | null;
|
|
35
35
|
error: string;
|
|
36
36
|
private readonly _defaultClient;
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
37
39
|
get typeDef(): TaskTypeDef | undefined;
|
|
38
40
|
get taskFields(): ReadonlyArray<TaskFieldDef>;
|
|
39
41
|
submit(formData: Record<string, unknown>): Promise<void>;
|
|
40
42
|
reset(): void;
|
|
41
43
|
private _handleFormSubmit;
|
|
44
|
+
private _handleRequestSubmit;
|
|
42
45
|
private _handleClick;
|
|
43
46
|
private _handleChildChange;
|
|
44
47
|
private _syncMaskSources;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { LcImageUploader } from '../components/image-uploader/image-uploader.js';
|
|
2
3
|
import { LcMaskEditor } from '../components/mask-editor/mask-editor.js';
|
|
3
4
|
import { LcEnumSelector } from '../components/enum-selector/enum-selector.js';
|
|
@@ -8,7 +9,7 @@ import { LcTaskProgressCard } from '../components/task-progress-card/task-progre
|
|
|
8
9
|
import { LcResultGallery } from '../components/result-gallery/result-gallery.js';
|
|
9
10
|
import { LcImageCompareSlider } from '../components/image-compare-slider/image-compare-slider.js';
|
|
10
11
|
import { LcTaskWorkflow } from '../components/task-workflow/task-workflow.js';
|
|
11
|
-
import { LcButton } from '../components/button/button.js';
|
|
12
|
+
import { LcButton, type LcButtonType, type LcButtonVariant } from '../components/button/button.js';
|
|
12
13
|
export declare const LcImageUploaderReact: import("@lit/react").ReactWebComponent<LcImageUploader, {
|
|
13
14
|
onChange: "change";
|
|
14
15
|
}>;
|
|
@@ -33,11 +34,25 @@ export declare const LcResultGalleryReact: import("@lit/react").ReactWebComponen
|
|
|
33
34
|
onCompare: "compare";
|
|
34
35
|
}>;
|
|
35
36
|
export declare const LcImageCompareSliderReact: import("@lit/react").ReactWebComponent<LcImageCompareSlider, {}>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
type EventHandler = (event: Event) => void;
|
|
38
|
+
export declare const LcTaskWorkflowReact: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<LcTaskWorkflow>, "type" | "onSubmit" | "onError"> & {
|
|
39
|
+
type?: LcTaskWorkflow["type"];
|
|
40
|
+
submitEndpoint?: LcTaskWorkflow["submitEndpoint"];
|
|
41
|
+
pollEndpoint?: LcTaskWorkflow["pollEndpoint"];
|
|
42
|
+
pollInterval?: LcTaskWorkflow["pollInterval"];
|
|
43
|
+
maxPollAttempts?: LcTaskWorkflow["maxPollAttempts"];
|
|
44
|
+
client?: LcTaskWorkflow["client"];
|
|
45
|
+
customRequest?: LcTaskWorkflow["customRequest"];
|
|
46
|
+
customUploadRequest?: LcTaskWorkflow["customUploadRequest"];
|
|
47
|
+
onSubmit?: EventHandler;
|
|
48
|
+
onPoll?: EventHandler;
|
|
49
|
+
onPolling?: EventHandler;
|
|
50
|
+
onSuccess?: EventHandler;
|
|
51
|
+
onError?: EventHandler;
|
|
52
|
+
} & React.RefAttributes<LcTaskWorkflow>>;
|
|
53
|
+
export declare const LcButtonReact: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<LcButton>, "type"> & {
|
|
54
|
+
type?: LcButtonType;
|
|
55
|
+
variant?: LcButtonVariant;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
} & React.RefAttributes<LcButton>>;
|
|
58
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "light-chain-open-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/lightchain-ui.cjs",
|
|
@@ -46,11 +46,8 @@
|
|
|
46
46
|
"publish": "npm publish --access public",
|
|
47
47
|
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
48
48
|
"build": "npm run clean && tsc && vite build",
|
|
49
|
-
"typecheck:stories": "tsc -p tsconfig.stories.json",
|
|
50
49
|
"test": "vitest",
|
|
51
|
-
"test:run": "vitest run"
|
|
52
|
-
"storybook": "storybook dev -p 6006",
|
|
53
|
-
"build:storybook": "storybook build"
|
|
50
|
+
"test:run": "vitest run"
|
|
54
51
|
},
|
|
55
52
|
"keywords": [],
|
|
56
53
|
"author": "",
|
|
@@ -64,21 +61,9 @@
|
|
|
64
61
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
65
62
|
},
|
|
66
63
|
"devDependencies": {
|
|
67
|
-
"@chromatic-com/storybook": "^5.2.1",
|
|
68
|
-
"@storybook/addon-a11y": "^10.4.0",
|
|
69
|
-
"@storybook/addon-docs": "^10.4.0",
|
|
70
|
-
"@storybook/addon-vitest": "^10.4.0",
|
|
71
|
-
"@storybook/web-components-vite": "^10.4.0",
|
|
72
64
|
"@types/react": "^19.2.14",
|
|
73
65
|
"@types/react-dom": "^19.2.3",
|
|
74
|
-
"@vitest/browser-playwright": "^4.1.6",
|
|
75
|
-
"@vitest/coverage-v8": "^4.1.6",
|
|
76
|
-
"fetch-mock": "^12.6.0",
|
|
77
66
|
"jsdom": "^29.1.1",
|
|
78
|
-
"playwright": "^1.60.0",
|
|
79
|
-
"react": "^19.2.6",
|
|
80
|
-
"react-dom": "^19.2.6",
|
|
81
|
-
"storybook": "^10.4.0",
|
|
82
67
|
"typescript": "^6.0.3",
|
|
83
68
|
"vite": "^8.0.13",
|
|
84
69
|
"vitest": "^4.1.6"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`https://api.lightchainai.com`,t=`client-secret`,n=`/task/progress`,r=`/task/submit`,i={BAD_REQUEST:400,UNAUTHORIZED:401,RATE_LIMIT:429,SERVER_ERROR:500},a={GENERATE_PRINTING:`GeneratePrinting`,VIRTUAL_FITTING:`VirtualFitting`,FIX_FACE:`FixFace`,CHANGE_FACE:`ChangeFace`,MULTI_PERSPECTIVE:`MultiPerspective`,PRINTING_TILING:`PrintingTiling`,CHANGE_DESIGN_POINT:`ChangeDesignPoint`,CHANGE_COLOR:`ChangeColor`,CHANGE_FABRIC:`ChangeFabric`,SR:`Sr`,VECTOR_CONVERT:`VectorConvert`,CHANGE_MODEL:`ChangeModel`,GENERATE_SKETCH:`GenerateSketch`,MODEL_GENERATE_SKETCH:`ModelGenerateSketch`,ELIMINATE:`Eliminate`,EXPAND_IMAGE:`ExpandImage`,CLOTHING_DESIGN:`ClothingDesign`,CHANGE_PATTERN:`ChangePattern`,GENERATE_MODEL:`GenerateModel`,MODIFY_PRINTING:`ModifyPrinting`,CUT_OUT:`CutOut`,LINE_ART_TO_REAL:`LineArtToReal`,FIX_PARTIAL:`FixPartial`,DETAIL_COMPENSATION:`DetailCompensation`,CHANGE_CLOTHES_BY_IMG:`ChangeClothesByImg`,CHANGE_ACCESSORIES_BY_IMG:`ChangeAccessoriesByImg`,VIRTUAL_FITTING_REFERENCE:`VirtualFittingReference`,VIRTUAL_FITTING_TEMPLATE:`VirtualFittingTemplate`,FIX_DEFORMITIES:`FixDeformities`,INTELLIGENT_CROPPING:`IntelligentCropping`,MODEL_TO_FLAT:`ModelToFlat`,GENERATE_SHORT_VIDEO:`GenerateShortVideo`,ONE_CLICK_MODIFY_PRINTING:`OneClickModifyPrinting`,ORIENTATION_DESIGN:`OrientationDesign`,DIRECTIONAL_INTEGRATION:`DirectionalIntegration`,ONE_CLICK_INTEGRATION:`OneClickIntegration`,CHANGE_FABRIC_V2:`ChangeFabricV2`,VIRTUAL_FITTING_REFERENCE_V2:`VirtualFittingReferenceV2`,FLOWER_SHAPED_DESIGN:`FlowerShapedDesign`,FLOWER_SHAPED_VIRTUAL_PRINTING:`FlowerShapedVirtualPrinting`,ONE_CLICK_CHANGE_COLOR:`OneClickChangeColor`,FITTING_MODEL_WITH_LABELS:`FittingModelWithLabels`,FITTING_MODEL_CUSTOM:`FittingModelCustom`,FITTING_MODEL_CHANGE_FACE:`FittingModelChangeFace`,FITTING_MODEL_CHANGE_MODEL:`FittingModelChangeModel`,FITTING_MODEL_CHANGE_BODY_SHAPE:`FittingModelChangeBodyShape`,FITTING_MODEL_CHANGE_CLOTHING_SIZE:`FittingModelChangeClothingSize`,FITTING_MODEL_CHANGE_POSTURE:`FittingModelChangePosture`,FITTING_MODEL_CHANGE_BACKGROUND:`FittingModelChangeBackground`,FITTING_MODEL_CHANGE_PERSPECTIVE:`FittingModelChangePerspective`,TRAIN_CLOTHING_MODEL:`TrainClothingModel`},o={IMAGE:`image`,MASK:`mask`,IMAGES:`images`,TEXT:`text`,ENUM:`enum`,MULTI_ENUM:`multiEnum`,ASPECT_RATIO:`aspectRatio`,COLOR:`color`,STRENGTH:`strength`,NUMBER:`number`},s={IDLE:`idle`,SUBMITTING:`submitting`,POLLING:`polling`,SUCCESS:`success`,ERROR:`error`},c={POLL_INTERVAL:1e3,MAX_POLL_ATTEMPTS:120,POLL_ENDPOINT:`/task/progress`},l={CHANGE:`change`,SUBMIT:`submit`,POLL:`poll`,SUCCESS:`success`,ERROR:`error`,IMAGE_CLICK:`image-click`,COMPARE:`compare`},u={MISSING_ENDPOINT:`未指定提交端点或任务类型`,POLL_TIMEOUT:e=>`轮询超时: ${e}`,POLL_FAILED:`轮询失败`,TASK_NOT_FOUND:e=>`未找到任务: ${e}`,SUBMIT_FAILED:`提交失败`,FIELD_REQUIRED:e=>`${e}为必填项`,FIELD_STRING:e=>`${e}必须为字符串`,FIELD_ARRAY:e=>`${e}必须为非空数组`,FIELD_ARRAY_ELEMENTS:e=>`${e}数组元素必须为非空字符串`,FIELD_MAX_LENGTH:(e,t)=>`${e}不能超过${t}个字符`,FIELD_ENUM_INVALID:e=>`${e}值不在可选项中`,FIELD_COLOR_FORMAT:e=>`${e}必须为#RRGGBB格式`,FIELD_NUMBER:e=>`${e}必须为数字`},d={IMAGE:[`image/jpeg`,`image/png`,`image/webp`]},f={MAX_IMAGE_SIZE:10*1024*1024},p=[{label:`1:1`,value:`1:1`},{label:`2:3`,value:`2:3`},{label:`3:4`,value:`3:4`},{label:`3:2`,value:`3:2`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],m=[{label:`正面`,value:`front`},{label:`背面`,value:`back`},{label:`左侧`,value:`left`},{label:`右侧`,value:`right`}],h=[{label:`2倍`,value:`2`},{label:`3倍`,value:`3`},{label:`4倍`,value:`4`}],g=[{label:`线稿`,value:`line`},{label:`印花`,value:`printing`}],_=[{label:`女`,value:`female`},{label:`男`,value:`male`}],v=[{label:`青年`,value:`young`},{label:`中年`,value:`middle`}],y=[{label:`亚洲`,value:`asian`},{label:`欧洲`,value:`european`},{label:`非洲`,value:`african`}],b=[{label:`上装`,value:`upper`},{label:`下装`,value:`lower`},{label:`连身装`,value:`dress`}],x=[{label:`袖型`,value:`sleeve`},{label:`领型`,value:`collar`},{label:`裤型`,value:`pants`},{label:`裙型`,value:`skirt`}],S=[{label:`全身`,value:`full`},{label:`半身`,value:`half`},{label:`服装`,value:`clothing`}],C=[{label:`黑白线稿`,value:`bw`},{label:`彩色线稿`,value:`color`}],w=[{label:`背包`,value:`bag`},{label:`鞋子`,value:`shoes`},{label:`首饰`,value:`jewelry`},{label:`腰带`,value:`belt`},{label:`帽子`,value:`hat`}],T=[{label:`棚内瑜伽`,value:`yoga`},{label:`极简棚拍`,value:`minimal`}],E=[{label:`自定义像素`,value:`1`},{label:`比例裁剪`,value:`2`}],D=[{label:`3秒`,value:`3`},{label:`5秒`,value:`5`}],O=[{label:`是`,value:`true`},{label:`否`,value:`false`}],k=[{label:`中国`,value:`china`},{label:`美国`,value:`usa`},{label:`英国`,value:`uk`},{label:`法国`,value:`france`},{label:`德国`,value:`germany`},{label:`意大利`,value:`italy`},{label:`西班牙`,value:`spain`},{label:`俄罗斯`,value:`russia`},{label:`日本`,value:`japan`},{label:`韩国`,value:`korea`},{label:`泰国`,value:`thailand`},{label:`印度`,value:`india`},{label:`越南`,value:`vietnam`},{label:`其他`,value:`other`}],A=[{label:`白皙`,value:`fair`},{label:`中等`,value:`medium`},{label:`小麦色`,value:`wheatish`},{label:`深色`,value:`dark`},{label:`其他`,value:`other`}],j=[{label:`偏瘦`,value:`slim`},{label:`标准`,value:`standard`},{label:`微胖`,value:`chubby`},{label:`肥胖`,value:`fat`}],M=[{label:`一致`,value:`same`},{label:`相似`,value:`similar`}],N=[{label:`偏小`,value:`smaller`},{label:`偏大`,value:`larger`}];Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return g}});
|
package/dist/core-C5cKUOSx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./client-C5AgfBeT.js";
|
package/dist/core-DkseUrte.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./client-Dt9_oZey.cjs`);
|