import { defineComponent, computed, mergeProps, unref, ref, watch, withAsyncContext, provide, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderClass, ssrRenderList, ssrRenderStyle } from 'vue/server-renderer'; import { a as useConfigStore, u as useRouter$1, b as useUserStore, o as useCartStore, p as usePriceStore, _ as __nuxt_component_0$1, m as useIntersectionObserver, n as getToken, d as api$1 } from './server.mjs'; import { L as Logo } from './Logo-CS_PsVSS.mjs'; import { a as _sfc_main$5, C as CommentAddEdit, _ as _sfc_main$8, d as deletePostLike, c as createPostLike } from './moreOptionProduct-C93aAhOp.mjs'; import { P as Post, _ as _sfc_main$7 } from './PostCardSkeleton-Bf-WUNfS.mjs'; import { d as deleteSave, c as createSave } from './save-3yOnAiJS.mjs'; import { u as useProductStore } from './product-qwehvGHt.mjs'; import { u as useMediaStore } from './media-Cj7oyS0P.mjs'; import { u as useAsyncData } from './asyncData-DVPmuEBB.mjs'; import { storeToRefs } from 'pinia'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; import { _ as _sfc_main$6 } from './FullScreenStories-zaV3qMX5.mjs'; import { U as UserProfilePic } from './UserProfilePic-CSSFM-Xe.mjs'; import { u as usePrice } from './usePrice-CFcNV1RQ.mjs'; import { _ as __nuxt_component_2 } from './index-CRP3RHmx.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import 'consola'; import 'fast-xml-parser'; import 'ipx'; import '@supabase/supabase-js'; import 'axios'; import 'lodash-es'; import '@babel/runtime/helpers/esm/extends'; import '@babel/runtime/helpers/esm/objectSpread2'; import '@ant-design/colors'; import '@ctrl/tinycolor'; import 'stylis'; import 'vue-types'; import '@ant-design/icons-vue'; import 'unhead/utils'; import './index-zsqPNrGJ.mjs'; import '@vueuse/gesture'; import '@headlessui/vue'; import 'framesync'; import 'popmotion'; import 'style-value-types'; import './BasicButton-7YIRCRg8.mjs'; import './BasicIconOld-Booq7UXp.mjs'; import './index-CO_xVqO1.mjs'; import 'throttle-debounce'; import './index-DN2Eqyc3.mjs'; import 'dom-align'; import './index-CQMiaHEh.mjs'; import './shallowequal-CJsWvZb3.mjs'; import 'lodash-es/uniq.js'; import './index-D4HrLPqa.mjs'; import './FormItemContext-DTpHAXaY.mjs'; import './index-BTlbWWOl.mjs'; import 'lodash-es/isPlainObject.js'; import 'resize-observer-polyfill'; import './useDateTime-iTLoRLEX.mjs'; import 'moment'; import 'moment-timezone'; import 'moment-jalaali'; import 'date-fns'; import 'date-fns/locale'; import './empty_user-DSxcM_ac.mjs'; import './like-D4L8S2C_.mjs'; import 'vue-content-loader'; import 'swiper/vue'; import 'swiper/modules'; import './post_loading-CMOcYm9B.mjs'; import './media-CiMHc-Ka.mjs'; import 'perfect-debounce'; import './BasicInput-CgQV_gT5.mjs'; import '../_/CheckOutlined.mjs'; import './useRefs-BHKrVg4I.mjs'; const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "InstallButton", __ssrInlineRender: true, emits: ["show"], setup(__props, { emit: __emit }) { const emits = __emit; const showInstallButton = ref(false); ref(null); watch(showInstallButton, (n) => { emits("show", n); }); return (_ctx, _push, _parent, _attrs) => { const _component_ClientOnly = __nuxt_component_0$1; _push(ssrRenderComponent(_component_ClientOnly, _attrs, {}, _parent)); }; } }); const _sfc_setup$4 = _sfc_main$4.setup; _sfc_main$4.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/InstallButton.vue"); return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0; }; const __nuxt_component_0 = Object.assign(_sfc_main$4, { __name: "InstallButton" }); const _sfc_main$3 = /* @__PURE__ */ defineComponent({ __name: "Posts", __ssrInlineRender: true, props: { userPostScroll: {}, scrollSave: {} }, async setup(__props) { let __temp, __restore; const props = __props; const user = useUserStore(); const media = useMediaStore(); const percent = useProductStore(); const router = useRouter$1(); const config = useConfigStore(); ref(100); const { posts, endPage } = storeToRefs(media); ref(0); const loading = ref(false); const addLikeLoading = ref(false); const commentPostId = ref(); const commentVisible = ref(false); const optionVisible = ref(false); const optionPostId = ref(); const ownerPostId = ref(); computed(() => props.userPostScroll === "userPostScroll"); const present = computed(() => percent.percentUpload); function handleLike(isLiked, id) { try { addLikeLoading.value = true; if (getToken()) { if (isLiked) { deletePostLike(id); const index = posts.value.findIndex((x) => x.id === id); posts.value[index]?.likes.splice(posts.value[index].likes?.findIndex((y) => y.user_id === user.user.id)); } else { createPostLike(id); const index = posts.value.findIndex((x) => x.id === id); posts.value[index]?.likes.push({ product_id: id, user_id: user.user.id }); } } else { router.push({ name: "auth-login" }); api$1.warn(config.useString("pleaseLoginOrRegister")); } } catch (e) { console.log(e); } finally { addLikeLoading.value = false; } } function addCommentId(id) { posts.value[posts.value.findIndex((x) => x.id === commentPostId.value)]?.comments.push({ id }); } function deleteCommentId() { posts.value[posts.value.findIndex((x) => x.id === commentPostId.value)]?.comments.splice(0, 1); } function handleSave(isSaved, id) { if (getToken()) { if (isSaved) { deleteSave(id); const index = posts.value.findIndex((x) => x.id === id); posts.value[index]?.saved.splice(posts.value[index].saved?.findIndex((y) => y.user_id === user.user.id)); } else { createSave(id); const index = posts.value.findIndex((x) => x.id === id); posts.value[index]?.saved.push({ product_id: id, user_id: user.user.id }); } } else { router.push({ name: "auth-login" }); api$1.warn(config.useString("pleaseLoginOrRegister")); } } function openOption(id) { optionPostId.value = id; optionVisible.value = true; } function openComment(id, owner_id) { commentPostId.value = id; commentVisible.value = true; ownerPostId.value = owner_id; } provide("ownerPostId", ownerPostId); const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("posts", () => media.loadPosts(1))), __temp = await __temp, __restore(), __temp); const observer = ref(); useIntersectionObserver(observer, async (entries) => { const entry = entries[0]; if (!entry) return; if (entry.isIntersecting && !media.loading && !media.endPage) { await media.loadPosts(media.currentPage + 1); } }); computed(() => router.currentRoute.value.query.target || null); watch(present, () => { if (present.value == 100) { media.reset(); media.loadPosts(1); } }); return (_ctx, _push, _parent, _attrs) => { _push(`