"use strict";
(() => {
var exports = {};
exports.id = 531;
exports.ids = [531];
exports.modules = {

/***/ 7941:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   "getServerSideProps": () => (/* binding */ getServerSideProps)
/* harmony export */ });
/* harmony import */ var _lib_rssFetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9956);
/* harmony import */ var _lib_NewUrlCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8953);


function SitemapDynamic() {}
async function getServerSideProps({ res , params , resolvedUrl  }) {
    try {
        // console.log("=== SITEMAP DYNAMIC ===");
        // console.log("params:", params);
        // console.log("params.id:", params.id);
        // console.log("resolvedUrl:", resolvedUrl);
        const { id  } = params;
        // console.log("id value:", id);
        // Check if this is a content sitemap request
        if (!id || !id.startsWith("content-") || !id.endsWith(".xml")) {
            console.log("Not a content sitemap request");
            res.statusCode = 404;
            res.end("Not found");
            return {
                props: {}
            };
        }
        // Extract number from "content-1.xml"
        const contentId = id.replace("content-", "").replace(".xml", "");
        // console.log("Looking for content ID:", contentId);
        const generateContent = await (0,_lib_rssFetch__WEBPACK_IMPORTED_MODULE_0__/* .getSitemapContent */ .yM)();
        // console.log("Available content keys:", Object.keys(generateContent));
        const items = generateContent[contentId];
        if (!items || items.length === 0) {
            console.log("No items found");
            res.statusCode = 404;
            res.end("Sitemap not found");
            return {
                props: {}
            };
        }
        // console.log("Generating XML for", items.length, "items");
        const xml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
${items.map((item)=>{
            return `
  <url>
      <loc>${`${"https://trsondakika.com"}${(0,_lib_NewUrlCheck__WEBPACK_IMPORTED_MODULE_1__/* .CheckUrlSlug */ .v)(item.id, item.categorySlug, item.slug)}`}</loc>
      <lastmod>${new Date(item.published_at).toISOString()}</lastmod>          
      <priority>1.0</priority>
      <image:image>
        <image:loc>${`${"https://trsondakika-front.s3.amazonaws.com"}/${item.image}`}</image:loc>
        <image:title>${item.title}</image:title>
        <image:caption>${item.title}</image:caption>
      </image:image>
  </url>
`;
        }).join("")}
</urlset>`;
        res.setHeader("Content-Type", "text/xml");
        res.setHeader("Cache-Control", "s-maxage=3600, stale-while-revalidate");
        res.write(xml);
        res.end();
        return {
            props: {}
        };
    } catch (error) {
        console.error("=== Error ===");
        console.error(error);
        res.statusCode = 500;
        res.end("Error generating sitemap");
        return {
            props: {}
        };
    }
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SitemapDynamic);


/***/ })

};
;

// load runtime
var __webpack_require__ = require("../../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [639], () => (__webpack_exec__(7941)));
module.exports = __webpack_exports__;

})();