import{a as addQueryArgs}from"./add-query-args-0e2a8393.js";var _a;const STATE_INCLUDED_COUNTRIES=["AU","BR","CA","CH","ES","HK","IE","IN","IT","JP","MY","MX","US"],POSTAL_CODE_EXCLUDED_COUNTRIES=["HK"],CITY_EXCLUDED_COUNTRIES=["SG"],hasPostal=a=>!POSTAL_CODE_EXCLUDED_COUNTRIES.includes(a),hasCity=a=>!CITY_EXCLUDED_COUNTRIES.includes(a),hasState=a=>STATE_INCLUDED_COUNTRIES.includes(a),lang=(null===(_a=window.scData)||void 0===_a?void 0:_a.locale)||navigator.language||(null===navigator||void 0===navigator?void 0:navigator.browserLanguage)||(navigator.languages||["en"])[0],countryChoices=async()=>{var a,o,l,t;const i=addQueryArgs("https://api.surecart.com/v1/public/atlas",{locale:lang}),s=await fetch(i),n=await s.json(),e=null===(a=(null==n?void 0:n.data)||[])||void 0===a?void 0:a.map((({code:a,name:o})=>({value:a,label:o})));return(null===(t=null===(l=null===(o=null===window||void 0===window?void 0:window.wp)||void 0===o?void 0:o.hooks)||void 0===l?void 0:l.applyFilters)||void 0===t?void 0:t.call(l,"surecart_address_countries",e))||e},getCountryDetails=async a=>{const o=addQueryArgs(`https://api.surecart.com/v1/public/atlas/${a}`,{locale:lang}),l=await fetch(o);return await l.json()},isAddressComplete=a=>(null==a?void 0:a.country)&&(null==a?void 0:a.line_1)&&(!hasPostal(a.country)||(null==a?void 0:a.postal_code))&&(!hasCity(a.country)||(null==a?void 0:a.city))&&(!hasState(a.country)||(null==a?void 0:a.state));export{countryChoices as c,getCountryDetails as g,isAddressComplete as i};