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