import{j as t,n,D as $,I as G}from"./index-BTX1XDcj.js";import{L as H,b as x}from"./vendor-q1sfVHxQ.js";import{B as W}from"./button-Denaz1br.js";import"./input-CPMYudWS.js";import"./textarea-rdVfGD9I.js";import"./skeleton-CNA6x1S-.js";import"./select-wzQ5sK6b.js";import"./checkbox-zTCM5Mnm.js";import{P as g}from"./PLPThumbCard-Bvr3vm3P.js";import{u as z}from"./useQuery-DR2YabPW.js";import{I as U}from"./ImageCarousel-B5BhD1BX.js";import{S as K,a as Z}from"./swiper.min-BjDUzMMs.js";import{f as q}from"./free-mode.min-D8ybSzIe.js";import{u as V}from"./useIsDesktop-DbmMhgKo.js";import{u as Y}from"./useLayoutChanger-UU16y5vN.js";const h=({children:e,className:r})=>t.jsx("div",{className:n("w-full","lg:grid lg:grid-cols-12 lg:gap-x-[0.8rem]"),children:t.jsx("div",{className:n("w-full","lg:col-start-3 lg:col-span-8",r),children:e})}),E={narrow:n("lg:max-w-[62.1rem] lg:mx-auto"),half:n("lg:w-[calc((100%-0.8rem)/2)] lg:mx-auto")},F=({to:e,productNo:r,label:s,width:l="narrow",className:o})=>{const a=e??(r?`/product-detail?productNo=${r}`:null);if(!a||!s)return null;const i=/^https?:\/\//.test(a);return t.jsx("div",{className:n("w-full",E[l]??E.narrow,o),children:t.jsx(W,{asChild:!0,variant:"fig-outline",size:"fig-default",className:"w-full",children:i?t.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:s}):t.jsx(H,{to:a,children:s})})})},S=e=>e.map((r,s)=>t.jsxs(x.Fragment,{children:[s>0&&t.jsx("br",{}),r]},r)),Q=({kicker:e,title:r,titleMobile:s,description:l,descriptionMobile:o})=>{const a=s?.length>0,i=o?.length>0;return t.jsxs("div",{className:n("flex flex-col items-center justify-center w-full","font-fig-kr-only text-center text-[var(--fig-text-primary)] uppercase [word-break:normal] [overflow-wrap:break-word]"),children:[e&&t.jsx("p",{className:n("w-full font-normal","text-[1.4rem] leading-[2rem]","lg:text-[1.6rem] lg:leading-[2.4rem]"),children:e}),a&&t.jsx("p",{className:n("w-full font-bold text-[1.6rem] leading-[2.4rem]","lg:hidden"),children:S(s)}),t.jsx("p",{className:n("w-full font-bold",a?"hidden":"text-[1.6rem] leading-[2.4rem]","lg:block lg:text-[1.8rem] lg:leading-[2.8rem]"),children:r}),i&&t.jsx("p",{className:n("w-full font-normal text-[1.4rem] leading-[2rem]","lg:hidden"),children:S(o)}),l&&t.jsx("p",{className:n("w-full font-normal",i?"hidden":"text-[1.4rem] leading-[2rem]","lg:block lg:text-[1.6rem] lg:leading-[2.4rem]"),children:l})]})},J=30,X="ADMIN_SETTING",w=e=>{const{data:r,isLoading:s}=z({queryKey:["editorial","section-products",e],enabled:!!e,staleTime:3e5,queryFn:async()=>{const l=await $({url:`display/sections/ids/${e}/products`,query:{pageNumber:1,pageSize:J,hasTotalCount:!0,soldout:!0,by:X}});return{products:(l?.products??[]).filter(({frontDisplayYn:o})=>o),totalCount:l?.productTotalCount??0}}});return{products:r?.products??[],totalCount:r?.totalCount??0,isLoading:!!e&&s}},ee=["productNo","productName","brandName","brandNameEn","imageUrls","listImageUrls","salePrice","immediateDiscountAmt","additionDiscountAmt","isSoldOut","saleStatusType","salePeriodType","saleStartYmdt","saleEndYmdt","liked","adult","stickerLabels"],j=e=>({...Object.fromEntries(ee.map(s=>[s,e[s]])),collabBrandName:e.promotionText}),v={1:"w-full",2:"w-[calc((100%-0.8rem)/2)]"},te=({sectionId:e,mobileColumns:r=1,offset:s=0})=>{const{products:l}=w(e),o=l.slice(s);return o.length?t.jsx(h,{className:n("flex flex-wrap items-start justify-start gap-x-[0.8rem] gap-y-[6rem]","lg:justify-center"),children:o.map(a=>t.jsx("div",{className:n(v[r]??v[1],"lg:w-[calc((100%-2.4rem)/4)]"),children:t.jsx(g,{...j(a)})},a.productNo))}):null},re=({children:e,className:r})=>t.jsx("p",{className:n("w-full font-fig-kr-only font-bold text-[var(--fig-text-primary)] uppercase [word-break:normal] [overflow-wrap:break-word]","text-[1.6rem] leading-[2.4rem]","lg:text-[1.8rem] lg:leading-[2.8rem]",r),children:e}),m=[400,700,1e3,1300,1600],C="(min-width: 1024px) 66vw, 100vw",L="(min-width: 1024px) 22vw, 300px",se="(min-width: 1024px) 33vw, 300px",le=e=>e?.startsWith("//")?`https:${e}`:e,I=(e,r,s)=>G({url:le(e),additionalSearchParams:`${r}x${Math.round(r*s)}`}),N=({url:e,width:r,height:s},l)=>{const o=r&&s?s/r:1.25;return{src:I(e,m[m.length-1],o),srcSet:m.map(a=>`${I(e,a,o)} ${a}w`).join(", "),sizes:l}},oe=({images:e=[]})=>{if(!e.length)return null;const r=e.map(s=>N(s,C));return t.jsx(U,{slides:r,aspectRatio:"4 / 5"})},T={0:{slidesPerView:1.1,spaceBetween:8,threshold:10},768:{slidesPerView:2.4,spaceBetween:8,threshold:10}},p=({items:e,breakpoints:r=T,className:s})=>e?.length?t.jsx("div",{className:n("w-full",s),children:t.jsx(K,{className:"swiper--bleed",modules:[q],freeMode:!0,slidesPerView:1.1,spaceBetween:8,breakpoints:r,children:e.map(({key:l,node:o})=>t.jsx(Z,{className:"self-start !h-auto",children:o},l))})}):null,k={2:"w-[calc((100%-0.8rem)/2)]",3:"w-[calc((100%-1.6rem)/3)]"},B=({children:e,columns:r=3,className:s})=>{const l=V(),o=x.Children.toArray(e);return o.length?l?t.jsx("div",{className:n("flex flex-wrap items-start justify-center gap-[0.8rem] w-full",s),children:o.map(a=>t.jsx("div",{className:k[r]??k[3],children:a},a.key))}):t.jsx(p,{className:s,items:o.map(a=>({key:a.key,node:a}))}):null},M=({image:e,sizes:r=L})=>{const{src:s,srcSet:l}=N(e,r);return t.jsx("div",{className:"w-full aspect-[4/5] overflow-hidden bg-[var(--fig-system-product-bg)]",children:t.jsx("img",{src:s,srcSet:l,sizes:r,loading:"lazy",alt:"",className:"block size-full object-cover"})})},ae=({images:e=[],columns:r=3,className:s})=>t.jsx(B,{columns:r,className:s,children:e.map(l=>t.jsx(M,{image:l,sizes:r===2?se:L},l.url))}),_={...T,1024:{slidesPerView:3.42,spaceBetween:8,threshold:10}},ne=4,ie=()=>t.jsxs("div",{className:"flex flex-col items-start justify-start gap-[0.8rem] w-full",children:[t.jsx("div",{className:"w-full aspect-[4/5] bg-[var(--fig-system-product-bg)]"}),t.jsx("div",{className:"w-full h-[7.2rem]"})]}),ce=({sectionId:e,offset:r=0})=>{const{products:s,isLoading:l}=w(e),o=s.slice(r);return l?t.jsx(p,{breakpoints:_,items:Array.from({length:ne},(a,i)=>({key:`placeholder-${i}`,node:t.jsx(ie,{})}))}):o.length?t.jsx(p,{breakpoints:_,items:o.map(a=>({key:a.productNo,node:t.jsx(g,{...j(a)})}))}):null},de=()=>t.jsx("div",{className:"w-full aspect-[4/5] bg-[var(--fig-system-product-bg)]"}),ue=({sectionId:e,items:r=[],offset:s=0})=>{const{products:l,isLoading:o}=w(e);if(!r.length)return null;const a=l.slice(s);let i=0;const u=r.map(c=>{if(c.type!=="product")return{key:c.image.url,node:t.jsx(M,{image:c.image})};const d=a[i];return i+=1,d?{key:d.productNo,node:t.jsx(g,{...j(d)})}:o?{key:`placeholder-${i}`,node:t.jsx(de,{})}:null}).filter(Boolean);return u.length?t.jsx(B,{columns:r.length,children:u.map(({key:c,node:d})=>t.jsx("div",{className:"w-full",children:d},c))}):null},me=({image:e,className:r})=>{if(!e?.url)return null;const{src:s,srcSet:l,sizes:o}=N(e,C),a=e.width&&e.height?`${e.width} / ${e.height}`:"5 / 4";return t.jsx("div",{className:n("w-full overflow-hidden bg-[var(--fig-system-product-bg)]",r),style:{aspectRatio:a},children:t.jsx("img",{src:s,srcSet:l,sizes:o,loading:"lazy",alt:"",className:"block size-full object-cover"})})},f=({paragraphs:e=[],className:r})=>e.length?t.jsx("div",{className:n("flex flex-col items-start justify-start w-full","font-fig-kr-only text-[var(--fig-text-primary)] uppercase [word-break:normal] [overflow-wrap:break-word]","text-[1.4rem] leading-[2rem]","lg:text-[1.6rem] lg:leading-[2.4rem]",r),children:e.map(s=>t.jsx("p",{className:"w-full font-normal",children:s},s))}):null,R={full:"",half:n("lg:w-[calc((100%-0.8rem)/2)] lg:mx-auto")},fe={default:"",body:n("lg:text-[1.6rem] lg:leading-[2.4rem]")},A={default:"gap-[2rem]",tight:"gap-[1rem]"},pe=e=>Array.isArray(e)?e.map((r,s)=>t.jsxs(x.Fragment,{children:[s>0&&t.jsx("br",{}),r]},r)):e,P=e=>e?e.type==="row"?t.jsx(ae,{images:e.images,columns:e.columns}):e.type==="product-row"?t.jsx(ue,{sectionId:e.sectionId,items:e.items,offset:e.offset}):e.type==="product-carousel"?t.jsx(ce,{sectionId:e.sectionId,offset:e.offset}):e.type==="image"?t.jsx(me,{image:e.image,className:R[e.width??"full"]}):t.jsx(oe,{images:e.images}):null,xe=({heading:e,headingSize:r="default",headingPosition:s="above",media:l,paragraphs:o,paragraphsPosition:a="below",caption:i,credit:u,creditWidth:c="column",gap:d="default"})=>{const y=o?.length>0,b=e&&t.jsx(re,{className:fe[r],children:pe(e)}),D=u&&t.jsx("p",{className:n("w-full font-fig-kr-only font-normal text-right text-[var(--fig-text-secondary)] uppercase","text-[1.4rem] leading-[2rem]","lg:text-[1.6rem] lg:leading-[2.4rem]",c==="media"&&l?.type==="image"&&R[l.width??"full"]),children:u}),O=u?t.jsxs("div",{className:"flex flex-col items-start justify-start w-full",children:[P(l),D]}):P(l);return t.jsxs(h,{className:n("flex flex-col items-start justify-start",A[d]??A.default),children:[s==="above"&&b,y&&a==="above"&&t.jsx(f,{paragraphs:o}),O,s==="belowMedia"&&b,y&&a==="below"&&t.jsx(f,{paragraphs:o}),i&&t.jsx(f,{paragraphs:[i]})]})},Ce=({content:e})=>{Y({hasBackBtnOnHeader:!0,hasCartBtnOnHeader:!0,hasBottomNav:!0});const{lead:r,blocks:s}=e,l=({id:o,type:a,...i})=>a==="products"?t.jsx(te,{...i},o):a==="cta"?t.jsx(h,{children:t.jsx(F,{width:"half",...i})},o):t.jsx(xe,{...i},o);return t.jsxs("div",{className:n("flex flex-col items-start justify-start gap-[6rem] w-full","pt-[4rem] pb-[8rem]","lg:pt-[6rem]"),children:[t.jsx(Q,{kicker:r.kicker,title:r.title,titleMobile:r.titleMobile,description:r.description,descriptionMobile:r.descriptionMobile}),s.map(l)]})};export{Ce as E};