import { defineComponent, ref, computed, withAsyncContext, watch, resolveDirective, unref, withCtx, createVNode, createBlock, openBlock, toDisplayString, createTextVNode, mergeProps, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrRenderList, ssrGetDirectiveProps, ssrRenderStyle } from 'vue/server-renderer'; import { _ as _imports_0, a as _imports_1 } from './cart-DMkYna66.mjs'; import { _ as __nuxt_component_1, a as _sfc_main$6, b as _imports_2, c as _imports_3, d as _sfc_main$5, H as Highlights } from './Highlights-BBCbV9vc.mjs'; import { u as useRouter$1, a as useConfigStore, b as useUserStore, p as useCartStore, n as useIntersectionObserver, q as APP_TYPE, t as reactiveProjectName, o as getToken, C as getSupabaseStorageUrl, e as appName } from './server.mjs'; import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs'; import numbro from 'numbro'; import { B as BasicButton } from './BasicButton-DjnsWEoH.mjs'; import { U as UserProfilePic } from './UserProfilePic-DmMhGlDO.mjs'; import { l as loadGray, S as SquarePostSkeleton } from './gray-aGBk9il7.mjs'; import { _ as _sfc_main$3 } from './FullScreenStories-PlbP0ebP.mjs'; import { u as useMediaStore } from './media-g_JiA7fA.mjs'; import { u as useUserPostStore } from './userPostsStore-6qqHC3AK.mjs'; import { u as useAsyncData } from './asyncData-DGiCewbG.mjs'; import { B as Badge } from './index-DPz-pTqF.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; import '@babel/runtime/helpers/esm/objectSpread2'; import '@babel/runtime/helpers/esm/extends'; import './index-TzujBed1.mjs'; import './raf-ruCY1ktO.mjs'; import 'dom-align'; import './media-B5mop_Ew.mjs'; import 'swiper/vue'; import './empty_user-BaUNCdgf.mjs'; import './post_loading-BiySI7bp.mjs'; import './index-CX0dq7oe.mjs'; import '@vueuse/gesture'; import '@headlessui/vue'; import '../_/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:url'; import 'consola'; import 'ipx'; import 'node:path'; import 'node:crypto'; import 'framesync'; import 'popmotion'; import 'style-value-types'; import 'lodash-es'; import 'pinia'; import '@supabase/supabase-js'; import '@ant-design/colors'; import '@ctrl/tinycolor'; import 'stylis'; import 'vue-types'; import 'axios'; import '@ant-design/icons-vue'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import './index-C7TNxeFB.mjs'; import 'throttle-debounce'; import 'vue-content-loader'; import './BasicInput-Blh68VTZ.mjs'; import './usePrice-B-5-jXKQ.mjs'; import './index-Dd0_mp7p.mjs'; import './FormItemContext-CR0UDjwx.mjs'; import './statusUtils-TdjbCkOy.mjs'; import './BaseInput-8pfzphkE.mjs'; import 'resize-observer-polyfill'; import './index-PQFDA1Lj.mjs'; import '../_/SearchOutlined.mjs'; import 'lodash-es/isPlainObject.js'; import './like-BhIOg3YL.mjs'; import 'swiper/modules'; const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "Seller", __ssrInlineRender: true, async setup(__props) { let __temp, __restore; const router = useRouter$1(); const selectedStoryId = ref(null); const visibleAdd = ref(false); const config = useConfigStore(); const user = useUserStore(); const mediaStore = useMediaStore(); const cartStore = useCartStore(); const userPost = useUserPostStore(); const seller = computed(() => config.sellerConfig?.store); const userStory = computed(() => { return mediaStore.users.find((x) => x.id === seller.value?.id); }); const formatNumber = (num) => { if (num < 9999) return num; return numbro(num).format({ average: true, // Converts 11230 -> 11.2K, 1000000 -> 1M mantissa: 1 // Number of decimal places }); }; const videoThumbnails = ref({}); async function shareProfile() { if ((void 0).share) { try { await (void 0).share({ title: `${config.lang === "fa" ? `${appName.fa}` : `${appName.en}`}`, text: `${seller.value?.bio}`, url: `${(void 0).location.origin}/user` }); } catch (error) { console.error("Sharing failed", error); } } else { alert("Web Share API not supported in this browser."); } } const observer = ref(); useIntersectionObserver(observer, async ([{ isIntersecting }]) => { if (isIntersecting && !userPost.loading && !userPost.endPage) { setTimeout(async () => { const nextPage = userPost.currentPage + 1; const data2 = await userPost.loadPosts(seller.value?.user_id, nextPage); userPost.loadStateNextPage(data2); }, 100); } }); const { data } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData("productMainSeller", async () => { userPost.reset(); return await userPost.loadPosts(seller.value?.user_id, 1); })), __temp = await __temp, __restore(), __temp); watch(data, () => { if (data) { userPost.loadStateNextPage(data.value); } }); return (_ctx, _push, _parent, _attrs) => { const _component_a_badge = Badge; const _component_a_popover = __nuxt_component_1; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${ssrInterpolate(seller.value?.username)}
`); if (!unref(config).isSeller && unref(APP_TYPE) === "single" || unref(APP_TYPE) === "multi") { _push(ssrRenderComponent(_component_a_badge, { count: unref(cartStore).count, dir: "ltr", class: "mt1" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
`); if (unref(config).isNightStore) { _push2(``); } else { _push2(``); } _push2(`
`); } else { return [ createVNode("div", { onClick: ($event) => unref(router).push({ name: "cart" }) }, [ unref(config).isNightStore ? (openBlock(), createBlock("img", { key: 0, src: _imports_0, class: "w-1.8rem -mt1", alt: "" })) : (openBlock(), createBlock("img", { key: 1, src: _imports_1, alt: unref(reactiveProjectName), class: "w-1.8rem -mt1" }, null, 8, ["alt"])) ], 8, ["onClick"]) ]; } }), _: 1 }, _parent)); } else { _push(``); } if (unref(getToken)() && unref(config).isSeller) { _push(ssrRenderComponent(_component_a_popover, { open: visibleAdd.value, "onUpdate:open": ($event) => visibleAdd.value = $event, trigger: "click" }, { content: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
${ssrInterpolate(unref(config).useString("product"))}
${ssrInterpolate(unref(config).useString("story"))}
`); } else { return [ createVNode("div", null, [ createVNode("div", { class: "flex items-center gap-2", onClick: ($event) => unref(router).push({ name: "add-product" }) }, [ createVNode("img", { src: _imports_2, class: "w-1rem", alt: unref(reactiveProjectName) }, null, 8, ["alt"]), createVNode("div", null, toDisplayString(unref(config).useString("product")), 1) ], 8, ["onClick"]), createVNode("div", { class: "flex items-center gap-2 mt-2", onClick: ($event) => unref(router).push({ name: "add-story" }) }, [ createVNode("img", { src: _imports_3, class: "w-1rem", alt: unref(reactiveProjectName) }, null, 8, ["alt"]), createVNode("div", null, toDisplayString(unref(config).useString("story")), 1) ], 8, ["onClick"]) ]) ]; } }), default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(ssrRenderComponent(_sfc_main$6, { class: "w-1.4rem" }, null, _parent2, _scopeId)); } else { return [ createVNode(_sfc_main$6, { class: "w-1.4rem" }) ]; } }), _: 1 }, _parent)); } else { _push(``); } if (unref(getToken)() && !unref(config).isSeller) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:profile-circle" }, null, _parent)); _push(`
`); } else { _push(``); } if (!unref(getToken)()) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:login" }, null, _parent)); _push(`
`); } else { _push(``); } _push(ssrRenderComponent(_sfc_main$5, { class: "w-1.3rem", onClick: ($event) => unref(router).push({ name: "user-setting" }) }, null, _parent)); _push(`
`); _push(ssrRenderComponent(UserProfilePic, { src: seller.value?.avatar, onClick: ($event) => userStory.value?.stories?.length === 0 || !userStory.value?.stories ? "" : selectedStoryId.value = seller.value?.id, "just-show-profile": userStory.value?.stories?.length === 0 || !userStory.value?.stories, seenStory: !userStory.value?.stories?.length || userStory.value?.stories?.every((item) => item.storyviews.find((_item) => _item.user_id === unref(user).user?.id || _item.user_id === "me")), showAdd: unref(config).isSeller }, null, _parent)); _push(`
${ssrInterpolate(formatNumber(seller.value?.stats?.total_product ?? 0))}
${ssrInterpolate(unref(config).useString("products"))}
`); if (unref(config).isSeller) { _push(`
${ssrInterpolate(formatNumber(seller.value?.stats?.total_customer ?? 0))}
${ssrInterpolate(unref(config).useString("customers"))}
`); } else { _push(``); } _push(`
${ssrInterpolate(formatNumber(unref(config).isSeller ? seller.value?.stats?.sell_total_order_count ?? 0 : unref(user)?.user?.stats?.buy_total_order_count ?? 0))}
${ssrInterpolate(unref(config).isSeller ? unref(config).useString("orders") : unref(config).useString("yourOrders"))}
${ssrInterpolate(seller.value?.bio)}
`); if (seller.value?.website) { _push(`
`); _push(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:link-1", class: "text-primary", size: "20" }, null, _parent)); _push(` ${ssrInterpolate(seller.value?.website)}
`); } else { _push(``); } if (unref(getToken)()) { _push(`
`); _push(ssrRenderComponent(BasicButton, { size: "small", block: "", class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"], onClick: ($event) => unref(router).push({ name: "user-edit" }) }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(unref(config).useString("editProfile"))}`); } else { return [ createTextVNode(toDisplayString(unref(config).useString("editProfile")), 1) ]; } }), _: 1 }, _parent)); _push(ssrRenderComponent(BasicButton, { size: "small", block: "", class: ["!h-unset !rounded-lg", unref(config).isNightStore ? "border-white text-white bg-black" : "border-black text-black"], onClick: ($event) => shareProfile() }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`${ssrInterpolate(unref(config).useString("shareStore"))}`); } else { return [ createTextVNode(toDisplayString(unref(config).useString("shareStore")), 1) ]; } }), _: 1 }, _parent)); _push(`
`); } else { _push(``); } _push(`
`); _push(ssrRenderComponent(Highlights, { "current-user": seller.value }, null, _parent)); _push(`
`); ssrRenderList(unref(userPost).posts, (post, i) => { _push(`
`); if (post.files?.length) { _push(``); if (post.files[0]?.type === "image") { _push(`${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}`); } else if (post.files[0]?.type === "video") { _push(`
`); } else { _push(``); } _push(``); } else { _push(``); } _push(`
`); }); _push(`
load
`); if (unref(userPost).loading) { _push(ssrRenderComponent(SquarePostSkeleton, null, null, _parent)); } else { _push(``); } _push(`
`); if (selectedStoryId.value) { _push(ssrRenderComponent(_sfc_main$3, { id: selectedStoryId.value, "onUpdate:id": ($event) => selectedStoryId.value = $event, specifyId: "" }, null, _parent)); } else { _push(``); } _push(``); }; } }); const _sfc_setup$2 = _sfc_main$2.setup; _sfc_main$2.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/components/Seller.vue"); return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0; }; const Seller = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f5add76d"]]); const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(Seller, _attrs, null, _parent)); }; } }); const _sfc_setup$1 = _sfc_main$1.setup; _sfc_main$1.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/index.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent)); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/user/index.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=index-2k941qg7.mjs.map