import { e as createComponent, k as renderComponent, r as renderTemplate, ak as defineScriptVars, g as addAttribute, m as maybeRenderHead } from '../chunks/astro/server_DePCulMI.mjs';
import 'piccolore';
import { $ as $$Layout } from '../chunks/Layout_DxAv3UTa.mjs';
import { $ as $$ProductCard } from '../chunks/ProductCard_7e_PI4fu.mjs';
import { a as getPriceDropsFromDB } from '../chunks/products_DQrRaeeW.mjs';
export { renderers } from '../renderers.mjs';

var __freeze = Object.freeze;
var __defProp = Object.defineProperty;
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(cooked.slice()) }));
var _a;
const $$Deals = createComponent(async ($$result, $$props, $$slots) => {
  function getDiscountPercent(sneaker) {
    return Math.round((sneaker.originalPrice - sneaker.lowestPrice) / sneaker.originalPrice * 100);
  }
  const deals = await getPriceDropsFromDB(24);
  const analyticsItems = deals.map((s, i) => ({
    item_id: s.id,
    item_name: `${s.brand} ${s.name}`,
    item_brand: s.brand,
    price: s.lowestPrice,
    index: i
  }));
  return renderTemplate`${renderComponent($$result, "Layout", $$Layout, { "title": "Deals \u2014 SneakerPicks", "description": "De beste sneaker deals en prijsdalingen. Bespaar tot 25% op populaire sneakers." }, { "default": async ($$result2) => renderTemplate(_a || (_a = __template([" ", '<section class="mx-auto max-w-7xl px-4 py-12 sm:px-6"> <div class="mb-8"> <h1 class="text-3xl font-black tracking-tight sm:text-4xl">\nDeals & Prijsdalingen\n</h1> <p class="mt-2 text-text-secondary">Sneakers die recent in prijs zijn gedaald</p> </div> <!-- Stats --> <div class="mb-8 grid grid-cols-3 gap-4"> <div class="rounded-2xl border border-border/50 bg-bg-card p-4 text-center"> <div class="text-2xl font-black text-deal">', '</div> <div class="text-xs text-text-muted">Actieve deals</div> </div> <div class="rounded-2xl border border-border/50 bg-bg-card p-4 text-center"> <div class="text-2xl font-black text-accent">-', '%</div> <div class="text-xs text-text-muted">Hoogste korting</div> </div> <div class="rounded-2xl border border-border/50 bg-bg-card p-4 text-center"> <div class="text-2xl font-black text-text">\u20AC', '</div> <div class="text-xs text-text-muted">Vanaf prijs</div> </div> </div> <!-- Filter buttons --> <div class="mb-8 flex flex-wrap gap-2"> ', ' </div> <div class="grid grid-cols-2 gap-4 sm:gap-6 md:grid-cols-3 lg:grid-cols-4"> ', " </div> </section> <script>(function(){", "\n    window.dataLayer = window.dataLayer || [];\n    window.dataLayer.push({ ecommerce: null });\n    window.dataLayer.push({\n      event: 'view_item_list',\n      ecommerce: {\n        item_list_id: 'deals',\n        item_list_name: 'Deals & Prijsdalingen',\n        items: analyticsItems.map(function(item) {\n          return Object.assign({}, item, { item_list_id: 'deals', item_list_name: 'Deals & Prijsdalingen' });\n        })\n      }\n    });\n  })();<\/script> "])), maybeRenderHead(), deals.length, Math.max(...deals.map((d) => getDiscountPercent(d))), Math.min(...deals.map((d) => d.lowestPrice)).toFixed(0), ["Alle", "> 10%", "> 15%", "> 20%"].map((label, i) => renderTemplate`<button${addAttribute([
    "rounded-xl px-4 py-2 text-sm font-bold transition-all",
    i === 0 ? "bg-deal text-white" : "bg-bg-card text-text-muted border border-border/50 hover:border-deal/50 hover:text-deal"
  ], "class:list")}> ${label} </button>`), deals.map((sneaker, i) => renderTemplate`${renderComponent($$result2, "ProductCard", $$ProductCard, { "sneaker": sneaker, "index": i })}`), defineScriptVars({ analyticsItems })) })}`;
}, "C:/Users/Roel/clawd/sneakerpicks/src/pages/deals.astro", void 0);

const $$file = "C:/Users/Roel/clawd/sneakerpicks/src/pages/deals.astro";
const $$url = "/deals";

const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  default: $$Deals,
  file: $$file,
  url: $$url
}, Symbol.toStringTag, { value: 'Module' }));

const page = () => _page;

export { page };
