(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[36],{498:function(e,t,i){"use strict";i.r(t);var s=i(0),n=i(6),l=i.n(n),o=i(137),d=i(308),c=i(401),r=i(7),a=i(3),b=i(73),p=i(46),h=i(38),u=i(407),g=i(405),m=i(11),O=i(406),j=e=>{let{showCompanyField:t=!1,showApartmentField:i=!1,showPhoneField:n=!1,requireCompanyField:l=!1,requirePhoneField:o=!1}=e;const{defaultAddressFields:d,billingAddress:r,setBillingAddress:a,setShippingAddress:j,setBillingPhone:w,setShippingPhone:F,useBillingAsShipping:f}=Object(c.a)(),{dispatchCheckoutEvent:E}=Object(b.a)(),{isEditor:y}=Object(p.a)();Object(s.useEffect)(()=>{n||w("")},[n,w]);const[_,k]=Object(s.useState)(!1);Object(s.useEffect)(()=>{_||(f&&j(r),k(!0))},[_,j,r,f]);const C=Object(s.useMemo)(()=>({company:{hidden:!t,required:l},address_2:{hidden:!i}}),[t,l,i]),A=y?g.a:s.Fragment;return Object(s.createElement)(A,null,Object(s.createElement)(m.StoreNoticesContainer,{context:h.d.BILLING_ADDRESS}),Object(s.createElement)(u.a,{id:"billing",type:"billing",onChange:e=>{a(e),f&&(j(e),E("set-shipping-address")),E("set-billing-address")},values:r,fields:Object.keys(d),fieldConfig:C}),n&&Object(s.createElement)(O.a,{isRequired:o,value:r.phone,onChange:e=>{w(e),E("set-phone-number",{step:"billing"}),f&&(F(e),E("set-phone-number",{step:"shipping"}))}}))},w=i(287),F=i(1);const f=Object(F.__)("Billing address","woocommerce"),E=Object(F.__)("Enter the billing address that matches your payment method.","woocommerce"),y=Object(F.__)("Billing and shipping address","woocommerce"),_=Object(F.__)("Enter the billing and shipping address that matches your payment method.","woocommerce");var k={...Object(w.a)({defaultTitle:f,defaultDescription:E}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},C=i(153);t.default=Object(o.withFilteredAttributes)(k)(e=>{let{title:t,description:i,showStepNumber:n,children:o,className:b}=e;const p=Object(r.useSelect)(e=>e(a.CHECKOUT_STORE_KEY).isProcessing()),{requireCompanyField:h,requirePhoneField:u,showApartmentField:g,showCompanyField:m,showPhoneField:O}=Object(C.b)(),{showBillingFields:w,forcedBillingAddress:F,useBillingAsShipping:k}=Object(c.a)();return w||k?(t=((e,t)=>t?e===f?y:e:e===y?f:e)(t,F),i=((e,t)=>t?e===E?_:e:e===_?E:e)(i,F),Object(s.createElement)(d.a,{id:"billing-fields",disabled:p,className:l()("wc-block-checkout__billing-fields",b),title:t,description:i,showStepNumber:n},Object(s.createElement)(j,{requireCompanyField:h,showApartmentField:g,showCompanyField:m,showPhoneField:O,requirePhoneField:u}),o)):null})}}]);