import{b as a,c as e,d as s,f as l,g as t,h as o,m as n,v as u,B as c,A as r,t as i,n as d}from"./vendor.38cc6e40.js";import{u as v,a as p,m}from"./index.751353e8.js";const h={class:"workshop-view"},b={class:"panel-card task-card"},k={class:"panel-card__body task-card__body"},g={class:"task-form"},y={class:"check-option"},_={class:"check-option"},f={class:"task-actions"},w=["disabled"],x=["disabled"],I={class:"task-status-box__badge"},D={class:"task-status-box__content"},P={class:"preview-box"},V={class:"preview-box__content"},L={__name:"WorkshopView",setup(L){const S=a({path:null}),U=a(""),W=a(!0),$=a(!0),j=a(!1),A=a("idle"),C=a("等待执行"),T=a("请输入创意工坊链接或 ID 后，再点击开始任务。"),{setEnvironment:z,setLastAction:B,showToast:E}=v(),{addLog:K,addLogs:q}=p(),F=e((()=>U.value.trim()?"创意工坊任务已就绪":"等待入库")),G=e((()=>U.value.trim()?`将按原项目逻辑处理创意工坊输入：${U.value.trim()}`:"请输入创意工坊链接或数字 ID。")),H=e((()=>({idle:"待命",running:"进行中",success:"已完成",error:"失败"}[A.value]||"待命"))),J=(a,e,s)=>{A.value=a,C.value=e,T.value=s},M=a=>{(null==a?void 0:a.message)&&(K(a.message,a.type||"info"),J("running","任务执行中",a.message))},N=async()=>{if(U.value.trim())if(W.value||$.value){j.value=!0,J("running","任务已启动","正在准备处理创意工坊清单...");try{const s=await m.startWorkshopTask({workshopInput:U.value.trim(),steamPath:S.value.path,onProgress:M});J(s.success?"success":"error",s.success?"任务执行成功":"任务执行失败",s.summary),B(s.summary),a=s.success,e=s.summary,a?E("任务执行成功。","success"):E(e||"创意工坊任务失败，请查看执行日志。","error")}catch(s){const a=`创意工坊任务异常：${s.message}`;K(a,"error"),J("error","任务执行失败",a),B(a),E(a,"error")}finally{j.value=!1}var a,e}else E("至少保留一个输出目录。","warning");else E("请输入创意工坊链接或 ID。","info")},O=()=>{U.value="",W.value=!0,$.value=!0,K("已重置创意工坊表单。","success")};return s((async()=>{const a=await m.initialize();S.value.path=a.steamPath,a.logs&&q(a.logs),z({steamPath:a.steamPath,unlocker:a.unlocker})})),(a,e)=>(l(),t("div",h,[o("section",b,[e[8]||(e[8]=o("header",{class:"panel-card__header"},[o("h2",null,"创意工坊入库")],-1)),o("div",k,[o("div",g,[e[5]||(e[5]=o("label",{class:"field-label",for:"workshopInput"},"创意工坊物品链接或 ID",-1)),n(o("input",{id:"workshopInput","onUpdate:modelValue":e[0]||(e[0]=a=>U.value=a),class:"text-input",type:"text",placeholder:"例如：创意工坊链接或物品 ID",onKeyup:c(N,["enter"])},null,544),[[u,U.value]]),e[6]||(e[6]=o("p",{class:"field-help"}," 支持创意工坊链接或数字 ID，例如： `https://steamcommunity.com/sharedfiles/filedetails/?id=123456789` ",-1)),o("label",y,[n(o("input",{"onUpdate:modelValue":e[1]||(e[1]=a=>W.value=a),type:"checkbox"},null,512),[[r,W.value]]),e[3]||(e[3]=o("div",null,[o("strong",null,"复制到 config/depotcache"),o("small",null,"当前任务会把清单同时复制到 Steam/config/depotcache 目录。")],-1))]),o("label",_,[n(o("input",{"onUpdate:modelValue":e[2]||(e[2]=a=>$.value=a),type:"checkbox"},null,512),[[r,$.value]]),e[4]||(e[4]=o("div",null,[o("strong",null,"复制到 depotcache"),o("small",null,"当前任务会把清单同时复制到 Steam/depotcache 目录。")],-1))])]),o("div",f,[o("button",{class:"primary-btn",type:"button",disabled:j.value,onClick:N},i(j.value?"执行中...":"开始任务"),9,w),o("button",{class:"secondary-btn",type:"button",disabled:j.value,onClick:O}," 重置 ",8,x)]),o("section",{class:d(["task-status-box",`task-status-box--${A.value}`])},[o("div",I,i(H.value),1),o("div",D,[o("strong",null,i(C.value),1),o("p",null,i(T.value),1)])],2),o("section",P,[e[7]||(e[7]=o("div",{class:"preview-box__empty"},[o("div",{class:"preview-box__placeholder"},"WS"),o("span",null,"创意工坊")],-1)),o("div",V,[o("strong",null,i(F.value),1),o("p",null,i(G.value),1)])])])])]))},__scopeId:"data-v-1469ddda"};export{L as default};
