1import{n as r,o as d,q as l}from"./index-BCakBLyb.js";const m=s=>({...s,"Cache-Control":"no-store",Pragma:"no-cache",Expires:"0"}),n=s=>{const t=s.includes("?")?"&":"?";return`${s}${t}_ts=${Date.now()}`},u=s=>s?Array.isArray(s)?s:Array.isArray(s.data)?s.data:s.data?[s.data]:[]:[],c=s=>s?s.attributes?{id:s.id,...s.attributes}:s:null,p=s=>s&&typeof s=="object"&&"data"in s?s:{data:s};async function a(s,t={}){var e;const o=await fetch(s,{...t,headers:m(l())});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(((e=i==null?void 0:i.error)==null?void 0:e.message)||`Error ${o.status}`)}return o.json()}const y={async getAll(){const s=await a(n(r("shop-sucursales?populate=*&sort=nombre:asc")));return u(s).map(c)}},b={async getAll(s){const t="shop-bodegas?populate=*&sort=nombre:asc",o=s?`${t}&${s}`:t,e=await a(n(r(o)));return u(e).map(c)},async getBySucursal(s){const t=await a(n(r(`shop-bodegas?filters[sucursales][documentId][$eq]=${s}&populate=*&sort=nombre:asc`)));return u(t).map(c)}},f={async getAll(s){const t="shop-producto-sucursales?populate=producto,variante,insumo,servicio,sucursal&sort=createdAt:desc",o=s?`${t}&${s}`:t,e=await a(n(r(o)));return u(e).map(c)},async getBySucursal(s){const t=await a(n(r(`shop-producto-sucursales?filters[sucursal][documentId][$eq]=${s}&populate=producto,variante,insumo,servicio,sucursal&sort=createdAt:desc`)));return u(t).map(c)},async create(s){const t=await a(r("shop-producto-sucursales"),{method:"POST",body:JSON.stringify(p(s))}),o=c(t.data||t);return o&&d({moduleName:"Alcance",action:"created",record:o,recordId:o.documentId||o.id,route:"/shop/scope",payload:s}),o},async update(s,t){const o=await a(r(`shop-producto-sucursales/${s}`),{method:"PUT",body:JSON.stringify(p(t))}),e=c(o.data||o);return e&&d({moduleName:"Alcance",action:"updated",record:e,recordId:e.documentId||e.id,route:"/shop/scope",payload:t}),e},async delete(s){await a(r(`shop-producto-sucursales/${s}`),{method:"DELETE"}),d({moduleName:"Alcance",action:"deleted",record:{documentId:s},recordId:s,payload:{eliminado:!0}})}};export{f as a,b,y as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.