PageSourceSearch

https://www.nikon.fr/dist-client/FullWidthAnchorNavigation-Chunk-3e062cbe5ff0d1009755.js

js nikon.fr collected 2026-09-24 17:51:54 UTC 5,366 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunknikon_client=globalThis.webpackChunknikon_client||[]).push([[2945],{96298(e,t,n){n.r(t),n.d(t,{default:()=>h});var o=n(64363),i=n(12518),a=n(73156),r=n(59471),c=n(55169),l=n(97500),s=n.n(l),d=n(34629);function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(null,arguments)}const u=({dataAnchorId:e,dataTestId:t,isActive:n,item:i,onClick:a})=>React.createElement("div",m({className:"relative flex items-center justify-center","data-testid":t},e?{"data-anchorid":e}:{}),React.createElement("button",{type:"button",className:s()("cta px-[15px] motion-safe:transition-all motion-safe:duration-100 [@media(hover:hover)]:hover:text-yellow",n?"text-white":"text-grey-500"),onClick:e=>{a(e,i.anchor),(0,c.A)({event:"menuUsed",content_type:"anchor_menu",main_category:i.title})}},i.title),React.createElement(d.N,null,n&&React.createElement(o.A,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"absolute bottom-0 h-1 w-full bg-grey-450"}))),h=({items:e})=>{const t=(0,r.useRef)(null),n=e.slice(0,5),{activeAnchorId:c,scrollTo:l}=(0,a.A)({items:n}),s=()=>{const e=document.getElementById("AnchorMenu");return e&&"sticky"===getComputedStyle(e).position};return(0,r.useEffect)(()=>{const e=t.current?.querySelector(`:scope [data-anchorid="${c}"]`);e&&s()&&e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[c]),React.createElement("section",{"data-testid":"CT-06-B-Full-Width-Anchor-Navigation",className:"h-15 bg-grey-600",ref:t},React.createElement(o.A,{className:"hidden h-full overflow-hidden lg:flex",initial:{opacity:0},animate:{opacity:1}},React.createElement("div",{className:"grid w-full grid-cols-[repeat(auto-fit,_minmax(0,_1fr))]"},n.map((e,t)=>React.createElement(u,{key:`desktop-${e.title}`,dataTestId:`CT-06-B-Full-Width-Anchor-Navigation-Desktop-Item-${t}`,isActive:c===e.anchor,item:e,onClick:(e,t)=>{l(`a-${t}`)}})))),React.createElement(o.A,{className:"h-full lg:hidden",initial:{opacity:0}
1,animate:{opacity:1}},React.createElement(i.A,{className:"h-full",innerWrapperClassName:"h-full",shadowColour:"from-grey-600"},React.createElement("div",{className:"flex h-full"},n.map((e,t)=>React.createElement(u,{key:`mobile-${e.title}`,dataAnchorId:e.anchor,dataTestId:`CT-06-B-Full-Width-Anchor-Navigation-Mobile-Item-${t}`,isActive:c===e.anchor,item:e,onClick:(e,t)=>{l(`a-${t}`),s()&&e.currentTarget?.scrollIntoView({behavior:"smooth",inline:"center"})}}))))))}},30680(e,t,n){n.d(t,{A:()=>i});var o=function(e){return e.Screen="Screen",e.Viewport="Viewport",e}(o||{});const i=o},63904(e,t,n){n.d(t,{A:()=>i});var o=n(42926);const i=()=>{const e=Math.abs(window.outerWidth-window.innerWidth)<=50?1:Number((window.outerWidth/window.innerWidth).toFixed(2));return o.gm&&!o.Fr?window.devicePixelRatio:e}},73156(e,t,n){n.d(t,{A:()=>c});var o=n(30680),i=n(59471),a=n(55423),r=n(26093);const c=({items:e,stickToBottom:t})=>{const n=(0,r.A)(1024),c=!(0,r.A)(1024,o.A.Screen)&&n,[l,s]=(0,i.useState)(""),d=(0,a.A)(l,250),m=(0,i.useCallback)(()=>e.map(e=>`#a-${e.anchor}`),[e]),u=(0,i.useCallback)(()=>{const e=m();if(0===e.length)return;const t=document.querySelectorAll(e.toString()),n=new IntersectionObserver(e=>{const t=e.filter(e=>e.isIntersecting);let n;if(1===t.length&&(n=t.at(0)),t.length>1){let e;t.forEach(t=>{e||(e=t),t.intersectionRatio>=e?.intersectionRatio&&(e=t)}),n=e}s(n?.target.id.split("-")[1]||"")},{rootMargin:"-30% 0% -30% 0%",threshold:[0,.25,.5,.75,1]});t.forEach(e=>{n.observe(e)})},[m]);return(0,i.useEffect)(()=>(window.addEventListener("scroll",u),u(),()=>window.removeEventListener("scroll",u)),[u]),(0,i.useEffect)(()=>{["ProductNavigation","AnchorMenu"].forEach(e=>{document.getElementById(e)?.classList[c?"remove":"add"]("sticky")})},[c]),{scrollTo:e=>{const o=document.getElementById(e);if(!o)return;const i=Array.from(document.querySelectorAll('img[loading="lazy"]')).filter(e=>o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING);i.forEach(e=>{e.setAttribute("loading","eager")});const a=0===i.length?0:n?400:300;setTimeout(()=>{const e=(o?.getBoundingClientRect().top||0)+window.scrollY+(()=>{const e=document.getElementById("AnchorMenu"),n=document.getElementById("ProductNavigation"),o=document.getElementById("SiteNotifications");return-20-(e&&"sticky"===getComputedStyle(e).position?e.clientHeight:0)-(n&&!t&&"sticky"===getComputedStyle(n).position?n.clientHeight:0)-(o?.parentElement?.parentElement&&"sticky"===getComputedStyle(o.parentElement?.parentElement).position?o.clientHeight:0)})();window.scrollTo({top:e,behavior:"smooth"})},a)},activeAnchorId:d}}},55423(e,t,n){n.d(t,{A:()=>i});var o=n(59471);const i=(e,t)=>{const[n,i]=(0,o.useState)(e);return(0,o.useEffect)(()=>{const n=setTimeout(()=>i(e),t||500);return()=>{clearTimeout(n)}},[e,t]),n}},26093(e,t,n){n.d(t,{A:()=>r});var o=n(30680),i=n(63904),a=n(59471);const r=(e,t=o.A.Viewport)=>{const[n,r]=(0,a.useState)(),c=(0,a.useCallback)(()=>{const n=(0,i.A)(),a=t===o.A.Viewport?window.innerWidth:window.innerWidth*n;r(a<e)},[e,t]);return(0,a.useEffect)(()=>(window.addEventListener("resize",c),c(),()=>{window.removeEventListener("resize",c)}),[c]),n}}}]);
2//# sourceMappingURL=FullWidthAnchorNavigation-Chunk-3e062cbe5ff0d1009755.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.