"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[19],{38: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)(l.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||p.status===o.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)(h,{selectedVariant:O,showPriceOnButton:b,isUpdating:(P.length>1&&`${null==O?void 0:O.variantId}_bundle`===p.variantId||(null==O?void 0:O.variantId)===p.variantId)&&p.status===o.Status.updating,isPreorder:x,isSoldOut:!y,buttonSubText:v,buttonMessage:j})})})})};const s=r(0),i=a(r(50)),o=r(12),l=r(0),d=r(8),u=r(3),c=r(23),p=r(32);function h({isUpdating:e,isPreorder:t,isSoldOut:r,selectedVariant:n,showPriceOnButton:a,buttonSubText:o,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",h=null!=d?d:t?"Pre-Order Now":"Add to Cart";if(a&&(null==n?void 0:n.price)){const e=n.compareAtPrice?(0,p.roundToCents)(parseFloat(n.compareAtPrice)):null,t=(0,p.roundToCents)(parseFloat(n.price));return(0,s.jsxs)(l.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:h})," - ",(0,s.jsxs)("span",{style:{whiteSpace:"nowrap"},children:[null!==e&&e>t&&(0,s.jsxs)("span",{class:i.default.linethrough,children:["$",e," "]}),"$",t]})]}),o&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:o})]})}return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)("span",{children:h}),o&&(0,s.jsx)("div",{class:i.default.estimatedShipDate,children:o})]})}}}]);