import{a as u,j as e,c as o,a8 as y,T as l,L as v,U as f,az as k,aB as T,aC as g,aD as h,aE as F,b,aF as A,V as L,w as N,k as _,aL as D,aI as B,$ as E,ac as M,W as Y,X as G,Z as O,G as p}from"../index.Crez7j-Y.bundle.js";import{u as z}from"./useFetchFaqList.BTWKzy9v.bundle.js";import{u as H}from"./useFetchNoticeList.g3uFeF0L.bundle.js";import{E as m}from"./EmptyContent.BRQ9JwMr.bundle.js";import"./BoardAPIs.CPUVoL2H.bundle.js";function Q({keyword:r,faqSearchResult:t,isPending:n}){var x;const s=(x=t==null?void 0:t.totalCount)!=null?x:0,a=t==null?void 0:t.items,{isDesktop:i,isMobile:d}=u();return e.jsxs(e.Fragment,{children:[e.jsxs(o,{display:"flex",justifyContent:"space-between",alignItems:"baseline",borderBottom:"2px solid ".concat(y),py:1,children:[e.jsxs(o,{display:"flex",alignItems:"baseline",children:[e.jsx(l,{variant:"title",mr:1,children:"FAQ"}),e.jsx(l,{variant:"subtitle1",children:"총 ".concat(s,"건")})]}),e.jsx(v,{variant:"subtitle1",href:"".concat(f.FAQ,"?keyword=").concat(r),underline:"none",children:"더보기"})]}),i&&e.jsx(Z,{faqList:a,totalItemCount:s,isPending:n}),d&&e.jsx(V,{faqList:a,totalItemCount:s,isPending:n})]})}function Z(r){const{faqList:t,totalItemCount:n,isPending:s}=r;return e.jsx(e.Fragment,{children:t&&n===0?e.jsx(o,{height:"20vh",children:e.jsx(m,{height:"100%",text:"해당 검색어에 일치하는 FAQ가 없습니다."})}):e.jsx(o,{minHeight:"20vh",children:e.jsxs(k,{sx:{"& th, & td":{px:{mobile:0},py:{mobile:1}}},children:[e.jsx(T,{children:e.jsxs(g,{children:[e.jsx(h,{width:35,align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"번호"})}),e.jsx(h,{width:50,align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"분류"})}),e.jsx(h,{width:415,align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"내용"})})]})}),e.jsxs(F,{children:[s&&Array.from({length:5}).map((a,i)=>e.jsx(g,{children:Array.from({length:3}).map((d,x)=>e.jsx(h,{children:e.jsx(b,{variant:"rectangular"})},x))},i)),t==null?void 0:t.map((a,i)=>e.jsx(A,{index:i+1,faq:a},a.articleNo))]})]})})})}function V(r){const{faqList:t,totalItemCount:n,isPending:s}=r;return e.jsx(o,{children:t&&n===0?e.jsx(o,{height:"20vh",children:e.jsx(m,{height:"100%",text:"해당 검색어에 일치하는 공지사항이 없습니다."})}):e.jsxs(L,{disablePadding:!0,children:[s&&e.jsx(e.Fragment,{children:Array.from({length:3}).map((a,i)=>e.jsx(N,{sx:{px:0,py:2,borderBottom:"1px solid ".concat(_)},children:e.jsx(b,{variant:"rounded",height:100,width:"100%"})},i))}),t==null?void 0:t.map((a,i)=>e.jsx(A,{index:i+1,faq:a},a.articleNo))]})})}function X({keyword:r,noticeSearchResult:t,isPending:n}){var c;const s=(c=t==null?void 0:t.totalCount)!=null?c:0,a=t==null?void 0:t.items,i=D().subtract(365,"day"),{isDesktop:d,isMobile:x}=u();return e.jsxs(e.Fragment,{children:[e.jsxs(o,{display:"flex",justifyContent:"space-between",alignItems:"baseline",borderBottom:"2px solid ".concat(y),py:1,children:[e.jsxs(o,{display:"flex",alignItems:"baseline",children:[e.jsx(l,{variant:"title",mr:1,children:"게시글"}),e.jsx(l,{variant:"subtitle1",children:"총 ".concat(s," 건")})]}),e.jsx(v,{variant:"subtitle1",href:"".concat(f.NOTICE_LIST,"?keyword=").concat(r,"&searchType=ALL&startYmd=").concat(i.format("YYYY-MM-DD")),underline:"none",children:"더보기"})]}),d&&e.jsx(J,{noticeList:a,isPending:n,totalItemCount:s}),x&&e.jsx(K,{noticeList:a,isPending:n,totalItemCount:s})]})}function J({noticeList:r,totalItemCount:t,isPending:n}){return e.jsx(e.Fragment,{children:e.jsx(o,{minHeight:"20vh",children:r&&t===0?e.jsx(o,{height:"20vh",children:e.jsx(m,{height:"100%",text:"해당 검색어에 일치하는 공지사항이 없습니다."})}):e.jsxs(k,{sx:{"& th, & td":{px:{mobile:0},py:{mobile:1}}},children:[e.jsx(T,{children:e.jsxs(g,{children:[e.jsx(h,{width:"120",align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"번호"})}),e.jsx(h,{width:"680",align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"제목"})}),e.jsx(h,{width:"120",align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"조회수"})}),e.jsx(h,{width:"140",align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"작성자"})}),e.jsx(h,{width:"140",align:"center",children:e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"작성일"})})]})}),e.jsxs(F,{children:[n&&e.jsx(e.Fragment,{children:Array.from({length:5}).map((s,a)=>e.jsx(g,{children:Array.from({length:5}).map((i,d)=>e.jsx(h,{children:e.jsx(b,{variant:"rectangular"})},d))},a))}),r==null?void 0:r.map((s,a)=>e.jsx(B,{noticeNo:a+1,notice:s},s.articleNo))]})]})})})}function K(r){const{isPending:t,noticeList:n,totalItemCount:s}=r;return e.jsx(o,{children:n&&s===0?e.jsx(o,{height:"20vh",children:e.jsx(m,{height:"100%",text:"해당 검색어에 일치하는 공지사항이 없습니다."})}):e.jsxs(L,{disablePadding:!0,children:[t&&e.jsx(e.Fragment,{children:Array.from({length:3}).map((a,i)=>e.jsx(N,{sx:{px:0,py:2,borderBottom:"1px solid ".concat(_)},children:e.jsx(b,{variant:"rounded",height:100,width:"100%"})},i))}),n==null?void 0:n.map((a,i)=>e.jsx(B,{noticeNo:i+1,notice:a},a.articleNo))]})})}function S({keyword:r,productSearchResult:t}){var i;const n=(i=t==null?void 0:t.totalCount)!=null?i:0,s=t==null?void 0:t.items,{isDesktop:a}=u();return e.jsxs(o,{children:[e.jsxs(o,{display:"flex",justifyContent:"space-between",alignItems:"baseline",borderBottom:"2px solid ".concat(y),py:1,children:[e.jsxs(o,{display:"flex",alignItems:"baseline",children:[e.jsx(l,{variant:"title",mr:1,children:"제품"}),e.jsx(l,{variant:"subtitle1",children:"총 ".concat(n,"건")})]}),e.jsx(v,{variant:"subtitle1",href:"".concat(f.PRODUCT_LIST,"?filter.keywords=").concat(r),underline:"none",children:"더보기"})]}),n===0&&e.jsx(o,{height:"20vh",children:e.jsx(m,{height:"100%",text:"해당 검색어에 일치하는 상품이 없습니다."})}),s&&s.length>0&&e.jsx(o,{mt:5,gap:3,gridTemplateColumns:"repeat(".concat(a?4:2,", minmax(0, 1fr))"),display:"grid",width:"100%",minHeight:"20vh",children:s.map(d=>e.jsx(E,{product:d},d.productNo))})]})}function q({keyword:r,totalItemCount:t}){const{isMobile:n}=u();return e.jsxs(e.Fragment,{children:[e.jsxs(o,{display:"flex",gap:1,alignItems:"baseline",children:[e.jsx(l,{variant:"title",children:"("}),e.jsx(l,{variant:"title",color:M,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:n?200:"100%"},children:"".concat(r," ")}),e.jsx(l,{variant:"title",children:")"}),e.jsx(l,{variant:"title",children:"검색결과"}),!n&&e.jsx(l,{variant:"subtitle1",children:"총 ".concat(t,"건")})]}),n&&e.jsx(l,{variant:"subtitle1",children:"총 ".concat(t,"건")})]})}const R=4,$=5;function ae(){var w,C,P,I;const[r]=Y(),t=(w=r.get("keyword"))!=null?w:"",n=new URLSearchParams;n.append("filter.keywords",t),n.append("filter.totalReviewCount","true"),n.append("pageNumber","1"),n.append("pageSize","".concat(R));const{data:s,isPending:a}=G(n),i=new URLSearchParams;i.append("searchType","ALL"),i.append("hasTotalCount","true"),i.append("keyword",t),i.append("pageNumber","1"),i.append("pageSize","".concat($));const{data:d,isPending:x}=H(i),c=new URLSearchParams;c.append("searchType","ALL"),i.append("hasTotalCount","true"),c.append("keyword",t),c.append("pageNumber","1"),c.append("pageSize","".concat($));const{data:j,isPending:U}=z(c),W=((C=s==null?void 0:s.totalCount)!=null?C:0)+((P=d==null?void 0:d.totalCount)!=null?P:0)+((I=j==null?void 0:j.totalCount)!=null?I:0);return e.jsxs(O,{gap:3,pt:{desktop:10,mobile:3},children:[e.jsx(p,{item:!0,desktop:12,mobile:11,mx:"auto",component:"summary",children:e.jsx(q,{keyword:t,totalItemCount:W})}),e.jsx(p,{item:!0,desktop:12,mobile:11,mx:"auto",component:"article",children:e.jsx(S,{keyword:t,productSearchResult:s,isPending:a})}),e.jsx(p,{item:!0,desktop:12,mobile:11,mx:"auto",component:"article",children:e.jsx(X,{keyword:t,noticeSearchResult:d,isPending:x})}),e.jsx(p,{item:!0,desktop:12,mobile:11,mx:"auto",component:"article",children:e.jsx(Q,{keyword:t,faqSearchResult:j,isPending:U})})]})}export{ae as default};