import{c as r,b as f}from"./dc0o8kHW.js";import{e as l}from"./92N1comP.js";async function u(){return r.get("/flex-objects")}async function d(t){return r.get(`/flex-objects/${t}/metadata`)}async function p(t,e={}){const a={};if(e.page&&(a.page=String(e.page)),e.perPage&&(a.per_page=String(e.perPage)),e.search&&(a.search=e.search),e.sort&&(a.sort=e.sort),e.order&&(a.order=e.order),e.filters)for(const[i,o]of Object.entries(e.filters))o!=null&&(a[`filters[${i}]`]=String(o));const s=await r.getFullBody(`/flex-objects/${t}`,a),n=s.data??[],c=s.meta?.pagination??{};return{objects:n,total:c.total??n.length,page:c.page??e.page??1,perPage:c.per_page??e.perPage??20,totalPages:c.total_pages??1}}async function j(t,e){const{data:a,headers:s}=await r.requestRaw("GET",`/flex-objects/${t}/${e}`);return{object:a,etag:l(s)}}async function h(t,e){return r.post(`/flex-objects/${t}`,e)}async function x(t,e,a,s){const n={};s&&(n["If-Match"]=`"${s}"`);const c=await r.requestRaw("PATCH",`/flex-objects/${t}/${e}`,{body:a,headers:n});return{object:c.data,etag:l(c.headers)}}async function m(t,e){await r.delete(`/flex-objects/${t}/${e}`)}async function $(t){return r.get(`/blueprints/flex-objects/${t}`)}async function y(t){const e={Accept:"application/x-yaml"};f.accessToken&&(e["X-API-Token"]=f.accessToken);const a=await fetch(`${r.baseUrl}/flex-objects/${t}/export`,{headers:e});if(!a.ok)throw new Error("Export failed");const c=(a.headers.get("content-disposition")??"").match(/filename="?([^"]+)"?/)?.[1]??`${t}-export.yaml`;return{blob:await a.blob(),filename:c}}export{u as a,$ as b,h as c,m as d,y as e,j as f,p as g,d as h,x as u};
