@anker-in/headless-ui 1.0.20-alpha.1761539003176 → 1.0.20-alpha.1761550525400

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.
@@ -24,7 +24,7 @@ interface NavContextType {
24
24
  setCurrentSeriesMetadata?: (metadata: any) => void;
25
25
  subSubCategory?: any;
26
26
  setSubSubCategory?: (category: any) => void;
27
- onSeriesProductClick?: (seriesProduct: any, position: number) => void;
27
+ onSeriesProductClick?: (seriesProduct: any, position: number, seriesLabel?: string) => void;
28
28
  }
29
29
  export declare const NavContext: React.Context<NavContextType>;
30
30
  export declare const useNavContext: () => NavContextType;
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var a in e)s(t,a,{get:e[a],enumerable:!0})},N=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of _(e))!T.call(t,n)&&n!==a&&s(t,n,{get:()=>e[n],enumerable:!(o=E(e,n))||o.enumerable});return t};var R=t=>N(s({},"__esModule",{value:!0}),t);var m={};l(m,{NavContext:()=>i,default:()=>b,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)=>{}},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}}},U=({children:t,...e})=>{const[a,o]=(0,r.useReducer)(P,{...v,currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{}}),n=(0,r.useCallback)(u=>o({type:"SET_CURRENT_MENU",value:u}),[o]),d=(0,r.useCallback)(u=>o({type:"SET_CURRENT_SERIES_METADATA",value:u}),[o]),C=(0,r.useCallback)(u=>o({type:"SET_SUB_SUB_CATEGORY",value:u}),[o]),S=(0,r.useCallback)(u=>o({type:"SET_ON_SERIES_PRODUCT_CLICK",value:u}),[o]),y=(0,r.useMemo)(()=>({...a,setCurrentMenu:n,setCurrentSeriesMetadata:d,setSubSubCategory:C,setOnSeriesProductClick:S}),[n,d,C,S,a]);return(0,p.jsx)(i.Provider,{value:{...y,...e},children:t})};var b=U;
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;
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) => 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) => {},\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,IAAqB,CAAC,CACnE,EAoBaT,KAAa,iBAA8BO,CAAY,EAEvDL,EAAgB,IAAM,CAEjC,GAAI,IADY,cAAWF,CAAU,EAEnC,MAAM,IAAI,MAAM,6CAA6C,EAE/D,SAAO,cAAWA,CAAU,CAC9B,EAEMU,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,GAAGH,EACH,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,CACzB,CAAC,EAEKU,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,OAACX,EAAW,SAAX,CAAoB,MAAO,CAAE,GAAGkB,EAAO,GAAGH,CAAK,EAAI,SAAAD,EAAS,CACtE,EAEA,IAAOb,EAAQY",
6
- "names": ["NavProvider_exports", "__export", "NavContext", "NavProvider_default", "useNavContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_types", "initialState", "seriesProduct", "position", "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}\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"]
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"),Re=require("react-responsive"),se=require("es-toolkit"),re=G(require("jump.js")),K=require("@gsap/react"),J=require("gsap"),H=require("./withCategory.js"),L=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:d,theme:f="light",isTop:v=!1,searchResult:p,onSearch:u,isSearching:z,keywords:k,onPrimaryNavClick:s,onSeriesProductClick:x}=t,b=(0,a.useRef)(null),[m,i]=(0,a.useState)(!1),[h,S]=(0,a.useState)(!1),[D,w]=(0,a.useState)(!1),[A,C]=(0,a.useState)(!1),T=(0,a.useRef)(null),j=()=>{const $=document?.querySelector("body")?.offsetWidth||0;C($<=1440)};(0,a.useEffect)(()=>(j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}),[]),(0,a.useImperativeHandle)(n,()=>T.current),(0,a.useEffect)(()=>{T.current&&v&&(0,re.default)(T.current,{duration:0,offset:T.current?.getBoundingClientRect()?.bottom||0})},[v]),(0,a.useEffect)(()=>{r&&(r.search=()=>i(!0))},[r]),(0,K.useGSAP)(()=>{b?.current&&m&&J.gsap.fromTo(b.current,{height:0},{height:"auto",duration:.3})},[m]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=m?"hidden":"auto"},[m]);const M=(0,a.useMemo)(()=>o?.headerBar?.actions?.find($=>$?.blockType===y.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[o]);return(0,e.jsx)(B.default,{buildProps:c,profile:d,isMobile:A,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",f==="light"?"text-black":"text-white",{}),onClick:()=>w(!0),children:[(0,e.jsx)(xe,{data:o,className:"hidden desktop:block",theme:f,onNavItemClick:()=>w(!0),onPrimaryNavClick:s}),(0,e.jsx)(Ce,{data:o,className:"block desktop:hidden",onPrimaryNavClick:s}),m&&(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:b,className:(0,N.cn)("overflow-y-auto",{}),children:(0,e.jsx)(ie.default,{data:M,keywords:k,isSearching:z,searchResult:p,onSearch:$=>{u?.($)},onClose:()=>{u?.(),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:d,onPrimaryNavClick:f}=t,{event:v,profile:p}=(0,B.useNavContext)(),[u,z]=(0,a.useState)(!1),k=(0,a.useMemo)(()=>(0,H.WithGroupCategory)(o?.categories?.filter(g=>g?.pcShow)),[o]),[s,x]=(0,a.useState)(null),[b,m]=(0,a.useState)([]),i=(0,a.useRef)(null),[h,S]=(0,a.useState)(!1),D=(0,a.useRef)(null),w=(0,a.useRef)(null),A=(0,a.useRef)(k.map(g=>Array(g?.length||0).fill(null)));(0,a.useEffect)(()=>{k?.length&&m(k?.map((g,P)=>g?.map((E,R)=>({groupIndex:P,index:R,open:!1}))))},[k]);const C=(0,a.useMemo)(()=>{let g=null;for(const P of b){for(const E of P)if(E.open){g=E;break}if(g)break}return g},[b]);(0,a.useEffect)(()=>{document.documentElement.style.overflow=C?.open||h?"hidden":"auto"},[C?.open,h]);const T=(g,P,E)=>{if(S(!1),s?.components?.[0]?.blockType===y.HeaderNavigationBlockType.Links)s?.components?.[0]?.url&&window.open(s?.components?.[0]?.url);else{const R=k?.flat()||[],I=R?.findIndex(Q=>Q?.id===k[P][E]?.id);g.stopPropagation(),c?.(),f?.(R[I],I),x(k[P][E]),m(Q=>Q.map(ue=>ue.map(_=>_.groupIndex===P&&_.index===E?{..._,open:!_.open}:{..._,open:!1})))}},j=()=>{m(g=>g.map(P=>P.map(E=>({...E,open:!1}))))},M=(0,a.useMemo)(()=>{if(s)return s?.components?.[0]?.blockType},[s]),$=(0,H.WithSidebar)(Ne,s),F=(0,H.WithMulticol)(ke,s),ce=(0,H.WithSupports)(we,{categoriesItem:s,currentNavItemRef:A.current?.[C?.groupIndex||0]?.[C?.index||0]}),de=(0,a.useMemo)(()=>{switch(M){case y.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)($,{});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]),O=(0,a.useMemo)(()=>V?.find(g=>g?.blockType===y.HeaderNavigationActionBlockType.Profile),[V]),q=(0,a.useCallback)(()=>{S(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)(()=>{C?.open&&J.gsap.fromTo(w?.current,{height:0},{height:"auto"})},[C?.open]),(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[96px]",r),children:[(0,e.jsxs)("div",{ref:D,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:k?.map((g,P)=>(0,e.jsx)("div",{className:"flex gap-3",children:g?.map((E,R)=>(0,e.jsx)("div",{ref:I=>{A.current[P][R]=I},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:I=>T(I,P,R),children:[(0,e.jsx)(l.Text,{html:E.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(L.DownArrow,{className:(0,N.cn)("opacity-0 size-4 group-hover:opacity-100 transition-opacity duration-500",{"rotate-180":C?.groupIndex===P&&C?.index===R,"opacity-100":u&&C?.groupIndex===P&&C?.index===R})})]}),(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)]":C?.groupIndex===P&&C?.index===R},d==="dark"?"bg-white":"bg-[#1D1D1F]")})]})},E.id))},`groupCategory-${P}`))})]}),(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:!(C?.open&&s)}),onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),style:{height:`calc(100dvh - ${D?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:w,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||O?.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:O?.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)(L.Polygon,{className:"absolute -top-2 text-white right-[46px] z-30"}),(0,e.jsx)(l.Text,{html:O?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:O?.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:()=>v?.join?.(),children:(0,e.jsx)(l.Text,{html:O?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>v?.login?.(),children:(0,e.jsx)(l.Text,{html:O?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>S(!1)})]})]})}),Ne=a.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{buildProps:o}=(0,B.useNavContext)(),[c,r]=(0,a.useState)([]),[d,f]=(0,a.useState)(-1),v=(0,a.useRef)(null),p=(0,a.useCallback)(()=>{const s=t?.subcategories;if(!s?.length)return;const x=s.findIndex(i=>!!i?.subSubCategories),b=s.findIndex(i=>!i?.subSubCategories),m=s.map((i,h)=>({index:h,open:x===h||b===h}));r(m)},[t]);(0,a.useEffect)(()=>{p()},[p]);const u=(0,a.useMemo)(()=>{const s=t?.subcategories?.[c?.find(b=>b.open)?.index||0],x=n?.find(b=>b?.label?.toLowerCase()===s?.label?.toLowerCase())||{};if(s?.collections){const b=o?.categories?.[s?.collections]||{};return{label:x?.label,isCollection:!0,banner:x?.banner,primary:x?.primary,series:[{products:b?.products}]}}else if(s?.subSubCategories){const b=s?.subSubCategories?.[d],m=n?.find(i=>i?.label?.toLowerCase()===b?.label?.toLowerCase())||{};if(b?.collections){const i=o?.categories?.[b?.collections]||{};return{label:m?.label,isCollection:!0,banner:m?.banner,primary:m?.primary,series:[{products:i?.products}]}}else return m}else return x},[t,c,d,n]),z=(0,a.useCallback)((s,x)=>{if(x?.subSubCategories?.length>0?f(0):f(-1),x?.subSubCategories?.length>0)r(b=>b.map(m=>m.index===s?{...m,open:!0}:{...m,open:!1}));else{const m=t?.subcategories?.findIndex(i=>!!i?.subSubCategories);r(i=>i.map(h=>({...h,open:h.index===s||h.index===m})))}},[t,p]),k=(s,x)=>{r(b=>b.map(m=>m.index===s?{...m,open:!0}:{...m,open:!1})),f(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:v,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 b=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]":!b&&c?.find(m=>m.index===x)?.open}),onClick:()=>{z(x,s)},children:[(0,e.jsx)(l.Text,{html:s.label,className:"p-4 text-sm font-bold leading-[1.4]"}),b&&(0,e.jsx)(L.DownArrow,{className:(0,N.cn)("size-4",{"rotate-180":c?.find(m=>m.index===x)?.open})})]}),c?.find(m=>m.index===x)?.open&&(0,e.jsx)("div",{className:"flex flex-col",children:s.subSubCategories?.map((m,i)=>(0,e.jsx)(l.Text,{html:m.label,onClick:()=>k(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]":d===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,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(u).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:u?.label,className:"text-xl lg-desktop:text-2xl font-bold leading-[1.4]"}),u?.primary&&!u?.primary?.hide&&(0,e.jsx)(l.Button,{as:"a",href:u?.primary?.url,variant:"link",size:"lg",className:"justify-start !p-0 text-sm lg-desktop:text-base font-bold leading-[1.2] no-underline",children:u?.primary?.label})]}),(0,e.jsx)(l.Link,{href:u?.guide?.url,className:"text-sm lg-desktop:text-base leading-[1.2] text-[#6D6D6F]",children:u?.guide?.label})]}),(0,e.jsx)("div",{className:"flex flex-col gap-4 overflow-y-auto h-[426px]",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:u?.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:[!!u?.banner&&(0,e.jsx)(l.Link,{asChild:!u?.banner?.href,href:u?.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:u?.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:u?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),(0,e.jsx)(l.Text,{html:u?.banner?.desc||"20.000mAh",className:"text-sm text-white font-bold"})]})]})}),s.products?.map((b,m)=>(0,e.jsx)(Y,{product:b,isCollection:u?.isCollection},`seriesProductItem-${m}`))]})]},`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),[d,f]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(o?.current){const p=o?.current?.getBoundingClientRect();f(p.height)}},[o]);const v=(0,se.debounce)(()=>{if(n){const p=n.getBoundingClientRect();r(p)}},500);return(0,a.useEffect)(()=>(v(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}),[v]),(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:d},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})=>{const{buildProps:c,onSeriesProductClick:r}=(0,B.useNavContext)();let d=n?t:c?.products?.find(u=>u.handle===t.handle);const f=d?.variants?.find(u=>u.sku===t.sku)||d?.variants?.[0],v=(0,a.useMemo)(()=>`/products/${d?.handle}?variant=${(0,N.atobID)(f?.id)}`,[d?.handle,f?.id]),p=(0,a.useMemo)(()=>d?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return f?.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:`${f?.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(p)&&p?.map(u=>(0,e.jsx)(l.Text,{as:"p",html:u,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:v,onClick:u=>{u.preventDefault(),window.open(v),r?.(d,o||0)},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,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,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:d,setCurrentMenu:f,subSubCategory:v}=(0,B.useNavContext)(),[p,u]=(0,a.useState)(!1),[z,k]=(0,a.useState)(0),[s,x]=(0,a.useState)(null),b=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(b?.current&&p){const M=b?.current?.getBoundingClientRect();k(window?.innerHeight-(M?.bottom||0))}},[p]),(0,K.useGSAP)(()=>{J.gsap.fromTo(b.current,{height:0},{height:z,duration:.3})},[z]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=p?"hidden":"auto"},[p]);const m=(0,a.useMemo)(()=>s?.components?.[0]?.blockType,[s]),i=(0,H.WithSupports)(Me,{categoriesItem:s}),h=(0,H.WithSidebar)(De,s),S=(0,H.WithMulticol)(Le,s),D=(0,a.useMemo)(()=>{switch(m){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)(S,{});default:return null}},[m,s,i]),w=(0,a.useCallback)(()=>{u(!1),k(0),f&&f(y.HeaderNavigationMenu.Primary)},[u,k,f]),A=(0,a.useMemo)(()=>t?.headerBar?.actions?.filter(M=>M?.mobileShow&&M?.blockType!==y.HeaderNavigationActionBlockType.Profile),[t]),C=(0,a.useMemo)(()=>t?.headerBar?.actions?.find(M=>M?.mobileShow&&M?.blockType===y.HeaderNavigationActionBlockType.Profile)||{},[t]),T=(0,a.useMemo)(()=>{switch(d){case y.HeaderNavigationMenu.Primary:return(0,e.jsx)(ze,{actions:A,menuOpen:p,onMenuOpenClose:()=>{u(!1),k(0)},onMenuOpenClick:()=>u(!0)});case y.HeaderNavigationMenu.Secondary:return(0,e.jsx)(le,{title:s?.text,onMenuOpenClose:w,onMenuBackClick:()=>f?.(y.HeaderNavigationMenu.Primary)});case y.HeaderNavigationMenu.Third:return(0,e.jsx)(le,{title:v?.label,onMenuOpenClose:w,onMenuBackClick:()=>f?.(y.HeaderNavigationMenu.Secondary)});default:return null}},[p,d,f,s,A,v,w]),j=(0,a.useCallback)((M,$)=>{const F=Array.isArray(r)?Array.isArray(r[M])?r[M][$]:{}:{};x(F),F?.components?.[0]?.blockType===y.HeaderNavigationBlockType.Links?F?.components?.[0]?.url&&window.open(F?.components?.[0]?.url):f?.(y.HeaderNavigationMenu.Secondary)},[r,f]);return(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[52px]",n),children:[T,p&&(0,e.jsx)("div",{ref:b,className:"absolute left-0 top-full text-black border-t border-[#E4E5E6] z-[999] w-full overflow-y-auto bg-white",style:{height:z},children:d===y.HeaderNavigationMenu.Primary?(0,e.jsx)(Se,{categories:r,onPrimaryMenuClick:j,onPrimaryNavClick:o,profileAction:C}):D})]})}),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,d)=>(0,e.jsxs)("div",{className:"",children:[r?.map((f,v)=>(0,e.jsx)(W,{label:f.text,onClick:()=>{const u=(t?.flat()||[])?.findIndex(z=>z?.id===t[d][v]?.id);n(d,v),c?.(f,u)},icon:f.components?.[0]?.icon},f.id)),(0,e.jsx)("div",{className:(0,N.cn)("my-2 h-px w-full bg-[#E5E5E7]",{hidden:d===t.length-1})})]},`groupCategory-${d}`))}),(0,e.jsx)(Pe,{profileAction:o})]}),De=({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{currentMenu:o,setCurrentMenu:c,subSubCategory:r,setSubSubCategory:d,setCurrentSeriesMetadata:f,currentSeriesMetadata:v,buildProps:p}=(0,B.useNavContext)(),[u,z]=(0,a.useState)([]),[k,s]=(0,a.useState)([]);(0,a.useEffect)(()=>{t?.subcategories?.length&&z(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),d?.(i);const S=n?.find(D=>h!==void 0?i?.subSubCategories?.[h]?.label?.toLowerCase()===D.label?.toLowerCase():i?.label?.toLowerCase()===D.label?.toLowerCase())||{};if(i?.collections){const D=p?.categories?.[i?.collections]||{};f?.({label:S?.label,isCollection:!0,banner:S?.banner,primary:S?.primary,series:[{products:D?.products}]})}else f?.(S)},[n,t,c,d,f]),b=(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:u.find(S=>S.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,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 S=n?.find(w=>w.label.toLowerCase()===i?.label?.toLowerCase())||{};let D={};if(i?.collections){const w=p?.categories?.[i?.collections]||{};D={label:S?.label,isCollection:!0,banner:S?.banner,primary:S?.primary,series:[{products:w?.products}]}}else D=S;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(i).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:D,onSubSubCategoryItemClick:()=>s(w=>w.map((A,C)=>({...A,open:C===h}))),expanded:!!k?.find(w=>w.index===h)?.open}),k?.find(w=>w.index===h)?.open&&(0,e.jsxs)(e.Fragment,{children:[(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,className:"text-base no-underline leading-[1.2]",variant:"secondary",size:"base",children:D?.primary?.label})})]})]},`${i.label}-${h}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(v).length>0&&(0,e.jsx)(ee,{matchSeriesMetadata:v}),(0,e.jsx)(te,{matchSeriesMetadata:v}),v?.primary&&(0,e.jsx)("div",{className:"text-center my-4 ",children:(0,e.jsx)(l.Button,{as:"a",href:v?.primary?.url,variant:"secondary",size:"base",className:"text-base no-underline leading-[1.2]",children:v?.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,u,k,d,r,f,v])},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)(L.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,isCollection:t?.isCollection},`seriesProductItem-${o}-${r}`))]})]},`seriesItem-${o}`))}),Me=({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))}),Le=({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)(L.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)(L.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(d=>(0,e.jsx)(W,{label:d?.title,href:d?.url},d.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(d=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:d.benefitIcon?.url,className:"size-4",alt:d.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:d.benefit,className:"text-sm font-bold leading-[1.4]"})]},d.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)(L.Close,{className:"size-5",onClick:()=>n()}):(0,e.jsx)(L.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,d]=(0,a.useState)(null),f=(0,a.useCallback)((v,p)=>{switch(d(p),v?.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((v,p)=>(0,e.jsx)("div",{ref:v.blockType===y.HeaderNavigationActionBlockType.Profile?o:null,onClick:()=>f(v,p),children:(0,e.jsx)(l.Text,{html:v.icon,className:(0,N.cn)("cursor-pointer size-5",{"text-brand-0":n&&r===p})})},v.id))})}),le=({title:t,onMenuOpenClose:n,onMenuBackClick:o})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)(L.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)(L.Close,{className:"size-5",onClick:()=>n()})]}),W=({label:t,href:n,onClick:o,active:c,icon:r,className:d})=>(0,e.jsx)("div",{className:(0,N.cn)("flex cursor-pointer items-center justify-between py-4",d),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)(L.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 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"),Re=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),[A,S]=(0,a.useState)(!1),T=(0,a.useRef)(null),j=()=>{const $=document?.querySelector("body")?.offsetWidth||0;S($<=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($=>$?.blockType===y.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[o]);return(0,e.jsx)(B.default,{buildProps:c,profile:b,isMobile:A,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:$=>{v?.($)},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),A=(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,R)=>({groupIndex:z,index:R,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 R=w?.flat()||[],_=R?.findIndex(Q=>Q?.id===w[z][E]?.id);g.stopPropagation(),c?.(),d?.(R[_],_),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]),$=(0,H.WithSidebar)(Ne,s),F=(0,H.WithMulticol)(ke,s),ce=(0,H.WithSupports)(we,{categoriesItem:s,currentNavItemRef:A.current?.[S?.groupIndex||0]?.[S?.index||0]}),de=(0,a.useMemo)(()=>{switch(M){case y.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)($,{});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]),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,R)=>(0,e.jsx)("div",{ref:_=>{A.current[z][R]=_},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:_=>T(_,z,R),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===R,"opacity-100":v&&S?.groupIndex===z&&S?.index===R})})]}),(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===R},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||O?.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:O?.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:O?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:O?.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:O?.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:O?.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,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,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:s?.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,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,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]),A=(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:A,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,A,m,C]),j=(0,a.useCallback)((M,$)=>{const F=Array.isArray(r)?Array.isArray(r[M])?r[M][$]:{}:{};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,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((A,S)=>({...A,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,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);
2
2
  //# sourceMappingURL=index.js.map