@usechat/react-native 1.0.14 → 1.0.15

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- "use strict";var tn=Object.create;var ko=Object.defineProperty;var on=Object.getOwnPropertyDescriptor;var sn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var rn=(C,R)=>()=>(C&&(R=C(C=0)),R);var Rs=(C,R)=>{for(var M in R)ko(C,M,{get:R[M],enumerable:!0})},Ss=(C,R,M,T)=>{if(R&&typeof R=="object"||typeof R=="function")for(let S of sn(R))!an.call(C,S)&&S!==M&&ko(C,S,{get:()=>R[S],enumerable:!(T=on(R,S))||T.enumerable});return C};var X=(C,R,M)=>(M=C!=null?tn(nn(C)):{},Ss(R||!C||!C.__esModule?ko(M,"default",{value:C,enumerable:!0}):M,C)),ln=C=>Ss(ko({},"__esModule",{value:!0}),C);var Ys={};Rs(Ys,{copyToClipboard:()=>Ln,isClipboardAvailable:()=>jn});var Ln,jn,Gs=rn(()=>{"use strict";Ln=async C=>{console.log("copyToClipboard called with text:",C);try{try{let{setStringAsync:R}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",R),await R(C),console.log("Text copied to clipboard successfully")}catch(R){throw console.error("Failed to import expo-clipboard:",R),new Error("expo-clipboard not available")}try{let R=await import("react-native-toast-message"),M=R.default||R;console.log("react-native-toast-message imported successfully"),M.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(R){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",R)}return!0}catch(R){console.error("Failed to copy to clipboard:",R);try{let M=await import("react-native-toast-message");(M.default||M).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(M){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",M)}return!1}},jn=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var ua={};Rs(ua,{AttachmentMenu:()=>ta,Chat:()=>Un,ChatAvatar:()=>ea,ChatHeader:()=>Zn,ChatItem:()=>Xn,ChatList:()=>Jn,ChatListSearchBar:()=>Qn,ChatProvider:()=>Kn,ChatScreenHeader:()=>Gn,I18nProvider:()=>Xt,MessageInput:()=>Yn,MessageList:()=>$n,ThemeProvider:()=>oa,TypingIndicator:()=>_n,defaultTheme:()=>Vt,defaultTranslations:()=>_t,getAuthState:()=>Is,getProjectId:()=>vs,getTranslation:()=>zt,initChat:()=>As,isInitialized:()=>Ps,isSupportedLocale:()=>Jt,useAttachments:()=>ca,useChatConfig:()=>qn,useChatMessages:()=>aa,useChatSDK:()=>na,useMessageActions:()=>ia,useMessageInput:()=>da,useMessageList:()=>ra,useMessageReactions:()=>la,useTheme:()=>sa,useTranslation:()=>as,useTranslationFunction:()=>We});module.exports=ln(ua);var lt={isInitialized:!1,projectId:null,error:null},ws=C=>{lt={isInitialized:!0,projectId:C,error:null}},Rt=C=>{lt={isInitialized:!1,projectId:null,error:C}};var Is=()=>({...lt}),At=()=>{if(lt.error)throw new Error(`UseChat SDK initialization failed: ${lt.error}
2
+ "use strict";var Qs=Object.create;var So=Object.defineProperty;var er=Object.getOwnPropertyDescriptor;var tr=Object.getOwnPropertyNames;var or=Object.getPrototypeOf,sr=Object.prototype.hasOwnProperty;var rr=(T,R)=>()=>(T&&(R=T(T=0)),R);var fs=(T,R)=>{for(var M in R)So(T,M,{get:R[M],enumerable:!0})},ys=(T,R,M,C)=>{if(R&&typeof R=="object"||typeof R=="function")for(let S of tr(R))!sr.call(T,S)&&S!==M&&So(T,S,{get:()=>R[S],enumerable:!(C=er(R,S))||C.enumerable});return T};var Y=(T,R,M)=>(M=T!=null?Qs(or(T)):{},ys(R||!T||!T.__esModule?So(M,"default",{value:T,enumerable:!0}):M,T)),ar=T=>ys(So({},"__esModule",{value:!0}),T);var Ks={};fs(Ks,{copyToClipboard:()=>Vr,isClipboardAvailable:()=>Dr});var Vr,Dr,$s=rr(()=>{"use strict";Vr=async T=>{console.log("copyToClipboard called with text:",T);try{try{let{setStringAsync:R}=await import("expo-clipboard");console.log("expo-clipboard imported successfully"),console.log("setStringAsync function:",R),await R(T),console.log("Text copied to clipboard successfully")}catch(R){throw console.error("Failed to import expo-clipboard:",R),new Error("expo-clipboard not available")}try{let R=await import("react-native-toast-message"),M=R.default||R;console.log("react-native-toast-message imported successfully"),M.show({type:"success",text1:"Copied to clipboard",text2:"Message copied successfully",position:"bottom",visibilityTime:2e3}),console.log("Toast shown successfully")}catch(R){console.log("Toast not available, but message copied to clipboard"),console.error("Toast import error:",R)}return!0}catch(R){console.error("Failed to copy to clipboard:",R);try{let M=await import("react-native-toast-message");(M.default||M).show({type:"error",text1:"Copy failed",text2:"Failed to copy message to clipboard",position:"bottom",visibilityTime:2e3})}catch(M){console.error("Copy failed: expo-clipboard not available"),console.error("Toast import error:",M)}return!1}},Dr=async()=>{try{return await import("expo-clipboard"),!0}catch{return!1}}});var la={};fs(la,{AttachmentMenu:()=>Xr,Chat:()=>Or,ChatAvatar:()=>Jr,ChatHeader:()=>Gr,ChatItem:()=>Yr,ChatList:()=>qr,ChatListSearchBar:()=>_r,ChatProvider:()=>Hr,ChatScreenHeader:()=>Kr,I18nProvider:()=>_t,MessageInput:()=>Ur,MessageList:()=>Wr,ThemeProvider:()=>Zr,TypingIndicator:()=>$r,defaultTheme:()=>Vt,defaultTranslations:()=>Yt,getAuthState:()=>bs,getProjectId:()=>Ts,getTranslation:()=>zt,initChat:()=>Cs,isInitialized:()=>Ms,isSupportedLocale:()=>Gt,useAttachments:()=>aa,useChatConfig:()=>Nr,useChatMessages:()=>ta,useChatSDK:()=>ea,useDateFormatter:()=>ia,useMessageActions:()=>sa,useMessageInput:()=>na,useMessageList:()=>oa,useMessageReactions:()=>ra,useTheme:()=>Qr,useTranslation:()=>Qo,useTranslationFunction:()=>ke});module.exports=ar(la);var lt={isInitialized:!1,projectId:null,error:null},xs=T=>{lt={isInitialized:!0,projectId:T,error:null}},Rt=T=>{lt={isInitialized:!1,projectId:null,error:T}};var bs=()=>({...lt}),At=()=>{if(lt.error)throw new Error(`UseChat SDK initialization failed: ${lt.error}
3
3
 
4
4
  Please call initChat() with a valid project ID before using any UseChat components or hooks.
5
5
 
@@ -11,36 +11,36 @@ 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' });`)},vs=()=>(At(),lt.projectId),Ps=()=>lt.isInitialized&&!lt.error;var As=async C=>{let{projectId:R,apiUrl:M="http://localhost:3000/api/chat/init",debug:T=!1}=C;if(!R){let S="Project ID is required";throw Rt(S),new Error(S)}try{T&&console.log(`[UseChat SDK] Validating projectId: ${R}`);let S=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:R})});if(T&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let z=await S.json();P=z.error||z.message||P}catch{try{let E=await S.text();E&&(P=`Server error: ${E}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw Rt(P),new Error(P)}let A;try{let P=await S.text();if(T&&console.log(`[Chat SDK] Response text: ${P}`),!P){let z="Server returned empty response";throw Rt(z),new Error(z)}A=JSON.parse(P)}catch(P){T&&console.error("[Chat SDK] JSON parse error:",P);let z="Server returned invalid JSON response";throw Rt(z),new Error(z)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw Rt(P),new Error(P)}let I=A;return T&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${R}`),ws(R),I}catch(S){T&&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")||Rt(A),new Error(A)}};var Pe=X(require("react")),at=require("react-native");var Do=require("react"),zs=require("react-native"),Lo=require("react-native-keyboard-controller");var st=require("react");var cn={"input.placeholder":"Type a message...","search.placeholder":"Search chats...","status.online":"Online","status.offline":"Offline","status.typing":"typing...","message.deleted":"This message was deleted","message.sending":"Sending...","message.sent":"Sent","message.delivered":"Delivered","message.read":"Read","message.failed":"Failed to send","action.reply":"Reply","action.copy":"Copy","action.delete":"Delete","action.cancel":"Cancel","action.send":"Send","action.clear":"Clear","action.clearAll":"Clear All","attachment.add":"Add attachment","attachment.remove":"Remove","attachment.clear":"Clear","attachment.attachments":"Attachments:","accessibility.back":"Go back","accessibility.send":"Send message","accessibility.attach":"Add attachment","accessibility.emoji":"Add emoji","accessibility.videoCall":"Start video call","accessibility.voiceCall":"Start voice call","accessibility.info":"Chat info","accessibility.search":"Search chats","accessibility.typing":"Someone is typing","error.fileTooLarge":"File is too large","error.invalidFileType":"Invalid file type","error.maxAttachments":"Maximum attachments reached","error.networkError":"Network error occurred","time.justNow":"Just now","time.minutesAgo":"{{count}} min ago","time.hoursAgo":"{{count}}h ago","time.daysAgo":"{{count}}d ago","time.weeksAgo":"{{count}}w ago","time.monthsAgo":"{{count}}mo ago","time.yearsAgo":"{{count}}y ago"},dn={"input.placeholder":"Napisz wiadomo\u015B\u0107...","search.placeholder":"Szukaj czat\xF3w...","status.online":"Online","status.offline":"Offline","status.typing":"pisze...","message.deleted":"Ta wiadomo\u015B\u0107 zosta\u0142a usuni\u0119ta","message.sending":"Wysy\u0142anie...","message.sent":"Wys\u0142ano","message.delivered":"Dostarczono","message.read":"Przeczytano","message.failed":"Nie uda\u0142o si\u0119 wys\u0142a\u0107","action.reply":"Odpowiedz","action.copy":"Kopiuj","action.delete":"Usu\u0144","action.cancel":"Anuluj","action.send":"Wy\u015Blij","action.clear":"Wyczy\u015B\u0107","action.clearAll":"Wyczy\u015B\u0107 wszystko","attachment.add":"Dodaj za\u0142\u0105cznik","attachment.remove":"Usu\u0144","attachment.clear":"Wyczy\u015B\u0107","attachment.attachments":"Za\u0142\u0105czniki:","accessibility.back":"Wr\xF3\u0107","accessibility.send":"Wy\u015Blij wiadomo\u015B\u0107","accessibility.attach":"Dodaj za\u0142\u0105cznik","accessibility.emoji":"Dodaj emoji","accessibility.videoCall":"Rozpocznij wideorozmow\u0119","accessibility.voiceCall":"Rozpocznij rozmow\u0119 g\u0142osow\u0105","accessibility.info":"Informacje o czacie","accessibility.search":"Szukaj czat\xF3w","accessibility.typing":"Kto\u015B pisze","error.fileTooLarge":"Plik jest za du\u017Cy","error.invalidFileType":"Nieprawid\u0142owy typ pliku","error.maxAttachments":"Osi\u0105gni\u0119to maksymaln\u0105 liczb\u0119 za\u0142\u0105cznik\xF3w","error.networkError":"Wyst\u0105pi\u0142 b\u0142\u0105d sieci","time.justNow":"W\u0142a\u015Bnie teraz","time.minutesAgo":"{{count}} min temu","time.hoursAgo":"{{count}}h temu","time.daysAgo":"{{count}}d temu","time.weeksAgo":"{{count}}t temu","time.monthsAgo":"{{count}}mies temu","time.yearsAgo":"{{count}}l temu"},_t={en:cn,pl:dn},zt=C=>_t[C]||_t.en,Jt=C=>C==="en"||C==="pl";var ns=(0,st.createContext)(void 0),Xt=({children:C,locale:R="en",fallbackLocale:M="en"})=>{let[T,S]=(0,st.useState)(R),A=(0,st.useCallback)((z,E={})=>{let k=zt(T)[z];return!k&&T!==M&&(k=zt(M)[z]),k?k.replace(/\{\{(\w+)\}\}/g,(D,V)=>E[V]?.toString()||D):(console.warn(`Translation missing for key: ${z} in locale: ${T}`),z)},[T,M]),I=(0,st.useCallback)(z=>{Jt(z)?S(z):(console.warn(`Unsupported locale: ${z}. Falling back to 'en'`),S("en"))},[]),P={t:A,locale:T,setLocale:I};return<ns.Provider value={P}>
15
- {C}
16
- </ns.Provider>},as=()=>{let C=(0,st.useContext)(ns);if(!C)throw new Error("useTranslation must be used within an I18nProvider");return C},We=()=>{let C=(0,st.useContext)(ns);return C?C.t:R=>R};var Vs=(0,Do.createContext)(null),un=({children:C,config:R={},locale:M="en"})=>{let T={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...R};return<Xt locale={M}>
17
- <Vs.Provider value={{config:T}}>
18
- <Lo.KeyboardProvider>
19
- <Lo.KeyboardAvoidingView behavior={T.keyboardBehavior}style={[mn.keyboardContainer]}keyboardVerticalOffset={T.keyboardVerticalOffset}>
14
+ await initChat({ projectId: 'your-project-id' });`)},Ts=()=>(At(),lt.projectId),Ms=()=>lt.isInitialized&&!lt.error;var Cs=async T=>{let{projectId:R,apiUrl:M="http://localhost:3000/api/chat/init",debug:C=!1}=T;if(!R){let S="Project ID is required";throw Rt(S),new Error(S)}try{C&&console.log(`[UseChat SDK] Validating projectId: ${R}`);let S=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:R})});if(C&&console.log(`[Chat SDK] Response status: ${S.status}, ok: ${S.ok}`),!S.ok){let P=`HTTP ${S.status}: ${S.statusText}`;try{let z=await S.json();P=z.error||z.message||P}catch{try{let E=await S.text();E&&(P=`Server error: ${E}`)}catch{P=`Failed to initialize chat (HTTP ${S.status})`}}throw Rt(P),new Error(P)}let A;try{let P=await S.text();if(C&&console.log(`[Chat SDK] Response text: ${P}`),!P){let z="Server returned empty response";throw Rt(z),new Error(z)}A=JSON.parse(P)}catch(P){C&&console.error("[Chat SDK] JSON parse error:",P);let z="Server returned invalid JSON response";throw Rt(z),new Error(z)}if(!A||typeof A!="object"){let P="Server returned invalid response format";throw Rt(P),new Error(P)}let I=A;return C&&console.log(`[UseChat SDK] Successfully initialized with projectId: ${R}`),xs(R),I}catch(S){C&&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")||Rt(A),new Error(A)}};var Pe=Y(require("react")),nt=require("react-native");var wo=require("react"),Rs=require("react-native"),Io=require("react-native-keyboard-controller");var rt=require("react");var nr={"input.placeholder":"Type a message...","search.placeholder":"Search chats...","status.online":"Online","status.offline":"Offline","status.typing":"typing...","message.deleted":"This message was deleted","message.sending":"Sending...","message.sent":"Sent","message.delivered":"Delivered","message.read":"Read","message.failed":"Failed to send","action.reply":"Reply","action.copy":"Copy","action.delete":"Delete","action.cancel":"Cancel","action.send":"Send","action.clear":"Clear","action.clearAll":"Clear All","attachment.add":"Add attachment","attachment.remove":"Remove","attachment.clear":"Clear","attachment.attachments":"Attachments:","accessibility.back":"Go back","accessibility.send":"Send message","accessibility.attach":"Add attachment","accessibility.emoji":"Add emoji","accessibility.videoCall":"Start video call","accessibility.voiceCall":"Start voice call","accessibility.info":"Chat info","accessibility.search":"Search chats","accessibility.typing":"Someone is typing","error.fileTooLarge":"File is too large","error.invalidFileType":"Invalid file type","error.maxAttachments":"Maximum attachments reached","error.networkError":"Network error occurred","time.justNow":"Just now","time.minutesAgo":"{{count}} min ago","time.hoursAgo":"{{count}}h ago","time.daysAgo":"{{count}}d ago","time.weeksAgo":"{{count}}w ago","time.monthsAgo":"{{count}}mo ago","time.yearsAgo":"{{count}}y ago","date.today":"Today","date.yesterday":"Yesterday","date.todayWithTime":"Today {{time}}","date.yesterdayWithTime":"Yesterday {{time}}"},ir={"input.placeholder":"Napisz wiadomo\u015B\u0107...","search.placeholder":"Szukaj czat\xF3w...","status.online":"Online","status.offline":"Offline","status.typing":"pisze...","message.deleted":"Ta wiadomo\u015B\u0107 zosta\u0142a usuni\u0119ta","message.sending":"Wysy\u0142anie...","message.sent":"Wys\u0142ano","message.delivered":"Dostarczono","message.read":"Przeczytano","message.failed":"Nie uda\u0142o si\u0119 wys\u0142a\u0107","action.reply":"Odpowiedz","action.copy":"Kopiuj","action.delete":"Usu\u0144","action.cancel":"Anuluj","action.send":"Wy\u015Blij","action.clear":"Wyczy\u015B\u0107","action.clearAll":"Wyczy\u015B\u0107 wszystko","attachment.add":"Dodaj za\u0142\u0105cznik","attachment.remove":"Usu\u0144","attachment.clear":"Wyczy\u015B\u0107","attachment.attachments":"Za\u0142\u0105czniki:","accessibility.back":"Wr\xF3\u0107","accessibility.send":"Wy\u015Blij wiadomo\u015B\u0107","accessibility.attach":"Dodaj za\u0142\u0105cznik","accessibility.emoji":"Dodaj emoji","accessibility.videoCall":"Rozpocznij wideorozmow\u0119","accessibility.voiceCall":"Rozpocznij rozmow\u0119 g\u0142osow\u0105","accessibility.info":"Informacje o czacie","accessibility.search":"Szukaj czat\xF3w","accessibility.typing":"Kto\u015B pisze","error.fileTooLarge":"Plik jest za du\u017Cy","error.invalidFileType":"Nieprawid\u0142owy typ pliku","error.maxAttachments":"Osi\u0105gni\u0119to maksymaln\u0105 liczb\u0119 za\u0142\u0105cznik\xF3w","error.networkError":"Wyst\u0105pi\u0142 b\u0142\u0105d sieci","time.justNow":"W\u0142a\u015Bnie teraz","time.minutesAgo":"{{count}} min temu","time.hoursAgo":"{{count}}h temu","time.daysAgo":"{{count}}d temu","time.weeksAgo":"{{count}}t temu","time.monthsAgo":"{{count}}mies temu","time.yearsAgo":"{{count}}l temu","date.today":"Dzisiaj","date.yesterday":"Wczoraj","date.todayWithTime":"Dzisiaj {{time}}","date.yesterdayWithTime":"Wczoraj {{time}}"},Yt={en:nr,pl:ir},zt=T=>Yt[T]||Yt.en,Gt=T=>T==="en"||T==="pl";var Zo=(0,rt.createContext)(void 0),_t=({children:T,locale:R="en",fallbackLocale:M="en"})=>{let[C,S]=(0,rt.useState)(R),A=(0,rt.useCallback)((z,E={})=>{let B=zt(C)[z];return!B&&C!==M&&(B=zt(M)[z]),B?B.replace(/\{\{(\w+)\}\}/g,(k,V)=>E[V]?.toString()||k):(console.warn(`Translation missing for key: ${z} in locale: ${C}`),z)},[C,M]),I=(0,rt.useCallback)(z=>{Gt(z)?S(z):(console.warn(`Unsupported locale: ${z}. Falling back to 'en'`),S("en"))},[]),P={t:A,locale:C,setLocale:I};return<Zo.Provider value={P}>
15
+ {T}
16
+ </Zo.Provider>},Qo=()=>{let T=(0,rt.useContext)(Zo);if(!T)throw new Error("useTranslation must be used within an I18nProvider");return T},ke=()=>{let T=(0,rt.useContext)(Zo);return T?T.t:R=>R};var Ss=(0,wo.createContext)(null),lr=({children:T,config:R={},locale:M="en"})=>{let C={keyboardBehavior:"padding",keyboardVerticalOffset:60,enableReactionDetails:!0,enableMessageActions:!0,enableScrollToBottom:!0,enableTypingIndicator:!0,...R};return<_t locale={M}>
17
+ <Ss.Provider value={{config:C}}>
18
+ <Io.KeyboardProvider>
19
+ <Io.KeyboardAvoidingView behavior={C.keyboardBehavior}style={[cr.keyboardContainer]}keyboardVerticalOffset={C.keyboardVerticalOffset}>
20
20
  {}
21
- {C}
22
- </Lo.KeyboardAvoidingView>
23
- </Lo.KeyboardProvider>
24
- </Vs.Provider>
25
- </Xt>},rs=un,Zt=()=>{let C=(0,Do.useContext)(Vs);if(!C)throw new Error("useChatConfig must be used within a ChatProvider");return C.config},mn=zs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var nt=require("react"),Qt=(C={})=>{let{uploader:R,maxAttachments:M=10,maxFileSize:T=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=C,[z,E]=(0,nt.useState)([]),[v,k]=(0,nt.useState)(!1),[D,V]=(0,nt.useState)(0),B=(0,nt.useCallback)(N=>{if(z.length>=M){console.warn(`Maximum ${M} attachments allowed`);return}if(N.data?.size&&N.data.size>T){console.warn(`File size exceeds ${T/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(Le=>Le.endsWith("/*")?N.data.type.startsWith(Le.slice(0,-1)):N.data.type===Le)){console.warn(`File type ${N.data.type} not allowed`);return}let O={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(te=>[...te,O]),A&&A(O)},[z.length,M,T,S,A]),L=(0,nt.useCallback)(N=>{E(O=>O.filter(te=>te.id!==N)),I&&I(N)},[I]),F=(0,nt.useCallback)(()=>{E([])},[]),j=(0,nt.useCallback)(async N=>{try{let O;switch(N){case"image":O={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":O={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":O={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":O={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 te={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:O.data,fileName:O.data.fileName||O.data.name,fileSize:O.data.fileSize||O.data.size,mimeType:O.data.mimeType,uploadStatus:"pending",uploadProgress:0};B(te)}catch(O){console.error("Error opening picker:",O)}},[B]),H=(0,nt.useCallback)(async()=>{if(!R)return console.warn("No uploader provided, skipping upload"),z;if(z.length===0)return[];k(!0),V(0);try{let N=z.map(async(Ce,Ee)=>{try{E(Ye=>Ye.map(U=>U.id===Ce.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Me=setInterval(()=>{E(Ye=>Ye.map(U=>U.id===Ce.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),ke=await R.upload(Ce.data);clearInterval(Me);let Ae={...Ce,uploadStatus:"completed",uploadProgress:100,data:{...Ce.data,url:ke.url,metadata:ke.metadata}};return E(Ye=>Ye.map(U=>U.id===Ce.id?Ae:U)),Ae}catch(Me){return console.error(`Error uploading attachment ${Ce.id}:`,Me),E(ke=>ke.map(Ae=>Ae.id===Ce.id?{...Ae,uploadStatus:"failed",uploadProgress:0}:Ae)),{...Ce,uploadStatus:"failed",uploadProgress:0}}}),O=await Promise.all(N),Le=O.filter(Ce=>Ce.uploadStatus==="completed").length/O.length*100;return V(Le),P&&P(O),O}catch(N){return console.error("Error uploading attachments:",N),z}finally{k(!1)}},[z,R,P]);return{attachments:z,openPicker:j,addAttachment:B,removeAttachment:L,clearAttachments:F,uploadAttachments:H,isUploading:v,uploadProgress:D}};var Je=require("react"),Bs=(C={})=>{let{onSend:R,onFocus:M,initialValue:T="",maxLength:S=1e3}=C,[A,I]=(0,Je.useState)(T),[P,z]=(0,Je.useState)(40),[E,v]=(0,Je.useState)(!1),k=(0,Je.useCallback)(H=>{H.length<=S&&I(H)},[S]),D=(0,Je.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();R&&R(N,H),I(""),z(40)},[A,R]),V=(0,Je.useCallback)(()=>{v(!0),M&&M()},[M]),B=(0,Je.useCallback)(()=>{v(!1)},[]),L=(0,Je.useCallback)(H=>{z(Math.max(40,Math.min(H,120)))},[]),F=(0,Je.useCallback)(()=>{I(""),z(40)},[]),j=(0,Je.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:k,handleSend:D,handleFocus:V,handleBlur:B,handleContentSizeChange:L,clearMessage:F,setMessage:j}};var pn=({messages:C,components:R={},renderProps:M={},onMessageSend:T,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:z,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:k=["image/*","application/pdf","text/*"],enableReactionDetails:D,enableMessageActions:V=!0,enableScrollToBottom:B,enableTypingIndicator:L,isTyping:F=!1,typingUserName:j,isLoading:H=!1,loadingComponent:N})=>{let O=Zt(),[te,Le]=(0,Pe.useState)(!1),Ce=R.MessageList||pt,Ee=R.MessageInput||mt,Me=D??O.enableReactionDetails??!0,ke=V??O.enableMessageActions??!0,Ae=B??O.enableScrollToBottom??!0,Ye=L??O.enableTypingIndicator??!0,[U,Ge]=(0,Pe.useState)(null),Oe=(0,Pe.useRef)(null),[Mt,Te]=(0,Pe.useState)(C||[]),_e=(0,Pe.useRef)((C||[]).length+1);Pe.default.useEffect(()=>{C&&(Te(C),_e.current=C.length+1)},[C]),Pe.default.useEffect(()=>{if(U&&Oe.current){let K=setTimeout(()=>{Oe.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let Ze=Qt({uploader:z,maxAttachments:E,maxFileSize:v,allowedTypes:k}),we=Bs({onSend:(K,G)=>{if(U){let J={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],ve={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:J,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}}};Te(Qe=>[...Qe,ve]),T&&T(ve)}else{let q={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:J};Te(ve=>[...ve,q]),T&&T(q)}Ge(null)}else if(G&&G.length>0){let J=G[0],q={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:G,type:J.type==="image"?"image":"text",...J.type==="image"&&J.data&&{imageData:{uri:J.data.uri||"",width:J.data.width||300,height:J.data.height||200,fileName:J.fileName||"image.jpg",fileSize:J.fileSize||0}}};Te(ve=>[...ve,q]),T&&T(q)}else{let J={id:_e.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Te(q=>[...q,J]),T&&T(J)}Ze.clearAttachments()},onFocus:()=>{}}),Pt=(0,Pe.useCallback)((K,G)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",G),Te(J=>J.map(q=>q.id===K?q.reactions?.find(Qe=>Qe.emoji===G)?{...q,reactions:q.reactions?.map(Qe=>Qe.emoji===G?{...Qe,count:Qe.count+1,users:[...Qe.users,"currentUser"]}:Qe)}:{...q,reactions:[...q.reactions||[],{emoji:G,count:1,users:["currentUser"]}]}:q)),S&&S(K,G)},[S]),Tt=(0,Pe.useCallback)((K,G)=>{Te(J=>J.map(q=>q.id===K?{...q,reactions:q.reactions?.map(ve=>ve.emoji===G?{...ve,count:Math.max(0,ve.count-1),users:ve.users.filter(Qe=>Qe!=="currentUser")}:ve).filter(ve=>ve.count>0)}:q)),A&&A(K,G)},[A]),ss=(0,Pe.useCallback)(K=>{Te(G=>G.map(J=>J.id===K?{...J,deleted:!0,text:"",reactions:void 0}:J)),I&&I(K)},[I]),ze=(0,Pe.useCallback)(()=>{Ge(null)},[]),Ne=(0,Pe.useCallback)(K=>{Ge(K),setTimeout(()=>{Oe.current?.focus()},100)},[]),Gt=(0,Pe.useCallback)(K=>{if(te)return;let{layout:G}=K.nativeEvent;G.height<=0||Le(!0)},[te]);if(H)return<at.View style={St.container}>
26
- {N||<at.View style={St.loadingContainer}>
21
+ {T}
22
+ </Io.KeyboardAvoidingView>
23
+ </Io.KeyboardProvider>
24
+ </Ss.Provider>
25
+ </_t>},es=lr,Jt=()=>{let T=(0,wo.useContext)(Ss);if(!T)throw new Error("useChatConfig must be used within a ChatProvider");return T.config},cr=Rs.StyleSheet.create({container:{flex:1},keyboardContainer:{flex:1,overflow:"hidden"}});var at=require("react"),Xt=(T={})=>{let{uploader:R,maxAttachments:M=10,maxFileSize:C=10*1024*1024,allowedTypes:S=["image/*","application/pdf","text/*"],onAttachmentAdd:A,onAttachmentRemove:I,onAttachmentUpload:P}=T,[z,E]=(0,at.useState)([]),[v,B]=(0,at.useState)(!1),[k,V]=(0,at.useState)(0),D=(0,at.useCallback)(N=>{if(z.length>=M){console.warn(`Maximum ${M} attachments allowed`);return}if(N.data?.size&&N.data.size>C){console.warn(`File size exceeds ${C/(1024*1024)}MB limit`);return}if(N.data?.type&&!S.some(je=>je.endsWith("/*")?N.data.type.startsWith(je.slice(0,-1)):N.data.type===je)){console.warn(`File type ${N.data.type} not allowed`);return}let F={...N,id:N.id||`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,uploadStatus:"pending",uploadProgress:0};E(te=>[...te,F]),A&&A(F)},[z.length,M,C,S,A]),L=(0,at.useCallback)(N=>{E(F=>F.filter(te=>te.id!==N)),I&&I(N)},[I]),O=(0,at.useCallback)(()=>{E([])},[]),j=(0,at.useCallback)(async N=>{try{let F;switch(N){case"image":F={type:"image",data:{uri:"mock-image-uri",width:800,height:600,fileName:"image.jpg",fileSize:1024*1024}};break;case"document":F={type:"document",data:{uri:"mock-document-uri",name:"document.pdf",size:2048*1024,mimeType:"application/pdf"}};break;case"location":F={type:"location",data:{coordinates:{latitude:0,longitude:0},address:"Mock Address",timestamp:Date.now()}};break;case"contact":F={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 te={id:`att_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:N,data:F.data,fileName:F.data.fileName||F.data.name,fileSize:F.data.fileSize||F.data.size,mimeType:F.data.mimeType,uploadStatus:"pending",uploadProgress:0};D(te)}catch(F){console.error("Error opening picker:",F)}},[D]),H=(0,at.useCallback)(async()=>{if(!R)return console.warn("No uploader provided, skipping upload"),z;if(z.length===0)return[];B(!0),V(0);try{let N=z.map(async(Te,Ee)=>{try{E(qe=>qe.map(U=>U.id===Te.id?{...U,uploadStatus:"uploading",uploadProgress:0}:U));let Me=setInterval(()=>{E(qe=>qe.map(U=>U.id===Te.id?{...U,uploadProgress:Math.min((U.uploadProgress??0)+10,90)}:U))},100),Be=await R.upload(Te.data);clearInterval(Me);let Ae={...Te,uploadStatus:"completed",uploadProgress:100,data:{...Te.data,url:Be.url,metadata:Be.metadata}};return E(qe=>qe.map(U=>U.id===Te.id?Ae:U)),Ae}catch(Me){return console.error(`Error uploading attachment ${Te.id}:`,Me),E(Be=>Be.map(Ae=>Ae.id===Te.id?{...Ae,uploadStatus:"failed",uploadProgress:0}:Ae)),{...Te,uploadStatus:"failed",uploadProgress:0}}}),F=await Promise.all(N),je=F.filter(Te=>Te.uploadStatus==="completed").length/F.length*100;return V(je),P&&P(F),F}catch(N){return console.error("Error uploading attachments:",N),z}finally{B(!1)}},[z,R,P]);return{attachments:z,openPicker:j,addAttachment:D,removeAttachment:L,clearAttachments:O,uploadAttachments:H,isUploading:v,uploadProgress:k}};var _e=require("react"),ws=(T={})=>{let{onSend:R,onFocus:M,initialValue:C="",maxLength:S=1e3}=T,[A,I]=(0,_e.useState)(C),[P,z]=(0,_e.useState)(40),[E,v]=(0,_e.useState)(!1),B=(0,_e.useCallback)(H=>{H.length<=S&&I(H)},[S]),k=(0,_e.useCallback)(H=>{if(!A.trim()&&(!H||H.length===0))return;let N=A.trim();R&&R(N,H),I(""),z(40)},[A,R]),V=(0,_e.useCallback)(()=>{v(!0),M&&M()},[M]),D=(0,_e.useCallback)(()=>{v(!1)},[]),L=(0,_e.useCallback)(H=>{z(Math.max(40,Math.min(H,120)))},[]),O=(0,_e.useCallback)(()=>{I(""),z(40)},[]),j=(0,_e.useCallback)(H=>{I(H)},[]);return{message:A,composerHeight:P,isFocused:E,handleTextChange:B,handleSend:k,handleFocus:V,handleBlur:D,handleContentSizeChange:L,clearMessage:O,setMessage:j}};var dr=({messages:T,components:R={},renderProps:M={},onMessageSend:C,onReactionAdd:S,onReactionRemove:A,onMessageDelete:I,onActionPress:P,attachmentUploader:z,maxAttachments:E=10,maxFileSize:v=10*1024*1024,allowedFileTypes:B=["image/*","application/pdf","text/*"],enableReactionDetails:k,enableMessageActions:V=!0,enableScrollToBottom:D,enableTypingIndicator:L,isTyping:O=!1,typingUserName:j,isLoading:H=!1,loadingComponent:N})=>{let F=Jt(),[te,je]=(0,Pe.useState)(!1),Te=R.MessageList||pt,Ee=R.MessageInput||mt,Me=k??F.enableReactionDetails??!0,Be=V??F.enableMessageActions??!0,Ae=D??F.enableScrollToBottom??!0,qe=L??F.enableTypingIndicator??!0,[U,Ye]=(0,Pe.useState)(null),Fe=(0,Pe.useRef)(null),[Mt,Ce]=(0,Pe.useState)(T||[]),Ge=(0,Pe.useRef)((T||[]).length+1);Pe.default.useEffect(()=>{T&&(Ce(T),Ge.current=T.length+1)},[T]),Pe.default.useEffect(()=>{if(U&&Fe.current){let K=setTimeout(()=>{Fe.current?.focus()},150);return()=>clearTimeout(K)}},[U]);let Xe=Xt({uploader:z,maxAttachments:E,maxFileSize:v,allowedTypes:B}),we=ws({onSend:(K,_)=>{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(_&&_.length>0){let $=_[0],ve={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X,attachments:_,type:$.type==="image"?"image":"text",...$.type==="image"&&$.data&&{imageData:{uri:$.data.uri||"",width:$.data.width||300,height:$.data.height||200,fileName:$.fileName||"image.jpg",fileSize:$.fileSize||0}}};Ce(Ze=>[...Ze,ve]),C&&C(ve)}else{let $={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:X};Ce(ve=>[...ve,$]),C&&C($)}Ye(null)}else if(_&&_.length>0){let X=_[0],$={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent",attachments:_,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}}};Ce(ve=>[...ve,$]),C&&C($)}else{let X={id:Ge.current++,text:K.trim(),isMe:!0,timestamp:new Date().toISOString(),status:"sent"};Ce($=>[...$,X]),C&&C(X)}Xe.clearAttachments()},onFocus:()=>{}}),Pt=(0,Pe.useCallback)((K,_)=>{console.log("\u{1F525} Chat - addReaction called with messageId:",K,"and emoji:",_),Ce(X=>X.map($=>$.id===K?$.reactions?.find(Ze=>Ze.emoji===_)?{...$,reactions:$.reactions?.map(Ze=>Ze.emoji===_?{...Ze,count:Ze.count+1,users:[...Ze.users,"currentUser"]}:Ze)}:{...$,reactions:[...$.reactions||[],{emoji:_,count:1,users:["currentUser"]}]}:$)),S&&S(K,_)},[S]),Ct=(0,Pe.useCallback)((K,_)=>{Ce(X=>X.map($=>$.id===K?{...$,reactions:$.reactions?.map(ve=>ve.emoji===_?{...ve,count:Math.max(0,ve.count-1),users:ve.users.filter(Ze=>Ze!=="currentUser")}:ve).filter(ve=>ve.count>0)}:$)),A&&A(K,_)},[A]),Xo=(0,Pe.useCallback)(K=>{Ce(_=>_.map(X=>X.id===K?{...X,deleted:!0,text:"",reactions:void 0}:X)),I&&I(K)},[I]),ze=(0,Pe.useCallback)(()=>{Ye(null)},[]),Ne=(0,Pe.useCallback)(K=>{Ye(K),setTimeout(()=>{Fe.current?.focus()},100)},[]),qt=(0,Pe.useCallback)(K=>{if(te)return;let{layout:_}=K.nativeEvent;_.height<=0||je(!0)},[te]);if(H)return<nt.View style={St.container}>
26
+ {N||<nt.View style={St.loadingContainer}>
27
27
  {}
28
- </at.View>}
29
- </at.View>;if(!te)return<at.View style={St.container}>
30
- <at.View style={St.chatContainer}onLayout={Gt}>
31
- <at.View style={St.loadingContainer}>{N}</at.View>
32
- </at.View>
33
- </at.View>;let Ts=M.renderInput;return<at.View style={St.container}>
34
- <at.View style={St.fill}>
35
- <Ce messages={Mt}isTyping={Ye?F:!1}typingUserName={j}showScrollToBottom={Ae}isReplyActive={!!U}enableMessageActions={ke}enableReactionDetails={Me}onReactionAdd={Pt}onReactionRemove={Tt}onMessageDelete={ss}onReplyMessage={Ne}onActionPress={(K,G)=>{K==="reply"?Ne(G):P?.(K,G)}}/>
28
+ </nt.View>}
29
+ </nt.View>;if(!te)return<nt.View style={St.container}>
30
+ <nt.View style={St.chatContainer}onLayout={qt}>
31
+ <nt.View style={St.loadingContainer}>{N}</nt.View>
32
+ </nt.View>
33
+ </nt.View>;let hs=M.renderInput;return<nt.View style={St.container}>
34
+ <nt.View style={St.fill}>
35
+ <Te messages={Mt}isTyping={qe?O:!1}typingUserName={j}showScrollToBottom={Ae}isReplyActive={!!U}enableMessageActions={Be}enableReactionDetails={Me}onReactionAdd={Pt}onReactionRemove={Ct}onMessageDelete={Xo}onReplyMessage={Ne}onActionPress={(K,_)=>{K==="reply"?Ne(_):P?.(K,_)}}/>
36
36
 
37
- {Ts?Ts({value:we.message,onChangeText:we.handleTextChange,onSend:we.handleSend,onFocus:we.handleFocus,height:we.composerHeight,onContentSizeChange:we.handleContentSizeChange,replyToMessage:U,onCancelReply:ze,attachments:Ze.attachments,onAttachmentAdd:Ze.addAttachment,onAttachmentRemove:Ze.removeAttachment,onAttachmentUpload:Ze.uploadAttachments}):<Ee ref={Oe}value={we.message}onChangeText={we.handleTextChange}onSend={we.handleSend}onFocus={we.handleFocus}height={we.composerHeight}onContentSizeChange={we.handleContentSizeChange}replyToMessage={U}onCancelReply={ze}onAttachmentSend={(K,G)=>{let J=K.type==="image",q={id:_e.current++,text:G?.trim()||"",isMe:!0,timestamp:new Date().toISOString(),status:"sent",type:J?"image":"text",...J&&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}}};Te(ve=>[...ve,q]),T&&T(q),we.handleTextChange("")}}/>}
37
+ {hs?hs({value:we.message,onChangeText:we.handleTextChange,onSend:we.handleSend,onFocus:we.handleFocus,height:we.composerHeight,onContentSizeChange:we.handleContentSizeChange,replyToMessage:U,onCancelReply:ze,attachments:Xe.attachments,onAttachmentAdd:Xe.addAttachment,onAttachmentRemove:Xe.removeAttachment,onAttachmentUpload:Xe.uploadAttachments}):<Ee ref={Fe}value={we.message}onChangeText={we.handleTextChange}onSend={we.handleSend}onFocus={we.handleFocus}height={we.composerHeight}onContentSizeChange={we.handleContentSizeChange}replyToMessage={U}onCancelReply={ze}onAttachmentSend={(K,_)=>{let X=K.type==="image",$={id:Ge.current++,text:_?.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}}};Ce(ve=>[...ve,$]),C&&C($),we.handleTextChange("")}}/>}
38
38
 
39
39
  {}
40
- </at.View>
40
+ </nt.View>
41
41
 
42
42
  {}
43
- </at.View>},St=at.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),is=pn;var Ie=require("react-native"),gt=require("lucide-react-native");var Ds=require("react");var jo=require("react");var Vt={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 ls=(0,jo.createContext)(Vt),gn=(C,R)=>({colors:{...C.colors,...R.colors},spacing:{...C.spacing,...R.spacing},borderRadius:{...C.borderRadius,...R.borderRadius},typography:{...C.typography,...R.typography}}),ks=({children:C,theme:R})=>{let M=(0,jo.useMemo)(()=>R?gn(Vt,R):Vt,[R]);return<ls.Provider value={M}>{C}</ls.Provider>};var $=()=>{let C=(0,Ds.useContext)(ls);if(!C)throw new Error("useTheme must be used within a ThemeProvider");return C};var hn=({name:C="George Alan",isOnline:R=!0,onBack:M=()=>{},onVideoCall:T=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=$(),P=We();return<Ie.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}}>
43
+ </nt.View>},St=nt.StyleSheet.create({container:{flex:1},chatContainer:{flex:1,overflow:"hidden"},fill:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center"}}),ts=dr;var Ie=require("react-native"),gt=require("lucide-react-native");var vs=require("react");var vo=require("react");var Vt={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 os=(0,vo.createContext)(Vt),ur=(T,R)=>({colors:{...T.colors,...R.colors},spacing:{...T.spacing,...R.spacing},borderRadius:{...T.borderRadius,...R.borderRadius},typography:{...T.typography,...R.typography}}),Is=({children:T,theme:R})=>{let M=(0,vo.useMemo)(()=>R?ur(Vt,R):Vt,[R]);return<os.Provider value={M}>{T}</os.Provider>};var q=()=>{let T=(0,vs.useContext)(os);if(!T)throw new Error("useTheme must be used within a ThemeProvider");return T};var mr=({name:T="George Alan",isOnline:R=!0,onBack:M=()=>{},onVideoCall:C=()=>{},onVoiceCall:S=()=>{},onInfo:A=()=>{}})=>{let I=q(),P=ke();return<Ie.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}}>
44
44
  <Ie.View style={{flex:1,flexDirection:"row",alignItems:"center"}}>
45
45
  <Ie.TouchableOpacity onPress={M}style={{marginRight:I.spacing.md}}>
46
46
  <gt.ArrowLeft size={24}color={I.colors.gray[700]}/>
@@ -59,7 +59,7 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
59
59
 
60
60
  <Ie.View style={{flex:1}}>
61
61
  <Ie.Text style={{fontSize:I.typography.fontSize.lg,fontWeight:I.typography.fontWeight.semibold,color:I.colors.text}}>
62
- {C}
62
+ {T}
63
63
  </Ie.Text>
64
64
  <Ie.Text style={{fontSize:I.typography.fontSize.sm,color:I.colors.textSecondary}}>
65
65
  {P(R?"status.online":"status.offline")}
@@ -70,7 +70,7 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
70
70
 
71
71
  <Ie.View style={{flexDirection:"row",alignItems:"center",gap:I.spacing.lg}}>
72
72
  {}
73
- {T&&<Ie.TouchableOpacity onPress={T}>
73
+ {C&&<Ie.TouchableOpacity onPress={C}>
74
74
  <gt.Video size={24}color={I.colors.gray[700]}/>
75
75
  </Ie.TouchableOpacity>}
76
76
  {S&&<Ie.TouchableOpacity onPress={S}>
@@ -80,32 +80,32 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
80
80
  <gt.Info size={24}color={I.colors.gray[700]}/>
81
81
  </Ie.TouchableOpacity>}
82
82
  </Ie.View>
83
- </Ie.View>},Eo=hn;var Hs=require("react"),Se=require("react-native");var Bt=X(require("dayjs")),Ls=X(require("dayjs/plugin/isToday")),js=X(require("dayjs/plugin/isYesterday"));Bt.default.extend(Ls.default);Bt.default.extend(js.default);var fn=C=>{let R=(0,Bt.default)(C);return R.isToday()?"Today":R.isYesterday()?"Yesterday":R.format("ddd D MMMM")},yn=C=>(0,Bt.default)(C).format("YYYY-MM-DD"),Es=C=>{if(C.length===0)return[];let R=[],M=null;return C.forEach((T,S)=>{let A=yn(T.timestamp);if(M!==A){let P=fn(T.timestamp),z={id:`date-${A}`,listItemType:"date-separator",date:A,displayDate:P};R.push(z),M=A}let I={...T,listItemType:"message"};R.push(I)}),R},cs=C=>(0,Bt.default)(C).format("HH:mm");var et=require("react-native");var xn=({replyTo:C,isMyMessage:R})=>{let M=$(),T=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=R?"rgba(255, 255, 255, 0.3)":M.colors.primary,A=R?"rgba(255, 255, 255, 0.8)":M.colors.primary,I=R?"rgba(255, 255, 255, 0.7)":M.colors.textSecondary,P=R?"rgba(255, 255, 255, 0.1)":M.colors.surfaceSecondary,z=C.type==="image"&&C.imageData;return<et.View style={{marginBottom:M.spacing.sm,borderRadius:M.borderRadius.md,padding:M.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
83
+ </Ie.View>},Po=mr;var Es=require("react"),Se=require("react-native");var Qe=Y(require("dayjs")),Ps=Y(require("dayjs/plugin/isToday")),As=Y(require("dayjs/plugin/isYesterday")),zs=Y(require("dayjs/plugin/relativeTime")),Vs=Y(require("dayjs/plugin/localizedFormat")),Ga=require("dayjs/locale/pl"),_a=require("dayjs/locale/en");Qe.default.extend(Ps.default);Qe.default.extend(As.default);Qe.default.extend(zs.default);Qe.default.extend(Vs.default);var pr=(T,R="en")=>{let M=(0,Qe.default)(T).locale(R);return M.isToday()?R==="pl"?"Dzisiaj":"Today":M.isYesterday()?R==="pl"?"Wczoraj":"Yesterday":M.format("ddd D MMMM")},Ds=(T,R,M="en")=>{let C=(0,Qe.default)(T).locale(M);return C.isToday()?R("date.today"):C.isYesterday()?R("date.yesterday"):C.format("ddd D MMMM")},gr=T=>(0,Qe.default)(T).format("YYYY-MM-DD"),Ao=(T,R="en")=>{if(T.length===0)return[];let M=[],C=null;return T.forEach((S,A)=>{let I=gr(S.timestamp);if(C!==I){let z=pr(S.timestamp,R),E={id:`date-${I}`,listItemType:"date-separator",date:I,displayDate:z};M.push(E),C=I}let P={...S,listItemType:"message"};M.push(P)}),M},Zt=(T,R="en")=>(0,Qe.default)(T).locale(R).format("HH:mm"),Bs=(T,R="en")=>(0,Qe.default)(T).locale(R).fromNow();var ks=(T,R,M="en")=>{let C=(0,Qe.default)(T).locale(M);return C.isToday()?R("date.todayWithTime",{time:C.format("HH:mm")}):C.isYesterday()?R("date.yesterdayWithTime",{time:C.format("HH:mm")}):C.format("DD MMM YYYY HH:mm")};var et=require("react-native");var hr=({replyTo:T,isMyMessage:R})=>{let M=q(),C=(E,v=50)=>E.length<=v?E:E.substring(0,v)+"...",S=R?"rgba(255, 255, 255, 0.3)":M.colors.primary,A=R?"rgba(255, 255, 255, 0.8)":M.colors.primary,I=R?"rgba(255, 255, 255, 0.7)":M.colors.textSecondary,P=R?"rgba(255, 255, 255, 0.1)":M.colors.surfaceSecondary,z=T.type==="image"&&T.imageData;return<et.View style={{marginBottom:M.spacing.sm,borderRadius:M.borderRadius.md,padding:M.spacing.sm,backgroundColor:P,borderLeftWidth:4,borderLeftColor:S}}>
84
84
  <et.Text style={{fontSize:M.typography.fontSize.xs,fontWeight:M.typography.fontWeight.medium,color:A,marginBottom:M.spacing.xs}}>
85
- {C.isMe?"You":C.senderName||"Sender"}
85
+ {T.isMe?"You":T.senderName||"Sender"}
86
86
  </et.Text>
87
87
 
88
88
  {z?<et.View style={{flexDirection:"row",alignItems:"center"}}>
89
- <et.Image source={{uri:C.imageData.uri}}style={{width:40,height:40,borderRadius:M.borderRadius.sm,marginRight:M.spacing.sm}}resizeMode="cover"/>
89
+ <et.Image source={{uri:T.imageData.uri}}style={{width:40,height:40,borderRadius:M.borderRadius.sm,marginRight:M.spacing.sm}}resizeMode="cover"/>
90
90
  <et.View style={{flex:1}}>
91
91
  <et.Text style={{fontSize:M.typography.fontSize.xs,color:I,fontStyle:"italic",marginBottom:M.spacing.xs}}>
92
92
  📷 Image
93
93
  </et.Text>
94
- {C.text&&C.text.trim()&&<et.Text style={{fontSize:M.typography.fontSize.sm,color:I,lineHeight:M.typography.lineHeight.tight}}>
95
- {T(C.text,30)}
94
+ {T.text&&T.text.trim()&&<et.Text style={{fontSize:M.typography.fontSize.sm,color:I,lineHeight:M.typography.lineHeight.tight}}>
95
+ {C(T.text,30)}
96
96
  </et.Text>}
97
97
  </et.View>
98
98
  </et.View>:<et.Text style={{fontSize:M.typography.fontSize.sm,color:I,lineHeight:M.typography.lineHeight.tight}}>
99
- {T(C.text)}
99
+ {C(T.text)}
100
100
  </et.Text>}
101
- </et.View>},Dt=xn;var ct=require("react"),Re=require("react-native");var{width:ds,height:Os}=Re.Dimensions.get("window"),bn=({imageData:C,isMe:R,onImagePress:M,onLongPress:T})=>{let S=$(),[A,I]=(0,ct.useState)(!1),[P,z]=(0,ct.useState)(!1),v=(0,ct.useCallback)(()=>{let F=ds*.6,j=300;if(!C.width||!C.height)return{width:F,height:j};let H=C.width/C.height,N=F,O=N/H;return O>j&&(O=j,N=O*H),{width:Math.round(N),height:Math.round(O)}},[C.width,C.height])(),k=(0,ct.useCallback)(()=>{M?M():I(!0)},[M]),D=(0,ct.useCallback)(()=>{console.error("Failed to load image:",C.uri),z(!0)},[C.uri]),V=(0,ct.useCallback)(()=>{I(!1)},[]),L=(0,ct.useCallback)(()=>{if(!C.width||!C.height)return{width:ds,height:Os*.8};let F=C.width/C.height,j=ds*.9,H=Os*.8,N=j,O=N/F;return O>H&&(O=H,N=O*F),{width:Math.round(N),height:Math.round(O)}},[C.width,C.height])();return P?<Re.View style={[ht.errorContainer,{width:v.width,height:v.height,backgroundColor:R?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
101
+ </et.View>},Dt=hr;var ct=require("react"),Re=require("react-native");var{width:ss,height:Ls}=Re.Dimensions.get("window"),fr=({imageData:T,isMe:R,onImagePress:M,onLongPress:C})=>{let S=q(),[A,I]=(0,ct.useState)(!1),[P,z]=(0,ct.useState)(!1),v=(0,ct.useCallback)(()=>{let O=ss*.6,j=300;if(!T.width||!T.height)return{width:O,height:j};let H=T.width/T.height,N=O,F=N/H;return F>j&&(F=j,N=F*H),{width:Math.round(N),height:Math.round(F)}},[T.width,T.height])(),B=(0,ct.useCallback)(()=>{M?M():I(!0)},[M]),k=(0,ct.useCallback)(()=>{console.error("Failed to load image:",T.uri),z(!0)},[T.uri]),V=(0,ct.useCallback)(()=>{I(!1)},[]),L=(0,ct.useCallback)(()=>{if(!T.width||!T.height)return{width:ss,height:Ls*.8};let O=T.width/T.height,j=ss*.9,H=Ls*.8,N=j,F=N/O;return F>H&&(F=H,N=F*O),{width:Math.round(N),height:Math.round(F)}},[T.width,T.height])();return P?<Re.View style={[ht.errorContainer,{width:v.width,height:v.height,backgroundColor:R?S.colors.messageBubble.sent:S.colors.messageBubble.received,borderRadius:S.borderRadius.lg}]}>
102
102
  <Re.Text style={[ht.errorText,{color:R?S.colors.messageBubble.sentText:S.colors.messageBubble.receivedText,fontSize:S.typography.fontSize.sm}]}>
103
103
  Failed to load image
104
104
  </Re.Text>
105
105
  </Re.View>:<>
106
- <Re.Pressable onPress={k}onLongPress={T}delayLongPress={500}>
106
+ <Re.Pressable onPress={B}onLongPress={C}delayLongPress={500}>
107
107
  <Re.View style={[ht.imageContainer,{borderRadius:S.borderRadius.lg,overflow:"hidden"}]}>
108
- <Re.Image source={{uri:C.uri}}style={[ht.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={D}/>
108
+ <Re.Image source={{uri:T.uri}}style={[ht.image,{width:v.width,height:v.height}]}resizeMode='cover'onError={k}/>
109
109
 
110
110
  {}
111
111
  <Re.View style={ht.imageOverlay}/>
@@ -116,144 +116,144 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
116
116
  <Re.Modal visible={A}transparent animationType='fade'onRequestClose={V}>
117
117
  <Re.Pressable style={ht.modalContainer}onPress={V}>
118
118
  <Re.View style={ht.modalContent}>
119
- <Re.Image source={{uri:C.uri}}style={[ht.modalImage,{width:L.width,height:L.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
119
+ <Re.Image source={{uri:T.uri}}style={[ht.modalImage,{width:L.width,height:L.height,borderRadius:S.borderRadius.lg}]}resizeMode='contain'/>
120
120
  </Re.View>
121
121
  </Re.Pressable>
122
122
  </Re.Modal>
123
- </>},ht=Re.StyleSheet.create({imageContainer:{position:"relative"},image:{backgroundColor:"#f0f0f0"},imageOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent"},errorContainer:{justifyContent:"center",alignItems:"center",borderWidth:1,borderColor:"#e0e0e0"},errorText:{textAlign:"center",fontWeight:"500"},modalContainer:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.9)",justifyContent:"center",alignItems:"center"},modalContent:{justifyContent:"center",alignItems:"center"},modalImage:{backgroundColor:"transparent"}}),Oo=bn;var rt=require("react-native"),Fs=require("lucide-react-native");var Cn=({isMe:C,timestamp:R,senderName:M})=>{let T=$(),S=We();return<rt.View style={[Lt.container,{alignSelf:C?"flex-end":"flex-start",maxWidth:"80%"}]}>
124
- <rt.View style={[Lt.messageBubble,{backgroundColor:T.colors.gray[100],borderColor:T.colors.gray[200]}]}>
125
- <rt.View style={Lt.content}>
126
- <Fs.Trash2 size={16}color={T.colors.gray[500]}/>
127
- <rt.Text style={[Lt.deletedText,{color:T.colors.gray[500]}]}>
123
+ </>},ht=Re.StyleSheet.create({imageContainer:{position:"relative"},image:{backgroundColor:"#f0f0f0"},imageOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent"},errorContainer:{justifyContent:"center",alignItems:"center",borderWidth:1,borderColor:"#e0e0e0"},errorText:{textAlign:"center",fontWeight:"500"},modalContainer:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.9)",justifyContent:"center",alignItems:"center"},modalContent:{justifyContent:"center",alignItems:"center"},modalImage:{backgroundColor:"transparent"}}),Vo=fr;var it=require("react-native"),js=require("lucide-react-native");var yr=({isMe:T,timestamp:R,senderName:M})=>{let C=q(),S=ke();return<it.View style={[Bt.container,{alignSelf:T?"flex-end":"flex-start",maxWidth:"80%"}]}>
124
+ <it.View style={[Bt.messageBubble,{backgroundColor:C.colors.gray[100],borderColor:C.colors.gray[200]}]}>
125
+ <it.View style={Bt.content}>
126
+ <js.Trash2 size={16}color={C.colors.gray[500]}/>
127
+ <it.Text style={[Bt.deletedText,{color:C.colors.gray[500]}]}>
128
128
  {S("message.deleted")}
129
- </rt.Text>
130
- </rt.View>
131
- </rt.View>
132
- <rt.View style={[Lt.metadata,{alignSelf:C?"flex-end":"flex-start"}]}>
133
- <rt.Text style={[Lt.timestamp,{color:T.colors.gray[400]}]}>
129
+ </it.Text>
130
+ </it.View>
131
+ </it.View>
132
+ <it.View style={[Bt.metadata,{alignSelf:T?"flex-end":"flex-start"}]}>
133
+ <it.Text style={[Bt.timestamp,{color:C.colors.gray[400]}]}>
134
134
  {R}
135
- </rt.Text>
136
- </rt.View>
137
- </rt.View>},Lt=rt.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}}),Fo=Cn;var Mn=({message:C,onLongPress:R,onReactionPress:M})=>{let T=$(),S=(0,Hs.useRef)(null),A=()=>{S.current?S.current.measureInWindow((z,E,v,k)=>{let D={x:Math.round(z),y:Math.round(E),width:Math.round(v),height:Math.round(k)};R?.(C,D)}):R?.(C)},I=()=>{C.reactions&&C.reactions.length>0&&M?.(C)},P=C.type==="image"&&C.imageData;return C.deleted?<Fo isMe={C.isMe}timestamp={cs(C.timestamp)}senderName={C.senderName}/>:<Se.View style={{marginBottom:T.spacing.md,alignItems:C.isMe?"flex-end":"flex-start",marginHorizontal:T.spacing.sm}}>
138
- <Se.Pressable ref={S}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?T.borderRadius.lg:T.borderRadius.xl,borderBottomRightRadius:C.isMe?4:P?T.borderRadius.lg:T.borderRadius.xl,borderBottomLeftRadius:C.isMe?P?T.borderRadius.lg:T.borderRadius.xl:4,paddingHorizontal:P?0:T.spacing.lg,paddingVertical:P?0:T.spacing.md,backgroundColor:P?"transparent":C.isMe?T.colors.messageBubble.sent:T.colors.messageBubble.received,overflow:"hidden"}}>
139
- {C.replyTo&&<Dt replyTo={C.replyTo}isMyMessage={C.isMe}/>}
135
+ </it.Text>
136
+ </it.View>
137
+ </it.View>},Bt=it.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}}),Do=yr;var xr=({message:T,onLongPress:R,onReactionPress:M})=>{let C=q(),S=(0,Es.useRef)(null),A=()=>{S.current?S.current.measureInWindow((z,E,v,B)=>{let k={x:Math.round(z),y:Math.round(E),width:Math.round(v),height:Math.round(B)};R?.(T,k)}):R?.(T)},I=()=>{T.reactions&&T.reactions.length>0&&M?.(T)},P=T.type==="image"&&T.imageData;return T.deleted?<Do isMe={T.isMe}timestamp={Zt(T.timestamp)}senderName={T.senderName}/>:<Se.View style={{marginBottom:C.spacing.md,alignItems:T.isMe?"flex-end":"flex-start",marginHorizontal:C.spacing.sm}}>
138
+ <Se.Pressable ref={S}onLongPress={A}delayLongPress={500}style={{maxWidth:P?"75%":"80%",borderRadius:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomRightRadius:T.isMe?4:P?C.borderRadius.lg:C.borderRadius.xl,borderBottomLeftRadius:T.isMe?P?C.borderRadius.lg:C.borderRadius.xl:4,paddingHorizontal:P?0:C.spacing.lg,paddingVertical:P?0:C.spacing.md,backgroundColor:P?"transparent":T.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,overflow:"hidden"}}>
139
+ {T.replyTo&&<Dt replyTo={T.replyTo}isMyMessage={T.isMe}/>}
140
140
 
141
- {P?<Oo imageData={C.imageData}isMe={C.isMe}onLongPress={A}/>:<Se.Text style={{fontSize:T.typography.fontSize.base,color:C.isMe?T.colors.messageBubble.sentText:T.colors.messageBubble.receivedText}}>
142
- {C.text}
141
+ {P?<Vo imageData={T.imageData}isMe={T.isMe}onLongPress={A}/>:<Se.Text style={{fontSize:C.typography.fontSize.base,color:T.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
142
+ {T.text}
143
143
  </Se.Text>}
144
144
 
145
145
  {}
146
- {P&&C.text&&C.text.trim()&&<Se.View style={{paddingHorizontal:T.spacing.lg,paddingVertical:T.spacing.md,backgroundColor:C.isMe?T.colors.messageBubble.sent:T.colors.messageBubble.received,borderRadius:T.borderRadius.lg,marginTop:T.spacing.xs}}>
147
- <Se.Text style={{fontSize:T.typography.fontSize.base,color:C.isMe?T.colors.messageBubble.sentText:T.colors.messageBubble.receivedText}}>
148
- {C.text}
146
+ {P&&T.text&&T.text.trim()&&<Se.View style={{paddingHorizontal:C.spacing.lg,paddingVertical:C.spacing.md,backgroundColor:T.isMe?C.colors.messageBubble.sent:C.colors.messageBubble.received,borderRadius:C.borderRadius.lg,marginTop:C.spacing.xs}}>
147
+ <Se.Text style={{fontSize:C.typography.fontSize.base,color:T.isMe?C.colors.messageBubble.sentText:C.colors.messageBubble.receivedText}}>
148
+ {T.text}
149
149
  </Se.Text>
150
150
  </Se.View>}
151
151
  </Se.Pressable>
152
152
 
153
153
  {}
154
- {C.reactions&&C.reactions.length>0&&<Se.TouchableOpacity onPress={I}style={{marginTop:T.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:T.colors.background,borderRadius:T.borderRadius.full,justifyContent:C.isMe?"flex-end":"flex-start"}}>
155
- {C.reactions.map((z,E)=><Se.View key={`${z.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:T.spacing.xs}}>
156
- <Se.Text style={{fontSize:T.typography.fontSize.sm}}>
154
+ {T.reactions&&T.reactions.length>0&&<Se.TouchableOpacity onPress={I}style={{marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",backgroundColor:C.colors.background,borderRadius:C.borderRadius.full,justifyContent:T.isMe?"flex-end":"flex-start"}}>
155
+ {T.reactions.map((z,E)=><Se.View key={`${z.emoji}-${E}`}style={{flexDirection:"row",alignItems:"center",padding:C.spacing.xs}}>
156
+ <Se.Text style={{fontSize:C.typography.fontSize.sm}}>
157
157
  {z.emoji}
158
158
  </Se.Text>
159
- {z.count>1&&<Se.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary,marginLeft:T.spacing.xs,fontWeight:T.typography.fontWeight.medium}}>
159
+ {z.count>1&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary,marginLeft:C.spacing.xs,fontWeight:C.typography.fontWeight.medium}}>
160
160
  {z.count}
161
161
  </Se.Text>}
162
162
  </Se.View>)}
163
163
  </Se.TouchableOpacity>}
164
164
 
165
- <Se.View style={{marginHorizontal:T.spacing.sm,marginTop:T.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:C.isMe?"flex-end":"flex-start"}}>
166
- <Se.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.textSecondary}}>
167
- {cs(C.timestamp)}
165
+ <Se.View style={{marginHorizontal:C.spacing.sm,marginTop:C.spacing.xs,flexDirection:"row",alignItems:"center",justifyContent:T.isMe?"flex-end":"flex-start"}}>
166
+ <Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.textSecondary}}>
167
+ {Zt(T.timestamp)}
168
168
  </Se.Text>
169
- {C.isMe&&C.status&&<Se.View style={{marginLeft:T.spacing.xs}}>
170
- {C.status==="sent"&&<Se.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.gray[400]}}>
169
+ {T.isMe&&T.status&&<Se.View style={{marginLeft:C.spacing.xs}}>
170
+ {T.status==="sent"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
171
171
 
172
172
  </Se.Text>}
173
- {C.status==="delivered"&&<Se.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.gray[400]}}>
173
+ {T.status==="delivered"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.gray[400]}}>
174
174
  ✓✓
175
175
  </Se.Text>}
176
- {C.status==="read"&&<Se.Text style={{fontSize:T.typography.fontSize.xs,color:T.colors.primary}}>
176
+ {T.status==="read"&&<Se.Text style={{fontSize:C.typography.fontSize.xs,color:C.colors.primary}}>
177
177
  ✓✓
178
178
  </Se.Text>}
179
179
  </Se.View>}
180
180
  </Se.View>
181
- </Se.View>},Ho=Mn;var Z=require("react-native"),Ns=require("lucide-react-native");var Tn=({replyToMessage:C,onCancel:R})=>{let M=$(),T=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!C.replyTo,A=C.type==="image"&&C.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:M.colors.border,backgroundColor:M.colors.surface,paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md}}>
181
+ </Se.View>},Bo=xr;var Z=require("react-native"),Fs=require("lucide-react-native");var br=({replyToMessage:T,onCancel:R})=>{let M=q(),C=(I,P=50)=>I.length<=P?I:I.substring(0,P)+"...",S=!!T.replyTo,A=T.type==="image"&&T.imageData;return<Z.View style={{borderBottomWidth:1,borderBottomColor:M.colors.border,backgroundColor:M.colors.surface,paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md}}>
182
182
  <Z.View style={{flexDirection:"row",alignItems:"center",justifyContent:"space-between"}}>
183
183
  <Z.View style={{flex:1,marginRight:M.spacing.md}}>
184
184
  <Z.View style={{flexDirection:"row",alignItems:"center",marginBottom:M.spacing.xs}}>
185
185
  <Z.View style={{width:4,backgroundColor:M.colors.primary,borderRadius:M.borderRadius.full,marginRight:M.spacing.md,height:S?48:32}}/>
186
186
  <Z.View style={{flex:1}}>
187
187
  <Z.Text style={{fontSize:M.typography.fontSize.xs,fontWeight:M.typography.fontWeight.medium,color:M.colors.primary,marginBottom:M.spacing.xs}}>
188
- Replying to {C.isMe?"yourself":C.senderName||"sender"}
188
+ Replying to {T.isMe?"yourself":T.senderName||"sender"}
189
189
  {S&&" (reply thread)"}
190
190
  </Z.Text>
191
191
 
192
192
  {}
193
193
  {S&&<Z.View style={{marginBottom:M.spacing.sm,padding:M.spacing.sm,backgroundColor:M.colors.surfaceSecondary,borderRadius:M.borderRadius.md,borderLeftWidth:2,borderLeftColor:M.colors.gray[300]}}>
194
194
  <Z.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary,marginBottom:M.spacing.xs}}>
195
- Originally replying to: {C.replyTo.isMe?"yourself":C.replyTo.senderName||"sender"}
195
+ Originally replying to: {T.replyTo.isMe?"yourself":T.replyTo.senderName||"sender"}
196
196
  </Z.Text>
197
197
  <Z.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.textSecondary,lineHeight:M.typography.lineHeight.tight}}>
198
- {T(C.replyTo.text,40)}
198
+ {C(T.replyTo.text,40)}
199
199
  </Z.Text>
200
200
  </Z.View>}
201
201
 
202
202
  {A?<Z.View style={{flexDirection:"row",alignItems:"center"}}>
203
- <Z.Image source={{uri:C.imageData.uri}}style={{width:32,height:32,borderRadius:M.borderRadius.sm,marginRight:M.spacing.sm}}resizeMode="cover"/>
203
+ <Z.Image source={{uri:T.imageData.uri}}style={{width:32,height:32,borderRadius:M.borderRadius.sm,marginRight:M.spacing.sm}}resizeMode="cover"/>
204
204
  <Z.View style={{flex:1}}>
205
205
  <Z.Text style={{fontSize:M.typography.fontSize.xs,color:M.colors.gray[600],fontStyle:"italic",marginBottom:M.spacing.xs}}>
206
206
  📷 Image
207
207
  </Z.Text>
208
- {C.text&&C.text.trim()&&<Z.Text style={{fontSize:M.typography.fontSize.sm,color:M.colors.gray[700],lineHeight:M.typography.lineHeight.tight}}>
209
- {T(C.text,40)}
208
+ {T.text&&T.text.trim()&&<Z.Text style={{fontSize:M.typography.fontSize.sm,color:M.colors.gray[700],lineHeight:M.typography.lineHeight.tight}}>
209
+ {C(T.text,40)}
210
210
  </Z.Text>}
211
211
  </Z.View>
212
212
  </Z.View>:<Z.Text style={{fontSize:M.typography.fontSize.sm,color:M.colors.gray[700],lineHeight:M.typography.lineHeight.tight}}>
213
- {T(C.text)}
213
+ {C(T.text)}
214
214
  </Z.Text>}
215
215
  </Z.View>
216
216
  </Z.View>
217
217
  </Z.View>
218
218
 
219
219
  <Z.TouchableOpacity onPress={R}style={{height:32,width:32,alignItems:"center",justifyContent:"center",borderRadius:M.borderRadius.full,backgroundColor:M.colors.gray[200]}}hitSlop={{top:8,bottom:8,left:8,right:8}}>
220
- <Ns.X size={16}color={M.colors.textSecondary}/>
220
+ <Fs.X size={16}color={M.colors.textSecondary}/>
221
221
  </Z.TouchableOpacity>
222
222
  </Z.View>
223
- </Z.View>},Co=Tn;var Be=require("react"),W=require("react-native"),ft=require("lucide-react-native");var No=require("react"),Ws=X(require("rn-emoji-keyboard")),Rn=({visible:C,onClose:R,onEmojiSelected:M})=>{let[T,S]=(0,No.useState)(!1);(0,No.useEffect)(()=>{S(!!C)},[C]);let A=P=>{console.log("Selected emoji:",P),M(P.emoji),S(!1),R()},I=()=>{S(!1),R()};return C?<Ws.default onEmojiSelected={A}open={T}onClose={I}enableSearchBar/>:null},Et=Rn;var Sn=({visible:C,onPress:R,children:M})=>C?<W.View style={Ve.overlay}>
223
+ </Z.View>},Qt=br;var De=require("react"),W=require("react-native"),ft=require("lucide-react-native");var ko=require("react"),Os=Y(require("rn-emoji-keyboard")),Tr=({visible:T,onClose:R,onEmojiSelected:M})=>{let[C,S]=(0,ko.useState)(!1);(0,ko.useEffect)(()=>{S(!!T)},[T]);let A=P=>{console.log("Selected emoji:",P),M(P.emoji),S(!1),R()},I=()=>{S(!1),R()};return T?<Os.default onEmojiSelected={A}open={C}onClose={I}enableSearchBar/>:null},Lt=Tr;var Mr=({visible:T,onPress:R,children:M})=>T?<W.View style={Ve.overlay}>
224
224
  <W.TouchableOpacity style={Ve.backdrop}onPress={R}activeOpacity={1}/>
225
225
  {M}
226
- </W.View>:null,{width:Ot,height:us}=W.Dimensions.get("window"),In=({message:C,positions:R,messagePosition:M,containerRef:T,containerOffset:S,setContainerOffset:A})=>{let I=$(),P=(0,Be.useRef)(new W.Animated.Value(M.y)).current,z=(0,Be.useRef)(new W.Animated.Value(0)).current,E=(0,Be.useRef)(!1),v=C.type==="image"&&C.imageData;return(0,Be.useEffect)(()=>{E.current=!1,T.current&&T.current.measureInWindow((k,D,V,B)=>{A({x:k,y:D});let L=M.y-D,F=R.messagePreviewTop-D;P.setValue(L),z.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:F,duration:250,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[R.messagePreviewTop,M.y,T]),<W.Animated.View style={{position:"absolute",top:P,left:M.x,width:M.width,height:C.replyTo?M.height+10:M.height,zIndex:1e3,opacity:z,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":C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
227
- {C.replyTo&&<Dt replyTo={C.replyTo}isMyMessage={C.isMe}/>}
226
+ </W.View>:null,{width:jt,height:rs}=W.Dimensions.get("window"),Cr=({message:T,positions:R,messagePosition:M,containerRef:C,containerOffset:S,setContainerOffset:A})=>{let I=q(),P=(0,De.useRef)(new W.Animated.Value(M.y)).current,z=(0,De.useRef)(new W.Animated.Value(0)).current,E=(0,De.useRef)(!1),v=T.type==="image"&&T.imageData;return(0,De.useEffect)(()=>{E.current=!1,C.current&&C.current.measureInWindow((B,k,V,D)=>{A({x:B,y:k});let L=M.y-k,O=R.messagePreviewTop-k;P.setValue(L),z.setValue(0),requestAnimationFrame(()=>{W.Animated.parallel([W.Animated.timing(P,{toValue:O,duration:250,useNativeDriver:!1}),W.Animated.timing(z,{toValue:1,duration:250,useNativeDriver:!1})]).start(()=>{E.current=!0})})})},[R.messagePreviewTop,M.y,C]),<W.Animated.View style={{position:"absolute",top:P,left:M.x,width:M.width,height:T.replyTo?M.height+10:M.height,zIndex:1e3,opacity:z,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":T.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,overflow:"hidden"}}>
227
+ {T.replyTo&&<Dt replyTo={T.replyTo}isMyMessage={T.isMe}/>}
228
228
 
229
229
  {v?<W.View>
230
- <W.Image source={{uri:C.imageData.uri}}style={{width:M.width,height:M.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
230
+ <W.Image source={{uri:T.imageData.uri}}style={{width:M.width,height:M.height,borderRadius:I.borderRadius.lg}}resizeMode='cover'/>
231
231
  {}
232
- {C.text&&C.text.trim()&&<W.View style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:C.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
233
- <W.Text style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
- {C.text}
232
+ {T.text&&T.text.trim()&&<W.View style={{paddingHorizontal:I.spacing.lg,paddingVertical:I.spacing.md,backgroundColor:T.isMe?I.colors.messageBubble.sent:I.colors.messageBubble.received,borderRadius:I.borderRadius.lg,marginTop:I.spacing.xs}}>
233
+ <W.Text style={{fontSize:I.typography.fontSize.base,color:T.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
234
+ {T.text}
235
235
  </W.Text>
236
236
  </W.View>}
237
- </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:C.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
238
- {C.text}
237
+ </W.View>:<W.Text style={{fontSize:I.typography.fontSize.base,color:T.isMe?I.colors.messageBubble.sentText:I.colors.messageBubble.receivedText}}>
238
+ {T.text}
239
239
  </W.Text>}
240
- </W.Animated.View>},vn=({visible:C,onClose:R,isMyMessage:M,selectedMessage:T,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let P=We(),[z,E]=(0,Be.useState)(!1),v=(0,Be.useRef)(null),[k,D]=(0,Be.useState)({x:0,y:0}),V=(0,Be.useRef)(new W.Animated.Value(0)).current,B=(0,Be.useRef)(new W.Animated.Value(0)).current,L=(0,Be.useRef)(!1),F=(0,Be.useRef)(!1),j=Me=>{A(Me),R()},H=Me=>{I?.(Me),R()},N=()=>{E(!0)},O=()=>{E(!1)},te=Me=>{I?.(Me),E(!1),R()},Le=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Ee=(()=>{if(!S)return{emojiBar:{top:us/2-200,left:Ot/2-160},actionMenu:{top:us/2+50,left:Ot/2-100}};let Me=320,ke=60,Ae=200,Ye=160,U=20,Ge=8,Oe,Mt,Te,_e,Ze,we=us/2,Pt=ke+Ge+S.height+Ge+Ye,Tt=we-Pt/2;return Mt=Tt,Ze=Tt+ke+Ge,_e=Tt+ke+Ge+S.height+Ge,Oe=S.x,Te=S.x,Oe+Me>Ot-U&&(Oe=Ot-Me-U),Oe<U&&(Oe=U),Te+Ae>Ot-U&&(Te=Ot-Ae-U),Te<U&&(Te=U),{emojiBar:{top:Mt,left:Oe},actionMenu:{top:_e,left:Te},messagePreviewTop:Ze,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,Be.useEffect)(()=>{C&&S&&!F.current&&(V.setValue(0),B.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(V,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(B,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{F.current=!0})},50))},[C,S,V,B]),(0,Be.useEffect)(()=>{C||(L.current=!1,F.current=!1,V.setValue(0),B.setValue(0))},[C,V,B]),C?<>
240
+ </W.Animated.View>},Rr=({visible:T,onClose:R,isMyMessage:M,selectedMessage:C,messagePosition:S,onActionPress:A,onEmojiReact:I})=>{let P=ke(),[z,E]=(0,De.useState)(!1),v=(0,De.useRef)(null),[B,k]=(0,De.useState)({x:0,y:0}),V=(0,De.useRef)(new W.Animated.Value(0)).current,D=(0,De.useRef)(new W.Animated.Value(0)).current,L=(0,De.useRef)(!1),O=(0,De.useRef)(!1),j=Me=>{A(Me),R()},H=Me=>{I?.(Me),R()},N=()=>{E(!0)},F=()=>{E(!1)},te=Me=>{I?.(Me),E(!1),R()},je=["\u2764\uFE0F","\u{1F602}","\u{1F62E}","\u{1F622}","\u{1F621}","\u{1F44D}"],Ee=(()=>{if(!S)return{emojiBar:{top:rs/2-200,left:jt/2-160},actionMenu:{top:rs/2+50,left:jt/2-100}};let Me=320,Be=60,Ae=200,qe=160,U=20,Ye=8,Fe,Mt,Ce,Ge,Xe,we=rs/2,Pt=Be+Ye+S.height+Ye+qe,Ct=we-Pt/2;return Mt=Ct,Xe=Ct+Be+Ye,Ge=Ct+Be+Ye+S.height+Ye,Fe=S.x,Ce=S.x,Fe+Me>jt-U&&(Fe=jt-Me-U),Fe<U&&(Fe=U),Ce+Ae>jt-U&&(Ce=jt-Ae-U),Ce<U&&(Ce=U),{emojiBar:{top:Mt,left:Fe},actionMenu:{top:Ge,left:Ce},messagePreviewTop:Xe,isNearAverageHeight:!0,isNearTop:!0,isEdgeCase:!0}})();return(0,De.useEffect)(()=>{T&&S&&!O.current&&(V.setValue(0),D.setValue(0),setTimeout(()=>{W.Animated.sequence([W.Animated.timing(V,{toValue:1,duration:200,useNativeDriver:!1}),W.Animated.timing(D,{toValue:1,duration:200,useNativeDriver:!1})]).start(()=>{O.current=!0})},50))},[T,S,V,D]),(0,De.useEffect)(()=>{T||(L.current=!1,O.current=!1,V.setValue(0),D.setValue(0))},[T,V,D]),T?<>
241
241
  {}
242
- <Sn visible={!0}onPress={R}>
242
+ <Mr visible={!0}onPress={R}>
243
243
  <W.Pressable style={Ve.overlayPressable}onPress={R}/>
244
- </Sn>
244
+ </Mr>
245
245
 
246
246
  <W.View ref={v}style={{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"}}>
247
247
  {}
248
248
  </W.View>
249
249
 
250
250
  {}
251
- {S&&T&&<In message={T}positions={Ee}messagePosition={S}containerRef={v}containerOffset={k}setContainerOffset={D}/>}
251
+ {S&&C&&<Cr message={C}positions={Ee}messagePosition={S}containerRef={v}containerOffset={B}setContainerOffset={k}/>}
252
252
 
253
253
  {}
254
- <W.Animated.View style={[Ve.emojiBar,{position:"absolute",top:Ee.emojiBar.top-(k.y||0),left:Ee.emojiBar.left,opacity:V,pointerEvents:"auto"}]}>
254
+ <W.Animated.View style={[Ve.emojiBar,{position:"absolute",top:Ee.emojiBar.top-(B.y||0),left:Ee.emojiBar.left,opacity:V,pointerEvents:"auto"}]}>
255
255
  <W.ScrollView horizontal showsHorizontalScrollIndicator={!1}contentContainerStyle={Ve.emojiContainer}>
256
- {Le.map((Me,ke)=><W.TouchableOpacity key={ke}style={Ve.emojiButton}onPress={()=>H(Me)}>
256
+ {je.map((Me,Be)=><W.TouchableOpacity key={Be}style={Ve.emojiButton}onPress={()=>H(Me)}>
257
257
  <W.Text style={Ve.emojiText}>{Me}</W.Text>
258
258
  </W.TouchableOpacity>)}
259
259
  <W.TouchableOpacity style={Ve.addEmojiButton}onPress={N}>
@@ -263,7 +263,7 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
263
263
  </W.Animated.View>
264
264
 
265
265
  {}
266
- <W.Animated.View style={[Ve.actionMenu,{position:"absolute",top:Ee.actionMenu.top-(k.y||0)+(T?.replyTo?10:0),left:Ee.actionMenu.left,opacity:B,pointerEvents:"auto"}]}>
266
+ <W.Animated.View style={[Ve.actionMenu,{position:"absolute",top:Ee.actionMenu.top-(B.y||0)+(C?.replyTo?10:0),left:Ee.actionMenu.left,opacity:D,pointerEvents:"auto"}]}>
267
267
  <W.View style={Ve.actionItems}>
268
268
  {}
269
269
  <W.TouchableOpacity style={Ve.actionRow}onPress={()=>j("reply")}>
@@ -288,54 +288,54 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
288
288
  </W.Animated.View>
289
289
 
290
290
  {}
291
- <Et visible={z}onClose={O}onEmojiSelected={te}/>
292
- </>:null},Ve=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)"}}),Wo=vn;var Ft=require("react"),_=require("react-native"),Us=X(require("react-native-actions-sheet"));var Pn=({visible:C,onClose:R,reactions:M,messageText:T,onAddReaction:S,onRemoveReaction:A})=>{let I=(0,Ft.useRef)(null),[P,z]=(0,Ft.useState)(!1);(0,Ft.useEffect)(()=>{C?I.current?.show():I.current?.hide()},[C]);let v=(()=>{let j=[];return M.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 O=0;O<Math.min(H.count,N.length);O++)j.push({id:`${H.emoji}-${O}`,name:N[O].name,avatar:N[O].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),j})(),k=M.reduce((j,H)=>j+H.count,0),D=j=>{console.log("Remove reaction called with:",j),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",j.name==="You"),j.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",j.emoji),A(j.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:j.name==="You",hasCallback:!!A})},V=()=>{I.current?.hide(),R(),setTimeout(()=>{z(!0)},300)},B=()=>{z(!1)},L=j=>{console.log("Selected emoji from picker:",j),S?.(j),z(!1),R()},F=()=>{I.current?.hide(),R()};return<>
293
- <Us.default ref={I}onClose={F}containerStyle={Q.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
291
+ <Lt visible={z}onClose={F}onEmojiSelected={te}/>
292
+ </>:null},Ve=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)"}}),Lo=Rr;var Et=require("react"),J=require("react-native"),Hs=Y(require("react-native-actions-sheet"));var Sr=({visible:T,onClose:R,reactions:M,messageText:C,onAddReaction:S,onRemoveReaction:A})=>{let I=(0,Et.useRef)(null),[P,z]=(0,Et.useState)(!1);(0,Et.useEffect)(()=>{T?I.current?.show():I.current?.hide()},[T]);let v=(()=>{let j=[];return M.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 F=0;F<Math.min(H.count,N.length);F++)j.push({id:`${H.emoji}-${F}`,name:N[F].name,avatar:N[F].avatar,emoji:H.emoji,timestamp:new Date().toISOString()})}),j})(),B=M.reduce((j,H)=>j+H.count,0),k=j=>{console.log("Remove reaction called with:",j),console.log("onRemoveReaction prop exists:",!!A),console.log("User is current user:",j.name==="You"),j.name==="You"&&A?(console.log("Calling onRemoveReaction with emoji:",j.emoji),A(j.emoji)):console.log("Not calling onRemoveReaction because:",{isCurrentUser:j.name==="You",hasCallback:!!A})},V=()=>{I.current?.hide(),R(),setTimeout(()=>{z(!0)},300)},D=()=>{z(!1)},L=j=>{console.log("Selected emoji from picker:",j),S?.(j),z(!1),R()},O=()=>{I.current?.hide(),R()};return<>
293
+ <Hs.default ref={I}onClose={O}containerStyle={Q.container}headerAlwaysVisible={!0}gestureEnabled={!0}closeOnTouchBackdrop={!0}>
294
294
  {}
295
- <_.View style={Q.header}>
296
- <_.Text style={Q.title}>{k} reactions</_.Text>
297
- <_.TouchableOpacity onPress={F}style={Q.closeButton}>
298
- <_.Text style={Q.closeText}>✕</_.Text>
299
- </_.TouchableOpacity>
300
- </_.View>
295
+ <J.View style={Q.header}>
296
+ <J.Text style={Q.title}>{B} reactions</J.Text>
297
+ <J.TouchableOpacity onPress={O}style={Q.closeButton}>
298
+ <J.Text style={Q.closeText}>✕</J.Text>
299
+ </J.TouchableOpacity>
300
+ </J.View>
301
301
 
302
302
  {}
303
- <_.View style={Q.messagePreview}>
304
- <_.Text style={Q.messageText}numberOfLines={2}>
305
- {T}
306
- </_.Text>
307
- </_.View>
303
+ <J.View style={Q.messagePreview}>
304
+ <J.Text style={Q.messageText}numberOfLines={2}>
305
+ {C}
306
+ </J.Text>
307
+ </J.View>
308
308
 
309
309
  {}
310
- <_.View style={Q.reactionButtons}>
310
+ <J.View style={Q.reactionButtons}>
311
311
  {}
312
312
 
313
- {M.map((j,H)=><_.View key={H}style={Q.reactionButton}>
314
- <_.Text style={Q.reactionEmoji}>{j.emoji}</_.Text>
315
- <_.Text style={Q.reactionCount}>{j.count}</_.Text>
316
- </_.View>)}
317
- </_.View>
313
+ {M.map((j,H)=><J.View key={H}style={Q.reactionButton}>
314
+ <J.Text style={Q.reactionEmoji}>{j.emoji}</J.Text>
315
+ <J.Text style={Q.reactionCount}>{j.count}</J.Text>
316
+ </J.View>)}
317
+ </J.View>
318
318
 
319
319
  {}
320
- <_.ScrollView style={Q.userReactionsList}showsVerticalScrollIndicator={!1}>
321
- {v.map(j=>{let H=j.name==="You",N=H?_.TouchableOpacity:_.View;return<N key={j.id}style={[Q.userReactionItem,H&&Q.tappableUserReactionItem]}onPress={H?()=>D(j):void 0}activeOpacity={H?.7:1}>
322
- <_.View style={Q.userInfo}>
323
- <_.Text style={Q.userAvatar}>{j.avatar}</_.Text>
324
- <_.View style={Q.userDetails}>
325
- <_.Text style={Q.userName}>{j.name}</_.Text>
326
- {H&&<_.Text style={Q.removeText}>Tap to remove</_.Text>}
327
- </_.View>
328
- </_.View>
329
- <_.View style={Q.userReactionEmoji}>
330
- <_.Text style={Q.emojiText}>{j.emoji}</_.Text>
331
- </_.View>
320
+ <J.ScrollView style={Q.userReactionsList}showsVerticalScrollIndicator={!1}>
321
+ {v.map(j=>{let H=j.name==="You",N=H?J.TouchableOpacity:J.View;return<N key={j.id}style={[Q.userReactionItem,H&&Q.tappableUserReactionItem]}onPress={H?()=>k(j):void 0}activeOpacity={H?.7:1}>
322
+ <J.View style={Q.userInfo}>
323
+ <J.Text style={Q.userAvatar}>{j.avatar}</J.Text>
324
+ <J.View style={Q.userDetails}>
325
+ <J.Text style={Q.userName}>{j.name}</J.Text>
326
+ {H&&<J.Text style={Q.removeText}>Tap to remove</J.Text>}
327
+ </J.View>
328
+ </J.View>
329
+ <J.View style={Q.userReactionEmoji}>
330
+ <J.Text style={Q.emojiText}>{j.emoji}</J.Text>
331
+ </J.View>
332
332
  </N>})}
333
- </_.ScrollView>
334
- </Us.default>
333
+ </J.ScrollView>
334
+ </Hs.default>
335
335
 
336
336
  {}
337
- <Et visible={P}onClose={B}onEmojiSelected={L}/>
338
- </>},Q=_.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}}),Uo=Pn;var Ht=X(require("react")),tt=require("react-native"),Ks=X(require("react-native-actions-sheet")),qs=require("lucide-react-native"),It=(0,Ht.forwardRef)(({onOptionSelect:C,options:R},M)=>{let T=Ht.default.useRef(null);(0,Ht.useImperativeHandle)(M,()=>({show:()=>T.current?.show(),hide:()=>T.current?.hide()}));let S=A=>{C(A),T.current?.hide()};return<Ks.default ref={T}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
337
+ <Lt visible={P}onClose={D}onEmojiSelected={L}/>
338
+ </>},Q=J.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}}),Eo=Sr;var Ft=Y(require("react")),tt=require("react-native"),Ns=Y(require("react-native-actions-sheet")),Ws=require("lucide-react-native"),It=(0,Ft.forwardRef)(({onOptionSelect:T,options:R},M)=>{let C=Ft.default.useRef(null);(0,Ft.useImperativeHandle)(M,()=>({show:()=>C.current?.show(),hide:()=>C.current?.hide()}));let S=A=>{T(A),C.current?.hide()};return<Ns.default ref={C}headerAlwaysVisible gestureEnabled={!0}statusBarTranslucent drawUnderStatusBar={!1}containerStyle={{borderTopLeftRadius:20,borderTopRightRadius:20}}>
339
339
  <tt.View style={{padding:20,width:"100%"}}>
340
340
 
341
341
  {}
@@ -343,8 +343,8 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
343
343
  <tt.Text style={{fontSize:18,fontWeight:"600",color:"#1F2937"}}>
344
344
  Share Content
345
345
  </tt.Text>
346
- <tt.TouchableOpacity onPress={()=>T.current?.hide()}>
347
- <qs.X size={24}color="#6B7280"/>
346
+ <tt.TouchableOpacity onPress={()=>C.current?.hide()}>
347
+ <Ws.X size={24}color="#6B7280"/>
348
348
  </tt.TouchableOpacity>
349
349
  </tt.View>
350
350
 
@@ -360,104 +360,104 @@ await initChat({ projectId: 'your-project-id' });`)},vs=()=>(At(),lt.projectId),
360
360
  </tt.TouchableOpacity>})}
361
361
  </tt.View>
362
362
  </tt.View>
363
- </Ks.default>});It.displayName="AttachmentMenu";var Ko=require("react"),De=require("react-native"),An=({isVisible:C})=>{let R=(0,Ko.useRef)(new De.Animated.Value(0)).current;return(0,Ko.useEffect)(()=>{if(!C){R.setValue(0);return}let M=De.Animated.loop(De.Animated.sequence([De.Animated.timing(R,{toValue:1,duration:1200,useNativeDriver:!0}),De.Animated.timing(R,{toValue:0,duration:1200,useNativeDriver:!0})]));return M.start(),()=>{M.stop()}},[C,R]),C?<De.View style={Nt.container}>
364
- <De.View style={Nt.bubble}>
365
- <De.View style={Nt.dotsContainer}>
366
- <De.Animated.View style={[Nt.dot,{opacity:R.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
367
- <De.Animated.View style={[Nt.dot,{opacity:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
368
- <De.Animated.View style={[Nt.dot,{opacity:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
369
- </De.View>
370
- </De.View>
371
- </De.View>:null},Nt=De.StyleSheet.create({container:{paddingHorizontal:15,paddingVertical:5},bubble:{backgroundColor:"#fff",borderRadius:18,paddingHorizontal:12,paddingVertical:8,alignSelf:"flex-start",maxWidth:"80%"},senderNameContainer:{marginBottom:4},senderName:{fontSize:12,color:"#666",fontWeight:"500"},dotsContainer:{flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,backgroundColor:"#999",marginHorizontal:3}}),Wt=An;var qo=X(require("react")),Ut=require("react-native"),$s=require("lucide-react-native");var zn=({visible:C,onPress:R,isReplyActive:M=!1})=>{let T=$(),S=qo.default.useRef(new Ut.Animated.Value(0)).current,[A,I]=qo.default.useState(!1);return qo.default.useEffect(()=>{Ut.Animated.timing(S,{toValue:C?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(C)})},[C,S]),!C&&!A?null:<Ut.Pressable onPress={R}hitSlop={{top:10,bottom:10,left:10,right:10}}>
372
- {({pressed:P})=><Ut.Animated.View style={[{position:"absolute",bottom:40,right:T.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:T.colors.background,borderRadius:T.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:S,transform:P?[{scale:.95}]:[]}]}>
373
- <$s.ChevronDown size={20}color={T.colors.text}/>
374
- </Ut.Animated.View>}
375
- </Ut.Pressable>},$o=zn;var Mo=require("react-native");var Vn=({displayDate:C})=>{let R=$();return<Mo.View style={{marginVertical:R.spacing.lg,alignItems:"center"}}>
376
- <Mo.View style={{borderRadius:R.borderRadius.full,backgroundColor:R.colors.surfaceSecondary,paddingHorizontal:R.spacing.md,paddingVertical:R.spacing.xs}}>
377
- <Mo.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,fontWeight:R.typography.fontWeight.medium}}>
378
- {C}
379
- </Mo.Text>
380
- </Mo.View>
381
- </Mo.View>},Yo=Vn;var Ue=X(require("react")),Xe=require("react-native"),Kt=require("lucide-react-native");var ot=require("react"),ee=require("react-native"),Fe=require("lucide-react-native");var Bn={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},ms=async(C,R={})=>{try{let M;try{M=await import("expo-image-manipulator")}catch(k){console.log("expo-image-manipulator not available, returning original image info:",k);let V=`image_${Date.now()}.jpg`;return{uri:C,width:1920,height:1920,fileName:V}}let T={...Bn,...R};console.log("Starting image compression...",{uri:C,options:T});let S=await M.manipulateAsync(C,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(T.maxWidth||T.maxHeight){let{width:k,height:D}=S,V=k,B=D;if(T.maxWidth&&k>T.maxWidth){let L=T.maxWidth/k;V=T.maxWidth,B=D*L}if(T.maxHeight&&B>T.maxHeight){let L=T.maxHeight/B;B=T.maxHeight,V=V*L}(V!==k||B!==D)&&(A.push({resize:{width:Math.round(V),height:Math.round(B)}}),console.log("Resizing image:",{from:{width:k,height:D},to:{width:Math.round(V),height:Math.round(B)}}))}let I={compress:T.quality,format:T.format==="png"?M.SaveFormat?.PNG:M.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await M.manipulateAsync(C,A,I);console.log("Image compression completed:",{originalUri:C,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let z=Date.now(),E=T.format==="png"?"png":"jpg",v=`compressed_image_${z}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(M){console.error("Error compressing image:",M);let T=M instanceof Error?M.message:"Unknown error";throw new Error(`Failed to compress image: ${T}`)}},ps=(C,R)=>C>3e3||R>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:C>1920||R>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var kn=[{id:"photo",label:"Photo",icon:Fe.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:Fe.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:Fe.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:Fe.User,color:"#6B7280"},{id:"document",label:"Document",icon:Fe.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Fe.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:Fe.Calendar,color:"#EF4444"}],Go=C=>{let R=(0,ot.useRef)(null),M=(0,ot.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),ee.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:k}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",k),k!=="granted"){ee.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(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 V=D.assets[0];console.log("Photo selected successfully:",V.uri);try{console.log("Starting image compression...");let B=ps(V.width||1920,V.height||1920),L=await ms(V.uri,B);console.log("Image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(B){console.error("Image compression failed:",B),ee.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),ee.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),T=(0,ot.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),ee.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:k}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",k),k!=="granted"){ee.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(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 V=D.assets[0];console.log("Photo captured successfully:",V.uri);try{console.log("Starting camera image compression...");let B=ps(V.width||1920,V.height||1920),L=await ms(V.uri,B);console.log("Camera image compression completed:",L),C?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(B){console.error("Camera image compression failed:",B),ee.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),C?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),ee.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),S=(0,ot.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(L){console.log("expo-location not available:",L),ee.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:k}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",k),k!=="granted"){ee.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 V=await v.reverseGeocodeAsync({latitude:D.coords.latitude,longitude:D.coords.longitude}),B={coordinates:{latitude:D.coords.latitude,longitude:D.coords.longitude},address:V[0]||null,timestamp:D.timestamp};console.log("Location shared successfully:",B.coordinates),C?.({type:"location",data:B})}catch(v){console.error("Error in location sharing process:",v),ee.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[C]),A=(0,ot.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(D){console.log("expo-contacts not available:",D),ee.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:k}=await v.requestPermissionsAsync();if(k!=="granted"){ee.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}ee.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),ee.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{R.current?.hide()}},[]),I=(0,ot.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),ee.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 k=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",k),!k.canceled&&k.assets&&k.assets.length>0){let D=k.assets[0];console.log("Document selected successfully:",D.name),C?.({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),ee.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[C]),P=(0,ot.useCallback)(()=>{ee.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")}])},[]),z=(0,ot.useCallback)(()=>{ee.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,ot.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await M();break;case"camera":await T();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":z();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(k){console.error(`Error handling ${v}:`,k),ee.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[M,T,S,A,I,P,z]);return{menuRef:R,handleOptionSelect:E,options:kn}};var Y=X(require("react")),To=(C={})=>{let{initialValue:R="",initialHeight:M=50,onValueChange:T,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:z,onBlur:E,maxHeight:v=100,minHeight:k=50,maxLength:D=1e3,placeholder:V="Type a message..."}=C,B=(0,Y.useRef)(null),[L,F]=Y.default.useState(R),[j,H]=Y.default.useState(M),[N,O]=Y.default.useState(!1),[te,Le]=Y.default.useState(null),[Ce,Ee]=Y.default.useState([]),Me=Y.default.useMemo(()=>({value:L,height:j,isFocused:N,replyToMessage:te,attachments:Ce}),[L,j,N,te,Ce]),ke=(0,Y.useCallback)(ze=>{F(ze),T?.(ze)},[T]),Ae=(0,Y.useCallback)(ze=>{let Ne=Math.max(k,Math.min(v,ze));H(Ne),S?.(Ne)},[k,v,S]),Ye=(0,Y.useCallback)(()=>{O(!0),z?.()},[z]),U=(0,Y.useCallback)(()=>{O(!1),E?.()},[E]),Ge=(0,Y.useCallback)(ze=>{let{height:Ne}=ze.nativeEvent.contentSize,Gt=Math.max(k,Math.min(v,Ne+16));Ae(Gt)},[k,v,Ae]),Oe=(0,Y.useCallback)(()=>{A&&(L||Ce.length>0)&&(A(L,Ce,te),F(R),Ee([]),Le(null),H(M))},[A,L,Ce,te,R,M]),Mt=(0,Y.useCallback)(ze=>{I?(I(ze,L),L&&F(R)):Ee(Ne=>[...Ne,{...ze,id:Date.now().toString()}])},[I,L,R]),Te=(0,Y.useCallback)(ze=>{Ee(Ne=>[...Ne,ze])},[]),_e=(0,Y.useCallback)(ze=>{Ee(Ne=>Ne.filter(Gt=>Gt.id!==ze))},[]),Ze=(0,Y.useCallback)(()=>{Ee([])},[]),we=(0,Y.useCallback)(()=>{Le(null),P?.()},[P]),Pt=(0,Y.useCallback)(()=>{B.current?.focus()},[]),Tt=Y.default.useMemo(()=>({setValue:ke,setHeight:Ae,setFocus:O,setReplyToMessage:Le,addAttachment:Te,removeAttachment:_e,clearAttachments:Ze,sendMessage:Oe,cancelReply:we,focusInput:Pt,handleAttachmentSelected:Mt,handleContentSizeChange:Ge,handleFocus:Ye,handleBlur:U}),[ke,Ae,O,Le,Te,_e,Ze,Oe,we,Pt,Mt,Ge,Ye,U]),ss=Y.default.useMemo(()=>({textInputRef:B}),[]);return{state:Me,actions:Tt,refs:ss}},si=(0,Y.createContext)(null);var mt=(0,Ue.forwardRef)(({value:C,onChangeText:R,onSend:M,onFocus:T,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:z},E)=>{let v=$(),k=We(),D=(0,Ue.useRef)(null);(0,Ue.useImperativeHandle)(E,()=>({focus:()=>{D.current?.focus()}}));let{state:V,actions:B}=To({initialValue:C,initialHeight:S,onValueChange:R,onHeightChange:A,onSend:M,onAttachmentSend:z,onReplyCancel:P,onFocus:T});Ue.default.useEffect(()=>{C!==V.value&&B.setValue(C)},[C,V.value,B]),Ue.default.useEffect(()=>{S!==V.height&&B.setHeight(S)},[S,V.height,B]),Ue.default.useEffect(()=>{I!==V.replyToMessage&&B.setReplyToMessage(I||null)},[I,V.replyToMessage,B]),Ue.default.useEffect(()=>{if(I&&D.current){let j=setTimeout(()=>{D.current?.focus()},100);return()=>clearTimeout(j)}},[I]);let L=(0,Ue.useCallback)(j=>{if(console.log("Attachment selected:",j),z)z(j,C.trim()||void 0),C.trim()&&R("");else switch(j.type){case"image":console.log("Image attachment ready to send:",{uri:j.data.uri,dimensions:{width:j.data.width,height:j.data.height},fileName:j.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:j.data.name,size:j.data.size});break;case"location":console.log("Location attachment ready to send:",j.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",j.data);break;default:console.log("Other attachment ready to send:",j)}},[z,C,R]),F=Go(L);return<>
382
- {I&&P&&<Co replyToMessage={I}onCancel={P}/>}
383
- <Xe.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
384
- <Xe.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
385
- <Xe.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>F.menuRef.current?.show()}>
386
- <Kt.Plus size={24}color={v.colors.textSecondary}/>
387
- </Xe.TouchableOpacity>
363
+ </Ns.default>});It.displayName="AttachmentMenu";var Fo=require("react"),Le=require("react-native"),wr=({isVisible:T})=>{let R=(0,Fo.useRef)(new Le.Animated.Value(0)).current;return(0,Fo.useEffect)(()=>{if(!T){R.setValue(0);return}let M=Le.Animated.loop(Le.Animated.sequence([Le.Animated.timing(R,{toValue:1,duration:1200,useNativeDriver:!0}),Le.Animated.timing(R,{toValue:0,duration:1200,useNativeDriver:!0})]));return M.start(),()=>{M.stop()}},[T,R]),T?<Le.View style={Ot.container}>
364
+ <Le.View style={Ot.bubble}>
365
+ <Le.View style={Ot.dotsContainer}>
366
+ <Le.Animated.View style={[Ot.dot,{opacity:R.interpolate({inputRange:[0,.5,1],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[0,.5,1],outputRange:[0,-4,0]})}]}]}/>
367
+ <Le.Animated.View style={[Ot.dot,{opacity:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.33,.83,1.33],outputRange:[0,-4,0]})}]}]}/>
368
+ <Le.Animated.View style={[Ot.dot,{opacity:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[.3,1,.3]}),transform:[{translateY:R.interpolate({inputRange:[.66,1.16,1.66],outputRange:[0,-4,0]})}]}]}/>
369
+ </Le.View>
370
+ </Le.View>
371
+ </Le.View>:null},Ot=Le.StyleSheet.create({container:{paddingHorizontal:15,paddingVertical:5},bubble:{backgroundColor:"#fff",borderRadius:18,paddingHorizontal:12,paddingVertical:8,alignSelf:"flex-start",maxWidth:"80%"},senderNameContainer:{marginBottom:4},senderName:{fontSize:12,color:"#666",fontWeight:"500"},dotsContainer:{flexDirection:"row",alignItems:"center",justifyContent:"center"},dot:{width:6,height:6,borderRadius:3,backgroundColor:"#999",marginHorizontal:3}}),Ht=wr;var Oo=Y(require("react")),Nt=require("react-native"),Us=require("lucide-react-native");var Ir=({visible:T,onPress:R,isReplyActive:M=!1})=>{let C=q(),S=Oo.default.useRef(new Nt.Animated.Value(0)).current,[A,I]=Oo.default.useState(!1);return Oo.default.useEffect(()=>{Nt.Animated.timing(S,{toValue:T?1:0,duration:200,useNativeDriver:!0}).start(()=>{I(T)})},[T,S]),!T&&!A?null:<Nt.Pressable onPress={R}hitSlop={{top:10,bottom:10,left:10,right:10}}>
372
+ {({pressed:P})=><Nt.Animated.View style={[{position:"absolute",bottom:40,right:C.spacing.lg,zIndex:9999,width:32,height:32,backgroundColor:C.colors.background,borderRadius:C.borderRadius.xl,justifyContent:"center",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:3.84,elevation:5,opacity:S,transform:P?[{scale:.95}]:[]}]}>
373
+ <Us.ChevronDown size={20}color={C.colors.text}/>
374
+ </Nt.Animated.View>}
375
+ </Nt.Pressable>},Ho=Ir;var eo=require("react-native");var vr=({displayDate:T})=>{let R=q();return<eo.View style={{marginVertical:R.spacing.lg,alignItems:"center"}}>
376
+ <eo.View style={{borderRadius:R.borderRadius.full,backgroundColor:R.colors.surfaceSecondary,paddingHorizontal:R.spacing.md,paddingVertical:R.spacing.xs}}>
377
+ <eo.Text style={{fontSize:R.typography.fontSize.xs,color:R.colors.textSecondary,fontWeight:R.typography.fontWeight.medium}}>
378
+ {T}
379
+ </eo.Text>
380
+ </eo.View>
381
+ </eo.View>},No=vr;var We=Y(require("react")),Je=require("react-native"),Wt=require("lucide-react-native");var ot=require("react"),ee=require("react-native"),Oe=require("lucide-react-native");var Pr={maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"},as=async(T,R={})=>{try{let M;try{M=await import("expo-image-manipulator")}catch(B){console.log("expo-image-manipulator not available, returning original image info:",B);let V=`image_${Date.now()}.jpg`;return{uri:T,width:1920,height:1920,fileName:V}}let C={...Pr,...R};console.log("Starting image compression...",{uri:T,options:C});let S=await M.manipulateAsync(T,[],{});console.log("Original image info:",{width:S.width,height:S.height,uri:S.uri});let A=[];if(C.maxWidth||C.maxHeight){let{width:B,height:k}=S,V=B,D=k;if(C.maxWidth&&B>C.maxWidth){let L=C.maxWidth/B;V=C.maxWidth,D=k*L}if(C.maxHeight&&D>C.maxHeight){let L=C.maxHeight/D;D=C.maxHeight,V=V*L}(V!==B||D!==k)&&(A.push({resize:{width:Math.round(V),height:Math.round(D)}}),console.log("Resizing image:",{from:{width:B,height:k},to:{width:Math.round(V),height:Math.round(D)}}))}let I={compress:C.quality,format:C.format==="png"?M.SaveFormat?.PNG:M.SaveFormat?.JPEG};console.log("Applying compression with options:",I);let P=await M.manipulateAsync(T,A,I);console.log("Image compression completed:",{originalUri:T,compressedUri:P.uri,finalDimensions:{width:P.width,height:P.height}});let z=Date.now(),E=C.format==="png"?"png":"jpg",v=`compressed_image_${z}.${E}`;return{uri:P.uri,width:P.width,height:P.height,fileName:v}}catch(M){console.error("Error compressing image:",M);let C=M instanceof Error?M.message:"Unknown error";throw new Error(`Failed to compress image: ${C}`)}},ns=(T,R)=>T>3e3||R>3e3?{maxWidth:1920,maxHeight:1920,quality:.7,format:"jpeg"}:T>1920||R>1920?{maxWidth:1920,maxHeight:1920,quality:.8,format:"jpeg"}:{quality:.9,format:"jpeg"};var Ar=[{id:"photo",label:"Photo",icon:Oe.Image,color:"#3B82F6"},{id:"camera",label:"Camera",icon:Oe.Camera,color:"#6B7280"},{id:"location",label:"Location",icon:Oe.MapPin,color:"#10B981"},{id:"contact",label:"Contact",icon:Oe.User,color:"#6B7280"},{id:"document",label:"Document",icon:Oe.FileText,color:"#3B82F6"},{id:"poll",label:"Poll",icon:Oe.BarChart3,color:"#F59E0B"},{id:"event",label:"Event",icon:Oe.Calendar,color:"#EF4444"}],Wo=T=>{let R=(0,ot.useRef)(null),M=(0,ot.useCallback)(async()=>{console.log("Photo selection initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),ee.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:B}=await v.requestMediaLibraryPermissionsAsync();if(console.log("Photo library permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant photo library access to select images.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(void 0),300)),console.log("Launching image picker...");let k=await v.launchImageLibraryAsync({mediaTypes:"images",allowsEditing:!0,aspect:[4,3],quality:.8,allowsMultipleSelection:!1});if(console.log("Image picker result:",k),!k.canceled&&k.assets&&k.assets.length>0){let V=k.assets[0];console.log("Photo selected successfully:",V.uri);try{console.log("Starting image compression...");let D=ns(V.width||1920,V.height||1920),L=await as(V.uri,D);console.log("Image compression completed:",L),T?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(D){console.error("Image compression failed:",D),ee.Alert.alert("Compression Error","Failed to compress image. Sending original image.",[{text:"OK"}]),T?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"image.jpg"}})}}else console.log("Photo selection was canceled by user")}catch(v){console.error("Error in photo selection process:",v),ee.Alert.alert("Photo Selection Error","Failed to open photo library. Please try again or check your device permissions.",[{text:"OK"}])}},[T]),C=(0,ot.useCallback)(async()=>{console.log("Camera capture initiated");try{let v;try{v=await import("expo-image-picker")}catch(V){console.log("expo-image-picker not available:",V),ee.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:B}=await v.requestCameraPermissionsAsync();if(console.log("Camera permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant camera access to take photos.");return}console.log("Waiting for UI to stabilize..."),await new Promise(V=>setTimeout(()=>V(void 0),300)),console.log("Launching camera...");let k=await v.launchCameraAsync({allowsEditing:!0,aspect:[4,3],quality:.8,mediaTypes:"images"});if(console.log("Camera result:",k),!k.canceled&&k.assets&&k.assets.length>0){let V=k.assets[0];console.log("Photo captured successfully:",V.uri);try{console.log("Starting camera image compression...");let D=ns(V.width||1920,V.height||1920),L=await as(V.uri,D);console.log("Camera image compression completed:",L),T?.({type:"image",data:{...L,originalFileSize:V.fileSize}})}catch(D){console.error("Camera image compression failed:",D),ee.Alert.alert("Compression Error","Failed to compress captured image. Sending original image.",[{text:"OK"}]),T?.({type:"image",data:{uri:V.uri,width:V.width,height:V.height,fileSize:V.fileSize,fileName:V.fileName||"camera_photo.jpg"}})}}else console.log("Camera capture was canceled by user")}catch(v){console.error("Error in camera capture process:",v),ee.Alert.alert("Camera Error","Failed to open camera. Please try again or check your device permissions.",[{text:"OK"}])}},[T]),S=(0,ot.useCallback)(async()=>{console.log("Location sharing initiated");try{let v;try{v=await import("expo-location")}catch(L){console.log("expo-location not available:",L),ee.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:B}=await v.requestForegroundPermissionsAsync();if(console.log("Location permission status:",B),B!=="granted"){ee.Alert.alert("Permission needed","Please grant location access to share your location.");return}console.log("Getting current location...");let k=await v.getCurrentPositionAsync({accuracy:v.Accuracy.High});console.log("Getting address from coordinates...");let V=await v.reverseGeocodeAsync({latitude:k.coords.latitude,longitude:k.coords.longitude}),D={coordinates:{latitude:k.coords.latitude,longitude:k.coords.longitude},address:V[0]||null,timestamp:k.timestamp};console.log("Location shared successfully:",D.coordinates),T?.({type:"location",data:D})}catch(v){console.error("Error in location sharing process:",v),ee.Alert.alert("Location Error","Failed to get your location. Please try again or check your device permissions.",[{text:"OK"}])}},[T]),A=(0,ot.useCallback)(async()=>{try{let v;try{v=await import("expo-contacts")}catch(k){console.log("expo-contacts not available:",k),ee.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:B}=await v.requestPermissionsAsync();if(B!=="granted"){ee.Alert.alert("Permission needed","Please grant contacts access to share contacts.");return}ee.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),ee.Alert.alert("Error","Failed to access contacts. Please try again.")}finally{R.current?.hide()}},[]),I=(0,ot.useCallback)(async()=>{console.log("Document selection initiated");try{let v;try{v=await import("expo-document-picker")}catch(k){console.log("expo-document-picker not available:",k),ee.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(k=>setTimeout(()=>k(void 0),300)),console.log("Launching document picker...");let B=await v.getDocumentAsync({type:"*/*",copyToCacheDirectory:!0,multiple:!1});if(console.log("Document picker result:",B),!B.canceled&&B.assets&&B.assets.length>0){let k=B.assets[0];console.log("Document selected successfully:",k.name),T?.({type:"document",data:{uri:k.uri,name:k.name,size:k.size,mimeType:k.mimeType}})}else console.log("Document selection was canceled by user")}catch(v){console.error("Error in document selection process:",v),ee.Alert.alert("Document Selection Error","Failed to open document picker. Please try again.",[{text:"OK"}])}},[T]),P=(0,ot.useCallback)(()=>{ee.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")}])},[]),z=(0,ot.useCallback)(()=>{ee.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,ot.useCallback)(async v=>{console.log(`Selected attachment option: ${v}`);try{switch(v){case"photo":await M();break;case"camera":await C();break;case"location":await S();break;case"contact":await A();break;case"document":await I();break;case"poll":P();break;case"event":z();break;default:console.warn(`Unknown attachment option: ${v}`)}}catch(B){console.error(`Error handling ${v}:`,B),ee.Alert.alert("Error",`Failed to handle ${v}. Please try again.`)}},[M,C,S,A,I,P,z]);return{menuRef:R,handleOptionSelect:E,options:Ar}};var G=Y(require("react")),to=(T={})=>{let{initialValue:R="",initialHeight:M=50,onValueChange:C,onHeightChange:S,onSend:A,onAttachmentSend:I,onReplyCancel:P,onFocus:z,onBlur:E,maxHeight:v=100,minHeight:B=50,maxLength:k=1e3,placeholder:V="Type a message..."}=T,D=(0,G.useRef)(null),[L,O]=G.default.useState(R),[j,H]=G.default.useState(M),[N,F]=G.default.useState(!1),[te,je]=G.default.useState(null),[Te,Ee]=G.default.useState([]),Me=G.default.useMemo(()=>({value:L,height:j,isFocused:N,replyToMessage:te,attachments:Te}),[L,j,N,te,Te]),Be=(0,G.useCallback)(ze=>{O(ze),C?.(ze)},[C]),Ae=(0,G.useCallback)(ze=>{let Ne=Math.max(B,Math.min(v,ze));H(Ne),S?.(Ne)},[B,v,S]),qe=(0,G.useCallback)(()=>{F(!0),z?.()},[z]),U=(0,G.useCallback)(()=>{F(!1),E?.()},[E]),Ye=(0,G.useCallback)(ze=>{let{height:Ne}=ze.nativeEvent.contentSize,qt=Math.max(B,Math.min(v,Ne+16));Ae(qt)},[B,v,Ae]),Fe=(0,G.useCallback)(()=>{A&&(L||Te.length>0)&&(A(L,Te,te),O(R),Ee([]),je(null),H(M))},[A,L,Te,te,R,M]),Mt=(0,G.useCallback)(ze=>{I?(I(ze,L),L&&O(R)):Ee(Ne=>[...Ne,{...ze,id:Date.now().toString()}])},[I,L,R]),Ce=(0,G.useCallback)(ze=>{Ee(Ne=>[...Ne,ze])},[]),Ge=(0,G.useCallback)(ze=>{Ee(Ne=>Ne.filter(qt=>qt.id!==ze))},[]),Xe=(0,G.useCallback)(()=>{Ee([])},[]),we=(0,G.useCallback)(()=>{je(null),P?.()},[P]),Pt=(0,G.useCallback)(()=>{D.current?.focus()},[]),Ct=G.default.useMemo(()=>({setValue:Be,setHeight:Ae,setFocus:F,setReplyToMessage:je,addAttachment:Ce,removeAttachment:Ge,clearAttachments:Xe,sendMessage:Fe,cancelReply:we,focusInput:Pt,handleAttachmentSelected:Mt,handleContentSizeChange:Ye,handleFocus:qe,handleBlur:U}),[Be,Ae,F,je,Ce,Ge,Xe,Fe,we,Pt,Mt,Ye,qe,U]),Xo=G.default.useMemo(()=>({textInputRef:D}),[]);return{state:Me,actions:Ct,refs:Xo}},si=(0,G.createContext)(null);var mt=(0,We.forwardRef)(({value:T,onChangeText:R,onSend:M,onFocus:C,height:S,onContentSizeChange:A,replyToMessage:I,onCancelReply:P,onAttachmentSend:z},E)=>{let v=q(),B=ke(),k=(0,We.useRef)(null);(0,We.useImperativeHandle)(E,()=>({focus:()=>{k.current?.focus()}}));let{state:V,actions:D}=to({initialValue:T,initialHeight:S,onValueChange:R,onHeightChange:A,onSend:M,onAttachmentSend:z,onReplyCancel:P,onFocus:C});We.default.useEffect(()=>{T!==V.value&&D.setValue(T)},[T,V.value,D]),We.default.useEffect(()=>{S!==V.height&&D.setHeight(S)},[S,V.height,D]),We.default.useEffect(()=>{I!==V.replyToMessage&&D.setReplyToMessage(I||null)},[I,V.replyToMessage,D]),We.default.useEffect(()=>{if(I&&k.current){let j=setTimeout(()=>{k.current?.focus()},100);return()=>clearTimeout(j)}},[I]);let L=(0,We.useCallback)(j=>{if(console.log("Attachment selected:",j),z)z(j,T.trim()||void 0),T.trim()&&R("");else switch(j.type){case"image":console.log("Image attachment ready to send:",{uri:j.data.uri,dimensions:{width:j.data.width,height:j.data.height},fileName:j.data.fileName});break;case"document":console.log("Document attachment ready to send:",{name:j.data.name,size:j.data.size});break;case"location":console.log("Location attachment ready to send:",j.data.coordinates);break;case"contact":console.log("Contact attachment ready to send:",j.data);break;default:console.log("Other attachment ready to send:",j)}},[z,T,R]),O=Wo(L);return<>
382
+ {I&&P&&<Qt replyToMessage={I}onCancel={P}/>}
383
+ <Je.View style={{borderTopWidth:1,borderTopColor:v.colors.borderLight,backgroundColor:v.colors.background}}>
384
+ <Je.View style={{flexDirection:"row",alignItems:"center",backgroundColor:v.colors.background,paddingHorizontal:v.spacing.lg,paddingVertical:v.spacing.sm,minHeight:S}}>
385
+ <Je.TouchableOpacity style={{marginRight:v.spacing.md}}onPress={()=>O.menuRef.current?.show()}>
386
+ <Wt.Plus size={24}color={v.colors.textSecondary}/>
387
+ </Je.TouchableOpacity>
388
388
 
389
- <Xe.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
390
- <Xe.TextInput ref={D}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:Xe.Platform.OS==="ios"?6:3,paddingBottom:Xe.Platform.OS==="ios"?6:3,color:v.colors.text}}value={C}onChangeText={R}placeholder={k("input.placeholder")}placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={T}onContentSizeChange={B.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
391
- </Xe.View>
389
+ <Je.View style={{flex:1,flexDirection:"row",alignItems:"center",borderRadius:v.borderRadius.full,backgroundColor:v.colors.surfaceSecondary,paddingHorizontal:v.spacing.lg,paddingVertical:6}}>
390
+ <Je.TextInput ref={k}style={{flex:1,fontSize:v.typography.fontSize.base,maxHeight:70,minHeight:18,paddingTop:Je.Platform.OS==="ios"?6:3,paddingBottom:Je.Platform.OS==="ios"?6:3,color:v.colors.text}}value={T}onChangeText={R}placeholder={B("input.placeholder")}placeholderTextColor={v.colors.textMuted}multiline maxLength={1e3}onFocus={C}onContentSizeChange={D.handleContentSizeChange}returnKeyType='default'textAlignVertical='center'/>
391
+ </Je.View>
392
392
 
393
- <Xe.TouchableOpacity onPress={M}style={{marginLeft:v.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:v.borderRadius.full,backgroundColor:C.trim()?v.colors.primary:v.colors.gray[300]}}disabled={!C.trim()}>
394
- {C.trim()?<Kt.Send size={18}color='white'/>:<Kt.Mic size={18}color='white'/>}
395
- </Xe.TouchableOpacity>
396
- </Xe.View>
397
- </Xe.View>
393
+ <Je.TouchableOpacity onPress={M}style={{marginLeft:v.spacing.md,height:40,width:40,alignItems:"center",justifyContent:"center",borderRadius:v.borderRadius.full,backgroundColor:T.trim()?v.colors.primary:v.colors.gray[300]}}disabled={!T.trim()}>
394
+ {T.trim()?<Wt.Send size={18}color='white'/>:<Wt.Mic size={18}color='white'/>}
395
+ </Je.TouchableOpacity>
396
+ </Je.View>
397
+ </Je.View>
398
398
 
399
- <It ref={F.menuRef}onOptionSelect={F.handleOptionSelect}options={F.options}/>
400
- </>});mt.displayName="MessageInput";var _o=require("react-native"),gs=require("lucide-react-native");var Xo=X(require("react"));var yt=X(require("react"));var Jo=require("react");function Ro(C,R={}){let{initialNumToRender:M=20,maxToRenderPerBatch:T=10,windowSize:S=10}=R,A=(0,Jo.useMemo)(()=>Es(C).reverse(),[C]),I=(0,Jo.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:M,maxToRenderPerBatch:T,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ke=require("react");function hs(C={}){let{scrollThreshold:R=50,autoScrollToBottom:M=!0}=C,T=(0,Ke.useRef)(null),[S,A]=(0,Ke.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ke.useRef)(0),P=(0,Ke.useCallback)(B=>{let{contentOffset:L,contentSize:F,layoutMeasurement:j}=B.nativeEvent,H=L.y,N=Math.abs(H)<R,O=Math.abs(H)>F.height-j.height-R;A({isNearBottom:N,isNearTop:O,showScrollToBottomButton:!N})},[R]),z=(0,Ke.useCallback)(B=>{let L=B>I.current;return I.current=B,L},[]),E=(0,Ke.useCallback)(()=>{},[]),v=(0,Ke.useCallback)((B=!0)=>{T.current&&T.current.scrollToOffset({offset:0,animated:B})},[]),k=(0,Ke.useCallback)((B,L=!0)=>{T.current&&T.current.scrollToOffset({offset:B,animated:L})},[]),D=(0,Ke.useCallback)((B,L=!0)=>{T.current&&T.current.scrollToIndex({index:B,animated:L})},[]),V=(0,Ke.useCallback)(B=>{z(B)&&M&&T.current&&setTimeout(()=>{v()},100)},[z,M,v]);return{flatListRef:T,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:V,scrollToEnd:v,scrollToOffset:k,scrollToIndex:D}}var qt=require("react");function So(C={}){let{enableMessageActions:R=!0}=C,[M,T]=(0,qt.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,qt.useCallback)((P,z)=>{R&&T({actionSheetVisible:!0,selectedMessage:P,messagePosition:z})},[R]),A=(0,qt.useCallback)(()=>{T({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,qt.useCallback)((P,z)=>{if(!M.selectedMessage)return;let{selectedMessage:E}=M;switch(P){case"reply":z?.onReply?.(E);break;case"copy":if(z?.onCopy)z.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>(Gs(),Ys)).then(({copyToClipboard:k})=>{k(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":z?.onDelete?.(E.id);break;default:z?.onCustomAction?.(P,E);break}A()},[M.selectedMessage,A]);return{actionState:M,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}var dt=require("react");function wo(C={}){let{enableReactionDetails:R=!0}=C,[M,T]=(0,dt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=(0,dt.useState)(null),I=(0,dt.useCallback)(k=>{R&&k.reactions&&k.reactions.length>0&&(A(k),T({isReactionDetailsVisible:!0,selectedReactions:k.reactions,selectedMessageText:k.text}))},[R]),P=(0,dt.useCallback)(()=>{T({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),z=(0,dt.useCallback)((k,D)=>{S&&D?.(S.id,k),P()},[S,P]),E=(0,dt.useCallback)((k,D)=>{S&&D?.(S.id,k),P()},[S,P]),v=(0,dt.useCallback)((k,D)=>{S&&D?.(S.id,k)},[S]);return{reactionState:M,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:z,handleRemoveReaction:E,handleEmojiReact:v}}var Io=require("react");function fs(){let[C,R]=(0,Io.useState)({replyToMessage:null}),M=(0,Io.useCallback)(S=>{R({replyToMessage:S})},[]),T=(0,Io.useCallback)(()=>{R({replyToMessage:null})},[]);return{replyState:C,setReplyToMessage:M,clearReply:T}}var _s=(0,yt.createContext)(null);function $t(){let C=(0,yt.useContext)(_s);if(!C)throw new Error("useMessageListContext must be used within MessageListProvider");return C}function Po({children:C,messages:R,config:M={},...T}){let S=Ro(R,M),A=hs(M),I=So(M),P=wo(M),z=fs();yt.default.useEffect(()=>{A.handleNewMessages(R.length)},[R.length,A.handleNewMessages]);let E=(0,yt.useMemo)(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:z,config:M,callbacks:T}),[S,A,I,P,z,M,T]);return<_s.Provider value={E}>
401
- {C}
402
- </_s.Provider>}var Ao=require("react"),Yt=require("react-native");var xt={Provider:Po,Container:({children:C,style:R})=><Yt.View style={[Js.container,R]}>{C}</Yt.View>,Messages:({renderMessage:C,style:R})=>{let{messageList:M,scroll:T,actions:S,reactions:A,callbacks:I}=$t(),P=(0,Ao.useCallback)(({item:E,index:v})=>C&&E.listItemType!=="date-separator"?C({message:E,index:v})||null:E.listItemType==="date-separator"?<Yo date={E.date}displayDate={E.displayDate}/>:<Ho message={E}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,C]),z=(0,Ao.useCallback)(E=>{T.handleScroll(E);let{isNearBottom:v,isNearTop:k}=T.scrollState;I.onScrollPositionChange?.(v,k),v&&I.onScrollToBottom?.(),k&&I.onScrollToTop?.()},[T.handleScroll,T.scrollState,I]);return<Yt.FlatList ref={T.flatListRef}data={M.messageItems}renderItem={P}keyExtractor={M.keyExtractor}contentContainerStyle={[Js.contentContainer,R]}onContentSizeChange={T.handleContentSizeChange}onScroll={z}{...M.flatListProps}/>},TypingIndicator:({isVisible:C})=>C?<Wt isVisible={C}/>:null,ScrollButton:({visible:C,isReplyActive:R,onPress:M})=>{let{scroll:T}=$t();return<$o visible={C??T.scrollState.showScrollToBottomButton}onPress={M??T.scrollToEnd}isReplyActive={R}/>},ActionSheet:()=>{let{actions:C,reactions:R,reply:M,callbacks:T,config:S}=$t(),A=(0,Ao.useCallback)(P=>{C.handleActionPress(P,{onReply:z=>{M.setReplyToMessage(z),T.onReplyMessage?.(z)},onDelete:T.onMessageDelete,onCustomAction:T.onActionPress})},[C.handleActionPress,M.setReplyToMessage,T]),I=(0,Ao.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let z=C.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",z?.id,"callbacks.onReactionAdd exists:",!!T.onReactionAdd),z&&T.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",z.id,"emoji:",P),T.onReactionAdd(z.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!z,"callback exists:",!!T.onReactionAdd)},[C.actionState.selectedMessage,T.onReactionAdd]);return S.enableMessageActions?<Wo visible={C.actionState.actionSheetVisible}onClose={C.handleActionSheetClose}isMyMessage={C.actionState.selectedMessage?.isMe||!1}selectedMessage={C.actionState.selectedMessage||void 0}messagePosition={C.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:C,callbacks:R,config:M}=$t();return M.enableReactionDetails?<Uo visible={C.reactionState.isReactionDetailsVisible}onClose={C.handleReactionDetailsClose}reactions={C.reactionState.selectedReactions}messageText={C.reactionState.selectedMessageText}onRemoveReaction={T=>C.handleRemoveReaction(T,R.onReactionRemove)}/>:null}},Js=Yt.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var pt=(0,Xo.forwardRef)(({messages:C,isTyping:R,showScrollToBottom:M=!1,isReplyActive:T=!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 Xo.default.useImperativeHandle(A,()=>({scrollToEnd:(z=!0)=>{},scrollToOffset:(z,E=!0)=>{},scrollToIndex:(z,E=!0)=>{}}),[]),<Po messages={C}config={I}{...P}>
399
+ <It ref={O.menuRef}onOptionSelect={O.handleOptionSelect}options={O.options}/>
400
+ </>});mt.displayName="MessageInput";var Uo=require("react-native"),is=require("lucide-react-native");var $o=Y(require("react"));var yt=Y(require("react"));var Ko=require("react");function oo(T,R={}){let{initialNumToRender:M=20,maxToRenderPerBatch:C=10,windowSize:S=10}=R,A=(0,Ko.useMemo)(()=>Ao(T).reverse(),[T]),I=(0,Ko.useCallback)(P=>P.listItemType==="date-separator"?P.id:P.id.toString(),[]);return{messageItems:A,keyExtractor:I,flatListProps:{initialNumToRender:M,maxToRenderPerBatch:C,windowSize:S,inverted:!0,showsVerticalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",removeClippedSubviews:!1,scrollEventThrottle:16}}}var Ue=require("react");function ls(T={}){let{scrollThreshold:R=50,autoScrollToBottom:M=!0}=T,C=(0,Ue.useRef)(null),[S,A]=(0,Ue.useState)({isNearBottom:!0,isNearTop:!1,showScrollToBottomButton:!1}),I=(0,Ue.useRef)(0),P=(0,Ue.useCallback)(D=>{let{contentOffset:L,contentSize:O,layoutMeasurement:j}=D.nativeEvent,H=L.y,N=Math.abs(H)<R,F=Math.abs(H)>O.height-j.height-R;A({isNearBottom:N,isNearTop:F,showScrollToBottomButton:!N})},[R]),z=(0,Ue.useCallback)(D=>{let L=D>I.current;return I.current=D,L},[]),E=(0,Ue.useCallback)(()=>{},[]),v=(0,Ue.useCallback)((D=!0)=>{C.current&&C.current.scrollToOffset({offset:0,animated:D})},[]),B=(0,Ue.useCallback)((D,L=!0)=>{C.current&&C.current.scrollToOffset({offset:D,animated:L})},[]),k=(0,Ue.useCallback)((D,L=!0)=>{C.current&&C.current.scrollToIndex({index:D,animated:L})},[]),V=(0,Ue.useCallback)(D=>{z(D)&&M&&C.current&&setTimeout(()=>{v()},100)},[z,M,v]);return{flatListRef:C,scrollState:S,handleScroll:P,handleContentSizeChange:E,handleNewMessages:V,scrollToEnd:v,scrollToOffset:B,scrollToIndex:k}}var Ut=require("react");function so(T={}){let{enableMessageActions:R=!0}=T,[M,C]=(0,Ut.useState)({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0}),S=(0,Ut.useCallback)((P,z)=>{R&&C({actionSheetVisible:!0,selectedMessage:P,messagePosition:z})},[R]),A=(0,Ut.useCallback)(()=>{C({actionSheetVisible:!1,selectedMessage:null,messagePosition:void 0})},[]),I=(0,Ut.useCallback)((P,z)=>{if(!M.selectedMessage)return;let{selectedMessage:E}=M;switch(P){case"reply":z?.onReply?.(E);break;case"copy":if(z?.onCopy)z.onCopy(E);else{let v=E.type==="image"&&E.imageData?E.text||"Image message":E.text;Promise.resolve().then(()=>($s(),Ks)).then(({copyToClipboard:B})=>{B(v)}).catch(()=>{console.log("Clipboard functionality not available")})}break;case"delete":z?.onDelete?.(E.id);break;default:z?.onCustomAction?.(P,E);break}A()},[M.selectedMessage,A]);return{actionState:M,handleMessageLongPress:S,handleActionSheetClose:A,handleActionPress:I}}var dt=require("react");function ro(T={}){let{enableReactionDetails:R=!0}=T,[M,C]=(0,dt.useState)({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),[S,A]=(0,dt.useState)(null),I=(0,dt.useCallback)(B=>{R&&B.reactions&&B.reactions.length>0&&(A(B),C({isReactionDetailsVisible:!0,selectedReactions:B.reactions,selectedMessageText:B.text}))},[R]),P=(0,dt.useCallback)(()=>{C({isReactionDetailsVisible:!1,selectedReactions:[],selectedMessageText:""}),A(null)},[]),z=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B),P()},[S,P]),E=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B),P()},[S,P]),v=(0,dt.useCallback)((B,k)=>{S&&k?.(S.id,B)},[S]);return{reactionState:M,selectedMessage:S,handleReactionPress:I,handleReactionDetailsClose:P,handleAddReaction:z,handleRemoveReaction:E,handleEmojiReact:v}}var ao=require("react");function cs(){let[T,R]=(0,ao.useState)({replyToMessage:null}),M=(0,ao.useCallback)(S=>{R({replyToMessage:S})},[]),C=(0,ao.useCallback)(()=>{R({replyToMessage:null})},[]);return{replyState:T,setReplyToMessage:M,clearReply:C}}var qs=(0,yt.createContext)(null);function Kt(){let T=(0,yt.useContext)(qs);if(!T)throw new Error("useMessageListContext must be used within MessageListProvider");return T}function To({children:T,messages:R,config:M={},...C}){let S=oo(R,M),A=ls(M),I=so(M),P=ro(M),z=cs();yt.default.useEffect(()=>{A.handleNewMessages(R.length)},[R.length,A.handleNewMessages]);let E=(0,yt.useMemo)(()=>({messageList:S,scroll:A,actions:I,reactions:P,reply:z,config:M,callbacks:C}),[S,A,I,P,z,M,C]);return<qs.Provider value={E}>
401
+ {T}
402
+ </qs.Provider>}var Mo=require("react"),$t=require("react-native");var xt={Provider:To,Container:({children:T,style:R})=><$t.View style={[Ys.container,R]}>{T}</$t.View>,Messages:({renderMessage:T,style:R})=>{let{messageList:M,scroll:C,actions:S,reactions:A,callbacks:I}=Kt(),P=(0,Mo.useCallback)(({item:E,index:v})=>T&&E.listItemType!=="date-separator"?T({message:E,index:v})||null:E.listItemType==="date-separator"?<No date={E.date}displayDate={E.displayDate}/>:<Bo message={E}onLongPress={S.handleMessageLongPress}onReactionPress={A.handleReactionPress}onReactionRemove={I.onReactionRemove}/>,[S.handleMessageLongPress,A.handleReactionPress,I.onReactionRemove,T]),z=(0,Mo.useCallback)(E=>{C.handleScroll(E);let{isNearBottom:v,isNearTop:B}=C.scrollState;I.onScrollPositionChange?.(v,B),v&&I.onScrollToBottom?.(),B&&I.onScrollToTop?.()},[C.handleScroll,C.scrollState,I]);return<$t.FlatList ref={C.flatListRef}data={M.messageItems}renderItem={P}keyExtractor={M.keyExtractor}contentContainerStyle={[Ys.contentContainer,R]}onContentSizeChange={C.handleContentSizeChange}onScroll={z}{...M.flatListProps}/>},TypingIndicator:({isVisible:T})=>T?<Ht isVisible={T}/>:null,ScrollButton:({visible:T,isReplyActive:R,onPress:M})=>{let{scroll:C}=Kt();return<Ho visible={T??C.scrollState.showScrollToBottomButton}onPress={M??C.scrollToEnd}isReplyActive={R}/>},ActionSheet:()=>{let{actions:T,reactions:R,reply:M,callbacks:C,config:S}=Kt(),A=(0,Mo.useCallback)(P=>{T.handleActionPress(P,{onReply:z=>{M.setReplyToMessage(z),C.onReplyMessage?.(z)},onDelete:C.onMessageDelete,onCustomAction:C.onActionPress})},[T.handleActionPress,M.setReplyToMessage,C]),I=(0,Mo.useCallback)(P=>{console.log("\u{1F525} MessageListCompound - handleEmojiReact called with emoji:",P);let z=T.actionState.selectedMessage;console.log("\u{1F525} MessageListCompound - selectedMessage:",z?.id,"callbacks.onReactionAdd exists:",!!C.onReactionAdd),z&&C.onReactionAdd?(console.log("\u{1F525} MessageListCompound - Calling onReactionAdd for message:",z.id,"emoji:",P),C.onReactionAdd(z.id,P)):console.log("\u{1F525} MessageListCompound - NOT calling onReactionAdd. selectedMessage:",!!z,"callback exists:",!!C.onReactionAdd)},[T.actionState.selectedMessage,C.onReactionAdd]);return S.enableMessageActions?<Lo visible={T.actionState.actionSheetVisible}onClose={T.handleActionSheetClose}isMyMessage={T.actionState.selectedMessage?.isMe||!1}selectedMessage={T.actionState.selectedMessage||void 0}messagePosition={T.actionState.messagePosition}onActionPress={A}onEmojiReact={I}/>:null},ReactionDetails:()=>{let{reactions:T,callbacks:R,config:M}=Kt();return M.enableReactionDetails?<Eo visible={T.reactionState.isReactionDetailsVisible}onClose={T.handleReactionDetailsClose}reactions={T.reactionState.selectedReactions}messageText={T.reactionState.selectedMessageText}onRemoveReaction={C=>T.handleRemoveReaction(C,R.onReactionRemove)}/>:null}},Ys=$t.StyleSheet.create({container:{flex:1},contentContainer:{paddingVertical:16}});var pt=(0,$o.forwardRef)(({messages:T,isTyping:R,showScrollToBottom:M=!1,isReplyActive:C=!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 $o.default.useImperativeHandle(A,()=>({scrollToEnd:(z=!0)=>{},scrollToOffset:(z,E=!0)=>{},scrollToIndex:(z,E=!0)=>{}}),[]),<To messages={T}config={I}{...P}>
403
403
  <xt.Container>
404
404
  <xt.Messages/>
405
405
  <xt.TypingIndicator isVisible={R}/>
406
- <xt.ScrollButton visible={M?void 0:!1}isReplyActive={T}/>
406
+ <xt.ScrollButton visible={M?void 0:!1}isReplyActive={C}/>
407
407
  <xt.ActionSheet/>
408
408
  <xt.ReactionDetails/>
409
409
  </xt.Container>
410
- </Po>});pt.displayName="MessageList";var Xs=X(require("react"));function He(C){let R=Xs.default.forwardRef((T,S)=>(At(),<C{...T}ref={S}/>)),M=C.displayName||C.name||"Component";return R.displayName=`RequireAuth(${M})`,R}function it(C){return(...R)=>(At(),C(...R))}var Zo=require("react-native");var qe=require("react-native");var bt=require("react-native");var En=({avatar:C,isOnline:R=!1,size:M="medium"})=>{let T=$(),S=()=>{switch(M){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(M){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(M){case"small":return 14;case"large":return 28;default:return 20}})();return<bt.View style={{position:"relative"}}>
411
- {C&&C.trim()!==""?<bt.Image source={{uri:C}}style={[I,{borderRadius:T.borderRadius.full}]}resizeMode="cover"/>:<bt.View style={[I,{borderRadius:T.borderRadius.full,backgroundColor:T.colors.primary,justifyContent:"center",alignItems:"center"}]}>
412
- <bt.Text style={{color:T.colors.background,fontSize:E,fontWeight:"600"}}>
410
+ </To>});pt.displayName="MessageList";var Gs=Y(require("react"));function He(T){let R=Gs.default.forwardRef((C,S)=>(At(),<T{...C}ref={S}/>)),M=T.displayName||T.name||"Component";return R.displayName=`RequireAuth(${M})`,R}function st(T){return(...R)=>(At(),T(...R))}var qo=require("react-native");var Ke=require("react-native");var bt=require("react-native");var Br=({avatar:T,isOnline:R=!1,size:M="medium"})=>{let C=q(),S=()=>{switch(M){case"small":return{width:32,height:32};case"large":return{width:64,height:64};default:return{width:48,height:48}}},A=()=>{switch(M){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(M){case"small":return 14;case"large":return 28;default:return 20}})();return<bt.View style={{position:"relative"}}>
411
+ {T&&T.trim()!==""?<bt.Image source={{uri:T}}style={[I,{borderRadius:C.borderRadius.full}]}resizeMode="cover"/>:<bt.View style={[I,{borderRadius:C.borderRadius.full,backgroundColor:C.colors.primary,justifyContent:"center",alignItems:"center"}]}>
412
+ <bt.Text style={{color:C.colors.background,fontSize:E,fontWeight:"600"}}>
413
413
  👤
414
414
  </bt.Text>
415
415
  </bt.View>}
416
416
 
417
417
  {}
418
- {R&&<bt.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:T.colors.online,borderRadius:T.borderRadius.full,borderWidth:2,borderColor:T.colors.background}]}/>}
419
- </bt.View>},Vo=En;var On=({item:C,onPress:R})=>{let M=$(),T=C.unreadCount&&C.unreadCount>0;return<qe.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md,borderBottomWidth:1,borderBottomColor:M.colors.borderLight,backgroundColor:T?M.colors.unread:M.colors.background}}onPress={()=>R(C)}>
420
- <qe.View style={{marginRight:M.spacing.md}}>
421
- <Vo avatar={C.avatar}isOnline={C.isOnline}size="medium"/>
422
- </qe.View>
418
+ {R&&<bt.View style={[P,{position:"absolute",bottom:-2,right:-2,backgroundColor:C.colors.online,borderRadius:C.borderRadius.full,borderWidth:2,borderColor:C.colors.background}]}/>}
419
+ </bt.View>},Co=Br;var kr=({item:T,onPress:R})=>{let M=q(),C=T.unreadCount&&T.unreadCount>0;return<Ke.TouchableOpacity style={{flexDirection:"row",alignItems:"center",paddingHorizontal:M.spacing.lg,paddingVertical:M.spacing.md,borderBottomWidth:1,borderBottomColor:M.colors.borderLight,backgroundColor:C?M.colors.unread:M.colors.background}}onPress={()=>R(T)}>
420
+ <Ke.View style={{marginRight:M.spacing.md}}>
421
+ <Co avatar={T.avatar}isOnline={T.isOnline}size="medium"/>
422
+ </Ke.View>
423
423
 
424
- <qe.View style={{flex:1,marginRight:M.spacing.md}}>
424
+ <Ke.View style={{flex:1,marginRight:M.spacing.md}}>
425
425
  {}
426
- <qe.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:M.spacing.xs}}>
427
- <qe.Text style={{fontSize:M.typography.fontSize.base,flex:1,fontWeight:T?M.typography.fontWeight.bold:M.typography.fontWeight.semibold,color:M.colors.text}}>
428
- {C.name}
429
- </qe.Text>
430
- <qe.Text style={{fontSize:M.typography.fontSize.sm,marginLeft:M.spacing.sm,color:T?M.colors.gray[700]:M.colors.textSecondary,fontWeight:T?M.typography.fontWeight.medium:M.typography.fontWeight.normal}}>
431
- {C.time}
432
- </qe.Text>
433
- </qe.View>
426
+ <Ke.View style={{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:M.spacing.xs}}>
427
+ <Ke.Text style={{fontSize:M.typography.fontSize.base,flex:1,fontWeight:C?M.typography.fontWeight.bold:M.typography.fontWeight.semibold,color:M.colors.text}}>
428
+ {T.name}
429
+ </Ke.Text>
430
+ <Ke.Text style={{fontSize:M.typography.fontSize.sm,marginLeft:M.spacing.sm,color:C?M.colors.gray[700]:M.colors.textSecondary,fontWeight:C?M.typography.fontWeight.medium:M.typography.fontWeight.normal}}>
431
+ {T.time}
432
+ </Ke.Text>
433
+ </Ke.View>
434
434
 
435
435
  {}
436
- <qe.View style={{flexDirection:"row",alignItems:"center"}}>
437
- <qe.Text style={{fontSize:M.typography.fontSize.sm,flex:1,color:T?M.colors.gray[800]:M.colors.textSecondary,fontWeight:T?M.typography.fontWeight.medium:M.typography.fontWeight.normal}}numberOfLines={1}>
438
- {C.message}
439
- </qe.Text>
440
- {C.unreadCount&&<qe.View style={{width:20,height:20,backgroundColor:M.colors.primary,borderRadius:M.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:M.spacing.sm}}>
441
- <qe.Text style={{fontSize:M.typography.fontSize.xs,color:"white",fontWeight:M.typography.fontWeight.bold}}>
442
- {C.unreadCount}
443
- </qe.Text>
444
- </qe.View>}
445
- </qe.View>
446
- </qe.View>
447
- </qe.TouchableOpacity>},Bo=On;var Fn=({chats:C,onChatPress:R,onRefresh:M,refreshing:T=!1})=>{let S=({item:A})=><Bo item={A}onPress={R}/>;return<Zo.FlatList data={C}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={M?<Zo.RefreshControl refreshing={T}onRefresh={M}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},ys=Fn;var Qo=require("react-native");var Hn=({title:C})=>{let R=$();return<Qo.View style={{backgroundColor:R.colors.background,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.lg,borderBottomWidth:1,borderBottomColor:R.colors.borderLight}}>
448
- <Qo.Text style={{fontSize:R.typography.fontSize.xxl,fontWeight:R.typography.fontWeight.bold,color:R.colors.text}}>
449
- {C}
450
- </Qo.Text>
451
- </Qo.View>},xs=Hn;var Ct=require("react-native"),es=require("lucide-react-native");var Nn=({value:C,onChangeText:R,onClear:M,placeholder:T})=>{let S=$(),I=We()("search.placeholder");return<Ct.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
452
- <Ct.View style={{position:"relative"}}>
453
- <Ct.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
454
- <es.Search size={20}color={S.colors.textMuted}/>
455
- </Ct.View>
436
+ <Ke.View style={{flexDirection:"row",alignItems:"center"}}>
437
+ <Ke.Text style={{fontSize:M.typography.fontSize.sm,flex:1,color:C?M.colors.gray[800]:M.colors.textSecondary,fontWeight:C?M.typography.fontWeight.medium:M.typography.fontWeight.normal}}numberOfLines={1}>
438
+ {T.message}
439
+ </Ke.Text>
440
+ {T.unreadCount&&<Ke.View style={{width:20,height:20,backgroundColor:M.colors.primary,borderRadius:M.borderRadius.full,alignItems:"center",justifyContent:"center",marginLeft:M.spacing.sm}}>
441
+ <Ke.Text style={{fontSize:M.typography.fontSize.xs,color:"white",fontWeight:M.typography.fontWeight.bold}}>
442
+ {T.unreadCount}
443
+ </Ke.Text>
444
+ </Ke.View>}
445
+ </Ke.View>
446
+ </Ke.View>
447
+ </Ke.TouchableOpacity>},Ro=kr;var Lr=({chats:T,onChatPress:R,onRefresh:M,refreshing:C=!1})=>{let S=({item:A})=><Ro item={A}onPress={R}/>;return<qo.FlatList data={T}renderItem={S}keyExtractor={A=>A.id}showsVerticalScrollIndicator={!1}style={{flex:1}}refreshControl={M?<qo.RefreshControl refreshing={C}onRefresh={M}tintColor="#007AFF"colors={["#007AFF"]}/>:void 0}/>},ds=Lr;var Yo=require("react-native");var jr=({title:T})=>{let R=q();return<Yo.View style={{backgroundColor:R.colors.background,paddingHorizontal:R.spacing.lg,paddingVertical:R.spacing.lg,borderBottomWidth:1,borderBottomColor:R.colors.borderLight}}>
448
+ <Yo.Text style={{fontSize:R.typography.fontSize.xxl,fontWeight:R.typography.fontWeight.bold,color:R.colors.text}}>
449
+ {T}
450
+ </Yo.Text>
451
+ </Yo.View>},us=jr;var Tt=require("react-native"),Go=require("lucide-react-native");var Er=({value:T,onChangeText:R,onClear:M,placeholder:C})=>{let S=q(),I=ke()("search.placeholder");return<Tt.View style={{backgroundColor:S.colors.background,paddingHorizontal:S.spacing.lg,paddingVertical:S.spacing.md,borderBottomWidth:1,borderBottomColor:S.colors.borderLight}}>
452
+ <Tt.View style={{position:"relative"}}>
453
+ <Tt.View style={{position:"absolute",left:S.spacing.md,top:"50%",transform:[{translateY:-10}],zIndex:10}}>
454
+ <Go.Search size={20}color={S.colors.textMuted}/>
455
+ </Tt.View>
456
456
 
457
- <Ct.TextInput value={C}onChangeText={R}placeholder={T||I}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"/>
457
+ <Tt.TextInput value={T}onChangeText={R}placeholder={C||I}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"/>
458
458
 
459
- {C.length>0&&<Ct.TouchableOpacity onPress={M}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
460
- <es.X size={20}color={S.colors.textMuted}/>
461
- </Ct.TouchableOpacity>}
462
- </Ct.View>
463
- </Ct.View>},bs=Nn;var ut=require("react"),ts=X(require("dayjs")),vt=(0,ts.default)(),Zs=vt.subtract(1,"day"),Qs=vt.subtract(2,"day"),en=vt.subtract(3,"day"),Wn=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:en.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:en.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:Qs.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Qs.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:Zs.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:Zs.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:vt.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:vt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:vt.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:vt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],Cs=C=>{let R=Wn.map(v=>v.isMe?v:{...v,senderName:C||v.senderName}),[M,T]=(0,ut.useState)(R),S=(0,ut.useCallback)((v,k)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",k),!v.trim())return;let D={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,ts.default)().toISOString(),status:"sent",replyTo:k};T(V=>[...V,D]),setTimeout(()=>{T(V=>V.map(B=>B.id===D.id?{...B,status:"delivered"}:B))},1e3),setTimeout(()=>{T(V=>V.map(B=>B.id===D.id?{...B,status:"read"}:B))},3e3)},[]),A=(0,ut.useCallback)((v,k,D)=>{let V={id:Date.now(),text:k||"",isMe:!0,timestamp:(0,ts.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:D};T(B=>[...B,V]),setTimeout(()=>{T(B=>B.map(L=>L.id===V.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{T(B=>B.map(L=>L.id===V.id?{...L,status:"read"}:L))},3e3)},[]),I=(0,ut.useCallback)((v,k)=>{T(D=>D.map(V=>V.id===v?{...V,status:k}:V))},[]),P=(0,ut.useCallback)((v,k)=>{T(D=>D.map(V=>{if(V.id===v){let B=V.reactions||[],L=B.findIndex(F=>F.emoji===k);if(L>=0){let F=[...B];return F[L]={...F[L],count:F[L].count+1,users:[...F[L].users,"me"]},{...V,reactions:F}}else{let F={emoji:k,count:1,users:["me"]};return{...V,reactions:[...B,F]}}}return V}))},[]),z=(0,ut.useCallback)((v,k)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",k),T(D=>D.map(V=>{if(V.id===v){let B=V.reactions||[],L=B.findIndex(F=>F.emoji===k);if(L>=0){let F=B[L];if(F.count>1){let j=[...B];return j[L]={...F,count:F.count-1,users:F.users.filter(H=>H!=="me")},{...V,reactions:j}}else return{...V,reactions:B.filter(j=>j.emoji!==k)}}}return V}))},[]),E=(0,ut.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),T(k=>{let D=k.map(V=>V.id===v?{...V,deleted:!0}:V);return console.log("Message marked as deleted:",v),D})},[]);return{messages:M,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:z}};var $e=require("react");var Ms=(C={})=>{At();let[R,M]=(0,$e.useState)(C.initialMessages||[]),[T,S]=(0,$e.useState)(!1),A=(0,$e.useCallback)((B,L)=>{let F={id:Date.now(),text:B,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:L?{id:L.id,text:L.text,senderName:L.senderName,isMe:L.isMe}:void 0};M(j=>[F,...j])},[]),I=(0,$e.useCallback)(B=>{M(L=>[B,...L])},[]),P=(0,$e.useCallback)((B,L)=>{M(F=>F.map(j=>j.id===B?{...j,...L}:j))},[]),z=(0,$e.useCallback)(B=>{M(L=>L.filter(F=>F.id!==B))},[]),E=(0,$e.useCallback)((B,L)=>{M(F=>F.map(j=>{if(j.id!==B)return j;let H=j.reactions||[];if(H.find(O=>O.emoji===L))return{...j,reactions:H.map(O=>O.emoji===L?{...O,count:O.count+1,users:[...O.users,"current-user"]}:O)};{let O={emoji:L,count:1,users:["current-user"]};return{...j,reactions:[...H,O]}}}))},[]),v=(0,$e.useCallback)((B,L)=>{M(F=>F.map(j=>{if(j.id!==B)return j;let H=j.reactions||[],N=H.find(O=>O.emoji===L);return N?N.count<=1?{...j,reactions:H.filter(O=>O.emoji!==L)}:{...j,reactions:H.map(O=>O.emoji===L?{...O,count:O.count-1,users:O.users.filter(te=>te!=="current-user")}:O)}:j}))},[]),k=(0,$e.useCallback)(B=>{S(B)},[]),D=(0,$e.useCallback)(()=>{M(C.initialMessages||[]),S(!1)},[C.initialMessages]),V=(0,$e.useCallback)(B=>R.find(L=>L.id===B),[R]);return{messages:R,isTyping:T,sendMessage:A,addReaction:E,removeReaction:v,setMessages:M,addMessage:I,updateMessage:P,deleteMessage:z,setTyping:k,resetChat:D,getMessageById:V}};var os=require("react");var Un=He(is),Kn=He(rs),qn=it(Zt),$n=He(pt),Yn=He(mt),Gn=He(Eo),_n=He(Wt),Jn=He(ys),Xn=He(Bo),Zn=He(xs),Qn=He(bs),ea=He(Vo),ta=He(It),oa=He(ks),sa=it($),na=it(Ms),aa=it(Cs),ra=it(Ro),ia=it(So),la=it(wo),ca=it(Qt),da=it(To);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,I18nProvider,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,defaultTranslations,getAuthState,getProjectId,getTranslation,initChat,isInitialized,isSupportedLocale,useAttachments,useChatConfig,useChatMessages,useChatSDK,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme,useTranslation,useTranslationFunction});
459
+ {T.length>0&&<Tt.TouchableOpacity onPress={M}style={{position:"absolute",right:S.spacing.md,top:"50%",transform:[{translateY:-10}]}}hitSlop={{top:10,bottom:10,left:10,right:10}}>
460
+ <Go.X size={20}color={S.colors.textMuted}/>
461
+ </Tt.TouchableOpacity>}
462
+ </Tt.View>
463
+ </Tt.View>},ms=Er;var ut=require("react"),_o=Y(require("dayjs")),vt=(0,_o.default)(),_s=vt.subtract(1,"day"),Js=vt.subtract(2,"day"),Xs=vt.subtract(3,"day"),Fr=[{id:1,text:"Hi! How are you?",isMe:!1,timestamp:Xs.hour(10).minute(30).toISOString(),senderName:"Anna"},{id:2,text:"Hey! Great, thanks! And you?",isMe:!0,timestamp:Xs.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:Js.hour(14).minute(20).toISOString(),senderName:"Anna"},{id:4,text:"Maybe we could go to the movies?",isMe:!0,timestamp:Js.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:_s.hour(9).minute(15).toISOString(),senderName:"Anna"},{id:6,text:"Great! What movies are you interested in?",isMe:!0,timestamp:_s.hour(9).minute(20).toISOString()},{id:7,text:"Maybe something action or comedy?",isMe:!1,timestamp:vt.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:vt.hour(8).minute(35).toISOString()},{id:9,text:"Perfect! What time should we meet?",isMe:!1,timestamp:vt.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:vt.hour(9).minute(15).toISOString(),reactions:[{emoji:"\u{1F44D}",count:1,users:["anna"]},{emoji:"\u23F0",count:1,users:["me"]}]}],ps=T=>{let R=Fr.map(v=>v.isMe?v:{...v,senderName:T||v.senderName}),[M,C]=(0,ut.useState)(R),S=(0,ut.useCallback)((v,B)=>{if(console.log("sendMessage called with text:",v,"and replyTo:",B),!v.trim())return;let k={id:Date.now(),text:v.trim(),isMe:!0,timestamp:(0,_o.default)().toISOString(),status:"sent",replyTo:B};C(V=>[...V,k]),setTimeout(()=>{C(V=>V.map(D=>D.id===k.id?{...D,status:"delivered"}:D))},1e3),setTimeout(()=>{C(V=>V.map(D=>D.id===k.id?{...D,status:"read"}:D))},3e3)},[]),A=(0,ut.useCallback)((v,B,k)=>{let V={id:Date.now(),text:B||"",isMe:!0,timestamp:(0,_o.default)().toISOString(),status:"sent",type:"image",imageData:v,replyTo:k};C(D=>[...D,V]),setTimeout(()=>{C(D=>D.map(L=>L.id===V.id?{...L,status:"delivered"}:L))},1e3),setTimeout(()=>{C(D=>D.map(L=>L.id===V.id?{...L,status:"read"}:L))},3e3)},[]),I=(0,ut.useCallback)((v,B)=>{C(k=>k.map(V=>V.id===v?{...V,status:B}:V))},[]),P=(0,ut.useCallback)((v,B)=>{C(k=>k.map(V=>{if(V.id===v){let D=V.reactions||[],L=D.findIndex(O=>O.emoji===B);if(L>=0){let O=[...D];return O[L]={...O[L],count:O[L].count+1,users:[...O[L].users,"me"]},{...V,reactions:O}}else{let O={emoji:B,count:1,users:["me"]};return{...V,reactions:[...D,O]}}}return V}))},[]),z=(0,ut.useCallback)((v,B)=>{console.log("removeReaction 1212121 called with messageId:",v,"and emoji:",B),C(k=>k.map(V=>{if(V.id===v){let D=V.reactions||[],L=D.findIndex(O=>O.emoji===B);if(L>=0){let O=D[L];if(O.count>1){let j=[...D];return j[L]={...O,count:O.count-1,users:O.users.filter(H=>H!=="me")},{...V,reactions:j}}else return{...V,reactions:D.filter(j=>j.emoji!==B)}}}return V}))},[]),E=(0,ut.useCallback)(v=>{console.log("deleteMessage called with messageId:",v),C(B=>{let k=B.map(V=>V.id===v?{...V,deleted:!0}:V);return console.log("Message marked as deleted:",v),k})},[]);return{messages:M,sendMessage:S,sendImageMessage:A,updateMessageStatus:I,addReaction:P,deleteMessage:E,removeReaction:z}};var $e=require("react");var gs=(T={})=>{At();let[R,M]=(0,$e.useState)(T.initialMessages||[]),[C,S]=(0,$e.useState)(!1),A=(0,$e.useCallback)((D,L)=>{let O={id:Date.now(),text:D,isMe:!0,timestamp:new Date().toISOString(),status:"sent",replyTo:L?{id:L.id,text:L.text,senderName:L.senderName,isMe:L.isMe}:void 0};M(j=>[O,...j])},[]),I=(0,$e.useCallback)(D=>{M(L=>[D,...L])},[]),P=(0,$e.useCallback)((D,L)=>{M(O=>O.map(j=>j.id===D?{...j,...L}:j))},[]),z=(0,$e.useCallback)(D=>{M(L=>L.filter(O=>O.id!==D))},[]),E=(0,$e.useCallback)((D,L)=>{M(O=>O.map(j=>{if(j.id!==D)return j;let H=j.reactions||[];if(H.find(F=>F.emoji===L))return{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count+1,users:[...F.users,"current-user"]}:F)};{let F={emoji:L,count:1,users:["current-user"]};return{...j,reactions:[...H,F]}}}))},[]),v=(0,$e.useCallback)((D,L)=>{M(O=>O.map(j=>{if(j.id!==D)return j;let H=j.reactions||[],N=H.find(F=>F.emoji===L);return N?N.count<=1?{...j,reactions:H.filter(F=>F.emoji!==L)}:{...j,reactions:H.map(F=>F.emoji===L?{...F,count:F.count-1,users:F.users.filter(te=>te!=="current-user")}:F)}:j}))},[]),B=(0,$e.useCallback)(D=>{S(D)},[]),k=(0,$e.useCallback)(()=>{M(T.initialMessages||[]),S(!1)},[T.initialMessages]),V=(0,$e.useCallback)(D=>R.find(L=>L.id===D),[R]);return{messages:R,isTyping:C,sendMessage:A,addReaction:E,removeReaction:v,setMessages:M,addMessage:I,updateMessage:P,deleteMessage:z,setTyping:B,resetChat:k,getMessageById:V}};var Jo=require("react");var Zs=()=>{let T=ke(),R=()=>"en";return{formatDate:P=>Ds(P,T,R()),formatTime:P=>Zt(P,R()),formatRelative:P=>Bs(P,R()),formatDateTimeWithTime:P=>ks(P,T,R()),groupMessages:P=>Ao(P,R())}};var Or=He(ts),Hr=He(es),Nr=st(Jt),Wr=He(pt),Ur=He(mt),Kr=He(Po),$r=He(Ht),qr=He(ds),Yr=He(Ro),Gr=He(us),_r=He(ms),Jr=He(Co),Xr=He(It),Zr=He(Is),Qr=st(q),ea=st(gs),ta=st(ps),oa=st(oo),sa=st(so),ra=st(ro),aa=st(Xt),na=st(to),ia=st(Zs);0&&(module.exports={AttachmentMenu,Chat,ChatAvatar,ChatHeader,ChatItem,ChatList,ChatListSearchBar,ChatProvider,ChatScreenHeader,I18nProvider,MessageInput,MessageList,ThemeProvider,TypingIndicator,defaultTheme,defaultTranslations,getAuthState,getProjectId,getTranslation,initChat,isInitialized,isSupportedLocale,useAttachments,useChatConfig,useChatMessages,useChatSDK,useDateFormatter,useMessageActions,useMessageInput,useMessageList,useMessageReactions,useTheme,useTranslation,useTranslationFunction});