lua-ai-chat 0.0.19 → 0.0.22
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 +18 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -13
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
'use strict';var luaniverse=require('luaniverse'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),reactVisuallyHidden=require('@radix-ui/react-visually-hidden'),Bt=require('react-markdown'),prismReactRenderer=require('prism-react-renderer'),tl=require('dompurify'),reactLeaflet=require('react-leaflet');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Bt__default=/*#__PURE__*/_interopDefault(Bt);var tl__default=/*#__PURE__*/_interopDefault(tl);function Xl({onAudioRecorded:t,onClose:e,inputMessage:a}){let[l,r]=react.useState(false),[o,u]=react.useState(0),[c,i]=react.useState([]),[m,p]=react.useState(null),[n,s]=react.useState(null),g=react.useRef(null),x=react.useRef(null),d=react.useRef([]),v=react.useRef(null),h=react.useRef(null),N=react.useRef(null),w=react.useRef(null),f=react.useRef(false),y=react.useRef(false),U=react.useRef(null);react.useEffect(()=>{if(!l||!m)return;let A=setInterval(()=>{let k=Math.floor((Date.now()-m)/1e3);u(k);},1e3);return ()=>clearInterval(A)},[l,m]),react.useEffect(()=>((async()=>{if(!(f.current||y.current))try{f.current=!0;let k=await navigator.mediaDevices.getUserMedia({audio:!0});g.current=k,v.current=new AudioContext,h.current=v.current.createAnalyser(),h.current.fftSize=256,v.current.createMediaStreamSource(k).connect(h.current),N.current=new Uint8Array(h.current.frequencyBinCount);let _=()=>{if(!h.current||!N.current)return;h.current.getByteFrequencyData(N.current);let Qt=Array.from(N.current).map(Zt=>Zt/255);i(Qt),w.current=requestAnimationFrame(_);};_(),Gt();}catch(k){console.error("Error accessing microphone:",k),e();}finally{f.current=false;}})(),()=>{O();}),[]);let O=()=>{if(!y.current)try{if(y.current=!0,l&&x.current&&(x.current.stop(),r(!1),p(null)),g.current){let A=g.current.getAudioTracks(),k=g.current.getVideoTracks();A.forEach(R=>{R.stop(),R.enabled=!1;}),k.forEach(R=>{R.stop(),R.enabled=!1;});}w.current&&cancelAnimationFrame(w.current),v.current&&v.current.close(),g.current=null,x.current=null,d.current=[],v.current=null,h.current=null,N.current=null,w.current=null;}finally{y.current=false;}},Gt=()=>{if(!g.current)return;let k=["audio/webm","audio/mp4","audio/ogg","audio/wav"].find(_=>MediaRecorder.isTypeSupported(_));if(!k){console.error("No supported MIME type found for MediaRecorder"),e();return}U.current=k;let R=new MediaRecorder(g.current,{mimeType:k});x.current=R,d.current=[],R.ondataavailable=_=>{_.data.size>0&&d.current.push(_.data);},R.start(),r(true),p(Date.now()),u(0);},Kt=async()=>{if(!x.current||!g.current)return;r(false),s(o),p(null),x.current.stop(),await new Promise(k=>{x.current&&(x.current.onstop=()=>k());});let A=new Blob(d.current,{type:U.current||"audio/webm"});t(A,a),O(),e();},gt=A=>{let k=Math.floor(A/60),R=A%60;return `${k.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`};return jsxRuntime.jsxs("div",{className:"audio-recorder-container lua:bg-muted lua:rounded-lg lua:p-2 lua:flex lua:items-center lua:gap-4",children:[jsxRuntime.jsx(luaniverse.IconButton,{variant:"muted",onClick:async()=>{O(),e();},className:"audio-recorder-close-button lua:flex-shrink-0",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"audio-recorder-close-icon lua:text-gray-600 lua:dark:text-gray-400"})}),jsxRuntime.jsxs("div",{className:"audio-recorder-status lua:flex lua:items-center lua:gap-2",children:[jsxRuntime.jsx("div",{className:`audio-recorder-indicator lua:w-3 lua:h-3 lua:rounded-full ${l?"lua:bg-red-500 lua:animate-pulse":"lua:bg-gray-500 lua:dark:bg-gray-400"}`}),jsxRuntime.jsx("span",{className:"audio-recorder-time lua:text-gray-700 lua:dark:text-gray-200 lua:text-sm",children:gt(l?o:n||0)})]}),jsxRuntime.jsx("div",{className:"audio-recorder-visualizer lua:flex-1","data-testid":"audio-visualizer-bar",children:c.length>0&&jsxRuntime.jsx("div",{className:"audio-recorder-bars lua:h-8 lua:flex lua:items-center lua:w-full lua:gap-px sm:lua:gap-0.5 lua:md:gap-1",children:c.slice(0,50).map((A,k)=>jsxRuntime.jsx("div",{className:"audio-recorder-bar lua:flex-1 lua:bg-blue-600 lua:dark:bg-blue-400",style:{height:`${A*100}%`}},k))})}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:Kt,className:"audio-recorder-send-button lua:flex-shrink-0 lua:mr-1","data-testid":"send-audio-button",children:jsxRuntime.jsx(luaniverse.ArrowUp,{className:"audio-recorder-send-icon",color:"white"})})]})}function na(t){let e=Math.floor(t/60),a=t%60;return `${e.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function er({videoRef:t,isRecording:e,recordingTime:a,loading:l,onStartRecording:r,onStopRecording:o,onClose:u,open:c}){return jsxRuntime.jsx(luaniverse.Dialog,{open:c,onOpenChange:u,children:jsxRuntime.jsxs(luaniverse.DialogContent,{className:"lua:w-full lua:max-w-2xl lua:p-2.5",showClose:false,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsxs("div",{className:"lua:relative lua:aspect-[4/3] lua:bg-black lua:rounded-xl lua:overflow-hidden lua:mb-8",children:[jsxRuntime.jsx("video",{ref:t,autoPlay:true,playsInline:true,muted:true,className:"lua:absolute lua:inset-0 lua:w-full lua:h-full lua:object-cover",style:{backgroundColor:"black"}}),e&&jsxRuntime.jsxs("div",{className:"lua:absolute lua:top-4 lua:left-4 lua:flex lua:items-center lua:gap-2 lua:bg-black lua:bg-opacity-50 lua:px-3 lua:py-1 lua:rounded-full",children:[jsxRuntime.jsx("div",{className:"lua:w-2 lua:h-2 lua:rounded-full lua:bg-red-500 lua:animate-pulse"}),jsxRuntime.jsx("span",{className:"lua:text-sm lua:font-medium lua:text-white",children:na(a)})]})]}),jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center lua:items-center lua:gap-5 lua:mb-2.5",children:e?jsxRuntime.jsx(luaniverse.IconButton,{"data-testid":"stop-recording-button",onClick:o,disabled:l,variant:"secondary",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:text-gray-900 lua:dark:text-gray-100"})}):jsxRuntime.jsxs("svg",{onClick:r,"data-testid":"start-recording-button",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"36",height:"36",rx:"18",stroke:"#FF0342",strokeWidth:"4"}),jsxRuntime.jsx("rect",{x:"6",y:"6",width:"28",height:"28",rx:"14",fill:"#FF0342"})]})})]})})}function yt({url:t,alt:e,open:a,onClose:l}){return jsxRuntime.jsxs(luaniverse.Dialog,{open:a,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsx(luaniverse.DialogContent,{className:"lua:w-full lua:fixed lua:inset-0 lua:h-full lua:max-w-none lua:p-0 lua:bg-transparent lua:shadow-none lua:translate-x-0 lua:translate-y-0 lua:m-0 lua:rounded-none",showClose:false,children:jsxRuntime.jsxs("div",{className:"lua:relative lua:w-full lua:h-full",children:[jsxRuntime.jsx("button",{onClick:l,className:"lua:cursor-pointer lua:absolute lua:top-4 lua:left-4 lua:z-10 lua:p-2 lua:bg-black/50 lua:rounded-full lua:hover:bg-black/70 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{color:"white",className:"lua:w-6 lua:h-6"})}),jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("img",{src:t,alt:e,className:"sm:lua:aspect-[16/9] lua:object-contain lua:rounded-none sm:lua:rounded-lg"})})]})})]})}function wt({images:t,initialIndex:e=0,open:a,onClose:l}){let[r,o]=react.useState(),[u,c]=react.useState(0);return react.useEffect(()=>{if(!r)return;e>0&&e<t.length&&(r.scrollTo(e),c(e));let i=()=>{c(r.selectedScrollSnap());};return r.on("select",i),i(),()=>{r?.off("select",i);}},[r,e,t.length]),jsxRuntime.jsxs(luaniverse.Dialog,{open:a,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsx(luaniverse.DialogContent,{className:"lua:w-full lua:m-0",showClose:false,children:jsxRuntime.jsxs("div",{className:"lua:relative lua:w-full lua:h-full",children:[jsxRuntime.jsx("button",{onClick:l,className:"lua:cursor-pointer lua:absolute lua:top-4 lua:left-4 lua:z-10 lua:p-2 lua:bg-black/50 lua:rounded-full lua:hover:bg-black/70 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{color:"white",className:"lua:w-6 lua:h-6"})}),t.length>1&&jsxRuntime.jsxs("div",{className:"lua:absolute lua:top-4 lua:right-4 lua:z-10 lua:px-3 lua:py-1 lua:bg-black/50 lua:rounded-full lua:text-white lua:text-sm",children:[u+1," / ",t.length]}),jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:flex lua:items-center lua:justify-center lua:px-16",children:jsxRuntime.jsxs(luaniverse.Carousel,{setApi:o,className:"lua:w-full lua:max-w-5xl",opts:{align:"center",loop:t.length>1},children:[jsxRuntime.jsx(luaniverse.CarouselContent,{children:t.map((i,m)=>jsxRuntime.jsx(luaniverse.CarouselItem,{className:"lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("img",{src:i.src,alt:i.alt||`Image ${m+1}`,className:"lua:max-w-full lua:max-h-screen lua:object-contain lua:rounded-none sm:lua:rounded-lg",draggable:false})},m))}),t.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(luaniverse.CarouselPrevious,{className:"lua:left-4 lua:bg-black/50 lua:border-none lua:text-white lua:hover:bg-black/70 lua:hover:text-white-white/70"}),jsxRuntime.jsx(luaniverse.CarouselNext,{className:"lua:right-4 lua:bg-black/50 lua:border-none lua:text-white lua:hover:bg-black/70 lua:hover:text-white-white/70"})]})]})})]})})]})}function gr({videoRef:t,canvasRef:e,onCapture:a,onClose:l,open:r}){return jsxRuntime.jsxs(luaniverse.Dialog,{open:r,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsxs(luaniverse.DialogContent,{className:"lua:w-full lua:max-w-2xl lua:p-2.5",showClose:false,children:[jsxRuntime.jsxs("div",{className:"lua:relative lua:aspect-[16/9] lua:bg-black lua:rounded-xl lua:overflow-hidden",children:[jsxRuntime.jsx("video",{ref:t,autoPlay:true,playsInline:true,muted:true,className:"lua:absolute lua:inset-0 lua:w-full lua:h-full lua:object-cover",style:{backgroundColor:"black"}}),jsxRuntime.jsx("canvas",{ref:e,className:"lua:hidden"})]}),jsxRuntime.jsxs("div",{className:"lua:flex lua:justify-center lua:items-center lua:gap-5 lua:mb-2.5 lua:mt-6",children:[jsxRuntime.jsx(luaniverse.IconButton,{onClick:a,"data-testid":"capture-button",children:jsxRuntime.jsx(luaniverse.Camera,{className:"lua:text-white"})}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:l,variant:"secondary",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:text-gray-900 lua:dark:text-gray-100"})})]})]})]})}function vr({locationError:t,currentLocation:e,loading:a,onShare:l,onClose:r}){return jsxRuntime.jsx("div",{className:"lua:fixed lua:inset-0 lua:bg-black lua:bg-opacity-75 lua:flex lua:items-center lua:justify-center lua:z-50",children:jsxRuntime.jsxs("div",{className:"lua:bg-card lua:rounded-lg lua:p-4 lua:max-w-2xl lua:w-full lua:mx-4",children:[jsxRuntime.jsxs("div",{className:"lua:flex lua:justify-between lua:items-center lua:mb-4",children:[jsxRuntime.jsx("h3",{className:"lua:text-lg lua:font-semibold lua:text-gray-900 lua:dark:text-gray-50",children:"Share Location"}),jsxRuntime.jsx("button",{onClick:r,className:"lua:text-gray-500 lua:dark:text-gray-400 lua:hover:text-gray-700 lua:dark:hover:text-gray-200",children:jsxRuntime.jsx("svg",{className:"lua:w-6 lua:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t?jsxRuntime.jsx("div",{className:"lua:bg-red-50 lua:dark:bg-red-900/30 lua:text-red-500 lua:dark:text-red-400 lua:p-4 lua:rounded-lg lua:mb-4",children:t}):e?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"lua:mb-4",children:[jsxRuntime.jsx("div",{className:"lua:text-sm lua:text-gray-500 lua:dark:text-gray-400 lua:mb-2",children:"Current Location:"}),jsxRuntime.jsx("div",{className:"lua:text-gray-700 lua:dark:text-gray-200 lua:mb-2",children:e.address}),jsxRuntime.jsxs("div",{className:"lua:text-sm lua:text-gray-500 lua:dark:text-gray-400",children:[e.latitude.toFixed(6),","," ",e.longitude.toFixed(6)]})]})}):jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center lua:items-center lua:h-48",children:jsxRuntime.jsx("div",{className:"lua:animate-spin lua:rounded-full lua:h-8 lua:w-8 lua:border-b-2 lua:border-blue-500"})}),jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center",children:e&&jsxRuntime.jsxs("button",{onClick:l,disabled:a,className:`lua:px-4 lua:py-2 lua:rounded-full ${a?"lua:bg-blue-300 lua:dark:bg-blue-800 lua:cursor-not-allowed":"lua:bg-blue-500 lua:hover:bg-blue-600 lua:dark:bg-blue-600 lua:dark:hover:bg-blue-700"} lua:text-white lua:flex lua:items-center lua:gap-2`,children:[jsxRuntime.jsx("svg",{className:"lua:w-5 lua:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"})}),a?"Sharing...":"Share Location"]})})]})})}function Ia(t){let e=[],a=t.split(`
|
|
2
|
-
`).filter(l=>l.trim()!=="");for(let l of a){let r=/\[([^\]]+)\]\(([^)]+)\)\s+filename:([^\s]+)\s+mime:([^\s]+)/g,
|
|
3
|
-
`)?jsxRuntime.jsx("code",{className:
|
|
4
|
-
`).filter(a=>a.trim()).filter(a=>a.trim().startsWith("-")).map(a=>({text:a.trim().substring(1).trim(),onClick:a.trim().substring(1).trim()})),
|
|
5
|
-
:::`)}var
|
|
6
|
-
`);let e=[],a="",l="",r="",
|
|
7
|
-
`);for(let w=0;w<
|
|
8
|
-
`:
|
|
9
|
-
`:
|
|
10
|
-
`:
|
|
11
|
-
`:
|
|
12
|
-
`:
|
|
13
|
-
`:
|
|
14
|
-
`:
|
|
15
|
-
`;}return p?e.push({type:"list-item",content:l.trim(),isComplete:false}):n?e.push({type:"payment",content:r.trim(),isComplete:false}):s?e.push({type:"actions",content:o.trim(),isComplete:false}):g?e.push({type:"images",content:u.trim(),isComplete:false}):x?e.push({type:"links",content:c.trim(),isComplete:false}):d?e.push({type:"navigate",content:i.trim(),isComplete:false}):v?e.push({type:"documents",content:m.trim(),isComplete:false}):a.trim()&&e.push({type:"text",content:a.trim()}),e},It=el;function al(t){let e=new Set(["br","hr","img","input","meta","link"]),a=[],l=/<\/?([a-z][a-z0-9]*)[^>]*>/gi,r=l.exec(t);for(;r!==null;){let o=r[0],u=r[1].toLowerCase();if(e.has(u)||o.endsWith("/>")){r=l.exec(t);continue}if(o.startsWith("</")){if(a.length===0||a.pop()!==u)return false}else a.push(u);r=l.exec(t);}return a.length===0}function Ut(t){let e=new Set(["br","hr","img","input","meta","link"]),a=/<\/?([a-z][a-z0-9]*)[^>]*>/gi,r=0,o=[],u;for(a.lastIndex=0;(u=a.exec(t))!==null;){let m=u[0],p=u[1].toLowerCase(),s=u.index+m.length;if(e.has(p)||m.endsWith("/>")){o.length===0&&(r=s);continue}m.startsWith("</")?o.length>0&&o[o.length-1]===p&&(o.pop(),o.length===0&&(r=s)):o.push(p);}let c=t.substring(0,r),i=r<t.length||o.length>0;return {completeHtml:c,hasIncompleteContent:i}}function Dt(t){return /^\s*<[a-z]+[\s>]/i.test(t.trim())?{isHtml:true,isComplete:al(t)}:{isHtml:false,isComplete:false}}function Ve(t){if(typeof window>"u")return "";let e={ALLOWED_TAGS:["div","b","ol","ul","li","a","br"],ALLOWED_ATTR:["style","href","target","rel"],ALLOW_DATA_ATTR:false,ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};return tl__default.default.sanitize(t,e)}function Me({images:t}){let[e,a]=react.useState(false),[l,r]=react.useState(0),o=react.useRef(null),[u,c]=react.useState(false),[i,m]=react.useState(0),[p,n]=react.useState(0),[s,g]=react.useState(0),x=react.useCallback(y=>{o.current&&(c(true),m(y.pageX-o.current.offsetLeft),n(o.current.scrollLeft),g(0),y.preventDefault());},[]),d=react.useCallback(y=>{if(!u||!o.current)return;y.preventDefault();let U=y.pageX-o.current.offsetLeft,O=(U-i)*2;o.current.scrollLeft=p-O,g(Math.abs(U-i));},[u,i,p]),v=react.useCallback(()=>{c(false);},[]),h=react.useCallback(()=>{c(false);},[]),N=react.useCallback((y,U)=>{if(s>5){U.preventDefault();return}r(y),a(true);},[s]);return jsxRuntime.jsxs("div",{"data-testid":"image-carousel-message",className:"chat-image-carousel-message lua:w-full",children:[jsxRuntime.jsx("div",{ref:o,className:"chat-image-carousel markdown-image-carousel",style:{cursor:u?"grabbing":"grab"},onMouseDown:x,onMouseMove:d,onMouseUp:v,onMouseLeave:h,onDragStart:y=>{y.preventDefault(),y.stopPropagation();},onDragOver:y=>{y.preventDefault(),y.stopPropagation();},children:t.map((y,U)=>jsxRuntime.jsx("div",{className:"chat-carousel-image-item markdown-image-item",onClick:O=>N(U,O),children:jsxRuntime.jsx("img",{src:y.src,alt:y.alt,draggable:false,style:{userSelect:"none"}})},y.src))}),jsxRuntime.jsx(wt,{images:t,initialIndex:l,open:e,onClose:()=>a(false)})]})}function We({message:t}){let[e,a]=react.useState(false);return t.url?jsxRuntime.jsxs("div",{"data-testid":"image-message",className:"chat-image-message lua:flex lua:flex-col lua:w-3/5 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsxs("div",{className:"chat-image-container lua:relative",children:[jsxRuntime.jsx("img",{src:t.url,alt:t.content,className:"chat-image lua:rounded-lg lua:w-full lua:cursor-pointer",onClick:()=>a(true)}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-image-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsxs("div",{className:"lua:text-white lua:text-sm",children:["Uploading..."," ",t.uploadProgress?Math.round(t.uploadProgress):0,"%"]})})]}),!t.isUploading&&t.content.length>0&&jsxRuntime.jsx("div",{className:"chat-image-caption lua:w-full lua:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:p-3 lua:mt-8",children:t.content}),jsxRuntime.jsx(yt,{url:t.url,alt:t.content,open:e,onClose:()=>a(false)})]}):null}function qe({url:t,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l}){let[r,o]=react.useState(null),[u,c]=react.useState(true),[i,m]=react.useState(null);return react.useEffect(()=>{t&&e&&!l&&(async()=>{try{c(!0),m(null);let n=a;if(!n)throw new Error("No auth token available");let s=await fetch(`${e}/chat/url-metadata?url=${encodeURIComponent(t)}`,{headers:{Authorization:`Bearer ${n}`}});if(!s.ok)throw new Error(`Failed to fetch preview: ${s.status}`);let g=await s.json();o(g);}catch(n){console.error("Error fetching link preview:",n),m(n instanceof Error?n.message:"Failed to load preview");}finally{c(false);}})();},[t,e]),l?jsxRuntime.jsx("div",{className:"lua:mb-5 lua:mx-[-30px]",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:max-w-full",children:jsxRuntime.jsx(luaniverse.Button,{variant:"muted",className:"lua:w-full lua:justify-start",children:jsxRuntime.jsx("span",{className:"lua:truncate lua:block",children:Ue(t)})})})}):u?jsxRuntime.jsxs("div",{className:"lua:animate-pulse",children:[jsxRuntime.jsx("div",{className:"lua:bg-gray-300 lua:dark:bg-gray-600 lua:h-4 lua:w-3/4 lua:mb-2 lua:rounded"}),jsxRuntime.jsx("div",{className:"lua:bg-gray-300 lua:dark:bg-gray-600 lua:h-3 lua:w-1/2 lua:rounded"})]}):i||!r?jsxRuntime.jsx("div",{className:"lua:mb-5 lua:mx-[-30px]",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:max-w-full",children:jsxRuntime.jsx(luaniverse.Button,{variant:"muted",className:"lua:w-full lua:justify-start",children:jsxRuntime.jsx("span",{className:"lua:truncate lua:block",children:Ue(t)})})})}):jsxRuntime.jsxs("a",{href:r.url||t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:border lua:border-gray-200 lua:dark:border-gray-700 lua:rounded-lg lua:p-3 lua:hover:bg-gray-50 lua:dark:hover:bg-gray-800 lua:transition-colors lua:no-underline lua:max-w-sm",children:[r.image&&jsxRuntime.jsx("img",{src:r.image,alt:r.title,className:"lua:w-full lua:h-32 lua:object-cover lua:rounded lua:mb-2",onError:p=>{p.currentTarget.style.display="none";}}),jsxRuntime.jsx("div",{className:"lua:text-sm lua:font-medium lua:text-gray-900 lua:dark:text-gray-50 lua:mb-1 lua:line-clamp-2",children:r.title}),r.description&&jsxRuntime.jsx("div",{className:"lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:line-clamp-2",children:r.description}),jsxRuntime.jsx("div",{className:"lua:text-xs lua:text-gray-400 lua:dark:text-gray-500 lua:mt-1 lua:truncate",children:new URL(r.url||t).hostname})]})}function Le({links:t,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l}){return jsxRuntime.jsx("div",{"data-testid":"link-list-message",className:"chat-link-list-message lua:w-full",children:jsxRuntime.jsx("div",{className:"chat-links-container lua:space-y-2 lua:mx-4 lua:sm:mx-5",children:t.map(r=>jsxRuntime.jsx(qe,{url:r,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l},r))})})}function Ge({location:t}){let e=[t.latitude,t.longitude];return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-48 lua:rounded-lg lua:overflow-hidden",children:jsxRuntime.jsxs(reactLeaflet.MapContainer,{center:e,zoom:15,scrollWheelZoom:false,className:"lua:w-full lua:h-full",children:[jsxRuntime.jsx(reactLeaflet.TileLayer,{attribution:'\xA9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),jsxRuntime.jsx(reactLeaflet.Marker,{position:e,children:t.address&&jsxRuntime.jsx(reactLeaflet.Popup,{children:jsxRuntime.jsx("div",{children:t.address})})})]})})}function Ke({location:t}){return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:rounded-lg lua:flex lua:items-center lua:justify-center lua:flex-col",children:t.address&&jsxRuntime.jsx(Ge,{location:t})})}function Qe({location:t}){return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-60 lua:rounded-lg","data-testid":"location-preview",children:jsxRuntime.jsx(Ke,{location:t})})}function Ze({message:t}){return jsxRuntime.jsx("div",{"data-testid":"location-message",className:"chat-location-message lua:flex lua:flex-col lua:w-11/12 sm:lua:w-3/5 lua:bg-muted lua:text-foreground lua:rounded-2xl lua:p-3 lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsxs("div",{className:"chat-location-preview-container location-preview-container lua:relative",children:[t.location&&jsxRuntime.jsx(Qe,{location:t.location}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-location-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("div",{className:"lua:text-white lua:text-sm",children:"Sharing location..."})}),jsxRuntime.jsxs("div",{className:"chat-location-info lua:flex lua:items-center lua:gap-2 lua:mt-3",children:[jsxRuntime.jsx(luaniverse.MapPin,{className:"lua:fill-gray-800 lua:dark:fill-gray-100"}),jsxRuntime.jsx("div",{className:"lua:flex-1",children:jsxRuntime.jsx("div",{className:"lua:text-sm",children:t.content})})]})]})})}function Je({url:t,onNavigate:e}){let[a,l]=react.useState(false);return react.useEffect(()=>{if(e&&!a){l(true);let r=we(t);e(r.pathname,{...r.queryParams&&{query:r.queryParams}});}},[a,e]),null}function tt({message:t}){return jsxRuntime.jsxs("div",{"data-testid":"video-message",className:"chat-video-message lua:flex lua:flex-col lua:w-3/5 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsxs("div",{className:"chat-video-container lua:relative",children:[jsxRuntime.jsx("video",{src:t.url,controls:true,className:"chat-video lua:rounded-lg lua:w-full"}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-video-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsxs("div",{className:"lua:text-white lua:text-sm",children:["Uploading..."," ",t.uploadProgress?Math.round(t.uploadProgress):0,"%"]})})]}),!t.isUploading&&t.content&&jsxRuntime.jsx("div",{className:"chat-video-caption lua:w-full lua:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:p-3 lua:mt-8",children:t.content})]})}function hl(t){return new Date(t).toLocaleTimeString()}function vl(t){return {icon:()=>null}}var bn=react.memo(function({message:e,onSelect:a,luaApiUrl:l,authToken:r,disablePreviewOnLinks:o=false,onNavigate:u}){let c=react.useCallback(p=>{let n=p.match(/^#\s+(.+)$/m),s=p.match(/^##\s+(.+)$/m),g=n?n[1]:"",x=s?s[1]:"",d=`${g}. ${x}`;a&&a(d);},[a]),i=react.useCallback(p=>{if(!a)return;let n=Rt(p).trim();a(n);},[a]),m=react.useCallback(()=>{if(e.type==="location")return jsxRuntime.jsx(Ze,{message:e});if(e.mediaType?.startsWith("video"))return e.url?jsxRuntime.jsx(tt,{message:{url:e.url,content:e.content||"",isUploading:e.isUploading,uploadProgress:e.uploadProgress}}):null;if(e.mediaType?.startsWith("image"))return e.url?jsxRuntime.jsx(We,{message:{url:e.url,content:e.content||"",isUploading:e.isUploading,uploadProgress:e.uploadProgress}}):null;if(e.mediaType?.startsWith("audio"))return jsxRuntime.jsx(Pt,{message:e});if(e.type==="file"&&e.mediaType){let x=vl(new File([],"",{type:e.mediaType})).icon;return jsxRuntime.jsx("a",{"data-testid":"chat-file-message",href:e.url,target:"_blank",rel:"noopener noreferrer",className:"chat-file-message lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsxs("div",{className:"lua:flex lua:flex-col lua:gap-8",children:[jsxRuntime.jsxs("div",{className:"chat-file-card lua:flex lua:items-center lua:justify-start lua:p-3 lua:border lua:border-border lua:rounded-lg lua:bg-card lua:dark:bg-card lua:w-80",children:[jsxRuntime.jsx(x,{className:"lua:w-12 lua:h-12 lua:text-gray-500 lua:dark:text-gray-400"}),jsxRuntime.jsxs("div",{className:"lua:flex lua:flex-col lua:gap-1 lua:pl-2",children:["File",jsxRuntime.jsx("span",{className:"lua:text-gray-500 lua:dark:text-gray-400 lua:text-sm",children:e.mediaType})]})]}),e.content&&jsxRuntime.jsx("div",{className:"chat-file-content lua:bg-muted lua:dark:bg-muted lua:rounded-2xl lua:px-4 lua:py-2 lua:w-80",children:jsxRuntime.jsx("div",{className:"lua:text-sm lua:text-foreground",children:e.content})})]})})}if(e.role==="user")return e.content;if(e.content==="...")return null;let p=Dt(e.content);if(p.isHtml){if(p.isComplete){let d=Ve(e.content);return jsxRuntime.jsx("div",{className:"chat-html-content lua:prose lua:prose-sm lua:max-w-none lua:mx-4 lua:sm:mx-5",dangerouslySetInnerHTML:{__html:d}})}let{completeHtml:g,hasIncompleteContent:x}=Ut(e.content);if(g){let d=Ve(g);return jsxRuntime.jsxs("div",{className:"lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsx("div",{className:"chat-html-content lua:prose lua:prose-sm lua:max-w-none",dangerouslySetInnerHTML:{__html:d}}),x&&jsxRuntime.jsx("div",{className:"lua:flex lua:items-center lua:gap-2 lua:text-gray-500 lua:dark:text-gray-400 lua:mt-2",children:jsxRuntime.jsx(luaniverse.LogoSpinner,{size:14})})]})}return jsxRuntime.jsx("div",{className:"lua:flex lua:items-center lua:gap-2 lua:text-gray-500 lua:dark:text-gray-400 lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsx("div",{className:"lua:animate-pulse",children:"\u25CF\u25CF\u25CF"})})}let n=It(e.content),s=be(i);return jsxRuntime.jsx("div",{className:"chat-markdown-content lua:prose lua:prose-sm lua:max-w-none",children:jsxRuntime.jsx("div",{className:"lua:flex lua:flex-wrap lua:gap-4",children:(()=>{if(n.filter(d=>d.type==="list-item").length>1){let d=[],v=[];return n.forEach(h=>{h.type==="list-item"?v.push(h):(v.length>0&&(d.push(v),v=[]),d.push([h]));}),v.length>0&&d.push(v),d.map((h,N)=>h.length>1&&h[0].type==="list-item"?jsxRuntime.jsx(Tt,{group:h,onCardClick:c,onListItemClick:i,onNavigate:u},N):h.map((w,f)=>{if(w.type==="list-item")return jsxRuntime.jsx(oe,{block:w,onCardClick:c,onListItemClick:i,onNavigate:u},f);if(w.type==="actions")return He(w.content).length>0&&w.isComplete,null;if(w.type==="images"){let y=Fe(w.content);if(y.length>0)return jsxRuntime.jsx(Me,{images:y},f)}if(w.type==="links"){let y=Oe(w.content);return y.length>0&&w.isComplete?jsxRuntime.jsx(Le,{links:y,luaApiUrl:l||"",authToken:r||"",disablePreviewOnLinks:o},f):null}if(w.type==="navigate"){let y=Be(w.content);return y&&w.isComplete?jsxRuntime.jsx(Je,{text:y.text,url:y.url,onNavigate:u},f):null}if(w.type==="documents"){let y=Ie(w.content);return jsxRuntime.jsx(Ne,{documents:y},f)}if(w.type==="payment"){let y=ze(w.content);return y?jsxRuntime.jsx("div",{className:"chat-payment-message lua:w-full lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsx(Se,{url:y})},f):null}return jsxRuntime.jsx("div",{className:"chat-markdown-block lua:w-full",children:jsxRuntime.jsx(Bt__default.default,{components:s,children:w.content})},f)}))}return n.map((d,v)=>{if(d.type==="list-item")return jsxRuntime.jsx(oe,{block:d,onCardClick:c,onListItemClick:i,onNavigate:u},v);if(d.type==="actions")return He(d.content).length>0&&d.isComplete,null;if(d.type==="images"){let h=Fe(d.content);if(h.length>0)return jsxRuntime.jsx(Me,{images:h},v)}if(d.type==="navigate"){let h=Be(d.content);return h&&d.isComplete?jsxRuntime.jsx(Je,{text:h.text,url:h.url,onNavigate:u},v):null}if(d.type==="documents"){let h=Ie(d.content);return jsxRuntime.jsx(Ne,{documents:h},v)}if(d.type==="links"){let h=Oe(d.content);return h.length>0&&d.isComplete?jsxRuntime.jsx(Le,{links:h,luaApiUrl:l||"",authToken:r||"",disablePreviewOnLinks:o},v):null}if(d.type==="payment"){let h=ze(d.content);return h?jsxRuntime.jsx("div",{className:"chat-payment-message lua:w-full lua:mx-4 lua:sm:mx-5 lua:mb-5",children:jsxRuntime.jsx(Se,{url:h})},v):null}return jsxRuntime.jsx("div",{className:"chat-markdown-block lua:w-full",children:jsxRuntime.jsx(Bt__default.default,{components:s,children:d.content})},v)})})()})})},[e,c,i]);return jsxRuntime.jsxs("div",{className:`chat-message-container lua:flex lua:flex-col ${e.role==="user"?"lua:items-end":"lua:items-start"} lua:gap-1`,children:[jsxRuntime.jsxs("div",{className:`lua:flex ${e.role==="user"?"lua:justify-end":"lua:justify-start"} lua:items-start lua:gap-2 lua:w-full`,children:[!["file","image","video","tool","location"].includes(e.type||"")&&e.content!=="..."&&jsxRuntime.jsx("div",{className:`chat-message-bubble ${e.role==="user"?"chat-message-bubble-user lua:max-w-full lua:md:max-w-3/5 lua:bg-muted lua:dark:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:py-3 lua:mx-4 lua:sm:mx-5 lua:whitespace-pre-wrap":"chat-message-bubble-agent lua:w-full lua:bg-card lua:dark:bg-card lua:text-foreground lua:rounded-lg lua:py-3 lua:rounded-bl-none"}`,style:{wordBreak:"break-word"},children:m()}),["file","image","video","location"].includes(e.type||"")&&m()]}),jsxRuntime.jsx("div",{className:`lua-message-timestamp lua:text-xs lua:text-gray-400 lua:dark:text-gray-500 lua:px-1 ${e.role==="user"?"lua:mr-4 sm:lua:mr-5":"lua:ml-4 sm:lua:ml-5"}`,children:hl(e.createdAt)})]})});var lt=react.createContext(void 0),rt=react.createContext(void 0),ot=react.createContext(void 0),nt=react.createContext(void 0),it=react.createContext(void 0);function Mn({children:t}){let[e,a]=react.useState([]),[l,r]=react.useState(""),[o,u]=react.useState(null),[c,i]=react.useState(false),[m]=react.useState(new Map),p=react.useCallback(s=>{if(!m.has(s)){let g=URL.createObjectURL(s);m.set(s,g);}return m.get(s)},[m]),n=react.useCallback(s=>{let g=m.get(s);g&&(URL.revokeObjectURL(g),m.delete(s));},[m]);return react.useEffect(()=>()=>{e.forEach(s=>{s.url&&s.url.startsWith("blob:")&&URL.revokeObjectURL(s.url);}),m.forEach(s=>URL.revokeObjectURL(s));},[e,m]),jsxRuntime.jsx(lt.Provider,{value:{messages:e,setMessages:a},children:jsxRuntime.jsx(rt.Provider,{value:{inputMessage:l,setInputMessage:r},children:jsxRuntime.jsx(ot.Provider,{value:{loadingMessage:o,setLoadingMessage:u},children:jsxRuntime.jsx(nt.Provider,{value:{hasUnreadMessages:c,setHasUnreadMessages:i},children:jsxRuntime.jsx(it.Provider,{value:{getFileUrl:p,removeFileUrl:n},children:t})})})})})}function Tn(){let t=react.useContext(lt);if(t===void 0)throw new Error("useMessages must be used within a ChatProvider");return t}function $t(){let t=react.useContext(rt);if(t===void 0)throw new Error("useInput must be used within a ChatProvider");return t}function Ln(){let t=react.useContext(ot);if(t===void 0)throw new Error("useLoadingMessage must be used within a ChatProvider");return t}function Pn(){let t=react.useContext(it);if(t===void 0)throw new Error("useFileUrls must be used within a ChatProvider");return t}function An(){let t=react.useContext(nt);if(t===void 0)throw new Error("useUnreadMessages must be used within a ChatProvider");return t}function z(){let t=react.useContext(lt),e=react.useContext(rt),a=react.useContext(ot),l=react.useContext(nt),r=react.useContext(it);if(t===void 0||e===void 0||a===void 0||l===void 0||r===void 0)throw new Error("useChat must be used within a ChatProvider");return {...t,...e,...a,...l,...r}}function En(){let{loadingMessage:t}=z();return t?jsxRuntime.jsxs("div",{className:"chat-loading-message lua:flex lua:items-center lua:gap-2 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsx(luaniverse.Logo,{size:24,className:"chat-loading-logo lua:w-6 lua:h-6 lua:rounded-full lua:flex-shrink-0 lua:animate-spin",style:{animationDuration:"3s"}}),jsxRuntime.jsx("div",{className:"chat-loading-text lua:text-sm lua:opacity-40",children:t||"Lua is typing..."})]}):null}function _t({buttons:t,onClick:e}){return jsxRuntime.jsx("div",{className:"chat-action-message lua:w-full",children:jsxRuntime.jsx("div",{className:"chat-action-buttons lua:flex lua:gap-2 lua:flex-wrap lua:mx-4 lua:sm:mx-5",children:t.map((a,l)=>jsxRuntime.jsx(luaniverse.Button,{variant:"tertiary",className:"chat-action-button lua:font-normal lua:rounded-lg lua:py-2 lua:h-auto",onClick:()=>e(a.text),children:a.text},l))})})}var Wt=t=>{let e="::: actions",l=t.indexOf(e);if(l===-1)return [];let r=t.indexOf(":::",l+e.length);return r===-1?[]:t.slice(l+e.length,r).trim().replace(/\\n/g,`
|
|
1
|
+
'use strict';var luaniverse=require('luaniverse'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),reactVisuallyHidden=require('@radix-ui/react-visually-hidden'),qt=require('react-markdown'),prismReactRenderer=require('prism-react-renderer'),il=require('dompurify'),reactLeaflet=require('react-leaflet');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var qt__default=/*#__PURE__*/_interopDefault(qt);var il__default=/*#__PURE__*/_interopDefault(il);function rr({onAudioRecorded:t,onClose:e,inputMessage:a}){let[l,r]=react.useState(false),[n,u]=react.useState(0),[c,s]=react.useState([]),[m,g]=react.useState(null),[i,d]=react.useState(null),f=react.useRef(null),v=react.useRef(null),y=react.useRef([]),N=react.useRef(null),p=react.useRef(null),h=react.useRef(null),b=react.useRef(null),C=react.useRef(false),w=react.useRef(false),o=react.useRef(null);react.useEffect(()=>{if(!l||!m)return;let D=setInterval(()=>{let T=Math.floor((Date.now()-m)/1e3);u(T);},1e3);return ()=>clearInterval(D)},[l,m]),react.useEffect(()=>((async()=>{if(!(C.current||w.current))try{C.current=!0;let T=await navigator.mediaDevices.getUserMedia({audio:!0});f.current=T,N.current=new AudioContext,p.current=N.current.createAnalyser(),p.current.fftSize=256,N.current.createMediaStreamSource(T).connect(p.current),h.current=new Uint8Array(p.current.frequencyBinCount);let j=()=>{if(!p.current||!h.current)return;p.current.getByteFrequencyData(h.current);let aa=Array.from(h.current).map(la=>la/255);s(aa),b.current=requestAnimationFrame(j);};j(),L();}catch(T){console.error("Error accessing microphone:",T),e();}finally{C.current=false;}})(),()=>{M();}),[]);let M=()=>{if(!w.current)try{if(w.current=!0,l&&v.current&&(v.current.stop(),r(!1),g(null)),f.current){let D=f.current.getAudioTracks(),T=f.current.getVideoTracks();D.forEach(U=>{U.stop(),U.enabled=!1;}),T.forEach(U=>{U.stop(),U.enabled=!1;});}b.current&&cancelAnimationFrame(b.current),N.current&&N.current.close(),f.current=null,v.current=null,y.current=[],N.current=null,p.current=null,h.current=null,b.current=null;}finally{w.current=false;}},L=()=>{if(!f.current)return;let T=["audio/webm","audio/mp4","audio/ogg","audio/wav"].find(j=>MediaRecorder.isTypeSupported(j));if(!T){console.error("No supported MIME type found for MediaRecorder"),e();return}o.current=T;let U=new MediaRecorder(f.current,{mimeType:T});v.current=U,y.current=[],U.ondataavailable=j=>{j.data.size>0&&y.current.push(j.data);},U.start(),r(true),g(Date.now()),u(0);},ta=async()=>{if(!v.current||!f.current)return;r(false),d(n),g(null),v.current.stop(),await new Promise(T=>{v.current&&(v.current.onstop=()=>T());});let D=new Blob(y.current,{type:o.current||"audio/webm"});t(D,a),M(),e();},bt=D=>{let T=Math.floor(D/60),U=D%60;return `${T.toString().padStart(2,"0")}:${U.toString().padStart(2,"0")}`};return jsxRuntime.jsxs("div",{className:"audio-recorder-container lua:bg-muted lua:rounded-lg lua:p-2 lua:flex lua:items-center lua:gap-4",children:[jsxRuntime.jsx(luaniverse.IconButton,{variant:"muted",onClick:async()=>{M(),e();},className:"audio-recorder-close-button lua:flex-shrink-0",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"audio-recorder-close-icon lua:text-gray-600 lua:dark:text-gray-400"})}),jsxRuntime.jsxs("div",{className:"audio-recorder-status lua:flex lua:items-center lua:gap-2",children:[jsxRuntime.jsx("div",{className:`audio-recorder-indicator lua:w-3 lua:h-3 lua:rounded-full ${l?"lua:bg-red-500 lua:animate-pulse":"lua:bg-gray-500 lua:dark:bg-gray-400"}`}),jsxRuntime.jsx("span",{className:"audio-recorder-time lua:text-gray-700 lua:dark:text-gray-200 lua:text-sm",children:bt(l?n:i||0)})]}),jsxRuntime.jsx("div",{className:"audio-recorder-visualizer lua:flex-1","data-testid":"audio-visualizer-bar",children:c.length>0&&jsxRuntime.jsx("div",{className:"audio-recorder-bars lua:h-8 lua:flex lua:items-center lua:w-full lua:gap-px sm:lua:gap-0.5 lua:md:gap-1",children:c.slice(0,50).map((D,T)=>jsxRuntime.jsx("div",{className:"audio-recorder-bar lua:flex-1 lua:bg-blue-600 lua:dark:bg-blue-400",style:{height:`${D*100}%`}},T))})}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:ta,className:"audio-recorder-send-button lua:flex-shrink-0 lua:mr-1","data-testid":"send-audio-button",children:jsxRuntime.jsx(luaniverse.ArrowUp,{className:"audio-recorder-send-icon",color:"white"})})]})}function ma(t){let e=Math.floor(t/60),a=t%60;return `${e.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function dr({videoRef:t,isRecording:e,recordingTime:a,loading:l,onStartRecording:r,onStopRecording:n,onClose:u,open:c}){return jsxRuntime.jsx(luaniverse.Dialog,{open:c,onOpenChange:u,children:jsxRuntime.jsxs(luaniverse.DialogContent,{className:"lua:w-full lua:max-w-2xl lua:p-2.5",showClose:false,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsxs("div",{className:"lua:relative lua:aspect-[4/3] lua:bg-black lua:rounded-xl lua:overflow-hidden lua:mb-8",children:[jsxRuntime.jsx("video",{ref:t,autoPlay:true,playsInline:true,muted:true,className:"lua:absolute lua:inset-0 lua:w-full lua:h-full lua:object-cover",style:{backgroundColor:"black"}}),e&&jsxRuntime.jsxs("div",{className:"lua:absolute lua:top-4 lua:left-4 lua:flex lua:items-center lua:gap-2 lua:bg-black lua:bg-opacity-50 lua:px-3 lua:py-1 lua:rounded-full",children:[jsxRuntime.jsx("div",{className:"lua:w-2 lua:h-2 lua:rounded-full lua:bg-red-500 lua:animate-pulse"}),jsxRuntime.jsx("span",{className:"lua:text-sm lua:font-medium lua:text-white",children:ma(a)})]})]}),jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center lua:items-center lua:gap-5 lua:mb-2.5",children:e?jsxRuntime.jsx(luaniverse.IconButton,{"data-testid":"stop-recording-button",onClick:n,disabled:l,variant:"secondary",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:text-gray-900 lua:dark:text-gray-100"})}):jsxRuntime.jsxs("svg",{onClick:r,"data-testid":"start-recording-button",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"36",height:"36",rx:"18",stroke:"#FF0342",strokeWidth:"4"}),jsxRuntime.jsx("rect",{x:"6",y:"6",width:"28",height:"28",rx:"14",fill:"#FF0342"})]})})]})})}function Mt({url:t,alt:e,open:a,onClose:l}){return jsxRuntime.jsxs(luaniverse.Dialog,{open:a,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsx(luaniverse.DialogContent,{className:"lua:w-full lua:fixed lua:inset-0 lua:h-full lua:max-w-none lua:p-0 lua:bg-transparent lua:shadow-none lua:translate-x-0 lua:translate-y-0 lua:m-0 lua:rounded-none",showClose:false,children:jsxRuntime.jsxs("div",{className:"lua:relative lua:w-full lua:h-full",children:[jsxRuntime.jsx("button",{onClick:l,className:"lua:cursor-pointer lua:absolute lua:top-4 lua:left-4 lua:z-10 lua:p-2 lua:bg-black/50 lua:rounded-full lua:hover:bg-black/70 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{color:"white",className:"lua:w-6 lua:h-6"})}),jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("img",{src:t,alt:e,className:"sm:lua:aspect-[16/9] lua:object-contain lua:rounded-none sm:lua:rounded-lg"})})]})})]})}function Tt({images:t,initialIndex:e=0,open:a,onClose:l}){let[r,n]=react.useState(),[u,c]=react.useState(0);return react.useEffect(()=>{if(!r)return;e>0&&e<t.length&&(r.scrollTo(e),c(e));let s=()=>{c(r.selectedScrollSnap());};return r.on("select",s),s(),()=>{r?.off("select",s);}},[r,e,t.length]),jsxRuntime.jsxs(luaniverse.Dialog,{open:a,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsx(luaniverse.DialogContent,{className:"lua:w-full lua:m-0",showClose:false,children:jsxRuntime.jsxs("div",{className:"lua:relative lua:w-full lua:h-full",children:[jsxRuntime.jsx("button",{onClick:l,className:"lua:cursor-pointer lua:absolute lua:top-4 lua:left-4 lua:z-10 lua:p-2 lua:bg-black/50 lua:rounded-full lua:hover:bg-black/70 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{color:"white",className:"lua:w-6 lua:h-6"})}),t.length>1&&jsxRuntime.jsxs("div",{className:"lua:absolute lua:top-4 lua:right-4 lua:z-10 lua:px-3 lua:py-1 lua:bg-black/50 lua:rounded-full lua:text-white lua:text-sm",children:[u+1," / ",t.length]}),jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:flex lua:items-center lua:justify-center lua:px-16",children:jsxRuntime.jsxs(luaniverse.Carousel,{setApi:n,className:"lua:w-full lua:max-w-5xl",opts:{align:"center",loop:t.length>1},children:[jsxRuntime.jsx(luaniverse.CarouselContent,{children:t.map((s,m)=>jsxRuntime.jsx(luaniverse.CarouselItem,{className:"lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("img",{src:s.src,alt:s.alt||`Image ${m+1}`,className:"lua:max-w-full lua:max-h-screen lua:object-contain lua:rounded-none sm:lua:rounded-lg",draggable:false})},m))}),t.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(luaniverse.CarouselPrevious,{className:"lua:left-4 lua:bg-black/50 lua:border-none lua:text-white lua:hover:bg-black/70 lua:hover:text-white-white/70"}),jsxRuntime.jsx(luaniverse.CarouselNext,{className:"lua:right-4 lua:bg-black/50 lua:border-none lua:text-white lua:hover:bg-black/70 lua:hover:text-white-white/70"})]})]})})]})})]})}function Mr({videoRef:t,canvasRef:e,onCapture:a,onClose:l,open:r}){return jsxRuntime.jsxs(luaniverse.Dialog,{open:r,onOpenChange:l,children:[jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden,{children:jsxRuntime.jsx(luaniverse.DialogTitle,{})}),jsxRuntime.jsxs(luaniverse.DialogContent,{className:"lua:w-full lua:max-w-2xl lua:p-2.5",showClose:false,children:[jsxRuntime.jsxs("div",{className:"lua:relative lua:aspect-[16/9] lua:bg-black lua:rounded-xl lua:overflow-hidden",children:[jsxRuntime.jsx("video",{ref:t,autoPlay:true,playsInline:true,muted:true,className:"lua:absolute lua:inset-0 lua:w-full lua:h-full lua:object-cover",style:{backgroundColor:"black"}}),jsxRuntime.jsx("canvas",{ref:e,className:"lua:hidden"})]}),jsxRuntime.jsxs("div",{className:"lua:flex lua:justify-center lua:items-center lua:gap-5 lua:mb-2.5 lua:mt-6",children:[jsxRuntime.jsx(luaniverse.IconButton,{onClick:a,"data-testid":"capture-button",children:jsxRuntime.jsx(luaniverse.Camera,{className:"lua:text-white"})}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:l,variant:"secondary",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:text-gray-900 lua:dark:text-gray-100"})})]})]})]})}function Pr({locationError:t,currentLocation:e,loading:a,onShare:l,onClose:r}){return jsxRuntime.jsx("div",{className:"lua:fixed lua:inset-0 lua:bg-black lua:bg-opacity-75 lua:flex lua:items-center lua:justify-center lua:z-50",children:jsxRuntime.jsxs("div",{className:"lua:bg-card lua:rounded-lg lua:p-4 lua:max-w-2xl lua:w-full lua:mx-4",children:[jsxRuntime.jsxs("div",{className:"lua:flex lua:justify-between lua:items-center lua:mb-4",children:[jsxRuntime.jsx("h3",{className:"lua:text-lg lua:font-semibold lua:text-gray-900 lua:dark:text-gray-50",children:"Share Location"}),jsxRuntime.jsx("button",{onClick:r,className:"lua:text-gray-500 lua:dark:text-gray-400 lua:hover:text-gray-700 lua:dark:hover:text-gray-200",children:jsxRuntime.jsx("svg",{className:"lua:w-6 lua:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t?jsxRuntime.jsx("div",{className:"lua:bg-red-50 lua:dark:bg-red-900/30 lua:text-red-500 lua:dark:text-red-400 lua:p-4 lua:rounded-lg lua:mb-4",children:t}):e?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"lua:mb-4",children:[jsxRuntime.jsx("div",{className:"lua:text-sm lua:text-gray-500 lua:dark:text-gray-400 lua:mb-2",children:"Current Location:"}),jsxRuntime.jsx("div",{className:"lua:text-gray-700 lua:dark:text-gray-200 lua:mb-2",children:e.address}),jsxRuntime.jsxs("div",{className:"lua:text-sm lua:text-gray-500 lua:dark:text-gray-400",children:[e.latitude.toFixed(6),","," ",e.longitude.toFixed(6)]})]})}):jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center lua:items-center lua:h-48",children:jsxRuntime.jsx("div",{className:"lua:animate-spin lua:rounded-full lua:h-8 lua:w-8 lua:border-b-2 lua:border-blue-500"})}),jsxRuntime.jsx("div",{className:"lua:flex lua:justify-center",children:e&&jsxRuntime.jsxs("button",{onClick:l,disabled:a,className:`lua:px-4 lua:py-2 lua:rounded-full ${a?"lua:bg-blue-300 lua:dark:bg-blue-800 lua:cursor-not-allowed":"lua:bg-blue-500 lua:hover:bg-blue-600 lua:dark:bg-blue-600 lua:dark:hover:bg-blue-700"} lua:text-white lua:flex lua:items-center lua:gap-2`,children:[jsxRuntime.jsx("svg",{className:"lua:w-5 lua:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"})}),a?"Sharing...":"Share Location"]})})]})})}function Oa(t){let e=[],a=t.split(`
|
|
2
|
+
`).filter(l=>l.trim()!=="");for(let l of a){let r=/\[([^\]]+)\]\(([^)]+)\)\s+filename:([^\s]+)\s+mime:([^\s]+)/g,n;for(;(n=r.exec(l))!==null;){let[,u,c,s,m]=n;e.push({fileName:u.trim(),url:c.trim(),filename:s.trim(),mediaType:m.trim()});}}return e}var He=Oa;function At({children:t,language:e=""}){let[a,l]=react.useState(false),r=typeof t=="string"?t:String(t),n=e||"javascript";return jsxRuntime.jsxs("div",{className:"lua:relative lua:my-4 lua:rounded-lg lua:overflow-hidden lua:mx-4 lua:sm:mx-5 lua:grid",children:[jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:justify-between lua:bg-gray-800 lua:text-gray-200 lua:px-4 lua:py-2",children:[jsxRuntime.jsx("span",{className:"lua:text-xs lua:font-mono",children:n}),jsxRuntime.jsx("button",{onClick:()=>{navigator.clipboard.writeText(r),l(true),setTimeout(()=>l(false),2e3);},className:"lua:text-xs lua:bg-gray-700 lua:hover:bg-gray-600 lua:rounded lua:px-2 lua:py-1 lua:transition-colors","aria-label":"Copy code",children:a?"Copied!":"Copy"})]}),jsxRuntime.jsx(prismReactRenderer.Highlight,{theme:prismReactRenderer.themes.vsDark,code:r,language:n,children:({className:c,style:s,tokens:m,getLineProps:g,getTokenProps:i})=>jsxRuntime.jsx("pre",{className:`${c} lua:p-4 lua:overflow-x-auto`,style:s,children:m.map((d,f)=>jsxRuntime.jsx("div",{...g({line:d}),children:d.map((v,y)=>jsxRuntime.jsx("span",{...i({token:v})},y))},f))})})]})}var R={p:"lua:mb-2 lua:last:mb-0 lua:mx-4 lua:sm:mx-5 lua-paragraph-markdown",h1:"lua:text-2xl lua:font-bold lua:mb-2 lua:mx-4 lua:sm:mx-5",h2:"lua:text-xl lua:font-semibold lua:mb-2 lua:text-gray-700 lua:dark:text-gray-200 lua:mx-4 lua:sm:mx-5",h3:"lua:text-lg lua:font-medium lua:mb-2 lua:mx-4 lua:sm:mx-5",h4:"lua:mx-4 lua:sm:mx-5",ul:"lua:list-disc lua:pl-6 lua:mb-4",ol:"lua:list-decimal lua:pl-6 lua:mb-4 lua:mx-4 lua:sm:mx-5",li:"lua:mb-1 lua:mx-4 lua:sm:mx-5",a:"lua:text-blue-500 lua:dark:text-blue-400 lua:hover:underline",blockquote:"lua:border-l-4 lua:border-gray-200 lua:dark:border-gray-600 lua:pl-4 lua:italic lua:my-4",pre:"lua:contents lua:bg-gray-100 lua:dark:bg-gray-700 lua:rounded lua:px-1 lua:text-gray-700 lua:dark:text-gray-200 lua:mx-4 lua:sm:mx-5",code:"lua:bg-gray-100 lua:dark:bg-gray-700 lua:rounded lua:px-1 lua:mx-4 lua:sm:mx-5",img:"lua:max-w-full lua:h-auto lua:rounded-lg lua:mb-2",table:"lua:min-w-full lua:border lua:border-gray-200 lua:dark:border-gray-700 lua:my-4",th:"lua:bg-gray-100 lua:dark:bg-gray-700 lua:border lua:border-gray-200 lua:dark:border-gray-700 lua:px-4 lua:py-2",td:"lua:border lua:border-gray-200 lua:dark:border-gray-700 lua:px-4 lua:py-2"};var $a=t=>({code({children:e,className:a,...l}){let r=a?.replace("language-","")||"";return typeof e=="string"&&!e.includes(`
|
|
3
|
+
`)?jsxRuntime.jsx("code",{className:R.code,...l,children:e}):jsxRuntime.jsx(At,{language:r,className:a,children:e})},p({children:e,...a}){return jsxRuntime.jsx("p",{className:R.p,...a,children:e})},h1({children:e,...a}){return jsxRuntime.jsx("h1",{className:R.h1,...a,children:e})},h2({children:e,...a}){return jsxRuntime.jsx("h2",{className:R.h2,...a,children:e})},h3({children:e,...a}){return jsxRuntime.jsx("h3",{className:R.h3,...a,children:e})},h4({children:e,...a}){return jsxRuntime.jsx("h4",{className:R.h4,...a,children:e})},img({src:e,alt:a}){return jsxRuntime.jsx("img",{src:e,alt:a,className:"lua:w-full lua:h-48 lua:object-cover lua:rounded-lg lua:mb-3"})},ul({children:e,...a}){return jsxRuntime.jsx("ul",{className:R.ul,...a,children:e})},ol({children:e,...a}){return jsxRuntime.jsx("ol",{className:R.ol,...a,children:e})},li({children:e,...a}){return jsxRuntime.jsx("li",{className:`${R.li} cursor-pointer hover:bg-gray-50 rounded px-2 -mx-2 transition-colors`,onClick:()=>t(e),...a,children:e})},a({href:e,children:a,...l}){return jsxRuntime.jsx("a",{href:e,className:R.a,target:"_blank",rel:"noopener noreferrer",...l,children:a})},blockquote({children:e,...a}){return jsxRuntime.jsx("blockquote",{className:R.blockquote,...a,children:e})},pre({children:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})},table({children:e,...a}){return jsxRuntime.jsx("table",{className:R.table,...a,children:e})},th({children:e,...a}){return jsxRuntime.jsx("th",{className:R.th,...a,children:e})},td({children:e,...a}){return jsxRuntime.jsx("td",{className:R.td,...a,children:e})}}),Q=$a;function Va(t){let e=new URL(t,"http://lua"),a=decodeURIComponent(e.pathname),l={};for(let[r,n]of e.searchParams.entries())l[r]=decodeURIComponent(n);return {pathname:a,queryParams:l}}function Se(t,e=60){if(t.length<=e)return t;try{let a=new URL(t),l=a.hostname,r=a.pathname+a.search+a.hash;if(l.length>=e-3)return l.slice(0,e-3)+"...";let n=e-l.length-4;return r.length>n?l+r.slice(0,n)+"...":l+r}catch{return t.slice(0,e-3)+"..."}}var ke=Va;function Wa(t){let e=t.match(/\[navigate\]\(([^)]+)\)/);return e?e[1]:null}var It=Wa;var Xa=react.memo(function({block:e,onCardClick:a,onListItemClick:l,onNavigate:r}){let n=e.content.match(/^#\s+(.+)$/m),u=e.content.match(/!\[.*?]\((.*)\)/),c=n?n[1]:"",s=u?u[1]:null,m=It(e.content),g=e.content.replace(/^#\s+.+$/m,"").replace(/!\[.*?]\(.*?\)/g,"").replace(/\[.*?]\(.*?\)/g,"").trim(),i=Q(l);return jsxRuntime.jsxs("div",{onClick:()=>{if(r&&m){let f=ke(m);r(f.pathname,{...f.queryParams&&{query:f.queryParams}});}else a(e.content);},className:"chat-list-item group",children:[jsxRuntime.jsx("div",{className:"lua:absolute lua:inset-0 lua:bg-blue-500 lua:opacity-0 group-hover:lua:opacity-5 lua:dark:group-hover:lua:opacity-10 lua:rounded-lg lua:transition-opacity lua:duration-200"}),jsxRuntime.jsxs("div",{className:"chat-list-item-content",children:[s?jsxRuntime.jsx("div",{className:"chat-list-item-image-wrapper",children:jsxRuntime.jsx("img",{className:"chat-list-item-image",src:s,alt:c})}):null,jsxRuntime.jsxs("div",{className:"content-container",children:[jsxRuntime.jsx("h1",{className:"lua:text-base lua:leading-6 lua:font-semibold lua:text-gray-900 lua:dark:text-gray-50 lua:mb-0",children:c}),jsxRuntime.jsx("div",{className:"lua:text-sm lua:leading-6 lua:font-normal lua:text-gray-600 lua:dark:text-gray-300",children:jsxRuntime.jsx(qt__default.default,{components:i,children:g})})]})]})]})}),se=Xa;var Ka=react.memo(function({group:e,onCardClick:a,onListItemClick:l,onNavigate:r}){return jsxRuntime.jsx("div",{className:"lua:w-full",children:jsxRuntime.jsx("div",{className:"chat-list-item-container",children:e.map((n,u)=>jsxRuntime.jsx(se,{block:n,onCardClick:a,onListItemClick:l,onNavigate:r},u))})})}),Dt=Ka;function Qa(t){return {icon:()=>null}}function Le({documents:t}){return t.map(e=>{let l=Qa(new File([],"",{type:e.mediaType})).icon;return jsxRuntime.jsx("a",{"data-testid":"chat-file-message",href:e.url,target:"_blank",rel:"noopener noreferrer",className:"chat-file-message lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsx("div",{className:"lua:flex lua:flex-col lua:gap-8",children:jsxRuntime.jsxs("div",{className:"chat-file-card lua:flex lua:items-center lua:justify-start lua:p-3 lua:border lua:border-border lua:rounded-lg lua:bg-card lua:w-80",children:[jsxRuntime.jsx(l,{className:"lua:w-12 lua:h-12 lua:text-gray-500 lua:dark:text-gray-400"}),jsxRuntime.jsxs("div",{className:"lua:flex lua:flex-col lua:gap-1 lua:pl-2",children:[e.fileName||"File",jsxRuntime.jsx("span",{className:"lua:text-gray-500 lua:dark:text-gray-400 lua:text-sm",children:e.mediaType})]})]})})},e.url)})}function Et({message:t}){return jsxRuntime.jsx("div",{className:"chat-audio-message lua:flex lua:flex-col lua:mx-4 lua:sm:mx-5","data-testid":"audio-preview",children:jsxRuntime.jsx("div",{className:"chat-audio-container audio-playback-container lua:relative",children:jsxRuntime.jsxs("div",{className:"chat-audio-controls lua:flex lua:items-center lua:gap-2 lua:min-w-full",children:[jsxRuntime.jsx("audio",{src:t.url,controls:true,className:"chat-audio-player lua:h-8",style:{backgroundColor:"transparent",border:"none"}}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-audio-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("div",{className:"lua:text-white lua:text-sm",children:"Uploading..."})})]})})})}function ze({url:t}){return jsxRuntime.jsxs(luaniverse.Button,{onClick:a=>{if(a.preventDefault(),/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)){window.open(t,"_blank","noopener,noreferrer");return}let r=500,n=600,u=window.screen.width/2-r/2,c=window.screen.height/2-n/2,s=window.open(t,"Payment",`width=${r},height=${n},left=${u},top=${c},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`);(!s||s.closed||typeof s.closed>"u")&&window.open(t,"_blank","noopener,noreferrer");},className:"chat-payment-button lua:rounded-xl",children:[jsxRuntime.jsx(luaniverse.CreditCard,{size:16}),jsxRuntime.jsx("span",{children:"Open payment"})]})}var tl=t=>t.split(`
|
|
4
|
+
`).filter(a=>a.trim()).filter(a=>a.trim().startsWith("-")).map(a=>({text:a.trim().substring(1).trim(),onClick:a.trim().substring(1).trim()})),Be=tl;var al=t=>{let e=/!\[(.*?)\]\((.*)\)/g,a=[],l;for(;(l=e.exec(t))!==null;)l[1]&&l[2]&&a.push({alt:l[1],src:l[2]});return a},$e=al;var ll=t=>{let e=/\[.*?\]\((.*?)\)/g,a=[],l;for(;(l=e.exec(t))!==null;)l[1]&&a.push(l[1]);return a},_e=ll;function Ve(t){let e=t.match(/!\[([^\]]+)\]\(([^)]+)\)/);if(!e)return null;let[,a,l]=e;return {text:a,url:l}}var rl=t=>{let e=/\[.*?\]\((.*?)\)/,a=t.match(e);return a?a[1]:null},We=rl;var je=t=>typeof t=="string"?t:Array.isArray(t)?t.map(je).join(""):typeof t=="object"&&t!==null&&"props"in t?je(t.props.children):"",St=je;function ol(t){return t.replace(/([^\n]):::/g,`$1
|
|
5
|
+
:::`)}var nl=t=>{t=t.replace(/\\n/g,`
|
|
6
|
+
`);let e=[],a="",l="",r="",n="",u="",c="",s="",m="",g="",i=false,d=false,f=false,v=false,y=false,N=false,p=false,h=false,C=ol(t).split(`
|
|
7
|
+
`);for(let w=0;w<C.length;w++){let o=C[w];if(o.trim()==="::: list-item"||o.trim()===":::list-item"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),i=true;continue}if(o.trim()==="::: payment"||o.trim()===":::payment"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),d=true;continue}if(o.trim()==="::: actions"||o.trim()===":::actions"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),f=true;continue}if(o.trim()==="::: images"||o.trim()===":::images"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),v=true;continue}if(o.trim()==="::: links"||o.trim()===":::links"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),y=true;continue}if(o.trim()==="::: navigate"||o.trim()===":::navigate"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),N=true;continue}if(o.trim()==="::: documents"||o.trim()===":::documents"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),p=true;continue}if(o.trim()==="::: horizontal-list-item"||o.trim()===":::horizontal-list-item"){a.trim()&&(e.push({type:"text",content:a.trim()}),a=""),h=true;continue}if(o.trim()===":::"&&i){e.push({type:"list-item",content:l.trim(),isComplete:true}),l="",i=false;continue}if(o.trim()===":::"&&d){e.push({type:"payment",content:r.trim(),isComplete:true}),r="",d=false;continue}if(o.trim()===":::"&&f){e.push({type:"actions",content:n.trim(),isComplete:true}),n="",f=false;continue}if(o.trim()===":::"&&v){e.push({type:"images",content:u.trim(),isComplete:true}),u="",v=false;continue}if(o.trim()===":::"&&y){e.push({type:"links",content:c.trim(),isComplete:true}),c="",y=false;continue}if(o.trim()===":::"&&N){e.push({type:"navigate",content:s.trim(),isComplete:true}),s="",N=false;continue}if(o.trim()===":::"&&p){e.push({type:"documents",content:m.trim(),isComplete:true}),m="",p=false;continue}if(o.trim()===":::"&&h){e.push({type:"horizontal-list-item",content:g.trim(),isComplete:true}),g="",h=false;continue}i?l+=o+`
|
|
8
|
+
`:d?r+=o+`
|
|
9
|
+
`:f?n+=o+`
|
|
10
|
+
`:v?u+=o+`
|
|
11
|
+
`:y?c+=o+`
|
|
12
|
+
`:N?s+=o+`
|
|
13
|
+
`:p?m+=o+`
|
|
14
|
+
`:h?g+=o+`
|
|
15
|
+
`:a+=o+`
|
|
16
|
+
`;}return i?e.push({type:"list-item",content:l.trim(),isComplete:false}):d?e.push({type:"payment",content:r.trim(),isComplete:false}):f?e.push({type:"actions",content:n.trim(),isComplete:false}):v?e.push({type:"images",content:u.trim(),isComplete:false}):y?e.push({type:"links",content:c.trim(),isComplete:false}):N?e.push({type:"navigate",content:s.trim(),isComplete:false}):p?e.push({type:"documents",content:m.trim(),isComplete:false}):h?e.push({type:"horizontal-list-item",content:g.trim(),isComplete:false}):a.trim()&&e.push({type:"text",content:a.trim()}),e},Ot=nl;function sl(t){let e=new Set(["br","hr","img","input","meta","link"]),a=[],l=/<\/?([a-z][a-z0-9]*)[^>]*>/gi,r=l.exec(t);for(;r!==null;){let n=r[0],u=r[1].toLowerCase();if(e.has(u)||n.endsWith("/>")){r=l.exec(t);continue}if(n.startsWith("</")){if(a.length===0||a.pop()!==u)return false}else a.push(u);r=l.exec(t);}return a.length===0}function Ft(t){let e=new Set(["br","hr","img","input","meta","link"]),a=/<\/?([a-z][a-z0-9]*)[^>]*>/gi,r=0,n=[],u;for(a.lastIndex=0;(u=a.exec(t))!==null;){let m=u[0],g=u[1].toLowerCase(),d=u.index+m.length;if(e.has(g)||m.endsWith("/>")){n.length===0&&(r=d);continue}m.startsWith("</")?n.length>0&&n[n.length-1]===g&&(n.pop(),n.length===0&&(r=d)):n.push(g);}let c=t.substring(0,r),s=r<t.length||n.length>0;return {completeHtml:c,hasIncompleteContent:s}}function zt(t){return /^\s*<[a-z]+[\s>]/i.test(t.trim())?{isHtml:true,isComplete:sl(t)}:{isHtml:false,isComplete:false}}function qe(t){if(typeof window>"u")return "";let e={ALLOWED_TAGS:["div","b","ol","ul","li","a","br"],ALLOWED_ATTR:["style","href","target","rel"],ALLOW_DATA_ATTR:false,ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};return il__default.default.sanitize(t,e)}function ul(t){let e=t.match(/!\[.*?]\((.*)\)/),a=e?e[1]:null,l=t.match(/^#\s*(.+)$/m),r=l?l[1]:"",n=t.match(/^##\s*(.+)$/m),u=n?n[1]:"",c=t.replace(/^#\s*.+$/m,"").replace(/^##\s*.+$/m,"").replace(/!\[.*?]\(.*?\)/g,"").replace(/\[.*?]\(.*?\)/g,"").trim();return {imageUrl:a,title:r,subheading:u,description:c}}var Bt=ul;var pl=react.memo(function({blocks:e,onCardClick:a,onListItemClick:l}){let r=react.useRef(null),[n,u]=react.useState(false),[c,s]=react.useState(0),[m,g]=react.useState(0),[i,d]=react.useState(0),f=e.map(o=>Bt(o.content)),v=react.useCallback(o=>{r.current&&(u(true),s(o.pageX-r.current.offsetLeft),g(r.current.scrollLeft),d(0),o.preventDefault());},[]),y=react.useCallback(o=>{if(!n||!r.current)return;o.preventDefault();let M=o.pageX-r.current.offsetLeft,L=(M-c)*2;r.current.scrollLeft=m-L,d(Math.abs(M-c));},[n,c,m]),N=react.useCallback(()=>{u(false);},[]),p=react.useCallback(()=>{u(false);},[]),h=react.useCallback((o,M)=>{if(i>5){M.preventDefault();return}a(o);},[i,a]),b=o=>{o.preventDefault(),o.stopPropagation();},C=o=>{o.preventDefault(),o.stopPropagation();},w=Q(l);return jsxRuntime.jsx("div",{"data-testid":"horizontal-list-carousel-message",className:"chat-horizontal-list-carousel-message lua:w-full",children:jsxRuntime.jsx("div",{ref:r,className:"chat-horizontal-list-carousel",style:{cursor:n?"grabbing":"grab"},onMouseDown:v,onMouseMove:y,onMouseUp:N,onMouseLeave:p,onDragStart:b,onDragOver:C,children:f.map((o,M)=>jsxRuntime.jsxs("div",{className:"chat-horizontal-list-item group",onClick:L=>h(e[M].content,L),children:[jsxRuntime.jsx("div",{className:"lua:absolute lua:inset-0 lua:bg-blue-500 lua:opacity-0 group-hover:lua:opacity-5 lua:dark:group-hover:lua:opacity-10 lua:rounded-lg lua:transition-opacity lua:duration-200"}),jsxRuntime.jsxs("div",{className:"chat-horizontal-list-item-content",children:[o.imageUrl?jsxRuntime.jsx("div",{className:"chat-horizontal-list-item-image-wrapper",children:jsxRuntime.jsx("img",{className:"chat-horizontal-list-item-image",src:o.imageUrl,alt:o.title,draggable:false,style:{userSelect:"none"}})}):null,jsxRuntime.jsxs("div",{className:"content-container",children:[jsxRuntime.jsx("h1",{className:"lua:text-base lua:leading-6 lua:font-semibold lua:text-gray-900 lua:dark:text-gray-50 lua:mb-0",children:o.title}),o.subheading&&jsxRuntime.jsx("h2",{className:"lua:text-sm lua:leading-5 lua:font-medium lua:text-gray-700 lua:dark:text-gray-300 lua:mb-1",children:o.subheading}),o.description&&jsxRuntime.jsx("div",{className:"lua:text-sm lua:leading-6 lua:font-normal lua:text-gray-600 lua:dark:text-gray-300",children:jsxRuntime.jsx(qt__default.default,{components:w,children:o.description})})]})]})]},`${o.title}-${M}`))})})}),Ge=pl;function Re({images:t}){let[e,a]=react.useState(false),[l,r]=react.useState(0),n=react.useRef(null),[u,c]=react.useState(false),[s,m]=react.useState(0),[g,i]=react.useState(0),[d,f]=react.useState(0),v=react.useCallback(w=>{n.current&&(c(true),m(w.pageX-n.current.offsetLeft),i(n.current.scrollLeft),f(0),w.preventDefault());},[]),y=react.useCallback(w=>{if(!u||!n.current)return;w.preventDefault();let o=w.pageX-n.current.offsetLeft,M=(o-s)*2;n.current.scrollLeft=g-M,f(Math.abs(o-s));},[u,s,g]),N=react.useCallback(()=>{c(false);},[]),p=react.useCallback(()=>{c(false);},[]),h=react.useCallback((w,o)=>{if(d>5){o.preventDefault();return}r(w),a(true);},[d]);return jsxRuntime.jsxs("div",{"data-testid":"image-carousel-message",className:"chat-image-carousel-message lua:w-full",children:[jsxRuntime.jsx("div",{ref:n,className:"chat-image-carousel markdown-image-carousel",style:{cursor:u?"grabbing":"grab"},onMouseDown:v,onMouseMove:y,onMouseUp:N,onMouseLeave:p,onDragStart:w=>{w.preventDefault(),w.stopPropagation();},onDragOver:w=>{w.preventDefault(),w.stopPropagation();},children:t.map((w,o)=>jsxRuntime.jsx("div",{className:"chat-carousel-image-item markdown-image-item",onClick:M=>h(o,M),children:jsxRuntime.jsx("img",{src:w.src,alt:w.alt,draggable:false,style:{userSelect:"none"}})},w.src))}),jsxRuntime.jsx(Tt,{images:t,initialIndex:l,open:e,onClose:()=>a(false)})]})}function Qe({message:t}){let[e,a]=react.useState(false);return t.url?jsxRuntime.jsxs("div",{"data-testid":"image-message",className:"chat-image-message lua:flex lua:flex-col lua:w-3/5 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsxs("div",{className:"chat-image-container lua:relative",children:[jsxRuntime.jsx("img",{src:t.url,alt:t.content,className:"chat-image lua:rounded-lg lua:w-full lua:cursor-pointer",onClick:()=>a(true)}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-image-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsxs("div",{className:"lua:text-white lua:text-sm",children:["Uploading..."," ",t.uploadProgress?Math.round(t.uploadProgress):0,"%"]})})]}),!t.isUploading&&t.content.length>0&&jsxRuntime.jsx("div",{className:"chat-image-caption lua:w-full lua:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:p-3 lua:mt-8",children:t.content}),jsxRuntime.jsx(Mt,{url:t.url,alt:t.content,open:e,onClose:()=>a(false)})]}):null}function Je({url:t,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l}){let[r,n]=react.useState(null),[u,c]=react.useState(true),[s,m]=react.useState(null);return react.useEffect(()=>{t&&e&&!l&&(async()=>{try{c(!0),m(null);let i=a;if(!i)throw new Error("No auth token available");let d=await fetch(`${e}/chat/url-metadata?url=${encodeURIComponent(t)}`,{headers:{Authorization:`Bearer ${i}`}});if(!d.ok)throw new Error(`Failed to fetch preview: ${d.status}`);let f=await d.json();n(f);}catch(i){console.error("Error fetching link preview:",i),m(i instanceof Error?i.message:"Failed to load preview");}finally{c(false);}})();},[t,e]),l?jsxRuntime.jsx("div",{className:"lua:mb-5 lua:mx-[-30px]",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:max-w-full",children:jsxRuntime.jsx(luaniverse.Button,{variant:"muted",className:"lua:w-full lua:justify-start",children:jsxRuntime.jsx("span",{className:"lua:truncate lua:block",children:Se(t)})})})}):u?jsxRuntime.jsxs("div",{className:"lua:animate-pulse",children:[jsxRuntime.jsx("div",{className:"lua:bg-gray-300 lua:dark:bg-gray-600 lua:h-4 lua:w-3/4 lua:mb-2 lua:rounded"}),jsxRuntime.jsx("div",{className:"lua:bg-gray-300 lua:dark:bg-gray-600 lua:h-3 lua:w-1/2 lua:rounded"})]}):s||!r?jsxRuntime.jsx("div",{className:"lua:mb-5 lua:mx-[-30px]",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:max-w-full",children:jsxRuntime.jsx(luaniverse.Button,{variant:"muted",className:"lua:w-full lua:justify-start",children:jsxRuntime.jsx("span",{className:"lua:truncate lua:block",children:Se(t)})})})}):jsxRuntime.jsxs("a",{href:r.url||t,target:"_blank",rel:"noopener noreferrer",className:"lua:block lua:border lua:border-gray-200 lua:dark:border-gray-700 lua:rounded-lg lua:p-3 lua:hover:bg-gray-50 lua:dark:hover:bg-gray-800 lua:transition-colors lua:no-underline lua:max-w-sm",children:[r.image&&jsxRuntime.jsx("img",{src:r.image,alt:r.title,className:"lua:w-full lua:h-32 lua:object-cover lua:rounded lua:mb-2",onError:g=>{g.currentTarget.style.display="none";}}),jsxRuntime.jsx("div",{className:"lua:text-sm lua:font-medium lua:text-gray-900 lua:dark:text-gray-50 lua:mb-1 lua:line-clamp-2",children:r.title}),r.description&&jsxRuntime.jsx("div",{className:"lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:line-clamp-2",children:r.description}),jsxRuntime.jsx("div",{className:"lua:text-xs lua:text-gray-400 lua:dark:text-gray-500 lua:mt-1 lua:truncate",children:new URL(r.url||t).hostname})]})}function Ie({links:t,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l}){return jsxRuntime.jsx("div",{"data-testid":"link-list-message",className:"chat-link-list-message lua:w-full",children:jsxRuntime.jsx("div",{className:"chat-links-container lua:space-y-2 lua:mx-4 lua:sm:mx-5",children:t.map(r=>jsxRuntime.jsx(Je,{url:r,luaApiUrl:e,authToken:a,disablePreviewOnLinks:l},r))})})}function et({location:t}){let e=[t.latitude,t.longitude];return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-48 lua:rounded-lg lua:overflow-hidden",children:jsxRuntime.jsxs(reactLeaflet.MapContainer,{center:e,zoom:15,scrollWheelZoom:false,className:"lua:w-full lua:h-full",children:[jsxRuntime.jsx(reactLeaflet.TileLayer,{attribution:'\xA9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),jsxRuntime.jsx(reactLeaflet.Marker,{position:e,children:t.address&&jsxRuntime.jsx(reactLeaflet.Popup,{children:jsxRuntime.jsx("div",{children:t.address})})})]})})}function tt({location:t}){return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-full lua:rounded-lg lua:flex lua:items-center lua:justify-center lua:flex-col",children:t.address&&jsxRuntime.jsx(et,{location:t})})}function at({location:t}){return jsxRuntime.jsx("div",{className:"lua:w-full lua:h-60 lua:rounded-lg","data-testid":"location-preview",children:jsxRuntime.jsx(tt,{location:t})})}function lt({message:t}){return jsxRuntime.jsx("div",{"data-testid":"location-message",className:"chat-location-message lua:flex lua:flex-col lua:w-11/12 sm:lua:w-3/5 lua:bg-muted lua:text-foreground lua:rounded-2xl lua:p-3 lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsxs("div",{className:"chat-location-preview-container location-preview-container lua:relative",children:[t.location&&jsxRuntime.jsx(at,{location:t.location}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-location-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("div",{className:"lua:text-white lua:text-sm",children:"Sharing location..."})}),jsxRuntime.jsxs("div",{className:"chat-location-info lua:flex lua:items-center lua:gap-2 lua:mt-3",children:[jsxRuntime.jsx(luaniverse.MapPin,{className:"lua:fill-gray-800 lua:dark:fill-gray-100"}),jsxRuntime.jsx("div",{className:"lua:flex-1",children:jsxRuntime.jsx("div",{className:"lua:text-sm",children:t.content})})]})]})})}function rt({url:t,onNavigate:e}){let[a,l]=react.useState(false);return react.useEffect(()=>{if(e&&!a){l(true);let r=ke(t);e(r.pathname,{...r.queryParams&&{query:r.queryParams}});}},[a,e]),null}function it({message:t}){return jsxRuntime.jsxs("div",{"data-testid":"video-message",className:"chat-video-message lua:flex lua:flex-col lua:w-3/5 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsxs("div",{className:"chat-video-container lua:relative",children:[jsxRuntime.jsx("video",{src:t.url,controls:true,className:"chat-video lua:rounded-lg lua:w-full"}),t.isUploading&&jsxRuntime.jsx("div",{className:"chat-video-upload-overlay lua:absolute lua:inset-0 lua:bg-black lua:bg-opacity-50 lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsxs("div",{className:"lua:text-white lua:text-sm",children:["Uploading..."," ",t.uploadProgress?Math.round(t.uploadProgress):0,"%"]})})]}),!t.isUploading&&t.content&&jsxRuntime.jsx("div",{className:"chat-video-caption lua:w-full lua:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:p-3 lua:mt-8",children:t.content})]})}function Tl(t){return new Date(t).toLocaleTimeString()}function Pl(t){return {icon:()=>null}}var Bn=react.memo(function({message:e,onSelect:a,luaApiUrl:l,authToken:r,disablePreviewOnLinks:n=false,onNavigate:u}){let c=react.useCallback(g=>{let i=g.match(/^#\s*(.+)$/m),d=g.match(/^##\s*(.+)$/m),f=i?i[1]:"",v=d?d[1]:"",y=`${f}. ${v}`;a&&a(y);},[a]),s=react.useCallback(g=>{if(!a)return;let i=St(g).trim();a(i);},[a]),m=react.useCallback(()=>{if(e.type==="location")return jsxRuntime.jsx(lt,{message:e});if(e.mediaType?.startsWith("video"))return e.url?jsxRuntime.jsx(it,{message:{url:e.url,content:e.content||"",isUploading:e.isUploading,uploadProgress:e.uploadProgress}}):null;if(e.mediaType?.startsWith("image"))return e.url?jsxRuntime.jsx(Qe,{message:{url:e.url,content:e.content||"",isUploading:e.isUploading,uploadProgress:e.uploadProgress}}):null;if(e.mediaType?.startsWith("audio"))return jsxRuntime.jsx(Et,{message:e});if(e.type==="file"&&e.mediaType){let v=Pl(new File([],"",{type:e.mediaType})).icon;return jsxRuntime.jsx("a",{"data-testid":"chat-file-message",href:e.url,target:"_blank",rel:"noopener noreferrer",className:"chat-file-message lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsxs("div",{className:"lua:flex lua:flex-col lua:gap-8",children:[jsxRuntime.jsxs("div",{className:"chat-file-card lua:flex lua:items-center lua:justify-start lua:p-3 lua:border lua:border-border lua:rounded-lg lua:bg-card lua:dark:bg-card lua:w-80",children:[jsxRuntime.jsx(v,{className:"lua:w-12 lua:h-12 lua:text-gray-500 lua:dark:text-gray-400"}),jsxRuntime.jsxs("div",{className:"lua:flex lua:flex-col lua:gap-1 lua:pl-2",children:["File",jsxRuntime.jsx("span",{className:"lua:text-gray-500 lua:dark:text-gray-400 lua:text-sm",children:e.mediaType})]})]}),e.content&&jsxRuntime.jsx("div",{className:"chat-file-content lua:bg-muted lua:dark:bg-muted lua:rounded-2xl lua:px-4 lua:py-2 lua:w-80",children:jsxRuntime.jsx("div",{className:"lua:text-sm lua:text-foreground",children:e.content})})]})})}if(e.role==="user")return e.content;if(e.content==="...")return null;let g=zt(e.content);if(g.isHtml){if(g.isComplete){let y=qe(e.content);return jsxRuntime.jsx("div",{className:"chat-html-content lua:prose lua:prose-sm lua:max-w-none lua:mx-4 lua:sm:mx-5",dangerouslySetInnerHTML:{__html:y}})}let{completeHtml:f,hasIncompleteContent:v}=Ft(e.content);if(f){let y=qe(f);return jsxRuntime.jsxs("div",{className:"lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsx("div",{className:"chat-html-content lua:prose lua:prose-sm lua:max-w-none",dangerouslySetInnerHTML:{__html:y}}),v&&jsxRuntime.jsx("div",{className:"lua:flex lua:items-center lua:gap-2 lua:text-gray-500 lua:dark:text-gray-400 lua:mt-2",children:jsxRuntime.jsx(luaniverse.LogoSpinner,{size:14})})]})}return jsxRuntime.jsx("div",{className:"lua:flex lua:items-center lua:gap-2 lua:text-gray-500 lua:dark:text-gray-400 lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsx("div",{className:"lua:animate-pulse",children:"\u25CF\u25CF\u25CF"})})}let i=Ot(e.content),d=Q(s);return jsxRuntime.jsx("div",{className:"chat-markdown-content lua:prose lua:prose-sm lua:max-w-none",children:jsxRuntime.jsx("div",{className:"lua:flex lua:flex-wrap lua:gap-4",children:(()=>{let f=i.filter(p=>p.type==="list-item"),v=i.filter(p=>p.type==="horizontal-list-item"),y=f.length>1,N=v.length>0;if(y||N){let p=[],h=[],b=null;return i.forEach(C=>{C.type==="list-item"||C.type==="horizontal-list-item"?b===null||b===C.type?(h.push(C),b=C.type):(h.length>0&&(p.push(h),h=[]),h.push(C),b=C.type):(h.length>0&&(p.push(h),h=[],b=null),p.push([C]));}),h.length>0&&p.push(h),p.map((C,w)=>C.length>1&&C[0].type==="list-item"?jsxRuntime.jsx(Dt,{group:C,onCardClick:c,onListItemClick:s,onNavigate:u},w):C.length>0&&C[0].type==="horizontal-list-item"?jsxRuntime.jsx(Ge,{blocks:C,onCardClick:c,onListItemClick:s},w):C.map((o,M)=>{if(o.type==="list-item")return jsxRuntime.jsx(se,{block:o,onCardClick:c,onListItemClick:s,onNavigate:u},M);if(o.type==="actions")return Be(o.content).length>0&&o.isComplete,null;if(o.type==="images"){let L=$e(o.content);if(L.length>0)return jsxRuntime.jsx(Re,{images:L},M)}if(o.type==="links"){let L=_e(o.content);return L.length>0&&o.isComplete?jsxRuntime.jsx(Ie,{links:L,luaApiUrl:l||"",authToken:r||"",disablePreviewOnLinks:n},M):null}if(o.type==="navigate"){let L=Ve(o.content);return L&&o.isComplete?jsxRuntime.jsx(rt,{text:L.text,url:L.url,onNavigate:u},M):null}if(o.type==="documents"){let L=He(o.content);return jsxRuntime.jsx(Le,{documents:L},M)}if(o.type==="payment"){let L=We(o.content);return L?jsxRuntime.jsx("div",{className:"chat-payment-message lua:w-full lua:mx-4 lua:sm:mx-5",children:jsxRuntime.jsx(ze,{url:L})},M):null}return jsxRuntime.jsx("div",{className:"chat-markdown-block lua:w-full",children:jsxRuntime.jsx(qt__default.default,{components:d,children:o.content})},M)}))}return i.map((p,h)=>{if(p.type==="list-item")return jsxRuntime.jsx(se,{block:p,onCardClick:c,onListItemClick:s,onNavigate:u},h);if(p.type==="horizontal-list-item")return jsxRuntime.jsx(Ge,{blocks:[p],onCardClick:c,onListItemClick:s},h);if(p.type==="actions")return Be(p.content).length>0&&p.isComplete,null;if(p.type==="images"){let b=$e(p.content);if(b.length>0)return jsxRuntime.jsx(Re,{images:b},h)}if(p.type==="navigate"){let b=Ve(p.content);return b&&p.isComplete?jsxRuntime.jsx(rt,{text:b.text,url:b.url,onNavigate:u},h):null}if(p.type==="documents"){let b=He(p.content);return jsxRuntime.jsx(Le,{documents:b},h)}if(p.type==="links"){let b=_e(p.content);return b.length>0&&p.isComplete?jsxRuntime.jsx(Ie,{links:b,luaApiUrl:l||"",authToken:r||"",disablePreviewOnLinks:n},h):null}if(p.type==="payment"){let b=We(p.content);return b?jsxRuntime.jsx("div",{className:"chat-payment-message lua:w-full lua:mx-4 lua:sm:mx-5 lua:mb-5",children:jsxRuntime.jsx(ze,{url:b})},h):null}return jsxRuntime.jsx("div",{className:"chat-markdown-block lua:w-full",children:jsxRuntime.jsx(qt__default.default,{components:d,children:p.content})},h)})})()})})},[e,c,s]);return jsxRuntime.jsxs("div",{className:`chat-message-container lua:flex lua:flex-col ${e.role==="user"?"lua:items-end":"lua:items-start"} lua:gap-1`,children:[jsxRuntime.jsxs("div",{className:`lua:flex ${e.role==="user"?"lua:justify-end":"lua:justify-start"} lua:items-start lua:gap-2 lua:w-full`,children:[!["file","image","video","tool","location"].includes(e.type||"")&&e.content!=="..."&&jsxRuntime.jsx("div",{className:`chat-message-bubble ${e.role==="user"?"chat-message-bubble-user lua:max-w-full lua:md:max-w-3/5 lua:bg-muted lua:dark:bg-muted lua:text-foreground lua:rounded-2xl lua:px-4 lua:py-3 lua:mx-4 lua:sm:mx-5 lua:whitespace-pre-wrap":"chat-message-bubble-agent lua:w-full lua:bg-card lua:dark:bg-card lua:text-foreground lua:rounded-lg lua:py-3 lua:rounded-bl-none"}`,style:{wordBreak:"break-word"},children:m()}),["file","image","video","location"].includes(e.type||"")&&m()]}),jsxRuntime.jsx("div",{className:`lua-message-timestamp lua:text-xs lua:text-gray-400 lua:dark:text-gray-500 lua:px-1 ${e.role==="user"?"lua:mr-4 sm:lua:mr-5":"lua:ml-4 sm:lua:ml-5"}`,children:Tl(e.createdAt)})]})});var ut=react.createContext(void 0),ct=react.createContext(void 0),dt=react.createContext(void 0),mt=react.createContext(void 0),pt=react.createContext(void 0);function jn({children:t}){let[e,a]=react.useState([]),[l,r]=react.useState(""),[n,u]=react.useState(null),[c,s]=react.useState(false),[m]=react.useState(new Map),g=react.useCallback(d=>{if(!m.has(d)){let f=URL.createObjectURL(d);m.set(d,f);}return m.get(d)},[m]),i=react.useCallback(d=>{let f=m.get(d);f&&(URL.revokeObjectURL(f),m.delete(d));},[m]);return react.useEffect(()=>()=>{e.forEach(d=>{d.url&&d.url.startsWith("blob:")&&URL.revokeObjectURL(d.url);}),m.forEach(d=>URL.revokeObjectURL(d));},[e,m]),jsxRuntime.jsx(ut.Provider,{value:{messages:e,setMessages:a},children:jsxRuntime.jsx(ct.Provider,{value:{inputMessage:l,setInputMessage:r},children:jsxRuntime.jsx(dt.Provider,{value:{loadingMessage:n,setLoadingMessage:u},children:jsxRuntime.jsx(mt.Provider,{value:{hasUnreadMessages:c,setHasUnreadMessages:s},children:jsxRuntime.jsx(pt.Provider,{value:{getFileUrl:g,removeFileUrl:i},children:t})})})})})}function qn(){let t=react.useContext(ut);if(t===void 0)throw new Error("useMessages must be used within a ChatProvider");return t}function Gt(){let t=react.useContext(ct);if(t===void 0)throw new Error("useInput must be used within a ChatProvider");return t}function Xn(){let t=react.useContext(dt);if(t===void 0)throw new Error("useLoadingMessage must be used within a ChatProvider");return t}function Gn(){let t=react.useContext(pt);if(t===void 0)throw new Error("useFileUrls must be used within a ChatProvider");return t}function Kn(){let t=react.useContext(mt);if(t===void 0)throw new Error("useUnreadMessages must be used within a ChatProvider");return t}function _(){let t=react.useContext(ut),e=react.useContext(ct),a=react.useContext(dt),l=react.useContext(mt),r=react.useContext(pt);if(t===void 0||e===void 0||a===void 0||l===void 0||r===void 0)throw new Error("useChat must be used within a ChatProvider");return {...t,...e,...a,...l,...r}}function ei(){let{loadingMessage:t}=_();return t?jsxRuntime.jsxs("div",{className:"chat-loading-message lua:flex lua:items-center lua:gap-2 lua:mx-4 lua:sm:mx-5",children:[jsxRuntime.jsx(luaniverse.Logo,{size:24,className:"chat-loading-logo lua:w-6 lua:h-6 lua:rounded-full lua:flex-shrink-0 lua:animate-spin",style:{animationDuration:"3s"}}),jsxRuntime.jsx("div",{className:"chat-loading-text lua:text-sm lua:opacity-40",children:t||"Lua is typing..."})]}):null}function Qt({buttons:t,onClick:e}){return jsxRuntime.jsx("div",{className:"chat-action-message lua:w-full",children:jsxRuntime.jsx("div",{className:"chat-action-buttons lua:flex lua:gap-2 lua:flex-wrap lua:mx-4 lua:sm:mx-5",children:t.map((a,l)=>jsxRuntime.jsx(luaniverse.Button,{variant:"tertiary",className:"chat-action-button lua:font-normal lua:rounded-lg lua:py-2 lua:h-auto",onClick:()=>e(a.text),children:a.text},l))})})}var Zt=t=>{let e="::: actions",a=":::",l=t.indexOf(e);if(l===-1)return [];let r=t.indexOf(a,l+e.length);return r===-1?[]:t.slice(l+e.length,r).trim().replace(/\\n/g,`
|
|
16
17
|
`).split(`
|
|
17
|
-
`).map(p=>p.trim()).filter(p=>p&&p.startsWith("-")).map(p=>({text:p.replace(/^-[\s]?/,"").trim(),onClick:p.replace(/^-[\s]?/,"").trim()}))};function Wn({onSelect:t}){let{messages:e}=z();if(e.length===0)return null;let a=e[e.length-1],l=Wt(a.content);return l.length===0?null:jsxRuntime.jsx(_t,{buttons:l,onClick:t})}var pi=react.memo(function({onSend:e,disabled:a=false,onFilePaste:l}){let{inputMessage:r,setInputMessage:o}=$t(),[u,c]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let n=()=>{c(window.matchMedia("(max-width: 768px)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n);}},[]),react.useEffect(()=>{let n=i.current;n&&(a||(n.style.height="auto",n.style.height=`${n.scrollHeight}px`));},[r]);let m=n=>{if(n.key==="Enter"){if(u||n.shiftKey||n.metaKey||n.ctrlKey)return;n.preventDefault(),e();}},p=react.useCallback(n=>{let{items:s}=n.clipboardData;if(!s||!l)return;let g=[];for(let x=0;x<s.length;x++){let d=s[x];if(d.kind==="file"){let v=d.getAsFile();v&&g.push(v);}}g.length>0&&(n.preventDefault(),l(g));},[l]);return jsxRuntime.jsxs("div",{className:"lua:flex lua:gap-3 lua:py-2 lua:px-3 lua:items-start",children:[jsxRuntime.jsx(luaniverse.Logo,{size:32,className:"lua:w-8 lua:h-8 lua:rounded-full lua:flex-shrink-0 lua:m-1"}),jsxRuntime.jsx("div",{className:"lua:flex-1 lua:flex",children:jsxRuntime.jsx("textarea",{ref:i,disabled:a,value:r,onChange:n=>o(n.target.value),onKeyDown:m,onPaste:p,placeholder:a?"This conversation's chat window has already been closed":"Reply to user",className:`lua:w-full lua:pl-0 lua:pr-4 lua:py-2 lua:resize-none lua:overflow-y-auto lua:border-none lua:focus:outline-none lua:focus:ring-0 lua:text-gray-700 lua:dark:text-gray-200 lua:placeholder:text-gray-400 lua:dark:placeholder:text-gray-500 lua:min-h-10 lua:max-h-48 lua:bg-transparent${a?" lua:cursor-not-allowed lua:h-14":""}`,rows:1})})]})});function Rl(){return localStorage.getItem("authToken")}async function Z(t,e,a){let l=Rl();if(!l)throw new Error("No auth token found");return new Promise((r,o)=>{let u=new XMLHttpRequest,c=new FormData;c.append("file",t),u.upload.addEventListener("progress",i=>{if(i.lengthComputable&&a){let m=i.loaded/i.total*100;a(m);}}),u.addEventListener("load",()=>{if(u.status>=200&&u.status<300)try{let i=JSON.parse(u.responseText);r(i);}catch{o(new Error("Failed to parse response"));}else o(new Error(`Failed to upload file: ${u.status}`));}),u.addEventListener("error",()=>{o(new Error("Network error occurred"));}),u.open("POST",`${e}/upload`),u.setRequestHeader("Authorization",`Bearer ${l}`),u.send(c);})}function El(t){let e=t.type,a="File";return e.startsWith("image/")?a="Image":e.startsWith("video/")?a="Video":e.startsWith("audio/")&&(a="Audio"),{icon:()=>null,label:a}}function dt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,onUploadComplete:r}){let o=El(t),u=o.icon,[c,i]=react.useState(false),[m,p]=react.useState(0),[n,s]=react.useState(l||null),g=react.useRef(false);return react.useEffect(()=>{if(n||g.current)return;(async()=>{i(true),g.current=true;try{let{fileId:d}=await Z(t,a,h=>{p(h);}),v=`${a}/${d}`;s(v),i(!1),r&&r(t,v);}catch(d){console.error("Upload failed for file:",t.name,d),i(false),g.current=false;}})();},[t,a,r,n]),jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:gap-4 lua:p-3 lua:bg-card lua:border lua:border-border lua:rounded-lg",children:[jsxRuntime.jsx("div",{className:"lua:flex-shrink-0",children:c?jsxRuntime.jsxs("div",{className:"lua:w-8 lua:h-8 lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-6 lua:h-6 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-1 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(m),"%"]})]}):jsxRuntime.jsx(u,{className:"lua:w-8 lua:h-8 lua:text-gray-600 lua:dark:text-gray-400"})}),jsxRuntime.jsxs("div",{className:"lua:flex-grow lua:min-w-0",children:[jsxRuntime.jsx("p",{className:"lua:text-sm lua:font-medium lua:text-gray-900 lua:dark:text-gray-100 lua:truncate",children:t.name}),jsxRuntime.jsx("p",{className:"lua:text-xs lua:text-gray-500 lua:dark:text-gray-400",children:o.label})]}),jsxRuntime.jsx("button",{onClick:e,className:"lua:flex-shrink-0 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:w-4 lua:h-4"})})]})}function mt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,onUploadComplete:r}){let{getFileUrl:o}=z(),[u,c]=react.useState(false),[i,m]=react.useState(0),[p,n]=react.useState(l||null),[s,g]=react.useState(false);react.useEffect(()=>{if(l||s)return;(async()=>{c(true),g(true);try{let{fileId:v}=await Z(t,a,N=>{m(N);}),h=`${a}/${v}`;n(h),c(!1),r&&r(t,h);}catch(v){console.error("Upload failed:",v),c(false);}})();},[t,l,a,s,r]);let x=p||(u?void 0:o(t));return jsxRuntime.jsxs("div",{className:"lua:relative lua:flex-shrink-0",children:[u?jsxRuntime.jsxs("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-8 lua:h-8 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-2 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(i),"%"]})]}):x?jsxRuntime.jsx("img",{"data-testid":"image-thumbnail",src:x,alt:t.name,className:"lua:w-32 lua:h-32 lua:object-cover lua:rounded-lg"}):jsxRuntime.jsx("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("span",{className:"lua:text-gray-500 lua:dark:text-gray-400",children:"No preview"})}),jsxRuntime.jsxs("div",{className:"lua:absolute lua:bottom-1 lua:left-1 lua:px-1.5 lua:py-0.5 lua:rounded lua:bg-black/50 lua:text-white lua:text-xs",children:[Math.floor(t.size/1024/1024),"MB"]}),jsxRuntime.jsx("button",{onClick:()=>e(),className:"lua:absolute lua:top-1 lua:right-1 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx("span",{className:"lua:text-sm",children:"\xD7"})})]})}function pt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,thumbnailUrl:r,onUploadComplete:o}){let{getFileUrl:u}=z(),[c,i]=react.useState(false),[m,p]=react.useState(0),[n,s]=react.useState(l||null),[g,x]=react.useState(false),[d,v]=react.useState(r||null);return react.useEffect(()=>{if(!r&&!d){let h=u(t),N=document.createElement("video");N.src=h;let w=()=>{try{N.currentTime=0,setTimeout(()=>{let f=document.createElement("canvas");f.width=N.videoWidth,f.height=N.videoHeight;let y=f.getContext("2d");if(!y){console.error("Could not get canvas context");return}y.drawImage(N,0,0);let U=f.toDataURL("image/jpeg",.8);v(U);},100);}catch(f){console.error("Error generating thumbnail:",f);}finally{URL.revokeObjectURL(h),N.removeEventListener("canplay",w);}};N.addEventListener("canplay",w),N.load();}},[t,r,d]),react.useEffect(()=>{if(l||g)return;(async()=>{i(true),x(true);try{let{fileId:N}=await Z(t,a,f=>{p(f);}),w=`${a}/${N}`;s(w),i(!1),o&&o(t,w);}catch(N){console.error("Upload failed:",N),i(false);}})();},[t,l,a,g,o]),jsxRuntime.jsxs("div",{className:"lua:relative lua:flex-shrink-0",children:[c?jsxRuntime.jsxs("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-8 lua:h-8 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-2 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(m),"%"]})]}):jsxRuntime.jsxs("div",{className:"lua:relative",children:[jsxRuntime.jsx("img",{"data-testid":"video-thumbnail",src:d||n||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",alt:t.name,className:"lua:w-32 lua:h-32 lua:object-cover lua:rounded-lg lua:bg-muted"}),jsxRuntime.jsx("div",{className:"lua:absolute lua:inset-0 lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("div",{className:"lua:w-10 lua:h-10 lua:rounded-full lua:bg-black/50 lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M5 3L19 12L5 21V3Z",fill:"white"})})})})]}),jsxRuntime.jsxs("div",{className:"lua:absolute lua:bottom-1 lua:left-1 lua:px-1.5 lua:py-0.5 lua:rounded lua:bg-black/50 lua:text-white lua:text-xs",children:[Math.floor(t.size/1024/1024),"MB"]}),jsxRuntime.jsx("button",{onClick:()=>e(),className:"lua:absolute lua:top-1 lua:right-1 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx("span",{className:"lua:text-sm",children:"\xD7"})})]})}function Xt(t){let e=t.type,a="other",l="File";return e.startsWith("image/")?(a="image",l="Image"):e.startsWith("video/")?(a="video",l="Video"):e.startsWith("audio/")&&(a="audio",l="Audio"),{category:a,icon:()=>null,label:l}}function Hi({files:t,onRemove:e,cdnUrl:a,fileMetadata:l=[],onFileUploadComplete:r}){let[o,u]=react.useState({});return react.useEffect(()=>{t.forEach((c,i)=>{let m=Xt(c),p=l.find(n=>n.file===c);if(m.category==="video"&&!o[i]&&!p){let n=URL.createObjectURL(c),s=document.createElement("video");s.src=n;let g=()=>{try{s.currentTime=0,setTimeout(()=>{let x=document.createElement("canvas");x.width=s.videoWidth,x.height=s.videoHeight;let d=x.getContext("2d");if(!d){console.error("Could not get canvas context");return}d.drawImage(s,0,0);let v=x.toDataURL("image/jpeg",.8);u(h=>({...h,[i]:v}));},100);}catch(x){console.error("Error generating thumbnail:",x);}finally{URL.revokeObjectURL(n),s.removeEventListener("canplay",g);}};s.addEventListener("canplay",g),s.load();}});},[t,l]),t.length===0?null:jsxRuntime.jsx("div",{className:"lua:px-4 lua:py-2 lua:border-b lua:border-gray-200 lua:dark:border-gray-700",children:jsxRuntime.jsx("div",{className:"lua:flex lua:gap-2 lua:overflow-x-auto scrollbar-hide",children:t.map((c,i)=>{let m=Xt(c),p=l.find(n=>n.file===c);return t.length>1?jsxRuntime.jsx("div",{className:"lua:flex-shrink-0 lua:w-64",children:jsxRuntime.jsx(dt,{file:c,onRemove:()=>e(i),cdnUrl:a,onUploadComplete:(n,s)=>{r&&r(n,s);}})},i):m.category==="image"?jsxRuntime.jsx(mt,{file:c,onRemove:()=>e(i),cdnUrl:a,initialUrl:p?.url,onUploadComplete:(n,s)=>{r&&r(n,s);}},c.name):m.category==="video"?jsxRuntime.jsx(pt,{file:c,onRemove:()=>e(i),cdnUrl:a,initialUrl:p?.url,thumbnailUrl:o[i],onUploadComplete:(n,s)=>{r&&r(n,s);}},c.name):jsxRuntime.jsx("div",{className:"lua:flex-shrink-0 lua:w-64",children:jsxRuntime.jsx(dt,{file:c,onRemove:()=>e(i),cdnUrl:a,onUploadComplete:(n,s)=>{r&&r(n,s);}})},i)})})})}var ee={CHAT:{TOOLBAR_ACTION:{FILE_UPLOAD:"file_upload",CAMERA:"camera",VIDEO:"video",AUDIO:"audio",LOCATION:"location"},MESSAGE_SENT:"message_sent"}};function te(t){console.log("Analytics event:",t);}function zi({loading:t,onFileClick:e,onCameraClick:a,onVideoClick:l,onAudioClick:r,onLocationClick:o,onSendClick:u}){return jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:justify-between lua:border-t lua:border-border lua:bg-muted/50 lua:dark:bg-muted/50 lua:px-3 lua:py-2",children:[jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:gap-2",children:[jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{te(ee.CHAT.TOOLBAR_ACTION.FILE_UPLOAD),e();},disabled:t,"data-testid":"file-upload-button",children:jsxRuntime.jsx(luaniverse.Paperclip,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Attach files"})]})]}),jsxRuntime.jsx("div",{className:"lua:w-px lua:h-5 lua:bg-border"}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{te(ee.CHAT.TOOLBAR_ACTION.CAMERA),a();},disabled:t,"data-testid":"camera-button",children:jsxRuntime.jsx(luaniverse.Camera,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Take a picture"})]})]}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{te(ee.CHAT.TOOLBAR_ACTION.VIDEO),l();},disabled:t,"data-testid":"video-button",children:jsxRuntime.jsx(luaniverse.VideoCamera,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Record video"})]})]}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{te(ee.CHAT.TOOLBAR_ACTION.AUDIO),r();},disabled:t,"data-testid":"audio-button",children:jsxRuntime.jsx(luaniverse.Microphone,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Record voice message"})]})]}),jsxRuntime.jsx("div",{className:"lua:w-px lua:h-5 lua:bg-border"}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{te(ee.CHAT.TOOLBAR_ACTION.LOCATION),o();},disabled:t,"data-testid":"location-button",children:jsxRuntime.jsx(luaniverse.MapPin,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Share location"})]})]})]}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:()=>{te(ee.CHAT.MESSAGE_SENT),u();},disabled:t,"data-testid":"send-button",variant:"default",children:jsxRuntime.jsx(luaniverse.ArrowUp,{})})]})}
|
|
18
|
-
exports.ActionMessage=
|
|
18
|
+
`).map(g=>g.trim()).filter(g=>g&&g.startsWith("-")).map(g=>({text:g.replace(/^-[\s]?/,"").trim(),onClick:g.replace(/^-[\s]?/,"").trim()}))};function ci({onSelect:t}){let{messages:e}=_();if(e.length===0)return null;let a=e[e.length-1],l=Zt(a.content);return l.length===0?null:jsxRuntime.jsx(Qt,{buttons:l,onClick:t})}var Ui=react.memo(function({onSend:e,disabled:a=false,onFilePaste:l}){let{inputMessage:r,setInputMessage:n}=Gt(),[u,c]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let i=()=>{c(window.matchMedia("(max-width: 768px)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));};return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i);}},[]),react.useEffect(()=>{let i=s.current;i&&(a||(i.style.height="auto",i.style.height=`${i.scrollHeight}px`));},[r]);let m=i=>{if(i.key==="Enter"){if(u||i.shiftKey||i.metaKey||i.ctrlKey)return;i.preventDefault(),e();}},g=react.useCallback(i=>{let{items:d}=i.clipboardData;if(!d||!l)return;let f=[];for(let v=0;v<d.length;v++){let y=d[v];if(y.kind==="file"){let N=y.getAsFile();N&&f.push(N);}}f.length>0&&(i.preventDefault(),l(f));},[l]);return jsxRuntime.jsxs("div",{className:"lua:flex lua:gap-3 lua:py-2 lua:px-3 lua:items-start",children:[jsxRuntime.jsx(luaniverse.Logo,{size:32,className:"lua:w-8 lua:h-8 lua:rounded-full lua:flex-shrink-0 lua:m-1"}),jsxRuntime.jsx("div",{className:"lua:flex-1 lua:flex",children:jsxRuntime.jsx("textarea",{ref:s,disabled:a,value:r,onChange:i=>n(i.target.value),onKeyDown:m,onPaste:g,placeholder:a?"This conversation's chat window has already been closed":"Reply to user",className:`lua:w-full lua:pl-0 lua:pr-4 lua:py-2 lua:resize-none lua:overflow-y-auto lua:border-none lua:focus:outline-none lua:focus:ring-0 lua:text-gray-700 lua:dark:text-gray-200 lua:placeholder:text-gray-400 lua:dark:placeholder:text-gray-500 lua:min-h-10 lua:max-h-48 lua:bg-transparent${a?" lua:cursor-not-allowed lua:h-14":""}`,rows:1})})]})});function $l(){return localStorage.getItem("authToken")}async function ee(t,e,a){let l=$l();if(!l)throw new Error("No auth token found");return new Promise((r,n)=>{let u=new XMLHttpRequest,c=new FormData;c.append("file",t),u.upload.addEventListener("progress",s=>{if(s.lengthComputable&&a){let m=s.loaded/s.total*100;a(m);}}),u.addEventListener("load",()=>{if(u.status>=200&&u.status<300)try{let s=JSON.parse(u.responseText);r(s);}catch{n(new Error("Failed to parse response"));}else n(new Error(`Failed to upload file: ${u.status}`));}),u.addEventListener("error",()=>{n(new Error("Network error occurred"));}),u.open("POST",`${e}/upload`),u.setRequestHeader("Authorization",`Bearer ${l}`),u.send(c);})}function jl(t){let e=t.type,a="File";return e.startsWith("image/")?a="Image":e.startsWith("video/")?a="Video":e.startsWith("audio/")&&(a="Audio"),{icon:()=>null,label:a}}function vt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,onUploadComplete:r}){let n=jl(t),u=n.icon,[c,s]=react.useState(false),[m,g]=react.useState(0),[i,d]=react.useState(l||null),f=react.useRef(false);return react.useEffect(()=>{if(i||f.current)return;(async()=>{s(true),f.current=true;try{let{fileId:y}=await ee(t,a,p=>{g(p);}),N=`${a}/${y}`;d(N),s(!1),r&&r(t,N);}catch(y){console.error("Upload failed for file:",t.name,y),s(false),f.current=false;}})();},[t,a,r,i]),jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:gap-4 lua:p-3 lua:bg-card lua:border lua:border-border lua:rounded-lg",children:[jsxRuntime.jsx("div",{className:"lua:flex-shrink-0",children:c?jsxRuntime.jsxs("div",{className:"lua:w-8 lua:h-8 lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-6 lua:h-6 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-1 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(m),"%"]})]}):jsxRuntime.jsx(u,{className:"lua:w-8 lua:h-8 lua:text-gray-600 lua:dark:text-gray-400"})}),jsxRuntime.jsxs("div",{className:"lua:flex-grow lua:min-w-0",children:[jsxRuntime.jsx("p",{className:"lua:text-sm lua:font-medium lua:text-gray-900 lua:dark:text-gray-100 lua:truncate",children:t.name}),jsxRuntime.jsx("p",{className:"lua:text-xs lua:text-gray-500 lua:dark:text-gray-400",children:n.label})]}),jsxRuntime.jsx("button",{onClick:e,className:"lua:flex-shrink-0 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx(luaniverse.XIcon,{className:"lua:w-4 lua:h-4"})})]})}function xt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,onUploadComplete:r}){let{getFileUrl:n}=_(),[u,c]=react.useState(false),[s,m]=react.useState(0),[g,i]=react.useState(l||null),[d,f]=react.useState(false);react.useEffect(()=>{if(l||d)return;(async()=>{c(true),f(true);try{let{fileId:N}=await ee(t,a,h=>{m(h);}),p=`${a}/${N}`;i(p),c(!1),r&&r(t,p);}catch(N){console.error("Upload failed:",N),c(false);}})();},[t,l,a,d,r]);let v=g||(u?void 0:n(t));return jsxRuntime.jsxs("div",{className:"lua:relative lua:flex-shrink-0",children:[u?jsxRuntime.jsxs("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-8 lua:h-8 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-2 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(s),"%"]})]}):v?jsxRuntime.jsx("img",{"data-testid":"image-thumbnail",src:v,alt:t.name,className:"lua:w-32 lua:h-32 lua:object-cover lua:rounded-lg"}):jsxRuntime.jsx("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("span",{className:"lua:text-gray-500 lua:dark:text-gray-400",children:"No preview"})}),jsxRuntime.jsxs("div",{className:"lua:absolute lua:bottom-1 lua:left-1 lua:px-1.5 lua:py-0.5 lua:rounded lua:bg-black/50 lua:text-white lua:text-xs",children:[Math.floor(t.size/1024/1024),"MB"]}),jsxRuntime.jsx("button",{onClick:()=>e(),className:"lua:absolute lua:top-1 lua:right-1 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx("span",{className:"lua:text-sm",children:"\xD7"})})]})}function yt({file:t,onRemove:e,cdnUrl:a,initialUrl:l,thumbnailUrl:r,onUploadComplete:n}){let{getFileUrl:u}=_(),[c,s]=react.useState(false),[m,g]=react.useState(0),[i,d]=react.useState(l||null),[f,v]=react.useState(false),[y,N]=react.useState(r||null);return react.useEffect(()=>{if(!r&&!y){let p=u(t),h=document.createElement("video");h.src=p;let b=()=>{try{h.currentTime=0,setTimeout(()=>{let C=document.createElement("canvas");C.width=h.videoWidth,C.height=h.videoHeight;let w=C.getContext("2d");if(!w){console.error("Could not get canvas context");return}w.drawImage(h,0,0);let o=C.toDataURL("image/jpeg",.8);N(o);},100);}catch(C){console.error("Error generating thumbnail:",C);}finally{URL.revokeObjectURL(p),h.removeEventListener("canplay",b);}};h.addEventListener("canplay",b),h.load();}},[t,r,y]),react.useEffect(()=>{if(l||f)return;(async()=>{s(true),v(true);try{let{fileId:h}=await ee(t,a,C=>{g(C);}),b=`${a}/${h}`;d(b),s(!1),n&&n(t,b);}catch(h){console.error("Upload failed:",h),s(false);}})();},[t,l,a,f,n]),jsxRuntime.jsxs("div",{className:"lua:relative lua:flex-shrink-0",children:[c?jsxRuntime.jsxs("div",{className:"lua:w-32 lua:h-32 lua:bg-muted lua:rounded-lg lua:flex lua:flex-col lua:items-center lua:justify-center",children:[jsxRuntime.jsx("div",{className:"lua:w-8 lua:h-8 lua:border-2 lua:border-t-blue-500 lua:border-r-transparent lua:border-b-transparent lua:border-l-transparent lua:rounded-full lua:animate-spin"}),jsxRuntime.jsxs("div",{className:"lua:mt-2 lua:text-xs lua:text-gray-600 lua:dark:text-gray-300 lua:font-medium",children:[Math.round(m),"%"]})]}):jsxRuntime.jsxs("div",{className:"lua:relative",children:[jsxRuntime.jsx("img",{"data-testid":"video-thumbnail",src:y||i||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",alt:t.name,className:"lua:w-32 lua:h-32 lua:object-cover lua:rounded-lg lua:bg-muted"}),jsxRuntime.jsx("div",{className:"lua:absolute lua:inset-0 lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("div",{className:"lua:w-10 lua:h-10 lua:rounded-full lua:bg-black/50 lua:flex lua:items-center lua:justify-center",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M5 3L19 12L5 21V3Z",fill:"white"})})})})]}),jsxRuntime.jsxs("div",{className:"lua:absolute lua:bottom-1 lua:left-1 lua:px-1.5 lua:py-0.5 lua:rounded lua:bg-black/50 lua:text-white lua:text-xs",children:[Math.floor(t.size/1024/1024),"MB"]}),jsxRuntime.jsx("button",{onClick:()=>e(),className:"lua:absolute lua:top-1 lua:right-1 lua:w-6 lua:h-6 lua:flex lua:items-center lua:justify-center lua:rounded-full lua:bg-gray-800 lua:dark:bg-gray-700 lua:text-white lua:hover:bg-gray-700 lua:dark:hover:bg-gray-600 lua:transition-colors",children:jsxRuntime.jsx("span",{className:"lua:text-sm",children:"\xD7"})})]})}function ea(t){let e=t.type,a="other",l="File";return e.startsWith("image/")?(a="image",l="Image"):e.startsWith("video/")?(a="video",l="Video"):e.startsWith("audio/")&&(a="audio",l="Audio"),{category:a,icon:()=>null,label:l}}function as({files:t,onRemove:e,cdnUrl:a,fileMetadata:l=[],onFileUploadComplete:r}){let[n,u]=react.useState({});return react.useEffect(()=>{t.forEach((c,s)=>{let m=ea(c),g=l.find(i=>i.file===c);if(m.category==="video"&&!n[s]&&!g){let i=URL.createObjectURL(c),d=document.createElement("video");d.src=i;let f=()=>{try{d.currentTime=0,setTimeout(()=>{let v=document.createElement("canvas");v.width=d.videoWidth,v.height=d.videoHeight;let y=v.getContext("2d");if(!y){console.error("Could not get canvas context");return}y.drawImage(d,0,0);let N=v.toDataURL("image/jpeg",.8);u(p=>({...p,[s]:N}));},100);}catch(v){console.error("Error generating thumbnail:",v);}finally{URL.revokeObjectURL(i),d.removeEventListener("canplay",f);}};d.addEventListener("canplay",f),d.load();}});},[t,l]),t.length===0?null:jsxRuntime.jsx("div",{className:"lua:px-4 lua:py-2 lua:border-b lua:border-gray-200 lua:dark:border-gray-700",children:jsxRuntime.jsx("div",{className:"lua:flex lua:gap-2 lua:overflow-x-auto scrollbar-hide",children:t.map((c,s)=>{let m=ea(c),g=l.find(i=>i.file===c);return t.length>1?jsxRuntime.jsx("div",{className:"lua:flex-shrink-0 lua:w-64",children:jsxRuntime.jsx(vt,{file:c,onRemove:()=>e(s),cdnUrl:a,onUploadComplete:(i,d)=>{r&&r(i,d);}})},s):m.category==="image"?jsxRuntime.jsx(xt,{file:c,onRemove:()=>e(s),cdnUrl:a,initialUrl:g?.url,onUploadComplete:(i,d)=>{r&&r(i,d);}},c.name):m.category==="video"?jsxRuntime.jsx(yt,{file:c,onRemove:()=>e(s),cdnUrl:a,initialUrl:g?.url,thumbnailUrl:n[s],onUploadComplete:(i,d)=>{r&&r(i,d);}},c.name):jsxRuntime.jsx("div",{className:"lua:flex-shrink-0 lua:w-64",children:jsxRuntime.jsx(vt,{file:c,onRemove:()=>e(s),cdnUrl:a,onUploadComplete:(i,d)=>{r&&r(i,d);}})},s)})})})}var le={CHAT:{TOOLBAR_ACTION:{FILE_UPLOAD:"file_upload",CAMERA:"camera",VIDEO:"video",AUDIO:"audio",LOCATION:"location"},MESSAGE_SENT:"message_sent"}};function re(t){console.log("Analytics event:",t);}function ns({loading:t,onFileClick:e,onCameraClick:a,onVideoClick:l,onAudioClick:r,onLocationClick:n,onSendClick:u}){return jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:justify-between lua:border-t lua:border-border lua:bg-muted/50 lua:dark:bg-muted/50 lua:px-3 lua:py-2",children:[jsxRuntime.jsxs("div",{className:"lua:flex lua:items-center lua:gap-2",children:[jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{re(le.CHAT.TOOLBAR_ACTION.FILE_UPLOAD),e();},disabled:t,"data-testid":"file-upload-button",children:jsxRuntime.jsx(luaniverse.Paperclip,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Attach files"})]})]}),jsxRuntime.jsx("div",{className:"lua:w-px lua:h-5 lua:bg-border"}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{re(le.CHAT.TOOLBAR_ACTION.CAMERA),a();},disabled:t,"data-testid":"camera-button",children:jsxRuntime.jsx(luaniverse.Camera,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Take a picture"})]})]}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{re(le.CHAT.TOOLBAR_ACTION.VIDEO),l();},disabled:t,"data-testid":"video-button",children:jsxRuntime.jsx(luaniverse.VideoCamera,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Record video"})]})]}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{re(le.CHAT.TOOLBAR_ACTION.AUDIO),r();},disabled:t,"data-testid":"audio-button",children:jsxRuntime.jsx(luaniverse.Microphone,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Record voice message"})]})]}),jsxRuntime.jsx("div",{className:"lua:w-px lua:h-5 lua:bg-border"}),jsxRuntime.jsxs(luaniverse.Tooltip,{children:[jsxRuntime.jsx(luaniverse.TooltipTrigger,{asChild:true,children:jsxRuntime.jsx(luaniverse.IconButton,{className:"lua:rounded-lg",variant:"muted",onClick:()=>{re(le.CHAT.TOOLBAR_ACTION.LOCATION),n();},disabled:t,"data-testid":"location-button",children:jsxRuntime.jsx(luaniverse.MapPin,{className:"lua:text-gray-600 lua:dark:text-gray-300"})})}),jsxRuntime.jsxs(luaniverse.TooltipContent,{children:[jsxRuntime.jsx(luaniverse.TooltipArrow,{}),jsxRuntime.jsx("p",{children:"Share location"})]})]})]}),jsxRuntime.jsx(luaniverse.IconButton,{onClick:()=>{re(le.CHAT.MESSAGE_SENT),u();},disabled:t,"data-testid":"send-button",variant:"default",children:jsxRuntime.jsx(luaniverse.ArrowUp,{})})]})}
|
|
19
|
+
exports.ActionMessage=Qt;exports.AudioPreview=Et;exports.AudioRecorder=rr;exports.CameraDialog=Mr;exports.CarouselImageDialog=Tt;exports.ChatActions=ci;exports.ChatInput=Ui;exports.ChatMessage=Bn;exports.ChatProvider=jn;exports.CodeBlock=At;exports.FilePreview=as;exports.FilePreviewCard=vt;exports.ImageDialog=Mt;exports.LoadingMessage=ei;exports.LocationDialog=Pr;exports.PaymentPreview=ze;exports.Toolbar=ns;exports.VideoDialog=dr;exports.markdownStyles=R;exports.parseActions=Zt;exports.parseUrl=Va;exports.truncateUrl=Se;exports.uploadFile=ee;exports.useChat=_;exports.useFileUrls=Gn;exports.useInput=Gt;exports.useLoadingMessage=Xn;exports.useMessages=qn;exports.useUnreadMessages=Kn;//# sourceMappingURL=index.js.map
|
|
19
20
|
//# sourceMappingURL=index.js.map
|