var Mr=Object.defineProperty;var Ar=(o,s,t)=>s in o?Mr(o,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[s]=t;var oa=(o,s,t)=>(Ar(o,typeof s!="symbol"?s+"":s,t),t);import{d as gs,a as Mt,b as xt,c as Er,r as Nt,l as Dr,e as Ki,u as ls,f as $,s as Ts,g as b,h as Ta,i as hi,v as is,j as cs,m as Ir,k as Ke,n as Fr,o as Pr,p as jr,q as fe,t as He,w as a,x as d,y as e,z as F,A as p,B as I,C as O,D as Xe,E as ps,F as Pe,G as ne,H as K,T as ms,I as At,J as h,K as Ss,L as _e,M as Qe,N as Ht,O as Ye,P as ut,Q as bs,R as W,S as Ne,U as bt,V as Se,W as Ft,X as Nn,Y as Ms,Z as Ia,_ as lt,$ as Lr,a0 as da,a1 as Os,a2 as We,a3 as Ys,a4 as Rr,a5 as Br,a6 as Nr,a7 as Yi,a8 as uo,a9 as Or,aa as Zi,ab as Ji,ac as Qi,ad as Vr,ae as Ut,af as On,ag as Is,ah as Ur,ai as Xi,aj as _i,ak as Vn,al as ia,am as Gt,an as za,ao as Gr,ap as It,aq as Wr,ar as qr,as as Un,at as Wo,au as Hr,av as Xo,aw as zo,ax as Gn,ay as zr,az as Ma,aA as el,aB as qo,aC as Ko,aD as Kr,aE as tl,aF as vo,aG as Yo,aH as sl,aI as al,aJ as Yr,aK as Zr,aL as Jr,aM as Hs,aN as co,aO as Qr,aP as Xr,aQ as ed,aR as yi,aS as bi,aT as td,aU as sd,aV as ad,aW as od,aX as nd,aY as id,aZ as ld,a_ as rd,a$ as dd,b0 as ud,b1 as cd,b2 as ol,b3 as md,b4 as gd,b5 as pd,b6 as Ws,b7 as vd,b8 as fd,b9 as hd,ba as _d,bb as yd,bc as bd,bd as wd,be as nl,bf as il,bg as ll,bh as rl,bi as xd,bj as Cd,bk as kd,bl as dl,bm as ul,bn as cl,bo as wi,bp as xi,bq as $d,br as Sd,bs as ml,bt as Td,bu as Md,bv as Ad,bw as Ed,bx as Dd,by as Dn,bz as Id,bA as Fd,bB as Pd,bC as jd,bD as Ld,bE as Rd,bF as Bd,bG as Ci,bH as ki,bI as Nd,bJ as Od,bK as Vd,bL as Ud,bM as Oa,bN as $i,bO as Si,bP as Ti,bQ as Gd,bR as Wd,bS as qd,bT as Hd,bU as zd,bV as Kd,bW as Yd,bX as Zd,bY as Jd,bZ as Qd,b_ as Xd,b$ as eu,c0 as tu,c1 as su,c2 as au}from"./vendor-f9bdd444.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[s]="fc328cc1-0520-4347-bc1e-1d0abea9d0e3",o._sentryDebugIdIdentifier="sentry-dbid-fc328cc1-0520-4347-bc1e-1d0abea9d0e3")}catch{}})();(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))n(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const m of i.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&n(m)}).observe(document,{childList:!0,subtree:!0});function t(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(l){if(l.ep)return;l.ep=!0;const i=t(l);fetch(l.href,i)}})();const Va={VISITOR:"Visitor",AGENT:"Agent"},la={CHAT_AGENT_OWNER:"CHAT_AGENT_OWNER",CHAT_AGENT_ADMIN:"CHAT_AGENT_ADMIN",CHAT_AGENT_MEMBER:"CHAT_AGENT_MEMBER"},Vo={NOT_ONBOARDED:"NOT_ONBOARDED",PROFILE:"BASIC_INFO",CREATE_WIDGET:"WIDGET_CREATED",INVITE_AGENT:"INVITED_AGENT",ONBOARDED:"ONBOARDED"},Sn={PROFILE:"/onboarding/info",CREATE_WIDGET:"/onboarding/widget",INVITE_AGENT:"/onboarding/invite"},Me={CONNECT:"connect",DISCONNECT:"disconnect",AGENT_CONNECT:"agent.connect.sent",AGENT_CONNECT_ERROR:"agent.connect.error",AGENT_CONNECT_SUCCESS:"agent.connect.success",CONVERSATION_CREATE_SUCCESS:"conversation.create.success",WIDGET_MESSAGE_RECEIVED:"widget.message.received",AGENT_CONVERSATION_REFRESH:"agent.conversation.refresh.sent",AGENT_CONVERSATION_VIEWING_GET:"agent.conversation.viewing.get",AGENT_CONVERSATION_VIEWING_SENT:"agent.conversation.viewing.sent",AGENT_CONVERSATION_VIEWING_RECEIVED:"agent.conversation.viewing.received",AGENT_CONVERSATION_VIEWING_STOPPED_SENT:"agent.conversation.viewing.stopped.sent",AGENT_CONVERSATION_VIEWING_STOPPED_RECEIVED:"agent.conversation.viewing.stopped.received",AGENT_CONVERSATION_VIEWING_STOPPED_ALL_SENT:"agent.conversation.viewing.stopped.all.sent",AGENT_CONVERSATION_VIEWING_STOPPED_ALL_RECEIVE:"agent.conversation.viewing.stopped.all.received",AGENT_CONVERSATION_DELETED_SENT:"agent.conversation.deleted.sent",AGENT_CONVERSATION_DELETED_RECEIVED:"agent.conversation.deleted.received",AGENT_SEND_MESSAGE:"agent.message.sent",AGENT_MESSAGE_RECEIVED:"agent.message.received",CHANGE_CONVERSATION_STATUS:"system.message.updated.sent",CHANGE_CONVERSATION_STATUS_RECEIVED:"system.message.updated.received",CHANGE_CONVERSATION_STATUS_TRIGGERED:"system.message.triggered.received",AGENT_TOGGLE_READ_SENT:"agent.toggle.read.sent",WIDGET_MESSAGE_READ:"widget.message.read",AGENT_NOTE_UPDATE:"agent.note.update",AGENT_NOTE_UPDATED:"agent.note.updated",AGENT_TAG_RECEIVED:"agent.tag.received",AGENT_NOTE_DELETE:"agent.note.delete",AGENT_NOTE_DELETED:"agent.note.deleted",AGENT_REMINDER_TRIGGERED:"agent.reminder.triggered",AGENT_REMINDER_RECEIVED:"agent.reminder.received",AGENT_REMINDER_UPDATE:"agent.reminder.update",AGENT_REMINDER_UPDATED:"agent.reminder.updated",AGENT_REMINDER_DELETE:"agent.reminder.delete",AGENT_REMINDER_DELETED:"agent.reminder.deleted",CHANGE_CONVERSATION_ASSIGNEE:"toggle.chat.assignment.sent",CHANGE_CONVERSATION_ASSIGNEE_RECEIVED:"toggle.chat.assignment.received",CHANGE_ONLINE_STATUS:"agent.online.status.sent",CHANGE_ONLINE_STATUS_RECEIVED:"agent.online.status.received",WIDGET_PROFILE_UPDATE:"widget.profile.update.received",USER_TYPING_START:"user.typing.start",USER_TYPING_STOP:"user.typing.stop",TYPING_START:"typing.start",TYPING_STOP:"typing.stop",PAGE_VISITED:"page.visited.updated",CHAT_CONTACT_UPDATED_SENT:"chat.contact.update.sent",CHAT_CONTACT_UPDATED_RECEIVED:"chat.contact.update.received",CHAT_CONTACT_UPDATED:"update.chat.contact",CHAT_CONTACT_BLOCK:"toggle.contact.blocked.sent",MARKETPLACE_CART_UPDATED:"marketplace.cart.updated",MARKETPLACE_ORDER_CREATED:"marketplace.order.created",OFFLINE_VISITOR:"user.triggered.offline",CREATE_SEGMENT:"segment.create",NEW_SEGMENT:"segment.create.success",UPDATE_SEGMENT:"segment.update",SEGMENT_DATA_UPDATED:"segment.update.success",DELETE_SEGMENT:"segment.delete",SEGMENT_DATA_DELETED:"segment.delete.success",CREATE_CUSTOM_FIELD:"custom_field.create",UPDATE_CUSTOM_FIELD_NAME:"custom_field.name.update",UPDATE_CUSTOM_FIELD_NAME_SUCCESS:"custom_field.name.update.success",UPDATE_CUSTOM_FIELD_VALUE:"custom_field.value.update",UPDATE_CUSTOM_FIELD_VALUE_SUCCESS:"custom_field.value.update.success",DELETE_CUSTOM_FIELD_FOR_CONTACT:"custom_field.delete",DELETE_CUSTOM_FIELD_FOR_ALL_CONTACT_SUCCESS:"custom_field.delete.success",CREATE_TAG:"create.tag",UPDATE_TAG:"update.tag",UPDATE_TAG_SUCCESS:"tag.updated",DELETE_TAG:"delete.tag",DELETE_TAG_FOR_ALL_CONTACT:"tag.deleted",DEACTIVATE_AGENT:"agent.status.updated.sent",AGENT_STATUS_UPDATED_RECEIVED:"agent.status.updated.received",UPDATE_AGENT:"agent.profile.update",UPDATE_AGENT_SUCCESS:"agent.profile.updated",CANNED_RESPONSE_ORDER_UPDATE:"canned_response.order.update",CANNED_RESPONSE_ORDER_UPDATE_SUCCESS:"canned_response.order.update",CANNED_RESPONSE_FOLDER_ORDER_UPDATE:"canned_response_folder.order.update",CANNED_RESPONSE_FOLDER_ORDER_UPDATE_SUCCESS:"canned_response_folder.order.updated.success",FIRST_VISITOR_EMAIL_UPDATED:"first.visitor.email.updated",CANNED_RESPONSE_CREATED:"canned_response.create",CANNED_RESPONSE_CREATED_SUCCESS:"canned_response.created.success",CANNED_RESPONSE_UPDATE:"canned_response.update",CANNED_RESPONSE_UPDATED_SUCCESS:"canned_response.updated.success",CANNED_RESPONSE_DELETE:"canned_response.delete",CANNED_RESPONSE_DELETED_SUCCESS:"canned_response.deleted.success",CANNED_RESPONSE_FOLDER_UPDATE:"canned_response_folder.update",CANNED_RESPONSE_FOLDER_UPDATED_SUCCESS:"canned_response_folder.updated.success",CANNED_RESPONSE_FOLDER_DELETE:"canned_response_folder.delete",CANNED_RESPONSE_FOLDER_DELETED_SUCCESS:"canned_response_folder.deleted.success",SUBSCRIPTION_UPDATES:"agent.team.subscription.updated",SHOW_RATING_MODAL:"show.rating.modal"},bq=[{id:1,key:"today",name:"Today"},{id:2,key:"yesterday",name:"Yesterday"},{id:3,key:"last_7_days",name:"Last 7 days"},{id:4,key:"last_4_weeks",name:"Last 4 week"},{id:5,key:"this_month",name:"This month"},{id:6,key:"last_year",name:"Last year"},{id:7,key:"this_year",name:"This year"}];function Xt(){var g,y,c;const s=Ae().user,t=(g=s==null?void 0:s.attributes)==null?void 0:g.role,n=(y=s==null?void 0:s.attributes)==null?void 0:y.agent_id,l=(c=s==null?void 0:s.attributes)==null?void 0:c.registration_step,i=t===la.CHAT_AGENT_OWNER||t===la.CHAT_AGENT_ADMIN,m=t===la.CHAT_AGENT_OWNER,r=t===la.CHAT_AGENT_ADMIN,u=t===la.CHAT_AGENT_MEMBER||t===la.CHAT_AGENT_ADMIN;return{isOwner:m,isAdmin:r,isAgent:u,isOwnerOrAdmin:i,userRole:t,registrationStep:l,agentId:n}}const ze=gs({id:"toast",state:()=>({message:"",type:"",status:!1,timer:null}),actions:{set({message:o,type:s="success",time:t=2e3}){this.timer&&clearTimeout(this.timer),this.status=!0,this.message=o,this.type=s;const n=t;this.timer=setTimeout(()=>{this.reset()},n)},reset(){this.status=!1,this.message="",clearTimeout(this.timer)}}}),Wa=o=>o?o.replace(/[^\p{L}0-9\s]/gu,"").match(/(^\S\S?|\s\S)?/g).map(s=>s.trim()).join("").match(/(^\S|\S$)?/g).join("").toLocaleUpperCase():"",ou=(o,s,t)=>Vo.ONBOARDED===o?{completed:!0}:t?{completed:!0}:!o||o===Vo.NOT_ONBOARDED?{completed:!1,path:Sn.PROFILE}:o===Vo.PROFILE&&s?{completed:!1,path:Sn.CREATE_WIDGET}:o===Vo.CREATE_WIDGET&&s?{completed:!1,path:Sn.INVITE_AGENT}:{completed:!0},nu=o=>`<script id="chatway" async="true" src="https://cdn.chatway.app/widget.js?id=${o}"><\/script>`,iu=({typingRecords:o})=>o.length===0?"":o.length===1?`${o[0].name} is typing`:o.length===2?`${o[0].name} and ${o[1].name} are typing`:`${o[0].name}, ${o[1].name} and ${o.length-2} others are typing`,wq=o=>{const s=xt(),t=s.format("YYYY-MM-DD");switch(o){case"today":return{startDate:t,endDate:t};case"yesterday":return{startDate:s.subtract(1,"day").format("YYYY-MM-DD"),endDate:s.subtract(1,"day").format("YYYY-MM-DD")};case"last_7_days":return{startDate:s.subtract(7,"day").format("YYYY-MM-DD"),endDate:t};case"last_4_weeks":return{startDate:s.subtract(4,"week").format("YYYY-MM-DD"),endDate:t};case"this_month":return{startDate:xt(t).startOf("month").format("YYYY-MM-DD"),endDate:t};case"last_year":return{startDate:xt(t).subtract(1,"year").startOf("year").format("YYYY-MM-DD"),endDate:xt(t).subtract(1,"year").endOf("year").format("YYYY-MM-DD")};case"this_year":return{startDate:xt(t).startOf("year").format("YYYY-MM-DD"),endDate:t};default:return{startDate:xt(t).startOf("month").format("YYYY-MM-DD"),endDate:t}}},lu=o=>[...o].sort((t,n)=>{const l=t.attributes.latest_message?new Date(t.attributes.latest_message.updated_at):new Date;return(n.attributes.latest_message?new Date(n.attributes.latest_message.updated_at):new Date).getTime()-l.getTime()}),ru=(o,s)=>{const t=lu(o);if(!s||s==="all"){const n=t.filter(i=>!i.attributes.is_resolved),l=t.filter(i=>i.attributes.is_resolved);return[...n,...l]}return s==="resolved"?t.filter(n=>n.attributes.is_resolved):s==="unresolved"?t.filter(n=>!n.attributes.is_resolved):s==="starred"?t.filter(n=>n.attributes.is_bookmarked):s==="not_starred"?t.filter(n=>!n.attributes.is_bookmarked):s==="assigned_to"?t.filter(n=>n.attributes.assigned_to):s==="not_assigned"?t.filter(n=>n.attributes.not_assigned_to):s==="unassigned"?t.filter(n=>!n.attributes.assigned_to&&!n.attributes.not_assigned_to):t},du=({url:o})=>{try{return Boolean(new URL(o))}catch{return!1}},uu=({url:o})=>{if(!du({url:o}))return o;const t=o.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i);return t!=null&&t.length>2&&typeof t[2]=="string"&&t[2].length>0?t[2]:o},cu=o=>o.includes("https://")||o.includes("http://")?new URL(o).pathname:"",mu=()=>{let o;return window.location.origin==="https://go.chatway.app"?(o={apiKey:"AIzaSyDwvRhyb85_liQY2KXEL3wiIZeW1CccA04",authDomain:"chatway-prod.firebaseapp.com",projectId:"chatway-prod",storageBucket:"chatway-prod.appspot.com",messagingSenderId:"110002034514",appId:"1:110002034514:web:ab56c780af787063238c8b"},o):(o={apiKey:"AIzaSyB_NWdqU9bAIEJbS1b_UE4ForU4Ux0qjfY",authDomain:"chatway-staging.firebaseapp.com",projectId:"chatway-staging",storageBucket:"chatway-staging.appspot.com",messagingSenderId:"262126713057",appId:"1:262126713057:web:86e3b012dc534df5481fa0"},o)},Ds=function(o){const s="֑-߿‏‫‮יִ-﷽ﹰ-ﻼ";return new RegExp("^[^"+s+"]*?["+s+"]").test(o)},gl=["#373740","#F6F6F8","#9A9AA6","#E495B5","#FF5D9D","#5D6DFF","#5DC5FF","#915DFF","#DF5DFF","#FFCACA","#6BE4AA","#FFA15D","#8DE3CF","#439FA5","#D26198","#ECEE9A","#FFCC74"],Ga=[{id:"equals",name:"Equals"},{id:"does_not_equal",name:"Does not equal"},{id:"contains",name:"Contains"},{id:"does_not_contain",name:"Does not contain"},{id:"starts_with",name:"Start with"},{id:"ends_with",name:"Ends with"},{id:"contains_any_value",name:"Contains any value"},{id:"does_not_contain_any_value",name:"Does not exist for a contact"}],xq=[{id:"show_available_when_online",name:"Show online based on status"},{id:"never",name:"Never online"},{id:"always",name:"Always online"},{id:"custom",name:"Custom availability"}],us=(o,s,t)=>{if(o)return o.replace(new RegExp(s,"g"),t)},Tn=o=>{const s=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,t=o.replace(s,""),n=/(?:https?:\/\/)?(?:www\.)?([a-zA-Z0-9.-]+)\.[a-zA-Z]{2,7}(?:\/\S*)?/gi,l=t.match(n);return l?l.map(i=>i.toLowerCase().startsWith("http")?i.toLowerCase():`http://${i.toLowerCase()}`):[]},kt=()=>`${window.origin.includes("localhost")||window.origin.includes("dev")||window.origin.includes("127.0.0.1")?"staging_lv_token":"lv_token"}`,ht=o=>{o!=null&&o.error&&(console.log(o,"response in sentry"),Er(o.error.message))},gu=o=>{if(!o)return!1;const s=r=>r.match(/[A-Za-z0-9]{2}/g).map(u=>parseInt(u,16)),t=(r,u,g)=>(.299*r+.587*u+.114*g)/255,[n,l,i]=s(o);return t(n,l,i)>.5},Ka=o=>["image/jpeg","image/png","image/gif","image/webp","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","video/mp4","audio/mp3","audio/mpeg","text/plain","text/csv","application/vnd.openxmlformats-officedocument.presentationml.presentation"].some(t=>o.type.startsWith(t)),De="https://files-cdn.chatway.app/assets/",pl=["January","February","March","April","May","June","July","August","September","October","November","December"],vl=o=>{const s=o.getDate();if(s>3&&s<21)return"th";switch(s%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},In=[{name:"Sapir",src:`${De}images/randomImage.svg`},{name:"Shalo",src:`${De}images/randomImage1.svg`},{name:"Erez",src:`${De}images/randomImage2.svg`}],Ze=o=>{var t,n;const s=((n=(t=o.response)==null?void 0:t.data)==null?void 0:n.message)||"An error occurred";ze().set({message:s,type:"error"})},ua=()=>window.location.origin.includes("sp-go.chatway.app"),Ks=()=>window.location.origin.includes("sp-go.chatway.app")?!1:(Mt.set("isCookieEnabled","true",{sameSite:"none",secure:!0,domain:".chatway.app",expires:400}),Mt.set("isCookieEnabled","true",{sameSite:"none",secure:!0,domain:"localhost",expires:400}),Mt.set("isCookieEnabled","true",{sameSite:"none",secure:!0,domain:"127.0.0.1",expires:400}),Mt.get("isCookieEnabled")),yo=()=>window.wix_client!=null||sessionStorage.getItem("ch_app_wix_environment")==="true";Nt({connected:!1});const Mi=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt()),$e=Dr("https://chat.chatway.app",{autoConnect:!!Mi,extraHeaders:{Authorization:`Bearer ${Mi}`},closeOnBeforeunload:!1}),ke=Ki.create({baseURL:"https://prod-api.chatway.app/api/",headers:{"Content-Type":"application/json"}});ke.interceptors.request.use(function(o){const s=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt());return s&&(o.headers.Authorization="Bearer "+s),o},function(o){return Promise.reject(o)});ke.interceptors.response.use(function(o){return o.data},function(o){var n,l;const s=(n=o.response)==null?void 0:n.status,t=(l=o.response)==null?void 0:l.data;if([401].includes(s)&&!window.location.pathname.includes("/login")&&(localStorage.clear(),$e.disconnect(),Mt.remove(kt(),{domain:".chatway.app",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"localhost",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"127.0.0.1",sameSite:"none",secure:!0}),sessionStorage.removeItem(kt()),Ae().enableExistingUserWelcomeToProModal=!1,Ae().hasMarketplaceOnboarded=null,window.location.href="/login"),[301,302].includes(s)&&"redirect_url"in t){const i=document.createElement("a");i.target=t.target||"_blank",i.href=t.redirect_url,i.click()}return o.code==="ERR_CANCELED"?Promise.resolve({status:499}):Promise.reject(o)});class pu{getInstallationPlatforms(s){return ke.get("sites",s)}}const As=gs({id:"widget",state:()=>({id:null,attributes:null,languages:{},contact_form:[],visibilityHours:[],fileUploadUrl:"",showFullScreen:!1,widgetOnlineState:"online",hidePreviewTextPreview:!1,widgetTriggers:null,uiFlags:{isFetchingWidget:!1},show_faq:!1,faqs:[]}),actions:{resetStore(){this.id=null,this.attributes=null,this.languages={},this.fileUploadUrl="",this.uiFlags.isFetchingWidget=!1,this.showFullScreen=!1,this.visibilityHours=[],this.hidePreviewTextPreview=!1,this.contact_form=[],this.show_faq=!1,this.faqs=[]}}}),ct=gs({id:"conversation",state:()=>({allConversations:[],selectedConversation:{},firstUnreadMessage:null,conversationsMeta:{total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0},messagesMeta:{total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0},conversationColors:[],uiFlags:{isConversationsLoading:!1,isMessagesLoading:!1,isMessageSending:!1,isImageUploading:!1,isLinkPreviewLoading:!1,isBlockingContact:!1,isDeletingConversations:!1},unreadMessageCount:0,isTogglingConversationStatus:!1,isAssigningAgent:!1,presenceAgents:[],messageUnreadCount:0,linkMessageId:"",latestMessage:null,chatInputFocus:!1,currentConversationId:""}),getters:{isDemoConversation(){return!!this.allConversations.length&&this.allConversations[0].type=="demo-conversations"},currentConversation(){return this.selectedConversation.id?this.selectedConversation:this.allConversations.find(o=>{var s,t;return o.id===((t=(s=ls())==null?void 0:s.params)==null?void 0:t.id)})||{}}},actions:{resetStore(){this.allConversations=[],this.selectedConversation={},this.firstUnreadMessage=null,this.conversationsMeta={total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0},this.messagesMeta={total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0},this.conversationColors=[],this.uiFlags={isConversationsLoading:!1,isMessagesLoading:!1,isMessageSending:!1,isImageUploading:!1,isLinkPreviewLoading:!1,isBlockingContact:!1,isDeletingConversations:!1},this.unreadMessageCount=0,this.isTogglingConversationStatus=!1,this.isAssigningAgent=!1,this.messageUnreadCount=0,this.linkMessageId=""}}});function fl(){const o=$([]),s={message:"",sReminder:!1,isNote:!1,noteHtml:""};return{storeUserMessage:(m,r)=>{o.value[m]||(o.value[m]=s),o.value[m]=r},getUserMessages:m=>o.value[m]||s,resetUserMessage:m=>{o.value[m]=s},clearUserMessages:()=>{o.value=[]}}}class Aa{login({email:s,password:t,option:n}){return ke.post("login?include[]=agent&include[]=subscription&include[]=card",{email:s,password:t,...n})}register(s){return ke.post("register?include[]=agent",s)}sendPasswordResetLink({email:s}){return ke.post("password/email",{email:s})}resetPassword({token:s,password:t,password_confirmation:n,email:l}){return ke.post("password/reset",{token:s,password:t,password_confirmation:n,email:l})}changePassword({current_password:s,password:t,password_confirmation:n}){return ke.post("password/update",{current_password:s,password:t,password_confirmation:n})}logout(){const{resetStore:s}=Zt(),{clearUserMessages:t}=fl();$e.disconnect(),localStorage.clear(),sessionStorage.removeItem("dismiss-app-download"),sessionStorage.removeItem(kt()),sessionStorage.removeItem("ch_show_installation_tooltip"),s(),ct().resetStore(),As().resetStore(),t(),Mt.remove(kt(),{domain:".chatway.app",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"localhost",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"127.0.0.1",sameSite:"none",secure:!0})}gainAccess({userIdentifier:s,code:t}){return ke.post(`grant-access/page505/user/${s}/code/${t}`,"")}shopifyLogin({hmac:s,host:t,shop:n,timestamp:l,code:i,state:m,is_not_embedded:r,country:u}){return ke.post("shopify/oauth/overview",{hmac:s,host:t,shop:n,timestamp:l,code:i,state:m,is_not_embedded:r,country:u})}shopifyUserUpdate({app_bridge_session:s,email:t,password:n}){return ke.post("shopify/login",{app_bridge_session:s,email:t,password:n})}shopifyInstall(s){return ke.post("shopify/oauth/install",s)}wixInstall({token:s}){return ke.post("wix/oauth/install",{token:s})}wixLogin(s){return ke.get("wix/oauth/overview",s)}wixLoginWithInstance(s){return ke.post("wix/login-by-instance",{instance:s})}dudaLogin({site_name:s,timestamp:t,is_white_label:n,secure_sig:l,current_user_uuid:i,sdk_url:m,editor_origin:r}){return ke.post("duda/oauth/overview",{site_name:s,timestamp:t,is_white_label:n,secure_sig:l,current_user_uuid:i,sdk_url:m,editor_origin:r})}dudaRepublishSite(s){return ke.post("duda/republish-site",{site_name:s})}getProviderURL(s){return ke.get(`${s}/oauth/install`)}authViaProvider(s,t){return ke.post(`${s}/oauth/overview`,t)}squareInstall(){return ke.post("square/oauth/install")}squareLogin({code:s,state:t}){return ke.post("square/oauth/overview",{code:s,state:t})}requestAccessFromOwner(){return ke.post("agents/access")}ecwidLogin(s){return ke.post("ecwid/oauth/overview",s)}bigCartelInstall(){return ke.get("big-cartel/oauth/install")}bigCartelLogin(s){return ke.post("big-cartel/oauth/overview",s)}bigCommerceInstall(s){return ke.post("big-commerce/oauth/install",s)}bigCommerceLogin(s){return ke.post("big-commerce/oauth/overview",s)}thinkificInstall(s){return ke.post("thinkific/oauth/install",s)}thinkificLogin(s){return ke.post("thinkific/oauth/overview",s)}nuvemshopInstall(){return ke.get("nuvemshop/oauth/install")}nuvemshopLogin(s){return ke.post("nuvemshop/oauth/overview",s)}}class qs{getConversations({page:s,limit:t,type:n,search:l,segment:i}){const m={page:s,limit:t};return n==="unresolved"&&(m["filters[is_unresolved]"]=1),n==="resolved"&&(m["filters[is_resolved]"]=1),n==="starred"&&(m["filters[is_starred]"]=1),n==="not_starred"&&(m["filters[not_starred]"]=1),n==="assigned_to"&&(m["filters[assigned_to]"]=1),n==="not_assigned"&&(m["filters[not_assigned_to]"]=1),n==="unassigned"&&(m["filters[unassigned]"]=1),l&&(m.search=l),i&&(m["filters[segment]"]=i),ke.get("v2/conversations",{params:m})}getConversationById({id:s}){return ke.get(`conversations/${s}?include[]=contact`)}getMessages({id:s,page:t,limit:n=20}){return ke.get(`conversations/${s}/messages`,{params:{page:t,limit:n,"include[]":"agentMentions"}})}sendMessage({content:s,chatId:t,userId:n}){const l=new FormData;return l.append("message[content]",s),l.append("conversation_id",t),l.append("agent_id",n),ke.post("conversations/agent/messages",l)}uploadFiles(s){const t=s.map(({file:n})=>n);return ke.post("upload/files",{files:t},{headers:{"Content-Type":"multipart/form-data"}}).then(n=>n.data.attributes.urls)}toggleConversationStatus({id:s,status:t}){return ke.post(`conversations/${s}/update-system-message`,{status:t})}saveConversation({chatId:s,model:t}){return ke.post("saved-items",{model:t,model_id:s})}assignConversation({chatId:s,agentId:t}){return ke.post(`conversations/${s}/assign-unassign-chat-agent`,{agent_id:t})}unassignConversation({chatId:s}){return ke.post(`conversations/${s}/unassign-all-agents`)}linkPreview({url:s}){return ke.get(`url/preview?url=${s}`)}updateNote({content:s,message_id:t}){const n=new FormData;return n.append("message[content]",s),ke.put(`conversations/agent/messages/${t}/note`,n)}deleteNote(s){return ke.delete(`conversations/agent/messages/${s}/note`)}updateReminder({content:s,message_id:t,remindAt:n}){const l=new FormData;return l.append("message[content]",s),l.append("remind_at",n),ke.put(`conversations/agent/messages/${t}/reminder`,l)}deleteReminder(s){return ke.delete(`conversations/agent/messages/${s}/reminder`)}toggleTranslation(s,t){return ke.patch(`conversations/${s}/agent/toggle-translation`,t)}translateMessages(s,t="en"){const n=new FormData;return n.append("type","message"),s.forEach((l,i)=>{n.append(`message_ids[${i}]`,l)}),n.append("target_language",t),ke.post("translate",n)}toggleBlockContact(s){return ke.patch(`chat-contacts/${s}/toggle-blocked`)}deleteConversation(s){return ke.delete(`conversations/${s}`)}checkConversationSegment({segmentId:s,conversationId:t}){return s?ke.get(`conversations/filter?filters[segment]=${s}&conversation_id=${t}`):ke.get(`conversations/filter?conversation_id=${t}`)}}class ns{getCurrentUser(){return ke.get("profile?include[]=agent&include[]=subscription&include[]=card&include[]=marketplace_app")}updateProfileData(s){return ke.patch("profile",s)}updateProfilePassword(s){return ke.patch("update/password",s)}updateUserAvailabilityStatus(s){return ke.post("agents/update-online-status",{status:s})}onboarding(s){return ke.post("onboarding",s)}onboardingAgent(s,t,n){return ke.put(`agents/invite/${n}?expires=${s.expires}&signature=${s.signature}`,t)}uploadProfileImage({file:s,signal:t}){const n=new FormData;return n.append("file",s,s.name),ke.post("upload/photo",n,{signal:t,headers:{"Content-Type":s.type}})}getConnectedAppData(s){return ke.get("market-apps/connected",s)}signOut(){return ke.post("logout","")}deleteAccount(){return ke.delete("profile")}checkShopifyEmbedStatus(s){return ke.get("shopify/app-embedded-blocks",s)}fetchMarketPlaceLink(s){return ke.get("shopify/app-embedded-deeplink",s)}makeRating(s){return ke.post("apps/rating",s)}setReminder(s){return ke.post("apps/rating/reminder",s)}showRatingPopup(){return ke.get("show-rating-popup")}toggleTranslation(){return ke.patch("profile/toggle-translation-switcher")}updateOnboardingTourStep(s){return ke.post("update-tour-stage",s)}skipProductTour(){return ke.patch("skip-tour")}updateEmailOffileVisitorModal(){return ke.patch("update-email-offline-visitor-modal")}getAccessUrl(s){return ke.get("access-url",s)}getShopToken(s){return ke.get(s)}checkEmail(s){return ke.get("check-email-exists",s)}getWixInstanceData(s){return ke.post("wix/instance",s)}getWixAppData(s){return ke.get(`wix/instance/${s}`)}}class Rs{getAgents({page:s=1,limit:t=100}){return ke.get("agents",{params:{page:s,limit:t}})}getAgent(s){return ke.get(`agents/${s}`,{params:{include:["visibility_hours"]}})}inviteAgent(s){const t=new FormData;return t.append("agents[0][email]",s.email),t.append("agents[0][name]",s.name),t.append("agents[0][role]",s.role),ke.post("agents/invite",t)}skipInviteAgent(){return ke.post("agents/invite",{skip_onboarding:!0})}inviteAgents(s){const t=new FormData;return s.forEach((n,l)=>{t.append(`agents[${l}][name]`,n.name),t.append(`agents[${l}][email]`,n.email),t.append(`agents[${l}][role]`,n.role)}),ke.post("agents/invite",t)}updateAgent(s,t){return ke.post(`agents/${s}/update-profile`,{name:t.name,email:t.email,role:t.role,online_availability:t.online_availability,is_default:t.is_default??0,visibility_hour_timezone:t.visibility_hour_timezone,visibility_hours:t.visibility_hours,profile_photo_url:t.profile_photo_url})}deleteAgent(s){return ke.delete(`agents/${s}`)}inviteAgentDetails(s,t){return ke.get(`agents/invite/${s}`,t)}deactivateAgent(s){return ke.patch(`agents/toggle-active/${s}`)}removeAgent(s){return ke.delete(`pending/agents/${s}`)}resendAgentInvite(s){const t=new FormData;return t.append("agent_id",s),ke.post("agents/resend-invite",t,{headers:{"Content-Type":"multipart/form-data"}})}deleteAgentVisibilityHour(s,t){return ke.delete(`agent-visibility-hours/${s}`,{params:t})}updateAgentStatus(s,t){return ke.post(`agents/${s}/update-online-status`,{status:t})}}class na{getWidget(){return ke.get("/widgets?include=faqs")}getWidgetLangText(){return ke.get("widgets/lang-text")}createWidget(s){return ke.post("widgets",s)}updateWidget({widgetId:s,payload:t}){return ke.patch(`widgets/${s}?include=faqs`,t)}uploadCustomWidget({file:s}){const t=new FormData;return t.append("file",s,s.name),ke.post("upload/photo",t,{headers:{"Content-Type":s.type}})}sendInstallationCode({email:s}){return ke.post("email/embed",{email:s})}getDomains(){return ke.get("domains")}getContactFormFields(){return ke.get("/widgets/contact-form-fields")}}class Ai{getCountries(){return ke.get("countries")}getWidgetLangTexts(){return ke.get("widget-lang-texts")}getLocation(){return Ki.get("https://www.cloudflare.com/cdn-cgi/trace")}}class vu{constructor(){oa(this,"browser");oa(this,"version");oa(this,"OS");oa(this,"versionSearchString");this.browser=this.searchString(this.dataBrowser()),this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion),this.OS=this.searchString(this.dataOS())}searchString(s){for(let t=0;t<s.length;t++){const n=s[t].string,l=s[t].prop;if(this.versionSearchString=s[t].versionSearch||s[t].identity,n){if(n.indexOf(s[t].subString)!==-1)return s[t].identity}else if(l)return s[t].identity}}searchVersion(s){const t=s.indexOf(this.versionSearchString);if(t!==-1)return parseFloat(s.substring(t+this.versionSearchString.length+1))}dataBrowser(){return[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{string:navigator.userAgent,subString:"MSIE",identity:"IE10",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Trident",identity:"IE11",versionSearch:"rv"},{string:navigator.userAgent,subString:"Edge",identity:"Edge",versionSearch:"Edge"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.vendor,subString:"Camino",identity:"Camino"}]}dataOS(){return[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"macOS"},{string:navigator.userAgent,subString:"iPhone",identity:"iOS"},{string:navigator.userAgent,subString:"iPad",identity:"iOS"},{string:navigator.userAgent,subString:"iPod",identity:"iOS"},{string:navigator.userAgent,subString:"Android",identity:"Android"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]}}class Ua{updateNotificationSetting(s){return ke.post("settings",s)}updateNotificationSettings(s){const t=new FormData;return t.append(s.name,s.value),ke.post("notification-settings",t)}getAllNotificationSettings(){return ke.get("settings")}getDevices(){return ke.get("devices")}sendFirebaseToken(s){const t=new FormData;return t.append("agent_id",s.agent_id),t.append("name",`${new vu().browser}`),t.append("token",s.token),t.append("platform","web"),ke.post("devices",t)}deleteFirebaseToken(){return ke.delete("devices/7")}dontShowGlobalNotificationAgain(){return ke.patch("update/notification-modal","")}}function Zt(){const{user:o,marketPlaceUrl:s,storeName:t,token:n,isOnboardingSuccessful:l,allShopifyWithEmbeddedStatus:i,uiFlags:m,isFromSignIn:r,isShowRatingPopup:u,isFirstResolvedConversation:g,subscription:y,cardDetails:c,marketPlaceApps:w,isLoadingFullscreen:f,shopifyStore:v,isShopifyRibbonVisible:C,hasMarketplaceOnboarded:_,wixInstanceId:A,wixAppData:D,isLoadedOnShopifyDashboard:T,currentShopIdentifier:B,currentShopChannel:S,showDownloadAppPrompt:E}=Ts(Ae());function x(N){return o.value=N,N}function P(N){n.value=N}async function j(N){var L,me,G,U,R,ee;m.value.isFetchingProfile=!0;try{const{data:se,included:Y}=await new ns().getCurrentUser();let Fe={};const oe=Y.filter(le=>le.type==="agent-user"),st=Y.find(le=>le.type==="subscription"),Le=Y.find(le=>le.type==="card");if(st&&(y.value=st),Le?c.value=Le:c.value=null,oe&&oe.length){const le=oe[0].attributes;Fe={agent_id:oe[0].id,status:le.status,online_status:le.online_status,last_active_at:le.last_active_at,join_date:le.join_date,role:le.role,team_id:le.team_id}}if(o.value={id:se.id,type:se.type,attributes:{...se.attributes,...Fe}},_.value=null,T.value&&v.value){const le=Y.find(Ie=>Ie.type==="marketplace_app"&&Ie.attributes.host_url===v.value);_.value=(le==null?void 0:le.attributes)||null}if(yo()&&A.value){const le=Y.find(Ie=>Ie.type==="marketplace_app"&&Ie.attributes.identifier===A.value);_.value=(le==null?void 0:le.attributes)||null}if(S.value&&B.value){const le=Y.find(Ie=>Ie.type==="marketplace_app"&&Ie.attributes.identifier===B.value);_.value=(le==null?void 0:le.attributes)||null}Ae().enableNotificationModal=(se==null?void 0:se.attributes.enable_notification_modal)===void 0?!0:se==null?void 0:se.attributes.enable_notification_modal,m.value.isFetchingProfile=!1,N!=null&&N.isSecondCall||await de(),o.value.attributes.reg_source&&o.value.attributes.reg_source.toLowerCase()!=="chatway"&&await z(o.value.attributes.reg_source.toLowerCase()),f.value=!1,N!=null&&N.updateCustomField&&window.$chatway.updateChatwayCustomData("Plan",`${(L=Ae().subscription)==null?void 0:L.attributes.plan} ${((me=Ae().subscription)==null?void 0:me.attributes.plan_type.toLowerCase())==="free"?"":`${(G=Ae().subscription)==null?void 0:G.attributes.agents} agents`} ${(U=Ae().user)!=null&&U.attributes.has_trial&&!((R=Ae().user)!=null&&R.attributes.pro_year_trial)?"(trial)":(ee=Ae().user)!=null&&ee.attributes.pro_year_trial?"(trial 6)":""}`||"")}catch(se){console.log("err",se),f.value=!1,m.value.isFetchingProfile=!1}}async function H(N){try{const{data:L}=await new ns().updateProfileData(N);o.value&&(o.value={...o.value,attributes:{...o.value.attributes,...L.attributes}}),N.online_availability=="always"||N.online_availability=="show_available_when_online"?o.value.attributes.online_status="online":N.online_availability=="never"&&(o.value.attributes.online_status="offline"),ze().set({message:"Profile updated successfully",type:"success"})}catch(L){Ze(L)}}async function k(){try{await new ns().deleteAccount(),ze().set({message:"Account deleted successfully",type:"success"})}catch(N){Ze(N)}}async function M(N){const L={status:N};o.value&&(o.value.attributes.online_status=N),$e.emit(Me.CHANGE_ONLINE_STATUS,L,me=>{ht(me),console.log(`Emit ${Me.CHANGE_ONLINE_STATUS}:`,me)})}async function V(N){o.value&&(o.value.attributes.registration_step=N)}async function Z(N){var L;l.value=!1;try{const{data:me}=await new ns().onboarding(N);o.value&&(o.value={...o.value,attributes:{...o.value.attributes,...me.attributes,terms_accepted:!0}});const G=me.attributes.access_token;G||await j(),G&&(Ks()&&!Ae().isLoadedOnShopifyDashboard&&(Mt.set(kt(),G,{sameSite:"none",secure:!0,domain:".chatway.app",expires:400}),Mt.set(kt(),G,{sameSite:"none",secure:!0,domain:"localhost",expires:400}),Mt.set(kt(),G,{sameSite:"none",secure:!0,domain:"127.0.0.1",expires:400})),sessionStorage.setItem(kt(),G),await j(),$e.disconnect(),$e.io.opts.extraHeaders={Authorization:`Bearer ${G}`},$e.connect()),l.value=!0,Object.prototype.hasOwnProperty.call(window,"$chatway")&&(window.$chatway.updateChatwayCustomData("email",((L=o.value)==null?void 0:L.attributes.email)||""),window.$chatway.updateChatwayCustomData("name",N.name||""))}catch(me){l.value=!1,Ze(me)}}async function ae({params:N,payload:L,agentId:me}){try{return await new ns().onboardingAgent(N,L,me),await j(),"success"}catch(G){return Ze(G),"error"}}async function ce({file:N,payload:L}){try{await new ns().uploadProfileImage({file:N}).then(me=>{L.profile_photo_url=me.data.attributes.url,H(L)})}catch(me){Ze(me)}}async function J({file:N,signal:L}){try{return(await new ns().uploadProfileImage({file:N,signal:L})).data.attributes.url}catch(me){me.code!=="ERR_CANCELED"&&Ze(me)}}async function X(){try{await new ns().signOut()}catch(N){Ze(N)}}async function z(N){try{Bs().allInstallationPlatform.length||await Bs().getAllInstallationPlatforms();const L=Bs().allInstallationPlatform.filter(me=>me.attributes.channel.toLowerCase()===N);if(w.value=L,!L.length)return;s.value="",N==="shopify"&&v.value?(s.value=v.value.includes("https")||v.value.includes("http")?v.value:`https://${v.value}`,t.value=v.value):(s.value=L[0].attributes.url.includes("https")||L[0].attributes.url.includes("http")?L[0].attributes.url:`https://${L[0].attributes.url}`,t.value=L[0].attributes.url)}catch(L){Ze(L)}}async function q(){m.value.isFetchingEmbeddedStatus=!0,C.value=!0;try{Bs().allInstallationPlatform.length||await Bs().getAllInstallationPlatforms();const N=Bs().allInstallationPlatform.filter(L=>L.attributes.channel==="SHOPIFY");if(!N.length){m.value.isFetchingEmbeddedStatus=!1,i.value=[];return}if(N){const L=[];for(const me of N)try{const G={params:{shop:me.attributes.host_url}},U=await new ns().checkShopifyEmbedStatus(G);U&&L.push({url:me.attributes.url,host_url:me.attributes.host_url,attributes:U.data.attributes,activationLink:U.data.attributes.url})}catch(G){m.value.isFetchingEmbeddedStatus=!1,console.error(`Error fetching data for ${me.attributes.url}:`,G)}i.value=L}m.value.isFetchingEmbeddedStatus=!1}catch(N){if(m.value.isFetchingEmbeddedStatus=!1,!N.response)return;Ze(N)}}async function ue(N,L){var me;try{const G=new FormData;G.append("rating",N),G.append("review",L),G.append("channel",(me=o.value)==null?void 0:me.attributes.reg_source.toUpperCase()),await new ns().makeRating(G),await j()}catch(G){Ze(G)}}async function pe(N){var L;try{const me=new FormData;me.append("remind_after",N),me.append("channel",(L=o.value)==null?void 0:L.attributes.reg_source.toUpperCase()),await new ns().setReminder(me),await j()}catch(me){Ze(me)}}async function de(){try{const{data:N}=await new ns().showRatingPopup();u.value=N.attributes.show_rating_popup,g.value=N.attributes.is_first_resolved_conversation}catch(N){Ze(N)}}async function he(N){try{await new ns().updateOnboardingTourStep(N)}catch(L){Ze(L)}}async function ve(){try{await new ns().skipProductTour()}catch(N){Ze(N)}}async function be(){try{await new ns().updateEmailOffileVisitorModal()}catch(N){Ze(N)}}function re(N){o.value&&(o.value.attributes.has_skipped_tour=N)}function ie(N){o.value&&(o.value.attributes.show_email_offline_visitor_modal=N)}function xe(){o.value=null,s.value="",t.value="",n.value="",l.value=!1,m.value.isFetchingProfile=!1,r.value=!1,u.value=!1,c.value=null,y.value=null,i.value=[],_.value=null,A.value="",D.value=null,E.value=!1}return{setUser:x,setToken:P,getCurrentUser:j,updateProfileData:H,deleteAccount:k,updateUserStatus:M,updateOnboardingStep:V,onboarding:Z,onboardAgent:ae,uploadProfileImage:ce,uploadPhoto:J,logout:X,getMarketplaceUrl:z,getAllShopifyUrl:q,makeRating:ue,setReminder:pe,showRatingPopup:de,updateOnboardingTourStep:he,skipProductTour:ve,updateEmailOffileVisitorModal:be,setProductTourSkiped:re,setEmailOfflineVisitorModal:ie,resetStore:xe}}const Bs=gs({id:"installation",state:()=>({allInstallationPlatform:[],activatedDomains:[],uiFlags:{isInstallationLoading:!1}}),actions:{async getAllInstallationPlatforms(o){var t;const{getAllShopifyUrl:s}=Zt();if(!(!Ae().user||((t=Ae().user)==null?void 0:t.attributes.registration_step)==="NOT_ONBOARDED")){this.uiFlags.isInstallationLoading=!0;try{const{data:n}=await new pu().getInstallationPlatforms();this.allInstallationPlatform=n;const l=new Set,i=[];n.filter(r=>l.has(r.attributes.url)?!1:(l.add(r.attributes.url),!0)).forEach(r=>{const u=`https://${r.attributes.url}`;i.push(u)}),this.activatedDomains=i,Ae().getShopifySiteLength&&o&&await s(),this.uiFlags.isInstallationLoading=!1}catch(n){this.uiFlags.isInstallationLoading=!1,Ze(n)}}}}}),Ae=gs({id:"user",state:()=>({user:null,marketPlaceUrl:"",token:"",isOnboardingSuccessful:!1,storeName:"",embeddedStoreData:null,allShopifyWithEmbeddedStatus:[],uiFlags:{isFetchingProfile:!1,isFetchingEmbeddedStatus:!1,isFetchingEmbeddedStatusWithStoreName:!1},isFromSignIn:!1,isShowRatingPopup:!1,isFirstResolvedConversation:!1,subscription:null,showTrialCountdown:!1,cardDetails:null,isDeactivated:!1,shopifyStore:"",dudaData:null,showFailedPaymentModal:!1,marketPlaceApps:[],notificationModalClosed:!0,enableNotificationModal:!0,deactivationReason:"",enableExistingUserWelcomeToProModal:!1,showSkipTourModal:!1,showShopifyCompleteSetupModal:!1,isShopifyRibbonVisible:!1,shopifyEndpoint:"",isLoadingFullscreen:!1,hasMarketplaceOnboarded:null,openInstallationTooltip:!1,ignoreConversationCheck:!1,wixInstanceId:"",wixAppData:null,currentShopIdentifier:"",currentShopChannel:"",agentUpgradeNeeded:!1,showDownloadAppPrompt:!1}),getters:{isLoadedOnShopifyDashboard(){return window["app-bridge"]!=null},isLoadedOnDudaDashboard(){return window._dAPI!=null},isLoadedOnWixDashboard(){return window.wix_client!=null||sessionStorage.getItem("ch_app_wix_environment")==="true"},marketPlaceName(){var o,s;return this.user?(s=(o=this.user)==null?void 0:o.attributes)==null?void 0:s.reg_source.toLowerCase():""},isMarketPlace(){const o=this.marketPlaceName;return o==="shopify"||o==="wix"||o==="wordpress"||o==="duda"||o==="square"||o==="bigcartel"||o==="ecwid"||o==="bigcommerce"||o==="thinkific"||o==="nuvemshop"||o==="tiendanube"||this.isLoadedOnDudaDashboard||this.isLoadedOnShopifyDashboard},preferredChatLanguage(){var s;const o=((s=this.user)==null?void 0:s.attributes.preferred_chat_language)||"auto-detect";if(o==="auto-detect"){const t=navigator.language;return t.startsWith("zh")?t:t.split("-")[0]}return o},isProUser(){var o,s;return((o=this.subscription)==null?void 0:o.attributes.plan_type.toLowerCase())==="pro"||((s=this.user)==null?void 0:s.attributes.pro_year_trial)||!1},isProUserOrTrial(){var o,s,t;return((o=this.subscription)==null?void 0:o.attributes.plan_type.toLowerCase())==="pro"||((s=this.user)==null?void 0:s.attributes.has_trial)||((t=this.user)==null?void 0:t.attributes.pro_year_trial)||!1},isProOrProTrialUser(){var o;return((o=this.subscription)==null?void 0:o.attributes.plan_type.toLowerCase())==="pro"},hasTrial(){var o;return((o=this.user)==null?void 0:o.attributes.has_trial)||!1},hasFailedPayment(){var o;return((o=this.user)==null?void 0:o.attributes.has_failed_payment)||!1},trialDaysLeft(){var o;return((o=this.user)==null?void 0:o.attributes.trial_days_left)||0},isTrialContainerVisible(){var o,s,t,n,l;return this.hasTrial&&this.showTrialCountdown&&this.showProUpgradeRibbon&&!((o=this.user)!=null&&o.attributes.pro_year_trial)&&Xt().isOwnerOrAdmin||this.hasTrial&&this.showTrialCountdown&&((s=this.user)==null?void 0:s.attributes.pro_year_trial)&&!this.cardDetails&&((t=this.user)==null?void 0:t.attributes.trial_days_left)<15||!this.hasTrial&&((n=this.subscription)==null?void 0:n.attributes.plan_type.toLowerCase())==="free"&&this.showTrialCountdown&&this.showProUpgradeRibbon&&!((l=this.user)!=null&&l.attributes.pro_year_trial)},isFailedPaymentModalVisible(){var o;return((o=this.user)==null?void 0:o.attributes.has_failed_payment)&&this.showFailedPaymentModal||!1},productTourSteps(){const o=[{id:1,title:"Filter resolved, unresolved, starred etc.",content:"From here, you can navigate to various tabs. You can see the resolved, unresolved, or star-marked conversations. You can also create your own custom segments or choose from the existing ones."},{id:2,title:"Assign conversation and mark status",content:`You can resolve the conversation from here, and star it for quick access. When you click "Assign to," you'll see a list of all the agents to whom you can assign this conversation. <div class="bg-grey100 p-2 mt-2 rounded-xl">Resolving or assigning the conversation will not trigger notifications to your users, this action is only for internal team communication</div>`},{id:3,title:"Canned Responses, Reminders & Private Notes",content:'Create shortcuts for frequently used responses for quick access by clicking the shortcut icon.<div class="mt-4 rounded-xl">Set reminders so you do not miss out on important events like following-up with your customers.</div> <div class="mt-4 rounded-xl">You can also add private notes visible only to your internal team. Tag a teammate in a note to notify them directly.</div>'},{id:4,title:"Visitor’s panel",content:"The visitor's information will be displayed here. You will see their contact details if they submit it via contact form, you will see their contact information, as well as their location, device information, tags, and custom data. You can also see which pages they have visited."}];return this.isShopifyUser&&o.push({id:5,title:"Shopify Order & Cart Data",content:"You can view the visitor's order and cart details. You can also share these details with visitors and open it directly in the Shopify dashboard."},{id:6,title:"Share Shopify Data",content:"If you want to share a product link, collection, or coupon code from your Shopify store, click here to access them and share directly with your visitors."}),o},isProductTourCompleted(){return this.productTourCurrentStep>this.productTourSteps.length},isProductTourSkiped(){var o;return((o=this.user)==null?void 0:o.attributes.has_skipped_tour)||!1},isProductTourRunning(){return!this.isProductTourCompleted&&!this.isProductTourSkiped},productTourCurrentStep(){var o;return((o=this.user)==null?void 0:o.attributes.tour_stage)||1},showEmailOfflineVisitorModal(){var o;return((o=this.user)==null?void 0:o.attributes.show_email_offline_visitor_modal)||!1},isProductTourAndEmailModalNotVisible(){return!this.isProductTourRunning&&!this.showEmailOfflineVisitorModal},hasTrialButNotProYearTrial(){var o;return this.hasTrial&&!((o=this.user)!=null&&o.attributes.pro_year_trial)},showProUpgradeRibbon(){var o,s;return((o=this.user)==null?void 0:o.attributes.show_pro_upgrade_ribbon)||((s=this.user)==null?void 0:s.attributes.has_trial)||!1},isShopifyUser(){return this.marketPlaceName==="shopify"||this.isLoadedOnShopifyDashboard},getShopifySiteLength(){return Bs().allInstallationPlatform.filter(o=>o.attributes.channel==="SHOPIFY").length},shouldDisplayShopifyInstructionOnChatway(){if(this.shopifyStore){const o=this.allShopifyWithEmbeddedStatus.find(s=>s.host_url===this.shopifyStore);return!(o!=null&&o.attributes.is_embedded_app_enabled)}return this.allShopifyWithEmbeddedStatus.some(o=>{var s;return!o.attributes.is_embedded_app_enabled&&this.isLoadedOnShopifyDashboard||!o.attributes.is_embedded_app_enabled&&this.isShopifyUser||!o.attributes.is_embedded_app_enabled&&((s=this.user)==null?void 0:s.attributes.reg_source)==="AGENT_INVITE"})}},persist:!0}),hl=gs({id:"typings",state:()=>({typings:{}}),actions:{addUserToTyping({conversation_id:o,user_type:s,name:t,contact_id:n,agent_id:l,agent_profile_picture:i}){const m=this.typings[o]?this.typings[o]:[];!!m.filter(u=>u.user_type===Va.VISITOR&&u.contact_id===n||u.user_type===Va.AGENT&&u.agent_id===l).length||(this.typings[o]=[...m,{user_type:s,name:t,contact_id:n,agent_id:l,agent_profile_picture:i}])},deleteUserFromTyping({conversation_id:o,contact_id:s,agent_id:t}){const l=(this.typings[o]?this.typings[o]:[]).filter(i=>i.user_type===Va.VISITOR&&i.contact_id!==s||i.user_type===Va.AGENT&&i.agent_id!==t);this.typings[o]=l},toggleStartTyping({conversationId:o,agentId:s,teamId:t,userName:n,agentProfilePicture:l}){const i={name:n,conversation_id:o,user_type:Va.AGENT,agent_id:s,team_id:t,agent_profile_picture:l};$e.emit(Me.TYPING_START,i,m=>{ht(m)})},toggleStopTyping({conversationId:o,agentId:s,teamId:t,userName:n,agentProfilePicture:l}){const i={name:n,conversation_id:o,user_type:Va.AGENT,agent_id:s,team_id:t,agent_profile_picture:l};$e.emit(Me.TYPING_STOP,i,m=>{ht(m)})}}}),zs=gs({id:"notifications",state:()=>({notificationSettings:null,isPageVisible:!0,pendingUnreadMessage:null,notificationType:"",uiFlags:{isUpdatingNotificationSettings:!1,isFetchingNotificationSettings:!1},showGlobalNotificationModal:!1})});class fu{getCustomFields(){return ke.get("custom-fields")}createCustomFields(s){return ke.post("custom-fields",s)}updateCustomFields(s,t){return ke.patch("custom-fields",s,t)}deleteCustomFields(s){const t={params:s};return ke.delete("custom-fields",t)}}class Ei{getSegments(){return ke.get("segments")}getSegmentFields(){return ke.get("segments/fields")}}const hu="/assets/favicon-0a07a58f.ico",_u="/assets/messageFavicon-4956c8f6.ico",yu="/assets/notification-1e65ead0.wav";function _l(){const o=zs(),s=$(null),t=$(null),n=async()=>{if(s.value||(s.value=new(window.AudioContext||window.webkitAudioContext)),!t.value)try{const u=await(await fetch(yu)).arrayBuffer();t.value=await s.value.decodeAudioData(u)}catch(r){console.error("Error loading audio file:",r)}},l=async()=>{var r,u;(u=(r=o==null?void 0:o.notificationSettings)==null?void 0:r.attributes)!=null&&u.play_sound&&(await n(),i())},i=()=>{if(s.value&&t.value){s.value.state==="suspended"&&s.value.resume();const r=s.value.createBufferSource();r.buffer=t.value,r.connect(s.value.destination),r.start(0)}};return{playNotificationSound:l,initializeAudio:n,cleanUp:()=>{s.value&&(s.value.close(),s.value=null),t.value=null}}}function Yt(){const{allConversations:o,messagesMeta:s,unreadMessageCount:t,uiFlags:n,firstUnreadMessage:l,linkMessageId:i,latestMessage:m,selectedConversation:r}=Ts(ct()),u=b(()=>{if(!r.value.messages)return;let j="";return r.value.messages.filter(H=>!H.attributes.is_sender_agent&&H.attributes.message_body&&!H.attributes.is_chat_init_details&&!H.attributes.is_system_message).forEach(H=>{if(H.attributes.message_language!==null)return j=H.attributes.message_language,!1}),j=="ak"&&(j="tw"),j=="gom"&&(j="kok"),j=="iw"&&(j="he"),j=="jw"&&(j="jv"),j!=null&&j.startsWith("en-")&&(j="en"),j}),g=()=>{const j=o.value.reduce((H,k)=>H+(k.attributes.is_resolved?0:k.attributes.unread_messages+k.attributes.unread_notes),0);if(t.value=j,j>0){const H=`(${j} unread)`;Ta({title:H}),hi(_u)}else hi(hu)},y=async({id:j})=>{const H=o.value.find(k=>k.id===j);H&&(H.messages=[],s.value={total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0})},c=async({id:j,page:H,conversationData:k})=>{n.value.isMessagesLoading=!0;try{const{data:M,meta:V}=await new qs().getMessages({id:j,page:H}),Z=M.reverse();if(A({messages:Z,conversationId:j}),H===1){const ae=Z[Z.length-1];T({conversationId:j,messageId:ae.id})}if(s.value=V.pagination,l.value=null,k&&k.unread_messages){const ae=Z.slice(Z.length-k.unread_messages);l.value=ae[0]}n.value.isMessagesLoading=!1}catch{n.value.isMessagesLoading=!1}},w=async({conversationId:j,params:H,isNote:k=!1,isReminder:M=!1,remindAt:V=""})=>{const{updateConversation:Z}=ss(),ae=Ae();n.value.isMessageSending=!0;try{const ce=is(),J={team_id:H.teamId,agent_id:H.agentId,widget_id:H.widgetId,echo_id:ce,userType:"agent",conversation_id:j,message:{meta:H.meta,type:"text",content:H.content},...k&&{type:"note"},...M&&{type:"reminder"},...M&&{remind_at:V},...k&&{mentions:H.mentions}},X={id:ce,type:k?"note":M?"reminder":"temp_message",isTemp:!0,hasError:$e.disconnected,status:"sending",mentions:H.mentions,attributes:{agent_profle_photo:ae.user.attributes.profile_photo_url||"",message_type:k?"note":M?"reminder":"text",type:k?"note":M?"reminder":"temp_message",is_sender_agent:!0,message_body:H.content,message_created_at:new Date().toISOString(),...M&&{remind_at:V},message_sender:{id:H.agentId,name:ae.user.attributes.name||"",profile_pic_url:ae.user.attributes.profile_photo_url||""},tempMeta:{...H},meta:H.meta}};if(D({conversationId:j,tempMessage:X,isTemp:!0}),n.value.isMessageSending=!1,$e.disconnected){ht({error:{message:"Socket disconnected"}});return}$e.emit(Me.AGENT_SEND_MESSAGE,J,z=>{const{error:q}=z;if(q){v({conversationId:j,tempMessageID:ce}),n.value.isMessageSending=!1;const{message:he}=q;ze().set({message:he||"An error occurred",type:"error"}),ht(z);return}const{message:{included:ue,data:pe}}=z;m.value=pe,D({conversationId:j,tempMessageID:ce,message:pe});const de=ue.find(he=>he.id===j);return Z({conversationId:j,attributes:de.attributes}),Promise.resolve()})}catch{n.value.isMessageSending=!1}},f=({conversationId:j,messageId:H,isNote:k=!1,isReminder:M=!1,remindAt:V=""})=>{const Z=o.value.find(ce=>ce.id===j);if(!Z)return;const ae=Z.messages.findIndex(ce=>ce.id==H);if(ae>-1){const ce=Z.messages[ae];if(!ce.hasError)return;const J=ce.attributes.tempMeta;Z.messages.splice(ae,1),w({conversationId:j,params:J,isNote:k,isReminder:M,remindAt:V})}},v=({conversationId:j,tempMessageID:H})=>{const k=o.value.find(V=>V.id===j);if(!k)return;const M=k.messages.findIndex(V=>V.id==H);if(M>-1){const V=k.messages[M];V.hasError=!0}},C=async({conversationId:j,params:H,isNote:k=!1})=>{n.value.isImageUploading=!0;const M=Ae(),{updateConversation:V}=ss(),Z=URL.createObjectURL(H.file),ae=is(),ce={id:ae,type:"temp_message",isTemp:!0,hasError:$e.disconnected,status:"sending",attributes:{agent_profle_photo:M.user.attributes.profile_photo_url||"",message_type:"media",is_sender_agent:!0,message_body:null,message_created_at:new Date().toISOString(),message_urls:[{type:H.fileInfo.mime,content:Z,size:H.fileInfo.size,mime:H.fileInfo.mime,original_file_name:H.fileInfo.name}],message_sender:{name:M.user.attributes.name||"",profile_pic_url:M.user.attributes.profile_photo_url||""},...k&&{type:"note"}}};D({conversationId:j,tempMessage:ce,isTemp:!0}),n.value.isImageUploading=!1;try{const J=await new qs().uploadFiles([{file:H.file}]),X={team_id:H.teamId,agent_id:H.agentId,userType:"agent",conversation_id:j,widget_id:H.widgetId,echo_id:ae,message:{urls:[{type:H.fileInfo.mime,content:J[0],size:H.fileInfo.size,mime:H.fileInfo.mime,original_file_name:H.fileInfo.name}]},...k&&{type:"note"}};if($e.disconnected)return;$e.emit(Me.AGENT_SEND_MESSAGE,X,z=>{if(ht(z),z.error){n.value.isImageUploading=!1,v({conversationId:j,tempMessageID:ae});const{error:{message:de}}=z;ze().set({message:de||"An error occurred",type:"error"});return}const{message:{data:q,included:ue}}=z;q.attributes.message_urls[0].content=Z,D({conversationId:j,tempMessageID:ae,message:q});const pe=ue.find(de=>de.id===j);V({conversationId:j,attributes:pe.attributes}),n.value.isImageUploading=!1})}catch(J){n.value.isImageUploading=!1,Ze(J)}},_=({conversationId:j,message:H,isWidgetMessage:k,isTemp:M})=>{const V=o.value.find(ae=>ae.id===j);if(!V)return;if(H.attributes.echo_id&&!M){const ae=V.messages.findIndex(ce=>ce.attributes.echo_id===H.attributes.echo_id);if(ae>-1){V.messages.splice(ae,1,H),x(V);return}}V.messages.findIndex(ae=>ae.id===H.id)===-1&&(V.messages.push(H),x(V),k&&B())},A=({messages:j,conversationId:H})=>{const k=o.value.find(V=>V.id===H);if(!k)return;const M=j.filter(V=>(k==null?void 0:k.messages.findIndex(ae=>ae.id===V.id))===-1);k.messages.unshift(...M),x(k)},D=({conversationId:j,message:H,isTemp:k=!1,tempMessage:M=null,tempMessageID:V=null,isReceivingMessage:Z=!1})=>{const ae=o.value.find(ce=>ce.id===j);if(ae){if(ae.attributes.is_read=!1,Z){ae.messages.findIndex(J=>J.id==(H==null?void 0:H.attributes.echo_id)||J.id==(H==null?void 0:H.id))<0&&(ae.messages.push(H),x(ae));return}if(k)ae.messages.push(M),x(ae);else if(V){const ce=ae.messages.findIndex(J=>J.id==V);ce>-1?(ae.messages.splice(ce,1,H),x(ae)):(ae.messages.push(H),x(ae))}else ae.messages.push(H),x(ae)}},T=async({conversationId:j,messageId:H})=>{const{updateConversation:k}=ss(),M={conversation_id:j,message_id:H};$e.emit(Me.AGENT_TOGGLE_READ_SENT,M,V=>{if(ht(V),V.error)console.log(V.error);else{const{message:{data:Z}}=V;k({conversationId:j,attributes:Z.attributes})}}),g()},B=()=>{_l().playNotificationSound()},S=async({messageId:j,url:H})=>{i.value=j,n.value.isLinkPreviewLoading=!0;try{const k=await new qs().linkPreview({url:H}),M={url:H,preview:k};k.is_valid&&E({linkPreview:M,messageId:j}),k.is_valid||(n.value.isLinkPreviewLoading=!1,i.value="")}catch{n.value.isLinkPreviewLoading=!1,i.value=""}},E=({linkPreview:j,messageId:H})=>{var ce;if(!ct().selectedConversation){n.value.isLinkPreviewLoading=!1,i.value="";return}const M=ct().selectedConversation.messages;let V;if(V=M.find(J=>J.id===H),V||(V=M.find(J=>J.attributes.echo_id===H)),!V){n.value.isLinkPreviewLoading=!1,i.value="";return}const Z=((ce=V.attributes.message_meta)==null?void 0:ce.url_previews)||[];Z.find(J=>J.url===j.url)||(Z.push(j),V.attributes.message_meta=V.attributes.message_meta??{note_html:"",url_previews:[]},V.attributes.message_meta.url_previews=Z),n.value.isLinkPreviewLoading=!1,i.value=""},x=j=>{const H={},k=j.messages.reduce((M,V)=>{const Z=V.attributes.message_created_at;let ae=H[Z];return ae||(ae=cs(Z,"MMM DD, YYYY").value,H[Z]=ae),M[ae]||(M[ae]=[]),M[ae].push(V),M},{});j.groupedMessages=Object.keys(k).map(M=>{const V=k[M];return{messageDate:V[0].attributes.message_created_at,messages:P(V)}})},P=j=>j.sort((H,k)=>H.attributes.sort_number&&k.attributes.sort_number?H.attributes.sort_number-k.attributes.sort_number:0);return{lastMessageLanguageCode:u,getAllMessages:c,sendMessage:w,sendImage:C,updateMessage:_,addMessage:D,addMessages:A,readMessages:T,resendMessage:f,clearMessagesAndMeta:y,updateUnreadMessageCount:g,getLinkPreview:S,playAudio:B,updateLinkPreview:E,groupMessagesByDate:x}}class bu{getTags(){return ke.get("tags")}createTag(s){return ke.post("tags",s)}updateTag(s,t){return ke.put(`tags/${t}`,s,{params:s})}deleteTag(s){const t={params:s};return ke.delete("tags",t)}}const nt=Ir(),Fa=gs({id:"tags",state:()=>({tags:[],showAddTagModal:!1,showEditTagModal:!1,showDeleteTagModal:!1,isTagCreated:!1,uiFlags:{isFetchingTags:!1,isUpdatingTag:!1,isCreatingTag:!1,isDeletingTag:!1}}),actions:{async getTags(){this.uiFlags.isFetchingTags=!0;try{const{data:o}=await new bu().getTags();this.tags=o,this.uiFlags.isFetchingTags=!1,await jt().getSegmentFields()}catch(o){this.uiFlags.isFetchingTags=!1,Ze(o)}},async createTag(o){this.isTagCreated=!1,this.uiFlags.isCreatingTag=!0;const s=o.name;try{if(ct().selectedConversation.attributes.tags.filter(n=>n.name===s).length>0)return;ct().selectedConversation.attributes.tags.push({name:s,color:o.color,id:"0233"}),$e.emit(Me.CREATE_TAG,o,async n=>{if(n.error){const{message:i}=n.error;ze().set({message:i||"An error occurred",type:"error"}),this.uiFlags.isCreatingTag=!1;return}const l=ct().selectedConversation;jt().selectedSegment&&nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:l.id}),this.isTagCreated=!0,this.uiFlags.isCreatingTag=!1,await this.getTags()})}catch(t){this.uiFlags.isCreatingTag=!1,Ze(t)}},async updateTag(o){this.uiFlags.isUpdatingTag=!0,this.isTagCreated=!1;const s={name:o.name,color:o.color,tag_id:o.id};try{$e.emit(Me.UPDATE_TAG,s,async t=>{if(t.error){const{message:i}=t.error;ze().set({message:i||"An error occurred",type:"error"}),this.uiFlags.isUpdatingTag=!1;return}const n=ct().selectedConversation.attributes.tags,l=n.findIndex(i=>i.id===o.id);return n[l]={id:o.id,name:o.name,color:o.color},this.uiFlags.isUpdatingTag=!1,this.showEditTagModal=!1,await this.getTags(),Promise.resolve()})}catch(t){this.uiFlags.isUpdatingTag=!1,Ze(t)}},async deleteTag(o){this.uiFlags.isDeletingTag=!0,this.uiFlags.isUpdatingTag=!0;let s;o.delete_from_all_contact?s={name:o.name,is_delete_tag:"1"}:s={name:o.name,chat_contact_id:o.chat_contact_id};try{$e.emit(Me.DELETE_TAG,s,async t=>{if(t.error){const{message:l}=t.error;ze().set({message:l||"An error occurred",type:"error"}),this.uiFlags.isDeletingTag=!1,this.uiFlags.isUpdatingTag=!1;return}const n=ct().selectedConversation;return jt().selectedSegment&&nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:n.id}),ct().selectedConversation.attributes.tags=ct().selectedConversation.attributes.tags.filter(l=>l.name.toLowerCase()!==o.name.toLowerCase()),this.uiFlags.isDeletingTag=!1,this.uiFlags.isUpdatingTag=!1,this.showDeleteTagModal=!1,this.showEditTagModal=!1,await this.getTags(),Promise.resolve()})}catch(t){this.uiFlags.isDeletingTag=!1,this.uiFlags.isUpdatingTag=!1,Ze(t)}}}}),ys=gs({id:"agents",state:()=>({agents:[],agent:{},availabilityHours:[],isAgentInviteSuccessful:!1,uiFlags:{isFetchingAgents:!1,isResendingAgentInvite:!1,isFetchingAgentDetails:!1},agentMeta:{}}),actions:{resetStore(){this.agents=[],this.isAgentInviteSuccessful=!1,this.uiFlags={isFetchingAgents:!1,isResendingAgentInvite:!1,isFetchingAgentDetails:!1}}}}),wu=(o,s)=>{const t=[];return o.page_visited.forEach(n=>{t.push(n.page.charAt(0)===s.value.charAt(0))}),t.includes(!0)},xu=(o,s)=>{const t=[];return o.page_visited.forEach(n=>{t.push(n.page.charAt(n.page.length-1)===s.value.charAt(s.value.length-1))}),t.includes(!0)},Cu=(o,s)=>{const t=[];return o.page_visited.forEach(n=>{t.push(n.page.includes(s.value))}),t.includes(!0)},ku=(o,s)=>{const t=[];return o.page_visited.forEach(n=>{t.push(!n.page.includes(s.value))}),t.includes(!0)},Di=(o,s)=>{const t=jt().selectedSegment,n=ct().allConversations.find(i=>i.id===o)||s,l=[];return!t.id&&!n?!1:(t.attributes.rules.forEach(i=>{var m;if(i.field_type==="custom_field"){const r=(m=n==null?void 0:n.attributes)==null?void 0:m.custom_data.find(u=>u.name===i.field);if(!r)l.push(!r&&i.conditional_op==="does_not_contain_any_value");else switch(i.conditional_op){case"equals":l.push(r.value===i.value);break;case"does_not_equal":l.push(r.value!==i.value);break;case"contains":l.push(r.value.includes(i.value));break;case"does_not_contain":l.push(!r.value.includes(i.value));break;case"starts_with":l.push(r.value.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.value.charAt(r.value.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.value!=="");break;case"does_not_contain_any_value":l.push(r.value==="");break;default:l.push(!1)}}if(i.field_type==="chat_contact"){const r=n==null?void 0:n.attributes.contact;if(i.field==="email")switch(i.conditional_op){case"equals":l.push(r.email===i.value);break;case"does_not_equal":l.push(r.email!==i.value);break;case"contains":l.push(r.email.includes(i.value));break;case"does_not_contain":l.push(!r.email.includes(i.value));break;case"starts_with":l.push(r.email.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.email.charAt(r.email.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.email!=="");break;case"does_not_contain_any_value":l.push(r.email==="");break;default:l.push(!1)}else if(i.field==="phone")switch(i.conditional_op){case"equals":l.push(r.name===i.value);break;case"does_not_equal":l.push(r.name!==i.value);break;case"contains":l.push(r.name.includes(i.value));break;case"does_not_contain":l.push(!r.name.includes(i.value));break;case"starts_with":l.push(r.name.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.name.charAt(r.name.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.name!=="");break;case"does_not_contain_any_value":l.push(r.name==="");break;default:l.push(!1)}else if(i.field==="location")switch(i.conditional_op){case"equals":l.push(r.location===i.value);break;case"does_not_equal":l.push(r.location!==i.value);break;case"contains":l.push(r.location.includes(i.value));break;case"does_not_contain":l.push(!r.location.includes(i.value));break;case"starts_with":l.push(r.location.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.location.charAt(r.location.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.location!=="");break;case"does_not_contain_any_value":l.push(r.location==="");break;default:l.push(!1)}else if(i.field==="browser_type")switch(i.conditional_op){case"equals":l.push(r.browser_type===i.value);break;case"does_not_equal":l.push(r.browser_type!==i.value);break;case"contains":l.push(r.browser_type.includes(i.value));break;case"does_not_contain":l.push(!r.browser_type.includes(i.value));break;case"starts_with":l.push(r.browser_type.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.browser_type.charAt(r.location.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.browser_type!=="");break;case"does_not_contain_any_value":l.push(r.browser_type==="");break;default:l.push(!1)}else if(i.field==="ip")switch(i.conditional_op){case"equals":l.push(r.ip===i.value);break;case"does_not_equal":l.push(r.ip!==i.value);break;case"contains":l.push(r.ip.includes(i.value));break;case"does_not_contain":l.push(!r.ip.includes(i.value));break;case"starts_with":l.push(r.ip.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.ip.charAt(r.location.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.ip!=="");break;case"does_not_contain_any_value":l.push(r.ip==="");break;default:l.push(!1)}else if(i.field==="operating_system")switch(i.conditional_op){case"equals":l.push(r.operating_system===i.value);break;case"does_not_equal":l.push(r.operating_system!==i.value);break;case"contains":l.push(r.operating_system.includes(i.value));break;case"does_not_contain":l.push(!r.operating_system.includes(i.value));break;case"starts_with":l.push(r.operating_system.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.operating_system.charAt(r.location.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.operating_system!=="");break;case"does_not_contain_any_value":l.push(r.operating_system==="");break;default:l.push(!1)}else if(i.field==="last_active_at")switch(i.conditional_op){case"equals":l.push(r.last_active_at===i.value);break;case"does_not_equal":l.push(r.last_active_at!==i.value);break;case"contains":l.push(r.last_active_at.includes(i.value));break;case"does_not_contain":l.push(!r.last_active_at.includes(i.value));break;case"starts_with":l.push(r.last_active_at.charAt(0)===i.value.charAt(0));break;case"ends_with":l.push(r.last_active_at.charAt(r.location.length-1)===i.value.charAt(i.value.length-1));break;case"contains_any_value":l.push(r.last_active_at!=="");break;case"does_not_contain_any_value":l.push(r.last_active_at==="");break;default:l.push(!1)}else if(i.field==="page_visited"){const u=r.page_visited.find(g=>g.page===i.value);switch(i.conditional_op){case"equals":l.push(!!u);break;case"does_not_equal":l.push(!u);break;case"contains":l.push(Cu(r,i));break;case"does_not_contain":l.push(ku(r,i));break;case"starts_with":l.push(wu(r,i));break;case"ends_with":l.push(xu(r,i));break;case"contains_any_value":l.push(r.page_visited.length>0);break;case"does_not_contain_any_value":l.push(r.page_visited.length===0);break;default:l.push(!1)}}else if(i.field==="country")switch(i.conditional_op){case"equals":l.push(r.country===i.value);break;case"does_not_equal":l.push(r.country!==i.value);break;default:l.push(!1)}else if(i.field==="online_status")switch(i.conditional_op){case"equals":l.push(r.online_status===i.value);break;case"does_not_equal":l.push(r.online_status!==i.value);break;default:l.push(!1)}else if(i.field==="language")switch(i.conditional_op){case"equals":l.push(r.country===i.value);break;case"does_not_equal":l.push(r.country!==i.value);break;default:l.push(!1)}else l.push(!1)}if(i.field_type==="tags"){const r=n==null?void 0:n.attributes.tags.find(u=>u.name===i.field);if(!r)return!1;switch(i.conditional_op){case"equals":l.push(r.name===i.value);break;case"does_not_equal":l.push(r.name!==i.value);break;default:l.push(!1)}}}),t.attributes.rules.length>1&&t.attributes.rules[1].logical_op==="and"?l.every(i=>i):l.includes(!0))},Mn=[{type:"demo-conversations",id:"f116488b-9721-4c48-9f59-f3f0d206ebb3",attributes:{is_resolved:!1,resolved_at:null,contact_id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",contact:{id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",team_id:"07ceb61f-41a1-4d07-98a0-b0abde259173",widget_id:0,is_name_updated:!1,name:"John Smith",email:"example@gmail.com",phone:null,preferred_chat_language:"en",bgcolor:"#FF7043",location:"NY",browser_type:"Chrome 129",operating_system:"macOS",ip:"999.999.999.999",language:"en-US",country:"US",page_visited:[{date:"2024-03-21",page:"https://example.com"}],timezone:"America/New_York",contact_type:"visitor",online_status:"online",last_active_at:"2024-03-08T12:37:36.000000Z",blocked_at:null,deleted_at:null,src:"chatway",country_details:{id:109,name:"United States",code:"US",emoji:"🇺🇸",unicode:"U+1F1FA U+1F1F8",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/US.png",is_taxable:0,tax_rate:null,gateway_tax_identifier:null,created_at:"2023-03-29T09:39:16.000000Z",updated_at:"2023-03-29T09:39:16.000000Z"},conversations:[{id:"f666488b-9721-4c48-9f59-f3f0d206ebb3",team_id:"06beb61f-41a1-4d07-98a0-b0abde259173",widget_id:0,chat_contact_id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",social_account_identifier:null,identifier:null,origin_url:"",is_resolved:!1,resolved_by:null,resolved_at:null,created_at:"2024-03-05T14:33:02.000000Z",updated_at:"2024-03-05T14:33:02.000000Z",deleted_at:null,origin:null,email_subject:null,should_translate_messages:!1}],tags:[],custom_field_alloted:[]},total_messages_count:1,latest_message:{id:"889fbec7-3d4c-4451-b2bf-da48d1c03151",sort_number:"1709649222175",origin:"chat",parent_id:null,content:"Hello, I'm a demo user created by Chatway to guide you through the onboarding process.",scheduled_at:null,sent_at:null,translations:null,message_language:null,meta:{url_previews:[]},type:null,conversation_id:"f666488b-9721-4c48-9f59-f3f0d206ebb3",chat_contact_id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",agent_id:null,urls:null,echo_id:null,ip:"999.999.999.999",is_system_message:!1,created_at:"2024-03-05T14:33:42.000000Z",updated_at:"2024-03-05T14:33:44.000000Z",deleted_at:null,edited_at:null,scheduled_for_mail_at:null,notified_on_mail_at:null,is_chat_init_details:0,contact_name:"Demo Visitor",contact:{id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",team_id:"07ceb61f-41a1-4d07-98a0-b0abde259173",widget_id:884,is_name_updated:!0,name:"Demo Visitor",email:"example@gmail.com",phone:null,preferred_chat_language:"en",bgcolor:"#FF7043",location:"CDG",browser_type:"Chrome 122",operating_system:"macOS",ip:"105.113.96.17",language:"en",country:"NG",page_visited:[],timezone:"Asia/Jerusalem",contact_type:"visitor",online_status:"offline",last_active_at:"2024-03-08T12:37:36.000000Z",blocked_at:null,created_at:"2024-03-05T14:32:59.000000Z",updated_at:"2024-03-14T07:21:33.000000Z",deleted_at:null,src:"chatway",social_account_identifier:null,identifier:null}},message_urls:null,is_bookmarked:!1,agents:[],origin:"",agent_read_till:"",chat_contact_read_till:"",unread_messages:0,latest_active_agent:{},tags:[],translation_setting:!1,scheduled_messages_count:0,unread_notes:0,has_unread_note_tags:!1,has_month_old_messages:!1},messages:[]}],$u=[{type:"conversation_messages",id:"889fbec7-3d4c-4451-b2bf-da48d1c03151",attributes:{conversation_id:"f116488b-9721-4c48-9f59-f3f0d206ebb3",is_system_message:!1,is_chat_init_details:0,origin:"chat",type:"message",message_type:"message",message_body:"Hello, I'm a demo user created by Chatway to guide you through the onboarding process.",message_meta:{url_previews:[]},message_sender:{id:"992ba79d-d74e-4412-90b5-2ccd78c2b716",team_id:"07ceb61f-41a1-4d07-98a0-b0abde259173",widget_id:884,is_name_updated:!0,name:"Demo Visitor",email:"example@gmail.com",phone:null,preferred_chat_language:"en",bgcolor:"#FF7043",location:"CDG",browser_type:"Chrome 122",operating_system:"macOS",ip:"105.113.96.17",language:"en",country:"NG",page_visited:[],timezone:"Asia/Jerusalem",contact_type:"visitor",online_status:"online",last_active_at:"2024-03-15T11:50:24.000000Z",blocked_at:null,created_at:"2024-03-15T11:48:52.000000Z",updated_at:"2024-03-15T12:21:03.000000Z",deleted_at:null,src:"chatway",social_account_identifier:null,identifier:null},agent_profle_photo:null,message_urls:null,is_sender_agent:!1,message_created_at:"2024-03-15T11:50:23.000000Z",echo_id:null,message_language:null,translations:[],is_read_by_visitor:null,send_at:null,scheduled_at:null,parent_id:null},relationships:{agentMentions:{data:[]}}}];function ss(){const{allConversations:o,selectedConversation:s,conversationsMeta:t,uiFlags:n,presenceAgents:l,isAssigningAgent:i,isTogglingConversationStatus:m}=Ts(ct()),r=async({page:X,limit:z,type:q,search:ue,segment:pe,keepConversations:de=[]})=>{const{updateUnreadMessageCount:he}=Yt();n.value.isConversationsLoading=!0;try{const{data:ve,meta:be}=await new qs().getConversations({page:X,limit:z,type:q,search:ue,segment:pe}),re=ve.map(ie=>({...ie,attributes:{...ie.attributes,custom_data:[]},messages:[]}));if(X===1){const xe=[...o.value.filter(N=>de.includes(N.id)),...re].filter((N,L,me)=>me.findIndex(G=>G.id===N.id)===L);o.value=[...xe]}else f(re);t.value=be.pagination,n.value.isConversationsLoading=!1,he()}catch{n.value.isConversationsLoading=!1}},u=async(X,z)=>{try{const q=await new qs().checkConversationSegment({conversationId:z,segmentId:X}),ue=o.value.findIndex(de=>de.id===z),pe=o.value[ue];q.data.attributes.fits_to_criteria?ue!==-1&&(pe.notVisible=!1):ue!==-1&&(pe.notVisible=!0)}catch(q){Ze(q)}},g=()=>{f(Mn),x(Mn[0]),Yt().addMessages({messages:$u,conversationId:Mn[0].id})},y=X=>{l.value.findIndex(q=>q.conversation_id==X.conversation_id&&q.agent_id==X.agent_id)>-1||l.value.push(X)},c=X=>{const z=l.value.findIndex(q=>q.conversation_id==X.conversation_id&&q.agent_id==X.agent_id);z<0||l.value.splice(z,1)},w=X=>{l.value.filter(z=>z.agent_id==X.agent_id).forEach(z=>{const q=l.value.findIndex(ue=>ue.agent_id==z.agent_id);l.value.splice(q,1)})},f=X=>{X.forEach(z=>{const q=o.value.findIndex(ue=>ue.id===z.id);q<0?o.value.push(z):o.value[q]=Ke.merge(z,o.value[q])})},v=X=>{if(jt().selectedSegment.id&&!Di(X.id,X)){console.log("Segment rule not valid",X.id);return}const z=X;if(z.messages=[],o.value.find(ue=>ue.id===X.id)){console.log("Conversation already exist",X.id);return}o.value.unshift(z)},C=async()=>{t.value={total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0}},_=async(X=[])=>{const z=o.value.filter(q=>X.includes(q.id));o.value=[...z],t.value={total:0,count:0,page:0,per_page:0,current_page:0,total_pages:0}},A=async({id:X,isCustomData:z})=>{try{const{data:q,included:ue}=await new qs().getConversationById({id:X}),pe=ue.filter(ie=>ie.type==="customfield"),de=ue.filter(ie=>ie.type==="tag"),he=ue.find(ie=>ie.type==="contact");he&&(he.attributes.src=q.attributes.contact.src);const ve=P(pe,he),be=j(de,he),re=[{...q,attributes:{...q.attributes,contact:he?he.attributes:q.attributes.contact,custom_data:ve,tags:be},messages:[]}];return x(re[0]),z?void 0:(f(re),Promise.resolve())}catch{window.location.href="/"}},D=async({conversationId:X,agentId:z,teamId:q})=>{const{updateMessage:ue,readMessages:pe}=Yt();i.value=!0;const de=is(),he={conversation_id:X,agent_id:z,team_id:q,echo_id:de},be=ys().agents.find(N=>N.id===z),re=s.value.attributes.agents.findIndex(N=>N.id===z),ie={id:de,type:"temp_message",isTemp:!0,attributes:{message_type:null,echo_id:de,is_sender_agent:!0,is_system_message:!0,message_body:`${be==null?void 0:be.attributes.name} was ${re>-1?"unassigned from":"assigned to"} this conversation`,message_created_at:new Date().toISOString(),message_sender:{name:Ae().user.attributes.name||"",profile_pic_url:Ae().user.attributes.profile_photo_url||""}}},xe={id:be.id,name:be.id,online_status:be.attributes.online_status,profile_photo_url:be.attributes.profile_photo_url};re<0?s.value.attributes.agents.push(xe):s.value.attributes.agents.splice(re,1),ue({conversationId:X,message:ie,isTemp:!0}),S({conversationId:X,attributes:s.value.attributes}),$e.emit(Me.CHANGE_CONVERSATION_ASSIGNEE,he,N=>{var se,Y,Fe,oe,st,Le;ht(N);const{data:L,included:me}=N.message,G=me[0],U=G.attributes.agents,R=ct().selectedConversation,ee=o.value.findIndex(le=>le.id===X);o.value[ee].attributes.agents=U,ue({conversationId:G.id,message:L}),i.value&&((((Y=(se=jt().selectedSegment)==null?void 0:se.attributes)==null?void 0:Y.rules[0].conditional_op)==="assigned_to"||((oe=(Fe=jt().selectedSegment)==null?void 0:Fe.attributes)==null?void 0:oe.rules[0].conditional_op)==="not_assigned_to"||((Le=(st=jt().selectedSegment)==null?void 0:st.attributes)==null?void 0:Le.rules[0].conditional_op)==="unassigned")&&nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:R.id}),S({conversationId:G.id,attributes:G.attributes}),pe({conversationId:G.id,messageId:L.id}),i.value=!1)})},T=async({id:X,saveStatus:z})=>{try{E({conversationId:X,saveStatus:z,isTemp:!0}),await new qs().saveConversation({chatId:X,model:"conversation"}),E({conversationId:X,saveStatus:z,isTemp:!1})}catch{}},B=async({conversationId:X,status:z,teamId:q})=>{var ve;const{updateMessage:ue}=Yt();m.value=!0;const pe=is(),de={status:z,conversation_id:X,team_id:q,echo_id:pe},he={id:pe,type:"temp_message",isTemp:!0,attributes:{message_type:null,echo_id:pe,is_sender_agent:!0,is_system_message:!0,message_body:`Conversation was marked ${z} by ${(ve=Ae().user)==null?void 0:ve.attributes.name}`,message_created_at:new Date().toISOString(),message_sender:{name:Ae().user.attributes.name||"",profile_pic_url:Ae().user.attributes.profile_photo_url||""}}};ue({conversationId:X,message:he,isTemp:!0}),z==="resolved"?s.value.attributes.is_resolved=!0:s.value.attributes.is_resolved=!1,S({conversationId:X,attributes:s.value.attributes}),$e.emit(Me.CHANGE_CONVERSATION_STATUS,de,be=>{var G,U;ht(be);const{message:{data:re,included:ie}}=be;ue({conversationId:X,message:re});const xe=ie.find(R=>R.id===X),N=be.message.included[0].attributes.is_resolved,L=ct().selectedConversation,me=o.value.findIndex(R=>R.id===X);if(o.value[me].attributes.is_resolved=N,(((G=jt().selectedSegment.attributes)==null?void 0:G.rules[0].conditional_op)==="is_resolved"||((U=jt().selectedSegment.attributes)==null?void 0:U.rules[0].conditional_op)==="is_unresolved")&&nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:L.id}),m.value){m.value=!1;return}S({conversationId:X,attributes:xe.attributes}),m.value=!1})},S=({conversationId:X,attributes:z})=>{var pe;const{updateUnreadMessageCount:q}=Yt();if(jt().selectedSegment.id&&!Di(X))return;if(!z||!((pe=z==null?void 0:z.contact)!=null&&pe.id)){console.log("No contact found",X);return}const ue=o.value.find(de=>de.id===X);if(!ue){v({id:X,attributes:z});return}ue.attributes={...z,custom_data:ue.attributes.custom_data,tags:ue.attributes.tags},q()},E=({conversationId:X,saveStatus:z,isTemp:q})=>{const ue=o.value.find(pe=>pe.id===X);if(ue&&(ue.attributes.is_bookmarked=z,jt().selectedSegment.id&&!q)){const pe=ct().selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:pe.id})}},x=X=>{s.value=X},P=(X,z)=>{const q=[],ue=Pa().customFields;X.forEach(de=>{ue.findIndex(he=>he.id===de.id),q!==-1&&q.push(de)});const pe=[];return z&&z.relationships.customFields.data.length&&q.length&&z.relationships.customFields.data.forEach(de=>{const he=q.find(ve=>ve.id===de.id);he&&pe.push({id:he.id,name:he.attributes.name,value:he.attributes.value})}),pe},j=(X,z)=>{const q=[],ue=Fa().tags;X.forEach(de=>{ue.findIndex(he=>he.id===de.id),q!==-1&&q.push(de)});const pe=[];return z&&z.relationships.tags.data.length&&q.length&&z.relationships.tags.data.forEach(de=>{const he=q.find(ve=>ve.id===de.id);he&&pe.push({id:he.id,name:he.attributes.name,color:he.attributes.color})}),pe};return{getAllConversations:r,addConversations:f,addConversation:v,clearConversationsAndMetaSeg:C,clearConversationsAndMeta:_,getConversationById:A,assignConversation:D,bookmarkConversation:T,toggleConversationStatus:B,updateConversation:S,updateConversationSaveStatus:E,setSelectedConversation:x,addPresenceAgent:y,removePresenceAgent:c,removeAllPresenceAgent:w,updateVisitorInfo:({conversationId:X,attributes:z})=>{const q=o.value.find(ue=>ue.id===X);q&&(q.attributes.contact.name=z.contact.name,q.attributes.contact.email=z.contact.email,q.attributes.contact.phone=z.contact.phone)},updatePageVisited:({conversationId:X,pageVisited:z})=>{const q=o.value.find(ue=>ue.id===X);q&&(q.attributes.contact.page_visited=z)},toggleTranslation:async X=>{try{s.value.attributes.translation_setting=!s.value.attributes.translation_setting,await new qs().toggleTranslation(X,{should_translate_messages:s.value.attributes.translation_setting})}catch(z){s.value.attributes.translation_setting=!s.value.attributes.translation_setting,console.log(z)}},translateMessages:async()=>{var q;const X=Ae().preferredChatLanguage,z=s.value.messages.filter(ue=>!(ue.attributes.translations&&ue.attributes.translations.find(de=>de.language==X))&&!ue.attributes.is_sender_agent&&ue.attributes.message_body&&!ue.attributes.is_chat_init_details&&!ue.attributes.is_system_message);if(z.length)try{const ue=z.map(de=>de.id),pe=await new qs().translateMessages(ue,X);z.forEach(de=>{var he,ve;de.attributes.message_language=(he=pe.translated_text[de.id])==null?void 0:he.translations[0].message_language,de.attributes.translations=(ve=pe.translated_text[de.id])==null?void 0:ve.translations}),s.value.attributes.latest_message.translations=(q=pe.translated_text[s.value.attributes.latest_message.id])==null?void 0:q.translations}catch(ue){console.log(ue)}},deleteConversation:async({contactId:X,conversationId:z,teamId:q})=>{if(o.value.find(pe=>pe.id===z)){if($e.disconnected){ht({error:{message:"Socket disconnected"}});return}try{n.value.isDeletingConversations=!0;const pe={team_id:q,chat_contact_id:X,conversation_id:z};$e.emit(Me.AGENT_CONVERSATION_DELETED_SENT,pe,async de=>{const{error:he}=de;if(he){n.value.isDeletingConversations=!1;const{message:ve}=he;ze().set({message:ve||"An error occurred",type:"error"}),ht(de);return}return nt.emit("nextConversation",{removeCurrent:!0}),Promise.resolve()}),n.value.isDeletingConversations=!1}catch(pe){Ze(pe),n.value.isDeletingConversations=!1}}},toggleBlockContact:async({contactId:X,conversationId:z,teamId:q})=>{const{updateMessage:ue}=Yt(),pe=o.value.find(ve=>ve.id===z);if(!pe)return;const de=pe.attributes.contact,he={...de};if(he.blocked_at?he.blocked_at=null:he.blocked_at=new Date().toISOString(),pe.attributes.contact={...he},$e.disconnected){ht({error:{message:"Socket disconnected"}});return}try{n.value.isBlockingContact=!0;const ve={team_id:q,chat_contact_id:X,conversation_id:z};$e.emit(Me.CHAT_CONTACT_BLOCK,ve,xe=>{const{error:N}=xe;if(N){n.value.isBlockingContact=!1;const{message:me}=N;ze().set({message:me||"An error occurred",type:"error"}),ht(xe);return}const{message:{data:L}}=xe;pe.attributes.contact={...pe.attributes.contact,...L.attributes},console.log(`Emit ${Me.CHAT_CONTACT_BLOCK}:`,xe)});const be=is(),re={status:he.blocked_at?"contact_blocked":"contact_unblocked",conversation_id:z,team_id:q,echo_id:be},ie={id:be,type:"temp_message",isTemp:!0,attributes:{message_type:null,echo_id:be,is_sender_agent:!0,is_system_message:!0,message_body:he.blocked_at?"User blocked":"User unblocked",message_created_at:new Date().toISOString(),message_sender:{name:Ae().user.attributes.name||"",profile_pic_url:Ae().user.attributes.profile_photo_url||""}}};ue({conversationId:z,message:ie,isTemp:!0}),S({conversationId:z,attributes:pe.attributes}),$e.emit(Me.CHANGE_CONVERSATION_STATUS,re,xe=>{const{error:N}=xe;if(N){n.value.isBlockingContact=!1;const{message:U}=N;ze().set({message:U||"An error occurred",type:"error"}),ht(xe);return}const{message:{data:L,included:me}}=xe;ue({conversationId:z,message:L});const G=me.find(U=>U.id===z);S({conversationId:z,attributes:G.attributes})}),n.value.isBlockingContact=!1}catch(ve){Ze(ve),pe.attributes.contact={...de},n.value.isBlockingContact=!1}},removeConversation:async({id:X})=>{const z=o.value.findIndex(q=>q.id===X);o.value.splice(z,1)},addDemoConversation:g,getSegmentConversations:u,updateChatContact:X=>new Promise((z,q)=>{$e.emit(Me.CHAT_CONTACT_UPDATED_SENT,X,ue=>ue.error?q(ue):z(ue))})}}const jt=gs({id:"segments",state:()=>({segments:[],segmentFields:[],selectedSegment:{id:""},editSegmentData:{id:""},showAddSegmentModal:!1,showEditSegmentModal:!1,showDeleteSegmentModal:!1,showSegmentList:!1,uiFlags:{isFetchingSegment:!1,isFetchingSegmentFields:!1,isUpdatingSegment:!1,isCreatingSegment:!1,isDeletingSegment:!1}}),actions:{async getSegments(){var o,s;this.uiFlags.isFetchingSegment=!0;try{const{data:t}=await new Ei().getSegments();this.segments=t,this.uiFlags.isFetchingSegment=!1}catch(t){this.uiFlags.isFetchingSegment=!1;const n=((s=(o=t.response)==null?void 0:o.data)==null?void 0:s.message)||"An error occurred";ze().set({message:n,type:"error"})}},async getSegmentFields(){this.uiFlags.isFetchingSegmentFields=!0;try{this.segmentFields=await new Ei().getSegmentFields(),this.uiFlags.isFetchingSegmentFields=!1}catch(o){Ze(o),this.uiFlags.isFetchingSegmentFields=!1}},async createSegment(o){const s={name:o.name,owner_type:o.owner_type,rules:o.rules.map(t=>{const{field:n,field_type:l,conditional_op:i,value:m,logical_op:r}=t;return{field:n,field_type:l,conditional_op:i,value:m,logical_op:r}})};this.uiFlags.isCreatingSegment=!0,$e.emit(Me.CREATE_SEGMENT,s,t=>{if(ht(t),t.error){const n=t.error.message;ze().set({message:n||"An error occurred",type:"error"}),this.uiFlags.isCreatingSegment=!1;return}t.message.data&&(ze().set({message:"Segment created successfully",type:"success"}),this.showAddSegmentModal=!1,this.uiFlags.isCreatingSegment=!1),this.uiFlags.isCreatingSegment=!1})},async updateSegment(o,s){const{getAllConversations:t}=ss(),n={segment_id:s,name:o.name,owner_type:o.owner_type,rules:o.rules.map(l=>{const{field:i,field_type:m,conditional_op:r,value:u,logical_op:g}=l;return{field:i,field_type:m,conditional_op:r,value:u,logical_op:g}})};this.uiFlags.isUpdatingSegment=!0,$e.emit(Me.UPDATE_SEGMENT,n,async l=>{if(ht(l),l.error){const i=l.error.message;ze().set({message:i||"An error occurred",type:"error"}),this.uiFlags.isUpdatingSegment=!1;return}l.message.data&&(ze().set({message:"Segment updated successfully",type:"success"}),this.showEditSegmentModal=!1,this.uiFlags.isUpdatingSegment=!1,this.selectedSegment.id===this.editSegmentData.id&&(this.selectedSegment.attributes.name=n.name,await t({page:1,limit:20,type:"",search:"",segment:s}),this.showSegmentList=!1)),this.uiFlags.isUpdatingSegment=!1})},async deleteSegment(o){const{getAllConversations:s}=ss();this.uiFlags.isDeletingSegment=!0,$e.emit(Me.DELETE_SEGMENT,{segment_id:o},async t=>{if(ht(t),t.error){const n=t.error.message;ze().set({message:n||"An error occurred",type:"error"}),this.uiFlags.isDeletingSegment=!1;return}t.segment_id&&(ze().set({message:"Segment deleted successfully",type:"success"}),this.showEditSegmentModal=!1,this.showDeleteSegmentModal=!1,this.uiFlags.isDeletingSegment=!1,this.selectedSegment.isSegmentSelected&&(this.selectedSegment={id:""},await s({page:1,limit:20,type:"",search:"",segment:""}),this.showSegmentList=!1)),this.uiFlags.isDeletingSegment=!1})}}}),Pa=gs({id:"customData",state:()=>({customFields:[],showAddCustomDataModal:!1,showEditCustomDataModal:!1,showDeleteCustomFieldModal:!1,uiFlags:{isFetchingCustomFields:!1,isUpdatingCustomFields:!1,isCreatingCustomFields:!1,isDeletingCustomFields:!1}}),actions:{async getCustomFields(){this.uiFlags.isFetchingCustomFields=!0;try{const{data:o}=await new fu().getCustomFields();this.customFields=o,this.uiFlags.isFetchingCustomFields=!1}catch(o){this.uiFlags.isFetchingCustomFields=!1,Ze(o)}},async createCustomField(o){if(this.uiFlags.isCreatingCustomFields=!0,this.customFields.find(t=>t.attributes.name.toLowerCase()===o.name.toLowerCase())&&o.oldValue){const t=ct().selectedConversation.attributes.custom_data.find(n=>n.name.toLowerCase()===o.name.toLowerCase());o.id=t.id,await this.updateCustomFieldValue(o);return}delete o.oldValue;try{return $e.emit(Me.CREATE_CUSTOM_FIELD,o,async t=>{if(console.log(t,"response"),t.error){const{message:n}=t.error;ze().set({message:n||"An error occurred",type:"error"}),this.uiFlags.isCreatingCustomFields=!1;return}this.showAddCustomDataModal=!1,await this.getCustomFields(),this.uiFlags.isCreatingCustomFields=!1}),Promise.resolve()}catch(t){this.uiFlags.isCreatingCustomFields=!1,Ze(t)}},async updateCustomFieldName(o){this.uiFlags.isUpdatingCustomFields=!0;try{const s={name:o.name,old_name:o.oldName,chat_contact_id:o.chat_contact_id};$e.emit(Me.UPDATE_CUSTOM_FIELD_NAME,s,async t=>{if(console.log(Me.UPDATE_CUSTOM_FIELD_NAME,t),t.error){const{message:i}=t.error;ze().set({message:i||"An error occurred",type:"error"}),this.uiFlags.isUpdatingCustomFields=!1;return}this.uiFlags.isUpdatingCustomFields=!1,this.showEditCustomDataModal=!1;const n=ct().selectedConversation.attributes.custom_data,l=n.findIndex(i=>i.id===o.id);if(n[l]={id:o.id,name:o.name,value:o.value},await this.getCustomFields(),o.oldValue!==o.value){await this.updateCustomFieldValue(o);return}return Promise.resolve()})}catch(s){this.uiFlags.isUpdatingCustomFields=!1,Ze(s)}},async updateCustomFieldValue(o){this.uiFlags.isUpdatingCustomFields=!0;try{const s={name:o.name,old_value:o.oldValue,value:o.value,chat_contact_id:o.chat_contact_id};$e.emit(Me.UPDATE_CUSTOM_FIELD_VALUE,s,async t=>{if(console.log(Me.UPDATE_CUSTOM_FIELD_VALUE,t),t.error){const{message:i}=t.error;ze().set({message:i||"An error occurred",type:"error"}),this.uiFlags.isUpdatingCustomFields=!1,this.uiFlags.isCreatingCustomFields=!1;return}const n=ct().selectedConversation.attributes.custom_data,l=n.findIndex(i=>i.id===o.id);l!==-1&&(n[l]={id:o.id,name:o.name,value:o.value}),this.uiFlags.isUpdatingCustomFields=!1,this.uiFlags.isCreatingCustomFields=!1,this.showEditCustomDataModal=!1,this.showAddCustomDataModal=!1})}catch(s){this.uiFlags.isUpdatingCustomFields=!1,this.uiFlags.isCreatingCustomFields=!1,Ze(s)}},async deleteCustomField(o){this.uiFlags.isDeletingCustomFields=!0;let s;o.delete_from_all_contact?s={name:o.name,remove_field:"1"}:s={name:o.name,chat_contact_id:o.chat_contact_id};try{$e.emit(Me.DELETE_CUSTOM_FIELD_FOR_CONTACT,s,async t=>{var l,i;if(t.error){const{message:m}=t.error;ze().set({message:m||"An error occurred",type:"error"}),this.uiFlags.isDeletingCustomFields=!1;return}const n=ct().selectedConversation;return((i=(l=jt().selectedSegment.attributes)==null?void 0:l.rules[0])==null?void 0:i.field_type)==="custom_field"&&nt.emit("fetchSegmentConversation",{segmentId:jt().selectedSegment.id,conversationId:n.id}),ct().selectedConversation.attributes.custom_data=ct().selectedConversation.attributes.custom_data.filter(m=>m.name.toLowerCase()!==o.name.toLowerCase()),this.uiFlags.isDeletingCustomFields=!1,this.showDeleteCustomFieldModal=!1,await this.getCustomFields(),Promise.resolve()})}catch(t){this.uiFlags.isDeletingCustomFields=!1,Ze(t)}}}});function Wn(){const{allConversations:o}=Ts(ct());return{updateConversationNote:({conversationId:i,messageId:m,data:r})=>{const u=o.value.find(c=>c.id===i),{groupMessagesByDate:g}=Yt();if(!u)return;const y=u.messages.findIndex(c=>c.id===m);y>-1&&(u.messages.splice(y,1,{...r}),g(u))},deleteConversationNote:({conversationId:i,messageId:m})=>{const r=o.value.find(y=>y.id===i);if(!r)return;const{groupMessagesByDate:u}=Yt(),g=r.messages.findIndex(y=>y.id===m);g>-1&&(r.messages.splice(g,1),u(r))},updateNote:async({teamId:i,conversationId:m,messageId:r,content:u,mentions:g,meta:y})=>{try{const c=o.value.find(C=>C.id===m);if(!c)return;const{groupMessagesByDate:w}=Yt(),f={team_id:i,message_id:r,message:{meta:y,content:u},mentions:g},v=c.messages.findIndex(C=>C.id===r);if(v>-1){const C=c.messages[v];C.attributes.message_body=u,c.messages.splice(v,1,{...C}),w(c),$e.emit(Me.AGENT_NOTE_UPDATE,f,_=>{ht(_);const{error:A}=_;if(A){const{message:T}=A;ze().set({message:T||"An error occurred",type:"error"});return}const{message:{data:D}}=_;c.messages.splice(v,1,{...D}),w(c)})}}catch(c){console.log(c)}},deleteNote:async({conversationId:i,messageId:m,teamId:r})=>{try{const u=o.value.find(w=>w.id===i);if(!u)return;const{groupMessagesByDate:g}=Yt(),y={team_id:r,message_id:m,conversation_id:i},c=u.messages.findIndex(w=>w.id===m);c>-1&&(u.messages.splice(c,1),g(u)),$e.emit(Me.AGENT_NOTE_DELETE,y,w=>{ht(w);const{error:f}=w;if(f){const{message:v}=f;ze().set({message:v||"An error occurred",type:"error"});return}})}catch(u){console.log(u)}}}}function qn(){const{uiFlags:o,agents:s,agentMeta:t,agent:n,availabilityHours:l,isAgentInviteSuccessful:i}=Ts(ys()),{getCurrentUser:m}=Zt();async function r(S={}){o.value.isFetchingAgents=!0;try{const{data:E,meta:x}=await new Rs().getAgents(S);x.pagination.current_page===1?s.value=E:s.value.push(...E),t.value=x,o.value.isFetchingAgents=!1}catch(E){o.value.isFetchingAgents=!1,Ze(E)}}async function u(S){o.value.isFetchingAgentDetails=!0;try{const{data:E,included:x}=await new Rs().getAgent(S);n.value=E,x?g(x):l.value=[],o.value.isFetchingAgentDetails=!1}catch(E){Ze(E),o.value.isFetchingAgentDetails=!1}}function g(S){l.value=S.map(E=>({id:E.id,...E.attributes})).map(E=>({id:E.id,...E.attributes}))}async function y(S,E){var P,j;const x={name:E.name,email:E.email,...E.role&&{role:E.role},profile_photo_url:E.profile_photo_url,online_availability:E.online_availability,is_default:E.is_default??0,visibility_hour_timezone:E.visibility_hour_timezone,visibility_hours:E.visibility_hours,agent_id:S,team_id:(P=Ae().user)==null?void 0:P.attributes.team_id,widget_id:(j=Ae().user)==null?void 0:j.attributes.widget_id};return new Promise((H,k)=>{$e.emit(Me.UPDATE_AGENT,x,async M=>{var V;if(M.error){const{message:Z}=M.error;return ze().set({message:Z||"An error occurred",type:"error"}),k(M)}return E.online_availability&&((V=Ae().user)==null?void 0:V.attributes.agent_id)===S&&(Ae().user.attributes.online_availability=E.online_availability),E.visibility_hour_timezone&&(n.value.attributes.visibility_hour_timezone=E.visibility_hour_timezone),M.message.included&&g(M.message.included),ze().set({message:"Agent updated successfully",type:"success"}),H(M)})})}async function c(S,E){try{const x={params:{expires:E}};return await new Rs().inviteAgentDetails(S,x)}catch(x){return Ze(x),Promise.reject(x)}}async function w(S){i.value=!1;try{await new Rs().inviteAgent(S),i.value=!0,ze().set({message:"Agent invited successfully",type:"success"}),await m({isSecondCall:!0,updateCustomField:!0})}catch(E){i.value=!1,Ze(E)}}async function f(S){try{await new Rs().deleteAgent(S);const E=s.value.find(x=>x.id===S);s.value=s.value.filter(x=>x.id!==(E==null?void 0:E.id)),ze().set({message:"Agent deleted successfully",type:"success"}),await m({isSecondCall:!0,updateCustomField:!0})}catch(E){Ze(E)}}async function v(S){var E,x;Ae().agentUpgradeNeeded=!1;try{const P={agent_id:S,team_id:(E=Ae().user)==null?void 0:E.attributes.team_id,widget_id:(x=Ae().user)==null?void 0:x.attributes.widget_id};$e.emit(Me.DEACTIVATE_AGENT,P,async j=>{if(j.error){const{message:k}=j.error;k.includes("reached the maximum number of agent")?Ae().agentUpgradeNeeded=!0:ze().set({message:k||"An error occurred",type:"error"}),nt.emit("closeAgentActivationDeactivationModal");return}const H=s.value.filter(k=>k.id!==S);s.value=[...H,j.message.data],ze().set({message:j.message.message,type:"success"}),nt.emit("closeAgentActivationDeactivationModal"),await m({isSecondCall:!0,updateCustomField:!0})})}catch(P){Ze(P)}}async function C(S){try{const{data:E}=await new Rs().removeAgent(S);ze().set({message:E.attributes,type:"success"});const x=s.value.find(P=>P.id===S);s.value=s.value.filter(P=>P.id!==(x==null?void 0:x.id)),nt.emit("closeAgentActivationDeactivationModal"),await m({isSecondCall:!0,updateCustomField:!0})}catch(E){Ze(E)}}async function _(S){try{await new Rs().inviteAgents(S)}catch(E){Ze(E)}}async function A(){try{await new Rs().skipInviteAgent()}catch(S){Ze(S)}}function D({agentId:S,onlineStatus:E}){var P;const x=s.value.find(j=>j.id===S);x&&(x.attributes.online_status=E),((P=Ae().user)==null?void 0:P.attributes.agent_id)===S&&(Ae().user.attributes.online_status=E)}async function T(S){o.value.isResendingAgentInvite=!0;try{await new Rs().resendAgentInvite(S),o.value.isResendingAgentInvite=!1,ze().set({message:"Agent invited successfully",type:"success"}),s.value.map(E=>(E.id===S&&(E.attributes.status="pending"),E))}catch(E){o.value.isResendingAgentInvite=!1,Ze(E)}}async function B(S,E){try{await new Rs().updateAgentStatus(S,E),ze().set({message:"Agent status updated successfully",type:"success"})}catch(x){Ze(x)}}return{getAllAgents:r,getAgentDetails:u,updateAgent:y,checkInviteAgentDetails:c,inviteAgent:w,deleteAgent:f,deactivateOrActivateAgent:v,removeAgent:C,inviteAgents:_,skipInviteAgent:A,updateAgentOnlineStatus:D,resendAgentInvite:T,updateAgentStatus:B}}const Su=Fr(mu());let yl=null;navigator.serviceWorker&&(yl=Pr(Su));const Tu=yl;function bo(){const{notificationSettings:o,isPageVisible:s,notificationType:t,uiFlags:n,showGlobalNotificationModal:l}=Ts(zs()),i=async()=>{var f;n.value.isFetchingNotificationSettings=!0;try{const{data:v}=await new Ua().getAllNotificationSettings();o.value=v,n.value.isFetchingNotificationSettings=!1,(Notification.permission!=="denied"&&(v!=null&&v.attributes.new_message_when_offline)||Notification.permission!=="denied"&&(v!=null&&v.attributes.new_message_when_online))&&g((f=Ae().user)==null?void 0:f.attributes.agent_id)}catch(v){if(n.value.isFetchingNotificationSettings=!1,!v.response)return;Ze(v)}},m=async f=>{var v;n.value.isUpdatingNotificationSettings=!0;try{const{data:C}=await new Ua().updateNotificationSetting(f);o.value=C,ze().set({message:"Settings saved successfully",type:"success"}),(c("new_message_when_offline")||c("new_message_when_online"))&&g((v=Ae().user)==null?void 0:v.attributes.agent_id),n.value.isUpdatingNotificationSettings=!1,l.value=!1,Ae().isFromSignIn=!1}catch(C){n.value.isUpdatingNotificationSettings=!1,Ze(C)}},r=async f=>{var v;n.value.isUpdatingNotificationSettings=!0;try{const{data:C}=await new Ua().updateNotificationSettings(f);o.value=C,ze().set({message:"Settings saved successfully",type:"success"}),(f.name==="new_message_when_offline"&&c("new_message_when_offline")||f.name==="new_message_when_online"&&c("new_message_when_online"))&&g((v=Ae().user)==null?void 0:v.attributes.agent_id),n.value.isUpdatingNotificationSettings=!1,l.value=!1,Ae().isFromSignIn=!1}catch(C){n.value.isUpdatingNotificationSettings=!1,Ze(C)}},u=async()=>{try{await new Ua().deleteFirebaseToken()}catch(f){Ze(f)}},g=async f=>{jr(Tu,{vapidKey:{}.VITE_FIREBASE_VAPID_KEY}).then(async v=>{if(v){const C={token:v,agent_id:f};try{await new Ua().sendFirebaseToken(C)}catch{console.log("Notification permission not granted.")}}else console.log("Requesting permission..."),Notification.requestPermission().then(C=>{C==="granted"&&console.log("Notification permission granted.")})}).catch(v=>{v.message.includes("The notification permission was not granted and blocked instead")&&ze().set({message:"The notification permission was not granted, please allow notification in site settings",type:"error"})})},y=f=>{s.value=f},c=f=>(t.value=f,Notification.permission==="granted");return{getNotificationSettings:i,updateNotificationSetting:m,updateNotificationSettings:r,deleteFirebaseDevices:u,getFirebaseToken:g,updateIsPageVisible:y,isNotificationGranted:c,dontShowGlobalNotificationAgain:async()=>{n.value.isUpdatingNotificationSettings=!0;try{await new Ua().dontShowGlobalNotificationAgain(),n.value.isUpdatingNotificationSettings=!1,Ae().isFromSignIn=!1,Ae().enableNotificationModal=!1}catch(f){n.value.isUpdatingNotificationSettings=!1,Ze(f)}}}}const ts=gs({id:"plans",state:()=>({showProPlan:!1,isChangePlan:!1,plans:[],invoices:[],showDudaUpgradeModal:!1,showDudaUpgradeNoticeModal:!1,showUpdateAgentModal:!1,isDowngrading:!1,isUpgradingDudaUser:!1}),getters:{dudaPlanList(){let o;return o=["f2800b61-c2c9-44ae-bca1-e4c91987786a","a6bed4a6-3f79-4740-b62a-1fafa54acb15","a44d58dd-4a83-4e95-b6a8-578043cc79de","4729ce55-8643-439e-8d24-1750a09e23e2","eed2d5e3-5067-4f29-81f1-7a6553fa2c40","602a9454-d1a5-410d-ba80-a9820a30098a","ce621804-0f30-4529-ac7a-3aa21812d6a5","931febbf-6f82-43e6-a781-9897dea4834d","c068f1ee-ea48-4a3c-acd4-98ab76c10f29","5879172b-1195-4194-b5ac-bc709dc7dfb1","515289e0-370c-4bc5-9194-e62633e938cd"],o=["f554e6ab-dc06-44e8-a9d3-edfa110ffd6e","d5285321-61a3-45d4-9aa2-a200c5b0c4a9","dcaead35-d161-453b-a966-e5690ee862f0","585fd282-ca22-4371-b736-4aa8304b5358","2cd6c87a-7b57-400d-93c4-fd956f521acd","c3738117-ccf9-4f84-9c4d-b7b3462a7a49","0495906b-8dc4-4928-8224-e5e18f896dc4","33a2db66-85fb-4d15-a9a4-e3fa0fdff9d4","8ca71fff-effa-4a7e-99e7-f6defa6562a4","a06f16c9-8f07-43b7-88f3-5b9b7b465c2a","5c160b08-07f3-4ea7-9664-2ff59e5c1125"],o}},actions:{resetStore(){this.showProPlan=!1,this.isChangePlan=!1,this.showUpdateAgentModal=!1,this.isDowngrading=!1}}}),Ya=gs({id:"cannedResponses",state:()=>({cannedResponses:[],cannedResponseFolders:[],meta:{total:0,count:0,per_page:0,current_page:0,total_pages:0},uiFlags:{isFetchingCannedResponses:!1,isCreatingCannedResponse:!1,isFetchingCannedResponseByFolder:!1,isCreatingCannedResponseFailed:!1,isAddEditResponseOpen:!1,isFolderDropdownOpen:!1}})});function Hn(){const{allConversations:o}=Ts(ct());return{updateConversationReminder:({conversationId:i,messageId:m,data:r})=>{const u=o.value.find(c=>c.id===i),{groupMessagesByDate:g}=Yt();if(!u)return;const y=u.messages.findIndex(c=>c.id===m);y>-1&&(u.messages.splice(y,1,{...r}),g(u))},deleteConversationReminder:({conversationId:i,messageId:m})=>{const r=o.value.find(y=>y.id===i);if(!r)return;const{groupMessagesByDate:u}=Yt(),g=r.messages.findIndex(y=>y.id===m);g>-1&&(r.messages.splice(g,1),u(r))},updateReminder:async({conversationId:i,content:m,teamId:r,messageId:u,remindAt:g})=>{try{const y=o.value.find(v=>v.id===i);if(!y)return;const{groupMessagesByDate:c}=Yt(),w={team_id:r,message_id:u,message:{content:m},remind_at:g},f=y.messages.findIndex(v=>v.id===u);if(f>-1){const v=y.messages[f];v.attributes.message_body=m,y.messages.splice(f,1,{...v}),c(y),$e.emit(Me.AGENT_REMINDER_UPDATE,w,C=>{ht(C);const{error:_}=C;if(_){const{message:D}=_;ze().set({message:D||"An error occurred",type:"error"});return}const{message:{data:A}}=C;y.messages.splice(f,1,{...A}),c(y)})}}catch(y){console.log(y)}},deleteReminder:async({conversationId:i,messageId:m,teamId:r})=>{try{const u=o.value.find(w=>w.id===i);if(!u)return;const{groupMessagesByDate:g}=Yt(),y={team_id:r,message_id:m,conversation_id:i},c=u.messages.findIndex(w=>w.id===m);c>-1&&(u.messages.splice(c,1),g(u)),$e.emit(Me.AGENT_REMINDER_DELETE,y,w=>{ht(w);const{error:f}=w;if(f){const{message:v}=f;ze().set({message:v||"An error occurred",type:"error"});return}})}catch(u){console.log(u)}}}}const zn="/assets/close-default-656ec2f9.svg",Mu="/assets/success-a5687d88.svg",Au="/assets/error-6cab922c.svg",Eu="/assets/info-coloured-cb506b87.svg",Du={src:zn},Iu={key:0},Fu={src:Mu,class:"icon"},Pu={key:1},ju={src:Au,class:"icon"},Lu={key:2},Ru={src:Eu,class:"icon"},Bu={class:"content"},Nu=fe({__name:"Toast",setup(o){const s=ze(),t=()=>{s.status&&s.reset()};return(n,l)=>{const i=He("svg-inline");return a(),d("div",{class:O(["toast-container",{active:p(s).status==!0}])},[e("div",{class:O(["toast",[p(s).type?`toast--${p(s).type}`:""]])},[e("button",{class:"button--text",onClick:t},[F(e("img",Du,null,512),[[i]])]),p(s).type=="success"?(a(),d("span",Iu,[F(e("img",Fu,null,512),[[i]])])):p(s).type=="error"?(a(),d("span",Pu,[F(e("img",ju,null,512),[[i]])])):(a(),d("span",Lu,[F(e("img",Ru,null,512),[[i]])])),e("div",Bu,I(p(s).message),1)],2)],2)}}});const Oe=(o,s)=>{const t=o.__vccOpts||o;for(const[n,l]of s)t[n]=l;return t},Ou=Oe(Nu,[["__scopeId","data-v-37d41cd4"]]),Qt="/assets/chevron-up-b8aea55d.svg",Tt="/assets/chevron-down-89ee6c74.svg",Wt="/assets/active-check-ac5b5f73.svg",en="/assets/colored-plus-circle-1c24193c.svg",wo="/assets/trash-small-aa830f47.svg",xo="/assets/black-crown-08a95252.svg",Vu={key:0,class:"flex items-center border-b-[#e6e6f0] border-b[1px] p-4"},Uu={class:"font-semibold text-lg leading-[25px] text-gray900"},Gu={key:0,class:"label-status"},Wu={key:0,class:"alert-buttons--wrap"},qu={src:wo,alt:"delete"},Hu={class:"action-buttons--wrap"},zu=["disabled"],Ku=fe({__name:"SideDrawer",props:{closeModal:{type:Boolean},headerTitle:{default:""},label:{default:""},showFooter:{type:Boolean,default:!0},alertModal:{type:Boolean,default:!1},enableDelete:{type:Boolean,default:!0},isLoading:{type:Boolean},alertButtonText:{default:""},actionButtonTypeOneText:{default:""},actionButtonTypeTwoText:{default:""},actionButtonTwoInvalid:{type:Boolean,default:!1}},emits:["closeModal","actionAlertButton","actionButtonTypeOne","actionButtonTypeTwo"],setup(o,{emit:s}){const t=o,n=Ae(),l=At(),i=s,m=$(!1),r=b(()=>n.isProUserOrTrial),u=()=>{i("actionAlertButton")},g=()=>{i("actionButtonTypeOne")},y=()=>{i("actionButtonTypeTwo")},c=()=>{i("closeModal")},w=()=>{t.closeModal&&c()},f=()=>{c(),l.push("/plans")};return Xe(()=>{m.value=!0}),ps(()=>{m.value=!1}),(v,C)=>{const _=Pe("Loader"),A=He("svg-inline");return a(),ne(ms,{name:"modal-fade"},{default:K(()=>[m.value?(a(),d("div",{key:0,class:"modal-wrap flex justify-end fixed top-0 z-[99999999999] w-full h-full right-0 bg-[#121422CC] backdrop-blur-[4px]",transition:"modal",onClick:w},[e("div",{class:"modal-container relative w-[442px] h-auto bg-white shadow-[0_24px_48px_-4.875px_#282d3e]",onClick:C[0]||(C[0]=Qe(()=>{},["stop"]))},[v.headerTitle?(a(),d("div",Vu,[e("span",Uu,I(v.headerTitle),1),v.label?(a(),d("span",Gu,I(v.label),1)):h("",!0)])):h("",!0),Ss(v.$slots,"default",{},void 0,!0),v.showFooter?(a(),d("div",{key:1,class:O(["w-full modal-footer p-4 absolute bottom-0 right-0",{"modal-footer-with--alert":v.alertButtonText}])},[v.alertButtonText?(a(),d("div",Wu,[e("button",{class:"action-button-type--one action-button gap-0.5",onClick:u},[F(e("img",qu,null,512),[[A]]),_e(" "+I(v.alertButtonText),1)])])):h("",!0),e("div",Hu,[v.actionButtonTypeOneText?(a(),d("button",{key:0,class:"action-button-type--one action-button",onClick:g},I(v.actionButtonTypeOneText),1)):h("",!0),r.value&&v.actionButtonTypeTwoText?(a(),d("button",{key:1,class:O(["action-button-type--two action-button",{alert:v.alertModal}]),disabled:v.actionButtonTwoInvalid,onClick:y},[_e(I(v.actionButtonTypeTwoText)+" ",1),v.isLoading?(a(),ne(_,{key:0,size:"12px"})):h("",!0)],10,zu)):h("",!0),r.value?h("",!0):(a(),d("button",{key:2,onClick:f,class:"flex justify-center items-center text-grey900 upgrade-now-btn-bg text-sm w-[139px] h-8 px-1 py-2 gap-1"},C[1]||(C[1]=[e("img",{src:xo,alt:"crown icon"},null,-1),_e(" Upgrade now ")])))])],2)):h("",!0)])])):h("",!0)]),_:3})}}});const bl=Oe(Ku,[["__scopeId","data-v-a0d0722e"]]),fo=[{id:"America/Chicago",name:"Central Standard Time(CST) | United States/Chicago"},{id:"America/Denver",name:"Mountain Standard Time(MST) | United States/Denver"},{id:"America/Los_Angeles",name:"Pacific Standard Time(PST) | United States/Los Angeles"},{id:"America/New_York",name:"Eastern Standard Time(EST) | United States/New York"},{id:"Africa/Algiers",name:"(GMT+01:00) Algeria/Algiers"},{id:"Africa/Ceuta",name:"(GMT+01:00) Spain/Ceuta"},{id:"Africa/Ndjamena",name:"(GMT+01:00) Chad/Ndjamena"},{id:"Africa/Tunis",name:"(GMT+01:00) Tunisia/Tunis"},{id:"Arctic/Longyearbyen",name:"(GMT+01:00) Svalbard and Jan Mayen/Longyearbyen"},{id:"Europe/Amsterdam",name:"(GMT+01:00) Netherlands/Amsterdam"},{id:"Europe/Andorra",name:"(GMT+01:00) Andorra/Andorra la Vella"},{id:"Europe/Belgrade",name:"(GMT+01:00) Serbia/Belgrade"},{id:"Europe/Bratislava",name:"(GMT+01:00) Slovakia/Bratislava"},{id:"Europe/Brussels",name:"(GMT+01:00) Belgium/Brussels"},{id:"Europe/Budapest",name:"(GMT+01:00) Hungary/Budapest"},{id:"Europe/Busingen",name:"(GMT+01:00) Germany/Busingen"},{id:"Europe/Copenhagen",name:"(GMT+01:00) Denmark/Copenhagen"},{id:"Europe/Gibraltar",name:"(GMT+01:00) Gibraltar/Gibraltar"},{id:"Europe/Ljubljana",name:"(GMT+01:00) Slovenia/Ljubljana"},{id:"Europe/Luxembourg",name:"(GMT+01:00) Luxembourg/Luxembourg"},{id:"Europe/Madrid",name:"(GMT+01:00) Spain/Madrid"},{id:"Europe/Malta",name:"(GMT+01:00) Malta/Valletta"},{id:"Europe/Monaco",name:"(GMT+01:00) Monaco/Monaco"},{id:"Europe/Oslo",name:"(GMT+01:00) Norway/Oslo"},{id:"Europe/Podgorica",name:"(GMT+01:00) Montenegro/Podgorica"},{id:"Europe/Prague",name:"(GMT+01:00) Czech Republic/Prague"},{id:"Europe/Rome",name:"(GMT+01:00) Italy/Rome"},{id:"Europe/San_Marino",name:"(GMT+01:00) San Marino/San Marino"},{id:"Europe/Sarajevo",name:"(GMT+01:00) Bosnia and Herzegovina/Sarajevo"},{id:"Europe/Skopje",name:"(GMT+01:00) North Macedonia/Skopje"},{id:"Europe/Stockholm",name:"(GMT+01:00) Sweden/Stockholm"},{id:"Europe/Tirane",name:"(GMT+01:00) Albania/Tirane"},{id:"Europe/Vaduz",name:"(GMT+01:00) Liechtenstein/Vaduz"},{id:"Europe/Vatican",name:"(GMT+01:00) Vatican City/Vatican City"},{id:"Europe/Vienna",name:"(GMT+01:00) Austria/Vienna"},{id:"Europe/Warsaw",name:"(GMT+01:00) Poland/Warsaw"},{id:"Europe/Zagreb",name:"(GMT+01:00) Croatia/Zagreb"},{id:"Europe/Zurich",name:"(GMT+01:00) Switzerland/Zurich"},{id:"Africa/Brazzaville",name:"(GMT+01:00) Republic of the Congo/Brazzaville"},{id:"Africa/Douala",name:"(GMT+01:00) Cameroon/Douala"},{id:"Africa/Kinshasa",name:"(GMT+01:00) Democratic Republic of the Congo/Kinshasa"},{id:"Africa/Libreville",name:"(GMT+01:00) Gabon/Libreville"},{id:"Africa/Luanda",name:"(GMT+01:00) Angola/Luanda"},{id:"Africa/Malabo",name:"(GMT+01:00) Equatorial Guinea/Malabo"},{id:"Africa/Niamey",name:"(GMT+01:00) Niger/Niamey"},{id:"Africa/Porto-Novo",name:"(GMT+01:00) Benin/Porto-Novo"},{id:"Africa/Bangui",name:"(GMT+01:00) Central African Republic/Bangui"},{id:"Africa/Lagos",name:"(GMT+01:00) West Africa Time(WAT)"},{id:"Europe/Paris",name:"(GMT+01:00) Central European Time(CET) | France/Paris"},{id:"Africa/Cairo",name:"(GMT+02:00) Egypt/Cairo"},{id:"Africa/Johannesburg",name:"(GMT+02:00) South Africa/Johannesburg"},{id:"Africa/Khartoum",name:"(GMT+02:00) Sudan/Khartoum"},{id:"Africa/Maputo",name:"(GMT+02:00) Mozambique/Maputo"},{id:"Africa/Tripoli",name:"(GMT+02:00) Libya/Tripoli"},{id:"Africa/Windhoek",name:"(GMT+02:00) Namibia/Windhoek"},{id:"Asia/Amman",name:"(GMT+02:00) Jordan/Amman"},{id:"Asia/Beirut",name:"(GMT+02:00) Lebanon/Beirut"},{id:"Asia/Damascus",name:"(GMT+02:00) Syria/Damascus"},{id:"Asia/Famagusta",name:"(GMT+02:00) Cyprus/Famagusta"},{id:"Asia/Gaza",name:"(GMT+02:00) Palestine/Gaza"},{id:"Asia/Hebron",name:"(GMT+02:00) Palestine/Hebron"},{id:"Asia/Jerusalem",name:"(GMT+02:00) Israel/Jerusalem"},{id:"Asia/Nicosia",name:"(GMT+02:00) Cyprus/Nicosia"},{id:"Europe/Athens",name:"(GMT+02:00) Greece/Athens"},{id:"Europe/Bucharest",name:"(GMT+02:00) Romania/Bucharest"},{id:"Europe/Chisinau",name:"(GMT+02:00) Moldova/Chisinau"},{id:"Europe/Helsinki",name:"(GMT+02:00) Finland/Helsinki"},{id:"Europe/Kaliningrad",name:"(GMT+02:00) Russia/Kaliningrad"},{id:"Europe/Mariehamn",name:"(GMT+02:00) Åland Islands/Mariehamn"},{id:"Europe/Riga",name:"(GMT+02:00) Latvia/Riga"},{id:"Europe/Sofia",name:"(GMT+02:00) Bulgaria/Sofia"},{id:"Europe/Tallinn",name:"(GMT+02:00) Estonia/Tallinn"},{id:"Europe/Vilnius",name:"(GMT+02:00) Lithuania/Vilnius"},{id:"Africa/Bujumbura",name:"(GMT+02:00) Burundi/Bujumbura"},{id:"Africa/Gaborone",name:"(GMT+02:00) Botswana/Gaborone"},{id:"Africa/Kigali",name:"(GMT+02:00) Rwanda/Kigali"},{id:"Africa/Lubumbashi",name:"(GMT+02:00) Democratic Republic of the Congo/Lubumbashi"},{id:"Africa/Lusaka",name:"(GMT+02:00) Zambia/Lusaka"},{id:"Africa/Maseru",name:"(GMT+02:00) Lesotho/Maseru"},{id:"Africa/Mbabane",name:"(GMT+02:00) Eswatini/Mbabane"},{id:"Africa/Blantyre",name:"(GMT+02:00) Malawi/Blantyre"},{id:"Africa/Harare",name:"(GMT+02:00) Central Africa Time(CAT) | Zimbabwe/Harare"},{id:"Europe/Berlin",name:"(GMT+01:00) Germany/Berlin"},{id:"Europe/Kyiv",name:"(GMT+02:00) Ukraine/Kiev"},{id:"Africa/Juba",name:"(GMT+03:00) South Sudan/Juba"},{id:"Antarctica/Syowa",name:"(GMT+03:00) Antarctica/Syowa"},{id:"Asia/Aden",name:"(GMT+03:00) Yemen/Aden"},{id:"Asia/Baghdad",name:"(GMT+03:00) Iraq/Baghdad"},{id:"Asia/Bahrain",name:"(GMT+03:00) Bahrain/Manama"},{id:"Asia/Kuwait",name:"(GMT+03:00) Kuwait/Kuwait City"},{id:"Asia/Qatar",name:"(GMT+03:00) Qatar/Doha"},{id:"Asia/Riyadh",name:"(GMT+03:00) Saudi Arabia/Riyadh"},{id:"Europe/Istanbul",name:"(GMT+03:00) Turkey/Istanbul"},{id:"Europe/Kirov",name:"(GMT+03:00) Russia/Kirov"},{id:"Europe/Minsk",name:"(GMT+03:00) Belarus/Minsk"},{id:"Europe/Moscow",name:"(GMT+03:00) Russia/Moscow"},{id:"Europe/Simferopol",name:"(GMT+03:00) Russia/Simferopol"},{id:"Europe/Volgograd",name:"(GMT+03:00) Russia/Volgograd"},{id:"Indian/Antananarivo",name:"(GMT+03:00) Madagascar/Antananarivo"},{id:"Indian/Comoro",name:"(GMT+03:00) Comoros/Moroni"},{id:"Indian/Mayotte",name:"(GMT+03:00) Mayotte/Mamoudzou"},{id:"Africa/Addis_Ababa",name:"(GMT+03:00) Ethiopia/Addis Ababa"},{id:"Africa/Asmara",name:"(GMT+03:00) Eritrea/Asmara"},{id:"Africa/Dar_es_Salaam",name:"(GMT+03:00) Tanzania/Dar es Salaam"},{id:"Africa/Djibouti",name:"(GMT+03:00) Djibouti/Djibouti"},{id:"Africa/Kampala",name:"(GMT+03:00) Uganda/Kampala"},{id:"Africa/Mogadishu",name:"(GMT+03:00) Somalia/Mogadishu"},{id:"Africa/Nairobi",name:"(GMT+03:00) East Africa Time(EAT)"},{id:"Asia/Tehran",name:"(GMT+03:30) Iran/Tehran"},{id:"Asia/Baku",name:"(GMT+04:00) Azerbaijan/Baku"},{id:"Asia/Dubai",name:"(GMT+04:00) United Arab Emirates/Dubai"},{id:"Asia/Muscat",name:"(GMT+04:00) Oman/Muscat"},{id:"Asia/Tbilisi",name:"(GMT+04:00) Georgia/Tbilisi"},{id:"Asia/Yerevan",name:"(GMT+04:00) Armenia/Yerevan"},{id:"Europe/Astrakhan",name:"(GMT+04:00) Russia/Astrakhan"},{id:"Europe/Samara",name:"(GMT+04:00) Russia/Samara"},{id:"Europe/Saratov",name:"(GMT+04:00) Russia/Saratov"},{id:"Europe/Ulyanovsk",name:"(GMT+04:00) Russia/Ulyanovsk"},{id:"Indian/Mahe",name:"(GMT+04:00) Seychelles/Mahe"},{id:"Indian/Mauritius",name:"(GMT+04:00) Mauritius/Port Louis"},{id:"Indian/Reunion",name:"(GMT+04:00) Reunion/Saint-Denis"},{id:"Asia/Kabul",name:"(GMT+04:30) Afghanistan/Kabul"},{id:"Antarctica/Mawson",name:"(GMT+05:00) Antarctica/Mawson"},{id:"Asia/Aqtau",name:"(GMT+05:00) Kazakhstan/Aqtau"},{id:"Asia/Aqtobe",name:"(GMT+05:00) Kazakhstan/Aqtobe"},{id:"Asia/Ashgabat",name:"(GMT+05:00) Turkmenistan/Ashgabat"},{id:"Asia/Atyrau",name:"(GMT+05:00) Kazakhstan/Atyrau"},{id:"Asia/Dushanbe",name:"(GMT+05:00) Tajikistan/Dushanbe"},{id:"Asia/Karachi",name:"(GMT+05:00) Pakistan/Karachi"},{id:"Asia/Oral",name:"(GMT+05:00) Kazakhstan/Oral"},{id:"Asia/Samarkand",name:"(GMT+05:00) Uzbekistan/Samarkand"},{id:"Asia/Tashkent",name:"(GMT+05:00) Uzbekistan/Tashkent"},{id:"Asia/Yekaterinburg",name:"(GMT+05:00) Russia/Yekaterinburg"},{id:"Indian/Kerguelen",name:"(GMT+05:00) French Southern and Antarctic Lands/Port-aux-Francais"},{id:"Indian/Maldives",name:"(GMT+05:00) Maldives/Male"},{id:"Asia/Colombo",name:"(GMT+05:30) Sri Lanka/Colombo"},{id:"Asia/Kolkata",name:"(GMT+05:30) India/Kolkata"},{id:"Asia/Kathmandu",name:"(GMT+05:45) Nepal/Kathmandu"},{id:"Antarctica/Vostok",name:"(GMT+06:00) Antarctica/Vostok"},{id:"Asia/Almaty",name:"(GMT+06:00) Kazakhstan/Almaty"},{id:"Asia/Bishkek",name:"(GMT+06:00) Kyrgyzstan/Bishkek"},{id:"Asia/Dhaka",name:"(GMT+06:00) Bangladesh/Dhaka"},{id:"Asia/Omsk",name:"(GMT+06:00) Russia/Omsk"},{id:"Asia/Qyzylorda",name:"(GMT+06:00) Kazakhstan/Qyzylorda"},{id:"Asia/Thimphu",name:"(GMT+06:00) Bhutan/Thimphu"},{id:"Asia/Urumqi",name:"(GMT+06:00) China/Urumqi"},{id:"Indian/Chagos",name:"(GMT+06:00) British Indian Ocean Territory/Diego Garcia"},{id:"Asia/Qostanay",name:"(GMT+06:00) Kazakhstan/Qostanay"},{id:"Asia/Yangon",name:"(GMT+06:30) Myanmar/Yangon"},{id:"Indian/Cocos",name:"(GMT+06:30) Cocos (Keeling) Islands/West Island"},{id:"Antarctica/Davis",name:"(GMT+07:00) Antarctica/Davis"},{id:"Asia/Bangkok",name:"(GMT+07:00) Thailand/Bangkok"},{id:"Asia/Barnaul",name:"(GMT+07:00) Russia/Barnaul"},{id:"Asia/Ho_Chi_Minh",name:"(GMT+07:00) Vietnam/Ho Chi Minh"},{id:"Asia/Hovd",name:"(GMT+07:00) Mongolia/Hovd"},{id:"Asia/Jakarta",name:"(GMT+07:00) Indonesia/Jakarta"},{id:"Asia/Krasnoyarsk",name:"(GMT+07:00) Russia/Krasnoyarsk"},{id:"Asia/Novokuznetsk",name:"(GMT+07:00) Russia/Novokuznetsk"},{id:"Asia/Novosibirsk",name:"(GMT+07:00) Russia/Novosibirsk"},{id:"Asia/Phnom_Penh",name:"(GMT+07:00) Cambodia/Phnom Penh"},{id:"Asia/Pontianak",name:"(GMT+07:00) Indonesia/Pontianak"},{id:"Asia/Tomsk",name:"(GMT+07:00) Russia/Tomsk"},{id:"Asia/Vientiane",name:"(GMT+07:00) Laos/Vientiane"},{id:"Indian/Christmas",name:"(GMT+07:00) Christmas Island/The Settlement"},{id:"Antarctica/Casey",name:"(GMT+08:00) Antarctica/Casey"},{id:"Asia/Brunei",name:"(GMT+08:00) Brunei/Bandar Seri Begawan"},{id:"Asia/Choibalsan",name:"(GMT+08:00) Mongolia/Choibalsan"},{id:"Asia/Hong_Kong",name:"(GMT+08:00) Hong Kong/Hong Kong"},{id:"Asia/Irkutsk",name:"(GMT+08:00) Russia/Irkutsk"},{id:"Asia/Kuala_Lumpur",name:"(GMT+08:00) Malaysia/Kuala Lumpur"},{id:"Asia/Kuching",name:"(GMT+08:00) Malaysia/Kuching"},{id:"Asia/Macau",name:"(GMT+08:00) Macao/Macau"},{id:"Asia/Makassar",name:"(GMT+08:00) Indonesia/Makassar"},{id:"Asia/Manila",name:"(GMT+08:00) Philippines/Manila"},{id:"Asia/Shanghai",name:"(GMT+08:00) China/Shanghai"},{id:"Asia/Singapore",name:"(GMT+08:00) Singapore/Singapore"},{id:"Asia/Taipei",name:"(GMT+08:00) Taiwan/Taipei"},{id:"Asia/Ulaanbaatar",name:"(GMT+08:00) Mongolia/Ulaanbaatar"},{id:"Australia/Perth",name:"(GMT+08:00) Australia/Perth"},{id:"Asia/Pyongyang",name:"(GMT+08:30) North Korea/Pyongyang"},{id:"Australia/Eucla",name:"(GMT+08:45) Australia/Eucla"},{id:"Asia/Chita",name:"(GMT+09:00) Russia/Chita"},{id:"Asia/Dili",name:"(GMT+09:00) Timor-Leste/Dili"},{id:"Asia/Jayapura",name:"(GMT+09:00) Indonesia/Jayapura"},{id:"Asia/Khandyga",name:"(GMT+09:00) Russia/Khandyga"},{id:"Asia/Seoul",name:"(GMT+09:00) South Korea/Seoul"},{id:"Asia/Tokyo",name:"(GMT+09:00) Japan/Tokyo"},{id:"Asia/Yakutsk",name:"(GMT+09:00) Russia/Yakutsk"},{id:"Pacific/Palau",name:"(GMT+09:00) Palau/Koror"},{id:"Australia/Darwin",name:"(GMT+09:30)  Australian Central Standard Time (ACST) | Australia/Darwin"},{id:"Antarctica/DumontDUrville",name:"(GMT+10:00) Antarctica/DumontDUrville"},{id:"Asia/Ust-Nera",name:"(GMT+10:00) Russia/Ust-Nera"},{id:"Asia/Vladivostok",name:"(GMT+10:00) Russia/Vladivostok"},{id:"Australia/Brisbane",name:"(GMT+10:00) Australia/Brisbane"},{id:"Australia/Lindeman",name:"(GMT+10:00) Australia/Lindeman"},{id:"Pacific/Chuuk",name:"(GMT+10:00) Micronesia/Chuuk"},{id:"Pacific/Guam",name:"(GMT+10:00) Guam/Hagatna"},{id:"Pacific/Port_Moresby",name:"(GMT+10:00) Papua New Guinea/Port Moresby"},{id:"Pacific/Saipan",name:"(GMT+10:00) Northern Mariana Islands/Saipan"},{id:"Australia/Sydney",name:"(GMT+10:00) Australia/Sydney"},{id:"Australia/Adelaide",name:"(GMT+10:30) Australia/Adelaide"},{id:"Australia/Broken_Hill",name:"(GMT+10:30) Australia/Broken Hill"},{id:"Australia/Lord_Howe",name:"(GMT+10:30) Australia/Lord Howe"},{id:"Antarctica/Macquarie",name:"(GMT+11:00) Antarctica/Macquarie Island"},{id:"Asia/Magadan",name:"(GMT+11:00) Russia/Magadan"},{id:"Asia/Sakhalin",name:"(GMT+11:00) Russia/Sakhalin"},{id:"Asia/Srednekolymsk",name:"(GMT+11:00) Russia/Srednekolymsk"},{id:"Australia/Melbourne",name:"(GMT+11:00) Australia/Melbourne"},{id:"Pacific/Bougainville",name:"(GMT+11:00) Papua New Guinea/Bougainville"},{id:"Pacific/Efate",name:"(GMT+11:00) Vanuatu/Efate"},{id:"Pacific/Guadalcanal",name:"(GMT+11:00) Solomon Islands/Guadalcanal"},{id:"Pacific/Kosrae",name:"(GMT+11:00) Micronesia/Kosrae"},{id:"Pacific/Norfolk",name:"(GMT+11:00) Norfolk Island/Kingston"},{id:"Pacific/Noumea",name:"(GMT+11:00) New Caledonia/Noumea"},{id:"Pacific/Pohnpei",name:"(GMT+11:00) Micronesia/Pohnpei"},{id:"Australia/Hobart",name:"(GMT+11:00) Australia/Hobart"},{id:"Antarctica/McMurdo",name:"(GMT+12:00) Antarctica/McMurdo"},{id:"Asia/Anadyr",name:"(GMT+12:00) Russia/Anadyr"},{id:"Asia/Kamchatka",name:"(GMT+12:00) Russia/Kamchatka"},{id:"Pacific/Fiji",name:"(GMT+12:00) Fiji/Suva"},{id:"Pacific/Funafuti",name:"(GMT+12:00) Tuvalu/Funafuti"},{id:"Pacific/Kwajalein",name:"(GMT+12:00) Marshall Islands/Kwajalein"},{id:"Pacific/Majuro",name:"(GMT+12:00) Marshall Islands/Majuro"},{id:"Pacific/Nauru",name:"(GMT+12:00) Nauru/Yaren"},{id:"Pacific/Tarawa",name:"(GMT+12:00) Kiribati/Tarawa"},{id:"Pacific/Wake",name:"(GMT+12:00) Wake Island/Wake Island"},{id:"Pacific/Wallis",name:"(GMT+12:00) Wallis and Futuna/Mata-Utu"},{id:"Pacific/Apia",name:"(GMT+13:00) Samoa/Apia"},{id:"Pacific/Auckland",name:"(GMT+13:00) New Zealand/Auckland"},{id:"Pacific/Kanton",name:"(GMT+13:00) Kiribati/Enderbury"},{id:"Pacific/Fakaofo",name:"(GMT+13:00) Tokelau/Fakaofo"},{id:"Pacific/Tongatapu",name:"(GMT+13:00) Tonga/Nukuʻalofa"},{id:"Pacific/Chatham",name:"(GMT+13:45) New Zealand/Chatham"},{id:"Pacific/Kiritimati",name:"(GMT+14:00) Kiribati/Kiritimati"},{id:"Africa/Accra",name:"(GMT+00:00) Ghana/Accra"},{id:"Africa/Bissau",name:"(GMT+00:00) Guinea-Bissau/Bissau"},{id:"Atlantic/Canary",name:"(GMT+00:00) Spain/Canary Islands"},{id:"Africa/Casablanca",name:"(GMT+00:00) Morocco/Casablanca"},{id:"Africa/El_Aaiun",name:"(GMT+00:00) Western Sahara/El Aaiun"},{id:"Africa/Monrovia",name:"(GMT+00:00) Liberia/Monrovia"},{id:"Africa/Sao_Tome",name:"(GMT+00:00) Sao Tome and Principe/Sao Tome"},{id:"America/Danmarkshavn",name:"(GMT+00:00) Greenland/Danmarkshavn"},{id:"America/Scoresbysund",name:"(GMT+00:00) Greenland/Scoresbysund"},{id:"Antarctica/Troll",name:"(GMT+00:00) Antarctica/Troll"},{id:"Atlantic/Faroe",name:"(GMT+00:00) Faroe Islands/Faroe"},{id:"Atlantic/Madeira",name:"(GMT+00:00) Portugal/Madeira"},{id:"Atlantic/Reykjavik",name:"(GMT+00:00) Iceland/Reykjavik"},{id:"Europe/Dublin",name:"(GMT+00:00) Ireland/Dublin"},{id:"Europe/Guernsey",name:"(GMT+00:00) Guernsey/Guernsey"},{id:"Europe/Isle_of_Man",name:"(GMT+00:00) Isle of Man/Douglas"},{id:"Europe/Jersey",name:"(GMT+00:00) Jersey/Saint Helier"},{id:"Europe/Lisbon",name:"(GMT+00:00) Portugal/Lisbon"},{id:"Europe/London",name:"(GMT+00:00) United Kingdom/London"},{id:"Africa/Bamako",name:"(GMT+00:00) Mali/Bamako"},{id:"Africa/Banjul",name:"(GMT+00:00) Gambia/Banjul"},{id:"Africa/Conakry",name:"(GMT+00:00) Guinea/Conakry"},{id:"Africa/Dakar",name:"(GMT+00:00) Senegal/Dakar"},{id:"Africa/Freetown",name:"(GMT+00:00) Sierra Leone/Freetown"},{id:"Africa/Lome",name:"(GMT+00:00) Togo/Lome"},{id:"Africa/Nouakchott",name:"(GMT+00:00) Mauritania/Nouakchott"},{id:"Africa/Ouagadougou",name:"(GMT+00:00) Burkina Faso/Ouagadougou"},{id:"Atlantic/St_Helena",name:"(GMT+00:00) Saint Helena/St Helena"},{id:"Africa/Abidjan",name:"(GMT+00:00) Greenwich Mean Time | Ivory Coast/Abidjan"},{id:"Atlantic/Azores",name:"(GMT-01:00) Portugal/Azores"},{id:"Atlantic/Cape_Verde",name:"(GMT-01:00) Cape Verde"},{id:"America/Noronha",name:"(GMT-02:00) Brazil/Noronha"},{id:"Atlantic/South_Georgia",name:"(GMT-02:00) United Kingdom/South Georgia"},{id:"America/Araguaina",name:"(GMT-03:00) Brazil/Araguaina"},{id:"America/Argentina/Buenos_Aires",name:"(GMT-03:00) Argentina/Buenos Aires"},{id:"America/Argentina/Catamarca",name:"(GMT-03:00) Argentina/Catamarca"},{id:"America/Argentina/Cordoba",name:"(GMT-03:00) Argentina/Cordoba"},{id:"America/Argentina/Jujuy",name:"(GMT-03:00) Argentina/Jujuy"},{id:"America/Argentina/La_Rioja",name:"(GMT-03:00) Argentina/La Rioja"},{id:"America/Argentina/Mendoza",name:"(GMT-03:00) Argentina/Mendoza"},{id:"America/Argentina/Rio_Gallegos",name:"(GMT-03:00) Argentina/Rio Gallegos"},{id:"America/Argentina/Salta",name:"(GMT-03:00) Argentina/Salta"},{id:"America/Argentina/San_Juan",name:"(GMT-03:00) Argentina/San Juan"},{id:"America/Argentina/San_Luis",name:"(GMT-03:00) Argentina/San Luis"},{id:"America/Argentina/Tucuman",name:"(GMT-03:00) Argentina/Tucuman"},{id:"America/Argentina/Ushuaia",name:"(GMT-03:00) Argentina/Ushuaia"},{id:"America/Bahia",name:"(GMT-03:00) Brazil/Bahia"},{id:"America/Belem",name:"(GMT-03:00) Brazil/Belem"},{id:"America/Cayenne",name:"(GMT-03:00) French Guiana/Cayenne"},{id:"America/Fortaleza",name:"(GMT-03:00) Brazil/Fortaleza"},{id:"America/Nuuk",name:"(GMT-03:00) Greenland/Nuuk"},{id:"America/Maceio",name:"(GMT-03:00) Brazil/Maceio"},{id:"America/Miquelon",name:"(GMT-03:00) Saint Pierre and Miquelon/Miquelon"},{id:"America/Montevideo",name:"(GMT-03:00) Uruguay/Montevideo"},{id:"America/Paramaribo",name:"(GMT-03:00) Suriname/Paramaribo"},{id:"America/Punta_Arenas",name:"(GMT-03:00) Chile/Punta Arenas"},{id:"America/Recife",name:"(GMT-03:00) Brazil/Recife"},{id:"America/Santarem",name:"(GMT-03:00) Brazil/Santarem"},{id:"America/Santiago",name:"(GMT-03:00) Chile/Santiago"},{id:"Antarctica/Palmer",name:"(GMT-03:00) Palmer Station, Antarctica"},{id:"Antarctica/Rothera",name:"(GMT-03:00) Rothera Research Station, Antarctica"},{id:"Atlantic/Stanley",name:"(GMT-03:00) Falkland Islands/Stanley"},{id:"America/Sao_Paulo",name:"(GMT-03:00) Brasilia Time(BRT) | Brazil/Sao Paulo"},{id:"America/St_Johns",name:"(GMT-03:30) Canada/St Johns"},{id:"America/Anguilla",name:"(GMT-04:00) Anguilla"},{id:"America/Antigua",name:"(GMT-04:00) Antigua and Barbuda/Antigua"},{id:"America/Aruba",name:"(GMT-04:00) Aruba"},{id:"America/Asuncion",name:"(GMT-04:00) Paraguay/Asuncion"},{id:"America/Barbados",name:"(GMT-04:00) Barbados"},{id:"America/Blanc-Sablon",name:"(GMT-04:00) Canada/Blanc-Sablon"},{id:"America/Boa_Vista",name:"(GMT-04:00) Brazil/Boa Vista"},{id:"America/Campo_Grande",name:"(GMT-04:00) Brazil/Campo Grande"},{id:"America/Caracas",name:"(GMT-04:00) Venezuela/Caracas"},{id:"America/Cuiaba",name:"(GMT-04:00) Brazil/Cuiaba"},{id:"America/Curacao",name:"(GMT-04:00) Curacao"},{id:"America/Dominica",name:"(GMT-04:00) Dominica"},{id:"America/Glace_Bay",name:"(GMT-04:00) Canada/Glace Bay"},{id:"America/Goose_Bay",name:"(GMT-04:00) Canada/Goose Bay"},{id:"America/Grand_Turk",name:"(GMT-04:00) Turks and Caicos Islands/Grand Turk"},{id:"America/Grenada",name:"(GMT-04:00) Grenada"},{id:"America/Guadeloupe",name:"(GMT-04:00) Guadeloupe"},{id:"America/Guyana",name:"(GMT-04:00) Guyana"},{id:"America/Kralendijk",name:"(GMT-04:00) Bonaire, Sint Eustatius and Saba/Kralendijk"},{id:"America/La_Paz",name:"(GMT-04:00) Bolivia/La Paz"},{id:"America/Lower_Princes",name:"(GMT-04:00) Sint Maarten/Lower Princes"},{id:"America/Manaus",name:"(GMT-04:00) Brazil/Manaus"},{id:"America/Marigot",name:"(GMT-04:00) Saint Martin/Marigot"},{id:"America/Martinique",name:"(GMT-04:00) Martinique"},{id:"America/Moncton",name:"(GMT-04:00) Canada/Moncton"},{id:"America/Montserrat",name:"(GMT-04:00) United Kingdom/Montserrat"},{id:"America/Port_of_Spain",name:"(GMT-04:00) Trinidad and Tobago/Port of Spain"},{id:"America/Porto_Velho",name:"(GMT-04:00) Brazil/Porto Velho"},{id:"America/Santo_Domingo",name:"(GMT-04:00) Dominican Republic/Santo Domingo"},{id:"America/St_Barthelemy",name:"(GMT-04:00) Saint Barthelemy"},{id:"America/St_Kitts",name:"(GMT-04:00) Saint Kitts and Nevis/St Kitts"},{id:"America/St_Lucia",name:"(GMT-04:00) Saint Lucia/St Lucia"},{id:"America/St_Thomas",name:"(GMT-04:00) U.S. Virgin Islands/St Thomas"},{id:"America/St_Vincent",name:"(GMT-04:00) Saint Vincent and the Grenadines/St Vincent"},{id:"America/Thule",name:"(GMT-04:00) Greenland/Thule"},{id:"America/Tortola",name:"(GMT-04:00) British Virgin Islands/Tortola"},{id:"Atlantic/Bermuda",name:"(GMT-04:00) Bermuda"},{id:"America/Halifax",name:"(GMT-04:00) Canada/Halifax"},{id:"America/Puerto_Rico",name:"(GMT-04:00) Puerto Rico"},{id:"America/Atikokan",name:"(GMT-05:00) Canada/Atikokan"},{id:"America/Bogota",name:"(GMT-05:00) Colombia/Bogota"},{id:"America/Cancun",name:"(GMT-05:00) Mexico/Cancun"},{id:"America/Cayman",name:"(GMT-05:00) Cayman Islands/Cayman"},{id:"America/Detroit",name:"(GMT-05:00) United States/Detroit"},{id:"America/Eirunepe",name:"(GMT-05:00) Brazil/Eirunepe"},{id:"America/Guayaquil",name:"(GMT-05:00) Ecuador/Guayaquil"},{id:"America/Havana",name:"(GMT-05:00) Cuba/Havana"},{id:"America/Indiana/Marengo",name:"(GMT-05:00) United States/Marengo"},{id:"America/Indiana/Petersburg",name:"(GMT-05:00) United States/Petersburg"},{id:"America/Indiana/Vevay",name:"(GMT-05:00) United States/Vevay"},{id:"America/Indiana/Vincennes",name:"(GMT-05:00) United States/Vincennes"},{id:"America/Indiana/Winamac",name:"(GMT-05:00) United States/Winamac"},{id:"America/Jamaica",name:"(GMT-05:00) Jamaica/Jamaica"},{id:"America/Kentucky/Louisville",name:"(GMT-05:00) United States/Louisville"},{id:"America/Lima",name:"(GMT-05:00) Peru/Lima"},{id:"America/Nassau",name:"(GMT-05:00) Bahamas/Nassau"},{id:"America/Port-au-Prince",name:"(GMT-05:00) Haiti/Port-au-Prince"},{id:"America/Rio_Branco",name:"(GMT-05:00) Brazil/Rio Branco"},{id:"America/Kentucky/Monticello",name:"(GMT-05:00) United States/Monticello"},{id:"America/Indiana/Indianapolis",name:"(GMT-05:00) United States/Indianapolis"},{id:"America/Iqaluit",name:"(GMT-05:00) Canada/Iqaluit"},{id:"America/Panama",name:"(GMT-05:00) Panama | Canada/Coral Harbour"},{id:"America/Toronto",name:"(GMT-05:00) Canada/Toronto"},{id:"America/Bahia_Banderas",name:"(GMT-06:00) Mexico/Bahia Banderas"},{id:"America/Belize",name:"(GMT-06:00) Belize/Belize"},{id:"America/Costa_Rica",name:"(GMT-06:00) Costa Rica/San Jose"},{id:"America/Guatemala",name:"(GMT-06:00) Guatemala/Guatemala"},{id:"America/Indiana/Knox",name:"(GMT-06:00) United States/Knox"},{id:"America/Indiana/Tell_City",name:"(GMT-06:00) United States/Tell City"},{id:"America/Managua",name:"(GMT-06:00) Nicaragua/Managua"},{id:"America/Matamoros",name:"(GMT-06:00) Mexico/Matamoros"},{id:"America/Menominee",name:"(GMT-06:00) United States/Menominee"},{id:"America/Merida",name:"(GMT-06:00) Mexico/Merida"},{id:"America/Mexico_City",name:"(GMT-06:00) Mexico/Mexico City"},{id:"America/Monterrey",name:"(GMT-06:00) Mexico/Monterrey"},{id:"America/North_Dakota/Beulah",name:"(GMT-06:00) United States/Beulah"},{id:"America/North_Dakota/Center",name:"(GMT-06:00) United States/Center"},{id:"America/North_Dakota/New_Salem",name:"(GMT-06:00) United States/New Salem"},{id:"America/Rankin_Inlet",name:"(GMT-06:00) Canada/Rankin Inlet"},{id:"America/Regina",name:"(GMT-06:00) Canada/Regina"},{id:"America/Resolute",name:"(GMT-06:00) Canada/Resolute"},{id:"America/Swift_Current",name:"(GMT-06:00) Canada/Swift Current"},{id:"Pacific/Easter",name:"(GMT-06:00) Chile/Easter Island"},{id:"Pacific/Galapagos",name:"(GMT-06:00) Ecuador/Galapagos"},{id:"America/El_Salvador",name:"(GMT-06:00) El Salvador/San Salvador"},{id:"America/Tegucigalpa",name:"(GMT-06:00) Honduras/Tegucigalpa"},{id:"America/Winnipeg",name:"(GMT-06:00) Canada/Central"},{id:"America/Boise",name:"(GMT-07:00) United States/Boise"},{id:"America/Cambridge_Bay",name:"(GMT-07:00) Canada/Cambridge Bay"},{id:"America/Chihuahua",name:"(GMT-07:00) Mexico/Chihuahua"},{id:"America/Creston",name:"(GMT-07:00) Canada/Creston"},{id:"America/Dawson_Creek",name:"(GMT-07:00) Canada/Dawson Creek"},{id:"America/Fort_Nelson",name:"(GMT-07:00) Canada/Fort Nelson"},{id:"America/Hermosillo",name:"(GMT-07:00) Mexico/Hermosillo"},{id:"America/Inuvik",name:"(GMT-07:00) Canada/Inuvik"},{id:"America/Mazatlan",name:"(GMT-07:00) Mexico/Mazatlan"},{id:"America/Ojinaga",name:"(GMT-07:00) United States/Ojinaga"},{id:"America/Edmonton",name:"(GMT-07:00) Canada/Edmonton"},{id:"America/Phoenix",name:"(GMT-07:00) United States/Arizona"},{id:"America/Dawson",name:"(GMT-08:00) Canada/Dawson"},{id:"America/Tijuana",name:"(GMT-08:00) Mexico/Tijuana"},{id:"America/Whitehorse",name:"(GMT-08:00) Canada/Whitehorse"},{id:"Pacific/Pitcairn",name:"(GMT-08:00) Pitcairn Islands/Pitcairn"},{id:"America/Vancouver",name:"(GMT-08:00) Canada/Vancouver"},{id:"America/Juneau",name:"(GMT-09:00) United States/Juneau"},{id:"America/Metlakatla",name:"(GMT-09:00) United States/Metlakatla"},{id:"America/Nome",name:"(GMT-09:00) United States/Nome"},{id:"America/Sitka",name:"(GMT-09:00) United States/Sitka"},{id:"America/Yakutat",name:"(GMT-09:00) United States/Yakutat"},{id:"Pacific/Gambier",name:"(GMT-09:00) French Polynesia/Gambier"},{id:"America/Anchorage",name:"(GMT-09:00) United States/Alaska"},{id:"Pacific/Marquesas",name:"(GMT-09:30) French Polynesia/Marquesas"},{id:"America/Adak",name:"(GMT-10:00) United States/Adak"},{id:"Pacific/Rarotonga",name:"(GMT-10:00) Cook Islands/Rarotonga"},{id:"Pacific/Tahiti",name:"(GMT-10:00) French Polynesia/Tahiti"},{id:"Pacific/Honolulu",name:"(GMT-10:00) United States/Honolulu | United States/Hawaii"},{id:"Pacific/Midway",name:"(GMT-11:00) United States/Midway"},{id:"Pacific/Niue",name:"(GMT-11:00) Niue/Niue"},{id:"Pacific/Pago_Pago",name:"(GMT-11:00) American Samoa/Pago Pago"}],wl=["af","af-NA","af-ZA","agq","agq-CM","ak","ak-GH","am","am-ET","ar","ar-001","ar-AE","ar-BH","ar-DJ","ar-DZ","ar-EG","ar-EH","ar-ER","ar-IL","ar-IQ","ar-JO","ar-KM","ar-KW","ar-LB","ar-LY","ar-MA","ar-MR","ar-OM","ar-PS","ar-QA","ar-SA","ar-SD","ar-SO","ar-SS","ar-SY","ar-TD","ar-TN","ar-YE","as","as-IN","asa","asa-TZ","ast","ast-ES","az","az-Cyrl","az-Cyrl-AZ","az-Latn","az-Latn-AZ","bas","bas-CM","be","be-BY","bem","bem-ZM","bez","bez-TZ","bg","bg-BG","bm","bm-ML","bn","bn-BD","bn-IN","bo","bo-CN","bo-IN","br","br-FR","brx","brx-IN","bs","bs-Cyrl","bs-Cyrl-BA","bs-Latn","bs-Latn-BA","ca","ca-AD","ca-ES","ca-FR","ca-IT","ccp","ccp-BD","ccp-IN","ce","ce-RU","cgg","cgg-UG","chr","chr-US","ckb","ckb-IQ","ckb-IR","cs","cs-CZ","cy","cy-GB","da","da-DK","da-GL","dav","dav-KE","de","de-AT","de-BE","de-CH","de-DE","de-IT","de-LI","de-LU","dje","dje-NE","dsb","dsb-DE","dua","dua-CM","dyo","dyo-SN","dz","dz-BT","ebu","ebu-KE","ee","ee-GH","ee-TG","el","el-CY","el-GR","en","en-001","en-150","en-AG","en-AI","en-AS","en-AT","en-AU","en-BB","en-BE","en-BI","en-BM","en-BS","en-BW","en-BZ","en-CA","en-CC","en-CH","en-CK","en-CM","en-CX","en-CY","en-DE","en-DG","en-DK","en-DM","en-ER","en-FI","en-FJ","en-FK","en-FM","en-GB","en-GD","en-GG","en-GH","en-GI","en-GM","en-GU","en-GY","en-HK","en-IE","en-IL","en-IM","en-IN","en-IO","en-JE","en-JM","en-KE","en-KI","en-KN","en-KY","en-LC","en-LR","en-LS","en-MG","en-MH","en-MO","en-MP","en-MS","en-MT","en-MU","en-MW","en-MY","en-NA","en-NF","en-NG","en-NL","en-NR","en-NU","en-NZ","en-PG","en-PH","en-PK","en-PN","en-PR","en-PW","en-RW","en-SB","en-SC","en-SD","en-SE","en-SG","en-SH","en-SI","en-SL","en-SS","en-SX","en-SZ","en-TC","en-TK","en-TO","en-TT","en-TV","en-TZ","en-UG","en-UM","en-US","en-US-POSIX","en-VC","en-VG","en-VI","en-VU","en-WS","en-ZA","en-ZM","en-ZW","eo","es","es-419","es-AR","es-BO","es-BR","es-BZ","es-CL","es-CO","es-CR","es-CU","es-DO","es-EA","es-EC","es-ES","es-GQ","es-GT","es-HN","es-IC","es-MX","es-NI","es-PA","es-PE","es-PH","es-PR","es-PY","es-SV","es-US","es-UY","es-VE","et","et-EE","eu","eu-ES","ewo","ewo-CM","fa","fa-AF","fa-IR","ff","ff-CM","ff-GN","ff-MR","ff-SN","fi","fi-FI","fil","fil-PH","fo","fo-DK","fo-FO","fr","fr-BE","fr-BF","fr-BI","fr-BJ","fr-BL","fr-CA","fr-CD","fr-CF","fr-CG","fr-CH","fr-CI","fr-CM","fr-DJ","fr-DZ","fr-FR","fr-GA","fr-GF","fr-GN","fr-GP","fr-GQ","fr-HT","fr-KM","fr-LU","fr-MA","fr-MC","fr-MF","fr-MG","fr-ML","fr-MQ","fr-MR","fr-MU","fr-NC","fr-NE","fr-PF","fr-PM","fr-RE","fr-RW","fr-SC","fr-SN","fr-SY","fr-TD","fr-TG","fr-TN","fr-VU","fr-WF","fr-YT","fur","fur-IT","fy","fy-NL","ga","ga-IE","gd","gd-GB","gl","gl-ES","gsw","gsw-CH","gsw-FR","gsw-LI","gu","gu-IN","guz","guz-KE","gv","gv-IM","ha","ha-GH","ha-NE","ha-NG","haw","haw-US","he","he-IL","hi","hi-IN","hr","hr-BA","hr-HR","hsb","hsb-DE","hu","hu-HU","hy","hy-AM","id","id-ID","ig","ig-NG","ii","ii-CN","is","is-IS","it","it-CH","it-IT","it-SM","it-VA","ja","ja-JP","jgo","jgo-CM","jmc","jmc-TZ","ka","ka-GE","kab","kab-DZ","kam","kam-KE","kde","kde-TZ","kea","kea-CV","khq","khq-ML","ki","ki-KE","kk","kk-KZ","kkj","kkj-CM","kl","kl-GL","kln","kln-KE","km","km-KH","kn","kn-IN","ko","ko-KP","ko-KR","kok","kok-IN","ks","ks-IN","ksb","ksb-TZ","ksf","ksf-CM","ksh","ksh-DE","kw","kw-GB","ky","ky-KG","lag","lag-TZ","lb","lb-LU","lg","lg-UG","lkt","lkt-US","ln","ln-AO","ln-CD","ln-CF","ln-CG","lo","lo-LA","lrc","lrc-IQ","lrc-IR","lt","lt-LT","lu","lu-CD","luo","luo-KE","luy","luy-KE","lv","lv-LV","mas","mas-KE","mas-TZ","mer","mer-KE","mfe","mfe-MU","mg","mg-MG","mgh","mgh-MZ","mgo","mgo-CM","mk","mk-MK","ml","ml-IN","mn","mn-MN","mr","mr-IN","ms","ms-BN","ms-MY","ms-SG","mt","mt-MT","mua","mua-CM","my","my-MM","mzn","mzn-IR","naq","naq-NA","nb","nb-NO","nb-SJ","nd","nd-ZW","nds","nds-DE","nds-NL","ne","ne-IN","ne-NP","nl","nl-AW","nl-BE","nl-BQ","nl-CW","nl-NL","nl-SR","nl-SX","nmg","nmg-CM","nn","nn-NO","nnh","nnh-CM","nus","nus-SS","nyn","nyn-UG","om","om-ET","om-KE","or","or-IN","os","os-GE","os-RU","pa","pa-Arab","pa-Arab-PK","pa-Guru","pa-Guru-IN","pl","pl-PL","ps","ps-AF","pt","pt-AO","pt-BR","pt-CH","pt-CV","pt-GQ","pt-GW","pt-LU","pt-MO","pt-MZ","pt-PT","pt-ST","pt-TL","qu","qu-BO","qu-EC","qu-PE","rm","rm-CH","rn","rn-BI","ro","ro-MD","ro-RO","rof","rof-TZ","ru","ru-BY","ru-KG","ru-KZ","ru-MD","ru-RU","ru-UA","rw","rw-RW","rwk","rwk-TZ","sah","sah-RU","saq","saq-KE","sbp","sbp-TZ","se","se-FI","se-NO","se-SE","seh","seh-MZ","ses","ses-ML","sg","sg-CF","shi","shi-Latn","shi-Latn-MA","shi-Tfng","shi-Tfng-MA","si","si-LK","sk","sk-SK","sl","sl-SI","smn","smn-FI","sn","sn-ZW","so","so-DJ","so-ET","so-KE","so-SO","sq","sq-AL","sq-MK","sq-XK","sr","sr-Cyrl","sr-Cyrl-BA","sr-Cyrl-ME","sr-Cyrl-RS","sr-Cyrl-XK","sr-Latn","sr-Latn-BA","sr-Latn-ME","sr-Latn-RS","sr-Latn-XK","sv","sv-AX","sv-FI","sv-SE","sw","sw-CD","sw-KE","sw-TZ","sw-UG","ta","ta-IN","ta-LK","ta-MY","ta-SG","te","te-IN","teo","teo-KE","teo-UG","tg","tg-TJ","th","th-TH","ti","ti-ER","ti-ET","to","to-TO","tr","tr-CY","tr-TR","tt","tt-RU","twq","twq-NE","tzm","tzm-MA","ug","ug-CN","uk","uk-UA","ur","ur-IN","ur-PK","uz","uz-Arab","uz-Arab-AF","uz-Cyrl","uz-Cyrl-UZ","uz-Latn","uz-Latn-UZ","vai","vai-Latn","vai-Latn-LR","vai-Vaii","vai-Vaii-LR","vi","vi-VN","vun","vun-TZ","wae","wae-CH","wo","wo-SN","xog","xog-UG","yav","yav-CM","yi","yi-001","yo","yo-BJ","yo-NG","yue","yue-Hans","yue-Hans-CN","yue-Hant","yue-Hant-HK","zgh","zgh-MA","zh","zh-Hans","zh-Hans-CN","zh-Hans-HK","zh-Hans-MO","zh-Hans-SG","zh-Hant","zh-Hant-HK","zh-Hant-MO","zh-Hant-TW","zu","zu-ZA"],Yu={"auto-detect":"Detect member's browser language",en:"English",pt:"Portuguese",hi:"Hindi",ar:"Arabic",es:"Spanish",de:"German",fr:"French",ja:"Japanese",ru:"Russian",da:"Danish",fi:"Finnish",it:"Italian",tr:"Turkish","zh-CN":"Chinese (Simplified)",af:"Afrikaans",sq:"Albanian",am:"Amharic",hy:"Armenian",as:"Assamese",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",eu:"Basque",be:"Belarusian",bn:"Bengali",bho:"Bhojpuri",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",ceb:"Cebuano",ny:"Chichewa","zh-TW":"Chinese (Traditional)",co:"Corsican",hr:"Croatian",cs:"Czech",dv:"Dhivehi",doi:"Dogri",nl:"Dutch",eo:"Esperanto",et:"Estonian",ee:"Ewe",fil:"Filipino",fy:"Frisian",gl:"Galician",ka:"Georgian",el:"Greek",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",haw:"Hawaiian",he:"Hebrew",hmn:"Hmong",hu:"Hungarian",is:"Icelandic",ig:"Igbo",ilo:"Ilocano",id:"Indonesian",ga:"Irish",jv:"Javanese",kn:"Kannada",kk:"Kazakh",km:"Khmer",rw:"Kinyarwanda",kok:"Konkani",ko:"Korean",kri:"Krio",ku:"Kurdish (Kurmanji)",ckb:"Kurdish (Sorani)",ky:"Kyrgyz",lo:"Lao",la:"Latin",lv:"Latvian",ln:"Lingala",lt:"Lithuanian",lg:"Luganda",lb:"Luxembourgish",mk:"Macedonian",mai:"Maithili",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi","mni-Mtei":"Meiteilon (Manipuri)",lus:"Mizo",mn:"Mongolian",my:"Myanmar (Burmese)",ne:"Nepali",no:"Norwegian",or:"Odia (Oriya)",om:"Oromo",ps:"Pashto",fa:"Persian",pl:"Polish",qu:"Quechua",ro:"Romanian",sm:"Samoan",sa:"Sanskrit",gd:"Scots Gaelic",nso:"Sepedi",sr:"Serbian",st:"Sesotho",sn:"Shona",sd:"Sindhi",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",su:"Sundanese",sw:"Swahili",sv:"Swedish",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",ti:"Tigrinya",ts:"Tsonga",tk:"Turkmen",tw:"Twi",uk:"Ukrainian",ur:"Urdu",ug:"Uyghur",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",zu:"Zulu"},Zu=o=>Yu[o]??null,Ju=o=>({en:"US",pt:"PT",hi:"IN",ar:"SA",es:"ES",de:"DE",fr:"FR",ja:"JP",ru:"RU",da:"DK",fi:"FI",it:"IT",tr:"TR","zh-CN":"CN",af:"ZA",sq:"AL",am:"ET",hy:"AM",as:"IN",ay:"BO",az:"AZ",bm:"ML",eu:"ES",be:"BY",bn:"BD",bho:"IN",bs:"BA",bg:"BG",ca:"ES",ceb:"PH",ny:"MW","zh-TW":"TW",co:"FR",hr:"HR",cs:"CZ",dv:"MV",doi:"IN",nl:"NL",eo:"EO",et:"EE",ee:"GH",fil:"PH",fy:"NL",gl:"ES",ka:"GE",el:"GR",gn:"PY",gu:"IN",ha:"NG",haw:"US",he:"IL",hmn:"LA",hu:"HU",is:"IS",ig:"NG",ilo:"PH",id:"ID",ga:"IE",jv:"ID",kn:"IN",kk:"KZ",km:"KH",rw:"RW",kok:"IN",ko:"KR",kri:"SL",ku:"TR",ckb:"IQ",ky:"KG",lo:"LA",la:"VA",lv:"LV",ln:"CD",lt:"LT",lg:"UG",lb:"LU",mk:"MK",mai:"IN",mg:"MG",ms:"MY",ml:"IN",mt:"MT",mi:"NZ",mr:"IN","mni-Mtei":"IN",mn:"MN",my:"MM",ne:"NP",no:"NO",or:"IN",ps:"AF",fa:"IR",pl:"PL",qu:"PE",ro:"RO",sm:"WS",sa:"IN",gd:"GB",nso:"ZA",sr:"RS",st:"LS",sn:"ZW",sd:"PK",si:"LK",sk:"SK",sl:"SI",so:"SO",su:"ID",sw:"TZ",sv:"SE",tg:"TJ",ta:"IN",tt:"RU",te:"IN",th:"TH",ti:"ER",ts:"ZA",tk:"TM",tw:"GH",uk:"UA",ur:"PK",ug:"CN",uz:"UZ",vi:"VN",cy:"GB",xh:"ZA",yi:"US",yo:"NG",zu:"ZA"})[o]??null,Qu=[{id:1,name:"Ascension Island",code:"AC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AC.svg",emoji:"🇦🇨",phoneCode:"+247"},{id:2,name:"Andorra",code:"AD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AD.svg",emoji:"🇦🇩",phoneCode:"+376"},{id:3,name:"United Arab Emirates",code:"AE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AE.svg",emoji:"🇦🇪",phoneCode:"+971"},{id:4,name:"Afghanistan",code:"AF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AF.svg",emoji:"🇦🇫",phoneCode:"+93"},{id:5,name:"Antigua & Barbuda",code:"AG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AG.svg",emoji:"🇦🇬",phoneCode:"+1"},{id:6,name:"Anguilla",code:"AI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AI.svg",emoji:"🇦🇮",phoneCode:"+1"},{id:7,name:"Albania",code:"AL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AL.svg",emoji:"🇦🇱",phoneCode:"+355"},{id:8,name:"Armenia",code:"AM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AM.svg",emoji:"🇦🇲",phoneCode:"+374"},{id:9,name:"Angola",code:"AO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AO.svg",emoji:"🇦🇴",phoneCode:"+244"},{id:10,name:"Antarctica",code:"AQ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AQ.svg",emoji:"🇦🇶",phoneCode:"+672"},{id:11,name:"Argentina",code:"AR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AR.svg",emoji:"🇦🇷",phoneCode:"+54"},{id:12,name:"American Samoa",code:"AS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AS.svg",emoji:"🇦🇸",phoneCode:"+1"},{id:13,name:"Austria",code:"AT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AT.svg",emoji:"🇦🇹",phoneCode:"+43"},{id:14,name:"Australia",code:"AU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AU.svg",emoji:"🇦🇺",phoneCode:"+61"},{id:15,name:"Aruba",code:"AW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AW.svg",emoji:"🇦🇼",phoneCode:"+297"},{id:16,name:"Åland Islands",code:"AX",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AX.svg",emoji:"🇦🇽",phoneCode:"+358"},{id:17,name:"Azerbaijan",code:"AZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AZ.svg",emoji:"🇦🇿",phoneCode:"+994"},{id:18,name:"Bosnia & Herzegovina",code:"BA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BA.svg",emoji:"🇧🇦",phoneCode:"+387"},{id:19,name:"Barbados",code:"BB",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BB.svg",emoji:"🇧🇧",phoneCode:"+1"},{id:20,name:"Bangladesh",code:"BD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BD.svg",emoji:"🇧🇩",phoneCode:"+880"},{id:21,name:"Belgium",code:"BE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BE.svg",emoji:"🇧🇪",phoneCode:"+32"},{id:22,name:"Burkina Faso",code:"BF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BF.svg",emoji:"🇧🇫",phoneCode:"+226"},{id:23,name:"Bulgaria",code:"BG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BG.svg",emoji:"🇧🇬",phoneCode:"+359"},{id:24,name:"Bahrain",code:"BH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BH.svg",emoji:"🇧🇭",phoneCode:"+973"},{id:25,name:"Burundi",code:"BI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BI.svg",emoji:"🇧🇮",phoneCode:"+257"},{id:26,name:"Benin",code:"BJ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BJ.svg",emoji:"🇧🇯",phoneCode:"+229"},{id:27,name:"St. Barthélemy",code:"BL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BL.svg",emoji:"🇧🇱",phoneCode:"+590"},{id:28,name:"Bermuda",code:"BM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BM.svg",emoji:"🇧🇲",phoneCode:"+1"},{id:29,name:"Brunei",code:"BN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BN.svg",emoji:"🇧🇳",phoneCode:"+673"},{id:30,name:"Bolivia",code:"BO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BO.svg",emoji:"🇧🇴",phoneCode:"+591"},{id:31,name:"Caribbean Netherlands",code:"BQ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BQ.svg",emoji:"🇧🇶",phoneCode:"+599"},{id:32,name:"Brazil",code:"BR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BR.svg",emoji:"🇧🇷",phoneCode:"+55"},{id:33,name:"Bahamas",code:"BS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BS.svg",emoji:"🇧🇸",phoneCode:"+1"},{id:34,name:"Bhutan",code:"BT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BT.svg",emoji:"🇧🇹",phoneCode:"+975"},{id:35,name:"Bouvet Island",code:"BV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BV.svg",emoji:"🇧🇻",phoneCode:"+47"},{id:36,name:"Botswana",code:"BW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BW.svg",emoji:"🇧🇼",phoneCode:"+267"},{id:37,name:"Belarus",code:"BY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BY.svg",emoji:"🇧🇾",phoneCode:"+375"},{id:38,name:"Belize",code:"BZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/BZ.svg",emoji:"🇧🇿",phoneCode:"+501"},{id:39,name:"Canada",code:"CA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CA.svg",emoji:"🇨🇦",phoneCode:"+1"},{id:40,name:"Cocos (Keeling) Islands",code:"CC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CC.svg",emoji:"🇨🇨",phoneCode:"+61"},{id:41,name:"Congo - Kinshasa",code:"CD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CD.svg",emoji:"🇨🇩",phoneCode:"+243"},{id:42,name:"Central African Republic",code:"CF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CF.svg",emoji:"🇨🇫",phoneCode:"+236"},{id:43,name:"Congo - Brazzaville",code:"CG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CG.svg",emoji:"🇨🇬",phoneCode:"+242"},{id:44,name:"Switzerland",code:"CH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CH.svg",emoji:"🇨🇭",phoneCode:"+41"},{id:45,name:"Côte d’Ivoire",code:"CI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CI.svg",emoji:"🇨🇮",phoneCode:"+225"},{id:46,name:"Cook Islands",code:"CK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CK.svg",emoji:"🇨🇰",phoneCode:"+682"},{id:47,name:"Chile",code:"CL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CL.svg",emoji:"🇨🇱",phoneCode:"+56"},{id:48,name:"Cameroon",code:"CM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CM.svg",emoji:"🇨🇲",phoneCode:"+237"},{id:49,name:"China",code:"CN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CN.svg",emoji:"🇨🇳",phoneCode:"+86"},{id:50,name:"Colombia",code:"CO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CO.svg",emoji:"🇨🇴",phoneCode:"+57"},{id:51,name:"Clipperton Island",code:"CP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CP.svg",emoji:"🇨🇵",phoneCode:"+689"},{id:52,name:"Costa Rica",code:"CR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CR.svg",emoji:"🇨🇷",phoneCode:"+506"},{id:53,name:"Cuba",code:"CU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CU.svg",emoji:"🇨🇺",phoneCode:"+53"},{id:54,name:"Cape Verde",code:"CV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CV.svg",emoji:"🇨🇻",phoneCode:"+238"},{id:55,name:"Curaçao",code:"CW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CW.svg",emoji:"🇨🇼",phoneCode:"+599"},{id:56,name:"Christmas Island",code:"CX",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CX.svg",emoji:"🇨🇽",phoneCode:"+61"},{id:57,name:"Cyprus",code:"CY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CY.svg",emoji:"🇨🇾",phoneCode:"+357"},{id:58,name:"Czechia",code:"CZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/CZ.svg",emoji:"🇨🇿",phoneCode:"+420"},{id:59,name:"Germany",code:"DE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DE.svg",emoji:"🇩🇪",phoneCode:"+49"},{id:60,name:"Diego Garcia",code:"DG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DG.svg",emoji:"🇩🇬",phoneCode:"+246"},{id:61,name:"Djibouti",code:"DJ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DJ.svg",emoji:"🇩🇯",phoneCode:"+253"},{id:62,name:"Denmark",code:"DK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DK.svg",emoji:"🇩🇰",phoneCode:"+45"},{id:63,name:"Dominica",code:"DM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DM.svg",emoji:"🇩🇲",phoneCode:"+1"},{id:64,name:"Dominican Republic",code:"DO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DO.svg",emoji:"🇩🇴",phoneCode:"+1"},{id:65,name:"Algeria",code:"DZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/DZ.svg",emoji:"🇩🇿",phoneCode:"+213"},{id:66,name:"Ceuta & Melilla",code:"EA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/EA.svg",emoji:"🇪🇦",phoneCode:"+34"},{id:67,name:"Ecuador",code:"EC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/EC.svg",emoji:"🇪🇨",phoneCode:"+593"},{id:68,name:"Estonia",code:"EE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/EE.svg",emoji:"🇪🇪",phoneCode:"+372"},{id:69,name:"Egypt",code:"EG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/EG.svg",emoji:"🇪🇬",phoneCode:"+20"},{id:70,name:"Western Sahara",code:"EH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/EH.svg",emoji:"🇪🇭",phoneCode:"+212"},{id:71,name:"Eritrea",code:"ER",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ER.svg",emoji:"🇪🇷",phoneCode:"+291"},{id:72,name:"Spain",code:"ES",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ES.svg",emoji:"🇪🇸",phoneCode:"+34"},{id:73,name:"Ethiopia",code:"ET",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ET.svg",emoji:"🇪🇹",phoneCode:"+251"},{id:75,name:"Finland",code:"FI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FI.svg",emoji:"🇫🇮",phoneCode:"+358"},{id:76,name:"Fiji",code:"FJ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FJ.svg",emoji:"🇫🇯",phoneCode:"+679"},{id:77,name:"Falkland Islands",code:"FK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FK.svg",emoji:"🇫🇰",phoneCode:"+500"},{id:78,name:"Micronesia",code:"FM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FM.svg",emoji:"🇫🇲",phoneCode:"+691"},{id:79,name:"Faroe Islands",code:"FO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FO.svg",emoji:"🇫🇴",phoneCode:"+298"},{id:80,name:"France",code:"FR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/FR.svg",emoji:"🇫🇷",phoneCode:"+33"},{id:81,name:"Gabon",code:"GA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GA.svg",emoji:"🇬🇦",phoneCode:"+241"},{id:82,name:"United Kingdom",code:"GB",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GB.svg",emoji:"🇬🇧",phoneCode:"+44"},{id:83,name:"Grenada",code:"GD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GD.svg",emoji:"🇬🇩",phoneCode:"+1"},{id:84,name:"Georgia",code:"GE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GE.svg",emoji:"🇬🇪",phoneCode:"+995"},{id:85,name:"French Guiana",code:"GF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GF.svg",emoji:"🇬🇫",phoneCode:"+594"},{id:86,name:"Guernsey",code:"GG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GG.svg",emoji:"🇬🇬",phoneCode:"+44"},{id:87,name:"Ghana",code:"GH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GH.svg",emoji:"🇬🇭",phoneCode:"+233"},{id:88,name:"Gibraltar",code:"GI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GI.svg",emoji:"🇬🇮",phoneCode:"+350"},{id:89,name:"Greenland",code:"GL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GL.svg",emoji:"🇬🇱",phoneCode:"+299"},{id:90,name:"Gambia",code:"GM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GM.svg",emoji:"🇬🇲",phoneCode:"+220"},{id:91,name:"Guinea",code:"GN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GN.svg",emoji:"🇬🇳",phoneCode:"+224"},{id:92,name:"Guadeloupe",code:"GP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GP.svg",emoji:"🇬🇵",phoneCode:"+590"},{id:93,name:"Equatorial Guinea",code:"GQ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GQ.svg",emoji:"🇬🇶",phoneCode:"+240"},{id:94,name:"Greece",code:"GR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GR.svg",emoji:"🇬🇷",phoneCode:"+30"},{id:95,name:"South Georgia & South Sandwich Islands",code:"GS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GS.svg",emoji:"🇬🇸",phoneCode:"+500"},{id:96,name:"Guatemala",code:"GT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GT.svg",emoji:"🇬🇹",phoneCode:"+502"},{id:97,name:"Guam",code:"GU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GU.svg",emoji:"🇬🇺",phoneCode:"+1"},{id:98,name:"Guinea-Bissau",code:"GW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GW.svg",emoji:"🇬🇼",phoneCode:"+245"},{id:99,name:"Guyana",code:"GY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/GY.svg",emoji:"🇬🇾",phoneCode:"+592"},{id:100,name:"Hong Kong SAR China",code:"HK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HK.svg",emoji:"🇭🇰",phoneCode:"+852"},{id:101,name:"Heard & McDonald Islands",code:"HM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HM.svg",emoji:"🇭🇲",phoneCode:"+672"},{id:102,name:"Honduras",code:"HN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HN.svg",emoji:"🇭🇳",phoneCode:"+504"},{id:103,name:"Croatia",code:"HR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HR.svg",emoji:"🇭🇷",phoneCode:"+385"},{id:104,name:"Haiti",code:"HT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HT.svg",emoji:"🇭🇹",phoneCode:"+509"},{id:105,name:"Hungary",code:"HU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/HU.svg",emoji:"🇭🇺",phoneCode:"+36"},{id:106,name:"Canary Islands",code:"IC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IC.svg",emoji:"🇮🇨",phoneCode:"+34"},{id:107,name:"Indonesia",code:"ID",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ID.svg",emoji:"🇮🇩",phoneCode:"+62"},{id:108,name:"Ireland",code:"IE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IE.svg",emoji:"🇮🇪",phoneCode:"+353"},{id:109,name:"Israel",code:"IL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IL.svg",emoji:"🇮🇱",phoneCode:"+972"},{id:110,name:"Isle of Man",code:"IM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IM.svg",emoji:"🇮🇲",phoneCode:"+44"},{id:111,name:"India",code:"IN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IN.svg",emoji:"🇮🇳",phoneCode:"+91"},{id:112,name:"British Indian Ocean Territory",code:"IO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IO.svg",emoji:"🇮🇴",phoneCode:"+246"},{id:113,name:"Iraq",code:"IQ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IQ.svg",emoji:"🇮🇶",phoneCode:"+964"},{id:114,name:"Iran",code:"IR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IR.svg",emoji:"🇮🇷",phoneCode:"+98"},{id:115,name:"Iceland",code:"IS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IS.svg",emoji:"🇮🇸",phoneCode:"+354"},{id:116,name:"Italy",code:"IT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/IT.svg",emoji:"🇮🇹",phoneCode:"+39"},{id:117,name:"Jersey",code:"JE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/JE.svg",emoji:"🇯🇪",phoneCode:"+44"},{id:118,name:"Jamaica",code:"JM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/JM.svg",emoji:"🇯🇲",phoneCode:"+1"},{id:119,name:"Jordan",code:"JO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/JO.svg",emoji:"🇯🇴",phoneCode:"+962"},{id:120,name:"Japan",code:"JP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/JP.svg",emoji:"🇯🇵",phoneCode:"+81"},{id:121,name:"Kenya",code:"KE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KE.svg",emoji:"🇰🇪",phoneCode:"+254"},{id:122,name:"Kyrgyzstan",code:"KG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KG.svg",emoji:"🇰🇬",phoneCode:"+996"},{id:123,name:"Cambodia",code:"KH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KH.svg",emoji:"🇰🇭",phoneCode:"+855"},{id:124,name:"Kiribati",code:"KI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KI.svg",emoji:"🇰🇮",phoneCode:"+686"},{id:125,name:"Comoros",code:"KM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KM.svg",emoji:"🇰🇲",phoneCode:"+269"},{id:126,name:"St. Kitts & Nevis",code:"KN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KN.svg",emoji:"🇰🇳",phoneCode:"+1"},{id:127,name:"North Korea",code:"KP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KP.svg",emoji:"🇰🇵",phoneCode:"+850"},{id:128,name:"South Korea",code:"KR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KR.svg",emoji:"🇰🇷",phoneCode:"+82"},{id:129,name:"Kuwait",code:"KW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KW.svg",emoji:"🇰🇼",phoneCode:"+965"},{id:130,name:"Cayman Islands",code:"KY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KY.svg",emoji:"🇰🇾",phoneCode:"+1"},{id:131,name:"Kazakhstan",code:"KZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/KZ.svg",emoji:"🇰🇿",phoneCode:"+7"},{id:132,name:"Laos",code:"LA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LA.svg",emoji:"🇱🇦",phoneCode:"+856"},{id:133,name:"Lebanon",code:"LB",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LB.svg",emoji:"🇱🇧",phoneCode:"+961"},{id:134,name:"St. Lucia",code:"LC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LC.svg",emoji:"🇱🇨",phoneCode:"+1"},{id:135,name:"Liechtenstein",code:"LI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LI.svg",emoji:"🇱🇮",phoneCode:"+423"},{id:136,name:"Sri Lanka",code:"LK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LK.svg",emoji:"🇱🇰",phoneCode:"+94"},{id:137,name:"Liberia",code:"LR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LR.svg",emoji:"🇱🇷",phoneCode:"+231"},{id:138,name:"Lesotho",code:"LS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LS.svg",emoji:"🇱🇸",phoneCode:"+266"},{id:139,name:"Lithuania",code:"LT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LT.svg",emoji:"🇱🇹",phoneCode:"+370"},{id:140,name:"Luxembourg",code:"LU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LU.svg",emoji:"🇱🇺",phoneCode:"+352"},{id:141,name:"Latvia",code:"LV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LV.svg",emoji:"🇱🇻",phoneCode:"+371"},{id:142,name:"Libya",code:"LY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/LY.svg",emoji:"🇱🇾",phoneCode:"+218"},{id:143,name:"Morocco",code:"MA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MA.svg",emoji:"🇲🇦",phoneCode:"+212"},{id:144,name:"Monaco",code:"MC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MC.svg",emoji:"🇲🇨",phoneCode:"+377"},{id:145,name:"Moldova",code:"MD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MD.svg",emoji:"🇲🇩",phoneCode:"+373"},{id:146,name:"Montenegro",code:"ME",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ME.svg",emoji:"🇲🇪",phoneCode:"+382"},{id:147,name:"St. Martin",code:"MF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MF.svg",emoji:"🇲🇫",phoneCode:"+590"},{id:148,name:"Madagascar",code:"MG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MG.svg",emoji:"🇲🇬",phoneCode:"+261"},{id:149,name:"Marshall Islands",code:"MH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MH.svg",emoji:"🇲🇭",phoneCode:"+692"},{id:150,name:"North Macedonia",code:"MK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MK.svg",emoji:"🇲🇰",phoneCode:"+389"},{id:151,name:"Mali",code:"ML",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ML.svg",emoji:"🇲🇱",phoneCode:"+223"},{id:152,name:"Myanmar (Burma)",code:"MM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MM.svg",emoji:"🇲🇲",phoneCode:"+95"},{id:153,name:"Mongolia",code:"MN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MN.svg",emoji:"🇲🇳",phoneCode:"+976"},{id:154,name:"Macao SAR China",code:"MO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MO.svg",emoji:"🇲🇴",phoneCode:"+853"},{id:155,name:"Northern Mariana Islands",code:"MP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MP.svg",emoji:"🇲🇵",phoneCode:"+1"},{id:156,name:"Martinique",code:"MQ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MQ.svg",emoji:"🇲🇶",phoneCode:"+596"},{id:157,name:"Mauritania",code:"MR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MR.svg",emoji:"🇲🇷",phoneCode:"+222"},{id:158,name:"Montserrat",code:"MS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MS.svg",emoji:"🇲🇸",phoneCode:"+1"},{id:159,name:"Malta",code:"MT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MT.svg",emoji:"🇲🇹",phoneCode:"+356"},{id:160,name:"Mauritius",code:"MU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MU.svg",emoji:"🇲🇺",phoneCode:"+230"},{id:161,name:"Maldives",code:"MV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MV.svg",emoji:"🇲🇻",phoneCode:"+960"},{id:162,name:"Malawi",code:"MW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MW.svg",emoji:"🇲🇼",phoneCode:"+265"},{id:163,name:"Mexico",code:"MX",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MX.svg",emoji:"🇲🇽",phoneCode:"+52"},{id:164,name:"Malaysia",code:"MY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MY.svg",emoji:"🇲🇾",phoneCode:"+60"},{id:165,name:"Mozambique",code:"MZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/MZ.svg",emoji:"🇲🇿",phoneCode:"+258"},{id:166,name:"Namibia",code:"NA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NA.svg",emoji:"🇳🇦",phoneCode:"+264"},{id:167,name:"New Caledonia",code:"NC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NC.svg",emoji:"🇳🇨",phoneCode:"+687"},{id:168,name:"Niger",code:"NE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NE.svg",emoji:"🇳🇪",phoneCode:"+227"},{id:169,name:"Norfolk Island",code:"NF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NF.svg",emoji:"🇳🇫",phoneCode:"+672"},{id:170,name:"Nigeria",code:"NG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NG.svg",emoji:"🇳🇬",phoneCode:"+234"},{id:171,name:"Nicaragua",code:"NI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NI.svg",emoji:"🇳🇮",phoneCode:"+505"},{id:172,name:"Netherlands",code:"NL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NL.svg",emoji:"🇳🇱",phoneCode:"+31"},{id:173,name:"Norway",code:"NO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NO.svg",emoji:"🇳🇴",phoneCode:"+47"},{id:174,name:"Nepal",code:"NP",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NP.svg",emoji:"🇳🇵",phoneCode:"+977"},{id:175,name:"Nauru",code:"NR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NR.svg",emoji:"🇳🇷",phoneCode:"+674"},{id:176,name:"Niue",code:"NU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NU.svg",emoji:"🇳🇺",phoneCode:"+683"},{id:177,name:"New Zealand",code:"NZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/NZ.svg",emoji:"🇳🇿",phoneCode:"+64"},{id:178,name:"Oman",code:"OM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/OM.svg",emoji:"🇴🇲",phoneCode:"+968"},{id:179,name:"Panama",code:"PA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PA.svg",emoji:"🇵🇦",phoneCode:"+507"},{id:180,name:"Peru",code:"PE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PE.svg",emoji:"🇵🇪",phoneCode:"+51"},{id:181,name:"French Polynesia",code:"PF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PF.svg",emoji:"🇵🇫",phoneCode:"+689"},{id:182,name:"Papua New Guinea",code:"PG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PG.svg",emoji:"🇵🇬",phoneCode:"+675"},{id:183,name:"Philippines",code:"PH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PH.svg",emoji:"🇵🇭",phoneCode:"+63"},{id:184,name:"Pakistan",code:"PK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PK.svg",emoji:"🇵🇰",phoneCode:"+92"},{id:185,name:"Poland",code:"PL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PL.svg",emoji:"🇵🇱",phoneCode:"+48"},{id:186,name:"St. Pierre & Miquelon",code:"PM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PM.svg",emoji:"🇵🇲",phoneCode:"+508"},{id:187,name:"Pitcairn Islands",code:"PN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PN.svg",emoji:"🇵🇳",phoneCode:"+64"},{id:188,name:"Puerto Rico",code:"PR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PR.svg",emoji:"🇵🇷",phoneCode:"+1"},{id:189,name:"Palestinian Territories",code:"PS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PS.svg",emoji:"🇵🇸",phoneCode:"+970"},{id:190,name:"Portugal",code:"PT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PT.svg",emoji:"🇵🇹",phoneCode:"+351"},{id:191,name:"Palau",code:"PW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PW.svg",emoji:"🇵🇼",phoneCode:"+680"},{id:192,name:"Paraguay",code:"PY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/PY.svg",emoji:"🇵🇾",phoneCode:"+595"},{id:193,name:"Qatar",code:"QA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/QA.svg",emoji:"🇶🇦",phoneCode:"+974"},{id:194,name:"Réunion",code:"RE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/RE.svg",emoji:"🇷🇪",phoneCode:"+262"},{id:195,name:"Romania",code:"RO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/RO.svg",emoji:"🇷🇴",phoneCode:"+40"},{id:196,name:"Serbia",code:"RS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/RS.svg",emoji:"🇷🇸",phoneCode:"+381"},{id:197,name:"Russia",code:"RU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/RU.svg",emoji:"🇷🇺",phoneCode:"+7"},{id:198,name:"Rwanda",code:"RW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/RW.svg",emoji:"🇷🇼",phoneCode:"+250"},{id:199,name:"Saudi Arabia",code:"SA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SA.svg",emoji:"🇸🇦",phoneCode:"+966"},{id:200,name:"Solomon Islands",code:"SB",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SB.svg",emoji:"🇸🇧",phoneCode:"+677"},{id:201,name:"Seychelles",code:"SC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SC.svg",emoji:"🇸🇨",phoneCode:"+248"},{id:202,name:"Sudan",code:"SD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SD.svg",emoji:"🇸🇩",phoneCode:"+249"},{id:203,name:"Sweden",code:"SE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SE.svg",emoji:"🇸🇪",phoneCode:"+46"},{id:204,name:"Singapore",code:"SG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SG.svg",emoji:"🇸🇬",phoneCode:"+65"},{id:205,name:"St. Helena",code:"SH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SH.svg",emoji:"🇸🇭",phoneCode:"+290"},{id:206,name:"Slovenia",code:"SI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SI.svg",emoji:"🇸🇮",phoneCode:"+386"},{id:207,name:"Svalbard & Jan Mayen",code:"SJ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SJ.svg",emoji:"🇸🇯",phoneCode:"+47"},{id:208,name:"Slovakia",code:"SK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SK.svg",emoji:"🇸🇰",phoneCode:"+421"},{id:209,name:"Sierra Leone",code:"SL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SL.svg",emoji:"🇸🇱",phoneCode:"+232"},{id:210,name:"San Marino",code:"SM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SM.svg",emoji:"🇸🇲",phoneCode:"+378"},{id:211,name:"Senegal",code:"SN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SN.svg",emoji:"🇸🇳",phoneCode:"+221"},{id:212,name:"Somalia",code:"SO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SO.svg",emoji:"🇸🇴",phoneCode:"+252"},{id:213,name:"Suriname",code:"SR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SR.svg",emoji:"🇸🇷",phoneCode:"+597"},{id:214,name:"South Sudan",code:"SS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SS.svg",emoji:"🇸🇸",phoneCode:"+211"},{id:215,name:"São Tomé & Príncipe",code:"ST",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ST.svg",emoji:"🇸🇹",phoneCode:"+239"},{id:216,name:"El Salvador",code:"SV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SV.svg",emoji:"🇸🇻",phoneCode:"+503"},{id:217,name:"Sint Maarten",code:"SX",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SX.svg",emoji:"🇸🇽",phoneCode:"+1"},{id:218,name:"Syria",code:"SY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SY.svg",emoji:"🇸🇾",phoneCode:"+963"},{id:219,name:"Eswatini",code:"SZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SZ.svg",emoji:"🇸🇿",phoneCode:"+268"},{id:220,name:"Tristan da Cunha",code:"TA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TA.svg",emoji:"🇹🇦",phoneCode:"+290"},{id:221,name:"Turks & Caicos Islands",code:"TC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TC.svg",emoji:"🇹🇨",phoneCode:"+1"},{id:222,name:"Chad",code:"TD",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TD.svg",emoji:"🇹🇩",phoneCode:"+235"},{id:223,name:"French Southern Territories",code:"TF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TF.svg",emoji:"🇹🇫",phoneCode:"+262"},{id:224,name:"Togo",code:"TG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TG.svg",emoji:"🇹🇬",phoneCode:"+228"},{id:225,name:"Thailand",code:"TH",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TH.svg",emoji:"🇹🇭",phoneCode:"+66"},{id:226,name:"Tajikistan",code:"TJ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TJ.svg",emoji:"🇹🇯",phoneCode:"+992"},{id:227,name:"Tokelau",code:"TK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TK.svg",emoji:"🇹🇰",phoneCode:"+690"},{id:228,name:"Timor-Leste",code:"TL",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TL.svg",emoji:"🇹🇱",phoneCode:"+670"},{id:229,name:"Turkmenistan",code:"TM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TM.svg",emoji:"🇹🇲",phoneCode:"+993"},{id:230,name:"Tunisia",code:"TN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TN.svg",emoji:"🇹🇳",phoneCode:"+216"},{id:231,name:"Tonga",code:"TO",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TO.svg",emoji:"🇹🇴",phoneCode:"+676"},{id:232,name:"Turkey",code:"TR",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TR.svg",emoji:"🇹🇷",phoneCode:"+90"},{id:233,name:"Trinidad & Tobago",code:"TT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TT.svg",emoji:"🇹🇹",phoneCode:"+1"},{id:234,name:"Tuvalu",code:"TV",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TV.svg",emoji:"🇹🇻",phoneCode:"+688"},{id:235,name:"Taiwan",code:"TW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TW.svg",emoji:"🇹🇼",phoneCode:"+886"},{id:236,name:"Tanzania",code:"TZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/TZ.svg",emoji:"🇹🇿",phoneCode:"+255"},{id:237,name:"Ukraine",code:"UA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/UA.svg",emoji:"🇺🇦",phoneCode:"+380"},{id:238,name:"Uganda",code:"UG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/UG.svg",emoji:"🇺🇬",phoneCode:"+256"},{id:239,name:"U.S. Outlying Islands",code:"UM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/UM.svg",emoji:"🇺🇲",phoneCode:"+1"},{id:241,name:"United States",code:"US",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/US.svg",emoji:"🇺🇸",phoneCode:"+1"},{id:242,name:"Uruguay",code:"UY",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/UY.svg",emoji:"🇺🇾",phoneCode:"+598"},{id:243,name:"Uzbekistan",code:"UZ",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/UZ.svg",emoji:"🇺🇿",phoneCode:"+998"},{id:244,name:"Vatican City",code:"VA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VA.svg",emoji:"🇻🇦",phoneCode:"+379"},{id:245,name:"St. Vincent & Grenadines",code:"VC",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VC.svg",emoji:"🇻🇨",phoneCode:"+1"},{id:246,name:"Venezuela",code:"VE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VE.svg",emoji:"🇻🇪",phoneCode:"+58"},{id:247,name:"British Virgin Islands",code:"VG",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VG.svg",emoji:"🇻🇬",phoneCode:"+1"},{id:248,name:"U.S. Virgin Islands",code:"VI",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VI.svg",emoji:"🇻🇮",phoneCode:"+1"},{id:249,name:"Vietnam",code:"VN",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VN.svg",emoji:"🇻🇳",phoneCode:"+84"},{id:250,name:"Vanuatu",code:"VU",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/VU.svg",emoji:"🇻🇺",phoneCode:"+678"},{id:251,name:"Wallis & Futuna",code:"WF",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/WF.svg",emoji:"🇼🇫",phoneCode:"+681"},{id:252,name:"Samoa",code:"WS",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/WS.svg",emoji:"🇼🇸",phoneCode:"+685"},{id:253,name:"Kosovo",code:"XK",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/XK.svg",emoji:"🇽🇰",phoneCode:"+383"},{id:254,name:"Yemen",code:"YE",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/YE.svg",emoji:"🇾🇪",phoneCode:"+967"},{id:255,name:"Mayotte",code:"YT",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/YT.svg",emoji:"🇾🇹",phoneCode:"+262"},{id:256,name:"South Africa",code:"ZA",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ZA.svg",emoji:"🇿🇦",phoneCode:"+27"},{id:257,name:"Zambia",code:"ZM",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ZM.svg",emoji:"🇿🇲",phoneCode:"+260"},{id:258,name:"Zimbabwe",code:"ZW",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ZW.svg",emoji:"🇿🇼",phoneCode:"+263"},{id:259,name:"England",code:"ENGLAND",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/ENGLAND.svg",emoji:"🏴",phoneCode:"+44"},{id:260,name:"Scotland",code:"SCOTLAND",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/SCOTLAND.svg",emoji:"🏴",phoneCode:"+44"},{id:261,name:"Wales",code:"WALES",image:"https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/WALES.svg",emoji:"🏴",phoneCode:"+44"}],Es=gs({id:"setting",state:()=>({countries:Qu,widgetLangs:{},languages:{},timezone:"",location:""}),actions:{async getWidgetLangs(){try{const o=await new Ai().getWidgetLangTexts();this.widgetLangs=o.text,this.languages=o.languages}catch(o){Ze(o)}},async getUserLocation(){try{const o=await new Ai().getLocation(),s=this.getAndParsedResponse(o).loc;this.location=s}catch(o){Ze(o)}},getAndParsedResponse(o){return o.data.trim().split(`
`).reduce(function(t,n){return n=n.split("="),t[n[0]]=n[1],t},{})}},persist:[{paths:["widgetLangs","languages","timezone","location"]}]}),Xu={class:"flex flex-col justify-between px-4 h-full"},ec={class:""},tc={key:0,class:"grid grid-cols-12 items-center gap-3 mb-2"},sc={class:"col-span-3 inline-flex bg-grey100 gap-3 px-[5px] py-1 w-[95px]"},ac=["onClick"],oc=["onClick"],nc={class:"bg-grey100 rounded-lg p-4 mb-2"},ic=["onClick"],lc={src:zn,alt:"close icon"},rc={class:"mb-4 mt-2 inline-flex bg-grey200 rounded-lg p-1 gap-1 items-center"},dc=["onClick"],uc=["onClick"],cc=["onClick"],mc={key:1,class:"relative h-[74px] mb-4"},gc={class:"text-grey600 text-sm leading-leading400 mb-1"},pc={class:"o-combobox"},vc={class:"input-field-text"},fc={class:"o-combobox__container relative"},hc=["onUpdate:modelValue","onFocusin","onBlur"],_c=["onClick"],yc=["onClick"],bc=["onClick","onMouseover"],wc={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},xc={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Cc=["onClick"],kc={class:"relative h-[74px] mb-4"},$c={class:"o-combobox"},Sc={class:"input-field-text"},Tc={class:"o-combobox__container relative"},Mc=["onUpdate:modelValue","onFocusin","onBlur"],Ac=["onClick"],Ec=["onClick"],Dc=["onClick","onMouseover"],Ic={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Fc={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Pc=["onClick"],jc={key:2,class:"relative h-[74px] mb-4"},Lc={class:"o-combobox"},Rc={class:"input-field-text"},Bc={class:"o-combobox__container relative"},Nc=["onUpdate:modelValue","onFocusin","onBlur"],Oc=["onClick"],Vc=["onClick"],Uc=["onClick","onMouseover"],Gc={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Wc={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},qc=["onClick"],Hc={key:3,class:"relative h-[74px] mb-4"},zc={class:"o-combobox"},Kc={class:"input-field-text"},Yc={class:"o-combobox__container relative"},Zc=["onUpdate:modelValue","onFocusin","onBlur"],Jc=["onClick"],Qc=["onClick"],Xc=["onClick","onMouseover"],em={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},tm={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},sm=["onClick"],am={key:4,class:"relative h-[74px] mb-4"},om={class:"o-combobox"},nm={class:"input-field-text"},im={class:"o-combobox__container relative"},lm=["onUpdate:modelValue","onFocusin","onBlur"],rm=["onClick"],dm=["onClick"],um=["onClick","onMouseover"],cm={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},mm={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},gm=["onClick"],pm={key:5,class:"relative h-[74px] mb-4"},vm={class:"o-combobox"},fm={class:"input-field-text"},hm={class:"o-combobox__container relative"},_m=["onUpdate:modelValue","onFocusin","onBlur"],ym=["onClick"],bm=["onClick"],wm=["onClick","onMouseover"],xm={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Cm={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},km=["onClick"],$m={key:6,class:"relative h-[74px] mb-4"},Sm={class:"o-combobox"},Tm={class:"input-field-text"},Mm={class:"o-combobox__container relative"},Am=["onUpdate:modelValue","onFocusin","onBlur"],Em=["onClick"],Dm=["onClick"],Im=["onClick","onMouseover"],Fm={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Pm={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},jm=["onClick"],Lm={key:7,class:"relative h-[74px] mb-4"},Rm={class:"o-combobox"},Bm={class:"input-field-text"},Nm={class:"o-combobox__container relative"},Om=["onUpdate:modelValue","onFocusin","onBlur"],Vm=["onClick"],Um=["onClick"],Gm=["onClick","onMouseover"],Wm={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},qm={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Hm=["onClick"],zm={src:en,alt:""},Km={key:0,class:"bg-[#FFCB141A] mb-[123px] rounded-lg mt-4"},Ym=fe({__name:"AddSegment",props:{showModal:{type:Boolean}},emits:["close"],setup(o,{emit:s}){const t=At(),{height:n}=Ht(),l=jt(),i=Es(),m=ys(),r=Ae(),u=$(""),g=$(0),y=$(null),c=s,w=b(()=>l.segmentFields),f=b(()=>i.countries),v=b(()=>m.agents),C=b(()=>{var G,U;return r.hasTrial&&!((G=r.user)!=null&&G.attributes.pro_year_trial)&&((U=r.subscription)==null?void 0:U.attributes.plan_type.toLowerCase())!=="pro"}),_=Nt({name:"",owner_type:"chat_contact",rules:[{field:"",field_type:"custom_field",conditional_op:"",value:"",fieldsArray:w.value.filter(G=>G.field_type!=="tag"),segmentConditions:Ga,showConditionOptions:!1,showTagOptions:!1,conditionValueHolder:"",searchConditionValue:"",showFieldOptions:!1,fieldValueHolder:"",searchFieldValue:"",tagValueHolder:"",searchTagValue:""}]}),A=b(()=>({name:{required:Ye.withMessage("Segment name is required",ut)},rules:{$each:Ye.forEach({field:{required:Ye.withMessage("Field is required",ut)},field_type:{required:Ye.withMessage("Field type is required",ut)},conditional_op:{required:Ye.withMessage("Condition is required",ut)}})}})),D=b(()=>l.uiFlags.isCreatingSegment),T=b(()=>{var G;return _.rules[g.value].searchConditionValue?(G=_.rules[g.value].segmentConditions)==null?void 0:G.filter(U=>{var R;return U.name.toLowerCase().includes((R=_.rules[g.value].searchConditionValue)==null?void 0:R.toLowerCase())}):_.rules[g.value].segmentConditions}),B=b(()=>{var U;const G=w.value.filter(R=>R.field_type!=="tag");return(U=_.rules[g.value])!=null&&U.searchFieldValue?G.filter(R=>{var ee,se;return R.name.toLowerCase().includes((se=(ee=_.rules[g.value])==null?void 0:ee.searchFieldValue)==null?void 0:se.toLowerCase())}):G}),S=b(()=>{const G=w.value.filter(U=>U.field_type==="tag");return _.rules[g.value].searchTagValue?G.filter(U=>{var R;return U.name.toLowerCase().includes((R=_.rules[g.value].searchTagValue)==null?void 0:R.toLowerCase())}):G}),E=b(()=>{const G=fo;return _.rules[g.value].searchTagValue?G.filter(U=>{var R;return U.name.toLowerCase().includes((R=_.rules[g.value].searchTagValue)==null?void 0:R.toLowerCase())}):G}),x=b(()=>{const G=["Online","Offline"];return _.rules[g.value].searchTagValue?G.filter(U=>{var R;return U.toLowerCase().includes((R=_.rules[g.value].searchTagValue)==null?void 0:R.toLowerCase())}):G}),P=b(()=>{const G=wl;return _.rules[g.value].searchTagValue?G.filter(U=>{var R;return U.toLowerCase().includes((R=_.rules[g.value].searchTagValue)==null?void 0:R.toLowerCase())}):G}),j=b(()=>{var G;return _.rules[g.value].searchTagValue?(G=f.value)==null?void 0:G.filter(U=>{var R;return U.name.toLowerCase().includes((R=_.rules[g.value].searchTagValue)==null?void 0:R.toLowerCase())}):f.value}),H=b(()=>{var U,R;const G=_.rules[g.value];if(G!=null&&G.searchTagValue){const ee=G.searchTagValue.toLowerCase();return(U=v.value)==null?void 0:U.filter(Y=>{var st,Le;const Fe=(st=Y.attributes)==null?void 0:st.name,oe=(Le=Y.attributes)==null?void 0:Le.status;return Fe&&oe!=="pending"&&oe!=="deactivated"?Fe.toLowerCase().includes(ee):!1})}return(R=v.value)==null?void 0:R.filter(ee=>{var se,Y;return((se=ee.attributes)==null?void 0:se.status)!=="pending"&&((Y=ee.attributes)==null?void 0:Y.status)!=="deactivated"})}),k=bs(A,_),M=()=>{c("close")},V=()=>{const G=w.value.filter(U=>U.field_type!=="tag");_.rules.push({field:"",field_type:"custom_field",conditional_op:"",value:"",fieldsArray:G,logical_op:"and",segmentConditions:Ga,showConditionOptions:!1,showTagOptions:!1,conditionValueHolder:"",searchConditionValue:"",showFieldOptions:!1,fieldValueHolder:"",searchFieldValue:"",tagValueHolder:"",searchTagValue:""}),Ft(()=>{L()})},Z=G=>{_.rules.splice(G,1)},ae=(G,U)=>{_.rules[G].logical_op=U},ce=(G,U,R)=>{if((_.rules[G].field!==R||_.rules[G].field_type!==U)&&(_.rules[G].field_type=U,_.rules[G].field="",_.rules[G].searchFieldValue="",_.rules[G].fieldValueHolder="",_.rules[G].conditional_op="",_.rules[G].conditionValueHolder="",_.rules[G].searchConditionValue="",_.rules[G].tagValueHolder="",_.rules[G].searchTagValue="",_.rules[G].value=""),R){_.rules[G].field=R;const ee=us(R,"_"," ");k.value.rules.$model[G].fieldValueHolder=`${ee==null?void 0:ee.charAt(0).toUpperCase()}${ee==null?void 0:ee.slice(1)}`}if(U==="custom_field"||U==="chat_contact"&&R!=="country"&&R!=="online_status"&&R!=="language"&&R!=="timezone"){_.rules[G].fieldsArray=w.value.filter(ee=>ee.field_type!=="tag"),_.rules[G].segmentConditions=Ga,_.rules[G].showFieldOptions=!1;return}U==="tag"&&(_.rules[G].fieldsArray=w.value.filter(ee=>ee.field_type==="tag"),_.rules[G].field="tag",_.rules[G].fieldValueHolder="tag",_.rules[G].showFieldOptions=!1),_.rules[G].segmentConditions=[{id:"equals",name:"Equals"},{id:"does_not_equal",name:"Does not equal"}],U==="conversation"&&(_.rules[G].fieldsArray=w.value.filter(ee=>ee.field_type==="conversation"),_.rules[G].field="conversation",_.rules[G].fieldValueHolder="conversation",_.rules[G].showFieldOptions=!1,_.rules[G].segmentConditions=[{id:"is_resolved",name:"Is resolved"},{id:"is_unresolved",name:"Is unresolved"},{id:"assigned_to",name:"Assigned to"},{id:"not_assigned_to",name:"Not assigned to"},{id:"unassigned",name:"Unassigned"},{id:"is_starred",name:"Is starred"},{id:"not_starred",name:"Not starred"}])},J=(G,U)=>{k.value.rules.$model[G].conditional_op=U,_.rules[g.value].searchConditionValue="";const R=U==="does_not_contain_any_value"?"Does not exist for a contact":us(U,"_"," ");k.value.rules.$model[G].conditionValueHolder=`${R==null?void 0:R.charAt(0).toUpperCase()}${R==null?void 0:R.slice(1)}`,(U==="contains_any_value"||U==="does_not_contain_any_value")&&(_.rules[G].value=""),_.rules[G].showConditionOptions=!1},X=(G,U)=>{k.value.rules.$model[G].value=U,_.rules[g.value].searchTagValue="";const R=us(U,"_"," ");k.value.rules.$model[G].tagValueHolder=`${R==null?void 0:R.charAt(0).toUpperCase()}${R==null?void 0:R.slice(1)}`,_.rules[G].showTagOptions=!1},z=(G,U)=>{k.value.rules.$model[G].value=U.code,_.rules[g.value].searchTagValue="",_.rules[g.value].tagValueHolder=U.name,_.rules[G].showTagOptions=!1},q=(G,U)=>{k.value.rules.$model[G].value=[U.id],_.rules[g.value].searchTagValue="",_.rules[g.value].tagValueHolder=U.attributes.name,_.rules[G].showTagOptions=!1},ue=()=>{k.value.$touch();const G=[];_.rules.forEach((U,R)=>{G.push(k.value.rules.$dirty&&!k.value.rules.$model[R].value&&_.rules[R].conditional_op!=="contains_any_value"&&_.rules[R].conditional_op!=="does_not_contain_any_value"&&_.rules[R].conditional_op!=="is_resolved"&&_.rules[R].conditional_op!=="is_unresolved"&&_.rules[R].conditional_op!=="unassigned"&&_.rules[R].conditional_op!=="is_starred"&&_.rules[R].conditional_op!=="not_starred"&&_.rules[R].conditional_op!=="assigned_to"&&_.rules[R].conditional_op!=="not_assigned_to")}),!(k.value.$invalid||G.includes(!0))&&l.createSegment(_)},pe=G=>{setTimeout(()=>{_.rules[G].showConditionOptions=!1},500)},de=G=>{setTimeout(()=>{_.rules[G].showFieldOptions=!1},500)},he=(G,U)=>{setTimeout(()=>{U==="tag"&&(S.value.find(ee=>{var se;return ee.name.toLowerCase()===((se=_.rules[G].tagValueHolder)==null?void 0:se.toLowerCase())})||(_.rules[G].tagValueHolder="",_.rules[G].value="",_.rules[G].searchTagValue="")),U==="country"&&(j.value.find(ee=>{var se;return ee.name.toLowerCase()===((se=_.rules[G].tagValueHolder)==null?void 0:se.toLowerCase())})||(_.rules[G].tagValueHolder="",_.rules[G].value="",_.rules[G].searchTagValue="")),U==="online_status"&&(x.value.find(ee=>{var se;return ee.toLowerCase()===((se=_.rules[G].tagValueHolder)==null?void 0:se.toLowerCase())})||(_.rules[G].tagValueHolder="",_.rules[G].value="",_.rules[G].searchTagValue="")),U==="language"&&(P.value.find(ee=>{var se;return ee.toLowerCase()===((se=_.rules[G].tagValueHolder)==null?void 0:se.toLowerCase())})||(_.rules[G].tagValueHolder="",_.rules[G].value="",_.rules[G].searchTagValue="")),U==="timezone"&&(E.value.find(ee=>ee.id===_.rules[G].value)||(_.rules[G].tagValueHolder="",_.rules[G].value="",_.rules[G].searchTagValue="")),_.rules[G].showTagOptions=!1},500)},ve=G=>{g.value=G,_.rules[G].showConditionOptions=!_.rules[G].showConditionOptions},be=G=>{g.value=G,_.rules[G].showTagOptions=!_.rules[G].showTagOptions},re=G=>{g.value=G,_.rules[G].showFieldOptions=!_.rules[G].showFieldOptions},ie=()=>{_.rules[g.value].searchConditionValue=_.rules[g.value].conditionValueHolder,_.rules[g.value].conditionValueHolder||(_.rules[g.value].conditional_op="")},xe=()=>{_.rules[g.value].searchFieldValue=_.rules[g.value].fieldValueHolder,_.rules[g.value].fieldValueHolder||(_.rules[g.value].field="")},N=()=>{_.rules[g.value].searchTagValue=_.rules[g.value].tagValueHolder,_.rules[g.value].tagValueHolder||(_.rules[g.value].value="")};function L(){const G=y==null?void 0:y.value;G&&G.scrollTo({top:G.scrollHeight,behavior:"smooth"})}const me=()=>{c("close"),t.push({name:"settings-plans-view"})};return(G,U)=>{const R=Pe("InputField"),ee=He("svg-inline");return a(),ne(bl,{closeModal:G.showModal,showFooter:!0,isLoading:D.value,headerTitle:"New Segment",onCloseModal:M,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save New Segment",onActionButtonTypeOne:M,onActionButtonTypeTwo:ue},{default:K(()=>[e("div",Xu,[e("div",ec,[W(R,{class:"mb-3",value:_.name,type:"text",forValue:"name",placeholder:"Enter the segment name",hasError:p(k).name.$error&&p(k).name.$dirty,validationMessage:p(k).name.$errors,onBlur:U[0]||(U[0]=se=>p(k).name.$touch()),onInput:U[1]||(U[1]=se=>_.name=se)},null,8,["value","hasError","validationMessage"]),e("div",{ref_key:"segmentView",ref:y,class:O(["segment-max-height overflow-y-auto",{"segment-max-height-for-trial":C.value,"segment-max-height":!C.value,"pb-20":_.rules.length>2&&_.rules[g.value].showConditionOptions,"pb-[150px]":_.rules.length>2&&_.rules[g.value].showTagOptions}])},[(a(!0),d(Se,null,Ne(_.rules,(se,Y)=>{var Fe,oe,st,Le,le,Ie,rt,Et;return a(),d("div",{key:Y},[Y!==0?(a(),d("div",tc,[U[10]||(U[10]=e("div",{class:"col-span-5 bg-grey200 border h-px"},null,-1)),e("div",sc,[e("span",{onClick:ye=>ae(Y,"and"),class:O(["px-2 py-0.5 text-sm cursor-pointer",{"text-primary bg-white":se.logical_op==="and","text-grey":se.logical_op!=="and"}])}," and ",10,ac),e("span",{onClick:ye=>ae(Y,"or"),class:O(["px-2 py-0.5 text-sm cursor-pointer",{"text-primary bg-white":se.logical_op==="or","text-grey":se.logical_op!=="or"}])}," or ",10,oc)]),U[11]||(U[11]=e("div",{class:"col-span-4 bg-grey200 border h-px"},null,-1))])):h("",!0),e("div",nc,[_.rules.length>1?(a(),d("button",{key:0,onClick:ye=>Z(Y),class:"z-[1] w-4 h-4 bg-grey200 flex items-center justify-center rounded-full p-[2px] cursor-pointer float-right"},[F(e("img",lc,null,512),[[ee]])],8,ic)):h("",!0),e("div",rc,[e("div",{onClick:ye=>ce(Y,"custom_field"),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[Y].field_type==="custom_field"||p(k).rules.$model[Y].field_type==="chat_contact"}])}," Custom data ",10,dc),e("div",{onClick:ye=>ce(Y,"tag"),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[Y].field_type==="tag"}])}," Tags ",10,uc),e("div",{onClick:ye=>ce(Y,"conversation"),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[Y].field_type==="conversation"}])}," Conversation data ",10,cc)]),p(k).rules.$model[Y].field_type!=="tag"&&p(k).rules.$model[Y].field_type!=="conversation"?(a(),d("div",mc,[e("label",gc,I(p(k).rules.$model[Y].field_type==="custom_data"?"Custom Data":"Field"),1),e("div",pc,[e("div",vc,[e("div",fc,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showFieldOptions,error:p(k).rules.$each.$response.$data[Y].field.$error&&p(k).rules.$dirty}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].fieldValueHolder=ye,onInput:xe,onFocusin:ye=>re(Y),onBlur:ye=>de(Y)},null,42,hc),[[bt,p(k).rules.$model[Y].fieldValueHolder]]),_.rules[Y].showFieldOptions?(a(),d("img",{key:0,onClick:ye=>re(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,_c)):(a(),d("img",{key:1,onClick:Qe(ye=>re(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,yc))])]),_.rules[Y].showFieldOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",T.value&&T.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(B.value,ye=>(a(),d("li",{class:O([[u.value===ye.name||p(k).rules.$model[Y].field===ye.name?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4 first-letter:uppercase"],"o-date-list__item"]),key:ye.name,onClick:_t=>ce(Y,ye.field_type,ye.name),onMouseover:_t=>u.value=ye.name,onMouseleave:U[2]||(U[2]=_t=>u.value="")},[_e(I(p(us)(ye.name,"_"," "))+" ",1),p(k).rules.$model[Y].field===ye.name?(a(),d("span",wc,[F(e("img",xc,null,512),[[ee]])])):h("",!0)],42,bc))),128)),(Fe=B.value)!=null&&Fe.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>re(Y),class:"text-gray-900 px-4"},"Field not found",8,Cc))],2)):h("",!0)])])):h("",!0),e("div",kc,[U[12]||(U[12]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Condition",-1)),e("div",$c,[e("div",Sc,[e("div",Tc,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showConditionOptions,error:p(k).rules.$each.$response.$data[Y].conditional_op.$error&&p(k).rules.$dirty}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].conditionValueHolder=ye,onInput:ie,onFocusin:ye=>ve(Y),onBlur:ye=>pe(Y)},null,42,Mc),[[bt,p(k).rules.$model[Y].conditionValueHolder]]),_.rules[Y].showConditionOptions?(a(),d("img",{key:0,onClick:ye=>ve(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Ac)):(a(),d("img",{key:1,onClick:Qe(ye=>ve(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Ec))])]),_.rules[Y].showConditionOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",T.value&&T.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(T.value,ye=>(a(),d("li",{class:O([[u.value===ye.name||p(k).rules.$model[Y].conditional_op===ye.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:ye.id,onClick:_t=>J(Y,ye.id),onMouseover:_t=>u.value=ye.name,onMouseleave:U[3]||(U[3]=_t=>u.value="")},[_e(I(ye.name)+" ",1),p(k).rules.$model[Y].conditional_op===ye.id?(a(),d("span",Ic,[F(e("img",Fc,null,512),[[ee]])])):h("",!0)],42,Dc))),128)),(oe=T.value)!=null&&oe.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>ve(Y),class:"text-gray-900 px-4"},"Condition not found",8,Pc))],2)):h("",!0)])]),p(k).rules.$model[Y].field_type==="tag"?(a(),d("div",jc,[U[13]||(U[13]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",Lc,[e("div",Rc,[e("div",Bc,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"tag")},null,42,Nc),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Oc)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Vc))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(S.value,ye=>(a(),d("li",{class:O([[u.value===ye.name||p(k).rules.$model[Y].value===ye.name?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:ye.name,onClick:_t=>X(Y,ye.name),onMouseover:_t=>u.value=ye.name,onMouseleave:U[4]||(U[4]=_t=>u.value="")},[_e(I(ye.name)+" ",1),p(k).rules.$model[Y].value===ye.name?(a(),d("span",Gc,[F(e("img",Wc,null,512),[[ee]])])):h("",!0)],42,Uc))),128)),(st=S.value)!=null&&st.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Tag not found",8,qc))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].field==="timezone"?(a(),d("div",Hc,[U[14]||(U[14]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",zc,[e("div",Kc,[e("div",Yc,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"timezone")},null,42,Zc),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Jc)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Qc))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(E.value,ye=>(a(),d("li",{class:O([[u.value===ye.name||p(k).rules.$model[Y].value===ye.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:ye.id,onClick:_t=>X(Y,ye.id),onMouseover:_t=>u.value=ye.id,onMouseleave:U[5]||(U[5]=_t=>u.value="")},[_e(I(ye.id)+" ",1),p(k).rules.$model[Y].value===ye.id?(a(),d("span",em,[F(e("img",tm,null,512),[[ee]])])):h("",!0)],42,Xc))),128)),(Le=E.value)!=null&&Le.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Timezone not found",8,sm))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].field.toLowerCase()==="online_status"?(a(),d("div",am,[U[15]||(U[15]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",om,[e("div",nm,[e("div",im,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"online_status")},null,42,lm),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,rm)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,dm))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(x.value,(ye,_t)=>(a(),d("li",{class:O([[u.value===ye||p(k).rules.$model[Y].value===ye?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:_t,onClick:Ce=>X(Y,ye),onMouseover:Ce=>u.value=ye,onMouseleave:U[6]||(U[6]=Ce=>u.value="")},[_e(I(ye)+" ",1),p(k).rules.$model[Y].value===ye?(a(),d("span",cm,[F(e("img",mm,null,512),[[ee]])])):h("",!0)],42,um))),128)),(le=x.value)!=null&&le.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Value not found",8,gm))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].field.toLowerCase()==="language"?(a(),d("div",pm,[U[16]||(U[16]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",vm,[e("div",fm,[e("div",hm,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"language")},null,42,_m),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,ym)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,bm))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(P.value,(ye,_t)=>(a(),d("li",{class:O([[u.value===ye||p(k).rules.$model[Y].value===ye?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:_t,onClick:Ce=>X(Y,ye),onMouseover:Ce=>u.value=ye,onMouseleave:U[7]||(U[7]=Ce=>u.value="")},[_e(I(ye)+" ",1),p(k).rules.$model[Y].value===ye?(a(),d("span",xm,[F(e("img",Cm,null,512),[[ee]])])):h("",!0)],42,wm))),128)),(Ie=P.value)!=null&&Ie.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Value not found",8,km))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].field.toLowerCase()==="country"?(a(),d("div",$m,[U[17]||(U[17]=e("label",{class:"text-grey600 text-sm leading-leading400"},"Value",-1)),e("div",Sm,[e("div",Tm,[e("div",Mm,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"country")},null,42,Am),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Em)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Dm))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",j.value&&j.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(j.value,ye=>(a(),d("li",{class:O([[u.value===ye.name||p(k).rules.$model[Y].value===ye.code?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:ye.name,onClick:_t=>z(Y,ye),onMouseover:_t=>u.value=ye.name,onMouseleave:U[8]||(U[8]=_t=>u.value="")},[_e(I(ye.name)+" ",1),p(k).rules.$model[Y].value===ye.code?(a(),d("span",Fm,[F(e("img",Pm,null,512),[[ee]])])):h("",!0)],42,Im))),128)),(rt=j.value)!=null&&rt.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Country not found",8,jm))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].conditional_op.toLowerCase()==="not_assigned_to"||p(k).rules.$model[Y].conditional_op.toLowerCase()==="assigned_to"?(a(),d("div",Lm,[U[18]||(U[18]=e("label",{class:"text-grey600 text-sm leading-leading400"},"Agents",-1)),e("div",Rm,[e("div",Bm,[e("div",Nm,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":_.rules[Y].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":ye=>p(k).rules.$model[Y].tagValueHolder=ye,onInput:N,onFocusin:ye=>be(Y),onBlur:ye=>he(Y,"conversation")},null,42,Om),[[bt,p(k).rules.$model[Y].tagValueHolder]]),_.rules[Y].showTagOptions?(a(),d("img",{key:0,onClick:ye=>be(Y),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Vm)):(a(),d("img",{key:1,onClick:Qe(ye=>be(Y),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Um))])]),_.rules[Y].showTagOptions?(a(),d("ul",{key:0,class:O([[_.rules.length===1||_.rules.length<3&&p(n)>1e3?"fixed !w-[376px]":"absolute",H.value&&H.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(H.value,ye=>(a(),d("li",{class:O([[u.value===ye.id||p(k).rules.$model[Y].value===ye.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:ye.id,onClick:_t=>q(Y,ye),onMouseover:_t=>u.value=ye.id,onMouseleave:U[9]||(U[9]=_t=>u.value="")},[_e(I(ye.attributes.name)+" ",1),p(k).rules.$model[Y].value===ye.id?(a(),d("span",Wm,[F(e("img",qm,null,512),[[ee]])])):h("",!0)],42,Gm))),128)),(Et=H.value)!=null&&Et.length?h("",!0):(a(),d("li",{key:0,onClick:ye=>be(Y),class:"text-gray-900 px-4"},"Agent not found",8,Hm))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[Y].conditional_op!=="contains_any_value"&&p(k).rules.$model[Y].conditional_op!=="does_not_contain_any_value"&&p(k).rules.$model[Y].field.toLowerCase()!=="country"&&p(k).rules.$model[Y].field.toLowerCase()!=="online_status"&&p(k).rules.$model[Y].field.toLowerCase()!=="language"&&p(k).rules.$model[Y].field.toLowerCase()!=="timezone"&&p(k).rules.$model[Y].field_type!=="tag"&&p(k).rules.$model[Y].field_type!=="conversation"?(a(),ne(R,{key:8,class:"input-field text-base text-grey900",label:"Value",value:p(k).rules.$model[Y].value,type:"text",forValue:"value",placeholder:"Value",onInput:ye=>p(k).rules.$model[Y].value=ye,classes:p(k).rules.$dirty&&!p(k).rules.$model[Y].value&&_.rules[Y].conditional_op!=="contains_any_value"&&_.rules[Y].conditional_op!=="does_not_contain_any_value"?"error":""},null,8,["value","onInput","classes"])):h("",!0)])])}),128))],2),e("div",{class:"sticky z-10 inline-flex gap-1 cursor-pointer",onClick:V},[F(e("img",zm,null,512),[[ee]]),U[19]||(U[19]=e("span",{class:"text-sm text-grey900"},"Add condition",-1))])]),C.value?(a(),d("div",Km,[e("div",{class:"text-grey900 text-xs leading-[140%] px-4 py-3"},[U[20]||(U[20]=e("span",{class:"text-grey900 font-semibold"},"Please note:",-1)),U[21]||(U[21]=_e(" that once the trial period ends, you won't be able to use Segments. ")),e("span",{onClick:me,class:"text-grey900 underline cursor-pointer"},"Upgrade to Pro"),U[22]||(U[22]=_e(" so that you can continue using the Segments you create "))])])):h("",!0)])]),_:1},8,["closeModal","isLoading"])}}});const Zm=Oe(Ym,[["__scopeId","data-v-bb4b5412"]]),Jm={class:"px-4 pt-4 pb-[16px]"},Qm={class:"text-left"},Xm=fe({__name:"DeleteSegment",props:{showModal:{type:Boolean},segment:{}},setup(o){const s=jt(),t=o,n=b(()=>s.uiFlags.isDeletingSegment),l=()=>{s.showDeleteSegmentModal=!1},i=()=>{s.deleteSegment(t.segment.id)};return(m,r)=>{const u=Pe("Modal");return m.showModal?(a(),ne(u,{key:0,"header-title":"Delete Segment?",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete Segment",closeModal:m.showModal,isLoading:n.value,onActionButtonTypeOne:l,onActionButtonTypeTwo:i,onCloseModal:l,class:"!z-[9999999999]"},{default:K(()=>[e("div",Jm,[e("p",Qm,"Are you sure you want to delete "+I(m.segment.attributes.name)+" segment?",1)])]),_:1},8,["closeModal","isLoading"])):h("",!0)}}}),eg={class:"px-4"},tg={key:0,class:"grid grid-cols-12 items-center gap-3 mb-2"},sg={class:"col-span-3 inline-flex bg-grey100 gap-3 px-[5px] py-1 w-[95px]"},ag=["onClick"],og=["onClick"],ng={class:"bg-grey100 rounded-lg p-4 mb-2"},ig=["onClick"],lg={src:zn,alt:"close icon"},rg={class:"mb-4 mt-2 inline-flex bg-grey200 rounded-lg p-1 gap-1 items-center"},dg=["onClick"],ug=["onClick"],cg=["onClick"],mg={key:1,class:"relative h-[74px] mb-4"},gg={class:"text-grey600 text-sm leading-leading400 mb-1"},pg={class:"o-combobox"},vg={class:"input-field-text"},fg={class:"o-combobox__container relative"},hg=["onUpdate:modelValue","onFocusin","onBlur"],_g=["onClick"],yg=["onClick"],bg=["onClick","onMouseover"],wg={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},xg={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Cg=["onClick"],kg={class:"relative h-[74px] mb-4"},$g={class:"o-combobox"},Sg={class:"input-field-text"},Tg={class:"o-combobox__container relative"},Mg=["onUpdate:modelValue","onFocusin","onBlur"],Ag=["onClick"],Eg=["onClick"],Dg=["onClick","onMouseover"],Ig={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Fg={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Pg=["onClick"],jg={key:2,class:"relative h-[74px] mb-4"},Lg={class:"o-combobox"},Rg={class:"input-field-text"},Bg={class:"o-combobox__container relative"},Ng=["onUpdate:modelValue","onFocusin","onBlur"],Og=["onClick"],Vg=["onClick"],Ug=["onClick","onMouseover"],Gg={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Wg={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},qg=["onClick"],Hg={key:3,class:"relative h-[74px] mb-4"},zg={class:"o-combobox"},Kg={class:"input-field-text"},Yg={class:"o-combobox__container relative"},Zg=["onUpdate:modelValue","onFocusin","onBlur"],Jg=["onClick"],Qg=["onClick"],Xg=["onClick","onMouseover"],ep={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},tp={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},sp=["onClick"],ap={key:4,class:"relative h-[74px] mb-4"},op={class:"o-combobox"},np={class:"input-field-text"},ip={class:"o-combobox__container relative"},lp=["onUpdate:modelValue","onFocusin","onBlur"],rp=["onClick"],dp=["onClick"],up=["onClick","onMouseover"],cp={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},mp={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},gp=["onClick"],pp={key:5,class:"relative h-[74px] mb-4"},vp={class:"o-combobox"},fp={class:"input-field-text"},hp={class:"o-combobox__container relative"},_p=["onUpdate:modelValue","onFocusin","onBlur"],yp=["onClick"],bp=["onClick"],wp=["onClick","onMouseover"],xp={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Cp={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},kp=["onClick"],$p={key:6,class:"relative h-[74px]"},Sp={class:"o-combobox"},Tp={class:"input-field-text"},Mp={class:"o-combobox__container relative"},Ap=["onUpdate:modelValue","onFocusin","onBlur"],Ep=["onClick"],Dp=["onClick"],Ip=["onClick","onMouseover"],Fp={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},Pp={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},jp=["onClick"],Lp={key:7,class:"relative h-[74px] mb-4"},Rp={class:"o-combobox"},Bp={class:"input-field-text"},Np={class:"o-combobox__container relative"},Op=["onUpdate:modelValue","onFocusin","onBlur"],Vp=["onClick"],Up=["onClick"],Gp=["onClick","onMouseover"],Wp={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},qp={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},Hp=["onClick"],zp={src:en,alt:""},Kp=fe({__name:"EditSegment",props:{showModal:{type:Boolean}},emits:["close"],setup(o,{emit:s}){const{height:t}=Ht(),n=jt(),l=Es(),i=ys(),m=s,r=$(""),u=$(0),g=$(null),y=$([]),c=Nt({name:"",owner_type:"chat_contact",rules:[{field:"",field_type:"",conditional_op:"",value:""}]}),w=b(()=>l.countries),f=b(()=>i.agents),v=b(()=>({name:{required:Ye.withMessage("Segment name is required",ut)},rules:{$each:Ye.forEach({field:{required:Ye.withMessage("Field is required",ut)},field_type:{required:Ye.withMessage("Field type is required",ut)},conditional_op:{required:Ye.withMessage("Condition is required",ut)}})}})),C=b(()=>n.segmentFields),_=b(()=>n.editSegmentData),A=b(()=>n.uiFlags.isUpdatingSegment),D=b(()=>n.showDeleteSegmentModal),T=b(()=>{var R;return c.rules[u.value].searchConditionValue?(R=c.rules[u.value].segmentConditions)==null?void 0:R.filter(ee=>{var se;return ee.name.toLowerCase().includes((se=c.rules[u.value].searchConditionValue)==null?void 0:se.toLowerCase())}):c.rules[u.value].segmentConditions}),B=b(()=>{const R=C.value.filter(ee=>ee.field_type!=="tag");return c.rules[u.value].searchFieldValue?R.filter(ee=>{var se;return ee.name.toLowerCase().includes((se=c.rules[u.value].searchFieldValue)==null?void 0:se.toLowerCase())}):R}),S=b(()=>{const R=C.value.filter(ee=>ee.field_type==="tag");return c.rules[u.value].searchTagValue?R.filter(ee=>{var se;return ee.name.toLowerCase().includes((se=c.rules[u.value].searchTagValue)==null?void 0:se.toLowerCase())}):R}),E=b(()=>{const R=fo;return c.rules[u.value].searchTagValue?R.filter(ee=>{var se;return ee.name.toLowerCase().includes((se=c.rules[u.value].searchTagValue)==null?void 0:se.toLowerCase())}):R}),x=b(()=>{const R=["Online","Offline"];return c.rules[u.value].searchTagValue?R.filter(ee=>{var se;return ee.toLowerCase().includes((se=c.rules[u.value].searchTagValue)==null?void 0:se.toLowerCase())}):R}),P=b(()=>{const R=wl;return c.rules[u.value].searchTagValue?R.filter(ee=>{var se;return ee.toLowerCase().includes((se=c.rules[u.value].searchTagValue)==null?void 0:se.toLowerCase())}):R}),j=b(()=>{var R;return c.rules[u.value].searchTagValue?(R=w.value)==null?void 0:R.filter(ee=>{var se;return ee.name.toLowerCase().includes((se=c.rules[u.value].searchTagValue)==null?void 0:se.toLowerCase())}):w.value}),H=b(()=>{var ee,se;const R=c.rules[u.value];if(R!=null&&R.searchTagValue){const Y=R.searchTagValue.toLowerCase();return(ee=f.value)==null?void 0:ee.filter(oe=>{var le,Ie;const st=(le=oe.attributes)==null?void 0:le.name,Le=(Ie=oe.attributes)==null?void 0:Ie.status;return st&&Le!=="pending"&&Le!=="deactivated"?st.toLowerCase().includes(Y):!1})}return(se=f.value)==null?void 0:se.filter(Y=>{var Fe,oe;return((Fe=Y.attributes)==null?void 0:Fe.status)!=="pending"&&((oe=Y.attributes)==null?void 0:oe.status)!=="deactivated"})}),k=bs(v,c),M=()=>{m("close")},V=()=>{const R=C.value.filter(ee=>ee.field_type!=="tag");c.rules.push({field:"",field_type:"custom_field",conditional_op:"",value:"",logical_op:"and",fieldsArray:R,segmentConditions:Ga}),Ft(()=>{U()})},Z=R=>{c.rules.splice(R,1)},ae=(R,ee)=>{c.rules[R].logical_op=ee},ce=(R,ee,se,Y)=>{J(R,ee),c.rules[R].field_type=ee,c.rules[R].field="",c.rules[R].searchFieldValue="",c.rules[R].fieldValueHolder="";const Fe=y.value[R]&&ee==="conversation"||y.value[R]&&ee==="tag"?y.value[R].tag:y.value[R]&&ee!=="tag"?y.value[R].custom:null;if(se&&(c.rules[R].field=Fe?Fe.field:"",c.rules[R].fieldValueHolder=Fe?Fe.field:"",c.rules[R].conditional_op=Fe&&ee!=="tag"||Fe&&ee==="tag"&&Fe.conditional_op.includes("equal")?Fe.conditional_op:"",c.rules[R].conditionValueHolder=Fe&&ee!=="tag"||Fe&&ee==="tag"&&Fe.conditional_op.includes("equal")?us(Fe.conditional_op,"_"," "):"",c.rules[R].searchConditionValue="",c.rules[R].tagValueHolder=Fe&&Fe.field&&ee!=="tag"&&Fe.field.toLowerCase()!=="country"?Fe.value:Fe&&Fe.field&&Fe.field.toLowerCase()==="country"?me(Fe.value):"",c.rules[R].searchTagValue="",c.rules[R].value=Fe&&ee!=="tag"?Fe.value:""),Y){c.rules[R].field=Y;const oe=us(Y,"_"," ");k.value.rules.$model[R].fieldValueHolder=`${oe==null?void 0:oe.charAt(0).toUpperCase()}${oe==null?void 0:oe.slice(1)}`}if(ee==="custom_field"||ee==="chat_contact"&&Y!=="country"&&Y!=="online_status"&&Y!=="language"&&Y!=="timezone"?(c.rules[R].fieldsArray=C.value.filter(oe=>oe.field_type!=="tag"),c.rules[R].segmentConditions=Ga):(c.rules[R].fieldsArray=C.value.filter(oe=>oe.field_type==="tag"),c.rules[R].segmentConditions=[{id:"equals",name:"Equals"},{id:"does_not_equal",name:"Does not equal"}]),ee==="tag"){c.rules[R].field="tag",c.rules[R].fieldValueHolder="tag";const oe=C.value.filter(st=>st.field_type==="tag");if(Fe){const st=oe.find(Le=>Le.name===Fe.value);st?(c.rules[R].value=st.name,c.rules[R].tagValueHolder=st.name):(c.rules[R].value="",c.rules[R].tagValueHolder="")}else c.rules[R].value="",c.rules[R].tagValueHolder=""}ee==="conversation"&&(c.rules[R].fieldsArray=C.value.filter(oe=>oe.field_type==="conversation"),c.rules[R].field="conversation",c.rules[R].fieldValueHolder="conversation",c.rules[R].segmentConditions=[{id:"is_resolved",name:"Is resolved"},{id:"is_unresolved",name:"Is unresolved"},{id:"assigned_to",name:"Assigned to"},{id:"not_assigned_to",name:"Not assigned to"},{id:"unassigned",name:"Unassigned"},{id:"is_starred",name:"Is starred"},{id:"not_starred",name:"Not starred"}]),c.rules[R].showFieldOptions=!1},J=(R,ee)=>{const se={field:c.rules[R].field,field_type:c.rules[R].field_type,conditional_op:c.rules[R].conditional_op,value:c.rules[R].value};y.value[R]?ee==="custom_field"||ee==="chat_contact"||ee==="conversation"?y.value[R].tag=se:y.value[R].custom=se:y.value.push({custom:se,tag:se})},X=(R,ee)=>{k.value.rules.$model[R].conditional_op=ee,c.rules[u.value].searchConditionValue="";const se=ee==="does_not_contain_any_value"?"Does not exist for a contact":us(ee,"_"," ");k.value.rules.$model[R].conditionValueHolder=`${se==null?void 0:se.charAt(0).toUpperCase()}${se==null?void 0:se.slice(1)}`,(ee==="contains_any_value"||ee==="does_not_contain_any_value")&&(c.rules[R].value=""),c.rules[R].showConditionOptions=!1},z=(R,ee)=>{k.value.rules.$model[R].value=ee,c.rules[u.value].searchTagValue="";const se=us(ee,"_"," ");k.value.rules.$model[R].tagValueHolder=`${se==null?void 0:se.charAt(0).toUpperCase()}${se==null?void 0:se.slice(1)}`,c.rules[R].showTagOptions=!1},q=(R,ee)=>{k.value.rules.$model[R].value=ee.code,c.rules[u.value].searchTagValue="",c.rules[u.value].tagValueHolder=ee.name,c.rules[R].showTagOptions=!1},ue=(R,ee)=>{k.value.rules.$model[R].value=[ee.id],c.rules[u.value].searchTagValue="",c.rules[u.value].tagValueHolder=ee.attributes.name,c.rules[R].showTagOptions=!1},pe=()=>{k.value.$touch();const R=[];c.rules.forEach((ee,se)=>{R.push(k.value.rules.$dirty&&!k.value.rules.$model[se].value&&c.rules[se].conditional_op!=="contains_any_value"&&c.rules[se].conditional_op!=="does_not_contain_any_value"&&c.rules[se].conditional_op!=="is_resolved"&&c.rules[se].conditional_op!=="is_unresolved"&&c.rules[se].conditional_op!=="unassigned"&&c.rules[se].conditional_op!=="is_starred"&&c.rules[se].conditional_op!=="not_starred"&&c.rules[se].conditional_op!=="assigned_to"&&c.rules[se].conditional_op!=="not_assigned_to")}),!(k.value.$invalid||R.includes(!0))&&n.updateSegment(c,_.value.id)},de=R=>{setTimeout(()=>{c.rules[R].showConditionOptions=!1},500)},he=R=>{setTimeout(()=>{c.rules[R].showFieldOptions=!1},500)},ve=(R,ee)=>{setTimeout(()=>{ee==="tag"&&(S.value.find(Y=>{var Fe;return Y.name.toLowerCase()===((Fe=c.rules[R].tagValueHolder)==null?void 0:Fe.toLowerCase())})||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),(ee==="not_assigned_to"||ee==="assigned_to")&&(S.value.find(Y=>{var Fe;return Y.name.toLowerCase()===((Fe=c.rules[R].tagValueHolder)==null?void 0:Fe.toLowerCase())})||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),ee==="country"&&(j.value.find(Y=>{var Fe;return Y.name.toLowerCase()===((Fe=c.rules[R].tagValueHolder)==null?void 0:Fe.toLowerCase())})||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),ee==="online_status"&&(x.value.find(Y=>{var Fe;return Y.toLowerCase()===((Fe=c.rules[R].tagValueHolder)==null?void 0:Fe.toLowerCase())})||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),ee==="language"&&(P.value.find(Y=>{var Fe;return Y.toLowerCase()===((Fe=c.rules[R].tagValueHolder)==null?void 0:Fe.toLowerCase())})||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),ee==="timezone"&&(E.value.find(Y=>Y.id===c.rules[R].value)||(c.rules[R].tagValueHolder="",c.rules[R].value="",c.rules[R].searchTagValue="")),c.rules[R].showTagOptions=!1},500)},be=R=>{u.value=R,c.rules[R].showConditionOptions=!c.rules[R].showConditionOptions},re=R=>{u.value=R,c.rules[R].showTagOptions=!c.rules[R].showTagOptions},ie=R=>{u.value=R,c.rules[R].showFieldOptions=!c.rules[R].showFieldOptions},xe=()=>{c.rules[u.value].searchConditionValue=c.rules[u.value].conditionValueHolder,c.rules[u.value].conditionValueHolder||(c.rules[u.value].conditional_op="")},N=()=>{c.rules[u.value].searchFieldValue=c.rules[u.value].fieldValueHolder,c.rules[u.value].fieldValueHolder||(c.rules[u.value].field="")},L=()=>{c.rules[u.value].searchTagValue=c.rules[u.value].tagValueHolder,c.rules[u.value].tagValueHolder||(c.rules[u.value].value="")},me=R=>{const ee=w.value.find(se=>se.code===R);return ee?ee.name:""},G=R=>{const ee=f.value.find(se=>se.id===R);return ee?ee.attributes.name:""};function U(){const R=g==null?void 0:g.value;R&&R.scrollTo({top:R.scrollHeight,behavior:"smooth"})}return Xe(()=>{if(_.value){y.value=_.value.attributes.rules;const R=_.value.attributes.rules.map(ee=>{var se;return ee.field_type==="custom_field"||ee.field_type==="chat_contact"||ee.field_type==="conversation"?{...ee,conditionValueHolder:ee.conditional_op==="does_not_contain_any_value"?"Does not exist for a contact":us(ee.conditional_op,"_"," "),tagValueHolder:((se=ee.field)==null?void 0:se.toLowerCase())==="country"?me(ee.value):ee.conditional_op==="assigned_to"||ee.conditional_op==="not_assigned_to"?G(ee.value[0]):us(ee.value,"_"," "),fieldValueHolder:typeof ee.field=="string"?us(ee.field,"_"," "):ee.field,fieldsArray:C.value.filter(Y=>Y.field_type!=="tag"),segmentConditions:ee.field!=="country"&&ee.field!=="online_status"&&ee.field!=="language"&&ee.field!=="timezone"&&ee.field_type!=="conversation"?Ga:ee.field_type==="conversation"?[{id:"is_resolved",name:"Is resolved"},{id:"is_unresolved",name:"Is unresolved"},{id:"assigned_to",name:"Assigned to"},{id:"not_assigned_to",name:"Not assigned to"},{id:"unassigned",name:"Unassigned"},{id:"is_starred",name:"Is starred"},{id:"not_starred",name:"Not starred"}]:[{id:"equals",name:"Equals"},{id:"does_not_equal",name:"Does not equal"}],tag:ee,custom:{field:"",value:"",conditional_op:""}}:{...ee,conditionValueHolder:ee.conditional_op==="does_not_contain_any_value"?"Does not exist for a contact":us(ee.conditional_op,"_"," "),tagValueHolder:ee.field.toLowerCase()==="country"?me(ee.value):us(ee.value,"_"," "),fieldValueHolder:us(ee.field,"_"," "),fieldsArray:C.value.filter(Y=>Y.field_type==="tag"),segmentConditions:[{id:"equals",name:"Equals"},{id:"does_not_equal",name:"Does not equal"}],custom:ee,tag:{field:"",value:"",conditional_op:""}}});c.name=_.value.attributes.name,c.rules=R}}),(R,ee)=>{const se=Pe("InputField"),Y=He("svg-inline");return a(),d(Se,null,[W(bl,{closeModal:R.showModal,showFooter:!0,isLoading:A.value,headerTitle:"Edit Segment",alertButtonText:"Delete",onCloseModal:M,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save Changes",onActionButtonTypeOne:M,onActionButtonTypeTwo:pe,onActionAlertButton:ee[10]||(ee[10]=Fe=>p(n).showDeleteSegmentModal=!0)},{default:K(()=>[e("div",eg,[W(se,{class:"mb-3",value:c.name,type:"text",forValue:"name",placeholder:"Enter the segment name",hasError:p(k).name.$error&&p(k).name.$dirty,validationMessage:p(k).name.$errors,onBlur:ee[0]||(ee[0]=Fe=>p(k).name.$touch()),onInput:ee[1]||(ee[1]=Fe=>c.name=Fe)},null,8,["value","hasError","validationMessage"]),e("div",{ref_key:"segmentView",ref:g,class:"segment-max-height overflow-y-auto"},[(a(!0),d(Se,null,Ne(c.rules,(Fe,oe)=>{var st,Le,le,Ie,rt,Et,ye,_t;return a(),d("div",{key:oe},[oe!==0?(a(),d("div",tg,[ee[11]||(ee[11]=e("div",{class:"col-span-5 bg-grey200 border h-px"},null,-1)),e("div",sg,[e("span",{onClick:Ce=>ae(oe,"and"),class:O(["px-2 py-0.5 text-sm cursor-pointer",{"text-primary bg-white":Fe.logical_op==="and","text-grey":Fe.logical_op!=="and"}])}," and ",10,ag),e("span",{onClick:Ce=>ae(oe,"or"),class:O(["px-2 py-0.5 text-sm cursor-pointer",{"text-primary bg-white":Fe.logical_op==="or","text-grey":Fe.logical_op!=="or"}])}," or ",10,og)]),ee[12]||(ee[12]=e("div",{class:"col-span-4 bg-grey200 border h-px"},null,-1))])):h("",!0),e("div",ng,[c.rules.length>1?(a(),d("button",{key:0,onClick:Ce=>Z(oe),class:"z-[1] w-4 h-4 bg-grey200 flex items-center justify-center rounded-full p-[2px] cursor-pointer float-right"},[F(e("img",lg,null,512),[[Y]])],8,ig)):h("",!0),e("div",rg,[e("div",{onClick:Ce=>ce(oe,"custom_field",!0),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[oe].field_type==="custom_field"||p(k).rules.$model[oe].field_type==="chat_contact"}])}," Custom data ",10,dg),e("div",{onClick:Ce=>ce(oe,"tag",!0),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[oe].field_type==="tag"}])}," Tags ",10,ug),e("div",{onClick:Ce=>ce(oe,"conversation",!0),class:O(["text-sm font-normal leading-leading400 text-grey600 cursor-pointer px-4 py-1",{"bg-white text-primary rounded-md":p(k).rules.$model[oe].field_type==="conversation"}])}," Conversation data ",10,cg)]),p(k).rules.$model[oe].field_type!=="tag"&&p(k).rules.$model[oe].field_type!=="conversation"?(a(),d("div",mg,[e("label",gg,I(p(k).rules.$model[oe].field_type==="custom_data"?"Custom Data":"Field"),1),e("div",pg,[e("div",vg,[e("div",fg,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showFieldOptions,error:p(k).rules.$each.$response.$data[oe].field.$error&&p(k).rules.$dirty}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].fieldValueHolder=Ce,onInput:N,onFocusin:Ce=>ie(oe),onBlur:Ce=>he(oe)},null,42,hg),[[bt,p(k).rules.$model[oe].fieldValueHolder]]),c.rules[oe].showFieldOptions?(a(),d("img",{key:0,onClick:Ce=>ie(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,_g)):(a(),d("img",{key:1,onClick:Qe(Ce=>ie(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,yg))])]),c.rules[oe].showFieldOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",T.value&&T.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(B.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.name||p(k).rules.$model[oe].field===Ce.name?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4 first-letter:uppercase"],"o-date-list__item"]),key:Ce.name,onClick:vt=>ce(oe,Ce.field_type,!1,Ce.name),onMouseover:vt=>r.value=Ce.name,onMouseleave:ee[2]||(ee[2]=vt=>r.value="")},[_e(I(p(us)(Ce.name,"_"," "))+" ",1),p(k).rules.$model[oe].field===Ce.name?(a(),d("span",wg,[F(e("img",xg,null,512),[[Y]])])):h("",!0)],42,bg))),128)),(st=B.value)!=null&&st.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>ie(oe),class:"text-gray-900 px-4"},"Field not found",8,Cg))],2)):h("",!0)])])):h("",!0),e("div",kg,[ee[13]||(ee[13]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Condition",-1)),e("div",$g,[e("div",Sg,[e("div",Tg,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showConditionOptions,error:p(k).rules.$each.$response.$data[oe].conditional_op.$error&&p(k).rules.$dirty}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].conditionValueHolder=Ce,onInput:xe,onFocusin:Ce=>be(oe),onBlur:Ce=>de(oe)},null,42,Mg),[[bt,p(k).rules.$model[oe].conditionValueHolder]]),c.rules[oe].showConditionOptions?(a(),d("img",{key:0,onClick:Ce=>be(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Ag)):(a(),d("img",{key:1,onClick:Qe(Ce=>be(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Eg))])]),c.rules[oe].showConditionOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",T.value&&T.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(T.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.name||p(k).rules.$model[oe].conditional_op===Ce.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:Ce.id,onClick:vt=>X(oe,Ce.id),onMouseover:vt=>r.value=Ce.name,onMouseleave:ee[3]||(ee[3]=vt=>r.value="")},[_e(I(Ce.name)+" ",1),p(k).rules.$model[oe].conditional_op===Ce.id?(a(),d("span",Ig,[F(e("img",Fg,null,512),[[Y]])])):h("",!0)],42,Dg))),128)),(Le=T.value)!=null&&Le.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>be(oe),class:"text-gray-900 px-4"},"Condition not found",8,Pg))],2)):h("",!0)])]),p(k).rules.$model[oe].field_type==="tag"?(a(),d("div",jg,[ee[14]||(ee[14]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",Lg,[e("div",Rg,[e("div",Bg,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"tag")},null,42,Ng),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Og)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Vg))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(S.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.name||p(k).rules.$model[oe].value===Ce.name?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:Ce.name,onClick:vt=>z(oe,Ce.name),onMouseover:vt=>r.value=Ce.name,onMouseleave:ee[4]||(ee[4]=vt=>r.value="")},[_e(I(Ce.name)+" ",1),p(k).rules.$model[oe].value===Ce.name?(a(),d("span",Gg,[F(e("img",Wg,null,512),[[Y]])])):h("",!0)],42,Ug))),128)),(le=S.value)!=null&&le.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Tag not found",8,qg))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].field==="timezone"?(a(),d("div",Hg,[ee[15]||(ee[15]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",zg,[e("div",Kg,[e("div",Yg,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"timezone")},null,42,Zg),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Jg)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Qg))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(E.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.name||p(k).rules.$model[oe].value===Ce.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:Ce.id,onClick:vt=>z(oe,Ce.id),onMouseover:vt=>r.value=Ce.id,onMouseleave:ee[5]||(ee[5]=vt=>r.value="")},[_e(I(Ce.id)+" ",1),p(k).rules.$model[oe].value===Ce.id?(a(),d("span",ep,[F(e("img",tp,null,512),[[Y]])])):h("",!0)],42,Xg))),128)),(Ie=E.value)!=null&&Ie.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Timezone not found",8,sp))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].field.toLowerCase()==="online_status"?(a(),d("div",ap,[ee[16]||(ee[16]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",op,[e("div",np,[e("div",ip,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"online_status")},null,42,lp),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,rp)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,dp))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(x.value,(Ce,vt)=>(a(),d("li",{class:O([[r.value===Ce||p(k).rules.$model[oe].value===Ce?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:vt,onClick:qe=>z(oe,Ce),onMouseover:qe=>r.value=Ce,onMouseleave:ee[6]||(ee[6]=qe=>r.value="")},[_e(I(Ce)+" ",1),p(k).rules.$model[oe].value===Ce?(a(),d("span",cp,[F(e("img",mp,null,512),[[Y]])])):h("",!0)],42,up))),128)),(rt=x.value)!=null&&rt.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Value not found",8,gp))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].field.toLowerCase()==="language"?(a(),d("div",pp,[ee[17]||(ee[17]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",vp,[e("div",fp,[e("div",hp,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"language")},null,42,_p),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,yp)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,bp))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",S.value&&S.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(P.value,(Ce,vt)=>(a(),d("li",{class:O([[r.value===Ce||p(k).rules.$model[oe].value===Ce?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:vt,onClick:qe=>z(oe,Ce),onMouseover:qe=>r.value=Ce,onMouseleave:ee[7]||(ee[7]=qe=>r.value="")},[_e(I(Ce)+" ",1),p(k).rules.$model[oe].value===Ce?(a(),d("span",xp,[F(e("img",Cp,null,512),[[Y]])])):h("",!0)],42,wp))),128)),(Et=P.value)!=null&&Et.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Value not found",8,kp))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].field.toLowerCase()==="country"?(a(),d("div",$p,[ee[18]||(ee[18]=e("label",{class:"text-grey600 text-sm leading-leading400 mb-1"},"Value",-1)),e("div",Sp,[e("div",Tp,[e("div",Mp,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"country")},null,42,Ap),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Ep)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Dp))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",j.value&&j.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(j.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.name||p(k).rules.$model[oe].value===Ce.code?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:Ce.name,onClick:vt=>q(oe,Ce),onMouseover:vt=>r.value=Ce.name,onMouseleave:ee[8]||(ee[8]=vt=>r.value="")},[_e(I(Ce.name)+" ",1),p(k).rules.$model[oe].value===Ce.code?(a(),d("span",Fp,[F(e("img",Pp,null,512),[[Y]])])):h("",!0)],42,Ip))),128)),(ye=j.value)!=null&&ye.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Country not found",8,jp))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].conditional_op==="not_assigned_to"||p(k).rules.$model[oe].conditional_op==="assigned_to"?(a(),d("div",Lp,[ee[19]||(ee[19]=e("label",{class:"text-grey600 text-sm leading-leading400"},"Agents",-1)),e("div",Rp,[e("div",Bp,[e("div",Np,[F(e("input",{class:O(["o-combobox__input block",{"o-combobox__container__active":c.rules[oe].showTagOptions,error:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"}]),type:"text",placeholder:"Select","onUpdate:modelValue":Ce=>p(k).rules.$model[oe].tagValueHolder=Ce,onInput:L,onFocusin:Ce=>re(oe),onBlur:Ce=>ve(oe,"conversation")},null,42,Op),[[bt,p(k).rules.$model[oe].tagValueHolder]]),c.rules[oe].showTagOptions?(a(),d("img",{key:0,onClick:Ce=>re(oe),src:Qt,alt:"chevron-up",class:"absolute cursor top-[15px] right-2"},null,8,Vp)):(a(),d("img",{key:1,onClick:Qe(Ce=>re(oe),["prevent"]),src:Tt,alt:"chevron-down",class:"absolute cursor top-[15px] right-2"},null,8,Up))])]),c.rules[oe].showTagOptions?(a(),d("ul",{key:0,class:O([[c.rules.length===1||c.rules.length<3&&p(t)>1e3?"fixed !w-[376px]":"absolute",H.value&&H.value.length>4?"overflow-y-scroll":"overflow-auto"],"mt-1 z-20 max-h-[12rem] w-full rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"])},[(a(!0),d(Se,null,Ne(H.value,Ce=>(a(),d("li",{class:O([[r.value===Ce.id||p(k).rules.$model[oe].value===Ce.id?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-4"],"o-date-list__item"]),key:Ce.id,onClick:vt=>ue(oe,Ce),onMouseover:vt=>r.value=Ce.id,onMouseleave:ee[9]||(ee[9]=vt=>r.value="")},[_e(I(Ce.attributes.name)+" ",1),p(k).rules.$model[oe].value===Ce.id?(a(),d("span",Wp,[F(e("img",qp,null,512),[[Y]])])):h("",!0)],42,Gp))),128)),(_t=H.value)!=null&&_t.length?h("",!0):(a(),d("li",{key:0,onClick:Ce=>re(oe),class:"text-gray-900 px-4"},"Agent not found",8,Hp))],2)):h("",!0)])])):h("",!0),p(k).rules.$model[oe].conditional_op!=="contains_any_value"&&p(k).rules.$model[oe].conditional_op!=="does_not_contain_any_value"&&p(k).rules.$model[oe].field.toLowerCase()!=="country"&&p(k).rules.$model[oe].field.toLowerCase()!=="online_status"&&p(k).rules.$model[oe].field.toLowerCase()!=="language"&&p(k).rules.$model[oe].field.toLowerCase()!=="timezone"&&p(k).rules.$model[oe].field_type!=="tag"&&p(k).rules.$model[oe].field_type!=="conversation"?(a(),ne(se,{key:8,class:"input-field text-base text-grey900",label:"Value",value:p(k).rules.$model[oe].value,type:"text",forValue:"value",placeholder:"Value",onInput:Ce=>p(k).rules.$model[oe].value=Ce,classes:p(k).rules.$dirty&&!p(k).rules.$model[oe].value&&c.rules[oe].conditional_op!=="contains_any_value"&&c.rules[oe].conditional_op!=="does_not_contain_any_value"?"error":""},null,8,["value","onInput","classes"])):h("",!0)])])}),128))],512),e("div",{class:"sticky z-10 inline-flex gap-1 cursor-pointer",onClick:V},[F(e("img",zp,null,512),[[Y]]),ee[20]||(ee[20]=e("span",{class:"text-sm text-grey900"},"Add condition",-1))])])]),_:1},8,["closeModal","isLoading"]),D.value?(a(),ne(Xm,{key:0,segment:_.value,showModal:D.value},null,8,["segment","showModal"])):h("",!0)],64)}}});const Yp=Oe(Kp,[["__scopeId","data-v-f0a9674d"]]),ca="/assets/dismiss-grey-f90b1389.svg",Zp=["src"],Jp={src:ca},Qp=fe({__name:"ImageViewer",setup(o){const s=$(""),t=ct(),n=()=>{s.value="",t.chatInputFocus=!0,Ft(()=>t.chatInputFocus=!1)},l=i=>{i.key==="Escape"&&n()};return Nn(()=>{document.addEventListener("keydown",l),nt.on("openModal",i=>{s.value=i})}),Ms(()=>{document.removeEventListener("keydown",l),nt.off("openModal")}),(i,m)=>{const r=He("svg-inline");return a(),ne(ms,{name:"modal-fade"},{default:K(()=>[s.value?(a(),d("div",{key:0,class:"modal-container",onClick:n,transition:"modal"},[e("img",{src:s.value,class:"modal-image"},null,8,Zp),e("a",{href:"#",class:"button--text dismiss--button",onClick:Qe(n,["prevent"])},[F(e("img",Jp,null,512),[[r]]),m[0]||(m[0]=e("span",null,"Close",-1))])])):h("",!0)]),_:1})}}});const Xp=Oe(Qp,[["__scopeId","data-v-1690c2e6"]]),ev="/assets/ios-badge-e408a50f.svg",tv="/assets/android-badge-8af431b3.svg",sv="/assets/scan-the-qr-037fa969.svg",av="/assets/toast-arrow-qr-1dcc0667.svg",ov="/assets/dismiss-c7f38e04.svg";class nv{connectFacebook(){return ke.get("facebook/oauth")}facebookCallback(s){return ke.get("facebook/callback",s)}connectFacebookPages(s){return ke.post("social-accounts/messenger",s)}facebookPages(s){return ke.get("facebook/pages",s)}socialAccounts(){return ke.get("social-accounts")}facebookAccounts(){return ke.get("social-accounts?channel=messenger")}deleteSocialAccount(s){return ke.delete(`social-accounts/${s}`)}hideAppDownloadModal(){return ke.patch("update/mobile-app-modal")}addEmailSocialAccount(s){return ke.post("social-accounts/email",{name:s,channel:"chatwayEmail"})}updateEmailSocialAccount({name:s,id:t}){return ke.put("social-accounts/email/"+t,{name:s,channel:"chatwayEmail"})}}const iv={key:0,class:"app--download-container"},lv={class:"inner"},rv={class:"app--download-badge p-4"},dv={class:"badges mt-5"},uv={href:"https://apps.apple.com/ng/app/chatway-website-live-chat/id6449775006",target:"_blank",rel:"noopener noreferrer"},cv={src:ev},mv={href:"https://play.google.com/store/apps/details?id=com.chatway.mobile&pcampaignid=web_share",target:"_blank",rel:"noopener noreferrer"},gv={src:tv},pv={class:"checkbox--container"},vv={class:"app--download-qr bg-gray-100 w-48 rounded-r-lg"},fv={class:"qr-img"},hv=["src"],_v={class:"app--download-close"},yv={src:ov},bv=fe({__name:"MobileAppDownload",setup(o){const s=Ae(),t=ls(),n=$(!0),l=$(!1),i=b(()=>{var u,g;return!sessionStorage.getItem("dismiss-app-download")&&((u=s.user)==null?void 0:u.attributes.show_mobileapp_store_modal)&&((g=s.user)==null?void 0:g.attributes.registration_step)=="ONBOARDED"&&!t.path.includes("onboarding")&&s.isProductTourAndEmailModalNotVisible&&!s.showSkipTourModal}),m=()=>{sessionStorage.setItem("dismiss-app-download","true"),n.value=!1,l.value&&(s.user.attributes.show_mobileapp_store_modal=!1,new nv().hideAppDownloadModal())};return(r,u)=>{const g=He("svg-inline");return a(),ne(ms,{name:"fade"},{default:K(()=>[n.value&&i.value?(a(),d("div",iv,[e("div",lv,[e("div",rv,[u[3]||(u[3]=e("h1",{class:"text-grey900 text-2xl leading-[1.76rem] m-0"},"Download the app",-1)),u[4]||(u[4]=e("p",{class:"text-sm leading-[1.24rem] mt-1"},"and answer anytime, anywhere!",-1)),e("div",dv,[e("a",uv,[F(e("img",cv,null,512),[[g]])]),e("a",mv,[F(e("img",gv,null,512),[[g]])])]),e("div",pv,[F(e("input",{type:"checkbox","onUpdate:modelValue":u[0]||(u[0]=y=>l.value=y),id:"checkbox",class:"checkbox"},null,512),[[Ia,l.value]]),u[2]||(u[2]=e("label",{for:"checkbox",class:"checkbox"},"Don’t show again",-1))])]),e("div",vv,[u[5]||(u[5]=e("div",{class:"toast-text absolute top-[30px] right-[172px]"},[e("img",{width:"74",src:sv,alt:""})],-1)),u[6]||(u[6]=e("div",{class:"toast-arrow absolute top-[58px] right-[168px]"},[e("img",{width:"40",src:av,alt:""})],-1)),e("div",fv,[e("img",{src:`${p(De)}images/qr.svg`,width:"127",height:"127",loading:"lazy",alt:""},null,8,hv)]),e("div",_v,[e("a",{class:"dismiss--button",href:"",onClick:u[1]||(u[1]=Qe(y=>m(),["prevent"]))},[F(e("img",yv,null,512),[[g]])])])])])])):h("",!0)]),_:1})}}});const wv=Oe(bv,[["__scopeId","data-v-c9168035"]]),xv="/assets/lock-bbd19f03.svg",Cv="/assets/mail-white-b61fdda5.svg",kv=fe({__name:"Loader",props:{size:{default:"30px"}},setup(o){return(s,t)=>(a(),d("div",{class:"loader",style:lt({width:s.size,height:s.size})},null,4))}});const fs=Oe(kv,[["__scopeId","data-v-2d06b4b9"]]),$v={class:"flex flex-col items-center gap-1 p-6"},Sv={src:xv,alt:""},Tv={class:"text-grey900 text-lg font-semibold leading-[1.8rem] mb-2 text-center"},Mv={class:"text-base m-0 text-center text-grey900 pb-[2.5rem] leading-[140%]"},Av={class:"flex items-center justify-center gap-1"},Ev={key:0,class:"m-0 text-grey600 text-sm leading-leading400"},Dv={key:1,width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Iv={key:2,class:"m-0 text-[#27B836] text-xs leading-leading400"},Fv=fe({__name:"RequestAccessFromOwnerModal",props:{showModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const t=s,n=Ae(),l=$(!1),i=$(!1),m=b(()=>n.deactivationReason),r=()=>{t("closeModal")},u=async()=>{l.value=!0;try{await new Aa().requestAccessFromOwner(),l.value=!1,i.value=!0,setTimeout(()=>{t("closeModal")},1500)}catch(y){l.value=!1,Ze(y)}},g=b(()=>m.value!=="deactivated_by_owner"?{title:"Access has been deactivated as the free trial period has ended.",description:"Contact admin to upgrade to the Pro plan today and continue to experience the full suite of Pro features!"}:{title:"Access to the Chatway dashboard has been revoked.",description:"Please contact the account owner and ask for access to this account"});return(y,c)=>{const w=Pe("Modal"),f=He("svg-inline");return y.showModal?(a(),ne(w,{key:0,classes:"!w-[31.5rem]",showFooter:!1,closeModal:!1,onCloseModal:r},{default:K(()=>[e("div",$v,[F(e("img",Sv,null,512),[[f]]),e("div",{class:O([m.value!=="deactivated_by_owner"?"w-[28.5rem]":"w-[19.13rem]"])},[e("h3",Tv,I(g.value.title),1),e("p",Mv,I(g.value.description),1)],2),e("button",{onClick:u,class:"py-[0.5625rem] px-4 flex gap-1 items-center justify-center bg-grey900 text-white mb-2"},[c[0]||(c[0]=e("img",{src:Cv,alt:""},null,-1)),c[1]||(c[1]=_e(" Request Access From Owner ")),l.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"17px"})):h("",!0)]),e("div",Av,[i.value?h("",!0):(a(),d("p",Ev,"We will send them an email about your request")),i.value?(a(),d("svg",Dv,c[2]||(c[2]=[e("path",{d:"M13.8332 4.5L6.49984 11.8333L3.1665 8.5",stroke:"#27B836","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))):h("",!0),i.value?(a(),d("p",Iv,"Request has been sent")):h("",!0)])])]),_:1})):h("",!0)}}});class _s{addCard(s){return ke.post("cards",s)}editPayment(s){return ke.post("cards?include[]=card",s)}getPlans(){return ke.get("plans")}updateSubscription(s){return ke.post("subscriptions",s,{params:{"include[]":"subscription"}})}removeCard(){return ke.delete("cards")}dudaUpgrade(s){return ke.post("duda/upgradeUrl",s)}getInvoice(s){return ke.get("payments",s)}toggleReminder(s){return ke.post("user/reminder",s)}subscriptionCancellation(){return ke.post("subscriptions/stop-cancel","")}}const Pv={class:"flex flex-col items-center gap-1 p-4 pb-"},jv=["href"],Lv=fe({__name:"DudaUpgradeNoticeModal",setup(o){const s=ts(),t=$(""),n=b(()=>s.showDudaUpgradeNoticeModal),l=()=>{s.showDudaUpgradeNoticeModal=!1},i=async()=>{try{const{data:m}=await new _s().dudaUpgrade();t.value=m}catch(m){Ze(m)}};return Xe(async()=>{await i()}),(m,r)=>{const u=Pe("Modal");return n.value?(a(),ne(u,{key:0,headerTitle:"Please use the Chatway app to upgrade",showFooter:!1,closeModal:n.value,onCloseModal:l},{default:K(()=>[e("div",Pv,[r[0]||(r[0]=e("p",{class:"text-base m-0 !text-center text-grey900 pb-[1.87rem]"},"If you want to upgrade to any of the paid plans, please go to your website builder platform and launch the Chatway app",-1)),e("a",{href:t.value,target:"_blank",class:"w-[13.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey900 text-white",onClick:l},"Launch Chatway",8,jv)])]),_:1},8,["closeModal"])):h("",!0)}}}),Rv=fe({__name:"DudaUpgradeModal",setup(o){const s=ts(),t=b(()=>s.showDudaUpgradeModal),n=()=>{s.showDudaUpgradeModal=!1};return(l,i)=>{const m=Pe("Modal");return t.value?(a(),ne(m,{key:0,headerTitle:"Please contact your managing agency",showFooter:!1,showHeaderClose:!1,closeModal:t.value,onCloseModal:n},{default:K(()=>[e("div",{class:"flex flex-col items-center gap-1 p-4 pb-"},[i[0]||(i[0]=e("p",{class:"text-base m-0 !text-center text-grey900 pb-[1.87rem]"}," It seems like you don't have access to upgrade to a paid plan. Please contact the agency that manages your website and ask them to upgrade your Chatway plan ",-1)),e("button",{class:"w-[5.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey900 text-white",onClick:n},"Close")])]),_:1},8,["closeModal"])):h("",!0)}}}),as="/assets/info-97945247.svg",xl="/assets/minus-with-bg-9abc3e36.svg",Cl="/assets/add-with-bg-555790a9.svg",ws="/assets/chevron-left-9be59948.svg",Fn="/assets/shield-white-24ca6f4a.svg";function ma(){const{plans:o,invoices:s,isChangePlan:t,isDowngrading:n,isUpgradingDudaUser:l}=Ts(ts()),{getCurrentUser:i}=Zt(),m=async()=>{try{const{data:f}=await new _s().getPlans();o.value=f}catch(f){Ze(f)}},r=async(f,v)=>{try{const C={params:{start_date:f,end_date:v}},{data:_}=await new _s().getInvoice(C);s.value=_}catch(C){Ze(C)}},u=async()=>{var _;const f=Ae(),v=ts(),C=window.location!==window.parent.location;((_=f.dudaData)==null?void 0:_.is_white_label)==="true"?v.showDudaUpgradeModal=!0:C?v.showUpdateAgentModal=!0:v.showDudaUpgradeNoticeModal=!0},g=async()=>{var _;const f=Ae(),v=ts(),C=window.location!==window.parent.location;if(((_=f.dudaData)==null?void 0:_.is_white_label)==="true")v.showDudaUpgradeModal=!0;else if(!C)v.showDudaUpgradeNoticeModal=!0;else{const A={type:"upgradeApp",appId:"5e055a6a-7f43-4fdd-8ce2-821f30728049",plansList:[ts().dudaPlanList[0]]};window._dAPI.upgrade(A)}};return{getPlans:m,upgradeDudaPlan:u,getInvoices:r,downgradeDudaPlan:g,removeCardDowngrade:async()=>{if(Ae().marketPlaceName==="duda"){await g();return}try{return n.value=!0,await new _s().removeCard(),n.value=!1,t.value=!1,"success"}catch(f){return n.value=!1,Ze(f),"error"}},upgradeDudaUser:async f=>{l.value=!0;try{const{data:v}=await new _s().dudaUpgrade(f);return l.value=!1,v}catch(v){return l.value=!1,Ze(v),"error"}},closeAppUpgradeReminder:async f=>{try{await new _s().toggleReminder(f),await i({isSecondCall:!0})}catch(v){Ae().showTrialCountdown=!0,Ze(v)}}}}const Zo=fe({__name:"UpgradeNowButton",setup(o){const s=At(),t=()=>{s.push("/plans")};return(n,l)=>(a(),d("button",{onClick:t,class:"flex justify-center items-center text-grey900 upgrade-now-btn-bg text-sm w-[139px] h-8 px-1 py-2 gap-1"},l[0]||(l[0]=[e("img",{src:xo,alt:"crown icon"},null,-1),_e(" Upgrade now ")])))}}),Bv={key:0,class:"modal-header"},Nv={class:"title"},Ov={key:0,class:"label-status"},Vv={key:2,class:"text-right w-100 text-gray-400 text-xs"},Uv={src:ca},Gv={key:0,class:"w-full"},Wv={key:1,class:"relative alert-buttons--wrap"},qv={class:"action-buttons--wrap"},Hv=["disabled"],zv=fe({__name:"Modal",props:{closeModal:{type:Boolean},headerTitle:{default:""},headerTextRight:{default:""},label:{default:""},showFooter:{type:Boolean,default:!0},alertModal:{type:Boolean,default:!1},enableDelete:{type:Boolean,default:!0},isLoading:{type:Boolean},disableLoader:{type:Boolean,default:!1},alertButtonText:{default:""},actionButtonTypeOneText:{default:""},actionButtonTypeTwoText:{default:""},showHeaderClose:{type:Boolean,default:!0},classes:{},footerTopBorder:{type:Boolean,default:!1},isProFeature:{type:Boolean},topUpgradeButton:{type:Boolean},backdropClickClose:{type:Boolean,default:!0},topUpgradeButtonText:{default:"Upgrade Now"},disableButtonTwo:{type:Boolean,default:!1}},emits:["closeModal","actionAlertButton","actionButtonTypeOne","actionButtonTypeTwo"],setup(o,{emit:s}){const t=o,n=Ae(),l=At(),i=s,m=$(!1),r=b(()=>n.isProUserOrTrial),u=()=>{i("actionAlertButton")},g=()=>{i("actionButtonTypeOne")},y=()=>{i("actionButtonTypeTwo")},c=()=>{i("closeModal")},w=()=>{t.closeModal&&t.backdropClickClose&&c()},f=()=>{l.push("/plans")};return Xe(()=>{m.value=!0}),ps(()=>{m.value=!1}),(v,C)=>{const _=Pe("Loader"),A=He("svg-inline");return a(),ne(ms,{name:"modal-fade"},{default:K(()=>[m.value?(a(),d("div",{key:0,class:"modal-wrap",transition:"modal",onClick:w},[e("div",{class:O(["modal-container",v.classes]),onClick:C[0]||(C[0]=Qe(()=>{},["stop"]))},[v.headerTitle?(a(),d("div",Bv,[e("span",Nv,I(v.headerTitle),1),v.label?(a(),d("span",Ov,I(v.label),1)):h("",!0),v.topUpgradeButton?(a(),d("button",{key:1,onClick:f,class:"flex justify-center items-center ml-3 text-grey900 upgrade-now-btn-bg text-sm h-8 p-2 gap-1"},[C[1]||(C[1]=e("img",{src:xo,alt:"crown icon"},null,-1)),_e(" "+I(v.topUpgradeButtonText),1)])):h("",!0),v.headerTextRight?(a(),d("div",Vv,I(v.headerTextRight),1)):h("",!0)])):h("",!0),v.showHeaderClose?(a(),d("button",{key:1,class:"button--text close--button",onClick:c},[F(e("img",Uv,null,512),[[A]])])):h("",!0),Ss(v.$slots,"default",{},void 0,!0),v.showFooter?(a(),d("div",{key:2,class:O(["modal-footer",{"modal-footer-with--alert":v.alertButtonText,"border-t border-grey200":v.footerTopBorder,"flex items-center justify-between":v.$slots.FooterLeftContent}])},[v.$slots.FooterLeftContent?(a(),d("div",Gv,[Ss(v.$slots,"FooterLeftContent",{},void 0,!0)])):h("",!0),v.alertButtonText?(a(),d("div",Wv,[v.enableDelete?(a(),d("button",{key:0,class:"action-button-type--one action-button",onClick:u},I(v.alertButtonText),1)):h("",!0),W(ms,{name:"modal-fade"},{default:K(()=>[Ss(v.$slots,"delete-popover",{},void 0,!0)]),_:3})])):h("",!0),e("div",qv,[v.actionButtonTypeOneText?(a(),d("button",{key:0,class:"action-button-type--one action-button",onClick:g},I(v.actionButtonTypeOneText),1)):h("",!0),v.actionButtonTypeTwoText&&!r.value&&!v.isProFeature||v.actionButtonTypeTwoText&&r.value&&v.isProFeature||v.actionButtonTypeTwoText&&r.value&&!v.isProFeature?(a(),d("button",{key:1,class:O(["action-button-type--two action-button truncate",{alert:v.alertModal}]),disabled:v.isLoading||v.disableButtonTwo,onClick:y},[_e(I(v.actionButtonTypeTwoText)+" ",1),v.isLoading&&!v.disableLoader?(a(),ne(_,{key:0,size:"12px"})):h("",!0)],10,Hv)):h("",!0),!r.value&&v.isProFeature?(a(),ne(Zo,{key:2})):h("",!0)])],2)):h("",!0)],2)])):h("",!0)]),_:3})}}});const Co=Oe(zv,[["__scopeId","data-v-64021134"]]),Kv={class:"flex flex-col md:flex-row gap-4"},Yv={class:"w-full relative"},Zv=["id"],Jv={class:"w-full"},Qv=["id"],Xv={class:"w-full"},ef=["id"],Kn=fe({__name:"CardDetails",props:{isEditing:{type:Boolean}},emits:["changeCardNumber","cardError"],setup(o,{emit:s}){let t=Lr("pk_live_51MYxQ4AIdRTsEWAYOK7KQggGrWF6lvhKEPLOXjQssE4wrPQIQifHa4qZ64P22fhBxN4hGdetUqh9cJ258086wyKw00oMyhF6Ae");const n=s;let l=$(),i=$(),m=$(),r=$(),u=$(),g=$();const y=$(Math.floor(Math.random()*200)),c=$(),w=async()=>{const f=await t;if(!f)return;c.value=f.elements();const v={base:{color:"#49687E",fontFamily:'"Poppins", sans-serif',fontSmoothing:"antialiased",fontSize:"14px","::placeholder":{color:"#aab7c4"},backgroundColor:"#fff"},invalid:{color:"#fa755a",iconColor:"#fa755a"}};l.value=c.value.create("cardNumber",{style:v}),m.value=c.value.create("cardExpiry",{style:v}),u.value=c.value.create("cardCvc",{style:v}),m.value.mount(`#cc--card-expiry${y.value}`),l.value.mount(`#cc--card-number${y.value}`),u.value.mount(`#cc--card-cvc${y.value}`),l.value.on("change",C=>{n("changeCardNumber",{value:l.value,stripe:f}),C.complete&&m.value.focus(),C.error?(i.value={...C.error},n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value})):(i.value=null,n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value}))}),m.value.on("change",C=>{C.complete&&u.value.focus(),C.error?(r.value={...C.error},n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value})):(r.value=null,n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value}))}),u.value.on("change",C=>{C.error?(g.value={...C.error},n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value})):(g.value=null,n("cardError",{cardNumberError:i.value,cardExpiryError:r.value,cardCvcError:g.value}))})};return Xe(()=>{w()}),(f,v)=>(a(),d("div",null,[v[3]||(v[3]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mb-2"},"Credit card",-1)),e("div",Kv,[e("div",Yv,[v[0]||(v[0]=da('<label for="cardNumber" class="text-sm text-nowrap leading-leading400">Card Number*</label><svg class="absolute bottom-[0.9rem] left-1" xmlns="http://www.w3.org/2000/svg" width="22" height="16" viewBox="0 0 22 16" fill="none"><rect width="22" height="16" rx="2" fill="#E6E6F0"></rect><rect opacity="0.2" x="2" y="3" width="4" height="3" rx="1" fill="#282D3E"></rect><rect opacity="0.2" y="7" width="22" height="3" fill="#282D3E"></rect></svg>',2)),e("div",{class:"!pl-8 md:w-[200px]",id:"cc--card-number"+y.value},null,8,Zv)]),e("div",Jv,[v[1]||(v[1]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"Expiration*",-1)),e("div",{id:"cc--card-expiry"+y.value},null,8,Qv)]),e("div",Xv,[v[2]||(v[2]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"CVC*",-1)),e("div",{id:"cc--card-cvc"+y.value},null,8,ef)])])]))}}),tf={class:"input-field-text"},sf={class:"o-combobox__container relative"},af=["placeholder","disabled"],of={class:"error-message"},nf=["onClick","onMouseover"],lf={key:0,class:"absolute inset-y-0 right-[14px] flex items-center pl-3 text-amber-600"},rf={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected condition"},df={key:0,class:"text-gray-900 px-4"},uf=fe({__name:"SearchableDropdown",props:{modelValue:{},items:{},bindLabel:{default:"name"},bindValue:{default:"id"},classes:{},placeholder:{default:"Select"},hasError:{type:Boolean},validationMessage:{},showPhoneCustomizedLabel:{type:Boolean},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean},listWidth:{}},emits:["update:modelValue","change:selectedItem"],setup(o,{emit:s}){const t=o,n=s,l=$(""),i=$(""),m=$(""),r=$(!1),u=$(""),g=$(null),y=$(null),c=$(""),w=b(()=>t.items.length>0&&typeof t.items[0]=="string"),f=b(()=>l.value?w.value?t.items.filter(x=>{var P;return x.toLowerCase().includes((P=l.value)==null?void 0:P.toLowerCase())}):t.items.filter(x=>{var P;return S(x).toLowerCase().includes((P=l.value)==null?void 0:P.toLowerCase())}):t.items),v=()=>{t.disabled||(r.value=!r.value)},C=()=>{l.value=i.value,m.value=""},_=()=>{setTimeout(()=>{let x;w.value?x=t.items.find(P=>{var j;return P.toLowerCase()===((j=m.value)==null?void 0:j.toLowerCase())}):x=t.items.find(P=>{var j;return E(P).toLowerCase()===((j=m.value)==null?void 0:j.toLowerCase())}),x||(m.value="",n("update:modelValue",m.value),l.value="",i.value=""),r.value=!1},500)};Os(g,()=>{r.value=!1});const A=x=>{n("change:selectedItem",x),m.value=w.value?x:E(x),n("update:modelValue",m.value),i.value=t.showPhoneCustomizedLabel?D(x):S(x),l.value="",r.value=!1},D=x=>{const P=t.items.find(j=>j.code===x.code);return P==null?void 0:P.customizedLabel},T=()=>{let x,P;return w.value?P=t.items.find(j=>j.toLowerCase()===t.modelValue.toLowerCase()):P=t.items.find(j=>{var H;return E(j).toLowerCase()===((H=t.modelValue)==null?void 0:H.toLowerCase())}),P&&(x=w.value?P:!w.value&&t.showPhoneCustomizedLabel?D(P):S(P)),x},B=b(()=>{var P;return y.value&&((P=y.value)==null?void 0:P.getBoundingClientRect()).bottom+100>window.innerHeight?"up":"down"});We(()=>[f.value,B.value],()=>{Ft(()=>{c.value=B.value==="up"?`translateY(-${y.value.offsetHeight+57}px`:"translateY(0)"})}),We(()=>t.modelValue,x=>{m.value&&!t.readOnly||!t.items||(m.value=x,i.value=T())}),Xe(()=>{m.value||!t.items||(m.value=t.modelValue,i.value=T())});function S(x){const P=t.bindLabel.split(".");switch(P.length){case 1:return x[P[0]];case 2:return x[P[0]][P[1]];case 3:return x[P[0]][P[1]][P[2]];default:return x[t.bindLabel]}}function E(x){const P=t.bindValue.split(".");switch(P.length){case 1:return x[P[0]];case 2:return x[P[0]][P[1]];case 3:return x[P[0]][P[1]][P[2]];default:return x[t.bindLabel]}}return(x,P)=>{var H;const j=He("svg-inline");return a(),d("div",{class:"o-combobox relative",ref_key:"dropdownClose",ref:g},[e("div",tf,[e("div",sf,[x.disabled&&i.value==="None"?(a(),d("div",{key:0,class:O(`o-combobox__input block w-full ${x.classes} !p-2`)},P[3]||(P[3]=[e("div",{class:"w-4 h-[0.727rem] bg-grey200 rounded-[0.091rem]"},null,-1)]),2)):F((a(),d("input",{key:1,class:O(["o-combobox__input block",[r.value?"o-combobox__container__active":"",{error:x.hasError},x.classes]]),type:"text",placeholder:x.placeholder,disabled:x.disabled,"onUpdate:modelValue":P[0]||(P[0]=k=>i.value=k),onInput:C,onFocusin:P[1]||(P[1]=k=>r.value=!0),onBlur:_},null,42,af)),[[bt,i.value]]),r.value?(a(),d("img",{key:2,onClick:v,src:Qt,alt:"chevron-up",class:O(["absolute cursor-pointer bottom-[20%] right-2",{"!cursor-not-allowed":x.disabled}])},null,2)):(a(),d("img",{key:3,onClick:Qe(v,["prevent"]),src:Tt,alt:"chevron-down",class:O(["absolute cursor-pointer bottom-[20%] right-2",{"!cursor-not-allowed":x.disabled}])},null,2))]),(a(!0),d(Se,null,Ne(x.validationMessage,(k,M)=>(a(),d("div",{key:M},[e("span",of,I(k.$message),1)]))),128))]),r.value?(a(),d("ul",{key:0,style:lt({transform:c.value}),class:O([["absolute",f.value&&f.value.length>4?"overflow-y-scroll":"overflow-auto",x.listWidth],"mt-1 z-20 w-full max-h-[12rem] rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"]),ref_key:"dropdownRef",ref:y},[(a(!0),d(Se,null,Ne(f.value,(k,M)=>(a(),d("li",{class:O([[u.value===(w.value?k:S(k))||m.value===(w.value?k:E(k))?"bg-[#F3F9FF] text-primary":"text-gray-900","relative cursor-pointer select-none py-2 pl-4 pr-8"],"o-date-list__item text-sm"]),key:M,onClick:V=>A(k),onMouseover:V=>u.value=w.value?k:S(k),onMouseleave:P[2]||(P[2]=V=>u.value="")},[_e(I(w.value?k:S(k))+" ",1),m.value===(w.value?k:E(k))?(a(),d("span",lf,[F(e("img",rf,null,512),[[j]])])):h("",!0)],42,nf))),128)),(H=f.value)!=null&&H.length?h("",!0):(a(),d("li",df,"Not found"))],6)):h("",!0)],512)}}});const ga=Oe(uf,[["__scopeId","data-v-3cbbb40c"]]),cf={class:"p-4"},mf={key:0,class:"flex rounded-lg bg-[#FFF1F1] border border-[#FF45454D] p-4 mb-2 gap-[0.93rem] items-start"},gf={key:0,class:"text-sm leading-leading400 text-[#ff4545] m-0"},pf={key:1,class:"text-sm leading-leading400 text-[#ff4545] m-0"},vf={key:2,class:"text-sm leading-leading400 text-[#ff4545] m-0"},ff={key:3,class:"text-sm leading-leading400 text-[#ff4545] m-0"},hf={class:"mt-6"},_f={class:"mb-6"},yf={class:"mb-6"},bf={class:"mb-4"},wf=fe({__name:"EnterPaymentDetails",props:{showModal:{type:Boolean}},emits:["closeModal","openAgentUpgradeSuccessModal"],setup(o,{emit:s}){const t=Es(),n=Ae(),{getCurrentUser:l}=Zt(),i=s,m=$(""),r=$(),u=$(),g=$(),y=$(),c=$(!1),w=Nt({company_name:"",country_code:"",vatNumber:"",agentCount:1}),f=b(()=>t.countries),v=b(()=>{var E,x,P;return((E=y.value)==null?void 0:E.cardCvcError)||((x=y.value)==null?void 0:x.cardExpiryError)||((P=y.value)==null?void 0:P.cardNumberError)||g.value}),C=b(()=>n.cardDetails),_=()=>{i("closeModal")},A=E=>{r.value=E.value,u.value=E.stripe},D=E=>{y.value=E},T=async()=>{c.value=!0;try{const{token:E,error:x}=await u.value.createToken(r.value);x&&(g.value=x,c.value=!1),m.value=E.id,await B()}catch(E){return c.value=!1,E}},B=async()=>{try{await new _s().addCard({card_token:m.value}),await l({isSecondCall:!0})}catch(E){c.value=!1,Ze(E)}},S=async()=>{var x,P;const E={expiry_month:(x=C.value)==null?void 0:x.attributes.expiry_month,expiry_year:(P=C.value)==null?void 0:P.attributes.expiry_year,company_name:w.company_name,vat:w.vatNumber,country_code:w.country_code};try{await new _s().editPayment(E),await l({isSecondCall:!0}),w.company_name="",_(),c.value=!1}catch(j){c.value=!1,Ze(j)}};return Xe(async()=>{await t.getUserLocation(),f.value.forEach(E=>{E.code===t.location&&(w.country_code=E.code)})}),We(()=>C.value,()=>{C.value&&w.company_name?S():(c.value=!1,_())}),(E,x)=>(a(),d("div",null,[E.showModal?(a(),ne(Co,{key:0,closeModal:E.showModal,headerTitle:"Enter your payment details",actionButtonTypeOneText:"Back",actionButtonTypeTwoText:"Update Payment",onCloseModal:_,onActionButtonTypeOne:_,onActionButtonTypeTwo:T,isLoading:c.value},{default:K(()=>{var P,j,H,k,M,V,Z,ae,ce;return[e("div",cf,[v.value?(a(),d("div",mf,[x[3]||(x[3]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"42",height:"30",viewBox:"0 0 42 30",fill:"none"},[e("rect",{x:"0.828125",y:"0.337891",width:"40.357",height:"29.3505",rx:"3.66882",fill:"white"}),e("rect",{x:"1.37812",y:"0.887891",width:"39.257",height:"28.2505",rx:"3.11882",stroke:"#282D3E","stroke-opacity":"0.2","stroke-width":"1.1"}),e("rect",{opacity:"0.2",x:"4.5",y:"5.8418",width:"7.33763",height:"5.50322",rx:"1.83441",fill:"#282D3E"}),e("rect",{opacity:"0.2",x:"1.75",y:"13.167",width:"38.5",height:"5.5",fill:"#282D3E"})],-1)),e("div",null,[g.value?(a(),d("p",gf,I(g.value.message),1)):h("",!0),(P=y.value)!=null&&P.cardNumberError&&y.value.cardNumberError.message?(a(),d("p",pf,I((H=(j=y.value)==null?void 0:j.cardNumberError)==null?void 0:H.message),1)):h("",!0),(k=y.value)!=null&&k.cardExpiryError&&y.value.cardExpiryError.message?(a(),d("p",vf,I((V=(M=y.value)==null?void 0:M.cardExpiryError)==null?void 0:V.message),1)):h("",!0),(Z=y.value)!=null&&Z.cardCvcError&&y.value.cardCvcError.message?(a(),d("p",ff,I((ce=(ae=y.value)==null?void 0:ae.cardCvcError)==null?void 0:ce.message),1)):h("",!0)])])):h("",!0),W(Kn,{onChangeCardNumber:A,onCardError:D}),e("div",hf,[x[7]||(x[7]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mb-2"},"Details",-1)),e("div",_f,[x[4]||(x[4]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"Company Name*",-1)),F(e("input",{type:"text",placeholder:"My company","onUpdate:modelValue":x[0]||(x[0]=J=>w.company_name=J)},null,512),[[bt,w.company_name]])]),e("div",yf,[x[5]||(x[5]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"VAT Number (optional)",-1)),F(e("input",{type:"text",placeholder:"123456","onUpdate:modelValue":x[1]||(x[1]=J=>w.vatNumber=J)},null,512),[[bt,w.vatNumber]])]),e("div",bf,[x[6]||(x[6]=e("label",{class:"text-sm leading-leading400"},"Country*",-1)),W(ga,{items:f.value,bindValue:"code",modelValue:w.country_code,"onUpdate:modelValue":x[2]||(x[2]=J=>w.country_code=J)},null,8,["items","modelValue"])])])])]}),_:1},8,["closeModal","isLoading"])):h("",!0)]))}});const xf=Oe(wf,[["__scopeId","data-v-275d3398"]]),Cf={class:"flex flex-col items-center gap-1 px-[2.62rem] pb-4"},kf=["src"],$f=fe({__name:"AgentUpgradeSuccessModal",props:{showModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const t=At(),n=s,l=()=>{n("closeModal")},i=()=>{t.push({name:"settings-agents-view"})};return(m,r)=>{const u=Pe("Modal");return m.showModal?(a(),ne(u,{key:0,classes:"!w-[29rem]",closeModal:m.showModal,showFooter:!1,onCloseModal:l},{default:K(()=>[e("div",Cf,[e("img",{src:`${p(De)}images/invite-success.svg`,alt:""},null,8,kf),r[0]||(r[0]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] mb-0"},"Congratulations! 🎉",-1)),r[1]||(r[1]=e("p",{class:"text-base m-0 text-center text-grey900 pb-[1.87rem]"},"You now have the option to invite or activate additional agents",-1)),e("button",{class:"w-[13.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey900 text-white mb-2",onClick:i},"Go to agents page")])]),_:1},8,["closeModal"])):h("",!0)}}}),mo="/assets/active-check-with-bg-178edd79.svg",Sf={class:"px-4 pt-4 pb-16"},Tf={key:0,class:"flex flex-col md:w-[28rem] rounded-lg bg-[#FFF1F1] border border-[#FF45454D] p-4 mb-2 gap-[0.33rem] items-start"},Mf={key:0,class:"text-left text-sm leading-leading400 text-[#ff4545] m-0"},Af={key:1,class:"text-left text-sm leading-leading400 text-[#ff4545] m-0"},Ef={key:2,class:"text-left text-sm leading-leading400 text-[#ff4545] m-0"},Df={key:3,class:"text-left text-sm leading-leading400 text-[#ff4545] m-0"},If=fe({__name:"AddNewCard",props:{showModal:{type:Boolean},isProYearTrial:{type:Boolean}},emits:["closeModal","cardAdded"],setup(o,{emit:s}){const t=o,{getCurrentUser:n}=Zt(),l=s,i=$(),m=$(),r=$(),u=$(),g=$(),y=b(()=>{var _,A,D,T,B,S,E;return((A=(_=g.value)==null?void 0:_.cardCvcError)==null?void 0:A.message)||((T=(D=g.value)==null?void 0:D.cardExpiryError)==null?void 0:T.message)||((S=(B=g.value)==null?void 0:B.cardNumberError)==null?void 0:S.message)||((E=u.value)==null?void 0:E.message)}),c=()=>{l("closeModal")},w=_=>{m.value=_.value,r.value=_.stripe},f=_=>{g.value=_},v=async()=>{i.value=!0;try{if(y.value&&g.value){i.value=!1;return}const{token:_,error:A}=await r.value.createToken(m.value);if(A){g.value=void 0,u.value=A,i.value=!1;return}await C(_)}catch(_){return i.value=!1,u.value={message:"Please fill out all the required fields"},_}},C=async _=>{i.value=!0;try{await new _s().addCard({card_token:_.id}),c(),t.isProYearTrial||l("cardAdded"),ze().set({message:"Your credit card was successfully added",type:"success"}),await n({isSecondCall:!0}),i.value=!1}catch(A){i.value=!1,Ze(A)}};return(_,A)=>{const D=Pe("Modal");return _.showModal?(a(),ne(D,{key:0,headerTitle:_.isProYearTrial?"Add Credit Card Details":"Add new credit card",actionButtonTypeOneText:"Back",actionButtonTypeTwoText:_.isProYearTrial?"Save card":"Save new card",closeModal:_.showModal,onActionButtonTypeOne:c,isLoading:i.value,onActionButtonTypeTwo:v,onCloseModal:c},{default:K(()=>{var T,B,S,E,x,P,j,H,k;return[e("div",Sf,[y.value?(a(),d("div",Tf,[u.value&&!g.value?(a(),d("p",Mf,I(u.value.message),1)):h("",!0),(T=g.value)!=null&&T.cardNumberError&&g.value.cardNumberError.message?(a(),d("p",Af,I((S=(B=g.value)==null?void 0:B.cardNumberError)==null?void 0:S.message),1)):h("",!0),(E=g.value)!=null&&E.cardExpiryError&&g.value.cardExpiryError.message?(a(),d("p",Ef,I((P=(x=g.value)==null?void 0:x.cardExpiryError)==null?void 0:P.message),1)):h("",!0),(j=g.value)!=null&&j.cardCvcError&&g.value.cardCvcError.message?(a(),d("p",Df,I((k=(H=g.value)==null?void 0:H.cardCvcError)==null?void 0:k.message),1)):h("",!0)])):h("",!0),W(Kn,{onChangeCardNumber:w,onCardError:f})])]}),_:1},8,["headerTitle","actionButtonTypeTwoText","closeModal","isLoading"])):h("",!0)}}});const kl=Oe(If,[["__scopeId","data-v-ec50226d"]]),Ff="/assets/close-danger-e78c17f8.svg",$l="/assets/support-chat-f81b8179.svg",Pf={class:"p-4"},jf={key:0,class:"text-sm mt-0 mb-6 text-grey900 font-semibold leading-leading400"},Lf={class:"text-[#ff4545] text-sm font-semibold leading-leading400"},Rf={key:1},Bf={key:0,class:"text-sm mt-0 mb-6 text-[#0C1D36] font-semibold leading-leading400"},Nf={key:0,class:"text-base text-grey900 font-semibold leading-leading400"},Of={key:1,class:"text-base text-indicator font-semibold leading-leading400"},Vf={class:"flex items-center gap-[0.63rem] mb-5"},Uf={class:"m-0 text-base text-grey900 leading-leading400"},Gf={class:"flex justify-between"},Wf={class:"flex items-center gap-2"},qf={key:1,class:"text-white text-sm leading-leading400"},Hf={key:1,class:"text-white text-sm leading-leading400"},zf=fe({__name:"RemoveCreditCardAndDowngrade",props:{showModal:{type:Boolean},isRemove:{type:Boolean,default:!0}},emits:["closeModal","closeEditPaymentDetails"],setup(o,{emit:s}){const t=ts(),n=Ae(),{removeCardDowngrade:l,downgradeDudaPlan:i}=ma(),m=s,r=["Multiple agents","Unlimited chat history","Email integration","Private notes","Custom data, tags and segments","Live translation & multilingual widget"],u=$(!1),g=b(()=>t.plans),y=b(()=>n.subscription),c=b(()=>n.marketPlaceName==="duda"),w=b(()=>n.marketPlaceName==="shopify"),f=b(()=>{var x;return(x=n.user)==null?void 0:x.attributes.trial_ends_at}),v=b(()=>{var x;return(x=n.user)==null?void 0:x.attributes.pro_year_trial}),C=b(()=>t.isDowngrading),_=b(()=>n.hasTrial),A=b(()=>n.hasFailedPayment),D=b(()=>{var x,P;return(x=y.value)!=null&&x.attributes.next_renewal_date&&!v.value?cs((P=y.value)==null?void 0:P.attributes.next_renewal_date,"DD/MM/YYYY").value:v.value?cs(f,"DD/MM/YYYY").value:""}),T=()=>{m("closeModal")},B=()=>{var x;(x=window.$chatway)==null||x.openChatwayWidget()},S=async()=>{var P;if(c.value){await i();return}const x={plan_id:(P=g.value.find(j=>j.attributes.type.toLowerCase()==="free"))==null?void 0:P.id,frequency:"month"};try{u.value=!0,await new _s().updateSubscription(x),T(),u.value=!1,t.isChangePlan=!1}catch(j){u.value=!1,Ze(j)}},E=async()=>{await l()==="success"&&(T(),m("closeEditPaymentDetails"),ze().set({message:"Your credit card was successfully removed",type:"success"}),t.isChangePlan=!1)};return(x,P)=>{const j=Pe("Modal");return a(),d("div",null,[x.showModal?(a(),ne(j,{key:0,closeModal:x.showModal,headerTitle:x.isRemove?"Remove credit card & downgrade?":"Downgrade to Free plan?",onCloseModal:T},{FooterLeftContent:K(()=>[e("div",Gf,[e("div",{class:"flex items-center gap-2 cursor-pointer",onClick:B},P[4]||(P[4]=[e("img",{src:$l,alt:"support"},null,-1),e("p",{class:"m-0 text-base leading-leading400 text-grey900"},"Talk to our support",-1)])),e("div",Wf,[e("button",{onClick:T,class:"flex justify-center items-center gap-1 bg-grey100 px-2 py-[0.375rem] h-8 w-20 rounded text-grey900 text-sm leading-leading400"}," Cancel "),x.isRemove?(a(),d("button",{key:0,onClick:E,class:"flex justify-center items-center gap-1 bg-[#FF4545] px-2 py-[0.375rem] h-8 rounded text-white text-sm leading-leading400"},[C.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):(a(),d("span",qf,"Remove & Downgrade"))])):(a(),d("button",{key:1,onClick:S,class:"flex justify-center items-center gap-1 bg-[#FF4545] px-2 py-[0.375rem] h-8 rounded w-[98px]"},[u.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):(a(),d("span",Hf,"Downgrade"))]))])])]),default:K(()=>[e("div",Pf,[_.value||v.value?(a(),d("p",jf,[P[0]||(P[0]=_e(" Your Pro trial is still active, so you can continue enjoying all its benefits. Your trial ends on ")),e("span",Lf,I(D.value),1),P[1]||(P[1]=_e(" . After that, you won't be charged for Pro access, and your plan will automatically switch to the Free plan. "))])):(a(),d("div",Rf,[P[2]||(P[2]=e("p",{class:"my-0 text-base text-indicator font-semibold leading-leading400"},"Please Notice:",-1)),e("p",{class:O(["mb-2 text-base text-indicator leading-leading400",{"mb-6":A.value||c.value}])}," This action will result in a downgrade from the Pro plan to the Free plan. Are you sure? ",2),!A.value&&!c.value&&!w.value?(a(),d("p",Bf," You can still use your Pro plan until "+I(D.value),1)):h("",!0)])),e("div",null,[_.value||v.value?(a(),d("p",Nf,"Once your trial ends you'll lose access to these features:")):(a(),d("p",Of,"You'll lose access to these features:")),(a(),d(Se,null,Ne(r,H=>e("div",{key:H},[e("div",Vf,[P[3]||(P[3]=e("div",{class:"w-[1.25rem] h-[1.25rem] bg-[#FF45451A] flex justify-center items-center rounded-[6.25rem] p-[0.125rem]"},[e("img",{src:Ff,alt:"cancel icon"})],-1)),e("p",Uf,I(H),1)])])),64))])]),P[5]||(P[5]=e("div",{class:"h-[0.0625rem] bg-grey200"},null,-1))]),_:1},8,["closeModal","headerTitle"])):h("",!0)])}}});const Sl=Oe(zf,[["__scopeId","data-v-da74ba13"]]),Kf={class:"flex flex-col items-center gap-1 pt-4"},Yf={class:"text-base m-0 text-grey900 px-3 leading-[140%]"},Zf={class:"text-base text-grey900 font-semibold"},Jf={class:"flex justify-between"},Qf={class:"flex items-center gap-2"},Xf={key:1,class:"text-white text-sm leading-leading400"},eh=fe({__name:"proYearTrialRemoveCardAndDownGradeModal",props:{showModal:{type:Boolean}},emits:["closeModal","closeEditPaymentDetails"],setup(o,{emit:s}){const{removeCardDowngrade:t}=ma(),n=Ae(),l=ts(),i=s,m=b(()=>l.isDowngrading),r=b(()=>{var c;return(c=n.user)==null?void 0:c.attributes.trial_ends_at}),u=()=>{i("closeModal")},g=()=>{var c;(c=window.$chatway)==null||c.openChatwayWidget()},y=async()=>{await t()==="success"&&(u(),i("closeEditPaymentDetails"),ze().set({message:"Your credit card was successfully removed",type:"success"}))};return(c,w)=>{const f=Pe("Modal");return c.showModal?(a(),ne(f,{key:0,classes:"!w-[29rem]",headerTitle:"Remove Credit Card?",closeModal:c.showModal,onCloseModal:u},{FooterLeftContent:K(()=>[e("div",Jf,[e("div",{class:"flex items-center gap-2 cursor-pointer",onClick:g},w[3]||(w[3]=[e("img",{src:$l,alt:"support"},null,-1),e("p",{class:"m-0 text-base leading-leading400 text-grey900"},"Talk to our support",-1)])),e("div",Qf,[e("button",{onClick:u,class:"flex justify-center items-center gap-1 bg-grey100 px-2 py-[0.375rem] h-8 w-20 rounded-[0.25rem] text-grey900 text-sm leading-leading400"},"Cancel"),e("button",{onClick:y,class:"flex justify-center items-center gap-1 bg-[#FF4545] px-2 py-[0.375rem] h-8 rounded-[0.25rem] text-white text-sm leading-leading400"},[m.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):(a(),d("span",Xf,"Remove"))])])])]),default:K(()=>[e("div",Kf,[e("p",Yf,[w[0]||(w[0]=_e(" Your trial ends on ")),e("span",Zf,I(p(cs)(r.value,"DD/MM/YYYY").value)+".",1),w[1]||(w[1]=_e(" To keep enjoying Pro features without interruption, make sure your credit card is added. Removing it might limit your access after the trial. "))]),w[2]||(w[2]=e("div",{class:"bg-grey200 h-px w-full mt-3"},null,-1))])]),_:1},8,["closeModal"])):h("",!0)}}}),th={class:"p-4"},sh={key:0,class:"flex gap-4"},ah={class:"relative"},oh={class:"mt-6"},nh={class:"mb-6"},ih={class:"mb-6"},lh={class:"mb-4"},rh=fe({__name:"EditPaymentDetails",props:{showModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const t=At(),n=Es(),l=Ae(),{getCurrentUser:i}=Zt(),m=$(!1),r=$(!1),u=$(!1),g=$(!1),y=$(!1),c=$(),w=$(),f=Nt({company:"",country:"",vatNumber:"",agentCount:1,cardNumber:"**** **** **** ****",expiration:"",cvc:"***"}),v=s,C=b(()=>n.countries.map(x=>({name:`${x.emoji} ${x.name}`,code:x.code,emoji:x.emoji,id:x.id,image:x.image}))),_=b(()=>l.user),A=b(()=>l.cardDetails),D=()=>{var E;v("closeModal"),(E=t.currentRoute.value.query)!=null&&E.editPaymentDetails&&t.push({name:"settings-plans-view"})},T=()=>{var E;(E=l.user)!=null&&E.attributes.pro_year_trial?u.value=!0:r.value=!0},B=E=>{let x=E.target.value.trim();if(!x.toString().length){y.value=!0;return}if(E.target.selectionStart<2&&x.length>2&&E.inputType==="deleteContentBackward"||x.length===1&&E.inputType==="deleteContentBackward")return;let P=x.replace(/\D/g,"").slice(0,4),j=P.slice(0,2),H=P.slice(2);if(j&&j.length===1&&parseInt(j)>1&&(j="0"+j,P=j+H),H&&H.length===2){let k=new Date().getFullYear().toString().substr(-2),M=(new Date().getMonth()+1).toString().padStart(2,"0");y.value=H<k||H===k&&j<M}P.length>1&&P.charAt(2)!=="/"&&E.inputType!=="deleteContentBackward"?f.expiration=`${j}/${H}`:f.expiration=j+(P.length>2?"/"+H:"")},S=async()=>{if(!f.company||!f.country||!f.expiration||y.value){c.value=!0,w.value=!0,ze().set({message:`${f.company?f.country?"Card":"Country":"Company name"} is required`,type:"error"});return}g.value=!0;const E={expiry_month:f.expiration.split("/")[0],expiry_year:20+f.expiration.split("/")[1],company_name:f.company,vat:f.vatNumber,country_code:f.country};try{await new _s().editPayment(E),D(),await i({isSecondCall:!0}),g.value=!1}catch(x){g.value=!1,Ze(x)}};return Xe(async()=>{var E;_.value&&(f.company=_.value.attributes.company_name,f.vatNumber=_.value.attributes.vat,f.country=_.value.attributes.country_code),A.value&&(f.cardNumber=`**** **** **** ${A.value.attributes.last_4_digit}`,f.expiration=(A.value.attributes.expiry_month.toString().length>1?A.value.attributes.expiry_month.toString():`0${A.value.attributes.expiry_month}`)+"/"+A.value.attributes.expiry_year.toString().substr(-2)),(E=_.value)!=null&&E.attributes.country_code||(await n.getUserLocation(),C.value.forEach(x=>{x.code===n.location&&(f.country=x.code)}))}),We(()=>l.cardDetails,async()=>{var E;A.value?(f.cardNumber=`**** **** **** ${A.value.attributes.last_4_digit}`,f.expiration=(A.value.attributes.expiry_month.toString().length>1?A.value.attributes.expiry_month.toString():`0${A.value.attributes.expiry_month}`)+"/"+A.value.attributes.expiry_year.toString().substr(-2)):(f.cardNumber="**** **** **** ****",f.expiration=""),_.value&&(f.company=_.value.attributes.company_name,f.vatNumber=_.value.attributes.vat,f.country=_.value.attributes.country_code),(E=_.value)!=null&&E.attributes.country_code||(await n.getUserLocation(),C.value.forEach(x=>{x.code===n.location&&(f.country=x.code)}))}),(E,x)=>(a(),d("div",null,[E.showModal?(a(),ne(Co,{key:0,closeModal:E.showModal,headerTitle:"Edit your payment details",actionButtonTypeOneText:`${A.value?"Replace":"Add"} Card`,actionButtonTypeTwoText:"Save",alertButtonText:A.value?"Remove card":"",onCloseModal:D,onActionButtonTypeOne:x[9]||(x[9]=P=>m.value=!0),onActionButtonTypeTwo:S,onActionAlertButton:T,isLoading:g.value},{default:K(()=>[e("div",th,[A.value?(a(),d("div",sh,[e("div",ah,[x[13]||(x[13]=e("label",{for:"cardNumber",class:"text-sm text-nowrap leading-leading400"},"Card Number*",-1)),x[14]||(x[14]=e("svg",{class:"absolute bottom-4 left-1",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"16",viewBox:"0 0 22 16",fill:"none"},[e("rect",{width:"22",height:"16",rx:"2",fill:"#E6E6F0"}),e("rect",{opacity:"0.2",x:"2",y:"3",width:"4",height:"3",rx:"1",fill:"#282D3E"}),e("rect",{opacity:"0.2",y:"7",width:"22",height:"3",fill:"#282D3E"})],-1)),F(e("input",{type:"text",class:"!pl-8 !bg-grey100 md:!w-[200px]",placeholder:"**** **** **** ****",disabled:"","onUpdate:modelValue":x[0]||(x[0]=P=>f.cardNumber=P)},null,512),[[bt,f.cardNumber]])]),e("div",null,[x[15]||(x[15]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"Expiration*",-1)),F(e("input",{type:"text",class:O([[y.value?"!border-[#ff424d]":"border-inherit"],"w-full"]),placeholder:"mm/yy",inputmode:"numeric",maxlength:"5","onUpdate:modelValue":x[1]||(x[1]=P=>f.expiration=P),onInput:B},null,34),[[bt,f.expiration]])]),e("div",null,[x[16]||(x[16]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"CVC*",-1)),F(e("input",{type:"number",placeholder:"***",class:"!bg-grey100 w-full",disabled:"","onUpdate:modelValue":x[2]||(x[2]=P=>f.cvc=P)},null,512),[[bt,f.cvc]])])])):(a(),d("p",{key:1,onClick:x[3]||(x[3]=P=>m.value=!0),class:"text-primary underline cursor-pointer text-sm font-semibold inline"},"Add Card")),e("div",oh,[x[20]||(x[20]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mb-2"},"Details",-1)),e("div",nh,[x[17]||(x[17]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"Company Name*",-1)),F(e("input",{type:"text",placeholder:"My company","onUpdate:modelValue":x[4]||(x[4]=P=>f.company=P),onBlur:x[5]||(x[5]=P=>c.value=!0),class:O([c.value&&!f.company?"!border-[#ff424d]":"border-inherit"])},null,34),[[bt,f.company]])]),e("div",ih,[x[18]||(x[18]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"VAT Number (optional)",-1)),F(e("input",{type:"text",placeholder:"123456","onUpdate:modelValue":x[6]||(x[6]=P=>f.vatNumber=P)},null,512),[[bt,f.vatNumber]])]),e("div",lh,[x[19]||(x[19]=e("label",{class:"text-sm leading-leading400"},"Country*",-1)),W(ga,{items:C.value,bindValue:"code",modelValue:f.country,"onUpdate:modelValue":[x[7]||(x[7]=P=>f.country=P),x[8]||(x[8]=P=>w.value=!0)],hasError:w.value&&!f.country},null,8,["items","modelValue","hasError"])])])])]),_:1},8,["closeModal","actionButtonTypeOneText","alertButtonText","isLoading"])):h("",!0),m.value?(a(),ne(kl,{key:1,showModal:m.value,onCloseModal:x[10]||(x[10]=P=>m.value=!1)},null,8,["showModal"])):h("",!0),W(Sl,{showModal:r.value,onCloseModal:x[11]||(x[11]=P=>r.value=!1),onCloseEditPaymentDetails:D},null,8,["showModal"]),W(eh,{"show-modal":u.value,onCloseModal:x[12]||(x[12]=P=>u.value=!1),onCloseEditPaymentDetails:D},null,8,["show-modal"])]))}});const dh=Oe(rh,[["__scopeId","data-v-e1e0e85e"]]),uh={class:"flex flex-col items-center gap-1 p-6"},ch={class:"w-[24.688rem] text-base m-0 text-center text-grey900 pb-8 leading-[140%]"},ko=fe({__name:"ownerAccessRequired",props:{showModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const t=ys(),n=s,l=b(()=>{const r=t.agents.find(u=>u.attributes.role===la.CHAT_AGENT_OWNER);return r==null?void 0:r.attributes.email}),i=()=>{var r;(r=window.$chatway)==null||r.openChatwayWidget()},m=()=>{n("closeModal")};return(r,u)=>{const g=Pe("Modal");return r.showModal?(a(),ne(g,{key:0,classes:"!w-[29rem]",closeModal:r.showModal,showFooter:!1,onCloseModal:m},{default:K(()=>[e("div",uh,[u[1]||(u[1]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] text-center"},"Owner access required",-1)),e("p",ch,I(`Only the Chatway account owner can upgrade the plan. Please reach out to ${l.value} for assistance.`),1),e("button",{onClick:m,class:"py-[0.5625rem] w-[13.688rem] h-10 px-4 flex gap-1 items-center justify-center bg-grey900 text-white mb-2"},"Got it"),e("div",{class:"flex items-center gap-1"},[u[0]||(u[0]=e("p",{class:"m-0 text-grey900 text-sm leading-[1.05rem]"},"Need Help?",-1)),e("p",{onClick:i,class:"m-0 text-primary text-sm leading-[1.05rem] cursor-pointer"},"Talk to support")])])]),_:1},8,["closeModal"])):h("",!0)}}}),mh={key:0},gh={class:"border border-[#93939D4C] rounded-xl !p-5"},ph={class:"flex flex-col items-center justify-center"},vh=["src"],fh={class:"text-grey900 text-base font-semibold leading-leading400 m-0"},hh={class:"flex justify-between mt-3"},_h={class:"text-xs leading-leading400 text-grey600 mb-0 mt-1 flex items-center"},yh={class:"info-wrap"},bh={class:"w-4 h-4",src:as,alt:""},wh={class:"flex items-center gap-4"},xh={class:"text-grey900 font-semibold text-lg leading-leading400"},Ch={key:0,class:"flex justify-between font-semibold text-sm leading-leading400 text-grey900 mt-[1.37rem]"},kh={class:"font-semibold text-grey900"},$h={class:"!text-left text-grey900 text-sm font-semibold leading-leading400 m-0"},Sh={key:1,class:"border border-[#ff4545] mt-[-20px] mb-4 border-opacity-30 bg-[#fff1f1] rounded-lg p-3"},Th={class:"!text-left mt-0 mx-0 mb-2 text-[#ff4545] text-sm font-semibold leading-[19.6px]"},Mh={class:"flex justify-between items-center gap-1"},Ah=["disabled"],Eh={key:1,class:"text-white text-sm leading-leading400"},Dh={key:1},Ih={class:"flex items-center flex-col !mb-6"},Fh=["src"],Ph={class:"flex items-center gap-2"},jh=["src"],Lh={key:1,class:"text-left text-grey900 text-base leading-leading400"},Rh={class:"font-semibold text-grey900"},Bh={key:2,class:"text-left text-grey900 text-base leading-leading400"},Nh={class:"font-semibold text-grey900"},Oh={key:0,class:"flex items-center gap-2"},Vh=["src"],Uh={class:"text-left text-grey900 text-base leading-leading400"},Gh={class:"font-semibold text-grey900"},Wh={class:"flex items-center gap-2"},qh=["src"],Hh={key:0,class:"text-left text-grey900 text-base leading-leading400"},zh={class:"font-semibold text-grey900"},Kh={key:1,class:"text-left text-grey900 text-base leading-leading400"},Yh={class:"font-semibold text-grey900"},Zh={key:1,class:"flex items-center gap-2"},Jh=["src"],Qh={class:"text-left text-grey900 text-base leading-leading400"},Xh={class:"font-semibold text-grey900"},e_=["disabled"],t_={key:1,class:"flex items-center justify-center gap-2 text-base leading-leading400 text-white"},s_=["href"],a_=fe({__name:"UpdateAgent",props:{showModal:{type:Boolean},upgradeOnDeactivation:{type:Boolean}},emits:["closeModal","openCreateAgentModal","activateAgent"],setup(o,{emit:s}){const t=o,n=Ae(),l=At(),i=ts(),{getPlans:m,upgradeDudaUser:r}=ma(),{isOwner:u}=Xt(),g=s,y={agent1:`${De}images/agent1.png`,agent2:`${De}images/agent2.png`,agent3:`${De}images/agent3.png`,agent4:`${De}images/agent4.png`,agent5:`${De}images/agent5.png`,agent6:`${De}images/agent6.png`,agent7:`${De}images/agent7.png`},c=$(1),w=$(0),f=$(!1),v=$(!1),C=$(!1),_=$(!1),A=$(!1),D=$(""),T=b(()=>i.isUpgradingDudaUser),B=b(()=>{var xe;return((xe=n.subscription)==null?void 0:xe.attributes.agents)||0}),S=b(()=>{var xe;return((xe=n.user)==null?void 0:xe.attributes.agent_count)||0}),E=b(()=>{var xe;return((xe=n.user)==null?void 0:xe.attributes.pro_year_trial)||!1}),x=b(()=>c.value-B.value),P=b(()=>n.cardDetails),j=b(()=>i.plans),H=b(()=>y[`agent${c.value<7?c.value:7}`]),k=b(()=>n.user),M=b(()=>n.marketPlaceName==="duda"),V=b(()=>n.marketPlaceName==="shopify"),Z=b(()=>n.hasTrial),ae=b(()=>{var xe;return(xe=n.user)==null?void 0:xe.attributes.trial_ends_at}),ce=b(()=>n.hasTrialButNotProYearTrial),J=b(()=>l.currentRoute.value.path.includes("onboarding")),X=b(()=>{const xe=new Date(ae.value);return xe.setDate(xe.getDate()+Number(1)),xe}),z=b(()=>i.dudaPlanList),q=b(()=>!V.value&&!M.value),ue=b(()=>n.isProUser),pe=()=>{g("closeModal"),C.value=!1},de=()=>{M.value&&c.value===10||c.value++},he=()=>{c.value!=1&&c.value--},ve=()=>{g("closeModal"),l.push("/agents")},be=async()=>{if(!u){A.value=!0;return}if(M.value){const xe=new FormData;xe.append("plan_identifier",z.value[c.value]);const N=await r(xe);N!=="error"&&(D.value=N,w.value=1);return}if(V.value){ie();return}w.value=1},re=()=>{P.value?v.value=!0:f.value=!0},ie=async()=>{var N,L,me,G,U;if(!V.value&&!((N=k.value)!=null&&N.attributes.company_name)||!V.value&&!((L=k.value)!=null&&L.attributes.country_code)){v.value=!0,ze().set({message:"Please add company name and country code in your profile",type:"error"});return}let xe={plan_id:(me=j.value.find(R=>R.attributes.type.toLowerCase()==="pro"))==null?void 0:me.id,frequency:"month",agents:c.value,country_code:(G=k.value)==null?void 0:G.attributes.country_code,company_name:(U=k.value)==null?void 0:U.attributes.company_name};V.value&&(xe.shop=n.shopifyStore,xe.is_onboarding=J.value?1:0),_.value=!0;try{const{data:R}=await new _s().updateSubscription(xe);if(V.value){_.value=!1,D.value=R.attributes.checkout_url,w.value=1;return}l.currentRoute.value.path==="/plans"&&(C.value=!0),_.value=!1,l.currentRoute.value.path!=="/plans"&&pe(),t.upgradeOnDeactivation?g("activateAgent"):g("openCreateAgentModal")}catch(R){_.value=!1,Ze(R)}};return Xe(async()=>{c.value=B.value+1,!j.value.length&&await m()}),(xe,N)=>{const L=Pe("VDropdown"),me=Pe("Modal"),G=He("svg-inline");return a(),d("div",null,[xe.showModal?(a(),ne(me,{key:0,classes:w.value===0&&!xe.upgradeOnDeactivation?"!w-[22.5rem]":"!w-[27.25rem]",showHeaderClose:!1,closeModal:!1,showFooter:!1},{default:K(()=>{var U,R;return[e("div",{class:O([w.value===0?"!p-6":"!p-3"])},[w.value===0?(a(),d("div",mh,[e("div",gh,[e("div",ph,[e("img",{src:H.value,alt:"",class:"mb-2"},null,8,vh),e("p",fh,I(xe.upgradeOnDeactivation&&ue.value?`You currently have a Pro ${Z.value?"trial":"plan"} for ${B.value} agent${B.value>1?"s":""}`:xe.upgradeOnDeactivation&&!ue.value?"You currently using a free plan":"Select number of agents"),1),e("p",{class:O(["m-0 !text-center text-grey600",{"text-sm":xe.upgradeOnDeactivation}])},I(xe.upgradeOnDeactivation?"Increase the number of agents to invite more":"Choose the number of agents based on your requirements."),3)]),e("div",hh,[e("div",null,[N[6]||(N[6]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 m-0"},"Number of agents",-1)),e("p",_h,[_e(" $9 X "+I(c.value)+" agent /month ",1),W(L,{triggers:["hover","click"],placement:"top"},{popper:K(()=>N[5]||(N[5]=[e("div",{class:"more--info"},[e("span",null," This indicates the total number of paid user seats. For example, with 2 agents, you're purchasing 2 seats, one seat for the owner and another seat allowing you to invite 1 more teammate to Chatway. ")],-1)])),default:K(()=>[e("div",yh,[F(e("img",bh,null,512),[[G]])])]),_:1})])]),e("div",wh,[e("div",{onClick:he,class:"w-8 h-8 rounded-full flex items-center justify-center hover:border-[#D9E5FF] hover:border-4"},N[7]||(N[7]=[e("img",{class:"w-6 h-6 cursor-pointer",src:xl,alt:""},null,-1)])),e("span",xh,I(c.value),1),e("div",{onClick:de,class:"w-8 h-8 rounded-full flex items-center justify-center hover:border-[#D9E5FF] hover:border-4"},N[8]||(N[8]=[e("img",{class:"w-6 h-6 cursor-pointer",src:Cl,alt:""},null,-1)]))])])]),Z.value&&!((U=p(n).user)!=null&&U.attributes.pro_year_trial)?(a(),d("p",Ch,[N[9]||(N[9]=_e(" Your billing starts on: ")),e("span",kh,I(`${p(pl)[X.value.getMonth()]} ${X.value.getDate()}${p(vl)(X.value)}, ${X.value.getFullYear()}`),1)])):h("",!0),e("div",{class:O(["flex justify-between mb-[3.44rem]",[ce.value?"mt-0":"mt-[1.37rem]"]])},[N[10]||(N[10]=e("p",{class:"!text-left text-grey900 text-sm font-semibold leading-leading400 m-0"},"Total",-1)),e("p",$h,"$"+I(9*c.value)+"/month",1)],2),c.value<S.value?(a(),d("div",Sh,[e("p",Th,"You currently have "+I(S.value)+" active agent"+I(S.value>1?"s":"")+".",1),e("p",{class:"!text-left m-0 text-[#ff4545] text-sm leading-[19.6px]"},[N[11]||(N[11]=_e(" Deactivate active agents on the ")),e("span",{onClick:ve,class:"text-[#ff4545] text-sm cursor-pointer underline"},"agent screen"),N[12]||(N[12]=_e(" to lower their count "))])])):h("",!0),e("div",Mh,[e("button",{onClick:pe,class:O(["flex justify-center items-center gap-1 bg-grey100 px-2 py-[0.375rem] h-[2.5rem] w-[9.375rem] rounded-[0.25rem] text-grey900 text-sm leading-leading400",{"w-[11.6875rem]":xe.upgradeOnDeactivation}])}," Cancel ",2),e("button",{disabled:c.value<S.value||c.value===B.value&&!E.value&&(!V.value||!M.value),onClick:be,class:O(["flex justify-center items-center gap-1 bg-grey900 px-2 py-[0.375rem] h-[2.5rem] rounded-[0.25rem] w-[9.375rem] text-white text-sm leading-leading400",{"w-[11.6875rem]":xe.upgradeOnDeactivation}])},[T.value||_.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):(a(),d("span",Eh,"Next"))],10,Ah)])])):h("",!0),w.value===1?(a(),d("div",Dh,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:N[0]||(N[0]=ee=>w.value=0)},N[13]||(N[13]=[e("img",{src:ws,alt:"user"},null,-1),e("span",{class:"text-grey900 text-sm m-0 leading-[1.225rem]"},"Go Back",-1)])),e("div",Ih,[e("img",{src:`${p(De)}images/summaryFrame.svg`,alt:"summary icon",class:"mb-2"},null,8,Fh),N[14]||(N[14]=e("p",{class:"m-0 text-lg text-grey900 font-semibold leading-leading400 text-center"},"Summary & Payment",-1))]),e("div",null,[e("div",Ph,[x.value!=0?(a(),d("img",{key:0,src:p(mo),alt:"active icon"},null,8,jh)):h("",!0),x.value>0?(a(),d("p",Lh,[N[15]||(N[15]=_e(" You are adding ")),e("span",Rh,I(x.value),1),_e(" new agent"+I(x.value>1?"s":""),1)])):h("",!0),x.value<0?(a(),d("p",Bh,[N[16]||(N[16]=_e(" You are removing ")),e("span",Nh,I(Math.abs(x.value)),1),_e(" agent"+I(x.value>1?"s":""),1)])):h("",!0)]),x.value>0&&!Z.value?(a(),d("div",Oh,[e("img",{src:p(mo),alt:"active icon"},null,8,Vh),e("p",Uh,[N[17]||(N[17]=_e(" This month your relative payment will be ")),e("span",Gh,"$"+I(x.value*9),1)])])):h("",!0),e("div",Wh,[e("img",{src:p(mo),alt:"active icon"},null,8,qh),Z.value?(a(),d("p",Kh,[N[19]||(N[19]=_e(" After trial your total amount will be ")),e("span",Yh,"$"+I(c.value*9)+"/month",1)])):(a(),d("p",Hh,[N[18]||(N[18]=_e(" Next month your payment will be ")),e("span",zh,"$"+I(c.value*9)+"/month",1)]))]),q.value?(a(),d("div",Zh,[e("img",{src:p(mo),alt:"active icon"},null,8,Jh),e("p",Qh,[N[20]||(N[20]=_e(" We will charge the card ending with ")),e("span",Xh,I((R=P.value)==null?void 0:R.attributes.last_4_digit),1)]),(a(),d("svg",{class:"cursor-pointer",onClick:re,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},N[21]||(N[21]=[e("path",{d:"M8 13.3334H14",stroke:"#0446DE","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e("path",{d:"M11 2.33334C11.2652 2.06813 11.6249 1.91913 12 1.91913C12.1857 1.91913 12.3696 1.95571 12.5412 2.02678C12.7128 2.09785 12.8687 2.20202 13 2.33334C13.1313 2.46466 13.2355 2.62057 13.3066 2.79215C13.3776 2.96373 13.4142 3.14762 13.4142 3.33334C13.4142 3.51906 13.3776 3.70296 13.3066 3.87454C13.2355 4.04612 13.1313 4.20202 13 4.33334L4.66667 12.6667L2 13.3333L2.66667 10.6667L11 2.33334Z",stroke:"#0446DE","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])))])):h("",!0)]),q.value?(a(),d("button",{key:0,disabled:!P.value,onClick:ie,class:"flex items-center justify-center bg-grey900 py-[0.5625rem] px-4 mt-10 w-full"},[_.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):(a(),d("span",t_,[N[22]||(N[22]=e("img",{src:Fn,alt:"shield"},null,-1)),_e(" "+I(Z.value?"Update":"Pay now"),1)]))],8,e_)):(a(),d("a",{key:1,href:D.value,target:"_parent",class:"flex items-center justify-center bg-grey900 gap-2 py-[0.5625rem] px-4 mt-10 text-base leading-leading400 text-white w-full"},[N[23]||(N[23]=e("img",{src:Fn,alt:"shield"},null,-1)),_e(" "+I(Z.value?"Update":"Pay now"),1)],8,s_))])):h("",!0)],2)]}),_:1},8,["classes"])):h("",!0),v.value?(a(),ne(dh,{key:1,showModal:v.value,onCloseModal:N[1]||(N[1]=U=>v.value=!1)},null,8,["showModal"])):h("",!0),W(xf,{showModal:f.value,onCloseModal:N[2]||(N[2]=U=>f.value=!1),onOpenAgentUpgradeSuccessModal:N[3]||(N[3]=U=>C.value=!0)},null,8,["showModal"]),W($f,{showModal:C.value,onCloseModal:pe},null,8,["showModal"]),W(ko,{showModal:A.value,onCloseModal:N[4]||(N[4]=U=>A.value=!1)},null,8,["showModal"])])}}});const o_=Oe(a_,[["__scopeId","data-v-c47db390"]]),n_={class:"flex flex-col items-center gap-1 p-6"},i_=fe({__name:"FailedPayment",props:{showModal:{type:Boolean}},setup(o){const s=Ae(),t=At(),n=$(!1),l=()=>{var r;(r=window.$chatway)==null||r.openChatwayWidget()},i=()=>{s.showFailedPaymentModal=!1},m=()=>{s.showFailedPaymentModal=!1,t.push({name:"settings-plans-view"})};return(r,u)=>{const g=Pe("Modal");return r.showModal?(a(),ne(g,{key:0,classes:"!w-[29rem]",closeModal:r.showModal,showFooter:!1,onCloseModal:i},{default:K(()=>[e("div",n_,[u[2]||(u[2]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] text-center"},"Payment Failed 😞",-1)),u[3]||(u[3]=e("p",{class:"w-[23.625rem] text-base m-0 text-center text-grey900 pb-8 leading-[140%]"}," Your last payment didn't go through. Please update your payment information to ensure that Chatway works as expected. ",-1)),e("button",{onClick:m,class:"py-[0.5625rem] px-4 flex gap-1 items-center justify-center bg-grey900 text-white mb-2"},[u[0]||(u[0]=_e(" Update Payment ")),n.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"17px"})):h("",!0)]),e("div",{class:"flex items-center gap-1"},[u[1]||(u[1]=e("p",{class:"m-0 text-grey900 text-sm leading-[1.05rem]"},"Need Help?",-1)),e("p",{onClick:l,class:"m-0 text-primary text-sm leading-[1.05rem] cursor-pointer"},"Talk to support")])])]),_:1},8,["closeModal"])):h("",!0)}}}),Tl="/assets/alt-logo-with-bg-5f914119.svg",l_=fe({__name:"ExistingUserTrialModal",setup(o){const s=Ae(),{closeAppUpgradeReminder:t}=ma(),n=b(()=>s.enableExistingUserWelcomeToProModal),l=()=>{var m;(m=window.$chatway)==null||m.openChatwayWidget()},i=()=>{s.enableExistingUserWelcomeToProModal=!1;const m=new FormData;m.append("type","fe_hide_existing_user_trial_modal"),t(m)};return(m,r)=>{const u=Pe("Modal");return n.value?(a(),ne(u,{key:0,classes:"!w-[31.38rem]",showHeaderClose:!0,closeModal:n.value,showFooter:!1,onCloseModal:i},{default:K(()=>[e("div",{class:"bg-primary pb-3"},[e("div",{class:"bg-[url('@/assets/images/existing-user-trial-bg.svg')] bg-no-repeat bg-cover pt-8"},[r[1]||(r[1]=e("div",{class:"flex justify-center gap-1 pb-6"},[e("img",{class:"",src:Tl,alt:"icon"})],-1)),r[2]||(r[2]=e("div",{class:"px-6 pb-6"},[e("h3",{class:"text-white pb-2 text-2xl text-center font-semibold leading-[120%]"},"Introducing Chatway Pro!"),e("div",{class:"text-white text-base text-center leading-[150%]"},[_e(" Chatway now offers paid plans to enhance your communication experience. And the best part? As an existing user - "),e("span",{class:"bg-[#F3F9FF29] rounded text-[15px] text-white p-1 font-semibold leading-[150%]"},"enjoy 6 months of Chatway Pro for free 🎉")])],-1)),r[3]||(r[3]=e("div",{class:"w-full h-[0.0625rem] opacity-10 bg-grey100 mb-4"},null,-1)),e("div",{class:"flex flex-col items-center px-6"},[e("button",{onClick:i,class:"button-shadow py-[0.5625rem] w-full h-10 px-4 flex gap-1 items-center justify-center bg-white text-[#170f49] font-semibold mb-3"}," Got it "),e("div",{class:"flex items-center gap-1 text-[#FFFFFFC2]"},[r[0]||(r[0]=e("p",{class:"m-0 text-sm leading-[1.05rem] text-[#FFFFFFC2]"},"Need Help?",-1)),e("p",{onClick:l,class:"m-0 text-sm leading-[1.05rem] cursor-pointer text-[#FFFFFFC2] underline"},"Talk to support")])])])])]),_:1},8,["closeModal"])):h("",!0)}}});const r_=Oe(l_,[["__scopeId","data-v-a7cf8790"]]),d_="/assets/line-3a01573f.svg",u_="/assets/line-4-2738a477.svg",$o="/assets/external-link-34a65320.svg",c_="/assets/shopify-setup-toggle-7dbbfa0b.svg",m_="/assets/shopify-save-6ead5cd1.svg",g_="/assets/link-grey-86eb1413.svg",p_={class:"p-6"},v_={class:"flex gap-2"},f_={class:""},h_={src:d_,alt:"line",class:"ml-5 md:h-[2.94rem]"},__={src:u_,alt:"line",class:"ml-5 md:h-[5.6rem]"},y_={class:"w-full"},b_={class:"flex flex-col md:flex-row justify-between md:items-center mb-12 md:mb-6 mt-2 md:mt-0"},w_={key:1},x_={class:"w-4 h-4 cursor-pointer text-white",src:$o,alt:"external link"},C_={class:"flex flex-col md:flex-row md:justify-between md:items-center mb-12 md:my-6"},k_={src:c_,alt:"toggle design",class:"my-2 m-0 md:w-[12.5rem] md:h-[4.4375rem]"},$_={class:"flex flex-col md:flex-row md:justify-between md:items-center md:mt-6"},S_={src:m_,alt:"save design",class:"my-2 m-0 md:w-[12.5rem] md:h-[4.4375rem]"},T_={key:0,class:"bg-grey100 flex justify-center items-center gap-1 h-8 px-[0.75] py-[0.63rem] text-sm text-grey900 leading-leading400"},M_=["href"],A_={key:1,class:"bg-danger flex justify-center items-center h-8 px-[0.75] py-[0.63rem] text-sm text-white leading-leading400 rounded-b-lg"},E_=fe({__name:"ShopifyEmptyState",props:{hideBorder:{type:Boolean}},setup(o){const s=Ae(),t=$(!1),n=b(()=>s.allShopifyWithEmbeddedStatus.find(r=>!r.attributes.is_embedded_app_enabled)),l=b(()=>s.uiFlags.isFetchingEmbeddedStatus),i=b(()=>s.shopifyStore),m=()=>{var r;n.value&&(t.value=!0,window.open((r=n.value)==null?void 0:r.activationLink,"_blank"))};return(r,u)=>{const g=Pe("Loader"),y=He("svg-inline");return a(),d("div",{class:O(["md:rounded-lg md:max-w-[691px]",[{"md:border md:border-grey200":!r.hideBorder}]])},[u[11]||(u[11]=e("div",{class:"border-b border-grey200 hidden md:block"},[e("div",{class:"pl-6 pt-6 pb-4 flex items-center gap-2"},[e("span",{class:"w-1 h-4 rounded-[1px] title-bar"}),e("p",{class:"text-lg text-grey900 font-semibold leading-leading400"},"We’re almost done, now lets add Chatway to your theme 🚀")])],-1)),e("div",p_,[u[8]||(u[8]=e("p",{class:"text-grey900 text-sm text-center md:hidden mt-[-50px] mb-8"},"Please add Chatway to your Shopify theme",-1)),e("div",v_,[e("div",f_,[u[0]||(u[0]=e("div",{class:"bg-[rgba(207,207,211,0.24)] md:bg-grey100 border-2 border-[#f6f6f8] rounded-[56px] w-10 h-10 flex items-enter justify-center py-2 px-0"},[e("h4",{class:"font-semibold leading-leading400 text-grey900 text-lg m-0"},"1")],-1)),F(e("img",h_,null,512),[[y]]),u[1]||(u[1]=e("div",{class:"bg-[rgba(207,207,211,0.24)] md:bg-grey100 border-2 border-[#f6f6f8] rounded-[56px] w-10 h-10 flex items-enter justify-center py-2 px-0"},[e("h4",{class:"font-semibold leading-leading400 text-grey900 text-lg m-0"},"2")],-1)),F(e("img",__,null,512),[[y]]),u[2]||(u[2]=e("div",{class:"bg-[rgba(207,207,211,0.24)] md:bg-grey100 border-2 border-[#f6f6f8] rounded-[56px] w-10 h-10 flex items-enter justify-center py-2 px-0"},[e("h4",{class:"font-semibold leading-leading400 text-grey900 text-lg m-0"},"3")],-1))]),e("div",y_,[e("div",b_,[u[3]||(u[3]=e("div",{class:"md:w-[343px]"},[e("p",{class:"block text-sm md:text-base text-grey900 md:font-semibold leading-leading400 mx-0 mt-0 !mb-2 md:!mb-0"},"Click on “Complete Setup”")],-1)),e("button",{onClick:m,class:O([[{"cursor-not-allowed":l.value}],"complete-setup w-full md:w-max flex items-center justify-center py-[6px] px-4 gap-2 bg-primary text-white text-base"])},[_e(I(l.value?"Verifying":"Complete Setup")+" ",1),l.value?(a(),ne(g,{key:0,size:"16px"})):(a(),d("span",w_,[F(e("img",x_,null,512),[[y]])]))],2)]),u[6]||(u[6]=e("div",{class:"hidden md:block border-b border-b-grey200 rounded-lg w-full"},null,-1)),e("div",C_,[u[4]||(u[4]=e("div",{class:"w-[343px]"},[e("p",{class:"text-sm md:text-base text-grey900 md:font-semibold leading-leading400 mx-0 mt-0 !mb-2 md:!mb-0 md:w-[19.19rem]"},'Make sure that the "Chatway" toggle on the left sidebar is turned on')],-1)),F(e("img",k_,null,512),[[y]])]),u[7]||(u[7]=e("div",{class:"hidden md:block border-b border-b-grey200 rounded-lg w-full"},null,-1)),e("div",$_,[u[5]||(u[5]=e("div",{class:""},[e("p",{class:"text-sm md:text-base text-grey900 md:font-semibold leading-leading400 mx-0 mt-0 !mb-2 md:!mb-0"},'Click "Save"')],-1)),F(e("img",S_,null,512),[[y]])])])])]),i.value?(a(),d("div",T_,[u[9]||(u[9]=e("img",{src:g_,alt:""},null,-1)),u[10]||(u[10]=_e(" Store Link: ")),e("a",{href:`https://${i.value}`,target:"_blank",class:"text-sm text-grey900 leading-leading400 underline"},I(i.value),9,M_)])):h("",!0),t.value&&!l.value?(a(),d("div",A_," Setup incomplete. Please check again. ")):h("",!0)],2)}}});const Pn=Oe(E_,[["__scopeId","data-v-9252215d"]]),D_=fe({__name:"ShopifyInstructionModal",props:{showModal:{type:Boolean}},emits:["close"],setup(o,{emit:s}){const t=s,n=Ae(),l=()=>{t("close")};return(i,m)=>i.showModal&&p(n).isProductTourAndEmailModalNotVisible?(a(),ne(Co,{key:0,closeModal:i.showModal,class:"w-full !z-[999999]",onCloseModal:l},{default:K(()=>[W(Pn,{hideBorder:!0,onClose:l})]),_:1},8,["closeModal"])):h("",!0)}});const I_=Oe(D_,[["__scopeId","data-v-62ff5eb1"]]),F_="/assets/x-white-58dda251.svg";function hs(){const o=$(!1);function s(){Ys(()=>{window.innerWidth<=1024?o.value=!0:o.value=!1},100)()}function t(){window.innerWidth<=1024?o.value=!0:o.value=!1}return Xe(()=>{t(),window.addEventListener("resize",s)}),Ms(()=>{window.removeEventListener("resize",s)}),{isSmallScreen:o}}const Za=gs({id:"sidebar",state:()=>({showPrimarySidebar:!1,isExpandedChatView:!1}),actions:{togglePrimarySidebar(){this.showPrimarySidebar=!this.showPrimarySidebar}}}),P_={class:"bg-grey900 pt-4 lg:pr-3.5"},j_=fe({__name:"ShopifyCompleteSetupRibbon",setup(o){const s=Ae(),{isSmallScreen:t}=hs(),n=Za(),l=()=>{s.showShopifyCompleteSetupModal=!0,s.ignoreConversationCheck=!0},i=b(()=>n.showPrimarySidebar);return(m,r)=>(a(),d("div",P_,[e("div",{class:O(["bg-[#FF4545] md:h-9 rounded-xl flex justify-center items-center py-1 px-3",[{"ml-[52px]":!p(t)||i.value}]])},[e("p",{class:"m-0 text-center text-sm text-white leading-leading400"},[r[1]||(r[1]=_e(' Setup failed. Please click on "Complete Setup" and follow the installation steps. ')),e("span",{class:"text-white text-sm underline cursor-pointer",onClick:l},"Complete Setup")]),e("img",{onClick:r[0]||(r[0]=u=>p(s).isShopifyRibbonVisible=!1),src:F_,alt:"close icon",class:"absolute right-2 md:right-5 cursor-pointer"})],2)]))}}),L_=fe({__name:"WixUpgrade",props:{showModal:{type:Boolean}},setup(o){const s=Ae(),t=$(!1),n=`https://www.wix.com/installer/install?appId=${window.location.origin.includes("dev-go")?"6bd4ebd0-500f-4c43-a1d1-5b7a42539ab7":"5aea2d6c-558b-4658-98ea-c948691b626a"}&redirectUrl=${window.location.origin}/wix/oauth/overview`,l=()=>{window.open(n,"_blank")},i=()=>{s.wixAppData=null,t.value=!1};return Xe(()=>{setTimeout(()=>{t.value=!0},2500)}),(m,r)=>{const u=Pe("Modal");return m.showModal&&t.value?(a(),ne(u,{key:0,classes:"!w-[29rem]",closeModal:m.showModal,showFooter:!1,onCloseModal:i},{default:K(()=>[e("div",{class:"flex flex-col items-center gap-1 p-6"},[r[0]||(r[0]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] text-center mb-4"},"Update Required",-1)),r[1]||(r[1]=e("p",{class:"w-[23.625rem] text-base m-0 text-center text-grey900 pb-8 leading-[140%]"}," You are using an older version of our app. To continue enjoying the latest features and improvements, please update to the newest version. ",-1)),e("div",{onClick:l,class:"py-[0.5625rem] rounded px-4 flex gap-1 items-center justify-center bg-grey900 text-white mb-2 cursor-pointer"},"Update")])]),_:1},8,["closeModal"])):h("",!0)}}}),R_={class:"bg-primary pb-3"},B_={class:"pt-8"},N_={class:"px-6 pb-6"},O_={class:"text-white text-base text-center leading-[150%]"},V_={class:"text-[15px] text-white font-semibold leading-[150%]"},U_=fe({__name:"ExistingUserTrialNotificationModal",props:{showExistingUserTrialNotificationModal:{type:Boolean}},setup(o){const s=o,t=At(),n=Ae(),{closeAppUpgradeReminder:l}=ma(),i=$(!1),m=b(()=>s.showExistingUserTrialNotificationModal&&i.value===!0),r=()=>{var y;(y=window.$chatway)==null||y.openChatwayWidget()},u=()=>{i.value=!1,n.enableExistingUserWelcomeToProModal=!1;const y=new FormData;y.append("type","fe_hide_add_cc_modal"),l(y)},g=()=>{u(),t.push({name:"settings-plans-view",query:{addCreditCard:"true"}})};return Xe(()=>{setTimeout(()=>{i.value=!0},2500)}),(y,c)=>{const w=Pe("Modal");return m.value?(a(),ne(w,{key:0,classes:"!w-[31.38rem]",showHeaderClose:!0,closeModal:m.value,showFooter:!1,onCloseModal:u},{default:K(()=>{var f,v;return[e("div",R_,[e("div",B_,[c[4]||(c[4]=e("div",{class:"flex justify-center gap-1 pb-6"},[e("img",{class:"",src:Tl,alt:"icon"})],-1)),e("div",N_,[c[2]||(c[2]=e("h3",{class:"text-white pb-2 text-2xl text-center font-semibold leading-[120%]"},"Add Your payment method",-1)),e("div",O_,[c[0]||(c[0]=_e(" Your trial ends on ")),e("span",V_,I(p(cs)((v=(f=p(n))==null?void 0:f.user)==null?void 0:v.attributes.trial_ends_at,"DD/MM/YYYY").value)+".",1),c[1]||(c[1]=_e(" To keep enjoying Pro features without interruption, make sure your payment details are added. Removing it might limit your access after the trial "))])]),c[5]||(c[5]=e("div",{class:"w-full h-[0.0625rem] opacity-10 bg-grey100 mb-4"},null,-1)),e("div",{class:"flex flex-col items-center px-6"},[e("button",{onClick:g,class:"button-shadow py-[0.5625rem] w-full h-10 px-4 flex gap-1 items-center justify-center bg-white text-[#170f49] font-semibold mb-3"},"Add payment method"),e("div",{class:"flex items-center gap-1 text-[#FFFFFFC2]"},[c[3]||(c[3]=e("p",{class:"m-0 text-sm leading-[1.05rem] text-[#FFFFFFC2]"},"Need Help?",-1)),e("p",{onClick:r,class:"m-0 text-sm leading-[1.05rem] cursor-pointer text-[#FFFFFFC2] underline"},"Talk to support")])])])])]}),_:1},8,["closeModal"])):h("",!0)}}});const G_=Oe(U_,[["__scopeId","data-v-9342f79a"]]),Ml="/assets/bell-1da9f242.svg",W_="/assets/conversation-dd7aa59f.svg",Al="/assets/zap-9b3a9a64.svg",q_={key:0,class:"bg-[rgba(18,20,34,0.80)] backdrop-blur-sm fixed top-0 bottom-0 w-full h-full z-[2147489999]"},H_={class:"fixed bottom-0"},z_={class:"bg-white w-full h-[28.8125rem] rounded-t-xl shadow-[0px_2px_8px_0px_rgba(43,43,62,0.08)"},K_={class:"bg-[url('@/assets/images/md-bg.svg')] bg-cover bg-no-repeat pt-[1.31rem] px-4"},Y_={class:"flex flex-col items-center gap-2"},Z_=["src"],J_={class:"text-grey900 text-[1.375rem] font-medium leading-[130%] text-center m-0"},Q_={class:"px-6"},X_={class:"flex flex-col gap-3"},e0={class:"flex items-center gap-2"},t0={class:"[&>path]:stroke-grey900",src:Ml,alt:"notification"},s0={class:"flex items-center gap-2"},a0={class:"w-4 h-4 [&>path]:stroke-grey900",src:Al,alt:"notification"},o0={class:"flex flex-col items-center"},n0={class:"checkbox-form-group"},i0=fe({__name:"MobileAppDownloadPrompt",props:{showDownloadAppPrompt:{type:Boolean},isIos:{type:Boolean}},setup(o){const s=Ae(),t=$(!1),n=()=>{t.value&&l(),s.showDownloadAppPrompt=!1},l=()=>{Mt.set("dontShowChAppDownloadPromptAgain","true",{sameSite:"none",secure:!0,domain:".chatway.app",expires:180}),Mt.set("dontShowChAppDownloadPromptAgain","true",{sameSite:"none",secure:!0,domain:"localhost",expires:180})},i=m=>{s.showDownloadAppPrompt=!1,window.open(m)};return(m,r)=>{const u=He("svg-inline");return a(),ne(ms,{name:"slide-up"},{default:K(()=>[m.showDownloadAppPrompt?(a(),d("div",q_,[e("div",H_,[e("div",z_,[e("div",K_,[e("div",Y_,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"Chatway",width:"112",height:"30",loading:"lazy"},null,8,Z_),e("p",J_,"Download the Chatway App for "+I(m.isIos?"iOS":"Android")+" Now",1),r[2]||(r[2]=e("div",{class:"bg-black opacity-[0.06] w-full h-px my-[1.38rem]"},null,-1))])]),e("div",Q_,[e("div",X_,[e("div",e0,[F(e("img",t0,null,512),[[u]]),r[3]||(r[3]=e("p",{class:"m-0 text-sm leading-leading400 font-normal text-grey900"},"Get instant alerts for new chats",-1))]),r[5]||(r[5]=e("div",{class:"flex items-center gap-2"},[e("img",{src:W_,alt:"notification"}),e("p",{class:"m-0 text-sm leading-leading400 font-normal text-grey900"},"Chat on the go, anytime, anywhere")],-1)),e("div",s0,[F(e("img",a0,null,512),[[u]]),r[4]||(r[4]=e("p",{class:"m-0 text-sm leading-leading400 font-normal text-grey900"},"Respond faster with quick replies",-1))])]),r[7]||(r[7]=e("div",{class:"bg-black opacity-[0.06] w-full h-px my-[1.38rem]"},null,-1)),e("button",{onClick:r[0]||(r[0]=g=>i(m.isIos?"https://apps.apple.com/ng/app/chatway-website-live-chat/id6449775006":"https://play.google.com/store/apps/details?id=com.chatway.mobile&pcampaignid=web_share")),class:"w-full h-[2.375rem] bg-primary rounded flex justify-center items-center gap-2 text-sm leading-leading400 text-white mb-2.5"}," Download the App "),e("button",{onClick:n,class:"w-full h-[2.375rem] bg-grey100 rounded flex justify-center items-center gap-2 text-sm leading-leading400 text-grey900 mb-[1.38rem]"}," Continue using your browser "),e("div",o0,[e("div",n0,[F(e("input",{ref:"checkInput",id:"app_download_modal_hide","onUpdate:modelValue":r[1]||(r[1]=g=>t.value=g),type:"checkbox",class:"w-4 h-4 rounded-sm border-[1.5px] border-grey600 checked:bg-primary focus:ring-0 mr-2"},null,512),[[Ia,t.value]]),r[6]||(r[6]=e("label",{for:"app_download_modal_hide",class:"flex items-center gap-2 text-sm text-grey900 select-none hover:cursor-pointer"},"Don't show this page again",-1))])])])])])])):h("",!0)]),_:1})}}});const l0=Oe(i0,[["__scopeId","data-v-4f7affb0"]]);class r0{constructor(){oa(this,"myshopify_domain","");oa(this,"origin_url","")}async getCustomer(s,t){return ke.get("/shopify/customers/search",{params:{...s,myshopify_domain:this.myshopify_domain},signal:t})}async getCartInfo(s,t){return ke.get(`/chat-contacts/${s}/cart-info`,{params:{myshopify_domain:this.myshopify_domain},signal:t})}async getCustomerOrders(s,t){return ke.get("/shopify/orders",{params:{...s,myshopify_domain:this.myshopify_domain},signal:t})}async getProductImages(s){return ke.get(`/shopify/products/${s.product_id}/images`,{params:{...s,myshopify_domain:this.myshopify_domain}})}async getCollections(s){return ke.get("/shopify/collections",{params:{...s,myshopify_domain:this.myshopify_domain}})}async getProducts(s){return ke.get("/shopify/products",{params:{...s,myshopify_domain:this.myshopify_domain}})}async getCoupons(){return ke.get("/shopify/coupons",{params:{myshopify_domain:this.myshopify_domain}})}async getShopMeta(s,t){return ke.get("/shopify/shop-info",{params:{origin_url:s},signal:t})}async updatePermission(){return ke.get("/shopify/permission-update",{params:{myshopify_domain:this.myshopify_domain}})}}const $s=new r0,d0=[{id:"1",legacyResourceId:1234567890,name:"#1001",email:"example@gmail.com",phone:"",createdAt:"2024-11-09T10:15:30.000Z",currencyCode:"USD",displayFulfillmentStatus:"FULFILLED",active:!1,statusPageUrl:"",test:!1,fullyPaid:!1,unpaid:!0,isDummy:!0,fulfillments:[{displayStatus:"FULFILLED",trackingInfo:[{number:"ZXC23458K",url:""}]}],shippingAddress:{formatted:[],formattedArea:"305 W 60th St. New York, NY 10023"},billingAddress:{formatted:[],formattedArea:"305 W 60th St. New York, NY 10023"},currentTotalPriceSet:{shopMoney:{amount:129,currencyCode:"USD"}},currentTotalTaxSet:{shopMoney:{amount:10,currencyCode:"USD"}},currentSubtotalPriceSet:{shopMoney:{amount:110,currencyCode:"USD"}},totalShippingPriceSet:{shopMoney:{amount:9,currencyCode:"USD"}},lineItems:{nodes:[{id:"1",title:"Casual shoes",name:"Casual shoes",sku:"sku-hosted-1",quantity:1,currentQuantity:1,originalUnitPriceSet:{shopMoney:{amount:60,currencyCode:"USD"}},product:{id:"1",legacyResourceId:8838199050544,status:"ACTIVE",handle:"",title:"Casual shoes",featuredImage:{url:"",altText:""}},image:{url:"",altText:""}},{id:"2",title:"Formal shoes",name:"Formal shoes",sku:"sku-hosted-2",quantity:1,currentQuantity:1,originalUnitPriceSet:{shopMoney:{amount:50,currencyCode:"USD"}},product:{id:"2",legacyResourceId:8838198722864,status:"ACTIVE",handle:"",title:"Formal shoes",featuredImage:{url:"",altText:""}},image:{url:"https://files-cdn.chatway.app/assets/images/dummy-product-1.webp",altText:""}}]}}],u0="gid://shopify/Customer/1234567890",c0="1234567890",m0="example@gmail.com",g0="John",p0="John Smith",v0="1",f0={amount:"245",currencyCode:"USD"},h0="enabled",_0=!0,y0={id:u0,legacyResourceId:c0,email:m0,firstName:g0,displayName:p0,numberOfOrders:v0,amountSpent:f0,state:h0,isDummy:_0},b0=[{id:1,key:"1",sku:"sku-hosted-1",url:"",image:"https://files-cdn.chatway.app/assets/images/dummy-product-2.webp",price:2500,original_price:2500,title:"Running shoes",taxable:!0,quantity:1,line_price:2500,discounted_price:2500,final_line_price:2500,final_price:2500,presentment_price:2500,original_line_price:2500,requires_shipping:!0,product_id:23467,featured_image:{alt:"Running shoes",url:"https://files-cdn.chatway.app/assets/images/dummy-product-2.webp"},total_discount:0,isDummy:!0},{id:2,key:"2",sku:"sku-hosted-2",url:"",image:"https://files-cdn.chatway.app/assets/images/dummy-product-3.webp",price:7500,original_price:7500,title:"Sneakers",taxable:!0,quantity:1,line_price:7500,discounted_price:7500,final_line_price:7500,final_price:7500,presentment_price:7500,original_line_price:7500,requires_shipping:!0,product_id:23478,featured_image:{alt:"Sneakers",url:"https://files-cdn.chatway.app/assets/images/dummy-product-3.webp"},total_discount:0,isDummy:!0}],w0="USD",x0=2,C0=1e4,k0=0,$0=[],S0=!0,T0={items:b0,currency:w0,item_count:x0,total_price:C0,total_discount:k0,cart_level_discount_applications:$0,isDummy:S0},Ja=gs("shopify-data",()=>{const o=ct(),s=Ae(),t=$(null),n=$(null),l=$([]),i=$(null),m=$(""),r=$(3),u=$(3),g=$(!1),y=$(!1),c=$(!1),w=$(!1),f=$(!1),v=$(!1),C=$(!1);let _=null,A=null,D=null,T=null;const B=b(()=>S.value&&r.value<l.value.length),S=b(()=>l.value.length>3),E=b(()=>{var re,ie,xe;return x.value&&!!((ie=(re=i.value)==null?void 0:re.items)!=null&&ie.length)&&u.value<((xe=i.value)==null?void 0:xe.items.length)}),x=b(()=>{var re,ie;return(re=i.value)!=null&&re.items.length?((ie=i.value)==null?void 0:ie.items.length)>3:!1}),P=b(()=>g.value||c.value||C.value),j=b(()=>{var re;return!!((re=t.value)!=null&&re.site_host_url)}),H=b(()=>{var ie,xe,N,L,me,G;return((N=(xe=(ie=o.selectedConversation)==null?void 0:ie.attributes)==null?void 0:xe.contact)==null?void 0:N.origin)||((G=(me=(L=o.selectedConversation)==null?void 0:L.attributes)==null?void 0:me.origin)==null?void 0:G.toString())||""}),k=b(()=>{var re;return!!((re=t.value)!=null&&re.required_permission_update)}),M=b(()=>l.value.sort((re,ie)=>ie.legacyResourceId-re.legacyResourceId).slice(0,r.value)),V=b(()=>{var re;return((re=i.value)==null?void 0:re.items.slice(0,u.value))||[]}),Z=b(()=>{var re,ie,xe;return(re=t.value)!=null&&re.url?`https://${(ie=t.value)==null?void 0:ie.url}`:`https://${(xe=t.value)==null?void 0:xe.site_host_url}`});We(()=>{var re,ie,xe,N,L,me,G;return[(re=o.selectedConversation)==null?void 0:re.id,(N=(xe=(ie=o.selectedConversation)==null?void 0:ie.attributes)==null?void 0:xe.contact)==null?void 0:N.email,(G=(me=(L=o.selectedConversation)==null?void 0:L.attributes)==null?void 0:me.contact)==null?void 0:G.contact_email]},async(re,ie)=>{var R;const[xe,N,L]=re,[me,G,U]=ie;if(!(xe===me&&N===G&&L===U)&&!((R=n.value)!=null&&R.isDummy)&&(await z(),await q(),await Ft(),await ue(),!!t.value&&(pe(),N||L)))try{C.value=!0,await de(N||L),await he()}finally{C.value=!1}}),We([()=>s.productTourCurrentStep,()=>s.isProductTourSkiped],()=>{s.isProductTourSkiped||s.productTourCurrentStep>s.productTourSteps.length?be():ve()}),Xe(()=>{ve()});function ae(){r.value+=3}function ce(){r.value=3}function J(){u.value+=3}function X(){u.value=3}async function z(){t.value=null,n.value=null,l.value=[],i.value=null}async function q(){_==null||_.abort(),T==null||T.abort(),A==null||A.abort(),D==null||D.abort()}async function ue(){_=new AbortController;const re=await $s.getShopMeta(H.value,_.signal);t.value=re,$s.myshopify_domain=re.site_host_url,$s.origin_url="https://"+re.site_host_url}async function pe(){var re,ie,xe;y.value=!0,T=new AbortController,await $s.getCartInfo((xe=(ie=(re=ct().selectedConversation)==null?void 0:re.attributes)==null?void 0:ie.contact)==null?void 0:xe.id,T.signal).then(async({cart:N})=>{N!=null&&N.items&&(N.items=N.items.map(L=>({...L,active:!1}))),i.value=N||null}).finally(()=>{T!=null&&T.signal.aborted||(y.value=!1)})}async function de(re){c.value=!0,A=new AbortController,await $s.getCustomer({email:re},A.signal).then(({data:ie})=>{n.value=(ie==null?void 0:ie.customers.nodes[0])||null}).finally(()=>{A!=null&&A.signal.aborted||(c.value=!1)})}async function he(re=""){var ie;n.value&&(m.value=re,D=new AbortController,g.value=!0,await $s.getCustomerOrders({customer_id:(ie=n.value)==null?void 0:ie.legacyResourceId,q:[re,"test:false"].join(" ").toString()},D.signal).then(async({data:xe})=>{var N,L;D!=null&&D.signal.aborted||(l.value=((L=(N=xe==null?void 0:xe.orders)==null?void 0:N.nodes)==null?void 0:L.map(me=>({...me,active:!1})))||[])}).finally(async()=>{D!=null&&D.signal.aborted||(await Ft(),g.value=!1)}))}async function ve(){l.value.length||!s.isProductTourRunning||!s.isShopifyUser||(n.value=y0,l.value=d0,i.value=T0)}async function be(){var re,ie,xe;(re=n.value)!=null&&re.isDummy&&(n.value=null),(ie=l.value[0])!=null&&ie.isDummy&&(l.value=[]),(xe=i.value)!=null&&xe.isDummy&&(i.value=null)}return{requiredShopifyPermissionUpdate:k,marketplaceApp:t,loadingCustomerOrder:P,updateCartInfo:pe,loadingCouponData:v,loadingOrderData:g,loadingCartData:y,loadingProductData:w,loadingCollectionData:f,isOriginatedFromShopify:j,customerOrders:l,cartData:i,customer:n,orderSearchQuery:m,getCustomerOrders:he,sortedCustomerOrders:M,getShopifyCustomerByEmail:de,handelShowMoreOrderClick:ae,handelShowLessOrderClick:ce,handelShowMoreCartItemClick:J,handelShowLessCartItemClick:X,canLoadMoreOrders:B,canShowOrderPagination:S,canLoadMoreCartItem:E,canShowCartPagination:x,sortedCartItems:V,getShopUrl:Z}}),M0={key:1,class:"h-screen flex justify-center items-center"},A0=1e4,E0=fe({__name:"App",setup(o){const s=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt()),t=({content:Be})=>Be.includes("unread")?`${Be} Chatway`:Be?`Chatway ${Be}`:"Chatway";Ta({titleTemplate:Be=>t({content:Be||""}),meta:[{name:"Chatway",content:"Chatway is a customer support application designed to help businesses interact with their customers in real-time through chat. With Chatway, businesses can easily provide support, answer questions, and resolve issues through a simple chat interface, all while maintaining a high level of customer satisfaction."},{property:"og:image",content:"https://dev-chaty-uploads.s3.us-east-2.amazonaws.com/M0PtIvQMUZPDfOBnphvQuISxtvyheBzVPa7t4G5E0GlYR85o.png"}]});const n=ls(),l=At(),i=Ae(),m=hl(),r=Ja(),u=Ya(),{updateAgentOnlineStatus:g}=qn(),y=zs(),c=ct(),w=Pa(),f=ts(),{updateConversationNote:v,deleteConversationNote:C}=Wn(),_=Fa(),{updateConversationReminder:A,deleteConversationReminder:D}=Hn(),T=jt(),{getCurrentUser:B,setEmailOfflineVisitorModal:S,getAllShopifyUrl:E}=Zt(),{addPresenceAgent:x,removePresenceAgent:P,removeAllPresenceAgent:j,addConversation:H,updateConversation:k,updatePageVisited:M,updateVisitorInfo:V}=ss(),{updateMessage:Z,addMessage:ae,readMessages:ce,playAudio:J}=Yt(),{updateIsPageVisible:X}=bo(),{isOwner:z}=Xt(),q=Bs(),{isPending:ue}=Rr(()=>{},1500),{initializeAudio:pe,cleanUp:de}=_l(),he=[],ve=$(!1),be=b(()=>{const Be=navigator.userAgent||navigator.vendor||window.opera,at=window.matchMedia("(max-width: 480px)").matches&&window.location===window.parent.location,Ue=/iPhone|iPad|iPod/i.test(Be);return{isMobile:at,isIOS:Ue}}),re=b(()=>i.showDownloadAppPrompt&&be.value.isMobile),ie=b(()=>T.showEditSegmentModal),xe=b(()=>T.showAddSegmentModal),N=b(()=>i.user),L=b(()=>i.isDeactivated),me=b(()=>f.showDudaUpgradeModal),G=b(()=>f.showDudaUpgradeNoticeModal),U=b(()=>f.showUpdateAgentModal),R=b(()=>T.selectedSegment),ee=b(()=>i.isFailedPaymentModalVisible),se=b(()=>n.path==="/login"||n.path==="/register"||n.path==="/forgot-password"),Y=b(()=>!n.path.includes("onboarding")&&!n.path.includes("login")&&!n.path.includes("register")&&!n.path.includes("password")&&!n.path.includes("verify")&&!n.path.includes("shopify")&&!n.path.includes("agent/invite")&&!n.path.includes("oauth")),Fe=b(()=>Y.value&&i.getShopifySiteLength&&!ue.value&&!i.isProductTourRunning),oe=b(()=>i.isLoadingFullscreen),st=b(()=>i.shouldDisplayShopifyInstructionOnChatway),Le=b(()=>i.showShopifyCompleteSetupModal&&st.value&&!oe.value&&!n.path.includes("onboarding")&&!c.allConversations.length||i.showShopifyCompleteSetupModal&&st.value&&!oe.value&&!n.path.includes("onboarding")&&i.ignoreConversationCheck),le=b(()=>st.value&&!i.showShopifyCompleteSetupModal&&i.isShopifyRibbonVisible&&Fe.value&&!oe.value||st.value&&i.showShopifyCompleteSetupModal&&c.allConversations.length&&i.isShopifyRibbonVisible&&Fe.value&&!oe.value),Ie=b(()=>{var Be;return Y.value&&yo()&&i.wixAppData!==null&&i.wixAppData.version!=="latest"&&((Be=i.user)==null?void 0:Be.attributes.email.endsWith("@premio.io"))||!1}),rt=b(()=>{var Be;return((Be=i.user)==null?void 0:Be.attributes.trial_days_left)||0}),Et=b(()=>i.cardDetails),ye=b(()=>{var Be,at,Ue;return((Be=i.user)==null?void 0:Be.attributes.role)==="CHAT_AGENT_OWNER"&&((at=i.user)==null?void 0:at.attributes.pro_year_trial)&&((Ue=i.user)==null?void 0:Ue.attributes.show_add_cc_modal)&&!Et.value&&rt.value<31}),_t=()=>{$e.off(Me.WIDGET_PROFILE_UPDATE),$e.off(Me.PAGE_VISITED),$e.off(Me.CHANGE_ONLINE_STATUS_RECEIVED),$e.off(Me.CHANGE_CONVERSATION_STATUS_RECEIVED),$e.off(Me.CHANGE_CONVERSATION_ASSIGNEE_RECEIVED),$e.off(Me.WIDGET_MESSAGE_RECEIVED),$e.off(Me.AGENT_MESSAGE_RECEIVED),$e.off(Me.AGENT_CONVERSATION_VIEWING_RECEIVED),$e.off(Me.AGENT_CONVERSATION_VIEWING_STOPPED_RECEIVED),$e.off(Me.AGENT_CONVERSATION_VIEWING_STOPPED_ALL_RECEIVE),$e.off(Me.CONVERSATION_CREATE_SUCCESS),$e.off(Me.USER_TYPING_STOP),$e.off(Me.USER_TYPING_START),$e.off(Me.WIDGET_MESSAGE_READ),$e.off(Me.CHAT_CONTACT_UPDATED),$e.off(Me.CHANGE_CONVERSATION_STATUS_TRIGGERED),$e.off(Me.FIRST_VISITOR_EMAIL_UPDATED),$e.off(Me.SUBSCRIPTION_UPDATES),$e.off(Me.UPDATE_AGENT_SUCCESS),$e.off(Me.CANNED_RESPONSE_CREATED_SUCCESS),$e.off(Me.CANNED_RESPONSE_DELETED_SUCCESS),$e.off(Me.NEW_SEGMENT),$e.off(Me.MARKETPLACE_CART_UPDATED),$e.off(Me.MARKETPLACE_ORDER_CREATED)},Ce=Be=>{he[Be.conversation_id]=setTimeout(()=>{Je(Be)},A0)},vt=Be=>{he[Be]&&(clearTimeout(he[Be]),he[Be]=null)},qe=Be=>{const at=Be.conversation_id;vt(at),m.addUserToTyping(Be),Ce(Be)},Je=Be=>{const at=Be.conversation_id;clearTimeout(he[at]),m.deleteUserFromTyping({conversation_id:at,contact_id:Be.contact_id,agent_id:Be.agent_id})},ft=()=>{var Be,at;s&&n.meta.requiresAuth&&B(),s&&N.value&&(i.enableExistingUserWelcomeToProModal=z&&((Be=i.user)==null?void 0:Be.attributes.pro_year_trial)&&((at=i.user)==null?void 0:at.attributes.show_existing_user_trial_modal))},Ve=()=>{const Be=setInterval(async()=>{var at,Ue,Ct,te,Q;(n.name==="login"||n.name==="register"||n.name==="forgot-password"||n.name==="password-reset"||n.name==="password-reset-token")&&clearInterval(Be),N.value&&Object.prototype.hasOwnProperty.call(window,"$chatway")&&(clearInterval(Be),window.$chatway.updateChatwayCustomData("email",((at=N.value.attributes)==null?void 0:at.email)||""),window.$chatway.updateChatwayCustomData("name",((Ue=N.value.attributes)==null?void 0:Ue.name)||""),window.$chatway.updateChatwayCustomData("Product","Chatway"),window.$chatway.updateChatwayCustomData("Type",N.value.attributes.reg_source||""),window.$chatway.updateChatwayCustomData("Sign up date",cs(N.value.attributes.created_at,"MMM DD, YYYY").value),window.$chatway.updateChatwayCustomData("Plan",`${(Ct=i.subscription)==null?void 0:Ct.attributes.plan} ${((te=i.subscription)==null?void 0:te.attributes.plan_type.toLowerCase())==="free"?"":`${(Q=i.subscription)==null?void 0:Q.attributes.agents} agents`} ${N.value.attributes.has_trial&&!N.value.attributes.pro_year_trial?"(trial)":N.value.attributes.pro_year_trial?"(trial 6)":""}`||""),!q.activatedDomains.length&&s&&await q.getAllInstallationPlatforms(),q.activatedDomains.length>1?q.activatedDomains.forEach((Te,je)=>{window.$chatway.updateChatwayCustomData(`Domain${je>0?je:""}`,Te)}):window.$chatway.updateChatwayCustomData("Domain",q.activatedDomains[0]))},1e3)},Re=()=>{i.showShopifyCompleteSetupModal=!1,i.ignoreConversationCheck=!1},it=()=>{document.hidden?X(!1):(X(!0),Y.value&&i.getShopifySiteLength&&st.value&&i.isShopifyUser&&s&&E())},tt=()=>{location.reload()};return We(()=>i.user,()=>{if(N.value){const Be={agent_id:N.value.attributes.agent_id,team_id:N.value.attributes.team_id,widget_id:N.value.attributes.widget_id};if(Be.agent_id&&Be.team_id&&!ve.value){_t(),console.log("agent connect payload",Be),$e.emit(Me.AGENT_CONNECT,Be,te=>{ht(te),console.log("%cAgent connected","color:blue; font-size:12px")}),$e.on(Me.CONNECT,()=>{console.log("%cConnected to socket","color:blue; font-size:16px"),ve.value=!0,$e.emit(Me.AGENT_CONNECT,Be,te=>{ht(te),console.log("%cAgent connected","color:blue; font-size:12px")})}),$e.on("connect_error",te=>{console.error("Socket error:",te)}),$e.on(Me.AGENT_CONNECT_ERROR,function(te){console.log("%cAgent connected error","color:blue; font-size:12px",te)}),$e.on(Me.AGENT_CONNECT_SUCCESS,function(te){console.log("%cAgent connected success","color:blue; font-size:12px",te)}),$e.on(Me.DISCONNECT,te=>{ve.value=!1,["ping timeout","transport error","transport close"].includes(te)&&navigator.onLine&&nt.emit("refreshConversations"),console.log(`%cDisconnected ${te} ${new Date}`,"color:red; font-size:16px")}),$e.on(Me.WIDGET_PROFILE_UPDATE,te=>{const{included:Q}=te;if(!Q)return;const Te=Q.find(je=>je.type==="conversation");V({conversationId:Te.id,attributes:Te.attributes})}),$e.on(Me.PAGE_VISITED,te=>{te.conversation_id&&M({conversationId:te.conversation_id,pageVisited:te.page_visited})}),$e.on(Me.CHANGE_ONLINE_STATUS_RECEIVED,te=>{const{attributes:{online_status:Q},id:Te}=te.data;g({agentId:Te,onlineStatus:Q})}),$e.on(Me.CHANGE_CONVERSATION_STATUS_RECEIVED,te=>{if(!te)return;const{data:Q,included:Te}=te,je=Te[0],Ge=c.allConversations.find(Dt=>Dt.id===je.id),mt=je.attributes.is_resolved;if(Ge&&(Ge.attributes.is_resolved=mt),R.value.id){const Dt=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Dt.id})}const wt=Ge==null?void 0:Ge.messages.find(Dt=>Dt.attributes.echo_id===Q.attributes.echo_id);if(Ge!=null&&Ge.messages.length&&wt)return;const $t=Ge==null?void 0:Ge.messages.find(Dt=>Dt.attributes.echo_id===Q.attributes.echo_id);ae({conversationId:je.id,message:Q,tempMessageID:$t==null?void 0:$t.attributes.echo_id,isReceivingMessage:!0}),!c.isTogglingConversationStatus&&k({conversationId:je.id,attributes:je.attributes})}),$e.on(Me.CHANGE_CONVERSATION_ASSIGNEE_RECEIVED,te=>{const{attributes:Q,id:Te,type:je,relationships:Ge}=te.data,mt={attributes:Q,id:Te,type:je},wt={...Q,...te.included[0].attributes};if(Z({conversationId:Ge.conversation.data.id,message:mt}),!c.isAssigningAgent&&(k({conversationId:Ge.conversation.data.id,attributes:wt}),R.value.id)){const $t=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:$t.id})}}),$e.on(Me.WIDGET_MESSAGE_RECEIVED,te=>{var $t,Dt,zt,qt;const{attributes:Q,id:Te,type:je,relationships:{conversation:{data:{id:Ge}}}}=te.data,mt={attributes:{...Q,tempMeta:{content:Q.message_body}},id:Te,type:je},{id:wt}=n.params;if(wt!==Ge||!y.isPageVisible?($e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Ge},os=>{var St;ht(te);const dt=(St=os.conversation.data)==null?void 0:St.attributes;k({conversationId:Ge,attributes:dt})}),y.isPageVisible||(y.pendingUnreadMessage={conversationId:Ge,messageId:te.data.id})):(y.pendingUnreadMessage=null,ce({conversationId:Ge,messageId:te.data.id})),wt===Ge&&(c.messageUnreadCount+=1),((Dt=($t=R.value.attributes)==null?void 0:$t.rules[0])==null?void 0:Dt.conditional_op)==="is_resolved"||((qt=(zt=R.value.attributes)==null?void 0:zt.rules[0])==null?void 0:qt.conditional_op)==="is_unresolved"){const os=c.selectedConversation,dt=te.included[0].attributes.is_resolved;os.attributes.is_resolved=dt,nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:os.id})}Z({conversationId:Ge,message:mt}),J()}),$e.on(Me.AGENT_MESSAGE_RECEIVED,te=>{if(!te)return;const{attributes:Q,id:Te,type:je,relationships:{conversation:{data:{id:Ge}}}}=te.data,mt={attributes:Q,id:Te,type:je},wt=te.included[0].attributes.agents;c.allConversations.forEach(zt=>{var qt,os,dt,St,xs,La;if(zt.id===Ge){if(zt.attributes.agents.length===0&&(((os=(qt=R.value.attributes)==null?void 0:qt.rules[0])==null?void 0:os.conditional_op)==="unassigned"||((St=(dt=R.value.attributes)==null?void 0:dt.rules[0])==null?void 0:St.conditional_op)==="assigned_to"||((La=(xs=R.value.attributes)==null?void 0:xs.rules[0])==null?void 0:La.conditional_op)==="not_assigned_to")){const Ps=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Ps.id})}zt.attributes.agents=wt}});const{id:$t}=n.params;if($t!==Ge||!y.isPageVisible?($e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Ge},zt=>{ht(zt);const qt=zt.conversation.data.attributes;k({conversationId:Ge,attributes:qt})}),y.isPageVisible||(y.pendingUnreadMessage={conversationId:Ge,messageId:te.data.id})):(y.pendingUnreadMessage=null,ce({conversationId:Ge,messageId:te.data.id})),ae({conversationId:Ge,message:mt,isReceivingMessage:!0}),te.data.attributes.message_sender.id!==N.value.attributes.agent_id&&R.value.id){const zt=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:zt.id})}}),$e.on(Me.AGENT_NOTE_UPDATED,te=>{if(ht(te),!te)return;const Q=te.data.id,Te=te.data,je=te.data.attributes.conversation_id;$e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:je},Ge=>{ht(Ge),console.log(`Listen ${Me.AGENT_CONVERSATION_REFRESH}:`,te);const mt=Ge.conversation.data.attributes;k({conversationId:je,attributes:mt});const{id:wt}=n.params;wt==je&&ce({conversationId:je,messageId:Q})}),v({conversationId:je,messageId:Q,data:Te})}),$e.on(Me.AGENT_NOTE_DELETED,te=>{if(ht(te),!te)return;const Q=te.conversation_message_id,Te=te.conversation_id;$e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Te},je=>{ht(je),console.log(`Listen ${Me.AGENT_CONVERSATION_REFRESH}:`,te);const Ge=je.conversation.data.attributes;k({conversationId:Te,attributes:Ge})}),C({conversationId:Te,messageId:Q})}),$e.on(Me.CONVERSATION_CREATE_SUCCESS,async te=>{var Te,je,Ge;console.log(Me.CONVERSATION_CREATE_SUCCESS,te),ht(te),H(te.data),Ae().notificationModalClosed=!1;const{id:Q}=te.data;if($e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Q},mt=>{ht(mt);const wt=mt.conversation.data.attributes;k({conversationId:Q,attributes:wt})}),J(),Ae().enableNotificationModal&&(!((Te=zs().notificationSettings)!=null&&Te.attributes.new_message_when_online)||!((je=zs().notificationSettings)!=null&&je.attributes.new_message_when_offline))){if(!((Ge=N.value)!=null&&Ge.attributes.enable_notification_modal))return;zs().showGlobalNotificationModal=!0}}),$e.on(Me.USER_TYPING_START,te=>{if(te.agent_id===N.value.attributes.agent_id)return;const Te={conversation_id:te.conversation_id,contact_id:te.contact_id,agent_id:te.agent_id,name:te.name,user_type:te.user_type,agent_profile_picture:te.agent_profile_picture};qe(Te)}),$e.on(Me.USER_TYPING_STOP,te=>{const Q={conversation_id:te.conversation_id,contact_id:te.contact_id,agent_id:te.agent_id,name:te.name,user_type:te.user_type,agent_profile_picture:te.agent_profile_picture};Je(Q)}),$e.on(Me.WIDGET_MESSAGE_READ,te=>{if(te.error)return;let Q;const{conversation_id:Te}=te,je=c.allConversations.find(Ge=>Ge.id===Te);je&&(Q=je.messages.findIndex(Ge=>Ge.id===te.message_id),Q===-1&&(Q=je.messages.findIndex(Ge=>{var mt;return Ge.id===((mt=c.latestMessage)==null?void 0:mt.attributes.echo_id)})),je.messages[Q]&&(je.messages[Q].attributes.is_read_by_visitor=!0))});const Ue=(te,Q)=>{const{data:Te,included:je}=te;if(!je){Q!=null&&Q.id&&(c.selectedConversation.attributes.custom_data=[]);return}const Ge=je.filter(dt=>dt.type==="customfield"),mt=T.segmentFields.filter(dt=>dt.field_type==="custom_field"),wt=Ge.filter(dt=>!mt.some(St=>dt.attributes.name===St.name));wt.length&&wt.forEach(dt=>{T.segmentFields.push({name:dt.attributes.name,field_type:"custom_field"})});const $t=[],Dt=Te,zt=w.customFields;Ge.forEach(dt=>{zt.findIndex(St=>St.id===dt.id),$t!==-1&&$t.push(dt)});const qt=[];Dt&&Dt.relationships.customFields.data.length&&$t.length&&Dt.relationships.customFields.data.forEach(dt=>{const St=$t.find(xs=>xs.id===dt.id);St&&qt.push({id:St.id,name:St.attributes.name,value:St.attributes.value})});for(const dt of zt)qt.forEach(St=>{dt.attributes.name===St.name&&(dt.attributes.value=St.value)});Q!=null&&Q.id&&c.selectedConversation.id&&c.selectedConversation.attributes.custom_data&&(c.selectedConversation.attributes.custom_data=qt);const os=qt.filter(dt=>!w.customFields.some(St=>dt.name===St.attributes.name));os.length&&os.forEach(dt=>{w.customFields.push({id:dt.id,type:"customfield",attributes:{name:dt.name,slug:null,type:null,value:dt.value}})})},Ct=(te,Q)=>{const{data:Te,included:je}=te;if(!je){Q!=null&&Q.id&&(c.selectedConversation.attributes.tags=[]);return}const Ge=je.filter(dt=>dt.type==="tag"),mt=T.segmentFields.filter(dt=>dt.field_type==="tag"),wt=Ge.filter(dt=>!mt.some(St=>dt.attributes.name===St.name));wt.length&&wt.forEach(dt=>{T.segmentFields.push({name:dt.attributes.name,field_type:"tag"})});const $t=[],Dt=Te,zt=_.tags;Ge.forEach(dt=>{zt.findIndex(St=>St.id===dt.id),$t!==-1&&$t.push(dt)});const qt=[];Dt&&Dt.relationships.tags.data.length&&$t.length&&Dt.relationships.tags.data.forEach(dt=>{const St=$t.find(xs=>xs.id===dt.id);St&&qt.push({id:St.id,name:St.attributes.name,color:St.attributes.color})}),Q!=null&&Q.id&&c.selectedConversation.id&&c.selectedConversation.attributes.tags&&(c.selectedConversation.attributes.tags=qt);const os=qt.filter(dt=>!_.tags.some(St=>dt.id===St.id));os.length&&os.forEach(dt=>{_.tags.push({id:dt.id,type:"tags",attributes:{name:dt.name,color:dt.color}})})};$e.on(Me.CHAT_CONTACT_UPDATED,te=>{if(R.value.id){const je=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:je.id})}if(te.error)return;let Q=null;const Te=te.data.attributes.conversations.find(je=>je===n.params.id);Q=c.allConversations.find(je=>je.id===Te),Q&&Q.attributes&&(Q.attributes.contact.name=te.data.attributes.name,Q.attributes.contact.email=te.data.attributes.email,Q.attributes.contact.phone=te.data.attributes.phone),Ue(te,Q),Ct(te,Q)}),$e.on(Me.MARKETPLACE_CART_UPDATED,te=>{var Te,je,Ge;const Q=te.marketplace_channel;((Ge=(je=(Te=c.selectedConversation)==null?void 0:Te.attributes)==null?void 0:je.contact)==null?void 0:Ge.id)==te.chat_contact_id&&Q==="SHOPIFY"&&r.updateCartInfo()}),$e.on(Me.MARKETPLACE_ORDER_CREATED,async te=>{var mt,wt,$t,Dt;const Q=te.marketplace_channel,Te=te.marketplace_url,je=te.email,Ge=($t=(wt=(mt=c.selectedConversation)==null?void 0:mt.attributes)==null?void 0:wt.contact)==null?void 0:$t.email;console.log("MARKETPLACE_ORDER_CREATED",te),r.isOriginatedFromShopify&&((Dt=r.marketplaceApp)==null?void 0:Dt.site_host_url)==Te&&je&&je===Ge&&Q==="SHOPIFY"&&(await r.getShopifyCustomerByEmail(Ge),await r.getCustomerOrders())}),$e.on(Me.CHAT_CONTACT_UPDATED_RECEIVED,te=>{if(!te)return;const Q=c.allConversations.find(Te=>Te.id===te.data.attributes.conversations[0]);if(Q&&Q.attributes&&(Q.attributes.contact.name=te.data.attributes.name,Q.attributes.contact.email=te.data.attributes.email,Q.attributes.contact.phone=te.data.attributes.phone),R.value.id){const Te=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Te.id})}}),$e.on(Me.UPDATE_CUSTOM_FIELD_NAME_SUCCESS,te=>{if(te.error)return;if(c.selectedConversation.id){const je=c.selectedConversation.attributes.custom_data.findIndex(Ge=>Ge.name.toLowerCase()===te.custom_field_old_name.toLowerCase());if(je!==-1){const Ge=c.selectedConversation.attributes.custom_data[je];Ge.name=te.custom_field_new_name,c.selectedConversation.attributes.custom_data[je]=Ge}}const Q=w.customFields.findIndex(je=>je.attributes.name.toLowerCase()===te.custom_field_old_name.toLowerCase());w.customFields[Q].attributes.name=te.custom_field_new_name;const Te=T.segmentFields.findIndex(je=>je.name.toLowerCase()===te.custom_field_old_name.toLowerCase());if(T.segmentFields[Te]={name:te.custom_field_new_name,field_type:"custom_field"},R.value.id){const je=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:je.id})}}),$e.on(Me.UPDATE_CUSTOM_FIELD_VALUE_SUCCESS,te=>{if(te.error)return;const Q=c.selectedConversation.attributes.custom_data.findIndex(Te=>Te.name.toLowerCase()===te.custom_field_name.toLowerCase());if(Q!==-1&&c.selectedConversation.attributes.custom_data[Q].value.toLowerCase()===te.custom_field_old_value.toLowerCase()){const Te=c.selectedConversation.attributes.custom_data[Q];Te.value=te.custom_field_value,c.selectedConversation.attributes.custom_data[Q]=Te}if(R.value.id){const Te=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Te.id})}}),$e.on(Me.DELETE_CUSTOM_FIELD_FOR_ALL_CONTACT_SUCCESS,te=>{if(te.error)return;c.selectedConversation.id&&(c.selectedConversation.attributes.custom_data=c.selectedConversation.attributes.custom_data.filter(Te=>Te.name.toLowerCase()!==te.custom_field_name.toLowerCase())),w.customFields=w.customFields.filter(Te=>Te.attributes.name.toLowerCase()!==te.custom_field_name.toLowerCase()),T.segmentFields=T.segmentFields.filter(Te=>Te.name.toLowerCase()!==te.custom_field_name.toLowerCase()),c.allConversations.map(Te=>Te.id).forEach(Te=>{R.value.id&&nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Te})})}),$e.on(Me.UPDATE_TAG_SUCCESS,te=>{if(te.error)return;if(c.selectedConversation.id){const je=c.selectedConversation.attributes.tags.findIndex(Ge=>Ge.name.toLowerCase()===te.old_name.toLowerCase());je!==-1&&(c.selectedConversation.attributes.tags[je]={id:te.tag.data.id,name:te.tag.data.attributes.name,color:te.tag.data.attributes.color})}if(R.value.id){const je=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:je.id})}const Q=_.tags.findIndex(je=>je.attributes.name.toLowerCase()===te.old_name.toLowerCase());_.tags[Q]={id:te.tag.data.id,type:"tags",attributes:{name:te.tag.data.attributes.name,color:te.tag.data.attributes.color}};const Te=T.segmentFields.findIndex(je=>je.name.toLowerCase()===te.old_name.toLowerCase());T.segmentFields[Te]={name:te.tag.data.attributes.name,field_type:"tag"}}),$e.on(Me.DELETE_TAG_FOR_ALL_CONTACT,te=>{if(console.log(`Listen ${Me.DELETE_TAG_FOR_ALL_CONTACT}:`,te),te.error)return;c.selectedConversation.id&&(c.selectedConversation.attributes.tags=c.selectedConversation.attributes.tags.filter(Te=>Te.name.toLowerCase()!==te.name.toLowerCase())),_.tags=_.tags.filter(Te=>Te.attributes.name.toLowerCase()!==te.name.toLowerCase()),T.segmentFields=T.segmentFields.filter(Te=>Te.name.toLowerCase()!==te.name.toLowerCase()),c.allConversations.map(Te=>Te.id).forEach(Te=>{R.value.id&&nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:Te})})}),$e.on(Me.CHANGE_CONVERSATION_STATUS_TRIGGERED,te=>{var wt;console.log(te,Me.CHANGE_CONVERSATION_STATUS_TRIGGERED);const{data:Q,included:Te,conversation_id:je}=te,Ge=Te[0],mt=c.allConversations.find($t=>$t.id===je);mt!=null&&mt.messages.length&&((wt=mt==null?void 0:mt.messages[(mt==null?void 0:mt.messages.length)-1])==null?void 0:wt.id)===je||(ae({conversationId:je,message:Q,isReceivingMessage:!0}),k({conversationId:je,attributes:Ge.attributes}))}),$e.on(Me.AGENT_CONVERSATION_VIEWING_STOPPED_ALL_RECEIVE,te=>{var Te;if(console.log(`Listen ${Me.AGENT_CONVERSATION_VIEWING_STOPPED_ALL_RECEIVE}:`,te),te.error)return;const{data:Q}=te;((Te=N.value)==null?void 0:Te.attributes.agent_id)!=Q.attributes.agent_id&&j(Q.attributes)}),$e.on(Me.AGENT_CONVERSATION_VIEWING_RECEIVED,te=>{var Te;if(te.error)return;const{data:Q}=te;((Te=N.value)==null?void 0:Te.attributes.agent_id)!=Q.attributes.agent_id&&x(Q.attributes)}),$e.on(Me.AGENT_CONVERSATION_VIEWING_STOPPED_RECEIVED,te=>{var Te;if(te.error)return;const{data:Q}=te;((Te=N.value)==null?void 0:Te.attributes.agent_id)!=Q.attributes.agent_id&&P(Q.attributes)}),$e.on(Me.NEW_SEGMENT,te=>{te.error||T.segments.push(te.data)}),$e.on(Me.SEGMENT_DATA_UPDATED,te=>{if(te.error)return;const Q=T.segments.findIndex(Te=>Te.id===te.data.id);T.segments[Q]=te.data}),$e.on(Me.AGENT_CONVERSATION_DELETED_RECEIVED,te=>{const Q=te.conversation_id,Te=ct().allConversations.findIndex(je=>je.id===Q);ct().allConversations.splice(Te,1)}),$e.on(Me.SEGMENT_DATA_DELETED,te=>{te.error||(T.segments=T.segments.filter(Q=>Q.id!==te.segment_id))}),$e.on(Me.FIRST_VISITOR_EMAIL_UPDATED,te=>{te.error||(S(!0),l.push({name:"conversations-view",params:{id:te.conversation_id}}))}),$e.on(Me.SUBSCRIPTION_UPDATES,()=>{B({isSecondCall:!0})}),$e.on(Me.CANNED_RESPONSE_CREATED_SUCCESS,te=>{if(!te.error)if(te.data.attributes.folder){u.cannedResponseFolders.push({id:te.data.relationships.folder.data.id,name:te.data.attributes.folder,canned_response_count:0,items:[],team_id:"",agent_id:"",created_at:"",updated_at:"",shortcut:[],order_id:0});const Q=u.cannedResponseFolders.findIndex(Te=>Te.name===te.data.attributes.folder);Q!==-1&&(u.cannedResponseFolders[Q].items&&u.cannedResponseFolders[Q].items.push(te.data),u.cannedResponseFolders[Q].canned_response_count=te.included[0].attributes.canned_response_count)}else u.cannedResponses.push(te.data)}),$e.on(Me.CANNED_RESPONSE_UPDATED_SUCCESS,te=>{var Te;if(te.error)return;const Q=u.cannedResponses.findIndex(je=>je.id===te.data.id);if(u.cannedResponses[Q]=te.data,te.data.attributes.folder){const je=u.cannedResponseFolders.findIndex(Ge=>Ge.name===te.data.attributes.folder);if(je!==-1){const Ge=(Te=u.cannedResponseFolders[je].items)==null?void 0:Te.findIndex(mt=>mt.id===te.data.id);u.cannedResponseFolders[je].items[Ge]=te.data}}}),$e.on(Me.CANNED_RESPONSE_FOLDER_UPDATED_SUCCESS,te=>{te.error||(u.cannedResponseFolders=u.cannedResponseFolders.map(Q=>Q.id===te.data.id?{...Q,name:te.data.attributes.name,shortcut:te.data.attributes.shortcut}:Q))}),$e.on(Me.CANNED_RESPONSE_FOLDER_DELETED_SUCCESS,te=>{u.cannedResponseFolders=u.cannedResponseFolders.filter(Q=>Q.id!==te.data.attributes.canned_response_folder_id)}),$e.on(Me.SUBSCRIPTION_UPDATES,()=>{B({isSecondCall:!0})}),$e.on(Me.CANNED_RESPONSE_DELETED_SUCCESS,te=>{if(!te.error&&(u.cannedResponses=u.cannedResponses.filter(Q=>Q.id!==te.data.attributes.canned_response_id),te.data.attributes.folder_name)){u.cannedResponseFolders.forEach(Te=>{Te.name===te.data.attributes.folder_name&&Te.items&&(Te.items=Te.items.filter(je=>je.id!==te.data.attributes.canned_response_id))});const Q=u.cannedResponseFolders.findIndex(Te=>Te.name===te.data.attributes.folder_name);Q!==-1&&(u.cannedResponseFolders[Q].canned_response_count=te.data.attributes.folder_canned_responses_count)}}),$e.on(Me.AGENT_STATUS_UPDATED_RECEIVED,te=>{if(!te||te!=null&&te.error)return;const Q=te.data.id,Te=ys().agents;ys().agents=Te.map(je=>je.id===Q?{...je,attributes:{...je.attributes,...te.data.attributes}}:je)}),$e.on(Me.UPDATE_AGENT_SUCCESS,te=>{var je,Ge,mt;if(!te||te.error)return;const Q=te.data.id,Te=ys().agents;if(ys().agents=Te.map(wt=>wt.id===Q?{...wt,attributes:{...wt.attributes,...te.data.attributes}}:wt),((je=Ae().user)==null?void 0:je.attributes.agent_id)===Q){const wt=(mt=(Ge=Ae())==null?void 0:Ge.user)==null?void 0:mt.attributes,$t=wt==null?void 0:wt.role;wt&&(Ae().user.attributes={...Ae().user.attributes,...te.data.attributes},$t!==te.data.attributes.role&&(window.location.href="/"))}}),$e.on(Me.AGENT_REMINDER_TRIGGERED,te=>{if(te.error)return;const Q=te.message.data.attributes.conversation_id,Te=c.allConversations.find(Ge=>Ge.id===Q),{id:je}=n.params;if(Te)if(je!==Q)$e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Q},Ge=>{ht(Be);const mt={...Ge.conversation.data.attributes,has_unread_reminders:!0};k({conversationId:Q,attributes:mt}),J()});else{const Ge={...te.message.data},mt=te.message.data.id;A({conversationId:Q,messageId:mt,data:Ge}),J()}}),$e.on(Me.AGENT_REMINDER_RECEIVED,te=>{if(!te)return;const{attributes:Q,id:Te,type:je,relationships:{conversation:{data:{id:Ge}}}}=te.data,mt={attributes:Q,id:Te,type:je},{id:wt}=n.params;if(wt!==Ge||!y.isPageVisible?($e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Ge},$t=>{ht($t);const Dt=$t.conversation.data.attributes;k({conversationId:Ge,attributes:Dt})}),y.isPageVisible||(y.pendingUnreadMessage={conversationId:Ge,messageId:te.data.id})):y.pendingUnreadMessage=null,ae({conversationId:Ge,message:mt,isReceivingMessage:!0}),R.value.id){const $t=c.selectedConversation;nt.emit("fetchSegmentConversation",{segmentId:R.value.id,conversationId:$t.id})}}),$e.on(Me.AGENT_REMINDER_UPDATED,te=>{if(ht(te),!te)return;const Q=te.data.id,Te=te.data,je=te.data.attributes.conversation_id;$e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:je},Ge=>{ht(Ge);const mt=Ge.conversation.data.attributes;k({conversationId:je,attributes:mt})}),A({conversationId:je,messageId:Q,data:Te})}),$e.on(Me.AGENT_REMINDER_DELETED,te=>{if(ht(te),!te)return;const Q=te.conversation_message_id,Te=te.conversation_id;$e.emit(Me.AGENT_CONVERSATION_REFRESH,{conversation_id:Te},je=>{ht(je);const Ge=je.conversation.data.attributes;k({conversationId:Te,attributes:Ge})}),D({conversationId:Te,messageId:Q})}),$e.on(Me.SHOW_RATING_MODAL,te=>{ht(te),te&&(console.log(Me.SHOW_RATING_MODAL,te),i.isShowRatingPopup=te.show_rating_popup,i.isFirstResolvedConversation=te.is_first_resolved_conversation)})}}},{deep:!0}),We(()=>n.path,()=>{c.unreadMessageCount&&setTimeout(()=>{const Be=`(${c.unreadMessageCount} unread)`;Ta({title:Be})},1e3)}),We(()=>q.allInstallationPlatform,()=>{i.getShopifySiteLength&&E()}),We(()=>n.path,()=>{!n.path.includes("conversations")&&i.openInstallationTooltip&&(i.openInstallationTooltip=!1)}),We(()=>[Fe.value,st.value,i.isShopifyRibbonVisible],()=>{st.value&&!i.showShopifyCompleteSetupModal&&i.isShopifyRibbonVisible&&Fe.value&&!oe.value?document.documentElement.style.setProperty("--page-container","95vh"):document.documentElement.style.setProperty("--page-container","100%")}),We(()=>n.path,()=>{var Be,at;se.value?(Be=window.$chatway)==null||Be.showChatwayIcon():(at=window.$chatway)==null||at.hideChatwayIcon()}),We([()=>{var Be;return(Be=i.user)==null?void 0:Be.id},()=>{var Be;return(Be=i.user)==null?void 0:Be.attributes.email}],()=>{i.user&&(clarity("set","user_id",N.value.id),clarity("set","user_email",N.value.attributes.email),clarity("identify",N.value.id,"","",N.value.attributes.email))}),Xe(()=>{setTimeout(()=>{ft()},1),document.addEventListener("click",pe,{once:!0}),window.addEventListener("load",Ve),document.addEventListener("visibilitychange",it),window.addEventListener("online",tt);const Be=setInterval(()=>{var Ue;document.getElementsByClassName("chatway--container").length&&(se.value||(Ue=window.$chatway)==null||Ue.hideChatwayIcon(),clearInterval(Be))},50)}),ps(()=>{de(),document.removeEventListener("visibilitychange",it),window.removeEventListener("load",Ve),window.removeEventListener("online",tt)}),(Be,at)=>(a(),d(Se,null,[le.value?(a(),ne(j_,{key:0})):h("",!0),oe.value?(a(),d("div",M0,at[4]||(at[4]=[e("div",{class:"loading"},null,-1)]))):h("",!0),W(p(Br),{class:"h-screen"}),ie.value?(a(),ne(Yp,{key:2,showModal:ie.value,onClose:at[0]||(at[0]=Ue=>p(T).showEditSegmentModal=!1)},null,8,["showModal"])):h("",!0),xe.value?(a(),ne(Zm,{key:3,showModal:xe.value,onClose:at[1]||(at[1]=Ue=>p(T).showAddSegmentModal=!1)},null,8,["showModal"])):h("",!0),W(Xp),W(wv),L.value?(a(),ne(Fv,{key:4,showModal:L.value,onCloseModal:at[2]||(at[2]=Ue=>p(i).isDeactivated=!1)},null,8,["showModal"])):h("",!0),G.value?(a(),ne(Lv,{key:5})):h("",!0),me.value?(a(),ne(Rv,{key:6})):h("",!0),U.value?(a(),ne(o_,{key:7,showModal:U.value,onCloseModal:at[3]||(at[3]=Ue=>p(f).showUpdateAgentModal=!1)},null,8,["showModal"])):h("",!0),W(i_,{showModal:ee.value},null,8,["showModal"]),W(r_),ye.value?(a(),ne(G_,{key:8,showExistingUserTrialNotificationModal:ye.value},null,8,["showExistingUserTrialNotificationModal"])):h("",!0),W(I_,{showModal:Le.value,onClose:Re},null,8,["showModal"]),Ie.value?(a(),ne(L_,{key:9,showModal:Ie.value},null,8,["showModal"])):h("",!0),W(l0,{showDownloadAppPrompt:re.value,isIos:be.value.isIOS},null,8,["showDownloadAppPrompt","isIos"]),W(Ou)],64))}});const D0="modulepreload",I0=function(o){return"/"+o},Ii={},gt=function(s,t,n){if(!t||t.length===0)return s();const l=document.getElementsByTagName("link");return Promise.all(t.map(i=>{if(i=I0(i),i in Ii)return;Ii[i]=!0;const m=i.endsWith(".css"),r=m?'[rel="stylesheet"]':"";if(!!n)for(let y=l.length-1;y>=0;y--){const c=l[y];if(c.href===i&&(!m||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${r}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":D0,m||(g.as="script",g.crossOrigin=""),g.href=i,document.head.appendChild(g),m)return new Promise((y,c)=>{g.addEventListener("load",y),g.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>s())},F0=fe({__name:"index",setup(o){const s=At();return localStorage.removeItem("vue-svg-inline-plugin:2.2.0"),Xe(()=>{(Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt()))?s.push({path:"/conversations"}):s.push({path:"/login"})}),(t,n)=>(a(),d("div"))}}),jn="/assets/chevron-left-white-e6a7c6c3.svg",P0={class:"relative"},j0={class:"flex flex-col justify-between sm:p-6 h-screen custom-scroll overflow-y-auto sm:bg-grey100 sm:bg-[url('@/assets/images/bg-md.svg')] lg:bg-[url('@/assets/images/bg-lg.svg')] 2xl:bg-[url('@/assets/images/bg-xl.svg')] bg-no-repeat bg-center bg-cover"},L0={key:1,class:"inline-flex items-center gap-1 bg-white/10 pl-2 pr-4 py-1.5 rounded-full",href:"https://chatway.app",target:"_blank"},R0={class:"relative z-10 flex flex-1 flex-col sm:justify-center"},B0=["src"],N0=["src"],O0=fe({__name:"auth",setup(o){const s=Ae(),{height:t,width:n}=Ht(),l=window.location!==window.parent.location&&s.isLoadedOnShopifyDashboard,i=async()=>{if(s.isLoadedOnShopifyDashboard&&l){const m=window["app-bridge"].actions.Redirect.create(window.shopifyBridgeApp),r=Date.now().toString(36)+Math.random().toString(36).substring(2);await m.dispatch(window["app-bridge"].actions.Redirect.Action.APP,`/shopify/oauth/overview?chRefresh=${r}`)}};return(m,r)=>{const u=Pe("router-view");return a(),d("div",P0,[e("div",j0,[e("div",{class:O(["hidden lg:block absolute top-6 left-6 z-[9999]",[{"!hidden":p(t)<525&&p(l)||p(n)<770&&p(l)}]])},[p(l)?(a(),d("a",{key:0,class:"inline-flex items-center gap-1 bg-white/10 pl-2 pr-4 py-1.5 rounded-full",href:"#",onClick:i},r[0]||(r[0]=[e("img",{src:jn,alt:"",width:"20",height:"20",loading:"lazy"},null,-1),e("span",{class:"font-normal text-sm text-white pt-px"},"Back to Sign Up",-1)]))):(a(),d("a",L0,r[1]||(r[1]=[e("img",{src:jn,alt:"",width:"20",height:"20",loading:"lazy"},null,-1),e("span",{class:"font-normal text-sm text-white pt-px"},"Chatway website",-1)])))],2),e("div",R0,[W(u,null,{default:K(({Component:g})=>[W(ms,{name:"scale",mode:"out-in"},{default:K(()=>[(a(),ne(Nr(g)))]),_:2},1024)]),_:1})]),r[2]||(r[2]=e("div",{class:"hidden md:block w-full text-center"},[e("label",{class:"text-xs font-normal text-grey100 text-center"},[_e(" By signing up, you agree to our "),e("a",{class:"hover:underline text-xs text-grey100",href:"https://chatway.app/terms-of-service/",target:"_blank"},"Terms Of Use"),_e(" and "),e("a",{class:"hover:underline text-xs text-grey100",href:"https://chatway.app/privacy-policy/",target:"_blank"},"Privacy Policy")])],-1)),e("img",{src:`${p(De)}images/bg-shape-top.svg`,class:"hidden lg:block absolute top-0 left-0",width:"406",height:"163",loading:"lazy",alt:"shape"},null,8,B0),e("img",{src:`${p(De)}images/bg-shape-bottom.svg`,class:O(["hidden lg:block absolute bottom-0",p(t)>670?"right-0":"right-2"]),width:"239",height:"206",loading:"lazy",alt:"shape bottom"},null,10,N0)])])}}});const V0=Oe(O0,[["__scopeId","data-v-93184089"]]),El="/assets/logo-806c6bfe.svg",U0="/assets/dashboard-34c1f8cb.svg",G0="/assets/users-491dbb47.svg",W0="/assets/bar-b83903fd.svg",q0="/assets/more-b3249cb6.svg",Yn="/assets/alert-with-bg-3b683e21.svg",Dl="/assets/close-38a538e9.svg",Zn="/assets/chevron-right-white-2b553dce.svg",H0="/assets/support-3fc34d9c.svg",z0="/assets/settings-a33e53fe.svg",K0="/assets/crown-349fe7db.svg",Y0=["src","alt"],Z0=fe({__name:"ProfileThumbnail",props:{userName:{default:""},size:{default:"32px"},src:{default:""},fontSize:{default:"12px"},showStatus:{type:Boolean,default:!1},availabilityStatus:{type:Boolean,default:!1},enableBorder:{type:Boolean,default:!1},enableBorderForStatus:{type:Boolean,default:!1},color:{default:"#F69D01"}},setup(o){const s=o,t=b(()=>Wa(s.userName));return(n,l)=>(a(),d("div",{class:O(["thumbnail-wrap",`${n.availabilityStatus?"border-online":"border-offline"}`]),key:n.userName},[n.src?(a(),d("div",{key:0,class:O(["thumbnail2",`${n.availabilityStatus?"":"blackOverlay"}`])},[e("img",{class:"thumbnail-img",src:n.src,alt:n.userName},null,8,Y0)],2)):(a(),d("div",{key:1,class:O(["thumbnail2",`${n.availabilityStatus?"":"blackOverlay"}`])},[e("span",null,I(t.value),1)],2)),n.showStatus?(a(),d("span",{key:2,class:O(["status",{offline:!n.availabilityStatus,border:n.enableBorderForStatus,"small-size":!n.enableBorderForStatus}])},null,2)):h("",!0)],2))}});const J0=Oe(Z0,[["__scopeId","data-v-2a49009c"]]),Q0="/assets/resume-27a6a559.svg",X0="/assets/code-0df644c6.svg",ey="/assets/integration-487d00a2.svg",Il="/assets/mobile-app-d512c87a.svg",Fl="/assets/chevron-right-black-493d5495.svg",ty="/assets/logout-a32e203d.svg",sy={class:"dropdown--wrapper"},ay={class:"dropdown-header"},oy={class:"user-details--wrap"},ny={class:"user-name overflow-hidden w-[168px] text-ellipsis"},iy={class:"email"},ly={class:"tag-info"},ry={class:"sender"},dy={class:"sender"},uy={class:"status-toggle"},cy={class:"options"},my={src:Q0,alt:""},gy={src:X0,alt:""},py={src:ey,alt:""},vy={src:Il,alt:""},fy={src:Ml,alt:""},hy={class:"ml-auto",src:Fl,alt:""},_y={src:ty,alt:""},yy=fe({__name:"ProfileDropdown",props:{currentUser:{default:void 0}},emits:["close"],setup(o,{emit:s}){const{isOwnerOrAdmin:t}=Xt(),n=Ae(),l=At(),{updateUserStatus:i,logout:m,setProductTourSkiped:r,skipProductTour:u}=Zt(),{addDemoConversation:g}=ss(),{isSmallScreen:y}=hs(),c=ct(),w=s,f=o,v=$(!1),C=b(()=>f.currentUser&&f.currentUser.attributes.online_status==="online"),_=b(()=>n.isMarketPlace),A=k=>{i(k?"online":"offline")},D=b(()=>f.currentUser&&f.currentUser.attributes.name),T=b(()=>f.currentUser&&f.currentUser.attributes.email),B=b(()=>f.currentUser&&f.currentUser.attributes.profile_photo_url),S=b(()=>window.location!==window.parent.location),E=()=>{if(document.querySelector('script[src*="//cdn.headwayapp.co/widget.js"]'))return;v.value=!0;let M=document.createElement("script");M.setAttribute("src","//cdn.headwayapp.co/widget.js"),M.defer=!0,document.head.appendChild(M),M.onload=()=>{const V={selector:".whats-new",account:"JnEe07"};Headway.init(V),v.value=!1}},x=()=>{if(v.value)return;const k=document.querySelector("#HW_frame_cont"),M=document.querySelector("#HW_badge_cont"),V=document.querySelector("#HW_badge");k&&(k.classList.contains("HW_visible")?k.classList.remove("HW_visible"):(M&&M.click(),V&&V.click(),k.classList.add("HW_visible")))},P=k=>{l.push(k),w("close")},j=async()=>{var k,M;$e.emit(Me.AGENT_CONVERSATION_VIEWING_STOPPED_ALL_SENT,{team_id:(k=n.user)==null?void 0:k.attributes.team_id},V=>{ht(V)}),window.parent&&window.parent.postMessage&&window.parent.postMessage("chatway/logout_from_iframe","*"),(M=navigator.serviceWorker)==null||M.getRegistrations().then(function(V){for(let Z of V)Z.unregister()}),await m(),new Aa().logout(),l.push("/login")},H=()=>{n.isProductTourSkiped&&u(),r(!1),c.allConversations.length||g(),l.push({name:"conversations-view",params:{id:c.allConversations[0].id}}),w("close")};return Xe(()=>E()),ps(()=>{var M;(M=document.querySelector("#HW_frame_cont").classList)==null||M.remove("HW_visible")}),(k,M)=>{const V=Pe("Thumbnail"),Z=Pe("router-link"),ae=Pe("VDropdown"),ce=Pe("ToggleSwitch"),J=He("svg-inline");return a(),d("div",sy,[e("div",ay,[W(Z,{to:"/profile"},{default:K(()=>[W(V,{"user-name":D.value,"enable-border":!0,src:B.value,size:"32px","font-size":"10px"},null,8,["user-name","src"])]),_:1}),W(ae,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>[e("div",ly,[e("div",ry,I(D.value),1),e("div",dy,I(T.value),1)])]),default:K(()=>[e("div",oy,[e("span",ny,I(D.value),1),e("span",iy,I(T.value),1)])]),_:1})]),e("div",uy,[e("span",null,I(C.value?"You are online":"You are offline"),1),W(ce,{value:C.value,isAvailabilityToggle:"",size:"small",onInput:A},null,8,["value"])]),e("div",cy,[!p(n).isProductTourCompleted&&!p(y)?(a(),d("div",{key:0,class:"option-item",onClick:H},[F(e("img",my,null,512),[[J]]),M[3]||(M[3]=e("span",null,"Resume product tour",-1))])):h("",!0),p(t)&&!_.value?(a(),d("div",{key:1,class:"option-item",onClick:M[0]||(M[0]=X=>P("/installation"))},[F(e("img",gy,null,512),[[J]]),M[4]||(M[4]=e("span",null,"Installation",-1))])):h("",!0),p(t)?(a(),d("div",{key:2,class:"option-item",onClick:M[1]||(M[1]=X=>P("/integrations"))},[F(e("img",py,null,512),[[J]]),M[5]||(M[5]=e("span",null,"Integrations & Apps",-1))])):(a(),d("div",{key:3,class:"option-item",onClick:M[2]||(M[2]=X=>P("/mobile-apps"))},[F(e("img",vy,null,512),[[J]]),M[6]||(M[6]=e("span",null,"Mobile Apps",-1))])),e("div",{class:O(["option-item relative select-none whats-new",{"opacity-50":v.value}]),onClick:x},[F(e("img",fy,null,512),[[J]]),M[7]||(M[7]=e("span",null,"What’s new",-1)),F(e("img",hy,null,512),[[J]])],2)]),S.value?h("",!0):(a(),d("div",{key:0,class:"dropdown-footer",onClick:j},[F(e("img",_y,null,512),[[J]]),M[8]||(M[8]=e("span",null,"Logout",-1))]))])}}});const by=Oe(yy,[["__scopeId","data-v-df73b6f7"]]),wy={class:"relative z-[500]"},xy={class:"bg-primary px-2 pb-2 rounded-lg"},Cy={class:"flex flex-col items-center gap-1 pb-[1.12rem]"},ky=["src"],$y={class:"px-2"},Sy={class:"text-sm text-white font-semibold leading-leading400 mb-3"},Ty={class:"flex items-center gap-[0.63rem] mb-5"},My={class:"m-0 text-sm text-left text-white leading-leading400"},Ay={class:"bg-[#F3F9FF] bg-opacity-30 flex items-center px-0.5 w-[302.2px] h-2.5 border-[#e5e7eb] rounded-[40px]"},Ey={class:"text-xs text-white text-center"},Ea=fe({__name:"UpgradeNowPopup",emits:["showOwnerAccessRequired"],setup(o,{emit:s}){const t=At(),n=Ae(),l=ts(),{isAgent:i}=Xt(),m=s,r=["Multiple agents","Unlimited chat history","Email integration","Private notes & reminders","Live translation & multilingual widget","Custom data, tags and segments"],u=b(()=>n.trialDaysLeft),g=b(()=>n.hasTrial),y=b(()=>Math.min(u.value/14*100,100).toFixed(2)),c=b(()=>u.value===14?"Enjoy 14-day free trial of Pro":u.value===-1?"Free trial has ended!":`Only ${u.value} day${u.value>1?"s":""} left on the free trial`),w=()=>{if(Yi(),i){m("showOwnerAccessRequired");return}l.isChangePlan=!1,l.showProPlan=!1,t.push({name:"settings-plans-view"})};return(f,v)=>(a(),d("div",wy,[e("div",xy,[e("div",Cy,[e("img",{class:"h-[12.31rem]",src:`${p(De)}images/upgrade-rocket.svg`,alt:"icon"},null,8,ky)]),e("div",$y,[e("h3",Sy,I(g.value?"You are currently on a 14-day free trial of the Pro plan, with access to:":"You are currently on a free plan. Upgrade to Pro and get access to:"),1),(a(),d(Se,null,Ne(r,C=>e("div",{key:C},[e("div",Ty,[v[0]||(v[0]=e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("rect",{width:"20",height:"20",rx:"10",fill:"white","fill-opacity":"0.12"}),e("path",{d:"M15.3332 6L7.99984 13.3333L4.6665 10",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),e("p",My,I(C),1)])])),64)),e("button",{class:"w-full h-10 py-[0.5625rem] px-3 flex gap-1 items-center justify-center bg-white text-base text-grey900 mb-2 font-semibold leading-leading400",onClick:w},"Upgrade now"),e("div",Ay,[e("div",{class:"bg-[#FFF] rounded-[32px] h-1.5",style:lt({width:`${u.value===14?"100%":`${y.value}%`}`})},null,4)]),e("p",Ey,I(c.value),1)])])]))}}),So="/assets/message-circle-default-4e604fe6.svg",Dy="/assets/question-mark-da5492db.svg",Iy={class:"w-[18rem] h-auto absolute z-[99] left-1 bottom-11 bg-white rounded-lg shadow-[0px_24px_48px_-4.875px_rgba(40,45,62,0.48)]"},Fy={class:"w-5 h-5 text-grey600",src:So,alt:""},Py={class:"w-5 h-5 text-grey600",src:Dy,alt:""},jy=fe({__name:"SupportDropdown",emits:["close"],setup(o,{emit:s}){const t=s,n=()=>{var i;t("close"),(i=window.$chatway)==null||i.openChatwayWidget()},l=()=>{t("close"),window.open("https://chatway.app/help?utm_source=chatwaydashboard","_blank")};return(i,m)=>{const r=He("svg-inline");return a(),d("div",Iy,[e("div",{class:"flex items-center gap-2 p-4 cursor-pointer hover:bg-[#F6F6F8] hover:rounded-t-lg",onClick:n},[F(e("img",Fy,null,512),[[r]]),m[0]||(m[0]=e("span",{class:"text-grey900 text-sm leading-leading400"},"Live chat with our support team",-1))]),m[2]||(m[2]=e("div",{class:"h-px bg-grey200"},null,-1)),e("div",{class:"flex items-center gap-2 p-4 cursor-pointer hover:bg-[#F6F6F8] hover:rounded-b-lg",onClick:l},[F(e("img",Py,null,512),[[r]]),m[1]||(m[1]=e("span",{class:"text-grey900 text-sm leading-leading400"},"Help center",-1))])])}}}),Ly="/assets/bar-gray-4530fd71.svg",Ry={class:"w-[18rem] h-auto absolute z-[99] left-12 top-0 bg-white rounded-lg shadow-[0px_24px_48px_-4.875px_rgba(40,45,62,0.48)]"},By={class:"w-5 h-5 text-grey600",src:Ly,alt:"overview"},Ny={class:"w-5 h-5 text-grey600",src:So,alt:""},Oy={class:"w-5 h-5 text-grey600",src:Al,alt:"Help canter"},Vy=fe({__name:"MoreItemDropdown",emits:["close"],setup(o,{emit:s}){const t=s,n=At(),l=()=>{t("close")},i=()=>{var u;l(),(u=window.$chatway)==null||u.openChatwayWidget()},m=()=>{l(),n.push("/overview")},r=()=>{l(),window.open("https://chatway.app/help?utm_source=chatwaydashboard","_blank")};return(u,g)=>{const y=He("svg-inline");return a(),d("div",Ry,[e("div",{class:"flex items-center gap-2 p-4 cursor-pointer hover:bg-[#F6F6F8] hover:rounded-t-lg",onClick:m},[F(e("img",By,null,512),[[y]]),g[0]||(g[0]=e("span",{class:"text-grey900 text-sm leading-leading400"},"Overview",-1))]),g[3]||(g[3]=e("div",{class:"h-px bg-grey200"},null,-1)),e("div",{class:"flex items-center gap-2 p-4 cursor-pointer hover:bg-[#F6F6F8] hover:rounded-t-lg",onClick:i},[F(e("img",Ny,null,512),[[y]]),g[1]||(g[1]=e("span",{class:"text-grey900 text-sm leading-leading400"},"Live chat with our support team",-1))]),g[4]||(g[4]=e("div",{class:"h-px bg-grey200"},null,-1)),e("div",{class:"flex items-center gap-2 p-4 cursor-pointer hover:bg-[#F6F6F8] hover:rounded-b-lg",onClick:r},[F(e("img",Oy,null,512),[[y]]),g[2]||(g[2]=e("span",{class:"text-grey900 text-sm leading-leading400"},"Help center",-1))])])}}}),Uy={class:"primary--sidebar"},Gy={class:"global-nav"},Wy={key:0},qy={class:"global-nav__list"},Hy={class:"flex flex-col items-center"},zy={src:U0,alt:""},Ky={src:G0,alt:""},Yy={src:W0,alt:""},Zy={key:1,class:"relative"},Jy={class:"icon",src:q0,alt:""},Qy={class:"flex flex-col gap-4 justify-center items-center"},Xy={class:"w-[18.3125rem] p-3 relative"},e1={class:"cursor-pointer block stroke-grey900 absolute top-[5px] right-[5px]",src:Dl},t1={key:1,class:"relative"},s1={class:"icon",src:H0,alt:""},a1={src:$o,alt:""},o1={class:"icon",src:z0,alt:""},n1={key:3,class:"relative"},i1={class:"w-[20.875rem]"},l1={class:"profile-view"},r1=fe({__name:"PrimarySidebar",setup(o){const{isOwnerOrAdmin:s}=Xt(),{height:t}=Ht(),n=ls(),l=At(),i=Ae(),m=ct(),r=ts(),u=$(!1),g=$(!1),y=$(!1),c=$(!1),w=$(""),f=$(!1),v=b(()=>n.name==="conversations-view"),C=b(()=>i.user),_=b(()=>C.value&&C.value.attributes.name),A=b(()=>C.value&&C.value.attributes.profile_photo_url),D=b(()=>window!==window.parent&&i.marketPlaceName!=="duda"),T=b(()=>i.isProUser),B=b(()=>i.allShopifyWithEmbeddedStatus.some(J=>!J.attributes.is_embedded_app_enabled)),S=b(()=>sessionStorage.getItem("ch_show_installation_tooltip")&&i.openInstallationTooltip&&!i.isProductTourRunning&&!i.showSkipTourModal||!1),E=b(()=>t.value<520),x=()=>{u.value=!u.value},P=()=>{g.value=!g.value},j=()=>{f.value=!f.value},H=()=>{r.isChangePlan=!1,r.showProPlan=!1,u.value=!1,g.value=!1,f.value=!1},k=J=>{r.isChangePlan=!1,r.showProPlan=!1,l.push(J)},M=b(()=>["/design","/profile","/agents","/plans","/installation","/notifications","/integrations","/keyboard-shortcuts"].includes(n.path)),V=async()=>{if(!i.shopifyStore)return;const J={params:{shop:i.shopifyStore}};try{const{data:X}=await new ns().getAccessUrl(J);i.shopifyEndpoint=X.attributes.endpoint,w.value=`${window.location.origin}/conversations?marketplace=1&endpoint=${X.attributes.endpoint}`}catch(X){Ze(X)}},Z=async()=>{if(i.isLoadedOnShopifyDashboard){window.open(w.value,"_blank");return}window.open(`${window.location.origin}/fullscreen`,"_blank")},ae=()=>{ce(),l.push({name:"settings-code-view",query:{platform:"shopify"}})},ce=()=>{Yi(),i.openInstallationTooltip=!1,sessionStorage.removeItem("ch_show_installation_tooltip")};return Xe(async()=>{window!==window.parent&&i.isLoadedOnShopifyDashboard&&await V(),nt.on("openKeyboardShortcut",()=>{l.push("/keyboard-shortcuts")}),nt.on("openConversationPage",()=>{l.push("/conversations")})}),Ms(()=>{nt.off("openKeyboardShortcut"),nt.off("openConversationPage")}),(J,X)=>{const z=Pe("router-link"),q=Pe("VDropdown"),ue=He("svg-inline"),pe=He("tooltip"),de=He("click-away");return a(),d(Se,null,[e("div",Uy,[e("div",Gy,[e("div",null,[W(z,{to:"/conversations",class:"global-nav__logo"},{default:K(()=>[X[6]||(X[6]=e("img",{src:El,alt:""},null,-1)),p(m).unreadMessageCount?(a(),d("span",Wy,I(p(m).unreadMessageCount),1)):h("",!0)]),_:1})]),X[14]||(X[14]=e("div",{class:"global-nav__divider"},null,-1)),e("div",qy,[e("div",Hy,[F((a(),ne(z,{to:"/conversations",class:O([{"router-link-active":v.value},"nav__item"]),title:"Conversations"},{default:K(()=>[F(e("img",zy,null,512),[[ue]])]),_:1},8,["class"])),[[pe,"Conversations",void 0,{right:!0}]]),F((a(),ne(z,{to:"/contacts",class:"nav__item",title:"Contacts"},{default:K(()=>[F(e("img",Ky,null,512),[[ue]])]),_:1})),[[pe,"Contacts",void 0,{right:!0}]]),p(s)&&!E.value?F((a(),ne(z,{key:0,to:"/overview",class:"nav__item",title:"Overview"},{default:K(()=>[F(e("img",Yy,null,512),[[ue]])]),_:1})),[[pe,"Overview",void 0,{right:!0}]]):h("",!0),E.value?(a(),d("div",Zy,[F((a(),d("div",{class:O([{"bg-white/10":f.value},"nav__item flex flex-col gap-1 items-center"]),onClick:j},[F(e("img",Jy,null,512),[[ue]]),X[7]||(X[7]=e("p",{class:"text-[10px] text-center text-white leading-leading400 m-0 p-0"},"More",-1))],2)),[[pe,"More",void 0,{right:!0}]]),f.value?F((a(),ne(Vy,{key:0,onClose:H},null,512)),[[de,H]]):h("",!0)])):h("",!0)]),e("div",Qy,[B.value&&p(s)?(a(),ne(q,{key:0,triggers:["click"],shown:S.value,autoHide:!1,placement:"right"},{popper:K(()=>[e("div",Xy,[e("div",{onClick:ce},[F(e("img",e1,null,512),[[ue]])]),X[9]||(X[9]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mt-2"},"Please Complete Installation",-1)),X[10]||(X[10]=e("span",{class:"text-sm text-grey900"},"The Chatway widget needs to be installed and activated to display on your websites",-1)),e("div",{class:"flex items-center justify-center bg-grey900 gap-2 cursor-pointer h-8 mt-4 rounded",onClick:ae},X[8]||(X[8]=[e("span",{class:"text-sm text-white"},"Complete Installation",-1),e("img",{src:Zn,alt:"chevron"},null,-1)]))])]),default:K(()=>[X[11]||(X[11]=e("div",{class:"info-wrap cursor-pointer"},[e("img",{src:Yn,alt:""})],-1))]),_:1},8,["shown"])):h("",!0),E.value?h("",!0):(a(),d("div",t1,[F((a(),d("div",{class:O([{"bg-white/10":g.value},"nav__item"]),onClick:P},[F(e("img",s1,null,512),[[ue]])],2)),[[pe,"Support",void 0,{right:!0}]]),g.value?F((a(),ne(jy,{key:0,onClose:H},null,512)),[[de,H]]):h("",!0)])),D.value?F((a(),d("div",{key:2,onClick:X[0]||(X[0]=he=>Z()),class:"flex flex-col items-center gap-0.5 cursor-pointer nav__item"},[e("div",null,[F(e("img",a1,null,512),[[ue]])]),X[12]||(X[12]=e("span",{class:"text-[10px] text-white text-center"},"Full Screen",-1))])),[[pe,"Open Chatway in full screen",void 0,{right:!0}]]):h("",!0),F((a(),d("div",{class:O([{"router-link-active":M.value},"nav__item"]),onClick:X[1]||(X[1]=he=>k(`${p(s)?"/design":"/profile"}`))},[F(e("img",o1,null,512),[[ue]])],2)),[[pe,"Settings",void 0,{right:!0}]]),T.value?h("",!0):(a(),d("div",n1,[W(q,{theme:"chatway-upgradenow",triggers:["click"],placement:"left",onShow:X[3]||(X[3]=he=>y.value=!0),onHide:X[4]||(X[4]=he=>y.value=!1)},{popper:K(()=>[e("div",i1,[W(Ea,{onShowOwnerAccessRequired:X[2]||(X[2]=he=>c.value=!0)})])]),default:K(()=>[e("div",{class:O(["inline-flex p-1.5 gap-[0.75rem] justify-center items-center rounded hover:bg-[#FFFFFF1A] cursor-pointer",{"bg-[#FFFFFF1A]":y.value}])},X[13]||(X[13]=[e("img",{src:K0,alt:""},null,-1)]),2)]),_:1})])),e("div",l1,[C.value?(a(),ne(J0,{key:0,availabilityStatus:C.value.attributes.online_status==="online",showStatus:"","user-name":_.value,src:A.value,"enable-border":!0,"font-size":"10px",size:"32px",onClick:x,enableBorderForStatus:!0,color:C.value.attributes.online_status==="online"?"#F69D01":"#FF4545"},null,8,["availabilityStatus","user-name","src","color"])):h("",!0),u.value?F((a(),ne(by,{key:1,"current-user":C.value,onClose:H},null,8,["current-user"])),[[de,H]]):h("",!0)])])])])]),W(ko,{showModal:c.value,onCloseModal:X[5]||(X[5]=he=>c.value=!1)},null,8,["showModal"])],64)}}});const Pl=Oe(r1,[["__scopeId","data-v-d1228b52"]]),d1="/assets/checkbox-off-d95cc295.svg",u1="/assets/checkbox-on-7ab98aba.svg",c1={src:ca,alt:"dismiss modal button"},m1={class:"flex justify-content-center"},g1={class:"px-[50px] text-center"},p1={class:"flex justify-center my-4"},v1=["src"],f1={class:"flex justify-content-center"},h1={class:"flex justify-center items-center gap-4"},_1=fe({__name:"NotificationModal",setup(o){const s=zs(),t=Ae(),n=At(),{dontShowGlobalNotificationAgain:l}=bo(),i=$(!1),m=b(()=>s.showGlobalNotificationModal&&t.isProductTourAndEmailModalNotVisible),r=b(()=>s.uiFlags.isUpdatingNotificationSettings),u=()=>{s.showGlobalNotificationModal=!1,t.isFromSignIn=!1,t.notificationModalClosed=!0,y()},g=w=>{i.value=w.target.checked},y=()=>{i.value&&l()},c=()=>{if(y(),window!==window.parent&&!t.isShopifyUser){window.open(`${window.location.origin}/notifications?marketplace=true`,"_blank"),s.showGlobalNotificationModal=!1,t.isFromSignIn=!1;return}else if(window!==window.parent&&t.isShopifyUser){window.open(`${window.location.origin}/notifications?marketplace=1&endpoint=${t.shopifyEndpoint}`,"_blank"),s.showGlobalNotificationModal=!1,t.isFromSignIn=!1;return}else n.push("/notifications"),s.showGlobalNotificationModal=!1,t.isFromSignIn=!1};return(w,f)=>{const v=Pe("Modal"),C=He("svg-inline");return m.value?(a(),ne(v,{key:0,closeModal:m.value,showHeaderClose:!1},{default:K(()=>[e("button",{class:"button--text close--button",onClick:u},[F(e("img",c1,null,512),[[C]])]),e("div",m1,[e("div",g1,[e("div",p1,[e("img",{src:`${p(De)}illustrations/notification.svg`,alt:"notification image"},null,8,v1)]),f[2]||(f[2]=e("h3",{class:"text-2xl text-grey900 font-semibold leading-[120%]"},"Set notifications",-1)),f[3]||(f[3]=e("p",{class:"text-base leading-leading400 mb-[18px] text-grey900 text-center"}," You've just received a message. Enable push notifications for instant alerts. Email notifications for unread messages are already enabled, and you can customize them in settings. ",-1)),e("div",f1,[e("label",{class:"flex gap-1.5 mb-[34px] items-center cursor-pointer",onChange:g},f[0]||(f[0]=[e("input",{type:"checkbox",class:"hidden peer"},null,-1),e("img",{src:d1,alt:"",class:"peer-checked:hidden"},null,-1),e("img",{src:u1,alt:"",class:"hidden peer-checked:block"},null,-1),e("span",{class:"text-grey600 text-sm"},"Don’t show this message again",-1)]),32)]),e("div",h1,[e("button",{class:"flex justify-center items-center bg-grey100 text-base text-grey900 leading-leading400 rounded-[4px] w-[177px] px-2 py-[9px] outline-0",onClick:u}," Cancel "),e("button",{class:"action-btn flex justify-center items-center gap-1 bg-grey900 text-base text-white leading-leading400 rounded-[4px] w-[185px] px-2 py-[9px] outline-0",onClick:c},[f[1]||(f[1]=_e(" Notification settings ")),r.value?(a(),ne(fs,{key:0,size:"10px"})):h("",!0)])])])])]),_:1},8,["closeModal"])):h("",!0)}}});const y1=Oe(_1,[["__scopeId","data-v-2764792e"]]),Vs="/assets/star-1a5f150f.svg",b1={class:"close"},w1={src:ca},x1={class:"text-[#49687e] text-center text-[1.75rem] font-semibold mt-0 leading-[1.4]"},C1={class:"text-[#49687e] text-base text-center pr-0 mx-auto mt-4"},k1={key:0},$1={class:"stars-rating--area relative mt-[30px] flex w-[18rem] mx-auto text-2xl justify-around p-[0.02em]"},S1={src:Vs,alt:"",class:""},T1={src:Vs,alt:"",class:""},M1={src:Vs,alt:"",class:""},A1={src:Vs,alt:"",class:""},E1={src:Vs,alt:"",class:""},D1={class:"mt-6 flex justify-center"},I1={class:"text-[#49687e] text-[0.8rem] leading-[1.6] text-center"},F1=fe({__name:"RatingComponent",emits:["setRating","setReminder"],setup(o,{emit:s}){const t=s,n=Ae(),l=$("0"),i=$("0"),m=b(()=>n.marketPlaceName),r=b(()=>i.value&&i.value>l.value?i.value:l.value),u=b(()=>n.isFirstResolvedConversation?"Congrats on resolving your first conversation 🥳":"Enjoying Chatway so far? 🥳"),g=()=>{t("setReminder")};return We(()=>l.value,y=>{y&&t("setRating",y)}),(y,c)=>{const w=He("svg-inline");return a(),d("div",null,[e("div",b1,[e("button",{class:"button--text close--button",onClick:Qe(g,["prevent"])},[F(e("img",w1,null,512),[[w]])])]),e("h4",x1,I(u.value),1),e("p",C1,[c[21]||(c[21]=_e(" Can you please show us some love and rate ")),m.value==="chatway"||m.value==="chaty"?(a(),d("strong",k1,"Chatway?")):h("",!0),m.value==="wix"?(a(),d(Se,{key:1},[c[15]||(c[15]=e("strong",null,"Chatway.app",-1)),c[16]||(c[16]=_e(" on ")),c[17]||(c[17]=e("strong",null,"Wix?",-1))],64)):h("",!0),m.value==="shopify"?(a(),d(Se,{key:2},[c[18]||(c[18]=e("strong",null,"Chatway.app",-1)),c[19]||(c[19]=_e(" on ")),c[20]||(c[20]=e("strong",null,"Shopify?",-1))],64)):h("",!0),c[22]||(c[22]=_e(" It'll really help us spread the word 🙏 "))]),e("div",$1,[F(e("input",{type:"radio","onUpdate:modelValue":c[0]||(c[0]=f=>l.value=f),id:"5-stars",name:"rating",value:"5"},null,512),[[uo,l.value]]),e("label",{for:"5-stars",class:"star",onMouseover:c[1]||(c[1]=f=>i.value="5"),onMouseleave:c[2]||(c[2]=f=>i.value="0")},[F(e("img",S1,null,512),[[w]])],32),F(e("input",{type:"radio","onUpdate:modelValue":c[3]||(c[3]=f=>l.value=f),id:"4-stars",name:"rating",value:"4"},null,512),[[uo,l.value]]),e("label",{for:"4-stars",class:"star",onMouseover:c[4]||(c[4]=f=>i.value="4"),onMouseleave:c[5]||(c[5]=f=>i.value="0")},[F(e("img",T1,null,512),[[w]])],32),F(e("input",{type:"radio","onUpdate:modelValue":c[6]||(c[6]=f=>l.value=f),id:"3-stars",name:"rating",value:"3"},null,512),[[uo,l.value]]),e("label",{for:"3-stars",class:"star",onMouseover:c[7]||(c[7]=f=>i.value="3"),onMouseleave:c[8]||(c[8]=f=>i.value="0")},[F(e("img",M1,null,512),[[w]])],32),F(e("input",{type:"radio","onUpdate:modelValue":c[9]||(c[9]=f=>l.value=f),id:"2-stars",name:"rating",value:"2"},null,512),[[uo,l.value]]),e("label",{for:"2-stars",class:"star",onMouseover:c[10]||(c[10]=f=>i.value="2"),onMouseleave:c[11]||(c[11]=f=>i.value="0")},[F(e("img",A1,null,512),[[w]])],32),F(e("input",{type:"radio","onUpdate:modelValue":c[12]||(c[12]=f=>l.value=f),id:"1-star",name:"rating",value:"1"},null,512),[[uo,l.value]]),e("label",{for:"1-star",class:"star",onMouseover:c[13]||(c[13]=f=>i.value="1"),onMouseleave:c[14]||(c[14]=f=>i.value="0")},[F(e("img",E1,null,512),[[w]])],32)]),e("div",D1,[e("span",I1,[e("strong",null,I(r.value)+"/5",1),c[23]||(c[23]=_e(" rating "))])])])}}}),P1={src:ca,alt:"dismiss modal button"},j1={class:"mt-[10px]"},L1={class:"select-field__wrapper w-full"},R1=["value"],B1=fe({__name:"RemindComponent",emits:["setReminder","closeModal"],setup(o,{emit:s}){const t=s,n=$("7"),l=$([{name:"7 Days",value:"7"},{name:"14 Days",value:"14"},{name:"Don’t remind me",value:"-1"}]),i=()=>{t("setReminder",n.value)},m=()=>{t("closeModal")};return(r,u)=>{const g=He("svg-inline");return a(),d("div",null,[e("button",{class:"button--text close--button",onClick:Qe(m,["prevent"])},[F(e("img",P1,null,512),[[g]])]),u[2]||(u[2]=e("h4",{class:"text-[#49687e] text-center text-[1.75rem] font-semibold mt-0 leading-[1.4] mb-0"},"Would you like to be reminded in the future?",-1)),e("div",j1,[u[1]||(u[1]=e("label",{class:"text-[#49687e99] text-[0.95rem] mb-0.5",for:""},"Remind me after",-1)),e("div",L1,[F(e("select",{"onUpdate:modelValue":u[0]||(u[0]=y=>n.value=y),id:"custom_channel_type_select",class:"w-full cursor-pointer border rounded-lg h-[48px] border[#eaeff2] text-base py-[10px] px-4 cursor focus-visible:outline-0"},[(a(!0),d(Se,null,Ne(l.value,y=>(a(),d("option",{value:y.value,key:y.value},I(y.name),9,R1))),128))],512),[[Or,n.value]])])]),e("div",{class:"grid center-xs middle-xs m-t-30 m-b-20"},[e("button",{class:"button bg-primary border-primary text-white flex justify-center !w-[150px] !h-10",onClick:i},"Submit")])])}}}),N1={class:"close"},O1={src:ca,alt:"dismiss modal button"},V1={class:"stars-rating--area relative mt-[30px] flex w-[18rem] mx-auto text-2xl justify-around p-[0.02em]",style:{"pointer-events":"none"}},U1=["checked"],G1={for:"5-stars",class:"star"},W1={src:Vs,alt:"",class:""},q1=["checked"],H1={for:"4-stars",class:"star"},z1={src:Vs,alt:"",class:""},K1=["checked"],Y1={for:"3-stars",class:"star"},Z1={src:Vs,alt:"",class:""},J1=["checked"],Q1={for:"2-stars",class:"star"},X1={src:Vs,alt:"",class:""},eb=["checked"],tb={for:"1-star",class:"star"},sb={src:Vs,alt:"",class:""},ab={class:"mt-6 flex justify-center"},ob={class:"text-[#49687e] text-[0.8rem] leading-[1.6] text-center"},nb={class:"m-t-40"},ib={class:"input-field__wrapper"},lb={class:"grid between-xs"},rb={class:"text-grey-light"},db=fe({__name:"ReviewComponent",props:{ratings:{}},emits:["makeReview","setReminder"],setup(o,{emit:s}){const t=s,n=$(""),l=()=>{t("makeReview",n.value)},i=()=>{t("setReminder")};return(m,r)=>{const u=He("svg-inline");return a(),d("div",null,[e("div",N1,[e("button",{class:"button--text close--button",onClick:Qe(i,["prevent"])},[F(e("img",O1,null,512),[[u]])])]),r[3]||(r[3]=e("h4",{class:"text-[#49687e] text-center text-[1.75rem] font-semibold mt-0 leading-[1.4]"},"Share Your Experience",-1)),e("div",null,[e("div",V1,[e("input",{type:"radio",checked:m.ratings==="5",id:"5-stars",name:"rating"},null,8,U1),e("label",G1,[F(e("img",W1,null,512),[[u]])]),e("input",{type:"radio",checked:m.ratings==="4",id:"4-stars",name:"rating"},null,8,q1),e("label",H1,[F(e("img",z1,null,512),[[u]])]),e("input",{type:"radio",checked:m.ratings==="3",id:"3-stars",name:"rating"},null,8,K1),e("label",Y1,[F(e("img",Z1,null,512),[[u]])]),e("input",{type:"radio",checked:m.ratings==="2",id:"2-stars",name:"rating"},null,8,J1),e("label",Q1,[F(e("img",X1,null,512),[[u]])]),e("input",{type:"radio",checked:m.ratings==="1",id:"1-star",name:"rating"},null,8,eb),e("label",tb,[F(e("img",sb,null,512),[[u]])])]),e("div",ab,[e("span",ob,[e("strong",null,I(m.ratings)+"/5",1),r[1]||(r[1]=_e(" rating "))])])]),e("div",nb,[e("div",ib,[e("label",lb,[r[2]||(r[2]=e("span",null,"Review (optional)",-1)),e("span",rb,I(1e3-n.value.length),1)]),F(e("textarea",{class:"",placeholder:"Input your review","onUpdate:modelValue":r[0]||(r[0]=g=>n.value=g),maxlength:"1000"},null,512),[[bt,n.value]])])]),e("div",{class:"grid center-xs middle-xs m-t-30 m-b-20"},[e("button",{class:"button bg-primary border-primary text-white flex justify-center !w-[150px] !h-10",onClick:l},"Submit")])])}}});const ub=Oe(db,[["__scopeId","data-v-f08fd92e"]]),cb={class:"max-w-[85%] mx-auto"},mb={class:"flex justify-center items-center flex-col p-[2rem]"},gb={class:"flex justify-center mb-5"},pb=["src"],vb=fe({__name:"RatingModal",setup(o){const s=Ae(),{isOwner:t}=Xt(),{makeRating:n,setReminder:l}=Zt(),i=$(1),m=$("1"),r=$(""),u=$(!1),g=b(()=>{var _;return(_=s.user)==null?void 0:_.attributes.reg_source}),y=b(()=>s.isShowRatingPopup&&s.isProductTourAndEmailModalNotVisible),c=()=>{s.isShowRatingPopup=!1,u.value=!1,i.value=1},w=async _=>{var A,D;try{if(m.value=_,m.value==="5"){switch((A=g.value)==null?void 0:A.toUpperCase()){case"WIX":window.open("https://www.wix.com/app-market/add-review/5aea2d6c-558b-4658-98ea-c948691b626a","_blank");break;case"SHOPIFY":window.open("https://apps.shopify.com/chatway#modal-show=WriteReviewModal","_blank");break;default:window.open((D=s.user)==null?void 0:D.attributes.rating_link,"_blank")}c(),await n(_,r.value)}else i.value=2}catch(T){console.log(T)}},f=async(_="")=>{r.value=_;try{c(),await n(m.value,r.value)}catch(A){console.log(A)}},v=async _=>{u.value=!0,c(),await l(_)},C=()=>{i.value===3&&!u.value&&v("7")};return(_,A)=>y.value&&p(t)?(a(),ne(Co,{key:0,closeModal:y.value,showHeaderClose:!1,showFooter:!1,onClose:C},{default:K(()=>[e("div",cb,[e("div",mb,[e("div",gb,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"",class:"w-[150px]"},null,8,pb)]),i.value==1?(a(),ne(F1,{key:0,onSetRating:w,onSetReminder:A[0]||(A[0]=D=>i.value=3)})):h("",!0),i.value==2?(a(),ne(ub,{key:1,onMakeReview:f,onSetReminder:A[1]||(A[1]=D=>v("7")),ratings:m.value},null,8,["ratings"])):h("",!0),i.value==3?(a(),ne(B1,{key:2,onSetReminder:v,onCloseModal:C})):h("",!0)])])]),_:1},8,["closeModal"])):h("",!0)}});const fb=Oe(vb,[["__scopeId","data-v-c566f233"]]),jl="/assets/union-69272398.svg";const hb={},_b={class:"global-file-uploader h-screen w-screen"},yb={class:"flex flex-col justify-center items-center"},bb={src:jl};function wb(o,s){const t=He("svg-inline");return a(),d("div",_b,[e("div",null,[e("div",yb,[F(e("img",bb,null,512),[[t]]),s[0]||(s[0]=e("h3",null,"Upload File to Conversation",-1))])])])}const xb=Oe(hb,[["render",wb],["__scopeId","data-v-8de2ef22"]]),Jn="/assets/alert-triangle-a7a1e493.svg",Cb="/assets/x-circle-01b0b23e.svg",Ll="/assets/circle-dismiss-8719c8a4.svg",kb={key:0,class:"bg-grey900 pt-3 lg:pr-3.5 relative pb-3 lg:pb-0"},$b={key:0,class:"text-white text-sm font-medium leading-leading400 text-center"},Sb={key:1,class:"flex flex-col md:flex-row items-center gap-1"},Tb={class:"m-0 text-center px-[30px]"},Mb={class:"text-white whitespace-break-spaces text-sm leading-leading400 font-medium"},Ab={key:2,class:"flex flex-row items-center gap-1"},Eb={key:0,class:"mr-[-25px]",src:Jn,alt:"alert"},Db={key:1,class:"hidden md:flex bg-[#F3F9FF] bg-opacity-30 items-center px-0.5 w-[256px] h-2.5 border-[#e5e7eb] rounded-[40px]"},Ib={class:"m-0 text-center px-[30px]"},Rl=fe({__name:"TrialAndFailedPaymentRibbon",setup(o){const s=At(),t=Ae(),n=ts(),{isOwnerOrAdmin:l}=Xt(),{closeAppUpgradeReminder:i}=ma(),{width:m}=Ht(),r=b(()=>t.isTrialContainerVisible&&t.showTrialCountdown&&l),u=b(()=>t.hasFailedPayment),g=b(()=>t.trialDaysLeft),y=b(()=>Math.min(g.value/14*100,100).toFixed(2)),c=b(()=>{var T;return!t.hasTrial&&((T=t.subscription)==null?void 0:T.attributes.plan_type.toLowerCase())==="free"}),w=b(()=>t.showProUpgradeRibbon),f=b(()=>{var T,B;return((T=t.subscription)==null?void 0:T.attributes.plan_type.toLowerCase())==="pro"&&!((B=t.user)!=null&&B.attributes.pro_year_trial)}),v=b(()=>g.value>3&&g.value<14?`${g.value} days left on your free trial ${f.value?"":"then you can use it for free or"} `:`Only ${g.value} day${g.value>1?"s":""} left on the free trial. `),C=()=>{s.push({name:"settings-plans-view"})},_=()=>{n.isChangePlan=!1,s.push({name:"settings-plans-view",query:{editPaymentDetails:"true"}})},A=()=>{t.showTrialCountdown=!1},D=()=>{t.showTrialCountdown=!1;const T=new FormData;T.append("type","fe_app_pro_upgrade"),i(T)};return(T,B)=>r.value&&w.value||u.value?(a(),d("div",kb,[u.value?(a(),d("div",{key:0,class:O(["flex justify-center items-center gap-[23.75rem] md:h-8 rounded-[0.625rem]",[r.value?"mb-3":"mb-0"]])},[e("p",{class:"text-white text-sm text-center font-medium leading-leading400 px-4"},[B[0]||(B[0]=_e(" Your last payment has failed! Please update your payment information to ensure that Chatway works as expected. ")),e("span",{onClick:_,class:"text-[#F90] cursor-pointer text-sm underline"},"Update payment")])],2)):h("",!0),r.value?(a(),d("div",{key:1,class:O(["flex justify-center items-center md:h-8 gap-[23.75rem] rounded-[0.625rem]",[c.value?"bg-[#FFAF65]":"bg-[#FFFFFF33]"]])},[g.value===14?(a(),d("p",$b,B[1]||(B[1]=[_e(" Enjoy 14-day free trial of Pro, "),e("span",{class:"font-normal text-white"},"use all the Pro features for free during the trial period 🎉",-1)]))):h("",!0),g.value!==14&&g.value!==-1&&g.value!==0?(a(),d("div",Sb,[e("div",{class:O(["bg-[#F3F9FF] bg-opacity-30 items-center px-0.5 md:w-[256px] h-2.5 border-[#e5e7eb] rounded-[40px]",[p(m)>814?"flex":"hidden"]])},[e("div",{class:"bg-[#F3F9FF] rounded-[32px] h-1.5",style:lt({width:`${g.value===14?"100%":`${y.value}%`}`})},null,4)],2),e("p",Tb,[e("span",Mb,I(v.value),1),f.value?h("",!0):(a(),d("span",{key:0,onClick:C,class:"text-[#F90] cursor-pointer text-sm underline"},I(g.value>5&&g.value<14?"upgrade⚡":"Upgrade to Pro today!"),1))])])):h("",!0),g.value===0||g.value===-1?(a(),d("div",Ab,[c.value?(a(),d("img",Eb)):(a(),d("div",Db,[e("div",{class:"bg-[#F3F9FF] rounded-[32px] h-1.5",style:lt({width:`${y.value}%`})},null,4)])),e("p",Ib,[e("span",{class:O(["text-sm leading-leading400 font-medium mr-1",[c.value?"text-grey900":"text-white"]])},I(c.value?"Your trial has ended":"Today is the last day of your Pro trial."),3),f.value?h("",!0):(a(),d("span",{key:0,onClick:C,class:O(["text-[#F90] cursor-pointer text-sm underline",[c.value?"text-grey900 font-semibold":"text-[#F90]"]])},"Upgrade to Pro now!",2))])])):h("",!0),c.value?(a(),d("img",{key:3,onClick:D,src:Cb,alt:"close icon",class:"absolute right-2 md:right-5 cursor-pointer"})):(a(),d("img",{key:4,onClick:A,src:Ll,alt:"close icon",class:"absolute right-2 md:right-5 cursor-pointer"}))],2)):h("",!0)])):h("",!0)}}),Fb=fe({__name:"conversation",setup(o){const s=ls(),t=Za(),n=Ae(),{height:l}=Ht(),{isOwnerOrAdmin:i}=Xt(),m=ct(),r=$(!1),u=b(()=>t.showPrimarySidebar),g=b(()=>n.isTrialContainerVisible&&i||n.hasFailedPayment&&i||C.value),y=b(()=>B.value?u.value:!0),c=b(()=>!!s.params.id),w=b(()=>n.isTrialContainerVisible&&i||n.hasFailedPayment&&i),f=b(()=>m.allConversations.length),v=b(()=>n.isLoadingFullscreen),C=b(()=>n.isShopifyRibbonVisible&&n.shouldDisplayShopifyInstructionOnChatway&&!n.isProductTourRunning),_=S=>{var E;(E=S.dataTransfer)!=null&&E.types.includes("text/plain")?S.preventDefault():c.value&&(r.value||(r.value=!0))},A=()=>{r.value=!1},D=S=>{var x;S.preventDefault();const E=(x=S.dataTransfer)==null?void 0:x.files;E&&E.length>0&&T(E[0])},T=S=>{Ka(S)?nt.emit("imageDragged",S):alert("Please select a valid file type."),A()},{isSmallScreen:B}=hs();return Xe(()=>{n.currentShopIdentifier="",n.currentShopChannel="",nt.on("toggleLeftMenu",()=>{t.isExpandedChatView=!t.isExpandedChatView})}),Ms(()=>{nt.off("toggleLeftMenu")}),(S,E)=>{const x=Pe("router-view");return a(),d("div",null,[e("div",{class:"app--container",onDragover:Qe(_,["prevent"]),onDragleave:Qe(A,["prevent"]),onDrop:D},[y.value&&!v.value?(a(),ne(Pl,{key:0})):h("",!0),e("div",{class:O(["conversations--screen",{"hide-sidebar":!y.value}])},[W(Rl),e("div",{class:O(["page-container lg:pr-4",[{"!h-[91%]":w.value&&C.value&&p(l)>800},{"!h-[85%]":w.value&&C.value&&p(l)<800},{"!h-[94%]":w.value&&p(l)<800&&!C.value||C.value&&p(l)<800&&!w.value},{"!h-[96%]":w.value&&p(l)>800&&f.value&&!C.value||C.value&&p(l)>800&&f.value&&!w.value},{"!h-full":!w.value&&!C.value},g.value?"lg:pt-2":"lg:pt-4"]])},[W(x)],2)],2)],32),W(y1),W(fb),W(ms,{name:"modal-fade"},{default:K(()=>[r.value?(a(),ne(xb,{key:0,onStopDrag:A})):h("",!0)]),_:1})])}}});const Pb=Oe(Fb,[["__scopeId","data-v-7488ae66"]]),Bl="/assets/sliders-86b654d0.svg",Nl="/assets/code-colored-020a03b5.svg",Ol="/assets/user-a6096343.svg",Vl="/assets/agents-cc10ef09.svg",Ul="/assets/plans-68190479.svg",tn="/assets/shopping-bag-52cec387.svg",Gl="/assets/volume-752d1014.svg",Wl="/assets/integration-blue-32cc262e.svg",jb={class:"settings-sidebar--wrap"},Lb={class:"icon text-primary"},Rb={src:Gl,alt:""},Bb=fe({__name:"SettingsSidebar",setup(o){const{isOwnerOrAdmin:s}=Xt(),t=At(),n=ls(),l=Ae(),i=b(()=>l.marketPlaceName),m=()=>{window!==window.parent&&!l.isShopifyUser?window.open(`${window.location.origin}/notifications?marketplace=true`,"_blank"):window!==window.parent&&l.isShopifyUser?window.open(`${window.location.origin}/notifications?marketplace=1&endpoint=${l.shopifyEndpoint}`,"_blank"):t.push("/notifications")},r=()=>{window!==window.parent&&window["app-bridge"]!==void 0&&i.value!=="shopify"?window.open(`${window.location.origin.includes("dev")?"https://dev-go.chatway.app":"https://go.chatway.app"}/plans?marketplace=1&endpoint=${l.shopifyEndpoint}`,"_blank"):t.push("/plans")};return(u,g)=>{const y=Pe("router-link"),c=He("svg-inline");return a(),d("div",jb,[p(s)?(a(),ne(y,{key:0,to:"/design",class:"sidebar_item",title:"Design"},{default:K(()=>g[0]||(g[0]=[e("div",{class:"icon"},[e("img",{src:Bl,alt:""})],-1),e("span",{class:"item"},"Widget Settings",-1)])),_:1})):h("",!0),p(s)?(a(),ne(y,{key:1,to:"/installation",class:"sidebar_item",title:"Installation"},{default:K(()=>g[1]||(g[1]=[e("div",{class:"icon"},[e("img",{class:"w-4 h-4",src:Nl,alt:""})],-1),e("span",{class:"item"},"Installation",-1)])),_:1})):h("",!0),W(y,{to:"/profile",class:"sidebar_item",title:"Profile"},{default:K(()=>g[2]||(g[2]=[e("div",{class:"icon"},[e("img",{src:Ol,alt:""})],-1),e("span",{class:"item"},"Profile",-1)])),_:1}),p(s)?(a(),ne(y,{key:2,to:"/agents",class:"sidebar_item",title:"Agents"},{default:K(()=>g[3]||(g[3]=[e("div",{class:"icon"},[e("img",{src:Vl,alt:""})],-1),e("span",{class:"item"},"Agents",-1)])),_:1})):h("",!0),p(s)?(a(),d("a",{key:3,onClick:r,class:O(["sidebar_item cursor-pointer",{"router-link-exact-active":p(n).path.includes("plans")}]),title:"Plans"},g[4]||(g[4]=[e("div",{class:"icon"},[e("img",{src:Ul,alt:""})],-1),e("span",{class:"item"},"Plans & Billing",-1)]),2)):h("",!0),p(s)&&i.value==="square"?(a(),ne(y,{key:4,to:"/square",class:"sidebar_item",title:"Installation"},{default:K(()=>g[5]||(g[5]=[e("div",{class:"icon"},[e("img",{src:tn,alt:""})],-1),e("span",{class:"item"},"My Square Stores",-1)])),_:1})):h("",!0),e("a",{onClick:m,class:O(["sidebar_item cursor-pointer",{"router-link-exact-active":p(n).path.includes("notification")}]),title:"Notification"},[e("div",Lb,[F(e("img",Rb,null,512),[[c]])]),g[6]||(g[6]=e("span",{class:"item"},"Notifications",-1))],2),p(s)?(a(),ne(y,{key:5,to:"/integrations",class:O(["sidebar_item",{"router-link-exact-active":p(n).path.includes("facebook")||p(n).path.includes("email")}]),title:"Integrations & Apps"},{default:K(()=>g[7]||(g[7]=[e("div",{class:"icon"},[e("img",{src:Wl,alt:""})],-1),e("span",{class:"item"},"Integrations & Apps",-1)])),_:1},8,["class"])):(a(),ne(y,{key:6,to:"/mobile-apps",class:"sidebar_item",title:"Email"},{default:K(()=>g[8]||(g[8]=[e("div",{class:"icon"},[e("img",{src:Il,alt:""})],-1),e("span",{class:"item"},"Mobile Apps",-1)])),_:1}))])}}});const Nb=Oe(Bb,[["__scopeId","data-v-9aec8dcc"]]),Ob="/assets/long-arrow-down-2960f3e2.svg",Vb="/assets/neutral-logo-2ca2a518.svg",Ub={class:"flex justify-center gap-[0.38rem] mt-6"},Gb=["onClick"],Wb=fe({__name:"TestimonialCarousel",props:{indicatorBg:{default:"bg-[#3E4252]"},indicatorActiveBg:{default:"bg-white"},isPlan:{type:Boolean,default:!1}},setup(o){const{width:s}=Ht(),t=$([{img:`${De}images/matias.png`,name:"Matias Yabar-Davila",role:"Founder,",company:"Coach Social",text:"Smooth and easy. Simple interface and a good way to engage with potential customers."},{img:`${De}images/mary.png`,name:"Mary",role:"Founder of",company:"Orion's Corner",text:"This app is actually much easier to use than one I previously tried. It’s very, very user-friendly and support has been extremely helpful. The price is excellent and I definitely am glad that I found this one. It’s totally worth using and trying out."},{img:`${De}images/asbjorn.png`,name:"Asbjørn Kofoed-Nielsen",role:"Founder of",company:"WDT Tool",text:"Added Chatway to my website in minutes, and I get notified on my email and phone app when customers ask questions on my website. Works great."},{img:`${De}images/barak.png`,name:"Barak Liberman",role:"Founder of",company:"Bridge Online Academy",text:"Game Changer. Chatway Live Chat is a great plugin. I’ve used to use a WhatsApp link, and since changing to Chatway Live Chat, I’m getting a lot more chat requests and, as a result, a lot more paying customers. I highly recommend it!"},{img:`${De}images/laslo.png`,name:"Laslo Dosa",role:"Founder of",company:"Bridge Online Academy",text:"Simply the best live chat app that exists on Shopify. Beautiful design, easy customization, and instant messaging with customers through the app"},{img:`${De}images/elaine.png`,name:"Elaine Faye Abueva",role:"Founder,",company:"LZ Marketing",text:"I highly recommend Chatway for online stores. They also notify via email when a new chat comes in"},{img:`${De}images/melanie.png`,name:"Melanie Steele",role:"Founder of",company:"For the Writer's Soul",text:"Hands down the best chat app. I've tried several other apps and they all had major issues. The Chatway app is all you will need. It's simple and easy to set up."}]),n=$(),l=$({}),i=$(""),m=$(!1),r=$(0),u=$([]);let g=null,y=null;const c=()=>{var S;const T=(S=n.value)==null?void 0:S.scrollWidth,B=t.value.length;i.value=`${T/B}px`},w=T=>{m.value||(m.value=!0,T>r.value?f():v(),C(()=>{if(T>r.value){const B=t.value.shift();t.value.push(B)}else{const B=t.value.pop();t.value.unshift(B)}r.value=T,_(),m.value=!1}),D(),A())},f=()=>{l.value={transform:`translateX(${i.value})
                    translateX(-${i.value})`}},v=()=>{l.value={transform:`translateX(${i.value})
                    translateX(-${i.value})`}},C=T=>{var S;const B=()=>{var E;T(),(E=n.value)==null||E.removeEventListener("transitionend",B)};(S=n.value)==null||S.addEventListener("transitionend",B)},_=()=>{l.value={transition:"none",transform:`translate3d(${i.value}, 0, 0)`}},A=()=>{clearInterval(g);let T=0;u.value[0]&&(u.value[0].style.width="0%"),g=setInterval(()=>{if(T>=100)clearInterval(g);else{if(T++,!u.value[0])return;u.value[0].style.width=T+"%"}},50)},D=()=>{clearInterval(y),y=setInterval(()=>{const T=r.value>=t.value.length-1?0:r.value+1;w(T)},5e3)};return We(()=>s.value,()=>{Ft(()=>{i.value="",c(),_()})}),Xe(()=>{c(),_(),A(),D()}),ps(()=>{clearInterval(g),clearInterval(y)}),(T,B)=>(a(),d(Se,null,[e("div",{class:O([[{"py-14 overflow-hidden ":T.isPlan}],"w-full flex justify-center"])},[e("div",{class:"inner flex",ref_key:"inner",ref:n,style:lt(l.value)},[(a(!0),d(Se,null,Ne(t.value,S=>Ss(T.$slots,"default",{key:S.name,slide:S},void 0,!0)),128))],4)],2),e("div",Ub,[(a(!0),d(Se,null,Ne(t.value,(S,E)=>(a(),d(Se,{key:E},[r.value===E?(a(),d("div",{key:0,class:O([[T.indicatorBg],"flex items-center w-24 h-1 rounded-3xl"])},[e("div",{ref_for:!0,ref_key:"bar",ref:u,class:O([[T.indicatorActiveBg],"rounded-[32px] h-1"])},null,2)],2)):(a(),d("div",{key:1,onClick:x=>w(E),class:"cursor-pointer h-1.5"},[e("div",{class:O(["w-3.5 h-1 rounded-3xl",[T.indicatorBg]])},null,2)],8,Gb))],64))),128))])],64))}});const ql=Oe(Wb,[["__scopeId","data-v-b7ad1fdd"]]),qb={class:"flex flex-col items-center justify-center"},Hb={class:"carousel_img flex justify-center items-center w-[85px] h-[85px] rounded-[1000px] absolute -top-10"},zb=["src"],Kb={class:"text-grey900 text-center text-2xl py-[46px] md:py-[4.62rem] whitespace-normal"},Yb={class:"sm:absolute bottom-[30px] flex flex-col md:flex-row items-center justify-center gap-3"},Zb={class:"text-black font-semibold text-lg m-0"},Jb={key:0,class:"bg-grey900 w-px h-5 rounded-lg"},Qb={class:"text-grey900 text-lg leading-[150%] m-0"},Xb=fe({__name:"TestimonialCard",setup(o){const{width:s}=Ht();return(t,n)=>(a(),ne(ql,{indicatorBg:"bg-grey200",indicatorActiveBg:"bg-grey900",isPlan:!0},{default:K(({slide:l})=>[e("div",{class:O(["flex flex-col justify-center bg-grey100 rounded-2xl pt-0 px-2 md:px-14 mx-10 sm:pb-6 relative",[p(s)>1270?"!w-[55rem] h-[19.5rem]":p(s)>730&&p(s)<1270?"!w-[45rem] h-[19.5rem]":"h-full"]]),style:lt({width:p(s)<730?`${p(s)-20}px`:"inherit"})},[e("div",qb,[e("div",Hb,[e("img",{src:l.img,alt:"testimonial image",class:"carousel_img !w-20 !h-20 rounded-[1000px] border-[3px]"},null,8,zb)]),e("p",Kb,I(l.text),1),e("div",Yb,[e("p",Zb,I(l.name),1),p(s)>500?(a(),d("div",Jb)):h("",!0),e("p",Qb,I(l.role)+" "+I(l.company),1)])]),n[0]||(n[0]=e("div",{class:"flex flex-col items-center justify-center mt-4"},null,-1))],6)]),_:1}))}});const ew=Oe(Xb,[["__scopeId","data-v-c67a7228"]]),tw="/assets/minus-primary-ded05286.svg",sw="/assets/plus-primary-0d068d16.svg",aw={class:"flex flex-col items-center px-4 sm:px-12 py-8 mt-8 rounded-lg"},ow={class:"text-lg text-grey900 font-semibold leading-leading400 m-0 max-w-[39.3125rem] text-left"},nw={key:0,class:"mt-2",src:tw,alt:"close"},iw={key:1,src:sw,alt:"open"},lw={class:"text-sm text-grey900 font-normal leading-leading400 pt-2 m-0 text-left"},rw=fe({__name:"PlanFaq",setup(o){const s=[{question:"Can I try the Pro plan features before committing to a subscription?",answer:`Yes, you can explore all the features of the Pro plan with our 14-day free trial. It's a risk-free way to experience the additional capabilities and decide if they meet your business requirements.
`},{question:"Is the Free plan truly free with no hidden charges?",answer:"Yes, the Free plan is completely free and includes the specified features. There are no hidden charges."},{question:"Do you have a refund policy?",answer:"Yes, if you are not satisfied, you can contact us within 30 days of your purchase and you will get a refund."},{question:"Can I upgrade from the Free plan to the Pro plan at any time?",answer:"Absolutely! You can upgrade from the Free plan to the Pro plan at any time to access additional features and benefits."},{question:"Can I cancel or downgrade my Pro plan at any time?",answer:"Yes, you have the flexibility to cancel or downgrade your Pro plan at any time. Changes will take effect at the end of your billing period."},{question:"How does Chatway's Free plan benefit small businesses or startups?",answer:"The Free plan caters to the needs of small businesses by providing access to only a single agent for free. It offers essential features like unlimited conversations, widget customization and social media integration to kickstart seamless customer communication."},{question:"How does the Pro plan enhance customer satisfaction and support?",answer:"The Pro plan goes beyond with unlimited chat history, email integration, and features like multilingual widget, providing an enriched customer support experience that can lead to higher satisfaction and better user engagement."},{question:"What advantages does the multilingual widget bring to businesses targeting diverse audiences?",answer:"The multilingual widget in the Pro plan allows businesses to communicate effectively with a global audience. This feature is invaluable for companies reaching customers in different languages and regions."},{question:"What is the advantage of having unlimited chat history in the Pro plan?",answer:"The Pro plan allows you to access an unlimited chat history, ensuring you can review past conversations and gather valuable insights over an extended period."}],{width:t}=Ht(),{isSmallScreen:n}=hs();return(l,i)=>(a(),d("main",aw,[i[0]||(i[0]=e("h1",{class:"pt-2 pb-8 text-center text-grey900 text-[2.5rem] font-bold"},"Frequently Asked Questions",-1)),(a(),d(Se,null,Ne(s,m=>W(p(Qi),{key:m.question},{default:K(({open:r})=>[e("div",{class:O(["bg-white rounded-2xl border border-grey200 mb-3 p-6 md:w-[47.5rem] w-full",{"!w-[40.5rem]":p(t)<1105&&!p(n)}])},[W(p(Zi),{as:"div",class:"flex justify-between items-start cursor-pointer"},{default:K(()=>[e("p",ow,I(m.question),1),r?(a(),d("img",nw)):(a(),d("img",iw))]),_:2},1024),W(p(Ji),null,{default:K(()=>[e("p",lw,I(m.answer),1)]),_:2},1024)],2)]),_:2},1024)),64))]))}}),dw="/assets/check-green-sm-618c5536.svg",uw="/assets/arrow-down-1df4e70b.svg",cw="/assets/neutral-check-with-bg-d2e79c0c.svg",mw="/assets/check-d1315448.svg",gw="/assets/new-powered-by-stripe-e77961fd.svg",pw={class:"flex flex-col items-center gap-1 px-[2.62rem] pb-4"},vw=["src"],fw={class:"flex items-center gap-2 pt-[1.22rem] pb-[3.22rem]"},hw={class:"bg-[#F3F9FF] bg-opacity-30 flex items-center px-0.5 w-[256px] h-2.5 border border-[#0446DE29] rounded-[40px]"},_w={key:1,class:"text-white"},yw=fe({__name:"TrialModal",props:{showFreePlanSuccessModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const{getPlans:t}=ma(),n=At(),l=ts(),i=s,m=$(null),r=()=>{var v;(v=window.$chatway)==null||v.openChatwayWidget()},u=()=>{i("closeModal")},g=()=>{n.push({name:"conversations"})},y=$(!1),c=b(()=>l.plans),w=async()=>{u(),g()},f=()=>{let v=0;const C=setInterval(()=>{if(v>=100)clearInterval(C);else{if(v++,!m.value)return;m.value.style.width=v+"%"}},10)};return Xe(async()=>{f(),c.value.length||await t()}),(v,C)=>{const _=Pe("Modal");return v.showFreePlanSuccessModal?(a(),ne(_,{key:0,classes:"!w-[29rem]",closeModal:v.showFreePlanSuccessModal,showFooter:!1,onCloseModal:w},{default:K(()=>[e("div",pw,[e("img",{src:`${p(De)}images/invite-success.svg`,alt:""},null,8,vw),C[2]||(C[2]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] mb-0"},"Welcome to Chatway",-1)),C[3]||(C[3]=e("p",{class:"text-base m-0 text-center text-grey900"},"Experience all the Chatway Pro features for the next 14 days for free",-1)),e("div",fw,[C[0]||(C[0]=e("p",{class:"m-0 text-grey900 text-sm font-semibold leading-[1.05rem] text-center"},"14/14 days left",-1)),e("div",hw,[e("div",{ref_key:"bar",ref:m,class:"bg-primary rounded-[32px] h-1.5"},null,512)])]),e("button",{class:"w-[13.6875rem] h-10 py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey900 text-white mb-2",onClick:w},[y.value?(a(),ne(fs,{key:0,class:"before:!border-white m-0",size:"17px"})):(a(),d("span",_w,"Get Started"))]),e("div",{class:"flex items-center gap-1"},[C[1]||(C[1]=e("p",{class:"m-0 text-grey900 text-sm leading-[1.05rem]"},"Need Help?",-1)),e("p",{onClick:r,class:"m-0 text-primary text-sm leading-[1.05rem] cursor-pointer"},"Talk to support")])])]),_:1},8,["closeModal"])):h("",!0)}}}),yt=fe({__name:"Tooltip",props:{placement:{type:String,default:"top"},isOpen:{type:Boolean,default:!1},autoHide:{type:Boolean,default:!0},distance:{type:Number,default:5},skidding:{type:Number,default:0},triggers:{type:Array,default:()=>["hover","click"]}},setup(o){return(s,t)=>{const n=Pe("VDropdown");return a(),ne(n,{triggers:o.triggers,placement:o.placement,shown:o.isOpen,autoHide:o.autoHide,distance:o.distance,skidding:o.skidding},{popper:K(({hide:l})=>[Ss(s.$slots,"content",{hide:l})]),default:K(()=>[Ss(s.$slots,"default")]),_:3},8,["triggers","placement","shown","autoHide","distance","skidding"])}}}),bw={class:"flex flex-col md:flex-row gap-4"},ww={class:"pt-8 !px-8"},xw={key:0,class:""},Cw={key:1,class:"mb-[43px]"},kw={class:"flex items-center justify-center py-[0.94rem] px-2 w-full h-[3.25rem] border border-[#27B836] text-base rounded-lg text-grey900 gap-2"},$w={class:"w-5 h-5",src:dw,alt:""},Sw={key:2,class:""},Tw=["disabled"],Mw={class:"flex gap-2 mb-3"},Aw={class:"my-0 text-grey900 text-sm leading-leading400"},Ew={class:"p-3 w-96"},Dw={class:"!px-5"},Iw={key:0,class:""},Fw={key:1,class:""},Pw={key:2,class:""},jw={class:"flex items-center justify-center text-base py-[0.94rem] px-2 w-full h-[3.25rem] bg-[#27B836] rounded-lg text-white text-shadow gap-2"},Lw={class:"w-5 h-5",src:mw,alt:""},Rw={class:"flex gap-2 mb-3"},Bw={class:"w-5 h-5 [&>rect]:fill-[#0446DE] [&>rect]:opacity-[0.06]",src:mo,alt:"check icon"},Nw={class:"my-0 text-grey900 text-sm leading-leading400"},Ow={class:"p-3 w-96"},Vw=fe({__name:"PlanList",props:{isProUser:{type:Boolean},isOnboarding:{type:Boolean}},setup(o){const s=ts(),t=Ae(),{getPlans:n,upgradeDudaPlan:l}=ma(),{getCurrentUser:i}=Zt(),{isOwner:m}=Xt(),{width:r}=Ht(),{isSmallScreen:u}=hs(),g=[{name:"1 agent",tooltip:"Manage chats with a single seat. Please note that this plan supports only one agent, so inviting multiple agents to handle chats isn't available."},{name:"Unlimited Conversations",tooltip:"Engage with as many visitors as you like, without any chat limits."},{name:"30 days chat history",tooltip:"Access past conversations for up to 30 days"},{name:"Canned responses",tooltip:"Create customizable, pre-written responses to frequently asked questions."},{name:"iOS and Android mobile apps",tooltip:"Manage live chats on the go with our mobile app, available on Google Play store and App store."},{name:"Widget customization",tooltip:"Customize your chat widget as per your brand guidelines."},{name:"Facebook Messenger integration",tooltip:"Connect Facebook Messenger to Chatway and manage conversations within Chatway."}],y=[{name:"14 days free, then $9/agent monthly",tooltip:"This plan allows you to add multiple team members and assign specific roles, such as admin or member, to better manage your support team."},{name:"Private notes & reminders",tooltip:"Add private notes to chats for internal reference and set reminders for follow-ups, visible only to your team."},{name:"Unlimited chat history",tooltip:"Never lose track of conversations with unlimited access to chat history."},{name:"Live translation & multilingual widget",tooltip:"Turn on live translation to see visitor messages in your preferred language instantly, and extend your global reach with a multilingual widget."},{name:"Email integration",tooltip:"Create a Chatway email and manage email conversations within Chatway."},{name:"Custom data, tags and segments",tooltip:"Organize and categorize customers by creating segments, collect additional visitor information with custom data, and use tags for quick access to conversations."},{name:"Remove Chatway branding",tooltip:"Enjoy a more personalized chat experience by removing Chatway branding from your widget."}],c=$(!1),w=$(!1),f=$(!1),v=$(!1),C=b(()=>s.plans),_=b(()=>t.marketPlaceName==="duda"),A=b(()=>t.marketPlaceName==="shopify"),D=b(()=>{var E;return(E=t.subscription)==null?void 0:E.attributes.move_to_free_plan_at}),T=()=>{if(!m){v.value=!0;return}if(_.value){l();return}if(A.value){s.showUpdateAgentModal=!0;return}s.showProPlan=!0},B=async()=>{var E;return C.value.length||await n(),{plan_id:(E=C.value.find(x=>x.attributes.type.toLowerCase()==="free"))==null?void 0:E.id,frequency:"month",is_onboarding:1}},S=async()=>{f.value=!0;const E=await B();try{await new _s().updateSubscription(E),await i({isSecondCall:!1,updateCustomField:!0}),f.value=!1,c.value=!0}catch(x){f.value=!1,Ze(x)}};return Xe(async()=>{C.value.length||await n()}),(E,x)=>{const P=He("svg-inline");return a(),d("div",null,[e("div",null,[e("div",bw,[e("div",{class:O(["w-[22.3rem] flex-shrink-0 rounded-xl bg-white border border-grey200 overflow-hidden",{"!w-[19.3rem]":p(r)<1105&&!p(u),"!border-[#E6E6F0]":!E.isProUser&&!E.isOnboarding}])},[e("div",ww,[x[8]||(x[8]=da('<p class="text-grey900 font-semibold text-lg leading-leading400 mt-0 mb-[0.53rem]" data-v-e1c22157>Free</p><div class="flex items-center gap-[0.38rem]" data-v-e1c22157><p class="text-neutral800 my-0 text-[2rem] font-semibold leading-[120%]" data-v-e1c22157>$0</p><p class="flex flex-col my-0 text-grey900 text-xs leading-[121%] opacity-60" data-v-e1c22157> Free <span class="text-inherit" data-v-e1c22157>forever</span></p></div><p class="text-sm leading-leading400 text-grey900 mb-4" data-v-e1c22157>For small companies with only one customer support representative</p>',3)),e("div",null,[!E.isProUser&&E.isOnboarding?(a(),d("div",xw,[e("button",{onClick:S,class:"flex items-center justify-center py-[0.94rem] px-2 w-full h-[3.25rem] bg-grey900 text-base rounded-lg text-white hover:opacity-60 gap-2"},[f.value?(a(),ne(fs,{key:0,class:"m-0 before:!border-white",size:"17px"})):h("",!0),x[4]||(x[4]=_e(" Use for free "))]),x[5]||(x[5]=e("p",{class:"text-xs text-grey900 leading-[400%] mb-0 -mt-[5px] text-center"},"Access Pro features free for 14 days",-1))])):h("",!0),!E.isProUser&&!E.isOnboarding?(a(),d("div",Cw,[e("div",kw,[F(e("img",$w,null,512),[[P]]),x[6]||(x[6]=_e(" You’re using the free plan "))])])):h("",!0),E.isProUser?(a(),d("div",Sw,[e("button",{disabled:D.value,onClick:x[0]||(x[0]=j=>w.value=!0),class:"flex items-center justify-center py-[0.94rem] px-2 w-full h-[3.25rem] bg-grey100 text-base rounded-lg text-neutral800 hover:opacity-60 gap-2"},x[7]||(x[7]=[e("span",{class:"flex justify-center items-center gap-2 text-neutral800"},[e("img",{src:uw,alt:""}),_e(" Downgrade to free plan ")],-1)]),8,Tw)])):h("",!0)])]),e("div",{class:O(["p-8 bg-grey100 rounded-b-xl h-full",[{"mt-4":!E.isProUser&&!E.isOnboarding||E.isProUser,"h-[324px]":p(r)<1105&&!p(u)}]])},[x[10]||(x[10]=e("p",{class:"text-sm font-semibold leading-leading400 text-neutral800 mt-0"},"What’s included:",-1)),(a(),d(Se,null,Ne(g,(j,H)=>e("div",{key:H},[e("div",Mw,[x[9]||(x[9]=e("img",{src:cw,alt:"check icon"},null,-1)),W(yt,null,{content:K(()=>[e("div",Ew,[e("span",null,I(j.tooltip),1)])]),default:K(()=>[e("p",Aw,I(j.name),1)]),_:2},1024)])])),64))],2)],2),e("div",{class:O(["w-[22.3rem] flex-shrink-0 rounded-xl bg-white border border-primary overflow-hidden",{"!w-[19.3rem]":p(r)<1105&&!p(u)}])},[x[16]||(x[16]=da('<div class="pt-8 px-8" data-v-e1c22157><div class="relative" data-v-e1c22157><div class="absolute right-[-75px] bottom-[-35px] inline-flex rotate-[42.169deg] items-center bg-main100 text-primary text-[0.625rem] pt-[0.49081rem] pr-[3.67644rem] pb-[0.44669rem] pl-[3.32356rem] font-semibold leading-leading400" data-v-e1c22157> RECOMMENDED </div></div><p class="text-primary text-lg font-semibold leading-leading400 mt-0 mb-[0.53rem]" data-v-e1c22157>PRO</p><div class="flex items-center gap-[0.38rem]" data-v-e1c22157><p class="text-grey900 my-0 text-[2rem] font-semibold leading-[120%]" data-v-e1c22157>$9</p><p class="flex flex-col my-0 text-grey900 text-xs leading-[121%] opacity-60" data-v-e1c22157> Agent/ <span class="text-inherit" data-v-e1c22157>month</span></p></div><p class="text-sm leading-leading400 text-grey900 mb-4" data-v-e1c22157>For professional individuals or companies with multiple agents</p></div>',1)),e("div",Dw,[!E.isProUser&&E.isOnboarding?(a(),d("div",Iw,[e("button",{onClick:T,class:"flex items-center justify-center text-base py-[0.94rem] px-2 w-full h-[3.25rem] bg-primary rounded-lg text-white"},"Start 14-day free trial"),x[11]||(x[11]=e("p",{class:"text-xs text-grey900 leading-[400%] mb-0 mt-[-5px] text-center"},"Cancel anytime",-1))])):h("",!0),!E.isProUser&&!E.isOnboarding?(a(),d("div",Fw,[e("button",{onClick:T,class:"flex items-center justify-center bg-primary text-base text-white py-[0.94rem] px-2 w-full h-[3.25rem] rounded-lg"},"Upgrade now"),x[12]||(x[12]=e("p",{class:"text-xs text-grey900 leading-[400%] mb-0 mt-[-5px] text-center"},"Cancel anytime",-1))])):h("",!0),E.isProUser?(a(),d("div",Pw,[e("div",jw,[F(e("img",Lw,null,512),[[P]]),x[13]||(x[13]=_e(" You’re using the Pro plan "))])])):h("",!0)]),e("div",{class:O(["relative bg-main100 p-8 rounded-b-xl h-full",[{"mt-4":E.isProUser}]])},[x[14]||(x[14]=e("p",{class:"text-sm font-semibold leading-leading400 text-grey900 mt-0"},"Everything in Free, and:",-1)),(a(),d(Se,null,Ne(y,(j,H)=>e("div",{key:H},[e("div",Rw,[F(e("img",Bw,null,512),[[P]]),W(yt,null,{content:K(()=>[e("div",Ow,[e("span",null,I(j.tooltip),1)])]),default:K(()=>[e("p",Nw,I(j.name),1)]),_:2},1024)])])),64)),x[15]||(x[15]=e("img",{class:"absolute right-0 bottom-0",src:gw,alt:"powered by stripe"},null,-1))],2)],2)])]),c.value?(a(),ne(yw,{key:0,showFreePlanSuccessModal:c.value,onCloseModal:x[1]||(x[1]=j=>c.value=!1)},null,8,["showFreePlanSuccessModal"])):h("",!0),W(Sl,{isRemove:!1,showModal:w.value,onCloseModal:x[2]||(x[2]=j=>w.value=!1)},null,8,["showModal"]),W(ko,{showModal:v.value,onCloseModal:x[3]||(x[3]=j=>v.value=!1)},null,8,["showModal"])])}}});const Uw=Oe(Vw,[["__scopeId","data-v-e1c22157"]]),Gw={class:"flex flex-col items-center gap-1 px-[2.62rem] pb-4"},Ww=["src"],qw=fe({__name:"ProSuccessModal",props:{showSuccessProModal:{type:Boolean}},emits:["closeModal"],setup(o,{emit:s}){const t=At(),n=s,l=()=>{var r;(r=window.$chatway)==null||r.openChatwayWidget()},i=()=>{n("closeModal")},m=()=>{i(),t.push({name:"conversations"})};return(r,u)=>{const g=Pe("Modal");return r.showSuccessProModal?(a(),ne(g,{key:0,classes:"!w-[29rem]",closeModal:r.showSuccessProModal,showFooter:!1,onCloseModal:m},{default:K(()=>[e("div",Gw,[e("img",{src:`${p(De)}images/invite-success.svg`,alt:""},null,8,Ww),u[1]||(u[1]=e("h3",{class:"text-grey900 text-2xl font-semibold leading-[1.8rem] mb-0"},"Congratulations! 🎉",-1)),u[2]||(u[2]=e("p",{class:"text-base m-0 text-center text-grey900 pb-[1.87rem]"},"Take your customer support to the next level with the Chatway Pro",-1)),e("button",{class:"w-[13.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey900 text-white mb-2",onClick:m},"Close"),e("div",{class:"flex items-center gap-1"},[u[0]||(u[0]=e("p",{class:"m-0 text-grey900 text-sm leading-[1.05rem]"},"Need Help?",-1)),e("p",{onClick:l,class:"m-0 text-primary text-sm leading-[1.05rem] cursor-pointer"},"Talk to support")])])]),_:1},8,["closeModal"])):h("",!0)}}}),Hw={class:"flex justify-between pb-6"},zw=["src"],Kw={key:0,class:"flex flex-col justify-center items-center"},Yw={key:0,class:"flex md:w-[31rem] rounded-lg bg-[#FFF1F1] border border-[#FF45454D] p-4 mb-2 gap-[0.93rem] items-start"},Zw={key:0,class:"text-sm leading-leading400 text-[#ff4545] m-0"},Jw={key:1,class:"text-sm leading-leading400 text-[#ff4545] m-0"},Qw={key:2,class:"text-sm leading-leading400 text-[#ff4545] m-0"},Xw={key:3,class:"text-sm leading-leading400 text-[#ff4545] m-0"},e2={key:4,class:"text-sm leading-leading400 text-[#ff4545] m-0"},t2={class:"flex justify-end"},s2=["src"],a2={class:"mb-6"},o2={key:0},n2={class:"flex items-center gap-2"},i2={class:"relative"},l2={class:"mt-6"},r2={class:"mb-6"},d2={class:"mb-6"},u2={class:"mb-4"},c2={class:"border border-[#93939D4C] rounded-xl !p-5"},m2={class:"flex flex-col items-center justify-center"},g2=["src"],p2={class:"flex justify-between mt-3"},v2={class:"text-xs leading-leading400 text-grey600 mb-0 mt-1 flex items-center"},f2={class:"info-wrap"},h2={class:"w-4 h-4",src:as,alt:""},_2={class:"flex items-center gap-"},y2={class:"w-8 text-center text-grey900 font-semibold text-lg leading-leading400"},b2={key:0,class:"border border-[#ff4545] border-opacity-30 bg-[#fff1f1] rounded-lg p-3"},w2={class:"!text-left mt-0 mx-0 mb-2 text-[#ff4545] text-sm font-semibold leading-[19.6px]"},x2={key:0,class:"text-sm leading-leading400 text-grey900 mb-0 mt-1"},C2={class:"font-semibold text-grey900"},k2={class:"flex justify-between mb-16"},$2={class:"text-grey900 text-sm font-semibold leading-leading400 m-0"},S2=["disabled"],T2={key:1,class:"flex items-center justify-center gap-2"},M2=fe({__name:"ProPlan",setup(o){const s=Es(),t=ts(),n=At(),l=Ae(),{getCurrentUser:i}=Zt(),{height:m,width:r}=Ht(),u={agent1:`${De}images/agent1.png`,agent2:`${De}images/agent2.png`,agent3:`${De}images/agent3.png`,agent4:`${De}images/agent4.png`,agent5:`${De}images/agent5.png`,agent6:`${De}images/agent6.png`,agent7:`${De}images/agent7.png`},g=$(!1),y=$(),c=$(),w=$(),f=$(),v=$(),C=$(""),_=$(""),A=$(!1),D=Nt({company_name:"",country_code:"",vatNumber:"",agentCount:1}),T=$(!1),B=b(()=>s.countries.map(ie=>({name:`${ie.emoji} ${ie.name}`,code:ie.code,emoji:ie.emoji,id:ie.id,image:ie.image}))),S=b(()=>{var re,ie,xe;return((re=v.value)==null?void 0:re.cardCvcError)||((ie=v.value)==null?void 0:ie.cardExpiryError)||((xe=v.value)==null?void 0:xe.cardNumberError)||w.value||f.value}),E=b(()=>t.plans),x=b(()=>u[`agent${D.agentCount<7?D.agentCount:7}`]),P=b(()=>l.marketPlaceName==="shopify"),j=b(()=>l.cardDetails),H=b(()=>l.hasTrial),k=b(()=>{var re;return(re=l.user)==null?void 0:re.attributes.trial_ends_at}),M=b(()=>{const re=V.value?new Date:new Date(k.value);return re.setDate(re.getDate()+Number(V.value?14:1)),re}),V=b(()=>n.currentRoute.value.path.includes("onboarding")),Z=b(()=>l.isTrialContainerVisible),ae=b(()=>l.user),ce=b(()=>{var re;return((re=l.user)==null?void 0:re.attributes.agent_count)||0}),J=()=>{D.agentCount++},X=()=>{D.agentCount!=1&&D.agentCount--},z=re=>{v.value=re,w.value=null},q=()=>{var re,ie,xe;(re=D.company_name)!=null&&re.length&&((ie=f.value)!=null&&ie.message)&&(f.value=null),!((xe=D.company_name)!=null&&xe.length)&&!f.value&&(f.value={message:"Company name is required"})},ue=()=>{P.value?he():pe()},pe=async()=>{const{company_name:re,country_code:ie}=D;if(y.value&&q(),!((!re&&y.value||!ie&&y.value)&&(f.value={message:`${ie?"Company name":"Country"} is required`},C.value))){if(A.value=!0,!y.value&&V.value||j.value){await he();return}try{if(S.value&&v.value){A.value=!1;return}const{token:xe,error:N}=await c.value.createToken(y.value);if(N){v.value=void 0,w.value=N,A.value=!1;return}C.value=xe.id,f.value=null,await he()}catch(xe){return f.value={message:"Please fill out all the required fields"},A.value=!1,xe}}},de=()=>{var ie,xe;let re;return re={plan_id:(ie=E.value.find(N=>N.attributes.type.toLowerCase()==="pro"))==null?void 0:ie.id,frequency:"month",card_token:C.value,agents:D.agentCount,country_code:D.country_code,company_name:D.company_name,vat:D.vatNumber,is_onboarding:V.value?1:0},P.value&&(re.shop=l.shopifyStore,delete re.card_token),!y.value&&!P.value&&re.is_onboarding===1&&(delete re.card_token,re.plan_id=(xe=E.value.find(N=>N.attributes.type.toLowerCase()==="free"))==null?void 0:xe.id),re},he=async()=>{const{company_name:re,country_code:ie}=D;if(!re&&(y.value||j.value)||!ie&&(y.value||j.value)){f.value={message:`${ie?"Company name":"Country"} is required`},A.value=!1;return}const xe=de();try{await new _s().updateSubscription(xe),g.value=!0,A.value=!1,await i({isSecondCall:!1,updateCustomField:!0})}catch(N){A.value=!1,Ze(N)}},ve=re=>{y.value=re.value,c.value=re.stripe},be=()=>{t.showProPlan=!1,n.push("/agents")};return Xe(async()=>{var re;await s.getUserLocation(),B.value.forEach(ie=>{ie.code===s.location&&(D.country_code=ie.code)}),j.value&&(_.value=`**** **** **** **** ${j.value.attributes.last_4_digit}`),ae.value&&(D.company_name=ae.value.attributes.company_name,D.vatNumber=ae.value.attributes.vat),ae.value&&((re=ae.value)!=null&&re.attributes.country_code)&&(D.country_code=ae.value.attributes.country_code),D.agentCount=ce.value}),We(()=>l.cardDetails,()=>{j.value?_.value=`**** **** **** **** ${j.value.attributes.last_4_digit}`:_.value=""}),(re,ie)=>{var L,me,G,U,R,ee,se,Y,Fe;const xe=Pe("VDropdown"),N=He("svg-inline");return a(),d("div",{class:O(["bg-grey100 p-6 overflow-y-auto",[p(m)<763&&Z.value&&!V.value?"h-[91vh]":"h-screen"]])},[e("div",Hw,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"chatway logo"},null,8,zw),e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:ie[0]||(ie[0]=oe=>p(t).showProPlan=!1)},ie[8]||(ie[8]=[e("img",{src:ws,alt:"user"},null,-1),e("span",{class:"text-grey900 text-sm m-0 leading-[1.225rem]"},"Go Back",-1)]))]),V.value?(a(),d("div",Kw,ie[9]||(ie[9]=[e("p",{class:"text-primary text-center text-[2rem] font-bold leading-[3.2rem] m-0"},"Begin your journey for free and enjoy full access",-1),e("p",{class:"text-grey900 text-2xl leading-[2.4rem] m-1"},"Payment only required after 14 days",-1)]))):h("",!0),e("div",{class:O(["flex md:flex-row justify-center items-end gap-4 mt-10",[{"!flex-col":p(r)<868}]])},[e("div",{class:O([{"!w-full":p(r)<868}])},[S.value?(a(),d("div",Yw,[ie[10]||(ie[10]=da('<svg xmlns="http://www.w3.org/2000/svg" width="42" height="30" viewBox="0 0 42 30" fill="none" data-v-144ba8de><rect x="0.828125" y="0.337891" width="40.357" height="29.3505" rx="3.66882" fill="white" data-v-144ba8de></rect><rect x="1.37812" y="0.887891" width="39.257" height="28.2505" rx="3.11882" stroke="#282D3E" stroke-opacity="0.2" stroke-width="1.1" data-v-144ba8de></rect><rect opacity="0.2" x="4.5" y="5.8418" width="7.33763" height="5.50322" rx="1.83441" fill="#282D3E" data-v-144ba8de></rect><rect opacity="0.2" x="1.75" y="13.167" width="38.5" height="5.5" fill="#282D3E" data-v-144ba8de></rect></svg>',1)),e("div",null,[w.value&&!v.value?(a(),d("p",Zw,I(w.value.message),1)):h("",!0),f.value?(a(),d("p",Jw,I(f.value.message),1)):h("",!0),(L=v.value)!=null&&L.cardNumberError&&v.value.cardNumberError.message?(a(),d("p",Qw,I((G=(me=v.value)==null?void 0:me.cardNumberError)==null?void 0:G.message),1)):h("",!0),(U=v.value)!=null&&U.cardExpiryError&&v.value.cardExpiryError.message?(a(),d("p",Xw,I((ee=(R=v.value)==null?void 0:R.cardExpiryError)==null?void 0:ee.message),1)):h("",!0),(se=v.value)!=null&&se.cardCvcError&&v.value.cardCvcError.message?(a(),d("p",e2,I((Fe=(Y=v.value)==null?void 0:Y.cardCvcError)==null?void 0:Fe.message),1)):h("",!0)])])):h("",!0),e("div",{class:O(["bg-white md:w-[31rem] flex-shrink-0 rounded-xl px-6 py-3",[V.value||H.value?"md:h-[33rem]":"md:h-[31.4rem]",{"!w-full":p(r)<868}]])},[e("div",t2,[e("img",{src:`${p(De)}images/grey-powered-by-stripe.svg`,alt:"powered by stripe"},null,8,s2)]),ie[17]||(ie[17]=e("p",{class:"text-grey900 text-lg font-semibold leading-leading400 mb-6"},"Enter your payment details",-1)),e("div",a2,[j.value?(a(),d("div",o2,[e("div",n2,[ie[11]||(ie[11]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mb-2"},"Credit card",-1)),e("div",{class:"inline-flex justify-center items-center rounded-md bg-[#F3F9FF] text-primary px-2 py-[0.13rem] text-sm leading-[1.225rem] cursor-pointer",onClick:ie[1]||(ie[1]=oe=>T.value=!0)}," Replace ")]),e("div",i2,[ie[12]||(ie[12]=da('<label for="cardNumber" class="text-sm text-nowrap leading-leading400" data-v-144ba8de>Card Number*</label><svg class="absolute bottom-4 left-1" xmlns="http://www.w3.org/2000/svg" width="22" height="16" viewBox="0 0 22 16" fill="none" data-v-144ba8de><rect width="22" height="16" rx="2" fill="#E6E6F0" data-v-144ba8de></rect><rect opacity="0.2" x="2" y="3" width="4" height="3" rx="1" fill="#282D3E" data-v-144ba8de></rect><rect opacity="0.2" y="7" width="22" height="3" fill="#282D3E" data-v-144ba8de></rect></svg>',2)),F(e("input",{type:"text",class:"!pl-8 !bg-grey100 md:!w-[14rem]",placeholder:"**** **** **** ****",disabled:"","onUpdate:modelValue":ie[2]||(ie[2]=oe=>_.value=oe)},null,512),[[bt,_.value]])])])):(a(),ne(Kn,{key:1,onChangeCardNumber:ve,onCardError:z})),e("div",l2,[ie[16]||(ie[16]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 mb-2"},"Details",-1)),e("div",r2,[ie[13]||(ie[13]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"Company Name*",-1)),F(e("input",{type:"text",placeholder:"My company",onInput:q,"onUpdate:modelValue":ie[3]||(ie[3]=oe=>D.company_name=oe)},null,544),[[bt,D.company_name]])]),e("div",d2,[ie[14]||(ie[14]=e("label",{for:"cardNumber",class:"text-sm leading-leading400"},"VAT Number (optional)",-1)),F(e("input",{type:"text",placeholder:"123456","onUpdate:modelValue":ie[4]||(ie[4]=oe=>D.vatNumber=oe)},null,512),[[bt,D.vatNumber]])]),e("div",u2,[ie[15]||(ie[15]=e("label",{class:"text-sm leading-leading400"},"Country*",-1)),W(ga,{items:B.value,bindValue:"code",modelValue:D.country_code,"onUpdate:modelValue":ie[5]||(ie[5]=oe=>D.country_code=oe)},null,8,["items","modelValue"])])])])],2)],2),e("div",{class:O(["flex flex-col gap-4 md:w-[19.5rem]",[{"!w-full":p(r)<868}]])},[e("div",c2,[e("div",m2,[e("img",{src:x.value,alt:"",class:"mb-2 w-16 h-16"},null,8,g2),ie[18]||(ie[18]=e("p",{class:"text-grey900 text-base font-semibold leading-leading400 m-0"},"Select number of agents",-1)),ie[19]||(ie[19]=e("p",{class:"m-0 !text-center text-grey600 text-sm"},"Whether it's straightforward or intricate, the Pro plan aligns with your unique support needs",-1))]),e("div",p2,[e("div",null,[ie[21]||(ie[21]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 m-0"},"Number of agents",-1)),e("p",v2,[_e(" $9 X "+I(D.agentCount)+" agent /month ",1),W(xe,{triggers:["hover","click"],placement:"top"},{popper:K(()=>ie[20]||(ie[20]=[e("div",{class:"more--info"},[e("span",null," This indicates the total number of paid user seats. For example, with 2 agents, you're purchasing 2 seats, one seat for the owner and another seat allowing you to invite 1 more teammate to Chatway. ")],-1)])),default:K(()=>[e("div",f2,[F(e("img",h2,null,512),[[N]])])]),_:1})])]),e("div",_2,[e("div",{onClick:X,class:"w-8 h-8 rounded-[1.33875rem] flex items-center justify-center hover:border-[#D9E5FF] hover:border-4"},ie[22]||(ie[22]=[e("img",{class:"w-6 h-6 cursor-pointer",src:xl,alt:""},null,-1)])),e("span",y2,I(D.agentCount),1),e("div",{onClick:J,class:"w-8 h-8 rounded-[1.33875rem] flex items-center justify-center hover:border-[#D9E5FF] hover:border-4"},ie[23]||(ie[23]=[e("img",{class:"w-6 h-6 cursor-pointer",src:Cl,alt:""},null,-1)]))])])]),D.agentCount<ce.value?(a(),d("div",b2,[e("p",w2,"You currently have "+I(ce.value)+" active agent"+I(ce.value>1?"s":"")+".",1),e("p",{class:"!text-left m-0 text-[#ff4545] text-sm leading-[19.6px]"},[ie[24]||(ie[24]=_e(" Deactivate active agents on the ")),e("span",{onClick:be,class:"text-[#ff4545] text-sm cursor-pointer underline"},"agent screen"),ie[25]||(ie[25]=_e(" to lower their count "))])])):h("",!0),e("div",null,[ie[29]||(ie[29]=e("p",{class:"text-grey900 text-base font-semibold leading-leading400 m-0"},"Pro plan",-1)),V.value||H.value?(a(),d("p",x2,[ie[26]||(ie[26]=_e(" Your billing starts on: ")),e("span",C2,I(`${p(pl)[M.value.getMonth()]} ${M.value.getDate()}${p(vl)(M.value)}, ${M.value.getFullYear()}`),1)])):h("",!0),ie[30]||(ie[30]=e("p",{class:"text-sm leading-leading400 text-grey900 mb-0 mt-1"},[_e(" Billing cycle: "),e("span",{class:"font-semibold text-grey900"},"Monthly")],-1)),ie[31]||(ie[31]=e("div",{class:"border-dashed border border-[#CFCFD3] my-4"},null,-1)),e("div",k2,[ie[27]||(ie[27]=e("p",{class:"text-grey900 text-sm font-semibold leading-leading400 m-0"},"Total",-1)),e("p",$2,"$"+I(9*D.agentCount)+"/month",1)]),e("button",{disabled:D.agentCount<ce.value,onClick:ue,class:"flex items-center justify-center text-white text-base leading-leading400 w-full h-10 gap-2 py-[0.5625rem] pr-3 pl-4 bg-primary rounded-lg"},[A.value?(a(),ne(fs,{key:0,class:"before:!border-white",size:"20px"})):h("",!0),A.value?h("",!0):(a(),d("div",T2,[ie[28]||(ie[28]=e("img",{src:Fn,alt:"shield icon"},null,-1)),_e(" "+I(V.value?"Start 14-day free trial":"Upgrade Now"),1)]))],8,S2),ie[32]||(ie[32]=e("div",{class:"flex flex-col md:flex-row items-center gap-2 text-xs leading-leading400 text-grey900 mb-0 mt-3"},[_e(" 30 days money back guarantee "),e("div",{class:"hidden md:block rounded-2xl w-[0.1875rem] h-[0.1875rem] bg-grey600"}),e("span",{class:"text-grey900 text-xs leading-leading400"},"Cancel anytime")],-1))])],2)],2),W(qw,{showSuccessProModal:g.value,onCloseModal:ie[6]||(ie[6]=oe=>g.value=!1)},null,8,["showSuccessProModal"]),T.value?(a(),ne(kl,{key:1,showModal:T.value,onCloseModal:ie[7]||(ie[7]=oe=>T.value=!1)},null,8,["showModal"])):h("",!0)],2)}}});const A2=Oe(M2,[["__scopeId","data-v-144ba8de"]]),E2=["src"],D2=["src"],I2=fe({__name:"TrustedBy",setup(o){const{isSmallScreen:s}=hs(),t=[new URL("/assets/danone-logo-39dfa0fe.svg",self.location).href,new URL("/assets/nutrilon-logo-53d204d1.svg",self.location).href,new URL("/assets/fjall-logo-be22b07f.svg",self.location).href,new URL("/assets/olymphost-logo-0374c8d2.svg",self.location).href];return(n,l)=>{const i=Pe("MarqueeComponent");return a(),d("div",null,[l[0]||(l[0]=e("h2",{class:"text-grey900 font-semibold text-center text-sm m-0"},"Trusted by businesses big and small",-1)),p(s)?(a(),ne(i,{key:0,class:"mt-3"},{default:K(()=>[(a(),d(Se,null,Ne(t,m=>e("img",{key:m,src:m,class:"w-full h-8 ml-[1.28rem]"},null,8,E2)),64))]),_:1})):(a(),d("img",{key:1,src:`${p(De)}images/new-trusted-businesses.svg`,class:"mt-[0.79rem] mb-5 md:mb-0",alt:"trusted busineses"},null,8,D2))])}}}),F2={},P2={width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function j2(o,s){return a(),d("svg",P2,s[0]||(s[0]=[e("g",{opacity:"0.8"},[e("path",{d:"M10.6413 3.71533L3.75 10.6067",stroke:"currentColor","stroke-width":"0.861418","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M3.75 3.71533L10.6413 10.6067",stroke:"currentColor","stroke-width":"0.861418","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))}const Jo=Oe(F2,[["render",j2]]),L2="/assets/plan-inactive-check-5872bd5c.svg",Hl="/assets/plan-active-check-b39d42cb.svg",R2="/assets/chevron-down-blue-1fb2c123.svg";const B2={class:"w-full relative"},N2={class:"overflow-x-auto mb-[1.94rem]"},O2={class:"w-full overflow-hidden"},V2={class:"whitespace-nowrap"},U2={key:0,class:"[&_+_tr]:border-t-0"},G2={colspan:"3",class:"bg-grey100 text-grey900 text-base whitespace-nowrap leading-leading400 font-semibold rounded-2xl py-4 pl-6"},W2={key:1,class:"border-t border-t-grey200 first:border-t-0"},q2={class:"inline-flex items-center gap-1 text-base text-grey900 py-4 pl-6 font-normal leading-leading400"},H2={class:"w-4 h-4 cursor-pointer",src:as,alt:""},z2={class:"p-4 w-[16.3125rem] border-gray-200 flex flex-col gap-3 justify-center items-center self-stretch"},K2={class:"text-grey900 text-sm leading-leading400"},Y2=["src"],Z2={class:"pl-5 py-4"},J2={key:0,src:L2,alt:"free plan"},Q2={key:1,src:Hl,alt:"free plan"},X2={key:0,class:"flex justify-center"},ex=fe({__name:"PricingComparison",setup(o){const s=[{title:"Invite multiple agents",isPro:!0,isSubheading:!1,tooltipText:"Add multiple team members and assign specific roles.",tooltipImg:`${De}images/tooltip/multiple-agents.svg`},{title:"Unlimited conversation",isPro:!1,isSubheading:!1,tooltipText:"Engage in as many live chat interactions as needed, without limitations.",tooltipImg:`${De}images/tooltip/unlimited-conversation.svg`},{title:"Unlimited chat history",isPro:!0,isSubheading:!1,tooltipText:"Access and refer to past conversations for context and continuity. In the free plan you have 30-days history access.",tooltipImg:`${De}images/tooltip/chat-history.svg`},{title:"Install on unlimited websites",isPro:!1,isSubheading:!1,tooltipText:"Install a live chat widget on all of your websites.",tooltipImg:`${De}images/tooltip/installation.svg`},{title:"iOS and Android mobile apps",isPro:!1,isSubheading:!1,tooltipText:"Manage live chats on the go with our mobile app, available on Google Play store and App store.",tooltipImg:`${De}images/tooltip/mobile-apps.svg`},{title:"Chat Management",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Display FAQs",isPro:!1,tooltipText:"You can add frequently asked questions related to your website, product, and services, along with the answers. This helps visitors easily find information, reducing support tickets and improving their experience on your site.",tooltipImg:`${De}images/tooltip/faq.png`},{title:"Canned responses",isPro:!1,tooltipText:"Create customizable, pre-written responses to frequently asked questions.",tooltipImg:`${De}images/tooltip/canned-responses.svg`},{title:"Agent custom availability",isPro:!1,tooltipText:"Set custom availability of all agents based on their schedule.",tooltipImg:`${De}images/tooltip/custom-availability.svg`},{title:"Automated availability messages",isPro:!1,tooltipText:"Setup automated messages for working and non-working hours.",tooltipImg:`${De}images/tooltip/working-hours.svg`},{title:"Private notes",isPro:!0,tooltipText:"Add private notes to chats for internal reference, visible only to your team.",tooltipImg:`${De}images/tooltip/private-note.svg`},{title:"Reminders",isPro:!0,tooltipText:"Set reminders for follow-ups and important tasks.",tooltipImg:`${De}images/tooltip/reminder.svg`},{title:"Notifications",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Email notifications for unread chats",isPro:!1,tooltipText:"Receive email alerts for any unread chats.",tooltipImg:`${De}images/tooltip/email-notification.svg`},{title:"Mobile and desktop push notifications",isPro:!1,tooltipText:"Stay updated with instant push notifications on both mobile and desktop devices whenever a new chat comes in",tooltipImg:`${De}images/tooltip/push-notification.svg`},{title:"Multilingual Support",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Live conversation translation",isPro:!0,tooltipText:"Turn on live translation to see visitor messages in your preferred language instantly.",tooltipImg:`${De}images/tooltip/live-translation.svg`},{title:"Translate widget into multiple languages",isPro:!0,tooltipText:"Reach a global audience with a multilingual chat widget that supports 20+ languages.",tooltipImg:`${De}images/tooltip/translation.svg`},{title:"Integrations & Apps",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Facebook Messenger integration",isPro:!1,tooltipText:"Connect Facebook Messenger to Chatway and manage conversations within Chatway.",tooltipImg:`${De}images/tooltip/facebook-messenger.svg`},{title:"Email integration",isPro:!0,tooltipText:"Create a Chatway email and manage email conversations within Chatway.",tooltipImg:`${De}images/tooltip/email-integration.svg`},{title:"WordPress plugin",isPro:!1,tooltipText:"Install the Chatway plugin on your WordPress website to manage live chats directly from the WordPress admin panel or the Chatway dashboard.",tooltipImg:""},{title:"Shopify app",isPro:!1,tooltipText:"Install the Chatway app on your Shopify store to manage live chats directly from your Shopify admin panel or the Chatway dashboard.",tooltipImg:""},{title:"Wix app",isPro:!1,tooltipText:"Install the Chatway app on your Wix website to handle live chats from your Wix site dashboard or directly from the Chatway dashboard.",tooltipImg:""},{title:"Square app",isPro:!1,tooltipText:"Add the Chatway app to your Square online store and manage the live chat from the Chatway dashboard.",tooltipImg:""},{title:"BigCommerce app",isPro:!1,tooltipText:"Install the Chatway app on your BigCommerce store and manage live chats directly from your BigCommerce control panel or the Chatway dashboard.",tooltipImg:""},{title:"Ecwid app",isPro:!1,tooltipText:"Integrate the Chatway app with your Ecwid store and manage live chats from the Chatway dashboard.",tooltipImg:""},{title:"Big Cartel app",isPro:!1,tooltipText:"Install the Chatway app on your Big Cartel shop and handle live chats from the Chatway dashboard.",tooltipImg:""},{title:"Duda app",isPro:!1,tooltipText:"Add the Chatway app to your Duda shop to manage live chats from the Duda editor or directly from the Chatway dashboard.",tooltipImg:""},{title:"Any Website",isPro:!1,tooltipText:"Add Chatway to any website by installing the JavaScript code and manage live chats directly from the Chatway dashboard.",tooltipImg:""},{title:"Widget Customization & Targeting",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Contact form",isPro:!1,tooltipText:"Collect key details from visitors, like name and email, before the chat begins.",tooltipImg:`${De}images/tooltip/contact-form.svg`},{title:"Widget design customization",isPro:!1,tooltipText:"Customize your chat widget as per your brand guidelines.",tooltipImg:`${De}images/tooltip/widget-design.svg`},{title:"Widget's custom visibility",isPro:!1,tooltipText:"Control the date, time, and days your chat widget appears on your website.",tooltipImg:`${De}images/tooltip/custom-visibility.svg`},{title:"Triggers",isPro:!1,tooltipText:"Set the live chat widget to show up after certain triggers, for example,after a few seconds or scroll percentage of a page.",tooltipImg:`${De}images/tooltip/triggers.svg`},{title:"Page Targeting",isPro:!0,tooltipText:"Display the chat widget on specific pages or sections of your website.",tooltipImg:`${De}images/tooltip/page-targeting.svg`},{title:"Country targeting",isPro:!0,tooltipText:"Show the chat widget to visitors from specific countries.",tooltipImg:`${De}images/tooltip/country-targeting.svg`},{title:"Analytics & Segmentation",isPro:!1,tooltipText:"",tooltipImg:"",isSubheading:!0},{title:"Analytics",isPro:!1,tooltipText:"Gain insights into support agents’ activities and live chat conversations.",tooltipImg:`${De}images/tooltip/analytics.svg`},{title:"Custom segments",isPro:!0,tooltipText:"Create segments to categorize customers based on specific attributes.",tooltipImg:`${De}images/tooltip/segment.svg`},{title:"Custom visitor data",isPro:!0,tooltipText:"Collect and store additional information about your website visitors.",tooltipImg:`${De}images/tooltip/custom-data.svg`},{title:"Tags",isPro:!0,tooltipText:"Add labels to conversations for quick access and  efficient management.",tooltipImg:`${De}images/tooltip/tags.svg`}],t=$(13);return(n,l)=>{const i=He("svg-inline");return a(),d("div",B2,[l[4]||(l[4]=e("p",{class:"text-grey900 text-[2rem] text-center font-light leading-[120%] mb-[2.31rem]"},"Compare Chatway plans",-1)),e("div",N2,[e("table",O2,[l[2]||(l[2]=e("thead",{class:"bg-grey100 text-grey900 text-base whitespace-nowrap leading-leading400 font-semibold"},[e("tr",{class:"w-full text-left"},[e("th",{class:"py-4 pl-6 w-1/2 rounded-l-2xl"},"Features"),e("th",{class:"py-4"},"FREE Plan"),e("th",{class:"py-4 text-center px-16 md:px-0 rounded-r-2xl"},"PRO Plan")])],-1)),e("tbody",V2,[(a(!0),d(Se,null,Ne(s.slice(0,t.value),m=>(a(),d(Se,{key:m.title},[m.isSubheading?(a(),d("tr",U2,[e("td",G2,I(m.title),1)])):(a(),d("tr",W2,[e("td",q2,[_e(I(m.title)+" ",1),W(p(Vr),{theme:"light",placement:m.title.includes("FAQ")?"auto":"top"},{content:K(()=>[e("div",z2,[e("span",K2,I(m.tooltipText),1),m.tooltipImg?(a(),d("img",{key:0,src:m.tooltipImg,alt:"tooltip image"},null,8,Y2)):h("",!0)])]),default:K(()=>[F(e("img",H2,null,512),[[i]])]),_:2},1032,["placement"])]),e("td",Z2,[e("div",null,[m.isPro?(a(),d("img",J2)):(a(),d("img",Q2))])]),l[1]||(l[1]=e("td",{class:"py-4"},[e("div",{class:"flex justify-center"},[e("img",{src:Hl,alt:"pro plan"})])],-1))]))],64))),128))])])]),t.value!==s.length?(a(),d("div",X2,[e("button",{onClick:l[0]||(l[0]=m=>t.value=s.length),class:"bg-[#F3F9FF] flex items-center gap-1 rounded-lg px-4 py-3.5 text-primary font-semibold text-sm leading-leading400"},l[3]||(l[3]=[_e(" Expand All Features "),e("img",{src:R2,alt:""},null,-1)]))])):h("",!0)])}}}),tx={class:"md:pt-4 md:pr-4 overflow-x-hidden"},sx={key:0,class:"w-full"},ax={class:"overflow-y-auto h-full"},ox={class:"px-6 py-3 sm:rounded-tr-xl sm:rounded-tl-xl"},nx={class:"fixed right-12 z-50"},ix={class:"flex flex-col items-center gap-8 pt-8"},lx={key:0},rx={key:1},dx={class:"relative"},ux={class:"bg-grey100"},cx=fe({__name:"ChangeExistingPlan",setup(o){const s=ts(),t=Ae(),{isOwnerOrAdmin:n}=Xt(),l=$(),i=b(()=>s.showProPlan),m=b(()=>t.isProUser),r=b(()=>t.isTrialContainerVisible&&n||t.hasFailedPayment&&n),u=()=>{s.isChangePlan=!1},g=()=>{var c;(c=window.$chatway)==null||c.openChatwayWidget()},y=()=>{const c=l.value;c&&c.scrollIntoView({behavior:"smooth"})};return(c,w)=>(a(),d("div",tx,[i.value?(a(),d("div",sx,[W(A2)])):(a(),d("div",{key:1,class:O(["bg-white w-full sm:rounded-tr-xl sm:rounded-tl-xl h-screen overflow-hidden",[{"!h-[95vh]":r.value}]])},[e("div",ax,[e("div",ox,[e("div",nx,[e("div",{onClick:u,class:"inline-flex flex-col items-center plans-heading-bg cursor-pointer"},[W(Jo,{class:"!h-10 !w-10 stroke-[2.5] [&>g]:opacity-100 text-grey900"}),w[0]||(w[0]=e("p",{class:"m-0 text-xs text-grey600 leading-leading400"},"Close",-1))])]),e("div",null,[e("div",ix,[e("div",null,[m.value?(a(),d("div",lx,w[1]||(w[1]=[e("h1",{class:"text-[2rem] text-center font-normal text-grey900 leading-[120%]"},"You are currently using Pro plan",-1),e("p",{class:"text-base text-center text-grey900 leading-leading400"},"Feel free to reach out to our support team if you have any questions",-1)]))):(a(),d("div",rx,w[2]||(w[2]=[e("h1",{class:"text-[2rem] text-center font-normal text-grey900 leading-[120%]"},"Upgrade to Chatway Pro",-1),e("p",{class:"text-base text-center text-grey900 leading-leading400"},"Whether solo or in a team, unlock incredible functionalities and tailor the experience to your unique needs",-1)]))),e("div",{class:"flex justify-center mt-6"},[e("div",{onClick:g,class:"flex items-center gap-2 py-2 px-4 w-[13.125rem] rounded-lg bg-[#0446DE14] cursor-pointer"},w[3]||(w[3]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[e("path",{d:"M17.5 12.5C17.5 12.942 17.3244 13.366 17.0118 13.6785C16.6993 13.9911 16.2754 14.1667 15.8333 14.1667H5.83333L2.5 17.5V4.16667C2.5 3.72464 2.67559 3.30072 2.98816 2.98816C3.30072 2.67559 3.72464 2.5 4.16667 2.5H15.8333C16.2754 2.5 16.6993 2.67559 17.0118 2.98816C17.3244 3.30072 17.5 3.72464 17.5 4.16667V12.5Z",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})],-1),e("p",{class:"m-0 text-primary text-base leading-leading400"},"Talk to our support",-1)]))])]),W(Uw,{isProUser:m.value},null,8,["isProUser"]),W(I2)]),e("div",{onClick:y,class:"inline-flex"},w[4]||(w[4]=[e("img",{src:Ob,alt:"arrow down",class:"cursor-pointer"},null,-1)]))])]),e("div",dx,[e("div",{ref_key:"pricingComparison",ref:l,id:"pricingComparison",class:"flex flex-col items-center max-w-[1027px] mx-auto px-7 mb-20"},[W(ex)],512)]),e("div",null,[W(ew)]),e("div",ux,[W(rw),w[5]||(w[5]=e("div",{class:"flex justify-center pb-8"},[e("img",{src:Vb,alt:""})],-1))])])],2))]))}}),mx={class:"app--container"},gx={class:"page-container"},px=fe({__name:"settings",setup(o){const s=ct(),t=Za(),{getAllConversations:n}=ss(),{getNotificationSettings:l}=bo(),{getCurrentUser:i}=Zt(),m=ts(),r=Ae(),u=ls(),g=b(()=>t.showPrimarySidebar),y=b(()=>f.value?g.value:!0),c=b(()=>m.isChangePlan),w=b(()=>m.showProPlan),{isSmallScreen:f}=hs(),v=b(()=>r.isTrialContainerVisible||r.hasFailedPayment),C=b(()=>u.name==="settings-design-view");return Xe(()=>{l(),s.allConversations.length||n({page:1,limit:20,type:"all",search:"",segment:""}),u.name!=="settings-design-view"&&u.name!=="settings-profile-view"&&i()}),(_,A)=>{const D=Pe("router-view");return a(),d("div",null,[e("div",mx,[y.value?(a(),ne(Pl,{key:0})):h("",!0),e("div",{class:O(["settings--screen overflow-hidden",{"hide-sidebar":!y.value}])},[W(Rl),e("div",gx,[!c.value&&!w.value?(a(),d("div",{key:0,class:O(["settings pr-4 pb-0 pl-0",{"settings-small--screen":p(f)&&!C.value,"!p-0":p(f)&&C.value,"pt-2":v.value,"pt-4":!v.value}])},[p(f)?h("",!0):(a(),ne(Nb,{key:0})),W(D)],2)):h("",!0),c.value||w.value?(a(),d("div",{key:1,class:O(["settings",{"settings-small--screen":p(f),"!block w-full":w.value}])},[W(cx)],2)):h("",!0)])],2)])])}}});const vx=Oe(px,[["__scopeId","data-v-cc710714"]]),fx=["disabled"],hx={class:"button-text"},_x={src:Zn,alt:""},yx=fe({__name:"AuthSubmitButton",props:{buttonLabel:{},isLoading:{type:Boolean},disabled:{type:Boolean}},setup(o){return(s,t)=>{const n=Pe("Loader"),l=He("svg-inline");return a(),d("button",{class:"submit-button--wrap",disabled:s.disabled},[e("div",hx,[e("span",null,I(s.buttonLabel),1),F(e("img",_x,null,512),[[l]])]),s.isLoading?(a(),ne(n,{key:0,size:"18px"})):h("",!0)],8,fx)}}});const zl=Oe(yx,[["__scopeId","data-v-c1a550a1"]]),bx="/assets/shopify-oauth-9173538c.svg",wx={class:"relative w-full"},xx=["src"],Cx={class:"flex items-center justify-center gap-2 mt-2"},kx={href:"https://www.wix.com/app-market/chatway-live-chat",target:"_blank",class:"flex items-center gap-2 justify-center w-full border border-b-grey200 hover:bg-grey100 rounded-lg p-3"},$x=["src"],Sx={key:0,class:"absolute inset-0 bg-white/50"},Kl=fe({__name:"AuthProviders",setup(o){const{setUser:s}=Zt(),t=$(!1),n=async l=>{t.value=!0,await s(null),Mt.remove(kt(),{domain:".chatway.app",sameSite:"none",secure:!0}),localStorage.clear();try{const{data:i}=await new Aa().getProviderURL(l);window.location.href=i.attributes}catch(i){ze().set({message:i.message||"An error occurred",type:"error"}),t.value=!1}t.value=!1};return(l,i)=>{const m=Pe("Loader");return a(),d("div",wx,[e("a",{onClick:i[0]||(i[0]=Qe(r=>n("google"),["prevent"])),onKeydown:i[1]||(i[1]=Ut(Qe(r=>n("google"),["prevent"]),["enter"])),class:"flex items-center gap-2 justify-center border border-b-grey200 hover:bg-grey100 rounded-lg p-3 cursor-pointer",tabindex:"0"},[t.value?(a(),ne(m,{key:0,class:"!m-0",size:"18px"})):h("",!0),e("img",{src:`${p(De)}images/google.svg`,alt:"",width:"25",height:"24px",loading:"lazy"},null,8,xx),i[2]||(i[2]=e("span",{class:"text-base font-normal text-[#83A1B7]"},"Google",-1))],32),e("div",Cx,[e("a",kx,[e("img",{src:`${p(De)}images/wix.svg`,alt:"",width:"25",height:"24px",loading:"lazy"},null,8,$x),i[3]||(i[3]=e("span",{class:"text-base font-normal text-[#83A1B7]"},"Wix",-1))]),i[4]||(i[4]=e("a",{href:"https://apps.shopify.com/chatway?utm_source=chatway_new_store",target:"_blank",class:"flex items-center gap-2 justify-center w-full border border-b-grey200 hover:bg-grey100 rounded-lg p-3"},[e("img",{src:bx,alt:"",width:"25",height:"24px",loading:"lazy"}),e("span",{class:"text-base font-normal text-[#83A1B7]"},"Shopify")],-1))]),t.value?(a(),d("div",Sx)):h("",!0)])}}}),Tx="/assets/orange-star-e34337e6.svg",Mx={class:"carousel-item"},Ax={class:"carousel__list bg-[#3E4252] rounded-xl pt-0 px-4 mx-4 relative w-[15.375rem] h-[22rem] shadow-[0px_8px_52px_0px_rgba(0,0,0,0.25)]"},Ex={class:"flex flex-col items-center"},Dx=["src"],Ix={class:"text-white font-semibold text-sm leading-leading400 m-0"},Fx={class:"text-grey600 text-center text-xs leading-[150%] mt-0 mb-2"},Px={class:"flex gap-1"},jx={class:"text-grey100 text-sm italic whitespace-normal m-0"},Lx=fe({__name:"AuthTestimonial",setup(o){return(s,t)=>(a(),ne(ql,null,{default:K(({slide:n})=>[e("div",Mx,[e("div",Ax,[e("div",Ex,[e("img",{src:n.img,alt:"testimonial image",class:"carousel_img w-14 h-14 rounded-[1000px] border-solid border-[1.5px] border-transparent mt-4 mb-2"},null,8,Dx),e("p",Ix,I(n.name),1),e("p",Fx,I(n.role)+" "+I(n.company),1),e("div",Px,[(a(),d(Se,null,Ne(5,l=>e("img",{key:l,src:Tx,alt:"star"})),64))]),t[0]||(t[0]=e("div",{class:"my-4 w-full h-px bg-white/10 rounded-lg"},null,-1)),e("p",jx,I(n.text),1)])])])]),_:1}))}});const Rx=Oe(Lx,[["__scopeId","data-v-e6c3a28b"]]),Bx={class:"flex flex-col justify-center w-full md:w-[290px] lg:w-[400px] bg-grey900 sm:rounded-r-xl relative overflow-hidden pb-32 sm:pb-24"},Nx={class:"absolute left-0 bottom-7 w-full"},Ox=["src"],Yl=fe({__name:"Testimonial",setup(o){return(s,t)=>(a(),d("div",Bx,[t[1]||(t[1]=e("p",{class:"text-center text-white text-base font-normal leading-leading400"},[_e(" Over "),e("span",{class:"text-white text-lg font-semibold leading-leading400"},"600"),_e(" Five-Star️ Reviews: ")],-1)),W(Rx),e("div",Nx,[t[0]||(t[0]=e("h2",{class:"text-[#A5A5B8] font-semibold text-xs m-0 text-center"},"TRUSTED BY BUSINESSES",-1)),e("img",{src:`${p(De)}images/new-trusted-businesses.svg`,class:"mt-[0.79rem] mb-5 md:mb-0 px-[2.19rem]",alt:"trusted busineses"},null,8,Ox)])]))}}),Vx={class:"flex flex-col sm:flex-row justify-center"},Ux={class:"flex items-center flex-col w-full md:w-[430px] lg:w-[460px] 2xl:w-[500px] h-auto bg-white sm:rounded-l-xl px-6 pt-[85px] pb-[60px] md:px-10 md:pt-8 md:pb-6 lg:px-14"},Gx=["src"],Wx={class:"mt-6 w-full"},qx={class:"flex flex-col gap-6 mb-3"},Hx={class:"relative"},zx={key:0,class:"flex items-center my-6 w-full"},Kx={key:2,class:"w-full text-center mt-4"},Yx={class:"text-grey600 text-sm font-normal"},Zx=fe({__name:"login",setup(o){const s=At(),t=Bs(),{showRatingPopup:n,getCurrentUser:l,setUser:i}=Zt(),m=Nt({email:"",password:""}),r=Ae(),{getNotificationSettings:u}=bo(),g=b(()=>({email:{required:Ye.withMessage("Email is required",ut),email:Ye.withMessage("Please enter a valid email address",On)},password:{required:Ye.withMessage("Password is required",ut)}})),y=bs(g,m),c=$(!1),w=$("password"),f=b(()=>y.value.$invalid||c.value),v=window.location!==window.parent.location,C=S=>{w.value=S==="show"?"text":"password"},_=async()=>{if(y.value.$touch(),y.value.$pending||y.value.$error)return!1;if(sessionStorage.setItem("ch_show_installation_tooltip","true"),r.isLoadedOnShopifyDashboard&&window.location!==window.parent.location){await A();return}if(yo()){const S=sessionStorage.getItem("ch_app_wix_instance")||"";await D({channel:"wix",instance:S});return}if(r.currentShopIdentifier&&r.currentShopChannel){const S=r.currentShopIdentifier;await D({channel:r.currentShopChannel,shop:S});return}await D()},A=async()=>{try{c.value=!0;const S=await window["app-bridge"].utilities.getSessionToken(window.shopifyBridgeApp);S||(c.value=!1,ze().set({message:"App bridge session not found, please refresh",type:"error"}));const E={app_bridge_session:S,shop:r.shopifyStore,channel:"shopify"};await D(E)}catch(S){Ze(S)}finally{c.value=!1}},D=async S=>{var E,x,P,j,H,k,M,V,Z,ae,ce,J,X,z,q,ue;Mt.remove(kt()),c.value=!0;try{const{data:pe,included:de}=await new Aa().login({email:m.email,password:m.password,option:S});let he={};const ve=de.filter(L=>L.type==="agent-user"),be=de.find(L=>L.type==="subscription"),re=de.find(L=>L.type==="card");if(be&&(r.subscription=be),re&&(r.cardDetails=re),ve&&ve.length){const L=ve[0].attributes;he={agent_id:ve[0].id,status:L.status,online_status:L.online_status,last_active_at:L.last_active_at,join_date:L.join_date,role:L.role,team_id:L.team_id}}const ie={id:pe.id,type:pe.type,attributes:{...pe.attributes,...he}};i(ie),r.isFromSignIn=!0,r.showTrialCountdown=r.showProUpgradeRibbon,(E=r.user)!=null&&E.attributes.has_failed_payment&&(r.showFailedPaymentModal=!0),Object.prototype.hasOwnProperty.call(window,"$chatway")&&(window.$chatway.updateChatwayCustomData("email",((x=ie.attributes)==null?void 0:x.email)||""),window.$chatway.updateChatwayCustomData("name",((P=ie.attributes)==null?void 0:P.name)||""),window.$chatway.updateChatwayCustomData("Product","Chatway"),window.$chatway.updateChatwayCustomData("Type",((j=r.user)==null?void 0:j.attributes.reg_source)||""),window.$chatway.updateChatwayCustomData("Sign up date",cs((H=r.user)==null?void 0:H.attributes.created_at,"MMM DD, YYYY").value),window.$chatway.updateChatwayCustomData("Plan",`${(k=r.subscription)==null?void 0:k.attributes.plan} ${((M=r.subscription)==null?void 0:M.attributes.plan_type.toLowerCase())==="free"?"":`${(V=r.subscription)==null?void 0:V.attributes.agents} agents`} ${(Z=r.user)!=null&&Z.attributes.has_trial&&!((ae=r.user)!=null&&ae.attributes.pro_year_trial)?"(trial)":(ce=r.user)!=null&&ce.attributes.pro_year_trial?"(trial 6)":""}`||""));const xe=pe.attributes.access_token;if(Ks()&&!ua()?(Mt.set(kt(),xe,{sameSite:"none",secure:!0,domain:".chatway.app",expires:400}),Mt.set(kt(),xe,{sameSite:"none",secure:!0,domain:"localhost",expires:400}),Mt.set(kt(),xe,{sameSite:"none",secure:!0,domain:"127.0.0.1",expires:400})):sessionStorage.setItem(kt(),xe),((J=r.user)==null?void 0:J.attributes.status)==="deactivated"){c.value=!1,r.isDeactivated=!0,r.deactivationReason=ve[0].attributes.deactivation_reason;return}$e.disconnect(),$e.io.opts.extraHeaders={Authorization:`Bearer ${xe}`},$e.connect(),u(),n();const N=(z=(X=r.user)==null?void 0:X.attributes)==null?void 0:z.role;return r.enableExistingUserWelcomeToProModal=N==="CHAT_AGENT_OWNER"&&((q=r.user)==null?void 0:q.attributes.pro_year_trial)&&((ue=r.user)==null?void 0:ue.attributes.show_existing_user_trial_modal),await t.getAllInstallationPlatforms(),t.activatedDomains.length>1?t.activatedDomains.forEach((L,me)=>{window.$chatway.updateChatwayCustomData(`Domain${me>0?me:""}`,L)}):window.$chatway.updateChatwayCustomData("Domain",t.activatedDomains[0]),s.push("/")}catch(pe){Ze(pe)}finally{c.value=!1}},T=async()=>{var E,x,P,j;if(window.location!==window.parent.location){new Aa().logout();return}const S=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt());S&&!r.user&&await l(),S&&r.user&&((x=(E=r.user)==null?void 0:E.attributes)==null?void 0:x.registration_step)==="ONBOARDED"?s.push("/conversations"):S&&r.user&&((j=(P=r.user)==null?void 0:P.attributes)==null?void 0:j.registration_step)!=="ONBOARDED"&&s.push("/onboarding/info")},B=()=>{if(window.location.origin==="https://go.chatway.app"){const S=document.createElement("script");S.id="googleTag",S.src="https://www.googletagmanager.com/gtag/js?id=G-NM7E259B49",S.async=!0,document.head.appendChild(S),S.onload=()=>{window.dataLayer=window.dataLayer||[];function E(){var x;(x=window.dataLayer)==null||x.push(arguments)}E("js",new Date),E("config","G-NM7E259B49")}}};return Ta({title:"Login"}),Xe(()=>{r.hasMarketplaceOnboarded=null,m.email=sessionStorage.getItem("loginEmail")||"",sessionStorage.removeItem("loginEmail"),s.currentRoute.value.query.email&&(m.email=s.currentRoute.value.query.email),T(),B()}),ps(()=>{var E;const S=document.getElementById("googleTag");S&&((E=S.parentNode)==null||E.removeChild(S),window.dataLayer&&(window.dataLayer.length=0),window.gtag&&(window.gtag=function(){console.warn("gtag function is no longer available")}))}),(S,E)=>{const x=Pe("InputField"),P=Pe("router-link");return a(),d("div",Vx,[e("div",Ux,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"Chatway",width:"112",height:"30",loading:"lazy"},null,8,Gx),E[6]||(E[6]=e("div",{class:"mt-8"},[e("h3",{class:"m-0 text-3xl font-semibold text-center text-grey900"},"Sign In to Chatway")],-1)),e("div",Wx,[e("form",{onSubmit:Qe(_,["prevent"])},[e("div",qx,[W(x,{label:"Enter Your Email",value:m.email,type:"email",forValue:"email",placeholder:"Enter Your Email",hasError:p(y).email.$error,validationMessage:p(y).email.$errors,onInput:E[0]||(E[0]=j=>m.email=j),onBlur:p(y).email.$touch},null,8,["value","hasError","validationMessage","onBlur"]),e("div",Hx,[W(x,{label:"Your Password",value:m.password,type:w.value,forValue:"password",placeholder:"Your Password",hasError:p(y).password.$error,validationMessage:p(y).password.$errors,onInput:E[1]||(E[1]=j=>m.password=j),onBlur:p(y).password.$touch,onTogglePassword:C},null,8,["value","type","hasError","validationMessage","onBlur"]),W(P,{to:"/forgot-password",class:"absolute right-0 top-0 font-normal text-xs p-0.5 text-primary text-right"},{default:K(()=>E[2]||(E[2]=[_e("Forgot password?")])),_:1})])]),W(zl,{buttonLabel:"Sign In",isLoading:c.value,disabled:f.value},null,8,["isLoading","disabled"])],32)]),v?h("",!0):(a(),d("div",zx,E[3]||(E[3]=[e("div",{class:"w-full h-px rounded-2xl bg-grey200"},null,-1),e("div",{class:"px-3 text-center text-sm font-normal text-grey600 shrink-0"},"Or sign in with",-1),e("div",{class:"w-full h-px rounded-2xl bg-grey200"},null,-1)]))),v?h("",!0):(a(),ne(Kl,{key:1})),v?h("",!0):(a(),d("div",Kx,[e("div",Yx,[E[5]||(E[5]=_e(" Do not have an account? ")),W(P,{to:"/register",class:"text-sm font-semibold text-primary"},{default:K(()=>E[4]||(E[4]=[_e("Register")])),_:1})])]))]),W(Yl)])}}}),Jx={class:"auto-fill-input-wrapper"},Qx={class:"main-input"},Xx={key:1,class:"misspelled-area"},eC=fe({__name:"AutoFillMail",props:{value:{type:String,default:"",required:!0}},emits:["update:value"],setup(o,{expose:s,emit:t}){const n=o,l=t,i=$([{name:"gmail.com",autoCompleteAfter:1,misspelledVariations:["gmial.com","gmai.com","gamil.com","gmal.com","gamil.com","gmail.cm","mgail.com","gmil.com","gmail.om","gmaill.com","gmi.com","gmail.co","gmal.com","gmali.com","gml.com","gmal.com","gmali.com","gma.com"]},{name:"yahoo.com",autoCompleteAfter:2},{name:"icloud.com",autoCompleteAfter:2},{name:"me.com",autoCompleteAfter:2},{name:"mac.com",autoCompleteAfter:2},{name:"outlook.com",autoCompleteAfter:2},{name:"protonmail.com",autoCompleteAfter:2},{name:"zohocorp.com",autoCompleteAfter:2},{name:"gmx.com",autoCompleteAfter:2},{name:"hotmail.com",autoCompleteAfter:2},{name:"aol.com",autoCompleteAfter:2},{name:"aoicorp.com",autoCompleteAfter:2},{name:"premio.io",autoCompleteAfter:2}]),m=$(!1),r=$(!1),u=$(""),g=$(""),y=b(()=>{const[T,B]=n.value.split("@");return{username:T,domain:B}}),c=()=>i.value.some(T=>n.value.toLowerCase().includes(T.name)),w=T=>{m.value&&(T.preventDefault(),l("update:value",g.value.trim()),m.value=!1,r.value=!1)},f=()=>{l("update:value",u.value),m.value=!1,r.value=!1},v=T=>/[A-Z]/.test(T),C=()=>{if(u.value.length>0&&!m.value)return r.value=!1,!1;const{domain:T}=y.value,B=i.value.find(S=>S.name!==(T==null?void 0:T.toLowerCase().trim())&&Array.isArray(S.misspelledVariations)&&S.misspelledVariations.includes(T.toLowerCase()));return B&&(u.value=`${y.value.username}@${B.name}`,r.value=!0),r.value},_=()=>{if(c()){m.value=!1,r.value=!1;return}const{shouldShow:T,email:B}=D();g.value=B,m.value=T},A=()=>{const{domain:T}=y.value;return i.value.find(B=>B.name.startsWith(T==null?void 0:T.toLowerCase()))||!1},D=()=>{const{domain:T,username:B}=y.value,S=A();if(S&&T.length>=S.autoCompleteAfter&&T.length<=S.name.length){let E="";if(v(T)){const[,x]=S.name.split(T.toLowerCase());E=`${B}@${T}${x}`}else E=`${B}@${S.name}`;return{shouldShow:!0,email:E}}else return{shouldShow:!1,email:n.value}};return We(()=>n.value,()=>{const{domain:T,username:B}=y.value;T&&B?_():m.value=!1,u.value="",r.value=!1}),s({confirmAutoComplete:w,checkSuggestion:C}),(T,B)=>{const S=Pe("InputField");return a(),d("div",Jx,[e("div",Qx,[Ss(T.$slots,"default",{},void 0,!0)]),m.value&&!r.value?(a(),ne(S,{key:0,label:"Enter Your Email",disabled:"",value:g.value,type:"email",class:"placeholder-input",placeholder:"Enter Your Email"},null,8,["value"])):h("",!0),r.value?(a(),d("p",Xx,[B[0]||(B[0]=e("span",{class:"misspelled-label"},"Did you mean",-1)),e("span",{class:"misspelled-text",onClick:Qe(f,["prevent"])},I(u.value)+"?",1)])):h("",!0)])}}});const tC=Oe(eC,[["__scopeId","data-v-89f85fba"]]),sC={class:"flex flex-col sm:flex-row justify-center"},aC={class:"flex items-center flex-col w-full md:w-[430px] lg:w-[460px] 2xl:w-[500px] h-auto bg-white sm:rounded-l-xl px-6 pt-[85px] pb-[60px] md:px-10 md:pt-8 md:pb-6 lg:px-14"},oC=["src"],nC={class:"mt-6 w-full"},iC={class:"mb-3"},lC={class:"w-full text-center mt-4"},rC={class:"text-grey600 text-sm font-normal"},dC=fe({__name:"register",setup(o){const{setUser:s,getCurrentUser:t}=Zt(),n=At(),l=Ae(),i=Nt({email:"",password:""}),m=b(()=>({email:{required:Ye.withMessage("Email  is required",ut),email:Ye.withMessage("Please enter a valid email address",On)}})),r=bs(m,i),u=$(!1),g=$(),y=b(()=>r.value.$invalid||u.value),c=b(()=>{var C;return(C=g.value)==null?void 0:C.checkSuggestion}),w=async()=>{if(!await c.value()){if(r.value.$touch(),r.value.$pending||r.value.$error)return!1;u.value=!0;try{const _={email:i.email,src:"CHATWAY",landing_url:Mt.get("chatway_landing_url"),referrer_url:Mt.get("chatway_referrer_url")},A=await new Aa().register(_),{data:D,included:T}=A;let B={};if(T&&T.length){const x=T[0].attributes;B={agent_id:T[0].id,status:x.status,online_status:x.online_status,last_active_at:x.last_active_at,join_date:x.join_date,role:x.role,team_id:x.team_id}}const S={id:D.id,type:D.type,attributes:{...D.attributes,...B,role:la.CHAT_AGENT_OWNER}},E=D.attributes.access_token;return Mt.set(kt(),E,{sameSite:"none",secure:!0,domain:".chatway.app",expires:400}),Mt.set(kt(),E,{sameSite:"none",secure:!0,domain:"localhost",expires:400}),Mt.set(kt(),E,{sameSite:"none",secure:!0,domain:"127.0.0.1",expires:400}),$e.disconnect(),$e.io.opts.extraHeaders={Authorization:`Bearer ${E}`},$e.connect(),await s(S),n.push("/onboarding/info")}catch(_){Ze(_),u.value=!1}u.value=!1}},f=async()=>{if(window.location!==window.parent.location)return;const C=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt());C&&!l.user&&await t(),C&&l.user&&n.push("/conversations")},v=()=>{if(window.location.origin==="https://go.chatway.app"){const C=document.createElement("script");C.id="googleTag",C.src="https://www.googletagmanager.com/gtag/js?id=G-NM7E259B49",C.async=!0,document.head.appendChild(C),C.onload=()=>{window.dataLayer=window.dataLayer||[];function _(){var A;(A=window.dataLayer)==null||A.push(arguments)}_("js",new Date),_("config","G-NM7E259B49")}}};return Ta({title:"Register"}),Xe(()=>{f(),v()}),ps(()=>{var _;const C=document.getElementById("googleTag");C&&((_=C.parentNode)==null||_.removeChild(C),window.dataLayer&&(window.dataLayer.length=0),window.gtag&&(window.gtag=function(){console.warn("gtag function is no longer available")}))}),(C,_)=>{const A=Pe("InputField"),D=Pe("router-link");return a(),d("div",sC,[e("div",aC,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"Chatway",width:"112",height:"30",loading:"lazy"},null,8,oC),_[9]||(_[9]=e("div",{class:"mt-8"},[e("h3",{class:"m-0 text-3xl font-semibold text-center text-grey900"},"Sign Up for Free")],-1)),_[10]||(_[10]=e("div",{class:"mt-2"},[e("p",{class:"m-0 font-normal text-sm text-center text-grey900"},"Add live chat to your website and start engaging with visitors")],-1)),e("div",nC,[e("form",{onSubmit:Qe(w,["prevent"])},[e("div",iC,[W(tC,{value:i.email,"onUpdate:value":_[6]||(_[6]=T=>i.email=T),ref_key:"autoFillMail",ref:g},{default:K(()=>[W(A,{label:"Enter Your Email",value:i.email,type:"email",forValue:"email",class:"bg-transparent",placeholder:"Enter Your Email",hasError:p(r).email.$error,validationMessage:p(r).email.$errors,onInput:_[0]||(_[0]=T=>i.email=T),onBlur:p(r).email.$touch,onKeydown:[_[1]||(_[1]=Ut(T=>{var B;return(B=g.value)==null?void 0:B.confirmAutoComplete(T)},["tab"])),_[2]||(_[2]=Ut(T=>{var B;return(B=g.value)==null?void 0:B.confirmAutoComplete(T)},["enter"])),_[3]||(_[3]=Ut(T=>{var B;return(B=g.value)==null?void 0:B.confirmAutoComplete(T)},["space"])),_[4]||(_[4]=Ut(T=>{var B;return(B=g.value)==null?void 0:B.confirmAutoComplete(T)},["right"]))],onClick:_[5]||(_[5]=T=>{var B;return(B=g.value)==null?void 0:B.confirmAutoComplete(T)})},null,8,["value","hasError","validationMessage","onBlur"])]),_:1},8,["value"])]),W(zl,{buttonLabel:"Sign Up",isLoading:u.value,disabled:y.value},null,8,["isLoading","disabled"])],32)]),_[11]||(_[11]=e("div",{class:"flex items-center my-6 w-full"},[e("div",{class:"w-full h-px rounded-2xl bg-grey200"}),e("div",{class:"px-3 text-center text-sm font-normal text-grey600 shrink-0"},"Or sign up with"),e("div",{class:"w-full h-px rounded-2xl bg-grey200"})],-1)),W(Kl),e("div",lC,[e("div",rC,[_[8]||(_[8]=_e(" Already have an account? ")),W(D,{to:"/login",class:"text-sm font-semibold text-primary"},{default:K(()=>_[7]||(_[7]=[_e("Sign in")])),_:1})])])]),W(Yl)])}}}),uC="/assets/arrow-right-blue-7bc5b885.svg",cC="/assets/arrow-left-slide-4e1197cf.svg",mC="/assets/search-conv-b419a688.svg",gC="/assets/chevron-down-solid-b26c09ad.svg",pC="/assets/edit-active-cba02ff2.svg",vC={key:0,class:"flex flex-col justify-center items-center py-[59px]"},fC={key:1,class:"pt-4"},hC={class:"max-h-[365px] overflow-y-auto"},_C=["onClick","onMouseover"],yC={class:"flex items-center gap-2 pr-4"},bC=["onClick"],wC={src:pC,alt:""},xC={key:1},CC={src:Wt,class:"h-5 w-5","aria-hidden":"true",alt:"selected field"},kC={src:en,class:"pl-[6px]",alt:"add segment icon"},$C=fe({__name:"SegmentList",props:{isContact:{type:Boolean,default:!1}},emits:["segment","close"],setup(o,{emit:s}){const t=jt(),n=Ae(),l=At(),i=s,m=$(t.selectedSegment),r=$(""),u=b(()=>t.segments),g=b(()=>n.isProUserOrTrial),y=_=>{w.value&&(m.value=_,t.selectedSegment=_,i("segment",_),i("close"))},c=(_,A)=>{_.stopPropagation(),t.editSegmentData=A,t.showEditSegmentModal=!0,t.selectedSegment.isSegmentSelected=m.value.id===t.selectedSegment.id},w=b(()=>n.isProUserOrTrial),f=_=>{r.value=_},v=()=>{t.showSegmentList=!1},C=()=>{l.push("/plans")};return(_,A)=>{const D=He("svg-inline");return a(),d("div",null,[F((a(),d("div",{class:O([{"left-0":!_.isContact,"right-[120px]":_.isContact},"segment absolute top-[83px] w-[399px] bg-white rounded-tl-0 rounded-tr-0 rounded-b-[8px] z-[1000]"])},[u.value.length?(a(),d("div",fC,[e("div",hC,[(a(!0),d(Se,null,Ne(u.value,T=>(a(),d("div",{key:T.id,onClick:B=>y(T),onMouseover:B=>f(T.id),onMouseleave:A[1]||(A[1]=B=>f("")),class:O(["flex justify-between items-center h-[38px] mb-2 hover:bg-grey100 cursor-disabled",[{"bg-[#F3F9FF] text-primary":m.value.id===T.id},w.value?"cursor-pointer":"cursor-not-allowed"]])},[e("span",{class:O(["pl-4 text-base",{"text-primary":m.value.id===T.id,"text-grey900":m.value.id!==T.id}])},I(T.attributes.name),3),e("div",yC,[r.value===T.id&&r.value!=="contact"&&w.value||r.value===T.id&&m.value.id===T.id&&m.value.id!=="contact"&&w.value?(a(),d("span",{key:0,onClick:Qe(B=>c(B,T),["prevent"])},[F(e("img",wC,null,512),[[D]])],8,bC)):h("",!0),m.value.id===T.id?(a(),d("span",xC,[F(e("img",CC,null,512),[[D]])])):h("",!0)])],42,_C))),128))]),g.value?(a(),d("div",{key:0,class:"flex bg-grey100 gap-1 cursor-pointer",onClick:A[2]||(A[2]=T=>p(t).showAddSegmentModal=!0)},[F(e("img",kC,null,512),[[D]]),A[4]||(A[4]=e("span",{class:"text-sm text-grey900"},"New Segment",-1))])):(a(),d("div",{key:1,class:"flex items-center upgrade-now-btn-bg gap-1 cursor-pointer h-8",onClick:C},A[5]||(A[5]=[e("img",{src:xo,class:"pl-2",alt:"crown icon"},null,-1),e("span",{class:"text-sm text-grey900"},"Upgrade now",-1)])))])):(a(),d("div",vC,[A[3]||(A[3]=e("p",{class:"text-sm text-gray900 text-center"},"Create visitors segments using custom data, tags and more for easy access and better management",-1)),e("button",{onClick:A[0]||(A[0]=T=>p(t).showAddSegmentModal=!0),class:"bg-grey900 text-white text-sm rounded-[4px] px-2 py-1.5"},"Create Segment")]))],2)),[[p(Is),v]])])}}});const SC=Oe($C,[["__scopeId","data-v-b0743e57"]]),TC="/assets/sidebar-de6e89be.svg",MC={class:"sidebar-icon",src:TC},AC=fe({__name:"SidebarToggleButton",setup(o){const s=Za(),{isSmallScreen:t}=hs(),n=()=>{s.togglePrimarySidebar()};return(l,i)=>{const m=He("svg-inline");return p(t)?(a(),d("button",{key:0,onClick:n,class:"sidebar-button"},[F(e("img",MC,null,512),[[m]])])):h("",!0)}}});const Zl=Oe(AC,[["__scopeId","data-v-285cd12b"]]),EC={class:"text-sm text-grey900 font-semibold mb-2"},DC=["innerHTML"],IC={class:"flex items-center justify-between"},FC={class:"flex items-center gap-3"},PC={class:"flex items-center gap-3"},jC=["disabled"],LC={class:"text-sm text-grey600"},go=fe({__name:"ProductTour",props:{placement:{default:"top"},step:{},classes:{},skidding:{default:0},arrowPadding:{default:0}},setup(o){const s=o,t=At(),n=Ae(),l=ct(),{updateOnboardingTourStep:i,skipProductTour:m,setProductTourSkiped:r}=Zt(),{addDemoConversation:u}=ss(),{isSmallScreen:g}=hs(),y=$(null),c=b(()=>n.productTourSteps.find(T=>T.id==n.productTourCurrentStep)),w=b(()=>Array.isArray(s.step)&&s.step.includes(n.productTourCurrentStep)||n.productTourCurrentStep==s.step),f=b(()=>n.isProductTourRunning&&!n.showSkipTourModal&&w.value),v=T=>{if(n.user){if(l.allConversations.length||u(),T>n.productTourSteps.length&&l.isDemoConversation)l.resetStore(),t.push({name:"conversations"});else if(T>n.productTourSteps.length&&n.showEmailOfflineVisitorModal){const B=l.allConversations.find(S=>S.attributes.contact.email);B&&t.push({name:"conversations-view",params:{id:B.id}})}n.user.attributes.tour_stage=T}},C=async()=>{if(n.productTourCurrentStep>1){const T=n.productTourCurrentStep-1;v(T),await i({stage:T})}},_=async()=>{if(n.productTourCurrentStep<=n.productTourSteps.length){const T=n.productTourCurrentStep+1;v(T),await i({stage:T})}},A=async()=>{if(r(!0),l.isDemoConversation)l.resetStore(),t.push({name:"conversations"});else if(n.showEmailOfflineVisitorModal){const T=l.allConversations.find(B=>B.attributes.contact.email);T&&t.push({name:"conversations-view",params:{id:T.id}})}n.showSkipTourModal=!1,await m()},D=()=>{r(!1),n.showSkipTourModal=!1};return Os(y,T=>{const B=T.target;f.value&&!B.closest(".chatway--container")&&!B.closest(".modal-wrap")&&!B.closest(".chat--profile")&&(r(!0),n.showSkipTourModal=!0)}),(T,B)=>{const S=Pe("Modal");return a(),d(Se,null,[!p(g)&&f.value?(a(),ne(yt,{key:0,placement:T.placement,triggers:[],isOpen:"",autoHide:!1,distance:10,skidding:T.skidding,arrowPadding:T.arrowPadding,class:O([{"pointer-events-none":![4,5].includes(p(n).productTourCurrentStep)},T.classes])},{content:K(()=>{var E,x;return[e("div",{class:"p-6 w-[360px]",ref_key:"tooltip",ref:y},[e("div",EC,I((E=c.value)==null?void 0:E.title),1),e("div",{class:"text-sm text-grey900 mb-4",innerHTML:(x=c.value)==null?void 0:x.content},null,8,DC),e("div",IC,[e("div",FC,[e("div",PC,[e("button",{onClick:C,disabled:p(n).productTourCurrentStep==1,class:"w-8 h-8 p-0 flex items-center justify-center bg-primary rounded-full"},B[0]||(B[0]=[e("img",{src:jn},null,-1)]),8,jC),e("button",{onClick:_,class:"w-8 h-8 p-0 flex items-center justify-center bg-primary rounded-full"},B[1]||(B[1]=[e("img",{src:Zn},null,-1)]))]),e("div",LC,I(p(n).productTourCurrentStep)+" of "+I(p(n).productTourSteps.length),1)]),e("div",null,[p(n).productTourCurrentStep<p(n).productTourSteps.length?(a(),d("button",{key:0,class:"text-sm text-grey600",onClick:A},"Skip")):(a(),d("button",{key:1,class:"text-sm font-semibold text-primary",onClick:_},"Done"))])])],512)]}),default:K(()=>[Ss(T.$slots,"default")]),_:3},8,["placement","skidding","arrowPadding","class"])):Ss(T.$slots,"default",{key:1}),p(n).showSkipTourModal&&w.value?(a(),ne(S,{key:2,closeModal:p(n).showSkipTourModal,"header-title":"Skip the tour",actionButtonTypeOneText:"Skip tour",actionButtonTypeTwoText:"Resume tour",onActionButtonTypeOne:A,onActionButtonTypeTwo:D,onCloseModal:D},{default:K(()=>B[2]||(B[2]=[e("div",{class:"flex flex-col gap-2 p-4 mb-6"},[e("p",{class:"text-grey900 font-normal m-0 text-base text-left"},"Are you sure you want to skip the onboarding tour? You can resume it later.")],-1)])),_:1},8,["closeModal"])):h("",!0)],64)}}}),RC={FILTERS:{TITLE:"Inbox",ALL:"All",UN_RESOLVED:"Unresolved",RESOLVED:"Resolved",STARRED:"Starred"},ACTIONS:{ASSIGN_TO:"Assign to",RESOLVE:"Resolve",UN_RESOLVE:"Unresolve",SEND_MESSAGE:"Send Message",SAVE_CHANGES:"Save Changes",CANCEL:"Cancel",UPLOADING_IMAGE:"Uploading image",RESOLVED:"Conversation resolved",WRITE_MESSAGE:"Write your message...",WRITE_NOTE:"Add a private note for yourself, or use {'@'} to tag teammates. Only the team can see the notes.",WRITE_REMINDER:"Add a reminder for yourself, you will be notified at your selected time."},LOADING:"Loading conversations...",LOADED:"All conversations loaded 💥"},BC={DETAILS:"Details",LOCATION:"Location",DEVICE:"Device",PAGES_VISITED:"Pages visited",CUSTOM_DATA:"Custom Data",TAGS:"Tags",LANGUAGE:"Language",SAME_EMAIL_CONVERSATION:"Conversations with the same email id"},NC={CONVERSATION:RC,CONTACT:BC},OC={FILTERS:{TITLE:"Bonjour",ALL:"Tous",UN_RESOLVED:"Non résolus",RESOLVED:"Résolus",STARRED:"Favoris"}},VC={CONVERSATION:OC},UC={en:NC,fr:VC},po=Ur({locale:"en",fallbackLocale:"en",legacy:!1,globalInjection:!0,messages:UC}),GC={class:"chat--filter--container"},WC={class:"chat--filter__header"},qC={key:0,class:"chat--filter__title"},HC={src:mC,class:"search-icon",alt:"search icon"},zC={key:2,class:"search-section"},KC={src:Ll,class:"search-icon",alt:"close search icon"},YC={class:"chat--filter"},ZC={class:"tabs"},JC=["onClick"],QC={key:0},XC={class:"flex items-center gap-0.5"},ek={class:"truncate max-w-[98px]"},tk={class:"w-3 h-3 text-[#93939D] fill-[#93939D]",src:gC,alt:"segment"},sk=fe({__name:"ChatFilter",props:{isSmallScreen:{type:Boolean,default:!1}},emits:["change-filter","search","close-search","segment"],setup(o,{emit:s}){const t=ys(),n=jt(),l=Za(),i=$(!1),m=$("all"),r=$(""),u=$([{name:po.global.t("CONVERSATION.FILTERS.ALL"),value:"all"},{name:po.global.t("CONVERSATION.FILTERS.UN_RESOLVED"),value:"unresolved"},{name:po.global.t("CONVERSATION.FILTERS.RESOLVED"),value:"resolved"},{name:po.global.t("CONVERSATION.FILTERS.STARRED"),value:"starred"}]),g=s,y=b(()=>l.isExpandedChatView),c=b(()=>n.showSegmentList),w=b(()=>t.agents.filter(j=>j.attributes.online_status==="online"&&j.attributes.status==="active").map(j=>({name:j.attributes.name,src:j.attributes.profile_photo_url,online_status:j.attributes.online_status,id:j.id})).slice(0,8)),f=b(()=>n.selectedSegment.id?n.selectedSegment.attributes.name:"Segments"),v=b(()=>t.agents.filter(P=>P.attributes.online_status==="online"&&P.attributes.status==="active")),C=b(()=>v.value.length<8?0:v.value.length-8),_=async()=>{i.value=!i.value,await Ft(),B()},A=()=>{n.showSegmentList=!1},D=Ys(()=>{g("search",r.value)},1500),T=P=>{r.value=P.target.value,D()},B=()=>{const P=document.activeElement;P&&P.blur();const j=document.querySelector("#conversationSearch");j&&(j.focus(),j.select())},S=P=>{r.value="",g("change-filter",P),m.value=P,n.showSegmentList=!1},E=P=>{g("segment",P.id)},x=()=>{g("close-search"),r.value="",i.value=!1};return Xe(()=>{nt.on("search",()=>{_()})}),Nn(()=>{nt.off("search")}),(P,j)=>{const H=Pe("thumbnail-group"),k=He("svg-inline");return a(),d("div",GC,[e("div",WC,[W(Zl),y.value?h("",!0):(a(),d("h4",qC,I(P.$t("CONVERSATION.FILTERS.TITLE")),1)),!i.value&&!y.value?(a(),d("div",{key:1,onClick:_,class:"search-button"},[F(e("img",HC,null,512),[[k]])])):h("",!0),i.value&&!y.value?(a(),d("div",zC,[e("input",{type:"text",class:"search-input",placeholder:"Search",id:"conversationSearch",onInput:T},null,32),e("div",{onClick:x},[F(e("img",KC,null,512),[[k]])])])):h("",!0),!i.value&&!y.value?(a(),ne(H,{key:3,class:"agent-thumbnail","users-list":w.value,"total-count":v.value.length,size:"20px","font-size":"8px",gap:"tight",showShadow:"",showStatus:"",showMore:8,plusMoreThumbnailsCount:C.value},null,8,["users-list","total-count","plusMoreThumbnailsCount"])):h("",!0)]),W(go,{placement:"bottom",step:1,classes:"relative z-[12] px-4 pt-2.5 pb-px bg-white rounded-xl"},{default:K(()=>[e("div",YC,[e("ul",ZC,[(a(!0),d(Se,null,Ne(u.value,M=>(a(),d("li",{key:M.value,class:O(["tabs-title",{active:m.value===M.value&&!c.value&&f.value.toLowerCase()==="segments"}]),onClick:V=>S(M.value)},[y.value?h("",!0):(a(),d("span",QC,I(M.name),1))],10,JC))),128)),y.value?h("",!0):(a(),d("li",{key:0,onClick:j[0]||(j[0]=M=>p(n).showSegmentList=!0),class:O(["tabs-title",{"segment-active":c.value||f.value.toLowerCase()!=="segments"}])},[e("span",XC,[e("span",ek,I(f.value),1),F(e("img",tk,null,512),[[k]])])],2))]),c.value?(a(),ne(SC,{key:0,onClose:A,onSegment:j[1]||(j[1]=M=>E(M))})):h("",!0)])]),_:1})])}}});const ak=Oe(sk,[["__scopeId","data-v-1b91e8d5"]]),Qa="/assets/slash-f8c33d8c.svg",ho="/assets/messenger-0d773872.svg",Ln="/assets/email-fill-fd136eaa.svg",Qn="/assets/left-arrow-b84969ed.svg",ok="/assets/at-bf0e237d.svg",nk="/assets/star-icon-adc8dd0e.svg",To="/assets/calendar-293f9519.svg",Jl="/assets/resolved-f3c96b9a.svg",ik={class:"tag-info max-w-md"},lk={class:"sender"},rk={class:"sender"},dk={class:"others chat--details"},uk={key:0,class:"resolved-name"},ck={class:"name is-resolved"},mk={key:0,class:"is-blocked"},gk={src:Qa,alt:""},pk=["title"],vk={key:1},fk={key:2},hk={key:3,class:"agent-name"},_k={src:Qn},yk={key:0,class:"is-blocked"},bk={src:Qa,alt:""},wk=["title"],xk={key:1},Ck={key:2},kk={key:3,class:"agent-name"},$k={src:Qn},Sk=["title","innerHTML"],Tk=["title","textContent"],Mk={href:""},Ak={src:ok},Ek={class:"meta-details"},Dk={class:"meta"},Ik={key:0,class:"bookmark-icon"},Fk={class:"icon",src:nk},Pk={class:"time"},jk={class:"icon",src:To},Lk={key:1,class:"unread-count"},Rk={class:"icon",src:Jl},Bk={class:"relative z-1 w-6 h-6 text-xs inline-flex items-center justify-center overflow-hidden bg-grey600 rounded-full border border-white"},Nk=["src"],Ok={key:1,class:"text-white"},Vk={class:"p-4 w-[260px] text-xs leading-4"},Uk={class:"relative z-3 w-4 h-4 mt-0.5 text-[8px] font-semibold leading-3 inline-flex items-center justify-center overflow-hidden bg-white shadow-xl rounded-full"},Gk={class:"text-primary"},Wk={class:"p-4 w-[260px] text-xs leading-4"},qk=["innerHTML"],Hk=["src"],zk={key:1,class:"text-white"},Kk={class:"p-4 w-[260px] text-xs leading-4"},Yk=fe({__name:"ChatList",props:{id:{},conversationAttributes:{}},emits:["openConversation"],setup(o,{emit:s}){const t=ls(),n=Ae(),l=ct(),i=o,m=s,r=b(()=>Ds(k.value.charAt(0))),u=b(()=>{var z,q;return((z=i.conversationAttributes.contact)==null?void 0:z.contact_name)||((q=i.conversationAttributes.contact)==null?void 0:q.name)}),g=b(()=>{var z,q;return((z=i.conversationAttributes.contact)==null?void 0:z.contact_email)||((q=i.conversationAttributes.contact)==null?void 0:q.email)}),y=b(()=>i.conversationAttributes.latest_active_agent?i.conversationAttributes.latest_active_agent.name:""),c=b(()=>i.conversationAttributes.latest_message?i.conversationAttributes.latest_message:""),w=b(()=>{var z;return(z=i.conversationAttributes.contact)==null?void 0:z.online_status}),f=b(()=>i.conversationAttributes.unread_messages+i.conversationAttributes.unread_notes),v=b(()=>i.conversationAttributes.is_resolved),C=b(()=>i.conversationAttributes.contact.blocked_at),_=b(()=>i.conversationAttributes.is_bookmarked),A=b(()=>{var z,q;return(q=(z=i.conversationAttributes)==null?void 0:z.contact)==null?void 0:q.src}),D=b(()=>l.presenceAgents.filter(z=>z.conversation_id==i.id)),T=b(()=>i.conversationAttributes.has_unread_reminders||!1),B=b(()=>(j.value||v.value||T.value)&&D.value.length<=2?D.value.slice(0,2):(j.value||v.value)&&D.value.length>2?D.value.slice(0,1):!j.value&&!v.value&&D.value.length<=3?D.value.slice(1,3):!j.value&&!v.value&&D.value.length>3?D.value.slice(1,2):D.value),S=b(()=>(j.value||v.value)&&D.value.length<=2?[]:(j.value||v.value)&&D.value.length>2?D.value.slice(1):!j.value&&!v.value&&D.value.length<=3?[]:!j.value&&!v.value&&D.value.length>3?D.value.slice(2):D.value),E=b(()=>{if(S.value.length)return S.value.length==2?`<strong>${S.value[0].agent_name}</strong> and <strong>${S.value[1].agent_name}</strong> are viewing this conversation`:S.value.length==3?`<strong>${S.value[0].agent_name}</strong>, <strong>${S.value[1].agent_name}</strong>, and <strong>${S.value[2].agent_name}</strong> are viewing this conversation`:S.value.length>3?`<strong>${S.value[0].agent_name}</strong>, <strong>${S.value[1].agent_name}</strong>, <strong>${S.value[2].agent_name}</strong>, and others are viewing this conversation`:`<strong>${S.value[0].agent_name}</strong> is viewing this conversation`}),x=b(()=>w.value==="online"),P=b(()=>i.id===t.params.id),j=b(()=>f.value>0),H=b(()=>i.conversationAttributes.has_unread_note_tags),k=b(()=>{var ue,pe,de;const{agent_name:z}=c.value;let q=null;return(ue=c.value)!=null&&ue.content&&Z.value&&M.value?q=M.value.translated_message:(pe=c.value)!=null&&pe.content?q=((de=c.value.meta)==null?void 0:de.content_html)||c.value.content:c.value.urls&&(q="File attachment"),(q==null?void 0:q.length)>0?`${z?`${z}: `:""}${ae(q)}`:"No messages"}),M=b(()=>c.value.translations&&c.value.translations.find(z=>z.language==V.value)),V=b(()=>n.preferredChatLanguage),Z=b(()=>i.conversationAttributes.translation_setting),ae=z=>{const q={"&amp;":"&","&#038;":"&","&lt;":"<","&#060;":"<","&gt;":">","&#062;":">","&quot;":'"',"&#034;":'"',"&apos;":"'","&#039;":"'"};return z.replace(/&amp;|&#038;|&lt;|&#060;|&gt;|&#062;|&quot;|&#034;|&apos;|&#039;/g,ue=>q[ue])},ce=b(()=>Xi(i.conversationAttributes.latest_message?i.conversationAttributes.latest_message.updated_at:"")),J=()=>{m("openConversation",i.conversationAttributes)},X=z=>z.replace(/<[^>]*>/g,"");return(z,q)=>{var he,ve;const ue=Pe("Thumbnail"),pe=Pe("VDropdown"),de=He("svg-inline");return a(),d("div",{class:"chat-item--container",onClick:q[0]||(q[0]=be=>J())},[e("div",{class:O(["chat--list-item",{"is-active":P.value,"is-unread":j.value,"is-reminder":T.value}])},[W(pe,{"no-auto-focus":"",triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>[e("div",ik,[e("div",lk,I(u.value),1),e("div",rk,I(g.value),1)])]),default:K(()=>[W(ue,{"user-name":u.value,"availability-status":x.value,enableBorderForStatus:"","show-status":!0,color:z.conversationAttributes.contact.bgcolor},null,8,["user-name","availability-status","color"])]),_:1}),e("div",dk,[v.value?(a(),d("div",uk,[e("div",ck,[C.value?(a(),d("span",mk,[F(e("img",gk,null,512),[[de]])])):h("",!0),e("span",{class:"max-w-[130px] truncate",title:u.value},I(u.value),9,pk),A.value&&A.value==="messenger"?(a(),d("div",vk,[W(pe,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>q[1]||(q[1]=[e("div",{class:"tag-info"},[e("div",{class:"sender"},"Facebook Messenger conversation")],-1)])),default:K(()=>[q[2]||(q[2]=e("img",{src:ho,alt:"messenger"},null,-1))]),_:1})])):h("",!0),A.value&&A.value==="email"?(a(),d("div",fk,[W(pe,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>q[3]||(q[3]=[e("div",{class:"tag-info"},[e("div",{class:"sender"},"Email integration conversation")],-1)])),default:K(()=>[q[4]||(q[4]=e("img",{src:Ln,alt:"email integration conversation"},null,-1))]),_:1})])):h("",!0),y.value?(a(),d("span",hk,[F(e("img",_k,null,512),[[de]]),e("span",null,I(y.value),1)])):h("",!0)])])):(a(),d("div",{key:1,class:O(["name",{"unread-message":j.value&&!v.value}])},[C.value?(a(),d("span",yk,[F(e("img",bk,null,512),[[de]])])):h("",!0),e("span",{class:"max-w-[130px] truncate",title:u.value},I(u.value),9,wk),A.value&&A.value==="messenger"?(a(),d("div",xk,[W(pe,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>q[5]||(q[5]=[e("div",{class:"tag-info"},[e("div",{class:"sender"},"Facebook Messenger conversation")],-1)])),default:K(()=>[q[6]||(q[6]=e("img",{src:ho,alt:"messenger"},null,-1))]),_:1})])):h("",!0),A.value&&A.value==="email"?(a(),d("div",Ck,[W(pe,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>q[7]||(q[7]=[e("div",{class:"tag-info"},[e("div",{class:"sender"},"Email integration conversation")],-1)])),default:K(()=>[q[8]||(q[8]=e("img",{src:Ln,alt:"email integration conversation"},null,-1))]),_:1})])):h("",!0),y.value?(a(),d("span",kk,[F(e("img",$k,null,512),[[de]]),e("span",null,I(y.value),1)])):h("",!0)],2)),e("div",{class:O(["message",{"unread-message":j.value&&!v.value||P.value}])},[(ve=(he=c.value)==null?void 0:he.meta)!=null&&ve.content_html?(a(),d("a",{key:0,href:"#",class:O(["message--item",{rtl:r.value}]),title:X(k.value),innerHTML:k.value},null,10,Sk)):(a(),d("a",{key:1,href:"#",class:O(["message--item",{rtl:r.value}]),title:k.value,textContent:I(k.value)},null,10,Tk)),H.value?(a(),ne(pe,{key:2,triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>q[9]||(q[9]=[e("div",{class:"tag-info"},[e("div",{class:"sender"},"You've been tagged")],-1)])),default:K(()=>[e("span",Mk,[F(e("img",Ak,null,512),[[de]])])]),_:1})):h("",!0)],2)]),e("div",Ek,[e("div",Dk,[_.value?(a(),d("div",Ik,[F(e("img",Fk,null,512),[[de]])])):h("",!0),e("span",Pk,I(ce.value.value),1)]),e("div",{class:O([{flex:T.value&&(j.value||v.value)}])},[T.value&&!P.value?(a(),d("div",{key:0,class:O([j.value||v.value?"reminder-icon-with-others":"reminder-icon"])},[F(e("img",jk,null,512),[[de]])],2)):h("",!0),j.value&&!v.value?(a(),d("span",Lk,I(f.value),1)):h("",!0),v.value?(a(),d("div",{key:2,class:O(T.value?"resolved-icon-with-others ml-[4px] mt-[5px]":"mt-1")},[F(e("img",Rk,null,512),[[de]])],2)):h("",!0),!j.value&&!v.value&&!T.value&&D.value.length?(a(),ne(pe,{key:3,triggers:["hover","click"],placement:"top",class:"flex items-center"},{popper:K(()=>[e("div",Vk,[e("strong",null,I(D.value[0].agent_name),1),q[10]||(q[10]=_e(" is viewing this conversation "))])]),default:K(()=>[e("div",Bk,[D.value[0].agent_profile_photo_url?(a(),d("img",{key:0,src:D.value[0].agent_profile_photo_url,class:"object-cover",alt:""},null,8,Nk)):(a(),d("div",Ok,I(p(Wa)(D.value[0].agent_name)),1))])]),_:1})):h("",!0)],2),B.value.length?(a(),d("div",{key:0,class:O(["flex items-center -space-x-1 absolute",v.value||T.value||v.value?"right-4 top-9":"right-3 top-8"])},[S.value.length?(a(),ne(pe,{key:0,triggers:["hover","click"],placement:"top",class:"flex items-center"},{popper:K(()=>[e("div",Wk,[e("div",{innerHTML:E.value},null,8,qk)])]),default:K(()=>[e("div",Uk,[e("div",Gk,"+"+I(S.value.length),1)])]),_:1})):h("",!0),(a(!0),d(Se,null,Ne(B.value,(be,re)=>(a(),ne(pe,{key:re,triggers:["hover","click"],placement:"top",class:"flex items-center"},{popper:K(()=>[e("div",Kk,[e("strong",null,I(be.agent_name),1),q[11]||(q[11]=_e(" is viewing this conversation "))])]),default:K(()=>[e("div",{class:O([re==0?"z-2":"z-1","relative w-4 h-4 text-[8px] inline-flex items-center justify-center overflow-hidden bg-grey600 rounded-full border border-white"])},[be.agent_profile_photo_url?(a(),d("img",{key:0,src:be.agent_profile_photo_url,class:"object-cover",alt:""},null,8,Hk)):(a(),d("div",zk,I(p(Wa)(be.agent_name)),1))],2)]),_:2},1024))),128))],2)):h("",!0)])],2)])}}});const Zk=Oe(Yk,[["__scopeId","data-v-eb0e614c"]]),Jk="/assets/back-icon-e77f9207.svg",Qk="/assets/star-outline-9fa9d327.svg",Ql="/assets/check-black-3fb30ce5.svg",Xk="/assets/redo-e8b9a3c3.svg",e$="/assets/information-e6086661.svg",Da="/assets/plain-crown-db7d24a3.svg",Rn="/assets/chevron-down-white-dcf42767.svg",t$="/assets/line-caution-b4eb791c.svg",s$="/assets/at-black-92d521c6.svg",a$="/assets/upload-a063408d.svg",o$="/assets/canned-38fd3405.svg",Xn="/assets/note-50d7e344.svg",n$="/assets/shopify-info-e7b56221.svg",_o="/assets/shopify-colored-4b3dd339.svg",i$="/assets/unresolved-55738c62.svg",Xl="/assets/menu-d4d654ec.svg",l$="/assets/refresh-white-20d1695d.svg",r$={class:"activity-message"},d$={class:"message"},u$={class:"time"},c$=fe({__name:"ActivityMessage",props:{isUnresolvedMessage:{type:Boolean,default:!1},messageBody:{type:String,default:""},messageCreatedAt:{type:String,default:""}},setup(o){const s=o,t=b(()=>cs(s.messageCreatedAt,"h:mm A"));return(n,l)=>(a(),d("div",r$,[e("div",{class:O(["message-content",{"resolved-banner":o.messageBody.includes("resolved")&&!o.isUnresolvedMessage,"unresolved-banner":o.isUnresolvedMessage,"assignee-banner":o.messageBody.includes("assigned"),"block-activity unblocked":o.messageBody.toLowerCase().includes("unblocked"),"block-activity blocked":o.messageBody.toLowerCase().includes("user blocked")}])},[e("div",d$,I(o.messageBody),1),e("div",u$,I(t.value.value),1)],2)]))}});const m$=Oe(c$,[["__scopeId","data-v-6afafee9"]]),g$={class:"image-wrap"},p$=["src"],v$=["src"],f$={class:"description-wrap p-[12px]"},h$={class:"domain"},_$=["src"],y$={class:"title"},b$={class:"para"},w$=fe({__name:"LinkPreview",props:{isSender:{type:Boolean},linkPreview:{}},setup(o){const s=t=>{window.open(t,"_blank")};return(t,n)=>(a(),d("div",{key:t.linkPreview.preview.title.title,class:O(["link-preview--container cursor-pointer",{"link-preview-received--container":!t.isSender}]),onClick:n[1]||(n[1]=l=>s(t.linkPreview.url))},[e("div",g$,[t.linkPreview.preview.meta.image!==null?(a(),d("img",{key:0,src:t.linkPreview.preview.meta.image,alt:""},null,8,p$)):(a(),d("img",{key:1,src:`${p(De)}images/fallback-bg.png`,alt:""},null,8,v$))]),e("div",f$,[e("div",h$,[t.linkPreview.preview.meta.favicon!==null?(a(),d("img",{key:0,src:t.linkPreview.preview.meta.favicon},null,8,_$)):h("",!0),_e(" "+I(t.linkPreview.preview.domain),1)]),e("div",y$,[e("span",null,I(t.linkPreview.preview.title.title),1)]),e("p",b$,I(t.linkPreview.preview.meta.description),1)]),e("button",{onClick:n[0]||(n[0]=l=>s(t.linkPreview.url.includes("http")?t.linkPreview.url:`http://${t.linkPreview.url}`))},I("Visit page"))],2))}});const Fi=Oe(w$,[["__scopeId","data-v-172bcbc4"]]),er="/assets/edit-2-3e3fe47e.svg",Xa="/assets/trash-692ec4e9.svg",x$={class:"note--action"},C$={class:"action--listing"},k$={class:"options"},$$={src:er},S$={src:Xa},T$=fe({__name:"NoteActivityActions",props:{isMedia:{type:Boolean}},emits:["close","edit","delete"],setup(o,{expose:s,emit:t}){const n=t;return s({reset:()=>{n("close")}}),(i,m)=>{const r=He("svg-inline");return a(),d("div",x$,[e("div",C$,[e("div",k$,[i.isMedia?h("",!0):(a(),d("a",{key:0,href:"",class:"option-item",onClick:m[0]||(m[0]=Qe(u=>n("edit"),["prevent"]))},[F(e("img",$$,null,512),[[r]]),m[2]||(m[2]=e("span",null,"Edit Note",-1))])),e("a",{href:"",onClick:m[1]||(m[1]=Qe(u=>n("delete"),["prevent"])),class:"option-item"},[F(e("img",S$,null,512),[[r]]),m[3]||(m[3]=e("span",null,"Delete",-1))])])])])}}});const M$=Oe(T$,[["__scopeId","data-v-0b056cf6"]]),A$="/assets/download-2-b353c271.svg",E$=["src"],D$={src:A$,class:"w-6 h-6 text-grey900 mr-3"},I$={class:"pl-1"},F$=fe({__name:"MediaPreview",props:{showTime:{type:Boolean},time:{},media:{},isNote:{type:Boolean}},setup(o){const s=o,t=b(()=>{const u=s.media.content,g=s.media.type;return u&&(/\.(png|jpeg|jpg|gif)$/i.test(u)||l(g))}),n=b(()=>{if(s.media&&s.media.size){const u=s.media.size/1048576;return u>1?u.toFixed(1)+"MB":(u*1048).toFixed(1)+"KB"}return 0}),l=u=>(u==null?void 0:u.startsWith("image/"))&&u!=="image/svg+xml",i=b(()=>{if(s.media.content.length||s.media.original_file_name){const g=(s.media.original_file_name||s.media.content).split("/");let y=g[g.length-1];const c=30;if(y.length>c){const w=Math.floor(c/2);y=y.substr(0,w)+"..."+y.substr(-w)}return y}return""}),m=()=>{nt.emit("openModal",s.media.content)},r=()=>{window.open(s.media.content,"_blank")};return(u,g)=>{var c,w,f;const y=He("svg-inline");return a(),d("div",{class:O(["p-1.5",{"!bg-[#fff2e7] [&_svg]:!text-grey900":u.isNote,"other-file-wrapper":!t.value}])},[t.value?(a(),d("img",{key:0,src:(c=u.media)!=null&&c.thumbnail?(w=u.media)==null?void 0:w.thumbnail:(f=u.media)==null?void 0:f.content,class:"image-bubble cursor-zoom-in object-cover",onClick:m,width:"200",height:"200"},null,8,E$)):(a(),d("a",{key:1,href:"#",onClick:Qe(r,["prevent"]),class:"flex items-center rounded-lg p-10 bg-[rgba(147,147,157,0.15)]"},[F(e("img",D$,null,512),[[y]]),e("span",{class:O(["file-name mr-2",{"!text-grey900":u.isNote}])},I(i.value),3),e("span",{class:O(["text-[#93939D] ml-auto whitespace-nowrap",{"! text-grey900":u.isNote}])},I(n.value),3)])),u.showTime?(a(),d("div",{key:2,class:O(["flex items-center gap-1.5 text-[10px] leading-[14px] mt-1",u.isNote?"text-[#f69d01]":"text-[#83a1b7]"])},[e("div",I$,I(u.time),1),u.isNote?(a(),d(Se,{key:0},[g[0]||(g[0]=e("div",{class:"w-[3px] h-[3px] rounded-full bg-[#f69d01]"},null,-1)),g[1]||(g[1]=e("div",null,"Private Note",-1))],64)):h("",!0)],2)):h("",!0)],2)}}});const Pi=Oe(F$,[["__scopeId","data-v-a26b2a27"]]),eo="/assets/edit-3-85b21e3d.svg",P$={class:"text"},j$={class:"message-wrap--container"},L$={src:Xl,class:"w-6 h-6"},R$={class:"reminder-actions list-none"},B$={class:"my-2 hover:bg-gray-100"},N$={src:eo,alt:"edit",class:"w-4 h-4"},O$={class:"my-2 hover:bg-gray-100"},V$={src:Xa,alt:"trash",class:"w-6 h-6"},U$={class:"chat-message contents message [&>a]:underline [&>a]:text-sm [&>a]:text-orange-500"},G$={class:"details flex items-center"},W$={key:0,class:"time mr-2"},q$={class:"flex items-center justify-between"},H$={class:"mt-[4px]"},z$={src:To,class:"w-3 h-3"},K$={key:0,class:"time ml-0.5"},Y$={key:1,class:"time ml-0.5"},Z$={src:eo},J$={class:"profile--image"},Q$={class:"text-gray-600 text-md p-4"},X$={class:"flex items-center gap-1 p-1 py-2 reminder-actions-mobile border-t border-gray-200"},eS={src:Xa,alt:"trash",class:"w-5 h-5"},tS={src:eo,alt:"edit",class:"w-5 h-5"},sS=fe({__name:"ReminderNote",props:{isSender:{type:Boolean,default:!0},message:{type:Object,default:()=>{}},hasError:{type:Boolean,default:!1}},emits:["setEditReminder","onDeleteReminder"],setup(o,{emit:s}){const t=o,n=Ae(),{isSmallScreen:l}=hs(),i=$(!1),m=$(null),r=$(null),u=$(!1),g=$(!1),y=b(()=>n.user),c=b(()=>{var k;return((k=t.message.message_sender)==null?void 0:k.name)||""}),w=b(()=>t.message.agent_profle_photo||""),f=b(()=>{var k;return y.value&&((k=t.message.message_sender)==null?void 0:k.id)==y.value.attributes.agent_id}),v=s,C=()=>{v("setEditReminder",t.message.message_body)},_=()=>{v("setEditReminder",t.message.message_body,!0)},A=()=>{B(),C()},D=()=>{B(),g.value=!0},T=()=>{i.value=!i.value},B=()=>{u.value=!u.value},S=()=>{g.value=!1},E=()=>{v("onDeleteReminder"),S()},x=()=>{l.value&&P.value&&f.value&&!t.hasError&&B()},P=b(()=>!!t.message.remind_at),j=b(()=>!t.message.is_past_reminder),H=b(()=>{const k=t.message.remind_at;if(k){const M=k.replaceAll("-","/"),V=new Date(M+" UTC"),Z=Intl.DateTimeFormat().resolvedOptions().timeZone,ae=V.toLocaleString("en-US",{timeZone:Z}).replace(",","");return cs(ae,"DD/MM/YY h:mm A").value}return null});return(k,M)=>{const V=Pe("Thumbnail"),Z=Pe("Modal"),ae=He("svg-inline"),ce=He("click-away");return a(),d(Se,null,[e("div",{class:O(["chat--item",{"has--error":o.hasError}])},[e("div",P$,[e("div",j$,[o.isSender?(a(),d("div",{key:0,class:O(["message-wrap flex",{"relative z-[6]":i.value}])},[!p(l)&&j.value&&f.value&&!o.hasError?(a(),d("button",{key:0,onClick:T,ref_key:"toggleButtonRef",ref:r},[F(e("img",L$,null,512),[[ae]]),i.value?F((a(),d("div",{key:0,class:"absolute bg-white shadow-reminder-options rounded-lg w-[160px] -top-6 right-10 text-left z-[7]",ref_key:"reminderActionsRef",ref:m},[e("ul",R$,[e("li",B$,[e("button",{class:"edit w-100",onClick:C},[F(e("img",N$,null,512),[[ae]]),M[1]||(M[1]=e("span",{class:"ml-1"},"Edit Reminder",-1))])]),e("li",O$,[e("button",{class:"delete w-100",onClick:M[0]||(M[0]=J=>g.value=!0)},[F(e("img",V$,null,512),[[ae]]),M[2]||(M[2]=e("span",{class:"ml-1 text-[#FF4545]"},"Delete",-1))])])])])),[[ce,T]]):h("",!0)],512)):h("",!0),e("div",{class:"message-body--wrap",onClick:x},[e("span",U$,I(o.message.message_body),1),e("div",G$,[P.value?(a(),d("span",W$,I(H.value)+" •",1)):h("",!0),e("div",q$,[e("span",H$,[F(e("img",z$,null,512),[[ae]])]),o.hasError?(a(),d("span",K$,"Reminder wasn't set")):(a(),d("span",Y$,"Reminder"))])])])],2)):h("",!0)]),o.hasError?(a(),d("button",{key:0,class:"resend--button",onClick:_},[F(e("img",Z$,null,512),[[ae]]),M[3]||(M[3]=_e(" Edit Reminder "))])):h("",!0)]),e("div",J$,[t.isSender?(a(),ne(V,{key:0,"user-name":c.value,src:w.value},null,8,["user-name","src"])):h("",!0)])],2),u.value?(a(),ne(Z,{key:0,class:"reminder-modal",showFooter:!1,showHeaderClose:!1,headerTitle:"Reminder",headerTextRight:H.value,closeModal:u.value,onCloseModal:B},{default:K(()=>[e("div",Q$,I(o.message.message_body),1),e("div",X$,[e("button",{class:"delete w-100",onClick:D},[F(e("img",eS,null,512),[[ae]])]),e("button",{class:"edit",onClick:A},[F(e("img",tS,null,512),[[ae]]),M[4]||(M[4]=e("span",{class:"text-base ml-1"},"Edit",-1))])])]),_:1},8,["headerTextRight","closeModal"])):h("",!0),g.value?(a(),ne(Z,{key:1,class:"reminder-modal",headerTitle:"Delete Reminder",showFooter:!1,showHeaderClose:!0,closeModal:g.value,onCloseModal:S},{default:K(()=>[M[5]||(M[5]=e("div",{class:"flex flex-col items-center gap-1 p-4 m-[0px] pb-16"},[e("p",{class:"text-base m-0 !text-center text-grey900 pb-[1rem]"},"Are you sure you want to delete this reminder?")],-1)),e("div",{class:"actions flex flex-row justify-end items-center m-2"},[e("button",{class:"w-[5.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-grey100 text-grey900 inline",onClick:S},"Cancel"),e("button",{class:"w-[5.6875rem] py-[0.5625rem] flex flex-col gap-1 items-center justify-center bg-[#FF424D] text-white inline ml-2",onClick:E},"Delete")])]),_:1},8,["closeModal"])):h("",!0)],64)}}});const aS=["innerHTML"],oS=700,nS=fe({__name:"ChatMessage",props:{isRtl:{type:Boolean,default:!1},messageBody:{default:""},isSender:{type:Boolean,default:!1}},setup(o){const s=o,t=$(!0),n=$(700),l=b(()=>s.messageBody.split(" ")),i=b(()=>n.value<l.value.length),m=b(()=>l.value.slice(0,n.value).join(" ")),r=()=>{n.value+=oS,t.value=i.value};return(u,g)=>{const y=He("linkify");return a(),d("div",null,[e("div",null,[s.messageBody?F((a(),d("span",{key:0,ref:"content",class:O(["chat-message contents message [&>a]:underline [&>a]:text-sm [&>a]:text-orange-500",{isRtl:u.isRtl,isSender:u.isSender}]),innerHTML:m.value},null,10,aS)),[[y,{target:"_blank"},"options"]]):h("",!0),t.value&&i.value?(a(),d("a",{key:1,class:O(["text-sm pl-0.5 cursor-pointer text-orange-500",{isRtl:u.isRtl}]),onClick:r},"...show more",2)):h("",!0)])])}}});const ji=Oe(nS,[["__scopeId","data-v-293cb719"]]),iS={class:"profile--image"},lS={key:1},rS={key:0,src:i$,class:"!w-[30px] !h-[30px]"},dS={key:1,src:Jl,class:"!w-[30px] !h-[30px]"},uS={key:2,class:"unblocked !w-[30px] !h-[30px] inline-flex items-center justify-center rounded-[50%]"},cS={src:Qa,class:"!w-[15px] !h-[15px]"},mS={key:3,class:"blocked !w-[30px] !h-[30px] inline-flex items-center justify-center rounded-[50%]"},gS={src:Qa,class:"!w-[15px] !h-[15px]"},pS={key:0,class:"text"},vS={class:"message-wrap--container"},fS={key:0,class:"message-wrap"},hS={src:Xl},_S={key:2,class:"h-[310.8px] w-[314px]"},yS={key:4,class:"time"},bS={key:5,class:"message-status"},wS={src:Xn},xS={key:0,class:"message-status"},CS={src:l$},kS={key:1,class:"message-wrap"},$S={key:2,class:"h-[310.8px] w-[314px]"},SS={key:4,class:"text-[10px] gap-1 text-left font-normal text-[#83a1b7] mt-[5px] inline-flex items-center time"},TS={key:0},MS={class:"w-3 h-3",src:ho,alt:"messenger"},AS={key:5,class:"message-status"},ES={src:Xn},DS={class:"more--info"},IS={class:"status"},FS={class:"channel"},PS={key:0,src:ho},jS={key:1,src:So},LS=fe({__name:"ChatItem",props:{isSender:{type:Boolean,default:!0},hasError:{type:Boolean,default:!1},isRead:{type:Boolean,default:!1},isTranslationEnabled:{type:Boolean,default:!1},message:{type:Object,default:()=>{}},mentions:{type:Array,default:()=>[]},messageId:{type:String,default:""},conversationId:{type:String,default:""},lastReadMessage:{type:Object,default:()=>{}},lastSenderAgent:{type:Object,default:()=>{}}},emits:["editNote","setEditReminder"],setup(o,{emit:s}){const t=s,n=ct(),l=Ae(),{deleteReminder:i}=Hn(),{deleteNote:m}=Wn(),{resendMessage:r,getLinkPreview:u}=Yt(),g=o,y=ls(),c=$(!1),w=$(!1),f=$(null),v=$(!1),C=b(()=>l.user),_=b(()=>{var U;return((U=g.message.message_sender)==null?void 0:U.name)||""}),A=b(()=>g.message.agent_profle_photo||""),D=b(()=>g.message.is_system_message),T=b(()=>g.message.message_body.includes("unresolved")),B=b(()=>{var U,R;return X.value&&g.message.message_meta&&g.message.message_meta.note_html?g.message.message_meta.note_html:k.value&&j.value&&!g.message.is_sender_agent?j.value.translated_message:g.message.is_chat_init_details&&g.message.message_meta.message_html?g.message.message_meta.message_html:((R=(U=g.message)==null?void 0:U.message_meta)==null?void 0:R.content_html)||g.message.message_body}),S=b(()=>g.message.message_urls&&g.message.message_urls[0].content),E=b(()=>g.message.message_created_at),x=b(()=>(B.value||S.value)&&!!E.value),P=b(()=>g.message.message_link_previews),j=b(()=>g.message.translations&&g.message.translations.find(U=>U.language==H.value)),H=b(()=>l.preferredChatLanguage),k=b(()=>{var U,R;return(R=(U=n.selectedConversation)==null?void 0:U.attributes)==null?void 0:R.translation_setting}),M=b(()=>B.value===null?!1:P.value&&P.value.length>0),V=b(()=>Ds(B.value.charAt(0))),Z=b(()=>{var U,R;return(R=(U=l.user)==null?void 0:U.attributes)==null?void 0:R.team_id}),ae=b(()=>{var R,ee;let U=((ee=(R=g.message)==null?void 0:R.message_meta)==null?void 0:ee.url_previews)||[];return U&&U.length&&g.message.origin!=="email"?Array.from(new Set(U)).slice(0,3):U}),ce=()=>{if(!B.value||P.value&&P.value.length>0)return;const U=Tn(B.value);U&&U.length&&[...new Set(U)].slice(0,3).forEach(ee=>{u({messageId:g.messageId,url:ee})})},J=b(()=>cs(E,"h:mm A")),X=b(()=>g.message?g.message.type=="note":!1),z=b(()=>g.message?g.message.type=="reminder":!1),q=b(()=>{const U=cs(E,"DD MMM").value,R=cs(E,"h:mm A").value;return`${U} at ${R}`}),ue=b(()=>q.value),pe=b(()=>{var U,R;return(R=(U=n.selectedConversation)==null?void 0:U.attributes)==null?void 0:R.contact.src}),de=b(()=>g.hasError?"Message wasn't delivered":g.isRead||g.message.is_read_by_visitor?"Read":"Sent"),he=b(()=>{var U;return X.value&&C.value&&((U=g.message.message_sender)==null?void 0:U.id)==C.value.attributes.agent_id}),ve=()=>{c.value=!c.value},be=()=>{r({messageId:g.messageId,conversationId:g.conversationId,isNote:X.value})},re=U=>{U&&U.target.classList.contains("option-item")||(c.value=!1)},ie=()=>{re(),w.value=!0},xe=()=>{w.value=!1},N=()=>{c.value=!1,m({messageId:g.messageId,teamId:Z.value,conversationId:g.conversationId})},L=()=>{c.value=!1;const U={conversation_id:g.conversationId,message_id:g.messageId,message:g.message,message_meta:g.message.message_meta};t("editNote",U)},me=(U,R)=>{t("setEditReminder",U,g.messageId,g.message.remind_at,R)},G=()=>{const{id:U}=y.params;i({conversationId:U,teamId:Z.value,messageId:g.messageId})};return Xe(()=>{var U,R,ee,se,Y;(U=g.message)!=null&&U.tempMeta&&!((ee=(R=g.message)==null?void 0:R.meta)!=null&&ee.disable_preview)&&g.message.origin!=="email"&&(v.value=((se=g.message.message_body)==null?void 0:se.includes("http://"))||((Y=g.message.message_body)==null?void 0:Y.includes("https://")),v.value&&ce())}),(U,R)=>{const ee=Pe("Thumbnail"),se=Pe("VDropdown"),Y=Pe("Modal"),Fe=He("svg-inline"),oe=He("click-away");return a(),d("div",{class:O(["chat--item--container",{"is--received":!o.isSender,"is-note":X.value,relative:!0}])},[z.value?(a(),ne(sS,{key:0,"is-sender":o.isSender,message:o.message,hasError:o.hasError,onOnDeleteReminder:G,onSetEditReminder:me},null,8,["is-sender","message","hasError"])):(a(),d("div",{key:1,class:O(["chat--item",{"activity-chat--item":D.value,"has--error":o.hasError}])},[e("div",iS,[o.isSender&&!D.value?(a(),ne(ee,{key:0,"user-name":_.value,src:A.value},null,8,["user-name","src"])):h("",!0),D.value&&(B.value.includes("resolved")||B.value.includes("block"))?(a(),d("div",lS,[T.value?(a(),d("img",rS)):h("",!0),B.value.includes("resolved")&&!T.value?(a(),d("img",dS)):h("",!0),B.value.toLowerCase().includes("unblocked")?(a(),d("span",uS,[F(e("img",cS,null,512),[[Fe]])])):h("",!0),B.value.toLowerCase().includes("user blocked")?(a(),d("span",mS,[F(e("img",gS,null,512),[[Fe]])])):h("",!0)])):h("",!0),D.value&&!B.value.includes("resolved")&&!B.value.toLowerCase().includes("block")?(a(),ne(ee,{key:2,"user-name":_.value,src:A.value},null,8,["user-name","src"])):h("",!0),o.isSender?h("",!0):(a(),ne(ee,{key:3,"user-name":_.value,src:A.value},null,8,["user-name","src"]))]),D.value?h("",!0):(a(),d("div",pS,[W(se,{"no-auto-focus":"",triggers:["hover"],delay:300,placement:"top",disabled:o.hasError||!!X.value,container:"#chat-view-items-container"},{popper:K(()=>{var st,Le,le;return[e("div",DS,[e("div",IS,I(o.isSender?"Sent":"Received")+" "+I(`on ${ue.value}`),1),e("div",FS,[e("div",null,[pe.value==="messenger"&&!o.isSender?F((a(),d("img",PS,null,512)),[[Fe]]):F((a(),d("img",jS,null,512)),[[Fe]])]),e("span",null,I(pe.value==="messenger"&&!o.isSender?"Sent from Facebook Messenger":o.isRead&&o.isSender||(st=o.lastSenderAgent.attributes)!=null&&st.is_read_by_visitor?"Read from chat":`Sent from ${(Le=o.message)!=null&&Le.origin?(le=o.message)==null?void 0:le.origin:"chat"}`),1)])])]}),default:K(()=>[e("div",vS,[o.isSender?(a(),d("div",fS,[X.value&&he.value?(a(),d(Se,{key:0},[c.value?F((a(),ne(M$,{key:0,ref_key:"noteActivityActions",ref:f,isMedia:S.value,onClose:re,onDelete:ie,onEdit:L},null,8,["isMedia"])),[[oe,re]]):h("",!0),e("a",{href:"",class:"menu",onClick:Qe(ve,["prevent"])},[F(e("img",hS,null,512),[[Fe]])])],64)):h("",!0),S.value?(a(),ne(Pi,{key:1,media:o.message.message_urls[0],showTime:x.value,time:J.value.value,isNote:X.value,class:"message is-sender"},null,8,["media","showTime","time","isNote"])):h("",!0),B.value?(a(),d("div",{key:2,class:O(["message-body--wrap",{"h-[410px] w-[410px]":p(Tn)(B.value).length&&M.value&&p(n).uiFlags.isLinkPreviewLoading}])},[X.value?_i([B.value],()=>(a(),d("div",{key:0,class:O(["message [&>a]:underline [&>a]:text-orange-500",{isRtl:V.value}]),innerHTML:B.value},null,10,["innerHTML"])),R,0):(a(),ne(ji,{key:1,isRtl:V.value,messageBody:B.value,isSender:!0},null,8,["isRtl","messageBody"])),p(n).uiFlags.isLinkPreviewLoading&&p(n).linkMessageId===o.messageId?(a(),d("div",_S,[W(fs,{class:"before:!border-white"})])):h("",!0),ae.value.length&&ae.value[0].preview.is_valid||v.value?(a(),d("div",{key:3,class:O({"link-preview--grid":ae.value.length>1,"link-preview--grid-columntwo":ae.value.length===2})},[(a(!0),d(Se,null,Ne(ae.value,(st,Le)=>(a(),ne(Fi,{key:Le,isSender:o.isSender,"link-preview":st},null,8,["isSender","link-preview"]))),128))],2)):h("",!0),x.value?(a(),d("div",yS,I(J.value.value),1)):h("",!0),X.value?(a(),d("div",bS,[R[2]||(R[2]=_e("  •  ")),F(e("img",wS,null,512),[[Fe]]),R[3]||(R[3]=_e(" Private note "))])):(a(),d(Se,{key:6},[o.lastReadMessage.id===o.messageId||o.lastSenderAgent.id===o.messageId&&!o.lastSenderAgent.attributes.is_read_by_visitor?(a(),d("div",xS,"  • "+I(de.value),1)):h("",!0)],64))],2)):h("",!0),o.hasError?(a(),d("button",{key:3,class:"resend--button",onClick:be},[F(e("img",CS,null,512),[[Fe]]),R[4]||(R[4]=_e(" Resend message "))])):h("",!0)])):(a(),d("div",kS,[S.value?(a(),ne(Pi,{key:0,media:o.message.message_urls[0],showTime:x.value,time:J.value.value,class:"message is-not-sender"},null,8,["media","showTime","time"])):h("",!0),B.value?(a(),d("div",{key:1,class:O(["message-body--wrap",{"h-[410px] w-[410px]":p(Tn)(B.value).length&&M.value&&p(n).uiFlags.isLinkPreviewLoading}])},[X.value?_i([B.value],()=>(a(),d("div",{key:0,class:O(["message [&>a]:underline [&>a]:text-orange-500",{isRtl:V.value}]),innerHTML:B.value},null,10,["innerHTML"])),R,1):(a(),ne(ji,{key:1,isRtl:V.value,isSender:!1,messageBody:B.value},null,8,["isRtl","messageBody"])),p(n).uiFlags.isLinkPreviewLoading&&p(n).linkMessageId===o.messageId?(a(),d("div",$S,[W(fs)])):h("",!0),ae.value.length&&ae.value[0].preview.is_valid||v.value?(a(),d("div",{key:3,class:O({"link-preview--grid":ae.value.length>1,"link-preview--grid-columntwo":ae.value.length===2})},[(a(!0),d(Se,null,Ne(ae.value,(st,Le)=>(a(),ne(Fi,{key:Le,isSender:o.isSender,"link-preview":st},null,8,["isSender","link-preview"]))),128))],2)):h("",!0),x.value?(a(),d("div",SS,[pe.value==="messenger"?(a(),d("span",TS,[F(e("img",MS,null,512),[[Fe]])])):h("",!0),_e(" "+I(J.value.value),1)])):h("",!0),X.value?(a(),d("div",AS,[R[5]||(R[5]=_e("  •  ")),F(e("img",ES,null,512),[[Fe]]),R[6]||(R[6]=_e(" Private note "))])):h("",!0)],2)):h("",!0)]))])]),_:1},8,["disabled"])])),D.value?(a(),ne(m$,{key:1,"message-body":B.value,"is-unresolved-message":T.value,"message-created-at":E.value},null,8,["message-body","is-unresolved-message","message-created-at"])):h("",!0),w.value?(a(),ne(Vn,{key:2,to:"body"},[W(Y,{closeModal:!0,alertModal:!0,"header-title":"Delete Note?",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete Note",onActionButtonTypeOne:xe,onActionButtonTypeTwo:N,onCloseModal:xe},{default:K(()=>R[7]||(R[7]=[e("div",{class:"pt-2 pl-5 mb-6"},[e("p",null,"Are you sure you want to delete this note?")],-1)])),_:1})])):h("",!0)],2))],2)}}});const RS=Oe(LS,[["__scopeId","data-v-b3e29053"]]),ei="/assets/copy-code-gray-5296afac.svg",Li="/assets/plus-circle-6fc68b2d.svg",BS="/assets/phone-a8fda9a3.svg",NS="/assets/clock-3923df25.svg",OS="/assets/cloud-325b1f39.svg",VS="/assets/language-globe-14c14137.svg",US=o=>new Date().toLocaleString("en-US",{timeZone:o,hour:"numeric",minute:"numeric",hour12:!0}).split(" ").join("").toLocaleLowerCase(),GS=o=>{try{return!Intl||!Intl.DateTimeFormat().resolvedOptions().timeZone||typeof o!="string"?!1:(Intl.DateTimeFormat(void 0,{timeZone:o}),!0)}catch{return!1}},WS="/assets/tag-close-1d59356b.svg",tr="/assets/plus-circle-sm-92f7d167.svg",sr="/assets/add-e7156f22.svg",qS="/assets/tag-5925ec5d.svg",HS="/assets/no-result-c80249e3.svg",zS={key:0,class:"modal-header"},KS={class:"title"},YS={key:0,class:"label-status"},ZS={key:0,class:"alert-buttons--wrap"},JS={class:"action-buttons--wrap"},QS=fe({__name:"CustomOverlay",props:{closeModal:{type:Boolean},headerTitle:{default:""},label:{default:""},showFooter:{type:Boolean,default:!0},alertModal:{type:Boolean,default:!1},enableDelete:{type:Boolean,default:!0},isLoading:{type:Boolean},alertButtonText:{default:""},actionButtonTypeOneText:{default:""},actionButtonTypeTwoText:{default:""},modalBottom:{},modalLeft:{},modalRight:{},type:{default:""},useCustomStyle:{type:Boolean},customStyles:{}},emits:["closeModal","actionAlertButton","actionButtonTypeOne","actionButtonTypeTwo","closePicker"],setup(o,{emit:s}){const t=o,n=Ae(),l=s,i=$(!1),m=b(()=>n.isProUserOrTrial),r=()=>{l("actionAlertButton")},u=()=>{l("actionButtonTypeOne")},g=()=>{l("actionButtonTypeTwo")},y=()=>{l("closeModal")},c=()=>{l("closePicker")},w=b(()=>({bottom:t.modalBottom,position:"absolute",right:t==null?void 0:t.modalRight})),f=b(()=>{if(t.useCustomStyle)return t.customStyles;const C=window.innerWidth,_=window.innerHeight,A=700,D=480;let T=window.innerWidth||document.documentElement.clientWidth,B=(window.innerHeight||document.documentElement.clientHeight)+20;return T+A>C&&(T=C-A),B+D>_&&(B=_-D),T=Math.max(0,T),B=Math.max(0,B),{left:`${T}px`,top:`${B}px`}}),v=()=>{t.closeModal&&y()};return Xe(()=>{i.value=!0}),ps(()=>{i.value=!1}),(C,_)=>{const A=Pe("Loader");return a(),ne(ms,{name:"modal-fade"},{default:K(()=>[i.value?(a(),d("div",{key:0,class:"modal-wrap",transition:"modal",style:lt([C.type==="integration"?w.value:f.value]),onClick:v},[e("div",{class:"modal-container",onClick:_[0]||(_[0]=Qe(()=>{},["stop"]))},[C.headerTitle?(a(),d("div",zS,[e("span",KS,I(C.headerTitle),1),C.label?(a(),d("span",YS,I(C.label),1)):h("",!0)])):h("",!0),Ss(C.$slots,"default",{},void 0,!0),C.showFooter?(a(),d("div",{key:1,onClick:c,class:O(["modal-footer",{"modal-footer-with--alert":C.alertButtonText}])},[C.alertButtonText?(a(),d("div",ZS,[C.enableDelete?(a(),d("button",{key:0,class:"action-button-type--one font-normal action-button",onClick:r},[_[1]||(_[1]=e("img",{src:wo,alt:""},null,-1)),_e(" "+I(C.alertButtonText),1)])):h("",!0)])):h("",!0),e("div",JS,[C.actionButtonTypeOneText?(a(),d("button",{key:0,class:"action-button-type--one action-button",onClick:u},I(C.actionButtonTypeOneText),1)):h("",!0),C.actionButtonTypeTwoText&&(C.type==="integration"||m.value)?(a(),d("button",{key:1,class:O(["action-button-type--two action-button",{alert:C.alertModal}]),onClick:g},[_e(I(C.actionButtonTypeTwoText)+" ",1),C.isLoading?(a(),ne(A,{key:0,size:"12px"})):h("",!0)],2)):h("",!0),C.type!=="integration"&&!m.value?(a(),ne(Zo,{key:2})):h("",!0)])],2)):h("",!0)])],4)):h("",!0)]),_:3})}}});const Zs=Oe(QS,[["__scopeId","data-v-21042d24"]]),XS={class:"ch-grid gap-4"},eT=["onClick"],tT={src:sr,alt:"add icon"},sT={key:0,class:"bg-[#FFCB141A] rounded-lg mt-4"},aT={key:1,class:"flex justify-center py-[59px]"},oT={src:ca,alt:"dismiss modal button"},nT={key:2},iT={class:"pl-4 flex gap-0.5"},lT={class:"px-4 h-full max-h-[250px] overflow-y-auto"},rT={class:"flex justify-between items-center mb-4 cursor-pointer"},dT={class:"text-base text-grey900 mb-0 mt-0"},uT=["disabled","checked","onChange"],cT={key:0,class:"flex justify-center"},mT={src:HS,alt:""},gT={key:1,class:"pl-4 py-1.5 bg-grey100"},pT={src:en,alt:""},vT={class:"mb-0 mt-0 w-[365px] text-left"},fT=fe({__name:"AddTagModal",props:{showModal:{type:Boolean}},emits:["close"],setup(o,{emit:s}){const t=At(),n=ct(),l=Fa(),i=Ae(),{isAgent:m}=Xt(),r=$(!1),u=$(!1),g=$({hex:"#F3F9FF"}),y=$(""),c=$(!1),w=$(!1),f=s,v=Nt({name:"",chat_contact_id:"",color:"#373740"}),C=b(()=>l.uiFlags.isCreatingTag),_=b(()=>l.tags),A=b(()=>_.value.filter(ce=>ce.attributes.name.toLowerCase().includes(v.name.toLowerCase()))),D=b(()=>{if(v.name){const ce=v.name.toLowerCase();return _.value.filter(J=>{const X=J.attributes.name.toLowerCase();return new RegExp(`\\b${ce}\\b`,"i").test(X)})}return _.value}),T=b(()=>{const ce=[];return n.selectedConversation.attributes.tags.forEach(J=>{ce.push(J.id)}),ce}),B=b(()=>i.hasTrial),S=b(()=>i.trialDaysLeft),E=b(()=>{var ce;return(ce=i.user)==null?void 0:ce.attributes.pro_year_trial}),x=b(()=>{var ce;return B.value&&!E.value&&((ce=i.subscription)==null?void 0:ce.attributes.plan_type.toLowerCase())!=="pro"||E.value&&S.value<16&&S.value!==0&&S.value!==-1}),P=b(()=>i.isProUserOrTrial),j=ce=>{ce.stopPropagation(),r.value=!0},H=ce=>{v.color=ce,g.value.hex="#F3F9FF",M()},k=()=>{f("close")},M=()=>{r.value&&(r.value=!1)},V=(ce,J)=>{if(c.value=!0,ce.target.checked)y.value=J.attributes.name,v.color=J.attributes.color,v.chat_contact_id=n.selectedConversation.attributes.contact_id,l.createTag({name:J.attributes.name,chat_contact_id:n.selectedConversation.attributes.contact_id,color:J.attributes.color});else{const X={id:J.id,name:J.attributes.name,chat_contact_id:n.selectedConversation.attributes.contact_id,delete_from_all_contact:!1};l.deleteTag(X)}},Z=()=>{c.value=!1,v.chat_contact_id=n.selectedConversation.attributes.contact_id,l.createTag(v)},ae=()=>{if(m){w.value=!0;return}t.push({name:"settings-plans-view"})};return We(()=>g.value,()=>{var ce;r.value&&(v.color=(ce=g.value)==null?void 0:ce.hex)}),We(()=>l.isTagCreated,()=>{l.isTagCreated&&!c.value&&(v.name=""),l.isTagCreated&&(u.value=!1)}),(ce,J)=>{const X=Pe("InputField"),z=He("svg-inline");return a(),d("div",null,[W(Zs,{closeModal:ce.showModal,showFooter:u.value,isLoading:C.value,onCloseModal:k,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:k,onActionButtonTypeTwo:Z,onClosePicker:M},{default:K(()=>[u.value?(a(),d("div",{key:0,class:"add-custom-data-modal",onClick:M},[J[9]||(J[9]=e("h3",{class:"add-custom-data-modal--header"},"Create New Tag",-1)),W(X,{class:"input-field",label:"Name",value:v.name,type:"text",forValue:"name",placeholder:"Enter name here",onInput:J[0]||(J[0]=q=>v.name=q)},null,8,["value"]),J[10]||(J[10]=e("div",{class:"relative"},[e("label",{for:"",class:"text-sm text-grey600 mb-1"},"Select color")],-1)),e("div",XS,[(a(!0),d(Se,null,Ne(p(gl),(q,ue)=>(a(),d("a",{href:"#",key:ue,class:"color-view--wrap",onClick:Qe(pe=>H(q),["prevent"])},[e("div",{class:O(["w-6 h-6 rounded-full",{"border-2 border-[#93939D]":v.color===q}]),style:lt({background:q})},null,6)],8,eT))),128)),e("a",{onClick:j,class:O(["color-view--wrap custom cursor-pointer",{active:v.color==="custom"}])},[e("div",{class:"w-6 h-6 rounded-full flex items-center justify-center",style:lt({background:g.value.hex})},[F(e("img",tT,null,512),[[z]])],4)],2)]),x.value?(a(),d("div",sT,[e("div",{class:"text-grey900 text-xs leading-[140%] px-4 py-3"},[J[6]||(J[6]=e("span",{class:"text-grey900 font-semibold"},"Please note:",-1)),J[7]||(J[7]=_e(" that once the trial period ends, you won't be able to use Tags. ")),e("span",{onClick:ae,class:"text-grey900 underline cursor-pointer"},"Upgrade to Pro"),J[8]||(J[8]=_e(" so that you can continue using the tags you create "))])])):h("",!0)])):h("",!0),!u.value&&!_.value.length?(a(),d("div",aT,[e("button",{class:"button--text close--button",onClick:k},[F(e("img",oT,null,512),[[z]])]),e("div",null,[J[11]||(J[11]=e("p",{class:"text-sm text-gray900 text-center"},"No tags yet...",-1)),e("button",{onClick:J[1]||(J[1]=q=>u.value=!0),class:"bg-grey900 text-white text-sm rounded-[4px] px-2 py-1.5"},"Create New Tag")])])):h("",!0),_.value.length&&!u.value?(a(),d("div",nT,[e("div",iT,[J[12]||(J[12]=e("img",{src:qS,alt:"tag icon"},null,-1)),F(e("input",{type:"text",class:"tag--search placeholder-grey-300",placeholder:"Search or add new tag","onUpdate:modelValue":J[2]||(J[2]=q=>v.name=q)},null,512),[[bt,v.name]])]),J[14]||(J[14]=e("div",{class:"bg-grey200 h-px w-full mb-4"},null,-1)),e("div",lT,[(a(!0),d(Se,null,Ne(A.value,q=>(a(),d("div",{key:q.id,class:""},[e("label",rT,[e("span",dT,I(q.attributes.name),1),e("input",{class:"w-4 h-4 cursor-pointer",disabled:!P.value,type:"checkbox",checked:T.value.includes(q.id),onChange:ue=>V(ue,q)},null,40,uT)])]))),128))]),e("div",null,[A.value.length?h("",!0):(a(),d("div",cT,[e("div",null,[F(e("img",mT,null,512),[[z]]),J[13]||(J[13]=e("p",{class:"text-grey900 text-sm text-center mt-[-15px]"},"No results",-1))])])),D.value.length?h("",!0):(a(),d("div",gT,[e("div",{onClick:J[3]||(J[3]=q=>u.value=!0),class:"flex gap-1.5 cursor-pointer"},[F(e("img",pT,null,512),[[z]]),e("p",vT,'Create "'+I(v.name)+'"',1)])]))])])):h("",!0),r.value?F((a(),ne(p(ia),{key:3,class:"absolute top-[75%] right-0 z-10",disableAlpha:!0,modelValue:g.value,"onUpdate:modelValue":J[4]||(J[4]=q=>g.value=q)},null,8,["modelValue"])),[[p(Is),M]]):h("",!0)]),_:1},8,["closeModal","showFooter","isLoading"]),W(ko,{showModal:w.value,onCloseModal:J[5]||(J[5]=q=>w.value=!1)},null,8,["showModal"])])}}});const hT=Oe(fT,[["__scopeId","data-v-1073fc3d"]]),_T={class:"delete-custom-field"},yT={class:"delete-globally cursor-pointer"},bT=fe({__name:"DeleteTagModal",props:{showModal:{type:Boolean},tag:{}},emits:["close"],setup(o,{emit:s}){const t=ct(),n=Fa(),l=o,i=s,m=$(!1),r=b(()=>n.uiFlags.isDeletingTag),u=()=>{i("close")},g=async()=>{const c={chat_contact_id:t.selectedConversation.attributes.contact_id,id:l.tag.id,name:l.tag.name,delete_from_all_contact:m.value};await n.deleteTag(c)};return(y,c)=>y.showModal?(a(),ne(Zs,{key:0,closeModal:y.showModal,alertModal:!0,showFooter:!0,isLoading:r.value,onCloseModal:u,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete",onActionButtonTypeOne:u,onActionButtonTypeTwo:g},{default:K(()=>[e("div",_T,[c[2]||(c[2]=e("p",null,"Are you sure you want to delete this tag?",-1)),e("label",yT,[F(e("input",{type:"checkbox","onUpdate:modelValue":c[0]||(c[0]=w=>m.value=w)},null,512),[[Ia,m.value]]),c[1]||(c[1]=e("span",null,"Delete from all contacts/conversation",-1))])])]),_:1},8,["closeModal","isLoading"])):h("",!0)}});const ar=Oe(bT,[["__scopeId","data-v-a2958ab0"]]),wT={class:"ch-grid gap-4"},xT=["onClick"],CT={src:sr},kT={key:0,class:"bg-[#FFCB141A] rounded-lg mt-4"},$T=fe({__name:"EditTagModal",props:{showModal:{type:Boolean},tag:{}},emits:["close"],setup(o,{emit:s}){const t=At(),n=Fa(),l=jt(),i=ct(),m=Ae(),r=o,u=$(!1),g=$({hex:"#F3F9FF"}),y=s,c=Nt({name:"",id:"",color:""}),w=b(()=>n.uiFlags.isUpdatingTag),f=b(()=>n.showDeleteTagModal),v=b(()=>l.selectedSegment),C=b(()=>m.hasTrial),_=b(()=>m.trialDaysLeft),A=b(()=>{var k;return(k=m.user)==null?void 0:k.attributes.pro_year_trial}),D=b(()=>{var k;return C.value&&!A.value&&((k=m.subscription)==null?void 0:k.attributes.plan_type.toLowerCase())!=="pro"||A.value&&_.value<16&&_.value!==0&&_.value!==-1}),T=()=>{n.showDeleteTagModal=!1},B=k=>{k.stopPropagation(),u.value=!0},S=()=>{u.value&&(u.value=!1)},E=k=>{c.color=k,g.value.hex="#F3F9FF",S()},x=()=>{y("close")},P=async()=>{const k=i.selectedConversation;await n.updateTag(c),v.value.id&&nt.emit("fetchSegmentConversation",{segmentId:v.value.id,conversationId:k.id})},j=()=>{t.push({name:"settings-plans-view"})},H=()=>{c.id=r.tag.id,c.name=r.tag.name,c.color=r.tag.color};return Xe(()=>{H()}),We(()=>g.value,()=>{var k;u.value&&(c.color=(k=g.value)==null?void 0:k.hex)}),(k,M)=>{const V=Pe("InputField"),Z=He("svg-inline");return a(),d("div",null,[k.showModal?(a(),ne(Zs,{key:0,closeModal:k.showModal,showFooter:!0,isLoading:w.value,alertButtonText:"Delete Tag",enableDelete:!0,onCloseModal:x,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:x,onActionButtonTypeTwo:P,onActionAlertButton:M[2]||(M[2]=ae=>p(n).showDeleteTagModal=!0),onClosePicker:S},{default:K(()=>[e("div",{class:"add-custom-data-modal p-4",onClick:S},[M[6]||(M[6]=e("h3",{class:"text-base text-gray900 font-semibold leading-[22.4px] mb-4"},"Edit Tag",-1)),W(V,{class:"input-field mb-[22px]",label:"Name",value:c.name,type:"text",forValue:"name",placeholder:"Enter name here",onInput:M[0]||(M[0]=ae=>c.name=ae)},null,8,["value"]),M[7]||(M[7]=e("div",{class:"relative"},[e("label",{for:"",class:"text-sm text-grey600 mb-1"},"Select color")],-1)),e("div",wT,[(a(!0),d(Se,null,Ne(p(gl),(ae,ce)=>(a(),d("a",{href:"#",key:ce,class:"color-view--wrap",onClick:Qe(J=>E(ae),["prevent"])},[e("div",{class:O(["w-6 h-6 rounded-full",{"border-2 border-[#93939D]":c.color===ae}]),style:lt({background:ae})},null,6)],8,xT))),128)),e("a",{onClick:Qe(B,["prevent"]),class:O(["color-view--wrap custom cursor-pointer",{active:c.color==="custom"}])},[e("div",{class:"w-6 h-6 rounded-full flex items-center justify-center",style:lt({background:g.value.hex})},[F(e("img",CT,null,512),[[Z]])],4)],2)]),D.value?(a(),d("div",kT,[e("div",{class:"text-grey900 text-xs leading-[140%] px-4 py-3"},[M[3]||(M[3]=e("span",{class:"text-grey900 font-semibold"},"Please note:",-1)),M[4]||(M[4]=_e(" that once the trial period ends, you won't be able to use Tags. ")),e("span",{onClick:j,class:"text-grey900 underline cursor-pointer"},"Upgrade to Pro"),M[5]||(M[5]=_e(" so that you can continue using the tags you create "))])])):h("",!0)]),F(W(p(ia),{class:"absolute top-[75%] right-0 z-10",disableAlpha:!0,modelValue:g.value,"onUpdate:modelValue":M[1]||(M[1]=ae=>g.value=ae)},null,8,["modelValue"]),[[Gt,u.value],[p(Is),S]])]),_:1},8,["closeModal","isLoading"])):h("",!0),f.value?F((a(),ne(ar,{key:1,showModal:f.value,tag:k.tag,onClose:T},null,8,["showModal","tag"])),[[p(Is),T]]):h("",!0)])}}}),ST={key:0,class:"ch-grid gap-2 mb-2"},TT={class:"relative"},MT={class:"tag"},AT=["onClick"],ET={class:"absolute z right-[-7px] top-[-4px] tag--action"},DT=["onClick"],IT={class:"text-white",type:"button",src:WS,alt:""},FT={class:"relative w-[30%]"},PT=["disabled"],jT={src:tr,alt:"add icon"},LT=fe({__name:"TagList",props:{isShowTags:{type:Boolean}},setup(o){const s=Ae(),t=Fa(),n=ct(),l=$({}),i=b(()=>{var C;return(C=n.selectedConversation.attributes)==null?void 0:C.tags}),m=b(()=>t.showAddTagModal),r=b(()=>t.showEditTagModal),u=b(()=>t.showDeleteTagModal),g=()=>{t.showAddTagModal=!0},y=C=>{l.value=C,t.showEditTagModal=!0},c=C=>{l.value=C,t.showDeleteTagModal=!0},w=()=>{t.showAddTagModal=!1},f=()=>{t.showEditTagModal=!1},v=()=>{t.showDeleteTagModal=!1};return(C,_)=>{var T;const A=Pe("VDropdown"),D=He("svg-inline");return a(),d(Se,null,[(T=i.value)!=null&&T.length&&!p(s).isProductTourRunning?(a(),d("div",ST,[(a(!0),d(Se,null,Ne(i.value,B=>(a(),d("div",{key:B.id},[e("div",TT,[e("div",MT,[e("button",{onClick:S=>y(B),style:lt({background:B.color}),class:O(["px-2 py-[3px] rounded text-xs font-normal leading-5 bg-[#373740]",p(gu)(B.color)?"text-grey900":"text-white"])},I(B.name),15,AT),e("div",ET,[e("div",null,[W(A,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>_[0]||(_[0]=[e("p",{class:"tag--tooltip"},"Delete",-1)])),default:K(()=>[e("button",{onClick:S=>c(B),class:"button--text"},[F(e("img",IT,null,512),[[D]])],8,DT)]),_:2},1024)])])])])]))),128)),r.value?F((a(),ne($T,{key:0,showModal:r.value,tag:l.value,onClose:f},null,8,["showModal","tag"])),[[p(Is),f]]):h("",!0),u.value?F((a(),ne(ar,{key:1,showModal:u.value,tag:l.value,onClose:v},null,8,["showModal","tag"])),[[p(Is),v]]):h("",!0)])):h("",!0),e("div",FT,[m.value?F((a(),ne(hT,{key:0,showModal:m.value,onClose:w},null,8,["showModal"])),[[p(Is),w]]):h("",!0),e("button",{disabled:p(s).showEmailOfflineVisitorModal||p(s).isProductTourRunning,class:O(["whitespace-nowrap tag-btn disabled:!bg-grey100",{"active-custom-data-btn":m.value}]),onClick:g},[F(e("img",jT,null,512),[[D]]),_[1]||(_[1]=_e(" Add Tag "))],10,PT)])],64)}}});const RT=Oe(LT,[["__scopeId","data-v-bfb431fa"]]),BT="/assets/edit-dark-17c06875.svg",NT={class:"add-custom-data-modal"},OT={class:"o-combobox"},VT={class:"input-field-text"},UT={class:"o-combobox__container"},GT={key:0,class:"o-date-list overflow-y-auto"},WT=["onClick"],qT={key:0,class:"bg-[#FFCB141A] rounded-lg"},HT=fe({__name:"AddCustomDataModal",props:{showModal:{type:Boolean}},emits:["close"],setup(o,{emit:s}){const t=ct(),n=Pa(),l=jt(),i=ze(),m=At(),r=Ae(),{isAgent:u}=Xt(),g=s,y=$(!1),c=$(null),w=$(!1),f=Nt({name:"",value:"",chat_contact_id:"",oldValue:""}),v=b(()=>n.uiFlags.isCreatingCustomFields),C=b(()=>l.selectedSegment),_=b(()=>n.customFields),A=b(()=>f.name?n.customFields.filter(Z=>Z.attributes.name.toLowerCase().includes(f.name.toLowerCase())):n.customFields),D=b(()=>{if(f.name){const Z=f.name.toLowerCase();return n.customFields.filter(ae=>{const ce=ae.attributes.name.toLowerCase();return new RegExp(`\\b${Z}\\b`,"i").test(ce)})}return n.customFields}),T=b(()=>r.hasTrial),B=b(()=>r.trialDaysLeft),S=b(()=>{var Z;return(Z=r.user)==null?void 0:Z.attributes.pro_year_trial}),E=b(()=>{var Z;return T.value&&!S.value&&((Z=r.subscription)==null?void 0:Z.attributes.plan_type.toLowerCase())!=="pro"||S.value&&B.value<16&&B.value!==0&&B.value!==-1}),x=()=>{g("close")},P=()=>{setTimeout(()=>{y.value=!1},500)},j=()=>{y.value=!y.value},H=(Z,ae)=>{y.value=!1,c.value=ae;const ce=t.selectedConversation.attributes.custom_data.find(J=>J.name===Z.attributes.name);if(!ce){f.name=Z.attributes.name,f.value="";return}f.name=ce.name,ce.value&&(f.value=ce.value,f.oldValue=ce.value)},k=()=>{if(_.value.findIndex(ae=>ae.attributes.name.toLowerCase()===f.name.toLowerCase())>-1){const ae=t.selectedConversation.attributes.custom_data.find(ce=>ce.name.toLowerCase()===f.name.toLowerCase());if(!ae)return;f.name=ae.name,ae.value&&(f.value=ae.value,f.oldValue=ae.value)}else f.oldValue=""},M=async()=>{var ae;const Z=t.selectedConversation;if(!f.name&&!f.value){i.set({message:"Missing input",type:"error"});return}f.chat_contact_id=(ae=t.selectedConversation)==null?void 0:ae.attributes.contact_id,await n.createCustomField(f),C.value.id&&nt.emit("fetchSegmentConversation",{segmentId:C.value.id,conversationId:Z.id})},V=()=>{if(u){w.value=!0;return}m.push({name:"settings-plans-view"})};return(Z,ae)=>{const ce=Pe("InputField");return a(),d("div",null,[Z.showModal?(a(),ne(Zs,{key:0,closeModal:Z.showModal,showFooter:!0,isLoading:v.value,onCloseModal:x,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:x,onActionButtonTypeTwo:M},{default:K(()=>[e("div",NT,[ae[7]||(ae[7]=e("h3",{class:"add-custom-data-modal--header"},"Add/Create New Custom Data",-1)),e("div",OT,[e("div",VT,[ae[3]||(ae[3]=e("label",null,"Name",-1)),e("div",UT,[F(e("input",{class:O(["o-combobox__input",{"o-combobox__container__active":y.value}]),type:"text",placeholder:"Select or create new custom data","onUpdate:modelValue":ae[0]||(ae[0]=J=>f.name=J),onInput:k,onFocusin:j,onBlur:P},null,34),[[bt,f.name]]),y.value?(a(),d("img",{key:0,onClick:j,src:Qt,alt:"chevron-up",class:"custom-field--selector"})):(a(),d("img",{key:1,onClick:Qe(j,["prevent"]),src:Tt,alt:"chevron-down",class:"custom-field--selector"}))])]),y.value?(a(),d("ul",GT,[(a(!0),d(Se,null,Ne(A.value,(J,X)=>(a(),d("li",{class:O(["o-date-list__item",{"o-date-list__item--selected":X===c.value}]),key:J.id,onClick:z=>H(J,X)},I(J.attributes.name),11,WT))),128)),!D.value.length&&f.name.length?(a(),d("li",{key:0,onClick:j,class:"o-date-list__item"},"Create "+I(f.name),1)):h("",!0)])):h("",!0)]),W(ce,{class:"input-field",label:"Value",value:f.value,type:"text",forValue:"value",placeholder:"Enter value here",onInput:ae[1]||(ae[1]=J=>f.value=J)},null,8,["value"]),E.value?(a(),d("div",qT,[e("div",{class:"text-grey900 text-xs leading-[140%] px-4 py-3"},[ae[4]||(ae[4]=e("span",{class:"text-grey900 font-semibold"},"Please note:",-1)),ae[5]||(ae[5]=_e(" that once the trial period ends, you won't be able to use Custom data. ")),e("span",{onClick:V,class:"text-grey900 underline cursor-pointer"},"Upgrade to Pro"),ae[6]||(ae[6]=_e(" so that you can continue using the Custom data you create "))])])):h("",!0)])]),_:1},8,["closeModal","isLoading"])):h("",!0),W(ko,{showModal:w.value,onCloseModal:ae[2]||(ae[2]=J=>w.value=!1)},null,8,["showModal"])])}}});const zT=Oe(HT,[["__scopeId","data-v-23ecc28b"]]),KT={class:"delete-custom-field"},YT={class:"delete-globally"},ZT=fe({__name:"DeleteCustomFieldModal",props:{showModal:{type:Boolean},customData:{}},emits:["close"],setup(o,{emit:s}){const t=ct(),n=Pa(),l=o,i=s,m=$(!1),r=b(()=>n.uiFlags.isDeletingCustomFields),u=()=>{i("close")},g=async()=>{var w;const c={chat_contact_id:(w=t.selectedConversation)==null?void 0:w.attributes.contact_id,id:l.customData.id,name:l.customData.name,delete_from_all_contact:m.value};await n.deleteCustomField(c)};return(y,c)=>y.showModal?(a(),ne(Zs,{key:0,closeModal:y.showModal,alertModal:!0,showFooter:!0,isLoading:r.value,onCloseModal:u,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete",onActionButtonTypeOne:u,onActionButtonTypeTwo:g},{default:K(()=>[e("div",KT,[c[2]||(c[2]=e("p",null,"Are you sure you want to delete this custom data field?",-1)),e("label",YT,[F(e("input",{type:"checkbox","onUpdate:modelValue":c[0]||(c[0]=w=>m.value=w)},null,512),[[Ia,m.value]]),c[1]||(c[1]=e("span",null,"Delete from all contacts/conversation",-1))])])]),_:1},8,["closeModal","isLoading"])):h("",!0)}});const JT=Oe(ZT,[["__scopeId","data-v-87a6a964"]]),QT={class:"add-custom-data-modal"},XT={class:"o-combobox"},eM={class:"input-field-text"},tM={class:"o-combobox__container"},sM={key:0,class:"o-date-list overflow-y-auto"},aM=["onClick"],oM=fe({__name:"EditCustomDataModal",props:{showModal:{type:Boolean},customData:{}},emits:["close"],setup(o,{emit:s}){const t=ct(),n=jt(),l=Pa(),i=o,m=s,r=$(!1),u=$(null),g=Nt({name:"",oldValue:"",oldName:"",value:"",chat_contact_id:"",id:""}),y=b(()=>l.uiFlags.isUpdatingCustomFields),c=b(()=>n.selectedSegment),w=b(()=>g.name?l.customFields.filter(B=>B.attributes.name.toLowerCase().includes(g.name.toLowerCase())):l.customFields),f=b(()=>{if(g.name){const B=g.name.toLowerCase();return l.customFields.filter(S=>{const E=S.attributes.name.toLowerCase();return new RegExp(`\\b${B}\\b`,"i").test(E)})}return l.customFields}),v=()=>{m("close")},C=()=>{setTimeout(()=>{r.value=!1},500)},_=()=>{r.value=!r.value},A=B=>{r.value=!1,u.value=B,g.name=w.value[B].attributes.name},D=async()=>{const B=t.selectedConversation;if(!g.name){ze().set({message:"The name field is required",type:"error"});return}if(!g.value){ze().set({message:"The value field is required",type:"error"});return}g.chat_contact_id=t.selectedConversation.attributes.contact_id;const S=l.customFields.find(E=>E.attributes.name.toLowerCase()===g.name.toLowerCase());if(g.oldName!==g.name&&S){ze().set({message:"The name field can only be updated to a new one",type:"error"});return}g.oldName!==g.name&&await l.updateCustomFieldName(g),g.oldValue!==g.value&&g.oldName===g.name&&await l.updateCustomFieldValue(g),c.value.id&&nt.emit("fetchSegmentConversation",{segmentId:c.value.id,conversationId:B.id})},T=()=>{g.id=i.customData.id,g.name=i.customData.name,g.oldName=i.customData.name,g.oldValue=i.customData.value,g.value=i.customData.value,g.chat_contact_id=t.selectedConversation.attributes.contact_id};return Xe(()=>{T()}),(B,S)=>{const E=Pe("InputField");return B.showModal?(a(),ne(Zs,{key:0,closeModal:B.showModal,showFooter:!0,isLoading:y.value,onCloseModal:v,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:v,onActionButtonTypeTwo:D},{default:K(()=>[e("div",QT,[S[5]||(S[5]=e("h3",{class:"add-custom-data-modal--header"},"Edit Custom Data",-1)),e("div",XT,[e("div",eM,[S[4]||(S[4]=e("label",null,"Name",-1)),e("div",tM,[F(e("input",{class:O(["o-combobox__input",{"o-combobox__container__active":r.value}]),type:"text",placeholder:"Select or create new custom data","onUpdate:modelValue":S[0]||(S[0]=x=>g.name=x),onClick:S[1]||(S[1]=x=>r.value=!0),onKeyup:S[2]||(S[2]=Ut(Qe(x=>A(u.value),["prevent"]),["enter"])),onBlur:C},null,34),[[bt,g.name]]),r.value?(a(),d("img",{key:0,onClick:_,src:Qt,alt:"chevron-up",class:"custom-field--selector"})):(a(),d("img",{key:1,onClick:_,src:Tt,alt:"chevron-down",class:"custom-field--selector"}))])]),r.value?(a(),d("ul",sM,[(a(!0),d(Se,null,Ne(w.value,(x,P)=>(a(),d("li",{class:O(["o-date-list__item",{"o-date-list__item--selected":P===u.value}]),key:x.id,onClick:j=>A(P)},I(x.attributes.name),11,aM))),128)),f.value.length?h("",!0):(a(),d("li",{key:0,onClick:_,class:"o-date-list__item"},"Update to "+I(g.name),1))])):h("",!0)]),W(E,{class:"input-field",label:"Value",value:g.value,type:"text",forValue:"value",placeholder:"Enter value here",onInput:S[3]||(S[3]=x=>g.value=x)},null,8,["value"])])]),_:1},8,["closeModal","isLoading"])):h("",!0)}}});const nM=Oe(oM,[["__scopeId","data-v-fb2665b0"]]),iM={key:0,class:"custom-data"},lM={class:"",style:{position:"relative"}},rM={class:"custom-data--item"},dM={class:"custom-data--title max-w-[117px]"},uM={class:"custom-data--action"},cM={class:"custom-data--action--item"},mM=["onClick"],gM={type:"button",src:BT,alt:""},pM=["onClick"],vM={src:ei,alt:""},fM=["onClick"],hM={src:wo,alt:""},_M={class:"flex items-center custom-data--value mb-0 text-primary"},yM=["href"],bM={class:"text-primary"},wM={key:1,class:"truncate"},xM={style:{position:"relative"}},CM=["disabled"],kM={src:tr},$M=fe({__name:"CustomDataList",props:{isShowCustomData:{type:Boolean}},setup(o){const s=ct(),t=Pa(),n=Ae(),l=$({}),i=Nt({x:0,y:0}),m=b(()=>{var A;return(A=s.selectedConversation.attributes)==null?void 0:A.custom_data}),r=b(()=>t.showAddCustomDataModal),u=b(()=>t.showEditCustomDataModal),g=b(()=>t.showDeleteCustomFieldModal),y=()=>{t.showAddCustomDataModal=!0},c=A=>{l.value=A,t.showEditCustomDataModal=!0},w=A=>{l.value=A,t.showDeleteCustomFieldModal=!0},f=()=>{t.showAddCustomDataModal=!1},v=()=>{t.showEditCustomDataModal=!1},C=()=>{t.showDeleteCustomFieldModal=!1},_=A=>{navigator.clipboard.writeText(A),ze().set({message:"Data copied successfully",type:"success"})};return(A,D)=>{var S;const T=Pe("VDropdown"),B=He("svg-inline");return a(),d(Se,null,[(S=m.value)!=null&&S.length&&!p(n).isProductTourRunning?(a(),d("div",iM,[(a(!0),d(Se,null,Ne(m.value,E=>(a(),d("div",{key:E.id,class:"custom-data--container"},[e("div",lM,[e("div",rM,[e("p",dM,I(E.name),1),e("div",uM,[e("div",cM,[e("div",null,[W(T,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>D[0]||(D[0]=[e("p",{class:"custom-data--tooltip"},"Edit",-1)])),default:K(()=>[e("button",{onClick:x=>c(E),class:"button--text"},[F(e("img",gM,null,512),[[B]])],8,mM)]),_:2},1024)]),W(T,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>D[1]||(D[1]=[e("p",{class:"custom-data--tooltip"},"Copy",-1)])),default:K(()=>[e("button",{onClick:x=>_(E.value),class:"button--text"},[F(e("img",vM,null,512),[[B]])],8,pM)]),_:2},1024),W(T,{triggers:["hover"],delay:300,placement:"top"},{popper:K(()=>D[2]||(D[2]=[e("p",{class:"custom-data--tooltip"},"Delete",-1)])),default:K(()=>[e("button",{onClick:x=>w(E),class:"button--text"},[F(e("img",hM,null,512),[[B]])],8,fM)]),_:2},1024)])])]),e("p",_M,[E.value.includes("http://")||E.value.includes("https://")?(a(),d("a",{key:0,class:"truncate",href:E.value,target:"_blank"},[e("span",bM,I(E.value),1)],8,yM)):(a(),d("span",wM,I(E.value),1))])])]))),128)),u.value?F((a(),ne(nM,{key:0,showModal:u.value,customData:l.value,position:i,onClose:v},null,8,["showModal","customData","position"])),[[p(Is),v]]):h("",!0),g.value?F((a(),ne(JT,{key:1,showModal:g.value,customData:l.value,position:i,onClose:C},null,8,["showModal","customData","position"])),[[p(Is),C]]):h("",!0)])):h("",!0),e("div",xM,[r.value?F((a(),ne(zT,{key:0,position:i,showModal:r.value,onClose:f},null,8,["position","showModal"])),[[p(Is),f]]):h("",!0),e("button",{disabled:p(n).showEmailOfflineVisitorModal||p(n).isProductTourRunning,class:O(["custom-data-btn disabled:!bg-grey100",{"active-custom-data-btn":r.value}]),onClick:y},[F(e("img",kM,null,512),[[B]]),D[3]||(D[3]=_e(" Add Custom "))],10,CM)])],64)}}});const SM=Oe($M,[["__scopeId","data-v-c2f34806"]]),TM={class:"fixed top-[130px] lg:top-[140px] right-2.5 sm:right-[54px] lg:right-[90px] xl:right-[100px] 2xl:right-[138px] z-10 bg-white shadow-2xl w-[368px] rounded-lg"},MM={class:"p-4 border-b border-grey200"},AM={class:"p-4 flex items-center justify-end gap-3"},EM=["disabled"],DM=fe({__name:"NameEditModal",emits:["toggle-name-edit-modal"],setup(o,{emit:s}){const t=s,n=Ae(),{updateChatContact:l}=ss(),i=za("activeConversation"),m=i==null?void 0:i.value.attributes.contact,r=$(""),u=$(!1),g=b(()=>(m==null?void 0:m.contact_name)||(m==null?void 0:m.name)),y={contactName:{required:Ye.withMessage("Name is required",ut),minLength:Gr(1),maxLength:Ye.withMessage("Name must be less than 255 characters",It(255))}},c=bs(y,{contactName:r}),w=()=>{t("toggle-name-edit-modal")},f=async()=>{var C,_;if(c.value.$touch(),c.value.$invalid||r.value==g.value)return;u.value=!0;const v={team_id:(C=n.user)==null?void 0:C.attributes.team_id,chat_contact_id:m==null?void 0:m.id,conversation_id:(_=i==null?void 0:i.value)==null?void 0:_.id,name:r.value};try{await l(v),w()}catch(A){Ze(A),ht(A)}finally{u.value=!1}};return Xe(()=>{r.value=g.value}),(v,C)=>{const _=Pe("InputField"),A=He("click-away");return F((a(),d("div",TM,[e("div",MM,[C[1]||(C[1]=e("div",{class:"text-base font-semibold text-grey900 mb-4"},"Update Name",-1)),W(_,{value:r.value,onInput:C[0]||(C[0]=D=>r.value=D),onKeyup:Ut(f,["enter"]),hasError:p(c).contactName.$error,validationMessage:p(c).contactName.$errors,forValue:"name",label:"Name",type:"text",placeholder:"Name",classes:"!py-1 !px-2 !rounded-lg"},null,8,["value","hasError","validationMessage"])]),e("div",AM,[e("button",{onClick:w,class:"bg-grey100 py-1.5 px-2 text-grey900"},"Cancel"),e("button",{onClick:f,disabled:p(c).contactName.$error||u.value||r.value==g.value,class:"bg-grey900 py-1.5 px-[18px] text-white"},I(u.value?"Saving...":"Save"),9,EM)])])),[[A,w]])}}}),IM={class:"fixed top-[160px] lg:top-[170px] right-2.5 sm:right-[74px] lg:right-[110px] xl:right-[122px] z-10 bg-white shadow-2xl w-[368px] rounded-lg"},FM={class:"p-4 border-b border-grey200"},PM={class:"text-base font-semibold text-grey900 mb-4"},jM={class:"p-4 flex items-center justify-end gap-3"},LM=["disabled"],RM=fe({__name:"EmailEditModal",emits:["toggle-email-edit-modal"],setup(o,{emit:s}){const{updateChatContact:t}=ss(),n=Ae(),l=s,i=za("activeConversation"),m=i==null?void 0:i.value.attributes.contact,r=$(""),u=$(!1),g=b(()=>(m==null?void 0:m.contact_name)||(m==null?void 0:m.name)),y=b(()=>(m==null?void 0:m.contact_email)||(m==null?void 0:m.email)),c={contactEmail:{email:Ye.withMessage("Please enter a valid email address",On),maxLength:Ye.withMessage("Email must be less than 255 characters",It(255))}},w=bs(c,{contactEmail:r}),f=()=>{l("toggle-email-edit-modal")},v=async()=>{var _;if(w.value.$touch(),w.value.$invalid||r.value==y.value)return;u.value=!0;const C={team_id:(_=n.user)==null?void 0:_.attributes.team_id,chat_contact_id:m==null?void 0:m.id,conversation_id:i==null?void 0:i.value.id,name:g.value,email:r.value};try{await t(C),f()}catch(A){Ze(A),ht(A)}finally{u.value=!1}};return Xe(()=>{r.value=y.value}),(C,_)=>{const A=Pe("InputField"),D=He("click-away");return F((a(),d("div",IM,[e("div",FM,[e("div",PM,I(y.value?"Update Email":"Add Email"),1),W(A,{value:r.value,onInput:_[0]||(_[0]=T=>r.value=T),onKeyup:Ut(v,["enter"]),hasError:p(w).contactEmail.$error,validationMessage:p(w).contactEmail.$errors,forValue:"Email",label:"Email",type:"email",placeholder:"michael@gmail.com",classes:"!py-1 !px-2 !rounded-lg"},null,8,["value","hasError","validationMessage"])]),e("div",jM,[e("button",{onClick:f,class:"bg-grey100 py-1.5 px-2 text-grey900"},"Cancel"),e("button",{onClick:v,disabled:p(w).contactEmail.$error||u.value||r.value==y.value,class:"bg-grey900 py-1.5 px-[18px] text-white"},I(u.value?"Saving...":"Save"),9,LM)])])),[[D,f]])}}}),BM={class:"fixed top-[130px] lg:top-[210px] right-2.5 sm:right-[54px] lg:right-[90px] xl:right-[90px] 2xl:right-[138px] z-10 bg-white shadow-2xl w-[368px] rounded-lg"},NM={class:"p-4 border-b border-grey200"},OM={class:"text-base font-semibold text-grey900 mb-4"},VM={class:"p-4 flex items-center justify-end gap-3"},UM=["disabled"],GM=fe({__name:"PhoneEditModal",emits:["toggle-phone-edit-modal"],setup(o,{emit:s}){const t=Ae(),{updateChatContact:n}=ss(),l=s,i=za("activeConversation"),m=i==null?void 0:i.value.attributes.contact,r=$(""),u=$(!1),g=b(()=>m==null?void 0:m.phone),y=b(()=>(m==null?void 0:m.contact_name)||(m==null?void 0:m.name)),c=_=>_?/^[0-9()+-. ]{4,20}$/.test(_):!0,w={phone:{phone:Ye.withMessage("Invalid phone number",c)}},f=bs(w,{phone:r}),v=()=>{l("toggle-phone-edit-modal")},C=async()=>{var A;if(f.value.$touch(),f.value.$invalid||r.value==g.value)return;u.value=!0;const _={team_id:(A=t.user)==null?void 0:A.attributes.team_id,chat_contact_id:m==null?void 0:m.id,conversation_id:i==null?void 0:i.value.id,name:y.value,phone:r.value};try{await n(_),v()}catch(D){Ze(D),ht(D)}finally{u.value=!1}};return Xe(()=>{r.value=g.value}),(_,A)=>{const D=Pe("InputField"),T=He("click-away");return F((a(),d("div",BM,[e("div",NM,[e("div",OM,I(g.value?"Update Phone Number":"Add Phone Number"),1),W(D,{value:r.value,onInput:A[0]||(A[0]=B=>r.value=B),onKeyup:Ut(C,["enter"]),hasError:p(f).phone.$error,validationMessage:p(f).phone.$errors,forValue:"phone",label:"Phone Number",type:"text",placeholder:"+1567935678",classes:"!py-1 !px-2 !rounded-lg"},null,8,["value","hasError","validationMessage"])]),e("div",VM,[e("button",{onClick:v,class:"bg-grey100 py-1.5 px-2 text-grey900"},"Cancel"),e("button",{onClick:C,disabled:p(f).phone.$error||u.value||r.value==g.value,class:"bg-grey900 py-1.5 px-[18px] text-white"},I(u.value?"Saving...":"Save"),9,UM)])])),[[T,v]])}}}),WM="/assets/user-check-439acfcc.svg",qM="/assets/divider-7728186c.svg",HM="/assets/menu-2-af3665c1.svg",zM={class:""},KM={class:"px-4 pt-6 pb-0 text-[#282d3e] font-semibold"},YM={key:0,class:"px-4 pb-2 text-[#282d3e]"},ZM=fe({__name:"BlockContact",props:{showModal:{type:Boolean},position:{}},emits:["close"],setup(o,{emit:s}){const t=ct(),{toggleBlockContact:n}=ss(),l=Ae(),i=o,m=s,r=za("activeConversation"),u=b(()=>t.uiFlags.isBlockingContact),g=b(()=>!!(r!=null&&r.value.attributes.contact.blocked_at)),y=b(()=>{const f=window.innerWidth||document.documentElement.clientWidth,C=(window.innerHeight||document.documentElement.clientHeight)-i.position.y-5+"px",_=f>700?f-i.position.x-20+"px":"0px",A=f>700?"unset":"0px";return{bottom:C,right:_,left:A}}),c=()=>{m("close")},w=()=>{var v,C;const f=(C=(v=l.user)==null?void 0:v.attributes)==null?void 0:C.team_id;n({contactId:r.value.attributes.contact.id,conversationId:r.value.id,teamId:f}),c()};return(f,v)=>f.showModal?(a(),ne(Zs,{key:0,closeModal:f.showModal,alertModal:!0,showFooter:!0,isLoading:u.value,useCustomStyle:!0,customStyles:y.value,onCloseModal:c,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:g.value?"Unblock Visitor":"Block Visitor",onActionButtonTypeOne:c,onActionButtonTypeTwo:w},{default:K(()=>[e("div",zM,[e("p",KM,"Are you sure you want to "+I(g.value?"unblock":"block")+" this visitor?",1),g.value?h("",!0):(a(),d("p",YM,"Please keep in mind that this visitor might use another device to chat with you.")),v[0]||(v[0]=e("hr",null,null,-1))])]),_:1},8,["closeModal","isLoading","customStyles","actionButtonTypeTwoText"])):h("",!0)}}),JM=fe({__name:"DeleteConversation",props:{showModal:{type:Boolean},position:{}},emits:["close"],setup(o,{emit:s}){const{deleteConversation:t}=ss(),n=ct(),l=Ae(),i=o,m=s,{isSmallScreen:r}=hs(),u=za("activeConversation"),g=b(()=>n.uiFlags.isDeletingConversations),y=b(()=>{const f=window.innerWidth||document.documentElement.clientWidth,C=(window.innerHeight||document.documentElement.clientHeight)-i.position.y-5+"px",_=f>700?f-i.position.x-20+"px":"0px",A=f>700?"unset":"0px";return{bottom:C,right:_,left:A}}),c=()=>{m("close")},w=async()=>{var v,C;const f=(C=(v=l.user)==null?void 0:v.attributes)==null?void 0:C.team_id;t({contactId:u.value.attributes.contact.id,conversationId:u.value.id,teamId:f}),c(),r.value&&nt.emit("closeSidePanel")};return(f,v)=>f.showModal?(a(),ne(Zs,{key:0,closeModal:f.showModal,alertModal:!0,showFooter:!0,isLoading:g.value,useCustomStyle:!0,customStyles:y.value,onCloseModal:c,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete",onActionButtonTypeOne:c,onActionButtonTypeTwo:w},{default:K(()=>v[0]||(v[0]=[e("div",{class:""},[e("div",{class:"px-4 pt-6 pb-0 text-[#282d3e] font-semibold"},"Are you sure you want to delete this conversation?"),e("p",{class:"px-4 pb-2 text-[#282d3e]"},"All chats in this conversation will be deleted. A new conversation will be created if the visitor sends a message again."),e("hr")],-1)])),_:1},8,["closeModal","isLoading","customStyles"])):h("",!0)}}),QM={class:"profile-menu-section"},XM={key:0},e4={src:WM,class:"mr-1",alt:""},t4={key:1},s4={src:Qa,class:"mr-1",alt:""},a4={src:qM,class:"mx-2",alt:""},o4={src:HM,alt:""},n4={key:0,class:"dropdown--wrapper"},i4={class:"options"},l4={src:Xa,alt:""},r4=fe({__name:"ProfileMenu",setup(o){const s=za("activeConversation"),t=$(!1),n=$(!1),l=$(!1),i=Nt({x:0,y:0}),m=b(()=>!!(s!=null&&s.value.attributes.contact.blocked_at)),r=()=>{t.value=!1},u=()=>{l.value=!1},g=()=>{n.value=!1},y=w=>{i.x=w.clientX,i.y=w.clientY,n.value=!n.value},c=w=>{i.x=w.clientX,i.y=w.clientY,l.value=!0,setTimeout(()=>{r()},0)};return(w,f)=>{const v=He("svg-inline"),C=He("click-away");return a(),d(Se,null,[e("div",QM,[e("a",{href:"",onClick:f[0]||(f[0]=Qe(_=>y(_),["prevent"])),class:"block-toggler"},[m.value?(a(),d("span",XM,[F(e("img",e4,null,512),[[v]])])):(a(),d("span",t4,[F(e("img",s4,null,512),[[v]])])),e("p",null,I(m.value?"Unblock":"Block"),1)]),F(e("img",a4,null,512),[[v]]),e("a",{href:"",onClick:f[2]||(f[2]=Qe(_=>t.value=!0,["prevent"])),class:"menu-toggler"},[F(e("img",o4,null,512),[[v]]),t.value?F((a(),d("div",n4,[e("div",i4,[e("div",{class:"option-item delete",onClick:f[1]||(f[1]=_=>c(_))},[F(e("img",l4,null,512),[[v]]),f[3]||(f[3]=e("span",null,"Delete this conversation",-1))])])])),[[C,r]]):h("",!0)])]),n.value?F((a(),ne(ZM,{key:0,position:i,showModal:n.value,onClose:g},null,8,["position","showModal"])),[[C,g]]):h("",!0),l.value?F((a(),ne(JM,{key:1,position:i,showModal:l.value,onClose:u},null,8,["position","showModal"])),[[C,u]]):h("",!0)],64)}}});const d4=Oe(r4,[["__scopeId","data-v-37a2873c"]]),Mo="/assets/image-placeholder-2a4f3a07.svg",u4="/assets/chevron-up-active-4b5671f4.svg",or="/assets/copy-38ac3e2e.svg",pa="/assets/plus-add-8d89efcf.svg",nr="/assets/minus-small-496d94ad.svg",c4={key:0,class:"font-normal text-xs text-grey600 mb-1 flex items-center justify-between capitalize"},m4={class:"flex items-center gap-2"},g4={key:0,class:"bg-grey100 flex gap-2 divide-x py-1.5 px-2 rounded-full"},p4={class:"!text-[10px] !text-grey900 normal-case"},v4={class:"!text-[10px] !text-grey900 normal-case pl-1"},f4={src:Yn,class:"w-4"},h4={key:0,src:ws,alt:""},_4={key:1,src:Tt,alt:""},y4={key:1,class:"font-normal text-xs text-grey600 mb-1 capitalize"},b4={class:"flex items-center justify-between"},w4={class:"flex items-center gap-2"},x4={src:Yn,class:"w-4"},C4={key:0,src:ws,alt:""},k4={key:1,src:Tt,alt:""},$4={key:0,class:"bg-grey100 inline-flex gap-2 divide-x py-1.5 px-2 ml-7 rounded-full"},S4={class:"!text-[10px] !text-grey900 normal-case"},T4={class:"!text-[10px] !text-grey900 normal-case pl-1"},M4={key:2},A4={class:"relative rounded-md shadow-sm mb-2"},E4=["value","disabled"],D4={class:"flex flex-col gap-3 divide-y bg-grey100 !p-3 rounded-lg"},I4={class:"text-xs text-grey900"},F4={key:0,class:"h-16 grid place-items-center"},P4={key:1,class:"h-16 grid place-items-center"},j4=["href","target"],L4={class:"text-xs text-grey900 font-bold hover:text-primary hover:underline"},R4={class:"flex gap-2 mt-1"},B4=["href","target"],N4=["src"],O4={key:1,src:Mo,class:"text-grey900 w-[72px] h-[72px]",alt:""},V4={class:"flex flex-col justify-between"},U4={class:"text-xs"},G4={class:"text-xs"},W4={class:"text-xs capitalize"},q4={class:"flex items-center gap-2 mt-2"},H4=["onClick"],z4={key:0,src:Tt,alt:""},K4={key:1,src:u4,alt:""},Y4=["disabled","onClick"],Z4={key:0,class:"border-1 border-grey200 rounded-md px-2"},J4=["href"],Q4={key:0,class:"flex flex-col mt-2 bg-[#282D3E0F] p-3 rounded-md"},X4={class:"flex"},e3={class:"truncate font-medium max-w-[110px]"},t3=["href"],s3={key:1,class:"text-grey900 font-medium text-capitalize"},a3={key:2,class:"text-grey900 font-medium text-capitalize"},o3={class:"flex items-start mt-1 mb-3"},n3={class:"flex pt-1 items-end justify-end flex-col ml-1 max-w-[55%]"},i3=["href","target"],l3={class:"text-grey900 text-xs line-clamp-1 font-medium !mb-0 !pb-0 hover:text-primary hover:underline"},r3={class:"flex items-end text-grey700 text-xs font-medium !mt-0 !pt-0"},d3={class:"text-gray900"},u3={class:"text-gray900"},c3={class:"flex"},m3={class:"text-grey900 font-medium"},g3={class:"flex"},p3={class:"text-grey900 font-medium"},v3={class:"flex"},f3={class:"text-grey900 font-medium"},h3={class:"flex"},_3={class:"text-grey900 font-medium"},y3={key:0,class:"flex items-start"},b3={class:"flex items-end justify-end text-grey900 font-medium max-w-[45%] float-right text-right text-wrap"},w3={class:""},x3={key:3,class:""},C3=fe({__name:"ShopifyOrderData",props:{handelShopifyInfoClick:{type:Function,required:!0}},setup(o){const s=Ja(),t=Ae(),{width:n}=Ht(),l=$(!1);function i(f){var C;return new Intl.NumberFormat("en-US",{style:"currency",currency:((C=s.customer)==null?void 0:C.amountSpent.currencyCode)||"USD",maximumFractionDigits:2,minimumFractionDigits:2}).format(parseFloat(f||"0"))}const m=()=>{l.value=!l.value},r=Ys(async f=>{const v=f.target.value;await s.getCustomerOrders(v)},800);async function u(f){var A,D;let v=new Intl.NumberFormat("en-US",{style:"currency",currency:f.currencyCode});const C=g(f),_=`Order Id : ${f.name}
Order date : ${xt(f.createdAt).format("DD/MM/YYYY")}
Tracking number : ${C?C==null?void 0:C.number:"Undefined"} ${C!=null&&C.url?`
Tracking link : `+(C==null?void 0:C.url):""}
Fulfilment status : ${f.displayFulfillmentStatus.toLowerCase()}
Products : ${f.lineItems.nodes.map(T=>T.name).join(", ")}
Subtotal cost : ${v.format(f.currentSubtotalPriceSet.shopMoney.amount)}
Shipping cost : ${v.format(f.totalShippingPriceSet.shopMoney.amount)}
Tax : ${v.format(f.currentTotalTaxSet.shopMoney.amount)}
Total price : ${v.format(f.currentTotalPriceSet.shopMoney.amount)}
Billing address : ${((A=f.billingAddress)==null?void 0:A.formattedArea)||"Unknown"}
Shipping address : ${((D=f.shippingAddress)==null?void 0:D.formattedArea)||"Unknown"}
View order in shopify : ${f.statusPageUrl}
`;await navigator.clipboard.writeText(_),ze().set({message:"Element Copied"})}function g(f){var v;return(v=f.fulfillments[f.fulfillments.length-1])==null?void 0:v.trackingInfo[f.fulfillments[f.fulfillments.length-1].trackingInfo.length-1]}function y(f){var v,C;return((C=(v=f.lineItems.nodes.find(_=>{var A;return(A=_.image)==null?void 0:A.url}))==null?void 0:v.image)==null?void 0:C.url)||""}function c(f){return f.product.handle?s.getShopUrl+"/products/"+f.product.handle:"#"}function w(){!t.isProductTourRunning||!t.isShopifyUser||t.isProductTourSkiped||(t.productTourCurrentStep==5?l.value=!0:l.value=!1)}return We([()=>t.productTourCurrentStep,()=>t.isProductTourSkiped],w),Xe(()=>{w()}),(f,v)=>{var A,D,T,B,S,E,x,P,j,H,k,M,V,Z,ae,ce;const C=Pe("Loader"),_=He("svg-inline");return a(),d("div",null,[p(n)>1450?(a(),d("div",c4,[e("div",m4,[v[5]||(v[5]=e("img",{src:_o,class:"w-5 h-5"},null,-1)),v[6]||(v[6]=_e(" Orders ")),!p(s).requiredShopifyPermissionUpdate&&!l.value?(a(),d("div",g4,[e("span",p4,I(((D=(A=p(s))==null?void 0:A.customer)==null?void 0:D.numberOfOrders)||0)+" Orders",1),e("span",v4,"Total sum "+I(i((S=(B=(T=p(s))==null?void 0:T.customer)==null?void 0:B.amountSpent)==null?void 0:S.amount)),1)])):p(s).requiredShopifyPermissionUpdate?(a(),d("div",{key:1,onClick:v[0]||(v[0]=()=>{o.handelShopifyInfoClick()}),class:"cursor-pointer"},[F(e("img",f4,null,512),[[_]])])):h("",!0)]),p(s).requiredShopifyPermissionUpdate?h("",!0):(a(),d("button",{key:0,onClick:m,class:"button--text shrink-0"},[l.value?(a(),d("img",_4)):(a(),d("img",h4))]))])):(a(),d("div",y4,[e("div",b4,[e("div",w4,[v[7]||(v[7]=e("img",{src:_o,class:"w-5 h-5"},null,-1)),v[8]||(v[8]=_e(" Orders ")),p(s).requiredShopifyPermissionUpdate?(a(),d("div",{key:0,onClick:v[1]||(v[1]=()=>{o.handelShopifyInfoClick()}),class:"cursor-pointer"},[F(e("img",x4,null,512),[[_]])])):h("",!0)]),p(s).requiredShopifyPermissionUpdate?h("",!0):(a(),d("button",{key:0,onClick:m,class:"button--text shrink-0"},[l.value?(a(),d("img",k4)):(a(),d("img",C4))]))]),!p(s).requiredShopifyPermissionUpdate&&!l.value?(a(),d("div",$4,[e("span",S4,I(((x=(E=p(s))==null?void 0:E.customer)==null?void 0:x.numberOfOrders)||0)+" Orders",1),e("span",T4,"Total sum "+I(i((H=(j=(P=p(s))==null?void 0:P.customer)==null?void 0:j.amountSpent)==null?void 0:H.amount)),1)])):h("",!0)])),l.value?(a(),d("div",M4,[e("div",A4,[v[9]||(v[9]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"!w-4 !h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])],-1)),e("input",{value:p(s).orderSearchQuery,onInput:v[2]||(v[2]=(...J)=>p(r)&&p(r)(...J)),disabled:(k=p(s).customerOrders[0])==null?void 0:k.isDummy,class:"block w-full !rounded-lg border-0 !py-1 !pl-8 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Searching all orders"},null,40,E4)]),e("div",D4,[e("div",null,[v[10]||(v[10]=e("p",{class:"flex items-center gap-1 !p-0 !m-0 text-grey900 text-sm font-semibold"},[e("img",{src:tn,class:"text-grey900",alt:""}),_e(" Order insights ")],-1)),e("span",I4,"Total orders: "+I(((V=(M=p(s))==null?void 0:M.customer)==null?void 0:V.numberOfOrders)||0)+", Total sum "+I(i((ae=(Z=p(s))==null?void 0:Z.customer)==null?void 0:ae.amountSpent.amount)),1)]),p(s).loadingCustomerOrder?(a(),d("div",F4,[W(C,{size:"18px"})])):h("",!0),!p(s).loadingCustomerOrder&&p(s).customerOrders.length===0?(a(),d("div",P4,v[11]||(v[11]=[e("p",null,"No order found!",-1)]))):h("",!0),!p(s).loadingCustomerOrder&&((ce=p(s).customerOrders)==null?void 0:ce.length)>0?(a(!0),d(Se,{key:2},Ne(p(s).sortedCustomerOrders,J=>{var X,z,q,ue,pe,de,he,ve,be,re;return a(),d("div",{class:"pt-3",key:J.id},[e("a",{href:J.statusPageUrl?J.statusPageUrl:"#",target:J.statusPageUrl?"_blank":"",rel:"noopener noreferrer"},[e("span",L4,"Order id : "+I(J.name),1)],8,j4),e("div",R4,[e("a",{href:J.statusPageUrl?J.statusPageUrl:"#",target:J.statusPageUrl?"_blank":"",rel:"noopener noreferrer"},[y(J)?(a(),d("img",{key:0,src:y(J),class:"text-grey900 w-[72px] h-[72px] rounded",alt:""},null,8,N4)):(a(),d("img",O4))],8,B4),e("div",V4,[e("span",U4,I(p(xt)(J.createdAt).format("MM/DD/YYYY")),1),e("span",G4,I(i(J.currentTotalPriceSet.shopMoney.amount)),1),e("span",W4,I(J.displayFulfillmentStatus.toLowerCase()),1)])]),e("div",q4,[e("button",{onClick:ie=>J.active=!J.active,class:O(["border-1 rounded-md text-xs",[J.active?"text-main400 border-main400":"text-grey900 border-grey200"]])},[J.active?(a(),d("img",K4)):(a(),d("img",z4)),v[12]||(v[12]=_e(" Details "))],10,H4),e("button",{class:"border-1 border-grey200 rounded-md px-2 disabled:!bg-transparent",disabled:J==null?void 0:J.isDummy,onClick:()=>u(J)},v[13]||(v[13]=[e("img",{src:or,class:"text-grey900 w-4 h-4 !m-0 !p-0 mr-2",alt:""},null,-1),e("span",{class:"ml-1"},"Copy",-1)]),8,Y4),(X=g(J))!=null&&X.number&&((z=g(J))!=null&&z.url)?(a(),d("button",Z4,[e("a",{href:(q=g(J))==null?void 0:q.url,target:"_blank"},v[14]||(v[14]=[e("img",{src:$o,class:"text-grey900 w-4 h-4 !m-0 !p-0",alt:""},null,-1)]),8,J4)])):h("",!0)]),J.active?(a(),d("div",Q4,[e("div",X4,[v[15]||(v[15]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Tracking"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("div",e3,[(ue=g(J))!=null&&ue.url?(a(),d("a",{key:0,href:(pe=g(J))==null?void 0:pe.url,target:"_blank"},[e("span",null,I((de=g(J))==null?void 0:de.number),1)],8,t3)):h("",!0),!((he=g(J))!=null&&he.url)&&((ve=g(J))!=null&&ve.number)?(a(),d("span",s3,I(g(J).number),1)):h("",!0),g(J)?h("",!0):(a(),d("span",a3,"Unknown"))])]),e("div",o3,[v[17]||(v[17]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Products"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("div",n3,[(a(!0),d(Se,null,Ne(J.lineItems.nodes,ie=>(a(),d(Se,{key:ie.id},[e("a",{href:c(ie),target:ie.product.handle?"_blank":"",rel:"noopener noreferrer"},[e("span",l3,I(ie.name),1)],8,i3),e("span",r3,[e("span",d3,I(i(ie.originalUnitPriceSet.shopMoney.amount))+" x "+I(ie.currentQuantity)+" . ",1),e("span",u3,I(i(ie.originalUnitPriceSet.shopMoney.amount*ie.quantity)),1)]),v[16]||(v[16]=e("div",{class:"h-2"},null,-1))],64))),128))])]),e("div",c3,[v[18]||(v[18]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Subtotal"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",m3,I(i(J.currentSubtotalPriceSet.shopMoney.amount)),1)]),e("div",g3,[v[19]||(v[19]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Shipping cost"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",p3,I(i(J.totalShippingPriceSet.shopMoney.amount)),1)]),e("div",v3,[v[20]||(v[20]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Tax"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",f3,I(i(J.currentTotalTaxSet.shopMoney.amount)),1)]),e("div",h3,[v[21]||(v[21]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Total price"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",_3,I(i(J.currentTotalPriceSet.shopMoney.amount)),1)]),((be=J.billingAddress)==null?void 0:be.formattedArea)!==null?(a(),d("div",y3,[v[22]||(v[22]=e("div",{class:"flex flex-1 items-center"},[e("span",{style:{"text-wrap":"nowrap"}},"Billing address"),e("div",{class:"border-b border-grey300 border-dashed w-full mx-1 top-1 relative"})],-1)),e("div",b3,[e("span",w3,I((re=J.billingAddress)==null?void 0:re.formattedArea),1)])])):h("",!0)])):h("",!0)])}),128)):h("",!0),p(s).canShowOrderPagination?(a(),d("div",x3,[p(s).canLoadMoreOrders?(a(),d("span",{key:0,class:"flex items-center gap-1 cursor-pointer mt-2 mx-3",onClick:v[3]||(v[3]=(...J)=>p(s).handelShowMoreOrderClick&&p(s).handelShowMoreOrderClick(...J))},v[23]||(v[23]=[e("img",{src:pa},null,-1),_e(" Show more ")]))):(a(),d("span",{key:1,class:"flex items-center gap-1 cursor-pointer mt-2 mx-3",onClick:v[4]||(v[4]=(...J)=>p(s).handelShowLessOrderClick&&p(s).handelShowLessOrderClick(...J))},v[24]||(v[24]=[e("img",{src:nr},null,-1),_e(" Show less ")])))])):h("",!0)])])):h("",!0)])}}}),k3={key:0,class:"font-normal text-xs text-grey600 mb-3 flex items-center justify-between capitalize"},$3={class:"flex items-center gap-2"},S3={class:"bg-grey100 flex gap-2 divide-x py-1.5 px-2 rounded-full"},T3={class:"!text-[10px] !text-grey900 !normal-case"},M3={class:"!text-[10px] !text-grey900 !normal-case !pl-1.5"},A3={key:0,src:ws,alt:""},E3={key:1,src:Tt,alt:""},D3={key:1,class:"font-normal text-xs text-grey600 mb-3"},I3={class:"flex items-center justify-between capitalize"},F3={key:0,src:ws,alt:""},P3={key:1,src:Tt,alt:""},j3={class:"bg-grey100 inline-flex gap-2 divide-x py-1.5 px-2 ml-7 rounded-full"},L3={class:"!text-[10px] !text-grey900 !normal-case"},R3={class:"!text-[10px] !text-grey900 !normal-case !pl-1.5"},B3={key:2},N3={class:"flex flex-col gap-3 divide-y bg-grey100 !p-3 rounded-md"},O3={class:"text-xs text-grey900"},V3={key:0,class:"h-16 grid place-items-center"},U3={key:1,class:"h-16 grid place-items-center"},G3=["href","target"],W3={class:"text-xs text-grey900 font-bold line-clamp-1 hover:text-primary hover:underline"},q3={class:"flex gap-2 mt-3"},H3=["href","target"],z3=["src"],K3={key:1,src:tn,class:"text-grey900 w-[72px] h-[72px]",alt:""},Y3={class:"flex flex-col gap-1"},Z3={class:"text-xs"},J3={class:"text-xs"},Q3={class:"flex items-center gap-2 mt-2"},X3=["disabled","onClick"],eA={key:2,class:""},tA=fe({__name:"ShopifyCartData",setup(o){const s=Ja(),{width:t}=Ht(),n=$(!1);function l(u){var y;return new Intl.NumberFormat("en-US",{style:"currency",currency:((y=s.cartData)==null?void 0:y.currency)||"USD"}).format(parseFloat(u||"0")/100)}const i=()=>{n.value=!n.value};async function m(u){var c;let g=new Intl.NumberFormat("en-US",{style:"currency",currency:(c=s.cartData)==null?void 0:c.currency});const y=`Product ID : ${u.product_id}
Total price : ${g.format(u.final_line_price/100)}
`;await navigator.clipboard.writeText(y),ze().set({message:"Element Copied"})}function r(u){return u.url?s.getShopUrl+u.url:"#"}return(u,g)=>{var c,w,f,v,C,_,A,D,T,B,S,E,x,P;const y=Pe("Loader");return a(),d("div",null,[p(t)>1450?(a(),d("div",k3,[e("div",$3,[g[2]||(g[2]=e("img",{src:_o,class:"w-5 h-5"},null,-1)),g[3]||(g[3]=_e(" Cart ")),e("div",S3,[e("span",T3,I(((w=(c=p(s))==null?void 0:c.cartData)==null?void 0:w.item_count)||0)+" Items",1),e("span",M3,"Total sum "+I(l((v=(f=p(s))==null?void 0:f.cartData)==null?void 0:v.total_price)),1)])]),e("button",{onClick:i,class:"button--text shrink-0"},[n.value?(a(),d("img",E3)):(a(),d("img",A3))])])):(a(),d("div",D3,[e("div",I3,[g[4]||(g[4]=e("div",{class:"flex items-center gap-2"},[e("img",{src:_o,class:"w-5 h-5"}),_e(" Cart ")],-1)),e("button",{onClick:i,class:"button--text shrink-0"},[n.value?(a(),d("img",P3)):(a(),d("img",F3))])]),e("div",j3,[e("span",L3,I(((_=(C=p(s))==null?void 0:C.cartData)==null?void 0:_.item_count)||0)+" Items",1),e("span",R3,"Total sum "+I(l((D=(A=p(s))==null?void 0:A.cartData)==null?void 0:D.total_price)),1)])])),n.value?(a(),d("div",B3,[e("div",N3,[e("div",null,[g[5]||(g[5]=e("p",{class:"flex items-center gap-1 !p-0 !m-0 text-grey900 text-sm font-semibold"},[e("img",{src:tn,class:"text-grey900",alt:""}),_e(" Cart insights ")],-1)),e("span",O3,"Total items: "+I(((B=(T=p(s))==null?void 0:T.cartData)==null?void 0:B.item_count)||0)+", Total sum "+I(l((E=(S=p(s))==null?void 0:S.cartData)==null?void 0:E.total_price)),1)]),p(s).loadingCartData&&((x=p(s).cartData)==null?void 0:x.items.length)===0?(a(),d("div",V3,[W(y,{size:"18px"})])):h("",!0),!p(s).loadingCartData&&((P=p(s).cartData)==null?void 0:P.items.length)===0?(a(),d("div",U3,g[6]||(g[6]=[e("p",null,"No item found!",-1)]))):h("",!0),(a(!0),d(Se,null,Ne(p(s).sortedCartItems,j=>(a(),d("div",{class:"pt-3",key:j.id},[e("a",{href:r(j),target:j.url?"_blank":"",rel:"noopener noreferrer"},[e("span",W3,I(j.title),1)],8,G3),e("div",q3,[e("a",{href:r(j),target:j.url?"_blank":"",rel:"noopener noreferrer"},[j.image?(a(),d("img",{key:0,src:j.image,class:"border-1 border-grey900 rounded w-[72px] h-[72px]",alt:""},null,8,z3)):(a(),d("img",K3))],8,H3),e("div",Y3,[e("span",Z3,"Product id: "+I(j.product_id),1),e("span",J3,I(l(j.final_line_price))+" (Qty: "+I(j.quantity)+")",1)])]),e("div",Q3,[e("button",{class:"border-1 border-grey200 rounded-md px-2 disabled:!bg-transparent",disabled:j==null?void 0:j.isDummy,onClick:()=>m(j)},g[7]||(g[7]=[e("img",{src:or,class:"text-grey900 w-4 h-4 !m-0 !p-0 mr-2",alt:""},null,-1),e("span",{class:"ml-1"},"Copy",-1)]),8,X3)])]))),128)),p(s).canShowCartPagination?(a(),d("div",eA,[p(s).canLoadMoreCartItem?(a(),d("span",{key:0,class:"flex items-center gap-1 cursor-pointer mt-2 mx-3",onClick:g[0]||(g[0]=(...j)=>p(s).handelShowMoreCartItemClick&&p(s).handelShowMoreCartItemClick(...j))},g[8]||(g[8]=[e("img",{src:pa},null,-1),_e(" Show more ")]))):(a(),d("span",{key:1,class:"flex items-center gap-1 cursor-pointer mt-2 mx-3",onClick:g[1]||(g[1]=(...j)=>p(s).handelShowLessCartItemClick&&p(s).handelShowLessCartItemClick(...j))},g[9]||(g[9]=[e("img",{src:nr},null,-1),_e(" Show less ")])))])):h("",!0)])])):h("",!0)])}}}),sA={class:"profile--section header"},aA={class:"personal--info"},oA={class:"details"},nA={class:"relative flex items-center justify-center gap-1 group"},iA=["title"],lA=["disabled"],rA={src:eo,alt:""},dA={key:0,class:"flex items-center gap-2"},uA={src:ho},cA={key:1,class:"actions relative flex items-center gap-1 group"},mA=["title"],gA={key:0},pA={src:Ln},vA=["title"],fA=["disabled"],hA={src:eo},_A={key:0,class:"absolute -top-2 -right-[3.25rem] opacity-0 group-hover:opacity-100 px-1.5 py-1.5"},yA={src:Wt},bA={src:ei},wA=["disabled"],xA={key:3,class:"actions w-[140px] relative flex justify-content-center items-center gap-1 mt-2 group"},CA=["href","title"],kA={src:BS},$A={class:"max-w-[140px] truncate"},SA=["disabled"],TA={src:eo,alt:""},MA={key:0,class:"absolute -top-2 -right-[3.25rem] opacity-0 group-hover:opacity-100 px-1.5 py-1.5"},AA={src:Wt},EA={src:ei},DA=["disabled"],IA=["disabled"],FA={src:ca},PA={key:0,class:"profile--section location"},jA={class:"title"},LA={key:0,src:ws,alt:""},RA={key:1,src:Tt,alt:""},BA={key:0,class:"list--item"},NA={key:1,class:"list--item"},OA={src:NS},VA={key:3,class:"profile--section device"},UA={class:"title"},GA={key:0,src:ws,alt:""},WA={key:1,src:Tt,alt:""},qA={class:"list--item"},HA=["src"],zA={class:"list--item"},KA=["src"],YA={key:0,class:"list--item"},ZA={src:OS},JA={class:"truncate"},QA={class:"list--item"},XA={src:VS},e5={class:"profile--section pages"},t5={class:"title"},s5={class:"flex items-center gap-1 relative"},a5={key:0,class:"inline-flex p-1.5 gap-3 justify-center items-center rounded hover:bg-[#FFFFFF1A] cursor-pointer"},o5={class:"w-[20.875rem]"},n5={key:0,src:ws,alt:""},i5={key:1,src:Tt,alt:""},l5={class:"profile--section pages"},r5={class:"title"},d5={class:"flex items-center gap-1"},u5={key:0,class:"inline-flex p-1.5 gap-3 justify-center items-center rounded hover:bg-[#FFFFFF1A] cursor-pointer"},c5={class:"w-[20.875rem]"},m5={key:0,src:ws,alt:""},g5={key:1,src:Tt,alt:""},p5={key:4,class:"profile--section pages"},v5={class:"title"},f5={class:"block overflow-hidden text-grey600"},h5={class:"block w-full"},_5=["href"],y5={class:"py-1.5 px-3 w-auto"},b5={key:0,src:ws,alt:""},w5={key:1,src:Tt,alt:""},x5={key:0,class:"path"},C5={class:"page-visited--item flex gap-2"},k5=["href"],$5={class:"!text-grey600"},S5=fe({__name:"ChatProfile",props:{contactAttributes:{type:Object,default:()=>{}},handelShopifyInfoClick:{type:Function,required:!0}},emits:["closePanel"],setup(o,{emit:s}){const t=o,n=Es(),l=ct(),i=As(),m=Ae(),r=Ja(),{updateEmailOffileVisitorModal:u,setEmailOfflineVisitorModal:g}=Zt(),y=s,c=$(!0),w=$(!0),f=$(!0),v=$(!0),C=$(!0),_=$(!1),A=$(!1),D=$(!1),T=$(!1),B=$(!1),S=$(null),E=b(()=>{var L;const N=(L=t.contactAttributes.browser_type)==null?void 0:L.toLowerCase();return N?N.includes("safari")?"/browsers/safari.png":N.includes("chrome")?"/browsers/chrome.png":N.includes("firefox")?"/browsers/firefox.png":N.includes("edge")?"/browsers/edge.png":N.includes("opera")?"/browsers/opera.png":N.includes("brave")?"/browsers/brave.png":"/browsers/other.png":"/browsers/other.png"}),x=b(()=>{var L,me;const N=((L=t.contactAttributes.os)==null?void 0:L.toLowerCase())||((me=t.contactAttributes.operating_system)==null?void 0:me.toLowerCase());return N?N.includes("windows")?"/os/windows.png":N.includes("mac")?"/os/macos.png":N.includes("ios")?"/os/ios.png":N.includes("android")?"/os/android.png":N.includes("ubuntu")?"/os/ubuntu.png":N.includes("linux")?"/os/linux.png":"/os/other.png":"/os/other.png"}),P=b(()=>GS(t.contactAttributes.timezone)),j=b(()=>{var N;return(N=l.currentConversation.attributes)==null?void 0:N.contact.src}),H=b(()=>{var N,L;return((N=t.contactAttributes)==null?void 0:N.contact_name)||((L=t.contactAttributes)==null?void 0:L.name)}),k=b(()=>{var N,L;return((N=t.contactAttributes)==null?void 0:N.contact_email)||((L=t.contactAttributes)==null?void 0:L.email)}),M=b(()=>{var N;return(N=t.contactAttributes)==null?void 0:N.phone}),V=b(()=>{var N,L;return((N=t.contactAttributes)==null?void 0:N.os)||((L=t.contactAttributes)==null?void 0:L.operating_system)}),Z=b(()=>P.value?US(t.contactAttributes.timezone||"")+` (${t.contactAttributes.timezone})`:""),ae=b(()=>t.contactAttributes.location&&(t.contactAttributes.country_name||t.contactAttributes.country)),ce=b(()=>{const N=t.contactAttributes.page_visited?t.contactAttributes.page_visited:[];return N.length?N.map(me=>({page:cu(me.page),url:me.page,date:Wr(new Date(me.date),"dd MMM")})).reverse():[]}),J=b(()=>({baseURL:uu({url:t.contactAttributes.page_visited[0].page}),fullURL:t.contactAttributes.page_visited[0].page})),X=b(()=>{if(t.contactAttributes.country_flag||t.contactAttributes.country_name)return{countryName:t.contactAttributes.country,countryFlag:t.contactAttributes.country_flag};const N=n.countries.find(L=>L.code===t.contactAttributes.country);return N?{countryName:N.name,countryFlag:N.image}:{countryName:"",countryFlag:""}}),z=b(()=>{var N;return!!((N=i.contact_form.find(L=>L.field_name=="phone"))!=null&&N.is_visible)}),q=b(()=>m.isProUser),ue=b(()=>m.showEmailOfflineVisitorModal||m.isProductTourRunning),pe=()=>{y("closePanel")},de=()=>{_.value=!_.value},he=()=>{D.value=!D.value},ve=()=>{A.value=!A.value},be=(N,L)=>{navigator.clipboard.writeText(N),ze().set({message:`${L} copied successfully`,type:"success"}),L=="Email"?T.value=!0:B.value=!0,setTimeout(()=>{T.value=!1,B.value=!1},3e3)},re=N=>({backgroundImage:`url(${N})`}),ie=async()=>{g(!1),await u()},xe=()=>{S.value&&(S.value.scrollTop=0)};return We([()=>m.isProductTourSkiped,()=>m.productTourCurrentStep,()=>m.showEmailOfflineVisitorModal],()=>xe()),(N,L)=>{var R,ee;const me=Pe("Thumbnail"),G=Pe("VDropdown"),U=He("svg-inline");return a(),d(Se,null,[e("div",{class:"chat--profile",ref_key:"chatProfile",ref:S},[e("div",sA,[e("div",aA,[W(me,{"user-name":H.value,size:"64px","font-size":"20px",color:(R=p(l).selectedConversation.attributes)==null?void 0:R.contact.bgcolor},null,8,["user-name","color"]),e("div",oA,[e("div",nA,[e("h5",{class:"name max-w-[120px] truncate",title:H.value},I(H.value),9,iA),e("button",{onClick:de,disabled:ue.value,class:"absolute top-1 -right-8 opacity-0 group-hover:opacity-100 px-1.5 py-1.5 disabled:!bg-transparent"},[F(e("img",rA,null,512),[[U]])],8,lA)]),j.value==="messenger"?(a(),d("div",dA,[F(e("img",uA,null,512),[[U]]),L[7]||(L[7]=e("span",{class:"text-grey300"},"Facebook user",-1))])):h("",!0),k.value?(a(),d("div",cA,[W(yt,{placement:"left",triggers:[],isOpen:p(m).showEmailOfflineVisitorModal&&!p(m).isProductTourRunning,autoHide:!1,distance:10,skidding:54},{content:K(()=>[e("div",{class:"p-6 w-[360px]"},[L[8]||(L[8]=e("div",{class:"text-sm text-grey900 font-semibold mb-2"},"Notifying offline visitors via email",-1)),L[9]||(L[9]=e("div",{class:"text-sm text-grey900 mb-4"}," Congratulations! Your first visitor has shared their email address. In case they miss your message on the site widget, a notification will be sent to their email once you respond. ",-1)),e("button",{class:"p-0 text-sm font-semibold text-primary",onClick:ie},"Got it")])]),default:K(()=>[e("div",{class:"email",title:k.value},[j.value&&j.value==="email"?(a(),d("span",gA,[F(e("img",pA,null,512),[[U]])])):h("",!0),e("span",{class:"max-w-[130px] truncate",title:k.value},I(k.value),9,vA)],8,mA)]),_:1},8,["isOpen"]),e("button",{onClick:ve,disabled:ue.value,class:"absolute -top-2 -right-8 opacity-0 group-hover:opacity-100 px-1.5 py-1.5 disabled:!bg-transparent"},[F(e("img",hA,null,512),[[U]])],8,fA),T.value?(a(),d("button",_A,[F(e("img",yA,null,512),[[U]])])):(a(),d("button",{key:1,onClick:L[0]||(L[0]=se=>be(k.value,"Email")),class:"absolute -top-2 -right-[3.25rem] opacity-0 group-hover:opacity-100 px-1.5 py-1.5"},[F(e("img",bA,null,512),[[U]])]))])):(a(),d("button",{key:2,onClick:ve,disabled:ue.value,class:"flex items-center gap-1 bg-grey100 px-1.5 py-0.5 h-auto disabled:!bg-grey100"},L[10]||(L[10]=[e("img",{src:Li,alt:""},null,-1),e("span",{class:"text-sm font-normal text-grey900"},"Add Email",-1)]),8,wA)),M.value?(a(),d("div",xA,[e("a",{href:`tel:${M.value}`,class:"phone",title:M.value},[F(e("img",kA,null,512),[[U]]),e("span",$A,I(M.value),1)],8,CA),e("button",{onClick:he,disabled:ue.value,class:"absolute -top-2 -right-8 opacity-0 group-hover:opacity-100 disabled:!bg-transparent"},[F(e("img",TA,null,512),[[U]])],8,SA),B.value?(a(),d("button",MA,[F(e("img",AA,null,512),[[U]])])):(a(),d("button",{key:1,onClick:L[1]||(L[1]=se=>be(M.value,"Phone")),class:"absolute -top-2 -right-[3rem] opacity-0 group-hover:opacity-100 px-1.5 py-1.5"},[F(e("img",EA,null,512),[[U]])]))])):z.value?(a(),d("button",{key:4,onClick:he,disabled:ue.value,class:"flex items-center gap-1 bg-grey100 px-1.5 py-1.5 mt-2 h-auto disabled:!bg-grey100"},L[11]||(L[11]=[e("img",{src:Li,alt:""},null,-1),e("span",{class:"text-sm font-normal text-grey900"},"Add Phone Number",-1)]),8,DA)):h("",!0)])]),e("button",{class:"button--text close--button disabled:!bg-transparent",disabled:ue.value,onClick:pe},[F(e("img",FA,null,512),[[U]])],8,IA)]),j.value&&["messenger","email"].indexOf(j.value)<0?(a(),d("div",PA,[e("div",jA,[_e(I(N.$t("CONTACT.LOCATION"))+" ",1),e("button",{onClick:L[2]||(L[2]=se=>w.value=!w.value),class:"button--text"},[w.value?(a(),d("img",RA)):(a(),d("img",LA))])]),w.value?(a(),d(Se,{key:0},[ae.value?(a(),d("div",BA,[e("span",{class:"flag",style:lt(re(X.value.countryFlag))},null,4),e("span",null,I(`${o.contactAttributes.location}, ${X.value.countryName}`),1)])):h("",!0),P.value?(a(),d("div",NA,[F(e("img",OA,null,512),[[U]]),e("span",null,I(Z.value),1)])):h("",!0)],64)):h("",!0)])):h("",!0),p(r).isOriginatedFromShopify||p(m).isProductTourRunning&&p(m).isShopifyUser?(a(),ne(C3,{key:1,class:"profile--section",handelShopifyInfoClick:o.handelShopifyInfoClick},null,8,["handelShopifyInfoClick"])):h("",!0),p(r).isOriginatedFromShopify||p(m).isProductTourRunning&&p(m).isShopifyUser?(a(),ne(tA,{key:2,class:"profile--section"})):h("",!0),j.value&&["messenger","email"].indexOf(j.value)<0?(a(),d("div",VA,[e("div",UA,[_e(I(N.$t("CONTACT.DEVICE"))+" ",1),e("button",{onClick:L[3]||(L[3]=se=>f.value=!f.value),class:"button--text"},[f.value?(a(),d("img",WA)):(a(),d("img",GA))])]),f.value?(a(),d(Se,{key:0},[e("div",qA,[e("img",{src:E.value,alt:""},null,8,HA),e("span",null,I((ee=o.contactAttributes.browser_type)!=null&&ee.includes("undefined")?o.contactAttributes.browser_type.split(" ")[0]:o.contactAttributes.browser_type),1)]),e("div",zA,[e("img",{src:x.value,alt:""},null,8,KA),e("span",null,I(V.value),1)]),o.contactAttributes.ip?(a(),d("div",YA,[F(e("img",ZA,null,512),[[U]]),e("span",JA,I(o.contactAttributes.ip),1)])):h("",!0),e("div",QA,[F(e("img",XA,null,512),[[U]]),e("span",null,I(N.$t("CONTACT.LANGUAGE"))+" "+I(`: ${o.contactAttributes.language}`),1)])],64)):h("",!0)])):h("",!0),e("div",e5,[e("div",t5,[e("div",s5,[_e(I(N.$t("CONTACT.TAGS"))+" ",1),W(G,{theme:"chatway-upgradenow",triggers:["click"],placement:"left"},{popper:K(()=>[e("div",o5,[W(Ea)])]),default:K(()=>[q.value?h("",!0):(a(),d("div",a5,L[12]||(L[12]=[e("img",{src:Da,alt:""},null,-1)])))]),_:1})]),e("button",{onClick:L[4]||(L[4]=se=>C.value=!C.value),class:"button--text"},[C.value?(a(),d("img",i5)):(a(),d("img",n5))])]),C.value?(a(),ne(RT,{key:0,isShowTags:C.value},null,8,["isShowTags"])):h("",!0)]),e("div",l5,[e("div",r5,[e("div",d5,[_e(I(N.$t("CONTACT.CUSTOM_DATA"))+" ",1),W(G,{theme:"chatway-upgradenow",triggers:["click"],placement:"left"},{popper:K(()=>[e("div",c5,[W(Ea)])]),default:K(()=>[q.value?h("",!0):(a(),d("div",u5,L[13]||(L[13]=[e("img",{src:Da,alt:""},null,-1)])))]),_:1})]),e("button",{onClick:L[5]||(L[5]=se=>c.value=!c.value),class:"button--text"},[c.value?(a(),d("img",g5)):(a(),d("img",m5))])]),c.value?(a(),ne(SM,{key:0,isShowCustomData:c.value},null,8,["isShowCustomData"])):h("",!0)]),ce.value.length?(a(),d("div",p5,[e("div",v5,[e("span",f5,[_e(I(N.$t("CONTACT.PAGES_VISITED"))+" ",1),e("span",h5,[W(yt,null,{content:K(()=>[e("div",y5,[e("span",null,I(J.value.fullURL),1)])]),default:K(()=>[e("a",{target:"_blank",href:J.value.fullURL,class:"block text-xs truncate lowercase font-normal text-grey900 hover:text-[#0446de]"},I(`(${J.value.baseURL})`),9,_5)]),_:1})])]),e("button",{onClick:L[6]||(L[6]=se=>v.value=!v.value),class:"button--text"},[v.value?(a(),d("img",w5)):(a(),d("img",b5))])]),v.value?(a(),d("div",x5,[(a(!0),d(Se,null,Ne(ce.value,(se,Y)=>(a(),d("div",{key:Y,class:"list--item page-visited"},[e("div",C5,[e("a",{class:"truncate text-grey900",target:"_blank",href:se.url},I(se.page),9,k5),e("span",$5,I(se.date),1)])]))),128))])):h("",!0)])):h("",!0),_.value?(a(),ne(DM,{key:5,onToggleNameEditModal:de})):h("",!0),A.value?(a(),ne(RM,{key:6,onToggleEmailEditModal:ve})):h("",!0),D.value?(a(),ne(GM,{key:7,onTogglePhoneEditModal:he})):h("",!0)],512),W(d4)],64)}}});const T5=Oe(S5,[["__scopeId","data-v-5daf0e9f"]]),M5="/assets/smile-083c60c3.svg",A5={class:"emoji-box--wrapper"},E5={src:M5},D5={class:"picker-wrap"},I5=fe({__name:"EmojiPicker",emits:["insertEmoji"],setup(o,{expose:s,emit:t}){const n=new qr,l=t,i=$(!1),m=()=>{i.value=!i.value,i.value&&Ft(()=>{var w;const c=(w=n.shadowRoot)==null?void 0:w.querySelector("#search");c&&c.focus()})},r=()=>{i.value=!1},u=()=>{i.value=!0},g=c=>{l("insertEmoji",c.unicode),r()},y=()=>{var w;const c=document.querySelector(".picker-wrap");if(c&&c.appendChild(n),n.shadowRoot){(w=document.querySelector("emoji-picker"))==null||w.classList.add("light");const f=document.createElement("style");f.textContent=".picker { border-radius: 5px }",n.shadowRoot.appendChild(f)}};return Xe(()=>{y(),n.addEventListener("emoji-click",c=>g(c.detail))}),ps(()=>{n.removeEventListener("emoji-click",c=>g(c.detail))}),s({hidePicker:r,showPicker:u}),(c,w)=>{const f=He("svg-inline");return a(),d("div",A5,[e("button",{class:"emoji-toggle",onClick:m},[F(e("img",E5,null,512),[[f]])]),F(e("div",D5,null,512),[[Gt,i.value]])])}}});const F5=Oe(I5,[["__scopeId","data-v-973bdf64"]]),P5="/assets/dismiss-outline-ab03b5e7.svg",j5={class:"assign-agent--dropdown"},L5={class:"search-wrap"},R5={class:"search"},B5=["placeholder"],N5={src:P5},O5={key:1,class:"agent-list--wrap"},V5=["onClick"],U5={class:"thumbnail-name--wrap"},G5={key:0},W5={src:Ql,alt:"assign agent"},q5={key:0,class:"h-[290px] flex justify-center items-center flex-col"},H5=["src"],z5=fe({__name:"AssignAgentDropdown",props:{agents:{},currentAssignee:{},isLoading:{type:Boolean}},emits:["assign-agent"],setup(o,{emit:s}){const t=o,n=s,l=$(""),i=b(()=>t.agents.filter(y=>{var c;return((c=y.attributes.name)==null?void 0:c.toLowerCase().includes(l.value.toLowerCase()))&&y.attributes.status!=="pending"})),m=b(()=>i.value.length===0&&l.value!=="");function r(){l.value=""}function u(y){n("assign-agent",y)}const g=()=>{const y=document.activeElement;y&&y.blur();const c=document.querySelector("#agentSearch");c&&(c.focus(),c.select())};return Xe(async()=>{await Ft(),g()}),(y,c)=>{const w=Pe("Loader"),f=Pe("Thumbnail"),v=He("svg-inline");return a(),d("div",j5,[e("div",L5,[e("div",R5,[F(e("input",{type:"text",id:"agentSearch","onUpdate:modelValue":c[0]||(c[0]=C=>l.value=C),placeholder:y.$t("CONVERSATION.ACTIONS.ASSIGN_TO")},null,8,B5),[[bt,l.value]]),l.value!==""?(a(),d("div",{key:0,class:"clear-search--button",onClick:r},[F(e("img",N5,null,512),[[v]])])):h("",!0)])]),y.isLoading?(a(),ne(w,{key:0,size:"24px"})):(a(),d("div",O5,[(a(!0),d(Se,null,Ne(i.value,C=>(a(),d("div",{key:C.id,class:"agent-list",onClick:_=>u(C.id)},[e("div",U5,[W(f,{class:"agent-thumbnail","user-name":C.attributes.name,size:"32px",src:C.attributes.profile_photo_url},null,8,["user-name","src"]),e("span",{class:O(["agent-name",{"is-active":y.currentAssignee?y.currentAssignee.map(_=>_.id).includes(C.id):!1}])},I(C.attributes.name),3)]),y.currentAssignee&&y.currentAssignee.map(_=>_.id).includes(C.id)?(a(),d("div",G5,[F(e("img",W5,null,512),[[v]])])):h("",!0)],8,V5))),128)),m.value?(a(),d("div",q5,[e("img",{src:`${p(De)}illustrations/search.svg`},null,8,H5),c[1]||(c[1]=e("p",{class:"text-grey900 text-sm leading-leading400 text-center"},"No results...",-1))])):h("",!0)]))])}}});const K5=Oe(z5,[["__scopeId","data-v-0b7bd1d3"]]),Y5={key:0,class:"flex flex-nowrap"},Z5={class:"w-[30px] h-[30px] rounded-full overflow-hidden m-5 flex-shrink-0"},J5={class:"thumbnail-wrap"},Q5={class:"thumbnail w-[30px] h-[30px] flex rounded-full justify-content-center items-center cursor-pointer bg-[#8286DB]"},X5={class:"text-white"},eE={key:1,class:"chat--item--container"},tE={class:"chat--item"},sE={key:0,class:"profile--image rounded-full overflow-hidden m-5 flex-shrink-0 order-2"},aE={class:"thumbnail-wrap",style:{width:"30px",height:"30px"}},oE=["src","alt"],nE={key:1,class:"initials rounded-full overflow-hidden flex-shrink-0 order-2"},iE={class:"thumbnail-wrap"},lE={class:"thumbnail flex rounded-full justify-content-center items-center cursor-pointer bg-[#8286DB]",style:{"background-color":"rgb(130, 134, 219)",width:"32px",height:"32px"}},rE={class:"text-white"},dE=fe({__name:"TypingIndicator",props:{typingText:{type:String,default:""},senderName:{type:String,default:""},typingRecords:{type:Object}},emits:["scroll-to-bottom"],setup(o,{emit:s}){const t=s,n=o;return Xe(()=>{t("scroll-to-bottom")}),(l,i)=>(a(!0),d(Se,null,Ne(n.typingRecords,m=>(a(),d("div",{key:m.name,class:"pl-4 flex w-full mb-[-0.5rem] mt-[-1rem]"},[m.agent_id?(a(),d("div",eE,[e("div",tE,[m.agent_profile_picture?(a(),d("div",sE,[e("div",aE,[e("img",{class:"thumbnail-img",src:m.agent_profile_picture,alt:m.agent_profile_picture,style:{"background-color":"rgb(130, 134, 219)",width:"32px",height:"32px"}},null,8,oE)])])):(a(),d("div",nE,[e("div",iE,[e("div",lE,[e("span",rE,I(p(Wa)(m.name)),1)])])])),i[1]||(i[1]=da('<div class="text is-sender" data-v-fac134ed><div class="v-popper v-popper--theme-dropdown" data-v-fac134ed><div class="message-wrap--container" data-v-fac134ed><div class="message-wrap" data-v-fac134ed><div class="message-body--wrap gap-[5px]" data-v-fac134ed><p class="message italic opacity-60 inline text-sm" data-v-fac134ed>Typing</p><div class="inline mb-[6px]" data-v-fac134ed><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-white rounded-full opacity-0 animate-ping" data-v-fac134ed></div><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-white rounded-full opacity-0 animate-ping" data-v-fac134ed></div><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-white rounded-full opacity-0 animate-pingg__dot" data-v-fac134ed></div></div></div></div></div></div></div>',1))])])):(a(),d("div",Y5,[e("div",Z5,[e("div",J5,[e("div",Q5,[e("span",X5,I(p(Wa)(m.name)),1)])])]),i[0]||(i[0]=da('<div class="text relative flex flex-col ml-auto" data-v-fac134ed><div class="message-wrap--container" data-v-fac134ed><div class="flex flex-col items-end mb-4 mt-2" data-v-fac134ed><div class="message-body--wrap flex gap-[5px] ml-0.5 mb-1 pr-4 pl-2 bg-grey100 rounded-tl-none rounded-tr-lg rounded-br-lg rounded-bl-lg min-w-52" data-v-fac134ed><p class="inline text-sm text-opacity-60 text-grey900 italic font-normal" data-v-fac134ed>Typing</p><div class="inline mt-[29px]" data-v-fac134ed><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-primary rounded-full opacity-0 animate-ping" data-v-fac134ed></div><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-primary rounded-full opacity-0 animate-ping" data-v-fac134ed></div><div class="typing__dot float-left w-[6px] h-1.5 mx-1 bg-primary rounded-full opacity-0 animate-pingg__dot" data-v-fac134ed></div></div></div></div></div></div>',1))]))]))),128))}});const uE=Oe(dE,[["__scopeId","data-v-fac134ed"]]),cE={class:"typing-indicator"},mE=fe({__name:"TypingIndicatorUp",props:{typingText:{type:String,default:""}},setup(o){return(s,t)=>(a(),d("div",cE,[_e(I(o.typingText)+" ",1),t[0]||(t[0]=e("div",{class:"typing"},[e("span",{class:"circle scaling"}),e("span",{class:"circle scaling"}),e("span",{class:"circle scaling"})],-1))]))}});const gE=Oe(mE,[["__scopeId","data-v-8a89871b"]]),ti="/assets/drag-ab7cb09b.svg",sn="/assets/edit-pen-6786fa30.svg",ir="/assets/folder-cbe48d13.svg",pE="/assets/kebab-57b2fae0.svg",vE="/assets/blue-plus-circle-065d3ea5.svg";class Ri{index(){return ke.get("canned-responses/plus-folders")}indexByFolderId(s){return ke.get(`canned-response-folders/${s}?include[]=cannedResponses`)}create(s){const t=new FormData;return t.append("message",s.message),t.append("shortcut",s.shortcut),s.folder_name&&t.append("folder_name",s.folder_name),s.order_id&&t.append("order_id",s.order_id),ke.post("canned-responses",t)}delete(s){return ke.delete(`canned-responses/${s}`)}update(s,t){const n=new FormData;return n.append("message",t.message),n.append("shortcut",t.shortcut),t.folder_name&&n.append("folder_id",t.folder_name),t.order_id&&n.append("order_id",t.order_id),ke.put(`canned-responses/${s}`,n)}}function fE(){const{cannedResponses:o,cannedResponseFolders:s,meta:t,uiFlags:n}=Ts(Ya());async function l(){n.value.isFetchingCannedResponses=!0;try{const{data:f,meta:{folders:v,pagination:C}}=await new Ri().index();n.value.isFetchingCannedResponses=!1,o.value=f,s.value=v.filter(_=>_.canned_response_count>0),t.value=C}catch(f){Ze(f),n.value.isFetchingCannedResponses=!1}}async function i(f){n.value.isFetchingCannedResponseByFolder=!0;try{const{included:v}=await new Ri().indexByFolderId(f);n.value.isFetchingCannedResponseByFolder=!1;const C=s.value.find(_=>_.id===f);C&&(C.items=v)}catch(v){Ze(v),n.value.isFetchingCannedResponseByFolder=!1}}async function m(f){return n.value.isCreatingCannedResponse=!0,new Promise((v,C)=>{$e.emit(Me.CANNED_RESPONSE_CREATED,f,_=>{_.error?(ze().set({message:_.error.message,type:"error"}),n.value.isCreatingCannedResponse=!1,n.value.isCreatingCannedResponseFailed=!1,C(new Error(_.error.message))):(ze().set({message:"Canned response created",type:"success"}),n.value.isCreatingCannedResponse=!1,n.value.isCreatingCannedResponseFailed=!0,l(),v())})})}async function r(f){$e.emit(Me.CANNED_RESPONSE_DELETE,f,v=>{v.error?ze().set({message:"Not able to delete it",type:"error"}):ze().set({message:"Canned response deleted",type:"success"})})}async function u(f){$e.emit(Me.CANNED_RESPONSE_UPDATE,f,v=>{v.error?ze().set({message:v.error,type:"error"}):ze().set({message:"Canned response updated",type:"success"})})}async function g(f){$e.emit(Me.CANNED_RESPONSE_FOLDER_UPDATE,f,v=>{v.error?ze().set({message:"The folder name already exists. Please select a different name",type:"error"}):(ze().set({message:"Canned response folder updated",type:"success"}),l())})}async function y(f){$e.emit(Me.CANNED_RESPONSE_FOLDER_DELETE,f,v=>{v.error?ze().set({message:v.error,type:"error"}):ze().set({message:"Canned response folder deleted",type:"success"})})}async function c(f){$e.emit(Me.CANNED_RESPONSE_ORDER_UPDATE,f,v=>{v.error?ze().set({message:v.error,type:"error"}):ze().set({message:"Canned response order updated",type:"success"})})}async function w(f){$e.emit(Me.CANNED_RESPONSE_FOLDER_ORDER_UPDATE,f,v=>{v.error?ze().set({message:v.error,type:"error"}):ze().set({message:"Canned response folder order updated",type:"success"})})}return{getAllCannedResponses:l,getCannedResponsesByFolderId:i,createCannedResponse:m,deleteCannedResponse:r,updateCannedResponse:u,renameCannedResponseFolder:g,deleteCannedResponseFolder:y,updateCannedResponseOrder:c,updateCannedResponseFolderOrder:w}}const hE={class:"bg-white rounded-lg z-10 w-full"},_E={key:0,class:"flex h-full items-center justify-center"},yE={key:1},bE=["onClick"],wE=fe({__name:"CannedResponseFolderDropdown",props:{selectedFolder:{}},emits:["onFolderSelect","onFolderNameChange"],setup(o,{emit:s}){var H;const t=o,n=Ya(),l=b(()=>n.cannedResponseFolders),i=$({}),m=$(!1),r=$(((H=t.selectedFolder)==null?void 0:H.name)||""),u=$(null),g=$(null),y=$([]),c=$(0),w=$(!1),f=b(()=>i.value.name||""),v=b(()=>m.value&&_.value.length>0),C=s;We(r,()=>{w.value=!0});const _=b(()=>!w.value||r.value.trim()===""?l.value:l.value.filter(k=>k.name.toLowerCase().includes(r.value.toLowerCase()))),A=k=>{C("onFolderNameChange",k.target.value)},D=k=>{C("onFolderSelect",k),m.value=!1,r.value=k.name,i.value=k};Os(u,()=>{m.value=!1}),We(r,k=>{k&&!l.value.find(M=>M.name===k)&&(i.value={})});const T=()=>{m.value=!m.value},B=k=>k===0?c.value===0:c.value===k,S=()=>{Ft(()=>{const k=y.value[c.value];k&&g.value&&k.scrollIntoView({block:"nearest"})})},E=async k=>{k.key==="ArrowUp"&&(c.value===0?c.value=_.value.length-1:c.value-=1,S())},x=async k=>{k.key==="ArrowDown"&&(m.value=!0,c.value===_.value.length-1?c.value=0:c.value+=1,S())},P=()=>{D(_.value[c.value])},j=k=>{k.key==="Enter"&&m.value&&(k.preventDefault(),P(),m.value=!1)};return We(_,()=>{c.value=0}),We(m,k=>{k?n.uiFlags.isFolderDropdownOpen=!0:n.uiFlags.isFolderDropdownOpen=!1}),Xe(()=>{m.value||(n.uiFlags.isFolderDropdownOpen=!1),window.addEventListener("keydown",E),window.addEventListener("keydown",x),window.addEventListener("keydown",j)}),ps(()=>{window.removeEventListener("keydown",E),window.removeEventListener("keydown",x),window.removeEventListener("keydown",j)}),Un(()=>{t.selectedFolder&&(i.value=t.selectedFolder)}),(k,M)=>(a(),d("div",{class:"flex relative flex-col items-start gap-1 mt-6",ref_key:"folderlist",ref:u},[M[3]||(M[3]=e("span",{class:"text-sm text-[#93939d]"},"Create new or select folder (optional)",-1)),e("div",{class:"pl-3 pt-[2px] rounded-lg flex w-full border border-solid border-grey200 h-[46px]",onClick:T},[e("div",hE,[F(e("input",{id:"folder-search","onUpdate:modelValue":M[0]||(M[0]=V=>r.value=V),type:"text",autofocus:"",class:"folder-search p-0 h-[40px] border-b border-solid border-gray-200 w-full",placeholder:"Create new folder or select",onInput:A,maxlength:"30"},null,544),[[bt,r.value]])]),M[1]||(M[1]=e("div",{class:"px-2 flex"},[e("img",{src:Tt,alt:""})],-1))]),W(ms,{name:"modal-fade"},{default:K(()=>[v.value?(a(),d("div",{key:0,ref_key:"dropdownContainer",ref:g,class:"z-10 rounded absolute border border-sold border-gray-200 shadow-md top-[70px] overflow-y-auto bg-white max-h-24 w-full"},[l.value.length?(a(),d("div",yE,[(a(!0),d(Se,null,Ne(_.value,(V,Z)=>(a(),d("button",{key:V.id,ref_for:!0,ref_key:"folderItems",ref:y,class:"p-0 flex flex-col w-full",onClick:ae=>D(V)},[e("span",{class:O(["text-sm py-2 px-3 w-full items-center flex justify-start hover:bg-[#F6F6F8]",[f.value===V.name?"bg-[#F6F6F8]":"",B(Z)?"bg-grey100":""]])},I(V.name),3)],8,bE))),128))])):(a(),d("div",_E,M[2]||(M[2]=[e("span",{class:"text-sm py-2 px-2"},"No folders found",-1)])))],512)):h("",!0)]),_:1}),M[4]||(M[4]=e("span",{class:"text-gray-400 text-xs w-full"},"To list all the folders, enter # in the chat",-1))],512))}});const lr=Oe(wE,[["__scopeId","data-v-b54e60ab"]]),xE={class:"p-4"},CE={class:"flex flex-col items-center gap-1 mb-6"},kE={key:0,class:"text-red-500 text-xs w-full"},$E={class:"flex flex-col items-center gap-1"},SE=fe({__name:"AddCannedResponse",props:{showModal:{type:Boolean,default:!1}},emits:["closeAddCannedResponseModal","addCannedResponse"],setup(o,{emit:s}){const t=Ya(),n=b(()=>t.uiFlags.isCreatingCannedResponse),l=b(()=>t.uiFlags.isCreatingCannedResponseFailed),i=b(()=>t.uiFlags.isAddEditResponseOpen),m=b(()=>t.uiFlags.isFolderDropdownOpen),r=s,u=Nt({message:"",shortcut:""}),g=b(()=>({message:{required:ut},shortcut:{required:ut}})),y=bs(g,u),c=$(""),w=$(null),f=$(!1),v=B=>{c.value=B.name,f.value=!0},C=B=>{c.value=B},_=()=>{u.message="",u.shortcut="",c.value="",f.value=!1,y.value.$reset()},A=()=>{var E,x;if(y.value.$touch(),y.value.$pending||y.value.$error)return!1;const B=u.shortcut.startsWith("#")?u.shortcut:"#"+u.shortcut,S={message:u.message,shortcut:B,folder_name:c.value,team_id:(x=(E=Ae().user)==null?void 0:E.attributes)==null?void 0:x.team_id};r("addCannedResponse",S)},D=()=>{_(),r("closeAddCannedResponseModal"),t.uiFlags.isAddEditResponseOpen=!1},T=()=>{m.value&&!f.value?setTimeout(()=>{f.value=!0},200):A()};return We(i,B=>{B&&Ft(()=>{w.value&&w.value.focus()})}),We(l,B=>{B&&(_(),t.uiFlags.isCreatingCannedResponseFailed=!1)}),(B,S)=>{const E=Pe("InputField"),x=Pe("Modal");return B.showModal?(a(),ne(x,{key:0,"header-title":"Add new canned response",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",closeModal:B.showModal,isLoading:n.value,onActionButtonTypeOne:D,onActionButtonTypeTwo:T,onCloseModal:D},{default:K(()=>[e("div",xE,[e("div",CE,[S[3]||(S[3]=e("label",{for:"message",class:"mb-0 text-sm font-normal w-full"},"Message",-1)),F(e("textarea",{ref_key:"messageInput",ref:w,"onUpdate:modelValue":S[0]||(S[0]=P=>u.message=P),type:"text",id:"message",class:O(["text-[#282D3E] rounded-md h-48 focus:border-blue-500",{"border-red-500 focus:border-red-500 bg-[#fff2f2]":p(y).message.$error}]),name:"message",placeholder:"Enter new canned response here",onBlur:S[1]||(S[1]=(...P)=>p(y).message.$touch&&p(y).message.$touch(...P))},null,34),[[bt,u.message]]),p(y).message.$error?(a(),d("span",kE,"Message is required")):h("",!0)]),e("div",$E,[W(E,{label:"Shortcut",value:u.shortcut,type:"text",forValue:"shortcut",placeholder:"For example #welcome_new_user",hasError:p(y).shortcut.$error,validationMessage:p(y).shortcut.$errors,onInput:S[2]||(S[2]=P=>u.shortcut=P),onBlur:p(y).shortcut.$touch,onKeydown:Ut(T,["enter"]),maxlength:30},null,8,["value","hasError","validationMessage","onBlur"]),S[4]||(S[4]=e("span",{class:"text-gray-400 text-xs w-full"},'Quickly access responses by entering "#+shortcut" in the chat',-1))]),W(lr,{onOnFolderSelect:v,onOnFolderNameChange:C,onKeydown:Ut(T,["enter"])})])]),_:1},8,["closeModal","isLoading"])):h("",!0)}}}),TE={class:"p-4"},ME={class:"flex flex-col items-center gap-1 mb-6"},AE={key:0,class:"text-red-500 text-xs w-full"},EE={class:"flex flex-col items-center gap-1"},DE={key:0,class:"absolute bg-white shadow-md rounded-md w-[349px] h-[141px] -left-[232px] bottom-[28px] z-50"},IE=fe({__name:"EditCannedResponse",props:{showModal:{type:Boolean,default:!1},selectedCannedResponse:{},activeFolder:{}},emits:["closeEditCannedResponseModal","deleteCannedResponse","editCannedResponse"],setup(o,{emit:s}){var D,T,B,S,E;const t=Ya(),n=o,l=s,i=b(()=>t.uiFlags.isAddEditResponseOpen),m=Nt({message:((T=(D=n.selectedCannedResponse)==null?void 0:D.attributes)==null?void 0:T.message)||"",shortcut:((S=(B=n.selectedCannedResponse)==null?void 0:B.attributes)==null?void 0:S.shortcut)||""}),r=$(((E=n.activeFolder)==null?void 0:E.name)||null),u=$(null),g=x=>{r.value=x};Un(()=>{var x,P,j,H;m.message=((P=(x=n.selectedCannedResponse)==null?void 0:x.attributes)==null?void 0:P.message)||"",m.shortcut=((H=(j=n.selectedCannedResponse)==null?void 0:j.attributes)==null?void 0:H.shortcut)||""});const y=b(()=>({message:{required:ut},shortcut:{required:ut}})),c=bs(y,m),w=$(!1),f=()=>{w.value=!w.value},v=x=>{r.value=x.name},C=()=>{var j,H,k,M;if(c.value.$touch(),c.value.$pending||c.value.$error)return!1;const x=m.shortcut.startsWith("#")?m.shortcut:"#"+m.shortcut,P={message:m.message,shortcut:x,folder_name:r.value||((j=n.activeFolder)==null?void 0:j.name),team_id:(k=(H=Ae().user)==null?void 0:H.attributes)==null?void 0:k.team_id,canned_response_id:(M=n.selectedCannedResponse)==null?void 0:M.id};l("editCannedResponse",P)},_=()=>{var P,j,H;const x={team_id:(j=(P=Ae().user)==null?void 0:P.attributes)==null?void 0:j.team_id,canned_response_id:(H=n.selectedCannedResponse)==null?void 0:H.id};l("deleteCannedResponse",x),w.value=!1},A=()=>{l("closeEditCannedResponseModal"),t.uiFlags.isAddEditResponseOpen=!1};return We(i,x=>{x&&Ft(()=>{u.value&&u.value.focus()})}),(x,P)=>{const j=Pe("InputField"),H=Pe("Modal");return x.showModal?(a(),ne(H,{key:0,"header-title":"Edit canned response",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",alertButtonText:"Delete response",closeModal:x.showModal,onActionAlertButton:f,onActionButtonTypeOne:A,onActionButtonTypeTwo:C,onCloseModal:A},{"delete-popover":K(()=>[w.value?(a(),d("div",DE,[P[5]||(P[5]=e("p",{class:"text-base p-4 text-grey900 m-0"},"Are you sure you want to delete this canned response?",-1)),e("div",{class:"flex flex-row gap-2 items-center justify-end border-t border-solid border-grey200 p-4"},[e("button",{class:"bg-grey100 text-grey900 text-sm rounded px-2 py-1",onClick:f},"Cancel"),e("button",{class:"bg-[#FF424D] text-white text-sm rounded px-2 py-1",onClick:_},"Delete response")])])):h("",!0)]),default:K(()=>[e("div",TE,[e("div",ME,[P[3]||(P[3]=e("label",{for:"message",class:"mb-0 text-sm font-normal w-full"},"Message",-1)),F(e("textarea",{ref_key:"messageInput",ref:u,"onUpdate:modelValue":P[0]||(P[0]=k=>m.message=k),type:"text",id:"message",class:O(["text-[#282D3E] rounded-md h-48 focus:border-blue-500",{"border-red-500 focus:border-red-500 bg-[#fff2f2]":p(c).message.$error}]),name:"message",placeholder:"Enter message",onBlur:P[1]||(P[1]=(...k)=>p(c).message.$touch&&p(c).message.$touch(...k))},null,34),[[bt,m.message]]),p(c).message.$error?(a(),d("span",AE,"Message is required")):h("",!0)]),e("div",EE,[W(j,{label:"Shortcut",value:m.shortcut,type:"text",forValue:"shortcut",placeholder:"Enter shortcut",hasError:p(c).shortcut.$error,validationMessage:p(c).shortcut.$errors,onInput:P[2]||(P[2]=k=>m.shortcut=k),onBlur:p(c).shortcut.$touch,onKeydown:Ut(C,["enter"]),maxlength:30},null,8,["value","hasError","validationMessage","onBlur"]),P[4]||(P[4]=e("span",{class:"text-gray-400 text-xs w-full"},'Quickly access responses by entering "#+shortcut" in the chat',-1))]),W(lr,{onOnFolderSelect:v,onOnFolderNameChange:g,selectedFolder:x.activeFolder,onKeydown:Ut(C,["enter"])},null,8,["selectedFolder"])])]),_:1},8,["closeModal"])):h("",!0)}}});const FE=Oe(IE,[["__scopeId","data-v-58a7fb9e"]]),PE={class:"absolute h-[28rem] left-0 w-96 z-40 flex justify-between flex-col overflow-y-auto border border-sold border-gray-200 overflow-x-hidden bg-white shadow-2xl rounded bottom-[11rem] canned-modal"},jE={key:0,class:"h-full items-center flex justify-center"},LE={key:1,class:"text-sm py-2 px-2"},RE={key:1,class:"h-full items-center flex justify-center"},BE={key:2,class:"flex flex-col justify-between h-[calc(100%-32px)]"},NE={key:0,class:"flex flex-col gap-1 overflow-auto h-[100%]"},OE={src:ti},VE=["onClick"],UE={src:sn},GE=["onClick"],WE={class:"flex"},qE={class:"text-sm font-normal text-gray-700 mt-0 mb-0.5"},HE=["onClick"],zE={src:ir,class:"folder-icon"},KE={class:"text-sm font-normal text-[#282D3E] m-0"},YE={class:"text-xs text-gray-600 m-0"},ZE=["onClick"],JE={class:"flex flex-row items-center justify-between w-full"},QE={class:"stroke-[#93939d] mr-[5px]",src:ir},XE={class:"absolute left-0 cursor-move drag-icon"},e6={src:ti},t6={class:"text-sm font-normal text-gray-900"},s6={class:"bg-grey200 px-1.5 rounded-full text-xs pt-0 text-gray-600 ml-auto canned-response-count"},a6=["onClick"],o6={src:pE},n6={class:"edit-folder-modal w-44 h-[90px] flex flex-col justify-center items-center"},i6={class:"w-full"},l6={src:sn},r6={key:1,class:"flex flex-col gap-1 overflow-auto"},d6={class:"text-sm font-semibold text-gray-900 ml-1"},u6={key:1},c6={class:"absolute left-0 flex items-center cursor-move top-0 bottom-0 drag-icon"},m6={src:ti},g6=["onClick"],p6={src:sn},v6=["onClick"],f6={class:"text-sm font-normal text-gray-700 mt-0 mb-0.5"},h6={class:"text-xs text-gray-600 m-0"},_6={src:vE},y6={class:"rename-modal"},b6={class:"rename-container pb-0 pt-5 px-5"},w6={class:"delete-modal"},x6={class:"delete-container pb-0 pt-5 px-5 flex items-center gap-2"},C6=fe({__name:"CannedResponse",props:{selectedCannedResponseForSearch:{type:String,default:null}},emits:["insertCannedResponse"],setup(o,{emit:s}){const t=Ya(),{getCannedResponsesByFolderId:n,createCannedResponse:l,getAllCannedResponses:i,updateCannedResponse:m,deleteCannedResponse:r,renameCannedResponseFolder:u,deleteCannedResponseFolder:g,updateCannedResponseOrder:y,updateCannedResponseFolderOrder:c}=fE(),w=o,f=$(!1),v=$(!1),C=$(!1),_=$({}),A=$({}),D=$(0),T=$([]),B=$(!1),S=$(!1),E=$(!1),x=$(null);let P=$("");const j=$(!1),H=$(null),k=$(!1),M=$(!1),V=b(()=>t.cannedResponses.filter(qe=>qe.attributes.folder===null).slice().sort((qe,Je)=>qe.attributes.order_id-Je.attributes.order_id)),Z=b(()=>{if(w.selectedCannedResponseForSearch){const qe=w.selectedCannedResponseForSearch.toLowerCase(),Je=t.cannedResponses.filter(Re=>{var it;return Re.attributes.shortcut.toLowerCase().includes(qe)||Re.attributes.message.toLowerCase().includes(qe)||((it=Re.attributes.folder)==null?void 0:it.toLowerCase().includes(qe))}),ft=Je.filter(Re=>Re.attributes.shortcut.toLowerCase().includes(qe)),Ve=Je.filter(Re=>{var it;return!ft.includes(Re)&&((it=Re.attributes.folder)==null?void 0:it.toLowerCase().includes(qe))});return[...ft,...Ve]}else return V.value}),ae=b(()=>w.selectedCannedResponseForSearch?Z.value.length?Z.value:J.value:[...Z.value,...t.cannedResponseFolders]),ce=b(()=>t.cannedResponseFolders.slice().sort((qe,Je)=>qe.order_id-Je.order_id)),J=b(()=>w.selectedCannedResponseForSearch?[]:ce.value),X=b(()=>t.cannedResponses.length===0&&t.cannedResponseFolders.filter(qe=>qe.canned_response_count>0).length===0),z=b(()=>t.uiFlags.isFetchingCannedResponses),q=b(()=>t.uiFlags.isFetchingCannedResponseByFolder),ue=qe=>{_.value=qe,A.value.name=qe.attributes.folder,C.value=!0,t.uiFlags.isAddEditResponseOpen=!0},pe=()=>{v.value=!v.value,t.uiFlags.isAddEditResponseOpen=!0},de=qe=>{const Je=t.cannedResponseFolders.find(ft=>ft.id===qe);Je&&he(Je,new MouseEvent("click"))},he=(qe,Je)=>{if(Je.stopPropagation(),E.value)return E.value=!1;f.value=!0,D.value=0,A.value=qe,qe.id&&n(qe.id)},ve=qe=>{qe.stopPropagation(),f.value=!1,A.value={}},be=b(()=>{var qe;return((qe=A.value)==null?void 0:qe.name)||""}),re=s,ie=qe=>{E.value||re("insertCannedResponse",qe.attributes.message)},xe=async qe=>{try{await l(qe),await i(),v.value=!1,f.value=!1}catch{v.value=!0}},N=async qe=>{await m(qe),await i(),C.value=!1,f.value=!1},L=async qe=>{await r(qe),await i(),C.value=!1,f.value=!1},me=qe=>{var Je,ft;return((ft=(Je=qe.draggedContext)==null?void 0:Je.element)==null?void 0:ft.name)!=="apple"},G=async qe=>{var Ue,Ct,te;const Je=qe.newIndex+1,ft=(Ue=qe.item.__draggable_context)==null?void 0:Ue.element.id,Ve=t.cannedResponses.filter(Q=>Q.attributes.folder===null),Re=Ve.find(Q=>Q.id===ft);if(!Re)return;const it=[...Ve].sort((Q,Te)=>Q.attributes.order_id-Te.attributes.order_id);it.forEach((Q,Te)=>{Q.attributes.order_id=Te+1});const tt=Re.attributes.order_id,Be=it.map(Q=>Je>tt&&Q.attributes.order_id>tt&&Q.attributes.order_id<=Je?{...Q,attributes:{...Q.attributes,order_id:Q.attributes.order_id-1}}:Je<tt&&Q.attributes.order_id<tt&&Q.attributes.order_id>=Je?{...Q,attributes:{...Q.attributes,order_id:Q.attributes.order_id+1}}:Q),at=Be.findIndex(Q=>Q.id===ft);at!==-1&&(Be[at].attributes.order_id=Je),t.cannedResponses=t.cannedResponses.map(Q=>Be.find(je=>je.id===Q.id)||Q);try{for(const Q of Be){const Te={team_id:(te=(Ct=Ae().user)==null?void 0:Ct.attributes)==null?void 0:te.team_id,canned_response_id:Q.id,order_id:Q.attributes.order_id};await y(Te)}}catch(Q){console.error("Failed to update canned response order:",Q)}},U=async qe=>{var at;const Je=qe.newIndex+1,ft=(at=qe.item.__draggable_context)==null?void 0:at.element.id,Ve=t.cannedResponseFolders.find(Ue=>Ue.id===ft);if(!Ve)return;const Re=[...t.cannedResponseFolders].sort((Ue,Ct)=>Ue.order_id-Ct.order_id);Re.forEach((Ue,Ct)=>{Ue.order_id=Ct+1});const it=Ve.order_id,tt=Re.map(Ue=>Je>it&&Ue.order_id>it&&Ue.order_id<=Je?{...Ue,order_id:Ue.order_id-1}:Je<it&&Ue.order_id<it&&Ue.order_id>=Je?{...Ue,order_id:Ue.order_id+1}:Ue),Be=tt.findIndex(Ue=>Ue.id===ft);Be!==-1&&(tt[Be].order_id=Je),t.cannedResponseFolders=tt;try{const Ue=tt.map(async Ct=>{var Q,Te;const te={team_id:(Te=(Q=Ae().user)==null?void 0:Q.attributes)==null?void 0:Te.team_id,canned_response_folder_id:Ct.id,order_id:Ct.order_id};return c(te)});await Promise.all(Ue)}catch(Ue){console.error("Failed to update canned response folder order:",Ue)}},R=async()=>{await Ft();const qe=T.value[D.value];qe&&qe.scrollIntoView({behavior:"smooth",block:"nearest"})},ee=qe=>qe===0?D.value===0:D.value===qe,se=async qe=>{if(qe.key==="ArrowUp"){if(v.value||C.value)return;if(qe.preventDefault(),D.value>0){let Je=T.value.reduce((Ve,Re,it)=>(Re&&Ve.push(it),Ve),[]),ft=Je.indexOf(D.value);if(ft>0){let Ve=ft-1;D.value=Je[Ve],await R()}}}},Y=async qe=>{var Je,ft;if(qe.key==="ArrowDown"){if(v.value||C.value)return;if(qe.preventDefault(),f.value)D.value<((ft=(Je=A.value)==null?void 0:Je.items)==null?void 0:ft.length)-1&&(D.value++,await R());else{let Ve=T.value.reduce((it,tt,Be)=>(tt&&it.push(Be),it),[]),Re=Ve.indexOf(D.value);if(Re<Ve.length-1){let it=Re+1;D.value=Ve[it],await R()}}}},Fe=()=>{f.value?ie(A.value.items[D.value]):ie(Z.value[D.value])},oe=qe=>{if(qe.key==="Enter"){if(v.value||C.value||B.value)return;qe.preventDefault(),Fe()}},st=(qe,Je)=>{Je.stopPropagation(),E.value=!0,x.value=qe.id,P.value=qe.name},Le=()=>{E.value=!1},le=()=>{B.value=!0,Ft(()=>{H.value&&H.value.focus()})},Ie=()=>{S.value=!0},rt=()=>{S.value=!1},Et=()=>{B.value=!1},ye=async()=>{var Je,ft;if(!P.value.trim()){ze().set({message:"Folder name is invalid. Please rename again",type:"error"});return}const qe={team_id:(ft=(Je=Ae().user)==null?void 0:Je.attributes)==null?void 0:ft.team_id,canned_response_folder_id:x.value,name:P.value};await u(qe),B.value=!1,E.value=!1},_t=async()=>{var ft,Ve,Re,it;const qe={team_id:(Ve=(ft=Ae().user)==null?void 0:ft.attributes)==null?void 0:Ve.team_id,canned_response_folder_id:x.value},Je={team_id:(it=(Re=Ae().user)==null?void 0:Re.attributes)==null?void 0:it.team_id,canned_response_folder_id:x.value,delete_responses:1};j.value?(await g(Je),await i(),j.value=!1):(await g(qe),await i()),S.value=!1,E.value=!1},Ce=()=>{M.value=!0},vt=()=>{M.value=!1};return We(Z,()=>{D.value=0}),We(()=>w.selectedCannedResponseForSearch,qe=>{k.value=!!qe}),Xe(()=>{i(),window.addEventListener("keydown",se),window.addEventListener("keydown",Y),window.addEventListener("keydown",oe)}),ps(()=>{window.removeEventListener("keydown",se),window.removeEventListener("keydown",Y),window.removeEventListener("keydown",oe)}),(qe,Je)=>{const ft=Pe("Loader"),Ve=Pe("Modal"),Re=He("svg-inline"),it=He("click-away");return a(),d(Se,null,[e("div",PE,[z.value||X.value?(a(),d("div",jE,[z.value?(a(),ne(ft,{key:0,size:"24px"})):h("",!0),!z.value&&X.value?(a(),d("span",LE,"No canned responses found")):h("",!0)])):ae.value.length?(a(),d("div",BE,[f.value?(a(),d("div",r6,[e("div",{class:"flex items-center cursor-pointer py-1 h-9 px-3 hover:bg-grey100 border-b border-sold border-gray-100",onClick:ve},[Je[7]||(Je[7]=e("img",{src:ws,alt:""},null,-1)),e("h6",d6,I(be.value),1)]),q.value?(a(),ne(ft,{key:0,size:"20px"})):(a(),d("div",u6,[W(p(Wo),{list:A.value.items,"item-key":"id",class:"list-group","ghost-class":"ghost",move:me,handle:".cursor-move",onEnd:G},{item:K(({element:tt,index:Be})=>[e("div",{ref:at=>T.value[Be]=at,class:O(["hover:bg-grey100 py-2 pl-[18px] pr-3 relative cursor-pointer border-b border-sold border-gray-100 item-wrap",ee(Be)?"bg-grey100":""])},[e("div",c6,[F(e("img",m6,null,512),[[Re]])]),e("button",{class:"absolute right-3 top-2.5 flex items-center cursor-pointer rounded drag-icon p-1 hover:bg-gray-200",onClick:at=>ue(tt)},[F(e("img",p6,null,512),[[Re]])],8,g6),e("div",{onClick:at=>ie(tt)},[e("h6",f6,I(tt.attributes.shortcut),1),e("p",h6,I(tt.attributes.message),1)],8,v6)],2)]),_:1},8,["list"])]))])):(a(),d("div",NE,[W(p(Wo),{list:Z.value,"item-key":"id",class:"list-group","ghost-class":"ghost",move:me,handle:".cursor-move",onEnd:G},{item:K(({element:tt,index:Be})=>[!tt.attributes.folder||k.value?(a(),d("div",{key:0,ref:at=>T.value[Be]=at,class:O(["hover:bg-grey100 py-2 pl-[18px] pr-3 relative cursor-pointer border-b border-sold border-gray-100 item-wrap",ee(Be)?"bg-grey100":""])},[e("div",{class:O(["absolute left-0 flex items-center cursor-move top-0 bottom-0 drag-icon",{"opacity-0":M.value}])},[F(e("img",OE,null,512),[[Re]])],2),e("button",{class:O(["absolute right-3 top-3 flex items-center cursor-pointer rounded drag-icon p-1 hover:bg-gray-200",{"opacity-0":M.value}]),onClick:at=>ue(tt)},[F(e("img",UE,null,512),[[Re]])],10,VE),e("div",{onClick:at=>ie(tt)},[e("div",WE,[e("h6",qE,I(tt.attributes.shortcut),1),tt.attributes.folder?(a(),d("div",{key:0,class:"flex bg-[#F6F6F8] justify-center items-center gap-1 rounded ml-2 px-[5px] py-[1px] search-folder",onMouseenter:Ce,onMouseleave:vt,onClick:Qe(at=>de(tt.attributes.folder_id),["stop"])},[F(e("img",zE,null,512),[[Re]]),e("h6",KE,I(tt.attributes.folder),1)],40,HE)):h("",!0)]),e("p",YE,I(tt.attributes.message),1)],8,GE)],2)):h("",!0)]),_:1},8,["list"]),W(p(Wo),{list:J.value,"item-key":"id",class:"list-group","ghost-class":"ghost",move:me,handle:".cursor-move",onEnd:U},{item:K(({element:tt})=>[e("div",{class:"flex relative py-1.5 pl-[18px] pr-3 items-center gap-2 cursor-pointer hover:bg-grey100 item-wrap",onClick:Be=>he(tt,Be)},[e("div",JE,[F(e("img",QE,null,512),[[Re]]),e("div",XE,[F(e("img",e6,null,512),[[Re]])]),e("h6",t6,I(tt.name),1),e("span",s6,I(tt.canned_response_count),1),e("div",{class:"absolute top-1 right-3 kebab-menu",onClick:Be=>st(tt,Be)},[F(e("img",o6,null,512),[[Re]])],8,a6)]),E.value&&x.value===tt.id?(a(),ne(Zs,{key:0,closeModal:E.value,class:"rename-delete-modal"},{default:K(()=>[F((a(),d("div",n6,[e("ul",i6,[e("li",{onClick:Qe(le,["stop"]),class:"flex gap-2.5 justify-start items-center cursor-pointer m-0 px-[22px] py-1.5"},[F(e("img",l6,null,512),[[Re]]),Je[5]||(Je[5]=e("span",null,"Rename Folder",-1))]),e("li",{onClick:Qe(Ie,["stop"]),class:"flex gap-2.5 justify-start items-center cursor-pointer m-0 px-[22px] py-1.5"},Je[6]||(Je[6]=[e("img",{class:"w-4 h-4",src:Xa,alt:""},null,-1),e("span",null,"Delete...",-1)]))])])),[[it,Le]])]),_:1},8,["closeModal"])):h("",!0)],8,ZE)]),_:1},8,["list"])]))])):(a(),d("div",RE,Je[4]||(Je[4]=[e("span",{class:"text-sm py-2 px-2"},"No canned responses found",-1)]))),e("button",{class:"rounded-none flex flex-row items-center gap-1 sticky bottom-0 cursor-pointer h-8 min-h-[2rem] px-[16px] bg-grey100",onClick:pe},[F(e("img",_6,null,512),[[Re]]),Je[8]||(Je[8]=e("span",null,"New canned response",-1))])]),W(SE,{showModal:v.value,onCloseAddCannedResponseModal:Je[0]||(Je[0]=tt=>v.value=!1),onAddCannedResponse:xe},null,8,["showModal"]),W(FE,{showModal:C.value,activeFolder:A.value,selectedCannedResponse:_.value,onCloseEditCannedResponseModal:Je[1]||(Je[1]=tt=>C.value=!1),onDeleteCannedResponse:L,onEditCannedResponse:N},null,8,["showModal","activeFolder","selectedCannedResponse"]),e("div",y6,[B.value?(a(),ne(Ve,{key:0,closeModal:B.value,onCloseModal:Et,actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save Changes",onActionButtonTypeOne:Et,onActionButtonTypeTwo:ye,onKeyup:Ut(ye,["enter"])},{default:K(()=>[e("div",b6,[Je[9]||(Je[9]=e("label",{for:"",class:"pb-2"},"Rename",-1)),F(e("input",{type:"text","onUpdate:modelValue":Je[2]||(Je[2]=tt=>Hr(P)?P.value=tt:P=tt),ref_key:"folderRenameInput",ref:H,maxlength:"30"},null,512),[[bt,p(P)]])])]),_:1},8,["closeModal"])):h("",!0)]),e("div",w6,[S.value?(a(),ne(Ve,{key:0,alertModal:!0,"header-title":"Are you sure you want to delete this folder?",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Delete Folder",closeModal:S.value,onActionButtonTypeOne:rt,onActionButtonTypeTwo:_t,onCloseModal:rt},{default:K(()=>[e("label",x6,[F(e("input",{type:"checkbox",class:"w-[18px] h-[18px]","onUpdate:modelValue":Je[3]||(Je[3]=tt=>j.value=tt)},null,512),[[Ia,j.value]]),Je[10]||(Je[10]=e("span",{class:"text-base text-[#282D3E]"},"Delete all the canned responses inside this folder",-1))])]),_:1},8,["closeModal"])):h("",!0)])],64)}}});const k6=Oe(C6,[["__scopeId","data-v-1f013fc9"]]),$6=(o="")=>new Xo({props:{decorations:s=>{const t=[],n=(l,i)=>{s.doc.content.size===2&&t.push(Gn.node(i,i+l.nodeSize,{class:"prose-placeholder empty-node","data-placeholder":o}))};return s.doc.descendants(n),zo.create(s.doc,t)}}}),rr=(o,s)=>{const{from:t,to:n,empty:l}=o.selection;if(l)return!!s.isInSet(o.tr.storedMarks||o.selection.$from.marks());let i=!1;return o.doc.nodesBetween(t,n,m=>{i=i||s.isInSet(m.marks)}),i},An=(o,s)=>{const{code:t}=o.schema.marks,n=s>=0&&o.doc.nodeAt(s);return n?!!n.marks.filter(l=>l.type===t).length:!1},S6=(o,s,t)=>{const{doc:n,schema:{marks:l}}=o;let i=!1;const m=r=>r.type===l.code||r.type===l.link;return n.nodesBetween(s,t,r=>{i=i||r.marks.filter(m).length>0}),i},T6=(o,s,t)=>{const{doc:n,schema:{marks:l}}=o;let i=!1;const m=r=>r.type===l.code;return n.nodesBetween(s,t,r=>{i=i||r.marks.filter(m).length>0}),i};function si(o,s=!1){const t=o.handler;return o.handler=(n,l,i,m)=>{const r=s?S6(n,i,m):T6(n,i,m);if(!(n.selection.$from.parent.type.spec.code||r))return t(n,l,i,m)},o}const Fs=(o,s,t=!1)=>si(new zr(o,s),t),ai="￼";function dr(o){const s=t=>t.isText?!!t.textContent.trim():t.type.name!=="hardBreak";if(o.isInline)return s(o);if(o.isBlock&&(o.isLeaf||o.isAtom))return!0;if(!o.childCount)return!1;for(let t=0;t<o.childCount;t++){const n=o.child(t);if(dr(n))return!0}return!1}function Bi(o){return!o||o.type.name==="paragraph"&&!o.textContent&&!o.childCount}function M6(o){if(o&&o.textContent)return!1;if(!o||!o.childCount||o.childCount===1&&Bi(o.firstChild))return!0;const s=[],t=[];return o.forEach(n=>{n.isInline?t.push(n):s.push(n)}),!t.length&&!s.filter(n=>!!n.childCount&&!(n.childCount===1&&Bi(n.firstChild))||n.isAtom).length}const A6=(...o)=>s=>o.reduceRight((t,n)=>n(t),s);function E6(o){return o.content}function ur(o,s,t){const n=[];for(let l=0,i=o.childCount;l<i;l++){const m=o.child(l),r=m.isLeaf?s(m,t,l):s(m.copy(ur(m.content,s,m)),t,l);r&&(r?n.push(...E6(r)):Array.isArray(r)?n.push(...r):n.push(r))}return qo.fromArray(n)}function D6(o,s){const t=ur(o.content,s);return new el(t,o.openStart,o.openEnd)}function I6(o){const{selection:s,doc:t}=o;return t.nodeSize-s.$to.pos-2===s.$to.depth}function F6(o){const{selection:s}=o;return s instanceof Ma&&!s.empty?!0:!I6(o)}function P6(o){const{selection:s}=o;return s.$from.pos===s.$from.depth}function j6(o){const{selection:s}=o;return s instanceof Ma&&!s.empty?!0:!P6(o)}async function cr(){const o=await Intl.DateTimeFormat().resolvedOptions().timeZone;return{"Africa/Asmera":"Africa/Nairobi","Africa/Timbuktu":"Africa/Abidjan","America/Argentina/ComodRivadavia":"America/Argentina/Catamarca","America/Atka":"America/Adak","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Catamarca":"America/Argentina/Catamarca","America/Coral_Harbour":"America/Panama","America/Cordoba":"America/Argentina/Cordoba","America/Ensenada":"America/Tijuana","America/Fort_Wayne":"America/Indiana/Indianapolis","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Jujuy":"America/Argentina/Jujuy","America/Knox_IN":"America/Indiana/Knox","America/Louisville":"America/Kentucky/Louisville","America/Mendoza":"America/Argentina/Mendoza","America/Montreal":"America/Toronto","America/Nipigon":"America/Toronto","America/Pangnirtung":"America/Iqaluit","America/Porto_Acre":"America/Rio_Branco","America/Rainy_River":"America/Winnipeg","America/Rosario":"America/Argentina/Cordoba","America/Santa_Isabel":"America/Tijuana","America/Shiprock":"America/Denver","America/Thunder_Bay":"America/Toronto","America/Virgin":"America/Puerto_Rico","America/Yellowknife":"America/Edmonton","Antarctica/South_Pole":"Pacific/Auckland","Asia/Ashkhabad":"Asia/Ashgabat","Asia/Calcutta":"Asia/Kolkata","Asia/Chongqing":"Asia/Shanghai","Asia/Chungking":"Asia/Shanghai","Asia/Dacca":"Asia/Dhaka","Asia/Harbin":"Asia/Shanghai","Asia/Istanbul":"Europe/Istanbul","Asia/Kashgar":"Asia/Urumqi","Asia/Katmandu":"Asia/Kathmandu","Asia/Macao":"Asia/Macau","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Tel_Aviv":"Asia/Jerusalem","Asia/Thimbu":"Asia/Thimphu","Asia/Ujung_Pandang":"Asia/Makassar","Asia/Ulan_Bator":"Asia/Ulaanbaatar","Atlantic/Faeroe":"Atlantic/Faroe","Atlantic/Jan_Mayen":"Europe/Berlin","Australia/ACT":"Australia/Sydney","Australia/Canberra":"Australia/Sydney","Australia/Currie":"Australia/Hobart","Australia/LHI":"Australia/Lord_Howe","Australia/North":"Australia/Darwin","Australia/NSW":"Australia/Sydney","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Australia/Yancowinna":"Australia/Broken_Hill","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse",CET:"Europe/Paris","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",CST6CDT:"America/Chicago",Cuba:"America/Havana",EET:"Europe/Sofia",Egypt:"Africa/Cairo",Eire:"Europe/Dublin",EST:"",EST5EDT:"America/New_York","Etc/GMT":"","Etc/GMT+0":"","Etc/GMT+1":"","Etc/GMT+10":"","Etc/GMT+11":"","Etc/GMT+12":"","Etc/GMT+2":"","Etc/GMT+3":"","Etc/GMT+4":"","Etc/GMT+5":"","Etc/GMT+6":"","Etc/GMT+7":"","Etc/GMT+8":"","Etc/GMT+9":"","Etc/GMT-0":"","Etc/GMT-1":"","Etc/GMT-10":"","Etc/GMT-11":"","Etc/GMT-12":"","Etc/GMT-13":"","Etc/GMT-14":"","Etc/GMT-2":"","Etc/GMT-3":"","Etc/GMT-4":"","Etc/GMT-5":"","Etc/GMT-6":"","Etc/GMT-7":"","Etc/GMT-8":"","Etc/GMT-9":"","Etc/GMT0":"","Etc/Greenwich":"","Etc/UCT":"","Etc/Universal":"","Etc/UTC":"","Etc/Zulu":"","Europe/Belfast":"Europe/London","Europe/Kiev":"Europe/Kyiv","Europe/Nicosia":"Asia/Nicosia","Europe/Tiraspol":"Europe/Chisinau","Europe/Uzhgorod":"Europe/Kyiv","Europe/Zaporozhye":"Europe/Kyiv",Factory:"",GB:"Europe/London","GB-Eire":"Europe/London",GMT:"","GMT+0":"","GMT-0":"",GMT0:"",Greenwich:"",Hongkong:"Asia/Hong_Kong",HST:"Pacific/Honolulu",Iceland:"Africa/Abidjan",Iran:"Asia/Jerusalem",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli",MET:"","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",MST:"",MST7MDT:"",Navajo:"America/Denver",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham","Pacific/Enderbury":"Pacific/Kanton","Pacific/Johnston":"Pacific/Honolulu","Pacific/Ponape":"Pacific/Guadalcanal","Pacific/Samoa":"Pacific/Pago_Pago","Pacific/Truk":"Pacific/Port_Moresby","Pacific/Yap":"Pacific/Port_Moresby",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",PRC:"Asia/Shanghai",PST8PDT:"America/Los_Angeles",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/East-Indiana":"America/Indiana/Indianapolis","US/Eastern":"America/New_York","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago","W-SU":"Europe/Moscow",WET:"Europe/Lisbon"}[o]||o}const L6=3,mr=o=>{const{$from:s}=o.selection,{list_item:t,paragraph:n}=o.schema.nodes;return tl(t)(o.selection)&&s.parent.type===n},gr=(o,s)=>{const{bullet_list:t,ordered_list:n}=s;let l=0;for(let i=o.depth-1;i>0;i--){const m=o.node(i);(m.type===t||m.type===n)&&(l+=1)}return l};function R6(o,s){return t=>(n,l)=>t((i,m)=>{const r=i.doc.resolve(s.start),u=i.doc.resolve(s.end),g=m.doc.resolve(m.mapping.map(s.end-1));g.nodeBefore&&g.nodeAfter&&g.nodeBefore.type===g.nodeAfter.type&&u.nodeAfter&&u.nodeAfter.type===o&&u.parent.type===r.parent.type&&m.join(g.pos),l&&l(m.scrollIntoView())})}function pr(){return function(o,s){const{list_item:t}=o.schema.nodes,{$from:n,$to:l}=o.selection;if(mr(o)){const i=n.blockRange(l,m=>m.childCount>0&&m.firstChild.type===t);return i?A6(R6(t,i),vo)(t)(o,s):!1}return!1}}function vr(o){return function(s,t){const n=s.selection,l=n.$from,i=n.$to,m=n.node;if(m&&m.isBlock||l.depth<2||!l.sameParent(i))return!1;const r=l.node(-1);if(r.type!==o)return!1;if(r.content.content.length<=1&&l.parent.content.size===0&&r.content.size!==0){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(t){let c=qo.empty;const w=l.index(-1)>0;for(let v=l.depth-(w?1:2);v>=l.depth-3;v--)c=qo.from(l.node(v).copy(c));c=c.append(qo.from(o.createAndFill()));const f=s.tr.replace(l.before(w?void 0:-1),l.after(-3),new el(c,w?3:2,2));f.setSelection(Ko.near(f.doc.resolve(l.pos+(w?3:2)))),t(f.scrollIntoView())}return!0}const u=i.pos===l.end()?r.contentMatchAt(0).defaultType:void 0,g=s.tr.delete(l.pos,i.pos),y=u&&[void 0,{type:u}];return t&&t(g.split(l.pos,2,y).scrollIntoView()),!0}}const B6=(o,s)=>{const{selection:t}=o;if(t.empty){const{$from:n}=t,{list_item:l}=o.schema.nodes,i=n.node(n.depth),m=n.node(n.depth-1);if(m&&m.type===l){const r=dr(m);return M6(i)&&!r?pr()(o,s):vr(l)(o,s)}}return!1};function N6(o,s){let t,n=s.tr.selection.$to.pos;do{const l=s.doc.resolve(n);if(t=gr(l,s.schema.nodes),t>L6)return!1;n++}while(t>=o);return!0}function O6(){return function(o,s){const{list_item:t}=o.schema.nodes;if(mr(o)){const n=gr(o.selection.$from,o.schema.nodes);return N6(n,o)&&Kr(t)(o,s),!0}return!1}}const V6=(o,s,t,n,l)=>(l.doc.nodesBetween(l.mapping.map(o),l.mapping.map(s),(i,m)=>{if(!i.isText)return!0;const r=Math.max(m,l.mapping.map(o)),u=Math.min(m+i.nodeSize,l.mapping.map(s));return t?l.removeMark(r,u,n):l.addMark(r,u,n),!0}),l),U6=()=>(o,s)=>{const{code:t}=o.schema.marks,{empty:n,$cursor:l}=o.selection;if(!n||!l)return!1;const{storedMarks:i}=o.tr;if(t){const m=rr(o,t.create()),r=o.doc.rangeHasMark(l.pos,l.pos,t),u=o.doc.rangeHasMark(l.pos,l.pos+1,t),g=!r&&!u&&(!i||!!i.length),y=!r&&u&&(!i||!i.length);if(!m&&y)return s&&s(o.tr.addStoredMark(t.create())),!0;if(m&&g)return s&&s(o.tr.removeStoredMark(t)),!0}return!1},G6=()=>(o,s)=>{const{code:t}=o.schema.marks,{empty:n,$cursor:l}=o.selection;if(!n||!l)return!1;const{storedMarks:i}=o.tr;if(t){const m=t&&rr(o,t.create()),r=An(o,l.pos),u=An(o,l.pos-1),g=An(o,l.pos-2),y=r&&!u&&Array.isArray(i),c=u&&!g&&(i===null||Array.isArray(i)&&!!i.length),w=(y&&Array.isArray(i)&&!i.length||!y&&i===null)&&!u&&g,f=!r&&u&&Array.isArray(i)&&!i.length;if(!m&&w){const C=o.tr.setSelection(Ko.near(o.doc.resolve(l.pos-1)));return s&&s(C.removeStoredMark(t)),!0}if(!m&&f)return s&&s(o.tr.addStoredMark(t.create())),!0;if(m&&c){const C=o.tr.setSelection(Ko.near(o.doc.resolve(l.pos-1)));return s&&s(C.addStoredMark(t.create())),!0}const v=l.index(l.depth-1)===0;if(m&&(y||!l.nodeBefore&&v))return s&&s(o.tr.removeStoredMark(t)),!0}return!1},oi=(o,s,t,n,l,i)=>{const{hard_break:m,code_block:r,list_item:u}=o.schema.nodes,g=o.doc.resolve(n);if(g.nodeAfter.type!==m||g.depth>1&&!(s===r&&tl(u)(o.selection)))return null;let y=o.tr.delete(n,l).split(n),c=y.doc.nodeAt(n+1),w=!1;y.doc.nodesBetween(n,n+c.nodeSize,(D,T)=>{!w&&D.type===m&&(w=!0,y=y.split(T+1).delete(T,T+1))}),w&&(c=y.doc.nodeAt(n+1));const{blockquote:f,paragraph:v}=o.schema.nodes;let C,_;s===f?(_=3,C=[v.create({},c.content)]):(_=2,C=c.content);const A=s.create(i,C);return y=y.setSelection(new sl(y.doc.resolve(n+1))).replaceSelectionWith(A).setSelection(new Ma(y.doc.resolve(n+_))),y};function W6(o,s){if(!o.selection.empty)return o.tr;const t=o.schema.nodes.code_block,n=o.selection.$from,l=n.before(),i=n.end(),m=D6(o.doc.slice(n.pos,i),u=>u.type===o.schema.nodes.hard_break?o.schema.text(`
`):u.isText?u.mark([]):u.isInline?u.attrs.text?o.schema.text(u.attrs.text):null:u.content.childCount?u.content:null),r=o.tr.replaceRange(n.pos,i,m);return n.parentOffset>=3?r.split(n.pos,void 0,[{type:t,attrs:s}]):r.setNodeMarkup(l,t,s,[])}function q6(o){if(!o.selection)return!1;const{$from:s}=o.selection,t=s.parent;if(!t.isTextblock||t.type===o.schema.nodes.code_block)return!1;const n=s.depth-1,l=s.node(n),i=s.index(n);return l.canReplaceWith(i,i+1,o.schema.nodes.code_block)}const H6=(o,s)=>{const{$cursor:t}=o.selection;if(t&&!t.nodeBefore&&!t.nodeAfter&&t.pos===1){const{tr:n,schema:l}=o,{paragraph:i}=l.nodes,{parent:m}=t;return n.setNodeMarkup(0,i,m.attrs,[]),s&&s(n),!0}return!1};function fr(o){const{selection:{$from:s}}=o,t=s.node(s.depth),n=!!t&&t.type===o.schema.nodes.code_block,l=o.selection instanceof sl;return s.depth>1||l||n}const z6=(o,s)=>!F6(o)&&fr(o)?(hr(!0)(o,s),!0):!1,K6=(o,s)=>!j6(o)&&fr(o)?(hr(!1)(o,s),!0):!1;function Y6(o){const s=o.selection.$from.node(1);return s.isTextblock&&s.type!==o.schema.nodes.code_block&&s.nodeSize===2}function Z6(o,s){const{$from:t,$to:n}=o.selection;let l;return s?l=n.end(0):l=t.start(0),l}function J6(o,s){const{$from:t,$to:n}=o.selection;let l;return s?(l=n.end(n.depth),l=n.depth>0?l+1:l):(l=t.start(t.depth),l=t.depth>0?l-1:l),l}function hr(o=!0){return function(s,t){const n=s.schema.nodes.paragraph;if(!n)return!1;let l;if(s.selection instanceof Ma){if(Y6(s))return!1;l=Z6(s,o)}else l=J6(s,o);const i=n.createAndFill(),m=s.tr.insert(l,i);return m.setSelection(Ma.create(m.doc,l+1)),t&&t(m),!0}}function Qo(o,s){const{$from:t}=o.selection;return t.node(-2)&&t.node(-2).type===s}function _r(...o){return(s,t)=>{const n=m=>{s=s.apply(m),t(m)},l=o.pop();return o.reduce((m,r)=>m||r(s,n),!1)&&l!==void 0&&l(s,t)}}function Q6(o,s){const{schema:t}=o;return Qo(o,t.nodes.bullet_list)?vo(t.nodes.list_item)(o,s):Qo(o,t.nodes.ordered_list)?_r(vo(o.schema.nodes.list_item),Yo(o.schema.nodes.bullet_list))(o,s):Yo(t.nodes.bullet_list)(o,s)}function X6(o,s){const{schema:t}=o;return Qo(o,t.nodes.ordered_list)?vo(t.nodes.list_item)(o,s):Qo(o,t.nodes.bullet_list)?_r(vo(o.schema.nodes.list_item),Yo(o.schema.nodes.ordered_list))(o,s):Yo(t.nodes.ordered_list)(o,s)}const e8=6;function t8(o){return{level:o[1].length}}function s8(o,s){return Yr(new RegExp("^(#{1,"+s+"})\\s$"),o,t8)}function a8(o){return Zr(/^\s*>\s$/,o)}function o8(o){const s=si(s8(o.nodes.heading,e8),!0),t=Fs(new RegExp(`${ai}(#{1,6})\\s$`),(n,l,i,m)=>{const r=l[1].length;return oi(n,o.nodes.heading,`heading${r}`,i,m,{level:r})},!0);return[s,t]}function n8(o){const s=si(a8(o.nodes.blockquote),!0),t=Fs(new RegExp(`${ai}\\s*>\\s$`),(n,l,i,m)=>oi(n,o.nodes.blockquote,"blockquote",i,m),!0);return[s,t]}function i8(o){const s=Fs(/((^`{3,})|(\s`{3,}))(\S*)$/,(n,l,i,m)=>{const r={};l[4]&&(r.language=l[4]);const u=l[0][0]===" "?i+1:i;if(q6(n))return W6(n,r).delete(u,m).scrollIntoView();let{tr:g}=n;g=g.delete(u,m);const y=n.schema.nodes.code_block.createChecked();return Jr(y)(g)},!0),t=Fs(new RegExp(`((${ai}\`{3,})|(\\s\`{3,}))(\\S*)$`),(n,l,i,m)=>{const r={};return l[4]&&(r.language=l[4]),oi(n,o.nodes.code_block,"codeblock",i,m,r)},!0);return[s,t]}function l8(o){const s=[];if(o.nodes.heading&&s.push(...o8(o)),o.nodes.blockquote&&s.push(...n8(o)),o.nodes.code_block&&s.push(...i8(o)),s.length!==0)return al({rules:s})}const En=typeof navigator<"u"?/Mac/.test(navigator.platform):!1;function r8(o){const s=Xr;function t(m,r){s[m]=r}t("Mod-z",co(yi,ed)),t("Shift-Mod-z",bi);const n=co(yi,H6,ud,dd,rd);if(t("Backspace",n),t("Mod-Backspace",n),En||t("Mod-y",bi),t("Alt-ArrowUp",td),t("Alt-ArrowDown",sd),t("Escape",ad),t("ArrowLeft",G6()),t("ArrowRight",U6()),t("ArrowDown",z6),t("ArrowUp",K6),o.marks.strong&&(t("Mod-b",Hs(o.marks.strong)),t("Mod-B",Hs(o.marks.strong))),o.marks.em&&(t("Mod-i",Hs(o.marks.em)),t("Mod-I",Hs(o.marks.em))),o.marks.superscript&&t("Shift-Mod-.",Hs(o.marks.superscript)),o.nodes.hard_break){const m=o.nodes.hard_break,r=co(cd,(u,g)=>(g(u.tr.insertText("").replaceSelectionWith(m.create()).scrollIntoView()),!0));t("Mod-Enter",r),t("Shift-Enter",r),En&&t("Ctrl-Enter",r)}const l=En?"Mod-Enter":"Alt-Enter",i=[od,nd,id,ld];return o.nodes.list_item&&(i.unshift(B6),i.unshift(vr(o.nodes.list_item)),t("Tab",O6()),t("Shift-Tab",pr())),t("Enter",co.apply(null,i)),t(l,co.apply(null,i)),Qr(s)}const Ni={"**":["_","~~","^"],"*":["__","~~","^"],"^":["*","_"],__:["*","~~","^"],_:["**","~~","^"],"~~":["__","_","**","*","^"]},yr=(o,s)=>{for(let t=0;t<Ni[o].length;t++){const n=Ni[o][t];if(n===s)return!0;const l=s.length-n.length;if(s.substr(l,s.length)===n)return yr(n,s.substr(0,l))}return!1};function qa(o,s,t,n){return(l,i,m,r)=>{const[,u,g]=i,y=r,c=g?m+u.length:m,w=l.doc.resolve(m+u.length).nodeBefore;if(u&&u.length>0&&!yr(n,u)&&!(w&&w.type===l.schema.nodes.hard_break)||l.schema.marks.code&&l.schema.marks.code.isInSet(l.doc.resolve(c+1).marks()))return null;let f=!1;if(l.doc.nodesBetween(c,y,C=>C.type===s.nodes.hard_break?(f=!0,!1):!f),f||l.doc.resolve(c).sameParent(l.doc.resolve(y))&&!l.doc.resolve(c).parent.type.allowsMarkType(o))return null;let v=l.tr.addMark(c,y,o.create());return t>1&&(v=v.delete(y-(t-1),y)),v.delete(c,c+t).removeStoredMark(o)}}function d8(o,s){return(t,n,l,i)=>{if(n[1]&&n[1].length>0&&[y=>y==="(",y=>{const c=t.doc.resolve(l+y.length).nodeBefore;return c&&c.type===t.schema.nodes.hard_break||!1}].every(y=>!y(n[1]))||t.doc.resolve(l).sameParent(t.doc.resolve(i))&&!t.doc.resolve(l).parent.type.allowsMarkType(o))return null;const m=t.tr;t.selection.from!==t.selection.to&&(m.delete(t.selection.from,t.selection.to),i-=t.selection.to-t.selection.from);const r=i-n[2].length+1,u=t.schema.marks.code.create();return V6(r,i,!1,u,m).setStoredMarks([u]).delete(r,r+s.length).removeStoredMark(o)}}const u8=/(\S*)(\_\_([^\_\s](\_(?!\_)|[^\_])*[^\_\s]|[^\_\s])\_\_)$/,c8=/(\S*)(\*\*([^\*\s](\*(?!\*)|[^\*])*[^\*\s]|[^\*\s])\*\*)$/,m8=/(\S*[^\s\_]*)(\_([^\s\_][^\_]*[^\s\_]|[^\s\_])\_)$/,g8=/(\S*[^\s\*]*)(\*([^\s\*][^\*]*[^\s\*]|[^\s\*])\*)$/,p8=/(\S*)(\~\~([^\s\~](\~(?!\~)|[^\~])*[^\s\~]|[^\s\~])\~\~)$/,v8=/(\S*)(`[^\s][^`]*`)$/,f8=/(\S*[^\s^]*)(\^([^\s^][^^]*[^\s^]|[^\s^])\^)$/;function h8(o){const t=Fs(u8,qa(o.marks.strong,o,2,"__")),n=Fs(c8,qa(o.marks.strong,o,2,"**"));return[t,n]}function _8(o){const t=Fs(m8,qa(o.marks.em,o,1,"_")),n=Fs(g8,qa(o.marks.em,o,1,"*"));return[t,n]}function y8(o){return[Fs(p8,qa(o.marks.strike,o,2,"~~"))]}function b8(o){return[Fs(f8,qa(o.marks.superscript,o,1,"^"))]}function w8(o){return[Fs(v8,d8(o.marks.code,"`"))]}function x8(o){const s=[];if(o.marks.strong&&s.push(...h8(o)),o.marks.em&&s.push(..._8(o)),o.marks.superscript&&s.push(...b8(o)),o.marks.strike&&s.push(...y8(o)),o.marks.code&&s.push(...w8(o)),s.length!==0)return al({rules:s})}function C8(o,s){return Object.keys(s).reduce((t,n)=>{const l=s[n],i=l.block||l.node,m=l.mark;return(i&&o.nodes[i]||m&&o.marks[m])&&(t[n]=l),t},{})}const Oi={nodes:{blockquote:"blockquote",paragraph:"paragraph",code_block:["code","fence"],list_item:"list"},marks:{em:"emphasis",superscript:"sup",strong:"text",link:["link","autolink","reference","linkify"],strike:"strikethrough",code:"backticks"}},k8={blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},softbreak:{node:"hard_break"},hardbreak:{node:"hard_break"},code_block:{block:"code_block"},fence:{block:"code_block",attrs:o=>({language:o.info&&o.info.trim()||null})},list_item:{block:"list_item"},bullet_list:{block:"bullet_list"},ordered_list:{block:"ordered_list",attrs:o=>({order:+o.attrGet("order")||1})}},$8={em:{mark:"em"},sup:{mark:"superscript"},strong:{mark:"strong"},link:{mark:"link",attrs:o=>({href:o.attrGet("href"),title:o.attrGet("title")||null})},code_inline:{mark:"code"},s:{mark:"strike"}},Vi={nodes:{...Oi.nodes},marks:{...Oi.marks}},S8={...k8,...$8,mention:{node:"mention",getAttrs:({mention:o})=>{const{userId:s,userFullName:t}=o;return{userId:s,userFullName:t}}}},br=ol("commonmark",{html:!1,linkify:!1});br.enable(["entity","escape"]);class T8{constructor(s,t=br){oa(this,"markdownParser");["nodes","marks"].forEach(l=>{for(const i in Vi[l])s[l][i]&&t.enable(Vi[l][i])}),this.markdownParser=new md(s,t,C8(s,S8))}encode(s){throw console.log(s),new Error("This is not implemented yet")}parse(s){return this.markdownParser.parse(s)}}const M8=(o,s)=>{const t=o.esc("@"+(s.attrs.userFullName||""));o.write(`${t}`)},A8=(o,s)=>{o.wrapBlock("> ",null,s,()=>o.renderContent(s))},E8=(o,s)=>{o.write("```"+(s.attrs.params||"")+`
`),o.text(s.textContent,!1),o.ensureNewLine(),o.write("```"),o.closeBlock(s)},D8=(o,s)=>{o.renderList(s,"  ",()=>(s.attrs.bullet||"*")+" ")},I8=(o,s)=>{const t=s.attrs.order||1,n=String(t+s.childCount-1).length,l=o.repeat(" ",n+2);o.renderList(s,l,i=>{const m=String(t+i);return o.repeat(" ",n-m.length)+m+". "})},F8=(o,s)=>{o.renderContent(s)},P8=(o,s)=>{o.renderInline(s),o.closeBlock(s)},j8=(o,s,t,n)=>{for(let l=n+1;l<t.childCount;l++)if(t.child(l).type!==s.type){o.write(`  
`);return}},L8=(o,s)=>{o.text(s.text,!1)},R8={open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},B8={open:"~~",close:"~~",mixable:!0,expelEnclosingWhitespace:!0},N8={open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},O8={open(o,s,t,n){return Gi(s,t,n,1)?"<":"["},close(o,s,t,n){return Gi(s,t,n,-1)?">":"]("+o.esc(s.attrs.href)+(s.attrs.title?" "+o.quote(s.attrs.title):"")+")"},escape:!1},V8={open(o,s,t,n){return Ui(t.child(n),-1)},close(o,s,t,n){return Ui(t.child(n-1),1)},escape:!1};function Ui(o,s){const t=/`+/g;let n,l=0;if(o.isText)for(;n=t.exec(o.text);)l=Math.max(l,n[0].length);let i=l>0&&s>0?" `":"`";for(let m=0;m<l;m++)i+="`";return l>0&&s<0&&(i+=" "),i}function Gi(o,s,t,n){if(o.attrs.title||!/^\w+:/.test(o.attrs.href))return!1;const l=s.child(t+(n<0?-1:0));if(!l.isText||l.text!=o.attrs.href||l.marks[l.marks.length-1]!=o)return!1;if(t==(n<0?1:s.childCount-1))return!0;const i=s.child(t+(n<0?-2:1));return!o.isInSet(i.marks)}const U8=new gd({mention:M8,blockquote:A8,code_block:E8,bullet_list:D8,ordered_list:I8,list_item:F8,paragraph:P8,hard_break:j8,text:L8},{em:R8,strike:B8,strong:N8,link:O8,code:V8}),Kt=new pd({nodes:{doc:Ws.spec.nodes.get("doc"),paragraph:Ws.spec.nodes.get("paragraph"),blockquote:Ws.spec.nodes.get("blockquote"),code_block:Ws.spec.nodes.get("code_block"),text:Ws.spec.nodes.get("text"),hard_break:Ws.spec.nodes.get("hard_break"),ordered_list:Object.assign(vd,{content:"list_item+",group:"block"}),bullet_list:Object.assign(fd,{content:"list_item+",group:"block"}),list_item:Object.assign(hd,{content:"paragraph block*"}),mention:{attrs:{userFullName:{default:""},userId:{default:""}},group:"inline",inline:!0,selectable:!0,draggable:!0,atom:!0,toDOM:o=>["span",{class:"prosemirror-mention-node","mention-user-id":o.attrs.userId,"mention-user-full-name":o.attrs.userFullName},`@${o.attrs.userFullName}`],parseDOM:[{tag:"span[mention-user-id][mention-user-full-name]",getAttrs:o=>{const s=o.getAttribute("mention-user-id"),t=o.getAttribute("mention-user-full-name");return{userId:s,userFullName:t}}}]},image:{inline:!1,attrs:{src:{},alt:{default:null},title:{default:null},class:{default:null}},group:"block",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:o=>({src:o.getAttribute("src"),alt:o.getAttribute("alt"),title:o.getAttribute("title")})}],toDOM:o=>["img",o.attrs]}},marks:{link:{attrs:{href:{},title:{default:null},target:{default:"_blank"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:o=>({href:o.getAttribute("href"),title:o.getAttribute("title"),target:o.getAttribute("target")})}],toDOM:o=>["a",o.attrs,0]},em:Ws.spec.marks.get("em"),strong:Ws.spec.marks.get("strong"),code:Ws.spec.marks.get("code"),underline:{toDOM:()=>["span",{class:"underline"}]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",getAttrs:o=>o==="line-through"}],toDOM:()=>["s",0]}}});function wr(o){return[...o.plugins||[],_d(),r8(o.schema),l8(o.schema),x8(o.schema),yd(),bd(),$6(o.placeholder),new Xo({props:{attributes:{class:o.class?o.class:"ProseMirror-chatway-style"}}})]}const G8=o=>s=>{const t=new RegExp(`(?:^)?${o}[^\\s${o}]*`,"g"),n=s.before(),l=s.end(),i=s.doc.textBetween(n,l,"\0","\0");let m;for(;m=t.exec(i);){const r=m.input.slice(Math.max(0,m.index-1),m.index);if(!/^[\s\0]?$/.test(r))continue;const u=m.index+s.start(),g=u+m[0].length;if(u<s.pos&&g>=s.pos)return{range:{from:u,to:g},text:m[0]}}return null},W8=({matcher:o,suggestionClass:s="prosemirror-mention-node",onEnter:t=()=>!1,onChange:n=()=>!1,onExit:l=()=>!1,onKeyDown:i=()=>!1})=>new Xo({key:new wd("mentions"),view(){return{update:(m,r)=>{const u=this.key.getState(r),g=this.key.getState(m.state),y=u.active&&g.active&&u.range.from!==g.range.from,c=!u.active&&g.active,w=u.active&&!g.active,f=!c&&!w&&u.text!==g.text;(w||y)&&l({view:m,range:u.range,text:u.text}),f&&!y&&n({view:m,range:g.range,text:g.text}),(c||y)&&t({view:m,range:g.range,text:g.text})}}},state:{init(){return{active:!1,range:{},text:null}},apply(m,r){const{selection:u}=m,g={...r};if(u.from===u.to){(u.from<r.range.from||u.from>r.range.to)&&(g.active=!1);const y=u.$from,c=o(y);c?(g.active=!0,g.range=c.range,g.text=c.text):g.active=!1}else g.active=!1;return g.active||(g.range={},g.text=null),g}},props:{handleKeyDown(m,r){const{active:u}=this.getState(m.state);return u?i({view:m,event:r}):!1},decorations(m){const{active:r,range:u}=this.getState(m);return r?zo.create(m.doc,[Gn.inline(u.from,u.to,{nodeName:"span",class:s})]):null}}}),q8=o=>{const s=o.key.toLowerCase();if(["shift","meta","alt","control"].includes(s))return s;let t="";return o.altKey&&(t+="alt+"),o.ctrlKey&&(t+="ctrl+"),o.metaKey&&!o.ctrlKey&&(t+="meta+"),o.shiftKey&&(t+="shift+"),t+=s,t},H8={key:0,class:"mention--box",tabindex:"0"},z8=["id","onClick"],K8={class:"mention--name"},Y8=fe({__name:"Agents",props:{searchKey:{type:String,default:""}},emits:["click"],setup(o,{emit:s}){const t=ys(),n=o,l=s,i=$(0),m=b(()=>t.agents.filter(v=>v.attributes.status==="active")),r=b(()=>n.searchKey?m.value.filter(v=>v.attributes.name.toLocaleLowerCase().includes(n.searchKey.toLocaleLowerCase())):m.value),u=v=>{f(v)},g=v=>{i.value=v,y()},y=()=>{l("click",r.value[i.value])},c=()=>{i.value?i.value-=1:i.value=r.value.length-1},w=()=>{i.value===r.value.length-1?i.value=0:i.value+=1},f=v=>{const C=q8(v);["arrowup","ctrl+p"].includes(C)?(c(),v.preventDefault()):["arrowdown","ctrl+n"].includes(C)?(w(),v.preventDefault()):C==="enter"&&(y(),v.preventDefault())};return We(r,v=>{v.length<i.value+1&&(i.value=0)}),Xe(()=>{document.addEventListener("keydown",u)}),Ms(()=>{document.removeEventListener("keydown",u)}),(v,C)=>{const _=Pe("Thumbnail");return r.value.length?(a(),d("ul",H8,[(a(!0),d(Se,null,Ne(r.value,(A,D)=>(a(),d("li",{id:`mention-item-${D}`,key:A.id,onClick:T=>g(D)},[e("div",{class:O(["mention--info",{active:D===i.value}])},[W(_,{"user-name":A.attributes.name,src:A.attributes.profile_photo_url},null,8,["user-name","src"]),e("div",K8,I(A.attributes.name),1)],2)],8,z8))),128))])):h("",!0)}}});const Z8=Oe(Y8,[["__scopeId","data-v-ae0e71b2"]]),J8={style:{width:"100%"},class:"editor--container"},Q8={key:0},X8=fe({__name:"Editor",props:{value:{type:String,default:""},enableMentions:{type:Boolean,default:!1},overrideLineBreaks:{type:Boolean,default:!1},placeholder:{type:String,default:""}},emits:["input","blur","focus","submit","showEmojiPicker","hideEmojiPicker","removeEmojiPicker"],setup(o,{expose:s,emit:t}){const n=t,l=ys(),i=ct(),m=Ae(),r=o,u=(ve,be)=>(ve.match(be)||[]).length,g=ve=>ve.replace(/\*/g,"").replace(/<\/?p>/g,"").replace(/\s+((<br>)|\n)/g,"$1").replace(/\n/g,"").replace(/<br>/g,""),y=(ve,be)=>ve<be,c=$(25e3);We(()=>r.value,()=>{const ve=u(r.value,/\n/g),be=u(r.value,/<br>/g),ie=g(r.value).length+ve+be;n("removeEmojiPicker",y(ie,c.value-8))});let w=Nt({}),f=Nt({});const v=$(!1),C=$(null),_=$(""),A=$(null),D=b(()=>l.agents.filter(ve=>ve.attributes.status==="active")),T=b(()=>{const ve=[];return B.value&&D&&D.value.length>0&&ve.push(W8({debug:!1,matcher:G8("@"),onEnter:be=>(v.value=!0,A.value=be.range,w=be.view,!1),onChange:be=>(w=be.view,A.value=be.range,_.value=be.text.replace("@",""),!1),onExit:()=>(_.value="",v.value=!1,ue(),!1),onKeyDown:({event:be})=>be.keyCode===13&&v.value})),ve}),B=b(()=>r.enableMentions),S=b(()=>r.value),E=b(()=>r.placeholder);function x(ve){let be=0;return ve.descendants(re=>{re.text?be+=re.text.length:(re.type.name=="hard_break"||re.type.name=="paragraph")&&(be+=1)}),be}const P=()=>{w=new nl(C.value,{state:f,dispatchTransaction:function(ve){let be=f.apply(ve),re=x(be.doc)-1,ie=c.value;re<=ie&&(f=f.apply(ve),w.updateState(f),J())},handleDOMEvents:{keydown:(ve,be)=>{X(be,ve)},focus:()=>{q()},blur:()=>{z()}},handlePaste(ve,be){const re=be.clipboardData,ie=re==null?void 0:re.getData("text/plain"),xe=re==null?void 0:re.getData("text/html");if(xe&&/<\/?[a-z][\s\S]*>/i.test(xe))return!1;const N=(ie??"").split(`
`);be.preventDefault();const{state:L,dispatch:me}=ve,G=L.tr;return N.forEach((U,R)=>{U=U.trim(),G.insertText(U),R<N.length-1&&G.replaceSelectionWith(L.schema.nodes.hard_break.create())}),me(G),!0},transformPastedHTML(ve){const be=ve.match(/<body[^>]*>([\s\S]*?)<\/body>/i);let re=be?be[1]:ve;const ie="__NEWLINE__";let N=re.replace(/>([\s\S]*?)</g,(L,me)=>">"+me.replace(/\n/g,ie)+"<").replace(/class="([^"]*)"/g,'class=""').replace(/style="([^"]*)"/g,'style=""');return N=N.replace(/<(\w+)([^>]*)>/g,(L,me)=>`<${me}>`),N=N.replace(/\n/g,"").replace(/(div>|h1>|h2>|h3>|h4>|h5>|h6>)/gi,"p>").replace(/<p><\/p>/g,"<br>").replace(/<\/p><br>/g,"<br>").replace(/<br><p>/g,"<br>").replace(/<p><p>/g,"<p>").replace(/<\/p><\/p>/g,"</p>").replace(/<\/p><p>/g,"<br>"),N=N.replace(new RegExp(`<br>${ie}`,"g"),"<br>"),N=N.replace(new RegExp(ie,"g"),"<br>"),N}})},j=(ve,be=[])=>{let re=new T8(Kt).parse(ve);if(B.value){const xe=new DOMParser().parseFromString(ve,"text/html");re=il.fromSchema(Kt).parse(xe)}return ll.create({doc:re,plugins:wr({schema:Kt,placeholder:E.value,plugins:be})})},H=ve=>{if(!w)return null;const be=w.state.schema.nodes.mention.create({userId:ve.id,userFullName:ve.attributes.name}),re=w.state.tr.replaceWith(A.value.from,A.value.to,be).insertText(" ");return f=w.state.apply(re),J(),Z(),he(),ue(),!1},k=(ve="")=>{if(!w)return null;const be=w.state.tr,{schema:re}=w.state,ie=x(be.doc)-1,xe=ve.length;return ie+xe>=c.value?null:(ve.split(`
`).forEach((N,L,me)=>{N&&be.insertText(N),L<me.length-1&&be.replaceSelectionWith(re.nodes.hard_break.create())}),f=w.state.apply(be),J(),!1)},M=()=>{v.value=!1,f=j(S.value,T.value),w.updateState(f),ue()},V=()=>U8.serialize(w.state.doc),Z=()=>{v.value=!1},ae=()=>{v.value=!0},ce=()=>v.value,J=()=>{w.updateState(f);let ve=V(),be=[],re="";B.value&&(re=pe(f),be=de(re)),ve=ve.replace(/\n/g,`
`),n("input",{content:ve,mentions:be,html:re})},X=(ve,be)=>{const{state:re,dispatch:ie}=be,{selection:xe}=re;if(ve.key==="Backspace"&&xe instanceof Ma){const{$cursor:L}=xe;if(L){const me=L.nodeBefore,G=L.pos-1;if(me&&L.pos>0&&re.doc.textBetween(G,L.pos,`
`).length>0){ve.preventDefault();const U=re.tr.delete(G,L.pos);return ie(U),!0}if(me&&me.isText&&me.text===" "){const U=Ma.create(re.doc,G),R=re.tr.setSelection(U);return ie(R),!0}}}let N=ve.metaKey||ve.ctrlKey;ve.code=="Enter"&&!N&&!v.value&&!ve.shiftKey&&!r.overrideLineBreaks&&(n("submit"),ve.preventDefault(),M())},z=()=>{n("blur")},q=()=>{n("focus")},ue=()=>{const{tr:ve}=w.state,be=Ko.atEnd(ve.doc);w.dispatch(ve.setSelection(be)),w.focus()},pe=ve=>{const be=rl.fromSchema(ve.schema).serializeFragment(ve.doc.content),re=document.createElement("div");return re.appendChild(be),re.innerHTML},de=ve=>{if(!ve)return[];const ie=new DOMParser().parseFromString(ve,"text/html").querySelectorAll(".prosemirror-mention-node");return Array.from(ie).map(xe=>({id:xe.getAttribute("mention-user-id"),name:xe.getAttribute("mention-user-full-name")}))},he=()=>{document.querySelectorAll(".prosemirror-mention-node").forEach(be=>{const re=be;be.hasAttribute("mention-user-id")?re.style.color="#0446de":re.style.color="#282d3e"})};return Xe(()=>{he(),f=j(S.value,T.value),P(),w.updateState(f),m.isProductTourRunning||ue()}),Ms(()=>{w.destroy()}),We(S,ve=>{let be=V();B.value&&(be=pe(f)),ve!==be&&M()}),We(B,()=>{M()}),We(()=>r.placeholder,()=>{M()}),We(()=>i.chatInputFocus,()=>{i.chatInputFocus&&Ft(()=>ue())}),s({insertMessage:k,focusEditorInputField:ue,showMentions:ae,hideMentions:Z,getShowMentionValue:ce}),(ve,be)=>{const re=He("click-away");return a(),d("div",J8,[F((a(),d("div",{id:"editor",ref_key:"editorRef",ref:C},[v.value?(a(),d("div",Q8,[W(Z8,{"search-key":_.value,onClick:H},null,8,["search-key"])])):h("",!0)])),[[re,Z]])])}}});function xr(){const{countries:o}=Ts(Es());return{getCountryFlag:t=>{if(!t)return!1;const n=Ju(t),l=o.value.find(i=>i.code===n);return l?l.image:!1}}}const e9=["disabled"],t9=fe({__name:"ToggleSwitch",props:{value:{type:Boolean,default:!1},size:{default:""},isAvailabilityToggle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["input"],setup(o,{emit:s}){const t=s,n=o,l=b(()=>n.size?`toggle-button--${n.size}`:""),i=b(()=>n.value?"active":""),m=()=>{t("input",!n.value)};return(r,u)=>(a(),d("button",{type:"button",class:O(["toggle-button",[l.value,i.value,{"is-activity-toggle":r.isAvailabilityToggle}]]),onClick:m,disabled:r.disabled},[e("span",{"aria-hidden":"true",class:O({active:r.value})},null,2)],10,e9))}});const Sa=Oe(t9,[["__scopeId","data-v-11361fd9"]]),s9={key:0},a9={key:0,class:"flex items-center justify-center gap-1 p-1 bg-primaryLight text-grey900 text-xs font-normal leading-4"},o9={key:0,class:"bg-primary text-white px-4 rounded-md cursor-pointer hover:bg-primaryDark"},n9={key:0},i9={key:1},l9={key:1,class:"flex items-center justify-center gap-1 p-1 bg-primaryLight text-grey900 text-xs font-normal leading-4"},r9={key:0,class:"bg-primary text-white px-4 rounded-md cursor-pointer hover:bg-primaryDark"},d9=fe({__name:"TranslationSwitcher",props:{isTranslationEnabled:{type:Boolean},contactLang:{},conversationId:{}},setup(o){const s=o,t=Ae(),{getCountryFlag:n}=xr(),{translateMessages:l,toggleTranslation:i}=ss(),{lastMessageLanguageCode:m}=Yt(),r=$(!1),u=b(()=>{var v;return(v=t.user)==null?void 0:v.attributes.enable_translation_switcher}),g=b(()=>{if(m.value)return Zu(m.value)}),y=b(()=>t.preferredChatLanguage),c=b(()=>{var v,C;return(v=s.contactLang)!=null&&v.startsWith("zh")?s.contactLang:(C=s.contactLang)==null?void 0:C.split("-")[0]}),w=b(()=>t.isProUserOrTrial),f=async()=>{r.value=!0,await i(s.conversationId),s.isTranslationEnabled&&await l(),r.value=!1};return(v,C)=>w.value?(a(),d("div",s9,[p(m)&&y.value!=p(m)&&p(n)(p(m))?(a(),d("div",a9,[r.value?(a(),d("span",o9,"Translating...")):(a(),d(Se,{key:1},[e("span",{style:lt({"background-image":`url(${p(n)(p(m))})`}),class:"w-4 h-4 bg-primaryLight border-primaryLight inline-block bg-center bg-[length:calc(16px*2)] overflow-hidden rounded-[16px]"},null,4),v.isTranslationEnabled?(a(),d("span",n9,I(`Translating from ${g.value}`),1)):(a(),d("span",i9,I(`Showing original messages in ${g.value}`),1)),W(Sa,{value:v.isTranslationEnabled,onInput:f,size:"xsmall"},null,8,["value"])],64))])):u.value||c.value&&y.value!=c.value?(a(),d("div",l9,[r.value?(a(),d("span",r9,"Translating...")):(a(),d("span",{key:1,onClick:f,class:"bg-primary text-white px-4 rounded-md cursor-pointer hover:bg-primaryDark"},I(v.isTranslationEnabled?"Show Original":"Enable Translation"),1))])):h("",!0)])):h("",!0)}}),u9={key:0,class:"shadow-sm"},c9=["src"],m9={key:1},Cr=fe({__name:"ShopifyProductImage",props:{productId:{type:[Number,String],required:!1},size:{type:[Number,String],default:12},url:{type:String,required:!1}},setup(o){const s=o,t=$([]);Xe(()=>{n()});async function n(){if(s.productId||s.url)return;const{images:l}=await $s.getProductImages({product_id:s.productId||""});t.value=l}return(l,i)=>{const m=He("svg-inline");return t.value.length>0||s.url?(a(),d("div",u9,[e("img",{class:"inline-block rounded-md ring-1 ring-grey200",style:lt({"max-height":`${o.size}rem`,"max-width":`${o.size}rem`}),src:s.url??t.value[0].src,alt:""},null,12,c9)])):(a(),d("div",m9,[F(e("img",{class:"inline-block rounded-md border bg-white border-1 w-full h-full",src:Mo,alt:"",style:lt({"max-height":`${o.size}rem`,"max-width":`${o.size}rem`})},null,4),[[m]])]))}}}),g9={class:"flex -space-x-1 overflow-hidden mt-2 mb-3 p-5"},p9={class:"flex flex-col gap-1"},v9={class:"flex"},f9={class:"text-grey900 text-xs"},h9={class:"flex"},_9={class:"text-grey900 text-xs"},y9={class:"flex"},b9=["href"],w9={key:1,class:"text-grey900 text-xs text-capitalize"},x9={class:"flex"},C9={class:"text-grey900 text-xs text-capitalize"},k9={key:0,class:"flex"},$9={class:"text-grey900 text-xs text-capitalize"},S9={key:1,class:"flex items-start mb-3"},T9={class:"flex items-end flex-col ml-1"},M9={class:"text-grey900 text-xs overflow-hidden truncate text-xs max-w-[160px] !mb-0 !pb-0"},A9={class:"text-grey700 font-normal text-xs text-xs !mt-0 !pt-0"},E9={class:"text-xs !text-[#4A4A4A]"},D9={class:"text-xs !text-[#136]"},I9={key:2,class:"flex"},F9={class:"text-grey900 text-xs"},P9={key:3,class:"flex"},j9={class:"text-grey900 text-xs"},L9={key:4,class:"flex"},R9={class:"text-grey900 text-xs"},B9={key:5,class:"flex"},N9={class:"text-grey900 text-xs"},O9={key:6,class:"flex"},V9={class:"text-grey900 text-xs"},U9={key:7,class:"flex"},G9={class:"text-grey900 text-xs"},W9={key:8,class:"flex"},q9={class:"text-grey900 text-xs"},H9={class:"flex gap-2 mt-2"},z9={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-3 h-3 mr-1 text-main400"},K9={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-3 h-3 mr-1 text-grey600"},Y9=["href"],Z9={src:$o,alt:""},J9=fe({__name:"ShopifyOrderSummary",props:{order:{type:Object,required:!0}},setup(o){const s=o,t=$(!1);function n(m){const r=new Date(m.createdAt);return r.getDate()+"/"+r.getMonth()+"/"+r.getFullYear()}function l(m){var u;return new Intl.NumberFormat("en-US",{style:"currency",currency:(u=s.order)==null?void 0:u.currencyCode}).format(m)}function i(m){var r;return(r=m.fulfillments[m.fulfillments.length-1])==null?void 0:r.trackingInfo[m.fulfillments[m.fulfillments.length-1].trackingInfo.length-1]}return(m,r)=>{var g,y,c,w,f,v,C;const u=He("svg-inline");return a(),d(Se,null,[e("div",g9,[(a(!0),d(Se,null,Ne(o.order.lineItems.nodes,_=>{var A;return a(),ne(Cr,{size:2.5,"product-id":_.product.legacyResourceId,url:(A=_.image)==null?void 0:A.url,key:_.id},null,8,["product-id","url"])}),128))]),e("div",p9,[e("div",v9,[r[1]||(r[1]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Order Id"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",f9,I(o.order.name),1)]),e("div",h9,[r[2]||(r[2]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Order date"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",_9,I(n(o.order)),1)]),e("div",y9,[r[3]||(r[3]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Tracking number & link"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),(g=i(o.order))!=null&&g.url?(a(),d("a",{key:0,href:((y=i(o.order))==null?void 0:y.url)||"#",target:"_blank",class:"text-grey900 text-xs"},I((c=i(o.order))==null?void 0:c.number),9,b9)):(a(),d("span",w9,"Unknown"))]),e("div",x9,[r[4]||(r[4]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Fulfilment status"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",C9,I(o.order.displayFulfillmentStatus.toString().toLowerCase()),1)]),t.value?(a(),d("div",k9,[r[5]||(r[5]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Payment status"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",$9,I(o.order.fullyPaid?"Paid":o.order.unpaid?"Unpaid":"Partially Paid"),1)])):h("",!0),t.value?(a(),d("div",S9,[r[7]||(r[7]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Products"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("div",T9,[(a(!0),d(Se,null,Ne(o.order.lineItems.nodes,_=>(a(),d(Se,{key:_.id},[e("span",M9,I(_.name),1),e("span",A9,[e("span",E9,I(l(_.originalUnitPriceSet.shopMoney.amount))+" x "+I(_.currentQuantity)+" . ",1),e("span",D9,I(l(_.originalUnitPriceSet.shopMoney.amount*_.currentQuantity)),1)]),r[6]||(r[6]=e("div",{class:"h-2"},null,-1))],64))),128))])])):h("",!0),t.value?(a(),d("div",I9,[r[8]||(r[8]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Subtotal"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",F9,I(l(o.order.currentSubtotalPriceSet.shopMoney.amount)),1)])):h("",!0),t.value?(a(),d("div",P9,[r[9]||(r[9]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Shipping cost"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",j9,I(l(o.order.totalShippingPriceSet.shopMoney.amount)),1)])):h("",!0),t.value?(a(),d("div",L9,[r[10]||(r[10]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Tax"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",R9,I(l(o.order.currentTotalTaxSet.shopMoney.amount)),1)])):h("",!0),t.value?(a(),d("div",B9,[r[11]||(r[11]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Total price"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",N9,I(l(o.order.currentTotalPriceSet.shopMoney.amount)),1)])):h("",!0),t.value&&((w=o.order.billingAddress)!=null&&w.formattedArea)?(a(),d("div",O9,[r[12]||(r[12]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Billing address"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",V9,I(o.order.billingAddress.formattedArea),1)])):h("",!0),t.value&&((f=o.order.shippingAddress)!=null&&f.formattedArea)?(a(),d("div",U9,[r[13]||(r[13]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Shipping address"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",G9,I((v=o.order)==null?void 0:v.shippingAddress.formattedArea),1)])):h("",!0),t.value?h("",!0):(a(),d("div",W9,[r[14]||(r[14]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Total price"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",q9,I(l(o.order.currentTotalPriceSet.shopMoney.amount)),1)])),e("div",H9,[e("button",{class:O(["w-fit text-xs !p-2 select-none",[t.value?"bg-main-100 text-main400":"bg-grey100 text-grey900"]]),onClick:r[0]||(r[0]=()=>t.value=!t.value)},[t.value?(a(),d("svg",z9,r[15]||(r[15]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"},null,-1)]))):(a(),d("svg",K9,r[16]||(r[16]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"},null,-1)]))),r[17]||(r[17]=_e(" Order summary "))],2),o.order.fulfillments.length?(a(),d("a",{key:0,class:"w-fit text-xs !p-2 select-none flex bg-grey100 rounded-md items-center gap-2",href:((C=i(o.order))==null?void 0:C.url)||"#",target:"_blank"},[r[18]||(r[18]=_e(" Order tracking ")),F(e("img",Z9,null,512),[[u]])],8,Y9)):h("",!0)])])],64)}}}),Q9={class:"form-group flex gap-2"},X9=["id"],eD=["for"],tD=fe({__name:"CheckBox",props:{id:{type:[String,Number]},hintText:String,modelValue:{type:[Boolean,String,Number]}},emits:["update:modelValue"],setup(o,{emit:s}){const t=s,n=o,l=$(),i=b({get:()=>n.modelValue,set:r=>{t("update:modelValue",r)}});function m(){var r;(r=l.value)==null||r.click()}return(r,u)=>{var g,y;return a(),d("div",Q9,[F(e("input",{ref_key:"checkInput",ref:l,id:(g=o.id)==null?void 0:g.toString(),"onUpdate:modelValue":u[0]||(u[0]=c=>i.value=c),type:"checkbox",class:"w-4 h-4 rounded-sm border-[1.5px] border-grey600 checked:bg-primary focus:ring-0 mr-2"},null,8,X9),[[Ia,i.value]]),e("label",{class:"text-sm",for:(y=o.id)==null?void 0:y.toString()},null,8,eD),e("span",{onClick:m,class:"select-none hover:cursor-pointer"},[Ss(r.$slots,"default",{},()=>[_e(I(o.hintText),1)],!0)])])}}});const ja=Oe(tD,[["__scopeId","data-v-3b6ccc44"]]),sD=fe({__name:"OrderCheckBox",props:{selectedOrders:{type:Object,required:!0},order:{type:Object,required:!0},handelOrderSelection:{type:Function,required:!0}},setup(o){const s=o,t=b(()=>{var l;return!!((l=s.selectedOrders)!=null&&l.find(i=>{var m;return i.id===((m=s.order)==null?void 0:m.id)}))});function n(l){return xt(l.createdAt).format("DD/MM/YYYY")}return(l,i)=>(a(),ne(ja,{id:o.order.id,"model-value":t.value,"onUpdate:modelValue":i[0]||(i[0]=m=>o.handelOrderSelection(m,o.order))},{default:K(()=>[i[1]||(i[1]=_e(" Order ID: ")),e("strong",null,I(o.order.name),1),i[2]||(i[2]=_e("  Order date: ")),e("strong",null,I(n(o.order)),1)]),_:1},8,["id","model-value"]))}}),aD={class:"flex max-h-[14rem] sm:max-h-[18rem] md:max-h-[20rem] xl:max-h-[34rem] lg:max-h-[24rem]"},oD={class:"bg-grey100 basis-3/5 p-5 overflow-y-auto"},nD={class:"relative rounded-md shadow-sm"},iD=["value"],lD={key:0,class:"!mt-8 divide-y"},rD={class:"flex -space-x-3 overflow-hidden mt-2 mb-3 p-5"},dD={key:1,class:"grid place-items-center h-[200px]"},uD={key:1},cD={class:"basis-2/5 p-10 flex flex-col gap-4 overflow-y-auto"},mD={key:0,class:"h-full grid place-items-center"},gD={key:1,class:"flex flex-col gap-2 !bg-white"},pD=fe({__name:"ShopifyOrderShareModel",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","share"],setup(o,{emit:s}){const t=s,n=Ja(),l=$([]);async function i(c=""){await n.getCustomerOrders(c)}function m(){u()}function r(){t("share",Ke.cloneDeep(l.value))}function u(){l.value=[],t("update:modelValue",!1)}const g=Ys(c=>{const w=c.target.value;i(w)},800);function y(c,w){if(c){l.value.push(Ke.cloneDeep(w));return}const f=l.value.findIndex(v=>v.id===w.id);l.value.splice(f,1)}return(c,w)=>{const f=Pe("Loader"),v=Pe("Modal");return o.modelValue?(a(),ne(v,{key:0,closeModal:o.modelValue,"header-title":"Share order status",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Share Order",onActionButtonTypeOne:m,onActionButtonTypeTwo:r,onCloseModal:u,footerTopBorder:"",classes:"md:!w-[770px] z-50","disable-button-two":!l.value.length},{default:K(()=>[e("div",aD,[e("div",oD,[e("div",nD,[w[1]||(w[1]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"!w-4 !h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])],-1)),e("input",{value:p(n).orderSearchQuery,onInput:w[0]||(w[0]=(...C)=>p(g)&&p(g)(...C)),class:"block w-full !rounded-lg border-0 !py-1 !pl-8 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Searching all ordersc"},null,40,iD)]),!p(n).loadingCustomerOrder&&p(n).customerOrders.length?(a(),d("div",lD,[(a(!0),d(Se,null,Ne(p(n).sortedCustomerOrders,C=>(a(),d("div",{class:"py-2 pl-1",key:C.id},[W(sD,{"selected-orders":l.value,order:C,"handel-order-selection":y},null,8,["selected-orders","order"]),e("div",rD,[(a(!0),d(Se,null,Ne(C.lineItems.nodes,_=>{var A;return a(),ne(Cr,{size:4.5,"product-id":_.product.legacyResourceId,url:(A=_.image)==null?void 0:A.url,key:_.id},null,8,["product-id","url"])}),128))])]))),128))])):(a(),d("div",dD,[p(n).loadingCustomerOrder?(a(),ne(f,{key:0})):(a(),d("span",uD,"No orders found"))]))]),e("div",cD,[l.value.length===0?(a(),d("div",mD,w[2]||(w[2]=[e("p",{class:"select-none"},"Select one or more client orders",-1)]))):(a(),d("div",gD,[(a(!0),d(Se,null,Ne(l.value.sort((C,_)=>_.legacyResourceId-C.legacyResourceId),C=>(a(),d("div",{key:C.legacyResourceId},[W(J9,{order:C},null,8,["order"])]))),128))]))])])]),_:1},8,["closeModal","disable-button-two"])):h("",!0)}}}),ni="/assets/send-white-c4a4e5ec.svg",vD="/assets/chevron-up-white-a32b51c9.svg",fD="/assets/edit-4-8e9ada3c.svg",hD="/assets/info-white-0604a28e.svg",_D="/assets/black-eye-15d3ce49.svg",yD="/assets/black-hide-eye-66988cad.svg",bD={class:"input-field relative"},wD=["for"],xD={src:hD,alt:""},CD=["innerHTML"],kD=["disabled","value","type","placeholder","id","readonly","autofocus","maxlength"],$D={key:0,class:"error-message"},SD=fe({__name:"InputField",props:{label:{},value:{},type:{default:"text"},hasError:{type:Boolean},forValue:{},placeholder:{default:""},readonly:{type:Boolean,default:!1},validationMessage:{},classes:{},tooltip:{},disable:{type:Boolean},autofocus:{type:Boolean},maxlength:{}},emits:["input","blur","togglePassword","focusin","keydown","focusout"],setup(o,{emit:s}){const t=$("hide"),n=$("hide"),l=s,i=u=>{const g=u.target;l("input",g.value)},m=()=>{l("blur")},r=u=>{t.value=u,l("togglePassword",u)};return(u,g)=>{const y=Pe("VDropdown"),c=He("svg-inline");return a(),d("div",bD,[u.label?(a(),d("label",{key:0,for:u.forValue},[_e(I(u.label)+" ",1),u.tooltip?(a(),ne(y,{key:0,showTriggers:["hover"],hideTriggers:["click"],placement:"top",class:"ml-1"},{popper:K(()=>[e("div",{class:"max-w-md p-3 text-xs text-grey900",innerHTML:u.tooltip},null,8,CD)]),default:K(()=>[e("div",null,[F(e("img",xD,null,512),[[c]])])]),_:1})):h("",!0)],8,wD)):h("",!0),e("input",{disabled:u.disable,value:u.value,type:u.type,placeholder:u.placeholder,id:u.forValue,readonly:u.readonly,autofocus:u.autofocus,maxlength:u.maxlength,class:O([{error:u.hasError},u.classes]),ref_key:"inputFiled",ref:n,onInput:i,onBlur:m,onFocusin:g[0]||(g[0]=w=>u.$emit("focusin")),onKeydown:g[1]||(g[1]=w=>u.$emit("keydown",w)),onFocusout:g[2]||(g[2]=w=>u.$emit("focusout"))},null,42,kD),F(e("img",{class:"w-5 h-5 absolute top-9 right-4 cursor-pointer",src:_D,alt:"eye icon",onClick:g[3]||(g[3]=w=>r("show"))},null,512),[[Gt,u.type==="password"&&t.value==="hide"]]),F(e("img",{class:"w-5 h-5 absolute top-9 right-4 cursor-pointer",src:yD,alt:"eye icon",onClick:g[4]||(g[4]=w=>r("hide"))},null,512),[[Gt,t.value==="show"]]),(a(!0),d(Se,null,Ne(u.validationMessage,(w,f)=>(a(),d("div",{key:f},[f==0?(a(),d("span",$D,I(w.$message),1)):h("",!0)]))),128))])}}});const Ha=Oe(SD,[["__scopeId","data-v-de30a91c"]]),TD={class:"timepicker"},MD={class:"relative"},AD={class:"select-arrow",src:Tt},ED=["onClick"],DD={class:"block truncate focus:bg-grey600"},ra=fe({__name:"TimePicker",props:{modelValue:{type:String,required:!0},disable:{type:Boolean,required:!1},hasError:Boolean,hidePastTime:{type:Boolean,default:!1,required:!1},dropUp:{type:Boolean,default:!1,required:!1}},emits:["update:modelValue"],setup(o,{emit:s}){const t=o,n=$(),l=s,i=$(!1),m=$();let r=null;const u=$([]),g=$();Xe(()=>{Ft(()=>C(t.modelValue))}),We(()=>m.value,()=>{const{item:S,index:E}=T();g.value.scrollTo({top:E*40,behavior:"smooth"}),S.classList.add("bg-grey100")}),We(()=>t.modelValue,()=>{t.hidePastTime&&C(t.modelValue)});const y=b(()=>{const S=[],x={hour:"2-digit",minute:"2-digit"},P=new Date,j=new Date(2e3,0,1,P.getHours(),P.getMinutes());for(let H=0;H<24;H++)for(let k=0;k<60;k+=30){const M=new Date(2e3,0,1,H,k);if(!t.hidePastTime||M>=j){const V=M.toLocaleTimeString("en-US",x);S.push(V)}}return S.push("11:59 PM"),S});function c(S){C(S),i.value=!1}function w(S){S.key==="Enter"&&v()}const f=function(){r=setTimeout(()=>{v()},400)};function v(){if(i.value=!1,A(m.value)){C(D(m.value));return}C(T().time)}function C(S){var E,x;l("update:modelValue",S),m.value=S,(x=(E=n.value)==null?void 0:E.$refs)==null||x.inputFiled.blur()}function _(){r&&clearTimeout(r),n.value.$refs.inputFiled.focus()}const A=S=>{const E=/^(0?[0-9]|1[0-9]|2[0-3])\s?:\s?([0-5]?[0-9])$/,x=/^(0?[1-9]|1[0-2])\s?:\s?([0-5]?[0-9])\s?(am|pm)$/i;return E.test(S)||x.test(S)},D=S=>{S=S.toLowerCase().replace(/(\d{1,2}:\d{2})([ap]m)/i,"$1 $2");const E=xt("2000/01/01 "+S,["YYYY/MM/DD hh:mm a","YYYY/MM/DD hh:mm A","YYYY/MM/DD h:m a","YYYY/MM/DD h:m A","YYYY/MM/DD h:mm a","YYYY/MM/DD h:mm A","YYYY/MM/DD hh:m a","YYYY/MM/DD hh:m A"],!1);return E.format("hh:mm A")==="Invalid Date"?xt("2000/01/01 09:00 AM").format("hh:mm A"):E.format("hh:mm A")};function T(){let S=u.value.map((x,P)=>(x.classList.remove("bg-grey100"),{item:x,index:P,time:x.innerText}));const E=S.filter(({item:x})=>x.innerText.replace(":","").replace(/\s+/g,"").toLowerCase().indexOf(B())>-1);return E.length?{...E[0]}:S[0]}function B(){const S=m.value.toLowerCase(),[E,x]=S.split(":").map(V=>V.trim());let P=parseInt(E),j=parseInt(x||"0"),H=S.includes("am")?"am":S.includes("pm")?"pm":"";j>0&&j<=15?j=0:j>15&&j<=45?j=30:j>45&&(j=0,P+=1),!isNaN(P)&&P>=13&&P<=23&&(P-=12,H="pm");const k=P.toString().padStart(2,"0"),M=j.toString().padStart(2,"0");return`${k}${M}${H}`}return(S,E)=>{const x=He("svg-inline");return a(),d("div",TD,[e("div",MD,[W(Ha,{type:"text",placeholder:"Pick time",value:m.value,onInput:E[0]||(E[0]=P=>m.value=P),disable:o.disable,ref_key:"timeInput",ref:n,onFocusin:E[1]||(E[1]=P=>i.value=!0),onBlur:f,classes:"w-full !p-1 !pl-1.5 !text-sm !text-gray-500",onKeydown:w,"has-error":o.hasError},null,8,["value","disable","has-error"]),e("button",{onClick:_,type:"button",class:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none z-1"},[F(e("img",AD,null,512),[[x]])]),e("ul",{class:O(["absolute z-10 mt-1 max-h-48 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",i.value?"":"hidden",o.dropUp?"drop-up":""]),ref_key:"timePickerDropdown",ref:g,id:"options",role:"listbox"},[(a(!0),d(Se,null,Ne(y.value,P=>(a(),d("li",{onClick:j=>c(P),class:"relative select-none text-sm !p-1.5 text-gray100 cursor-pointer hover:bg-grey100",key:P+"key",role:"option",ref_for:!0,ref_key:"timeElements",ref:u},[e("span",DD,I(P),1)],8,ED))),128))],2)])])}}}),ID={class:"text-xs text-gray-400"},FD=["onClick"],PD={href:"#",class:"text-gray-900"},jD={class:"text-xs text-gray-400"},LD={class:"timer p-1 min-w-[225px]"},RD={class:"px-4 pt-2 timepicker-reminder"},BD=["min"],ND={class:"flex m-4 py-2 justify-end"},OD=fe({__name:"ReminderModal",props:{showMobileReminder:{type:Boolean,default:!1},showMobileReminderOptions:{type:Boolean,default:!0},formattedRemindAt:{type:String,default:""},reminderOptions:{type:Array,default:[]},reminderOptionsText:{type:Array,default:[]},reminderTime:{type:String,default:""},reminderDate:{type:String,default:""},shouldHidePastTime:{type:Boolean,default:!0},showMobileTimer:{type:Boolean,default:!0}},emits:["closeReminderModal","setChatReminder","openMobileReminderTimer","updateReminderDate","updateReminderTime"],setup(o,{emit:s}){const t=o,n=s,l=b(()=>t.formattedRemindAt?-1:0),i=$("09:00 AM"),m=$(""),r=$(t.reminderOptions),u=$(-2),g=$(),y=b(()=>r.value.length),c=()=>xt().format("YYYY-MM-DD");We(()=>m.value,()=>{i.value=A(),n("updateReminderDate",m.value)}),We(()=>i.value,()=>{n("updateReminderTime",i.value)}),We(()=>t.reminderOptions,()=>{r.value=t.reminderOptions}),We(()=>t.showMobileReminder,()=>{t.showMobileReminder?setTimeout(()=>u.value=l.value,100):(m.value=c(),u.value=-2)}),Xe(()=>{window.addEventListener("keydown",w),m.value=c()}),ps(()=>{window.removeEventListener("keydown",w)});const w=D=>{if(!(!t.showMobileReminderOptions||!t.showMobileReminder))switch(D.preventDefault(),D.stopPropagation(),D.key){case"Enter":f();break;case"ArrowUp":v();break;case"ArrowDown":C();break}},f=async()=>{u.value===l.value&&t.formattedRemindAt?n("setChatReminder","original",0):u.value<y.value&&u.value>-2?n("setChatReminder","preset",u.value):u.value===y.value&&(n("openMobileReminderTimer"),g.value&&await Ft(),g.value.focus())},v=async()=>{u.value>l.value?u.value--:u.value=y.value},C=async()=>{u.value<y.value?u.value++:u.value=l.value};function _(D){const T={hour:"numeric",minute:"numeric"},B=new Intl.DateTimeFormat("en-US",T).format(D),S=new Date,E=new Date(S);return E.setDate(E.getDate()+1),D.toDateString()===S.toDateString()?`Today, ${B}`:D.toDateString()===E.toDateString()?`Tomorrow, ${B}`:D>E?`${D.toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit"})}, ${B}`:D.toLocaleString("en-US")}const A=()=>{let D=xt();return D.minute()<30?D=D.startOf("hour").add(30,"minute"):D=D.startOf("hour").add(1,"hour"),D.format("hh:mm A")};return(D,T)=>{const B=Pe("Modal");return F((a(),ne(B,{closeModal:!o.showMobileReminder,onCloseModal:T[6]||(T[6]=S=>D.$emit("closeReminderModal")),"header-title":"Set Reminder",showFooter:!1},{default:K(()=>[F(e("div",null,[e("ul",null,[o.formattedRemindAt?(a(),d("li",{key:0,class:O(["px-4 py-1 hover:bg-gray-100 cursor-pointer",{"bg-gray-200":u.value===-1}]),onClick:T[0]||(T[0]=S=>D.$emit("setChatReminder","original",0))},[T[7]||(T[7]=e("a",{href:"#",class:"text-gray-900"},"Original",-1)),e("div",ID,I(_(new Date(o.formattedRemindAt))),1)],2)):h("",!0),(a(!0),d(Se,null,Ne(r.value,(S,E)=>(a(),d("li",{class:O(["px-4 py-1 hover:bg-gray-100 cursor-pointer",{"bg-gray-200":u.value===E}]),onClick:x=>D.$emit("setChatReminder","preset",E),key:E},[e("a",PD,I(o.reminderOptionsText[E]),1),e("div",jD,I(_(S)),1)],10,FD))),128))]),e("ul",{class:O(["px-4 border-t border-gray-200 hover:bg-gray-100 rounded-bl-lg rounded-br-lg py-2 cursor-pointer",{"bg-gray-200":u.value===y.value}])},[e("li",{class:"m-0",onClick:T[1]||(T[1]=S=>D.$emit("openMobileReminderTimer"))},T[8]||(T[8]=[e("a",{class:"text-gray-900"},"Custom Time",-1)]))],2)],512),[[Gt,o.showMobileReminderOptions]]),F(e("div",LD,[e("div",RD,[F(e("input",{type:"date",class:"!text-sm","onUpdate:modelValue":T[2]||(T[2]=S=>m.value=S),min:p(xt)().format("YYYY-MM-DD"),ref_key:"reminderDateInputRef",ref:g,onfocus:"this.showPicker?.()"},null,8,BD),[[bt,m.value]]),W(ra,{modelValue:i.value,"onUpdate:modelValue":T[3]||(T[3]=S=>i.value=S),hidePastTime:o.shouldHidePastTime,ref:"reminderDateTimeRef"},null,8,["modelValue","hidePastTime"])]),e("div",ND,[e("button",{class:"!bg-gray-200 text-gray-900 !shadow-none",onClick:T[4]||(T[4]=S=>D.$emit("closeReminderModal"))},"Cancel"),e("button",{class:"ml-3 !bg-gray-900 text-white w-[66px] flex justify-center",onClick:T[5]||(T[5]=S=>D.$emit("setChatReminder","custom",4))},"Set")])],512),[[Gt,o.showMobileTimer]])]),_:1},8,["closeModal"])),[[Gt,o.showMobileReminder]])}}}),VD={class:"min-w-[200px] text-gray-900"},UD={class:"text-xs text-gray-400"},GD=["onClick"],WD={href:"#",class:"text-gray-900"},qD={class:"text-xs text-gray-400"},HD={class:"timer p-1 min-w-[225px]"},zD={class:"mx-2 timepicker-reminder"},KD=["min"],YD={class:"flex m-2 py-2 justify-end"},ZD=fe({__name:"ReminderButtonPopup",props:{showReminderOptions:{type:Boolean,default:!0},formattedRemindAt:{type:String,default:""},reminderOptions:{type:Array,default:[]},reminderOptionsText:{type:Array,default:[]},reminderTime:{type:String,default:""},reminderDate:{type:String,default:""},shouldHidePastTime:{type:Boolean,default:!0},showTimer:{type:Boolean,default:!0}},emits:["openTimer","closeOptions","setChatReminder","updateReminderDate","updateReminderTime"],setup(o,{emit:s}){const t=o,n=b(()=>t.formattedRemindAt?-1:0),l=s,i=$("09:00 AM"),m=$(""),r=$(t.reminderOptions),u=$(-2),g=$(),y=b(()=>r.value.length),c=()=>xt().format("YYYY-MM-DD"),w=()=>{g.value.click()};We(()=>m.value,()=>{i.value=D(),l("updateReminderDate",m.value)}),We(()=>i.value,()=>{l("updateReminderTime",i.value)}),We(()=>t.reminderOptions,()=>{r.value=t.reminderOptions}),We(()=>t.showTimer,()=>{t.showTimer||(m.value=c())}),We(()=>t.showReminderOptions,()=>{t.showReminderOptions?setTimeout(()=>u.value=n.value,10):u.value=-2}),Xe(()=>{g.value&&g.value.addEventListener("click",w),window.addEventListener("keydown",f),m.value=c()}),ps(()=>{var T;(T=g.value)==null||T.removeEventListener("click",w),window.removeEventListener("keydown",f)});const f=T=>{if(t.showReminderOptions)switch(T.preventDefault(),T.stopPropagation(),T.key){case"Enter":v();break;case"ArrowUp":C();break;case"ArrowDown":_();break}},v=async()=>{u.value===n.value&&t.formattedRemindAt?l("setChatReminder","original",0):u.value<y.value&&u.value>-2?l("setChatReminder","preset",u.value):u.value===y.value&&(l("openTimer"),g.value&&await Ft(),g.value.focus())},C=async()=>{u.value>n.value?u.value--:u.value=y.value},_=async()=>{u.value<y.value?u.value++:u.value=n.value};function A(T){const B={hour:"numeric",minute:"numeric"},S=new Intl.DateTimeFormat("en-US",B).format(T),E=new Date,x=new Date(E);return x.setDate(x.getDate()+1),T.toDateString()===E.toDateString()?`Today, ${S}`:T.toDateString()===x.toDateString()?`Tomorrow, ${S}`:T>x?`${T.toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"2-digit"})}, ${S}`:T.toLocaleString("en-US")}const D=()=>{let T=xt();return T.minute()<30?T=T.startOf("hour").add(30,"minute"):T=T.startOf("hour").add(1,"hour"),T.format("hh:mm A")};return(T,B)=>(a(),d(Se,null,[F(e("div",VD,[B[8]||(B[8]=e("h6",{class:"ml-2 mt-4 text-base px-2 pb-0 text-gray-900"},"Set a reminder",-1)),e("ul",null,[o.formattedRemindAt?(a(),d("li",{key:0,class:O(["px-4 py-1 hover:bg-gray-100 cursor-pointer duration-200",{"bg-orange-100":u.value===-1}]),onClick:B[0]||(B[0]=S=>T.$emit("setChatReminder","original",0))},[B[6]||(B[6]=e("a",{href:"#",class:"text-gray-900"},"Original",-1)),e("div",UD,I(A(new Date(o.formattedRemindAt))),1)],2)):h("",!0),(a(!0),d(Se,null,Ne(o.reminderOptions,(S,E)=>(a(),d("li",{class:O(["px-4 py-1 hover:bg-gray-100 cursor-pointer",{"bg-gray-200":u.value===E}]),onClick:x=>T.$emit("setChatReminder","preset",E),key:E},[e("a",WD,I(o.reminderOptionsText[E]),1),e("div",qD,I(A(S)),1)],10,GD))),128))]),e("ul",{class:O(["px-4 border-t border-gray-200 hover:bg-gray-100 rounded-bl-lg rounded-br-lg py-2 cursor-pointer",{"bg-gray-200":u.value===y.value}])},[e("li",{class:"m-0",onClick:B[1]||(B[1]=S=>T.$emit("openTimer"))},B[7]||(B[7]=[e("a",{class:"text-gray-900 w-100"},"Custom Time",-1)]))],2)],512),[[Gt,o.showReminderOptions]]),F(e("div",HD,[B[9]||(B[9]=e("h6",{class:"ml-2 mt-4 text-base px-2 pb-0 text-gray-900"},"Set a reminder",-1)),e("div",zD,[F(e("input",{type:"date",class:"!text-sm","onUpdate:modelValue":B[2]||(B[2]=S=>m.value=S),min:p(xt)().format("YYYY-MM-DD"),ref_key:"reminderDateInputRef",ref:g,onfocus:"this.showPicker?.()"},null,8,KD),[[bt,m.value]]),W(ra,{modelValue:i.value,"onUpdate:modelValue":B[3]||(B[3]=S=>i.value=S),dropUp:"",hidePastTime:o.shouldHidePastTime},null,8,["modelValue","hidePastTime"])]),e("div",YD,[e("button",{class:"!bg-gray-200 text-gray-900 !shadow-none",onClick:B[4]||(B[4]=S=>T.$emit("closeOptions"))},"Cancel"),e("button",{class:"ml-3 !bg-gray-900 text-white w-[66px] flex justify-center",onClick:B[5]||(B[5]=S=>T.$emit("setChatReminder","custom",4))},"Set")])],512),[[Gt,o.showTimer]])],64))}}),JD={key:0,class:"send--button"},QD=["disabled"],XD=["disabled"],eI={key:2,class:"send--button"},tI=["disabled"],sI=["disabled"],aI={src:To},oI={key:3,class:"send--button"},nI=["disabled"],iI={key:1,class:"icon"},lI={src:ni},rI=["disabled"],dI=["disabled"],uI=["disabled"],cI={src:vD,alt:"chevron-up",class:"absolute cursor"},mI={src:fD},gI={src:To},pI={class:"flex flex-row"},Wi=300,vI=fe({__name:"ChatSendButton",props:{isNoteMode:{type:Boolean,default:!1},isReminderMode:{type:Boolean,default:!1},disableSendButton:{type:Boolean,default:!1},isEditingNode:{type:Boolean,default:!1},isEditingReminder:{type:Boolean,default:!1},isEditingReminderWithError:{type:Boolean,default:!1},isTranslationEnabled:{type:Boolean,default:!1},isSmallScreen:{type:Boolean,default:!1},showMobileReminder:{type:Boolean,default:!1},isBlocked:{type:Boolean,default:!1},message:{type:String,default:""},remindAt:{type:String,default:""},messageMeta:{type:Object},messageId:{type:String,default:""}},emits:["updatePrivateNote","sendMessage","clearMessage","onCloseReminderEdit","toggleMobileReminder","revertReminderMode","toggleNoteMode","focusEditorInputField"],setup(o,{emit:s}){const t=ls(),n=ct(),l=Ae(),{sendMessage:i,resendMessage:m,lastMessageLanguageCode:r}=Yt(),{updateReminder:u}=Hn(),{getCountryFlag:g}=xr(),y=o,c=s,w=$([]),f=$(!1),v=$(!1),C=$(!0),_=$(!1),A=$(!1),D=$("09:00 AM"),T=$(),B=$(null),S=$(null),E=$(["1 hour","3 hours","24 hours","48 hours"]),x=$(0),P=$(2),j=$(1),H=b(()=>l.isProUserOrTrial),k=b(()=>{y.showMobileReminder,v.value;const Le=new Date;return[new Date(Le.getTime()+1*60*60*1e3),new Date(Le.getTime()+3*60*60*1e3),new Date(Le.getTime()+24*60*60*1e3),new Date(Le.getTime()+48*60*60*1e3)]}),M=Le=>Le.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),V=b(()=>{var Le;return(Le=l.user)==null?void 0:Le.id}),Z=b(()=>{var Le;return(Le=l.user)==null?void 0:Le.attributes.widget_id}),ae=b(()=>{var Le,le;return(le=(Le=l==null?void 0:l.user)==null?void 0:Le.attributes)==null?void 0:le.agent_id}),ce=b(()=>{var Le,le;return(le=(Le=l.user)==null?void 0:Le.attributes)==null?void 0:le.team_id}),J=b(()=>{const Le=y.remindAt;if(Le){const le=new Date(Le.replaceAll("-","/")+" UTC"),Ie=Intl.DateTimeFormat().resolvedOptions().timeZone;return le.toLocaleString("en-US",{timeZone:Ie}).replace(",","")}}),X=()=>{c("sendMessage",!1),c("clearMessage")},z=()=>{c("onCloseReminderEdit"),G()};We(()=>T.value,()=>{ve(T.value)&&(D.value=be())}),Xe(()=>{window.addEventListener("keydown",q)}),ps(()=>{window.removeEventListener("keydown",q)});const q=Le=>{if(f.value)switch(Le.preventDefault(),Le.stopPropagation(),Le.key){case"Enter":ue();break;case"ArrowUp":pe();break;case"ArrowDown":de();break}},ue=async()=>{switch(x.value){case 0:c("sendMessage"),G();break;case 1:ee(),G();break;case 2:ie();break}},pe=async()=>{x.value>j.value?x.value--:x.value=P.value},de=async()=>{x.value<P.value?x.value++:x.value=j.value},he=b(()=>T.value?ve(T.value):!1),ve=Le=>{const le=xt(),Ie=xt(Le);return le.isSame(Ie,"day")},be=()=>{let Le=xt();return Le.minute()<30?Le=Le.startOf("hour").add(30,"minute"):Le=Le.startOf("hour").add(1,"hour"),Le.format("hh:mm A")};function re(){f.value?(f.value=!1,c("focusEditorInputField")):v.value?v.value=!1:A.value?A.value=!1:f.value=!0}function ie(){G(),v.value=!0}function xe(){G(),A.value=!0}function N(){_.value=!0,C.value=!1}function L(Le){const le=xt(Le).format("YYYY-MM-DD"),Ie=xt(Le).format("HH:mm:ss");T.value=le,D.value=Ie}function me(Le){let[le,Ie]=Le.split(" "),[rt,Et]=le.split(":");return Ie==="PM"&&rt!=="12"?rt=`${parseInt(rt,10)+12}`:Ie==="AM"&&rt==="12"&&(rt="00"),`${rt.toString().padStart(2,"0")}:${Et.padStart(2,"0")}:00`}const G=()=>{x.value=0,y.showMobileReminder&&c("toggleMobileReminder"),f.value=!1,v.value=!1,A.value=!1,C.value=!0,_.value=!1,c("revertReminderMode")},U=()=>{y.showMobileReminder&&c("toggleMobileReminder"),C.value=!0,_.value=!1},R=Le=>{const le=p(B),Ie=p(S);le&&!le.contains(Le.target)&&le!==Le.target&&!(Ie!=null&&Ie.contains(Le.target))&&G()},ee=()=>{c("toggleNoteMode")};async function se(Le){if(!T.value){ze().set({message:"Please select a date to set the reminder.",type:"error"});return}const{id:le}=t.params;if(y.message){c("onCloseReminderEdit"),c("clearMessage"),G();const Ie=`${T.value} ${me(D.value)}`,rt=Le==="original"?Ie:Fe(Ie);u({conversationId:le,content:M(y.message),messageId:y.messageId,teamId:ce.value,remindAt:rt})}}async function Y(Le,le){var Ce;if(Le==="preset"&&L(k.value[le]),Le==="original"&&L(new Date(y.remindAt)),y.isEditingReminder&&!y.isEditingReminderWithError){se(Le);return}if(y.message.length>Wi){ze().set({message:"The maximum character limit for reminders is "+Wi+" characters.",type:"error"});return}if(!T.value){ze().set({message:"Please select a date to set the reminder.",type:"error"});return}G();const Ie=new Set([...w.value.map(vt=>vt.id)]),{id:rt}=t.params,Et={content:M(y.message),userId:V.value,agentId:ae.value,teamId:ce.value,widgetId:Z.value,meta:{note_html:(Ce=y.messageMeta)==null?void 0:Ce.note_html},mentions:Array.from(Ie).map(vt=>({agent_id:vt}))},ye=`${T.value} ${me(D.value)}`,_t=Le==="original"?ye:Fe(ye);y.isEditingReminderWithError?(m({isReminder:!0,conversationId:rt,messageId:y.messageId,isNote:!1,remindAt:_t}),c("onCloseReminderEdit"),c("clearMessage"),G()):await i({isReminder:!0,conversationId:rt,isNote:y.isNoteMode,params:Et,remindAt:_t}),c("clearMessage")}const Fe=Le=>new Date(Le).toISOString().replace("T"," ").replace(/\.\d{3}Z$/,""),oe=Le=>{T.value=Le},st=Le=>{D.value=Le};return(Le,le)=>{const Ie=Pe("Loader"),rt=He("svg-inline"),Et=He("click-away");return a(),d(Se,null,[H.value&&o.isNoteMode?(a(),d("div",JD,[o.isEditingNode?(a(),d("button",{key:0,onClick:le[0]||(le[0]=ye=>c("updatePrivateNote")),disabled:o.disableSendButton},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0})):h("",!0),le[4]||(le[4]=e("span",null,"Update Note",-1))],8,QD)):(a(),d("button",{key:1,onClick:X,disabled:o.disableSendButton},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0})):h("",!0),le[5]||(le[5]=e("span",null,"Add a Private Note",-1))],8,XD))])):!H.value&&(o.isNoteMode||o.isReminderMode)?(a(),ne(Zo,{key:1})):o.isReminderMode?(a(),d("div",eI,[o.isEditingReminder?(a(),d("button",{key:0,class:"save-changes-main-button",onClick:le[1]||(le[1]=ye=>c("toggleMobileReminder")),disabled:o.disableSendButton},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0})):h("",!0),le[6]||(le[6]=e("span",null,"Update Reminder",-1))],8,tI)):(a(),d("button",{key:1,class:"save-changes-main-button",onClick:le[2]||(le[2]=ye=>c("toggleMobileReminder")),disabled:o.disableSendButton},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0})):h("",!0),F(e("img",aI,null,512),[[rt]]),le[7]||(le[7]=e("span",null,"Set a Reminder",-1))],8,sI))])):(a(),d("div",oI,[o.isSmallScreen?(a(),d("button",{key:0,disabled:o.disableSendButton||o.isBlocked,onClick:X,class:"send-button-small--screen"},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0,size:"12px"})):(a(),d("div",iI,[F(e("img",lI,null,512),[[rt]])]))],8,nI)):(a(),d("div",{key:1,class:"relative flex justify-content-center align-items-center",ref_key:"optionsButtonRef",ref:S},[o.isEditingReminder?(a(),d("button",{key:0,class:"!bg-white !shadow-none",onClick:z},le[8]||(le[8]=[e("span",{class:"!text-gray-900"},"Cancel",-1)]))):h("",!0),o.isEditingReminder?(a(),d("button",{key:1,class:"main-button space-x-2 save-changes-main-button",onClick:le[3]||(le[3]=ye=>ie()),disabled:o.disableSendButton||o.isBlocked},le[9]||(le[9]=[e("span",null,"Edit Reminder",-1)]),8,rI)):h("",!0),o.isEditingReminder?h("",!0):(a(),d("button",{key:2,class:"main-button space-x-2",onClick:X,disabled:o.disableSendButton||o.isBlocked},[p(n).uiFlags.isMessageSending||p(n).uiFlags.isImageUploading?(a(),ne(Ie,{key:0,size:"12px"})):h("",!0),o.isTranslationEnabled&&p(r)&&p(g)(p(r))?(a(),d("span",{key:1,style:lt({"background-image":`url(${p(g)(p(r))})`}),class:"w-4 h-4 bg-primaryLight border-primaryLight inline-block bg-center bg-[length:calc(16px*2)] overflow-hidden rounded-2xl"},null,4)):h("",!0),e("span",null,I(`${p(n).uiFlags.isImageUploading?Le.$t("CONVERSATION.ACTIONS.UPLOADING_IMAGE"):Le.$t("CONVERSATION.ACTIONS.SEND_MESSAGE")}`),1)],8,dI)),o.isEditingReminder?h("",!0):F((a(),d("button",{key:3,class:O(["dropdown-button text-white border-none duration-300 cursor-pointer p-0 rounded-md w-7 h-7 top-0",{"dropdown-button-selected":f.value||v.value||A.value}]),disabled:o.disableSendButton||o.isBlocked,onClick:re},[e("div",{class:O(["bg-[#F3F9FF88] w-[1px] h-100 -ml-[4px] border-y-4 border-primary duration-300",{"!border-[#cfcfd3]":o.disableSendButton||o.isBlocked}])},null,2),F(e("img",cI,null,512),[[rt]])],10,uI)),[[Et,R]]),F(e("div",{class:"dropdown-content absolute min-w-[180px] z-[1000] right-0 cursor-pointer bg-white rounded-lg",ref_key:"optionsRef",ref:B},[F(e("div",null,[e("div",{onClick:ee,class:O(["flex flex-row p-2  mt-2 mb-2 px-2  hover:bg-gray-200 cursor-pointer",{"opacity-30 pointer-events-none":!H.value},{"opacity-1 pointer-events-auto":H.value},{"bg-gray-100":x.value===1}])},[F(e("img",mI,null,512),[[rt]]),le[10]||(le[10]=_e(" Private Note "))],2),e("div",{onClick:ie,class:O(["flex flex-row p-2 mb-2 px-2  hover:bg-gray-200 cursor-pointer",{"opacity-30 pointer-events-none":!H.value},{"opacity-1 pointer-events-auto":H.value},{"bg-gray-100":x.value===2}])},[F(e("img",gI,null,512),[[rt]]),le[11]||(le[11]=e("a",{class:"no-underline block"},"Set a reminder",-1))],2),e("div",pI,[H.value?h("",!0):(a(),ne(Zo,{key:0}))])],512),[[Gt,f.value]]),W(ZD,{showReminderOptions:v.value,formattedRemindAt:J.value,reminderOptions:k.value,reminderOptionsText:E.value,reminderTime:D.value,reminderDate:T.value,shouldHidePastTime:he.value,showTimer:A.value,onOpenTimer:xe,onCloseOptions:G,onSetChatReminder:Y,onUpdateReminderDate:oe,onUpdateReminderTime:st},null,8,["showReminderOptions","formattedRemindAt","reminderOptions","reminderOptionsText","reminderTime","reminderDate","shouldHidePastTime","showTimer"])],512),[[Gt,f.value||v.value||A.value]])],512))])),W(OD,{showMobileReminder:o.showMobileReminder,showMobileReminderOptions:C.value,formattedRemindAt:J.value,reminderOptions:k.value,reminderOptionsText:E.value,reminderTime:D.value,reminderDate:T.value,shouldHidePastTime:he.value,showMobileTimer:_.value,onCloseReminderModal:U,onSetChatReminder:Y,onOpenMobileReminderTimer:N,onUpdateReminderDate:oe,onUpdateReminderTime:st},null,8,["showMobileReminder","showMobileReminderOptions","formattedRemindAt","reminderOptions","reminderOptionsText","reminderTime","reminderDate","shouldHidePastTime","showMobileTimer"])],64)}}});const fI=Oe(vI,[["__scopeId","data-v-d05dcf17"]]),hI={class:"flex max-h-[14rem] sm:max-h-[18rem] md:max-h-[20rem] xl:max-h-[34rem] lg:max-h-[24rem]"},_I={class:"bg-grey100 basis-3/5 p-5 overflow-y-auto"},yI={class:"relative rounded-md shadow-sm"},bI={key:0,class:"!mt-8 divide-y"},wI={class:"flex -space-x-3 overflow-hidden mt-2 mb-3"},xI=["src","alt"],CI={key:1,src:Mo,class:"w-10 h-10",alt:""},kI={key:1,class:"grid place-items-center min-h-[180px]"},$I={key:1},SI={class:"basis-2/5 p-10 overflow-y-auto"},TI={key:0,class:"h-full grid place-items-center"},MI={key:1,class:"!bg-white flex flex-col gap-4"},AI=["src","alt"],EI={key:1,class:"w-10 h-10",src:Mo,alt:""},DI={class:"flex flex-col gap-1"},II={class:"flex"},FI={class:"text-grey900 font-medium"},PI={class:"flex flex-col gap-1"},jI={class:"flex"},LI={class:"text-grey900 font-medium"},RI=["href"],BI=fe({__name:"ShopifyCollectionShareModel",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","share"],setup(o,{emit:s}){const t=s,n=$([]),l=$([]),i=$(!1);Xe(async()=>{await m()});async function m(f=""){i.value=!0;try{const{data:v}=await $s.getCollections({q:f});n.value=v.collections.nodes}catch(v){Ze(v)}finally{i.value=!1}}function r(){g()}function u(){t("share",Ke.cloneDeep(l.value))}function g(){l.value=[],t("update:modelValue",!1)}const y=(f,v)=>{if(f){l.value.push(Ke.cloneDeep(v));return}const C=l.value.findIndex(_=>_.id===v.id);l.value.splice(C,1)},c=Ys(f=>{const v=f.target.value;m(v)},800);function w(f){return new URL("/collections/"+f.handle,$s.origin_url).href}return(f,v)=>{const C=Pe("Loader"),_=Pe("Modal"),A=He("svg-inline");return o.modelValue?(a(),ne(_,{key:0,closeModal:o.modelValue,"header-title":"Share collection",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Share Collection",onActionButtonTypeOne:r,onActionButtonTypeTwo:u,onCloseModal:g,footerTopBorder:"",classes:"md:!w-[770px] z-50","disable-button-two":!l.value.length},{default:K(()=>[e("div",hI,[e("div",_I,[e("div",yI,[v[1]||(v[1]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"!w-4 !h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])],-1)),e("input",{onInput:v[0]||(v[0]=(...D)=>p(c)&&p(c)(...D)),class:"block w-full !rounded-lg border-0 !py-1 !pl-8 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Search by ID number or name..."},null,32)]),!i.value&&n.value.length?(a(),d("div",bI,[(a(!0),d(Se,null,Ne(n.value.sort((D,T)=>T.id-D.id),D=>{var T,B,S;return a(),d("div",{class:"py-2",key:D.id},[W(ja,{id:D.id,"model-value":!n.value.find(E=>E.id===D.id),"onUpdate:modelValue":E=>y(E,D)},{default:K(()=>[v[2]||(v[2]=_e(" Collection name: ")),e("strong",null,I(D.title),1)]),_:2},1032,["id","model-value","onUpdate:modelValue"]),e("div",wI,[(T=D.image)!=null&&T.url?(a(),d("img",{key:0,class:"inline-block rounded-md ring-1 ring-grey200 w-10 h-10",src:(B=D.image)==null?void 0:B.url,alt:(S=D.image)==null?void 0:S.altText},null,8,xI)):F((a(),d("img",CI,null,512)),[[A]])])])}),128))])):(a(),d("div",kI,[i.value?(a(),ne(C,{key:0})):(a(),d("span",$I,"No collections found"))]))]),e("div",SI,[l.value.length===0?(a(),d("div",TI,v[3]||(v[3]=[e("p",{class:"select-none"},"Select one or more collection",-1)]))):(a(),d("div",MI,[(a(!0),d(Se,null,Ne(l.value.sort((D,T)=>T.id-D.id),D=>{var T,B,S;return a(),d("div",{key:D.id},[(T=D.image)!=null&&T.url?(a(),d("img",{key:0,class:"inline-block rounded-md ring-1 ring-grey200 w-10 h-10",src:(B=D.image)==null?void 0:B.url,alt:(S=D.image)==null?void 0:S.altText},null,8,AI)):F((a(),d("img",EI,null,512)),[[A]]),e("div",DI,[e("div",II,[v[4]||(v[4]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Collection name"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",FI,I(D.title),1)])]),e("div",PI,[e("div",jI,[v[5]||(v[5]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"URL"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",LI,[e("a",{href:w(D),target:"_blank"},"Link",8,RI)])])])])}),128))]))])])]),_:1},8,["closeModal","disable-button-two"])):h("",!0)}}}),NI={class:"flex max-h-[14rem] sm:max-h-[18rem] md:max-h-[20rem] xl:max-h-[34rem] lg:max-h-[24rem]"},OI={class:"bg-grey100 basis-3/5 p-5 overflow-y-auto"},VI={class:"relative rounded-md shadow-sm"},UI={key:0,class:"!mt-8 grid place-items-center grid-cols-4"},GI={class:"relative"},WI={class:"grid place-items-center"},qI=["src","alt"],HI={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"inline-block rounded-md bg-white border-2 w-16 h-16"},zI={class:"text-xs px-1 truncate text-ellipsis text-center"},KI={key:1,class:"grid place-items-center h-[200px]"},YI={key:1},ZI={class:"basis-2/5 p-10 overflow-y-auto"},JI={key:0,class:"h-full grid place-items-center"},QI={key:1,class:"!bg-white flex flex-col gap-4"},XI=["src","alt"],eF={key:1,class:"inline-block rounded-md border bg-white border-2 w-fit w-10 h-10",src:Mo,alt:""},tF={class:"flex flex-col gap-3"},sF={class:"flex"},aF=["innerHTML"],oF={class:"flex flex-col gap-1"},nF={class:"flex"},iF={class:"text-grey900 font-medium max-w-[150px] truncate"},lF={class:"flex flex-col gap-1"},rF={class:"flex"},dF={class:"text-grey900 font-medium"},uF=fe({__name:"ShopifyProductShareModel",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","share"],setup(o,{emit:s}){const t=s,n=$([]),l=$([]),i=$(!1);Xe(async()=>{await m()});async function m(f=""){i.value=!0;try{const{data:v}=await $s.getProducts({q:f});n.value=v.products.nodes.map(C=>(C.id=C.id.substring(C.id.lastIndexOf("/")+1),C))}catch(v){Ze(v)}finally{i.value=!1}}function r(){g()}function u(){t("share",Ke.cloneDeep(l.value))}function g(){l.value=[],t("update:modelValue",!1)}const y=Ys(f=>{const v=f.target.value;m(v)},800),c=(f,v)=>{if(f){l.value.push(Ke.cloneDeep(v));return}const C=l.value.findIndex(_=>_.id===v.id);l.value.splice(C,1)};function w(f){return`<a href="${new URL(`/products/${f.handle}`,$s.origin_url).href}" target="_blank">Link</a>`}return(f,v)=>{const C=Pe("Modal"),_=He("svg-inline");return o.modelValue?(a(),ne(C,{key:0,closeModal:o.modelValue,"header-title":"Share product",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Share Product",onActionButtonTypeOne:r,onActionButtonTypeTwo:u,onCloseModal:g,footerTopBorder:"",classes:"md:!w-[770px] z-50","disable-button-two":!l.value.length},{default:K(()=>[e("div",NI,[e("div",OI,[e("div",VI,[v[1]||(v[1]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"!w-4 !h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])],-1)),e("input",{onInput:v[0]||(v[0]=(...A)=>p(y)&&p(y)(...A)),class:"block w-full !rounded-lg border-0 !py-1 !pl-8 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-1 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6",placeholder:"Search by ID number or name..."},null,32)]),!i.value&&n.value.length?(a(),d("div",UI,[(a(!0),d(Se,null,Ne(n.value.sort((A,D)=>D.legacyResourceId-A.legacyResourceId),A=>{var D,T,B;return a(),d("div",{key:A.legacyResourceId,class:"border-solid border-1 bg-white px-0.5 py-2.5 m-1 rounded-md border-grey900 w-[90%]"},[e("div",GI,[W(ja,{class:"absolute right-[-2px] top-[-5px] bg-white",id:A.id,"model-value":!!l.value.find(S=>S.id===A.id),"onUpdate:modelValue":S=>c(S,A)},null,8,["id","model-value","onUpdate:modelValue"]),e("div",WI,[(D=A.featuredImage)!=null&&D.url?(a(),d("img",{key:0,class:"inline-block rounded-md ring-1 ring-grey200 w-16 h-16",src:(T=A.featuredImage)==null?void 0:T.url,alt:(B=A.featuredImage)==null?void 0:B.altText},null,8,qI)):(a(),d("svg",HI,v[2]||(v[2]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"},null,-1)])))])]),e("p",zI,I(A.title),1)])}),128))])):(a(),d("div",KI,[i.value?(a(),ne(fs,{key:0})):(a(),d("span",YI,"No products found"))]))]),e("div",ZI,[l.value.length===0?(a(),d("div",JI,v[3]||(v[3]=[e("p",{class:"select-none"},"Select one or more products",-1)]))):(a(),d("div",QI,[(a(!0),d(Se,null,Ne(l.value.sort((A,D)=>D.legacyResourceId-A.legacyResourceId),A=>{var D,T,B;return a(),d("div",{key:A.legacyResourceId},[(D=A.featuredImage)!=null&&D.url?(a(),d("img",{key:0,class:"inline-block rounded-md ring-1 ring-grey200 w-10 h-10",src:(T=A.featuredImage)==null?void 0:T.url,alt:(B=A.featuredImage)==null?void 0:B.altText},null,8,XI)):F((a(),d("img",eF,null,512)),[[_]]),e("div",tF,[e("div",sF,[v[4]||(v[4]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Product url"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",{class:"text-grey900 font-medium",innerHTML:w(A)},null,8,aF)])]),e("div",oF,[e("div",nF,[v[5]||(v[5]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Product name"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",iF,I(A.title),1)])]),e("div",lF,[e("div",rF,[v[6]||(v[6]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Product id"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",dF,I(A.id),1)])])])}),128))]))])])]),_:1},8,["closeModal","disable-button-two"])):h("",!0)}}}),cF={class:"flex gap-1 items-center mb-1"},mF={class:"font-normal text-sm text-grey600"},gF={class:"p-3 w-96"},pF={class:"w-[20.875rem]"},Ns=fe({__name:"Label",props:{labelText:{type:String,required:!0},tooltipText:{type:String,required:!1},placement:{type:String,required:!1,default:"top"},isProFeature:{type:Boolean,required:!1,default:!1}},setup(o){return(s,t)=>(a(),d("div",cF,[e("span",mF,I(o.labelText),1),o.tooltipText?(a(),ne(yt,{key:0,placement:o.placement},{content:K(()=>[e("div",gF,[e("span",null,I(o.tooltipText),1)])]),default:K(()=>[t[0]||(t[0]=e("img",{src:as,alt:"info"},null,-1))]),_:1},8,["placement"])):h("",!0),o.isProFeature?(a(),ne(yt,{key:1,triggers:["click"],class:"cursor-pointer",placement:"left",theme:"chatway-upgradenow"},{content:K(()=>[e("div",pF,[W(Ea)])]),default:K(()=>[t[1]||(t[1]=e("img",{src:Da,alt:""},null,-1))]),_:1})):h("",!0)]))}}),vF={class:"m-[20px]"},fF={key:0,class:"mx-1"},hF={class:"flex flex-col gap-1"},_F={class:"flex"},yF={class:"text-grey900 font-medium"},bF={class:"flex flex-col gap-1"},wF={class:"flex"},xF={class:"text-grey900 font-medium"},CF={class:"flex flex-col gap-1"},kF={class:"flex"},$F={class:"text-grey900 font-medium"},SF=fe({__name:"ShopifyCuponShareModel",props:{modelValue:{type:Boolean,required:!0}},emits:["update:modelValue","share"],setup(o,{emit:s}){const t=s,n=$([]),l=$(),i=$(!1);Xe(async()=>{await m()});async function m(){i.value=!0;try{const{data:w}=await $s.getCoupons();n.value=w.codeDiscountNodes.nodes}catch(w){Ze(w)}finally{i.value=!1}}function r(){g()}function u(){t("share",Ke.cloneDeep(l.value))}function g(){l.value=void 0,t("update:modelValue",!1)}const y=w=>{l.value=w};function c(w){return w==null?"No expiration date":xt(w).format("DD/MM/YYYY")}return(w,f)=>{const v=Pe("Modal");return o.modelValue?(a(),ne(v,{key:0,closeModal:o.modelValue,"header-title":"Share coupon",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Share Coupon",onActionButtonTypeOne:r,onActionButtonTypeTwo:u,onCloseModal:g,footerTopBorder:"","disable-button-two":!l.value,classes:"md:!w-[496px]  z-50"},{default:K(()=>{var C,_,A,D,T;return[e("div",vF,[W(Ns,{"label-text":"Select coupon code"}),W(ga,{classes:"h-8 ",class:"mb-8","model-value":((C=l.value)==null?void 0:C.id)||"",items:n.value,"onChange:selectedItem":y,"bind-value":"id","bind-label":"codeDiscount.title",placeholder:"Select coupon"},null,8,["model-value","items"]),l.value?(a(),d("div",fF,[e("div",hF,[e("div",_F,[f[0]||(f[0]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Coupon name"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",yF,I((A=(_=l.value)==null?void 0:_.codeDiscount)==null?void 0:A.title),1)])]),e("div",bF,[e("div",wF,[f[1]||(f[1]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Coupon code"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",xF,I((T=(D=l.value)==null?void 0:D.codeDiscount)==null?void 0:T.title),1)])]),e("div",CF,[e("div",kF,[f[2]||(f[2]=e("div",{class:"flex items-center flex-1"},[e("span",{style:{"text-wrap":"nowrap"}},"Valid till"),e("div",{class:"border-b border-grey200 border-dashed w-full mx-1 top-1 relative"})],-1)),e("span",$F,I(c(l.value.codeDiscount.endsAt)),1)])])])):h("",!0)])]}),_:1},8,["closeModal","disable-button-two"])):h("",!0)}}}),TF=fe({__name:"ChatCustomFileUpload",emits:["fileUploaded"],setup(o,{expose:s,emit:t}){const n=t,l=$(null),i=()=>{var g;(g=l.value)==null||g.click()},m=g=>{const y=g.target.files;y&&y.length>0&&r(y[0])},r=g=>{const c=g.size>8388608;Ka(g)?c?(u(),alert("You can upload file up to 8 MB")):(n("fileUploaded",{file:g}),u()):(alert("Please select a valid file type."),u())},u=()=>{l.value.value=""};return s({openFileExplorer:i}),(g,y)=>(a(),d("input",{class:"hidden",type:"file",accept:"image/png, image/gif, image/jpeg, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, image/webp, video/mp4, audio/mp3, text/plain, text/csv, application/vnd.openxmlformats-officedocument.presentationml.presentation",ref_key:"fileInput",ref:l,onChange:m},null,544))}}),MF={class:"flex justify-center date sticky sticky-animated top-0 z-[5]"},AF={class:"bg-white inline-flex items-center justify-center py-1 px-4 rounded-[28px] shadow-[0px_1px_4px_0px_#282D3E28]"},EF={class:"text-[12px] font-normal leading-leading400"},DF=fe({__name:"DateView",props:{conversationDate:{type:String,required:!0}},setup(o){const s=o,t=b(()=>cs(s.conversationDate,"MMM DD, YYYY").value),n=b(()=>cs(xd(),"MMM DD, YYYY").value),l=b(()=>Xi(s.conversationDate).value),i=b(()=>t.value===n.value?"Today":l.value==="yesterday"||l.value.includes("hour")?"Yesterday":t.value);return(m,r)=>(a(),d("div",MF,[e("div",AF,[e("div",EF,I(i.value),1)])]))}});const IF=Oe(DF,[["__scopeId","data-v-97319d7f"]]),FF={class:"chat--view--wrap"},PF={src:Jk},jF={class:"chat-header--left"},LF={class:"name-wrap"},RF=["title"],BF={key:0,class:"is-blocked"},NF={src:Qa,alt:""},OF={key:0,class:"arrow-wrap"},VF={src:Qn},UF={class:"chat-header--right"},GF={class:"bookmark-conversation"},WF={src:Qk,alt:"",class:""},qF={class:"conversation-assignment"},HF=["disabled"],zF={src:Ql},KF=["disabled"],YF={src:Xk},ZF={src:e$},JF={key:0,class:"resolved-banner"},QF={key:0,class:"flex flex-col justify-center items-center h-[11.938rem] bg-[url('@/assets/images/blurred-message.png')] mb-[1.06rem] after:absolute after:left-0 after:top-0 after:w-full after:h-full after:bg-white/80 after:content-[''] after:backdrop-blur-[6.5px]"},XF={key:0},eP={class:"absolute right-[-4px] top-[-3px] flex justify-center items-center w-4 h-4 text-xs leading-normal bg-[#FF4545] text-white rounded-[6.25rem]"},tP={key:0,class:"pro-message bg-[#ffa565] flex justify-center items-center text-sm mb-2 rounded-lg py-[6px]"},sP={src:Jn,alt:"alert triangle icon"},aP={class:"m-0"},oP={key:1,class:"pro-message bg-[#ffa565] flex justify-center items-center text-sm text-center mb-2 rounded-lg py-[6px]"},nP={src:Jn,alt:"alert triangle icon"},iP={class:"textarea--container"},lP={class:"reply-bottom--area"},rP={class:"others"},dP={src:s$},uP={src:a$},cP={src:o$},mP={class:"reminder flex flex-row"},gP={src:To},pP={src:Dl},vP={src:Xn},fP={class:"w-4",src:_o},hP=["onClick"],_P=["onClick"],yP=["onClick"],bP=["onClick"],wP={key:0,class:"m-[15px]"},xP={key:1,class:"m-[15px]"},CP={class:"pt-2"},Uo=300,kP=fe({__name:"ChatView",props:{selectedConversation:{type:Object,default:()=>{}}},emits:["toggle-expanded-view"],setup(o,{emit:s}){const t=ls(),n=At(),l=ct(),i=zs(),m=Ja(),r=Ae(),u=ys(),g=hl(),y=ze(),c=Xt(),{updateNote:w}=Wn(),{assignConversation:f,bookmarkConversation:v,toggleConversationStatus:C,translateMessages:_}=ss(),{getAllMessages:A,sendMessage:D,sendImage:T,readMessages:B}=Yt(),{storeUserMessage:S,getUserMessages:E,resetUserMessage:x}=fl(),{height:P}=Ht(),{isSmallScreen:j}=hs(),H=o,k=s,M=ol("commonmark",{html:!0,linkify:!0}),V=$(""),Z=$(""),ae=$(""),ce=$([]),J=Nt({note_html:"",content_html:"",disable_preview:!1}),X=$(!0),z=$(!1),q=$(!1),ue=$(!1),pe=$(!1),de=$(!1),he=$(null),ve=$(0),be=$(0),re=$(0),ie=$(0),xe=$(!0),N=$(!1),L=$(!1),me=$(!1),G=$(!1),U=$(null),R=$(),ee=$(!1),se=$(),Y=$(!1),Fe=$(!0),oe=$(!1),st=$(null),Le=$(!1),le=$(!1),Ie=$(!1),rt=$(!1),Et=localStorage.getItem("dontShowShopifyPermissionUpdateModal")||"false",ye=$(Et==="false"),_t=$(Et==="true"),Ce=$();let vt=null;const qe=b(()=>l.uiFlags.isMessagesLoading),Je=b(()=>u.uiFlags.isFetchingAgents),ft=b(()=>z.value||q.value?J.note_html:V.value),Ve=b(()=>V.value.length==0),Re=$(null),it=b(()=>l.messagesMeta.current_page),tt=b(()=>l.messagesMeta.total_pages),Be=b(()=>{var ge;return(ge=r.user)==null?void 0:ge.id}),at=b(()=>{var ge;return(ge=r.user)==null?void 0:ge.attributes.widget_id}),Ue=b(()=>{var ge,we;return(we=(ge=r.user)==null?void 0:ge.attributes)==null?void 0:we.name}),Ct=b(()=>{var ge,we;return(we=(ge=r.user)==null?void 0:ge.attributes)==null?void 0:we.team_id}),te=b(()=>{var ge,we;return(we=(ge=r==null?void 0:r.user)==null?void 0:ge.attributes)==null?void 0:we.agent_id}),Q=b(()=>{var ge,we;return(we=(ge=r==null?void 0:r.user)==null?void 0:ge.attributes)==null?void 0:we.profile_photo_url}),Te=b(()=>{var ge;return(ge=H.selectedConversation)==null?void 0:ge.attributes.contact}),je=b(()=>Te.value?Te.value.contact_name||Te.value.name:""),Ge=b(()=>u.agents.filter(ge=>ge.attributes.status==="active")),mt=b(()=>{var ge;return(ge=H.selectedConversation)==null?void 0:ge.groupedMessages}),wt=b(()=>H.selectedConversation.attributes.translation_setting),$t=b(()=>l.messageUnreadCount),Dt=b(()=>{const we=(H.selectedConversation?[...H.selectedConversation.messages]:[...l.selectedConversation.messages]).reverse().find(et=>et.attributes.is_read_by_visitor===!0);return we||{id:""}}),zt=b(()=>{const we=(H.selectedConversation?[...H.selectedConversation.messages]:[...l.selectedConversation.messages]).reverse().find(et=>et.attributes.is_sender_agent&&!et.attributes.is_system_message);return we||{id:""}}),qt=b(()=>g.typings[H.selectedConversation.id]||[]),os=b(()=>Ds(V.value.charAt(0))),dt=b(()=>{var ge;return!!((ge=Te.value)!=null&&ge.blocked_at)}),St=b(()=>qt.value.length===0?"":iu({typingRecords:qt.value})),xs=b(()=>{var pt;const ge=l.allConversations;if(ge.length===0||!H.selectedConversation)return[];const we=ge.findIndex(Pt=>Pt.id===H.selectedConversation.id);return(pt=ge[we].attributes.agents)==null?void 0:pt.map(Pt=>({id:Pt.id,name:Pt.name,src:Pt.profile_photo_url}))}),La=b(()=>xs.value.length!==0),Ps=b({get(){var ge;return H.selectedConversation&&((ge=H.selectedConversation)==null?void 0:ge.attributes.is_bookmarked)},set(ge){const{id:we}=t.params;v({id:we,saveStatus:ge})}}),Eo=b(()=>it.value===tt.value),Js=b(()=>{var ge;return H.selectedConversation&&((ge=H.selectedConversation)==null?void 0:ge.attributes.is_resolved)===!0}),rs=b(()=>r.isProUserOrTrial),so=b(()=>{var ge;return(ge=H.selectedConversation)==null?void 0:ge.attributes.contact.src}),on=b(()=>!r.isProUserOrTrial&&Eo.value&&H.selectedConversation.attributes.has_month_old_messages),ao=b(()=>l.isTogglingConversationStatus),nn=b(()=>q.value||pe.value?"CONVERSATION.ACTIONS.WRITE_REMINDER":z.value?"CONVERSATION.ACTIONS.WRITE_NOTE":"CONVERSATION.ACTIONS.WRITE_MESSAGE"),ln=b(()=>r.productTourCurrentStep==4&&P.value>=500?-230:r.productTourCurrentStep==5&&P.value>=500?50:0),rn=()=>{var ge;(ge=Ce.value)==null||ge.openFileExplorer()},dn=()=>{if(k("toggle-expanded-view"),j.value)return n.go(-1)},un=()=>{ft.value.startsWith("#")&&Ee(),G.value=!1};We(()=>[ft.value,V.value,q.value,z.value],()=>{cn()});function cn(){var ge;(ge=H.selectedConversation)!=null&&ge.id&&!ue.value&&!pe.value?S(H.selectedConversation.id,{message:V.value,isReminder:q.value,isNote:z.value,noteHtml:J.note_html}):mn()}function mn(){x(H.selectedConversation.id)}function gn(){var ge,we;if((ge=H.selectedConversation)!=null&&ge.id){const et=E((we=H.selectedConversation)==null?void 0:we.id);if(!ue.value&&!pe.value&&et&&(et!=null&&et.message)){V.value=et==null?void 0:et.message,q.value=et==null?void 0:et.isReminder,z.value=et==null?void 0:et.isNote,J.note_html=et==null?void 0:et.noteHtml;return}}Xs(),z.value=!1}function pn(ge){var we,et;(we=U.value)==null||we.insertMessage(ge),(et=U.value)==null||et.focusEditorInputField()}function vn(){var ge,we,et,pt;((ge=V.value)==null?void 0:ge.slice(-1))!=="@"?((we=U.value)==null||we.insertMessage("@"),setTimeout(()=>{var Pt;return(Pt=U.value)==null?void 0:Pt.showMentions()},0)):((et=U.value)==null||et.insertMessage("@"),setTimeout(()=>{var Pt;return(Pt=U.value)==null?void 0:Pt.hideMentions()},0)),(pt=U.value)==null||pt.focusEditorInputField()}function Do(){var ge;(ge=R.value)==null||ge.hidePicker()}const Io=$(!0),Fo=b(()=>r.isProUser),Po=()=>{n.push({name:"settings-plans-view"})};function fn(ge){Io.value=ge}function hn(){q.value=!q.value,q.value&&(z.value=!1)}function va(){V.value.length<=Uo?J.note_html=V.value:J.note_html=V.value.substring(0,Uo),V.value.endsWith("@")&&V.value[V.value.length-2]!=="@"&&setTimeout(()=>{var ge;return(ge=U.value)==null?void 0:ge.showMentions()},0),z.value&&setTimeout(()=>{var ge;return(ge=U.value)==null?void 0:ge.hideMentions()},0),z.value=!z.value,z.value&&(q.value=!1),ue.value&&(ue.value=!1,he.value=null,Ee())}function jo(){q.value||(V.value.length>Uo&&(V.value=V.value.substring(0,Uo)),J.note_html=V.value),q.value=!q.value}function Lo(){oe.value=!oe.value}function _n(){q.value=!1}function yn(){var ge;(ge=U.value)==null||ge.focusEditorInputField()}const ds=ge=>ge.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;"),bn=async ge=>{var Lt,ks,vs,Gs,aa;const we=J.note_html,et=/<p>#.*<\/p>/,pt=/<br\s*\/?>#/,Pt=/\n#.*$/;ft.value.startsWith("#")||et.test(we)?(await Ee(),(Lt=U.value)==null||Lt.insertMessage(ge)):pt.test(we)?(await ot(),(ks=U.value)==null||ks.insertMessage(ge)):Pt.test(V.value)?(await Ot(),(vs=U.value)==null||vs.insertMessage(`
`+ge)):(Gs=U.value)==null||Gs.insertMessage(ge),(aa=U.value)==null||aa.focusEditorInputField()};function Qs(ge=!1){dt.value&&!z.value||(ue.value?Bo():no(ge))}function oo(){var ge;t.params.id===((ge=i.pendingUnreadMessage)==null?void 0:ge.conversationId)&&(B(i.pendingUnreadMessage),i.pendingUnreadMessage=null)}function wn({content:ge,mentions:we,html:et=""}){const pt=V.value;V.value=ge;const Pt=V.value.split(`
`),Lt=Pt[Pt.length-1];if(st.value=Lt,st.value.startsWith("#")?st.value=st.value.slice(1):st.value="",ce.value=we,J.note_html=et,oo(),L.value||z.value||q.value)return;Ue.value&&te.value&&Ct.value&&V.value.length&&V.value!=pt&&(L.value=!0,g.toggleStartTyping({conversationId:H.selectedConversation.id,userName:Ue.value,teamId:Ct.value,agentId:te.value,agentProfilePicture:Q.value}))}function Ro(){L.value=!1,Ue.value&&te.value&&Ct.value&&g.toggleStopTyping({conversationId:H.selectedConversation.id,userName:Ue.value,teamId:Ct.value,agentId:te.value,agentProfilePicture:Q.value})}function xn(ge){he.value=ge,ue.value=!0,z.value=!0,V.value=ge.message.message_body,J.note_html=ge.message&&ge.message.message_meta&&ge.message.message_meta.note_html?ge.message.message_meta.note_html:ge.message.message_body}async function no(ge=!1){if(!G.value&&V.value){if(oe.value)return;if(q.value||pe.value){Lo();return}if(so.value==="email"&&!rs.value)return;if(z.value&&!rs.value){y.set({message:"Private notes are only available for Pro users.",type:"error"});return}try{const{id:we}=t.params,et=new Set([...ce.value.map(Pt=>Pt.id)]),pt={content:ds(V.value),userId:Be.value,agentId:te.value,teamId:Ct.value,widgetId:at.value,meta:{note_html:J.note_html,content_html:J.content_html,disable_preview:J.disable_preview},mentions:Array.from(et).map(Pt=>({agent_id:Pt}))};await D({conversationId:we,isNote:z.value,params:pt}),J.content_html="",J.disable_preview=!1,ge&&!Js.value&&(vt&&clearTimeout(vt),vt=setTimeout(()=>{Ra("resolved")},500)),Us()}catch{}finally{Ro(),Xs()}}}async function Bo(){var ge;if(V.value)try{const{id:we}=t.params,et=new Set([...ce.value.map(pt=>pt.id)]);await w({conversationId:we,teamId:Ct.value,messageId:(ge=he.value)==null?void 0:ge.message_id,content:ds(V.value),meta:{note_html:J.note_html},mentions:Array.from(et).map(pt=>({agent_id:pt}))})}catch{Ee()}finally{he.value=null,ue.value=!1,z.value=!1,Ee()}}async function No(ge){if(ge&&ge.file){const{id:we}=t.params;if(z.value&&!rs.value){y.set({message:"Private notes are only available for Pro users.",type:"error"});return}if(ge.file.size>8192e3){y.set({message:"The file must not be greater than 8MB",type:"error"});return}me.value=!1;const et={file:ge.file,agentId:te.value,teamId:Ct.value,userId:Be.value,widgetId:at.value,fileInfo:{name:ge.file.name,size:ge.file.size,mime:ge.file.type}};await T({conversationId:we,params:et,isNote:z.value})}Ft(()=>{Us()}),l.chatInputFocus=!0,Ft(()=>l.chatInputFocus=!1)}function io(){X.value=!X.value}function Oo(){N.value=!N.value}function Cn(){N.value=!1}function kn(ge){const{id:we}=t.params;f({conversationId:we,agentId:ge,teamId:Ct.value})}function Ra(ge){if(ao.value||qe.value)return;const{id:we}=t.params;C({conversationId:we,status:ge,teamId:Ct.value})}function Us(){const ge=Re.value;ge&&(ge.scrollTop=ge.scrollHeight)}const Ba=()=>{const ge=Re.value;return ge?Math.abs(ge.scrollTop+ge.clientHeight-ge.scrollHeight)<1:void 0};function Na(){var ge,we,et;be.value=(ge=Re.value)==null?void 0:ge.scrollHeight,re.value=(we=Re.value)==null?void 0:we.scrollTop,ie.value=(et=Re.value)==null?void 0:et.clientHeight,Math.floor(be.value-re.value)-ie.value<20?Fe.value=!0:Fe.value=!1}function lo(){const ge=Re.value;if(Na(),!(l.uiFlags.isMessagesLoading||Eo.value)&&ge&&ge.scrollTop<150){const{id:we}=t.params;A({id:we,page:it.value+1}).then(()=>{wt.value&&_();const et=ge.scrollHeight-be.value;ge.scrollTop=re.value+et,Na()}),xe.value=!1}}function $n(ge){var et,pt;if(((et=ge.clipboardData)==null?void 0:et.files.length)==0)return;const we=(pt=ge.clipboardData)==null?void 0:pt.files[0];Ka(we)&&(se.value=we,ee.value||es())}async function Ee(){await Ft(),V.value="",J.note_html="",ce.value=[],ae.value=""}async function ot(){let ge=J.note_html;const we=/<br\s*\/?>#/,et=ge.match(we);if(et){const pt=ge.indexOf(et[0]);J.note_html=ge.substring(0,pt+et[0].length-1)}}async function Ot(){V.value=V.value.replace(/#.*$/,"")}function Cs(){No({file:se.value}),es()}const es=()=>{ee.value=!ee.value};function js(){ee.value&&Cs()}function Bt(){ee.value&&es()}function Xs(){ue.value=!1,q.value=!1,pe.value=!1,de.value=!1,he.value=null,Ee()}function fa(ge){ge.forEach(async we=>{var Lt,ks,vs;let et=new Intl.NumberFormat("en-US",{style:"currency",currency:we.currencyCode});const pt=(Lt=we.fulfillments[we.fulfillments.length-1])==null?void 0:Lt.trackingInfo[we.fulfillments[we.fulfillments.length-1].trackingInfo.length-1],Pt=`**Order Id :** ${we.name}
**Order date :** ${xt(we.createdAt).format("DD/MM/YYYY")}
**Tracking number & link :** ${pt?pt!=null&&pt.url?`[${pt==null?void 0:pt.number}](${pt==null?void 0:pt.url})`:pt==null?void 0:pt.number:"Undefined"}
**Fulfilment status :** ${we.displayFulfillmentStatus.toLowerCase()}
**Products :** ${we.lineItems.nodes.map(Gs=>Gs.name).join(", ")}
**Shipping cost :** ${et.format(we.totalShippingPriceSet.shopMoney.amount)}
**Tax :** ${et.format(we.currentTotalTaxSet.shopMoney.amount)}
**Total price :** ${et.format(we.currentTotalPriceSet.shopMoney.amount)}
**Billing address :** ${((ks=we.billingAddress)==null?void 0:ks.formattedArea)||"Unknown"}
**Shipping address :** ${((vs=we.shippingAddress)==null?void 0:vs.formattedArea)||"Unknown"}
**View order in shopify :** [Link](${we.statusPageUrl})
`;V.value=Pt,J.disable_preview=!0,J.content_html=M.renderInline(Pt),await Qs(!1)}),Le.value=!1}function ha(ge){ge.forEach(async we=>{var pt;const et=`**Collection name :** ${we.title}
**URL :** ${new URL("/collections/"+we.handle,"https://"+((pt=m.marketplaceApp)==null?void 0:pt.site_host_url)).href}
`;V.value=et,J.disable_preview=!0,J.content_html=M.renderInline(et),await Qs(!1)}),le.value=!1}function _a(ge){ge.forEach(async we=>{var pt;const et=`**Product name :** ${we.title}
**Product id :** ${we.id}
**URL :** ${new URL("/products/"+we.handle,"https://"+((pt=m.marketplaceApp)==null?void 0:pt.site_host_url)).href}
`;V.value=et,J.content_html=M.renderInline(et),J.disable_preview=!0,await Qs(!1)}),Ie.value=!1}async function ya(ge){const we=`**Coupon name :** ${ge.codeDiscount.title}
**Coupon code :** ${ge.codeDiscount.title}
**Valid till :** ${ge.codeDiscount.endsAt==null?"No expiration date":xt(ge.codeDiscount.endsAt).format("DD/MM/YYYY")}
`;V.value=we,J.content_html=M.renderInline(we),await Qs(!1),rt.value=!1}const ba=()=>{if(!c.isOwner){ye.value=!1;return}try{$s.updatePermission()}catch(ge){Ze(ge)}},ea=()=>{ye.value=!0},wa=()=>{const ge=Re.value;if(!ge)return;const we=5;Y.value=ge.scrollTop+ge.clientHeight+we<ge.scrollHeight,Ba()&&l.messageUnreadCount>0&&(l.messageUnreadCount=0)};function xa(ge,we,et,pt){V.value=ge,J.note_html=ge,Z.value=we,ae.value=et,pe.value=!0,pt&&(de.value=!0),j.value&&(q.value=!0)}function Ca(){Ee(),pe.value=!1,de.value=!1}const ka=()=>{G.value=!G.value},ta=()=>{r.showFailedPaymentModal=!1,n.push({name:"settings-plans-view"})},sa=ge=>{ge.key==="Escape"&&(ft.value.startsWith("#")&&Ee(),G.value=!1)};We(()=>H.selectedConversation,ge=>{ge&&(gn(),setTimeout(()=>{xe.value=!0},500))}),We(()=>j.value,ge=>{X.value=!ge}),We(()=>V.value,ge=>{const we=ge.split(`
`);we[we.length-1].startsWith("#")?G.value=!0:G.value=!1}),We(()=>l.uiFlags.isLinkPreviewLoading,()=>{xe.value=!0}),We(()=>l.messageUnreadCount,()=>{Ba()&&l.messageUnreadCount>0&&(setTimeout(()=>{Us()},100),l.messageUnreadCount=0)});const $a=Ys(()=>{L.value&&Ro()},1e3);return We(V,()=>{$a()}),We(()=>_t.value,ge=>{ge?localStorage.setItem("dontShowShopifyPermissionUpdateModal","true"):localStorage.setItem("dontShowShopifyPermissionUpdateModal","false")}),Xe(()=>{var ge;(ge=Re.value)==null||ge.addEventListener("scroll",lo),Na(),Us(),lo(),j.value&&(X.value=!1),window.addEventListener("keydown",sa),nt.on("imageDragged",we=>{if(dt.value){ze().set({message:"User has been blocked",type:"error"});return}se.value=we,me.value=!1,ee.value||es()}),nt.on("toggleStarConversation",()=>{Ps.value=!Ps.value}),nt.on("toggleRightMenu",()=>{io()}),nt.on("addNote",()=>{va()}),nt.on("addReminder",()=>{hn()}),nt.on("sendMessageAndResolve",()=>{Qs(!0)}),nt.on("toggleResolveConversation",()=>{Ra(Js.value?"unresolved":"resolved")}),nt.on("assignConversation",()=>{Oo()})}),Ms(()=>{var ge;(ge=Re.value)==null||ge.removeEventListener("scroll",lo),window.removeEventListener("keydown",sa),nt.off("imageDragged"),nt.off("toggleRightMenu"),nt.off("toggleResolveConversation"),nt.off("toggleStarConversation"),nt.off("addNote"),nt.off("assignConversation"),nt.off("addReminder"),nt.off("sendMessageAndResolve")}),Un(()=>{xe.value===!0&&!Y.value&&!Ba()&&Us()}),Cd((ge,we,et)=>{Y.value=!1,l.messageUnreadCount=0,et()}),(ge,we)=>{var Gs,aa,ri,di,ui,ci,mi;const et=Pe("ThumbnailGroup"),pt=Pe("Loader"),Pt=Pe("Modal"),Lt=He("svg-inline"),ks=He("click-away"),vs=He("tooltip");return a(),d(Se,null,[e("div",FF,[e("div",{class:O(["chat--view",{"w-full":p(j)}])},[e("div",{class:O(["chat--view--header",{"is-panel--close":!X.value,"column-view":p(j)}])},[p(j)?(a(),d("div",{key:0,onClick:dn,class:"toggle-expanded--view"},[F(e("img",PF,null,512),[[Lt]])])):h("",!0),e("div",jF,[e("div",LF,[e("span",{class:"contact-name max-w-[190px] truncate inline-flex items-center",title:je.value},[dt.value?(a(),d("span",BF,[F(e("img",NF,null,512),[[Lt]])])):h("",!0),_e(" "+I(p(Ke.truncate)(je.value,{length:20})),1)],8,RF),La.value?(a(),d("div",OF,[F(e("img",VF,null,512),[[Lt]])])):h("",!0)]),W(et,{"users-list":xs.value,size:"20px","font-size":"8px",gap:"tight"},null,8,["users-list"])]),W(go,{placement:"bottom",step:2,classes:"flex z-[13] px-4 py-2.5 bg-white rounded-xl"},{default:K(()=>[e("div",UF,[e("div",GF,[F(e("input",{type:"checkbox","onUpdate:modelValue":we[0]||(we[0]=Rt=>Ps.value=Rt),id:"1-star",name:"rating"},null,512),[[Ia,Ps.value]]),e("label",{for:"1-star",class:"star",onMouseover:we[1]||(we[1]=Rt=>ve.value=1),onMouseleave:we[2]||(we[2]=Rt=>ve.value=0)},[F(e("img",WF,null,512),[[Lt]])],32)]),e("div",qF,[e("button",{class:O(["action-button",{"is-active":N.value}]),onClick:Oo},[e("span",null,I(ge.$t("CONVERSATION.ACTIONS.ASSIGN_TO")),1)],2),N.value?F((a(),ne(K5,{key:0,agents:Ge.value,"current-assignee":xs.value,"is-loading":Je.value,onAssignAgent:kn},null,8,["agents","current-assignee","is-loading"])),[[ks,Cn]]):h("",!0)]),Js.value?(a(),d("button",{key:1,disabled:ao.value||qe.value,class:O(["action-button unresolve-button",{"action-button-small--screen":p(j)}]),onClick:we[4]||(we[4]=Rt=>Ra("unresolved"))},[F(e("img",YF,null,512),[[Lt]]),e("span",null,I(ge.$t("CONVERSATION.ACTIONS.UN_RESOLVE")),1)],10,KF)):(a(),d("button",{key:0,disabled:ao.value||qe.value,class:O(["action-button resolve-button",{"action-button-small--screen":p(j)}]),onClick:we[3]||(we[3]=Rt=>Ra("resolved"))},[F(e("img",zF,null,512),[[Lt]]),e("span",null,I(ge.$t("CONVERSATION.ACTIONS.RESOLVE")),1)],10,HF)),X.value?h("",!0):(a(),d("button",{key:2,class:O(["action-button info-button",{"action-button-small--screen":p(j)}]),onClick:io},[F(e("img",ZF,null,512),[[Lt]]),e("span",null,I(ge.$t("CONTACT.DETAILS")),1)],2))])]),_:1})],2),Js.value?(a(),d("span",JF,I(ge.$t("CONVERSATION.ACTIONS.RESOLVED")),1)):h("",!0),qe.value?h("",!0):(a(),ne(d9,{key:1,isTranslationEnabled:wt.value,contactLang:Te.value.language,conversationId:o.selectedConversation.id},null,8,["isTranslationEnabled","contactLang","conversationId"])),e("div",{class:O(["chat-view--display",{"small-screen--height":p(j)}])},[e("div",{ref_key:"chatView",ref:Re,class:"chat-view--items",onScroll:wa,id:"chat-view-items-container"},[on.value?(a(),d("div",QF,[we[16]||(we[16]=e("img",{class:"z-10 w-8 h-8",src:Da,alt:""},null,-1)),e("div",{class:"z-10 text-sm text-center text-grey900 font-normal leading-[1.225rem]"},[we[14]||(we[14]=_e(" Only the last 30 days of conversation history can be accessed. ")),we[15]||(we[15]=e("br",null,null,-1)),e("span",{class:"inline-flex items-center cursor-pointer",onClick:ta},we[13]||(we[13]=[e("span",{class:"text-primary text-xs leading-[1.05rem] font-semibold underline"},"Upgrade for unlimited history",-1),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[e("path",{d:"M4.5 9L7.5 6L4.5 3",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))])])):h("",!0),e("div",{onClick:oo},[qe.value?(a(),ne(pt,{key:0})):h("",!0),(a(!0),d(Se,null,Ne(mt.value,(Rt,ro)=>(a(),d("div",{key:ro},[W(IF,{conversationDate:Rt.messageDate},null,8,["conversationDate"]),(a(!0),d(Se,null,Ne(Rt.messages,Ls=>{var gi,pi,vi,fi;return a(),d("div",{key:Ls.id,class:"conversation--list"},[p(l).firstUnreadMessage&&p(l).firstUnreadMessage.id===Ls.id?(a(),d("div",XF,we[17]||(we[17]=[e("div",{class:"new-message--alert"},[e("div"),e("p",null,"New"),e("div")],-1)]))):h("",!0),W(RS,{message:Ls.attributes,isRead:(gi=Ls.attributes)==null?void 0:gi.is_read_by_visitor,mentions:Ls.isTemp?Ls.mentions:(vi=(pi=Ls.relationships)==null?void 0:pi.agentMentions)==null?void 0:vi.data,hasError:Ls.hasError,"message-id":Ls.id,"is-sender":(fi=Ls.attributes)==null?void 0:fi.is_sender_agent,"conversation-id":o.selectedConversation.id,onEditNote:xn,lastReadMessage:Dt.value,lastSenderAgent:zt.value,onSetEditReminder:xa},null,8,["message","isRead","mentions","hasError","message-id","is-sender","conversation-id","lastReadMessage","lastSenderAgent"])])}),128))]))),128))]),$t.value?(a(),d("div",{key:1,onClick:Us,class:"flex justify-center items-center cursor-pointer w-[3rem] h-[3rem] rounded-[6.25rem] absolute z-[500] right-[20px] bottom-52 p-2 bg-primary new-msg-shadow hover:bg-[#1155F6]"},[e("span",eP,I($t.value),1),we[18]||(we[18]=e("img",{src:Rn,alt:"scroll icon"},null,-1))])):h("",!0)],544),so.value==="email"&&!rs.value?(a(),d("div",{key:0,onClick:ta,class:"flex items-center gap-2 px-[0.53rem] mx-4 rounded-[0.63rem] bg-[#ffaf65]"},we[19]||(we[19]=[e("img",{src:t$,alt:"caution"},null,-1),e("p",{class:"text-sm text-grey900 leading-[1.225rem] p-0"},[_e(" Message cannot be sent because the conversation is via email, and you don't have access to email integration as a free user. "),e("span",{class:"text-sm text-grey900 leading-[1.225rem] font-semibold underline cursor-pointer"},"Upgrade to Pro")],-1)]))):h("",!0),St.value&&Fe.value?(a(),ne(uE,{key:1,"typing-text":St.value,"sender-name":je.value,onScrollToBottom:Us,"typing-records":qt.value},null,8,["typing-text","sender-name","typing-records"])):h("",!0),St.value&&!Fe.value?(a(),ne(gE,{key:2,"typing-text":St.value,"sender-name":je.value},null,8,["typing-text","sender-name"])):h("",!0),e("div",{class:O(["message-textarea--wrapper",{"is-adding--note":z.value||q.value||pe.value}])},[!rs.value&&q.value?(a(),d("div",tP,[F(e("img",sP,null,512),[[Lt]]),e("p",aP,[we[20]||(we[20]=e("span",{class:"hidden sm:inline text-grey900 text-xs md:text-sm"},"Reminders are a Pro feature.",-1)),Fo.value?h("",!0):(a(),d("a",{key:0,onClick:Po,class:"text-sm text-grey900 leading-[1.225rem] font-semibold underline cursor-pointer"}," Upgrade to Pro ")),we[21]||(we[21]=e("span",{class:"inline text-grey900 text-xs md:text-sm"},"to start setting reminders",-1))])])):h("",!0),!rs.value&&z.value?(a(),d("div",oP,[F(e("img",nP,null,512),[[Lt]]),we[22]||(we[22]=e("span",{class:"text-grey900 hidden sm:inline text-xs md:text-sm"},"Notes are a Pro feature.",-1)),Fo.value?h("",!0):(a(),d("a",{key:0,onClick:Po,class:"text-sm text-grey900 leading-[1.225rem] font-semibold underline cursor-pointer"}," Upgrade to Pro ")),we[23]||(we[23]=e("span",{class:"text-grey900 inline text-xs md:text-sm"},"to start setting notes",-1))])):h("",!0),e("div",iP,[W(X8,{value:ft.value,ref_key:"editorInstance",ref:U,placeholder:ge.$t(nn.value),limitCharacters:q.value,onInput:wn,onFocus:oo,onSubmit:Qs,onPaste:$n,onKeyup:[Ut(js,["enter"]),Ut(Bt,["esc"])],onShowEmojiPicker:(Gs=R.value)==null?void 0:Gs.showPicker,onHideEmojiPicker:Do,onToggleNoteMode:va,onRemoveEmojiPicker:fn,class:O({rtl:os.value}),enableMentions:z.value||q.value},null,8,["value","placeholder","limitCharacters","onShowEmojiPicker","class","enableMentions"]),e("div",lP,[e("div",rP,[Io.value?F((a(),ne(F5,{key:0,ref_key:"emojiPickerInstance",ref:R,onInsertEmoji:pn},null,512)),[[vs,"Emoji",void 0,{top:!0}],[ks,Do]]):h("",!0),z.value?F((a(),d("a",{key:1,href:"",onClick:Qe(vn,["prevent"])},[F(e("img",dP,null,512),[[Lt]])])),[[vs,"Mentions",void 0,{top:!0}]]):h("",!0),!q.value&&!pe.value&&!dt.value?F((a(),d("a",{key:2,href:"",onClick:Qe(rn,["prevent"]),class:"file-upload--button"},[F(e("img",uP,null,512),[[Lt]])])),[[vs,"File upload",void 0,{top:!0}]]):h("",!0),W(go,{placement:"top",step:3,classes:"flex z-[13] px-2 py-2.5 bg-white rounded-xl"},{default:K(()=>[F((a(),d("div",null,[G.value?(a(),ne(k6,{key:0,onInsertCannedResponse:bn,selectedCannedResponseForSearch:st.value},null,8,["selectedCannedResponseForSearch"])):h("",!0),F((a(),d("div",{class:"canned-icon flex mt-0.5",onClick:ka},[F(e("img",cP,null,512),[[Lt]])])),[[vs,"Canned responses #️⃣",void 0,{top:!0}]])])),[[ks,un]]),!z.value&&!q.value&&!pe.value?F((a(),d("a",{key:0,onClick:jo,class:"reminder-icon"},[e("div",mP,[F(e("img",gP,null,512),[[Lt]])])])),[[vs,"Reminder",void 0,{top:!0}]]):h("",!0),z.value||q.value?(a(),d("a",{key:1,href:"",onClick:we[5]||(we[5]=Qe(Rt=>z.value?va():jo(),["prevent"])),class:"close-icon bg-transparent p-4 cursor-pointer inline-flex"},[F(e("img",pP,null,512),[[Lt]]),we[24]||(we[24]=e("span",{class:"text-[#f69d01]"},"Close",-1))])):pe.value?h("",!0):F((a(),d("a",{key:2,href:"",onClick:Qe(va,["prevent"]),class:"note-icon"},[F(e("img",vP,null,512),[[Lt]])])),[[vs,"Private note",void 0,{top:!0}]])]),_:1}),p(m).requiredShopifyPermissionUpdate&&p(m).isOriginatedFromShopify&&!z.value&&!q.value&&!p(r).isProductTourRunning?(a(),d("div",{key:3,onClick:ea,class:"border-l pl-2 cursor-pointer"},we[25]||(we[25]=[e("img",{src:n$},null,-1)]))):h("",!0),W(go,{placement:"top",step:6,classes:"flex z-[13] bg-white rounded-xl"},{default:K(()=>[!p(m).requiredShopifyPermissionUpdate&&p(m).isOriginatedFromShopify&&!z.value||p(r).isProductTourRunning&&p(r).isShopifyUser?(a(),ne(yt,{key:0,triggers:["click"],placement:"top"},{content:K(({hide:Rt})=>[e("ul",null,[p(m).customerOrders.length?(a(),d("li",{key:0,onClick:ro=>(Rt(),Le.value=!0),class:"px-4 py-1 hover:bg-grey100 cursor-pointer"},"Order status",8,hP)):h("",!0),e("li",{onClick:ro=>(Rt(),Ie.value=!0),class:"px-4 py-1 hover:bg-grey100 cursor-pointer"},"Product link",8,_P),e("li",{onClick:ro=>(Rt(),le.value=!0),class:"px-4 py-1 hover:bg-grey100 cursor-pointer"},"Product collections",8,yP),e("li",{onClick:ro=>(Rt(),rt.value=!0),class:"px-4 py-1 hover:bg-grey100 cursor-pointer"},"Coupon code",8,bP)])]),default:K(()=>[e("div",{class:O(["border-l pl-2 cursor-pointer",{"!border-0 !px-3.5 py-2.5":p(r).isProductTourRunning&&p(r).productTourCurrentStep==6}])},[F(e("img",fP,null,512),[[Lt]])],2)]),_:1})):h("",!0)]),_:1}),Le.value?(a(),ne(pD,{key:4,modelValue:Le.value,"onUpdate:modelValue":we[6]||(we[6]=Rt=>Le.value=Rt),onShare:fa},null,8,["modelValue"])):h("",!0),le.value?(a(),ne(BI,{key:5,modelValue:le.value,"onUpdate:modelValue":we[7]||(we[7]=Rt=>le.value=Rt),onShare:ha,"origin-url":(ri=(aa=o.selectedConversation)==null?void 0:aa.attributes)==null?void 0:ri.origin},null,8,["modelValue","origin-url"])):h("",!0),Ie.value?(a(),ne(uF,{key:6,modelValue:Ie.value,"onUpdate:modelValue":we[8]||(we[8]=Rt=>Ie.value=Rt),onShare:_a,"origin-url":(ui=(di=o.selectedConversation)==null?void 0:di.attributes)==null?void 0:ui.origin},null,8,["modelValue","origin-url"])):h("",!0),rt.value?(a(),ne(SF,{key:7,modelValue:rt.value,"onUpdate:modelValue":we[9]||(we[9]=Rt=>rt.value=Rt),onShare:ya,"origin-url":(mi=(ci=o.selectedConversation)==null?void 0:ci.attributes)==null?void 0:mi.origin},null,8,["modelValue","origin-url"])):h("",!0)]),W(fI,{isNoteMode:z.value,isReminderMode:q.value,disableSendButton:Ve.value,isEditingNode:ue.value,isSmallScreen:p(j),isBlocked:dt.value,message:V.value,messageMeta:J,messageId:Z.value,remindAt:ae.value,isEditingReminder:pe.value,isEditingReminderWithError:de.value,showMobileReminder:oe.value,isTranslationEnabled:wt.value,onUpdatePrivateNote:Bo,onSendMessage:no,onClearMessage:Ee,onOnCloseReminderEdit:Ca,onToggleMobileReminder:Lo,onRevertReminderMode:_n,onToggleNoteMode:va,onFocusEditorInputField:yn},null,8,["isNoteMode","isReminderMode","disableSendButton","isEditingNode","isSmallScreen","isBlocked","message","messageMeta","messageId","remindAt","isEditingReminder","isEditingReminderWithError","showMobileReminder","isTranslationEnabled"]),W(TF,{onFileUploaded:No,ref_key:"customFileUpload",ref:Ce},null,512)])])],2)],2)],2),X.value?(a(),d("div",{key:0,class:O(["profile--info--container",{"is-small--screen":p(j),"z-[13]":p(r).showEmailOfflineVisitorModal||p(r).isProductTourRunning&&[4,5].includes(p(r).productTourCurrentStep)}])},[W(go,{placement:"left",step:[4,5],skidding:ln.value,"arrow-padding":100,classes:"h-full"},{default:K(()=>[Te.value?(a(),ne(T5,{key:0,onClosePanel:io,"contact-attributes":Te.value,"handel-shopify-info-click":ea},null,8,["contact-attributes"])):h("",!0)]),_:1},8,["skidding"])],2)):h("",!0)]),ee.value?(a(),ne(Vn,{key:0,to:"body"},[ee.value?(a(),ne(Pt,{key:0,closeModal:ee.value,alertModal:!0,"header-title":"Are you sure you want to send the file?",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Send",onActionButtonTypeOne:es,onActionButtonTypeTwo:Cs,onCloseModal:es},null,8,["closeModal"])):h("",!0)])):h("",!0),ye.value&&p(m).requiredShopifyPermissionUpdate&&p(m).isOriginatedFromShopify?(a(),ne(Pt,{key:1,classes:"md:!w-[600px]","close-modal":ye.value,onCloseModal:we[11]||(we[11]=()=>ye.value=!1),"header-title":"Update Shopify Data Permission",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:p(c).isOwner?"Update":"Got it",onActionButtonTypeOne:we[12]||(we[12]=()=>ye.value=!1),onActionButtonTypeTwo:ba},{FooterLeftContent:K(()=>[W(ja,{modelValue:_t.value,"onUpdate:modelValue":we[10]||(we[10]=Rt=>_t.value=Rt),id:"shopify_modal_consent","hint-text":"Don't show this message again"},null,8,["modelValue"])]),default:K(()=>{var Rt;return[p(c).isOwner?(a(),d("div",wP,we[26]||(we[26]=[e("p",null,"To display order and cart details on customer profiles, Chatway needs permission to access this data from Shopify.",-1),e("p",{class:"pt-2"},"Once granted, you'll be able to view order status, details, and cart items, enabling you to resolve customer issues more efficiently.",-1)]))):(a(),d("div",xP,[we[27]||(we[27]=e("p",null,"To display order and cart details, Chatway needs permission from Shopify.",-1)),e("p",CP,"Only the account owner can grant this. Please contact "+I((Rt=p(r).user)==null?void 0:Rt.attributes.owner_email)+".",1),we[28]||(we[28]=e("p",null,"Once granted, you'll see order status, details, and cart items, making it easier to resolve customer issues.",-1))]))]}),_:1},8,["close-modal","actionButtonTypeTwoText"])):h("",!0)],64)}}});const $P=Oe(kP,[["__scopeId","data-v-f44c1968"]]),SP={class:"skeleton-loader--container"},TP=fe({__name:"ChatListLoader",setup(o){const s=$(25),t=Array.from({length:s.value},(n,l)=>l);return(n,l)=>(a(),d("div",SP,[(a(!0),d(Se,null,Ne(p(t),i=>(a(),d("div",{key:i,class:"chat-item--container"},l[0]||(l[0]=[da('<div class="chat--list-item" data-v-88198d25><div class="thumbnail skeleton" data-v-88198d25></div><div class="others" data-v-88198d25><div class="name skeleton" data-v-88198d25><span class="agent-name skeleton" data-v-88198d25></span></div><div class="message skeleton" data-v-88198d25></div></div><div class="meta-details" data-v-88198d25><div class="meta skeleton" data-v-88198d25></div><span class="unread-count skeleton" data-v-88198d25></span></div></div>',1)])))),128))]))}});const MP=Oe(TP,[["__scopeId","data-v-88198d25"]]),AP="/assets/copy-code-7573b4aa.svg",EP={class:"logo mt-8"},DP=["src"],IP={key:0},FP={key:0,class:"flex justify-center mt-7 text-left"},PP={key:1,class:"installation-code--wrap max-w-[691px]"},jP={class:"text-center"},LP=["href"],RP={src:$o,alt:""},BP={key:1},NP={key:0},OP={key:0,class:"flex justify-center mt-7 text-left"},VP={key:1},UP={class:"installation-code--wrap max-w-[615px] md:min-w-[615px]"},GP={class:"flex justify-center"},WP={key:0,class:"w-[21.44rem] !text-grey900 !text-sm !text-center"},qP=["onClick"],HP=["src"],zP={key:0,class:"w-full flex justify-center"},KP={class:"!text-xs md:!text-sm"},YP={key:0,class:"w-full flex justify-center"},ZP={src:AP,alt:""},JP={key:1,class:"w-full"},QP={class:"rounded-lg bg-grey100 p-3"},XP={key:0},ej={key:1},tj={key:2,class:"w-full flex justify-center"},sj={class:"rounded-lg bg-grey100 p-3 w-full"},aj={class:"!text-xs md:!text-sm !text-grey900 md:!text-grey600 !font-semibold md:!font-normal"},oj=["href"],nj=["href"],ij=fe({__name:"EmptyInstallationCode",setup(o){const s=Ae(),t=Bs(),{width:n,height:l}=Ht(),i=$({name:"Any Website",marketPlaceUrl:"",learnMore:""}),m=Nt([{name:"Any Website",logo:new URL("/assets/code-gray-18eb4e0c.svg",self.location).href,selectedLogo:new URL("/assets/code-colored-020a03b5.svg",self.location).href},{name:"Shopify",logo:new URL("/assets/shopify-gray-3a2eab20.svg",self.location).href,selectedLogo:new URL("/assets/shopify-colored-4b3dd339.svg",self.location).href},{name:"Wix",logo:new URL("/assets/wix-gray-facc44d4.svg",self.location).href,selectedLogo:new URL("/assets/wix-colored-bae2672d.svg",self.location).href,marketPlaceUrl:"https://www.wix.com/app-market/chatway-live-chat",learnMore:"https://chatway.app/help/getting-started/how-to-install-chatway-on-wix/"},{name:"WordPress",logo:new URL("/assets/wordpress-gray-31608caf.svg",self.location).href,selectedLogo:new URL("/assets/wordpress-colored-cfa7d8ec.svg",self.location).href,marketPlaceUrl:"https://wordpress.org/plugins/chatway-live-chat",learnMore:"https://chatway.app/help/getting-started/how-to-install-chatway-on-wordpress/"},{name:"Square",logo:new URL("/assets/square-gray-5e62c511.svg",self.location).href,selectedLogo:new URL("/assets/square-colored-91a89206.svg",self.location).href,marketPlaceUrl:"/square/install",learnMore:"https://chatway.app/help/getting-started/how-to-install-chatway-on-square-online/"},{name:"Duda",logo:new URL("/assets/duda-gray-1147c36e.svg",self.location).href,selectedLogo:new URL("/assets/duda-colored-5000c5e3.svg",self.location).href,marketPlaceUrl:"https://apps.duda.co/apps/chatway:-live-chat",learnMore:"https://chatway.app/help/getting-started/how-to-install-chatway-on-duda/"}]),r=T=>{i.value=T},u=b(()=>{const T=s.user;return nu(T==null?void 0:T.attributes.team_id)}),g=b(()=>s.marketPlaceName),y=b(()=>s.marketPlaceUrl),c=b(()=>s.isTrialContainerVisible||s.hasFailedPayment),w=()=>{try{navigator.clipboard.writeText(u.value),ze().set({message:"Code copied successfully",type:"success"})}catch{}},f=b(()=>t.uiFlags.isInstallationLoading),v=b(()=>s.uiFlags.isFetchingEmbeddedStatus),C=b(()=>s.shouldDisplayShopifyInstructionOnChatway),_=b(()=>s.isMarketPlace),A=b(()=>n.value<604),D=()=>{s.showShopifyCompleteSetupModal=!0,s.ignoreConversationCheck=!0};return(T,B)=>{var E;const S=He("svg-inline");return a(),d("div",{class:O(["installation-settings flex items-center flex-col p-1",[{"overflow-y-auto pb-[100px]":p(l)<698&&_.value&&C.value}]])},[e("div",EP,[e("img",{src:`${p(De)}images/logo-text.svg`,alt:"logo"},null,8,DP)]),_.value?(a(),d("div",IP,[e("div",null,[C.value&&!p(yo)()&&!p(s).isLoadedOnDudaDashboard?(a(),d("div",FP,[W(Pn)])):h("",!0),y.value&&!C.value?(a(),d("div",PP,[e("p",jP," Your visitors can now contact you through Chatway's live chat. Go to your "+I(g.value==="shopify"||g.value==="bigcommerce"||g.value==="ecwid"?"store":g.value==="bigcartel"?"shop":"website")+" to start a test conversation. ",1),e("a",{href:y.value,class:"copy-button visit-button",target:"_blank"},[F(e("img",RP,null,512),[[S]]),_e(" Go to "+I(g.value==="shopify"||g.value==="bigcommerce"||g.value==="ecwid"||g.value==="nuvemshop"||g.value==="tiendanube"?"Store":g.value==="bigcartel"?"Shop":"Website"),1)],8,LP)])):h("",!0)])])):h("",!0),!_.value&&!((E=p(s).user)!=null&&E.attributes.has_conversations)?(a(),d("div",BP,[!f.value&&!v.value?(a(),d("div",NP,[C.value?(a(),d("div",OP,[W(Pn)])):(a(),d("div",VP,[e("div",UP,[e("div",{class:O([{"h-[calc(100vh-230px)]":A.value&&i.value.name==="Any Website","h-[calc(100vh-295px)]":A.value&&i.value.name==="Any Website"&&c.value,"!h-full":A.value&&i.value.name==="Any Website"&&p(l)<668,"h-[calc(100vh-264px)]":A.value&&i.value.name!=="Any Website","h-[calc(100vh-330px)]":A.value&&i.value.name!=="Any Website"&&c.value}])},[e("h5",{class:O([{"!text-sm !text-grey900 !font-normal":A.value}])},"Start Chatting with Your Visitors 🎉",2),e("div",GP,[A.value?(a(),d("p",WP,"We recommend using a larger screen during installation process.")):h("",!0)]),e("div",{class:O(["grid gap-x-3 gap-y-2 my-4",[A.value?"grid-cols-2":"grid-cols-3"]])},[(a(!0),d(Se,null,Ne(m,x=>(a(),d("div",{key:x.name,class:"w-full"},[e("div",{class:O([`${i.value.name===x.name?"border-primary bg-[#F3F9FF]":"border-grey200"}`,"border rounded-lg p-3 flex flex-col items-center justify-center gap-3 cursor-pointer hover:border-primary hover:bg-[#F3F9FF]"]),onClick:P=>r(x)},[e("div",{class:O(["rounded-lg bg-grey100 w-10 h-10 flex items-center justify-center",[i.value.name===x.name?"bg-[#0446de] bg-opacity-20":""]])},[e("img",{src:i.value.name===x.name?x.selectedLogo:x.logo,alt:"icon",width:"24",height:"24",loading:"lazy"},null,8,HP)],2),e("p",{class:O(["text-sm !leading-5 text-center whitespace-nowrap",`${i.value.name===x.name?"!text-primary":"text-grey600"}`])},I(x.name),3)],10,qP)]))),128))],2),i.value.name==="Any Website"?(a(),d("div",zP,[e("div",null,[e("div",{class:O(["rounded-lg bg-grey100 border border-grey200 w-full mb-4",[{"!bg-[rgba(230,230,240,0.5)]":A.value}]])},[B[0]||(B[0]=e("p",{class:"!text-xs !text-grey900 md:!text-grey600 md:!text-base !font-semibold border-b border-b-grey200 px-4 py-2"},"Paste the script in every page above the </head>",-1)),e("code",KP,I(`${u.value}`),1)],2)])])):h("",!0)],2),i.value.name==="Any Website"?(a(),d("div",YP,[e("button",{class:"copy-button",onClick:w},[F(e("img",ZP,null,512),[[S]]),B[1]||(B[1]=_e(" Copy Code "))])])):h("",!0),i.value.name==="Shopify"?(a(),d("div",JP,[e("div",QP,[B[3]||(B[3]=e("p",{class:"!text-xs md:!text-sm !text-grey900 md:!text-grey600 !font-semibold md:!font-normal"},[_e(" Easy Installation on Shopify "),e("a",{target:"_blank",href:"https://chatway.app/help/getting-started/how-to-install-chatway-on-shopify/"},[e("span",{class:"text-sm text-primary cursor-pointer"},"(Learn More)")])],-1)),C.value?(a(),d("div",XP,[e("button",{class:"copy-button w-full",onClick:D},"Complete Shopify Setup")])):(a(),d("div",ej,B[2]||(B[2]=[e("a",{href:"https://apps.shopify.com/chatway?utm_source=chatway_new_store",target:"_blank",rel:"noopener noreferrer"},[e("button",{class:"copy-button w-full"},"Connect Shopify")],-1)])))])])):h("",!0),i.value.name!=="Shopify"&&i.value.name!=="Any Website"?(a(),d("div",tj,[e("div",sj,[e("p",aj,[_e(" Easy Installation on "+I(i.value.name)+" ",1),e("a",{target:"_blank",href:i.value.learnMore},B[4]||(B[4]=[e("span",{class:"text-sm text-primary cursor-pointer"},"(Learn More)",-1)]),8,oj)]),e("a",{href:i.value.marketPlaceUrl,target:"_blank",rel:"noopener noreferrer"},[e("button",{class:"copy-button w-full",onClick:w},"Connect "+I(i.value.name),1)],8,nj)])])):h("",!0)])]))])):h("",!0)])):h("",!0)],2)}}});const lj=Oe(ij,[["__scopeId","data-v-8faf453e"]]),rj={key:0,class:"p-4 flex justify-center"},dj={key:1,class:"flex flex-col"},uj=["src"],cj={key:1,class:"empty-text"},mj=fe({__name:"EmptyState",props:{text:{},src:{},showInstallationCode:{type:Boolean},hasConversationsOlderThanMonth:{type:Boolean}},setup(o){const{width:s}=Ht(),t=Ae(),n=o,l=At(),{allConversations:i,uiFlags:m}=Ts(ct()),r=b(()=>m.value.isConversationsLoading?!1:!i.value.length&&n.showInstallationCode&&!n.hasConversationsOlderThanMonth),u=b(()=>s.value<604),g=b(()=>t.isMarketPlace),y=b(()=>t.marketPlaceName==="shopify"),c=b(()=>t.allShopifyWithEmbeddedStatus.some(f=>!f.attributes.is_embedded_app_enabled&&y)),w=()=>{l.push({name:"settings-plans-view"})};return(f,v)=>(a(),d("div",{class:O(["empty-view",[{"!bg-grey100 !rounded-none":u.value&&r.value||p(s)<768&&r.value&&y.value,"!block":u.value&&r.value&&!g.value||p(s)<768&&r.value&&c.value}]])},[r.value?(a(),ne(lj,{key:0})):(a(),d(Se,{key:1},[f.hasConversationsOlderThanMonth?(a(),d("div",rj,[e("div",{class:"flex items-center justify-center gap-[0.62rem]"},[v[2]||(v[2]=e("div",{class:"bg-[#0446DE1A] w-8 h-8 flex items-center p-1.5 rounded-full"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[e("path",{d:"M15.8333 9.1665H4.16667C3.24619 9.1665 2.5 9.9127 2.5 10.8332V16.6665C2.5 17.587 3.24619 18.3332 4.16667 18.3332H15.8333C16.7538 18.3332 17.5 17.587 17.5 16.6665V10.8332C17.5 9.9127 16.7538 9.1665 15.8333 9.1665Z",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M5.83301 9.1665V5.83317C5.83301 4.7281 6.27199 3.66829 7.0534 2.88689C7.8348 2.10549 8.89461 1.6665 9.99968 1.6665C11.1047 1.6665 12.1646 2.10549 12.946 2.88689C13.7274 3.66829 14.1663 4.7281 14.1663 5.83317V9.1665",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e("div",{class:"text-xs font-normal leading-[1.05rem]"},[v[1]||(v[1]=_e(" Free plan includes last 30 days' chat history. ")),e("span",{class:"inline-flex items-center cursor-pointer",onClick:w},v[0]||(v[0]=[e("span",{class:"text-primary text-xs leading-[1.05rem] font-semibold underline"},"Upgrade for unlimited history",-1),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[e("path",{d:"M4.5 9L7.5 6L4.5 3",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))])])])):(a(),d("div",dj,[n.src?(a(),d("img",{key:0,src:n.src,alt:"search"},null,8,uj)):h("",!0),n.text?(a(),d("span",cj,I(n.text),1)):h("",!0)]))],64))],2))}});const Go=Oe(mj,[["__scopeId","data-v-bd132906"]]);function ii(){const{id:o,attributes:s,languages:t,fileUploadUrl:n,uiFlags:l,contact_form:i,visibilityHours:m,widgetTriggers:r,faqs:u,show_faq:g}=Ts(As()),{languages:y}=Ts(Es()),c=async()=>{l.value.isFetchingWidget=!0;try{const L=new na,[{data:me,included:G},U]=await Promise.all([L.getWidget(),L.getWidgetLangText()]);if(!me.id)return;o.value=me.id,s.value=me.attributes,g.value=!!me.attributes.show_faq,f(U.data),v(G),C(G),w(G),_(G),l.value.isFetchingWidget=!1}catch(L){l.value.isFetchingWidget=!1,Ze(L)}},w=L=>{L.forEach(me=>{me.type==="widget_trigger"&&(r.value=me.attributes)})},f=L=>{const me={};L.forEach(G=>{G.type==="widget_lang"&&(me[G.id]=G.attributes)}),t.value=me},v=L=>{const me=[];L.forEach(G=>{G.type==="widget_contact_form"&&me.push(G.attributes)}),i.value=me},C=L=>{const me=[];L.forEach(G=>{G.type==="widget_visibility_hour"&&me.push(G.attributes)}),m.value=me},_=L=>{const me=[];L.forEach(G=>{G.type==="widget_faqs"&&me.push({id:G.id,...G.attributes})}),u.value=me},A=async L=>{var me,G;try{const{data:U,included:R}=await new na().createWidget(L);return o.value=U.id,s.value=U.attributes,v(R),f(R),C(R),{data:U,type:"success"}}catch(U){return Ze(U),(G=(me=U.response)==null?void 0:me.data)!=null&&G.message?{message:U.response.data.message,type:"error"}:{message:"Something went wrong",type:"error"}}},D=async L=>{var me,G;try{const{data:U,included:R}=await new na().updateWidget({widgetId:o.value,payload:L});return s.value=U.attributes,g.value=!!U.attributes.show_faq,v(R),f(R),C(R),_(R),ze().set({message:"Widget updated successfully",type:"success"}),{data:U,type:"success"}}catch(U){return U.response.data.errors.side_spacing&&U.response.data.errors.bottom_spacing?(ze().set({message:"Side spacing and bottom spacing must be between 0 & 1500",type:"error"}),{message:"Side spacing and bottom spacing must be between 0 & 1500",type:"error"}):(Ze(U),(G=(me=U.response)==null?void 0:me.data)!=null&&G.message?{message:U.response.data.message,type:"error"}:{message:"Something went wrong",type:"error"})}},T=async({file:L})=>{try{await new na().uploadCustomWidget({file:L}).then(me=>{n.value=me.data.attributes.url})}catch(me){Ze(me)}},B=async({file:L})=>{try{return await new na().uploadCustomWidget({file:L})}catch(me){Ze(me)}},S=async({email:L})=>{try{await new na().sendInstallationCode({email:L}),ze().set({message:"Installation code sent successfully",type:"success"})}catch(me){Ze(me)}},E=L=>{const me=[];for(const[G,U]of Object.entries(L)){const R={lang:G,is_published:U!=null&&U.is_published?1:0,is_default:U.is_default?1:0,locale:U.locale??y.value[G],text:Object.entries(U).filter(([ee])=>!["locale","is_published","is_default"].includes(ee)).map(([ee,se])=>({text_title:ee,text_value:se}))};me.push(R)}return me},x=$("right"),P=$("left"),j=$(0),H=$(0),k=$("m"),M=$(48),V=$([{color:"#0446DE",hex:"#0446DE"},{color:"linear-gradient(100.96deg, #43cea2 0%, #185a9d 100%), #414141",hex:"#185A9D"},{color:"#282D3E",hex:"#282D3E"},{color:"linear-gradient(101.04deg, #56CCF2 0.59%, #2F80ED 100%), #7E8E9C",hex:"#2F80ED"},{color:"linear-gradient(101.04deg, #00317A 0.59%, #001F4F 100%)",hex:"#001F4F"},{color:"linear-gradient(100.96deg, #5E3D86 0%, #2F164D 100%), #537EE1",hex:"#2F164D"},{color:"linear-gradient(180deg, #F69D01 0%, #F65901 100%)",hex:"#F65901"},{color:"linear-gradient(100.96deg, #6A3093 0%, #A044FF 100%), #3B9488",hex:"#A044FF"},{color:"linear-gradient(100.96deg, #E96443 0%, #904E95 100%), #5BB055",hex:"#904E95"}]),Z=$("#0446DE"),ae=$({color:"#0446DE",hex:"#0446DE"}),ce=$([{key:"left",position:"left"},{key:"right",position:"right"},{key:"custom",position:"custom"}]),J=$([{key:"left",position:"left"},{key:"right",position:"right"}]),X=$([{key:"s",size:"S"},{key:"m",size:"M"},{key:"l",size:"L"},{key:"xl",size:"XL"},{key:"xxl",size:"XXL"},{key:"custom",size:"Custom"}]),z=L=>{const me=window.innerHeight,G=704,U=400,R=x.value==="custom"?L:10,ee=me-R-104,se=Math.max(U,ee);return Math.min(se,G)},q=b(()=>z(j.value)),ue=b(()=>{let L=H.value;const me=window.innerWidth;if(me>=480){const G=me-420;L>G&&(L=G)}else{const G=me-70;L>G&&(L=G)}return L<0&&(L=0),L}),pe=b(()=>{const me=z(j.value),G=parseInt(re.value.replace("px","")),U=j.value+me+G;let R=j.value;if(U>window.innerHeight){const ee=U-window.innerHeight+20;R=j.value-ee}return R}),de=b(()=>he.value),he=b(()=>{if(x.value==="left")return{justifyContent:"flex-start",bottom:"20px",left:"10px"};if(x.value==="right")return{justifyContent:"flex-end",bottom:"20px",right:"10px"};if(x.value==="custom"){if(P.value==="left")return{justifyContent:"flex-start",bottom:`${pe.value}px`,left:`${ue.value}px`};if(P.value==="right")return{justifyContent:"flex-end",bottom:`${pe.value}px`,right:`${ue.value}px`}}return{}}),ve=b(()=>{if(x.value==="custom"){const me=parseInt(re.value.replace("px","")),G=pe.value+me+10;if(P.value==="left")return`position: relative; bottom: ${G}px; left: ${ue.value}px;`;if(P.value==="right")return`position: relative; bottom: ${G}px; right: ${ue.value}px;`}return""}),be=b(()=>{const me=parseInt(re.value.replace("px","")),G=pe.value+me;if(x.value==="left")return{justifyContent:"flex-start",bottom:"90px",left:"10px"};if(x.value==="right")return{justifyContent:"flex-end",bottom:"90px",right:"10px"};if(x.value==="custom"){if(P.value==="left")return{justifyContent:"flex-start",bottom:`${G+10}px`,left:`${ue.value}px`};if(P.value==="right")return{justifyContent:"flex-start",bottom:`${G+10}px`,right:`${ue.value}px`}}return{}}),re=b(()=>k.value==="s"?"44px":k.value==="m"?"60px":k.value==="l"?"70px":k.value==="xl"?"84px":k.value==="xxl"?"94px":k.value==="custom"?`${M.value}px`:"60px"),ie=b(()=>[{key:"chat-smile"},{key:"chat-base"},{key:"chat-bubble"},{key:"chat-db"},{key:"chat-image"}]),xe=b(()=>V.value.some(me=>Z.value==me.hex)?ae.value.hex:Z.value);return{getWidget:c,createWidget:A,updateWidget:D,uploadSystemMessageIcon:B,uploadCustomWidget:T,sendInstallationCode:S,formatLanguages:E,bubblePosition:de,previewBubblePosition:he,previewWidgetPosition:be,previewWidgetHeight:q,widgetPosition:ve,widgetSizeInPixel:re,widgetBubbles:ie,getBubbleColor:xe,activeWidgetPositionKey:x,activeCustomWidgetPositionKey:P,bubbleBottomSpacing:j,bubbleSideSpacing:H,activeWidgetSizeKey:k,customWidgetSize:M,widgetColors:V,chatBubbleColor:Z,activeWidgetColor:ae,widgetPositions:ce,customWidgetPosition:J,widgetSizes:X,getContactFormFields:async()=>{try{const{data:L}=await new na().getContactFormFields();v(L)}catch(L){l.value.isFetchingWidget=!1,Ze(L)}}}}const gj={class:"filter--container"},pj={src:uC},vj={src:cC},fj={key:0,class:"empty-view--wrap"},hj={key:0,class:"conversation-loaded"},_j={key:1,class:"flex items-center justify-center gap-[0.62rem]"},yj={class:"text-xs font-normal leading-[1.05rem]"},bj={key:2,class:"absolute inset-0 z-[9] lg:rounded-tl-xl lg:rounded-tr-xl overflow-hidden bg-grey900 bg-opacity-60 backdrop-filter"},qi=20,wj=fe({__name:"Conversation",setup(o){const s=At(),t=ls(),n=ct(),{getAllAgents:l}=qn(),{getAllShopifyUrl:i,getCurrentUser:m}=Zt(),{width:r}=Ht(),u=zs(),g=Pa(),y=Fa(),c=jt(),w=As(),f=Ae(),v=Za(),{clearMessagesAndMeta:C,getAllMessages:_}=Yt(),{getAllConversations:A,clearConversationsAndMeta:D,clearConversationsAndMetaSeg:T,getConversationById:B,addDemoConversation:S,getSegmentConversations:E}=ss(),{getNotificationSettings:x}=bo(),{isSmallScreen:P}=hs(),{isOwnerOrAdmin:j}=Xt(),{getContactFormFields:H}=ii(),k=$("all"),M=$(""),V=$(""),Z=b(()=>P.value?he.value:ae.value),ae=b(()=>t.params.id),ce=b(()=>n.allConversations.length),J=b(()=>ce.value&&n.allConversations.every(Ve=>Ve.notVisible===!0)),X=b(()=>{if(!ce.value)return;const{id:Ve}=t.params;return n.allConversations.find(Re=>Re.id===Ve)}),z=b(()=>n.conversationsMeta),q=b(()=>z.value&&z.value.current_page),ue=b(()=>z.value&&z.value.total_pages),pe=b(()=>q.value<ue.value),de=b(()=>he.value?"is-expanded":"is-normal"),he=b(()=>v.isExpandedChatView),ve=b(()=>f.hasFailedPayment),be=b(()=>f.isTrialContainerVisible&&j),re=b(()=>{var Ve;return((Ve=f.user)==null?void 0:Ve.attributes.has_conversations_older_than_month)&&!f.isProUser}),ie=b(()=>({page:q.value===0?1:q.value+1,limit:qi,type:k.value,search:M.value,segment:V.value,keepConversations:[]})),xe=b(()=>{const Ve=ru(n.allConversations,k.value),Re=n.unreadMessageCount;return ee({unreadCount:Re}),Ve}),{list:N,containerProps:L,wrapperProps:me}=kd(xe,{itemHeight:64,overscan:10}),G=b(()=>f.shouldDisplayShopifyInstructionOnChatway),U=b(()=>f.isProductTourRunning||f.showEmailOfflineVisitorModal),R=b(()=>xe.value.find(Ve=>Ve.attributes.contact.email));function ee({unreadCount:Ve=0}){const Re=Ve?`(${Ve} unread)`:"Conversations";Ta({title:Re})}const se=b(()=>f.isProductTourRunning||r.value>=1512||P.value?"":"!w-[370px]"),Y=async(Ve,Re,it=!1)=>{var Ue,Ct;const{id:tt}=t.params;if(tt===Re)return;const{updateConversation:Be}=ss(),at=n.allConversations.find(te=>te.id===Re);(Ue=at==null?void 0:at.attributes)!=null&&Ue.has_unread_reminders&&Be({conversationId:Re,attributes:{...at.attributes,has_unread_reminders:!1}}),n.messageUnreadCount=0,(Ct=n.selectedConversation)!=null&&Ct.id&&(n.selectedConversation.attributes.tags=[],n.selectedConversation.attributes.custom_data=[]),n.chatInputFocus=!0,Ft(()=>n.chatInputFocus=!1),n.latestMessage=null,await C({id:Re}),n.uiFlags.isMessagesLoading=!0,n.currentConversationId=Re,B({id:Re}).then(()=>{_({id:Re,page:1,conversationData:Ve})}),s.push({name:"conversations-view",params:{id:Re},replace:it}).then(()=>{P.value&&(v.isExpandedChatView=!0)})},Fe=async Ve=>{!n.isDemoConversation&&U.value&&(n.uiFlags.isMessagesLoading=!0,B({id:Ve}).then(()=>{_({id:Ve,page:1})}))},oe=()=>{pe.value&&!n.uiFlags.isConversationsLoading&&A(ie.value)},st=async()=>{if(t.name=="conversations-view"&&ce.value&&f.isProductTourRunning){Fe(t.params.id);return}else if(t.name=="conversations-view"&&f.showEmailOfflineVisitorModal&&R.value&&R.value.id!=t.params.id){s.push({name:"conversations-view",params:{id:R.value.id}});return}if(await A({page:1,limit:qi,type:k.value,search:M.value,segment:V.value}),t.name=="conversations"&&f.isProductTourRunning&&!ce.value&&!P.value){S(),s.push({name:"conversations-view",params:{id:xe.value[0].id}});return}if(t.name=="conversations"&&f.isProductTourRunning&&ce.value&&!P.value){s.push({name:"conversations-view",params:{id:xe.value[0].id}});return}else if(t.name=="conversations"&&f.showEmailOfflineVisitorModal&&R.value&&!P.value){s.push({name:"conversations-view",params:{id:R.value.id}});return}const{id:Ve}=t.params;Ve&&(n.uiFlags.isMessagesLoading=!0,B({id:Ve}).then(()=>{_({id:Ve,page:1})}))},Le=Ve=>{s.push({name:"conversations"}),V.value="",c.selectedSegment={id:""},D(),k.value=Ve,A(ie.value)},le=Ve=>{M.value=Ve,c.selectedSegment={id:""},s.push({name:"conversations"}),D(),A(ie.value)},Ie=(Ve,Re=!0,it=[])=>{V.value=Ve,k.value="",Re&&s.push({name:"conversations"}),T(),A({...ie.value,keepConversations:it})},rt=()=>{M.value.length>0&&(M.value="",s.push({name:"conversations"}),D(),A(ie.value))},Et=()=>{v.isExpandedChatView=!he.value},ye=()=>{v.isExpandedChatView=!1},_t=(Ve=!1)=>{const Re=xe.value,it=Re.find(at=>at.id===t.params.id);if(!it&&Re.length){Y(Re[0].attributes,Re[0].id,Ve);return}const tt=Re.findIndex(at=>at.id===t.params.id),Be=Re[tt+1];Be&&Y(it.attributes,Be.id,Ve)},Ce=()=>{const Ve=xe.value,Re=Ve.find(Be=>Be.id===t.params.id);if(!Re&&Ve.length){Y(Ve[0].attributes,Ve[0].id);return}const it=Ve.findIndex(Be=>Be.id===t.params.id),tt=Ve[it-1];tt&&Y(Re.attributes,tt.id)},vt=Ve=>{var it;const Re={conversation_id:Ve,team_id:(it=f.user)==null?void 0:it.attributes.team_id};$e.emit(Me.AGENT_CONVERSATION_VIEWING_SENT,Re,tt=>{ht(tt)})},qe=Ve=>{var it;const Re={conversation_id:Ve,team_id:(it=f.user)==null?void 0:it.attributes.team_id};$e.emit(Me.AGENT_CONVERSATION_VIEWING_STOPPED_SENT,Re,tt=>{ht(tt)})},Je=()=>{ae.value&&qe(ae.value)},ft=()=>{s.push({name:"settings-plans-view"})};return dl(()=>{ae.value&&P.value&&(v.isExpandedChatView=!0)}),$d("activeConversation",X),We(()=>t.params,Ve=>{!Ve.id&&he.value&&(v.isExpandedChatView=!1)}),We([G],([Ve])=>{Ve&&!f.isLoadedOnDudaDashboard&&!yo()&&(f.showShopifyCompleteSetupModal=!0)}),We(()=>t.name,Ve=>{Ve=="conversations-view"&&Fe(t.params.id)}),We(()=>t.params.id,(Ve,Re)=>{Ve!==Re&&(vt(Ve),qe(Re))}),We(()=>t.params.id,(Ve,Re)=>{const it=xe.value.find(tt=>tt.id===Re);it&&(it.attributes.tags=[],it.attributes.custom_data=[],it.messages=[],it.groupedMessages=[])}),ul(L.ref,oe,{distance:10}),Xe(()=>{setTimeout(()=>{f.openInstallationTooltip=!0},1e3),st(),l(),g.getCustomFields(),y.getTags(),c.getSegments(),c.selectedSegment={},w.contact_form.length||H(),u.notificationSettings||x(),f.user||m(),f.isShopifyUser&&i(),window.addEventListener("beforeunload",Je),nt.on("nextConversation",Re=>{_t(Re==null?void 0:Re.removeCurrent)}),nt.on("previousConversation",()=>{Ce()}),nt.on("closeSidePanel",()=>{Et()}),nt.on("fetchSegmentConversation",Re=>{E(Re.segmentId,Re.conversationId)}),nt.on("refreshConversations",()=>{st()}),ae.value&&vt(ae.value),c.segments.find(Re=>Re.type==="segments")&&c.segments.shift(),f.showSkipTourModal=!1}),Ms(()=>{window.removeEventListener("beforeunload",Je),nt.off("nextConversation"),nt.off("previousConversation"),nt.off("closeSidePanel"),nt.off("fetchSegmentConversation"),nt.off("refreshConversations")}),cl((Ve,Re)=>{if(Ve.name!="conversations-view"&&Ve.name!="login"&&ce.value&&(f.isProductTourRunning||f.showSkipTourModal))return!1;Re.params.id&&qe(Re.params.id)}),(Ve,Re)=>{const it=Pe("Loader"),tt=He("svg-inline");return a(),d("div",{class:O(["conversations",{"expanded-chat-view--container":he.value,"conversation-small-screen":p(P)}])},[e("div",{class:O(["chat--listing--container",[{"chat-list-small--screen":p(P),"!h-[96%]":p(P)&&be.value},se.value]])},[e("div",gj,[W(ak,{isSmallScreen:p(P),onChangeFilter:Le,onSearch:le,onCloseSearch:rt,onSegment:Ie},null,8,["isSmallScreen"]),he.value&&!p(P)?(a(),d("div",{key:0,class:"toggle-expanded--view",onClick:Et},[F(e("img",pj,null,512),[[tt]])])):h("",!0),!he.value&&!p(P)?(a(),d("div",{key:1,class:"toggle-expanded--view",onClick:Et},[F(e("img",vj,null,512),[[tt]])])):h("",!0)]),!ce.value||J.value?(a(),d("div",fj,[p(n).uiFlags.isConversationsLoading&&!ce.value?(a(),ne(MP,{key:0})):h("",!0),!p(n).uiFlags.isConversationsLoading&&!ce.value&&M.value.length===0||J.value?(a(),ne(Go,{key:1,text:"No conversations found..",class:"list-empty--state","show-installation-code":p(P)&&k.value!=="resolved"&&k.value!=="starred"&&k.value!=="","has-conversations-older-than-month":re.value},null,8,["show-installation-code","has-conversations-older-than-month"])):h("",!0),M.value.length>0&&!ce.value&&!p(n).uiFlags.isConversationsLoading?(a(),ne(Go,{key:2,src:`${p(De)}illustrations/search.svg`,text:"No results...",class:"list-empty--state"},null,8,["src"])):h("",!0)])):h("",!0),e("div",wi(xi(p(L))),[e("div",wi(xi(p(me))),[(a(!0),d(Se,null,Ne(p(N),({data:Be})=>(a(),d("div",{key:Be.id},[Be.notVisible?h("",!0):(a(),ne(Zk,{key:0,id:Be.id,"conversation-attributes":Be.attributes,onOpenConversation:at=>Y(at,Be.id)},null,8,["id","conversation-attributes","onOpenConversation"]))]))),128))],16),p(n).uiFlags.isConversationsLoading&&pe.value?(a(),ne(it,{key:0,size:"20px"})):h("",!0),ce.value&&!J.value?(a(),d("div",{key:1,class:O(["conversation-loaded--wrap",{"justify-center":!re.value}])},[!pe.value&&!re.value?(a(),d("span",hj,I(Ve.$t("CONVERSATION.LOADED")),1)):h("",!0),!pe.value&&re.value?(a(),d("div",_j,[Re[2]||(Re[2]=e("div",{class:"bg-[#0446DE1A] w-8 h-8 flex items-center p-1.5 rounded-full"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[e("path",{d:"M15.8333 9.1665H4.16667C3.24619 9.1665 2.5 9.9127 2.5 10.8332V16.6665C2.5 17.587 3.24619 18.3332 4.16667 18.3332H15.8333C16.7538 18.3332 17.5 17.587 17.5 16.6665V10.8332C17.5 9.9127 16.7538 9.1665 15.8333 9.1665Z",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M5.83301 9.1665V5.83317C5.83301 4.7281 6.27199 3.66829 7.0534 2.88689C7.8348 2.10549 8.89461 1.6665 9.99968 1.6665C11.1047 1.6665 12.1646 2.10549 12.946 2.88689C13.7274 3.66829 14.1663 4.7281 14.1663 5.83317V9.1665",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),e("div",yj,[Re[1]||(Re[1]=_e(" Free plan includes last 30 days' chat history. ")),p(j)?(a(),d("span",{key:0,class:"inline-flex items-center cursor-pointer",onClick:ft},Re[0]||(Re[0]=[e("span",{class:"text-primary text-xs leading-[1.05rem] font-semibold underline"},"Upgrade for unlimited history",-1),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[e("path",{d:"M4.5 9L7.5 6L4.5 3",stroke:"#0446DE","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):h("",!0)])])):h("",!0)],2)):h("",!0)],16)],2),Z.value?(a(),d("div",{key:0,class:O(["chat--view--container",[de.value,{"chat-view-container--small-screen":p(P)},{"!h-[93%]":p(P)&&be.value&&!ve.value,"!h-[85%]":p(P)&&ve.value}]])},[p(n).uiFlags.isConversationsLoading&&!ce.value?(a(),ne(Go,{key:0,class:O(de.value),text:Ve.$t("CONVERSATION.LOADING")},null,8,["class","text"])):h("",!0),ce.value&&X.value?(a(),ne($P,{key:1,"selected-conversation":X.value,onToggleExpandedView:ye},null,8,["selected-conversation"])):h("",!0)],2)):h("",!0),!ae.value&&!p(P)?(a(),ne(Go,{key:1,showInstallationCode:!0,src:`${p(De)}images/logo-text.svg`,class:O(de.value)},null,8,["src","class"])):h("",!0),!p(P)&&p(f).isProductTourRunning||!p(P)&&p(f).showEmailOfflineVisitorModal&&R.value?(a(),d("div",bj)):h("",!0)],2)}}});const Hi=Oe(wj,[["__scopeId","data-v-d00a0a33"]]),xj="/assets/keyboard-0418a158.svg",Cj="/assets/arrow-down-solid-63ac3b90.svg",kj="/assets/check-green-9566e014.svg",$j={class:"settings-header"},Sj={class:"settings-header--left"},Tj={key:0,class:"settings-dropdown--wrap"},Mj={class:"settings-dropdown"},Aj=["onClick"],Ej={key:0},Dj={src:Ol,alt:""},Ij={key:1},Fj={src:Vl,alt:""},Pj={key:2},jj={src:Ul,alt:""},Lj={key:3},Rj={src:er,alt:""},Bj={key:4},Nj={class:"w-4 h-4",src:Nl,alt:""},Oj={key:5,class:"text-primary"},Vj={src:Gl,alt:""},Uj={key:6},Gj={src:Wl,alt:""},Wj={key:7},qj={src:xj,alt:""},Hj={class:"title max-w-[300px] md:max-w-full break-words"},zj={key:0},Kj={src:Cj,alt:""},Yj={key:1,class:"label ml-4 md:ml-0"},Zj={src:kj,alt:""},Jj={class:"flex items-center gap-3"},Qj={class:"settings-header--right"},Xj={key:0,class:"action-buttons--wrap"},eL={class:"w-4 h-4 [&>path]:stroke-primary",src:So,alt:"help center"},tL={key:1,class:"w-[0.0625rem] h-6 rounded-[1.5rem] bg-grey200"},sL=["disabled"],aL=["disabled"],oL=["disabled"],nL=fe({__name:"SettingsHeader",props:{type:{default:""},title:{default:""},label:{default:""},actionButtonTypeOneText:{default:""},actionButtonTypeTwoText:{default:""},actionButtonTypeThreeText:{},isActionButtonOneDisabled:{type:Boolean},isActionButtonTwoDisabled:{type:Boolean,default:!1},isActionButtonThreeDisabled:{type:Boolean},isLoading:{type:Boolean},isProFeature:{type:Boolean},upgradeText:{default:"Upgrade Now"},showSupportButton:{type:Boolean,default:!1}},emits:["actionButtonTypeOne","actionButtonTypeTwo","actionButtonTypeThree"],setup(o,{emit:s}){const{isSmallScreen:t}=hs(),n=o,{isOwnerOrAdmin:l}=Xt(),i=At(),m=ls(),r=Ae(),u=$(!1),g=$(n.type),y=m.name,c=()=>{g.value||(u.value=!u.value)},w=()=>{u.value=!1},f=x=>{i.push({name:x.route})},v=()=>{i.push("/plans")},C=$([{key:"widget",route:"settings-design-view",name:"Widget Settings"},{key:"code",route:"settings-code-view",name:"Installation"},{key:"profile",route:"settings-profile-view",name:"Profile"},{key:"agents",route:"settings-agents-view",name:"Agents"},{key:"notifications",route:"settings-notification-view",name:"Notifications"}]),_=s,A=b(()=>r.isProUserOrTrial),D=()=>{_("actionButtonTypeOne")},T=()=>{_("actionButtonTypeTwo")},B=()=>{_("actionButtonTypeThree")},S=x=>{x.key!=="Enter"||n.isLoading||m.name=="settings-agents-view"||m.name=="settings-design-view"||m.name==="settings-plans-view"||m.name==="settings-profile-view"||T()},E=()=>{var x;(x=window.$chatway)==null||x.openChatwayWidget()};return Xe(()=>{l&&(C.value.push({key:"integrations",route:"settings-integration-view",name:"Integrations & Apps"}),C.value.splice(3,0,{key:"plans",route:"settings-plans-view",name:"Plans & Billing"})),window.addEventListener("keypress",S)}),ps(()=>{window.removeEventListener("keypress",S)}),(x,P)=>{const j=Pe("Loader"),H=He("svg-inline");return a(),d("div",$j,[e("div",Sj,[W(Zl),p(t)&&u.value?(a(),d("div",Tj,[F((a(),d("div",Mj,[(a(!0),d(Se,null,Ne(C.value,k=>(a(),d("div",{class:O(["dropdown-item",{"is-active":k.route===p(y)}]),key:k.name,onClick:M=>f(k)},[k.key==="profile"?(a(),d("div",Ej,[F(e("img",Dj,null,512),[[H]])])):h("",!0),k.key==="agents"?(a(),d("div",Ij,[F(e("img",Fj,null,512),[[H]])])):h("",!0),k.key==="plans"?(a(),d("div",Pj,[F(e("img",jj,null,512),[[H]])])):h("",!0),k.key==="widget"?(a(),d("div",Lj,[F(e("img",Rj,null,512),[[H]])])):h("",!0),k.key==="code"?(a(),d("div",Bj,[F(e("img",Nj,null,512),[[H]])])):h("",!0),k.key==="notifications"?(a(),d("div",Oj,[F(e("img",Vj,null,512),[[H]])])):h("",!0),k.key==="integrations"?(a(),d("div",Uj,[F(e("img",Gj,null,512),[[H]])])):h("",!0),k.key==="keyboard-shortcuts"?(a(),d("div",Wj,[F(e("img",qj,null,512),[[H]])])):h("",!0),e("span",null,I(k.name),1)],10,Aj))),128))])),[[p(Is),w]])])):h("",!0),e("div",{class:"header-title",onClick:c},[e("h3",Hj,I(x.title),1),p(t)&&!g.value?(a(),d("div",zj,[F(e("img",Kj,null,512),[[H]])])):h("",!0)]),x.label?(a(),d("span",Yj,[F(e("img",Zj,null,512),[[H]]),_e(" "+I(x.label),1)])):h("",!0)]),e("div",Jj,[Ss(x.$slots,"extraHeaderContent",{},void 0,!0),e("div",Qj,[!A.value&&!x.isProFeature||A.value&&x.isProFeature||A.value&&!x.isProFeature?(a(),d("div",Xj,[x.showSupportButton?(a(),d("button",{key:0,class:"!bg-[#F3F9FF] py-1.5 px-2 flex items-center justify-center gap-1 rounded h-auto md:!h-8 text-sm leading-leading400 text-primary",onClick:E},[F(e("img",eL,null,512),[[H]]),P[0]||(P[0]=_e(" Contact Support "))])):h("",!0),x.showSupportButton?(a(),d("div",tL)):h("",!0),x.actionButtonTypeOneText?(a(),d("button",{key:2,class:"action-button-type--one action-button h-auto md:!h-8",disabled:x.isActionButtonOneDisabled,onClick:D},I(x.actionButtonTypeOneText),9,sL)):h("",!0),x.actionButtonTypeThreeText?(a(),d("button",{key:3,disabled:x.isLoading||x.isActionButtonThreeDisabled,class:"action-button-type--one action-button h-auto md:!h-8",onClick:B},[x.isLoading?(a(),ne(j,{key:0,size:"15px",style:{"margin-right":"5px"}})):h("",!0),_e(" "+I(x.actionButtonTypeThreeText),1)],8,aL)):h("",!0),x.actionButtonTypeTwoText?(a(),d("button",{key:4,disabled:x.isLoading||x.isActionButtonTwoDisabled,class:"action-button-type--two action-button h-auto md:!h-8",onClick:T},[x.isLoading?(a(),ne(j,{key:0,size:"15px",style:{"margin-right":"5px"}})):h("",!0),_e(" "+I(x.actionButtonTypeTwoText),1)],8,oL)):h("",!0)])):h("",!0),!A.value&&x.isProFeature?(a(),d("button",{key:1,onClick:v,class:"flex justify-center items-center text-grey900 upgrade-now-btn-bg text-sm h-8 py-1.5 px-2 gap-2"},[P[1]||(P[1]=e("img",{src:xo,alt:"crown icon"},null,-1)),_e(" "+I(x.upgradeText),1)])):h("",!0)])])])}}});const iL=Oe(nL,[["__scopeId","data-v-d6ecfa9c"]]),lL="/assets/dark-eye-e4a79897.svg",rL="/assets/emoji-850d6aa3.svg",dL="/assets/attachment-727771c4.svg",uL="/assets/close-onb-a578bfd9.svg";const cL={class:""},mL={class:"h-7 justify-start items-start gap-2 inline-flex mb-4"},gL={key:0,class:"text-xs text-grey600 text-center my-auto"},pL={key:0,class:"text-xs text-grey600"},vL={key:1,class:"close-icon"},fL={key:2,class:"flex flex-col items-center"},hL={class:"flex relative w-fit items-center mt-3 mb-2"},_L=["src"],yL={key:0,class:"rounded-lg overflow-hidden mb-4"},bL={class:"rounded-b-lg bg-white divide-y"},wL=["onClick"],xL=["innerHTML"],CL={key:1,class:"message-bubble mb-[17px]"},kL=["src"],$L={class:"bubble"},SL={key:2,class:"flex justify-end"},TL={class:""},ML={key:3,class:"message-bubble"},AL=["src"],EL={class:"bubble w-full"},DL={class:"mt-2 pb-1 space-y-2.5"},IL={key:0,class:"text-[#FF4545] text-[11px]"},FL={key:0,class:"text-[#FF4545] text-[11px]"},PL={key:1,class:"flex items-center"},jL={class:"flex justify-end pt-0.5"},LL={key:4,class:"message-bubble"},RL=["src"],BL={key:5,class:"flex justify-end"},NL={class:""},OL=["placeholder"],VL={class:"input-action"},UL={class:"svg-icon"},GL={class:"w-4 h-4",src:rL,alt:""},WL={class:"svg-icon"},qL={class:"w-4 h-4",src:dL,alt:""},HL=["disabled"],zL={class:"w-4 h-4",src:ni,alt:""},KL=["src"],YL={src:uL},ZL={class:"allAgents relative"},JL={class:"flex relative w-fit items-center"},QL=["src"],XL={class:"pending-message"},eR=["src"],tR={key:1},sR=["src"],aR=fe({__name:"WidgetPreview",props:{activeWidget:{},activeWidgetColor:{},activeWidgetBubbleKey:{},activeWidgetStateKey:{},activeWidgetEffectKey:{},activeWidgetPositionKey:{},pendingTextMessage:{},thumbnailList:{},bubblePosition:{},widgetPosition:{},previewBubblePosition:{},previewWidgetPosition:{},previewWidgetHeight:{},pendingMessage:{type:Boolean},previewTextBubble:{type:Boolean},isWelcomeTextEnabled:{type:Boolean},widgetBubbleSize:{},customWidgetBubbleSrc:{},showCustom:{type:Boolean},previousWidgetBubbleKey:{},showPreviewToggle:{type:Boolean,default:!0},showUserMessage:{type:Boolean,default:!0},canClose:{type:Boolean,default:!0},contact_fields:{},defaultLanguage:{},headerFontColor:{},avatarBorderColor:{},chatBubbleColor:{},chatFontColor:{},closeIconColor:{},systemMessageIcon:{default:"system-base"},showPreviewHeader:{type:Boolean,default:!0},previewContainerHeight:{},isRemoveChatwayBranding:{type:Boolean},isFaqPreview:{type:Boolean},faqs:{},isFaqEnabled:{type:Boolean}},emits:["closeWidgetPreview","toggleWidgetPreview","closePreviewBubble"],setup(o,{emit:s}){const t=o,n=At(),l=As(),i=ys(),m=Ae(),{height:r,width:u}=Ht(),g=Es(),{getAllAgents:y}=qn(),c=s,w=$(""),f=$(!1),v=$(""),C=$(),_=$(),A=$(null),D=$("slide-left"),T=$(!1),B=$({country_dialing_code:""}),S="https://files-cdn.chatway.app/assets/images/system-male.png",E=b(()=>{var le;if(i.agents.length>0){if(i.agents.length===1&&!i.agents[0].attributes.profile_photo_url)return[S];const Ie=i.agents.filter(rt=>rt.attributes.profile_photo_url).slice(0,3).map(rt=>rt.attributes.profile_photo_url);return Ie.length>0?Ie:[S]}return(le=m.user)!=null&&le.attributes.profile_photo_url?[m.user.attributes.profile_photo_url]:[S]}),x=b(()=>Ds(q.value.write_your_message)),P=b(()=>Ds(q.value.team_here)),j=b(()=>t.pendingTextMessage?Ds(t.pendingTextMessage):!1),H=b(()=>l.hidePreviewTextPreview),k=b(()=>{var le;return(le=t.contact_fields)==null?void 0:le.find(Ie=>Ie.field_name=="name")}),M=b(()=>{var le;return(le=t.contact_fields)==null?void 0:le.find(Ie=>Ie.field_name=="email")}),V=b(()=>{var le;return(le=t.contact_fields)==null?void 0:le.find(Ie=>Ie.field_name=="phone")}),Z=b(()=>{var le;return!!((le=t.contact_fields)!=null&&le.filter(Ie=>Ie.is_required).length)}),ae=b(()=>{var le;return!!((le=t.contact_fields)!=null&&le.filter(Ie=>Ie.is_visible).length)}),ce=b(()=>{var le;return{width:t.widgetBubbleSize,height:t.widgetBubbleSize,background:(le=t.activeWidgetColor)==null?void 0:le.hex,padding:"2px"}}),J=b(()=>({padding:"12%",width:"100%"})),X=b(()=>({padding:"24%",width:"100%"})),z=b(()=>{var le;return{background:(le=t.activeWidgetColor)==null?void 0:le.hex}}),q=b(()=>t.defaultLanguage?t.defaultLanguage:{team_here:"Our team is here for you",write_your_message:"Write your message...",initiate_chat_with_details:"Initiate chat by sharing details",provide_details_notified:"Provide your details to get notified",team_online:"Please add your email to get notified when we reply",name:"Name",email:"Email",phone_number:"Phone Number",start_chatting:"Start Chatting",submit:"Submit"}),ue=b(()=>{switch(t.systemMessageIcon){case"system-base":return`${De}images/system-base.png`;case"system-smile":return`${De}images/system-smile.png`;case"system-robot":return`${De}images/system-robot.png`;case"system-male":return`${De}images/system-male.png`;case"system-female":return`${De}images/system-female.png`;default:return t.systemMessageIcon}}),pe=b(()=>n.currentRoute.value.name==="onboarding-widget"),de=b(()=>l.showFullScreen),he=b(()=>l.widgetOnlineState),ve=b(()=>{var le;if(de.value)return{height:"auto"};{const Ie=Number((le=t.widgetBubbleSize)==null?void 0:le.slice(0,-2)),rt=Ie<69?30:Ie>69&&Ie<84?40:Ie>83&&Ie<94?50:Ie>93&&Ie<104?60:Ie/2+30;return{height:t.previewContainerHeight?`${t.previewContainerHeight-rt}px`:"100%"}}}),be=b(()=>{if(!t.previewContainerHeight&&t.showPreviewHeader||t.showPreviewHeader&&!ae.value)return{maxHeight:"inherit"};if(!t.previewContainerHeight&&!t.showPreviewHeader)return{maxHeight:"330px"};let le=Z.value&&r.value>750?Number(t.previewContainerHeight)+30:Z.value&&r.value<751?Number(t.previewContainerHeight)-70:Number(t.previewContainerHeight)-200;return le=t.isRemoveChatwayBranding?le+30:le,he.value==="online"&&ae.value&&!de.value&&!t.isFaqEnabled?{maxHeight:le>340?"340px":le+"px"}:he.value==="offline"&&ae.value&&!de.value&&!t.isFaqEnabled?{maxHeight:le>380?"380px":le+"px"}:he.value==="online"&&ae.value&&!de.value&&t.isFaqEnabled?{maxHeight:le>340?"340px":le+"px"}:he.value==="offline"&&ae.value&&!de.value&&t.isFaqEnabled?{maxHeight:le>380?"380px":le+"px"}:{maxHeight:"500px"}}),re=b(()=>{const le=he.value==="online"?152:53;return{height:`${t.previewWidgetHeight>le?t.previewWidgetHeight-le:t.previewWidgetHeight}px`}}),ie=b(()=>{const le=t.previewWidgetPosition,Ie=t.previewWidgetPosition&&de.value?t.previewWidgetPosition:t.previewWidgetPosition&&!de.value?{justifyContent:le.justifyContent}:{};return t.previewWidgetHeight?{...Ie,height:t.previewWidgetHeight+"px !important",maxHeight:de.value?t.previewWidgetHeight+"px":"500px",position:de.value?"absolute":"relative"}:!t.previewContainerHeight&&!t.showPreviewHeader?{...Ie,height:"600px",maxHeight:"500px",position:de.value?"absolute":"relative"}:Z.value&&!de.value?{...Ie,height:t.previewContainerHeight&&t.previewContainerHeight>600?"600px":t.previewContainerHeight+"px",maxHeight:"500px",position:de.value?"absolute":"relative"}:!de.value&&t.showPreviewHeader?{...Ie,height:t.previewContainerHeight&&t.previewContainerHeight>600?"600px":Number(t.previewContainerHeight)-30+"px",maxHeight:"500px",position:de.value?"absolute":"relative"}:Ie}),xe=b(()=>{const le=g.countries.map(Ie=>({...Ie,customizedLabel:`${Ie.emoji}`,name:`${Ie.emoji} ${Ie.name} (${Ie.phoneCode})`}));return le.unshift({id:1,name:"None",customizedLabel:"None",code:"none",image:"",emoji:"",phoneCode:"none"}),le}),N=le=>{l.widgetOnlineState=le},L=()=>{f.value=!1,l.hidePreviewTextPreview=!1,c("closeWidgetPreview",f.value)},me=()=>{l.showFullScreen=!0},G=()=>{v.value="",f.value=!f.value,f.value&&(v.value=""),c("toggleWidgetPreview",f.value)},U=()=>{l.hidePreviewTextPreview=!0},R=()=>{t.activeWidgetStateKey==="hover"&&(f.value=!0)},ee=()=>{f.value=t.activeWidgetStateKey==="opened"},se=le=>{switch(le){case"chat-base":return`${De}images/chat-base.svg`;case"chat-smile":return`${De}images/chat-smile-update.svg`;case"chat-bubble":return`${De}images/chat-bubble.svg`;case"chat-db":return`${De}images/chat-db.svg`;default:return new URL("",import.meta.url).href}},Y=()=>(v.value="",t.activeWidgetEffectKey&&t.activeWidgetStateKey==="click"?v.value=`${t.activeWidgetEffectKey}-effect`:v.value=""),Fe=le=>{switch(le){case"name":return q.value.name;case"email":return q.value.email;default:return q.value.phone_number}},oe=le=>{D.value=x.value?"slide-left":"slide-right",A.value=le},st=()=>{D.value=x.value?"slide-right":"slide-left",A.value=null},Le=()=>{var Ie;const le=(Ie=t.contact_fields)==null?void 0:Ie.find(rt=>rt.field_name=="phone");if(le&&le.is_enabled_country_code_format){const rt=xe.value.find(Et=>Et.code.includes(le.country_dialing_code));rt&&V.value&&(B.value.country_dialing_code=rt.code)}};return We(()=>t.systemMessageIcon,()=>{f.value||G()}),We(()=>[u.value,r.value],()=>{var le;_.value=(le=C.value)==null?void 0:le.offsetHeight}),We(()=>f.value,()=>{f.value&&Ft(()=>{var le;_.value=(le=C.value)==null?void 0:le.offsetHeight})}),We(()=>t.contact_fields,()=>{Ft(()=>{Le()})},{deep:!0}),dl(()=>{ee(),Y()}),Xe(()=>{Le(),y()}),(le,Ie)=>{var Et,ye,_t,Ce,vt,qe,Je,ft,Ve,Re,it,tt,Be,at;const rt=He("svg-inline");return a(),d(Se,null,[e("div",cL,[le.showPreviewHeader&&!de.value?(a(),d("div",{key:0,class:O(["absolut left-[-32px]",[!pe.value&&p(u)>699&&p(r)<=900&&((Et=le.contact_fields)!=null&&Et.length)?"top-[200px]":!pe.value&&!(p(u)>699&&p(r)<=900&&((ye=le.contact_fields)!=null&&ye.length))?"top-[-120px]":"top-4"]])},[e("div",mL,[e("div",{onClick:Ie[0]||(Ie[0]=Ue=>N("online")),class:O(["px-[22px] h-7 whitespace-nowrap py-1 rounded-md justify-start items-center gap-2 flex",[he.value==="online"?"bg-white":"cursor-pointer bg-[rgba(207,207,211,0.20)] hover:bg-[rgba(207,207,211,0.40)]"]])},[e("div",{class:O(["w-2 h-2 rounded-full",[he.value==="online"?"bg-green-400 shadow-[0_2px_4px_rgba(68,224,84,0.4)]":"bg-grey600/40  hover:bg-[rgba(207,207,211,0.40)]"]])},null,2),e("div",{class:O(["text-sm font-normal leading-tight",[he.value==="online"?"text-grey900":"text-grey600"]])},"Online state",2)],2),e("div",{onClick:Ie[1]||(Ie[1]=Ue=>N("offline")),class:O(["px-[22px] h-7 whitespace-nowrap py-1 rounded-md justify-start items-center gap-2 flex",[he.value==="offline"?"bg-white":"cursor-pointer bg-[rgba(207,207,211,0.20)] hover:bg-[rgba(207,207,211,0.40)]"]])},[e("div",{class:O(["w-2 h-2 rounded-full",[he.value==="offline"?"bg-red-500 shadow-[0_2px_4px_rgba(255,69,69,0.4)]":"bg-grey600/40 hover:bg-[rgba(207,207,211,0.40)]"]])},null,2),e("div",{class:O(["text-sm font-normal leading-tight",[he.value==="offline"?"text-grey900":"text-grey600"]])},"Offline state",2)],2),Ie[7]||(Ie[7]=e("div",{class:"w-[0.0625rem] h-7 rounded-[6.25rem] bg-grey200"},null,-1)),e("div",{onClick:me,class:"flex items-center justify-center w-12 h-7 rounded-md bg-[#CFCFD3]/20 hover:bg-[#CFCFD3]/40 py-[0.38rem] px-4 cursor-pointer"},Ie[6]||(Ie[6]=[e("img",{src:lL,alt:"preview"},null,-1)]))])],2)):h("",!0)]),e("div",null,[e("div",{class:O(["mx-auto",[{"border border-dashed border-[#00000029] rounded-xl":!f.value&&!de.value,"max-h-[500px] flex flex-col justify-end w-[18.57rem]":!de.value}]]),style:lt(ve.value)},[!f.value&&!de.value?(a(),d("p",gL,[Ie[8]||(Ie[8]=_e(" Widget closed ")),le.previewTextBubble?(a(),d("span",pL,"+ Preview bubble enabled")):h("",!0)])):h("",!0),f.value?(a(),d("div",{key:1,class:O([[{"w-[400px] max-w-[400px]":de.value,"!w-full !max-w-full":p(u)<600,"!h-full":de.value&&p(r)<800,"!max-h-[704px] !h-[704px]":de.value&&p(r)>800&&p(u)>=600,"!max-h-full !h-screen":de.value&&p(u)<600}],"preview-wrap"]),style:lt(ie.value)},[e("div",{class:O(["preview-header",[he.value==="online"?"h-[152px]":"h-[53.47px]",{"!rounded-none":de.value&&p(u)<600,"py-6 px-4":de.value}]]),style:lt({background:(_t=le.activeWidgetColor)==null?void 0:_t.color})},[le.canClose?(a(),d("div",{key:0,class:"close-icon",onClick:L},[W(Jo,{class:O({"w-5 h-5":de.value}),style:lt({color:le.closeIconColor})},null,8,["class","style"])])):(a(),d("div",vL,[W(Jo,{class:O(["text-white",{"w-5 h-5":de.value}])},null,8,["class"])])),he.value==="online"?(a(),d("div",fL,[e("span",{class:O(["title mt-2",{rtl:P.value,"!text-[1.1rem]":de.value}]),style:lt({color:le.headerFontColor})},I(q.value.team_here),7),e("div",hL,[(a(!0),d(Se,null,Ne(E.value,Ue=>(a(),d("div",{key:Ue,class:"rounded-full p-0.5 first:ml-0 -ml-2",style:lt({background:le.avatarBorderColor})},[e("img",{src:Ue,alt:"agent",class:"imageShadow w-9 h-9 rounded-full"},null,8,_L)],4))),128))])])):(a(),d("div",{key:3,class:O(["text-center text-white text-sm font-normal leading-tight",{rtl:P.value,"!text-[1.1rem]":de.value}]),style:lt({color:le.headerFontColor})},I(le.defaultLanguage.away),7))],6),e("div",{ref_key:"previewItem",ref:C,class:O(["preview-body",[{"!rounded-none":de.value&&p(u)<600,"max-h-[65vh]":de.value&&p(r)<600&&p(u)>=600&&he.value==="offline"}]]),style:lt(re.value)},[e("div",{style:lt(be.value),class:O(["preview-content overflow-y-auto",[{"h-[65vh]":de.value&&p(r)<800&&p(u)>=600}]])},[le.isFaqEnabled&&((Ce=le.faqs)!=null&&Ce.length)?(a(),d("div",yL,[W(ms,{name:D.value,mode:"out-in"},{default:K(()=>[A.value?A.value?(a(),d("div",{key:1,class:O(["bg-white divide-y-[0.67px] divide-grey200",{rtl:x.value}])},[e("div",{class:O(["flex items-center gap-1 cursor-pointer",de.value?"p-4":"p-[10.85px]"]),onClick:Qe(st,["prevent"])},[e("img",{class:O(["shrink-0 w-2.5 h-2.5",{"rotate-[180deg]":x.value}]),src:ws,alt:"icon"},null,2),e("div",{class:O(["flex-1 text-grey900 leading-leading400 line-clamp-2",de.value?"text-sm":"text-[9.85px]"])},I(A.value.question),3)],2),e("div",{class:O(["prose prose-p:m-0 prose-p:text-[9.85px] prose-p:text-grey900 prose-p:font-[Poppins] prose-img:my-2 prose-img:rounded prose-a:text-primary prose-ul:mt-0 prose-ol:mt-0 prose-li:m-0",de.value?"prose-p:text-sm p-4":"prose-p:text-[9.85px] p-[10.85px]"]),innerHTML:A.value.answer},null,10,xL)],2)):h("",!0):(a(),d("div",{key:0,class:O({rtl:x.value})},[e("div",{class:O(["text-grey900 font-semibold leading-leading400 bg-grey200",de.value?"text-base p-4":"text-[8.13px] p-[10.85px]"])},I(q.value.faq),3),e("div",bL,[(a(!0),d(Se,null,Ne(le.faqs,Ue=>(a(),d("div",{key:Ue.id,class:O(["flex items-center cursor-pointer",de.value?"p-4":"p-[10.85px]"]),onClick:Qe(Ct=>oe(Ue),["prevent"])},[e("div",{class:O(["flex-1 text-grey900 leading-leading400 line-clamp-2",de.value?"text-sm":"text-[9.85px]"])},I(Ue.question),3),e("img",{class:O(["shrink-0 w-2.5 h-2.5 rotate-[270deg]",{"rotate-[90deg]":x.value}]),src:Tt,alt:"icon"},null,2)],10,wL))),128))])],2))]),_:1},8,["name"])])):h("",!0),le.isWelcomeTextEnabled&&((vt=le.pendingTextMessage)!=null&&vt.length)&&T.value||le.isWelcomeTextEnabled&&((qe=le.pendingTextMessage)!=null&&qe.length)&&!le.isFaqEnabled&&!le.isFaqPreview?(a(),d("div",CL,[e("img",{src:ue.value,alt:"user",class:"w-6 h-6 object-cover rounded-full"},null,8,kL),e("div",$L,[e("p",{class:O(["message",{rtl:j.value,"!text-sm":de.value}])},I(le.pendingTextMessage),3)])])):h("",!0),!Z.value&&T.value||!Z.value&&!le.isFaqEnabled&&!le.isFaqPreview?(a(),d("div",SL,[le.showUserMessage?(a(),d("div",{key:0,class:"user-msg mb-[17px]",style:lt({background:le.chatBubbleColor})},[e("div",TL,[e("p",{class:O(["text",{"!text-xs":!de.value}]),style:lt({color:le.chatFontColor})},"Hi, I need help please",6),e("p",{class:"time",style:lt({color:le.chatFontColor,opacity:"80%"})},I(p(cs)(new Date,"h:mm A").value),5)])],4)):h("",!0)])):h("",!0),Z.value||ae.value&&!le.isFaqEnabled||T.value&&((Je=k.value)!=null&&Je.is_visible)||T.value&&((ft=V.value)!=null&&ft.is_visible)||(Ve=M.value)!=null&&Ve.is_visible&&((Re=M.value)!=null&&Re.is_required)?(a(),d("div",ML,[e("img",{src:ue.value,alt:"bot",class:"w-6 h-6 object-cover rounded-full"},null,8,AL),e("div",EL,[Z.value?(a(),d("p",{key:0,class:O(["message text-start text-[11px]",{rtl:x.value,"!text-sm":de.value}])},I(q.value.initiate_chat_with_details),3)):(a(),d("p",{key:1,class:O(["message text-start",{rtl:x.value,"!text-sm":de.value}])},I(q.value.provide_details_notified),3)),e("div",DL,[(a(!0),d(Se,null,Ne(le.contact_fields,Ue=>(a(),d(Se,null,[Ue.is_visible&&Ue.field_name!=="phone"?(a(),d("div",{key:Ue.field_name,class:O({rtl:x.value})},[e("div",{class:O(["text-[11px] font-normal text-[#777]",{"text-sm":de.value}])},[_e(I(Fe(Ue.field_name))+" ",1),Ue.is_required?(a(),d("span",IL,"*")):h("",!0)],2),Ie[9]||(Ie[9]=e("input",{class:"email-input",type:"text"},null,-1))],2)):h("",!0),Ue.is_visible&&Ue.field_name==="phone"?(a(),d("div",{key:Ue.field_name,class:O({rtl:x.value})},[e("div",{class:O(["text-[11px] font-normal text-[#777]",{"text-sm":de.value}])},[_e(I(Fe(Ue.field_name))+" ",1),Ue.is_required?(a(),d("span",FL,"*")):h("",!0)],2),Ue.is_enabled_country_code_format&&V.value&&de.value?(a(),ne(p(Sd),{key:0,mode:"international",defaultCountry:Ue.country_dialing_code!=="none"?Ue.country_dialing_code:"",validCharactersOnly:!0,enabledCountryCode:!0,dropdownOptions:{showFlags:!0,showDialCodeInList:!0,disabledDialCode:!1,disabledFetchingCountry:!1,disabled:!1,showSearchBox:!0,searchBoxPlaceholder:"Search for country"},inputOptions:{showDialCode:!0}},null,8,["defaultCountry"])):h("",!0),!de.value||de.value&&!Ue.is_enabled_country_code_format?(a(),d("div",PL,[Ue.is_enabled_country_code_format&&V.value?(a(),ne(ga,{key:0,items:xe.value,bindValue:"code",showPhoneCustomizedLabel:!0,modelValue:B.value.country_dialing_code,"onUpdate:modelValue":Ie[2]||(Ie[2]=Ct=>B.value.country_dialing_code=Ct),class:"!mb-0 !w-[75px]",classes:`!p-1 ${Ue.is_enabled_country_code_format?"!rounded-br-none !rounded-tr-none":""}`,readOnly:!0,listWidth:de.value?"!w-[20rem]":"!w-[14rem]",disabled:!de.value},null,8,["items","modelValue","classes","listWidth","disabled"])):h("",!0),e("input",{class:O(`email-input ${Ue.is_enabled_country_code_format?"!rounded-bl-none !rounded-tl-none":""} `),type:"text"},null,2)])):h("",!0)],2)):h("",!0)],64))),256)),e("div",jL,[e("button",{onClick:Ie[3]||(Ie[3]=Ue=>T.value=!0),type:"button",class:O(["send-button text-white text-[11px]",{"!text-sm":de.value}])},I(Z.value?q.value.start_chatting:q.value.submit),3)])])])])):h("",!0),!((it=k.value)!=null&&it.is_visible)&&!((tt=V.value)!=null&&tt.is_visible)&&((Be=M.value)!=null&&Be.is_visible)&&!((at=M.value)!=null&&at.is_required)?(a(),d("div",LL,[e("img",{src:ue.value,alt:"bot",class:"w-6 h-6 object-cover rounded-full"},null,8,RL),e("div",{class:O(["bubble",{rtl:x.value}])},[e("p",{class:O(["message text-start",[{"!text-sm":de.value}]])},I(q.value.team_online),3),e("div",{class:O(["text-[11px] font-normal text-[#777] mt-2",{"text-sm":de.value}])},I(Fe("email")),3),Ie[10]||(Ie[10]=e("div",{class:"flex items-center gap-1.5 pb-1"},[e("input",{class:"email-input",type:"email"}),e("button",{class:"send-button"},[e("img",{class:"w-4 h-4",src:ni,alt:""})])],-1))],2)])):h("",!0),Z.value&&T.value||Z.value&&!le.isFaqEnabled&&!le.isFaqPreview?(a(),d("div",BL,[le.showUserMessage?(a(),d("div",{key:0,class:"user-msg mt-[17px]",style:lt({background:le.chatBubbleColor})},[e("div",NL,[e("p",{class:"text",style:lt({color:le.chatFontColor})},"Hi, I need help please",4),e("p",{class:"time",style:lt({color:le.chatFontColor,opacity:"80%"})},I(p(cs)(new Date,"h:mm A").value),5)])],4)):h("",!0)])):h("",!0)],6),e("div",{class:O(["preview-footer",[{"!h-auto":de.value,"!h-10":le.isRemoveChatwayBranding||Z.value&&!T.value}]])},[le.isFaqEnabled&&!T.value&&!Z.value?(a(),d("button",{key:0,onClick:Ie[4]||(Ie[4]=Ue=>T.value=!0),class:"flex justify-center w-full bg-grey900 text-white"},"Chat")):h("",!0),!Z.value&&T.value||!Z.value&&!le.isFaqEnabled||T.value?(a(),d("div",{key:1,class:O(["input-wrap",{rtl:x.value,"py-[0.7rem] px-2":de.value}])},[F(e("input",{"onUpdate:modelValue":Ie[5]||(Ie[5]=Ue=>w.value=Ue),type:"text",placeholder:q.value.write_your_message,class:O(["placeholder-[#282d3e]",{rtl:p(Ds)(w.value.charAt(0)),"placeholder:!text-sm":de.value}])},null,10,OL),[[bt,w.value]]),e("div",VL,[e("div",UL,[F(e("img",GL,null,512),[[rt]])]),e("div",WL,[F(e("img",qL,null,512),[[rt]])]),e("button",{style:lt(z.value),class:"send-button",disabled:w.value.length==0},[F(e("img",zL,null,512),[[rt]])],12,HL)])],2)):h("",!0),le.isRemoveChatwayBranding?h("",!0):(a(),d("span",{key:2,class:O(["powered-label mt-2",[{"py-2 px-4":de.value}]])},[e("img",{src:`${p(De)}images/powered-by.svg`,alt:""},null,8,KL)],2))],2)],6)],6)):h("",!0),!f.value&&le.previewTextBubble&&!H.value&&he.value==="online"?(a(),d("div",{key:2,class:"pending-text--section",style:lt(de.value?le.previewBubblePosition:{justifyContent:le.previewBubblePosition.justifyContent})},[e("div",{class:O(["pending-message--wrap",{rtl:j.value}])},[e("div",{class:"close-pending--bubble",style:lt(j.value?"left: 4px":"right: 4px"),onClick:U},[F(e("img",YL,null,512),[[rt]])],4),e("div",ZL,[e("div",JL,[(a(!0),d(Se,null,Ne(E.value,Ue=>(a(),d("img",{key:Ue,src:Ue,alt:"agent",class:O(["imageShadow w-8 h-8 rounded-full -ml-2 border-[1.5px] border-solid",{"first:ml-0":!j.value}]),style:lt({borderColor:le.avatarBorderColor})},null,14,QL))),128)),e("span",{class:"absolute w-2.5 h-2.5 bg-[#5be179] rounded-full bottom-0.5 -right-1 border-[1.5px] border-solid",style:lt({borderColor:le.avatarBorderColor})},null,4)])]),e("span",XL,I(le.pendingTextMessage),1)],2)],4)):h("",!0)],6),le.showPreviewToggle?(a(),d("div",{key:0,class:O(["bubble-preview--toggle mx-auto mt-2",[{"w-[18.57rem]":!de.value}]]),style:lt(de.value?le.bubblePosition:{justifyContent:le.bubblePosition.justifyContent})},[e("div",{class:O(["bubble-preview",v.value]),onClick:G,onMouseenter:R},[le.activeWidgetBubbleKey==="chat-image"&&le.customWidgetBubbleSrc?(a(),d("div",{key:0,style:lt(ce.value),class:"icon-preview"},[W(ms,{name:"fade",mode:"out-in"},{default:K(()=>[f.value?(a(),d("img",{key:1,src:Rn,class:"p-[12%]",style:lt(X.value)},null,4)):(a(),d("img",{key:0,src:le.customWidgetBubbleSrc,class:"chat-image"},null,8,eR))]),_:1})],4)):(a(),d("div",tR,[e("div",{style:lt(ce.value),class:"icon-preview"},[W(ms,{name:"fade",mode:"out-in"},{default:K(()=>[f.value?(a(),d("img",{key:"2",class:"p-[18%]",src:Rn,style:lt(X.value)},null,4)):(a(),d("img",{key:"1",src:se(le.activeWidgetBubbleKey==="chat-image"&&!le.customWidgetBubbleSrc?le.previousWidgetBubbleKey:le.activeWidgetBubbleKey),style:lt(J.value)},null,12,sR))]),_:1})],4)]))],34)],6)):h("",!0)]),Ie[11]||(Ie[11]=e("div",null,null,-1))],64)}}});const an=Oe(aR,[["__scopeId","data-v-84435955"]]),oR="/assets/sliders-gray-72e37d28.svg",nR={class:"widget-colors"},iR={class:"color-view--wrap"},lR=["onClick"],rR={src:pa},dR={key:0,src:Bl},uR={key:1,src:oR},cR={key:0,class:"mt-2 py-3 px-4 space-y-5 bg-grey100 max-w-[344px] rounded"},mR={class:"color-view--wrap"},gR={src:pa},pR={class:"color-view--wrap"},vR={src:pa},fR={class:"color-view--wrap"},hR={src:pa},_R={class:"color-view--wrap"},yR={src:pa},bR={class:"color-view--wrap"},wR={src:pa},xR={class:"flex items-center gap-3 flex-wrap"},CR=["onClick"],kR={class:"flex items-center justify-center shrink-0 w-8 h-8 p-1 border border-[#c6d7e3] rounded-full overflow-hidden"},$R=["src","alt"],SR=["checked"],TR={class:"flex items-center flex-col gap-1"},MR={key:0,class:"flex items-center justify-center w-8 h-8 p-1 border border-[#c6d7e3] rounded-full overflow-hidden"},AR=["src"],ER=["src"],DR={key:1,class:"flex items-center justify-center w-8 h-8 p-1 border border-[#c6d7e3] rounded-full overflow-hidden"},IR=["src"],FR=["src"],PR=["src"],jR=["checked"],LR=fe({__name:"WidgetColorSelector",props:{activeWidgetColor:{},headerFontColor:{},avatarBorderColor:{},chatBubbleColor:{},chatFontColor:{},closeIconColor:{},widgetColors:{},systemMessageIcon:{},showAdvancedSettings:{type:Boolean,default:!1}},emits:["change-color","change-header-font-color","change-avatar-border-color","change-chat-bubble-color","change-chat-font-color","change-close-icon-color","change-system-message-icon","handle-show-advanced-settings"],setup(o,{emit:s}){const t=o,n=s,l=ls(),i=$(!1),m=$(!1),r=$(""),u=$(!1),g=$(!1),y=$(!1),c=$(!1),w=$(!1),f=$(!1),v=$(""),C=$(""),_=$(""),A=$(""),D=$(""),T=$(),B=["system-base","system-smile","system-robot","system-male","system-female"],S=$(""),E=b(()=>!B.includes(t.systemMessageIcon)),x=b(()=>100*1024),P=b(()=>!t.widgetColors.some(G=>G.color==t.activeWidgetColor.color)),j=b(()=>P.value?t.activeWidgetColor.hex:""),H=G=>{switch(G){case"system-smile":return`${De}images/system-smile.png`;case"system-robot":return`${De}images/system-robot.png`;case"system-male":return`${De}images/system-male.png`;case"system-female":return`${De}images/system-female.png`;default:return`${De}images/system-base.png`}},k=G=>{E.value&&(S.value=t.systemMessageIcon),n("change-system-message-icon",G)},M=()=>{T.value.$refs.input.click()},V=G=>{if(G&&G.file){const U=G.file.size/1048576;if(!Ka(G.file)){ze().set({message:"Please upload icon in .jpg, .jpeg, .png, .gif format.",type:"error"});return}if(U>8){ze().set({message:"File size can not be larger than 8MB",type:"error"});return}n("change-system-message-icon",G.file)}},Z=()=>{S.value?n("change-system-message-icon",S.value):M()},ae=G=>{n("change-color",G)},ce=G=>{n("change-header-font-color",G)},J=G=>{n("change-avatar-border-color",G)},X=G=>{n("change-chat-bubble-color",G)},z=G=>{n("change-chat-font-color",G)},q=G=>{n("change-close-icon-color",G)},ue=()=>{i.value=!1},pe=()=>{g.value=!1},de=()=>{y.value=!1},he=()=>{c.value=!1},ve=()=>{w.value=!1},be=()=>{f.value=!1},re=()=>{m.value=!1,setTimeout(()=>{i.value=!0},300)},ie=()=>{g.value=!1,setTimeout(()=>{g.value=!0},300)},xe=()=>{y.value=!1,setTimeout(()=>{y.value=!0},300)},N=()=>{c.value=!1,setTimeout(()=>{c.value=!0},300)},L=()=>{w.value=!1,setTimeout(()=>{w.value=!0},300)},me=()=>{f.value=!1,setTimeout(()=>{f.value=!0},300)};return Xe(()=>{u.value=t.showAdvancedSettings,t.headerFontColor!="#FFFFFF"&&(v.value={hex:t.headerFontColor}),t.avatarBorderColor!="#FFFFFF"&&(C.value={hex:t.avatarBorderColor}),t.chatBubbleColor!=t.activeWidgetColor.hex&&(_.value={hex:t.chatBubbleColor}),t.chatFontColor!="#FFFFFF"&&(A.value={hex:t.chatFontColor}),t.closeIconColor!="#FFFFFF"&&(D.value={hex:t.closeIconColor})}),We(()=>r.value,()=>{i.value&&n("change-color",{color:r.value.hex,hex:r.value.hex})}),We(()=>v.value,()=>{g.value&&ce(v.value.hex)}),We(()=>C.value,()=>{y.value&&J(C.value.hex)}),We(()=>_.value,()=>{c.value&&X(_.value.hex)}),We(()=>A.value,()=>{w.value&&z(A.value.hex)}),We(()=>D.value,()=>{f.value&&q(D.value.hex)}),We(()=>t.showAdvancedSettings,()=>{u.value=t.showAdvancedSettings}),(G,U)=>{const R=He("svg-inline"),ee=He("click-away");return a(),d("div",nR,[U[22]||(U[22]=e("span",{class:"item-title"},"Widget Color",-1)),e("div",iR,[(a(!0),d(Se,null,Ne(G.widgetColors,se=>(a(),d("a",{href:"#",key:se.color,class:O([{"is-active":G.activeWidgetColor.color===se.color},"color-view--wrap"]),onClick:Qe(Y=>ae(se),["prevent"])},[e("div",{class:"color-view",style:lt({background:se.color})},null,4)],10,lR))),128)),e("a",{onClick:Qe(re,["prevent"]),class:O(["color-view--wrap custom",{active:P.value}])},[e("div",{style:lt({background:j.value?j.value:""}),class:"color-view"},[F(e("img",rR,null,512),[[R]])],4)],2),i.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:r.value,"onUpdate:modelValue":U[0]||(U[0]=se=>r.value=se)},null,8,["modelValue"])),[[ee,ue]]):h("",!0)]),p(l).name!="onboarding-widget"?(a(),d("button",{key:0,onClick:U[1]||(U[1]=se=>n("handle-show-advanced-settings")),class:"flex items-center justify-center gap-2 py-1 px-2 mt-1 h-auto bg-grey100 max-w-[208px] rounded"},[u.value?(a(),d("img",dR)):(a(),d("img",uR)),e("span",{class:O(["text-xs font-normal",u.value?"text-primary":"text-grey900"])},"Advanced Settings",2)])):h("",!0),W(ms,null,{default:K(()=>[u.value?(a(),d("div",cR,[e("div",null,[U[13]||(U[13]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"Header font",-1)),e("div",mR,[e("a",{href:"#",class:O([{"is-active":G.headerFontColor=="#FFFFFF"},"color-view--wrap"]),onClick:U[2]||(U[2]=Qe(se=>ce("#FFFFFF"),["prevent"]))},U[12]||(U[12]=[e("div",{class:"color-view border border-grey200 bg-white"},null,-1)]),2),e("a",{onClick:Qe(ie,["prevent"]),class:O(["color-view--wrap custom",{active:G.headerFontColor!="#FFFFFF"}])},[e("div",{style:lt({background:v.value?v.value.hex:""}),class:"color-view"},[F(e("img",gR,null,512),[[R]])],4)],2),g.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:v.value,"onUpdate:modelValue":U[3]||(U[3]=se=>v.value=se)},null,8,["modelValue"])),[[ee,pe]]):h("",!0)])]),e("div",null,[U[15]||(U[15]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"Avatar border",-1)),e("div",pR,[e("a",{href:"#",class:O([{"is-active":G.avatarBorderColor=="#FFFFFF"},"color-view--wrap"]),onClick:U[4]||(U[4]=Qe(se=>J("#FFFFFF"),["prevent"]))},U[14]||(U[14]=[e("div",{class:"color-view border border-grey200 bg-[#FFFFFF]"},null,-1)]),2),e("a",{onClick:Qe(xe,["prevent"]),class:O(["color-view--wrap custom",{active:G.avatarBorderColor!="#FFFFFF"}])},[e("div",{style:lt({background:C.value?C.value.hex:""}),class:"color-view"},[F(e("img",vR,null,512),[[R]])],4)],2),y.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:C.value,"onUpdate:modelValue":U[5]||(U[5]=se=>C.value=se)},null,8,["modelValue"])),[[ee,de]]):h("",!0)])]),e("div",null,[U[16]||(U[16]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"Chat bubble",-1)),e("div",fR,[e("a",{href:"#",class:O([{"is-active":G.chatBubbleColor==G.activeWidgetColor.hex},"color-view--wrap"]),onClick:U[6]||(U[6]=Qe(se=>X(G.activeWidgetColor.hex),["prevent"]))},[e("div",{class:"color-view border border-grey200",style:lt({background:G.activeWidgetColor.color})},null,4)],2),e("a",{onClick:Qe(N,["prevent"]),class:O(["color-view--wrap custom",{active:G.chatBubbleColor!=G.activeWidgetColor.hex}])},[e("div",{style:lt({background:_.value?_.value.hex:""}),class:"color-view"},[F(e("img",hR,null,512),[[R]])],4)],2),c.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:_.value,"onUpdate:modelValue":U[7]||(U[7]=se=>_.value=se)},null,8,["modelValue"])),[[ee,he]]):h("",!0)])]),e("div",null,[U[18]||(U[18]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"Chat font",-1)),e("div",_R,[e("a",{href:"#",class:O([{"is-active":G.chatFontColor=="#FFFFFF"},"color-view--wrap"]),onClick:U[8]||(U[8]=Qe(se=>z("#FFFFFF"),["prevent"]))},U[17]||(U[17]=[e("div",{class:"color-view border border-grey200 bg-white"},null,-1)]),2),e("a",{onClick:Qe(L,["prevent"]),class:O(["color-view--wrap custom",{active:G.chatFontColor!="#FFFFFF"}])},[e("div",{style:lt({background:A.value?A.value.hex:""}),class:"color-view"},[F(e("img",yR,null,512),[[R]])],4)],2),w.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:A.value,"onUpdate:modelValue":U[9]||(U[9]=se=>A.value=se)},null,8,["modelValue"])),[[ee,ve]]):h("",!0)])]),e("div",null,[U[20]||(U[20]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"Close icon",-1)),e("div",bR,[e("a",{href:"#",class:O([{"is-active":G.closeIconColor=="#FFFFFF"},"color-view--wrap"]),onClick:U[10]||(U[10]=Qe(se=>q("#FFFFFF"),["prevent"]))},U[19]||(U[19]=[e("div",{class:"color-view border border-grey200 bg-white"},null,-1)]),2),e("a",{onClick:Qe(me,["prevent"]),class:O(["color-view--wrap custom",{active:G.closeIconColor!="#FFFFFF"}])},[e("div",{style:lt({background:D.value?D.value.hex:""}),class:"color-view"},[F(e("img",wR,null,512),[[R]])],4)],2),f.value?F((a(),ne(p(ia),{key:0,disableAlpha:!0,modelValue:D.value,"onUpdate:modelValue":U[11]||(U[11]=se=>D.value=se)},null,8,["modelValue"])),[[ee,be]]):h("",!0)])]),e("div",null,[U[21]||(U[21]=e("div",{class:"mb-1 text-sm font-normal text-grey600"},"System message icon",-1)),e("div",xR,[(a(),d(Se,null,Ne(B,se=>e("div",{key:se,onClick:Y=>k(se),class:"flex items-center flex-col gap-1"},[e("div",{class:O(["flex items-center justify-center w-10 h-10 rounded-full cursor-pointer",{"border-2 border-grey600":se==G.systemMessageIcon}])},[e("div",kR,[e("img",{src:H(se),loading:"lazy",alt:se,width:"32",height:"32"},null,8,$R)])],2),e("input",{class:"cursor-pointer",type:"radio",name:"icon",checked:se==G.systemMessageIcon},null,8,SR)],8,CR)),64)),e("div",TR,[e("div",{onClick:M,class:O(["relative flex items-center justify-center w-10 h-10 cursor-pointer rounded-full group",{"border-2 border-grey600":E.value}])},[E.value?(a(),d("div",MR,[e("img",{src:G.systemMessageIcon,class:"object-cover",loading:"lazy",alt:"upload",width:"32",height:"32"},null,8,AR),e("img",{class:"absolute opacity-0 bg-grey900 group-hover:opacity-80 rounded-full overflow-hidden",src:`${p(De)}images/upload.svg`,loading:"lazy",alt:"upload",width:"32",height:"32"},null,8,ER)])):S.value?(a(),d("div",DR,[e("img",{src:S.value,class:"object-cover",loading:"lazy",alt:"upload",width:"32",height:"32"},null,8,IR),e("img",{class:"absolute opacity-0 bg-grey900 group-hover:opacity-80 rounded-full overflow-hidden",src:`${p(De)}images/upload.svg`,loading:"lazy",alt:"upload",width:"32",height:"32"},null,8,FR)])):(a(),d("img",{key:2,src:`${p(De)}images/upload.svg`,loading:"lazy",alt:"upload",width:"32",height:"32"},null,8,PR)),W(p(ml),{ref_key:"upload",ref:T,class:"file-upload-view",size:x.value,accept:"image/jpeg, image/png, image/gif",multiple:!1,drop:!1,"drop-directory":!1,onInputFile:V},null,8,["size"])],2),e("input",{class:"cursor-pointer",type:"radio",name:"icon",checked:E.value,onClick:Z},null,8,jR)])])])])):h("",!0)]),_:1})])}}});const RR=Oe(LR,[["__scopeId","data-v-08054384"]]),BR={class:"widget-position"},NR={class:"tab"},OR=["onClick"],VR={key:0,class:"custom-position--wrap"},UR={class:"custom-position--toggle"},GR={class:"tab custom-tab"},WR=["onClick"],qR={class:"custom-position--fields"},HR={class:"position-field--wrap"},zR={class:"position-field"},KR=["value"],YR={class:"position-field--wrap"},ZR={class:"position-field"},JR=["value"],QR=fe({__name:"WidgetPosition",props:{activeWidgetPositionKey:{},activeCustomWidgetPositionKey:{},widgetPositions:{},customWidgetPosition:{},bubbleBottomSpacing:{},bubbleSideSpacing:{}},emits:["change-position","change-custom-position","change-bottom-spacing","change-side-spacing"],setup(o,{emit:s}){const t=s,n=r=>{t("change-position",r)},l=r=>{t("change-custom-position",r)},i=r=>{t("change-bottom-spacing",r.target.value?parseInt(r.target.value):0)},m=r=>{t("change-side-spacing",r.target.value?parseInt(r.target.value):0)};return(r,u)=>(a(),d("div",BR,[u[5]||(u[5]=e("span",{class:"item-title"},"Position",-1)),e("ul",NR,[(a(!0),d(Se,null,Ne(r.widgetPositions,g=>(a(),d("li",{key:g.key,class:O(["tab-item",{"is-active":r.activeWidgetPositionKey===g.key}]),onClick:y=>n(g)},I(g.position),11,OR))),128))]),r.activeWidgetPositionKey==="custom"?(a(),d("div",VR,[e("div",UR,[u[0]||(u[0]=e("span",{class:"item-title"},"Side section",-1)),e("ul",GR,[(a(!0),d(Se,null,Ne(r.customWidgetPosition,g=>(a(),d("li",{key:g.key,class:O(["tab-item",{"is-active":r.activeCustomWidgetPositionKey===g.key}]),onClick:y=>l(g)},I(g.position),11,WR))),128))])]),e("div",qR,[e("div",HR,[u[2]||(u[2]=e("span",{class:"item-title"},"Bottom Spacing",-1)),e("div",zR,[e("input",{type:"number",value:r.bubbleBottomSpacing,placeholder:"0",onInput:i,min:"0",max:"1500",oninput:"this.value = Math.floor(this.value)"},null,40,KR),u[1]||(u[1]=e("span",{class:"pixel-text"},"px",-1))])]),e("div",YR,[u[4]||(u[4]=e("span",{class:"item-title"},"Side Spacing",-1)),e("div",ZR,[e("input",{type:"number",value:r.bubbleSideSpacing,placeholder:"0",onInput:m,min:"0",max:"1500",oninput:"this.value = Math.floor(this.value)"},null,40,JR),u[3]||(u[3]=e("span",{class:"pixel-text"},"px",-1))])])])])):h("",!0)]))}});const XR=Oe(QR,[["__scopeId","data-v-c3ffb9d4"]]),e7={class:"widget-appearance flex flex-col gap-0.5"},t7={class:"tab flex items-center gap-4 px-4px py-4px"},s7=["onClick"],a7=fe({__name:"WidgetAppearance",props:{activeDeviceAppearanceOption:{},widgetAppearanceOptions:{}},emits:["change-appearance"],setup(o,{emit:s}){const t=s,n=l=>{t("change-appearance",l)};return(l,i)=>(a(),d("div",e7,[W(Ns,{"label-text":"Mobile & Desktop Appearance","tooltip-text":"Select the specific device on which you'd like to showcase the widget."}),e("ul",t7,[(a(!0),d(Se,null,Ne(l.widgetAppearanceOptions,m=>(a(),d("li",{key:m.key,class:O(["tab-item flex items-center gap-2 py-1 text-sm cursor-pointer hover:text-[#0446de]",{"is-active":l.activeDeviceAppearanceOption===m.key}]),onClick:r=>n(m)},[i[0]||(i[0]=e("span",{class:"p-relative w-3.5 h-3.5 rounded-lg inline-block border border-solid border-[#282d3e]"},null,-1)),_e(" "+I(m.title),1)],10,s7))),128))])]))}});const o7=Oe(a7,[["__scopeId","data-v-a12b7108"]]),n7={class:"widget-state mt-8"},i7={class:"relative inline-block w-[222px] text-sm"},l7={class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},r7={class:"select-arrow",src:Tt},d7={class:"bg-white mt-1 w-full dropDown absolute z-10 rounded-lg py-2"},u7=["onClick"],c7=fe({__name:"WidgetDefaultState",props:{activeWidgetStateKey:{},stateOptions:{}},emits:["change-state"],setup(o,{emit:s}){const t=o,n=s,l=$(!1),i=()=>{l.value=!l.value},m=g=>{n("change-state",g.key),l.value=!1},r=g=>{var c;const y=(c=t.stateOptions)==null?void 0:c.find(w=>w.key===g);return y?y.name:null},u=g=>{var y;l.value&&!((y=document.querySelector(".custom-select"))!=null&&y.contains(g.target))&&(l.value=!1)};return Xe(()=>{document.addEventListener("click",u)}),Ms(()=>{document.removeEventListener("click",u)}),(g,y)=>{const c=He("svg-inline");return a(),d("div",n7,[y[0]||(y[0]=e("span",{class:"item-title"},"Default State",-1)),e("div",i7,[e("div",{onClick:i,class:"custom-select block w-full cursor-pointer text-[#282d3e] pointer relative py-1 px-2 border border-[#e6e6f0] rounded-lg"},[e("div",{class:O(["",{open:l.value}])},I(g.activeWidgetStateKey?r(g.activeWidgetStateKey):"Select an option"),3),e("div",l7,[F(e("img",r7,null,512),[[c]])])]),F(e("ul",d7,[(a(!0),d(Se,null,Ne(g.stateOptions,w=>(a(),d("li",{key:w.key,onClick:f=>m(w),class:"py-1 cursor-pointer px-2 m-0 text-sm text-[#282D3E] hover:bg-grey100"},I(w.name),9,u7))),128))],512),[[Gt,l.value]])])])}}});const m7=Oe(c7,[["__scopeId","data-v-a9b38ae5"]]),g7={class:"widget-pending-message"},p7={class:"item-title"},v7={class:"info-wrap"},f7={src:as,alt:""},h7={class:"item-title mt-4"},_7={class:"info-wrap"},y7={src:as,alt:""},b7=["value"],w7={class:"error-message"},x7=fe({__name:"WidgetPreviewTextBubble",props:{previewTextBubble:{type:Boolean},isWelcomeTextEnabled:{type:Boolean},pendingMessage:{default:"Hi, how can we help?"},hasError:{type:Boolean},validationMessage:{}},emits:["input","text-input","toggle-welcome-text"],setup(o,{emit:s}){const t=o,n=s,l=b(()=>t.pendingMessage?Ds(t.pendingMessage):!1),i=u=>{t.isWelcomeTextEnabled||m(!0),n("input",u)},m=u=>{t.previewTextBubble||n("toggle-welcome-text",u)},r=u=>{const g=u.target;n("text-input",g.value)};return(u,g)=>{const y=Pe("VDropdown"),c=Pe("ToggleSwitch"),w=He("svg-inline");return a(),d("div",g7,[e("span",p7,[g[1]||(g[1]=_e(" Preview Text Bubble ")),W(y,{triggers:["hover","click"],placement:"top"},{popper:K(()=>g[0]||(g[0]=[e("div",{class:"more--info"},[e("span",null,"Display this message as a call to action when your widget is in a closed state.")],-1)])),default:K(()=>[e("div",v7,[F(e("img",f7,null,512),[[w]])])]),_:1})]),W(c,{value:u.previewTextBubble,onInput:i},null,8,["value"]),e("span",h7,[g[3]||(g[3]=_e(" Welcome Message ")),W(y,{triggers:["hover","click"],placement:"top"},{popper:K(()=>g[2]||(g[2]=[e("div",{class:"more--info"},[e("span",null,"This is the initial message visitors see when opening the widget. If the preview text bubble is enabled, the message displayed in the preview bubble is the same as the welcome message.")],-1)])),default:K(()=>[e("div",_7,[F(e("img",y7,null,512),[[w]])])]),_:1})]),W(c,{value:u.isWelcomeTextEnabled,onInput:m,disabled:u.previewTextBubble,class:"disabled:!bg-primary disabled:opacity-50"},null,8,["value","disabled"]),u.isWelcomeTextEnabled?(a(),d("textarea",{key:0,ref:"welcomeMessage",value:u.pendingMessage,class:O(["input",{error:u.hasError,rtl:l.value}]),placeholder:"Write your message here",onInput:r},null,42,b7)):h("",!0),(a(!0),d(Se,null,Ne(u.validationMessage,(f,v)=>(a(),d("div",{key:v},[e("span",w7,I(f.$message),1)]))),128))])}}});const C7=Oe(x7,[["__scopeId","data-v-13ea7a86"]]),k7={key:0,class:"bg-grey100 p-2.5 rounded-md mt-2 toggle-settings"},$7={class:"flex items-center gap-4"},S7={class:"flex items-center gap-4 mt-4"},T7=fe({__name:"WidgetTrigger",props:{modelValue:{type:Object,required:!0},validator:{type:Object,required:!0}},setup(o){const t=$(o.modelValue);function n(u){t.value.is_trigger_enabled=u,r(u),m(u)}function l(u){t.value.has_display_after_time=u,r(u)}function i(u){t.value.has_display_page_scroll=u,m(u)}function m(u){!u&&(!t.value.display_page_scroll||t.value.display_page_scroll>100)&&(t.value.display_page_scroll=0)}function r(u){!u&&(!t.value.display_after_time||t.value.display_after_time>999)&&(t.value.display_after_time=0)}return Xe(()=>{!t.value.has_display_after_time&&!t.value.has_display_page_scroll&&(t.value.is_trigger_enabled=!1)}),(u,g)=>(a(),d("div",null,[W(Ns,{"label-text":"Triggers","tooltip-text":"You can set the Chatway icon to appear after a specific time or scroll percentage. Once triggered, it remains visible. The widget is always visible if the trigger toggle is off."}),W(Sa,{value:t.value.is_trigger_enabled,onInput:n},null,8,["value"]),t.value.is_trigger_enabled?(a(),d("div",k7,[e("div",$7,[W(Sa,{value:t.value.has_display_after_time,onInput:l},null,8,["value"]),e("div",{class:O(["text-sm text-[#282D3E]",{"opacity-40":!t.value.has_display_after_time}])},[g[2]||(g[2]=_e(" Display after ")),W(Ha,{placeholder:"0",type:"number",min:"0",step:"1",class:"!inline-block !w-10 !m-1",readonly:!t.value.has_display_after_time,value:t.value.display_after_time,onInput:g[0]||(g[0]=y=>t.value.display_after_time=y),hasError:o.validator.triggerSettings.display_after_time.$error,classes:"!bg-white !inline-block !py-0 !px-1 h-7 !w-10 border-[#282D3E] rounded-md ![appearance:textfield]"},null,8,["readonly","value","hasError"]),g[3]||(g[3]=_e(" seconds on the page "))],2)]),e("div",S7,[W(Sa,{value:t.value.has_display_page_scroll,onInput:i},null,8,["value"]),e("div",{class:O(["text-sm text-[#282D3E]",{"opacity-40":!t.value.has_display_page_scroll}])},[g[4]||(g[4]=_e(" Display after ")),W(Ha,{placeholder:"25",type:"number",class:"!inline-block !w-10 !m-1",readonly:!t.value.has_display_page_scroll,value:t.value.display_page_scroll,onInput:g[1]||(g[1]=y=>t.value.display_page_scroll=y),hasError:o.validator.triggerSettings.display_page_scroll.$error,classes:"!bg-white !inline-block !py-0 !px-1 h-7 !w-10 border-[#282D3E] rounded-md ![appearance:textfield]"},null,8,["readonly","value","hasError"]),g[5]||(g[5]=_e(" % on page "))],2)])])):h("",!0)]))}});const M7=Oe(T7,[["__scopeId","data-v-07a8a6c3"]]),A7={class:"widget-size"},E7={class:"tab"},D7=["onClick"],I7={key:0,class:"custom-size--wrap"},F7={class:"flex items-center gap-1"},P7={class:"size-field"},j7=fe({__name:"WidgetSize",props:{activeWidgetSizeKey:{},widgetSizes:{},customWidgetSize:{default:48}},emits:["change-size","change-custom-size"],setup(o,{emit:s}){const t=o,n=s,l=$(t.customWidgetSize||48),i=$(t.customWidgetSize||48),m=u=>{n("change-size",u),u.key==="custom"&&n("change-custom-size",l.value)},r=()=>{i.value=i.value>119?120:i.value,l.value=i.value,n("change-custom-size",l.value)};return We(()=>t.customWidgetSize,u=>{l.value=u,i.value=u}),(u,g)=>(a(),d("div",A7,[g[4]||(g[4]=e("span",{class:"item-title"},"Widget Size",-1)),e("div",null,[e("ul",E7,[(a(!0),d(Se,null,Ne(u.widgetSizes,y=>(a(),d("li",{key:y.key,class:O(["tab-item",{"is-active":u.activeWidgetSizeKey===y.key}]),onClick:c=>m(y)},I(y.size),11,D7))),128))])]),u.activeWidgetSizeKey==="custom"?(a(),d("div",I7,[e("div",F7,[g[3]||(g[3]=e("span",{class:"item-title"},"Choose Size",-1)),W(yt,{placement:"top"},{content:K(()=>g[1]||(g[1]=[e("div",{class:"p-3"},[e("span",null,"Maximum size is 120")],-1)])),default:K(()=>[g[2]||(g[2]=e("img",{src:as,alt:"info"},null,-1))]),_:1})]),e("div",P7,[F(e("input",{"onUpdate:modelValue":g[0]||(g[0]=y=>i.value=y),type:"number",onInput:r,min:"0",max:"120"},null,544),[[bt,i.value]])])])):h("",!0)]))}});const L7=Oe(j7,[["__scopeId","data-v-187a3b11"]]),R7="/assets/upload-bubble-e1cfd32b.svg",B7="/assets/upload-cloud-bcdd7332.svg",N7="/assets/upload-cloud-small-0b44ade8.svg",O7=fe({__name:"CropperStencil",props:{image:Object,coordinates:Object,transitions:Object,stencilCoordinates:{type:Object,default:()=>({height:0,width:0,left:0,top:0})}},emits:["move","move-end","resize","resize-end"],setup(o,{emit:s}){const t=o,n=s,l=b(()=>{const{height:g,width:y,left:c,top:w}=t.stencilCoordinates,f={width:`${y}px`,height:`${g}px`,transform:`translate(${c}px, ${w}px)`,transition:""};return t.transitions&&t.transitions.enabled&&(f.transition=`${t.transitions.time}ms ${t.transitions.timingFunction}`),f}),i=g=>{n("move",g)},m=()=>{n("move-end")},r=g=>{const y=g.shift(),c=y.left,w=-y.top;n("resize",new Ed({left:c,right:c,top:w,bottom:w},{compensate:!0}))},u=()=>{n("resize-end")};return(g,y)=>(a(),d("div",{class:"circle-stencil",style:lt(l.value)},[W(p(Td),{class:"circle-stencil__handler",onDrag:r,onDragEnd:u},{default:K(()=>[(a(),d("svg",{class:"circle-stencil__icon",xmlns:"http://www.w3.org/2000/svg",width:"26.7",height:"26.7",onMousedown:y[0]||(y[0]=Qe(()=>{},["prevent"]))},y[1]||(y[1]=[e("path",{fill:"#FFF",d:"M15.1 4.7L18.3 6l-3.2 3.3 2.3 2.3 3.3-3.3 1.3 3.3L26.7 0zM9.3 14.7L6 18l-1.3-3.3L0 26.3l11.6-4.7-3.3-1.3 3.3-3.3z"},null,-1)]),32))]),_:1}),W(p(Ad),{onMove:i,onMoveEnd:m},{default:K(()=>{var c,w;return[W(p(Md),{class:"circle-stencil__preview",image:o.image,coordinates:o.coordinates,width:(c=o.stencilCoordinates)==null?void 0:c.width,height:(w=o.stencilCoordinates)==null?void 0:w.height,transitions:o.transitions},null,8,["image","coordinates","width","height","transitions"])]}),_:1})],4))}});const V7={class:"flex justify-content-center items-center gap-2 p-4 mb-6 min-h-[200px]"},U7={class:"w-full bg-white"},G7={src:N7,class:"w-5 h-5 mr-1 ml-4",alt:""},W7=fe({__name:"ImageCropperModal",props:{showImageCropper:{type:Boolean},img:{},isLoading:{type:Boolean}},emits:["onClose","onUploadImage","onNewImageRequested","onStartLoading"],setup(o,{emit:s}){const t=s,n=$(),l=()=>{t("onClose")},i=()=>{t("onStartLoading"),setTimeout(()=>{m()},500)},m=async()=>{if(n!=null&&n.value){const{canvas:u}=n.value.getResult();u.toBlob(g=>{t("onUploadImage",g)},"image/jpeg")}},r=()=>{t("onNewImageRequested")};return(u,g)=>{const y=Pe("Loader"),c=Pe("Modal"),w=He("svg-inline");return u.showImageCropper?(a(),ne(c,{key:0,"header-title":"Crop Image",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Crop and Save",isLoading:u.isLoading,backdropClickClose:!1,closeModal:u.showImageCropper,onCloseModal:l,onActionButtonTypeOne:l,onActionButtonTypeTwo:i,disableButtonTwo:u.isLoading,classes:"md:!w-[600px] !w-[350px] md:!h-auto"},{default:K(()=>[e("div",V7,[W(y,{size:"24px",class:"!absolute top-50"}),W(p(Dd),{ref_key:"cropperRef",ref:n,src:u.img,class:"max-h-96","stencil-component":O7,"stencil-props":{aspectRatio:1/1}},null,8,["src"])]),e("div",U7,[e("div",{onClick:r,class:"inline-flex items-center cursor-pointer absolute bottom-[15px] upload-new-button"},[F(e("img",G7,null,512),[[w]]),g[0]||(g[0]=e("button",{class:"p-0 hidden md:block"},"Choose different Image",-1)),g[1]||(g[1]=e("button",{class:"p-0 block md:hidden"},"Change",-1))])])]),_:1},8,["isLoading","closeModal","disableButtonTwo"])):h("",!0)}}}),q7={class:"widget-bubble"},H7={class:"bubble-wrap flex-nowrap"},z7=["onClick"],K7=["src"],Y7={key:1,class:"upload-bubble--button"},Z7={class:"info-wrap"},J7={src:as,alt:""},Q7={key:0,class:"custom-img--view"},X7=["src"],eB={key:1},tB={src:R7,alt:""},sB={key:2,class:"hover-upload"},aB={src:B7,alt:""},oB={key:2,class:"radio-button"},nB=["checked"],iB={key:3,class:"radio-button"},lB=["value","checked"],rB=fe({__name:"WidgetBubblePreview",props:{activeWidgetBubbleKey:{},widgetBubbles:{},showCustom:{type:Boolean},customWidgetBubbleSrc:{},isCustomBubbleLoading:{type:Boolean}},emits:["change-bubble","change-custom-bubble","change-custom-widget-bubble"],setup(o,{emit:s}){const t=o,n=s,l=S=>{S.key!=="chat-image"&&n("change-bubble",S)},i=$(!1),m=$(),r=$(""),u=$(!1),g=$(!1),y=S=>{n("change-bubble",{key:"chat-image"}),!S&&m.value[0].$refs.input.click()},c=()=>{i.value=!0},w=()=>{i.value=!1},f=()=>{u.value=!u.value},v=()=>{g.value=!g.value},C=()=>{f(),m.value[0].$refs.input.click()},_=b(()=>100*1024),A=async S=>{S&&T({file:S}),setTimeout(()=>{g.value=t.isCustomBubbleLoading,f()},1500)},D=async S=>{if(S!=null&&S.file){const E=S.file.size/1048576;if(!Ka(S.file)){ze().set({message:"Please upload icon in .jpg, .jpeg, .png, .gif format.",type:"error"});return}if(E>8){ze().set({message:"File size can not be larger than 8MB",type:"error"});return}const x=URL.createObjectURL(S.file);r.value=x,f()}};function T(S){if(S&&S.file){if(S.file.size/1048576>8){ze().set({message:"File size can not be larger than 8MB",type:"error"});return}n("change-custom-widget-bubble","chat-image"),n("change-custom-bubble",S.file)}}const B=S=>{switch(S){case"chat-base":return`${De}images/chat-base.png`;case"chat-smile":return`${De}images/chat-smile-update-2.png`;case"chat-bubble":return`${De}images/chat-bubble.png`;case"chat-db":return`${De}images/chat-db.png`;default:return""}};return Xe(()=>{g.value=t.isCustomBubbleLoading}),We(()=>t.isCustomBubbleLoading,()=>{g.value=t.isCustomBubbleLoading}),(S,E)=>{const x=Pe("VDropdown"),P=Pe("Loader"),j=He("svg-inline");return a(),d("div",q7,[e("div",H7,[(a(!0),d(Se,null,Ne(S.widgetBubbles,H=>(a(),d("div",{key:H.key,class:O([{"is-active":S.activeWidgetBubbleKey===H.key},"bubble-preview"]),onClick:k=>l(H)},[H.key!=="chat-image"?(a(),d("img",{key:0,src:B(H.key),alt:"",class:"bubble",loading:"lazy",width:"48",height:"48"},null,8,K7)):h("",!0),H.key==="chat-image"&&S.showCustom?(a(),d("div",Y7,[W(x,{distance:56,skidding:-100,triggers:["hover","click"],placement:"right-start"},{popper:K(()=>E[1]||(E[1]=[e("div",{class:"more--info"},[e("span",null,"If you wish to showcase your custom bubble in the widget, you can upload it here.")],-1)])),default:K(()=>[e("div",Z7,[F(e("img",J7,null,512),[[j]])])]),_:1}),S.customWidgetBubbleSrc?(a(),d("div",Q7,[g.value?(a(),ne(P,{key:0,class:"!absolute before:!border-black -top-[38px] -left-[6px]",size:"60px"})):h("",!0),e("img",{src:S.customWidgetBubbleSrc,alt:""},null,8,X7)])):(a(),d("div",eB,[g.value?(a(),ne(P,{key:0,class:"!absolute before:!border-black -top-[38px] -left-[6px]",size:"60px"})):h("",!0),F(e("img",tB,null,512),[[j]])])),i.value&&S.customWidgetBubbleSrc?(a(),d("div",sB,[F(e("img",aB,null,512),[[j]])])):h("",!0),W(p(ml),{ref_for:!0,ref_key:"upload",ref:m,class:"file-upload-view",size:_.value,accept:"image/jpeg, image/png, image/gif",multiple:!1,drop:!1,"drop-directory":!1,onInputFile:D,onMouseenter:c,onMouseleave:w},null,8,["size"]),W(W7,{showImageCropper:u.value,isLoading:g.value,img:r.value,onOnClose:f,onOnStartLoading:v,onOnUploadImage:A,onOnNewImageRequested:C},null,8,["showImageCropper","isLoading","img"])])):h("",!0),H.key==="chat-image"?(a(),d("div",oB,[e("input",{type:"radio",class:"cursor-pointer",checked:S.activeWidgetBubbleKey===H.key,onClick:E[0]||(E[0]=k=>y(S.customWidgetBubbleSrc))},null,8,nB)])):(a(),d("div",iB,[e("input",{type:"radio",class:"cursor-pointer",value:H.key,checked:S.activeWidgetBubbleKey===H.key},null,8,lB)]))],10,z7))),128))])])}}});const dB=Oe(rB,[["__scopeId","data-v-39cfd928"]]),to="/assets/exclamation-circle-aa8e6f25.svg",uB="/assets/language-1eb95cc4.svg",Ao="/assets/arrow-right-3-e348887a.svg",cB="/assets/search-bf3bc3aa.svg",mB="/assets/refresh-2971465e.svg",Vt="/assets/eye-873b463b.svg";const gB={class:"flex flex-col md:flex-row items-start md:items-center gap-1 md:gap-2 select-wrapper"},pB={class:"flex items-center gap-1 shrink-0"},vB=["disabled"],fB={class:"truncate"},hB={key:0,class:"absolute bottom-10 bg-white w-[232px] rounded-lg shadow-xl"},_B={class:"p-4 space-y-4"},yB=["onClick"],bB={key:0,class:"w-4 h-4",src:Wt,alt:""},wB=fe({__name:"DefaultLanguageSwitcher",props:{languages:{}},emits:["on-default-language-change"],setup(o,{emit:s}){const t=o,n=s,l=$(!1),i=$(null),m=()=>{l.value=!l.value},r=c=>{n("on-default-language-change",c)},u=b(()=>Object.keys(t.languages).find(c=>{var w;return(w=t.languages[c])==null?void 0:w.is_default})??"ENGLISH"),g=b(()=>Object.keys(t.languages).filter(c=>{var w,f;return((w=t.languages[c])==null?void 0:w.is_published)||((f=t.languages[c])==null?void 0:f.is_default)})),y=c=>{if(c.trim())return c.replace("_"," ")};return Os(i,()=>l.value=!1),(c,w)=>{const f=Pe("VDropdown");return a(),d("div",gB,[e("div",pB,[w[2]||(w[2]=e("span",null,"Change default language",-1)),W(f,{triggers:["hover","click"],placement:"top"},{popper:K(()=>w[0]||(w[0]=[e("div",{class:"p-3 w-96"},[e("span",null,"You can choose any language to be the widget's default. The widget will be displayed in the default language if no language is specified for that visitor's browser language.")],-1)])),default:K(()=>[w[1]||(w[1]=e("div",null,[e("img",{src:as,alt:""})],-1))]),_:1})]),e("div",{class:"relative",ref_key:"defaultLanguageSwitcher",ref:i},[e("button",{onClick:m,disabled:g.value.length<2,class:O(["flex items-center justify-between border py-1.5 px-2 rounded-lg w-36 h-auto disabled:!bg-white disabled:opacity-50",l.value?"border-primary":"border-grey200"])},[e("div",fB,I(u.value),1),e("img",{class:O({"transition rotate-180":l.value}),src:Tt,alt:""},null,2)],10,vB),l.value?(a(),d("div",hB,[W(p(Dn),{class:"max-h-96 overflow-y-auto",defer:""},{default:K(()=>[e("div",_B,[(a(!0),d(Se,null,Ne(g.value,v=>{var C,_;return a(),d("div",{key:v,onClick:A=>r(v),class:"flex items-center justify-between cursor-pointer"},[e("div",{class:O(["text-base font-normal truncate",{"text-primary":(C=c.languages[v])==null?void 0:C.is_default}])},I(y(v)),3),(_=c.languages[v])!=null&&_.is_default?(a(),d("img",bB)):h("",!0)],8,yB)}),128))])]),_:1})])):h("",!0)],512)])}}}),xB=fe({__name:"FreeTrialMultiLanguageNotificationModal",props:{showModal:{type:Boolean}},emits:["closeModal","save"],setup(o,{emit:s}){const t=s,n=Ae(),l=()=>{n.showFailedPaymentModal=!1},i=()=>{t("save")};return(m,r)=>{const u=Pe("Modal");return m.showModal?(a(),ne(u,{key:0,classes:"!w-[29rem]",closeModal:m.showModal,showHeaderClose:!1,onCloseModal:l,footerTopBorder:"",actionButtonTypeTwoText:"Got it",onActionButtonTypeTwo:i},{default:K(()=>r[0]||(r[0]=[e("div",{class:"flex flex-col items-center gap-1 p-6"},[e("p",{class:"text-base m-0 text-grey900 leading-[140%]"},[e("b",null,"Please note:"),_e(" After the Pro trial ends, the widget will revert to the default language you selected, and multi-language support will no longer be available. ")])],-1)])),_:1},8,["closeModal"])):h("",!0)}}}),CB={class:"flex items-center justify-content-between"},kB={class:"flex items-center gap-1 mb-1"},$B={class:"w-[20.875rem]"},SB={key:0,class:"flex items-center gap-1 mb-2"},TB={class:"w-4 h-4",src:to,alt:""},MB={class:"flex items-center gap-1"},AB={src:uB,alt:"",class:"languageIcon"},EB={key:0,class:"text-grey-900 group-hover:text-primary"},DB={key:1,class:"text-grey-900 group-hover:text-primary"},IB={src:Ao,alt:"",class:"arrowRight"},FB={class:"md:flex h-full scroll-border"},PB={class:"w-full md:w-[221px]"},jB={class:"px-4 pt-4 pb-3 mr-3"},LB={class:"relative"},RB={for:"search"},BB={class:"absolute top-3 left-2.5 w-4 h-4",src:cB,alt:""},NB=["title"],OB=["onClick"],VB={class:"flex items-center gap-3 form-group"},UB=["onClick"],GB={class:"w-4 h-4",src:mB,alt:""},WB=["id","onInput","value","checked","disabled"],qB=["for"],HB={key:1,class:"px-4 py-[9px]"},zB={key:0,class:"space-y-4 w-full md:w-[576px] p-4 pr-6"},KB={class:"flex items-center justify-between"},YB={class:"text-base font-semibold text-grey900 leading-5 md:w-[298px]"},ZB={class:"md:flex justify-between"},JB={class:"flex gap-2 mb-2 md:mb-0"},QB=["src"],XB={for:"WriteYourMessage",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},eN={class:"md:flex justify-between"},tN={class:"flex gap-2 mb-2 md:mb-0"},sN=["src"],aN={for:"OurTeamHere",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},oN={class:"md:flex justify-between"},nN={class:"flex gap-2 mb-2 md:mb-0"},iN=["src"],lN={for:"AddEmail",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},rN={class:"md:flex justify-between"},dN={class:"flex gap-2 mb-2 md:mb-0"},uN=["src"],cN={for:"WeAreAway",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},mN={class:"md:flex justify-between"},gN={class:"flex gap-2 mb-2 md:mb-0"},pN=["src"],vN={for:"CouldNotUpload",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},fN={class:"md:flex justify-between"},hN={class:"flex gap-2 mb-2 md:mb-0"},_N=["src"],yN={for:"VisitPage",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},bN={class:"md:flex justify-between"},wN={class:"flex gap-2 mb-2 md:mb-0"},xN=["src"],CN={for:"SetEmailNotification",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},kN={class:"md:flex justify-between"},$N={class:"flex gap-2 mb-2 md:mb-0"},SN=["src"],TN={for:"WillUpdateYou",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},MN={class:"md:flex justify-between"},AN={class:"flex gap-2 mb-2 md:mb-0"},EN=["src"],DN={for:"UpdateYourEmail",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},IN={class:"md:flex justify-between"},FN={class:"flex gap-2 mb-2 md:mb-0"},PN=["src"],jN={for:"IsTyping",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},LN={class:"md:flex justify-between"},RN={class:"flex gap-2 mb-2 md:mb-0"},BN=["src"],NN={for:"InvalidEmail",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},ON={class:"md:flex justify-between"},VN={class:"flex gap-2 mb-2 md:mb-0"},UN=["src"],GN={for:"ContactFormHeading",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},WN={class:"md:flex justify-between"},qN={class:"flex gap-2 mb-2 md:mb-0"},HN=["src"],zN={for:"FillContactDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},KN={class:"md:flex justify-between"},YN={class:"flex gap-2 mb-2 md:mb-0"},ZN=["src"],JN={for:"FormDetailsShared",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},QN={class:"md:flex justify-between"},XN={class:"flex gap-2 mb-2 md:mb-0"},eO=["src"],tO={for:"UpdateDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},sO={class:"md:flex justify-between"},aO={class:"flex gap-2 mb-2 md:mb-0"},oO=["src"],nO={for:"Name",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},iO={class:"md:flex justify-between"},lO={class:"flex gap-2 mb-2 md:mb-0"},rO=["src"],dO={for:"Email",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},uO={class:"md:flex justify-between"},cO={class:"flex gap-2 mb-2 md:mb-0"},mO=["src"],gO={for:"PhoneNumber",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},pO={class:"md:flex justify-between"},vO={class:"flex gap-2 mb-2 md:mb-0"},fO=["src"],hO={for:"StartChatting",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},_O={class:"md:flex justify-between"},yO={class:"flex gap-2 mb-2 md:mb-0"},bO=["src"],wO={for:"Submit",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},xO={class:"md:flex justify-between"},CO={class:"flex gap-2 mb-2 md:mb-0"},kO=["src"],$O={for:"WidgetTextBubble",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},SO={class:"md:flex justify-between"},TO={class:"flex gap-2 mb-2 md:mb-0"},MO=["src"],AO={for:"UpdateDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},EO={class:"md:flex justify-between"},DO={class:"flex gap-2 mb-2 md:mb-0"},IO=["src"],FO={for:"UpdateDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},PO={class:"md:flex justify-between"},jO={class:"flex gap-2 mb-2 md:mb-0"},LO=["src"],RO={for:"UpdateDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},BO={class:"md:flex justify-between"},NO={class:"flex gap-2 mb-2 md:mb-0"},OO=["src"],VO={for:"UpdateDetails",class:"text-sm font-normal text-grey900/60 w-full md:max-w-[200px]"},UO=fe({__name:"WidgetLanguageSelector",props:{widgetHeaderText:{},pendingTextMessage:{},noneWorkingHourMessage:{},workingHourMessage:{}},emits:["save-widget-langs","init-widget-langs","reset-skip-to-next","skip-to-next"],setup(o,{expose:s,emit:t}){const n=As(),l=Es(),i=ls(),m=o,r=t,u=Ae(),g=$({}),y=$({}),c=$("ENGLISH"),w=$(!1),f=$(""),v=$(!1),C=$(!1),_=$(new Set),A=b(()=>Object.keys(l.widgetLangs).filter(N=>f.value.trim()?N.replace("_"," ").toLocaleLowerCase().includes(f.value.toLocaleLowerCase()):N)),D=b(()=>{var L;const N=Ke.cloneDeep(g.value);for(const me in g.value)"locale"in N[me]&&delete N[me].locale,"is_published"in N[me]&&((L=N[me])==null||delete L.is_published),"is_default"in N[me]&&delete N[me].is_default;return N}),T=b(()=>{const N=Object.keys(g.value).filter(L=>{var me;return(me=g.value[L])==null?void 0:me.is_published});return N.length==1&&N[0]=="ENGLISH"?0:N.length}),B=b(()=>g.value[c.value]??g.value.ENGLISH),S=b(()=>{const N=Object.keys(g.value).find(L=>{var me;return(me=g.value[L])==null?void 0:me.is_default})??"ENGLISH";return l.widgetLangs[N]}),E=b(()=>Object.keys(n.languages).length===1&&n.languages.ENGLISH?!Ke.isEqual(g.value.ENGLISH,n.languages.ENGLISH):!Ke.isEqual(g.value,n.languages)),x=b(()=>u.isProUser),P=b(()=>u.isProUserOrTrial),j=b(()=>u.hasTrial),H=b(()=>i.name=="onboarding-widget"),k={working_hour_message:{required:Ye.withMessage("Input Required",ut),maxLength:It(1e3)},none_working_hour_message:{required:Ye.withMessage("Input Required",ut),maxLength:It(1e3)},write_your_message:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},team_here:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},team_online:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},away:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},image_upload_error:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},visit_page:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},click_set_email:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},update_email:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},update_you_at:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},typing_at:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},invalid_email:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},initiate_chat_with_details:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},provide_details_notified:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},form_details_shared:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},update_details:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},name:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},email:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},phone_number:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},start_chatting:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},submit:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},widget_text_bubble:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},faq:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)},chat:{required:Ye.withMessage("Input Required",ut),maxLength:It(255)}},M=bs(k,B,{$scope:!1,$stopPropagation:!0}),V=N=>{if(N.trim())return N.replace("_"," ")},Z=N=>{M.value.$errors.length?_.value.add(N):_.value.delete(N)},ae=N=>{Z(c.value),c.value=N},ce=N=>{var L;Z(c.value),P.value||(Object.keys(l.widgetLangs).forEach(G=>{g.value[G].is_published=!1,g.value[G].is_default=!1}),g.value[N].is_default=!0),(L=g.value[N])!=null&&L.is_published?g.value[N].is_published=!1:g.value[N].is_published=!0,c.value=N},J=N=>{g.value[N]=Ke.merge(Ke.cloneDeep(g.value[N]),Ke.cloneDeep(l.widgetLangs[N]))},X=N=>{const L=Object.values(g.value).find(me=>me.is_default);L&&(L.is_default=!1),g.value[N].is_default=!0},z=()=>{g.value=Ke.merge(Ke.cloneDeep(l.widgetLangs),Ke.cloneDeep(n.languages));const N=Object.entries(g.value).filter(([,L])=>L.is_published&&L.is_default);H.value&&N.length==0&&g.value.ENGLISH&&(g.value.ENGLISH.is_default=!0,g.value.ENGLISH.is_published=!0)},q=()=>{if(Z(c.value),!x.value&&!_.value.size&&!C.value){C.value=!0;return}const N=[];if(j.value&&(Object.keys(l.widgetLangs).forEach(me=>{g.value[me].is_published&&N.push(me)}),N.length>1&&!C.value&&!x.value)){C.value=!0;return}ue()},ue=()=>{if(M.value.$touch(),!M.value.$invalid){if(Z(c.value),_.value.size){ze().set({message:"All inputs must be filled out",type:"error"});return}y.value=Ke.cloneDeep(g.value),r("save-widget-langs",Ke.cloneDeep(g.value)),w.value=!1,C.value&&he()}},pe=()=>{y.value={},z(),r("init-widget-langs",Ke.cloneDeep(g.value))},de=()=>{Object.keys(y.value).length?g.value=Ke.cloneDeep(y.value):z(),H.value&&r("skip-to-next"),w.value=!1},he=()=>{C.value=!1},ve=()=>{pe(),H.value&&r("skip-to-next"),w.value=!1},be=()=>{H.value&&r("reset-skip-to-next"),w.value=!0},re=()=>{w.value=!0},ie=N=>Object.values(N).find(L=>(L==null?void 0:L.is_default)&&(L==null?void 0:L.is_published)),xe=Ys(()=>{const N=ie(g.value);N&&(N.team_here=m.widgetHeaderText,N.widget_text_bubble=m.pendingTextMessage,H.value||(N.working_hour_message=m.workingHourMessage??"",N.none_working_hour_message=m.noneWorkingHourMessage??""),r("init-widget-langs",Ke.cloneDeep(g.value)))},300);return Xe(async()=>{pe()}),We(()=>[m.widgetHeaderText,m.pendingTextMessage,m.workingHourMessage,m.noneWorkingHourMessage],()=>xe()),We([()=>l.widgetLangs,()=>n.languages],()=>{pe()},{deep:!0}),Ms(()=>{g.value={},y.value={}}),s({resetWidgetLangs:ve,openLanguageSelectModal:re}),(N,L)=>{const me=Pe("VDropdown"),G=Pe("InputField"),U=Pe("TextareaField"),R=Pe("Modal"),ee=He("svg-inline");return a(),d(Se,null,[e("div",{class:O({"mt-6":H.value})},[e("div",CB,[e("div",kB,[L[28]||(L[28]=e("span",{class:"font-normal text-sm text-grey600"},"Edit & Translate Widget Text",-1)),W(yt,null,{content:K(()=>L[26]||(L[26]=[e("div",{class:"p-3 w-96"},[e("span",null,[_e(" English will be the default language for all your visitors unless other languages are added. Edit the default widget text and pick the languages for widget translation. When visitors share the same browser language, they'll view the widget in that language. For instance, "),e("strong",null,"if you select Spanish and visitors have their browser language as Spanish, they'll see the widget in Spanish too.")])],-1)])),default:K(()=>[L[27]||(L[27]=e("img",{src:as,alt:""},null,-1))]),_:1})]),!x.value&&!H.value?(a(),ne(me,{key:0,theme:"chatway-upgradenow",triggers:["click"],placement:"left"},{popper:K(()=>[e("div",$B,[W(Ea)])]),default:K(()=>[e("div",{class:O(["inline-flex p-1.5 gap-3 justify-center items-center rounded hover:bg-[#FFFFFF1A] cursor-pointer",{"bg-[#FFFFFF1A]":v.value}])},L[29]||(L[29]=[e("img",{src:Da,alt:""},null,-1)]),2)]),_:1})):h("",!0)]),E.value&&!H.value?(a(),d("div",SB,[F(e("img",TB,null,512),[[ee]]),L[30]||(L[30]=e("span",{class:"text-[#ff4545]"},"Please click the publish button to save all changes",-1))])):h("",!0),e("button",{onClick:be,class:"p-2 bg-grey100 flex justify-between gap-16 group hover:bg-[#F3F9FF] w-full"},[e("span",MB,[F(e("img",AB,null,512),[[ee]]),T.value?(a(),d("span",EB,I(T.value)+" selected",1)):(a(),d("span",DB,"Translate widget"))]),F(e("img",IB,null,512),[[ee]])]),w.value?(a(),ne(R,{key:1,closeModal:w.value,"header-title":"Add Your Language",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:ve,onActionButtonTypeTwo:q,onCloseModal:de,footerTopBorder:"",topUpgradeButton:!P.value,topUpgradeButtonText:"Upgrade to enable multi-language support for your widget",classes:"md:!w-[800px]"},{FooterLeftContent:K(()=>[W(wB,{languages:g.value,onOnDefaultLanguageChange:X},null,8,["languages"])]),default:K(()=>[e("div",FB,[W(p(Dn),{class:"h-[278px] md:h-[478px] border-b md:border-none",defer:""},{default:K(()=>{var se;return[e("div",PB,[e("div",jB,[e("div",LB,[W(G,{forValue:"search",value:f.value,type:"search",placeholder:"Search",onInput:L[0]||(L[0]=Y=>f.value=Y),classes:"!py-2 !pl-8 !pr-2"},null,8,["value"]),e("label",RB,[F(e("img",BB,null,512),[[ee]])])])]),e("div",null,[(se=A.value)!=null&&se.length?(a(!0),d(Se,{key:0},Ne(A.value,Y=>{var Fe,oe,st,Le;return a(),d("div",{key:Y,title:Y.length>10?V(Y):"",class:O(["flex items-center justify-between gap-1 px-4 mr-3 py-[9px] hover:bg-primaryLight",{"border-l-4 border-orange-800 bg-red-200":_.value.has(Y)}])},[e("span",{onClick:le=>ae(Y),class:O(["text-base font-normal leading-5 uppercase select-none w-full truncate",(Fe=g.value[Y])!=null&&Fe.is_published?"text-primary":"text-grey900"])},I(V(Y)),11,OB),e("div",VB,[p(Ke.isEqual)(D.value[Y],p(l).widgetLangs[Y])?h("",!0):(a(),d("button",{key:0,onClick:le=>J(Y),class:"!p-0 !h-0",title:"Reset to default"},[F(e("img",GB,null,512),[[ee]])],8,UB)),e("input",{id:Y,onInput:le=>ce(Y),value:Y,type:"checkbox",checked:((oe=g.value[Y])==null?void 0:oe.is_published)||((st=g.value[Y])==null?void 0:st.is_default),disabled:((Le=g.value[Y])==null?void 0:Le.is_default)&&P.value,class:"w-4 h-4 rounded-sm border-[1.5px] border-grey600 checked:bg-primary focus:ring-0"},null,40,WB),e("label",{for:Y},null,8,qB)])],10,NB)}),128)):(a(),d("div",HB,"No language found"))])])]}),_:1}),W(p(Dn),{class:"h-[278px] md:h-[478px]",defer:""},{default:K(()=>[B.value?(a(),d("div",zB,[e("div",KB,[L[31]||(L[31]=e("h3",{class:"text-base font-semibold text-grey900 leading-5"},"Default Widget Text",-1)),e("h4",YB,I(V(c.value)),1)]),e("div",ZB,[e("div",JB,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/write-your-message.png`,alt:""},null,8,QB)]),default:K(()=>[L[32]||(L[32]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",XB,I(S.value.write_your_message),1)]),W(U,{modelValue:p(M).write_your_message.$model,"onUpdate:modelValue":L[1]||(L[1]=se=>p(M).write_your_message.$model=se),hasError:p(M).write_your_message.$error,validationMessage:p(M).write_your_message.$errors,forValue:"WriteYourMessage"},null,8,["modelValue","hasError","validationMessage"])]),e("div",eN,[e("div",tN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/team-here.png`,alt:""},null,8,sN)]),default:K(()=>[L[33]||(L[33]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",aN,I(S.value.team_here),1)]),W(U,{modelValue:p(M).team_here.$model,"onUpdate:modelValue":L[2]||(L[2]=se=>p(M).team_here.$model=se),hasError:p(M).team_here.$error,validationMessage:p(M).team_here.$errors,forValue:"OurTeamHere"},null,8,["modelValue","hasError","validationMessage"])]),e("div",oN,[e("div",nN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/team-online.png`,alt:""},null,8,iN)]),default:K(()=>[L[34]||(L[34]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",lN,I(S.value.team_online),1)]),W(U,{modelValue:p(M).team_online.$model,"onUpdate:modelValue":L[3]||(L[3]=se=>p(M).team_online.$model=se),hasError:p(M).team_online.$error,validationMessage:p(M).team_online.$errors,forValue:"AddEmail"},null,8,["modelValue","hasError","validationMessage"])]),e("div",rN,[e("div",dN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/away.png`,alt:""},null,8,uN)]),default:K(()=>[L[35]||(L[35]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",cN,I(S.value.away),1)]),W(U,{modelValue:p(M).away.$model,"onUpdate:modelValue":L[4]||(L[4]=se=>p(M).away.$model=se),hasError:p(M).away.$error,validationMessage:p(M).away.$errors,forValue:"WeAreAway"},null,8,["modelValue","hasError","validationMessage"])]),e("div",mN,[e("div",gN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/image-upload-error.png`,alt:""},null,8,pN)]),default:K(()=>[L[36]||(L[36]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",vN,I(S.value.image_upload_error),1)]),W(U,{modelValue:p(M).image_upload_error.$model,"onUpdate:modelValue":L[5]||(L[5]=se=>p(M).image_upload_error.$model=se),hasError:p(M).image_upload_error.$error,validationMessage:p(M).image_upload_error.$errors,forValue:"CouldNotUpload"},null,8,["modelValue","hasError","validationMessage"])]),e("div",fN,[e("div",hN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/visit-page.png`,alt:""},null,8,_N)]),default:K(()=>[L[37]||(L[37]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",yN,I(S.value.visit_page),1)]),W(U,{modelValue:p(M).visit_page.$model,"onUpdate:modelValue":L[6]||(L[6]=se=>p(M).visit_page.$model=se),hasError:p(M).visit_page.$error,validationMessage:p(M).visit_page.$errors,forValue:"VisitPage"},null,8,["modelValue","hasError","validationMessage"])]),e("div",bN,[e("div",wN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/click-set-email.png`,alt:""},null,8,xN)]),default:K(()=>[L[38]||(L[38]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",CN,I(S.value.click_set_email),1)]),W(U,{modelValue:p(M).click_set_email.$model,"onUpdate:modelValue":L[7]||(L[7]=se=>p(M).click_set_email.$model=se),hasError:p(M).click_set_email.$error,validationMessage:p(M).click_set_email.$errors,forValue:"SetEmailNotification"},null,8,["modelValue","hasError","validationMessage"])]),e("div",kN,[e("div",$N,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/update-you-at.png`,alt:""},null,8,SN)]),default:K(()=>[L[39]||(L[39]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",TN,I(S.value.update_you_at),1)]),W(U,{modelValue:p(M).update_you_at.$model,"onUpdate:modelValue":L[8]||(L[8]=se=>p(M).update_you_at.$model=se),hasError:p(M).update_you_at.$error,validationMessage:p(M).update_you_at.$errors,forValue:"WillUpdateYou"},null,8,["modelValue","hasError","validationMessage"])]),e("div",MN,[e("div",AN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/update-email.png`,alt:""},null,8,EN)]),default:K(()=>[L[40]||(L[40]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",DN,I(S.value.update_email),1)]),W(U,{modelValue:p(M).update_email.$model,"onUpdate:modelValue":L[9]||(L[9]=se=>p(M).update_email.$model=se),hasError:p(M).update_email.$error,validationMessage:p(M).update_email.$errors,forValue:"UpdateYourEmail"},null,8,["modelValue","hasError","validationMessage"])]),e("div",IN,[e("div",FN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/is-typing.png`,alt:""},null,8,PN)]),default:K(()=>[L[41]||(L[41]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",jN,I(S.value.typing_at),1)]),W(U,{modelValue:p(M).typing_at.$model,"onUpdate:modelValue":L[10]||(L[10]=se=>p(M).typing_at.$model=se),hasError:p(M).typing_at.$error,validationMessage:p(M).typing_at.$errors,forValue:"IsTyping"},null,8,["modelValue","hasError","validationMessage"])]),e("div",LN,[e("div",RN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/invalid-email.png`,alt:""},null,8,BN)]),default:K(()=>[L[42]||(L[42]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",NN,I(S.value.invalid_email),1)]),W(U,{modelValue:p(M).invalid_email.$model,"onUpdate:modelValue":L[11]||(L[11]=se=>p(M).invalid_email.$model=se),hasError:p(M).invalid_email.$error,validationMessage:p(M).invalid_email.$errors,forValue:"InvalidEmail"},null,8,["modelValue","hasError","validationMessage"])]),e("div",ON,[e("div",VN,[W(yt,{class:"shrink-0"},{content:K(()=>[L[43]||(L[43]=e("div",{class:"p-2 max-w-[234px] text-xs"},"Heading on the contact form when details are mandatory",-1)),e("img",{src:`${p(De)}images/initialte-chat.png`,alt:""},null,8,UN)]),default:K(()=>[L[44]||(L[44]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",GN,I(S.value.initiate_chat_with_details),1)]),W(U,{modelValue:p(M).initiate_chat_with_details.$model,"onUpdate:modelValue":L[12]||(L[12]=se=>p(M).initiate_chat_with_details.$model=se),hasError:p(M).initiate_chat_with_details.$error,validationMessage:p(M).initiate_chat_with_details.$errors,forValue:"ContactFormHeading"},null,8,["modelValue","hasError","validationMessage"])]),e("div",WN,[e("div",qN,[W(yt,{class:"shrink-0"},{content:K(()=>[L[45]||(L[45]=e("div",{class:"p-2 max-w-[234px] text-xs"},"Heading on the contact form when details are not mandatory",-1)),e("img",{src:`${p(De)}images/provide-your-details.png`,alt:""},null,8,HN)]),default:K(()=>[L[46]||(L[46]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",zN,I(S.value.provide_details_notified),1)]),W(U,{modelValue:p(M).provide_details_notified.$model,"onUpdate:modelValue":L[13]||(L[13]=se=>p(M).provide_details_notified.$model=se),hasError:p(M).provide_details_notified.$error,validationMessage:p(M).provide_details_notified.$errors,forValue:"FillContactDetails"},null,8,["modelValue","hasError","validationMessage"])]),e("div",KN,[e("div",YN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/form-details-shared.png`,alt:""},null,8,ZN)]),default:K(()=>[L[47]||(L[47]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",JN,I(S.value.form_details_shared),1)]),W(U,{modelValue:p(M).form_details_shared.$model,"onUpdate:modelValue":L[14]||(L[14]=se=>p(M).form_details_shared.$model=se),hasError:p(M).form_details_shared.$error,validationMessage:p(M).form_details_shared.$errors,forValue:"FormDetailsShared"},null,8,["modelValue","hasError","validationMessage"])]),e("div",QN,[e("div",XN,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/update-details.png`,alt:""},null,8,eO)]),default:K(()=>[L[48]||(L[48]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",tO,I(S.value.update_details),1)]),W(U,{modelValue:p(M).update_details.$model,"onUpdate:modelValue":L[15]||(L[15]=se=>p(M).update_details.$model=se),hasError:p(M).update_details.$error,validationMessage:p(M).update_details.$errors,forValue:"UpdateDetails"},null,8,["modelValue","hasError","validationMessage"])]),e("div",sO,[e("div",aO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/provide-your-details.png`,alt:""},null,8,oO)]),default:K(()=>[L[49]||(L[49]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",nO,I(S.value.name),1)]),W(U,{modelValue:p(M).name.$model,"onUpdate:modelValue":L[16]||(L[16]=se=>p(M).name.$model=se),hasError:p(M).name.$error,validationMessage:p(M).name.$errors,forValue:"Name"},null,8,["modelValue","hasError","validationMessage"])]),e("div",iO,[e("div",lO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/provide-your-details.png`,alt:""},null,8,rO)]),default:K(()=>[L[50]||(L[50]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",dO,I(S.value.email),1)]),W(U,{modelValue:p(M).email.$model,"onUpdate:modelValue":L[17]||(L[17]=se=>p(M).email.$model=se),hasError:p(M).email.$error,validationMessage:p(M).email.$errors,forValue:"Email"},null,8,["modelValue","hasError","validationMessage"])]),e("div",uO,[e("div",cO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/provide-your-details.png`,alt:""},null,8,mO)]),default:K(()=>[L[51]||(L[51]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",gO,I(S.value.phone_number),1)]),W(U,{modelValue:p(M).phone_number.$model,"onUpdate:modelValue":L[18]||(L[18]=se=>p(M).phone_number.$model=se),hasError:p(M).phone_number.$error,validationMessage:p(M).phone_number.$errors,forValue:"PhoneNumber"},null,8,["modelValue","hasError","validationMessage"])]),e("div",pO,[e("div",vO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/initialte-chat.png`,alt:""},null,8,fO)]),default:K(()=>[L[52]||(L[52]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",hO,I(S.value.start_chatting),1)]),W(U,{modelValue:p(M).start_chatting.$model,"onUpdate:modelValue":L[19]||(L[19]=se=>p(M).start_chatting.$model=se),hasError:p(M).start_chatting.$error,validationMessage:p(M).start_chatting.$errors,forValue:"StartChatting"},null,8,["modelValue","hasError","validationMessage"])]),e("div",_O,[e("div",yO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/provide-your-details.png`,alt:""},null,8,bO)]),default:K(()=>[L[53]||(L[53]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",wO,I(S.value.submit),1)]),W(U,{modelValue:p(M).submit.$model,"onUpdate:modelValue":L[20]||(L[20]=se=>p(M).submit.$model=se),hasError:p(M).submit.$error,validationMessage:p(M).submit.$errors,forValue:"Submit"},null,8,["modelValue","hasError","validationMessage"])]),e("div",xO,[e("div",CO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/widget-text-bubble.png`,alt:""},null,8,kO)]),default:K(()=>[L[54]||(L[54]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",$O,I(S.value.widget_text_bubble),1)]),W(U,{modelValue:p(M).widget_text_bubble.$model,"onUpdate:modelValue":L[21]||(L[21]=se=>p(M).widget_text_bubble.$model=se),hasError:p(M).widget_text_bubble.$error,validationMessage:p(M).widget_text_bubble.$errors,forValue:"WidgetTextBubble"},null,8,["modelValue","hasError","validationMessage"])]),e("div",SO,[e("div",TO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/working-hour-message.png`,alt:""},null,8,MO)]),default:K(()=>[L[55]||(L[55]=e("img",{class:"w-4 h-4 mt-1 hover:text-primary cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",AO,I(S.value.working_hour_message),1)]),W(U,{modelValue:p(M).working_hour_message.$model,"onUpdate:modelValue":L[22]||(L[22]=se=>p(M).working_hour_message.$model=se),hasError:p(M).working_hour_message.$error,validationMessage:p(M).working_hour_message.$errors,forValue:"UpdateDetails"},null,8,["modelValue","hasError","validationMessage"])]),e("div",EO,[e("div",DO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{src:`${p(De)}images/non-working-hour_message.png`,alt:""},null,8,IO)]),default:K(()=>[L[56]||(L[56]=e("img",{class:"w-4 h-4 mt-1 hover:text-primary cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",FO,I(S.value.none_working_hour_message),1)]),W(U,{modelValue:p(M).none_working_hour_message.$model,"onUpdate:modelValue":L[23]||(L[23]=se=>p(M).none_working_hour_message.$model=se),hasError:p(M).none_working_hour_message.$error,validationMessage:p(M).none_working_hour_message.$errors,forValue:"UpdateDetails"},null,8,["modelValue","hasError","validationMessage"])]),e("div",PO,[e("div",jO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{class:"w-56",src:`${p(De)}images/faq.png`,alt:""},null,8,LO)]),default:K(()=>[L[57]||(L[57]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",RO,I(S.value.faq),1)]),W(U,{modelValue:p(M).faq.$model,"onUpdate:modelValue":L[24]||(L[24]=se=>p(M).faq.$model=se),hasError:p(M).faq.$error,validationMessage:p(M).faq.$errors,forValue:"UpdateDetails"},null,8,["modelValue","hasError","validationMessage"])]),e("div",BO,[e("div",NO,[W(yt,{class:"shrink-0"},{content:K(()=>[e("img",{class:"w-56",src:`${p(De)}images/faq.png`,alt:""},null,8,OO)]),default:K(()=>[L[58]||(L[58]=e("img",{class:"w-4 h-4 mt-1 cursor-pointer",src:Vt,alt:""},null,-1))]),_:1}),e("label",VO,I(S.value.chat),1)]),W(U,{modelValue:p(M).chat.$model,"onUpdate:modelValue":L[25]||(L[25]=se=>p(M).chat.$model=se),hasError:p(M).chat.$error,validationMessage:p(M).chat.$errors,forValue:"UpdateDetails"},null,8,["modelValue","hasError","validationMessage"])])])):h("",!0)]),_:1})])]),_:1},8,["closeModal","topUpgradeButton"])):h("",!0)],2),W(xB,{showModal:C.value,onCloseModal:he,onSave:q},null,8,["showModal"])],64)}}});const GO=Oe(UO,[["__scopeId","data-v-4a48a0c4"]]),WO="/assets/list-a02facba.svg",qO={class:"mt-1"},HO={class:"flex items-center gap-1 mb-1"},zO={key:0,class:"flex items-center gap-1 mb-2"},KO={class:"w-4 h-4",src:to,alt:""},YO={class:"flex items-center gap-1"},ZO={src:WO,alt:"",class:"listIcon"},JO={key:0,class:"text-grey-900 group-hover:text-primary"},QO={key:1,class:"text-grey-900 group-hover:text-primary"},XO={src:Ao,alt:"",class:"arrowRight"},eV={class:"md:flex h-[70vh] md:h-full overflow-y-auto"},tV={class:"flex flex-col md:justify-between w-full md:w-[440px] md:h-[531px] border-r p-4"},sV={class:"space-y-4"},aV={class:"flex items-center justify-between text-sm font-normal text-grey900"},oV={class:"flex items-center gap-16"},nV={class:"form-group -mr-1"},iV=["id","checked","onInput"],lV=["for"],rV={class:"form-group mr-5"},dV=["id","checked","disabled","onInput"],uV=["for"],cV={key:0,class:"w-full p-3 bg-grey100 rounded-lg mt-2.5 mb-5"},mV={class:"flex items-center gap-2"},gV={class:"w-full md:w-[330px] md:h-[531px] p-4 border-t md:border-none"},pV=fe({__name:"WidgetContactInfoSelector",props:{defaultLanguage:{},activeWidgetColor:{},systemMessageIcon:{},isRemoveChatwayBranding:{type:Boolean}},emits:["save-contact-info"],setup(o,{expose:s,emit:t}){const n=ls(),l=As(),i=Es(),m=t,r=$(!1),u=$([]),g=$([]),y=$("opened"),c=$([{name:"Sapir",src:`${De}images/randomImage.svg`},{name:"Shalo",src:`${De}images/randomImage1.svg`},{name:"Erez",src:`${De}images/randomImage2.svg`}]),w=b(()=>u.value.filter(P=>P.is_visible).length),f=b(()=>!Ke.isEqual(u.value,l.contact_form)),v=b(()=>{const P=[{field_name:"name",is_required:0,is_visible:0},{field_name:"phone",is_required:0,is_enabled_country_code_format:!0,country_dialing_code:"none",is_visible:0},{field_name:"email",is_required:0,is_visible:1}];return l.id||(P[0].is_visible=1),P}),C=b(()=>{const P=i.countries.map(j=>({...j,customizedLabel:`${j.emoji} ${j.phoneCode.includes("+1")?"+1":j.phoneCode} (${j.code})`,name:`${j.emoji} ${j.name} (${j.phoneCode.includes("+1")?"+1":j.phoneCode})`}));return P.unshift({id:1,name:"None",customizedLabel:"None",code:"none",image:"",emoji:"",phoneCode:"none"}),P}),_=P=>{P.is_visible?P.is_visible=0:P.is_visible=1,P.is_visible||(P.is_required=0)},A=P=>{P.is_required?P.is_required=0:P.is_required=1},D=(P,j)=>{j.is_enabled_country_code_format=P},T=P=>{switch(P){case"name":return"Name";case"email":return"Email";default:return"Phone Number"}},B=()=>{g.value=Ke.cloneDeep(u.value),m("save-contact-info",Ke.cloneDeep(u.value)),r.value=!1},S=()=>{g.value.length?u.value=Ke.cloneDeep(g.value):u.value=Ke.merge(Ke.cloneDeep(v.value),Ke.cloneDeep(l.contact_form)),r.value=!1},E=()=>{x(),r.value=!1},x=()=>{g.value=[],u.value=Ke.merge(Ke.cloneDeep(v.value),Ke.cloneDeep(l.contact_form)),m("save-contact-info",Ke.cloneDeep(u.value))};return Xe(()=>{x()}),s({resetContactInfo:E}),(P,j)=>{const H=Pe("VDropdown"),k=Pe("ToggleSwitch"),M=Pe("Modal"),V=He("svg-inline");return a(),d("div",qO,[e("div",HO,[j[3]||(j[3]=e("span",{class:"font-normal text-sm text-grey600"},"Collect Contact Info",-1)),W(H,{triggers:["hover","click"],placement:"top"},{popper:K(()=>j[1]||(j[1]=[e("div",{class:"p-3 w-96"},[e("span",null," Customize your contact form with additional fields such as name and phone number. You can choose to include all three fields (name, email, phone) or any combination of two that suits your needs. ")],-1)])),default:K(()=>[j[2]||(j[2]=e("div",null,[e("img",{src:as,alt:""})],-1))]),_:1})]),p(n).name=="settings-design-view"&&f.value?(a(),d("div",zO,[F(e("img",KO,null,512),[[V]]),j[4]||(j[4]=e("span",{class:"text-[#ff4545]"},"Please click the publish button to save all changes",-1))])):h("",!0),e("button",{onClick:j[0]||(j[0]=Z=>r.value=!0),class:"p-2 bg-grey100 flex gap-16 group hover:bg-[#F3F9FF]"},[e("span",YO,[F(e("img",ZO,null,512),[[V]]),w.value?(a(),d("span",JO,I(w.value)+" selected",1)):(a(),d("span",QO,"Select fields"))]),F(e("img",XO,null,512),[[V]])]),r.value?(a(),ne(M,{key:1,closeModal:r.value,"header-title":"Collect Contact Info",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:E,onActionButtonTypeTwo:B,onCloseModal:S,footerTopBorder:"",classes:"md:!w-[770px]"},{default:K(()=>[e("div",eV,[e("div",tV,[e("div",sV,[j[7]||(j[7]=e("div",{class:"flex items-center justify-between text-xs font-semibold text-grey600"},[e("div",null,"Field"),e("div",{class:"flex items-center gap-8"},[e("div",null,"Show"),e("div",null,"Required")])],-1)),(a(!0),d(Se,null,Ne(u.value,Z=>(a(),d("div",{key:Z.field_name,class:""},[e("div",aV,[_e(I(T(Z.field_name))+" ",1),e("div",oV,[e("div",nV,[e("input",{id:"show-"+Z.field_name,checked:Z.is_visible==1,onInput:ae=>_(Z),type:"checkbox",class:"w-4 h-4 rounded-sm border-[1.5px] border-grey600 checked:bg-primary focus:ring-0"},null,40,iV),e("label",{for:"show-"+Z.field_name},null,8,lV)]),e("div",rV,[e("input",{id:"required-"+Z.field_name,checked:Z.is_required==1,disabled:Z.is_visible==0,onInput:ae=>A(Z),type:"checkbox",class:"w-4 h-4 rounded-sm border-[1.5px] border-grey600 checked:bg-primary focus:ring-0"},null,40,dV),e("label",{for:"required-"+Z.field_name},null,8,uV)])])]),Z.field_name==="phone"&&Z.is_visible?(a(),d("div",cV,[e("div",mV,[W(k,{value:Z.is_enabled_country_code_format,class:"!bg-grey200",onInput:ae=>D(ae,Z)},null,8,["value","onInput"]),j[5]||(j[5]=e("p",{class:"m-0 text-sm text-grey900 leading-leading400"},"Use country code formatting",-1))]),e("div",{class:O(["mt-4",{"opacity-60":!Z.is_enabled_country_code_format}])},[j[6]||(j[6]=e("label",{class:"text-sm leading-leading400 mb-1"},"Add a default country code",-1)),W(ga,{items:C.value,bindValue:"code",showPhoneCustomizedLabel:!0,disabled:!Z.is_enabled_country_code_format,modelValue:Z.country_dialing_code,"onUpdate:modelValue":ae=>Z.country_dialing_code=ae,class:"!mb-0"},null,8,["items","disabled","modelValue","onUpdate:modelValue"])],2)])):h("",!0)]))),128))]),j[8]||(j[8]=e("div",{class:"flex items-start gap-1 mt-6 md:mt-0"},[e("img",{src:as,alt:""}),e("div",{class:"text-xs font-normal text-grey600"},'Turning on the "Required" field requires users to fill out the field before they can contact support.')],-1))]),e("div",gV,[W(an,{activeWidgetColor:P.activeWidgetColor,activeWidgetStateKey:y.value,thumbnailList:c.value,showPreviewToggle:!1,showUserMessage:!1,contact_fields:u.value,canClose:!1,defaultLanguage:P.defaultLanguage,systemMessageIcon:P.systemMessageIcon,isRemoveChatwayBranding:P.isRemoveChatwayBranding,showPreviewHeader:!1},null,8,["activeWidgetColor","activeWidgetStateKey","thumbnailList","contact_fields","defaultLanguage","systemMessageIcon","isRemoveChatwayBranding"])])])]),_:1},8,["closeModal"])):h("",!0)])}}});const vV=Oe(pV,[["__scopeId","data-v-7224afc0"]]),fV={class:"widget-effect mt-1"},hV={class:"flex items-center justify-content-between"},_V={class:"flex items-center gap-1 mb-1"},yV={class:"relative inline-block w-[222px] text-sm"},bV={class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},wV={class:"select-arrow",src:Tt},xV={class:"bg-white mt-1 w-full dropDown absolute z-10 rounded-lg py-2 bottom-[33px]"},CV=["onClick"],kV=fe({__name:"WidgetAttentionEffectsSelector",props:{effectOptions:{},activeWidgetEffectKey:{}},emits:["change-effect"],setup(o,{emit:s}){const t=o,n=s,l=$(!1),i=()=>{l.value=!l.value},m=g=>{n("change-effect",g.key),l.value=!1},r=g=>{var c;const y=(c=t.effectOptions)==null?void 0:c.find(w=>w.key===g);return y?y.name:null},u=g=>{var y;l.value&&!((y=document.querySelector(".widget-attention-effects-selector"))!=null&&y.contains(g.target))&&(l.value=!1)};return Xe(()=>{document.addEventListener("click",u)}),Ms(()=>{document.removeEventListener("click",u)}),(g,y)=>{const c=He("svg-inline");return a(),d("div",fV,[e("div",hV,[e("div",_V,[y[2]||(y[2]=e("span",{class:"item-title"},"Attention Effect",-1)),W(yt,null,{content:K(()=>y[0]||(y[0]=[e("div",{class:"p-3 w-96"},[e("span",null,"Add an eye-catching effect to your widget. These attention effects will increase your click rate and increase the visibility of your Chatway widget.")],-1)])),default:K(()=>[y[1]||(y[1]=e("img",{src:as,alt:""},null,-1))]),_:1})])]),e("div",yV,[e("div",{onClick:i,class:"custom-select widget-attention-effects-selector block w-full cursor-pointer text-[#282d3e] pointer relative py-1 px-2 border border-[#e6e6f0] rounded-lg"},[e("div",{class:O(["",{open:l.value}])},I(g.activeWidgetEffectKey?r(g.activeWidgetEffectKey):"Select an option"),3),e("div",bV,[F(e("img",wV,null,512),[[c]])])]),F(e("ul",xV,[(a(!0),d(Se,null,Ne(g.effectOptions,w=>(a(),d("li",{key:w.key,onClick:f=>m(w),class:"py-1 cursor-pointer px-2 m-0 text-sm text-[#282D3E] hover:bg-grey100"},I(w.name),9,CV))),128))],512),[[Gt,l.value]])])])}}});const $V=Oe(kV,[["__scopeId","data-v-ef1f81c3"]]),kr="/assets/plus-2-f431d9d9.svg",zi={is_enable_working_hour_message:!1,timezone:"America/New_York",is_enable_none_working_hour_message:!1,only_send_when_all_agent_offline:!1,working_hour_message:"Hi, our agent will connect with you shortly.",none_working_hour_message:"Hi, thank you for messaging. Please write your question, and we will contact you during our working hours.",working_hours:{sunday:{is_enable:!1,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},monday:{is_enable:!0,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},tuesday:{is_enable:!0,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},wednesday:{is_enable:!0,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},thursday:{is_enable:!0,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},friday:{is_enable:!0,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]},saturday:{is_enable:!1,hours:[{start_at:"09:00 AM",end_at:"05:00 PM",id:is()}]}}},SV={class:"font-medium text-gray-500 capitalize"},Ho=fe({__name:"Switch",props:{modelValue:{type:Boolean,required:!0},label:String},emits:["update:modelValue"],setup(o,{emit:s}){const t=s,n=o,l=b({get:()=>n.modelValue||!1,set:i=>{t("update:modelValue",i)}});return(i,m)=>(a(),ne(p(Pd),{as:"div",class:"flex items-center"},{default:K(()=>[W(p(Id),{modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=r=>l.value=r),class:O([l.value?"bg-primary":"bg-gray-200","!p-0 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-0 "])},{default:K(()=>[e("span",{"aria-hidden":"true",class:O([l.value?"translate-x-5":"translate-x-0","pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"])},null,2)]),_:1},8,["modelValue","class"]),o.label?(a(),ne(p(Fd),{key:0,as:"span",class:"ml-1.5 text-sm"},{default:K(()=>[e("span",SV,I(o.label),1)]),_:1})):h("",!0)]),_:1}))}}),TV={class:"flex gap-1 items-center"},MV=fe({__name:"TimeRangePicker",props:{modelValue:{type:Object},disable:{type:Boolean,required:!1},dropUp:{type:Boolean,default:!1,required:!1}},emits:["update:modelValue","startAt","endAt"],setup(o,{emit:s}){const t=s,n=o;Xe(()=>{n.modelValue&&(l.value=n.modelValue.start_at,i.value=n.modelValue.end_at)});const l=$("09:00 AM"),i=$("05:00 PM");We(()=>[l,i],()=>{t("update:modelValue",{start_at:l.value,end_at:i.value}),t("startAt",l.value),t("endAt",i.value)},{deep:!0});const m=b(()=>{const r=xt("2000/01/01 "+l.value,"YYYY/MM/DD hh:mm A"),u=xt("2000/01/01 "+i.value,"YYYY/MM/DD hh:mm A");return r.isAfter(u,"minute")||r.isSame(u)});return(r,u)=>(a(),d("div",TV,[W(ra,{"drop-up":o.dropUp,"has-error":m.value,disable:o.disable,modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=g=>l.value=g)},null,8,["drop-up","has-error","disable","modelValue"]),u[2]||(u[2]=e("span",{class:"text-xs text-grey-300"},"to",-1)),W(ra,{"drop-up":o.dropUp,"has-error":m.value,disable:o.disable,modelValue:i.value,"onUpdate:modelValue":u[1]||(u[1]=g=>i.value=g)},null,8,["drop-up","has-error","disable","modelValue"])]))}}),AV={class:"textarea-field"},EV=["for"],DV=["value","placeholder","id","readonly"],IV={class:"error-message"},FV=fe({__name:"TextareaField",props:{label:{},modelValue:{},hasError:{type:Boolean},forValue:{},placeholder:{default:""},readonly:{type:Boolean,default:!1},validationMessage:{},classes:{}},emits:["update:modelValue"],setup(o,{emit:s}){const t=o,n=s,l=b(()=>t.modelValue?Ds(t.modelValue):!1),i=r=>{const u=r.target;n("update:modelValue",u.value)},m=b(()=>!t.modelValue||t.modelValue.length<20?"h-40":t.modelValue.length<40?"h-80":"min-h-80");return(r,u)=>(a(),d("div",AV,[r.label?(a(),d("label",{key:0,for:r.forValue},I(r.label),9,EV)):h("",!0),e("textarea",{value:r.modelValue,placeholder:r.placeholder,id:r.forValue,readonly:r.readonly,class:O([{error:r.hasError,rtl:l.value},r.classes,m.value]),onInput:i},null,42,DV),(a(!0),d(Se,null,Ne(r.validationMessage,(g,y)=>(a(),d("div",{key:y},[e("span",IV,I(g.$message),1)]))),128))]))}});const Bn=Oe(FV,[["__scopeId","data-v-1cc9786b"]]),PV={class:"mt-1 font-normal text-sm"},jV={key:0,class:"flex items-center gap-1 mb-2"},LV={class:"w-4 h-4",src:to,alt:""},RV={class:"flex items-center gap-1"},BV={src:So,alt:""},NV={key:0,class:"text-grey-900 group-hover:text-primary"},OV={key:1,class:"text-grey-900 group-hover:text-primary"},VV={key:2,class:"text-grey-900 group-hover:text-primary"},UV={key:3,class:"text-grey-900 group-hover:text-primary"},GV={src:Ao,class:"arrowRight"},WV={class:"grow p-4 overflow-y-auto"},qV={class:"mb-6"},HV={class:"inline-flex gap-2"},zV={key:0,class:"mt-1 text-xs text-[#FF4545] max-w-[312px]"},KV={class:"flex flex-col gap-2"},YV={class:"flex flex-col gap-3 mt-2"},ZV=["onClick","disabled"],JV={src:kr,alt:""},QV=["onClick"],XV={src:wo,alt:""},eU={class:"w-full md:w-[350px] bg-gray-50 p-4 overflow-y-auto"},tU={key:0,class:"flex gap-1 text-red-500"},sU={class:"!my-px w-4 h-4",src:to,alt:""},aU=fe({__name:"WidgetAutomatedMessageSettings",props:{noneWorkingHourMessage:String,workingHourMessage:String,payloadAutomatedMessageSettings:{type:Object,required:!0}},emits:["change-settings"],setup(o,{expose:s,emit:t}){const n=o,{width:l,height:i}=Ht(),m=As(),r=t,u=$(!1),g=b(()=>fo),y=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],c=$(Ke.cloneDeep(zi)),w=$(),f=(k,M)=>{const V=xt("2000/01/01 "+k,"YYYY/MM/DD hh:mm A"),Z=xt("2000/01/01 "+M.end_at,"YYYY/MM/DD hh:mm A");return V.isBefore(Z,"minute")},v={working_hour_message:{required:Ye.withMessage("Please add working hours message",k=>!c.value.is_enable_working_hour_message||k.trim()!==""),maxLength:Ye.withMessage("Please shorten your message to less than 1,000 characters",It(1e3))},none_working_hour_message:{required:Ye.withMessage("Please add non-working hours message",k=>!c.value.is_enable_none_working_hour_message||c.value.is_enable_none_working_hour_message&&k.trim()!==""),maxLength:Ye.withMessage("Please shorten your message to less than 1,000 characters",It(1e3))},working_hours:{sunday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},monday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},tuesday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},wednesday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},thursday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},friday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}},saturday:{hours:{$each:Ye.forEach({start_at:{before_end_at:Ye.withMessage("Invalid start time",f)}})}}}},C=bs(v,c,{$scope:!1,$stopPropagation:!0}),_=b(()=>{var k,M,V,Z,ae;return(M=(k=m.attributes)==null?void 0:k.automated_message_settings)!=null&&M.timezone&&((Z=(V=m.attributes)==null?void 0:V.automated_message_settings)!=null&&Z.working_hours)?!Ke.isEqual(c.value,(ae=m.attributes)==null?void 0:ae.automated_message_settings):!Ke.isEqual(c.value,w.value)}),A=b(()=>Ke.isEqual(c.value,n.payloadAutomatedMessageSettings));function D(){if(C.value.$touch(),C.value.$invalid)return;const k=[];for(const[V,Z]of Object.entries(c.value.working_hours))Z.hours.forEach(ae=>{k.push(`${V}${ae.start_at}${ae.end_at}${Z.is_enable.toString()}`.replace(/\s/g,""))});if(k.some((V,Z)=>k.indexOf(V)!==Z)){ze().set({message:"Duplicate time slot is not allowed",type:"error"});return}r("change-settings",Ke.cloneDeep(c.value)),P()}function T(){if(u.value=!1,_.value&&!A.value){c.value=Ke.cloneDeep(n.payloadAutomatedMessageSettings);return}}function B(){j(),P()}function S(k){c.value.working_hours[k].is_enable&&c.value.working_hours[k].hours.push({start_at:"09:00 AM",end_at:"05:00 PM",id:is()})}function E(k,M){c.value.working_hours[k].hours.splice(M,1)}function x(){u.value=!0}function P(){u.value=!1}async function j(){var k,M,V,Z;(M=(k=m.attributes)==null?void 0:k.automated_message_settings)!=null&&M.working_hours?c.value=Ke.cloneDeep(m.attributes.automated_message_settings):c.value=Ke.cloneDeep(zi),(Z=(V=m.attributes)==null?void 0:V.automated_message_settings)!=null&&Z.timezone||await H(),w.value=Ke.cloneDeep(c.value),r("change-settings",Ke.cloneDeep(c.value))}async function H(){const k=await cr(),M=g.value.find(V=>V.id.toLowerCase()===k.toLowerCase());M&&(c.value.timezone=M.id)}return We(()=>[n.workingHourMessage,n.noneWorkingHourMessage],()=>{c.value.working_hour_message=n.workingHourMessage||"",c.value.none_working_hour_message=n.noneWorkingHourMessage||""}),Xe(async()=>{j()}),s({onCancel:B}),(k,M)=>{const V=Pe("Modal"),Z=He("svg-inline");return a(),d("div",PV,[W(Ns,{"label-text":"Set Automated Messages","tooltip-text":"Send automated messages to your website visitors during work hours and off-work hours"}),_.value?(a(),d("div",jV,[F(e("img",LV,null,512),[[Z]]),M[6]||(M[6]=e("span",{class:"text-[#ff4545]"},"Please click the publish button to save all changes",-1))])):h("",!0),e("button",{onClick:x,class:"p-2 min-w-[190px] bg-grey100 flex justify-content-between gap-2 group hover:bg-main100"},[e("span",RV,[F(e("img",BV,null,512),[[Z]]),c.value.is_enable_none_working_hour_message&&c.value.is_enable_working_hour_message?(a(),d("span",NV," Working hours & non-working hours ")):c.value.is_enable_working_hour_message?(a(),d("span",OV,"Working hours")):c.value.is_enable_none_working_hour_message?(a(),d("span",VV,"Non-working hours")):(a(),d("span",UV,"None"))]),F(e("img",GV,null,512),[[Z]])]),u.value?(a(),ne(V,{key:1,closeModal:u.value,"header-title":"Set Automated Messages",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:B,onActionButtonTypeTwo:D,onCloseModal:T,footerTopBorder:"",classes:"md:!w-[800px] "},{FooterLeftContent:K(()=>[!c.value.is_enable_working_hour_message&&!c.value.is_enable_none_working_hour_message?(a(),d("div",tU,[F(e("img",sU,null,512),[[Z]]),M[12]||(M[12]=e("p",{class:"!m-0 text-sm text-red-500"},[_e(" Currently, no automated messages are being sent. "),e("br"),_e(" Please enable messages for working and non-working hours ")],-1))])):h("",!0)]),default:K(()=>{var ae,ce,J;return[e("div",{class:O(["md:flex max-h-[34rem] overflow-y-auto",[p(i)<=1080&&p(l)<=767||p(i)<=700&&p(l)>767?"h-[calc(100vh-200px)]":"h-full"]])},[e("div",WV,[M[10]||(M[10]=e("p",{class:"text-500 !mt-0 mb-2 font-bold"},"Setup working hours",-1)),e("div",qV,[e("div",HV,[W(ga,{classes:"h-8 !w-[20rem]",class:"!mb-0",modelValue:c.value.timezone,"onUpdate:modelValue":M[0]||(M[0]=X=>c.value.timezone=X),items:g.value,placeholder:"Select Timezone"},null,8,["modelValue","items"]),W(yt,null,{content:K(()=>M[7]||(M[7]=[e("div",{class:"p-3 w-96"},[e("span",null,"Please note that the timezone you select here will also be applied to other places. If you've chosen a different timezone elsewhere, it will be updated.")],-1)])),default:K(()=>[M[8]||(M[8]=e("img",{src:as,class:"mt-2",alt:""},null,-1))]),_:1})]),(ce=(ae=p(m).attributes)==null?void 0:ae.automated_message_settings)!=null&&ce.timezone&&c.value.timezone!=((J=p(m).attributes)==null?void 0:J.automated_message_settings.timezone)?(a(),d("div",zV,M[9]||(M[9]=[e("strong",null,"Please note",-1),_e(" that the timezone you select here will apply to other places with timezone option ")]))):h("",!0)]),e("div",KV,[(a(),d(Se,null,Ne(y,X=>e("div",{class:"flex items-start",key:X},[W(Ho,{class:"shrink min-w-[145px] mt-3",modelValue:c.value.working_hours[X].is_enable,"onUpdate:modelValue":z=>c.value.working_hours[X].is_enable=z,label:X[0].toUpperCase()+X.substring(1).toLowerCase()},null,8,["modelValue","onUpdate:modelValue","label"]),e("div",YV,[(a(!0),d(Se,null,Ne(c.value.working_hours[X].hours,(z,q)=>(a(),d("div",{class:"flex items-center gap-2",key:`${X}-hours${z.id}`},[W(MV,{disable:!c.value.working_hours[X].is_enable,"model-value":c.value.working_hours[X].hours[q],onStartAt:ue=>c.value.working_hours[X].hours[q].start_at=ue,onEndAt:ue=>c.value.working_hours[X].hours[q].end_at=ue,"drop-up":X!=="sunday"&&X!=="monday"},null,8,["disable","model-value","onStartAt","onEndAt","drop-up"]),q===0?(a(),d("button",{key:0,type:"button",onClick:ue=>S(X),disabled:!c.value.working_hours[X].is_enable,class:"bg-gray-100 rounded-md p-2 text-grey-500 shadow-sm hover:bg-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:opacity-60 disabled:!bg-grey100"},[F(e("img",JV,null,512),[[Z]])],8,ZV)):h("",!0),q>0?(a(),d("button",{key:1,type:"button",onClick:ue=>E(X,q),class:"bg-gray-100 rounded-md p-2 text-grey-500 shadow-sm hover:bg-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},[F(e("img",XV,null,512),[[Z]])],8,QV)):h("",!0)]))),128))])])),64))])]),e("div",eU,[M[11]||(M[11]=e("p",{class:"m-0 text-sm font-semibold"},"Your Messages",-1)),W(Ho,{class:"my-2",modelValue:c.value.is_enable_working_hour_message,"onUpdate:modelValue":M[1]||(M[1]=X=>c.value.is_enable_working_hour_message=X),label:"Working hours"},null,8,["modelValue"]),W(Bn,{modelValue:c.value.working_hour_message,"onUpdate:modelValue":M[2]||(M[2]=X=>c.value.working_hour_message=X),placeholder:"Write your message here","for-value":"working-hour",classes:"!h-[150px] !w-full bg-white","has-error":p(C).working_hour_message.$error,"validation-message":p(C).working_hour_message.$errors},null,8,["modelValue","has-error","validation-message"]),W(Ho,{class:"mt-4 mb-2",modelValue:c.value.is_enable_none_working_hour_message,"onUpdate:modelValue":M[3]||(M[3]=X=>c.value.is_enable_none_working_hour_message=X),label:"Non-working hours"},null,8,["modelValue"]),W(Bn,{modelValue:c.value.none_working_hour_message,"onUpdate:modelValue":M[4]||(M[4]=X=>c.value.none_working_hour_message=X),placeholder:"Write your message here","for-value":"non-working-hour",classes:"!h-[150px] !w-full bg-white","has-error":p(C).none_working_hour_message.$error,"validation-message":p(C).none_working_hour_message.$errors},null,8,["modelValue","has-error","validation-message"]),c.value.is_enable_none_working_hour_message?(a(),ne(ja,{key:0,id:"only_send_when_all_agent_offline",class:"mt-3",modelValue:c.value.only_send_when_all_agent_offline,"onUpdate:modelValue":M[5]||(M[5]=X=>c.value.only_send_when_all_agent_offline=X),"hint-text":"Send only when all agents are offline"},null,8,["modelValue"])):h("",!0)])],2)]}),_:1},8,["closeModal"])):h("",!0)])}}});const oU=Oe(aU,[["__scopeId","data-v-0ce22bd8"]]),nU="/assets/grey-eye-42512cdd.svg",iU="/assets/active-plus-b936697d.svg",lU={key:0,class:"flex items-center gap-1 mb-2"},rU={class:"w-4 h-4",src:to,alt:""},dU={class:"flex items-center gap-[0.25rem]"},uU={src:nU,alt:"eye"},cU={class:"text-sm leading-leading400 text-grey900 my-0"},mU={src:Ao,class:"stroke-grey600 mt-[2px]",alt:""},gU={class:"mb-6"},pU={class:"inline-flex gap-2"},vU={key:0,class:"mt-1 text-xs text-[#FF4545] max-w-[312px]"},fU={class:"flex items-center gap-2"},hU={key:0},_U={class:"inline-flex flex-column items-center gap-1 bg-grey100 p-2 rounded-lg h-8"},yU=["onClick"],bU=["onClick"],wU={class:"relative"},xU=["min","max","onUpdate:modelValue"],CU=["onClick"],kU={src:iU,class:"w-5 h-5",alt:""},$U=fe({__name:"WidgetCustomVisibility",emits:["saveCustomWidgetVisibility"],setup(o,{expose:s,emit:t}){const n=As(),l=t,i=$(null),m=$(!1),r=Nt({timezone:"",weekDays:[{day:"Sunday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Monday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Tuesday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Wednesday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Thursday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Friday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0},{day:"Saturday",start_time:"12:00 AM",end_time:"11:59 PM",is_published:!0,is_custom:0}],specialDates:[]}),u=Nt({timezone:"",weekDays:[],specialDates:[]}),g=Nt({timezone:"",weekDays:[],specialDates:[]}),y=b(()=>n.visibilityHours),c=b(()=>{const z=r.weekDays.filter(ue=>ue.is_published).length,q=r.specialDates.length;return z===7&&!q?"Show always":!z&&q?`${q} specific ${q>1?"dates":"date"}`:z&&!q?`${z} ${z>1?"days":"day"} a week`:!z&&!q?"Never show the widget":`${z} ${z>1?"days":"day"} a week + ${q} specific ${q>1?"dates":"date"}`}),w=b(()=>!Ke.isEqual(r,u)),f=()=>{r.specialDates.push({start_time:"12:00 AM",end_time:"11:59 PM",is_published:1,is_custom:1,custom_date:xt().format("YYYY-MM-DD")}),Ft(()=>{C()})},v=z=>{r.specialDates.splice(z,1)},C=()=>{const z=i==null?void 0:i.value;z&&z.scrollTo&&z.scrollTo(0,z.scrollHeight)},_=(z,q)=>{r.specialDates[z].is_published=q},A=(z,q)=>{const ue=xt("2000/01/01 "+q.start_time,"YYYY/MM/DD hh:mm");return xt("2000/01/01 "+z,"YYYY/MM/DD hh:mm").isAfter(ue,"minute")},D=(z,q)=>{const ue=xt("2000/01/01 "+z,"YYYY/MM/DD hh:mm"),pe=xt("2000/01/01 "+q.end_time,"YYYY/MM/DD hh:mm");return ue.isBefore(pe,"minute")},T=z=>{const q=xt().subtract(1,"day");return xt(z).isAfter(q)},B={timezone:{required:Ye.withMessage("Timezone is required",ut)},weekDays:{$each:Ye.forEach({start_time:{required:Ye.withMessage("Start time is required",ut),before_end_date:Ye.withMessage("Invalid start time",D)},end_time:{required:Ye.withMessage("End time is required",ut),after_start_date:Ye.withMessage("Invalid end time",A)}})},specialDates:{$each:Ye.forEach({start_time:{required:Ye.withMessage("Start time is required",ut),before_end_date:Ye.withMessage("Invalid start time",D)},end_time:{required:Ye.withMessage("End time is required",ut),after_start_date:Ye.withMessage("Invalid end time",A)},custom_date:{required:Ye.withMessage("Date is required",ut),is_valid_date:Ye.withMessage("Invalid date",T)}})}},S=bs(B,r,{$scope:!1,$stopPropagation:!0}),E=()=>{S.value.$touch(),!S.value.$invalid&&(g.timezone=r.timezone,g.weekDays=Ke.cloneDeep(r.weekDays),g.specialDates=Ke.cloneDeep(r.specialDates),l("saveCustomWidgetVisibility",P()),k())},x=async()=>{var pe,de;if((pe=n.attributes)!=null&&pe.timezone?r.timezone=(de=n.attributes)==null?void 0:de.timezone:await X(),!y.value.length){u.timezone=r.timezone,u.weekDays=Ke.cloneDeep(r.weekDays),u.specialDates=Ke.cloneDeep(r.specialDates);return}let z=[];const q=[];y.value.forEach(he=>{J(he.start_time)&&(he.start_time=ae(he.start_time)),J(he.end_time)&&(he.end_time=ae(he.end_time)),he.is_custom===0?(delete he.custom_date,z.push({...he,is_published:he.is_published===1})):(delete he.day,q.push(he))});const ue=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];z=z.sort((he,ve)=>{const be=ue.indexOf(he.day),re=ue.indexOf(ve.day);return be-re}),r.weekDays=Ke.cloneDeep(z),r.specialDates=Ke.cloneDeep(q),u.timezone=r.timezone,u.weekDays=Ke.cloneDeep(z),u.specialDates=Ke.cloneDeep(q),g.timezone="",g.weekDays=[],g.specialDates=[]},P=()=>{const z=[];r.weekDays.forEach(ue=>{z.push({...ue,is_published:ue.is_published?1:0})});const q=[...Ke.cloneDeep(z),...Ke.cloneDeep(r.specialDates)].map(ue=>(ue.start_time=ce(ue.start_time),ue.end_time=ce(ue.end_time),ue));return{timezone:r.timezone,visibility_hours:q}},j=async()=>{await x(),l("saveCustomWidgetVisibility",P())},H=()=>{g.timezone?(r.timezone=g.timezone,r.weekDays=Ke.cloneDeep(g.weekDays),r.specialDates=Ke.cloneDeep(g.specialDates)):(r.timezone=u.timezone,r.weekDays=Ke.cloneDeep(u.weekDays),r.specialDates=Ke.cloneDeep(u.specialDates))},k=()=>{m.value=!1},M=()=>{H(),k()},V=()=>{j(),y.value.length||(g.timezone=""),H(),k()},Z=z=>{const q=r.weekDays[z].start_time,ue=r.weekDays[z].end_time,pe=xt("2000/01/01 "+q,"YYYY/MM/DD hh:mm"),de=xt("2000/01/01 "+ue,"YYYY/MM/DD hh:mm");(pe.isAfter(de,"minute")||pe.isSame(de,"minute"))&&(r.weekDays[z].start_time="12:00 AM",r.weekDays[z].end_time="11:59 PM")},ae=z=>{const[q,ue]=z.split(":"),pe=+q%24,de=pe%12||12;return(de<10?"0"+de:de)+":"+ue+" "+(pe<12?"AM":"PM")},ce=z=>{const[q,ue]=z.split(" ");let[pe,de]=q.split(":");return ue==="PM"&&pe!=="12"&&(pe=String(Number(pe)+12)),ue==="AM"&&pe==="12"&&(pe="00"),`${pe}:${de}`},J=z=>/^(?:[01]\d|2[0-3]):(?:[0-5]\d)$/.test(z),X=async()=>{const z=await cr(),q=fo.find(ue=>ue.id.toLowerCase()===z.toLowerCase());r.timezone=q?q.id:"Asia/Jerusalem"};return We(()=>n.visibilityHours,()=>{x()}),Xe(()=>{j()}),Ms(()=>{u.timezone="",u.weekDays=[],u.specialDates=[],g.timezone="",g.weekDays=[],g.specialDates=[]}),s({resetCustomVisibility:V}),(z,q)=>{const ue=Pe("Modal"),pe=He("svg-inline");return a(),d("div",null,[W(Ns,{"label-text":"Set Custom Visibility of Widget","tooltip-text":"Customize when your widget appears by selecting specific days, hours, and even setting specific dates."}),w.value?(a(),d("div",lU,[F(e("img",rU,null,512),[[pe]]),q[2]||(q[2]=e("span",{class:"text-[#ff4545]"},"Please click the publish button to save all changes",-1))])):h("",!0),e("div",{class:"inline-flex justify-between bg-grey100 rounded p-2 cursor-pointer min-w-[190px]",onClick:q[0]||(q[0]=de=>m.value=!0)},[e("div",dU,[F(e("img",uU,null,512),[[pe]]),e("p",cU,I(c.value),1)]),F(e("img",mU,null,512),[[pe]])]),m.value?(a(),ne(ue,{key:1,closeModal:m.value,headerTitle:"Set Custom Visibility of Widget",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",onActionButtonTypeOne:V,onActionButtonTypeTwo:E,onCloseModal:M,footerTopBorder:"",classes:"md:!w-[40.5rem]"},{FooterLeftContent:K(()=>[e("div",{class:"inline-flex items-center gap-2 cursor-pointer",onClick:f},[F(e("img",kU,null,512),[[pe]]),q[11]||(q[11]=e("p",{class:"text-sm text-primary leading-[1.225rem] my-0"},"Add Special Date",-1))])]),default:K(()=>[e("div",{ref_key:"customWidgetVisibilityView",ref:i,class:"pt-4 px-4 max-h-[34.18rem] overflow-y-auto"},[e("div",gU,[e("div",pU,[W(ga,{classes:"h-8 !w-[20rem]",class:"!mb-0",modelValue:r.timezone,"onUpdate:modelValue":q[1]||(q[1]=de=>r.timezone=de),items:p(fo),hasError:p(S).timezone.$error,validationMessage:p(S).timezone.$errors,placeholder:"Select Timezone"},null,8,["modelValue","items","hasError","validationMessage"]),W(yt,null,{content:K(()=>q[3]||(q[3]=[e("div",{class:"p-3 w-96"},[e("span",null,"Please note that the timezone you select here will also be applied to other places. If you've chosen a different timezone elsewhere, it will be updated.")],-1)])),default:K(()=>[q[4]||(q[4]=e("img",{src:as,class:"mt-2",alt:""},null,-1))]),_:1})]),r.timezone!=u.timezone?(a(),d("div",vU,q[5]||(q[5]=[e("strong",null,"Please note",-1),_e(" that the timezone you select here will apply to other places with timezone option ")]))):h("",!0)]),(a(!0),d(Se,null,Ne(r.weekDays,(de,he)=>(a(),d("div",{key:de,class:"flex items-center justify-between mb-5"},[W(Ho,{class:"shrink min-w-[145px]",modelValue:de.is_published,"onUpdate:modelValue":[ve=>de.is_published=ve,ve=>Z(he)],label:de.day},null,8,["modelValue","onUpdate:modelValue","label"]),e("div",fU,[W(ra,{modelValue:de.start_time,"onUpdate:modelValue":ve=>de.start_time=ve,dropUp:he>2,disable:!de.is_published,"has-error":!!p(S).weekDays.$each.$response.$errors[he].start_time.length,class:"w-[7.5rem]"},null,8,["modelValue","onUpdate:modelValue","dropUp","disable","has-error"]),q[6]||(q[6]=e("span",{class:"text-xs text-grey-300"},"to",-1)),W(ra,{modelValue:de.end_time,"onUpdate:modelValue":ve=>de.end_time=ve,dropUp:he>2,disable:!de.is_published,"has-error":!!p(S).weekDays.$each.$response.$errors[he].end_time.length,class:"w-[7.5rem]"},null,8,["modelValue","onUpdate:modelValue","dropUp","disable","has-error"])])]))),128)),r.specialDates.length?(a(),d("div",hU,[q[9]||(q[9]=e("div",{class:"w-full h-[0.025rem] bg-grey200 my-1"},null,-1)),q[10]||(q[10]=e("p",{class:"text-sm text-grey900 font-semibold leading-[1.225rem]"},"Special Dates",-1)),(a(!0),d(Se,null,Ne(r.specialDates,(de,he)=>(a(),d("div",{key:de,class:"flex items-center flex-wrap gap-2 mb-5"},[e("div",_U,[e("div",{onClick:ve=>_(he,1),class:O(["w-[4.375rem] px-4 py-[0.125rem] text-sm leading-[1.225rem] cursor-pointer",[de.is_published===1?"rounded-md bg-white text-primary":"text-grey600"]])}," Show ",10,yU),e("div",{onClick:ve=>_(he,0),class:O(["w-[4.375rem] h-[1.5rem] px-4 py-[0.125rem] text-sm leading-[1.225rem] cursor-pointer",[de.is_published===0?"rounded-md bg-white text-primary":"text-grey600"]])}," Hide ",10,bU)]),e("div",wU,[F(e("input",{type:"date",min:p(xt)().format("YYYY-MM-DD"),max:p(xt)().add(10,"years").format("YYYY-MM-DD"),class:O({"!border-danger":p(S).specialDates.$each.$response.$errors[he].custom_date.length}),"onUpdate:modelValue":ve=>de.custom_date=ve,onclick:"this.showPicker?.()"},null,10,xU),[[bt,de.custom_date]])]),W(ra,{modelValue:de.start_time,"onUpdate:modelValue":ve=>de.start_time=ve,"has-error":!!p(S).specialDates.$each.$response.$errors[he].start_time.length,dropUp:"",class:"w-[7rem]"},null,8,["modelValue","onUpdate:modelValue","has-error"]),q[8]||(q[8]=e("span",{class:"text-xs text-grey-300"},"to",-1)),W(ra,{modelValue:de.end_time,"onUpdate:modelValue":ve=>de.end_time=ve,"has-error":!!p(S).specialDates.$each.$response.$errors[he].end_time.length,dropUp:"",class:"w-[7rem]"},null,8,["modelValue","onUpdate:modelValue","has-error"]),e("div",{onClick:ve=>v(he),class:"flex items-center justify-center gap-1 p-2 h-8 bg-grey100 rounded-lg cursor-pointer"},q[7]||(q[7]=[e("img",{src:Xa,class:"w-4 h-4",alt:""},null,-1)]),8,CU)]))),128))])):h("",!0)],512)]),_:1},8,["closeModal"])):h("",!0)])}}});const SU=Oe($U,[["__scopeId","data-v-e80bb018"]]),$r="/assets/eye-off-3b7d286c.svg",TU={key:0,class:"fixed right-0 top-0 h-full w-full z-[99999999999] bg-[#121422]/50 backdrop-blur-[4px]"},MU={class:"relative flex justify-center items-center h-full"},AU={class:"text-grey900",src:$r,alt:"close"},EU=fe({__name:"WidgetFullScreenPreview",props:{activeWidget:{},activeWidgetColor:{},activeWidgetBubbleKey:{},activeWidgetStateKey:{},activeWidgetEffectKey:{},activeWidgetPositionKey:{},pendingTextMessage:{},thumbnailList:{},message:{},bubblePosition:{},widgetPosition:{},previewBubblePosition:{},previewWidgetPosition:{},previewWidgetHeight:{},pendingMessage:{type:Boolean},previewTextBubble:{type:Boolean},isWelcomeTextEnabled:{type:Boolean},widgetBubbleSize:{},customWidgetBubbleSrc:{},showCustom:{type:Boolean},previousWidgetBubbleKey:{},showPreviewToggle:{type:Boolean,default:!0},showUserMessage:{type:Boolean,default:!0},canClose:{type:Boolean,default:!0},contact_fields:{},defaultLanguage:{},headerFontColor:{},avatarBorderColor:{},chatBubbleColor:{},chatFontColor:{},closeIconColor:{},systemMessageIcon:{default:"system-base"},showPreviewHeader:{type:Boolean,default:!0},isRemoveChatwayBranding:{type:Boolean},faqs:{},isFaqEnabled:{type:Boolean}},emits:["closeFullScreenPreview"],setup(o,{emit:s}){const t=o,{width:n}=Ht(),l=As(),i=s,m=$(!1),r=$(!1),u=$(!1),g=()=>{i("closeFullScreenPreview"),l.hidePreviewTextPreview=!1},y=v=>{m.value=v,l.hidePreviewTextPreview=!1},c=v=>{m.value=v},w=()=>{r.value=!1},f=v=>{(v.key==="Escape"||v.key==="Esc")&&g()};return Xe(()=>{u.value=!0,l.hidePreviewTextPreview=!1,m.value=t.activeWidgetStateKey==="opened",r.value=t.previewTextBubble;const v=document.getElementsByClassName("chatway--container");v.length&&(v[0].style.display="none"),window.addEventListener("keydown",f)}),ps(()=>{window.removeEventListener("keydown",f),u.value=!1;const v=document.getElementsByClassName("chatway--container");v.length&&(v[0].style.display="block")}),(v,C)=>{const _=He("svg-inline");return a(),ne(Vn,{to:"body"},[W(ms,{name:"modal-fade"},{default:K(()=>[u.value?(a(),d("div",TU,[W(Jo,{class:"absolute top-5 right-5 cursor-pointer text-white w-6 h-6 z-10",onClick:g}),e("div",MU,[e("div",{onClick:g,class:"flex items-center justify-center cursor-pointer w-[11.69rem] h-12 bg-white py-[0.31rem] px-4 rounded-md gap-2 z-[1000]"},[F(e("img",AU,null,512),[[_]]),C[0]||(C[0]=e("p",{class:"text-base leading-leading400 text-grey900 m-0"},"Close Preview",-1))])]),e("div",{class:O(["absolute bottom-0 z-20 w-full",[{"right-5":v.activeWidgetPositionKey==="right","left-5":v.activeWidgetPositionKey==="left","w-full h-full !left-0 !bottom-0 !right-0":p(n)<600&&m.value}]])},[e("div",{class:O(["flex flex-col",[{"!gap-0":p(n)<600}]])},[W(an,{activeWidgetColor:v.activeWidgetColor,activeWidgetBubbleKey:v.activeWidgetBubbleKey,activeWidgetStateKey:v.activeWidgetStateKey,activeWidgetEffectKey:v.activeWidgetEffectKey,activeWidgetPositionKey:v.activeWidgetPositionKey,pendingTextMessage:v.pendingTextMessage,thumbnailList:v.thumbnailList,bubblePosition:v.bubblePosition,widgetPosition:v.widgetPosition,previewBubblePosition:v.previewBubblePosition,previewWidgetPosition:v.previewWidgetPosition,previewWidgetHeight:v.previewWidgetHeight,pendingMessage:v.pendingMessage,previewTextBubble:v.previewTextBubble,isWelcomeTextEnabled:v.isWelcomeTextEnabled,widgetBubbleSize:v.widgetBubbleSize,showCustom:v.showCustom,customWidgetBubbleSrc:v.customWidgetBubbleSrc,previousWidgetBubbleKey:v.previousWidgetBubbleKey,defaultLanguage:v.defaultLanguage,headerFontColor:v.headerFontColor,avatarBorderColor:v.avatarBorderColor,chatBubbleColor:v.chatBubbleColor,chatFontColor:v.chatFontColor,closeIconColor:v.closeIconColor,systemMessageIcon:v.systemMessageIcon,contact_fields:v.contact_fields,isRemoveChatwayBranding:v.isRemoveChatwayBranding,faqs:v.faqs,isFaqEnabled:v.isFaqEnabled,onCloseWidgetPreview:y,onToggleWidgetPreview:c,onClosePreviewBubble:w},null,8,["activeWidgetColor","activeWidgetBubbleKey","activeWidgetStateKey","activeWidgetEffectKey","activeWidgetPositionKey","pendingTextMessage","thumbnailList","bubblePosition","widgetPosition","previewBubblePosition","previewWidgetPosition","previewWidgetHeight","pendingMessage","previewTextBubble","isWelcomeTextEnabled","widgetBubbleSize","showCustom","customWidgetBubbleSrc","previousWidgetBubbleKey","defaultLanguage","headerFontColor","avatarBorderColor","chatBubbleColor","chatFontColor","closeIconColor","systemMessageIcon","contact_fields","isRemoveChatwayBranding","faqs","isFaqEnabled"])],2)],2)])):h("",!0)]),_:1})])}}}),DU="/assets/eye-u-274f5e3f.svg",IU="/assets/trash-transparent-be78f9cc.svg",FU={class:"relative"},PU={key:0,class:"block truncate text-gray-300"},jU={class:"block truncate"},LU={class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},RU={class:"select-arrow",src:Tt},BU={class:"select-arrow",src:Wt},NU=fe({__name:"Dropdown",props:{modelValue:{},items:{},itemValue:{default:"name"},itemId:{default:"id"},hintText:{default:"Select item"},shadow:{type:Boolean,default:!0},emptyMessage:{default:"Select"}},emits:["update:modelValue","change:selectedObject"],setup(o,{emit:s}){const t=s,n=o,l=b({get:()=>{var i;return((i=n.items)==null?void 0:i.find(m=>m[n.itemId]===n.modelValue))??{id:null,name:n.hintText}},set:i=>{t("update:modelValue",i[n.itemId]),t("change:selectedObject",i)}});return(i,m)=>{const r=He("svg-inline");return a(),ne(p(Bd),{as:"div",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=u=>l.value=u)},{default:K(()=>[e("div",FU,[W(p(jd),{class:O(["relative w-full cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6 border border-grey200",[i.shadow?"shadow-sm":"shadow-0"]])},{default:K(()=>[l.value[i.itemValue]?h("",!0):(a(),d("span",PU,I(i.emptyMessage),1)),e("span",jU,I(l.value[i.itemValue]),1),e("span",LU,[F(e("img",RU,null,512),[[r]])])]),_:1},8,["class"]),W(ms,{"leave-active-class":"transition ease-in duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:K(()=>[W(p(Ld),{class:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"},{default:K(()=>[(a(!0),d(Se,null,Ne(i.items,u=>(a(),ne(p(Rd),{as:"template",key:u[i.itemId],value:u},{default:K(({active:g,selected:y})=>[e("li",{class:O([g?"bg-gray-100 text-white":"text-gray-900","relative cursor-default select-none py-2 pl-8 pr-4"])},[e("span",{class:O([y?"font-semibold":"font-normal","block truncate"])},I(u[i.itemValue]),3),y?(a(),d("span",{key:0,class:O([g?"text-white":"text-indigo-600","absolute inset-y-0 left-0 flex items-center pl-1.5"])},[F(e("img",BU,null,512),[[r]])],2)):h("",!0)],2)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})])]),_:1},8,["modelValue"])}}}),OU={key:0,class:"error-message mt-1"},VU={key:1,class:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",id:"options",role:"listbox"},UU={class:"block truncate"},GU=["onClick"],WU={class:"block truncate"},qU=fe({__name:"DomainAutocomplete",props:{modelValue:{type:String,required:!0},domains:{type:Array,required:!0}},emits:["update:modelValue"],setup(o,{emit:s}){const t=o;Xe(()=>{_()});const n=s,l=$(!1),i=$(null),m=b({get(){return t.modelValue},set(A){n("update:modelValue",A)}}),r=$(t.domains),u=$(!1);We(()=>l.value,()=>{!l.value&&!m.value&&(u.value=!0)}),We(()=>m.value,()=>{v(m.value)&&(u.value=!1)});const g=b(()=>{if(m.value){const A=D=>D.replace(/^(https?:)?\/\//,"").toLowerCase();return r.value.find(D=>A(D.toLowerCase())===A(m.value.toLowerCase()))}return""});function y(A){m.value=A,l.value=!1;let D=A.replace("https://","").replace("http://","");D&&!r.value.includes(D)&&r.value.push(D)}function c(){l.value=!0,u.value=!1}function w(){!m.value&&!r.value.length&&(u.value=!0)}function f(){if(m.value&&v(m.value)){let A=m.value.replace("https://","").replace("http://","");A&&!r.value.includes(A)&&(r.value.push(A),l.value=!1)}}function v(A){return!!(A&&/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)?([a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?)$/.test(A))}function C(){return m.value?r.value.filter(A=>A.includes(m.value)):r.value}async function _(){if(m.value){let A=m.value.replace("https://","").replace("http://","");A&&!r.value.includes(A)&&r.value.push(A)}}return Os(i,()=>l.value=!1),(A,D)=>(a(),d("div",{class:"relative",ref_key:"defaultDomainAutoComplete",ref:i},[W(Ha,{type:"text",placeholder:"https://my-domain.com",onFocusout:f,onFocusin:c,value:m.value,onInput:D[0]||(D[0]=T=>m.value=T),hasError:u.value,onBlur:w,classes:"!p-1 !text-sm page-input"},null,8,["value","hasError"]),u.value?(a(),d("span",OU,"The value is required")):h("",!0),l.value&&C().length?(a(),d("ul",VU,[r.value.length===0&&!g.value&&m.value!="https://my-domain.com"?(a(),d("li",{key:0,onClick:D[1]||(D[1]=T=>y(m.value)),class:"relative select-none py-2 pl-3 pr-9 text-gray-900 hover:bg-grey100 cursor-pointer",id:"option-0",role:"option",tabindex:"-1"},[e("span",UU,I(m.value),1)])):h("",!0),(a(!0),d(Se,null,Ne(C(),T=>(a(),d("li",{onClick:B=>y("https://"+T),key:T,class:"relative select-none py-2 pl-3 pr-9 text-gray-900 hover:bg-grey100 cursor-pointer",id:"option-0",role:"option",tabindex:"-1"},[e("span",WU,I("https://"+T),1)],8,GU))),128))])):h("",!0)],512))}}),HU={class:"flex flex-col gap-4 p-4"},zU={class:"flex justify-between items-center"},KU={class:"bg-grey200 flex gap-2 !p-1 rounded-md w-full"},YU={class:"flex items-center gap-2"},ZU={class:"flex items-center gap-2"},JU={class:"text-danger",src:$r},QU={src:IU,class:"text-gray300 w-4"},XU={class:"rule-options"},eG={key:0},tG={key:0,class:"error-message mt-1"},sG=fe({__name:"PageTargetingRule",props:{rule:{},domains:{}},emits:["update:rule","delete"],setup(o,{emit:s}){const n=$(o.rule),l=s,i=[{name:"Pages that contain",id:"contains"},{name:"A specific page",id:"equals"},{name:"Pages starting with",id:"start-with"},{name:"Pages ending with",id:"end-with"},{name:"Homepage",id:"homepage"},{name:"Any page under the domain",id:"any-page"}],m=$(!1);function r(){m.value=!n.value.page||!u()}function u(){return g(),/^\/?[a-z\d\-_.~%!$&'()*+,;=:@/]*\??[a-z\d\-_.~%!$&'()*+,;=:@/?]*#?[a-z\d\-_.~%!$&'()*+,;=:@/?]*/i.test(n.value.page)}function g(){const f=n.value.page;if(f&&y(f)){let v="https://"+n.value.page.replace("https://","").replace("http://","");const C=new URL(v);n.value.page=C.pathname+C.search+C.hash}}function y(f){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(f)}function c(){m.value=!1}function w(){l("delete")}return We(()=>n,()=>{n.value.condition==="homepage"&&(n.value.page="/",m.value=!1),l("update:rule",n.value)},{deep:!0}),(f,v)=>{const C=He("svg-inline");return a(),d("div",HU,[e("div",zU,[W(p(Nd),{modelValue:n.value.visibility,"onUpdate:modelValue":v[0]||(v[0]=_=>n.value.visibility=_)},{default:K(()=>[e("div",KU,[W(p(Ci),{as:"template",value:"show"},{default:K(({checked:_})=>[e("div",{class:O([_?"bg-white":"text-gray300","flex items-center justify-center rounded-md py-1 px-3 text-sm font-semibold"])},[W(p(ki),{class:"cursor-pointer"},{default:K(()=>[e("div",YU,[F(e("img",{src:DU,class:O([_?"text-green-400":"text-green-900","w-4"])},null,2),[[C]]),e("p",{class:O([_?"text-green-400":"text-grey300","text-sm !m-0 !p-0"])},"Show",2)])]),_:2},1024)],2)]),_:1}),W(p(Ci),{as:"template",value:"hide"},{default:K(({checked:_})=>[e("div",{class:O([_?"bg-white":"text-gray300","flex items-center justify-center rounded-md py-1 px-3 text-sm font-semibold"])},[W(p(ki),{class:"cursor-pointer"},{default:K(()=>[e("div",ZU,[F(e("img",JU,null,512),[[C]]),e("p",{class:O([_?"text-danger":"text-grey300","text-sm !m-0 !p-0"])},"Don't show",2)])]),_:2},1024)],2)]),_:1})])]),_:1},8,["modelValue"]),e("div",null,[e("button",{onClick:w,class:"rule-button"},[F(e("img",QU,null,512),[[C]])])])]),e("div",null,[W(Ns,{"label-text":"Domain","tooltip-text":"Choose the domain where the Chatway widget is installed"}),W(qU,{modelValue:n.value.domain,"onUpdate:modelValue":v[1]||(v[1]=_=>n.value.domain=_),domains:f.domains,class:"page-input"},null,8,["modelValue","domains"])]),e("div",XU,[W(Ns,{"label-text":"Rules","tooltip-text":"You can choose the criteria, such as page url that contains, starts with, ends with, etc., for the widget to be displayed on particular pages."}),W(NU,{modelValue:n.value.condition,"onUpdate:modelValue":v[2]||(v[2]=_=>n.value.condition=_),items:i,shadow:!1},null,8,["modelValue"])]),n.value.condition!="any-page"?(a(),d("div",eG,[W(Ns,{"label-text":"Page","tooltip-text":'The widget will appear on specific pages based on the rule and page field input. For example, if the domain is www.example.com, the rule is "Pages starting with", and the page input field contains "products/", the widget will be shown on pages like www.example.com/products/abc, www.example.com/products-abc, and www.example.com/products/product-abc'}),W(Ha,{type:"text",placeholder:"about-us/team",disable:n.value.condition==="homepage",value:n.value.page,onInput:v[3]||(v[3]=_=>n.value.page=_),hasError:m.value,classes:"!p-1 !text-sm page-input",onBlur:r,onFocusin:c},null,8,["disable","value","hasError"]),m.value?(a(),d("span",tG,"The value is required")):h("",!0)])):h("",!0)])}}});const Sr=fe({__name:"WidgetTargetingProModal",props:{isProFeature:{type:Boolean}},emits:["hideModal"],setup(o,{emit:s}){const t=s;function n(){t("hideModal")}return(l,i)=>{const m=Pe("Modal");return a(),d("div",null,[W(m,{"header-title":"Access Pro Targeting Features",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Upgrade now",footerTopBorder:"",classes:"md:!w-[500px]",isProFeature:l.isProFeature,"close-modal":"",onCloseModal:n,onActionButtonTypeOne:n,onActionButtonTypeTwo:n},{default:K(()=>i[0]||(i[0]=[e("div",{class:"md:flex h-full scroll-border px-4 py-6 text-black text-base"},"Your current plan doesn't include country and page targeting. Upgrade to Pro for full access.",-1)])),_:1},8,["isProFeature"])])}}}),aG={key:0,class:"flex items-center justify-center py-4"},oG={src:kr,alt:""},nG=fe({__name:"WidgetPageTargetingSettings",props:{modelValue:{},validator:{},disable:{type:Boolean}},setup(o){const s=o,t=$(s.modelValue),n=$(!1),l={is_enable:!1,rules:[{id:is(),domain:"",page:"",condition:"contains",visibility:"show"}]},i=f=>{if(s.disable){n.value=!0,t.value.is_enable=!1;return}t.value.is_enable=f,f&&t.value.rules.length===0&&y()},m=As(),r=$([]),u=$(!0);Xe(()=>{g()});async function g(){if(m.id)try{const{data:f}=await new na().getDomains();r.value=f.attributes.domains||[],u.value=!1}catch(f){Ze(f),u.value=!1}}function y(){const f={...l.rules[0],id:is()};t.value.rules.push(f)}function c(f){t.value.rules.splice(t.value.rules.findIndex(v=>v.id===f),1),t.value.rules.length===0&&y()}function w(){n.value=!1}return(f,v)=>{const C=Pe("ToggleSwitch"),_=Pe("Loader"),A=He("svg-inline");return a(),d(Se,null,[e("div",null,[W(Ns,{isProFeature:f.disable,"label-text":"Page Targeting","tooltip-text":"Select the pages where you want to show or hide the widget. You can use rules for specified domains like contains, exact match, starts with and ends with. When targeting is disabled, the widget appears wherever the code is installed."},null,8,["isProFeature"]),W(C,{value:t.value.is_enable,onInput:i},null,8,["value"]),t.value.is_enable?(a(),d("div",{key:0,class:O(["bg-grey100 mt-2 rounded-md divide-y page-rules",{"hide-button":t.value.rules.length<=1}])},[u.value?(a(),d("div",aG,[W(_,{size:"24px"})])):(a(!0),d(Se,{key:1},Ne(t.value.rules,(D,T)=>(a(),ne(sG,{domains:r.value,onDelete:B=>c(D.id),"onUpdate:rule":B=>t.value.rules[T]=B,rule:D,key:D.id},null,8,["domains","onDelete","onUpdate:rule","rule"]))),128)),e("button",{onClick:y,class:"text-primary my-2"},[F(e("img",oG,null,512),[[A]]),v[0]||(v[0]=_e(" Add another rule "))])],2)):h("",!0)]),n.value?(a(),ne(Sr,{key:0,showUpgradeModal:n.value,onHideModal:w,isProFeature:f.disable},null,8,["showUpgradeModal","isProFeature"])):h("",!0)],64)}}}),iG=fe({__name:"CountryCheckBox",props:{country:{},selectedCountries:{}},emits:["select","unselect"],setup(o,{emit:s}){const t=o,n=s,l=b({get(){var i;return!!((i=t.selectedCountries)!=null&&i.find(m=>{var r;return m.id===((r=t.country)==null?void 0:r.id)}))},set(i){var m,r;if(i){n("select",(m=t.country)==null?void 0:m.id);return}n("unselect",(r=t.country)==null?void 0:r.id)}});return(i,m)=>(a(),ne(ja,{modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=r=>l.value=r),id:i.country.id+i.country.code,"hint-text":i.country.name},null,8,["modelValue","id","hint-text"]))}}),lG={class:"relative"},rG={class:"block truncate !p-1 !text-sm"},dG={class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},uG={class:"select-arrow",src:Tt},cG={key:0,class:"error-message"},mG={class:"border-b px-4 py-2 relative"},gG={key:0,class:"border-b pl-4 py-2 pt-0"},pG=fe({__name:"CountryDropdown",props:{selectedCountryCodes:{type:Object,required:!0},isSelectedAll:{type:Boolean,required:!0},hasError:{type:Boolean,required:!0}},emits:["selectedAll","selectedCountryCodes"],setup(o,{emit:s}){const t=o,n=$(null),l=s,i=$(!1),m=$([]),r=Es(),u=$(null),g=$(""),y=b(()=>g.value?r.countries.filter(A=>A.name.toLowerCase().includes(g.value.toLowerCase())).slice().sort((A,D)=>A.name>D.name?1:-1):r.countries.slice().sort((A,D)=>A.name>D.name?1:-1));Xe(()=>{var A;if(t.isSelectedAll){C(!0);return}(A=t.selectedCountryCodes)==null||A.forEach(D=>{const T=r.countries.find(B=>B.code==D);T&&m.value.push({...T})})});const c=b(()=>{if(w.value)return"All countries";if(m.value.length>3){const A=m.value.map(T=>T.name).sort((T,B)=>T>B?1:-1).slice(0,3).join(", "),D=m.value.length-3;return`${A}, + ${D}`}else return m.value.map(A=>A.name).sort((A,D)=>A>D?1:-1).join(", ")}),w=b(()=>r.countries.length===m.value.length);We(()=>[w.value,m.value],()=>{l("selectedAll",w.value),l("selectedCountryCodes",m.value.map(A=>A.code))});function f(A){const D=r.countries.find(T=>T.id===A);D&&m.value.push({...D})}function v(A){const D=m.value.findIndex(T=>T.id===A);m.value.splice(D,1)}function C(A){if(A){m.value=[...r.countries];return}m.value=[]}Os(n,()=>{u.value=setTimeout(()=>i.value=!1,300)});function _(){u.value&&clearTimeout(u.value),i.value=!i.value}return(A,D)=>{const T=He("svg-inline");return a(),d("div",lG,[e("button",{onClick:_,type:"button",class:O(["relative w-full cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 border-[#e6e6f0] focus:outline-none",[{"border-red-500 !bg-red-50":o.hasError}]]),"aria-haspopup":"listbox","aria-expanded":"true","aria-labelledby":"listbox-label"},[e("span",rG,I(c.value),1),e("span",dG,[F(e("img",uG,null,512),[[T]])])],2),o.hasError?(a(),d("span",cG,"Please select country")):h("",!0),i.value?(a(),d("ul",{key:1,ref_key:"target",ref:n,class:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",tabindex:"-1",role:"listbox","aria-labelledby":"listbox-label","aria-activedescendant":"listbox-option-3"},[e("li",mG,[F(e("input",{ref:"searchInput",class:"w-full !py-2 !px-2 border rounded","onUpdate:modelValue":D[0]||(D[0]=B=>g.value=B),type:"text",placeholder:"Search Country..."},null,512),[[bt,g.value]])]),g.value?h("",!0):(a(),d("li",gG,[W(ja,{"model-value":w.value,"onUpdate:modelValue":C,"hint-text":"Select All",id:"all-country-select"},null,8,["model-value"])])),(a(!0),d(Se,null,Ne(y.value,B=>(a(),d("li",{key:B.id,class:"text-gray-900 relative cursor-default select-none pl-4 p-2 !m-0 hover:bg-grey100 border-b border-grey100",role:"option"},[W(iG,{onSelect:f,onUnselect:v,"selected-countries":m.value,country:B},null,8,["selected-countries","country"])]))),128))],512)):h("",!0)])}}}),vG={key:0,class:"bg-grey100 p-[10px] rounded-md mt-2"},fG=fe({__name:"WidgetCountryTargetingRule",props:{settings:{},validator:{},disable:{type:Boolean}},emits:["settings"],setup(o,{emit:s}){const t=s,n=$(!1),l=o,i=$(l.settings);We(()=>i.value,()=>{t("settings",i.value)},{deep:!0});function m(u){l.disable&&(n.value=!0),i.value.is_enable=!l.disable&&u}function r(){n.value=!1}return(u,g)=>(a(),d(Se,null,[e("div",null,[W(Ns,{isProFeature:u.disable,"label-text":"Country Targeting","tooltip-text":"When Country targeting is off, the widget is visible in all the countries"},null,8,["isProFeature"]),W(Sa,{value:i.value.is_enable,onInput:m},null,8,["value"]),i.value.is_enable?(a(),d("div",vG,[W(pG,{selectedCountryCodes:i.value.country_codes,onSelectedAll:g[0]||(g[0]=y=>i.value.is_selected_all=y),onSelectedCountryCodes:g[1]||(g[1]=y=>i.value.country_codes=y),"is-selected-all":i.value.is_selected_all,hasError:u.validator.countryTargetingRule.country_codes.$error},null,8,["selectedCountryCodes","is-selected-all","hasError"])])):h("",!0)]),n.value?(a(),ne(Sr,{key:0,showUpgradeModal:n.value,onHideModal:r,isProFeature:u.disable},null,8,["showUpgradeModal","isProFeature"])):h("",!0)],64))}}),hG={key:0},_G={class:"border-[#FFB067] border-px border-solid bg-[#FFF4EA] rounded-lg text-xs p-3 pt-2 pb-2"},yG=fe({__name:"WidgetTargetingProContent",props:{countryTargetingSettings:{},pageTargetingSettings:{}},setup(o){const s=o,t=b(()=>{var n,l;return((n=s.countryTargetingSettings)==null?void 0:n.is_enable)||((l=s.pageTargetingSettings)==null?void 0:l.is_enable)});return(n,l)=>{const i=Pe("RouterLink");return a(),d("div",null,[t.value?(a(),d("div",hG,[e("div",_G,[l[1]||(l[1]=e("span",{class:"font-semibold"},"Please note:",-1)),l[2]||(l[2]=_e(" Country and page targeting features will be disabled after the trial period. ")),W(i,{class:"font-semibold underline text-xs",to:"/plans"},{default:K(()=>l[0]||(l[0]=[_e("Upgrade to Pro")])),_:1}),l[3]||(l[3]=_e(" so that you can continue using the targeting features "))])])):h("",!0)])}}}),bG="/assets/message-circle-41d7e0b5.svg",wG={class:"flex items-center gap-1"},xG={class:"w-[20.875rem]"},CG={class:"flex flex-col items-center text-center pt-6 pb-8 px-6"},kG={class:"text-white",src:bG,alt:""},$G=fe({__name:"WidgetBranding",props:{isRemoveChatwayBranding:{type:Boolean}},emits:["updateBranding"],setup(o,{emit:s}){const t=Ae(),n=s,l=$(!1),i=()=>{n("updateBranding")},m=()=>{window.$chatway.openChatwayWidget(),l.value=!1};return(r,u)=>{const g=Pe("ToggleSwitch"),y=Pe("Modal"),c=He("svg-inline");return a(),d(Se,null,[e("div",null,[e("div",wG,[p(t).isProOrProTrialUser?h("",!0):(a(),ne(yt,{key:0,triggers:["click"],class:"cursor-pointer",placement:"left",theme:"chatway-upgradenow"},{content:K(()=>[e("div",xG,[W(Ea)])]),default:K(()=>[u[2]||(u[2]=e("img",{src:Da,alt:""},null,-1))]),_:1})),u[5]||(u[5]=e("div",{class:"text-sm text-grey600"},"Remove Chatway Branding",-1)),W(yt,null,{content:K(()=>u[3]||(u[3]=[e("div",{class:"p-3 w-96"},[e("span",null,"Toggle this to remove the Chatway logo and branding from your chat widget.")],-1)])),default:K(()=>[u[4]||(u[4]=e("img",{src:as,alt:"info"},null,-1))]),_:1})]),p(t).isProOrProTrialUser?h("",!0):(a(),d("div",{key:0,onClick:u[0]||(u[0]=w=>l.value=!0),class:"text-sm text-[#f79d03] underline mt-2 cursor-pointer"},"Check if you're eligible to remove branding")),W(g,{value:r.isRemoveChatwayBranding,onInput:i,disabled:!p(t).isProOrProTrialUser,class:O(["disabled:opacity-50 mt-1",{"disabled:!bg-primary":r.isRemoveChatwayBranding}])},null,8,["value","disabled","class"])]),l.value?(a(),ne(y,{key:0,closeModal:l.value,onCloseModal:u[1]||(u[1]=w=>l.value=!1),showFooter:!1},{default:K(()=>[e("div",CG,[u[7]||(u[7]=e("div",{class:"flex items-center justify-center w-[108px] h-[108px] bg-[rgba(4,70,222,0.04)] rounded-full mb-4"},[e("img",{src:El,alt:"logo",width:"48",height:"56",loading:"lazy"})],-1)),u[8]||(u[8]=e("div",{class:"text-2xl font-semibold text-grey900 mb-2"},"Remove Chatway Branding?",-1)),u[9]||(u[9]=e("div",{class:"text-base font-normal text-grey900 mb-8"},"Please contact us to check if you are eligible to remove the branding for free",-1)),e("button",{onClick:m,class:"flex items-center gap-1 py-[9px] px-4 bg-grey900 h-auto rounded"},[F(e("img",kG,null,512),[[c]]),u[6]||(u[6]=e("div",{class:"text-base font-normal text-white"},"Ask Our Support to Remove",-1))])])]),_:1},8,["closeModal"])):h("",!0)],64)}}}),SG="/assets/help-circle-a7589553.svg",TG="/assets/info-red-2952d552.svg",MG="/assets/plus-blue-af1c7be1.svg",AG="/assets/grip-dots-fef4e1a0.svg",EG="/assets/edit-8efa3a15.svg",DG={key:0,class:"absolute top-4 right-0 mt-2 bg-white w-[280px] rounded-lg z-10 shadow-[0px_24px_48px_-4.875px_rgba(40,45,62,0.40)]"},IG={class:"p-4 flex items-center justify-end gap-2"},FG=fe({__name:"DeleteFaq",emits:["cancelDelete","deleteFaq"],setup(o,{emit:s}){const t=s,n=$(!1),l=$(null),i=()=>{n.value=!1},m=()=>{t("deleteFaq")};return Os(l,i),(r,u)=>(a(),d("div",{class:"relative",ref_key:"deletePopup",ref:l},[e("button",{onClick:u[0]||(u[0]=Qe(g=>n.value=!0,["stop"])),class:"p-0.5 h-auto"},u[1]||(u[1]=[e("img",{src:wo,alt:""},null,-1)])),n.value?(a(),d("div",DG,[u[2]||(u[2]=e("div",{class:"p-4 border-b border-grey200 text-base text-grey900 font-semibold"},"Delete FAQ?",-1)),e("div",IG,[e("button",{onClick:Qe(i,["stop"]),class:"h-auto py-1.5 px-2 text-sm text-grey900 bg-grey100 rounded"},"Cancel"),e("button",{onClick:Qe(m,["stop"]),class:"h-auto py-1.5 px-2 text-sm text-white bg-danger rounded"},"Delete")])])):h("",!0)],512))}}),PG={class:"mb-2"},jG={class:"flex items-center gap-1"},LG={class:"w-4 h-4 group-hover:text-primary",src:AG,alt:""},RG={class:"w-5 h-5",src:Fl,alt:""},BG={class:"flex items-center justify-between grow"},NG={class:"text-sm text-grey900 line-clamp-1 max-w-[385px]"},OG={class:"flex items-center gap-4 shrink-0"},VG=["onClick"],UG=["innerHTML"],GG="Click the pencil icon to edit this FAQ and add your answer, which will be displayed here.",WG=fe({__name:"FaqList",props:{faqs:{}},emits:["edit-faq","delete-faq"],setup(o,{emit:s}){const t=s,n=$(!1),l=b(()=>({animation:250,group:"description",ghostClass:"ghost"})),i=r=>{t("edit-faq",r)},m=r=>{t("delete-faq",r)};return(r,u)=>{const g=He("svg-inline");return a(),ne(p(Wo),Od({list:r.faqs,disabled:r.faqs.length==1,"item-key":"id",handle:".handle","component-data":{tag:"div",type:"transition-group",name:n.value?null:"flip-list"}},l.value,{onStart:u[0]||(u[0]=y=>n.value=!0),onEnd:u[1]||(u[1]=y=>n.value=!1)}),{item:K(({element:y})=>[W(p(Qi),null,{default:K(({open:c})=>[e("div",PG,[e("div",jG,[e("div",{class:O(["handle flex items-center justify-center w-6 h-6 rounded-full group hover:bg-main100",r.faqs.length>1?"cursor-move":"cursor-not-allowed"])},[F(e("img",LG,null,512),[[g]])],2),W(p(Zi),{as:"div",class:"grow cursor-pointer"},{default:K(()=>[e("div",{class:O(["flex items-center gap-2 bg-grey100 py-2 px-2 max-w-[560px]",c?"rounded-t-lg":"rounded-lg"])},[e("div",{class:O(["transition",{" rotate-90 [&>svg>path]:stroke-primary":c}])},[F(e("img",RG,null,512),[[g]])],2),e("div",BG,[e("div",NG,I(y.question),1),e("div",OG,[e("button",{onClick:Qe(w=>i(y),["stop"]),class:"p-0.5 h-auto"},u[2]||(u[2]=[e("img",{class:"w-4 h-4",src:EG,alt:""},null,-1)]),8,VG),W(FG,{onDeleteFaq:w=>m(y)},null,8,["onDeleteFaq"])])])],2)]),_:2},1024)]),W(p(Ji),{class:O(["p-3 ml-7 bg-[rgba(230,230,240,0.40)] rounded-b-lg border-t border-grey200 text-sm text-grey900",{rtl:p(Ds)(y.question)}])},{default:K(()=>[e("div",{class:"text-sm prose prose-p:m-0 prose-p:text-sm prose-p:text-grey900 prose-p:font-normal prose-p:font-[Poppins] prose-img:mb-1 prose-img:rounded prose-a:text-primary prose-ul:mt-0 prose-ol:mt-0 prose-li:m-0",innerHTML:y.answer||GG},null,8,UG)]),_:2},1032,["class"])])]),_:2},1024)]),_:1},16,["list","disabled","component-data"])}}});const qG=Oe(WG,[["__scopeId","data-v-7f563873"]]),HG="/assets/unlink-a176ddbb.svg",zG=`
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
    <path d="M4 2.66666H9.33333C10.0406 2.66666 10.7189 2.94761 11.219 3.4477C11.719 3.9478 12 4.62608 12 5.33332C12 6.04057 11.719 6.71884 11.219 7.21894C10.7189 7.71904 10.0406 7.99999 9.33333 7.99999H4V2.66666Z" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M4 8H10C10.7072 8 11.3855 8.28095 11.8856 8.78105C12.3857 9.28115 12.6667 9.95942 12.6667 10.6667C12.6667 11.3739 12.3857 12.0522 11.8856 12.5523C11.3855 13.0524 10.7072 13.3333 10 13.3333H4V8Z" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,KG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M12.667 2.66666H6.66699" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M9.33301 13.3333H3.33301" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M10 2.66666L6 13.3333" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,YG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M4 2V6.66667C4 7.72753 4.42143 8.74495 5.17157 9.49509C5.92172 10.2452 6.93913 10.6667 8 10.6667C9.06087 10.6667 10.0783 10.2452 10.8284 9.49509C11.5786 8.74495 12 7.72753 12 6.66667V2" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M2.66699 14H13.3337" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,ZG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M5.32812 4H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M5.32812 8H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M5.32812 12H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M2 4H2.00667" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M2 8H2.00667" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M2 12H2.00667" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,JG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M1.55714 6C1.42381 6 1.31429 5.95952 1.22857 5.87857C1.14286 5.79286 1.1 5.6881 1.1 5.56429V1.96429L1.2 2.12143L0.678571 2.50714C0.611905 2.55952 0.528571 2.58571 0.428571 2.58571C0.314286 2.58571 0.214286 2.54286 0.128571 2.45714C0.0428571 2.37143 0 2.26905 0 2.15C0 1.99762 0.0738095 1.87381 0.221429 1.77857L1.25 1.09286C1.29762 1.05952 1.35 1.03571 1.40714 1.02143C1.46905 1.00714 1.52619 1 1.57857 1C1.71667 1 1.82619 1.04286 1.90714 1.12857C1.9881 1.20952 2.02857 1.3119 2.02857 1.43571V5.56429C2.02857 5.6881 1.98333 5.79286 1.89286 5.87857C1.80714 5.95952 1.69524 6 1.55714 6Z" fill="#93939D"/>
    <path d="M2.83803 13.2254C2.9507 13.2254 3.0446 13.2629 3.11972 13.338C3.19484 13.4131 3.23239 13.507 3.23239 13.6197C3.23239 13.7277 3.19484 13.8192 3.11972 13.8944C3.0446 13.9648 2.9507 14 2.83803 14H0.443662C0.321596 14 0.225352 13.9624 0.15493 13.8873C0.0845071 13.8122 0.0492958 13.716 0.0492958 13.5986C0.0492958 13.4812 0.0915493 13.3779 0.176056 13.2887L1.71127 11.6479C1.88498 11.4601 2.02113 11.2676 2.11972 11.0704C2.223 10.8732 2.27465 10.7019 2.27465 10.5563C2.27465 10.3216 2.20657 10.1338 2.07042 9.99296C1.93427 9.84742 1.75352 9.77465 1.52817 9.77465C1.43897 9.77465 1.34742 9.79577 1.25352 9.83803C1.15962 9.88028 1.06808 9.93897 0.978873 10.0141C0.894366 10.0892 0.814554 10.1761 0.739437 10.2746C0.683099 10.3498 0.626761 10.3967 0.570423 10.4155C0.514085 10.4343 0.462441 10.4437 0.415493 10.4437C0.312207 10.4437 0.215962 10.4061 0.126761 10.331C0.0422536 10.2512 0 10.1596 0 10.0563C0 9.97653 0.0258216 9.89906 0.0774648 9.82394C0.133803 9.74883 0.201878 9.67136 0.28169 9.59155C0.399061 9.47418 0.530516 9.37089 0.676056 9.28169C0.821596 9.19249 0.971831 9.12441 1.12676 9.07746C1.28169 9.02582 1.43192 9 1.57746 9C1.89202 9 2.16432 9.06338 2.39437 9.19014C2.62911 9.31221 2.80986 9.48826 2.93662 9.71831C3.06338 9.94366 3.12676 10.2113 3.12676 10.5211C3.12676 10.7793 3.0493 11.0681 2.89437 11.3873C2.74413 11.7019 2.53991 11.9977 2.28169 12.2746L1.33099 13.2887L1.25352 13.2254H2.83803Z" fill="#93939D"/>
    <path d="M5.32812 4H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M5.32812 8H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M5.32812 12H13.9948" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,QG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M7 8.76024C7.2517 9.11522 7.57282 9.40895 7.94158 9.6215C8.31035 9.83404 8.71813 9.96043 9.13726 9.9921C9.5564 10.0238 9.97709 9.95997 10.3708 9.80503C10.7645 9.6501 11.122 9.40764 11.4191 9.09412L13.1774 7.23922C13.7112 6.65615 14.0066 5.87523 13.9999 5.06465C13.9932 4.25406 13.685 3.47867 13.1417 2.90548C12.5984 2.33229 11.8634 2.00716 11.095 2.00012C10.3267 1.99307 9.58642 2.30468 9.03373 2.86782L8.02566 3.92512" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M9 7.23976C8.7483 6.88478 8.42718 6.59105 8.05842 6.3785C7.68965 6.16596 7.28187 6.03957 6.86273 6.0079C6.4436 5.97623 6.02291 6.04003 5.62919 6.19497C5.23548 6.3499 4.87796 6.59236 4.58088 6.90588L2.82261 8.76078C2.28881 9.34385 1.99343 10.1248 2.00011 10.9354C2.00679 11.7459 2.31498 12.5213 2.85831 13.0945C3.40164 13.6677 4.13663 13.9928 4.90499 13.9999C5.67334 14.0069 6.41358 13.6953 6.96627 13.1322L7.96848 12.0749" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,XG=`
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M12.6667 2H3.33333C2.59695 2 2 2.59695 2 3.33333V12.6667C2 13.403 2.59695 14 3.33333 14H12.6667C13.403 14 14 13.403 14 12.6667V3.33333C14 2.59695 13.403 2 12.6667 2Z" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M5.66699 6.66663C6.21928 6.66663 6.66699 6.21891 6.66699 5.66663C6.66699 5.11434 6.21928 4.66663 5.66699 4.66663C5.11471 4.66663 4.66699 5.11434 4.66699 5.66663C4.66699 6.21891 5.11471 6.66663 5.66699 6.66663Z" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M13.9997 9.99996L10.6663 6.66663L3.33301 14" stroke="#93939D" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
`,eW=new Xo({state:{init(){return{deco:zo.empty}},apply(o,s,t){const n=o.selection;if(n){const l=[Gn.inline(n.$from.pos,n.$to.pos,{class:"selection-marker"},{inclusiveLeft:!0,inclusiveRight:!0})];return{deco:zo.create(t.doc,l)}}return s}},props:{decorations(o){if(o&&this.getState(o)){const s=this.getState(o);return s?s.deco:null}return null}}});function tW(){const{uploadSystemMessageIcon:o}=ii();let s,t;const n=$(""),l=Nt({href:""}),i=$(!1),m=$(!1),r=$(!1),u=$(!1),g=$(null),y=$(null),c=Nt({top:0,left:0}),w=(V,Z,ae,ce)=>new Vd({run:V,title:Z,icon:{dom:(()=>{const J=document.createElement("span");return J.innerHTML=ae,J.className=ce??"",J})()}}),f=[w(Hs(Kt.marks.strong),"Bold",zG),w(Hs(Kt.marks.em),"Italic",KG),w(Hs(Kt.marks.underline),"Underline",YG),w(Q6,"Bulleted list",ZG),w(X6,"Ordered list",JG),w(E,"Link",QG,"link-icon"),w(H,"Image",XG,"file-icon")],v=()=>{const V=new DOMParser().parseFromString(n.value,"text/html"),Z=il.fromSchema(Kt).parse(V);return ll.create({doc:Z,plugins:wr({schema:Kt,placeholder:"Write something...",class:"editor-content",plugins:[Ud({content:[f]}),eW]})})},C=()=>{t=v(),s=new nl(g.value,{state:t,dispatchTransaction:function(V){t=t.apply(V),s.updateState(t),_()},handleDOMEvents:{click:(V,Z)=>(T(V),B(V,Z),!1)}})},_=()=>{const V=A();n.value=V!=="<p></p>"?V:""},A=()=>{const V=rl.fromSchema(Kt).serializeFragment(t.doc.content),Z=document.createElement("div");return Z.appendChild(V),Z.innerHTML},D=V=>{n.value=V,t=v(),s.updateState(t)},T=V=>{const Z=V.coordsAtPos(V.state.selection.from),ae=V.dom.getBoundingClientRect(),ce=Z.left-ae.left,J=Z.top-ae.top;ce<0||J<0||(J>200?c.top=J-30:c.top=J+60,ce<180?c.left=ce+180:ce>350?c.left=ce-130:c.left=ce)};function B(V,Z){Z.target.closest("a[href]")?S(V):l.href=""}function S(V){const{state:Z}=V,{from:ae,to:ce}=Z.selection;Z.doc.nodesBetween(ae,ce,J=>{if(J.isText){const X=J.marks.find(z=>z.type===Kt.marks.link);X&&(l.href=X.attrs.href,m.value=!0)}})}function E(V,Z){const{doc:ae,selection:ce}=V;if(ce.empty&&!r.value||!ae.rangeHasMark(ce.from,ce.to,Kt.marks.link)&&(i.value=!0,m.value=!1,Ft(()=>{var X;i.value&&((X=y.value)==null||X.focus())}),!l.href))return!1;l.href&&!l.href.startsWith("http://")&&!l.href.startsWith("https://")&&(l.href=`https://${l.href}`);const J=V.tr;ae.nodesBetween(ce.from,ce.to,(X,z)=>{if(X.isText){const q=X.marks.find(ue=>ue.type===Kt.marks.link);if(q&&r.value){const ue={...q.attrs,...l};J.removeMark(z,z+X.nodeSize,Kt.marks.link),J.addMark(z,z+X.nodeSize,Kt.marks.link.create(ue)),Z(J)}else Hs(Kt.marks.link,l)(V,Z)}}),r.value=!1}const x=()=>{l.href&&(E(t,s.dispatch),s.focus(),l.href="",i.value=!1)},P=()=>{m.value=!1,i.value=!0,r.value=!0},j=()=>{const{tr:V,selection:Z}=t,{from:ae,to:ce}=Z;t.doc.nodesBetween(ae,ce,(J,X)=>{J.isText&&J.marks.find(q=>q.type===Kt.marks.link)&&(V.removeMark(X,X+J.nodeSize,Kt.marks.link),s.dispatch(V),l.href="")}),m.value=!1};function H(){u.value=!u.value}const k=()=>{u.value=!1};async function M(V){if(V&&V.file){if(V.file.size>8192e3){ze().set({message:"The file must not be greater than 8MB",type:"error"});return}u.value=!1;const Z="/loader.gif",ae=Kt.nodes.image.create({src:Z,class:"w-[200px] mx-auto"}),ce=t.tr.replaceSelectionWith(ae);s.dispatch(ce);let J=null;t.doc.descendants((X,z)=>X.type.name==="image"&&X.attrs.src===Z?(J=z,!1):!0);try{const X=await o({file:V.file});if(J!==null){const z=Kt.nodes.image.create({src:X==null?void 0:X.data.attributes.url}),q=Kt.nodes.paragraph.create(),ue=t.tr.replaceWith(J,J+1,[z,q]);s.dispatch(ue)}}catch{if(J!==null){const z=t.tr.delete(J,J+1);s.dispatch(z)}ze().set({message:"Failed to upload image",type:"error"})}}}return{createMenuItem:w,createEditorView:C,reloadState:D,insertLink:x,removeLink:j,hideCustomFileUpload:k,openAddLinkPopup:P,onFileUpload:M,customMenuItems:f,editorRef:g,content:n,linkAttrs:l,isAddLinkPopupOpen:i,isPreviewLinkPopupOpen:m,showImageUpload:u,linkInput:y,popupStyle:c}}const sW={class:"custom--file-upload"},aW={class:"file-uploader flex flex-col justify-center items-center"},oW={src:jl},nW=["accept"],iW=fe({__name:"CustomFileUpload",props:{accept:{type:String,default:"image/png, image/gif, image/jpeg, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, image/webp, video/mp4, audio/mp3, text/plain, text/csv, application/vnd.openxmlformats-officedocument.presentationml.presentation"}},emits:["fileUploaded"],setup(o,{emit:s}){const t=s,n=$(null),l=r=>{const u=r.target.files;u&&u.length>0&&i(u[0])},i=r=>{const g=r.size>8388608;Ka(r)?g?(m(),alert("You can upload file up to 8 MB")):(t("fileUploaded",{file:r}),m()):(alert("Please select a valid file type."),m())},m=()=>{n.value.value=""};return(r,u)=>{const g=He("svg-inline");return a(),d("div",sW,[e("div",aW,[F(e("img",oW,null,512),[[g]]),u[1]||(u[1]=e("h5",null,"Drag & Drop to Upload File",-1)),e("input",{type:"file",accept:o.accept,ref_key:"fileInput",ref:n,onChange:l},null,40,nW),u[2]||(u[2]=e("div",{class:"or"},[e("span",null,"OR")],-1)),e("button",{class:"button--primary",onClick:u[0]||(u[0]=y=>{var c;return(c=n.value)==null?void 0:c.click()})},"Browse File"),u[3]||(u[3]=e("div",{class:"side--note"},"You can upload files up to 8 MB in size",-1))])])}}});const lW=Oe(iW,[["__scopeId","data-v-93b5a935"]]),rW={class:"relative border border-grey200 rounded-lg mt-1 overflow-hidden"},dW=["disabled"],uW={class:"flex items-center p-3 gap-1"},cW=["href"],mW={class:"flex items-center divide-x"},gW={key:0},pW={class:"error-message"},vW=fe({__name:"EditorWithMenu",props:{modelValue:{},validationMessage:{},hasError:{type:Boolean}},emits:["update:modelValue"],setup(o,{emit:s}){const{createEditorView:t,openAddLinkPopup:n,reloadState:l,insertLink:i,removeLink:m,onFileUpload:r,hideCustomFileUpload:u,editorRef:g,linkAttrs:y,isAddLinkPopupOpen:c,isPreviewLinkPopupOpen:w,showImageUpload:f,linkInput:v,content:C,popupStyle:_}=tW(),A=s,D=o,T=$(null),B=$(null);return We(()=>C.value,S=>{A("update:modelValue",S)}),We(()=>D.modelValue,S=>{S!==C.value&&l(S)}),Xe(()=>{t()}),Os(B,S=>{S.target.closest(".file-icon")||u()}),Os(T,S=>{const E=S.target;!E.closest(".link-icon")&&!E.closest(".link-popup")&&(c.value=!1,w.value=!1)}),(S,E)=>(a(),d("div",null,[e("div",rW,[e("div",{ref_key:"editorRef",ref:g,class:O(["chatway-editor",{isRtl:p(Ds)(S.modelValue)}])},null,2),F(e("div",{onKeyup:E[3]||(E[3]=Ut(x=>c.value=!1,["esc"])),ref_key:"linkPopup",ref:T,class:"link-popup absolute left-1/2 -translate-x-1/2 p-2 flex items-center gap-2 rounded-lg max-w-[361px] w-full bg-white shadow-[0px_8px_16px_0px_rgba(40,45,62,0.16)]",style:lt([{top:p(_).top+"px",left:p(_).left+"px"}])},[F(e("input",{"onUpdate:modelValue":E[0]||(E[0]=x=>p(y).href=x),onKeyup:E[1]||(E[1]=Ut((...x)=>p(i)&&p(i)(...x),["enter"])),ref_key:"linkInput",ref:v,class:"!rounded-lg !border-grey200 !py-[13px] placeholder:!text-grey200",type:"text",placeholder:"Ex: https://chatway.app"},null,544),[[bt,p(y).href,void 0,{trim:!0}]]),e("button",{onClick:E[2]||(E[2]=(...x)=>p(i)&&p(i)(...x)),disabled:!p(y).href,class:"p-2 h-auto bg-grey900 text-white text-sm disabled:!bg-grey900 disabled:opacity-60"},"Apply",8,dW)],36),[[Gt,p(c)]]),F(e("div",{ref_key:"linkPopup",ref:T,class:"link-popup absolute flex left-1/2 -translate-x-1/2 items-center gap-2 rounded-lg max-w-[370px] w-full divide-x divide-grey200 bg-white shadow-[0px_8px_16px_0px_rgba(40,45,62,0.16)]",style:lt([{top:p(_).top+"px",left:p(_).left+"px"}])},[e("div",uW,[E[6]||(E[6]=e("div",{class:"text-sm font-semibold text-grey900"},"Open",-1)),e("a",{class:"text-sm text-grey900 underline cursor-pointer w-[155px] truncate",href:p(y).href,target:"_blank"},I(p(y).href),9,cW)]),e("div",mW,[e("div",{onClick:E[4]||(E[4]=(...x)=>p(n)&&p(n)(...x)),class:"flex items-center gap-1 shrink-0 py-3 px-2 cursor-pointer"},E[7]||(E[7]=[e("img",{class:"w-3 h-3",src:sn,alt:""},null,-1),e("div",{class:"text-sm text-grey900"},"Edit",-1)])),e("div",{onClick:E[5]||(E[5]=(...x)=>p(m)&&p(m)(...x)),class:"flex items-center gap-1 shrink-0 py-3 px-2 cursor-pointer"},E[8]||(E[8]=[e("img",{class:"w-4 h-4",src:HG,alt:""},null,-1),e("div",{class:"text-sm text-grey900"},"Unlink",-1)]))])],4),[[Gt,p(w)]]),p(f)?(a(),ne(lW,{key:0,ref_key:"fileUploader",ref:B,accept:"image/png, image/gif, image/jpeg, image/webp",class:"top-[34px] left-2 !min-h-[298px]",onFileUploaded:p(r)},null,8,["onFileUploaded"])):h("",!0)]),S.hasError?(a(),d("div",gW,[(a(!0),d(Se,null,Ne(S.validationMessage,(x,P)=>(a(),d("div",{key:P},[e("span",pW,I(x.$message),1)]))),128))])):h("",!0)]))}}),fW={class:"mt-4"},hW={class:"mt-4"},_W=fe({__name:"AddFaq",props:{selectedFaq:{}},emits:["saveFaq","backToFaqList"],setup(o,{expose:s,emit:t}){const n=t,l=o,i=Nt({question:"",answer:"",id:""}),m=w=>f=>f?f.replace(/<[^>]*>/g,"").split(" ").filter(C=>C).length<=w:!0,r={question:{required:Ye.withMessage("Question is required",ut),maxLength:Ye.withMessage("Question should not exceed 100 words",m(100))},answer:{required:Ye.withMessage("Answer is required",ut),maxLength:Ye.withMessage("Answer should not exceed 1000 words",m(1e3))}},u=bs(r,i,{$scope:!1,$stopPropagation:!0}),g=()=>{i.question="",i.answer="",i.id="",u.value.$reset()},y=()=>{u.value.$touch(),!u.value.$invalid&&n("saveFaq",i)},c=()=>{n("backToFaqList")};return We(()=>l.selectedFaq,w=>{w&&(i.question=w.question,i.answer=w.answer,i.id=w.id)}),s({resetState:g}),(w,f)=>{const v=Pe("InputField");return a(),d("div",null,[e("div",{class:"flex items-center justify-between"},[e("div",{onClick:c,class:"inline-flex items-center gap-2 cursor-pointer"},f[4]||(f[4]=[e("img",{src:ws,alt:""},null,-1),e("div",{class:"text-sm text-grey900"},"Back",-1)])),e("div",null,[e("button",{onClick:y,class:"bg-grey900 text-white"},"Save FAQ")])]),e("div",fW,[W(v,{label:"Question",value:i.question,type:"text",forValue:"question",placeholder:"Enter your question",hasError:p(u).question.$error,validationMessage:p(u).question.$errors,class:O({"[&_*]:text-right":p(Ds)(i.question)}),onInput:f[0]||(f[0]=C=>i.question=C),onBlur:f[1]||(f[1]=C=>p(u).question.$touch())},null,8,["value","hasError","validationMessage","class"])]),e("div",hW,[f[5]||(f[5]=e("label",{for:"answer"},"Answer",-1)),W(vW,{modelValue:i.answer,"onUpdate:modelValue":[f[2]||(f[2]=C=>i.answer=C),f[3]||(f[3]=C=>p(u).answer.$touch())],hasError:p(u).answer.$error,validationMessage:p(u).answer.$errors,class:"h-[342px] faq-editor"},null,8,["modelValue","hasError","validationMessage"])])])}}}),yW={class:"mt-1"},bW={class:"flex items-center gap-1 mb-1 text-"},wW={class:"p-3 w-96"},xW=["src"],CW={key:0,class:"flex items-center gap-1 mb-2"},kW={class:"w-4 h-4",src:to,alt:""},$W={class:"flex items-center gap-1"},SW={src:SG,alt:"",class:"w-5 h-5 text-grey600 group-hover:text-primary"},TW={key:0,class:"text-grey-900 group-hover:text-primary"},MW={key:1,class:"text-grey-900 group-hover:text-primary"},AW={key:2,class:"text-grey-900 group-hover:text-primary"},EW={src:Ao,alt:"",class:"arrowRight"},DW={class:"grow w-full md:w-[440px] md:h-[531px] border-r p-4 overflow-y-auto"},IW={class:"flex items-center gap-2"},FW={key:0,class:"flex items-start gap-1 mt-4"},PW={key:1,class:"text-sm font-semibold text-grey900 mt-6 mb-1"},jW={key:2,class:"text-sm font-semibold text-grey900 mt-6 mb-1"},LW={class:"w-full md:w-[330px] md:h-[531px] p-4 border-t md:border-none"},RW=["disabled"],BW=fe({__name:"WidgetFaqs",props:{defaultLanguage:{},activeWidgetColor:{},systemMessageIcon:{},isRemoveChatwayBranding:{type:Boolean}},emits:["save-faqs"],setup(o,{expose:s,emit:t}){const n=As(),{height:l,width:i}=Ht(),m=ls(),r=t,u=$(!1),g=$(!1),y=$(!1),c=$(!1),w=$([]),f=$([]),v=$(null),C=$("opened"),_=$(),A=[{id:"dummy1",question:"How can I track my order?",answer:""},{id:"dummy2",question:"When will I get my order?",answer:""},{id:"dummy3",question:"Do you ship internationally?",answer:""},{id:"dummy4",question:"What is your return policy?",answer:""},{id:"dummy5",question:"How do I request a refund?",answer:""}],D=b(()=>w.value.length),T=b(()=>!Ke.isEqual({show_faq:g.value,faqs:w.value},{show_faq:n.show_faq,faqs:n.faqs})),B=()=>{u.value=!0},S=V=>{if(V.id){const Z=w.value.findIndex(ae=>ae.id===V.id);w.value[Z]={id:V.id,question:V.question,answer:V.answer}}else w.value.push({id:is(),question:V.question,answer:V.answer});P()},E=V=>{v.value=V,c.value=!0},x=V=>{w.value=w.value.filter(Z=>Z.id!==V.id),w.value.length===0&&(g.value=!1)},P=()=>{var V;v.value=null,(V=_.value)==null||V.resetState(),c.value=!1},j=()=>{w.value.length===0&&(g.value=!1),f.value=Ke.cloneDeep(w.value),y.value=g.value,r("save-faqs",Ke.cloneDeep({show_faq:g.value,faqs:w.value})),u.value=!1},H=()=>{f.value.length?(w.value=Ke.cloneDeep(f.value),g.value=y.value):(w.value=Ke.cloneDeep(n.faqs),g.value=n.show_faq),u.value=!1,P()},k=()=>{M(),u.value=!1,P()},M=()=>{y.value=!1,m.name=="onboarding-widget"?(w.value=A,f.value=Ke.cloneDeep(w.value)):(f.value=[],w.value=Ke.cloneDeep(n.faqs)),g.value=n.show_faq,r("save-faqs",Ke.cloneDeep({show_faq:g.value,faqs:w.value}))};return We(()=>n.faqs,M,{deep:!0}),Xe(()=>{M()}),s({resetFaqsSettings:k}),(V,Z)=>{const ae=Pe("Modal"),ce=He("svg-inline");return a(),d("div",yW,[e("div",bW,[Z[4]||(Z[4]=e("span",{class:"font-normal text-sm text-grey600"},"Add Frequently asked questions",-1)),W(yt,{placement:"right"},{content:K(()=>[e("div",wW,[Z[2]||(Z[2]=e("span",null," Display a list of common questions and answers directly in the live chat widget. When visitors open the chat, they'll see these FAQs first, helping them find quick answers and reducing the number of support queries your team needs to handle. ",-1)),e("img",{class:"mt-2",src:`${p(De)}images/faq.png`,alt:""},null,8,xW)])]),default:K(()=>[Z[3]||(Z[3]=e("img",{src:as,alt:""},null,-1))]),_:1})]),p(m).name=="settings-design-view"&&T.value?(a(),d("div",CW,[F(e("img",kW,null,512),[[ce]]),Z[5]||(Z[5]=e("span",{class:"text-[#ff4545]"},"Please click the publish button to save all changes",-1))])):h("",!0),e("button",{onClick:B,class:"p-2 bg-grey100 flex justify-between gap-16 group hover:bg-[#F3F9FF] min-w-[190px]"},[e("span",$W,[F(e("img",SW,null,512),[[ce]]),g.value?D.value?(a(),d("span",MW,I(D.value)+" FAQs Added",1)):(a(),d("span",AW,"Add")):(a(),d("span",TW,"Enable FAQs"))]),F(e("img",EW,null,512),[[ce]])]),F(W(ae,{closeModal:u.value,"header-title":"FAQs",actionButtonTypeOneText:"Cancel",actionButtonTypeTwoText:"Save",disableButtonTwo:c.value,onActionButtonTypeOne:k,onActionButtonTypeTwo:j,onCloseModal:H,footerTopBorder:"",classes:"md:!w-[920px]"},{FooterLeftContent:K(()=>[e("button",{onClick:Z[1]||(Z[1]=J=>c.value=!0),disabled:c.value,class:"inline-flex items-center gap-1 bg-main100 py-1.5 px-2 h-auto rounded cursor-pointer disabled:!bg-main100 disabled:opacity-40"},Z[8]||(Z[8]=[e("img",{class:"w-4 h-4",src:MG,alt:""},null,-1),e("span",{class:"text-sm text-primary"},"Add FAQ",-1)]),8,RW)]),default:K(()=>[e("div",{class:O(["md:flex overflow-auto",[p(l)<=1080&&p(i)<=767||p(l)<=700&&p(i)>767?"h-[calc(100vh-147px)]":"h-full"]])},[e("div",DW,[F(e("div",null,[e("div",IW,[W(Sa,{value:g.value,onInput:Z[0]||(Z[0]=J=>g.value=!g.value),size:"small",class:O({"!bg-danger":!g.value})},null,8,["value","class"]),Z[6]||(Z[6]=e("div",{class:"text-sm text-grey900"},"Show FAQs on your Chatway widget",-1))]),g.value?h("",!0):(a(),d("div",FW,Z[7]||(Z[7]=[e("img",{class:"mt-0.5",src:TG,alt:""},null,-1),e("div",{class:"text-sm text-danger"},"Currently, no FAQs are displayed. Please enable to display FAQs on the widget side.",-1)]))),D.value?(a(),d("div",PW,"Added FAQs: ("+I(D.value)+")",1)):(a(),d("div",jW,"No FAQ found")),W(qG,{faqs:w.value,onEditFaq:E,onDeleteFaq:x},null,8,["faqs"])],512),[[Gt,!c.value]]),F(W(_W,{ref_key:"addFaqComponent",ref:_,selectedFaq:v.value,onSaveFaq:S,onBackToFaqList:P},null,8,["selectedFaq"]),[[Gt,c.value]])]),e("div",LW,[W(an,{activeWidgetColor:V.activeWidgetColor,activeWidgetStateKey:C.value,thumbnailList:p(In),faqs:w.value,isFaqEnabled:g.value,showPreviewToggle:!1,showUserMessage:!1,canClose:!1,defaultLanguage:V.defaultLanguage,systemMessageIcon:V.systemMessageIcon,isRemoveChatwayBranding:V.isRemoveChatwayBranding,showPreviewHeader:!1,isFaqPreview:!0},null,8,["activeWidgetColor","activeWidgetStateKey","thumbnailList","faqs","isFaqEnabled","defaultLanguage","systemMessageIcon","isRemoveChatwayBranding"])])],2)]),_:1},8,["closeModal","disableButtonTwo"]),[[Gt,u.value]])])}}});const NW=Oe(BW,[["__scopeId","data-v-1ed7fb29"]]),OW={key:1,class:"widget--form"},VW={class:"md:flex justify-end md:overflow-y-auto md:h-full"},UW={class:"builder-wrap"},GW={class:"preview-container pt-4 pb-[6.19rem] h-full w-full bg-grey100 items-center flex justify-center"},WW=fe({__name:"WidgetDesignSettings",setup(o){const{isSmallScreen:s}=hs(),{getWidget:t,updateWidget:n,uploadSystemMessageIcon:l,uploadCustomWidget:i,formatLanguages:m,bubblePosition:r,previewBubblePosition:u,previewWidgetPosition:g,previewWidgetHeight:y,widgetPosition:c,widgetSizeInPixel:w,widgetBubbles:f,getBubbleColor:v,activeWidgetPositionKey:C,activeCustomWidgetPositionKey:_,bubbleBottomSpacing:A,bubbleSideSpacing:D,activeWidgetSizeKey:T,customWidgetSize:B,widgetColors:S,chatBubbleColor:E,activeWidgetColor:x,widgetPositions:P,customWidgetPosition:j,widgetSizes:H}=ii(),{isOwnerOrAdmin:k}=Xt(),{height:M,width:V}=Ht(),Z=As(),ae=Es(),ce=Ae(),J=$(""),X=$("#FFFFFF"),z=$("#FF9900"),q=$("#FFFFFF"),ue=$("#FFFFFF"),pe=$("system-base"),de=$([{key:"both",title:"Both"},{key:"desktop",title:"Desktop"},{key:"mobile",title:"Mobile"}]),he=$("both"),ve=$({}),be=$({}),re=$(!1),ie=$(!1),xe=$(!1),N=$("Hi, how can we help?"),L={is_trigger_enabled:!1,has_display_after_time:!0,display_after_time:0,has_display_page_scroll:!1,has_display_visitor_leaving_page:!1,display_page_scroll:25},me={is_enable:!1,rules:[{id:is(),domain:"",page:"",condition:"contains",visibility:"show"}]},G=$(Ke.cloneDeep(me)),U=Ke.cloneDeep(G),R=$({country_codes:[],is_enable:!1,is_selected_all:!0}),ee=$({country_codes:[],is_enable:!1,is_selected_all:!0}),se=$(L),Y=$(L),Fe=$("chat-smile"),oe=$(""),st=$("click"),Le=$(!1),le=$([{key:"click",name:"Click to open"},{key:"opened",name:"Opened by default"}]),Ie=$("none"),rt=$([{key:"none",name:"None"},{key:"bounce",name:"Bounce"},{key:"waggle",name:"Waggle"},{key:"floating",name:"Floating"},{key:"sheen",name:"Sheen"},{key:"spin",name:"Spin"},{key:"fade",name:"Fade"},{key:"shockwave",name:"Shockwave"},{key:"pulse",name:"Pulse"},{key:"blink",name:"Blink"}]),Et=$(!0),ye=$(!1),_t=$(),Ce=$({}),vt=$({}),qe=$(),Je=$([]),ft=$(),Ve=$({}),Re=$(),it=$(!1),tt=$(""),Be=$(),at=$(),Ue=$(!1),Ct=$({show_faq:!1,faqs:[]}),te=$(),Q=b(()=>Z.attributes),Te=b(()=>!Ke.isEqual(Je.value,Z.contact_form)),je=b(()=>Object.keys(Z.languages).length===1&&Z.languages.ENGLISH?!Ke.isEqual(Ve.value.ENGLISH,Z.languages.ENGLISH):!Ke.isEqual(Ve.value,Z.languages)),Ge=b(()=>!Ke.isEqual(vt.value,Ce.value)),mt=b(()=>{var Ee,ot,Ot,Cs,es;return(ot=(Ee=Z.attributes)==null?void 0:Ee.automated_message_settings)!=null&&ot.timezone&&((Cs=(Ot=Z.attributes)==null?void 0:Ot.automated_message_settings)!=null&&Cs.working_hours)?!Ke.isEqual(ve.value,(es=Z.attributes)==null?void 0:es.automated_message_settings):!Ke.isEqual(ve.value,be.value)}),wt=b(()=>ce.isTrialContainerVisible&&k||ce.hasFailedPayment&&k),$t=b(()=>Z.showFullScreen),Dt=b(()=>Z.widgetTriggers),zt=b(()=>!Ke.isEqual(Y.value,se.value)),qt=b(()=>!Ke.isEqual(U.value,G.value)),os=b(()=>!Ke.isEqual(ee.value,R.value)),dt=b(()=>!Ke.isEqual(Ct.value,{show_faq:Z.show_faq,faqs:Z.faqs})),St=b(()=>{var Ee;return!ce.hasTrial&&((Ee=ce.subscription)==null?void 0:Ee.attributes.plan_type.toLowerCase())==="free"}),xs=b(()=>ce.isProUser),La=b(()=>!xs.value&&!St.value),Ps=b(()=>!xs.value&&St.value),Eo=b(()=>{var Ee;return{show_faq:Ct.value.show_faq,faqs:(Ee=Ct.value.faqs)==null?void 0:Ee.map(ot=>({question:ot.question,answer:ot.answer}))}}),Js=b(()=>{var Ee,ot,Ot,Cs,es,js,Bt,Xs,fa,ha,_a,ya,ba,ea,wa,xa,Ca,ka,ta,sa,$a,ge;return Q.value?re.value!==!!((Ee=Q==null?void 0:Q.value)!=null&&Ee.is_preview_text_enabled)||ie.value!==((ot=Q==null?void 0:Q.value)==null?void 0:ot.is_welcome_text_enabled)||C.value!==((Ot=Q==null?void 0:Q.value)==null?void 0:Ot.position)||_.value!==((Cs=Q==null?void 0:Q.value)==null?void 0:Cs.custom_position_side)||he.value!==((es=Q==null?void 0:Q.value)==null?void 0:es.device_appearance)||A.value!==((js=Q==null?void 0:Q.value)==null?void 0:js.bottom_spacing)||D.value!==((Bt=Q==null?void 0:Q.value)==null?void 0:Bt.side_spacing)||st.value!==((Xs=Q==null?void 0:Q.value)==null?void 0:Xs.default_state)||Fe.value!==((fa=Q==null?void 0:Q.value)==null?void 0:fa.widget_icon)||T.value!==((ha=Q==null?void 0:Q.value)==null?void 0:ha.widget_size)||B.value!==((_a=Q==null?void 0:Q.value)==null?void 0:_a.custom_widget_size)||((ya=x.value)==null?void 0:ya.color)!==((ba=Q==null?void 0:Q.value)==null?void 0:ba.widget_color)||oe.value!==((ea=Q==null?void 0:Q.value)==null?void 0:ea.widget_icon_url)||Ie.value!==((wa=Q==null?void 0:Q.value)==null?void 0:wa.attention_effect)||X.value!==((xa=Q==null?void 0:Q.value)==null?void 0:xa.header_text_color)||z.value!==((Ca=Q==null?void 0:Q.value)==null?void 0:Ca.avatar_border_color)||E.value!==((ka=Q==null?void 0:Q.value)==null?void 0:ka.chat_bubble_color)||q.value!==((ta=Q==null?void 0:Q.value)==null?void 0:ta.chat_font_color)||ue.value!==((sa=Q==null?void 0:Q.value)==null?void 0:sa.close_icon_color)||pe.value!=(($a=Q.value)==null?void 0:$a.system_message_icon)||Ue.value!=((ge=Q.value)==null?void 0:ge.is_removed_chatway_branding)||je.value||Te.value||mt.value||zt.value||qt.value||os.value||Ge.value||dt.value:Z.uiFlags.isFetchingWidget}),rs=b(()=>{const Ee=Ba(Ve.value);if(Ee)return Ee;const ot=Ba(Z.languages);return ot||ae.widgetLangs.ENGLISH}),so=()=>{var Ee,ot,Ot,Cs,es,js,Bt,Xs,fa,ha,_a,ya,ba,ea,wa,xa,Ca,ka,ta,sa,$a,ge,we,et,pt,Pt,Lt,ks,vs;C.value=(Ee=Q==null?void 0:Q.value)==null?void 0:Ee.position,he.value=(ot=Q==null?void 0:Q.value)==null?void 0:ot.device_appearance,_.value=(Ot=Q.value)==null?void 0:Ot.custom_position_side,A.value=(Cs=Q.value)==null?void 0:Cs.bottom_spacing,D.value=(es=Q.value)==null?void 0:es.side_spacing,st.value=(js=Q.value)==null?void 0:js.default_state,Ie.value=(Bt=Q.value)==null?void 0:Bt.attention_effect,re.value=!!((Xs=Q.value)!=null&&Xs.is_preview_text_enabled),ie.value=(fa=Q.value)==null?void 0:fa.is_welcome_text_enabled,N.value=(ha=Q.value)!=null&&ha.preview_text?(_a=Q.value)==null?void 0:_a.preview_text:"",it.value=((ya=Q.value)==null?void 0:ya.is_pending_mesg_enabled)!==0,Fe.value=(ba=Q.value)==null?void 0:ba.widget_icon,T.value=(ea=Q.value)==null?void 0:ea.widget_size,B.value=(wa=Q.value)==null?void 0:wa.custom_widget_size,x.value=S.value.find(Gs=>{var aa;return Gs.color===((aa=Q.value)==null?void 0:aa.widget_color)})||{color:(xa=Q.value)==null?void 0:xa.widget_color,hex:(Ca=Q.value)==null?void 0:Ca.widget_color},oe.value=(ka=Q.value)==null?void 0:ka.widget_icon_url,X.value=(ta=Q.value)==null?void 0:ta.header_text_color,z.value=(sa=Q.value)==null?void 0:sa.avatar_border_color,E.value=($a=Q.value)==null?void 0:$a.chat_bubble_color,q.value=(ge=Q.value)==null?void 0:ge.chat_font_color,ue.value=(we=Q.value)==null?void 0:we.close_icon_color,pe.value=(et=Q.value)==null?void 0:et.system_message_icon,Ps.value&&(Q.value.country_targeting.is_enable=!1,Q.value.page_targeting.is_enable=!1,Q.value.page_targeting.rules=[]),se.value=Dt!=null&&Dt.value?Dt.value:se.value,Y.value=Ke.cloneDeep(se.value),R.value=(pt=Q.value)==null?void 0:pt.country_targeting,ee.value=Ke.cloneDeep(R.value),ds.value.pageTargetingRule.$model.is_enable=(Pt=Q.value)==null?void 0:Pt.page_targeting.is_enable,ds.value.pageTargetingRule.$model.rules=(Lt=Q.value)==null?void 0:Lt.page_targeting.rules,U.value=Ke.cloneDeep((ks=Q.value)==null?void 0:ks.page_targeting),Ue.value=!!((vs=Q.value)!=null&&vs.is_removed_chatway_branding)},on=()=>{Z.showFullScreen=!1},ao=()=>{Et.value=!1},nn=()=>{Et.value=!Et.value},ln=Ee=>{x.value=Ee},rn=async Ee=>{if(!Ee.size){pe.value=Ee;return}if(Ee&&Ee.size>8192e3){ze().set({message:"File size should be less than 8MB",type:"error"});return}const ot=await l({file:Ee});ot!=null&&ot.data.attributes.url&&(pe.value=ot==null?void 0:ot.data.attributes.url)},dn=Ee=>{C.value=Ee.key},un=Ee=>{he.value=Ee.key},cn=Ee=>{_.value=Ee.key},mn=Ee=>{A.value=Ee},gn=Ee=>{D.value=Ee},pn=Ee=>{st.value=Ee},vn=Ee=>{const ot=le.value.find(Ot=>Ot.key===Ee);return ot?ot.name:null},Do=Ee=>{Ie.value=Ee},Io=Ee=>{Z.hidePreviewTextPreview=!1,re.value=Ee},Fo=()=>{re.value=!1},Po=Ee=>{ie.value=Ee},fn=Ee=>{N.value=Ee},hn=Ee=>{T.value=Ee.key},va=Ee=>{B.value=Ee},jo=Ee=>{Fe.value!=="chat-image"&&(tt.value=Fe.value),Fe.value=Ee.key},Lo=Ee=>{Fe.value!=="chat-image"&&(tt.value=Fe.value),Fe.value=Ee},_n=()=>{xe.value=!xe.value},yn={widget_header_text:{required:Ye.withMessage("Please add header text",ut),maxLength:It(255)},pendingTextMessage:{required:Ye.withMessage("Please add welcome message",Oa(ie)),maxLength:It(255)},triggerSettings:{is_trigger_enabled:{required:ut},display_after_time:{requiredIfFuction:Oa(()=>se.value.is_trigger_enabled&&se.value.has_display_after_time),numeric:$i,minValue:Si(0),maxValue:Ti(999)},display_page_scroll:{requiredIfFuction:Oa(()=>se.value.is_trigger_enabled&&se.value.has_display_page_scroll),numeric:$i,minValue:Si(0),maxValue:Ti(100)}},pageTargetingRule:{is_enable:{required:ut},rules:{$each:Ye.forEach({domain:{requiredIfFuction:Oa(()=>G.value.is_enable),validDomain:Ye.regex(/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)?([a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?)$/)},page:{requiredIfFuction:Oa(()=>G.value.is_enable),urlPath:Ye.regex(/^\/?[a-z\d\-_.~%!$&'()*+,;=:@/]*\??[a-z\d\-_.~%!$&'()*+,;=:@/?]*#?[a-z\d\-_.~%!$&'()*+,;=:@/?]*/i)}})}},countryTargetingRule:{is_enable:{required:ut},country_codes:{requiredIfFuction:Oa(()=>R.value.is_enable)}}},ds=bs(yn,{widget_header_text:J,pendingTextMessage:N,triggerSettings:se,pageTargetingRule:G,countryTargetingRule:R});function bn(){if(ds.value.pageTargetingRule.$error){const Ee=oo();Qs(Ee),G.value.rules.length==0&&(G.value.is_enable=!1)}}function Qs(Ee){if(Ee.length>0)for(let ot=0;ot<Ee.length;ot++)G.value.rules.splice(G.value.rules.findIndex(Ot=>Ot.id===Ee[ot]),1)}function oo(){let Ee=[];for(let ot=0;ot<G.value.rules.length;ot++){const Ot=G.value.rules[ot];Ot.condition=="any-page"&&!Ot.page&&(G.value.rules[ot].page="/"),(!Ot.domain||!Ot.page)&&Ee.push(Ot.id)}return Ee}const wn=async()=>{ds.value.$touch(),bn();const Ee=document.querySelector(".error");if(Ee&&Ee.scrollIntoView({behavior:"smooth",block:"center"}),ds.value.$invalid)return;ds.value.$reset(),ye.value=!0;const ot={position:C.value,custom_position_side:_.value,device_appearance:he.value,bottom_spacing:A.value,side_spacing:D.value,default_state:st.value,preview_text:N.value,is_pending_mesg_enabled:Number(it.value),is_preview_text_enabled:Number(re.value),is_welcome_text_enabled:ie.value,widget_icon:Fe.value==="chat-image"&&!oe.value?tt.value:Fe.value,widget_icon_url:Fe.value==="chat-image"?oe.value:null,widget_size:T.value,custom_widget_size:B.value,widget_color:x.value.color,attention_effect:Ie.value,widget_langs:m(Ve.value),contact_form:Je.value,header_text_color:X.value,avatar_border_color:z.value,chat_bubble_color:v.value,chat_font_color:q.value,close_icon_color:ue.value,system_message_icon:pe.value,automated_message_settings:ve.value,page_targeting:G.value,country_targeting:R.value,triggers:se.value,is_removed_chatway_branding:Ue.value,...vt.value,faq_settings:Eo.value};ce.isProOrProTrialUser||delete ot.is_removed_chatway_branding,await n(ot),xe.value&&(xe.value=!1),Ce.value=Ke.cloneDeep(vt.value),ye.value=!1},Ro=async Ee=>{if(Ee&&Ee.size>8192e3){ze().set({message:"File size should be less than 8MB",type:"error"});return}Ee&&(Le.value=!0,await i({file:Ee}),Ee.size>2097152?setTimeout(()=>{Le.value=!1},3e3):Le.value=!1,Fe.value="chat-image")},xn=()=>{rs.value&&(J.value=rs.value.team_here,N.value=rs.value.widget_text_bubble,ve.value&&(ve.value.working_hour_message=rs.value.working_hour_message,ve.value.none_working_hour_message=rs.value.none_working_hour_message))},no=Ee=>{Ve.value=Ee,xn()},Bo=()=>{var Ee;(Ee=Re.value)==null||Ee.resetWidgetLangs()},No=Ee=>{Je.value=Ee},io=()=>{var Ee;(Ee=ft.value)==null||Ee.resetContactInfo()},Oo=()=>{var Ee;(Ee=qe.value)==null||Ee.onCancel()},Cn=Ee=>{vt.value=Ee,ve.value.timezone=Ee.timezone,Ke.isEmpty(Ce.value)&&(Ce.value=Ke.cloneDeep(Ee))},kn=Ee=>{ve.value=Ee,vt.value.timezone=Ee.timezone,Ke.isEmpty(be.value)&&(be.value=Ke.cloneDeep(Ee))},Ra=()=>{var Ee;(Ee=_t.value)==null||Ee.resetCustomVisibility()},Us=()=>{so(),io(),Bo(),Ra(),Oo(),$n()},Ba=Ee=>Object.values(Ee).find(ot=>(ot==null?void 0:ot.is_default)&&(ot==null?void 0:ot.is_published)),Na=Ee=>{if(!Z.uiFlags.isFetchingWidget&&Js.value)return Ee.preventDefault(),Ee.returnValue="",""},lo=Ee=>{Ct.value=Ee},$n=()=>{var Ee;(Ee=te.value)==null||Ee.resetFaqsSettings()};return We(()=>Z.attributes,()=>{so()}),We(()=>Z.fileUploadUrl,Ee=>{oe.value=Ee}),We(()=>[V.value,M.value,Be.value],()=>{var Ee;at.value=(Ee=Be.value)==null?void 0:Ee.offsetHeight}),Nn(()=>{t(),ae.getWidgetLangs()}),Xe(()=>{var Ee;at.value=(Ee=Be.value)==null?void 0:Ee.offsetHeight,window.addEventListener("beforeunload",Na)}),Ms(()=>{window.removeEventListener("beforeunload",Na),Z.resetStore(),Ve.value={},vt.value={},Ce.value={}}),cl((Ee,ot,Ot)=>{!Z.uiFlags.isFetchingWidget&&Js.value&&!window.confirm("Leave without publishing?")?Ot(!1):Ot()}),Ta({title:"Widget"}),(Ee,ot)=>{var es,js;const Ot=Pe("Loader"),Cs=Pe("TextareaField");return a(),d(Se,null,[e("div",{class:O(["widget-settings--container",{"widget-settings-container-small--screen":p(s)}])},[W(iL,{title:"Widget Settings",actionButtonTypeOneText:"Cancel",isActionButtonOneDisabled:!Js.value,isActionButtonTwoDisabled:Le.value,actionButtonTypeTwoText:"Publish",isLoading:ye.value,showSupportButton:!0,onActionButtonTypeOne:Us,onActionButtonTypeTwo:wn},null,8,["isActionButtonOneDisabled","isActionButtonTwoDisabled","isLoading"]),e("div",{class:O(["widget-settings",{"widget-settings-small--screen":p(s)}])},[p(Z).uiFlags.isFetchingWidget?(a(),ne(Ot,{key:0,size:"24px"})):(a(),d("div",OW,[e("div",{class:O(["widget-builder md:grid grid-cols-2 overflow-y-auto",{"pb-[55px]":wt.value}])},[e("div",VW,[e("div",UW,[W(Cs,{modelValue:J.value,"onUpdate:modelValue":ot[0]||(ot[0]=Bt=>J.value=Bt),hasError:p(ds).widget_header_text.$error,validationMessage:p(ds).widget_header_text.$errors,label:"Header",classes:"!h-16",placeholder:"Write your header text here"},null,8,["modelValue","hasError","validationMessage"]),W(SU,{onSaveCustomWidgetVisibility:Cn,ref_key:"widgetCustomVisibility",ref:_t},null,512),W(RR,{activeWidgetColor:p(x),widgetColors:p(S),headerFontColor:X.value,avatarBorderColor:z.value,chatBubbleColor:p(v),chatFontColor:q.value,closeIconColor:ue.value,systemMessageIcon:pe.value,showAdvancedSettings:xe.value,onChangeHeaderFontColor:ot[1]||(ot[1]=Bt=>X.value=Bt),onChangeAvatarBorderColor:ot[2]||(ot[2]=Bt=>z.value=Bt),onChangeChatBubbleColor:ot[3]||(ot[3]=Bt=>E.value=Bt),onChangeChatFontColor:ot[4]||(ot[4]=Bt=>q.value=Bt),onChangeCloseIconColor:ot[5]||(ot[5]=Bt=>ue.value=Bt),onChangeSystemMessageIcon:rn,onChangeColor:ln,onHandleShowAdvancedSettings:_n},null,8,["activeWidgetColor","widgetColors","headerFontColor","avatarBorderColor","chatBubbleColor","chatFontColor","closeIconColor","systemMessageIcon","showAdvancedSettings"]),W(NW,{defaultLanguage:rs.value,activeWidgetColor:p(x),systemMessageIcon:pe.value,isRemoveChatwayBranding:Ue.value,onSaveFaqs:lo,ref_key:"faqComponent",ref:te},null,8,["defaultLanguage","activeWidgetColor","systemMessageIcon","isRemoveChatwayBranding"]),W(XR,{activeWidgetPositionKey:p(C),activeCustomWidgetPositionKey:p(_),widgetPositions:p(P),customWidgetPosition:p(j),bubbleBottomSpacing:p(A),bubbleSideSpacing:p(D),onChangePosition:dn,onChangeCustomPosition:cn,onChangeBottomSpacing:mn,onChangeSideSpacing:gn},null,8,["activeWidgetPositionKey","activeCustomWidgetPositionKey","widgetPositions","customWidgetPosition","bubbleBottomSpacing","bubbleSideSpacing"]),W(o7,{widgetAppearanceOptions:de.value,activeDeviceAppearanceOption:he.value,onChangeAppearance:un},null,8,["widgetAppearanceOptions","activeDeviceAppearanceOption"]),W(vV,{onSaveContactInfo:No,defaultLanguage:rs.value,activeWidgetColor:p(x),systemMessageIcon:pe.value,isRemoveChatwayBranding:Ue.value,ref_key:"contactInfoSelector",ref:ft},null,8,["defaultLanguage","activeWidgetColor","systemMessageIcon","isRemoveChatwayBranding"]),W(oU,{ref_key:"autoWorkingHourComponent",ref:qe,"payload-automated-message-settings":ve.value,"none-working-hour-message":ve.value.none_working_hour_message,"working-hour-message":ve.value.working_hour_message,onChangeSettings:kn},null,8,["payload-automated-message-settings","none-working-hour-message","working-hour-message"]),p(ce).isProOrProTrialUser||!Ue.value?(a(),ne($G,{key:0,isRemoveChatwayBranding:Ue.value,onUpdateBranding:ot[6]||(ot[6]=Bt=>Ue.value=!Ue.value)},null,8,["isRemoveChatwayBranding"])):h("",!0),W(C7,{previewTextBubble:re.value,isWelcomeTextEnabled:ie.value,pendingMessage:N.value,hasError:p(ds).pendingTextMessage.$error,validationMessage:p(ds).pendingTextMessage.$errors,onTextInput:fn,onInput:Io,onToggleWelcomeText:Po},null,8,["previewTextBubble","isWelcomeTextEnabled","pendingMessage","hasError","validationMessage"]),W(M7,{modelValue:se.value,"onUpdate:modelValue":ot[7]||(ot[7]=Bt=>se.value=Bt),validator:p(ds)},null,8,["modelValue","validator"]),W(nG,{modelValue:G.value,"onUpdate:modelValue":ot[8]||(ot[8]=Bt=>G.value=Bt),validator:p(ds),disable:Ps.value},null,8,["modelValue","validator","disable"]),W(fG,{onSettings:ot[9]||(ot[9]=Bt=>R.value=Bt),settings:R.value,validator:p(ds),disable:Ps.value},null,8,["settings","validator","disable"]),La.value?(a(),ne(yG,{key:1,countryTargetingSettings:R.value,pageTargetingSettings:G.value},null,8,["countryTargetingSettings","pageTargetingSettings"])):h("",!0),W(L7,{activeWidgetSizeKey:p(T),widgetSizes:p(H),customWidgetSize:p(B),onChangeSize:hn,onChangeCustomSize:va},null,8,["activeWidgetSizeKey","widgetSizes","customWidgetSize"]),W(dB,{showCustom:"",activeWidgetBubbleKey:Fe.value,customWidgetBubbleSrc:oe.value,widgetBubbles:p(f),onChangeBubble:jo,isCustomBubbleLoading:Le.value,onChangeCustomWidgetBubble:Lo,onChangeCustomBubble:Ro},null,8,["activeWidgetBubbleKey","customWidgetBubbleSrc","widgetBubbles","isCustomBubbleLoading"]),W(m7,{activeWidgetStateKey:st.value,stateOptions:le.value,onChangeState:pn,onChangeName:vn},null,8,["activeWidgetStateKey","stateOptions"]),st.value==="click"?(a(),ne($V,{key:2,activeWidgetEffectKey:Ie.value,effectOptions:rt.value,onChangeEffect:Do},null,8,["activeWidgetEffectKey","effectOptions"])):h("",!0),W(GO,{onSaveWidgetLangs:no,onInitWidgetLangs:no,widgetHeaderText:J.value,pendingTextMessage:N.value,ref_key:"widgetLanguageSelector",ref:Re,"working-hour-message":(es=ve.value)==null?void 0:es.working_hour_message,"none-working-hour-message":(js=ve.value)==null?void 0:js.none_working_hour_message},null,8,["widgetHeaderText","pendingTextMessage","working-hour-message","none-working-hour-message"])])]),e("div",GW,[e("div",{class:O(["relative",[(p(V)>699&&p(M)<=900&&Je.value.length,"h-full")]])},[e("div",{ref_key:"previewContainer",ref:Be,class:"builder-preview"},[$t.value?h("",!0):(a(),ne(an,{key:0,activeWidgetColor:p(x),activeWidgetBubbleKey:Fe.value,activeWidgetStateKey:st.value,activeWidgetEffectKey:Ie.value,activeWidgetPositionKey:p(C),pendingTextMessage:N.value,thumbnailList:p(In),bubblePosition:p(r),widgetPosition:p(c),previewBubblePosition:p(u),pendingMessage:it.value,previewTextBubble:re.value,isWelcomeTextEnabled:ie.value,widgetBubbleSize:p(w),showCustom:p(T)==="custom",customWidgetBubbleSrc:oe.value,previousWidgetBubbleKey:tt.value,defaultLanguage:rs.value,headerFontColor:X.value,avatarBorderColor:z.value,chatBubbleColor:p(v),chatFontColor:q.value,closeIconColor:ue.value,systemMessageIcon:pe.value,contact_fields:Je.value,previewContainerHeight:at.value,isRemoveChatwayBranding:Ue.value,faqs:Ct.value.faqs,isFaqEnabled:Ct.value.show_faq,onCloseWidgetPreview:ao,onToggleWidgetPreview:nn,onClosePreviewBubble:Fo},null,8,["activeWidgetColor","activeWidgetBubbleKey","activeWidgetStateKey","activeWidgetEffectKey","activeWidgetPositionKey","pendingTextMessage","thumbnailList","bubblePosition","widgetPosition","previewBubblePosition","pendingMessage","previewTextBubble","isWelcomeTextEnabled","widgetBubbleSize","showCustom","customWidgetBubbleSrc","previousWidgetBubbleKey","defaultLanguage","headerFontColor","avatarBorderColor","chatBubbleColor","chatFontColor","closeIconColor","systemMessageIcon","contact_fields","previewContainerHeight","isRemoveChatwayBranding","faqs","isFaqEnabled"]))],512)],2)])],2)]))],2)],2),$t.value?(a(),ne(EU,{key:0,onCloseFullScreenPreview:on,activeWidgetColor:p(x),activeWidgetBubbleKey:Fe.value,activeWidgetStateKey:st.value,activeWidgetEffectKey:Ie.value,activeWidgetPositionKey:p(C),pendingTextMessage:N.value,thumbnailList:p(In),bubblePosition:p(r),widgetPosition:p(c),previewBubblePosition:p(u),previewWidgetPosition:p(g),previewWidgetHeight:p(y),pendingMessage:it.value,previewTextBubble:re.value,isWelcomeTextEnabled:ie.value,widgetBubbleSize:p(w),showCustom:p(T)==="custom",customWidgetBubbleSrc:oe.value,previousWidgetBubbleKey:tt.value,defaultLanguage:rs.value,headerFontColor:X.value,avatarBorderColor:z.value,chatBubbleColor:p(v),chatFontColor:q.value,closeIconColor:ue.value,systemMessageIcon:pe.value,contact_fields:Je.value,isRemoveChatwayBranding:Ue.value,faqs:Ct.value.faqs,isFaqEnabled:Ct.value.show_faq},null,8,["activeWidgetColor","activeWidgetBubbleKey","activeWidgetStateKey","activeWidgetEffectKey","activeWidgetPositionKey","pendingTextMessage","thumbnailList","bubblePosition","widgetPosition","previewBubblePosition","previewWidgetPosition","previewWidgetHeight","pendingMessage","previewTextBubble","isWelcomeTextEnabled","widgetBubbleSize","showCustom","customWidgetBubbleSrc","previousWidgetBubbleKey","defaultLanguage","headerFontColor","avatarBorderColor","chatBubbleColor","chatFontColor","closeIconColor","systemMessageIcon","contact_fields","isRemoveChatwayBranding","faqs","isFaqEnabled"])):h("",!0)],64)}}});const qW=Oe(WW,[["__scopeId","data-v-cbd6e1ab"]]),li=Gd({history:Wd("/"),scrollBehavior:(o,s,t)=>t||{left:0,top:0},routes:[{path:"/",component:F0},{path:"/:pathMatch(.*)*",name:"not-found",component:()=>gt(()=>import("./NotFound-c778edd3.js"),["assets/NotFound-c778edd3.js","assets/vendor-f9bdd444.js","assets/NotFound-40bfb9a5.css"])},{path:"/shopify",name:"shopify-install",component:()=>gt(()=>import("./shopify-install-43453cb8.js"),["assets/shopify-install-43453cb8.js","assets/vendor-f9bdd444.js","assets/shopify-install-1fd28498.css"])},{path:"/shopify/oauth/overview",name:"shopify-login",component:()=>gt(()=>import("./shopify-login-38f90329.js"),["assets/shopify-login-38f90329.js","assets/vendor-f9bdd444.js","assets/shopify-login-34eb05e6.css"])},{path:"/wix/oauth/overview",name:"wix-login",component:()=>gt(()=>import("./wix-login-78ffd5a0.js"),["assets/wix-login-78ffd5a0.js","assets/vendor-f9bdd444.js","assets/wix-login-a0c8e310.css"])},{path:"/chaty/oauth/overview",name:"chaty-login",component:()=>gt(()=>import("./chaty-login-ed1288ab.js"),["assets/chaty-login-ed1288ab.js","assets/vendor-f9bdd444.js","assets/chaty-login-50ba9c87.css"])},{path:"/wordpress",name:"wordpress",component:()=>gt(()=>import("./wordpress-login-ca99a45b.js"),["assets/wordpress-login-ca99a45b.js","assets/vendor-f9bdd444.js","assets/wordpress-login-8722bda9.css"])},{path:"/duda/oauth/overview",name:"duda-login",component:()=>gt(()=>import("./duda-login-76014712.js"),["assets/duda-login-76014712.js","assets/vendor-f9bdd444.js","assets/duda-login-3680be5e.css"])},{path:"/google/oauth/install",name:"google-login",component:()=>gt(()=>import("./google-login-df491dfe.js"),["assets/google-login-df491dfe.js","assets/vendor-f9bdd444.js","assets/google-login-e1f964ee.css"])},{path:"/square/install",name:"square-install",alias:"/square/overview",component:()=>gt(()=>import("./square-install-dd9be984.js"),["assets/square-install-dd9be984.js","assets/vendor-f9bdd444.js","assets/square-install-b801c8e1.css"])},{path:"/square/oauth/overview",name:"square-login",component:()=>gt(()=>import("./square-login-55d5ebd3.js"),["assets/square-login-55d5ebd3.js","assets/vendor-f9bdd444.js","assets/square-login-226a7093.css"])},{path:"/ecwid/oauth/overview",name:"ecwid-login",component:()=>gt(()=>import("./ecwid-login-ef1e50cb.js"),["assets/ecwid-login-ef1e50cb.js","assets/vendor-f9bdd444.js","assets/ecwid-login-5d74e6eb.css"])},{path:"/bigcartel",name:"big-cartel-install",component:()=>gt(()=>import("./big-cartel-install-092ea21e.js"),["assets/big-cartel-install-092ea21e.js","assets/vendor-f9bdd444.js","assets/big-cartel-install-7d121063.css"])},{path:"/big-cartel/oauth/overview",name:"big-cartel-login",component:()=>gt(()=>import("./big-cartel-login-45ab886c.js"),["assets/big-cartel-login-45ab886c.js","assets/vendor-f9bdd444.js","assets/big-cartel-login-5ea213dd.css"])},{path:"/big-commerce/oauth/install",name:"big-commerce-install",component:()=>gt(()=>import("./big-commerce-install-d60dda8a.js"),["assets/big-commerce-install-d60dda8a.js","assets/vendor-f9bdd444.js","assets/big-commerce-install-26274f78.css"])},{path:"/big-commerce/oauth/overview",name:"big-commerce-login",component:()=>gt(()=>import("./big-commerce-login-8602ce99.js"),["assets/big-commerce-login-8602ce99.js","assets/vendor-f9bdd444.js","assets/big-commerce-login-289b4c9d.css"])},{path:"/thinkific/install",name:"thinkific-install",component:()=>gt(()=>import("./thinkific-install-8d6c2fa0.js"),["assets/thinkific-install-8d6c2fa0.js","assets/vendor-f9bdd444.js","assets/thinkific-install-a1c11ea0.css"])},{path:"/thinkific/oauth/overview",name:"thinkific-login",component:()=>gt(()=>import("./thinkific-login-1cb4b26b.js"),["assets/thinkific-login-1cb4b26b.js","assets/vendor-f9bdd444.js","assets/thinkific-login-e9f751c9.css"])},{path:"/nuvemshop/install",name:"nuvemshop-install",component:()=>gt(()=>import("./nuvemshop-install-62fb4bcc.js"),["assets/nuvemshop-install-62fb4bcc.js","assets/vendor-f9bdd444.js","assets/nuvemshop-install-2f27f747.css"])},{path:"/nuvemshop/oauth/overview",name:"nuvemshop-login",component:()=>gt(()=>import("./nuvemshop-login-78b21006.js"),["assets/nuvemshop-login-78b21006.js","assets/vendor-f9bdd444.js","assets/nuvemshop-login-95c9968f.css"])},{path:"/",component:V0,children:[{path:"login",name:"login",component:Zx,meta:{guest:!0}},{path:"register",name:"register",component:dC,meta:{guest:!0}},{path:"forgot-password",name:"forgot-password",component:()=>gt(()=>import("./forgot-password-8f7251b6.js"),["assets/forgot-password-8f7251b6.js","assets/vendor-f9bdd444.js"]),meta:{guest:!0}},{path:"password/reset/:token",name:"password-reset-token",component:()=>gt(()=>import("./reset-password-token-ef30623a.js"),["assets/reset-password-token-ef30623a.js","assets/vendor-f9bdd444.js"]),meta:{guest:!0}},{path:"password/reset/",name:"password-reset",component:()=>gt(()=>import("./reset-password-3d89e21e.js"),["assets/reset-password-3d89e21e.js","assets/vendor-f9bdd444.js","assets/reset-password-466fda54.css"]),meta:{guest:!0}},{path:"embed/:id",name:"installation-code",component:()=>gt(()=>import("./installation-code-4b8ca705.js"),["assets/installation-code-4b8ca705.js","assets/vendor-f9bdd444.js","assets/installation-code-8fd245db.css"]),meta:{guest:!0}},{path:"grant-access",name:"grant-access",component:()=>gt(()=>import("./grant-access-ce8a7723.js"),["assets/grant-access-ce8a7723.js","assets/vendor-f9bdd444.js"]),meta:{guest:!0}}]},{path:"/",component:()=>gt(()=>import("./onboarding-ee7bdde2.js"),["assets/onboarding-ee7bdde2.js","assets/vendor-f9bdd444.js","assets/onboarding-5b6e17ea.css"]),children:[{path:"onboarding/info",name:"onboarding-info",component:()=>gt(()=>import("./OnboardingScreenInfo-6bae2571.js"),["assets/OnboardingScreenInfo-6bae2571.js","assets/vendor-f9bdd444.js","assets/dummy-image-upload-80b60261.js","assets/OnboardingHeader-4bf63f2c.js","assets/arrow-right-white-74c62b1a.js","assets/OnboardingHeader-cb286fe4.css","assets/OnboardingScreenInfo-e5c97b37.css"]),meta:{requiresAuth:!0,memberAccess:!0,onboardingPath:!0}},{path:"onboarding/widget",name:"onboarding-widget",component:()=>gt(()=>import("./OnboardingScreenWidget-8ef0e7fc.js"),["assets/OnboardingScreenWidget-8ef0e7fc.js","assets/vendor-f9bdd444.js","assets/OnboardingHeader-4bf63f2c.js","assets/arrow-right-white-74c62b1a.js","assets/OnboardingHeader-cb286fe4.css","assets/OnboardingScreenWidget-61fc587f.css"]),meta:{requiresAuth:!0,memberAccess:!0,onboardingPath:!0}},{path:"onboarding/invite",name:"onboarding-invite",component:()=>gt(()=>import("./OnboardingScreenInvite-4fe0b79e.js"),["assets/OnboardingScreenInvite-4fe0b79e.js","assets/vendor-f9bdd444.js","assets/OnboardingHeader-4bf63f2c.js","assets/arrow-right-white-74c62b1a.js","assets/OnboardingHeader-cb286fe4.css","assets/OnboardingScreenInvite-4d193db6.css"]),meta:{requiresAuth:!0,memberAccess:!0,onboardingPath:!0}},{path:"agent/invite/:id?",name:"onboarding-agent",component:()=>gt(()=>import("./OnboardingAgentScreen-f8aadd17.js"),["assets/OnboardingAgentScreen-f8aadd17.js","assets/vendor-f9bdd444.js","assets/dummy-image-upload-80b60261.js","assets/OnboardingHeader-4bf63f2c.js","assets/arrow-right-white-74c62b1a.js","assets/OnboardingHeader-cb286fe4.css","assets/OnboardingAgentScreen-05741744.css"]),meta:{requiresAuth:!1,memberAccess:!0,onboardingPath:!0}}]},{path:"/onboarding/plans",name:"onboarding-plans",component:()=>gt(()=>import("./OnboardingPlanScreen-606d3cdf.js"),["assets/OnboardingPlanScreen-606d3cdf.js","assets/RefundTag-b29aa092.js","assets/vendor-f9bdd444.js","assets/OnboardingPlanScreen-21e042b0.css"]),meta:{requiresAuth:!0,memberAccess:!0}},{path:"/fullscreen",name:"fullscreen",component:()=>gt(()=>import("./fullscreen-f5e84344.js"),["assets/fullscreen-f5e84344.js","assets/vendor-f9bdd444.js","assets/fullscreen-793eb4d2.css"]),meta:{requiresAuth:!0,memberAccess:!0}},{path:"/",component:Pb,children:[{path:"conversations",name:"conversations",component:Hi,meta:{requiresAuth:!0,memberAccess:!0}},{path:"conversations/:id",name:"conversations-view",component:Hi,meta:{requiresAuth:!0,memberAccess:!0}}]},{path:"/",component:()=>gt(()=>import("./overview-9e14287d.js"),["assets/overview-9e14287d.js","assets/vendor-f9bdd444.js","assets/overview-6b15d0bc.css"]),children:[{path:"overview",name:"overview-view",component:()=>gt(()=>import("./Overview-c6478d4f.js"),["assets/Overview-c6478d4f.js","assets/vendor-f9bdd444.js","assets/DateFilterDropdown-3f7a8097.js","assets/DateFilterDropdown-7aa5fb17.css","assets/Overview-f9603d59.css"]),meta:{requiresAuth:!0,memberAccess:!0}}]},{path:"/",component:()=>gt(()=>import("./contact-38644c33.js"),["assets/contact-38644c33.js","assets/contact-66227352.js","assets/vendor-f9bdd444.js","assets/contact-c002e18e.css"]),children:[{path:"contacts",name:"contacts",component:()=>gt(()=>import("./Contacts-fec254a6.js"),["assets/Contacts-fec254a6.js","assets/vendor-f9bdd444.js","assets/contact-66227352.js","assets/Contacts-3b0b128b.css"]),meta:{requiresAuth:!0,memberAccess:!0}}]},{path:"/",component:vx,children:[{path:"profile",name:"settings-profile-view",component:()=>gt(()=>import("./ProfileSettings-495524f8.js"),["assets/ProfileSettings-495524f8.js","assets/vendor-f9bdd444.js","assets/AgentCustomAvailabilityModal-a0542ce8.js","assets/AgentCustomAvailabilityModal-bd1679ce.css","assets/ProfileSettings-8ca6d1b7.css"]),meta:{requiresAuth:!0,memberAccess:!0}},{path:"agents",name:"settings-agents-view",component:()=>gt(()=>import("./AgentsSettings-a609e5b8.js"),["assets/AgentsSettings-a609e5b8.js","assets/vendor-f9bdd444.js","assets/AgentCustomAvailabilityModal-a0542ce8.js","assets/AgentCustomAvailabilityModal-bd1679ce.css","assets/AgentsSettings-bbf93b70.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"billing",name:"settings-billing-view",component:()=>gt(()=>import("./BillingSettings-184f1690.js"),["assets/BillingSettings-184f1690.js","assets/vendor-f9bdd444.js"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"plans",name:"settings-plans-view",component:()=>gt(()=>import("./PlansSettings-f6cf3f64.js"),["assets/PlansSettings-f6cf3f64.js","assets/vendor-f9bdd444.js","assets/DateFilterDropdown-3f7a8097.js","assets/DateFilterDropdown-7aa5fb17.css","assets/RefundTag-b29aa092.js","assets/PlansSettings-389cde6f.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"design",name:"settings-design-view",component:qW,meta:{requiresAuth:!0,memberAccess:!1}},{path:"installation",name:"settings-code-view",component:()=>gt(()=>import("./InstallationCode-76b5d24a.js"),["assets/InstallationCode-76b5d24a.js","assets/vendor-f9bdd444.js","assets/InstallationCode-33c04bb5.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"notifications",name:"settings-notification-view",component:()=>gt(()=>import("./NotificationSettings-9e07628a.js"),["assets/NotificationSettings-9e07628a.js","assets/vendor-f9bdd444.js","assets/NotificationSettings-49faa7ff.css"]),meta:{requiresAuth:!0,memberAccess:!0}},{path:"integrations",name:"settings-integration-view",component:()=>gt(()=>import("./IntegrationSettings-bd49289c.js"),["assets/IntegrationSettings-bd49289c.js","assets/playstore-7f688061.js","assets/colored-messenger-ad4d4c68.js","assets/arrow-right-white-74c62b1a.js","assets/vendor-f9bdd444.js","assets/useIntegration-15f7256e.js","assets/IntegrationSettings-23367c31.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"mobile-apps",name:"settings-mobile-apps-view",component:()=>gt(()=>import("./MobileApps-bf1abc3e.js"),["assets/MobileApps-bf1abc3e.js","assets/playstore-7f688061.js","assets/vendor-f9bdd444.js","assets/useIntegration-15f7256e.js","assets/MobileApps-5af55c76.css"]),meta:{requiresAuth:!0,memberAccess:!0}},{path:"integrations/:id",name:"single-integration-view",component:()=>gt(()=>import("./SingleIntegrationView-4f5ba96f.js"),["assets/SingleIntegrationView-4f5ba96f.js","assets/colored-messenger-ad4d4c68.js","assets/vendor-f9bdd444.js","assets/RemoveFacebookPageModal-e5649bb3.js","assets/useIntegration-15f7256e.js","assets/RemoveFacebookPageModal-13e7c500.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"integrations/facebook",name:"facebook-integration-view",component:()=>gt(()=>import("./FacebookIntegrationView-a694e388.js"),["assets/FacebookIntegrationView-a694e388.js","assets/colored-messenger-ad4d4c68.js","assets/vendor-f9bdd444.js","assets/RemoveFacebookPageModal-e5649bb3.js","assets/useIntegration-15f7256e.js","assets/RemoveFacebookPageModal-13e7c500.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"integrations/email",name:"email-integration-view",component:()=>gt(()=>import("./EmailIntegrationView-2c1455c5.js"),["assets/EmailIntegrationView-2c1455c5.js","assets/vendor-f9bdd444.js","assets/useIntegration-15f7256e.js","assets/EmailIntegrationView-47eee9b2.css"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"square",name:"squareup-integration-view",component:()=>gt(()=>import("./SquareupIntegrationView-11d1022b.js"),["assets/SquareupIntegrationView-11d1022b.js","assets/vendor-f9bdd444.js"]),meta:{requiresAuth:!0,memberAccess:!1}},{path:"keyboard-shortcuts",name:"keyboard-shortcuts-view",component:()=>gt(()=>import("./KeyboardShortcut-121f9b8f.js"),["assets/KeyboardShortcut-121f9b8f.js","assets/vendor-f9bdd444.js","assets/KeyboardShortcut-52899429.css"]),meta:{requiresAuth:!0,memberAccess:!0}}]}]});li.beforeEach(async(o,s,t)=>{var S,E,x;const{getCurrentUser:n,resetStore:l}=Zt(),i=Ae();let m=i.user,r=Ks()&&!ua()?Mt.get(kt()):sessionStorage.getItem(kt());((S=i.user)==null?void 0:S.attributes.status)==="deactivated"&&(new Aa().logout(),l(),i.isDeactivated=!1),(m&&m.attributes.registration_step!=="ONBOARDED"&&o.query.marketplace||o.path==="/fullscreen")&&(o.path==="/fullscreen"&&(i.isLoadingFullscreen=!0),await n(),m=i.user),o.name==="conversations-view"&&!Mt.get("dontShowChAppDownloadPromptAgain")&&window.matchMedia("(max-width: 480px)").matches&&(i.showDownloadAppPrompt=!0);const u=m||!1,{isOwnerOrAdmin:g,isAgent:y,isOwner:c}=Xt(),w=(E=m==null?void 0:m.attributes)==null?void 0:E.registration_step,f=g||o.matched.some(P=>P.meta.memberAccess),v=o.matched.some(P=>P.meta.requiresAuth),C=o.matched.some(P=>P.meta.onboardingPath),{path:_,completed:A}=ou(w,c,y),D=sessionStorage.getItem("redirectPath"),T=o.query.marketplace==="1"&&o.query.endpoint,B=i.hasMarketplaceOnboarded&&i.hasMarketplaceOnboarded.has_onboarded===!1;if(T){const P=`${(x=o.query.endpoint)==null?void 0:x.slice(5)}&identifier=${o.query.identifier}&shop=${o.query.shop}&signature=${o.query.signature}`;try{i.isLoadingFullscreen=!0;const{data:j}=await new ns().getShopToken(P);r=j.attributes.access_token,sessionStorage.setItem(kt(),r),$e.disconnect(),$e.io.opts.extraHeaders={Authorization:`Bearer ${r}`},$e.connect(),u&&(i.isLoadingFullscreen=!1)}catch(j){i.isLoadingFullscreen=!1,Ze(j)}}v?!r&&!u?(Mt.remove(kt(),{domain:".chatway.app",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"localhost",sameSite:"none",secure:!0}),Mt.remove(kt(),{domain:"127.0.0.1",sameSite:"none",secure:!0}),localStorage.clear(),sessionStorage.setItem("redirectPath",o.path),t({path:"/login"})):r&&!u?(await n(),t()):f?B&&o.path!=="/onboarding/info"?t({name:"onboarding-info"}):!A&&o.fullPath!==_&&!B?t({path:_||"/"}):A&&!(m!=null&&m.attributes.is_plan_selected)&&!(m!=null&&m.attributes.pro_year_trial)&&o.fullPath!=="/onboarding/plans"&&!B?t({path:"/onboarding/plans"}):A&&C&&!B?t({path:"/"}):D?(t({path:D}),sessionStorage.removeItem("redirectPath")):t():t({name:"not-found"}):t()});li.onError((o,s)=>{["Failed to fetch dynamically imported module","Unable to preload CSS","failed fo load module script"].some(n=>o.message.includes(n))&&(window.location.href=s.fullPath)});const HW="/assets/close-blue-862408d2.svg",zW={class:"w-full"},KW={key:0,class:"flex items-center justify-between"},YW={class:"flex items-center gap-1"},ZW=["for"],JW={class:"p-3 w-96"},QW={class:"w-[20.875rem]"},XW={class:"inline-block w-full"},eq=["disabled","aria-expanded"],tq=["textContent"],sq=["id","value"],aq={class:"absolute inset-y-0 right-0 flex items-center pr-4"},oq={class:"relative"},nq=["id","onMouseenter","aria-selected"],iq=["textContent"],lq={class:"absolute inset-y-0 right-0 flex items-center pr-4"},rq={class:"text-danger text-xs font-normal"},dq=["innerHTML"],uq=fe({__name:"SelectField",props:{options:{},name:{},modelValue:{},placeholder:{default:"Select an option"},emptyOptionsMessage:{default:"No items found."},label:{},tooltip:{},hasError:{type:Boolean},validationMessage:{},disabled:{type:Boolean,default:!1},server:{type:Boolean,default:!1},isLoading:{type:Boolean},optionLabel:{default:"label"},optionValue:{default:"value"},showUnselect:{type:Boolean,default:!0},showOnTop:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},message:{},isAlertMessage:{type:Boolean}},emits:["update:modelValue","on-search","on-scroll"],setup(o,{emit:s}){const t=Ae(),n=s,l=o,i=$(-1),m=$(!1),r=$(l.modelValue),u=$(""),g=$(null),y=$(null),c=b(()=>Array.isArray(l.options)?l.options:Object.keys(l.options)),w=b(()=>c.value.filter(M=>{let V=v(M);return V&&V.toString().toLowerCase().includes(u.value.toLowerCase())})),f=b(()=>{if(l.multiple)return c.value.filter(Z=>_(Z)).map(Z=>v(Z)).join(", ");let M=c.value.find(V=>_(V));return M?v(M):""}),v=M=>{let V;return Array.isArray(l.options)?typeof M=="string"||typeof M=="number"?V=M:V=M[l.optionLabel]:V=l.options[M],V},C=M=>{let V;return typeof M=="string"||typeof M=="number"?V=M:V=M[l.optionValue],V},_=M=>{let V=M;return typeof M=="object"&&(V=M[l.optionValue]),l.multiple&&Array.isArray(r.value)?r.value.includes(V):r.value==V},A=()=>{m.value=!1,i.value=-1,u.value=""},D=()=>{if(i.value===-1){i.value=w.value.length-1;return}if(i.value+1>=w.value.length){i.value=0;return}i.value++,Ft(()=>{P()})},T=()=>{if(i.value===-1){i.value=0;return}if(i.value<=0){i.value=w.value.length-1;return}i.value--,Ft(()=>{P()})},B=()=>{if(!m.value){x();return}if(i.value!=-1){const M=w.value[i.value];l.multiple&&!_(M)?r.value.push(C(M)):l.multiple&&_(M)?S(M):r.value=C(M)}n("update:modelValue",r.value),A()},S=M=>{r.value.splice(r.value.indexOf(C(M)),1)},E=()=>{l.multiple&&!Array.isArray(l.modelValue)?r.value=[]:r.value="",i.value=-1,n("update:modelValue",r.value)},x=()=>{if(m.value)return A();i.value=c.value.findIndex(M=>C(M)==r.value),i.value<0&&(i.value=0),m.value=!0,Ft(()=>{document.getElementById(l.name).focus(),P()})},P=()=>{const M=document.getElementById("listbox");if(M&&i.value){const V=M.children[i.value],Z=M.getBoundingClientRect(),ae=V.getBoundingClientRect(),ce=ae.top-Z.top-Z.height/2+ae.height/2;M.scrollTop+=ce}},j=M=>{const V=M.target;u.value=V.value,l.server&&k()},H=()=>{l.multiple&&!Array.isArray(l.modelValue)?r.value=[]:r.value=l.modelValue};We(()=>l.modelValue,()=>{H()});const k=Ys(()=>{n("on-search",u.value)},500);return Xe(()=>{H(),l.server&&ul(y.value,()=>{n("on-scroll")},{distance:10})}),Os(g,()=>A()),(M,V)=>{const Z=Pe("Loader");return a(),d("div",zW,[e("div",{ref_key:"listbox",ref:g,onKeydown:V[9]||(V[9]=Ut(ae=>A(),["escape"]))},[M.label?(a(),d("div",KW,[e("div",YW,[e("label",{for:M.name+"Label",class:"text-grey600 text-sm font-normal mb-1"},I(M.label),9,ZW),M.tooltip?(a(),ne(yt,{key:0},{content:K(()=>[e("div",JW,[e("span",null,I(M.tooltip),1)])]),default:K(()=>[V[10]||(V[10]=e("img",{src:as,alt:""},null,-1))]),_:1})):h("",!0)]),p(t).isProUserOrTrial?h("",!0):(a(),ne(yt,{key:0,placement:"left",triggers:["click"],theme:"chatway-upgradenow"},{content:K(()=>[e("div",QW,[W(Ea)])]),default:K(()=>[V[11]||(V[11]=e("img",{src:Da,alt:""},null,-1))]),_:1}))])):h("",!0),e("span",XW,[e("button",{ref:"button",disabled:M.disabled,onClick:V[3]||(V[3]=ae=>x()),"aria-expanded":m.value,"aria-haspopup":"listbox",class:O(["relative z-0 w-full py-3 pl-4 pr-10 h-auto text-left transition duration-150 ease-in-out bg-white border rounded-lg cursor-default disabled:!bg-transparent disabled:opacity-50 focus:outline-none focus:shadow-outline-blue focus:border-blue-300",M.hasError?"border-[#ff0000]":"border-grey200"])},[F(e("span",{textContent:I(f.value?f.value:M.placeholder),class:O(["block text-base leading-5 max-w-[290px] truncate",f.value?"text-grey900":"text-grey200"])},null,10,tq),[[Gt,!m.value]]),F(e("input",{id:M.name,value:u.value,onKeyup:Qe(j,["prevent"]),onKeydown:[V[0]||(V[0]=Ut(Qe(ae=>B(),["stop","prevent"]),["enter"])),V[1]||(V[1]=Ut(Qe(ae=>T(),["prevent"]),["arrow-up"])),V[2]||(V[2]=Ut(Qe(ae=>D(),["prevent"]),["arrow-down"]))],type:"search",class:"w-full h-full form-control focus:outline-none",placeholder:"Search"},null,40,sq),[[Gt,m.value]]),e("span",aq,[M.showUnselect&&!m.value&&f.value?(a(),d("button",{key:0,onClick:E,class:"p-1 h-auto"},V[12]||(V[12]=[e("img",{class:"w-3.5 h-3.5",src:HW,alt:""},null,-1)]))):h("",!0),e("button",{class:O(["p-0 h-auto",{"transition rotate-180":m.value}])},V[13]||(V[13]=[e("img",{class:"w-5 h-5",src:Tt,alt:""},null,-1)]),2)])],10,eq)]),e("div",oq,[F(e("div",{"leave-active-class":"transition ease-in duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0",class:O(["absolute z-10 w-full mt-1 bg-white rounded-md overflow-hidden shadow-[4px_0px_16px_0px_rgba(43,_43,_62,_0.16)]",M.showOnTop?"bottom-12 mb-1":"top-0 mt-1"])},[e("ul",{id:"listbox",onKeydown:[V[6]||(V[6]=Ut(Qe(ae=>B(),["stop","prevent"]),["enter"])),V[7]||(V[7]=Ut(Qe(ae=>T(),["prevent"]),["arrow-up"])),V[8]||(V[8]=Ut(Qe(ae=>D(),["prevent"]),["arrow-down"]))],role:"listbox",tabindex:"-1",class:"py-1 overflow-auto text-base rounded-md shadow-xs max-h-60 focus:outline-none",ref_key:"scrollEl",ref:y},[(a(!0),d(Se,null,Ne(w.value,(ae,ce)=>(a(),d("li",{key:ae.toString(),id:M.name+"Option"+i.value,onClick:V[4]||(V[4]=J=>B()),onMouseenter:J=>i.value=ce,onMouseleave:V[5]||(V[5]=J=>i.value=-1),role:"option","aria-selected":i.value===ce,class:O([{"bg-grey100":ce===i.value},"relative py-2 pl-4 pr-9 m-0 cursor-default select-none"])},[e("span",{textContent:I(v(ae)),class:O([{"text-primary":_(ae)},"block text-sm font-normal text-grey900 truncate"])},null,10,iq),F(e("span",lq,V[14]||(V[14]=[e("img",{src:Wt,alt:""},null,-1)]),512),[[Gt,_(ae)]])],42,nq))),128)),M.isLoading?(a(),ne(Z,{key:0,size:"20px"})):h("",!0),F(e("div",{class:"px-3 py-2 text-grey900 text-sm font-normal cursor-default select-none"},I(u.value?"No results match your search.":M.emptyOptionsMessage),513),[[Gt,!M.isLoading&&!w.value.length]])],544)],2),[[Gt,m.value&&!M.disabled]])]),(a(!0),d(Se,null,Ne(M.validationMessage,(ae,ce)=>(a(),d("div",{key:ce},[e("span",rq,I(ae.$message),1)]))),128)),M.message?(a(),d("div",{key:1,class:O(["mt-1 text-sm",M.isAlertMessage?"text-danger":"text-grey600"]),innerHTML:M.message},null,10,dq)):h("",!0)],544)])}}}),cq=["src","alt"],mq=fe({__name:"Thumbnail",props:{userName:{default:""},size:{default:"30px"},src:{default:""},fontSize:{default:"12px"},showStatus:{type:Boolean,default:!1},availabilityStatus:{type:Boolean,default:!1},enableBorder:{type:Boolean,default:!1},enableBorderForStatus:{type:Boolean,default:!1},color:{default:"#8286DB"}},emits:["onImageLoad"],setup(o,{emit:s}){const t=o,n=s,l=()=>{n("onImageLoad")},i=b(()=>Wa(t.userName)),m=b(()=>{const{enableBorder:r}=t,u=`width: ${t.size}; height: ${t.size};`,g=t.color||"#8286DB";return r&&!t.src?`background: linear-gradient(${g}, ${g}) padding-box, linear-gradient(180deg, #f69d01, #f65901) border-box; ${u}`:r&&t.src?`background: linear-gradient(180deg, #f69d01, #f65901) border-box; ${u}`:`background-color: ${g}; ${u}`});return(r,u)=>(a(),d("div",{class:"thumbnail-wrap",key:r.userName,style:lt({width:r.size,height:r.size})},[r.src?(a(),d("img",{key:0,class:O(["thumbnail-img",{border:r.enableBorder}]),src:r.src,alt:r.userName,style:lt(m.value),onLoad:l},null,46,cq)):(a(),d("div",{key:1,class:O(["thumbnail",{border:r.enableBorder}]),style:lt(m.value)},[e("span",{style:lt({fontSize:r.fontSize})},I(i.value),5)],6)),r.showStatus?(a(),d("span",{key:2,class:O(["status",{offline:!r.availabilityStatus,border:r.enableBorderForStatus,"small-size":!r.enableBorderForStatus}])},null,2)):h("",!0)],4))}});const gq=Oe(mq,[["__scopeId","data-v-5ab0bf55"]]),pq=fe({__name:"ThumbnailGroup",props:{usersList:{type:Array,default:()=>[]},totalCount:{type:Number,default:0},size:{type:String,default:"30px"},showMore:{type:Number,default:0},fontSize:{type:String,default:"12px"},availabilityStatus:{type:Boolean,default:!1},showStatus:{type:Boolean,default:!1},showShadow:{type:Boolean,default:!1},src:{type:String,default:""},plusMoreThumbnailsCount:{type:Number,default:1},enableBorderForStatus:{type:Boolean,default:!1},fit:{type:String,default:"normal",validator(o){return["normal","","tight"].includes(o)}}},setup(o){return(s,t)=>{const n=Pe("thumbnail"),l=He("tooltip");return a(),d("div",{class:O(["thumbnails",{"background-shadow":o.showShadow}])},[(a(!0),d(Se,null,Ne(o.usersList,i=>F((a(),ne(n,{key:i.id,"user-name":i.name,size:o.size,src:i.src,"font-size":o.fontSize,"availability-status":i.online_status==="online",enableBorderForStatus:o.enableBorderForStatus,"show-status":o.showStatus,class:O(`thumbnail fit-${o.fit} ${o.showShadow?"background-shadow":""}`)},null,8,["user-name","size","src","font-size","availability-status","enableBorderForStatus","show-status","class"])),[[l,i.name,void 0,{bottom:!0}]])),128)),o.showMore&&o.totalCount>o.showMore?(a(),d("span",{key:0,class:"thumbnail-text",style:lt({height:o.size,width:o.size,fontSize:o.fontSize})},I(o.plusMoreThumbnailsCount),5)):h("",!0)],2)}}});const vq=Oe(pq,[["__scopeId","data-v-b9e19e76"]]);function fq(){const o="https://prod-api.chatway.app/api/",s=window["app-bridge"],t=window.shopifyBridgeApp;if(!t||!s)return;function n(){const l=window["app-bridge"].utilities;return l.isShopifyEmbedded()?"iframe":l.isShopifyMobile()?"mobile_app":"web"}t.hooks.set(s.LifecycleHook.DispatchAction,l=>i=>{const{group:m,clientInterface:r}=i;m==="WebVitals"&&ke.post(`${o}web-vitals`,{metric_name:i.payload.metricName,value:String(i.payload.value),location:window.location.pathname,client_interface:r,environment:n()}),l(i)})}const Jt=qd(E0),Tr=Hd();Tr.use(zd);const hq=Kd();Jt.use(Tr);Jt.use(li);Jt.use(hq);Jt.use(po);Jt.use(Yd);Jt.use(Zd,{cache:{persistent:!1}});Jt.use(Jd,{themes:{"chatway-upgradenow":{triggers:["click","hover"],autoHide:!0,distance:14}}});Jt.use(Qd);Jt.use(Xd);Jt.use(eu,{name:"MarqueeComponent"});Jt.component("Loader",fs);Jt.component("InputField",Ha);Jt.component("TextareaField",Bn);Jt.component("SelectField",uq);Jt.component("Thumbnail",gq);Jt.component("ThumbnailGroup",vq);Jt.component("Modal",Co);Jt.component("ToggleSwitch",Sa);tu({app:Jt,dsn:"https://3bc3671e394dbbd01578c6505a3809ef@o4505458601361408.ingest.sentry.io/4506139954839552",integrations:[su({maskAllText:!1,blockAllMedia:!1}),au()],environment:"production",enabled:!0,tracePropagationTargets:["localhost","https://dev-chat.chatway.app/","https://chat.chatway.app/"],tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,ignoreErrors:["Not found.","NotAllowedError: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD","Blocked.","Messaging: This browser doesn't support the API's required to use the Firebase SDK. (messaging/unsupported-browser).","The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.","Cannot read properties of undefined (reading 'parentNode')","NS_ERROR_NOT_AVAILABLE","NS_ERROR_FAILURE","NS_ERROR_ABORT","NS_ERROR_UNEXPECTED","Failed to fetch dynamically imported module","Unable to preload CSS","failed fo load module script"]});fq();Jt.mount("#app");export{ew as $,Aa as A,vV as B,C7 as C,L7 as D,dB as E,GO as F,an as G,EU as H,In as I,qn as J,Tt as K,fs as L,Co as M,Xa as N,Vo as O,Pl as P,Uw as Q,I2 as R,Pn as S,Ob as T,ns as U,ts as V,RR as W,Me as X,ht as Y,ex as Z,Oe as _,Zt as a,N7 as a$,rw as a0,Vb as a1,A2 as a2,Za as a3,ct as a4,ss as a5,hs as a6,Rl as a7,ke as a8,wq as a9,kr as aA,Bl as aB,oR as aC,iU as aD,Rs as aE,ma as aF,_s as aG,ws as aH,mo as aI,Fn as aJ,hD as aK,nt as aL,o_ as aM,xo as aN,TG as aO,R2 as aP,ko as aQ,dh as aR,kl as aS,HW as aT,So as aU,kj as aV,Yn as aW,_o as aX,Fl as aY,zs as aZ,Gl as a_,Zl as aa,To as ab,Wt as ac,bq as ad,jt as ae,Fa as af,Xt as ag,SC as ah,Go as ai,Ll as aj,gu as ak,yt as al,as as am,xq as an,iL as ao,la as ap,Ka as aq,Yu as ar,er as as,ys as at,cr as au,fo as av,ga as aw,Ho as ax,ra as ay,K5 as az,Bs as b,ev as b0,tv as b1,Dy as b2,nv as b3,sv as b4,av as b5,Zs as b6,EG as b7,$o as b8,kt as c,$e as d,bo as e,De as f,ze as g,Ks as h,zl as i,Yl as j,ua as k,nu as l,AP as m,yo as n,B7 as o,W7 as p,wo as q,u4 as r,Ze as s,uB as t,Ae as u,As as v,Es as w,ii as x,NW as y,XR as z};
