module.exports=[50640,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"InvariantError",{enumerable:!0,get:function(){return d}});class d extends Error{constructor(a,b){super(`Invariant: ${a.endsWith(".")?a:a+"."} This is a bug in Next.js.`,b),this.name="InvariantError"}}},25343,a=>{"use strict";var b=a.i(37936),c=a.i(98310),d=a.i(18558);async function e(){let a=await (0,c.createClient)(),{data:b,error:d}=await a.from("products").select("*, category:categories(*), modules:product_modules(*)").order("created_at",{ascending:!1});if(d)throw d;return b}async function f(){let a=await (0,c.createClient)(),{data:b,error:d}=await a.from("categories").select("*").order("sort_order",{ascending:!0});if(d)throw d;return b}async function g(a){let b=await (0,c.createClient)(),{data:e,error:f}=await b.from("categories").insert([a]).select().single();if(f)throw f;return(0,d.revalidatePath)("/admin/categories"),(0,d.revalidatePath)("/order"),e}async function h(a,b){let e=await (0,c.createClient)(),{error:f}=await e.from("categories").update(b).eq("id",a);if(f)throw f;(0,d.revalidatePath)("/admin/categories"),(0,d.revalidatePath)("/order")}async function i(a){let b=await (0,c.createClient)(),{error:e}=await b.from("categories").delete().eq("id",a);if(e)throw e;(0,d.revalidatePath)("/admin/categories"),(0,d.revalidatePath)("/order")}async function j(a,b){let e=await (0,c.createClient)(),{data:f,error:g}=await e.from("products").insert([a]).select().single();if(g)throw g;if(b.length>0){let a=b.map(a=>({...a,product_id:f.id})),{error:c}=await e.from("product_modules").insert(a);if(c)throw c}return(0,d.revalidatePath)("/admin/products"),(0,d.revalidatePath)("/order"),f}async function k(a,b,e){let f=await (0,c.createClient)(),{error:g}=await f.from("products").update(b).eq("id",a);if(g)throw g;if(await f.from("product_modules").delete().eq("product_id",a),e.length>0){let b=e.map(b=>({name:b.name,description:b.description||null,price:b.price,requirements:b.requirements||[],exclusions:b.exclusions||[],product_id:a})),{error:c}=await f.from("product_modules").insert(b);if(c)throw c}(0,d.revalidatePath)("/admin/products"),(0,d.revalidatePath)("/order")}async function l(a){let b=await (0,c.createClient)(),{error:e}=await b.from("products").delete().eq("id",a);if(e)throw e;(0,d.revalidatePath)("/admin/products"),(0,d.revalidatePath)("/order")}(0,a.i(13095).ensureServerEntryExports)([e,f,g,h,i,j,k,l]),(0,b.registerServerReference)(e,"00c025951ac48bbc471c319f97bf1a8040d996e943",null),(0,b.registerServerReference)(f,"00c33c218db92f0574a15792844c36b40835c2551f",null),(0,b.registerServerReference)(g,"407bdb7aaaf3a11c053fdd318f09738d3866a746b2",null),(0,b.registerServerReference)(h,"604ec31c2cd7dd2e95a8ca506e3f6160189d8a40a5",null),(0,b.registerServerReference)(i,"40fe250b848634e555d6fa7c234529bc0c459a5f34",null),(0,b.registerServerReference)(j,"605638da51e488c9781483a4b154c1a2ce2578676c",null),(0,b.registerServerReference)(k,"70b0a56442225be2d84273d7139da0338a60dd4c1b",null),(0,b.registerServerReference)(l,"400e9b629f70ea93b510ba2950527adf41205870db",null),a.s(["createCategory",0,g,"createProduct",0,j,"deleteCategory",0,i,"deleteProduct",0,l,"getCategories",0,f,"getProducts",0,e,"updateCategory",0,h,"updateProduct",0,k])},15158,a=>{"use strict";var b=a.i(25343);a.s([],75557),a.i(75557),a.s(["00c025951ac48bbc471c319f97bf1a8040d996e943",()=>b.getProducts,"00c33c218db92f0574a15792844c36b40835c2551f",()=>b.getCategories,"400e9b629f70ea93b510ba2950527adf41205870db",()=>b.deleteProduct,"407bdb7aaaf3a11c053fdd318f09738d3866a746b2",()=>b.createCategory,"40fe250b848634e555d6fa7c234529bc0c459a5f34",()=>b.deleteCategory,"604ec31c2cd7dd2e95a8ca506e3f6160189d8a40a5",()=>b.updateCategory,"605638da51e488c9781483a4b154c1a2ce2578676c",()=>b.createProduct,"70b0a56442225be2d84273d7139da0338a60dd4c1b",()=>b.updateProduct],15158)}];

//# sourceMappingURL=_0lz5pg_._.js.map