(()=>{"use strict";var __webpack_modules__={822:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Ay:()=>__WEBPACK_DEFAULT_EXPORT__,PW:()=>EMainLanguage,ju:()=>ESide,oj:()=>EDataRetrievalType,rb:()=>EEmailRetrievalMethod,wP:()=>ELimitBudgetAction});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(540),universal_cookie__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(580),socket_io_client__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(820),_extraUIcomponents_Add2Cart_Add2Cart__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(849),_extraUIcomponents_ShopifyWidgetCart__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(468),_extraUIcomponents_RecommendationCarousel_RecommendationCarousel__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(585),_extraUIcomponents_AddToCartWithSubscriptions_Add2CartWithSubscriptions__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(966),_types_MessageType__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(222),_extraUIcomponents_extraUIComponentTypes__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(68),EChatState=function(e){return e.close="close",e.open="open",e}(EChatState||{}),EVisibleMessageState=function(e){return e.visible="visible",e.invisible="invisible",e}(EVisibleMessageState||{}),ECreateClientState=function(e){return e.visible="visible",e.invisible="invisible",e}(ECreateClientState||{}),ECartState=function(e){return e.visible="visible",e.invisible="invisible",e}(ECartState||{}),ECreateClientBackendState=function(e){return e.send="send",e.loading="loading",e}(ECreateClientBackendState||{}),EConnectionType=function(e){return e.initial="initial",e.message="message",e.brute="brute",e}(EConnectionType||{});let EMainLanguage=function(e){return e.SPANISH="Spanish",e.ENGLISH="English",e.PORTUGUESE="Portuguese",e.FRENCH="French",e.GERMAN="German",e.ITALIAN="Italian",e}({}),ESide=function(e){return e.RIGHT="Right",e.LEFT="Left",e}({}),EEmailRetrievalMethod=function(e){return e.MANDATORY="Mandatory",e.SEMANTIC="Semantic",e.NONE="None",e}({}),EDataRetrievalType=function(e){return e.EMAIL="Email",e.PHONE="Phone",e.BOTH="Both",e.CUSTOM="Custom",e}({}),ELimitBudgetAction=function(e){return e.WIDGET_OFF="widget off",e.AI_OFF="ai off",e.DEFAULT_MESSAGE="default message",e.REDIRECT="redirect",e}({});const ShopifyWidget=_ref=>{let{domain,widget,isTest,isDashboard,isAdmin,isRelative,ipRegistryKey,globalSelectedBackend,chatProfileImage,curvyBorderImage,wizyLogoImage,noImageImage,shopifyRootPath,isRedirect,redirectionLink,shopifyCurrentPath,showNewMessage,hideNewMessage,setIsOpen}=_ref;const[messages,setMessages]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),[newMessage,setNewMessage]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""),[isNewMessage,setIsNewMessage]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[init,setInit]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({init:"",type:EConnectionType.initial}),[chatState,setChatState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isRelative?EChatState.open:EChatState.close),[chatStateVisibility,setChatStateVisibility]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isRelative?EChatState.open:EChatState.close),[visibleMessage,setVisibleMessage]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""),[visibleMessageState,setVisibleMessageState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(EVisibleMessageState.invisible),[visibleMessageOpacity,setVisibleMessageOpacity]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(EVisibleMessageState.invisible),[createClientState,setCreateClientState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(ECreateClientState.invisible),[cartState,setCartState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(ECartState.invisible),[createClientBackendState,setCreateClientBackendState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(ECreateClientBackendState.send),[isLoaded,setIsLoaded]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[socket,setSocket]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)((0,socket_io_client__WEBPACK_IMPORTED_MODULE_1__.io)(globalSelectedBackend+"/shopifywidget?domain="+domain+"&&path="+shopifyCurrentPath,{forceNew:!0,autoConnect:!1,transports:["websocket"],transportOptions:{websocket:{extraHeaders:{"Sec-WebSocket-Key":"dGhlIHNhbXBsZSBub25jZQ==","Sec-WebSocket-Version":"13","Sec-WebSocket-Protocol":"chat, superchat"}}}})),[email,setEmail]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""),[phone,setPhone]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(""),[emailError,setEmailError]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[phoneError,setPhoneError]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[subscriptionState,setSubscriptionState]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[cart,setCart]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),[isCartLoaded,setIsCartLoaded]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[isTyping,setIsTyping]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[isSendButtonActive,setIsSendButtonActive]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0),[isCreatingClient,setIsCreatingClient]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[clientCreated,setClientCreated]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[lastMessage,setLastMessage]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),socketRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(socket),cookies=new universal_cookie__WEBPACK_IMPORTED_MODULE_8__.A,ecommerceEmojis=["😊","🛍️","📦","💳","🤑","🛒","💬","👍","📢","📆","✉️","🔍","🎁","📱","💻","📋","🌟","💬","❓","💯"];(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{initializeUrlParameters()}),[]);const initializeUrlParameters=async()=>{const e=new URLSearchParams(window.location.search),t=e.get("wizyclient"),n=e.get("wizyopen"),a=e.get("wizyreferral");if(null!==t){createSaleOption(t),cookies.remove(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain,{path:"/"}),cookies.set(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain,t,{path:"/",maxAge:31536e3}),cookies.remove("WIZY_SUPERCLIENT_"+domain,{path:"/"});const e=await clientId2SuperClientId(t);e&&cookies.set("WIZY_SUPERCLIENT_"+domain,e,{path:"/",maxAge:31536e3})}if("true"===n&&handleToggleChat(),null!==a){createSaleOption(a);const e=cookies.get("WIZY_SUPERCLIENT_"+domain),t=cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain);if(void 0===t&&void 0===e){const e=await clientId2SuperClientId(a);e&&cookies.set("WIZY_SUPERCLIENT_"+domain,e,{path:"/",maxAge:31536e3})}else if(t){const n=await mergeSuperClientByClientId(a,t);e&&cookies.remove("WIZY_SUPERCLIENT_"+domain,{path:"/"}),n&&cookies.set("WIZY_SUPERCLIENT_"+domain,n,{path:"/",maxAge:31536e3})}else if(e){const t=e,n=await clientId2SuperClientId(a);if(n&&n!==t){const e=await mergeSuperClientBySuperClientId(n,t);e&&(cookies.remove("WIZY_SUPERCLIENT_"+domain,{path:"/"}),cookies.set("WIZY_SUPERCLIENT_"+domain,e,{path:"/",maxAge:31536e3}))}}}void 0!==cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)?(setClientCreated(!0),handleSocketConnection(EConnectionType.initial),setIsLoaded(!0)):getOutboundMessage(domain,shopifyCurrentPath)},handleSocketConnection=e=>{if(e===EConnectionType.initial||e===EConnectionType.message){if(socket)return socket.connect(),socket.on("connect",onConnect),socket.on("disconnect",onDisconnect),socket.on("newMessage",onMessageEvent),socket.on("typing",onTyping),socket.on("init",e===EConnectionType.initial?onInitInitial:onInitMessage),()=>{socket.off("connect",onConnect),socket.off("disconnect",onDisconnect),socket.off("newMessage",onMessageEvent),socket.off("typing",onTyping),socket.off("init",e===EConnectionType.initial?onInitInitial:onInitMessage),socket.disconnect()}}else if(e===EConnectionType.brute){const e=(0,socket_io_client__WEBPACK_IMPORTED_MODULE_1__.io)(globalSelectedBackend+"/shopifywidget?domain="+domain+"&&path="+shopifyCurrentPath,{forceNew:!0,autoConnect:!1,transports:["websocket"],transportOptions:{websocket:{extraHeaders:{"Sec-WebSocket-Key":"dGhlIHNhbXBsZSBub25jZQ==","Sec-WebSocket-Version":"13","Sec-WebSocket-Protocol":"chat, superchat"}}}});return e.connect(),e.on("connect",onConnect),e.on("disconnect",onDisconnect),e.on("newMessage",onMessageEvent),e.on("typing",onTyping),e.on("init",onInitBrute),setSocket(e),()=>{e.off("connect",onConnect),e.off("disconnect",onDisconnect),e.off("newMessage",onMessageEvent),e.off("typing",onTyping),e.off("init",onInitBrute),e.disconnect()}}};function onConnect(){}function onDisconnect(){}function onMessageEvent(e){setLastMessage(e)}function onTyping(e){setIsTyping(!0)}function onInitInitial(e){setInit({init:e,type:EConnectionType.initial})}function onInitMessage(e){setInit({init:e,type:EConnectionType.message})}function onInitBrute(e){setInit({init:e,type:EConnectionType.brute})}const getOutboundMessage=async(e,t)=>{try{var n=new Headers;n.append("Content-Type","application/json");var a=JSON.stringify({domain:e,path:t});const r=await fetch(globalSelectedBackend+"/shopifywidgetrest/outboundmessage",{method:"POST",headers:n,body:a,credentials:"include",redirect:"follow"});if(r.ok)setLastMessage(JSON.parse(await r.text())),setIsLoaded(!0);else{let e=await r.text();console.log(e)}}catch(e){console.log(e)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{isLoaded&&isNotBlank(widget.setup.customWidgetCode)&&eval("try { ".concat(widget.setup.customWidgetCode,' } catch (e) { console.log("Error in custom widget script") }'))}),[isLoaded]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{setIsCartLoaded(!0)}),[cart]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{null!==lastMessage&&""!==lastMessage.content&&(clientCreated?(setMessages((e=>[...e,{id:lastMessage.id?lastMessage.id:"",content:lastMessage.content,createDate:lastMessage.createDate,role:lastMessage.role,name:lastMessage.name,functionCall:lastMessage.functionCall,toolCalls:lastMessage.toolCalls,toolCallId:lastMessage.toolCallId,extraUIComponents:lastMessage.extraUIComponents?JSON.parse(lastMessage.extraUIComponents):null,sourceType:lastMessage.sourceType,sourceId:lastMessage.sourceId,hasMedia:lastMessage.hasMedia,status:lastMessage.status}])),setIsNewMessage(!0),setIsTyping(!1)):(setMessages([{id:lastMessage.id?lastMessage.id:"",content:lastMessage.content,createDate:lastMessage.createDate,role:lastMessage.role,name:lastMessage.name,functionCall:lastMessage.functionCall,toolCalls:lastMessage.toolCalls,toolCallId:lastMessage.toolCallId,extraUIComponents:lastMessage.extraUIComponents?JSON.parse(lastMessage.extraUIComponents):null,sourceType:lastMessage.sourceType,sourceId:lastMessage.sourceId,hasMedia:lastMessage.hasMedia,status:lastMessage.status}]),setIsNewMessage(!0),setIsTyping(!1)))}),[lastMessage]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{if(isLoaded)if(chatState!==EChatState.close||widget.setup.hideOutboundMessage){const e=cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain);chatState===EChatState.open&&void 0!==e&&socketEmit("clientRead",{clientId:cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain),shopDomain:domain})}else setVisibleMessage(messages.slice(-1)[0].content),setVisibleMessageState(EVisibleMessageState.visible),showNewMessage(),setTimeout((()=>{setVisibleMessageOpacity(EVisibleMessageState.visible)}),100),setTimeout((()=>{setVisibleMessageOpacity(EVisibleMessageState.invisible)}),5e3),setTimeout((()=>{setVisibleMessageState(EVisibleMessageState.invisible),hideNewMessage()}),5800)}),[isNewMessage]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{isLoaded&&(init.type===EConnectionType.message?handleMessageSend():updateClient(init.init))}),[init]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{socketRef.current=socket}),[socket]);const socketEmit=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3;return new Promise(((r,i)=>{const o=s=>{let l=!1;socketRef.current.emit(e,t,(e=>{l=!0,r()})),setTimeout((()=>{l||(so(s+1)),a)):(console.error("Emit failed after maximum retries."),i(new Error("Server did not respond after retries."))))}),3e3)};o(0)}))},clientId2SuperClientId=async e=>{try{var t=new Headers;t.append("Content-Type","application/json");const n=await fetch(globalSelectedBackend+"/superclients/clientid2superclientid/"+e,{method:"GET",headers:t,credentials:"include",redirect:"follow"});if(n.ok)return await n.text();{let e=await n.text();console.log(e)}}catch(e){console.log(e)}},mergeSuperClientByClientId=async(e,t)=>{try{var n=new Headers;n.append("Content-Type","application/json");var a=JSON.stringify({fromClientId:e,toClientId:t});const r=await fetch(globalSelectedBackend+"/superclients/mergebyclientids/",{method:"POST",headers:n,body:a,credentials:"include",redirect:"follow"});if(r.ok)return await r.text();{let e=await r.text();console.log(e)}}catch(e){console.log(e)}},mergeSuperClientBySuperClientId=async(e,t)=>{try{var n=new Headers;n.append("Content-Type","application/json");var a=JSON.stringify({fromSuperClientId:e,toSuperClientId:t});const r=await fetch(globalSelectedBackend+"/superclients/mergebysuperclientids/",{method:"POST",headers:n,body:a,credentials:"include",redirect:"follow"});if(r.ok)return await r.text();{let e=await r.text();console.log(e)}}catch(e){console.log(e)}},handleMessageSend=async()=>{if(socket.connected){if(!isCreatingClient)if(void 0!==cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)){if(""!==newMessage.replaceAll(" ","")){const e=newMessage;setMessages((t=>[...t,{content:e,createDate:(new Date).toLocaleDateString(),role:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user,name:null,functionCall:null,toolCalls:null,toolCallId:null,extraUIComponents:[],sourceType:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.rS.SHOPIFY_WIDGET,sourceId:null,hasMedia:!1,status:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.nH.SENT}])),setNewMessage(""),socketEmit("newMessage",{content:e,clientId:cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain),isTest,shopDomain:domain,path:shopifyCurrentPath})}}else if(clientCreated)setMessages((e=>[...e,{id:"",content:"We are sorry, but the widget has to be tested in your own web [page](https://"+domain+"). Enter now! It's already available!",createDate:messages[0].createDate,role:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.ai,name:"",functionCall:"",toolCalls:"",toolCallId:"",extraUIComponents:null,sourceType:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.rS.SHOPIFY_WIDGET,sourceId:null,hasMedia:!1,status:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.nH.SENT}])),setIsNewMessage(!0),setIsTyping(!1);else if("Mandatory"===widget.setup.emailRetrievalMethod)handleToogleCreateClient();else if(""!==newMessage.replaceAll(" ","")){const e=newMessage;setMessages((t=>[...t,{content:e,createDate:(new Date).toLocaleDateString(),role:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user,name:null,functionCall:null,toolCalls:null,toolCallId:null,extraUIComponents:[],sourceType:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.rS.SHOPIFY_WIDGET,sourceId:null,whatsAppMediaId:null,hasMedia:!1,status:_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.nH.SENT}])),setNewMessage(""),await createClientAuto(),socketEmit("newMessage",{content:e,clientId:cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain),isTest,shopDomain:domain,path:shopifyCurrentPath})}}else handleSocketConnection(EConnectionType.message)},handleToggleChat=()=>{if(isRedirect){const e=document.getElementById("WizybotShopifyWidget__data__div"),t=null==e?void 0:e.dataset.additionaltextredirectionlink;t?window.open(redirectionLink+t,"_blank"):window.open(redirectionLink,"_blank")}else if(chatState===EChatState.close){setChatState(EChatState.open),setChatStateVisibility(EChatState.open),setIsOpen(!0),setIsNewMessage(!1);if(void 0!==cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain))try{socketEmit("clientRead",{clientId:cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain),shopDomain:domain})}catch(e){}}else setChatState(EChatState.close),setTimeout((()=>{setIsOpen(!1),setChatStateVisibility(EChatState.close)}),800)},handleToogleCreateClient=()=>{createClientState===ECreateClientState.invisible?(setCreateClientState(ECreateClientState.visible),setIsNewMessage(!1),setIsSendButtonActive(!1)):(setIsSendButtonActive(!0),setCreateClientState(ECreateClientState.invisible))},handleToggleCartState=async()=>{cartState===ECartState.invisible?(getCart().then((()=>{setCartState(ECartState.visible)})),setIsSendButtonActive(!1)):(setIsSendButtonActive(!0),setCartState(ECartState.invisible))},addRandomNiceEmoji=()=>{const e=Math.floor(Math.random()*ecommerceEmojis.length),t=ecommerceEmojis[e];setNewMessage(newMessage+t)},getCart=async()=>{null!==shopifyRootPath?(setIsCartLoaded(!1),await fetch(shopifyRootPath+"cart.js",{method:"GET"}).then((e=>e.json())).then((e=>{console.log(e),setCart({totalPrice:e.total_price,currency:e.currency,items:e.items.map((e=>({id:e.id,quantity:e.quantity,productTitle:e.product_title,variantTitle:e.variant_title,linePrice:e.line_price,image:e.image,url:e.url})))})})).catch((e=>{console.error("Error:",e),setIsCartLoaded(!0)}))):(console.log("Not in shopify"),setIsCartLoaded(!0))},updateCart=async e=>{if(setIsCartLoaded(!1),null!==shopifyRootPath&&null!==e){const t=e.items.reduce(((e,t)=>({...e,[t.id]:t.quantity})),{});fetch(shopifyRootPath+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:t})}).then((e=>e.json())).then((e=>{setCart({totalPrice:e.total_price,currency:e.currency,items:e.items.map((e=>({id:e.id,quantity:e.quantity,productTitle:e.product_title,variantTitle:e.variant_title,linePrice:e.line_price,image:e.image,url:e.url})))})})).catch((e=>{console.error("Error:",e),setIsCartLoaded(!0)}))}else console.log("Not in shopify"),setIsCartLoaded(!0)},createSaleOption=async e=>{null===shopifyRootPath||isDashboard?console.log("not in shopify"):await fetch(shopifyRootPath+"cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{wizybot:!0},note:widget.setup.preventSaleNoteCreation?"":"Wizybot sale!"})}).then((async t=>{await fetch(shopifyRootPath+"cart.js",{method:"GET"}).then((e=>e.json())).then((async t=>{var n=JSON.stringify({cartId:t.token.split("?")[0]}),a=new Headers;a.append("Content-Type","application/json"),await fetch(globalSelectedBackend+"/sale/"+domain+"/"+e+"/createsale",{method:"POST",headers:a,body:n,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((e=>{})).catch((e=>{console.log("Error:",e)}))})).catch((e=>{console.error("Error:",e)}))})).catch((e=>{console.error("Error:",e)}))},createClient=async()=>{if(setIsCreatingClient(!0),void 0!==cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)||!email.includes("@")&&"Phone"!==widget.setup.dataRetrievalType||""===phone&&"Email"!==widget.setup.dataRetrievalType)setEmailError(!0),setPhoneError(!0),setIsCreatingClient(!1),setCreateClientBackendState(ECreateClientBackendState.send);else{setCreateClientBackendState(ECreateClientBackendState.loading);const n=JSON.parse(await getClientIpInfo());setEmailError(!1);const a=cookies.get("WIZY_SUPERCLIENT_"+domain);var e=new Headers;e.append("Content-Type","application/json");var t=JSON.stringify({firstName:"",lastName:"",email,phone,location:n.location.city+", "+n.location.country.name+" "+n.location.country.flag.emoji,computer:void 0===window.navigator.platform?"":window.navigator.platform,ipAddress:n.ip,lastMessageDate:messages[0].createDate,lastMessage:messages[0].content,subscriptionState,isShopRead:!1,isClientRead:!0,isAiEnabled:!0,websocketId:init.init,isTest,superClient:a?{id:a}:null});await fetch(globalSelectedBackend+"/clients/"+domain+(isDashboard?"/private":""),{method:"POST",headers:e,body:t,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((e=>{var t,n;null!==(t=e.superClient)&&void 0!==t&&t.id&&cookies.set("WIZY_SUPERCLIENT_"+domain,null===(n=e.superClient)||void 0===n?void 0:n.id,{path:"/",maxAge:31536e3});cookies.set(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain,e.id,{path:"/",maxAge:31536e3}),handleToogleCreateClient(),createSaleOption(e.id),setCreateClientBackendState(ECreateClientBackendState.send),setClientCreated(!0),setIsCreatingClient(!1),handleMessageSend()})).catch((e=>{console.log(e),setIsCreatingClient(!1)}))}},createClientAuto=async()=>{if(setIsCreatingClient(!0),void 0===cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)){setCreateClientBackendState(ECreateClientBackendState.loading);const n=JSON.parse(await getClientIpInfo());setEmailError(!1);const a=cookies.get("WIZY_SUPERCLIENT_"+domain);var e=new Headers;e.append("Content-Type","application/json");var t=JSON.stringify({firstName:"",lastName:"",email:"",phone:"",location:n.location.city+", "+n.location.country.name+" "+n.location.country.flag.emoji,computer:void 0===window.navigator.platform?"":window.navigator.platform,ipAddress:n.ip,lastMessageDate:messages[0].createDate,lastMessage:messages[0].content,subscriptionState,isShopRead:!1,isClientRead:!0,isAiEnabled:!0,isTest,websocketId:init.init,superClient:a?{id:a}:null});await fetch(globalSelectedBackend+"/clients/"+domain+(isDashboard?"/private":""),{method:"POST",headers:e,body:t,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((e=>{var t;null!==(t=e.superClient)&&void 0!==t&&t.id&&cookies.set("WIZY_SUPERCLIENT_"+domain,e.superClient.id,{path:"/",maxAge:31536e3}),cookies.set(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain,e.id,{path:"/",maxAge:31536e3}),createSaleOption(e.id),setCreateClientBackendState(ECreateClientBackendState.send),setClientCreated(!0),setIsCreatingClient(!1)})).catch((e=>{console.log(e),setIsCreatingClient(!1)}))}else setEmailError(!0),setPhoneError(!0),setIsCreatingClient(!1),setCreateClientBackendState(ECreateClientBackendState.send)},getClientIpInfo=async()=>{let e="";return await fetch("https://api.ipregistry.co/?key="+ipRegistryKey,{method:"GET",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((t=>{e=JSON.stringify(t)})).catch((e=>{console.log(e)})),e},updateClient=async e=>{if(void 0!==cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)){var t=new Headers;t.append("Content-Type","application/json");var n=JSON.stringify({websocketId:e});await fetch(globalSelectedBackend+"/clients/"+cookies.get(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)+"/websocketid",{method:"PATCH",headers:t,body:n,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((e=>{e.messages.length>0&&0===messages.length&&(setMessages([]),e.messages.sort(((e,t)=>Date.parse(e.createDate)-Date.parse(t.createDate))).filter((e=>!(e.role!==_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.ai&&e.role!==_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.assistant&&e.role!==_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user||!isNotBlank(e.content)))).forEach((e=>{setMessages((t=>[...t,{id:e.id,content:e.content,createDate:e.createDate,role:e.role,name:e.name,functionCall:e.functionCall,toolCalls:e.toolCalls,toolCallId:e.toolCallId,extraUIComponents:e.extraUIComponents?JSON.parse(e.extraUIComponents):null,sourceType:e.sourceType,sourceId:e.sourceId,hasMedia:e.hasMedia,status:e.status}]))})),setIsNewMessage(!e.isClientRead))})).catch((e=>{console.log(e),cookies.remove(isAdmin?"WIZY_CLIENT_ADMIN_"+domain:"WIZY_CLIENT_"+domain)}))}},convertToHTMLLink=e=>{const t=e.replace(/\[([^[\]]+)\]\(((https?|mailto):\/\/\S+|mailto:\S+)\)/g,((e,t,n)=>'').concat(t,""))).replace(/\*\*([^\*]+)\*\*/g,((e,t)=>"".concat(t,""))).replace(/\n\s*\n/g,"\n");return react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{dangerouslySetInnerHTML:{__html:t},style:{whiteSpace:"pre-line"}})},isNotBlank=e=>null!=e&&""!==e;return isLoaded?react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__open__button__outter",style:{right:widget.setup.side===ESide.RIGHT?"0px":"calc(100% - 80px)",visibility:chatStateVisibility===EChatState.close?"visible":"hidden",opacity:chatStateVisibility===EChatState.close?"1":"0"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__open__button__inner",style:{background:"linear-gradient(135deg, "+widget.setup.primaryColor+" 0%, "+widget.setup.secondaryColor+" 100%)"},onClick:()=>{chatState===EChatState.close?handleToggleChat():handleMessageSend()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__open__button__notification rise-shake",style:{opacity:chatStateVisibility===EChatState.close&&isNewMessage?"1":"0",display:widget.setup.hideNotificationSign?"none":"block"}},"!"),isRedirect&&(redirectionLink.includes("wa")||redirectionLink.includes("whatsapp"))?react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 50 50",width:"50",height:"50",fill:"none",className:"WizybotShopifyWidget__open__button__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M25,2C12.318,2,2,12.318,2,25c0,3.96,1.023,7.854,2.963,11.29L2.037,46.73c-0.096,0.343-0.003,0.711,0.245,0.966 C2.473,47.893,2.733,48,3,48c0.08,0,0.161-0.01,0.24-0.029l10.896-2.699C17.463,47.058,21.21,48,25,48c12.682,0,23-10.318,23-23 S37.682,2,25,2z M36.57,33.116c-0.492,1.362-2.852,2.605-3.986,2.772c-1.018,0.149-2.306,0.213-3.72-0.231 c-0.857-0.27-1.957-0.628-3.366-1.229c-5.923-2.526-9.791-8.415-10.087-8.804C15.116,25.235,13,22.463,13,19.594 s1.525-4.28,2.067-4.864c0.542-0.584,1.181-0.73,1.575-0.73s0.787,0.005,1.132,0.021c0.363,0.018,0.85-0.137,1.329,1.001 c0.492,1.168,1.673,4.037,1.819,4.33c0.148,0.292,0.246,0.633,0.05,1.022c-0.196,0.389-0.294,0.632-0.59,0.973 s-0.62,0.76-0.886,1.022c-0.296,0.291-0.603,0.606-0.259,1.19c0.344,0.584,1.529,2.493,3.285,4.039 c2.255,1.986,4.158,2.602,4.748,2.894c0.59,0.292,0.935,0.243,1.279-0.146c0.344-0.39,1.476-1.703,1.869-2.286 s0.787-0.487,1.329-0.292c0.542,0.194,3.445,1.604,4.035,1.896c0.59,0.292,0.984,0.438,1.132,0.681 C37.062,30.587,37.062,31.755,36.57,33.116z",fill:widget.setup.fontColor})):isRedirect&&redirectionLink.includes("m.me")?react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 50 50",width:"50",height:"50",fill:"none",className:"WizybotShopifyWidget__open__button__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M41,4H9C6.24,4,4,6.24,4,9v32c0,2.76,2.24,5,5,5h32c2.76,0,5-2.24,5-5V9C46,6.24,43.76,4,41,4z M37,19h-2c-2.14,0-3,0.5-3,2 v3h5l-1,5h-4v15h-5V29h-4v-5h4v-3c0-4,2-7,6-7c2.9,0,4,1,4,1V19z",fill:widget.setup.fontColor})):react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__open__button__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M2 5C2 3.89543 2.89543 3 4 3H11C12.1046 3 13 3.89543 13 5V9C13 10.1046 12.1046 11 11 11H9L6 14V11H4C2.89543 11 2 10.1046 2 9V5Z",fill:widget.setup.fontColor}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M15 7V9C15 11.2091 13.2091 13 11 13H9.82843L8.06173 14.7667C8.34154 14.9156 8.66091 15 9 15H11L14 18V15H16C17.1046 15 18 14.1046 18 13V9C18 7.89543 17.1046 7 16 7H15Z",fill:widget.setup.fontColor}))),visibleMessageState===EVisibleMessageState.visible?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__new__visible__message__outter",style:{opacity:visibleMessageOpacity===EVisibleMessageState.visible?"1":"0",left:"Left"===widget.setup.side?"-100%":"0",transform:"Left"===widget.setup.side?"translate(130px, -100%)":"translate(-110%, -100%)"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WisybotShopifyWidget__new__visible__message__inner"},visibleMessage)):""),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__outter__outter",style:{position:"absolute",visibility:chatStateVisibility===EChatState.close?"hidden":"visible",opacity:chatStateVisibility===EChatState.close?"0":"1"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:chatState===EChatState.open?"Left"===widget.setup.side?"WizybotShopifyWidget__outter__open__left":"WizybotShopifyWidget__outter__open__right":"WizybotShopifyWidget__outter__close"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header",style:{background:"linear-gradient(135deg, "+widget.setup.primaryColor+" 0%, "+widget.setup.secondaryColor+" 100%)"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__inner"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__inner__inner"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__picture__name"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("img",{src:""===widget.setup.image?chatProfileImage:widget.setup.image,alt:"wizy_chat_profile",className:"WizybotShopifyWidget__header__profile__image"}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__name__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__chat__with",style:{color:widget.setup.fontColor}},"English"===widget.setup.mainLanguage?"Chat with":"Spanish"===widget.setup.mainLanguage?"Habla con":"French"===widget.setup.mainLanguage?"Parler avec":"Portuguese"===widget.setup.mainLanguage?"Conversar com":"German"===widget.setup.mainLanguage?"Chatten Sie mit":"Italian"===widget.setup.mainLanguage?"Chat con":"Chat with"),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__agent__name",style:{color:widget.setup.fontColor}}," ",widget.setup.agentName," "))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__header__close__arrow__outter"},createClientState===ECreateClientState.visible?react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__header__options__dots__image",onClick:()=>{handleToogleCreateClient()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M2 5C2 3.89543 2.89543 3 4 3H11C12.1046 3 13 3.89543 13 5V9C13 10.1046 12.1046 11 11 11H9L6 14V11H4C2.89543 11 2 10.1046 2 9V5Z",fill:widget.setup.fontColor}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M15 7V9C15 11.2091 13.2091 13 11 13H9.82843L8.06173 14.7667C8.34154 14.9156 8.66091 15 9 15H11L14 18V15H16C17.1046 15 18 14.1046 18 13V9C18 7.89543 17.1046 7 16 7H15Z",fill:widget.setup.fontColor})):cartState===ECartState.visible?react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__header__options__dots__image",onClick:()=>{handleToggleCartState()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M2 5C2 3.89543 2.89543 3 4 3H11C12.1046 3 13 3.89543 13 5V9C13 10.1046 12.1046 11 11 11H9L6 14V11H4C2.89543 11 2 10.1046 2 9V5Z",fill:widget.setup.fontColor}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M15 7V9C15 11.2091 13.2091 13 11 13H9.82843L8.06173 14.7667C8.34154 14.9156 8.66091 15 9 15H11L14 18V15H16C17.1046 15 18 14.1046 18 13V9C18 7.89543 17.1046 7 16 7H15Z",fill:widget.setup.fontColor})):react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:"WizybotShopifyWidget__header__options__dots__image",xmlns:"http://www.w3.org/2000/svg",onClick:()=>{handleToggleCartState()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M3 1C2.44772 1 2 1.44772 2 2C2 2.55228 2.44772 3 3 3H4.21922L4.52478 4.22224C4.52799 4.23637 4.5315 4.25039 4.5353 4.26429L5.89253 9.69321L4.99995 10.5858C3.74002 11.8457 4.63235 14 6.41416 14H15C15.5522 14 16 13.5523 16 13C16 12.4477 15.5522 12 15 12L6.41417 12L7.41416 11H14C14.3788 11 14.725 10.786 14.8944 10.4472L17.8944 4.44721C18.0494 4.13723 18.0329 3.76909 17.8507 3.47427C17.6684 3.17945 17.3466 3 17 3H6.28078L5.97014 1.75746C5.85885 1.3123 5.45887 1 5 1H3Z",fill:widget.setup.fontColor}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M16 16.5C16 17.3284 15.3284 18 14.5 18C13.6716 18 13 17.3284 13 16.5C13 15.6716 13.6716 15 14.5 15C15.3284 15 16 15.6716 16 16.5Z",fill:widget.setup.fontColor}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M6.5 18C7.32843 18 8 17.3284 8 16.5C8 15.6716 7.32843 15 6.5 15C5.67157 15 5 15.6716 5 16.5C5 17.3284 5.67157 18 6.5 18Z",fill:widget.setup.fontColor})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"25",height:"25",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__header__close__arrow__image",onClick:()=>{isRelative||handleToggleChat()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289L10 10.5858L13.2929 7.29289C13.6834 6.90237 14.3166 6.90237 14.7071 7.29289C15.0976 7.68342 15.0976 8.31658 14.7071 8.70711L10.7071 12.7071C10.3166 13.0976 9.68342 13.0976 9.29289 12.7071L5.29289 8.70711C4.90237 8.31658 4.90237 7.68342 5.29289 7.29289Z",fill:widget.setup.fontColor}))))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__online__phrase__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__online__dot__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__online__dot__inner"})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__online__phrase",style:{color:widget.setup.fontColor}},widget.setup.onlinePhrase)),react__WEBPACK_IMPORTED_MODULE_0__.createElement("img",{src:curvyBorderImage,alt:"wizy_curvy_border",className:"WizybotShopifyWidget__headder__wave"})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:createClientState===ECreateClientState.invisible?"WizybotShopifyWidget__email__requirement__outter__close":"WizybotShopifyWidget__email__requirement__outter__open"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__requirement__inner"},"Email"===widget.setup.dataRetrievalType||"Both"===widget.setup.dataRetrievalType?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__title"},"Email"),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__2__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("input",{type:"text",className:"WizybotShopifyWidget__email__input__2",value:email,onChange:e=>{const{value:t}=e.currentTarget;setEmail(t)},style:{border:emailError?"1px solid #ff3e3e":""},onKeyDown:e=>{"Enter"===e.key&&(createClientBackendState!==ECreateClientBackendState.send||isCreatingClient||createClient())}})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__prompt__1"},"Eg: jhon.doe@email.com")):"","Phone"===widget.setup.dataRetrievalType||"Both"===widget.setup.dataRetrievalType?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__title"},"English"===widget.setup.mainLanguage?"Phone":"Spanish"===widget.setup.mainLanguage?"Teléfono":"French"===widget.setup.mainLanguage?"Téléphone":"Portuguese"===widget.setup.mainLanguage?"Telefone":"German"===widget.setup.mainLanguage?"Telefon":"Italian"===widget.setup.mainLanguage?"Telefono":"Phone"),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__2__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("input",{type:"text",className:"WizybotShopifyWidget__email__input__2",value:phone,onChange:e=>{const{value:t}=e.currentTarget;setPhone(t)},style:{border:phoneError?"1px solid #ff3e3e":""},onKeyDown:e=>{"Enter"===e.key&&(createClientBackendState!==ECreateClientBackendState.send||isCreatingClient||createClient())}})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__prompt__1"},"Eg: +573215484843")):"",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__checkbox__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("input",{type:"checkbox",name:"isNotCommercialized",checked:subscriptionState,onChange:()=>{setSubscriptionState(!subscriptionState)}}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__input__checkbox__text"},"English"===widget.setup.mainLanguage?"Sign up for our newsletter":"Spanish"===widget.setup.mainLanguage?"Suscríbete a nuestro boletín":"French"===widget.setup.mainLanguage?"Inscrivez-vous à notre newsletter":"Portuguese"===widget.setup.mainLanguage?"Assine a nossa newsletter":"German"===widget.setup.mainLanguage?"Melden Sie sich für unseren Newsletter an":"Italian"===widget.setup.mainLanguage?"Iscriviti alla nostra newsletter":"Sign up for our newsletter")),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__email__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__email__button",style:{width:"100%",background:"linear-gradient(135deg, "+widget.setup.primaryColor+" 0%, "+widget.setup.secondaryColor+" 100%)",color:widget.setup.fontColor},onClick:()=>{createClientBackendState!==ECreateClientBackendState.send||isCreatingClient||createClient()}},createClientBackendState===ECreateClientBackendState.send?"English"===widget.setup.mainLanguage?"Send":"Spanish"===widget.setup.mainLanguage?"Enviar":"French"===widget.setup.mainLanguage?"Envoyer":"Portuguese"===widget.setup.mainLanguage?"Enviar":"German"===widget.setup.mainLanguage?"Schicken":"Italian"===widget.setup.mainLanguage?"Inviare":"Send":"English"===widget.setup.mainLanguage?"Loading...":"Spanish"===widget.setup.mainLanguage?"Cargando...":"French"===widget.setup.mainLanguage?"Chargement...":"Portuguese"===widget.setup.mainLanguage?"Carregando...":"German"===widget.setup.mainLanguage?"Wird geladen...":"Italian"===widget.setup.mainLanguage?"Caricamento...":"Loading...")))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:cartState===ECartState.invisible?"WizybotShopifyWidget__cart__outter__close":"WizybotShopifyWidget__cart__outter__open"},null!==cart&&isCartLoaded?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_extraUIcomponents_ShopifyWidgetCart__WEBPACK_IMPORTED_MODULE_3__.A,{cart,updateCart,language:widget.setup.mainLanguage,agentName:widget.setup.agentName,closeCart:handleToggleCartState}):isCartLoaded?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__products"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__no__products"},"English"===widget.setup.mainLanguage?"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?":"Spanish"===widget.setup.mainLanguage?"¡Hola! Parece que no has añadido nada a tu carrito, ¿por qué no nos pides algunas recomendaciones?":"French"===widget.setup.mainLanguage?"Bonjour! Il semble que vous n'avez rien ajouté à votre panier, pourquoi ne pas nous demander des recommandations?":"Portuguese"===widget.setup.mainLanguage?"Olá! Parece que você não adicionou nada ao seu carrinho, por que não nos pede algumas recomendações?":"German"===widget.setup.mainLanguage?"Hallo! Es scheint, dass Sie nichts in Ihren Warenkorb gelegt haben. Warum fragen Sie uns nicht nach einigen Empfehlungen?":"Italian"===widget.setup.mainLanguage?"Ciao! Sembra che tu non abbia aggiunto nulla al carrello, perché non ci chiedi qualche consiglio?":"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__no__products__button",style:{width:"100%"},onClick:handleToggleCartState},"English"===widget.setup.mainLanguage?"Chat with":"Spanish"===widget.setup.mainLanguage?"Habla con":"French"===widget.setup.mainLanguage?"Parler avec":"Portuguese"===widget.setup.mainLanguage?"Conversar com":"German"===widget.setup.mainLanguage?"Chatten Sie mit":"Italian"===widget.setup.mainLanguage?"Chat con":"Chat with"," ",widget.setup.agentName)))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__checkout"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__estimated"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated"},"English"===widget.setup.mainLanguage?"Estimated total":"Spanish"===widget.setup.mainLanguage?"Total estimado":"French"===widget.setup.mainLanguage?"Total estimé":"Portuguese"===widget.setup.mainLanguage?"Total estimado":"German"===widget.setup.mainLanguage?"Geschätzte Gesamtsumme":"Italian"===widget.setup.mainLanguage?"Totale stimato":"Estimated total")," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__price"},"$0.00")),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("a",{href:"/cart",target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__button",style:{width:"100%"}},"English"===widget.setup.mainLanguage?"Pay":"Spanish"===widget.setup.mainLanguage?"Pagar":"French"===widget.setup.mainLanguage?"Payer":"Portuguese"===widget.setup.mainLanguage?"Pagar":"German"===widget.setup.mainLanguage?"Bezahlen":"Italian"===widget.setup.mainLanguage?"Pagare":"Pay")))))):react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__products"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__no__products",style:{width:"fit-content"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"loader"}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__checkout"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__estimated"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated"},"English"===widget.setup.mainLanguage?"Estimated total":"Spanish"===widget.setup.mainLanguage?"Total estimado":"French"===widget.setup.mainLanguage?"Total estimé":"Portuguese"===widget.setup.mainLanguage?"Total estimado":"German"===widget.setup.mainLanguage?"Geschätzte Gesamtsumme":"Italian"===widget.setup.mainLanguage?"Totale stimato":"Estimated total")," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__price"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"loader",style:{position:"absolute",transform:"translate(-100%, -50%)",left:"100%",top:"50%"}}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("a",{href:"/cart",target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__button",style:{width:"100%"}},"English"===widget.setup.mainLanguage?"Pay":"Spanish"===widget.setup.mainLanguage?"Pagar":"French"===widget.setup.mainLanguage?"Payer":"Portuguese"===widget.setup.mainLanguage?"Pagar":"German"===widget.setup.mainLanguage?"Bezahlen":"Italian"===widget.setup.mainLanguage?"Pagare":"Pay"))))))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__inner"},messages.map(((e,t)=>react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{style:{width:"100%"},key:t},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__message__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__message__inner",style:{marginLeft:e.role===_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user?"auto":"",background:e.role===_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user?"linear-gradient(135deg, "+widget.setup.primaryColor+" 0%, "+widget.setup.secondaryColor+" 100%)":"",color:e.role===_types_MessageType__WEBPACK_IMPORTED_MODULE_6__.PG.user?widget.setup.fontColor:"black"}},convertToHTMLLink(e.content))),e.extraUIComponents&&e.extraUIComponents.length>0?e.extraUIComponents.map(((t,n)=>t.type===_extraUIcomponents_extraUIComponentTypes__WEBPACK_IMPORTED_MODULE_7__.q.ADD_TO_CART?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_extraUIcomponents_Add2Cart_Add2Cart__WEBPACK_IMPORTED_MODULE_2__.A,{content:t.content,extraUIComponentIndex:n,globalSelectedBackend,domain,shopifyRootPath,messageId:e.id?e.id:"",language:widget.setup.mainLanguage,openCart:handleToggleCartState}):t.type===_extraUIcomponents_extraUIComponentTypes__WEBPACK_IMPORTED_MODULE_7__.q.ADD_TO_CART_WITH_SUBSCRIPTIONS?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_extraUIcomponents_AddToCartWithSubscriptions_Add2CartWithSubscriptions__WEBPACK_IMPORTED_MODULE_5__.A,{content:t.content,extraUIComponentIndex:n,globalSelectedBackend,domain,shopifyRootPath,messageId:e.id?e.id:"",language:widget.setup.mainLanguage,noImageImage,openCart:handleToggleCartState}):t.type===_extraUIcomponents_extraUIComponentTypes__WEBPACK_IMPORTED_MODULE_7__.q.RECOMMENDATION_CAROUSEL?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_extraUIcomponents_RecommendationCarousel_RecommendationCarousel__WEBPACK_IMPORTED_MODULE_4__.A,{content:t.content,language:widget.setup.mainLanguage}):react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null))):react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null)))),isTyping?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__message__outter",key:"LoadingDots"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__message__inner",style:{color:"black"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"loader"}))):"")),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__input__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__send__button__outter",style:{background:"linear-gradient(135deg, "+widget.setup.primaryColor+" 0%, "+widget.setup.secondaryColor+" 100%)",opacity:isSendButtonActive?"1":"0",visibility:isSendButtonActive?"visible":"hidden"},onClick:()=>{chatState===EChatState.close?handleToggleChat():handleMessageSend()}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__open__button__image",style:{transform:"scale(1) translate(-50%, -50%)"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M17.4472 9.10556C17.786 9.27495 18 9.62122 18 9.99999C18 10.3788 17.786 10.725 17.4472 10.8944L3.44721 17.8944C3.09251 18.0718 2.66653 18.0228 2.36136 17.7695C2.0562 17.5162 1.92953 17.1066 2.03848 16.7253L3.46704 11.7253C3.5897 11.296 3.98209 11 4.42857 11L9 11C9.55229 11 10 10.5523 10 10C10 9.44771 9.55229 9 9 9H4.42857C3.98209 9 3.58971 8.70402 3.46705 8.27472L2.03848 3.27471C1.92953 2.8934 2.0562 2.48374 2.36136 2.23048C2.66653 1.97722 3.09251 1.92821 3.44721 2.10556L17.4472 9.10556Z",fill:widget.setup.fontColor}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__input__inner"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__chat__input__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("input",{name:"message",value:newMessage,type:"text",className:"WizybotShopifyWidget__chat__input",placeholder:"English"===widget.setup.mainLanguage?"Enter your message...":"Spanish"===widget.setup.mainLanguage?"Ingrese su mensaje..":"French"===widget.setup.mainLanguage?"Entrez votre message...":"Portuguese"===widget.setup.mainLanguage?"Digite sua mensagem...":"German"===widget.setup.mainLanguage?"Geben Sie eine Nachricht ein...":"Italian"===widget.setup.mainLanguage?"Inserisci il tuo messaggio...":"Enter your message...",onChange:e=>{setNewMessage(e.currentTarget.value)},onKeyDown:e=>{"Enter"===e.key&&handleMessageSend()}})))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__emojis__propaganda__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__emojis__propaganda__inner"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__emojis__outter",onClick:addRandomNiceEmoji},react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{id:"ic_emojiSwitch",fill:"#000000",height:"20",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",className:"WizybotShopifyWidget__emojis__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__propaganda__outter",style:{visibility:widget.setup.hideWizybotBanner?"hidden":"visible"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__propaganda__text"},"POWERED BY"),react__WEBPACK_IMPORTED_MODULE_0__.createElement("a",{href:"https://apps.shopify.com/wizybot",target:"_blank",rel:"noreferrer",style:{textDecoration:"none"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__propaganda__logo__outter"}," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("img",{src:wizyLogoImage,alt:"wizy_logo_blue",className:"WizybotShopifyWidget__propaganda__logo__image"})," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__propaganda__logo__text"},"Wizybot"))))))))):react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null)},__WEBPACK_DEFAULT_EXPORT__=ShopifyWidget},849:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(540),r=n(68);const i=e=>{const[t,n]=(0,a.useState)(e.content.options),[i,o]=(0,a.useState)(e.content.infoArray),[s,l]=(0,a.useState)((e=>{const t=[];for(let n=0;n{const n=[];let a=e;for(let e=0;ee*t)),i=Math.floor(a/r);n.push(i),a-=r*i}return n})(i.flat(t.length).findIndex((e=>null!==e)),t);return n})(e.content.options)),[u,c]=(0,a.useState)(1),[d,_]=(0,a.useState)(0),[p,f]=(0,a.useState)(e.content.stateAction),[h,g]=(0,a.useState)(e.content.stateSelection),m=(e=>{const t=[];for(let n=0;n{C()}),[s]);const y=(e,n)=>{let a=i;for(let t=0;tnull!==e))&&r.push(e)}else null!==a[e]&&r.push(e);const o=[];return t[e].values.map(((e,t)=>{r.includes(t)&&o.push({name:e,index:t})})),o},E=async e=>{const{name:t,value:n}=e.currentTarget;let a=s.map(((e,a)=>a===parseInt(t)?parseInt(n):e));a=v(a,parseInt(t)),l(a)},v=(e,t)=>{for(let n=t+1;ne.index));t.includes(e[n])||(e[n]=t[0])}return e},b=(e,t)=>{if(1===t.length)return e[t[0]];{const[n,...a]=t;return b(e[n],a)}},C=()=>{const e=b(i,s);_(e.quantityAvailable)},S=e=>{c("increase"===e?u===d?d:u+1:1===u?1:u-1)},w=async t=>{var n=new Headers;n.append("Content-Type","application/json");const a={type:r.q.ADD_TO_CART,content:e.content};a.content.stateAction=t,a.content.stateSelection={selectedOptionValues:s,selectedQuantity:u};var i=JSON.stringify({stringifiedExtraUIComponent:JSON.stringify(a),extraUIComponentIndex:e.extraUIComponentIndex});await fetch(e.globalSelectedBackend+"/shopifywidgetrest/extrauicomponent/"+e.messageId,{method:"PUT",headers:n,body:i,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((t=>{const n=JSON.parse(t.extraUIComponents);f(n[e.extraUIComponentIndex].content.stateAction),g(n[e.extraUIComponentIndex].content.stateSelection)})).catch((e=>{console.log(e)}))};return a.createElement(a.Fragment,null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__outter"},e.content.stateAction===r.A.NONE?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__image__outter"},a.createElement("img",{src:e.content.imageUrl+"&&width=150",alt:"WizybotShopifyAdd2Cart__add__product__image",className:"WizybotShopifyAdd2Cart__add__product__image"})),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__name__outter"},a.createElement("a",{className:"WizybotShopifyAdd2Cart__add__prouct__name__inner",href:e.content.productUrl,target:"_top",rel:"noopener noreferrer"},e.content.title),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__prouct__sku__inner"},"ID: ",e.content.productId.split("/").pop()),a.createElement("a",{href:e.content.productUrl,target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},a.createElement("div",{className:""},"English"===e.language?"View details":"Spanish"===e.language?"Ver detalles":"French"===e.language?"Voir les détails":"Portuguese"===e.language?"Ver detalhes":"German"===e.language?"Details anzeigen":"Italian"===e.language?"Visualizza dettagli":"View details")))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__options__outter__outter"},1===e.content.options.length&&1===e.content.options[0].values.length&&"Default Title"===e.content.options[0].values[0]?"":e.content.options.map(((e,t)=>a.createElement("div",{className:"AWizybotShopifyAdd2Cart__add__product__option__outter",key:e.name+"_"+t},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__name"},e.name,":"),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__variants__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__input__select__outter"},a.createElement("select",{className:"WizybotShopifyAdd2Cart__input__select",name:t.toString(),value:s[t],onChange:E},y(t,s).map((e=>a.createElement("option",{value:e.index,key:e.toString()},e.name))))))))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__quantity__price__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__quantity__outter__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__quantity__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__quantity__outter"},a.createElement("div",null),a.createElement("div",{onClick:()=>{S("decrease")},className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image__outter"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image"},a.createElement("path",{d:"M19.1111 12.7778H4.88889C4.40296 12.7778 4 12.3748 4 11.8889C4 11.403 4.40296 11 4.88889 11H19.1111C19.597 11 20 11.403 20 11.8889C20 12.3748 19.597 12.7778 19.1111 12.7778Z",fill:"#222251"})))," ",a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__quantity__counter"},u),a.createElement("div",{onClick:()=>{S("increase")},className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image__outter"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image"},a.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.1111 19.1111C11.1111 19.597 11.5141 20 12 20C12.4859 20 12.8889 19.597 12.8889 19.1111V12.8889H19.1111C19.597 12.8889 20 12.4859 20 12C20 11.5141 19.597 11.1111 19.1111 11.1111H12.8889V4.88889C12.8889 4.40296 12.4859 4 12 4C11.5141 4 11.1111 4.40296 11.1111 4.88889V11.1111H4.88889C4.40296 11.1111 4 11.5141 4 12C4 12.4859 4.40296 12.8889 4.88889 12.8889H11.1111V19.1111Z",fill:"#222251"}))),a.createElement("div",null)))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__price__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__price__inner"},(k=b(i,s).price.amount*u,P=b(i,s).price.currencyCode,"$"+(k%1!=0||"USD"===P||"EUR"===P||"GBP"===P||"CAD"===P||"AUD"===P?k.toFixed(2):k.toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__currency__inner"},b(i,s).price.currencyCode)))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter__outter"},a.createElement("div",null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter"},a.createElement("button",{disabled:null===e.shopifyRootPath,className:"WizybotShopifyAdd2Cart__add__to__cart__button",style:{width:"100%"},onClick:async()=>{const t=b(i,s).id,n=u;if(u>0){(new Headers).append("Content-Type","application/json");let a={items:[{id:parseInt(t.split("/").pop()),quantity:n}]};null!==e.shopifyRootPath?await fetch(e.shopifyRootPath+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then((async e=>{await w(r.A.ADDED_TO_CART)})).catch((e=>{console.error("Error:",e)})):console.log("not in shopify")}}},"English"===e.language?"Add to cart":"Spanish"===e.language?"Añadir al carrito":"French"===e.language?"Ajouter au panier":"Portuguese"===e.language?"Adicionar ao carrinho":"German"===e.language?"In den Warenkorb":"Italian"===e.language?"Aggiungi al carrello":"Add to cart"))),a.createElement("div",null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter"},a.createElement("button",{disabled:u<=0,className:"WizybotShopifyAdd2Cart__buy__now__button",style:{width:"100%"},onClick:async()=>{const t=b(i,s).id,n=u;if(u>0){var a=new Headers;a.append("Content-Type","application/json");var o=JSON.stringify({variantId:t,quantity:n});await fetch(e.globalSelectedBackend+"/shopifywidgetrest/buynowlink/"+e.domain+"/"+e.messageId,{method:"POST",headers:a,body:o,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((async e=>{await w(r.A.BOUGHT),window.open(e.link,"_top")})).catch((e=>{console.log(e)}))}else console.log("Add something")}},"English"===e.language?"Buy Now":"Spanish"===e.language?"Comprar ahora":"French"===e.language?"Acheter maintenant":"Portuguese"===e.language?"Comprar agora":"German"===e.language?"Jetzt kaufen":"Italian"===e.language?"Compra ora":"Buy Now"))))," "):e.content.stateAction===r.A.BOUGHT?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner__inner"},"English"===e.language?"You have been redirected to the checkout page. In case the redirection didn't work, please click this link:":"Spanish"===e.language?"Has sido redirigido a la página de pago. En caso de que la redirección no haya funcionado, por favor haz clic en este enlace:":"French"===e.language?"Vous avez été redirigé vers la page de paiement. Si la redirection n'a pas fonctionné, veuillez cliquer sur ce lien :":"Portuguese"===e.language?"Você foi redirecionado para a página de checkout. Caso o redirecionamento não tenha funcionado, por favor clique neste link:":"German"===e.language?"Sie wurden zur Checkout-Seite weitergeleitet. Falls die Weiterleitung nicht funktioniert hat, klicken Sie bitte auf diesen Link:":"Italian"===e.language?"Sei stato reindirizzato alla pagina di pagamento. Se il reindirizzamento non ha funzionato, per favore clicca su questo link:":"You have been redirected to the checkout page. In case the redirection didn't work, please click this link:"," ",a.createElement("span",{onClick:e.openCart,className:"WizybotShopifyAdd2Cart__add__prouct__details__inner"},"English"===e.language?"Checkout":"Spanish"===e.language?"Pagar":"French"===e.language?"Paiement":"Portuguese"===e.language?"Finalizar compra":"German"===e.language?"Zur Kasse":"Italian"===e.language?"Cassa":"Checkout"))):e.content.stateAction===r.A.ADDED_TO_CART?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}}," ",a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner__inner"},"English"===e.language?"The product has been added to your cart. If you want to buy something else, just let me know. If not, please finalize your purchase by clicking this link:":"Spanish"===e.language?"El producto ha sido añadido a tu carrito. Si quieres comprar algo más, solo avísame. Si no, por favor finaliza tu compra haciendo clic en este enlace:":"French"===e.language?"Le produit a été ajouté à votre panier. Si vous souhaitez acheter autre chose, faites-le moi savoir. Sinon, veuillez finaliser votre achat en cliquant sur ce lien :":"Portuguese"===e.language?"O produto foi adicionado ao seu carrinho. Se você quiser comprar outra coisa, é só me avisar. Se não, finalize sua compra clicando neste link:":"German"===e.language?"Das Produkt wurde Ihrem Warenkorb hinzugefügt. Wenn Sie etwas anderes kaufen möchten, lassen Sie es mich einfach wissen. Wenn nicht, bitte schließen Sie Ihren Einkauf ab, indem Sie auf diesen Link klicken:":"Italian"===e.language?"Il prodotto è stato aggiunto al tuo carrello. Se vuoi acquistare qualcos'altro, fammelo sapere. Altrimenti, per favore finalizza il tuo acquisto cliccando su questo link:":"The product has been added to your cart. If you want to buy something else, just let me know. If not, please finalize your purchase by clicking this link:"," ",a.createElement("span",{onClick:e.openCart,className:"WizybotShopifyAdd2Cart__add__prouct__details__inner"},"English"===e.language?"Go to Cart":"Spanish"===e.language?"Ir al carrito":"French"===e.language?"Aller au panier":"Portuguese"===e.language?"Ir para o carrinho":"German"===e.language?"Zum Warenkorb":"Italian"===e.language?"Vai al carrello":"Go to Cart"))):a.createElement(a.Fragment,null)));var k,P}},966:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(540),r=n(68);const i=e=>{const t=(e,n)=>{if(1===n.length)return e[n[0]];{const[a,...r]=n;return t(e[a],r)}},[n,i]=(0,a.useState)(e.content.options),[o,s]=(0,a.useState)(e.content.infoArray),[l,u]=(0,a.useState)((e=>{const t=[];for(let n=0;n{const n=[];let a=e;for(let e=0;ee*t)),i=Math.floor(a/r);n.push(i),a-=r*i}return n})(o.flat(t.length).findIndex((e=>null!==e)),t);return n})(e.content.options)),[c,d]=(0,a.useState)(1),[_,p]=(0,a.useState)(0),[f,h]=(0,a.useState)(e.content.stateAction),[g,m]=(0,a.useState)(e.content.stateSelection),y=(e=>{const t=[];for(let n=0;n{let n="";const a=t(o,e).sellingPlans;return n=a.length>0?a[0].id:"",n})(l));(0,a.useEffect)((()=>{O()}),[l]);const w=(e,t)=>{let a=o;for(let n=0;nnull!==e))&&r.push(e)}else null!==a[e]&&r.push(e);const i=[];return n[e].values.map(((e,t)=>{r.includes(t)&&i.push({name:e,index:t})})),i},k=async e=>{const{name:n,value:a}=e.currentTarget;let r=l.map(((e,t)=>t===parseInt(n)?parseInt(a):e));r=P(r,parseInt(n)),b(E.SUBSCRIPTION);const i=t(o,r).sellingPlans;i.length>0?S(i[0].id):S(""),u(r)},P=(e,t)=>{for(let n=t+1;ne.index));t.includes(e[n])||(e[n]=t[0])}return e},O=()=>{const e=t(o,l);p(e.quantityAvailable)},M=e=>{d("increase"===e?c===_?_:c+1:1===c?1:c-1)},T=async t=>{var n=new Headers;n.append("Content-Type","application/json");const a={type:r.q.ADD_TO_CART,content:e.content};a.content.stateAction=t,a.content.stateSelection={selectedOptionValues:l,selectedQuantity:c};var i=JSON.stringify({stringifiedExtraUIComponent:JSON.stringify(a),extraUIComponentIndex:e.extraUIComponentIndex});await fetch(e.globalSelectedBackend+"/shopifywidgetrest/extrauicomponent/"+e.messageId,{method:"PUT",headers:n,body:i,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((t=>{const n=JSON.parse(t.extraUIComponents);h(n[e.extraUIComponentIndex].content.stateAction),m(n[e.extraUIComponentIndex].content.stateSelection)})).catch((e=>{console.log(e)}))},I=()=>{let e=!1;return v===E.SUBSCRIPTION&&t(o,l).sellingPlans.length&&t(o,l).sellingPlans.find((e=>e.id===C)).discountPercentage&&(e=!0),e};return a.createElement(a.Fragment,null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__outter"},e.content.stateAction===r.A.NONE?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__image__outter"},a.createElement("img",{src:e.content.imageUrl?e.content.imageUrl+"&&width=150":e.noImageImage,alt:"WizybotShopifyAdd2Cart__add__product__image",className:"WizybotShopifyAdd2Cart__add__product__image"})),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__name__outter"},a.createElement("a",{className:"WizybotShopifyAdd2Cart__add__prouct__name__inner",href:e.content.productUrl,target:"_top",rel:"noopener noreferrer"},e.content.title),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__prouct__sku__inner"},"ID: ",e.content.productId.split("/").pop()),a.createElement("a",{href:e.content.productUrl,target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},a.createElement("div",{className:""},"English"===e.language?"View details":"Spanish"===e.language?"Ver detalles":"French"===e.language?"Voir les détails":"Portuguese"===e.language?"Ver detalhes":"German"===e.language?"Details anzeigen":"Italian"===e.language?"Visualizza dettagli":"View details")))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__options__outter__outter"},1===e.content.options.length&&1===e.content.options[0].values.length&&"Default Title"===e.content.options[0].values[0]?"":e.content.options.map(((e,t)=>a.createElement("div",{className:"AWizybotShopifyAdd2Cart__add__product__option__outter",key:e.name+"_"+t},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__name"},e.name,":"),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__variants__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__input__select__outter"},a.createElement("select",{className:"WizybotShopifyAdd2Cart__input__select",name:t.toString(),value:l[t],onChange:k},w(t,l).map((e=>a.createElement("option",{value:e.index,key:e.toString()},e.name))))))))),t(o,l).sellingPlans.length>0?a.createElement("div",{className:"AWizybotShopifyAdd2Cart__add__product__option__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__name"},"English"===e.language?"Payment type":"Spanish"===e.language?"Tipo de pago":"French"===e.language?"Type de paiement":"Portuguese"===e.language?"Tipo de pagamento":"German"===e.language?"Zahlungsart":"Italian"===e.language?"Tipo di pagamento":"Payment type",":"),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__variants__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__input__select__outter"},a.createElement("select",{className:"WizybotShopifyAdd2Cart__input__select",value:v,onChange:e=>{const{value:t}=e.currentTarget;b(t)}},a.createElement("option",{value:E.ONE_TIME,key:E.ONE_TIME},"English"===e.language?"One time":"Spanish"===e.language?"Una vez":"French"===e.language?"Une seule fois":"Portuguese"===e.language?"Uma vez":"German"===e.language?"Einmalig":"Italian"===e.language?"Una sola volta":"One time"),a.createElement("option",{value:E.SUBSCRIPTION,key:E.SUBSCRIPTION},"English"===e.language?"Subscription":"Spanish"===e.language?"Suscripción":"French"===e.language?"Abonnement":"Portuguese"===e.language?"Assinatura":"German"===e.language?"Abonnement":"Italian"===e.language?"Abbonamento":"Subscription"))))):a.createElement(a.Fragment,null),v===E.SUBSCRIPTION&&t(o,l).sellingPlans.length?a.createElement("div",{className:"AWizybotShopifyAdd2Cart__add__product__option__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__name"},"English"===e.language?"Subscription Plans":"Spanish"===e.language?"Planes de subscripción":"French"===e.language?"Plans d'abonnement":"Portuguese"===e.language?"Planos de assinatura":"German"===e.language?"Abonnement-Pläne":"Italian"===e.language?"Piani di abbonamento":"Subscription Plans",":"),a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__variants__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__input__select__outter"},a.createElement("select",{className:"WizybotShopifyAdd2Cart__input__select",value:C,onChange:e=>{const{value:t}=e.currentTarget;S(t)}},t(o,l).sellingPlans.map((e=>a.createElement("option",{value:e.id,key:e.id},e.name))))))):a.createElement(a.Fragment,null),a.createElement("div",{className:"WizybotShopifyAdd2Cart__quantity__price__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__quantity__outter__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__quantity__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__quantity__outter"},a.createElement("div",null),a.createElement("div",{onClick:()=>{M("decrease")},className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image__outter"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image"},a.createElement("path",{d:"M19.1111 12.7778H4.88889C4.40296 12.7778 4 12.3748 4 11.8889C4 11.403 4.40296 11 4.88889 11H19.1111C19.597 11 20 11.403 20 11.8889C20 12.3748 19.597 12.7778 19.1111 12.7778Z",fill:"#222251"})))," ",a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__option__quantity__counter"},c),a.createElement("div",{onClick:()=>{M("increase")},className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image__outter"},a.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyAdd2Cart__add__product__option__quantity__image"},a.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.1111 19.1111C11.1111 19.597 11.5141 20 12 20C12.4859 20 12.8889 19.597 12.8889 19.1111V12.8889H19.1111C19.597 12.8889 20 12.4859 20 12C20 11.5141 19.597 11.1111 19.1111 11.1111H12.8889V4.88889C12.8889 4.40296 12.4859 4 12 4C11.5141 4 11.1111 4.40296 11.1111 4.88889V11.1111H4.88889C4.40296 11.1111 4 11.5141 4 12C4 12.4859 4.40296 12.8889 4.88889 12.8889H11.1111V19.1111Z",fill:"#222251"}))),a.createElement("div",null)))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__price__outter"},a.createElement("div",{className:"WizybotShopifyAdd2Cart__price__inner"},(D=t(o,l).price.amount*c*(()=>{let e=1;return I()&&(e=(100-t(o,l).sellingPlans.find((e=>e.id===C)).discountPercentage)/100),e})(),W=t(o,l).price.currencyCode,"$"+(D%1!=0||"USD"===W||"EUR"===W||"GBP"===W||"CAD"===W||"AUD"===W?D.toFixed(2):D.toFixed(0)).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"))),a.createElement("div",{className:"WizybotShopifyAdd2Cart__currency__inner"},t(o,l).price.currencyCode," ",(()=>{let e=!1;return v===E.SUBSCRIPTION&&t(o,l).sellingPlans.length&&t(o,l).sellingPlans.find((e=>e.id===C)).discountCycles&&(e=!0),e})()?("English"===e.language?"for the first":"Spanish"===e.language?"por los primeros":"French"===e.language?"pour les":"Portuguese"===e.language?"para os primeiros":"German"===e.language?"für die ersten":"Italian"===e.language?"per i primi":"for the first")+" "+t(o,l).sellingPlans.find((e=>e.id===C)).discountCycles+" "+("English"===e.language?"billing cycles":"Spanish"===e.language?"ciclos de facturación":"French"===e.language?"cycles de facturation":"Portuguese"===e.language?"ciclos de faturação":"German"===e.language?"Abrechnungszyklen":"Italian"===e.language?"cicli di fatturazione":"billing cycles"):""),I()?a.createElement("div",{className:"WizybotShopifyAdd2Cart__discount"},"-",t(o,l).sellingPlans.find((e=>e.id===C)).discountPercentage,"%"," "):a.createElement(a.Fragment,null)))),v===E.SUBSCRIPTION&&t(o,l).sellingPlans.length?a.createElement("div",{className:"WizybotShopifyAdd2CartSubscription__add__product__buttons__outter__outter"},a.createElement("div",null,a.createElement("button",{disabled:c<=0,className:"WizybotShopifyAdd2CartSubscription__buy__now__button",style:{width:"100%"},onClick:async()=>{const n=t(o,l).id,a=c;if(c>0){var i=new Headers;i.append("Content-Type","application/json");var s=JSON.stringify({variantId:n,quantity:a,sellingPlanId:C});await fetch(e.globalSelectedBackend+"/shopifywidgetrest/buynowlinksubscription/"+e.domain+"/"+e.messageId,{method:"POST",headers:i,body:s,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((async e=>{await T(r.A.BOUGHT),window.open(e.link,"_top")})).catch((e=>{console.log(e)}))}else console.log("Add something")}},"English"===e.language?"Subscribe Now":"Spanish"===e.language?"Suscríbase ahora":"French"===e.language?"S'abonner maintenant":"Portuguese"===e.language?"Subscrever agora":"German"===e.language?"jetzt abonnieren":"Italian"===e.language?"iscriviti ora":"Subscribe Now"))):a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter__outter"},a.createElement("div",null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter"},a.createElement("button",{disabled:null===e.shopifyRootPath,className:"WizybotShopifyAdd2Cart__add__to__cart__button",style:{width:"100%"},onClick:async()=>{const n=t(o,l).id,a=c;if(c>0){(new Headers).append("Content-Type","application/json");let t={items:[{id:parseInt(n.split("/").pop()),quantity:a}]};null!==e.shopifyRootPath?await fetch(e.shopifyRootPath+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then((async e=>{await T(r.A.ADDED_TO_CART)})).catch((e=>{console.error("Error:",e)})):console.log("not in shopify")}}},"English"===e.language?"Add to cart":"Spanish"===e.language?"Añadir al carrito":"French"===e.language?"Ajouter au panier":"Portuguese"===e.language?"Adicionar ao carrinho":"German"===e.language?"In den Warenkorb":"Italian"===e.language?"Aggiungi al carrello":"Add to cart"))),a.createElement("div",null,a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__product__buttons__outter"},a.createElement("button",{disabled:c<=0,className:"WizybotShopifyAdd2Cart__buy__now__button",style:{width:"100%"},onClick:async()=>{const n=t(o,l).id,a=c;if(c>0){var i=new Headers;i.append("Content-Type","application/json");var s=JSON.stringify({variantId:n,quantity:a});await fetch(e.globalSelectedBackend+"/shopifywidgetrest/buynowlink/"+e.domain+"/"+e.messageId,{method:"POST",headers:i,body:s,credentials:"include",redirect:"follow"}).then((async e=>{if(e.ok)return e.text();{let t=await e.text(),n=JSON.parse(t);throw new Error(n.message)}})).then((e=>JSON.parse(e))).then((async e=>{await T(r.A.BOUGHT),window.open(e.link,"_top")})).catch((e=>{console.log(e)}))}else console.log("Add something")}},"English"===e.language?"Buy Now":"Spanish"===e.language?"Comprar ahora":"French"===e.language?"Acheter maintenant":"Portuguese"===e.language?"Comprar agora":"German"===e.language?"Jetzt kaufen":"Italian"===e.language?"Compra ora":"Buy Now"))))):e.content.stateAction===r.A.BOUGHT?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}},a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner__inner"},"English"===e.language?"You have been redirected to the checkout page. In case the redirection didn't work, please click this link:":"Spanish"===e.language?"Has sido redirigido a la página de pago. En caso de que la redirección no haya funcionado, por favor haz clic en este enlace:":"French"===e.language?"Vous avez été redirigé vers la page de paiement. Si la redirection n'a pas fonctionné, veuillez cliquer sur ce lien :":"Portuguese"===e.language?"Você foi redirecionado para a página de checkout. Caso o redirecionamento não tenha funcionado, por favor clique neste link:":"German"===e.language?"Sie wurden zur Checkout-Seite weitergeleitet. Falls die Weiterleitung nicht funktioniert hat, klicken Sie bitte auf diesen Link:":"Italian"===e.language?"Sei stato reindirizzato alla pagina di pagamento. Se il reindirizzamento non ha funzionato, per favore clicca su questo link:":"You have been redirected to the checkout page. In case the redirection didn't work, please click this link:"," ",a.createElement("span",{onClick:e.openCart,className:"WizybotShopifyAdd2Cart__add__prouct__details__inner"},"English"===e.language?"Checkout":"Spanish"===e.language?"Pagar":"French"===e.language?"Paiement":"Portuguese"===e.language?"Finalizar compra":"German"===e.language?"Zur Kasse":"Italian"===e.language?"Cassa":"Checkout"))):e.content.stateAction===r.A.ADDED_TO_CART?a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner",style:{color:"black"}}," ",a.createElement("div",{className:"WizybotShopifyAdd2Cart__add__message__inner__inner"},"English"===e.language?"The product has been added to your cart. If you want to buy something else, just let me know. If not, please finalize your purchase by clicking this link:":"Spanish"===e.language?"El producto ha sido añadido a tu carrito. Si quieres comprar algo más, solo avísame. Si no, por favor finaliza tu compra haciendo clic en este enlace:":"French"===e.language?"Le produit a été ajouté à votre panier. Si vous souhaitez acheter autre chose, faites-le moi savoir. Sinon, veuillez finaliser votre achat en cliquant sur ce lien :":"Portuguese"===e.language?"O produto foi adicionado ao seu carrinho. Se você quiser comprar outra coisa, é só me avisar. Se não, finalize sua compra clicando neste link:":"German"===e.language?"Das Produkt wurde Ihrem Warenkorb hinzugefügt. Wenn Sie etwas anderes kaufen möchten, lassen Sie es mich einfach wissen. Wenn nicht, bitte schließen Sie Ihren Einkauf ab, indem Sie auf diesen Link klicken:":"Italian"===e.language?"Il prodotto è stato aggiunto al tuo carrello. Se vuoi acquistare qualcos'altro, fammelo sapere. Altrimenti, per favore finalizza il tuo acquisto cliccando su questo link:":"The product has been added to your cart. If you want to buy something else, just let me know. If not, please finalize your purchase by clicking this link:"," ",a.createElement("span",{onClick:e.openCart,className:"WizybotShopifyAdd2Cart__add__prouct__details__inner"},"English"===e.language?"Go to Cart":"Spanish"===e.language?"Ir al carrito":"French"===e.language?"Aller au panier":"Portuguese"===e.language?"Ir para o carrinho":"German"===e.language?"Zum Warenkorb":"Italian"===e.language?"Vai al carrello":"Go to Cart"))):a.createElement(a.Fragment,null)));var D,W}},585:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(540);const r=e=>a.createElement(a.Fragment,null,a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__outter"},a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__inner",style:{color:"black"}},"cards"in e.content?e.content.cards.map((t=>a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__product__outter"},a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__outter"},a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__image__outter"},"product"===t.type?a.createElement("img",{src:t.imageUrl+"&&width=150",alt:"WizybotShopifyRecommendationCarousel__add__product__image",className:"WizybotShopifyRecommendationCarousel__add__product__image"}):1===t.imageUrls.length?a.createElement("img",{src:t.imageUrls[0]+"&&width=150",alt:"WizybotShopifyRecommendationCarousel__add__product__image",className:"WizybotShopifyRecommendationCarousel__add__product__image"}):a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__collection__image__container"},t.imageUrls.map((e=>a.createElement("img",{src:e+"&&width=150",alt:"WizybotShopifyRecommendationCarousel__add__collection__image",className:"WizybotShopifyRecommendationCarousel__add__collection__image"}))))),a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__name__outter"},a.createElement("a",{className:"WizybotShopifyRecommendationCarousel__add__prouct__name__inner",href:t.redirectUrl,target:"_top",rel:"noopener noreferrer"},t.title),"product"===t.type?a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__prouct__sku__inner"},t.price):a.createElement(a.Fragment,null),a.createElement("a",{href:t.redirectUrl,target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},a.createElement("div",{className:""},"English"===e.language?"View details":"Spanish"===e.language?"Ver detalles":"French"===e.language?"Voir les détails":"Portuguese"===e.language?"Ver detalhes":"German"===e.language?"Details anzeigen":"Italian"===e.language?"Visualizza dettagli":"View details"))))))):e.content.recommendations.map((t=>a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__product__outter"},a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__outter"},a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__image__outter"},a.createElement("img",{src:t.imageUrl+"&&width=150",alt:"WizybotShopifyRecommendationCarousel__add__product__image",className:"WizybotShopifyRecommendationCarousel__add__product__image"})),a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__product__name__outter"},a.createElement("a",{className:"WizybotShopifyRecommendationCarousel__add__prouct__name__inner",href:t.redirectUrl,target:"_top",rel:"noopener noreferrer"},t.title),a.createElement("div",{className:"WizybotShopifyRecommendationCarousel__add__prouct__sku__inner"},t.price),a.createElement("a",{href:t.redirectUrl,target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},a.createElement("div",{className:""},"English"===e.language?"View details":"Spanish"===e.language?"Ver detalles":"French"===e.language?"Voir les détails":"Portuguese"===e.language?"Ver detalhes":"German"===e.language?"Details anzeigen":"Italian"===e.language?"Visualizza dettagli":"View details"))))))))))},468:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(540);const ShopifyWidgetCart=props=>{const[cartToUpdate,setCartToUpdate]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(props.cart),[updateTimeout,setUpdateTimeout]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{JSON.stringify(props.cart)!==JSON.stringify(cartToUpdate)&&(clearTimeout(updateTimeout),setUpdateTimeout(setTimeout((()=>{props.updateCart(cartToUpdate)}),1e3)))}),[cartToUpdate]);const handleQuantityChange=(e,t)=>{t>=0&&setCartToUpdate((n=>({...n,items:n.items.map((n=>n.id===e?{id:n.id,quantity:t,productTitle:n.productTitle,variantTitle:n.variantTitle,linePrice:n.linePrice,image:n.image,url:n.url}:n))})))};function currencyFormat(price,currency){const formatedMoney=eval("Shopify.formatMoney("+price+")");return formatedMoney}return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,null!==cartToUpdate?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__products"},cartToUpdate.items.length>0?react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__products"},cartToUpdate.items.map((e=>react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__product__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__product__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__product__image__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("img",{src:e.image+"&&width=150",alt:"WizybotShopifyWidget__cart__add__product__image",className:"WizybotShopifyWidget__cart__add__product__image"})),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__product__name__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__prouct__name__inner"},e.productTitle),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__prouct__sku__inner"},""!==e.variantTitle&&null!==e.variantTitle?e.variantTitle:"English"===props.language?"Unique":"Spanish"===props.language?"Único":"French"===props.language?"Unique":"Portuguese"===props.language?"Único":"German"===props.language?"Einzigartig":"Italian"===props.language?"unico":"Unique"),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__prouct__quantity__delete"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__product__option__quantity__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{onClick:()=>{handleQuantityChange(e.id,e.quantity-1)},className:"WizybotShopifyWidget__cart__add__product__option__quantity__image__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__cart__add__product__option__quantity__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{d:"M19.1111 12.7778H4.88889C4.40296 12.7778 4 12.3748 4 11.8889C4 11.403 4.40296 11 4.88889 11H19.1111C19.597 11 20 11.403 20 11.8889C20 12.3748 19.597 12.7778 19.1111 12.7778Z",fill:"#222251"})))," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__add__product__option__quantity__counter"},e.quantity),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{onClick:()=>{handleQuantityChange(e.id,e.quantity+1)},className:"WizybotShopifyWidget__cart__add__product__option__quantity__image__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"WizybotShopifyWidget__cart__add__product__option__quantity__image"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.1111 19.1111C11.1111 19.597 11.5141 20 12 20C12.4859 20 12.8889 19.597 12.8889 19.1111V12.8889H19.1111C19.597 12.8889 20 12.4859 20 12C20 11.5141 19.597 11.1111 19.1111 11.1111H12.8889V4.88889C12.8889 4.40296 12.4859 4 12 4C11.5141 4 11.1111 4.40296 11.1111 4.88889V11.1111H4.88889C4.40296 11.1111 4 11.5141 4 12C4 12.4859 4.40296 12.8889 4.88889 12.8889H11.1111V19.1111Z",fill:"#222251"}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null))))))))):react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__no__products"},"English"===props.language?"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?":"Spanish"===props.language?"¡Hola! Parece que no has añadido nada a tu carrito, ¿por qué no nos pides algunas recomendaciones?":"French"===props.language?"Bonjour! Il semble que vous n'avez rien ajouté à votre panier, pourquoi ne pas nous demander des recommandations?":"Portuguese"===props.language?"Olá! Parece que você não adicionou nada ao seu carrinho, por que não nos pede algumas recomendações?":"German"===props.language?"Hallo! Es scheint, dass Sie nichts in Ihren Warenkorb gelegt haben. Warum fragen Sie uns nicht nach einigen Empfehlungen?":"Italian"===props.language?"Ciao! Sembra che tu non abbia aggiunto nulla al carrello, perché non ci chiedi qualche consiglio?":"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__no__products__button",style:{width:"100%"},onClick:props.closeCart},"English"===props.language?"Chat with":"Spanish"===props.language?"Habla con":"French"===props.language?"Parler avec":"Portuguese"===props.language?"Conversar com":"German"===props.language?"Chatten Sie mit":"Italian"===props.language?"Chat con":"Chat with"," ",props.agentName)))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__checkout"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__estimated"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated"},"English"===props.language?"Estimated total":"Spanish"===props.language?"Total estimado":"French"===props.language?"Total estimé":"Portuguese"===props.language?"Total estimado":"German"===props.language?"Geschätzte Gesamtsumme":"Italian"===props.language?"Totale stimato":"Estimated total")," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__price"},currencyFormat(cartToUpdate.totalPrice,cartToUpdate.currency))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("a",{href:"/cart",target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__button",style:{width:"100%"}},"English"===props.language?"Pay":"Spanish"===props.language?"Pagar":"French"===props.language?"Payer":"Portuguese"===props.language?"Pagar":"German"===props.language?"Bezahlen":"Italian"===props.language?"Pagare":"Pay"))))):react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__products"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__no__products"},"English"===props.language?"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?":"Spanish"===props.language?"¡Hola! Parece que no has añadido nada a tu carrito, ¿por qué no nos pides algunas recomendaciones?":"French"===props.language?"Bonjour! Il semble que vous n'avez rien ajouté à votre panier, pourquoi ne pas nous demander des recommandations?":"Portuguese"===props.language?"Olá! Parece que você não adicionou nada ao seu carrinho, por que não nos pede algumas recomendações?":"German"===props.language?"Hallo! Es scheint, dass Sie nichts in Ihren Warenkorb gelegt haben. Warum fragen Sie uns nicht nach einigen Empfehlungen?":"Italian"===props.language?"Ciao! Sembra che tu non abbia aggiunto nulla al carrello, perché non ci chiedi qualche consiglio?":"Hello there! It seems you have not added anything to your cart, why don't you ask us for some recommendations?",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__no__products__button",style:{width:"100%"},onClick:props.closeCart},"English"===props.language?"Chat with":"Spanish"===props.language?"Habla con":"French"===props.language?"Parler avec":"Portuguese"===props.language?"Conversar com":"German"===props.language?"Chatten Sie mit":"Italian"===props.language?"Chat con":"Chat with"," ",props.agentName)))),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__checkout"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__outter__estimated"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated"},"English"===props.language?"Estimated total":"Spanish"===props.language?"Total estimado":"French"===props.language?"Total estimé":"Portuguese"===props.language?"Total estimado":"German"===props.language?"Geschätzte Gesamtsumme":"Italian"===props.language?"Totale stimato":"Estimated total")," ",react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__price"},"$0.00")),react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{className:"WizybotShopifyWidget__cart__inner__estimated__button__outter"},react__WEBPACK_IMPORTED_MODULE_0__.createElement("a",{href:"/cart",target:"_top",rel:"noreferrer",style:{textDecoration:"none"}},react__WEBPACK_IMPORTED_MODULE_0__.createElement("button",{className:"WizybotShopifyWidget__cart__inner__estimated__button",style:{width:"100%"}},"English"===props.language?"Pay":"Spanish"===props.language?"Pagar":"French"===props.language?"Payer":"Portuguese"===props.language?"Pagar":"German"===props.language?"Bezahlen":"Italian"===props.language?"Pagare":"Pay")))))))},__WEBPACK_DEFAULT_EXPORT__=ShopifyWidgetCart},68:(e,t,n)=>{n.d(t,{A:()=>r,q:()=>a});let a=function(e){return e.ADD_TO_CART="Add to cart",e.ADD_TO_CART_WITH_SUBSCRIPTIONS="Add to cart with subscriptions",e.RECOMMENDATION_CAROUSEL="Recommendation carousel",e}({}),r=function(e){return e.NONE="none",e.BOUGHT="bought",e.ADDED_TO_CART="addedtocart",e}({})},222:(e,t,n)=>{n.d(t,{PG:()=>a,nH:()=>i,rS:()=>r});let a=function(e){return e.assistant="assistant",e.ai="ai",e.user="user",e.function="function",e.tool="tool",e}({}),r=function(e){return e.SHOPIFY_WIDGET="shopify widget",e.WHATSAPP="whatsapp",e.INSTAGRAM="instagram",e.MESSENGER="messenger",e}({}),i=function(e){return e.SENT="sent",e.READ="read",e.FAILED="failed",e.DELETED="deleted",e}({})},551:(e,t,n)=>{var a=n(540),r=n(982);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n