(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[51],{511:function(e,t,i){"use strict";i.r(t);var s=i(0),n=i(4),o=i.n(n),l=i(144),c=i(314),d=i(404),r=i(5),a=i(3),p=i(1),h=i(411),b=i(73),u=i(50),g=i(46),m=i(11),w=i(408),O=i(409),j=e=>{let{showCompanyField:t=!1,showApartmentField:i=!1,showPhoneField:n=!1,requireCompanyField:o=!1,requirePhoneField:l=!1}=e;const{defaultAddressFields:c,setShippingAddress:r,setBillingAddress:a,shippingAddress:j,billingAddress:F,setShippingPhone:S,useShippingAsBilling:E,setUseShippingAsBilling:f}=Object(d.a)(),{dispatchCheckoutEvent:_}=Object(b.a)(),{isEditor:k}=Object(u.a)(),{email:C}=F,[A,y]=Object(s.useState)(!1);Object(s.useEffect)(()=>{n||S("")},[n,S]),Object(s.useEffect)(()=>{A||(E&&a({...j,email:C}),y(!0))},[A,a,j,E]);const P=Object(s.useMemo)(()=>({company:{hidden:!t,required:o},address_2:{hidden:!i}}),[t,o,i]),N=k?w.a:s.Fragment,q=E?[g.d.SHIPPING_ADDRESS,g.d.BILLING_ADDRESS]:[g.d.SHIPPING_ADDRESS];return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(N,null,Object(s.createElement)(m.StoreNoticesContainer,{context:q}),Object(s.createElement)(h.a,{id:"shipping",type:"shipping",onChange:e=>{r(e),E&&a({...e,email:C}),_("set-shipping-address")},values:j,fields:Object.keys(c),fieldConfig:P}),n&&Object(s.createElement)(O.a,{id:"shipping-phone",errorId:"shipping_phone",isRequired:l,value:j.phone,onChange:e=>{S(e),_("set-phone-number",{step:"shipping"})}})),Object(s.createElement)(m.CheckboxControl,{className:"wc-block-checkout__use-address-for-billing",label:Object(p.__)("Use same address for billing","woocommerce"),checked:E,onChange:e=>{f(e),e&&a(j)}}))},F=i(290),S={...Object(F.a)({defaultTitle:Object(p.__)("Shipping address","woocommerce"),defaultDescription:Object(p.__)("Enter the address where you want your order delivered.","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},E=i(150);t.default=Object(l.withFilteredAttributes)(S)(e=>{let{title:t,description:i,showStepNumber:n,children:l,className:p}=e;const h=Object(r.useSelect)(e=>e(a.CHECKOUT_STORE_KEY).isProcessing()),{showShippingFields:b}=Object(d.a)(),{requireCompanyField:u,requirePhoneField:g,showApartmentField:m,showCompanyField:w,showPhoneField:O}=Object(E.b)();return b?Object(s.createElement)(c.a,{id:"shipping-fields",disabled:h,className:o()("wc-block-checkout__shipping-fields",p),title:t,description:i,showStepNumber:n},Object(s.createElement)(j,{requireCompanyField:u,requirePhoneField:g,showApartmentField:m,showCompanyField:w,showPhoneField:O}),l):null})}}]);