import{p as u,t as g,r as i,j as e}from"./vendor-react-C630P38J.js";import{q as h}from"./vendor-fxts-IS4CCBC4.js";import{E as p}from"./vendor-runtime-BrGgGswE.js";import{u as y,aR as E,t as x,L as C,N,b as k}from"./feature-order-C2we0F5o.js";import{C as j}from"./index-DrhpmguR.js";import{g as f}from"./index-nim7WYfB.js";import"./vendor-utils-Cb1MAKRV.js";import{c as b,t as P,d as v}from"./shared.css-DH9SezeH.js";import{e as S}from"./index-BNckj-u7.js";import"./vendor-swiper-CwUwDtZu.js";const w=()=>u({selectedCategoryNo:g.withDefault(0)},{shallow:!1,history:"replace"}),L=()=>{const{isMobile:c}=y(),l=f(),[{selectedCategoryNo:o},r]=w(),n={pageNumber:1,pageSize:50,categoryNos:[o||Number(l)||0]},{data:s,isLoading:d}=E({searchParams:n}),a=i.useMemo(()=>{var t;return((t=s==null?void 0:s.items)==null?void 0:t.map(x))??[]},[s==null?void 0:s.items]),m=i.useCallback(t=>{r({selectedCategoryNo:t??0})},[r]);return e.jsxs("div",{className:b,children:[e.jsx("h1",{className:P,children:"BEST"}),e.jsx(p,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(j,{selectedCategoryNo:o,onClickCategory:m})}),e.jsx(C,{isLoading:d,loadingStyle:{height:"50vh"},children:h(a)?e.jsx(N,{text:"상품 목록이 없습니다.",style:{height:"50vh"}}):e.jsx("div",{className:v,children:e.jsx(S,{isMobile:c,products:a,showRank:!0})})})]})},I=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"})),_=()=>u({selectedCategoryNo:g.withDefault(0)},{shallow:!1,history:"replace"}),M=()=>{const c=f(),{isMobile:l}=y(),[{selectedCategoryNo:o},r]=_(),n={categoryNos:[o||Number(c)||0],pageSize:50,pageNumber:1,order:{by:"RECENT_PRODUCT",direction:"DESC"},filter:{soldout:!0}},{data:s,isLoading:d}=k({searchParams:n}),a=i.useMemo(()=>{var t;return((t=s==null?void 0:s.items)==null?void 0:t.map(x))??[]},[s==null?void 0:s.items]),m=i.useCallback(t=>{r({selectedCategoryNo:t??0})},[r]);return e.jsxs("div",{className:b,children:[e.jsx("h1",{className:P,children:"NEW"}),e.jsx(p,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(j,{selectedCategoryNo:o,onClickCategory:m})}),e.jsx(C,{isLoading:d,loadingStyle:{height:"50vh"},children:h(a)?e.jsx(N,{text:"상품 목록이 없습니다.",style:{height:"50vh"}}):e.jsx("div",{className:v,children:e.jsx(S,{isMobile:l,products:a})})})]})},Q=Object.freeze(Object.defineProperty({__proto__:null,default:M},Symbol.toStringTag,{value:"Module"}));export{Q as a,I as i};