1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,984362,e=>{"use strict";var t=e.i(269938),r=e.i(27565),s=e.i(163362),a=e.i(115102),n=e.i(209165),l=e.i(720690),i=e.i(545035);function o(e){return"image"===e.media_type||e.media_type.includes("image")}function d({selectedUrl:e,onSelect:i}){let c=(0,s.useTranslations)(),[u,x]=(0,r.useState)([]),[p,b]=(0,r.useState)(null),[m,h]=(0,r.useState)(!0),[g,f]=(0,r.useState)(!1),[v,y]=(0,r.useState)(""),_=async e=>{let t=!e;t?h(!0):f(!0);try{y("");let r=await n.api.get("/api/user/ideas/medias",{params:{cursor:e,limit:24}}),s=(r.data.medias??[]).filter(o);x(e=>t?s:[...e,...s]),b(r.data.next_cursor)}catch(e){console.error("Failed to fetch idea medias",e),y(c("user.events.cover_picker_load_failed"))}finally{h(!1),f(!1)}};return((0,r.useEffect)(()=>{_()},[]),m)?(0,t.jsx)("div",{className:"flex min-h-[260px] items-center justify-center text-secondary",children:(0,t.jsx)(a.Spinner,{size:"3"})}):v?(0,t.jsxs)("div",{className:"flex min-h-[220px] flex-col items-center justify-center gap-3 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-bold text-error",children:v}),(0,t.jsx)("button",{type:"button",onClick:()=>_(),className:"rounded-xl border border-border bg-input px-4 py-2 text-xs font-bold text-primary hover:border-brand/40 hover:bg-surface-hover",children:c("user.events.cover_picker_retry")})]}):0===u.length?(0,t.jsx)("div",{className:"flex min-h-[220px] items-center justify-center text-center",children:(0,t.jsx)("p",{className:"max-w-xs text-sm font-semibold text-muted",children:c("user.events.cover_picker_empty_idea")})}):(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:u.map(r=>{let s=e===r.storage_url;return(0,t.jsxs)("button",{type:"button",onClick:()=>i(r.storage_url),className:`group relative overflow-hidden rounded-xl border bg-input transition-all hover:border-brand/50 ${s?"border-brand ring-2 ring-ring":"border-border"}`,style:function(e,t){if(e&&t&&!(e<=0)&&!(t<=0))return{aspectRatio:`${e} / ${t}`}}(r.width,r.height)??{aspectRatio:"4 / 3"},children:[(0,t.jsx)("img",{src:r.storage_url,alt:r.prompt||c("user.events.cover_picker_ai_alt"),loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}),s&&(0,t.jsx)("span",{className:"absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-brand text-brand-foreground shadow-md",children:(0,t.jsx)(l.LuCheck,{className:"h-4 w-4"})}),(0,t.jsx)("span",{className:"absolute inset-x-0 bottom-0 line-clamp-2 bg-black/55 px-2 py-1 text-left text-[10px] font-bold text-white opacity-0 transition-opacity group-hover:opacity-100",children:r.prompt||new Date(r.created_at).toLocaleDateString()})]},r.item_id)})}),p&&(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("button",{type:"button",disabled:g,onClick:()=>_(p),className:"rounded-xl border border-border bg-input px-5 py-2.5 text-xs font-black text-primary transition-all hover:border-brand/40 hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50",children:g?c("user.loading"):c("user.events.cover_picker_load_more")})})]})}function c({selectedUrl:e,onSelect:i}){let o=(0,s.useTranslations)(),[d,u]=(0,r.useState)([]),[x,p]=(0,r.useState)(null),[b,m]=(0,r.useState)(!0),[h,g]=(0,r.useState)(!1),[f,v]=(0,r.useState)(""),y=async e=>{let t=!e;t?m(!0):g(!0);try{v("");let r=await n.api.get("/api/user/medias",{params:{cursor:e,image_only:!0,limit:24,media_type:"elements"}}),s=r.data.medias??[];u(e=>t?s:[...e,...s]),p(r.data.next_cursor)}catch(e){console.error("Failed to fetch media library",e),v(o("user.events.cover_picker_load_failed"))}finally{m(!1),g(!1)}};return((0,r.useEffect)(()=>{y()},[]),b)?(0,t.jsx)("div",{className:"flex min-h-[260px] items-center justify-center text-secondary",children:(0,t.jsx)(a.Spinner,{size:"3"})}):f?(0,t.jsxs)("div",{className:"flex min-h-[220px] flex-col items-center justify-center gap-3 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-bold text-error",children:f}),(0,t.jsx)("button",{type:"button",onClick:()=>y(),className:"rounded-xl border border-border bg-input px-4 py-2 text-xs font-bold text-primary hover:border-brand/40 hover:bg-surface-hover",children:o("user.events.cover_picker_retry")})]}):0===d.length?(0,t.jsx)("div",{className:"flex min-h-[220px] items-center justify-center text-center",children:(0,t.jsx)("p",{className:"max-w-xs text-sm font-semibold text-muted",children:o("user.events.cover_picker_empty_media")})}):(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:d.map(r=>{let s=e===r.media_url;return(0,t.jsxs)("button",{type:"button",onClick:()=>i(r.media_url),className:`group relative aspect-[4/3] overflow-hidden rounded-xl border bg-input transition-all hover:border-brand/50 ${s?"border-brand ring-2 ring-ring":"border-border"}`,children:[(0,t.jsx)("img",{src:r.thumb_url||r.media_url,alt:r.name||o("user.events.cover_picker_media_alt"),loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}),s&&(0,t.jsx)("span",{className:"absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-brand text-brand-foreground shadow-md",children:(0,t.jsx)(l.LuCheck,{className:"h-4 w-4"})}),(0,t.jsx)("span",{className:"absolute inset-x-0 bottom-0 truncate bg-black/55 px-2 py-1 text-left text-[10px] font-bold text-white opacity-0 transition-opacity group-hover:opacity-100",children:new Date(r.created_at).toLocaleDateString()})]},r.media_id)})}),x&&(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("button",{type:"button",disabled:h,onClick:()=>y(x),className:"rounded-xl border border-border bg-input px-5 py-2.5 text-xs font-black text-primary transition-all hover:border-brand/40 hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-50",children:h?o("user.loading"):o("user.events.cover_picker_load_more")})})]})}let u=[{id:"upload",icon:l.LuUpload,labelKey:"user.events.cover_picker_tab_upload"},{id:"media",icon:l.LuImage,labelKey:"user.events.cover_picker_tab_media"},{id:"idea",icon:l.LuSparkles,labelKey:"user.events.cover_picker_tab_idea"}];function x({open:e,selectedUrl:a,uploadContent:n,onOpenChange:o,onSelect:p}){let b=(0,s.useTranslations)(),[m,h]=(0,r.useState)("upload"),g=e=>{p(e),o(!1)};return(0,t.jsx)(i.Dialog.Root,{open:e,onOpenChange:o,children:(0,t.jsxs)(i.Dialog.Content,{style:{maxWidth:900,padding:0,overflow:"hidden"},className:"rounded-3xl border border-border/60 bg-surface shadow-2xl",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4 border-b border-border/50 px-5 py-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Dialog.Title,{className:"m-0 text-lg font-black tracking-tight text-primary",children:b("user.events.cover_picker_title")}),(0,t.jsx)(i.Dialog.Description,{className:"mt-1 text-xs font-semibold text-muted",children:b("user.events.cover_picker_desc")})]}),(0,t.jsx)(i.Dialog.Close,{children:(0,t.jsx)("button",{type:"button",className:"flex h-9 w-9 items-center justify-center rounded-xl border border-border bg-input text-secondary transition-all hover:border-brand/40 hover:text-primary","aria-label":b("user.events.cover_picker_close"),children:(0,t.jsx)(l.LuX,{className:"h-4 w-4"})})})]}),(0,t.jsx)("div",{className:"border-b border-border/50 px-5 pt-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:u.map(e=>{let r=e.icon,s=m===e.id;return(0,t.jsxs)("button",{type:"button",onClick:()=>h(e.id),className:`flex items-center gap-2 rounded-xl px-4 py-2 text-xs font-black transition-all ${s?"bg-brand text-brand-foreground shadow-md shadow-brand/15":"bg-input text-secondary hover:bg-surface-hover hover:text-primary"}`,children:[(0,t.jsx)(r,{className:"h-4 w-4"}),b(e.labelKey)]},e.id)})})}),(0,t.jsxs)("div",{className:"max-h-[68vh] overflow-y-auto p-5 custom-scrollbar",children:["upload"===m&&n,"media"===m&&(0,t.jsx)(c,{selectedUrl:a,onSelect:g}),"idea"===m&&(0,t.jsx)(d,{selectedUrl:a,onSelect:g})]})]})})}
1function p({coverUrl:e,onChange:i,requiresAuth:o=!1,labels:d}){let c=(0,s.useTranslations)(),u=(0,r.useRef)(null),[b,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!1),[f,v]=(0,r.useState)(""),y=async e=>{if(o)return void v(c("user.events.public.cover_auth_required"));if(!e.type.startsWith("image/"))return void v(c("user.events.errors.invalid_image_type"));if(e.size>3145728)return void v(c("user.events.errors.file_too_large"));try{g(!0),v("");let t=await new Promise(t=>{let r=new Image,s=URL.createObjectURL(e);r.onload=()=>{URL.revokeObjectURL(s),t({width:r.width,height:r.height})},r.onerror=()=>{URL.revokeObjectURL(s),t({width:0,height:0})},r.src=s});if(!t.width||!t.height)return void v(c("user.events.errors.invalid_image_type"));let r=new FormData;r.append("file",e),r.append("mediaType","elements"),r.append("width",t.width.toString()),r.append("height",t.height.toString());let s=await n.api.post("/api/user/medias/upload",{body:r});if(!s.data?.media_url)throw Error("Invalid response");i(s.data.media_url),m(!1)}catch(e){console.error(e),v(c("user.events.errors.upload_failed"))}finally{g(!1),u.current&&(u.current.value="")}},_=e=>{if(e.preventDefault(),e.currentTarget.classList.remove("border-brand","bg-brand/5"),o)return void v(c("user.events.public.cover_auth_required"));let t=e.dataTransfer.files?.[0];t&&y(t)},j=e=>{e.preventDefault(),e.currentTarget.classList.add("border-brand","bg-brand/5")},w=e=>{e.preventDefault(),e.currentTarget.classList.remove("border-brand","bg-brand/5")},N=(0,t.jsx)("div",{role:"button",tabIndex:0,onClick:()=>{o?v(c("user.events.public.cover_auth_required")):u.current?.click()},onKeyDown:e=>{o||("Enter"===e.key||" "===e.key)&&(e.preventDefault(),u.current?.click())},onDragOver:j,onDragLeave:w,onDrop:_,className:`flex min-h-[260px] w-full cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed border-border bg-input p-6 text-center transition-all hover:border-brand hover:bg-surface-hover ${h?"pointer-events-none opacity-60":""}`,children:h?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 text-secondary animate-pulse",children:[(0,t.jsx)(a.Spinner,{size:"3"}),(0,t.jsx)("span",{className:"text-xs font-extrabold",children:c("user.events.uploading")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border border-brand/10 bg-brand/5 text-brand",children:(0,t.jsx)(l.LuUpload,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"block text-sm font-extrabold text-primary",children:c("user.events.cover_picker_upload_local")}),(0,t.jsx)("span",{className:"mt-1 block text-xs font-semibold text-muted",children:d?.uploadDescription??c("user.events.upload_cover_desc")})]})]})});return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"block text-xs font-bold text-secondary",children:d?.uploadCover??c("user.events.upload_cover")}),o&&(0,t.jsx)("p",{className:"rounded-lg border border-brand/15 bg-brand/5 px-3 py-2 text-xs font-semibold leading-5 text-secondary",children:c("user.events.public.cover_auth_required")}),(0,t.jsx)("input",{type:"file",ref:u,onChange:e=>{let t=e.target.files?.[0];t&&y(t)},accept:"image/png,image/jpeg,image/webp",className:"hidden"}),e?(0,t.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-border bg-input group",children:[(0,t.jsx)("img",{src:e,alt:c("user.events.cover_banner"),className:"block h-auto w-full transition-transform duration-300 group-hover:scale-105"}),(0,t.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center gap-3 bg-black/40 opacity-0 transition-opacity duration-200 group-hover:opacity-100",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{o?v(c("user.events.public.cover_auth_required")):m(!0)},className:"flex items-center gap-1.5 rounded-lg bg-white/95 px-3 py-1.5 text-xs font-bold text-black shadow-md transition-all hover:bg-white",children:[(0,t.jsx)(l.LuLibrary,{className:"h-3.5 w-3.5"}),c("user.events.cover_picker_choose")]}),(0,t.jsxs)("button",{type:"button",onClick:()=>i(""),className:"flex items-center gap-1.5 rounded-lg bg-red-600/95 px-3 py-1.5 text-xs font-bold text-white shadow-md transition-all hover:bg-red-600",children:[(0,t.jsx)(l.LuTrash2,{className:"h-3.5 w-3.5"}),c("user.events.upload_cover_remove")]})]})]}):(0,t.jsx)("div",{onDragOver:j,onDragLeave:w,onDrop:_,className:`flex aspect-[21/9] w-full select-none flex-col items-center justify-center gap-3 overflow-hidden rounded-xl border-2 border-dashed border-border bg-input p-4 transition-all hover:border-brand hover:bg-surface-hover ${h?"pointer-events-none opacity-60":""}`,children:h?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 text-secondary animate-pulse",children:[(0,t.jsx)(a.Spinner,{size:"3"}),(0,t.jsx)("span",{className:"text-xs font-extrabold",children:c("user.events.uploading")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full border border-brand/10 bg-brand/5 text-brand",children:(0,t.jsx)(l.LuImage,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{o?v(c("user.events.public.cover_auth_required")):m(!0)},className:"rounded-xl bg-brand px-4 py-2 text-xs font-black text-brand-foreground shadow-md shadow-brand/15 transition-all hover:bg-brand-hover",children:c("user.events.cover_picker_choose")}),(0,t.jsx)("button",{type:"button",onClick:()=>{o?v(c("user.events.public.cover_auth_required")):u.current?.click()},className:"rounded-xl border border-border bg-surface px-4 py-2 text-xs font-black text-primary transition-all hover:border-brand/40 hover:bg-brand/5",children:c("user.events.cover_picker_upload_local")})]}),(0,t.jsx)("span",{className:"block text-center text-[10px] font-semibold text-muted",children:d?.uploadDescription??c("user.events.upload_cover_desc")})]})}),f&&(0,t.jsx)("p",{className:"mt-1 text-[10px] font-extrabold text-error",children:f}),(0,t.jsx)(x,{open:b,selectedUrl:e,uploadContent:N,onOpenChange:m,onSelect:i})]})}var b=e.i(8116);function m(){let e=(0,s.useTranslations)();return[{id:"default",name:e("user.events.theme_default"),bgClass:"bg-gradient-to-tr from-brand via-secondary-theme to-tertiary-theme",previewHeader:"bg-gradient-to-br from-brand via-secondary-theme/80 to-tertiary-theme text-inverse",previewStyles:"font-sans",badgeColor:"bg-brand/10 text-brand border border-brand/20",primaryButton:"bg-brand text-brand-foreground hover:opacity-90",cardStyles:"border-brand/20 shadow-brand/10"},{id:"clean",name:e("user.events.theme_clean"),bgClass:"bg-zinc-50 dark:bg-zinc-950",previewHeader:"bg-zinc-100 dark:bg-zinc-900 text-primary border-b border-border/40",previewStyles:"font-sans",badgeColor:"bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200 border border-zinc-200 dark:border-zinc-800",primaryButton:"bg-zinc-900 hover:bg-zinc-800 text-zinc-50 dark:bg-zinc-100 dark:hover:bg-zinc-200 dark:text-zinc-900",cardStyles:"border-zinc-200 dark:border-zinc-800 shadow-zinc-200/50"},{id:"floral",name:e("user.events.theme_floral"),bgClass:"bg-gradient-to-tr from-emerald-300 via-teal-300 to-pink-300",previewHeader:"bg-gradient-to-br from-mint via-cream to-pink/20 text-teal-950 border-b border-border/40",previewStyles:"font-sans tracking-wide",badgeColor:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/20 dark:text-emerald-400 border border-emerald-500/20",primaryButton:"bg-emerald-600 text-white dark:bg-emerald-500 hover:opacity-90",cardStyles:"border-emerald-500/20 shadow-emerald-500/10"},{id:"modern",name:e("user.events.theme_modern"),bgClass:"bg-gradient-to-tr from-zinc-800 to-zinc-950",previewHeader:"bg-gradient-to-br from-zinc-900 to-black text-zinc-100 border-b border-zinc-800",previewStyles:"font-jakarta tracking-tight",badgeColor:"bg-zinc-100 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200 border border-zinc-300 dark:border-zinc-700",primaryButton:"bg-zinc-950 text-white dark:bg-zinc-100 dark:text-zinc-950 hover:opacity-90",cardStyles:"border-zinc-800 shadow-black/40"},{id:"neon",name:e("user.events.theme_neon"),bgClass:"bg-gradient-to-tr from-pink-500 via-purple-600 to-blue-500",previewHeader:"bg-gradient-to-br from-pink-600 via-purple-700 to-indigo-600 text-white shadow-inner",previewStyles:"font-outfit tracking-wide uppercase",badgeColor:"bg-pink-500/10 text-pink-500 border border-pink-500/30",primaryButton:"bg-purple-600 text-white hover:opacity-90",cardStyles:"border-pink-500/20 shadow-pink-500/10"},{id:"vintage",name:e("user.events.theme_vintage"),bgClass:"bg-gradient-to-tr from-amber-100 via-amber-200 to-yellow-300 border border-amber-300",previewHeader:"bg-cream text-amber-950 border-b-2 border-double border-amber-900/30",previewStyles:"font-serif",badgeColor:"bg-
1amber-100 text-amber-800 border border-amber-800/20",primaryButton:"bg-amber-900 text-white hover:opacity-90",cardStyles:"border-amber-900/10 shadow-amber-900/10"}]}function h({form:e,eventDate:r,eventTime:a,editingEvent:n}){let i=(0,s.useTranslations)(),o=m(),d=o.find(t=>t.id===e.theme)||o[0];return(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-4 w-full max-w-[360px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500 animate-ping"}),(0,t.jsx)("span",{className:"text-xs font-black tracking-widest text-secondary uppercase",children:i("user.events.live_preview")})]}),(0,t.jsx)("div",{className:"w-full max-w-[360px] h-[640px] lg:h-[calc(100vh-170px)] lg:min-h-[480px] lg:max-h-[640px] rounded-3xl border border-border bg-background shadow-2xl relative overflow-hidden flex flex-col transition-all duration-300",children:(0,t.jsxs)("div",{className:`flex-1 overflow-y-auto custom-scrollbar flex flex-col bg-background pb-10 ${d.previewStyles}`,children:[e.cover_url?(0,t.jsx)("div",{className:"relative w-full overflow-hidden shrink-0",children:(0,t.jsx)("img",{src:e.cover_url,alt:e.title||i("user.events.cover_banner"),className:"w-full h-auto block",onError:e=>{e.currentTarget.style.display="none"}})}):(0,t.jsx)("div",{className:"relative aspect-[16/10] w-full overflow-hidden shrink-0",children:(0,t.jsxs)("div",{className:`h-full w-full flex items-center justify-center p-6 ${d.previewHeader} relative`,children:[(0,t.jsx)(l.LuHeart,{className:"w-8 h-8 opacity-40 absolute"}),"floral"===e.theme&&(0,t.jsx)("div",{className:"absolute inset-0 opacity-15 flex flex-wrap gap-2 p-4",children:Array.from({length:12}).map((e,r)=>(0,t.jsx)("span",{className:"w-4 h-4 rounded-full bg-emerald-500"},r))}),"neon"===e.theme&&(0,t.jsx)("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.15)_1px,transparent_1px)] bg-[size:16px_16px]"}),"vintage"===e.theme&&(0,t.jsx)("div",{className:"absolute inset-2 border border-dashed border-amber-900/30"}),(0,t.jsx)("span",{className:"opacity-90 font-black text-lg text-center drop-shadow-md select-none line-clamp-2 px-4 uppercase tracking-wider",children:"vintage"===e.theme?i("user.events.theme_cover_vintage"):"floral"===e.theme?i("user.events.theme_cover_floral"):i("user.events.theme_cover_default")})]})}),(0,t.jsxs)("div",{className:"px-5 py-6 space-y-6 text-center",children:[(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("span",{className:`px-2.5 py-0.5 rounded-full text-[9px] font-black uppercase tracking-widest ${d.badgeColor}`,children:"vintage"===e.theme?i("user.events.theme_badge_vintage"):i("user.events.theme_badge_default")})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)("h2",{className:"text-xl font-black text-primary leading-tight tracking-tight drop-shadow-sm break-words px-2",children:e.title||i("user.events.preview_title_placeholder")})}),(0,t.jsx)("div",{className:"inline-flex items-center justify-center gap-1.5 py-2 px-4 rounded-2xl bg-surface-hover/20 border border-border/40 max-w-full mx-auto",children:(0,t.jsx)("span",{className:"text-[11px] font-extrabold text-primary break-words",children:(()=>{if(!r)return i("user.events.date_format_fallback");try{let e=new Date(`${r}T${a||"00:00"}`);if(isNaN(e.getTime()))return`${r} ${a}`;let t=i("user.events.date_format"),s="zh-CN"===t,n=e.toLocaleDateString(t,{weekday:"short",year:"numeric",month:"short",day:"numeric"}),l=e.toLocaleTimeString(t,{hour:"2-digit",minute:"2-digit",hour12:!s});return s?`${n} ${l}`:`${n} ⢠${l}`}catch(e){return`${r} ${a}`}})()})}),(0,t.jsx)("div",{className:"space-y-3.5 text-left border-t border-b border-border/40 py-5",children:(0,t.jsxs)("div",{className:"flex gap-3 align-start",children:[(0,t.jsx)("div",{className:"w-7 h-7 rounded-lg bg-surface-hover/30 flex items-center justify-center text-primary shrink-0 border border-border/20",children:(0,t.jsx)(l.LuMapPin,{className:"w-3.5 h-3.5 text-brand"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"text-[10px] font-bold text-muted block uppercase tracking-wider",children:i("user.events.field_location_name")}),(0,t.jsx)("span",{className:"text-xs font-bold text-primary block truncate",children:e.location_name||i("user.events.preview_location_placeholder")}),e.location_address&&(0,t.jsx)("span",{className:"text-[10px] font-medium text-secondary block leading-tight mt-0.5 truncate",children:e.location_address})]})]})}),e.description&&(0,t.jsxs)("div",{className:"bg-brand-muted/20 border border-brand/10 rounded-2xl p-4 text-left relative overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute top-0 right-0 w-8 h-8 opacity-5",children:(0,t.jsx)(l.LuHeart,{className:"w-full h-full text-brand"})}),(0,t.jsx)("span",{className:"text-[10px] font-black text-brand block uppercase tracking-widest mb-1.5",children:i("user.events.preview_host_note")}),(0,t.jsx)("div",{className:"text-xs font-semibold text-secondary leading-relaxed break-words prose-sm prose-neutral dark:prose-invert max-w-none [&_p]:mb-2 [&_p:last-child]:mb-0 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_ol]:mb-2 [&_li]:mb-1 [&_strong]:font-black [&_em]:italic [&_a]:text-brand [&_a]:underline [&_a:hover]:opacity-80 [&_h1]:text-sm [&_h1]:font-black [&_h2]:text-xs [&_h2]:font-black [&_h3]:text-xs [&_h3]:font-bold [&_blockquote]:border-l-2 [&_blockquote]:border-brand/40 [&_blockquote]:pl-3 [&_blockquote]:opacity-70 [&_code]:bg-brand-muted/30 [&_code]:rounded [&_code]:px-1 [&_code]:text-[10px]",children:(0,t.jsx)(b.default,{children:e.description})})]}),(0,t.jsx)("div",{className:"pt-2",children:(0,t.jsx)("button",{type:"button",className:`w-full py-3 px-6 rounded-full font-black text-xs uppercase tracking-widest shadow-md transition-all active:scale-[0.98] cursor-default text-center ${d.primaryButton}`,children:i("user.events.preview_rsvp")})})]})]})}),(0,t.jsx)("p",{className:"text-[11px] text-muted text-center max-w-[280px]",children:i("user.events.preview_disclaimer")})]})}function g({theme:e,selected:r,onSelect:s,rsvpLabel:a,locationLabel:n,invitationLabel:l,invitationBadge:i,sampleTitle:o,sampleDetails:d}){return(0,t.jsxs)("button",{type:"button","aria-pressed":r,onClick:s,className:`group rounded-2xl border p-2 text-left transition-[border-color,box-shadow,transform] duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${r?"border-brand bg-brand-muted/30 shadow-md ring-2 ring-ring":"border-border bg-input hover:-translate-y-0.5 hover:border-border-strong hover:shadow-sm"}`,children:[(0,t.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-border/50 bg-background shadow-sm",children:[(0,t.jsxs)("div",{className:`relative flex aspect-[16/10] items-center justify-center overflow-hidden ${e.previewHeader}`,children:[(0,t.jsx)("div",{className:"absolute inset-3 rounded-lg border border-current/20"}),(0,t.jsx)("span",{className:"relative px-3 text-center text-[10px] font-black uppercase tracking-[0.16em] opacity-90",children:l})]}),(0,t.jsxs)("div",{className:`space-y-2 px-3 py-3 text-center ${e.previewStyles}`,children:[(0,t.jsx)("p",{className:"text-[8px] font-black uppercase tracking-[0.16em] text-brand",children:i}),(0,t.jsx)("p",{className:"truncate font-serif text-sm font-bold text-primary",children:o}),(0,t.jsxs)("p",{className:"truncate text-[8px] font-semibold text-secondary",children:[d," · ",n]}),(0,t.jsx)("span",{className:`inline-flex rounded-full px-2.5 py-1 text-[8px] font-black uppercase tracking-wider ${e.primaryButton}`,children:a})]}),r&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/15",children:(0,t.jsx)("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-white text-sm font-black text-brand shadow-lg",children:"â"})})]}),(0,t.jsx)("span",{className:"mt-2 block truncate px-1 text-center text-[11px] font-bold text-primary",children:e.name})]})}e.s(["default",0,function({editingEvent:e,initialDraft:i=null,onSubmit:o,onCancel:d,title:c,description:u,saveLabel:x,unauthenticatedNotice:b,coverRequiresAuth:f=!1,labels:v}){let y=(0,s.useTranslations)(),[_,j]=(0,r.useState)({title:"",description:"",location_name:"",location_address:"",passcode:"",status:"draft",theme:"default",special_instructions:"",cover_url:""}),[w,N]=(0,r.useState)(""),[k,S]=(0,r.useState)(""),[z,C]=(0,r.useState)(!1),[L,T]=(0,r.useState)("open"),[D,$]=(0,r.useState)(0);(0,r.useEffect)(()=>{e?(async()=>{let t=0,r=0,s=!0;for(;s;){let a=await n.api.get(`/api/user/events/${e.event_id}/guests`,{params:{limit:500,offset:r}});t+=a.data?.length??0,s=!!(a.pagination?.hasMore&&null!==a.pagination.nextOffset),r=a.pagination?.nextOffset??r+500}$(t)})().catch(e=>console.error("Failed to fetch guest count:",e)):$(0)},[e]),(0,r.useEffect)(()=>
1{if(e){let t="",r="";if(e.event_date)try{let s=new Date(e.event_date),a=6e4*s.getTimezoneOffset(),n=new Date(s.getTime()-a).toISOString();t=n.split("T")[0],r=n.split("T")[1].slice(0,5)}catch(e){console.error(e)}j({title:e.title||"",description:e.description||"",location_name:e.location_name||"",location_address:e.location_address||"",passcode:e.passcode||"",status:e.status||"active",theme:e.template_config?.theme||"default",special_instructions:e.template_config?.special_instructions||"",cover_url:e.cover_url||""}),N(t),S(r),T((e.template_config?.guest_restriction||{type:"open"}).type||"open")}else if(i){let e="",t="";if(i.event_date)try{let r=new Date(i.event_date);if(!Number.isNaN(r.getTime())){let s=6e4*r.getTimezoneOffset(),a=new Date(r.getTime()-s).toISOString();e=a.split("T")[0],t=a.split("T")[1].slice(0,5)}}catch(e){console.error(e)}let r=i.template_config??{};j({title:i.title||"",description:i.description||"",location_name:i.location_name||"",location_address:i.location_address||"",passcode:i.passcode||"",status:i.status||"draft",theme:r.theme||i.theme||"default",special_instructions:r.special_instructions||i.special_instructions||"",cover_url:i.cover_url||""}),N(e),S(t),T((i.guest_restriction||r.guest_restriction||{type:"open"}).type||"open")}else{let e=new Date;e.setDate(e.getDate()+7),e.setHours(18,0,0,0);let t=6e4*e.getTimezoneOffset(),r=new Date(e.getTime()-t).toISOString();j({title:"",description:"",location_name:"",location_address:"",passcode:"",status:"draft",theme:"default",special_instructions:"",cover_url:""}),N(r.split("T")[0]),S(r.split("T")[1].slice(0,5)),T("open")}},[e,i,y]);let O=async e=>{if((e.preventDefault(),_.title.trim()&&w&&k)&&(!_.passcode||4===_.passcode.length))try{C(!0);let e=`${w}T${k}`,t={theme:_.theme,special_instructions:_.special_instructions,guest_restriction:{type:L}};await o({..._,event_date:e,premium:"",template_config:t,guest_restriction:{type:L}})}catch(e){console.error(e)}finally{C(!1)}},U=m();return(0,t.jsxs)("form",{onSubmit:O,className:"w-full max-w-7xl mx-auto px-1 select-none animate-fade-in",children:[(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-3xl font-black tracking-tight text-primary font-jakarta",children:c??(e?y("user.events.edit"):y("user.events.create"))}),(0,t.jsx)("p",{className:"text-sm text-secondary mt-1 max-w-2xl leading-relaxed",children:u??y("user.events.field_description_desc")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 w-full md:w-auto shrink-0",children:[d&&(0,t.jsx)("button",{type:"button",onClick:d,className:"w-full md:w-auto px-5 py-2.5 rounded-xl border border-border bg-input hover:bg-border/30 hover:text-primary transition-all text-secondary font-bold text-sm cursor-pointer",children:y("user.events.cancel")}),(0,t.jsxs)("button",{type:"submit",disabled:z||!_.title.trim()||!w||!k||_.passcode.length>0&&4!==_.passcode.length,className:"w-full md:w-auto px-6 py-2.5 rounded-xl bg-brand hover:bg-brand-hover text-brand-foreground font-black text-sm flex items-center justify-center gap-2 shadow-md hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[z?(0,t.jsx)(a.Spinner,{size:"1"}):null,x??y("user.events.save")]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8 items-start",children:[(0,t.jsxs)("div",{className:"lg:col-span-7 space-y-6",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-border bg-surface-hover/10 p-6 md:p-8 space-y-5",children:[b&&(0,t.jsxs)("div",{className:"rounded-xl border border-brand/20 bg-brand/5 p-4",children:[(0,t.jsx)("p",{className:"text-sm font-black text-primary",children:b.title}),(0,t.jsx)("p",{className:"mt-1 text-xs font-semibold leading-5 text-secondary",children:b.description})]}),(0,t.jsxs)("h3",{className:"text-md font-extrabold text-primary flex items-center gap-2 border-b border-border/60 pb-3",children:[(0,t.jsx)("span",{className:"w-1.5 h-4 bg-brand rounded-full"}),v?.details??y("user.events.details")]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-bold text-secondary flex justify-between",children:(0,t.jsxs)("span",{children:[v?.fieldTitle??y("user.events.field_title")," ",(0,t.jsx)("span",{className:"text-error",children:"*"})]})}),(0,t.jsx)("input",{type:"text",placeholder:v?.placeholderTitle??y("user.events.placeholder_title"),value:_.title,onChange:e=>j(t=>({...t,title:e.target.value})),required:!0,className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold"})]}),(0,t.jsx)(p,{coverUrl:_.cover_url,onChange:e=>j(t=>({...t,cover_url:e})),requiresAuth:f,labels:v?.cover}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-bold text-secondary flex items-center gap-1.5",children:[(0,t.jsx)(l.LuCalendar,{className:"text-muted w-3.5 h-3.5"}),(0,t.jsxs)("span",{children:[v?.fieldDate??y("user.events.field_date").split(" &")[0]," ",(0,t.jsx)("span",{className:"text-error",children:"*"})]})]}),(0,t.jsx)("input",{type:"date",value:w,onChange:e=>N(e.target.value),required:!0,className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-bold text-secondary flex items-center gap-1.5",children:[(0,t.jsx)(l.LuClock,{className:"text-muted w-3.5 h-3.5"}),(0,t.jsxs)("span",{children:[v?.fieldTime??y("user.events.field_time")," ",(0,t.jsx)("span",{className:"text-error",children:"*"})]})]}),(0,t.jsx)("input",{type:"time",value:k,onChange:e=>S(e.target.value),required:!0,className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold"})]})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-bold text-secondary",children:v?.fieldLocationName??y("user.events.field_location_name")}),(0,t.jsx)("input",{type:"text",placeholder:y("user.events.placeholder_location"),value:_.location_name,onChange:e=>j(t=>({...t,location_name:e.target.value})),className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-bold text-secondary",children:v?.fieldLocationAddress??y("user.events.field_location_address")}),(0,t.jsx)("input",{type:"text",placeholder:y("user.events.placeholder_address"),value:_.location_address,onChange:e=>j(t=>({...t,location_address:e.target.value})),className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-bold text-secondary",children:v?.fieldSpecialInstructions??y("user.events.field_special_instructions")}),(0,t.jsx)("textarea",{placeholder:v?.descriptionPlaceholder??y("user.events.desc_placeholder"),value:_.description,onChange:e=>j(t=>({...t,description:e.target.value})),rows:4,className:"w-full px-4 py-3 rounded-xl border border-border bg-input text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold resize-none"})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-3",children:[(0,t.jsx)("label",{className:"text-xs font-bold text-secondary block",children:v?.fieldTheme??y("user.events.field_theme")}),(0,t.jsx)("p",{className:"-mt-1 text-xs leading-5 text-muted",children:y("user.events.template_choice_hint")}),(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:U.map(e=>{let r=_.theme===e.id;return(0,t.jsx)(g,{theme:e,selected:r,onSelect:()=>j(t=>({...t,theme:e.id})),rsvpLabel:y("user.events.preview_rsvp"),locationLabel:y("user.events.preview_location_placeholder"),invitationLabel:y("user.events.template_preview_invitation"),invitationBadge:y("user.events.template_preview_badge"),sampleTitle:y("user.events.template_preview_title"),sampleDetails:y("user.events.template_preview_details")},e.id)})})]}),(0,t.jsxs)("div",{className:"mt-8 p-6 rounded-2xl border border-brand/20 bg-brand-muted/10 space-y-3 relative overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -right-4 -top-4 text-brand/5 w-24 h-24 pointer-events-none",children:(0,t.jsx)(l.LuLock,{className:"w-full h-full"})}),(0,t.jsxs)("div",{className:"relative z-10 flex flex-col sm:flex-row sm:items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,t.jsxs)("h4",{className:"text-sm font-black text-brand flex items-center gap-1.5",children:[(0,t.jsx)(l.LuLock,{className:"w-4 h-4"}),v?.fieldPasscode??y("user.events.field_passcode")]}),(0,t.jsx)("p",{className:"text-xs text-secondary leading-relaxed max-w-md",children:v?.fieldPasscodeDe
1scription??y("user.events.field_passcode_description")})]}),(0,t.jsxs)("div",{className:"w-full sm:w-1/3 shrink-0",children:[(0,t.jsx)("input",{type:"text",inputMode:"numeric",pattern:"\\d*",maxLength:4,placeholder:"1234",value:_.passcode,onChange:e=>{let t=e.target.value.replace(/\D/g,"").slice(0,4);j(e=>({...e,passcode:t}))},className:"w-full px-4 py-3 rounded-xl border border-brand/30 bg-background text-primary focus:border-brand focus:ring-2 focus:ring-ring transition-all text-sm outline-none font-semibold shadow-sm text-center tracking-widest text-lg"}),_.passcode.length>0&&_.passcode.length<4&&(0,t.jsx)("p",{className:"text-[10px] text-red-500 font-bold mt-1 text-center",children:y("user.events.errors.must_be_4_digits")})]})]})]}),(0,t.jsxs)("div",{className:"mt-6 p-6 rounded-2xl border border-brand/20 bg-brand-muted/10 space-y-4 relative overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -right-4 -top-4 text-brand/5 w-24 h-24 pointer-events-none",children:(0,t.jsx)(l.LuUsers,{className:"w-full h-full"})}),(0,t.jsxs)("div",{className:"relative z-10 space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("h4",{className:"text-sm font-black text-brand flex items-center gap-1.5",children:[(0,t.jsx)(l.LuUsers,{className:"w-4 h-4"}),v?.fieldGuestRestriction??y("user.events.field_guest_restriction")]}),(0,t.jsx)("p",{className:"text-xs text-secondary leading-relaxed max-w-md",children:v?.fieldGuestRestrictionDescription??y("user.events.field_guest_restriction_description")})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:["open","phone"].map(e=>{let r=L===e;return(0,t.jsxs)("button",{type:"button",onClick:()=>T(e),className:`flex items-center justify-center gap-2 p-3 rounded-xl border text-xs font-bold transition-all cursor-pointer ${r?"border-brand ring-2 ring-ring bg-brand-muted/30 text-primary":"border-border bg-input hover:border-border-strong hover:bg-surface-hover text-secondary"}`,children:["phone"===e&&(0,t.jsx)(l.LuPhone,{className:"w-3.5 h-3.5"}),"open"===e&&(0,t.jsx)(l.LuUsers,{className:"w-3.5 h-3.5"}),y(`user.events.restriction_type_${e}`)]},e)})}),"phone"===L&&(0,t.jsx)("div",{className:"p-3 bg-amber-500/10 border border-amber-500/20 rounded-xl text-xs text-amber-700 dark:text-amber-400 font-semibold leading-relaxed animate-fade-in",children:y("user.events.field_guest_restriction_phone_notice")})]})]})]}),e&&(0,t.jsxs)("div",{className:"rounded-2xl border border-border bg-surface-hover/10 p-6 md:p-8 space-y-4",children:[(0,t.jsxs)("h3",{className:"text-md font-extrabold text-primary flex items-center gap-2 border-b border-border/60 pb-3",children:[(0,t.jsx)("span",{className:"w-1.5 h-4 bg-brand rounded-full"}),y("user.events.field_status")]}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{id:"draft",label:y("user.events.status_draft"),color:"border-yellow-500 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"},{id:"active",label:y("user.events.status_active"),color:"border-emerald-500 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"},{id:"cancelled",label:y("user.events.status_cancelled"),color:"border-red-500 bg-red-500/10 text-red-600 dark:text-red-400"},{id:"completed",label:y("user.events.status_completed"),color:"border-gray-500 bg-gray-500/10 text-gray-600 dark:text-gray-400"}].map(e=>{let r=_.status===e.id;return(0,t.jsx)("button",{type:"button",onClick:()=>j(t=>({...t,status:e.id})),className:`flex items-center justify-center gap-2 p-3 rounded-xl border text-xs font-bold transition-all cursor-pointer ${r?`ring-2 ring-ring ${e.color}`:"border-border bg-input hover:border-border-strong hover:bg-surface-hover text-secondary"}`,children:e.label},e.id)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-4",children:[d&&(0,t.jsx)("button",{type:"button",onClick:d,className:"px-5 py-2.5 rounded-xl border border-border bg-input hover:bg-border/30 hover:text-primary transition-all text-secondary font-bold text-sm cursor-pointer",children:y("user.events.cancel")}),(0,t.jsxs)("button",{type:"submit",disabled:z||!_.title.trim()||!w||!k||_.passcode.length>0&&4!==_.passcode.length,className:"px-6 py-2.5 rounded-xl bg-brand hover:bg-brand-hover text-brand-foreground font-black text-sm flex items-center justify-center gap-2 shadow-md hover:shadow-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[z?(0,t.jsx)(a.Spinner,{size:"1"}):null,x??y("user.events.save")]})]})]}),(0,t.jsx)("div",{className:"lg:col-span-5 lg:self-stretch",children:(0,t.jsx)("div",{className:"lg:sticky lg:top-20 lg:z-20 w-full flex justify-center lg:justify-end",children:(0,t.jsx)(h,{form:_,eventDate:w,eventTime:k,editingEvent:e})})})]})]})}],984362)}]);
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.