PageSourceSearch

https://socialloop.ai/_next/static/chunks/3231.85201fa644867fef.js

js socialloop.ai collected 2026-10-05 12:46:26 UTC 72,312 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3231],{34598:(e,t,s)=>{s.d(t,{tA:()=>i,vv:()=>a});let n=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2});function a(e){return n.format(e)}function i(e,t,s){return"".concat(e).concat(s?"":" / ".concat(t)," ").concat(1===e?"ticket type":"ticket types")}},47394:(e,t,s)=>{s.d(t,{A:()=>u});var n=s(95155),a=s(12115),i=s(76849),r=s(14585),l=s(37401),o=s(12711),c=s(34598);let d=null;function u(){let{userProfile:e}=(0,l.Y)(),[t,s]=(0,a.useState)(null),u=(null==e?void 0:e.stripeStatus)==="active"||(null==e?void 0:e.stripeChargesEnabled)===!0;return((0,a.useEffect)(()=>{if(u)return;let e=!1;return(!d&&(d=(0,i.httpsCallable)(r.functions,"getHeldPayoutSummary")({}).then(e=>e.data)).catch(()=>{d=null}),d).then(t=>{e||s(t)}).catch(()=>{}),()=>{e=!0}},[u]),!u&&(null==t?void 0:t.capReached))?(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4 rounded-xl bg-amber-500/10 border border-amber-500/25",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("svg",{className:"w-5 h-5 text-attention-ink flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-t1",children:"Ticket sales are paused — connect your payout account"}),(0,n.jsxs)("p",{className:"text-[12px] text-t3 mt-0.5",children:["You've reached the sales limit before payment setup.",t.heldCents>0&&(0,n.jsxs)(n.Fragment,{children:[" ",(0,c.vv)(t.heldCents/100)," is held safely for you."]})," ","Connecting takes a few minutes and sales resume immediately."]})]})]}),(0,n.jsx)(o.$n,{variant:"primary",className:"flex-shrink-0",onClick:()=>{window.location.href="/producer-center?tab=account&section=payouts"},children:"Connect payouts"})]}):null}},80064:(e,t,s)=>{s.d(t,{JE:()=>r,nO:()=>c,tH:()=>l});let n=new Set(["image/heic","image/heif","image/heic-sequence","image/heif-sequence"]),a=/\.(heic|heif)$/i;function i(e){return n.has(e.type.toLowerCase())||a.test(e.name)}function r(e){return e.type.startsWith("image/")||i(e)}let l="image/*,.heic,.heif",o=async()=>{var e;let t=await s.e(2e3).then(s.t.bind(s,2402,23));return null!=(e=t.default)?e:t};async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.92;if(!i(e))return e;let s=await o(),n=await s({blob:e,toType:"image/jpeg",quality:t}),r=Array.isArray(n)?n[0]:n;if(!r)throw Error("HEIC conversion produced no image");return new File([r],function(e){let t=e.replace(a,"");return"".concat(t||"photo",".jpg")}(e.name),{type:"image/jpeg",lastModified:e.lastModified})}},83231:(e,t,s)=>{s.r(t),s.d(t,{default:()=>eu});var n=s(95155),a=s(94461),i=s(12115),r=s(80064),l=s(39390),o=s(76849),c=s(20063),d=s(14585),u=s(29213),m=s(37169);let h=e=>e.trim().toLowerCase();var x=s(56071),p=s(37401),v=s(82146),f=s(8683),b=s(12711),g=s(33583),y=s(12180);async function j(e,t){let s=(0,o.httpsCallable)(d.functions,"cancelEvent");await s({eventId:e,reason:t})}function w(e){let{open:t,onClose:s,eventId:a,eventName:r,onCancelled:l}=e,{notify:o}=(0,p.Y)(),[c,d]=(0,i.useState)(""),[u,m]=(0,i.useState)(!1);if(!t)return null;let h=async()=>{if(!c.trim()||u)return;m(!0);let e=await (0,y.$F)(()=>j(a,c.trim()),"Failed to cancel event",o);m(!1),e&&(l(),s())};return(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:s}),(0,n.jsxs)("div",{className:"relative bg-surface-overlay border border-white/[0.06] rounded-2xl w-full max-w-md mx-4 p-6 space-y-5",children:[(0,n.jsx)("button",{onClick:s,className:"absolute top-4 right-4 p-1 rounded-lg hover:bg-white/[0.06] text-t2 hover:text-t1 transition",children:(0,n.jsx)(f.fK,{className:"w-4 h-4"})}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"p-2.5 rounded-lg bg-red-500/10",children:(0,n.jsx)(f.tP,{className:"w-5 h-5 text-negative-ink"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"studio-subtitle",children:"Cancel Event"}),(0,n.jsx)("p",{className:"studio-caption mt-0.5",children:r})]})]}),(0,n.jsx)("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg px-4 py-3",children:(0,n.jsx)("p",{className:"text-sm text-negative-ink/80",children:"This action cannot be undone. All ticket holders will be notified."})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block studio-label mb-2",children:["Cancellation Reason ",(0,n.jsx)("span",{className:"text-negative-ink",children:"*"})]}),(0,n.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),placeholder:"Let attendees know why...",rows:3,className:"w-full px-3 py-2 rounded-lg bg-card border border-card text-sm text-white placeholder:text-t2 outline-none focus:border-white/20 resize-none",autoFocus:!0})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(b.$n,{variant:"secondary",onClick:s,className:"flex-1 py-2.5 rounded-xl",children:"Keep Event"}),(0,n.jsx)(b.$n,{variant:"danger",onClick:h,disabled:!c.trim()||u,icon:u?(0,n.jsx)("div",{className:"w-3.5 h-3.5 border-2 border-red-400/30 border-t-red-400 rounded-full animate-spin"}):void 0,className:"flex-1 py-2.5 rounded-xl",children:"Cancel Event"})]})]})]})}var N=s(85964);let k=[{key:"daily",label:"Every day",helper:"Repeats daily"},{key:"weekly",label:"Every week",helper:"Same day, same time"},{key:"biweekly",label:"Every two weeks",helper:"Every other week"},{key:"monthly",label:"Every month",helper:"Same date each month"}],C=new Intl.DateTimeFormat("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"});function S(e){let{open:t,onClose:s,sourceEventId:a,sourceEventName:r,sourceEventDate:l,onCreated:o}=e,{notify:c}=(0,p.Y)(),[d,u]=(0,i.useState)("weekly"),[m,h]=(0,i.useState)("count"),[x,v]=(0,i.useState)("3"),[g,j]=(0,i.useState)(""),[w,S]=(0,i.useState)(!1),I=(0,i.useMemo)(()=>{let e="count"===m?parseInt(x,10)+1:52;if(isNaN(e)||e<=0)return[];let t="until"===m&&g?new Date(g):void 0;return(0,N.t)(l,d,{after:e,until:t})},[d,m,x,g,l]),A=(0,i.useMemo)(()=>
1{if("count"===m){let e=parseInt(x,10);if(isNaN(e)||e<1)return"Repeat at least one more time";if(e>51)return"Up to 51 more events (52 total max)"}else{if(!g)return"Pick an end date";if(new Date(g)<=l)return"End date must be after the original event"}return I.length<2?"This pattern doesn't produce any future dates":null},[m,x,g,l,I]),D=Math.max(0,I.length-1),E=(0,i.useCallback)(async()=>{if(!A&&!w){S(!0);try{let e=await (0,N.G)({sourceEventId:a,recurrence:{pattern:d,..."count"===m&&{endAfter:parseInt(x,10)+1},..."until"===m&&g&&{endDate:new Date(g)}}}),t=e.newEventIds.length,n=e.extras.totals,i=n.promoCodes.ok||n.forms.ok||n.affiliateProfiles.ok?" — same setup applied to each.":"";c({type:"success",message:"".concat(t," more event").concat(1!==t?"s":""," scheduled").concat(i)}),null==o||o({seriesId:e.seriesId,newEventCount:t}),s()}catch(e){(0,y.WL)("MakeRecurring",c)(e)}finally{S(!1)}}},[A,w,a,d,m,x,g,c,o,s]);return t?(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:w?void 0:s}),(0,n.jsxs)("div",{className:"relative w-full max-w-lg mx-4 bg-modal-glass border border-card rounded-2xl shadow-2xl overflow-hidden max-h-[calc(100dvh-2rem)] flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-white/5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"studio-subtitle",children:"Repeat this event"}),(0,n.jsx)("p",{className:"studio-caption mt-0.5 truncate max-w-[400px]",children:r})]}),(0,n.jsx)("button",{onClick:s,disabled:w,className:"p-1.5 rounded-lg hover:bg-white/5 text-t2 hover:text-t1/70 transition disabled:opacity-30",children:(0,n.jsx)(f.fK,{className:"w-5 h-5"})})]}),(0,n.jsxs)("div",{className:"px-6 py-5 space-y-5 overflow-y-auto ".concat(w?"pointer-events-none opacity-60":""),children:[(0,n.jsx)("p",{className:"studio-caption leading-relaxed",children:"We'll create copies on a schedule — same description, ticket tiers, promo codes, forms, and profiles, all already in place."}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"studio-label",children:"How often"}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:k.map(e=>(0,n.jsxs)("button",{onClick:()=>u(e.key),className:"px-3 py-2.5 rounded-lg text-left text-sm transition ".concat(d===e.key?"bg-white/[0.08] border border-white/15 text-t1":"bg-card border border-card text-t2 hover:text-t1"),children:[(0,n.jsx)("div",{className:"font-medium",children:e.label}),(0,n.jsx)("div",{className:"studio-caption mt-0.5",children:e.helper})]},e.key))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"studio-label",children:"For how long"}),(0,n.jsxs)("div",{className:"mt-2 flex rounded-lg border border-white/[0.06] overflow-hidden text-sm",children:[(0,n.jsx)("button",{onClick:()=>h("count"),className:"flex-1 px-3 py-2 transition ".concat("count"===m?"bg-white/10 text-t1":"text-t3 hover:text-t2"),children:"A set number of times"}),(0,n.jsx)("button",{onClick:()=>h("until"),className:"flex-1 px-3 py-2 transition ".concat("until"===m?"bg-white/10 text-t1":"text-t3 hover:text-t2"),children:"Until a date"})]}),"count"===m?(0,n.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-xs text-t3",children:"Repeat"}),(0,n.jsx)("input",{type:"number",min:"1",max:"51",value:x,onChange:e=>v(e.target.value),className:"w-20 px-3 py-2 rounded-lg bg-white/5 border border-white/10 text-sm text-t1 outline-none focus:border-white/20 text-center"}),(0,n.jsxs)("span",{className:"text-xs text-t3",children:["more ",1===parseInt(x,10)?"time":"times"]})]}):(0,n.jsx)("div",{className:"mt-3",children:(0,n.jsx)("input",{type:"date",value:g,onChange:e=>j(e.target.value),className:"w-full px-3 py-2 rounded-lg bg-white/5 border border-white/10 text-sm text-t1 outline-none focus:border-white/20 [color-scheme:dark]"})})]}),I.length>0&&(0,n.jsxs)("div",{className:"rounded-lg bg-card border border-card p-3",children:[(0,n.jsx)("p",{className:"studio-label mb-2",children:D>0?"We'll create ".concat(D," more event").concat(1!==D?"s":""):"No new events yet"}),(0,n.jsxs)("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:[I.slice(0,6).map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,n.jsx)("span",{className:"text-t2",children:C.format(e)}),0===t&&(0,n.jsx)("span",{className:"text-[10px] text-t4 px-1.5 py-0.5 rounded bg-white/[0.05]",children:"This event"})]},e.getTime())),I.length>6&&(0,n.jsxs)("div",{className:"studio-micro pt-1",children:["…and ",I.length-6," more"]})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 px-6 py-4 border-t border-white/5",children:[(0,n.jsx)("p",{className:"text-xs truncate ".concat(A?"text-negative-ink/70":"text-t4"),children:null!=A?A:""}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsx)(b.$n,{variant:"secondary",onClick:s,disabled:w,children:"Cancel"}),(0,n.jsx)(b.$n,{variant:"primary",onClick:E,disabled:!!A||w,icon:w?(0,n.jsx)("div",{className:"w-3.5 h-3.5 border-2 border-black/20 border-t-black rounded-full animate-spin"}):void 0,className:"min-w-[140px]",children:w?"Scheduling…":D>0?"Schedule ".concat(D," more event").concat(1!==D?"s":""):"Schedule events"})]})]})]})]}):null}var I=s(91196),A=s(12353),D=s(202);let E=[{id:"email",label:"Email",description:"Guests with an email on file (unsubscribes suppressed)",locked:!1,defaultOn:!0},{id:"notification",label:"In-app notification",description:"Every guest with the app",locked:!1,defaultOn:!0},{id:"sms",label:"SMS",description:"Opted-in guests with a verified phone",locked:!1,defaultOn:!1}],T=E.reduce((e,t)=>
1(e[t.id]=t.defaultOn,e),{}),L=E.reduce((e,t)=>(e[t.id]=t,e),{});function R(e){return E.filter(t=>!t.locked&&e[t.id]).map(e=>e.id)}var U=s(79718),F=s(56384),z=s(63095),M=s(3552);function P(e){let{eventId:t,message:s,onUse:a}=e,{audience:i,loading:r,error:l,refresh:o}=(0,M.d)(t);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(z.A,{audience:i,loading:r,error:l,onRefresh:()=>void o()}),(0,n.jsx)(F.A,{eventId:t,currentMessage:s,onUse:a},t)]})}var H=s(73041);let O={email:"email",notification:"in-app",sms:"SMS"};function B(e){var t,s,a;let{open:r,onClose:c,eventId:m,eventName:h,eventImageUrl:x,eventDateLabel:v,eventVenue:g,guestCount:y}=e,{notify:j}=(0,p.Y)(),[w,N]=(0,i.useState)(""),[k,C]=(0,i.useState)(""),[S,I]=(0,i.useState)(T),[F,z]=(0,i.useState)("compose"),[M,B]=(0,i.useState)(!1),[_,W]=(0,i.useState)(!1),[$,V]=(0,i.useState)(null),[Y,q]=(0,i.useState)(null),[K,G]=(0,i.useState)(!1),[J,Q]=(0,i.useState)(""),Z=(0,i.useRef)({}),X=(0,i.useRef)({email:(0,u.k)(),notification:(0,u.k)()}),ee=(0,i.useRef)({}),[et,es]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!r||!m)return;let e=!1;return fetch("/api/email-audience-count?eventId=".concat(m)).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&"number"==typeof t.withEmail&&es(t.withEmail)}).catch(()=>{e||es(null)}),()=>{e=!0}},[r,m]);let[en,ea]=(0,i.useState)("Your host");if((0,i.useEffect)(()=>{var e;if(!r)return;
1let t=null==(e=d.auth.currentUser)?void 0:e.uid;if(!t)return;let s=!1;return(0,l.getDoc)((0,l.doc)(d.db,"users",t)).then(e=>{var t;if(s)return;let n=e.data()||{},a=[n.firstName,n.lastName].filter(Boolean).join(" ").trim()||(n.displayName||"").trim()||((null==(t=d.auth.currentUser)?void 0:t.displayName)||"").trim();a&&ea(a)}).catch(()=>{}),()=>{s=!0}},[r]),!r)return null;let ei=(t=w,s=k,a=S,t.trim().length>0&&s.trim().length>0&&R(a).length>0),er=S.email,el=S.notification,eo=(en.trim().charAt(0)||"S").toUpperCase(),ec=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!e&&(M||_)||(N(""),C(""),I(T),z("compose"),V(null),q(null),G(!1),Q(""),Z.current={},ee.current={},X.current={email:(0,u.k)(),notification:(0,u.k)()},c())},ed=async()=>{W(!0),Q(""),G(!1);try{S.sms&&!Z.current.sms&&q(await (0,H.Qj)(m,null!=$?$:k)),z("confirm")}catch(e){Q(e.message)}finally{W(!1)}},eu=async()=>{var e;if(S.sms&&!Z.current.sms&&!(0,H.R2)(Y,K))return;let t=null==(e=d.auth.currentUser)?void 0:e.uid;if(!t)return void j({type:"error",message:"You must be signed in to send an announcement."});let s=R(S);if(0===s.length)return void j({type:"error",message:"Pick at least one channel to send."});B(!0);let n=w.trim(),a=k.trim(),i={...Z.current},r="";if(s.includes("email")&&!i.email)try{let e=X.current.email;ee.current.email||await (0,l.setDoc)((0,l.doc)(d.db,"email_campaigns",e),{name:"Announcement: ".concat(n),subject:n,preheaderText:"",body:a,templateId:"host_announcement",ctaText:"View Event",ctaUrl:"https://socialloop.ai/loops/".concat(m),fromName:en,fromEmail:"",replyTo:"",useAiPersonalization:!1,aiContext:"",audienceType:"event_participants",distributionListId:null,segmentFilters:null,sendAs:null,eventId:m,eventName:h,eventDate:v||null,eventVenue:g||null,hostName:en,estimatedAudienceSize:null!=et?et:null,producerUserId:t,createdBy:t,status:"draft",stats:{sent:0,delivered:0,opened:0,clicked:0,bounced:0,failed:0,unsubscribed:0},createdAt:(0,l.serverTimestamp)(),updatedAt:(0,l.serverTimestamp)()}),ee.current.email=!0,await (0,o.httpsCallable)(d.functions,"sendEmailCampaign")({campaignId:e}),i.email=!0}catch(e){i.email=!1,r=r||e.message,(0,D.T)(e)||(0,A.V9)("announcement",e,{channel:"email",eventId:m})}if(s.includes("notification")&&!i.notification)try{let e=X.current.notification;ee.current.notification||await (0,l.setDoc)((0,l.doc)(d.db,"notification_campaigns",e),{name:"Announcement: ".concat(n),persona:"host",title:n,body:a,useAiPersonalization:!1,audienceType:"event_participants",status:"draft",createdBy:t,producerUserId:t,hostName:en,stats:{audienceSize:0,sent:0,delivered:0,failed:0},eventId:m,eventName:h,eventImageUrl:x||null,createdAt:(0,l.serverTimestamp)(),updatedAt:(0,l.serverTimestamp)()}),ee.current.notification=!0,await (0,o.httpsCallable)(d.functions,"sendNotificationCampaign")({campaignId:e}),i.notification=!0}catch(e){i.notification=!1,r=r||e.message,(0,D.T)(e)||(0,A.V9)("announcement",e,{channel:"notification",eventId:m})}if(s.includes("sms")&&!i.sms&&Y)try{await (0,H.lM)(Y.previewId),i.sms=!0}catch(e){r=r||e.message}Z.current={...Z.current,...Object.fromEntries(Object.entries(i).filter(e=>{let[,t]=e;return t}))},B(!1);let c=s.filter(e=>i[e]),u=s.filter(e=>!i[e]),p=c.map(e=>O[e]).join(" and ");if(0===u.length)j({type:"success",message:"Announcement submitted via ".concat(p,".").concat(S.sms?" SMS delivery is tracked in SMS Blasts.":"")}),ec(!0);else if(c.length>0){let e=s.map(e=>"".concat(O[e]," ").concat(i[e]?"✓":"✗")).join(", ");j({type:"success",message:"Announcement partly sent (".concat(e,").").concat(r?" ".concat(r):"")}),z("confirm")}else j({type:"error",message:"Announcement failed to send.".concat(r?" ".concat(r):"")}),z("confirm")},em=null===et?"guests with an email on file":"".concat(et," guest").concat(1===et?"":"s"," by email");return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:(0,n.jsxs)("div",{className:"bg-modal-glass border border-card rounded-2xl w-full max-w-md mx-4 max-h-[calc(100dvh-2rem)] flex flex-col overflow-hidden",children:[(0,n.jsxs)("div",{className:"shrink-0 flex items-center justify-between px-5 py-4 border-b border-white/[0.06]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"studio-body-strong",children:"Make an Announcement"}),(0,n.jsx)("p",{className:"studio-caption mt-0.5",children:"compose"===F?"Reach your registered guests":"Preview — exactly what your guests receive"})]}),(0,n.jsx)("button",{onClick:()=>ec(),className:"text-t2 hover:text-t1 transition","aria-label":"Close",children:(0,n.jsx)(f.fK,{className:"w-5 h-5"})})]}),"compose"===F&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"studio-caption block mb-1.5",children:"Subject"}),(0,n.jsx)("input",{value:w,onChange:e=>N(e.target.value),maxLength:120,className:"w-full bg-card border border-card rounded-lg px-3 py-2 text-sm text-t1 placeholder-t3 focus:outline-none focus:border-brand",placeholder:"e.g. A small change to Sunday's dinner"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"studio-caption block mb-1.5",children:"Message"}),(0,n.jsx)("textarea",{value:k,onChange:e=>C(e.target.value),rows:5,className:"w-full bg-card border border-card rounded-lg px-3 py-2 text-sm text-t1 placeholder-t3 focus:outline-none focus:border-brand resize-none",placeholder:"Write your announcement to all guests…"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"studio-caption block mb-1.5",children:"Send via"}),(0,n.jsx)("div",{className:"space-y-1.5",children:E.map(e=>{let t=S[e.id],s=e.locked;return(0,n.jsxs)("button",{type:"button",disabled:s,"aria-pressed":t,"aria-disabled":s,onClick:()=>!s&&I(t=>{var s,n;
1return L[n=s=e.id]&&!L[n].locked?{...t,[s]:!t[s]}:t}),className:"w-full flex items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition ".concat(s?"border-card bg-card/40 opacity-60 cursor-not-allowed":t?"border-brand/30 bg-brand/10":"border-card bg-card hover:border-white/[0.12]"),children:[(0,n.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border ".concat(t&&!s?"border-brand bg-brand":"border-[var(--border-emphasis)] bg-transparent"),children:t&&!s&&(0,n.jsx)("svg",{viewBox:"0 0 12 12",className:"h-3 w-3 text-surface-base",fill:"none",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{d:"M2.5 6.5l2.2 2.2 4.6-5",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-t1",children:e.label}),e.locked&&(0,n.jsx)("span",{className:"rounded-full bg-white/[0.08] px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-t3",children:"Coming soon"})]}),(0,n.jsx)("span",{className:"block text-xs text-t3",children:e.description})]})]},e.id)})})]}),S.sms&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(P,{eventId:m,message:null!=$?$:k,onUse:V}),(0,n.jsx)("label",{htmlFor:"announcement-sms-message",className:"studio-caption block mb-1.5",children:"Text message"}),(0,n.jsx)("textarea",{id:"announcement-sms-message",value:null!=$?$:k,onChange:e=>V(e.target.value),maxLength:1e3,rows:3,className:"w-full bg-card border border-card rounded-lg px-3 py-2 text-sm text-t1 focus:outline-none focus:border-brand"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-t3",children:"Shorten the text if needed. The organizer, event name and STOP instructions are added automatically."})]}),J&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-[color:var(--state-negative-fg)]",children:J}),(0,n.jsxs)("p",{className:"studio-caption text-t3",children:["Goes only to this event's ",y," registered guest",1===y?"":"s",".",er?" Guests who unsubscribed won’t be emailed.":""]})]}),(0,n.jsxs)("div",{className:"shrink-0 flex items-center justify-end gap-2 px-5 py-4 border-t border-white/[0.06]",children:[(0,n.jsx)(b.$n,{variant:"secondary",onClick:()=>ec(),children:"Cancel"}),(0,n.jsx)(b.$n,{onClick:ed,disabled:!ei||_,children:_?"Checking audience…":"Continue"})]})]}),"confirm"===F&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[er&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"studio-caption text-t3 mb-1.5",children:"Email"}),(0,n.jsxs)("div",{className:"rounded-xl overflow-hidden border border-card",style:{backgroundColor:"#0A0A0A"},children:[(null==x?void 0:x.startsWith("https://"))&&(0,n.jsx)("div",{style:{padding:"18px 18px 0",textAlign:"center"},children:(0,n.jsx)("img",{src:x,alt:h,style:{width:180,height:180,objectFit:"cover",borderRadius:14,display:"inline-block"}})}),(0,n.jsxs)("div",{style:{padding:18},children:[(0,n.jsx)("p",{style:{margin:0,fontSize:10,fontWeight:700,color:"#E8C872",textTransform:"uppercase",letterSpacing:1.5},children:"\uD83D\uDCE2 Announcement"}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,margin:"14px 0 16px"},children:[(0,n.jsx)("div",{style:{width:36,height:36,borderRadius:18,backgroundColor:"#FFFFFF",color:"#000",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:15},children:eo}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{style:{margin:0,fontSize:11,color:"#999"},children:"From your host"}),(0,n.jsx)("p",{style:{margin:"2px 0 0",fontSize:14,fontWeight:600,color:"#fff"},children:en})]})]}),(0,n.jsx)("h1",{style:{margin:"0 0 10px",fontSize:18,fontWeight:700,color:"#fff",lineHeight:"24px"},children:w.trim()}),(0,n.jsx)("div",{children:k.trim().split("\n").map((e,t)=>e.trim()?(0,n.jsx)("p",{style:{margin:"0 0 10px",fontSize:14,color:"#fff",lineHeight:"21px"},children:e.trim()},t):(0,n.jsx)("br",{},t))}),(h||v||g)&&(0,n.jsxs)("div",{style:{backgroundColor:"#1A1A1A",border:"1px solid #222",borderRadius:10,padding:"14px 16px",margin:"18px 0 4px"},children:[(0,n.jsx)("p",{style:{margin:"0 0 6px",fontSize:10,fontWeight:700,color:"#555",textTransform:"uppercase",letterSpacing:1.2},children:"Event"}),h&&(0,n.jsx)("p",{style:{margin:0,fontSize:14,fontWeight:600,color:"#fff"},children:h}),v&&(0,n.jsx)("p",{style:{margin:"6px 0 0",fontSize:13,color:"#E8C872",fontWeight:600},children:v}),g&&(0,n.jsx)("p",{style:{margin:"4px 0 0",fontSize:12,color:"#999"},children:g})]}),(0,n.jsx)("div",{style:{textAlign:"center",marginTop:20},children:(0,n.jsx)("span",{style:{display:"inline-block",padding:"12px 28px",backgroundColor:"#fff",color:"#000",borderRadius:10,fontSize:14,fontWeight:600},children:"View Event"})})]})]})]}),el&&(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"studio-caption text-t3 mb-1.5",children:"In-app notification"}),(0,n.jsxs)("div",{className:"rounded-xl bg-card border border-card px-3 py-3 flex items-start gap-3",children:[(0,n.jsx)("img",{src:"https://socialloop.ai/branding-128.png",alt:"SocialLoop",width:36,height:36,style:{width:36,height:36,borderRadius:9,flexShrink:0}}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm text-t1 font-medium truncate",children:w.trim()}),(0,n.jsx)("p",{className:"text-sm text-t2 line-clamp-2",children:k.trim()})]})]})]}),S.sms&&Y&&(0,n.jsx)(U.A,{preview:Y,confirmed:K,onConfirm:G}),(0,n.jsxs)("p",{className:"studio-caption text-t2",children:[el&&(0,n.jsxs)(n.Fragment,{children:["This will notify ",(0,n.jsxs)("span",{className:"text-t1 font-medium",children:["all ",y," guest",1===y?""
1:"s"]})," in-app"]}),el&&er?" and ":"",er&&(0,n.jsxs)(n.Fragment,{children:["email ",(0,n.jsx)("span",{className:"text-t1 font-medium",children:em})]}),S.sms?" SMS is queued for eligible opted-in guests.":"."," Sent messages can't be recalled."]})]}),(0,n.jsxs)("div",{className:"shrink-0 flex items-center justify-end gap-2 px-5 py-4 border-t border-white/[0.06]",children:[(0,n.jsx)(b.$n,{variant:"secondary",onClick:()=>z("compose"),disabled:M,children:"Back"}),(0,n.jsx)(b.$n,{onClick:eu,disabled:M||S.sms&&!Z.current.sms&&!(0,H.R2)(Y,K),icon:M?(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-white/30 border-t-[rgb(var(--surface-base))] rounded-full animate-spin"}):(0,n.jsx)(f.sZ,{className:"w-4 h-4"}),children:M?"Submitting…":"Send announcement"})]})]})]})})}var _=s(13038),W=s(34598),$=s(8824),V=s(27590),Y=s(10579),q=s(26825),K=s(96709);function G(e){let{open:t,onClose:s,eventName:a,totalCount:i,thisAndFutureCount:r,onChoose:l}=e;return t?(0,n.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:s}),(0,n.jsxs)("div",{className:"relative w-full max-w-md mx-4 bg-card border border-card rounded-2xl shadow-2xl overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-6 py-5 border-b border-white/5",children:[(0,n.jsx)("h2",{className:"studio-subtitle",children:"Apply to which events?"}),(0,n.jsxs)("p",{className:"studio-caption mt-1 truncate",children:[a," is part of a recurring series."]})]}),(0,n.jsxs)("div",{className:"px-3 py-3 space-y-1",children:[(0,n.jsx)(J,{label:"Just this event",sub:"Only the one you're editing",onClick:()=>l("this")}),(0,n.jsx)(J,{label:"This and all future events",sub:"".concat(r," event").concat(1!==r?"s":""," affected"),onClick:()=>l("thisAndFuture")}),(0,n.jsx)(J,{label:"All events in the series",sub:"".concat(i," event").concat(1!==i?"s":""," affected — including past"),onClick:()=>l("all")})]}),(0,n.jsx)("div",{className:"flex items-center justify-end gap-2 px-6 py-4 border-t border-white/5",children:(0,n.jsx)(b.$n,{variant:"ghost",onClick:s,children:"Cancel"})})]})]}):null}function J(e){let{label:t,sub:s,onClick:a}=e;return(0,n.jsxs)("button",{onClick:a,className:"w-full text-left px-4 py-3 rounded-lg hover:bg-white/[0.06] transition group",children:[(0,n.jsx)("div",{className:"studio-body-strong",children:t}),(0,n.jsx)("div",{className:"studio-caption mt-0.5",children:s})]})}var Q=s(6100),Z=s(67073),X=s(11374),ee=s(49848),et=s(47394),es=s(175);function en(e){let{seriesId:t,currentEventId:s}=e,[a,r]=(0,i.useState)(null);return((0,i.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await (0,l.getDoc)((0,l.doc)(d.db,"eventSeries",t));if(e||!n.exists())return;let a=n.data(),i=Array.isArray(a.eventIds)?a.eventIds:[],o=i.indexOf(s);if(-1===o)return;r({index:o+1,total:i.length,pattern:a.pattern||"weekly"})}catch(e){}})(),()=>{e=!0}},[t,s]),a)?(0,n.jsxs)("p",{className:"studio-micro mt-1",children:["Event ",a.index," of ",a.total," \xb7 ",a.pattern]}):null}function ea(e){let{value:t,onSave:s}=e,[a,r]=(0,i.useState)(!1),[l,o]=(0,i.useState)(t),[c,d]=(0,i.useState)(!1),u=(0,i.useRef)(null);(0,i.useEffect)(()=>{o(t)},[t]),(0,i.useEffect)(()=>{var e;a&&(null==(e=u.current)||e.select())},[a]);let m=async()=>{let e=l.trim();if(!e||e===t){r(!1),o(t);return}d(!0),await s(e),d(!1),r(!1)};return a?(0,n.jsx)("input",{ref:u,type:"text",value:l,autoFocus:!0,disabled:c,onChange:e=>o(e.target.value),onBlur:m,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),m()),"Escape"===e.key&&(r(!1),o(t))},className:"w-full text-[14px] text-white bg-transparent outline-none -mx-1.5 px-1.5 py-0.5 rounded-md ring-1 ring-white/[0.12] focus:ring-white/[0.25]"}):(0,n.jsx)("button",{type:"button",onClick:()=>r(!0),className:"w-full text-left -mx-1.5 px-1.5 py-0.5 rounded-md hover:bg-white/[0.03] transition",children:(0,n.jsx)("span",{className:"text-[14px] text-t2",children:t})})}function ei(e){let t=e=>e.toString().padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()),"T").concat(t(e.getHours()),":").concat(t(e.getMinutes()))}function er(e){let{label:t,value:s,onSave:a}=e,[r,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(ei(s)),[d,u]=(0,i.useState)(!1),{notify:m}=(0,p.Y)();(0,i.useEffect)(()=>{c(ei(s))},[s]);let h=async()=>{let e=new Date(o);if(isNaN(e.getTime())){m({type:"error",message:"Invalid date"}),l(!1),c(ei(s));return}if(e.getTime()===s.getTime())return void l(!1);u(!0),await a(e),u(!1),l(!1)};return r?(0,n.jsx)("input",{type:"datetime-local",value:o,autoFocus:!0,disabled:d,onChange:e=>c(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.currentTarget.blur()),"Escape"===e.key&&(l(!1),c(ei(s)))},"aria-label":t,className:"w-full bg-card border border-card rounded-md px-2 py-1 text-[14px] text-white outline-none focus:border-white/[0.18] transition [color-scheme:dark]"}):(0,n.jsx)("button",{type:"button",onClick:()=>l(!0),className:"w-full text-left -mx-1.5 px-1.5 py-0.5 rounded-md hover:bg-white/[0.03] transition",children:(0,n.jsx)("span",{className:"text-[14px] text-t2",children:s.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})})}function el(e){let{value:t,onSave:s}=e,[a,r]=(0,i.useState)(!1),[l,o]=(0,i.useState)(!1),c=t?(0,$.gQ)(t):null;return a?(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:t||"",autoFocus:!0,disabled:l,onChange:async e=>{let t=e.target.value;o(!0),await s(t),o(!1),r(!1)},onBlur:()=>r(!1),className:"appearance-none bg-card border border-card rounded-md pl-2 pr-7 py-1 text-[14px] text-white outline-none focus:border-white/[0.18] transition",children:[(0,n.jsx)("option",{value:"",children:"No category"}),Object.entries($.Is).map(e=>{let[t,s]=e;return(0,n.jsx)("option",{value:t,children:s},t)})]}),(0,n.jsx)(f.D3,{className:"w-3.5 h-3.5 text-t3 absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none"})]}):(0,n.jsx)("button",{type:"button",onClick:()=>r(!0),className:"text-left -mx-1.5 px-1.5 py-0.5 rounded-md hover:bg-white/[0.03] transition",children:(0,n.jsx)("span",{className:"text-[14px] ".concat(c?"text-t2":"text-t4 italic"),children:c||"Click to add a category"})})}function eo(e){let{html:t,text:s,eventId:r,onSave:l}=e,[o,c]=(0,i.useState)(!1),[d,u]=(0,i.useState)(t),[m,h]=(0,i.useState)(s),[x,p]=(0,i.useState)(!1),[v,f]=(0,i.useState)(!1),b=(0,i.useRef)(null),g=(0,i.useMemo)(()=>(0,K.x6)(t||""),[t]);(0,i.useEffect)(()=>{o||(u(t),h(s))},[t,s,o]);let y=async()=>
1{if(v)return;if(d===t&&m===s)return void c(!1);p(!0);let e=(0,K.x6)(d),n=(0,K.uN)(e);await l({eventDescription:m.trim(),eventDescriptionHTML:e,inlineImageRefs:n}),p(!1),c(!1)},j=(0,i.useRef)(y);return(j.current=y,(0,i.useEffect)(()=>{if(!o)return;let e=e=>{let t=b.current;t&&(t.contains(e.target)||j.current())};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),o)?(0,n.jsxs)("div",{ref:b,className:"space-y-2",children:[(0,n.jsx)(Y.default,{onUploadStateChange:f,value:d,onChange:(e,t)=>{u(e),h(t)},placeholder:"Describe your event...",eventId:r}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>{c(!1),u(t),h(s)},disabled:x||v,className:"px-2.5 py-1 rounded-md text-[11px] text-t3 hover:text-white transition",children:"Cancel"}),(0,n.jsx)("button",{type:"button",onClick:y,disabled:x||v,className:"px-3 py-1 rounded-md bg-brand text-surface-base text-[11px] font-semibold disabled:opacity-50 transition",children:x?"Saving…":"Save"})]})]}):(0,n.jsx)("div",{role:"button",tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c(!0))},onClick:()=>c(!0),className:"w-full text-left -mx-1.5 px-1.5 py-1.5 rounded-md hover:bg-white/[0.03] transition",children:t?(0,n.jsx)(a.A,{className:"description-preview max-w-none max-h-[500px] overflow-y-auto overflow-x-hidden text-[14px] leading-relaxed text-t2 [&>p]:mb-2.5 [&>p:last-child]:mb-0",style:{overflowWrap:"break-word"},sanitizedHTML:g}):(0,n.jsx)("p",{className:s?"whitespace-pre-wrap text-[14px] leading-relaxed text-t2 max-h-[300px] overflow-y-auto":"studio-body studio-dim italic",children:s||"Click to add a description"})})}function ec(e){let{address:t,onSave:s}=e,[a,r]=(0,i.useState)(!1),[o,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(!1),[m,h]=(0,i.useState)(!1),x=async()=>{if(!d)return void r(!1);h(!0),await s(function(e){if(!e)return{locationAddress:"",venue:null};let t=e.formattedAddress||e.name,s={locationAddress:t},{latitude:n,longitude:a}=e.coordinates;return 0!==n&&0!==a&&(s.location=new l.GeoPoint(n,a),s.venue={name:e.name&&e.name!==t?e.name:t,address:t,latitude:n,longitude:a}),s}(o)),h(!1),r(!1),u(!1)};return a?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(q.A,{value:o,onChange:e=>{c(e),u(!0)}}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>{r(!1),u(!1)},disabled:m,className:"px-2.5 py-1 rounded-md text-[11px] text-t3 hover:text-white transition",children:"Cancel"}),(0,n.jsx)("button",{type:"button",onClick:x,disabled:m,className:"px-3 py-1 rounded-md bg-brand text-surface-base text-[11px] font-semibold disabled:opacity-50 transition",children:m?"Saving…":"Save"})]})]}):(0,n.jsx)("button",{type:"button",onClick:()=>{c(t?{placeId:"",formattedAddress:t,coordinates:{latitude:0,longitude:0},name:t}:null),u(!1),r(!0)},className:"w-full text-left -mx-1.5 px-1.5 py-0.5 rounded-md hover:bg-white/[0.03] transition",children:(0,n.jsx)("span",{className:"text-[14px] ".concat(t?"text-t2":"text-t4 italic"),children:t||"Click to add a location"})})}function ed(e){let{overridden:t,seriesId:s,busy:a,onReset:i}=e;return t&&s?(0,n.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,n.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/10 text-attention-ink",children:"Edited for this event"}),(0,n.jsx)("button",{type:"button",onClick:i,disabled:a,className:"text-[11px] text-t3 hover:text-t1 underline underline-offset-2 disabled:opacity-50 transition",children:a?"Resetting…":"Reset to series template"})]}):null}function eu(){var e,t,s,a,o,u,h,j;let N=(0,c.useRouter)(),k=(0,c.usePathname)(),{notify:C}=(0,p.Y)(),{eventId:D,eventData:E,loading:T,setEventId:L,isHost:R}=(0,v._)(),[,U]=(0,g.W)("tab","my-events"),[F,z]=(0,i.useState)(!1),[M,P]=(0,i.useState)(!1),[H,O]=(0,i.useState)(!1),[_,Y]=(0,i.useState)(!1),[q,K]=(0,i.useState)(null),[J,es]=(0,i.useState)(null);(0,i.useEffect)(()=>{D&&(0,x.sL)(D).then(e=>K(e)).catch(()=>{})},[D]),(0,i.useEffect)(()=>{D&&(0,V.I)(D).then(e=>es(e)).catch(()=>{})},[D]);let ei=null!=(e=null!=q?q:null==E?void 0:E.attendeeCount)?e:0,eu=null!=(t=null!=J?J:null==E?void 0:E.revenue)?t:0,{save:em,scopeChooser:ex}=function(e){let{notify:t}=(0,p.Y)(),[s,a]=(0,i.useState)(!1),[r,o]=(0,i.useState)(null),[c,u]=(0,i.useState)({total:0,thisAndFuture:0}
1),m=(0,i.useCallback)(async s=>{let n="eventDate"in s||"eventEndDate"in s;if(e.seriesId&&!n)try{let t=await (0,Q.yZ)(e.seriesId);if(t){let n=t.eventIds.indexOf(e.id),i=n>=0?t.eventIds.length-n:1;u({total:t.eventIds.length,thisAndFuture:i}),o(s),a(!0);return}}catch(e){}try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",e.id),s),t({type:"success",message:"Saved"})}catch(s){(0,A.V9)("event-save",s,{feature:"event-inline-save",eventId:e.id}),t({type:"error",message:"Failed to save"})}},[e.id,e.seriesId,t]),h=(0,i.useCallback)(async s=>{if(r&&e.seriesId){a(!1);try{if("this"===s){var n,i;let s={...r},a=null!=(i=null==(n=d.auth.currentUser)?void 0:n.uid)?i:null;for(let e of(0,Z.ZK)(r))s["fieldOverrides.".concat(e)]={at:(0,l.serverTimestamp)(),by:a};await (0,l.updateDoc)((0,l.doc)(d.db,"events",e.id),s),t({type:"success",message:"Saved"})}else{let n={};"string"==typeof r.eventName&&(n.eventName=r.eventName),"string"==typeof r.eventDescription&&(n.eventDescription=r.eventDescription),"string"==typeof r.eventDescriptionHTML&&(n.eventDescriptionHTML=r.eventDescriptionHTML),Array.isArray(r.inlineImageRefs)&&(n.inlineImageRefs=r.inlineImageRefs),"string"==typeof r.category&&(n.category=r.category),"string"==typeof r.locationAddress&&(n.locationAddress=r.locationAddress);let a=r.location;a&&"number"==typeof a.latitude&&"number"==typeof a.longitude&&(n.locationLat=a.latitude,n.locationLng=a.longitude);let i=r.venue;i&&"string"==typeof i.name&&(n.venueName=i.name);let l=await (0,Q.pY)({seriesId:e.seriesId,fromEventId:e.id,scope:"thisAndFuture"===s?"thisAndFuture":"all",updates:n});t({type:"success",message:"Updated ".concat(l.affectedCount," event").concat(1!==l.affectedCount?"s":""," in the series")})}o(null)}catch(n){(0,A.V9)("event-save",n,{feature:"series-scoped-save",scope:s,eventId:e.id,seriesId:e.seriesId}),t({type:"error",message:"Failed to update series"})}}},[e.id,e.seriesId,r,t]);return{save:m,scopeChooser:(0,n.jsx)(G,{open:s,onClose:()=>{a(!1),o(null)},eventName:e.eventName,totalCount:c.total,thisAndFutureCount:c.thisAndFuture,onChoose:h})}}(null!=E?E:{id:D||"",eventName:""}),ep=(0,i.useMemo)(()=>(0,Z.nf)(null==E?void 0:E.fieldOverrides),[null==E?void 0:E.fieldOverrides]),[ev,ef]=(0,i.useState)(null),eb=(0,i.useCallback)(async e=>{if(D&&(null==E?void 0:E.seriesId)&&!ev){ef(e);try{await (0,Q.k2)({seriesId:E.seriesId,fromEventId:D,groups:[e]}),C({type:"success",message:"".concat(Z.nr[e]," reset to the series template")})}catch(t){(0,A.V9)("event-save",t,{feature:"series-override-reset",group:e,eventId:D,seriesId:E.seriesId}),C({type:"error",message:"Failed to reset to template"})}finally{ef(null)}}},[D,null==E?void 0:E.seriesId,ev,C]),ey=(0,i.useRef)(null),[ej,ew]=(0,i.useState)(null),[eN,ek]=(0,i.useState)(!1),eC=(0,i.useCallback)(e=>(0,r.JE)(e)?e.size>0xa00000?void C({type:"error",message:"Image must be less than 10MB"}):d.auth.currentUser?void(0,r.nO)(e).then(e=>{let t=new FileReader;t.onloadend=()=>ew(t.result),t.readAsDataURL(e)}).catch(()=>C({type:"error",message:"That photo couldn't be read. Try a JPG or PNG."})):void C({type:"error",message:"Please sign in to change the cover"}):void C({type:"error",message:"Please choose an image file"}),[C]),eS=(0,i.useCallback)(e=>{if(ew(null),!D)return;ek(!0);let t=(0,ee.u)("jpg");(async()=>{let s;try{s=await (0,X.uploadEventImage)(e,{fileName:t,contentType:e.type})}catch(e){(0,A.V9)("event-save",e,{feature:"event-cover-change",stage:"upload",eventId:D}),C({type:"error",message:"Failed to upload image"}),ek(!1);return}try{let e={imageURL:s};if(null==E?void 0:E.seriesId){var n,a;e["fieldOverrides.imageURL"]={at:(0,l.serverTimestamp)(),by:null!=(a=null==(n=d.auth.currentUser)?void 0:n.uid)?a:null}}await (0,l.updateDoc)((0,l.doc)(d.db,"events",D),e),C({type:"success",message:"Cover updated"})}catch(e){(0,A.V9)("event-save",e,{feature:"event-cover-change",stage:"save",eventId:D,seriesId:null==E?void 0:E.seriesId}),(0,y.WL)("EventOverview cover")(e),C({type:"error",message:"Failed to save cover"})}finally{ek(!1)}})()},[D,C,null==E?void 0:E.seriesId]);if(!D)return(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center h-80 text-center",children:[(0,n.jsx)("div",{className:"w-16 h-16 rounded-2xl bg-white/[0.04] flex items-center justify-center mb-4",children:(0,n.jsx)(f.c2,{className:"w-8 h-8 text-t2"})}),(0,n.jsx)("h2",{className:"studio-subtitle",children:"No Event Selected"}),(0,n.jsx)("p",{className:"studio-body mt-1 max-w-sm",children:"Select an event from My Events to view its details and manage it."})]});if(T||!E)return(0,n.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,n.jsx)("div",{className:"w-8 h-8 border-2 border-white/10 border-t-brand rounded-full animate-spin"})});let eI=(0,$.gQ)(E.category);return(0,n.jsxs)("div",{className:"space-y-8",children:[(0,n.jsx)(et.A,{}),"cancelled"===E.status&&(0,n.jsxs)("div",{className:"bg-red-500/10 border border-red-500/20 rounded-xl p-4 flex items-center gap-3",children:[(0,n.jsx)(f.tP,{className:"w-5 h-5 text-negative-ink"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-negative-ink",children:"This event has been cancelled"}),E.cancellationReason&&(0,n.jsx)("p",{className:"text-xs text-negative-ink/60 mt-0.5",children:E.cancellationReason})]})]}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-6",children:[(0,n.jsxs)("div",{className:"flex-shrink-0",children:[(()=>{let e=E.imageURL?(0,n.jsx)("img",{src:E.imageURL,alt:"",className:"w-full h-full aspect-square object-cover"}):(0,n.jsx)("div",{className:"w-full h-full aspect-square bg-surface-overlay flex items-center justify-center",children:(0,n.jsx)("svg",{className:"w-10 h-10 text-white/10",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})})});return R?(0,n.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=ey.current)?void 0:e.click()},disabled:eN,title:"Change cover",className:"group relative w-full sm:w-48 sm:h-48 aspect-square rounded-2xl overflow-hidden border border-white/[0.06] hover:border-white/[0.15] transition disabled:cursor-default",children:[e,!eN&&(0,n.jsx)("div",{className:"absolute inset-0 bg-black/25 sm:bg-black/0 sm:group-hover:bg-black/40 flex items-center justify-center transition",children:(0,n.jsx)("span",{className:"text-white/85 sm:text-white/0 sm:group-hover:text-white/85 text-xs font-semibold transition",children:E.imageURL?"Change":"Add cover"})}),eN&&(0,n.jsx)("div",{className:"absolute inset-0 bg-black/55 flex items-center justify-center",children:(0,n.jsx)("div",{className:"w-7 h-7 border-2 border-white/20 border-t-white rounded-full animate-spin"})})]}):(0,n.jsx)("div",{className:"w-full sm:w-48 sm:h-48 aspect-square rounded-2xl overflow-hidden",children:e})})(),(0,n.jsx)("input",{ref:ey,type:"file",accept:r.tH,className:"hidden",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];s&&eC(s),e.target.value=""}}),R&&(0,n.jsx)(ed,{overridden:ep.has("imageURL"),seriesId:E.seriesId,busy:"imageURL"===ev,onReset:()=>eb("imageURL")})]}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col justify-between pt-5 pb-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-start flex-wrap gap-x-7 gap-y-3 mb-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-lg font-semibold bg-gradient-to-b from-white to-w
1hite/50 bg-clip-text text-transparent tabular-nums leading-none",children:ei}),(0,n.jsx)("p",{className:"studio-label mt-1.5",children:"Guests"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-lg font-semibold bg-gradient-to-b from-white to-white/50 bg-clip-text text-transparent tabular-nums leading-none",children:(0,W.vv)(eu)}),(0,n.jsx)("p",{className:"studio-label mt-1.5",children:"Revenue"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-lg font-semibold bg-gradient-to-b from-white to-white/50 bg-clip-text text-transparent leading-none",children:E.hasTicketing?"On":"Off"}),(0,n.jsx)("p",{className:"studio-label mt-1.5 whitespace-nowrap",children:"Ticket Sales"})]}),(0,n.jsxs)("button",{type:"button",onClick:async()=>{if(!D)return;let e=!E.discovery;try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",D),{discovery:e})}catch(e){C({type:"error",message:"Failed to update"})}},className:"text-left",children:[(0,n.jsx)("div",{className:"relative w-8 h-[18px] rounded-full transition-colors flex-shrink-0 ".concat(E.discovery?"bg-success":"bg-[rgb(var(--color-brand)/0.1)]"),children:(0,n.jsx)("div",{className:"absolute top-[2px] w-[14px] h-[14px] rounded-full bg-white-fixed shadow-sm transition-transform ".concat(E.discovery?"translate-x-[15px]":"translate-x-[2px]")})}),(0,n.jsx)("p",{className:"studio-label mt-1.5",children:"Discovery"})]}),(0,n.jsxs)("button",{type:"button",onClick:async()=>{if(!D)return;let e=!E.hideParticipants;try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",D),{hideParticipants:e})}catch(e){C({type:"error",message:"Failed to update"})}},className:"text-left",children:[(0,n.jsx)("div",{className:"relative w-8 h-[18px] rounded-full transition-colors flex-shrink-0 ".concat(E.hideParticipants?"bg-[rgb(var(--color-brand)/0.1)]":"bg-success"),children:(0,n.jsx)("div",{className:"absolute top-[2px] w-[14px] h-[14px] rounded-full bg-white-fixed shadow-sm transition-transform ".concat(E.hideParticipants?"translate-x-[2px]":"translate-x-[15px]")})}),(0,n.jsx)("p",{className:"studio-label mt-1.5",children:E.hideParticipants?"Hide guests":"Show guests"})]})]}),eI&&(0,n.jsx)("p",{className:"studio-eyebrow mb-1.5",children:eI}),(0,n.jsx)("h1",{className:"studio-title bg-gradient-to-b from-white to-white/50 bg-clip-text text-transparent",children:E.eventName}),(0,n.jsxs)("div",{className:"mt-2 space-y-1",children:[(0,n.jsx)("p",{className:"studio-body",children:(()=>{let e=E.eventDate,t=E.eventEndDate,s={weekday:"long",month:"long",day:"numeric",year:"numeric"},n={hour:"numeric",minute:"2-digit"},a=e.toLocaleDateString("en-US",s),i=e.toLocaleTimeString("en-US",n);if(!t)return"".concat(a," at ").concat(i);let r=e.toDateString()===t.toDateString(),l=t.toLocaleTimeString("en-US",n);if(r)return"".concat(a," \xb7 ").concat(i," – ").concat(l);let o=t.toLocaleDateString("en-US",s);return"".concat(a," at ").concat(i," – ").concat(o," at ").concat(l)})()}),E.locationAddress&&(0,n.jsx)("p",{className:"studio-caption",children:E.locationAddress})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-4",children:[(0,n.jsx)(b.$n,{variant:"primary",size:"sm",onClick:()=>U("distribution"),icon:(0,n.jsx)(f.sZ,{className:"w-3.5 h-3.5"}),className:"font-semibold",children:"Promote"}),R&&"cancelled"!==E.status&&(0,n.jsx)(b.$n,{variant:"ghost",size:"sm",onClick:()=>Y(!0),icon:(0,n.jsx)(f.sZ,{className:"w-3.5 h-3.5"}),children:"Make an Announcement"}),(0,n.jsxs)("a",{href:E.shortLink?"https://socialloop.ai/go/".concat(E.shortLink):"/loops/".concat(D),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-white/[0.06] hover:bg-white/[0.1] text-t2 hover:text-t1/70 text-xs font-medium transition",children:[(0,n.jsx)(f.pT,{className:"w-3.5 h-3.5"}),"View Live Page"]}),R&&(0,n.jsx)(b.$n,{variant:"ghost",size:"sm",onClick:()=>O(!0),icon:(0,n.jsx)(f.zm,{className:"w-3.5 h-3.5"}),children:"Submit to Community"}),(0,n.jsx)(b.$n,{variant:"ghost",size:"sm",onClick:()=>N.push("".concat(k,"?tab=create-event&clone=").concat(D),{scroll:!1}),icon:(0,n.jsx)(f.Td,{className:"w-3.5 h-3.5"}),children:"Duplicate"}),R&&"cancelled"!==E.status&&!E.seriesId&&(0,n.jsx)(b.$n,{variant:"ghost",size:"sm",onClick:()=>P(!0),icon:(0,n.jsx)(f.Ho,{className:"w-3.5 h-3.5"}),children:"Set up as recurring"}),E.seriesId&&(0,n.jsx)(b.$n,{variant:"ghost",size:"sm",onClick:()=>{let e=new URLSearchParams(window.location.search);e.set("tab","series"),e.set("id",E.seriesId),e.delete("event"),N.push("".concat(k,"?").concat(e.toString()),{scroll:!1})},icon:(0,n.jsx)(f.Ho,{className:"w-3.5 h-3.5"}),children:"Manage series"})]})]})]}),(0,n.jsx)(eg,{eventId:D,shortLink:E.shortLink}),(0,n.jsx)(eh,{eventId:D,eventData:E}),(0,n.jsxs)("div",{className:"rounded-xl border border-card bg-card divide-y divide-white/[0.04]",children:[(0,n.jsx)("div",{className:"px-6 py-4",children:(0,n.jsx)("h2",{className:"studio-eyebrow",children:"Event Details"})}),(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsxs)("div",{className:"px-3.5 py-3 -mx-3.5",children:[(0,n.jsx)("p",{className:"studio-label",children:"Name"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(ea,{value:E.eventName,onSave:async e=>{await em({eventName:e})}})}),(0,n.jsx)(ed,{overridden:ep.has("eventName"),seriesId:E.seriesId,busy:"eventName"===ev,onReset:()=>eb("eventName")}
1)]})}),(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsxs)("div",{className:"px-3.5 py-3 -mx-3.5",children:[(0,n.jsx)("p",{className:"studio-label",children:"Description"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(eo,{html:E.eventDescriptionHTML||"",text:E.eventDescription||"",eventId:D,onSave:e=>em(e)})}),(0,n.jsx)(ed,{overridden:ep.has("description"),seriesId:E.seriesId,busy:"description"===ev,onReset:()=>eb("description")})]})}),(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 px-3.5 py-3 -mx-3.5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"studio-label",children:"Starts"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(er,{label:"Starts",value:E.eventDate,onSave:async e=>{await em({eventDate:l.Timestamp.fromDate(e)})}})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"studio-label",children:"Ends"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(er,{label:"Ends",value:E.eventEndDate,onSave:async e=>{await em({eventEndDate:l.Timestamp.fromDate(e)})}})})]})]})}),(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsxs)("div",{className:"px-3.5 py-3 -mx-3.5",children:[(0,n.jsx)("p",{className:"studio-label",children:"Location"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(ec,{address:E.locationAddress||"",onSave:e=>em(e)})}),(0,n.jsx)(ed,{overridden:ep.has("location"),seriesId:E.seriesId,busy:"location"===ev,onReset:()=>eb("location")})]})}),(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsxs)("div",{className:"px-3.5 py-3 -mx-3.5",children:[(0,n.jsx)("p",{className:"studio-label",children:"Category"}),(0,n.jsx)("div",{className:"mt-0.5",children:(0,n.jsx)(el,{value:E.category,onSave:async e=>{await em({category:e||""})}})}),(0,n.jsx)(ed,{overridden:ep.has("category"),seriesId:E.seriesId,busy:"category"===ev,onReset:()=>eb("category")})]})}),E.seriesId&&D&&(0,n.jsx)("div",{className:"px-6 py-2",children:(0,n.jsx)("div",{className:"px-3.5 py-3 -mx-3.5",children:(0,n.jsx)(en,{seriesId:E.seriesId,currentEventId:D})})})]}),(0,n.jsx)(b.lQ,{socials:E.socials,canEdit:R,notify:C,onSave:async e=>{try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",D),{socials:e})}catch(e){throw(0,A.V9)("event-save",e,{feature:"event-links-save",eventId:D}),e}}}),R&&"cancelled"!==E.status&&(0,n.jsxs)("div",{className:"rounded-xl border border-card bg-card px-6 py-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"studio-eyebrow",children:"Cancel Event"}),(0,n.jsx)("p",{className:"studio-caption mt-1",children:"Notify all guests and stop accepting RSVPs. This cannot be undone."})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>z(!0),className:"flex-shrink-0 inline-flex items-center justify-center gap-1.5 px-3.5 py-1.5 rounded-lg border border-red-500/20 hover:border-red-500/40 bg-red-500/[0.04] hover:bg-red-500/[0.08] text-[12px] font-medium text-negative-ink/80 hover:text-negative-ink transition",children:[(0,n.jsx)(f.tP,{className:"w-3.5 h-3.5"}),"Cancel event"]})]}),(0,n.jsx)(S,{open:M,onClose:()=>P(!1),sourceEventId:D,sourceEventName:E.eventName,sourceEventDate:E.eventDate}),(0,n.jsx)(w,{open:F,onClose:()=>z(!1),eventId:D,eventName:E.eventName,onCancelled:()=>{C({type:"success",message:"Event cancelled successfully. All pending invitations have been cancelled."}),L(null)}}),(0,n.jsx)(I.A,{mode:"pick-community",open:H,onClose:()=>O(!1),event:{id:D,name:E.eventName,seriesId:null!=(s=E.seriesId)?s:null,startMs:E.eventDate?E.eventDate.getTime():null,endMs:E.eventEndDate?E.eventEndDate.getTime():null,communityIds:null!=(a=E.communityIds)?a:[],organizerCollectiveId:null!=(o=E.organizerCollectiveId)?o:null,venueBooking:null!=(u=E.venueBooking)?u:null,payoutDestination:E.payoutDestination?{collectiveId:E.payoutDestination.collectiveId,status:E.payoutDestination.status,lockedAt:!!E.payoutDestination.lockedAt}:null,isPaid:!!(E.hasTicketing||E.requiresTickets)}}),(0,n.jsx)(B,{open:_,onClose:()=>Y(!1),eventId:D,eventName:E.eventName,eventImageUrl:null!=(h=E.imageURL)?h:null,eventVenue:null!=(j=E.locationAddress)?j:null,guestCount:ei}),ex,ej&&(0,n.jsx)(m.A,{open:!0,imageSrc:ej,aspectRatio:1,onConfirm:e
1S,onCancel:()=>ew(null)})]})}let em=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;function eh(e){let{eventId:t,eventData:s}=e,[a,r]=(0,i.useState)([]),[o,c]=(0,i.useState)([]),[u,m]=(0,i.useState)(s.communityHostIds||[]),[h,x]=(0,i.useState)(s.hiddenHosts||[]),[p,v]=(0,i.useState)(!1),[b,g]=(0,i.useState)(null),[y,j]=(0,i.useState)(!1),w=t?"events/".concat(t,"/staff_invites"):null,{data:N}=(0,_.$)(w,[],(e,t)=>{var s,n,a,i,r,l,o,c,d,u;return{id:e,eventId:null!=(r=t.eventId)?r:"",email:t.email,phone:t.phone,role:null!=(l=t.role)?l:"guest_list",permissions:t.permissions,token:null!=(o=t.token)?o:"",status:null!=(c=t.status)?c:"pending",invitedBy:null!=(d=t.invitedBy)?d:"",createdAt:null!=(u=null==(n=t.createdAt)||null==(s=n.toDate)?void 0:s.call(n))?u:new Date,acceptedAt:null==(i=t.acceptedAt)||null==(a=i.toDate)?void 0:a.call(i)}}),k=(0,i.useMemo)(()=>N.filter(e=>"pending"===e.status&&("host"===e.role||"promoter"===e.role)),[N]),C=(0,i.useMemo)(()=>N.map(e=>e.email||""),[N]),S=(0,i.useCallback)(async e=>{if(t&&!b){g(e.id);try{await (0,l.deleteDoc)((0,l.doc)(d.db,"events",t,"staff_invites",e.id))}catch(e){}finally{g(null)}}},[t,b]),I=(0,i.useMemo)(()=>Array.isArray(s.hosts)?s.hosts:[],[s.hosts]),A=(0,i.useMemo)(()=>{let e=s.staff;return e?Object.entries(e).filter(e=>{let[,t]=e;return(null==t?void 0:t.role)==="promoter"}).map(e=>{let[t]=e;return t}):[]},[s]),D=(0,i.useMemo)(()=>s.communityIds&&Array.isArray(s.communityIds)?s.communityIds:s.organizerCollectiveId?[s.organizerCollectiveId]:[],[s.communityIds,s.organizerCollectiveId]);(0,i.useEffect)(()=>{if(0===I.length&&0===A.length)return void r([]);let e=!1,t=new Set,s=[];for(let e of I)t.has(e)||(t.add(e),s.push({uid:e,kind:"co_producer"}));for(let e of A)t.has(e)||(t.add(e),s.push({uid:e,kind:"co_host"}));return Promise.all(s.map(async e=>{let{uid:t,kind:s}=e;try{let e=await (0,l.getDoc)((0,l.doc)(d.db,"publicProfiles",t));if(!e.exists())return null;let n=e.data(),a=n.displayName||[n.firstName,n.lastName].filter(Boolean).join(" ").trim()||"Host",i=n.profilePictureURL||void 0,r={id:t,name:a,kind:s};return i&&(r.imageURL=i),r}catch(e){return null}})).then(t=>{e||r(t.filter(e=>null!==e))}).catch((0,es.Q5)("event-overview-human-hosts")),()=>{e=!0}},[I,A]),(0,i.useEffect)(()=>{if(0===D.length)return void c([]);Promise.all(D.map(e=>(0,l.getDoc)((0,l.doc)(d.db,"collectives",e)))).then(e=>{c(e.filter(e=>e.exists()).map(e=>{var t,s;return{id:e.id,name:(null==(t=e.data())?void 0:t.name)||"",iconURL:null==(s=e.data())?void 0:s.iconURL}}))}).catch(()=>{})},[D]);let E=async e=>{let s=u.includes(e)?u.filter(t=>t!==e):[...u,e];m(s),v(!0);try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",t),{communityHostIds:s})}catch(e){m(u)}v(!1)},T=async e=>{let s=h.includes(e)?h.filter(t=>t!==e):[...h,e];x(s),v(!0);try{await (0,l.updateDoc)((0,l.doc)(d.db,"events",t),{hiddenHosts:s})}catch(e){x(h)}v(!1)};return(0,n.jsxs)("div",{className:"rounded-xl border border-card bg-card overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-5 py-4 border-b border-white/[0.06] flex items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"studio-subtitle",children:"Event Hosts"}),(0,n.jsx)("p",{className:"studio-caption mt-0.5",children:"Pick the people and communities that appear as hosts on your public event page."})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>j(e=>!e),className:"inline-flex items-center gap-1 text-xs h-8 px-3 rounded-md bg-white/[0.06] hover:bg-white/[0.10] text-t1 border border-white/[0.08] transition shrink-0","aria-expanded":y,"aria-label":y?"Close invite panel":"Add host",children:[y?(0,n.jsx)(f.fK,{className:"w-3.5 h-3.5"}):(0,n.jsx)(f.c1,{className:"w-3.5 h-3.5"}),y?"Cancel":"Add host"]})]}),y&&(0,n.jsx)(eb,{eventId:t,excludeEmails:C,onDone:()=>j(!1)}),(0,n.jsxs)("div",{className:"divide-y divide-white/[0.06]",children:[a.map(e=>{var t,s;let a=!h.includes(e.id);return(0,n.jsxs)("div",{className:"flex items-center justify-between px-5 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[e.imageURL?(0,n.jsx)("img",{src:e.imageURL,alt:"",className:"w-8 h-8 rounded-full object-cover"}):(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-white/[0.08] flex items-center justify-center text-t2 text-xs font-semibold",children:(null==(s=e.name)||null==(t=s[0])?void 0:t.toUpperCase())||"H"}),(0,n.jsx)("span",{className:"studio-body-strong truncate",children:e.name}),(0,n.jsx)("span",{className:"text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded-full border shrink-0 ".concat("co_producer"===e.kind?"bg-white/[0.06] text-t2 border-white/[0.10]":"bg-[rgb(var(--accent-purple)/0.15)] text-[color:rgb(var(--accent-purple))] border-[rgb(var(--accent-purple)/0.3)]"),children:"co_producer"===e.kind?"Producer":"Co-Host"})]}),(0,n.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:p,onClick:()=>T(e.id),className:"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 disabled:opacity-50 ".concat(a?"bg-success":"bg-[rgb(var(--color-brand)/0.1)]"),children:(0,n.jsx)("span",{className:"pointer-events-none inline-block h-5 w-5 rounded-full bg-white-fixed shadow transition-transform duration-200 ".concat(a?"translate-x-5":"translate-x-0")})})]},"u-".concat(e.id))}),k.map(e=>{let t="host"===e.role?"Producer":"Co-Host",s=b===e.id;return(0,n.jsxs)("div",{className:"flex items-center justify-between px-5 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-amber-500/10 border border-amber-500/20 flex items-center justify-center flex-shrink-0",children:(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"studio-body truncate",children:e.email||e.phone||"Unknown"}),(0,n.jsxs)("p",{className:"text-[10px] text-attention-ink/80 mt-0.5 uppercase tracking-wider",children:[t," \xb7 pending"]})]})]}),(0,n.jsx)("button",{type:"button",disabled:s,onClick:()=>S(e),className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-md text-[11px] font-medium text-t2 hover:text-negative-ink/80 hover:bg-red-500/[0.06] border border-white/[0.08] hover:border-red-500/20 transition disabled:opacity-50",children:s?"Cancelling…":"Cancel invite"})]},"i-".concat(e.id))}),0===a.length&&0===o.length&&0===k.length&&(0,n.jsxs)("div",{className:"px-5 py-6 text-center",children:[(0,n.jsx)("p",{className:"studio-body",children:"No additional hosts yet"}),(0,n.jsx)("p",{className:"studio-caption mt-1",children:"Use the Add host button to invite a Producer or Co-Host."})]}),o.map(e=>{var t,a;let i=u.includes(e.id),r="pending"===s.communityApprovalStatus||"rejected"===s.communityApprovalStatus;return(0,n.jsxs)("div",{className:"flex items-center justify-between px-5 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[e.iconURL?(0,n.jsx)("img",{src:e.iconURL,alt:"",className:"w-8 h-8 rounded-full object-cover"}):(0,n.jsx)("div",{className:"w-8 h-8 rounded-full bg-white/[0.08] flex items-center justify-center text-t2 text-xs font-semibold",children:(null==(a=e.name)||null==(t=a[0])?void 0:t.toUpperCase())||"C"}),(0,n.jsx)("span",{className:"studio-body-strong",children:e.name}),r&&(0,n.jsx)("span",{className:"text-[9px] uppercase tracking-wide px-1.5 py-0.5 rounded-full border shrink-0 bg-amber-500/10 text-attention-ink/80 border-amber-500/20",children:"rejected"===s.communityApprovalStatus?"Not approved":"Pending approval"})]}),(0,n.jsx)("button",{type:"button",role:"switch","aria-checked":i&&!r,disabled:p||r,title:r?"Available once the community approves this event":void 0,onClick:()=>{r||E(e.id)},className:"relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 disabled:opacity-40 ".concat(r?"curs
1or-not-allowed":"cursor-pointer"," ").concat(i&&!r?"bg-success":"bg-[rgb(var(--color-brand)/0.1)]"),children:(0,n.jsx)("span",{className:"pointer-events-none inline-block h-5 w-5 rounded-full bg-white-fixed shadow transition-transform duration-200 ".concat(i&&!r?"translate-x-5":"translate-x-0")})})]},"c-".concat(e.id))})]})]})}let ex="",ep=[],ev=0;async function ef(e){if(e===ex&&Date.now()-ev<3e5)return ep;let t=await (0,l.getDocs)((0,l.query)((0,l.collection)(d.db,"events"),(0,l.where)("hosts","array-contains",e),(0,l.orderBy)("eventDate","desc"),(0,l.limit)(12))),s=[];return await Promise.all(t.docs.map(async t=>{try{for(let r of(await (0,l.getDocs)((0,l.collection)(d.db,"events",t.id,"staff_invites"))).docs){var n,a,i;let t=r.data();t.invitedBy===e&&("host"===t.role||"promoter"===t.role)&&"string"==typeof t.email&&t.email&&s.push({email:t.email,role:t.role,createdAtMs:null!=(i=null==(a=t.createdAt)||null==(n=a.toMillis)?void 0:n.call(a))?i:0})}}catch(e){}})),ex=e,ep=s,ev=Date.now(),s}function eb(e){let{eventId:t,excludeEmails:s,onDone:a}=e,{user:r,userProfile:c,notify:m}=(0,p.Y)(),{eventData:x}=(0,v._)(),[f,g]=(0,i.useState)(""),[j,w]=(0,i.useState)("host"),[N,k]=(0,i.useState)(!1),[C,S]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(!r)return;let e=!1;return ef(r.uid).then(t=>{e||S(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6,n=new Set(t.map(h)),a=new Set,i=[];for(let t of[...e].sort((e,t)=>t.createdAtMs-e.createdAtMs)){if("host"!==t.role&&"promoter"!==t.role)continue;let e=h(t.email||"");if(!(!e||n.has(e)||a.has(e))&&(a.add(e),i.push({email:e,role:t.role}),i.length>=s))break}return i}(t,[...s,r.email||""]))}).catch(()=>{}),()=>{e=!0}},[r,s]);let I=(0,i.useCallback)(async()=>{let e=f.trim();if(t&&r&&e){k(!0);try{let s=(0,o.httpsCallable)(d.functions,"checkStaffLimit");await s({eventId:t});let n=(0,u.q)(),i=[null==c?void 0:c.firstName,null==c?void 0:c.lastName].filter(Boolean).join(" ").trim()||"A host";await (0,l.addDoc)((0,l.collection)(d.db,"events",t,"staff_invites"),{eventId:t,email:e,role:j,token:n,status:"pending",invitedBy:r.uid,createdAt:(0,l.serverTimestamp)(),inviterName:i,eventName:(null==x?void 0:x.eventName)||null,eventDate:(null==x?void 0:x.eventDate)?l.Timestamp.fromDate(x.eventDate):null,eventImageURL:(null==x?void 0:x.imageURL)||null,eventVenue:(null==x?void 0:x.locationAddress)||null,metadata:{}}),m({type:"success",message:"Invite sent to ".concat(e)}),g(""),a()}catch(e){(0,y.WL)("InviteHost",m)(e)}finally{k(!1)}}},[f,t,r,c,x,j,m,a]),A=f.trim().length>0&&!N&&!!t;return(0,n.jsxs)("div",{className:"px-5 py-4 border-b border-white/[0.06] bg-white/[0.015] space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:()=>w("host"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition border ".concat("host"===j?"bg-white/[0.12] text-white border-white/[0.18]":"bg-transparent text-t2 hover:text-t1 border-white/[0.08] hover:bg-white/[0.04]"),children:"Producer"}),(0,n.jsx)("button",{type:"button",onClick:()=>w("promoter"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition border ".concat("promoter"===j?"bg-white/[0.12] text-white border-white/[0.18]":"bg-transparent text-t2 hover:text-t1 border-white/[0.08] hover:bg-white/[0.04]"),children:"Co-Host"})]}),(0,n.jsx)("p",{className:"studio-caption leading-relaxed",children:{host:"Full producer permissions — manage everything as if it were their own event.",promoter:"Featured on the event page as a host. Can invite people from their own network. No other event access."}[j]}),C.length>0&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"studio-caption",children:"Invited before:"}),C.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>{g(e.email),w(e.role)},title:"host"===e.role?"Invited as Producer last time":"Invited as Co-Host last time",className:"px-2.5 py-1 rounded-full text-[12px] border border-white/[0.08] bg-white/[0.03] text-t2 hover:text-white hover:bg-white/[0.06] transition",children:e.email},e.email))]}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,n.jsx)("input",{type:"email",autoFocus:!0,value:f,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&A&&(e.preventDefault(),I())},placeholder:"[email protected]",disabled:N,className:"flex-1 bg-card border border-card rounded-md px-3 py-2 text-[13px] text-white placeholder:text-t3 outline-none focus:border-white/[0.18] transition"}),(0,n.jsx)(b.$n,{variant:"primary",size:"sm",onClick:I,disabled:!A,className:"font-semibold",children:N?"Sending…":"Send invite"})]})]})}function eg(e){let{eventId:t,shortLink:s}=e,{notify:a}=(0,p.Y)(),[r,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(""),[u,m]=(0,i.useState)({checking:!1}),[h,x]=(0,i.useState)(!1),[v,b]=(0,i.useState)(!1),g=(0,i.useRef)(void 0),y=(0,i.useRef)(!1),j=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]),(0,i.useEffect)(()=>
1{if(!r)return;let e=e=>{let t=j.current;t&&(t.contains(e.target)||(l(!1),c(""),m({checking:!1})))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]);let w=s?"socialloop.ai/go/".concat(s):null,N=s?"https://socialloop.ai/go/".concat(s):null,k=(0,i.useCallback)(async()=>{if(N)try{await navigator.clipboard.writeText(N),b(!0),setTimeout(()=>b(!1),2e3)}catch(e){a({type:"error",message:"Failed to copy"})}},[N,a]),C=(0,i.useCallback)(e=>{g.current&&clearTimeout(g.current);let t=e.length<3?"Min 3 characters":e.length>30?"Max 30 characters":em.test(e)?e.includes("--")?"No consecutive hyphens":null:"Lowercase letters, numbers, and hyphens only";return t?void m({checking:!1,available:!1,reason:t}):e===s?void m({checking:!1,available:!1,reason:"Already your current link"}):void(m({checking:!0}),g.current=setTimeout(async()=>{try{var t;let s=await (null==(t=d.auth.currentUser)?void 0:t.getIdToken(!0));if(!s)return void m({checking:!1,available:!1,reason:"Not authenticated"});let n=await fetch("/api/short-links/custom?slug=".concat(encodeURIComponent(e)),{headers:{Authorization:"Bearer ".concat(s)}}),a=await n.json();m({checking:!1,available:a.available,reason:a.reason})}catch(e){m({checking:!1,available:!1,reason:"Failed to check"})}},300))},[s]),S=async()=>{if(u.available&&!y.current){y.current=!0,x(!0);try{var e;
1let s=await (null==(e=d.auth.currentUser)?void 0:e.getIdToken());if(!s)return void a({type:"error",message:"Not authenticated"});let n=await fetch("/api/short-links/custom",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(s)},body:JSON.stringify({eventId:t,slug:o})});if(!n.ok){let e=await n.json().catch(()=>({error:"Failed to save"}));a({type:"error",message:e.error||"Failed to save"});return}a({type:"success",message:"Custom link saved!"}),l(!1),c(""),m({checking:!1})}catch(e){(0,A.V9)("event-save",e,{feature:"custom-short-link",eventId:t}),a({type:"error",message:"Failed to save custom link"})}finally{y.current=!1,x(!1)}}};return(0,n.jsxs)("div",{className:"rounded-xl border border-card bg-card overflow-hidden",children:[(0,n.jsx)("div",{className:"px-6 py-4",children:(0,n.jsx)("h2",{className:"studio-eyebrow",children:"Set Up Custom URL"})}),(0,n.jsx)("div",{className:"px-6 pb-4 space-y-3",children:s?(0,n.jsxs)(n.Fragment,{children:[!r&&(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>{l(!0),c("")},className:"flex-1 min-w-0 text-left -mx-1.5 px-1.5 py-1 rounded-md hover:bg-white/[0.03] transition",title:"Click to customize",children:(0,n.jsx)("span",{className:"text-[13px] text-t2 font-mono",children:w})}),(0,n.jsxs)("button",{onClick:k,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white/[0.06] hover:bg-white/[0.1] text-t2 hover:text-t1/70 text-[11px] font-medium transition flex-shrink-0",children:[(0,n.jsx)(f.Td,{className:"w-3 h-3"}),v?"Copied!":"Copy"]})]}),r&&(0,n.jsxs)("div",{ref:j,className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-[12px] text-t3 flex-shrink-0",children:"socialloop.ai/go/"}),(0,n.jsx)("input",{type:"text",value:o,onChange:e=>(e=>{let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"");c(t),t.length>0?C(t):m({checking:!1})})(e.target.value),placeholder:"your-custom-slug",maxLength:30,className:"flex-1 bg-white/[0.06] rounded-lg px-3 py-1.5 text-[13px] text-white/80 placeholder-white/20 outline-none focus:ring-1 focus:ring-white/20 font-mono",autoFocus:!0})]}),o.length>0&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-[11px] font-medium ".concat(u.checking?"text-white/30":u.available?"text-positive-ink":"text-negative-ink/70"),children:u.checking?"Checking...":u.available?"Available":u.reason||"Unavailable"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:()=>{l(!1),c(""),m({checking:!1})},className:"text-[11px] text-t3 hover:text-white/50 transition",children:"Cancel"}),(0,n.jsx)("button",{onClick:S,disabled:!u.available||h,className:"px-3 py-1 rounded-lg bg-brand text-surface-base text-[11px] font-semibold disabled:opacity-30 disabled:cursor-not-allowed hover:bg-brand/90 transition",children:h?"Saving...":"Save"})]})]}),(0,n.jsx)("p",{className:"studio-caption",children:"Previous links still work — old shortcodes are never deleted."})]})]}):(0,n.jsx)("p",{className:"studio-caption",children:"A short link will be generated automatically when the event is created."})})]})}},94461:(e,t,s)=>{s.d(t,{A:()=>o});var n=s(95155),a=s(12115),i=s(47650),r=s(41928),l=s(17512);function o(e){let{sanitizedHTML:t,className:s,style:o,onClick:c}=e,d=(0,a.useRef)(null),u=(0,a.useMemo)(()=>({__html:t}),[t]),[m,h]=(0,a.useState)([]);return(0,a.useEffect)(()=>{var e;let t=[];return null==(e=d.current)||e.querySelectorAll("video[data-video-id]").forEach(e=>{let s=(0,r.bv)(Object.fromEntries([...e.attributes].map(e=>[e.name,e.value])));if(!s)return;let n=document.createElement("div");n.className="description-video-block",e.hidden=!0,e.after(n),t.push({mount:n,original:e,video:s})}),h(t),()=>{t.forEach(e=>{let{mount:t,original:s}=e;t.remove(),s.hidden=!1})}},[u]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:d,onClick:c,className:s,style:o,dangerouslySetInnerHTML:u}),m.map(e=>{let{mount:t,video:s}=e;return(0,i.createPortal)((0,n.jsx)(l.Ay,{video:s}),t,s.id)})]})}}}]);

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.