1import{_ as D,r as v,c as a,d as r,f as $,e,t as i,h,g as m,i as I,C as N,F as f,k as B,w as E,l as w,G as Z}from"./app-Ctvx_saG.js";import{_ as O}from"./AppHead-CtSB0Yeg.js";import{P as L}from"./PagesLeftSidebar-BeyufIxg.js";import"./floatingChatHelper-btbz5wWc.js";import"./ChatPicker-CRVak1Zr.js";const H={class:"main__inner relative",style:{"max-width":"none !important",width:"100% !important"}},q={class:"settings-wrapper"},G={class:"settings-container"},J={class:"settings-header"},z={class:"text-2xl font-bold text-white mb-2"},K=["href"],Q={key:0,class:"success-alert"},W={key:1,class:"error-alert"},X={key:2,class:"info-card"},Y={class:"mod-card"},ee={class:"space-y-4"},se={class:"relative"},te={key:0,class:"search-dropdown"},oe=["onClick"],ae=["src","alt"],re={class:"search-result-name"},ne=["disabled"],le={key:0,class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},ie={key:1},de={key:2},ue={class:"mod-card"},me={class:"mod-card-header"},ce={class:"mod-card-title"},ve={key:0,class:"mod-list"},he={class:"mod-item-info"},pe=["src","alt"],ge={class:"mod-details"},ke={class:"mod-name"},be={key:0,class:"creator-badge"},_e={key:1,class:"mod-badge"},fe={class:"mod-meta"},we=["onClick"],ye={key:1,class:"empty-state"},Me={class:"modal-body"},Ce={class:"text-slate-300"},xe={class:"text-white"},$e={class:"modal-footer"},Be=["disabled"],Ze={__name:"Members",props:{page:Object,members:Object,is_creator:Boolean,user:Object},setup(n){const p=n,l=v({username:"",user_id:null}),c=v([]),g=v(!1),b=v(!1),k=v(""),d=v({show:!1,member:null});let y=null;const j=async()=>{if(l.value.username.length<2){c.value=[];return}clearTimeout(y),y=setTimeout(async()=>{try{const t=await w.get("/api/pages/moderators/search-users",{params:{q:l.value.username}});c.value=t.data.users||[]}catch(t){console.error("Error searching users:",t),c.value=[]}},300)},R=t=>{l.value.username=t.name,l.value.user_id=t.id,c.value=[]},S=async()=>{var t,s;if(l.value.user_id){g.value=!0,k.value="";try{await w.post(`/p/${p.page.slug}/members/invite`,{user_id:l.value.user_id}),Z.reload({preserveScroll:!0}),l.value.username="",l.value.user_id=null}catch(u){console.error("Error inviting member:",u),k.value=((s=(t=u.response)==null?void 0:t.data)==null?void 0:s.message)||"Failed to invite member"}finally{g.value=!1}}},A=t=>{d.value.show=!0,d.value.member=t},_=()=>{d.value.show=!1,d.value.member=null},F=async()=>{var t,s;if(d.value.member){b.value=!0;try{await w.delete(`/p/${p.page.slug}/members/${d.value.member.id}`),Z.reload({preserveScroll:!0}),_()}catch(u){console.error("Error removing member:",u),k.value=((s=(t=u.response)==null?void 0:t.data)==null?void 0:s.message)||"Failed to remove member"}finally{b.value=!1}}},P=t=>!1,T=t=>t===p.page.creator_id||t===p.user.id?!1:p.is_creator,U=t=>new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});return(t,s)=>{var u,M,C,x;return a(),r(f,null,[$(O,{title:`Members - /p/${n.page.slug}`},null,8,["title"]),e("div",H,[$(L,{user:n.user},null,8,["user"]),e("div",q,[e("div",G,[e("div",J,[e("div",null,[e("h1",z,"Page Members - /p/"+i(n.page.slug),1),s[2]||(s[2]=e("p",{class:"text-slate-400 text-sm"},"Manage members who can access this private page",-1))]),e("a",{href:`/p/${n.page.slug}`,class:"back-button"},s[3]||(s[3]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})],-1),h(" Back to Page ")]),8,K)]),(u=t.$page.props.flash)!=null&&u.message?(a(),r("div",Q,[s[4]||(s[4]=e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})],-1)),h(" "+i(t.$page.props.flash.message),1)])):m("",!0),(M=t.$page.props.flash)!=null&&M.error||k.value?(a(),r("div",W,[s[5]||(s[5]=e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75
1a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})],-1)),h(" "+i(t.$page.props.flash.error||k.value),1)])):m("",!0),n.page.is_private?(a(),r("div",X,s[6]||(s[6]=[e("svg",{class:"info-icon",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})],-1),e("div",null,[e("strong",null,"Private Page"),e("p",null,"Only invited members can view this page's content. Use the form below to invite new members.")],-1)]))):m("",!0),e("div",Y,[s[9]||(s[9]=e("h2",{class:"mod-card-title"},"Invite Member",-1)),e("div",ee,[e("div",se,[s[7]||(s[7]=e("label",{class:"mod-label"},"Search Username",-1)),I(e("input",{"onUpdate:modelValue":s[0]||(s[0]=o=>l.value.username=o),type:"text",class:"mod-input",placeholder:"Type username to invite...",onInput:j},null,544),[[N,l.value.username]]),c.value.length>0?(a(),r("div",te,[(a(!0),r(f,null,B(c.value,o=>(a(),r("button",{key:o.id,onClick:V=>R(o),class:"search-result-item"},[e("img",{src:o.avatar||`https://ui-avatars.com/api/?name=${o.name}&background=random`,alt:o.name,class:"search-result-avatar"},null,8,ae),e("span",re,i(o.name),1)],8,oe))),128))])):m("",!0)]),e("button",{onClick:S,disabled:!l.value.user_id||g.value,class:"mod-button mod-button-primary"},[g.value?m("",!0):(a(),r("svg",le,s[8]||(s[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"},null,-1)]))),g.value?(a(),r("span",ie,"Inviting...")):(a(),r("span",de,"Invite Member"))],8,ne)])]),e("div",ue,[e("div",me,[e("h2",ce,"Members ("+i(((C=n.members.data)==null?void 0:C.length)||0)+")",1)]),n.members.data&&n.members.data.length>0?(a(),r("div",ve,[(a(!0),r(f,null,B(n.members.data,o=>(a(),r("div",{key:o.id,class:"mod-item"},[e("div",he,[e("img",{src:o.avatar||`https://ui-avatars.com/api/?name=${o.name}&background=random`,alt:o.name,class:"mod-avatar"},null,8,pe),e("div",ge,[e("div",ke,[h(i(o.name)+" ",1),n.page.creator_id===o.id?(a(),r("span",be,"Creator")):P(o.id)?(a(),r("span",_e,"Moderator")):m("",!0)]),e("div",fe," Joined "+i(U(o.pivot.created_at)),1)])]),T(o.id)?(a(),r("button",{key:0,onClick:V=>A(o),class:"mod-button-icon mod-button-danger"},s[10]||(s[10]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M22 10.5h-6m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM4 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 10.374 21c-2.331 0-4.512-.645-6.374-1.766Z"})],-1)]),8,we)):m("",!0)]))),128))])):(a(),r("div",ye,s[11]||(s[11]=[e("svg",{class:"empty-icon",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z"})],-1),e("p",null,"No members yet",-1)])))])])])]),d.value.show?(a(),r("div",{key:0,class:"modal-overlay",onClick:_},[e("div",{class:"modal-content",onClick:s[1]||(s[1]=E(()=>{},["stop"]))},[e("div",{class:"modal-header"},[s[13]||(s[13]=e("h3",{class:"modal-title"},"Remove Member",-1)),e("button",{onClick:_,class:"modal-close"},s[12]||(s[12]=[e("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18
118 6M6 6l12 12"})],-1)]))]),e("div",Me,[e("p",Ce,[s[14]||(s[14]=h(" Are you sure you want to remove ")),e("strong",xe,i((x=d.value.member)==null?void 0:x.name),1),s[15]||(s[15]=h(" from this page? "))])]),e("div",$e,[e("button",{onClick:_,class:"mod-button mod-button-secondary"}," Cancel "),e("button",{onClick:F,disabled:b.value,class:"mod-button mod-button-danger"},i(b.value?"Removing...":"Remove Member"),9,Be)])])])):m("",!0)],64)}}},Pe=D(Ze,[["__scopeId","data-v-e2ed605b"]]);export{Pe 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.