import{r as g,j as y}from"./vendor-react-C630P38J.js";import{at as i,aa as B,H as q,I as E,c as N,j as c,am as d,b9 as T,ba as I}from"./feature-order-C2we0F5o.js";import"./vendor-utils-Cb1MAKRV.js";import{u as K}from"./vendor-i18n-D_F5k183.js";import{q as l,f as O,d as j,k as D,a as F}from"./vendor-query-BjC2S-sR.js";const u={getProductSections:t=>i({method:"GET",url:"/display/sections",...t}),getProductSection:(t,e)=>i({method:"GET",url:`display/sections/${t}`,headers:{version:"2.0"},...e}),getProductSectionById:(t,e)=>i({method:"GET",url:`/display/sections/ids/${t}`,headers:{version:"2.0"},...e}),getProductSectionProductsByNo:(t,e,o)=>i({method:"GET",url:`/display/sections/${t}/products`,params:e,...o}),getProductSectionProductsById:(t,e,o)=>i({method:"GET",url:`/display/sections/ids/${t}/products`,params:e,...o})};var G="_67w66d0";const Q=t=>g.createElement("svg",{viewBox:"-2 -2 32 27",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"var(--like-icon-width, 24px)",height:"var(--like-icon-height, 20px)",filter:"var(--like-icon-filter, none)",overflow:"visible"},...t},g.createElement("path",{d:"M25.5716 1.94765C22.2416 -1.26235 17.0916 -0.162345 14.0016 2.76765C10.9116 -0.162345 5.76155 -1.23235 2.43155 1.94765C1.66351 2.6747 1.05177 3.55071 0.633696 4.52215C0.215623 5.49359 0 6.54007 0 7.59765C0 8.65524 0.215623 9.70172 0.633696 10.6732C1.05177 11.6446 1.66351 12.5206 2.43155 13.2477L13.3516 22.7677C13.5327 22.9226 13.7632 23.0077 14.0016 23.0077C14.2399 23.0077 14.4704 22.9226 14.6516 22.7677L24.9316 13.8677L25.5716 13.2477C26.3396 12.5206 26.9513 11.6446 27.3694 10.6732C27.7875 9.70172 28.0031 8.65524 28.0031 7.59765C28.0031 6.54007 27.7875 5.49359 27.3694 4.52215C26.9513 3.55071 26.3396 2.6747 25.5716 1.94765Z",fill:"var(--like-icon-fill, transparent)",stroke:"var(--like-icon-stroke, currentColor)",strokeWidth:"var(--like-icon-stroke-width, 2)",strokeLinejoin:"round"})),U=({isMobile:t,liked:e,productNo:o,strokeWidth:r,variant:n,size:s="default",type:k="button",...a})=>{const{t:p}=K(),m=B(),{openDialog:S,openLoginDialog:f}=q(),{like:{mutate:w}}=E(),{height:P,stroke:x,width:C}=_[s],L={"--like-icon-fill":e?c.orange:"transparent","--like-icon-filter":M({isMobile:t,liked:e,variant:n}),"--like-icon-height":P,"--like-icon-stroke":$({isMobile:t,liked:e,variant:n}),"--like-icon-stroke-width":r??x,"--like-icon-width":C,...a.style},v=b=>{if(b.preventDefault(),!m){f();return}w({data:{items:[{productNo:o,like:e?"N":"Y"}]}},{onSuccess:()=>{S({message:p(e?"좋아하는 상품에서 제거하였습니다.":"좋아하는 상품에 추가하였습니다.")})}})};return y.jsx("button",{...a,type:k,"aria-label":a["aria-label"]??"좋아요","aria-pressed":e,style:L,onClick:v,className:N(G,a.className),children:y.jsx(Q,{})})},_={small:{width:"15.75px",height:"12.94px",stroke:"3"},default:{width:"24px",height:"20px",stroke:"2"},large:{width:"28px",height:"23px",stroke:""}},$=({isMobile:t,liked:e,variant:o})=>e?c.orange:o==="product-card"&&t?c.white:c.black,M=({isMobile:t,liked:e,variant:o})=>!e&&o==="product-card"&&t?"drop-shadow(0px 0px 3px rgba(0, 0, 0, 0.25))":"none",h=(t,e,o)=>({queryKey:d.products(e,o),queryFn:z(t,e,o),staleTime:1e3*60*60,gcTime:1e3*60*60}),z=(t,e,o)=>async()=>{if(t==="no"){const{data:n}=await u.getProductSectionProductsByNo(e,o);return n}const{data:r}=await u.getProductSectionProductsById(e,o);return r},A=({type:t="id",sectionId:e,searchParams:o,options:r})=>l({...h(t,e,o),...r}),V=({type:t="id",sectionId:e,searchParams:o,options:r})=>l({...h(t,e,o),...r}),R=t=>({queryKey:d.detail(t),queryFn:async()=>{const{data:e}=await u.getProductSectionById(t);return e}}),X=({sectionId:t,options:e})=>l({...R(t),...e}),tt=({options:t}={})=>O({queryKey:d.lists(),queryFn:async()=>{const{data:e}=await u.getProductSections();return e},staleTime:1e3*60*60,gcTime:1e3*60*60,...t}),et=({searchParams:t,options:e})=>j({queryKey:T.infiniteList(t),queryFn:async({pageParam:o})=>{const{data:r}=await I.searchProducts({...t,pageNumber:o});return{data:r,pageNumber:o}},getNextPageParam:(o,r)=>{var s;if(!t.pageSize)return;const n=((s=o.data)==null?void 0:s.totalCount)??0;return t.pageSize*r.lengthF(A({type:t,sectionId:e,searchParams:o,options:{enabled:!!e,...r}}));export{U as L,ot as a,et as b,X as c,V as d,u as p,tt as u};