1(function(){if(window.__PreferredStoreEntryLoaded)return;window.__PreferredStoreEntryLoaded=!0;function getCookie(name){var value="; "+document.cookie,parts=value.split("; "+name+"=");return parts.length===2?decodeURIComponent(parts.pop().split(";").shift()):null}var shared=window.__PreferredStoreShared;if(!shared)return;function updateLabelsFromCookies(){var name=getCookie("preferred_store_location_name");if(name){var labels=document.querySelectorAll("[data-preferred-store-current-label]");!labels||!labels.length||labels.forEach(function(el){el.textContent=name})}}function retryLabelHydration(){var tries=0,t=setInterval(function(){tries++,updateLabelsFromCookies();var labels=document.querySelectorAll("[data-preferred-store-current-label]");(labels&&labels.length||tries>=20)&&clearInterval(t)},100)}function moveTriggerIntoHeader(){var cfg=window.__PreferredStoreConfig||{},targetSelector=String(cfg.headerTargetSelector||"").trim(),anchorPlacement=String(cfg.headerAnchorPlacement||"after").toLowerCase(),insertPosition=anchorPlacement==="before"?"beforebegin":"afterend";if(targetSelector){var trigger=document.querySelector(".preferred-store-trigger--side-tab[data-preferred-store-open]");if(trigger){var target=document.querySelector(targetSelector);target&&trigger.dataset.preferredStoreMountedTarget!==targetSelector&&(target.insertAdjacentElement(insertPosition,trigger),trigger.classList.remove("preferred-store-trigger--side-tab"),trigger.classList.add("preferred-store-trigger--header-inline"),trigger.dataset.preferredStoreMountedTarget=targetSelector)}}}function retryHeaderMount(){var tries=0,t=setInterval(function(){tries++,moveTriggerIntoHeader(),(document.querySelector(".preferred-store-trigger--header-inline")||tries>=30)&&clearInterval(t)},100)}function normalizeKey(s){return shared.normalizeKey(s)}function buildInStockSetFromLocations(locations){return shared.buildInStockSetFromLocations(locations)}function updatePickupStatusLine(){var statusEl=document.querySelector("[data-preferred-store-pickup-status]");if(statusEl){var selectedName=getCookie("preferred_store_location_name");if(!selectedName){statusEl.textContent="Choose a store to see pickup availability.";return}var ctx=window.__PreferredStoreProductContext||{},locations=ctx.locations||[],inStockSet=buildInStockSetFromLocations(locations),selectedKey=normalizeKey(selectedName),isInStock=!!inStockSet[selectedKey],PICKUP_ICON_AVAILABLE='<svg class="surface-pick-up-embed__in-stock-icon surface-pick-up-embed__svg-placeholder" width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M4.33346 10.5625L3.80311 11.0928L4.33344 11.6232L4.86379 11.0928L4.33346 10.5625ZM0.191824 7.48134L3.80311 11.0928L4.8638 10.0322L1.25251 6.4207L0.191824 7.48134ZM4.86379 11.0928L12.9888 2.96783L11.9281 1.90717L3.80313 10.0322L4.86379 11.0928Z"></path></svg>',PICKUP_ICON_UNAVAILABLE='<svg class="surface-pick-up-embed__out-of-stock-icon surface-pick-up-embed__svg-placeholder" width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M1.46967 2.53033L5.96967 7.03033L7.03033 5.96967L2.53033 1.46967L1.46967 2.53033ZM5.96967 7.03033L10.4697 11.5303L11.5303 10.4697L7.03033 5.96967L5.96967 7.03033ZM7.03033 7.03033L11.5303 2.53033L10.4697 1.46967L5.96967 5.96967L7.03033 7.03033ZM10.4697 1.46967L1.46967 10.4697L2.53033 11.5303L11.5303 2.53033L10.4697 1.46967Z"></path></svg>';statusEl.innerHTML=isInStock?"Pickup: "+PICKUP_ICON_AVAILABLE+'available at <span class="preferred-store-selected-name">'+selectedName+"</span>":"Pickup: "+PICKUP_ICON_UNAVAILABLE+'unavailable at <span class="preferred-store-selected-name">'+selectedName+"</span>"}}function retryPickupHydration(){var tries=0,t=setInterval(function(){tries++,updatePickupStatusLine(),(document.querySelector("[data-preferred-store-pickup-status]")||tries>=20)&&clearInterval(t)},100)}function getBaseUrl(){var s=document.currentScript||document.querySelector('script[src*="preferred-store-entry.js"]');return!s||!s.src?null:s.src.substring(0,s.src.lastIndexOf("/")+1)}function openDialogImmediately(){var dialog=document.querySelector("[data-preferred-store-dialog]");if(dialog){typeof dialog.showModal=="function"?dialog.open||dialog.showModal():dialog.setAttribute("open","open");var loadingEl=dialog.querySelector("[data-preferred-store-loading]");loadingEl&&(loadingEl.textContent="Loading stores\u2026")}}function loadMain(){return new Promise(function(resolve,reject){if(window.__PreferredStoreAPI&&typeof window.__PreferredStoreAPI.open=="function"){resolve();return}if(window.__PreferredStoreMainLoading){var check=setInterval(function(){window.__PreferredStoreAPI&&typeof window.__PreferredStoreAPI.open=="function"&&(clearInterval(check),resolve())},50);setTimeout(function(){clearInterval(check),reject(new Error("Preferred store: main load timeout"))},8e3);return}window.__PreferredStoreMainLoading=!0;var cfg=window.__PreferredStoreConfig||{},configuredMainUrl=cfg.mainScriptUrl?String(cfg.mainScriptUrl).trim():"",base=getBaseUrl(),mainSrc=configuredMainUrl;if(!mainSrc){if(!base){reject(new Error("Preferred store: cannot determine assets base URL"));return}mainSrc=base+"russo-preferred-store-main.js?v="+Date.now()}var script=document.createElement("script");script.src=mainSrc,script.async=!0,script.defer=!0,script.onload=function(){resolve()},script.onerror=function(){reject(new Error("Preferred store: failed to load main"))},document.head.appendChild(script)})}function toUniqueList(items){return shared.toUniqueList(items)}function fetchJsonWithFallback(urls,requestInit){return shared.fetchJsonWithFallback(urls,requestInit,{errorPrefix:"Batch stock request failed"})}function collectBatchVariantIds(){var triggers=document.querySelectorAll('[data-preferred-store-variant-trigger][data-auto-status-fetch="false"]'),ids=[];
1return triggers.forEach(function(node){var id=node&&node.dataset?node.dataset.preferredStoreVariantId:null;if(id){var normalized=String(id).trim();/^\d+$/.test(normalized)&&ids.push(normalized)}}),toUniqueList(ids)}function clearPickupIcon(root){var iconRoot=root.querySelector(".preffered-store-pickup__status-icon");iconRoot&&(iconRoot.innerHTML="")}function setPickupIcon(root,inStock){var iconRoot=root.querySelector(".preffered-store-pickup__status-icon");if(iconRoot){if(inStock===!0){iconRoot.innerHTML='<svg class="surface-pick-up-embed__in-stock-icon" width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M4.33346 10.5625L3.80311 11.0928L4.33344 11.6232L4.86379 11.0928L4.33346 10.5625ZM0.191824 7.48134L3.80311 11.0928L4.8638 10.0322L1.25251 6.4207L0.191824 7.48134ZM4.86379 11.0928L12.9888 2.96783L11.9281 1.90717L3.80313 10.0322L4.86379 11.0928Z"></path></svg>';return}if(inStock===!1){iconRoot.innerHTML='<svg class="surface-pick-up-embed__out-of-stock-icon" width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M1.46967 2.53033L5.96967 7.03033L7.03033 5.96967L2.53033 1.46967L1.46967 2.53033ZM5.96967 7.03033L10.4697 11.5303L11.5303 10.4697L7.03033 5.96967L5.96967 7.03033ZM7.03033 7.03033L11.5303 2.53033L10.4697 1.46967L5.96967 5.96967L7.03033 7.03033ZM10.4697 1.46967L1.46967 10.4697L2.53033 11.5303L11.5303 2.53033L10.4697 1.46967Z"></path></svg>';return}iconRoot.innerHTML=""}}function setPickupLabel(root,text){var label=root.querySelector("[data-preferred-store-product-label]");label&&(label.textContent=text)}function setPickupLabelContent(root,payload){var label=root.querySelector("[data-preferred-store-product-label]");if(label){var specialOrder=root.querySelector("[data-preferred-store-special-order-note]"),specialOrderLabel=root.querySelector("[data-preferred-store-special-order-label]"),specialOrderTitle=root.querySelector("[data-preferred-store-special-order-tooltip-title]"),specialOrderBody=root.querySelector("[data-preferred-store-special-order-tooltip-body]"),data=payload||{};if(data.showSpecialOrder&&specialOrder){label.hidden=!0,specialOrder.hidden=!1,specialOrder.classList.remove("preferred-store-special-order-note--hidden"),specialOrderLabel&&(specialOrderLabel.textContent=data.specialOrderLabel||data.text||"Special Order"),specialOrderTitle&&(specialOrderTitle.textContent=data.specialOrderTitle||data.specialOrderLabel||data.text||"Special Order"),specialOrderBody&&(specialOrderBody.textContent=data.specialOrderBody||"");return}label.hidden=!1,specialOrder&&(specialOrder.hidden=!0,specialOrder.classList.add("preferred-store-special-order-note--hidden")),label.textContent=data.text||""}}function parseVariantIdFromGid(gid){return shared.parseVariantIdFromGid(gid)}function inventoryLevelNodes(levels){return shared.inventoryLevelNodes(levels)}function extractVariantNodes(data){return shared.extractVariantNodes(data)}function toLocationNameFromStockItem(item){return shared.toLocationNameFromStockItem(item)}function toAvailableQtyFromStockItem(item){return shared.toAvailableQtyFromStockItem(item)}function buildStockMaps(items){return shared.buildStockMaps(items)}function addLocationIdCandidates(target,locationId){return shared.addLocationIdCandidates(target,locationId)}function getStockLookupCandidates(selectedName,selectedId){return shared.getStockLookupCandidates(selectedName,selectedId)}function getLiveStockForSelectedStore(mapped,selectedName,selectedId){return shared.getLiveStockForSelectedStore(mapped,selectedName,selectedId)}function buildPreferredStoreStatusLabel(options){if(shared&&typeof shared.buildPreferredStoreStatusLabel=="function")return shared.buildPreferredStoreStatusLabel(options);var opts=options||{};return{text:String(opts.defaultLabel||"Choose a Store"),showSpecialOrder:!1,specialOrderLabel:"",specialOrderTitle:"",specialOrderBody:""}}function hydrateBatchPickupStatuses(){var triggers=document.querySelectorAll('[data-preferred-store-variant-trigger][data-auto-status-fetch="false"]');if(triggers.length){var selectedName=getCookie("preferred_store_location_name"),selectedId=getCookie("preferred_store_location_id"),cache=window.__PreferredStoreVariantStockCache||{};
1triggers.forEach(function(root){var defaultLabel=root.dataset&&root.dataset.preferredStoreDefaultLabel?String(root.dataset.preferredStoreDefaultLabel):"Choose a Store",unavailableDisplayMode=root.dataset&&root.dataset.preferredStoreUnavailableDisplayMode?String(root.dataset.preferredStoreUnavailableDisplayMode):"custom_tooltip",unavailableLabel=root.dataset&&root.dataset.preferredStoreUnavailableLabel?String(root.dataset.preferredStoreUnavailableLabel):"Special Order",unavailableTooltipTitle=root.dataset&&root.dataset.preferredStoreUnavailableTooltipTitle?String(root.dataset.preferredStoreUnavailableTooltipTitle):unavailableLabel,unavailableTooltipBody=root.dataset&&root.dataset.preferredStoreUnavailableTooltipBody?String(root.dataset.preferredStoreUnavailableTooltipBody):"Unavailable at {store}. Typical Lead Time is 2-5 Business days.",variantId=root.dataset?String(root.dataset.preferredStoreVariantId||"").trim():"";if(!selectedName){setPickupLabelContent(root,buildPreferredStoreStatusLabel({status:"default",defaultLabel:defaultLabel})),clearPickupIcon(root);return}if(!variantId||!cache[variantId]){setPickupLabelContent(root,buildPreferredStoreStatusLabel({status:"default",defaultLabel:""})),clearPickupIcon(root);return}var live=getLiveStockForSelectedStore(cache[variantId],selectedName,selectedId);if(!live){setPickupLabelContent(root,buildPreferredStoreStatusLabel({status:"unknown",selectedName:selectedName,defaultLabel:defaultLabel})),clearPickupIcon(root);return}setPickupIcon(root,live.inStock),setPickupLabelContent(root,buildPreferredStoreStatusLabel({status:live.inStock?"available":"unavailable",selectedName:selectedName,defaultLabel:defaultLabel,unavailableDisplayMode:unavailableDisplayMode,unavailableLabel:unavailableLabel,unavailableTooltipTitle:unavailableTooltipTitle,unavailableTooltipBody:unavailableTooltipBody}))})}}function mergeBatchResponseIntoVariantCache(data){var variantNodes=data.data.nodes;if(variantNodes.length){var cache=window.__PreferredStoreVariantStockCache||{};variantNodes.forEach(function(variantNode){if(!(!variantNode||typeof variantNode!="object")){var variantId=parseVariantIdFromGid(variantNode.id)||String(variantNode.id||"").trim();if(variantId){var levels=inventoryLevelNodes(variantNode.inventoryItem&&variantNode.inventoryItem.inventoryLevels);cache[String(variantId)]=buildStockMaps(levels)}}}),window.__PreferredStoreVariantStockCache=cache}}function batchProbeVariantStock(){var variantIds=collectBatchVariantIds();if(variantIds.length){var state=window.__PreferredStoreBatchProbeState||{},signature=variantIds.join(",");if(!(state.inFlight&&state.signature===signature)&&state.lastSuccessSignature!==signature){state.inFlight=!0,state.signature=signature,window.__PreferredStoreBatchProbeState=state;var cfg=window.__PreferredStoreConfig||{},endpoints=[cfg.stockLevelsEndpoint||"/apps/russoAPI/v2/getStockLevels"],requestInit={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({variantIds:variantIds,variant_ids:variantIds})};fetchJsonWithFallback(endpoints,requestInit).then(function(result){state.inFlight=!1,state.lastSuccessSignature=signature,window.__PreferredStoreBatchProbeState=state,window.__PreferredStoreBatchStockResponse=result.data,mergeBatchResponseIntoVariantCache(result.data),hydrateBatchPickupStatuses()}).catch(function(err){state.inFlight=!1,window.__PreferredStoreBatchProbeState=state})}}}var batchRefreshTimer=null;function scheduleBatchRefresh(){batchRefreshTimer||(batchRefreshTimer=setTimeout(function(){batchRefreshTimer=null,batchProbeVariantStock(),hydrateBatchPickupStatuses()},120))}function observeTriggerInsertions(){if(!(typeof MutationObserver!="function"||!document.body)){var observer=new MutationObserver(function(mutations){for(var shouldRefresh=!1,i=0;i<mutations.length;i+=1){var mutation=mutations[i];if(!(!mutation.addedNodes||!mutation.addedNodes.length)){for(var j=0;j<mutation.addedNodes.length;j+=1){var node=mutation.addedNodes[j];if(!(!node||node.nodeType!==1)){if(node.matches&&node.matches("[data-preferred-store-variant-trigger]")){shouldRefresh=!0;break}if(node.querySelector&&node.querySelector("[data-preferred-store-variant-trigger]")){shouldRefresh=!0;break}}}if(shouldRefresh)break}}shouldRefresh&&scheduleBatchRefresh()});observer.observe(document.body,{childList:!0,subtree:!0})}}function ensureMainThenOpen(options){openDialogImmediately(),loadMain().then(function(){window.__PreferredStoreAPI&&typeof window.__PreferredStoreAPI.open=="function"&&window.__PreferredStoreAPI.open(options||{})}).catch(function(e){})}window.__PreferredStoreOpen=function(options){if(options&&options.variantId){var ctx=window.__PreferredStoreProductContext||{};ctx.variantId=String(options.variantId),Array.isArray(options.locations)&&(ctx.locations=options.locations),window.__PreferredStoreProductContext=ctx}ensureMainThenOpen(options||{})},updateLabelsFromCookies(),retryLabelHydration(),moveTriggerIntoHeader(),retryHeaderMount(),updatePickupStatusLine(),retryPickupHydration(),batchProbeVariantStock(),hydrateBatchPickupStatuses(),observeTriggerInsertions(),document.addEventListener("preferred-store-drawer:close",function(){updatePickupStatusLine(),hydrateBatchPickupStatuses()}),document.addEventListener("DOMContentLoaded",function(){updateLabelsFromCookies(),retryLabelHydration(),moveTriggerIntoHeader(),retryHeaderMount(),updatePickupStatusLine(),retryPickupHydration(),batchProbeVariantStock(),hydrateBatchPickupStatuses()}),document.addEventListener("shopify:section:load",function(){updateLabelsFromCookies(),retryLabelHydration(),moveTriggerIntoHeader(),retryHeaderMount(),updatePickupStatusLine(),retryPickupHydration(),batchProbeVariantStock(),hydrateBatchPickupStatuses()}),document.addEventListener("click",function(e){var trigger=e.target&&e.target.closest&&e.target.closest("[data-preferred-store-open]");trigger&&(trigger.dataset&&trigger.dataset.preferredStoreDirect==="true"||(e.preventDefault(),e.stopPropagation(),ensureMainThenOpen({source:"delegated-trigger",skipStockLookup:!0}
1)))},!0)})(); 2//# sourceMappingURL=/cdn/shop/t/149/assets/russo-preferred-store-entry.js.map?v=32170072646769249481790109550
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.