@_solaris/messenger-widget 0.2.25 → 0.2.27

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.
@@ -53,4 +53,4 @@ ${i}`)}return a.join(`
53
53
 
54
54
  `)}function K(n,t){if(!Array.isArray(n==null?void 0:n.options))return t;const r=n.options.find(a=>(a==null?void 0:a.value)===t);return(r==null?void 0:r.label)||t}function eo(n,t){const r=[],a=Array.isArray(n==null?void 0:n.fields)?n.fields:[];for(const o of a){if(!(o!=null&&o.key)||!(o!=null&&o.label))continue;const s=t==null?void 0:t[o.key];if(s==null||s==="")continue;let i;if(Array.isArray(s)){if(i=s.map(f=>K(o,String(f))).join(", "),!i)continue}else typeof s=="boolean"?i=s?"Oui":"Non":i=K(o,String(s));const l=o.type==="textarea"||typeof i=="string"&&(i.length>60||i.includes(`
55
55
  `));r.push({label:o.label,value:i,multiline:l})}return{kind:"form_response",data:{title:(n==null?void 0:n.title)||"Formulaire",fields:r}}}const to=450,no=50,ro=900,so=12e3,oo=300,ao={name:"Messenger",components:{Launcher:de,Header:me,Onboarding:he,MessageList:Ee,Composer:Ve,SuggestionChips:Se,ApprovalCard:Me,FormCard:xe,Feedback:Te,HistoryDrawer:Oe,MoreMenu:Ie},provide(){return{signAttachmentFn:n=>{var t,r;return((r=(t=this.store)==null?void 0:t.signAttachment)==null?void 0:r.call(t,n))||null}}},props:{baseUrl:{type:String,default:ce},widgetId:{type:String,default:""},userId:{type:String,default:""},userHash:{type:String,default:""},customer:{type:Object,default:null},displayMode:{type:String,default:"floating"},devtools:{type:Boolean,default:!1}},data(){return{transport:null,store:null,isOpen:!1,draft:"",busy:!1,bootError:null,pendingAttachments:[],feedbackBusy:!1,feedbackDone:!1,revealedAt:{},nextRevealAt:0,revealTimers:[],convOpenedAt:0,historyOpen:!1,moreOpen:!1,activeConvId:null,showOnboarding:!1,notifEnabled:!0,labelDismissed:!1,readState:{},unreadAnchorTs:"",floatHeight:0,floatRO:null,approvalSettled:!0,approvalSettleTimer:null,approvalLatchId:null}},computed:{isEditor(){return!!this.devtools},isEmbedded(){return this.displayMode==="embedded"},error(){var n;return this.bootError||((n=this.s)==null?void 0:n.error)||null},canBoot(){return!!(this.baseUrl&&this.widgetId&&this.userId&&this.userHash)},s(){var n;return((n=this.store)==null?void 0:n.state)||null},ready(){var n;return!!((n=this.s)!=null&&n.ready)},allConversations(){var t;const n=(t=this.s)==null?void 0:t.conversations;return Array.isArray(n)?n:[]},drawerConversations(){var r;const n=this.readState,t=((r=this.s)==null?void 0:r.messagesByConv)||{};return this.allConversations.map(a=>{const o=t[a.id]||[],s=this.convLastActivity(a,o),i=n[a.id]||"",l=this.lastMessageAuthorType(o),f=!!s&&l!=="user"&&(!i||s>i);return{...a,_preview:this.convPreview(a,o),_unread:f}})},unreadCount(){return this.drawerConversations.filter(n=>n._unread).length},unreadThreads(){var t;const n=((t=this.s)==null?void 0:t.messagesByConv)||{};return this.drawerConversations.filter(r=>r._unread).map(r=>({id:r.id,title:r.name||"Nouvelle conversation",preview:r._preview||"Nouveau message",_ts:this.convLastActivity(r,n[r.id]||[])})).sort((r,a)=>r._ts<a._ts?1:r._ts>a._ts?-1:0).slice(0,3)},latestUnread(){var r;const n=((r=this.s)==null?void 0:r.messagesByConv)||{};let t=null;for(const a of this.drawerConversations){if(!a._unread)continue;const o=this.convLastActivity(a,n[a.id]||[]);(!t||o>t.ts)&&(t={convId:a.id,preview:a._preview,ts:o})}return t},launcherPeek(){if(this.isOpen||this.isEmbedded||this.labelDismissed)return"";const n=this.latestUnread;return n?n.preview||"Vous avez un nouveau message":""},isViewingThread(){return(this.isOpen||this.isEmbedded)&&!this.historyOpen&&!!this.currentConv},currentConv(){if(this.showOnboarding)return null;const n=this.allConversations;if(!n.length)return null;if(this.activeConvId!=null){const t=n.find(r=>r.id===this.activeConvId);if(t)return t}return n[0]||null},canBack(){return!!this.currentConv},statusUrl(){var r;const n=(r=this.widget)==null?void 0:r.quick_links;if(!Array.isArray(n))return"";const t=n.find(a=>a.icon==="status"&&a.url);return(t==null?void 0:t.url)||""},helpUrl(){var r;const n=(r=this.widget)==null?void 0:r.quick_links;if(!Array.isArray(n))return"";const t=n.find(a=>(a.icon==="chat"||a.icon==="help")&&a.url);return(t==null?void 0:t.url)||""},widget(){var n,t;return((t=(n=this.s)==null?void 0:n.config)==null?void 0:t.widget)||null},widgetWelcomeMessage(){var n;return((n=this.widget)==null?void 0:n.welcome_message)||""},agentName(){var n,t,r;return((r=(t=(n=this.s)==null?void 0:n.config)==null?void 0:t.agent)==null?void 0:r.name)||""},agentAvatarUrl(){var n,t,r;return((r=(t=(n=this.s)==null?void 0:n.config)==null?void 0:t.agent)==null?void 0:r.avatar_url)||null},quickLinks(){var t;const n=(t=this.widget)==null?void 0:t.quick_links;return Array.isArray(n)?n:[]},teamMembers(){var t;const n=(t=this.widget)==null?void 0:t.team_members;return Array.isArray(n)?n:[]},responseLabel(){var n;return((n=this.widget)==null?void 0:n.response_time_label)||""},humanMessageAuthor(){var t,r,a;if(!this.currentConv)return null;const n=((t=this.s.messagesByConv)==null?void 0:t[this.currentConv.id])||[];for(let o=n.length-1;o>=0;o--)if(((a=(r=n[o])==null?void 0:r.author)==null?void 0:a.type)==="agent_human")return n[o].author;return null},humanAgentName(){var n;return((n=this.humanMessageAuthor)==null?void 0:n.name)||""},humanAgentAvatarUrl(){var n;return((n=this.humanMessageAuthor)==null?void 0:n.avatar_url)||null},isEscalated(){return!!this.humanMessageAuthor},isWaitingHuman(){var t;const n=(t=this.currentConv)==null?void 0:t.status;return n==="waiting"||n==="handled"},headerTitle(){var n,t;return((n=this.currentConv)==null?void 0:n.name)||((t=this.widget)==null?void 0:t.name)||"Nouvelle conversation"},composerPlaceholder(){return this.isEscalated&&this.humanAgentName?`Répondre à ${this.humanAgentName.split(" ")[0]}…`:this.isWaitingHuman?"Un agent prend le relais…":"Écrivez votre message…"},displayedMessages(){const n=this.currentConv;if(!n)return[];const t=o=>{var s,i,l,f;return(o==null?void 0:o.type)==="action"||(o==null?void 0:o.type)==="system"||((s=o==null?void 0:o.payload)==null?void 0:s.type)==="system"||Array.isArray((i=o==null?void 0:o.payload)==null?void 0:i.attachments)&&o.payload.attachments.length||(l=o==null?void 0:o.metadata)!=null&&l.artifact||(f=o==null?void 0:o.metadata)!=null&&f.form?!0:typeof(o==null?void 0:o.text_md)=="string"&&o.text_md.trim().length>0},r=o=>{var s;return(o==null?void 0:o.type)==="action"&&((s=o==null?void 0:o.payload)==null?void 0:s.state)==="pending"},a=this.revealedAt;return(this.s.messagesByConv[n.id]||[]).filter(o=>!r(o)).filter(o=>J(o)?a[o.id]>0:!0).filter(t)},streamingActive(){var r,a,o;const n=this.currentConv;return n?Object.keys(((r=this.s)==null?void 0:r.streamingByMsgId)||{}).length>0?!0:this.actionInFlight?!1:(((o=(a=this.s)==null?void 0:a.messagesByConv)==null?void 0:o[n.id])||[]).some(s=>J(s)&&!(this.revealedAt[s.id]>0)):!1},currentConvMessages(){var t,r,a;const n=(t=this.currentConv)==null?void 0:t.id;return n?((a=(r=this.s)==null?void 0:r.messagesByConv)==null?void 0:a[n])||[]:[]},pendingApproval(){return!this.currentConv||!this.store||this.actionInFlight?null:this.store.getPendingApproval(this.currentConv.id)},approvalReady(){return this.pendingApproval?this.pendingApproval.id===this.approvalLatchId?!0:!(this.streamingActive||!this.approvalSettled):!1},approvalTitle(){var n,t,r;return((t=(n=this.pendingApproval)==null?void 0:n.payload)==null?void 0:t.name)||((r=this.pendingApproval)==null?void 0:r.text_md)||"Confirmer l'action"},approvalDetail(){var a,o,s,i,l,f;const n=(s=(o=(a=this.pendingApproval)==null?void 0:a.payload)==null?void 0:o.pending)==null?void 0:s.user_explanation;if(typeof n=="string"&&n.trim())return n.trim();const t=(f=(l=(i=this.pendingApproval)==null?void 0:i.payload)==null?void 0:l.pending)==null?void 0:f.prepared_params;if(!t||typeof t!="object")return"";const r=Object.entries(t);return r.length?r.slice(0,2).map(([v,g])=>`${v}: ${g}`).join(" · "):""},actionInFlight(){var n,t;return!this.currentConv||!this.store?null:((t=(n=this.store).getActionInFlight)==null?void 0:t.call(n,this.currentConv.id))||null},actionInFlightName(){var t;const n=this.actionInFlight;return n?((t=n.payload)==null?void 0:t.name)||n.text_md||"Action":""},suggestions(){return!this.currentConv||!this.store?[]:this.streamingActive?[]:this.pendingForm?[]:this.store.getLatestSuggestions(this.currentConv.id)},pendingForm(){var n,t;return!this.currentConv||!this.store||this.pendingApproval||this.actionInFlight||this.streamingActive||!this.approvalSettled?null:((t=(n=this.store).getLatestForm)==null?void 0:t.call(n,this.currentConv.id))||null},showFeedback(){var t;const n=this.currentConv;return n?this.feedbackDone?!0:n.status!=="resolved"?!1:!((t=n.metadata)!=null&&t.feedback):!1},floatVisible(){return this.approvalReady||!!this.pendingForm||this.showFeedback||this.suggestions.length>0},dateLabel(){var r,a,o;const n=this.currentConv;let t=new Date;if(n){const i=((o=(((a=(r=this.s)==null?void 0:r.messagesByConv)==null?void 0:a[n.id])||[]).find(l=>l==null?void 0:l.created_at))==null?void 0:o.created_at)||n.created_at;if(i){const l=new Date(i);Number.isNaN(l.getTime())||(t=l)}}return`Aujourd'hui · ${ee(t)}`},paginationState(){var r,a,o;const n=(r=this.currentConv)==null?void 0:r.id,t=n?(o=(a=this.s)==null?void 0:a.paginationByConv)==null?void 0:o[n]:null;return{loading:!!(t!=null&&t.loading),hasMore:!!(t!=null&&t.nextCursor)}}},watch:{latestUnread:{handler(n,t){if(!n){this.labelDismissed=!1;return}(!t||n.convId!==t.convId||n.ts>t.ts)&&(this.labelDismissed=!1)},deep:!0},"currentConv.id":{handler(n){this.cancelReveals(),this.revealedAt={},this.nextRevealAt=0,this.convOpenedAt=Date.now(),this.moreOpen=!1,this.resetApprovalPacing(),this.isViewingThread&&(this.unreadAnchorTs=n&&this.readState[n]||"")},immediate:!0},isViewingThread(n,t){var r;if(n&&!t){const a=(r=this.currentConv)==null?void 0:r.id;this.unreadAnchorTs=a&&this.readState[a]||""}else n||(this.unreadAnchorTs="")},pendingApproval:{handler(n,t){if(n&&!t){const r=n!=null&&n.created_at?Date.parse(n.created_at):NaN;if(!(Number.isFinite(r)&&r>=this.convOpenedAt)){this.resetApprovalPacing();return}this.bumpApprovalSettle(2600)}else!n&&t&&this.resetApprovalPacing()},immediate:!1},streamingActive(n,t){n!==t&&this.pendingApproval&&this.pendingApproval.id!==this.approvalLatchId&&this.bumpApprovalSettle()},approvalReady(n){n&&this.pendingApproval&&(this.approvalLatchId=this.pendingApproval.id)},floatVisible:{handler(n){this.$nextTick(()=>this.syncFloatObserver(n))},immediate:!0},currentConvMessages(n){var a;if(!Array.isArray(n)||!n.length)return;const t=Date.now(),r={...this.revealedAt};for(const o of n){if((o==null?void 0:o.id)==null||r[o.id]!==void 0)continue;if(!J(o)){r[o.id]=t;continue}const s=o!=null&&o.created_at?Date.parse(o.created_at):NaN;if(!Number.isFinite(s)||s<this.convOpenedAt){r[o.id]=t;continue}const i=typeof(o==null?void 0:o.text_md)=="string"&&o.text_md.trim().length>0,l=Array.isArray((a=o==null?void 0:o.payload)==null?void 0:a.attachments)&&o.payload.attachments.length>0;if(!i&&!l){r[o.id]=t;continue}r[o.id]=0,this.scheduleReveal(o)}this.revealedAt=r,(this.isOpen||this.isEmbedded)&&!this.historyOpen&&this.currentConv&&this.markConvRead(this.currentConv)}},async mounted(){if(console.log("[messenger] mounted",{isEditor:this.isEditor,canBoot:this.canBoot,hasBaseUrl:!!this.baseUrl,hasWidgetId:!!this.widgetId,hasUserId:!!this.userId,hasUserHash:!!this.userHash}),typeof document<"u"&&!document.getElementById(oe)){const n=document.createElement("style");n.id=oe,n.textContent=le,document.head.appendChild(n)}this.hydrateReadState(),await this.boot(),this.isEmbedded&&this.store&&await this.open()},beforeUnmount(){this.cancelReveals(),this.disconnectFloatRO(),this.resetApprovalPacing(),this.store&&this.store.destroy()},methods:{syncFloatObserver(n){if(this.disconnectFloatRO(),!n){this.floatHeight=0;return}const t=this.$refs.floatEl;if(t){if(typeof ResizeObserver>"u"){this.floatHeight=Math.ceil(t.getBoundingClientRect().height+8);return}this.floatRO=new ResizeObserver(r=>{const a=r[0];if(!a)return;const o=Math.ceil(a.contentRect.height+8);o!==this.floatHeight&&(this.floatHeight=o,this.$nextTick(()=>{var s,i;(i=(s=this.$refs.messageList)==null?void 0:s.scrollToBottom)==null||i.call(s)}))}),this.floatRO.observe(t)}},disconnectFloatRO(){if(this.floatRO){try{this.floatRO.disconnect()}catch{}this.floatRO=null}},convLastActivity(n,t){let r=(n==null?void 0:n.last_message_at)||(n==null?void 0:n.updated_at)||(n==null?void 0:n.created_at)||"";for(const a of t)a!=null&&a.created_at&&a.created_at>r&&(r=a.created_at);return r},lastMessageAuthorType(n){var t,r;for(let a=n.length-1;a>=0;a--){const o=(r=(t=n[a])==null?void 0:t.author)==null?void 0:r.type;if(o)return o}return""},convPreview(n,t){var r,a,o;for(let s=t.length-1;s>=0;s--){const i=t[s];if(!i)continue;const l=typeof i.text_md=="string"?i.text_md.trim():"";if(l)return(((r=i.author)==null?void 0:r.type)==="user"?"Vous : ":"")+l.replace(/\s+/g," ");const f=(a=i.payload)==null?void 0:a.attachments;if(Array.isArray(f)&&f.length)return"📎 Pièce jointe"}return(n==null?void 0:n.last_message_preview)||(n==null?void 0:n.preview)||((o=n==null?void 0:n.metadata)==null?void 0:o.last_preview)||""},readStorageKey(){const n=this.widgetId||"",t=this.userId||"";return`wm:read:${n}:${t}`},hydrateReadState(){try{if(typeof localStorage>"u")return;const n=localStorage.getItem(this.readStorageKey());if(!n)return;const t=JSON.parse(n);t&&typeof t=="object"&&(this.readState=t)}catch{}},persistReadState(){try{if(typeof localStorage>"u")return;localStorage.setItem(this.readStorageKey(),JSON.stringify(this.readState))}catch{}},markConvRead(n){var a,o;if(!(n!=null&&n.id))return;const t=((o=(a=this.s)==null?void 0:a.messagesByConv)==null?void 0:o[n.id])||[],r=this.convLastActivity(n,t);r&&this.readState[n.id]!==r&&(this.readState={...this.readState,[n.id]:r},this.persistReadState())},cancelReveals(){for(const n of this.revealTimers)try{clearTimeout(n)}catch{}this.revealTimers=[]},resetApprovalPacing(){if(this.approvalSettleTimer){try{clearTimeout(this.approvalSettleTimer)}catch{}this.approvalSettleTimer=null}this.approvalSettled=!0,this.approvalLatchId=null},bumpApprovalSettle(n=800){if(this.approvalSettled=!1,this.approvalSettleTimer)try{clearTimeout(this.approvalSettleTimer)}catch{}this.approvalSettleTimer=setTimeout(()=>{this.approvalSettled=!0,this.approvalSettleTimer=null},n)},scheduleReveal(n){const t=Date.now(),r=((n==null?void 0:n.text_md)||"").length,a=Math.min(so,Math.max(ro,r*no)),s=Math.max(t+to,this.nextRevealAt+oo)+a;this.nextRevealAt=s;const i=Math.max(0,s-t),l=n.id,f=setTimeout(()=>{this.revealedAt={...this.revealedAt,[l]:Date.now()},this.revealTimers=this.revealTimers.filter(g=>g!==f)},i);this.revealTimers.push(f);const v=setTimeout(()=>{this.revealedAt[l]>0||(this.revealedAt={...this.revealedAt,[l]:Date.now()}),this.revealTimers=this.revealTimers.filter(g=>g!==v)},i+4e3);this.revealTimers.push(v)},async boot(){if(!this.canBoot){console.warn("[messenger] boot skipped — missing creds",{baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId,hasUserHash:!!this.userHash});return}try{console.log("[messenger] boot start",{baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId}),this.transport=e.markRaw(ae({baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId,userHash:this.userHash})),this.store=e.markRaw(ie(this.transport)),await this.store.start(),this.customer&&typeof this.customer=="object"&&await this.store.applyCustomer(this.customer),console.log("[ww-messenger] boot done",{ready:this.store.state.ready,error:this.store.state.error})}catch(n){console.error("[ww-messenger] bootstrap failed",n),this.bootError=(n==null?void 0:n.message)||String(n)}},async refresh(){this.store&&this.store.destroy(),this.cancelReveals(),this.revealedAt={},this.nextRevealAt=0,this.convOpenedAt=0,this.transport=null,this.store=null,this.isOpen=!1,this.draft="",this.busy=!1,this.bootError=null,this.pendingAttachments=[],this.feedbackBusy=!1,this.feedbackDone=!1,this.historyOpen=!1,this.moreOpen=!1,this.activeConvId=null,this.showOnboarding=!1,await this.boot(),this.isEmbedded&&this.store&&await this.open()},async openFromPeek(){var t,r;const n=(t=this.latestUnread)==null?void 0:t.convId;n&&n!==((r=this.currentConv)==null?void 0:r.id)&&(this.activeConvId=n,this.showOnboarding=!1),await this.open()},async open(){if(this.isOpen=!0,this.store&&this.store.setPanelOpen(!0),this.currentConv){try{await this.store.openConversation(this.currentConv.id)}catch(n){console.error("[ww-messenger] load messages failed",n)}this.markConvRead(this.currentConv)}},close(){this.isOpen=!1,this.store&&this.store.setPanelOpen(!1)},async startConv(){if(!this.busy){this.busy=!0;try{const n=await this.store.createConversation({});this.activeConvId=n.id,this.showOnboarding=!1,await this.store.openConversation(n.id),this.markConvRead(n),this.focusComposer()}catch(n){console.error("[ww-messenger] create conv failed",n),this.bootError=(n==null?void 0:n.message)||String(n)}finally{this.busy=!1}}},focusComposer(){this.$nextTick(()=>{var n;return(n=this.$refs.composer)==null?void 0:n.focus()})},toggleMore(){this.historyOpen=!1,this.moreOpen=!this.moreOpen},goHome(){this.historyOpen=!1,this.moreOpen=!1,this.activeConvId=null,this.showOnboarding=!0},async onDrawerPick(n){if(!(n!=null&&n.id)||!this.store)return;this.historyOpen=!1,this.activeConvId=n.id,this.showOnboarding=!1;try{await this.store.openConversation(n.id)}catch(r){console.error("[ww-messenger] open conv failed",r)}const t=this.allConversations.find(r=>r.id===n.id);t&&this.markConvRead(t)},async onDrawerNew(){this.historyOpen=!1,await this.startConv()},onNotifToggle(n){this.notifEnabled=!!n},async onMoreAction(n){switch(this.moreOpen=!1,n){case"history":this.historyOpen=!0;break;case"rename":await this.renameCurrentConv();break;case"clear":await this.clearCurrentConv();break;case"export":this.exportCurrentConv();break;case"status":if(this.statusUrl)try{window.open(this.statusUrl,"_blank","noopener")}catch{}break;case"help":if(this.helpUrl)try{window.open(this.helpUrl,"_blank","noopener")}catch{}break}},async renameCurrentConv(){const n=this.currentConv;if(!n||!this.store)return;let t;try{t=typeof window<"u"&&typeof window.prompt=="function"?window.prompt("Nouveau nom du fil",n.name||""):null}catch{t=null}if(t==null)return;const r=t.trim();if(!(!r||r===n.name))try{await this.store.patchConversation(n.id,{name:r})}catch(a){console.error("[ww-messenger] rename failed",a)}},async clearCurrentConv(){var r;const n=this.currentConv;!n||!this.store||!(!(typeof window<"u"&&typeof window.confirm=="function")||window.confirm("Effacer ce fil de votre côté ? Cette action ne supprime pas les messages côté agent."))||((r=this.s)!=null&&r.messagesByConv&&(this.s.messagesByConv[n.id]=[]),this.activeConvId=null,this.showOnboarding=!0)},exportCurrentConv(){var o,s,i,l,f,v;const n=this.currentConv;if(!n)return;const t=(((s=(o=this.s)==null?void 0:o.messagesByConv)==null?void 0:s[n.id])||[]).slice(),r=[`# ${n.name||"Conversation"}`,n.created_at?`Créée le : ${n.created_at}`:"",""];for(const g of t){if(!g)continue;const w=((i=g.author)==null?void 0:i.name)||(((l=g.author)==null?void 0:l.type)==="user"?"Vous":((f=g.author)==null?void 0:f.type)==="agent_human"?"Agent":((v=g.author)==null?void 0:v.type)==="agent_ia"?"Assistant IA":"Système"),A=g.created_at?new Date(g.created_at).toLocaleString("fr-FR"):"",k=(g.text_md||"").trim();k&&(r.push(`[${A}] ${w} :`),r.push(k),r.push(""))}const a=new Blob([r.join(`
56
- `)],{type:"text/plain;charset=utf-8"});try{const g=URL.createObjectURL(a),w=document.createElement("a");w.href=g,w.download=`${(n.name||"conversation").replace(/[^a-z0-9-_]+/gi,"_")}.txt`,document.body.appendChild(w),w.click(),document.body.removeChild(w),setTimeout(()=>URL.revokeObjectURL(g),1e3)}catch(g){console.error("[ww-messenger] export failed",g)}},async onSend(n){const t=this.currentConv;if(!t&&(await this.startConv(),!this.currentConv))return;const r=(this.currentConv||t).id,a=this.pendingAttachments.slice();this.pendingAttachments=[],await this.store.send(r,n,{attachments:a.length?a:void 0})},async onSuggestion(n){const t=n==null?void 0:n.label;t&&await this.onSend(t)},async onLoadMore(){var t;const n=(t=this.currentConv)==null?void 0:t.id;!n||!this.store||await this.store.loadMore(n)},async onApprovalCallback(n){const t=this.pendingApproval;t&&await this.store.clickCallback(t.id,n)},async onFormSubmit({values:n}){const t=this.pendingForm;if(!(t!=null&&t.form))return;const r=Zs(t.form,n);if(!r)return;const a=this.currentConv;a&&await this.store.send(a.id,r,{metadata:{artifact:eo(t.form,n)}})},async onAttach(n){if(!(!n||!this.transport))try{const t=await this.transport.uploadAttachment(n);this.pendingAttachments.push({type:t.type||"file",path:t.path,name:n.name||"fichier",mime_type:n.type,size_bytes:n.size})}catch(t){console.error("[ww-messenger] attachment upload failed",t)}},async onQuickLink(n){if(n){if(n.url){try{window.open(n.url,"_blank","noopener")}catch{}return}await this.startConv(),this.currentConv&&await this.store.send(this.currentConv.id,n.label)}},async onFeedback({rating:n,comment:t}){if(this.currentConv){this.feedbackBusy=!0;try{await this.store.submitFeedback(this.currentConv.id,{rating:n,comment:t}),this.feedbackDone=!0}catch(r){console.error("[ww-messenger] feedback failed",r)}finally{this.feedbackBusy=!1}}}}},io={key:0,class:"wm-loading","aria-busy":"true","aria-live":"polite"},lo={key:0,class:"wm-state"},co={class:"wm-state__err"},uo={class:"wm-state__errSub"},mo={class:"wm-bottom"},ho={key:0,ref:"floatEl",class:"wm-float"},po={key:1,class:"wm-actionWait",role:"status","aria-live":"polite"},fo={class:"wm-actionWait__lbl"},_o={key:1,class:"wm-attached"},go=["onClick"];function vo(n,t,r,a,o,s){const i=e.resolveComponent("Launcher"),l=e.resolveComponent("Header"),f=e.resolveComponent("Onboarding"),v=e.resolveComponent("MessageList"),g=e.resolveComponent("ApprovalCard"),w=e.resolveComponent("FormCard"),A=e.resolveComponent("Feedback"),k=e.resolveComponent("SuggestionChips"),T=e.resolveComponent("Composer"),b=e.resolveComponent("MoreMenu"),M=e.resolveComponent("HistoryDrawer");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wm-root",`wm-root--${r.displayMode}`])},[!o.isOpen&&!s.isEmbedded?(e.openBlock(),e.createBlock(i,{key:0,"unread-count":s.unreadCount,peek:s.launcherPeek,onOpen:s.openFromPeek,onDismiss:t[0]||(t[0]=V=>o.labelDismissed=!0)},null,8,["unread-count","peek","onOpen"])):e.createCommentVNode("",!0),o.isOpen||s.isEmbedded?(e.openBlock(),e.createElementBlock("section",{key:1,class:e.normalizeClass(["wm-panel",`wm-panel--${r.displayMode}`]),style:e.normalizeStyle(o.floatHeight?{"--wm-float-h":o.floatHeight+"px"}:null),role:"dialog","aria-label":"Messenger"},[!s.ready&&!s.error?(e.openBlock(),e.createElementBlock("div",io,[s.isEmbedded?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wm-loading__close","aria-label":"Réduire",onClick:t[1]||(t[1]=(...V)=>s.close&&s.close(...V))},[...t[6]||(t[6]=[e.createElementVNode("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])),t[7]||(t[7]=e.createElementVNode("div",{class:"wm-loading__spinner","aria-hidden":"true"},null,-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(l,{title:s.headerTitle,escalated:s.isEscalated,"agent-name":s.humanAgentName,"agent-avatar-url":s.humanAgentAvatarUrl,"team-members":s.teamMembers,"response-label":s.responseLabel,"show-identity":!!s.currentConv,"show-back":s.canBack,"show-close":!s.isEmbedded,"more-active":o.moreOpen,onBack:s.goHome,onMore:s.toggleMore,onClose:s.close},null,8,["title","escalated","agent-name","agent-avatar-url","team-members","response-label","show-identity","show-back","show-close","more-active","onBack","onMore","onClose"]),s.error?(e.openBlock(),e.createElementBlock("div",lo,[e.createElementVNode("div",co,[t[9]||(t[9]=e.createElementVNode("div",{class:"wm-state__errIcon"},[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})])],-1)),e.createElementVNode("div",null,[t[8]||(t[8]=e.createElementVNode("div",{class:"wm-state__errTitle"},"Connexion impossible",-1)),e.createElementVNode("div",uo,e.toDisplayString(s.error),1)])])])):s.currentConv?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createVNode(v,{ref:"messageList",messages:s.displayedMessages,"streaming-active":s.streamingActive,"date-label":s.dateLabel,"conversation-id":s.currentConv?s.currentConv.id:null,"loading-more":s.paginationState.loading,"has-more":s.paginationState.hasMore,"unread-anchor-ts":o.unreadAnchorTs,onLoadMore:s.onLoadMore},null,8,["messages","streaming-active","date-label","conversation-id","loading-more","has-more","unread-anchor-ts","onLoadMore"]),e.createElementVNode("div",mo,[s.floatVisible?(e.openBlock(),e.createElementBlock("div",ho,[s.approvalReady?(e.openBlock(),e.createBlock(g,{key:0,action:s.approvalTitle,detail:s.approvalDetail,callbacks:s.pendingApproval.callbacks,onCallback:s.onApprovalCallback},null,8,["action","detail","callbacks","onCallback"])):s.pendingForm?(e.openBlock(),e.createBlock(w,{key:s.pendingForm.message&&s.pendingForm.message.id,form:s.pendingForm.form,onSubmit:s.onFormSubmit},null,8,["form","onSubmit"])):s.showFeedback?(e.openBlock(),e.createBlock(A,{key:2,busy:o.feedbackBusy,done:o.feedbackDone,onSubmit:s.onFeedback},null,8,["busy","done","onSubmit"])):(e.openBlock(),e.createBlock(k,{key:3,items:s.suggestions,onSelect:s.onSuggestion},null,8,["items","onSelect"]))],512)):e.createCommentVNode("",!0),s.actionInFlight?(e.openBlock(),e.createElementBlock("div",po,[t[10]||(t[10]=e.createElementVNode("span",{class:"wm-actionWait__spinner","aria-hidden":"true"},null,-1)),e.createElementVNode("span",fo,e.toDisplayString(s.actionInFlightName)+" en cours, veuillez patienter…",1)])):(e.openBlock(),e.createBlock(T,{key:2,ref:"composer",modelValue:o.draft,"onUpdate:modelValue":t[2]||(t[2]=V=>o.draft=V),placeholder:s.composerPlaceholder,disabled:!!s.pendingApproval,"attach-label":"Joindre un fichier",onSend:s.onSend,onAttach:s.onAttach},null,8,["modelValue","placeholder","disabled","onSend","onAttach"]))]),o.moreOpen?(e.openBlock(),e.createBlock(b,{key:0,"can-rename":!!s.currentConv,"can-clear":!!s.currentConv,"can-export":!!s.currentConv,"notif-enabled":o.notifEnabled,"status-url":s.statusUrl,"help-url":s.helpUrl,onClose:t[3]||(t[3]=V=>o.moreOpen=!1),onNotifToggle:s.onNotifToggle,onAction:s.onMoreAction},null,8,["can-rename","can-clear","can-export","notif-enabled","status-url","help-url","onNotifToggle","onAction"])):e.createCommentVNode("",!0),o.pendingAttachments.length?(e.openBlock(),e.createElementBlock("div",_o,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.pendingAttachments,(V,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"wm-attached__chip"},[t[12]||(t[12]=e.createElementVNode("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})],-1)),e.createElementVNode("span",null,e.toDisplayString(V.name),1),e.createElementVNode("button",{type:"button","aria-label":"Retirer",onClick:D=>o.pendingAttachments.splice(x,1)},[...t[11]||(t[11]=[e.createElementVNode("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])],8,go)]))),128))])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(f,{key:1,"welcome-message":s.widgetWelcomeMessage,"agent-name":s.agentName,"quick-links":s.quickLinks,"unread-threads":s.unreadThreads,busy:o.busy,onStart:s.startConv,onSelect:s.onQuickLink,onResume:s.onDrawerPick},null,8,["welcome-message","agent-name","quick-links","unread-threads","busy","onStart","onSelect","onResume"])),o.historyOpen?(e.openBlock(),e.createBlock(M,{key:3,conversations:s.drawerConversations,"active-id":s.currentConv?s.currentConv.id:null,onClose:t[4]||(t[4]=V=>o.historyOpen=!1),onNew:s.onDrawerNew,onPick:s.onDrawerPick},null,8,["conversations","active-id","onNew","onPick"])):e.createCommentVNode("",!0),o.moreOpen&&!s.currentConv?(e.openBlock(),e.createBlock(b,{key:4,"can-rename":!1,"can-clear":!1,"can-export":!1,"notif-enabled":o.notifEnabled,"status-url":s.statusUrl,"help-url":s.helpUrl,onClose:t[5]||(t[5]=V=>o.moreOpen=!1),onNotifToggle:s.onNotifToggle,onAction:s.onMoreAction},null,8,["notif-enabled","status-url","help-url","onNotifToggle","onAction"])):e.createCommentVNode("",!0)],64))],6)):e.createCommentVNode("",!0)],2)}const De=C(ao,[["render",vo],["__scopeId","data-v-8264e504"]]),yo="0.2.25";exports.AIAvatar=j;exports.AVATAR_COLORS=W;exports.ActionResult=pe;exports.ApprovalCard=Me;exports.ArtifactFormResponse=fe;exports.ArtifactInfoCard=_e;exports.ArtifactRenderer=ve;exports.ArtifactTicket=ge;exports.AttachmentPreview=ye;exports.Bubble=we;exports.Composer=Ve;exports.DEFAULT_BASE_URL=ce;exports.Feedback=Te;exports.FormCard=xe;exports.Header=me;exports.HistoryDrawer=Oe;exports.HumanAvatar=te;exports.Launcher=de;exports.MEDIA_RECORDER_SUPPORTED=G;exports.MessageList=Ee;exports.Messenger=De;exports.MoreMenu=Ie;exports.Onboarding=he;exports.SCREEN_CAPTURE_SUPPORTED=z;exports.SuggestionChips=Se;exports.TeamAvatars=ue;exports.Typing=be;exports.VERSION=yo;exports.avatarColor=Q;exports.avatarInitials=Z;exports.captureScreenshotFile=Ne;exports.colors=S;exports.createStore=ie;exports.createTransport=ae;exports.default=De;exports.formatTime=ee;exports.guessAttachmentKind=_r;exports.pickRecorderMime=Be;exports.renderMarkdown=ke;exports.startScreenRecording=Ae;exports.tokensCss=le;exports.uuid=X;exports.v4=X;
56
+ `)],{type:"text/plain;charset=utf-8"});try{const g=URL.createObjectURL(a),w=document.createElement("a");w.href=g,w.download=`${(n.name||"conversation").replace(/[^a-z0-9-_]+/gi,"_")}.txt`,document.body.appendChild(w),w.click(),document.body.removeChild(w),setTimeout(()=>URL.revokeObjectURL(g),1e3)}catch(g){console.error("[ww-messenger] export failed",g)}},async onSend(n){const t=this.currentConv;if(!t&&(await this.startConv(),!this.currentConv))return;const r=(this.currentConv||t).id,a=this.pendingAttachments.slice();this.pendingAttachments=[],await this.store.send(r,n,{attachments:a.length?a:void 0})},async onSuggestion(n){const t=n==null?void 0:n.label;t&&await this.onSend(t)},async onLoadMore(){var t;const n=(t=this.currentConv)==null?void 0:t.id;!n||!this.store||await this.store.loadMore(n)},async onApprovalCallback(n){const t=this.pendingApproval;t&&await this.store.clickCallback(t.id,n)},async onFormSubmit({values:n}){const t=this.pendingForm;if(!(t!=null&&t.form))return;const r=Zs(t.form,n);if(!r)return;const a=this.currentConv;a&&await this.store.send(a.id,r,{metadata:{artifact:eo(t.form,n)}})},async onAttach(n){if(!(!n||!this.transport))try{const t=await this.transport.uploadAttachment(n);this.pendingAttachments.push({type:t.type||"file",path:t.path,name:n.name||"fichier",mime_type:n.type,size_bytes:n.size})}catch(t){console.error("[ww-messenger] attachment upload failed",t)}},async onQuickLink(n){if(n){if(n.url){try{window.open(n.url,"_blank","noopener")}catch{}return}await this.startConv(),this.currentConv&&await this.store.send(this.currentConv.id,n.label)}},async onFeedback({rating:n,comment:t}){if(this.currentConv){this.feedbackBusy=!0;try{await this.store.submitFeedback(this.currentConv.id,{rating:n,comment:t}),this.feedbackDone=!0}catch(r){console.error("[ww-messenger] feedback failed",r)}finally{this.feedbackBusy=!1}}}}},io={key:0,class:"wm-loading","aria-busy":"true","aria-live":"polite"},lo={key:0,class:"wm-state"},co={class:"wm-state__err"},uo={class:"wm-state__errSub"},mo={class:"wm-bottom"},ho={key:0,ref:"floatEl",class:"wm-float"},po={key:1,class:"wm-actionWait",role:"status","aria-live":"polite"},fo={class:"wm-actionWait__lbl"},_o={key:1,class:"wm-attached"},go=["onClick"];function vo(n,t,r,a,o,s){const i=e.resolveComponent("Launcher"),l=e.resolveComponent("Header"),f=e.resolveComponent("Onboarding"),v=e.resolveComponent("MessageList"),g=e.resolveComponent("ApprovalCard"),w=e.resolveComponent("FormCard"),A=e.resolveComponent("Feedback"),k=e.resolveComponent("SuggestionChips"),T=e.resolveComponent("Composer"),b=e.resolveComponent("MoreMenu"),M=e.resolveComponent("HistoryDrawer");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wm-root",`wm-root--${r.displayMode}`])},[!o.isOpen&&!s.isEmbedded?(e.openBlock(),e.createBlock(i,{key:0,"unread-count":s.unreadCount,peek:s.launcherPeek,onOpen:s.openFromPeek,onDismiss:t[0]||(t[0]=V=>o.labelDismissed=!0)},null,8,["unread-count","peek","onOpen"])):e.createCommentVNode("",!0),o.isOpen||s.isEmbedded?(e.openBlock(),e.createElementBlock("section",{key:1,class:e.normalizeClass(["wm-panel",`wm-panel--${r.displayMode}`]),style:e.normalizeStyle(o.floatHeight?{"--wm-float-h":o.floatHeight+"px"}:null),role:"dialog","aria-label":"Messenger"},[!s.ready&&!s.error?(e.openBlock(),e.createElementBlock("div",io,[s.isEmbedded?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wm-loading__close","aria-label":"Réduire",onClick:t[1]||(t[1]=(...V)=>s.close&&s.close(...V))},[...t[6]||(t[6]=[e.createElementVNode("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])),t[7]||(t[7]=e.createElementVNode("div",{class:"wm-loading__spinner","aria-hidden":"true"},null,-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(l,{title:s.headerTitle,escalated:s.isEscalated,"agent-name":s.humanAgentName,"agent-avatar-url":s.humanAgentAvatarUrl,"team-members":s.teamMembers,"response-label":s.responseLabel,"show-identity":!!s.currentConv,"show-back":s.canBack,"show-close":!s.isEmbedded,"more-active":o.moreOpen,onBack:s.goHome,onMore:s.toggleMore,onClose:s.close},null,8,["title","escalated","agent-name","agent-avatar-url","team-members","response-label","show-identity","show-back","show-close","more-active","onBack","onMore","onClose"]),s.error?(e.openBlock(),e.createElementBlock("div",lo,[e.createElementVNode("div",co,[t[9]||(t[9]=e.createElementVNode("div",{class:"wm-state__errIcon"},[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})])],-1)),e.createElementVNode("div",null,[t[8]||(t[8]=e.createElementVNode("div",{class:"wm-state__errTitle"},"Connexion impossible",-1)),e.createElementVNode("div",uo,e.toDisplayString(s.error),1)])])])):s.currentConv?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createVNode(v,{ref:"messageList",messages:s.displayedMessages,"streaming-active":s.streamingActive,"date-label":s.dateLabel,"conversation-id":s.currentConv?s.currentConv.id:null,"loading-more":s.paginationState.loading,"has-more":s.paginationState.hasMore,"unread-anchor-ts":o.unreadAnchorTs,onLoadMore:s.onLoadMore},null,8,["messages","streaming-active","date-label","conversation-id","loading-more","has-more","unread-anchor-ts","onLoadMore"]),e.createElementVNode("div",mo,[s.floatVisible?(e.openBlock(),e.createElementBlock("div",ho,[s.approvalReady?(e.openBlock(),e.createBlock(g,{key:0,action:s.approvalTitle,detail:s.approvalDetail,callbacks:s.pendingApproval.callbacks,onCallback:s.onApprovalCallback},null,8,["action","detail","callbacks","onCallback"])):s.pendingForm?(e.openBlock(),e.createBlock(w,{key:s.pendingForm.message&&s.pendingForm.message.id,form:s.pendingForm.form,onSubmit:s.onFormSubmit},null,8,["form","onSubmit"])):s.showFeedback?(e.openBlock(),e.createBlock(A,{key:2,busy:o.feedbackBusy,done:o.feedbackDone,onSubmit:s.onFeedback},null,8,["busy","done","onSubmit"])):(e.openBlock(),e.createBlock(k,{key:3,items:s.suggestions,onSelect:s.onSuggestion},null,8,["items","onSelect"]))],512)):e.createCommentVNode("",!0),s.actionInFlight?(e.openBlock(),e.createElementBlock("div",po,[t[10]||(t[10]=e.createElementVNode("span",{class:"wm-actionWait__spinner","aria-hidden":"true"},null,-1)),e.createElementVNode("span",fo,e.toDisplayString(s.actionInFlightName)+" en cours, veuillez patienter…",1)])):(e.openBlock(),e.createBlock(T,{key:2,ref:"composer",modelValue:o.draft,"onUpdate:modelValue":t[2]||(t[2]=V=>o.draft=V),placeholder:s.composerPlaceholder,disabled:!!s.pendingApproval,"attach-label":"Joindre un fichier",onSend:s.onSend,onAttach:s.onAttach},null,8,["modelValue","placeholder","disabled","onSend","onAttach"]))]),o.moreOpen?(e.openBlock(),e.createBlock(b,{key:0,"can-rename":!!s.currentConv,"can-clear":!!s.currentConv,"can-export":!!s.currentConv,"notif-enabled":o.notifEnabled,"status-url":s.statusUrl,"help-url":s.helpUrl,onClose:t[3]||(t[3]=V=>o.moreOpen=!1),onNotifToggle:s.onNotifToggle,onAction:s.onMoreAction},null,8,["can-rename","can-clear","can-export","notif-enabled","status-url","help-url","onNotifToggle","onAction"])):e.createCommentVNode("",!0),o.pendingAttachments.length?(e.openBlock(),e.createElementBlock("div",_o,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.pendingAttachments,(V,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"wm-attached__chip"},[t[12]||(t[12]=e.createElementVNode("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})],-1)),e.createElementVNode("span",null,e.toDisplayString(V.name),1),e.createElementVNode("button",{type:"button","aria-label":"Retirer",onClick:D=>o.pendingAttachments.splice(x,1)},[...t[11]||(t[11]=[e.createElementVNode("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])],8,go)]))),128))])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(f,{key:1,"welcome-message":s.widgetWelcomeMessage,"agent-name":s.agentName,"quick-links":s.quickLinks,"unread-threads":s.unreadThreads,busy:o.busy,onStart:s.startConv,onSelect:s.onQuickLink,onResume:s.onDrawerPick},null,8,["welcome-message","agent-name","quick-links","unread-threads","busy","onStart","onSelect","onResume"])),o.historyOpen?(e.openBlock(),e.createBlock(M,{key:3,conversations:s.drawerConversations,"active-id":s.currentConv?s.currentConv.id:null,onClose:t[4]||(t[4]=V=>o.historyOpen=!1),onNew:s.onDrawerNew,onPick:s.onDrawerPick},null,8,["conversations","active-id","onNew","onPick"])):e.createCommentVNode("",!0),o.moreOpen&&!s.currentConv?(e.openBlock(),e.createBlock(b,{key:4,"can-rename":!1,"can-clear":!1,"can-export":!1,"notif-enabled":o.notifEnabled,"status-url":s.statusUrl,"help-url":s.helpUrl,onClose:t[5]||(t[5]=V=>o.moreOpen=!1),onNotifToggle:s.onNotifToggle,onAction:s.onMoreAction},null,8,["notif-enabled","status-url","help-url","onNotifToggle","onAction"])):e.createCommentVNode("",!0)],64))],6)):e.createCommentVNode("",!0)],2)}const De=C(ao,[["render",vo],["__scopeId","data-v-8264e504"]]),yo="0.2.27";exports.AIAvatar=j;exports.AVATAR_COLORS=W;exports.ActionResult=pe;exports.ApprovalCard=Me;exports.ArtifactFormResponse=fe;exports.ArtifactInfoCard=_e;exports.ArtifactRenderer=ve;exports.ArtifactTicket=ge;exports.AttachmentPreview=ye;exports.Bubble=we;exports.Composer=Ve;exports.DEFAULT_BASE_URL=ce;exports.Feedback=Te;exports.FormCard=xe;exports.Header=me;exports.HistoryDrawer=Oe;exports.HumanAvatar=te;exports.Launcher=de;exports.MEDIA_RECORDER_SUPPORTED=G;exports.MessageList=Ee;exports.Messenger=De;exports.MoreMenu=Ie;exports.Onboarding=he;exports.SCREEN_CAPTURE_SUPPORTED=z;exports.SuggestionChips=Se;exports.TeamAvatars=ue;exports.Typing=be;exports.VERSION=yo;exports.avatarColor=Q;exports.avatarInitials=Z;exports.captureScreenshotFile=Ne;exports.colors=S;exports.createStore=ie;exports.createTransport=ae;exports.default=De;exports.formatTime=ee;exports.guessAttachmentKind=_r;exports.pickRecorderMime=Be;exports.renderMarkdown=ke;exports.startScreenRecording=Ae;exports.tokensCss=le;exports.uuid=X;exports.v4=X;
@@ -73,4 +73,4 @@ ${o}`)}return s.join(`
73
73
 
74
74
  `)}function Qn(e,t){if(!Array.isArray(e==null?void 0:e.options))return t;const n=e.options.find(s=>(s==null?void 0:s.value)===t);return(n==null?void 0:n.label)||t}function Kh(e,t){const n=[],s=Array.isArray(e==null?void 0:e.fields)?e.fields:[];for(const r of s){if(!(r!=null&&r.key)||!(r!=null&&r.label))continue;const i=t==null?void 0:t[r.key];if(i==null||i==="")continue;let o;if(Array.isArray(i)){if(o=i.map(a=>Qn(r,String(a))).join(", "),!o)continue}else typeof i=="boolean"?o=i?"Oui":"Non":o=Qn(r,String(i));const l=r.type==="textarea"||typeof o=="string"&&(o.length>60||o.includes(`
75
75
  `));n.push({label:r.label,value:o,multiline:l})}return{kind:"form_response",data:{title:(e==null?void 0:e.title)||"Formulaire",fields:n}}}const Wh=450,zh=50,qh=900,Gh=12e3,Yh=300,Jh={name:"Messenger",components:{Launcher:gc,Header:Hc,Onboarding:cu,MessageList:Yd,Composer:gf,SuggestionChips:bf,ApprovalCard:Of,FormCard:sh,Feedback:hh,HistoryDrawer:Fh,MoreMenu:Uh},provide(){return{signAttachmentFn:e=>{var t,n;return((n=(t=this.store)==null?void 0:t.signAttachment)==null?void 0:n.call(t,e))||null}}},props:{baseUrl:{type:String,default:oo},widgetId:{type:String,default:""},userId:{type:String,default:""},userHash:{type:String,default:""},customer:{type:Object,default:null},displayMode:{type:String,default:"floating"},devtools:{type:Boolean,default:!1}},data(){return{transport:null,store:null,isOpen:!1,draft:"",busy:!1,bootError:null,pendingAttachments:[],feedbackBusy:!1,feedbackDone:!1,revealedAt:{},nextRevealAt:0,revealTimers:[],convOpenedAt:0,historyOpen:!1,moreOpen:!1,activeConvId:null,showOnboarding:!1,notifEnabled:!0,labelDismissed:!1,readState:{},unreadAnchorTs:"",floatHeight:0,floatRO:null,approvalSettled:!0,approvalSettleTimer:null,approvalLatchId:null}},computed:{isEditor(){return!!this.devtools},isEmbedded(){return this.displayMode==="embedded"},error(){var e;return this.bootError||((e=this.s)==null?void 0:e.error)||null},canBoot(){return!!(this.baseUrl&&this.widgetId&&this.userId&&this.userHash)},s(){var e;return((e=this.store)==null?void 0:e.state)||null},ready(){var e;return!!((e=this.s)!=null&&e.ready)},allConversations(){var t;const e=(t=this.s)==null?void 0:t.conversations;return Array.isArray(e)?e:[]},drawerConversations(){var n;const e=this.readState,t=((n=this.s)==null?void 0:n.messagesByConv)||{};return this.allConversations.map(s=>{const r=t[s.id]||[],i=this.convLastActivity(s,r),o=e[s.id]||"",l=this.lastMessageAuthorType(r),a=!!i&&l!=="user"&&(!o||i>o);return{...s,_preview:this.convPreview(s,r),_unread:a}})},unreadCount(){return this.drawerConversations.filter(e=>e._unread).length},unreadThreads(){var t;const e=((t=this.s)==null?void 0:t.messagesByConv)||{};return this.drawerConversations.filter(n=>n._unread).map(n=>({id:n.id,title:n.name||"Nouvelle conversation",preview:n._preview||"Nouveau message",_ts:this.convLastActivity(n,e[n.id]||[])})).sort((n,s)=>n._ts<s._ts?1:n._ts>s._ts?-1:0).slice(0,3)},latestUnread(){var n;const e=((n=this.s)==null?void 0:n.messagesByConv)||{};let t=null;for(const s of this.drawerConversations){if(!s._unread)continue;const r=this.convLastActivity(s,e[s.id]||[]);(!t||r>t.ts)&&(t={convId:s.id,preview:s._preview,ts:r})}return t},launcherPeek(){if(this.isOpen||this.isEmbedded||this.labelDismissed)return"";const e=this.latestUnread;return e?e.preview||"Vous avez un nouveau message":""},isViewingThread(){return(this.isOpen||this.isEmbedded)&&!this.historyOpen&&!!this.currentConv},currentConv(){if(this.showOnboarding)return null;const e=this.allConversations;if(!e.length)return null;if(this.activeConvId!=null){const t=e.find(n=>n.id===this.activeConvId);if(t)return t}return e[0]||null},canBack(){return!!this.currentConv},statusUrl(){var n;const e=(n=this.widget)==null?void 0:n.quick_links;if(!Array.isArray(e))return"";const t=e.find(s=>s.icon==="status"&&s.url);return(t==null?void 0:t.url)||""},helpUrl(){var n;const e=(n=this.widget)==null?void 0:n.quick_links;if(!Array.isArray(e))return"";const t=e.find(s=>(s.icon==="chat"||s.icon==="help")&&s.url);return(t==null?void 0:t.url)||""},widget(){var e,t;return((t=(e=this.s)==null?void 0:e.config)==null?void 0:t.widget)||null},widgetWelcomeMessage(){var e;return((e=this.widget)==null?void 0:e.welcome_message)||""},agentName(){var e,t,n;return((n=(t=(e=this.s)==null?void 0:e.config)==null?void 0:t.agent)==null?void 0:n.name)||""},agentAvatarUrl(){var e,t,n;return((n=(t=(e=this.s)==null?void 0:e.config)==null?void 0:t.agent)==null?void 0:n.avatar_url)||null},quickLinks(){var t;const e=(t=this.widget)==null?void 0:t.quick_links;return Array.isArray(e)?e:[]},teamMembers(){var t;const e=(t=this.widget)==null?void 0:t.team_members;return Array.isArray(e)?e:[]},responseLabel(){var e;return((e=this.widget)==null?void 0:e.response_time_label)||""},humanMessageAuthor(){var t,n,s;if(!this.currentConv)return null;const e=((t=this.s.messagesByConv)==null?void 0:t[this.currentConv.id])||[];for(let r=e.length-1;r>=0;r--)if(((s=(n=e[r])==null?void 0:n.author)==null?void 0:s.type)==="agent_human")return e[r].author;return null},humanAgentName(){var e;return((e=this.humanMessageAuthor)==null?void 0:e.name)||""},humanAgentAvatarUrl(){var e;return((e=this.humanMessageAuthor)==null?void 0:e.avatar_url)||null},isEscalated(){return!!this.humanMessageAuthor},isWaitingHuman(){var t;const e=(t=this.currentConv)==null?void 0:t.status;return e==="waiting"||e==="handled"},headerTitle(){var e,t;return((e=this.currentConv)==null?void 0:e.name)||((t=this.widget)==null?void 0:t.name)||"Nouvelle conversation"},composerPlaceholder(){return this.isEscalated&&this.humanAgentName?`Répondre à ${this.humanAgentName.split(" ")[0]}…`:this.isWaitingHuman?"Un agent prend le relais…":"Écrivez votre message…"},displayedMessages(){const e=this.currentConv;if(!e)return[];const t=r=>{var i,o,l,a;return(r==null?void 0:r.type)==="action"||(r==null?void 0:r.type)==="system"||((i=r==null?void 0:r.payload)==null?void 0:i.type)==="system"||Array.isArray((o=r==null?void 0:r.payload)==null?void 0:o.attachments)&&r.payload.attachments.length||(l=r==null?void 0:r.metadata)!=null&&l.artifact||(a=r==null?void 0:r.metadata)!=null&&a.form?!0:typeof(r==null?void 0:r.text_md)=="string"&&r.text_md.trim().length>0},n=r=>{var i;return(r==null?void 0:r.type)==="action"&&((i=r==null?void 0:r.payload)==null?void 0:i.state)==="pending"},s=this.revealedAt;return(this.s.messagesByConv[e.id]||[]).filter(r=>!n(r)).filter(r=>Hs(r)?s[r.id]>0:!0).filter(t)},streamingActive(){var n,s,r;const e=this.currentConv;return e?Object.keys(((n=this.s)==null?void 0:n.streamingByMsgId)||{}).length>0?!0:this.actionInFlight?!1:(((r=(s=this.s)==null?void 0:s.messagesByConv)==null?void 0:r[e.id])||[]).some(i=>Hs(i)&&!(this.revealedAt[i.id]>0)):!1},currentConvMessages(){var t,n,s;const e=(t=this.currentConv)==null?void 0:t.id;return e?((s=(n=this.s)==null?void 0:n.messagesByConv)==null?void 0:s[e])||[]:[]},pendingApproval(){return!this.currentConv||!this.store||this.actionInFlight?null:this.store.getPendingApproval(this.currentConv.id)},approvalReady(){return this.pendingApproval?this.pendingApproval.id===this.approvalLatchId?!0:!(this.streamingActive||!this.approvalSettled):!1},approvalTitle(){var e,t,n;return((t=(e=this.pendingApproval)==null?void 0:e.payload)==null?void 0:t.name)||((n=this.pendingApproval)==null?void 0:n.text_md)||"Confirmer l'action"},approvalDetail(){var s,r,i,o,l,a;const e=(i=(r=(s=this.pendingApproval)==null?void 0:s.payload)==null?void 0:r.pending)==null?void 0:i.user_explanation;if(typeof e=="string"&&e.trim())return e.trim();const t=(a=(l=(o=this.pendingApproval)==null?void 0:o.payload)==null?void 0:l.pending)==null?void 0:a.prepared_params;if(!t||typeof t!="object")return"";const n=Object.entries(t);return n.length?n.slice(0,2).map(([f,c])=>`${f}: ${c}`).join(" · "):""},actionInFlight(){var e,t;return!this.currentConv||!this.store?null:((t=(e=this.store).getActionInFlight)==null?void 0:t.call(e,this.currentConv.id))||null},actionInFlightName(){var t;const e=this.actionInFlight;return e?((t=e.payload)==null?void 0:t.name)||e.text_md||"Action":""},suggestions(){return!this.currentConv||!this.store?[]:this.streamingActive?[]:this.pendingForm?[]:this.store.getLatestSuggestions(this.currentConv.id)},pendingForm(){var e,t;return!this.currentConv||!this.store||this.pendingApproval||this.actionInFlight||this.streamingActive||!this.approvalSettled?null:((t=(e=this.store).getLatestForm)==null?void 0:t.call(e,this.currentConv.id))||null},showFeedback(){var t;const e=this.currentConv;return e?this.feedbackDone?!0:e.status!=="resolved"?!1:!((t=e.metadata)!=null&&t.feedback):!1},floatVisible(){return this.approvalReady||!!this.pendingForm||this.showFeedback||this.suggestions.length>0},dateLabel(){var n,s,r;const e=this.currentConv;let t=new Date;if(e){const o=((r=(((s=(n=this.s)==null?void 0:n.messagesByConv)==null?void 0:s[e.id])||[]).find(l=>l==null?void 0:l.created_at))==null?void 0:r.created_at)||e.created_at;if(o){const l=new Date(o);Number.isNaN(l.getTime())||(t=l)}}return`Aujourd'hui · ${io(t)}`},paginationState(){var n,s,r;const e=(n=this.currentConv)==null?void 0:n.id,t=e?(r=(s=this.s)==null?void 0:s.paginationByConv)==null?void 0:r[e]:null;return{loading:!!(t!=null&&t.loading),hasMore:!!(t!=null&&t.nextCursor)}}},watch:{latestUnread:{handler(e,t){if(!e){this.labelDismissed=!1;return}(!t||e.convId!==t.convId||e.ts>t.ts)&&(this.labelDismissed=!1)},deep:!0},"currentConv.id":{handler(e){this.cancelReveals(),this.revealedAt={},this.nextRevealAt=0,this.convOpenedAt=Date.now(),this.moreOpen=!1,this.resetApprovalPacing(),this.isViewingThread&&(this.unreadAnchorTs=e&&this.readState[e]||"")},immediate:!0},isViewingThread(e,t){var n;if(e&&!t){const s=(n=this.currentConv)==null?void 0:n.id;this.unreadAnchorTs=s&&this.readState[s]||""}else e||(this.unreadAnchorTs="")},pendingApproval:{handler(e,t){if(e&&!t){const n=e!=null&&e.created_at?Date.parse(e.created_at):NaN;if(!(Number.isFinite(n)&&n>=this.convOpenedAt)){this.resetApprovalPacing();return}this.bumpApprovalSettle(2600)}else!e&&t&&this.resetApprovalPacing()},immediate:!1},streamingActive(e,t){e!==t&&this.pendingApproval&&this.pendingApproval.id!==this.approvalLatchId&&this.bumpApprovalSettle()},approvalReady(e){e&&this.pendingApproval&&(this.approvalLatchId=this.pendingApproval.id)},floatVisible:{handler(e){this.$nextTick(()=>this.syncFloatObserver(e))},immediate:!0},currentConvMessages(e){var s;if(!Array.isArray(e)||!e.length)return;const t=Date.now(),n={...this.revealedAt};for(const r of e){if((r==null?void 0:r.id)==null||n[r.id]!==void 0)continue;if(!Hs(r)){n[r.id]=t;continue}const i=r!=null&&r.created_at?Date.parse(r.created_at):NaN;if(!Number.isFinite(i)||i<this.convOpenedAt){n[r.id]=t;continue}const o=typeof(r==null?void 0:r.text_md)=="string"&&r.text_md.trim().length>0,l=Array.isArray((s=r==null?void 0:r.payload)==null?void 0:s.attachments)&&r.payload.attachments.length>0;if(!o&&!l){n[r.id]=t;continue}n[r.id]=0,this.scheduleReveal(r)}this.revealedAt=n,(this.isOpen||this.isEmbedded)&&!this.historyOpen&&this.currentConv&&this.markConvRead(this.currentConv)}},async mounted(){if(console.log("[messenger] mounted",{isEditor:this.isEditor,canBoot:this.canBoot,hasBaseUrl:!!this.baseUrl,hasWidgetId:!!this.widgetId,hasUserId:!!this.userId,hasUserHash:!!this.userHash}),typeof document<"u"&&!document.getElementById(ho)){const e=document.createElement("style");e.id=ho,e.textContent=uc,document.head.appendChild(e)}this.hydrateReadState(),await this.boot(),this.isEmbedded&&this.store&&await this.open()},beforeUnmount(){this.cancelReveals(),this.disconnectFloatRO(),this.resetApprovalPacing(),this.store&&this.store.destroy()},methods:{syncFloatObserver(e){if(this.disconnectFloatRO(),!e){this.floatHeight=0;return}const t=this.$refs.floatEl;if(t){if(typeof ResizeObserver>"u"){this.floatHeight=Math.ceil(t.getBoundingClientRect().height+8);return}this.floatRO=new ResizeObserver(n=>{const s=n[0];if(!s)return;const r=Math.ceil(s.contentRect.height+8);r!==this.floatHeight&&(this.floatHeight=r,this.$nextTick(()=>{var i,o;(o=(i=this.$refs.messageList)==null?void 0:i.scrollToBottom)==null||o.call(i)}))}),this.floatRO.observe(t)}},disconnectFloatRO(){if(this.floatRO){try{this.floatRO.disconnect()}catch{}this.floatRO=null}},convLastActivity(e,t){let n=(e==null?void 0:e.last_message_at)||(e==null?void 0:e.updated_at)||(e==null?void 0:e.created_at)||"";for(const s of t)s!=null&&s.created_at&&s.created_at>n&&(n=s.created_at);return n},lastMessageAuthorType(e){var t,n;for(let s=e.length-1;s>=0;s--){const r=(n=(t=e[s])==null?void 0:t.author)==null?void 0:n.type;if(r)return r}return""},convPreview(e,t){var n,s,r;for(let i=t.length-1;i>=0;i--){const o=t[i];if(!o)continue;const l=typeof o.text_md=="string"?o.text_md.trim():"";if(l)return(((n=o.author)==null?void 0:n.type)==="user"?"Vous : ":"")+l.replace(/\s+/g," ");const a=(s=o.payload)==null?void 0:s.attachments;if(Array.isArray(a)&&a.length)return"📎 Pièce jointe"}return(e==null?void 0:e.last_message_preview)||(e==null?void 0:e.preview)||((r=e==null?void 0:e.metadata)==null?void 0:r.last_preview)||""},readStorageKey(){const e=this.widgetId||"",t=this.userId||"";return`wm:read:${e}:${t}`},hydrateReadState(){try{if(typeof localStorage>"u")return;const e=localStorage.getItem(this.readStorageKey());if(!e)return;const t=JSON.parse(e);t&&typeof t=="object"&&(this.readState=t)}catch{}},persistReadState(){try{if(typeof localStorage>"u")return;localStorage.setItem(this.readStorageKey(),JSON.stringify(this.readState))}catch{}},markConvRead(e){var s,r;if(!(e!=null&&e.id))return;const t=((r=(s=this.s)==null?void 0:s.messagesByConv)==null?void 0:r[e.id])||[],n=this.convLastActivity(e,t);n&&this.readState[e.id]!==n&&(this.readState={...this.readState,[e.id]:n},this.persistReadState())},cancelReveals(){for(const e of this.revealTimers)try{clearTimeout(e)}catch{}this.revealTimers=[]},resetApprovalPacing(){if(this.approvalSettleTimer){try{clearTimeout(this.approvalSettleTimer)}catch{}this.approvalSettleTimer=null}this.approvalSettled=!0,this.approvalLatchId=null},bumpApprovalSettle(e=800){if(this.approvalSettled=!1,this.approvalSettleTimer)try{clearTimeout(this.approvalSettleTimer)}catch{}this.approvalSettleTimer=setTimeout(()=>{this.approvalSettled=!0,this.approvalSettleTimer=null},e)},scheduleReveal(e){const t=Date.now(),n=((e==null?void 0:e.text_md)||"").length,s=Math.min(Gh,Math.max(qh,n*zh)),i=Math.max(t+Wh,this.nextRevealAt+Yh)+s;this.nextRevealAt=i;const o=Math.max(0,i-t),l=e.id,a=setTimeout(()=>{this.revealedAt={...this.revealedAt,[l]:Date.now()},this.revealTimers=this.revealTimers.filter(c=>c!==a)},o);this.revealTimers.push(a);const f=setTimeout(()=>{this.revealedAt[l]>0||(this.revealedAt={...this.revealedAt,[l]:Date.now()}),this.revealTimers=this.revealTimers.filter(c=>c!==f)},o+4e3);this.revealTimers.push(f)},async boot(){if(!this.canBoot){console.warn("[messenger] boot skipped — missing creds",{baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId,hasUserHash:!!this.userHash});return}try{console.log("[messenger] boot start",{baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId}),this.transport=ys(ic({baseUrl:this.baseUrl,widgetId:this.widgetId,userId:this.userId,userHash:this.userHash})),this.store=ys(cc(this.transport)),await this.store.start(),this.customer&&typeof this.customer=="object"&&await this.store.applyCustomer(this.customer),console.log("[ww-messenger] boot done",{ready:this.store.state.ready,error:this.store.state.error})}catch(e){console.error("[ww-messenger] bootstrap failed",e),this.bootError=(e==null?void 0:e.message)||String(e)}},async refresh(){this.store&&this.store.destroy(),this.cancelReveals(),this.revealedAt={},this.nextRevealAt=0,this.convOpenedAt=0,this.transport=null,this.store=null,this.isOpen=!1,this.draft="",this.busy=!1,this.bootError=null,this.pendingAttachments=[],this.feedbackBusy=!1,this.feedbackDone=!1,this.historyOpen=!1,this.moreOpen=!1,this.activeConvId=null,this.showOnboarding=!1,await this.boot(),this.isEmbedded&&this.store&&await this.open()},async openFromPeek(){var t,n;const e=(t=this.latestUnread)==null?void 0:t.convId;e&&e!==((n=this.currentConv)==null?void 0:n.id)&&(this.activeConvId=e,this.showOnboarding=!1),await this.open()},async open(){if(this.isOpen=!0,this.store&&this.store.setPanelOpen(!0),this.currentConv){try{await this.store.openConversation(this.currentConv.id)}catch(e){console.error("[ww-messenger] load messages failed",e)}this.markConvRead(this.currentConv)}},close(){this.isOpen=!1,this.store&&this.store.setPanelOpen(!1)},async startConv(){if(!this.busy){this.busy=!0;try{const e=await this.store.createConversation({});this.activeConvId=e.id,this.showOnboarding=!1,await this.store.openConversation(e.id),this.markConvRead(e),this.focusComposer()}catch(e){console.error("[ww-messenger] create conv failed",e),this.bootError=(e==null?void 0:e.message)||String(e)}finally{this.busy=!1}}},focusComposer(){this.$nextTick(()=>{var e;return(e=this.$refs.composer)==null?void 0:e.focus()})},toggleMore(){this.historyOpen=!1,this.moreOpen=!this.moreOpen},goHome(){this.historyOpen=!1,this.moreOpen=!1,this.activeConvId=null,this.showOnboarding=!0},async onDrawerPick(e){if(!(e!=null&&e.id)||!this.store)return;this.historyOpen=!1,this.activeConvId=e.id,this.showOnboarding=!1;try{await this.store.openConversation(e.id)}catch(n){console.error("[ww-messenger] open conv failed",n)}const t=this.allConversations.find(n=>n.id===e.id);t&&this.markConvRead(t)},async onDrawerNew(){this.historyOpen=!1,await this.startConv()},onNotifToggle(e){this.notifEnabled=!!e},async onMoreAction(e){switch(this.moreOpen=!1,e){case"history":this.historyOpen=!0;break;case"rename":await this.renameCurrentConv();break;case"clear":await this.clearCurrentConv();break;case"export":this.exportCurrentConv();break;case"status":if(this.statusUrl)try{window.open(this.statusUrl,"_blank","noopener")}catch{}break;case"help":if(this.helpUrl)try{window.open(this.helpUrl,"_blank","noopener")}catch{}break}},async renameCurrentConv(){const e=this.currentConv;if(!e||!this.store)return;let t;try{t=typeof window<"u"&&typeof window.prompt=="function"?window.prompt("Nouveau nom du fil",e.name||""):null}catch{t=null}if(t==null)return;const n=t.trim();if(!(!n||n===e.name))try{await this.store.patchConversation(e.id,{name:n})}catch(s){console.error("[ww-messenger] rename failed",s)}},async clearCurrentConv(){var n;const e=this.currentConv;!e||!this.store||!(!(typeof window<"u"&&typeof window.confirm=="function")||window.confirm("Effacer ce fil de votre côté ? Cette action ne supprime pas les messages côté agent."))||((n=this.s)!=null&&n.messagesByConv&&(this.s.messagesByConv[e.id]=[]),this.activeConvId=null,this.showOnboarding=!0)},exportCurrentConv(){var r,i,o,l,a,f;const e=this.currentConv;if(!e)return;const t=(((i=(r=this.s)==null?void 0:r.messagesByConv)==null?void 0:i[e.id])||[]).slice(),n=[`# ${e.name||"Conversation"}`,e.created_at?`Créée le : ${e.created_at}`:"",""];for(const c of t){if(!c)continue;const g=((o=c.author)==null?void 0:o.name)||(((l=c.author)==null?void 0:l.type)==="user"?"Vous":((a=c.author)==null?void 0:a.type)==="agent_human"?"Agent":((f=c.author)==null?void 0:f.type)==="agent_ia"?"Assistant IA":"Système"),S=c.created_at?new Date(c.created_at).toLocaleString("fr-FR"):"",C=(c.text_md||"").trim();C&&(n.push(`[${S}] ${g} :`),n.push(C),n.push(""))}const s=new Blob([n.join(`
76
- `)],{type:"text/plain;charset=utf-8"});try{const c=URL.createObjectURL(s),g=document.createElement("a");g.href=c,g.download=`${(e.name||"conversation").replace(/[^a-z0-9-_]+/gi,"_")}.txt`,document.body.appendChild(g),g.click(),document.body.removeChild(g),setTimeout(()=>URL.revokeObjectURL(c),1e3)}catch(c){console.error("[ww-messenger] export failed",c)}},async onSend(e){const t=this.currentConv;if(!t&&(await this.startConv(),!this.currentConv))return;const n=(this.currentConv||t).id,s=this.pendingAttachments.slice();this.pendingAttachments=[],await this.store.send(n,e,{attachments:s.length?s:void 0})},async onSuggestion(e){const t=e==null?void 0:e.label;t&&await this.onSend(t)},async onLoadMore(){var t;const e=(t=this.currentConv)==null?void 0:t.id;!e||!this.store||await this.store.loadMore(e)},async onApprovalCallback(e){const t=this.pendingApproval;t&&await this.store.clickCallback(t.id,e)},async onFormSubmit({values:e}){const t=this.pendingForm;if(!(t!=null&&t.form))return;const n=Vh(t.form,e);if(!n)return;const s=this.currentConv;s&&await this.store.send(s.id,n,{metadata:{artifact:Kh(t.form,e)}})},async onAttach(e){if(!(!e||!this.transport))try{const t=await this.transport.uploadAttachment(e);this.pendingAttachments.push({type:t.type||"file",path:t.path,name:e.name||"fichier",mime_type:e.type,size_bytes:e.size})}catch(t){console.error("[ww-messenger] attachment upload failed",t)}},async onQuickLink(e){if(e){if(e.url){try{window.open(e.url,"_blank","noopener")}catch{}return}await this.startConv(),this.currentConv&&await this.store.send(this.currentConv.id,e.label)}},async onFeedback({rating:e,comment:t}){if(this.currentConv){this.feedbackBusy=!0;try{await this.store.submitFeedback(this.currentConv.id,{rating:e,comment:t}),this.feedbackDone=!0}catch(n){console.error("[ww-messenger] feedback failed",n)}finally{this.feedbackBusy=!1}}}}},Xh={key:0,class:"wm-loading","aria-busy":"true","aria-live":"polite"},Qh={key:0,class:"wm-state"},Zh={class:"wm-state__err"},ep={class:"wm-state__errSub"},tp={class:"wm-bottom"},np={key:0,ref:"floatEl",class:"wm-float"},sp={key:1,class:"wm-actionWait",role:"status","aria-live":"polite"},rp={class:"wm-actionWait__lbl"},ip={key:1,class:"wm-attached"},op=["onClick"];function lp(e,t,n,s,r,i){const o=ge("Launcher"),l=ge("Header"),a=ge("Onboarding"),f=ge("MessageList"),c=ge("ApprovalCard"),g=ge("FormCard"),S=ge("Feedback"),C=ge("SuggestionChips"),U=ge("Composer"),O=ge("MoreMenu"),J=ge("HistoryDrawer");return m(),_("div",{class:ce(["wm-root",`wm-root--${n.displayMode}`])},[!r.isOpen&&!i.isEmbedded?(m(),pe(o,{key:0,"unread-count":i.unreadCount,peek:i.launcherPeek,onOpen:i.openFromPeek,onDismiss:t[0]||(t[0]=W=>r.labelDismissed=!0)},null,8,["unread-count","peek","onOpen"])):$("",!0),r.isOpen||i.isEmbedded?(m(),_("section",{key:1,class:ce(["wm-panel",`wm-panel--${n.displayMode}`]),style:Ne(r.floatHeight?{"--wm-float-h":r.floatHeight+"px"}:null),role:"dialog","aria-label":"Messenger"},[!i.ready&&!i.error?(m(),_("div",Xh,[i.isEmbedded?$("",!0):(m(),_("button",{key:0,type:"button",class:"wm-loading__close","aria-label":"Réduire",onClick:t[1]||(t[1]=(...W)=>i.close&&i.close(...W))},[...t[6]||(t[6]=[u("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])),t[7]||(t[7]=u("div",{class:"wm-loading__spinner","aria-hidden":"true"},null,-1))])):(m(),_(Y,{key:1},[ve(l,{title:i.headerTitle,escalated:i.isEscalated,"agent-name":i.humanAgentName,"agent-avatar-url":i.humanAgentAvatarUrl,"team-members":i.teamMembers,"response-label":i.responseLabel,"show-identity":!!i.currentConv,"show-back":i.canBack,"show-close":!i.isEmbedded,"more-active":r.moreOpen,onBack:i.goHome,onMore:i.toggleMore,onClose:i.close},null,8,["title","escalated","agent-name","agent-avatar-url","team-members","response-label","show-identity","show-back","show-close","more-active","onBack","onMore","onClose"]),i.error?(m(),_("div",Qh,[u("div",Zh,[t[9]||(t[9]=u("div",{class:"wm-state__errIcon"},[u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})])],-1)),u("div",null,[t[8]||(t[8]=u("div",{class:"wm-state__errTitle"},"Connexion impossible",-1)),u("div",ep,P(i.error),1)])])])):i.currentConv?(m(),_(Y,{key:2},[ve(f,{ref:"messageList",messages:i.displayedMessages,"streaming-active":i.streamingActive,"date-label":i.dateLabel,"conversation-id":i.currentConv?i.currentConv.id:null,"loading-more":i.paginationState.loading,"has-more":i.paginationState.hasMore,"unread-anchor-ts":r.unreadAnchorTs,onLoadMore:i.onLoadMore},null,8,["messages","streaming-active","date-label","conversation-id","loading-more","has-more","unread-anchor-ts","onLoadMore"]),u("div",tp,[i.floatVisible?(m(),_("div",np,[i.approvalReady?(m(),pe(c,{key:0,action:i.approvalTitle,detail:i.approvalDetail,callbacks:i.pendingApproval.callbacks,onCallback:i.onApprovalCallback},null,8,["action","detail","callbacks","onCallback"])):i.pendingForm?(m(),pe(g,{key:i.pendingForm.message&&i.pendingForm.message.id,form:i.pendingForm.form,onSubmit:i.onFormSubmit},null,8,["form","onSubmit"])):i.showFeedback?(m(),pe(S,{key:2,busy:r.feedbackBusy,done:r.feedbackDone,onSubmit:i.onFeedback},null,8,["busy","done","onSubmit"])):(m(),pe(C,{key:3,items:i.suggestions,onSelect:i.onSuggestion},null,8,["items","onSelect"]))],512)):$("",!0),i.actionInFlight?(m(),_("div",sp,[t[10]||(t[10]=u("span",{class:"wm-actionWait__spinner","aria-hidden":"true"},null,-1)),u("span",rp,P(i.actionInFlightName)+" en cours, veuillez patienter…",1)])):(m(),pe(U,{key:2,ref:"composer",modelValue:r.draft,"onUpdate:modelValue":t[2]||(t[2]=W=>r.draft=W),placeholder:i.composerPlaceholder,disabled:!!i.pendingApproval,"attach-label":"Joindre un fichier",onSend:i.onSend,onAttach:i.onAttach},null,8,["modelValue","placeholder","disabled","onSend","onAttach"]))]),r.moreOpen?(m(),pe(O,{key:0,"can-rename":!!i.currentConv,"can-clear":!!i.currentConv,"can-export":!!i.currentConv,"notif-enabled":r.notifEnabled,"status-url":i.statusUrl,"help-url":i.helpUrl,onClose:t[3]||(t[3]=W=>r.moreOpen=!1),onNotifToggle:i.onNotifToggle,onAction:i.onMoreAction},null,8,["can-rename","can-clear","can-export","notif-enabled","status-url","help-url","onNotifToggle","onAction"])):$("",!0),r.pendingAttachments.length?(m(),_("div",ip,[(m(!0),_(Y,null,Ce(r.pendingAttachments,(W,V)=>(m(),_("div",{key:V,class:"wm-attached__chip"},[t[12]||(t[12]=u("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})],-1)),u("span",null,P(W.name),1),u("button",{type:"button","aria-label":"Retirer",onClick:X=>r.pendingAttachments.splice(V,1)},[...t[11]||(t[11]=[u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])],8,op)]))),128))])):$("",!0)],64)):(m(),pe(a,{key:1,"welcome-message":i.widgetWelcomeMessage,"agent-name":i.agentName,"quick-links":i.quickLinks,"unread-threads":i.unreadThreads,busy:r.busy,onStart:i.startConv,onSelect:i.onQuickLink,onResume:i.onDrawerPick},null,8,["welcome-message","agent-name","quick-links","unread-threads","busy","onStart","onSelect","onResume"])),r.historyOpen?(m(),pe(J,{key:3,conversations:i.drawerConversations,"active-id":i.currentConv?i.currentConv.id:null,onClose:t[4]||(t[4]=W=>r.historyOpen=!1),onNew:i.onDrawerNew,onPick:i.onDrawerPick},null,8,["conversations","active-id","onNew","onPick"])):$("",!0),r.moreOpen&&!i.currentConv?(m(),pe(O,{key:4,"can-rename":!1,"can-clear":!1,"can-export":!1,"notif-enabled":r.notifEnabled,"status-url":i.statusUrl,"help-url":i.helpUrl,onClose:t[5]||(t[5]=W=>r.moreOpen=!1),onNotifToggle:i.onNotifToggle,onAction:i.onMoreAction},null,8,["notif-enabled","status-url","help-url","onNotifToggle","onAction"])):$("",!0)],64))],6)):$("",!0)],2)}const ap=be(Jh,[["render",lp],["__scopeId","data-v-8264e504"]]),cp="0.2.25";let yt=null,Tt=null,Us="";function up(e){if(e instanceof Element)return e;if(typeof e=="string"){const n=document.querySelector(e);if(n)return n}const t=document.createElement("div");return t.setAttribute("data-messenger-root",""),document.body.appendChild(t),t}function dp(e){return{baseUrl:String(e.baseUrl||oo).trim(),widgetId:String(e.widgetId||"").trim(),userId:String(e.userId||"").trim(),userHash:String(e.userHash||"").trim(),displayMode:e.displayMode||"floating",devtools:!!e.devtools,target:e.target||null,customer:e.customer&&typeof e.customer=="object"?e.customer:null}}function fp(e={}){const t=dp(e);if(!t.baseUrl||!t.widgetId||!t.userId||!t.userHash)return Vs(),null;const n=JSON.stringify({...t,target:typeof t.target=="string"?t.target:!!t.target});return yt&&n===Us||(Vs(),Tt=up(t.target),yt=Qa(ap,{baseUrl:t.baseUrl,widgetId:t.widgetId,userId:t.userId,userHash:t.userHash,displayMode:t.displayMode,devtools:t.devtools,customer:t.customer}),yt.mount(Tt),Us=n),yt}function Vs(){if(yt){try{yt.unmount()}catch{}yt=null}Tt&&Tt.hasAttribute&&Tt.hasAttribute("data-messenger-root")&&Tt.remove(),Tt=null,Us=""}return Ut.destroy=Vs,Ut.init=fp,Ut.version=cp,Object.defineProperty(Ut,Symbol.toStringTag,{value:"Module"}),Ut}({});
76
+ `)],{type:"text/plain;charset=utf-8"});try{const c=URL.createObjectURL(s),g=document.createElement("a");g.href=c,g.download=`${(e.name||"conversation").replace(/[^a-z0-9-_]+/gi,"_")}.txt`,document.body.appendChild(g),g.click(),document.body.removeChild(g),setTimeout(()=>URL.revokeObjectURL(c),1e3)}catch(c){console.error("[ww-messenger] export failed",c)}},async onSend(e){const t=this.currentConv;if(!t&&(await this.startConv(),!this.currentConv))return;const n=(this.currentConv||t).id,s=this.pendingAttachments.slice();this.pendingAttachments=[],await this.store.send(n,e,{attachments:s.length?s:void 0})},async onSuggestion(e){const t=e==null?void 0:e.label;t&&await this.onSend(t)},async onLoadMore(){var t;const e=(t=this.currentConv)==null?void 0:t.id;!e||!this.store||await this.store.loadMore(e)},async onApprovalCallback(e){const t=this.pendingApproval;t&&await this.store.clickCallback(t.id,e)},async onFormSubmit({values:e}){const t=this.pendingForm;if(!(t!=null&&t.form))return;const n=Vh(t.form,e);if(!n)return;const s=this.currentConv;s&&await this.store.send(s.id,n,{metadata:{artifact:Kh(t.form,e)}})},async onAttach(e){if(!(!e||!this.transport))try{const t=await this.transport.uploadAttachment(e);this.pendingAttachments.push({type:t.type||"file",path:t.path,name:e.name||"fichier",mime_type:e.type,size_bytes:e.size})}catch(t){console.error("[ww-messenger] attachment upload failed",t)}},async onQuickLink(e){if(e){if(e.url){try{window.open(e.url,"_blank","noopener")}catch{}return}await this.startConv(),this.currentConv&&await this.store.send(this.currentConv.id,e.label)}},async onFeedback({rating:e,comment:t}){if(this.currentConv){this.feedbackBusy=!0;try{await this.store.submitFeedback(this.currentConv.id,{rating:e,comment:t}),this.feedbackDone=!0}catch(n){console.error("[ww-messenger] feedback failed",n)}finally{this.feedbackBusy=!1}}}}},Xh={key:0,class:"wm-loading","aria-busy":"true","aria-live":"polite"},Qh={key:0,class:"wm-state"},Zh={class:"wm-state__err"},ep={class:"wm-state__errSub"},tp={class:"wm-bottom"},np={key:0,ref:"floatEl",class:"wm-float"},sp={key:1,class:"wm-actionWait",role:"status","aria-live":"polite"},rp={class:"wm-actionWait__lbl"},ip={key:1,class:"wm-attached"},op=["onClick"];function lp(e,t,n,s,r,i){const o=ge("Launcher"),l=ge("Header"),a=ge("Onboarding"),f=ge("MessageList"),c=ge("ApprovalCard"),g=ge("FormCard"),S=ge("Feedback"),C=ge("SuggestionChips"),U=ge("Composer"),O=ge("MoreMenu"),J=ge("HistoryDrawer");return m(),_("div",{class:ce(["wm-root",`wm-root--${n.displayMode}`])},[!r.isOpen&&!i.isEmbedded?(m(),pe(o,{key:0,"unread-count":i.unreadCount,peek:i.launcherPeek,onOpen:i.openFromPeek,onDismiss:t[0]||(t[0]=W=>r.labelDismissed=!0)},null,8,["unread-count","peek","onOpen"])):$("",!0),r.isOpen||i.isEmbedded?(m(),_("section",{key:1,class:ce(["wm-panel",`wm-panel--${n.displayMode}`]),style:Ne(r.floatHeight?{"--wm-float-h":r.floatHeight+"px"}:null),role:"dialog","aria-label":"Messenger"},[!i.ready&&!i.error?(m(),_("div",Xh,[i.isEmbedded?$("",!0):(m(),_("button",{key:0,type:"button",class:"wm-loading__close","aria-label":"Réduire",onClick:t[1]||(t[1]=(...W)=>i.close&&i.close(...W))},[...t[6]||(t[6]=[u("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])])),t[7]||(t[7]=u("div",{class:"wm-loading__spinner","aria-hidden":"true"},null,-1))])):(m(),_(Y,{key:1},[ve(l,{title:i.headerTitle,escalated:i.isEscalated,"agent-name":i.humanAgentName,"agent-avatar-url":i.humanAgentAvatarUrl,"team-members":i.teamMembers,"response-label":i.responseLabel,"show-identity":!!i.currentConv,"show-back":i.canBack,"show-close":!i.isEmbedded,"more-active":r.moreOpen,onBack:i.goHome,onMore:i.toggleMore,onClose:i.close},null,8,["title","escalated","agent-name","agent-avatar-url","team-members","response-label","show-identity","show-back","show-close","more-active","onBack","onMore","onClose"]),i.error?(m(),_("div",Qh,[u("div",Zh,[t[9]||(t[9]=u("div",{class:"wm-state__errIcon"},[u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})])],-1)),u("div",null,[t[8]||(t[8]=u("div",{class:"wm-state__errTitle"},"Connexion impossible",-1)),u("div",ep,P(i.error),1)])])])):i.currentConv?(m(),_(Y,{key:2},[ve(f,{ref:"messageList",messages:i.displayedMessages,"streaming-active":i.streamingActive,"date-label":i.dateLabel,"conversation-id":i.currentConv?i.currentConv.id:null,"loading-more":i.paginationState.loading,"has-more":i.paginationState.hasMore,"unread-anchor-ts":r.unreadAnchorTs,onLoadMore:i.onLoadMore},null,8,["messages","streaming-active","date-label","conversation-id","loading-more","has-more","unread-anchor-ts","onLoadMore"]),u("div",tp,[i.floatVisible?(m(),_("div",np,[i.approvalReady?(m(),pe(c,{key:0,action:i.approvalTitle,detail:i.approvalDetail,callbacks:i.pendingApproval.callbacks,onCallback:i.onApprovalCallback},null,8,["action","detail","callbacks","onCallback"])):i.pendingForm?(m(),pe(g,{key:i.pendingForm.message&&i.pendingForm.message.id,form:i.pendingForm.form,onSubmit:i.onFormSubmit},null,8,["form","onSubmit"])):i.showFeedback?(m(),pe(S,{key:2,busy:r.feedbackBusy,done:r.feedbackDone,onSubmit:i.onFeedback},null,8,["busy","done","onSubmit"])):(m(),pe(C,{key:3,items:i.suggestions,onSelect:i.onSuggestion},null,8,["items","onSelect"]))],512)):$("",!0),i.actionInFlight?(m(),_("div",sp,[t[10]||(t[10]=u("span",{class:"wm-actionWait__spinner","aria-hidden":"true"},null,-1)),u("span",rp,P(i.actionInFlightName)+" en cours, veuillez patienter…",1)])):(m(),pe(U,{key:2,ref:"composer",modelValue:r.draft,"onUpdate:modelValue":t[2]||(t[2]=W=>r.draft=W),placeholder:i.composerPlaceholder,disabled:!!i.pendingApproval,"attach-label":"Joindre un fichier",onSend:i.onSend,onAttach:i.onAttach},null,8,["modelValue","placeholder","disabled","onSend","onAttach"]))]),r.moreOpen?(m(),pe(O,{key:0,"can-rename":!!i.currentConv,"can-clear":!!i.currentConv,"can-export":!!i.currentConv,"notif-enabled":r.notifEnabled,"status-url":i.statusUrl,"help-url":i.helpUrl,onClose:t[3]||(t[3]=W=>r.moreOpen=!1),onNotifToggle:i.onNotifToggle,onAction:i.onMoreAction},null,8,["can-rename","can-clear","can-export","notif-enabled","status-url","help-url","onNotifToggle","onAction"])):$("",!0),r.pendingAttachments.length?(m(),_("div",ip,[(m(!0),_(Y,null,Ce(r.pendingAttachments,(W,V)=>(m(),_("div",{key:V,class:"wm-attached__chip"},[t[12]||(t[12]=u("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})],-1)),u("span",null,P(W.name),1),u("button",{type:"button","aria-label":"Retirer",onClick:X=>r.pendingAttachments.splice(V,1)},[...t[11]||(t[11]=[u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[u("path",{d:"M18 6L6 18M6 6l12 12"})],-1)])],8,op)]))),128))])):$("",!0)],64)):(m(),pe(a,{key:1,"welcome-message":i.widgetWelcomeMessage,"agent-name":i.agentName,"quick-links":i.quickLinks,"unread-threads":i.unreadThreads,busy:r.busy,onStart:i.startConv,onSelect:i.onQuickLink,onResume:i.onDrawerPick},null,8,["welcome-message","agent-name","quick-links","unread-threads","busy","onStart","onSelect","onResume"])),r.historyOpen?(m(),pe(J,{key:3,conversations:i.drawerConversations,"active-id":i.currentConv?i.currentConv.id:null,onClose:t[4]||(t[4]=W=>r.historyOpen=!1),onNew:i.onDrawerNew,onPick:i.onDrawerPick},null,8,["conversations","active-id","onNew","onPick"])):$("",!0),r.moreOpen&&!i.currentConv?(m(),pe(O,{key:4,"can-rename":!1,"can-clear":!1,"can-export":!1,"notif-enabled":r.notifEnabled,"status-url":i.statusUrl,"help-url":i.helpUrl,onClose:t[5]||(t[5]=W=>r.moreOpen=!1),onNotifToggle:i.onNotifToggle,onAction:i.onMoreAction},null,8,["notif-enabled","status-url","help-url","onNotifToggle","onAction"])):$("",!0)],64))],6)):$("",!0)],2)}const ap=be(Jh,[["render",lp],["__scopeId","data-v-8264e504"]]),cp="0.2.27";let yt=null,Tt=null,Us="";function up(e){if(e instanceof Element)return e;if(typeof e=="string"){const n=document.querySelector(e);if(n)return n}const t=document.createElement("div");return t.setAttribute("data-messenger-root",""),document.body.appendChild(t),t}function dp(e){return{baseUrl:String(e.baseUrl||oo).trim(),widgetId:String(e.widgetId||"").trim(),userId:String(e.userId||"").trim(),userHash:String(e.userHash||"").trim(),displayMode:e.displayMode||"floating",devtools:!!e.devtools,target:e.target||null,customer:e.customer&&typeof e.customer=="object"?e.customer:null}}function fp(e={}){const t=dp(e);if(!t.baseUrl||!t.widgetId||!t.userId||!t.userHash)return Vs(),null;const n=JSON.stringify({...t,target:typeof t.target=="string"?t.target:!!t.target});return yt&&n===Us||(Vs(),Tt=up(t.target),yt=Qa(ap,{baseUrl:t.baseUrl,widgetId:t.widgetId,userId:t.userId,userHash:t.userHash,displayMode:t.displayMode,devtools:t.devtools,customer:t.customer}),yt.mount(Tt),Us=n),yt}function Vs(){if(yt){try{yt.unmount()}catch{}yt=null}Tt&&Tt.hasAttribute&&Tt.hasAttribute("data-messenger-root")&&Tt.remove(),Tt=null,Us=""}return Ut.destroy=Vs,Ut.init=fp,Ut.version=cp,Object.defineProperty(Ut,Symbol.toStringTag,{value:"Module"}),Ut}({});
package/dist/messenger.js CHANGED
@@ -4836,7 +4836,7 @@ function Ni(t, e, n, a, r, s) {
4836
4836
  ], 6)) : w("", !0)
4837
4837
  ], 2);
4838
4838
  }
4839
- const zi = /* @__PURE__ */ B(Oi, [["render", Ni], ["__scopeId", "data-v-8264e504"]]), Vi = "0.2.25";
4839
+ const zi = /* @__PURE__ */ B(Oi, [["render", Ni], ["__scopeId", "data-v-8264e504"]]), Vi = "0.2.27";
4840
4840
  export {
4841
4841
  te as AIAvatar,
4842
4842
  ce as AVATAR_COLORS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_solaris/messenger-widget",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Embeddable chat messenger widget — Vue 3 library + standalone embed build. Wired to the messenger-server (HMAC + widgetId).",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",