@zappway/embeds 1.0.32 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3205,7 +3205,7 @@ See: https://github.com/francoischalifour/medium-zoom`)}},DGe=function(a){var t=
3205
3205
  rgba(0, 154, 126, 0.3) 50%,
3206
3206
  rgba(0, 0, 0, 0.1) 100%)`,boxShadow:"6px 6px 12px rgba(0, 0, 0, 0.7), -4px -1px 12px rgba(255, 255, 255, 0.3)",border:"1px solid rgba(255, 255, 255, 0.18)",backdropFilter:"blur(10px)"},children:[Q&&(0,Ze.jsx)(De,{sx:{position:"absolute",pointerEvents:"none",top:0,left:0,width:"100%",height:"100%",zIndex:2,justifyContent:"center",alignItems:"center",p:2},className:"bg-[radial-gradient(circle_at_center,_var(--tw-gradient-stops))] from-violet-500/80",children:(0,Ze.jsx)(Ji,{color:"primary",children:(0,Ze.jsxs)(De,{sx:{justifyContent:"center",alignItems:"center"},gap:1,children:[(0,Ze.jsx)(oI,{sx:{opacity:.5,fontSize:32}}),(0,Ze.jsx)(va,{component:"label",level:"body-sm",color:"neutral",children:z("drop_files_here")})]})})}),typeof N=="boolean"&&!N&&e?.length>0&&(0,Ze.jsx)(xi,{color:"danger",sx:{left:"50%",transform:"translateX(-50%)",top:10,position:"absolute",zIndex:1},variant:"soft",size:"sm",startDecorator:(0,Ze.jsx)(f3,{}),children:z("off")}),(0,Ze.jsx)(De,{ref:$,direction:"column",sx:{boxSizing:"border-box",maxWidth:"100%",width:"100%",mx:"auto",flex:1,maxHeight:"100%",overflowY:"auto",pb:4,pt:2,mb:-2,scrollbarColor:"rgba(0, 0, 0, 0.1) transparent","&::-webkit-scrollbar":{width:"0.3rem"},"&::-webkit-scrollbar-track":{display:"none"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(150, 150, 150, 0.5)",borderRadius:"12px"}},children:(0,Ze.jsx)(xle.default,{isReverse:!0,useWindow:!1,getScrollParent:()=>$.current,loadMore:f||(()=>{}),hasMore:p,loader:Array(1).fill(0).map((he,Fe)=>(0,Ze.jsxs)(De,{direction:"row",gap:2,mb:2,children:[(0,Ze.jsx)(Si,{variant:"circular",width:34,height:34}),(0,Ze.jsxs)(De,{gap:1,sx:{width:"100%"},children:[(0,Ze.jsx)(Si,{variant:"text",width:"97%"}),(0,Ze.jsx)(Si,{variant:"text",width:"92%"}),(0,Ze.jsx)(Si,{variant:"text",width:"95%"})]})]},Fe)),children:(0,Ze.jsxs)(De,{gap:2,children:[(0,Ze.jsx)(qz,{messages:ne.firstMsgs,shouldAnimate:e.length<2}),d&&e?.length<=0&&(0,Ze.jsx)(De,{gap:2,children:Array(1).fill(0).map((he,Fe)=>(0,Ze.jsxs)(De,{direction:"row",gap:2,children:[(0,Ze.jsx)(Si,{variant:"circular",width:34,height:34}),(0,Ze.jsxs)(De,{gap:1,sx:{width:"100%"},children:[(0,Ze.jsx)(Si,{variant:"text",width:"97%"}),(0,Ze.jsx)(Si,{variant:"text",width:"92%"}),(0,Ze.jsx)(Si,{variant:"text",width:"95%"})]})]},Fe))}),e?.length<=0&&!d&&g,(!d||e?.length>0)&&e.map((he,Fe)=>(0,Ze.jsx)("div",{children:he.metadata?.shouldDisplayForm?(0,Ze.jsx)(De,{sx:{zIndex:0,px:5},children:(0,Ze.jsx)(tle,{formId:he.metadata.formId,conversationId:he.conversationId,messageId:he.id,submissionId:he?.submission?.id,values:he?.submission?.data,readOnly:G})}):he.metadata?.whatsapp?.message?.audioMessage||he.metadata?.whatsapp?.mediaData?.audio?(0,Ze.jsx)(Ple,{message:he}):(0,Ze.jsx)(s_,{index:Fe,message:{...he,iconUrl:he.from==="agent"?u:I||he.iconUrl},withSources:T,hideInternalSources:v,handleEvalAnswer:k,handleImprove:b,handleSourceClick:_,organizationId:P})},Fe)),!L&&!ne.isLoading&&e[e.length-1]?.from==="agent"&&X,ne.files?.length>0&&ne.isLoading&&!ne.showAgentTyping&&(0,Ze.jsx)(lC,{}),ne.showAgentTyping&&e?.[e.length-1]?.from==="human"&&(0,Ze.jsx)(s_,{cardProps:{variant:"plain",sx:{background:"none",p:0}},message:{from:"agent",message:"",component:(0,Ze.jsx)(Mz,{}),approvals:[]}})]})})}),r,n&&!ne.isLastMsgInView&&(0,Ze.jsx)(it,{variant:"soft",color:"neutral",size:"sm",className:"absolute rounded-full right-1 bottom-2 z-99",onClick:()=>$.current?.scrollTo({behavior:"smooth",top:$.current?.scrollHeight+110}),children:(0,Ze.jsx)(hR,{})}),!n&&(0,Ze.jsxs)("form",{style:{maxWidth:"100%",width:"100%",position:"relative",display:"flex",flexDirection:"column",marginTop:"auto",overflow:"visible",background:"none",justifyContent:"center",marginLeft:"auto",marginRight:"auto"},onCompositionStart:fe,onCompositionEnd:fe,onSubmit:he=>{he.stopPropagation(),se.handleSubmit(ye)(he)},children:[(0,Ze.jsxs)(De,{gap:1,children:[N&&j&&j?.length>0&&(0,Ze.jsx)(Tf,{size:"sm",slotProps:{listbox:{sx:{zIndex:9999999999+1}}},sx:{mr:"auto",mb:.5},startDecorator:(0,Ze.jsx)(p3,{}),placeholder:z("use_uploaded_file"),multiple:!0,color:ne.attachmentsForAI?.length>0?"warning":"neutral",variant:ne.attachmentsForAI?.length>0?"soft":"plain",onChange:(he,Fe)=>{ie({attachmentsForAI:Fe})},children:j.map(he=>(0,Ze.jsx)(Af,{value:he.id,children:he.name},he.id))}),(t?.length||0)>0&&ne.files?.length<=0&&(0,Ze.jsx)(De,{direction:"row",gap:1,sx:{flexWrap:"nowrap",mb:1,overflowX:"auto",maxWidth:"100%",scrollbarColor:"rgba(0,0,0,.1) transparent","&::-webkit-scrollbar":{height:"0.4em"},"&::-webkit-scrollbar-track":{display:"none"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(0,0,0,.0)",borderRadius:"20px"}},children:t?.map((he,Fe)=>(0,Ze.jsx)(Mt,{size:"sm",variant:"soft",onClick:()=>ye({query:he}),sx:{whiteSpace:"nowrap"},children:he},Fe))})]}),(0,Ze.jsxs)(De,{width:"100%",gap:.5,children:[m,ne.files?.length>0&&(0,Ze.jsx)(De,{gap:1,sx:{mb:1},children:(0,Ze.jsx)(De,{direction:"row",sx:{flexWrap:"wrap"},gap:1,children:ne.files.map((he,Fe)=>(0,Ze.jsx)(xi,{size:"lg",variant:"soft",color:"primary",endDecorator:(0,Ze.jsx)(zy,{disabled:ne.isLoading,onDelete:()=>ie({files:ne.files.filter((Qe,la)=>la!==Fe)})}),children:he.name},he.name))})}),(0,Ze.jsxs)(De,{sx:{position:"relative"},children:[!ne.isLastMsgInView&&(0,Ze.jsx)(it,{variant:"soft",color:"neutral",size:"sm",sx:{position:"absolute",right:0,borderRadius:"50%",maxWidth:"12px",maxHeight:"12px",top:"-36px",zIndex:99},onClick:()=>$.current?.scrollTo({behavior:"smooth",top:$.current?.scrollHeight+110}),children:(0,Ze.jsx)(hR,{})}),(0,Ze.jsx)(wf,{variant:"outlined",autoFocus:!!M,slotProps:{textarea:{id:"chatbox-input",ref:W,sx:{my:"auto"}}},maxRows:24,minRows:ne.isTextAreaExpanded?18:1,onKeyDown:he=>{he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),se.handleSubmit(ye)(he))},sx:he=>({...ne.isTextAreaExpanded?{position:"absolute",bottom:0,zIndex:1}:{},width:"100%",flexDirection:"row",alignItems:"center",".MuiTextarea-endDecorator":{marginBlock:0,marginTop:"auto"},".MuiTextarea-startDecorator":{marginBlockEnd:0,marginTop:"auto"}}),startDecorator:(0,Ze.jsx)(De,{direction:"row",justifyContent:"space-between",sx:{width:"100%"},children:(0,Ze.jsx)(it,{variant:"plain",sx:{maxHeight:"100%"},size:"sm",onClick:()=>ie({isTextAreaExpanded:!ne.isTextAreaExpanded}),children:ne.isTextAreaExpanded?(0,Ze.jsx)(y3,{}):(0,Ze.jsx)(_3,{})})}),endDecorator:(0,Ze.jsxs)(De,{direction:"row",justifyContent:"space-between",sx:{width:"100%"},spacing:1,children:[D&&Ro.default.cloneElement(D,{onReply:ve,inputRef:W}),x&&(0,Ze.jsx)(LB,{changeCallback:he=>ie({files:he}),accept:ZI}),(0,Ze.jsxs)(De,{direction:"row",sx:{ml:"auto"},children:[!ne.isLoading&&(0,Ze.jsx)(it,{size:"sm",type:"submit",disabled:ne.isLoading||!se.formState.isValid,sx:{maxHeight:"100%"},color:"primary",variant:"soft",children:(0,Ze.jsx)(iI,{})}),ne.isLoading&&h&&(0,Ze.jsx)(it,{size:"sm",color:"danger",sx:{maxHeight:"100%"},variant:"soft",onClick:()=>{h?.()},children:(0,Ze.jsx)(b3,{})})]})]}),...se.register("query"),onBlur:he=>{}})]}),(0,Ze.jsxs)(De,{children:[(0,Ze.jsx)(De,{direction:"row",sx:{position:"relative",alignItems:"center",justifyContent:"space-between",width:"100%",maxWidth:"100%",overflowX:"auto","&::-webkit-scrollbar":{height:"0"}},children:y}),!s&&(0,Ze.jsx)(De,{sx:{mt:1},children:(0,Ze.jsx)(aC,{})})]})]})]})]})}var Sle=Lqe;var Pb=R(ae());function Fqe({agentId:e,layout:a,interfaceConfig:t,layoutClassName:o,containerSxProps:i,chatBoxProps:n,isLoadingAgent:r,agentIconUrl:s}){let{mode:u}=IM(),d=a||uC.default.Fragment,p=t?.primaryColor||"#ffffff",m=(0,uC.useMemo)(()=>t4(p,"#ffffff","#000000"),[p]);return r?(0,Pb.jsx)(et,{sx:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"transparent",...i||{}},children:(0,Pb.jsx)(Yi,{size:"sm",variant:"soft",color:"neutral"})}):(0,Pb.jsx)(d,{...a?{className:Kr(u,o),agentId:e,config:t,agentIconUrl:s}:{},children:(0,Pb.jsx)(et,{className:Kr({[`${u} ${o}`]:!a}),sx:g=>({display:"flex",flex:1,flexDirection:"column",position:"relative",width:"100%",height:"100%",overflow:"hidden",maxHeight:"100%",boxSizing:"border-box",backgroundColor:t?.isBgTransparent?"transparent":g.palette.background.default??"#ffffff","& .message-agent":{},"& .message-human":{backgroundColor:p},"& .message-human *":{color:m},...i||{}}),children:(0,Pb.jsx)(Sle,{...n,...s?{agentIconUrl:s}:{}})})})}var dC=Fqe;l();var OB="https://app.zappway.ai";function Gqe({id:e}){let a=gl(e?`${OB}/api/agents/${e}`:null,mp),t=ob(e?`${OB}/api/agents/${e}`:`${OB}/api/agents`,tb(e?"PATCH":"POST"),{onSuccess(o,i,n){a.mutate()}});return{query:a,mutation:t}}var pC=Gqe;l();var Qle=R(Nle()),Bi=R(K());l();var ju=R(K(),1);var Ole=R(HW(),1);var Uqe=()=>{},Vqe=Uqe(),YB=Object,Ble=e=>e===Vqe,Hqe=e=>typeof e=="function",gC=new WeakMap,HB=(e,a)=>YB.prototype.toString.call(e)===`[object ${a}]`,Kqe=0,QB=e=>{let a=typeof e,t=HB(e,"Date"),o=HB(e,"RegExp"),i=HB(e,"Object"),n,r;if(YB(e)===e&&!t&&!o){if(n=gC.get(e),n)return n;if(n=++Kqe+"~",gC.set(e,n),Array.isArray(e)){for(n="@",r=0;r<e.length;r++)n+=QB(e[r])+",";gC.set(e,n)}if(i){n="#";let s=YB.keys(e).sort();for(;!Ble(r=s.pop());)Ble(e[r])||(n+=r+":"+QB(e[r])+",");gC.set(e,n)}}else n=t?e.toJSON():a=="symbol"?e.toString():a=="string"?JSON.stringify(e):""+e;return n},Yqe=e=>{if(Hqe(e))try{e=e()}catch{e=""}let a=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?QB(e):"",[e,a]},Qqe=e=>Yqe(e?e(0,null):null)[0];var KB=Promise.resolve(),$qe=e=>(a,t,o)=>{let i=(0,ju.useRef)(!1),{cache:n,initialSize:r=1,revalidateAll:s=!1,persistSize:u=!1,revalidateFirstPage:d=!0,revalidateOnMount:p=!1,parallel:m=!1}=o,[,,,g]=En.get(ab),f;try{f=Qqe(a),f&&(f=y_+f)}catch{}let[k,b,_]=ts(n,f),h=(0,ju.useCallback)(()=>ya(k()._l)?r:k()._l,[n,f,r]);(0,Ole.useSyncExternalStore)((0,ju.useCallback)(x=>f?_(f,()=>{x()}):()=>{},[n,f]),h,h);let v=(0,ju.useCallback)(()=>{let x=k()._l;return ya(x)?r:x},[f,r]),y=(0,ju.useRef)(v());os(()=>{if(!i.current){i.current=!0;return}f&&b({_l:u?y.current:v()})},[f,n]);let I=p&&!i.current,P=e(f,async x=>{let D=k()._i,T=k()._r;b({_r:Ja});let N=[],M=v(),[C]=ts(n,x),G=C().data,L=[],j=null;for(let Z=0;Z<M;++Z){let[H,X]=cl(a(Z,m?null:j));if(!H)break;let[z,F]=ts(n,H),$=z().data,W=s||D||ya($)||d&&!Z&&!ya(G)||I||G&&!ya(G[Z])&&!o.compare(G[Z],$);if(t&&(typeof T=="function"?T($,X):W)){let de=async()=>{if(!(H in g))$=await t(X);else{let ie=g[H];delete g[H],$=await ie}F({data:$,_k:X}),N[Z]=$};m?L.push(de):await de()}else N[Z]=$;m||(j=$)}return m&&await Promise.all(L.map(Z=>Z())),b({_i:Ja}),N},o),w=(0,ju.useCallback)(function(x,D){let T=typeof D=="boolean"?{revalidate:D}:D||{},N=T.revalidate!==!1;return f?(N&&(ya(x)?b({_i:!0,_r:T.revalidate}):b({_i:!1,_r:T.revalidate})),arguments.length?P.mutate(x,{...T,revalidate:N}):P.mutate()):KB},[f,n]),S=(0,ju.useCallback)(x=>{if(!f)return KB;let[,D]=ts(n,f),T;if(Fi(x)?T=x(v()):typeof x=="number"&&(T=x),typeof T!="number")return KB;D({_l:T}),y.current=T;let N=[],[M]=ts(n,f),C=null;for(let G=0;G<T;++G){let[L]=cl(a(G,C)),[j]=ts(n,L),Z=L?j().data:Ja;if(ya(Z))return w(M().data);N.push(Z),C=Z}return w(N)},[f,n,w,v]);return{size:v(),setSize:S,mutate:w,get data(){return P.data},get error(){return P.error},get isValidating(){return P.isValidating},get isLoading(){return P.isLoading}}},Zle=kj(gl,$qe);l();var Zc=class e extends Error{constructor(t,o){super(t);this.status=o;if(!o)switch(t){case"UNAUTHORIZED":this.status=403;break;case"USAGE_LIMIT":case"PREMIUM_FEATURE":this.status=402;break;case"NOT_FOUND":this.status=404;break;case"INVALID_REQUEST":this.status=400;break;case"EMPTY_DATASOURCE":this.status=400;break;case"ALREADY_INVITED":case"INTEGRATION_VALIDATION_FAILED":this.status=400;break;case"INTEGRATION_CREDENTIALS_INVALID":this.status=403;break;case"RATE_LIMIT":this.status=429;break;case"NOT_IMPLEMENTED":this.status=501;break;default:this.status=500;break}Object.setPrototypeOf(this,e.prototype)}};l();l();l();async function Ule(e,a){let t=e.getReader(),o;for(;!(o=await t.read()).done;)a(o.value)}function Vle(e){let a,t=0,o=-1,i=!1;return function(r){if(a===void 0)a=r;else{let d=new Uint8Array(a.length+r.length);d.set(a),d.set(r,a.length),a=d}let s=a.length,u=0;for(;t<s;){i&&(a[t]===10&&(u=++t),i=!1);let d=-1;for(;t<s&&d===-1;++t)switch(a[t]){case 58:o===-1&&(o=t-u);break;case 13:case 10:i=!0,d=t;break}if(d===-1)break;e(a.subarray(u,d),o),u=t,o=-1}u===s?a=void 0:u>0&&(a=a.subarray(u),t-=u)}}function Hle(e,a,t){let o=qle(),i=new TextDecoder;return function(r,s){if(r.length===0)t?.(o),o=qle();else if(s>0){let u=i.decode(r.subarray(0,s)),d=s+(r[s+1]===32?2:1),p=i.decode(r.subarray(d));switch(u){case"data":o.data=o.data?o.data+`
3207
3207
  `+p:p;break;case"event":o.event=p;break;case"id":e(o.id=p);break;case"retry":let m=parseInt(p,10);isNaN(m)||a(o.retry=m);break}}}}function qle(){return{data:"",event:"",id:"",retry:void 0}}var xb="text/event-stream",Jqe=1e3,Kle="last-event-id";function $B(e,{signal:a,headers:t,onopen:o,onmessage:i,onclose:n,onerror:r,openWhenHidden:s,fetch:u,...d}){return new Promise((p,m)=>{let g={...t};g.accept||(g.accept=xb);let f;function k(){f.abort(),globalThis.hidden||I()}s||globalThis?.addEventListener?.("visibilitychange",k);let b=Jqe,_;function h(){globalThis?.removeEventListener?.("visibilitychange",k),clearTimeout(_),f.abort()}a?.addEventListener("abort",()=>{h(),p()});let v=u??globalThis.fetch,y=o??Xqe;async function I(){f=new AbortController;try{let P=await v(e,{...d,headers:g,signal:f.signal});await y(P),await Ule(P.body,Vle(Hle(w=>{w?g[Kle]=w:delete g[Kle]},w=>{b=w},i))),n?.(),h(),p()}catch(P){if(!f.signal.aborted)try{let w=r?.(P)??b;clearTimeout(_),_=setTimeout(I,w)}catch(w){h(),m(w)}}}I()})}function Xqe(e){let a=e.headers.get("content-type");if(!a?.startsWith(xb))throw new Error(`Expected content-type to be ${xb}, Actual: ${a}`)}l();var Sb=R(K());var eUe="https://app.zappway.ai",aUe=({agentId:e})=>{let[a,t]=(0,Sb.useState)(!1),i=gl(e?`${eUe}/api/agents/${e}`:null,mp)?.data?.interfaceConfig,n=i?.rateLimit?.maxQueries||0,r=(0,Sb.useCallback)(()=>{let s=0;try{s=Number(localStorage.getItem("rateLimitCount"))}catch{}s++;try{localStorage.setItem("rateLimitCount",`${s}`)}catch{}s>=n&&t(!0)},[n]);return(0,Sb.useEffect)(()=>{if(!i?.rateLimit?.interval)return;let s=setInterval(()=>{try{localStorage.setItem("rateLimitCount","0")}catch{}t(!1)},i?.rateLimit?.interval*1e3);return()=>clearInterval(s)},[i]),{isRateExceeded:i?.rateLimit?.enabled?a:!1,handleIncrementRateLimitCount:r,rateExceededMessage:i?.rateLimit?.limitReachedMessage||"Usage limit reached"}},Yle=aUe;var fC="https://app.zappway.ai",hl=(0,Bi.createContext)({}),tUe=async e=>{let a="";try{a=localStorage.getItem("visitorId")}catch{}await fetch(`${fC}/api/conversations/eval-answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eval:e.value,messageId:e.messageId,visitorId:a})})},oUe="conversationId",iUe=({endpoint:e,channel:a,queryBody:t,disableFetchHistory:o,...i})=>{let n=i.localStorageConversationIdKey||oUe,[r,s]=cr({history:[],visitorId:"",conversationId:"",conversationStatus:"UNRESOLVED",hasMoreMessages:!0,prevConversationId:"",mounted:!1,handleAbort:void 0,isStreaming:!1,isAiEnabled:!0,isFormValid:!1}),{upload:u}=ib(),{isRateExceeded:d,rateExceededMessage:p,handleIncrementRateLimitCount:m}=Yle({agentId:i.agentId}),g=`${fC}/api/conversations/message`,f=ob(g,async(S,{arg:x})=>{let{conversationId:D,...T}=x;if(!D)throw new Error("conversationId is required");let N=`${fC}/api/conversations/${D}/message`;return tb("POST")(N,T)}),k=Zle((S,x)=>{if(!r.conversationId)return r.hasMoreMessages&&s({hasMoreMessages:!1}),null;if(x&&x?.messages?.length===0)return s({hasMoreMessages:!1}),null;let D=x?.messages?.[x?.messages?.length-1]?.id;return o?null:`${fC}/api/conversations/${r.conversationId}?cursor=${D||""}`},mp,{onSuccess:S=>{(S===null||S?.[0]===null)&&s({conversationId:""})},...r.isAiEnabled?{refreshInterval:3e4}:{refreshInterval:5e3}}),{mutate:b}=k,_=(0,Bi.useCallback)(()=>{k.isLoading||k.isValidating||k.setSize(k.size+1)},[k]),h=(0,Bi.useCallback)(async({query:S,isDraft:x,files:D=[],attachmentsForAI:T=[]})=>{let N=S?.trim?.()||"";if(!N||!e)return;let M=r.conversationId||(0,Qle.default)(),C=[];if(D?.length){let X=await u(D.map(z=>({conversationId:M,agentId:i.agentId,case:"chatUpload",fileName:z.name,mimeType:z.type,file:z})));C=D.map((z,F)=>({name:z.name,url:X[F],size:z.size,mimeType:z.type}))}if(a&&a!=="dashboard"&&k.data&&!k.data[0]?.isAiEnabled){await f.trigger({conversationId:M,from:"human",message:N,channel:a,visitorId:r.visitorId}),await k.mutate();return}if(d){s({history:[...r.history,{from:"agent",message:p||""}]});return}let G=new AbortController,L=r.history.length,j=[...r.history,{from:"human",message:N,attachments:C.map((X,z)=>({id:z,...X}))}];s({history:j,isStreaming:!0,handleAbort:()=>{G.abort()}});let Z="",H="";try{let X="",z="",F="",$="",W="";class de extends Error{}class ne extends Error{}await $B(e,{method:"POST",headers:{"Content-Type":"application/json"},openWhenHidden:!0,body:JSON.stringify({...t,streaming:!0,query:N,visitorId:r.visitorId,conversationId:M,channel:a,attachments:C,isDraft:x,contact:i.contact,context:i.context,attachmentsForAI:T}),signal:G.signal,async onopen(ie){if(!(ie.ok&&ie.headers.get("content-type")===xb))throw ie.status>=400&&ie.status<500&&ie.status!==429?ie.status===402?new Zc("USAGE_LIMIT"):new ne:new de},onclose(){},onerror(ie){if(console.error("on error",ie,Object.keys(ie)),ie instanceof ne)throw G.abort(),ie;if(ie instanceof Zc)throw console.error("ApiError",Zc),ie;ie instanceof de&&console.warn("RetriableError ocorreu no onclose. Tentando reconexão ou ignorando...")},onmessage:ie=>{if(console.debug("[EventSource]",ie),ie.data==="[DONE]"){G.abort(),console.debug("[answer]",X),console.debug("[response]",F);try{let{sources:ee,conversationId:Q,visitorId:se,messageId:fe,isValid:ye,...be}=JSON.parse(F),Te=[...j],ve={...be.metadata};try{ve={...ve,...JSON.parse(W||"{}")}}catch{}Te[L]?(Te[L].message=X,Te[L].id=fe,Te[L].metadata=ve):Te.push({id:fe,from:"agent",message:X,sources:ee,metadata:ve}),s({history:Te,conversationId:Q,prevConversationId:r.conversationId,visitorId:se,isFormValid:ye});try{localStorage.setItem("visitorId",se||""),localStorage.setItem(n,Q||"")}catch{}X?.trim()===""&&setTimeout(()=>{k.mutate()},1e3)}catch(ee){console.error(ee)}return}if(ie.data?.startsWith("[ERROR]")){G.abort();let ee=ie.data.replace("[ERROR]","");if(ee==="USAGE_LIMIT")if(!a||a==="dashboard")ee="Message limit reached. Please upgrade your plan.";else return;s({history:[...j,{from:"agent",message:ee}]});return}if(ie.event==="endpoint_response"){F+=decodeURIComponent(ie.data);return}if(ie.event==="step"){z+=decodeURIComponent(ie.data);let ee=[...j];ee[L]?ee[L].message=z:ee.push({from:"agent",message:z}),s({history:ee});return}if(ie.event==="metadata"){W+=decodeURIComponent(ie.data);return}if(ie.event==="tool_call"){$+=ie.data;let ee=[...j];ee[L]?ee[L].step={type:"tool_call"}:ee.push({from:"agent",message:"",step:{type:"tool_call"}}),s({history:ee});return}if(ie.event==="answer"){X+=decodeURIComponent(ie.data);let ee=[...j];ee[L]?ee[L].message=X:ee.push({from:"agent",message:X}),s({history:ee})}}}),m?.()}catch(X){console.error("err",X),X instanceof Zc&&(X?.message?(H=X.message,H==="USAGE_LIMIT"?Z="Usage limit reached. Please upgrade your plan.":Z=`Error: ${H}`):Z=`Error: ${H}`,s({history:[...j,{from:"agent",message:Z}]}))}finally{s({isStreaming:!1})}},[e,a,t,d,p,n,r.conversationId,r.history,r.visitorId,s,m,i.agentId,i.contact,i.context,u,k,f]),v=(0,Bi.useCallback)(S=>{s({conversationId:S||""});try{localStorage.setItem(n,S||"")}catch{}},[n,s]),y=(0,Bi.useCallback)(S=>{s({visitorId:S||""});try{localStorage.setItem("visitorId",S||"")}catch{}},[s]),I=(0,Bi.useCallback)(S=>v(S),[v]),P=(0,Bi.useCallback)(S=>{s({history:S})},[s]);(0,Bi.useEffect)(()=>{k.data&&s({history:k.data?.filter(Boolean)?.map(S=>S?.messages)?.flat()?.reverse()?.map(S=>({id:S.id,conversationId:S.conversationId,eval:S.eval,from:S.from,message:S.text,createdAt:S.createdAt,sources:S.sources,approvals:S.approvals||[],metadata:S.metadata||{},attachments:S.attachments||[],submission:S.submission,iconUrl:S.from==="agent"?void 0:S?.user?.customPicture||S?.user?.picture,fromName:S.user?.name})),conversationStatus:k.data[0]?.status??r.conversationStatus,isAiEnabled:k.data[0]?.isAiEnabled})},[k.data,s,r.conversationStatus]),(0,Bi.useEffect)(()=>{r.conversationId&&k.mutate()},[r.conversationId,k]),(0,Bi.useEffect)(()=>{if(!r.prevConversationId&&r.conversationId){s({hasMoreMessages:!1});return}r.conversationId||s({history:[]})},[r.conversationId,r.prevConversationId,s]),(0,Bi.useEffect)(()=>{if(typeof window<"u")try{let S=localStorage.getItem("visitorId")||"",x=localStorage.getItem(n)||"";s({visitorId:S,conversationId:x})}catch{}},[n,s]);let w=(0,Bi.useCallback)(()=>b(),[b]);return{agentId:i.agentId,history:r.history,isLoadingConversation:k.isLoading,isValidatingConversation:k.isValidating,isFomValid:r.isFormValid,hasMoreMessages:r.hasMoreMessages,visitorId:r.visitorId,conversationId:r.conversationId,handleAbort:r.handleAbort,conversationStatus:r.conversationStatus,visitorEmail:k.data?.[0]?.lead?.email||"",contact:k.data?.[0]?.participantsVisitors?.[0]?.contact,isStreaming:r.isStreaming,isAiEnabled:r.isAiEnabled,conversationAttachments:k.data?.[0]?.attachments||[],createNewConversation:I,handleChatSubmit:h,handleLoadMoreMessages:_,setConversationId:v,setVisitorId:y,handleEvalAnswer:tUe,setHistory:P,refreshConversation:w,triggerSendMessage:f.trigger}},$le=iUe;l();var Jle=R(K());var bl=R(ae());function JB(e){let a=(0,Jle.useRef)(null),{t}=ho("",{i18n:ri}),[o,i]=cr({isCaptureLoading:!1,isCaptureSuccess:!1,visitorEmail:e.visitorEmail||"",emailInputValue:"",validPayload:void 0}),n=nt.object({...e.isEmailEnabled?{email:nt.string().email()}:{},...e.isPhoneNumberEnabled?{phoneNumber:nt.string().min(1)}:{}}),r=uf({resolver:df(n),mode:"onChange"}),s=async d=>{i({isCaptureLoading:!0}),await fetch(`https://app.zappway.ai/api/agents/${e.agentId}/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:e.conversationId,visitorId:e.visitorId,visitorEmail:d.email,phoneNumber:d.phoneNumber})}),await e.onSubmitSucess?.(d),i({isCaptureLoading:!1,isCaptureSuccess:!0})},u=typeof window<"u"?a.current?.closest(".zappway-widget"):null;return console.log("ERRORS-------->",r.formState.errors),(0,bl.jsxs)(De,{ref:a,onChange:d=>{d.preventDefault(),d.stopPropagation()},onSubmit:d=>{d.preventDefault(),d.stopPropagation(),r.handleSubmit(s)(d)},component:Vo.form,direction:"column",gap:1,sx:{width:"100%",height:"100%",pt:1,pb:2},initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[(0,bl.jsx)(va,{startDecorator:(0,bl.jsx)(_le,{sx:{fontSize:"sm"}}),level:"body-xs",fontWeight:600,children:t("chatbubble:lead.instruction")}),e.isEmailEnabled&&(0,bl.jsx)(_p,{control:r.control,sx:{width:"100%"},size:"sm",type:"email",placeholder:t("chatbubble:lead.email"),startDecorator:(0,bl.jsx)(yle,{}),defaultValue:e.visitorEmail,...r.register("email")}),e.isPhoneNumberEnabled&&(0,bl.jsx)(sC,{control:r.control,...r.register("phoneNumber"),placeholder:"phone number",handleChange:d=>{r.setValue("phoneNumber",d,{shouldValidate:!0,shouldDirty:!0})},selectProps:{slotProps:{listbox:{container:u}}}}),(0,bl.jsx)(Mt,{size:"sm",type:"submit",color:"primary",loading:o.isCaptureLoading,disabled:!r.formState.isValid,children:(0,bl.jsx)(iI,{sx:{fontSize:"sm"}})})]})}l();var sue=R(K());l();var nue=R(K());l();var bC=R(K());l();var Ts=R(K());l();var Xle=R(K());var zb=R(ae());function nUe(e){let{t:a}=ho("_Chatbox_NewChatButton",{i18n:ri}),{createNewConversation:t,history:o}=(0,Xle.useContext)(hl);return o.length<2?null:(0,zb.jsx)(Td,{title:a("new_chat"),variant:"solid",placement:"bottom",arrow:!0,disablePortal:!0,sx:i=>({zIndex:1e10,borderRadius:i.radius.md}),children:(0,zb.jsx)(it,{onClick:()=>t(),color:"neutral",variant:"plain",size:"sm",...e,children:(0,zb.jsx)(kf,{sx:{fontSize:"1rem"},children:(0,zb.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:(0,zb.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.7929 2.79289C18.0118 1.57394 19.9882 1.57394 21.2071 2.79289C22.4261 4.01184 22.4261 5.98815 21.2071 7.20711L12.7071 15.7071C12.5196 15.8946 12.2652 16 12 16H9C8.44772 16 8 15.5523 8 15V12C8 11.7348 8.10536 11.4804 8.29289 11.2929L16.7929 2.79289ZM19.7929 4.20711C19.355 3.7692 18.645 3.7692 18.2071 4.2071L10 12.4142V14H11.5858L19.7929 5.79289C20.2308 5.35499 20.2308 4.64501 19.7929 4.20711ZM6 5C5.44772 5 5 5.44771 5 6V18C5 18.5523 5.44772 19 6 19H18C18.5523 19 19 18.5523 19 18V14C19 13.4477 19.4477 13 20 13C20.5523 13 21 13.4477 21 14V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6C3 4.34314 4.34315 3 6 3H10C10.5523 3 11 3.44771 11 4C11 4.55228 10.5523 5 10 5H6Z"})})})})})}var hC=nUe;var Va=R(ae()),rUe=Vo.create(Ji),sUe=Vo.create(it),lUe={theme:"light",primaryColor:"#000000",position:"left"},eue="https://app.zappway.ai",uUe=({children:e,imageUrl:a,handleClose:t,config:o})=>(0,Va.jsxs)(De,{sx:{position:"relative",px:2,pt:6,pb:1,flex:1,width:"100%",height:"100%",maxHeight:"100%",overflowY:"hidden"},children:[(0,Va.jsx)(et,{sx:{position:"absolute",width:"100%",top:0,left:0,right:0,zIndex:1},children:(0,Va.jsxs)(De,{direction:"row",sx:i=>({px:2,py:1,alignItems:"center",borderBottom:"1px solid",borderColor:"divider"}),children:[(0,Va.jsx)(_d,{size:"sm",variant:"outlined",sx:{mr:1},src:a}),(0,Va.jsx)(va,{level:"body-lg",sx:i=>({fontFamily:"Bricolage Grotesque",fontWeight:i.fontWeight.lg}),children:o?.displayName}),(0,Va.jsxs)(De,{direction:"row",sx:{ml:"auto",alignItems:"center"},children:[(0,Va.jsx)(hC,{variant:"plain"}),t&&(0,Va.jsx)(it,{variant:"plain",size:"sm",onClick:t,children:(0,Va.jsx)(hle,{})})]})]})}),e]});function dUe({...e}){let a=e.interfaceConfig||lUe,t=e?.interfaceConfig?.iconUrl||e?.agentIconUrl||"https://app.zappway.ai/images/chatbubble-default-icon-sm.gif",o=(0,Ts.useRef)(null),[i,n]=cr({isOpen:!!e.isOpen,hasOpenOnce:!1,showInitialMessage:!1,visitorEmail:"",showLeadFormAfterMessageId:""});(0,Ts.useEffect)(()=>{n({isOpen:!!e.isOpen})},[e.isOpen,n]);let r=(0,Ts.useMemo)(()=>(a.initialMessages||[]).map(m=>m?.trim?.()).filter(m=>!!m),[a?.initialMessages]);(0,Ts.useEffect)(()=>{let p=null;return r?.length>0&&!a?.isInitMessagePopupDisabled&&(p=setTimeout(()=>{n({showInitialMessage:!0})},5e3)),()=>{p&&clearTimeout(p)}},[r?.length,a?.isInitMessagePopupDisabled,n]);let s=(0,Ts.useCallback)(()=>{n({isOpen:!1})},[n]),u=(0,Ts.useMemo)(()=>(0,Va.jsx)(_d,{src:t,sx:{width:"100%",height:"100%",background:"transparent",...a?.bubbleIconStyle}}),[t,a?.bubbleIconStyle]),d=(0,Ts.useMemo)(()=>p=>(0,Va.jsx)(uUe,{...p,handleClose:s,imageUrl:t,config:a}),[s,t,a]);return e?.isLoadingAgent?null:(0,Va.jsxs)(Va.Fragment,{children:[r?.length>0&&i.showInitialMessage&&!i.hasOpenOnce&&(0,Va.jsxs)(De,{ref:o,className:"zappway-init-messages",sx:{position:"fixed",bottom:100,maxWidth:{xs:"90%",sm:"500px"},zIndex:9999999999-1,...a?.position==="left"?{left:"20px"}:{},...a?.position==="right"?{right:"20px"}:{}},gap:2,children:[(0,Va.jsx)(it,{sx:{position:"absolute",zIndex:2,top:-2,transform:"translate(0px, -125%)",p:.2,backgroundColor:"white",minWidth:"10px",minHeight:"10px",borderRadius:"100%",...a?.position==="left"?{right:0}:{},...a?.position==="right"?{right:0}:{}},variant:"outlined",color:"neutral",size:"md",onClick:()=>n({showInitialMessage:!1}),children:(0,Va.jsx)(gle,{sx:{fontSize:"sm"}})}),(0,Va.jsx)(qz,{messages:r.map(p=>({iconUrl:t,from:"agent",message:p,approvals:[]}))})]}),(0,Va.jsxs)(et,{className:"zappway-widget",sx:{overflow:"visible",position:"fixed",height:"60px",bottom:"20px",zIndex:9999999999,...a?.position==="left"?{left:"20px"}:{},...a?.position==="right"?{right:"20px"}:{}},children:[(0,Va.jsx)(rUe,{initial:{opacity:0},animate:{opacity:i.isOpen?1:0},exit:{opacity:0},transition:{duration:.2},variant:"outlined",sx:p=>({pointerEvents:i.isOpen?"all":"none",position:"absolute",bottom:"80px",display:"flex",flexDirection:"column",boxSizing:"border-box",p:0,gap:0,opacity:1,zIndex:1,...a?.position==="right"?{transform:"translateX(-450px)"}:{},[p.breakpoints.up("sm")]:{width:"500px"},[p.breakpoints.only("xs")]:{width:"100vw",height:"100vh",maxWidth:"100vw",position:"fixed",left:0,top:0,transform:"translateX(0px)"}}),children:(0,Va.jsx)(De,{sx:p=>({position:"relative",height:"100%",maxHeight:"100%",flex:1,padding:0,[p.breakpoints.up("sm")]:{minHeight:"680px",maxHeight:"680px"},[p.breakpoints.only("xs")]:{height:"100%",maxWidth:"100vw"},overflowY:"hidden"}),children:(0,Va.jsx)(dC,{...e,chatBoxProps:{...e.chatBoxProps,isOpen:i.isOpen},agentIconUrl:t,layout:d})})}),(0,Va.jsx)(Vo.div,{initial:"hidden",animate:"visible",variants:{visible:{y:0,transition:{when:"beforeChildren",staggerChildren:.3}},hidden:{y:100,transition:{when:"afterChildren"}}},children:(0,Va.jsx)(sUe,{initial:"hidden",animate:"visible",variants:{visible:{rotate:0},hidden:{rotate:-180}},exit:"hidden",onClick:()=>n({isOpen:!i.isOpen,...i.isOpen?{}:{hasOpenOnce:!0}}),sx:p=>({backgroundColor:a?.primaryColor,width:"60px",height:"60px",borderRadius:"100%",borderWidth:"0.5px",borderColor:p.palette.divider,borderStyle:"solid",p:"0",overflow:"hidden","&:hover":{backgroundColor:a?.primaryColor,filter:"brightness(0.9)",transform:"scale(1.05)"},...a?.bubbleButtonStyle}),children:(0,Va.jsx)(Zf,{children:i.isOpen?(0,Va.jsx)(Vo.div,{initial:{rotate:-180},animate:{rotate:0},exit:{rotate:-180},transition:{duration:.2},children:(0,Va.jsx)(mle,{})},"close-icon"):u})})})]})]})}var aue=dUe;l();l();var XB={};(function e(a,t,o,i){var n=!!(a.Worker&&a.Blob&&a.Promise&&a.OffscreenCanvas&&a.OffscreenCanvasRenderingContext2D&&a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype.transferControlToOffscreen&&a.URL&&a.URL.createObjectURL),r=typeof Path2D=="function"&&typeof DOMMatrix=="function",s=function(){if(!a.OffscreenCanvas)return!1;var z=new OffscreenCanvas(1,1),F=z.getContext("2d");F.fillRect(0,0,1,1);var $=z.transferToImageBitmap();try{F.createPattern($,"no-repeat")}catch{return!1}return!0}();function u(){}function d(z){var F=t.exports.Promise,$=F!==void 0?F:a.Promise;return typeof $=="function"?new $(z):(z(u,u),null)}var p=function(z,F){return{transform:function($){if(z)return $;if(F.has($))return F.get($);var W=new OffscreenCanvas($.width,$.height),de=W.getContext("2d");return de.drawImage($,0,0),F.set($,W),W},clear:function(){F.clear()}}}(s,new Map),m=function(){var z=Math.floor(16.666666666666668),F,$,W={},de=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(F=function(ne){var ie=Math.random();return W[ie]=requestAnimationFrame(function ee(Q){de===Q||de+z-1<Q?(de=Q,delete W[ie],ne()):W[ie]=requestAnimationFrame(ee)}),ie},$=function(ne){W[ne]&&cancelAnimationFrame(W[ne])}):(F=function(ne){return setTimeout(ne,z)},$=function(ne){return clearTimeout(ne)}),{frame:F,cancel:$}}(),g=function(){var z,F,$={};function W(de){function ne(ie,ee){de.postMessage({options:ie||{},callback:ee})}de.init=function(ee){var Q=ee.transferControlToOffscreen();de.postMessage({canvas:Q},[Q])},de.fire=function(ee,Q,se){if(F)return ne(ee,null),F;var fe=Math.random().toString(36).slice(2);return F=d(function(ye){function be(Te){Te.data.callback===fe&&(delete $[fe],de.removeEventListener("message",be),F=null,p.clear(),se(),ye())}de.addEventListener("message",be),ne(ee,fe),$[fe]=be.bind(null,{data:{callback:fe}})}),F},de.reset=function(){de.postMessage({reset:!0});for(var ee in $)$[ee](),delete $[ee]}}return function(){if(z)return z;if(!o&&n){var de=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
3208
- `);try{z=new Worker(URL.createObjectURL(new Blob([de])))}catch(ne){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",ne),null}W(z)}return z}}(),f={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function k(z,F){return F?F(z):z}function b(z){return z!=null}function _(z,F,$){return k(z&&b(z[F])?z[F]:f[F],$)}function h(z){return z<0?0:Math.floor(z)}function v(z,F){return Math.floor(Math.random()*(F-z))+z}function y(z){return parseInt(z,16)}function I(z){return z.map(P)}function P(z){var F=String(z).replace(/[^0-9a-f]/gi,"");return F.length<6&&(F=F[0]+F[0]+F[1]+F[1]+F[2]+F[2]),{r:y(F.substring(0,2)),g:y(F.substring(2,4)),b:y(F.substring(4,6))}}function w(z){var F=_(z,"origin",Object);return F.x=_(F,"x",Number),F.y=_(F,"y",Number),F}function S(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function x(z){var F=z.getBoundingClientRect();z.width=F.width,z.height=F.height}function D(z){var F=document.createElement("canvas");return F.style.position="fixed",F.style.top="0px",F.style.left="0px",F.style.pointerEvents="none",F.style.zIndex=z,F}function T(z,F,$,W,de,ne,ie,ee,Q){z.save(),z.translate(F,$),z.rotate(ne),z.scale(W,de),z.arc(0,0,1,ie,ee,Q),z.restore()}function N(z){var F=z.angle*(Math.PI/180),$=z.spread*(Math.PI/180);return{x:z.x,y:z.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:z.startVelocity*.5+Math.random()*z.startVelocity,angle2D:-F+(.5*$-Math.random()*$),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:z.color,shape:z.shape,tick:0,totalTicks:z.ticks,decay:z.decay,drift:z.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:z.gravity*3,ovalScalar:.6,scalar:z.scalar,flat:z.flat}}function M(z,F){F.x+=Math.cos(F.angle2D)*F.velocity+F.drift,F.y+=Math.sin(F.angle2D)*F.velocity+F.gravity,F.velocity*=F.decay,F.flat?(F.wobble=0,F.wobbleX=F.x+10*F.scalar,F.wobbleY=F.y+10*F.scalar,F.tiltSin=0,F.tiltCos=0,F.random=1):(F.wobble+=F.wobbleSpeed,F.wobbleX=F.x+10*F.scalar*Math.cos(F.wobble),F.wobbleY=F.y+10*F.scalar*Math.sin(F.wobble),F.tiltAngle+=.1,F.tiltSin=Math.sin(F.tiltAngle),F.tiltCos=Math.cos(F.tiltAngle),F.random=Math.random()+2);var $=F.tick++/F.totalTicks,W=F.x+F.random*F.tiltCos,de=F.y+F.random*F.tiltSin,ne=F.wobbleX+F.random*F.tiltCos,ie=F.wobbleY+F.random*F.tiltSin;if(z.fillStyle="rgba("+F.color.r+", "+F.color.g+", "+F.color.b+", "+(1-$)+")",z.beginPath(),r&&F.shape.type==="path"&&typeof F.shape.path=="string"&&Array.isArray(F.shape.matrix))z.fill(Z(F.shape.path,F.shape.matrix,F.x,F.y,Math.abs(ne-W)*.1,Math.abs(ie-de)*.1,Math.PI/10*F.wobble));else if(F.shape.type==="bitmap"){var ee=Math.PI/10*F.wobble,Q=Math.abs(ne-W)*.1,se=Math.abs(ie-de)*.1,fe=F.shape.bitmap.width*F.scalar,ye=F.shape.bitmap.height*F.scalar,be=new DOMMatrix([Math.cos(ee)*Q,Math.sin(ee)*Q,-Math.sin(ee)*se,Math.cos(ee)*se,F.x,F.y]);be.multiplySelf(new DOMMatrix(F.shape.matrix));var Te=z.createPattern(p.transform(F.shape.bitmap),"no-repeat");Te.setTransform(be),z.globalAlpha=1-$,z.fillStyle=Te,z.fillRect(F.x-fe/2,F.y-ye/2,fe,ye),z.globalAlpha=1}else if(F.shape==="circle")z.ellipse?z.ellipse(F.x,F.y,Math.abs(ne-W)*F.ovalScalar,Math.abs(ie-de)*F.ovalScalar,Math.PI/10*F.wobble,0,2*Math.PI):T(z,F.x,F.y,Math.abs(ne-W)*F.ovalScalar,Math.abs(ie-de)*F.ovalScalar,Math.PI/10*F.wobble,0,2*Math.PI);else if(F.shape==="star")for(var ve=Math.PI/2*3,Ne=4*F.scalar,he=8*F.scalar,Fe=F.x,Qe=F.y,la=5,ra=Math.PI/la;la--;)Fe=F.x+Math.cos(ve)*he,Qe=F.y+Math.sin(ve)*he,z.lineTo(Fe,Qe),ve+=ra,Fe=F.x+Math.cos(ve)*Ne,Qe=F.y+Math.sin(ve)*Ne,z.lineTo(Fe,Qe),ve+=ra;else z.moveTo(Math.floor(F.x),Math.floor(F.y)),z.lineTo(Math.floor(F.wobbleX),Math.floor(de)),z.lineTo(Math.floor(ne),Math.floor(ie)),z.lineTo(Math.floor(W),Math.floor(F.wobbleY));return z.closePath(),z.fill(),F.tick<F.totalTicks}function C(z,F,$,W,de){var ne=F.slice(),ie=z.getContext("2d"),ee,Q,se=d(function(fe){function ye(){ee=Q=null,ie.clearRect(0,0,W.width,W.height),p.clear(),de(),fe()}function be(){o&&!(W.width===i.width&&W.height===i.height)&&(W.width=z.width=i.width,W.height=z.height=i.height),!W.width&&!W.height&&($(z),W.width=z.width,W.height=z.height),ie.clearRect(0,0,W.width,W.height),ne=ne.filter(function(Te){return M(ie,Te)}),ne.length?ee=m.frame(be):ye()}ee=m.frame(be),Q=ye});return{addFettis:function(fe){return ne=ne.concat(fe),se},canvas:z,promise:se,reset:function(){ee&&m.cancel(ee),Q&&Q()}}}function G(z,F){var $=!z,W=!!_(F||{},"resize"),de=!1,ne=_(F,"disableForReducedMotion",Boolean),ie=n&&!!_(F||{},"useWorker"),ee=ie?g():null,Q=$?S:x,se=z&&ee?!!z.__confetti_initialized:!1,fe=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ye;function be(ve,Ne,he){for(var Fe=_(ve,"particleCount",h),Qe=_(ve,"angle",Number),la=_(ve,"spread",Number),ra=_(ve,"startVelocity",Number),Wa=_(ve,"decay",Number),U=_(ve,"gravity",Number),te=_(ve,"drift",Number),ue=_(ve,"colors",I),_e=_(ve,"ticks",Number),V=_(ve,"shapes"),J=_(ve,"scalar"),pe=!!_(ve,"flat"),Ae=w(ve),We=Fe,ua=[],Ce=z.width*Ae.x,Ee=z.height*Ae.y;We--;)ua.push(N({x:Ce,y:Ee,angle:Qe,spread:la,startVelocity:ra,color:ue[We%ue.length],shape:V[v(0,V.length)],ticks:_e,decay:Wa,gravity:U,drift:te,scalar:J,flat:pe}));return ye?ye.addFettis(ua):(ye=C(z,ua,Q,Ne,he),ye.promise)}function Te(ve){var Ne=ne||_(ve,"disableForReducedMotion",Boolean),he=_(ve,"zIndex",Number);if(Ne&&fe)return d(function(ra){ra()});$&&ye?z=ye.canvas:$&&!z&&(z=D(he),document.body.appendChild(z)),W&&!se&&Q(z);var Fe={width:z.width,height:z.height};ee&&!se&&ee.init(z),se=!0,ee&&(z.__confetti_initialized=!0);function Qe(){if(ee){var ra={getBoundingClientRect:function(){if(!$)return z.getBoundingClientRect()}};Q(ra),ee.postMessage({resize:{width:ra.width,height:ra.height}});return}Fe.width=Fe.height=null}function la(){ye=null,W&&(de=!1,a.removeEventListener("resize",Qe)),$&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,se=!1)}return W&&!de&&(de=!0,a.addEventListener("resize",Qe,!1)),ee?ee.fire(ve,Fe,la):be(ve,Fe,la)}return Te.reset=function(){ee&&ee.reset(),ye&&ye.reset()},Te}var L;function j(){return L||(L=G(null,{useWorker:!0,resize:!0})),L}function Z(z,F,$,W,de,ne,ie){var ee=new Path2D(z),Q=new Path2D;Q.addPath(ee,new DOMMatrix(F));var se=new Path2D;return se.addPath(Q,new DOMMatrix([Math.cos(ie)*de,Math.sin(ie)*de,-Math.sin(ie)*ne,Math.cos(ie)*ne,$,W])),se}function H(z){if(!r)throw new Error("path confetti are not supported in this browser");var F,$;typeof z=="string"?F=z:(F=z.path,$=z.matrix);var W=new Path2D(F),de=document.createElement("canvas"),ne=de.getContext("2d");if(!$){for(var ie=1e3,ee=ie,Q=ie,se=0,fe=0,ye,be,Te=0;Te<ie;Te+=2)for(var ve=0;ve<ie;ve+=2)ne.isPointInPath(W,Te,ve,"nonzero")&&(ee=Math.min(ee,Te),Q=Math.min(Q,ve),se=Math.max(se,Te),fe=Math.max(fe,ve));ye=se-ee,be=fe-Q;var Ne=10,he=Math.min(Ne/ye,Ne/be);$=[he,0,0,he,-Math.round(ye/2+ee)*he,-Math.round(be/2+Q)*he]}return{type:"path",path:F,matrix:$}}function X(z){var F,$=1,W="#000000",de='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof z=="string"?F=z:(F=z.text,$="scalar"in z?z.scalar:$,de="fontFamily"in z?z.fontFamily:de,W="color"in z?z.color:W);var ne=10*$,ie=""+ne+"px "+de,ee=new OffscreenCanvas(ne,ne),Q=ee.getContext("2d");Q.font=ie;var se=Q.measureText(F),fe=Math.ceil(se.actualBoundingBoxRight+se.actualBoundingBoxLeft),ye=Math.ceil(se.actualBoundingBoxAscent+se.actualBoundingBoxDescent),be=2,Te=se.actualBoundingBoxLeft+be,ve=se.actualBoundingBoxAscent+be;fe+=be+be,ye+=be+be,ee=new OffscreenCanvas(fe,ye),Q=ee.getContext("2d"),Q.font=ie,Q.fillStyle=W,Q.fillText(F,Te,ve);var Ne=1/$;return{type:"bitmap",bitmap:ee.transferToImageBitmap(),matrix:[Ne,0,0,Ne,-fe*Ne/2,-ye*Ne/2]}}t.exports=function(){return j().apply(this,arguments)},t.exports.reset=function(){j().reset()},t.exports.create=G,t.exports.shapeFromPath=H,t.exports.shapeFromText=X})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),XB,!1);var tue=XB.exports,ujt=XB.exports.create;function pUe(e={}){return(t={})=>{tue({particleCount:450,startVelocity:70,spread:150,origin:{y:.5,x:.5},...e,...t})}}var oue=pUe;var jb=R(ae()),eO=async(e,a)=>await fetch(`${eue}/api/conversations/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:a})}),mUe=({sx:e})=>{let{conversationId:a,conversationStatus:t,refreshConversation:o,createNewConversation:i}=(0,bC.useContext)(hl),[n,r]=(0,bC.useState)(!1),{t:s}=ho("",{i18n:ri}),u=oue({zIndex:1e10}),d=async p=>{try{r(!0);let m=await eO(a,p);await o(),m.ok&&p==="RESOLVED"&&u()}catch{}finally{r(!1)}};return t!=="RESOLVED"?(0,jb.jsxs)(Mt,{size:"sm",variant:"outlined",color:t==="RESOLVED"?"danger":"success",startDecorator:n?(0,jb.jsx)(Yi,{}):t!=="RESOLVED"?(0,jb.jsx)(dle,{}):(0,jb.jsx)(lle,{}),sx:{whiteSpace:"nowrap",...e},onClick:t!=="RESOLVED"?()=>d("RESOLVED"):()=>d("UNRESOLVED"),children:[t==="RESOLVED"&&s("chatbubble:actions.mark_as_unresolved"),t!=="RESOLVED"&&s("chatbubble:actions.resolve")]}):null},iue=mUe;var aO=R(ae());function cUe({}){let{conversationId:e,conversationStatus:a,visitorEmail:t,refreshConversation:o}=(0,nue.useContext)(hl),{t:i}=ho(["chatbubble","_Chatbox_Actions_RequestHumanButton"],{i18n:ri}),[n,r]=cr({isHumanRequestLoading:!1}),s=d=>({HUMAN_REQUESTED:"warning",RESOLVED:"neutral",UNRESOLVED:"neutral"})[d]||"neutral",u=d=>({HUMAN_REQUESTED:i("_Chatbox_Actions_RequestHumanButton:human_requested"),RESOLVED:i("chatbubble:actions.request"),UNRESOLVED:i("chatbubble:actions.request")})[d]||"";return(0,aO.jsx)(Mt,{size:"sm",variant:"outlined",disabled:a==="HUMAN_REQUESTED",loading:n.isHumanRequestLoading,sx:{whiteSpace:"nowrap"},color:s(a),startDecorator:(0,aO.jsx)(rle,{}),onClick:async()=>{try{r({isHumanRequestLoading:!0}),await eO(e,"HUMAN_REQUESTED"),await o()}catch{}finally{r({isHumanRequestLoading:!1})}},"aria-label":i(a==="HUMAN_REQUESTED"?"_Chatbox_Actions_RequestHumanButton:human_requested":"chatbubble:actions.request"),children:u(a)})}var rue=cUe;var Ar=R(ae());function gUe({withHumanRequested:e,withMarkAsResolved:a,userActions:t=[]}){let{conversationId:o,conversationStatus:i,createNewConversation:n,refreshConversation:r}=(0,sue.useContext)(hl);return t.length>0||a||e?(0,Ar.jsx)(Ar.Fragment,{children:(0,Ar.jsxs)(De,{direction:"row",sx:{justifyContent:"center",flexWrap:"wrap",mx:"auto",gap:1},children:[o&&i&&(0,Ar.jsxs)(Ar.Fragment,{children:[a&&(0,Ar.jsx)(iue,{}),e&&(0,Ar.jsx)(rue,{})]}),t.map((u,d)=>(0,Ar.jsx)("a",{href:u?.url,target:"_blank",children:(0,Ar.jsx)(Mt,{size:"sm",variant:"outlined",color:"neutral",children:u.label})},d))]})}):null}var lue=gUe;var kC=R(ae()),uue="https://app.zappway.ai/images/chatbubble-default-icon-sm.gif",due={theme:"light",primaryColor:"#000000",isBgTransparent:!1},hUe="https://app.zappway.ai";function bUe(e){let{agentId:a,initConfig:t,onAgentLoaded:o,contact:i,context:n,isOpen:r,layout:s,className:u,styles:d,children:p}=e,[m,g]=Lo.default.useState(a),[f,k]=Lo.default.useState(),[b,_]=Lo.default.useState(t||due),[h,v]=Lo.default.useState(!1),{query:y}=pC({id:m}),I=$le({endpoint:`${hUe}/api/agents/${m}/query`,channel:"website",agentId:m,localStorageConversationIdKey:`iFrameConversationId-${m}`,contact:i,context:n}),{history:P,isLoadingConversation:w,hasMoreMessages:S,handleAbort:x,conversationAttachments:D,handleChatSubmit:T,handleLoadMoreMessages:N,handleEvalAnswer:M}=I;(0,Lo.useEffect)(()=>{t&&_(t)},[t]);let C=f?.organization?.subscriptions?.[0],L=!!C&&[ma.SubscriptionPlan.level_2,ma.SubscriptionPlan.level_3].includes(C?.plan)&&!!b?.isBrandingDisabled;(0,Lo.useEffect)(()=>{if(!(typeof window>"u"||m))try{let se=window?.location?.href?.match?.(/agents\/([a-zA-Z0-9]+)/)?.[1];se&&g(se)}catch(se){console.error(se)}},[m]),(0,Lo.useEffect)(()=>{y.data&&(k(y.data),o?.(y.data),_({...due,...y?.data?.interfaceConfig,...t}))},[y.data,o,t]);let{isStreaming:j,visitorId:Z,conversationId:H,visitorEmail:X,refreshConversation:z}=I,F=(0,Lo.useMemo)(()=>f?.tools?.find(se=>se?.type==="lead_capture")?.config??{},[f]),$=(0,Lo.useMemo)(()=>!!f?.tools?.find(se=>se?.type==="mark_as_resolved"),[f]),W=(0,Lo.useMemo)(()=>!!f?.tools?.find(se=>se?.type==="request_human"),[f]),de=!!X||!!h||!!i?.email||!!i?.phoneNumber,ne=!!F?.isRequired&&!de,ie=(0,Lo.useMemo)(()=>(0,kC.jsx)(JB,{agentId:m,visitorId:Z,conversationId:H,visitorEmail:X,isEmailEnabled:!0,isRequired:!1,onSubmitSucess:async()=>{z(),v(!0)},...F}),[m,Z,H,X,z,F]),ee=(0,Lo.useMemo)(()=>{let se=[];t?.initialMessages?.length?se=t.initialMessages:se=b?.initialMessages||[];let fe=se.map(ye=>ye?.trim?.()).filter(ye=>!!ye).map(ye=>({from:"agent",message:ye.trim(),approvals:[]}));return ne&&fe.push({id:"lead-form",from:"agent",component:ie,disableActions:!0}),fe},[t?.initialMessages,b?.initialMessages,ne,ie]),Q=(0,Lo.useMemo)(()=>{let se={id:"lead-form",from:"agent",component:ie,disableActions:!0};return P.reduce((fe,ye,be)=>{let Te=P?.length>=2&&be===1&&!(P?.length===2&&j);return[...fe,ye,...F&&!F?.isRequired&&!de&&Te?[se]:[]]},[])},[ie,P,F,de,j]);return(0,Lo.useEffect)(()=>{if(!(typeof window>"u"))return document.addEventListener("CREATE_NEW_CONVERSATION",I.createNewConversation),()=>{document.removeEventListener("CREATE_NEW_CONVERSATION",I.createNewConversation)}},[I.createNewConversation]),(0,kC.jsx)(hl.Provider,{value:{...I,history:Q},children:Lo.default.createElement(p||dC,{isOpen:r,isLoadingAgent:!f,agentId:m,agentIconUrl:f?.iconUrl||uue,layout:s,interfaceConfig:b,layoutClassName:u,containerSxProps:d,chatBoxProps:{isOpen:r,messages:Q,onSubmit:T,messageTemplates:b.messageTemplates,initialMessage:b.initialMessage,initialMessages:ee,agentIconUrl:f?.iconUrl||uue,agentIconStyle:t?.iconStyle,isLoadingConversation:w,hasMoreMessages:S,handleLoadMoreMessages:N,handleEvalAnswer:M,handleAbort:x,withSources:!!f?.includeSources,isAiEnabled:I.isAiEnabled,disableWatermark:L,isStreaming:j,readOnly:F?.isRequired&&!de,hideInternalSources:!0,withFileUpload:!0,conversationAttachments:D,actions:(0,kC.jsx)(lue,{withHumanRequested:W,withMarkAsResolved:$})}})})}var yC=bUe;l();l();l();var Db=R(K()),fue=R(mue());l();l();var oO={50:"#E0FFF9",100:"#1AFF9C",200:"#80FFD2",300:"#4CFFB8",400:"#1AFF9C",500:"#00E683",600:"#00B36B",700:"#008A56",800:"#006640",900:"#00331F",main:"#00E683",background:"#121212",light:"#4CFFB8",dark:"#008A56",contrastText:"#FFFFFF",hover:"#1AFF9C",focus:"#C69EFF",disabled:"#006640",formBorder:"#008A56",inputBorder:"#00B36B",paper:"#1E1E1E",tabsBg:"#1E1E1E",formBg:"#1D0A42",textContrastDark:"#FFFFFF"};var cue=(e="zappway")=>({modeStorageKey:e,colorSchemeStorageKey:`${e}-color-scheme`,attribute:`data-${e}`}),gue=(e={})=>yg({cssVarPrefix:e.prefix,fontFamily:{body:"Inter, sans-serif",display:"Poppins, sans-serif"},typography:{display1:{background:"linear-gradient(-30deg, var(--joy-palette-primary-900), var(--joy-palette-primary-400))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontSize:"57px",lineHeight:"64px",letterSpacing:"-0.25px"},kbd:{background:"linear-gradient(to top, var(--joy-palette-background-level2), var(--joy-palette-background-surface))",border:"1px solid var(--joy-palette-neutral-outlinedBorder)",borderRadius:"var(--joy-radius-xs)",boxShadow:"var(--joy-shadow-sm)",padding:"0.125em 0.375em"}},fontSize:{xl7:"4.5rem",xl6:"3.75rem",xl5:"3rem",xs2:"0.625rem",xs3:"0.5rem"},fontWeight:{xs:200,xl2:800,xl3:900},components:{JoySelect:{defaultProps:{slotProps:{listbox:{container:e.container}}},styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyModal:{defaultProps:{container:e.container}},JoyCard:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyInput:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyTextarea:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyButton:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyIconButton:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}}},colorSchemes:{dark:{palette:{primary:oO}},light:{palette:{primary:oO,neutral:{solidBg:"#000"}}}}});var Cb=R(ae()),kUe={"phone-number":"phoneNumber","user-id":"userId","first-name":"firstName","last-name":"lastName",email:"email"},hue="zappway-embeds",yUe=cue(hue),vUe="https://cdn.jsdelivr.net/npm/@zappway/embeds@latest",_Ue=({name:e,widget:a,type:t})=>class extends HTMLElement{constructor(n){super();this.cssProvider=vUe+`/dist/${t}/index.css`;this.Component=n=>{let[r,s]=(0,Db.useState)(!1);this.setIsOpen=s,this.isOpen=r;let u=Object.entries(kUe).reduce((m,[g,f])=>{let k=this.getAttribute(g);return k&&(m[f]=k),m},{}),d=this.getAttribute("context"),p={};try{p=JSON.parse(this.getAttribute("interface"))}catch{}return(0,Cb.jsx)(Db.StrictMode,{children:(0,Cb.jsx)(e0,{value:this.cache,children:(0,Cb.jsx)(wM,{theme:gue({container:this.shadowRootElement,prefix:hue}),defaultMode:"light",colorSchemeNode:this.shadowRootElement,...yUe,children:(0,Cb.jsx)(jR,{sx:{background:"transparent"},children:Db.default.createElement(a,{...n,isOpen:r,onEnd:this.onEnd,initConfig:p,context:d,agentId:this.getAttribute("agent-id")||"",formId:this.getAttribute("form-id")||"",contact:u,styles:this.getAttribute("styles")?JSON.parse(this.getAttribute("styles")):{},onAgentLoaded:m=>{let g=m?.interfaceConfig?.customCSS;if(g){let f=document.createElement("style");f.innerHTML=g,this.shadowRootElement.appendChild(f)}}})})})})})};this.instanceId=n?.instanceId,this.onEnd=n?.onEnd;let r=this.attachShadow({mode:"open"}),s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("href","https://fonts.googleapis.com/css2?family=Poppins:wght@200..800&family=Inter:wght@100..900&display=swap");let u=document.createElement("link");u.setAttribute("rel","stylesheet"),u.setAttribute("type","text/css"),u.setAttribute("href",this.cssProvider);let d=document.createElement("style");this.shadowRootElement=document.createElement("div"),r.appendChild(s),r.appendChild(u),r.appendChild(d),r.appendChild(this.shadowRootElement),this.cache=uA({key:e,prepend:!0,container:d}),this.root=(0,fue.createRoot)(this.shadowRootElement)}destroy(){this.innerHTML="",this.instanceId&&(window[this.instanceId]=null)}open(){this.setIsOpen?.(!0)}close(){this.setIsOpen?.(!1)}toggle(){this.setIsOpen?.(!this.isOpen)}createNewConversation(){this.dispatchEvent(new Event("CREATE_NEW_CONVERSATION",{bubbles:!0,composed:!0}))}connectedCallback(){this.root.render((0,Cb.jsx)(this.Component,{isOpen:this.isOpen,onEnd:this.onEnd}))}},vC=_Ue;var vue=R(ae()),bue="zappway-chatbox-bubble",kue=vC({type:"chatbox",widget:e=>(0,vue.jsx)(yC,{...e,className:Kr("zappway-widget",e.className),children:aue}),name:bue});customElements.define(bue,kue);var yue=kue;var AUe=async e=>{if(typeof window<"u"&&!window?.ChatboxBubble){let a=document?.currentScript?.src,t=document?.currentScript?.id,o=e.agentId||t;!o&&a&&(o=new URL(a).searchParams.get("agentId")||t||e.agentId),W_(e);let i=new yue({instanceId:"ChatBoxBubble"});N_({element:i,...e}),window.ChatboxBubble=i,document?.body?.prepend(i)}return window?.ChatboxBubble},_ue=AUe;l();l();l();var Cu=R(ae()),TUe="https://app.zappway.ai/images/chatbubble-default-icon-sm.gif",wUe=e=>{let{query:a}=pC({id:e.agentId});return(0,Cu.jsxs)(et,{className:Kr(e.className),sx:{position:"relative",px:2,pt:8,pb:2,width:"100%",height:"100%",backdropFilter:"blur(10px)",background:`linear-gradient(
3208
+ `);try{z=new Worker(URL.createObjectURL(new Blob([de])))}catch(ne){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",ne),null}W(z)}return z}}(),f={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function k(z,F){return F?F(z):z}function b(z){return z!=null}function _(z,F,$){return k(z&&b(z[F])?z[F]:f[F],$)}function h(z){return z<0?0:Math.floor(z)}function v(z,F){return Math.floor(Math.random()*(F-z))+z}function y(z){return parseInt(z,16)}function I(z){return z.map(P)}function P(z){var F=String(z).replace(/[^0-9a-f]/gi,"");return F.length<6&&(F=F[0]+F[0]+F[1]+F[1]+F[2]+F[2]),{r:y(F.substring(0,2)),g:y(F.substring(2,4)),b:y(F.substring(4,6))}}function w(z){var F=_(z,"origin",Object);return F.x=_(F,"x",Number),F.y=_(F,"y",Number),F}function S(z){z.width=document.documentElement.clientWidth,z.height=document.documentElement.clientHeight}function x(z){var F=z.getBoundingClientRect();z.width=F.width,z.height=F.height}function D(z){var F=document.createElement("canvas");return F.style.position="fixed",F.style.top="0px",F.style.left="0px",F.style.pointerEvents="none",F.style.zIndex=z,F}function T(z,F,$,W,de,ne,ie,ee,Q){z.save(),z.translate(F,$),z.rotate(ne),z.scale(W,de),z.arc(0,0,1,ie,ee,Q),z.restore()}function N(z){var F=z.angle*(Math.PI/180),$=z.spread*(Math.PI/180);return{x:z.x,y:z.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:z.startVelocity*.5+Math.random()*z.startVelocity,angle2D:-F+(.5*$-Math.random()*$),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:z.color,shape:z.shape,tick:0,totalTicks:z.ticks,decay:z.decay,drift:z.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:z.gravity*3,ovalScalar:.6,scalar:z.scalar,flat:z.flat}}function M(z,F){F.x+=Math.cos(F.angle2D)*F.velocity+F.drift,F.y+=Math.sin(F.angle2D)*F.velocity+F.gravity,F.velocity*=F.decay,F.flat?(F.wobble=0,F.wobbleX=F.x+10*F.scalar,F.wobbleY=F.y+10*F.scalar,F.tiltSin=0,F.tiltCos=0,F.random=1):(F.wobble+=F.wobbleSpeed,F.wobbleX=F.x+10*F.scalar*Math.cos(F.wobble),F.wobbleY=F.y+10*F.scalar*Math.sin(F.wobble),F.tiltAngle+=.1,F.tiltSin=Math.sin(F.tiltAngle),F.tiltCos=Math.cos(F.tiltAngle),F.random=Math.random()+2);var $=F.tick++/F.totalTicks,W=F.x+F.random*F.tiltCos,de=F.y+F.random*F.tiltSin,ne=F.wobbleX+F.random*F.tiltCos,ie=F.wobbleY+F.random*F.tiltSin;if(z.fillStyle="rgba("+F.color.r+", "+F.color.g+", "+F.color.b+", "+(1-$)+")",z.beginPath(),r&&F.shape.type==="path"&&typeof F.shape.path=="string"&&Array.isArray(F.shape.matrix))z.fill(Z(F.shape.path,F.shape.matrix,F.x,F.y,Math.abs(ne-W)*.1,Math.abs(ie-de)*.1,Math.PI/10*F.wobble));else if(F.shape.type==="bitmap"){var ee=Math.PI/10*F.wobble,Q=Math.abs(ne-W)*.1,se=Math.abs(ie-de)*.1,fe=F.shape.bitmap.width*F.scalar,ye=F.shape.bitmap.height*F.scalar,be=new DOMMatrix([Math.cos(ee)*Q,Math.sin(ee)*Q,-Math.sin(ee)*se,Math.cos(ee)*se,F.x,F.y]);be.multiplySelf(new DOMMatrix(F.shape.matrix));var Te=z.createPattern(p.transform(F.shape.bitmap),"no-repeat");Te.setTransform(be),z.globalAlpha=1-$,z.fillStyle=Te,z.fillRect(F.x-fe/2,F.y-ye/2,fe,ye),z.globalAlpha=1}else if(F.shape==="circle")z.ellipse?z.ellipse(F.x,F.y,Math.abs(ne-W)*F.ovalScalar,Math.abs(ie-de)*F.ovalScalar,Math.PI/10*F.wobble,0,2*Math.PI):T(z,F.x,F.y,Math.abs(ne-W)*F.ovalScalar,Math.abs(ie-de)*F.ovalScalar,Math.PI/10*F.wobble,0,2*Math.PI);else if(F.shape==="star")for(var ve=Math.PI/2*3,Ne=4*F.scalar,he=8*F.scalar,Fe=F.x,Qe=F.y,la=5,ra=Math.PI/la;la--;)Fe=F.x+Math.cos(ve)*he,Qe=F.y+Math.sin(ve)*he,z.lineTo(Fe,Qe),ve+=ra,Fe=F.x+Math.cos(ve)*Ne,Qe=F.y+Math.sin(ve)*Ne,z.lineTo(Fe,Qe),ve+=ra;else z.moveTo(Math.floor(F.x),Math.floor(F.y)),z.lineTo(Math.floor(F.wobbleX),Math.floor(de)),z.lineTo(Math.floor(ne),Math.floor(ie)),z.lineTo(Math.floor(W),Math.floor(F.wobbleY));return z.closePath(),z.fill(),F.tick<F.totalTicks}function C(z,F,$,W,de){var ne=F.slice(),ie=z.getContext("2d"),ee,Q,se=d(function(fe){function ye(){ee=Q=null,ie.clearRect(0,0,W.width,W.height),p.clear(),de(),fe()}function be(){o&&!(W.width===i.width&&W.height===i.height)&&(W.width=z.width=i.width,W.height=z.height=i.height),!W.width&&!W.height&&($(z),W.width=z.width,W.height=z.height),ie.clearRect(0,0,W.width,W.height),ne=ne.filter(function(Te){return M(ie,Te)}),ne.length?ee=m.frame(be):ye()}ee=m.frame(be),Q=ye});return{addFettis:function(fe){return ne=ne.concat(fe),se},canvas:z,promise:se,reset:function(){ee&&m.cancel(ee),Q&&Q()}}}function G(z,F){var $=!z,W=!!_(F||{},"resize"),de=!1,ne=_(F,"disableForReducedMotion",Boolean),ie=n&&!!_(F||{},"useWorker"),ee=ie?g():null,Q=$?S:x,se=z&&ee?!!z.__confetti_initialized:!1,fe=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ye;function be(ve,Ne,he){for(var Fe=_(ve,"particleCount",h),Qe=_(ve,"angle",Number),la=_(ve,"spread",Number),ra=_(ve,"startVelocity",Number),Wa=_(ve,"decay",Number),U=_(ve,"gravity",Number),te=_(ve,"drift",Number),ue=_(ve,"colors",I),_e=_(ve,"ticks",Number),V=_(ve,"shapes"),J=_(ve,"scalar"),pe=!!_(ve,"flat"),Ae=w(ve),We=Fe,ua=[],Ce=z.width*Ae.x,Ee=z.height*Ae.y;We--;)ua.push(N({x:Ce,y:Ee,angle:Qe,spread:la,startVelocity:ra,color:ue[We%ue.length],shape:V[v(0,V.length)],ticks:_e,decay:Wa,gravity:U,drift:te,scalar:J,flat:pe}));return ye?ye.addFettis(ua):(ye=C(z,ua,Q,Ne,he),ye.promise)}function Te(ve){var Ne=ne||_(ve,"disableForReducedMotion",Boolean),he=_(ve,"zIndex",Number);if(Ne&&fe)return d(function(ra){ra()});$&&ye?z=ye.canvas:$&&!z&&(z=D(he),document.body.appendChild(z)),W&&!se&&Q(z);var Fe={width:z.width,height:z.height};ee&&!se&&ee.init(z),se=!0,ee&&(z.__confetti_initialized=!0);function Qe(){if(ee){var ra={getBoundingClientRect:function(){if(!$)return z.getBoundingClientRect()}};Q(ra),ee.postMessage({resize:{width:ra.width,height:ra.height}});return}Fe.width=Fe.height=null}function la(){ye=null,W&&(de=!1,a.removeEventListener("resize",Qe)),$&&z&&(document.body.contains(z)&&document.body.removeChild(z),z=null,se=!1)}return W&&!de&&(de=!0,a.addEventListener("resize",Qe,!1)),ee?ee.fire(ve,Fe,la):be(ve,Fe,la)}return Te.reset=function(){ee&&ee.reset(),ye&&ye.reset()},Te}var L;function j(){return L||(L=G(null,{useWorker:!0,resize:!0})),L}function Z(z,F,$,W,de,ne,ie){var ee=new Path2D(z),Q=new Path2D;Q.addPath(ee,new DOMMatrix(F));var se=new Path2D;return se.addPath(Q,new DOMMatrix([Math.cos(ie)*de,Math.sin(ie)*de,-Math.sin(ie)*ne,Math.cos(ie)*ne,$,W])),se}function H(z){if(!r)throw new Error("path confetti are not supported in this browser");var F,$;typeof z=="string"?F=z:(F=z.path,$=z.matrix);var W=new Path2D(F),de=document.createElement("canvas"),ne=de.getContext("2d");if(!$){for(var ie=1e3,ee=ie,Q=ie,se=0,fe=0,ye,be,Te=0;Te<ie;Te+=2)for(var ve=0;ve<ie;ve+=2)ne.isPointInPath(W,Te,ve,"nonzero")&&(ee=Math.min(ee,Te),Q=Math.min(Q,ve),se=Math.max(se,Te),fe=Math.max(fe,ve));ye=se-ee,be=fe-Q;var Ne=10,he=Math.min(Ne/ye,Ne/be);$=[he,0,0,he,-Math.round(ye/2+ee)*he,-Math.round(be/2+Q)*he]}return{type:"path",path:F,matrix:$}}function X(z){var F,$=1,W="#000000",de='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof z=="string"?F=z:(F=z.text,$="scalar"in z?z.scalar:$,de="fontFamily"in z?z.fontFamily:de,W="color"in z?z.color:W);var ne=10*$,ie=""+ne+"px "+de,ee=new OffscreenCanvas(ne,ne),Q=ee.getContext("2d");Q.font=ie;var se=Q.measureText(F),fe=Math.ceil(se.actualBoundingBoxRight+se.actualBoundingBoxLeft),ye=Math.ceil(se.actualBoundingBoxAscent+se.actualBoundingBoxDescent),be=2,Te=se.actualBoundingBoxLeft+be,ve=se.actualBoundingBoxAscent+be;fe+=be+be,ye+=be+be,ee=new OffscreenCanvas(fe,ye),Q=ee.getContext("2d"),Q.font=ie,Q.fillStyle=W,Q.fillText(F,Te,ve);var Ne=1/$;return{type:"bitmap",bitmap:ee.transferToImageBitmap(),matrix:[Ne,0,0,Ne,-fe*Ne/2,-ye*Ne/2]}}t.exports=function(){return j().apply(this,arguments)},t.exports.reset=function(){j().reset()},t.exports.create=G,t.exports.shapeFromPath=H,t.exports.shapeFromText=X})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),XB,!1);var tue=XB.exports,ujt=XB.exports.create;function pUe(e={}){return(t={})=>{tue({particleCount:450,startVelocity:70,spread:150,origin:{y:.5,x:.5},...e,...t})}}var oue=pUe;var jb=R(ae()),eO=async(e,a)=>await fetch(`${eue}/api/conversations/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:a})}),mUe=({sx:e})=>{let{conversationId:a,conversationStatus:t,refreshConversation:o,createNewConversation:i}=(0,bC.useContext)(hl),[n,r]=(0,bC.useState)(!1),{t:s}=ho("",{i18n:ri}),u=oue({zIndex:1e10}),d=async p=>{try{r(!0);let m=await eO(a,p);await o(),m.ok&&p==="RESOLVED"&&u()}catch{}finally{r(!1)}};return t!=="RESOLVED"?(0,jb.jsxs)(Mt,{size:"sm",variant:"outlined",color:t==="RESOLVED"?"danger":"success",startDecorator:n?(0,jb.jsx)(Yi,{}):t!=="RESOLVED"?(0,jb.jsx)(dle,{}):(0,jb.jsx)(lle,{}),sx:{whiteSpace:"nowrap",...e},onClick:t!=="RESOLVED"?()=>d("RESOLVED"):()=>d("UNRESOLVED"),children:[t==="RESOLVED"&&s("chatbubble:actions.mark_as_unresolved"),t!=="RESOLVED"&&s("chatbubble:actions.resolve")]}):null},iue=mUe;var aO=R(ae());function cUe({}){let{conversationId:e,conversationStatus:a,visitorEmail:t,refreshConversation:o}=(0,nue.useContext)(hl),{t:i}=ho(["chatbubble","_Chatbox_Actions_RequestHumanButton"],{i18n:ri}),[n,r]=cr({isHumanRequestLoading:!1}),s=d=>({HUMAN_REQUESTED:"warning",RESOLVED:"neutral",UNRESOLVED:"neutral"})[d]||"neutral",u=d=>({HUMAN_REQUESTED:i("_Chatbox_Actions_RequestHumanButton:human_requested"),RESOLVED:i("chatbubble:actions.request"),UNRESOLVED:i("chatbubble:actions.request")})[d]||"";return(0,aO.jsx)(Mt,{size:"sm",variant:"outlined",disabled:a==="HUMAN_REQUESTED",loading:n.isHumanRequestLoading,sx:{whiteSpace:"nowrap"},color:s(a),startDecorator:(0,aO.jsx)(rle,{}),onClick:async()=>{try{r({isHumanRequestLoading:!0}),await eO(e,"HUMAN_REQUESTED"),await o()}catch{}finally{r({isHumanRequestLoading:!1})}},"aria-label":i(a==="HUMAN_REQUESTED"?"_Chatbox_Actions_RequestHumanButton:human_requested":"chatbubble:actions.request"),children:u(a)})}var rue=cUe;var Ar=R(ae());function gUe({withHumanRequested:e,withMarkAsResolved:a,userActions:t=[]}){let{conversationId:o,conversationStatus:i,createNewConversation:n,refreshConversation:r}=(0,sue.useContext)(hl);return t.length>0||a||e?(0,Ar.jsx)(Ar.Fragment,{children:(0,Ar.jsxs)(De,{direction:"row",sx:{justifyContent:"center",flexWrap:"wrap",mx:"auto",gap:1},children:[o&&i&&(0,Ar.jsxs)(Ar.Fragment,{children:[a&&(0,Ar.jsx)(iue,{}),e&&(0,Ar.jsx)(rue,{})]}),t.map((u,d)=>(0,Ar.jsx)("a",{href:u?.url,target:"_blank",children:(0,Ar.jsx)(Mt,{size:"sm",variant:"outlined",color:"neutral",children:u.label})},d))]})}):null}var lue=gUe;var kC=R(ae()),uue="https://app.zappway.ai/images/chatbubble-default-icon-sm.gif",due={theme:"light",primaryColor:"#000000",isBgTransparent:!1},hUe="https://app.zappway.ai";function bUe(e){let{agentId:a,initConfig:t,onAgentLoaded:o,contact:i,context:n,isOpen:r,layout:s,className:u,styles:d,children:p}=e,[m,g]=Lo.default.useState(a),[f,k]=Lo.default.useState(),[b,_]=Lo.default.useState(t||due),[h,v]=Lo.default.useState(!1),{query:y}=pC({id:m}),I=$le({endpoint:`${hUe}/api/agents/${m}/query`,channel:"website",agentId:m,localStorageConversationIdKey:`iFrameConversationId-${m}`,contact:i,context:n}),{history:P,isLoadingConversation:w,hasMoreMessages:S,handleAbort:x,conversationAttachments:D,handleChatSubmit:T,handleLoadMoreMessages:N,handleEvalAnswer:M}=I;(0,Lo.useEffect)(()=>{t&&_(t)},[t]);let C=f?.organization?.subscriptions?.[0],L=!!C&&[ma.SubscriptionPlan.level_2,ma.SubscriptionPlan.level_3].includes(C?.plan)&&!!b?.isBrandingDisabled;(0,Lo.useEffect)(()=>{if(!(typeof window>"u"||m))try{let se=window?.location?.href?.match?.(/agents\/([a-zA-Z0-9]+)/)?.[1];se&&g(se)}catch(se){console.error(se)}},[m]),(0,Lo.useEffect)(()=>{y.data&&(k(y.data),o?.(y.data),_({...due,...y?.data?.interfaceConfig,...t}))},[y.data,o,t]);let{isStreaming:j,visitorId:Z,conversationId:H,visitorEmail:X,refreshConversation:z}=I,F=(0,Lo.useMemo)(()=>f?.tools?.find(se=>se?.type==="lead_capture")?.config??{},[f]),$=(0,Lo.useMemo)(()=>!!f?.tools?.find(se=>se?.type==="mark_as_resolved"),[f]),W=(0,Lo.useMemo)(()=>!!f?.tools?.find(se=>se?.type==="request_human"),[f]),de=!!X||!!h||!!i?.email||!!i?.phoneNumber,ne=!!F?.isRequired&&!de,ie=(0,Lo.useMemo)(()=>(0,kC.jsx)(JB,{agentId:m,visitorId:Z,conversationId:H,visitorEmail:X,isEmailEnabled:!0,isRequired:!1,onSubmitSucess:async()=>{z(),v(!0)},...F}),[m,Z,H,X,z,F]),ee=(0,Lo.useMemo)(()=>{let se=[];t?.initialMessages?.length?se=t.initialMessages:se=b?.initialMessages||[];let fe=se.map(ye=>ye?.trim?.()).filter(ye=>!!ye).map(ye=>({from:"agent",message:ye.trim(),approvals:[]}));return ne&&fe.push({id:"lead-form",from:"agent",component:ie,disableActions:!0}),fe},[t?.initialMessages,b?.initialMessages,ne,ie]),Q=(0,Lo.useMemo)(()=>{let se={id:"lead-form",from:"agent",component:ie,disableActions:!0};return P.reduce((fe,ye,be)=>{let Te=P?.length>=2&&be===1&&!(P?.length===2&&j);return[...fe,ye,...F&&!F?.isRequired&&!de&&Te?[se]:[]]},[])},[ie,P,F,de,j]);return(0,Lo.useEffect)(()=>{if(typeof window>"u")return;let se=()=>{I.createNewConversation()};return document.addEventListener("CREATE_NEW_CONVERSATION",se),()=>{document.removeEventListener("CREATE_NEW_CONVERSATION",se)}},[I.createNewConversation]),(0,kC.jsx)(hl.Provider,{value:{...I,history:Q},children:Lo.default.createElement(p||dC,{isOpen:r,isLoadingAgent:!f,agentId:m,agentIconUrl:f?.iconUrl||uue,layout:s,interfaceConfig:b,layoutClassName:u,containerSxProps:d,chatBoxProps:{isOpen:r,messages:Q,onSubmit:T,messageTemplates:b.messageTemplates,initialMessage:b.initialMessage,initialMessages:ee,agentIconUrl:f?.iconUrl||uue,agentIconStyle:t?.iconStyle,isLoadingConversation:w,hasMoreMessages:S,handleLoadMoreMessages:N,handleEvalAnswer:M,handleAbort:x,withSources:!!f?.includeSources,isAiEnabled:I.isAiEnabled,disableWatermark:L,isStreaming:j,readOnly:F?.isRequired&&!de,hideInternalSources:!0,withFileUpload:!0,conversationAttachments:D,actions:(0,kC.jsx)(lue,{withHumanRequested:W,withMarkAsResolved:$})}})})}var yC=bUe;l();l();l();var Db=R(K()),fue=R(mue());l();l();var oO={50:"#E0FFF9",100:"#1AFF9C",200:"#80FFD2",300:"#4CFFB8",400:"#1AFF9C",500:"#00E683",600:"#00B36B",700:"#008A56",800:"#006640",900:"#00331F",main:"#00E683",background:"#121212",light:"#4CFFB8",dark:"#008A56",contrastText:"#FFFFFF",hover:"#1AFF9C",focus:"#C69EFF",disabled:"#006640",formBorder:"#008A56",inputBorder:"#00B36B",paper:"#1E1E1E",tabsBg:"#1E1E1E",formBg:"#1D0A42",textContrastDark:"#FFFFFF"};var cue=(e="zappway")=>({modeStorageKey:e,colorSchemeStorageKey:`${e}-color-scheme`,attribute:`data-${e}`}),gue=(e={})=>yg({cssVarPrefix:e.prefix,fontFamily:{body:"Inter, sans-serif",display:"Poppins, sans-serif"},typography:{display1:{background:"linear-gradient(-30deg, var(--joy-palette-primary-900), var(--joy-palette-primary-400))",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",fontSize:"57px",lineHeight:"64px",letterSpacing:"-0.25px"},kbd:{background:"linear-gradient(to top, var(--joy-palette-background-level2), var(--joy-palette-background-surface))",border:"1px solid var(--joy-palette-neutral-outlinedBorder)",borderRadius:"var(--joy-radius-xs)",boxShadow:"var(--joy-shadow-sm)",padding:"0.125em 0.375em"}},fontSize:{xl7:"4.5rem",xl6:"3.75rem",xl5:"3rem",xs2:"0.625rem",xs3:"0.5rem"},fontWeight:{xs:200,xl2:800,xl3:900},components:{JoySelect:{defaultProps:{slotProps:{listbox:{container:e.container}}},styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyModal:{defaultProps:{container:e.container}},JoyCard:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyInput:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyTextarea:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyButton:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}},JoyIconButton:{styleOverrides:{root:a=>({borderRadius:a.theme.radius.sm})}}},colorSchemes:{dark:{palette:{primary:oO}},light:{palette:{primary:oO,neutral:{solidBg:"#000"}}}}});var Cb=R(ae()),kUe={"phone-number":"phoneNumber","user-id":"userId","first-name":"firstName","last-name":"lastName",email:"email"},hue="zappway-embeds",yUe=cue(hue),vUe="https://cdn.jsdelivr.net/npm/@zappway/embeds@latest",_Ue=({name:e,widget:a,type:t})=>class extends HTMLElement{constructor(n){super();this.cssProvider=vUe+`/dist/${t}/index.css`;this.Component=n=>{let[r,s]=(0,Db.useState)(!1);this.setIsOpen=s,this.isOpen=r;let u=Object.entries(kUe).reduce((m,[g,f])=>{let k=this.getAttribute(g);return k&&(m[f]=k),m},{}),d=this.getAttribute("context"),p={};try{p=JSON.parse(this.getAttribute("interface"))}catch{}return(0,Cb.jsx)(Db.StrictMode,{children:(0,Cb.jsx)(e0,{value:this.cache,children:(0,Cb.jsx)(wM,{theme:gue({container:this.shadowRootElement,prefix:hue}),defaultMode:"light",colorSchemeNode:this.shadowRootElement,...yUe,children:(0,Cb.jsx)(jR,{sx:{background:"transparent"},children:Db.default.createElement(a,{...n,isOpen:r,onEnd:this.onEnd,initConfig:p,context:d,agentId:this.getAttribute("agent-id")||"",formId:this.getAttribute("form-id")||"",contact:u,styles:this.getAttribute("styles")?JSON.parse(this.getAttribute("styles")):{},onAgentLoaded:m=>{let g=m?.interfaceConfig?.customCSS;if(g){let f=document.createElement("style");f.innerHTML=g,this.shadowRootElement.appendChild(f)}}})})})})})};this.instanceId=n?.instanceId,this.onEnd=n?.onEnd;let r=this.attachShadow({mode:"open"}),s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("href","https://fonts.googleapis.com/css2?family=Poppins:wght@200..800&family=Inter:wght@100..900&display=swap");let u=document.createElement("link");u.setAttribute("rel","stylesheet"),u.setAttribute("type","text/css"),u.setAttribute("href",this.cssProvider);let d=document.createElement("style");this.shadowRootElement=document.createElement("div"),r.appendChild(s),r.appendChild(u),r.appendChild(d),r.appendChild(this.shadowRootElement),this.cache=uA({key:e,prepend:!0,container:d}),this.root=(0,fue.createRoot)(this.shadowRootElement)}destroy(){this.innerHTML="",this.instanceId&&(window[this.instanceId]=null)}open(){this.setIsOpen?.(!0)}close(){this.setIsOpen?.(!1)}toggle(){this.setIsOpen?.(!this.isOpen)}createNewConversation(){this.dispatchEvent(new Event("CREATE_NEW_CONVERSATION",{bubbles:!0,composed:!0}))}connectedCallback(){this.root.render((0,Cb.jsx)(this.Component,{isOpen:this.isOpen,onEnd:this.onEnd}))}},vC=_Ue;var vue=R(ae()),bue="zappway-chatbox-bubble",kue=vC({type:"chatbox",widget:e=>(0,vue.jsx)(yC,{...e,className:Kr("zappway-widget",e.className),children:aue}),name:bue});customElements.define(bue,kue);var yue=kue;var AUe=async e=>{if(typeof window<"u"&&!window?.ChatboxBubble){let a=document?.currentScript?.src,t=document?.currentScript?.id,o=e.agentId||t;!o&&a&&(o=new URL(a).searchParams.get("agentId")||t||e.agentId),W_(e);let i=new yue({instanceId:"ChatBoxBubble"});N_({element:i,...e}),window.ChatboxBubble=i,document?.body?.prepend(i)}return window?.ChatboxBubble},_ue=AUe;l();l();l();var Cu=R(ae()),TUe="https://app.zappway.ai/images/chatbubble-default-icon-sm.gif",wUe=e=>{let{query:a}=pC({id:e.agentId});return(0,Cu.jsxs)(et,{className:Kr(e.className),sx:{position:"relative",px:2,pt:8,pb:2,width:"100%",height:"100%",backdropFilter:"blur(10px)",background:`linear-gradient(
3209
3209
  to bottom,
3210
3210
  rgba(255, 255, 255, 0.3),
3211
3211
  rgba(0, 154, 126, 0.3),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappway/embeds",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "ZappWay",
5
5
  "main": "dist/chatbox/index.js",
6
6
  "scripts": {