PageSourceSearch

https://lovecomplement.com/cdn/shop/t/362/assets/buybox.pricing.J9H18AMh.bundle.js

js lovecomplement.com collected 2026-10-02 04:40:52 UTC 3,709 bytes, 11 lines download raw bytes

1import{f as E}from"./currency.CBGGqVVe.bundle.js";const M="${{amount}}",a={SUBSCRIPTION:"subscription",ONE_TIME:"oneTime"};function r(t,e=0){const c=Number.parseInt(t,10);return Number.isNaN(c)?e:c}function g(t){return t===a.SUBSCRIPTION?a.SUBSCRIPTION:a.ONE_TIME}function x(t){var e;return!t||t.selectedIndex===void 0?null:((e=t.options)==null?void 0:e[t.selectedIndex])||null}function C(t){const e=t.querySelector(".c-buybox__variant-select");return e?x(e):t.querySelector(".c-buybox__variant-field")}function N(t){const e=t.querySelector(".c-buybox__subscription-select");return x(e)}function R({offers:t=[],purchaseType:e=a.ONE_TIME,currentQty:c=1,cartOneTime:s=0,cartSubscription:o=0}){if(!Array.isArray(t)||t.length===0)return null;const d=g(e),m=Math.max(1,r(c,1)),P=Math.max(0,r(s,0)),T=Math.max(0,r(o,0)),u=t.filter(n=>{var b,S,O,A;if(!(((b=n?.oneTime)==null?void 0:b.discount)!==void 0&&((S=n?.oneTime)==null?void 0:S.minQuantity)!==void 0&&((O=n?.subscription)==null?void 0:O.discount)!==void 0&&((A=n?.subscription)==null?void 0:A.minQuantity)!==void 0))return!1;const p=n.oneTime.discount===n.subscription.discount&&n.oneTime.minQuantity===n.subscription.minQuantity;let i,y;return p?(i=P+T,y=r(n.oneTime.minQuantity,0)):d===a.SUBSCRIPTION?(i=T,y=r(n.subscription.minQuantity,0)):(i=P,y=r(n.oneTime.minQuantity,0)),i+m>=y});return u.length===0?null:u.reduce((n,l)=>{const p=d===a.SUBSCRIPTION?r(n.subscription.discount,0):r(n.oneTime.discount,0);return(d===a.SUBSCRIPTION?r(l.subscription.discount,0):r(l.oneTime.discount,0))>p?l:n})}function h({option:t,offer:e=null,purchaseType:c=a.ONE_TIME}){if(!(t!=null&&t.dataset))return{price:0,compareAtPrice:0};const s=r(t.dataset.price,0),o=r(t.dataset.compareAtPrice,0);if(!e)return{price:s,compareAtPrice:o};const m=g(c)===a.SUBSCRIPTION?e.subscription:e.oneTime,P=r(m?.discount,0),T=Math.max(0,100-P),u=o||s;return{price:Math.floor(u*T/100),compareAtPrice:u}}function I({price:t=0,compareAtPrice:e=0,showCompareAt:c=!0}){const s=Math.max(0,r(t,0)),o=Math.max(0,r(e,0));return`
2    <div class="price-content">
3      ${c&&o>s&&o>0?`<span class="compare-at-price" data-compare-at-price="${o}">
4              <s>${E(o,M)}</s>
5            </span>`:""}
6      <span class="regular-price" data-price="${s}">
7        ${E(s,M)}
8      </span>
9    </div>
10  `}function v(t){const{host:e,signal:c,state:s,settings:o,applicableOffers:d}=t,m=e.querySelector(".main-price"),P=e.querySelector(".one-time-price"),T=e.querySelector(".subscription-price"),u=i=>R({offers:d,purchaseType:i,currentQty:s.quantity,cartOneTime:s.cartOfferQuantityOneTime,cartSubscription:s.cartOfferQuantitySubscription}),n=()=>{const i=g(s.purchaseType),y=i===a.SUBSCRIPTION?N(e):C(e),b=h({option:y,offer:u(i),purchaseType:i}),S=Math.max(1,r(s.quantity,1));return{price:b.price*S,compareAtPrice:b.compareAtPrice*S}},l=()=>{if(P){const i=h({option:C(e),offer:u(a.ONE_TIME),purchaseType:a.ONE_TIME});P.innerHTML=I({price:i.price,compareAtPrice:i.compareAtPrice,showCompareAt:!0})}if(T){const i=h({option:N(e),offer:u(a.SUBSCRIPTION),purchaseType:a.SUBSCRIPTION});T.innerHTML=I({price:i.price,compareAtPrice:i.compareAtPrice,showCompareAt:!0})}if(m){const i=n();m.innerHTML=I({price:i.price,compareAtPrice:i.compareAtPrice,showCompareAt:o?.showDiscountPrice===!0})}},p=()=>{l()};return e.addEventListener("buybox:purchase-type-change",p,{signal:c}),e.addEventListener("buybox:quantity-change",p,{signal:c}),e.addEventListener("buybox:variant-change",p,{signal:c}),e.addEventListener("buybox:cart-tier-change",p,{signal:c}),e.addEventListener("buybox:price-update",p,{signal:c}),l(),{destroy(){}}}export{v as s};
11//# sourceMappingURL=/cdn/shop/t/362/assets/buybox.pricing.J9H18AMh.bundle.js.map

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.