PageSourceSearch

https://erobella.com/_nuxt/BsTFuBMi.js

js erobella.com collected 2026-09-24 10:05:00 UTC 340,511 bytes, 5 lines download raw bytes

1import{r as I,P as ms,$ as ae,E as ee,dl as Is,dm as ct,N as Rs,Z as ht,a8 as ue,O as Pt,d as je,c as R,q as ze,v as Qe,o as i,a,j as s,m as X,n as J,K as Ie,b5 as Oe,l as k,Q as Y,R as he,e as O,t as b,B as ke,k as Me,aO as jt,aV as Je,L as os,a2 as lt,F as Fe,az as Us,a0 as vt,b as pe,aG as Tt,V as Ps,W as Ns,b4 as Mt,w as Ne,M as ys,ai as Fs,z as Os,aE as Yt,aI as Gs,a4 as Ls,aF as Kt}from"./-6Lls737.js";import{_ as Vt}from"./C2j6UuSi.js";import{_ as Ve}from"./C9IHJtY7.js";import{C as Ds,M as zs,_ as Bs,a as Hs}from"./jKrhmY4U.js";import{u as _s}from"./DkMiOBSJ.js";import{b as Ws,u as ws}from"./CXnfTPfL.js";import{H as Xt}from"./DmcX-yy6.js";import"./B5spvOTL.js";import"./DSV61gAW.js";import"./DlAUqK2U.js";import"./B-WMGmDU.js";import"./BjgMM6IP.js";import"./DekfMc5K.js";let Lt=null,Dt="",zt=!1;const es=()=>{const t=I(typeof window<"u"&&"Notification"in window?Notification.permission:"default"),e=async()=>{if(typeof window>"u"||!("Notification"in window))return!1;if(t.value==="granted")return!0;if(t.value!=="denied"){const _=await Notification.requestPermission();return t.value=_,_==="granted"}return!1},o=_=>{if(typeof window>"u"||zt)return;Dt=document.title,zt=!0;let y=!0;Lt=setInterval(()=>{document.title=y?`🔔 ${_}`:Dt,y=!y},1e3);const x=()=>{document.hidden||(r(),document.removeEventListener("visibilitychange",x))};document.addEventListener("visibilitychange",x);const M=()=>{r(),window.removeEventListener("focus",M),window.removeEventListener("click",M)};window.addEventListener("focus",M),window.addEventListener("click",M)},r=()=>{Lt&&(clearInterval(Lt),Lt=null),Dt&&zt&&(document.title=Dt),zt=!1},n=(_,y={})=>typeof window>"u"||t.value!=="granted"?(typeof window<"u"&&document.hidden&&o(_),null):(document.hidden&&o(_),new Notification(_,{icon:"/favicon.ico",badge:"/favicon.ico",requireInteraction:!0,...y})),l=(_,y)=>{const x=n(`New message from ${_.punter_username}`,{body:`To ${_.girl_username}: ${_.preview||"New message"}`,tag:`new-message-${_.conversation_id}-${Date.now()}`});return x&&y&&(x.onclick=()=>{window.focus(),r(),y(_.girl_id,_.conversation_id),x.close()}),x},u=(_,y)=>{const x=n(`${_.punter_username} opened your message`,{body:`${_.girl_username}'s conversation - Sales opportunity!`,tag:`message-seen-${_.conversation_id}-${Date.now()}`});return x&&y&&(x.onclick=()=>{window.focus(),r(),y(_.girl_id,_.conversation_id),x.close()}),x},v=(_,y)=>{const x=n(`Content unlocked - ${_.amount} credits!`,{body:`${_.punter_username} unlocked ${_.girl_username}'s content`,tag:`content-unlocked-${_.message_id}-${Date.now()}`});return x&&y&&(x.onclick=()=>{window.focus(),r(),y(_.girl_id,_.conversation_id),x.close()}),x},g=(_,y)=>{const x=n(`Tip received - ${_.amount} credits!`,{body:`${_.punter_username} tipped ${_.girl_username}`,tag:`tip-received-${_.message_id}-${Date.now()}`});return x&&y&&(x.onclick=()=>{window.focus(),r(),y(_.girl_id,_.conversation_id),x.close()}),x},f=(_,y)=>{const x=_.gift_name?`${_.gift_name} · `:"",M=n(`Gift received - ${x}${_.amount} credits!`,{body:`${_.punter_username} sent ${_.girl_username} a gift`,tag:`gift-received-${_.message_id}-${Date.now()}`});return M&&y&&(M.onclick=()=>{window.focus(),r(),y(_.girl_id,_.conversation_id),M.close()}),M};return{permission:t,requestPermission:e,show:n,showNewMessage:l,showMessageSeen:u,showContentUnlocked:v,showTipReceived:g,showGiftReceived:f,showActivityNotification:(_,y)=>{switch(_.activity_type){case"new_message":return l(_.data,y);case"message_seen":return u(_.data,y);case"content_unlocked":return v(_.data,y);case"tip_received":return g(_.data,y);case"gift_received":return f(_.data,y);default:return null}},startTitleBlink:o,stopTitleBlink:r}},Vs="chatterCrm_saleSoundMuted";let ut=null;function qs(){if(!(typeof window>"u"))try{if(localStorage.getItem(Vs)==="1")return;const t=window.AudioContext||window.webkitAudioContext;if(!t)return;ut=ut||new t,ut.state==="suspended"&&ut.resume().catch(()=>{});const e=ut.currentTime,o=[[1046.5,0],[1567.98,.09]];for(const[r,n]of o){const l=ut.createOscillator(),u=ut.createGain();l.type="triangle",l.frequency.value=r,u.gain.setValueAtTime(1e-4,e+n),u.gain.exponentialRampToValueAtTime(.12,e+n+.015),u.gain.exponentialRampToValueAtTime(1e-4,e+n+.35),l.connect(u),u.connect(ut.destination),l.start(e+n),l.stop(e+n+.4)}}catch{}}const et=5*1024*1024,ns=10*1024*1024,is=3,rs=1e3,Bt=3,le=()=>{const e=ms().public.apiOriginUrl,o=async()=>{var c;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.GIRLS);if(m||d)throw m||d;return p&&Array.isArray(p.data)?p:p!=null&&p.results&&Array.isArray(p.results)?{data:p.results}:(c=p==null?void 0:p.results)!=null&&c.data&&Array.isArray(p.results.data)?{data:p.results.data}:{data:[]}},r=async(p,m,d=1,c=30,h)=>{var we,me;let S=ee.CHATTER_CRM.GIRL_CONVERSATIONS(p,m);const U=new URLSearchParams;U.append("page",String(d)),U.append("per_page",String(c)),h&&h.trim()!==""&&U.append("search",h.trim());const B=S.includes("?")?"&":"?";S+=B+U.toString();const{response:Q,error:ce,errors:q}=await ae(S);if(ce||q)throw ce||q;const ve=(Q==null?void 0:Q.meta)??null;return Q&&Array.isArray(Q.data)?{data:Q.data,meta:ve}:(we=Q==null?void 0:Q.data)!=null&&we.data&&Array.isArray(Q.data.data)?{data:Q.data.data,meta:ve}:Q!=null&&Q.results&&Array.isArray(Q.results)?{data:Q.results,meta:ve}:(me=Q==null?void 0:Q.results)!=null&&me.data&&Array.isArray(Q.results.data)?{data:Q.results.data,meta:ve}:Array.isArray(Q)?{data:Q,meta:ve}:{data:[],meta:ve}},n=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.GIRL_STORE_CONVERSATION(p),{method:"POST",body:{recipient_id:m,message:d}});if(h||S)throw h||S;return c},l=async(p,m,d,c)=>{var ve,we,me,xe;let h=ee.CHATTER_CRM.MESSAGES.LIST(p,m);const S=[];d&&S.push(`last_message_id=${d}`),c&&S.push(`page_size=${c}`),S.length&&(h+=`?${S.join("&")}`);const{response:U,error:B,errors:Q}=await ae(h);if(B||Q)throw B||Q;const ce=Array.isArray((ve=U==null?void 0:U.data)==null?void 0:ve.data)?U.data.data:Array.isArray(U==null?void 0:U.data)?U.data:Array.isArray((we=U==null?void 0:U.results)==null?void 0:we.data)?U.results.data:Array.isArray(U==null?void 0:U.results)?U.results:[],q=(U==null?void 0:U.meta)||((me=U==null?void 0:U.data)==null?void 0:me.meta)||((xe=U==null?void 0:U.results)==null?void 0:xe.meta)||{};return{data:ce,meta:{blocked:q.blocked??!1,conversation_id:q.conversation_id??m,total_count:q.total_count??q.total??ce.length}}},u=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.MESSAGES.SEND(p,m),{method:"POST",body:{content:d}});if(h||S)throw h||S;return c},v=async(p,m,d,c,h)=>{const S=await Promise.all(d.map(async ce=>({name:ce.name,type:ce.type,size:ce.size,data:await Is(ce)}))),{response:U,error:B,errors:Q}=await ae(ee.CHATTER_CRM.MESSAGES.SEND_IMAGES(p,m),{method:"POST",body:{price:c,content:h||"",images:S}});if(B||Q)throw B||Q;return U},g=async(p,m,d)=>{var c;try{const h=Math.ceil(d.size/et);return{data:await ct(`${e}${ee.CHATTER_CRM.MESSAGES.INIT_CHUNKED(p,m)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:d.name,fileSize:d.size,mimeType:d.type,totalChunks:h,chunkSize:et})}),error:null}}catch(h){return console.error("Init message chunked upload error:",h),{data:null,error:{message:((c=h==null?void 0:h.data)==null?void 0:c.message)||(h==null?void 0:h.message)||"Failed to initialize upload"}}}},f=async(p,m,d,c,h,S=0)=>{var U;try{const B=new FormData;return B.append("chunk",h),B.append("chunkIndex",c.toString()),B.append("sessionId",d),{data:await ct(`${e}${ee.CHATTER_CRM.MESSAGES.UPLOAD_CHUNK(p,m)}`,{method:"POST",credentials:"include",body:B}),error:null}}catch(B){return console.error(`Message chunk ${c} upload error (attempt ${S+1}):`,B),S<is?(await new Promise(Q=>setTimeout(Q,rs*(S+1))),f(p,m,d,c,h,S+1)):{data:null,error:{message:((U=B==null?void 0:B.data)==null?void 0:U.message)||`Failed to upload chunk ${c}`,chunkIndex:c}}}},C=async(p,m,d,c,h,S)=>{if(d.size<=ns){const me=new FormData;me.append("videos[]",d),me.append("price",String(c)),me.append("content",h||"");try{return await ct(`${e}${ee.CHATTER_CRM.MESSAGES.SEND_VIDEOS(p,m)}`,{method:"POST",credentials:"include",body:me})}catch(xe){throw console.error("Small video upload error:",xe),(xe==null?void 0:xe.data)||xe}}const U=await g(p,m,d);if(U.error||!U.data)throw U.error||new Error("Failed to initialize upload");const B=U.data,Q=Math.ceil(d.size/et),ce=new Set,q=new Map,ve=async me=>
1{const xe=me*et,Xe=Math.min(xe+et,d.size),ft=d.slice(xe,Xe),it=await f(p,m,B.session_id,me,ft);if(it.error)q.set(me,it.error);else if(ce.add(me),S){const bt=Math.round(ce.size/Q*90);S(bt)}};for(let me=0;me<Q;me+=Bt){const xe=[];for(let Xe=0;Xe<Bt&&me+Xe<Q;Xe++)xe.push(me+Xe);await Promise.all(xe.map(ve))}if(q.size>0){console.warn(`${q.size} chunks failed, retrying...`);for(const me of Array.from(q.keys())){const xe=me*et,Xe=Math.min(xe+et,d.size),ft=d.slice(xe,Xe);if((await f(p,m,B.session_id,me,ft)).error)throw new Error(`Upload failed at chunk ${me+1}/${Q}`);ce.add(me),S&&S(Math.round(ce.size/Q*90))}}if(ce.size!==Q)throw new Error(`Only ${ce.size}/${Q} chunks uploaded`);S&&S(95);const we=await ct(`${e}${ee.CHATTER_CRM.MESSAGES.SEND_VIDEOS_CHUNKED(p,m)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:B.session_id,content:h||"",price:c})});return S&&S(100),(we==null?void 0:we.data)||we},_=async(p,m,d,c,h,S=[],U=[])=>{const{response:B,error:Q,errors:ce}=await ae(ee.CHATTER_CRM.MESSAGES.FROM_REPOSITORY(p,m),{method:"POST",body:{repository_media_ids:d,price:c||0,content:h||"",gallery_photo_ids:S,gallery_video_ids:U}});if(Q||ce)throw Q||ce;return B},y=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_SEEN(p,m),{method:"PUT"});if(c||h)throw c||h;return d},x=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_UNSEEN(p,m),{method:"PUT"});if(c||h)throw c||h;return d},M=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_HIDE_CONVERSATION(p,m),{method:"DELETE"});if(c||h)throw c||h;return d},T=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.GIRL_VISIBILITY(p,m),{method:"PUT",body:{visible:d}});if(h||S)throw h||S;return c},w=async p=>{var h,S;const{response:m,error:d,errors:c}=await ae(ee.CHATTER_CRM.GIRL_HIDDEN_CONVERSATIONS(p));if(d||c)throw d||c;return m&&Array.isArray(m.data)?m:(h=m==null?void 0:m.data)!=null&&h.data&&Array.isArray(m.data.data)?{data:m.data.data}:m!=null&&m.results&&Array.isArray(m.results)?{data:m.results}:(S=m==null?void 0:m.results)!=null&&S.data&&Array.isArray(m.results.data)?{data:m.results.data}:Array.isArray(m)?{data:m}:{data:[]}},A=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_UNHIDE_CONVERSATION(p,m),{method:"PUT"});if(c||h)throw c||h;return d},E=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.MESSAGES.UNLOCK(p,m,d),{method:"POST"});if(h||S)throw h||S;return c},V=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.MESSAGES.DELETE(p,m,d),{method:"DELETE"});if(h||S)throw h||S;return c},de=async(p,m,d=1,c=50,h,S,U,B)=>{var it,bt;let Q=ee.CHATTER_CRM.MEDIA_REPOSITORY(p);const ce=new URLSearchParams;ce.append("page",String(d)),ce.append("per_page",String(c)),m&&ce.append("conversation_id",String(m)),h&&ce.append("type",h),S&&S.length>0&&ce.append("tag_ids",S.join(",")),U&&ce.append("favourites","1"),B&&B.trim()!==""&&ce.append("search",B.trim()),Q+="?"+ce.toString();const{response:q,error:ve,errors:we}=await ae(Q);if(ve||we)throw ve||we;const me=Array.isArray(q==null?void 0:q.data)?q.data:Array.isArray((it=q==null?void 0:q.results)==null?void 0:it.data)?q.results.data:Array.isArray(q==null?void 0:q.results)?q.results:Array.isArray(q)?q:[],xe=(q==null?void 0:q.meta)??((bt=q==null?void 0:q.results)==null?void 0:bt.meta)??null,Xe=(q==null?void 0:q.counts)??null,ft=(q==null?void 0:q.status_counts)??null;return{data:me,meta:xe,counts:Xe,statusCounts:ft}},W=async(p,m,d=1,c=50,h)=>{var me;let S=ee.CHATTER_CRM.MEDIA_REPOSITORY_GALLERY_CONTENT(p);const U=new URLSearchParams;U.append("page",String(d)),U.append("per_page",String(c)),m&&U.append("type",m),h&&U.append("conversation_id",String(h)),S+="?"+U.toString();const{response:B,error:Q,errors:ce}=await ae(S);if(Q||ce)throw Q||ce;const q=Array.isArray(B==null?void 0:B.data)?B.data:Array.isArray((me=B==null?void 0:B.results)==null?void 0:me.data)?B.results.data:Array.isArray(B==null?void 0:B.results)?B.results:Array.isArray(B)?B:[],ve=(B==null?void 0:B.counts)||{images:0,videos:0,total:0},we=(B==null?void 0:B.meta)||{current_page:d,per_page:c,last_page:1,total:q.length};return{data:q,counts:ve,meta:we}},te=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_DELETE(p,m),{method:"DELETE"});if(c||h)throw c||h;return d},L=async(p,m)=>{const{error:d,errors:c}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_REORDER(p),{method:"PUT",body:{media_ids:m}});if(d||c)throw d||c},F=async(p,m,d,c)=>{const{response:h,error:S,errors:U}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_UPDATE(p,m),{method:"PUT",body:{name:d,description:c}});if(S||U)throw S||U;
1return(h==null?void 0:h.data)||(h==null?void 0:h.results)||h},D=async(p,m,d)=>{const{error:c,errors:h}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_TAG_ATTACH(p,m),{method:"POST",body:{tag_id:d}});if(c||h)throw c||h},K=async(p,m,d)=>{const{error:c,errors:h}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_TAG_DETACH(p,m,d),{method:"DELETE"});if(c||h)throw c||h},H=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_FAVOURITE(p,m),{method:"POST"});if(c||h)throw c||h;return!!(d!=null&&d.is_favourite)},Re=async(p,m)=>{var U;const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.NOTES.LIST(p,m));if(c||h)throw c||h;return{data:Array.isArray(d==null?void 0:d.data)?d.data:Array.isArray((U=d==null?void 0:d.results)==null?void 0:U.data)?d.results.data:Array.isArray(d==null?void 0:d.results)?d.results:[]}},_e=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.NOTES.CREATE(p,m),{method:"POST",body:{content:d}});if(h||S)throw h||S;return(c==null?void 0:c.data)||(c==null?void 0:c.results)||c},Se=async(p,m,d,c)=>{const{response:h,error:S,errors:U}=await ae(ee.CHATTER_CRM.NOTES.UPDATE(p,m,d),{method:"PUT",body:{content:c}});if(S||U)throw S||U;return(h==null?void 0:h.data)||(h==null?void 0:h.results)||h},z=async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.NOTES.DELETE(p,m,d),{method:"DELETE"});if(h||S)throw h||S;return c},oe=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.PUNTER_STATS(p,m));if(c||h)throw c||h;return(d==null?void 0:d.data)||(d==null?void 0:d.results)||d},ge=async(p,m,d,c,h,S=[],U=[],B)=>{const{response:Q,error:ce,errors:q}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_SEND_TO_USERS(p),{method:"POST",body:{repository_media_ids:m,recipient_user_ids:d,price:c||0,content:h||"",gallery_photo_ids:S,gallery_video_ids:U,source:B}});if(ce||q)throw ce||q;return(Q==null?void 0:Q.results)||(Q==null?void 0:Q.data)||Q},be=async(p,m,d,c,h,S=[],U=[],B)=>{const{response:Q,error:ce,errors:q}=await ae(ee.CHATTER_CRM.MEDIA_REPOSITORY_SEND_TO_CONVERSATIONS(p),{method:"POST",body:{repository_media_ids:m,conversation_ids:d,price:c||0,content:h||"",gallery_photo_ids:S,gallery_video_ids:U,source:B}});if(ce||q)throw ce||q;return(Q==null?void 0:Q.data)||(Q==null?void 0:Q.results)||Q},Ge=async p=>{var S;const{response:m,error:d,errors:c}=await ae(ee.CHATTER_CRM.PROFILE_VIEWERS(p));if(d||c)throw d||c;return{data:Array.isArray(m)?m:Array.isArray(m==null?void 0:m.data)?m.data:Array.isArray((S=m==null?void 0:m.results)==null?void 0:S.data)?m.results.data:Array.isArray(m==null?void 0:m.results)?m.results:[]}},Ae=async p=>{var U;const m=ee.CHATTER_CRM.GALLERY_SUBSCRIBERS(p),{response:d,error:c,errors:h}=await ae(m);if(c||h)throw c||h;return{data:Array.isArray(d)?d:Array.isArray(d==null?void 0:d.data)?d.data:Array.isArray((U=d==null?void 0:d.results)==null?void 0:U.data)?d.results.data:Array.isArray(d==null?void 0:d.results)?d.results:[]}},qe=async p=>{var U;const m=ee.CHATTER_CRM.ONLINE_PUNTERS(p),{response:d,error:c,errors:h}=await ae(m);if(c||h)throw c||h;return{data:Array.isArray(d)?d:Array.isArray(d==null?void 0:d.data)?d.data:Array.isArray((U=d==null?void 0:d.results)==null?void 0:U.data)?d.results.data:Array.isArray(d==null?void 0:d.results)?d.results:[]}},ne=async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.LOOKUP_USERS(p),{method:"POST",body:{identifiers:m}});if(c||h)throw c||h;return{data:(d==null?void 0:d.data)||[],not_found:(d==null?void 0:d.not_found)||[],blocked:(d==null?void 0:d.blocked)||[],inactive:(d==null?void 0:d.inactive)||[]}},Z=async(p,m)=>{if(m.length===0)return{};const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.BULK_ELIGIBILITY(p),{method:"POST",body:{user_ids:m}});if(c||h)throw c||h;return(d==null?void 0:d.data)||{}},Te=async(p,m)=>{var d;try{const c=new FormData;c.append("image",m);const h=await ct(`${e}${ee.CHATTER_CRM.MEDIA_REPOSITORY_UPLOAD_IMAGE(p)}`,{method:"POST",body:c,credentials:"include"});return{data:(h==null?void 0:h.data)||h,error:null}}catch(c){return console.error("Chatter image upload error:",c),{data:null,error:{message:((d=c==null?void 0:c.data)==null?void 0:d.message)||(c==null?void 0:c.message)||"Failed to upload image",status:(c==null?void 0:c.status)||(c==null?void 0:c.statusCode)}}}},se=async(p,m)=>{var d;try{const c=Math.ceil(m.size/et);return{data:(await ct(`${e}${ee.CHATTER_CRM.MEDIA_REPOSITORY_INIT_CHUNKED(p)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:m.name,fileSize:m.size,mimeType:m.type,totalChunks:c,chunkSize:et})})).data,error:null}}catch(c){return console.error("Init chunked upload error:",c),{data:null,error:{message:((d=c==null?void 0:c.data)==null?void 0:d.message)||(c==null?void 0:c.message)||"Failed to initialize upload"}}}},Ce=async(p,m,d,c,h=0)=>{var S;try{const U=new FormData;return U.append("chunk",c),U.append("chunkIndex",d.toString()),U.append("sessionId",m),{data:await ct(`${e}${ee.CHATTER_CRM.MEDIA_REPOSITORY_UPLOAD_CHUNK(p)}`,{method:"POST",credentials:"include",body:U}),error:null}}catch(U){return console.error(`Chunk ${d} upload error (attempt ${h+1}):`,U),h<is?(await new Promise(B=>setTimeout(B,rs*(h+1))),Ce(p,m,d,c,h+1)):{data:null,error:{message:((S=U==null?void 0:U.data)==null?void 0:S.message)||`Failed to upload chunk ${d}`,chunkIndex:d}}}},Ue=async(p,m)=>{var d;try{return{data:(await ct(`${e}
1${ee.CHATTER_CRM.MEDIA_REPOSITORY_FINALIZE(p)}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:m})})).data,error:null}}catch(c){return console.error("Finalize chunked upload error:",c),{data:null,error:{message:((d=c==null?void 0:c.data)==null?void 0:d.message)||"Failed to finalize upload"}}}};return{getGirls:o,getConversations:r,storeConversation:n,getMessages:l,sendMessage:u,sendImageMessage:v,sendVideoMessage:C,sendFromRepository:_,markAsSeen:y,markAsUnread:x,hideConversation:M,setGirlVisibility:T,getHiddenConversations:w,unhideConversation:A,unlockMessage:E,deleteMessage:V,getMediaRepository:de,getGalleryContent:W,deleteMediaFromRepository:te,reorderMedia:L,updateMediaMeta:F,attachMediaTag:D,detachMediaTag:K,toggleMediaFavourite:H,getNotes:Re,createNote:_e,updateNote:Se,deleteNote:z,getPunterStats:oe,sendMediaToUsers:ge,sendMediaToConversations:be,getProfileViewers:Ge,getGallerySubscribers:Ae,getOnlinePunters:qe,lookupUsers:ne,getBulkEligibility:Z,uploadImageToRepository:Te,uploadVideoToRepository:async(p,m,d)=>{if(m.size<=ns)try{return await new Promise(c=>{const h=new XMLHttpRequest,S=new FormData;S.append("video",m),h.upload.addEventListener("progress",U=>{if(U.lengthComputable&&d){const B=Math.round(U.loaded/U.total*100);d(B)}}),h.addEventListener("load",()=>{if(h.status>=200&&h.status<300)try{const U=JSON.parse(h.responseText);c({data:(U==null?void 0:U.data)||U,error:null})}catch{c({data:null,error:{message:"Failed to parse server response",status:h.status}})}else{let U={};try{U=h.responseText?JSON.parse(h.responseText):{}}catch{}c({data:null,error:{message:(U==null?void 0:U.message)||(U==null?void 0:U.error)||"Failed to upload video",status:h.status}})}}),h.addEventListener("error",()=>{c({data:null,error:{message:"Network error occurred",status:0}})}),h.open("POST",`${e}${ee.CHATTER_CRM.MEDIA_REPOSITORY_UPLOAD_VIDEO(p)}`),h.withCredentials=!0,h.send(S)})}catch(c){return console.error("Chatter video upload error:",c),{data:null,error:{message:(c==null?void 0:c.message)||"Failed to upload video",status:0}}}try{const c=await se(p,m);if(c.error||!c.data)return{data:null,error:c.error};const h=c.data,S=Math.ceil(m.size/et),U=new Set,B=new Map,Q=async q=>{const ve=q*et,we=Math.min(ve+et,m.size),me=m.slice(ve,we),xe=await Ce(p,h.upload_session_id,q,me);if(xe.error)B.set(q,xe.error);else if(U.add(q),d){const Xe=Math.round(U.size/S*90);d(Xe)}};for(let q=0;q<S;q+=Bt){const ve=[];for(let we=0;we<Bt&&q+we<S;we++)ve.push(q+we);await Promise.all(ve.map(Q))}if(B.size>0){console.warn(`${B.size} chunks failed, retrying...`);for(const q of Array.from(B.keys())){const ve=q*et,we=Math.min(ve+et,m.size),me=m.slice(ve,we);if((await Ce(p,h.upload_session_id,q,me)).error)return{data:null,error:{message:`Upload failed at chunk ${q+1}/${S}`}};U.add(q),d&&d(Math.round(U.size/S*90))}}if(U.size!==S)return{data:null,error:{message:`Only ${U.size}/${S} chunks uploaded`}};d&&d(95);const ce=await Ue(p,h.upload_session_id);return ce.error||!ce.data?{data:null,error:ce.error}:(d&&d(100),{data:ce.data,error:null})}catch(c){return console.error("Chunked upload error:",c),{data:null,error:{message:(c==null?void 0:c.message)||"Chunked upload failed",status:0}}}},getReminders:async()=>{var h;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.REMINDERS.LIST);if(m||d)throw m||d;return{data:Array.isArray(p==null?void 0:p.data)?p.data:Array.isArray((h=p==null?void 0:p.results)==null?void 0:h.data)?p.results.data:Array.isArray(p==null?void 0:p.results)?p.results:Array.isArray(p)?p:[]}},createReminder:async(p,m,d,c,h)=>{const{response:S,error:U,errors:B}=await ae(ee.CHATTER_CRM.REMINDERS.CREATE,{method:"POST",body:{girl_id:p,conversation_id:m,target_user_id:d,remind_at:c,note:h||null}});if(U||B)throw U||B;return(S==null?void 0:S.data)||(S==null?void 0:S.results)||S},completeReminder:async p=>{const{response:m,error:d,errors:c}=await ae(ee.CHATTER_CRM.REMINDERS.COMPLETE(p),{method:"PUT"});if(d||c)throw d||c;return m},deleteReminder:async p=>{const{response:m,error:d,errors:c}=await ae(ee.CHATTER_CRM.REMINDERS.DELETE(p),{method:"DELETE"});if(d||c)throw d||c;return m},getDueRemindersCount:async()=>{const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.REMINDERS.DUE_COUNT);if(m||d)throw m||d;return(p==null?void 0:p.count)??0},getGirlNotes:async p=>{var S;const{response:m,error:d,errors:c}=await ae(ee.CHATTER_CRM.GIRL_NOTES.LIST(p));if(d||c)throw d||c;return{data:Array.isArray(m==null?void 0:m.data)?m.data:Array.isArray((S=m==null?void 0:m.results)==null?void 0:S.data)?m.results.data:Array.isArray(m==null?void 0:m.results)?m.results:Array.isArray(m)?m:[]}},createGirlNote:async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_NOTES.CREATE(p),{method:"POST",body:{content:m}});if(c||h)throw c||h;return(d==null?void 0:d.data)||(d==null?void 0:d.results)||d},updateGirlNote:async(p,m,d)=>{const{response:c,error:h,errors:S}=await ae(ee.CHATTER_CRM.GIRL_NOTES.UPDATE(p,m),{method:"PUT",body:{content:d}});if(h||S)throw h||S;return(c==null?void 0:c.data)||(c==null?void 0:c.results)||c},deleteGirlNote:async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.GIRL_NOTES.DELETE(p,m),{method:"DELETE"});if(c||h)throw c||h;return d},getFavourites:async()=>{const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.FAVOURITES.LIST);if(m||d)throw m||d;return{girl_ids:(p==null?void 0:p.girl_ids)||[],punter_ids:(p==null?void 0:p.punter_ids)||[]}},toggleFavourite:async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.FAVOURITES.TOGGLE,{method:"POST",body:{favouriteType:p,favouriteUserId:m}});if(c||h)throw c||h;return{is_favourite:(d==null?void 0:d.is_favourite)??!1}},getActivities:async()=>{var h;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.ACTIVITIES.LIST);if(m||d)throw m||d;return{data:Array.isArray(p==null?void 0:p.data)?p.data:Array.isArray((h=p==null?void 0:p.results)==null?void 0:h.data)?p.results.data:Array.isArray(p==null?void 0:p.results)?p.results:Array.isArray(p)?p:[]}},getUnreadActivitiesCount:async()=>{var c;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.ACTIVITIES.UNREAD_COUNT);if(m||d)throw m||d;return((c=p==null?void 0:p.results)==null?void 0:c.count)??(p==null?void 0:p.count)??0},markActivityAsRead:async p=>{const{error:m,errors:d}=await ae(ee.CHATTER_CRM.ACTIVITIES.MARK_READ(p),{method:"POST"});if(m||d)throw m||d},markAllActivitiesAsRead:async()=>{const{error:p,errors:m}=await ae(ee.CHATTER_CRM.ACTIVITIES.MARK_ALL_READ,{method:"POST"});if(p||m)throw p||m},getPurchases:async()=>{var h;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.PURCHASES.LIST);if(m||d)throw m||d;return{data:Array.isArray(p==null?void 0:p.data)?p.data:Array.isArray((h=p==null?void 0:p.results)==null?void 0:h.data)?p.results.data:Array.isArray(p==null?void 0:p.results)?p.results:Array.isArray(p)?p:[]}},getUnreadPurchasesCount:async()=>{var c;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.PURCHASES.UNREAD_COUNT);if(m||d)throw m||d;return((c=p==null?void 0:p.results)==null?void 0:c.count)??(p==null?void 0:p.count)??0},markPurchaseAsRead:async p=>{const{error:m,errors:d}=await ae(ee.CHATTER_CRM.PURCHASES.MARK_READ(p),{method:"POST"});if(m||d)throw m||d},markAllPurchasesAsRead:async()=>{const{error:p,errors:m}=await ae(ee.CHATTER_CRM.PURCHASES.MARK_ALL_READ,{method:"POST"});if(p||m)throw p||m},getOnlineUnreadPunters:async()=>{var h;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.ONLINE_WITH_UNREAD.LIST);if(m||d)throw m||d;return{data:Array.isArray(p==null?void 0:p.data)?p.data:Array.isArray((h=p==null?void 0:p.results)==null?void 0:h.data)?p.results.data:Array.isArray(p==null?void 0:p.results)?p.results:Array.isArray(p)?p:[]}},getOnlineUnreadCount:async()=>{var c;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.ONLINE_WITH_UNREAD.COUNT);if(m||d)throw m||d;return((c=p==null?void 0:p.results)==null?void 0:c.count)??(p==null?void 0:p.count)??0},getTags:async()=>{var c;const{response:p,error:m,errors:d}=await ae(ee.CHATTER_CRM.TAGS.LIST);if(m||d)throw m||d;return Array.isArray(p==null?void 0:p.data)?p.data:Array.isArray((c=p==null?void 0:p.results)==null?void 0:c.data)?p.results.data:Array.isArray(p)?p:[]},createTag:async(p,m,d="both",c=!1)=>{const{response:h,error:S,errors:U}=await ae(ee.CHATTER_CRM.TAGS.CREATE,{method:"POST",body:{name:p,color:m,type:d,excluded_from_bulk:c}});if(S||U)throw S||U;
1return(h==null?void 0:h.data)??(h==null?void 0:h.results)??h},updateTag:async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.TAGS.UPDATE(p),{method:"PUT",body:m});if(c||h)throw c||h;return(d==null?void 0:d.data)??(d==null?void 0:d.results)??d},deleteTag:async p=>{const{error:m,errors:d}=await ae(ee.CHATTER_CRM.TAGS.DELETE(p),{method:"DELETE"});if(m||d)throw m||d},attachTag:async(p,m,d)=>{const{error:c,errors:h}=await ae(ee.CHATTER_CRM.CONVERSATION_TAGS.ATTACH(p,m),{method:"POST",body:{tag_id:d}});if(c||h)throw c||h},detachTag:async(p,m,d)=>{const{error:c,errors:h}=await ae(ee.CHATTER_CRM.CONVERSATION_TAGS.DETACH(p,m,d),{method:"DELETE"});if(c||h)throw c||h},getTaggedConversations:async(p,m=1,d=30,c,h)=>{var ve,we;const S=new URLSearchParams;S.append("tag_ids",p.join(",")),S.append("page",String(m)),S.append("per_page",String(d)),c&&c.trim()!==""&&S.append("search",c.trim()),h&&S.append("girl_id",String(h));const U=`${ee.CHATTER_CRM.TAGS.TAGGED_CONVERSATIONS}?${S.toString()}`,{response:B,error:Q,errors:ce}=await ae(U);if(Q||ce)throw Q||ce;const q=(B==null?void 0:B.meta)??null;return B&&Array.isArray(B.data)?{data:B.data,meta:q}:(ve=B==null?void 0:B.data)!=null&&ve.data&&Array.isArray(B.data.data)?{data:B.data.data,meta:q}:(we=B==null?void 0:B.results)!=null&&we.data&&Array.isArray(B.results.data)?{data:B.results.data,meta:q}:Array.isArray(B)?{data:B,meta:q}:{data:[],meta:q}},getTaggedGirls:async p=>{var B;const m=new URLSearchParams;m.append("tag_ids",p.join(","));const d=`${ee.CHATTER_CRM.TAGS.TAGGED_GIRLS}?${m.toString()}`,{response:c,error:h,errors:S}=await ae(d);if(h||S)throw h||S;const U=(c==null?void 0:c.data)??((B=c==null?void 0:c.results)==null?void 0:B.data)??c;return Array.isArray(U)?U.map(Q=>Number(Q)):[]},togglePunterDoNotBulk:async(p,m)=>{const{response:d,error:c,errors:h}=await ae(ee.CHATTER_CRM.TOGGLE_DO_NOT_BULK(p),{method:"PUT",body:{do_not_bulk:m}});if(c||h)throw c||h;const S=(d==null?void 0:d.data)??(d==null?void 0:d.results)??d;return!!((S==null?void 0:S.do_not_bulk)??m)}}};function $e(t){if(!t)return 0;const e=t.includes("T")?t:t.replace(" ","T")+"Z",o=new Date(e).getTime();return Number.isNaN(o)?0:o}const $t=5e3,xs=13,Ys=3e3,as="chatterCrm_openTabIds",ls="chatterCrm_closedTabIds",ds=5,cs=384,Ht=12,Ks=140,Xs=160,Js=160,Qs=1800,Zs=50,eo=3,us=7,to=180,hs="chatterCrm_openWindows",so=450,oo=300,no=8e3,at=30;function io(t){return t?typeof t.id=="number"?t:t.data&&typeof t.data.id=="number"?t.data:t.results&&typeof t.results.id=="number"?t.results:null:null}function ro(t){return String(t.id).length>=xs}const Ee=Rs("chatterCrm",{state:()=>({girls:[],selectedGirlId:null,openTabIds:[],closedTabIds:[],conversations:{},conversationsPage:{},conversationsHasMore:{},conversationsSearch:{},hiddenConversations:{},showingHiddenConversations:!1,selectedConversationId:null,messages:{},notes:{},girlNotes:{},punterStats:{},blockedConversationIds:{},tabCountedMsgIds:{},viewportWidth:0,punterStatsInFlight:0,girlUnreadCounts:{},girlLastActivityAt:{},reminders:[],dueRemindersCount:0,activities:[],unreadActivitiesCount:0,purchases:[],unreadPurchasesCount:0,onlineUnreadPunters:[],onlineUnreadCount:0,onlineUnreadRefetchTimer:null,onlineStatusListenerBound:!1,pendingPurchaseBumps:{},favouriteGirlIds:[],favouritePunterIds:[],pusherChatterChannel:null,loading:{girls:!1,conversations:!1,conversationsMore:!1,hiddenConversations:!1,messages:!1,sending:!1,loadingEarlier:!1,notes:!1,girlNotes:!1,punterStats:!1,reminders:!1,favourites:!1,activities:!1,purchases:!1,onlineUnread:!1,tags:!1,combined:!1,combinedMore:!1},error:null,pagination:{},pusherMessageChannels:{},typingChannelLru:[],typingChannelDebounce:null,typingUsers:{},preparingContentUsers:{},preparingContentIntervals:{},openWindows:{},windowOrder:[],focusedConversationId:null,windowConversations:{},convLoading:{},pendingFetch:{},saleFlashTimers:{},lastVideoReadyEvent:null,tags:[],activeTagFilterIds:[],tagFilterGirlIds:[],combinedRequestSeq:0,combinedConversations:[],combinedPage:1,combinedHasMore:!1,combinedSearch:"",punterDoNotBulk:{}}),getters:{selectedGirl:t=>t.selectedGirlId&&t.girls.find(e=>e.id===t.selectedGirlId)||null,visibleTabs:t=>{var r;const e=t.girls.filter(n=>
1n.id===t.selectedGirlId?!0:t.closedTabIds.includes(n.id)?!1:t.openTabIds.includes(n.id)||(t.girlUnreadCounts[n.id]??n.unread_count??0)>0),o=new Set;for(const n of t.onlineUnreadPunters)(r=n.girl)!=null&&r.id&&o.add(n.girl.id);return e.sort((n,l)=>{if(n.id===t.selectedGirlId)return-1;if(l.id===t.selectedGirlId)return 1;const u=o.has(n.id),v=o.has(l.id);if(u!==v)return u?-1:1;const g=t.girlLastActivityAt[n.id]||n.last_received_at||"",f=t.girlLastActivityAt[l.id]||l.last_received_at||"";if(g&&f){const y=$e(f)-$e(g);if(y!==0)return y}else{if(g)return-1;if(f)return 1}const C=t.girlUnreadCounts[n.id]??n.unread_count??0;return(t.girlUnreadCounts[l.id]??l.unread_count??0)-C})},onlineUnreadCountByGirl:t=>{var o;const e={};for(const r of t.onlineUnreadPunters){const n=(o=r.girl)==null?void 0:o.id;n&&(e[n]=(e[n]??0)+1)}return e},isTabOpen:t=>e=>t.openTabIds.includes(e)||e===t.selectedGirlId||(t.girlUnreadCounts[e]??0)>0,isTagFilterActive:t=>t.activeTagFilterIds.length>0,conversationTags:t=>t.tags.filter(e=>!e.type||e.type==="girls"||e.type==="both"),mediaTags:t=>t.tags.filter(e=>!e.type||e.type==="media"||e.type==="both"),currentConversations:t=>t.activeTagFilterIds.length>
10?t.combinedConversations:t.selectedGirlId?t.showingHiddenConversations?t.hiddenConversations[t.selectedGirlId]||[]:t.conversations[t.selectedGirlId]||[]:[],currentHiddenConversationsCount:t=>t.selectedGirlId?(t.hiddenConversations[t.selectedGirlId]||[]).length:0,currentConversation(){return this.selectedConversationId&&this.currentConversations.find(t=>t.id===this.selectedConversationId)||null},messagesFor:t=>e=>e==null?[]:t.messages[e]||[],conversationFor(){return t=>t==null?null:this.windowConversations[t]||this.findLoadedConversation(t)||null},notesFor:t=>e=>e==null?[]:t.notes[e]||[],girlFor(){return t=>{var r;if(t==null)return null;const e=this.openWindows[t],o=(e==null?void 0:e.girlId)??((r=this.conversationFor(t))==null?void 0:r.girl_id)??this.selectedGirlId;return o==null?null:this.girls.find(n=>n.id===o)||null}},currentMessages:t=>t.selectedConversationId?t.messages[t.selectedConversationId]||[]:[],isOtherUserTyping(){return t=>{const e=t??this.selectedConversationId;if(e==null)return!1;const o=this.typingUsers[e];if(!o)return!1;const r=Date.now();return Object.values(o).some(n=>r-n.timestamp<$t)}},isOtherUserPreparingContent(){return t=>{const e=t??this.selectedConversationId;if(e==null)return!1;const o=this.preparingContentUsers[e];if(!o)return!1;const r=Date.now();return Object.values(o).some(n=>r-n.timestamp<$t)}},currentNotes:t=>t.selectedConversationId?t.notes[t.selectedConversationId]||[]:[],hasOpenWindows:t=>t.windowOrder.length>0,openWindowPunterIds:t=>{var o,r,n;const e=new Set;for(const l of t.windowOrder){const u=t.openWindows[l];if(!u)continue;if(u.punterId){e.add(u.punterId);continue}const v=t.windowConversations[l];if(v){const g=((o=v.initiator_user)==null?void 0:o.id)===u.girlId?(r=v.recipient_user)==null?void 0:r.id:(n=v.initiator_user)==null?void 0:n.id;g&&e.add(g)}}return Array.from(e)},windowsSorted:t=>t.windowOrder.map(e=>t.openWindows[e]).filter(Boolean),windowCapacity(){if(!this.viewportWidth)return ds;const t=this.viewportWidth-Ks,e=Math.floor((t+Ht)/(cs+Ht));return Math.min(ds,Math.max(1,e))},bubbleCapacity(){if(!this.viewportWidth)return us;if(this.viewportWidth<Qs)return 0;const t=this.visibleWindows.length*(cs+Ht),e=this.viewportWidth-t-Js,o=Math.floor(e/(Xs+Ht));return Math.min(us,Math.max(1,o))},visibleWindows(){return this.windowsSorted.filter(t=>!t.minimized).slice(0,this.windowCapacity)},overflowWindows(){return this.windowsSorted.filter(t=>!t.minimized).slice(this.windowCapacity)},minimizedBubbles(){return this.windowsSorted.filter(t=>t.minimized)},visibleMinimizedBubbles(){return this.minimizedBubbles.slice(0,this.bubbleCapacity)},hiddenMinimizedBubbles(){return this.minimizedBubbles.slice(this.bubbleCapacity)},totalWindowUnread:t=>Object.values(t.openWindows).reduce((e,o)=>e+(o.unread||0),0),isPunterFavourite:t=>e=>t.favouritePunterIds.includes(e),isGirlFavourite:t=>e=>t.favouriteGirlIds.includes(e)},actions:{async fetchGirls(){var e;const t=le();this.loading.girls=!0,this.error=null;try{const o=await t.getGirls();this.girls=o.data;const r={...this.girlUnreadCounts};
1this.girls.forEach(l=>{r[l.id]===void 0&&(r[l.id]=l.unread_count??0)}),this.girlUnreadCounts=r,this.girls.forEach(l=>{this.bumpGirlActivity(l.id,l.last_received_at)}),this.restoreOpenTabs(),this.fetchFavourites(),this.fetchTags(),this.fetchUnreadActivitiesCount();const n=ht();(e=n.currentUser)!=null&&e.id&&this.subscribeToChatterChannel(n.currentUser.id)}catch{this.error="Failed to load girls"}finally{this.loading.girls=!1}},async selectGirl(t){const e=this.activeTagFilterIds.length>0,o=e&&this.tagFilterGirlIds.includes(t);this.unsubscribeFromMessageChannel(),this.selectedGirlId=t,this.selectedConversationId=null,this.openTab(t),o?await this.reloadCombined():e?await this.clearTagFilter():await this.fetchConversations(t)},async fetchConversations(t,e,o){var l;const r=le();this.loading.conversations=!0,this.error=null;const n=o!==void 0?o:this.conversationsSearch[t]??"";this.conversationsSearch={...this.conversationsSearch,[t]:n};try{const u=await r.getConversations(t,e,1,at,n);this.conversations={...this.conversations,[t]:u.data},this.conversationsPage={...this.conversationsPage,[t]:1};for(const C of u.data)this.windowConversations[C.id]&&(this.windowConversations={...this.windowConversations,[C.id]:C});const v=u.meta,g=v&&v.current_page!==void 0&&v.last_page!==void 0?v.current_page<v.last_page:u.data.length>=at;this.conversationsHasMore={...this.conversationsHasMore,[t]:g};let f=null;for(const C of u.data){const _=C.last_received_at;_&&(!f||$e(_)>$e(f))&&(f=_)}if(this.bumpGirlActivity(t,f),this.selectedConversationId){const C=(l=this.conversations[t])==null?void 0:l.find(_=>_.id===this.selectedConversationId);C&&(C.unseen_count=0)}this.applyPendingPurchaseBumps(t)}catch{this.error="Failed to load conversations"}finally{this.loading.conversations=!1}},async fetchMoreConversations(t){if(this.loading.conversations||this.loading.conversationsMore||!this.conversationsHasMore[t])return;const e=le(),o=(this.conversationsPage[t]??1)+1;this.loading.conversationsMore=!0;const r=this.conversationsSearch[t]??"";try{const n=await e.getConversations(t,void 0,o,at,r),l=this.conversations[t]??[],u=new Set(l.map(C=>C.id)),v=n.data.filter(C=>!u.has(C.id));this.conversations={...this.conversations,[t]:l.concat(v)},this.conversationsPage={...this.conversationsPage,[t]:o};const g=n.meta,f=g&&g.current_page!==void 0&&g.last_page!==void 0?g.current_page<g.last_page:n.data.length>=at;this.conversationsHasMore={...this.conversationsHasMore,[t]:f}}catch(n){console.error("Failed to load more conversations:",n)}finally{this.loading.conversationsMore=!1}},async fetchTags(){const t=le();this.loading.tags=!0;try{this.tags=await t.getTags()}catch{this.error="Failed to load tags"}finally{this.loading.tags=!1}},tagErrorMessage(t,e){var n,l,u,v,g,f;const o=(t==null?void 0:t.name)??((n=t==null?void 0:t.errors)==null?void 0:n.name)??((v=(u=(l=t==null?void 0:t.response)==null?void 0:l._data)==null?void 0:u.errors)==null?void 0:v.name);if(Array.isArray(o)&&o.length>0)return String(o[0]);const r=((f=(g=t==null?void 0:t.response)==null?void 0:g._data)==null?void 0:f.message)??(t==null?void 0:t.message);return typeof r=="string"&&r.trim()!==""&&!r.startsWith("[")?r:e},async createTag(t,e,o="both",r=!1){const n=le();try{const l=await n.createTag(t,e,o,r);return await this.fetchTags(),l}catch(l){return ue.error(this.tagErrorMessage(l,"Failed to create tag")),null}},async updateTag(t,e){const o=le();try{await o.updateTag(t,e),await this.fetchTags(),this.patchLoadedTag(t,e)}catch(r){ue.error(this.tagErrorMessage(r,"Failed to update tag"))}},async deleteTag(t){const e=le();try{await e.deleteTag(t),this.tags=this.tags.filter(o=>o.id!==t),this.stripTagFromLoadedConversations(t),this.activeTagFilterIds.includes(t)&&await this.applyTagFilterIds(this.activeTagFilterIds.filter(o=>o!==t))}catch{ue.error("Failed to delete tag")}},async togglePunterDoNotBulk(t,e){const o=le(),r=this.punterDoNotBulk[t];this.punterDoNotBulk={...this.punterDoNotBulk,[t]:e};try{const n=await o.togglePunterDoNotBulk(t,e);this.punterDoNotBulk={...this.punterDoNotBulk,[t]:n},this.patchLoadedPunterDoNotBulk(t,n)}catch{if(r===void 0){const l={...this.punterDoNotBulk};delete l[t],this.punterDoNotBulk=l}else this.punterDoNotBulk={...this.punterDoNotBulk,[t]:r};ue.error('Failed to update "do not bulk"')}},patchLoadedPunterDoNotBulk(t,e){var r;const o=n=>{var l,u;((l=n.initiator_user)==null?void 0:l.id)===t&&(n.initiator_user.do_not_bulk=e),((u=n.recipient_user)==null?void 0:u.id)===t&&(n.recipient_user.do_not_bulk=e)};
1Object.values(this.windowConversations).forEach(o),this.combinedConversations.forEach(o);for(const n of Object.keys(this.conversations))(r=this.conversations[Number(n)])==null||r.forEach(o)},async attachTagToConversation(t,e){const o=le(),r=this.conversationFor(t),n=(r==null?void 0:r.girl_id)??this.selectedGirlId;if(!n)return;const l=this.tags.find(u=>u.id===e);try{await o.attachTag(n,t,e),l&&this.forEachLoadedConversation(t,u=>{u.tags=u.tags??[],u.tags.some(v=>v.id===e)||(u.tags=[...u.tags,l])})}catch{ue.error("Failed to add tag")}},async removeTagFromConversation(t,e){const o=le(),r=this.conversationFor(t),n=(r==null?void 0:r.girl_id)??this.selectedGirlId;if(n)try{if(await o.detachTag(n,t,e),this.forEachLoadedConversation(t,l=>{l.tags&&(l.tags=l.tags.filter(u=>u.id!==e))}),this.activeTagFilterIds.length>0){const l=this.combinedConversations.find(v=>v.id===t);if(!((l==null?void 0:l.tags)??[]).some(v=>this.activeTagFilterIds.includes(v.id))){const v=(l==null?void 0:l.girl_id)??n;this.combinedConversations=this.combinedConversations.filter(f=>f.id!==t),this.selectedConversationId===t&&(this.unsubscribeFromMessageChannel(),this.selectedConversationId=null),this.combinedConversations.some(f=>f.girl_id===v)||(this.tagFilterGirlIds=this.tagFilterGirlIds.filter(f=>f!==v))}}}catch{ue.error("Failed to remove tag")}},async toggleTagFilter(t){const e=this.activeTagFilterIds.includes(t)?this.activeTagFilterIds.filter(o=>o!==t):[...this.activeTagFilterIds,t];await this.applyTagFilterIds(e)},async applyTagFilterIds(t){var v;const e=Array.from(new Set(t)).filter(g=>g>0);if(e.length===0){await this.clearTagFilter();return}const o=le();this.tags.length===0&&await this.fetchTags();const r=new Set(this.tags.map(g=>g.id)),n=e.filter(g=>r.has(g));if(n.length===0){await this.clearTagFilter();return}const l=++this.combinedRequestSeq;this.activeTagFilterIds=n,this.combinedSearch="",this.unsubscribeFromMessageChannel(),this.selectedConversationId=null,this.loading.combined=!0;let u;try{u=await o.getTaggedGirls(n)}catch{if(l!==this.combinedRequestSeq)return;this.loading.combined=!1,this.error="Failed to load tagged conversations",ue.error("Failed to load tagged conversations");return}if(l===this.combinedRequestSeq){if(this.tagFilterGirlIds=u,this.selectedGirlId===null||!u.includes(this.selectedGirlId)){const g=((v=this.girls.find(f=>u.includes(f.id)))==null?void 0:v.id)??u[0]??null;g!==null&&(this.selectedGirlId=g,this.openTab(g))}await this.reloadCombined(l)}},async reloadCombined(t){const e=t??++this.combinedRequestSeq;if(this.activeTagFilterIds.length===0){e===this.combinedRequestSeq&&(this.loading.combined=!1);return}if(this.tagFilterGirlIds.length===0||this.selectedGirlId===null||!this.tagFilterGirlIds.includes(this.selectedGirlId)){if(e!==this.combinedRequestSeq)return;this.combinedConversations=[],this.combinedHasMore=!1,this.combinedPage=1,this.loading.combined=!1;return}const o=le();this.combinedPage=1,this.loading.combined=!0;try{const r=await o.getTaggedConversations(this.activeTagFilterIds,1,at,this.combinedSearch,this.selectedGirlId);if(e!==this.combinedRequestSeq)return;this.combinedConversations=r.data,this.combinedHasMore=this.computeHasMore(r,r.data.length)}catch{if(e!==this.combinedRequestSeq)return;this.error="Failed to load tagged conversations",this.combinedConversations=[],this.combinedHasMore=!1}finally{e===this.combinedRequestSeq&&(this.loading.combined=!1)}},async searchCombined(t){this.activeTagFilterIds.length!==0&&(this.combinedSearch=t,await this.reloadCombined())},async fetchMoreCombined(){if(this.activeTagFilterIds.length===0||this.loading.combined||this.loading.combinedMore||!this.combinedHasMore||this.selectedGirlId===null||!this.tagFilterGirlIds.includes(this.selectedGirlId))return;const t=le(),e=++this.combinedRequestSeq,o=this.combinedPage+1;this.loading.combinedMore=!0;try{const r=await t.getTaggedConversations(this.activeTagFilterIds,o,at,this.combinedSearch,this.selectedGirlId);if(e!==this.combinedRequestSeq)return;const n=new Set(this.combinedConversations.map(u=>u.id)),l=r.data.filter(u=>!n.has(u.id));this.combinedConversations=this.combinedConversations.concat(l),this.combinedPage=o,this.combinedHasMore=this.computeHasMore(r,r.data.length)}catch(r){console.error("Failed to load more tagged conversations:",r)}finally{this.loading.combinedMore=!1}},async clearTagFilter(){const t=this.selectedGirlId;this.combinedRequestSeq++,this.activeTagFilterIds=[],this.tagFilterGirlIds=[],this.combinedConversations=[],this.combinedPage=1,this.combinedHasMore=!1,this.combinedSearch="",this.loading.combined=!1,this.loading.combinedMore=!1,t!==null&&await this.fetchConversations(t)},async openCombinedConversation(t){const e=this.combinedConversations.find(n=>n.id===t.id),o=(e==null?void 0:e.unseen_count)??0;await this.selectConversation(t.id,t.girl_id??void 0),e&&(e.unseen_count=0);const r=t.girl_id??this.selectedGirlId;if(r!=null&&this.conversations[r]===void 0&&o>0){const n=this.girlUnreadCounts[r]??0;this.girlUnreadCounts={...this.girlUnreadCounts,[r]:Math.max(0,n-o)}}},computeHasMore(t,e){const o=t==null?void 0:t.meta;return o&&o.current_page!==void 0&&o.last_page!==void 0?o.current_page<o.last_page:e>=at},findLoadedConversation(t){var o;const e=this.combinedConversations.find(r=>r.id===t);if(e)return e;for(const r of Object.keys(this.conversations)){const n=(o=this.conversations[Number(r)])==null?void 0:o.find(l=>l.id===t);if(n)return n}}
1,forEachLoadedConversation(t,e){var n;const o=new Set,r=l=>{l&&!o.has(l)&&(o.add(l),e(l))};r(this.windowConversations[t]),r(this.combinedConversations.find(l=>l.id===t));for(const l of Object.keys(this.conversations))r((n=this.conversations[Number(l)])==null?void 0:n.find(u=>u.id===t))},patchLoadedTag(t,e){var r;const o=n=>{n.tags&&(n.tags=n.tags.map(l=>l.id===t?{...l,...e}:l))};this.combinedConversations.forEach(o);for(const n of Object.keys(this.conversations))(r=this.conversations[Number(n)])==null||r.forEach(o)},stripTagFromLoadedConversations(t){var o;const e=r=>{r.tags&&(r.tags=r.tags.filter(n=>n.id!==t))};this.combinedConversations.forEach(e);for(const r of Object.keys(this.conversations))(o=this.conversations[Number(r)])==null||o.forEach(e)},applyPendingPurchaseBumps(t){const e=this.pendingPurchaseBumps[t];if(!e||e.length===0)return;const o=this.conversations[t];if(!o||o.length===0)return;const r=new Date().toISOString();let n=!1;for(const u of e){const v=o.find(C=>C.id===u);if(!v)continue;const g=this.openWindows[u],f=!!g&&!g.minimized&&this.focusedConversationId===u;this.selectedConversationId!==u&&!f&&(v.unseen_count=(v.unseen_count??0)+1),v.last_received_at=r,v.updated_at=r,n=!0}const l={...this.pendingPurchaseBumps};if(delete l[t],this.pendingPurchaseBumps=l,n){const u=[...o].sort((v,g)=>{const f=v.last_received_at||v.updated_at||"",C=g.last_received_at||g.updated_at||"";return $e(C)-$e(f)});this.conversations={...this.conversations,[t]:u},this.updateGirlUnreadCount(t)}},async selectConversation(t,e){var l;const o=e??((l=this.girlFor(t))==null?void 0:l.id)??this.selectedGirlId;if(!o)return;o!==this.selectedGirlId&&(this.selectedGirlId=o,this.openTab(o));const r=this.selectedConversationId;this.selectedConversationId=t,this.typingUsers={...this.typingUsers,[t]:{}},this.preparingContentUsers={...this.preparingContentUsers,[t]:{}};const n=this.currentConversations.find(u=>u.id===t);n&&(n.unseen_count=0),r!==null&&r!==t&&this.releaseTypingChannel(r),this.subscribeToMessageChannel(t),await this.fetchMessages(o,t),await this.markAsSeen(o,t),this.updateGirlUnreadCount(o)},async refreshExistingMessage(t,e,o){const r=le();try{const n=await r.getMessages(t,e),l=((n==null?void 0:n.data)||[]).find(f=>f.id===o),u=this.messages[e]||[],v=u.findIndex(f=>f.id===o);if(!l||v===-1)return;const g=u.slice();g[v]=l,this.messages={...this.messages,[e]:g}}catch{}},async fetchMessages(t,e,o=!1){var n,l;const r=le();o||this.setConvLoading(e,{messages:!0}),this.error=null;try{const u=await r.getMessages(t,e);u&&Array.isArray(u.data)&&(this.messages={...this.messages,[e]:u.data},this.pagination={...this.pagination,[e]:{oldestMessageId:u.data.length>0?u.data[0].id:null,hasMore:((n=u.meta)==null?void 0:n.total_count)>u.data.length,pageSize:50,totalCount:((l=u.meta)==null?void 0:l.total_count)||u.data.length,loadedCount:u.data.length}})}catch{o||(this.error="Failed to load messages")}finally{o||this.setConvLoading(e,{messages:!1})}},async appendNewMessages(t,e){var r;if(this.messages[e]===void 0)return;const o=le();try{const n=await o.getMessages(t,e);if(n&&Array.isArray(n.data)&&n.data.length>0){const l=this.messages[e]||[],u=new Set(l.map(g=>g.id)),v=n.data.filter(g=>!u.has(g.id));if(v.length>0){this.messages={...this.messages,[e]:[...l,...v]};const g=this.pagination[e];g&&(g.loadedCount+=v.length,g.totalCount=Math.max(g.totalCount,((r=n.meta)==null?void 0:r.total_count)??g.totalCount))}}}catch{}},async loadEarlierMessages(t,e){var n;if(!t||!e||(n=this.convLoading[e])!=null&&n.loadingEarlier)return;const o=this.pagination[e];if(!(o!=null&&o.hasMore)||!o.oldestMessageId)return;const r=le();this.setConvLoading(e,{loadingEarlier:!0});try{const l=await r.getMessages(t,e,o.oldestMessageId,o.pageSize);if(l&&Array.isArray(l.data)&&l.data.length>0){const u=this.messages[e]||[],v=new Set(u.map(f=>f.id)),g=l.data.filter(f=>!v.has(f.id));g.length===0?o.hasMore=!1:(this.messages={...this.messages,[e]:[...g,...u]},o.oldestMessageId=g[0].id,o.loadedCount+=g.length,o.hasMore=l.data.length>=o.pageSize)}else o.hasMore=!1}catch(l){console.error("Failed to load earlier messages:",l)}finally{this.setConvLoading(e,{loadingEarlier:!1})}},setConvLoading(t,e){const o=this.convLoading[t]||{sending:!1,messages:!1,loadingEarlier:!1};this.convLoading={...this.convLoading,[t]:{...o,...e}},t===this.selectedConversationId&&(this.loading={...this.loading,...e})}
1,createTempMessage(t,e,o){const r=Date.now()*1e4+Math.floor(Math.random()*9999),n=this.girls.find(l=>l.id===t);return{id:r,conversation_id:e,content:o,created_at:new Date().toISOString(),user:{id:t,username:(n==null?void 0:n.username)||"",display_name:(n==null?void 0:n.display_name)||null,photo_url:(n==null?void 0:n.photo_url)||null}}},replaceTempMessage(t,e,o){const n=(this.messages[t]||[]).filter(l=>l.id!==e);if(o){const l=n.some(u=>u.id===o.id);this.messages={...this.messages,[t]:l?n:[...n,o]}}else this.messages={...this.messages,[t]:n}},updateConversationLastMessage(t,e){const o=n=>{n.updated_at=new Date().toISOString(),n.last_message={id:e.id,conversation_id:e.conversation_id,content:e.content,created_at:e.created_at,updated_at:e.updated_at||e.created_at,user:e.user}},r=this.windowConversations[t];r&&o(r),this.forEachLoadedConversation(t,o)},lastMessageNeedsFetch(t){const e=t.message_type,o=t.is_unlocked;return!!e&&e!=="text"||o===!1},lastMessageToMessage(t){const e=t;return{id:t.id,conversation_id:t.conversation_id,content:t.content,message_type:e.message_type??"text",price:e.price,is_unlocked:e.is_unlocked,created_at:t.created_at,updated_at:t.updated_at,user:t.user,chatter_user_id:e.chatter_user_id,chatter_username:e.chatter_username}},appendLiveMessage(t,e){const o=this.messages[t];if(o===void 0||o.some(u=>u.id===e.id))return;const r=this.lastMessageToMessage(e),n=o.filter(u=>{var v,g;return!(ro(u)&&u.content===r.content&&((v=u.user)==null?void 0:v.id)===((g=r.user)==null?void 0:g.id))});this.messages={...this.messages,[t]:[...n,r]};const l=this.pagination[t];l&&(l.loadedCount+=1,l.totalCount+=1)},scheduleAppendFetch(t,e){if(this.pendingFetch[e])return;const o=setTimeout(()=>{const r={...this.pendingFetch};delete r[e],this.pendingFetch=r,this.appendNewMessages(t,e)},oo);this.pendingFetch={...this.pendingFetch,[e]:o}},handleSendError(t,e,o){var l,u,v,g;const r=Number(((l=t==null?void 0:t.response)==null?void 0:l.status)??(t==null?void 0:t.status)??(t==null?void 0:t.statusCode)??0),n=String(((v=(u=t==null?void 0:t.response)==null?void 0:u._data)==null?void 0:v.message)??((g=t==null?void 0:t.data)==null?void 0:g.message)??(t==null?void 0:t.message)??"").toLowerCase();if(r===403&&n.includes("block")){this.blockedConversationIds={...this.blockedConversationIds,[e]:!0},this.error="Conversation is blocked",ue.error("🚫 This punter has blocked the girl — messages can't be delivered.");return}if(r===401){this.error="Session expired",ue.error("Your session has expired — please log in again.");return}this.error=o,ue.error(o)},clearBlockedConversation(t){const e={...this.blockedConversationIds};delete e[t],this.blockedConversationIds=e},async sendMessage(t,e,o){if(!t||!e||!o.trim())return;const r=le();this.setConvLoading(e,{sending:!0}),this.error=null;const n=this.createTempMessage(t,e,o),l=this.messages[e]||[];this.messages={...this.messages,[e]:[...l,n]};try{const u=await r.sendMessage(t,e,o),v=io(u);this.replaceTempMessage(e,n.id,v),v&&this.updateConversationLastMessage(e,v)}catch(u){this.handleSendError(u,e,"Failed to send message");const v=this.messages[e]||[];this.messages={...this.messages,[e]:v.filter(g=>g.id!==n.id)}}finally{this.setConvLoading(e,{sending:!1})}},async sendImageMessage(t,e,o,r,n){if(!t||!e)return;const l=le();this.setConvLoading(e,{sending:!0}),this.error=null;const u=`Sending ${o.length} image${o.length>1?"s":""}...`,v=this.createTempMessage(t,e,u),g=this.messages[e]||[];this.messages={...this.messages,[e]:[...g,v]},this.sendPreparingContentIndicator(t,e);try{await l.sendImageMessage(t,e,o,r,n),this.replaceTempMessage(e,v.id,null),await this.fetchMessages(t,e,!0)}catch(f){this.handleSendError(f,e,"Failed to send image");const C=this.messages[e]||[];this.messages={...this.messages,[e]:C.filter(_=>_.id!==v.id)}}finally{this.setConvLoading(e,{sending:!1}),this.clearPreparingContentIndicator(t,e)}},async sendVideoMessage(t,e,o,r,n){if(!t||!e)return;const l=le();this.setConvLoading(e,{sending:!0}),this.error=null;const v=this.createTempMessage(t,e,"Uploading video..."),g=this.messages[e]||[];this.messages={...this.messages,[e]:[...g,v]},this.sendPreparingContentIndicator(t,e);try{await l.sendVideoMessage(t,e,o,r,n),this.replaceTempMessage(e,v.id,null),await this.fetchMessages(t,e,!0)}catch(f){this.handleSendError(f,e,"Failed to send video");const C=this.messages[e]||[];this.messages={...this.messages,[e]:C.filter(_=>_.id!==v.id)}}finally{this.setConvLoading(e,{sending:!1}),this.clearPreparingContentIndicator(t,e)}},async sendFromRepository(t,e,o,r,n,l=[],u=[]){if(!t||!e)return;const v=le();this.setConvLoading(e,{sending:!0}),this.error=null;const g=o.length+l.length+u.length,f=`Sending ${g} item${g>1?"s":""} from repository...`,C=this.createTempMessage(t,e,f),_=this.messages[e]||[];this.messages={...this.messages,[e]:[..._,C]},this.sendPreparingContentIndicator(t,e);try{await v.sendFromRepository(t,e,o,r,n,l,u),this.replaceTempMessage(e,C.id,null),await this.fetchMessages(t,e,!0)}catch(y){this.handleSendError(y,e,"Failed to send from repository");const x=this.messages[e]||[];this.messages={...this.messages,[e]:x.filter(M=>M.id!==C.id)}}finally{this.setConvLoading(e,{sending:!1}),this.clearPreparingContentIndicator(t,e)}},async deleteMessage(t,e,o){if(!t||!e)return;const r=le();try{await r.deleteMessage(t,e,o);const n=this.messages[e]||[];this.messages={...this.messages,[e]:n.filter(l=>l.id!==o)}}catch{this.error="Failed to delete message",ue.error("Failed to delete message")}},async unlockMessage(t,e,o){if(!t||!e)return;const r=le();try{await r.unlockMessage(t,e,o),await this.fetchMessages(t,e,!0)}catch{this.error="Failed to unlock message",ue.error("Failed to unlock message")}},async fetchNotes(t,e,o=!1){const r=le();o||(this.loading.notes=!0);try{const n=await r.getNotes(t,e);this.notes={...this.notes,[e]:n.data}}
1catch(n){console.error("Failed to load notes:",n)}finally{o||(this.loading.notes=!1)}},async addNote(t,e,o){const r=e??this.selectedGirlId,n=o??this.selectedConversationId;if(!r||!n||!t.trim())return;const l=le();try{const u=await l.createNote(r,n,t),v=this.notes[n]||[];this.notes={...this.notes,[n]:[u,...v]}}catch{ue.error("Failed to add note")}},async updateNote(t,e,o,r){const n=o??this.selectedGirlId,l=r??this.selectedConversationId;if(!n||!l||!e.trim())return;const u=le();try{const v=await u.updateNote(n,l,t,e.trim()),g=this.notes[l]||[];this.notes={...this.notes,[l]:g.map(f=>f.id===t?{...f,...v}:f)}}catch{ue.error("Failed to update note")}},async deleteNote(t,e,o){const r=e??this.selectedGirlId,n=o??this.selectedConversationId;if(!r||!n)return;const l=le();try{await l.deleteNote(r,n,t);const u=this.notes[n]||[];this.notes={...this.notes,[n]:u.filter(v=>v.id!==t)}}catch{ue.error("Failed to delete note")}},async fetchPunterStats(t,e){const o=le();this.punterStatsInFlight++,this.loading.punterStats=!0;try{const r=await o.getPunterStats(t,e);this.punterStats={...this.punterStats,[e]:r}}catch(r){console.error("Failed to load punter stats:",r)}finally{this.punterStatsInFlight--,this.punterStatsInFlight<=0&&(this.punterStatsInFlight=0,this.loading.punterStats=!1)}},sendTypingIndicator(t){var n;const e=t??this.selectedConversationId;if(e==null)return;const o=this.pusherMessageChannels[e],r=((n=this.openWindows[e])==null?void 0:n.girlId)??this.selectedGirlId;if(!(!o||!r))try{o.subscription.trigger("client-typing",{userId:r,timestamp:Date.now()})}catch{}},clearTypingIndicator(t){var n;const e=t??this.selectedConversationId;if(e==null)return;const o=this.pusherMessageChannels[e],r=((n=this.openWindows[e])==null?void 0:n.girlId)??this.selectedGirlId;if(!(!o||!r))try{o.subscription.trigger("client-typing-stopped",{userId:r,timestamp:Date.now()})}catch{}},sendPreparingContentIndicator(t,e){this.clearPreparingContentInterval(e);const o=this.pusherMessageChannels[e];if(!o||!t)return;const r=()=>{var n;try{(n=o==null?void 0:o.subscription)==null||n.trigger("client-preparing-content",{userId:t,timestamp:Date.now()})}catch{}};r(),this.preparingContentIntervals={...this.preparingContentIntervals,[e]:setInterval(r,Ys)}},clearPreparingContentInterval(t){const e=this.preparingContentIntervals[t];if(e){clearInterval(e);const o={...this.preparingContentIntervals};delete o[t],this.preparingContentIntervals=o}},clearPreparingContentIndicator(t,e){this.clearPreparingContentInterval(e);const o=this.pusherMessageChannels[e];if(!(!o||!t))try{o.subscription.trigger("client-preparing-content-stopped",{userId:t,timestamp:Date.now()})}catch{}},setTypingUser(t,e){const o=this.typingUsers[t]||{};this.typingUsers={...this.typingUsers,[t]:{...o,[e]:{timestamp:Date.now()}}},setTimeout(()=>{const r=this.typingUsers[t];if(r!=null&&r[e]&&Date.now()-r[e].timestamp>=$t){const n={...r};delete n[e],this.typingUsers={...this.typingUsers,[t]:n}}},$t)},clearTypingUser(t,e){const o=this.typingUsers[t];if(o!=null&&o[e]){const r={...o};delete r[e],this.typingUsers={...this.typingUsers,[t]:r}}},setPreparingContentUser(t,e){const o=this.preparingContentUsers[t]||{};this.preparingContentUsers={...this.preparingContentUsers,[t]:{...o,[e]:{timestamp:Date.now()}}},setTimeout(()=>{const r=this.preparingContentUsers[t];if(r!=null&&r[e]&&Date.now()-r[e].timestamp>=$t){const n={...r};delete n[e],this.preparingContentUsers={...this.preparingContentUsers,[t]:n}}},$t)},clearPreparingContentUser(t,e){const o=this.preparingContentUsers[t];if(o!=null&&o[e]){const r={...o};delete r[e],this.preparingContentUsers={...this.preparingContentUsers,[t]:r}}},async markAsSeen(t,e){if(!t)return;const o=le();try{await o.markAsSeen(t,e),this.removeFromOnlineUnreadByConversation(e)}catch(r){console.error("Failed to mark as seen:",r)}},async setGirlVisibility(t,e){if(!this.selectedGirlId)return;const o=le();try{await o.setGirlVisibility(this.selectedGirlId,t,e);const r=(this.conversations[this.selectedGirlId]||[]).find(n=>n.id===t);r&&(r.hidden_from_girl=!e),ue.success(e?"Thread is now visible to the girl":"Thread hidden from the girl")}catch{ue.error("Failed to update visibility")}},async markAsUnread(t){var r;const e=((r=this.conversationFor(t))==null?void 0:r.girl_id)??this.selectedGirlId;if(!e)return;const o=le();try{await o.markAsUnread(e,t),await this.fetchConversations(e),this.updateGirlUnreadCount(e)}catch{ue.error("Failed to mark as unread")}},toggleShowHiddenConversations(){this.showingHiddenConversations=!this.showingHiddenConversations,this.unsubscribeFromMessageChannel(),this.selectedConversationId=null,this.showingHiddenConversations&&this.selectedGirlId&&this.fetchHiddenConversations(this.selectedGirlId)},async fetchHiddenConversations(t){this.loading.hiddenConversations=!0;const e=le();try{const o=await e.getHiddenConversations(t);this.hiddenConversations[t]=o.data||[]}catch(o){console.error("Failed to fetch hidden conversations:",o),ue.error("Failed to load hidden conversations")}finally{this.loading.hiddenConversations=!1}},async unhideConversation(t){if(!this.selectedGirlId)return;const e=le(),o=this.selectedGirlId;try{await e.unhideConversation(o,t),await Promise.all([this.fetchConversations(o),this.fetchHiddenConversations(o)]),this.updateGirlUnreadCount(o),ue.success("Conversation restored")}catch{ue.error("Failed to unhide conversation")}},async hideConversation(t){if(!this.selectedGirlId)return;const e=le(),o=this.selectedGirlId;try{await e.hideConversation(o,t),await Promise.all([this.fetchConversations(o),this.fetchHiddenConversations(o)]),this.updateGirlUnreadCount(o),this.selectedConversationId===t&&(this.unsubscribeFromMessageChannel(),this.selectedConversationId=null),ue.success("Conversation hidden")}catch{ue.error("Failed to hide conversation")}},updateGirlUnreadCount(t){const e=this.conversations[t];if(e===void 0)return;const o=e.reduce((r,n)=>r+(n.unseen_count??0),0);this.girlUnreadCounts={...this.girlUnreadCounts,[t]:o}},bumpGirlActivity(t,e){if(!e)return;const o=this.girlLastActivityAt[t];o&&$e(o)>=$e(e)||(this.girlLastActivityAt={...this.girlLastActivityAt,[t]:e})},handleGirlConversationUpdate(t,e){var C,_,y;const o=e.unseen_count??e.unread_count??0,r=e.is_hidden===!0,n=e.id,l=e.last_message??null,u=this.openWindows[n],v=this.selectedConversationId===n,g=!!u&&this.focusedConversationId===n&&!u.minimized;
1if(l&&(!!u||v)&&(this.typingUsers[n]&&(this.typingUsers={...this.typingUsers,[n]:{}}),this.lastMessageNeedsFetch(l)?g||v?this.appendNewMessages(t,n):this.scheduleAppendFetch(t,n):this.appendLiveMessage(n,l)),u){const x=((C=l==null?void 0:l.user)==null?void 0:C.id)!==void 0&&l.user.id!==u.girlId,M=(l==null?void 0:l.id)!==void 0&&l.id>(u.lastCountedMsgId??0);if(x&&M)if(u.lastCountedMsgId=l.id,g||v){u.unread=0;const T=this.windowConversations[n];T&&(T.unseen_count=0)}else u.unread=(u.unread||0)+1;this.updateWindowConversation(n,e,o)}if(l&&((_=l.user)==null?void 0:_.id)!==void 0&&l.user.id!==t&&(g||v)&&this.markAsSeen(t,n),!r){if(this.bumpGirlActivity(t,e.last_received_at),o===0&&this.removeFromOnlineUnreadByConversation(n),this.activeTagFilterIds.length>0){const x=this.combinedConversations.find(M=>M.id===e.id);x&&(e.last_message&&(x.last_message=e.last_message),x.updated_at=e.updated_at||new Date().toISOString(),e.hidden_from_girl!==void 0&&(x.hidden_from_girl=e.hidden_from_girl),e.last_received_at&&(x.last_received_at=e.last_received_at),x.unseen_count=e.id===this.selectedConversationId||g?0:o,this.combinedConversations=[...this.combinedConversations].sort((M,T)=>{var E,V;const w=Math.max($e((E=M.last_message)==null?void 0:E.created_at),$e(M.last_received_at),$e(M.updated_at));return Math.max($e((V=T.last_message)==null?void 0:V.created_at),$e(T.last_received_at),$e(T.updated_at))-w}))}if(this.selectedGirlId===t){if((this.hiddenConversations[t]||[]).some(A=>A.id===e.id))return;const T=this.conversations[t]||[],w=T.find(A=>A.id===e.id);if(w){e.last_message&&(w.last_message=e.last_message),w.updated_at=e.updated_at||new Date().toISOString(),e.hidden_from_girl!==void 0&&(w.hidden_from_girl=e.hidden_from_girl),e.last_received_at&&(w.last_received_at=e.last_received_at),e.id===this.selectedConversationId||g?w.unseen_count=0:w.unseen_count=o;const A=[...T].sort((E,V)=>{var te,L;const de=Math.max($e((te=E.last_message)==null?void 0:te.created_at),$e(E.last_received_at),$e(E.updated_at));return Math.max($e((L=V.last_message)==null?void 0:L.created_at),$e(V.last_received_at),$e(V.updated_at))-de});this.conversations={...this.conversations,[t]:A},this.updateGirlUnreadCount(t)}else this.fetchConversations(t)}else if(o>0&&!g){if((this.hiddenConversations[t]||[]).some(V=>V.id===e.id))return;const T=l==null?void 0:l.id,w=((y=l==null?void 0:l.user)==null?void 0:y.id)!==void 0&&l.user.id!==t;if(T===void 0||!w||T<=(this.tabCountedMsgIds[e.id]??0))return;this.tabCountedMsgIds={...this.tabCountedMsgIds,[e.id]:T};const A=this.girlUnreadCounts[t]??0;this.girlUnreadCounts={...this.girlUnreadCounts,[t]:A+1};const E=this.girls.find(V=>V.id===t);E&&(E.has_unread=!0,E.unread_count=(E.unread_count??0)+1),this.openTab(t)}}},markMessageUnlocked(t,e){if(!e)return;const o=(this.messages[t]||[]).find(r=>r.id===e);o&&(o.is_unlocked=!0)},registerWindowSale(t,e){const o=this.openWindows[t];if(!o)return;o.sessionSales=(o.sessionSales||0)+e,o.saleFlash=e,o.saleFlashSeq=(o.saleFlashSeq||0)+1,this.focusedConversationId===t&&!o.minimized||(o.unseenSales=(o.unseenSales||0)+e),this.saleFlashTimers[t]&&clearTimeout(this.saleFlashTimers[t]),this.saleFlashTimers[t]=setTimeout(()=>{const n={...this.saleFlashTimers};delete n[t],this.saleFlashTimers=n;const l=this.openWindows[t];l&&(l.saleFlash=null)},no)},bumpConversationForPurchase(t,e){if((this.hiddenConversations[t]||[]).some(g=>g.id===e))return;const r=g=>{let f=0;for(const C of g)f=Math.max(f,$e(C));return new Date(f+1e3).toISOString()};this.girlLastActivityAt={...this.girlLastActivityAt,[t]:r(this.girls.map(g=>this.girlLastActivityAt[g.id]||g.last_received_at))};let n=!1;const l=this.openWindows[e],u=!!l&&!l.minimized&&this.focusedConversationId===e,v=this.conversations[t];if(v){const g=v.find(f=>f.id===e);if(g){this.selectedConversationId!==e&&!u&&(g.unseen_count=(g.unseen_count??0)+1);const f=r(v.flatMap(_=>{var y;return[(y=_.last_message)==null?void 0:y.created_at,_.last_received_at,_.updated_at]}));g.last_received_at=f,g.updated_at=f;const C=[...v].sort((_,y)=>{var T,w;const x=Math.max($e((T=_.last_message)==null?void 0:T.created_at),$e(_.last_received_at),$e(_.updated_at));return Math.max($e((w=y.last_message)==null?void 0:w.created_at),$e(y.last_received_at),$e(y.updated_at))-x});this.conversations={...this.conversations,[t]:C},this.updateGirlUnreadCount(t),n=!0}}if(!n){const g=this.pendingPurchaseBumps[t]??[];this.pendingPurchaseBumps={...this.pendingPurchaseBumps,[t]:[...g,e]}}if(this.selectedGirlId!==t&&!n&&!u){const g=this.girlUnreadCounts[t]??0;this.girlUnreadCounts={...this.girlUnreadCounts,[t]:g+1};const f=this.girls.find(C=>C.id===t);f&&(f.has_unread=!0,f.unread_count=(f.unread_count??0)+1),this.openTab(t)}}
1,acquireTypingChannel(t,e){if(this.pusherMessageChannels[t]){this.typingChannelLru=[t,...this.typingChannelLru.filter(l=>l!==t)];return}const{$Echo:o}=Pt();if(!o)return;const r=o.private(`Conversations.Messages.${t}`);this.pusherMessageChannels={...this.pusherMessageChannels,[t]:r};const n=r.subscription;for(n.bind("message.deleted",l=>{var g;const u=(l==null?void 0:l.id)||((g=l==null?void 0:l.data)==null?void 0:g.id);if(!u)return;const v=this.messages[t]||[];this.messages={...this.messages,[t]:v.filter(f=>f.id!==u)}}),n.bind("message.created",l=>{const u=(l==null?void 0:l.data)??l,v=u==null?void 0:u.id,g=this.messages[t];!v||!g||!g.some(f=>f.id===v)||this.refreshExistingMessage(e,t,v)}),n.bind("client-typing",l=>{!(l!=null&&l.userId)||l.userId===e||this.setTypingUser(t,l.userId)}),n.bind("client-typing-stopped",l=>{l!=null&&l.userId&&this.clearTypingUser(t,l.userId)}),n.bind("client-preparing-content",l=>{!(l!=null&&l.userId)||l.userId===e||this.setPreparingContentUser(t,l.userId)}),n.bind("client-preparing-content-stopped",l=>{l!=null&&l.userId&&this.clearPreparingContentUser(t,l.userId)}),this.typingChannelLru=[t,...this.typingChannelLru.filter(l=>l!==t)];this.typingChannelLru.length>eo;){let l=null;for(let u=this.typingChannelLru.length-1;u>=0;u--){const v=this.typingChannelLru[u];if(v!==this.selectedConversationId&&v!==this.focusedConversationId){l=v;break}}if(l===null)break;this.leaveTypingChannel(l)}},leaveTypingChannel(t){const e=this.pusherMessageChannels[t];if(e){const{$Echo:o}=Pt();try{e.subscription.unbind()}catch{}o&&e.name&&o.leave(e.name);const r={...this.pusherMessageChannels};delete r[t],this.pusherMessageChannels=r}this.typingChannelLru=this.typingChannelLru.filter(o=>o!==t),this.clearPreparingContentInterval(t)},releaseTypingChannel(t){t!==this.selectedConversationId&&t!==this.focusedConversationId&&this.leaveTypingChannel(t)},scheduleTypingChannel(t,e){if(this.pusherMessageChannels[t]){this.acquireTypingChannel(t,e);return}this.typingChannelDebounce&&clearTimeout(this.typingChannelDebounce),this.typingChannelDebounce=setTimeout(()=>{this.typingChannelDebounce=null,this.focusedConversationId===t&&this.openWindows[t]&&this.acquireTypingChannel(t,e)},so)},subscribeToMessageChannel(t){this.selectedGirlId&&this.acquireTypingChannel(t,this.selectedGirlId)},unsubscribeFromMessageChannel(){const t=this.selectedConversationId;t!==null&&t!==this.focusedConversationId&&this.leaveTypingChannel(t)},resolvePunterId(t,e){var n,l;if(!t)return null;const o=(n=t.initiator_user)==null?void 0:n.id,r=(l=t.recipient_user)==null?void 0:l.id;return o&&o!==e?o:r&&r!==e?r:null},async hydrateWindowConversation(t,e){const o=le();try{const n=((await o.getConversations(t,e,1,at)).data||[]).find(l=>l.id===e);if(n){this.windowConversations={...this.windowConversations,[e]:n};const l=this.openWindows[e];l&&l.punterId===null&&(l.punterId=this.resolvePunterId(n,t))}}catch{}},updateWindowConversation(t,e,o){const r=this.windowConversations[t];if(!r)return;e.last_message&&(r.last_message=e.last_message),r.updated_at=e.updated_at||new Date().toISOString(),e.hidden_from_girl!==void 0&&(r.hidden_from_girl=e.hidden_from_girl),e.last_received_at&&(r.last_received_at=e.last_received_at);const n=this.openWindows[t],l=this.focusedConversationId===t&&n&&!n.minimized;r.unseen_count=l?0:o},async openWindow(t,e){if(this.openWindows[e]){this.restoreWindow(e);return}const o=this.windowConversations[e]||this.findLoadedConversation(e)||null;this.openWindows={...this.openWindows,[e]:{conversationId:e,girlId:t,punterId:this.resolvePunterId(o,t),minimized:!1,unread:0,saleFlash:null,saleFlashSeq:0,unseenSales:0,sessionSales:0,lastCountedMsgId:null}},this.windowOrder=[e,...this.windowOrder.filter(r=>r!==e)],o?this.windowConversations={...this.windowConversations,[e]:o}:this.hydrateWindowConversation(t,e),this.enforceWindowCap(),this.messages[e]===void 0&&this.fetchMessages(t,e),this.fetchNotes(t,e),this.focusWindow(e),this.persistWindows()},updateWindowCapacity(){typeof window>"u"||window.innerWidth!==this.viewportWidth&&(this.viewportWidth=window.innerWidth)},focusWindow(t){var l;const e=this.openWindows[t];if(!e)return;this.focusedConversationId=t,this.scheduleTypingChannel(t,e.girlId),this.markAsSeen(e.girlId,t),e.unread=0,e.unseenSales=0;const o=this.windowConversations[t];o&&(o.unseen_count=0);const r=(l=this.conversations[e.girlId])==null?void 0:l.find(u=>u.id===t);r&&r.unseen_count&&(r.unseen_count=0,this.updateGirlUnreadCount(e.girlId));const n=this.combinedConversations.find(u=>u.id===t);n&&n.unseen_count&&(n.unseen_count=0),this.persistWindows()},minimizeWindow(t){const e=this.openWindows[t];e&&(e.minimized=!0,this.focusedConversationId===t&&(this.focusedConversationId=null),this.releaseTypingChannel(t),this.clearPreparingContentInterval(t),this.persistWindows())},restoreWindow(t){const e=this.openWindows[t];e&&(e.minimized=!1,this.windowOrder=[t,...this.windowOrder.filter(o=>o!==t)],this.focusWindow(t))},closeWindow(t){this.focusedConversationId===t&&(this.focusedConversationId=null),this.releaseTypingChannel(t),this.clearPreparingContentInterval(t);const e={...this.openWindows};delete e[t],this.openWindows=e,this.windowOrder=this.windowOrder.filter(u=>u!==t);const o={...this.convLoading};delete o[t],this.convLoading=o;const r={...this.typingUsers};delete r[t],this.typingUsers=r;const n={...this.preparingContentUsers};delete n[t],this.preparingContentUsers=n;const l={...this.windowConversations};if(delete l[t],this.windowConversations=l,this.pendingFetch[t]){clearTimeout(this.pendingFetch[t]);const u={...this.pendingFetch};delete u[t],this.pendingFetch=u}if(this.saleFlashTimers[t]){clearTimeout(this.saleFlashTimers[t]);const u={...this.saleFlashTimers};delete u[t],this.saleFlashTimers=u}this.persistWindows()},async expandWindowToMain(t,e){this.closeWindow(e),await this.selectGirl(t),await this.selectConversation(e)},enforceWindowCap(){for(;this.windowOrder.length>Zs;){let t=null;for(let e=this.windowOrder.length-1;e>=0;e--){const o=this.windowOrder[e],r=this.openWindows[o];if(r&&r.minimized&&o!==this.focusedConversationId&&o!==this.selectedConversationId){t=o;break}}if(t===null)for(let e=this.windowOrder.length-1;e>=0;e--){const o=this.windowOrder[e];if(o!==this.focusedConversationId&&o!==this.selectedConversationId){t=o;break}}if(t===null)break;this.evictWindow(t)}},evictWindow(t){this.releaseTypingChannel(t),this.clearPreparingContentInterval(t);const e={...this.openWindows};delete e[t],this.openWindows=e,this.windowOrder=this.windowOrder.filter(u=>u!==t);const o={...this.convLoading};delete o[t],this.convLoading=o;const r={...this.typingUsers};delete r[t],this.typingUsers=r;const n={...this.preparingContentUsers};delete n[t],this.preparingContentUsers=n;const l={...this.windowConversations};if(delete l[t],this.windowConversations=l,this.pendingFetch[t]){clearTimeout(this.pendingFetch[t]);const u={...this.pendingFetch};delete u[t],this.pendingFetch=u}if(t!==this.selectedConversationId){const u={...this.messages};delete u[t],this.messages=u;const v={...this.pagination};delete v[t],this.pagination=v}},persistWindows(){if(!(typeof window>"u"))try{const t={windows:this.windowOrder.map(e=>
1this.openWindows[e]).filter(Boolean).map(e=>({conversationId:e.conversationId,girlId:e.girlId,minimized:e.minimized})),focusedConversationId:this.focusedConversationId};localStorage.setItem(hs,JSON.stringify(t))}catch{}},async restoreWindows(){if(typeof window>"u")return;let t=null;try{const l=localStorage.getItem(hs);l&&(t=JSON.parse(l))}catch{return}if(!t||!Array.isArray(t.windows))return;const e=[];for(const l of t.windows){const{conversationId:u,girlId:v,minimized:g}=l;if(this.openWindows[u]||!this.girls.some(C=>C.id===v))continue;const f=this.findLoadedConversation(u)||null;this.openWindows={...this.openWindows,[u]:{conversationId:u,girlId:v,punterId:f?this.resolvePunterId(f,v):null,minimized:!!g,unread:0,saleFlash:null,saleFlashSeq:0,unseenSales:0,sessionSales:0,lastCountedMsgId:null}},f&&(this.windowConversations={...this.windowConversations,[u]:f}),this.windowOrder=[...this.windowOrder,u],(!f||this.messages[u]===void 0)&&e.push(u)}const o=t.focusedConversationId,r=o!==null?this.openWindows[o]:void 0;o!==null&&r&&!r.minimized&&(this.focusedConversationId=o,this.acquireTypingChannel(o,r.girlId)),this.enforceWindowCap(),this.persistWindows();const n=e.filter(l=>this.openWindows[l]);if(n.length){const l=new Set(this.visibleWindows.map(g=>g.conversationId));this.focusedConversationId!==null&&l.add(this.focusedConversationId);const u=n.filter(g=>l.has(g)),v=n.filter(g=>!l.has(g));this.hydrateRestoredWindows([...u,...v],u.length)}},async hydrateRestoredWindows(t,e){const o=le();for(let r=0;r<t.length;r++){r>=e&&await new Promise(v=>setTimeout(v,to));const n=t[r],l=this.openWindows[n];if(!l)continue;const u=l.girlId;if(!this.windowConversations[n]){let v=null;try{v=((await o.getConversations(u,n,1,at)).data||[]).find(f=>f.id===n)||null}catch{continue}if(!this.openWindows[n])continue;if(v)this.windowConversations={...this.windowConversations,[n]:v},this.openWindows[n].punterId=this.resolvePunterId(v,u);else{this.closeWindow(n);continue}}this.messages[n]===void 0&&await this.fetchMessages(u,n,!0),this.openWindows[n]&&this.fetchNotes(u,n,!0)}},openTab(t){this.closedTabIds=this.closedTabIds.filter(e=>e!==t),this.openTabIds.includes(t)||(this.openTabIds=[...this.openTabIds,t]),this.persistTabState()},closeTab(t){t!==this.selectedGirlId&&(this.openTabIds=this.openTabIds.filter(e=>e!==t),this.closedTabIds.includes(t)||(this.closedTabIds=[...this.closedTabIds,t]),this.persistTabState())},persistTabState(){if(typeof window<"u")try{localStorage.setItem(as,JSON.stringify(this.openTabIds)),localStorage.setItem(ls,JSON.stringify(this.closedTabIds))}catch{}},restoreOpenTabs(){if(typeof window<"u")try{const t=localStorage.getItem(as);if(t){const r=JSON.parse(t);this.openTabIds=r.filter(n=>this.girls.some(l=>l.id===n))}const e=localStorage.getItem(ls);if(e){const r=JSON.parse(e);this.closedTabIds=r.filter(n=>this.girls.some(l=>l.id===n))}const o=this.girls.filter(r=>(this.girlUnreadCounts[r.id]??r.unread_count??0)>0).map(r=>r.id);this.closedTabIds=this.closedTabIds.filter(r=>!o.includes(r)),o.forEach(r=>{this.openTabIds.includes(r)||this.openTabIds.push(r)}),this.persistTabState()}catch{}},async fetchReminders(){const t=le();this.loading.reminders=!0;try{const e=await t.getReminders();this.reminders=e.data,this.dueRemindersCount=e.data.filter(o=>o.is_due).length}catch(e){console.error("Failed to load reminders:",e)}finally{this.loading.reminders=!1}},async fetchDueRemindersCount(){const t=le();try{this.dueRemindersCount=await t.getDueRemindersCount()}catch(e){console.error("Failed to fetch due reminders count:",e)}},async createReminder(t,e,o,r,n){const l=le();try{const u=await l.createReminder(t,e,o,r,n);this.reminders=[u,...this.reminders],u.is_due&&this.dueRemindersCount++,ue.success("Reminder created")}catch(u){throw ue.error("Failed to create reminder"),u}},async completeReminder(t){const e=le();try{await e.completeReminder(t);const o=this.reminders.find(r=>r.id===t);this.reminders=this.reminders.filter(r=>r.id!==t),o!=null&&o.is_due&&(this.dueRemindersCount=Math.max(0,this.dueRemindersCount-1))}catch{ue.error("Failed to complete reminder")}},async deleteReminder(t){const e=le();try{await e.deleteReminder(t);const o=this.reminders.find(r=>r.id===t);this.reminders=this.reminders.filter(r=>r.id!==t),o!=null&&o.is_due&&(this.dueRemindersCount=Math.max(0,this.dueRemindersCount-1))}catch{ue.error("Failed to delete reminder")}},navigateToReminder(t){this.selectGirl(t.girl.id),this.openWindow(t.girl.id,t.conversation_id)},async fetchGirlNotes(t){const e=le();this.loading.girlNotes=!0;try{const o=await e.getGirlNotes(t);this.girlNotes[t]=o.data}catch(o){console.error("Failed to load girl notes:",o),ue.error("Failed to load notes")}finally{this.loading.girlNotes=!1}},async createGirlNote(t,e){const o=le();try{const r=await o.createGirlNote(t,e);return this.girlNotes[t]||(this.girlNotes[t]=[]),this.girlNotes[t].unshift(r),ue.success("Note added"),r}catch(r){throw ue.error("Failed to add note"),r}},async updateGirlNote(t,e,o){const r=le();try{const n=await r.updateGirlNote(t,e,o),l=this.girlNotes[t]||[],u=l.findIndex(v=>v.id===e);return u!==-1&&(l[u]=n),ue.success("Note updated"),n}catch(n){throw ue.error("Failed to update note"),n}},async deleteGirlNote(t,e){const o=le();try{await o.deleteGirlNote(t,e);const r=this.girlNotes[t]||[];this.girlNotes[t]=r.filter(n=>n.id!==e),ue.success("Note deleted")}catch{ue.error("Failed to delete note")}},async fetchFavourites(){const t=le();this.loading.favourites=!0;try{const e=await t.getFavourites();this.favouriteGirlIds=e.girl_ids,this.favouritePunterIds=e.punter_ids}catch(e){console.error("Failed to fetch favourites:",e)}finally{this.loading.favourites=!1}},async togglePunterFavourite(t){const e=le(),o=this.favouritePunterIds.includes(t);o?this.favouritePunterIds=this.favouritePunterIds.filter(r=>r!==t):this.favouritePunterIds=[...this.favouritePunterIds,t];try{const r=await e.toggleFavourite("punter",t);r.is_favourite&&!this.favouritePunterIds.includes(t)?this.favouritePunterIds=[...this.favouritePunterIds,t]:!r.is_favourite&&this.favouritePunterIds.includes(t)&&(this.favouritePunterIds=this.favouritePunterIds.filter(n=>n!==t))}catch{o?this.favouritePunterIds=[...this.favouritePunterIds,t]:this.favouritePunterIds=this.favouritePunterIds.filter(n=>n!==t),ue.error("Failed to update favourite")}},async toggleGirlFavourite(t){const e=le(),o=this.favouriteGirlIds.includes(t);o?this.favouriteGirlIds=this.favouriteGirlIds.filter(r=>r!==t):this.favouriteGirlIds=[...this.favouriteGirlIds,t];try{const r=await e.toggleFavourite("girl",t);r.is_favourite&&!this.favouriteGirlIds.includes(t)?this.favouriteGirlIds=[...this.favouriteGirlIds,t]:!r.is_favourite&&this.favouriteGirlIds.includes(t)&&(this.favouriteGirlIds=this.favouriteGirlIds.filter(n=>n!==t))}catch{o?this.favouriteGirlIds=[...this.favouriteGirlIds,t]:this.favouriteGirlIds=this.favouriteGirlIds.filter(n=>n!==t),ue.error("Failed to update favourite")}},async fetchActivities(){const t=le();this.loading.activities=!0;try{const e=await t.getActivities(),o=new Set(this.activities.filter(n=>!n.is_read).map(n=>n.id));this.activities=e.data.map(n=>({...n,is_read:o.has(n.id)?!1:n.is_read}));const r=this.activities.filter(n=>!n.is_read).length;this.unreadActivitiesCount=Math.max(this.unreadActivitiesCount,r)}catch(e){console.error("Failed to load activities:",e)}finally{this.loading.activities=!1}},async fetchUnreadActivitiesCount(){const t=le();try{const e=await t.getUnreadActivitiesCount();this.unreadActivitiesCount=Math.max(this.unreadActivitiesCount,e)}catch(e){console.error("Failed to fetch unread activities count:",e)}},async markActivityAsRead(t){const e=le();try{await e.markActivityAsRead(t);const o=this.activities.find(r=>r.id===t);o&&!o.is_read&&(o.is_read=!0,this.unreadActivitiesCount=Math.max(0,this.unreadActivitiesCount-1))}catch(o){console.error("Failed to mark activity as read:",o)}},async markAllActivitiesAsRead(){const t=le();
1try{await t.markAllActivitiesAsRead(),this.activities.forEach(e=>{e.is_read=!0}),this.unreadActivitiesCount=0}catch{ue.error("Failed to mark activities as read")}},addActivity(t){const e={id:t.data.id,activity_type:t.activity_type,girl:t.data.girl,punter:t.data.punter,conversation_id:t.data.conversation_id,message_id:t.data.message_id||null,amount:t.data.amount||null,is_read:!1,created_at:t.timestamp};if(t.activity_type==="new_message"&&this.applyNewMessageToOnlineUnread(t),["content_unlocked","tip_received","gift_received"].includes(t.activity_type)){this.purchases=[e,...this.purchases],this.unreadPurchasesCount++,qs(),t.activity_type==="content_unlocked"&&this.markMessageUnlocked(t.data.conversation_id,t.data.message_id),this.registerWindowSale(t.data.conversation_id,Number(t.data.amount)||0),this.bumpConversationForPurchase(t.data.girl_id,t.data.conversation_id);return}const o=this.activities.findIndex(r=>r.conversation_id===e.conversation_id);if(o>=0){const r=!this.activities[o].is_read;this.activities.splice(o,1),this.activities=[e,...this.activities],r||this.unreadActivitiesCount++}else this.activities=[e,...this.activities],this.unreadActivitiesCount++},async fetchPurchases(){const t=le();this.loading.purchases=!0;try{const e=await t.getPurchases(),o=new Set(this.purchases.filter(n=>!n.is_read).map(n=>n.id));this.purchases=e.data.map(n=>({...n,is_read:o.has(n.id)?!1:n.is_read}));const r=this.purchases.filter(n=>!n.is_read).length;this.unreadPurchasesCount=Math.max(this.unreadPurchasesCount,r)}catch(e){console.error("Failed to load purchases:",e)}finally{this.loading.purchases=!1}},async fetchUnreadPurchasesCount(){const t=le();try{const e=await t.getUnreadPurchasesCount();this.unreadPurchasesCount=Math.max(this.unreadPurchasesCount,e)}catch(e){console.error("Failed to fetch unread purchases count:",e)}},async markPurchaseAsRead(t){const e=le();try{await e.markPurchaseAsRead(t);const o=this.purchases.find(r=>r.id===t);o&&!o.is_read&&(o.is_read=!0,this.unreadPurchasesCount=Math.max(0,this.unreadPurchasesCount-1))}catch(o){console.error("Failed to mark purchase as read:",o)}},async markAllPurchasesAsRead(){const t=le();try{await t.markAllPurchasesAsRead(),this.purchases.forEach(e=>{e.is_read=!0}),this.unreadPurchasesCount=0}catch{ue.error("Failed to mark purchases as read")}},applyNewMessageToOnlineUnread(t){const e=t.data.conversation_id,o=t.data.girl_id;if(!e||!o||(this.hiddenConversations[o]||[]).some(v=>v.id===e)||this.selectedConversationId===e)return;const n=this.openWindows[e];if(n&&!n.minimized&&this.focusedConversationId===e)return;const l=this.onlineUnreadPunters.findIndex(v=>v.conversation_id===e),u=t.timestamp||new Date().toISOString();if(l>=0){const v=this.onlineUnreadPunters[l],f=[{...v,unread_count:(v.unread_count??0)+1,last_message_at:u},...this.onlineUnreadPunters.filter((C,_)=>_!==l)];this.onlineUnreadPunters=f}else{const v={conversation_id:e,girl:t.data.girl,punter:t.data.punter,unread_count:1,last_message_at:u};this.onlineUnreadPunters=[v,...this.onlineUnreadPunters]}this.onlineUnreadCount=this.onlineUnreadPunters.length},removeFromOnlineUnreadByConversation(t){const e=this.onlineUnreadPunters.length;this.onlineUnreadPunters=this.onlineUnreadPunters.filter(o=>o.conversation_id!==t),this.onlineUnreadPunters.length!==e&&(this.onlineUnreadCount=this.onlineUnreadPunters.length)},subscribeToOnlineStatusChannel(){if(this.onlineStatusListenerBound)return;const{$Echo:t}=Pt();t&&(t.channel("OnlineStatus").listen(".user.online.changed",e=>{this.handleUserOnlineChanged(e.user_id,e.is_online)}),this.onlineStatusListenerBound=!0)},handleUserOnlineChanged(t,e){if(this.girls.length){if(!e){this.removeFromOnlineUnreadByPunter(t);return}this.onlineUnreadRefetchTimer||(this.onlineUnreadRefetchTimer=setTimeout(()=>{this.onlineUnreadRefetchTimer=null,this.fetchOnlineUnreadPunters()},2e3))}},removeFromOnlineUnreadByPunter(t){const e=this.onlineUnreadPunters.length;this.onlineUnreadPunters=this.onlineUnreadPunters.filter(o=>{var r;return((r=o.punter)==null?void 0:r.id)!==t}),this.onlineUnreadPunters.length!==e&&(this.onlineUnreadCount=this.onlineUnreadPunters.length)},async fetchOnlineUnreadPunters(){const t=le();this.loading.onlineUnread=!0;try{const e=await t.getOnlineUnreadPunters();this.onlineUnreadPunters=e.data,this.onlineUnreadCount=e.data.length}catch(e){console.error("Failed to load online unread punters:",e)}finally{this.loading.onlineUnread=!1}},async fetchOnlineUnreadCount(){const t=le();try{this.onlineUnreadCount=await t.getOnlineUnreadCount()}catch(e){console.error("Failed to fetch online unread count:",e)}},navigateToOnlineUnreadPunter(t){this.selectGirl(t.girl.id),this.openWindow(t.girl.id,t.conversation_id),this.onlineUnreadPunters=this.onlineUnreadPunters.filter(e=>e.conversation_id!==t.conversation_id),this.onlineUnreadCount=this.onlineUnreadPunters.length},subscribeToChatterChannel(t){this.unsubscribeFromChatterChannel();const{$Echo:e}=Pt();if(!e)return;this.subscribeToOnlineStatusChannel();const o=es();o.requestPermission().then(l=>{});const r=e.private(`Chatters.${t}`);this.pusherChatterChannel=r;const n=r.subscription;n.bind("chatter.activity",l=>{this.addActivity(l),o.showActivityNotification(l,(x,M)=>{this.selectGirl(x),this.openWindow(x,M)});const v={new_message:"💬 New message",message_seen:"👀 Message opened",content_unlocked:"💰 Content unlocked",tip_received:"💸 Tip received",gift_received:"🎁 Gift received"}[l.activity_type]||"Activity",g=l.data.punter_username||"Someone",f=l.data.girl_username||"a girl",C=l.data.gift_name?` ${l.data.gift_name}`:"",_=l.data.amount?` (${l.data.amount} credits)`:"",y=`${v}${C}: ${g} → ${f}${_}`;ue.info(y,{duration:5e3}).then(()=>{}).catch(x=>{console.error("[ChatterCRM] Toast error:",x)})}),window.testChatterNotification=()=>{ue.info("🧪 Test notification from console!",{duration:1e4});const l=es();l.permission.value,l.permission.value==="granted"?new Notification("Test Browser Notification",{body:"This is a test browser notification",icon:"/favicon.ico"}):Notification.requestPermission().then(u=>{})},n.bind("chatter.conversation.updated",l=>{this.handleGirlConversationUpdate(l.girl_id,l.conversation)}),n.bind("chatter.media.video.ready",l=>{this.lastVideoReadyEvent={girlId:l.girl_id,media:l.media}})},unsubscribeFromChatterChannel(){if(this.pusherChatterChannel){const{$Echo:t}=Pt();try{this.pusherChatterChannel.subscription.unbind()}catch{}t&&this.pusherChatterChannel.name&&t.leave(this.pusherChatterChannel.name),this.pusherChatterChannel=null}},navigateToActivity(t){this.selectGirl(t.girl.id),this.openWindow(t.girl.id,t.conversation_id),t.is_read||this.markActivityAsRead(t.id)},navigateToPurchase(t){this.selectGirl(t.girl.id),this.openWindow(t.girl.id,t.conversation_id),t.is_read||this.markPurchaseAsRead(t.id)},cleanup(){this.persistWindows();
1for(const t of Object.keys(this.pusherMessageChannels))this.leaveTypingChannel(Number(t));for(const t of Object.keys(this.preparingContentIntervals))this.clearPreparingContentInterval(Number(t));for(const t of Object.keys(this.pendingFetch))clearTimeout(this.pendingFetch[Number(t)]);this.typingChannelDebounce&&(clearTimeout(this.typingChannelDebounce),this.typingChannelDebounce=null),this.unsubscribeFromChatterChannel(),this.$reset()}}}),ao=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"})],-1),lo=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1),co=[lo],uo={key:0,class:"absolute right-0 top-full mt-1 w-72 bg-gray-800 rounded-lg shadow-xl border border-gray-700 z-50 overflow-hidden"},ho={class:"p-2 border-b border-gray-700"},go={class:"relative"},fo=s("svg",{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("circle",{cx:"11",cy:"11",r:"8"}),s("path",{d:"m21 21-4.3-4.3"})],-1),po={class:"max-h-80 overflow-y-auto"},vo={key:0,class:"px-4 py-6 text-center text-gray-400 text-sm"},mo=["onClick"],yo={class:"relative flex-shrink-0"},_o=["src","alt"],wo={key:1,class:"w-8 h-8 rounded-full bg-gray-500 flex items-center justify-center text-xs font-bold"},xo={key:2,class:"absolute -top-1 -right-1 min-w-4 h-4 px-1 bg-x-pink-1 rounded-full flex items-center justify-center text-[10px] font-medium"},ko={class:"flex-1 min-w-0"},bo={class:"flex items-center gap-1.5"},Co={key:0,class:"w-2 h-2 bg-x-green-1 rounded-full flex-shrink-0",title:"Open as tab"},$o={class:"text-sm font-medium truncate"},To={class:"flex items-center gap-2 text-xs text-gray-400 mt-0.5"},jo={title:"Total earnings from unlocked PPV"},Mo=s("span",{class:"text-gray-600"},"|",-1),So={title:"Media in repository"},Ao=je({__name:"ChatterAllGirlsDropdown",setup(t){const e=Ee(),o=I(!1),r=I(""),n=I(null),l=R(()=>[...e.girls].sort((y,x)=>{const M=e.girlUnreadCounts[y.id]??y.unread_count??0,T=e.girlUnreadCounts[x.id]??x.unread_count??0;return T!==M?T-M:x.total_earnings!==y.total_earnings?x.total_earnings-y.total_earnings:x.media_count-y.media_count})),u=R(()=>{const y=r.value.toLowerCase().trim();return y?l.value.filter(x=>(x.display_name||x.username).toLowerCase().includes(y)):l.value});function v(){o.value=!o.value,o.value&&(r.value="")}function g(){o.value=!1,r.value=""}function f(y){e.selectGirl(y),g()}function C(y){return y>=1e3?"£"+(y/1e3).toFixed(1)+"k":"£"+y}function _(y){n.value&&!n.value.contains(y.target)&&g()}return ze(()=>{document.addEventListener("click",_)}),Qe(()=>{document.removeEventListener("click",_)}),(y,x)=>(i(),a("div",{ref_key:"dropdownRef",ref:n,class:"relative"},[s("button",{class:"flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded hover:bg-gray-700 transition-colors whitespace-nowrap",title:"All Girls",onClick:v},[ao,X(" All Girls "),(i(),a("svg",{class:J(["w-3 h-3 transition-transform",{"rotate-180":o.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},co,2))]),o.value?(i(),a("div",uo,[s("div",ho,[s("div",go,[Ie(s("input",{"onUpdate:modelValue":x[0]||(x[0]=M=>r.value=M),type:"text",placeholder:"Search girls...",class:"w-full h-8 text-xs text-white bg-gray-700 pl-8 pr-3 rounded border border-gray-600 focus:outline-none focus:border-x-pink-1 transition-colors placeholder-gray-400"},null,512),[[Oe,r.value]]),fo])]),s("div",po,[u.value.length===0?(i(),a("div",vo," No girls found ")):k("",!0),(i(!0),a(Y,null,he(u.value,M=>(i(),a("button",{key:M.id,class:J(["w-full flex items-center gap-3 px-3 py-2 hover:bg-gray-700 transition-colors text-left",{"bg-gray-700":O(e).selectedGirlId===M.id}]),onClick:T=>f(M.id)},[s("div",yo,[M.photo_url?(i(),a("img",{key:0,src:M.photo_url,alt:M.display_name||M.username,class:"w-8 h-8 rounded-full object-cover"},null,8,_o)):(i(),a("div",wo,b((M.display_name||M.username).charAt(0).toUpperCase()),1)),O(e).girlUnreadCounts[M.id]>0?(i(),a("span",xo,b(O(e).girlUnreadCounts[M.id]>99?"99+":O(e).girlUnreadCounts[M.id]),1)):k("",!0)]),s("div",ko,[s("div",bo,[O(e).isTabOpen(M.id)?(i(),a("span",Co)):k("",!0),s("span",$o,b(M.display_name||M.username),1)]),s("div",To,[s("span",jo,b(C(M.total_earnings)),1),Mo,s("span",So,b(M.media_count)+" media",1)])])],10,mo))),128))])])):k("",!0)],512))}}),Eo={class:"notification-center relative"},Io=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})],-1),Ro={key:0,class:"absolute -top-0.5 -right-0.5 min-w-4 h-4 px-1 bg-x-pink-1 rounded-full flex items-center justify-center text-[10px] font-medium"},Uo={key:0,class:"absolute right-0 top-full mt-2 w-80 bg-white rounded-lg shadow-lg border border-gray-200 z-50 max-h-[70vh] overflow-hidden flex flex-col"},Po={class:"px-4 py-3 border-b border-gray-200 flex-shrink-0 flex items-center justify-between"},No=s("h3",{class:"font-semibold text-gray-800"},"Notifications",-1),Fo={class:"flex border-b border-gray-200 flex-shrink-0 text-sm"},Oo={key:1,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-purple-600"},Go={key:1,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-yellow-500"},Lo={key:1,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-red-600"},Do={key:1,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600"},zo={key:0,class:"flex items-center justify-center py-8"},Bo=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),Ho=[Bo],Wo={key:1,class:"py-8 text-center text-gray-500 text-sm"},Vo={key:0,class:"px-4 py-2 border-b border-gray-100 flex-shrink-0"},qo={class:"overflow-y-auto flex-1"},Yo=["onClick"],Ko={class:"flex items-start gap-3"},Xo={class:"relative flex-shrink-0"},Jo=["src","alt"],Qo={key:1,class:"w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-sm font-bold text-gray-600"},Zo={class:"absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-white flex items-center justify-center"},en=["d"],tn={class:"flex-1 min-w-0"},sn={class:"flex items-center justify-between gap-2"},on={class:"font-medium text-sm text-gray-900 truncate"},nn={class:"text-xs text-gray-500 flex-shrink-0"},rn={class:"text-xs text-gray-700 mt-0.5"},an={key:0,class:"font-medium text-yellow-600"},ln={class:"text-xs text-gray-500 truncate mt-0.5"},dn={key:0,class:"w-2 h-2 rounded-full bg-purple-500 flex-shrink-0 mt-2"},cn={key:0,class:"flex items-center justify-center py-8"},un=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),hn=[un],gn={key:1,class:"py-8 text-center text-gray-500 text-sm"},fn={key:0,class:"px-4 py-2 border-b border-gray-100 flex-shrink-0"},pn={class:"overflow-y-auto flex-1"},vn=["onClick"],mn={class:"flex items-start gap-3"},yn={class:"relative flex-shrink-0"},_n=["src","alt"],wn={key:1,class:"w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-sm font-bold text-gray-600"},xn={class:"absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-white flex items-center justify-center"},kn={class:"w-3.5 h-3.5 text-yellow-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},bn=["d"],Cn={class:"flex-1 min-w-0"},$n={class:"flex items-center justify-between gap-2"},Tn={class:"font-medium text-sm text-gray-900 truncate"},jn={class:"text-xs text-gray-500 flex-shrink-0"},Mn={class:"text-xs text-gray-700 mt-0.5"},Sn={key:0,class:"font-semibold text-yellow-700"},An={class:"text-xs text-gray-500 truncate mt-0.5"},En={key:0,class:"w-2 h-2 rounded-full bg-yellow-500 flex-shrink-0 mt-2"},In={key:0,class:"flex items-center justify-center py-8"},Rn=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),Un=[Rn],Pn={key:1,class:"py-8 text-center text-gray-500 text-sm"},Nn={key:2,class:"overflow-y-auto flex-1"},Fn=["onClick"],On={class:"flex items-start gap-3"},Gn={class:"relative flex-shrink-0"},Ln=["src","alt"],Dn={key:1,class:"w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-sm font-bold text-gray-600"},zn={class:"flex-1 min-w-0"},Bn={class:"flex items-center justify-between gap-2"},Hn={class:"font-medium text-sm text-gray-900 truncate"},Wn={class:"text-xs text-gray-500 truncate mt-0.5"},Vn={key:0,class:"text-xs text-gray-700 mt-1 line-clamp-2"},qn={class:"flex items-center gap-2 mt-2 ml-13"},Yn=["onClick"],Kn=["onClick"],Xn=je({__name:"ChatterNotificationCenter",setup(t){const e=Ee(),o=es(),r=I(!1),n=I("activities");let l=null;const u=R(()=>e.reminders.filter(D=>D.is_due)),v=R(()=>e.reminders.filter(D=>!D.is_due)),g=R(()=>e.unreadActivitiesCount+e.unreadPurchasesCount+e.dueRemindersCount);
1function f(D){switch(D){case"new_message":return"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z";case"message_seen":return"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z";case"content_unlocked":return"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z";case"tip_received":return"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M5 21h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z";case"gift_received":return"M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7";default:return"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}}function C(D){switch(D){case"new_message":return"New message";case"message_seen":return"Opened message";case"content_unlocked":return"Unlocked content";case"tip_received":return"Tip received";case"gift_received":return"Gift received";default:return"Activity"}}function _(D){switch(D){case"new_message":return"text-blue-600";case"message_seen":return"text-green-600";case"content_unlocked":return"text-yellow-600";case"tip_received":return"text-yellow-600";case"gift_received":return"text-yellow-600";default:return"text-gray-600"}}function y(){r.value=!r.value,r.value&&(n.value==="activities"?e.fetchActivities():n.value==="purchases"?e.fetchPurchases():e.fetchReminders())}function x(){r.value=!1}function M(D){D.target.closest(".notification-center")||x()}function T(D){const K=new Date(D),H=new Date,Re=K.getTime()-H.getTime(),_e=Math.round(Re/(1e3*60)),Se=Math.round(Re/(1e3*60*60)),z=Math.round(Re/(1e3*60*60*24));if(Re<0){const oe=Math.abs(_e),ge=Math.abs(Se);return oe<60?`${oe}m ago`:ge<24?`${ge}h ago`:K.toLocaleDateString([],{month:"short",day:"numeric"})}return _e<60?`in ${_e}m`:Se<24?`in ${Se}h`:z<7?`in ${z}d`:K.toLocaleDateString([],{month:"short",day:"numeric"})}async function w(D){await e.completeReminder(D.id)}async function A(D){await e.deleteReminder(D.id)}function E(D){e.navigateToReminder(D),x()}function V(D){e.navigateToActivity(D),x()}function de(D){e.navigateToPurchase(D),x()}function W(){e.markAllActivitiesAsRead()}function te(){e.markAllPurchasesAsRead()}async function L(){await o.requestPermission()}function F(D){n.value=D,D==="activities"?e.fetchActivities():D==="purchases"?e.fetchPurchases():e.fetchReminders()}return ze(()=>{document.addEventListener("click",M),e.fetchDueRemindersCount(),e.fetchUnreadActivitiesCount(),e.fetchUnreadPurchasesCount(),l=setInterval(()=>{e.fetchDueRemindersCount(),e.fetchUnreadActivitiesCount(),e.fetchUnreadPurchasesCount()},6e4)}),Qe(()=>{document.removeEventListener("click",M),l&&clearInterval(l)}),(D,K)=>(i(),a("div",Eo,[s("button",{class:"p-2 rounded hover:bg-gray-700 transition-colors relative",title:"Notifications",onClick:y},[Io,g.value>0?(i(),a("span",Ro,b(g.value>99?"99+":g.value),1)):k("",!0)]),r.value?(i(),a("div",Uo,[s("div",Po,[No,O(o).permission.value==="default"?(i(),a("button",{key:0,class:"text-xs text-blue-600 hover:text-blue-800",onClick:L}," Enable alerts ")):k("",!0)]),s("div",Fo,[s("button",{class:J(["flex-1 px-2 py-2 font-medium transition-colors relative",n.value==="activities"?"text-purple-600":"text-gray-500 hover:text-gray-700"]),onClick:K[0]||(K[0]=H=>F("activities"))},[X(" Activity "),O(e).unreadActivitiesCount>0?(i(),a("span",{key:0,class:J(["ml-1 px-1.5 py-0.5 text-xs rounded-full",n.value==="activities"?"bg-purple-100 text-purple-700":"bg-gray-100 text-gray-600"])},b(O(e).unreadActivitiesCount),3)):k("",!0),n.value==="activities"?(i(),a("div",Oo)):k("",!0)],2),s("button",{class:J(["flex-1 px-2 py-2 font-medium transition-colors relative",n.value==="purchases"?"text-yellow-600":"text-gray-500 hover:text-gray-700"]),onClick:K[1]||(K[1]=H=>F("purchases"))},[X(" Purchases "),O(e).unreadPurchasesCount>0?(i(),a("span",{key:0,class:J(["ml-1 px-1.5 py-0.5 text-xs rounded-full",n.value==="purchases"?"bg-yellow-100 text-yellow-700":"bg-gray-100 text-gray-600"])},b(O(e).unreadPurchasesCount),3)):k("",!0),n.value==="purchases"?(i(),a("div",Go)):k("",!0)],2),s("button",{class:J(["flex-1 px-2 py-2 font-medium transition-colors relative",n.value==="due"?"text-red-600":"text-gray-500 hover:text-gray-700"]),onClick:K[2]||(K[2]=H=>F("due"))},[X(" Due "),O(e).dueRemindersCount>0?(i(),a("span",{key:0,class:J(["ml-1 px-1.5 py-0.5 text-xs rounded-full",n.value==="due"?"bg-red-100 text-red-700":"bg-gray-100 text-gray-600"])},b(O(e).dueRemindersCount),3)):k("",!0),n.value==="due"?(i(),a("div",Lo)):k("",!0)],2),s("button",{class:J(["flex-1 px-2 py-2 font-medium transition-colors relative",n.value==="upcoming"?"text-blue-600":"text-gray-500 hover:text-gray-700"]),onClick:K[3]||(K[3]=H=>F("upcoming"))},[X(" Upcoming "),v.value.length>0?(i(),a("span",{key:0,class:J(["ml-1 px-1.5 py-0.5 text-xs rounded-full",n.value==="upcoming"?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"])},b(v.value.length),3)):k("",!0),n.value==="upcoming"?(i(),a("div",Do)):k("",!0)],2)]),n.value==="activities"?(i(),a(Y,{key:0},[O(e).loading.activities?(i(),a("div",zo,Ho)):O(e).activities.length===0?(i(),a("div",Wo," No recent activity ")):(i(),a(Y,{key:2},[O(e).unreadActivitiesCount>0?(i(),a("div",Vo,[s("button",{class:"text-xs text-purple-600 hover:text-purple-800",onClick:W}," Mark all as read ")])):k("",!0),s("div",qo,[(i(!0),a(Y,null,he(O(e).activities,H=>(i(),a("div",{key:H.id,class:J(["px-4 py-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer",{"bg-purple-50/30":!H.is_read}]),onClick:Re=>V(H)},[s("div",Ko,[s("div",Xo,[H.punter.photo_url?(i(),a("img",{key:0,src:H.punter.photo_url,alt:H.punter.username,class:"w-10 h-10 rounded-full object-cover"},null,8,Jo)):(i(),a("div",Qo,b(H.punter.username.charAt(0).toUpperCase()),1)),s("div",Zo,[(i(),a("svg",{class:J(["w-3.5 h-3.5",_(H.activity_type)]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:f(H.activity_type)},null,8,en)],2))])]),s("div",tn,[s("div",sn,[s("span",on,b(H.punter.display_name||H.punter.username),1),s("span",nn,b(T(H.created_at)),1)]),s("p",rn,[X(b(C(H.activity_type))+" ",1),H.amount?(i(),a("span",an," ("+b(H.amount)+" credits) ",1)):k("",!0)]),s("p",ln," via "+b(H.girl.display_name||H.girl.username),1)]),H.is_read?k("",!0):(i(),a("div",dn))])],10,Yo))),128))])],64))],64)):k("",!0),n.value==="purchases"?(i(),a(Y,{key:1},[O(e).loading.purchases?(i(),a("div",cn,hn)):O(e).purchases.length===0?(i(),a("div",gn," No purchases yet ")):(i(),a(Y,{key:2},[O(e).unreadPurchasesCount>0?(i(),a("div",fn,[s("button",{class:"text-xs text-yellow-700 hover:text-yellow-900",onClick:te}," Mark all as read ")])):k("",!0),s("div",pn,[(i(!0),a(Y,null,he(O(e).purchases,H=>(i(),a("div",{key:H.id,class:J(["px-4 py-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer",{"bg-yellow-50/40":!H.is_read}]),onClick:Re=>de(H)},[s("div",mn,[s("div",yn,[H.punter.photo_url?(i(),a("img",{key:0,src:H.punter.photo_url,alt:H.punter.username,class:"w-10 h-10 rounded-full object-cover"},null,8,_n)):(i(),a("div",wn,b(H.punter.username.charAt(0).toUpperCase()),1)),s("div",xn,[(i(),a("svg",kn,[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:f(H.activity_type)},null,8,bn)]))])]),s("div",Cn,[s("div",$n,[s("span",Tn,b(H.punter.display_name||H.punter.username),1),s("span",jn,b(T(H.created_at)),1)]),s("p",Mn,[X(b(C(H.activity_type))+" ",1),H.amount?(i(),a("span",Sn," · "+b(H.amount)+" credits ",1)):k("",!0)]),s("p",An," via "+b(H.girl.display_name||H.girl.username),1)]),H.is_read?k("",!0):(i(),a("div",En))])],10,vn))),128))])],64))],64)):n.value==="due"||n.value==="upcoming"?(i(),a(Y,{key:2},[O(e).loading.reminders?(i(),a("div",In,Un)):(n.value==="due"?u.value:v.value).length===0?(i(),a("div",Pn,b(n.value==="due"?"No due reminders":"No upcoming reminders"),1)):(i(),a("div",Nn,[(i(!0),a(Y,null,he(n.value==="due"?u.value:v.value,H=>(i(),a("div",{key:H.id,class:J(["px-4 py-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer",{"bg-red-50/30":n.value==="due"}]),onClick:Re=>E(H)},[s("div",On,[s("div",Gn,[H.target_user.photo_url?(i(),a("img",{key:0,src:H.target_user.photo_url,alt:H.target_user.username,class:"w-10 h-10 rounded-full object-cover"},null,8,Ln)):(i(),a("div",Dn,b(H.target_user.username.charAt(0).toUpperCase()),1))]),s("div",zn,[s("div",Bn,[s("span",Hn,b(H.target_user.display_name||H.target_user.username),1),s("span",{class:J(["text-xs flex-shrink-0",n.value==="due"?"text-red-600":"text-gray-500"])},b(T(H.remind_at)),3)]),s("p",Wn," via "+b(H.girl.display_name||H.girl.username),1),H.note?(i(),a("p",Vn,b(H.note),1)):k("",!0)])]),s("div",qn,[n.value==="due"?(i(),a("button",{key:0,class:"px-2 py-1 text-xs font-medium text-green-700 hover:bg-green-100 rounded transition-colors",onClick:ke(Re=>w(H),["stop"])}," Complete ",8,Yn)):k("",!0),s("button",{class:"px-2 py-1 text-xs font-medium text-red-600 hover:bg-red-100 rounded transition-colors",onClick:ke(Re=>A(H),["stop"])}," Delete ",8,Kn)])],10,Fn))),128))]))],64)):k("",!0)])):k("",!0)]))}}),Jn={class:"online-unread-center relative"},Qn=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1),Zn={key:0,class:"absolute -top-0.5 -right-0.5 min-w-4 h-4 px-1 bg-x-green-1 rounded-full flex items-center justify-center text-[10px] font-medium text-white"},ei={key:0,class:"absolute right-0 top-full mt-2 w-80 bg-white rounded-lg shadow-lg border border-gray-200 z-50 max-h-[70vh] overflow-hidden flex flex-col"},ti={class:"px-4 py-3 border-b border-gray-200 flex-shrink-0"},si={class:"flex items-center justify-between"},oi=s("h3",{class:"font-semibold text-gray-800"},"Online with unread",-1),ni={class:"text-xs text-gray-500"},ii=s("p",{class:"text-xs text-gray-500 mt-0.5"}," Punters online right now waiting for a reply. ",-1),ri={key:0,class:"flex items-center justify-center py-8"},ai=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),li=[ai],di={key:1,class:"py-8 text-center text-gray-500 text-sm"},ci={key:2,class:"overflow-y-auto flex-1"},ui=["onClick"],hi={class:"flex items-start gap-3"},gi={class:"relative flex-shrink-0"},fi=["src","alt"],pi={key:1,class:"w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-sm font-bold text-gray-600"},vi=s("span",{class:"absolute bottom-0 right-0 w-3 h-3 bg-x-green-1 border-2 border-white rounded-full"},null,-1),mi={class:"flex-1 min-w-0"},yi={class:"flex items-center justify-between gap-2"},_i={class:"font-medium text-sm text-gray-900 truncate"},wi={class:"text-xs text-gray-500 flex-shrink-0"},xi={class:"text-xs text-gray-500 truncate mt-0.5"},ki={key:0,class:"inline-flex items-center mt-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full bg-x-green-1/15 text-x-green-1"},bi=je({__name:"ChatterOnlineUnreadCenter",setup(t){const e=Ee(),o=I(!1);let r=null;function n(){o.value=!o.value,o.value&&e.fetchOnlineUnreadPunters()}function l(){o.value=!1}function u(f){f.target.closest(".online-unread-center")||l()}function v(f){const C=new Date(f),y=new Date().getTime()-C.getTime(),x=Math.round(y/(1e3*60)),M=Math.round(y/(1e3*60*60));return x<1?"just now":x<60?`${x}m ago`:M<24?`${M}h ago`:C.toLocaleDateString([],{month:"short",day:"numeric"})}function g(f){e.navigateToOnlineUnreadPunter(f),l()}return ze(()=>{document.addEventListener("click",u),e.fetchOnlineUnreadPunters(),r=setInterval(()=>{e.fetchOnlineUnreadPunters()},6e4)}),Qe(()=>{document.removeEventListener("click",u),r&&clearInterval(r)}),(f,C)=>(i(),a("div",Jn,[s("button",{class:"p-2 rounded hover:bg-gray-700 transition-colors relative",title:"Online with unread messages",onClick:n},[Qn,O(e).onlineUnreadCount>0?(i(),a("span",Zn,b(O(e).onlineUnreadCount>99?"99+":O(e).onlineUnreadCount),1)):k("",!0)]),o.value?(i(),a("div",ei,[s("div",ti,[s("div",si,[oi,s("span",ni,b(O(e).onlineUnreadPunters.length)+" live ",1)]),ii]),O(e).loading.onlineUnread?(i(),a("div",ri,li)):O(e).onlineUnreadPunters.length===0?(i(),a("div",di," No online punters with unread messages right now ")):(i(),a("div",ci,[(i(!0),a(Y,null,he(O(e).onlineUnreadPunters,_=>(i(),a("button",{key:_.conversation_id,class:"w-full px-4 py-3 border-b border-gray-100 hover:bg-gray-50 cursor-pointer text-left",onClick:y=>g(_)},[s("div",hi,[s("div",gi,[_.punter.photo_url?(i(),a("img",{key:0,src:_.pu
1nter.photo_url,alt:_.punter.username,class:"w-10 h-10 rounded-full object-cover"},null,8,fi)):(i(),a("div",pi,b(_.punter.username.charAt(0).toUpperCase()),1)),vi]),s("div",mi,[s("div",yi,[s("span",_i,b(_.punter.display_name||_.punter.username),1),s("span",wi,b(v(_.last_message_at)),1)]),s("p",xi," via "+b(_.girl.display_name||_.girl.username),1),_.unread_count>0?(i(),a("span",ki,b(_.unread_count)+" unread ",1)):k("",!0)])])],8,ui))),128))]))])):k("",!0)]))}}),mt=["#EF4444","#F97316","#F59E0B","#10B981","#06B6D4","#3B82F6","#6366F1","#8B5CF6","#EC4899","#64748B"],Ci={class:"bg-white rounded-xl shadow-xl w-full max-w-md max-h-[80vh] flex flex-col"},$i={class:"flex items-center justify-between px-5 py-3 border-b border-x-grey-1"},Ti=s("h3",{class:"font-semibold text-gray-800"},"Manage tags",-1),ji=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),Mi=[ji],Si={class:"px-5 py-3 border-b border-x-grey-1"},Ai=s("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"New tag",-1),Ei={class:"flex items-center gap-2"},Ii=["disabled"],Ri={class:"flex items-center gap-1.5 mt-2"},Ui=["onClick"],Pi=["value"],Ni=s("div",{class:"flex-1"},null,-1),Fi={class:"flex rounded-full border border-x-grey-1 overflow-hidden"},Oi=["onClick"],Gi={key:0,class:"flex items-center gap-2 mt-2 text-xs text-gray-600 cursor-pointer"},Li={class:"flex-1 overflow-y-auto px-5 py-2"},Di={key:0,class:"text-sm text-gray-400 py-4 text-center"},zi={key:0,class:"flex items-center gap-2"},Bi=["title"],Hi={class:"truncate"},Wi={class:"text-[10px] text-x-grey-15 bg-x-grey-2 px-1.5 py-0.5 rounded-full"},Vi={key:0,class:"text-[10px] text-red-600 bg-red-50 px-1.5 py-0.5 rounded-full",title:"Punters with this tag are excluded from bulk sends"},qi=s("div",{class:"flex-1"},null,-1),Yi=["onClick"],Ki=["onClick"],Xi={key:1,class:"flex flex-col gap-2"},Ji={class:"flex items-center gap-2"},Qi=["onKeyup"],Zi=["onClick"],er={class:"flex items-center gap-1.5"},tr=["onClick"],sr=["value"],or=s("div",{class:"flex-1"},null,-1),nr={class:"flex rounded-full border border-x-grey-1 overflow-hidden"},ir=["onClick"],rr={key:0,class:"flex items-center gap-2 text-xs text-gray-600 cursor-pointer"},ks=je({__name:"ChatterTagEditor",emits:["close"],setup(t,{emit:e}){const o=[{value:"girls",label:"Girls"},{value:"media",label:"Media"},{value:"both",label:"Both"}];function r(L){var F;return((F=o.find(D=>D.value===(L??"both")))==null?void 0:F.label)??"Both"}const n=e,l=Ee(),u=ht(),v=R(()=>u.canManageChatterTags()),g=I(""),f=I(mt[0]),C=I("both"),_=I(!1),y=I(!1),x=I(null),M=I(""),T=I(""),w=I("both"),A=I(!1);async function E(){const L=g.value.trim();if(!L||y.value)return;y.value=!0;const F=await l.createTag(L,f.value,C.value,_.value);y.value=!1,F&&(g.value="",f.value=mt[0],C.value="both",_.value=!1)}function V(L){x.value=L.id,M.value=L.name,T.value=L.color,w.value=L.type??"both",A.value=L.excluded_from_bulk??!1}function de(){x.value=null}async function W(L){const F=M.value.trim();F&&(await l.updateTag(L,{name:F,color:T.value,type:w.value,excluded_from_bulk:A.value}),x.value=null)}async function te(L){confirm("Delete this tag? It will be removed from every conversation.")&&(await l.deleteTag(L),x.value===L&&(x.value=null))}return(L,F)=>(i(),Me(lt,{to:"body"},[s("div",{class:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 p-4",onMousedown:F[7]||(F[7]=ke(D=>n("close"),["self"]))},[s("div",Ci,[s("div",$i,[Ti,s("button",{class:"text-gray-400 hover:text-gray-600",onClick:F[0]||(F[0]=D=>n("close"))},Mi)]),s("div",Si,[Ai,s("div",Ei,[Ie(s("input",{"onUpdate:modelValue":F[1]||(F[1]=D=>g.value=D),type:"text",maxlength:"30",placeholder:"Tag name",class:"flex-1 h-8 text-sm text-black px-2 rounded-lg border border-x-grey-1 focus:outline-none focus:border-x-pink-1",onKeyup:jt(E,["enter"])},null,544),[[Oe,g.value]]),s("button",{type:"button",class:"h-8 px-3 text-sm font-medium text-white bg-x-pink-1 rounded-lg disabled:opacity-50",disabled:!g.value.trim()||y.value,onClick:E}," Add ",8,Ii)]),s("div",Ri,[(i(!0),a(Y,null,he(O(mt),D=>(i(),a("button",{key:D,type:"button",class:J(["w-5 h-5 rounded-full transition-transform",f.value===D?"ring-2 ring-offset-1 ring-gray-700 scale-110":""]),style:Je({backgroundColor:D}),onClick:K=>f.value=D},null,14,Ui))),128)),s("input",{type:"color",value:f.value,title:"Custom colour",class:"w-5 h-5 rounded cursor-pointer border border-x-grey-1 p-0 bg-transparent flex-shrink-0",onInput:F[2]||(F[2]=D=>f.value=D.target.value)},null,40,Pi),Ni,s("div",Fi,[(i(),a(Y,null,he(o,D=>s("button",{key:D.value,type:"button",class:J(["px-2 first:pl-3 last:pr-3 h-6 text-[11px] font-medium transition-colors",C.value===D.value?"bg-x-pink-1 text-white":"text-gray-500 hover:bg-x-grey-2"]),onClick:K=>C.value=D.value},b(D.label),11,Oi)),64))])]),v.value?(i(),a("label",Gi,[Ie(s("input",{"onUpdate:modelValue":F[3]||(F[3]=D=>_.value=D),type:"checkbox",class:"w-3.5 h-3.5 accent-x-pink-1"},null,512),[[os,_.value]]),X(" Exclude from bulk ")])):k("",!0)]),s("div",Li,[O(l).tags.length===0?(i(),a("p",Di,"No tags yet.")):k("",!0),(i(!0),a(Y,null,he(O(l).tags,D=>(i(),a("div",{key:D.id,class:"py-2 border-b border-x-grey-1 last:border-b-0"},[x.value!==D.id?(i(),a("div",zi,[s("span",{class:"inline-flex items-center px-2 h-6 rounded-full text-xs font-medium text-white max-w-[220px] min-w-0",style:Je({backgroundColor:D.color}),title:D.name},[s("span",Hi,b(D.name),1)],12,Bi),s("span",Wi,b(r(D.type)),1),v.value&&D.excluded_from_bulk?(i(),a("span",Vi," No bulk ")):k("",!0),qi,s("button",{class:"text-xs text-gray-500 hover:text-x-pink-1",onClick:K=>V(D)},"Edit",8,Yi),s("button",{class:"text-xs text-red-500 hover:text-red-700",onClick:K=>te(D.id)},"Delete",8,Ki)])):(i(),a("div",Xi,[s("div",Ji,[Ie(s("input",{"onUpdate:modelValue":F[4]||(F[4]=K=>M.value=K),type:"text",maxlength:"30",class:"flex-1 h-8 text-sm text-black px-2 rounded-lg border border-x-grey-1 focus:outline-none focus:border-x-pink-1",onKeyup:jt(K=>W(D.id),["enter"])},null,40,Qi),[[Oe,M.value]]),s("button",{class:"h-8 px-3 text-sm font-medium text-white bg-x-pink-1 rounded-lg",onClick:K=>W(D.id)}
1,"Save",8,Zi),s("button",{class:"h-8 px-2 text-sm text-gray-500",onClick:de},"Cancel")]),s("div",er,[(i(!0),a(Y,null,he(O(mt),K=>(i(),a("button",{key:K,type:"button",class:J(["w-5 h-5 rounded-full transition-transform",T.value===K?"ring-2 ring-offset-1 ring-gray-700 scale-110":""]),style:Je({backgroundColor:K}),onClick:H=>T.value=K},null,14,tr))),128)),s("input",{type:"color",value:T.value,title:"Custom colour",class:"w-5 h-5 rounded cursor-pointer border border-x-grey-1 p-0 bg-transparent flex-shrink-0",onInput:F[5]||(F[5]=K=>T.value=K.target.value)},null,40,sr),or,s("div",nr,[(i(),a(Y,null,he(o,K=>s("button",{key:K.value,type:"button",class:J(["px-2 first:pl-3 last:pr-3 h-6 text-[11px] font-medium transition-colors",w.value===K.value?"bg-x-pink-1 text-white":"text-gray-500 hover:bg-x-grey-2"]),onClick:H=>w.value=K.value},b(K.label),11,ir)),64))])]),v.value?(i(),a("label",rr,[Ie(s("input",{"onUpdate:modelValue":F[6]||(F[6]=K=>A.value=K),type:"checkbox",class:"w-3.5 h-3.5 accent-x-pink-1"},null,512),[[os,A.value]]),X(" Exclude from bulk ")])):k("",!0)]))]))),128))])])],32)]))}}),ar={class:"tag-center relative"},lr=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 7h.01M7 3h5a1.99 1.99 0 011.414.586l7 7a2 2 0 010 2.828l-5 5a2 2 0 01-2.828 0l-7-7A2 2 0 014 9V4a1 1 0 011-1z"})],-1),dr=["title"],cr={key:0,class:"absolute right-0 top-full mt-2 w-72 bg-white rounded-lg shadow-lg border border-gray-200 z-50 max-h-[70vh] overflow-hidden flex flex-col"},ur={class:"px-4 py-3 border-b border-gray-200 flex-shrink-0 flex items-center justify-between"},hr=s("h3",{class:"font-semibold text-gray-800"},"Filter by tags",-1),gr=s("p",{class:"px-4 pt-2 text-[11px] text-gray-400 flex-shrink-0"}," Select one or more tags — shows conversations with any of them, across all your girls. ",-1),fr={class:"overflow-y-auto flex-1 py-1"},pr=["onClick"],vr={key:0,xmlns:"http://www.w3.org/2000/svg",class:"w-3 h-3 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"3"},mr=s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1),yr=[mr],_r={class:"flex-1 text-sm text-gray-700 truncate"},wr={key:0,class:"px-4 py-6 text-center text-xs text-gray-400"},xr=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1),kr=je({__name:"ChatterTagCenter",setup(t){const e=Ee(),o=ht(),r=I(!1);Fe(r,x=>{x&&e.fetchTags()});const n=I(!1),l=R(()=>o.canManageChatterTags()),u=R(()=>e.tags.filter(x=>e.activeTagFilterIds.includes(x.id)));function v(x){return e.activeTagFilterIds.includes(x)}function g(){r.value=!r.value}function f(){r.value=!1}function C(x){e.toggleTagFilter(x)}function _(){e.clearTagFilter()}function y(x){x.target.closest(".tag-center")||f()}return ze(()=>document.addEventListener("click",y)),Qe(()=>document.removeEventListener("click",y)),(x,M)=>(i(),a("div",ar,[s("button",{class:"p-2 rounded hover:bg-gray-700 transition-colors relative",title:"Tags — filter across all girls",onClick:g},[lr,u.value.length>0?(i(),a("span",{key:0,class:"absolute -top-0.5 -right-0.5 min-w-4 h-4 px-1 bg-x-pink-1 rounded-full border-2 border-gray-900 flex items-center justify-center text-[9px] font-medium leading-none",title:`Filtering by ${u.value.map(T=>T.name).join(", ")}`},b(u.value.length),9,dr)):k("",!0)]),r.value?(i(),a("div",cr,[s("div",ur,[hr,u.value.length>0?(i(),a("button",{key:0,class:"text-xs text-x-pink-1 hover:underline",onClick:_}," Clear all ")):k("",!0)]),gr,s("div",fr,[(i(!0),a(Y,null,he(O(e).conversationTags,T=>(i(),a("button",{key:T.id,type:"button",class:J(["w-full flex items-center gap-2 px-4 py-2 text-left hover:bg-gray-50",v(T.id)?"bg-gray-50":""]),onClick:w=>C(T.id)},[s("span",{class:J(["w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 transition-colors",v(T.id)?"border-transparent":"border-gray-300"]),style:Je(v(T.id)?{backgroundColor:T.color}:{})},[v(T.id)?(i(),a("svg",vr,yr)):k("",!0)],6),s("span",{class:"w-3 h-3 rounded-full flex-shrink-0",style:Je({backgroundColor:T.color})},null,4),s("span",_r,b(T.name),1)],10,pr))),128)),O(e).conversationTags.length===0?(i(),a("p",wr,b(l.value?"No tags yet. Create one below.":"No tags yet."),1)):k("",!0)]),l.value?(i(),a("button",{key:0,t
1ype:"button",class:"flex items-center gap-1.5 px-4 py-2.5 text-xs font-medium text-gray-600 hover:text-x-pink-1 hover:bg-gray-50 border-t border-x-grey-1 flex-shrink-0",onClick:M[0]||(M[0]=T=>n.value=!0)},[xr,X(" Create / edit tags ")])):k("",!0)])):k("",!0),n.value?(i(),Me(ks,{key:1,onClose:M[1]||(M[1]=T=>n.value=!1)})):k("",!0)]))}}),br={class:"flex items-center bg-gray-900 text-white h-14 flex-shrink-0 w-full max-w-full overflow-x-clip"},Cr=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1),$r=[Cr],Tr={key:0,class:"flex items-center gap-2 px-3"},jr=s("div",{class:"w-5 h-5 border-2 border-gray-600 border-t-white rounded-full animate-spin"},null,-1),Mr=s("span",{class:"text-sm text-gray-400"},"Loading...",-1),Sr=[jr,Mr],Ar=["onClick"],Er={class:"relative"},Ir=["src","alt"],Rr={key:1,class:"w-8 h-8 rounded-full bg-gray-500 flex items-center justify-center text-xs font-bold"},Ur={key:2,class:"absolute -top-1 -right-1 flex items-center gap-0.5"},Pr=["title"],Nr=["title"],Fr={class:"text-sm font-medium max-w-[100px] truncate"},Or=["onClick"],Gr=s("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Lr=[Gr],Dr=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1),zr=[Dr],Br={class:"flex items-center gap-2 px-3 border-l border-gray-700 flex-shrink-0"},Hr=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1),Wr=[Hr],Vr=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})],-1),qr=[Vr],Yr=je({__name:"ChatterGirlTabs",setup(t){const e=Ee(),o=Us(),r=ht(),n=I(null);Fe(()=>e.selectedGirlId,()=>{Tt(()=>{var M;(M=n.value)==null||M.scrollTo({left:0,behavior:"smooth"})})});const l=R(()=>{if(!e.isTagFilterActive)return e.visibleTabs;const M=new Set(e.tagFilterGirlIds);return e.visibleTabs.filter(T=>M.has(T.id))}),u=R(()=>r.hasAnyRole([vt.PUNTER,vt.ESCORT,vt.MANAGER,vt.VENUE])||!1);function v(M){e.selectGirl(M)}function g(M,T){M.stopPropagation(),e.closeTab(T)}function f(){n.value&&n.value.scrollBy({left:-200,behavior:"smooth"})}function C(M){const T=n.value;if(!T)return;const w=Math.abs(M.deltaY)>Math.abs(M.deltaX)?M.deltaY:M.deltaX;w!==0&&T.scrollWidth>T.clientWidth&&(T.scrollLeft+=w,M.preventDefault())}function _(){n.value&&n.value.scrollBy({left:200,behavior:"smooth"})}function y(){window.location.href=Ps(Ns.USERS_ACCOUNT,!0)}function x(){o.logout()}return(M,T)=>(i(),a("div",br,[s("button",{class:"px-2 h-full hover:bg-gray-700 flex-shrink-0",onClick:f},$r),s("div",{ref_key:"tabsContainer",ref:n,class:"flex-1 min-w-0 flex items-center overflow-x-auto gap-1 px-1 [scrollbar-width:none]",onWheel:C},[O(e).loading.girls?(i(),a("div",Tr,Sr)):k("",!0),(i(!0),a(Y,null,he(l.value,w=>(i(),a("button",{key:w.id,class:J(["flex items-center gap-2 px-3 py-2 rounded-md whitespace-nowrap flex-shrink-0 transition-colors group relative",O(e).selectedGirlId===w.id?"bg-gray-600":"hover:bg-gray-700"]),onClick:A=>v(w.id)},[s("div",Er,[w.photo_url?(i(),a("img",{key:0,src:w.photo_url,alt:w.display_name||w.username,class:"w-8 h-8 rounded-full object-cover"},null,8,Ir)):(i(),a("div",Rr,b((w.display_name||w.username).charAt(0).toUpperCase()),1)),O(e).girlUnreadCounts[w.id]>0||O(e).onlineUnreadCountByGirl[w.id]>0?(i(),a("div",Ur,[O(e).onlineUnreadCountByGirl[w.id]>0?(i(),a("span",{key:0,class:"min-w-4 h-4 px-1 bg-x-green-1 rounded-full border-2 border-gray-900 flex items-center justify-center text-[10px] font-medium text-white",title:`${O(e).onlineUnreadCountByGirl[w.id]} online with unread`},b(O(e).onlineUnreadCountByGirl[w.id]>99?"99+":O(e).onlineUnreadCountByGirl[w.id]),9,Pr)):k("",!0),O(e).girlUnreadCounts[w.id]>0?(i(),a("span",{key:1,class:"min-w-4 h-4 px-1 bg-x-pink-1 rounded-full border-2 border-gray-900 flex items-center justify-center text-[10px] font-medium",title:`${O(e).girlUnreadCounts[w.id]} unread`},b(O(e).girlUnreadCounts[w.id]>99?"99+":O(e).girlUnreadCounts[w.id]),9,Nr)):k("",!0)])):k("",!0)]),s("span",Fr,b(w.display_name||w.username),1),O(e).selectedGirlId!==w.id?(i(),a("button",{key:0,class:"absolute -top-1 -right-1 w-5 h-5 bg-gray-700 hover:bg-gray-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",title:"Close tab",onClick:A=>g(A,w.id)},Lr,8,Or)):k("",!0)],10,Ar))),128))],544),s("button",{class:"px-2 h-full hover:bg-gray-700 flex-shrink-0",onClick:_},zr),s("div",Br,[pe(bi),pe(Xn),pe(kr),pe(Ao),u.value?(i(),a("button",{key:0,class:"p-2 rounded hover:bg-gray-700 transition-colors",title:"My Account",onClick:y},Wr)):k("",!0),s("button",{class:"p-2 rounded hover:bg-gray-700 transition-colors text-gray-400 hover:text-white",title:"Logout",onClick:x},qr)])]))}}),Kr={class:"bg-white rounded-2xl shadow-xl w-[680px] max-h-[80vh] flex flex-col"},Xr={class:"flex items-center justify-between px-4 py-3 border-b border-x-grey-1 flex-shrink-0"},Jr={class:"font-semibold text-gray-900"},Qr=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),Zr=[Qr],ea={class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},ta={key:0,class:"w-8 h-8 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},sa=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1),oa=[sa],na={key:1,class:"w-8 h-8 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ia=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1),ra=[ia],aa={class:"text-lg font-semibold text-gray-900 mb-1"},la={class:"text-sm text-gray-500"},da={key:0,class:"mt-4 w-full max-w-xs"},ca=s("p",{class:"text-xs font-medium text-gray-700 mb-2"},"Failed to send:",-1),ua={class:"space-y-1"},ha={class:"text-gray-700 truncate"},ga={class:"text-red-600 ml-2 whitespace-nowrap"},fa={class:"px-4 py-3 border-t border-x-grey-1 flex justify-end"},pa=s("span",{class:"!py-1.5 !px-3 !text-xs"},"Done",-1),va={key:0,class:"px-4 py-3 border-b border-x-grey-1 flex-shrink-0"},ma={class:"flex items-center gap-2"}
1,ya={class:"flex -space-x-2"},_a=["src"],wa={key:0,class:"absolute inset-0 flex items-center justify-center bg-black/20"},xa=s("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[s("path",{d:"M6.3 2.841A1.5 1.5 0 004 4.11V15.89a1.5 1.5 0 002.3 1.269l9.344-5.89a1.5 1.5 0 000-2.538L6.3 2.84z"})],-1),ka=[xa],ba={key:0,class:"w-10 h-10 rounded-lg bg-x-grey-2 border-2 border-white flex items-center justify-center text-xs font-medium text-gray-500"},Ca={class:"text-xs text-gray-500"},$a={class:"flex border-b border-x-grey-1 flex-shrink-0"},Ta=["onClick"],ja={key:0,class:"ml-1 text-xs"},Ma={key:1,class:"ml-1 inline-block w-3 h-3 border border-x-pink-1 border-t-transparent rounded-full animate-spin"},Sa={key:2,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-x-pink-1"},Aa={class:"flex items-center justify-between px-4 py-2 border-b border-x-grey-1 flex-shrink-0 bg-x-grey-1/30"},Ea={class:"text-xs text-gray-500"},Ia={class:"font-medium"},Ra={key:0,class:"ml-2 text-x-green-1 font-medium"},Ua={class:"flex-1 overflow-y-auto min-h-[200px]"},Pa={key:0,class:"p-4 border-b border-x-grey-1 bg-gray-50"},Na=s("label",{class:"block text-xs font-medium text-gray-600 mb-2"}," Enter punter IDs or usernames (one per line, or comma-separated) ",-1),Fa=["onKeydown"],Oa={class:"flex items-center justify-between mt-2"},Ga=s("span",{class:"text-xs text-gray-400"},"One entry per line (supports usernames with spaces)",-1),La={class:"flex gap-2"},Da=["disabled"],za={key:0,class:"mt-3 space-y-1"},Ba={key:0,class:"text-xs text-red-500"},Ha={key:1,class:"text-xs text-orange-500"},Wa={key:2,class:"text-xs text-gray-500"},Va={key:1,class:"flex items-center justify-center py-12"},qa=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),Ya=[qa],Ka={key:2,class:"flex items-center justify-center py-12 text-gray-400 text-sm"},Xa={key:3,class:"flex items-center justify-center py-8 text-gray-400 text-sm"},Ja=["disabled","onClick"],Qa={key:0,class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Za=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1),el=[Za],tl={class:"relative flex-shrink-0"},sl=["src","alt"],ol={key:1,class:"w-10 h-10 rounded-full bg-x-grey-2 flex items-center justify-center text-sm font-bold text-gray-500"},nl={key:2,class:"absolute bottom-0 right-0 w-3 h-3 bg-x-green-1 border-2 border-white rounded-full"},il=["title"],rl=s("svg",{class:"w-2.5 h-2.5 font-bold",fill:"none",stroke:"currentColor","stroke-width":"3",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v18M7 8c0-1.5 2-3 5-3s5 1.5 5 3c0 2-2 3-5 3s-5 1-5 3c0 1.5 2 3 5 3s5-1.5 5-3"})],-1),al={class:"flex-1 min-w-0"},ll={class:"font-medium text-sm text-gray-900 truncate block"},dl={class:"text-xs text-gray-400 truncate block"},cl={key:0,class:"text-[11px] text-red-500 truncate block"},ul={key:1,class:"text-[11px] text-x-pink-1/90 truncate block"},hl=["disabled"],gl={key:1,class:"px-4 py-3 border-t border-x-grey-1 flex-shrink-0 bg-green-50/50"},fl={class:"flex items-center justify-between mb-2"},pl={class:"text-xs font-medium text-gray-700"},vl={class:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto"},ml={class:"truncate max-w-[120px]"},yl=["onClick"],_l=s("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),wl=[_l],xl={class:"px-4 py-3 border-t border-x-grey-1 flex-shrink-0 space-y-2"},kl={class:"flex gap-3"},bl={class:"flex-1"},Cl={class:"block text-xs font-medium text-gray-600 mb-1"},$l=["placeholder"],Tl={key:0,class:"w-28"},jl=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Price (credits)",-1),Ml=["value"],Sl={class:"flex items-center justify-between px-4 py-3 border-t border-x-grey-1 flex-shrink-0"},Al={class:"text-sm text-x-grey-15"},El={class:"flex gap-2"},Il={class:"!py-1.5 !px-3 !text-xs"},gs=500,Wt=50,Rl=200,bs=je({__name:"ChatterSendToConversationsModal",props:{mediaIds:{default:()=>[]},mediaItems:{default:()=>[]},galleryPhotoIds:{default:()=>[]},galleryVideoIds:{default:()=>[]},girlId:{default:void 0}},emits:["close","sent"],setup(t,{emit:e}){const o=t,r=R(()=>o.girlId??u.selectedGirlId),n=R(()=>o.mediaIds.length===0&&o.galleryPhotoIds.length===0&&o.galleryVideoIds.length===0),l=e,u=Ee(),v=le(),g=Mt(),f=ht();let C=[];function _(d){return d?g.isUserOnline(d):!1}const y=I("threads"),x=I(new Set),M=I("0"),T=I(""),w=I(!1),A=I(!1),E=I({messagesSent:0,failed:0,failedDetail
1s:[]}),V=I(new Map),de=new Set;let W=null;const te=I(!1),L=I(!1),F=I(!1),D=I(!1),K=I(!1),H=I([]),Re=I([]),_e=I([]),Se=I(""),z=I([]),oe=I({not_found:[],blocked:[],inactive:[]}),ge=I([]),be=I(1),Ge=I(!1),Ae=I(!1),qe=R(()=>ge.value.map(d=>{const c=He(d),h=c==null?void 0:c.is_active;return!c||h!=null&&!h?null:{id:c.id,username:c.username,display_name:c.display_name||void 0,photo_url:c.photo_url||void 0,total_spent:c.total_spent||0,source:"thread"}}).filter(d=>d!==null)),ne=R(()=>H.value.filter(d=>{var c;return(c=d.user)==null?void 0:c.id}).sort((d,c)=>{const h=d.last_viewed_at||"",S=c.last_viewed_at||"";return new Date(S).getTime()-new Date(h).getTime()}).map(d=>({id:d.user.id,username:d.user.username,display_name:d.user.display_name,photo_url:d.user.photo_url,total_spent:d.user.total_spent||0,source:"viewer",total_views:d.total_views,last_viewed_at:d.last_viewed_at}))),Z=R(()=>Re.value.filter(d=>{var c;return(c=d.user)==null?void 0:c.id}).sort((d,c)=>{const h=d.subscribed_at||"",S=c.subscribed_at||"";return new Date(S).getTime()-new Date(h).getTime()}).map(d=>({id:d.user.id,username:d.user.username,display_name:d.user.display_name,photo_url:d.user.photo_url,total_spent:d.user.total_spent||0,source:"subscriber"}))),Te=R(()=>_e.value.filter(d=>{var c;return(c=d.user)==null?void 0:c.id}).map(d=>({id:d.user.id,username:d.user.username,display_name:d.user.display_name,photo_url:d.user.photo_url,total_spent:d.user.total_spent||0,source:"online"}))),se=R(()=>{switch(y.value){case"threads":return qe.value;case"viewers":return ne.value;case"subscribers":return Z.value;case"online":return Te.value;case"manual":return z.value;default:return[]}}),Ce=R(()=>{const d=new Map;return[qe.value,ne.value,Z.value,Te.value,z.value].flat().forEach(c=>d.set(c.id,c)),d}),Ue=R(()=>f.hasAnyRole([vt.CORE_ADMIN,vt.GOD_ADMIN,vt.SUPER_GOD_ADMIN])||!1),Ye=R(()=>{const d=[];return Ue.value&&d.push({value:"threads",label:"Threads",count:qe.value.length,loading:te.value}),d.push({value:"viewers",label:"Viewers",count:ne.value.length,loading:L.value},{value:"subscribers",label:"Subscribers",count:Z.value.length,loading:F.value},{value:"online",label:"Online Now",count:Te.value.length,loading:D.value}),Ue.value&&d.push({value:"manual",label:"Manual",count:z.value.length,loading:K.value}),d}),ot=R(()=>Array.from(x.value).map(d=>Ce.value.get(d)).filter(d=>d!==void 0)),N=R(()=>x.value.size>0),ie=R(()=>{switch(y.value){case"online":return"live_now";case"viewers":return"viewed_profile";default:return}}),fe=R(()=>!(!N.value||n.value&&!T.value.trim())),G=R(()=>o.mediaItems.slice(0,3)),Le=R(()=>o.mediaIds.length+o.galleryPhotoIds.length+o.galleryVideoIds.length),Ke=R(()=>Math.max(0,o.mediaItems.length-3));function He(d){return r.value&&d.initiator_user.id===r.value?d.recipient_user:d.initiator_user}function De(d){return d.small_thumbnail_url||d.thumbnail_url||d.url||""}function We(d){return d.media_type==="video"||d.type==="video"}
1function nt(d){return d>=1e3?(d/1e3).toFixed(1)+"k":String(d)}function gt(d){if(!d)return"";const c=new Date(d.replace(" ","T"));if(isNaN(c.getTime()))return"";const h=new Date,S=new Date(h.getFullYear(),h.getMonth(),h.getDate()),U=new Date(c.getFullYear(),c.getMonth(),c.getDate()),B=Math.round((S.getTime()-U.getTime())/864e5);return B<=0?"today":B===1?"yesterday":B<7?`${B} days ago`:c.toLocaleDateString()}function dt(d){const c=d.target,h=Math.max(0,Math.floor(Number(c.value)||0));M.value=String(h)}function Be(d){if(st(d))return;const c=new Set(x.value);c.has(d)?c.delete(d):c.add(d),x.value=c}function st(d){return V.value.get(d)??null}function St(){W&&clearTimeout(W),W=setTimeout(()=>{W=null,yt(se.value.map(d=>d.id))},300)}async function yt(d){const c=r.value;if(!c)return;const h=d.filter(S=>!V.value.has(S)&&!de.has(S));if(h.length!==0){h.forEach(S=>de.add(S));try{for(let S=0;S<h.length;S+=gs){const U=h.slice(S,S+gs),B=await v.getBulkEligibility(c,U),Q=new Map(V.value);U.forEach(ve=>Q.set(ve,B[ve]??null)),V.value=Q;const ce=new Set(x.value);let q=!1;U.forEach(ve=>{Q.get(ve)&&ce.has(ve)&&(ce.delete(ve),q=!0)}),q&&(x.value=ce)}}catch(S){console.error("Failed to fetch bulk eligibility:",S)}finally{h.forEach(S=>de.delete(S))}}}function At(d){return x.value.has(d)}function Et(){x.value=new Set}function It(d){const c=new Set(x.value);c.delete(d),x.value=c}async function Rt(){var d;if(r.value){te.value=!0;try{const c=await v.getConversations(r.value,void 0,1,Wt);ge.value=(c==null?void 0:c.data)??[],be.value=1;const h=c==null?void 0:c.meta;Ge.value=h&&h.current_page!==void 0&&h.last_page!==void 0?h.current_page<h.last_page:(((d=c==null?void 0:c.data)==null?void 0:d.length)??0)===Wt}catch(c){console.error("Failed to fetch thread recipients:",c),Ge.value=!1}finally{te.value=!1}}}async function Ut(){if(!(!r.value||!Ge.value||Ae.value)){Ae.value=!0;try{const d=be.value+1,c=await v.getConversations(r.value,void 0,d,Wt),h=(c==null?void 0:c.data)??[];ge.value=[...ge.value,...h],be.value=d;const S=c==null?void 0:c.meta;Ge.value=S&&S.current_page!==void 0&&S.last_page!==void 0?S.current_page<S.last_page:h.length===Wt}catch(d){console.error("Failed to load more thread recipients:",d)}finally{Ae.value=!1}}}async function _t(){if(r.value){L.value=!0;try{const d=await v.getProfileViewers(r.value);H.value=d.data||[]}catch(d){console.error("Failed to fetch profile viewers:",d)}finally{L.value=!1}}}async function wt(){if(r.value){F.value=!0;try{const d=await v.getGallerySubscribers(r.value);Re.value=d.data||[]}catch(d){console.error("Failed to fetch gallery subscribers:",d)}finally{F.value=!1}}}async function Nt(){if(r.value){D.value=!0;try{const d=await v.getOnlinePunters(r.value);_e.value=d.data||[]}catch(d){console.error("Failed to fetch online punters:",d)}finally{D.value=!1}}}async function xt(){if(!(!r.value||!Se.value.trim())){K.value=!0,oe.value={not_found:[],blocked:[],inactive:[]};try{const d=await v.lookupUsers(r.value,Se.value),c=new Set(z.value.map(S=>S.id)),h=d.data.filter(S=>!c.has(S.id)).map(S=>({id:S.id,username:S.username,display_name:S.display_name||void 0,photo_url:S.photo_url||void 0,total_spent:0,source:"thread"}));if(z.value=[...z.value,...h],oe.value={not_found:d.not_found,blocked:d.blocked,inactive:d.inactive},h.forEach(S=>{x.value.add(S.id)}),x.value=new Set(x.value),Se.value="",h.length>0){const S=h.map(U=>U.id);g.watchUsers(S)}}catch(d){console.error("Failed to lookup users:",d)}finally{K.value=!1}}}function Ft(){Se.value="",oe.value={not_found:[],blocked:[],inactive:[]}}function kt(){const d=se.value.slice(0,Rl).map(c=>c.id).filter((c,h,S)=>S.indexOf(c)===h);C.length>0&&g.unwatchUsers(C),C=d,d.length>0&&g.watchUsers(d)}async function Ot(){if(!(!r.value||!N.value||w.value)){w.value=!0;try{const d=await v.sendMediaToUsers(r.value,o.mediaIds,Array.from(x.value),Number(M.value),T.value,o.galleryPhotoIds,o.galleryVideoIds,ie.value);E.value={messagesSent:(d==null?void 0:d.messages_sent)??0,failed:Array.isArray(d==null?void 0:d.failed)?d.failed.length:0,failedDetails:Array.isArray(d==null?void 0:d.failed)?d.failed:[]},A.value=!0}catch(d){console.error("Failed to send to users:",d),E.value={messagesSent:0,failed:x.value.size,failedDetail
1s:[]},A.value=!0}finally{w.value=!1}}}function Gt(){l("sent",E.value)}function p(d){return{cannot_send_to_self:"Cannot send to self",recipient_not_found:"User not found",internal_account:"Internal account",sender_blocked_recipient:"You have blocked this user",blocked_by_recipient:"This user has blocked you",send_failed:"Send failed",unknown:"Unknown error",do_not_bulk:'Set to "do not bulk"',excluded_by_tag:"Excluded from bulk by a tag",unanswered_bulk_limit:"Too many unanswered bulk messages",unanswered_bulk:"Bulked recently - wait for a reply or 24h"}[d]||d}function m(d){const h=[...qe.value,...ne.value,...Z.value,...z.value].find(S=>S.id===d);return(h==null?void 0:h.display_name)||(h==null?void 0:h.username)||`User #${d}`}return Fe(se,()=>{kt(),St()},{deep:!0}),ze(async()=>{var d;Ye.value.some(c=>c.value===y.value)||(y.value=((d=Ye.value[0])==null?void 0:d.value)??"viewers"),kt(),await Promise.all([Rt(),_t(),wt(),Nt()]),kt(),yt(se.value.map(c=>c.id))}),Qe(()=>{W&&clearTimeout(W),C.length>0&&g.unwatchUsers(C)}),(d,c)=>(i(),Me(lt,{to:"body"},[s("div",{class:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50",onClick:c[4]||(c[4]=ke(h=>l("close"),["self"]))},[s("div",Kr,[s("div",Xr,[s("h3",Jr,b(n.value?"Bulk Message":"Send to Users"),1),s("button",{class:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-x-grey-2 transition-colors",onClick:c[0]||(c[0]=h=>l("close"))},Zr)]),A.value?(i(),a(Y,{key:0},[s("div",ea,[s("div",{class:J(["w-16 h-16 rounded-full flex items-center justify-center mb-4",E.value.messagesSent>0?"bg-green-50":"bg-red-50"])},[E.value.messagesSent>0?(i(),a("svg",ta,oa)):(i(),a("svg",na,ra))],2),s("p",aa,b(E.value.messagesSent>0?"Sent!":"Failed to send"),1),s("p",la,[X(b(E.value.messagesSent)+" message"+b(E.value.messagesSent!==1?"s":"")+" sent ",1),E.value.failed>0?(i(),a(Y,{key:0},[X(" , "+b(E.value.failed)+" failed ",1)],64)):k("",!0)]),E.value.failedDetails.length>0?(i(),a("div",da,[ca,s("div",ua,[(i(!0),a(Y,null,he(E.value.failedDetails,h=>(i(),a("div",{key:h.user_id,class:"flex items-center justify-between text-xs bg-red-50 rounded px-2 py-1"},[s("span",ha,b(m(h.user_id)),1),s("span",ga,b(p(h.reason)),1)]))),128))])])):k("",!0)]),s("div",fa,[pe(Vt,{class:"!min-h-0",onClick:Gt},{default:Ne(()=>[pa]),_:1})])],64)):(i(),a(Y,{key:1},[n.value?k("",!0):(i(),a("div",va,[s("div",ma,[s("div",ya,[(i(!0),a(Y,null,he(G.value,h=>(i(),a("div",{key:h.id,class:"w-10 h-10 rounded-lg overflow-hidden border-2 border-white relative"},[s("img",{src:De(h),class:"w-full h-full object-cover",alt:""},null,8,_a),We(h)?(i(),a("div",wa,ka)):k("",!0)]))),128)),Ke.value>0?(i(),a("div",ba," +"+b(Ke.value),1)):k("",!0)]),s("span",Ca,b(Le.value)+" item"+b(Le.value!==1?"s":"")+" selected ",1)])])),s("div",$a,[(i(!0),a(Y,null,he(Ye.value,h=>(i(),a("button",{key:h.value,class:J(["flex-1 py-3 text-sm font-medium transition-colors relative",y.value===h.value?"text-x-pink-1":"text-x-grey-15 hover:text-gray-900"]),onClick:S=>y.value=h.value},[X(b(h.label)+" ",1),h.loading?(i(),a("span",Ma)):(i(),a("span",ja,"("+b(h.count)+")",1)),y.value===h.value?(i(),a("span",Sa)):k("",!0)],10,Ta))),128))]),s("div",Aa,[s("span",Ea,[s("span",Ia,b(se.value.length),1),X(" in this tab "),x.value.size>0?(i(),a("span",Ra," ("+b(x.value.size)+" selected total) ",1)):k("",!0)])]),s("div",Ua,[y.value==="manual"?(i(),a("div",Pa,[Na,Ie(s("textarea",{"onUpdate:modelValue":c[1]||(c[1]=h=>Se.value=h),class:"w-full h-24 text-sm text-black px-3 py-2 rounded-lg border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey resize-none font-mono",placeholder:`12345
2john_doe
3Email punter internal
467890, jane123`,onKeydown:jt(ke(xt,["ctrl"]),["enter"])},null,40,Fa),[[Oe,Se.value]]),s("div",Oa,[Ga,s("div",La,[z.value.length>0||Se.value?(i(),a("button",{key:0,class:"px-3 py-1 text-xs text-gray-500 hover:text-gray-700 transition-colors",onClick:Ft}," Clear ")):k("",!0),s("button",{class:"px-4 py-1.5 text-xs font-medium text-white bg-x-pink-1 rounded-full hover:bg-x-pink-1/90 transition-colors disabled:opacity-50",disabled:!Se.value.trim()||K.value,onClick:xt},b(K.value?"Looking up...":"Lookup"),9,Da)])]),oe.value.not_found.length||oe.value.blocked.length||oe.value.inactive.length?(i(),a("div",za,[oe.value.not_found.length?(i(),a("div",Ba," Not found: "+b(oe.value.not_found.join(", ")),1)):k("",!0),oe.value.blocked.length?(i(),a("div",Ha," Blocked: "+b(oe.value.blocked.join(", ")),1)):k("",!0),oe.value.inactive.length?(i(),a("div",Wa," Inactive: "+b(oe.value.inactive.join(", ")),1)):k("",!0)])):k("",!0)])):k("",!0),y.value==="threads"&&te.value||y.value==="viewers"&&L.value||y.value==="subscribers"&&F.value||y.value==="manual"&&K.value?(i(),a("div",Va,Ya)):se.value.length===0&&y.value!=="manual"?(i(),a("div",Ka," No "+b(y.value==="threads"?"conversations":y.value==="viewers"?"profile viewers":"subscribers")+" yet ",1)):se.value.length===0&&y.value==="manual"&&!K.value?(i(),a("div",Xa,b(Se.value?"No valid users found":"Enter IDs or usernames above and click Lookup"),1)):(i(),a(Y,{key:4},[(i(!0),a(Y,null,he(se.value,h=>(i(),a("button",{key:h.id,type:"button",disabled:!!st(h.id),class:J(["w-full flex items-center gap-3 px-4 py-3 transition-colors border-b border-x-grey-1 text-left",st(h.id)?"opacity-50 cursor-not-allowed bg-gray-50/60":"hover:bg-gray-50"]),onClick:S=>Be(h.id)},[s("div",{class:J(["w-5 h-5 rounded-full border-2 flex-shrink-0 flex items-center justify-center transition-colors",At(h.id)?"bg-x-pink-1 border-x-pink-1":"border-gray-300"])},[At(h.id)?(i(),a("svg",Qa,el)):k("",!0)],2),s("div",tl,[h.photo_url?(i(),a("img",{key:0,src:h.photo_url,alt:h.username,class:"w-10 h-10 rounded-full object-cover"},null,8,sl)):(i(),a("div",ol,b(h.username.charAt(0).toUpperCase()),1)),_(h.id)?(i(),a("span",nl)):k("",!0),(h.total_spent??0)>0?(i(),a("span",{key:3,class:"absolute -top-1 -right-1 px-1 min-w-5 h-4 bg-x-green-1 text-white text-[10px] font-medium rounded-full flex items-center justify-center gap-0.5",title:"Total spent: "+h.total_spent},[rl,X(" "+b(nt(h.total_spent??0)),1)],8,il)):k("",!0)]),s("div",al,[s("span",ll,b(h.display_name||h.username),1),s("span",dl," @"+b(h.username),1),st(h.id)?(i(),a("span",cl,b(p(st(h.id))),1)):k("",!0),y.value==="viewers"&&h.last_viewed_at?(i(),a("span",ul,[X(" Viewed "+b(gt(h.last_viewed_at)),1),h.total_views?(i(),a(Y,{key:0},[X(" · "+b(h.total_views)+" view"+b(h.total_views===1?"":"s"),1)],64)):k("",!0)])):k("",!0)])],10,Ja))),128)),y.value==="threads"&&Ge.value?(i(),a("button",{key:0,t
4ype:"button",class:"w-full px-4 py-3 text-sm font-medium text-x-pink-1 hover:bg-gray-50 transition-colors disabled:opacity-50",disabled:Ae.value,onClick:Ut},b(Ae.value?"Loading…":"Load more"),9,hl)):k("",!0)],64))]),ot.value.length>0?(i(),a("div",gl,[s("div",fl,[s("span",pl," Recipients ("+b(ot.value.length)+") ",1),s("button",{class:"text-xs text-red-500 hover:text-red-700 transition-colors",onClick:Et}," Clear all ")]),s("div",vl,[(i(!0),a(Y,null,he(ot.value,h=>(i(),a("span",{key:h.id,class:"inline-flex items-center gap-1 px-2 py-1 bg-white border border-gray-200 rounded-full text-xs text-gray-700 hover:border-red-300 group"},[s("span",ml,b(h.display_name||h.username),1),s("button",{class:"w-4 h-4 flex items-center justify-center rounded-full hover:bg-red-100 text-gray-400 hover:text-red-500 transition-colors",onClick:ke(S=>It(h.id),["stop"]),title:"Remove"},wl,8,yl)]))),128))])])):k("",!0),s("div",xl,[s("div",kl,[s("div",bl,[s("label",Cl," Message "+b(n.value?"(required)":"(optional)"),1),Ie(s("input",{"onUpdate:modelValue":c[2]||(c[2]=h=>T.value=h),class:"w-full h-8 text-xs text-black px-3 rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey",placeholder:n.value?"Enter your message...":"Add a message..."},null,8,$l),[[Oe,T.value]])]),n.value?k("",!0):(i(),a("div",Tl,[jl,s("input",{value:M.value,type:"number",min:"0",step:"1",class:"w-full h-8 text-xs text-black px-3 rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey",onInput:dt},null,40,Ml)]))])]),s("div",Sl,[s("span",Al,b(x.value.size)+" user"+b(x.value.size!==1?"s":"")+" selected ",1),s("div",El,[pe(Ve,{size:"xs",color:"secondary",onClick:c[3]||(c[3]=h=>l("close"))},{default:Ne(()=>[X(" Cancel ")]),_:1}),pe(Vt,{class:"!min-h-0",disabled:!fe.value||w.value,onClick:Ot},{default:Ne(()=>[s("span",Il,b(w.value?"Sending...":`Send to ${x.value.size}`),1)]),_:1},8,["disabled"])])])],64))])])]))}}),Ul={class:"bg-white rounded-lg shadow-xl w-full max-w-md mx-4"},Pl={class:"px-6 py-4 border-b border-gray-200 flex items-center justify-between"},Nl=s("h2",{class:"text-lg font-semibold text-gray-900"},"Set Reminder",-1),Fl=s("svg",{class:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Ol=[Fl],Gl={class:"p-6 space-y-4"},Ll={class:"text-sm text-gray-600 mb-4"},Dl={class:"font-medium text-gray-900"},zl=s("label",{class:"block text-sm font-medium text-gray-700 mb-2"},"When?",-1),Bl={class:"grid grid-cols-2 gap-2"},Hl=["onClick"],Wl={key:0,class:"space-y-3"},Vl=s("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Date",-1),ql=["min"],Yl=s("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Time",-1),Kl=["min"],Xl=s("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Note (optional)",-1),Jl={class:"px-6 py-4 border-t border-gray-200 flex justify-end gap-3"},Ql=["disabled"],Zl={key:0},ed={key:1},td=je({__name:"ChatterSetReminderModal",props:{girlId:{},conversationId:{},targetUserId:{},targetUserName:{}},emits:["close","created"],setup(t,{emit:e}){const o=t,r=e,n=Ee(),l=I(""),u=I(""),v=I(""),g=I(null),f=I(!1),C=[{label:"1 hour",value:"1h"},{label:"3 hours",value:"3h"},{label:"Tomorrow 10am",value:"tomorrow"},{label:"Custom",value:"custom"}],_=R(()=>{if(!g.value)return null;const A=new Date;switch(g.value){case"1h":return new Date(A.getTime()+60*60*1e3).toISOString();case"3h":return new Date(A.getTime()+3*60*60*1e3).toISOString();case"tomorrow":{const E=new Date(A);return E.setDate(E.getDate()+1),E.setHours(10,0,0,0),E.toISOString()}case"custom":return u.value&&v.value?new Date(`${u.value}T${v.value}`).toISOString():null;default:return null}}),y=R(()=>_.value!==null);function x(A){g.value=A}async function M(){if(!(!y.value||!_.value)){f.value=!0;try{await n.createReminder(o.girlId,o.conversationId,o.targetUserId,_.value,l.value||void 0),r("created"),r("close")}catch{}finally{f.value=!1}}}function T(){return new Date().toISOString().split("T")[0]}function w(){if(u.value===T()){const A=new Date;return`${String(A.getHours()).padStart(2,"0")}
4:${String(A.getMinutes()).padStart(2,"0")}`}return"00:00"}return(A,E)=>(i(),Me(lt,{to:"body"},[s("div",{class:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:E[5]||(E[5]=ke(V=>r("close"),["self"]))},[s("div",Ul,[s("div",Pl,[Nl,s("button",{class:"p-1 hover:bg-gray-100 rounded transition-colors",onClick:E[0]||(E[0]=V=>r("close"))},Ol)]),s("div",Gl,[s("div",null,[s("p",Ll,[X(" Remind me to message "),s("span",Dl,b(A.targetUserName),1)])]),s("div",null,[zl,s("div",Bl,[(i(),a(Y,null,he(C,V=>s("button",{key:V.value,type:"button",class:J(["px-4 py-2 text-sm font-medium rounded-lg border transition-colors",g.value===V.value?"border-x-pink-1 bg-x-pink-1/10 text-x-pink-1":"border-gray-300 text-gray-700 hover:bg-gray-50"]),onClick:de=>x(V.value)},b(V.label),11,Hl)),64))])]),g.value==="custom"?(i(),a("div",Wl,[s("div",null,[Vl,Ie(s("input",{"onUpdate:modelValue":E[1]||(E[1]=V=>u.value=V),type:"date",min:T(),class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-x-pink-1/50 focus:border-x-pink-1"},null,8,ql),[[Oe,u.value]])]),s("div",null,[Yl,Ie(s("input",{"onUpdate:modelValue":E[2]||(E[2]=V=>v.value=V),type:"time",min:w(),class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-x-pink-1/50 focus:border-x-pink-1"},null,8,Kl),[[Oe,v.value]])])])):k("",!0),s("div",null,[Xl,Ie(s("textarea",{"onUpdate:modelValue":E[3]||(E[3]=V=>l.value=V),rows:"2",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-x-pink-1/50 focus:border-x-pink-1 resize-none",placeholder:"Add a note about what to message them..."},null,512),[[Oe,l.value]])])]),s("div",Jl,[s("button",{type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",onClick:E[4]||(E[4]=V=>r("close"))}," Cancel "),s("button",{type:"button",disabled:!y.value||f.value,class:"px-4 py-2 text-sm font-medium text-white bg-x-pink-1 hover:bg-x-pink-1/90 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:M},[f.value?(i(),a("span",Zl,"Creating...")):(i(),a("span",ed,"Set Reminder"))],8,Ql)])])])]))}}),sd={class:"flex flex-col"},od={class:"p-4 border-b border-gray-200 flex-shrink-0 sticky top-0 bg-white z-10"},nd=["onKeydown"],id={class:"flex justify-end mt-2"},rd=["disabled"],ad={key:0,class:"flex items-center justify-center py-8"},ld=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),dd=[ld],cd={key:1,class:"flex items-center justify-center py-8 text-gray-400 text-sm"},ud={key:2},hd={key:0},gd={class:"flex justify-end gap-2 mt-2"},fd=["disabled","onClick"],pd={key:1},vd={class:"text-sm text-gray-800 whitespace-pre-wrap"},md={class:"flex items-center justify-between mt-2"},yd={class:"text-xs text-gray-400"},_d={key:0,class:"text-gray-500"},wd={key:1},xd={key:0,class:"flex items-center gap-2"},kd=s("span",{class:"text-xs text-gray-600"},"Delete?",-1),bd=["onClick"],Cd=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1),$d=[Cd],Td=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),jd=[Td],Md={key:1,class:"flex items-center gap-1"},Sd=["onClick"],Ad=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1),Ed=[Ad],Id=["onClick"],Rd=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),Ud=[Rd],Cs=je({__name:"ChatterGirlNotesSection",props:{girlId:{}}
4,setup(t){const e=t,o=Ee(),r=I(""),n=I(null),l=I(""),u=I(!1),v=I(null),g=R(()=>o.girlNotes[e.girlId]||[]);async function f(){if(!(!r.value.trim()||u.value)){u.value=!0;try{await o.createGirlNote(e.girlId,r.value.trim()),r.value=""}finally{u.value=!1}}}function C(A){n.value=A.id,l.value=A.content}function _(){n.value=null,l.value=""}async function y(A){if(!(!l.value.trim()||u.value)){u.value=!0;try{await o.updateGirlNote(e.girlId,A,l.value.trim()),n.value=null,l.value=""}finally{u.value=!1}}}function x(A){v.value=A}function M(){v.value=null}async function T(A){if(!u.value){u.value=!0;try{await o.deleteGirlNote(e.girlId,A),v.value=null}finally{u.value=!1}}}function w(A){const E=new Date(A);return E.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})+" at "+E.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}return ze(()=>{o.fetchGirlNotes(e.girlId)}),Fe(()=>e.girlId,A=>{_(),v.value=null,o.fetchGirlNotes(A)}),(A,E)=>(i(),a("div",sd,[s("div",od,[Ie(s("textarea",{"onUpdate:modelValue":E[0]||(E[0]=V=>r.value=V),rows:"3",placeholder:"Add a note about this girl...",class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 resize-none text-black",onKeydown:jt(ke(f,["ctrl"]),["enter"])},null,40,nd),[[Oe,r.value]]),s("div",id,[s("button",{disabled:!r.value.trim()||u.value,class:"px-4 py-1.5 bg-x-pink-1 text-white text-sm font-medium rounded-lg hover:bg-x-pink-1/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:f}," Add Note ",8,rd)])]),O(o).loading.girlNotes?(i(),a("div",ad,dd)):g.value.length===0?(i(),a("div",cd," No notes yet ")):(i(),a("div",ud,[(i(!0),a(Y,null,he(g.value,V=>(i(),a("div",{key:V.id,class:"px-4 py-3 border-b border-gray-100 hover:bg-gray-50"},[n.value===V.id?(i(),a("div",hd,[Ie(s("textarea",{"onUpdate:modelValue":E[1]||(E[1]=de=>l.value=de),rows:"3",class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 resize-none text-black"},null,512),[[Oe,l.value]]),s("div",gd,[s("button",{class:"px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded transition-colors",onClick:_}," Cancel "),s("button",{disabled:!l.value.trim()||u.value,class:"px-3 py-1 bg-x-pink-1 text-white text-sm font-medium rounded hover:bg-x-pink-1/90 transition-colors disabled:opacity-50",onClick:de=>y(V.id)}," Save ",8,fd)])])):(i(),a("div",pd,[s("p",vd,b(V.content),1),s("div",md,[s("span",yd,[V.chatter?(i(),a("span",_d," by "+b(V.chatter.display_name||V.chatter.username),1)):k("",!0),V.chatter?(i(),a("span",wd," · ")):k("",!0),X(" "+b(w(V.created_at)),1)]),v.value===V.id?(i(),a("div",xd,[kd,s("button",{class:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded transition-colors",title:"Confirm delete",onClick:de=>T(V.id)},$d,8,bd),s("button",{class:"p-1 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded transition-colors",title:"Cancel",onClick:M},jd)])):V.is_owner?(i(),a("div",Md,[s("button",{class:"p-1 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors",title:"Edit note",onClick:de=>C(V)},Ed,8,Sd),s("button",{class:"p-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded transition-colors",title:"Delete note",onClick:de=>x(V.id)},Ud,8,Id)])):k("",!0)])]))]))),128))]))]))}}),Pd={class:"fixed inset-0 z-50 flex items-center justify-center"},Nd={class:"relative bg-white rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col"},Fd={class:"px-4 py-3 border-b border-gray-200 flex items-center justify-between flex-shrink-0"},Od={class:"font-semibold text-gray-800"},Gd=s("svg",{class:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Ld=[Gd],Dd={class:"flex-1 overflow-y-auto"},zd=je({__name:"ChatterGirlNotesModal",props:{girlId:{},girlName:{}},emits:["close"],setup(t,{emit:e}){const o=e;return(r,n)=>(i(),Me(lt,{to:"body"},[s("div",Pd,[s("div",{class:"absolute inset-0 bg-black/50",onClick:n[0]||(n[0]=l=>o("close"))}),s("div",Nd,[s("div",Fd,[s("h3",Od," Notes for "+b(r.girlName),1),s("button",{class:"p-1 hover:bg-gray-100 rounded transition-colors",onClick:n[1]||(n[1]=l=>o("close"))},Ld)]),s("div",Dd,[pe(Cs,{"girl-id":r.girlId},null,8,["girl-id"])])])])]))}}),Bd={class:"flex flex-col h-full"},Hd={class:"px-4 py-3 border-b border-x-grey-1 flex-shrink-0"},Wd={class:"flex items-center justify-between"},Vd={class:"font-semibold text-gray-700"},qd={key:0,class:"flex items-center gap-1.5 flex-wrap"},Yd=["title"],Kd={class:"truncate"},Xd={key:0,class:"text-xs text-gray-400 font-normal"},Jd=["href"],Qd={key:3},Zd={key:4},ec={class:"flex items-center gap-1"},tc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1),sc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.25
45-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})],-1),oc={class:"mt-2 flex items-center gap-2"},nc={class:"relative flex-1"},ic=s("svg",{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("circle",{cx:"11",cy:"11",r:"8"}),s("path",{d:"m21 21-4.3-4.3"})],-1),rc=["title"],ac={xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},lc={key:0,"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"},dc={key:1,"stroke-linecap":"round","stroke-linejoin":"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"},cc={key:0,class:"flex-1 flex items-center justify-center"},uc=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),hc=[uc],gc={key:1,class:"flex-1 flex items-center justify-center text-gray-400 text-sm px-4 text-center"},fc={key:2,class:"flex-1 overflow-y-auto"},pc=["onClick","onContextmenu"],vc={class:"relative flex-shrink-0"},mc=["src","alt"],yc={key:1,class:"w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-sm font-bold text-gray-600"},_c={key:2,class:"absolute bottom-0 right-0 w-3 h-3 bg-x-green-1 border-2 border-white rounded-full"},wc=["title"],xc=s("svg",{class:"w-2.5 h-2.5 font-bold",fill:"none",stroke:"currentColor","stroke-width":"3",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v18M7 8c0-1.5 2-3 5-3s5 1.5 5 3c0 2-2 3-5 3s-5 1-5 3c0 1.5 2 3 5 3s5-1.5 5-3"})],-1),kc={class:"flex-1 min-w-0"},bc={class:"flex items-center justify-between"},Cc={class:"font-medium text-sm text-gray-900 truncate flex items-center gap-1"},$c={key:0,xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5 text-yellow-500 flex-shrink-0",viewBox:"0 0 24 24",fill:"currentColor"},Tc=s("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"},null,-1),jc=[Tc],Mc={class:"flex items-center gap-1 flex-shrink-0 ml-2"},Sc=["onClick","onKeydown"],Ac=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14 5h5m0 0v5m0-5l-7 7M10 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-4"})],-1),Ec=[Ac],Ic={class:"text-xs text-gray-400"},Rc={class:"flex items-center justify-between mt-0.5"},Uc={class:"text-xs text-gray-500 truncate"},Pc={key:0,class:"flex-shrink-0 ml-2 bg-x-pink-1 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center font-medium"},Nc={key:0,class:"flex flex-wrap items-center gap-1 mt-1"},Fc=["title"],Oc={class:"truncate"},Gc={key:0,class:"flex justify-center py-3"},Lc=["disabled"],Dc={key:0,class:"animate-spin rounded-full h-3 w-3 border-b border-x-pink-1"},zc={key:1,class:"flex items-center justify-center py-3 text-[10px] text-gray-400"},Bc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})],-1),Hc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),Wc={key:0,xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4 text-yellow-500",viewBox:"0 0 24 24",fill:"currentColor"},Vc=s("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"},null,-1),qc=[Vc],Yc={key:1,xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},Kc=s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"}
4,null,-1),Xc=[Kc],Jc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1),Qc=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})],-1),Zc=je({__name:"ChatterConversationList",setup(t){const e=Ee(),o=Mt(),r=I(""),n=I(!1),l=I(!1),u=I(null),v=I({x:0,y:0}),g=I(!1),f=I(null);function C(){n.value=!1,e.selectedGirlId&&e.fetchConversations(e.selectedGirlId)}let _=[];function y(ne){return ne?o.isUserOnline(ne):!1}function x(ne){const Z=K(ne);return e.isPunterFavourite(Z.id)}async function M(ne){z();const Z=e.currentConversations.find(se=>se.id===ne);if(!Z)return;const Te=K(Z);await e.togglePunterFavourite(Te.id)}function T(){const ne=e.currentConversations.map(Z=>{var Te;return(Te=K(Z))==null?void 0:Te.id}).filter(Z=>Z!==void 0);ne.length>0&&(_.length>0&&o.unwatchUsers(_),_=ne,o.watchUsers(ne))}Fe(()=>e.currentConversations.map(ne=>{var Z;return(Z=K(ne))==null?void 0:Z.id}).join(","),()=>T());async function w(){if(e.isTagFilterActive){await e.fetchMoreCombined();return}e.selectedGirlId&&await e.fetchMoreConversations(e.selectedGirlId)}let A=null;Fe(r,ne=>{if(A&&clearTimeout(A),e.isTagFilterActive){A=setTimeout(()=>{e.searchCombined(ne.trim())},300);return}if(!e.selectedGirlId||e.showingHiddenConversations)return;const Z=e.selectedGirlId;A=setTimeout(()=>{e.fetchConversations(Z,void 0,ne.trim())},300)}),Fe(()=>e.activeTagFilterIds,()=>{r.value=""},{deep:!0});const E=R(()=>e.loading.conversations||e.loading.hiddenConversations||e.loading.combined),V=R(()=>e.isTagFilterActive?e.combinedHasMore:!e.selectedGirlId||e.showingHiddenConversations?!1:!!e.conversationsHasMore[e.selectedGirlId]),de=R(()=>e.isTagFilterActive?e.loading.combinedMore:e.loading.conversationsMore),W=R(()=>e.tags.filter(ne=>e.activeTagFilterIds.includes(ne.id)));ze(()=>{T()}),Qe(()=>{_.length>0&&o.unwatchUsers(_),A&&clearTimeout(A)});const te=R(()=>[...e.currentConversations].sort((Z,Te)=>{var Ue,Ye;if(Z.unseen_count>0&&Te.unseen_count===0)return-1;if(Z.unseen_count===0&&Te.unseen_count>0)return 1;const se=Math.max($e((Ue=Z.last_message)==null?void 0:Ue.created_at),$e(Z.last_received_at),$e(Z.updated_at));return Math.max($e((Ye=Te.last_message)==null?void 0:Ye.created_at),$e(Te.last_received_at),$e(Te.updated_at))-se})),L=te;function F(ne){e.isTagFilterActive?e.openCombinedConversation(ne):e.selectConversation(ne.id)}function D(ne){const Z=ne.girl_id??e.selectedGirlId;Z&&e.openWindow(Z,ne.id)}function K(ne){const Z=ne.girl_id??e.selectedGirlId;return Z&&ne.initiator_user.id===Z?ne.recipient_user:ne.initiator_user}function H(ne){if(!ne.last_message)return"No messages yet";const Z=ne.last_message.content;return Z?Z.length>50?Z.substring(0,50)+"...":Z:"Media message"}function Re(ne){const Z=new Date(ne),se=new Date().getTime()-Z.getTime(),Ce=Math.floor(se/(1e3*60*60*24));return Ce===0?Z.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):Ce===1?"Yesterday":Ce<7?Z.toLocaleDateString([],{weekday:"short"}):Z.toLocaleDateString([],{month:"short",day:"numeric"})}function _e(ne){return ne>=1e3?(ne/1e3).toFixed(1)+"k":String(ne)}function Se(ne,Z){ne.preventDefault(),u.value=Z,v.value={x:ne.clientX,y:ne.clientY}}function z(){u.value=null}async function oe(ne){z(),await e.markAsUnread(ne)}async function ge(ne){z(),await e.hideConversation(ne)}async function be(ne){z(),await e.unhideConversation(ne)}function Ge(ne){if(z(),!e.selectedGirlId)return;const Z=e.currentConversations.find(se=>se.id===ne);
4if(!Z)return;const Te=K(Z);f.value={girlId:e.selectedGirlId,conversationId:ne,targetUserId:Te.id,targetUserName:Te.display_name||Te.username},g.value=!0}function Ae(){g.value=!1,f.value=null}function qe(ne){ne.target.closest(".context-menu")||z()}return ze(()=>{document.addEventListener("click",qe)}),Qe(()=>{document.removeEventListener("click",qe)}),(ne,Z)=>{var Te;return i(),a("div",Bd,[s("div",Hd,[s("div",Wd,[s("h2",Vd,[O(e).isTagFilterActive?(i(),a("span",qd,[(i(!0),a(Y,null,he(W.value,se=>(i(),a("span",{key:se.id,class:"inline-flex items-center px-2 h-5 rounded text-xs font-medium text-white max-w-[140px] min-w-0",title:se.name,style:Je({backgroundColor:se.color})},[s("span",Kd,b(se.name),1)],12,Yd))),128)),O(e).selectedGirl?(i(),a("span",Xd,b(O(e).selectedGirl.display_name||O(e).selectedGirl.username),1)):k("",!0)])):O(e).showingHiddenConversations?(i(),a(Y,{key:1},[X("Hidden")],64)):(Te=O(e).selectedGirl)!=null&&Te.profile_url?(i(),a("a",{key:2,href:O(e).selectedGirl.profile_url,target:"_blank",class:"text-x-pink-1 hover:underline"},b(O(e).selectedGirl.display_name||O(e).selectedGirl.username),9,Jd)):O(e).selectedGirl?(i(),a("span",Qd,b(O(e).selectedGirl.display_name||O(e).selectedGirl.username),1)):(i(),a("span",Zd,"Conversations"))]),s("div",ec,[O(e).selectedGirl&&!O(e).showingHiddenConversations?(i(),a("button",{key:0,class:"flex items-center gap-1 px-2 py-1 text-xs font-medium text-gray-500 hover:bg-gray-100 rounded transition-colors",title:"Girl notes",onClick:Z[0]||(Z[0]=se=>l.value=!0)},[tc,X(" Notes ")])):k("",!0),O(e).selectedGirl&&te.value.length>0&&!O(e).showingHiddenConversations?(i(),a("button",{key:1,class:"flex items-center gap-1 px-2 py-1 text-xs font-medium text-x-pink-1 hover:bg-x-pink-1/10 rounded transition-colors",title:"Send bulk message",onClick:Z[1]||(Z[1]=se=>n.value=!0)},[sc,X(" Bulk ")])):k("",!0)])]),s("div",oc,[s("div",nc,[Ie(s("input",{"onUpdate:modelValue":Z[2]||(Z[2]=se=>r.value=se),type:"text",placeholder:"Search conversations...",class:"w-full h-8 text-xs text-black pl-8 pr-3 rounded-lg border border-x-grey-1 focus:outline-none focus:border-x-pink-1 transition-colors"},null,512),[[Oe,r.value]]),ic]),O(e).selectedGirl?(i(),a("button",{key:0,class:J(["flex-shrink-0 p-1.5 rounded-lg transition-colors",O(e).showingHiddenConversations?"text-x-pink-1 bg-x-pink-1/10":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"]),title:O(e).showingHiddenConversations?"Show active conversations":"Show hidden conversations",onClick:Z[3]||(Z[3]=se=>O(e).toggleShowHiddenConversations())},[(i(),a("svg",ac,[O(e).showingHiddenConversations?(i(),a("path",lc)):(i(),a("path",dc))]))],10,rc)):k("",!0)])]),E.value?(i(),a("div",cc,hc)):te.value.length===0?(i(),a("div",gc,[O(e).showingHiddenConversations?(i(),a(Y,{key:0},[X("No hidden conversations")],64)):r.value.trim()?(i(),a(Y,{key:1},[X('No conversations match "'+b(r.value)+'"',1)],64)):O(e).isTagFilterActive?(i(),a(Y,{key:2},[X("No conversations with this tag")],64)):(i(),a(Y,{key:3},[X("No conversations yet")],64))])):(i(),a("div",fc,[(i(!0),a(Y,null,he(O(L),se=>{var Ce;return i(),a("button",{key:se.id,class:J(["w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-50 transition-colors border-b border-x-grey-1 text-left",{"bg-x-grey-2":O(e).selectedConversationId===se.id}]),onClick:Ue=>F(se),onContextmenu:Ue=>Se(Ue,se.id)},[s("div",vc,[K(se).photo_url?(i(),a("img",{key:0,src:K(se).photo_url??void 0,alt:K(se).username,class:"w-10 h-10 rounded-full object-cover"},null,8,mc)):(i(),a("div",yc,b(K(se).username.charAt(0).toUpperCase()),1)),y((Ce=K(se))==null?void 0:Ce.id)?(i(),a("span",_c)):k("",!0),(K(se).total_spent??0)>0?(i(),a("span",{key:3,class:"absolute -top-1 -right-1 px-1 min-w-5 h-4 bg-x-green-1 text-white text-[10px] font-medium rounded-full flex items-center justify-center gap-0.5",title:"Total spent: "+K(se).total_spent},[xc,X(" "+b(_e(K(se).total_spent??0)),1)],8,wc)):k("",!0)]),s("div",kc,[s("div",bc,[s("span",Cc,[X(b(K(se).display_name||K(se).username)+" ",1),x(se)?(i(),a("svg",$c,jc)):k("",!0)]),s("span",Mc,[s("span",{role:"button",tabindex:"0",title:"Open in a pop-out window",class:"p-0.5 rounded text-gray-400 hover:text-x-pink-1 hover:bg-x-pink-1/10 transition-colors",onClick:ke(Ue=>D(se),["stop"]),onKeydown:jt(ke(Ue=>D(se),["stop"]),["enter"])},Ec,40,Sc),s("span",Ic,b(Re(se.updated_at)),1)])]),s("div",Rc,[s("p",Uc,b(H(se)),1),se.unseen_count>0?(i(),a("span",Pc,b(se.unseen_count>9?"9+":se.unseen_count),1)):k("",!0)]),se.tags&&se.tags.length?(i(),a("div",Nc,[(i(!0),a(Y,null,he(se.tags,Ue=>(i(),a("span",{key:Ue.id,class:"inline-flex items-center px-1.5 h-4 rounded text-[10px] font-medium text-white max-w-[120px] min-w-0",title:Ue.name,style:Je({backgroundColor:Ue.color})},[s("span",Oc,b(Ue.name),1)],12,Fc))),128))])):k("",!0)])],42,pc)}),128)),V.value?(i(),a("div",Gc,[s("button",{type:"button",class:"px-4 py-1.5 text-xs font-medium text-x-pink-1 border border-x-pink-1 rounded hover:bg-x-pink-1 hover:text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",disabled:de.value,onClick:w},[de.value?(i(),a("span",Dc)):k("",!0),X(" "+b(de.value?"Loading…":"Load more"),1)],8,Lc)])):!V.value&&te.value.length>0&&(O(e).isTagFilterActive||O(e).selectedGirlId&&!O(e).showingHiddenConversations)?(i(),a("div",zc," End of list ")):k("",!0)])),(i(),Me(lt,{to:"body"},[u.value!==null?(i(),a("div",{key:0,class:"context-menu fixed bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[160px]",style:Je({left:v.value.x+"px",top:v.value.y+"px"})},[s("button",{class:"w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2",onClick:Z[4]||(Z[4]=se=>oe(u.value))},[Bc,X(" Mark as unread ")]),s("button",{class:"w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2",onClick:Z[5]||(Z[5]=se=>Ge(u.value))},[Hc,X(" Set reminder ")]),s("button",{class:"w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center gap-2",onClick:Z[6]||(Z[6]=se=>M(u.value))},[u.value&&x(O(e).currentConversations.find(se=>se.id===u.value))?(i(),a("svg",Wc,qc)):(i(),a("svg",Yc,Xc)),X(" "+b(u.value&&x(O(e).currentConversations.find(se=>se.id===u.value))?"Remove from favourites":"Add to favourites"),1)]),O(e).showingHiddenConversations?(i(),a("button",{key:0,class:"w-full px-4 py-2 text-left text-sm text-green-600 hover:bg-gray-100 flex items-center gap-2",onClick:Z[7]||(Z[7]=se=>be(u.value))},[Jc,X(" Unhide conversation ")])):(i(),a("button",{key:1,class:"w-full px-4 py-2 text-left text-sm text-red-600 hover:bg-gray-100 flex items-center gap-2",onClick:Z[8]||(Z[8]=se=>ge(u.value))},[Qc,X(" Hide conversation ")]))],4)):k("",!0)])),g.value&&f.value?(i(),Me(td,{key:3,"girl-id":f.value.girlId,"conversation-id":f.value.conversationId,"target-user-id":f.value.targetUserId,"target-user-name":f.value.targetUserName,onClose:Ae,onCreated:Ae},null,8,["girl-id","conversation-id","target-user-id","target-user-name"])):k("",!0),n.value?(i(),Me(bs,{key:4,onClose:Z[9]||(Z[9]=se=>n.value=!1),onSent:C})):k("",!0),l.value&&O(e).selectedGirl?(i(),Me(zd,{key:5,"girl-id":O(e).selectedGirl.id,"girl-name":O(e).selectedGirl.display_name||O(e).selectedGirl.username,onClose:Z[10]||(Z[10]=se=>l.value=!1)},null,8,["girl-id","girl-name"])):k("",!0)])}}}),eu={class:"tag-picker relative flex items-center gap-1.5 min-w-0"},tu={key:0,class:"flex items-center gap-1 min-w-0"},su=["title"],ou={class:"truncate"},nu=["title"],iu=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 7h.01M7 3h5a1.99 1.99 0 011.414.586l7 7a2 2 0 010 2.828l-5 5a2 2 0 01-2.828 0l-7-7A2 2 0 014 9V4a1 1 0 011-1z"})],-1),ru={key:1,class:"absolute right-0 top-full mt-1 w-56 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50"},au={class:"max-h-56 overflow-y-auto"},lu=["onClick"],du={class:"flex-1 text-sm text-gray-700 truncate"},cu={key:0,xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4 text-x-pink-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2.5"},uu=s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1),hu=[uu],gu={key:0,class:"px-3 py-2 text-xs text-gray-400"},fu=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})],-1),pu={key:1,class:"border-t border-x-grey-1 px-2 py-1.5"},vu={class:"flex items-center gap-1"},mu=["disabled"],yu={class:"flex items-center gap-1.5 mt-1.5 flex-wrap"},_u=["title","onClick"],wu=["value"],fs=2,$s=je({__name:"ChatterTagPicker",props:{conversation:{}},setup(t){const e=t,o=Ee(),r=ht(),n=R(()=>r.canManageChatterTags()),l=I(!1);Fe(l,w=>{w&&o.fetchTags()});const u=I(!1),v=I(""),g=I(mt[0]),f=I(!1),C=R(()=>new Set((e.conversation.tags??[]).map(w=>w.id))),_=R(()=>(e.conversation.tags??[]).slice(0,fs)),y=R(()=>Math.max(0,(e.conversation.tags??[]).length-fs));function x(w){C.value.has(w)?o.removeTagFromConversation(e.conversation.id,w):o.attachTagToConversation(e.conversation.id,w)}async function M(){const w=v.value.trim();if(!w||f.value)return;f.value=!0;const A=await o.createTag(w,g.value);A&&(await o.attachTagToConversation(e.conversation.id,A.id),v.value="",g.value=mt[0]),f.value=!1}function T(w){if(u.value)return;w.target.closest(".tag-picker")||(l.value=!1)}return ze(()=>document.addEventListener("click",T)),Qe(()=>document.removeEventListener("click",T)),(w,A)=>(i(),a("div",eu,[w.conversation.tags&&w.conversation.tags.length?(i(),a("div",tu,[(i(!0),a(Y,null,he(_.value,E=>(i(),a("button",{key:E.id,type:"button",class:"inline-flex items-center h-5 px-1.5 rounded text-[11px] font-medium text-white whitespace-nowrap max-w-[90px] min-w-0 flex-shrink",style:Je({backgroundColor:E.color}),title:E.name,onClick:A[0]||(A[0]=ke(V=>l.value=!l.value,["stop"]))},[s("span",ou,b(E.name),1)],12,su))),128)),y.value>
40?(i(),a("button",{key:0,type:"button",class:"inline-flex items-center h-5 px-1.5 rounded text-[11px] font-semibold bg-gray-200 text-gray-700 flex-shrink-0",title:(w.conversation.tags??[]).map(E=>E.name).join(", "),onClick:A[1]||(A[1]=ke(E=>l.value=!l.value,["stop"]))}," +"+b(y.value),9,nu)):k("",!0)])):k("",!0),s("button",{type:"button",class:"flex-shrink-0 flex items-center gap-1 px-2 py-1 text-xs font-medium text-gray-500 hover:bg-gray-100 rounded transition-colors",title:"Tags",onClick:A[2]||(A[2]=ke(E=>l.value=!l.value,["stop"]))},[iu,X(" Tags ")]),l.value?(i(),a("div",ru,[s("div",au,[(i(!0),a(Y,null,he(O(o).conversationTags,E=>(i(),a("button",{key:E.id,type:"button",class:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-gray-50",onClick:ke(V=>x(E.id),["stop"])},[s("span",{class:"w-3 h-3 rounded-full flex-shrink-0",style:Je({backgroundColor:E.color})},null,4),s("span",du,b(E.name),1),C.value.has(E.id)?(i(),a("svg",cu,hu)):k("",!0)],8,lu))),128)),O(o).conversationTags.length===0?(i(),a("p",gu,"No tags yet.")):k("",!0)]),n.value?(i(),a("button",{key:0,type:"button",class:"w-full flex items-center gap-1.5 px-3 py-1.5 text-xs text-gray-500 hover:text-x-pink-1 hover:bg-gray-50 border-t border-x-grey-1",onClick:A[3]||(A[3]=ke(E=>{u.value=!0,l.value=!1},["stop"]))}
4,[fu,X(" Edit / delete tags… ")])):k("",!0),n.value?(i(),a("div",pu,[s("div",vu,[Ie(s("input",{"onUpdate:modelValue":A[4]||(A[4]=E=>v.value=E),type:"text",maxlength:"30",placeholder:"New tag…",class:"flex-1 h-7 text-xs text-black px-2 rounded border border-x-grey-1 focus:outline-none focus:border-x-pink-1",onClick:A[5]||(A[5]=ke(()=>{},["stop"])),onKeyup:jt(M,["enter"])},null,544),[[Oe,v.value]]),s("button",{type:"button",class:"h-7 px-2 text-xs font-medium text-white bg-x-pink-1 rounded disabled:opacity-50",disabled:!v.value.trim()||f.value,onClick:ke(M,["stop"])}," Add ",8,mu)]),s("div",yu,[(i(!0),a(Y,null,he(O(mt),E=>(i(),a("button",{key:E,type:"button",class:J(["w-4 h-4 rounded-full transition-transform",g.value===E?"ring-2 ring-offset-1 ring-gray-600 scale-110":""]),style:Je({backgroundColor:E}),title:E,onClick:ke(V=>g.value=E,["stop"])},null,14,_u))),128)),s("input",{type:"color",value:g.value,title:"Custom colour",class:"w-4 h-4 rounded cursor-pointer border border-x-grey-1 p-0 bg-transparent flex-shrink-0",onClick:A[6]||(A[6]=ke(()=>{},["stop"])),onInput:A[7]||(A[7]=E=>g.value=E.target.value)},null,40,wu)])])):k("",!0)])):k("",!0),u.value?(i(),Me(ks,{key:2,onClose:A[8]||(A[8]=E=>u.value=!1)})):k("",!0)]))}}),xu={class:"flex flex-col flex-1 overflow-hidden"},ku={key:0,class:"flex items-center gap-3 px-4 py-3 border-b border-x-grey-1 flex-shrink-0 bg-white"},bu=["src","alt"],Cu={key:1,class:"w-8 h-8 rounded-full bg-x-grey-2 flex items-center justify-center text-sm font-bold text-gray-600"},$u={class:"flex-1 min-w-0"},Tu={class:"font-medium text-sm text-gray-900 truncate"},ju={key:0,class:"text-xs text-x-grey-15 truncate"},Mu=["title"],Su={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Au=s("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"},null,-1),Eu=s("circle",{cx:"12",cy:"12",r:"3"},null,-1),Iu={key:0,x1:"3",y1:"3",x2:"21",y2:"21"},Ru=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("path",{d:"M15 3h6v6"}),s("path",{d:"M10 14 21 3"}),s("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})],-1),Uu=[Ru],Pu=ys('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>',1),Nu=[Pu],Fu={key:1,class:"flex-1 flex items-center justify-center"},Ou=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),Gu=[Ou],Lu={key:0,class:"flex justify-center py-2"},Du=s("div",{class:"animate-spin rounded-full h-4 w-4 border-b-2 border-x-pink-1"},null,-1),zu=[Du],Bu={class:"flex items-center justify-center my-4 relative"},Hu={class:"bg-x-grey-2 text-xs text-x-grey-15 px-4 py-1 rounded-full z-10"},Wu=s("div",{class:"absolute h-px w-full bg-x-grey-1"},null,-1),Vu=["onClick"],qu=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),Yu=[qu],Ku=["onClick"],Xu=["src"],Ju={key:0,class:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-20"},Qu=s("svg",{class:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s("path",{d:"M7 11V7a5 5 0 0110 0v4"})],-1),Zu=[Qu],eh={class:"text-[9px] text-white opacity-70 absolute bottom-1.5 right-2 drop-shadow-sm"},th=["href","data-src","data-fancybox"],sh={key:1,class:"relative"},oh={key:0,class:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-20 rounded-2xl pointer-events-none"}
4,nh=s("svg",{class:"w-8 h-8 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s("path",{d:"M7 11V7a5 5 0 0110 0v4"})],-1),ih=[nh],rh={class:"text-[9px] text-white opacity-70 absolute bottom-1.5 right-2 drop-shadow-sm z-10"},ah=["href","data-src","data-fancybox"],lh={key:2,class:"text-xs text-center"},dh={key:0,class:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-x-gold-1 border border-x-gold-4 text-x-gold-darker font-semibold"},ch={key:1,class:"text-gray-500"},uh=["onClick"],hh={key:4,class:"text-[9px] text-x-grey-15 text-right"},gh=["onClick"],fh=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),ph=[fh],vh={key:0,class:"text-xs text-center"},mh={key:0,class:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-x-gold-1 border border-x-gold-4 text-x-gold-darker font-semibold"},yh={key:1,class:"text-gray-500"},_h={key:1,class:"text-[9px] text-x-grey-15 text-right"},wh={key:2,class:"flex mb-3 justify-center"},xh={key:3,class:"flex mb-3 justify-center"},kh=["onClick"],bh=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),Ch=[bh],$h=["src"],Th={class:"flex items-center justify-between gap-2 px-1 text-[9px] text-x-grey-15"},jh={key:0},Mh={class:"whitespace-nowrap flex-shrink-0 flex items-center gap-1"},Sh=s("div",{class:"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"},null,-1),Ah=["onClick"],Eh=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),Ih=[Eh],Rh={key:0,class:"whitespace-pre-wrap break-words"},Uh={class:"flex items-center justify-between gap-2"},Ph=s("div",{class:"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"},null,-1),Nh={key:1,class:"flex justify-start mb-2"},Fh=s("div",{class:"bg-white text-gray-500 rounded-2xl rounded-tl-none px-4 py-2 text-xs italic border border-x-grey-1"}," typing... ",-1),Oh=[Fh],Gh={key:2,class:"flex justify-start mb-2"},Lh=s("div",{class:"bg-white text-gray-500 rounded-2xl rounded-tl-none px-4 py-2 text-xs italic border border-x-grey-1"}," preparing content... ",-1),Dh=[Lh],zh={class:"bg-white rounded-lg shadow-xl p-6 w-80"},Bh=s("h3",{class:"font-semibold text-gray-900 mb-2"},"Delete Message?",-1),Hh=s("p",{class:"text-sm text-gray-500 mb-4"},"This action cannot be undone.",-1),Wh={class:"flex justify-end gap-2"},Vh=864e5,Ts=je({__name:"ChatterMessageThread",props:{showNotesToggle:{type:Boolean},notesOpen:{type:Boolean},girlId:{},conversationId:{},embedded:{type:Boolean}},emits:["toggle-notes"],setup(t,{emit:e}){const o=t,r=e,n=Ee(),l=I(null),u=I(!0),v=I(!1),g=I(null),f=I(null),C=R(()=>o.conversationId??n.selectedConversationId),_=R(()=>{var N;return o.girlId??((N=n.girlFor(C.value))==null?void 0:N.id)??n.selectedGirlId??0}),y=R(()=>o.conversationId==null),x=R(()=>n.conversationFor(C.value)),M=R(()=>n.messagesFor(C.value)),T=R(()=>n.girlFor(C.value)),w=R(()=>{var N;return((N=n.convLoading[C.value??-1])==null?void 0:N.messages)??!1}),A=R(()=>{var N;return((N=n.convLoading[C.value??-1])==null?void 0:N.loadingEarlier)??!1}),E=R(()=>{const N=x.value;if(!N)return null;const ie=N.girl_id??_.value;return ie?N.initiator_user.id===ie?N.recipient_user:N.initiator_user:null});function V(){const N=x.value;N&&n.setGirlVisibility(N.id,N.hidden_from_girl===!0)}function de(){_.value&&C.value!=null&&n.openWindow(_.value,C.value)}const W=R(()=>{var N;return((N=x.value)==null?void 0:N.girl_id)??_.value}),te=R(()=>{const N=[...M.value];if(N.length===0)return[];N.sort((He,De)=>{const We=F(He),nt=F(De);return We&&!nt?1:!We&&nt?-1:new Date(He.created_at).getTime()-new Date(De.created_at).getTime()});const ie=new Date().toLocaleDateString(),fe=new Date(Date.now()-Vh).toLocaleDateString(),G=[];let Le=null,Ke=null;for(const He of N){const De=new Date(He.created_at).toLocaleDateString();if(De!==Le){Le=De;let We;Le===ie?We="Today":Le===fe?We="Yesterday":We=Le,Ke={date:Le,dateLabel:We,messages:[]},G.push(Ke)}Ke&&Ke.messages.push(He)}return G});function L(N){var ie;return((ie=N.user)==null?void 0:ie.id)===W.value}function F(N){return String(N.id).length>=xs}function D(N){if(!N.content)return!1;const ie=N.content.trim();if(!ie)return!1;const fe=/^https?:\/\/.*\.gif(\?.*)?$/i,G=/^https?:\/\/(media\.)?tenor\.com/i,Le=/^https?:\/\/(media\d*\.)?giphy\.com/i;return fe.test(ie)||G.test(ie)||Le.test(ie)}function K(N){var ie;return((ie=N.content)==null?void 0:ie.trim())||""}function H(N){return!(!L(N)||F(N)||N.message_type==="gift"||N.message_type==="tip"||(N.message_type==="image"||N.message_type==="video")&&N.price&&N.price>0&&N.is_unlocked)}function Re(N){return L(N)||F(N)||!N.price||N.price<=0?!1:!N.is_unlocked}function _e(N){g.value=N}
4async function Se(){g.value&&(await n.deleteMessage(_.value,C.value??0,g.value),g.value=null)}async function z(N){await n.unlockMessage(_.value,C.value??0,N)}function oe(N){const ie=new Date(N);return isNaN(ie.getTime())?"":ie.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function ge(N){var ie,fe;return N.chatter_username?`sent by ${N.chatter_username}`:`sent by ${((ie=T.value)==null?void 0:ie.display_name)||((fe=T.value)==null?void 0:fe.username)||"girl"}`}async function be(N=!1){if(!l.value||!N&&!u.value||v.value)return;v.value=!0;const ie=()=>{l.value&&(l.value.scrollTop=l.value.scrollHeight)};await Tt(),await new Promise(fe=>setTimeout(fe,0)),ie(),await new Promise(fe=>setTimeout(fe,50)),ie(),await new Promise(fe=>setTimeout(fe,100)),ie(),await new Promise(fe=>setTimeout(fe,150)),ie(),await new Promise(fe=>setTimeout(fe,300)),ie(),await new Promise(fe=>setTimeout(fe,500)),requestAnimationFrame(()=>{ie(),setTimeout(()=>{v.value=!1},50)})}const Ge=ws(()=>be(),200),Ae=Ws(()=>{if(!l.value)return;const{scrollTop:N,scrollHeight:ie,clientHeight:fe}=l.value;u.value=ie-N-fe<100,N<50&&n.loadEarlierMessages(_.value,C.value??0)},100);function qe(N,ie){return L(ie)?N.thumbnail_url||N.url||N.small_thumbnail_url||"":N.is_locked?N.blurred_url||N.thumbnail_url||N.url||"":N.thumbnail_url||N.url||N.small_thumbnail_url||""}const{initFancybox:ne,bindFancybox:Z}=_s();function Te(N){return`chatter-gallery-${N}`}function se(N){return N.images?N.images.map(ie=>qe(ie,N)):[]}function Ce(N){return N.images?N.images.map(ie=>L(N)||!ie.is_locked?ie.url||ie.thumbnail_url||"":ie.blurred_url||ie.thumbnail_url||""):[]}function Ue(N){return L(N)?!0:N.is_unlocked===!0||!N.price||N.price<=0}function Ye(N,ie=0){if(!Ue(N))return;const fe=`[data-fancybox="${Te(N.id)}"]`,G=document.querySelectorAll(fe);G.length>ie&&G[ie].click()}function ot(){Tt(()=>{for(const N of M.value)N.images&&N.images.length>0&&Z(`[data-fancybox="${Te(N.id)}"]`,{infinite:!0,caption:!1})})}return Fe(()=>M.value.length,()=>{be(),ot()}),Fe(()=>M.value.map(N=>{var ie;return((ie=N.images)==null?void 0:ie.map(fe=>fe.url||fe.thumbnail_url).join(","))||""}),()=>{ot()},{deep:!0}),Fe(()=>C.value,()=>{be(!0)}),Fe(()=>w.value,(N,ie)=>{ie&&!N&&be(!0)}),Fe(()=>l.value,(N,ie)=>{if(ie&&f.value&&(f.value.disconnect(),f.value=null),N){M.value.length>0&&be(!0);const fe=new MutationObserver(()=>{Ge()});fe.observe(N,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"],characterData:!1}),f.value=fe}}),ze(async()=>{await ne(),ot(),!w.value&&l.value&&be(!0)}),Qe(()=>{f.value&&(f.value.disconnect(),f.value=null)}),(N,ie)=>(i(),a("div",xu,[E.value&&!N.embedded?(i(),a("div",ku,[E.value.photo_url?(i(),a("img",{key:0,src:E.value.photo_url,alt:E.value.username,class:"w-8 h-8 rounded-full object-cover"},null,8,bu)):(i(),a("div",Cu,b(E.value.username.charAt(0).toUpperCase()),1)),s("div",$u,[s("p",Tu,b(E.value.display_name||E.value.username),1),T.value?(i(),a("p",ju," Chatting as "+b(T.value.display_name||T.value.username),1)):k("",!0)]),x.value?(i(),Me($s,{key:2,conversation:x.value,class:"flex-shrink-0"},null,8,["conversation"])):k("",!0),x.value?(i(),a("button",{key:3,class:J(["flex-shrink-0 h-8 px-2 flex items-center gap-1 rounded-full text-xs font-medium transition-colors",x.value.hidden_from_girl?"bg-x-grey-2 text-x-grey-15 hover:bg-x-grey-3":"bg-x-green-1/15 text-x-green-1 hover:bg-x-green-1/25"]),title:x.value.hidden_from_girl?"Hidden from the girl — click to show this thread to her":"Visible to the girl — click to hide this thread from her",onClick:V},[(i(),a("svg",Su,[Au,Eu,x.value.hidden_from_girl?(i(),a("line",Iu)):k("",!0)])),X(" "+b(x.value.hidden_from_girl?"Hidden from girl":"Visible to girl"),1)],10,Mu)):k("",!0),y.value&&x.value?(i(),a("button",{key:4,class:"flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full hover:bg-x-grey-2 text-x-grey-15 transition-colors",title:"Pop out into a floating chat window",onClick:de},Uu)):k("",!0),N.showNotesToggle?(i(),a("button",{key:5,class:J(["flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full transition-colors",N.notesOpen?"bg-x-pink-1 text-white":"hover:bg-x-grey-2 text-x-grey-15"]),title:"Toggle info panel (notes & punter statistics)",onClick:ie[0]||(ie[0]=fe=>r("toggle-notes"))},Nu,2)):k("",!0)])):k("",!0),w.value?(i(),a("div",Fu,Gu)):(i(),a("div",{key:2,ref_key:"messagesContainer",ref:l,class:"flex-1 overflow-y-auto overflow-x-hidden overscroll-contain p-6 pb-6",onScroll:ie[2]||(ie[2]=(...fe)=>O(Ae)&&O(Ae)(...fe))},[A.value?(i(),a("div",Lu,zu)):k("",!0),(i(!0),a(Y,null,he(te.value,fe=>(i(),a("div",{key:fe.date}
4,[s("div",Bu,[s("div",Hu,b(fe.dateLabel),1),Wu]),(i(!0),a(Y,null,he(fe.messages,G=>{var Le,Ke,He,De,We,nt,gt,dt;return i(),a(Y,{key:G.id},[G.images&&G.images.length>0?(i(),a("div",{key:0,class:J(["flex mb-3 group",L(G)?"justify-end":"justify-start"])},[H(G)?(i(),a("button",{key:0,class:"self-center mr-1 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400",title:"Delete message",onClick:Be=>_e(G.id)},Yu,8,Vu)):k("",!0),s("div",{class:J(["flex flex-col gap-2",[N.embedded?"max-w-[230px]":"max-w-[350px]",F(G)?"opacity-70":""]])},[G.images.length===1?(i(),a("div",{key:0,class:"aspect-square overflow-hidden rounded-2xl shadow-sm relative cursor-pointer",onClick:Be=>Ue(G)&&Ye(G,0)},[s("img",{src:qe(G.images[0],G),class:J(["w-full h-full object-cover",{"blur-sm":G.images[0].is_locked&&!L(G)}]),alt:"",style:{"-webkit-touch-callout":"none","-webkit-user-select":"none","user-select":"none"},draggable:"false",onContextmenu:ie[1]||(ie[1]=ke(()=>{},["prevent"]))},null,42,Xu),G.images[0].is_locked&&!L(G)?(i(),a("div",Ju,Zu)):k("",!0),s("span",eh,b(oe(G.created_at)),1),s("a",{href:Ce(G)[0],"data-src":Ce(G)[0],"data-fancybox":Te(G.id),class:"hidden"},null,8,th)],8,Ku)):(i(),a("div",sh,[pe(Ds,{images:se(G),aspectRatio:"1/1",rounded:!0,class:J(["shadow-sm",{"cursor-pointer":Ue(G)}]),onClick:Be=>Ue(G)&&Ye(G,Be)},null,8,["images","class","onClick"]),!L(G)&&G.images.some(Be=>Be.is_locked)?(i(),a("div",oh,ih)):k("",!0),s("span",rh,b(oe(G.created_at)),1),(i(!0),a(Y,null,he(Ce(G),(Be,st)=>(i(),a("a",{key:`gallery-${G.id}-${st}`,href:Be,"data-src":Be,"data-fancybox":Te(G.id),class:"hidden"},null,8,ah))),128))])),G.price&&G.price>0?(i(),a("div",lh,[G.is_unlocked&&L(G)?(i(),a("span",dh," 💰 SOLD · "+b(G.price)+" credits ",1)):!G.is_unlocked&&L(G)?(i(),a("span",ch," Awaiting payment of "+b(G.price)+" credits ",1)):Re(G)?(i(),a("button",{key:2,class:"text-x-pink-1 underline",onClick:Be=>z(G.id)}," Unlock for "+b(G.price)+" credits ",9,uh)):k("",!0)])):k("",!0),G.content?(i(),a("div",{key:3,class:J(["rounded-2xl p-3 text-xs break-words",L(G)?"bg-x-pink-1 text-white rounded-tr-none":"bg-white rounded-tl-none border border-x-grey-1"])},b(G.content),3)):k("",!0),L(G)?(i(),a("div",hh,b(ge(G)),1)):k("",!0)],2)],2)):G.message_type==="video"||G.videos&&G.videos.length>0?(i(),a("div",{key:1,class:J(["flex mb-3 group",L(G)?"justify-end":"justify-start"])}
4,[H(G)?(i(),a("button",{key:0,class:"self-center mr-1 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400",title:"Delete message",onClick:Be=>_e(G.id)},ph,8,gh)):k("",!0),s("div",{class:J(["flex flex-col gap-2",[N.embedded?"max-w-[230px]":"max-w-[350px]",F(G)?"opacity-70":""]])},[pe(zs,{message:G,"current-user-id":W.value,"show-timestamp":!0,"hide-purchased-label":L(G)},null,8,["message","current-user-id","hide-purchased-label"]),L(G)&&G.price&&G.price>0?(i(),a("div",vh,[G.is_unlocked?(i(),a("span",mh," 💰 SOLD · "+b(G.price)+" credits ",1)):(i(),a("span",yh," Awaiting payment of "+b(G.price)+" credits ",1))])):k("",!0),L(G)?(i(),a("div",_h,b(ge(G)),1)):k("",!0)],2)],2)):G.message_type==="gift"?(i(),a("div",wh,[s("div",{class:J(["w-full",[N.embedded?"max-w-[260px]":"max-w-[340px] xl:max-w-[420px]",F(G)?"opacity-70":""]])},[pe(Bs,{message:G,"current-user-id":W.value,"show-timestamp":!0,"recipient-name":((Le=T.value)==null?void 0:Le.display_name)||((Ke=T.value)==null?void 0:Ke.username)||""},null,8,["message","current-user-id","recipient-name"])],2)])):G.message_type==="tip"?(i(),a("div",xh,[s("div",{class:J(["w-full",[N.embedded?"max-w-[260px]":"max-w-[340px] xl:max-w-[420px]",F(G)?"opacity-70":""]])},[pe(Hs,{message:G,"current-user-id":W.value,"show-timestamp":!0,"recipient-name":((He=T.value)==null?void 0:He.display_name)||((De=T.value)==null?void 0:De.username)||""},null,8,["message","current-user-id","recipient-name"])],2)])):D(G)?(i(),a("div",{key:4,class:J(["flex mb-3 group",L(G)?"justify-end":"justify-start"])}
4,[H(G)?(i(),a("button",{key:0,class:"self-center mr-1 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400",title:"Delete message",onClick:Be=>_e(G.id)},Ch,8,kh)):k("",!0),s("div",{class:J(["flex flex-col gap-2 max-w-[280px]",F(G)?"opacity-70":""])},[s("div",{class:J(["rounded-2xl overflow-hidden",L(G)?"rounded-tr-none":"rounded-tl-none"])},[s("img",{src:K(G),alt:"GIF",class:"w-full max-h-64 object-contain bg-gray-100",loading:"lazy"},null,8,$h)],2),s("div",Th,[L(G)?(i(),a("span",jh,b(G.chatter_username||((We=T.value)==null?void 0:We.display_name)||((nt=T.value)==null?void 0:nt.username)||"girl"),1)):k("",!0),s("div",Mh,[F(G)?(i(),a(Y,{key:0},[Sh,X(" sending... ")],64)):(i(),a(Y,{key:1},[X(b(oe(G.created_at)),1)],64))])])],2)],2)):(i(),a("div",{key:5,class:J(["flex mb-3 group",L(G)?"justify-end":"justify-start"])},[H(G)?(i(),a("button",{key:0,class:"self-center mr-1 opacity-0 group-hover:opacity-100 transition-opacity text-gray-300 hover:text-red-400",title:"Delete message",onClick:Be=>_e(G.id)},Ih,8,Ah)):k("",!0),s("div",{class:J(["flex flex-col gap-2.5 max-w-[80%] rounded-2xl p-4 text-xs",[L(G)?"bg-x-pink-1 text-white rounded-tr-none":"bg-white rounded-tl-none border border-x-grey-1",F(G)?"opacity-70":""]])},[G.content?(i(),a("p",Rh,b(G.content),1)):k("",!0),s("div",Uh,[L(G)?(i(),a("span",{key:0,class:J(["text-[9px] opacity-70",L(G)?"text-white/80":"text-black/60"])}
4,b(G.chatter_username||((gt=T.value)==null?void 0:gt.display_name)||((dt=T.value)==null?void 0:dt.username)||"girl"),3)):k("",!0),s("div",{class:J(["text-[9px] opacity-70 whitespace-nowrap flex-shrink-0 flex items-center gap-1",L(G)?"text-white/80":"text-black/60"])},[F(G)?(i(),a(Y,{key:0},[Ph,X(" sending... ")],64)):(i(),a(Y,{key:1},[X(b(oe(G.created_at)),1)],64))],2)])],2)],2))],64)}),128))]))),128)),O(n).isOtherUserTyping(C.value)?(i(),a("div",Nh,Oh)):k("",!0),O(n).isOtherUserPreparingContent(C.value)?(i(),a("div",Gh,Dh)):k("",!0)],544)),g.value!==null?(i(),a("div",{key:3,class:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:ie[4]||(ie[4]=ke(fe=>g.value=null,["self"]))},[s("div",zh,[Bh,Hh,s("div",Wh,[pe(Ve,{size:"xs",color:"secondary",onClick:ie[3]||(ie[3]=fe=>g.value=null)},{default:Ne(()=>[X(" Cancel ")]),_:1}),pe(Ve,{size:"sm",color:"primary",class:"!bg-red-500 hover:!bg-red-600",onClick:Se},{default:Ne(()=>[X(" Delete ")]),_:1})])])])):k("",!0)]))}}),qh={class:"bg-white rounded-lg shadow-xl w-full max-w-md mx-4 flex flex-col"},Yh={class:"px-4 py-3 border-b border-gray-200 flex items-center justify-between"},Kh=s("h3",{class:"font-semibold text-gray-800"},"Edit media",-1),Xh=s("svg",{class:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Jh=[Xh],Qh={class:"p-4 space-y-4"},Zh={class:"flex items-center gap-3"},eg=["src"],tg={class:"text-xs text-gray-400 truncate"},sg=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Name",-1),og=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Description",-1),ng=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Tags",-1),ig={key:0,class:"text-xs text-gray-400"},rg={key:1,class:"flex flex-wrap gap-1.5"},ag=["onClick"],lg={class:"px-4 py-3 border-t border-gray-200 flex justify-end gap-2"},dg=["disabled"],cg=je({__name:"ChatterMediaEditModal",props:{girlId:{},media:{}},emits:["close","updated"],setup(t,{emit:e}){const o=t,r=e,n=Ee(),l=le(),u=I(o.media.name||""),v=I(o.media.description||""),g=(o.media.tags||[]).map(M=>M.id),f=I([...g]),C=I(!1),_=R(()=>n.mediaTags.filter(M=>f.value.includes(M.id)));function y(M){f.value=f.value.includes(M)?f.value.filter(T=>T!==M):[...f.value,M]}async function x(){if(C.value)return;C.value=!0;const M=u.value.trim()||null,T=v.value.trim()||null;try{const w=f.value.filter(E=>!g.includes(E)),A=g.filter(E=>!f.value.includes(E));for(const E of w)await l.attachMediaTag(o.girlId,o.media.id,E);for(const E of A)await l.detachMediaTag(o.girlId,o.media.id,E);await l.updateMediaMeta(o.girlId,o.media.id,M,T),r("updated",{id:o.media.id,name:M,description:T,tags:_.value}),r("close")}catch{ue.error("Failed to save media details")}finally{C.value=!1}}return(M,T)=>(i(),Me(lt,{to:"body"},[s("div",{class:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50",onClick:T[4]||(T[4]=ke(w=>r("close"),["self"]))},[s("div",qh,[s("div",Yh,[Kh,s("button",{class:"p-1 hover:bg-gray-100 rounded transition-colors",onClick:T[0]||(T[0]=w=>r("close"))},Jh)]),s("div",Qh,[s("div",Zh,[s("img",{src:M.media.thumbnail_url||M.media.small_thumbnail_url||M.media.url,class:"w-16 h-16 rounded-lg object-cover flex-shrink-0",alt:""},null,8,eg),s("span",tg,b(M.media.original_filename),1)]),s("div",null,[sg,Ie(s("input",{"onUpdate:modelValue":T[1]||(T[1]=w=>u.value=w),maxlength:"120",placeholder:"e.g. Shower set — teaser 1",class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 text-black"},null,512),[[Oe,u.value]])]),s("div",null,[og,Ie(s("textarea",{"onUpdate:modelValue":T[2]||(T[2]=w=>v.value=w),rows:"3",maxlength:"2000",placeholder:"Notes for the team: what it shows, what it sells for, when to send it...",class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 resize-none text-black"},null,512),[[Oe,v.value]])]),s("div",null,[ng,O(n).mediaTags.length===0?(i(),a("div",ig," No tags in the library yet. ")):(i(),a("div",rg,[(i(!0),a(Y,null,he(O(n).mediaTags,w=>(i(),a("button",{key:w.id,class:J(["px-2 py-0.5 rounded-full text-[11px] font-medium border transition-colors",f.value.includes(w.id)?"text-white border-transparent":"text-gray-600 border-gray-300 hover:border-gray-400 bg-white"]),style:Je(f.value.includes(w.id)?{backgroundColor:w.color}:{}),onClick:A=>y(w.id)},b(w.name),15,ag))),128))]))])]),s("div",lg,[s("button",{class:"px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",onClick:T[3]||(T[3]=w=>r("close"))}," Cancel "),s("button",{disabled:C.value,class:"px-4 py-2 text-sm font-medium text-white bg-x-pink-1 hover:bg-x-pink-1/90 rounded-lg transition-colors disabled:opacity-50",onClick:x},b(C.value?"Saving...":"Save"),9,dg)])])])]))}}),ug={class:"bg-white rounded-lg shadow-xl w-[640px] max-h-[80vh] flex flex-col"},hg={class:"flex items-center justify-between px-4 py-3 border-b border-x-grey-1"},gg={class:"font-semibold text-gray-900"},fg={key:0,class:"text-sm font-normal text-x-grey-15"},pg=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),vg=[pg],mg={class:"flex items-center px-4 py-2 border-b border-x-grey-1 bg-x-grey-2/30"},yg={class:"flex gap-2"},_g=s("svg",{class:"w-3.5 h-3.5 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})],-1),wg=s("svg",{class:"w-3.5 h-3.5 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})],-1),xg={class:"flex items-center justify-between px-4 py-2 border-b border-x-grey-1"},kg={key:0,class:"flex items-center gap-2 text-xs text-x-grey-15"},bg=s("svg",{class:"w-4 h-4 text-x-pink-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})],-1),Cg={key:1,class:"flex flex-wrap items-center gap-1 min-w-0"},$g={key:2,class:"flex gap-1"},Tg=s("svg",{class:"w-3.5 h-3.5 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),jg={key:0,class:"flex items-center flex-wrap gap-1.5 px-4 py-2 border-b border-x-grey-1 bg-gray-50"},Mg=s("span",{class:"text-[10px] uppercase tracking-wide text-x-grey-15 font-semibold"},"Filtered by",-1),Sg=["title","onClick"],Ag={class:"truncate"},Eg=s("svg",{class:"w-3 h-3 flex-shrink-0 opacity-80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2.5"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),Ig={key:1,class:"px-4 py-2 border-b border-x-grey-1 flex items-center gap-2"},Rg={class:"relative flex-1 min-w-0"},Ug=s("svg",{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-x-grey-15",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1),Pg=s("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),Ng=[Pg],Fg=["fill"],Og=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.196-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.783-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"},null,-1),Gg=[Og],Lg={key:0,class:"relative"},Dg=s("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"})],-1),zg={class:"absolute top-full left-0 mt-1 z-50 w-48 max-h-56 overflow-y-auto bg-white rounded-lg shadow-2xl border border-x-grey-1 py-1"},Bg=["onClick"],Hg={class:"flex-1 text-xs text-gray-800 truncate"},Wg={key:0,class:"w-3.5 h-3.5 text-x-pink-1 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Vg=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1),qg=[Vg],Yg={key:2,class:"flex items-center px-4 py-2 border-b border-x-grey-1"},Kg={class:"flex gap-1"},Xg={key:3,class:"flex items-center justify-between px-4 py-2 border-b border-x-grey-1 bg-x-grey-2/
450"},Jg={class:"text-xs text-gray-700 font-medium"},Qg={class:"flex items-center gap-2"},Zg={key:0,class:"text-xs text-red-500"},ef={class:"flex-1 overflow-y-auto p-4"},tf={key:0,class:"flex items-center justify-between mb-2 text-[11px] text-x-grey-15"},sf={class:"font-semibold text-gray-700"},of={class:"font-semibold text-gray-700"},nf={key:0,class:"text-gray-400"},rf={key:1,class:"flex items-center justify-center py-12"},af=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),lf=[af],df={key:2,class:"flex items-center justify-center py-12 text-x-grey-15 text-sm"},cf={key:3,class:"grid grid-cols-4 gap-2"},uf=["onClick","onDblclick"],hf=["src"],gf=["title"],ff={key:1,class:"flex items-center gap-0.5 mt-0.5"},pf=["title"],vf={key:0,class:"text-[8px] text-white/80"},mf={key:1,class:"absolute bottom-1 left-1 bg-black bg-opacity-60 text-white text-xs px-1 rounded flex items-center gap-0.5"},yf=s("svg",{class:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20"},[s("path",{d:"M6.3 2.841A1.5 1.5 0 004 4.11V15.89a1.5 1.5 0 002.3 1.269l9.344-5.89a1.5 1.5 0 000-2.538L6.3 2.84z"})],-1),_f={key:0},wf={key:2,class:"absolute bottom-0 left-0 right-0 bg-black/70 text-white text-[10px] px-2 py-1 text-center"},xf={key:3,class:"absolute top-1 left-1 bg-purple-500 text-white text-[9px] px-1 py-0.5 rounded"},kf={key:0,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},bf=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1),Cf=[bf],$f={key:1,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Tf=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1),jf=[Tf],Mf={key:2,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Sf=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"},null,-1),Af=[Sf],Ef=["title"],If=["max","value","onChange"],Rf={class:"absolute inset-x-0 bottom-1 flex justify-center gap-2"},Uf=["disabled","onClick"],Pf=s("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"3"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})],-1),Nf=[Pf],Ff=["disabled","onClick"],Of=s("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"3"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 5l7 7-7 7"})],-1),Gf=[Of],Lf=["title","onClick"],Df=["fill"],zf=s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.196-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.783-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"},null,-1),Bf=[zf],Hf=["onClick"],Wf=s("svg",{class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1),Vf=[Wf],qf=["onClick"],Yf=s("svg",{class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1),Kf=[Yf],Xf=["onClick"],Jf=s("svg",{class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}
4)],-1),Qf=[Jf],Zf=["href","data-media-key"],ep={key:4,class:"flex items-center justify-center py-4 text-xs text-x-grey-15 gap-2"},tp=s("div",{class:"animate-spin rounded-full h-4 w-4 border-b-2 border-x-pink-1"},null,-1),sp={key:5,class:"flex items-center justify-center py-3 text-[10px] text-x-grey-15"},op={key:4,class:"px-4 py-3 border-t border-x-grey-1 space-y-2"},np={class:"flex items-center gap-2 overflow-x-auto pt-1.5 px-1.5 pb-1"},ip=s("span",{class:"text-[10px] text-x-grey-15 flex-shrink-0"},"Send order:",-1),rp=["src"],ap={class:"absolute -top-1 -left-1 min-w-4 h-4 px-0.5 bg-x-pink-1 text-white text-[9px] font-bold rounded-full flex items-center justify-center border border-white"},lp=["onClick"],dp=s("svg",{class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"3"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),cp=[dp],up={class:"absolute inset-x-0 bottom-0 flex justify-between px-0.5 pb-0.5 opacity-0 group-hover/order:opacity-100 transition-opacity"},hp=["disabled","onClick"],gp=s("svg",{class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"3"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})],-1),fp=[gp],pp=["disabled","onClick"],vp=s("svg",{class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"3"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 5l7 7-7 7"})],-1),mp=[vp],yp={class:"flex gap-3"},_p={class:"flex-1"},wp=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Message (optional)",-1),xp={class:"w-28"},kp=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Price (credits)",-1),bp=["value"],Cp={key:5,class:"flex items-center justify-between px-4 py-3 border-t border-x-grey-1"},$p={class:"text-sm text-x-grey-15"},Tp={class:"flex gap-2"},jp={key:6,class:"flex items-center justify-between px-4 py-3 border-t border-x-grey-1"},Mp={class:"flex items-center gap-3"},Sp={class:"text-sm text-x-grey-15"},Ap=s("svg",{class:"w-3.5 h-3.5 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})],-1),Ep={class:"flex gap-2"},Ip={class:"bg-white rounded-lg shadow-xl p-6 w-80"},Rp=s("h3",{class:"font-semibold text-gray-900 mb-2"},"Delete Media?",-1),Up=s("p",{class:"text-sm text-gray-500 mb-4"},"This will permanently remove this item from the repository.",-1),Pp={class:"flex justify-end gap-2"},Np={class:"relative w-full max-w-4xl max-h-[90vh] mx-4"},Fp=s("svg",{class:"w-8 h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Op=[Fp],Gp=["src","type"],Jt=50,Lp=je({__name:"ChatterMediaRepositoryModal",props:{conversationId:{},girlId:{}},emits:["close","send"],setup(t,{emit:e}){const o=t,r=e,n=Ee(),l=le(),{initFancybox:u,bindFancybox:v}=_s(),g=R(()=>o.girlId??n.selectedGirlId),f=R(()=>n.girls.find(j=>j.id===g.value)??null),C=I([]),_=I([]),y=new Map,x=I(!1),M=I(!1),T=I("0"),w=I(""),A=I(null),E=I("all"),V=I("all"),de=I("repository"),W=I(!1),te=I(!1),L=I([]),F=R(()=>n.mediaTags.filter(j=>L.value.includes(j.id))),D=I(!1),K=I(null),H=I("");let Re=null;const _e=I(!1),Se=I(!1),z=I(!1);let oe=!1;function ge(j){return j.gallery_photo_id?`gallery_photo_${j.gallery_photo_id}`:j.gallery_video_id?`gallery_video_${j.gallery_video_id}`:`repo_${j.id}`}function be(j){return j.source_type==="gallery_photo"||j.source_type==="gallery_video"||j.gallery_photo_id!==void 0||j.gallery_video_id!==void 0}const Ge=R(()=>_.value.length>0),Ae=R(()=>{const j=new Map(C.value.map(P=>[ge(P),P]));return _.value.map(P=>j.get(P)??y.get(P)).filter(P=>P!==void 0)}),qe=R(()=>{const j=Ae.value.filter(re=>!be(re)&&re.id).map(ge),P=Ae.value.filter(re=>re.gallery_photo_id).map(ge),$=Ae.value.filter(re=>re.gallery_video_id).map(ge);return[...j,...P,...$]}),ne=R(()=>Ae.value.filter(j=>!be(j)&&j.id).map(j=>j.id)),Z=R(()=>Ae.value.filter(j=>j.gallery_photo_id).map(j=>j.gallery_photo_id)),Te=R(()=>Ae.value.filter(j=>j.gallery_video_id).map(j=>j.gallery_video_id)),se=R(()=>
4{if(_e.value)return C.value;let j=C.value;return E.value!=="all"&&(j=j.filter(P=>(P.media_type||P.type||"image")===E.value)),o.conversationId&&de.value==="repository"&&V.value!=="all"&&(j=j.filter(P=>{const $=P.conversation_status||"not_sent",re=Number(P.message_price)||0;switch(V.value){case"not_sent":return!P.conversation_status||$==="not_sent";case"sent":return $==="purchased"&&re===0;case"waiting":return $==="sent_pending";case"paid":return $==="purchased"&&re>0;default:return!0}})),j}),Ce=I({images:0,videos:0,total:0}),Ue=R(()=>({all:Ce.value.total,image:Ce.value.images,video:Ce.value.videos})),Ye=I(null),ot=R(()=>Ye.value?Ye.value:{all:C.value.length,not_sent:C.value.filter(j=>!j.conversation_status||j.conversation_status==="not_sent").length,sent:C.value.filter(j=>j.conversation_status==="purchased"&&(!j.message_price||Number(j.message_price)===0)).length,waiting:C.value.filter(j=>j.conversation_status==="sent_pending").length,paid:C.value.filter(j=>j.conversation_status==="purchased"&&j.message_price&&Number(j.message_price)>0).length}),N=R(()=>{const j=Ae.value;if(j.length===0)return null;const P=j.some(ye=>(ye.media_type||ye.type||"image")==="image"),$=j.some(ye=>(ye.media_type||ye.type)==="video"),re=j.filter(ye=>(ye.media_type||ye.type)==="video").length;return P&&$?"Cannot mix images and videos in one message":re>1?"Only 1 video per message allowed":j.length>12?"Maximum 12 items per message":null}),ie=R(()=>Ge.value&&!N.value),fe=I(1),G=I(!0),Le=I(!1),Ke=I(null);let He=null;ze(async()=>{await u(),await De(),Xe(),gt()}),Qe(()=>{dt()}),Fe(()=>C.value.length,()=>{Xe()}),Fe([de,E,()=>g.value,te,L],async()=>{oe||await De()}),Fe(H,()=>{oe||(Re&&clearTimeout(Re),Re=setTimeout(()=>{De()},300))}),Fe([de,()=>g.value],()=>{_t()});async function De(){if(g.value){C.value=[],Ce.value={images:0,videos:0,total:0},Ye.value=null,fe.value=1,G.value=!0,x.value=!0;try{await We(1)}finally{x.value=!1}}}async function We(j){if(!g.value)return;const P=E.value==="all"?void 0:E.value;try{if(de.value==="gallery"){const $=await l.getGalleryContent(g.value,P,j,Jt,o.conversationId??void 0),re=($==null?void 0:$.data)||[];C.value=j===1?re:C.value.concat(re);const ye=($==null?void 0:$.meta)||{current_page:j,last_page:j};G.value=(ye.current_page??j)<(ye.last_page??j),$!=null&&$.counts&&(Ce.value=$.counts)}else{const $=await l.getMediaRepository(g.value,o.conversationId,j,Jt,P,L.value.length>0?L.value:void 0,te.value||void 0,H.value.trim()||void 0),re=($==null?void 0:$.data)||[];C.value=j===1?re:C.value.concat(re);const ye=($==null?void 0:$.meta)||{};ye.current_page!==void 0&&ye.last_page!==void 0?G.value=ye.current_page<ye.last_page:G.value=re.length>=Jt;const Ze=$==null?void 0:$.counts;Ze?Ce.value=Ze:ye.total!==void 0&&(Ce.value={images:0,videos:0,total:ye.total});const rt=$==null?void 0:$.statusCounts;rt&&(Ye.value=rt)}fe.value=j}catch($){console.error("Failed to load media page "+j+":",$)}}async function nt(){if(!(Le.value||x.value||!G.value)){Le.value=!0;try{await We(fe.value+1)}finally{Le.value=!1}}}function gt(){dt(),Tt(()=>{Ke.value&&(He=new IntersectionObserver(j=>{for(const P of j)P.isIntersecting&&nt()},{rootMargin:"300px 0px"}),He.observe(Ke.value))})}function dt(){He&&(He.disconnect(),He=null)}async function Be(){await De()}function st(j){const P=ge(j);_.value.includes(P)?(_.value=_.value.filter($=>$!==P),y.delete(P)):(_.value=[..._.value,P],y.set(P,j))}function St(j){return _.value.includes(ge(j))}function yt(j){const P=qe.value.indexOf(ge(j));return P===-1?null:P+1}const At=R(()=>{const j=new Map(Ae.value.map(P=>[ge(P),P]));return qe.value.map(P=>j.get(P)).filter(P=>P!==void 0)});function Et(j){return j.startsWith("gallery_photo_")?"photo":j.startsWith("gallery_video_")?"video":"repo"}function It(j,P){const $=_.value,re=$.indexOf(j);if(re===-1)return-1;for(let ye=re+P;ye>=0&&ye<$.length;ye+=P)if(Et($[ye])===Et(j))return ye;return-1}function Rt(j,P){return It(ge(j),P)!==-1}function Ut(j,P){const $=ge(j),re=[..._.value],ye=re.indexOf($),Ze=It($,P);ye===-1||Ze===-1||([re[ye],re[Ze]]=[re[Ze],re[ye]],_.value=re)}function _t(){_.value=[],y.clear()}const wt=new Set;async function Nt(j){if(!g.value||be(j)||wt.has(j.id))return;wt.add(j.id);const P=!!j.is_favourite;j.is_favourite=!P;try{const $=await l.toggleMediaFavourite(g.value,j.id);j.is_favourite=$,te.value&&!$&&(C.value=C.value.filter(re=>re!==j))}catch{j.is_favourite=P,ue.error("Failed to update favourite")}finally{wt.delete(j.id)}}function xt(j){L.value=L.value.includes(j)?L.value.filter(P=>P!==j):[...L.value,j]}function Ft(j){const P=C.value.findIndex($=>!be($)&&$.id===j.id);P!==-1&&(C.value[P]={...C.value[P],name:j.name,description:j.description,tags:j.tags}),K.value&&K.value.id===j.id&&(K.value=C.value[P]??K.value),P!==-1&&L.value.length>0&&(j.tags.some(re=>L.value.includes(re.id))||(C.value=C.value.filter(re=>
4be(re)||re.id!==j.id)))}function kt(j){const P=j.target,$=Math.max(0,Math.floor(Number(P.value)||0));T.value=String($)}function Ot(){r("send",{mediaIds:ne.value,price:Number(T.value),content:w.value,galleryPhotoIds:Z.value,galleryVideoIds:Te.value})}function Gt(){W.value=!0}function p(j){W.value=!1,j.messagesSent>0&&(g.value&&n.fetchConversations(g.value),r("close"))}function m(j){return j.thumbnail_url||j.small_thumbnail_url||j.url||""}function d(j){return j.media_type==="video"||j.type==="video"}function c(j){if(!o.conversationId||!j.conversation_status)return null;switch(j.conversation_status){case"purchased":return j.message_price&&Number(j.message_price)>0?{label:`${Math.floor(Number(j.message_price))}cr`,color:"bg-green-500",icon:"check"}:{label:"Sent",color:"bg-gray-500",icon:"check"};case"sent_pending":return j.message_price&&Number(j.message_price)>0?{label:`${Math.floor(Number(j.message_price))}cr`,color:"bg-yellow-500",icon:"clock"}:{label:"Sent",color:"bg-blue-500",icon:"send"};default:return null}}async function h(){if(!(!g.value||de.value!=="repository")){_e.value=!0,_t(),oe=!0,E.value="all",te.value=!1,L.value=[],H.value="",z.value=!0;try{await De();let j=0;for(;G.value&&j<40;)await We(fe.value+1),j++}finally{z.value=!1,oe=!1}}}function S(j,P){const $=j+P;if($<0||$>=C.value.length)return;const re=[...C.value];[re[j],re[$]]=[re[$],re[j]],C.value=re}function U(j,P){const $=P.target,re=Math.min(Math.max(Math.floor(Number($.value)||0),1),C.value.length)-1;if(re===j){$.value=String(j+1);return}const ye=[...C.value],[Ze]=ye.splice(j,1);ye.splice(re,0,Ze),C.value=ye}async function B(){if(!(!g.value||Se.value)){Se.value=!0;try{const j=C.value.filter(P=>!be(P)&&P.id).map(P=>P.id);await l.reorderMedia(g.value,j),ue.success("Order saved for the whole team"),_e.value=!1,await De()}catch{ue.error("Failed to save order")}finally{Se.value=!1}}}async function Q(){_e.value=!1,await De()}function ce(j,P){if(_e.value)return;const $=P==null?void 0:P.target;$&&$.closest("a[data-fancybox]")||st(j)}const q=I(null),ve=I(!1),we=I(null),me=I(null);let xe=null;function Xe(){Tt(()=>{v('[data-fancybox="chatter-media-repo"]',{infinite:!0,caption:!1})})}function ft(j){return j.url||j.thumbnail_url||""}function it(j,P){if(P.stopPropagation(),d(j)){const $=j.url||j.video_url;if($){const re=$.includes(".m3u8");we.value={url:$,mimeType:j.mime_type||"video/mp4",isHls:re},re&&Tt(()=>bt())}}else{const $=ge(j),re=document.querySelector(`[data-fancybox="chatter-media-repo"][data-media-key="${$}"]`);re&&re.click()}}function bt(){!me.value||!we.value||(xe&&(xe.destroy(),xe=null),Xt.isSupported()?(xe=new Xt({enableWorker:!0,lowLatencyMode:!1}),xe.loadSource(we.value.url),xe.attachMedia(me.value),xe.on(Xt.Events.MANIFEST_PARSED,()=>{var j;(j=me.value)==null||j.play()})):me.value.canPlayType("application/vnd.apple.mpegurl")&&(me.value.src=we.value.url,me.value.play()))}function ts(){xe&&(xe.destroy(),xe=null),we.value=null}async function Ss(){var j,P;if(!(!q.value||!g.value||ve.value)){ve.value=!0;try{await l.deleteMediaFromRepository(g.value,q.value);const $=`repo_${q.value}`;_.value=_.value.filter(re=>re!==$),y.delete($),q.value=null,await Be()}catch($){console.error("Failed to delete media:",$),(j=$==null?void 0:$.message)!=null&&j.includes("purchased")||(P=$==null?void 0:$.error)!=null&&P.includes("purchased")?ue.error("Cannot delete media that has been purchased"):ue.error("Failed to delete media")}finally{ve.value=!1}}}function As(){var j;(j=A.value)==null||j.click()}async function Es(j){var Ze;const P=j.target;if(!P.files||P.files.length===0||!g.value)return;M.value=!0;const $=g.value,re=["image/jpeg","image/png","image/gif","image/bmp","image/webp","image/avif"],ye=["video/mp4","video/quicktime","video/webm"];try{const rt=Array.from(P.files);let Ct=0;const pt=[];for(const Pe of rt){const ss=Pe.type.startsWith("video/");if(!(ss?ye.includes(Pe.type):re.includes(Pe.type))){pt.push(`${Pe.name}: unsupported file type`);continue}const qt=ss?await l.uploadVideoToRepository($,Pe):await l.uploadImageToRepository($,Pe);qt.error?(console.error("Upload failed:",qt.error),pt.push(`${Pe.name}: ${((Ze=qt.error)==null?void 0:Ze.message)||"upload failed"}`)):Ct++}await Be(),pt.length>0&&ue.error(pt.join(`
5`)),Ct>0&&ue.success(`${Ct} file(s) uploaded successfully`)}catch(rt){console.error("Upload failed:",rt),ue.error("Upload failed")}finally{M.value=!1,P&&(P.value="")}}return Fe(()=>n.lastVideoReadyEvent,j=>{if(!j||!j.media||!j.media.id||j.girlId!==g.value)return;const P=C.value.findIndex($=>$.id===j.media.id);P!==-1&&(C.value[P]={...C.value[P],...j.media})}),Qe(()=>{xe&&(xe.destroy(),xe=null)}),(j,P)=>(i(),a(Y,null,[s("div",{class:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:P[13]||(P[13]=ke($=>r("close"),["self"]))},[s("div",ug,[s("div",hg,[s("h3",gg,[X(" Media Repository "),f.value?(i(),a("span",fg," - "+b(f.value.display_name||f.value.username),1)):k("",!0)]),s("button",{class:"text-x-grey-15 hover:text-gray-900 transition-colors",onClick:P[0]||(P[0]=$=>r("close"))},vg)]),s("div",mg,[s("div",yg,[pe(Ve,{size:"xs",color:de.value==="repository"?"primary":"grey",rounded:"full",onClick:P[1]||(P[1]=$=>de.value="repository")},{default:Ne(()=>[_g,X(" Repository ")]),_:1},8,["color"]),pe(Ve,{size:"xs",color:de.value==="gallery"?"primary":"grey",rounded:"full",onClick:P[2]||(P[2]=$=>de.value="gallery")},{default:Ne(()=>[wg,X(" Private Gallery ")]),_:1},8,["color"])])]),s("div",xg,[_e.value?(i(),a("div",kg,[bg,X(" Arrange mode — move tiles with the arrows, then save. The order applies for the whole team. ")])):(i(),a("div",Cg,[(i(),a(Y,null,he(["all","image","video"],$=>pe(Ve,{key:$,size:"xs",color:E.value===$?"primary":"grey",rounded:"full",class:"whitespace-nowrap flex-shrink-0",onClick:re=>E.value=$},{default:Ne(()=>[X(b($==="all"?"All":$==="image"?"Images":"Videos")+" ("+b(Ue.value[$])+") ",1)]),_:2},1032,["color","onClick"])),64))])),_e.value?k("",!0):(i(),a("div",$g,[de.value==="repository"?(i(),Me(Ve,{key:0,size:"xs",color:"primary",disabled:M.value,onClick:As},{default:Ne(()=>[Tg,X(" "+b(M.value?"Uploading...":"Upload"),1)]),_:1},8,["disabled"])):k("",!0)]))]),de.value==="repository"&&F.value.length>0&&!_e.value?(i(),a("div",jg,[Mg,(i(!0),a(Y,null,he(F.value,$=>(i(),a("button",{key:$.id,class:"inline-flex items-center gap-1 h-5 pl-2 pr-1 rounded-full text-[11px] font-medium text-white max-w-[140px] hover:opacity-85 transition-opacity",style:Je({backgroundColor:$.color}),title:`Remove ${$.name} filter`,onClick:re=>xt($.id)},[s("span",Ag,b($.name),1),Eg],12,Sg))),128)),s("button",{class:"text-[11px] text-x-grey-15 underline hover:text-x-pink-1 transition-colors",onClick:P[3]||(P[3]=$=>L.value=[])}," Clear all ")])):k("",!0),de.value==="repository"&&!_e.value?(i(),a("div",Ig,[s("div",Rg,[Ug,Ie(s("input",{"onUpdate:modelValue":P[4]||(P[4]=$=>H.value=$),type:"text",placeholder:"Search media by name, description or filename...",class:"w-full h-8 text-xs text-black pl-8 pr-8 rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey"},null,512),[[Oe,H.value]]),H.value?(i(),a("button",{key:0,class:"absolute right-2 top-1/2 -translate-y-1/2 text-x-grey-15 hover:text-gray-700",title:"Clear search",onClick:P[5]||(P[5]=$=>H.value="")},Ng)):k("",!0)]),s("button",{class:J(["flex items-center gap-1 h-6 px-2 rounded-full text-xs font-medium border transition-colors whitespace-nowrap flex-shrink-0",te.value?"bg-x-gold-4 border-x-gold-4 text-white":"border-x-grey-1 text-x-grey-15 hover:border-x-gold-4 hover:text-x-gold-8"]),title:"Show only your favourites",onClick:P[6]||(P[6]=$=>te.value=!te.value)},[(i(),a("svg",{class:"w-3 h-3",fill:te.value?"currentColor":"none",stroke:"currentColor",viewBox:"0 0 24 24"},Gg,8,Fg)),X(" Favourites ")],2),O(n).mediaTags.length>0?(i(),a("div",Lg,[s("button",{class:J(["flex items-center gap-1 h-6 px-2 rounded-full text-xs font-medium border transition-colors whitespace-nowrap flex-shrink-0",L.value.length>0?"bg-x-pink-1 border-x-pink-1 text-white":"border-x-grey-1 text-x-grey-15 hover:border-x-pink-1 hover:text-x-pink-1"]),onClick:P[7]||(P[7]=$=>{D.value=!D.value,D.value&&O(n).fetchTags()})},[Dg,X(" Tags"+b(L.value.length>0?` (${L.value.length})`:""),1)],2),D.value?(i(),a(Y,{key:0},[s("div",{class:"fixed inset-0 z-40",onClick:P[8]||(P[8]=$=>D.value=!1)}),s("div",zg,[(i(!0),a(Y,null,he(O(n).mediaTags,$=>(i(),a("button",{key:$.id,class:"w-full flex items-center gap-2 px-3 py-1.5 hover:bg-gray-50 transition-colors text-left",onClick:re=>xt($.id)},[s("span",{class:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:Je({backgroundColor:$.color})},null,4),s("span",Hg,b($.name),1),L.value.includes($.id)?(i(),a("svg",Wg,qg)):k("",!0)],8,Bg))),128))])],64)):k("",!0)])):k("",!0)])):k("",!0),j.conversationId&&de.value==="repository"&&!_e.value?(i(),a("div",Yg,[s("div",Kg,[(i(),a(Y,null,he(["all","not_sent","sent","waiting","paid"],$=>pe(Ve,{key:$,size:"xs",color:V.value===$?"secondary":"grey",rounded:"full",onClick:re=>V.value=$},{default:Ne(()=>[X(b($==="all"?"All":$==="not_sent"?"Not Sent":$==="sent"?"Sent":$==="waiting"?"Waiting":"Paid")+" ("+b(ot.value[$])+") ",1)]),_:2},1032,["color","onClick"])),64))])])):k("",!0),Ge.value&&!_e.value?(i(),a("div",Xg,[s("span",Jg,b(Ae.value.length)+" selected — sent in this order",1),s("div",Qg,[N.value?(i(),a("span",Zg,b(N.value),1)):k("",!0),s("button",{class:"text-xs text-x-grey-15 hover:text-gray-900 transition-colors",onClick:_t}," Clear ")])])):k("",!0),s("div",ef,[!x.value&&Ce.value.total>0?(i(),a("div",tf,[s("span",null,[X(" Loaded "),s("span",sf,b(C.value.length),1),X(" of "),s("span",of,b(Ce.value.total),1),X(" "+b(de.value==="gallery"?"gallery items":"repository items"),1)]),Ce.value.images+Ce.value.videos>0?(i(),a("span",nf,b(Ce.value.images)+" image"+b(Ce.value.images===1?"":"s")+" · "+b(Ce.value.videos)+" video"+b(Ce.value.videos===1?"":"s"),1)):k("",!0)])):k("",!0),x.value?(i(),a("div",rf,lf)):se.value.length===0?(i(),a("div",df,[de.value==="repository"&&(F.value.length>0||te.value)?(i(),a(Y,{key:0},[X(" No media matches the active filters "),s("button",{class:"block mx-auto mt-2 text-xs text-x-pink-1 underline",onClick:P[9]||(P[9]=$=>{L.value=[],te.value=!1})}," Clear filters ")],64)):(i(),a(Y,{key:1},[X(b(de.value==="gallery"?"No private gallery content":"No media in repository"),1)],64))])):(i(),a("div",cf,[(i(!0),a(Y,null,he(se.value,($,re)=>{var ye,Ze,rt,Ct,pt;return i(),a("button",{key:ge($),class:J(["relative aspect-square rounded-lg overflow-hidden border-2 transition-colors group",St($)&&!_e.value?"border-x-pink-1":"border-transparent hover:border-x-grey-1"]),onClick:Pe=>ce($,Pe),onDblclick:Pe=>_e.value?void 0:it($,Pe)},[s("img",{src:m($),class:"w-full h-full object-cover",alt:""},null,8,hf),$.name||$.tags&&$.tags.length>0?(i(),a("div",{key:0,class:J(["absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/75 to-transparent px-1 pt-4 text-left pointer-events-none",d($)?"pb-6":"pb-0.5"])},[$.name?(i(),a("div",{key:0,class:"text-[9px] text-white font-medium truncate leading-tight",title:$.name},b($.name),9,gf)):k("",!0),$.tags&&$.tags.length>0?(i(),a("div",ff,[(i(!0),a(Y,null,he($.tags.slice(0,3),Pe=>(i(),a("span",{key:Pe.id,class:"w-2 h-2 rounded-full border border-white/40",style:Je({backgroundColor:Pe.color}),title:Pe.name},null,12,pf))),128)),$.tags.length>3?(i(),a("span",vf,"+"+b($.tags.length-3),1)):k("",!0)])):k("",!0)],2)):k("",!0),d($)?(i(),a("div",mf,[yf,$.formatted_duration?(i(),a("span",_f,b($.formatted_duration),1)):k("",!0)])):k("",!0),d($)&&$.bunny_status&&$.bunny_status!=="ready"?(i(),a("div",wf,[$.bunny_status==="pending"?(i(),a(Y,{key:0},[X("Pending...")],64)):$.bunny_status==="processing"?(i(),a(Y,{key:1},[X("Processing...")],64)):$.bunny_status==="failed"?(i(),a(Y,{key:2},[X("Failed")],64)):k("",!0)])):k("",!0),be($)?(i(),a("div",xf," Gallery ")):k("",!0),c($)?(i(),a("div",{key:4,class:J(["absolute bottom-1 right-1 text-white text-[10px] px-1.5 py-0.5 rounded flex items-center gap-0.5",(ye=c($))==null?void 0:ye.color])},[((Ze=c($))==null?void 0:Ze.icon)==="check"?(i(),a("svg",kf,Cf)):((rt=c($))==null?void 0:rt.icon)==="clock"?(i(),a("svg",$f,jf)):((Ct=c($))==null?void 0:Ct.icon)==="send"?(i(),a("svg",Mf,Af)):k("",!0),s("span",null,b((pt=c($))==null?void 0:pt.label),1)],2)):k("",!0),St($)&&!_e.value?(i(),a("div",{key:5,class:"absolute top-1 right-1 min-w-5 h-5 px-1 bg-x-pink-1 rounded-full flex items-center justify-center text-white text-[10px] font-bold border border-white",title:`Sends as #${yt($)}`},b(yt($)),9,Ef)):k("",!0),_e.value?(i(),a(Y,{key:6}
5,[s("input",{type:"number",min:"1",max:se.value.length,value:re+1,class:"absolute top-1 left-1 w-11 h-5 bg-gray-900/80 text-white text-[10px] font-bold rounded-full px-1.5 text-center focus:outline-none focus:ring-1 focus:ring-x-pink-1",title:"Type a position and press Enter",onClick:P[10]||(P[10]=ke(()=>{},["stop"])),onChange:Pe=>U(re,Pe)},null,40,If),s("div",Rf,[s("button",{class:"w-6 h-6 bg-black/70 hover:bg-x-pink-1 text-white rounded-full flex items-center justify-center disabled:opacity-30 disabled:hover:bg-black/70",disabled:re===0,title:"Move earlier",onClick:ke(Pe=>S(re,-1),["stop"])},Nf,8,Uf),s("button",{class:"w-6 h-6 bg-black/70 hover:bg-x-pink-1 text-white rounded-full flex items-center justify-center disabled:opacity-30 disabled:hover:bg-black/70",disabled:re===se.value.length-1,title:"Move later",onClick:ke(Pe=>S(re,1),["stop"])},Gf,8,Ff)])],64)):k("",!0),!be($)&&!_e.value?(i(),a("button",{key:7,class:J(["absolute top-1 right-7 w-5 h-5 rounded-full flex items-center justify-center transition-opacity",$.is_favourite?"bg-x-gold-4 opacity-100":"bg-black bg-opacity-50 opacity-0 group-hover:opacity-100 hover:bg-x-gold-4"]),title:$.is_favourite?"Remove from favourites":"Add to favourites",onClick:ke(Pe=>Nt($),["stop"])},[(i(),a("svg",{class:"w-3 h-3 text-white",fill:$.is_favourite?"currentColor":"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},Bf,8,Df))],10,Lf)):k("",!0),_e.value?k("",!0):(i(),a("button",{key:8,class:J(["absolute top-1 left-7 w-5 h-5 bg-black bg-opacity-50 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-blue-500",{"!left-16":be($)}]),title:"Preview",onClick:ke(Pe=>it($,Pe),["stop"])},Vf,10,Hf)),!be($)&&!_e.value?(i(),a("button",{key:9,class:"absolute top-1 left-[3.25rem] w-5 h-5 bg-black bg-opacity-50 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-x-pink-1",title:"Edit name, description & tags",onClick:ke(Pe=>K.value=$,["stop"])},Kf,8,qf)):k("",!0),!be($)&&!_e.value?(i(),a("button",{key:10,class:"absolute top-1 left-1 w-5 h-5 bg-black bg-opacity-50 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",title:"Delete",onClick:ke(Pe=>q.value=$.id,["stop"])},Qf,8,Xf)):k("",!0),d($)?k("",!0):(i(),a("a",{key:11,href:ft($),"data-fancybox":"chatter-media-repo","data-media-key":ge($),class:"hidden",tabindex:"-1"},null,8,Zf))],42,uf)}),128))])),s("div",{ref_key:"scrollSentinel",ref:Ke,class:"h-1 w-full"},null,512),Le.value?(i(),a("div",ep,[tp,X(" Loading more… ")])):!G.value&&C.value.length>0?(i(),a("div",sp," End of list ")):k("",!0)]),Ge.value&&!_e.value?(i(),a("div",op,[s("div",np,[ip,(i(!0),a(Y,null,he(At.value,($,re)=>(i(),a("div",{key:`order-${ge($)}`,class:"relative flex-shrink-0 group/order"},[s("img",{src:m($),class:"w-12 h-12 rounded-lg object-cover border border-x-grey-1",alt:""},null,8,rp),s("span",ap,b(re+1),1),s("button",{class:"absolute -top-1 -right-1 w-4 h-4 bg-gray-700 hover:bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover/order:opacity-100 transition-opacity",title:"Remove from selection",onClick:ye=>st($)},cp,8,lp),s("div",up,[s("button",{class:"w-4 h-4 bg-black/70 hover:bg-x-pink-1 text-white rounded flex items-center justify-center disabled:opacity-30 disabled:hover:bg-black/70",disabled:!Rt($,-1),title:"Send earlier",onClick:ye=>Ut($,-1)},fp,8,hp),s("button",{class:"w-4 h-4 bg-black/70 hover:bg-x-pink-1 text-white rounded flex items-center justify-center disabled:opacity-30 disabled:hover:bg-black/70",disabled:!Rt($,1),title:"Send later",onClick:ye=>Ut($,1)},mp,8,pp)])]))),128))]),s("div",yp,[s("div",_p,[wp,Ie(s("input",{"onUpdate:modelValue":P[11]||(P[11]=$=>w.value=$),class:"w-full h-8 text-xs text-black px-3 rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey",placeholder:"Add a message..."},null,512),[[Oe,w.value]])]),s("div",xp,[kp,s("input",{value:T.value,type:"number",min:"0",step:"1",class:"w-full h-8 text-xs text-black px-3 rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey",onInput:kt},null,40,bp)])])])):k("",!0),_e.value?(i(),a("div",Cp,[s("span",$p,[z.value?(i(),a(Y,{key:0},[X("Loading the whole repository…")],64)):(i(),a(Y,{key:1},[X(b(C.value.length)+" items — drag order applies to everyone",1)],64))]),s("div",Tp,[pe(Ve,{size:"xs",color:"grey",disabled:Se.value,onClick:Q},{default:Ne(()=>[X(" Cancel ")]),_:1},8,["disabled"]),pe(Ve,{size:"xs",color:"primary",disabled:Se.value||z.value,onClick:B},{default:Ne(()=>[X(b(Se.value?"Saving…":"Save order"),1)]),_:1},8,["disabled"])])])):(i(),a("div",jp,[s("div",Mp,[s("span",Sp,b(Ae.value.length)+" selected ",1),de.value==="repository"?(i(),Me(Ve,{key:0,size:"xs",color:"grey",rounded:"full",title:"Arrange the repository display order (applies for the whole team)",onClick:h},{default:Ne(()=>[Ap,X(" Arrange ")]),_:1})):k("",!0)]),s("div",Ep,[pe(Ve,{size:"xs",color:"grey",onClick:P[12]||(P[12]=$=>r("close"))},{default:Ne(()=>[X(" Cancel ")]),_:1}),ie.value?(i(),Me(Ve,{key:0,size:"xs",color:"secondary",onClick:Gt},{default:Ne(()=>[X(" Send to Multiple ")]),_:1})):k("",!0),pe(Ve,{size:"xs",color:"primary",disabled:!ie.value,onClick:Ot},{default:Ne(()=>[X(" Send ("+b(Ae.value.length)+") ",1)]),_:1},8,["disabled"])])])),s("input",{ref_key:"fileInput",ref:A,type:"file",accept:"image/*,video/mp4,video/quicktime,video/webm,.mp4,.mov,.webm",multiple:"",class:"hidden",onChange:Es},null,544)])]),K.value&&g.value?(i(),Me(cg,{key:0,"girl-id":g.value,media:K.value,onClose:P[14]||(P[14]=$=>K.value=null),onUpdated:Ft},null,8,["girl-id","media"])):k("",!0),W.value?(i(),Me(bs,{key:1,"girl-id":g.value??void 0,"media-ids":ne.value,"media-items":Ae.value,"gallery-photo-ids":Z.value,"gallery-video-ids":Te.value,onClose:P[15]||(P[15]=$=>W.value=!1),onSent:p},null,8,["girl-id","media-ids","media-items","gallery-photo-ids","gallery-video-ids"])):k("",!0),(i(),Me(lt,{to:"body"},[q.value!==null?(i(),a("div",{key:0,class:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50",onClick:P[17]||(P[17]=ke($=>q.value=null,["self"]))},[s("div",Ip,[Rp,Up,s("div",Pp,[pe(Ve,{size:"xs",color:"grey",disabled:ve.value,onClick:P[16]||(P[16]=$=>q.value=null)},{default:Ne(()=>[X(" Cancel ")]),_:1},8,["disabled"]),pe(Ve,{size:"xs",color:"primary",class:"!bg-red-500 hover:!bg-red-600",disabled:ve.value,onClick:Ss},{default:Ne(()=>[X(b(ve.value?"Deleting...":"Delete"),1)]),_:1},8,["disabled"])])])])):k("",!0)])),(i(),Me(lt,{to:"body"},[we.value?(i(),a("div",{key:0,class:"fixed inset-0 z-[70] flex items-center justify-center bg-black bg-opacity-90",onClick:ke(ts,["self"])},[s("div",Np,[s("button",{class:"absolute -top-10 right-0 text-white hover:text-gray-300 transition-colors",onClick:ts},Op),(i(),a("video",{ref_key:"videoPreviewRef",ref:me,key:we.value.url,controls:"",autoplay:"",class:"w-full max-h-[85vh] rounded-lg"},[we.value.isHls?k("",!0):(i(),a("source",{key:0,src:we.value.url,type:we.value.mimeType},null,8,Gp)),X(" Your browser does not support the video tag. ")]))])])):k("",!0)]))],64))}}),Dp={class:"bg-white rounded-lg shadow-xl w-[560px] max-h-[80vh] flex flex-col"},zp={class:"flex items-center justify-between px-4 py-3 border-b border-x-grey-1"},Bp={class:"font-semibold text-gray-900"},Hp=s("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),Wp=[Hp],Vp={class:"flex-1 overflow-y-auto p-4 space-y-4"},qp={key:0},Yp={key:0,class:"w-10 h-10 mx-auto text-x-grey-15 mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Kp=s("polygon",{points:"23 7 16 12 23 17 23 7"},null,-1),Xp=s("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"},null,-1),Jp=[Kp,Xp],Qp={key:1,class:"w-10 h-10 mx-auto text-x-grey-15 mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Zp=s("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},null,-1),ev=s("circle",{cx:"8.5",cy:"8.5",r:"1.5"},null,-1),tv=s("polyline",{points:"21 15 16 10 5 21"},null,-1),sv=[Zp,ev,tv],ov={class:"text-sm font-medium text-gray-600"},nv={class:"text-xs text-x-grey-15 mt-1"},iv={key:1},rv=["src"],av=["src"],lv=["onClick"],dv=s("svg",{class:"w-3 h-3 text-white",f
5ill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),cv=[dv],uv=s("svg",{class:"w-6 h-6 text-x-grey-15",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),hv=[uv],gv={key:2,class:"space-y-3"},fv=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Message (optional)",-1),pv=s("label",{class:"block text-xs font-medium text-gray-600 mb-1"},"Price (credits)",-1),vv=["value"],mv=s("p",{class:"text-[10px] text-x-grey-15 mt-0.5"},"Set to 0 for free content",-1),yv={class:"flex items-center justify-end gap-2 px-4 py-3 border-t border-x-grey-1"},_v=s("span",{class:"!py-1.5 !px-3 !text-xs"},"Send Content",-1),wv=["accept","multiple"],Qt=12,xv=je({__name:"ChatterUploadContentModal",props:{mediaType:{},girlId:{},conversationId:{}},emits:["close","send"],setup(t,{emit:e}){const o=Ee(),r=t,n=R(()=>r.girlId??o.selectedGirlId??0),l=R(()=>r.conversationId??o.selectedConversationId??0),u=e,v=I([]),g=I([]),f=I("0"),C=I(""),_=I(null),y=R(()=>{var W;return r.mediaType==="video"?!0:v.value.length===1&&((W=v.value[0])==null?void 0:W.type.startsWith("video/"))}),x=R(()=>{const W=Number(f.value);return v.value.length>0&&W>=0}),M=R(()=>r.mediaType==="video"?"video/mp4,video/quicktime,video/x-msvideo,video/webm,.mp4,.mov,.avi,.webm":"image/*");function T(){var W;(W=_.value)==null||W.click()}function w(W){const te=W.target;if(!te.files||te.files.length===0)return;const L=Array.from(te.files);if(r.mediaType==="video"){const F=L.find(D=>D.type.startsWith("video/"));F&&(v.value=[F],g.value=[URL.createObjectURL(F)])}else for(const F of L){if(!F.type.startsWith("image/"))continue;if(v.value.length>=Qt)break;v.value.push(F);const D=new FileReader;D.onload=K=>{var H;(H=K.target)!=null&&H.result&&g.value.push(K.target.result.toString())},D.readAsDataURL(F)}te&&(te.value="")}function A(W){v.value.splice(W,1);const te=g.value[W];te!=null&&te.startsWith("blob:")&&URL.revokeObjectURL(te),g.value.splice(W,1)}function E(){g.value.forEach(W=>{W!=null&&W.startsWith("blob:")&&URL.revokeObjectURL(W)})}ze(()=>{o.sendPreparingContentIndicator(n.value,l.value)}),Qe(()=>{E(),o.clearPreparingContentIndicator(n.value,l.value)});function V(W){const te=W.target,L=Math.max(0,Math.floor(Number(te.value)||0));f.value=String(L)}function de(){x.value&&u("send",{files:v.value,price:Number(f.value),content:C.value,type:y.value?"video":"image"})}return(W,te)=>(i(),a("div",{class:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:te[3]||(te[3]=ke(L=>u("close"),["self"]))},[s("div",Dp,[s("div",zp,[s("h3",Bp,b(W.mediaType==="video"?"Upload Video":"Upload Images"),1),s("button",{class:"text-x-grey-15 hover:text-gray-900 transition-colors",onClick:te[0]||(te[0]=L=>u("close"))},Wp)]),s("div",Vp,[v.value.length===0?(i(),a("div",qp,[s("button",{class:"w-full border-2 border-dashed border-x-grey-1 rounded-lg p-8 text-center hover:border-x-pink-1 hover:bg-x-grey-2 transition-colors",onClick:T},[W.mediaType==="video"?(i(),a("svg",Yp,Jp)):(i(),a("svg",Qp,sv)),s("p",ov,b(W.mediaType==="video"?"Click to select video":"Click to select images"),1),s("p",nv,b(W.mediaType==="video"?"MP4, MOV, AVI, WebM (1 video)":`JPG, PNG, GIF (up to ${Qt} images)`),1)])])):(i(),a("div",iv,[s("div",{class:J(["grid gap-2",y.value?"grid-cols-1":"grid-cols-3"])},[(i(!0),a(Y,null,he(g.value,(L,F)=>(i(),a("div",{key:F,class:"relative aspect-square rounded-lg overflow-hidden border border-x-grey-1"},[y.value?(i(),a("video",{key:0,src:L,class:"w-full h-full object-cover"},null,8,rv)):(i(),a("img",{key:1,src:L,class:"w-full h-full object-cover",alt:""},null,8,av)),s("button",{class:"absolute top-1 right-1 w-6 h-6 bg-black bg-opacity-60 rounded-full flex items-center justify-center hover:bg-opacity-80",onClick:D=>A(F)},cv,8,lv)]))),128)),!y.value&&v.value.length<Qt?(i(),a("button",{key:0,class:"aspect-square rounded-lg border-2 border-dashed border-x-grey-1 flex items-center justify-center hover:border-x-pink-1 transition-colors",onClick:T},hv)):k("",!0)],2)])),v.value.length>0?(i(),a("div",gv,[s("div",null,[fv,Ie(s("input",{"onUpdate:modelValue":te[1]||(te[1]=L=>C.value=L),class:"w-full h-9 text-xs px-3 rounded-2xl border border-x-grey-1 focus:outline-none focus:shadow-light-grey",placeholder:"Add a message..."},null,512),[[Oe,C.value]])]),s("div",null,[pv,s("input",{value:f.value,type:"number",min:"0",step:"1",class:"w-full h-9 text-xs px-3 rounded-2xl border border-x-grey-1 focus:outline-none focus:shadow-light-grey",placeholder:"0 = free",onInput:V},null,40,vv),mv])])):k("",!0)]),s("div",yv,[pe(Ve,{size:"xs",color:"secondary",onClick:te[2]||(te[2]=L=>u("close"))},{default:Ne(()=>[X(" Cancel ")]),_:1}),pe(Vt,{class:"!min-h-0",disabled:!x.value,onClick:de},{default:Ne(()=>[_v]),_:1},8,["disabled"])]),s("input",{ref_key:"fileInput",ref:_,type:"file",accept:M.value,multiple:W.mediaType!=="video",class:"hidden",onChange:w},null,40,wv)])]))}}),kv={class:"absolute bottom-full left-0 mb-2 bg-white rounded-lg shadow-xl border border-x-grey-1 w-80 z-50"},bv={class:"p-2 border-b border-x-grey-1"},Cv={class:"relative"},$v=s("svg",{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("circle",{cx:"11",cy:"11",r:"8"}),s("path",{d:"m21 21-4.3-4.3"})],-1),Tv={key:0,class:"flex border-b border-x-grey-1 px-1 py-1 gap-0.5 overflow-x-auto"},jv=["title","onClick"],Mv={class:"h-52 overflow-y-auto p-2"},Sv={key:0,class:"flex items-center justify-center h-full text-gray-400 text-sm"},Av={key:0,class:"mb-3"},Ev=s("div",{class:"text-[10px] text-gray-400 uppercase tracking-wide mb-1.5 px-0.5"},"Frequently Used",-1),Iv={class:"grid grid-cols-8 gap-1"},Rv=["title","onClick"],Uv={key:1,class:"text-[10px] text-gray-400 uppercase tracking-wide mb-1.5 px-0.5"},Pv={class:"grid grid-cols-8 gap-1"},Nv=["title","onClick"],Fv=s("div",{class:"px-2 py-1.5 border-t border-x-grey-1 text-center"},[s("span",{class:"text-[10px] text-gray-400"},"Tip: Type :shortcode: in chat to insert emoji")],-1),ps="chatter_emoji_usage",Ov=16,Gv=je({__name:"ChatterEmojiPicker",emits:["select","close"],setup(t,{emit:e}){const o=e,r=I({});ze(()=>{n()});function n(){try{const T=localStorage.getItem(ps);T&&(r.value=JSON.parse(T))}catch{r.value={}}}function l(){try{localStorage.setItem(ps,JSON.stringify(r.value))}catch{}}function u(T){r.value[T]=(r.value[T]||0)+1,l()}const v=[{name:"Smileys",icon:"😀",emojis:[{emoji:"😀",shortcodes:[":grinning:",":grin:"],keywords:["happy","smile","grin"]},{emoji:"😃",shortcodes:[":smiley:"],keywords:["happy","smile","joy"]},{emoji:"😄",shortcodes:[":smile:"],keywords:["happy","smile","joy"]},{emoji:"😁",shortcodes:[":beaming:"],keywords:["happy","grin","teeth"]},{emoji:"😆",shortcodes:[":laughing:",":satisfied:"],keywords:["happy","laugh","lol"]},{emoji:"😅",shortcodes:[":sweat_smile:"],keywords:["hot","sweat","laugh"]},{emoji:"🤣",shortcodes:[":rofl:"],keywords:["laugh","lol","funny"]},{emoji:"😂",shortcodes:[":joy:",":lol:"],keywords:["laugh","tears","funny"]},{emoji:"🙂",shortcodes:[":slight_smile:"],keywords:["smile","happy"]},{emoji:"😊",shortcodes:[":blush:"],keywords:["smile","happy","blush"]},{emoji:"😇",shortcodes:[":innocent:",":angel:"],keywords:["angel","innocent","halo"]},{emoji:"🥰",shortcodes:[":smiling_hearts:"],keywords:["love","hearts","adore"]},{emoji:"😍",shortcodes:[":heart_eyes:"],keywords:["love","heart","adore"]},{emoji:"🤩",shortcodes:[":star_struck:"],keywords:["star","eyes","wow"]},{emoji:"😘",shortcodes:[":kissing_heart:",":kiss:"],keywords:["kiss","love","heart"]},{emoji:"😗",shortcodes:[":kissing:"],keywords:["kiss","lips"]},{emoji:"😚",shortcodes:[":kissing_closed_eyes:"],keywords:["kiss","love"]},{emoji:"😙",shortcodes:[":kissing_smiling_eyes:"],keywords:["kiss","smile"]},{emoji:"🥲",shortcodes:[":smiling_tear:"],keywords:["smile","tear","sad"]},{emoji:"😋",shortcodes:[":yum:"],keywords:["tongue","yummy","delicious"]},{emoji:"😛",shortcodes:[":stuck_out_tongue:"],keywords:["tongue","playful"]},{emoji:"😜",shortcodes:[":stuck_out_tongue_winking:",":wink_tongue:"],keywords:["tongue","wink","playful"]},{emoji:"🤪",shortcodes:[":zany:",":crazy:"],keywords:["crazy","wild","goofy"]},{emoji:"😝",shortcodes:[":stuck_out_tongue_closed_eyes:"],keywords:["tongue","playful"]},{emoji:"🤑",shortcodes:[":money_mouth:"],keywords:["money","rich","dollar"]},{emoji:"🤗",shortcodes:[":hugs:",":hugging:"],keywords:["hug","love","warm"]},{emoji:"🤭",shortcodes:[":hand_over_mouth:"],keywords:["oops","giggle","shy"]},{emoji:"🤫",shortcodes:[":shushing:",":shh:"],keywords:["quiet","secret","shush"]},{emoji:"🤔",shortcodes:[":thinking:",":hmm:"],keywords:["think","wonder","hmm"]},{emoji:"🤐",shortcodes:[":zipper_mouth:"],keywords:["quiet","secret","zip"]},{emoji:"🤨",shortcodes:[":raised_eyebrow:"],keywords:["suspicious","skeptical"]},{emoji:"😐",shortcodes:[":neutral:"],keywords:["neutral","meh","blank"]},{emoji:"😑",shortcodes:[":expressionless:"],keywords:["blank","meh"]},{emoji:"😶",shortcodes:[":no_mouth:"],keywords:["silent","speechless"]},{emoji:"😏",shortcodes:[":smirk:"],keywords:["smirk","smug","flirt"]},{emoji:"😒",shortcodes:[":unamused:"],keywords:["meh","unhappy","bored"]},{emoji:"🙄",shortcodes:[":rolling_eyes:",":eyeroll:"],keywords:["eyes","annoyed"]},{emoji:"😬",shortcodes:[":grimacing:"],keywords:["awkward","nervous"]},{emoji:"😮‍💨",shortcodes:[":exhale:"],keywords:["sigh","relief","exhale"]},{emoji:"🤥",shortcodes:[":lying:"],keywords:["lie","pinocchio"]},{emoji:"😌",shortcodes:[":relieved:"],keywords:["relieved","calm","peaceful"]},{emoji:"😔",shortcodes:[":pensive:"],keywords:["sad","thoughtful"]},{emoji:"😪",shortcodes:[":sleepy:"],keywords:["tired","sleepy"]},{emoji:"🤤",shortcodes:[":drooling:"],keywords:["drool","hungry","yummy"]},{emoji:"😴",shortcodes:[":sleeping:",":zzz:"],keywords:["sleep","tired","zzz"]},{emoji:"😷",shortcodes:[":mask:"],keywords:["sick","mask","covid"]},{emoji:"🤒",shortcodes:[":thermometer:"],keywords:["sick","fever"]},{emoji:"🤕",shortcodes:[":bandage:"],keywords:["hurt","injured"]},{emoji:"🤢",shortcodes:[":nauseated:"],keywords:["sick","nauseous","green"]},{emoji:"🤮",shortcodes:[":vomiting:"],keywords:["sick","vomit","puke"]},{emoji:"🤧",shortcodes:[":sneezing:"],keywords:["sick","sneeze","cold"]},{emoji:"🥵",shortcodes:[":hot_face:",":hot:"],keywords:["hot","sweating"]},{emoji:"🥶",shortcodes:[":cold_face:",":cold:"],keywords:["cold","freezing"]},{emoji:"🥴",shortcodes:[":woozy:"],keywords:["dizzy","drunk","woozy"]},{emoji:"😵",shortcodes:[":dizzy_face:"],keywords:["dizzy","dead"]},{emoji:"😵‍💫",shortcodes:[":dizzy_spiral:"],keywords:["dizzy","spiral"]},{emoji:"🤯",shortcodes:[":exploding_head:",":mind_blown:"],keywords:["mind","blown","explode"]},{emoji:"🤠",shortcodes:[":cowboy:"],keywords:["cowboy","hat","western"]},{emoji:"🥳",shortcodes:[":partying:",":party:"],keywords:["party","celebrate","birthday"]},{emoji:"🥸",shortcodes:[":disguised:"],keywords:["disguise","glasses","nose"]},{emoji:"😎",shortcodes:[":sunglasses:",":cool:"],keywords:["cool","sunglasses","awesome"]},{emoji:"🤓",shortcodes:[":nerd:"],keywords:["nerd","glasses","geek"]},{emoji:"🧐",shortcodes:[":monocle:"],keywords:["monocle","inspect","curious"]},{emoji:"😕",shortcodes:[":confused:"],keywords:["confused","unsure"]},{emoji:"😟",shortcodes:[":worried:"],keywords:["worried","concern"]},{emoji:"🙁",shortcodes:[":slightly_frowning:"],keywords:["sad","frown"]},{emoji:"☹️",shortcodes:[":frowning:"],keywords:["sad","frown"]},{emoji:"😮",shortcodes:[":open_mouth:"],keywords:["surprise","wow"]},{emoji:"😯",shortcodes:[":hushed:"],keywords:["surprise","quiet"]},{emoji:"😲",shortcodes:[":astonished:"],keywords:["surprise","shock"]},{emoji:"😳",shortcodes:[":flushed:"],keywords:["embarrassed","blush","shy"]},{emoji:"🥺",shortcodes:[":pleading:",":puppy_eyes:"],keywords:["pleading","cute","puppy"]},{emoji:"😦",shortcodes:[":frowning_open_mouth:"],keywords:["sad","shock"]},{emoji:"😧",shortcodes:[":anguished:"],keywords:["pain","anguish"]},{emoji:"😨",shortcodes:[":fearful:"],keywords:["fear","scared"]},{emoji:"😰",shortcodes:[":anxious:"],keywords:["anxious","sweat","nervous"]},{emoji:"😥",shortcodes:[":sad_relieved:"],keywords:["sad","relieved"]},{emoji:"😢",shortcodes:[":cry:",":crying:"],keywords:["cry","sad","tear"]},{emoji:"😭",shortcodes:[":sob:",":crying_loudly:"],keywords:["cry","sob","tears"]},{emoji:"😱",shortcodes:[":scream:"],keywords:["scream","fear","scared"]},{emoji:"😖",shortcodes:[":confounded:"],keywords:["confused","frustrated"]},{emoji:"😣",shortcodes:[":persevere:"],keywords:["struggle","frustrated"]},{emoji:"😞",shortcodes:[":disappointed:"],keywords:["sad","disappointed"]},{emoji:"😓",shortcodes:[":downcast_sweat:"],keywords:["sad","sweat","hard"]},{emoji:"😩",shortcodes:[":weary:"],keywords:["tired","weary"]},{emoji:"😫",shortcodes:[":tired:"],keywords:["tired","exhausted"]},{emoji:"🥱",shortcodes:[":yawning:",":yawn:"],keywords:["yawn","tired","sleepy"]},{emoji:"😤",shortcodes:[":triumph:",":huffing:"],keywords:["angry","huff","proud"]},{emoji:"😡",shortcodes:[":rage:",":angry:"],keywords:["angry","mad","rage"]},{emoji:"😠",shortcodes:[":angry_face:"],keywords:["angry","mad"]},{emoji:"🤬",shortcodes:[":cursing:",":swearing:"],keywords:["angry","swear","curse"]},{emoji:"😈",shortcodes:[":smiling_imp:",":devil:"],keywords:["devil","evil","mischief"]},{emoji:"👿",shortcodes:[":imp:"],keywords:["devil","angry","evil"]},{emoji:"💀",shortcodes:[":skull:",":dead:"],keywords:["skull","dead","death"]},{emoji:"☠️",shortcodes:[":skull_crossbones:"],keywords:["skull","danger","death"]},{emoji:"💩",shortcodes:[":poop:",":shit:"],keywords:["poop","shit","crap"]},{emoji:"🤡",shortcodes:[":clown:"],keywords:["clown","circus","funny"]},{emoji:"👹",shortcodes:[":ogre:"],keywords:["monster","ogre","scary"]},{emoji:"👺",shortcodes:[":goblin:"],keywords:["monster","goblin","scary"]},{emoji:"👻",shortcodes:[":ghost:"],keywords:["ghost","halloween","spooky"]},{emoji:"👽",shortcodes:[":alien:"],keywords:["alien","ufo","space"]},{emoji:"👾",shortcodes:[":space_invader:"],keywords:["alien","game","invader"]},{emoji:"🤖",shortcodes:[":robot:"],keywords:["robot","bot","ai"]},{emoji:"😺",shortcodes:[":smiley_cat:"],keywords:["cat","happy","smile"]},{emoji:"😸",shortcodes:[":smile_cat:"],keywords:["cat","happy","grin"]},{emoji:"😹",shortcodes:[":joy_cat:"],keywords:["cat","laugh","tears"]},{emoji:"😻",shortcodes:[":heart_eyes_cat:"],keywords:["cat","love","heart"]},{emoji:"😼",shortcodes:[":smirk_cat:"],keywords:["cat","smirk","wry"]}
5,{emoji:"😽",shortcodes:[":kissing_cat:"],keywords:["cat","kiss"]},{emoji:"🙀",shortcodes:[":scream_cat:"],keywords:["cat","scream","shock"]},{emoji:"😿",shortcodes:[":crying_cat:"],keywords:["cat","cry","sad"]},{emoji:"😾",shortcodes:[":pouting_cat:"],keywords:["cat","angry","pout"]},{emoji:"🙈",shortcodes:[":see_no_evil:"],keywords:["monkey","hide","eyes"]},{emoji:"🙉",shortcodes:[":hear_no_evil:"],keywords:["monkey","hide","ears"]},{emoji:"🙊",shortcodes:[":speak_no_evil:"],keywords:["monkey","hide","mouth"]}]},{name:"Love",icon:"❤️",emojis:[{emoji:"❤️",shortcodes:[":heart:",":red_heart:"],keywords:["love","heart","red"]},{emoji:"🧡",shortcodes:[":orange_heart:"],keywords:["love","heart","orange"]},{emoji:"💛",shortcodes:[":yellow_heart:"],keywords:["love","heart","yellow"]},{emoji:"💚",shortcodes:[":green_heart:"],keywords:["love","heart","green"]},{emoji:"💙",shortcodes:[":blue_heart:"],keywords:["love","heart","blue"]},{emoji:"💜",shortcodes:[":purple_heart:"],keywords:["love","heart","purple"]},{emoji:"🖤",shortcodes:[":black_heart:"],keywords:["love","heart","black"]},{emoji:"🤍",shortcodes:[":white_heart:"],keywords:["love","heart","white"]},{emoji:"🤎",shortcodes:[":brown_heart:"],keywords:["love","heart","brown"]},{emoji:"💔",shortcodes:[":broken_heart:"],keywords:["sad","heart","broken"]},{emoji:"❣️",shortcodes:[":heart_exclamation:"],keywords:["love","heart","exclamation"]},{emoji:"💕",shortcodes:[":two_hearts:"],keywords:["love","hearts"]},{emoji:"💞",shortcodes:[":revolving_hearts:"],keywords:["love","hearts","revolving"]},{emoji:"💓",shortcodes:[":heartbeat:"],keywords:["love","heart","beat"]},{emoji:"💗",shortcodes:[":heartpulse:",":growing_heart:"],keywords:["love","heart","growing"]},{emoji:"💖",shortcodes:[":sparkling_heart:"],keywords:["love","heart","sparkle"]},{emoji:"💘",shortcodes:[":cupid:"],keywords:["love","heart","arrow","cupid"]},{emoji:"💝",shortcodes:[":gift_heart:"],keywords:["love","heart","gift","ribbon"]},{emoji:"💟",shortcodes:[":heart_decoration:"],keywords:["love","heart","decoration"]},{emoji:"🫶",shortcodes:[":heart_hands:"],keywords:["love","hands","heart"]},{emoji:"💋",shortcodes:[":lips:",":kiss_mark:"],keywords:["kiss","lips","love"]},{emoji:"💌",shortcodes:[":love_letter:"],keywords:["love","letter","heart"]},{emoji:"💍",shortcodes:[":ring:"],keywords:["wedding","ring","engagement"]},{emoji:"💎",shortcodes:[":gem:",":diamond:"],keywords:["diamond","gem","jewel"]},{emoji:"🥹",shortcodes:[":holding_back_tears:"],keywords:["emotional","tears","touched"]},{emoji:"🫠",shortcodes:[":melting:"],keywords:["melt","love","hot"]},{emoji:"😻",shortcodes:[":heart_eyes_cat:"],keywords:["cat","love","adore"]},{emoji:"💑",shortcodes:[":couple_with_heart:"],keywords:["couple","love","romance"]},{emoji:"💏",shortcodes:[":couplekiss:"],keywords:["couple","kiss","love"]},{emoji:"👩‍❤️‍👨",shortcodes:[":couple_heart:"],keywords:["couple","love"]}]},{name:"Gestures",icon:"👋",emojis:[{emoji:"👋",shortcodes:[":wave:",":hi:",":hello:"],keywords:["wave","hello","hi","bye"]},{emoji:"🤚",shortcodes:[":raised_back_of_hand:"],keywords:["hand","raised","back"]},{emoji:"🖐️",shortcodes:[":raised_hand_with_fingers:"],keywords:["hand","five","fingers"]},{emoji:"✋",shortcodes:[":raised_hand:",":high_five:"],keywords:["hand","stop","high five"]},{emoji:"🖖",shortcodes:[":vulcan:",":spock:"],keywords:["vulcan","spock","star trek"]},{emoji:"👌",shortcodes:[":ok:",":ok_hand:"],keywords:["ok","perfect","good"]},{emoji:"🤌",shortcodes:[":pinched_fingers:",":italian:"],keywords:["italian","chef","pinched"]},{emoji:"🤏",shortcodes:[":pinching:"],keywords:["small","tiny","pinch"]},{emoji:"✌️",shortcodes:[":v:",":peace:"],keywords:["peace","victory","two"]},{emoji:"🤞",shortcodes:[":crossed_fingers:",":fingers_crossed:"],keywords:["luck","hope","crossed"]},{emoji:"🫰",shortcodes:[":hand_with_index_finger_and_thumb_crossed:"],keywords:["money","snap"]},{emoji:"🤟",shortcodes:[":love_you_gesture:",":ily:"],keywords:["love","you","sign"]},{emoji:"🤘",shortcodes:[":metal:",":rock:"],keywords:["rock","metal","horns"]},{emoji:"🤙",shortcodes:[":call_me:",":shaka:"],keywords:["call","phone","shaka"]},{emoji:"👈",shortcodes:[":point_left:"],keywords:["point","left","direction"]},{emoji:"👉",shortcodes:[":point_right:"],keywords:["point","right","direction"]},{emoji:"👆",shortcodes:[":point_up:"],keywords:["point","up","direction"]},{emoji:"🖕",shortcodes:[":middle_finger:",":fu:"],keywords:["finger","rude","angry"]},{emoji:"👇",shortcodes:[":point_down:"],keywords:["point","down","direction"]},{emoji:"☝️",shortcodes:[":point_up_2:"],keywords:["point","up","one"]},{emoji:"👍",shortcodes:[":thumbsup:",":+1:",":thumbs_up:"],keywords:["good","yes","like","approve"]},{emoji:"👎",shortcodes:[":thumbsdown:",":-1:",":thumbs_down:"],keywords:["bad","no","dislike"]},{emoji:"✊",shortcodes:[":fist:"],keywords:["fist","power","punch"]},{emoji:"👊",shortcodes:[":punch:",":fist_bump:"],keywords:["punch","fist","bump"]},{emoji:"🤛",shortcodes:[":fist_left:"],keywords:["fist","bump","left"]},{emoji:"🤜",shortcodes:[":fist_right:"],keywords:["fist","bump","right"]},{emoji:"👏",shortcodes:[":clap:"],keywords:["clap","applause","bravo"]},{emoji:"🙌",shortcodes:[":raised_hands:",":hooray:"],keywords:["celebrate","hands","hooray"]},{emoji:"🫶",shortcodes:[":heart_hands:"],keywords:["love","heart","hands"]},{emoji:"👐",shortcodes:[":open_hands:"],keywords:["hands","open","jazz"]},{emoji:"🤲",shortcodes:[":palms_up:"],keywords:["palms","receive","pray"]},{emoji:"🤝",shortcodes:[":handshake:"],keywords:["handshake","deal","agree"]},{emoji:"🙏",shortcodes:[":pray:",":please:",":thank_you:"],keywords:["pray","please","thanks","namaste"]},{emoji:"✍️",shortcodes:[":writing:"],keywords:["write","hand","pen"]},{emoji:"💅",shortcodes:[":nail_polish:",":nails:"],keywords:["nails","beauty","polish"]},{emoji:"🤳",shortcodes:[":selfie:"],keywords:["selfie","phone","camera"]},{emoji:"💪",shortcodes:[":muscle:",":flex:"],keywords:["muscle","strong","flex","bicep"]},{emoji:"🦾",shortcodes:[":mechanical_arm:"],keywords:["robot","arm","prosthetic"]},{emoji:"🦿",shortcodes:[":mechanical_leg:"],keywords:["robot","leg","prosthetic"]},{emoji:"🦵",shortcodes:[":leg:"],keywords:["leg","kick"]},{emoji:"🦶",shortcodes:[":foot:"],keywords:["foot","kick"]},{emoji:"👂",shortcodes:[":ear:"],keywords:["ear","listen","hear"]},{emoji:"👃",shortcodes:[":nose:"],keywords:["nose","smell"]},{emoji:"🧠",shortcodes:[":brain:"],keywords:["brain","think","smart"]},{emoji:"👀",shortcodes:[":eyes:"],keywords:["eyes","look","see","watch"]},{emoji:"👁️",shortcodes:[":eye:"],keywords:["eye","see","look"]},{emoji:"👅",shortcodes:[":tongue:"],keywords:["tongue","taste","lick"]},{emoji:"👄",shortcodes:[":mouth:",":lips:"],keywords:["mouth","lips","kiss"]}]},{name:"Fun",icon:"🎉",emojis:[{emoji:"🎉",shortcodes:[":tada:",":party:"],keywords:["party","celebrate","tada"]},{emoji:"🎊",shortcodes:[":confetti:"],keywords:["confetti","party","celebrate"]},{emoji:"🎁",shortcodes:[":gift:"],keywords:["gift","present","birthday"]},{emoji:"🎈",shortcodes:[":balloon:"],keywords:["balloon","party","birthday"]},{emoji:"🎀",shortcodes:[":ribbon:"],keywords:["ribbon","bow","gift"]},{emoji:"🎄",shortcodes:[":christmas_tree:"],keywords:["christmas","tree","holiday"]},{emoji:"🎃",shortcodes:[":jack_o_lantern:",":pumpkin:"],keywords:["halloween","pumpkin"]},{emoji:"🔥",shortcodes:[":fire:",":hot:",":lit:"],keywords:["fire","hot","lit","flame"]}
5,{emoji:"✨",shortcodes:[":sparkles:",":stars:"],keywords:["sparkle","stars","magic","shine"]},{emoji:"💫",shortcodes:[":dizzy:"],keywords:["star","dizzy","shooting"]},{emoji:"⭐",shortcodes:[":star:"],keywords:["star","favorite"]},{emoji:"🌟",shortcodes:[":star2:",":glowing_star:"],keywords:["star","glow","shine"]},{emoji:"💥",shortcodes:[":boom:",":explosion:"],keywords:["boom","explosion","collision"]},{emoji:"💢",shortcodes:[":anger:"],keywords:["angry","symbol"]},{emoji:"💦",shortcodes:[":sweat_drops:"],keywords:["sweat","water","drops"]},{emoji:"💨",shortcodes:[":dash:"],keywords:["wind","fast","running"]},{emoji:"💣",shortcodes:[":bomb:"],keywords:["bomb","explosive"]},{emoji:"💬",shortcodes:[":speech_balloon:"],keywords:["speech","talk","message"]},{emoji:"💭",shortcodes:[":thought_balloon:"],keywords:["thought","think","bubble"]},{emoji:"💤",shortcodes:[":zzz:",":sleep:"],keywords:["sleep","zzz","tired"]},{emoji:"🎵",shortcodes:[":musical_note:"],keywords:["music","note","song"]},{emoji:"🎶",shortcodes:[":notes:"],keywords:["music","notes","song"]},{emoji:"🎤",shortcodes:[":microphone:",":mic:"],keywords:["microphone","sing","karaoke"]},{emoji:"🎧",shortcodes:[":headphones:"],keywords:["headphones","music","listen"]},{emoji:"🎬",shortcodes:[":clapper:"],keywords:["movie","film","action"]},{emoji:"🎮",shortcodes:[":video_game:",":gaming:"],keywords:["game","video","controller"]},{emoji:"🎯",shortcodes:[":dart:",":target:"],keywords:["target","dart","bullseye"]},{emoji:"🎲",shortcodes:[":dice:",":game_die:"],keywords:["dice","game","chance"]},{emoji:"🎰",shortcodes:[":slot_machine:"],keywords:["slot","casino","luck"]},{emoji:"🎪",shortcodes:[":circus:"],keywords:["circus","tent","carnival"]},{emoji:"🎭",shortcodes:[":performing_arts:"],keywords:["theater","drama","masks"]},{emoji:"🎨",shortcodes:[":art:",":palette:"],keywords:["art","paint","palette"]},{emoji:"🧩",shortcodes:[":puzzle:"],keywords:["puzzle","piece","game"]},{emoji:"🎱",shortcodes:[":8ball:"],keywords:["pool","billiards","eight"]},{emoji:"🏆",shortcodes:[":trophy:"],keywords:["trophy","winner","award"]},{emoji:"🥇",shortcodes:[":first_place:",":gold:"],keywords:["medal","gold","first","winner"]},{emoji:"🥈",shortcodes:[":second_place:",":silver:"],keywords:["medal","silver","second"]},{emoji:"🥉",shortcodes:[":third_place:",":bronze:"],keywords:["medal","bronze","third"]},{emoji:"🎗️",shortcodes:[":reminder_ribbon:"],keywords:["ribbon","awareness"]},{emoji:"🏅",shortcodes:[":medal:"],keywords:["medal","award","sports"]}]},{name:"Food",icon:"🍕",emojis:[{emoji:"🍕",shortcodes:[":pizza:"],keywords:["pizza","food","italian"]},{emoji:"🍔",shortcodes:[":hamburger:",":burger:"],keywords:["burger","hamburger","food"]},{emoji:"🍟",shortcodes:[":fries:"],keywords:["fries","french","food"]},{emoji:"🌭",shortcodes:[":hotdog:",":hot_dog:"],keywords:["hotdog","food"]},{emoji:"🍿",shortcodes:[":popcorn:"],keywords:["popcorn","movie","snack"]},{emoji:"🥓",shortcodes:[":bacon:"],keywords:["bacon","meat","breakfast"]},{emoji:"🥚",shortcodes:[":egg:"],keywords:["egg","breakfast"]},{emoji:"🍳",shortcodes:[":cooking:",":fried_egg:"],keywords:["cooking","egg","breakfast"]},{emoji:"🥞",shortcodes:[":pancakes:"],keywords:["pancakes","breakfast"]},{emoji:"🧇",shortcodes:[":waffle:"],keywords:["waffle","breakfast"]},{emoji:"🍞",shortcodes:[":bread:"],keywords:["bread","toast","loaf"]},{emoji:"🥐",shortcodes:[":croissant:"],keywords:["croissant","french","pastry"]},{emoji:"🥖",shortcodes:[":baguette:"],keywords:["baguette","french","bread"]},{emoji:"🧀",shortcodes:[":cheese:"],keywords:["cheese","dairy"]},{emoji:"🥗",shortcodes:[":salad:"],keywords:["salad","healthy","green"]},{emoji:"🍝",shortcodes:[":spaghetti:",":pasta:"],keywords:["pasta","spaghetti","italian"]},{emoji:"🍜",shortcodes:[":ramen:",":noodles:"],keywords:["ramen","noodles","soup"]},{emoji:"🍲",shortcodes:[":stew:"],keywords:["stew","soup","pot"]},{emoji:"🍛",shortcodes:[":curry:"],keywords:["curry","indian","rice"]},{emoji:"🍣",shortcodes:[":sushi:"],keywords:["sushi","japanese","fish"]},{emoji:"🍱",shortcodes:[":bento:"],keywords:["bento","japanese","lunch"]},{emoji:"🥟",shortcodes:[":dumpling:"],keywords:["dumpling","chinese","asian"]},{emoji:"🍤",shortcodes:[":shrimp:"],keywords:["shrimp","seafood"]},{emoji:"🍩",shortcodes:[":doughnut:",":donut:"],keywords:["donut","doughnut","sweet"]}
5,{emoji:"🍪",shortcodes:[":cookie:"],keywords:["cookie","sweet","biscuit"]},{emoji:"🎂",shortcodes:[":birthday:",":cake:"],keywords:["birthday","cake","celebrate"]},{emoji:"🍰",shortcodes:[":cake_slice:"],keywords:["cake","dessert","sweet"]},{emoji:"🧁",shortcodes:[":cupcake:"],keywords:["cupcake","dessert","sweet"]},{emoji:"🍫",shortcodes:[":chocolate:"],keywords:["chocolate","sweet","candy"]},{emoji:"🍬",shortcodes:[":candy:"],keywords:["candy","sweet"]},{emoji:"🍭",shortcodes:[":lollipop:"],keywords:["lollipop","candy","sweet"]},{emoji:"🍦",shortcodes:[":icecream:"],keywords:["ice cream","dessert","sweet"]},{emoji:"🍨",shortcodes:[":ice_cream:"],keywords:["ice cream","sundae","dessert"]},{emoji:"☕",shortcodes:[":coffee:"],keywords:["coffee","drink","cafe"]},{emoji:"🍵",shortcodes:[":tea:"],keywords:["tea","drink","cup"]},{emoji:"🧃",shortcodes:[":juice_box:"],keywords:["juice","drink","box"]},{emoji:"🥤",shortcodes:[":cup_with_straw:"],keywords:["drink","soda","cup"]},{emoji:"🍺",shortcodes:[":beer:"],keywords:["beer","drink","alcohol"]},{emoji:"🍻",shortcodes:[":beers:",":cheers:"],keywords:["beer","cheers","toast"]},{emoji:"🥂",shortcodes:[":champagne_glasses:",":toast:"],keywords:["champagne","cheers","celebrate"]},{emoji:"🍷",shortcodes:[":wine:"],keywords:["wine","drink","alcohol"]},{emoji:"🍸",shortcodes:[":cocktail:"],keywords:["cocktail","drink","martini"]},{emoji:"🍹",shortcodes:[":tropical_drink:"],keywords:["tropical","drink","cocktail"]}]},{name:"Nature",icon:"🌸",emojis:[{emoji:"🌸",shortcodes:[":cherry_blossom:"],keywords:["flower","cherry","blossom","spring"]},{emoji:"🌺",shortcodes:[":hibiscus:"],keywords:["flower","hibiscus","tropical"]},{emoji:"🌻",shortcodes:[":sunflower:"],keywords:["flower","sunflower","sun"]},{emoji:"🌷",shortcodes:[":tulip:"],keywords:["flower","tulip","spring"]},{emoji:"🌹",shortcodes:[":rose:"],keywords:["flower","rose","love","romantic"]},{emoji:"🥀",shortcodes:[":wilted_flower:"],keywords:["flower","wilted","dead","sad"]},{emoji:"🌼",shortcodes:[":blossom:"],keywords:["flower","blossom","nature"]},{emoji:"💐",shortcodes:[":bouquet:"],keywords:["flowers","bouquet","gift"]},{emoji:"🌿",shortcodes:[":herb:"],keywords:["herb","plant","green"]},{emoji:"🍀",shortcodes:[":four_leaf_clover:",":lucky:"],keywords:["clover","luck","lucky","irish"]},{emoji:"🍃",shortcodes:[":leaves:"],keywords:["leaves","wind","nature"]},{emoji:"🌳",shortcodes:[":deciduous_tree:"],keywords:["tree","nature","green"]},{emoji:"🌴",shortcodes:[":palm_tree:"],keywords:["palm","tree","tropical","beach"]},{emoji:"🌵",shortcodes:[":cactus:"],keywords:["cactus","desert","plant"]},{emoji:"🌾",shortcodes:[":rice:"],keywords:["rice","plant","harvest"]},{emoji:"🌱",shortcodes:[":seedling:"],keywords:["plant","seedling","grow"]},{emoji:"🌈",shortcodes:[":rainbow:"],keywords:["rainbow","colors","weather"]},{emoji:"☀️",shortcodes:[":sunny:",":sun:"],keywords:["sun","sunny","weather","hot"]},{emoji:"🌤️",shortcodes:[":sun_behind_cloud:"],keywords:["sun","cloud","weather"]},{emoji:"⛅",shortcodes:[":partly_sunny:"],keywords:["sun","cloud","weather"]},{emoji:"☁️",shortcodes:[":cloud:"],keywords:["cloud","weather"]},{emoji:"🌧️",shortcodes:[":rain:",":rainy:"],keywords:["rain","cloud","weather"]},{emoji:"⛈️",shortcodes:[":thunder_cloud:"],keywords:["thunder","storm","rain"]},{emoji:"🌩️",shortcodes:[":lightning:"],keywords:["lightning","cloud","storm"]},{emoji:"❄️",shortcodes:[":snowflake:"],keywords:["snow","winter","cold"]},{emoji:"⛄",shortcodes:[":snowman:"],keywords:["snowman","winter","cold"]},{emoji:"🌊",shortcodes:[":ocean:",":wave:"],keywords:["wave","ocean","sea","water"]},{emoji:"💧",shortcodes:[":droplet:"],keywords:["water","drop","rain"]},{emoji:"🌙",shortcodes:[":crescent_moon:"],keywords:["moon","night","crescent"]},{emoji:"🌕",shortcodes:[":full_moon:"],keywords:["moon","full","night"]},{emoji:"🌑",shortcodes:[":new_moon:"],keywords:["moon","new","dark"]},{emoji:"🌛",shortcodes:[":first_quarter_moon_face:"],keywords:["moon","face"]},{emoji:"🌜",shortcodes:[":last_quarter_moon_face:"],keywords:["moon","face"]},{emoji:"🌝",shortcodes:[":full_moon_face:"],keywords:["moon","face","full"]},{emoji:"🌚",shortcodes:[":new_moon_face:"],keywords:["moon","face","new"]},{emoji:"⚡",shortcodes:[":zap:",":lightning_bolt:"],keywords:["lightning","bolt","electric","power"]},{emoji:"🌍",shortcodes:[":earth_africa:"],keywords:["earth","world","globe"]},{emoji:"🌎",shortcodes:[":earth_americas:"],keywords:["earth","world","globe"]},{emoji:"🌏",shortcodes:[":earth_asia:"],keywords:["earth","world","globe"]}]},{name:"Animals",icon:"🐱",emojis:[{emoji:"🐱",shortcodes:[":cat:"],keywords:["cat","pet","kitten"]},{emoji:"🐶",shortcodes:[":dog:"],keywords:["dog","pet","puppy"]},{emoji:"🐭",shortcodes:[":mouse:"],keywords:["mouse","rodent"]},{emoji:"🐹",shortcodes:[":hamster:"],keywords:["hamster","pet","rodent"]},{emoji:"🐰",shortcodes:[":rabbit:",":bunny:"],keywords:["rabbit","bunny","pet"]},{emoji:"🦊",shortcodes:[":fox:"],keywords:["fox","animal"]},{emoji:"🐻",shortcodes:[":bear:"],keywords:["bear","animal"]},{emoji:"🐼",shortcodes:[":panda:"],keywords:["panda","bear","animal"]},{emoji:"🐨",shortcodes:[":koala:"],keywords:["koala","animal"]},{emoji:"🐯",shortcodes:[":tiger:"],keywords:["tiger","animal","cat"]},{emoji:"🦁",shortcodes:[":lion:"],keywords:["lion","animal","cat","king"]},{emoji:"🐮",shortcodes:[":cow:"],keywords:["cow","animal","farm"]},{emoji:"🐷",shortcodes:[":pig:"],keywords:["pig","animal","farm"]},{emoji:"🐸",shortcodes:[":frog:"],keywords:["frog","animal"]},{emoji:"🐵",shortcodes:[":monkey:"],keywords:["monkey","animal","ape"]}
5,{emoji:"🐔",shortcodes:[":chicken:"],keywords:["chicken","bird","farm"]},{emoji:"🐧",shortcodes:[":penguin:"],keywords:["penguin","bird","animal"]},{emoji:"🐦",shortcodes:[":bird:"],keywords:["bird","animal"]},{emoji:"🐤",shortcodes:[":baby_chick:"],keywords:["chick","bird","baby"]},{emoji:"🦆",shortcodes:[":duck:"],keywords:["duck","bird","animal"]},{emoji:"🦅",shortcodes:[":eagle:"],keywords:["eagle","bird","animal"]},{emoji:"🦉",shortcodes:[":owl:"],keywords:["owl","bird","wise"]},{emoji:"🦇",shortcodes:[":bat:"],keywords:["bat","animal","vampire"]},{emoji:"🐺",shortcodes:[":wolf:"],keywords:["wolf","animal"]},{emoji:"🐗",shortcodes:[":boar:"],keywords:["boar","pig","animal"]},{emoji:"🐴",shortcodes:[":horse:"],keywords:["horse","animal"]},{emoji:"🦄",shortcodes:[":unicorn:"],keywords:["unicorn","horse","magic","fantasy"]},{emoji:"🐝",shortcodes:[":bee:",":honeybee:"],keywords:["bee","insect","honey"]},{emoji:"🦋",shortcodes:[":butterfly:"],keywords:["butterfly","insect","beautiful"]},{emoji:"🐌",shortcodes:[":snail:"],keywords:["snail","slow"]},{emoji:"🐛",shortcodes:[":bug:"],keywords:["bug","insect"]},{emoji:"🐢",shortcodes:[":turtle:"],keywords:["turtle","slow","animal"]},{emoji:"🐍",shortcodes:[":snake:"],keywords:["snake","reptile"]},{emoji:"🦎",shortcodes:[":lizard:"],keywords:["lizard","reptile"]},{emoji:"🐙",shortcodes:[":octopus:"],keywords:["octopus","sea","animal"]},{emoji:"🦑",shortcodes:[":squid:"],keywords:["squid","sea","animal"]},{emoji:"🦐",shortcodes:[":shrimp:"],keywords:["shrimp","sea","food"]},{emoji:"🦞",shortcodes:[":lobster:"],keywords:["lobster","sea","food"]},{emoji:"🦀",shortcodes:[":crab:"],keywords:["crab","sea","animal"]},{emoji:"🐡",shortcodes:[":blowfish:"],keywords:["fish","blowfish","sea"]},{emoji:"🐠",shortcodes:[":tropical_fish:"],keywords:["fish","tropical","sea"]},{emoji:"🐟",shortcodes:[":fish:"],keywords:["fish","sea","animal"]},{emoji:"🐬",shortcodes:[":dolphin:"],keywords:["dolphin","sea","animal"]},{emoji:"🐳",shortcodes:[":whale:"],keywords:["whale","sea","animal"]},{emoji:"🦈",shortcodes:[":shark:"],keywords:["shark","sea","animal","danger"]},{emoji:"🐊",shortcodes:[":crocodile:"],keywords:["crocodile","reptile","alligator"]}]},{name:"Objects",icon:"💡",emojis:[{emoji:"💡",shortcodes:[":bulb:",":idea:"],keywords:["light","bulb","idea"]},{emoji:"🔦",shortcodes:[":flashlight:"],keywords:["flashlight","light"]},{emoji:"🕯️",shortcodes:[":candle:"],keywords:["candle","light"]},{emoji:"💰",shortcodes:[":moneybag:",":money:"],keywords:["money","bag","rich"]},{emoji:"💵",shortcodes:[":dollar:"],keywords:["money","dollar","cash"]},{emoji:"💳",shortcodes:[":credit_card:"],keywords:["credit","card","money"]},{emoji:"📱",shortcodes:[":iphone:",":phone:"],keywords:["phone","mobile","iphone"]},{emoji:"💻",shortcodes:[":computer:",":laptop:"],keywords:["computer","laptop"]},{emoji:"🖥️",shortcodes:[":desktop:"],keywords:["computer","desktop"]},{emoji:"⌨️",shortcodes:[":keyboard:"],keywords:["keyboard","type","computer"]},{emoji:"🖱️",shortcodes:[":mouse_computer:"],keywords:["mouse","computer","click"]},{emoji:"📷",shortcodes:[":camera:"],keywords:["camera","photo"]},{emoji:"📹",shortcodes:[":video_camera:"],keywords:["video","camera","record"]},{emoji:"📺",shortcodes:[":tv:"],keywords:["tv","television","watch"]},{emoji:"📻",shortcodes:[":radio:"],keywords:["radio","music"]},{emoji:"⏰",shortcodes:[":alarm_clock:"],keywords:["alarm","clock","time"]},{emoji:"⌚",shortcodes:[":watch:"],keywords:["watch","time"]},{emoji:"🔑",shortcodes:[":key:"],keywords:["key","lock"]},{emoji:"🗝️",shortcodes:[":old_key:"],keywords:["key","old","antique"]},{emoji:"🔐",shortcodes:[":closed_lock_with_key:"],keywords:["lock","key","secure"]},{emoji:"🔒",shortcodes:[":lock:"],keywords:["lock","secure"]},{emoji:"🔓",shortcodes:[":unlock:"],keywords:["unlock","open"]},{emoji:"📧",shortcodes:[":email:",":e-mail:"],keywords:["email","mail","message"]},{emoji:"📩",shortcodes:[":envelope_with_arrow:"],keywords:["email","send"]},{emoji:"📝",shortcodes:[":memo:",":note:"],keywords:["memo","note","write"]},{emoji:"✏️",shortcodes:[":pencil:"],keywords:["pencil","write"]},{emoji:"📌",shortcodes:[":pushpin:"],keywords:["pin","pushpin"]},{emoji:"📎",shortcodes:[":paperclip:"],keywords:["paperclip","attachment"]},{emoji:"📚",shortcodes:[":books:"],keywords:["books","read","study"]},{emoji:"📖",shortcodes:[":book:"],keywords:["book","read"]},{emoji:"🔗",shortcodes:[":link:"],keywords:["link","chain","url"]},{emoji:"✂️",shortcodes:[":scissors:"],keywords:["scissors","cut"]},{emoji:"🗑️",shortcodes:[":wastebasket:",":trash:"],keywords:["trash","delete","bin"]},{emoji:"🛒",shortcodes:[":shopping_cart:"],keywords:["shopping","cart","buy"]},{emoji:"🎁",shortcodes:[":gift:"],keywords:["gift","present"]},{emoji:"🔔",shortcodes:[":bell:"],keywords:["bell","notification"]},{emoji:"🔕",shortcodes:[":no_bell:"],keywords:["bell","mute","silent"]},{emoji:"📢",shortcodes:[":loudspeaker:"],keywords:["loudspeaker","announce"]},{emoji:"📣",shortcodes:[":megaphone:"],keywords:["megaphone","announce"]},{emoji:"🔊",shortcodes:[":loud_sound:"],keywords:["sound","loud","volume"]},{emoji:"🔇",shortcodes:[":mute:"],keywords:["mute","silent","volume"]},{emoji:"⚙️",shortcodes:[":gear:",":settings:"],keywords:["gear","settings","cog"]},{emoji:"🔧",shortcodes:[":wrench:"],keywords:["wrench","tool","fix"]},{emoji:"🔨",shortcodes:[":hammer:"],keywords:["hammer","tool"]},{emoji:"⚡",shortcodes:[":zap:"],keywords:["lightning","electric","power"]}]}],g=I(""),f=I(0),C=R(()=>{const T=[];for(const w of v)T.push(...w.emojis);return T}),_=R(()=>{const T=Object.entries(r.value);return T.length===0?[]:T.sort((A,E)=>E[1]-A[1]).slice(0,Ov).map(([A])=>A).map(A=>C.value.find(E=>E.emoji===A)).filter(A=>A!==void 0)}),y=R(()=>{const T=g.value.toLowerCase().trim();return T?C.value.filter(w=>{const A=w.shortcodes.some(de=>de.replace(/:/g,"").includes(T)),E=w.keywords.some(de=>de.includes(T)),V=w.emoji===T;return A||E||V}).slice(0,50):null}),x=R(()=>y.value!==null?y.value:v[f.value].emojis);function M(T){u(T.emoji),o("select",T.emoji)}return(T,w)=>(i(),a("div",kv,[s("div",bv,[s("div",Cv,[Ie(s("input",{"onUpdate:modelValue":w[0]||(w[0]=A=>g.value=A),type:"text",placeholder:"Search emojis... (e.g. :smile: or happy)",class:"w-full h-8 text-xs text-black pl-8 pr-3 rounded-lg border border-x-grey-1 focus:outline-none focus:border-x-pink-1 transition-colors"},null,512),[[Oe,g.value]]),$v])]),g.value?k("",!0):(i(),a("div",Tv,[(i(),a(Y,null,he(v,(A,E)=>s("button",{key:A.name,class:J(["flex-shrink-0 w-8 h-8 flex items-center justify-center rounded hover:bg-x-grey-2 transition-colors text-lg",{"bg-x-grey-2":f.value===E}]),title:A.name,onClick:V=>f.value=E},b(A.icon),11,jv)),64))])),s("div",Mv,[g.value&&x.value.length===0?(i(),a("div",Sv," No emojis found ")):(i(),a(Y,{key:1},[!g.value&&_.value.length>0?(i(),a("div",Av,[Ev,s("div",Iv,[(i(!0),a(Y,null,he(_.value,A=>(i(),a("button",{key:"freq-"+A.emoji,class:"w-8 h-8 flex items-center justify-center rounded hover:bg-x-grey-2 transition-colors text-lg",title:A.shortcodes[0],onClick:E=>M(A)},b(A.emoji),9,Rv))),128))])])):k("",!0),!g.value&&_.value.length>0?(i(),a("div",Uv,b(v[f.value].name),1)):k("",!0),s("div",Pv,[(i(!0),a(Y,null,he(x.value,A=>(i(),a("button",{key:A.emoji+A.shortcodes[0],class:"w-8 h-8 flex items-center justify-center rounded hover:bg-x-grey-2 transition-colors text-lg",title:A.shortcodes[0],onClick:E=>M(A)},b(A.emoji),9,Nv))),128))])],64))]),Fv,s("div",{class:"fixed inset-0 -z-10",onClick:w[1]||(w[1]=A=>o("close"))})]))}}),Lv={class:"bg-white rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col"},Dv={class:"flex items-center justify-between px-4 py-3 border-b border-x-grey-1"},zv=s("h3",{class:"font-semibold text-gray-900"},"Choose a GIF",-1),Bv=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1),Hv=[Bv],Wv={class:"px-4 py-3 border-b border-x-grey-1"},Vv={class:"relative"},qv=s("svg",{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("circle",{cx:"11",cy:"11",r:"8"}),s("path",{d:"m21 21-4.3-4.3"})],-1),Yv={class:"flex-1 overflow-y-auto p-4"},Kv={key:0,class:"flex items-center justify-center h-40"},Xv=s("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-x-pink-1"},null,-1),Jv=[Xv],Qv={key:1,class:"flex flex-col items-center justify-center h-40 text-center px-4"},Zv={class:"text-red-500 text-sm mb-2"},em={key:0,class:"text-xs text-gray-400"},tm=s("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener",class:"text-x-pink-1 underline"},"developers.giphy.com",-1),sm={key:2,class:"flex items-center justify-center h-40 text-gray-400 text-sm"},om={key:3,class:"grid grid-cols-3 gap-2"},nm=["onClick"],im=["src","alt"],rm=s("div",{class:"px-4 py-2 border-t border-x-grey-1 text-center"},[s("span",{class:"text-xs text-gray-400"},"Powered by GIPHY")],-1),am=je({__name:"ChatterGifPicker",emits:["select","close"],setup(t,{emit:e}){const o=e,r=ms(),n=I(""),l=I([]),u=I(!1),v=I(""),g=r.public.giphyApiKey||"lpnNfsjUCynSopgBo437iIPX9NwnrA8p",f=!!g;async function C(T){var w;if(!f){v.value="GIPHY API key not configured. Add VITE_GIPHY_API_KEY to your .env file.";return}if(!T.trim()){await _();return}u.value=!0,v.value="";try{const A=await fetch(`https://api.giphy.com/v1/gifs/search?api_key=${g}&q=${encodeURIComponent(T)}&limit=30&rating=r`);if(!A.ok)throw((w=(await A.json().catch(()=>({}))).meta)==null?void 0:w.status)===403?new Error("API key invalid or banned. Please check your GIPHY API key."):new Error("Failed to search GIFs");const E=await A.json();l.value=E.data||[]}catch(A){v.value=A.message||"Failed to load GIFs. Please try again.",l.value=[]}finally{u.value=!1}}async function _(){var T;if(!f){v.value="GIPHY API key not configured. Add VITE_GIPHY_API_KEY to your .env file.";return}u.value=!0,v.value="";try{const w=await fetch(`https://api.giphy.com/v1/gifs/trending?api_key=${g}&limit=30&rating=r`);if(!w.ok)throw((T=(await w.json().catch(()=>({}))).meta)==null?void 0:T.status)===403?new Error("API key invalid or banned. Please check your GIPHY API key."):new Error("Failed to load trending GIFs");const A=await w.json();l.value=A.data||[]}catch(w){v.value=w.message||"Failed to load GIFs. Please try again.",l.value=[]}finally{u.value=!1}}const y=ws(T=>{C(T)},300);Fe(n,T=>{y(T)});function x(T){var A,E,V;const w=((A=T.images.downsized)==null?void 0:A.url)||((E=T.images.original)==null?void 0:E.url)||((V=T.images.fixed_height)==null?void 0:V.url);w&&o("select",w)}function M(T){var w,A,E;return((w=T.images.fixed_height_small)==null?void 0:w.url)||((A=T.images.fixed_height)==null?void 0:A.url)||((E=T.images.downsized)==null?void 0:E.url)||""}return ze(()=>{_()}),(T,w)=>(i(),a("div",{class:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50",onClick:w[2]||(w[2]=ke(A=>o("close"),["self"]))},[s("div",Lv,[s("div",Dv,[zv,s("button",{class:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-x-grey-2 transition-colors",onClick:w[0]||(w[0]=A=>o("close"))},Hv)]),s("div",Wv,[s("div",Vv,[Ie(s("input",{"onUpdate:modelValue":w[1]||(w[1]=A=>n.value=A),type:"text",placeholder:"Search GIFs...",class:"w-full h-10 text-sm text-black pl-10 pr-4 rounded-lg border border-x-grey-1 focus:outline-none focus:border-x-pink-1 transition-colors"},null,512),[[Oe,n.value]]),qv])]),s("div",Yv,[u.value?(i(),a("div",Kv,Jv)):v.value?(i(),a("div",Qv,[s("p",Zv,b(v.value),1),O(f)?k("",!0):(i(),a("p",em,[X(" Get a free API key at "),tm]))])):l.value.length===0?(i(),a("div",sm," No GIFs found ")):(i(),a("div",om,[(i(!0),a(Y,null,he(l.value,A=>(i(),a("button",{key:A.id,class:"aspect-square rounded-lg overflow-hidden hover:ring-2 hover:ring-x-pink-1 transition-all",onClick:E=>x(A)},[s("img",{src:M(A),alt:A.title,class:"w-full h-full object-cover",loading:"lazy"},null,8,im)],8,nm))),128))]))]),rm])]))}}),vs={":grinning:":"😀",":grin:":"😀",":smiley:":"😃",":smile:":"😄",":beaming:":"😁",":laughing:":"😆","
5:satisfied:":"😆",":sweat_smile:":"😅",":rofl:":"🤣",":joy:":"😂",":lol:":"😂",":slight_smile:":"🙂",":blush:":"😊",":innocent:":"😇",":angel:":"😇",":smiling_hearts:":"🥰",":heart_eyes:":"😍",":star_struck:":"🤩",":kissing_heart:":"😘",":kiss:":"😘",":kissing:":"😗",":kissing_closed_eyes:":"😚",":kissing_smiling_eyes:":"😙",":smiling_tear:":"🥲",":yum:":"😋",":stuck_out_tongue:":"😛",":stuck_out_tongue_winking:":"😜",":wink_tongue:":"😜",":zany:":"🤪",":crazy:":"🤪",":stuck_out_tongue_closed_eyes:":"😝",":money_mouth:":"🤑",":hugs:":"🤗",":hugging:":"🤗",":hand_over_mouth:":"🤭",":shushing:":"🤫",":shh:":"🤫",":thinking:":"🤔",":hmm:":"🤔",":zipper_mouth:":"🤐",":raised_eyebrow:":"🤨",":neutral:":"😐",":expressionless:":"😑",":no_mouth:":"😶",":smirk:":"😏",":unamused:":"😒",":rolling_eyes:":"🙄",":eyeroll:":"🙄",":grimacing:":"😬",":exhale:":"😮‍💨",":lying:":"🤥",":relieved:":"😌",":pensive:":"😔",":sleepy:":"😪",":drooling:":"🤤",":sleeping:":"😴",":zzz:":"😴",":mask:":"😷",":thermometer:":"🤒",":bandage:":"🤕",":nauseated:":"🤢",":vomiting:":"🤮",":sneezing:":"🤧",":hot_face:":"🥵",":hot:":"🥵",":cold_face:":"🥶",":cold:":"🥶",":woozy:":"🥴",":dizzy_face:":"😵",":dizzy_spiral:":"😵‍💫",":exploding_head:":"🤯",":mind_blown:":"🤯",":cowboy:":"🤠",":partying:":"🥳",":party:":"🥳",":disguised:":"🥸",":sunglasses:":"😎",":cool:":"😎",":nerd:":"🤓",":monocle:":"🧐",":confused:":"😕",":worried:":"😟",":slightly_frowning:":"🙁",":frowning:":"☹️",":open_mouth:":"😮",":hushed:":"😯",":astonished:":"😲",":flushed:":"😳",":pleading:":"🥺",":puppy_eyes:":"🥺",":frowning_open_mouth:":"😦",":anguished:":"😧",":fearful:":"😨",":anxious:":"😰",":sad_relieved:":"😥",":cry:":"😢",":crying:":"😢",":sob:":"😭",":crying_loudly:":"😭",":scream:":"😱",":confounded:":"😖",":persevere:":"😣",":disappointed:":"😞",":downcast_sweat:":"😓",":weary:":"😩",":tired:":"😫",":yawning:":"🥱",":yawn:":"🥱",":triumph:":"😤",":huffing:":"😤",":rage:":"😡",":angry:":"😡",":angry_face:":"😠",":cursing:":"🤬",":swearing:":"🤬",":smiling_imp:":"😈",":devil:":"😈",":imp:":"👿",":skull:":"💀",":dead:":"💀",":skull_crossbones:":"☠️",":poop:":"💩",":shit:":"💩",":clown:":"🤡",":ogre:":"👹",":goblin:":"👺",":ghost:":"👻",":alien:":"👽",":space_invader:":"👾",":robot:":"🤖",":heart:":"❤️",":red_heart:":"❤️",":orange_heart:":"🧡",":yellow_heart:":"💛",":green_heart:":"💚",":blue_heart:":"💙",":purple_heart:":"💜",":black_heart:":"🖤",":white_heart:":"🤍",":brown_heart:":"🤎",":broken_heart:":"💔",":heart_exclamation:":"❣️",":two_hearts:":"💕",":revolving_hearts:":"💞",":heartbeat:":"💓",":heartpulse:":"💗",":growing_heart:":"💗",":sparkling_heart:":"💖",":cupid:":"💘",":gift_heart:":"💝",":heart_decoration:":"💟",":heart_hands:":"🫶",":lips:":"💋",":kiss_mark:":"💋",":love_letter:":"💌",":ring:":"💍",":gem:":"💎",":diamond:":"💎",":holding_back_tears:":"🥹",":melting:":"🫠",":wave:":"👋",":hi:":"👋",":hello:":"👋",":raised_back_of_hand:":"🤚",":raised_hand_with_fingers:":"🖐️",":raised_hand:":"✋",":high_five:":"✋",":vulcan:":"🖖",":spock:":"🖖",":ok:":"👌",":ok_hand:":"👌",":pinched_fingers:":"🤌",":italian:":"🤌",":pinching:":"🤏",":v:":"✌️",":peace:":"✌️",":crossed_fingers:":"🤞",":fingers_crossed:":"🤞",":love_you_gesture:":"🤟",":ily:":"🤟",":metal:":"🤘",":rock:":"🤘",":call_me:":"🤙",":shaka:":"🤙",":point_left:":"👈",":point_right:":"👉",":point_up:":"👆",":middle_finger:":"🖕",":fu:":"🖕",":point_down:":"👇",":point_up_2:":"☝️",":thumbsup:":"👍",":+1:":"👍",":thumbs_up:":"👍",":thumbsdown:":"👎",":-1:":"👎",":thumbs_down:":"👎",":fist:":"✊",":punch:":"👊",":fist_bump:":"👊",":fist_left:":"🤛",":fist_right:":"🤜",":clap:":"👏",":raised_hands:":"🙌",":hooray:":"🙌",":open_hands:":"👐",":palms_up:":"🤲",":handshake:":"🤝",":pray:":"🙏",":please:":"🙏",":thank_you:":"🙏",":writing:":"✍️","
5:nail_polish:":"💅",":nails:":"💅",":selfie:":"🤳",":muscle:":"💪",":flex:":"💪",":mechanical_arm:":"🦾",":mechanical_leg:":"🦿",":leg:":"🦵",":foot:":"🦶",":ear:":"👂",":nose:":"👃",":brain:":"🧠",":eyes:":"👀",":eye:":"👁️",":tongue:":"👅",":mouth:":"👄",":tada:":"🎉",":confetti:":"🎊",":gift:":"🎁",":balloon:":"🎈",":ribbon:":"🎀",":christmas_tree:":"🎄",":jack_o_lantern:":"🎃",":pumpkin:":"🎃",":fire:":"🔥",":lit:":"🔥",":sparkles:":"✨",":stars:":"✨",":dizzy:":"💫",":star:":"⭐",":star2:":"🌟",":glowing_star:":"🌟",":boom:":"💥",":explosion:":"💥",":anger:":"💢",":sweat_drops:":"💦",":dash:":"💨",":bomb:":"💣",":speech_balloon:":"💬",":thought_balloon:":"💭",":sleep:":"💤",":musical_note:":"🎵",":notes:":"🎶",":microphone:":"🎤",":mic:":"🎤",":headphones:":"🎧",":clapper:":"🎬",":video_game:":"🎮",":gaming:":"🎮",":dart:":"🎯",":target:":"🎯",":dice:":"🎲",":game_die:":"🎲",":slot_machine:":"🎰",":circus:":"🎪",":performing_arts:":"🎭",":art:":"🎨",":palette:":"🎨",":puzzle:":"🧩",":8ball:":"🎱",":trophy:":"🏆",":first_place:":"🥇",":gold:":"🥇",":second_place:":"🥈",":silver:":"🥈",":third_place:":"🥉",":bronze:":"🥉",":reminder_ribbon:":"🎗️",":medal:":"🏅",":pizza:":"🍕",":hamburger:":"🍔",":burger:":"🍔",":fries:":"🍟",":hotdog:":"🌭",":hot_dog:":"🌭",":popcorn:":"🍿",":bacon:":"🥓",":egg:":"🥚",":cooking:":"🍳",":fried_egg:":"🍳",":pancakes:":"🥞",":waffle:":"🧇",":bread:":"🍞",":croissant:":"🥐",":baguette:":"🥖",":cheese:":"🧀",":salad:":"🥗",":spaghetti:":"🍝",":pasta:":"🍝",":ramen:":"🍜",":noodles:":"🍜",":stew:":"🍲",":curry:":"🍛",":sushi:":"🍣",":bento:":"🍱",":dumpling:":"🥟",":shrimp:":"🍤",":doughnut:":"🍩",":donut:":"🍩",":cookie:":"🍪",":birthday:":"🎂",":cake:":"🎂",":cake_slice:":"🍰",":cupcake:":"🧁",":chocolate:":"🍫",":candy:":"🍬",":lollipop:":"🍭",":icecream:":"🍦",":ice_cream:":"🍨",":coffee:":"☕",":tea:":"🍵",":juice_box:":"🧃",":cup_with_straw:":"🥤",":beer:":"🍺",":beers:":"🍻",":cheers:":"🍻",":champagne_glasses:":"🥂",":toast:":"🥂",":wine:":"🍷",":cocktail:":"🍸",":tropical_drink:":"🍹",":cherry_blossom:":"🌸",":hibiscus:":"🌺",":sunflower:":"🌻",":tulip:":"🌷",":rose:":"🌹",":wilted_flower:":"🥀",":blossom:":"🌼",":bouquet:":"💐",":herb:":"🌿",":four_leaf_clover:":"🍀",":lucky:":"🍀",":leaves:":"🍃",":deciduous_tree:":"🌳",":palm_tree:":"🌴",":cactus:":"🌵",":rice:":"🌾",":seedling:":"🌱",":rainbow:":"🌈",":sunny:":"☀️",":sun:":"☀️",":sun_behind_cloud:":"🌤️",":partly_sunny:":"⛅",":cloud:":"☁️",":rain:":"🌧️",":rainy:":"🌧️",":thunder_cloud:":"⛈️",":lightning:":"🌩️",":snowflake:":"❄️",":snowman:":"⛄",":ocean:":"🌊",":droplet:":"💧",":crescent_moon:":"🌙",":full_moon:":"🌕",":new_moon:":"🌑",":first_quarter_moon_face:":"🌛",":last_quarter_moon_face:":"🌜",":full_moon_face:":"🌝",":new_moon_face:":"🌚",":zap:":"⚡",":lightning_bolt:":"⚡",":earth_africa:":"🌍",":earth_americas:":"🌎",":earth_asia:":"🌏",":cat:":"🐱",":dog:":"🐶",":mouse:":"🐭",":hamster:":"🐹",":rabbit:":"🐰",":bunny:":"🐰",":fox:":"🦊",":bear:":"🐻",":panda:":"🐼",":koala:":"🐨",":tiger:":"🐯",":lion:":"🦁",":cow:":"🐮",":pig:":"🐷",":frog:":"🐸",":monkey:":"🐵",":chicken:":"🐔",":penguin:":"🐧",":bird:":"🐦",":baby_chick:":"🐤",":duck:":"🦆",":eagle:":"🦅",":owl:":"🦉",":bat:":"🦇",":wolf:":"🐺",":boar:":"🐗",":horse:":"🐴",":unicorn:":"🦄",":bee:":"🐝",":honeybee:":"🐝",":butterfly:":"🦋",":snail:":"🐌",":bug:":"🐛",":turtle:":"🐢",":snake:":"🐍",":lizard:":"🦎",":octopus:":"🐙",":squid:":"🦑",":lobster:":"🦞",":crab:":"🦀",":blowfish:":"🐡",":tropical_fish:":"🐠",":fish:":"🐟",":dolphin:":"🐬",":whale:":"🐳",":shark:":"🦈",":crocodile:":"🐊",":smiley_cat:":"😺",":smile_cat:":"😸",":joy_cat:":"😹",":heart_eyes_cat:":"😻","
5:smirk_cat:":"😼",":kissing_cat:":"😽",":scream_cat:":"🙀",":crying_cat:":"😿",":pouting_cat:":"😾",":see_no_evil:":"🙈",":hear_no_evil:":"🙉",":speak_no_evil:":"🙊",":bulb:":"💡",":idea:":"💡",":flashlight:":"🔦",":candle:":"🕯️",":moneybag:":"💰",":money:":"💰",":dollar:":"💵",":credit_card:":"💳",":iphone:":"📱",":phone:":"📱",":computer:":"💻",":laptop:":"💻",":desktop:":"🖥️",":keyboard:":"⌨️",":mouse_computer:":"🖱️",":camera:":"📷",":video_camera:":"📹",":tv:":"📺",":radio:":"📻",":alarm_clock:":"⏰",":watch:":"⌚",":key:":"🔑",":old_key:":"🗝️",":closed_lock_with_key:":"🔐",":lock:":"🔒",":unlock:":"🔓",":email:":"📧",":e-mail:":"📧",":envelope_with_arrow:":"📩",":memo:":"📝",":note:":"📝",":pencil:":"✏️",":pushpin:":"📌",":paperclip:":"📎",":books:":"📚",":book:":"📖",":link:":"🔗",":scissors:":"✂️",":wastebasket:":"🗑️",":trash:":"🗑️",":shopping_cart:":"🛒",":bell:":"🔔",":no_bell:":"🔕",":loudspeaker:":"📢",":megaphone:":"📣",":loud_sound:":"🔊",":mute:":"🔇",":gear:":"⚙️",":settings:":"⚙️",":wrench:":"🔧",":hammer:":"🔨",":)":"😊",":-)":"😊",":(":"😞",":-(":"😞",":D":"😄",":-D":"😄",";)":"😉",";-)":"😉",":P":"😛",":-P":"😛",":p":"😛",":-p":"😛",":O":"😮",":-O":"😮",":o":"😮",":-o":"😮",XD:"😆",xD:"😆","<3":"❤️","</3":"💔",":*":"😘",":-*":"😘"};function lm(t){const e=t.match(/:[a-zA-Z0-9_+-]+:$/);if(e){const o=e[0],r=vs[o]||vs[o.toLowerCase()];if(r)return{shortcode:o,emoji:r,start:t.length-o.length}}return null}const dm={key:0,class:"flex items-center justify-center gap-2 py-2 text-sm text-red-500"},cm=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("circle",{cx:"12",cy:"12",r:"10"}),s("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})],-1),um=["disabled"],hm=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),s("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),s("polyline",{points:"21 15 16 10 5 21"})],-1),gm=[hm],fm=["disabled"],pm=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("polygon",{points:"23 7 16 12 23 17 23 7"}),s("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})],-1),vm=[pm],mm=["disabled"],ym=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[s("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})],-1),_m=[ym],wm={class:"relative"},xm=["disabled"],km=ys('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M8 14s1.5 2 4 2 4-2 4-2"></path><line x1="9" y1="9" x2="9.01" y2="9"></line><line x1="15" y1="9" x2="15.01" y2="9"></line></svg>',1),bm=[km],Cm=["disabled"],$m=s("span",{class:"text-xs font-bold text-gray-600"},"GIF",-1),Tm=[$m],jm=["disabled"],Mm={key:0,class:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"},Sm={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Am=s("line",{x1:"22",y1:"2",x2:"11",y2:"13"},null,-1),Em=s("polygon",{points:"22 2 15 22 11 13 2 9 22 2"},null,-1),Im=[Am,Em],js=je({__name:"ChatterMessageInput",props:{girlId:{},conversationId:{},embedded:{type:Boolean}},setup(t){const e=t,o=R(()=>
5e.embedded?"h-8 w-8":"h-10 w-10"),r=R(()=>e.embedded?"h-9":"h-10"),n=Ee(),l=I(""),u=I(!1),v=I(!1),g=I("image"),f=I(!1),C=I(!1),_=I(null),y=R(()=>e.conversationId??n.selectedConversationId),x=R(()=>{var z;return e.girlId??((z=n.girlFor(y.value))==null?void 0:z.id)??n.selectedGirlId??0}),M=R(()=>n.conversationFor(y.value)),T=R(()=>n.girlFor(y.value)),w=R(()=>{var z;return((z=n.convLoading[y.value??-1])==null?void 0:z.sending)??!1}),A=R(()=>{const z=M.value,oe=y.value!=null&&n.blockedConversationIds[y.value]===!0;return(z==null?void 0:z.blocked)===!0||(z==null?void 0:z.has_blocked)===!0||oe}),E=R(()=>{const z=M.value;return y.value!=null&&n.blockedConversationIds[y.value]===!0&&(z==null?void 0:z.blocked)!==!0&&(z==null?void 0:z.has_blocked)!==!0});function V(){y.value!=null&&n.clearBlockedConversation(y.value)}const de=R(()=>{var oe,ge,be,Ge;const z=((oe=T.value)==null?void 0:oe.display_name)||((ge=T.value)==null?void 0:ge.username)||"the girl";return E.value?`This punter has blocked ${z} — messages can't be delivered.`:(be=M.value)!=null&&be.blocked?`This user has blocked ${z}. You cannot send messages.`:(Ge=M.value)!=null&&Ge.has_blocked?`${z} has blocked this user. You cannot send messages.`:"This conversation is blocked. You cannot send messages."});let W=null;async function te(){const z=l.value.trim();!z||w.value||(l.value="",n.clearTypingIndicator(y.value??void 0),await n.sendMessage(x.value,y.value??0,z))}function L(z){z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),te())}function F(){n.sendTypingIndicator(y.value??void 0),W&&clearTimeout(W),W=setTimeout(()=>{n.clearTypingIndicator(y.value??void 0)},3e3);const z=lm(l.value);if(z){const oe=_.value;((oe==null?void 0:oe.selectionStart)||l.value.length)===l.value.length&&(l.value=l.value.substring(0,z.start)+z.emoji,setTimeout(()=>{if(oe){const be=z.start+z.emoji.length;oe.selectionStart=oe.selectionEnd=be}},0))}}function D(z){g.value=z,v.value=!0}function K(){u.value=!0}function H(z){u.value=!1,(z.mediaIds.length>0||z.galleryPhotoIds.length>0||z.galleryVideoIds.length>0)&&n.sendFromRepository(x.value,y.value??0,z.mediaIds,z.price,z.content,z.galleryPhotoIds,z.galleryVideoIds)}function Re(z){v.value=!1,z.type==="video"&&z.files.length===1?n.sendVideoMessage(x.value,y.value??0,z.files[0],z.price,z.content):z.files.length>0&&n.sendImageMessage(x.value,y.value??0,z.files,z.price,z.content)}function _e(z){const oe=_.value;if(oe){const ge=oe.selectionStart||0,be=oe.selectionEnd||0,Ge=l.value;l.value=Ge.substring(0,ge)+z+Ge.substring(be),setTimeout(()=>{oe.selectionStart=oe.selectionEnd=ge+z.length,oe.focus()},0)}else l.value+=z;f.value=!1}function Se(z){C.value=!1,z&&!w.value&&n.sendMessage(x.value,y.value??0,z)}return Qe(()=>{W&&clearTimeout(W)}
5),(z,oe)=>(i(),a("div",{class:J(["relative flex-shrink-0 bg-white z-20 border-t border-x-grey-1",z.embedded?"p-2":"p-4"])},[A.value?(i(),a("div",dm,[cm,s("span",null,b(de.value),1),E.value?(i(),a("button",{key:0,class:"ml-2 text-xs font-medium text-x-pink-1 underline hover:no-underline",onClick:V}," Try again ")):k("",!0)])):(i(),a("div",{key:1,class:J(["flex items-center gap-1",{"flex-wrap":z.embedded}])},[s("div",{class:J(["flex items-center gap-0.5",z.embedded?"order-2 w-full pt-1":"flex-none"])},[s("button",{class:J(["flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors",o.value]),title:"Upload images",disabled:w.value,onClick:oe[0]||(oe[0]=ge=>D("image"))},gm,10,um),s("button",{class:J(["flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors",o.value]),title:"Upload video",disabled:w.value,onClick:oe[1]||(oe[1]=ge=>D("video"))},vm,10,fm),s("button",{class:J(["flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors",o.value]),title:"From media repository",disabled:w.value,onClick:K},_m,10,mm),s("div",wm,[s("button",{class:J(["flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors",[o.value,{"bg-gray-100":f.value}]]),title:"Add emoji",disabled:w.value,onClick:oe[2]||(oe[2]=ge=>f.value=!f.value)},bm,10,xm),f.value?(i(),Me(Gv,{key:0,onSelect:_e,onClose:oe[3]||(oe[3]=ge=>f.value=!1)})):k("",!0)]),s("button",{class:J(["flex items-center justify-center rounded-full hover:bg-gray-100 transition-colors",o.value]),title:"Send GIF",disabled:w.value,onClick:oe[4]||(oe[4]=ge=>C.value=!0)},Tm,10,Cm)],2),Ie(s("input",{ref_key:"messageInput",ref:_,"onUpdate:modelValue":oe[5]||(oe[5]=ge=>l.value=ge),class:J(["flex-auto min-w-0 text-black placeholder:text-black px-4 text-xs rounded-2xl border border-x-grey-1 shadow focus-visible:outline-none focus-visible:shadow-light-grey",r.value]),placeholder:"Type a message...",disabled:w.value,onKeydown:L,onInput:F},null,42,jm),[[Oe,l.value]]),pe(Vt,{class:J(["flex-none p-0 !min-h-0 flex items-center justify-center",o.value]),disabled:!l.value.trim()||w.value,onClick:te},{default:Ne(()=>[w.value?(i(),a("div",Mm)):(i(),a("svg",Sm,Im))]),_:1},8,["class","disabled"])],2)),v.value?(i(),Me(xv,{key:2,"media-type":g.value,"girl-id":x.value,"conversation-id":y.value,onClose:oe[6]||(oe[6]=ge=>v.value=!1),onSend:Re},null,8,["media-type","girl-id","conversation-id"])):k("",!0),u.value?(i(),Me(Lp,{key:3,"girl-id":x.value,"conversation-id":y.value,onClose:oe[7]||(oe[7]=ge=>u.value=!1),onSend:H},null,8,["girl-id","conversation-id"])):k("",!0),C.value?(i(),Me(am,{key:4,onSelect:Se,onClose:oe[8]||(oe[8]=ge=>C.value=!1)})):k("",!0)],2))}}),Rm={class:"border-b border-x-grey-1"},Um=["aria-expanded"],Pm={class:"flex items-center gap-2 font-semibold text-sm text-gray-700"},Nm={key:0,class:"text-xs font-normal bg-x-grey-2 text-x-grey-15 px-2 py-0.5 rounded-full"},Fm=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1),Om=[Fm],Zt=je({__name:"ChatterInfoAccordion",props:{title:{},badge:{},defaultOpen:{type:Boolean}},setup(t){const o=I(t.defaultOpen??!1);return(r,n)=>(i(),a("div",Rm,[s("button",{class:"w-full flex items-center justify-between px-4 py-3 bg-white hover:bg-x-grey-2 transition-colors","aria-expanded":o.value,onClick:n[0]||(n[0]=l=>o.value=!o.value)},[s("span",Pm,[X(b(r.title)+" ",1),r.badge?(i(),a("span",Nm,b(r.badge),1)):k("",!0)]),(i(),a("svg",{class:J(["w-4 h-4 text-x-grey-15 transition-transform flex-shrink-0",o.value?"rotate-180":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Om,2))],8,Um),Ie(s("div",null,[Os(r.$slots,"default")],512),[[Fs,o.value]])]))}}),Gm={class:"flex flex-col"},Lm={class:"px-4 py-3 border-b border-x-grey-1 flex-shrink-0 bg-white"},Dm=["disabled"],zm={class:"flex justify-end mt-2"},Bm=["disabled"],Hm={key:0,class:"flex items-center justify-center py-8"},Wm=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),Vm=[Wm],qm={key:1,class:"flex items-center justify-center py-8 text-gray-400 text-sm px-6 text-center"},Ym={key:2},Km={key:0},Xm={class:"flex justify-end gap-2 mt-2"},Jm=["disabled","onClick"],Qm={key:1,class:"text-sm text-gray-800 whitespace-pre-wrap break-words"},Zm={key:2,class:"flex items-center justify-between mt-2"},e0={class:"text-xs text-gray-400 min-w-0"},t0={class:"text-gray-500"},s0={key:0,class:"flex items-center gap-2 flex-shrink-0 ml-2"},o0=s("span",{class:"text-xs text-gray-600"},"Delete?",-1),n0=["onClick"],i0=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1),r0=[i0],a0=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1),l0=[a0],d0={key:1,class:"flex items-center gap-1 flex-shrink-0 ml-2"},c0=["onClick"],u0=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1),h0=[u0],g0=["onClick"],f0=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),p0=[f0],v0=je({__name:"ChatterPunterNotesSection",props:{girlId:{},conversationId:{}},setup(t){const e=t,o=Ee(),r=ht(),n=R(()=>{var W;return(W=r.currentUser)==null?void 0:W.id}),l=R(()=>o.notesFor(e.conversationId)),u=I(""),v=I(!1),g=I(null),f=I(null),C=I(""),_=I(!1);async function y(){const W=u.value.trim();!W||v.value||(v.value=!0,u.value="",await o.addNote(W,e.girlId,e.conversationId),v.value=!1)}function x(W){W.key==="Enter"&&!W.shiftKey&&(W.preventDefault(),y())}async function M(W){await o.deleteNote(W,e.girlId,e.conversationId),g.value=null}function T(W){f.value=W.id,C.value=W.content}function w(){f.value=null,C.value=""}async function A(W){const te=C.value.trim();!te||_.value||(_.value=!0,await o.updateNote(W,te,e.girlId,e.conversationId),_.value=!1,w())}function E(W){const te=new Date(W);return isNaN(te.getTime())?"":te.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})+" at "+te.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function V(W){return n.value===W}function de(){const W=o.notes[e.conversationId]!==void 0;o.fetchNotes(e.girlId,e.conversationId,W)}return ze(de),Fe(()=>e.conversationId,()=>{g.value=null,u.value="",w(),de()}),(W,te)=>(i(),a("div",Gm,[s("div",Lm,[Ie(s("textarea",{"onUpdate:modelValue":te[0]||(te[0]=L=>u.value=L),class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 resize-none text-black",placeholder:"Add a note about this punter...",rows:"3",disabled:v.value,onKeydown:x},null,40,Dm),[[Oe,u.value]]),s("div",zm,[s("button",{disabled:!u.value.trim()||v.value,class:"px-4 py-1.5 bg-x-pink-1 text-white text-sm font-medium rounded-lg hover:bg-x-pink-1/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:y},b(v.value?"Adding...":"Add Note"),9,Bm)])]),O(o).loading.notes&&l.value.length===0?(i(),a("div",Hm,Vm)):l.value.length===0?(i(),a("div",qm," No notes yet. Add notes to help other chatters. ")):(i(),a("div",Ym,[(i(!0),a(Y,null,he(l.value,L=>(i(),a("div",{key:L.id,class:"px-4 py-3 hover:bg-gray-50 transition-colors border-b border-x-grey-1 group"},[f.value===L.id?(i(),a("div",Km,[Ie(s("textarea",{"onUpdate:modelValue":te[1]||(te[1]=F=>C.value=F),rows:"3",class:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:border-x-pink-1 resize-none text-black"},null,512),[[Oe,C.value]]),s("div",Xm,[s("button",{class:"px-3 py-1 text-sm text-gray-600 hover:bg-gray-100 rounded transition-colors",onClick:w}," Cancel "),s("button",{disabled:!C.value.trim()||_.value,class:"px-3 py-1 bg-x-pink-1 text-white text-sm font-medium rounded hover:bg-x-pink-1/90 transition-colors disabled:opacity-50",onClick:F=>A(L.id)}," Save ",8,Jm)])])):(i(),a("p",Qm,b(L.content),1)),f.value!==L.id?(i(),a("div",Zm,[s("span",e0,[s("span",t0,"by "+b(L.user.display_name||L.user.username),1),X(" · "+b(E(L.created_at)),1)]),g.value===L.id?(i(),a("div",s0,[o0,s("button",{class:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded transition-colors",title:"Confirm delete",onClick:F=>M(L.id)},r0,8,n0),s("button",{class:"p-1 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded transition-colors",title:"Cancel",onClick:te[2]||(te[2]=F=>g.value=null)}
5,l0)])):L.is_owner??V(L.user.id)?(i(),a("div",d0,[s("button",{class:"p-1 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors",title:"Edit note",onClick:F=>T(L)},h0,8,c0),s("button",{class:"p-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded transition-colors",title:"Delete note",onClick:F=>g.value=L.id},p0,8,g0)])):k("",!0)])):k("",!0)]))),128))]))]))}});function tt(t){return Number.isInteger(t)?String(t):t.toFixed(2)}const m0={class:"flex flex-col"},y0={key:0,class:"flex items-center justify-center py-8"},_0=s("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-x-pink-1"},null,-1),w0=[_0],x0={key:1,class:"flex items-center justify-center py-8 text-gray-400 text-sm"},k0={key:2},b0={class:"px-4 pt-3 pb-1 text-[11px] font-semibold uppercase tracking-wide text-x-grey-15"},C0={class:"px-4 pb-3"},$0=["title"],T0={class:"text-xs text-gray-500 flex-shrink-0"},j0={class:"px-4 py-2 flex justify-end"},M0=["disabled"],S0=s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1),A0=[S0],E0=je({__name:"ChatterPunterStatsSection",props:{girlId:{},conversationId:{}},setup(t){const e=t,o=Ee(),r=R(()=>o.punterStats[e.conversationId]??null),n=R(()=>o.loading.punterStats&&!r.value);function l(f){if(!f)return"Never";const C=new Date(f);return isNaN(C.getTime())?"Never":C.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})+" "+C.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function u(f){if(!f)return"Never";const C=new Date(f);if(isNaN(C.getTime()))return"Never";const _=Date.now()-C.getTime(),y=Math.floor(_/6e4);if(y<1)return"just now";if(y<60)return`${y}m ago`;const x=Math.floor(y/60);if(x<24)return`${x}h ago`;const M=Math.floor(x/24);return M<30?`${M}d ago`:C.toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"})}const v=R(()=>{const f=r.value;return f?[{heading:"💰 Spending",rows:[{label:"Total spend anywhere",value:`${tt(f.spending.lifetime_total)} cr`,highlight:"gold"},{label:"Spend in this chat",value:`${tt(f.spending.conversation_total)} cr · ${f.spending.conversation_unlocks} unlock${f.spending.conversation_unlocks===1?"":"s"}`,highlight:"gold"}]},{heading:"👤 Punter",rows:[{label:"Current credits",value:`${tt(f.punter.credits)} cr`,highlight:f.punter.credits>0?"green":void 0,title:"Credits the punter can spend right now"},{label:f.punter.is_online?"Online":"Last seen",value:f.punter.is_online?"Now":u(f.punter.last_seen_at),highlight:f.punter.is_online?"green":void 0},{label:"Viewed this girl's profile",value:u(f.punter.last_profile_view_at),title:"Refreshed every 10 minutes"},{label:"Registered",value:l(f.punter.registered_at)}]},{heading:"💬 Conversation",rows:[{label:"Started",value:l(f.conversation.started_at)},{label:"First contact by",value:f.conversation.first_contact_by==="girl"?"Girl / chatter":"Punter"},{label:"Messages",value:`${f.conversation.total_messages} (${f.conversation.punter_messages} punter / ${f.conversation.girl_messages} girl)`},{label:"Last punter message",value:u(f.conversation.last_punter_message_at)}]}]:[]});function g(){o.fetchPunterStats(e.girlId,e.conversationId)}return ze(g),Fe(()=>e.conversationId,g),(f,C)=>(i(),a("div",m0,[n.value?(i(),a("div",y0,w0)):r.value?(i(),a("div",k0,[(i(!0),a(Y,null,he(v.value,_=>(i(),a("div",{key:_.heading,class:"border-b border-x-grey-1 last:border-b-0"},[s("div",b0,b(_.heading),1),s("dl",C0,[(i(!0),a(Y,null,he(_.rows,y=>(i(),a("div",{key:y.label,class:"flex items-center justify-between gap-2 py-1",title:y.title},[s("dt",T0,b(y.label),1),s("dd",{class:J(["text-xs font-semibold text-right",y.highlight==="gold"?"text-x-gold-8":y.highlight==="green"?"text-x-green-2":"text-gray-900"])},b(y.value),3)],8,$0))),128))])]))),128)),s("div",j0,[s("button",{class:"flex items-center gap-1 text-[11px] text-x-grey-15 hover:text-gray-700 transition-colors",disabled:O(o).loading.punterStats,onClick:g},[(i(),a("svg",{class:J(["w-3 h-3",O(o).loading.punterStats?"animate-spin":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},A0,2)),X(" Refresh ")],8,M0)])])):(i(),a("div",x0," No statistics available "))]))}}),I0={class:"flex flex-col bg-white"},R0={key:0,class:"flex items-center justify-between px-4 py-3 border-t border-x-grey-1"},U0={class:"min-w-0"},P0=s("p",{class:"text-sm font-medium text-gray-800"},"Do not bulk",-1),N0={class:"text-xs text-gray-400"},F0=["aria-checked"],Ms=je({__name:"ChatterInfoPanel",props:{girlId:{},conversationId:{}},setup(t){const e=t,o=Ee(),r=ht(),n=R(()=>{var x;const y=o.conversationFor(e.conversationId);return y?((x=y.initiator_user)==null?void 0:x.id)===e.girlId?y.recipient_user:y.initiator_user:null}),l=R(()=>{const y=o.girls.find(x=>x.id===e.girlId);return(y==null?void 0:y.display_name)||(y==null?void 0:y.username)||"girl"}),u=R(()=>{var y,x;return((y=n.value)==null?void 0:y.display_name)||((x=n.value)==null?void 0:x.username)||"punter"}),v=R(()=>(o.girlNotes[e.girlId]||[]).length),g=R(()=>o.notesFor(e.conversationId).length),f=R(()=>r.canManageChatterTags()),C=R(()=>{var x,M,T,w;const y=(x=n.value)==null?void 0:x.id;return y==null?!1:o.punterDoNotBulk[y]??((T=(M=o.punterStats[e.conversationId])==null?void 0:M.punter)==null?void 0:T.do_not_bulk)??((w=n.value)==null?void 0:w.do_not_bulk)??!1});function _(){var x;const y=(x=n.value)==null?void 0:x.id;y!=null&&o.togglePunterDoNotBulk(y,!C.value)}return(y,x)=>(i(),a("div",I0,[pe(Zt,{title:`Girl notes (${l.value})`,badge:v.value,"default-open":!1},{default:Ne(()=>[pe(Cs,{"girl-id":y.girlId},null,8,["girl-id"])]),_:1},8,["title","badge"]),pe(Zt,{title:`Punter notes (${u.value})`,badge:g.value,"default-open":!0},{default:Ne(()=>[pe(v0,{"girl-id":y.girlId,"conversation-id":y.conversationId},null,8,["girl-id","conversation-id"])]),_:1},8,["title","badge"]),pe(Zt,{title:"Punter statistics","default-open":!0},{default:Ne(()=>[pe(E0,{"girl-id":y.girlId,"conversation-id":y.conversationId},null,8,["girl-id","conversation-id"])]),_:1}),f.value&&n.value?(i(),a("div",R0,[s("div",U0,[P0,s("p",N0,"Blocks all bulk sends to "+b(u.value),1)]),s("button",{type:"button",role:"switch","aria-checked":C.value,class:J(["relative inline-flex h-5 w-9 flex-shrink-0 items-center rounded-full transition-colors",C.value?"bg-x-pink-1":"bg-x-grey-2"]),onClick:_},[s("span",{class:J(["inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform",C.value?"translate-x-4":"translate-x-1"])},null,2)],10,F0)])):k("",!0)]))}}),O0={class:"fixed inset-0 z-[60] flex items-center justify-center"},G0={class:"relative bg-white rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[85vh] flex flex-col"},L0={class:"px-4 py-3 border-b border-gray-200 flex items-center justify-between flex-shrink-0"},D0={class:"min-w-0"},z0={class:"font-semibold text-gray-800 truncate"},B0={key:0,class:"block text-xs text-gray-400 truncate"},H0=s("svg",{class:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),W0=[H0],V0={class:"flex-1 overflow-y-auto"},q0=je({__name:"ChatterInfoModal",props:{girlId:{},conversationId:{}},emits:["close"],setup(t,{emit:e}){const o=t,r=e;function n(g){g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),r("close"))}ze(()=>{document.addEventListener("keydown",n,!0)}),Qe(()=>{document.removeEventListener("keydown",n,!0)});const l=Ee(),u=R(()=>{const g=l.girls.find(f=>f.id===o.girlId);return(g==null?void 0:g.display_name)||(g==null?void 0:g.username)||""}),v=R(()=>{var C;const g=l.conversationFor(o.conversationId);if(!g)return"Conversation";const f=((C=g.initiator_user)==null?void 0:C.id)===o.girlId?g.recipient_user:g.initiator_user;return(f==null?void 0:f.display_name)||(f==null?void 0:f.username)||"Conversation"});return(g,f)=>(i(),Me(lt,{to:"body"},[s("div",O0,[s("div",{class:"absolute inset-0 bg-black/50",onClick:f[0]||(f[0]=C=>r("close"))}),s("div",G0,[s("div",L0,[s("div",D0,[s("h3",z0," Info — "+b(v.value),1),u.value?(i(),a("span",B0," Chatting as "+b(u.value),1)):k("",!0)]),s("button",{class:"p-1 hover:bg-gray-100 rounded transition-colors flex-shrink-0",onClick:f[1]||(f[1]=C=>r("close"))},W0)]),s("div",V0,[pe(Ms,{"girl-id":g.girlId,"conversation-id":g.conversationId},null,8,["girl-id","conversation-id"])])])])]))}}),Y0={class:"relative flex-shrink-0"}
5,K0=["src","alt"],X0={key:1,class:"w-8 h-8 rounded-full bg-gray-500 flex items-center justify-center text-xs font-bold"},J0={key:2,class:"absolute -bottom-0.5 -right-0.5 flex h-3 w-3"},Q0=s("span",{class:"absolute inline-flex h-full w-full rounded-full bg-x-green-1 opacity-60 animate-ping"},null,-1),Z0=s("span",{class:"relative inline-flex h-3 w-3 rounded-full bg-x-green-1 border-2 border-gray-900"},null,-1),ey=[Q0,Z0],ty={class:"flex-1 min-w-0"},sy={class:"flex items-center gap-1.5"},oy={class:"text-sm font-medium truncate"},ny={key:0,class:"text-[10px] font-semibold text-x-green-1 flex-shrink-0 whitespace-nowrap"},iy=["title"],ry=["title"],ay=["title"],ly=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),dy=[ly],cy=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4h4M20 8V4h-4M4 16v4h4M20 16v4h-4"})],-1),uy=[cy],hy=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 12H6"})],-1),gy=[hy],fy=s("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),py=[fy],vy={key:1,class:"flex items-center gap-1.5 px-2 py-1 bg-gray-50 border-b border-x-grey-1 flex-shrink-0 min-w-0"},my={key:0,class:"inline-flex items-center h-5 px-1.5 rounded-full bg-x-green-4 text-x-green-5 text-[10px] font-semibold flex-shrink-0",title:"Total spent by this punter"},yy={class:"flex-1 min-w-0"},_y={class:"flex-1 min-h-0 flex flex-col overflow-hidden"},wy={class:"flex-shrink-0"},xy=je({__name:"ChatterChatWindow",props:{girlId:{},conversationId:{}},setup(t){const e=t,o=Ee(),r=Mt(),n=R(()=>o.conversationFor(e.conversationId)),l=R(()=>o.girlFor(e.conversationId)),u=R(()=>{const F=n.value;return F?F.initiator_user.id===e.girlId?F.recipient_user:F.initiator_user:null}),v=R(()=>{var F,D;return((F=u.value)==null?void 0:F.display_name)||((D=u.value)==null?void 0:D.username)||"Conversation"}),g=R(()=>{var F,D;return((F=l.value)==null?void 0:F.display_name)||((D=l.value)==null?void 0:D.username)||""}),f=R(()=>{var F;return((F=o.openWindows[e.conversationId])==null?void 0:F.unread)??0}),C=R(()=>{var D;const F=(D=u.value)==null?void 0:D.total_spent;return typeof F=="number"?F:null}),_=R(()=>o.focusedConversationId===e.conversationId),y=R(()=>{var F;return((F=o.openWindows[e.conversationId])==null?void 0:F.saleFlash)??null}),x=R(()=>{var F;return((F=o.openWindows[e.conversationId])==null?void 0:F.saleFlashSeq)??0}),M=R(()=>{var F;return((F=o.openWindows[e.conversationId])==null?void 0:F.sessionSales)??0}),T=R(()=>{var F;return((F=o.openWindows[e.conversationId])==null?void 0:F.unseenSales)??0}),w=R(()=>{const F=_.value?"z-50":"z-40";return y.value!==null||T.value>0?`${F} ring-4 ring-x-gold-4`:_.value?"z-50 ring-2 ring-x-pink-1":f.value>0?"z-40 ring-4 ring-x-pink-1 animate-pulse":"z-40"}),A=R(()=>y.value!==null?"bg-gradient-to-r from-x-gold-4 via-x-gold-8 to-x-gold-4 animate-pulse":f.value>0&&!_.value?"bg-x-pink-1 animate-pulse":"bg-gray-900"),E=R(()=>u.value?r.isUserOnline(u.value.id):!1),V=I(!1);function de(){o.focusWindow(e.conversationId)}function W(){o.minimizeWindow(e.conversationId)}function te(){o.expandWindowToMain(e.girlId,e.conversationId)}function L(){o.closeWindow(e.conversationId)}return(F,D)=>{var K;return i(),a("div",{class:J(["pointer-events-auto relative flex flex-col w-96 h-[70vh] max-h-[560px] min-h-[420px] bg-white rounded-t-lg shadow-2xl border border-x-grey-1 overflow-hidden transition-shadow",w.value]),onMousedown:de},[y.value!==null?(i(),a("div",{key:`sale-burst-${x.value}`,class:"cc-sale-burst","aria-hidden":"true"},[(i(),a(Y,null,he(7,H=>s("span",{key:H,class:"cc-sale-coin"},"💰")),64))])):k("",!0),s("div",{class:J(["flex items-center gap-2 px-3 h-11 text-white flex-shrink-0 cursor-pointer",A.value])},[s("div",Y0,[(K=u.value)!=null&&K.photo_url?(i(),a("img",{key:0,src:u.value.photo_url,alt:v.value,class:"w-8 h-8 rounded-full object-cover"},null,8,K0)):(i(),a("div",X0,b(v.value.charAt(0).toUpperCase()),1)),E.value?(i(),a("span",J0,ey)):k("",!0)]),s("div",ty,[s("div",sy,[s("span",oy,b(v.value),1),E.value?(i(),a("span",ny,"● Online")):k("",!0),f.value>0?(i(),a("span",{key:1,class:"min-w-5 h-5 px-1.5 bg-white text-x-pink-1 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 animate-bounce",title:`${f.value} new message${f.value===1?"":"s"}`},b(f.value>99?"99+":f.value),9,iy)):k("",!0),y.value!==null?(i(),a("span",{key:2,class:"flex items-center gap-0.5 h-5 px-2 bg-white text-x-gold-8 rounded-full text-[11px] font-extrabold flex-shrink-0 whitespace-nowrap animate-bounce shadow",title:`Just sold for ${O(tt)(y.value)} credits!`},"💰 +"+b(O(tt)(y.value)),9,ry)):M.value>0?(i(),a("span",{key:3,class:"flex items-center gap-0.5 h-5 px-1.5 rounded-full bg-x-gold-4/20 text-x-gold text-[11px] font-bold flex-shrink-0 whitespace-nowrap",title:`${O(tt)(M.value)} credits earned in this chat since the window opened`},"💰 "+b(O(tt)(M.value)),9,ay)):k("",!0)]),g.value?(i(),a("span",{key:0,class:J(["block text-[10px] truncate",y.value!==null?"text-white/90":"text-gray-400"])}," Chatting as "+b(g.value),3)):k("",!0)]),s("button",{class:"p-1 rounded hover:bg-gray-700 transition-colors flex-shrink-0",title:"Info: notes & punter statistics",onClick:D[0]||(D[0]=ke(H=>V.value=!0,["stop"]))},dy),s("button",{class:"p-1 rounded hover:bg-gray-700 transition-colors flex-shrink-0",title:"Open in main view",onClick:ke(te,["stop"])},uy),s("button",{class:"p-1 rounded hover:bg-gray-700 transition-colors flex-shrink-0",title:"Minimize",onClick:ke(W,["stop"])},gy),s("button",{class:"p-1 rounded hover:bg-gray-700 transition-colors flex-shrink-0",title:"Close",onClick:ke(L,["stop"])},py)],2),n.value?(i(),a("div",vy,[C.value!==null?(i(),a("span",my," 💰 "+b(C.value)+"cr ",1)):k("",!0),s("div",yy,[pe($s,{conversation:n.value},null,8,["conversation"])])])):k("",!0),s("div",_y,[pe(Ts,{"girl-id":F.girlId,"conversation-id":F.conversationId,embedded:!0},null,8,["girl-id","conversation-id"])]),s("div",wy,[pe(js,{"girl-id":F.girlId,"conversation-id":F.conversationId,embedded:!0},null,8,["girl-id","conversation-id"])]),V.value?(i(),Me(q0,{key:2,"girl-id":F.girlId,"conversation-id":F.conversationId,onClose:D[1]||(D[1]=H=>V.value=!1)},null,8,["girl-id","conversation-id"])):k("",!0)],34)}}}),ky=["title"],by={class:"relative flex-shrink-0"},Cy=["src","alt"],$y={key:1,class:"w-8 h-8 rounded-full bg-gray-500 flex items-center justify-center text-xs font-bold"},Ty={key:2,class:"absolute -bottom-0.5 -right-0.5 flex h-3 w-3"},jy=s("span",{class:"absolute inline-flex h-full w-full rounded-full bg-x-green-1 opacity-60 animate-ping"},null,-1),My=s("span",{class:"relative inline-flex h-3 w-3 rounded-full bg-x-green-1 border-2 border-gray-900"},null,-1),Sy=[jy,My],Ay={class:"text-sm font-medium truncate"},Ey={key:0,class:"absolute -top-1 -right-1 min-w-5 h-5 px-1 bg-x-pink-1 rounded-full border-2 border-gray-900 flex items-center justify-center text-[10px] font-medium"},Iy={key:1,class:"absolute -top-1 -left-1 h-5 px-1.5 bg-x-gold-4 text-gray-900 rounded-full border-2 border-gray-900 flex items-center justify-center gap-0.5 text-[10px] font-bold whitespace-nowrap"},Ry=je({__name:"ChatterMinimizedBubble",props:{conversationId:{},girlId:{}}
5,setup(t){const e=t,o=Ee(),r=Mt(),n=R(()=>o.conversationFor(e.conversationId)),l=R(()=>{const y=n.value;return y?y.initiator_user.id===e.girlId?y.recipient_user:y.initiator_user:null}),u=R(()=>{var y,x;return((y=l.value)==null?void 0:y.display_name)||((x=l.value)==null?void 0:x.username)||"Conversation"}),v=R(()=>l.value?r.isUserOnline(l.value.id):!1),g=R(()=>{var y;return((y=o.openWindows[e.conversationId])==null?void 0:y.unread)??0}),f=R(()=>{var y;return((y=o.openWindows[e.conversationId])==null?void 0:y.unseenSales)??0}),C=R(()=>{var T,w;const y=(w=(T=n.value)==null?void 0:T.last_message)==null?void 0:w.content,x=v.value?" · Online now":"",M=f.value>0?` · 💰 +${tt(f.value)} credits sold!`:"";return y?`${u.value}${x}${M}: ${y}`:`Chat with ${u.value}${x}${M}`});function _(){o.restoreWindow(e.conversationId)}return(y,x)=>{var M;return i(),a("button",{class:J(["pointer-events-auto relative flex items-center gap-2 h-10 pl-1 pr-3 bg-gray-900 text-white rounded-full shadow-lg hover:bg-gray-700 transition-colors max-w-[180px]",f.value>0?"ring-2 ring-x-gold-4 animate-pulse":g.value>0?"ring-2 ring-x-pink-1 animate-pulse":""]),title:C.value,onClick:_},[s("div",by,[(M=l.value)!=null&&M.photo_url?(i(),a("img",{key:0,src:l.value.photo_url,alt:u.value,class:"w-8 h-8 rounded-full object-cover"},null,8,Cy)):(i(),a("div",$y,b(u.value.charAt(0).toUpperCase()),1)),v.value?(i(),a("span",Ty,Sy)):k("",!0)]),s("span",Ay,b(u.value),1),g.value>0?(i(),a("span",Ey,b(g.value>99?"99+":g.value),1)):k("",!0),f.value>0?(i(),a("span",Iy," 💰+"+b(O(tt)(f.value)),1)):k("",!0)],10,ky)}}}),Uy={class:"pointer-events-auto relative"},Py=["title"],Ny={key:0,class:"absolute -top-1 -left-1 h-5 px-1.5 bg-x-gold-4 text-gray-900 rounded-full border-2 border-gray-900 flex items-center justify-center gap-0.5 text-[10px] font-bold whitespace-nowrap"},Fy={key:1,class:"absolute -bottom-0.5 -right-0.5 flex h-3 w-3"},Oy=s("span",{class:"absolute inline-flex h-full w-full rounded-full bg-x-green-1 opacity-60 animate-ping"},null,-1),Gy=s("span",{class:"relative inline-flex h-3 w-3 rounded-full bg-x-green-1 border-2 border-gray-900"},null,-1),Ly=[Oy,Gy],Dy={key:2,class:"absolute -top-1 -right-1 min-w-5 h-5 px-1 bg-x-pink-1 rounded-full border-2 border-gray-900 flex items-center justify-center text-[10px] font-medium"},zy={class:"absolute bottom-full right-0 mb-2 z-50 w-64 max-h-80 overflow-y-auto bg-white rounded-lg shadow-2xl border border-x-grey-1 py-1"},By=["onClick"],Hy={class:"relative flex-shrink-0"},Wy=["src","alt"],Vy={key:1,class:"w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center text-xs font-bold text-gray-600"},qy={key:2,class:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full bg-x-green-1 border-2 border-white",title:"Online now"},Yy={class:"flex-1 text-sm text-gray-900 truncate"},Ky={key:0,class:"flex-shrink-0 h-5 px-1.5 bg-x-gold-4 text-gray-900 rounded-full flex items-center justify-center gap-0.5 text-[10px] font-bold whitespace-nowrap"},Xy={key:1,class:"flex-shrink-0 min-w-5 h-5 px-1 bg-x-pink-1 text-white rounded-full flex items-center justify-center text-[10px] font-medium"},Jy=je({__name:"ChatterWindowOverflow",props:{windows:{}},setup(t){const e=t,o=Ee(),r=Mt(),n=I(!1),l=R(()=>e.windows??o.overflowWindows),u=R(()=>l.value.reduce((M,T)=>M+(T.unread||0),0)),v=R(()=>l.value.reduce((M,T)=>M+(T.unseenSales||0),0));function g(M,T){const w=o.conversationFor(M);return w?w.initiator_user.id===T?w.recipient_user:w.initiator_user:null}function f(M,T){const w=g(M,T);return w?r.isUserOnline(w.id):!1}const C=R(()=>l.value.filter(M=>f(M.conversationId,M.girlId)).length);function _(M,T){const w=g(M,T);return(w==null?void 0:w.display_name)||(w==null?void 0:w.username)||"Conversation"}function y(){n.value=!n.value}function x(M){n.value=!1,o.restoreWindow(M)}return(M,T)=>(i(),a("div",Uy,[s("button",{class:J(["relative flex items-center justify-center w-12 h-12 bg-gray-900 text-white rounded-full shadow-lg hover:bg-gray-700 transition-colors font-medium text-sm",v.value>0?"ring-2 ring-x-gold-4 animate-pulse":u.value>0?"ring-2 ring-x-pink-1 animate-pulse":""]),title:`${l.value.length} more chat${l.value.length===1?"":"s"}${C.value>0?` · ${C.value} online`:""}${v.value>0?` · 💰 +${O(tt)(v.value)} credits sold!`:""}`,onClick:y},[X(" +"+b(l.value.length)+" ",1),v.value>0?(i(),a("span",Ny," 💰+"+b(O(tt)(v.value)),1)):k("",!0),C.value>0?(i(),a("span",Fy,Ly)):k("",!0),u.value>0?(i(),a("span",Dy,b(u.value>99?"99+":u.value),1)):k("",!0)],10,Py),n.value?(i(),a(Y,{key:0},[s("div",{class:"fixed inset-0 z-40",onClick:T[0]||(T[0]=w=>n.value=!1)}),s("div",zy,[(i(!0),a(Y,null,he(l.value,w=>{var A,E;return i(),a("button",{key:w.conversationId,class:"w-full flex items-center gap-2 px-3 py-2 hover:bg-gray-50 transition-colors text-left",onClick:V=>x(w.conversationId)},[s("div",Hy,[(A=g(w.conversationId,w.girlId))!=null&&A.photo_url?(i(),a("img",{key:0,src:((E=g(w.conversationId,w.girlId))==null?void 0:E.photo_url)??void 0,alt:_(w.conversationId,w.girlId),class:"w-8 h-8 rounded-full object-cover"},null,8,Wy)):(i(),a("div",Vy,b(_(w.conversationId,w.girlId).charAt(0).toUpperCase()),1)),f(w.conversationId,w.girlId)?(i(),a("span",qy)):k("",!0)]),s("span",Yy,b(_(w.conversationId,w.girlId)),1),(w.unseenSales||0)>0?(i(),a("span",Ky," 💰+"+b(O(tt)(w.unseenSales||0)),1)):k("",!0),w.unread>0?(i(),a("span",Xy,b(w.unread>99?"99+":w.unread),1)):k("",!0)],8,By)}),128))])],64)):k("",!0)]))}}),Qy={class:"fixed bottom-0 right-0 z-40 hidden lg:flex items-end gap-3 p-4 pointer-events-none"},Zy=je({__name:"ChatterWindowStack",setup(t){const e=Ee(),o=Mt();let r=[];Fe(()=>e.openWindowPunterIds,_=>{const y=_.filter(M=>!r.includes(M)),x=r.filter(M=>!_.includes(M));y.length&&o.watchUsers(y),x.length&&o.unwatchUsers(x),r=_},{immediate:!0,deep:!0});const n=R(()=>[...e.visibleWindows].reverse()),l=R(()=>e.visibleMinimizedBubbles),u=R(()=>[...e.overflowWindows,...e.hiddenMinimizedBubbles]),v=R(()=>u.value.length>0);let g=null;function f(){g&&clearTimeout(g),g=setTimeout(()=>e.updateWindowCapacity(),150)}function C(_){_.key==="Escape"&&!_.defaultPrevented&&e.focusedConversationId!==null&&e.closeWindow(e.focusedConversationId)}return ze(()=>{document.addEventListener("keydown",C),e.updateWindowCapacity(),window.addEventListener("resize",f)}),Qe(()=>{document.removeEventListener("keydown",C),window.removeEventListener("resize",f),g&&clearTimeout(g),r.length&&o.unwatchUsers(r)}),(_,y)=>(i(),a("div",Qy,[v.value?(i(),Me(Jy,{key:0,windows:u.value},null,8,["windows"])):k("",!0),(i(!0),a(Y,null,he(l.value,x=>(i(),Me(Ry,{key:`bubble-${x.conversationId}`,"girl-id":x.girlId,"conversation-id":x.conversationId},null,8,["girl-id","conversation-id"]))),128)),(i(!0),a(Y,null,he(n.value,x=>(i(),Me(xy,{key:x.conversationId,"girl-id":x.girlId,"conversation-id":x.conversationId},null,8,["girl-id","conversation-id"]))),128))]))}}),e_={class:"flex flex-col h-screen overflow-hidden bg-white"},t_={class:"flex flex-1 overflow-hidden"},s_={class:"w-[320px] flex-shrink-0 border-r border-x-grey-1 overflow-y-auto"},o_={class:"flex-1 min-w-0 flex flex-col overflow-hidden"},n_={key:1,class:"flex-1 flex items-center justify-center text-x-grey-15"},i_=s("p",null,"Select a conversation to start messaging",-1),r_=[i_],a_={key:0,class:"w-[320px] flex-shrink-0 border-l border-x-grey-1 overflow-y-auto"},l_=je({__name:"ChatterCrmDesktop",setup(t){const e=Ee(),o=I(!1),r=Yt("initialGirlId",null),n=Yt("initialConversationId",null),l=Yt("initialTagIds",[]);function u(){o.value=!o.value}return ze(async()=>{var g;o.value=window.innerWidth>=1280,await e.fetchGirls(),e.restoreWindows();const v=r&&e.girls.some(f=>f.id===r)?r:(g=e.girls[0])==null?void 0:g.id;v&&(await e.selectGirl(v),l.length>0&&await e.applyTagFilterIds(l),n&&e.currentConversations.some(f=>f.id===n)&&await e.selectConversation(n))}),Gs(()=>{e.cleanup()}),(v,g)=>(i(),a("div",e_,[pe(Yr),s("div",t_,[s("div",s_,[pe(Zc)]),s("div",o_,[O(e).selectedConversationId?(i(),a(Y,{key:0},[pe(Ts,{"show-notes-toggle":!0,"notes-open":o.value,onToggleNotes:u},null,8,["notes-open"]),s("div",{class:J({"pb-20":O(e).hasOpenWindows})},[pe(js)],2)],64)):(i(),a("div",n_,r_))]),O(e).selectedGirlId&&O(e).selectedConversationId&&o.value?(i(),a("div",a_,[pe(Ms,{"girl-id":O(e).selectedGirlId,"conversation-id":O(e).selectedConversationId},null,8,["girl-id","conversation-id"])])):k("",!0)]),pe(Zy)]))}}),b_=je({__name:"index",setup(t){const e=Ls(),o=Ee();function r(){const f=e.query.girl;return f?Number(f):null}function n(){const f=e.query.thread;return f?Number(f):null}function l(){const f=e.query.tags;return f?String(f).split(",").map(Number).filter(C=>Number.isFinite(C)&&C>0):[]}function u(){const f=new URLSearchParams;o.selectedGirlId&&f.set("girl",String(o.selectedGirlId)),o.selectedConversationId&&f.set("thread",String(o.selectedConversationId)),o.activeTagFilterIds.length>0&&f.set("tags",o.activeTagFilterIds.join(","));const C=f.toString(),_=window.location.pathname+(C?`?${C}`:"");_!==window.location.pathname+window.location.search&&window.history.replaceState(window.history.state,"",_)}Fe(()=>[o.selectedGirlId,o.selectedConversationId,o.activeTagFilterIds.join(",")],u);function v(){return r()}function g(){return n()}return Kt("initialGirlId",v()),Kt("initialConversationId",g()),Kt("initialTagIds",l()),(f,C)=>(i(),Me(l_))}});
5export{b_ 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.