import { computed as _, createElementBlock as i, openBlock as o, createElementVNode as s, Fragment as D, renderList as H, unref as e, createBlock as c, toDisplayString as f, createCommentVNode as r, normalizeStyle as T, createVNode as z } from "vue";
import { useMd as A, useColor as E, usePost as F, usePosts as Q } from "./composables-BAZQlC3e.js";
import { PostLine as Y, UiLink as q, QrShare as G, PostActionUpdate as I, EmbedYoutube as J, PostList as K } from "./components.js";
const O = { class: "rounded-lg max-w-65ch flex flex-col items-stretch justify-center w-full overscroll-contain bg-light-200 dark-bg-dark-500" }, R = { class: "flex flex-wrap" }, W = { class: "z-30 flex flex-wrap items-center w-full px-4 py-2 sticky top-0 shadow-xl filter grayscale-70 hover-grayscale-0 transition duration-400ms" }, X = { class: "ml-1 break-all font-bold" }, Z = {
  class: "flex-1 flex flex-col items-stretch",
  style: { flex: "10 1 300px" }
}, ee = {
  key: 0,
  class: "z-1 max-w-100vw"
}, te = ["src"], se = { class: "flex flex-wrap items-start w-full justify-start" }, le = { class: "w-full flex flex-col items-stretch" }, oe = { class: "p-2" }, ie = ["src"], ne = {
  key: 1,
  class: "text-2xl font-bold m-2"
}, re = {
  key: 3,
  class: "m-2"
}, ae = { class: "flex flex-wrap p-4 bg-dark-50 bg-opacity-25 dark-bg-dark-400 w-full items-center gap-1 text-sm" }, de = {
  key: 0,
  class: "i-la-file-download"
}, ue = {
  key: 1,
  class: "i-la-redo-alt animate-spin"
}, ce = ["innerHTML"], ve = {
  __name: "PostPage",
  props: {
    tag: { type: String, default: "" },
    hash: { type: String, default: "" }
  },
  emits: ["close", "browse", "user"],
  setup(d) {
    const M = A(), u = d;
    _(() => E("light").hex(u.hash));
    const N = _(() => E("deep").hex(u.hash)), { post: l, download: U, downloading: V } = F({ hash: u.hash }), { posts: me, backlinks: j } = Q(u.hash);
    return (a, t) => {
      var x, k, v, h, p, y, g, b, w, $, C, P, L, S;
      return o(), i("div", O, [
        s("div", R, [
          (o(!0), i(D, null, H(e(j), (n, m) => (o(), c(e(Y), {
            key: m,
            style: { flex: "1 1 220px" },
            hash: m,
            tag: d.tag,
            authors: n,
            back: !0,
            onUser: t[0] || (t[0] = (B) => a.$emit("user", B)),
            onClick: (B) => a.$emit("browse", m)
          }, null, 8, ["hash", "tag", "authors", "onClick"]))), 128))
        ]),
        s("div", W, [
          s("div", {
            class: "hover-underline text-md cursor-pointer font-bold flex",
            onClick: t[1] || (t[1] = (n) => a.$emit("close"))
          }, t[6] || (t[6] = [
            s("div", { class: "p-0" }, "#", -1)
          ])),
          s("div", X, f((x = e(l)) == null ? void 0 : x.title), 1),
          t[9] || (t[9] = s("div", { class: "flex-1" }, null, -1)),
          s("button", {
            class: "p-2",
            onClick: t[2] || (t[2] = (n) => a.$router.back())
          }, t[7] || (t[7] = [
            s("div", { class: "i-la-angle-left" }, null, -1)
          ])),
          s("button", {
            class: "p-2",
            onClick: t[3] || (t[3] = (n) => a.$emit("close"))
          }, t[8] || (t[8] = [
            s("div", { class: "i-la-times" }, null, -1)
          ]))
        ]),
        s("div", Z, [
          (k = e(l)) != null && k.cover || (v = e(l)) != null && v.youtube || (h = e(l)) != null && h.text ? (o(), i("div", ee, [
            s("img", {
              class: "sticky top-0",
              src: e(l).cover
            }, null, 8, te)
          ])) : r("", !0),
          s("div", se, [
            s("div", le, [
              s("div", oe, [
                e(l).icon ? (o(), i("img", {
                  key: 0,
                  class: "w-20 h-20 rounded-full m-2",
                  style: T([{ flex: "0 1 40px" }, { borderColor: N.value }]),
                  src: e(l).icon
                }, null, 12, ie)) : r("", !0),
                (p = e(l)) != null && p.title ? (o(), i("div", ne, f((y = e(l)) == null ? void 0 : y.title), 1)) : r("", !0),
                (g = e(l)) != null && g.link ? (o(), c(e(q), {
                  key: 2,
                  url: (b = e(l)) == null ? void 0 : b.link
                }, null, 8, ["url"])) : r("", !0),
                (w = e(l)) != null && w.statement ? (o(), i("div", re, f(($ = e(l)) == null ? void 0 : $.statement), 1)) : r("", !0)
              ]),
              t[10] || (t[10] = s("div", { class: "flex-auto" }, null, -1)),
              s("div", ae, [
                z(e(G)),
                z(e(I), { hash: d.hash }, null, 8, ["hash"]),
                s("button", {
                  class: "button flex items-center",
                  onClick: t[4] || (t[4] = (n) => e(U)())
                }, [
                  e(V) ? (o(), i("div", ue)) : (o(), i("div", de))
                ])
              ])
            ])
          ]),
          (C = e(l)) != null && C.youtube ? (o(), c(e(J), {
            key: 1,
            class: "mb-6 shadow-xl flex-1",
            video: (P = e(l)) == null ? void 0 : P.youtube
          }, null, 8, ["video"])) : r("", !0),
          (L = e(l)) != null && L.text ? (o(), i("div", {
            key: 2,
            class: "text-md markdown-body m-1 px-4 py-4 leading-relaxed",
            innerHTML: e(M).render((S = e(l)) == null ? void 0 : S.text)
          }, null, 8, ce)) : r("", !0),
          (o(), c(e(K), {
            key: d.tag,
            tag: d.hash,
            header: !1,
            onBrowse: t[5] || (t[5] = (n) => a.$emit("browse", n))
          }, null, 8, ["tag"]))
        ])
      ]);
    };
  }
};
export {
  ve as default
};
//# sourceMappingURL=PostPage-SO35p7pH.js.map
