import { defineComponent, ref, mergeProps, withCtx, createBlock, openBlock, Fragment, renderList, withModifiers, createVNode, unref, resolveDirective, reactive, toDisplayString, useSSRContext } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue/index.mjs';
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderList, ssrInterpolate, ssrGetDirectiveProps, ssrRenderAttr } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue/server-renderer/index.mjs';
import { u as useRouter$1, a as useConfigStore, _ as __nuxt_component_0, b as useUserStore, aS as watchDebounced, e as loading, aT as getCustomerList, q as useElementSize, s as supabase } from './server.mjs';
import { _ as _sfc_main$9, C as Collapse, a as __nuxt_component_1, g as getCategoriesTree } from './ProductSearchList-BtzyWbWx.mjs';
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
import { p as previewImg$1 } from './logo_preview-CJTcB_Eg.mjs';
import { ContentLoader } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue-content-loader/dist/vue-content-loader.cjs.js';
import { T as Tag } from './index-CAZlc_qy.mjs';
import { C as CustomerCard, a as CustomerCardSkeleton } from './CustomerCardSkeleton-Bn-AquJT.mjs';
import 'node:http';
import 'node:https';
import '../nitro/nitro.mjs';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/consola/dist/index.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/ipx/dist/index.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/pinia/dist/pinia.prod.cjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@supabase/supabase-js/dist/main/index.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/axios/index.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/lodash-es/lodash.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@babel/runtime/helpers/esm/extends.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@babel/runtime/helpers/esm/objectSpread2.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@ant-design/colors/dist/index.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@ctrl/tinycolor/dist/public_api.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/stylis/index.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue-types/dist/vue-types.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@ant-design/icons-vue/lib/index.js';
import '../routes/renderer.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue-bundle-renderer/dist/runtime.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@nuxt/nitro-server/node_modules/vue/server-renderer/index.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/unhead/dist/server.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/devalue/index.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/unhead/dist/utils.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@unhead/vue/node_modules/vue/index.mjs';
import './gray-Bd8mWW-o.mjs';
import './media-_NDkNIvH.mjs';
import './index-BWBnVq-W.mjs';
import './usePrice-_QzChhgO.mjs';
import './BasicButton-DhQvSD8U.mjs';
import './_plugin-vue_export-helper-1tPrXgE0.mjs';
import './index-BMAjr3Fm.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/throttle-debounce/esm/index.js';
import './index-D-yl9XJT.mjs';
import './shallowequal-BEyWmMEh.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/lodash-es/uniq.js';
import './index-G65aBv4F.mjs';
import './FormItemContext-BlKvWASA.mjs';
import './index-BGahPE0Z.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/lodash-es/isPlainObject.js';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/resize-observer-polyfill/dist/ResizeObserver.js';
import './index-Bn4rLj9V.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/dom-align/dist-node/index.js';
import './Checkbox-Dl5Ja72L.mjs';
import './asyncData-Iix-4nDI.mjs';
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/perfect-debounce/dist/index.mjs';
import './UserProfilePic-DaZ03Xcl.mjs';
import './empty_user-DSxcM_ac.mjs';
const getBrandsList = async (search) => {
let queryBuilder = supabase.from("brands").select("*");
if (search?.length)
queryBuilder.like("title", `%${search}%`);
return (await queryBuilder.select("*").order("created_at", { ascending: false })).data;
};
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
__name: "BrandCard",
__ssrInlineRender: true,
props: {
item: {},
hasFunction: { type: Boolean, default: true }
},
emits: ["edit", "delete"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const emit = __emit;
return (_ctx, _push, _parent, _attrs) => {
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`
![]()
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
${ssrInterpolate(__props.item.title)}
`);
if (__props.hasFunction) {
_push(`
`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:edit",
color: "blue",
onClick: ($event) => emit("edit", __props.item)
}, null, _parent));
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:trash",
color: "red",
onClick: ($event) => emit("delete", __props.item.id)
}, null, _parent));
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
const _sfc_setup$8 = _sfc_main$8.setup;
_sfc_main$8.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCard.vue");
return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
};
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
__name: "BrandCardSkeleton",
__ssrInlineRender: true,
setup(__props) {
const skeletonRatio = ref(null);
const skeletonSize = reactive(
useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
);
return (_ctx, _push, _parent, _attrs) => {
_push(``);
_push(ssrRenderComponent(unref(ContentLoader), {
width: skeletonSize.width,
height: "60"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(``);
} else {
return [
createVNode("rect", {
height: "50",
rx: "3",
ry: "3",
width: skeletonSize.width,
x: "0",
y: "8"
}, null, 8, ["width"])
];
}
}),
_: 1
}, _parent));
_push(`
`);
};
}
});
const _sfc_setup$7 = _sfc_main$7.setup;
_sfc_main$7.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCardSkeleton.vue");
return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
__name: "BrandSearchList",
__ssrInlineRender: true,
props: {
search: {}
},
emits: ["selected"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const records = ref([]);
async function reload() {
loading.value = true;
records.value = await getBrandsList(props.search);
loading.value = false;
}
watchDebounced(() => props.search, () => {
reload();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
_push(``);
ssrRenderList(records.value, (item, key) => {
_push(ssrRenderComponent(_sfc_main$8, {
key,
item,
"has-function": false,
onClick: ($event) => emits("selected", item.id)
}, null, _parent));
});
_push(``);
if (unref(loading)) {
_push(`
`);
ssrRenderList(10, (i) => {
_push(ssrRenderComponent(_sfc_main$7, null, null, _parent));
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
const _sfc_setup$6 = _sfc_main$6.setup;
_sfc_main$6.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/BrandSearchList.vue");
return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
};
const previewImg = "" + __buildAssetsURL("logo_preview.B3D6jfxw.png");
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
__name: "CategoryCard",
__ssrInlineRender: true,
props: {
item: {},
hasFunction: { type: Boolean, default: true },
showChildren: { type: Boolean, default: false }
},
emits: ["edit", "delete"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const emit = __emit;
return (_ctx, _push, _parent, _attrs) => {
const _component_a_tag = Tag;
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`![]()
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
${ssrInterpolate(__props.item.title)}
`);
if (__props.item.children?.length !== 0 && __props.showChildren) {
_push(``);
ssrRenderList(__props.item.children, (val) => {
_push(ssrRenderComponent(_component_a_tag, { color: "blue" }, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`
${ssrInterpolate(val.title)}`);
} else {
return [
createVNode("span", null, toDisplayString(val.title), 1)
];
}
}),
_: 2
}, _parent));
});
_push(``);
} else {
_push(``);
}
_push(`
`);
if (__props.hasFunction) {
_push(`
`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:edit",
color: "blue",
onClick: ($event) => emit("edit", __props.item)
}, null, _parent));
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:trash",
color: "red",
onClick: ($event) => emit("delete", __props.item.id)
}, null, _parent));
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
const _sfc_setup$5 = _sfc_main$5.setup;
_sfc_main$5.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CategoryCard.vue");
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
};
const CategoryCard = Object.assign(_sfc_main$5, { __name: "CardsCategoryCard" });
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "CategoryCardSkeleton",
__ssrInlineRender: true,
setup(__props) {
const skeletonRatio = ref(null);
const skeletonSize = reactive(
useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
);
return (_ctx, _push, _parent, _attrs) => {
_push(``);
_push(ssrRenderComponent(unref(ContentLoader), {
width: skeletonSize.width,
height: "60"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(``);
} else {
return [
createVNode("rect", {
height: "50",
rx: "3",
ry: "3",
width: skeletonSize.width,
x: "0",
y: "8"
}, null, 8, ["width"])
];
}
}),
_: 1
}, _parent));
_push(`
`);
};
}
});
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/Cards/CategoryCardSkeleton.vue");
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const CategoryCardSkeleton = Object.assign(_sfc_main$4, { __name: "CardsCategoryCardSkeleton" });
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "CategorySearchList",
__ssrInlineRender: true,
props: {
search: {}
},
emits: ["selected"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const props = __props;
const emits = __emit;
const records = ref([]);
const activeKey = ref();
async function reload() {
loading.value = true;
records.value = await getCategoriesTree(props.search);
loading.value = false;
}
watchDebounced(() => props.search, () => {
reload();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
const _component_a_collapse = Collapse;
const _component_a_collapse_panel = __nuxt_component_1;
_push(``);
_push(ssrRenderComponent(_component_a_collapse, {
activeKey: activeKey.value,
"onUpdate:activeKey": ($event) => activeKey.value = $event,
bordered: false,
"expand-icon-position": "end",
class: "cat_collapse",
collapsible: "icon",
accordion: ""
}, {
expandIcon: withCtx(({ isActive }, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`
`);
if (unref(config).isRTL) {
_push2(ssrRenderComponent(BasicIconOld, {
class: "transition-all w-5",
icon: "vuesax-linear:arrow-right-1",
rotate: isActive ? 90 : 0
}, null, _parent2, _scopeId));
} else {
_push2(ssrRenderComponent(BasicIconOld, {
class: "transition-all w-5",
icon: "vuesax-linear:arrow-left-1",
rotate: isActive ? -90 : 0
}, null, _parent2, _scopeId));
}
_push2(`
`);
} else {
return [
createVNode("div", { class: "w-20 flex justify-center" }, [
unref(config).isRTL ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
class: "transition-all w-5",
icon: "vuesax-linear:arrow-right-1",
rotate: isActive ? 90 : 0
}, null, 8, ["rotate"])) : (openBlock(), createBlock(BasicIconOld, {
key: 1,
class: "transition-all w-5",
icon: "vuesax-linear:arrow-left-1",
rotate: isActive ? -90 : 0
}, null, 8, ["rotate"]))
])
];
}
}),
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(``);
ssrRenderList(records.value, (item, key) => {
_push2(ssrRenderComponent(_component_a_collapse_panel, {
key: item.id,
"show-arrow": item?.children.length != 0
}, {
header: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`
`);
_push3(ssrRenderComponent(CategoryCard, {
key,
item,
hasFunction: false
}, null, _parent3, _scopeId2));
_push3(`
`);
} else {
return [
createVNode("div", {
onClick: withModifiers(($event) => emits("selected", item.id), ["stop"])
}, [
(openBlock(), createBlock(CategoryCard, {
key,
item,
hasFunction: false
}, null, 8, ["item"]))
], 8, ["onClick"])
];
}
}),
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(``);
ssrRenderList(item.children, (child, key2) => {
_push3(`
`);
_push3(ssrRenderComponent(CategoryCard, {
key: key2,
item: child,
hasFunction: false
}, null, _parent3, _scopeId2));
_push3(`
`);
});
_push3(``);
} else {
return [
(openBlock(true), createBlock(Fragment, null, renderList(item.children, (child, key2) => {
return openBlock(), createBlock("div", {
class: "mx-3",
onClick: withModifiers(($event) => emits("selected", child.id), ["stop"])
}, [
(openBlock(), createBlock(CategoryCard, {
key: key2,
item: child,
hasFunction: false
}, null, 8, ["item"]))
], 8, ["onClick"]);
}), 256))
];
}
}),
_: 2
}, _parent2, _scopeId));
});
_push2(``);
} else {
return [
(openBlock(true), createBlock(Fragment, null, renderList(records.value, (item, key) => {
return openBlock(), createBlock(_component_a_collapse_panel, {
key: item.id,
"show-arrow": item?.children.length != 0
}, {
header: withCtx(() => [
createVNode("div", {
onClick: withModifiers(($event) => emits("selected", item.id), ["stop"])
}, [
(openBlock(), createBlock(CategoryCard, {
key,
item,
hasFunction: false
}, null, 8, ["item"]))
], 8, ["onClick"])
]),
default: withCtx(() => [
(openBlock(true), createBlock(Fragment, null, renderList(item.children, (child, key2) => {
return openBlock(), createBlock("div", {
class: "mx-3",
onClick: withModifiers(($event) => emits("selected", child.id), ["stop"])
}, [
(openBlock(), createBlock(CategoryCard, {
key: key2,
item: child,
hasFunction: false
}, null, 8, ["item"]))
], 8, ["onClick"]);
}), 256))
]),
_: 2
}, 1032, ["show-arrow"]);
}), 128))
];
}
}),
_: 1
}, _parent));
_push(`
`);
if (unref(loading)) {
_push(`
`);
ssrRenderList(10, (i) => {
_push(ssrRenderComponent(CategoryCardSkeleton, null, null, _parent));
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
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/search/mainSearch/components/CategorySearchList.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "CustomerSearchList",
__ssrInlineRender: true,
props: {
search: {}
},
setup(__props) {
const router = useRouter$1();
const props = __props;
const userStore = useUserStore();
const loading2 = ref(false);
const endPage = ref(false);
const currentPage = ref(0);
const limit = ref(10);
const users = ref([]);
const request = async () => {
try {
if (!endPage.value) {
loading2.value = true;
const userId = router.currentRoute.value.query?.user_id ?? userStore.user.id;
const res = await getCustomerList(userId, ++currentPage.value, limit.value, props.search);
if (res?.length <= limit.value) endPage.value = true;
users.value.push(...res);
}
} catch (e) {
console.log("e ===>", e);
} finally {
loading2.value = false;
}
};
const reset = () => {
endPage.value = false;
users.value = [];
currentPage.value = 0;
};
watchDebounced(() => props.search, () => {
reset();
request();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
_push(``);
if (!loading2.value) {
_push(``);
ssrRenderList(users.value, (user) => {
_push(ssrRenderComponent(CustomerCard, { user }, null, _parent));
});
_push(``);
} else {
_push(``);
ssrRenderList(8, (i) => {
_push(ssrRenderComponent(CustomerCardSkeleton, null, null, _parent));
});
_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/search/mainSearch/components/CustomerSearchList.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
useConfigStore();
const activeKey = ref("products");
const searchValue = ref("");
function SelectCategory(id) {
router.replace({
name: "search-main",
query: { category: id }
// Directly use the value instead of an array
});
setTimeout(() => {
activeKey.value = "products";
}, 50);
}
function selectBrand(id) {
router.replace({
name: "search-main",
query: { brand: id }
// Directly use the value instead of an array
});
setTimeout(() => {
activeKey.value = "products";
}, 50);
}
return (_ctx, _push, _parent, _attrs) => {
const _component_ClientOnly = __nuxt_component_0;
_push(``);
_push(ssrRenderComponent(_component_ClientOnly, null, {}, _parent));
_push(`
`);
if (activeKey.value === "products") {
_push(ssrRenderComponent(_sfc_main$9, { search: searchValue.value }, null, _parent));
} else {
_push(``);
}
if (activeKey.value === "customers") {
_push(ssrRenderComponent(_sfc_main$2, { search: searchValue.value }, null, _parent));
} else {
_push(``);
}
if (activeKey.value === "categories") {
_push(ssrRenderComponent(_sfc_main$3, {
search: searchValue.value,
onSelected: SelectCategory
}, null, _parent));
} else {
_push(``);
}
if (activeKey.value === "brands") {
_push(ssrRenderComponent(_sfc_main$6, {
search: searchValue.value,
onSelected: selectBrand
}, null, _parent));
} else {
_push(``);
}
_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/search/mainSearch/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/search/main/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };