You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3 lines
53 KiB
3 lines
53 KiB
import{j as e}from"./markdown-vendor-BZI_VWzW.js";import{u as Ge,r}from"./data-vendor-BOGugMqL.js";import{f as ha,R as Te,h as ma,$ as ua,i as pa,P as ga,A as _a,j as fa,k as Ca,l as xa,m as ve,a as ba,b as va,g as Na,n as ja,p as ya,q as wa,r as Ma,s as Ra,t as ka,v as Sa}from"./index-BxSU1Bs1.js";import{c as Ta}from"./imageDragTransfer-apm0lmHd.js";import{b as Pa}from"./react-vendor-CmPQC3tV.js";import{M as D,T as qe,I as Ia,D as We}from"./arco-vendor-gN7EHfgO.js";function La({visible:c,taskList:f,initialTaskId:y,onClose:P,onCreated:I}){const{t:o}=Ge(),L=Pa(),[i,A]=r.useState(null),[w,W]=r.useState(i?.resultList?.[0]?.images?.[0]??""),[g,O]=r.useState(i?.resultList?.[0]?.images?.[0]??""),[q,V]=r.useState(""),[E,Z]=r.useState(""),[Y,k]=r.useState(""),[C,v]=r.useState(!1),[S,Q]=r.useState(!1),[te,ee]=r.useState(!1),se=r.useRef(null),K=i?.userCreatedCharacter,b=Number(K?.id)>0;r.useEffect(()=>{c||(A(null),W(""),O(""),V(""),Z(""),k(""),v(!1),Q(!1),ee(!1))},[c]),r.useEffect(()=>{if(c){if(y){const m=f.find(R=>String(R.id)===String(y));if(m){A(m);return}}A(f[0]??null)}},[c,y,f]),r.useEffect(()=>{if(!c||!i)return;if(!f.some(F=>String(F.id)===String(i.id))){A(f[0]??null);return}const R=f.find(F=>String(F.id)===String(i.id));R&&R!==i&&A(R)},[c,f,i]),r.useEffect(()=>{const m=b?K?.avatar??"":i?.resultList?.[0]?.images?.[0]??"";V(""),O(m),W(m),Z(b?K?.characterName??"":""),k(b?K?.description??"":"")},[i,b,K?.avatar,K?.characterName,K?.description]);const N=r.useCallback(()=>{if(!g)return;const m=g.split("#")[0];V(`${m}#crop=${Date.now()}`)},[g]),u=r.useCallback(async()=>{const m=E.trim(),R=Y.trim();if(b){D.warning(o("pages.charactersCreate.createRoleModal.alreadyCreated"));return}if(!w){D.warning(o("pages.charactersCreate.createRoleModal.uploadAvatarFirst"));return}if(!m){D.warning(o("pages.charactersCreate.createRoleModal.inputName"));return}if(!R){D.warning(o("pages.charactersCreate.createRoleModal.inputDescription"));return}if(!S){D.warning(o("pages.charactersCreate.createRoleModal.agreementRequired"));return}if(!i?.id){D.warning(o("pages.charactersCreate.createRoleModal.taskNotFound"));return}ee(!0);try{await ha({taskId:i.id,avatar:w,characterName:m,description:R,isPublic:C}),D.success(o("pages.charactersCreate.createRoleModal.createSuccess")),I?.(String(i.id)),P(),L(Te.CHARACTERS)}catch{D.error(o("pages.charactersCreate.createRoleModal.createFailed"))}finally{ee(!1)}},[i?.id,S,w,E,Y,b,C,L,P,I,o]),H=r.useMemo(()=>{const m=[],R=i?.characterList;if(Array.isArray(R))for(const U of R){const re=U?.threeViewImage;re&&m.push(String(re))}const F=i?.images;if(Array.isArray(F))for(const U of F)U&&m.push(String(U));return m},[i?.characterList,i?.images]),d=E.trim(),T=Y.trim(),_=!!(!b&&!te&&w&&d&&T&&S&&i?.id),j=!_,M=`charactersCreateRoleModal__submitBtn${_?" charactersCreateRoleModal__submitBtn--active":""}`,B=r.useMemo(()=>{const m=E||o("pages.charactersCreate.createRoleModal.requiredChip"),F=Array.from(m).length*12+28;return Math.max(70,F)},[E,o]);if(!c)return null;const ce=m=>{const R=se.current;if(!R)return;const F=m==="left"?-121:121;R.scrollBy({left:F,behavior:"smooth"})};return e.jsxs("div",{className:"charactersCreateRoleModal",children:[e.jsx("div",{className:"charactersCreateRoleModal__mask",onClick:P}),e.jsxs("div",{className:"charactersCreateRoleModal__container",role:"dialog","aria-modal":"true","aria-label":o("pages.charactersCreate.createRoleModal.dialogAria"),children:[e.jsxs("section",{className:"charactersCreateRoleModal__previewSection",children:[e.jsx("div",{className:"charactersCreateRoleModal__previewMain",children:i?.resultList?.[0]?.images?.[0]?e.jsx("img",{className:"charactersCreateRoleModal__previewMainImage",src:i.resultList[0].images[0]}):null}),e.jsxs("div",{className:"charactersCreateRoleModal__thumbSection",children:[e.jsx("button",{type:"button",className:"charactersCreateRoleModal__thumbArrow ",onClick:()=>ce("left"),style:{transform:"rotate(180deg)"},children:e.jsx("img",{src:new URL("/assets/ic_arrow_right_gray-DM6GPP4g.png",import.meta.url).href})}),e.jsx("div",{ref:se,className:"charactersCreateRoleModal__thumbList",children:f.map((m,R)=>{const F=String(m.id??R),U=m.resultList[0]?.images?.[0]??"",re=String(m.id)===String(i?.id);return e.jsxs("button",{type:"button",className:`charactersCreateRoleModal__thumbItem${re?" charactersCreateRoleModal__thumbItem_active":""}`,onClick:()=>{A(m)},children:[U?e.jsx("img",{className:"charactersCreateRoleModal__thumbImage",src:U}):null,re?null:e.jsx("span",{className:"charactersCreateRoleModal__thumbMask"})]},F)})}),e.jsx("button",{type:"button",className:"charactersCreateRoleModal__thumbArrow ",onClick:()=>ce("right"),children:e.jsx("img",{src:new URL("/assets/ic_arrow_right_gray-DM6GPP4g.png",import.meta.url).href})})]})]}),e.jsxs("section",{className:"charactersCreateRoleModal__formSection",children:[e.jsx("button",{type:"button",className:"charactersCreateRoleModal__close","aria-label":o("button.close"),onClick:P,children:e.jsx("img",{src:new URL("/assets/ic_close-C0Ltcj9g.png",import.meta.url).href})}),e.jsx("div",{className:"charactersCreateRoleModal__formScrollArea",children:e.jsxs("div",{className:"charactersCreateRoleModal__formColumn",children:[e.jsxs("div",{className:"charactersCreateRoleModal__avatarStack",children:[w?e.jsxs("div",{className:`charactersCreateRoleModal__avatarPreview${b?"":" charactersCreateRoleModal__avatarPreview--editable"}`,children:[e.jsx("img",{className:"charactersCreateRoleModal__avatarCircleImg",src:w}),b?null:e.jsx("button",{type:"button",className:"charactersCreateRoleModal__avatarEditOverlay",onClick:N,"aria-label":o("pages.charactersCreate.createRoleModal.editAvatarAria"),children:e.jsx("img",{className:"charactersCreateRoleModal__avatarEditOverlayIcon",src:new URL("/assets/ic_crop-7RinYXMI.png",import.meta.url).href})})]}):e.jsx("button",{type:"button",className:"charactersCreateRoleModal__avatarCircleBtn charactersCreateRoleModal__avatarCircleBtn_empty",onClick:N,disabled:b||!g,"aria-label":o("pages.charactersCreate.createRoleModal.uploadAvatarFirst"),children:e.jsx("img",{className:"charactersCreateRoleModal__avatarCircleAdd",src:new URL("/assets/ic_avatar_add-DSbJ8ACW.png",import.meta.url).href})}),e.jsx("input",{id:"charactersCreateRoleModalName",className:"charactersCreateRoleModal__requiredChip",value:E,onChange:m=>Z(m.target.value),placeholder:o("pages.charactersCreate.createRoleModal.requiredChip"),disabled:b,style:{width:`${B}px`}})]}),e.jsxs("div",{className:"charactersCreateRoleModal__formBody",children:[e.jsxs("div",{className:"charactersCreateRoleModal__publicRow",children:[e.jsx("span",{className:"charactersCreateRoleModal__fieldLabel",children:o("pages.charactersCreate.createRoleModal.publicDisplay")}),e.jsxs("button",{type:"button",className:"charactersCreateRoleModal__publicTextToggle",onClick:()=>v(m=>!m),"aria-label":o("pages.charactersCreate.createRoleModal.publicDisplaySwitchAria"),"aria-pressed":C,children:[e.jsx("span",{className:`charactersCreateRoleModal__publicTextToggle_part${C?" charactersCreateRoleModal__publicTextToggle_part_active":" charactersCreateRoleModal__publicTextToggle_part_muted"}`,children:o("pages.charactersCreate.createRoleModal.publicLabel")}),e.jsx("span",{className:"charactersCreateRoleModal__publicTextToggle_sep",children:" / "}),e.jsx("span",{className:`charactersCreateRoleModal__publicTextToggle_part${C?" charactersCreateRoleModal__publicTextToggle_part_muted":" charactersCreateRoleModal__publicTextToggle_part_active"}`,children:o("pages.charactersCreate.createRoleModal.privateLabel")})]})]}),e.jsxs("div",{className:"charactersCreateRoleModal__fieldBlock",children:[e.jsx("label",{className:"charactersCreateRoleModal__fieldLabel",htmlFor:"charactersCreateRoleModalDesc",children:o("pages.charactersCreate.createRoleModal.descriptionLabel")}),e.jsx("textarea",{id:"charactersCreateRoleModalDesc",className:"charactersCreateRoleModal__introInput",value:Y,onChange:m=>k(m.target.value),placeholder:`|${o("pages.charactersCreate.createRoleModal.descriptionPlaceholder")}`,disabled:b})]}),i?.taskInfo?e.jsxs("div",{className:"charactersCreateRoleModal__modelMetaRow",role:"group","aria-label":o("pages.charactersCreate.modelListAria"),children:[i.taskInfo?.aiModelName?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"charactersCreateRoleModal__modelMetaText",children:[e.jsx("img",{className:"charactersCreateRoleModal__modelMetaIcon",src:new URL("/assets/ic_model_gray-CF0c-D8R.png",import.meta.url).href}),i.taskInfo.aiModelName]}),e.jsx("span",{className:"charactersCreateRoleModal__modelMetaDivider","aria-hidden":!0})]}):null,i.taskInfo?.resolution?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"charactersCreateRoleModal__modelMetaText",children:String(i.taskInfo.resolution)}),e.jsx("span",{className:"charactersCreateRoleModal__modelMetaDivider","aria-hidden":!0})]}):null,i.taskInfo?.aspectRatio?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"charactersCreateRoleModal__modelMetaText",children:i.taskInfo.aspectRatio}),e.jsx("span",{className:"charactersCreateRoleModal__modelMetaDivider","aria-hidden":!0})]}):null,e.jsx(qe,{position:"br",color:"#ffffff",getPopupContainer:()=>document.body,triggerProps:{showArrow:!1,style:{zIndex:10050},popupStyle:{borderRadius:12,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.08)",padding:"10px 14px"}},content:e.jsxs("div",{className:"charactersCreateRoleModal__taskMetaTooltip",children:[i.taskInfo?.aiModelName?e.jsxs("div",{className:"charactersCreateRoleModal__taskMetaTooltipRow",children:[e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipLabel",children:o("pages.assetDetails.model")}),e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipValue",children:i.taskInfo.aiModelName})]}):null,i.taskInfo?.aspectRatio?e.jsxs("div",{className:"charactersCreateRoleModal__taskMetaTooltipRow",children:[e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipLabel",children:o("pages.assetDetails.ratio")}),e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipValue",children:i.taskInfo.aspectRatio})]}):null,e.jsxs("div",{className:"charactersCreateRoleModal__taskMetaTooltipRow",children:[e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipLabel",children:o("pages.assetDetails.clarity")}),e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipValue",children:String(i.taskInfo?.resolution??"").trim()||"—"})]}),e.jsxs("div",{className:"charactersCreateRoleModal__taskMetaTooltipRow",children:[e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipLabel",children:o("pages.assetDetails.createdAt")}),e.jsx("span",{className:"charactersCreateRoleModal__taskMetaTooltipValue",children:ma(i.createTime??i.taskInfo?.createTime,"YYYY-MM-DD HH:mm:ss")||"—"})]})]}),children:e.jsx("span",{className:"charactersCreateRoleModal__modelMetaDetail",children:o("pages.charactersCreate.createRoleModal.detailInfo")})})]}):null,e.jsxs("div",{className:"charactersCreateRoleModal__materialsBlock",children:[e.jsx("span",{className:"charactersCreateRoleModal__fieldLabel",children:o("pages.assetDetails.useMaterial")}),e.jsx(ua,{children:e.jsx("div",{className:"charactersCreateRoleModal__materialsList",children:H.map((m,R)=>e.jsx(pa,{src:m,children:e.jsx("div",{className:"charactersCreateRoleModal__materialItem",children:e.jsx(ga,{src:m})})},`${m}-${R}`))})})]})]})]})}),e.jsxs("div",{className:"charactersCreateRoleModal__footer",children:[e.jsxs("div",{className:"charactersCreateRoleModal__agreement",children:[e.jsx("button",{type:"button",className:"charactersCreateRoleModal__agreementCheckbox","aria-label":o("pages.charactersCreate.createRoleModal.agreeTermsAria"),"aria-checked":S,onClick:()=>Q(m=>!m),children:e.jsx("img",{className:"charactersCreateRoleModal__agreementCheckboxIcon",src:S?new URL("/assets/ic_checkbox_agreement_on-CfQo_XPS.png",import.meta.url).href:new URL("/assets/ic_checkbox_agreement_off-DYbDLFis.png",import.meta.url).href})}),e.jsxs("p",{className:"charactersCreateRoleModal__agreementText",children:[o("pages.charactersCreate.createRoleModal.uploadMeansAgree"),e.jsx("a",{href:Te.LEGAL+"#user-agreement",target:"_blank",rel:"noreferrer",children:o("app.user_terms")}),o("auth.agreement_sub2"),e.jsx("a",{href:Te.LEGAL+"#privacy-policy",target:"_blank",rel:"noreferrer",children:o("app.privacy_policy")})]})]}),e.jsx("button",{type:"button",className:M,onClick:()=>{u()},disabled:j,"aria-disabled":j,children:o("pages.charactersCreate.createRole")})]})]})]}),e.jsx(_a,{image:q,onUploaded:m=>{W(m),V("")},onClose:()=>V("")})]})}function Aa({visible:c,steps:f,currentStep:y,showSkip:P=!0,showStepIndicator:I=!0,maskOpacity:o=.5,onClose:L,onStepChange:i,onComplete:A}){const[w,W]=r.useState(y??0),[g,O]=r.useState(null),[q,V]=r.useState(null),[E,Z]=r.useState({}),Y=r.useRef(null),k=r.useRef(null),C=y!==void 0?y:w,v=f[C],S=()=>{if(!v?.target){O(null),V(null);return}let N=null;if(typeof v.target=="string"?N=document.querySelector(v.target):v.target instanceof HTMLElement&&(N=v.target),!N){O(null),V(null);return}const u=N.getBoundingClientRect();O(u);const H=v.placement||"bottom",d=v.offset||[0,0],T=k.current?.offsetWidth||400,_=k.current?.offsetHeight||200;let j=0,M=0;switch(H){case"top":j=u.top-_-20+d[1],M=u.left+(u.width-T)/2+d[0];break;case"top-left":j=u.top-_-20+d[1],M=u.left+d[0];break;case"top-right":j=u.top-_-20+d[1],M=u.right-T+d[0];break;case"bottom":j=u.bottom+20+d[1],M=u.left+(u.width-T)/2+d[0];break;case"bottom-left":j=u.bottom+20+d[1],M=u.left+d[0];break;case"bottom-right":j=u.bottom+20+d[1],M=u.right-T+d[0];break;case"left":j=u.top+(u.height-_)/2+d[1],M=u.left-T-20+d[0];break;case"left-top":j=u.top+d[1],M=u.left-T-20+d[0];break;case"left-bottom":j=u.bottom-_+d[1],M=u.left-T-20+d[0];break;case"right":j=u.top+(u.height-_)/2+d[1],M=u.right+20+d[0];break;case"right-top":j=u.top+d[1],M=u.right+20+d[0];break;case"right-bottom":j=u.bottom-_+d[1],M=u.right+20+d[0];break;case"center":j=window.innerHeight/2-_/2+d[1],M=window.innerWidth/2-T/2+d[0];break}const B=20;j<B&&(j=B),j+_>window.innerHeight-B&&(j=window.innerHeight-_-B),M<B&&(M=B),M+T>window.innerWidth-B&&(M=window.innerWidth-T-B),V({top:j,left:M});const ce=Q(H,T,_);Z(ce)},Q=(N,u,H)=>{const d={position:"absolute",width:"0",height:"0",borderStyle:"solid"};switch(N){case"top":return{...d,bottom:"-6px",left:`${u/2}px`,transform:"translateX(-50%)",borderWidth:"6px 6px 0",borderColor:"#ffffff transparent transparent"};case"top-left":return{...d,bottom:"-6px",left:"24px",borderWidth:"6px 6px 0",borderColor:"#ffffff transparent transparent"};case"top-right":return{...d,bottom:"-6px",right:"24px",borderWidth:"6px 6px 0",borderColor:"#ffffff transparent transparent"};case"bottom":return{...d,top:"-6px",left:`${u/2}px`,transform:"translateX(-50%)",borderWidth:"0 6px 6px",borderColor:"transparent transparent #ffffff"};case"bottom-left":return{...d,top:"-6px",left:"24px",borderWidth:"0 6px 6px",borderColor:"transparent transparent #ffffff"};case"bottom-right":return{...d,top:"-6px",right:"24px",borderWidth:"0 6px 6px",borderColor:"transparent transparent #ffffff"};case"left":return{...d,right:"-6px",top:`${H/2}px`,transform:"translateY(-50%)",borderWidth:"6px 0 6px 6px",borderColor:"transparent transparent transparent #ffffff"};case"left-top":return{...d,right:"-6px",top:"24px",borderWidth:"6px 0 6px 6px",borderColor:"transparent transparent transparent #ffffff"};case"left-bottom":return{...d,right:"-6px",bottom:"24px",borderWidth:"6px 0 6px 6px",borderColor:"transparent transparent transparent #ffffff"};case"right":return{...d,left:"-6px",top:`${H/2}px`,transform:"translateY(-50%)",borderWidth:"6px 6px 6px 0",borderColor:"transparent #ffffff transparent transparent"};case"right-top":return{...d,left:"-6px",top:"24px",borderWidth:"6px 6px 6px 0",borderColor:"transparent #ffffff transparent transparent"};case"right-bottom":return{...d,left:"-6px",bottom:"24px",borderWidth:"6px 6px 6px 0",borderColor:"transparent #ffffff transparent transparent"};default:return{display:"none"}}},te=N=>{N<0||N>=f.length||(y===void 0&&W(N),i?.(N))},ee=()=>{C<f.length-1?te(C+1):b()},se=()=>{C>0&&te(C-1)},K=()=>{A?.(),L?.()},b=()=>{A?.(),L?.()};return r.useEffect(()=>{if(!c||!v)return;S();const N=()=>{S()},u=()=>{S()};window.addEventListener("resize",N),window.addEventListener("scroll",u,!0);let H=null;if(v.target){let T=null;typeof v.target=="string"?T=document.querySelector(v.target):v.target instanceof HTMLElement&&(T=v.target),T&&(H=new MutationObserver(()=>{S()}),H.observe(T,{attributes:!0,attributeFilter:["style","class"],childList:!0,subtree:!0}))}const d=setTimeout(S,100);return()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",u,!0),H?.disconnect(),clearTimeout(d)}},[c,C,v]),!c||!v?null:e.jsxs("div",{className:"user-guide",children:[e.jsx("div",{ref:Y,className:"user-guide__mask",onClick:N=>{N.stopPropagation()},children:g?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"user-guide__mask-part",style:{position:"absolute",top:0,left:0,right:0,height:`${g.top}px`,backgroundColor:`rgba(0, 0, 0, ${o})`}}),e.jsx("div",{className:"user-guide__mask-part",style:{position:"absolute",top:`${g.bottom}px`,left:0,right:0,bottom:0,backgroundColor:`rgba(0, 0, 0, ${o})`}}),e.jsx("div",{className:"user-guide__mask-part",style:{position:"absolute",top:`${g.top}px`,left:0,width:`${g.left}px`,height:`${g.height}px`,backgroundColor:`rgba(0, 0, 0, ${o})`}}),e.jsx("div",{className:"user-guide__mask-part",style:{position:"absolute",top:`${g.top}px`,left:`${g.right}px`,right:0,height:`${g.height}px`,backgroundColor:`rgba(0, 0, 0, ${o})`}}),e.jsx("div",{className:"user-guide__highlight",style:{position:"absolute",top:`${g.top-4}px`,left:`${g.left-4}px`,width:`${g.width+8}px`,height:`${g.height+8}px`,borderRadius:"8px"}})]}):e.jsx("div",{className:"user-guide__mask-part",style:{position:"absolute",inset:0,backgroundColor:`rgba(0, 0, 0, ${o})`}})}),q&&e.jsxs("div",{ref:k,className:"user-guide__card",style:{top:`${q.top}px`,left:`${q.left}px`},children:[e.jsx("div",{style:E}),e.jsxs("div",{className:"user-guide__card-content",children:[e.jsx("div",{className:"user-guide__card-title",children:v.title}),e.jsx("div",{className:"user-guide__card-body",children:typeof v.content=="string"?e.jsx("div",{className:"user-guide__card-text",children:v.content}):v.content})]}),e.jsxs("div",{className:"user-guide__card-footer",children:[e.jsxs("div",{className:"user-guide__footer-left",children:[I&&e.jsxs("span",{className:"user-guide__step-indicator",children:[C+1,"/",f.length]}),P&&e.jsx("span",{className:"user-guide__skip-text",onClick:K,children:"跳过"})]}),e.jsxs("div",{className:"user-guide__footer-right",children:[C>0&&e.jsx("button",{className:"user-guide__btn user-guide__btn--prev",onClick:se,children:"上一步"}),e.jsx("button",{className:"user-guide__btn user-guide__btn--next",onClick:ee,children:C<f.length-1?"下一步":"完成"})]})]})]})]})}function Da(c){const{steps:f,storageKey:y="user-guide-completed",delay:P=500,autoShow:I=!0}=c,[o,L]=r.useState(!1),[i,A]=r.useState(0),[w,W]=r.useState(!1);r.useEffect(()=>{if(typeof window>"u")return;const k=localStorage.getItem(y);W(!!k)},[y]),r.useEffect(()=>{if(!I||w)return;const k=setTimeout(()=>{L(!0)},P);return()=>clearTimeout(k)},[I,w,P]);const g=r.useCallback(()=>{A(0),L(!0)},[]),O=r.useCallback(()=>{L(!1)},[]),q=r.useCallback(k=>{k>=0&&k<f.length&&A(k)},[f.length]),V=r.useCallback(()=>{i<f.length-1&&A(k=>k+1)},[i,f.length]),E=r.useCallback(()=>{i>0&&A(k=>k-1)},[i]),Z=r.useCallback(()=>{typeof window<"u"&&localStorage.setItem(y,"true"),W(!0),L(!1)},[y]),Y=r.useCallback(()=>{typeof window<"u"&&localStorage.removeItem(y),W(!1),A(0)},[y]);return{visible:o,currentStep:i,show:g,hide:O,goToStep:q,nextStep:V,prevStep:E,complete:Z,reset:Y,steps:f,isCompleted:w}}function J(...c){return c.filter(Boolean).join(" ")}const Ea=[{key:"batchSize",name:"batchSize",options:[{value:1,label:"1",factor:1},{value:2,label:"2",factor:2},{value:3,label:"3",factor:3},{value:4,label:"4",factor:4}]}],Ua=new Set(["ratio"]),Ha=[{ratio:"21:9",width:1680,height:720},{ratio:"16:9",width:1280,height:720},{ratio:"3:2",width:1080,height:720},{ratio:"4:3",width:960,height:720},{ratio:"1:1",width:960,height:960},{ratio:"3:4",width:720,height:960},{ratio:"2:3",width:720,height:1080},{ratio:"9:16",width:720,height:1280}],G=5,Ba=3e3,Fa=24,me=12;function $a(c){if(typeof c!="string"||c.trim()==="")return{};try{return JSON.parse(c)}catch{return{}}}function za(c,f){const y=f?.width,P=f?.height;if(typeof y!="number"||typeof P!="number"||!Number.isFinite(y)||!Number.isFinite(P))return{};const I=c==="2K";return{width:I?y*2:y,height:I?P*2:P}}function Oe(c,f){return Ua.has(c.trim().toLowerCase())?!0:(f??"").trim().toLowerCase()==="ratio"}function Va(c){if(!c)return null;const f=Ha.find(i=>i.ratio===c);if(f)return f;const[y,P]=c.split(":"),I=Number(y),o=Number(P);if(!Number.isFinite(I)||!Number.isFinite(o)||I<=0||o<=0)return null;const L=720;return I>=o?{ratio:c,width:Math.round(I/o*L),height:L}:{ratio:c,width:L,height:Math.round(o/I*L)}}function Qa(){const{t:c}=Ge(),f=fa(a=>a.user),y=r.useMemo(()=>{const a=f?.avatar;return typeof a=="string"&&a.trim()!==""?a:new URL("/assets/ic_user-BLK-BFPI.png",import.meta.url).href},[f?.avatar]),[P,I]=r.useState([]),[o,L]=r.useState([]),[i,A]=r.useState([]),[w,W]=r.useState("reference"),[g,O]=r.useState(null),[q,V]=r.useState([]),[E,Z]=r.useState(null),[Y,k]=r.useState([]),[C,v]=r.useState(null),[S,Q]=r.useState({}),[te,ee]=r.useState(!1),[se,K]=r.useState(!1),[b,N]=r.useState([]),[u,H]=r.useState([]),[d,T]=r.useState(""),[_,j]=r.useState([]),[M,B]=r.useState(me),[ce,m]=r.useState(!1),[R,F]=r.useState([]),U=R[0],re=r.useMemo(()=>R.slice(1),[R]),[Pe,Ie]=r.useState(""),Ne=r.useRef(!1),[Le,Ae]=r.useState(!1),[Ye,Ke]=r.useState(null),$=r.useMemo(()=>Ta({maxCacheCount:32,maxWarmupPerCall:Fa,disableCanvasPreview:!1,enableCanvasWarmup:!0}),[]),ue=r.useRef(null),pe=r.useRef(null),De=r.useRef(null),ge=r.useRef(!1),le=r.useRef(!0),_e=r.useRef(1),Ee=r.useRef(0),je=r.useRef(!1),ye=r.useRef(0),ie=r.useRef(!1),ne=Da({steps:[{target:".charactersCreate__left",title:"角色风格库",content:"点选一个角色头像,就能决定这次生成的画风(比如美漫爱丽丝/韩漫叮叮/Q版叮叮)",placement:"right-top",offset:[0,0]},{target:".charactersCreate__left",title:"查看更多",content:"想换更多画风?点「查看更多」展开更多风格。",placement:"right-bottom"},{target:".charactersCreate__composerPanel",title:"图片上传区(「+」)",content:"点击「+」上传照片/参考图。上传后会按你的图片来转风格,或让生成更贴近参考",placement:"left",offset:[0,0]},{target:".charactersCreate__composerPanel",title:"描述输入框",content:"在这里用一句话说明你想要的角色可以写:外观、发型、服装、表情、动作、背景等米描述越清楚越好",placement:"top",offset:[0,0]},{target:".charactersCreate__taskPreview",title:"画布(工作区)",content:"生成出来的图片会显示在这里你可以先选风格,或先上传照片,再开始生成",placement:"bottom",offset:[0,0]},{target:".charactersCreate__right",title:"说明区",content:"右侧展示未开放模板示例。点卡片可把该模板的提示词填入中间描述框。上传与创建请用底部两个入口。",placement:"left-top",offset:[0,0]},{target:".charactersCreate__rightPromptGrid",title:"风格展示",content:"点风格卡会把对应提示词写入中间输入框,再按需上传参考图并生成。",placement:"left",offset:[0,0]},{target:".charactersCreate__createGlobal",title:"创建角色",content:"设定满意后点「创建角色」,把角色保存到你的资产里,之后可以继续使用",placement:"left-bottom",offset:[0,0]}],storageKey:"popiart.charactersCreate.guide",delay:1e3,autoShow:!0}),we=r.useMemo(()=>new Set(u),[u]),fe=r.useCallback(a=>{T(a.prompt||"")},[]),Qe=r.useMemo(()=>{const a=new Set;for(const t of b)typeof t=="string"&&t.trim()!==""&&a.add(t);return a},[b]),Me=r.useCallback(a=>{const t=a?.id;if(t==null)return;const s=String(t),l=we.has(s);if(!l&&b.length>=G){D.warning(c("composer.maxUploadReached",{max:G}));return}H(h=>l?h.filter(p=>p!==s):[...h,s]);const n={type:"character",id:a?.id,threeViewImage:String(a?.threeViewImage??""),avatar:a?.avatar};N(h=>{const p=h.findIndex(x=>typeof x=="object"&&x.type==="character"&&String(x.id)===s);return p>=0?h.filter((x,z)=>z!==p):[...h,n]})},[b.length,we,c]),Ue=r.useCallback(a=>{N(t=>{const s=[...t,String(a.url??"")];return s.length>G?s.slice(0,G):s})},[]),Xe=r.useCallback(a=>{const t=String(a.url??a.icon??"").trim();t&&N(s=>{const l=s.findIndex(n=>typeof n=="string"&&n===t);return l>=0?s.filter((n,h)=>h!==l):s.length>=G?(D.warning(c("composer.maxUploadReached",{max:G})),s):[...s,t]})},[c]),Je=r.useCallback(()=>{if(w==="reference"){Ca({onSelect:a=>{Me(a)}});return}xa({...g!=null?{initialCategoryId:g}:{},onSelect:a=>{Ue(a)}})},[g,w,Me,Ue]),He=r.useCallback((a,t,s)=>{$.startImageDrag({evt:a,dragUrl:t,previewUrl:s??t})},[$]),Re=r.useCallback((a,t)=>{$.startImageDrag({evt:a,dragUrl:t,previewUrl:t})},[$]),Ce=r.useCallback(async()=>{try{const t=await ve({page:1,pageSize:5,type:1,subType:106,status_min:0}),s=Array.isArray(t?.data?.list)?t.data.list:[];j(s),B(Math.min(Math.max(me,5),s.length)),_e.current=1,le.current=s.length>=5,ie.current=!0}catch{j([]),B(me),_e.current=1,le.current=!1,ie.current=!0}},[]),xe=r.useCallback(()=>{let a=!1;const t=[];let s=null;const l=()=>{const p=pe.current;p&&(p.scrollTop=p.scrollHeight)},n=p=>{if(a)return;if(l(),p>=2){ie.current=!1;return}const x=window.requestAnimationFrame(()=>n(p+1));t.push(x)},h=window.requestAnimationFrame(()=>{n(0)});return t.push(h),s=window.setTimeout(()=>{a||l()}),()=>{a=!0,t.forEach(p=>window.cancelAnimationFrame(p)),s!=null&&window.clearTimeout(s)}},[]),Be=r.useCallback(async()=>{if(ge.current||!le.current)return;const a=_e.current+1,t=5;ge.current=!0;const s=++Ee.current;try{const l=await ve({page:a,pageSize:t,type:1,subType:106,status_min:0}),n=Array.isArray(l?.data?.list)?l.data.list:[];if(j(p=>{if(n.length===0)return p;const x=new Set(p.map(ae=>String(ae.id))),z=n.filter(ae=>{const he=String(ae.id);return x.has(he)?!1:(x.add(he),!0)});return[...p,...z]}),B(p=>p+me),s!==Ee.current)return;_e.current=a;const h=n.length>=t;le.current=h}catch{}finally{ge.current=!1}},[]);r.useEffect(()=>{let a=!1;return ba({type:1,page:1,pageSize:120}).then(t=>{a||I(t?.data?.list??[])}).catch(()=>{a||I([])}),()=>{a=!0}},[]),r.useEffect(()=>{let a=!1;return va({isOpen:!1,page:1,pageSize:50}).then(t=>{a||F(t?.data?.list??[])}).catch(()=>{a||F([])}),()=>{a=!0}},[]),r.useEffect(()=>{Na().then(a=>{Ie(a?.systemConfig?.serviceQrCode??"")}).catch(()=>Ie(""))},[]),r.useEffect(()=>{if(w!=="diy"||g==null){L([]);return}const a=g;let t=!1;return ja({page:1,pageSize:120,categoryId:a}).then(s=>{t||L(s?.data?.list??[])}).catch(()=>{t||L([])}),()=>{t=!0}},[g,w]),r.useEffect(()=>{let a=!1;const t=P.flatMap(n=>[n?.avatar,n?.threeViewImage??n?.threeView]).filter(n=>typeof n=="string"&&n.trim()!=="");if(t.length===0)return;const s=()=>{a||$.warmupPreviewImages(t)};if("requestIdleCallback"in window){const n=window.requestIdleCallback(s,{timeout:1e3});return()=>{a=!0,window.cancelIdleCallback(n)}}const l=setTimeout(s,0);return()=>{a=!0,clearTimeout(l)}},[P,$]),r.useEffect(()=>{let a=!1;const t=o.map(n=>String(n.url??n.icon??"").trim()).filter(n=>n!=="");if(t.length===0)return;const s=()=>{a||$.warmupPreviewImages(t)};if("requestIdleCallback"in window){const n=window.requestIdleCallback(s,{timeout:1e3});return()=>{a=!0,window.cancelIdleCallback(n)}}const l=setTimeout(s,0);return()=>{a=!0,clearTimeout(l)}},[o,$]),r.useEffect(()=>()=>{$.dispose()},[$]),r.useEffect(()=>{(async()=>await Ce())()},[Ce]),r.useEffect(()=>{let a=!1;return ya().then(t=>{a||A(t?.data?.list??[])}).catch(()=>{a||A([])}),()=>{a=!0}},[]),r.useEffect(()=>{let a=!1;return wa().then(t=>{if(a)return;const s=t.data?.list?[...t.data.list].filter(l=>l.taskSubType===106):[];V(s)}).catch(()=>{a||V([])}),()=>{a=!0}},[]),r.useEffect(()=>{q.length!==0&&Z(a=>a!=null&&q.some(t=>t.taskSubType===a)?a:q[0].taskSubType)},[q]),r.useEffect(()=>{if(E==null)return;let a=!1;return Ma({subType:E}).then(t=>{if(a)return;const s=Array.isArray(t?.data)?t.data:[];k(s),v(s[0]??null),Q({})}).catch(()=>{a||(k([]),v(null),Q({}))}),()=>{a=!0}},[E]);const X=r.useMemo(()=>{const a=C?.displayDimensions,s=(typeof a=="string"?$a(a):a&&typeof a=="object"?a:{}).dimensions??{};return[...Object.entries(s).filter(([,n])=>Array.isArray(n?.options)&&(n?.options?.length??0)>0).map(([n,h])=>{const p=h;return{key:n,name:p?.name??n,options:p?.options??[]}}),...Ea]},[C]);r.useEffect(()=>{X.length!==0&&Q(a=>{const t={};return X.forEach(s=>{const l=s.options[0]?.value,n=a[s.key];if(s.options.some(p=>p.value===n)){t[s.key]=n;return}l!==void 0&&(t[s.key]=l)}),t})},[X]);const Ze=r.useMemo(()=>{const a=X.map(t=>{const s=S[t.key],l=t.options.find(h=>h.value===s)??t.options[0],n=l?.label??String(l?.value??"");return{key:t.key,label:n}}).filter(t=>!!t.label);return a.length===0?c("composer.paramPreset"):e.jsx(e.Fragment,{children:a.map((t,s)=>e.jsxs(r.Fragment,{children:[s>0?e.jsx("span",{className:"charactersCreate__paramPresetDivider","aria-hidden":"true"}):null,t.label]},t.key))})},[X,S,c]),oe=r.useMemo(()=>{const a=X.find(n=>Oe(n.key,n.name));if(!a)return null;const t=S[a.key],s=a.options[0]?.value,l=String(t??s??"");return l?Va(l):null},[X,S]),ea=r.useMemo(()=>{const a=Number(C?.baseRatio??0),t=Number(C?.discountCoef??1);if(!Number.isFinite(a)||a<=0||!Number.isFinite(t)||t<=0)return 0;const s=X.reduce((l,n)=>{const h=S[n.key],p=n.options.find(z=>z.value===h)??n.options[0],x=Number(p?.factor??1);return!Number.isFinite(x)||x<=0?l:l*x},1);return Math.ceil(a*s*t)},[C,X,S]),ke=r.useCallback(()=>{ue.current?.click()},[]),be=r.useCallback(async a=>{const t=a.filter(s=>s.type.startsWith("image/"));if(t.length!==0)try{const s=Math.max(0,G-b.length);if(s<=0){D.warning(c("composer.maxUploadReached",{max:G}));return}const l=await Ra(t.slice(0,s));N(n=>[...n,...l]),t.length>s&&D.warning(c("composer.maxUploadReached",{max:G}))}catch{D.error(c("composer.uploadFailed"))}},[b.length,c]),aa=r.useCallback(a=>{const t=a.target.files;!t||t.length===0||(be(Array.from(t)),a.target.value="")},[be]),Fe=r.useCallback(a=>{a.preventDefault(),a.stopPropagation()},[]),ta=r.useCallback(a=>{a.preventDefault(),a.stopPropagation();const t=a.dataTransfer?.files;if(t&&t.length>0){be(Array.from(t));return}const s=a.dataTransfer.getData("text/uri-list"),l=a.dataTransfer.getData("text/plain"),n=Array.from(new Set([...s.split(`
|
|
`).map(h=>h.trim()).filter(h=>h&&!h.startsWith("#")),l.trim()])).filter(h=>/^https?:\/\//i.test(h)||/^data:image\//i.test(h));n.length!==0&&N(h=>{const p=Math.max(0,G-h.length);if(p<=0)return D.warning(c("composer.maxUploadReached",{max:G})),h;const x=n.slice(0,p);return n.length>p&&D.warning(c("composer.maxUploadReached",{max:G})),[...h,...x]})},[c,be]),ra=r.useCallback(a=>{N(t=>{const s=t[a];if(typeof s=="object"&&s.type==="character"&&s.id!=null){const l=String(s.id);H(n=>n.filter(h=>h!==l))}return t.filter((l,n)=>n!==a)})},[]),sa=r.useCallback(()=>{if(N([]),H([]),T(""),W("reference"),i.length>0){const a=Number(i[0]?.id);O(Number.isFinite(a)?a:null)}else O(null);v(Y[0]??null),Q({}),ee(!1),K(!1),ue.current&&(ue.current.value="")},[Y,i]),ca=r.useCallback(async()=>{if(!Ne.current){Ne.current=!0,m(!0);try{if(d.trim()===""){D.error(c("composer.promptRequired"));return}const a=d.trim(),t={subType:E,aiModelName:C?.name,aiPlatform:C?.code,aiModelId:C?.id,model:C?.code,aiModelCode:C?.code,aiModelCodeAlias:C?.aiModelCodeAlias,type:1,...S,...za(S.resolution,oe),chatPrompt:a,images:b.map(l=>typeof l=="string"?l:l.threeViewImage).filter(l=>!!l)},s=b.filter(l=>typeof l=="object"&&l.type==="character").map(l=>l.id).filter(l=>l!=null&&l!=="");s.length>0&&(t.characterIdList=s),D.success(c("composer.taskCreating")),await ka(t),await Ce(),xe()}catch{}finally{Ne.current=!1,m(!1)}}},[C,E,d,b,oe,Ce,xe,S,c]),$e=r.useCallback(()=>{const a=pe.current;if(!a)return;const t=60;a.scrollTop<=t&&(ye.current=a.scrollHeight,je.current=!0,B(s=>Math.min(_.length,s+me))),!(ge.current||!le.current)&&a.scrollTop<=t&&Be()},[Be,_.length]),ze=r.useMemo(()=>_.filter(a=>{const t=Number(a.status);return t===0||t===1}).map(a=>String(a.id)),[_]),Se=r.useMemo(()=>ze.join(","),[ze]),de=r.useMemo(()=>{const a=_.length,t=Math.min(M,a);return t<=0?[]:[..._.slice(0,t)].reverse()},[_,M]),Ve=r.useMemo(()=>_.length>0&&_.some(a=>Number(a?.status)===2),[_]),na=r.useMemo(()=>_.filter(a=>Array.isArray(a?.resultList)&&a?.status>=0),[_]),la=r.useCallback(async a=>{if(_.some(s=>String(s.id)===String(a)))try{const s=await ve({ids:String(a),type:1,subType:106}),l=Array.isArray(s?.data?.list)?s.data.list:[];if(l.length===0)return;const n=new Map;if(l.forEach(h=>{n.set(String(h.id),h)}),n.size===0)return;j(h=>h.map(p=>n.get(String(p.id))??p))}catch{}},[_]);r.useEffect(()=>{if(Se==="")return;let a=!1;const t=Se,s=async()=>{if(!document.hidden)try{const n=await ve({ids:t,type:1,subType:106});if(a)return;const h=Array.isArray(n?.data?.list)?n.data.list:[];if(h.length===0)return;const p=new Map;if(h.forEach(x=>{const z=String(x.id),ae=Number(x?.status);if(ae<0){D.error(x?.userErrorTipMsg?String(x.userErrorTipMsg):c("pages.charactersCreate.taskGenerateFailed")),p.set(z,x);return}ae===2&&p.set(z,x)}),p.size===0)return;ie.current=!0,j(x=>x.map(z=>p.get(String(z.id))??z))}catch{}};s();const l=window.setInterval(()=>{s()},Ba);return()=>{a=!0,window.clearInterval(l)}},[Se,c]),r.useEffect(()=>{i.length!==0&&O(a=>{if(a!=null&&i.some(s=>Number(s.id)===a))return a;const t=Number(i[0]?.id);return Number.isFinite(t)?t:null})},[i]);const ia=r.useMemo(()=>{if(i.length===0)return!0;if(w!=="diy"||g==null)return!1;const a=i[i.length-1];return Number(a?.id)===g},[g,w,i]);r.useLayoutEffect(()=>{const a=De.current;if(!a)return;const t=w==="reference"?'[data-characters-create-style-tab="reference"]':`[data-characters-create-style-tab="diy"][data-diy-style-category-id="${g??""}"]`,s=a.querySelector(t);s&&s.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[w,g,i]),r.useEffect(()=>{const a=pe.current;if(!a||!je.current)return;const t=ye.current,l=a.scrollHeight-t;l>0&&(a.scrollTop+=l),je.current=!1,ye.current=0},[de.length]),r.useEffect(()=>{if(ie.current)return xe()},[de.length,xe]);const oa=r.useMemo(()=>_.length===0?e.jsxs("div",{className:"charactersCreate__empty",children:[e.jsx("img",{className:"charactersCreate__emptyIcon",src:new URL("/assets/ic_empty-C6qZWQhL.png",import.meta.url).href}),e.jsxs("div",{className:"charactersCreate__emptyText",children:[e.jsx("p",{className:"charactersCreate__emptyLine",children:c("pages.charactersCreate.emptyLine1")}),e.jsx("p",{className:"charactersCreate__emptyLine",children:c("pages.charactersCreate.emptyLine2")})]})]}):e.jsxs("section",{ref:pe,className:"charactersCreate__taskPreview","aria-label":c("pages.charactersCreate.taskPreviewAria"),onScroll:$e,children:[de.map(a=>e.jsxs("div",{className:"charactersCreate__taskPreviewInner",children:[e.jsx("div",{className:"charactersCreate__taskPreviewUserLane",children:e.jsxs("div",{className:"charactersCreate__taskPreviewUserLaneInner",children:[e.jsx("img",{className:"charactersCreate__taskPreviewUserAvatar",src:y,draggable:!1,loading:"lazy",decoding:"async"}),e.jsx("div",{className:"charactersCreate__taskPreviewTop",children:a.images.map((t,s)=>e.jsx("div",{className:"charactersCreate__taskPreviewStyleCard",children:e.jsx("img",{className:"charactersCreate__taskPreviewStyleImage",src:t,draggable:!0,loading:"lazy",decoding:"async",onMouseEnter:()=>{$.ensurePreviewImage(t)},onDragStart:l=>{Re(l,t)}})},`task-image-${a.id}-${s}`))}),e.jsx("p",{className:"charactersCreate__taskPreviewPrompt",children:a.chatPrompt})]})}),e.jsx("div",{className:"charactersCreate__taskPreviewAssistantLane",children:e.jsxs("div",{className:"charactersCreate__taskPreviewAssistantLaneInner",children:[e.jsx("img",{className:"charactersCreate__taskPreviewOfficialAvatar",src:new URL("/assets/popi_avatar-BNWnTSut.png",import.meta.url).href,draggable:!1,loading:"lazy",decoding:"async"}),a?.status==0||a?.status==1?e.jsx("div",{className:"charactersCreate__taskPreviewBody",children:e.jsx("div",{className:"charactersCreate__taskPreviewMainFrame charactersCreate__taskPreviewMainFrame_pending",children:e.jsxs("div",{className:"charactersCreate__taskPreviewPending",children:[e.jsx("img",{className:"charactersCreate__taskPreviewPendingIcon",src:new URL("/assets/pending-iKg2Z6_3.png",import.meta.url).href}),e.jsx("span",{className:"charactersCreate__taskPreviewPendingText",children:"GENERITING..."})]})})}):Array.isArray(a?.resultList)&&a?.status>=0?a.resultList.map((t,s)=>e.jsx(r.Fragment,{children:e.jsx("div",{className:"charactersCreate__taskPreviewBody",children:e.jsx("div",{className:"charactersCreate__taskPreviewMainFrame",children:e.jsx("img",{className:"charactersCreate__taskPreviewMainImage",src:t?.images?.[0],draggable:!0,loading:"lazy",decoding:"async",onMouseEnter:()=>{$.ensurePreviewImage(t?.images?.[0])},onDragStart:l=>{Re(l,t?.images?.[0])}})})})},`task-result-${a.id}-${s}`)):null]})})]},`task-preview-${a.id}`)),de.length<_.length?e.jsx("div",{className:"charactersCreate__taskPreviewLoadHint",children:c("index.explore_more")}):null]}),[$,Re,$e,de,c,_.length,y]);return e.jsxs("div",{className:"charactersCreate",children:[e.jsxs("div",{className:"charactersCreate__row",children:[e.jsx("aside",{className:"charactersCreate__left",children:e.jsxs("div",{className:"charactersCreate__leftInner",children:[e.jsxs("div",{className:"charactersCreate__leftBody",children:[e.jsxs("div",{className:"charactersCreate__leftDiyBanner","aria-hidden":"true",children:[e.jsxs("p",{className:"charactersCreate__leftDiyBannerTitle",children:[e.jsx("span",{children:"DIY "}),e.jsx("span",{children:"Character"})]}),e.jsx("p",{className:"charactersCreate__leftDiyBannerDesc",children:c("pages.charactersCreate.diyTitle")})]}),e.jsxs("div",{ref:De,className:J("charactersCreate__styleTabBar",ia&&"charactersCreate__styleTabBar_noRightFade"),children:[e.jsx("button",{type:"button","data-characters-create-style-tab":"reference",className:J("charactersCreate__styleTab",w==="reference"&&"charactersCreate__styleTab_active"),onClick:()=>W("reference"),children:c("pages.charactersCreate.styleLibraryTitle")}),i.map((a,t)=>{const s=Number(a.id),l=w==="diy"&&g===s;return e.jsx("button",{type:"button","data-characters-create-style-tab":"diy","data-diy-style-category-id":String(s),className:J("charactersCreate__styleTab",l&&"charactersCreate__styleTab_active"),onClick:()=>{W("diy"),O(s)},children:String(a.name??"")},String(a.id??t))})]}),e.jsx("div",{className:"charactersCreate__leftScroll",children:e.jsx("div",{className:"charactersCreate__styleGrid",children:w==="reference"?P.map((a,t)=>e.jsx("button",{type:"button",className:J("charactersCreate__styleCell",we.has(String(a.id))&&"charactersCreate__styleCell_selected"),draggable:!0,onMouseEnter:()=>{$.ensurePreviewImage(a.threeViewImage)},onDragStart:s=>{He(s,a.threeViewImage)},onClick:()=>{Me(a)},children:e.jsx("span",{className:"charactersCreate__styleCellInner",children:e.jsx("img",{className:"charactersCreate__styleImg",src:a.avatar,draggable:!1,loading:"lazy",decoding:"async"})})},String(a.id??t))):o.map(a=>(Qe.has(a.url),e.jsx("button",{type:"button",className:J("charactersCreate__styleCell"),draggable:!1,onMouseEnter:()=>{a.url&&$.ensurePreviewImage(a.url)},onDragStart:t=>{a.url&&He(t,a.url,a.url)},onClick:()=>{Xe(a)},children:e.jsx("span",{className:"charactersCreate__styleCellInner",children:e.jsx("img",{className:"charactersCreate__styleImg",src:a.url||void 0,draggable:!1,loading:"lazy",decoding:"async"})})},String(a.id))))})})]}),e.jsx("button",{type:"button",className:"charactersCreate__leftMore",onClick:Je,children:c("index.explore_more")})]})}),e.jsxs("main",{className:"charactersCreate__center",children:[oa,e.jsx("div",{className:"charactersCreate__composer",children:e.jsxs("div",{className:"charactersCreate__composerPanel",children:[e.jsxs("div",{className:"charactersCreate__composerRow",onDragOver:Fe,onDragEnter:Fe,onDrop:ta,children:[b.length===0?e.jsx("button",{type:"button",className:"charactersCreate__composerUploadCard","aria-label":c("composer.actions.uploadReferenceImage"),onClick:ke,children:e.jsx("img",{src:new URL("/assets/ic_plus-DsKUbTM-.png",import.meta.url).href})}):e.jsx("div",{className:"charactersCreate__composerUploadList","aria-label":c("composer.aria.referenceImageList"),children:b.map((a,t)=>{const s=t===b.length-1,l=typeof a=="object"&&a.type==="character",n=typeof a=="string"?a:a.threeViewImage;return e.jsxs("div",{className:"charactersCreate__composerUploadCard charactersCreate__composerUploadCard_preview",children:[e.jsx("img",{className:"charactersCreate__composerUploadPreview",src:n,loading:"lazy",decoding:"async"}),e.jsx("button",{type:"button",className:"charactersCreate__composerUploadDeleteBtn","aria-label":c(l?"pages.charactersCreate.deleteRoleAria":"composer.actions.deleteImage"),onClick:()=>ra(t),children:e.jsx("img",{src:new URL("/assets/ic_close-C0Ltcj9g.png",import.meta.url).href})}),s&&b.length<G?e.jsx("button",{type:"button",className:"charactersCreate__composerUploadAddBtn","aria-label":c("composer.actions.continueUploadReferenceImage"),onClick:ke,children:e.jsx("img",{src:new URL("/assets/addImage-Do8_T8na.png",import.meta.url).href})}):null]},typeof a=="string"?`${a}-${t}`:`character-${String(a.id??t)}-${t}`)})}),e.jsx("input",{ref:ue,className:"charactersCreate__composerUploadInput",type:"file",accept:"image/*",multiple:!0,onChange:aa,tabIndex:-1,"aria-hidden":"true"}),e.jsx(Ia.TextArea,{className:"charactersCreate__composerTextarea",value:d,onChange:a=>T(a),placeholder:c("pages.charactersCreate.promptPlaceholder"),"aria-label":c("composer.aria.promptInput"),autoSize:{minRows:1,maxRows:4}})]}),e.jsxs("div",{className:"charactersCreate__composerToolbar",children:[e.jsxs("div",{className:"charactersCreate__toolbarLeft",children:[e.jsx(We,{trigger:"click",position:"tl",popupVisible:se,onVisibleChange:K,getPopupContainer:()=>document.body,triggerProps:{className:"charactersCreate__paramDropdownTrigger"},droplist:e.jsx("div",{className:"charactersCreate__paramDropdown",style:{zIndex:2223},role:"menu","aria-label":c("composer.aria.paramPresetList"),children:X.map(a=>{const t=S[a.key],s=a.options[0]?.value,l=t??s,n=Oe(a.key,a.name);return e.jsxs("div",{className:"charactersCreate__paramGroup",children:[e.jsx("p",{className:"charactersCreate__paramTitle",children:a.key==="batchSize"?c("composer.fields.batchSize"):a.name}),e.jsx("div",{className:J("charactersCreate__paramOptions",n&&"charactersCreate__paramOptions_ratio"),role:"group","aria-label":a.name,children:a.options.map((h,p)=>{const x=h.value,z=h.label??String(x),ae=l===x,he=n?Sa(z):null;return e.jsx("button",{type:"button",role:"menuitemradio","aria-checked":ae,className:J("charactersCreate__paramOption",ae&&"charactersCreate__paramOption_active",n&&"charactersCreate__paramOption_ratio"),onClick:()=>{Q(da=>({...da,[a.key]:x}))},children:n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"charactersCreate__ratioShapeSlot","aria-hidden":"true",children:e.jsx("span",{className:"charactersCreate__ratioShape",style:{width:`${he?.width??20}px`,height:`${he?.height??20}px`}})}),e.jsx("span",{className:"charactersCreate__ratioLabel",children:z})]}):z},`${a.key}-${String(x)}-${p}`)})}),n&&oe?e.jsxs("div",{className:"charactersCreate__paramRatioSizeWrap","aria-label":c("composer.aria.sizePreview"),children:[e.jsx("p",{className:"charactersCreate__paramTitle",children:c("composer.fields.size")}),e.jsxs("div",{className:"charactersCreate__paramRatioSizeRow",children:[e.jsxs("span",{className:"charactersCreate__paramRatioSizeValue",children:["W ",oe.width]}),e.jsx("img",{className:"charactersCreate__paramRatioSizeLink",src:new URL("/assets/ic_link-BaYntrUJ.png",import.meta.url).href}),e.jsxs("span",{className:"charactersCreate__paramRatioSizeValue",children:["H ",oe.height]})]})]}):null]},a.key)})}),children:e.jsx("button",{type:"button",className:"charactersCreate__pill charactersCreate__pill--spec","aria-label":c("composer.paramPreset"),children:e.jsx("span",{className:"charactersCreate__paramPresetItem",children:Ze})})}),e.jsx(We,{trigger:"click",position:"tl",popupVisible:te,onVisibleChange:ee,getPopupContainer:()=>document.body,triggerProps:{className:"charactersCreate__modelDropdownTrigger"},droplist:e.jsxs("div",{className:"charactersCreate__modelDropdown",role:"menu","aria-label":c("pages.charactersCreate.modelListAria"),children:[e.jsx("p",{className:"charactersCreate__modelDropdownTitle",children:c("composer.modelLibrary")}),e.jsx("div",{className:"charactersCreate__modelDropdownList",children:Y.map((a,t)=>{const s=C===a;return e.jsxs("button",{type:"button",role:"menuitem",className:J("charactersCreate__modelDropdownItem",s&&"charactersCreate__modelDropdownItem_active"),onClick:()=>{v(a),Q({}),ee(!1)},children:[a.icon?e.jsx("img",{className:"charactersCreate__modelDropdownItemIcon",src:a.icon}):null,e.jsxs("span",{className:"charactersCreate__modelDropdownItemText",children:[e.jsx("span",{className:"charactersCreate__modelDropdownItemName",children:a.name}),a.description?e.jsx("span",{className:"charactersCreate__modelDropdownItemDesc",children:a.description}):null]})]},a.id??t)})})]}),children:e.jsxs("button",{type:"button",className:"charactersCreate__pill charactersCreate__pill--model","aria-haspopup":"menu","aria-expanded":te,"aria-label":c("composer.actions.selectModel"),children:[e.jsx("img",{className:"charactersCreate__modelIcon",src:C?.icon}),e.jsx("span",{className:"charactersCreate__pillText",children:C?.name??c("pages.assetDetails.model")})]})})]}),e.jsxs("div",{className:"charactersCreate__composerActions",children:[e.jsx(qe,{content:c("composer.actions.reset"),children:e.jsxs("button",{type:"button",className:"charactersCreate__composerResetBtn","aria-label":c("composer.actions.reset"),onClick:sa,children:[e.jsx("img",{src:new URL("/assets/ic_refresh-DGXw8T7J.png",import.meta.url).href,alt:""}),e.jsx("span",{children:c("composer.actions.reset")})]})}),e.jsxs("button",{type:"button",className:"charactersCreate__composerCostBtn",onClick:()=>ca(),disabled:ce,children:[e.jsx("img",{src:new URL("/assets/ic_stars_white-CxqAv7TF.png",import.meta.url).href}),e.jsx("span",{children:ea})]})]})]})]})})]}),e.jsxs("aside",{className:"charactersCreate__right",children:[e.jsxs("div",{className:"charactersCreate__rightStack",children:[U?e.jsxs("div",{className:J("charactersCreate__rHero","charactersCreate__rHero--pickPrompt","charactersCreate__rHero--withHoverMask"),role:"button",tabIndex:0,onClick:()=>fe(U),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),fe(U))},children:[e.jsxs("div",{className:"charactersCreate__rHeroMain",children:[e.jsx("div",{className:"charactersCreate__rHeroThumb",children:e.jsx("img",{className:"charactersCreate__rHeroThumbImg",src:U.coverUrl})}),e.jsxs("div",{className:"charactersCreate__rHeroTextCol",children:[e.jsx("span",{className:"charactersCreate__rHeroTitle",children:String(U.title??"")}),e.jsx("p",{className:"charactersCreate__rHeroDesc",children:String(U.subtitle??"")})]})]}),e.jsx("div",{className:"charactersCreate__rHeroMask","aria-hidden":"true",children:e.jsxs("div",{className:"charactersCreate__rHeroMaskInner",children:[e.jsxs("div",{className:"charactersCreate__rightPromptHoverHead",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:String(U.title??"")}),e.jsx("span",{className:"charactersCreate__rightPromptHoverChevronWrap",children:e.jsx("img",{className:"charactersCreate__rightPromptHoverChevron",src:new URL("/assets/hero-chevron-CtRISfYu.png",import.meta.url).href})})]}),e.jsx("p",{className:"charactersCreate__rightPromptHoverHint",children:String(U.desp??"")})]})})]}):null,e.jsx("div",{className:"charactersCreate__rightPromptGrid",children:re.map((a,t)=>{const s=String(a.id??a.templateId??t),l=String(a.title??"");return e.jsxs("div",{role:"button",tabIndex:0,className:"charactersCreate__rightPromptCard charactersCreate__rightPromptCard--pickPrompt charactersCreate__rightPromptCard--style",onClick:()=>fe(a),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),fe(a))},children:[e.jsxs("div",{className:"charactersCreate__rightPromptCardMain",children:[e.jsx("div",{className:"charactersCreate__rightPromptThumb",children:e.jsx("img",{className:"charactersCreate__rightPromptThumbImg",src:a.coverUrl})}),e.jsxs("div",{className:"charactersCreate__rightPromptText",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:l}),e.jsx("span",{className:"charactersCreate__rightPromptSub",children:c("pages.charactersCreate.rightPanel.promptHint")})]})]}),e.jsx("div",{className:"charactersCreate__rightPromptCardMask","aria-hidden":"true",children:e.jsxs("div",{className:"charactersCreate__rightPromptCardMaskInner",children:[e.jsxs("div",{className:"charactersCreate__rightPromptHoverHead",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:l}),e.jsx("span",{className:"charactersCreate__rightPromptHoverChevronWrap",children:e.jsx("img",{className:"charactersCreate__rightPromptHoverChevron",src:new URL("/assets/hero-chevron-CtRISfYu.png",import.meta.url).href})})]}),e.jsx("p",{className:"charactersCreate__rightPromptHoverHint",children:"点击开始创造"})]})})]},s)})})]}),e.jsxs("div",{className:"charactersCreate__rightPromptGridStaticRow",children:[e.jsxs("div",{className:"charactersCreate__rightPromptCard charactersCreate__rightPromptCard--static charactersCreate__rightPromptCard--style",children:[e.jsxs("div",{className:"charactersCreate__rightPromptCardMain",children:[e.jsx("div",{className:"charactersCreate__rightPromptThumb",children:e.jsx("img",{className:"charactersCreate__rightPromptThumbImg",src:new URL("/assets/ic_copyright-C5KY3Ol4.png",import.meta.url).href})}),e.jsxs("div",{className:"charactersCreate__rightPromptText",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:"角色存证"}),e.jsx("span",{className:"charactersCreate__rightPromptSub",children:"IP确权"})]})]}),e.jsx("div",{className:"charactersCreate__rightPromptCardMask","aria-hidden":"true",children:e.jsxs("div",{className:"charactersCreate__rightPromptCardMaskInner",children:[e.jsxs("div",{className:"charactersCreate__rightPromptHoverHead",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:"角色数字存证"}),e.jsx("span",{className:"charactersCreate__rightPromptHoverChevronWrap",children:e.jsx("img",{className:"charactersCreate__rightPromptHoverChevron",src:new URL("/assets/hero-chevron-CtRISfYu.png",import.meta.url).href})})]}),e.jsx("p",{className:"charactersCreate__rightPromptHoverHint",children:"IP存证保护与商用"})]})})]}),e.jsxs("div",{className:"charactersCreate__artistServiceSlot",children:[e.jsxs("div",{className:"charactersCreate__rightPromptCard charactersCreate__rightPromptCard--static charactersCreate__rightPromptCard--style",children:[e.jsxs("div",{className:"charactersCreate__rightPromptCardMain",children:[e.jsx("div",{className:"charactersCreate__rightPromptThumb",children:e.jsx("img",{className:"charactersCreate__rightPromptThumbImg",src:new URL("/assets/ic_artist-PE9NnTO-.png",import.meta.url).href})}),e.jsxs("div",{className:"charactersCreate__rightPromptText",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:"画师约稿"}),e.jsx("span",{className:"charactersCreate__rightPromptSub",children:"定制角色"})]})]}),e.jsx("div",{className:"charactersCreate__rightPromptCardMask","aria-hidden":"true",children:e.jsxs("div",{className:"charactersCreate__rightPromptCardMaskInner",children:[e.jsxs("div",{className:"charactersCreate__rightPromptHoverHead",children:[e.jsx("span",{className:"charactersCreate__rightPromptName",children:"官方画师约稿"}),e.jsx("span",{className:"charactersCreate__rightPromptHoverChevronWrap",children:e.jsx("img",{className:"charactersCreate__rightPromptHoverChevron",src:new URL("/assets/hero-chevron-CtRISfYu.png",import.meta.url).href})})]}),e.jsx("p",{className:"charactersCreate__rightPromptHoverHint",children:"一对一定制角色"})]})})]}),e.jsxs("div",{className:"charactersCreate__artistServicePopup",children:[e.jsx("div",{className:"charactersCreate__artistServicePopupTitle",children:c("contactService.title")}),e.jsx("div",{className:"charactersCreate__artistServicePopupQrWrap",children:Pe?e.jsx("img",{className:"charactersCreate__artistServicePopupQrImage",src:Pe}):e.jsx("div",{className:"charactersCreate__artistServicePopupPlaceholder","aria-hidden":!0})})]})]})]}),e.jsxs("div",{className:"charactersCreate__rightDisclaimer",children:[e.jsx("img",{className:"charactersCreate__rightDisclaimerIcon",src:new URL("/assets/info-icon-Bl1djEbP.png",import.meta.url).href}),e.jsx("p",{className:"charactersCreate__rightDisclaimerText",children:"上传和创建的角色归创作者所有"})]}),e.jsxs("div",{className:"charactersCreate__rightCtaRow",children:[e.jsx("button",{type:"button",className:"charactersCreate__rUploadBlob","aria-label":"上传角色",onClick:ke,children:e.jsx("img",{className:"charactersCreate__rUploadBlobBg",src:new URL("/assets/cta-upload-bg-CaK81ZLB.png",import.meta.url).href})}),e.jsxs("button",{type:"button",className:J("charactersCreate__rCreateBlob","charactersCreate__createGlobal",Ve&&"charactersCreate__createGlobal_active"),disabled:!Ve,onClick:()=>{Ke(null),Ae(!0)},children:[e.jsx("img",{className:"charactersCreate__rCreateBlobBg",src:new URL("/assets/cta-create-bg-DDICEBBC.png",import.meta.url).href}),e.jsxs("span",{className:"charactersCreate__rCreateBlobText",children:[e.jsx("span",{className:"charactersCreate__rCreateWatermark",children:"Popi"}),e.jsx("span",{className:"charactersCreate__rCreateTitle",children:"创建角色"})]})]})]})]})]}),Le&&e.jsx(La,{visible:Le,taskList:na,initialTaskId:Ye,onClose:()=>Ae(!1),onCreated:a=>void la(a)}),e.jsx(Aa,{visible:ne.visible,steps:ne.steps,currentStep:ne.currentStep,onClose:ne.hide,onComplete:ne.complete,onStepChange:ne.goToStep,showSkip:!0,showStepIndicator:!0})]})}export{Qa as default};
|
|
//# sourceMappingURL=index-lBlGgFp0.js.map
|
|
|