function getSettings(){var t=Shopify.shop;let e="https://musbu.codexade.com/";if(window.cxMusbuMetaData&&typeof maybeObject!=window.cxMusbuMetaData){var n=window.cxMusbuMetaData;if(isDisplayChatWidget(n)&&n?.channels?.length>0)createWhatsappHtml(n);else{var s=new XMLHttpRequest,a="shop="+t;s.onreadystatechange=function(){if(4==s.readyState&&200==s.status){var t=JSON.parse(s.response),e=t.data;200==t.status&&Object.keys(e).length>0&&(e.channels||(e.channels=[{type:"whatsapp",number:e.whatsapp_number||"",message:e.whatsapp_text||"",icon_uid:e.icon_uid,displayOnDesktop:!0,displayOnMobile:!0},]),e.styling||(e.styling={buttonLayout:"1",singleAccountLayout:"4",desktopPosition:e.button_position??"right",customDesktopSpacing:!1,mobilePosition:e.button_position??"right",buttonBackgroundColor:"#10c379",popupBackgroundColor:"#10c379",isPreset:["1"],presetId:"29",isRounded:!1,isCustomIcon:["1"],selectedCustomIcon:"svg1"}),isDisplayChatWidget(e)&&createWhatsappHtml(e))}},s.open("POST",e+"settings"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.send(a)}}else{var s=new XMLHttpRequest,a="shop="+t;s.onreadystatechange=function(){if(4==s.readyState&&200==s.status){var t=JSON.parse(s.response),e=t.data;200==t.status&&Object.keys(e).length>0&&(e.channels||(e.channels=[{type:"whatsapp",number:e.whatsapp_number||"",message:e.whatsapp_text||"",icon_uid:e.icon_uid,displayOnDesktop:!0,displayOnMobile:!0},]),e.styling||(e.styling={buttonLayout:"1",singleAccountLayout:"4",desktopPosition:e.button_position??"right",customDesktopSpacing:!1,mobilePosition:e.button_position??"right",buttonBackgroundColor:"#10c379",popupBackgroundColor:"#10c379",isPreset:["1"],presetId:"29",isRounded:!1,isCustomIcon:["1"],selectedCustomIcon:"svg1"}),isDisplayChatWidget(e)&&createWhatsappHtml(e))}},s.open("POST",e+"settings"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.send(a)}}function capitalizeFirstLetter(t){return"string"!=typeof t?"":t.charAt(0).toUpperCase()+t.slice(1)}function getSelectedSVG(t){if("undefined"==typeof IconList)return console.error("IconList is not defined"),null;var e=IconList?.filter(function(e){return e.label==t});return e.length>0?e[0].value:null}const generateSocialMediaLinks=(t,e)=>{let n,s;switch(t.type){case"whatsapp":let a=t?.message||"";e&&(a+=` ${window.location.href}`),n=`https://api.whatsapp.com/send?phone=${encodeURIComponent(t.number)}&text=${encodeURIComponent(a||"")}`,s=`https://api.whatsapp.com/send?phone=${encodeURIComponent(t.number)}&text=${encodeURIComponent(a||"")}`;break;case"phone":n=`tel:${t.number}`,s=`tel:${t.number}`;break;case"sms":n=`sms:${t.number}`,s=`sms:${t.number}`;break;case"viber":n=`viber://chat?number=${t.number}`,s=`viber://chat?number=${t.number}`;break;case"x":n=`https://twitter.com/${t.userName}`,s=`https://twitter.com/${t.userName}`;break;case"wechat":n=`weixin://dl/chat?${t.userName}`,s=`weixin://dl/chat?${t.userName}`;break;case"snapchat":n=`https://www.snapchat.com/add/${t.userName}`,s=`https://www.snapchat.com/add/${t.userName}`;break;case"skype":n=`skype:${t.userName}?chat`,s=`skype:${t.userName}?chat`;break;case"instagram":n=`https://www.instagram.com/${t.userName}`,s=`https://www.instagram.com/${t.userName}`;break;case"telegram":n=`https://t.me/${t.userName}`,s=`https://t.me/${t.userName}`;break;case"tiktok":n=`https://www.tiktok.com/@${t.userName}`,s=`https://www.tiktok.com/@${t.userName}`;break;case"email":n=`mailto:${t.email}`,s=`mailto:${t.email}`;break;case"google maps":n=`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(t.location)}`,s=`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(t.location)}`;break;case"waze":n=`https://www.waze.com/ul?ll=${encodeURIComponent(t.coordinates)}&navigate=yes`,s=`https://www.waze.com/ul?ll=${encodeURIComponent(t.coordinates)}&navigate=yes`;break;case"linkedin":n=`https://www.linkedin.com/in/${t.userName}`,s=`https://www.linkedin.com/in/${t.userName}`;break;case"vkontakte":n=`https://vk.com/${t.userName}`,s=`https://vk.com/${t.userName}`;break;case"slack":n=`https://${t.workspace}.slack.com/archives/${t.channel}`,s=`https://${t.workspace}.slack.com/archives/${t.channel}`;break;case"discord":n=`https://discord.com/users/${t.userName}`,s=`https://discord.com/users/${t.userName}`;break;case"teams":n=`https://teams.microsoft.com/l/chat/0/0?users=${t.email}`,s=`https://teams.microsoft.com/l/chat/0/0?users=${t.email}`;break;default:n="#",s="#"}return{desktopLink:n,mobileLink:s}};function getSelectedIconSVG(t){return chatIcons.find(e=>e.label==t).value}const getGradientString=t=>{if(t>=0&&te?.name?.toLowerCase()==t?.channels?.[0]?.type?.toLowerCase())?.value,backgroundColor:t?.styling?.isPreset?.[0]=="1"?getGradientString(t?.styling?.presetId):t?.styling?.buttonBackgroundColor||"#10c379",effect:1,notificationNumber:!!t?.styling?.isNotificationNumber&&t?.styling?.notificationNumber,speechBubble:t?.styling?.hoverText||!1,pulseEffect:t?.styling?.isPulse||!1,text:{title:t?.styling?.buttonHeading||"Need help? Chat with us",description:t?.styling?.buttonSubHeading||!1,online:!1,offline:!1}},sound:!1,changeBrowserTitle:!1,cookie:!1};if(t?.channels?.length==1&&t?.styling?.singleAccountLayout==0){let{desktopLink:n,mobileLink:s}=generateSocialMediaLinks(t?.channels[0],t.sendProductUrl);e.button={...e.button,link:{desktop:n,mobile:!!t?.channels[0].displayOnMobile&&s},onlineDay:{sunday:"00:00-23:59",monday:"00:00-23:59",tuesday:"00:00-23:59",wednesday:"00:00-23:59",thursday:"00:00-23:59",friday:"00:00-23:59",saturday:"00:00-23:59"}}}else if(t?.channels?.length==1&&t?.styling?.singleAccountLayout!=0){let{desktopLink:a,mobileLink:o}=generateSocialMediaLinks(t?.channels[0],t.sendProductUrl);e.popup={automaticOpen:!1,outsideClickClosePopup:!0,effect:1,header:{backgroundColor:t?.styling?.isPreset?.[0]=="1"?getGradientString(t?.styling?.presetId):t?.styling?.popupBackgroundColor||"#10c379"},persons:[{avatar:{src:"2"==t?.styling?.isCustomIcon[0]?getSelectedIconSVG(t?.styling?.selectedCustomIcon):"whatsapp"==t?.channels[0].type?getSelectedSVG("icon_"+t?.icon_uid):socialIcons.find(e=>e?.name?.toLowerCase()===t?.channels?.[0]?.type?.toLowerCase())?.value,backgroundColor:"#ffffff",onlineCircle:!0},text:{title:t?.styling?.popupTitle||"Need help? Chat with us",description:t?.styling?.popupSubtitle||"Customer Support",message:(t?.styling?.singleAccountLayout==1||t?.styling?.singleAccountLayout==3)&&("whatsapp"==t.channels[0].type?t.channels[0].message:t?.styling?.defaultChatMessage||"Hi there \uD83D\uDE42
How can I help you?"),textbox:(t?.styling?.singleAccountLayout==1||t?.styling?.singleAccountLayout==2)&&(t?.styling?.chatInputPlaceholder||"Say anything!"),button:(t?.styling?.singleAccountLayout==3||t?.styling?.singleAccountLayout==4)&&(t?.styling?.chatButtonName||"Start Chat")},link:{desktop:a,mobile:!!t?.channels[0].displayOnMobile&&o},onlineDay:{sunday:"00:00-23:59",monday:"00:00-23:59",tuesday:"00:00-23:59",wednesday:"00:00-23:59",thursday:"00:00-23:59",friday:"00:00-23:59",saturday:"00:00-23:59"}},]}}else t?.channels?.length>1&&(e.popup={automaticOpen:!1,outsideClickClosePopup:!0,effect:1,header:{backgroundColor:t?.styling?.isPreset?.[0]=="1"?getGradientString(t?.styling?.presetId):t?.styling?.buttonBackgroundColor||"#10c379",title:t?.styling?.popupTitle||"Need help? Chat with us",description:t?.styling?.popupSubtitle||!1},persons:t?.channels?.map(e=>{let{desktopLink:n,mobileLink:s}=generateSocialMediaLinks(e,t.sendProductUrl);return{avatar:{src:"whatsapp"==e.type?getSelectedSVG("icon_"+t?.icon_uid):socialIcons.find(t=>t?.name?.toLowerCase()==e?.type?.toLowerCase())?.value,backgroundColor:"#ffffff",onlineCircle:!1},text:{title:e?.channelName||capitalizeFirstLetter(e.type),description:e?.subHeading||!1,message:t?.whatsapp_text||"Hi there \uD83D\uDE42
How can I help you?",textbox:"Say anything!",button:"Start Chat",online:!1,offline:!1},link:{desktop:n,mobile:!!e.displayOnMobile&&s},onlineDay:{sunday:"00:00-23:59",monday:"00:00-23:59",tuesday:"00:00-23:59",wednesday:"00:00-23:59",thursday:"00:00-23:59",friday:"00:00-23:59",saturday:"00:00-23:59"}}})});jQuery("#cx_whatsapp_init").czmChatSupport(e);let i=window.location.pathname.split("/");if(!t.status||0==t.status||"home"==t.where_to_show&&""!=i[1])return!1;var p=".cx_whatsapp_btn{width:"+t.button_size+"px; height: "+t.button_size+`px; text-align: center; border-radius:`+("circle"==t.button_shape?"50px;":"4px;")+` position: fixed; bottom: 30px; z-index: 99999; cursor:pointer; transform: translateY(0px); transition: all 0.5s ease; } .cx_whatsapp_btn.cxshow{opacity: 1;transition: all 0.5s ease; cursor: pointer; transform: translateY(0)} @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { .cx_whatsapp_btn.mobile { display: none; }} `;1==t.isBackground&&(p+=".cx_whatsapp_btn{ background:"+t.background_color+" ;}"),"left"==t.button_position?p+=".cx_whatsapp_btn{ left: 30px;}":p+=".cx_whatsapp_btn{ right: 30px;}",p+=`.cxSvgIcon{ fill:`+t.button_color+"}",p+=`.cxSvgIcon svg{ height: ${t.button_size}px; width: ${t.button_size}px; }`;let r=document.createElement("style");r.innerHTML=p,document.head.appendChild(r)}function applyCustomCss(t){let e=document.createElement("style");e.id="cx-musbu-custom-css",e.type="text/css",e.appendChild(document.createTextNode(t)),document.head.appendChild(e)}function injectCss(t){document.querySelector("#cx_whatsapp_init1");let e=/iPhone|iPod|Android/i.test(navigator.userAgent);function n(t){return parseInt(t)+90}let s=document.createElement("style");s.type="text/css";let a="";if(t&&!e&&t?.customDesktopSpacing&&("left"==t.desktopPosition?a+=` #cx_whatsapp_init .czm-speech-bubble, #cx_whatsapp_init .czm-popup { bottom: ${n(t.desktopSpacing1)}px !important; left: ${t.desktopSpacing2}px !important; } #cx_whatsapp_init .czm-button { bottom: ${t.desktopSpacing1}px !important; left: ${t.desktopSpacing2}px !important; } `:t?.desktopPosition=="right"&&(a+=` #cx_whatsapp_init .czm-speech-bubble, #cx_whatsapp_init .czm-popup { bottom: ${n(t.desktopSpacing1)}px !important; right: ${t.desktopSpacing2}px !important; } #cx_whatsapp_init .czm-button { bottom: ${t.desktopSpacing1}px !important; right: ${t.desktopSpacing2}px !important; } `)),"1"==t?.isPreset[0]&&"2"==t?.isCustomIcon[0]&&(a+=`#cx_whatsapp_init .czm-button-person-avatar svg { fill: #ffff }`),t?.isRounded&&(a+=`#cx_whatsapp_init .czm-button-person-avatar svg, .czm-popup-person-avatar svg{ border-radius: 50% }`),"3"==t?.isPreset[0]&&(a+=` #cx_whatsapp_init .czm-button { background: transparent !important; box-shadow: none !important; } .czm-button-person-avatar svg { width: 50px !important; height: 50px !important; } #cx_whatsapp_init .czm-pulse { display: none !important; }`),"1"==t?.isPreset[0]){let o=parseInt(t.presetId,10),i=gradients[o][0];a+=`.czm-popup-header{ background: ${i} !important }`}t&&e&&t.customMobileSpacing&&(t?.mobilePosition=="left"?a+=` #cx_whatsapp_init .czm-popup, #cx_whatsapp_init .czm-button { bottom: ${t.mobileSpacing1}px !important; left: ${t.mobileSpacing2}px !important; } `:t?.mobilePosition=="right"&&(a+=` #cx_whatsapp_init .czm-popup, #cx_whatsapp_init .czm-button { bottom: ${t.mobileSpacing1}px !important; right: ${t.mobileSpacing2}px !important; } `)),s.appendChild(document.createTextNode(a)),document.head.appendChild(s)}function isDisplayChatWidget(t){let{where_to_show:e,styling:n}=t;var s=n?.pageLinks,a=/iPhone|iPod|Android/i.test(navigator.userAgent);if("2"==t.mobile_view&&a)return!1;let o=window.location.href,i=window.location.origin+"/";function p(t){return t.replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,"")}let r=p(o),c=p(i);switch(e){case"all":return!0;case"home":return r==c;case"specific":return s.some(t=>p(t.page)==r);case"exclude":return!s.some(t=>p(t.page)==r);default:return!1}}function loadScript(t,e=null){return new Promise((n,s)=>{var a=document.createElement("script");a.src=t,e&&(a.integrity=e,a.crossOrigin="anonymous",a.referrerPolicy="no-referrer"),a.onload=n,a.onerror=s,document.head.appendChild(a)})}loadScript("https://code.jquery.com/jquery-3.6.0.min.js").then(()=>loadScript("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js","sha512-i2CVnAiguN6SnJ3d2ChOOddMWQyvgQTzm0qSgiKhOqBMGCx4fGU5BtzXEybnKatWPDkXPFyCI0lbG42BnVjr/Q==")).then(()=>loadScript("https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.28/moment-timezone-with-data.min.js")).then(()=>loadScript("https://cdn.shopify.com/s/files/1/0756/0599/9919/files/musbu-chat-support.min.js")).then(()=>loadScript("https://cdn.shopify.com/s/files/1/0756/0599/9919/files/cx-constant.js")).then(()=>{setTimeout(()=>{getSettings()},200)}).catch(t=>console.error("Error loading scripts: ",t));