import{I as p,M as v,C as L,z as T,p as b,B as E,b4 as I,A as g,b5 as S,b6 as _,b7 as w,b8 as O,b9 as R}from"./bdrFovXZ.js";import{s as y}from"./CbnVsA8k.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalthis:typeof self<"u"?self:{};n.sentry_release={id:"dcd43fef1e4af7f7614a43abf36301348c5fce67"}}catch{}})();try{(function(){var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalthis:typeof self<"u"?self:{},l=new n.Error().stack;l&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[l]="9514e7ae-e8f8-462f-952b-5a0bfc1bf21f",n._sentryDebugIdIdentifier="sentry-dbid-9514e7ae-e8f8-462f-952b-5a0bfc1bf21f")})()}catch{}const U=()=>{const n=p(),{selectedLanguage:l}=v(n),{t:a,loadLocaleMessages:i}=L({useScope:"global"});return{translate:async r=>{const u=l.value;return u?(await i(u),a(r,1,{locale:u})??r):a(r)??r}}},A=T("countriesStore",()=>{const n=p(),{translate:l}=U(),a=b({}),i=b({}),f=b("");E(()=>n.selectedLanguage,async e=>{e&&I.includes(e)&&(f.value=await l("country.other"),C())},{immediate:!0});const r=e=>{e&&(a.value=e,i.value[n.selectedLanguage]=e)},u=g(()=>{let e=[];const o=S(f.value);if(Object.keys(a.value).length===0)return[o];const t=_.filter(s=>!!a.value[s]).map(s=>({id:a.value[s].code,label:a.value[s].name,image:a.value[s].flagPng})),c=t.splice(0,R.length);return y(t,"label"),e=[...c,...t,o],e.find(s=>s.id===n.selectedCountry)||n.setSelectedCountry(e[0].id),e}),h=g(()=>{if(Object.keys(a.value).length===0)return[];const e=Object.values(a.value).filter(t=>t.code!=="RU").map(t=>({id:t.code,label:t.name,image:t.flagPng})),o=[];for(const t of w){const c=e.findIndex(s=>s.id===t);if(c===-1)continue;const[d]=e.splice(c,1);o.push(d)}return y(e,"label"),[...o,...e]}),C=async()=>{const e=i.value[n.selectedLanguage];if(e){r(e);return}try{const o=await $fetch("/api/countries",{query:{language:n.selectedLanguage}});r(o._children)}catch(o){console.error("Failed to fetch data:",o)}},m=g(()=>{if(Object.keys(a.value).length===0)return{countriesList:[]};const e=Object.values(a.value).map(t=>({id:t.code,code:t.code,label:`${t.name} (${t.dialingCode})`,displayLabel:`${t.dialingCode}`,image:t.flagPng,name:t.name})),o=[];for(const t of O){const c=e.findIndex(s=>s.code===t);if(c===-1)continue;const[d]=e.splice(c,1);o.push(d)}return y(e,"name"),{countriesList:[{label:"countryCodes.frequentlyUsed",options:o},{label:"countryCodes.allCountries",options:e}]}});return{countries:a,availableCountries:u,countryPhoneCodes:m,sortedCountriesWithPopularFirst:h,getCountriesFromAPI:C,cachedCountries:i}});export{U as a,A as u}; //# sourceMappingURL=BSlRQa63.js.map

AltStyle によって変換されたページ (->オリジナル) /