@anker-in/headless-ui 1.0.20-alpha.1761577503057 → 1.0.20-alpha.1761623666342

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ interface NavContextType {
25
25
  subSubCategory?: any;
26
26
  setSubSubCategory?: (category: any) => void;
27
27
  onSeriesProductClick?: (seriesProduct: any, position: number, seriesLabel?: string) => void;
28
+ onSidebarNavClick?: (series: any, index: number, subSubindex?: number) => void;
28
29
  }
29
30
  export declare const NavContext: React.Context<NavContextType>;
30
31
  export declare const useNavContext: () => NavContextType;
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},N=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of _(e))!l.call(t,a)&&a!==o&&s(t,a,{get:()=>e[a],enumerable:!(n=E(e,a))||n.enumerable});return t};var R=t=>N(s({},"__esModule",{value:!0}),t);var m={};T(m,{NavContext:()=>i,default:()=>U,useNavContext:()=>M});module.exports=R(m);var p=require("react/jsx-runtime"),r=require("react"),c=require("./types.js");const v={isMobile:!1,payloadData:{},buildProps:{products:[],categories:{}},currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{},currentSeriesMetadata:{},setCurrentSeriesMetadata:()=>{},onSeriesProductClick:(t,e,o)=>{}},i=(0,r.createContext)(v),M=()=>{if(!(0,r.useContext)(i))throw new Error("useNavContext must be used in <NavProvider>");return(0,r.useContext)(i)},P=(t,e)=>{switch(e.type){case"SET_CURRENT_MENU":return{...t,currentMenu:e.value};case"SET_CURRENT_SERIES_METADATA":return{...t,currentSeriesMetadata:e.value};case"SET_SUB_SUB_CATEGORY":return{...t,subSubCategory:e.value};case"SET_ON_SERIES_PRODUCT_CLICK":return{...t,onSeriesProductClick:e.value}}},b=({children:t,...e})=>{const[o,n]=(0,r.useReducer)(P,{...v,currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{}}),a=(0,r.useCallback)(u=>n({type:"SET_CURRENT_MENU",value:u}),[n]),d=(0,r.useCallback)(u=>n({type:"SET_CURRENT_SERIES_METADATA",value:u}),[n]),C=(0,r.useCallback)(u=>n({type:"SET_SUB_SUB_CATEGORY",value:u}),[n]),S=(0,r.useCallback)(u=>n({type:"SET_ON_SERIES_PRODUCT_CLICK",value:u}),[n]),y=(0,r.useMemo)(()=>({...o,setCurrentMenu:a,setCurrentSeriesMetadata:d,setSubSubCategory:C,setOnSeriesProductClick:S}),[a,d,C,S,o]);return(0,p.jsx)(i.Provider,{value:{...y,...e},children:t})};var U=b;
1
+ "use strict";var s=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},M=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!E.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(a=C(e,o))||a.enumerable});return t};var N=t=>M(s({},"__esModule",{value:!0}),t);var x={};T(x,{NavContext:()=>u,default:()=>m,useNavContext:()=>b});module.exports=N(x);var S=require("react/jsx-runtime"),r=require("react"),c=require("./types.js");const y={isMobile:!1,payloadData:{},buildProps:{products:[],categories:{}},currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{},currentSeriesMetadata:{},setCurrentSeriesMetadata:()=>{},onSeriesProductClick:(t,e,n)=>{},onSidebarNavClick:t=>{}},u=(0,r.createContext)(y),b=()=>{if(!(0,r.useContext)(u))throw new Error("useNavContext must be used in <NavProvider>");return(0,r.useContext)(u)},_=(t,e)=>{switch(e.type){case"SET_CURRENT_MENU":return{...t,currentMenu:e.value};case"SET_CURRENT_SERIES_METADATA":return{...t,currentSeriesMetadata:e.value};case"SET_SUB_SUB_CATEGORY":return{...t,subSubCategory:e.value}}},R=({children:t,...e})=>{const[n,a]=(0,r.useReducer)(_,{...y,currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{}}),o=(0,r.useCallback)(i=>a({type:"SET_CURRENT_MENU",value:i}),[a]),d=(0,r.useCallback)(i=>a({type:"SET_CURRENT_SERIES_METADATA",value:i}),[a]),v=(0,r.useCallback)(i=>a({type:"SET_SUB_SUB_CATEGORY",value:i}),[a]),p=(0,r.useMemo)(()=>({...n,setCurrentMenu:o,setCurrentSeriesMetadata:d,setSubSubCategory:v}),[o,d,v,n]);return(0,S.jsx)(u.Provider,{value:{...p,...e},children:t})};var m=R;
2
2
  //# sourceMappingURL=NavProvider.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/HeaderNavigation/NavProvider.tsx"],
4
- "sourcesContent": ["import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react'\nimport type { Product } from '../../cpn-components/CpnProductCard/types.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport type { UserProfile } from './types.js'\n\ninterface NavContextType {\n buildProps: {\n products?: Product[] // \u4EA7\u54C1\u6570\u636E\n categories?: Record<string, any> // \u5206\u7C7B\u6570\u636E\n }\n event?: {\n search?: () => void\n cart?: () => void\n profile?: () => void\n livestream?: () => void\n join?: () => void\n login?: () => void\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n isMobile?: boolean\n payloadData: any\n currentMenu?: HeaderNavigationMenu // \u5F53\u524D\u83DC\u5355\n setCurrentMenu?: (menu: HeaderNavigationMenu) => void // \u8BBE\u7F6E\u5F53\u524D\u83DC\u5355\n currentSeriesMetadata?: any // \u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n setCurrentSeriesMetadata?: (metadata: any) => void // \u8BBE\u7F6E\u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n subSubCategory?: any // \u5B50\u5B50\u5206\u7C7B\n setSubSubCategory?: (category: any) => void // \u8BBE\u7F6E\u5B50\u5B50\u5206\u7C7B\n onSeriesProductClick?: (seriesProduct: any, position: number, seriesLabel?: string) => void // \u8BBE\u7F6E\u7CFB\u5217\u4EA7\u54C1\u70B9\u51FB\n}\n\nconst initialState: NavContextType = {\n isMobile: false,\n payloadData: {},\n buildProps: {\n products: [],\n categories: {},\n },\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n currentSeriesMetadata: {},\n setCurrentSeriesMetadata: () => {},\n onSeriesProductClick: (seriesProduct: any, position: number, seriesLabel?: string) => {},\n}\n\ntype Action =\n | {\n type: 'SET_CURRENT_MENU'\n value: HeaderNavigationMenu\n }\n | {\n type: 'SET_CURRENT_SERIES_METADATA'\n value: any\n }\n | {\n type: 'SET_SUB_SUB_CATEGORY'\n value: any\n }\n | {\n type: 'SET_ON_SERIES_PRODUCT_CLICK'\n value: (seriesProduct: any, position: number) => void\n }\n\nexport const NavContext = createContext<NavContextType>(initialState)\n\nexport const useNavContext = () => {\n const context = useContext(NavContext)\n if (!context) {\n throw new Error('useNavContext must be used in <NavProvider>')\n }\n return useContext(NavContext)\n}\n\nconst reducer = (state: NavContextType, action: Action) => {\n switch (action.type) {\n case 'SET_CURRENT_MENU': {\n return {\n ...state,\n currentMenu: action.value,\n }\n }\n case 'SET_CURRENT_SERIES_METADATA': {\n return {\n ...state,\n currentSeriesMetadata: action.value,\n }\n }\n case 'SET_SUB_SUB_CATEGORY': {\n return {\n ...state,\n subSubCategory: action.value,\n }\n }\n case 'SET_ON_SERIES_PRODUCT_CLICK': {\n return {\n ...state,\n onSeriesProductClick: action.value,\n }\n }\n }\n}\n\nconst NavProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & NavContextType) => {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n })\n\n const setCurrentMenu = useCallback(\n (value: HeaderNavigationMenu) => {\n return dispatch({ type: 'SET_CURRENT_MENU', value })\n },\n [dispatch]\n )\n\n const setCurrentSeriesMetadata = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_CURRENT_SERIES_METADATA', value })\n },\n [dispatch]\n )\n\n const setSubSubCategory = useCallback((value: any) => {\n return dispatch({ type: 'SET_SUB_SUB_CATEGORY', value })\n }, [dispatch])\n\n const setOnSeriesProductClick = useCallback((value: (seriesProduct: any, position: number) => void) => {\n return dispatch({ type: 'SET_ON_SERIES_PRODUCT_CLICK', value })\n }, [dispatch])\n\n const value = useMemo(\n () => ({\n ...state,\n setCurrentMenu,\n setCurrentSeriesMetadata,\n setSubSubCategory,\n setOnSeriesProductClick,\n }),\n [setCurrentMenu, setCurrentSeriesMetadata, setSubSubCategory, setOnSeriesProductClick, state]\n )\n\n return <NavContext.Provider value={{ ...value, ...rest }}>{children}</NavContext.Provider>\n}\n\nexport default NavProvider\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAL,GAkJS,IAAAM,EAAA,6BAlJTC,EAAmF,iBAEnFC,EAAqC,sBA4BrC,MAAMC,EAA+B,CACnC,SAAU,GACV,YAAa,CAAC,EACd,WAAY,CACV,SAAU,CAAC,EACX,WAAY,CAAC,CACf,EACA,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,EACvB,sBAAuB,CAAC,EACxB,yBAA0B,IAAM,CAAC,EACjC,qBAAsB,CAACC,EAAoBC,EAAkBC,IAAyB,CAAC,CACzF,EAoBaV,KAAa,iBAA8BO,CAAY,EAEvDL,EAAgB,IAAM,CAEjC,GAAI,IADY,cAAWF,CAAU,EAEnC,MAAM,IAAI,MAAM,6CAA6C,EAE/D,SAAO,cAAWA,CAAU,CAC9B,EAEMW,EAAU,CAACC,EAAuBC,IAAmB,CACzD,OAAQA,EAAO,KAAM,CACnB,IAAK,mBACH,MAAO,CACL,GAAGD,EACH,YAAaC,EAAO,KACtB,EAEF,IAAK,8BACH,MAAO,CACL,GAAGD,EACH,sBAAuBC,EAAO,KAChC,EAEF,IAAK,uBACH,MAAO,CACL,GAAGD,EACH,eAAgBC,EAAO,KACzB,EAEF,IAAK,8BACH,MAAO,CACL,GAAGD,EACH,qBAAsBC,EAAO,KAC/B,CAEJ,CACF,EAEMC,EAAc,CAAC,CACnB,SAAAC,EACA,GAAGC,CACL,IAEuB,CACrB,KAAM,CAACJ,EAAOK,CAAQ,KAAI,cAAWN,EAAS,CAC5C,GAAGJ,EACH,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,CACzB,CAAC,EAEKW,KAAiB,eACpBC,GACQF,EAAS,CAAE,KAAM,mBAAoB,MAAAE,CAAM,CAAC,EAErD,CAACF,CAAQ,CACX,EAEMG,KAA2B,eAC9BD,GACQF,EAAS,CAAE,KAAM,8BAA+B,MAAAE,CAAM,CAAC,EAEhE,CAACF,CAAQ,CACX,EAEMI,KAAoB,eAAaF,GAC9BF,EAAS,CAAE,KAAM,uBAAwB,MAAAE,CAAM,CAAC,EACtD,CAACF,CAAQ,CAAC,EAEPK,KAA0B,eAAaH,GACpCF,EAAS,CAAE,KAAM,8BAA+B,MAAAE,CAAM,CAAC,EAC7D,CAACF,CAAQ,CAAC,EAEPE,KAAQ,WACZ,KAAO,CACL,GAAGP,EACH,eAAAM,EACA,yBAAAE,EACA,kBAAAC,EACA,wBAAAC,CACF,GACA,CAACJ,EAAgBE,EAA0BC,EAAmBC,EAAyBV,CAAK,CAC9F,EAEA,SAAO,OAACZ,EAAW,SAAX,CAAoB,MAAO,CAAE,GAAGmB,EAAO,GAAGH,CAAK,EAAI,SAAAD,EAAS,CACtE,EAEA,IAAOd,EAAQa",
6
- "names": ["NavProvider_exports", "__export", "NavContext", "NavProvider_default", "useNavContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_types", "initialState", "seriesProduct", "position", "seriesLabel", "reducer", "state", "action", "NavProvider", "children", "rest", "dispatch", "setCurrentMenu", "value", "setCurrentSeriesMetadata", "setSubSubCategory", "setOnSeriesProductClick"]
4
+ "sourcesContent": ["import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react'\nimport type { Product } from '../../cpn-components/CpnProductCard/types.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport type { UserProfile } from './types.js'\n\ninterface NavContextType {\n buildProps: {\n products?: Product[] // \u4EA7\u54C1\u6570\u636E\n categories?: Record<string, any> // \u5206\u7C7B\u6570\u636E\n }\n event?: {\n search?: () => void\n cart?: () => void\n profile?: () => void\n livestream?: () => void\n join?: () => void\n login?: () => void\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n isMobile?: boolean\n payloadData: any\n currentMenu?: HeaderNavigationMenu // \u5F53\u524D\u83DC\u5355\n setCurrentMenu?: (menu: HeaderNavigationMenu) => void // \u8BBE\u7F6E\u5F53\u524D\u83DC\u5355\n currentSeriesMetadata?: any // \u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n setCurrentSeriesMetadata?: (metadata: any) => void // \u8BBE\u7F6E\u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n subSubCategory?: any // \u5B50\u5B50\u5206\u7C7B\n setSubSubCategory?: (category: any) => void // \u8BBE\u7F6E\u5B50\u5B50\u5206\u7C7B\n onSeriesProductClick?: (seriesProduct: any, position: number, seriesLabel?: string) => void // \u8BBE\u7F6E\u7CFB\u5217\u4EA7\u54C1\u70B9\u51FB\n onSidebarNavClick?: (series: any, index: number, subSubindex?: number) => void // \u8BBE\u7F6E\u4FA7\u8FB9\u680F\u5BFC\u822A\u70B9\u51FB\n}\n\nconst initialState: NavContextType = {\n isMobile: false,\n payloadData: {},\n buildProps: {\n products: [],\n categories: {},\n },\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n currentSeriesMetadata: {},\n setCurrentSeriesMetadata: () => {},\n onSeriesProductClick: (seriesProduct: any, position: number, seriesLabel?: string) => {},\n onSidebarNavClick: (series: any) => {} ,\n}\n\ntype Action =\n | {\n type: 'SET_CURRENT_MENU'\n value: HeaderNavigationMenu\n }\n | {\n type: 'SET_CURRENT_SERIES_METADATA'\n value: any\n }\n | {\n type: 'SET_SUB_SUB_CATEGORY'\n value: any\n }\nexport const NavContext = createContext<NavContextType>(initialState)\n\nexport const useNavContext = () => {\n const context = useContext(NavContext)\n if (!context) {\n throw new Error('useNavContext must be used in <NavProvider>')\n }\n return useContext(NavContext)\n}\n\nconst reducer = (state: NavContextType, action: Action) => {\n switch (action.type) {\n case 'SET_CURRENT_MENU': {\n return {\n ...state,\n currentMenu: action.value,\n }\n }\n case 'SET_CURRENT_SERIES_METADATA': {\n return {\n ...state,\n currentSeriesMetadata: action.value,\n }\n }\n case 'SET_SUB_SUB_CATEGORY': {\n return {\n ...state,\n subSubCategory: action.value,\n }\n }\n }\n}\n\nconst NavProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & NavContextType) => {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n })\n\n const setCurrentMenu = useCallback(\n (value: HeaderNavigationMenu) => {\n return dispatch({ type: 'SET_CURRENT_MENU', value })\n },\n [dispatch]\n )\n\n const setCurrentSeriesMetadata = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_CURRENT_SERIES_METADATA', value })\n },\n [dispatch]\n )\n\n const setSubSubCategory = useCallback((value: any) => {\n return dispatch({ type: 'SET_SUB_SUB_CATEGORY', value })\n }, [dispatch])\n\n const value = useMemo(\n () => ({\n ...state,\n setCurrentMenu,\n setCurrentSeriesMetadata,\n setSubSubCategory,\n }),\n [setCurrentMenu, setCurrentSeriesMetadata, setSubSubCategory, state]\n )\n\n return <NavContext.Provider value={{ ...value, ...rest }}>{children}</NavContext.Provider>\n}\n\nexport default NavProvider\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAL,GAoIS,IAAAM,EAAA,6BApITC,EAAmF,iBAEnFC,EAAqC,sBA6BrC,MAAMC,EAA+B,CACnC,SAAU,GACV,YAAa,CAAC,EACd,WAAY,CACV,SAAU,CAAC,EACX,WAAY,CAAC,CACf,EACA,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,EACvB,sBAAuB,CAAC,EACxB,yBAA0B,IAAM,CAAC,EACjC,qBAAsB,CAACC,EAAoBC,EAAkBC,IAAyB,CAAC,EACvF,kBAAoBC,GAAgB,CAAC,CACvC,EAeaX,KAAa,iBAA8BO,CAAY,EAEvDL,EAAgB,IAAM,CAEjC,GAAI,IADY,cAAWF,CAAU,EAEnC,MAAM,IAAI,MAAM,6CAA6C,EAE/D,SAAO,cAAWA,CAAU,CAC9B,EAEMY,EAAU,CAACC,EAAuBC,IAAmB,CACzD,OAAQA,EAAO,KAAM,CACnB,IAAK,mBACH,MAAO,CACL,GAAGD,EACH,YAAaC,EAAO,KACtB,EAEF,IAAK,8BACH,MAAO,CACL,GAAGD,EACH,sBAAuBC,EAAO,KAChC,EAEF,IAAK,uBACH,MAAO,CACL,GAAGD,EACH,eAAgBC,EAAO,KACzB,CAEJ,CACF,EAEMC,EAAc,CAAC,CACnB,SAAAC,EACA,GAAGC,CACL,IAEuB,CACrB,KAAM,CAACJ,EAAOK,CAAQ,KAAI,cAAWN,EAAS,CAC5C,GAAGL,EACH,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,CACzB,CAAC,EAEKY,KAAiB,eACpBC,GACQF,EAAS,CAAE,KAAM,mBAAoB,MAAAE,CAAM,CAAC,EAErD,CAACF,CAAQ,CACX,EAEMG,KAA2B,eAC9BD,GACQF,EAAS,CAAE,KAAM,8BAA+B,MAAAE,CAAM,CAAC,EAEhE,CAACF,CAAQ,CACX,EAEMI,KAAoB,eAAaF,GAC9BF,EAAS,CAAE,KAAM,uBAAwB,MAAAE,CAAM,CAAC,EACtD,CAACF,CAAQ,CAAC,EAEPE,KAAQ,WACZ,KAAO,CACL,GAAGP,EACH,eAAAM,EACA,yBAAAE,EACA,kBAAAC,CACF,GACA,CAACH,EAAgBE,EAA0BC,EAAmBT,CAAK,CACrE,EAEA,SAAO,OAACb,EAAW,SAAX,CAAoB,MAAO,CAAE,GAAGoB,EAAO,GAAGH,CAAK,EAAI,SAAAD,EAAS,CACtE,EAEA,IAAOf,EAAQc",
6
+ "names": ["NavProvider_exports", "__export", "NavContext", "NavProvider_default", "useNavContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_types", "initialState", "seriesProduct", "position", "seriesLabel", "series", "reducer", "state", "action", "NavProvider", "children", "rest", "dispatch", "setCurrentMenu", "value", "setCurrentSeriesMetadata", "setSubSubCategory"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var me=Object.create;var U=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var ge=(t,n)=>{for(var o in n)U(t,o,{get:n[o],enumerable:!0})},X=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of be(n))!ve.call(t,r)&&r!==o&&U(t,r,{get:()=>n[r],enumerable:!(c=pe(n,r))||c.enumerable});return t};var G=(t,n,o)=>(o=t!=null?me(fe(t)):{},X(n||!t||!t.__esModule?U(o,"default",{value:t,enumerable:!0}):o,t)),ye=t=>X(U({},"__esModule",{value:!0}),t);var He={};ge(He,{default:()=>Ee});module.exports=ye(He);var e=require("react/jsx-runtime"),a=G(require("react")),l=require("../../components/index.js"),oe=require("../../shared/Styles.js"),N=require("../../helpers/utils.js"),B=G(require("./NavProvider.js")),y=require("./types.js"),$e=require("react-responsive"),se=require("es-toolkit"),re=G(require("jump.js")),K=require("@gsap/react"),J=require("gsap"),H=require("./withCategory.js"),P=require("./icons/index.js"),ie=G(require("../NavigationSearch/index.js"));const he=(0,a.forwardRef)((t,n)=>{const{data:{headerNavigation:o}={},buildProps:c,event:r,profile:b,theme:d="light",isTop:m=!1,searchResult:p,onSearch:v,isSearching:k,keywords:w,onPrimaryNavClick:s,onSeriesProductClick:x}=t,f=(0,a.useRef)(null),[u,i]=(0,a.useState)(!1),[h,D]=(0,a.useState)(!1),[L,C]=(0,a.useState)(!1),[R,S]=(0,a.useState)(!1),T=(0,a.useRef)(null),j=()=>{const A=document?.querySelector("body")?.offsetWidth||0;S(A<=1440)};(0,a.useEffect)(()=>(j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}),[]),(0,a.useImperativeHandle)(n,()=>T.current),(0,a.useEffect)(()=>{T.current&&m&&(0,re.default)(T.current,{duration:0,offset:T.current?.getBoundingClientRect()?.bottom||0})},[m]),(0,a.useEffect)(()=>{r&&(r.search=()=>i(!0))},[r]),(0,K.useGSAP)(()=>{f?.current&&u&&J.gsap.fromTo(f.current,{height:0},{height:"auto",duration:.3})},[u]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=u?"hidden":"auto"},[u]);const M=(0,a.useMemo)(()=>o?.headerBar?.actions?.find(A=>A?.blockType===y.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[o]);return(0,e.jsx)(B.default,{buildProps:c,profile:b,isMobile:R,event:r,payloadData:o,onSeriesProductClick:x,children:(0,e.jsx)("header",{"data-ui-component-id":"HeaderNavigation",className:"relative z-[100]",ref:T,children:(0,e.jsxs)("div",{className:(0,N.cn)("hover:text-black hover:bg-white",d==="light"?"text-black":"text-white",{}),onClick:()=>C(!0),children:[(0,e.jsx)(xe,{data:o,className:"hidden desktop:block",theme:d,onNavItemClick:()=>C(!0),onPrimaryNavClick:s}),(0,e.jsx)(Ce,{data:o,className:"block desktop:hidden",onPrimaryNavClick:s}),u&&(0,e.jsxs)("div",{className:"absolute z-[60] top-0 left-0 w-full bg-black/70 flex flex-col",style:{height:`calc(100dvh - ${T?.current?.getBoundingClientRect()?.top}px)`},children:[(0,e.jsx)("div",{ref:f,className:(0,N.cn)("overflow-y-auto",{}),children:(0,e.jsx)(ie.default,{data:M,keywords:w,isSearching:k,searchResult:p,onSearch:A=>{v?.(A)},onClose:()=>{v?.(),i(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>i(!1)})]})]})})})}),xe=(0,a.forwardRef)((t,n)=>{const{data:o,onNavItemClick:c,className:r,theme:b,onPrimaryNavClick:d}=t,{event:m,profile:p}=(0,B.useNavContext)(),[v,k]=(0,a.useState)(!1),w=(0,a.useMemo)(()=>(0,H.WithGroupCategory)(o?.categories?.filter(g=>g?.pcShow)),[o]),[s,x]=(0,a.useState)(null),[f,u]=(0,a.useState)([]),i=(0,a.useRef)(null),[h,D]=(0,a.useState)(!1),L=(0,a.useRef)(null),C=(0,a.useRef)(null),R=(0,a.useRef)(w.map(g=>Array(g?.length||0).fill(null)));(0,a.useEffect)(()=>{w?.length&&u(w?.map((g,z)=>g?.map((E,$)=>({groupIndex:z,index:$,open:!1}))))},[w]);const S=(0,a.useMemo)(()=>{let g=null;for(const z of f){for(const E of z)if(E.open){g=E;break}if(g)break}return g},[f]);(0,a.useEffect)(()=>{document.documentElement.style.overflow=S?.open||h?"hidden":"auto"},[S?.open,h]);const T=(g,z,E)=>{if(D(!1),s?.components?.[0]?.blockType===y.HeaderNavigationBlockType.Links)s?.components?.[0]?.url&&window.open(s?.components?.[0]?.url);else{const $=w?.flat()||[],O=$?.findIndex(Q=>Q?.id===w[z][E]?.id);g.stopPropagation(),c?.(),d?.($[O],O),x(w[z][E]),u(Q=>Q.map(ue=>ue.map(I=>I.groupIndex===z&&I.index===E?{...I,open:!I.open}:{...I,open:!1})))}},j=()=>{u(g=>g.map(z=>z.map(E=>({...E,open:!1}))))},M=(0,a.useMemo)(()=>{if(s)return s?.components?.[0]?.blockType},[s]),A=(0,H.WithSidebar)(Ne,s),F=(0,H.WithMulticol)(ke,s),ce=(0,H.WithSupports)(we,{categoriesItem:s,currentNavItemRef:R.current?.[S?.groupIndex||0]?.[S?.index||0]}),de=(0,a.useMemo)(()=>{switch(M){case y.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(A,{});case y.HeaderNavigationBlockType.Supports:return(0,e.jsx)(ce,{});case y.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(F,{});default:return null}},[M,s]),V=(0,a.useMemo)(()=>o?.headerBar?.actions?.filter(g=>g?.pcShow),[o]),_=(0,a.useMemo)(()=>V?.find(g=>g?.blockType===y.HeaderNavigationActionBlockType.Profile),[V]),q=(0,a.useCallback)(()=>{D(g=>!g)},[]);return(0,a.useEffect)(()=>{if(i?.current){const g=i.current;return g.addEventListener("click",q),()=>{g.removeEventListener("click",q)}}},[q]),(0,K.useGSAP)(()=>{S?.open&&J.gsap.fromTo(C?.current,{height:0},{height:"auto"})},[S?.open]),(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[96px]",r),children:[(0,e.jsxs)("div",{ref:L,onClick:j,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(ae,{}),(0,e.jsx)(ne,{ref:i,actions:V,activeStatus:h})]}),(0,e.jsx)("div",{className:"flex justify-between",children:w?.map((g,z)=>(0,e.jsx)("div",{className:"flex gap-3",children:g?.map((E,$)=>(0,e.jsx)("div",{ref:O=>{R.current[z][$]=O},className:"group cursor-pointer",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 pb-4",onClick:O=>T(O,z,$),children:[(0,e.jsx)(l.Text,{html:E.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(P.DownArrow,{className:(0,N.cn)("opacity-0 size-4 group-hover:opacity-100 transition-opacity duration-500",{"rotate-180":S?.groupIndex===z&&S?.index===$,"opacity-100":v&&S?.groupIndex===z&&S?.index===$})})]}),(0,e.jsx)("div",{className:(0,N.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":S?.groupIndex===z&&S?.index===$},b==="dark"?"bg-white":"bg-[#1D1D1F]")})]})},E.id))},`groupCategory-${z}`))})]}),(0,e.jsxs)("div",{className:(0,N.cn)("border-t border-b-[#E4E5E6] text-black absolute left-0 top-full z-[999] flex w-full flex-col bg-black/70 overflow-hidden",{hidden:!(S?.open&&s)}),onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),style:{height:`calc(100dvh - ${L?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:C,className:(0,N.cn)("relative z-50",{"overflow-hidden":M!==y.HeaderNavigationBlockType.Supports}),children:de}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:j})]}),h&&(0,e.jsxs)("div",{className:"absolute left-0 z-[999] flex w-full bg-black/70 h-[100dvh] top-full",children:[(0,e.jsx)("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${i?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:p?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:p?.nick_name||_?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"h-[1px] mt-2 bg-[#D9D9D9]"}),(0,e.jsx)("div",{className:"mt-2",children:_?.profiles?.map(g=>(0,e.jsx)(W,{className:"py-2",label:g?.title,href:g?.url},g.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(P.Polygon,{className:"absolute -top-2 text-white right-[46px] z-30"}),(0,e.jsx)(l.Text,{html:_?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:_?.benefits?.map(g=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:g.benefitIcon?.url,className:"size-4",alt:g.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:g.benefit,className:"text-sm font-bold leading-[1.4]"})]},g.id))}),(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,e.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>m?.join?.(),children:(0,e.jsx)(l.Text,{html:_?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>m?.login?.(),children:(0,e.jsx)(l.Text,{html:_?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>D(!1)})]})]})}),Ne=a.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{buildProps:o}=(0,B.useNavContext)(),[c,r]=(0,a.useState)([]),[b,d]=(0,a.useState)(-1),m=(0,a.useRef)(null),p=(0,a.useCallback)(()=>{const s=t?.subcategories;if(!s?.length)return;const x=s.findIndex(i=>!!i?.subSubCategories),f=s.findIndex(i=>!i?.subSubCategories),u=s.map((i,h)=>({index:h,open:x===h||f===h}));r(u)},[t]);(0,a.useEffect)(()=>{p()},[p]);const v=(0,a.useMemo)(()=>{const s=t?.subcategories?.[c?.find(f=>f.open)?.index||0],x=n?.find(f=>f?.label?.toLowerCase()===s?.label?.toLowerCase())||{};if(s?.collections){const f=o?.categories?.[s?.collections]||{};return{label:x?.label,isCollection:!0,banner:x?.banner,primary:x?.primary,series:[{products:f?.products}]}}else if(s?.subSubCategories){const f=s?.subSubCategories?.[b],u=n?.find(i=>i?.label?.toLowerCase()===f?.label?.toLowerCase())||{};if(f?.collections){const i=o?.categories?.[f?.collections]||{};return{label:u?.label,isCollection:!0,banner:u?.banner,primary:u?.primary,series:[{products:i?.products}]}}else return u}else return x},[t,c,b,n]),k=(0,a.useCallback)((s,x)=>{if(x?.subSubCategories?.length>0?d(0):d(-1),x?.subSubCategories?.length>0)r(f=>f.map(u=>u.index===s?{...u,open:!0}:{...u,open:!1}));else{const u=t?.subcategories?.findIndex(i=>!!i?.subSubCategories);r(i=>i.map(h=>({...h,open:h.index===s||h.index===u})))}},[t,p]),w=(s,x)=>{r(f=>f.map(u=>u.index===s?{...u,open:!0}:{...u,open:!1})),d(x)};return(0,e.jsxs)(l.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:m,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((s,x)=>{const f=Array.isArray(s?.subSubCategories)&&s?.subSubCategories?.length>0;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:(0,N.cn)("flex cursor-pointer items-center justify-between",{"bg-[#F5F5F7]":!f&&c?.find(u=>u.index===x)?.open}),onClick:()=>{k(x,s)},children:[(0,e.jsx)(l.Text,{html:s.label,className:"p-4 text-sm font-bold leading-[1.4]"}),f&&(0,e.jsx)(P.DownArrow,{className:(0,N.cn)("size-4",{"rotate-180":c?.find(u=>u.index===x)?.open})})]}),c?.find(u=>u.index===x)?.open&&(0,e.jsx)("div",{className:"flex flex-col",children:s.subSubCategories?.map((u,i)=>(0,e.jsx)(l.Text,{html:u.label,onClick:()=>w(x,i),className:(0,N.cn)("cursor-pointer hover:bg-[#F5F5F7] px-6 py-4 text-sm font-bold leading-[1.4] text-[#6D6D6F]",{"bg-[#F5F5F7]":b===i})},`subSubItem-${x}-${i}`))})]},`subcategoryItem-${x}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{as:"a",href:`${t?.primary?.url}?ref=${t?.label}_shopall`,variant:"primary",size:"lg",className:"text-sm lg-desktop:text-base",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(l.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"justify-start !p-0 text-sm lg-desktop:text-base",children:t?.secondary?.label})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(v).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(l.Text,{html:v?.label,className:"text-xl lg-desktop:text-2xl font-bold leading-[1.4]"}),v?.primary&&!v?.primary?.hide&&(0,e.jsx)(l.Button,{as:"a",href:`${v?.primary?.url}?ref=${v?.label}_viewmore`,variant:"link",size:"lg",className:"justify-start !p-0 text-sm lg-desktop:text-base font-bold leading-[1.2] no-underline",children:v?.primary?.label})]}),(0,e.jsx)(l.Link,{href:v?.guide?.url,className:"text-sm lg-desktop:text-base leading-[1.2] text-[#6D6D6F]",children:v?.guide?.label})]}),(0,e.jsx)("div",{className:"flex flex-col gap-4 overflow-y-auto h-[426px]",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:v?.series?.map((s,x)=>(0,e.jsxs)("div",{children:[s.label&&(0,e.jsx)(l.Text,{html:s.label,className:"text-sm mb-2 font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!v?.banner&&(0,e.jsx)(l.Link,{asChild:!v?.banner?.href,href:v?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-105 [&_img]:hover:transition-all [&_img]:hover:duration-300",children:[(0,e.jsx)(l.Picture,{source:v?.banner?.imageUrl,className:"h-[114px] laptop:h-[120px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:v?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),(0,e.jsx)(l.Text,{html:v?.banner?.desc||"20.000mAh",className:"text-sm text-white font-bold"})]})]})}),s.products?.map((f,u)=>(0,e.jsx)(Y,{seriesLabel:v?.label,product:f,isCollection:v?.isCollection},`seriesProductItem-${u}`))]})]},`seriesItem-${x}`))})]})]})}),ke=({multicolMetadata:t})=>{const n=(0,a.useRef)(null);return(0,e.jsx)("div",{ref:n,children:(0,e.jsx)(l.Container,{childClassName:"bg-white",className:"h-full",children:(0,e.jsx)("div",{className:"flex gap-4 py-4",children:t?.map((o,c)=>(0,e.jsx)("div",{className:"w-1/4",children:(0,e.jsx)(Z,{item:o})},`multicolItem-${o?.label}-${c}`))})})})},we=({supportsMetadata:t,currentNavItemRef:n})=>{const o=(0,a.useRef)(null),[c,r]=(0,a.useState)(null),[b,d]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(o?.current){const p=o?.current?.getBoundingClientRect();d(p.height)}},[o]);const m=(0,se.debounce)(()=>{if(n){const p=n.getBoundingClientRect();r(p)}},500);return(0,a.useEffect)(()=>(m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}),[m]),(0,a.useEffect)(()=>{if(n){const p=n.getBoundingClientRect();r(p)}},[n]),(0,e.jsx)("div",{className:"absolute top-0 h-full bg-white transition-all duration-500 overflow-hidden",style:{right:`calc(100% - ${c?.right}px)`,height:b},children:(0,e.jsx)("div",{ref:o,className:"p-4",children:t?.map(p=>(0,e.jsx)("div",{className:"py-2",children:(0,e.jsx)(l.Link,{href:p.url,className:"text-sm font-bold leading-[1.4] no-underline",children:p.label})},p.id))})})},Y=({product:t,isCollection:n,position:o,seriesLabel:c})=>{const{buildProps:r,onSeriesProductClick:b}=(0,B.useNavContext)();let d=n?t:r?.products?.find(k=>k.handle===t.handle);const m=d?.variants?.find(k=>k.sku===t.sku)||d?.variants?.[0],p=(0,a.useMemo)(()=>`/products/${d?.handle}?variant=${(0,N.atobID)(m?.id)}`,[d?.handle,m?.id]),v=(0,a.useMemo)(()=>d?.tags?.filter?.(k=>k?.startsWith?.("CLtag"))?.map?.(k=>k?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return m?.availableForSale?(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-105",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)(l.Picture,{source:`${m?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"flex gap-1",children:Array.isArray(v)&&v?.map(k=>(0,e.jsx)(l.Text,{as:"p",html:k,className:"text-brand-0 whitespace-nowrap mb-1 inline-block h-[24px] rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),(0,e.jsx)(l.Link,{href:p,onClick:k=>{k.preventDefault(),window.open(p),b?.(d,o||0,c)},className:"no-underline hover:text-current",children:(0,e.jsx)(l.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:d?.title||t?.name})}),t?.desc&&(0,e.jsx)(l.Text,{as:"p",html:t?.desc,className:"lg-desktop:text-sm line-clamp-1 mt-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]}):null},Z=({item:t,allPicture:n})=>(0,e.jsxs)(e.Fragment,{children:[t?.columns&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col",children:t.columns?.map(o=>(0,e.jsxs)("div",{className:"py-2 flex items-center gap-1",children:[(0,e.jsx)(l.Link,{href:`${o.url}?ref=navMenu`,asChild:!o.url,className:"text-sm font-bold leading-[1.4] no-underline",children:o.label}),o?.badge&&(0,e.jsx)(l.Text,{as:"p",html:o?.badge||"badge",className:"text-sm font-bold !leading-[22px] text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px]"})]},o.label))})]}),t?.imageUrl&&(0,e.jsx)("div",{className:(0,N.cn)("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] h-[240px] max-w-[358px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative overflow-hidden",{"tablet:max-w-none laptop:max-w-none":n}),children:(0,e.jsxs)(l.Link,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[(0,e.jsx)(l.Picture,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[(0,e.jsx)(l.Text,{html:t.title,className:(0,N.cn)("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&(0,e.jsx)(l.Text,{html:t.subtitle,className:(0,N.cn)("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&(0,e.jsx)(l.Button,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:(0,N.cn)("text-sm font-bold mr-auto !p-0 leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Ce=(0,a.forwardRef)(({data:t,className:n,onPrimaryNavClick:o},c)=>{const r=(0,a.useMemo)(()=>(0,H.WithGroupCategory)(t?.categories?.filter(M=>M?.mobileShow)),[t]),{currentMenu:b,setCurrentMenu:d,subSubCategory:m}=(0,B.useNavContext)(),[p,v]=(0,a.useState)(!1),[k,w]=(0,a.useState)(0),[s,x]=(0,a.useState)(null),f=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(f?.current&&p){const M=f?.current?.getBoundingClientRect();w(window?.innerHeight-(M?.bottom||0))}},[p]),(0,K.useGSAP)(()=>{J.gsap.fromTo(f.current,{height:0},{height:k,duration:.3})},[k]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=p?"hidden":"auto"},[p]);const u=(0,a.useMemo)(()=>s?.components?.[0]?.blockType,[s]),i=(0,H.WithSupports)(Le,{categoriesItem:s}),h=(0,H.WithSidebar)(De,s),D=(0,H.WithMulticol)(Me,s),L=(0,a.useMemo)(()=>{switch(u){case y.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(h,{});case y.HeaderNavigationBlockType.Supports:return(0,e.jsx)(i,{});case y.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(D,{});default:return null}},[u,s,i]),C=(0,a.useCallback)(()=>{v(!1),w(0),d&&d(y.HeaderNavigationMenu.Primary)},[v,w,d]),R=(0,a.useMemo)(()=>t?.headerBar?.actions?.filter(M=>M?.mobileShow&&M?.blockType!==y.HeaderNavigationActionBlockType.Profile),[t]),S=(0,a.useMemo)(()=>t?.headerBar?.actions?.find(M=>M?.mobileShow&&M?.blockType===y.HeaderNavigationActionBlockType.Profile)||{},[t]),T=(0,a.useMemo)(()=>{switch(b){case y.HeaderNavigationMenu.Primary:return(0,e.jsx)(ze,{actions:R,menuOpen:p,onMenuOpenClose:()=>{v(!1),w(0)},onMenuOpenClick:()=>v(!0)});case y.HeaderNavigationMenu.Secondary:return(0,e.jsx)(le,{title:s?.text,onMenuOpenClose:C,onMenuBackClick:()=>d?.(y.HeaderNavigationMenu.Primary)});case y.HeaderNavigationMenu.Third:return(0,e.jsx)(le,{title:m?.label,onMenuOpenClose:C,onMenuBackClick:()=>d?.(y.HeaderNavigationMenu.Secondary)});default:return null}},[p,b,d,s,R,m,C]),j=(0,a.useCallback)((M,A)=>{const F=Array.isArray(r)?Array.isArray(r[M])?r[M][A]:{}:{};x(F),F?.components?.[0]?.blockType===y.HeaderNavigationBlockType.Links?F?.components?.[0]?.url&&window.open(F?.components?.[0]?.url):d?.(y.HeaderNavigationMenu.Secondary)},[r,d]);return(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[52px]",n),children:[T,p&&(0,e.jsx)("div",{ref:f,className:"absolute left-0 top-full text-black border-t border-[#E4E5E6] z-[999] w-full overflow-y-auto bg-white",style:{height:k},children:b===y.HeaderNavigationMenu.Primary?(0,e.jsx)(Se,{categories:r,onPrimaryMenuClick:j,onPrimaryNavClick:o,profileAction:S}):L})]})}),Se=({categories:t,onPrimaryMenuClick:n,profileAction:o,onPrimaryNavClick:c})=>(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((r,b)=>(0,e.jsxs)("div",{className:"",children:[r?.map((d,m)=>(0,e.jsx)(W,{label:d.text,onClick:()=>{const v=(t?.flat()||[])?.findIndex(k=>k?.id===t[b][m]?.id);n(b,m),c?.(d,v)},icon:d.components?.[0]?.icon},d.id)),(0,e.jsx)("div",{className:(0,N.cn)("my-2 h-px w-full bg-[#E5E5E7]",{hidden:b===t.length-1})})]},`groupCategory-${b}`))}),(0,e.jsx)(Pe,{profileAction:o})]}),De=({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{currentMenu:o,setCurrentMenu:c,subSubCategory:r,setSubSubCategory:b,setCurrentSeriesMetadata:d,currentSeriesMetadata:m,buildProps:p}=(0,B.useNavContext)(),[v,k]=(0,a.useState)([]),[w,s]=(0,a.useState)([]);(0,a.useEffect)(()=>{t?.subcategories?.length&&k(t?.subcategories?.map((i,h)=>({index:h,open:!1})))},[t]),(0,a.useEffect)(()=>{r?.subSubCategories?.length&&s(r?.subSubCategories?.map((i,h)=>({index:h,open:h===0})))},[r]);const x=(0,a.useCallback)((i,h)=>{c&&c(y.HeaderNavigationMenu.Third),b?.(i);const D=n?.find(L=>h!==void 0?i?.subSubCategories?.[h]?.label?.toLowerCase()===L.label?.toLowerCase():i?.label?.toLowerCase()===L.label?.toLowerCase())||{};if(i?.collections){const L=p?.categories?.[i?.collections]||{};d?.({label:D?.label,isCollection:!0,banner:D?.banner,primary:D?.primary,series:[{products:L?.products}]})}else d?.(D)},[n,t,c,b,d]),f=(0,a.useMemo)(()=>n?.find(i=>!!i?.guide)?.guide,[n,t]);return(0,a.useMemo)(()=>{switch(o){case y.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col justify-between tablet:justify-start tablet:gap-16 p-4",children:[(0,e.jsx)("div",{children:t?.subcategories?.map((i,h)=>(0,e.jsx)("div",{children:(0,e.jsx)(W,{label:i?.label,active:v.find(D=>D.index===h)?.open,onClick:()=>{x(i)}})},`${i.label}-${h}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{as:"a",href:`${t?.primary?.url}?ref=${t?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(l.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case y.HeaderNavigationMenu.Third:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[r?.subSubCategories?r?.subSubCategories?.map((i,h)=>{const D=n?.find(C=>C.label.toLowerCase()===i?.label?.toLowerCase())||{};let L={};if(i?.collections){const C=p?.categories?.[i?.collections]||{};L={label:D?.label,isCollection:!0,banner:D?.banner,primary:D?.primary,series:[{products:C?.products}]}}else L=D;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(i).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:L,onSubSubCategoryItemClick:()=>s(C=>C.map((R,S)=>({...R,open:S===h}))),expanded:!!w?.find(C=>C.index===h)?.open}),w?.find(C=>C.index===h)?.open&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(te,{matchSeriesMetadata:L}),L?.primary&&(0,e.jsx)("div",{className:"text-center my-4",children:(0,e.jsx)(l.Button,{as:"a",href:L?.primary?.url,className:"text-base no-underline leading-[1.2]",variant:"secondary",size:"base",children:L?.primary?.label})})]})]},`${i.label}-${h}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(m).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:m}),(0,e.jsx)(te,{matchSeriesMetadata:m}),m?.primary&&(0,e.jsx)("div",{className:"text-center my-4 ",children:(0,e.jsx)(l.Button,{as:"a",href:`${m?.primary?.url}?ref=${m?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base no-underline leading-[1.2]",children:m?.primary?.label})})]}),f&&(0,e.jsx)(l.Link,{href:f?.url,children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(l.Text,{html:f?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[o,t,c,n,v,w,b,r,d,m])},ee=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:o})=>(0,e.jsxs)("div",{className:"tablet:pt-0 py-4 flex items-center justify-between",onClick:n,children:[t?.label&&(0,e.jsx)(l.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(P.DownArrow,{className:(0,N.cn)("size-5",{"rotate-180":o})})]}),te=({matchSeriesMetadata:t})=>(0,e.jsx)("div",{className:"flex flex-col gap-2 laptop:gap-3",children:!!t?.series?.length&&t?.series?.map((n,o)=>(0,e.jsxs)("div",{children:[n.label&&(0,e.jsx)(l.Text,{html:n.label,className:"text-sm mb-2 font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&(0,e.jsx)(l.Link,{asChild:!t?.banner?.href,href:t?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-105 [&_img]:hover:transition-all [&_img]:hover:duration-300",children:[(0,e.jsx)(l.Picture,{source:t?.banner?.imageUrl,className:"h-[114px] laptop:h-[120px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,N.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(l.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,N.cn)("text-sm text-white font-bold",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((c,r)=>(0,e.jsx)(Y,{position:r,product:c,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${o}-${r}`))]})]},`seriesItem-${o}`))}),Le=({supportsMetadata:t})=>(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(n=>(0,e.jsx)(W,{href:n.url,label:n.label,onClick:()=>{}},n.id))}),Me=({multicolMetadata:t})=>{const n=(0,a.useMemo)(()=>!t?.some(o=>!!o.columns),[t]);return(0,e.jsx)("div",{className:(0,N.cn)("tablet:py-4 tablet:px-8 laptop:px-16 flex flex-col gap-4 tablet:gap-6 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":n}),children:t?.map((o,c)=>(0,e.jsx)("div",{children:(0,e.jsx)(Z,{item:o,allPicture:n})},`multicolItem-${o?.label}-${c}`))})},Pe=({profileAction:t})=>{const[n,o]=(0,a.useState)(!1),{profile:c,event:r}=(0,B.useNavContext)();return(0,e.jsxs)("div",{className:(0,N.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":n}),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",onClick:()=>o(!n),children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(P.User,{})}),(0,e.jsx)(l.Text,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(P.DownArrow,{className:(0,N.cn)("size-5 laptop:size-4",{"rotate-180":n})})]}),c?.email&&(0,e.jsx)("div",{className:"mt-4",children:t?.profiles?.map(b=>(0,e.jsx)(W,{label:b?.title,href:b?.url},b.id))}),n&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(b=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:b.benefitIcon?.url,className:"size-4",alt:b.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:b.benefit,className:"text-sm font-bold leading-[1.4]"})]},b.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>r?.join?.(),children:(0,e.jsx)(l.Text,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>r?.login?.(),children:(0,e.jsx)(l.Text,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},ze=({menuOpen:t,onMenuOpenClose:n,onMenuOpenClick:o,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(ae,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(ne,{actions:c}),t?(0,e.jsx)(P.Close,{className:"size-5",onClick:()=>n()}):(0,e.jsx)(P.Menu,{className:"size-5",onClick:()=>o()})]})]}),ae=()=>{const{payloadData:t,isMobile:n}=(0,B.useNavContext)();return(0,e.jsx)("div",{className:"[&>svg]:w-full hover:text-brand-0 cursor-pointer",onClick:()=>{window.location.href="/"},dangerouslySetInnerHTML:{__html:n?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},ne=(0,a.forwardRef)(({actions:t,activeStatus:n=!1},o)=>{const{event:c}=(0,B.useNavContext)(),[r,b]=(0,a.useState)(null),d=(0,a.useCallback)((m,p)=>{switch(b(p),m?.blockType){case y.HeaderNavigationActionBlockType.Search:c?.search?.();break;case y.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case y.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case y.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((m,p)=>(0,e.jsx)("div",{ref:m.blockType===y.HeaderNavigationActionBlockType.Profile?o:null,onClick:()=>d(m,p),children:(0,e.jsx)(l.Text,{html:m.icon,className:(0,N.cn)("cursor-pointer size-5",{"text-brand-0":n&&r===p})})},m.id))})}),le=({title:t,onMenuOpenClose:n,onMenuBackClick:o})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)(P.LeftArrow,{className:"size-5",onClick:()=>o()}),(0,e.jsx)(l.Text,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)(P.Close,{className:"size-5",onClick:()=>n()})]}),W=({label:t,href:n,onClick:o,active:c,icon:r,className:b})=>(0,e.jsx)("div",{className:(0,N.cn)("flex cursor-pointer items-center justify-between py-4",b),onClick:o,children:(0,e.jsxs)(l.Link,{href:n,asChild:!n,className:"flex w-full items-center justify-between no-underline",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(l.Text,{html:t,className:(0,N.cn)("text-sm font-bold leading-[1.4]",{underline:r})}),r&&(0,e.jsx)(l.Text,{html:r})]}),(0,e.jsx)(P.RightArrow,{className:(0,N.cn)("size-5 laptop:size-4",{"rotate-90":c})})]})});var Ee=(0,oe.withLayout)(he);
1
+ "use strict";"use client";var me=Object.create;var U=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var ge=(t,n)=>{for(var o in n)U(t,o,{get:n[o],enumerable:!0})},X=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of be(n))!ve.call(t,s)&&s!==o&&U(t,s,{get:()=>n[s],enumerable:!(c=pe(n,s))||c.enumerable});return t};var G=(t,n,o)=>(o=t!=null?me(fe(t)):{},X(n||!t||!t.__esModule?U(o,"default",{value:t,enumerable:!0}):o,t)),ye=t=>X(U({},"__esModule",{value:!0}),t);var He={};ge(He,{default:()=>Ee});module.exports=ye(He);var e=require("react/jsx-runtime"),a=G(require("react")),l=require("../../components/index.js"),oe=require("../../shared/Styles.js"),k=require("../../helpers/utils.js"),T=G(require("./NavProvider.js")),x=require("./types.js"),$e=require("react-responsive"),re=require("es-toolkit"),se=G(require("jump.js")),K=require("@gsap/react"),J=require("gsap"),$=require("./withCategory.js"),P=require("./icons/index.js"),ie=G(require("../NavigationSearch/index.js"));const he=(0,a.forwardRef)((t,n)=>{const{data:{headerNavigation:o}={},buildProps:c,event:s,profile:f,theme:m="light",isTop:d=!1,searchResult:p,onSearch:C,isSearching:i,keywords:w,onPrimaryNavClick:N,onSeriesProductClick:v,onSidebarNavClick:g}=t,b=(0,a.useRef)(null),[u,r]=(0,a.useState)(!1),[h,z]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),[L,j]=(0,a.useState)(!1),R=(0,a.useRef)(null),D=()=>{const H=document?.querySelector("body")?.offsetWidth||0;j(H<=1440)};(0,a.useEffect)(()=>(D(),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}),[]),(0,a.useImperativeHandle)(n,()=>R.current),(0,a.useEffect)(()=>{R.current&&d&&(0,se.default)(R.current,{duration:0,offset:R.current?.getBoundingClientRect()?.bottom||0})},[d]),(0,a.useEffect)(()=>{s&&(s.search=()=>r(!0))},[s]),(0,K.useGSAP)(()=>{b?.current&&u&&J.gsap.fromTo(b.current,{height:0},{height:"auto",duration:.3})},[u]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=u?"hidden":"auto"},[u]);const O=(0,a.useMemo)(()=>o?.headerBar?.actions?.find(H=>H?.blockType===x.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[o]);return(0,e.jsx)(T.default,{buildProps:c,profile:f,isMobile:L,event:s,payloadData:o,onSidebarNavClick:g,onSeriesProductClick:v,children:(0,e.jsx)("header",{"data-ui-component-id":"HeaderNavigation",className:"relative z-[100]",ref:R,children:(0,e.jsxs)("div",{className:(0,k.cn)("hover:text-black hover:bg-white",m==="light"?"text-black":"text-white",{}),onClick:()=>M(!0),children:[(0,e.jsx)(xe,{data:o,className:"hidden desktop:block",theme:m,onNavItemClick:()=>M(!0),onPrimaryNavClick:N}),(0,e.jsx)(Ce,{data:o,className:"block desktop:hidden",onPrimaryNavClick:N}),u&&(0,e.jsxs)("div",{className:"absolute z-[60] top-0 left-0 w-full bg-black/70 flex flex-col",style:{height:`calc(100dvh - ${R?.current?.getBoundingClientRect()?.top}px)`},children:[(0,e.jsx)("div",{ref:b,className:(0,k.cn)("overflow-y-auto",{}),children:(0,e.jsx)(ie.default,{data:O,keywords:w,isSearching:i,searchResult:p,onSearch:H=>{C?.(H)},onClose:()=>{C?.(),r(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>r(!1)})]})]})})})}),xe=(0,a.forwardRef)((t,n)=>{const{data:o,onNavItemClick:c,className:s,theme:f,onPrimaryNavClick:m}=t,{event:d,profile:p}=(0,T.useNavContext)(),[C,i]=(0,a.useState)(!1),w=(0,a.useMemo)(()=>(0,$.WithGroupCategory)(o?.categories?.filter(y=>y?.pcShow)),[o]),[N,v]=(0,a.useState)(null),[g,b]=(0,a.useState)([]),u=(0,a.useRef)(null),[r,h]=(0,a.useState)(!1),z=(0,a.useRef)(null),S=(0,a.useRef)(null),M=(0,a.useRef)(w.map(y=>Array(y?.length||0).fill(null)));(0,a.useEffect)(()=>{w?.length&&b(w?.map((y,E)=>y?.map((B,A)=>({groupIndex:E,index:A,open:!1}))))},[w]);const L=(0,a.useMemo)(()=>{let y=null;for(const E of g){for(const B of E)if(B.open){y=B;break}if(y)break}return y},[g]);(0,a.useEffect)(()=>{document.documentElement.style.overflow=L?.open||r?"hidden":"auto"},[L?.open,r]);const j=(y,E,B)=>{if(h(!1),N?.components?.[0]?.blockType===x.HeaderNavigationBlockType.Links)N?.components?.[0]?.url&&window.open(N?.components?.[0]?.url);else{const A=w?.flat()||[],_=A?.findIndex(Q=>Q?.id===w[E][B]?.id);y.stopPropagation(),c?.(),m?.(A[_],_),v(w[E][B]),b(Q=>Q.map(ue=>ue.map(I=>I.groupIndex===E&&I.index===B?{...I,open:!I.open}:{...I,open:!1})))}},R=()=>{b(y=>y.map(E=>E.map(B=>({...B,open:!1}))))},D=(0,a.useMemo)(()=>{if(N)return N?.components?.[0]?.blockType},[N]),O=(0,$.WithSidebar)(Ne,N),H=(0,$.WithMulticol)(ke,N),ce=(0,$.WithSupports)(we,{categoriesItem:N,currentNavItemRef:M.current?.[L?.groupIndex||0]?.[L?.index||0]}),de=(0,a.useMemo)(()=>{switch(D){case x.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(O,{});case x.HeaderNavigationBlockType.Supports:return(0,e.jsx)(ce,{});case x.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(H,{});default:return null}},[D,N]),V=(0,a.useMemo)(()=>o?.headerBar?.actions?.filter(y=>y?.pcShow),[o]),F=(0,a.useMemo)(()=>V?.find(y=>y?.blockType===x.HeaderNavigationActionBlockType.Profile),[V]),q=(0,a.useCallback)(()=>{h(y=>!y)},[]);return(0,a.useEffect)(()=>{if(u?.current){const y=u.current;return y.addEventListener("click",q),()=>{y.removeEventListener("click",q)}}},[q]),(0,K.useGSAP)(()=>{L?.open&&J.gsap.fromTo(S?.current,{height:0},{height:"auto"})},[L?.open]),(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[96px]",s),children:[(0,e.jsxs)("div",{ref:z,onClick:R,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(ae,{}),(0,e.jsx)(ne,{ref:u,actions:V,activeStatus:r})]}),(0,e.jsx)("div",{className:"flex justify-between",children:w?.map((y,E)=>(0,e.jsx)("div",{className:"flex gap-3",children:y?.map((B,A)=>(0,e.jsx)("div",{ref:_=>{M.current[E][A]=_},className:"group cursor-pointer",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 pb-4",onClick:_=>j(_,E,A),children:[(0,e.jsx)(l.Text,{html:B.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(P.DownArrow,{className:(0,k.cn)("opacity-0 size-4 group-hover:opacity-100 transition-opacity duration-500",{"rotate-180":L?.groupIndex===E&&L?.index===A,"opacity-100":C&&L?.groupIndex===E&&L?.index===A})})]}),(0,e.jsx)("div",{className:(0,k.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":L?.groupIndex===E&&L?.index===A},f==="dark"?"bg-white":"bg-[#1D1D1F]")})]})},B.id))},`groupCategory-${E}`))})]}),(0,e.jsxs)("div",{className:(0,k.cn)("border-t border-b-[#E4E5E6] text-black absolute left-0 top-full z-[999] flex w-full flex-col bg-black/70 overflow-hidden",{hidden:!(L?.open&&N)}),onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{height:`calc(100dvh - ${z?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:S,className:(0,k.cn)("relative z-50",{"overflow-hidden":D!==x.HeaderNavigationBlockType.Supports}),children:de}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:R})]}),r&&(0,e.jsxs)("div",{className:"absolute left-0 z-[999] flex w-full bg-black/70 h-[100dvh] top-full",children:[(0,e.jsx)("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${u?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:p?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:p?.nick_name||F?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"h-[1px] mt-2 bg-[#D9D9D9]"}),(0,e.jsx)("div",{className:"mt-2",children:F?.profiles?.map(y=>(0,e.jsx)(W,{className:"py-2",label:y?.title,href:y?.url},y.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(P.Polygon,{className:"absolute -top-2 text-white right-[46px] z-30"}),(0,e.jsx)(l.Text,{html:F?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:F?.benefits?.map(y=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:y.benefitIcon?.url,className:"size-4",alt:y.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:y.benefit,className:"text-sm font-bold leading-[1.4]"})]},y.id))}),(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,e.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>d?.join?.(),children:(0,e.jsx)(l.Text,{html:F?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>d?.login?.(),children:(0,e.jsx)(l.Text,{html:F?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>h(!1)})]})]})}),Ne=a.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{buildProps:o,onSidebarNavClick:c}=(0,T.useNavContext)(),[s,f]=(0,a.useState)([]),[m,d]=(0,a.useState)(-1),p=(0,a.useRef)(null),C=(0,a.useCallback)(()=>{const v=t?.subcategories;if(!v?.length)return;const g=v.findIndex(r=>!!r?.subSubCategories),b=v.findIndex(r=>!r?.subSubCategories),u=v.map((r,h)=>({index:h,open:g===h||b===h}));f(u)},[t]);(0,a.useEffect)(()=>{C()},[C]);const i=(0,a.useMemo)(()=>{const v=t?.subcategories?.[s?.find(b=>b.open)?.index||0],g=n?.find(b=>b?.label?.toLowerCase()===v?.label?.toLowerCase())||{};if(v?.collections){const b=o?.categories?.[v?.collections]||{};return{label:g?.label,isCollection:!0,banner:g?.banner,primary:g?.primary,series:[{products:b?.products}]}}else if(v?.subSubCategories){const b=v?.subSubCategories?.[m],u=n?.find(r=>r?.label?.toLowerCase()===b?.label?.toLowerCase())||{};if(b?.collections){const r=o?.categories?.[b?.collections]||{};return{label:u?.label,isCollection:!0,banner:u?.banner,primary:u?.primary,series:[{products:r?.products}]}}else return u}else return g},[t,s,m,n]),w=(0,a.useCallback)((v,g)=>{if(g?.subSubCategories?.length>0?d(0):d(-1),g?.subSubCategories?.length>0)f(b=>b.map(u=>u.index===v?{...u,open:!0}:{...u,open:!1}));else{const u=t?.subcategories?.findIndex(r=>!!r?.subSubCategories);f(r=>r.map(h=>({...h,open:h.index===v||h.index===u})))}},[t,C]),N=(v,g)=>{f(b=>b.map(u=>u.index===v?{...u,open:!0}:{...u,open:!1})),d(g)};return(0,e.jsxs)(l.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:p,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((v,g)=>{const b=Array.isArray(v?.subSubCategories)&&v?.subSubCategories?.length>0;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:(0,k.cn)("flex cursor-pointer items-center justify-between",{"bg-[#F5F5F7]":!b&&s?.find(u=>u.index===g)?.open}),onClick:()=>{w(g,v),c?.(v,g)},children:[(0,e.jsx)(l.Text,{html:v.label,className:"p-4 text-sm font-bold leading-[1.4]"}),b&&(0,e.jsx)(P.DownArrow,{className:(0,k.cn)("size-4",{"rotate-180":s?.find(u=>u.index===g)?.open})})]}),s?.find(u=>u.index===g)?.open&&(0,e.jsx)("div",{className:"flex flex-col",children:v.subSubCategories?.map((u,r)=>(0,e.jsx)(l.Text,{html:u.label,onClick:()=>{N(g,r),c?.(u,r)},className:(0,k.cn)("cursor-pointer hover:bg-[#F5F5F7] px-6 py-4 text-sm font-bold leading-[1.4] text-[#6D6D6F]",{"bg-[#F5F5F7]":m===r})},`subSubItem-${g}-${r}`))})]},`subcategoryItem-${g}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"text-sm lg-desktop:text-base",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(l.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"justify-start !p-0 text-sm lg-desktop:text-base",children:t?.secondary?.label})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(i).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(l.Text,{html:i?.label,className:"text-xl lg-desktop:text-2xl font-bold leading-[1.4]"}),i?.primary&&!i?.primary?.hide&&(0,e.jsx)(l.Button,{as:"a",href:`${i?.primary?.url}?ref=${i?.label}_viewmore`,variant:"link",size:"lg",className:"justify-start !p-0 text-sm lg-desktop:text-base font-bold leading-[1.2] no-underline",children:i?.primary?.label})]}),(0,e.jsx)(l.Link,{href:i?.guide?.url,className:"text-sm lg-desktop:text-base leading-[1.2] text-[#6D6D6F]",children:i?.guide?.label})]}),(0,e.jsx)("div",{className:"flex flex-col gap-4 overflow-y-auto h-[426px]",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:i?.series?.map((v,g)=>(0,e.jsxs)("div",{children:[v.label&&(0,e.jsx)(l.Text,{html:v.label,className:"text-sm mb-2 font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!i?.banner&&(0,e.jsx)(l.Link,{asChild:!i?.banner?.href,href:i?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-105 [&_img]:hover:transition-all [&_img]:hover:duration-300",children:[(0,e.jsx)(l.Picture,{source:i?.banner?.imageUrl,className:"h-[114px] laptop:h-[120px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:i?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),(0,e.jsx)(l.Text,{html:i?.banner?.desc||"20.000mAh",className:"text-sm text-white font-bold"})]})]})}),v.products?.map((b,u)=>(0,e.jsx)(Y,{seriesLabel:i?.label,product:b,isCollection:i?.isCollection},`seriesProductItem-${u}`))]})]},`seriesItem-${g}`))})]})]})}),ke=({multicolMetadata:t})=>{const n=(0,a.useRef)(null);return(0,e.jsx)("div",{ref:n,children:(0,e.jsx)(l.Container,{childClassName:"bg-white",className:"h-full",children:(0,e.jsx)("div",{className:"flex gap-4 py-4",children:t?.map((o,c)=>(0,e.jsx)("div",{className:"w-1/4",children:(0,e.jsx)(Z,{item:o})},`multicolItem-${o?.label}-${c}`))})})})},we=({supportsMetadata:t,currentNavItemRef:n})=>{const o=(0,a.useRef)(null),[c,s]=(0,a.useState)(null),[f,m]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(o?.current){const p=o?.current?.getBoundingClientRect();m(p.height)}},[o]);const d=(0,re.debounce)(()=>{if(n){const p=n.getBoundingClientRect();s(p)}},500);return(0,a.useEffect)(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[d]),(0,a.useEffect)(()=>{if(n){const p=n.getBoundingClientRect();s(p)}},[n]),(0,e.jsx)("div",{className:"absolute top-0 h-full bg-white transition-all duration-500 overflow-hidden",style:{right:`calc(100% - ${c?.right}px)`,height:f},children:(0,e.jsx)("div",{ref:o,className:"p-4",children:t?.map(p=>(0,e.jsx)("div",{className:"py-2",children:(0,e.jsx)(l.Link,{href:p.url,className:"text-sm font-bold leading-[1.4] no-underline",children:p.label})},p.id))})})},Y=({product:t,isCollection:n,position:o,seriesLabel:c})=>{const{buildProps:s,onSeriesProductClick:f}=(0,T.useNavContext)();let m=n?t:s?.products?.find(i=>i.handle===t.handle);const d=m?.variants?.find(i=>i.sku===t.sku)||m?.variants?.[0],p=(0,a.useMemo)(()=>`/products/${m?.handle}?variant=${(0,k.atobID)(d?.id)}`,[m?.handle,d?.id]),C=(0,a.useMemo)(()=>m?.tags?.filter?.(i=>i?.startsWith?.("CLtag"))?.map?.(i=>i?.replace?.("CLtag:",""))?.slice?.(0,2),[m?.tags]);return d?.availableForSale?(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-105",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)(l.Picture,{source:`${d?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"flex gap-1",children:Array.isArray(C)&&C?.map(i=>(0,e.jsx)(l.Text,{as:"p",html:i,className:"text-brand-0 whitespace-nowrap mb-1 inline-block h-[24px] rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),(0,e.jsx)(l.Link,{href:p,onClick:i=>{i.preventDefault(),window.open(p),f?.(m,o||0,c)},className:"no-underline hover:text-current",children:(0,e.jsx)(l.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:m?.title||t?.name})}),t?.desc&&(0,e.jsx)(l.Text,{as:"p",html:t?.desc,className:"lg-desktop:text-sm line-clamp-1 mt-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]}):null},Z=({item:t,allPicture:n})=>(0,e.jsxs)(e.Fragment,{children:[t?.columns&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col",children:t.columns?.map(o=>(0,e.jsxs)("div",{className:"py-2 flex items-center gap-1",children:[(0,e.jsx)(l.Link,{href:`${o.url}?ref=navMenu`,asChild:!o.url,className:"text-sm font-bold leading-[1.4] no-underline",children:o.label}),o?.badge&&(0,e.jsx)(l.Text,{as:"p",html:o?.badge||"badge",className:"text-sm font-bold !leading-[22px] text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px]"})]},o.label))})]}),t?.imageUrl&&(0,e.jsx)("div",{className:(0,k.cn)("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] h-[240px] max-w-[358px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative overflow-hidden",{"tablet:max-w-none laptop:max-w-none":n}),children:(0,e.jsxs)(l.Link,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[(0,e.jsx)(l.Picture,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[(0,e.jsx)(l.Text,{html:t.title,className:(0,k.cn)("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&(0,e.jsx)(l.Text,{html:t.subtitle,className:(0,k.cn)("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&(0,e.jsx)(l.Button,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:(0,k.cn)("text-sm font-bold mr-auto !p-0 leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Ce=(0,a.forwardRef)(({data:t,className:n,onPrimaryNavClick:o},c)=>{const s=(0,a.useMemo)(()=>(0,$.WithGroupCategory)(t?.categories?.filter(D=>D?.mobileShow)),[t]),{currentMenu:f,setCurrentMenu:m,subSubCategory:d}=(0,T.useNavContext)(),[p,C]=(0,a.useState)(!1),[i,w]=(0,a.useState)(0),[N,v]=(0,a.useState)(null),g=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(g?.current&&p){const D=g?.current?.getBoundingClientRect();w(window?.innerHeight-(D?.bottom||0))}},[p]),(0,K.useGSAP)(()=>{J.gsap.fromTo(g.current,{height:0},{height:i,duration:.3})},[i]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=p?"hidden":"auto"},[p]);const b=(0,a.useMemo)(()=>N?.components?.[0]?.blockType,[N]),u=(0,$.WithSupports)(Le,{categoriesItem:N}),r=(0,$.WithSidebar)(De,N),h=(0,$.WithMulticol)(Me,N),z=(0,a.useMemo)(()=>{switch(b){case x.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(r,{});case x.HeaderNavigationBlockType.Supports:return(0,e.jsx)(u,{});case x.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(h,{});default:return null}},[b,N,u]),S=(0,a.useCallback)(()=>{C(!1),w(0),m&&m(x.HeaderNavigationMenu.Primary)},[C,w,m]),M=(0,a.useMemo)(()=>t?.headerBar?.actions?.filter(D=>D?.mobileShow&&D?.blockType!==x.HeaderNavigationActionBlockType.Profile),[t]),L=(0,a.useMemo)(()=>t?.headerBar?.actions?.find(D=>D?.mobileShow&&D?.blockType===x.HeaderNavigationActionBlockType.Profile)||{},[t]),j=(0,a.useMemo)(()=>{switch(f){case x.HeaderNavigationMenu.Primary:return(0,e.jsx)(ze,{actions:M,menuOpen:p,onMenuOpenClose:()=>{C(!1),w(0)},onMenuOpenClick:()=>C(!0)});case x.HeaderNavigationMenu.Secondary:return(0,e.jsx)(le,{title:N?.text,onMenuOpenClose:S,onMenuBackClick:()=>m?.(x.HeaderNavigationMenu.Primary)});case x.HeaderNavigationMenu.Third:return(0,e.jsx)(le,{title:d?.label,onMenuOpenClose:S,onMenuBackClick:()=>m?.(x.HeaderNavigationMenu.Secondary)});default:return null}},[p,f,m,N,M,d,S]),R=(0,a.useCallback)((D,O)=>{const H=Array.isArray(s)?Array.isArray(s[D])?s[D][O]:{}:{};v(H),H?.components?.[0]?.blockType===x.HeaderNavigationBlockType.Links?H?.components?.[0]?.url&&window.open(H?.components?.[0]?.url):m?.(x.HeaderNavigationMenu.Secondary)},[s,m]);return(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[52px]",n),children:[j,p&&(0,e.jsx)("div",{ref:g,className:"absolute left-0 top-full text-black border-t border-[#E4E5E6] z-[999] w-full overflow-y-auto bg-white",style:{height:i},children:f===x.HeaderNavigationMenu.Primary?(0,e.jsx)(Se,{categories:s,onPrimaryMenuClick:R,onPrimaryNavClick:o,profileAction:L}):z})]})}),Se=({categories:t,onPrimaryMenuClick:n,profileAction:o,onPrimaryNavClick:c})=>{const{onSidebarNavClick:s}=(0,T.useNavContext)();return(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((f,m)=>(0,e.jsxs)("div",{className:"",children:[f?.map((d,p)=>(0,e.jsx)(W,{label:d.text,onClick:()=>{const i=(t?.flat()||[])?.findIndex(w=>w?.id===t[m][p]?.id);n(m,p),c?.(d,i)},icon:d.components?.[0]?.icon},d.id)),(0,e.jsx)("div",{className:(0,k.cn)("my-2 h-px w-full bg-[#E5E5E7]",{hidden:m===t.length-1})})]},`groupCategory-${m}`))}),(0,e.jsx)(Pe,{profileAction:o})]})},De=({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{currentMenu:o,setCurrentMenu:c,subSubCategory:s,setSubSubCategory:f,setCurrentSeriesMetadata:m,currentSeriesMetadata:d,buildProps:p,onSidebarNavClick:C}=(0,T.useNavContext)(),[i,w]=(0,a.useState)([]),[N,v]=(0,a.useState)([]);(0,a.useEffect)(()=>{t?.subcategories?.length&&w(t?.subcategories?.map((r,h)=>({index:h,open:!1})))},[t]),(0,a.useEffect)(()=>{s?.subSubCategories?.length&&v(s?.subSubCategories?.map((r,h)=>({index:h,open:h===0})))},[s]);const g=(0,a.useCallback)((r,h)=>{c&&c(x.HeaderNavigationMenu.Third),f?.(r);const z=n?.find(S=>h!==void 0?r?.subSubCategories?.[h]?.label?.toLowerCase()===S.label?.toLowerCase():r?.label?.toLowerCase()===S.label?.toLowerCase())||{};if(r?.collections){const S=p?.categories?.[r?.collections]||{};m?.({label:z?.label,isCollection:!0,banner:z?.banner,primary:z?.primary,series:[{products:S?.products}]})}else m?.(z)},[n,t,c,f,m]),b=(0,a.useMemo)(()=>n?.find(r=>!!r?.guide)?.guide,[n,t]);return(0,a.useMemo)(()=>{switch(o){case x.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col justify-between tablet:justify-start tablet:gap-16 p-4",children:[(0,e.jsx)("div",{children:t?.subcategories?.map((r,h)=>(0,e.jsx)("div",{children:(0,e.jsx)(W,{label:r?.label,active:i.find(z=>z.index===h)?.open,onClick:()=>{g(r),C?.(r,h)}})},`${r.label}-${h}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(l.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case x.HeaderNavigationMenu.Third:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[s?.subSubCategories?s?.subSubCategories?.map((r,h)=>{const z=n?.find(M=>M.label.toLowerCase()===r?.label?.toLowerCase())||{};let S={};if(r?.collections){const M=p?.categories?.[r?.collections]||{};S={label:z?.label,isCollection:!0,banner:z?.banner,primary:z?.primary,series:[{products:M?.products}]}}else S=z;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(r).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:S,onSubSubCategoryItemClick:()=>{C?.(r,h),v(M=>M.map((L,j)=>({...L,open:j===h})))},expanded:!!N?.find(M=>M.index===h)?.open}),N?.find(M=>M.index===h)?.open&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(te,{matchSeriesMetadata:S}),S?.primary&&(0,e.jsx)("div",{className:"text-center my-4",children:(0,e.jsx)(l.Button,{as:"a",href:S?.primary?.url,className:"text-base no-underline leading-[1.2]",variant:"secondary",size:"base",children:S?.primary?.label})})]})]},`${r.label}-${h}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(d).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:d}),(0,e.jsx)(te,{matchSeriesMetadata:d}),d?.primary&&(0,e.jsx)("div",{className:"text-center my-4 ",children:(0,e.jsx)(l.Button,{as:"a",href:`${d?.primary?.url}?ref=${d?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base no-underline leading-[1.2]",children:d?.primary?.label})})]}),b&&(0,e.jsx)(l.Link,{href:b?.url,children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(l.Text,{html:b?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[o,t,c,n,i,N,f,s,m,d])},ee=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:o})=>(0,e.jsxs)("div",{className:"tablet:pt-0 py-4 flex items-center justify-between",onClick:n,children:[t?.label&&(0,e.jsx)(l.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(P.DownArrow,{className:(0,k.cn)("size-5",{"rotate-180":o})})]}),te=({matchSeriesMetadata:t})=>(0,e.jsx)("div",{className:"flex flex-col gap-2 laptop:gap-3",children:!!t?.series?.length&&t?.series?.map((n,o)=>(0,e.jsxs)("div",{children:[n.label&&(0,e.jsx)(l.Text,{html:n.label,className:"text-sm mb-2 font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&(0,e.jsx)(l.Link,{asChild:!t?.banner?.href,href:t?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-105 [&_img]:hover:transition-all [&_img]:hover:duration-300",children:[(0,e.jsx)(l.Picture,{source:t?.banner?.imageUrl,className:"h-[114px] laptop:h-[120px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,k.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(l.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,k.cn)("text-sm text-white font-bold",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((c,s)=>(0,e.jsx)(Y,{position:s,product:c,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${o}-${s}`))]})]},`seriesItem-${o}`))}),Le=({supportsMetadata:t})=>(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(n=>(0,e.jsx)(W,{href:n.url,label:n.label,onClick:()=>{}},n.id))}),Me=({multicolMetadata:t})=>{const n=(0,a.useMemo)(()=>!t?.some(o=>!!o.columns),[t]);return(0,e.jsx)("div",{className:(0,k.cn)("tablet:py-4 tablet:px-8 laptop:px-16 flex flex-col gap-4 tablet:gap-6 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":n}),children:t?.map((o,c)=>(0,e.jsx)("div",{children:(0,e.jsx)(Z,{item:o,allPicture:n})},`multicolItem-${o?.label}-${c}`))})},Pe=({profileAction:t})=>{const[n,o]=(0,a.useState)(!1),{profile:c,event:s}=(0,T.useNavContext)();return(0,e.jsxs)("div",{className:(0,k.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":n}),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",onClick:()=>o(!n),children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(P.User,{})}),(0,e.jsx)(l.Text,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(P.DownArrow,{className:(0,k.cn)("size-5 laptop:size-4",{"rotate-180":n})})]}),c?.email&&(0,e.jsx)("div",{className:"mt-4",children:t?.profiles?.map(f=>(0,e.jsx)(W,{label:f?.title,href:f?.url},f.id))}),n&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(f=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:f.benefitIcon?.url,className:"size-4",alt:f.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:f.benefit,className:"text-sm font-bold leading-[1.4]"})]},f.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>s?.join?.(),children:(0,e.jsx)(l.Text,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>s?.login?.(),children:(0,e.jsx)(l.Text,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},ze=({menuOpen:t,onMenuOpenClose:n,onMenuOpenClick:o,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(ae,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(ne,{actions:c}),t?(0,e.jsx)(P.Close,{className:"size-5",onClick:()=>n()}):(0,e.jsx)(P.Menu,{className:"size-5",onClick:()=>o()})]})]}),ae=()=>{const{payloadData:t,isMobile:n}=(0,T.useNavContext)();return(0,e.jsx)("div",{className:"[&>svg]:w-full hover:text-brand-0 cursor-pointer",onClick:()=>{window.location.href="/"},dangerouslySetInnerHTML:{__html:n?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},ne=(0,a.forwardRef)(({actions:t,activeStatus:n=!1},o)=>{const{event:c}=(0,T.useNavContext)(),[s,f]=(0,a.useState)(null),m=(0,a.useCallback)((d,p)=>{switch(f(p),d?.blockType){case x.HeaderNavigationActionBlockType.Search:c?.search?.();break;case x.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case x.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case x.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((d,p)=>(0,e.jsx)("div",{ref:d.blockType===x.HeaderNavigationActionBlockType.Profile?o:null,onClick:()=>m(d,p),children:(0,e.jsx)(l.Text,{html:d.icon,className:(0,k.cn)("cursor-pointer size-5",{"text-brand-0":n&&s===p})})},d.id))})}),le=({title:t,onMenuOpenClose:n,onMenuBackClick:o})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)(P.LeftArrow,{className:"size-5",onClick:()=>o()}),(0,e.jsx)(l.Text,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)(P.Close,{className:"size-5",onClick:()=>n()})]}),W=({label:t,href:n,onClick:o,active:c,icon:s,className:f})=>(0,e.jsx)("div",{className:(0,k.cn)("flex cursor-pointer items-center justify-between py-4",f),onClick:o,children:(0,e.jsxs)(l.Link,{href:n,asChild:!n,className:"flex w-full items-center justify-between no-underline",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(l.Text,{html:t,className:(0,k.cn)("text-sm font-bold leading-[1.4]",{underline:s})}),s&&(0,e.jsx)(l.Text,{html:s})]}),(0,e.jsx)(P.RightArrow,{className:(0,k.cn)("size-5 laptop:size-4",{"rotate-90":c})})]})});var Ee=(0,oe.withLayout)(he);
2
2
  //# sourceMappingURL=index.js.map