(function(){if(typeof window.CustomEvent==="function")return!1;function CustomEvent(event,params){params=params||{bubbles:!1,cancelable:!1,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt} CustomEvent.prototype=window.Event.prototype;window.CustomEvent=CustomEvent;if(!('remove' in Element.prototype)){Element.prototype.remove=function(){if(this.parentNode){this.parentNode.removeChild(this)}}}})();var tomitStorageSystem={now:function(){var date=new Date().getTime();return parseInt(date/1000)},get:function(key){var entry=JSON.parse(localStorage.getItem(key)||"0");if(!entry)return null;if(entry.ttl&&entry.ttl+entry.now=1){e.classList.add('tomitIsInStock')}else{e.classList.add('tomitIsOutOfStock')} var radioSelectBtn="";if(t[o].pickupOption==!0&&(ShopifyAnalytics.meta.page.pageType=="product"||force==!0)&&usePickup==!0){hasPickupOptions=!0;var pickupDisabled='';var selectedLoc=tomitStorageSystem.get("TomITSelectedLocation");pickupStyle='';if(t[o].inStock==0){pickupDisabled='disabled';pickupStyle='style="opacity:.8";'} var atcBtn=document.querySelector("form[action='/cart/add'] button[name='add']")==null?document.querySelector("form[action='/cart/add'] input[name='add']"):document.querySelector("form[action='/cart/add'] button[name='add']");if(atcBtn==null){var atcBtn=document.querySelector("button[name='add']")==null?document.querySelector("form input[name='add']"):document.querySelector("button[name='add']")} if(t[o].inStock<=0&&(selectedGlobalLocation!=null&&selectedGlobalLocation==t[o].id)){if(atcBtn.disabled==!1){if(this.buttonDisabled==!1){this.originalButton=atcBtn.cloneNode(!0)} this.buttonDisabled=!0;atcBtn.setAttribute("disabled","disabled");atcBtn.innerHTML="No inventory in your location"}}else if(t[0].inStock==1&&this.buttonDisabled==!0){console.log("re-enable");atcBtn.parentNode.replaceChild(this.originalButton,atcBtn);this.buttonDisabled=!1} var checked='';if((selectedLoc=="pickup "+t[o].name&&t[o].inStock!=0)&&(selectedGlobalLocation==null||selectedGlobalLocation==t[o].id)){checked='checked'} radioSelectBtn='';e.innerHTML="",n.appendChild(e)}else{if(t[o].available==""||t[o].available==""||t[o].available==""){e.innerHTML=""+t[o].name,n.appendChild(e)+""}else{e.innerHTML=""+t[o].name+": "+t[o].available+"",n.appendChild(e)}}}}} if(hasPickupOptions){if(useDropdown){var e=document.createElement("select");e.onchange=tomitProductInventoryInfo.TomITChangeHandler;e.name='properties[Shipping Option]';var firstOption=document.createElement('option');firstOption.text='Ship To Me';e.appendChild(firstOption);for(var i=0;i Ship To Me';e.innerHTML=radioSelectBtn;n.prepend(e)}} return n},showCollectionInventory(selector,addAfter,productIds,display=!0){tomitProductInventoryInfo.getProductsInventoryInformation(productIds).then(function(e){tomitProductInventoryInfo.latestCollectionData=e;var items=document.querySelectorAll(selector);for(var i=0;i9?openHours:"0"+openHours;let openMinutes=timings.open.minutes||0;openMinutes=openMinutes>9?openMinutes:"0"+openMinutes;let closeHours=timings.close.hours||0;closeHours=closeHours>9?closeHours:"0"+closeHours;let closeMinutes=timings.close.minutes||0;closeMinutes=closeMinutes>9?closeMinutes:"0"+closeMinutes;openTime+=openHours>11?(openHours%12)+":"+openMinutes+"pm":openHours+":"+openMinutes+"am";closeTime+=closeHours>11?(closeHours%12)+":"+closeMinutes+"pm":closeHours+":"+closeMinutes+"am";time=openTime+"-"+closeTime;let closed=businessHour.closed?" (Closed)":"";if(businessHour.closed==!0){detail=''+businessHour.day+' : '+closed+''}else{detail=''+businessHour.day+' : '+time+''} return detail},attachVariantInformationOnGoogleMapEvents:function(){if(document.getElementById("inventoryLocation-store-pickup-button")){document.getElementById("inventoryLocation-store-pickup-button").addEventListener("click",function(){var n=document.getElementById("inventoryLocationInformationModal");n.style.display='block'})} if(document.querySelector('.inventoryLocation-information-modal-close')){document.querySelector('.inventoryLocation-information-modal-close').addEventListener("click",function(){var n=document.getElementById("inventoryLocationInformationModal");n.style.display='none'})}},updateInventoryInfo:function(e){var displayedProducts=document.querySelectorAll('[data-product-id]');var elements=document.getElementsByClassName('tomitOutOfStockMessage');while(elements.length>0){elements[0].parentNode.removeChild(elements[0])} for(var i=0;i0){allOutOfStock=!1}}}} if(allOutOfStock){var inv=document.createElement('div');inv.innerText="Out of Stock";inv.classList.add('tomitOutOfStockMessage');displayedProducts[i].querySelector('.tomit_inventory_list').appendChild(inv)}}}},TomITChangeHandler:function(e){tomitStorageSystem.set("TomITSelectedLocation",e.target.value)},getProductsLocations:function(){return new Promise(function(n,o){let e="https://inventorylocations.checkmyapp.net/api/locations/information/"+Shopify.shop,r=new XMLHttpRequest();r.open("GET",e,!0),r.onload=function(){if(200===r.status){var t=JSON.parse(r.responseText);n(t)}else o("error")},r.send()})},listInventoryCart:function(t,useDropdown){var n=document.getElementById("tomit_inventory_list_cart");if(n===null){n=document.createElement("ul");n.id="tomit_inventory_list_cart"} var options=[];var selectoption;t=Object.values(t);var selectedOption=tomitStorageSystem.get("TomITSelectedLocation");for(var o=0;o';e.innerHTML="";n.appendChild(e)}}} if(useDropdown){var e=document.getElementsByName('properties_shipping_option');if(!e.length){labelHolder=document.createElement("label");labelHolder.innerHTML="Select Shipping or Store Pickup Option
";e=document.createElement("select");e.name='properties_shipping_option'} var blankOption=document.createElement('option');blankOption.text='Select location';blankOption.disabled=!0;e=typeof e[0]!=="undefined"?e[0]:e;e.appendChild(blankOption);var firstOption=document.createElement('option');firstOption.text='ship to me';e.appendChild(firstOption);for(var i=0;i Ship to me';e.innerHTML=radioSelectBtn;n.prepend(e)}} return n},validateCart:function(id){var validLocations=[];tomitProductInventoryInfo.getCartItems().then(function(e){var productIds=[];e.items.forEach(function(item){productIds.push(item.product_id)});tomitProductInventoryInfo.getProductsInventoryInformation(productIds).then(function(inventoryProduct){var productCount=1;e.items.forEach(function(i){var variantLocations=[];inventoryProduct[i.product_id].product.variants[i.id].inventoryItem.locations.forEach(function(location){if(location.q>=i.quantity){if(productCount==1){validLocations.push(location.id)}}else{if(validLocations.includes(location.id)){for(var x=0;x1){variantLocations.push(location.id)}});if(productCount>1){validLocations.forEach(function(val){if(!variantLocations.includes(val)){for(var x=0;x0){elements[0].parentNode.removeChild(elements[0])}} if(productList!=null){productList.forEach(function(item){productIds.push(item.getAttribute('data-tomit-product-id'))});tomitProductInventoryInfo.getProductsInventoryInformation(productIds).then(function(e){document.querySelectorAll('[data-tomit-variant-id]').forEach(function(a){var prodId=parseInt(a.getAttribute('data-tomit-product-id'));var variantId=a.getAttribute('data-tomit-variant-id');if(e[prodId]!=undefined&&e[prodId].product.variants!=undefined){if(e[prodId].product.variants[variantId]!=undefined){a.append(tomitProductInventoryInfo.listInventory(e[prodId].product.variants[variantId].inventoryItem.locations,!1,!0))}}})})}},editMaxQuantity:function(locations){var max=locations[0].q;tomitProductInventoryInfo.getCartItems().then(function(e){e.items.forEach(function(e){if(e.id==tomitProductInventoryInfo.selectedVariantId){max=locations[0].q-e.quantity}});var qty=document.querySelectorAll("input[type='number'][name='quantity']");qty[0].max=max if(max<1){qty[0].min=0;qty[0].value=0;qty[0].disabled=!0 let small=document.createElement("small");small.className='MaxQuantity';small.style.fontSize='70%';small.innerHTML="Max quantity in cart";qty[0].after(small)}})},showWarningOnCartPage:function(id){tomitProductInventoryInfo.getCartItems().then(function(cart){var multiplePickup=!1;cart.items.forEach(function(e){if(e.properties["Shipping Option"]!=cart.items[0].properties["Shipping Option"]){multiplePickup=!0}});if(multiplePickup==!0){var firstdiv=document.createElement("div");var div=document.createElement("div");var strong=document.createElement("strong");var small=document.createElement("small");firstdiv.style.width='100%';firstdiv.appendChild(div);strong.innerHTML="Different pick-up locations are selected";small.innerHTML="Please make sure to only select one pickup location";div.id='multiplePickupWarning';var checkout=document.getElementsByName("checkout");div.append(strong);if(id==undefined){checkout[0].parentNode.insertBefore(firstdiv,checkout[0])}else{document.getElementById(id).append(firstdiv)} strong.append(small);var css='#multiplePickupWarning {background-color: #ffffd7; border: 1px solid gray;width: 100%;margin-bottom: 10px;padding: 7px; font-size: .8em; border-radius:10px; text-align:center;} #multiplePickupWarning small { display:block;}';var styleSheet=document.createElement("style");styleSheet.type="text/css";styleSheet.innerText=css;document.head.appendChild(styleSheet)}})},ShowInventoryOnCollection:function(){if(typeof(ShopifyAnalytics.meta.page)!="undefined"){if(ShopifyAnalytics.meta.page.pageType=="collection"){let productIds=[];var productList=document.querySelectorAll('[data-tomit-variant-id]');if(productList!=null){productList.forEach(function(item){productIds.push(item.getAttribute('data-tomit-product-id'))});tomitProductInventoryInfo.getProductsInventoryInformation(productIds).then(function(e){document.querySelectorAll('[data-tomit-variant-id]').forEach(function(a){var prodId=parseInt(a.getAttribute('data-tomit-product-id'));var variantId=a.getAttribute('data-tomit-variant-id');if(e[prodId]!=undefined&&e[prodId].product.variants!=undefined){if(e[prodId].product.variants[variantId]!=undefined){a.append(tomitProductInventoryInfo.listInventory(e[prodId].product.variants[variantId].inventoryItem.locations,!1,!0))}}})})}}}},getCartItems:function(){return new Promise(function(n,o){let e="/cart.js",r=new XMLHttpRequest();r.open("GET",e,!0),r.onload=function(){if(200===r.status){var t=JSON.parse(r.responseText);n(t)}else o("error")},r.send()})},sendBenchMark:async function(shopUrl,startTime,endTime,cached){var url=`https://inventorylocations.checkmyapp.net/benchmark/${shopUrl}/${startTime}/${endTime}/${cached}`;var xmlHttp=new XMLHttpRequest();xmlHttp.open("GET",url,!0);xmlHttp.send(null);return xmlHttp.responseText},listLocationsInformation:function(t){let obj=document.getElementById('tomit_inventory_locations_list');if(obj)obj.remove();let n=document.createElement("ul");n.id="tomit_inventory_locations_list";for(var o=0;o=1){e.classList.add('tomitIsInStock')}else{e.classList.add('tomitIsOutOfStock')} var radioSelectBtn="";radioSelectBtn='';e.innerHTML="";n.appendChild(e)}} return n},requestLocation:function(){var product=ShopifyAnalytics.meta.product;getProductInventoryInformation(product.id);if(tomitProductInventoryInfo.customerPos!='0,0'){if(typeof ShopifyAnalytics!="undefined"&&"product"==ShopifyAnalytics.meta.page.pageType&&null!=document.getElementById("inventoryLocationInformation")){var product=ShopifyAnalytics.meta.product;getProductInventoryInformation(product.id)}}else{if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position,that){tomitStorageSystem.set("tomitProductInventoryInfo.customerPos",position.coords.latitude+","+position.coords.longitude,86400);tomitProductInventoryInfo.customerPos=position.coords.latitude+","+position.coords.longitude;if(typeof ShopifyAnalytics!="undefined"&&"product"==ShopifyAnalytics.meta.page.pageType&&null!=document.getElementById("inventoryLocationInformation")){var product=ShopifyAnalytics.meta.product;getProductInventoryInformation(product.id)}},function(){if(typeof ShopifyAnalytics!="undefined"&&"product"==ShopifyAnalytics.meta.page.pageType&&null!=document.getElementById("inventoryLocationInformation")){var product=ShopifyAnalytics.meta.product;getProductInventoryInformation(product.id)}})}}},showCurrentVariantInformation:function(t,selectVariantId=!1){var n=document.getElementById("inventoryLocationInformation");if(selectVariantId!=!1){this.selectedVariantId=selectVariantId;o=tomitProductInventoryInfo.activeProduct.variants[selectVariantId]}else{if(typeof window.location.search.split('variant=')[1]!='undefined'){var urlVariantId=window.location.search.split('variant=')[1].split('&')[0];if(typeof t.variants[urlVariantId]=='undefined'){tomitProductInventoryInfo.getVariantInventory(urlVariantId).then(function(e){if(typeof e.product.variants[urlVariantId]!=='undefined'){t.variants[urlVariantId]=e.product.variants[urlVariantId];tomitProductInventoryInfo.showCurrentVariantInformation(t)}}).catch(function(error){});return!1} var o=t.variants[urlVariantId]}else if(typeof ShopifyAnalytics!="undefined"&&ShopifyAnalytics.meta.hasOwnProperty("selectedVariantId")&&""!=ShopifyAnalytics.meta.selectedVariantId&&t.variants[ShopifyAnalytics.meta.selectedVariantId]!=null){var o=t.variants[ShopifyAnalytics.meta.selectedVariantId]}else if(typeof ShopifyAnalytics!="undefined"&&ShopifyAnalytics.meta.page.pageType=='product'){o=t.variants[ShopifyAnalytics.meta.product.variants[0].id]}else{return!1} this.selectedVariantId=o.id} var e=document.getElementById("tomit_inventory_list");if(e&&e.remove(),null!=o.inventoryItem&&null==o.inventoryItem.locations||null!=o.inventoryItem&&0==o.inventoryItem.locations.length){(r=n.getElementsByClassName("inventoryLocationLoading")[0])&&r.remove();n.style.display='none'}else{if(document.body.contains(document.getElementById('no_inventory_found_message'))){document.getElementById('no_inventory_found_message').remove()} var r,i=this.listInventory(o.inventoryItem.locations,t.useDropdown);(r=n.getElementsByClassName("inventoryLocationLoading")[0])&&r.remove(),n.appendChild(i),n.style.display='block'} console.log("variant changed");var ev=new CustomEvent("tomitVariantChanged",{detail:{message:'variant changed'},bubbles:!0,cancelable:!0});document.dispatchEvent(ev)},appendVariantInformationOnPopupStyle:function(){var css=`.inventoryLocation-information-modal{display:none;position:fixed;z-index:50;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.4)}#select-store{position:absolute;bottom:20px;right:20px}[data-inventory-map]{height:400px}.inventoryLocation-information-modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:80%;position:relative;bottom:20px;right:20px}.inventoryLocation-information-modal-close{color:#aaa;float:right;font-size:28px;font-weight:700;position:absolute;top:0;right:3.75%}.inventoryLocation-information-modal-close:focus,.inventoryLocation-information-modal-close:hover{color:#000;text-decoration:none;cursor:pointer}.map-section-wrapper{padding-top:15px}@media only screen and (max-width:600px){#inventoryLocationInformationModalBody{margin-left:10%;width:90%}#select-store{position:absolute;width:90%}#tomit_inventory_list{padding-bottom:40px}.inventoryLocation-information-modal-close{position:absolute;top:0;right:5%}.map-section-wrapper{padding-top:5%}}`,head=document.head||document.getElementsByTagName('head')[0];if(!document.getElementById('inventoryLocation-information-modal-style')){var style=document.createElement('style');head.appendChild(style);style.type='text/css';style.id='inventoryLocation-information-modal-style';if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}}},setCartItemsShippingProperty:function(shippingOption,redirect=!0){let xmlhttp=new XMLHttpRequest();xmlhttp.open('GET','/cart.js',!0);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){let cart=JSON.parse(xmlhttp.responseText);let cartItems=cart.items.map(function(item,index){return{line:index+1,properties:{"Shipping Option":shippingOption},quantity:item.quantity}});tomitProductInventoryInfo.tomitCartItemsQueue=[];for(var i=0;inew Promise((n,o)=>{var e="https://inventorylocations.checkmyapp.net/pickup/cart/"+Shopify.shop+"/"+JSON.stringify(t),r=new XMLHttpRequest;r.open("GET",e,!0),r.onload=function(){if(200===r.status){var t=JSON.parse(r.responseText);n(t)}else o("error")},r.send()}),listInventoryPopup:function(t,useDropdown){var n=document.createElement("ul");n.id="tomit_inventory_list";var hasPickupOptions=!1;var options=[];var selectoption;for(var o=0;o ';e.innerHTML="",n.appendChild(e)}else{e.innerHTML=""+t[o].name+": "+t[o].available+"",n.appendChild(e)}}} if(hasPickupOptions){if(useDropdown){var e=document.createElement("select");e.name='properties[Shipping Option]';var firstOption=document.createElement('option');firstOption.text='ship to me';e.appendChild(firstOption);for(var i=0;i '+inputText+'';e.innerHTML=radioSelectBtn;n.prepend(e)}} return n},showCurrentVariantInformationOnPopupModal:function(t){var n=document.getElementById("inventoryLocationInformation");if(typeof ShopifyAnalytics!="undefined"&&""!=ShopifyAnalytics.meta.selectedVariantId&&t.variants[ShopifyAnalytics.meta.selectedVariantId]!=null&&typeof window.location.search.split('variant=')[1]=='undefined')var o=t.variants[ShopifyAnalytics.meta.selectedVariantId];else if(typeof window.location.search.split('variant=')[1]!='undefined')var o=t.variants[window.location.search.split('variant=')[1]];else o=t.variants[ShopifyAnalytics.meta.product.variants[0].id];if(typeof o=='undefined'){var urlVariantId=window.location.search.split('variant=')[1].split('&')[0];tomitProductInventoryInfo.getVariantInventory(urlVariantId).then(function(e){if(typeof e.product.variants[urlVariantId]!=='undefined'){t.variants[urlVariantId]=e.product.variants[urlVariantId];tomitProductInventoryInfo.showCurrentVariantInformationOnPopupModal(t)}});return} this.selectedVariantId=o.id;var e=document.getElementById("tomit_inventory_list");if(e&&e.remove(),null!=o.inventoryItem&&null==o.inventoryItem.locations||null!=o.inventoryItem&&0==o.inventoryItem.locations.length){(r=n.getElementsByClassName("inventoryLocationLoading")[0])&&r.remove();n.style.display='none'}else{if(document.body.contains(document.getElementById('no_inventory_found_message'))){document.getElementById('no_inventory_found_message').remove()} var inventoryLocationStorePickupButtonText="Check Store Inventory";if(document.getElementById("inventoryLocation-store-pickup-button")){var modalHtml=`
×
`;document.getElementById("inventoryLocation-store-pickup-button").parentNode.insertAdjacentHTML('beforeend',modalHtml)}else{var modalHtml=`
${inventoryLocationStorePickupButtonText}
×
`;n.innerHTML=modalHtml} var useDropDown=t.useDropdown;var r,i=this.listInventoryPopup(o.inventoryItem.locations,0);var k=document.getElementById("inventoryLocationInformationModalBody");(r=n.getElementsByClassName("inventoryLocationLoading")[0])&&r.remove(),k.appendChild(i),n.style.display='block'} this.attachVariantInformationOnGoogleMapEvents();var ev=new CustomEvent("tomitVariantChanged",{detail:{message:'variant changed'},bubbles:!0,cancelable:!0});document.dispatchEvent(ev)},disableAtc:function(text){var atcBtn=document.querySelector("form[action='/cart/add'] button[name='add']")==null?document.querySelector("form[action='/cart/add'] input[name='add']"):document.querySelector("form[action='/cart/add'] button[name='add']");if(atcBtn==null){var atcBtn=document.querySelector("button[name='add']")==null?document.querySelector("form input[name='add']"):document.querySelector("button[name='add']")} if(atcBtn.disabled==!1){if(this.buttonDisabled==!1){this.originalButton=atcBtn.cloneNode(!0)} this.buttonDisabled=!0;atcBtn.setAttribute("disabled","disabled");if(text!=null){atcBtn.innerHTML=text}else{atcBtn.innerHTML='product not available'}}},enableAtc:function(){console.log("enable");var atcBtn=document.querySelector("form[action='/cart/add'] button[name='add']")==null?document.querySelector("form[action='/cart/add'] input[name='add']"):document.querySelector("form[action='/cart/add'] button[name='add']");if(atcBtn==null){var atcBtn=document.querySelector("button[name='add']")==null?document.querySelector("form input[name='add']"):document.querySelector("button[name='add']")} if(atcBtn.disabled==!0){atcBtn.parentNode.replaceChild(this.originalButton,atcBtn);this.buttonDisabled=!1}},getProductsInventoryInformation:t=>new Promise((n,o)=>{var e="https://inventorylocations.checkmyapp.net/inventory/products/"+Shopify.shop+"/"+JSON.stringify(t),r=new XMLHttpRequest;r.open("GET",e,!0),r.onload=function(){if(200===r.status){var t=JSON.parse(r.responseText);n(t)}else o("error")},r.send()})};function getProductInventoryInformation(t,reload=!1){if((tomitProductInventoryInfo.productJson==null||tomitProductInventoryInfo.productJson.length<=2)||reload==!0){var n="https://inventorylocations.checkmyapp.net/product/"+Shopify.shop+"/"+t+"/"+tomitProductInventoryInfo.customerPos,o=new XMLHttpRequest;o.open("GET",n,!0),o.onload=function(){if(200===o.status){var t=JSON.parse(o.responseText);tomitProductInventoryInfo.activeProduct=t.product,tomitProductInventoryInfo.showCurrentVariantInformation(tomitProductInventoryInfo.activeProduct);tomitProductInventoryInfo.dispatchProductLoadedEvent()}},o.send()}else{let productId=t;var t=JSON.parse(tomitProductInventoryInfo.productJson);tomitProductInventoryInfo.activeProduct=t.product,tomitProductInventoryInfo.showCurrentVariantInformation(tomitProductInventoryInfo.activeProduct);tomitProductInventoryInfo.dispatchProductLoadedEvent();getProductInventoryInformation(productId,!0)}} function getProductInventoryInformationOnPopupModal(t){var n="https://inventorylocations.checkmyapp.net/product/"+Shopify.shop+"/"+t+"/"+tomitProductInventoryInfo.customerPos;o=new XMLHttpRequest;o.open("GET",n,!0),o.onload=function(){if(200===o.status){var t=JSON.parse(o.responseText);tomitProductInventoryInfo.activeProduct=t.product,tomitProductInventoryInfo.showCurrentVariantInformationOnPopupModal(tomitProductInventoryInfo.activeProduct);tomitProductInventoryInfo.dispatchProductLoadedEvent()}},o.send()} tomitProductInventoryInfo.dispatchLoadedEvent();if(typeof ShopifyAnalytics!="undefined"&&"product"==ShopifyAnalytics.meta.page.pageType&&(null!=document.getElementById("inventoryLocationInformation"))){var product=ShopifyAnalytics.meta.product;getProductInventoryInformation(product.id)} if(null!=document.getElementById("tomitStoreSelector")){var locSelector=document.getElementById("tomitStoreSelector");var availableLocations=tomitStorageSystem.get("TomITLocations");if(!availableLocations){tomitProductInventoryInfo.loadLocations().then(function(e){if(e.length>0){tomitStorageSystem.set("TomITLocations",e,90);tomitProductInventoryInfo.renderLocationSelector(locSelector,e)}})}else{tomitProductInventoryInfo.renderLocationSelector(locSelector,availableLocations)}} history.pushState=(f=>function pushState(){var ret=f.apply(this,arguments);window.dispatchEvent(new Event('pushState'));window.dispatchEvent(new Event('locationchange'));return ret})(history.pushState);history.replaceState=(f=>function replaceState(){var ret=f.apply(this,arguments);window.dispatchEvent(new Event('replaceState'));window.dispatchEvent(new Event('locationchange'));return ret})(history.replaceState);window.addEventListener('popstate',()=>{window.dispatchEvent(new Event('locationchange'))});window.addEventListener('locationchange',function(e){if(typeof window.location.search.split('variant=')[1]!='undefined'){var urlVariantId=window.location.search.split('variant=')[1].split('&')[0];if(tomitProductInventoryInfo.selectedVariantId==urlVariantId){return!0}}else if(typeof ShopifyAnalytics!="undefined"&&ShopifyAnalytics.meta.hasOwnProperty("selectedVariantId")&&""!=ShopifyAnalytics.meta.selectedVariantId&&typeof(t)!='undefined'&&t.variants[ShopifyAnalytics.meta.selectedVariantId]!=null){if(tomitProductInventoryInfo.selectedVariantId==ShopifyAnalytics.meta.selectedVariantId){return!0}} if(document.getElementById("inventoryLocationInformation")){tomitProductInventoryInfo.showCurrentVariantInformation(tomitProductInventoryInfo.activeProduct)}});function onStoreSelect(){var selectedOption=document.getElementById('tomit_inventory_list').querySelector('input[type="radio"]:checked').value;var selectedStore=document.getElementById('selectedStore');selectedStore.innerHTML="Selected option : "+selectedOption;document.getElementById("inventoryLocationInformation").appendChild(selectedStore);var modal=document.getElementById("inventoryLocationInformationModal");modal.style.display='none'}