@usechat/react-native 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +49 -45
  2. package/dist/index.mjs +131 -127
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- "use strict";var Os=Object.create;var eo=Object.defineProperty;var Fs=Object.getOwnPropertyDescriptor;var Hs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ws=Object.prototype.hasOwnProperty;var Us=(M,T)=>()=>(M&&(T=M(M=0)),T);var as=(M,T)=>{for(var C in T)eo(M,C,{get:T[C],enumerable:!0})},is=(M,T,C,R)=>{if(T&&typeof T=="object"||typeof T=="function")for(let S of Hs(T))!Ws.call(M,S)&&S!==C&&eo(M,S,{get:()=>T[S],enumerable:!(R=Fs(T,S))||R.enumerable});return M};var Q=(M,T,C)=>(C=M!=null?Os(Ns(M)):{},is(T||!M||!M.__esModule?eo(C,"default",{value:M,enumerable:!0}):C,M)),Ks=M=>is(eo({},"__esModule",{value:!0}),M);var zs={};as(zs,{copyToClipboard:()=>zr,isClipboardAvailable:()=>Br});var zr,Br,Bs=Us(()=>{"use strict";zr=async M=>{console.log("copyToClipboard called with text:",M);try{try{let{setStringAsync:T}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",T),await T(M),console.log("Text copied to clipboard successfully")}catch(T){throw console.error("Failed to import expo-clipboard:",T),new Error("expo-clipboard not available")}try{let T=await import("react-native-toast-message"),C=T.default||T;console.log("react-native-toast-message imported successfully"),C.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(T){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",T)}return!0}catch(T){console.error("Failed to copy to clipboard:",T);try{let C=await import("react-native-toast-message");(C.default||C).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(C){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",C)}return!1}},Br=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var an={};as(an,{AttachmentMenu:()=>Jr,Chat:()=>Or,ChatAvatar:()=>_r,ChatHeader:()=>Yr,ChatItem:()=>$r,ChatList:()=>qr,ChatListSearchBar:()=>Gr,ChatProvider:()=>Fr,ChatScreenHeader:()=>Ur,MessageInput:()=>Wr,MessageList:()=>Nr,ThemeProvider:()=>Xr,TypingIndicator:()=>Kr,defaultTheme:()=>Tt,getAuthState:()=>cs,getProjectId:()=>ds,initChat:()=>ms,isInitialized:()=>us,useAttachments:()=>rn,useChatConfig:()=>Hr,useChatMessages:()=>en,useChatSDK:()=>Zr,useMessageActions:()=>on,useMessageInput:()=>nn,useMessageList:()=>tn,useMessageReactions:()=>sn,useTheme:()=>Qr});module.exports=Ks(an);var nt={isInitialized:!1,projectId:null,error:null},ls=M=>{nt={isInitialized:!0,projectId:M,error:null}},xt=M=>{nt={isInitialized:!1,projectId:null,error:M}};var cs=()=>({...nt}),Rt=()=>{if(nt.error)throw new Error(`UseChat SDK initialization failed: ${nt.error}
2
+ "use strict";var Os=Object.create;var Zt=Object.defineProperty;var Fs=Object.getOwnPropertyDescriptor;var Hs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ws=Object.prototype.hasOwnProperty;var Us=(M,T)=>()=>(M&&(T=M(M=0)),T);var as=(M,T)=>{for(var C in T)Zt(M,C,{get:T[C],enumerable:!0})},is=(M,T,C,R)=>{if(T&&typeof T=="object"||typeof T=="function")for(let S of Hs(T))!Ws.call(M,S)&&S!==C&&Zt(M,S,{get:()=>T[S],enumerable:!(R=Fs(T,S))||R.enumerable});return M};var Q=(M,T,C)=>(C=M!=null?Os(Ns(M)):{},is(T||!M||!M.__esModule?Zt(C,"default",{value:M,enumerable:!0}):C,M)),Ks=M=>is(Zt({},"__esModule",{value:!0}),M);var zs={};as(zs,{copyToClipboard:()=>zr,isClipboardAvailable:()=>Br});var zr,Br,Bs=Us(()=>{"use strict";zr=async M=>{console.log("copyToClipboard called with text:",M);try{try{let{setStringAsync:T}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",T),await T(M),console.log("Text copied to clipboard successfully")}catch(T){throw console.error("Failed to import expo-clipboard:",T),new Error("expo-clipboard not available")}try{let T=await import("react-native-toast-message"),C=T.default||T;console.log("react-native-toast-message imported successfully"),C.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(T){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",T)}return!0}catch(T){console.error("Failed to copy to clipboard:",T);try{let C=await import("react-native-toast-message");(C.default||C).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(C){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",C)}return!1}},Br=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var an={};as(an,{AttachmentMenu:()=>Jr,Chat:()=>Or,ChatAvatar:()=>_r,ChatHeader:()=>Yr,ChatItem:()=>$r,ChatList:()=>qr,ChatListSearchBar:()=>Gr,ChatProvider:()=>Fr,ChatScreenHeader:()=>Ur,MessageInput:()=>Wr,MessageList:()=>Nr,ThemeProvider:()=>Xr,TypingIndicator:()=>Kr,defaultTheme:()=>St,getAuthState:()=>cs,getProjectId:()=>ds,initChat:()=>ms,isInitialized:()=>us,useAttachments:()=>rn,useChatConfig:()=>Hr,useChatMessages:()=>en,useChatSDK:()=>Zr,useMessageActions:()=>on,useMessageInput:()=>nn,useMessageList:()=>tn,useMessageReactions:()=>sn,useTheme:()=>Qr});module.exports=Ks(an);var nt={isInitialized:!1,projectId:null,error:null},ls=M=>{nt={isInitialized:!0,projectId:M,error:null}},bt=M=>{nt={isInitialized:!1,projectId:null,error:M}};var cs=()=>({...nt}),Tt=()=>{if(nt.error)throw new Error(`UseChat SDK initialization failed: ${nt.error}
3
3
 
4
4
  Please call initChat() with a valid project ID before using any UseChat components or hooks.
5
5
 
@@ -11,23 +11,23 @@ Please call initChat() with a valid project ID before using any UseChat componen
11
11
 
12
12
  Example:
13
13
  import { initChat } from '@usechat/react-native';
14
- await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),us=()=>nt.isInitialized&&!nt.error;var ms=async M=>{let{projectId:T,apiUrl:C="http://localhost:3000/api/chat/init",debug:R=!1}=M;if(!T){let S="Project ID is required";throw xt(S),new Error(S)}try{R&&console.log(`[UseChat SDK] Validating projectId: ${T}`);let S=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:T})});if(R&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let B=await S.json();P=B.error||B.message||P}catch{try{let j=await S.text();j&&(P=`Server error: ${j}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw xt(P),new Error(P)}let A;try{let P=await S.text();if(R&&console.log(`[Chat SDK] Response text: ${P}`),!P){let B="Server returned empty response";throw xt(B),new Error(B)}A=JSON.parse(P)}catch(P){R&&console.error("[Chat SDK] JSON parse error:",P);let B="Server returned invalid JSON response";throw xt(B),new Error(B)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw xt(P),new Error(P)}let I=A;return R&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${T}`),ls(T),I}catch(S){R&&console.error("[Chat SDK] Init error:",S);let A;throw S instanceof TypeError&&S.message.includes("fetch")?A="Network error: Unable to connect to server. Please check your internet connection.":S instanceof Error?A=S.message:A="Failed to initialize chat: Unknown error",A.includes("Project ID is required")||xt(A),new Error(A)}};var ve=Q(require("react")),ot=require("react-native");var to=require("react"),gs=require("react-native"),oo=require("react-native-keyboard-controller"),ps=(0,to.createContext)(null),qs=({children:M,config:T={}})=>{let C={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...T};return<ps.Provider value={{config:C}}>
15
- <oo.KeyboardProvider>
16
- <oo.KeyboardAvoidingView behavior={C.keyboardBehavior}style={[$s.keyboardContainer]}keyboardVerticalOffset={C.keyboardVerticalOffset}>
14
+ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Tt(),nt.projectId),us=()=>nt.isInitialized&&!nt.error;var ms=async M=>{let{projectId:T,apiUrl:C="http://localhost:3000/api/chat/init",debug:R=!1}=M;if(!T){let S="Project ID is required";throw bt(S),new Error(S)}try{R&&console.log(`[UseChat SDK] Validating projectId: ${T}`);let S=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:T})});if(R&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let B=await S.json();P=B.error||B.message||P}catch{try{let E=await S.text();E&&(P=`Server error: ${E}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw bt(P),new Error(P)}let A;try{let P=await S.text();if(R&&console.log(`[Chat SDK] Response text: ${P}`),!P){let B="Server returned empty response";throw bt(B),new Error(B)}A=JSON.parse(P)}catch(P){R&&console.error("[Chat SDK] JSON parse error:",P);let B="Server returned invalid JSON response";throw bt(B),new Error(B)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw bt(P),new Error(P)}let I=A;return R&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${T}`),ls(T),I}catch(S){R&&console.error("[Chat SDK] Init error:",S);let A;throw S instanceof TypeError&&S.message.includes("fetch")?A="Network error: Unable to connect to server. Please check your internet connection.":S instanceof Error?A=S.message:A="Failed to initialize chat: Unknown error",A.includes("Project ID is required")||bt(A),new Error(A)}};var ve=Q(require("react")),ot=require("react-native");var eo=require("react"),gs=require("react-native"),to=require("react-native-keyboard-controller"),ps=(0,eo.createContext)(null),qs=({children:M,config:T={}})=>{let C={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...T};return<ps.Provider value={{config:C}}>
15
+ <to.KeyboardProvider>
16
+ <to.KeyboardAvoidingView behavior={C.keyboardBehavior}style={[$s.keyboardContainer]}keyboardVerticalOffset={C.keyboardVerticalOffset}>
17
17
  {}
18
18
  {M}
19
- </oo.KeyboardAvoidingView>
20
- </oo.KeyboardProvider>
21
- </ps.Provider>},Uo=qs,Ht=()=>{let M=(0,to.useContext)(ps);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},$s=gs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var tt=require("react"),Nt=(M={})=>{let{uploader:T,maxAttachments:C=10,maxFileSize:R=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=M,[B,j]=(0,tt.useState)([]),[v,V]=(0,tt.useState)(!1),[D,z]=(0,tt.useState)(0),L=(0,tt.useCallback)(N=>{if(B.length>=C){console.warn(`Maximum ${C} attachments allowed`);return}if(N.data?.size&&N.data.size>R){console.warn(`File size exceeds ${R/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(Ee=>Ee.endsWith("/*")?N.data.type.startsWith(Ee.slice(0,-1)):N.data.type===Ee)){console.warn(`File type ${N.data.type} not allowed`);return}let E={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};j(oe=>[...oe,E]),A&&A(E)},[B.length,C,R,S,A]),k=(0,tt.useCallback)(N=>{j(E=>E.filter(oe=>oe.id!==N)),I&&I(N)},[I]),O=(0,tt.useCallback)(()=>{j([])},[]),F=(0,tt.useCallback)(async N=>{try{let E;switch(N){case"image":E={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":E={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":E={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":E={type:"contact",data:{id:"contact-1",name:"John Doe",phoneNumbers:["+1234567890"],emails:["john@example.com"]}};break;default:throw new Error(`Unsupported attachment type: ${N}`)}let oe={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:E.data,fileName:E.data.fileName||E.data.name,fileSize:E.data.fileSize||E.data.size,mimeType:E.data.mimeType,uploadStatus:"pending",uploadProgress:0};L(oe)}catch(E){console.error("Error opening picker:",E)}},[L]),H=(0,tt.useCallback)(async()=>{if(!T)return console.warn("No uploader provided, skipping upload"),B;if(B.length===0)return[];V(!0),z(0);try{let N=B.map(async(J,Me)=>{try{j(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let je=setInterval(()=>{j(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),Ke=await T.upload(J.data);clearInterval(je);let Be={...J,uploadStatus:"completed",uploadProgress:100,data:{...J.data,url:Ke.url,metadata:Ke.metadata}};return j(Ce=>Ce.map(U=>U.id===J.id?Be:U)),Be}catch(je){return console.error(`Error uploading attachment ${J.id}:`,je),j(Ke=>Ke.map(Be=>Be.id===J.id?{...Be,uploadStatus:"failed",uploadProgress:0}:Be)),{...J,uploadStatus:"failed",uploadProgress:0}}}),E=await Promise.all(N),Ee=E.filter(J=>J.uploadStatus==="completed").length/E.length*100;return z(Ee),P&&P(E),E}catch(N){return console.error("Error uploading attachments:",N),B}finally{V(!1)}},[B,T,P]);return{attachments:B,openPicker:F,addAttachment:L,removeAttachment:k,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:D}};var $e=require("react"),hs=(M={})=>{let{onSend:T,onFocus:C,initialValue:R="",maxLength:S=1e3}=M,[A,I]=(0,$e.useState)(R),[P,B]=(0,$e.useState)(40),[j,v]=(0,$e.useState)(!1),V=(0,$e.useCallback)(H=>{H.length<=S&&I(H)},[S]),D=(0,$e.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();T&&T(N,H),I(""),B(40)},[A,T]),z=(0,$e.useCallback)(()=>{v(!0),C&&C()},[C]),L=(0,$e.useCallback)(()=>{v(!1)},[]),k=(0,$e.useCallback)(H=>{B(Math.max(40,Math.min(H,120)))},[]),O=(0,$e.useCallback)(()=>{I(""),B(40)},[]),F=(0,$e.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:j,handleTextChange:V,handleSend:D,handleFocus:z,handleBlur:L,handleContentSizeChange:k,clearMessage:O,setMessage:F}};var Ys=({messages:M,components:T={},renderProps:C={},onMessageSend:R,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:B,maxAttachments:j=10,maxFileSize:v=10*1024*1024,allowedFileTypes:V=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:z=!0,enableScrollToBottom:L,enableTypingIndicator:k,isTyping:O=!1,typingUserName:F,isLoading:H=!1,loadingComponent:N})=>{let E=Ht(),[oe,Ee]=(0,ve.useState)(!1),J=T.MessageList||ut,Me=T.MessageInput||dt,je=D??E.enableReactionDetails??!0,Ke=z??E.enableMessageActions??!0,Be=L??E.enableScrollToBottom??!0,Ce=k??E.enableTypingIndicator??!0,[U,Oe]=(0,ve.useState)(null),Ze=(0,ve.useRef)(null),[Ge,Ve]=(0,ve.useState)(M||[]),qe=(0,ve.useRef)((M||[]).length+1);ve.default.useEffect(()=>{M&&(Ve(M),qe.current=M.length+1)},[M]),ve.default.useEffect(()=>{if(U&&Ze.current){let K=setTimeout(()=>{Ze.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let et=Nt({uploader:B,maxAttachments:j,maxFileSize:v,allowedTypes:V}),Se=hs({onSend:(K,G)=>{if(U){let X={id:U.id,text:U.text,senderName:U.senderName,senderId:U.senderId,isMe:U.isMe,timestamp:U.timestamp,type:U.type==="image"?"image":"text",imageData:U.imageData};if(G&&G.length>0){let q=G[0],Ie={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:G,type:q.type==="image"?"image":"text",...q.type==="image"&&q.data&&{imageData:{uri:q.data.uri||"",width:q.data.width||300,height:q.data.height||200,fileName:q.fileName||"image.jpg",fileSize:q.fileSize||0}}};Ve(_e=>[..._e,Ie]),R&&R(Ie)}else{let q={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Ve(Ie=>[...Ie,q]),R&&R(q)}Oe(null)}else if(G&&G.length>0){let X=G[0],q={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:G,type:X.type==="image"?"image":"text",...X.type==="image"&&X.data&&{imageData:{uri:X.data.uri||"",width:X.data.width||300,height:X.data.height||200,fileName:X.fileName||"image.jpg",fileSize:X.fileSize||0}}};Ve(Ie=>[...Ie,q]),R&&R(q)}else{let X={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Ve(q=>[...q,X]),R&&R(X)}et.clearAttachments()},onFocus:()=>{}}),ct=(0,ve.useCallback)((K,G)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",G),Ve(X=>X.map(q=>q.id===K?q.reactions?.find(_e=>_e.emoji===G)?{...q,reactions:q.reactions?.map(_e=>_e.emoji===G?{..._e,count:_e.count+1,users:[..._e.users,"currentUser"]}:_e)}:{...q,reactions:[...q.reactions||[],{emoji:G,count:1,users:["currentUser"]}]}:q)),S&&S(K,G)},[S]),No=(0,ve.useCallback)((K,G)=>{Ve(X=>X.map(q=>q.id===K?{...q,reactions:q.reactions?.map(Ie=>Ie.emoji===G?{...Ie,count:Math.max(0,Ie.count-1),users:Ie.users.filter(_e=>_e!=="currentUser")}:Ie).filter(Ie=>Ie.count>0)}:q)),A&&A(K,G)},[A]),Wo=(0,ve.useCallback)(K=>{Ve(G=>G.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),Pe=(0,ve.useCallback)(()=>{Oe(null)},[]),Fe=(0,ve.useCallback)(K=>{Oe(K),setTimeout(()=>{Ze.current?.focus()},100)},[]),Ft=(0,ve.useCallback)(K=>{if(oe)return;let{layout:G}=K.nativeEvent;G.height<=0||Ee(!0)},[oe]);if(H)return<ot.View style={bt.container}>
22
- {N||<ot.View style={bt.loadingContainer}>
19
+ </to.KeyboardAvoidingView>
20
+ </to.KeyboardProvider>
21
+ </ps.Provider>},Uo=qs,Ht=()=>{let M=(0,eo.useContext)(ps);if(!M)throw new Error("useChatConfig must be used within a ChatProvider");return M.config},$s=gs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var tt=require("react"),Nt=(M={})=>{let{uploader:T,maxAttachments:C=10,maxFileSize:R=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=M,[B,E]=(0,tt.useState)([]),[v,V]=(0,tt.useState)(!1),[D,z]=(0,tt.useState)(0),L=(0,tt.useCallback)(N=>{if(B.length>=C){console.warn(`Maximum ${C} attachments allowed`);return}if(N.data?.size&&N.data.size>R){console.warn(`File size exceeds ${R/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(Ee=>Ee.endsWith("/*")?N.data.type.startsWith(Ee.slice(0,-1)):N.data.type===Ee)){console.warn(`File type ${N.data.type} not allowed`);return}let j={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(oe=>[...oe,j]),A&&A(j)},[B.length,C,R,S,A]),k=(0,tt.useCallback)(N=>{E(j=>j.filter(oe=>oe.id!==N)),I&&I(N)},[I]),O=(0,tt.useCallback)(()=>{E([])},[]),F=(0,tt.useCallback)(async N=>{try{let j;switch(N){case"image":j={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":j={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":j={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":j={type:"contact",data:{id:"contact-1",name:"John Doe",phoneNumbers:["+1234567890"],emails:["john@example.com"]}};break;default:throw new Error(`Unsupported attachment type: ${N}`)}let oe={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:j.data,fileName:j.data.fileName||j.data.name,fileSize:j.data.fileSize||j.data.size,mimeType:j.data.mimeType,uploadStatus:"pending",uploadProgress:0};L(oe)}catch(j){console.error("Error opening picker:",j)}},[L]),H=(0,tt.useCallback)(async()=>{if(!T)return console.warn("No uploader provided, skipping upload"),B;if(B.length===0)return[];V(!0),z(0);try{let N=B.map(async(J,Me)=>{try{E(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let je=setInterval(()=>{E(Ce=>Ce.map(U=>U.id===J.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),Ke=await T.upload(J.data);clearInterval(je);let Be={...J,uploadStatus:"completed",uploadProgress:100,data:{...J.data,url:Ke.url,metadata:Ke.metadata}};return E(Ce=>Ce.map(U=>U.id===J.id?Be:U)),Be}catch(je){return console.error(`Error uploading attachment ${J.id}:`,je),E(Ke=>Ke.map(Be=>Be.id===J.id?{...Be,uploadStatus:"failed",uploadProgress:0}:Be)),{...J,uploadStatus:"failed",uploadProgress:0}}}),j=await Promise.all(N),Ee=j.filter(J=>J.uploadStatus==="completed").length/j.length*100;return z(Ee),P&&P(j),j}catch(N){return console.error("Error uploading attachments:",N),B}finally{V(!1)}},[B,T,P]);return{attachments:B,openPicker:F,addAttachment:L,removeAttachment:k,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:D}};var $e=require("react"),hs=(M={})=>{let{onSend:T,onFocus:C,initialValue:R="",maxLength:S=1e3}=M,[A,I]=(0,$e.useState)(R),[P,B]=(0,$e.useState)(40),[E,v]=(0,$e.useState)(!1),V=(0,$e.useCallback)(H=>{H.length<=S&&I(H)},[S]),D=(0,$e.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();T&&T(N,H),I(""),B(40)},[A,T]),z=(0,$e.useCallback)(()=>{v(!0),C&&C()},[C]),L=(0,$e.useCallback)(()=>{v(!1)},[]),k=(0,$e.useCallback)(H=>{B(Math.max(40,Math.min(H,120)))},[]),O=(0,$e.useCallback)(()=>{I(""),B(40)},[]),F=(0,$e.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:V,handleSend:D,handleFocus:z,handleBlur:L,handleContentSizeChange:k,clearMessage:O,setMessage:F}};var Ys=({messages:M,components:T={},renderProps:C={},onMessageSend:R,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:B,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:V=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:z=!0,enableScrollToBottom:L,enableTypingIndicator:k,isTyping:O=!1,typingUserName:F,isLoading:H=!1,loadingComponent:N})=>{let j=Ht(),[oe,Ee]=(0,ve.useState)(!1),J=T.MessageList||ut,Me=T.MessageInput||dt,je=D??j.enableReactionDetails??!0,Ke=z??j.enableMessageActions??!0,Be=L??j.enableScrollToBottom??!0,Ce=k??j.enableTypingIndicator??!0,[U,Oe]=(0,ve.useState)(null),Ze=(0,ve.useRef)(null),[Ge,Ve]=(0,ve.useState)(M||[]),qe=(0,ve.useRef)((M||[]).length+1);ve.default.useEffect(()=>{M&&(Ve(M),qe.current=M.length+1)},[M]),ve.default.useEffect(()=>{if(U&&Ze.current){let K=setTimeout(()=>{Ze.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let et=Nt({uploader:B,maxAttachments:E,maxFileSize:v,allowedTypes:V}),Se=hs({onSend:(K,G)=>{if(U){let X={id:U.id,text:U.text,senderName:U.senderName,senderId:U.senderId,isMe:U.isMe,timestamp:U.timestamp,type:U.type==="image"?"image":"text",imageData:U.imageData};if(G&&G.length>0){let q=G[0],Ie={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:G,type:q.type==="image"?"image":"text",...q.type==="image"&&q.data&&{imageData:{uri:q.data.uri||"",width:q.data.width||300,height:q.data.height||200,fileName:q.fileName||"image.jpg",fileSize:q.fileSize||0}}};Ve(_e=>[..._e,Ie]),R&&R(Ie)}else{let q={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Ve(Ie=>[...Ie,q]),R&&R(q)}Oe(null)}else if(G&&G.length>0){let X=G[0],q={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:G,type:X.type==="image"?"image":"text",...X.type==="image"&&X.data&&{imageData:{uri:X.data.uri||"",width:X.data.width||300,height:X.data.height||200,fileName:X.fileName||"image.jpg",fileSize:X.fileSize||0}}};Ve(Ie=>[...Ie,q]),R&&R(q)}else{let X={id:qe.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Ve(q=>[...q,X]),R&&R(X)}et.clearAttachments()},onFocus:()=>{}}),ct=(0,ve.useCallback)((K,G)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",G),Ve(X=>X.map(q=>q.id===K?q.reactions?.find(_e=>_e.emoji===G)?{...q,reactions:q.reactions?.map(_e=>_e.emoji===G?{..._e,count:_e.count+1,users:[..._e.users,"currentUser"]}:_e)}:{...q,reactions:[...q.reactions||[],{emoji:G,count:1,users:["currentUser"]}]}:q)),S&&S(K,G)},[S]),No=(0,ve.useCallback)((K,G)=>{Ve(X=>X.map(q=>q.id===K?{...q,reactions:q.reactions?.map(Ie=>Ie.emoji===G?{...Ie,count:Math.max(0,Ie.count-1),users:Ie.users.filter(_e=>_e!=="currentUser")}:Ie).filter(Ie=>Ie.count>0)}:q)),A&&A(K,G)},[A]),Wo=(0,ve.useCallback)(K=>{Ve(G=>G.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),Pe=(0,ve.useCallback)(()=>{Oe(null)},[]),Fe=(0,ve.useCallback)(K=>{Oe(K),setTimeout(()=>{Ze.current?.focus()},100)},[]),Ft=(0,ve.useCallback)(K=>{if(oe)return;let{layout:G}=K.nativeEvent;G.height<=0||Ee(!0)},[oe]);if(H)return<ot.View style={Mt.container}>
22
+ {N||<ot.View style={Mt.loadingContainer}>
23
23
  {}
24
24
  </ot.View>}
25
- </ot.View>;if(!oe)return<ot.View style={bt.container}>
26
- <ot.View style={bt.chatContainer}onLayout={Ft}>
27
- <ot.View style={bt.loadingContainer}>{N}</ot.View>
25
+ </ot.View>;if(!oe)return<ot.View style={Mt.container}>
26
+ <ot.View style={Mt.chatContainer}onLayout={Ft}>
27
+ <ot.View style={Mt.loadingContainer}>{N}</ot.View>
28
28
  </ot.View>
29
- </ot.View>;let ns=C.renderInput;return<ot.View style={bt.container}>
30
- <ot.View style={bt.fill}>
29
+ </ot.View>;let ns=C.renderInput;return<ot.View style={Mt.container}>
30
+ <ot.View style={Mt.fill}>
31
31
  <J messages={Ge}isTyping={Ce?O:!1}typingUserName={F}showScrollToBottom={Be}isReplyActive={!!U}enableMessageActions={Ke}enableReactionDetails={je}onReactionAdd={ct}onReactionRemove={No}onMessageDelete={Wo}onReplyMessage={Fe}onActionPress={(K,G)=>{K==="reply"?Fe(G):P?.(K,G)}}/>
32
32
 
33
33
  {ns?ns({value:Se.message,onChangeText:Se.handleTextChange,onSend:Se.handleSend,onFocus:Se.handleFocus,height:Se.composerHeight,onContentSizeChange:Se.handleContentSizeChange,replyToMessage:U,onCancelReply:Pe,attachments:et.attachments,onAttachmentAdd:et.addAttachment,onAttachmentRemove:et.removeAttachment,onAttachmentUpload:et.uploadAttachments}):<Me ref={Ze}value={Se.message}onChangeText={Se.handleTextChange}onSend={Se.handleSend}onFocus={Se.handleFocus}height={Se.composerHeight}onContentSizeChange={Se.handleContentSizeChange}replyToMessage={U}onCancelReply={Pe}onAttachmentSend={(K,G)=>{let X=K.type==="image",q={id:qe.current++,text:G?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:X?"image":"text",...X&&K.data&&{imageData:{uri:K.data.uri||"",width:K.data.width||300,height:K.data.height||200,fileName:K.data.fileName||K.data.name||"image.jpg",fileSize:K.data.fileSize||K.data.size||0}}};Ve(Ie=>[...Ie,q]),R&&R(q),Se.handleTextChange("")}}/>}
@@ -36,7 +36,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
36
36
  </ot.View>
37
37
 
38
38
  {}
39
- </ot.View>},bt=ot.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),Ko=Ys;var we=require("react-native"),mt=require("lucide-react-native");var ys=require("react");var so=require("react");var Tt={colors:{primary:"#3B82F6",secondary:"#34B7F1",background:"#FFFFFF",surface:"#F7F8FA",surfaceSecondary:"#F3F4F6",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",unread:"#EBF8FF",online:"#10B981",messageBubble:{sent:"#3B82F6",received:"#E5E7EB",sentText:"#FFFFFF",receivedText:"#111827"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},blue:{50:"#EBF8FF",500:"#3B82F6",600:"#2563EB"},green:{500:"#10B981"}},spacing:{xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},borderRadius:{sm:4,md:8,lg:12,xl:16,full:9999},typography:{fontFamily:"System",fontSize:{xs:12,sm:14,base:16,lg:18,xl:20,xxl:24},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:16,normal:20,relaxed:24}}};var qo=(0,so.createContext)(Tt),Gs=(M,T)=>({colors:{...M.colors,...T.colors},spacing:{...M.spacing,...T.spacing},borderRadius:{...M.borderRadius,...T.borderRadius},typography:{...M.typography,...T.typography}}),fs=({children:M,theme:T})=>{let C=(0,so.useMemo)(()=>T?Gs(Tt,T):Tt,[T]);return<qo.Provider value={C}>{M}</qo.Provider>};var $=()=>{let M=(0,ys.useContext)(qo);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var _s=({name:M="George Alan",isOnline:T=!0,onBack:C=()=>{},onVideoCall:R=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=$();return<we.View style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottomWidth:1,borderBottomColor:I.colors.borderLight,backgroundColor:I.colors.background,paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,zIndex:50}}>
39
+ </ot.View>},Mt=ot.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),Ko=Ys;var we=require("react-native"),mt=require("lucide-react-native");var ys=require("react");var oo=require("react");var St={colors:{primary:"#3B82F6",secondary:"#34B7F1",background:"#FFFFFF",surface:"#F7F8FA",surfaceSecondary:"#F3F4F6",text:"#111827",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",unread:"#EBF8FF",online:"#10B981",messageBubble:{sent:"#3B82F6",received:"#E5E7EB",sentText:"#FFFFFF",receivedText:"#111827"},gray:{50:"#F9FAFB",100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",600:"#4B5563",700:"#374151",800:"#1F2937",900:"#111827"},blue:{50:"#EBF8FF",500:"#3B82F6",600:"#2563EB"},green:{500:"#10B981"}},spacing:{xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},borderRadius:{sm:4,md:8,lg:12,xl:16,full:9999},typography:{fontFamily:"System",fontSize:{xs:12,sm:14,base:16,lg:18,xl:20,xxl:24},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:16,normal:20,relaxed:24}}};var qo=(0,oo.createContext)(St),Gs=(M,T)=>({colors:{...M.colors,...T.colors},spacing:{...M.spacing,...T.spacing},borderRadius:{...M.borderRadius,...T.borderRadius},typography:{...M.typography,...T.typography}}),fs=({children:M,theme:T})=>{let C=(0,oo.useMemo)(()=>T?Gs(St,T):St,[T]);return<qo.Provider value={C}>{M}</qo.Provider>};var $=()=>{let M=(0,ys.useContext)(qo);if(!M)throw new Error("useTheme must be used within a ThemeProvider");return M};var _s=({name:M="George Alan",isOnline:T=!0,onBack:C=()=>{},onVideoCall:R=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=$();return<we.View style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottomWidth:1,borderBottomColor:I.colors.borderLight,backgroundColor:I.colors.background,paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,zIndex:50}}>
40
40
  <we.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
41
41
  <we.TouchableOpacity onPress={C}style={{marginRight:I.spacing.md}}>
42
42
  <mt.ArrowLeft size={24}color={I.colors.gray[700]}/>
@@ -76,7 +76,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
76
76
  <mt.Info size={24}color={I.colors.gray[700]}/>
77
77
  </we.TouchableOpacity>}
78
78
  </we.View>
79
- </we.View>},ro=_s;var Ts=require("react"),Te=require("react-native");var St=Q(require("dayjs")),xs=Q(require("dayjs/plugin/isToday")),bs=Q(require("dayjs/plugin/isYesterday"));St.default.extend(xs.default);St.default.extend(bs.default);var Js=M=>{let T=(0,St.default)(M);return T.isToday()?"Today":T.isYesterday()?"Yesterday":T.format("ddd D MMMM")},Xs=M=>(0,St.default)(M).format("YYYY-MM-DD"),Ms=M=>{if(M.length===0)return[];let T=[],C=null;return M.forEach((R,S)=>{let A=Xs(R.timestamp);if(C!==A){let P=Js(R.timestamp),B={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};T.push(B),C=A}let I={...R,listItemType:"message"};T.push(I)}),T},$o=M=>(0,St.default)(M).format("HH:mm");var Je=require("react-native");var Qs=({replyTo:M,isMyMessage:T})=>{let C=$(),R=(j,v=50)=>j.length<=v?j:j.substring(0,v)+"...",S=T?"rgba(255, 255, 255, 0.3)":C.colors.primary,A=T?"rgba(255, 255, 255, 0.8)":C.colors.primary,I=T?"rgba(255, 255, 255, 0.7)":C.colors.textSecondary,P=T?"rgba(255, 255, 255, 0.1)":C.colors.surfaceSecondary,B=M.type==="image"&&M.imageData;return<Je.View style={{marginBottom:C.spacing.sm,borderRadius:C.borderRadius.md,padding:C.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
79
+ </we.View>},so=_s;var Ts=require("react"),Te=require("react-native");var wt=Q(require("dayjs")),xs=Q(require("dayjs/plugin/isToday")),bs=Q(require("dayjs/plugin/isYesterday"));wt.default.extend(xs.default);wt.default.extend(bs.default);var Js=M=>{let T=(0,wt.default)(M);return T.isToday()?"Today":T.isYesterday()?"Yesterday":T.format("ddd D MMMM")},Xs=M=>(0,wt.default)(M).format("YYYY-MM-DD"),Ms=M=>{if(M.length===0)return[];let T=[],C=null;return M.forEach((R,S)=>{let A=Xs(R.timestamp);if(C!==A){let P=Js(R.timestamp),B={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};T.push(B),C=A}let I={...R,listItemType:"message"};T.push(I)}),T},$o=M=>(0,wt.default)(M).format("HH:mm");var Je=require("react-native");var Qs=({replyTo:M,isMyMessage:T})=>{let C=$(),R=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=T?"rgba(255, 255, 255, 0.3)":C.colors.primary,A=T?"rgba(255, 255, 255, 0.8)":C.colors.primary,I=T?"rgba(255, 255, 255, 0.7)":C.colors.textSecondary,P=T?"rgba(255, 255, 255, 0.1)":C.colors.surfaceSecondary,B=M.type==="image"&&M.imageData;return<Je.View style={{marginBottom:C.spacing.sm,borderRadius:C.borderRadius.md,padding:C.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
80
80
  <Je.Text style={{fontSize:C.typography.fontSize.xs,fontWeight:C.typography.fontWeight.medium,color:A,marginBottom:C.spacing.xs}}>
81
81
  {M.isMe?"You":M.senderName||"Sender"}
82
82
  </Je.Text>
@@ -94,7 +94,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
94
94
  </Je.View>:<Je.Text style={{fontSize:C.typography.fontSize.sm,color:I,lineHeight:C.typography.lineHeight.tight}}>
95
95
  {R(M.text)}
96
96
  </Je.Text>}
97
- </Je.View>},It=Qs;var at=require("react"),Re=require("react-native");var{width:Yo,height:Cs}=Re.Dimensions.get("window"),Zs=({imageData:M,isMe:T,onImagePress:C,onLongPress:R})=>{let S=$(),[A,I]=(0,at.useState)(!1),[P,B]=(0,at.useState)(!1),v=(0,at.useCallback)(()=>{let O=Yo*.6,F=300;if(!M.width||!M.height)return{width:O,height:F};let H=M.width/M.height,N=O,E=N/H;return E>F&&(E=F,N=E*H),{width:Math.round(N),height:Math.round(E)}},[M.width,M.height])(),V=(0,at.useCallback)(()=>{C?C():I(!0)},[C]),D=(0,at.useCallback)(()=>{console.error("Failed to load image:",M.uri),B(!0)},[M.uri]),z=(0,at.useCallback)(()=>{I(!1)},[]),k=(0,at.useCallback)(()=>{if(!M.width||!M.height)return{width:Yo,height:Cs*.8};let O=M.width/M.height,F=Yo*.9,H=Cs*.8,N=F,E=N/O;return E>H&&(E=H,N=E*O),{width:Math.round(N),height:Math.round(E)}},[M.width,M.height])();return P?<Re.View style={[gt.errorContainer,{width:v.width,height:v.height,backgroundColor:T?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
97
+ </Je.View>},It=Qs;var at=require("react"),Re=require("react-native");var{width:Yo,height:Cs}=Re.Dimensions.get("window"),Zs=({imageData:M,isMe:T,onImagePress:C,onLongPress:R})=>{let S=$(),[A,I]=(0,at.useState)(!1),[P,B]=(0,at.useState)(!1),v=(0,at.useCallback)(()=>{let O=Yo*.6,F=300;if(!M.width||!M.height)return{width:O,height:F};let H=M.width/M.height,N=O,j=N/H;return j>F&&(j=F,N=j*H),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])(),V=(0,at.useCallback)(()=>{C?C():I(!0)},[C]),D=(0,at.useCallback)(()=>{console.error("Failed to load image:",M.uri),B(!0)},[M.uri]),z=(0,at.useCallback)(()=>{I(!1)},[]),k=(0,at.useCallback)(()=>{if(!M.width||!M.height)return{width:Yo,height:Cs*.8};let O=M.width/M.height,F=Yo*.9,H=Cs*.8,N=F,j=N/O;return j>H&&(j=H,N=j*O),{width:Math.round(N),height:Math.round(j)}},[M.width,M.height])();return P?<Re.View style={[gt.errorContainer,{width:v.width,height:v.height,backgroundColor:T?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
98
98
  <Re.Text style={[gt.errorText,{color:T?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
99
99
  Failed to load image
100
100
  </Re.Text>
@@ -130,7 +130,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
130
130
  {T}
131
131
  </st.Text>
132
132
  </st.View>
133
- </st.View>},vt=st.StyleSheet.create({container:{marginVertical:4,marginHorizontal:15},messageBubble:{borderRadius:18,paddingHorizontal:16,paddingVertical:12,borderWidth:1,borderStyle:"dashed"},content:{flexDirection:"row",alignItems:"center",justifyContent:"center"},deletedText:{fontSize:14,fontStyle:"italic",marginLeft:8},metadata:{marginTop:4,paddingHorizontal:4},timestamp:{fontSize:11}}),Co=er;var tr=({message:M,onLongPress:T,onReactionPress:C})=>{let R=$(),S=(0,Ts.useRef)(null),A=()=>{S.current?S.current.measureInWindow((B,j,v,V)=>{let D={x:Math.round(B),y:Math.round(j),width:Math.round(v),height:Math.round(V)};T?.(M,D)}):T?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&C?.(M)},P=M.type==="image"&&M.imageData;return M.deleted?<Co isMe={M.isMe}timestamp={$o(M.timestamp)}senderName={M.senderName}/>:<Te.View style={{marginBottom:R.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:R.spacing.sm}}>
133
+ </st.View>},vt=st.StyleSheet.create({container:{marginVertical:4,marginHorizontal:15},messageBubble:{borderRadius:18,paddingHorizontal:16,paddingVertical:12,borderWidth:1,borderStyle:"dashed"},content:{flexDirection:"row",alignItems:"center",justifyContent:"center"},deletedText:{fontSize:14,fontStyle:"italic",marginLeft:8},metadata:{marginTop:4,paddingHorizontal:4},timestamp:{fontSize:11}}),Co=er;var tr=({message:M,onLongPress:T,onReactionPress:C})=>{let R=$(),S=(0,Ts.useRef)(null),A=()=>{S.current?S.current.measureInWindow((B,E,v,V)=>{let D={x:Math.round(B),y:Math.round(E),width:Math.round(v),height:Math.round(V)};T?.(M,D)}):T?.(M)},I=()=>{M.reactions&&M.reactions.length>0&&C?.(M)},P=M.type==="image"&&M.imageData;return M.deleted?<Co isMe={M.isMe}timestamp={$o(M.timestamp)}senderName={M.senderName}/>:<Te.View style={{marginBottom:R.spacing.md,alignItems:M.isMe?"flex-end":"flex-start",marginHorizontal:R.spacing.sm}}>
134
134
  <Te.Pressable ref={S}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?R.borderRadius.lg:R.borderRadius.xl,borderBottomRightRadius:M.isMe?4:P?R.borderRadius.lg:R.borderRadius.xl,borderBottomLeftRadius:M.isMe?P?R.borderRadius.lg:R.borderRadius.xl:4,paddingHorizontal:P?0:R.spacing.lg,paddingVertical:P?0:R.spacing.md,backgroundColor:P?"transparent":M.isMe?R.colors.messageBubble.sent:R.colors.messageBubble.received,overflow:"hidden"}}>
135
135
  {M.replyTo&&<It replyTo={M.replyTo}isMyMessage={M.isMe}/>}
136
136
 
@@ -148,7 +148,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
148
148
 
149
149
  {}
150
150
  {M.reactions&&M.reactions.length>0&&<Te.TouchableOpacity onPress={I}style={{marginTop:R.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:R.colors.background,borderRadius:R.borderRadius.full,justifyContent:M.isMe?"flex-end":"flex-start"}}>
151
- {M.reactions.map((B,j)=><Te.View key={`${B.emoji}-${j}`}style={{flexDirection:"row",alignItems:"center",padding:R.spacing.xs}}>
151
+ {M.reactions.map((B,E)=><Te.View key={`${B.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:R.spacing.xs}}>
152
152
  <Te.Text style={{fontSize:R.typography.fontSize.sm}}>
153
153
  {B.emoji}
154
154
  </Te.Text>
@@ -219,7 +219,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
219
219
  </Z.View>},Wt=or;var ze=require("react"),W=require("react-native"),pt=require("lucide-react-native");var To=require("react"),ws=Q(require("rn-emoji-keyboard")),sr=({visible:M,onClose:T,onEmojiSelected:C})=>{let[R,S]=(0,To.useState)(!1);(0,To.useEffect)(()=>{S(!!M)},[M]);let A=P=>{console.log("Selected emoji:",P),C(P.emoji),S(!1),T()},I=()=>{S(!1),T()};return M?<ws.default onEmojiSelected={A}open={R}onClose={I}enableSearchBar/>:null},Pt=sr;var Mr=({visible:M,onPress:T,children:C})=>M?<W.View style={Ae.overlay}>
220
220
  <W.TouchableOpacity style={Ae.backdrop}onPress={T}activeOpacity={1}/>
221
221
  {C}
222
- </W.View>:null,{width:At,height:Go}=W.Dimensions.get("window"),Cr=({message:M,positions:T,messagePosition:C,containerRef:R,containerOffset:S,setContainerOffset:A})=>{let I=$(),P=(0,ze.useRef)(new W.Animated.Value(C.y)).current,B=(0,ze.useRef)(new W.Animated.Value(0)).current,j=(0,ze.useRef)(!1),v=M.type==="image"&&M.imageData;return(0,ze.useEffect)(()=>{j.current=!1,R.current&&R.current.measureInWindow((V,D,z,L)=>{A({x:V,y:D});let k=C.y-D,O=T.messagePreviewTop-D;P.setValue(k),B.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(B,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{j.current=!0})})})},[T.messagePreviewTop,C.y,R]),<W.Animated.View style={{position:"absolute",top:P,left:C.x,width:C.width,height:M.replyTo?C.height+10:C.height,zIndex:1e3,opacity:B,maxWidth:v?"75%":"80%",borderRadius:v?I.borderRadius.lg:I.borderRadius.xl,paddingHorizontal:v?0:I.spacing.lg,paddingVertical:v?0:I.spacing.md,backgroundColor:v?"transparent":M.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
222
+ </W.View>:null,{width:At,height:Go}=W.Dimensions.get("window"),Cr=({message:M,positions:T,messagePosition:C,containerRef:R,containerOffset:S,setContainerOffset:A})=>{let I=$(),P=(0,ze.useRef)(new W.Animated.Value(C.y)).current,B=(0,ze.useRef)(new W.Animated.Value(0)).current,E=(0,ze.useRef)(!1),v=M.type==="image"&&M.imageData;return(0,ze.useEffect)(()=>{E.current=!1,R.current&&R.current.measureInWindow((V,D,z,L)=>{A({x:V,y:D});let k=C.y-D,O=T.messagePreviewTop-D;P.setValue(k),B.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(B,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[T.messagePreviewTop,C.y,R]),<W.Animated.View style={{position:"absolute",top:P,left:C.x,width:C.width,height:M.replyTo?C.height+10:C.height,zIndex:1e3,opacity:B,maxWidth:v?"75%":"80%",borderRadius:v?I.borderRadius.lg:I.borderRadius.xl,paddingHorizontal:v?0:I.spacing.lg,paddingVertical:v?0:I.spacing.md,backgroundColor:v?"transparent":M.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
223
223
  {M.replyTo&&<It replyTo={M.replyTo}isMyMessage={M.isMe}/>}
224
224
 
225
225
  {v?<W.View>
@@ -233,18 +233,18 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
233
233
  </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:M.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
234
  {M.text}
235
235
  </W.Text>}
236
- </W.Animated.View>},Rr=({visible:M,onClose:T,isMyMessage:C,selectedMessage:R,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let[P,B]=(0,ze.useState)(!1),j=(0,ze.useRef)(null),[v,V]=(0,ze.useState)({x:0,y:0}),D=(0,ze.useRef)(new W.Animated.Value(0)).current,z=(0,ze.useRef)(new W.Animated.Value(0)).current,L=(0,ze.useRef)(!1),k=(0,ze.useRef)(!1),O=Me=>{A(Me),T()},F=Me=>{I?.(Me),T()},H=()=>{B(!0)},N=()=>{B(!1)},E=Me=>{I?.(Me),B(!1),T()},oe=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],J=(()=>{if(!S)return{emojiBar:{top:Go/2-200,left:At/2-160},actionMenu:{top:Go/2+50,left:At/2-100}};let Me=320,je=60,Ke=200,Be=160,Ce=20,U=8,Oe,Ze,Ge,Ve,qe,et=Go/2,Se=je+U+S.height+U+Be,ct=et-Se/2;return Ze=ct,qe=ct+je+U,Ve=ct+je+U+S.height+U,Oe=S.x,Ge=S.x,Oe+Me>At-Ce&&(Oe=At-Me-Ce),Oe<Ce&&(Oe=Ce),Ge+Ke>At-Ce&&(Ge=At-Ke-Ce),Ge<Ce&&(Ge=Ce),{emojiBar:{top:Ze,left:Oe},actionMenu:{top:Ve,left:Ge},messagePreviewTop:qe,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,ze.useEffect)(()=>{M&&S&&!k.current&&(D.setValue(0),z.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{k.current=!0})},50))},[M,S,D,z]),(0,ze.useEffect)(()=>{M||(L.current=!1,k.current=!1,D.setValue(0),z.setValue(0))},[M,D,z]),M?<>
236
+ </W.Animated.View>},Rr=({visible:M,onClose:T,isMyMessage:C,selectedMessage:R,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let[P,B]=(0,ze.useState)(!1),E=(0,ze.useRef)(null),[v,V]=(0,ze.useState)({x:0,y:0}),D=(0,ze.useRef)(new W.Animated.Value(0)).current,z=(0,ze.useRef)(new W.Animated.Value(0)).current,L=(0,ze.useRef)(!1),k=(0,ze.useRef)(!1),O=Me=>{A(Me),T()},F=Me=>{I?.(Me),T()},H=()=>{B(!0)},N=()=>{B(!1)},j=Me=>{I?.(Me),B(!1),T()},oe=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],J=(()=>{if(!S)return{emojiBar:{top:Go/2-200,left:At/2-160},actionMenu:{top:Go/2+50,left:At/2-100}};let Me=320,je=60,Ke=200,Be=160,Ce=20,U=8,Oe,Ze,Ge,Ve,qe,et=Go/2,Se=je+U+S.height+U+Be,ct=et-Se/2;return Ze=ct,qe=ct+je+U,Ve=ct+je+U+S.height+U,Oe=S.x,Ge=S.x,Oe+Me>At-Ce&&(Oe=At-Me-Ce),Oe<Ce&&(Oe=Ce),Ge+Ke>At-Ce&&(Ge=At-Ke-Ce),Ge<Ce&&(Ge=Ce),{emojiBar:{top:Ze,left:Oe},actionMenu:{top:Ve,left:Ge},messagePreviewTop:qe,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,ze.useEffect)(()=>{M&&S&&!k.current&&(D.setValue(0),z.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{k.current=!0})},50))},[M,S,D,z]),(0,ze.useEffect)(()=>{M||(L.current=!1,k.current=!1,D.setValue(0),z.setValue(0))},[M,D,z]),M?<>
237
237
  {}
238
238
  <Mr visible={!0}onPress={T}>
239
239
  <W.Pressable style={Ae.overlayPressable}onPress={T}/>
240
240
  </Mr>
241
241
 
242
- <W.View ref={j}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
242
+ <W.View ref={E}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
243
243
  {}
244
244
  </W.View>
245
245
 
246
246
  {}
247
- {S&&R&&<Cr message={R}positions={J}messagePosition={S}containerRef={j}containerOffset={v}setContainerOffset={V}/>}
247
+ {S&&R&&<Cr message={R}positions={J}messagePosition={S}containerRef={E}containerOffset={v}setContainerOffset={V}/>}
248
248
 
249
249
  {}
250
250
  <W.Animated.View style={[Ae.emojiBar,{position:"absolute",top:J.emojiBar.top-(v.y||0),left:J.emojiBar.left,opacity:D,pointerEvents:"auto"}]}>
@@ -284,8 +284,8 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
284
284
  </W.Animated.View>
285
285
 
286
286
  {}
287
- <Pt visible={P}onClose={N}onEmojiSelected={E}/>
288
- </>:null},Ae=W.StyleSheet.create({spotlightOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},overlayPressable:{flex:1,backgroundColor:"transparent"},emojiBar:{backgroundColor:"white",borderRadius:25,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,maxWidth:320},emojiContainer:{flexDirection:"row",alignItems:"center",paddingHorizontal:4},emojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},emojiText:{fontSize:18},addEmojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},actionMenu:{backgroundColor:"white",borderRadius:12,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,minWidth:160,maxWidth:200},actionItems:{paddingVertical:4},actionRow:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,minHeight:44},actionLabel:{fontSize:15,color:"#333",marginLeft:12,fontWeight:"500"},hiddenEmojiInput:{position:"absolute",left:-9999,opacity:0,height:0,width:0},overlay:{...W.StyleSheet.absoluteFillObject,zIndex:1e3},backdrop:{...W.StyleSheet.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),So=Rr;var zt=require("react"),_=require("react-native"),Is=Q(require("react-native-actions-sheet"));var Tr=({visible:M,onClose:T,reactions:C,messageText:R,onAddReaction:S,onRemoveReaction:A})=>{let I=(0,zt.useRef)(null),[P,B]=(0,zt.useState)(!1);(0,zt.useEffect)(()=>{M?I.current?.show():I.current?.hide()},[M]);let v=(()=>{let F=[];return C.forEach(H=>{let N=[{id:"1",name:"You",avatar:"\u{1F464}"},{id:"2",name:"Anna",avatar:"\u{1F469}"},{id:"3",name:"Young Beetle",avatar:"\u{1F697}"},{id:"4",name:"Lele",avatar:"\u{1F3AD}"},{id:"5",name:"Needle",avatar:"\u{1F3E0}"}];for(let E=0;E<Math.min(H.count,N.length);E++)F.push({id:`${H.emoji}-${E}`,name:N[E].name,avatar:N[E].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),F})(),V=C.reduce((F,H)=>F+H.count,0),D=F=>{console.log("Remove reaction called with:",F),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",F.name==="You"),F.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",F.emoji),A(F.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:F.name==="You",hasCallback:!!A})},z=()=>{I.current?.hide(),T(),setTimeout(()=>{B(!0)},300)},L=()=>{B(!1)},k=F=>{console.log("Selected emoji from picker:",F),S?.(F),B(!1),T()},O=()=>{I.current?.hide(),T()};return<>
287
+ <Pt visible={P}onClose={N}onEmojiSelected={j}/>
288
+ </>:null},Ae=W.StyleSheet.create({spotlightOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0},overlayPressable:{flex:1,backgroundColor:"transparent"},emojiBar:{backgroundColor:"white",borderRadius:25,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,maxWidth:320},emojiContainer:{flexDirection:"row",alignItems:"center",paddingHorizontal:4},emojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},emojiText:{fontSize:18},addEmojiButton:{width:36,height:36,borderRadius:18,backgroundColor:"#f8f9fa",justifyContent:"center",alignItems:"center",marginHorizontal:3},actionMenu:{backgroundColor:"white",borderRadius:12,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.25,shadowRadius:12,elevation:12,zIndex:1001,minWidth:160,maxWidth:200},actionItems:{paddingVertical:4},actionRow:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,minHeight:44},actionLabel:{fontSize:15,color:"#333",marginLeft:12,fontWeight:"500"},hiddenEmojiInput:{position:"absolute",left:-9999,opacity:0,height:0,width:0},overlay:{...W.StyleSheet.absoluteFillObject,zIndex:1e3},backdrop:{...W.StyleSheet.absoluteFillObject,backgroundColor:"rgba(0, 0, 0, 0.8)"}}),So=Rr;var zt=require("react"),_=require("react-native"),Is=Q(require("react-native-actions-sheet"));var Tr=({visible:M,onClose:T,reactions:C,messageText:R,onAddReaction:S,onRemoveReaction:A})=>{let I=(0,zt.useRef)(null),[P,B]=(0,zt.useState)(!1);(0,zt.useEffect)(()=>{M?I.current?.show():I.current?.hide()},[M]);let v=(()=>{let F=[];return C.forEach(H=>{let N=[{id:"1",name:"You",avatar:"\u{1F464}"},{id:"2",name:"Anna",avatar:"\u{1F469}"},{id:"3",name:"Young Beetle",avatar:"\u{1F697}"},{id:"4",name:"Lele",avatar:"\u{1F3AD}"},{id:"5",name:"Needle",avatar:"\u{1F3E0}"}];for(let j=0;j<Math.min(H.count,N.length);j++)F.push({id:`${H.emoji}-${j}`,name:N[j].name,avatar:N[j].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),F})(),V=C.reduce((F,H)=>F+H.count,0),D=F=>{console.log("Remove reaction called with:",F),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",F.name==="You"),F.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",F.emoji),A(F.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:F.name==="You",hasCallback:!!A})},z=()=>{I.current?.hide(),T(),setTimeout(()=>{B(!0)},300)},L=()=>{B(!1)},k=F=>{console.log("Selected emoji from picker:",F),S?.(F),B(!1),T()},O=()=>{I.current?.hide(),T()};return<>
289
289
  <Is.default ref={I}onClose={O}containerStyle={ee.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
290
290
  {}
291
291
  <_.View style={ee.header}>
@@ -331,7 +331,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
331
331
 
332
332
  {}
333
333
  <Pt visible={P}onClose={L}onEmojiSelected={k}/>
334
- </>},ee=_.StyleSheet.create({container:{backgroundColor:"white",borderTopLeftRadius:20,borderTopRightRadius:20,paddingTop:20,paddingBottom:40,maxHeight:"70%"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:20,paddingBottom:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},title:{fontSize:18,fontWeight:"600",color:"#333"},closeButton:{padding:5},closeText:{fontSize:18,color:"#666",fontWeight:"500"},messagePreview:{paddingHorizontal:20,paddingVertical:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},messageText:{fontSize:14,color:"#666",lineHeight:20},reactionButtons:{flexDirection:"row",paddingHorizontal:20,paddingVertical:15,gap:10},addReactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#f8f9fa",borderWidth:1,borderColor:"#e9ecef",borderRadius:20,paddingHorizontal:12,paddingVertical:8},addReactionIcon:{fontSize:16,marginRight:4},addReactionText:{fontSize:14,color:"#666",fontWeight:"500"},reactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#28a745",borderRadius:20,paddingHorizontal:12,paddingVertical:8},reactionEmoji:{fontSize:16,marginRight:4},reactionCount:{fontSize:14,color:"white",fontWeight:"600"},userReactionsList:{paddingHorizontal:20,paddingTop:10},userReactionItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"#f8f9fa"},tappableUserReactionItem:{backgroundColor:"#f8f9fa",borderRadius:8,paddingHorizontal:8,marginVertical:2},userInfo:{flexDirection:"row",alignItems:"center",flex:1},userAvatar:{fontSize:24,marginRight:12},userDetails:{flex:1},userName:{fontSize:16,fontWeight:"500",color:"#333"},removeText:{fontSize:12,color:"#dc3545",marginTop:2,fontWeight:"500"},userReactionEmoji:{backgroundColor:"#f8f9fa",borderRadius:16,paddingHorizontal:8,paddingVertical:4},emojiText:{fontSize:16}}),Io=Tr;var Bt=Q(require("react")),Xe=require("react-native"),vs=Q(require("react-native-actions-sheet")),Ps=require("lucide-react-native"),Mt=(0,Bt.forwardRef)(({onOptionSelect:M,options:T},C)=>{let R=Bt.default.useRef(null);(0,Bt.useImperativeHandle)(C,()=>({show:()=>R.current?.show(),hide:()=>R.current?.hide()}));let S=A=>{M(A),R.current?.hide()};return<vs.default ref={R}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
334
+ </>},ee=_.StyleSheet.create({container:{backgroundColor:"white",borderTopLeftRadius:20,borderTopRightRadius:20,paddingTop:20,paddingBottom:40,maxHeight:"70%"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingHorizontal:20,paddingBottom:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},title:{fontSize:18,fontWeight:"600",color:"#333"},closeButton:{padding:5},closeText:{fontSize:18,color:"#666",fontWeight:"500"},messagePreview:{paddingHorizontal:20,paddingVertical:15,borderBottomWidth:1,borderBottomColor:"#f0f0f0"},messageText:{fontSize:14,color:"#666",lineHeight:20},reactionButtons:{flexDirection:"row",paddingHorizontal:20,paddingVertical:15,gap:10},addReactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#f8f9fa",borderWidth:1,borderColor:"#e9ecef",borderRadius:20,paddingHorizontal:12,paddingVertical:8},addReactionIcon:{fontSize:16,marginRight:4},addReactionText:{fontSize:14,color:"#666",fontWeight:"500"},reactionButton:{flexDirection:"row",alignItems:"center",backgroundColor:"#28a745",borderRadius:20,paddingHorizontal:12,paddingVertical:8},reactionEmoji:{fontSize:16,marginRight:4},reactionCount:{fontSize:14,color:"white",fontWeight:"600"},userReactionsList:{paddingHorizontal:20,paddingTop:10},userReactionItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"#f8f9fa"},tappableUserReactionItem:{backgroundColor:"#f8f9fa",borderRadius:8,paddingHorizontal:8,marginVertical:2},userInfo:{flexDirection:"row",alignItems:"center",flex:1},userAvatar:{fontSize:24,marginRight:12},userDetails:{flex:1},userName:{fontSize:16,fontWeight:"500",color:"#333"},removeText:{fontSize:12,color:"#dc3545",marginTop:2,fontWeight:"500"},userReactionEmoji:{backgroundColor:"#f8f9fa",borderRadius:16,paddingHorizontal:8,paddingVertical:4},emojiText:{fontSize:16}}),Io=Tr;var Bt=Q(require("react")),Xe=require("react-native"),vs=Q(require("react-native-actions-sheet")),Ps=require("lucide-react-native"),Ct=(0,Bt.forwardRef)(({onOptionSelect:M,options:T},C)=>{let R=Bt.default.useRef(null);(0,Bt.useImperativeHandle)(C,()=>({show:()=>R.current?.show(),hide:()=>R.current?.hide()}));let S=A=>{M(A),R.current?.hide()};return<vs.default ref={R}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
335
335
  <Xe.View style={{padding:20,width:"100%"}}>
336
336
 
337
337
  {}
@@ -356,7 +356,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
356
356
  </Xe.TouchableOpacity>})}
357
357
  </Xe.View>
358
358
  </Xe.View>
359
- </vs.default>});Mt.displayName="AttachmentMenu";var vo=require("react"),De=require("react-native"),Sr=({isVisible:M})=>{let T=(0,vo.useRef)(new De.Animated.Value(0)).current;return(0,vo.useEffect)(()=>{if(!M){T.setValue(0);return}let C=De.Animated.loop(De.Animated.sequence([De.Animated.timing(T,{toValue:1,duration:1200,useNativeDriver:!0}),De.Animated.timing(T,{toValue:0,duration:1200,useNativeDriver:!0})]));return C.start(),()=>{C.stop()}},[M,T]),M?<De.View style={Vt.container}>
359
+ </vs.default>});Ct.displayName="AttachmentMenu";var vo=require("react"),De=require("react-native"),Sr=({isVisible:M})=>{let T=(0,vo.useRef)(new De.Animated.Value(0)).current;return(0,vo.useEffect)(()=>{if(!M){T.setValue(0);return}let C=De.Animated.loop(De.Animated.sequence([De.Animated.timing(T,{toValue:1,duration:1200,useNativeDriver:!0}),De.Animated.timing(T,{toValue:0,duration:1200,useNativeDriver:!0})]));return C.start(),()=>{C.stop()}},[M,T]),M?<De.View style={Vt.container}>
360
360
  <De.View style={Vt.bubble}>
361
361
  <De.View style={Vt.dotsContainer}>
362
362
  <De.Animated.View style={[Vt.dot,{opacity:T.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:T.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
@@ -374,7 +374,7 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
374
374
  {M}
375
375
  </Ut.Text>
376
376
  </Ut.View>
377
- </Ut.View>},Bo=Ir;var He=Q(require("react")),Ye=require("react-native"),Lt=require("lucide-react-native");var Qe=require("react"),te=require("react-native"),ke=require("lucide-react-native");var vr={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},_o=async(M,T={})=>{try{let C;try{C=await import("expo-image-manipulator")}catch(V){console.log("expo-image-manipulator not available, returning original image info:",V);let z=`image_${Date.now()}.jpg`;return{uri:M,width:1920,height:1920,fileName:z}}let R={...vr,...T};console.log("Starting image compression...",{uri:M,options:R});let S=await C.manipulateAsync(M,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(R.maxWidth||R.maxHeight){let{width:V,height:D}=S,z=V,L=D;if(R.maxWidth&&V>R.maxWidth){let k=R.maxWidth/V;z=R.maxWidth,L=D*k}if(R.maxHeight&&L>R.maxHeight){let k=R.maxHeight/L;L=R.maxHeight,z=z*k}(z!==V||L!==D)&&(A.push({resize:{width:Math.round(z),height:Math.round(L)}}),console.log("Resizing image:",{from:{width:V,height:D},to:{width:Math.round(z),height:Math.round(L)}}))}let I={compress:R.quality,format:R.format==="png"?C.SaveFormat?.PNG:C.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await C.manipulateAsync(M,A,I);console.log("Image compression completed:",{originalUri:M,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let B=Date.now(),j=R.format==="png"?"png":"jpg",v=`compressed_image_${B}.${j}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(C){console.error("Error compressing image:",C);let R=C instanceof Error?C.message:"Unknown error";throw new Error(`Failed to compress image: ${R}`)}},Jo=(M,T)=>M>3e3||T>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:M>1920||T>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Pr=[{id:"photo",label:"Photo",icon:ke.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:ke.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:ke.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:ke.User,color:"#6B7280"},{id:"document",label:"Document",icon:ke.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:ke.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:ke.Calendar,color:"#EF4444"}],Vo=M=>{let T=(0,Qe.useRef)(null),C=(0,Qe.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),te.Alert.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:V}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching image picker...");let D=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo selected successfully:",z.uri);try{console.log("Starting image compression...");let L=Jo(z.width||1920,z.height||1920),k=await _o(z.uri,L);console.log("Image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Image compression failed:",L),te.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),te.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),R=(0,Qe.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),te.Alert.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:V}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching camera...");let D=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo captured successfully:",z.uri);try{console.log("Starting camera image compression...");let L=Jo(z.width||1920,z.height||1920),k=await _o(z.uri,L);console.log("Camera image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Camera image compression failed:",L),te.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),te.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),S=(0,Qe.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(k){console.log("expo-location not available:",k),te.Alert.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:V}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let D=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let z=await v.reverseGeocodeAsync({latitude:D.coords.latitude,longitude:D.coords.longitude}),L={coordinates:{latitude:D.coords.latitude,longitude:D.coords.longitude},address:z[0]||null,timestamp:D.timestamp};console.log("Location shared successfully:",L.coordinates),M?.({type:"location",data:L})}catch(v){console.error("Error in location sharing process:",v),te.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),A=(0,Qe.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(D){console.log("expo-contacts not available:",D),te.Alert.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:V}=await v.requestPermissionsAsync();if(V!=="granted"){te.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}te.Alert.alert("Contact Sharing","Contact selection feature is coming soon! This would open a contact picker.",[{text:"OK",onPress:()=>console.log("Contact sharing acknowledged")}])}catch(v){console.error("Error accessing contacts:",v),te.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{T.current?.hide()}},[]),I=(0,Qe.useCallback)(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(D){console.log("expo-document-picker not available:",D),te.Alert.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching document picker...");let V=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",V),!V.canceled&&V.assets&&V.assets.length>0){let D=V.assets[0];console.log("Document selected successfully:",D.name),M?.({type:"document",data:{uri:D.uri,name:D.name,size:D.size,mimeType:D.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),te.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),P=(0,Qe.useCallback)(()=>{te.Alert.alert("Create Poll","Poll creation feature is coming soon! This would open a poll creation interface.",[{text:"OK",onPress:()=>console.log("Poll creation acknowledged")}])},[]),B=(0,Qe.useCallback)(()=>{te.Alert.alert("Create Event","Event creation feature is coming soon! This would open an event creation interface.",[{text:"OK",onPress:()=>console.log("Event creation acknowledged")}])},[]),j=(0,Qe.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await C();break;case"camera":await R();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":B();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(V){console.error(`Error handling ${v}:`,V),te.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[C,R,S,A,I,P,B]);return{menuRef:T,handleOptionSelect:j,options:Pr}};var Y=Q(require("react")),Kt=(M={})=>{let{initialValue:T="",initialHeight:C=50,onValueChange:R,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:B,onBlur:j,maxHeight:v=100,minHeight:V=50,maxLength:D=1e3,placeholder:z="Type a message..."}=M,L=(0,Y.useRef)(null),[k,O]=Y.default.useState(T),[F,H]=Y.default.useState(C),[N,E]=Y.default.useState(!1),[oe,Ee]=Y.default.useState(null),[J,Me]=Y.default.useState([]),je=Y.default.useMemo(()=>({value:k,height:F,isFocused:N,replyToMessage:oe,attachments:J}),[k,F,N,oe,J]),Ke=(0,Y.useCallback)(Pe=>{O(Pe),R?.(Pe)},[R]),Be=(0,Y.useCallback)(Pe=>{let Fe=Math.max(V,Math.min(v,Pe));H(Fe),S?.(Fe)},[V,v,S]),Ce=(0,Y.useCallback)(()=>{E(!0),B?.()},[B]),U=(0,Y.useCallback)(()=>{E(!1),j?.()},[j]),Oe=(0,Y.useCallback)(Pe=>{let{height:Fe}=Pe.nativeEvent.contentSize,Ft=Math.max(V,Math.min(v,Fe+16));Be(Ft)},[V,v,Be]),Ze=(0,Y.useCallback)(()=>{A&&(k||J.length>0)&&(A(k,J,oe),O(T),Me([]),Ee(null),H(C))},[A,k,J,oe,T,C]),Ge=(0,Y.useCallback)(Pe=>{I?(I(Pe,k),k&&O(T)):Me(Fe=>[...Fe,{...Pe,id:Date.now().toString()}])},[I,k,T]),Ve=(0,Y.useCallback)(Pe=>{Me(Fe=>[...Fe,Pe])},[]),qe=(0,Y.useCallback)(Pe=>{Me(Fe=>Fe.filter(Ft=>Ft.id!==Pe))},[]),et=(0,Y.useCallback)(()=>{Me([])},[]),Se=(0,Y.useCallback)(()=>{Ee(null),P?.()},[P]),ct=(0,Y.useCallback)(()=>{L.current?.focus()},[]),No=Y.default.useMemo(()=>({setValue:Ke,setHeight:Be,setFocus:E,setReplyToMessage:Ee,addAttachment:Ve,removeAttachment:qe,clearAttachments:et,sendMessage:Ze,cancelReply:Se,focusInput:ct,handleAttachmentSelected:Ge,handleContentSizeChange:Oe,handleFocus:Ce,handleBlur:U}),[Ke,Be,E,Ee,Ve,qe,et,Ze,Se,ct,Ge,Oe,Ce,U]),Wo=Y.default.useMemo(()=>({textInputRef:L}),[]);return{state:je,actions:No,refs:Wo}},Ha=(0,Y.createContext)(null);var dt=(0,He.forwardRef)(({value:M,onChangeText:T,onSend:C,onFocus:R,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:B},j)=>{let v=$(),V=(0,He.useRef)(null);(0,He.useImperativeHandle)(j,()=>({focus:()=>{V.current?.focus()}}));let{state:D,actions:z}=Kt({initialValue:M,initialHeight:S,onValueChange:T,onHeightChange:A,onSend:C,onAttachmentSend:B,onReplyCancel:P,onFocus:R});He.default.useEffect(()=>{M!==D.value&&z.setValue(M)},[M,D.value,z]),He.default.useEffect(()=>{S!==D.height&&z.setHeight(S)},[S,D.height,z]),He.default.useEffect(()=>{I!==D.replyToMessage&&z.setReplyToMessage(I||null)},[I,D.replyToMessage,z]),He.default.useEffect(()=>{if(I&&V.current){let O=setTimeout(()=>{V.current?.focus()},100);return()=>clearTimeout(O)}},[I]);let L=(0,He.useCallback)(O=>{if(console.log("Attachment selected:",O),B)B(O,M.trim()||void 0),M.trim()&&T("");else switch(O.type){case"image":console.log("Image attachment ready to send:",{uri:O.data.uri,dimensions:{width:O.data.width,height:O.data.height},fileName:O.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:O.data.name,size:O.data.size});break;case"location":console.log("Location attachment ready to send:",O.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",O.data);break;default:console.log("Other attachment ready to send:",O)}},[B,M,T]),k=Vo(L);return<>
377
+ </Ut.View>},Bo=Ir;var He=Q(require("react")),Ye=require("react-native"),Lt=require("lucide-react-native");var Qe=require("react"),te=require("react-native"),ke=require("lucide-react-native");var vr={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},_o=async(M,T={})=>{try{let C;try{C=await import("expo-image-manipulator")}catch(V){console.log("expo-image-manipulator not available, returning original image info:",V);let z=`image_${Date.now()}.jpg`;return{uri:M,width:1920,height:1920,fileName:z}}let R={...vr,...T};console.log("Starting image compression...",{uri:M,options:R});let S=await C.manipulateAsync(M,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(R.maxWidth||R.maxHeight){let{width:V,height:D}=S,z=V,L=D;if(R.maxWidth&&V>R.maxWidth){let k=R.maxWidth/V;z=R.maxWidth,L=D*k}if(R.maxHeight&&L>R.maxHeight){let k=R.maxHeight/L;L=R.maxHeight,z=z*k}(z!==V||L!==D)&&(A.push({resize:{width:Math.round(z),height:Math.round(L)}}),console.log("Resizing image:",{from:{width:V,height:D},to:{width:Math.round(z),height:Math.round(L)}}))}let I={compress:R.quality,format:R.format==="png"?C.SaveFormat?.PNG:C.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await C.manipulateAsync(M,A,I);console.log("Image compression completed:",{originalUri:M,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let B=Date.now(),E=R.format==="png"?"png":"jpg",v=`compressed_image_${B}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(C){console.error("Error compressing image:",C);let R=C instanceof Error?C.message:"Unknown error";throw new Error(`Failed to compress image: ${R}`)}},Jo=(M,T)=>M>3e3||T>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:M>1920||T>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Pr=[{id:"photo",label:"Photo",icon:ke.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:ke.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:ke.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:ke.User,color:"#6B7280"},{id:"document",label:"Document",icon:ke.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:ke.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:ke.Calendar,color:"#EF4444"}],Vo=M=>{let T=(0,Qe.useRef)(null),C=(0,Qe.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),te.Alert.alert("Feature Not Available","Photo selection requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting photo library permissions...");let{status:V}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching image picker...");let D=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo selected successfully:",z.uri);try{console.log("Starting image compression...");let L=Jo(z.width||1920,z.height||1920),k=await _o(z.uri,L);console.log("Image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Image compression failed:",L),te.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),te.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),R=(0,Qe.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(z){console.log("expo-image-picker not available:",z),te.Alert.alert("Feature Not Available","Camera capture requires expo-image-picker to be installed. Please install expo-image-picker to use this feature.",[{text:"OK"}]);return}console.log("Requesting camera permissions...");let{status:V}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(z=>setTimeout(()=>z(void 0),300)),console.log("Launching camera...");let D=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",D),!D.canceled&&D.assets&&D.assets.length>0){let z=D.assets[0];console.log("Photo captured successfully:",z.uri);try{console.log("Starting camera image compression...");let L=Jo(z.width||1920,z.height||1920),k=await _o(z.uri,L);console.log("Camera image compression completed:",k),M?.({type:"image",data:{...k,originalFileSize:z.fileSize}})}catch(L){console.error("Camera image compression failed:",L),te.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),M?.({type:"image",data:{uri:z.uri,width:z.width,height:z.height,fileSize:z.fileSize,fileName:z.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),te.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),S=(0,Qe.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(k){console.log("expo-location not available:",k),te.Alert.alert("Feature Not Available","Location sharing requires expo-location to be installed. Please install expo-location to use this feature.",[{text:"OK"}]);return}console.log("Requesting location permissions...");let{status:V}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",V),V!=="granted"){te.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let D=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let z=await v.reverseGeocodeAsync({latitude:D.coords.latitude,longitude:D.coords.longitude}),L={coordinates:{latitude:D.coords.latitude,longitude:D.coords.longitude},address:z[0]||null,timestamp:D.timestamp};console.log("Location shared successfully:",L.coordinates),M?.({type:"location",data:L})}catch(v){console.error("Error in location sharing process:",v),te.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[M]),A=(0,Qe.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(D){console.log("expo-contacts not available:",D),te.Alert.alert("Feature Not Available","Contact sharing requires expo-contacts to be installed. Please install expo-contacts to use this feature.",[{text:"OK"}]);return}let{status:V}=await v.requestPermissionsAsync();if(V!=="granted"){te.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}te.Alert.alert("Contact Sharing","Contact selection feature is coming soon! This would open a contact picker.",[{text:"OK",onPress:()=>console.log("Contact sharing acknowledged")}])}catch(v){console.error("Error accessing contacts:",v),te.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{T.current?.hide()}},[]),I=(0,Qe.useCallback)(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(D){console.log("expo-document-picker not available:",D),te.Alert.alert("Feature Not Available","Document selection requires expo-document-picker to be installed. Please install expo-document-picker to use this feature.",[{text:"OK"}]);return}console.log("Waiting for UI to stabilize..."),await new Promise(D=>setTimeout(()=>D(void 0),300)),console.log("Launching document picker...");let V=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",V),!V.canceled&&V.assets&&V.assets.length>0){let D=V.assets[0];console.log("Document selected successfully:",D.name),M?.({type:"document",data:{uri:D.uri,name:D.name,size:D.size,mimeType:D.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),te.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[M]),P=(0,Qe.useCallback)(()=>{te.Alert.alert("Create Poll","Poll creation feature is coming soon! This would open a poll creation interface.",[{text:"OK",onPress:()=>console.log("Poll creation acknowledged")}])},[]),B=(0,Qe.useCallback)(()=>{te.Alert.alert("Create Event","Event creation feature is coming soon! This would open an event creation interface.",[{text:"OK",onPress:()=>console.log("Event creation acknowledged")}])},[]),E=(0,Qe.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await C();break;case"camera":await R();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":B();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(V){console.error(`Error handling ${v}:`,V),te.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[C,R,S,A,I,P,B]);return{menuRef:T,handleOptionSelect:E,options:Pr}};var Y=Q(require("react")),Kt=(M={})=>{let{initialValue:T="",initialHeight:C=50,onValueChange:R,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:B,onBlur:E,maxHeight:v=100,minHeight:V=50,maxLength:D=1e3,placeholder:z="Type a message..."}=M,L=(0,Y.useRef)(null),[k,O]=Y.default.useState(T),[F,H]=Y.default.useState(C),[N,j]=Y.default.useState(!1),[oe,Ee]=Y.default.useState(null),[J,Me]=Y.default.useState([]),je=Y.default.useMemo(()=>({value:k,height:F,isFocused:N,replyToMessage:oe,attachments:J}),[k,F,N,oe,J]),Ke=(0,Y.useCallback)(Pe=>{O(Pe),R?.(Pe)},[R]),Be=(0,Y.useCallback)(Pe=>{let Fe=Math.max(V,Math.min(v,Pe));H(Fe),S?.(Fe)},[V,v,S]),Ce=(0,Y.useCallback)(()=>{j(!0),B?.()},[B]),U=(0,Y.useCallback)(()=>{j(!1),E?.()},[E]),Oe=(0,Y.useCallback)(Pe=>{let{height:Fe}=Pe.nativeEvent.contentSize,Ft=Math.max(V,Math.min(v,Fe+16));Be(Ft)},[V,v,Be]),Ze=(0,Y.useCallback)(()=>{A&&(k||J.length>0)&&(A(k,J,oe),O(T),Me([]),Ee(null),H(C))},[A,k,J,oe,T,C]),Ge=(0,Y.useCallback)(Pe=>{I?(I(Pe,k),k&&O(T)):Me(Fe=>[...Fe,{...Pe,id:Date.now().toString()}])},[I,k,T]),Ve=(0,Y.useCallback)(Pe=>{Me(Fe=>[...Fe,Pe])},[]),qe=(0,Y.useCallback)(Pe=>{Me(Fe=>Fe.filter(Ft=>Ft.id!==Pe))},[]),et=(0,Y.useCallback)(()=>{Me([])},[]),Se=(0,Y.useCallback)(()=>{Ee(null),P?.()},[P]),ct=(0,Y.useCallback)(()=>{L.current?.focus()},[]),No=Y.default.useMemo(()=>({setValue:Ke,setHeight:Be,setFocus:j,setReplyToMessage:Ee,addAttachment:Ve,removeAttachment:qe,clearAttachments:et,sendMessage:Ze,cancelReply:Se,focusInput:ct,handleAttachmentSelected:Ge,handleContentSizeChange:Oe,handleFocus:Ce,handleBlur:U}),[Ke,Be,j,Ee,Ve,qe,et,Ze,Se,ct,Ge,Oe,Ce,U]),Wo=Y.default.useMemo(()=>({textInputRef:L}),[]);return{state:je,actions:No,refs:Wo}},Ha=(0,Y.createContext)(null);var dt=(0,He.forwardRef)(({value:M,onChangeText:T,onSend:C,onFocus:R,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:B},E)=>{let v=$(),V=(0,He.useRef)(null);(0,He.useImperativeHandle)(E,()=>({focus:()=>{V.current?.focus()}}));let{state:D,actions:z}=Kt({initialValue:M,initialHeight:S,onValueChange:T,onHeightChange:A,onSend:C,onAttachmentSend:B,onReplyCancel:P,onFocus:R});He.default.useEffect(()=>{M!==D.value&&z.setValue(M)},[M,D.value,z]),He.default.useEffect(()=>{S!==D.height&&z.setHeight(S)},[S,D.height,z]),He.default.useEffect(()=>{I!==D.replyToMessage&&z.setReplyToMessage(I||null)},[I,D.replyToMessage,z]),He.default.useEffect(()=>{if(I&&V.current){let O=setTimeout(()=>{V.current?.focus()},100);return()=>clearTimeout(O)}},[I]);let L=(0,He.useCallback)(O=>{if(console.log("Attachment selected:",O),B)B(O,M.trim()||void 0),M.trim()&&T("");else switch(O.type){case"image":console.log("Image attachment ready to send:",{uri:O.data.uri,dimensions:{width:O.data.width,height:O.data.height},fileName:O.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:O.data.name,size:O.data.size});break;case"location":console.log("Location attachment ready to send:",O.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",O.data);break;default:console.log("Other attachment ready to send:",O)}},[B,M,T]),k=Vo(L);return<>
378
378
  {I&&P&&<Wt replyToMessage={I}onCancel={P}/>}
379
379
  <Ye.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
380
380
  <Ye.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
@@ -392,10 +392,10 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
392
392
  </Ye.View>
393
393
  </Ye.View>
394
394
 
395
- <Mt ref={k.menuRef}onOptionSelect={k.handleOptionSelect}options={k.options}/>
396
- </>});dt.displayName="MessageInput";var Do=require("react-native"),Xo=require("lucide-react-native");var Lo=Q(require("react"));var ht=Q(require("react"));var ko=require("react");function qt(M,T={}){let{initialNumToRender:C=20,maxToRenderPerBatch:R=10,windowSize:S=10}=T,A=(0,ko.useMemo)(()=>Ms(M).reverse(),[M]),I=(0,ko.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:C,maxToRenderPerBatch:R,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ne=require("react");function Qo(M={}){let{scrollThreshold:T=50,autoScrollToBottom:C=!0}=M,R=(0,Ne.useRef)(null),[S,A]=(0,Ne.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ne.useRef)(0),P=(0,Ne.useCallback)(L=>{let{contentOffset:k,contentSize:O,layoutMeasurement:F}=L.nativeEvent,H=k.y,N=Math.abs(H)<T,E=Math.abs(H)>O.height-F.height-T;A({isNearBottom:N,isNearTop:E,showScrollToBottomButton:!N})},[T]),B=(0,Ne.useCallback)(L=>{let k=L>I.current;return I.current=L,k},[]),j=(0,Ne.useCallback)(()=>{},[]),v=(0,Ne.useCallback)((L=!0)=>{R.current&&R.current.scrollToOffset({offset:0,animated:L})},[]),V=(0,Ne.useCallback)((L,k=!0)=>{R.current&&R.current.scrollToOffset({offset:L,animated:k})},[]),D=(0,Ne.useCallback)((L,k=!0)=>{R.current&&R.current.scrollToIndex({index:L,animated:k})},[]),z=(0,Ne.useCallback)(L=>{B(L)&&C&&R.current&&setTimeout(()=>{v()},100)},[B,C,v]);return{flatListRef:R,scrollState:S,handleScroll:P,handleContentSizeChange:j,handleNewMessages:z,scrollToEnd:v,scrollToOffset:V,scrollToIndex:D}}var Et=require("react");function $t(M={}){let{enableMessageActions:T=!0}=M,[C,R]=(0,Et.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,Et.useCallback)((P,B)=>{T&&R({actionSheetVisible:!0,selectedMessage:P,messagePosition:B})},[T]),A=(0,Et.useCallback)(()=>{R({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Et.useCallback)((P,B)=>{if(!C.selectedMessage)return;let{selectedMessage:j}=C;switch(P){case"reply":B?.onReply?.(j);break;case"copy":if(B?.onCopy)B.onCopy(j);else{let v=j.type==="image"&&j.imageData?j.text||"Image message":j.text;Promise.resolve().then(()=>(Bs(),zs)).then(({copyToClipboard:V})=>{V(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":B?.onDelete?.(j.id);break;default:B?.onCustomAction?.(P,j);break}A()},[C.selectedMessage,A]);return{actionState:C,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}var it=require("react");function Yt(M={}){let{enableReactionDetails:T=!0}=M,[C,R]=(0,it.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=(0,it.useState)(null),I=(0,it.useCallback)(V=>{T&&V.reactions&&V.reactions.length>0&&(A(V),R({isReactionDetailsVisible:!0,selectedReactions:V.reactions,selectedMessageText:V.text}))},[T]),P=(0,it.useCallback)(()=>{R({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),B=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),j=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),v=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V)},[S]);return{reactionState:C,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:B,handleRemoveReaction:j,handleEmojiReact:v}}var Gt=require("react");function Zo(){let[M,T]=(0,Gt.useState)({replyToMessage:null}),C=(0,Gt.useCallback)(S=>{T({replyToMessage:S})},[]),R=(0,Gt.useCallback)(()=>{T({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:C,clearReply:R}}var Vs=(0,ht.createContext)(null);function jt(){let M=(0,ht.useContext)(Vs);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function _t({children:M,messages:T,config:C={},...R}){let S=qt(T,C),A=Qo(C),I=$t(C),P=Yt(C),B=Zo();ht.default.useEffect(()=>{A.handleNewMessages(T.length)},[T.length,A.handleNewMessages]);let j=(0,ht.useMemo)(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:B,config:C,callbacks:R}),[S,A,I,P,B,C,R]);return<Vs.Provider value={j}>
395
+ <Ct ref={k.menuRef}onOptionSelect={k.handleOptionSelect}options={k.options}/>
396
+ </>});dt.displayName="MessageInput";var Do=require("react-native"),Xo=require("lucide-react-native");var Lo=Q(require("react"));var ht=Q(require("react"));var ko=require("react");function qt(M,T={}){let{initialNumToRender:C=20,maxToRenderPerBatch:R=10,windowSize:S=10}=T,A=(0,ko.useMemo)(()=>Ms(M).reverse(),[M]),I=(0,ko.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:C,maxToRenderPerBatch:R,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ne=require("react");function Qo(M={}){let{scrollThreshold:T=50,autoScrollToBottom:C=!0}=M,R=(0,Ne.useRef)(null),[S,A]=(0,Ne.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ne.useRef)(0),P=(0,Ne.useCallback)(L=>{let{contentOffset:k,contentSize:O,layoutMeasurement:F}=L.nativeEvent,H=k.y,N=Math.abs(H)<T,j=Math.abs(H)>O.height-F.height-T;A({isNearBottom:N,isNearTop:j,showScrollToBottomButton:!N})},[T]),B=(0,Ne.useCallback)(L=>{let k=L>I.current;return I.current=L,k},[]),E=(0,Ne.useCallback)(()=>{},[]),v=(0,Ne.useCallback)((L=!0)=>{R.current&&R.current.scrollToOffset({offset:0,animated:L})},[]),V=(0,Ne.useCallback)((L,k=!0)=>{R.current&&R.current.scrollToOffset({offset:L,animated:k})},[]),D=(0,Ne.useCallback)((L,k=!0)=>{R.current&&R.current.scrollToIndex({index:L,animated:k})},[]),z=(0,Ne.useCallback)(L=>{B(L)&&C&&R.current&&setTimeout(()=>{v()},100)},[B,C,v]);return{flatListRef:R,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:z,scrollToEnd:v,scrollToOffset:V,scrollToIndex:D}}var Et=require("react");function $t(M={}){let{enableMessageActions:T=!0}=M,[C,R]=(0,Et.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,Et.useCallback)((P,B)=>{T&&R({actionSheetVisible:!0,selectedMessage:P,messagePosition:B})},[T]),A=(0,Et.useCallback)(()=>{R({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Et.useCallback)((P,B)=>{if(!C.selectedMessage)return;let{selectedMessage:E}=C;switch(P){case"reply":B?.onReply?.(E);break;case"copy":if(B?.onCopy)B.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>(Bs(),zs)).then(({copyToClipboard:V})=>{V(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":B?.onDelete?.(E.id);break;default:B?.onCustomAction?.(P,E);break}A()},[C.selectedMessage,A]);return{actionState:C,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}var it=require("react");function Yt(M={}){let{enableReactionDetails:T=!0}=M,[C,R]=(0,it.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=(0,it.useState)(null),I=(0,it.useCallback)(V=>{T&&V.reactions&&V.reactions.length>0&&(A(V),R({isReactionDetailsVisible:!0,selectedReactions:V.reactions,selectedMessageText:V.text}))},[T]),P=(0,it.useCallback)(()=>{R({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),B=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),E=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V),P()},[S,P]),v=(0,it.useCallback)((V,D)=>{S&&D?.(S.id,V)},[S]);return{reactionState:C,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:B,handleRemoveReaction:E,handleEmojiReact:v}}var Gt=require("react");function Zo(){let[M,T]=(0,Gt.useState)({replyToMessage:null}),C=(0,Gt.useCallback)(S=>{T({replyToMessage:S})},[]),R=(0,Gt.useCallback)(()=>{T({replyToMessage:null})},[]);return{replyState:M,setReplyToMessage:C,clearReply:R}}var Vs=(0,ht.createContext)(null);function jt(){let M=(0,ht.useContext)(Vs);if(!M)throw new Error("useMessageListContext must be used within MessageListProvider");return M}function _t({children:M,messages:T,config:C={},...R}){let S=qt(T,C),A=Qo(C),I=$t(C),P=Yt(C),B=Zo();ht.default.useEffect(()=>{A.handleNewMessages(T.length)},[T.length,A.handleNewMessages]);let E=(0,ht.useMemo)(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:B,config:C,callbacks:R}),[S,A,I,P,B,C,R]);return<Vs.Provider value={E}>
397
397
  {M}
398
- </Vs.Provider>}var Jt=require("react"),Ot=require("react-native");var ft={Provider:_t,Container:({children:M,style:T})=><Ot.View style={[Ds.container,T]}>{M}</Ot.View>,Messages:({renderMessage:M,style:T})=>{let{messageList:C,scroll:R,actions:S,reactions:A,callbacks:I}=jt(),P=(0,Jt.useCallback)(({item:j,index:v})=>M&&j.listItemType!=="date-separator"?M({message:j,index:v})||null:j.listItemType==="date-separator"?<Bo date={j.date}displayDate={j.displayDate}/>:<Ro message={j}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,M]),B=(0,Jt.useCallback)(j=>{R.handleScroll(j);let{isNearBottom:v,isNearTop:V}=R.scrollState;I.onScrollPositionChange?.(v,V),v&&I.onScrollToBottom?.(),V&&I.onScrollToTop?.()},[R.handleScroll,R.scrollState,I]);return<Ot.FlatList ref={R.flatListRef}data={C.messageItems}renderItem={P}keyExtractor={C.keyExtractor}contentContainerStyle={[Ds.contentContainer,T]}onContentSizeChange={R.handleContentSizeChange}onScroll={B}{...C.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Dt isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:T,onPress:C})=>{let{scroll:R}=jt();return<Ao visible={M??R.scrollState.showScrollToBottomButton}onPress={C??R.scrollToEnd}isReplyActive={T}/>},ActionSheet:()=>{let{actions:M,reactions:T,reply:C,callbacks:R,config:S}=jt(),A=(0,Jt.useCallback)(P=>{M.handleActionPress(P,{onReply:B=>{C.setReplyToMessage(B),R.onReplyMessage?.(B)},onDelete:R.onMessageDelete,onCustomAction:R.onActionPress})},[M.handleActionPress,C.setReplyToMessage,R]),I=(0,Jt.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let B=M.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",B?.id,"callbacks.onReactionAdd exists:",!!R.onReactionAdd),B&&R.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",B.id,"emoji:",P),R.onReactionAdd(B.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!B,"callback exists:",!!R.onReactionAdd)},[M.actionState.selectedMessage,R.onReactionAdd]);return S.enableMessageActions?<So visible={M.actionState.actionSheetVisible}onClose={M.handleActionSheetClose}isMyMessage={M.actionState.selectedMessage?.isMe||!1}selectedMessage={M.actionState.selectedMessage||void 0}messagePosition={M.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:M,callbacks:T,config:C}=jt();return C.enableReactionDetails?<Io visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={R=>M.handleRemoveReaction(R,T.onReactionRemove)}/>:null}},Ds=Ot.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var ut=(0,Lo.forwardRef)(({messages:M,isTyping:T,showScrollToBottom:C=!1,isReplyActive:R=!1,...S},A)=>{let I={scrollThreshold:S.scrollThreshold,autoScrollToBottom:S.autoScrollToBottom,enableMessageActions:S.enableMessageActions,enableReactionDetails:S.enableReactionDetails},P={onScrollToBottom:S.onScrollToBottom,onScrollToTop:S.onScrollToTop,onScrollPositionChange:S.onScrollPositionChange,onReactionAdd:S.onReactionAdd,onReactionRemove:S.onReactionRemove,onMessageDelete:S.onMessageDelete,onReplyMessage:S.onReplyMessage,onActionPress:S.onActionPress};return Lo.default.useImperativeHandle(A,()=>({scrollToEnd:(B=!0)=>{},scrollToOffset:(B,j=!0)=>{},scrollToIndex:(B,j=!0)=>{}}),[]),<_t messages={M}config={I}{...P}>
398
+ </Vs.Provider>}var Jt=require("react"),Ot=require("react-native");var ft={Provider:_t,Container:({children:M,style:T})=><Ot.View style={[Ds.container,T]}>{M}</Ot.View>,Messages:({renderMessage:M,style:T})=>{let{messageList:C,scroll:R,actions:S,reactions:A,callbacks:I}=jt(),P=(0,Jt.useCallback)(({item:E,index:v})=>M&&E.listItemType!=="date-separator"?M({message:E,index:v})||null:E.listItemType==="date-separator"?<Bo date={E.date}displayDate={E.displayDate}/>:<Ro message={E}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,M]),B=(0,Jt.useCallback)(E=>{R.handleScroll(E);let{isNearBottom:v,isNearTop:V}=R.scrollState;I.onScrollPositionChange?.(v,V),v&&I.onScrollToBottom?.(),V&&I.onScrollToTop?.()},[R.handleScroll,R.scrollState,I]);return<Ot.FlatList ref={R.flatListRef}data={C.messageItems}renderItem={P}keyExtractor={C.keyExtractor}contentContainerStyle={[Ds.contentContainer,T]}onContentSizeChange={R.handleContentSizeChange}onScroll={B}{...C.flatListProps}/>},TypingIndicator:({isVisible:M})=>M?<Dt isVisible={M}/>:null,ScrollButton:({visible:M,isReplyActive:T,onPress:C})=>{let{scroll:R}=jt();return<Ao visible={M??R.scrollState.showScrollToBottomButton}onPress={C??R.scrollToEnd}isReplyActive={T}/>},ActionSheet:()=>{let{actions:M,reactions:T,reply:C,callbacks:R,config:S}=jt(),A=(0,Jt.useCallback)(P=>{M.handleActionPress(P,{onReply:B=>{C.setReplyToMessage(B),R.onReplyMessage?.(B)},onDelete:R.onMessageDelete,onCustomAction:R.onActionPress})},[M.handleActionPress,C.setReplyToMessage,R]),I=(0,Jt.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let B=M.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",B?.id,"callbacks.onReactionAdd exists:",!!R.onReactionAdd),B&&R.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",B.id,"emoji:",P),R.onReactionAdd(B.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!B,"callback exists:",!!R.onReactionAdd)},[M.actionState.selectedMessage,R.onReactionAdd]);return S.enableMessageActions?<So visible={M.actionState.actionSheetVisible}onClose={M.handleActionSheetClose}isMyMessage={M.actionState.selectedMessage?.isMe||!1}selectedMessage={M.actionState.selectedMessage||void 0}messagePosition={M.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:M,callbacks:T,config:C}=jt();return C.enableReactionDetails?<Io visible={M.reactionState.isReactionDetailsVisible}onClose={M.handleReactionDetailsClose}reactions={M.reactionState.selectedReactions}messageText={M.reactionState.selectedMessageText}onRemoveReaction={R=>M.handleRemoveReaction(R,T.onReactionRemove)}/>:null}},Ds=Ot.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var ut=(0,Lo.forwardRef)(({messages:M,isTyping:T,showScrollToBottom:C=!1,isReplyActive:R=!1,...S},A)=>{let I={scrollThreshold:S.scrollThreshold,autoScrollToBottom:S.autoScrollToBottom,enableMessageActions:S.enableMessageActions,enableReactionDetails:S.enableReactionDetails},P={onScrollToBottom:S.onScrollToBottom,onScrollToTop:S.onScrollToTop,onScrollPositionChange:S.onScrollPositionChange,onReactionAdd:S.onReactionAdd,onReactionRemove:S.onReactionRemove,onMessageDelete:S.onMessageDelete,onReplyMessage:S.onReplyMessage,onActionPress:S.onActionPress};return Lo.default.useImperativeHandle(A,()=>({scrollToEnd:(B=!0)=>{},scrollToOffset:(B,E=!0)=>{},scrollToIndex:(B,E=!0)=>{}}),[]),<_t messages={M}config={I}{...P}>
399
399
  <ft.Container>
400
400
  <ft.Messages/>
401
401
  <ft.TypingIndicator isVisible={T}/>
@@ -403,14 +403,18 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
403
403
  <ft.ActionSheet/>
404
404
  <ft.ReactionDetails/>
405
405
  </ft.Container>
406
- </_t>});ut.displayName="MessageList";var ks=Q(require("react"));function Le(M){let T=ks.default.forwardRef((R,S)=>(Rt(),<M{...R}ref={S}/>)),C=M.displayName||M.name||"Component";return T.displayName=`RequireAuth(${C})`,T}function rt(M){return(...T)=>(Rt(),M(...T))}var Eo=require("react-native");var We=require("react-native");var Xt=require("react-native");var Vr=({avatar:M,isOnline:T=!1,size:C="medium"})=>{let R=$(),S=()=>{switch(C){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(C){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=S(),P=A();return<Xt.View style={{position:"relative"}}>
407
- <Xt.Image source={{uri:M}}style={[I,{borderRadius:R.borderRadius.full}]}resizeMode="cover"/>
406
+ </_t>});ut.displayName="MessageList";var ks=Q(require("react"));function Le(M){let T=ks.default.forwardRef((R,S)=>(Tt(),<M{...R}ref={S}/>)),C=M.displayName||M.name||"Component";return T.displayName=`RequireAuth(${C})`,T}function rt(M){return(...T)=>(Tt(),M(...T))}var Eo=require("react-native");var We=require("react-native");var yt=require("react-native");var Vr=({avatar:M,isOnline:T=!1,size:C="medium"})=>{let R=$(),S=()=>{switch(C){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(C){case"small":return{width:12,height:12};case"large":return{width:24,height:24};default:return{width:16,height:16}}},I=S(),P=A(),E=(()=>{switch(C){case"small":return 14;case"large":return 28;default:return 20}})();return<yt.View style={{position:"relative"}}>
407
+ {M&&M.trim()!==""?<yt.Image source={{uri:M}}style={[I,{borderRadius:R.borderRadius.full}]}resizeMode="cover"/>:<yt.View style={[I,{borderRadius:R.borderRadius.full,backgroundColor:R.colors.primary,justifyContent:"center",alignItems:"center"}]}>
408
+ <yt.Text style={{color:R.colors.background,fontSize:E,fontWeight:"600"}}>
409
+ 👤
410
+ </yt.Text>
411
+ </yt.View>}
408
412
 
409
413
  {}
410
- {T&&<Xt.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:R.colors.online,borderRadius:R.borderRadius.full,borderWidth:2,borderColor:R.colors.background}]}/>}
411
- </Xt.View>},Qt=Vr;var Dr=({item:M,onPress:T})=>{let C=$(),R=M.unreadCount&&M.unreadCount>0;return<We.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md,borderBottomWidth:1,borderBottomColor:C.colors.borderLight,backgroundColor:R?C.colors.unread:C.colors.background}}onPress={()=>T(M)}>
414
+ {T&&<yt.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:R.colors.online,borderRadius:R.borderRadius.full,borderWidth:2,borderColor:R.colors.background}]}/>}
415
+ </yt.View>},Xt=Vr;var Dr=({item:M,onPress:T})=>{let C=$(),R=M.unreadCount&&M.unreadCount>0;return<We.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md,borderBottomWidth:1,borderBottomColor:C.colors.borderLight,backgroundColor:R?C.colors.unread:C.colors.background}}onPress={()=>T(M)}>
412
416
  <We.View style={{marginRight:C.spacing.md}}>
413
- <Qt avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
417
+ <Xt avatar={M.avatar}isOnline={M.isOnline}size="medium"/>
414
418
  </We.View>
415
419
 
416
420
  <We.View style={{flex:1,marginRight:C.spacing.md}}>
@@ -436,20 +440,20 @@ await initChat({ projectId: 'your-project-id' });`)},ds=()=>(Rt(),nt.projectId),
436
440
  </We.View>}
437
441
  </We.View>
438
442
  </We.View>
439
- </We.TouchableOpacity>},Zt=Dr;var kr=({chats:M,onChatPress:T,onRefresh:C,refreshing:R=!1})=>{let S=({item:A})=><Zt item={A}onPress={T}/>;return<Eo.FlatList data={M}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={C?<Eo.RefreshControl refreshing={R}onRefresh={C}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},es=kr;var jo=require("react-native");var Lr=({title:M})=>{let T=$();return<jo.View style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.lg,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
443
+ </We.TouchableOpacity>},Qt=Dr;var kr=({chats:M,onChatPress:T,onRefresh:C,refreshing:R=!1})=>{let S=({item:A})=><Qt item={A}onPress={T}/>;return<Eo.FlatList data={M}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={C?<Eo.RefreshControl refreshing={R}onRefresh={C}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},es=kr;var jo=require("react-native");var Lr=({title:M})=>{let T=$();return<jo.View style={{backgroundColor:T.colors.background,paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.lg,borderBottomWidth:1,borderBottomColor:T.colors.borderLight}}>
440
444
  <jo.Text style={{fontSize:T.typography.fontSize.xxl,fontWeight:T.typography.fontWeight.bold,color:T.colors.text}}>
441
445
  {M}
442
446
  </jo.Text>
443
- </jo.View>},ts=Lr;var yt=require("react-native"),Oo=require("lucide-react-native");var Er=({value:M,onChangeText:T,onClear:C,placeholder:R="Search chats..."})=>{let S=$();return<yt.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
444
- <yt.View style={{position:"relative"}}>
445
- <yt.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
447
+ </jo.View>},ts=Lr;var xt=require("react-native"),Oo=require("lucide-react-native");var Er=({value:M,onChangeText:T,onClear:C,placeholder:R="Search chats..."})=>{let S=$();return<xt.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
448
+ <xt.View style={{position:"relative"}}>
449
+ <xt.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
446
450
  <Oo.Search size={20}color={S.colors.textMuted}/>
447
- </yt.View>
451
+ </xt.View>
448
452
 
449
- <yt.TextInput value={M}onChangeText={T}placeholder={R}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
453
+ <xt.TextInput value={M}onChangeText={T}placeholder={R}placeholderTextColor={S.colors.textMuted}style={{backgroundColor:S.colors.surfaceSecondary,borderRadius:S.borderRadius.full,paddingLeft:48,paddingRight:40,paddingVertical:S.spacing.md,color:S.colors.text,fontSize:S.typography.fontSize.base}}autoCapitalize="none"autoCorrect={!1}clearButtonMode="never"/>
450
454
 
451
- {M.length>0&&<yt.TouchableOpacity onPress={C}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
455
+ {M.length>0&&<xt.TouchableOpacity onPress={C}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
452
456
  <Oo.X size={20}color={S.colors.textMuted}/>
453
- </yt.TouchableOpacity>}
454
- </yt.View>
455
- </yt.View>},os=Er;var lt=require("react"),Fo=Q(require("dayjs")),Ct=(0,Fo.default)(),Ls=Ct.subtract(1,"day"),Es=Ct.subtract(2,"day"),js=Ct.subtract(3,"day"),jr=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:js.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:js.hour(10).minute(31).toISOString(),reactions:[{emoji:"\u2764\uFE0F",count:1,users:["anna"]}]},{id:3,text:"Good too! What are we doing tonight?",isMe:!1,timestamp:Es.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Es.hour(14).minute(25).toISOString(),reactions:[{emoji:"\u{1F44D}",count:2,users:["anna","me"]},{emoji:"\u{1F3AC}",count:1,users:["anna"]}]},{id:5,text:"Good idea! I'll check the showtimes",isMe:!1,timestamp:Ls.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Ls.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:Ct.hour(8).minute(30).toISOString(),senderName:"Anna",reactions:[{emoji:"\u{1F602}",count:1,users:["me"]},{emoji:"\u{1F3AD}",count:1,users:["anna"]}]},{id:8,text:"Sounds great! I'll check what's playing",isMe:!0,timestamp:Ct.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:Ct.hour(9).minute(10).toISOString(),senderName:"Anna",replyTo:{id:8,text:"Sounds great! I'll check what's playing",senderName:void 0,isMe:!0,type:"text"}},{id:10,text:"How about 7:00 PM? The show is at 8:00 PM",isMe:!0,timestamp:Ct.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],ss=M=>{let T=jr.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[C,R]=(0,lt.useState)(T),S=(0,lt.useCallback)((v,V)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",V),!v.trim())return;let D={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,Fo.default)().toISOString(),status:"sent",replyTo:V};R(z=>[...z,D]),setTimeout(()=>{R(z=>z.map(L=>L.id===D.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{R(z=>z.map(L=>L.id===D.id?{...L,status:"read"}:L))},3e3)},[]),A=(0,lt.useCallback)((v,V,D)=>{let z={id:Date.now(),text:V||"",isMe:!0,timestamp:(0,Fo.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};R(L=>[...L,z]),setTimeout(()=>{R(L=>L.map(k=>k.id===z.id?{...k,status:"delivered"}:k))},1e3),setTimeout(()=>{R(L=>L.map(k=>k.id===z.id?{...k,status:"read"}:k))},3e3)},[]),I=(0,lt.useCallback)((v,V)=>{R(D=>D.map(z=>z.id===v?{...z,status:V}:z))},[]),P=(0,lt.useCallback)((v,V)=>{R(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=[...L];return O[k]={...O[k],count:O[k].count+1,users:[...O[k].users,"me"]},{...z,reactions:O}}else{let O={emoji:V,count:1,users:["me"]};return{...z,reactions:[...L,O]}}}return z}))},[]),B=(0,lt.useCallback)((v,V)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",V),R(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=L[k];if(O.count>1){let F=[...L];return F[k]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...z,reactions:F}}else return{...z,reactions:L.filter(F=>F.emoji!==V)}}}return z}))},[]),j=(0,lt.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),R(V=>{let D=V.map(z=>z.id===v?{...z,deleted:!0}:z);return console.log("Message marked as deleted:",v),D})},[]);return{messages:C,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:j,removeReaction:B}};var Ue=require("react");var rs=(M={})=>{Rt();let[T,C]=(0,Ue.useState)(M.initialMessages||[]),[R,S]=(0,Ue.useState)(!1),A=(0,Ue.useCallback)((L,k)=>{let O={id:Date.now(),text:L,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:k?{id:k.id,text:k.text,senderName:k.senderName,isMe:k.isMe}:void 0};C(F=>[O,...F])},[]),I=(0,Ue.useCallback)(L=>{C(k=>[L,...k])},[]),P=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>F.id===L?{...F,...k}:F))},[]),B=(0,Ue.useCallback)(L=>{C(k=>k.filter(O=>O.id!==L))},[]),j=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[];if(H.find(E=>E.emoji===k))return{...F,reactions:H.map(E=>E.emoji===k?{...E,count:E.count+1,users:[...E.users,"current-user"]}:E)};{let E={emoji:k,count:1,users:["current-user"]};return{...F,reactions:[...H,E]}}}))},[]),v=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[],N=H.find(E=>E.emoji===k);return N?N.count<=1?{...F,reactions:H.filter(E=>E.emoji!==k)}:{...F,reactions:H.map(E=>E.emoji===k?{...E,count:E.count-1,users:E.users.filter(oe=>oe!=="current-user")}:E)}:F}))},[]),V=(0,Ue.useCallback)(L=>{S(L)},[]),D=(0,Ue.useCallback)(()=>{C(M.initialMessages||[]),S(!1)},[M.initialMessages]),z=(0,Ue.useCallback)(L=>T.find(k=>k.id===L),[T]);return{messages:T,isTyping:R,sendMessage:A,addReaction:j,removeReaction:v,setMessages:C,addMessage:I,updateMessage:P,deleteMessage:B,setTyping:V,resetChat:D,getMessageById:z}};var Ho=require("react");var Or=Le(Ko),Fr=Le(Uo),Hr=rt(Ht),Nr=Le(ut),Wr=Le(dt),Ur=Le(ro),Kr=Le(Dt),qr=Le(es),$r=Le(Zt),Yr=Le(ts),Gr=Le(os),_r=Le(Qt),Jr=Le(Mt),Xr=Le(fs),Qr=rt($),Zr=rt(rs),en=rt(ss),tn=rt(qt),on=rt($t),sn=rt(Yt),rn=rt(Nt),nn=rt(Kt);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,getAuthState,getProjectId,initChat,isInitialized,useAttachments,useChatConfig,useChatMessages,useChatSDK,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme});
457
+ </xt.TouchableOpacity>}
458
+ </xt.View>
459
+ </xt.View>},os=Er;var lt=require("react"),Fo=Q(require("dayjs")),Rt=(0,Fo.default)(),Ls=Rt.subtract(1,"day"),Es=Rt.subtract(2,"day"),js=Rt.subtract(3,"day"),jr=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:js.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:js.hour(10).minute(31).toISOString(),reactions:[{emoji:"\u2764\uFE0F",count:1,users:["anna"]}]},{id:3,text:"Good too! What are we doing tonight?",isMe:!1,timestamp:Es.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Es.hour(14).minute(25).toISOString(),reactions:[{emoji:"\u{1F44D}",count:2,users:["anna","me"]},{emoji:"\u{1F3AC}",count:1,users:["anna"]}]},{id:5,text:"Good idea! I'll check the showtimes",isMe:!1,timestamp:Ls.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Ls.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:Rt.hour(8).minute(30).toISOString(),senderName:"Anna",reactions:[{emoji:"\u{1F602}",count:1,users:["me"]},{emoji:"\u{1F3AD}",count:1,users:["anna"]}]},{id:8,text:"Sounds great! I'll check what's playing",isMe:!0,timestamp:Rt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:Rt.hour(9).minute(10).toISOString(),senderName:"Anna",replyTo:{id:8,text:"Sounds great! I'll check what's playing",senderName:void 0,isMe:!0,type:"text"}},{id:10,text:"How about 7:00 PM? The show is at 8:00 PM",isMe:!0,timestamp:Rt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],ss=M=>{let T=jr.map(v=>v.isMe?v:{...v,senderName:M||v.senderName}),[C,R]=(0,lt.useState)(T),S=(0,lt.useCallback)((v,V)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",V),!v.trim())return;let D={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,Fo.default)().toISOString(),status:"sent",replyTo:V};R(z=>[...z,D]),setTimeout(()=>{R(z=>z.map(L=>L.id===D.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{R(z=>z.map(L=>L.id===D.id?{...L,status:"read"}:L))},3e3)},[]),A=(0,lt.useCallback)((v,V,D)=>{let z={id:Date.now(),text:V||"",isMe:!0,timestamp:(0,Fo.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};R(L=>[...L,z]),setTimeout(()=>{R(L=>L.map(k=>k.id===z.id?{...k,status:"delivered"}:k))},1e3),setTimeout(()=>{R(L=>L.map(k=>k.id===z.id?{...k,status:"read"}:k))},3e3)},[]),I=(0,lt.useCallback)((v,V)=>{R(D=>D.map(z=>z.id===v?{...z,status:V}:z))},[]),P=(0,lt.useCallback)((v,V)=>{R(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=[...L];return O[k]={...O[k],count:O[k].count+1,users:[...O[k].users,"me"]},{...z,reactions:O}}else{let O={emoji:V,count:1,users:["me"]};return{...z,reactions:[...L,O]}}}return z}))},[]),B=(0,lt.useCallback)((v,V)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",V),R(D=>D.map(z=>{if(z.id===v){let L=z.reactions||[],k=L.findIndex(O=>O.emoji===V);if(k>=0){let O=L[k];if(O.count>1){let F=[...L];return F[k]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...z,reactions:F}}else return{...z,reactions:L.filter(F=>F.emoji!==V)}}}return z}))},[]),E=(0,lt.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),R(V=>{let D=V.map(z=>z.id===v?{...z,deleted:!0}:z);return console.log("Message marked as deleted:",v),D})},[]);return{messages:C,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:B}};var Ue=require("react");var rs=(M={})=>{Tt();let[T,C]=(0,Ue.useState)(M.initialMessages||[]),[R,S]=(0,Ue.useState)(!1),A=(0,Ue.useCallback)((L,k)=>{let O={id:Date.now(),text:L,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:k?{id:k.id,text:k.text,senderName:k.senderName,isMe:k.isMe}:void 0};C(F=>[O,...F])},[]),I=(0,Ue.useCallback)(L=>{C(k=>[L,...k])},[]),P=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>F.id===L?{...F,...k}:F))},[]),B=(0,Ue.useCallback)(L=>{C(k=>k.filter(O=>O.id!==L))},[]),E=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[];if(H.find(j=>j.emoji===k))return{...F,reactions:H.map(j=>j.emoji===k?{...j,count:j.count+1,users:[...j.users,"current-user"]}:j)};{let j={emoji:k,count:1,users:["current-user"]};return{...F,reactions:[...H,j]}}}))},[]),v=(0,Ue.useCallback)((L,k)=>{C(O=>O.map(F=>{if(F.id!==L)return F;let H=F.reactions||[],N=H.find(j=>j.emoji===k);return N?N.count<=1?{...F,reactions:H.filter(j=>j.emoji!==k)}:{...F,reactions:H.map(j=>j.emoji===k?{...j,count:j.count-1,users:j.users.filter(oe=>oe!=="current-user")}:j)}:F}))},[]),V=(0,Ue.useCallback)(L=>{S(L)},[]),D=(0,Ue.useCallback)(()=>{C(M.initialMessages||[]),S(!1)},[M.initialMessages]),z=(0,Ue.useCallback)(L=>T.find(k=>k.id===L),[T]);return{messages:T,isTyping:R,sendMessage:A,addReaction:E,removeReaction:v,setMessages:C,addMessage:I,updateMessage:P,deleteMessage:B,setTyping:V,resetChat:D,getMessageById:z}};var Ho=require("react");var Or=Le(Ko),Fr=Le(Uo),Hr=rt(Ht),Nr=Le(ut),Wr=Le(dt),Ur=Le(so),Kr=Le(Dt),qr=Le(es),$r=Le(Qt),Yr=Le(ts),Gr=Le(os),_r=Le(Xt),Jr=Le(Ct),Xr=Le(fs),Qr=rt($),Zr=rt(rs),en=rt(ss),tn=rt(qt),on=rt($t),sn=rt(Yt),rn=rt(Nt),nn=rt(Kt);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,getAuthState,getProjectId,initChat,isInitialized,useAttachments,useChatConfig,useChatMessages,useChatSDK,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme});