1import{aO as ie,bE as le,bw as ce,bH as de,aZ as g,a_ as ue,aP as d,aQ as r,aR as i,b7 as a,b8 as u,aT as e,aS as t,by as me,bz as c,aX as _,aV as h,bg as b,aY as l,bI as ve,bh as L,aU as f,bi as z,ba as E,be as S,br as J,bJ as ge,bs as xe}from"./CN4ZE-vz.js";import{T as O}from"./BNVspykM.js";import{_ as fe}from"./Cam2duvV.js";import{u as pe}from"./BHO6cY2v.js";import{g as he,S as be,M as ye,b as _e}from"./BKwQ9MIR.js";import"./DQfWpKHy.js";import"./Duduxpha.js";import"./C12XAJdh.js";import"./BNXvtYLC.js";import"./PnwMnPXZ.js";import"./DwFc3Pcp.js";import"./ElNFAgva.js";import"./CC0q4xU1.js";import"./CfbobgoO.js";import"./Dx9sDdtk.js";import"./71jdSjd_.js";import"./eT1X0JLk.js";import"./BDig1T1j.js";const we={class:"min-h-[calc(100vh-64px)] flex flex-col items-center justify-center px-6 py-12"},ke={class:"w-full max-w-2xl"},Te={key:0,class:"mb-8 rounded-2xl border border-violet-200 bg-violet-50/70 p-5 shadow-sm"},Ce={class:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"},je={class:"text-center mb-10"},Se={class:"font-display text-3xl text-secondary-dark"},Pe={key:0,class:"flex justify-center mb-8"},Ie={class:"flex items-center justify-center w-5 h-5 rounded-full bg-amber-500 text-white text-[10px] font-bold"},Me={class:"text-secondary group-hover:text-secondary-dark transition-colors"},$e={class:"mb-10"},Ae={class:"flex items-center justify-between mb-3"},Le={class:"flex items-center gap-2"},Ne={class:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-gray-100 text-secondary"},Be={class:"space-y-2"},Fe=["onClick","disabled"],Ve={class:"flex-1 min-w-0 text-left"},Ye={class:"font-medium text-secondary-dark text-sm truncate group-hover:text-black transition-colors"},Ue={class:"text-xs text-secondary"},ze={class:"py-1"},Ee=["onClick"],Je={class:"flex-shrink-0 w-7 h-7 rounded-full bg-gray-100 group-hover:bg-secondary-dark flex items-center justify-center transition-all"},Oe={key:0},We={key:1},De={class:"grid sm:grid-cols-2 gap-3"},Ge=["onClick"],Re={class:"relative flex items-start gap-4"},qe={class:"flex-1 min-w-0"},He={class:"font-semibold text-secondary-dark text-[15px] mb-0.5"},Qe={class:"text-sm text-secondary leading-snug"},Xe={class:"grid md:grid-cols-2 gap-4 mb-10"},Ze=["onClick"],Ke={class:"relative text-xl font-semibold text-secondary-dark mb-1.5 group-hover:text-black transition-colors"},et={class:"relative text-sm text-secondary leading-relaxed"},tt={class:"absolute top-6 right-6 w-8 h-8 rounded-full bg-gray-100 group-hover:bg-secondary-dark flex items-center justify-center transition-all duration-300"},st={class:"flex flex-col md:flex-row md:items-start gap-3 md:gap-4"},ot={class:"flex-shrink-0"},at={class:"flex-1 min-w-0 pr-6 md:pr-8"},nt={key:0,class:"mt-3 inline-flex items-center gap-2"},rt={class:"flex items-center justify-center w-5 h-5 rounded-full bg-amber-500 text-white text-[10px] font-bold shadow-sm"},it={class:"text-sm font-medium text-amber-600"},lt={class:"absolute top-5 right-5 md:top-6 md:right-6 w-8 h-8 rounded-full bg-gray-100 group-hover:bg-secondary-dark flex items-center justify-center transition-all duration-300"},ct=ie({__name:"index",setup(dt){const N=ge();le({title:"Get Started",description:"Create your author or publisher profile on Beventi, or join a team to help manage an existing account.",robots:"noindex, nofollow"});const P=ce(),{managedTeams:y,user:I,allProfiles:W,hasSellerOrVendorProfile:D}=de(P),{profileTypes:B,returnUrl:M}=pe(),F=n=>{const s={type:n};M.value&&(s.returnUrl=M.value),J({path:"/start/profile",query:s})},w=g([]),$=g(!0),G=async()=>{try{$.value=!0;const n=await O.getPendingInvitations();w.value=n?.data||[]}catch(n){console.error("Failed to fetch pending invitations:",n),w.value=[]}finally{$.value=!1}};ue(()=>{G()});const V=d(()=>w.value.length>0),k=d(()=>w.value.length),x=g(!1),A=g(null),T=g(!1),R=d(()=>y.value.length>0),C=d(()=>y.value.length),q=d(()=>I.value?.is_admin===!0&&!D.value),H=g(I.value?.first_name||"there"),Q=d(()=>x.value?H.value:I.value?.first_name||"there"),X=d(()=>C.value<=3||T.value),Z=d(()=>X.value?y.value:y.value.slice(0,3)),Y=d(()=>Math.max(0,C.value-3)),K=async n=>{if(!x.value){x.value=!0,A.value=n;try{await P.switchToTeam(n),await J(M.value??"/dashboard")}catch(s){console.error("Failed to switch team:",s),x.value=!1,A.value=null}}},j=g(!1),m=g(null),U=g(!1),ee=d(()=>W.value.length>0),te=d(()=>y.value.length===1),se=d(()=>
1{if(!m.value)return"";const n=m.value.name;return te.value&&!ee.value?`You'll no longer be able to manage "${n}". Since you don't have your own profile, you'll need to create one or join another team to continue using Beventi.`:`You'll no longer be able to manage "${n}". You can be re-invited later if needed.`}),oe=n=>{m.value=n,j.value=!0},ae=async()=>{if(!m.value)return;U.value=!0;const n=m.value.team_member_id,s=m.value.name;try{await O.leaveTeam(n),await P.refresh(),N.success(`You've left "${s}"`),j.value=!1,m.value=null}catch(v){console.error("Failed to leave team:",v),N.error(v?.data?.message||"Failed to leave team. Please try again.")}finally{U.value=!1}},ne=n=>n.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2),re=n=>{const s=["bg-amber-500","bg-rose-500","bg-violet-500","bg-cyan-500","bg-emerald-500","bg-orange-500","bg-pink-500","bg-indigo-500"],v=n.split("").reduce((o,p)=>o+p.charCodeAt(0),0);return s[v%s.length]};return(n,s)=>{const v=me;return r(),i(b,null,[a(E,{appear:"","enter-active-class":"transition-all duration-500 ease-out","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0"},{default:u(()=>[e("div",we,[e("div",ke,[t(q)?(r(),i("div",Te,[e("div",Ce,[s[4]||(s[4]=e("div",{class:"min-w-0"},[e("p",{class:"text-sm font-semibold text-violet-900"},"Admin access"),e("p",{class:"mt-1 text-sm text-violet-700"}," You can open the admin area without creating an author or vendor profile. ")],-1)),a(v,{to:"/admin",class:"inline-flex shrink-0 items-center justify-center gap-2 rounded-lg bg-violet-900 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-violet-800"},{default:u(()=>[a(t(c),{icon:["fal","shield-user"],class:"text-xs"}),s[3]||(s[3]=_(" Admin ",-1))]),_:1})])])):h("",!0),t(R)?(r(),i(b,{key:1},[e("div",je,[s[5]||(s[5]=e("p",{class:"text-secondary text-sm tracking-wide uppercase mb-2"},"Welcome back",-1)),e("h1",Se,l(t(Q)),1)]),t(V)?(r(),i("div",Pe,[a(v,{to:"/team/join",class:"group inline-flex items-center gap-2 text-sm"},{default:u(()=>[e("span",Ie,l(t(k)),1),e("span",Me," Pending team invitation"+l(t(k)>1?"s":""),1),a(t(c),{icon:["fal","arrow-right"],class:"text-xs text-secondary group-hover:text-secondary-dark group-hover:translate-x-0.5 transition-all"})]),_:1})])):h("",!0),e("div",$e,[e("div",Ae,[e("div",Le,[s[6]||(s[6]=e("p",{class:"text-xs font-medium text-secondary uppercase tracking-wider"},"Your Teams",-1)),e("span",Ne,l(t(C)),1)]),a(v,{to:"/team/join",class:"text-xs font-semibold text-secondary-dark hover:text-black transition-colors"},{default:u(()=>[...s[7]||(s[7]=[_(" + Join team ",-1)])]),_:1})]),e("div",Be,[a(ve,{"enter-active-class":"transition-all duration-300","enter-from-class":"opacity-0 -translate-y-2","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:u(()=>[(r(!0),i(b,null,L(t(Z),o=>(r(),i("div",{key:o.id,class:f(["group relative w-full flex items-center gap-3 p-3 rounded-xl bg-white border border-gray-200 hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm transition-all",{"opacity-60 cursor-not-allowed":t(x)}])},[e("button",{onClick:p=>K(o.id),disabled:t(x),class:"absolute inset-0 w-full h-full cursor-pointer disabled:cursor-not-allowed","aria-label":"Switch to team"},null,8,Fe),e("div",{class:f([[re(o.name)],"flex-shrink-0 w-9 h-9 rounded-lg flex items-center justify-center text-white text-xs font-semibold shadow-sm"])},l(ne(o.name)),3),e("div",Ve,[e("p",Ye,l(o.name),1),e("p",Ue,l({admin:"Admin",member:"Member",viewer:"Viewer",assistant:"Assistant"}[o.role]||o.role),1)]),a(t(he),{as:"div",class:"relative z-10 flex-shrink-0"},{default:u(()=>[a(t(be),{onClick:s[0]||(s[0]=z(()=>{},["stop"])),class:"w-7 h-7 rounded-full flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-200 transition-all"},{default:u(()=>[a(t(c),{icon:["fal","ellipsis-vertical"],class:"text-sm"})]),_:1}),a(E,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:u(()=>[a(t(ye),{class:"absolute right-0 mt-1 w-36 origin-top-right rounded-lg bg-white shadow-lg ring-1 ring-black/5 focus:outline-none z-50"},{default:u(()=>[e("div",ze,[a(t(_e),null,{default:u(({active:p})=>[e("button",{onClick:z(ut=>oe(o),["stop"]),class:f([p?"bg-red-50":"","w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600"])},[a(t(c),{icon:["fal","right-from-bracket"],class:"text-xs"}),s[8]||(s[8]=_(" Leave team ",-1))],10,Ee)]),_:2},1024)])]),_:2},1024)]),_:2},1024)]),_:2},1024),e("div",Je,[t(x)&&t(A)===o.id?(r(),S(t(c),{key:0,icon:["fal","spinner-third"],class:"text-xs text-gray-400 animate-spin"})):(r(),S(t(c),{key:1,icon:["fal","arrow-right"],class:"text-xs text-gray-400 group-hover:text-white transition-colors"}))])],2))),128))]),_:1}),t(C)>3?(r(),i("button",{key:0,onClick:s[1]||(s[1]=o=>T.value=!t(T)),class:"w-full py-2.5 text-center text-xs font-medium text-secondary hover:text-secondary-dark transition-colors"},[t(T)?(r(),i("span",We,[s[9]||(s[9]=_(" Show less ",-1)),a(t(c),{icon:["fal","chevron-up"],class:"ml-1"})])):(r(),i("span",Oe,[_(" Show "+l(t(Y))+" more team"+l(t(Y)>
11?"s":"")+" ",1),a(t(c),{icon:["fal","chevron-down"],class:"ml-1"})]))])):h("",!0)])]),s[10]||(s[10]=e("div",{class:"relative my-8"},[e("div",{class:"absolute inset-0 flex items-center"},[e("div",{class:"w-full border-t border-gray-200"})]),e("div",{class:"relative flex justify-center"},[e("span",{class:"bg-gray-50 px-3 text-xs text-secondary uppercase tracking-wider"},"or create your own")])],-1)),e("div",null,[e("div",De,[(r(!0),i(b,null,L(t(B),o=>(r(),i("button",{key:o.id,onClick:p=>F(o.id),class:"group relative text-left p-5 rounded-2xl border border-gray-200 bg-white hover:border-gray-300 hover:shadow-md transition-all duration-300"},[e("div",{class:f([["bg-gradient-to-br opacity-0 group-hover:opacity-100 transition-opacity duration-300",o.gradient],"absolute inset-0 rounded-2xl pointer-events-none"])},null,2),e("div",Re,[e("div",{class:f([[o.iconColor],"flex-shrink-0 w-10 h-10 rounded-xl bg-gray-50 group-hover:bg-white/80 flex items-center justify-center transition-colors"])},[a(t(c),{icon:["fal",o.icon],class:"text-lg"},null,8,["icon"])],2),e("div",qe,[e("h3",He,l(o.title),1),e("p",Qe,l(o.description),1)]),a(t(c),{icon:["fal","arrow-right"],class:"flex-shrink-0 text-gray-300 group-hover:text-gray-500 group-hover:translate-x-0.5 transition-all mt-1"})])],8,Ge))),128))])])],64)):(r(),i(b,{key:2},[s[13]||(s[13]=e("div",{class:"text-center mb-10"},[e("h1",{class:"font-display text-3xl lg:text-4xl text-secondary-dark leading-tight mb-3"}," Create your profile "),e("p",{class:"text-secondary"}," Choose how you'll use Beventi ")],-1)),e("div",Xe,[(r(!0),i(b,null,L(t(B),o=>(r(),i("button",{key:o.id,onClick:p=>F(o.id),class:"group relative text-left p-6 rounded-2xl border border-gray-200 bg-white hover:border-gray-300 hover:shadow-lg transition-all duration-300 overflow-hidden"},[e("div",{class:f([["bg-gradient-to-br opacity-0 group-hover:opacity-100 transition-opacity duration-300",o.gradient],"absolute inset-0 rounded-2xl pointer-events-none"])},null,2),e("div",{class:f([[o.iconColor],"relative mb-4"])},[a(t(c),{icon:["fal",o.icon],class:"text-2xl"},null,8,["icon"])],2),e("h3",Ke,l(o.title),1),e("p",et,l(o.description),1),e("div",tt,[a(t(c),{icon:["fal","arrow-right"],class:"text-xs text-gray-400 group-hover:text-white transition-colors"})])],8,Ze))),128))]),t($)?h("",!0):(r(),S(v,{key:0,to:"/team/join",class:"group relative block p-5 md:p-6 rounded-2xl border border-gray-200 bg-gradient-to-br from-gray-50/80 to-white hover:border-gray-300 hover:shadow-md transition-all duration-300 overflow-hidden"},{default:u(()=>[e("div",st,[e("div",ot,[a(t(c),{icon:["fal","users"],class:"text-2xl text-gray-400 group-hover:text-gray-600 transition-colors"})]),e("div",at,[s[11]||(s[11]=e("h3",{class:"font-semibold text-secondary-dark mb-1 group-hover:text-black transition-colors"}," Managing someone else's account? ",-1)),s[12]||(s[12]=e("p",{class:"text-sm text-secondary leading-relaxed"}," Assistants don't need their own profile. Join a team to help manage an author or publisher account. ",-1)),t(V)?(r(),i("div",nt,[e("span",rt,l(t(k)),1),e("span",it," Pending invitation"+l(t(k)>1?"s":""),1)])):h("",!0)]),e("div",lt,[a(t(c),{icon:["fal","arrow-right"],class:"text-xs text-gray-400 group-hover:text-white transition-colors"})])])]),_:1}))],64))])])]),_:1}),t(j)?(r(),S(fe,{key:0,title:`Leave ${t(m)?.name}?`,text:t(se),onConfirm:ae,onClose:s[2]||(s[2]=o=>{j.value=!1,m.value=null})},null,8,["title","text"])):h("",!0)],64)}}}),Mt=xe(ct,[["__scopeId","data-v-d1717607"]]);export{Mt as default};
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.