import{k as i,j as d,$ as u,y as o,m as c}from"./LrfSKRHt.js";const l=r=>{if(!r)return[];const n=[];return r.forEach(e=>{const a=n.find(s=>s.id===e.id),t={id:e.channelId,language:e.language,deliveryMethodImages:e.deliveryMethodImages,countrySwitcherText:e.countrySwitcherText,paymentMethodImages:e.paymentMethodImages};if(a){a.channels.push(t);return}n.push({id:e.id,name:e.name,currency:e.currency,channels:[t],digitalPrint:e.digitalPrint})}),n},m=()=>{const r=i(),{apiEndpoint:n}=d(),e=u("litium-available-countries");return o("available-countries",async()=>{var t,s;const a=await $fetch(n,{method:"POST",credentials:"include",body:{query:`query getCountries($url: String!) { session(url: $url) { 
            countries {
              id
              name
              channelId
              digitalPrint
              language {
                id
                name
              }
              currency
              countrySwitcherText
              paymentMethodImages {
                alt
                id
              }
              deliveryMethodImages {
                alt
                id
              }
            }
          } }`,variables:{url:r}},headers:e});if(c(a.data))throw new Error("Litium responded with error");return l(((s=(t=a.data)==null?void 0:t.session)==null?void 0:s.countries)??[])},{dedupe:"defer",deep:!1,getCachedData:(a,t)=>t.payload.data[a]})};export{m as u};