"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[21],{32:function(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a(0,d.isPreOrderVariant)(e))),y=t.every((e=>e.availableForSale));y||m||(m={backgroundColor:"#666",color:"#999"});const P=(0,u.useMemo)((()=>{const e=(0,d.getPreOrderMessage)(...t);return null==t?void 0:t.map((t=>{var{addToCartProperties:r={}}=t,a=n(t,["addToCartProperties"]);const s=a.compareAtPrice?100*parseFloat(a.compareAtPrice):void 0;return{id:null==a?void 0:a.variantId,quantity:"number"==typeof r._item_quantity?r._item_quantity:1,properties:Object.assign(Object.assign({_compareRetail:s},r),{Shipping:null==e?void 0:e.propertyValue,_olpre:e&&"preorder"})}}))}),[t]),S=(0,c.useIsHydrated)();return(0,s.jsx)(o.Fragment,{children:(0,s.jsx)("form",{class:[i.default.container,"small"===f?i.default.small:""].join(" "),action:`/cart/add?return_to=${encodeURIComponent(`${r}?variant=${null==O?void 0:O.variantId}&viewcart=true`)}`,method:"POST",children:(0,s.jsx)("button",{type:"submit",disabled:!S||h.status===l.Status.updating||!y,class:[i.default.addButton,"small"===f?i.default.small:"",g?i.default.outlined:""].join(" "),style:m,onClick:e=>{e.preventDefault(),y?a({items:P}):console.error("Not available for sale")},children:(0,s.jsx)(p,{selectedVariant:O,showPriceOnButton:b,isUpdating:(P.length>1&&`${null==O?void 0:O.variantId}_bundle`===h.variantId||(null==O?void 0:O.variantId)===h.variantId)&&h.status===l.Status.updating,isPreorder:x,isSoldOut:!y,buttonSubText:v,buttonMessage:j})})})})};const s=r(0),i=a(r(47)),l=r(12),o=r(0),d=r(8),u=r(3),c=r(17);function p({isUpdating:e,isPreorder:t,isSoldOut:r,selectedVariant:n,showPriceOnButton:a,buttonSubText:l,buttonMessage:d,buttonMessageMobile:u}){if(r)return(0,s.jsx)("span",{children:"Sold Out"});if(e)return(0,s.jsx)("span",{children:"Adding..."});const c=null!=u?u:t?"Add Pre-Order":"Add to Cart",p=null!=d?d:t?"Pre-Order Now":"Add to Cart";if(a&&(null==n?void 0:n.price)){const e=n.compareAtPrice?parseInt(n.compareAtPrice):null,t=parseInt(n.price);return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{class:i.default.messageMobile,children:c}),(0,s.jsx)("span",{class:i.default.message,children:p})," - ",(0,s.jsxs)("span",{style:{whiteSpace:"nowrap"},children:[null!==e&&e>t&&(0,s.jsxs)("span",{class:i.default.linethrough,children:["$",e," "]}),"$",t]})]}),l&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:l})]})}return(0,s.jsxs)(o.Fragment,{children:[(0,s.jsx)("span",{children:p}),l&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:l})]})}}}]);