1import{r as o,j as e,B as v,S as T,v as Y,c as O,q as re,M as se,a as ne,b as le,P as I,t as ie,m as oe,u as ce,e as de,h as me,V as z,z as he,w as xe,E as J}from"./index-_aijvlUq.js";import{I as N}from"./Input-ysTyZFq5.js";import{n as ae,c as ue,d as ge}from"./tripRates-CtgxAan6.js";import{P as pe}from"./PageHeader-DCofr6qo.js";import{U as be}from"./usStates-B3oQG6kH.js";import{U as ye}from"./timezones-DtZyaxu5.js";import{a as V}from"./agreements-BApgy4DC.js";import{A as fe}from"./AgreementVersionHistory-BzxnBiqA.js";import{e as je}from"./ensembles-WGlB365j.js";import{o as X}from"./onboarding-yVikBuxN.js";import{C as ve}from"./ConfirmDialog-CODvETNM.js";import{m as Ne}from"./members-I3UAoZ9P.js";import{E as we}from"./EmptyState-CPGKooqj.js";import{T as ke}from"./Tabs-CGDUdv1I.js";import"./downscaleImage-qyGK-a3D.js";import"./Badge-DJIi163x.js";const Q="rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5";function Ce({value:a,onChange:r}){const l=ae(a),[c,u]=o.useState(()=>l.bands.map(d=>({miles:String(d.upToMiles),amount:ue(d.amountCents)})));function h(d,y={}){u(d);const p=d.map(s=>({upToMiles:Number(s.miles),amountCents:ge(s.amount)})).filter(s=>Number.isFinite(s.upToMiles)&&s.upToMiles>0&&s.amountCents!=null);r({...l,bands:p,...y})}const b=(d,y)=>h(c.map((p,s)=>s===d?{...p,...y}:p));return e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4","data-testid":"trip-settings",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Paid trips"}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Keep track of paid trips"}),e.jsx("p",{className:"text-xs text-gray-500",children:"For bands that pay drivers. You record each trip, someone authorizes it, and the treasurer gets a list to write invoices from. Backstage Baton never pays anyone."})]}),e.jsx("input",{type:"checkbox",className:Q,checked:l.enabled,onChange:d=>r({...l,enabled:d.target.checked})})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Your rates"}),e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"What a trip pays, by how far it is one way. A trip longer than your last rate is an amount you set each time."}),e.jsx("div",{className:"space-y-2",children:c.map((d,y)=>e.jsxs("div",{className:"flex flex-wrap items-end gap-2","data-testid":"rate-row",children:[e.jsx("div",{className:"w-36",children:e.jsx(N,{label:"Up to (miles one way)",type:"number",inputMode:"decimal",min:"1",value:d.miles,onChange:p=>b(y,{miles:p.target.value})})}),e.jsx("div",{className:"w-32",children:e.jsx(N,{label:"Pays ($)",inputMode:"decimal",value:d.amount,onChange:p=>b(y,{amount:p.target.value})})}),e.jsx(v,{type:"button",variant:"ghost",size:"md",onClick:()=>h(c.filter((p,s)=>s!==y)),"aria-label":`Remove rate ${y+1}`,children:"Remove"})]},y))}),c.length===0&&e.jsx("p",{className:"text-sm text-gray-600",children:"No rates yet, so every trip is an amount you set each time."}),c.length<6&&e.jsx(v,{type:"button",variant:"ghost",size:"md",className:"mt-2 !px-0",onClick:()=>h([...c,{miles:"",amount:""}]),children:"Add a rate"})]}),e.jsxs("div",{className:"max-w-xs",children:[e.jsx(T,{label:"For a trip one way only, the amount is",value:l.oneWayPays,onChange:d=>r({...l,oneWayPays:d.target.value}),options:[{value:"half",label:"Half your rate"},{value:"full",label:"Your full rate"}]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Your rates are for a trip there and back. This is for when one person drives there and someone else drives back."})]}),e.jsxs("div",{children:[e.jsx(N,{label:"How your band counts the miles",hint:"optional",placeholder:"e.g. To the venue, one way. Picking up the trailer is part of the trip.",value:l.milesNote,onChange:d=>r({...l,milesNote:d.target.value}),maxLength:200}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Shown under Miles one way when a trip is recorded, so everyone counts a trip with several stops the same way."})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"A driver needs documents on file"}),e.jsx("p",{className:"text-xs text-gray-500",children:"A trip can only be authorized for someone ticked as a licensed driver with documents on file (on their member page)."})]}),e.jsx("input",{type:"checkbox",className:Q,checked:l.requireDocuments,onChange:d=>r({...l,requireDocuments:d.target.checked})})]})]})]})}const K={list(a){return Y.get(`/organizations/${a}/role-labels`)},upsert(a,r,l){return Y.put(`/organizations/${a}/role-labels/${r}`,{label:l})},remove(a,r){return Y.delete(`/organizations/${a}/role-labels/${r}`)}};function Se(){const{showSuccess:a,showError:r}
1=O(),[l,c]=o.useState(null),[u,h]=o.useState(""),[b,d]=o.useState(""),[y,p]=o.useState(!1);if(o.useEffect(()=>{let n=!0;return V.getOrgAgreement().then(m=>{!n||!m||(c(m),h(m.title||""),d(m.bodyText||""))}).catch(()=>{}),()=>{n=!1}},[]),!l)return null;const s=u!==l.title||b!==l.bodyText;async function f(){if(b.trim().length<20){r("The permission text is too short.");return}p(!0);try{const n=await V.updateOrgAgreement({title:u,bodyText:b});c(n),h(n.title),d(n.bodyText),a(n.version>l.version?`Permission text saved as v${n.version} â answers from now on record against this wording`:"Permission text saved")}catch(n){r(n.message||"Failed to save")}finally{p(!1)}}return e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Photo & Media Permission"}),e.jsx("p",{className:"text-sm text-gray-500",children:"The wording members (or their guardians) answer when you record photo permission â shown wherever the question is asked. Edit it to match how your band actually uses photos and video."}),e.jsx(N,{label:"Title",value:u,onChange:n=>h(n.target.value)}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Permission text"}),e.jsx("textarea",{value:b,onChange:n=>d(n.target.value),rows:5,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:ring-2 focus:ring-band-500 focus:border-band-500"})]}),e.jsx("p",{className:"text-xs text-gray-400",children:"Backstage Baton records who answered and when â it isn't legal advice, and your band owns this wording. If you need specific release language (especially for minors), run it past someone qualified in your state."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-gray-500",children:["Current wording: v",l.version,l.updatedAt?` · last edited ${re(l.updatedAt)}`:""]}),e.jsx(fe,{load:()=>V.getOrgAgreementVersions(),currentVersion:l.version,currentTitle:l.title,reloadKey:l.version})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:e.jsx(v,{type:"button",onClick:f,isLoading:y,disabled:!s,children:"Save changes"})})]})}const ee="relay.backstagebaton.com",H="https://app.backstagebaton.com/app";function Ae(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function L({text:a}){const[r,l]=o.useState(!1);async function c(){try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2e3)}catch{}}return e.jsx(v,{variant:"ghost",size:"sm",onClick:c,children:r?"Copied!":"Copy"})}function Z({label:a,value:r,mono:l}){return e.jsxs("tr",{children:[e.jsx("td",{className:"py-2 pr-4 text-sm text-gray-500 whitespace-nowrap",children:a}),e.jsx("td",{className:`py-2 pr-4 text-sm ${l?"font-mono text-gray-700":"text-gray-900"} break-all`,children:r}),e.jsx("td",{className:"py-2 text-right",children:e.jsx(L,{text:r})})]})}function Pe({org:a,ensembles:r}){if(!a?.slug)return null;const l=`${a.slug}@${ee}`;return r?.reduce((c,u)=>c+(u.memberCount||0),0),e.jsxs("div",{className:"space-y-6 mt-6",children:[e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Email Relay Addresses"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Send to these addresses to reach your members without managing a distribution list."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs text-gray-500 border-b border-gray-100",children:[e.jsx("th",{className:"pb-2 font-medium",children:"Address"}),e.jsx("th",{className:"pb-2 font-medium",children:"Reaches"}),e.jsx("th",{className:"pb-2"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"py-2.5 pr-4 font-mono text-sm text-gray-700 break-all",children:l}),e.jsx("td",{className:"py-2.5 pr-4 text-sm text-gray-600",children:"All active members"}),e.jsx("td",{className:"py-2.5 text-right",children:e.jsx(L,{text:l})})]}),(r||[]).map(c=>{const u=Ae(c.name),h=`${a.slug}-${u}@${ee}`;return e.jsxs("tr",{children:[e.jsx("td",{className:"py-2.5 pr-4 font-mono text-sm text-gray-700 break-all",children:h}),e.jsxs("td",{className:"py-2.5 pr-4 text-sm text-gray-600",children:[c.name,c.memberCount!=null?` (${c.memberCount})`:""]}),e.jsx("td",{className:"py-2.5 text-right",children:e.jsx(L,{text:h})})]},c.id)})]})]})}),e.jsx("p",{className:"text-xs text-gray-400",children:"Members with director, band manager, or communications roles can send to these addresses."})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Member Login"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Share these links with your members."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs text-gray-500 border-b border-gray-100",children:[e.jsx("th",{className:"pb-2 font-medium",children:"Link"}),e.jsx("th",{className:"pb-2 font-medium",children:"Purpose"}),e.jsx("th",{className:"pb-2"})]})}),e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[e.jsxs("tr",{children:[e.jsx("td",{className:"py-2.5 pr-4 font-mono text-sm text-gray-700 break-all",children:H}),e.jsx("td",{className:"py-2.5 pr-4 text-sm text-gray-600",children:"Main app URL"}),e.jsx("td",{className:"py-2.5 text-right",children:e.jsx(L,{text:H})})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"py-2.5 pr-4 font-mono text-sm text-gray-700 break-all",children:`${H}/login?org=${a.slug}`}),e.jsx("td",{className:"py-2.5 pr-4 text-sm text-gray-600",children:"Direct org login"}),e.jsx("td",{className:"py-2.5 text-right",children:e.jsx(L,{text:`${H}/login?org=${a.slug}`})})]})]})]})})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Org Details"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"w-full text-sm",children:e.jsxs("tbody",{className:"divide-y divide-gray-50",children:[e.jsx(Z,{label:"Org slug",value:a.slug,mono:!0}),e.jsx(Z,{label:"Org ID",value:a.id,mono:!0}),a.planTier&&e.jsx(Z,{label:"Plan",value:a.planTier})]})})})]})]})}function Te({pass:a,label:r}){return e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[a?e.jsx("svg",{className:"h-4 w-4 text-green-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):e.jsx("svg",{className:"h-4 w-4 text-gray-300 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("circle",{cx:"12",cy:"12",r:"10"})}),e.jsx("span",{className:a?"text-gray-700":"text-gray-400",children:r})]})}function Re(){const[a,r]=o.useState(null),[l,c]=o.useState(!0),[u,h]=o.use
1State(!1),[b,d]=o.useState(!1),{showSuccess:y,showError:p}=O();if(o.useEffect(()=>{X.getStatus().then(r).catch(()=>r(null)).finally(()=>c(!1))},[]),l||!a||a.status!=="onboarding")return null;async function s(){d(!0);try{const f=await X.goLive();y(`Org is live! ${f.sentCount} welcome email${f.sentCount!==1?"s":""} sent.`),h(!1),r({...a,status:"active"})}catch(f){p(f.message||"Go Live failed")}finally{d(!1)}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 sm:p-6 mb-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 uppercase tracking-wide mb-1",children:"Onboarding Mode"}),e.jsx("p",{className:"text-sm text-amber-700 mb-4",children:"Member welcome emails are paused until you go live â build your roster quietly, then click Go Live when ready. Officers and staff (anyone with a leadership role) get their welcome email right away."}),e.jsx("ul",{className:"space-y-2 mb-4",children:Object.values(a.checklist).map(f=>e.jsx(Te,{pass:f.pass,label:f.label},f.label))}),a.pendingWelcomeEmails>0&&e.jsxs("p",{className:"text-xs text-amber-600 mb-3",children:[a.pendingWelcomeEmails," welcome email",a.pendingWelcomeEmails!==1?"s":""," queued â will send when you go live."]}),e.jsx(v,{variant:"primary",size:"sm",disabled:!a.canGoLive,onClick:()=>h(!0),children:"Go Live"}),!a.canGoLive&&e.jsx("p",{className:"text-xs text-amber-500 mt-2",children:"Complete all checklist items to enable Go Live."})]}),e.jsxs(se,{isOpen:u,onClose:()=>h(!1),title:"Go Live",children:[e.jsxs("p",{className:"text-sm text-gray-700 mb-4",children:["This will activate your organization and send welcome emails to"," ",e.jsxs("strong",{children:[a.pendingWelcomeEmails," member",a.pendingWelcomeEmails!==1?"s":""]}),". This cannot be undone."]}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:"Ready to go live?"}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(v,{variant:"secondary",size:"sm",onClick:()=>h(!1),disabled:b,children:"Cancel"}),e.jsx(v,{variant:"primary",size:"sm",onClick:s,isLoading:b,children:"Go Live"})]})]})]})}function Le({orgId:a}){const{authority:r}=ne(),l=le(i=>i.loadSession),{showSuccess:c,showError:u}=O(),[h,b]=o.useState({owner:null,admins:[]}),[d,y]=o.useState([]),[p,s]=o.useState(!0),[f,n]=o.useState(""),[m,j]=o.useState(!1),[k,w]=o.useState(null),[W,C]=o.useState(!1),[S,E]=o.useState(""),F=r==="owner",A=r==="owner"||r==="admin",R=o.useCallback(async()=>{s(!0);try{const[i,t]=await Promise.all([I.getAuthority(a),Ne.list({status:"active",limit:500})]);b(i),y(Array.isArray(t)?t:t?.members??[])}catch{u(ie("owners and admins"))}finally{s(!1)}},[a,u]);if(o.useEffect(()=>{A&&R()},[A,R]),!A)return null;const M=new Set(h.admins.map(i=>i.memberId)),P=h.owner?.memberId,x=d.filter(i=>i.systemRole&&i.id!==P&&!M.has(i.id)),U=i=>`${i.firstName} ${i.lastName}`.trim(),D=d.filter(i=>i.systemRole&&i.id!==P);async function _(){if(f){j(!0);try{const i=await I.grantAdmin(a,f);b(i),n(""),c("Admin added")}catch(i){u(i.message||"Could not add admin")}finally{j(!1)}}}async function q(){if(k){j(!0);try{const i=await I.revokeAdmin(a,k.memberId);b(i),c("Admin removed")}catch(i){u(i.message||"Could not remove admin")}finally{j(!1),w(null)}}}async function $(){if(S){j(!0);try{await I.transferOwnership(a,S),c("Ownership transferred"),C(!1),E(""),await l(),await R()}catch(i){u(i.message||"Could not transfer ownership")}finally{j(!1)}}}return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Owner & Admins"}),e.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["The ",e.jsx("strong",{children:"Owner"})," controls the account and can transfer ownership. ",e.jsx("strong",{children:"Admins"})," have full access to manage the organization. These are separate from band roles like President or Music Director."]}),p?e.jsx("p",{className:"text-sm text-gray-500",children:"Loadingâ¦"}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Owner"}),h.owner?e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-200 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:h.owner.name}),e.jsx("div",{className:"text-xs text-gray-500",children:h.owner.email})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-band-100 text-band-700 px-2.5 py-0.5 text-xs font-medium",children:"Owner"})]}):e.jsx("p",{className:"text-sm text-gray-500",children:"No owner assigned."}),F&&D.length>0&&e.jsx(v,{variant:"secondary",size:"sm",className:"mt-2",onClick:()=>C(!0),children:"Transfer ownershipâ¦"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Admins"}),h.admins.length===0?e.jsx(we,{size:"compact",title:"No admins yet."}):e.jsx("ul",{className:"space-y-2 mb-3",children:h.admins.map(i=>e.jsxs("li",{className:"flex items-center justify-between rounded-lg border border-gray-200 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:i.name}),e.jsx("div",{className:"text-xs text-gray-500",children:i.email})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>w({memberId:i.memberId,name:i.name}),children:"Remove"})]},i.memberId||i.userId))}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(T,{label:"Add an admin",placeholder:x.length?"Select a memberâ¦":"No eligible members",value:f,onChange:i=>n(i.target.value),options:x.map(i=>({value:i.id,label:U(i)})),disabled:m||x.length===0})}),e.jsx(v,{onClick:_,disabled:!f||m,isLoading:m,children:"Add"})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Only members with a login account can be made admins."})]})]}),e.jsx(ve,{isOpen:!!k,onClose:()=>w(null),onConfirm:q,title:"Remove admin",message:k?`Remove ${k.name} as an admin? They keep their band role and login, but lose full account access.`:"",confirmLabel:"Remove admin",isLoading:m}),e.jsx(se,{isOpen:W,onClose:()=>C(!1),title:"Transfer ownership",size:"sm",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-gray-600",children:["The new owner gains full control of the account, including billing and the ability to transfer ownership. You will become an ",e.jsx("strong",{children:"Admin"}),". This can only be undone by the new owner."]}
1),e.jsx(T,{label:"New owner",placeholder:"Select a memberâ¦",value:S,onChange:i=>E(i.target.value),options:D.map(i=>({value:i.id,label:U(i)})),disabled:m}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx(v,{variant:"secondary",onClick:()=>C(!1),disabled:m,children:"Cancel"}),e.jsx(v,{variant:"danger",onClick:$,disabled:!S||m,isLoading:m,children:"Transfer ownership"})]})]})})]})}const B={name:"",shortName:"",tagline:"",colorChrome:z[0].colorChrome,colorPrimary:z[0].colorPrimary,colorAccent:z[0].colorAccent,phone:"",website:"",street:"",city:"",state:"",zip:"",facebookUrl:"",instagramUrl:"",twitterUrl:"",youtubeUrl:"",trackPerformanceAttendance:!0,trackRehearsalAttendance:!0,volunteerSettings:{enabled:!0,membersCanSignUp:!0,membersSeeTheirHours:!0},tripSettings:{enabled:!1,bands:[],requireDocuments:!0},trackRehearsalRsvps:!0,membersOpenDigitalCopies:!1,trackPerformanceRsvps:!0,attendanceWindowDays:90,attendanceTargetPercent:50,attendanceExcusedPolicy:"excluded",timezone:"America/New_York",defaultContactSharingEmail:"all_band",defaultContactSharingPhone:"all_band"};function ze({orgId:a}){const[r,l]=o.useState([]),[c,u]=o.useState({}),[h,b]=o.useState({}),{showSuccess:d,showError:y}=O(),p=o.useCallback(async()=>{try{const n=await K.list(a);l(n);const m={};for(const j of n)m[j.role]=j.label??"";u(m)}catch{}},[a]);o.useEffect(()=>{p()},[p]);async function s(n){const m=c[n]?.trim();if(m){b(j=>({...j,[n]:!0}));try{await K.upsert(a,n,m),d("Label saved"),await p()}catch(j){y(j.message||J)}finally{b(j=>({...j,[n]:!1}))}}}async function f(n){b(m=>({...m,[n]:!0}));try{await K.remove(a,n),d("Label reset to default"),await p()}catch(m){y(m.message||J)}finally{b(m=>({...m,[n]:!1}))}}return e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4 mt-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Role Labels"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Override how role names appear in this organization. Security enforcement always uses system role names."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs text-gray-500 border-b border-gray-100",children:[e.jsx("th",{className:"pb-2 font-medium w-1/4",children:"System Role"}),e.jsx("th",{className:"pb-2 font-medium w-1/4",children:"Platform Default"}),e.jsx("th",{className:"pb-2 font-medium w-1/3",children:"Custom Label"}),e.jsx("th",{className:"pb-2 font-medium"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-50",children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{className:"py-2.5 pr-3 font-mono text-xs text-gray-500",children:n.role}),e.jsx("td",{className:"py-2.5 pr-3 text-gray-600",children:n.defaultLabel}),e.jsx("td",{className:"py-2.5 pr-3",children:e.jsx("input",{type:"text",value:c[n.role]??"",onChange:m=>u(j=>({...j,[n.role]:m.target.value})),onBlur:()=>{const m=c[n.role]?.trim();m&&m!==(n.label??"")&&s(n.role)},placeholder:n.defaultLabel,className:"w-full rounded border border-gray-200 px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-band-400"})}),e.jsxs("td",{className:"py-2.5 flex gap-1 items-center",children:[e.jsx(v,{size:"sm",variant:"ghost",disabled:h[n.role],onClick:()=>s(n.role),children:"Save"}),n.label&&e.jsx(v,{size:"sm",variant:"ghost",disabled:h[n.role],onClick:()=>f(n.role),children:"Reset"})]})]},n.role))})]})})]})}function Oe(a){return z.find(r=>r.colorChrome===a.colorChrome&&r.colorPrimary===a.colorPrimary&&r.colorAccent===a.colorAccent)??null}function Ze(){const{id:a}=oe(),r=!a||a==="new",l=ce(),[c]=de(),{orgs:u,createOrg:h,updateOrg:b,uploadLogo:d}=me(),{showSuccess:y,showError:p}=O(),[s,f]=o.useState(B),[n,m]=o.useState({}),[j,k]=o.useState(!1),[w,W]=o.useState(null),[C,S]=o.useState(null),[E,F]=o.useState([]),[A,R]=o.useState(c.get("tab")==="settings"?"settings":"profile"),M=o.useRef(null),P=o.useRef(null);o.useEffect(()=>{r||je.list().then(F).catch(he("ensemble options on the profile page"))},[r]),o.useEffect(()=>{if(!r){const t=u.find(g=>g.id===a);if(t){const g={name:t.name??"",shortName:t.shortName??"",tagline:t.tagline??"",colorChrome:t.colorChrome??B.colorChrome,colorPrimary:t.colorPrimary??B.colorPrimary,colorAccent:t.colorAccent??B.colorAccent,phone:t.phone??"",website:t.website??"",street:t.street??"",city:t.city??"",state:t.state??"",zip:t.zip??"",facebookUrl:t.facebookUrl??"",instagramUrl:t.instagramUrl??"",twitterUrl:t.twitterUrl??"",youtubeUrl:t.youtubeUrl??"",trackPerformanceAttendance:t.trackPerformanceAttendance!==!1,trackRehearsalAttendance:t.trackRehearsalAttendance!==!1,trackRehearsalRsvps:t.trackRehearsalRsvps!==!1,membersOpenDigitalCopies:t.membersOpenDigitalCopies===!0,trackPerformanceRsvps:t.trackPerformanceRsvps!==!1,attendanceWindowDays:t.attendanceWindowDays??90,attendanceTargetPercent:t.attendanceTargetPercent??50,attendanceExcusedPolicy:t.attendanceExcusedPolicy||"excluded",timezone:t.timezone||"America/Ne
1w_York",defaultContactSharingEmail:t.defaultContactSharingEmail||"all_band",defaultContactSharingPhone:t.defaultContactSharingPhone||"all_band",volunteerSettings:{enabled:t.volunteerSettings?.enabled!==!1,membersCanSignUp:t.volunteerSettings?.membersCanSignUp!==!1,membersSeeTheirHours:t.volunteerSettings?.membersSeeTheirHours!==!1},tripSettings:ae(t.tripSettings)};f(g),S(t.logoUrl??null),P.current||(P.current=g)}}},[a,u]);function x(t,g){f(G=>({...G,[t]:g})),n[t]&&m(G=>({...G,[t]:null}))}function U(t){f(g=>({...g,colorChrome:t.colorChrome,colorPrimary:t.colorPrimary,colorAccent:t.colorAccent}))}function D(t){const g=t.target.files?.[0];g&&(W(g),S(URL.createObjectURL(g)))}function _(){const t={};return s.name.trim()||(t.name="Required"),s.shortName.trim()||(t.shortName="Required"),m(t),Object.keys(t).length===0}async function q(t){if(t.preventDefault(),!!_()){k(!0);try{let g;if(r){g=await h({...s,status:"setup"}),w&&g?.id&&await d(g.id,w),y("Organization created â complete the setup wizard"),l(`/setup/${g.id}`);return}else g=await b(a,s);w&&g?.id&&await d(g.id,w),y("Organization updated"),l("/settings/organizations")}catch(g){p(g.message||J)}finally{k(!1)}}}const $=r||w!=null||!P.current||(()=>{const t=P.current;for(const g of Object.keys(t))if(s[g]!==t[g])return!0;return!1})(),i=Oe(s);return e.jsxs("div",{className:"px-4 md:px-0",children:[e.jsx(pe,{title:r?"New Organization":"Edit Organization",breadcrumbs:[{label:"Home",to:"/"},{label:"Settings"},{label:"Organizations",to:"/settings/organizations"},{label:r?"New":s.name||"Organization"}],actions:e.jsxs(e.Fragment,{children:[e.jsx(v,{type:"submit",form:"org-edit-form",isLoading:j,disabled:!$,children:r?"Create":"Save changes"}),e.jsx(v,{variant:"secondary",onClick:()=>l("/settings/organizations"),children:"Cancel"})]})}),!r&&e.jsx(Re,{}),!r&&e.jsx(ke,{className:"mb-4",ariaLabel:"Organization profile sections",tabs:[{key:"profile",label:"Profile"},{key:"settings",label:"Settings"}],value:A,onChange:R}),e.jsxs("form",{id:"org-edit-form",onSubmit:q,className:"space-y-6",children:[(r||A==="profile")&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Identity"}),e.jsx(N,{label:"Organization Name",placeholder:"Highlands Ranch Concert Band",value:s.name,onChange:t=>x("name",t.target.value),error:n.name,required:!0}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(N,{label:"Short Name",placeholder:"HRCB",value:s.shortName,onChange:t=>x("shortName",t.target.value),error:n.shortName,required:!0}),e.jsx(N,{label:"Footer Tagline",placeholder:"Making music since 1985",value:s.tagline,onChange:t=>x("tagline",t.target.value)})]})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Contact"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(N,{label:"Phone",placeholder:"(555) 555-5555",value:s.phone,onChange:t=>x("phone",xe(t.target.value))}),e.jsx(N,{label:"Website",type:"url",placeholder:"https://www.example.org",value:s.website,onChange:t=>x("website",t.target.value)})]})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Address"}),e.jsx(N,{label:"Street",placeholder:"123 Main St",value:s.street,onChange:t=>x("street",t.target.value)}),e.jsxs("div",{className:"grid grid-cols-6 gap-4",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(N,{label:"City",placeholder:"Highlands Ranch",value:s.city,onChange:t=>x("city",t.target.value)})}),e.jsx("div",{className:"col-span-2",children:e.jsx(T,{label:"State",options:be,value:s.state,onChange:t=>x("state",t.target.value)})}),e.jsx("div",{className:"col-span-2",children:e.jsx(N,{label:"Zip",placeholder:"80129",value:s.zip,onChange:t=>x("zip",t.target.value)})})]})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Social Media"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(N,{label:"Facebook",type:"url",placeholder:"https://facebook.com/yourorg",value:s.facebookUrl,onChange:t=>x("facebookUrl",t.target.value)}),e.jsx(N,{label:"Instagram",type:"url",placeholder:"https://instagram.com/yourorg",value:s.instagramUrl,onChange:t=>x("instagramUrl",t.target.value)}),e.jsx(N,{label:"X / Twitter",type:"url",placeholder:"https://x.com/yourorg",value:s.twitterUrl,onChange:t=>x("twitterUrl",t.target.value)}),e.jsx(N,{label:"YouTube",type:"url",placeholder:"https://youtube.com/@yourorg",value:s.youtubeUrl,onChange:t=>x("youtubeUrl",t.target.value)})]})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Color Scheme"}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:z.map(t=>{const g=i?.name===t.name;return e.jsxs("button",{type:"button",onClick:()=>U(t),className:`relative rounded-lg overflow-hidden border-2 transition-all focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-band-400 ${g?"border-band-400 ring-1 ring-band-400":"border-gray-200 hover:border-gray-400"}`,children:[e.jsx("div",{className:"h-10",style:{background:t.colorChrome},children:e.jsxs("div",{className:"flex items-center gap-1 px-2 h-full",children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-white/20"}),e.jsx("div",{className:"flex-1 h-1.5 rounded bg-white/20"}),e.jsx("div",{className:"h-4 w-8 rounded text-white",style:{background:t.colorPrimary}})]})}),e.jsx("div",{className:"h-1.5",style:{background:t.colorAccent}}),e.jsx("div",{className:"py-1.5 px-2 bg-gray-50 text-center",children:e.jsx("span",{className:"text-xs font-medium text-gray-700",children:t.name})}),g&&e.jsx("div",{className:"absolute top-1.5 right-1.5 h-4 w-4 roun
1ded-full bg-band-400 flex items-center justify-center",children:e.jsx("svg",{className:"h-2.5 w-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})})]},t.name)})}),e.jsxs("div",{className:"rounded-lg overflow-hidden border border-gray-200",children:[e.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3",style:{background:s.colorChrome},children:[e.jsx("span",{className:"text-white font-bold text-sm",children:s.shortName||"HRCB"}),e.jsx("span",{className:"text-white/60 text-xs",children:s.tagline||"Member Portal"})]}),e.jsx("div",{className:"h-1",style:{background:s.colorAccent}}),e.jsx("div",{className:"px-4 py-1.5",style:{background:s.colorChrome},children:e.jsxs("p",{className:"text-white/50 text-xs",children:["© ",new Date().getFullYear()," ",s.name||"Organization Name"," â ",s.tagline||"Tagline"]})})]})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Logo"}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("div",{className:"shrink-0",children:C?e.jsx("img",{src:C,alt:"Logo",className:"h-16 w-16 rounded-full object-cover ring-2 ring-gray-200"}):e.jsx("div",{className:"h-16 w-16 rounded-full bg-gray-100 border-2 border-dashed border-gray-300 flex items-center justify-center text-gray-400 text-xs",children:"Logo"})}),e.jsxs("div",{children:[e.jsx(v,{type:"button",variant:"secondary",size:"sm",onClick:()=>M.current?.click(),children:C?"Change logo":"Upload logo"}),w&&e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:w.name}),e.jsx("p",{className:"mt-1 text-xs text-gray-400",children:"JPEG, PNG, or WebP · max 5 MB"}),e.jsx("input",{ref:M,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:D})]})]})]})]}),!r&&A==="settings"&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Timezone"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Used for performance dates, rehearsal reminders, weekly digest send time, and other scheduled emails. Set this to your band's local timezone â not where the server is."}),e.jsx(T,{label:"Organization timezone",options:ye,value:s.timezone||"America/New_York",onChange:t=>x("timezone",t.target.value)})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Volunteer help"}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Keep track of volunteer help"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Adds Help wanted to your concerts and work days, so you can ask for people to load, usher or bake. Turning it off hides Help wanted; nothing already recorded is lost."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.volunteerSettings?.enabled!==!1,onChange:t=>x("volunteerSettings",{...s.volunteerSettings,enabled:t.target.checked})})]}),s.volunteerSettings?.enabled!==!1&&e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Members can sign themselves up"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Members see the jobs on their concerts, work days and Home, and tap Sign up. Turn this off if a leader should decide who helps; members then see the jobs and are asked to tell their director."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.volunteerSettings?.membersCanSignUp!==!1,onChange:t=>x("volunteerSettings",{...s.volunteerSettings,membersCanSignUp:t.target.checked})})]}),s.volunteerSettings?.enabled!==!1&&e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Members see their own hours"}),e.jsx("p",{className:"text-xs text-gray-500",children:"After a jobâs day has passed, everyone still signed up is given its hours. Each member sees what they helped with and their own total on Home and on their Help wanted page. Nobody sees anyone elseâs."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.volunteerSettings?.membersSeeTheirHours!==!1,onChange:t=>x("volunteerSettings",{...s.volunteerSettings,membersSeeTheirHours:t.target.checked})})]})]}
1),e.jsx(Ce,{value:s.tripSettings,onChange:t=>x("tripSettings",t)},a),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Attendance Tracking"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Choose which event types Backstage Baton records attendance for. Turning a type off hides the Take Attendance button for that event type and excludes those events from attendance percentage calculations. Existing records are preserved."}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2 border-b border-gray-100",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Performances"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Record who attended each performance."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.trackPerformanceAttendance,onChange:t=>x("trackPerformanceAttendance",t.target.checked)})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Rehearsals"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Record who attended each rehearsal."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.trackRehearsalAttendance,onChange:t=>x("trackRehearsalAttendance",t.target.checked)})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2 border-t border-gray-100 pt-3 mt-1",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Day-of rehearsal RSVPs"}),e.jsx("p",{className:"text-xs text-gray-500",children:`Members can tap "Can't make it tonight?" right in their rehearsal-day reminder email â no login. You and your section leaders see who's out ahead of time. Turn this off to remove the link from the reminder.`})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.trackRehearsalRsvps,onChange:t=>x("trackRehearsalRsvps",t.target.checked)})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2 border-t border-gray-100 pt-3 mt-1",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Members can open digital copies"}),e.jsx("p",{className:"text-xs text-gray-500",children:"When a piece has a digital-copy link, members can open it. Leave this off unless your digital licenses permit distributing the file to members â leadership can always open it either way."})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.membersOpenDigitalCopies,onChange:t=>x("membersOpenDigitalCopies",t.target.checked)})]}),e.jsxs("label",{className:"flex items-center justify-between gap-3 py-2 border-t border-gray-100 pt-3 mt-1",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Performance RSVPs"}),e.jsx("p",{className:"text-xs text-gray-500",children:`Members can tap "RSVP â will you be there?" right in the email announcing a new performance â no login. If they can't make it, they're marked unavailable for that performance, so you can see who's coming ahead of time. Turn this off to remove the link from the email.`})]}),e.jsx("input",{type:"checkbox",className:"rounded border-gray-300 text-band-600 focus:ring-band-500 h-5 w-5",checked:s.trackPerformanceRsvps,onChange:t=>x("trackPerformanceRsvps",t.target.checked)})]}),e.jsxs("div",{className:"border-t border-gray-100 pt-3 mt-1 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-800",children:"Attendance percentage rules"}),e.jsx("p",{className:"text-xs text-gray-500",children:"How Backstage Baton computes every attendance percentage â roster chips, the My Section history grid, at-risk flags, and reports."})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1",htmlFor:"att-window",children:"Counting window"}),e.jsx(T,{id:"att-window",value:String(s.attendanceWindowDays),onChange:t=>x("attendanceWindowDays",Number(t.target.value)),options:[{value:"30",label:"Last 30 days"},{value:"60",label:"Last 60 days"},{value:"90",label:"Last 90 days"},{value:"180",label:"Last 6 months"},{value:"365",label:"Last 12 months"}]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1",htmlFor:"att-target",children:"Attendance target"}),e.jsx(N,{id:"att-target",type:"number",min:0,max:100,value:s.attendanceTargetPercent,onChange:t=>x("attendanceTargetPercent",Math.max(0,Math.min(100,Number(t.target.value)||0)))}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"Members below this % are flagged at-risk."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1",htmlFor:"att-excused",children:"Excused absences"}),e.jsx(T,{id:"att-excused",value:s.attendanceExcusedPolicy,onChange:t=>x("attendanceExcusedPolicy",t.target.value),options:[{value:"excluded",label:"Don't count either way"},{value:"counts_against",label:"Count as a miss"},{value:"counts_for",label:"Count as attended"}]}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"What an excused absence does to the percentage."})]})]})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg border border-gray-200 p-3 text-xs text-gray-600 leading-relaxed",children:[e.jsx("strong",{className:"text-gray-700",children:"Still tracked regardless:"})," whether a member is on the roster and has a chair assignment for a performance. Member activity can still be inferred from participation even if direct attendance recording is off."]})]}),e.jsx(Se,{}),e.jsxs("section",{className:"bg-white rounded-xl border border-gray-200 p-6 space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide",children:"Default Contact Sharing"}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Sets the band-wide default for member-to-member visibility of email and ph
1one. Individual members can override this from ",e.jsx("strong",{children:"Account â Contact Sharing"}),". Schools and youth orgs typically pick ",e.jsx("em",{children:"Hidden"})," here so contact info isn't exposed without an explicit member opt-in. Admins always see contact info regardless."]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(te,{label:"Email",helperWhenLocked:"Members will need to opt in individually to share their email with peers.",value:s.defaultContactSharingEmail,onChange:t=>x("defaultContactSharingEmail",t)}),e.jsx(te,{label:"Phone",helperWhenLocked:"Members will need to opt in individually to share their phone with peers.",value:s.defaultContactSharingPhone,onChange:t=>x("defaultContactSharingPhone",t)})]}),e.jsxs("div",{className:"bg-amber-50 rounded-lg border border-amber-200 p-3 text-xs text-amber-900 leading-relaxed",children:[e.jsx("strong",{children:"Heads-up:"})," changing these affects every member who hasn't set their own preference. Members who've already opted-in or opted-out from their account page keep their setting."]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 mt-6 border-t border-gray-200",children:[e.jsx(v,{type:"submit",isLoading:j,disabled:!$,children:r?"Create":"Save changes"}),e.jsx(v,{type:"button",variant:"secondary",onClick:()=>l("/settings/organizations"),disabled:j,children:"Cancel"})]})]}),!r&&e.jsx(Le,{orgId:a}),!r&&e.jsx(ze,{orgId:a}),!r&&(()=>{const t=u.find(g=>g.id===a);return t?.slug?e.jsx(Pe,{org:t,ensembles:E}):null})()]})}function te({label:a,value:r,onChange:l,helperWhenLocked:c}){return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[{val:"all_band",title:"All band",sub:"Any member can see"},{val:"section_only",title:"Section only",sub:"Only same-section peers"},{val:"private",title:"Hidden",sub:"Admins only"}].map(u=>{const h=r===u.val;return e.jsxs("button",{type:"button",onClick:()=>l(u.val),"aria-pressed":h,className:`text-left rounded-lg border px-3 py-2 transition-colors ${h?"border-band-400 bg-band-50":"border-gray-200 hover:border-band-300"}`,children:[e.jsx("div",{className:`text-sm font-medium ${h?"text-band-900":"text-gray-900"}`,children:u.title}),e.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:u.sub})]},u.val)})}),r==="private"&&c&&e.jsx("p",{className:"text-xs text-amber-700 mt-2",children:c})]})}export{Ze as SiteProfilePage};
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.