1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3281],{24504:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(76715).A)("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]])},31940:(e,a,s)=>{s.d(a,{w:()=>c});var t=s(86707),n=s(73459),l=s(49756),r=s(34140);let c=n.forwardRef((e,a)=>{let{className:s,orientation:n="horizontal",decorative:c=!0,...i}=e;return(0,t.jsx)(l.b,{ref:a,decorative:c,orientation:n,className:(0,r.cn)("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",s),...i})});c.displayName=l.b.displayName},36083:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(76715).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},45132:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(76715).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},48527:(e,a,s)=>{s.d(a,{d:()=>c});var t=s(86707),n=s(73459),l=s(89335),r=s(34140);let c=n.forwardRef((e,a)=>{let{className:s,...n}=e;return(0,t.jsx)(l.bL,{className:(0,r.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...n,ref:a,children:(0,t.jsx)(l.zi,{className:(0,r.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});c.displayName=l.bL.displayName},49756:(e,a,s)=>{s.d(a,{b:()=>o});var t=s(73459),n=s(45754),l=s(86707),r="horizontal",c=["horizontal","vertical"],i=t.forwardRef((e,a)=>{var s;let{decorative:t,orientation:i=r,...o}=e,d=(s=i,c.includes(s))?i:r;return(0,l.jsx)(n.sG.div,{"data-orientation":d,...t?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"},...o,ref:a})});i.displayName="Separator";var o=i},74690:(e,a,s)=>{s.d(a,{A:()=>t});let t=(0,s(76715).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},75639:(e,a,s)=>{s.d(a,{A:()=>t});
1let t=(0,s(76715).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},83281:(e,a,s)=>{s.r(a),s.d(a,{IntegrationSettings:()=>E});var t=s(86707),n=s(8477),l=s(73459),r=s(86349),c=s(18239),i=s(77897),o=s(36711),d=s(48527),x=s(31940),m=s(54233),p=s(80915),h=s(75639),g=s(74690),u=s(61721),b=s(89432),y=s(65669),_=s(30368),j=s(65684),v=s(24504),f=s(62243),N=s(56072),k=s(44182),w=s(36083),z=s(45132);function S(){var e,a,s,n,m,h,S,C,A;let[R,E]=(0,l.useState)(null),[I,G]=(0,l.useState)(!0),[M,D]=(0,l.useState)(!1),[P,T]=(0,l.useState)({}),[Z,L]=(0,l.useState)({version:"",date:new Date().toISOString().split("T")[0],notes:""}),O=(0,l.useCallback)(async()=>{let{data:e}=await u.supabase.from("app_compatibility_manifest").select("*").eq("platform","all").maybeSingle();e&&(E(e),T(e)),G(!1)},[]);(0,l.useEffect)(()=>{O()},[O]);let J=async()=>{if(!R||!P)return;D(!0);let{error:e}=await u.supabase.from("app_compatibility_manifest").update({...P,updated_at:new Date().toISOString()}).eq("id",R.id);e?b.oR.error("Failed to save: "+e.message):(b.oR.success("Manifest saved"),O()),D(!1)};return I?(0,t.jsxs)("div",{className:"flex items-center justify-center py-12 text-zinc-500 gap-2",children:[(0,t.jsx)(p.A,{className:"w-4 h-4 animate-spin"}),(0,t.jsx)("span",{className:"text-sm",children:"Loading manifest..."})]}):R?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(v.A,{className:"w-4 h-4 text-cyan-400"}),(0,t.jsx)("span",{className:"text-sm font-medium text-white",children:"App Compatibility Manifest"}),(0,t.jsxs)(_.E,{variant:"outline",className:"text-[10px] border-zinc-700 text-zinc-400 font-mono",children:["schema v",P.schema_version]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"text-[10px] text-zinc-600 flex items-center gap-1",children:[(0,t.jsx)(f.A,{className:"w-3 h-3"}),"Updated ",new Date(R.updated_at).toLocaleString()]}),(0,t.jsxs)(c.$,{size:"sm",onClick:J,disabled:M,className:"gap-1.5 text-xs h-7",children:[M?(0,t.jsx)(p.A,{className:"w-3 h-3 animate-spin"}):(0,t.jsx)(g.A,{className:"w-3 h-3"}),"Save"]})]})]}),(0,t.jsx)(r.Zp,{className:"border ".concat(P.maintenance_mode?"border-red-500/40 bg-red-950/20":"border-zinc-800 bg-zinc-900/30"),children:(0,t.jsxs)(r.Wu,{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[(0,t.jsx)(j.A,{className:"w-4 h-4 ".concat(P.maintenance_mode?"text-red-400":"text-zinc-500")}),"Maintenance Mode"]}),(0,t.jsx)("p",{className:"text-xs text-zinc-500 mt-0.5",children:"When on, the mobile app shows a maintenance screen instead of normal content."})]}),(0,t.jsx)(d.d,{checked:null!=(e=P.maintenance_mode)&&e,onCheckedChange:e=>T({...P,maintenance_mode:e})})]}),P.maintenance_mode&&(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(i.p,{value:null!=(a=P.maintenance_message)?a:"",onChange:e=>T({...P,maintenance_message:e.target.value}),placeholder:"We'll be back shortly. Thank you for your patience.",className:"bg-zinc-900 border-zinc-700 text-sm"})})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)(r.Zp,{className:"border-zinc-800 bg-zinc-900/30",children:[(0,t.jsx)(r.aR,{className:"p-4 pb-2",children:(0,t.jsx)(r.ZB,{className:"text-sm font-semibold text-zinc-300",children:"Version Control"})}),(0,t.jsxs)(r.Wu,{className:"p-4 pt-0 space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Latest App Version"}),(0,t.jsx)(i.p,{value:null!=(s=P.latest_app_version)?s:"",onChange:e=>T({...P,latest_app_version:e.target.value}),placeholder:"1.0.0",className:"bg-zinc-900 border-zinc-700 text-sm font-mono"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Minimum Supported Version"}
1),(0,t.jsx)(i.p,{value:null!=(n=P.min_app_version)?n:"",onChange:e=>T({...P,min_app_version:e.target.value}),placeholder:"1.0.0",className:"bg-zinc-900 border-zinc-700 text-sm font-mono"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:["Force Update Below",(0,t.jsx)("span",{className:"ml-1 text-amber-400",children:"(users on older versions are blocked)"})]}),(0,t.jsx)(i.p,{value:null!=(m=P.force_update_below)?m:"",onChange:e=>T({...P,force_update_below:e.target.value}),placeholder:"0.0.0",className:"bg-zinc-900 border-zinc-700 text-sm font-mono"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Schema Version"}),(0,t.jsx)(i.p,{type:"number",value:null!=(h=P.schema_version)?h:1,onChange:e=>T({...P,schema_version:parseInt(e.target.value)||1}),className:"bg-zinc-900 border-zinc-700 text-sm font-mono"})]})]})]}),(0,t.jsxs)(r.Zp,{className:"border-zinc-800 bg-zinc-900/30",children:[(0,t.jsx)(r.aR,{className:"p-4 pb-2",children:(0,t.jsxs)(r.ZB,{className:"text-sm font-semibold text-zinc-300 flex items-center gap-1.5",children:[(0,t.jsx)(N.A,{className:"w-3.5 h-3.5 text-cyan-400"}),"Endpoints & Support"]})}),(0,t.jsxs)(r.Wu,{className:"p-4 pt-0 space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Supabase API Base URL"}),(0,t.jsx)(i.p,{value:null!=(S=P.api_base_url)?S:"",onChange:e=>T({...P,api_base_url:e.target.value}),placeholder:"https://yourproject.supabase.co",className:"bg-zinc-900 border-zinc-700 text-sm font-mono text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Support Email"}),(0,t.jsx)(i.p,{value:null!=(C=P.contact_email)?C:"",onChange:e=>T({...P,contact_email:e.target.value}),className:"bg-zinc-900 border-zinc-700 text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.J,{className:"text-xs text-zinc-500 mb-1 block",children:"Support URL"}),(0,t.jsx)(i.p,{value:null!=(A=P.support_url)?A:"",onChange:e=>T({...P,support_url:e.target.value}),className:"bg-zinc-900 border-zinc-700 text-sm font-mono text-xs"})]}),(0,t.jsx)(x.w,{className:"bg-zinc-800"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[(0,t.jsx)(k.A,{className:"w-3 h-3 text-green-400"}),(0,t.jsxs)("span",{children:["Mobile endpoint: ",(0,t.jsx)("code",{className:"text-cyan-400 font-mono",children:"/api/app-config"})]})]})]})]})]}),(0,t.jsxs)(r.Zp,{className:"border-zinc-800 bg-zinc-900/30",children:[(0,t.jsx)(r.aR,{className:"p-4 pb-2",children:(0,t.jsx)(r.ZB,{className:"text-sm font-semibold text-zinc-300",children:"Realtime Table Registry"})}),(0,t.jsxs)(r.Wu,{className:"p-4 pt-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:(P.realtime_tables||[]).map((e,a)=>(0,t.jsxs)(_.E,{variant:"outline",className:"text-[10px] font-mono ".concat(e.filter_by_user?"border-cyan-500/30 text-cyan-400":"border-zinc-600 text-zinc-400"),children:[e.table,e.filter_by_user&&(0,t.jsx)("span",{className:"ml-1 text-cyan-600",children:"user"})]},a))}),(0,t.jsxs)("p",{className:"text-[10px] text-zinc-600 mt-2",children:[(0,t.jsx)("span",{className:"text-cyan-400",children:"cyan"})," = per-user filtered subscription \xa0\xb7\xa0 grey = global subscription"]})]})]}),(0,t.jsxs)(r.Zp,{className:"border-zinc-800 bg-zinc-900/30",children:[(0,t.jsx)(r.aR,{className:"p-4 pb-2",children:(0,t.jsx)(r.ZB,{className:"text-sm font-semibold text-zinc-300",children:"Changelog"})}),(0,t.jsxs)(r.Wu,{className:"p-4 pt-0 space-y-3",children:[(0,t.jsxs)("div",{className:"bg-zinc-900 border border-zinc-700 rounded-lg p-3 space-y-2",children:[(0,t.jsx)("p",{className:"text-xs text-zinc-500 font-medium",children:"Add New Entry"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,t.jsx)(i.p,{value:Z.version,onChange:e=>L({...Z,version:e.target.value}),placeholder:"1.1.0",className:"bg-zinc-800 border-zinc-600 text-sm font-mono"}),(0,t.jsx)(i.p,{type:"date",value:Z.date,onChange:e=>L({...Z,date:e.target.value}),className:"bg-zinc-800 border-zinc-600 text-sm"})]}),(0,t.jsx)(y.T,{value:Z.notes,onChange:e=>L({...Z,notes:e.target.value}),placeholder:"What changed in this version...",className:"bg-zinc-800 border-zinc-600 text-sm min-h-[60
1px]"}),(0,t.jsxs)(c.$,{size:"sm",onClick:()=>{if(!Z.version||!Z.notes)return;let e=[Z,...P.changelog||[]];T({...P,changelog:e}),L({version:"",date:new Date().toISOString().split("T")[0],notes:""})},className:"gap-1.5 text-xs h-7 w-full",children:[(0,t.jsx)(w.A,{className:"w-3 h-3"})," Add Entry"]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(P.changelog||[]).map((e,a)=>(0,t.jsxs)("div",{className:"flex items-start gap-3 bg-zinc-900/50 border border-zinc-800 rounded-lg p-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsxs)("code",{className:"text-cyan-400 text-xs font-mono font-semibold",children:["v",e.version]}),(0,t.jsx)("span",{className:"text-zinc-600 text-xs",children:e.date})]}),(0,t.jsx)("p",{className:"text-xs text-zinc-400 leading-relaxed",children:e.notes})]}),(0,t.jsx)("button",{onClick:()=>(e=>{let a=[...P.changelog||[]];a.splice(e,1),T({...P,changelog:a})})(a),className:"text-zinc-700 hover:text-red-400 transition-colors shrink-0 mt-0.5",children:(0,t.jsx)(z.A,{className:"w-3.5 h-3.5"})})]},a)),0===(P.changelog||[]).length&&(0,t.jsx)("p",{className:"text-center text-xs text-zinc-600 py-4",children:"No changelog entries yet"})]})]})]}),(0,t.jsxs)(c.$,{onClick:J,disabled:M,className:"w-full gap-2",children:[M?(0,t.jsx)(p.A,{className:"w-4 h-4 animate-spin"}):(0,t.jsx)(g.A,{className:"w-4 h-4"}),"Save All Changes"]})]}):(0,t.jsxs)("div",{className:"text-center py-12 space-y-3",children:[(0,t.jsx)(j.A,{className:"w-8 h-8 text-amber-400 mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"No manifest found in database."}),(0,t.jsxs)("p",{className:"text-xs text-zinc-600",children:["Run the ",(0,t.jsx)("code",{className:"font-mono text-cyan-400",children:"20260601000000_create_app_compatibility_manifest"})," migration first."]})]})}let C=["stripe_publishable_key","stripe_secret_key","stripe_webhook_secret","stripe_enable_apple_pay","
1stripe_enable_google_pay","eventbrite_api_key","eventbrite_organization_id","eventbrite_auto_sync","google_calendar_enabled","google_calendar_api_key","google_calendar_id","google_calendar_auto_sync","google_calendar_import_horizon_days","google_calendar_last_sync_at","google_calendar_last_sync_status","google_calendar_last_sync_error"],A={stripe_publishable_key:"",stripe_secret_key:"",stripe_webhook_secret:"",stripe_enable_apple_pay:"false",stripe_enable_google_pay:"false",eventbrite_api_key:"",eventbrite_organization_id:"",eventbrite_auto_sync:"false",google_calendar_enabled:"false",google_calendar_api_key:"",google_calendar_id:"[email protected]",google_calendar_auto_sync:"false",google_calendar_import_horizon_days:"400",google_calendar_last_sync_at:"",google_calendar_last_sync_status:"",google_calendar_last_sync_error:""};(0,n.wV)("stripe-webhook");let R=(0,n.wV)("google-calendar-sync");function E(){let[e,a]=(0,l.useState)({}),[s,y]=(0,l.useState)(!0),[_,j]=(0,l.useState)(!1),[v,f]=(0,l.useState)(null),[N,k]=(0,l.useState)(!1),[w,z]=(0,l.useState)(null);(0,l.useEffect)(()=>{E()},[]);let E=async()=>{try{let{data:e,error:s}=await u.supabase.from("admin_settings").select("key, value").in("key",C);if(s)throw s;let t={...A};null==e||e.forEach(e=>{t[e.key]=e.value}),a(t)}catch(e){b.oR.error("Failed to load integration settings")}finally{y(!1)}},I=async a=>{a.preventDefault(),j(!0);try{let a=new Date().toISOString(),s=C.map(s=>{var t,n;return{key:s,value:null!=(n=null!=(t=e[s])?t:A[s])?n:"",updated_at:a}}),{error:t}=await u.supabase.from("admin_settings").upsert(s,{onConflict:"key"});if(t)throw t;b.oR.success("Integration settings saved")}catch(e){b.oR.error("Failed to save settings")}finally{j(!1)}},G=async()=>{f("eventbrite");try{let{data:e,error:a}=await u.supabase.functions.invoke("eventbrite-sync");if(a)throw a;(null==e?void 0:e.error)?b.oR.error(e.message||e.error):b.oR.success("Synced ".concat(e.synced," events from Eventbrite"))}catch(e){b.oR.error(e.message||"Failed to sync events")}finally{f(null)}},M=async()=>{f("google-calendar"),z({ok:!0,status:null,title:"Sync started",message:"Calling the Google Calendar sync function...",timestamp:new Date().toISOString()});try{var e,a;let{data:s}=await u.supabase.auth.getSession(),t=null==(e=s.session)?void 0:e.access_token;if(!t)throw Error("No admin session found. Sign out and sign back in, then try again.");let l=await fetch(R,{method:"POST",headers:{Authorization:"Bearer ".concat(t),apikey:n.Ql||"","Content-Type":"application/json"},body:JSON.stringify({source:"admin-manual-sync"})}),r=await l.text(),c=null;try{c=r?JSON.parse(r):null}catch(e){c={raw:r}}if(!l.ok||(null==c?void 0:c.error)){let e=(null==c?void 0:c.message)||(null==c?void 0:c.error)||r||"Google Calendar sync failed with HTTP ".concat(l.status);z({ok:!1,status:l.status,title:"Google Calendar sync failed",message:e,details:c,timestamp:new Date().toISOString()}),b.oR.error(e);return}let i="Synced ".concat(null!=(a=null==c?void 0:c.synced)?a:0," Google Calendar events");z({ok:!0,status:l.status,title:"Google Calendar sync completed",message:i,details:c,timestamp:new Date().toISOString()}),b.oR.success(i),await E()}catch(a){let e=(null==a?void 0:a.message)||"Failed to sync Google Calendar";z({ok:!1,status:null,title:"Google Calendar sync request failed",message:e,details:(null==a?void 0:a.cause)||null,timestamp:new Date().toISOString()}),b.oR.error(e)}finally{f(null)}},D=(e,s)=>{a(a=>({...a,[e]:s}))};return s?(0,t.jsx)(r.Zp,{className:"glass-card",children:(0,t.jsx)(r.Wu,{className:"text-center py-12",children:(0,t.jsx)("p",{className:"text-muted-foreground",children:"Loading integration settings..."})})}):(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsx)(S,{}),(0,t.jsx)(x.w,{className:"bg-zinc-800"}),(0,t.jsxs)("form",{onSubmit:I,className:"space-y-6",children:[(0,t.jsx)(r.Zp,{className:"glass-card",children:(0,t.jsxs)(r.aR,{children:[(0,t.jsx)(r.ZB,{children:"Online payments disabled"}),(0,t.jsx)(r.BT,{children:"All online purchasing is temporarily paused. Purchases are available in bar."})]})}),(0,t.jsxs)(r.Zp,{className:"glass-card",children:[(0,t.jsxs)(r.aR,{children:[(0,t.jsxs)(r.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(m.A,{className:"w-5 h-5 text-cyan-400"}),"Eventbrite Settings"]}),(0,t.jsx)(r.BT,{children:"Connect Eventbrite to automatically sync and display events."})]}),(0,t.jsxs)(r.Wu,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(o.J,{className:"text-xs",children:"Eventbrite API Key"}),(0,t.jsx)(i.p,{type:"password",placeholder:"Your private token...",value:e.eventbrite_api_key||"",onChange:e=>D("eventbrite_api_key",e.target.value),disabled:_})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(o.J,{className:"text-xs",children:"Organization ID"}),(0,t.jsx)(i.p,{placeholder:"123456789",value:e.eventbrite_organization_id||"",onChange:e=>D("eventbrite_organization_id",e.target.value),disabled:_})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700/50 px-4 py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-white",children:"Auto-Sync Every 7 Days"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Automatically sync Eventbrite events weekly"})]}
1),(0,t.jsx)(d.d,{checked:"true"===e.eventbrite_auto_sync,onCheckedChange:e=>D("eventbrite_auto_sync",e?"true":"false"),disabled:!e.eventbrite_api_key})]}),(0,t.jsxs)(c.$,{type:"button",variant:"outline",onClick:G,disabled:null!==v||!e.eventbrite_api_key,className:"w-full",children:[(0,t.jsx)(p.A,{className:"w-4 h-4 mr-2 ".concat("eventbrite"===v?"animate-spin":"")}),"eventbrite"===v?"Syncing...":"Sync Eventbrite Now"]}),(0,t.jsx)("div",{className:"p-3 rounded-md bg-zinc-900/50 border border-zinc-700/30",children:(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Get your API key from"," ",(0,t.jsxs)("a",{href:"https://www.eventbrite.com/platform/api-keys",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-cyan-400 hover:text-cyan-300",children:["Eventbrite API Keys ",(0,t.jsx)(h.A,{className:"w-3 h-3"})]})]})})]})]}),(0,t.jsxs)(r.Zp,{className:"glass-card",children:[(0,t.jsxs)(r.aR,{children:[(0,t.jsxs)(r.ZB,{className:"flex items-center gap-2",children:[(0,t.jsx)(m.A,{className:"w-5 h-5 text-lime-300"}),"Google Calendar Settings"]}),(0,t.jsx)(r.BT,{children:"Import public/shared Google Calendar events into the site events table."})]}),(0,t.jsxs)(r.Wu,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700/50 px-4 py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-white",children:"Enable Google Calendar Sync"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Allow manual syncs from a Google Calendar."})]}),(0,t.jsx)(d.d,{checked:"true"===e.google_calendar_enabled,onCheckedChange:e=>D("google_calendar_enabled",e?"true":"false"),disabled:_})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(o.J,{className:"text-xs",children:"Calendar ID or Embed URL"}),(0,t.jsx)(i.p,{placeholder:"[email protected] or https://calendar.google.com/calendar/embed?src=...",value:e.google_calendar_id||"",onChange:e=>D("google_calendar_id",e.target.value),disabled:_}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"You can paste the full Google Calendar embed URL; the sync will extract the src calendar ID automatically."})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(o.J,{className:"text-xs",children:"Google Calendar API Key"}),(0,t.jsx)(i.p,{type:"password",placeholder:"AIza...",value:e.google_calendar_api_key||"",onChange:e=>D("google_calendar_api_key",e.target.value),disabled:_})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(o.J,{className:"text-xs",children:"Import Horizon"}),(0,t.jsx)(i.p,{type:"number",min:1,max:730,value:e.google_calendar_import_horizon_days||"400",onChange:e=>D("google_calendar_import_horizon_days",e.target.value),disabled:_}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Number of future days to import. Default is 400 so annual recurring events stay visible."})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700/50 px-4 py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-white",children:"Auto-Sync Hourly"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Requires a Google Calendar API key and runs only when Supabase cron/net are configured."})]}),(0,t.jsx)(d.d,{checked:"true"===e.google_calendar_auto_sync,onCheckedChange:e=>D("google_calendar_auto_sync",e?"true":"false"),disabled:_||!e.google_calendar_api_key||!e.google_calendar_id})]}),(0,t.jsxs)(c.$,{type:"button",variant:"outline",onClick:M,disabled:null!==v||"true"!==e.google_calendar_enabled||!e.google_calendar_api_key||!e.google_calendar_id,className:"w-full",children:[(0,t.jsx)(p.A,{className:"w-4 h-4 mr-2 ".concat("google-calendar"===v?"animate-spin":"")}),"google-calendar"===v?"Syncing...":"Sync Google Calendar Now"]}),w&&(0,t.jsxs)("div",{className:"rounded-lg border p-4 ".concat(w.ok?"border-emerald-500/30 bg-emerald-500/10":"border-red-500/30 bg-red-500/10"),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-semibold ".concat(w.ok?"text-emerald-200":"text-red-200"),children:w.title}),(0,t.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-zinc-300",children:w.message})]}),(0,t.jsxs)("div",{className:"text-right text-[11px] text-zinc-500",children:[null!==w.status&&(0,t.jsxs)("p",{children:["HTTP ",w.status]}
1),(0,t.jsx)("p",{children:new Date(w.timestamp).toLocaleString()})]})]}),(0,t.jsxs)("div",{className:"mt-3 grid gap-2 text-[11px] text-zinc-400 sm:grid-cols-3",children:[(0,t.jsxs)("div",{className:"rounded border border-zinc-700/40 bg-black/20 p-2",children:[(0,t.jsx)("span",{className:"block text-zinc-500",children:"Enabled"}),(0,t.jsx)("span",{className:"font-mono text-zinc-200",children:"true"===e.google_calendar_enabled?"true":"false"})]}),(0,t.jsxs)("div",{className:"rounded border border-zinc-700/40 bg-black/20 p-2",children:[(0,t.jsx)("span",{className:"block text-zinc-500",children:"Calendar"}),(0,t.jsx)("span",{className:"break-all font-mono text-zinc-200",children:e.google_calendar_id||"missing"})]}),(0,t.jsxs)("div",{className:"rounded border border-zinc-700/40 bg-black/20 p-2",children:[(0,t.jsx)("span",{className:"block text-zinc-500",children:"API key"}),(0,t.jsx)("span",{className:"font-mono text-zinc-200",children:e.google_calendar_api_key?"set":"missing"})]})]}),void 0!==w.details&&null!==w.details&&(0,t.jsxs)("details",{className:"mt-3",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-xs font-medium text-cyan-300 hover:text-cyan-200",children:"Show raw sync response"}),(0,t.jsx)("pre",{className:"mt-2 max-h-64 overflow-auto rounded-md border border-zinc-700/50 bg-black/40 p-3 text-[11px] leading-relaxed text-zinc-300",children:JSON.stringify(w.details,null,2)})]})]}),(e.google_calendar_last_sync_status||e.google_calendar_last_sync_error)&&(0,t.jsxs)("div",{className:"p-3 rounded-md bg-zinc-900/50 border border-zinc-700/30",children:[(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Last sync: ",e.google_calendar_last_sync_status||e.google_calendar_last_sync_error]}),e.google_calendar_last_sync_at&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Completed ",new Date(e.google_calendar_last_sync_at).toLocaleString()]})]}),(0,t.jsx)("div",{className:"p-3 rounded-md bg-zinc-900/50 border border-zinc-700/30",children:(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Create an API key in"," ",(0,t.jsxs)("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-cyan-400 hover:text-cyan-300",children:["Google Cloud Credentials ",(0,t.jsx)(h.A,{className:"w-3 h-3"})]}),", enable the Google Calendar API, and make sure this calendar is shared publicly or shared with the credential that owns the key."]})})]})]}),(0,t.jsxs)(c.$,{type:"submit",disabled:_,className:"w-full",children:[(0,t.jsx)(g.A,{className:"w-4 h-4 mr-2"}),_?"Saving...":"Save All Integration Settings"]})]})]})}},89335:(e,a,s)=>{s.d(a,{bL:()=>f,zi:()=>N});var t=s(73459),n=s(91284),l=s(9430),r=s(10100),c=s(94638),i=s(77140),o=s(85816),d=s(45754),x=s(86707),m="Switch",[p,h]=(0,r.A)(m),[g,u]=p(m),b=t.forwardRef((e,a)=>{let{__scopeSwitch:s,name:r,checked:i,defaultChecked:o,required:m,disabled:p,value:h="on",onCheckedChange:u,form:b,...y}=e,[_,f]=t.useState(null),N=(0,l.s)(a,e=>f(e)),k=t.useRef(!1),w=!_||b||!!_.closest("form"),[z=!1,S]=(0,c.i)({prop:i,defaultProp:o,onChange:u});return(0,x.jsxs)(g,{scope:s,checked:z,disabled:p,children:[(0,x.jsx)(d.sG.button,{type:"button",role:"switch","aria-checked":z,"aria-required":m,"data-state":v(z),"data-disabled":p?"":void 0,disabled:p,value:h,...y,ref:N,onClick:(0,n.m)(e.onClick,e=>{S(e=>!e),w&&(k.current=e.isPropagationStopped(),k.current||e.stopPropagation())})}),w&&(0,x.jsx)(j,{control:_,bubbles:!k.current,name:r,value:h,checked:z,required:m,disabled:p,form:b,style:{transform:"translateX(-100%)"}})]})});b.displayName=m;var y="SwitchThumb",_=t.forwardRef((e,a)=>{let{__scopeSwitch:s,...t}=e,n=u(y,s);return(0,x.jsx)(d.sG.span,{"data-state":v(n.checked),"data-disabled":n.disabled?"":void 0,...t,ref:a})});_.displayName=y;var j=e=>{let{control:a,checked:s,bubbles:n=!0,...l}=e,r=t.useRef(null),c=(0,i.Z)(s),d=(0,o.X)(a);return t.useEffect(()=>{let e=r.current,a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(c!==s&&a){let t=new Event("click",{bubbles:n});a.call(e,s),e.dispatchEvent(t)}},[c,s,n]),(0,x.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...l,tabIndex:-1,ref:r,style:{...e.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function v(e){return e?"checked":"unchecked"}var f=b,N=_}}]);
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.