/* * Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js * Module id: 463672 * For reading/searching only; this factory depends on the original Turbopack runtime. */ const moduleFactory = (e) => { "use strict"; var t = e.i(462214), n = e.i(358379), i = e.i(768924), r = e.i(777784), a = e.i(485615), o = e.i(374090), s = e.i(111558), c = e.i(41671), l = e.i(417754), u = e.i(459812), h = e.i(299750), f = e.i(216257), d = e.i(791997), p = e.i(136036), g = e.i(10036), b = e.i(33725); let m = (0, n.memo)(function ({ strikethroughPrice: e, power: i, originalPrice: r, lightSurface: a, }) { let o = (0, n.useMemo)( () => (0, p.resolveStrikethroughPowerDisplay)({ strikethroughPrice: e, power: i, originalPrice: r, }), [e, i, r], ), s = (0, t.jsxs)("span", { className: a ? "bg-canvas-controls-active flex h-4 items-center gap-0.5 rounded-sm px-0.5" : "flex h-4 items-center gap-0.5 rounded-sm px-0.5", style: a ? void 0 : { background: "rgba(255, 255, 255, 0.08)" }, children: [ (0, t.jsx)(c.Icons.LightningF, { width: 6, height: 10, className: a ? "text-canvas-controls-text" : "text-white/95", }), (0, t.jsx)("span", { className: `text-center text-[11px] leading-[11px] ${a ? "text-canvas-controls-text" : "text-[#D6D6D6]"}`, children: o ? (0, t.jsxs)(t.Fragment, { children: [ o.primary, null != o.strikeThrough ? (0, t.jsxs)(t.Fragment, { children: [ (0, t.jsx)("span", { className: "opacity-60", children: "/", }), (0, t.jsx)("span", { className: "line-through opacity-60", children: o.strikeThrough, }), ], }) : null, ], }) : i, }), ], }); return o?.eligibilityTooltip ? (0, t.jsx)(b.CanvasTooltip, { label: o.eligibilityTooltip, position: "top", withArrow: !0, children: s, }) : s; }); async function w(e) { try { let t = f.stores.canvas, n = f.stores.global; if (!t || !n) return null; let i = t.getNode(e); if (!i) return null; let r = (0, g.getGeneratorTypeFromNode)(i); if (!r) return null; let a = i.data, o = a?.params ?? {}, s = t.getIncomingNodes(e), c = (0, l.collectIncomingNodeData)(s), d = { ...o, textList: c.textList, imageList: c.imageList, videoList: c.videoList, audioList: c.audioList, }; if (!d.model) { let e = r.replace(/^enhance/, "").toLowerCase(); d.model = n.defaultModel[e] ?? ""; } let b = d.model || "", m = r.startsWith("enhance") ? r.replace(/^enhance/, "").toLowerCase() : r, w = n.getModel(m, b); if (w) { let e = Array.isArray(d.imageList) && d.imageList.length > 0, t = d.modeType ?? ("image" === r ? (e ? "image2image" : "text2image") : void 0), n = (0, u.mergeParamsWithSchema)( d.settings, d.advancedSettings, w, t, ); (d.settings = n.settings), (d.advancedSettings = n.advancedSettings), t && !d.modeType && (d.modeType = t); } let v = t.projectId, x = (0, g.buildRequestData)(d, r, e, v, n.getModel), y = await (0, h.calculatePower)(x); if (y?.code === 0) { let e = y.data; return { power: e?.power ?? 0, originalPrice: e?.originalPrice, modelKey: b, generatorType: r, strikethroughPrice: (0, p.isStrikethroughPriceEnabled)( n.getModel(m, b), (0, p.buildStrikethroughEvaluationContextFromParams)(d), ), }; } return null; } catch { return null; } } let v = (0, n.memo)(function ({ nodeId: e, onDismiss: r, onRetry: a, noPowerCost: o, }) { let l = (0, d.useCanvasThemeStore)((e) => "light" === e.theme), [u, h] = (0, n.useState)(!1), [p, g] = (0, n.useState)(!1), [b, v] = (0, n.useState)(a && !o ? void 0 : null), [x, y] = (0, n.useState)(!a || !!o), _ = (0, n.useRef)(null), S = (0, n.useRef)(null), [E, M] = (0, n.useState)(null), T = (0, i.useStore)((e) => e.transform[2]), k = (0, f.useCanvasStore)( (0, n.useCallback)( (t) => { let n = t.nodes.find((t) => t.id === e); return n?.data?.staleVersion || 0; }, [e], ), ); (0, n.useEffect)(() => { g(!1); let e = setTimeout(() => g(!0), 3e4); return () => clearTimeout(e); }, [k]), (0, n.useEffect)(() => { if (!a || o) { v(null), y(!0); return; } let t = !1; return ( w(e).then((e) => { t || (v(e), y(!0)); }), () => { t = !0; } ); }, [e, a, o]); let C = !!a && (o || (x && null != b && "number" == typeof b.power)); (0, n.useEffect)(() => { if (!u) return; let e = (e) => { _.current?.contains(e.target) || S.current?.contains(e.target) || h(!1); }; return ( document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0) ); }, [u]); let A = (0, n.useCallback)(() => { if (!S.current) return; let e = S.current.getBoundingClientRect(); M({ top: e.bottom + 4, left: e.right }); }, []), N = (0, n.useCallback)( (e) => { e.stopPropagation(), h((e) => (e || A(), !e)); }, [A], ), I = (0, n.useCallback)( (e) => { e.stopPropagation(), h(!1), a?.(); }, [a], ), P = (0, n.useCallback)( (e) => { e.stopPropagation(), h(!1), r(); }, [r], ); return T < 0.2 ? null : (0, t.jsxs)("div", { className: "nodrag nopan relative flex shrink-0 items-center", children: [ (0, t.jsxs)("button", { ref: S, type: "button", className: `flex cursor-pointer items-center gap-0.5 rounded-lg border-none bg-transparent opacity-70 transition-opacity hover:opacity-100 ${l ? "shadow-none" : ""}`, style: l ? void 0 : { boxShadow: "0px 2px 6px 0px rgba(0,0,0,0.08)" }, onClick: N, children: [ (0, t.jsx)(c.Icons.WarnL, { width: 14, height: 14, className: `${p ? "text-[#A8A8A8]" : "text-[#ffc65d]"} cursor-pointer`, }), (0, t.jsx)("span", { className: "whitespace-nowrap text-[12px] leading-normal text-[#ffc65d]", style: { display: "inline-flex", overflow: "hidden", maxWidth: p ? 0 : "200px", opacity: +!p, transition: "max-width 0.4s ease, opacity 0.3s ease", }, children: "输入已更新", }), (0, t.jsx)("span", { style: { display: "inline-flex", overflow: "hidden", maxWidth: p ? 0 : "16px", opacity: +!p, transition: "max-width 0.4s ease, opacity 0.3s ease", }, children: (0, t.jsx)(c.Icons.DownS, { width: 8, height: 16, className: "text-[#ffc65d] transition-transform", style: u ? { transform: "rotate(180deg)" } : void 0, }), }), ], }), u && E && (0, s.createPortal)( (0, t.jsxs)("div", { ref: _, className: `fixed z-[9999] flex flex-col gap-1 p-1 ${l ? "canvas-light" : ""}`, style: { top: E.top, left: E.left, transform: "translateX(-100%)", minWidth: "180px", borderRadius: "12px", backdropFilter: "blur(32px)", WebkitBackdropFilter: "blur(32px)", ...(l ? { border: "0.5px solid var(--canvas-controls-border)", background: "var(--canvas-controls-bg)", boxShadow: "var(--canvas-shadow-dropdown)", } : { border: "0.5px solid rgba(255,255,255,0.16)", background: "rgba(23, 23, 23, 0.95)", boxShadow: "0px 4px 10px 0px rgba(0,0,0,0.12), 0px 2px 4px 0px rgba(0,0,0,0.2)", }), }, children: [ C && (0, t.jsxs)("button", { type: "button", className: l ? "hover:bg-canvas-controls-hover text-canvas-controls-text flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 transition-colors" : "hover:bg-white/8 flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 text-white/95 transition-colors", onClick: I, children: [ (0, t.jsx)(c.Icons.RefreshN, { width: 14, height: 14, className: l ? "text-canvas-controls-text" : "text-white/90", }), (0, t.jsx)("span", { className: "flex-1 text-left text-[13px]", children: "更新生成", }), !o && null != b && (0, t.jsx)(m, { strikethroughPrice: b.strikethroughPrice, power: b.power, originalPrice: b.originalPrice, lightSurface: l, }), ], }), (0, t.jsxs)("button", { type: "button", className: l ? "hover:bg-canvas-controls-hover text-canvas-controls-text flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 transition-colors" : "hover:bg-white/8 flex h-8 cursor-pointer items-center gap-2 rounded-lg px-2 text-white/95 transition-colors", onClick: P, children: [ (0, t.jsx)(c.Icons.Close, { width: 14, height: 14, className: l ? "text-canvas-controls-text" : "text-white/90", }), (0, t.jsx)("span", { className: "flex-1 text-left text-[13px]", children: "关闭提示", }), ], }), ], }), document.body, ), ], }); }), x = (0, n.memo)(function ({ nodeId: e, label: s, icon: c, isStale: l, onDismissStale: u, onRetry: h, noPowerCost: f, onLabelChange: d, readOnly: p, maxWidth: g, variant: b = "floating", className: m, textClassName: w, onEditingChange: x, titleDimensionHint: y, labelSuffix: _, }) { let [S, E] = (0, n.useState)(!1), [M, T] = (0, n.useState)(s), k = (0, n.useRef)(null); (0, n.useEffect)(() => { S || T(s); }, [s, S]); let C = (0, n.useCallback)(() => { p || (T(s), E(!0), x?.(!0)); }, [p, s, x]), A = (0, n.useCallback)( (e) => { e.preventDefault(), e.stopPropagation(), C(); }, [C], ), N = (0, n.useCallback)(() => { E(!1), x?.(!1); let e = M.trim(); e && e !== s ? (T(e), d(e), (0, o.filterSensitiveWords)(e).then((t) => { t !== e && (T(t), d(t), r.Notify.info("已自动过滤风险内容")); })) : T(e || s); }, [M, s, d, x]), I = (0, n.useCallback)(() => { E(!1), T(s), x?.(!1); }, [s, x]), P = (0, n.useCallback)( (e) => { "Enter" === e.key ? (e.preventDefault(), N()) : "Escape" === e.key && (e.preventDefault(), I()), e.stopPropagation(); }, [N, I], ); (0, n.useEffect)(() => { S && k.current && (k.current.focus(), k.current.select()); }, [S]); let R = "floating" === b, L = R ? "text-[13px]" : "text-sm font-medium opacity-80", D = w ?? L, j = (0, i.useStore)((t) => { if (!R || S) return !1; let n = t.nodeLookup.get(e); return !!n?.parentId && !0 !== n.selected; }), O = l && !S && u, F = (0, i.useStore)((e) => e.transform[2]), U = (0, n.useMemo)(() => { if (!g || !R) return; let e = Math.min(1 / F, 2); return { panelScale: e, compensatedWidth: g / e }; }, [g, R, F]), B = U?.compensatedWidth, H = (0, n.useMemo)( () => g ? R && U ? Math.max(0, g - 20) / U.panelScale : Math.max(0, g - 20) : void 0, [g, R, U], ), z = H ?? 180, G = (0, t.jsxs)("div", { className: R ? "text-fg-muted flex w-full min-w-0 items-center gap-1" : `flex w-full min-w-0 items-center gap-1${m ? ` ${m}` : ""}`, style: R ? { height: 24, width: B, maxWidth: B ?? g ?? void 0 } : { width: O ? (g ?? void 0) : void 0, maxWidth: g ?? void 0 }, children: [ (0, t.jsxs)("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-1", children: [ c && (0, t.jsx)("span", { className: "flex shrink-0 items-center", children: c, }), S ? (0, t.jsx)("input", { ref: k, className: `nodrag nopan px-1 leading-normal outline-none ${R ? "bg-panel-background ring-canvas-controls-border focus:ring-canvas-controls-text/50 rounded-sm ring-1" : "bg-black/6 min-w-0 flex-1 rounded-sm border border-black/10 focus:border-black/20 dark:border-white/15 dark:bg-white/10 dark:focus:border-white/30"} text-fg-default ${D}`, style: R ? { width: z, maxWidth: z, color: "var(--color-fg-default)", } : { color: "var(--color-fg-default)" }, value: M, onChange: (e) => T(e.target.value), onBlur: N, onKeyDown: P, onMouseDown: (e) => e.stopPropagation(), onClick: (e) => e.stopPropagation(), }) : (0, t.jsx)("span", { className: `${D} cursor-text`, style: { maxWidth: H, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", }, onDoubleClick: p ? void 0 : A, title: s, children: s, }), !S && _ && (0, t.jsx)("span", { className: "shrink-0", children: _ }), ], }), !S && y && (0, t.jsx)("span", { className: "text-fg-muted shrink-0 whitespace-nowrap text-[11px] tabular-nums opacity-80", title: y, children: y, }), O && u && (0, t.jsx)(v, { nodeId: e, onDismiss: u, onRetry: h, noPowerCost: f, }), ], }); return R ? (0, t.jsx)(a.default, { className: `absolute left-0 origin-bottom-left${j ? " pointer-events-none" : ""}`, style: { top: "-28px", zIndex: 10 }, hideWhenDragging: !1, noPan: S, noWheel: S, noDrag: S, maxScale: 2, children: G, }) : G; }); e.s(["default", 0, x], 463672); }; export default moduleFactory;