PageSourceSearch

https://www.lamodern.com/build/assets/scroll-to-hash-element-27736361.js

js lamodern.com collected 2026-09-24 22:59:14 UTC 5,195 bytes, 1 lines download raw bytes

1import{i as R}from"./imagesloaded-550c8879.js";import{i as v}from"./artLayoutAnchors-0c62ef4b.js";import{ax as A}from"./app-6d16514d.js";/* empty css             */function C({window:i,document:t,scroll:o}){let e=null,n=null;function s(){n!==null&&(i.clearTimeout(n),n=null)}function r(){s(),e=null}function a(){s(),e&&(e.done=!0)}function u(){var p,T,w,S;if(n=null,!e||e.done||i.location.href!==e.url)return;const l=t.getElementById(e.hash);if(e.attempts++,!l||t.body.classList.contains("sthe-paused")){e.attempts<100?n=i.setTimeout(u,150):e.done=!0;return}if(e.target!==l){e.target=l,e.previous=null,e.stable=0,e.targetChecks=0;const h=l.closest(".art-shared-step")||l;e.images=[...h.querySelectorAll("img")];for(const m of e.images)m.classList.contains("lazyload")&&((T=(p=i.lazySizes)==null?void 0:p.loader)==null||T.unveil(m)),m.loading==="lazy"&&(m.loading="eager")}e.targetChecks++;const c=l.getBoundingClientRect(),_=[c.top+i.scrollY,c.height,t.documentElement.scrollHeight,i.innerHeight,...[...t.querySelectorAll(".sthe-pusher")].map(h=>h.offsetHeight)],b=((w=t.fonts)==null?void 0:w.status)!=="loading"&&e.images.every(h=>h.complete&&!h.classList.contains("lazyload")),D=((S=e.previous)==null?void 0:S.length)===_.length&&_.every((h,m)=>Math.abs(h-e.previous[m])<1);if(e.stable=D&&(b||e.targetChecks>=20)?e.stable+1:0,e.previous=_,e.stable>=3||e.attempts>=100){e.done=!0,o(l);return}n=i.setTimeout(u,150)}function d(){const l=i.location.hash.slice(1);if(!v(l)){r();return}const c=t.getElementById(l);(e==null?void 0:e.url)===i.location.href&&(!e.target||e.target===c)||(r(),e={url:i.location.href,hash:l,attempts:0,done:!1},u())}return{start:d,reset:r,cancel:a}}window.DEBUG_STHE=0;const B=300,I=100;let y=0,E=null;const G=150,M=100,U=3;let f=null,H=0,L=0,g=0;class P{constructor(){this.paused=!0,this.artLayoutScroller=C({window,document,scroll:o=>this.scrollToHashOnceSettled(o,!0)});const t=1e3;this.handler_debounced=A(o=>{this.handler_raw(o)},t),this.handler=this.handler_debounced.bind(this),this.handler_now=this.handler_raw.bind(this),this.init()}init(){var e,n,s,r;window.addEventListener("hashchange",()=>this.artLayoutScroller.reset()),window.addEventListener("wheel",()=>this.artLayoutScroller.cancel(),{passive:!0}),window.addEventListener("touchstart",()=>this.artLayoutScroller.cancel(),{passive:!0}),window.addEventListener("keydown",a=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(a.key)&&this.artLayoutScroller.cancel()}),R(document.body,()=>{this.handler_debounced()}),document.addEventListener("lazybeforeunveil",()=>{this.handler_debounced()}),window.addEventListener("wright--request-scroll-to-hash-element",()=>{DEBUG_STHE,this.unPause(),this.handler(!0)});const t=window.d||{};typeof t.isViewingRoute=="function"&&(t.isViewingRoute((e=t.routenames)==null?void 0:e.ITEM_PAGE)||t.isViewingRoute((n=t.routenames)==null?void 0:n.SHOP_DIRECT_ITEM_PAGE)||t.isViewingRoute((s=t.routenames)==null?void 0:s.VR_DIRECT_ITEM_PAGE)||t.isViewingRoute((r=t.routenames)==null?void 0:r.SESSION_INDEX))||(DEBUG_STHE,this.unPause())}retry(t){E||(E=setTimeout(()=>{if(y++,E=null,y>I){DEBUG_STHE;return}this.handler_raw(t)},B))}handler_raw(t){var n,s,r,a,u,d,l,c;let o=window.location.hash.slice(1);if(v(o)){clearTimeout(E),clearTimeout(f),E=null,f=null,(a=(n=window.d)==null?void 0:n.scrollCache)!=null&&a[(r=(s=window.d)==null?void 0:s.$page)==null?void 0:r.url]&&delete window.d.scrollCache[window.d.$page.url],this.artLayoutScroller.start();return}if(this.artLayoutScroller.reset(),!o||!o.trim().length)return;if((c=(u=window.d)==null?void 0:u.scrollCache)!=null&&c[(l=(d=window.d)==null?void 0:d.$page)==null?void 0:l.url]&&delete window.d.scrollCache[window.d.$page.url],document.body.classList.contains("sthe-paused")){DEBUG_STHE,this.retry(t);return}let e=document.getElementById(o);if(DEBUG_STHE,!e){DEBUG_STHE,t=!0,this.retry(t);return}this.checkElementHasSettled(e,t)}checkElementHasSettled(t,o){if(!f){if(t.offsetTop===L?g++:g=0,H++,H>M){DEBUG_STHE,this.scrollToHashOnceSettled(t,o);return}else{if(g>=U){DEBUG_STHE,this.scrollToHashOnceSettled(t,o);return}DEBUG_STHE,f=setTimeout(()=>{f=null,this.checkElementHasSettled(t,o)},G)}L=t.offsetTop}}scrollToHashOnceSettled(t,o){let e=t.getBoundingClientRect().top+document.documentElement.scrollTop;if(!e)return;let n=0,s=document.querySelectorAll(".sthe-pusher");
1s.length&&s.forEach(function(c){n+=c.offsetHeight});let r=t.getBoundingClientRect().height,a=window.innerHeight||document.documentElement.clientHeight,u=n+(a-n)/2,d=e+r/2,l=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)-a;e=Math.min(Math.max(d-u,0),Math.max(l,0)),e&&window.scrollTo({top:e,behavior:"instant"}),o||this.removeHash()}removeHash(){var n;DEBUG_STHE;var t,o,e=window.location;if("replaceState"in history){let s=e.pathname.split("#"),r=s[0];s.length>1&&""+s[1];let a=r+e.search;history.replaceState({...(n=window.d)==null?void 0:n.$page},document.title,a)}else t=document.body.scrollTop,o=document.body.scrollLeft,e.hash="",document.body.scrollTop=t,document.body.scrollLeft=o}unPause(){DEBUG_STHE,document.body.classList.remove("sthe-paused"),this.paused=!1}}const $=new P;export{$ as default};

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.