import{ac as c,a1 as p,a4 as h,ad as u}from"./DPwbf7XO.js";import{g as f}from"./Dl1HJz7f.js";function d(){return globalThis.$fetch}function g(t="5"){try{return localStorage.getItem("TenantId")||t}catch{return t}}function l(){try{return d()}catch{return globalThis.$fetch}}function m(t){const e=p(),n=e.public.serverApiBase,s=e.public.modulesApiBase,a=e.public.appApiBase;return t.startsWith(n)?h+t.slice(n.length):t.startsWith(s)?c+t.slice(s.length):t.startsWith(a)?u+t.slice(a.length):t}function T(t){const e=p(),n=t?.TenantId??t?.tenantId??g(String(e.public.tenantId)),s=f(),a={TenantId:String(n)};if(s&&(a.Authorization=s),t)for(const[o,i]of Object.entries(t))i!=null&&(a[o]=String(i));return a}function I(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/api/_server")||t.startsWith("/api/_modules")||t.startsWith("/api/_file")?t:t.startsWith("/api/app")?"/api/_app"+t.slice(8):t.startsWith("/")?c+t:c+"/"+t}async function r(t,e,n,s={}){const a=l(),o=I(m(e));return{data:await a(o,{method:t,query:s.params,body:n??s.data,headers:T(s.headers),responseType:s.responseType})}}const b={get:(t,e)=>r("GET",t,void 0,e),delete:(t,e)=>r("DELETE",t,void 0,e),post:(t,e,n)=>r("POST",t,e,n),put:(t,e,n)=>r("PUT",t,e,n)};export{b as r};