webs-sdk 0.19.81 → 0.19.83
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/components/AvatarAI.js +1 -1
- package/dist/components/AvatarAI.js.map +1 -1
- package/dist/components/CreativeFaceSwap.d.ts +6 -1
- package/dist/components/CreativeFaceSwap.d.ts.map +1 -1
- package/dist/components/CreativeFaceSwap.js +193 -193
- package/dist/components/CreativeFaceSwap.js.map +1 -1
- package/dist/components/for-you/ForYouFullPage.d.ts.map +1 -1
- package/dist/components/for-you/ForYouFullPage.js +2 -2
- package/dist/components/for-you/ForYouFullPage.js.map +1 -1
- package/dist/components/for-you/ForYouPage.d.ts +5 -0
- package/dist/components/for-you/ForYouPage.d.ts.map +1 -1
- package/dist/components/for-you/ForYouPage.js +1 -1
- package/dist/components/for-you/ForYouPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -90,7 +90,7 @@ const DEFAULT_ACCEPTED_IMAGE_TYPES = [
|
|
|
90
90
|
"image/webp",
|
|
91
91
|
"image/gif",
|
|
92
92
|
];
|
|
93
|
-
function CreativeFaceSwap({ config, examples: examplesProp = [], collections = [], examplesTag, apiBaseUrl, locale, theme = {}, texts = {}, onGenerationComplete, onError, }) {
|
|
93
|
+
function CreativeFaceSwap({ config, examples: examplesProp = [], collections = [], examplesTag, apiBaseUrl, locale, theme = {}, texts = {}, onGenerationComplete, onError, disclaimerAiCfg, }) {
|
|
94
94
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
95
95
|
const mergedTheme = Object.assign(Object.assign({}, defaultTheme), theme);
|
|
96
96
|
const mergedTexts = Object.assign(Object.assign({}, defaultTexts), texts);
|
|
@@ -394,204 +394,204 @@ function CreativeFaceSwap({ config, examples: examplesProp = [], collections = [
|
|
|
394
394
|
return text;
|
|
395
395
|
return text.substring(0, maxLength) + "...";
|
|
396
396
|
};
|
|
397
|
-
return ((0, jsx_runtime_1.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
397
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: Object.assign({ width: "100%" }, { "--fs-border-color": mergedTheme.borderColor || "transparent" }), children: [(0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: "1280px", margin: "0 auto" }, children: [hasCollections && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
398
|
+
display: "flex",
|
|
399
|
+
gap: "8px",
|
|
400
|
+
padding: "16px 24px",
|
|
401
|
+
background: (_f = mergedTheme.tabsHeaderBackground) !== null && _f !== void 0 ? _f : "var(--color-surface-base)",
|
|
402
|
+
borderBottom: `1px solid ${(_g = mergedTheme.tabsHeaderBorderColor) !== null && _g !== void 0 ? _g : "var(--fs-border-color, transparent)"}`,
|
|
403
|
+
}, children: [
|
|
404
|
+
{ id: "create", label: createTabLabel },
|
|
405
|
+
{ id: "collections", label: collectionsTabLabel },
|
|
406
|
+
].map((tab) => {
|
|
407
|
+
var _a, _b;
|
|
408
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setActiveTab(tab.id), style: {
|
|
409
|
+
padding: "8px 20px",
|
|
410
|
+
borderRadius: "20px",
|
|
411
|
+
border: activeTab === tab.id
|
|
412
|
+
? "none"
|
|
413
|
+
: `1px solid ${mergedTheme.textColor}33`,
|
|
414
|
+
backgroundColor: activeTab === tab.id
|
|
415
|
+
? (_a = mergedTheme.primaryColor) !== null && _a !== void 0 ? _a : "#FF5500"
|
|
416
|
+
: "transparent",
|
|
417
|
+
color: activeTab === tab.id
|
|
418
|
+
? "#FFFFFF"
|
|
419
|
+
: (_b = mergedTheme.textColor) !== null && _b !== void 0 ? _b : "#001B5E",
|
|
420
|
+
fontSize: "14px",
|
|
421
|
+
fontWeight: 600,
|
|
422
|
+
cursor: "pointer",
|
|
423
|
+
transition: "all 0.2s",
|
|
424
|
+
outline: "none",
|
|
425
|
+
}, children: tab.label }, tab.id));
|
|
426
|
+
}) })), hasCollections && activeTab === "collections" && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
427
|
+
padding: "24px",
|
|
428
|
+
background: (_h = mergedTheme.tabsHeaderBackground) !== null && _h !== void 0 ? _h : "var(--color-surface-base)",
|
|
429
|
+
}, children: collections.length === 0 ? ((0, jsx_runtime_1.jsx)("p", { style: {
|
|
430
|
+
color: mergedTheme.textColor,
|
|
431
|
+
opacity: 0.5,
|
|
420
432
|
fontSize: "14px",
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
transition: "transform 0.18s, box-shadow 0.18s",
|
|
447
|
-
}, onMouseEnter: (e) => {
|
|
448
|
-
e.currentTarget.style.transform = "translateY(-4px)";
|
|
449
|
-
e.currentTarget.style.boxShadow =
|
|
450
|
-
"0 8px 24px rgba(0,0,0,0.18)";
|
|
451
|
-
}, onMouseLeave: (e) => {
|
|
452
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
453
|
-
e.currentTarget.style.boxShadow = "none";
|
|
454
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
455
|
-
overflow: "hidden",
|
|
456
|
-
borderRadius: "10px 10px 0 0",
|
|
457
|
-
}, children: (0, jsx_runtime_1.jsx)("img", { src: item.image, alt: item.description, style: {
|
|
458
|
-
width: "100%",
|
|
459
|
-
aspectRatio: "3/4",
|
|
460
|
-
objectFit: "cover",
|
|
461
|
-
display: "block",
|
|
462
|
-
} }) }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: "8px 8px 10px" }, children: [(0, jsx_runtime_1.jsx)("p", { style: {
|
|
463
|
-
margin: "0 0 8px",
|
|
464
|
-
fontSize: "11px",
|
|
465
|
-
color: mergedTheme.textColor,
|
|
466
|
-
opacity: 0.7,
|
|
467
|
-
lineHeight: 1.35,
|
|
468
|
-
overflow: "hidden",
|
|
469
|
-
display: "-webkit-box",
|
|
470
|
-
WebkitLineClamp: 2,
|
|
471
|
-
WebkitBoxOrient: "vertical",
|
|
472
|
-
}, children: item.description }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
473
|
-
setDescription(item.description);
|
|
474
|
-
setActiveTab("create");
|
|
475
|
-
setTimeout(() => window.scrollTo({
|
|
476
|
-
top: 0,
|
|
477
|
-
behavior: "smooth",
|
|
478
|
-
}), 50);
|
|
479
|
-
}, style: {
|
|
433
|
+
}, children: collectionsEmptyText })) : (collections.map((cat, catIdx) => ((0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "40px" }, children: [(0, jsx_runtime_1.jsx)("h3", { style: {
|
|
434
|
+
fontSize: "18px",
|
|
435
|
+
fontWeight: 700,
|
|
436
|
+
color: mergedTheme.textColor,
|
|
437
|
+
margin: "0 0 16px 0",
|
|
438
|
+
}, children: cat.label }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
439
|
+
display: "grid",
|
|
440
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(160px, 1fr))",
|
|
441
|
+
gap: "16px",
|
|
442
|
+
}, children: cat.items.map((item) => ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
443
|
+
borderRadius: "12px",
|
|
444
|
+
overflow: "hidden",
|
|
445
|
+
cursor: "pointer",
|
|
446
|
+
transition: "transform 0.18s, box-shadow 0.18s",
|
|
447
|
+
}, onMouseEnter: (e) => {
|
|
448
|
+
e.currentTarget.style.transform = "translateY(-4px)";
|
|
449
|
+
e.currentTarget.style.boxShadow =
|
|
450
|
+
"0 8px 24px rgba(0,0,0,0.18)";
|
|
451
|
+
}, onMouseLeave: (e) => {
|
|
452
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
453
|
+
e.currentTarget.style.boxShadow = "none";
|
|
454
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
455
|
+
overflow: "hidden",
|
|
456
|
+
borderRadius: "10px 10px 0 0",
|
|
457
|
+
}, children: (0, jsx_runtime_1.jsx)("img", { src: item.image, alt: item.description, style: {
|
|
480
458
|
width: "100%",
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
backgroundColor: mergedTheme.backgroundColor || "#F9F9F9",
|
|
532
|
-
border: `1px solid var(--fs-border-color, transparent)`,
|
|
533
|
-
color: mergedTheme.textColor,
|
|
534
|
-
boxShadow: `0 4px 20px rgba(0,0,0,0.25), 0 0 0 1px ${mergedTheme.textColor}22`,
|
|
535
|
-
backdropFilter: "blur(8px)",
|
|
536
|
-
opacity: 0.95,
|
|
537
|
-
}, children: (0, jsx_runtime_1.jsx)("p", { className: "leading-relaxed whitespace-pre-line", style: { color: mergedTheme.textColor }, children: mergedTexts.describeTooltip }) })] }) })] }), (0, jsx_runtime_1.jsx)("textarea", { value: description, onChange: (e) => setDescription(e.target.value), placeholder: mergedTexts.descriptionPlaceholder, className: (0, utils_1.cn)("faceswap-textarea w-full rounded-lg p-4 italic text-(--text-color) placeholder-gray-400 border border-(--fs-border-color) focus:outline-none focus:ring-2", showTooltip && "border-(--active-border-color)"), style: {
|
|
538
|
-
"--text-color": mergedTheme.textColor,
|
|
539
|
-
"--active-border-color": mergedTheme.primaryColor,
|
|
540
|
-
"--fs-border-color": mergedTheme.borderColor || "transparent",
|
|
541
|
-
background: "var(--neutral-10)",
|
|
542
|
-
} }), (0, jsx_runtime_1.jsx)("div", { className: "flex justify-end mt-4", children: (0, jsx_runtime_1.jsx)("button", { onClick: handleCreate, disabled: !uploadedImage ||
|
|
543
|
-
!description.trim() ||
|
|
544
|
-
isGenerating ||
|
|
545
|
-
(!!generatedResult && !generatedImageUrl), className: `font-bold text-base px-6 py-3 rounded-full transition-colors duration-300 flex items-center gap-2 ${uploadedImage &&
|
|
546
|
-
description.trim() &&
|
|
547
|
-
!isGenerating &&
|
|
548
|
-
!(!!generatedResult && !generatedImageUrl)
|
|
549
|
-
? "text-white cursor-pointer"
|
|
550
|
-
: "bg-gray-300 text-gray-500 cursor-not-allowed"}`, style: {
|
|
551
|
-
backgroundColor: uploadedImage &&
|
|
552
|
-
description.trim() &&
|
|
553
|
-
!isGenerating &&
|
|
554
|
-
!(!!generatedResult && !generatedImageUrl)
|
|
555
|
-
? mergedTheme.primaryColor
|
|
556
|
-
: undefined,
|
|
557
|
-
}, onMouseEnter: (e) => {
|
|
558
|
-
if (uploadedImage &&
|
|
559
|
-
description.trim() &&
|
|
560
|
-
!isGenerating &&
|
|
561
|
-
!(!!generatedResult && !generatedImageUrl)) {
|
|
562
|
-
e.currentTarget.style.backgroundColor =
|
|
563
|
-
mergedTheme.primaryHoverColor ||
|
|
564
|
-
mergedTheme.primaryColor ||
|
|
565
|
-
"#ff1600";
|
|
566
|
-
}
|
|
459
|
+
aspectRatio: "3/4",
|
|
460
|
+
objectFit: "cover",
|
|
461
|
+
display: "block",
|
|
462
|
+
} }) }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: "8px 8px 10px" }, children: [(0, jsx_runtime_1.jsx)("p", { style: {
|
|
463
|
+
margin: "0 0 8px",
|
|
464
|
+
fontSize: "11px",
|
|
465
|
+
color: mergedTheme.textColor,
|
|
466
|
+
opacity: 0.7,
|
|
467
|
+
lineHeight: 1.35,
|
|
468
|
+
overflow: "hidden",
|
|
469
|
+
display: "-webkit-box",
|
|
470
|
+
WebkitLineClamp: 2,
|
|
471
|
+
WebkitBoxOrient: "vertical",
|
|
472
|
+
}, children: item.description }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => {
|
|
473
|
+
setDescription(item.description);
|
|
474
|
+
setActiveTab("create");
|
|
475
|
+
setTimeout(() => window.scrollTo({
|
|
476
|
+
top: 0,
|
|
477
|
+
behavior: "smooth",
|
|
478
|
+
}), 50);
|
|
479
|
+
}, style: {
|
|
480
|
+
width: "100%",
|
|
481
|
+
padding: "6px",
|
|
482
|
+
borderRadius: "16px",
|
|
483
|
+
border: `1px solid ${mergedTheme.primaryColor}`,
|
|
484
|
+
backgroundColor: "transparent",
|
|
485
|
+
color: mergedTheme.primaryColor,
|
|
486
|
+
fontSize: "12px",
|
|
487
|
+
fontWeight: 600,
|
|
488
|
+
cursor: "pointer",
|
|
489
|
+
display: "flex",
|
|
490
|
+
alignItems: "center",
|
|
491
|
+
justifyContent: "center",
|
|
492
|
+
gap: "4px",
|
|
493
|
+
}, onMouseEnter: (e) => {
|
|
494
|
+
var _a;
|
|
495
|
+
e.currentTarget.style.backgroundColor =
|
|
496
|
+
(_a = mergedTheme.primaryColor) !== null && _a !== void 0 ? _a : "#FF5500";
|
|
497
|
+
e.currentTarget.style.color = "#fff";
|
|
498
|
+
}, onMouseLeave: (e) => {
|
|
499
|
+
var _a;
|
|
500
|
+
e.currentTarget.style.backgroundColor =
|
|
501
|
+
"transparent";
|
|
502
|
+
e.currentTarget.style.color =
|
|
503
|
+
(_a = mergedTheme.primaryColor) !== null && _a !== void 0 ? _a : "#FF5500";
|
|
504
|
+
}, children: [(0, jsx_runtime_1.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [(0, jsx_runtime_1.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })] }), mergedTexts.tryButton] })] })] }, item.id))) })] }, catIdx)))) })), (!hasCollections || activeTab === "create") && ((0, jsx_runtime_1.jsxs)("div", { className: "faceswap-layout", children: [(0, jsx_runtime_1.jsxs)("div", { className: "faceswap-col-left", children: [(0, jsx_runtime_1.jsxs)("div", { style: { padding: "16px 24px 24px", borderBottom: `1px solid var(--fs-border-color, transparent)` }, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: mergedTheme.textColor, fontSize: "18px", fontWeight: 700, marginBottom: "16px" }, children: mergedTexts.uploadTitle }), (0, jsx_runtime_1.jsx)("input", { ref: fileInputRef, type: "file", accept: acceptedImageTypes.join(",") || "image/*", onChange: handleFileChange, className: "hidden" }), (0, jsx_runtime_1.jsx)("div", { className: "relative rounded-lg p-8 mb-4 flex items-center justify-center border-2 border-dashed border-(--fs-border-color) overflow-hidden", style: { minHeight: "300px", background: "var(--neutral-10)" }, children: uploadedImage ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: uploadedImage, alt: "Uploaded photo", className: "w-full h-full object-contain max-h-[300px]" }), (0, jsx_runtime_1.jsx)("button", { onClick: handleRemoveImage, "aria-label": (_j = mergedTexts.changeImageButton) !== null && _j !== void 0 ? _j : "Remove image", className: "absolute top-4 right-4 rounded-full flex items-center justify-center shadow-lg transition-colors", style: { width: "48px", height: "48px", backgroundColor: "#ef4444", color: "#ffffff" }, onMouseEnter: (e) => { e.currentTarget.style.backgroundColor = "#dc2626"; }, onMouseLeave: (e) => { e.currentTarget.style.backgroundColor = "#ef4444"; }, children: (0, jsx_runtime_1.jsx)("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", style: { width: "24px", height: "24px" }, children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] })) : null }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleUploadClick, className: "w-full text-white font-bold text-base px-6 py-3 rounded-full transition-colors duration-300 cursor-pointer flex items-center justify-center gap-2", style: { backgroundColor: mergedTheme.primaryColor }, onMouseEnter: (e) => {
|
|
505
|
+
e.currentTarget.style.backgroundColor =
|
|
506
|
+
mergedTheme.primaryHoverColor ||
|
|
507
|
+
mergedTheme.primaryColor ||
|
|
508
|
+
"#ff1600";
|
|
567
509
|
}, onMouseLeave: (e) => {
|
|
568
|
-
|
|
510
|
+
e.currentTarget.style.backgroundColor =
|
|
511
|
+
mergedTheme.primaryColor || "#FF5500";
|
|
512
|
+
}, children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" }) }), uploadedImage
|
|
513
|
+
? mergedTexts.changeImageButton
|
|
514
|
+
: mergedTexts.uploadButton] }), uploadError && ((0, jsx_runtime_1.jsxs)("div", { role: "alert", className: "mt-4 flex items-start gap-2 p-3 rounded-lg border", style: {
|
|
515
|
+
color: (_k = mergedTheme.errorColor) !== null && _k !== void 0 ? _k : "#dc2626",
|
|
516
|
+
backgroundColor: (_l = mergedTheme.errorBackgroundColor) !== null && _l !== void 0 ? _l : "#fef2f2",
|
|
517
|
+
borderColor: (_m = mergedTheme.errorBorderColor) !== null && _m !== void 0 ? _m : "#fecaca",
|
|
518
|
+
}, children: [(0, jsx_runtime_1.jsx)("svg", { className: "shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", style: { width: "20px", height: "20px", marginTop: "2px" }, children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: uploadError })] }))] }), carouselExamples.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "p-6", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-bold mb-4", style: { color: mergedTheme.textColor }, children: mergedTexts.examplesTitle }), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("button", { onClick: handlePrevExample, className: "absolute left-0 top-1/2 -translate-y-1/2 z-10 w-8 h-8 bg-white rounded-full shadow-lg flex items-center justify-center hover:bg-gray-100 transition-colors -ml-4", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }), (0, jsx_runtime_1.jsx)("div", { ref: carouselRef, className: "faceswap-examples-outer", children: (0, jsx_runtime_1.jsx)("div", { className: "faceswap-examples-grid", children: carouselExamples.map((example) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)("div", { className: "aspect-[3/4] rounded-lg overflow-hidden mb-2", style: { background: "rgba(255,255,255,0.07)" }, children: (0, jsx_runtime_1.jsx)("img", { src: example.image, alt: `Example ${example.id}`, className: "w-full h-full object-cover" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs leading-tight line-clamp-3 mb-2 min-h-[3rem]", style: { color: mergedTheme.textColor }, children: truncateText(example.description, 120) }), (0, jsx_runtime_1.jsxs)("button", { onClick: () => handleTryExample(example.description), className: "w-full text-white font-bold text-sm px-4 py-2 rounded-full transition-colors duration-300 cursor-pointer flex items-center justify-center gap-2 mt-auto", style: {
|
|
519
|
+
backgroundColor: mergedTheme.primaryColor,
|
|
520
|
+
}, onMouseEnter: (e) => {
|
|
521
|
+
e.currentTarget.style.backgroundColor =
|
|
522
|
+
mergedTheme.primaryHoverColor ||
|
|
523
|
+
mergedTheme.primaryColor ||
|
|
524
|
+
"#ff1600";
|
|
525
|
+
}, onMouseLeave: (e) => {
|
|
526
|
+
e.currentTarget.style.backgroundColor =
|
|
527
|
+
mergedTheme.primaryColor || "#FF5500";
|
|
528
|
+
}, children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 5l7 7m0 0l-7 7m7-7H3" }) }), mergedTexts.tryButton] })] }, example.id))) }) }), (0, jsx_runtime_1.jsx)("button", { onClick: handleNextExample, className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 w-8 h-8 bg-white rounded-full shadow-lg flex items-center justify-center hover:bg-gray-100 transition-colors -mr-4", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })] })] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "faceswap-col-right", children: [(0, jsx_runtime_1.jsxs)("div", { style: { padding: "16px 24px 24px", borderBottom: `1px solid var(--fs-border-color, transparent)` }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "16px", position: "relative" }, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: mergedTheme.textColor, fontSize: "18px", fontWeight: 700 }, children: mergedTexts.describeTitle }), (0, jsx_runtime_1.jsx)(ui_1.TooltipProvider, { children: (0, jsx_runtime_1.jsxs)(ui_1.Tooltip, { open: showTooltip, onOpenChange: setShowTooltip, children: [(0, jsx_runtime_1.jsx)(ui_1.TooltipTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)("button", { className: "w-5 h-5 rounded-full border-2 flex items-center justify-center text-xs font-bold transition-colors border-[var(--theme-color)] text-[var(--theme-color)] hover:bg-(--theme-color) hover:text-white", style: {
|
|
529
|
+
"--theme-color": mergedTheme.textColor || "#001B5E",
|
|
530
|
+
}, children: "i" }) }), (0, jsx_runtime_1.jsx)(ui_1.TooltipContent, { className: "mt-2 w-64 rounded-lg p-4 z-20 text-sm", style: {
|
|
531
|
+
backgroundColor: mergedTheme.backgroundColor || "#F9F9F9",
|
|
532
|
+
border: `1px solid var(--fs-border-color, transparent)`,
|
|
533
|
+
color: mergedTheme.textColor,
|
|
534
|
+
boxShadow: `0 4px 20px rgba(0,0,0,0.25), 0 0 0 1px ${mergedTheme.textColor}22`,
|
|
535
|
+
backdropFilter: "blur(8px)",
|
|
536
|
+
opacity: 0.95,
|
|
537
|
+
}, children: (0, jsx_runtime_1.jsx)("p", { className: "leading-relaxed whitespace-pre-line", style: { color: mergedTheme.textColor }, children: mergedTexts.describeTooltip }) })] }) })] }), (0, jsx_runtime_1.jsx)("textarea", { value: description, onChange: (e) => setDescription(e.target.value), placeholder: mergedTexts.descriptionPlaceholder, className: (0, utils_1.cn)("faceswap-textarea w-full rounded-lg p-4 italic text-(--text-color) placeholder-gray-400 border border-(--fs-border-color) focus:outline-none focus:ring-2", showTooltip && "border-(--active-border-color)"), style: {
|
|
538
|
+
"--text-color": mergedTheme.textColor,
|
|
539
|
+
"--active-border-color": mergedTheme.primaryColor,
|
|
540
|
+
"--fs-border-color": mergedTheme.borderColor || "transparent",
|
|
541
|
+
background: "var(--neutral-10)",
|
|
542
|
+
} }), (0, jsx_runtime_1.jsx)("div", { className: "flex justify-end mt-4", children: (0, jsx_runtime_1.jsx)("button", { onClick: handleCreate, disabled: !uploadedImage ||
|
|
543
|
+
!description.trim() ||
|
|
544
|
+
isGenerating ||
|
|
545
|
+
(!!generatedResult && !generatedImageUrl), className: `font-bold text-base px-6 py-3 rounded-full transition-colors duration-300 flex items-center gap-2 ${uploadedImage &&
|
|
569
546
|
description.trim() &&
|
|
570
547
|
!isGenerating &&
|
|
571
|
-
!(!!generatedResult && !generatedImageUrl)
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
"#ff1600";
|
|
548
|
+
!(!!generatedResult && !generatedImageUrl)
|
|
549
|
+
? "text-white cursor-pointer"
|
|
550
|
+
: "bg-gray-300 text-gray-500 cursor-not-allowed"}`, style: {
|
|
551
|
+
backgroundColor: uploadedImage &&
|
|
552
|
+
description.trim() &&
|
|
553
|
+
!isGenerating &&
|
|
554
|
+
!(!!generatedResult && !generatedImageUrl)
|
|
555
|
+
? mergedTheme.primaryColor
|
|
556
|
+
: undefined,
|
|
557
|
+
}, onMouseEnter: (e) => {
|
|
558
|
+
if (uploadedImage &&
|
|
559
|
+
description.trim() &&
|
|
560
|
+
!isGenerating &&
|
|
561
|
+
!(!!generatedResult && !generatedImageUrl)) {
|
|
562
|
+
e.currentTarget.style.backgroundColor =
|
|
563
|
+
mergedTheme.primaryHoverColor ||
|
|
564
|
+
mergedTheme.primaryColor ||
|
|
565
|
+
"#ff1600";
|
|
566
|
+
}
|
|
591
567
|
}, onMouseLeave: (e) => {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
568
|
+
if (uploadedImage &&
|
|
569
|
+
description.trim() &&
|
|
570
|
+
!isGenerating &&
|
|
571
|
+
!(!!generatedResult && !generatedImageUrl)) {
|
|
572
|
+
e.currentTarget.style.backgroundColor =
|
|
573
|
+
mergedTheme.primaryColor || "#FF5500";
|
|
574
|
+
}
|
|
575
|
+
}, children: isGenerating ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "w-5 h-5 animate-spin", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), mergedTexts.generatingButton] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }), mergedTexts.createButton] })) }) }), error && ((0, jsx_runtime_1.jsx)("div", { className: "mt-4 p-3 bg-red-50 border border-red-200 rounded-lg", children: (0, jsx_runtime_1.jsx)("p", { className: "text-red-600 text-sm", children: error }) }))] }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: "16px 24px 24px" }, children: [(0, jsx_runtime_1.jsx)("h3", { style: { color: mergedTheme.textColor, fontSize: "18px", fontWeight: 700, marginBottom: "16px" }, children: mergedTexts.resultTitle }), (0, jsx_runtime_1.jsx)("div", { className: "rounded-lg mb-4 border border-(--fs-border-color) flex items-center justify-center", style: { minHeight: "600px", background: mergedTheme.backgroundColor || "var(--neutral-10)" }, children: isGenerating ? ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [(0, jsx_runtime_1.jsxs)("svg", { className: "w-16 h-16 animate-spin", fill: "none", viewBox: "0 0 24 24", style: { color: mergedTheme.primaryColor }, children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), (0, jsx_runtime_1.jsx)("p", { className: "font-bold", style: { color: mergedTheme.textColor }, children: "Generating your image..." }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-500", children: "This may take a few moments" })] })) : generatedResult ? ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: generatedImageUrl ? ((0, jsx_runtime_1.jsxs)("div", { className: "w-full", children: [(0, jsx_runtime_1.jsx)("div", { className: "rounded-lg overflow-hidden mb-4", children: (0, jsx_runtime_1.jsx)("img", { src: generatedImageUrl, alt: "Generated image", className: "w-full h-auto" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 justify-center", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-6 h-6 text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-green-600 font-bold", children: mergedTexts.successMessage })] })] })) : progressPercent !== null ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-16 h-16 animate-pulse", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", style: { color: mergedTheme.primaryColor }, children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }), (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-lg", style: { color: mergedTheme.textColor }, children: "Generating Image..." }), (0, jsx_runtime_1.jsx)("div", { className: "w-full max-w-md", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-white rounded-lg p-6 border border-(--fs-border-color)", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-600 font-bold", children: mergedTexts.progressText }), (0, jsx_runtime_1.jsxs)("span", { className: "text-2xl font-bold", style: { color: mergedTheme.primaryColor }, children: [progressPercent, "%"] })] }), (0, jsx_runtime_1.jsx)("div", { className: "w-full bg-gray-200 rounded-full h-4 overflow-hidden", children: (0, jsx_runtime_1.jsx)("div", { className: "h-4 rounded-full transition-all duration-500 ease-out", style: {
|
|
576
|
+
width: `${progressPercent}%`,
|
|
577
|
+
background: `linear-gradient(to right, ${mergedTheme.primaryColor}, #FF8800)`,
|
|
578
|
+
} }) })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-gray-500 text-center", children: "Creating your masterpiece..." })] }) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: "w-16 h-16 animate-spin", fill: "none", viewBox: "0 0 24 24", style: { color: mergedTheme.primaryColor }, children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-lg", style: { color: mergedTheme.textColor }, children: mergedTexts.startingText }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm text-gray-500 text-center", children: mergedTexts.preparingText })] })) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-center gap-3 text-gray-400", children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-16 h-16", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-center", children: mergedTexts.emptyStateText })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: "faceswap-action-buttons", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: handleStartAgain, disabled: !generatedResult, className: "text-white font-bold text-base px-6 py-3 rounded-full transition-colors duration-300 flex items-center gap-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", style: { backgroundColor: mergedTheme.primaryColor }, onMouseEnter: (e) => {
|
|
579
|
+
e.currentTarget.style.backgroundColor =
|
|
580
|
+
mergedTheme.primaryHoverColor ||
|
|
581
|
+
mergedTheme.primaryColor ||
|
|
582
|
+
"#ff1600";
|
|
583
|
+
}, onMouseLeave: (e) => {
|
|
584
|
+
e.currentTarget.style.backgroundColor =
|
|
585
|
+
mergedTheme.primaryColor || "#FF5500";
|
|
586
|
+
}, children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }), mergedTexts.startAgainButton] }), (0, jsx_runtime_1.jsxs)("button", { onClick: handleDownload, disabled: !generatedImageUrl, className: "text-white font-bold text-base px-6 py-3 rounded-full transition-colors duration-300 flex items-center gap-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", style: { backgroundColor: mergedTheme.primaryColor }, onMouseEnter: (e) => {
|
|
587
|
+
e.currentTarget.style.backgroundColor =
|
|
588
|
+
mergedTheme.primaryHoverColor ||
|
|
589
|
+
mergedTheme.primaryColor ||
|
|
590
|
+
"#ff1600";
|
|
591
|
+
}, onMouseLeave: (e) => {
|
|
592
|
+
e.currentTarget.style.backgroundColor =
|
|
593
|
+
mergedTheme.primaryColor || "#FF5500";
|
|
594
|
+
}, children: [(0, jsx_runtime_1.jsx)("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }) }), mergedTexts.downloadButton] })] })] })] })] }))] }), (disclaimerAiCfg === null || disclaimerAiCfg === void 0 ? void 0 : disclaimerAiCfg.pais_ue) === 1 && ((0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: '1280px', margin: '16px auto', padding: '12px 16px', background: '#eff6ff', border: '1px solid #bfdbfe', borderRadius: 8, display: 'flex', alignItems: 'flex-start', gap: 10 }, className: disclaimerAiCfg.className, children: [(0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#2563eb", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0, marginTop: 2 }, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "16", x2: "12", y2: "12" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })] }), (0, jsx_runtime_1.jsx)("p", { style: { margin: 0, fontSize: 13, color: '#1e40af', lineHeight: 1.5 }, children: disclaimerAiCfg.text })] }))] }));
|
|
595
595
|
}
|
|
596
596
|
void ui_1.Button;
|
|
597
597
|
exports.default = CreativeFaceSwap;
|