(self.webpackChunkwebpackWcBlocksFrontendJsonp=self.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[724],{8810:(e,t,n)=>{"use strict";n.d(t,{Z:()=>C});var c=n(9196),a=n(7608),l=n.n(a),o=n(5736),r=n(2629),s=n(711),i=n(9307),p=n(3251),d=n(3561),u=n.n(d);const m=["a","b","em","i","strong","p","br"],g=["target","href","rel","name","download"],k=(e,t)=>{const n=(null==t?void 0:t.tags)||m,c=(null==t?void 0:t.attr)||g;return u().sanitize(e,{ALLOWED_TAGS:n,ALLOWED_ATTR:c})};var _=n(9818),h=n(4801),v=n(8161),E=n(4293),b=n(4617);const f=e=>{const t=(0,b.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);let n=(0,c.createElement)(c.Fragment,null,Number.isFinite(t)&&(0,c.createElement)(s.FormattedMonetaryAmount,{currency:(0,E.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,(0,r.decodeEntities)(e.delivery_time));return 0===t&&(n=(0,c.createElement)("span",{className:"wc-block-components-shipping-rates-control__package__description--free"},(0,o.__)("Free","woocommerce"))),{label:(0,r.decodeEntities)(e.name),value:e.rate_id,description:n}},w=({className:e="",noResultsMessage:t,onSelectRate:n,rates:a,renderOption:l=f,selectedRate:o,disabled:r=!1,highlightChecked:p=!1})=>{const d=(null==o?void 0:o.rate_id)||"",u=(0,v.D)(d),[m,g]=(0,i.useState)((()=>{var e;return d||(null===(e=a[0])||void 0===e?void 0:e.rate_id)}));return(0,i.useEffect)((()=>{d&&d!==u&&d!==m&&g(d)}),[d,m,u]),(0,i.useEffect)((()=>{m&&n(m)}),[n,m]),0===a.length?t:(0,c.createElement)(s.RadioControl,{className:e,onChange:e=>{g(e),n(e)},highlightChecked:p,disabled:r,selected:m,options:a.map(l)})};n(7099);const C=({packageId:e,className:t="",noResultsMessage:n,renderOption:a,packageData:d,collapsible:u,showItems:m,highlightChecked:g=!1})=>{var v;const{selectShippingRate:E,isSelectingRate:b}=(0,p.V)(),f=(0,_.useSelect)((e=>{var t,n,c;return null===(t=e(h.CART_STORE_KEY))||void 0===t||null===(n=t.getCartData())||void 0===n||null===(c=n.shippingRates)||void 0===c?void 0:c.length}))>1||document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length>1,C=null!=m?m:f,S=null!=u?u:f,y=(0,c.createElement)(c.Fragment,null,(S||C)&&(0,c.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:k(d.name)}}),C&&(0,c.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(d.items).map((e=>{const t=(0,r.decodeEntities)(e.name),n=e.quantity;return(0,c.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},(0,c.createElement)(s.Label,{label:n>1?`${t} × ${n}`:`${t}`,screenReaderLabel:(0,o.sprintf)(/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */ /* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
(0,o._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woocommerce"),t,n)}))})))),R=(0,i.useCallback)((t=>{E(t,e)}),[e,E]),N={className:t,noResultsMessage:n,rates:d.shipping_rates,onSelectRate:R,selectedRate:d.shipping_rates.find((e=>e.selected)),renderOption:a,disabled:b,highlightChecked:g},P=(0,i.useMemo)((()=>{var e;return null==d||null===(e=d.shipping_rates)||void 0===e?void 0:e.findIndex((e=>null==e?void 0:e.selected))}),[null==d?void 0:d.shipping_rates]);return S?(0,c.createElement)(s.Panel,{className:l()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":b}),initialOpen:!1,title:y},(0,c.createElement)(w,{...N})):(0,c.createElement)("div",{className:l()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":b,"wc-block-components-shipping-rates-control__package--first-selected":!b&&0===P,"wc-block-components-shipping-rates-control__package--last-selected":!b&&P===(null==d||null===(v=d.shipping_rates)||void 0===v?void 0:v.length)-1})},y,(0,c.createElement)(w,{...N}))}},1070:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var c=n(5736);const a=({defaultTitle:e=(0,c.__)("Step","woocommerce"),defaultDescription:t=(0,c.__)("Step description text.","woocommerce"),defaultShowStepNumber:n=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:n}})},760:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>N});var c=n(9196),a=n(7608),l=n.n(a),o=n(721),r=n(711),s=n(9818),i=n(4801),p=n(8752),d=n(5736),u=n(9307),m=n(3251),g=n(9659),k=n(4293),_=n(2629),h=n(4617),v=n(2911),E=n(1873),b=n(7865),f=n(3554);const w=({title:e,setSelectedOption:t,selectedOption:n,pickupLocations:a,onSelectRate:l,renderPickupLocation:o,packageCount:p})=>{const d=(0,s.useSelect)((e=>{var t,n,c;return null===(t=e(i.CART_STORE_KEY))||void 0===t||null===(n=t.getCartData())||void 0===n||null===(c=n.shippingRates)||void 0===c?void 0:c.length}))>1||document.querySelectorAll(".wc-block-components-local-pickup-select .wc-block-components-radio-control").length>1;return(0,c.createElement)("div",{className:"wc-block-components-local-pickup-select"},!(!d||!e)&&(0,c.createElement)("div",null,e),(0,c.createElement)(r.RadioControl,{onChange:e=>{t(e),l(e)},highlightChecked:!0,selected:n,options:a.map((e=>o(e,p)))}))};var C=n(8810);const S=(e,t)=>{const n=(0,h.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):e.price,a=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_location"===e.key));return t?t.value:""}return""})(e),l=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_address"===e.key));return t?t.value:""}return""})(e),o=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_details"===e.key));return t?t.value:""}return""})(e);let s=(0,c.createElement)("em",null,(0,d.__)("free","woocommerce"));return parseInt(n,10)>0&&(s=1===t?(0,c.createElement)(r.FormattedMonetaryAmount,{currency:(0,k.getCurrencyFromPriceResponse)(e),value:n}):(0,u.createInterpolateElement)(/* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */ /* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */
(0,d._n)("<price/> x <packageCount/> package","<price/> x <packageCount/> packages",t,"woocommerce"),{price:(0,c.createElement)(r.FormattedMonetaryAmount,{currency:(0,k.getCurrencyFromPriceResponse)(e),value:n}),packageCount:(0,c.createElement)(c.Fragment,null,t)})),{value:e.rate_id,label:a?(0,_.decodeEntities)(a):(0,_.decodeEntities)(e.name),secondaryLabel:s,description:(0,_.decodeEntities)(o),secondaryDescription:l?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(v.Z,{icon:E.Z,className:"wc-block-editor-components-block-icon"}),(0,_.decodeEntities)(l)):void 0}},y=()=>{var e;const{shippingRates:t,selectShippingRate:n}=(0,m.V)(),a=((null===(e=t[0])||void 0===e?void 0:e.shipping_rates)||[]).filter(b.J3),[l,o]=(0,u.useState)((()=>{var e;return(null===(e=a.find((e=>e.selected)))||void 0===e?void 0:e.rate_id)||""})),r=(0,u.useCallback)((e=>{n(e)}),[n]),{extensions:s,receiveCart:i,...p}=(0,g.b)(),d={extensions:s,cart:p,components:{ShippingRatesControlPackage:C.Z,LocalPickupSelect:w},renderPickupLocation:S};(0,u.useEffect)((()=>{!l&&a[0]&&(o(a[0].rate_id),r(a[0].rate_id))}),[r,a,l]);const k=(0,b.wH)(t);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(f.ExperimentalOrderLocalPickupPackages.Slot,{...d}),(0,c.createElement)(f.ExperimentalOrderLocalPickupPackages,null,(0,c.createElement)(w,{title:t[0].name,setSelectedOption:o,onSelectRate:r,selectedOption:l,renderPickupLocation:S,pickupLocations:a,packageCount:k})))},R={...(0,n(1070).Z)({defaultTitle:(0,d.__)("Pickup options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},N=(0,o.withFilteredAttributes)(R)((({title:e,description:t,showStepNumber:n,children:a,className:o})=>{const{checkoutIsProcessing:d,prefersCollection:u}=(0,s.useSelect)((e=>{const t=e(i.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}}));return u&&p.oC?(0,c.createElement)(r.FormStep,{id:"pickup-options",disabled:d,className:l()("wc-block-checkout__pickup-options",o),title:e,description:t,showStepNumber:n},(0,c.createElement)(y,null),a):null}))},7099:()=>{}}]);