1import{d as L,u as j,a as z,b as A,S as H,r as h,z as D,o as s,f as n,i as _,j as G,m as T,t as l,h as e,g as a,F as y,n as d,L as C,a2 as S,D as J,dT as K,T as R,J as U,K as $}from"./entry.25e7c8e3.js";import q from"./Icon.b580a4dd.js";import{a as M}from"./skeleton-item.c230a7e2.js";import{u as O}from"./writing-plan.fb59efbf.js";import{a as P}from"./index.91261933.js";import{t as Q}from"./toast.32b89a94.js";import"./_plugin-vue_export-helper.c27b6911.js";import"./IconCSS.2b47b359.js";const X={class:"w-full flex flex-col min-h-screen"},Y={class:"flex flex-col gap-6 w-full max-w-[766px] mx-auto pt-6 pb-12 px-4"},Z={class:"flex items-center justify-between"},ee={class:"flex items-center gap-2"},te={class:"font-bold text-lg"},se={class:"border border-base-300 rounded-xl p-5 flex flex-col gap-3 bg-base-100"},ae={class:"text-xl font-bold"},oe={class:"flex flex-wrap items-center gap-3 text-sm text-base-content/60"},ne={key:0},le={key:1},re={key:2},ie={key:0,class:"flex flex-col gap-4"},de={key:1,class:"flex flex-col gap-4"},ce={class:"text-lg font-semibold"},ue={class:"flex w-full h-2 rounded-full overflow-hidden"},me={class:"flex flex-col gap-3"},pe={class:"flex flex-col gap-1 min-w-0"},_e={class:"font-medium text-sm"},fe={key:0,class:"text-xs text-base-content/60"},ge={key:1,class:"text-xs text-base-content/40"},ye={key:2,class:"text-xs text-base-content/40"},xe={key:3,class:"text-xs text-base-content/40"},ve=["disabled"],he={key:0,class:"loading loading-spinner loading-sm"},We=L({__name:"create",setup(be){const{t:o}=j(),b=z(),w=A(),W=H(),r=O(),u=h(!1),x=h(!1),f=h([]),g=["#FF9500","#FF3B30","#34C759","#007AFF"],t=D(()=>({title:r.title,presetType:r.presetType,durationWeeks:r.durationWeeks,writingDays:r.writingDays,dailyDuration:r.dailyDuration,wordGoal:r.wordGoal,cardGoal:r.cardGoal,reminderEnabled:r.reminderEnabled,reminderTime:r.reminderTime,startDate:r.startDate,assessment:r.assesement})),v=D(()=>!!r.presetType||!!r.title),F=async()=>{var p;if(!v.value)return;x.value=!0;const c=await P.writingPlan.preview({author:(p=w.user)==null?void 0:p.id,presetType:t.value.presetType||"custom",durationWeeks:t.value.durationWeeks,writingDays:t.value.writingDays,dailyDuration:t.value.dailyDuration,wordGoal:t.value.wordGoal,cardGoal:t.value.cardGoal,startDate:t.value.startDate});c.success&&c.data&&(f.value=c.data.phases||[]),x.value=!1},E=async()=>{if(u.value)return;u.value=!0;const c=await P.writingPlan.create({author:w.user.id,presetType:t.value.presetType||"custom",title:t.value.title,durationWeeks:t.value.durationWeeks,writingDays:t.value.writingDays,dailyDuration:t.value.dailyDuration,wordGoal:t.value.wordGoal,cardGoal:t.value.cardGoal,reminderEnabled:t.value.reminderEnabled,reminderTime:t.value.reminderTime,startDate:t.value.startDate,space:W.currentSpaceId,assessment:t.value.assessment,status:1});c.success&&c.data?(K.fromJson(c.data),r.reset(),b.replace("/writing-plan")):Q.error(o("message.createPlanFailed")),u.value=!1};return v.value&&F(),(c,p)=>{const N=R,B=U,I=q,k=M,V=$;return s(),n(y,null,[_(B,null,{default:G(()=>[_(N,null,{default:G(()=>[T(l(e(o)("common.pageTitleTemplate",{title:e(t).title||e(o)("message.planDetail")})),1)]),_:1})]),_:1}),a("div",X,[a("div",Y,[a("div",Z,[a("div",ee,[a("button",{class:"btn btn-ghost btn-sm gap-1 btn-circle",onClick:p[
10]||(p[0]=i=>e(b).back())},[_(I,{name:"ph:caret-left"})]),a("h1",te,l(e(o)("message.planPreview")),1)])]),e(v)?(s(),n(y,{key:0},[a("div",se,[a("h1",ae,l(e(t).title),1),a("div",oe,[a("span",null,l(e(o)("message.planWeeks",{n:e(t).durationWeeks})),1),e(t).wordGoal>0?(s(),n("span",ne,l(e(o)("message.nTenThousandWords",{n:(e(t).wordGoal/1e4).toFixed(1)})),1)):d("",!0),e(t).cardGoal>0?(s(),n("span",le,l(e(o)("message.nCards",{n:e(t).cardGoal})),1)):d("",!0),e(t).startDate?(s(),n("span",re,l(e(o)("message.planStartDate")+": "+e(t).startDate),1)):d("",!0)])]),e(x)?(s(),n("div",ie,[_(k,{rows:3,animated:""}),_(k,{rows:2,animated:""})])):d("",!0),e(f).length>0?(s(),n("div",de,[a("h2",ce,l(e(o)("message.trainingPhases")),1),a("div",ue,[(s(!0),n(y,null,C(e(f),(i,m)=>(s(),n("div",{key:"bar-"+m,class:"h-full",style:S({flex:1,backgroundColor:g[m%g.length]})},null,4))),128))]),a("div",me,[(s(!0),n(y,null,C(e(f),(i,m)=>(s(),n("div",{key:m,class:"border border-base-300 rounded-xl p-4 flex items-start gap-3 bg-base-100"},[a("div",{class:"w-1 self-stretch rounded-full shrink-0",style:S({backgroundColor:g[m%g.length]})},null,4),a("div",pe,[a("span",_e,l(e(o)("message.phaseN",{n:m+1}))+" · "+l(i.name),1),i.description?(s(),n("span",fe,l(i.description),1)):d("",!0),i.dailyWordGoal>0?(s(),n("span",ge,l(e(o)("message.dailyGoalWords",{n:i.dailyWordGoal})),1)):d("",!0),i.dailyCardGoal>0?(s(),n("span",ye,l(e(o)("message.dailyGoalCards",{n:i.dailyCardGoal})),1)):d("",!0),i.dailyDuration>0?(s(),n("span",xe,l(e(o)("message.dailyGoalDuration",{n:i.dailyDuration})),1)):d("",!0)])]))),128))])])):d("",!0),a("button",{class:"btn btn-primary w-full",disabled:e(u),onClick:E},[e(u)?(s(),n("span",he)):d("",!0),T(" "+l(e(u)?e(o)("message.generatingPlan"):e(o)("message.startPlan")),1)],8,ve)],64)):(s(),J(V,{key:1,description:e(o)("message.planNotFound")},null,8,["description"]))])])],64)}}});export{We as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.