@bcrumbs.net/bc-chat 1.0.74 → 1.0.75

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/build/index.es.js CHANGED
@@ -64,7 +64,7 @@ import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useCallba
64
64
  justify-content: ${e=>e.isMedia&&e.isMyMessage?"flex-end":"flex-start"};
65
65
  margin-bottom: -4px;
66
66
  gap: 4px;
67
- `,D=c.button`
67
+ `,S=c.button`
68
68
  display: none;
69
69
  position: absolute;
70
70
  ${e=>e.isMyMessage&&!e.isRTL||!e.isMyMessage&&e.isRTL?"left: -40px;":"right: -40px;"}
@@ -87,7 +87,7 @@ import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useCallba
87
87
  background-color: rgba(22, 97, 108, 0.12);
88
88
  outline: none;
89
89
  }
90
- `,S=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),B=({isMyMessage:t,createdAt:o,children:a,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const h=p(s.content),u="AR"===l.language,m=s?.messageId,b=Boolean(d&&m),C=i((()=>{m&&d?.(m)}),[m,d]),x=o||s&&l&&l.isAgent===s.isAgent?n(F,{isMedia:g,isMyMessage:t,children:[s&&l&&l.isAgent===s.isAgent&&e(A,{message:s,config:l}),o&&e(v,{createdAt:o})]}):null;return n(I,{isMyMessage:t,isMedia:g,language:l.language,className:r,style:c,children:[b?e(D,{className:"bc-replyButton",type:"button",onClick:C,isRTL:u,isMyMessage:t,children:e(S,{})}):null,s.context&&s.context.replyToId?e(k,{context:s.context,isMyMessage:t,language:h}):null,n(E,{isMyMessage:t,isMedia:g,children:[n(R,{language:h,children:[a,g&&x]}),!g&&x]})]})},z=({message:n,config:t,searchPattern:i,onReply:o})=>{const a=t.isAgent===n.isAgent;return e(B,{className:"bc-textMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:o,children:(n.content&&n.content.indexOf("\n")>-1?n.content.split("\n"):[n.content]).map(((t,o)=>{const a=i&&i.trim()?function(e,n){const t=(i=n.trim(),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var i;if(!t)return e;const o=new RegExp(`(${t})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(t,i):t;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${n.messageId}-${o}`)}))})};function N(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function Z({src:t}){const l=o(null),[c,d]=a(!1),[g,p]=a(!0),[h,u]=a(0),[m,b]=a(0),C=r((()=>{const e=function(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return()=>{n+=1831565813;let e=Math.imul(n^n>>>15,1|n);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(t),n=[];for(let t=0;t<82;t++){const i=.6*Math.sin(t/82*Math.PI)+.2,o=.25*(e()-.5),a=Math.min(1,Math.max(.15,i+o));n.push(a)}return n}),[t]);s((()=>{const e=l.current;if(!e)return;const n=()=>{u(e.duration),p(!1)},t=()=>b(e.currentTime),i=()=>d(!1),o=()=>{document.querySelectorAll("video, audio").forEach((n=>{n!==e&&n.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",n),e.addEventListener("timeupdate",t),e.addEventListener("ended",i),e.addEventListener("play",o),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("timeupdate",t),e.removeEventListener("ended",i),e.removeEventListener("play",o),e.removeEventListener("pause",a)}}),[t]);const x=i((()=>{const e=l.current;e&&(e.paused?e.play():e.pause())}),[]),f=i((e=>{const n=l.current;if(!n||!h)return;const t=e.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width));n.currentTime=i*h,b(n.currentTime)}),[h]),y=h?Math.min(1,m/h):0;return n("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:x,"aria-label":c?"Pause audio":"Play audio"}),n("div",{className:"bc-audioPlayer__wave",onClick:f,children:[e("div",{className:"bc-audioPlayer__wave--future",children:C.map(((n,t)=>e("span",{style:{height:`${Math.round(18*n)}px`}},`f-${t}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*y+"%"},children:C.map(((n,t)=>e("span",{style:{height:`${Math.round(18*n)}px`}},`p-${t}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":N(h)}),e("audio",{ref:l,src:t,preload:"metadata"})]})}const T=({message:t,config:r,onReply:l})=>{const[c,d]=a(!1),[g,p]=a(!0),h=o(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:t.type}),d(!0),p(!1)}),[t.type]),m=i((()=>{console.log("Media loaded successfully:",t.content),p(!1)}),[t.content]),b=i((()=>{console.log("Media can play:",t.content),p(!1)}),[t.content]),C=i((()=>{console.log("Media load started:",t.content)}),[t.content]);s((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},n=h.current;if(n){n.addEventListener("play",e),n.addEventListener("loadeddata",m),n.addEventListener("canplay",b),n.addEventListener("error",u),n.addEventListener("loadstart",C);const i=setTimeout((()=>{console.log("Loading timeout reached for:",t.content),p(!1)}),5e3);return()=>{n&&(n.removeEventListener("play",e),n.removeEventListener("loadeddata",m),n.removeEventListener("canplay",b),n.removeEventListener("error",u),n.removeEventListener("loadstart",C)),clearTimeout(i)}}}),[b,C,u,m,t.content,t.type]);const x=r.isAgent===t.isAgent;return c?n(B,{className:"bc-mediaMessage"+("audio"===t.type?" audio":""),isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,onReply:l,children:[n("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===t.type?"audio":"video"," file."]}),n("a",{href:t.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===t.type?"audio":"video"," in new tab"]})]}):"audio"===t.type?e(B,{className:"bc-mediaMessage audio",isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,style:{position:"relative"},onReply:l,children:e(Z,{src:t.content})}):n(B,{className:"bc-mediaMessage",isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,style:{position:"relative"},onReply:l,children:[e("video",{ref:h,src:t.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:b,onLoadStart:C}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var P={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download"},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل"},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir"}};const H=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),j=c.a`
90
+ `,D=()=>e("svg",{width:"15",height:"16",viewBox:"0 0 15 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.2232 8.33921C6.85992 8.33921 5.54564 8.35033 5.54564 8.35033V11.3333L1.29228 6.67275L5.54564 2.00666V5.01186C5.54564 5.01186 6.93435 4.99519 7.2232 5.0063C11.146 5.1285 13.8701 9.59462 13.8879 11.6832C12.6892 10.1445 9.53958 8.33921 7.2232 8.33921ZM6.65828 3.90089V0.623508C6.67716 0.456862 6.63217 0.290241 6.50552 0.162479C6.28554 -0.0541598 5.92892 -0.0541598 5.70895 0.162479L0.160208 6.25058C0.0430006 6.36723 -0.00699451 6.51722 0.000782283 6.67275C-0.00699451 6.82273 0.0430006 6.97827 0.160208 7.09493L5.6784 13.1442C5.78061 13.2719 5.92892 13.3553 6.10168 13.3553C6.25944 13.3553 6.39997 13.2886 6.50107 13.183C6.50218 13.183 6.50441 13.183 6.50552 13.1775C6.63217 13.0553 6.67716 12.8831 6.65828 12.722C6.65828 12.722 6.66772 9.63904 6.66772 9.45018C10.3339 9.45018 13.6496 12.0887 14.3079 15.5661C14.7511 14.544 15 13.4219 15 12.2387C15 7.63375 11.2649 3.90089 6.65828 3.90089Z",fill:"#161616"})}),B=({isMyMessage:t,createdAt:o,children:a,className:r,message:s,config:l,style:c,onReply:d,isMedia:g})=>{const h=p(s.content),u="AR"===l.language,m=s?.messageId,b=Boolean(d&&m),C=i((()=>{m&&d?.(m)}),[m,d]),x=o||s&&l&&l.isAgent===s.isAgent?n(F,{isMedia:g,isMyMessage:t,children:[s&&l&&l.isAgent===s.isAgent&&e(A,{message:s,config:l}),o&&e(v,{createdAt:o})]}):null;return n(I,{isMyMessage:t,isMedia:g,language:l.language,className:r,style:c,children:[b?e(S,{className:"bc-replyButton",type:"button",onClick:C,isRTL:u,isMyMessage:t,children:e(D,{})}):null,s.context&&s.context.replyToId?e(k,{context:s.context,isMyMessage:t,language:h}):null,n(E,{isMyMessage:t,isMedia:g,children:[n(R,{language:h,children:[a,g&&x]}),!g&&x]})]})},z=({message:n,config:t,searchPattern:i,onReply:o})=>{const a=t.isAgent===n.isAgent;return e(B,{className:"bc-textMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:o,children:(n.content&&n.content.indexOf("\n")>-1?n.content.split("\n"):[n.content]).map(((t,o)=>{const a=i&&i.trim()?function(e,n){const t=(i=n.trim(),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));var i;if(!t)return e;const o=new RegExp(`(${t})`,"gi");return e.replace(o,'<span style="background-color: var(--bc-chat-message-highlight-color, yellow); padding: 3px 0;">$1</span>')}(t,i):t;return e(d,{rehypePlugins:[g],skipHtml:!1,children:a},`${n.messageId}-${o}`)}))})};function N(e){if(!isFinite(e)||e<0)return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}function Z({src:t}){const l=o(null),[c,d]=a(!1),[g,p]=a(!0),[h,u]=a(0),[m,b]=a(0),C=r((()=>{const e=function(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return()=>{n+=1831565813;let e=Math.imul(n^n>>>15,1|n);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(t),n=[];for(let t=0;t<82;t++){const i=.6*Math.sin(t/82*Math.PI)+.2,o=.25*(e()-.5),a=Math.min(1,Math.max(.15,i+o));n.push(a)}return n}),[t]);s((()=>{const e=l.current;if(!e)return;const n=()=>{u(e.duration),p(!1)},t=()=>b(e.currentTime),i=()=>d(!1),o=()=>{document.querySelectorAll("video, audio").forEach((n=>{n!==e&&n.pause()})),d(!0)},a=()=>d(!1);return e.addEventListener("loadedmetadata",n),e.addEventListener("timeupdate",t),e.addEventListener("ended",i),e.addEventListener("play",o),e.addEventListener("pause",a),()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("timeupdate",t),e.removeEventListener("ended",i),e.removeEventListener("play",o),e.removeEventListener("pause",a)}}),[t]);const x=i((()=>{const e=l.current;e&&(e.paused?e.play():e.pause())}),[]),f=i((e=>{const n=l.current;if(!n||!h)return;const t=e.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width));n.currentTime=i*h,b(n.currentTime)}),[h]),y=h?Math.min(1,m/h):0;return n("div",{className:"bc-audioPlayer",role:"group","aria-label":"Audio message player",children:[e("button",{type:"button",className:"bc-audioPlayer__button "+(c?"pause":"play"),onClick:x,"aria-label":c?"Pause audio":"Play audio"}),n("div",{className:"bc-audioPlayer__wave",onClick:f,children:[e("div",{className:"bc-audioPlayer__wave--future",children:C.map(((n,t)=>e("span",{style:{height:`${Math.round(18*n)}px`}},`f-${t}`)))}),e("div",{className:"bc-audioPlayer__wave--past",style:{width:100*y+"%"},children:C.map(((n,t)=>e("span",{style:{height:`${Math.round(18*n)}px`}},`p-${t}`)))})]}),e("div",{className:"bc-audioPlayer__time","aria-live":"polite",children:g?"--:--":N(h)}),e("audio",{ref:l,src:t,preload:"metadata"})]})}const T=({message:t,config:r,onReply:l})=>{const[c,d]=a(!1),[g,p]=a(!0),h=o(null),u=i((()=>{const e=h.current;e&&console.error("Media playback error:",{src:e.src,error:e.error,networkState:e.networkState,readyState:e.readyState,messageType:t.type}),d(!0),p(!1)}),[t.type]),m=i((()=>{console.log("Media loaded successfully:",t.content),p(!1)}),[t.content]),b=i((()=>{console.log("Media can play:",t.content),p(!1)}),[t.content]),C=i((()=>{console.log("Media load started:",t.content)}),[t.content]);s((()=>{const e=()=>{document.querySelectorAll("video, audio").forEach((e=>{e!==h.current&&e.pause()}))},n=h.current;if(n){n.addEventListener("play",e),n.addEventListener("loadeddata",m),n.addEventListener("canplay",b),n.addEventListener("error",u),n.addEventListener("loadstart",C);const i=setTimeout((()=>{console.log("Loading timeout reached for:",t.content),p(!1)}),5e3);return()=>{n&&(n.removeEventListener("play",e),n.removeEventListener("loadeddata",m),n.removeEventListener("canplay",b),n.removeEventListener("error",u),n.removeEventListener("loadstart",C)),clearTimeout(i)}}}),[b,C,u,m,t.content,t.type]);const x=r.isAgent===t.isAgent;return c?n(B,{className:"bc-mediaMessage"+("audio"===t.type?" audio":""),isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,onReply:l,children:[n("p",{style:{margin:0,color:"#666"},children:["Unable to load ","audio"===t.type?"audio":"video"," file."]}),n("a",{href:t.content,target:"_blank",rel:"noopener noreferrer",style:{color:"#007bff",textDecoration:"none"},children:["Open ","audio"===t.type?"audio":"video"," in new tab"]})]}):"audio"===t.type?e(B,{className:"bc-mediaMessage audio",isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,style:{position:"relative"},onReply:l,children:e(Z,{src:t.content})}):n(B,{className:"bc-mediaMessage",isMyMessage:x,isMedia:!0,createdAt:t.createdAt,message:t,config:r,style:{position:"relative"},onReply:l,children:[e("video",{ref:h,src:t.content,controls:!0,preload:"metadata",playsInline:!0,onError:u,onLoadedData:m,onCanPlay:b,onLoadStart:C}),g&&e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",zIndex:1},children:"Loading video..."})]})};var P={EN:{share_my_location:"Share My Location",share_my_current_location:"Share My Current Location",placeholder:"Message...",notePlaceholder:"Add your note",see_your_location:"See Your Location",location_permission:"Please give location permission",download:"Download"},AR:{share_my_location:"مشاركة موقعي",share_my_current_location:"مشاركة موقعي الحالي",placeholder:"الرسالة...",notePlaceholder:"أضف ملاحظتك",see_your_location:"رؤية موقعك",location_permission:"يرجى منح إذن الموقع",download:"تحميل"},TR:{share_my_location:"Konumumu paylaş",share_my_current_location:"Güncel konumumu paylaş",placeholder:"Mesajınızı yazın",notePlaceholder:"Notunuzu ekleyin",see_your_location:"Konumunuzu Görüntüleyin",location_permission:"Lütfen konum paylaşımı için izin verin",download:"İndir"}};const H=()=>e("svg",{width:"18",height:"22",viewBox:"0 0 18 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.56055 0.249878C9.16365 0.249377 9.64011 0.249415 10.0869 0.407104C10.1792 0.439689 10.2701 0.477175 10.3584 0.519409C10.7858 0.723899 11.1227 1.06135 11.5488 1.48816L16.4443 6.38367C16.9387 6.87712 17.3304 7.26784 17.541 7.77625C17.7515 8.28461 17.7507 8.83754 17.75 9.53601V13.0565C17.75 14.8942 17.7498 16.3499 17.5967 17.4891C17.439 18.6615 17.1067 19.61 16.3584 20.3583C15.6101 21.1066 14.6616 21.4389 13.4893 21.5966C12.3501 21.7497 10.8943 21.7499 9.05664 21.7499H8.94336C7.10571 21.7499 5.64991 21.7497 4.51074 21.5966C3.33844 21.4389 2.38991 21.1066 1.6416 20.3583C0.893309 19.61 0.560952 18.6615 0.40332 17.4891C0.25016 16.3499 0.249984 14.8942 0.25 13.0565V8.4071C0.249988 6.82577 0.250388 5.57298 0.366211 4.58093C0.485107 3.56261 0.733898 2.72281 1.30176 2.01843C1.51427 1.75486 1.755 1.51514 2.01855 1.30261C2.72296 0.734673 3.56267 0.484993 4.58105 0.366089C5.57311 0.250277 6.8259 0.249866 8.40723 0.249878H8.56055ZM8.45605 1.74988C6.81549 1.74988 5.6499 1.75086 4.75488 1.85535C3.87608 1.95795 3.35453 2.15151 2.95996 2.4696C2.77959 2.61504 2.61516 2.77947 2.46973 2.95984C2.15159 3.35441 1.95808 3.87589 1.85547 4.75476C1.75097 5.64979 1.75 6.8153 1.75 8.45593V12.9999C1.75 14.9066 1.75151 16.2613 1.88965 17.2889C2.02491 18.295 2.27897 18.8745 2.70215 19.2977C3.12536 19.7209 3.70485 19.975 4.71094 20.1102C5.73859 20.2484 7.09323 20.2499 9 20.2499C10.9068 20.2499 12.2614 20.2484 13.2891 20.1102C14.2952 19.975 14.8746 19.7209 15.2979 19.2977C15.721 18.8745 15.9751 18.295 16.1104 17.2889C16.2485 16.2613 16.25 14.9066 16.25 12.9999V9.6571C16.25 9.21922 16.2468 8.94195 16.2334 8.74988H15.9453C14.5778 8.7499 13.4753 8.7502 12.6084 8.63367C11.7083 8.51265 10.9505 8.25316 10.3486 7.65125C9.74676 7.04934 9.48722 6.29156 9.36621 5.39148C9.24969 4.52456 9.24998 3.422 9.25 2.05457V1.76355C9.08319 1.75292 8.84192 1.74988 8.45605 1.74988ZM13 15.2499C13.4142 15.2499 13.75 15.5857 13.75 15.9999C13.75 16.4141 13.4142 16.7499 13 16.7499H5C4.58579 16.7499 4.25 16.4141 4.25 15.9999C4.25 15.5857 4.58579 15.2499 5 15.2499H13ZM9 11.2499C9.41421 11.2499 9.75 11.5857 9.75 11.9999C9.75 12.4141 9.41421 12.7499 9 12.7499H5C4.58579 12.7499 4.25 12.4141 4.25 11.9999C4.25 11.5857 4.58579 11.2499 5 11.2499H9ZM10.751 2.8114C10.7546 3.82629 10.7723 4.58818 10.8535 5.19226C10.9522 5.92571 11.1325 6.31399 11.4092 6.5907C11.6859 6.86746 12.0748 7.04771 12.8086 7.14636C13.4126 7.22753 14.1738 7.24524 15.1885 7.2489L10.751 2.8114Z",fill:"#16616C"})}),j=c.a`
91
91
  ${e=>e.isMyMessage?"flex-direction: row;":"flex-direction: row-reverse;"}
92
92
  min-width: 300px;
93
93
  display: flex;
@@ -121,11 +121,11 @@ i {
121
121
  align-items: center;
122
122
  justify-content: center;
123
123
  padding: 8px;
124
- `,U=c.div`
124
+ `,V=c.div`
125
125
  display: flex;
126
126
  flex-direction: column;
127
127
  gap: 4px;
128
- `,V=c.span`
128
+ `,U=c.span`
129
129
  font-size: var(--bc-chat-fontSize-xs);
130
130
  font-weight: var(--bc-chat-fontWeight-regular);
131
131
  line-height: var(--bc-chat-lineHeight-xs);
@@ -170,7 +170,7 @@ i {
170
170
  max-width: 60%;
171
171
  `,X=c.span`
172
172
  direction: ${e=>"arb"===e.language?"rtl":"ltr"};
173
- `,$={document:({message:t,config:i,onReply:o})=>{const l=i.isAgent===t.isAgent,[c,d]=a(""),g=r((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);s((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var o;!Number.isFinite(i)||i<0||(e||d((o=i)<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)}KB`:o<1073741824?`${(o/1048576).toFixed(1)}MB`:`${(o/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[t.content]);const p=c?`${c} - ${P[i.language]?.download}`:P[i.language]?.download;return e(B,{isMyMessage:l,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(j,{href:t.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:l,children:n(G,{isMyMessage:l,children:[e(J,{children:e(H,{})}),n(U,{children:[e(V,{children:g}),e(K,{children:p})]})]})})})},image:({message:n,config:t,onReply:i})=>{const o=t.isAgent===n.isAgent;return e(B,{className:"bc-mediaMessage",isMyMessage:o,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent;return e(B,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(Q,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:n(W,{children:[e(O,{color:"000000"}),e(Y,{children:"Open location"})]})})})},text:z,video:T,audio:T,interactive:null,template:({message:t,config:i,onReply:o})=>{const a=r((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),s=i.isAgent===t.isAgent;return n(B,{isMyMessage:s,createdAt:t.createdAt,message:t,config:i,onReply:o,children:[e("b",{children:"Template message:"})," ",a.name," ",a.language?.code?`/ ${a.language.code}`:null]})},note:({message:t})=>{const i=p(t.content);return n(q,{children:[e(X,{language:i,children:t.content})," ",e(v,{createdAt:t.createdAt})]})},button:z};function _(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}_('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const ee=c.i`
173
+ `,$={document:({message:t,config:i,onReply:o})=>{const l=i.isAgent===t.isAgent,[c,d]=a(""),g=r((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);s((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var o;!Number.isFinite(i)||i<0||(e||d((o=i)<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)}KB`:o<1073741824?`${(o/1048576).toFixed(1)}MB`:`${(o/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[t.content]);const p=c?`${c} - ${P[i.language]?.download}`:P[i.language]?.download;return e(B,{isMyMessage:l,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(j,{href:t.content,target:"_blank",download:g,rel:"noopener noreferrer",isMyMessage:l,children:n(G,{isMyMessage:l,children:[e(J,{children:e(H,{})}),n(V,{children:[e(U,{children:g}),e(K,{children:p})]})]})})})},image:({message:n,config:t,onReply:i})=>{const o=t.isAgent===n.isAgent;return e(B,{className:"bc-mediaMessage",isMyMessage:o,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:t,config:i,onReply:o})=>{const a=i.isAgent===t.isAgent;return e(B,{isMyMessage:a,createdAt:t.createdAt,message:t,config:i,onReply:o,children:e(Q,{href:"https://www.google.com/maps/?q="+t.content,target:"_blank",rel:"noopener noreferrer",children:n(W,{children:[e(O,{color:"000000"}),e(Y,{children:"Open location"})]})})})},text:z,video:T,audio:T,interactive:null,template:({message:t,config:i,onReply:o})=>{const a=r((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),s=i.isAgent===t.isAgent;return n(B,{isMyMessage:s,createdAt:t.createdAt,message:t,config:i,onReply:o,children:[e("b",{children:"Template message:"})," ",a.name," ",a.language?.code?`/ ${a.language.code}`:null]})},note:({message:t})=>{const i=p(t.content);return n(q,{children:[e(X,{language:i,children:t.content})," ",e(v,{createdAt:t.createdAt})]})},button:z};function _(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}_('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const ee=c.i`
174
174
  background-image: url(${e=>e.avatar||C});
175
175
  width: 30px;
176
176
  height: 30px;
@@ -234,7 +234,7 @@ i {
234
234
  font-size: var(--bc-chat-fontSize-sm);
235
235
  line-height: var(--bc-chat-lineHeight-sm);
236
236
  color: inherit;
237
- `,de=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})}),ge=({sendMessage:i,debug:r,config:c,messages:d,onReachingUp:g,agentsIdsAvatarsMap:p,searchPattern:h,searchMatchNo:u,onSearchMatchCount:m,onMessageReply:b,errorMessage:C})=>{const x=o(null),y=o(0),[v,w]=a(null),[M,A]=a(!0),L=C?.trim();return s((()=>{const e=document.getElementById(f);if(!e)return;y.current=e.scrollHeight;const n=()=>{0===e.scrollTop&&g?.();const n=e.scrollHeight-e.scrollTop-e.clientHeight<=4;A(n)};return e.addEventListener("scroll",n),()=>{e.removeEventListener("scroll",n)}}),[g]),l((()=>{const e=x.current;if(!e)return;const n=y.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),A(!0)}else{const t=e.scrollHeight-n;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+t;const i=4,o=e.scrollHeight-e.scrollTop-e.clientHeight<=i;A(o)}y.current=e.scrollHeight}),[d,L]),s((()=>{if(!h||!h.trim())return w(null),void m?.(0);const e=h.toLowerCase(),n=[];for(const t of d){const i=t&&t.content,o=t&&t.messageId;o&&i&&(String(i).toLowerCase().includes(e)&&n.push(o))}if(m?.(n.length),0===n.length)return void w(null);const t=n[Math.min(Math.max((u??1)-1,0),n.length-1)];w(t);const i=x.current,o=t?document.getElementById(t):null;i&&o&&(i.style.scrollBehavior="smooth",o.scrollIntoView())}),[h,u,d,m]),n(ae,{ref:x,id:f,config:c,children:[d?.map(((n,t)=>"seperator"===n.type?e(oe,{data:n,config:c}):e("div",{children:e(te,{message:n,index:t,sendMessage:i,messageActionsEnabled:d.length-1===t,debug:r,config:c,agentsIdsAvatarsMap:p,highlighted:v===n.messageId,searchPattern:h,onMessageReply:b})},n.messageId?n.messageId:"message"+t))),L&&n(t,{children:[e(oe,{data:{type:"seperator"},config:c}),n(se,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e(le,{children:e(de,{})}),e(ce,{children:L})]})]}),!M&&e(re,{"aria-label":"Scroll to latest message",onClick:()=>{const e=x.current;if(!e)return;const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),A(!0)},children:e("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},f)},pe="text";async function he(e,n,t){const i=new u("https://bcuserres.blob.core.windows.net?sp=rc&st=2024-12-31T17:52:49Z&se=2026-01-01T01:52:49Z&spr=https&sv=2022-11-02&sr=c&sig=ZM%2Fdd4vGMglDs%2F9GtJ8y510iYCcXpUO%2Bj5CvVAq8QDg%3D",new m).getContainerClient("anonymous"),o=new Date,a=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`,r=i.getBlockBlobClient(`${a}/${h()}`);try{await r.uploadBrowserData(e,{onProgress:t=>{const i=Math.round(t.loadedBytes/e.size*100);n(i)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});t(r.url.split("?")[0])}catch(e){t(void 0,"Error uploading file:"+e.message)}}const ue=c.span`
237
+ `,de=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})}),ge=({sendMessage:i,debug:r,config:c,messages:d,onReachingUp:g,agentsIdsAvatarsMap:p,searchPattern:h,searchMatchNo:u,onSearchMatchCount:m,onMessageReply:b,errorMessage:C})=>{const x=o(null),y=o(0),[v,w]=a(null),[M,A]=a(!0),L=C?.trim();return s((()=>{const e=document.getElementById(f);if(!e)return;y.current=e.scrollHeight;const n=()=>{0===e.scrollTop&&g?.();const n=e.scrollHeight-e.scrollTop-e.clientHeight<=4;A(n)};return e.addEventListener("scroll",n),()=>{e.removeEventListener("scroll",n)}}),[g]),l((()=>{const e=x.current;if(!e)return;const n=y.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),A(!0)}else{const t=e.scrollHeight-n;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+t;const i=4,o=e.scrollHeight-e.scrollTop-e.clientHeight<=i;A(o)}y.current=e.scrollHeight}),[d,L]),s((()=>{if(!h||!h.trim())return w(null),void m?.(0);const e=h.toLowerCase(),n=[];for(const t of d){const i=t&&t.content,o=t&&t.messageId;o&&i&&(String(i).toLowerCase().includes(e)&&n.push(o))}if(m?.(n.length),0===n.length)return void w(null);const t=n[Math.min(Math.max((u??1)-1,0),n.length-1)];w(t);const i=x.current,o=t?document.getElementById(t):null;i&&o&&(i.style.scrollBehavior="smooth",o.scrollIntoView())}),[h,u,d,m]),n(ae,{ref:x,id:f,config:c,children:[d?.map(((n,t)=>"seperator"===n.type?e(oe,{data:n,config:c}):e("div",{children:e(te,{message:n,index:t,sendMessage:i,messageActionsEnabled:d.length-1===t,debug:r,config:c,agentsIdsAvatarsMap:p,highlighted:v===n.messageId,searchPattern:h,onMessageReply:b})},n.messageId?n.messageId:"message"+t))),L&&n(t,{children:[e(oe,{data:{type:"seperator"},config:c}),n(se,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e(le,{children:e(de,{})}),e(ce,{children:L})]})]}),!M&&e(re,{"aria-label":"Scroll to latest message",onClick:()=>{const e=x.current;if(!e)return;const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),A(!0)},children:e("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},f)},pe="text";async function he(e,n,t){const i=new u("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new m).getContainerClient("anonymous"),o=new Date,a=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`,r=i.getBlockBlobClient(`${a}/${h()}`);try{await r.uploadBrowserData(e,{onProgress:t=>{const i=Math.round(t.loadedBytes/e.size*100);n(i)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});t(r.url.split("?")[0])}catch(e){t(void 0,"Error uploading file:"+e.message)}}const ue=c.span`
238
238
  cursor: pointer;
239
239
  width: 20px;
240
240
  height: 20px;
@@ -279,12 +279,12 @@ i {
279
279
  justify-content: center;
280
280
 
281
281
  ${e=>e.isRTL&&"\n svg {\n transform: scaleX(-1);\n }\n "}
282
- `,Ee=({isRTL:n})=>e(Ie,{isRTL:n,children:e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),Re=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),Fe={sampleRate:48e3,channelCount:1,sampleSize:128,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,googEchoCancellation:!0,googAutoGainControl:!0,googNoiseSuppression:!0,googHighpassFilter:!0,googTypingNoiseDetection:!0,googAudioMirroring:!1},De=c.div`
282
+ `,Ee=({isRTL:n})=>e(Ie,{isRTL:n,children:e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:"#666",fillRule:"evenodd",clipRule:"evenodd"})})}),Re=()=>e("svg",{width:"18",height:"18",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}),Fe={sampleRate:48e3,channelCount:1,sampleSize:128,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,googEchoCancellation:!0,googAutoGainControl:!0,googNoiseSuppression:!0,googHighpassFilter:!0,googTypingNoiseDetection:!0,googAudioMirroring:!1},Se=c.div`
283
283
  display: flex;
284
284
  align-items: center;
285
285
  gap: 5px;
286
286
  direction: ${e=>e.isRTL?"rtl":"ltr"};
287
- `,Se=({setProgress:r,setError:l,setFile:c,onActiveChange:d,config:g})=>{const p="AR"===g?.language,[h,u]=a(!1),[m,b]=a(0),C=o(null),x=o(null),f=o(null),y=o(null),v=o(null),w=o(null);s((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/mic-recorder-to-mp3",e.async=!0,e.onload=()=>console.log("Voice recording library loaded successfully"),e.onerror=()=>{console.error("Failed to load voice recording library"),l("Failed to load voice recording library. Please refresh the page.")},document.body.appendChild(e),()=>{document.body.contains(e)&&document.body.removeChild(e)}}),[l]);const M=i((e=>{try{if(!e.active)return void navigator.mediaDevices.getUserMedia({audio:Fe}).then((e=>{x.current=e,M(e)})).catch((e=>{console.error("Failed to get fresh stream:",e)}));f.current=new(window.AudioContext||window.webkitAudioContext),"suspended"===f.current.state&&f.current.resume().then((()=>{}));const n=f.current.createMediaStreamSource(e);y.current=f.current.createAnalyser(),y.current.fftSize=256,y.current.smoothingTimeConstant=.8,y.current.minDecibels=-90,y.current.maxDecibels=-10,n.connect(y.current);const t=y.current.frequencyBinCount;v.current=new Uint8Array(t);const i=()=>{if(!y.current)return;y.current.getByteFrequencyData(v.current);let e=0;for(let n=0;n<t;n++)e+=v.current[n]*v.current[n];const n=Math.sqrt(e/t),o=Math.min(255,2*n);b(o),w.current=requestAnimationFrame(i)};i()}catch(e){console.error("Audio level monitoring error:",e)}}),[]),A=i((()=>{w.current&&(cancelAnimationFrame(w.current),w.current=null),f.current&&(f.current.close(),f.current=null),b(0)}),[]),L=i((()=>{x.current&&(x.current.getTracks().forEach((e=>{e.stop()})),x.current=null)}),[]);s((()=>()=>{C.current&&h&&C.current.stop(),L(),A()}),[h,A,L]);const k=i((()=>{if(!C.current){if("function"!=typeof MicRecorder)return void l("Please wait a little until voice library is loaded");C.current=new MicRecorder({bitRate:128,sampleRate:48e3})}l(void 0),h?C.current.stop().getMp3().then((([e,n])=>{if(u(!1),A(),L(),d&&d(!0),n.size<1e3)return void l("Recording seems too short. Please try again.");if(!n||0===n.size)return void l("Invalid audio recording. Please try again.");const t=(new Date).toISOString().replace(/[:.]/g,"-"),i=new File([n],`recording-${t}.mp3`,{type:"audio/mpeg"}),o=URL.createObjectURL(i);c({fileUrl:o,fileName:`recording-${t}.mp3`,extension:"mp3",blob:i}),d&&d(!1)})).catch((e=>{u(!1),A(),L(),l(`Recording failed: ${e.message}`),d&&d(!1)})):navigator.mediaDevices.getUserMedia({audio:Fe}).then((e=>{x.current=e,C.current.start().then((()=>{u(!0),d&&d(!0),setTimeout((()=>{f.current&&"suspended"===f.current.state?f.current.resume().then((()=>{M(e)})).catch((n=>{console.error("Failed to resume audio context:",n),M(e)})):M(e)}),100)})).catch((n=>{l(`Failed to start recording: ${n.message}`),e.getTracks().forEach((e=>e.stop())),d&&d(!1)}))})).catch((e=>{"NotAllowedError"===e.name?l("Microphone access denied. Please allow microphone access and try again."):"NotFoundError"===e.name?l("No microphone found. Please connect a microphone and try again."):l(`Microphone error: ${e.message}`),d&&d(!1)}))}),[h,l,c,M,A,L,d]),I=i((()=>{C.current&&h&&C.current.stop(),u(!1),A(),L(),l(void 0),d&&d(!1)}),[h,A,L,l,d]);return n(De,{isRTL:p&&h,children:[h?e(Ae,{onClick:I,children:e(Re,{})}):null,e(Ae,{onClick:k,id:"voiceRecorderIcon",className:"mic-container",children:h?n(t,{children:[e(Ee,{isRTL:p}),e(ke,{className:"circle "+(h?"active":""),isRecording:h,audioLevel:m})]}):e(Le,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const Be=c.i`
287
+ `,De=({setProgress:r,setError:l,setFile:c,onActiveChange:d,config:g})=>{const p="AR"===g?.language,[h,u]=a(!1),[m,b]=a(0),C=o(null),x=o(null),f=o(null),y=o(null),v=o(null),w=o(null);s((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/mic-recorder-to-mp3",e.async=!0,e.onload=()=>console.log("Voice recording library loaded successfully"),e.onerror=()=>{console.error("Failed to load voice recording library"),l("Failed to load voice recording library. Please refresh the page.")},document.body.appendChild(e),()=>{document.body.contains(e)&&document.body.removeChild(e)}}),[l]);const M=i((e=>{try{if(!e.active)return void navigator.mediaDevices.getUserMedia({audio:Fe}).then((e=>{x.current=e,M(e)})).catch((e=>{console.error("Failed to get fresh stream:",e)}));f.current=new(window.AudioContext||window.webkitAudioContext),"suspended"===f.current.state&&f.current.resume().then((()=>{}));const n=f.current.createMediaStreamSource(e);y.current=f.current.createAnalyser(),y.current.fftSize=256,y.current.smoothingTimeConstant=.8,y.current.minDecibels=-90,y.current.maxDecibels=-10,n.connect(y.current);const t=y.current.frequencyBinCount;v.current=new Uint8Array(t);const i=()=>{if(!y.current)return;y.current.getByteFrequencyData(v.current);let e=0;for(let n=0;n<t;n++)e+=v.current[n]*v.current[n];const n=Math.sqrt(e/t),o=Math.min(255,2*n);b(o),w.current=requestAnimationFrame(i)};i()}catch(e){console.error("Audio level monitoring error:",e)}}),[]),A=i((()=>{w.current&&(cancelAnimationFrame(w.current),w.current=null),f.current&&(f.current.close(),f.current=null),b(0)}),[]),L=i((()=>{x.current&&(x.current.getTracks().forEach((e=>{e.stop()})),x.current=null)}),[]);s((()=>()=>{C.current&&h&&C.current.stop(),L(),A()}),[h,A,L]);const k=i((()=>{if(!C.current){if("function"!=typeof MicRecorder)return void l("Please wait a little until voice library is loaded");C.current=new MicRecorder({bitRate:128,sampleRate:48e3})}l(void 0),h?C.current.stop().getMp3().then((([e,n])=>{if(u(!1),A(),L(),d&&d(!0),n.size<1e3)return void l("Recording seems too short. Please try again.");if(!n||0===n.size)return void l("Invalid audio recording. Please try again.");const t=(new Date).toISOString().replace(/[:.]/g,"-"),i=new File([n],`recording-${t}.mp3`,{type:"audio/mpeg"}),o=URL.createObjectURL(i);c({fileUrl:o,fileName:`recording-${t}.mp3`,extension:"mp3",blob:i}),d&&d(!1)})).catch((e=>{u(!1),A(),L(),l(`Recording failed: ${e.message}`),d&&d(!1)})):navigator.mediaDevices.getUserMedia({audio:Fe}).then((e=>{x.current=e,C.current.start().then((()=>{u(!0),d&&d(!0),setTimeout((()=>{f.current&&"suspended"===f.current.state?f.current.resume().then((()=>{M(e)})).catch((n=>{console.error("Failed to resume audio context:",n),M(e)})):M(e)}),100)})).catch((n=>{l(`Failed to start recording: ${n.message}`),e.getTracks().forEach((e=>e.stop())),d&&d(!1)}))})).catch((e=>{"NotAllowedError"===e.name?l("Microphone access denied. Please allow microphone access and try again."):"NotFoundError"===e.name?l("No microphone found. Please connect a microphone and try again."):l(`Microphone error: ${e.message}`),d&&d(!1)}))}),[h,l,c,M,A,L,d]),I=i((()=>{C.current&&h&&C.current.stop(),u(!1),A(),L(),l(void 0),d&&d(!1)}),[h,A,L,l,d]);return n(Se,{isRTL:p&&h,children:[h?e(Ae,{onClick:I,children:e(Re,{})}):null,e(Ae,{onClick:k,id:"voiceRecorderIcon",className:"mic-container",children:h?n(t,{children:[e(Ee,{isRTL:p}),e(ke,{className:"circle "+(h?"active":""),isRecording:h,audioLevel:m})]}):e(Le,{activeColor:"var(--bc-chat-text-secondary-dark)"})})]})};const Be=c.i`
288
288
  ${e=>we('url("data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10%2019.084C15.0163%2019.0838%2019.0838%2015.0163%2019.084%2010C19.0838%204.98367%2015.0163%200.917168%2010%200.916992C4.98367%200.917168%200.917168%204.98367%200.916992%2010C0.917168%2015.0163%204.98367%2019.0838%2010%2019.084ZM10%2017.584C5.8121%2017.5838%202.41717%2014.1879%202.41699%2010C2.41717%205.8121%205.8121%202.41717%2010%202.41699C14.1879%202.41717%2017.5838%205.8121%2017.584%2010C17.5838%2014.1879%2014.1879%2017.5838%2010%2017.584ZM6.6748%208.5C7.22679%208.49964%207.6748%208.05206%207.6748%207.5C7.6748%206.94794%207.22679%206.50036%206.6748%206.5H6.66699C6.11471%206.5%205.66699%206.94771%205.66699%207.5C5.66699%208.05229%206.11471%208.5%206.66699%208.5H6.6748ZM13.334%208.5C13.886%208.49965%2014.334%208.05207%2014.334%207.5C14.334%206.94793%2013.886%206.50035%2013.334%206.5H13.3262C12.7739%206.50001%2012.3262%206.94772%2012.3262%207.5C12.3262%208.05228%2012.7739%208.49999%2013.3262%208.5H13.334ZM10%2014.917C11.6088%2014.9169%2013.038%2014.1426%2013.9336%2012.9502C14.1819%2012.6191%2014.115%2012.1491%2013.7842%2011.9004C13.453%2011.6517%2012.9832%2011.7188%2012.7344%2012.0498C12.1099%2012.8813%2011.117%2013.4169%2010%2013.417C8.88307%2013.4169%207.89111%2012.8811%207.2666%2012.0498C7.01792%2011.7187%206.54798%2011.6519%206.2168%2011.9004C5.88563%2012.1491%205.81871%2012.619%206.06738%2012.9502C6.96298%2014.1425%208.39126%2014.9169%2010%2014.917Z%22%20fill%3D%22%23161616%22%2F%3E%3C%2Fsvg%3E");',e)}
289
289
  `,ze=c.span`
290
290
  margin: 8px;
@@ -311,7 +311,7 @@ i {
311
311
  cursor: pointer;
312
312
  display: block;
313
313
  }
314
- `,je=({setView:i,setFile:o,setProgress:r,setError:s,text:l,setText:c,send:d,config:g})=>{const[p,h]=a(!1),[u,m]=a(!1);return n("div",{className:"bc-inputActions",id:"bc-inputActions",children:[n(He,{id:"iconsContainer",isRTL:"AR"===g?.language,children:[u?null:n(t,{children:[e(Pe,{setFile:o,setProgress:r,setError:s}),e(Ne,{onClick:()=>h(!0)})]}),e(Se,{setFile:o,setError:s,setProgress:r,onActiveChange:e=>{m(e),e&&h(!1)},config:g})]}),p?e(Ze,{text:l,setText:c,onClick:()=>h(!1)}):null]})};_('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const Ge=c.div`
314
+ `,je=({setView:i,setFile:o,setProgress:r,setError:s,text:l,setText:c,send:d,config:g})=>{const[p,h]=a(!1),[u,m]=a(!1);return n("div",{className:"bc-inputActions",id:"bc-inputActions",children:[n(He,{id:"iconsContainer",isRTL:"AR"===g?.language,children:[u?null:n(t,{children:[e(Pe,{setFile:o,setProgress:r,setError:s}),e(Ne,{onClick:()=>h(!0)})]}),e(De,{setFile:o,setError:s,setProgress:r,onActiveChange:e=>{m(e),e&&h(!1)},config:g})]}),p?e(Ze,{text:l,setText:c,onClick:()=>h(!1)}):null]})};_('.bc-trademark {\n height: 40px;\n width: 100%;\n box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.1);\n background-color: #fff;\n overflow-y: hidden;\n border-bottom-left-radius: 15px;\n border-bottom-right-radius: 15px;\n padding: 15px 0;\n}\n\n.bc-messageInput {\n min-height: 30px;\n max-height: 100%;\n background-color: #fff;\n overflow-y: hidden;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.bc-messageInput .bc-messageInputTextArea {\n color: var(--bc-chat-text-secondary-dark);\n display: block;\n min-height: 36px;\n background-color: #fff;\n box-sizing: border-box;\n font-family: var(--bc-chat-font-stack);\n font-size: var(--bc-chat-fontSize-md);\n padding: 10px 0;\n resize: none;\n overflow: auto;\n border-width: 0;\n width: calc(100% - 20px);\n word-wrap: break-word;\n border: none;\n overflow: hidden;\n outline: none;\n -webkit-box-shadow: none;\n -moz-box-shadow: none;\n box-shadow: none;\n}\n.bc-messageInput.bc-RTL {\n direction: rtl;\n}\n\n.bc-inputActions {\n display: flex;\n align-items: center;\n position: relative;\n width: fit-content;\n height: 36px;\n margin-left: auto;\n}\n.bc-inputActions .bc-fileUpload {\n display: none;\n}\n.bc-inputActions i {\n display: block;\n margin: 0 5px;\n}\n.bc-inputActions.bc-RTL {\n direction: rtl;\n}\n\n.bc-ActionChips {\n display: flex;\n gap: 10px;\n}\n\n.bc-BottomBar {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-top: 8px;\n}\n.bc-BottomBar.bc-RTL {\n direction: rtl;\n}\n\n.bc-CommandsArea {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n.bc-CommandsArea.bc-RTL {\n margin-left: 0;\n margin-right: auto;\n direction: rtl;\n}\n\n.bc-emojiPicker {\n position: absolute;\n bottom: 40px;\n right: 0;\n width: 200px;\n background: var(--bc-chat-white-color) 0% 0% no-repeat padding-box;\n box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1019607843);\n border-radius: 10px;\n opacity: 1;\n padding: 10px;\n z-index: 10;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n}\n[dir=rtl] .bc-emojiPicker, .bc-RTL .bc-emojiPicker {\n right: auto;\n left: 0;\n}\n\n.bc-uploadFileDetails {\n background-color: transparent;\n display: flex;\n align-items: center;\n width: calc(100% - 60px);\n height: 40px;\n padding: 4px 10px;\n}\n.bc-uploadFileDetails.bc-RTL {\n direction: rtl;\n}\n.bc-uploadFileDetails audio {\n width: 260px;\n}\n.bc-uploadFileDetails .bc-uploadedFile {\n max-width: 32px;\n max-height: 32px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-imageFile {\n max-width: 100%;\n max-height: 100%;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadedFile .bc-documentFile {\n max-width: 100%;\n max-height: 100%;\n margin-top: 4px;\n min-width: 25px;\n min-height: 25px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileName span {\n padding: 10px;\n pointer-events: none;\n}\n.bc-uploadFileDetails .bc-uploadFileCancel {\n cursor: pointer;\n margin-bottom: -6px;\n margin-left: 6px;\n color: var(--bc-chat-danger-color);\n}\n[dir=rtl] .bc-uploadFileDetails .bc-uploadFileCancel, .bc-RTL .bc-uploadFileDetails .bc-uploadFileCancel {\n margin-left: 0;\n margin-right: 6px;\n}\n\n.mic-container {\n position: relative;\n}\n.mic-container svg {\n z-index: 5;\n}\n.mic-container i {\n transition: 0.9s;\n z-index: 10;\n position: relative;\n}\n.mic-container .circle {\n z-index: 4;\n top: 3px;\n left: 3px;\n position: absolute;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1;\n transition: 0.5s;\n}\n.mic-container .circle:before {\n content: "";\n width: 36px;\n height: 36px;\n border-radius: 50%;\n opacity: 0.5;\n z-index: 3;\n position: absolute;\n}\n.mic-container .circle.active {\n background-color: #A8E6A3;\n}\n.mic-container .circle.active:before {\n background: #A8E6A3;\n}\n\n@keyframes bounce {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(1.4);\n }\n 75% {\n transform: scale(1);\n }\n 100% {\n transform: scale(1.3);\n }\n}');const Ge=c.div`
315
315
  display: flex;
316
316
  padding: 8px 16px 16px 16px;
317
317
  flex-direction: column;
@@ -345,14 +345,14 @@ i {
345
345
  gap: 4px;
346
346
  flex: 1 0 0;
347
347
  border-bottom: 1px solid var(--bc-border-neutral-secondary, #E5E7EB);
348
- `,Ue=c.div`
348
+ `,Ve=c.div`
349
349
  display: flex;
350
350
  align-items: center;
351
351
  justify-content: space-between;
352
352
  gap: 8px;
353
353
  direction: ${({isRTL:e})=>e?"rtl":"ltr"};
354
354
 
355
- `,Ve=c.span`
355
+ `,Ue=c.span`
356
356
  font-weight: 500;
357
357
  font-size: var(--bc-chat-fontSize-sm);
358
358
  line-height: var(--bc-chat-lineHeight-sm);
@@ -386,7 +386,7 @@ i {
386
386
  color: #111827;
387
387
  outline: none;
388
388
  }
389
- `,We=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Ye=({config:t,sendMessage:o,setView:s,actionChips:l,noteMode:c,onNoteSend:d,onCloseNoteMode:g,notePlaceholder:p,replyMessageTitle:h,replyMessageContent:u,onCancelReplyMessage:m})=>{const C="AR"===t?.language,[x,f]=a(),[y,v]=a(),[w,M]=a(),[A,L]=a(0),k=r((()=>Boolean(h||u)),[h,u]),I=r((()=>h||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,h]),E=r((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),R=i((e=>{if(c){const e=(x||"").trim();return d&&d(e),void f("")}const n=e=>{const{fileUrl:n,extension:t}=e;o(b.SupportedImageFormats.indexOf(t)>=0?"image":b.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?he(e.blob,L,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&M(i)})):n(e):y?y.blob&&y.fileUrl.startsWith("blob:")?he(y.blob,L,((e,t)=>{if(e){try{URL.revokeObjectURL(y.fileUrl)}catch{}n({...y,fileUrl:e,blob:void 0}),v(void 0)}else t&&M(t)})):(n(y),v(void 0)):(o(pe,x),f(""))}),[y,x,o,c,d]);return n(Ge,{isRTL:C,children:[k?n(Je,{isRTL:C,children:[n(Ue,{isRTL:C,children:[I?e(Ve,{children:I}):null,m?e(Qe,{type:"button",onClick:m,"aria-label":E,title:E,children:e(We,{})}):null]}),u?e(Ke,{children:u}):null]}):null,e("div",{className:"bc-InputArea",children:e(ve,{config:t,send:R,text:x,setText:f,file:c?void 0:y,isFileSelected:!!y,cancelFileUpload:()=>v(void 0),noteMode:c,onCloseNoteMode:()=>{f(""),g?.()},notePlaceholder:p})}),n("div",{className:"bc-BottomBar "+(C?"bc-RTL":""),children:[void 0!==l?l:null,e("div",{className:"bc-CommandsArea "+(C?"bc-RTL":""),children:c?null:e(je,{setView:s,setFile:v,setProgress:L,setError:M,setText:f,text:x,send:R,config:t})})]}),w?e("div",{className:"bc-uploadFileError",children:w}):null]})},Oe="bc-chat-header-banner",qe=390,Xe=c.div`
389
+ `,We=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Ye=({config:t,sendMessage:o,setView:s,actionChips:l,noteMode:c,onNoteSend:d,onCloseNoteMode:g,notePlaceholder:p,replyMessageTitle:h,replyMessageContent:u,onCancelReplyMessage:m})=>{const C="AR"===t?.language,[x,f]=a(),[y,v]=a(),[w,M]=a(),[A,L]=a(0),k=r((()=>Boolean(h||u)),[h,u]),I=r((()=>h||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,h]),E=r((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),R=i((e=>{if(c){const e=(x||"").trim();return d&&d(e),void f("")}const n=e=>{const{fileUrl:n,extension:t}=e;o(b.SupportedImageFormats.indexOf(t)>=0?"image":b.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?he(e.blob,L,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&M(i)})):n(e):y?y.blob&&y.fileUrl.startsWith("blob:")?he(y.blob,L,((e,t)=>{if(e){try{URL.revokeObjectURL(y.fileUrl)}catch{}n({...y,fileUrl:e,blob:void 0}),v(void 0)}else t&&M(t)})):(n(y),v(void 0)):(o(pe,x),f(""))}),[y,x,o,c,d]);return n(Ge,{isRTL:C,children:[k?n(Je,{isRTL:C,children:[n(Ve,{isRTL:C,children:[I?e(Ue,{children:I}):null,m?e(Qe,{type:"button",onClick:m,"aria-label":E,title:E,children:e(We,{})}):null]}),u?e(Ke,{children:u}):null]}):null,e("div",{className:"bc-InputArea",children:e(ve,{config:t,send:R,text:x,setText:f,file:c?void 0:y,isFileSelected:!!y,cancelFileUpload:()=>v(void 0),noteMode:c,onCloseNoteMode:()=>{f(""),g?.()},notePlaceholder:p})}),n("div",{className:"bc-BottomBar "+(C?"bc-RTL":""),children:[void 0!==l?l:null,e("div",{className:"bc-CommandsArea "+(C?"bc-RTL":""),children:c?null:e(je,{setView:s,setFile:v,setProgress:L,setError:M,setText:f,text:x,send:R,config:t})})]}),w?e("div",{className:"bc-uploadFileError",children:w}):null]})},Oe="bc-chat-header-banner",qe=390,Xe=c.div`
390
390
  ${e=>e.bannerWidth>qe?"height: 60px;":"height: 90px;"}
391
391
  display: block;
392
392
  width: 100%;
package/build/index.js CHANGED
@@ -141,12 +141,12 @@ i {
141
141
  &:hover {
142
142
  opacity: 0.8;
143
143
  }
144
- `,U=c.default.div`
144
+ `,V=c.default.div`
145
145
  display: flex;
146
146
  flex-direction: row;
147
147
  align-items: center;
148
148
  gap: 5px;
149
- `,V=c.default.span`
149
+ `,U=c.default.span`
150
150
  color: inherit;
151
151
  `;const K=c.default.i`
152
152
  background-image: ${e=>`url("data:image/svg+xml,%3Csvg%20width%3D%2215%22%20height%3D%2215%22%20viewBox%3D%220%200%2015%2015%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9.62129%201.13607C9.81656%200.940808%2010.1331%200.940809%2010.3284%201.13607L11.3891%202.19673L12.8033%203.61094L13.8639%204.6716C14.0592%204.86687%2014.0592%205.18345%2013.8639%205.37871C13.6687%205.57397%2013.3521%205.57397%2013.1568%205.37871L12.5038%204.7257L8.86727%209.57443L9.97485%2010.682C10.1701%2010.8773%2010.1701%2011.1939%209.97485%2011.3891C9.77959%2011.5844%209.463%2011.5844%209.26774%2011.3891L7.85353%209.97491L6.79287%208.91425L3.5225%2012.1846C3.32724%2012.3799%203.01065%2012.3799%202.81539%2012.1846C2.62013%2011.9894%202.62013%2011.6728%202.81539%2011.4775L6.08576%208.20714L5.0251%207.14648L3.61089%205.73226C3.41563%205.537%203.41562%205.22042%203.61089%205.02516C3.80615%204.8299%204.12273%204.8299%204.31799%205.02516L5.42557%206.13274L10.2743%202.49619L9.62129%201.84318C9.42603%201.64792%209.42603%201.33133%209.62129%201.13607Z%22%20fill%3D%22currentColor%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M9.62129%201.13607C9.81656%200.940808%2010.1331%200.940809%2010.3284%201.13607L11.3891%202.19673L12.8033%203.61094L13.8639%204.6716C14.0592%204.86687%2014.0592%205.18345%2013.8639%205.37871C13.6687%205.57397%2013.3521%205.57397%2013.1568%205.37871L12.5038%204.7257L8.86727%209.57443L9.97485%2010.682C10.1701%2010.8773%2010.1701%2011.1939%209.97485%2011.3891C9.77959%2011.5844%209.463%2011.5844%209.26774%2011.3891L7.85353%209.97491L6.79287%208.91425L3.5225%2012.1846C3.32724%2012.3799%203.01065%2012.3799%202.81539%2012.1846C2.62013%2011.9894%202.62013%2011.6728%202.81539%2011.4775L6.08576%208.20714L5.0251%207.14648L3.61089%205.73226C3.41563%205.537%203.41562%205.22042%203.61089%205.02516C3.80615%204.8299%204.12273%204.8299%204.31799%205.02516L5.42557%206.13274L10.2743%202.49619L9.62129%201.84318C9.42603%201.64792%209.42603%201.33133%209.62129%201.13607Z%22%20fill%3D%22%23${e.color}%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E")`};
@@ -170,7 +170,7 @@ i {
170
170
  max-width: 60%;
171
171
  `,W=c.default.span`
172
172
  direction: ${e=>"arb"===e.language?"rtl":"ltr"};
173
- `,Y={document:({message:t,config:i,onReply:a})=>{const o=i.isAgent===t.isAgent,[r,s]=n.useState(""),l=n.useMemo((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);n.useEffect((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var a;!Number.isFinite(i)||i<0||(e||s((a=i)<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)}KB`:a<1073741824?`${(a/1048576).toFixed(1)}MB`:`${(a/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[t.content]);const c=r?`${r} - ${B[i.language]?.download}`:B[i.language]?.download;return e.jsx(E,{isMyMessage:o,createdAt:t.createdAt,message:t,config:i,onReply:a,children:e.jsx(N,{href:t.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:o,children:e.jsxs(Z,{isMyMessage:o,children:[e.jsx(T,{children:e.jsx(z,{})}),e.jsxs(P,{children:[e.jsx(H,{children:l}),e.jsx(G,{children:c})]})]})})})},image:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(E,{className:"bc-mediaMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e.jsx("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(E,{isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,children:e.jsx(J,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(U,{children:[e.jsx(K,{color:"000000"}),e.jsx(V,{children:"Open location"})]})})})},text:R,video:D,audio:D,interactive:null,template:({message:t,config:i,onReply:a})=>{const o=n.useMemo((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return e.jsxs(E,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:a,children:[e.jsx("b",{children:"Template message:"})," ",o.name," ",o.language?.code?`/ ${o.language.code}`:null]})},note:({message:n})=>{const t=o.franc(n.content);return e.jsxs(Q,{children:[e.jsx(W,{language:t,children:n.content})," ",e.jsx(x,{createdAt:n.createdAt})]})},button:R};function O(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}O('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const q=c.default.i`
173
+ `,Y={document:({message:t,config:i,onReply:a})=>{const o=i.isAgent===t.isAgent,[r,s]=n.useState(""),l=n.useMemo((()=>{try{const e=(t.content||"").split("/");return decodeURIComponent(e[e.length-1]||"file")}catch{return"file"}}),[t.content]);n.useEffect((()=>{let e=!1;const n=t.content;if(n){try{new URL(n)}catch{return}return fetch(n,{method:"HEAD"}).then((n=>{if(!n.ok)return;const t=n.headers.get("content-length");if(!t)return;const i=Number(t);var a;!Number.isFinite(i)||i<0||(e||s((a=i)<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)}KB`:a<1073741824?`${(a/1048576).toFixed(1)}MB`:`${(a/1073741824).toFixed(1)}GB`))})).catch((e=>{console.debug("Failed to fetch file size:",e)})),()=>{e=!0}}}),[t.content]);const c=r?`${r} - ${B[i.language]?.download}`:B[i.language]?.download;return e.jsx(E,{isMyMessage:o,createdAt:t.createdAt,message:t,config:i,onReply:a,children:e.jsx(N,{href:t.content,target:"_blank",download:l,rel:"noopener noreferrer",isMyMessage:o,children:e.jsxs(Z,{isMyMessage:o,children:[e.jsx(T,{children:e.jsx(z,{})}),e.jsxs(P,{children:[e.jsx(H,{children:l}),e.jsx(G,{children:c})]})]})})})},image:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(E,{className:"bc-mediaMessage",isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,isMedia:!0,children:e.jsx("a",{href:n.content,target:"_blank",rel:"noreferrer",children:e.jsx("img",{src:n.content,alt:"message content",style:{width:"100%",height:"auto",borderRadius:"8px"}})})})},location:({message:n,config:t,onReply:i})=>{const a=t.isAgent===n.isAgent;return e.jsx(E,{isMyMessage:a,createdAt:n.createdAt,message:n,config:t,onReply:i,children:e.jsx(J,{href:"https://www.google.com/maps/?q="+n.content,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(V,{children:[e.jsx(K,{color:"000000"}),e.jsx(U,{children:"Open location"})]})})})},text:R,video:D,audio:D,interactive:null,template:({message:t,config:i,onReply:a})=>{const o=n.useMemo((()=>{try{return JSON.parse(t.content)}catch(e){return void console.log(e.message)}}),[t]),r=i.isAgent===t.isAgent;return e.jsxs(E,{isMyMessage:r,createdAt:t.createdAt,message:t,config:i,onReply:a,children:[e.jsx("b",{children:"Template message:"})," ",o.name," ",o.language?.code?`/ ${o.language.code}`:null]})},note:({message:n})=>{const t=o.franc(n.content);return e.jsxs(Q,{children:[e.jsx(W,{language:t,children:n.content})," ",e.jsx(x,{createdAt:n.createdAt})]})},button:R};function O(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}O('/* Shared styles between agent and client messages */\n.bc-otherMessage,\n.bc-myMessage {\n margin: 24px;\n font-size: var(--bc-chat-fontSize-sm);\n line-height: var(--bc-chat-lineHeight-sm);\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 12px;\n}\n.bc-otherMessage div p,\n.bc-myMessage div p {\n padding: 0;\n margin: 0;\n}\n\n/* Styles for agent messages */\n.bc-otherMessage {\n justify-content: flex-start;\n}\n.bc-otherMessage:first-child {\n flex: 1 0 50%;\n}\n.bc-otherMessage > :nth-child(2) {\n flex: 0 1 auto;\n max-width: 85%;\n}\n\n/* Styles for other messages */\n.bc-note {\n text-align: center;\n gap: 5px;\n}\n\n.bc-myMessage {\n justify-content: flex-end;\n}\n.bc-myMessage > div:not(.bc-debugCon),\n.bc-myMessage .bc-locationMessage,\n.bc-myMessage audio {\n color: #fff;\n}\n.bc-myMessage svg path:nth-child(2) {\n fill: #fff;\n}\n\n.bc-mediaMessage {\n position: relative;\n max-width: 300px !important;\n}\n.bc-mediaMessage audio,\n.bc-mediaMessage video,\n.bc-mediaMessage img {\n max-width: 100%;\n}\n.bc-mediaMessage audio {\n -webkit-appearance: none;\n -webkit-border-radius: 0;\n border-radius: 0;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n background-color: transparent;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n color: inherit;\n}\n.bc-mediaMessage audio {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n height: 40px !important;\n width: 100% !important;\n max-width: 400px !important;\n position: static !important;\n -webkit-appearance: none !important;\n -webkit-border-radius: 0 !important;\n border-radius: 0 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls {\n display: flex !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-panel {\n display: flex !important;\n visibility: visible !important;\n background-color: #f0f0f0 !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-play-button {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-timeline {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-volume-slider {\n display: block !important;\n visibility: visible !important;\n opacity: 1 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-current-time-display, .bc-mediaMessage audio::-webkit-media-controls-time-remaining-display {\n display: block !important;\n visibility: visible !important;\n color: #000 !important;\n}\n.bc-mediaMessage audio::-webkit-media-controls-mute-button {\n display: block !important;\n visibility: visible !important;\n}\n\n.bc-mediaMessage.audio {\n width: 320px;\n height: 64px !important;\n}\n\n/* Custom audio player */\n.bc-audioPlayer {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 300px;\n position: relative;\n height: 50px;\n justify-self: flex-start;\n}\n\n.bc-audioPlayer audio {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.bc-audioPlayer__button {\n flex: 0 0 auto;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background: var(--bc-chat-white-color);\n position: relative;\n cursor: pointer;\n}\n\n.bc-otherMessage .bc-audioPlayer__button {\n background: #16616C;\n}\n\n.bc-audioPlayer__button.play::before {\n content: "";\n position: absolute;\n left: 12px;\n top: 12px;\n width: 16px;\n height: 16px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%2316616C%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-otherMessage .bc-audioPlayer__button.play::before {\n background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.23541%202.19233C5.2355%201.62986%204%202.35243%204%203.49968V12.5C4%2013.6472%205.23546%2014.3698%206.23537%2013.8073L14.2356%209.30735C15.2551%208.73391%2015.2551%207.26609%2014.2357%206.69262L6.23541%202.19233Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");\n}\n\n.bc-audioPlayer__button.pause::before,\n.bc-audioPlayer__button.pause::after {\n content: "";\n position: absolute;\n top: 14px;\n width: 3px;\n height: 12px;\n background: #16616C;\n}\n\n.bc-otherMessage .bc-audioPlayer__button.pause::before,\n.bc-otherMessage .bc-audioPlayer__button.pause::after {\n background: var(--bc-chat-white-color);\n}\n\n.bc-audioPlayer__button.pause::before {\n left: 16px;\n}\n\n.bc-audioPlayer__button.pause::after {\n right: 16px;\n}\n\n.bc-audioPlayer__wave {\n position: relative;\n flex: 1 1 auto;\n height: 22px;\n cursor: pointer;\n}\n\n.bc-audioPlayer__wave--future,\n.bc-audioPlayer__wave--past {\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n height: 22px;\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 2px;\n column-gap: 1px;\n align-items: end;\n width: 100%;\n pointer-events: none;\n}\n\n.bc-audioPlayer__wave--future span {\n display: block;\n width: 2px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--future span {\n background: #16616C;\n opacity: 0.6;\n}\n\n.bc-audioPlayer__wave--past {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.bc-audioPlayer__wave--past span {\n display: inline-block;\n width: 2px;\n margin-right: 3px;\n background: var(--bc-chat-white-color);\n border-radius: 2px;\n}\n\n.bc-otherMessage .bc-audioPlayer__wave--past span {\n background: #16616C;\n}\n\n.bc-otherMessage:hover .bc-replyButton, .bc-otherMessage:active .bc-replyButton, .bc-myMessage:hover .bc-replyButton, .bc-myMessage:active .bc-replyButton {\n display: block;\n}\n\n.bc-audioPlayer__time {\n color: var(--bc-chat-white-color);\n font-weight: 400;\n opacity: 0.95;\n position: absolute;\n top: 46px;\n left: 80px;\n font-size: 10px;\n}\n\n.bc-otherMessage .bc-audioPlayer__time {\n color: #16616C;\n}\n\n.bc-selectionContainer {\n display: flex;\n align-items: flex-start;\n flex-wrap: wrap;\n}\n\n.bc-selectionContainer:first-child {\n flex: 1 0 50%;\n}\n\n.status-icon {\n color: var(--bc-chat-my-message-text-color) !important;\n opacity: 0.7;\n}\n.status-icon.read {\n color: #33C1FF !important;\n}\n.status-icon.failed {\n color: var(--bc-chat-danger-color) !important;\n}\n.status-icon.failed .resend {\n color: var(--bc-chat-text-secondary-dark) !important;\n cursor: pointer;\n margin: 0 10px;\n}');const q=c.default.i`
174
174
  background-image: url(${e=>e.avatar||u});
175
175
  width: 30px;
176
176
  height: 30px;
@@ -234,7 +234,7 @@ i {
234
234
  font-size: var(--bc-chat-fontSize-sm);
235
235
  line-height: var(--bc-chat-lineHeight-sm);
236
236
  color: inherit;
237
- `,re=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})}),se=({sendMessage:t,debug:i,config:a,messages:o,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p})=>{const u=n.useRef(null),h=n.useRef(0),[b,x]=n.useState(null),[C,f]=n.useState(!0),y=p?.trim();return n.useEffect((()=>{const e=document.getElementById(m);if(!e)return;h.current=e.scrollHeight;const n=()=>{0===e.scrollTop&&r?.();const n=e.scrollHeight-e.scrollTop-e.clientHeight<=4;f(n)};return e.addEventListener("scroll",n),()=>{e.removeEventListener("scroll",n)}}),[r]),n.useLayoutEffect((()=>{const e=u.current;if(!e)return;const n=h.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),f(!0)}else{const t=e.scrollHeight-n;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+t;const i=4,a=e.scrollHeight-e.scrollTop-e.clientHeight<=i;f(a)}h.current=e.scrollHeight}),[o,y]),n.useEffect((()=>{if(!l||!l.trim())return x(null),void d?.(0);const e=l.toLowerCase(),n=[];for(const t of o){const i=t&&t.content,a=t&&t.messageId;a&&i&&(String(i).toLowerCase().includes(e)&&n.push(a))}if(d?.(n.length),0===n.length)return void x(null);const t=n[Math.min(Math.max((c??1)-1,0),n.length-1)];x(t);const i=u.current,a=t?document.getElementById(t):null;i&&a&&(i.style.scrollBehavior="smooth",a.scrollIntoView())}),[l,c,o,d]),e.jsxs(ne,{ref:u,id:m,config:a,children:[o?.map(((n,r)=>"seperator"===n.type?e.jsx(ee,{data:n,config:a}):e.jsx("div",{children:e.jsx($,{message:n,index:r,sendMessage:t,messageActionsEnabled:o.length-1===r,debug:i,config:a,agentsIdsAvatarsMap:s,highlighted:b===n.messageId,searchPattern:l,onMessageReply:g})},n.messageId?n.messageId:"message"+r))),y&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{data:{type:"seperator"},config:a}),e.jsxs(ie,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e.jsx(ae,{children:e.jsx(re,{})}),e.jsx(oe,{children:y})]})]}),!C&&e.jsx(te,{"aria-label":"Scroll to latest message",onClick:()=>{const e=u.current;if(!e)return;const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),f(!0)},children:e.jsx("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},m)},le="text";async function ce(e,n,t){const i=new s.BlobServiceClient("https://bcuserres.blob.core.windows.net?sp=rc&st=2024-12-31T17:52:49Z&se=2026-01-01T01:52:49Z&spr=https&sv=2022-11-02&sr=c&sig=ZM%2Fdd4vGMglDs%2F9GtJ8y510iYCcXpUO%2Bj5CvVAq8QDg%3D",new s.AnonymousCredential).getContainerClient("anonymous"),a=new Date,o=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}`,l=i.getBlockBlobClient(`${o}/${r.v4()}`);try{await l.uploadBrowserData(e,{onProgress:t=>{const i=Math.round(t.loadedBytes/e.size*100);n(i)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});t(l.url.split("?")[0])}catch(e){t(void 0,"Error uploading file:"+e.message)}}const de=c.default.span`
237
+ `,re=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.95833 16.6667C4.70114 16.6667 1.25 13.2155 1.25 8.95833C1.25 4.70114 4.70114 1.25 8.95833 1.25C13.2155 1.25 16.6667 4.70114 16.6667 8.95833C16.6667 13.2155 13.2155 16.6667 8.95833 16.6667ZM0 8.95833C0 13.9059 4.01078 17.9167 8.95833 17.9167C13.9059 17.9167 17.9167 13.9059 17.9167 8.95833C17.9167 4.01078 13.9059 0 8.95833 0C4.01078 0 0 4.01078 0 8.95833ZM8.53419 8.75097C8.47632 8.75004 8.40939 8.75001 8.32682 8.75001C7.98164 8.75001 7.70182 8.47019 7.70182 8.12501C7.70182 7.77984 7.98164 7.50001 8.32682 7.50001L8.35553 7.50001C8.52646 7.49994 8.71128 7.49987 8.8673 7.52084C9.05007 7.54541 9.28356 7.60861 9.48006 7.80511C9.67656 8.00161 9.73975 8.2351 9.76433 8.41787C9.7853 8.57388 9.78523 8.75871 9.78516 8.92964V8.92964L9.78516 8.95835V13.125C9.78516 13.4702 9.50533 13.75 9.16016 13.75C8.81498 13.75 8.53516 13.4702 8.53516 13.125V8.95835C8.53516 8.87578 8.53513 8.80885 8.53419 8.75097ZM8.95182 4.79167C8.49159 4.79167 8.11849 5.16476 8.11849 5.625C8.11849 6.08524 8.49159 6.45833 8.95182 6.45833H8.95931C9.41955 6.45833 9.79264 6.08524 9.79264 5.625C9.79264 5.16476 9.41955 4.79167 8.95931 4.79167H8.95182Z",fill:"#6C737F"})}),se=({sendMessage:t,debug:i,config:a,messages:o,onReachingUp:r,agentsIdsAvatarsMap:s,searchPattern:l,searchMatchNo:c,onSearchMatchCount:d,onMessageReply:g,errorMessage:p})=>{const u=n.useRef(null),h=n.useRef(0),[b,x]=n.useState(null),[C,f]=n.useState(!0),y=p?.trim();return n.useEffect((()=>{const e=document.getElementById(m);if(!e)return;h.current=e.scrollHeight;const n=()=>{0===e.scrollTop&&r?.();const n=e.scrollHeight-e.scrollTop-e.clientHeight<=4;f(n)};return e.addEventListener("scroll",n),()=>{e.removeEventListener("scroll",n)}}),[r]),n.useLayoutEffect((()=>{const e=u.current;if(!e)return;const n=h.current;if(e.scrollHeight-e.scrollTop<=e.clientHeight+200){const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),f(!0)}else{const t=e.scrollHeight-n;e.style.scrollBehavior="auto",e.scrollTop=e.scrollTop+t;const i=4,a=e.scrollHeight-e.scrollTop-e.clientHeight<=i;f(a)}h.current=e.scrollHeight}),[o,y]),n.useEffect((()=>{if(!l||!l.trim())return x(null),void d?.(0);const e=l.toLowerCase(),n=[];for(const t of o){const i=t&&t.content,a=t&&t.messageId;a&&i&&(String(i).toLowerCase().includes(e)&&n.push(a))}if(d?.(n.length),0===n.length)return void x(null);const t=n[Math.min(Math.max((c??1)-1,0),n.length-1)];x(t);const i=u.current,a=t?document.getElementById(t):null;i&&a&&(i.style.scrollBehavior="smooth",a.scrollIntoView())}),[l,c,o,d]),e.jsxs(ne,{ref:u,id:m,config:a,children:[o?.map(((n,r)=>"seperator"===n.type?e.jsx(ee,{data:n,config:a}):e.jsx("div",{children:e.jsx($,{message:n,index:r,sendMessage:t,messageActionsEnabled:o.length-1===r,debug:i,config:a,agentsIdsAvatarsMap:s,highlighted:b===n.messageId,searchPattern:l,onMessageReply:g})},n.messageId?n.messageId:"message"+r))),y&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{data:{type:"seperator"},config:a}),e.jsxs(ie,{role:"alert","aria-live":"assertive","data-testid":"chat-error-message",children:[e.jsx(ae,{children:e.jsx(re,{})}),e.jsx(oe,{children:y})]})]}),!C&&e.jsx(te,{"aria-label":"Scroll to latest message",onClick:()=>{const e=u.current;if(!e)return;const n=e.scrollHeight;e.style.scrollBehavior="smooth",e.style.overscrollBehavior="contain",e.scroll(0,n),f(!0)},children:e.jsx("svg",{width:"14",height:"8",viewBox:"0 0 14 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.60372 0.555285C1.7256 0.716659 2.08951 1.1984 2.30624 1.47611C2.74031 2.03233 3.33342 2.77142 3.97323 3.50831C4.61627 4.24893 5.29178 4.97022 5.89189 5.50046C6.19281 5.76634 6.45714 5.96837 6.67527 6.09987C6.88042 6.22355 7.00161 6.24927 7.00161 6.24927C7.00161 6.24927 7.11923 6.22355 7.32437 6.09988C7.5425 5.96838 7.80684 5.76635 8.10775 5.50047C8.70786 4.97022 9.38337 4.24892 10.0264 3.5083C10.6662 2.7714 11.2593 2.0323 11.6934 1.47608C11.9101 1.19837 12.2735 0.717304 12.3954 0.555928C12.6411 0.222405 13.1111 0.150469 13.4446 0.396102C13.7781 0.641734 13.8494 1.11123 13.6037 1.44476L13.6018 1.4473C13.474 1.61655 13.0971 2.11556 12.8759 2.39892C12.4321 2.9677 11.8216 3.72861 11.1591 4.49171C10.4997 5.25109 9.77408 6.02979 9.10096 6.62454C8.76526 6.92116 8.42497 7.18788 8.0988 7.3845C7.79322 7.56872 7.40633 7.75 6.99982 7.75C6.59331 7.75 6.20642 7.56871 5.90084 7.3845C5.57468 7.18787 5.23439 6.92116 4.89869 6.62454C4.22557 6.02979 3.4999 5.2511 2.84058 4.49173C2.17803 3.72863 1.5676 2.96774 1.12372 2.39896C0.902432 2.11541 0.525506 1.61637 0.397929 1.44747L0.396279 1.44528C0.150645 1.11176 0.22154 0.641787 0.555062 0.396152C0.888572 0.150526 1.35808 0.221792 1.60372 0.555285Z",fill:"white"})})})]},m)},le="text";async function ce(e,n,t){const i=new s.BlobServiceClient("https://bcuserres.blob.core.windows.net?sv=2024-11-04&ss=b&srt=o&sp=rc&se=2027-12-31T19:19:59Z&st=2026-01-02T11:04:59Z&spr=https&sig=OqvZvcz%2FmvmhVS8gWqPpMBxDZXHbEZ%2BTQRpCT3bE3G0%3D",new s.AnonymousCredential).getContainerClient("anonymous"),a=new Date,o=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}`,l=i.getBlockBlobClient(`${o}/${r.v4()}`);try{await l.uploadBrowserData(e,{onProgress:t=>{const i=Math.round(t.loadedBytes/e.size*100);n(i)},blockSize:4194304,concurrency:20,blobHTTPHeaders:{blobContentType:e.type}});t(l.url.split("?")[0])}catch(e){t(void 0,"Error uploading file:"+e.message)}}const de=c.default.span`
238
238
  cursor: pointer;
239
239
  width: 20px;
240
240
  height: 20px;
@@ -386,7 +386,7 @@ i {
386
386
  color: #111827;
387
387
  outline: none;
388
388
  }
389
- `,Ue=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Ve=({config:t,sendMessage:i,setView:a,actionChips:o,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:u})=>{const h="AR"===t?.language,[m,b]=n.useState(),[x,C]=n.useState(),[f,y]=n.useState(),[v,w]=n.useState(0),M=n.useMemo((()=>Boolean(d||g)),[d,g]),A=n.useMemo((()=>d||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,d]),k=n.useMemo((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),L=n.useCallback((e=>{if(r){const e=(m||"").trim();return s&&s(e),void b("")}const n=e=>{const{fileUrl:n,extension:t}=e;i(p.SupportedImageFormats.indexOf(t)>=0?"image":p.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?ce(e.blob,w,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&y(i)})):n(e):x?x.blob&&x.fileUrl.startsWith("blob:")?ce(x.blob,w,((e,t)=>{if(e){try{URL.revokeObjectURL(x.fileUrl)}catch{}n({...x,fileUrl:e,blob:void 0}),C(void 0)}else t&&y(t)})):(n(x),C(void 0)):(i(le,m),b(""))}),[x,m,i,r,s]);return e.jsxs(Ze,{isRTL:h,children:[M?e.jsxs(Te,{isRTL:h,children:[e.jsxs(Pe,{isRTL:h,children:[A?e.jsx(He,{children:A}):null,u?e.jsx(Je,{type:"button",onClick:u,"aria-label":k,title:k,children:e.jsx(Ue,{})}):null]}),g?e.jsx(Ge,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(xe,{config:t,send:L,text:m,setText:b,file:r?void 0:x,isFileSelected:!!x,cancelFileUpload:()=>C(void 0),noteMode:r,onCloseNoteMode:()=>{b(""),l?.()},notePlaceholder:c})}),e.jsxs("div",{className:"bc-BottomBar "+(h?"bc-RTL":""),children:[void 0!==o?o:null,e.jsx("div",{className:"bc-CommandsArea "+(h?"bc-RTL":""),children:r?null:e.jsx(Ne,{setView:a,setFile:C,setProgress:w,setError:y,setText:b,text:m,send:L,config:t})})]}),f?e.jsx("div",{className:"bc-uploadFileError",children:f}):null]})},Ke="bc-chat-header-banner",Qe=390,We=c.default.div`
389
+ `,Ve=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Ue=({config:t,sendMessage:i,setView:a,actionChips:o,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:u})=>{const h="AR"===t?.language,[m,b]=n.useState(),[x,C]=n.useState(),[f,y]=n.useState(),[v,w]=n.useState(0),M=n.useMemo((()=>Boolean(d||g)),[d,g]),A=n.useMemo((()=>d||("AR"===t?.language?"الرد على رسالة":"TR"===t?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[t?.language,d]),k=n.useMemo((()=>"AR"===t?.language?"إلغاء":"TR"===t?.language?"İptal":"Cancel"),[t?.language]),L=n.useCallback((e=>{if(r){const e=(m||"").trim();return s&&s(e),void b("")}const n=e=>{const{fileUrl:n,extension:t}=e;i(p.SupportedImageFormats.indexOf(t)>=0?"image":p.SupportedAudioFormats.indexOf(t)>=0?"audio":"document",n)};e?e.blob&&e.fileUrl.startsWith("blob:")?ce(e.blob,w,((t,i)=>{if(t){try{URL.revokeObjectURL(e.fileUrl)}catch{}n({...e,fileUrl:t,blob:void 0})}else i&&y(i)})):n(e):x?x.blob&&x.fileUrl.startsWith("blob:")?ce(x.blob,w,((e,t)=>{if(e){try{URL.revokeObjectURL(x.fileUrl)}catch{}n({...x,fileUrl:e,blob:void 0}),C(void 0)}else t&&y(t)})):(n(x),C(void 0)):(i(le,m),b(""))}),[x,m,i,r,s]);return e.jsxs(Ze,{isRTL:h,children:[M?e.jsxs(Te,{isRTL:h,children:[e.jsxs(Pe,{isRTL:h,children:[A?e.jsx(He,{children:A}):null,u?e.jsx(Je,{type:"button",onClick:u,"aria-label":k,title:k,children:e.jsx(Ve,{})}):null]}),g?e.jsx(Ge,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(xe,{config:t,send:L,text:m,setText:b,file:r?void 0:x,isFileSelected:!!x,cancelFileUpload:()=>C(void 0),noteMode:r,onCloseNoteMode:()=>{b(""),l?.()},notePlaceholder:c})}),e.jsxs("div",{className:"bc-BottomBar "+(h?"bc-RTL":""),children:[void 0!==o?o:null,e.jsx("div",{className:"bc-CommandsArea "+(h?"bc-RTL":""),children:r?null:e.jsx(Ne,{setView:a,setFile:C,setProgress:w,setError:y,setText:b,text:m,send:L,config:t})})]}),f?e.jsx("div",{className:"bc-uploadFileError",children:f}):null]})},Ke="bc-chat-header-banner",Qe=390,We=c.default.div`
390
390
  ${e=>e.bannerWidth>Qe?"height: 60px;":"height: 90px;"}
391
391
  display: block;
392
392
  width: 100%;
@@ -463,5 +463,5 @@ i {
463
463
  font-style: normal;
464
464
  line-height: var(--bc-chat-lineHeight-xs);
465
465
  color: var(--bc-chat-text-secondary-dark);
466
- `;exports.BCChat=({config:t={language:"EN",backgroundColor:"#F3F4F6"},messages:i=[],sendMessage:a,debug:o,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:b,onMessageReply:x,replyMessageTitle:C,replyMessageContent:f,onCancelReplyMessage:y,errorMessage:v})=>{const[w,M]=n.useState("MESSAGE_LIST");return e.jsxs(en,{className:"bc-chat",children:[t.hideHeader?null:e.jsx(_e,{config:t,minimize:r}),"MESSAGE_LIST"===w?e.jsx(se,{messages:i,sendMessage:a,debug:o,config:t,onReachingUp:s,agentsIdsAvatarsMap:l,searchPattern:u,searchMatchNo:m,onSearchMatchCount:b,onMessageReply:x,errorMessage:v},"message-list"):null,t.inputDisabled?null:e.jsx(Ve,{sendMessage:a,setView:M,config:t,actionChips:c,noteMode:d,onCloseNoteMode:p,onNoteSend:g,notePlaceholder:h,replyMessageTitle:C,replyMessageContent:f,onCancelReplyMessage:y},"message-input")]})};
466
+ `;exports.BCChat=({config:t={language:"EN",backgroundColor:"#F3F4F6"},messages:i=[],sendMessage:a,debug:o,minimize:r,onReachingUp:s,agentsIdsAvatarsMap:l,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,searchPattern:u,notePlaceholder:h,searchMatchNo:m=1,onSearchMatchCount:b,onMessageReply:x,replyMessageTitle:C,replyMessageContent:f,onCancelReplyMessage:y,errorMessage:v})=>{const[w,M]=n.useState("MESSAGE_LIST");return e.jsxs(en,{className:"bc-chat",children:[t.hideHeader?null:e.jsx(_e,{config:t,minimize:r}),"MESSAGE_LIST"===w?e.jsx(se,{messages:i,sendMessage:a,debug:o,config:t,onReachingUp:s,agentsIdsAvatarsMap:l,searchPattern:u,searchMatchNo:m,onSearchMatchCount:b,onMessageReply:x,errorMessage:v},"message-list"):null,t.inputDisabled?null:e.jsx(Ue,{sendMessage:a,setView:M,config:t,actionChips:c,noteMode:d,onCloseNoteMode:p,onNoteSend:g,notePlaceholder:h,replyMessageTitle:C,replyMessageContent:f,onCancelReplyMessage:y},"message-input")]})};
467
467
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/bc-chat",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.es.js",
6
6
  "jsnext:main": "build/index.es.js",