import{b as r,c as o}from"./CF1ujZlL.js";import{e as i}from"./92N1comP.js";async function g(){return r.get("/flex-objects")}async function p(t,e={}){const a={};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);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 u(t,e){const{data:a,headers:s}=await r.requestRaw("GET",`/flex-objects/${t}/${e}`);return{object:a,etag:i(s)}}async function d(t,e){return r.post(`/flex-objects/${t}`,e)}async function j(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:i(c.headers)}}async function h(t,e){await r.delete(`/flex-objects/${t}/${e}`)}async function x(t){return r.get(`/blueprints/flex-objects/${t}`)}async function m(t){const e={Accept:"application/x-yaml"};o.accessToken&&(e["X-API-Token"]=o.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{p as a,u as b,x as c,h as d,m as e,d as f,g,j as u};
