"use strict";(self.webpackChunkwebpackWcBlocksStylingJsonp=self.webpackChunkwebpackWcBlocksStylingJsonp||[]).push([[7413],{15987:(e,t,i)=>{i.r(t),i.d(t,{default:()=>I});var o=i(99196),c=i(91),s=i.n(c),n=i(80721),p=i(40711),a=i(9818),l=i(94801),r=i(93251),h=i(68752),g=i(65736),d=i(7125),m=i(46023),u=i(71704),k=i(28268),_=i(45962),w=i(69307),E=i(27865),b=i(74617),C=i(33426),S=i(21921),T=i(14684);i(96483);const v={hidden:!0,message:(0,g.__)("Shipping options are not available","woocommerce")},x=({checked:e,rate:t,showPrice:i,showIcon:c,toggleText:n,multiple:p})=>(0,o.createElement)(d.Z,{value:"pickup",className:s()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===e})},!0===c&&(0,o.createElement)(u.Z,{icon:k.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},n),!0===i&&(0,o.createElement)(C.S,{multiple:p,minRate:t.min,maxRate:t.max})),P=({checked:e,rate:t,showPrice:i,showIcon:c,toggleText:n,shippingCostRequiresAddress:p=!1})=>{const r=(0,a.useSelect)((e=>e(l.CART_STORE_KEY).getShippingRates().some((({shipping_rates:e})=>!e.every(E.J3))))),h=p&&(()=>{const e=(0,a.select)("wc/store/validation"),t=e.getValidationError("shipping_state"),i=e.getValidationError("shipping_address_1"),o=e.getValidationError("shipping_country"),c=e.getValidationError("shipping_postcode");return[e.getValidationError("shipping_city"),t,i,o,c].some((e=>void 0!==e))})()&&!r,m=void 0!==t.min&&void 0!==t.max,{setValidationErrors:k,clearValidationError:b}=(0,a.useDispatch)(l.VALIDATION_STORE_KEY);(0,w.useEffect)((()=>{"shipping"!==e||m?b("shipping-rates-error"):k({"shipping-rates-error":v})}),[e,b,m,k]);const S=void 0===t.min||h?(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},(0,g.__)("calculated with an address","woocommerce")):(0,o.createElement)(C.S,{minRate:t.min,maxRate:t.max});return(0,o.createElement)(d.Z,{value:"shipping",className:s()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===e})},!0===c&&(0,o.createElement)(u.Z,{icon:_.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},n),!0===i&&S)},R=({checked:e,onChange:t,showPrice:i,showIcon:c,localPickupText:s,shippingText:n})=>{var p,a;const{shippingRates:l}=(0,r.V)(),h=(0,b.getSetting)("shippingCostRequiresAddress",!1),g=(0,b.getSetting)("localPickupText",s||T.$);return(0,o.createElement)(m.Z,{id:"shipping-method",className:"wc-block-checkout__shipping-method-container",label:"options",onChange:t,checked:e},(0,o.createElement)(P,{checked:e,rate:(0,S.i)(null===(p=l[0])||void 0===p?void 0:p.shipping_rates),showPrice:i,showIcon:c,shippingCostRequiresAddress:h,toggleText:n||T.Z}),(0,o.createElement)(x,{checked:e,rate:(0,S.B)(null===(a=l[0])||void 0===a?void 0:a.shipping_rates),multiple:l.length>1,showPrice:i,showIcon:c,toggleText:g}))};var N=i(43609);const I=(0,n.withFilteredAttributes)(N.Z)((({title:e,description:t,showStepNumber:i,children:c,className:n,showPrice:g,showIcon:d,shippingText:m,localPickupText:u})=>{const{checkoutIsProcessing:k,prefersCollection:_}=(0,a.useSelect)((e=>{const t=e(l.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}})),{setPrefersCollection:w}=(0,a.useDispatch)(l.CHECKOUT_STORE_KEY),{shippingRates:E,needsShipping:b,hasCalculatedShipping:C,isCollectable:S}=(0,r.V)();return b&&C&&E&&S&&h.oC?(0,o.createElement)(p.FormStep,{id:"shipping-method",disabled:k,className:s()("wc-block-checkout__shipping-method",n),title:e,description:t,showStepNumber:i},(0,o.createElement)(R,{checked:_?"pickup":"shipping",onChange:e=>{w("pickup"===e)},showPrice:g,showIcon:d,localPickupText:u,shippingText:m}),c):null}))}}]);