(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const n=window.wp.element,t=window.wp.htmlEntities,i=window.wc.components,o=({options:e,initialValues:t})=>{const[o,r]=(0,n.useState)(t);return(0,n.createElement)(i.TreeSelectControl,{value:o,onChange:e=>{document.body.dispatchEvent(new CustomEvent("wc_region_picker_update",{detail:e})),r(e)},options:e,placeholder:"Start typing to filter zones",selectAllLabel:"Select all countries",individuallySelectParent:!0,maxVisibleTags:5})},r=window.wc.currency,l=window.wc.number,c=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=(e,n)=>{if("number"==typeof n)return(0,l.numberFormat)(e,n);if("string"==typeof n){const t=c(e.decimalSeparator),i=c(e.thousandSeparator),o=new RegExp(`^\\s*(\\d+|\\d{1,3}(?:${i}\\d{3})*)(?:${t}\\d+)?\\s*$`);return n.replace(o,(n=>{const t=(0,l.parseNumber)(e,n);return(0,l.numberFormat)(e,t)}))}return n},d=()=>{const e=(0,n.useContext)(r.CurrencyContext);return(0,n.useEffect)((()=>{window.wc.ShippingCurrencyContext=window.wc.ShippingCurrencyContext||e,window.wc.ShippingCurrencyNumberFormat=window.wc.ShippingCurrencyNumberFormat||a}),[e]),null},u=(e,n)=>Array.isArray(e)?e.map((e=>u(e,n))):(e.label&&(e.label=n(e.label)),e.children&&(e.children=u(e.children,n)),e);var p,s;const w=document.getElementById("wc-shipping-zone-region-picker-root"),m=null!==(p=u(window.shippingZoneMethodsLocalizeScript?.region_options,t.decodeEntities))&&void 0!==p?p:[],g=null!==(s=window.shippingZoneMethodsLocalizeScript?.locations)&&void 0!==s?s:[];w&&(0,n.createRoot)(w).render((0,n.createElement)((()=>(0,n.createElement)("div",null,(0,n.createElement)(d,null),(0,n.createElement)(o,{options:m,initialValues:g}))),null)),(window.wc=window.wc||{}).shippingSettingsRegionPicker=e})();