import { c as createComponent, d as renderComponent, r as renderTemplate, b as createAstro, m as maybeRenderHead } from '../../chunks/astro/server_DrnzQWw3.mjs';
import 'kleur/colors';
import { $ as $$BaseLayout } from '../../chunks/BaseLayout_Bc2tHXHa.mjs';
import { $ as $$PostCard } from '../../chunks/PostCard_D8td2Gog.mjs';
import { r as readCms, a as getPostsByCategory, b as getApprovedPosts } from '../../chunks/cms_CRTVymfB.mjs';
export { renderers } from '../../renderers.mjs';

const $$Astro = createAstro();
const $$category = createComponent(async ($$result, $$props, $$slots) => {
  const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
  Astro2.self = $$category;
  const cms = await readCms();
  const category = decodeURIComponent(Astro2.params.category ?? "");
  if (!cms.categories.includes(category)) {
    return Astro2.redirect("/posts/");
  }
  const categoryPosts = getPostsByCategory(getApprovedPosts(cms), category);
  return renderTemplate`${renderComponent($$result, "BaseLayout", $$BaseLayout, { "title": `${category} | \u0631\u0648\u0633 \u0627\u0645\u0631\u0648\u0632`, "description": `\u0622\u062E\u0631\u06CC\u0646 \u0627\u062E\u0628\u0627\u0631 \u0648 \u062A\u062D\u0644\u06CC\u0644\u200C\u0647\u0627\u06CC ${category} \u062F\u0631 \u0631\u0648\u0633 \u0627\u0645\u0631\u0648\u0632` }, { "default": async ($$result2) => renderTemplate` ${maybeRenderHead()}<main class="max-w-7xl mx-auto px-4 lg:px-8 py-8"> <div class="mb-6"> <a href="/posts/" class="text-brand text-sm font-bold">آرشیو اخبار</a> <h1 class="text-2xl font-black mt-1">اخبار ${category}</h1> <p class="text-gray-500 text-sm mt-2">مجموعه خبرها و تحلیل‌های منتشر شده در بخش ${category}</p> </div> <div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> ${categoryPosts.map((post) => renderTemplate`${renderComponent($$result2, "PostCard", $$PostCard, { "post": post })}`)} </div> </main> ` })}`;
}, "/Users/drfelfel/ruseemrooz/src/pages/categories/[category].astro", void 0);

const $$file = "/Users/drfelfel/ruseemrooz/src/pages/categories/[category].astro";
const $$url = "/categories/[category]";

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

const page = () => _page;

export { page };
