import{c as E,d as oe,f as Q,r as P,j as e,B as z,ae as ce,H as F,S as Z,aa as ee,P as te,a6 as de,ac as O,I as U,T as me,ad as xe,v as ue}from"./index-DLLvDi5q.js";import{C as J,a as X,b as Y}from"./card-DFL6pamx.js";/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pe=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],he=E("ArrowDown",pe);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ye=E("ArrowUp",fe);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ge=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ke=E("ChevronRight",ge);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const be=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],je=E("GripVertical",be);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ve=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ne=E("PanelRightClose",ve);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const we=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Ce=E("PanelRightOpen",we);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Se=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],_e=E("Printer",Se),M=[{key:"info",defaultTitle:"基本信息",kind:"info",fixed:!0},{key:"education",defaultTitle:"教育经历",kind:"edu",fixed:!0},{key:"skills",defaultTitle:"核心技能",kind:"text"},{key:"projects",defaultTitle:"项目经历",kind:"list",types:["竞赛","科研","实习实践"]},{key:"certs",defaultTitle:"证书与荣誉",kind:"list",types:["荣誉惩处","证书技能"]},{key:"campus",defaultTitle:"在校经历",kind:"list",types:["学生工作","志愿公益"]},{key:"activity",defaultTitle:"文体活动",kind:"list",types:["文体活动"]},{key:"other",defaultTitle:"其他经历",kind:"list"},{key:"self",defaultTitle:"自我评价",kind:"text",fixed:!0}],L={skills:{text:`路由交换:熟悉TCP/IP协议栈与基础路由交换,掌握VLAN、链路聚合、MSTP、VRRP/VRRP6等园区网冗余技术,熟悉OSPF、RIP、BGP等动态路由协议,具备IPv4/IPv6双栈网络的规划与部署能力。 网络安全:熟悉防火墙安全区域、ACL访问控制与安全策略配置,掌握NAPT、NAT Server、NAT64地址转换,了解GRE over IPsec隧道与防火墙双机热备。 网络设备:熟悉华为交换机、路由器、防火墙CLI操作与配置,掌握GVRP、MSTP、VRRP、链路聚合及BFD联动快速收敛,熟悉Wireshark抓包分析。 运维基础:熟悉RedHat、Ubuntu等Linux系统部署与日常维护,了解Docker、K8s、Prometheus等云原生运维工具。`},campus:{items:[{title:"学校图书馆 勤工俭学固定岗",subtitle:"图书管理员",date:"2024.12 - 2026.7",desc:"负责图书上架、整理和维护,定时进行馆内安全巡检,协助读者检索和借阅服务,累计服务读者超2000人次,零服务投诉。这段经历培养了高度的责任意识与服务意识,锻炼了高效执行和多任务时间管理能力。"},{title:"学院团总支学生会宣传部 干事",subtitle:"视觉设计",date:"2023.9 - 2024.9",desc:"独立完成学院活动海报、邀请函、KT板、易拉宝等40余份宣传物料设计,参与换届大会、迎新、毕业季等重大活动视觉设计与宣传品制作。负责报告厅后台多媒体设备控制,保障12场大型活动视觉呈现零失误,锻炼了应急处置能力与谨慎细致的工作态度。"}]},self:{text:"心态沉稳、抗压能力较好,遇到突发状况能冷静应对、稳住局面。做事有计划性,习惯提前预判风险并做好预案,追求稳妥与确定性,执行质量有保障,能在压力下保持稳定输出。责任心强,凡事有始有终,注重细节与条理,能在复杂环境中稳步推进工作,是一名可靠、值得信赖的执行者。"}};function H(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:M.map(l=>({key:l.key,title:l.defaultTitle,enabled:!0,kind:l.kind,types:l.types,...l.key==="skills"?{text:L.skills.text}:{},...l.key==="campus"?{items:L.campus.items}:{},...l.key==="self"?{text:L.self.text}:{}}))}}function se(l){const a=H();if(!l||typeof l!="object")return a;const h=l,j=Array.isArray(h.sections)?h.sections:[],d=a.sections.map(n=>{var v;const p=j.find(c=>c.key===n.key),N=M.find(c=>c.key===n.key),w={...n,enabled:(p==null?void 0:p.enabled)??!0,title:(p==null?void 0:p.title)??(N==null?void 0:N.defaultTitle)??n.title};return n.key==="skills"&&!w.text&&(w.text=L.skills.text),n.key==="campus"&&!((v=w.items)!=null&&v.length)&&(w.items=L.campus.items),n.key==="self"&&!w.text&&(w.text=L.self.text),w});for(const n of j)d.some(p=>p.key===n.key)||d.push({key:n.key,title:n.title||n.key,enabled:n.enabled??!0,kind:"text",text:""});return{version:2,template:h.template??"tech",accent:h.accent??"#3056d3",fontScale:Math.min(1.2,Math.max(.8,h.fontScale??1)),density:h.density??"normal",onePage:h.onePage??!1,sections:d}}function Pe(){return M.filter(l=>l.types).flatMap(l=>l.types)}function Re(l){const a=[l.organizer,l.level,l.award_grade].filter(j=>j!=null&&j!=="").map(String).join(" · "),h=[l.result,l.description].filter(j=>j!=null&&j!=="").map(String).join(" — ");return{title:l.title,subtitle:a||void 0,date:l.start_date??l.created_at.slice(0,10),desc:h||void 0,fromRecord:l.id}}function ne(l,a){const h=[],j=Pe();for(const d of a.sections){if(!d.enabled)continue;const n=M.find(c=>c.key===d.key);if(d.key==="info"){h.push({key:d.key,title:d.title,kind:"info"});continue}if(d.key==="self"||d.kind==="text"){h.push({key:d.key,title:d.title,kind:"text",text:d.text??""});continue}const p=new Set(d.excluded??[]);let N=[];const w=n==null?void 0:n.types;w?N=l.filter(c=>w.includes(c.type_name)&&c.status!=="draft"&&!p.has(c.id)):N=l.filter(c=>c.status!=="draft"&&!p.has(c.id)&&!j.includes(c.type_name));const v=N.map(Re).filter(c=>!c.fromRecord||!p.has(c.fromRecord)).map(c=>{var y;return{...c,...((y=d.overrides)==null?void 0:y[String(c.fromRecord)])??{}}});for(const c of d.items??[])v.push({...c});v.sort((c,y)=>(y.date??"").localeCompare(c.date??"")),v.length&&h.push({key:d.key,title:d.title,kind:"list",items:v})}return h}const ae=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],le=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],S=l=>String(l??"").replace(/&/g,"&").replace(//g,">");function Te(l,a,h,j){const d=h.fontScale,n=y=>(y*d).toFixed(1)+"pt",p=h.accent,N={classic:"font-size:"+n(14)+";border-bottom:1.5pt solid #333;padding-bottom:3pt;margin:12pt 0 6pt;color:#111",tech:"font-size:"+n(14)+";color:"+p+";border-left:3pt solid "+p+";padding-left:6pt;margin:12pt 0 6pt",minimal:"font-size:"+n(11.5)+";color:#555;letter-spacing:1.5pt;text-transform:uppercase;margin:14pt 0 6pt"},w=l.map(y=>{let o="";if(y.kind==="info"){const u=[["姓名",b(a).name],["性别",b(a).gender],["出生年月",b(a).birth],["民族",b(a).nation],["籍贯",b(a).native],["政治面貌",b(a).political],["学校",b(a).school],["学院",b(a).college],["专业",b(a).major],["班级",b(a).className],["学号",b(a).studentId],["学历",b(a).degree],["手机",b(a).phone],["邮箱",b(a).email]].filter(C=>C[1]!=="");o=''+u.map(([C,r],I)=>(I%2===0?"":"")+'"+(I%2===1?"":"")).join("")+"
'+S(C)+''+S(r)+"
"}else if(y.kind==="edu"){const u=[["学校",a.school??""],["专业",a.major??""],["学制",a.eduLength??""],["学历",a.degree??""],["入学",a.eduStart??""],["毕业",a.eduEnd??""]].filter(C=>C[1]!=="");o=''+u.map(function(C){return'"}).join("")+"
'+S(C[0])+''+S(C[1])+"
"+(a.majorCourses?'
主修课程:'+S(a.majorCourses)+"
":"")}else y.kind==="list"?o='
'+(y.items??[]).map(u=>{const C=u.subtitle?'
'+S(u.subtitle)+"
":"",r=u.desc?'
'+S(u.desc)+"
":"";return'
'+S(u.title)+''+S(u.date??"")+"
"+C+r+"
"}).join("")+"
":o='

'+S(y.text??"")+"

";return'

'+S(y.title)+"

"+o}).join(""),v=j&&a.photoUrl?'
证件照
':"",c=[b(a).school,b(a).college,b(a).major,b(a).degree].filter(y=>y!=="").map(y=>S(y)).join(" · ");return''+S(b(a).name||"个人简历")+'

'+S(b(a).name||"个人简历")+"

"+v+"
"+(c?'
'+c+"
":"")+w+""}function b(l){return l??{}}const ze=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:le,RESUME_SECTION_DEFS:M,TEMPLATES:ae,assembleSections:ne,defaultResumeConfig:H,migrateResumeConfig:se,resumeToWordHtml:Te},Symbol.toStringTag,{value:"Module"}));function T({html:l,onCommit:a,className:h}){const j=l.replace(/&/g,"&").replace(//g,">");return e.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,className:"outline-none rounded-sm transition-shadow focus:shadow-[0_0_0_1.5px_rgba(48,86,211,0.5)] cursor-text "+(h??""),dangerouslySetInnerHTML:{__html:j},onBlur:d=>{const n=(d.currentTarget.textContent??"").trim();n!==l&&a(n)}})}function Me(){var W,G,$;const l=oe(),a=Q({queryKey:["profile"],queryFn:xe}),h=Q({queryKey:["resume-records"],queryFn:()=>ue({page:1,page_size:500})}),[j,d]=P.useState(null),[n,p]=P.useState(""),[N,w]=P.useState(!0),[v,c]=P.useState(new Set),[y,o]=P.useState(1),u=P.useRef(null),C=P.useRef(null);P.useEffect(()=>{var m,s;const t=(m=a.data)==null?void 0:m.content;t&&(d(se(t.resume)),p(((s=t.info)==null?void 0:s.selfIntro)??""))},[a.data]);const r={...((G=(W=a.data)==null?void 0:W.content)==null?void 0:G.info)??{}},I=(($=h.data)==null?void 0:$.items)??[],i=j??H(),K={...r,selfIntro:n},D=P.useMemo(()=>ne(I,i),[I,i]),V=(t,m)=>d(s=>{if(!s)return s;const f=[...s.sections],k=t+m;return k<0||k>=f.length?s:([f[t],f[k]]=[f[k],f[t]],{...s,sections:f})}),_=t=>{d(t),O({info:{...r,selfIntro:n},resume:t}).catch(m=>l("error",m.message))},A=t=>{d(m=>{const s=m??i,f=s.sections.map(x=>{var g;if(x.key!==t.secKey)return x;if(t.field==="text")return{...x,text:t.value};if(t.fromRecord!=null){const R={...((g=x.overrides)==null?void 0:g[t.fromRecord])??{},[t.field]:t.value};return{...x,overrides:{...x.overrides??{},[t.fromRecord]:R}}}if(t.itemIdx!=null&&x.items){const R=[...x.items];return R[t.itemIdx]={...R[t.itemIdx],[t.field]:t.value},{...x,items:R}}return x}),k={...s,sections:f};return O({info:{...r,selfIntro:n},resume:k}).catch(x=>l("error",x.message)),k})},B=(t,m)=>{O({info:{...K,[t]:m}}).then(()=>a.refetch()).catch(s=>l("error",s.message))};P.useEffect(()=>{if(!i.onePage){o(1);return}const t=u.current;if(!t)return;const m=1043,s=t.scrollHeight;o(s>m?Math.max(.7,m/s):1)},[i.onePage,i.fontScale,i.density,D]);const q=i.fontScale*(i.onePage?y:1),ie=()=>{de(()=>Promise.resolve().then(()=>ze),void 0).then(function(t){const m=t.resumeToWordHtml(D,K,i,r.photoUrl),s=new Blob(["\uFEFF"+m],{type:"application/msword"}),f=URL.createObjectURL(s),k=document.createElement("a");k.href=f,k.download=(r.name||"个人简历")+".doc",k.click(),setTimeout(()=>URL.revokeObjectURL(f),6e4),l("success","Word 文档已导出")})},re=t=>{var m,s;return((s=(m=M.find(f=>f.key===t))==null?void 0:m.types)==null?void 0:s.join(" / "))??"固定板块"};return e.jsxs("div",{className:"mx-auto max-w-[1280px] px-3 py-4 sm:px-6 sm:py-5",children:[e.jsxs("div",{className:"no-print mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-ink-1",children:"我的简历"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(z,{variant:"secondary",onClick:()=>w(t=>!t),children:[N?e.jsx(Ne,{size:13}):e.jsx(Ce,{size:13}),N?"收起设置":"展开设置"]}),e.jsxs(z,{variant:"secondary",onClick:ie,children:[e.jsx(ce,{size:13})," 导出 Word"]}),e.jsxs(z,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(_e,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(N?"lg:grid-cols-[1fr_340px]":"grid-cols-1"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"print-sheet mx-auto w-full max-w-[794px] rounded-lg border border-line bg-white shadow-card",style:{minHeight:i.onePage?1123:void 0},children:e.jsxs("div",{ref:u,className:"p-8 sm:p-10 resume-tpl-"+i.template,style:{zoom:q,"--accent":i.accent},children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-[26px] font-bold leading-tight "+(i.template==="tech"?"text-[var(--accent)]":"text-neutral-900"),children:r.name||"姓名"}),e.jsx("div",{className:"mt-1.5 text-[12.5px] text-neutral-500",children:[r.school,r.college,r.major,r.degree].filter(Boolean).join(" · ")||"完善个人信息后自动展示"}),e.jsx("div",{className:"mt-1 text-[12px] text-neutral-500",children:[r.phone,r.email,r.homepage].filter(Boolean).join(" · ")})]}),r.photoUrl&&e.jsx("img",{src:r.photoUrl,alt:"证件照",className:"h-[110px] w-[82px] rounded border border-neutral-200 object-cover"})]}),D.map(t=>{var m;return e.jsxs("div",{className:"mb-5 r-sec",children:[e.jsx("div",{className:"r-sec-title mb-2.5 text-[14px] font-bold text-neutral-900",children:e.jsx(T,{html:t.title,onCommit:s=>A({secKey:t.key,field:"title",value:s})})}),t.kind==="edu"?e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["学校",r.school,"school"],["专业",r.major,"major"],["学制",r.eduLength,"eduLength"],["学历",r.degree,"degree"],["入学",r.eduStart,"eduStart"],["毕业",r.eduEnd,"eduEnd"]].filter(s=>s[1]).map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:s[0]}),e.jsx(T,{html:s[1]??"",onCommit:f=>B(s[2],f)})]},s[0]))}),r.majorCourses&&e.jsxs("p",{className:"mt-2.5 text-[12.5px] leading-relaxed text-neutral-700",children:[e.jsx("b",{children:"主修课程:"}),e.jsx(T,{html:r.majorCourses,onCommit:s=>B("majorCourses",s)})]})]}):t.kind==="info"?e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["姓名",r.name],["性别",r.gender],["出生年月",r.birth],["民族",r.nation],["籍贯",r.native],["政治面貌",r.political],["班级",r.className],["学号",r.studentId],["手机",r.phone],["邮箱",r.email]].filter(s=>s[1]).map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:s[0]}),e.jsx("span",{children:s[1]})]},s[0]))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-neutral-700 "+(i.density==="compact"?"":"leading-relaxed"),children:e.jsx(T,{html:t.text??"",onCommit:s=>A({secKey:t.key,field:"text",value:s})})}):e.jsx("div",{className:i.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(m=t.items)==null?void 0:m.map((s,f)=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-semibold text-neutral-900 r-item-title",children:e.jsx(T,{html:s.title,onCommit:k=>A({secKey:t.key,field:"title",value:k,itemIdx:f,fromRecord:s.fromRecord})})}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:e.jsx(T,{html:s.date??"",onCommit:k=>A({secKey:t.key,field:"date",value:k,itemIdx:f,fromRecord:s.fromRecord})})})]}),s.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:s.subtitle}),s.desc&&e.jsx("p",{className:"text-[12px] text-neutral-500 "+(i.density==="compact"?"":"mt-0.5"),children:e.jsx(T,{html:s.desc,onCommit:k=>A({secKey:t.key,field:"desc",value:k,itemIdx:f,fromRecord:s.fromRecord})})})]},(s.title??"")+(s.date??"")+f))})]},t.key)})]})}),i.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(q*100),"% 以适配单页 A4"]})]}),N&&e.jsxs("div",{className:"no-print flex flex-col gap-4 lg:sticky lg:top-4 lg:max-h-[calc(100vh-2rem)] lg:self-start lg:overflow-y-auto lg:pr-1",children:[e.jsxs(J,{children:[e.jsx(X,{title:"模板与风格"}),e.jsxs(Y,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:ae.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(i.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>_({...i,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(i.template===t.key?"text-brand-text":"text-ink-1"),children:t.name}),e.jsx("div",{className:"text-[11px] text-ink-3",children:t.desc})]},t.key))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(F,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:le.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(i.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>_({...i,accent:t})},t))})}),e.jsx(F,{label:"字号",children:e.jsx(Z,{value:String(i.fontScale),onChange:t=>_({...i,fontScale:Number(t.target.value)}),options:[{value:"0.9",label:"小"},{value:"1",label:"标准"},{value:"1.1",label:"大"}]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(F,{label:"间距",children:e.jsx(Z,{value:i.density,onChange:t=>_({...i,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(F,{label:"单页限定",children:e.jsx("button",{className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-md border text-[12px] transition-colors "+(i.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>_({...i,onePage:!i.onePage}),children:i.onePage?"已开启":"已关闭"})})]})]})]}),e.jsxs(J,{children:[e.jsx(X,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 点击预览可改内容"})}),e.jsx(Y,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[i.sections.map((t,m)=>{var k;const s=v.has(t.key),f=t.kind==="info"?"固定":t.kind==="text"?"文本":t.kind==="edu"?"教育":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{C.current=t.key},onDragOver:x=>x.preventDefault(),onDrop:()=>{const x=i.sections.findIndex(g=>g.key===C.current);if(x>=0&&x!==m){const g=[...i.sections],R=g.splice(x,1)[0];g.splice(m,0,R),_({...i,sections:g})}C.current=null},className:"bg-surface "+(C.current===t.key?"opacity-40":""),children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[e.jsx(je,{size:13,className:"shrink-0 cursor-grab text-ink-3"}),e.jsx("input",{className:"min-w-0 flex-1 rounded-sm border border-transparent bg-transparent px-1 py-0.5 text-[12.5px] font-medium text-ink-1 hover:border-line focus:border-brand focus:outline-none",value:t.title,onChange:x=>_({...i,sections:i.sections.map(g=>g.key===t.key?{...g,title:x.target.value}:g)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:m===0,onClick:()=>V(m,-1),children:e.jsx(ye,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:m===i.sections.length-1,onClick:()=>V(m,1),children:e.jsx(he,{size:12})}),e.jsx("button",{className:"ml-0.5 rounded-sm border px-1.5 py-0.5 text-[11px] transition-colors "+(t.enabled?"border-brand/40 bg-brand-subtle text-brand-text":"border-line bg-surface-2 text-ink-3"),onClick:()=>_({...i,sections:i.sections.map(x=>x.key===t.key?{...x,enabled:!x.enabled}:x)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>c(x=>{const g=new Set(x);return g.has(t.key)?g.delete(t.key):g.add(t.key),g}),children:e.jsx(ke,{size:13,className:"transition-transform "+(s?"rotate-90":"")})})]}),s&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(ee,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:x=>_({...i,sections:i.sections.map(g=>g.key===t.key?{...g,text:x.target.value}:g)})}):t.kind==="list"?e.jsx(Ee,{cfg:i,section:t,records:I,persist:_,sectionTypes:re(t.key)}):e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"该板块内容来自「个人信息」页与记录数据。"})}),e.jsxs("div",{className:"px-3 pb-1.5 text-[10.5px] text-ink-3",children:[f,(k=t.types)!=null&&k.length?" · "+t.types.join("/"):""]})]},t.key)}),e.jsx("div",{className:"p-3",children:e.jsxs(z,{size:"sm",variant:"secondary",className:"w-full",onClick:()=>{const t="custom_"+Date.now();_({...i,sections:[...i.sections,{key:t,title:"自定义板块",enabled:!0,kind:"text",text:""}]}),c(m=>new Set(m).add(t))},children:[e.jsx(te,{size:13})," 新增文本板块"]})})]})})]})]})]})]})}function Ee({cfg:l,section:a,records:h,persist:j,sectionTypes:d}){const[n,p]=P.useState(null),N=new Set(a.excluded??[]),w=h.filter(o=>(a.types??[]).includes(o.type_name)&&o.status!=="draft").sort((o,u)=>(u.start_date??u.created_at).localeCompare(o.start_date??o.created_at)),v=a.items??[],c=o=>j({...l,sections:l.sections.map(u=>u.key===a.key?{...u,...o}:u)}),y=o=>{const u=new Set(a.excluded??[]);u.has(o)?u.delete(o):u.add(o),c({excluded:[...u]})};return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"来自记录的条目(勾选 = 显示)· 另可添加自定义条目"}),w.map(o=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!N.has(o.id),onChange:()=>y(o.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:o.title}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(o.start_date??"").slice(0,7)})]},o.id)),e.jsxs("div",{className:"mt-1 border-t border-line pt-2",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11.5px] font-medium text-ink-2",children:["自定义条目(",v.length,")"]}),e.jsxs(z,{size:"sm",variant:"ghost",onClick:()=>p({title:""}),children:[e.jsx(te,{size:12})," 添加"]})]}),n&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(U,{className:"mb-1.5",placeholder:"标题",value:n.title,onChange:o=>p({...n,title:o.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(U,{placeholder:"副标题(单位/角色)",value:n.subtitle??"",onChange:o=>p({...n,subtitle:o.target.value})}),e.jsx(U,{placeholder:"日期(2025.9)",value:n.date??"",onChange:o=>p({...n,date:o.target.value})})]}),e.jsx(ee,{rows:2,placeholder:"描述:做了什么、负责什么、学会什么",value:n.desc??"",onChange:o=>p({...n,desc:o.target.value})}),e.jsxs("div",{className:"mt-1.5 flex gap-1.5",children:[e.jsx(z,{size:"sm",variant:"primary",disabled:!n.title.trim(),onClick:()=>{n.title.trim()&&(c({items:[...v,n]}),p(null))},children:"添加"}),e.jsx(z,{size:"sm",variant:"ghost",onClick:()=>p(null),children:"取消"})]})]}),v.map((o,u)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-line bg-surface p-1.5 text-[12px]",children:[e.jsxs("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:[o.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",o.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>c({items:v.filter((C,r)=>r!==u)}),children:e.jsx(me,{size:12})})]},u)),!v.length&&!n&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",d,"」相关条目来自你的记录数据,此处可隐藏不需要展示的条目;描述可在预览中点击直接修改。"]})]})}export{Me as ResumePage};