import{j as o}from"./main.84523976.js";const s="inventario",v=async(e={})=>(await o.get(`${s}/alertas`,{params:e})).data,f=async(e={})=>(await o.get(s,{params:e})).data,$=async e=>(await o.post(`${s}/ajustar`,e)).data,R=async(e={})=>(await o.get(`${s}/movimientos`,{params:e})).data,b=async(e={})=>(await o.get(`${s}/reporte`,{params:e})).data,h=async(e={})=>(await o.get(`${s}/reporte/exportar`,{params:e})).data,y=async(e={})=>(await o.get(`${s}/movimientos-reporte`,{params:e})).data,j=async(e={})=>{const t=window.localStorage.getItem("token"),p={}.VITE_API_URL||"/api",i=new URLSearchParams(e).toString(),m=`${p}/${s}/movimientos-reporte/pdf${i?`?${i}`:""}`,a=await fetch(m,{headers:{Authorization:t?`Bearer ${t}`:"",Accept:"application/pdf"}});if(!a.ok){const n=await a.json().catch(()=>({})),l=n!=null&&n.errors?Object.values(n.errors).flat().join(" "):(n==null?void 0:n.message)||"No se pudo generar el PDF";throw new Error(l)}const d=await a.blob(),c=(a.headers.get("content-disposition")||"").match(/filename="?([^";]+)"?/i),g=(c==null?void 0:c[1])||`resumen_movimientos_inventario_${new Date().toISOString().slice(0,10)}.pdf`,r=document.createElement("a");r.href=URL.createObjectURL(d),r.download=g,r.click(),URL.revokeObjectURL(r.href)},k=async(e={})=>(await o.get(`${s}/movimientos-reporte/csv`,{params:e})).data;export{f as a,$ as b,R as c,b as d,h as e,y as f,v as g,j as h,k as i};
