1import{B as d}from"./BopisElement.8tfQ8Js1.min.js";import{n as p,t as u}from"./vendor-lit.BnJBJiFw.min.js";import{x as t}from"./vendor.DbyoNmQU.min.js";import"./BaseElement.OEEccP4F.min.js";import"./WithApiClient.DgkY69ua.min.js";import"./WithShopifyCart.CNL9p4av.min.js";import"./cart-sections.BeO_GuWv.min.js";var h=Object.defineProperty,b=Object.getOwnPropertyDescriptor,o=(a,e,r,n)=>{for(var i=n>1?void 0:n?b(e,r):e,l=a.length-1,c;l>=0;l--)(c=a[l])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&h(e,r,i),i};let s=class extends d{constructor(){super(...arguments),this.productLocations={},this.variantId=null,this.variantQuantity=1,this.context="default"}connectedCallback(){super.connectedCallback(),this.getProductLocations()}async getProductLocations(){return this.variantId?(this.productLocations=await this.getLocationsForVariants([this.variantId]),this.productLocations):{}}checkIfLocationHasVariantQuantity(){var i;const a=this.findMatchingProductVariantLocations(this.variantId,this.selectedLocation,this.productLocations);if(Object.keys(a).length===0)return{isAvailableWithQuantity:!1,variantDidNotMatchInStore:!0,isPreOrder:!1};const{available:e=!1,quantityAvailable:r=0}=a;return{isAvailableWithQuantity:e&&r>=this.variantQuantity,variantDidNotMatchInStore:!1,isPreOrder:((i=this.productLocations[this.variantId])==null?void 0:i.preorderEnabled)??!1}}render(){return this.context==="cart-item"?this.renderTemplateCartItem():this.context==="pdp-block"?this.renderTemplatePpdBlock():this.renderTemplateDefault()}renderTemplateDefault(){return this.hasHadFirstFetch===!1?t`<p> </p>`:this.selectedLocation===null?t`<p class='text-body-light'>${window.localeStrings.bopisNoStoreSelected}</p>`:t`<p class='text-body-light'>${this.selectedLocation.name}</p>`}renderTemplatePpdBlock(){if(this.selectedLocation===null)return t`<p class='text-body-light'>${window.localeStrings.bopisNoStoreSelected}</p>`;if(this.variantId===null)return t`<p>${window.localeStrings.bopisNa}</p>`;const{isAvailableWithQuantity:a,variantDidNotMatchInStore:e,isPreOrder:r}=this.checkIfLocationHasVariantQuantity();return e||r?t`<p> </p>`:a?t` 2 <p class='text-body-small'> 3 <span class="text-u-success"> 4 ${window.localeStrings.bopisAvailablePdp} 5 </span> 6 <span>${window.localeStrings.bopisAt} ${this.selectedLocation.name}</span> 7 </p> 8 `:t` 9 <p class='text-body-small'> 10 <span class="text-u-error"> 11 ${window.localeStrings.bopisUnavailablePdp} 12 </span> 13 <span>${window.localeStrings.bopisAt} ${this.selectedLocation.name}</span> 14 </p> 15 `}renderTemplateCartItem(){if(this.selectedLocation===null||this.variantId===null)return t`<p> </p>`;const{isAvailableWithQuantity:a,variantDidNotMatchInStore:e,isPreOrder:r}=this.checkIfLocationHasVariantQuantity();return e||r?t`<p> </p>`:(this.classList.remove("hidden"),a?t` 16 <p class="text-body-small-light text-u-success"> 17 ${window.localeStrings.bopisAvailableCart} 18 </p> 19 `:t` 20 <p class="text-body-small-light text-u-error"> 21 ${window.localeStrings.bopisUnavailableCart} 22 </p> 23 `)}};s.properties={...d.properties,productLocations:{type:Object}};o([p({type:String,attribute:"variant-id"})],s.prototype,"variantId",2);o([p({type:Number,attribute:"variant-quantity"})],s.prototype,"variantQuantity",2);o([p({type:String,attribute:"context"})],s.prototype,"context",2);s=o([u("bopis-selected-store")],s);
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.