module.exports=[12576,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored["react-ssr"].ReactServerDOMTurbopackClient},29173,(a,b,c)=>{b.exports=a.x("@prisma/client",()=>require("@prisma/client"))},98414,a=>{"use strict";var b=a.i(6155),c=a.i(12348);function d({className:a,...d}){return(0,b.jsx)("textarea",{"data-slot":"textarea",className:(0,c.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),...d})}a.s(["Textarea",()=>d])},45522,a=>{"use strict";var b=a.i(6155),c=a.i(54297),d=a.i(14672),e=a.i(1845),f=a.i(74719),g=a.i(8895),h=a.i(59580),i=a.i(85801),j=a.i(98414),k=a.i(99766),l=a.i(24749);let m=(0,a.i(37111).default)("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);var n=a.i(31483);function o(){let a=(0,d.useRouter)(),{data:o}=(0,e.useSession)(),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(!1),x=async a=>{if(a.preventDefault(),!p.trim())return void u("请输入家族树名称");u(""),w(!0);try{let a=await fetch("/api/trees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),description:r.trim()||void 0})}),b=await a.json();if(!a.ok)throw Error(b.error||"创建失败");window.location.href=`/?treeId=${b.tree.id}`}catch(a){u(a.message||"创建失败,请稍后重试")}finally{w(!1)}};return o?(0,b.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,b.jsx)(f.SiteHeader,{}),(0,b.jsx)("main",{className:"container mx-auto py-12 px-4 md:px-6 flex-1",children:(0,b.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,b.jsxs)("div",{className:"mb-8 text-center",children:[(0,b.jsx)("h1",{className:"text-4xl font-serif font-light mb-3 tracking-wide",children:"创建家族树"}),(0,b.jsx)("p",{className:"text-muted-foreground font-light",children:"记录家族历史,传承家族文化"})]}),(0,b.jsx)(k.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:(0,b.jsxs)("form",{onSubmit:x,children:[(0,b.jsxs)(k.CardHeader,{className:"text-center pb-8",children:[(0,b.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4 mx-auto",children:(0,b.jsx)(m,{className:"h-8 w-8",strokeWidth:1.5})}),(0,b.jsx)(k.CardTitle,{className:"text-2xl font-serif font-light",children:"基本信息"}),(0,b.jsx)(k.CardDescription,{className:"font-light",children:"填写家族树的名称和描述"})]}),(0,b.jsxs)(k.CardContent,{className:"space-y-8 px-8",children:[t&&(0,b.jsx)(l.Alert,{variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:t})}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)(i.Label,{htmlFor:"name",className:"text-base font-normal",children:["家族树名称 ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(h.Input,{id:"name",placeholder:"例如:王氏家族、李氏宗谱",value:p,onChange:a=>q(a.target.value),maxLength:50,required:!0,className:"h-12"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground font-light",children:"建议使用姓氏+家族/宗谱等命名"})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(i.Label,{htmlFor:"description",className:"text-base font-normal",children:"家族树描述(可选)"}),(0,b.jsx)(j.Textarea,{id:"description",placeholder:"简要描述您的家族历史、祖籍地等信息",value:r,onChange:a=>s(a.target.value),rows:4,maxLength:500,className:"resize-none"}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground font-light",children:[r.length,"/500 字"]})]}),(0,b.jsx)("div",{className:"rounded-lg bg-muted/30 p-6 space-y-2",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground font-light leading-relaxed",children:"创建后可以随时修改信息、邀请家族成员协作编辑、导入已有数据"})})]}),(0,b.jsxs)(k.CardFooter,{className:"flex gap-4 px-8 pt-8 pb-8",children:[(0,b.jsx)(g.Button,{type:"button",variant:"outline",onClick:()=>a.back(),disabled:v,className:"flex-1 h-12",children:"返回"}),(0,b.jsx)(g.Button,{type:"submit",disabled:v||!p.trim(),className:"flex-1 h-12 bg-primary text-primary-foreground hover:bg-primary/90",children:v?"创建中...":"创建家族树"})]})]})})]})})]}):(0,b.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,b.jsx)(f.SiteHeader,{}),(0,b.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,b.jsxs)(k.Card,{className:"w-full max-w-md mx-4",children:[(0,b.jsxs)(k.CardHeader,{children:[(0,b.jsx)(k.CardTitle,{children:"需要登录"}),(0,b.jsx)(k.CardDescription,{children:"请先登录后再创建家族树"})]}),(0,b.jsx)(k.CardFooter,{children:(0,b.jsx)(g.Button,{asChild:!0,className:"w-full",children:(0,b.jsx)(n.default,{href:"/auth/signin",children:"前往登录"})})})]})})]})}a.s(["default",()=>o],45522)}]; //# sourceMappingURL=%5Broot-of-the-server%5D__f1b6f610._.js.map