1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,90405,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},53996,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return l},searchParamsToUrlQuery:function(){return o},urlQueryToSearchParams:function(){return s}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});function o(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function s(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,i(e));else t.set(r,i(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},55020,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return s},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=e.r(88835)._(e.r(53996)),i=/https?|ftp|gopher|file/;function s(e){let{auth:t,hostname:r}=e,n=e.protocol||"",a=e.pathname||"",s=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(o.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||i.test(n))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),s&&"#"!==s[0]&&(s="#"+s),c&&"?"!==c[0]&&(c="?"+c),a=a.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${a}${c}${s}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return s(e)}},45707,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return a}});let n=e.r(34346);function a(e,t){let r=(0,n.useRef)(null),a=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=a.current;t&&(a.current=null,t())}else e&&(r.current=o(e,n)),t&&(a.current=o(t,n))},[e,t])}function o(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},70715,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return v},MissingStaticPage:function(){return j},NormalizeError:function(){return y},PageNotFoundError:function(){return b},SP:function(){return m},ST:function(){return x},WEB_VITALS:function(){return o},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return f},loadGetInitialProps:function(){return h},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return N}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let s=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>s.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function h(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await h(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let m="undefined"!=typeof performance,x=m&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class y extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class j extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class v extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function N(e){return JSON.stringify({message:e.message,stack:e.stack})}},17485,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return o}});let n=e.r(70715),a=e.r(57352);function o(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},85893,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},3965,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return g},useLinkStatus:function(){return b}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let o=e.r(88835),i=e.r(36792),s=o._(e.r(34346)),l=e.r(55020),u=e.r(12569),c=e.r(45707),d=e.r(70715),f=e.r(19664);e.r(90405);let p=e.r(44164),h=e.r(17485),m=e.r(36283);function x(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}function g(t){var r;let n,a,o,[l,g]=(0,s.useOptimistic)(p.IDLE_LINK_STATUS),b=(0,s.useRef)(null),{href:j,as:v,children:N,prefetch:P=null,passHref:C,replace:O,shallow:_,scroll:S,onClick:w,onMouseEnter:E,onTouchStart:T,legacyBehavior:k=!1,onNavigate:L,ref:R,unstable_dynamicOnHover:M,...A}=t;n=N,k&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let I=s.default.useContext(u.AppRouterContext),U=!1!==P,$=!1!==P?null===(r=P)||"auto"===r?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,{href:F,as:B}=s.default.useMemo(()=>{let e=x(j);return{href:e,as:v?x(v):e}},[j,v]);if(k){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});a=s.default.Children.only(n)}let D=k?a&&"object"==typeof a&&a.ref:R,z=s.default.useCallback(e=>(null!==I&&(b.current=(0,p.mountLinkInstance)(e,F,I,$,U,g)),()=>{b.current&&((0,p.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,p.unmountPrefetchableInstance)(e)}),[U,F,I,$,g]),K={ref:(0,c.useMergedRef)(z,D),onClick(t){k||"function"!=typeof w||w(t),k&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(t),!I||t.defaultPrevented||function(t,r,n,a,o,i,l){if("undefined"!=typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,h.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(35686);s.default.startTransition(()=>{d(n||r,o?"replace":"push",i??!0,a.current)})}}(t,F,B,b,O,S,L)},onMouseEnter(e){k||"function"!=typeof E||E(e),k&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),I&&U&&(0,p.onNavigationIntent)(e.currentTarget,!0===M)},onTouchStart:function(e){k||"function"!=typeof T||T(e),k&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),I&&U&&(0,p.onNavigationIntent)(e.currentTarget,!0===M)}};return(0,d.isAbsoluteUrl)(B)?K.href=B:k&&!C&&("a"!==a.type||"href"in a.props)||(K.href=(0,f.addBasePath)(B)),o=k?s.default.cloneElement(a,K):(0,i.jsx)("a",{...A,...K,children:n}),(0,i.jsx)(y.Provider,{value:l,children:o})}e.r(85893);let y=(0,s.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,s.useContext)(y);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},27458,e=>{"use strict";let t=(0,e.i(27706).default)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",()=>t],27458)},35904,e=>{"use strict";var t=e.i(36792),r=e.i(69744);function n({className:e,...n}){return(0,t.jsx)("textarea",{"data-slot":"textarea",className:(0,r.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",e),...n})}e.s(["Textarea",()=>n])},59173,e=>{"use strict";var t=e.i(36792),r=e.i(34346),n=e.i(69074),a=e.i(87830),o=e.i(82772),i=e.i(9991),s=e.i(77627),l=e.i(75985),u=e.i(35904),c=e.i(10743),d=e.i(12039);let f=(0,e.i(27706).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 p=e.i(3965);function h(){let e=(0,n.useRouter)(),{data:h}=(0,a.useSession)(),[m,x]=(0,r.useState)(""),[g,y]=(0,r.useState)(""),[b,j]=(0,r.useState)(""),[v,N]=(0,r.useState)(!1),P=async e=>{if(e.preventDefault(),!m.trim())return void j("请输入家族树名称");j(""),N(!0);try{let e=await fetch("/api/trees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:m.trim(),description:g.trim()||void 0})}),t=await e.json();if(!e.ok)throw Error(t.error||"创建失败");window.location.href=`/?treeId=${t.tree.id}`}catch(e){j(e.message||"创建失败,请稍后重试")}finally{N(!1)}};return h?(0,t.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,t.jsx)(o.SiteHeader,{}),(0,t.jsx)("main",{className:"container mx-auto py-12 px-4 md:px-6 flex-1",children:(0,t.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,t.jsxs)("div",{className:"mb-8 text-center",children:[(0,t.jsx)("h1",{className:"text-4xl font-serif font-light mb-3 tracking-wide",children:"创建家族树"}),(0,t.jsx)("p",{className:"text-muted-foreground font-light",children:"记录家族历史,传承家族文化"})]}),(0,t.jsx)(c.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:(0,t.jsxs)("form",{onSubmit:P,children:[(0,t.jsxs)(c.CardHeader,{className:"text-center pb-8",children:[(0,t.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,t.jsx)(f,{className:"h-8 w-8",strokeWidth:1.5})}),(0,t.jsx)(c.CardTitle,{className:"text-2xl font-serif font-light",children:"基本信息"}),(0,t.jsx)(c.CardDescription,{className:"font-light",children:"填写家族树的名称和描述"})]}),(0,t.jsxs)(c.CardContent,{className:"space-y-8 px-8",children:[b&&(0,t.jsx)(d.Alert,{variant:"destructive",children:(0,t.jsx)(d.AlertDescription,{children:b})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)(l.Label,{htmlFor:"name",className:"text-base font-normal",children:["家族树名称 ",(0,t.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,t.jsx)(s.Input,{id:"name",placeholder:"例如:王氏家族、李氏宗谱",value:m,onChange:e=>x(e.target.value),maxLength:50,required:!0,className:"h-12"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground font-light",children:"建议使用姓氏+家族/宗谱等命名"})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(l.Label,{htmlFor:"description",className:"text-base font-normal",children:"家族树描述(可选)"}),(0,t.jsx)(u.Textarea,{id:"description",placeholder:"简要描述您的家族历史、祖籍地等信息",value:g,onChange:e=>y(e.target.value),rows:4,maxLength:500,className:"resize-none"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground font-light",children:[g.length,"/500 字"]})]}),(0,t.jsx)("div",{className:"rounded-lg bg-muted/30 p-6 space-y-2",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground font-light leading-relaxed",children:"创建后可以随时修改信息、邀请家族成员协作编辑、导入已有数据"})})]}),(0,t.jsxs)(c.CardFooter,{className:"flex gap-4 px-8 pt-8 pb-8",children:[(0,t.jsx)(i.Button,{type:"button",variant:"outline",onClick:()=>e.back(),disabled:v,className:"flex-1 h-12",children:"返回"}),(0,t.jsx)(i.Button,{type:"submit",disabled:v||!m.trim(),className:"flex-1 h-12 bg-primary text-primary-foreground hover:bg-primary/90",children:v?"创建中...":"创建家族树"})]})]})})]})})]}):(0,t.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,t.jsx)(o.SiteHeader,{}),(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsxs)(c.Card,{className:"w-full max-w-md mx-4",children:[(0,t.jsxs)(c.CardHeader,{children:[(0,t.jsx)(c.CardTitle,{children:"需要登录"}),(0,t.jsx)(c.CardDescription,{children:"请先登录后再创建家族树"})]}),(0,t.jsx)(c.CardFooter,{children:(0,t.jsx)(i.Button,{asChild:!0,className:"w-full",children:(0,t.jsx)(p.default,{href:"/auth/signin",children:"前往登录"})})})]})})]})}e.s(["default",()=>h],59173)}]); |