import{a0 as f,Q as w,z as y}from"./UpFGpe05.js";const b=()=>{const r=f(),a=()=>{const e={},n=g();return n&&(e.Authorization=`${n}`),e},u=async(e,n={})=>{try{const o=r.public.productionEndpoint||"/api",t=await $fetch(e,{...n,baseURL:o,method:"GET",headers:a()});return t.data||t}catch(o){throw c(o),o}},i=async(e,n={},o={})=>{try{const t=r.public.productionEndpoint||"/api",s=a(),m={...o,baseURL:t,method:"POST",headers:s,body:n},h=await $fetch(e,m);return h.data||h}catch(t){throw c(t),t}},d=async(e,n={},o={})=>{try{const t=r.public.productionEndpoint||"/api",s=await $fetch(e,{...o,baseURL:t,method:"PUT",headers:a(),body:n});return s.data||s}catch(t){throw c(t),t}},p=async(e,n={})=>{try{const o=r.public.productionEndpoint||"/api",t=await $fetch(e,{...n,baseURL:o,method:"DELETE",headers:a()});return t.data||t}catch(o){throw c(o),o}},l=async(e,n={},o={})=>{try{const t=r.public.authAPIBaseURL||"/api",s=await $fetch(e,{...o,baseURL:t,method:"PUT",headers:a(),body:n});return s.data||s}catch(t){throw c(t),t}},c=e=>{e.status===401&&(console.warn("Token de autenticação inválido ou expirado"),localStorage.removeItem("auth_token"),sessionStorage.removeItem("auth_token"),w("/login"))},g=()=>{var e;try{return((e=y().token)==null?void 0:e.value)||null}catch{return localStorage.getItem("auth_token")||sessionStorage.getItem("auth_token")||null}};return{get:u,post:i,put:d,genericPut:l,delete:p}},k=()=>{const{get:r}=b();function a(i){return r(`/empresas/${i}`)}function u(){return r("/downloads/logomarcas")}return{getInfoEmpresa:a,getLogomarcas:u}};export{k as e,b as u};
