import { defineComponent, ref, watch, mergeProps, withCtx, unref, createVNode, toDisplayString, resolveDirective, reactive, nextTick, useSSRContext } from 'vue'; import { ssrRenderComponent, ssrInterpolate, ssrRenderAttrs, ssrRenderAttr, ssrGetDirectiveProps, ssrRenderList } from 'vue/server-renderer'; import { B as BasicSheet } from './index-DVD7vSfp.mjs'; import { a as formatTimeShort } from './useDateTime-D8RCoGwW.mjs'; import { e as empty_user } from './empty_user-BaUNCdgf.mjs'; import { _ as _sfc_main$4 } from './like-BhIOg3YL.mjs'; import { u as useRouter$1, a as useConfigStore, b as useUserStore, t as reactiveProjectName, x as getSupabaseStorageUrl, z as useElementSize, at as baseConfirm, au as deleteProductById, e as api$1 } from './server.mjs'; import { ContentLoader } from 'vue-content-loader'; import { B as BasicIconOld } from './BasicIconOld-I4c2ShMu.mjs'; import { u as useProductStore } from './product-DaDj7A6D.mjs'; const _sfc_main$3 = /* @__PURE__ */ defineComponent({ __name: "SubCommentCard", __ssrInlineRender: true, props: { item: {}, addLikeLoading: { type: Boolean } }, emits: ["likeComment", "reply"], setup(__props, { emit: __emit }) { const user = useUserStore(); useConfigStore(); return (_ctx, _push, _parent, _attrs) => { var _a2; var _a, _b, _c, _d; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : (_a2 = _temp0.innerHTML) != null ? _a2 : ""}
${ssrInterpolate(_ctx.item.user.name)}
${ssrInterpolate(unref(formatTimeShort)(_ctx.item.created_at))}
${ssrInterpolate(_ctx.item.message)}
`); _push(ssrRenderComponent(_sfc_main$4, { "is-gray": "", "is-liked": (_c = _ctx.item.like) == null ? void 0 : _c.some((x) => { var _a22; return x.user_id === ((_a22 = unref(user).user) == null ? void 0 : _a22.id); }) }, null, _parent)); _push(`
${ssrInterpolate((_d = _ctx.item.like) == null ? void 0 : _d.length)}
`); }; } }); const _sfc_setup$3 = _sfc_main$3.setup; _sfc_main$3.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/SubCommentCard.vue"); return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0; }; const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "CommentCard", __ssrInlineRender: true, props: { item: {}, addLikeLoading: { type: Boolean } }, emits: ["likeComment", "reply"], setup(__props, { emit: __emit }) { const user = useUserStore(); const config = useConfigStore(); const emits = __emit; const showReply = ref(false); return (_ctx, _push, _parent, _attrs) => { var _a2; var _a, _b, _c, _d, _e, _f, _g; const _directive_lazy = resolveDirective("lazy"); let _temp0; _push(`
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : (_a2 = _temp0.innerHTML) != null ? _a2 : ""}
${ssrInterpolate(_ctx.item.user.name)}
${ssrInterpolate(unref(formatTimeShort)(_ctx.item.created_at))}
${ssrInterpolate(_ctx.item.message)}
${ssrInterpolate(unref(config).useString("reply"))}
`); _push(ssrRenderComponent(_sfc_main$4, { "is-gray": "", "is-liked": (_a = _ctx.item.like) == null ? void 0 : _a.some((x) => { var _a22; return x.user_id === ((_a22 = unref(user).user) == null ? void 0 : _a22.id); }) }, null, _parent)); _push(`
${ssrInterpolate((_b = _ctx.item.like) == null ? void 0 : _b.length)}
`); if (((_d = (_c = _ctx.item) == null ? void 0 : _c.replies) == null ? void 0 : _d.length) > 0) { _push(``); if (!showReply.value) { _push(`
${ssrInterpolate(unref(config).useString("viewMoreReplies", (_f = (_e = _ctx.item) == null ? void 0 : _e.replies) == null ? void 0 : _f.length))}
`); } else { _push(`
`); ssrRenderList((_g = _ctx.item) == null ? void 0 : _g.replies, (subItem) => { _push(ssrRenderComponent(_sfc_main$3, { item: subItem, onLikeComment: ($event) => { var _a22; return emits("likeComment", (_a22 = subItem.like) == null ? void 0 : _a22.some((x) => { var _a3; return x.user_id === ((_a3 = unref(user).user) == null ? void 0 : _a3.id); }), subItem.id, true, _ctx.item.id); }, addLikeLoading: _ctx.addLikeLoading }, null, _parent)); }); _push(`
`); } _push(``); } 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/home/components/CommentCard.vue"); return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0; }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "CommentCardSkeleton", __ssrInlineRender: true, setup(__props) { const isLoaded = ref(false); const skeletonRatio = ref(null); const skeletonSize = reactive( useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" }) ); return (_ctx, _push, _parent, _attrs) => { if (isLoaded.value) { _push(``); _push(ssrRenderComponent(unref(ContentLoader), { width: skeletonSize.width, height: "60" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(``); } else { return [ createVNode("circle", { cx: 15, cy: "30", r: "15" }), createVNode("rect", { x: "45", y: "15", rx: "3", ry: "3", width: "100", height: "12" }), createVNode("rect", { x: "45", y: "35", rx: "5", ry: "5", width: skeletonSize.width - 100, height: "10" }, null, 8, ["width"]) ]; } }), _: 1 }, _parent)); _push(``); } else { _push(``); } }; } }); 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/home/components/CommentCardSkeleton.vue"); return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0; }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "moreOptionProduct", __ssrInlineRender: true, props: { open: { type: Boolean }, id: {} }, emits: ["update:open"], setup(__props, { emit: __emit }) { const router = useRouter$1(); const config = useConfigStore(); const sheetRef = ref(null); const props = __props; const emits = __emit; async function openSheet() { var _a; await nextTick(); await ((_a = sheetRef.value) == null ? void 0 : _a.setOpen()); } async function closeSheet() { var _a; await nextTick(); await ((_a = sheetRef.value) == null ? void 0 : _a.setClose()); } async function confirmDeleteProduct() { await baseConfirm(config.useString("areYouSureToDeleteThisProduct"), deleteProduct); } const percent = useProductStore(); async function deleteProduct() { percent.percentUpload = 0; percent.loading = true; try { await deleteProductById(props.id); percent.percentUpload = 100; api$1.success(config.useString("deletedSuccessfully")); } catch (e) { console.log(e); api$1.error(config.useString("errorInAction")); } finally { percent.loading = false; emits("update:open", false); } } watch(props, (value) => { if (value.open) { openSheet(); } else { closeSheet(); } }); return (_ctx, _push, _parent, _attrs) => { _push(ssrRenderComponent(BasicSheet, mergeProps({ title: "", ref_key: "sheetRef", ref: sheetRef, headerCls: "", closeOnClickOutside: "", onOnClickOutside: ($event) => emits("update:open", false), onOnClose: ($event) => emits("update:open", false) }, _attrs), { header: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
`); } else { return [ createVNode("div", { flex: "", "justify-center": "", "items-center": "", "flex-col": "", "p-2": "" }, [ createVNode("div", { "bg-gray-500": "", "h-2px": "", "w-2.5rem": "" }) ]) ]; } }), default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(`
`); _push2(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:edit", color: "white" }, null, _parent2, _scopeId)); _push2(`
${ssrInterpolate(unref(config).useString("edit"))}
`); _push2(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:trash", color: "red" }, null, _parent2, _scopeId)); _push2(`
${ssrInterpolate(unref(config).useString("delete"))}
`); } else { return [ createVNode("div", { class: "h-fit px-4" }, [ createVNode("div", { class: "flex flex-col gap-2 mt-5 mb-5" }, [ createVNode("div", { class: "flex items-center gap-3 p-3 rounded-lg bg-primary", onClick: ($event) => unref(router).push({ name: "edit-product-id", params: { id: props.id } }) }, [ createVNode(BasicIconOld, { icon: "vuesax-linear:edit", color: "white" }), createVNode("div", { class: "text-sm text-white" }, toDisplayString(unref(config).useString("edit")), 1) ], 8, ["onClick"]), createVNode("div", { class: "flex items-center gap-3 p-3 rounded-lg bg-red-100", onClick: ($event) => confirmDeleteProduct() }, [ createVNode(BasicIconOld, { icon: "vuesax-linear:trash", color: "red" }), createVNode("div", { class: "text-red text-sm" }, toDisplayString(unref(config).useString("delete")), 1) ], 8, ["onClick"]) ]) ]) ]; } }), _: 1 }, _parent)); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/moreOptionProduct.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as _, _sfc_main$2 as a, _sfc_main$1 as b }; //# sourceMappingURL=moreOptionProduct-DIWh2yKL.mjs.map