import{r as t,j as e,K as i}from"./react-B_SyE9nW.js";import{o,j as s,B as n,G as r,O as a,v as l,S as d,s as c,N as x,n as u,i as p}from"./index-Flm6m8Wj.js";import{B as h}from"./BtnIconRounded-Cm11YX7M.js";import{I as m}from"./ItemLoading-wir9MCjq.js";import{S as f}from"./SubTitle-CrjAIwYk.js";import{B as j,F as b}from"./BackIco-CDsoigLi.js";import{S as g,B as v}from"./Stack-CZ7Wid7r.js";import{N as w}from"./NoFound-BgX2Vk3k.js";import{P as M}from"./PublishContext-DeaOYrx6.js";const y={width:"100vw",overflow:"hidden",pl:"18px",m:"12px 0 10px"},D=t.createContext({}),B=o((()=>{const{title:i,titleProps:o}=t.useContext(D);return e.jsx(f,{text:i,align:"start",margin:`0 0 ${r.isMobile?8:15}px`,weight:500,...o})})),C={borderRadius:"18px",height:"100%",width:"100%",border:`1px solid ${s.grayMap}`,overflow:"hidden","& > div":{height:"100%"}},S=t.memo((function(){return e.jsx(n,{sx:C,className:"enj-infinity-loading",children:e.jsx(m,{})})})),I=o((({index:i,style:o,data:s})=>{const{child:r,onSelect:l,store:d,isProduct:c}=t.useContext(D),x=a((()=>d.at(i))).get();t.useEffect((()=>{const t=setTimeout((()=>{d.isLoading||x||d.loadData()}));return()=>clearTimeout(t)}),[d.isLoading]);const u=t.useMemo((()=>s?Number(s)-5+"px!important":"100%"),[s,x]);return e.jsx(n,{style:o,sx:{px:"5px",position:"relative",maxHeight:"fit-content",minHeight:u,"& > button.MuiButtonBase-root,.enj-infinity-loading":{height:u,"& .MuiPaper-root":{minHeight:"100%",height:"unset"}}},children:x?e.jsx(r,{...{...x,onSelect:l,index:i,isProduct:c}}):e.jsx(S,{})})})),k=o((({reference:o,onScroll:s,id:n})=>{const[a,l]=t.useState(0),{store:d}=t.useContext(D),c=()=>{var t;let e=a;const i=null==(t=document.getElementById(n))?void 0:t.getElementsByClassName("MuiPaper-root");i&&(Array.from(i).forEach((t=>{e<t.offsetHeight-5&&(e=t.offsetHeight)})),a<e&&l(e+5))},x=t.useCallback((t=>{c();const{overscanStopIndex:e}=t;setTimeout((()=>{(null==o?void 0:o.current)&&(o.current.data=t)}),(null==o?void 0:o.current)?0:400),e>=d.offset&&!d.isLoading&&d.loadData()}),[a]);return t.useEffect((()=>{c()}),[]),e.jsx(i,{className:"enj-fixed-list",ref:o,onItemsRendered:x,layout:"horizontal",itemSize:234,height:a,itemCount:d.getCount,itemData:a,width:r.isMobile?r.width-30:r.isDesktop?905:452,onScroll:s,overscanCount:0,children:I})})),z={display:"flex",flexGrow:1,"& > .enj-fixed-list > div > div > button.MuiButtonBase-root":{height:"fit-content","& > .MuiPaper-root":{p:"15px 12px 8px",minWidth:"100%"}},"@media(min-width:768px)":{pr:"165px","& > .enj-fixed-list":{width:"100%!important","& > div > div > button.MuiButtonBase-root":{width:"100%"}}},"@media(min-width:1366px)":{pr:"0","& > .enj-fixed-list":{scrollbarWidth:"none","-ms-overflow-style":"none","&::-webkit-scrollbar":{display:"none"}}}},N={"& .MuiIconButton-root.MuiButtonBase-root,&.MuiIconButton-root.MuiButtonBase-root":{width:"28px",height:"28px",borderColor:s.gray,"& > .MuiSvgIcon-root":{height:"18px",width:"auto",color:s.gray},"&.Mui-disabled":{borderColor:s.grayMap,"& > .MuiSvgIcon-root":{color:s.grayMap}},"@media(min-width:768px)":{"&.enj-map-btn-nav":{bgcolor:`${s.white}!important`,position:"relative",mx:"auto",display:"flex",zIndex:2,"&":{top:"calc(100vh - 564px)",left:"214px"},"&:first-of-type":{top:"calc(100vh - 536px)",right:"214px",left:"unset"},"&.Mui-disabled":{visibility:"hidden"}}},"@media(min-width:1366px)":{"&.enj-map-btn-nav":{"&":{top:"calc(100vh - 416px)",left:"246px"},"&:first-of-type":{top:"calc(100vh - 388px)",right:"250px",left:"unset"}}}}},T={display:"grid",gridTemplateColumns:"calc(100% - 64px) 32px 32px","@media(min-width:1366px)":{...N}},H=o((({sx:i})=>{const o=t.useRef(l()).current,{store:s}=t.useContext(D),a=t.useRef({}),[d,c]=t.useState({backDisable:!0,forwardDisable:s.getCount<=4}),{backDisable:x,forwardDisable:u}=d;return e.jsxs(g,{sx:{...y,...i},className:"enj-h-infinity",children:[e.jsxs(n,{sx:T,children:[e.jsx(B,{}),r.isDesktop?e.jsxs(e.Fragment,{children:[e.jsx(h,{onClick:()=>{const{data:{visibleStartIndex:t}}=a.current;if(t>0){const e=t-4;return a.current.scrollToItem(e<0?0:e,"start"),void setTimeout((()=>c({backDisable:e<=0,forwardDisable:!1})))}c({backDisable:!0,forwardDisable:!1})},disabled:x,children:e.jsx(j,{})}),e.jsx(h,{onClick:()=>{var t;if(!(null==(t=a.current)?void 0:t.data))return;const{data:{visibleStopIndex:e,visibleStartIndex:i},props:{itemCount:o}}=a.current,s=o-1;if(e<s){const t=i+4+(0===i?0:1);return a.current.scrollToItem(t>=s?s:t,"start"),void setTimeout((()=>c({backDisable:!1,forwardDisable:t+1>=s})))}c({...d,forwardDisable:!0})},disabled:u,children:e.jsx(b,{})})]}):e.jsx(e.Fragment,{})]}),e.jsx(n,{sx:z,id:o,children:e.jsx(k,{id:o,reference:a,onScroll:r.isDesktop?({scrollOffset:t})=>{if(0===t)return c({...d,backDisable:!0});if(a.current){const{data:{visibleStopIndex:t},props:{itemCount:e}}=a.current;if(t===e-1)return c({...d,forwardDisable:!0});c({backDisable:!1,forwardDisable:!1})}}:void 0})})]})}));function P(t){return e.jsxs(d,{...t,children:[e.jsx("path",{fill:"#DD4906",d:"M22.2 6.5L20.1 1h-5l1 6.4a2.8 2.8 0 003.1 2.1c1.7 0 3.1-1.1 3.1-2.4l-.1-.6zM17.5 10.1c-.7-.3-1.4-.7-2-1.3a5 5 0 01-4.1 1.7c-1.6.1-3.2-.5-4.3-1.6a5 5 0 01-1.9 1.3c-.8.2-1.6.3-2.3.2v8.5c0 .9.8 1.7 1.7 1.7H15v-3.4h2.9v-2.9h2v-3.9a5 5 0 01-2.4-.3z"}),e.jsx("path",{fill:"#DD4906",d:"M14.5 7l-.6-6h-5l-.7 6v.1c0 1.3 1.4 2.4 3.1 2.4 1.7 0 3.1-1.1 3.1-2.4l.1-.1zM2.5 1L.4 6.5l-.1.6c0 1.3 1.4 2.4 3.1 2.4a3 3 0 003.1-2.1l1-6.4h-5zM23.7 18.2v1.9h-2.9V23h-1.9v-2.9H16v-1.9h2.9v-2.9h1.9v2.9z"})]})}const E=c(x)`
  & {
    position: relative;
    top: 1px;
    line-height: 16px;
  }
`;const L=o((function({business:i=!1,onClickAdd:o}){const s=t.useContext(M);return e.jsxs(g,{sx:{mt:"20px",alignItems:"center","@media(min-width:768px)":{flexDirection:"column-reverse",maxWidth:"360px","& > .MuiSvgIcon-root":{height:"170px",m:"28px 0 34px"}}},children:[e.jsxs(g,{children:[e.jsx(x,{size:"mini",margin:"0",children:u(i?"searchNoBusiness":"noOptionsText",i?{enjoty:e.jsx("span",{children:u("enjotySp")})}:{enjoty:e.jsx(x,{size:"mini",color:"brown",weight:600,children:"enjoty"}),points:e.jsx(x,{size:"mini",color:"brown",weight:600,children:"30"}),separator:e.jsx("br",{})})}),e.jsx(v,{variant:"outlined",startIcon:e.jsx(P,{}),size:"large",sx:{m:"20px 0","& .MuiButton-label":{fontSize:p.mini},maxWidth:"fit-content",mx:"auto"},onClick:()=>{null==o||o(),s.onClickAddBusiness()},children:e.jsx(E,{size:"mini",color:"red",margin:"0",children:u("addBusiness")})})]}),e.jsx(w,{})]})}));export{D as H,L as N,H as a,N as s};