import { _ as __nuxt_component_0 } from './Map-CxQqTKvS.mjs';
import { _ as __nuxt_component_1 } from './HowToArriveNav-BOuf10gD.mjs';
import { V as VLazy, _ as __nuxt_component_1$1 } from './VLazy-7NXzod89.mjs';
import { defineComponent, withAsyncContext, mergeProps, withCtx, unref, createVNode, toDisplayString, openBlock, createBlock, createCommentVNode, Fragment, renderList, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrInterpolate, ssrRenderList } from 'vue/server-renderer';
import { s as useState, t as useRoute$2, v as useFetch, w as createError, x as useHead, r as VContainer } from './server.mjs';
import './nuxt-link-GqjpOmWr.mjs';
import '../nitro/nitro.mjs';
import 'luxon';
import '@sequelize/core';
import 'html-to-text';
import 'zod';
import 'crypto';
import 'node:fs';
import 'sharp';
import 'path';
import 'node:stream';
import 'jsdom';
import 'dompurify';
import 'mime-types';
import 'fs';
import 'fs/promises';
import 'linkify-html';
import '@peertube/http-signature';
import 'jsonld';
import 'lodash.intersection';
import 'email-templates';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'node:events';
import 'node:buffer';
import 'node:path';
import 'vue-router';
import 'dotenv';
import 'url';
import 'bcryptjs';
import 'slugify';
import 'umzug';
import 'consola';
import '@sequelize/core/decorators-legacy';
import 'util';
import 'mitt';
import 'ical.js';
import 'node:url';
import 'fast-xml-parser';
import './Img-CbtP1FQx.mjs';
import './useTime-xYTJHVg1.mjs';
import './VAvatar-oghuaLjs.mjs';
import './VCardText-D-diyBaj.mjs';
import './VChip-BM5W0ePt.mjs';
import './index-1z1zC4K2.mjs';
import 'perfect-debounce';
import 'v-calendar';
import 'linkifyjs';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "[slug]",
  __ssrInlineRender: true,
  async setup(__props) {
    let __temp, __restore;
    const settings = useState("settings");
    const route = useRoute$2();
    const { data } = ([__temp, __restore] = withAsyncContext(() => useFetch(
      `/api/events/place/${route.params.id}`,
      "$GZe7wefqyG"
      /* nuxt-injected */
    )), __temp = await __temp, __restore(), __temp);
    if (!data.value) {
      throw createError({ status: 404, statusMessage: `Place ${route.params?.id} not found` });
    }
    useHead(() => {
      const title = `${settings.value.title} - ${data.value?.place?.name}`;
      return {
        title,
        link: [
          { rel: "alternate", type: "application/rss+xml", title, href: settings.value.baseurl + `/feed/rss/place/${data.value?.place.name}` },
          { rel: "alternate", type: "text/calendar", title, href: settings.value.baseurl + `/feed/ics/place/${data.value?.place?.name}` }
        ]
      };
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_Map = __nuxt_component_0;
      const _component_HowToArriveNav = __nuxt_component_1;
      const _component_EventCard = __nuxt_component_1$1;
      _push(ssrRenderComponent(VContainer, mergeProps({
        id: "home",
        class: "px-2 px-sm-6 pt-0"
      }, _attrs), {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<h1 class="d-block text-h4 font-weight-black text-center text-uppercase mt-10 mx-auto w-100 text-underline"${_scopeId}><u${_scopeId}>${ssrInterpolate(unref(data).place?.name)}</u></h1>`);
            if (unref(data).place?.name !== "online") {
              _push2(`<span class="d-block text-subtitle text-center w-100"${_scopeId}>${ssrInterpolate(unref(data).place?.address)}</span>`);
            } else {
              _push2(`<!---->`);
            }
            if (unref(settings)?.allow_geolocation && unref(data).place?.latitude && unref(data).place?.longitude) {
              _push2(`<div class="position-relative my-4"${_scopeId}>`);
              _push2(ssrRenderComponent(_component_Map, {
                place: unref(data).place,
                height: "12rem"
              }, null, _parent2, _scopeId));
              _push2(ssrRenderComponent(_component_HowToArriveNav, {
                place: unref(data).place
              }, null, _parent2, _scopeId));
              _push2(`</div>`);
            } else {
              _push2(`<!---->`);
            }
            _push2(`<section class="events mt-sm-4 mt-2"${_scopeId}><!--[-->`);
            ssrRenderList(unref(data).events, (event, idx) => {
              _push2(ssrRenderComponent(VLazy, {
                key: event.id,
                class: "event",
                "model-value": idx < 9,
                options: { threshold: 0.5, rootMargin: "500px" }
              }, {
                default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                  if (_push3) {
                    _push3(ssrRenderComponent(_component_EventCard, {
                      event,
                      lazy: idx > 9,
                      "hide-thumbs": unref(settings).hide_thumbs
                    }, null, _parent3, _scopeId2));
                  } else {
                    return [
                      createVNode(_component_EventCard, {
                        event,
                        lazy: idx > 9,
                        "hide-thumbs": unref(settings).hide_thumbs
                      }, null, 8, ["event", "lazy", "hide-thumbs"])
                    ];
                  }
                }),
                _: 2
              }, _parent2, _scopeId));
            });
            _push2(`<!--]--></section>`);
            if (unref(data)?.pastEvents.length) {
              _push2(`<h2 class="mt-14 mb-3"${_scopeId}>${ssrInterpolate(_ctx.$t("common.past_events"))}</h2>`);
            } else {
              _push2(`<!---->`);
            }
            if (unref(data)?.pastEvents.length) {
              _push2(`<section class="events"${_scopeId}><!--[-->`);
              ssrRenderList(unref(data).pastEvents, (event, idx) => {
                _push2(ssrRenderComponent(VLazy, {
                  key: event.id,
                  class: "event",
                  "model-value": idx < 9,
                  options: { threshold: 0.5, rootMargin: "500px" }
                }, {
                  default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                    if (_push3) {
                      _push3(ssrRenderComponent(_component_EventCard, {
                        event,
                        lazy: idx > 9,
                        "hide-thumbs": unref(settings).hide_thumbs
                      }, null, _parent3, _scopeId2));
                    } else {
                      return [
                        createVNode(_component_EventCard, {
                          event,
                          lazy: idx > 9,
                          "hide-thumbs": unref(settings).hide_thumbs
                        }, null, 8, ["event", "lazy", "hide-thumbs"])
                      ];
                    }
                  }),
                  _: 2
                }, _parent2, _scopeId));
              });
              _push2(`<!--]--></section>`);
            } else {
              _push2(`<!---->`);
            }
          } else {
            return [
              createVNode("h1", { class: "d-block text-h4 font-weight-black text-center text-uppercase mt-10 mx-auto w-100 text-underline" }, [
                createVNode("u", null, toDisplayString(unref(data).place?.name), 1)
              ]),
              unref(data).place?.name !== "online" ? (openBlock(), createBlock("span", {
                key: 0,
                class: "d-block text-subtitle text-center w-100"
              }, toDisplayString(unref(data).place?.address), 1)) : createCommentVNode("", true),
              unref(settings)?.allow_geolocation && unref(data).place?.latitude && unref(data).place?.longitude ? (openBlock(), createBlock("div", {
                key: 1,
                class: "position-relative my-4"
              }, [
                createVNode(_component_Map, {
                  place: unref(data).place,
                  height: "12rem"
                }, null, 8, ["place"]),
                createVNode(_component_HowToArriveNav, {
                  place: unref(data).place
                }, null, 8, ["place"])
              ])) : createCommentVNode("", true),
              createVNode("section", { class: "events mt-sm-4 mt-2" }, [
                (openBlock(true), createBlock(Fragment, null, renderList(unref(data).events, (event, idx) => {
                  return openBlock(), createBlock(VLazy, {
                    key: event.id,
                    class: "event",
                    "model-value": idx < 9,
                    options: { threshold: 0.5, rootMargin: "500px" }
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_EventCard, {
                        event,
                        lazy: idx > 9,
                        "hide-thumbs": unref(settings).hide_thumbs
                      }, null, 8, ["event", "lazy", "hide-thumbs"])
                    ]),
                    _: 2
                  }, 1032, ["model-value"]);
                }), 128))
              ]),
              unref(data)?.pastEvents.length ? (openBlock(), createBlock("h2", {
                key: 2,
                class: "mt-14 mb-3"
              }, toDisplayString(_ctx.$t("common.past_events")), 1)) : createCommentVNode("", true),
              unref(data)?.pastEvents.length ? (openBlock(), createBlock("section", {
                key: 3,
                class: "events"
              }, [
                (openBlock(true), createBlock(Fragment, null, renderList(unref(data).pastEvents, (event, idx) => {
                  return openBlock(), createBlock(VLazy, {
                    key: event.id,
                    class: "event",
                    "model-value": idx < 9,
                    options: { threshold: 0.5, rootMargin: "500px" }
                  }, {
                    default: withCtx(() => [
                      createVNode(_component_EventCard, {
                        event,
                        lazy: idx > 9,
                        "hide-thumbs": unref(settings).hide_thumbs
                      }, null, 8, ["event", "lazy", "hide-thumbs"])
                    ]),
                    _: 2
                  }, 1032, ["model-value"]);
                }), 128))
              ])) : createCommentVNode("", true)
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/place/[id]/[slug].vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};

export { _sfc_main as default };
