(()=>{"use strict";var e,o={20:(e,o,t)=>{var r=t(609),a=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(e,o,t){var r,c={},n=null,d=null;for(r in void 0!==t&&(n=""+t),void 0!==o.key&&(n=""+o.key),void 0!==o.ref&&(d=o.ref),o)l.call(o,r)&&!i.hasOwnProperty(r)&&(c[r]=o[r]);if(e&&e.defaultProps)for(r in o=e.defaultProps)void 0===c[r]&&(c[r]=o[r]);return{$$typeof:a,type:e,key:n,ref:d,props:c,_owner:s.current}}o.jsx=c,o.jsxs=c},82:(e,o,t)=>{const r=window.wc.blocksCheckout,a=window.wc.wcSettings,l=window.wp.i18n,s=window.wp.element,i=(0,s.forwardRef)((function({icon:e,size:o=24,...t},r){return(0,s.cloneElement)(e,{width:o,height:o,...t,ref:r})})),c=window.wp.primitives;var n=t(848);const d=(0,n.jsx)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(c.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),p=window.wp.data;function u(e){var o,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(o=0;o{const{onChange:o,options:t,label:r,value:a="",className:c,size:u,errorId:_,required:b,errorMessage:w=(0,l.__)("Please select a valid option","woo-checkout-field-editor-pro"),placeholder:v,...k}=e,g=(0,s.useCallback)((e=>{o(e.target.value)}),[o]),y=(0,s.useMemo)((()=>({value:"",label:null!=v?v:(0,l.sprintf)( // translators: %s will be label of the field. For example "country/region". // translators: %s will be label of the field. For example "country/region". (0,l.__)("Select a %s","woo-checkout-field-editor-pro"),r?.toLowerCase()),disabled:!!b})),[r,v,b]),x=(0,s.useId)(),C=k.id||`wc-blocks-components-select-${x}`,j=_||C,E=(0,s.useMemo)((()=>b&&a?t:[y].concat(t)),[b,a,y,t]),{setValidationErrors:N,clearValidationError:O}=(0,p.useDispatch)(m.VALIDATION_STORE_KEY),{error:I,validationErrorId:$}=(0,p.useSelect)((e=>{const o=e(m.VALIDATION_STORE_KEY);return{error:o.getValidationError(j),validationErrorId:o.getValidationErrorId(j)}}));(0,s.useEffect)((()=>(!b||a?O(j):N({[j]:{message:w,hidden:!0}}),()=>{O(j)})),[O,a,j,w,b,N]);const S=(0,p.useSelect)((e=>e(m.VALIDATION_STORE_KEY).getValidationError(j||"")||{hidden:!0}));return(0,n.jsxs)("div",{className:h(c,{"has-error":!S.hidden}),children:[(0,n.jsx)("div",{className:"wc-blocks-components-select",children:(0,n.jsxs)("div",{className:"wc-blocks-components-select__container",children:[(0,n.jsx)("label",{htmlFor:C,className:"wc-blocks-components-select__label",children:r}),(0,n.jsx)("select",{className:"wc-blocks-components-select__select",id:C,size:void 0!==u?u:1,onChange:g,value:a,"aria-invalid":!(!I?.message||I?.hidden),"aria-errormessage":$,...k,children:E.map((e=>(0,n.jsx)("option",{value:e.value,"data-alternate-values":`[${e.label}]`,disabled:void 0!==e.disabled&&e.disabled,children:e.label},e.value)))},C),(0,n.jsx)(i,{className:"wc-blocks-components-select__expand",icon:d})]})}),(0,n.jsx)(f.ValidationInputError,{propertyName:j})]})};var b=t(609);const w=window.wp.compose,v=({label:e,secondaryLabel:o,description:t,secondaryDescription:r,id:a})=>(0,n.jsxs)("div",{className:"wc-block-components-radio-control__option-layout",children:[(0,n.jsxs)("div",{className:"wc-block-components-radio-control__label-group",children:[e&&(0,n.jsx)("span",{id:a&&`${a}__label`,className:"wc-block-components-radio-control__label",children:e}),o&&(0,n.jsx)("span",{id:a&&`${a}__secondary-label`,className:"wc-block-components-radio-control__secondary-label",children:o})]}),(t||r)&&(0,n.jsxs)("div",{className:"wc-block-components-radio-control__description-group",children:[t&&(0,n.jsx)("span",{id:a&&`${a}__description`,className:"wc-block-components-radio-control__description",children:t}),r&&(0,n.jsx)("span",{id:a&&`${a}__secondary-description`,className:"wc-block-components-radio-control__secondary-description",children:r})]})]}),k=({checked:e,name:o,onChange:t,option:r,disabled:a=!1,highlightChecked:l=!1})=>{const{value:s,label:i,description:c,secondaryLabel:d,secondaryDescription:p}=r;return(0,n.jsxs)("label",{className:h("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":e,"wc-block-components-radio-control__option--checked-option-highlighted":e&&l}),htmlFor:`${o}-${s}`,children:[(0,n.jsx)("input",{id:`${o}-${s}`,className:"wc-block-components-radio-control__input",type:"radio",name:o,value:s,onChange:e=>t(e.target.value),checked:e,"aria-describedby":h({[`${o}-${s}__label`]:i,[`${o}-${s}__secondary-label`]:d,[`${o}-${s}__description`]:c,[`${o}-${s}__secondary-description`]:p}),"aria-disabled":a,onKeyDown:e=>{a&&["ArrowUp","ArrowDown","AllowLeft","ArrowRight"].includes(e.key)&&e.preventDefault()}}),(0,n.jsx)(v,{id:`${o}-${s}`,label:i,secondaryLabel:d,description:c,secondaryDescription:p})]})},g=({className:e="",id:o,selected:t="",onChange:r,options:a=[],disabled:s=!1,highlightChecked:i=!1,title:c="",required:d=!1,errorMessage:u=(0,l.__)("Please select an option","woo-checkout-field-editor-pro"),errorId:_})=>{const v=(0,w.useInstanceId)(g),y=o||v,x=_||y,{setValidationErrors:C,clearValidationError:j}=(0,p.useDispatch)(m.VALIDATION_STORE_KEY),E=(0,p.useSelect)((e=>e(m.VALIDATION_STORE_KEY).getValidationError(x)||{hidden:!0}));(0,b.useEffect)((()=>(!d||t?j(x):C({[x]:{message:u,hidden:!0}}),()=>{j(x)})),[t,d,x,u]);const N=(0,b.useMemo)((()=>a.findIndex((e=>e.value===t))),[a,t]);return a.length?(0,n.jsxs)("div",{className:h("wc-block-components-radio-control thwcfe-radio-control",{"has-error":!E.hidden,"wc-block-components-radio-control--highlight-checked--first-selected":i&&0===N,"wc-block-components-radio-control--highlight-checked--last-selected":i&&N===a.length-1,"wc-block-components-radio-control--highlight-checked":i},e),children:[(0,n.jsxs)("div",{className:"wc-block-components-cfe-radio-control__heading",children:[" ",c||""," "]}),a.map((e=>(0,n.jsx)(k,{highlightChecked:i,name:`radio-control-${y}`,checked:e.value===t,option:e,onChange:o=>{r(o),"function"==typeof e.onChange&&e.onChange(o)},disabled:s},`${y}-${e.value}`))),(0,n.jsx)(f.ValidationInputError,{propertyName:x})]}):null},y=g,x=e=>{const{errorId:o,errorMessage:t,autoCapitalize:r,autoComplete:a,placeholder:l,...s}=e;return s},C=window.wp.url,j=({field:e,onChange:o=""})=>{const{id:t,label:r,type:a,value:s,placeholder:i,required:c,options:d,title:p,validate:u,property_set:m,enabled:w,cssclass:v}=e,{default:k,checked:g}=m,j=(e=>({id:`section_one-${e?.id}`.replaceAll("/","-"),errorId:`section_${e?.id}`,label:e?.title,autoCapitalize:e?.autocapitalize,autoComplete:e?.autocomplete,errorMessage:e?.errorMessage,required:e?.required,placeholder:e?.placeholder,className:`wc-block-components-address-form__${e?.id}`.replaceAll("/","-"),options:e?.options?Object.values(e.options).map((e=>({value:e.key,label:e.text}))):[],...e?.attributes}))(e),E=(0,b.useRef)({}),[N,O]=(0,b.useState)(!1);if(!w||"0"===w)return null;const I=e=>{o({[t]:e})};if((0,b.useEffect)((()=>{void 0!==k&&I(k)}),[k]),"checkbox"===a&&(0,b.useEffect)((()=>{void 0!==g&&(I(g),O(!0))}),[g]),"email"!==e.type){if("checkbox"===a){var $;const o={...x(j),checked:Boolean(null!==($=null!=s?s:k)&&void 0!==$?$:g),onChange:e=>I(e)};return c&&void 0!==f.ValidatedCheckboxControl&&N?(0,n.jsx)(f.ValidatedCheckboxControl,{...o,errorMessage:e?.errorMessage,ref:e=>E.current[t]=e,required:!0},t):(0,n.jsx)(f.CheckboxControl,{...o},t)}return"select"===a&&e.options?(0,n.jsx)(_,{...j,label:p||"",className:h(v?.split(",").map((e=>e.trim())),"wc-block-components-select-input",`wc-block-components-select-input-${t}`.replaceAll("/","-")),value:s,onChange:I,options:j.options,required:c,errorMessage:j.errorMessage||void 0,placeholder:i||null},t):"radio"===a?(0,n.jsx)(y,{...j,selected:s,onChange:I,options:j.options,disabled:!1,highlightChecked:!0,title:p||"",className:h(v?.split(",").map((e=>e.trim())))}):(0,n.jsx)(f.ValidatedTextInput,{ref:e=>E.current[t]=e,...j,type:a,value:s,onChange:I,className:h(v?.split(",").map((e=>e.trim()))),customFormatter:o=>"postcode"===e.type?o.trimStart().toUpperCase():o,customValidation:e=>((e,o)=>!((e.required||e.value)&&("phone"!==o||(0,C.isPhoneNumber)(e.value)?"url"!==o||(0,C.isURL)(e.value)?"email"===o&&!(0,C.isEmail)(e.value)&&(e.setCustomValidity((0,l.__)("Please enter a valid email address","woo-checkout-field-editor-pro")),1):(e.setCustomValidity((0,l.__)("Please enter a valid URL","woo-checkout-field-editor-pro")),1):(e.setCustomValidity((0,l.__)("Please enter a valid Phone Number","woo-checkout-field-editor-pro")),1))))(e,u)},t)}},E=window.lodash,N=(0,a.getSetting)("thwcfe-block-integration_data",""),{allSections:O}=N,{contact:I}=O,$=JSON.parse('{"apiVersion":2,"name":"woocommerce-checkout-field-editor-pro/contact-information-section","version":"2.0.0","title":"Contact Information Section","category":"woocommerce","description":"Adds fields.","supports":{"html":false,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-contact-information-block"],"attributes":{"lock":{"type":"object","default":{"remove":true,"move":false}},"text":{"type":"string","default":""},"title":{"type":"string","default":"Contact Information"},"description":{"type":"string","default":"contact Fields"}},"textdomain":"woocommerce-checkout-field-editor-pro","editorStyle":"file:../../../build/style-checkout-section-block.css"}');(0,r.registerCheckoutBlock)({metadata:$,component:({checkoutExtensionData:e,extensions:o})=>{const{setExtensionData:t}=e,[r,a]=(0,b.useState)({}),l=(0,b.useCallback)((0,E.debounce)((e=>{t("thwcfe-additional-fields","contact",e)}),1e3),[t]);(0,b.useEffect)((()=>(Object.keys(r).length>0&&l(r),()=>{l.cancel()})),[r,l]);const s=(0,b.useCallback)((e=>{a((o=>({...o,...e})))}),[]),i=Array.isArray(I.fields)?I.fields:Object.values(I.fields);return(0,n.jsx)("div",{children:i.map((e=>(0,n.jsx)("div",{className:"wc-block-checkout__additional-fields__field",children:(0,n.jsx)(j,{field:{...e,value:r[e.id]||""},onChange:s})},e.id)))})}})},609:e=>{e.exports=window.React},848:(e,o,t)=>{e.exports=t(20)}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var l=t[e]={exports:{}};return o[e](l,l.exports,r),l.exports}r.m=o,e=[],r.O=(o,t,a,l)=>{if(!t){var s=1/0;for(d=0;d=l)&&Object.keys(r.O).every((e=>r.O[e](t[c])))?t.splice(c--,1):(i=!1,l0&&e[d-1][2]>l;d--)e[d]=e[d-1];e[d]=[t,a,l]},r.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={213:0,185:0,294:0};r.O.j=o=>0===e[o];var o=(o,t)=>{var a,l,[s,i,c]=t,n=0;if(s.some((o=>0!==e[o]))){for(a in i)r.o(i,a)&&(r.m[a]=i[a]);if(c)var d=c(r)}for(o&&o(t);nr(82)));a=r.O(a)})();