1(function(){var LIVEX_BOT_ID="pub-d952c756-6b49-4d7d-8160-5a79d0a53595",LIVEX_ORIGIN="https://chatbox.copilot.livex.ai",LIVEX_SDK_URL=LIVEX_ORIGIN+"/livex.min.js",LIVEX_SUGGESTED_URL=LIVEX_ORIGIN+"/cdn/suggested-questions-widget/livex-suggested-questions.min.js",IDLE_FALLBACK_MS=5e3,READY_POLL_MAX_MS=3e4,COMPOSER_FOCUS_MAX_MS=1500,COMPOSER_FOCUS_INTERVAL_MS=50,loading=!1,watchingReady=!1,pendingCallbacks=[],readyPollId=null;function preconnectLivex(){if(!document.querySelector("link[data-wyze-livex-preconnect]")){var link=document.createElement("link");link.rel="preconnect",link.href=LIVEX_ORIGIN,link.crossOrigin="anonymous",link.setAttribute("data-wyze-livex-preconnect","true"),document.head.appendChild(link)}}function clearPendingCallbacks(){pendingCallbacks.length=0}function flushPendingCallbacks(){var callbacks=pendingCallbacks.slice();pendingCallbacks.length=0;for(var i=0;i<callbacks.length;i++)try{callbacks[i]()}catch(e){console.error("LiveX ready callback failed",e)}}function stopReadyPoll(){readyPollId!==null&&(clearInterval(readyPollId),readyPollId=null)}function removeLivexScripts(selector){for(var scripts=document.querySelectorAll(selector),i=0;i<scripts.length;i++)scripts[i].parentNode&&scripts[i].parentNode.removeChild(scripts[i])}function failLivexLoad(reason){stopReadyPoll(),loading=!1,watchingReady=!1,window.__wyzeLivexReady=!1,removeLivexScripts("script[data-wyze-livex-sdk], script[data-wyze-livex-suggested]"),clearPendingCallbacks(),window.dispatchEvent(new CustomEvent("livexLoadFailed",{detail:{reason:reason||"unknown"}}))}function isLivexComposerFocusable(el){if(!el||el.disabled||el.hidden||el.getAttribute("aria-hidden")==="true"||el.closest&&el.closest('[aria-hidden="true"]'))return!1;var style=window.getComputedStyle(el);if(style.display==="none"||style.visibility==="hidden"||style.opacity==="0")return!1;var rect=el.getBoundingClientRect();return rect.width>0&&rect.height>0}function queryInLivexRoots(selector){var host=document.querySelector("#livex-chatbox-root");if(!host)return null;if(host.querySelector){var light=host.querySelector(selector);if(light)return light}var roots=[];host.shadowRoot&&roots.push(host.shadowRoot);for(var descendants=host.querySelectorAll("*"),i=0;i<descendants.length;i++)descendants[i].shadowRoot&&roots.push(descendants[i].shadowRoot);for(var r=0;r<roots.length;r++){var hit=roots[r].querySelector(selector);if(hit)return hit}return null}function isLivexChatWindowOpen(){var container=queryInLivexRoots("#chatbox-container");if(container)return isLivexComposerFocusable(container);var cb=window.livexChatbot;return!!(cb&&typeof cb.openStatus=="function"&&cb.openStatus()==="open")}function queryLivexComposerInRoot(root){if(!root||!root.querySelector)return null;var preferred=root.querySelector('textarea.mantine-Textarea-input, textarea[placeholder="Type your message..."]');if(preferred&&isLivexComposerFocusable(preferred))return preferred;for(var textareas=root.querySelectorAll("textarea"),i=0;i<textareas.length;i++)if(isLivexComposerFocusable(textareas[i]))return textareas[i];for(var inputs=root.querySelectorAll("input"),j=0;j<inputs.length;j++){var input=inputs[j],type=(input.getAttribute("type")||"text").toLowerCase();if(!(type==="hidden"||type==="checkbox"||type==="radio"||type==="button"||type==="submit"||type==="file")&&isLivexComposerFocusable(input))return input}for(var editables=root.querySelectorAll('[contenteditable="true"]'),k=0;k<editables.length;k++)if(isLivexComposerFocusable(editables[k]))return editables[k];return null}function findLivexComposer(){var host=document.querySelector("#livex-chatbox-root");if(!host)return null;var found=queryLivexComposerInRoot(host);if(found)return found;var roots=[];host.shadowRoot&&roots.push(host.shadowRoot);for(var descendants=host.querySelectorAll("*"),i=0;i<descendants.length;i++)descendants[i].shadowRoot&&roots.push(descendants[i].shadowRoot);for(var r=0;r<roots.length;r++){if(found=queryLivexComposerInRoot(roots[r]),found)return found;for(var nested=roots[r].querySelectorAll("*"),n=0;n<nested.length;n++)if(nested[n].shadowRoot&&(found=queryLivexComposerInRoot(nested[n].shadowRoot),found))return found}return null}function focusLivexComposer(){var started=Date.now();function attempt(){if(isLivexChatWindowOpen()){var composer=findLivexComposer();if(composer){try{composer.focus()}catch{}return}}Date.now()-started>=COMPOSER_FOCUS_MAX_MS||setTimeout(attempt,COMPOSER_FOCUS_INTERVAL_MS)}requestAnimationFrame(function(){requestAnimationFrame(attempt)})}window.wyzeFocusLivexComposer=focusLivexComposer;function isFocusInsideLivexChatWindow(){var container=queryInLivexRoots("#chatbox-container");if(!container||!isLivexChatWindowOpen())return!1;var root=container.getRootNode&&container.getRootNode(),active=root&&root.activeElement;if(active&&container.contains(active))return!0;var host=document.querySelector("#livex-chatbox-root"),node=document.activeElement;return host&&node&&(node===host||host.contains(node))&&node.shadowRoot&&node.shadowRoot.activeElement?c
1ontainer.contains(node.shadowRoot.activeElement):!1}function closeLivexOnEscape(event){if(!(event.key!=="Escape"&&event.key!=="Esc")&&!event.defaultPrevented&&isFocusInsideLivexChatWindow()){var cb=window.livexChatbot;!cb||typeof cb.close!="function"||(event.preventDefault(),cb.close())}}document.addEventListener("keydown",closeLivexOnEscape);function emitLivexReady(){if(window.__wyzeLivexReady)return!0;var cb=window.livexChatbot;return!cb||typeof cb.addEventListener!="function"||typeof cb.getConversationId!="function"?!1:(window.__wyzeLivexReady=!0,stopReadyPoll(),window.dispatchEvent(new CustomEvent("livexReady")),flushPendingCallbacks(),!0)}function watchLivexReady(){if(window.__wyzeLivexReady){emitLivexReady();return}if(watchingReady){emitLivexReady();return}if(watchingReady=!0,!emitLivexReady()){var started=Date.now();readyPollId=setInterval(function(){emitLivexReady()||Date.now()-started>READY_POLL_MAX_MS&&failLivexLoad("ready_timeout")},50)}}function initLiveXIntegration(){if(!window.__wyzeLivexReady){var existingScript=document.querySelector("script[data-wyze-livex-sdk]");if(existingScript){loading=!0,watchLivexReady();return}if(!loading){loading=!0,preconnectLivex();var livexScript=document.createElement("script");if(livexScript.src=LIVEX_SDK_URL,livexScript.async=!0,livexScript.defer=!0,livexScript.setAttribute("data-bot-id",LIVEX_BOT_ID),livexScript.setAttribute("data-wyze-livex-sdk","true"),livexScript.onload=function(){watchLivexReady()},livexScript.onerror=function(){failLivexLoad("script_error")},document.head.appendChild(livexScript),!document.querySelector("script[data-wyze-livex-suggested]")){var suggestedQuestionsScript=document.createElement("script");suggestedQuestionsScript.type="module",suggestedQuestionsScript.src=LIVEX_SUGGESTED_URL,suggestedQuestionsScript.defer=!0,suggestedQuestionsScript.async=!0,suggestedQuestionsScript.setAttribute("data-bot-id",LIVEX_BOT_ID),suggestedQuestionsScript.setAttribute("data-wyze-livex-suggested","true"),document.head.appendChild(suggestedQuestionsScript)}}}}function ensureLivexLoaded(callback){if(typeof callback=="function"){if(window.__wyzeLivexReady&&window.livexChatbot){callback();return}pendingCallbacks.push(callback)}initLiveXIntegration()}window.wyzeEnsureLivexLoaded=ensureLivexLoaded,window.wyzeLoadLivexSdk=initLiveXIntegration;function scheduleDeferredLoad(){var started=!1,intentEvents=["pointerdown","touchstart"];function startOnce(){started||(started=!0,cleanupIntentListeners(),initLiveXIntegration())}function onIntent(){startOnce()}function cleanupIntentListeners(){for(var i2=0;i2<intentEvents.length;i2++)window.removeEventListener(intentEvents[i2],onIntent,!0)}for(var i=0;i<intentEvents.length;i++)window.addEventListener(intentEvents[i],onIntent,{capture:!0,passive:!0});function afterWindowLoad(){"requestIdleCallback"in window?requestIdleCallback(function(){startOnce()},{timeout:IDLE_FALLBACK_MS}):setTimeout(startOnce,IDLE_FALLBACK_MS)}document.readyState==="complete"?afterWindowLoad():window.addEventListener("load",afterWindowLoad,{once:!0})}scheduleDeferredLoad()})();var livexHandlerAttached=!1;function isAISearchVisible(){var aiSearchIcon=document.querySelector(".icon-search-ai-wrapper");return aiSearchIcon&&!aiSearchIcon.classList.contains("hidden")}function getLivexOrigin(el,fallbackOrigin){if(typeof window.wyzeGetLivexOriginFromElement=="function")return window.wyzeGetLivexOriginFromElement(el,fallbackOrigin);var origins=window.WYZE_LIVEX_ORIGIN||{};if(!el)return fallbackOrigin||origins.LIVEX_WIDGET||"LiveX widget";if(el.dataset&&el.dataset.livexOrigin)return el.dataset.livexOrigin;if(el.closest){var withOrigin=el.closest("[data-livex-origin]");if(withOrigin&&withOrigin.dataset&&withOrigin.dataset.livexOrigin)return withOrigin.dataset.livexOrigin}return fallbackOrigin||origins.LIVEX_WIDGET||"LiveX widget"}function prepareLivexOpenFromElement(triggerElement,fallbackOrigin){typeof window.wyzePrepareLivexOpen=="function"&&window.wyzePrepareLivexOpen({livexOriginElement:getLivexOrigin(triggerElement,fallbackOrigin)})}function prepareAskWyzeAssistantLivexOpen(btn){if(typeof window.wyzePrepareLivexOpen=="function"){var options=typeof window.wyzeGetAskWyzeAssistantLivexOptions=="function"?window.wyzeGetAskWyzeAssistantLivexOptions(btn):{livexOriginElement:getLivexOrigin(btn,"Ask Wyze Assistant")};window.wyzePrepareLivexOpen(options)}}function prepareSuggestedQuestionLivexOpen(triggerElement,questionText,fallbackOrigin){if(typeof window.wyzePrepareLivexOpen=="function"){var suggestedType=window.WYZE_LIVEX_MESSAGE_TYPE&&window.WYZE_LIVEX_MESSAGE_TYPE.SUGGESTED||"suggested",options=typeof window.wyzeGetSuggestedQuestionLivexOptions=="function"?window.wyzeGetSuggestedQuestionLivexOptions(triggerElement,questionText,fallbackOrigin,suggestedType):{livexOriginElement:getLivexOrigin(triggerElement,fallbackOrigin),livexMessage:(questionText||"").trim(),livexMessageType:suggestedType};window.wyzePrepareLivexOpen(options)}}function openLivexHybridSearchBar(){window.livexChatbot&&window.livexChatbot.setShowSearchBar(!0)}function attachLiveXHandler(){var inputDom=document.querySelector("summary#wyze-header-search, summary[data-search-toggle]");return!inputDom||livexHandlerAttached?!1:(inputDom.addEventListener("click",function(e){isAISearchVisible()&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),inputDom.blur(),prepareLivexOpenFromElement(inputDom,window.WYZE_LIVEX_ORIGIN&&window.WYZE_LIVEX_ORIGIN.HEADER_HYBRID_SEARCH||"Header hybrid search"),typeof window.wyzeEnsureLivexLoaded=="function"?window.wyzeEnsureLivexLoaded(function(){openLivexHybridSearchBar(),window.livexChatbot&&typeof window.livexChatbot.open=="function"&&(window.livexChatbot.open(),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer())}):openLivexHybridSearchBar())},!0),inputDom.addEventListener("focus",function(e){isAISearchVisible()&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.target.blur(),typeof window.wyzeEnsureLivexLoaded=="function"?window.wyzeEnsureLivexLoaded(function(){openLivexHybridSearchBar(),window.livexChatbot&&typeof window.livexChatbot.open=="function"&&(window.livexChatbot.open(),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer())}):openLivexHybridSearchBar())},!0),livexHandlerAttached=!0,!0)}function initializeLiveXSearchIntegration(){var inputDom=document.querySelector("summary#wyze-header-search, summary[data-search-toggle]");return inputDom?attachLiveXHandler():!1}function waitForABTestAndInitialize(){if(!initializeLiveXSearchIntegration()){var observer=new MutationObserver(function(){initializeLiveXSearchIntegration()});document.body&&observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]});var pollAttempts=0,maxAttempts=100,pollInterval=setInterval(function(){pollAttempts++,(initializeLiveXSearchIntegration()||pollAttempts>=maxAttempts)&&(clearInterval(pollInterval),observer.disconnect())},100)}}window.toggleSearchButton=function(type){var aiIcon=document.querySelector('.icon-search-ai-wrapper[data-search-type="ai"]'),standardIcon=document.querySelector('.icon-search-wrapper[data-search-type="standard"]');if(!aiIcon||!standardIcon){console.warn("Search icons not found");return}type==="ai"?(aiIcon.classList.remove("hidden"),standardIcon.classList.add("hidden"),setTimeout(function(){initializeLiveXSearchIntegration()},100)):type==="standard"?(aiIcon.classList.add("hidden"),standardIcon.classList.remove("hidden")):console.warn('Invalid search type. Use "ai" or "standard"')},window.toggleSuggestedQuestionsWidget=function(action){var mobileWidget=document.querySelector('suggested-questions-widget[data-location="mobile"]'),desktopWidget=document.querySelector('suggested-questions-widget[data-location="desktop"]');if(!mobileWidget||!desktopWidget){console.warn("Suggested questions widgets not found");return}action==="show"||action==="visible"?(mobileWidget.classList.remove("hidden"),mobileWidget.style.display="",desktopWidget.classList.remove("hidden"),desktopWidget.style.display=""):action==="hide"||action==="hidden"?(mobileWidget.classList.add("hidden"),desktopWidget.classList.add("hidden")):console.warn('Invalid action. Use "show" or "hide"')},window.livexDataLayer={initSetting:{onLoad:function(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",waitForABTestAndInitialize):waitForABTestAndInitialize()}}},window.initializeLiveXSearchIntegration=initializeLiveXSearchIntegration,window.waitForABTestAndInitialize=waitForABTestAndInitialize,window.openAiChatWithSearchQuery=function(btn
1){if(!(!btn||!btn.closest)){var searchEl=btn.closest("predictive-search");if(!(!searchEl||!searchEl.input)){prepareAskWyzeAssistantLivexOpen(btn);var runOpen=function(){var chatbot=window.livexChatbot;if(!(!chatbot||typeof chatbot.open!="function")){var query=searchEl.input.value.trim();if(searchEl._aiCtaHandler){try{chatbot.removeEventListener("afterOpen",searchEl._aiCtaHandler)}catch{}searchEl._aiCtaHandler=null}if(query&&typeof chatbot.sendMessage=="function"){var alreadyOpen=typeof chatbot.openStatus=="function"&&chatbot.openStatus()==="open";if(alreadyOpen){searchEl._aiCtaPendingMsg=null,chatbot.sendMessage(query),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer();return}else searchEl._aiCtaPendingMsg=query,searchEl._aiCtaHandler=function(){var bot=window.livexChatbot,msg=searchEl._aiCtaPendingMsg;if(searchEl._aiCtaPendingMsg=null,bot)try{bot.removeEventListener("afterOpen",searchEl._aiCtaHandler)}catch{}msg&&bot&&typeof bot.sendMessage=="function"&&bot.sendMessage(msg)},chatbot.addEventListener("afterOpen",searchEl._aiCtaHandler,{once:!0})}else searchEl._aiCtaPendingMsg=null,searchEl._aiCtaHandler=null;chatbot.open(),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer()}};if(!window.livexChatbot||typeof window.livexChatbot.open!="function"){typeof window.wyzeEnsureLivexLoaded=="function"&&window.wyzeEnsureLivexLoaded(runOpen);return}runOpen()}}};var LIVEX_PRODUCT_SUGGESTED_QUESTIONS_URL="https://chat.copilot.livex.ai/api/v1/product_suggested_questions/";window.openLivexWithMessage=function(message,triggerElement){var msg=(message||"").trim(),suggestedQuestionsOrigin=window.WYZE_LIVEX_ORIGIN&&window.WYZE_LIVEX_ORIGIN.HYBRID_SEARCH_SUGGESTED_QUESTIONS||"Hybrid search suggested questions";prepareSuggestedQuestionLivexOpen(triggerElement,msg,suggestedQuestionsOrigin);var runOpen=function(){var chatbot=window.livexChatbot;if(!(!chatbot||typeof chatbot.open!="function")){if(!msg||typeof chatbot.sendMessage!="function"){chatbot.open(),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer();return}var alreadyOpen=typeof chatbot.openStatus=="function"&&chatbot.openStatus()==="open";if(alreadyOpen){chatbot.sendMessage(msg),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer();return}var handler=function(){try{chatbot.removeEventListener("afterOpen",handler)}catch{}var bot=window.livexChatbot;bot&&typeof bot.sendMessage=="function"&&bot.sendMessage(msg)};chatbot.addEventListener("afterOpen",handler,{once:!0}),chatbot.open(),typeof window.wyzeFocusLivexComposer=="function"&&window.wyzeFocusLivexComposer()}};if(!window.livexChatbot||typeof window.livexChatbot.open!="function"){typeof window.wyzeEnsureLivexLoaded=="function"&&window.wyzeEnsureLivexLoaded(runOpen);return}runOpen()},window.hydrateLivexPredictiveSearchQuestions=function(root){if(!(!root||!root.querySelector)){var ul=root.querySelector("ul.predictive-search__ai-questions");if(ul){if(root._livexQuestionsAbort)try{root._livexQuestionsAbort.abort()}catch{}var ac=new AbortController;root._livexQuestionsAbort=ac,ul.innerHTML="",ul.setAttribute("hidden","");var agentId=root.getAttribute("data-agent-id")||"",productId=root.getAttribute("data-product-id")||"",productHandle=root.getAttribute("data-product-handle")||"",languageCode=(root.getAttribute("data-language-code")||"").trim(),numRaw=parseInt(root.getAttribute("data-num-questions")||"3",10),numQuestions=isNaN(numRaw)||numRaw<1?3:Math.min(numRaw,20);if(!(!agentId||!productId&&!productHandle)){var url=LIVEX_PRODUCT_SUGGESTED_QUESTIONS_URL+"?agent_id="+encodeURIComponent(agentId)+(productId?"&product_id="+encodeURIComponent(productId):"&product_handle="+encodeURIComponent(productHandle))+"&num_questions="+encodeURIComponent(String(numQuestions));languageCode&&(url+="&language_code="+encodeURIComponent(languageCode)),fetch(url,{signal:ac.signal,credentials:"omit",mode:"cors"}).then(function(res){if(!res.ok)throw new Error("livex suggested questions "+res.status);return res.json()}).then(function(data){var questions=data&&data.suggested_questions;if(!(!Array.isArray(questions)||!questions.length)){for(var sliced=questions.slice(0,numQuestions),i=0;i<sliced.length;i++){var text=sliced[i];if(text){var li=document.createElement("li"),btn=document.createElement("button");btn.type="button",btn.className="predictive-search__ai-question-pill",btn.textContent=text,btn.setAttribute("data-livex-suggested-question",text),btn.setAttribute("data-livex-origin",window.WYZE_LIVEX_ORIGIN&&window.WYZE_LIVEX_ORIGIN.HYBRID_SEARCH_SUGGESTED_QUESTIONS||"Hybrid search suggested questions"),btn.addEventListener("click",(function(q,pillBtn){return function(){typeof window.openLivexWithMessage=="function"&&window.openLivexWithMessage(q,pillBtn)}})(text,btn)),li.appendChild(btn),ul.appendChild(li)}}ul.children.length&&ul.removeAttribute("hidden")}}).catch(function(){})}}}},(function(){function initWidgetVisibilityManagement(){var widgetsEnabled=!1;function toggleSuggestedQuestionsVisibility(){const isMobile=window.innerWidth<750,mobileWidget=document.querySelector('suggested-questions-widget[data-location="mobile"]'),desktopWidget=document.querySelector('suggested-questions-widget[data-location="desktop"]');mobileWidget&&desktopWidget&&widgetsEnabled&&(isMobile?(mobileWidget.classList.remove("hidden"),desktopWidget.classList.add("hidden")):(mobileWidget.classList.add("hidden"),desktopWidget.classList.remove("hidden")))}var originalToggle=window.toggleSuggestedQuestionsWidget;originalToggle?window.toggleSuggestedQuestionsWidget=function(action){action==="show"||action==="visible"?widgetsEnabled=!0:(action==="hide"||action==="hidden")&&(widgetsEnabled=!1),originalToggle(action),widgetsEnabled&&toggleSuggestedQuestionsVisibility()}:window.toggleSuggestedQuestionsWidget=function(action){var mobileWidget=document.querySelector('suggested-questions-widget[data-location="mobile"]'),desktopWidget=document.querySelector('suggested-questions-widget[data-location="desktop"]');if(!mobileWidget||!desktopWidget){console.warn("Suggested questions widgets not found");return}action==="show"||action==="visible"?(widgetsEnabled=!0,mobileWidget.classList.remove("hidden"),mobileWidget.style.display="",desktopWidget.classList.remove("hidden"),desktopWidget.style.display="",toggleSuggestedQuestionsVisibility()):action==="hide"||action==="hidden"?(widgetsEnabled=!1,mobileWidget.classList.add("hidden"),desktopWidget.classList.add("hidden")):console.warn('Invalid action. Use "show" or "hide"')};let resizeTimeout;window.addEventListener("resize",function(){clearTimeout(resizeTimeout),resizeTimeout=setTimeout(toggleSuggestedQuestionsVisibility,100)});function initializeWidgets(){var mobileWidget=document.querySelector('suggested-questions-widget[data-location="mobile"]'),desktopWidget=document.querySelector('suggested-questions-widget[data-location="desktop"]');mobileWidget&&desktopWidget&&window.toggleSuggestedQuestionsWidget?(window.toggleSuggestedQuestionsWidget("show"),typeof window.wyzeBindSuggestedQuestionsWidgets=="function"&&window.wyzeBindSuggestedQuestionsWidgets(document)):setTimeout(initializeWidgets,200)}setTimeout(initializeWidgets,500)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initWidgetVisibilityManagement):setTimeout(initWidgetVisibilityManagement,0)})(); 2//# sourceMappingURL=/cdn/shop/t/766/assets/integration-livex-min.js.map?v=75334607056889321751789061009
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.