PageSourceSearch

https://www.astonmartin.com/theme/10.3.52.0.4/assets/astonmartin/mjs/homepage-controller.bundle.js

js astonmartin.com collected 2026-09-24 08:38:07 UTC 16,012 bytes, 2 lines download raw bytes

1/*! For license information please see homepage-controller.bundle.js.LICENSE.txt */
2(self.webpackChunkaml=self.webpackChunkaml||[]).push([[2192,3885],{37503:(e,t,i)=>{"use strict";i.d(t,{HE:()=>c,RX:()=>g});var n="undefined"!=typeof window?window:{screen:{},navigator:{}},o=(n.matchMedia||function(){return{matches:!1}}).bind(n),s=!1,r={get passive(){return s=!0}},a=function(){};n.addEventListener&&n.addEventListener("p",a,r),n.removeEventListener&&n.removeEventListener("p",a,!1);var c=s,l="ontouchstart"in n,h=l||"TouchEvent"in n&&o("(any-pointer: coarse)").matches,d=(n.navigator.maxTouchPoints||0)>0||h,u=n.navigator.userAgent||"",f=o("(pointer: coarse)").matches&&/iPad|Macintosh/.test(u)&&Math.min(n.screen.width||0,n.screen.height||0)>=768,v=(o("(pointer: coarse)").matches||!o("(pointer: fine)").matches&&l)&&!/Windows.*Firefox/.test(u),p=o("(any-pointer: fine)").matches||o("(any-hover: hover)").matches||f||!l,g=!d||!p&&v?d?"touchOnly":"mouseOnly":"hybrid"},96584:function(e){e.exports=function(e){function t(n){if(i[n])return i[n].exports;
2var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=n(i(2));e.exports=o.default},function(e,t){function i(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=i},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(i(9)),s=n(i(3)),r=i(4),a=function(){if("undefined"!=typeof window){var e=100,t=["scroll","resize","load"],i={history:[]},n={offset:{},threshold:0,test:r.inViewport},a=(0,o.default)((function(){i.history.forEach((function(e){i[e].check()}))}),e);t.forEach((function(e){return addEventListener(e,a)})),window.MutationObserver&&addEventListener("DOMContentLoaded",(function(){new MutationObserver(a).observe(document.body,{attributes:!0,childList:!0,subtree:!0})}));var c=function(e){if("string"==typeof e){var t=[].slice.call(document.querySelectorAll(e));return i.history.indexOf(e)>-1?i[e].elements=t:(i[e]=(0,s.default)(t,n),i.history.push(e)),i[e]}};return c.offset=function(e){if(void 0===e)return n.offset;var t=function(e){return"number"==typeof e};return["top","right","bottom","left"].forEach(t(e)?function(t){return n.offset[t]=e}:function(i){return t(e[i])?n.offset[i]=e[i]:null}),n.offset},c.threshold=function(e){return"number"==typeof e&&e>=0&&e<=1?n.threshold=e:n.threshold},c.test=function(e){return"function"==typeof e?n.test=e:n.test},c.is=function(e){return n.test(e,n)},c.offset(0),c}};t.default=a()},function(e,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=function(){function e(t,n){i(this,e),this.options=n,this.elements=t,this.current=[],this.handlers={enter:[],exit:[]},this.singles={enter:[],exit:[]}}return n(e,[{key:"check",value:function(){var e=this;return this.elements.forEach((function(t){var i=e.options.test(t,e.options),n=e.current.indexOf(t),o=n>-1,s=!i&&o;i&&!o&&(e.current.push(t),e.emit("enter",t)),s&&(e.current.splice(n,1),e.emit("exit",t))})),this}},{key:"on",value:function(e,t){return this.handlers[e].push(t),this}},{key:"once",value:function(e,t){return this.singles[e].unshift(t),this}},{key:"emit",value:function(e,t){for(;this.singles[e].length;)this.singles[e].pop()(t);for(var i=this.handlers[e].length;--i>-1;)this.handlers[e][i](t);return this}}]),e}();t.default=function(e,t){return new o(e,t)}},function(e,t){"use strict";function i(e,t){var i=e.getBoundingClientRect(),n=i.top,o=i.right,s=i.bottom,r=i.left,a=i.width,c=i.height,l={t:s,r:window.innerWidth-r,b:window.innerHeight-n,l:o},h={x:t.threshold*a,y:t.threshold*c};return l.t>t.offset.top+h.y&&l.r>t.offset.right+h.x&&l.b>t.offset.bottom+h.y&&l.l>t.offset.left+h.x}Object.defineProperty(t,"__esModule",{value:!0}),t.inViewport=i},function(e,t){(function(t){var i="object"==typeof t&&t&&t.Object===Object&&t;e.exports=i}).call(t,function(){return this}())},function(e,t,i){var n=i(5),o="object"==typeof self&&self&&self.Object===Object&&self,s=n||o||Function("return this")();e.exports=s},function(e,t,i){function n(e,t,i){function n(t){var i=w,n=b;return w=b=void 0,M=t,k=e.apply(n,i)}function h(e){return M=e,E=setTimeout(f,t),L?n(e):k}function d(e){var i=t-(e-B);return x?l(i,y-(e-M)):i}function u(e){var i=e-B;return void 0===B||i>=t||i<0||x&&e-M>=y}function f(){var e=s();return u(e)?v(e):void(E=setTimeout(f,d(e)))}function v(e){return E=void 0,P&&w?n(e):(w=b=void 0,k)}function p(){void 0!==E&&clearTimeout(E),M=0,w=B=b=E=void 0}function g(){return void 0===E?k:v(s())}function m(){var e=s(),i=u(e);if(w=arguments,b=this,B=e,i){if(void 0===E)return h(B);if(x)return E=setTimeout(f,t),n(B)}return void 0===E&&(E=setTimeout(f,t)),k}var w,b,y,k,E,B,M=0,L=!1,x=!1,P=!0;if("function"!=typeof e)throw new TypeError(a);return t=r(t)||0,o(i)&&(L=!!i.leading,y=(x="maxWait"in i)?c(r(i.maxWait)||0,t):y,P="trailing"in i?!!i.trailing:P),m.cancel=p,m.flush=g,m}var o=i(1),s=i(8),r=i(10),a="Expected a function",c=Math.max,l=Math.min;e.exports=n},function(e,t,i){var n=i(6),o=function(){return n.Date.now()};e.exports=o},function(e,t,i){function n(e,t,i){var n=!0,a=!0;if("function"!=typeof e)throw new TypeError(r);return s(i)&&(n="leading"in i?!!i.leading:n,a="trailing"in i?!!i.trailing:a),o(e,t,{leading:n,maxWait:t,trailing:a})}var o=i(7),s=i(1),r="Expected a function";e.exports=n},function(e,t){function i(e){return e}e.exports=i}])},18435:(e,t,i)=>{"use strict";i.r(t),i.d(t,{homepageController:()=>p});var n=i(39754),o=i(7350),s=i(38221),r=i(37503),a=i(96584),c=i(9346),l=i(64178),h=i(47304),d=i(58398),u=i(13751),f=[37,38,74],v=[32,39,40,75];var p=new class{isEditorMode(){return document.body.classList.contains("pagemode-edit")}init(){this.isEditorMode()?console.warning("Pagemode Edit. Skipping HomepageController."):(this.scrollDisabled=!1,this.activeBlock=0,this.activeBlockBeforeFooter=!1,this.lastKnownScrollPosition=0,this.lastDirection="down",this.animationInProgress=!1,this.players=u.videoController.getAllPlayers(),this.userInteractionLastTime=Date.now(),this.lastScrollEvent=Date.now(),this.scrollByMouse=!1,this.screenWidth=window.innerWidth,this.pagerOnMobileInited=!1,this.throttledMove=o(this.onMouseMove.bind(this),100),this.debouncedResize=s(this.onResize.bind(this),250),this.debouncedScroll=s(this.onScrollEvent.bind(this),250),this.onMouseWheelBind=this.onMouseWheel.bind(this),this.onMouseDownBind=this.onMouseDown.bind(this),this.onKeyDownBind=this.onKeyDown.bind(this),this.onPagerClickBind=this.onPagerClick.bind(this),this.footerHeight=204,this.initDOMElements(),this.initInView(),this.initBindings(),this.initPlayerCallbacks())}destroy(){this.main&&this.main.removeAttribute("style"),this.removeBindings()}initDOMElements(){this.main=document.body.querySelector("main"),this.pager=document.body.querySelector("main [data-pager]"),this.footer=document.body.querySelector("[data-footer]"),this.emissionBlock=this.footer.querySelector("[data-emission-block]"),this.collectionsList=document.body.querySelector("[data-collection-list]"),this.blocks=Array.prototype.slice.call(document.body.querySelectorAll("main [data-homepage-block]")),this.blocks.push(this.footer),null!==this.emissionBlock&&(this.footerHeight=this.footer.offsetHeight,"mouseOnly"===r.RX&&(this.main.style.marginBottom="".concat(this.footerHeight,"px")))}initBindings(){"mouseOnly"===r.RX?(this.screenWidth<769&&!1===this.pagerOnMobileInited&&this.initPagerOnMobile(),this.pager&&n(this.pager.querySelectorAll("li"),(e=>{e.addEventListener("click",this.onPagerClickBind,!!r.HE&&{capture:!1,passive:!0})}
2)),window.addEventListener("mousemove",this.throttledMove,!!r.HE&&{capture:!1,passive:!0}),window.addEventListener("wheel",this.onMouseWheelBind,!!r.HE&&{capture:!1,passive:!1}),window.addEventListener("resize",this.debouncedResize,!!r.HE&&{capture:!1,passive:!0}),window.addEventListener("mousedown",this.onMouseDownBind,!!r.HE&&{capture:!1,passive:!1}),window.addEventListener("scroll",this.debouncedScroll,!!r.HE&&{capture:!1,passive:!1}),window.addEventListener("keydown",this.onKeyDownBind,!!r.HE&&{capture:!1,passive:!1})):!1===this.pagerOnMobileInited&&this.initPagerOnMobile()}removeBindings(){this.pager&&n(this.pager.querySelectorAll("li"),(e=>{e.removeEventListener("click",this.onPagerClickBind)})),window.removeEventListener("mousemove",this.throttledMove),window.removeEventListener("wheel",this.onMouseWheelBind),window.removeEventListener("resize",this.debouncedResize),window.removeEventListener("mousedown",this.onMouseDownBind),window.removeEventListener("scroll",this.debouncedScroll),window.removeEventListener("keydown",this.onKeyDownBind)}onPagerClick(e){this.activeBlock=parseInt(e.target.getAttribute("data-target")-1,10),this.scrollToBlock()}onMouseMove(){this.userInteractionLastTime=Date.now()}onMouseWheel(e){(0,l.A)()||(!1===this.scrollDisabled&&this.screenWidth>768&&(e.preventDefault(),e.stopPropagation()),this.screenWidth>768&&this.onScroll(e))}onResize(){this.screenWidth=window.innerWidth,this.footerHeight=this.footer.offsetHeight,this.screenWidth<769&&!1===this.pagerOnMobileInited&&this.initPagerOnMobile(),"mouseOnly"===r.RX&&(this.main.style.marginBottom="".concat(this.footerHeight,"px")),this.screenWidth>768&&this.scrollToBlock()}onMouseDown(e){window.innerWidth-e.pageX<=h.A.scrollbarWidth&&(this.scrollByMouse=!0)}onScrollEvent(){if(!(0,l.A)()){var e=this.lastKnownScrollPosition>window.scrollY?"up":"down";this.lastKnownScrollPosition=window.scrollY,this.lastDirection=e,!1===this.animationInProgress&&!0===this.scrollByMouse&&this.screenWidth>768&&((this.activeBlockBeforeFooter&&"down"===e||this.activeBlock===this.blocks.length-1)&&this.setActiveBlock(e),this.scrollToBlock(),this.scrollByMouse=!1)}return!0}onKeyDown(e){if(!(0,l.A)()){var t=parseInt(e.keyCode,10),i=!1;-1!==f.indexOf(t)?i="up":-1!==v.indexOf(t)&&(i="down");var n=document.body.classList.contains("left_nav")||document.body.classList.contains("right_nav");i&&!n&&(e.preventDefault(),e.stopPropagation(),!1===this.animationInProgress&&(this.setActiveBlock(i),this.scrollToBlock()))}}initInView(){a.threshold(.5),a("main [data-homepage-block]").on("enter",this.onBlockEnters.bind(this)),a("main [data-homepage-block]").on("exit",this.onBlockExits.bind(this)),this.blocks.forEach((e=>{a.is(e)&&e.getAttribute("data-homepage-block")&&this.onBlockEnters(e)}))}initPagerOnMobile(){var e=0;this.collectionsList&&(e=this.collectionsList.offsetTop+window.innerHeight/2),this.pager&&window.addEventListener("scroll",s((()=>{var t=document.body.scrollTop+window.innerHeight;e<t&&this.collectionsList?this.pager.classList.add("pager--hidden"):this.pager.classList.remove("pager--hidden")}),200),!!r.HE&&{capture:!1,passive:!0}),this.pagerOnMobileInited=!0}initPlayerCallbacks(){this.players.forEach((e=>{e.player.setEndCallback((()=>{this.activeBlock<this.blocks.length-2&&Date.now()-this.userInteractionLastTime>5e3&&this.screenWidth>768&&(this.setActiveBlock("down"),this.scrollToBlock())})),e.player.setLoadedCallback((()=>{var t=e.player.video.parentNode.parentNode;t.classList.add("hero--loaded"),t.querySelector(".subtitle").addEventListener("transitionend",(()=>{t.classList.add("hero--intro-animation-done")}))}))}))}onBlockEnters(e){this.activeBlock=e&&parseInt(e.getAttribute("data-homepage-block")-1,10),e.querySelector(".hero").classList.add("hero--onscreen"),e.querySelector(".hero").classList.remove("hero--offscreen-up"),e.querySelector(".hero").classList.remove("hero--offscreen-down"),e.querySelector(".hero").classList.remove("hero--offscreen"),this.setPager()}onBlockExits(e){e.querySelector(".hero").classList.remove("hero--onscreen"),e.querySelector(".hero").classList.add("hero--offscreen-".concat(this.lastDirection)),e.querySelector(".hero").classList.add("hero--offscreen")}onScroll(e){var t=Date.now(),i=Math.abs(this.lastScrollEvent-t),n=e.deltaY<0?"up":"down";return this.lastScrollEvent=t,this.userInteractionLastTime=t,!(i<50||this.scrollDisabled)&&(this.setActiveBlock(n),this.scrollToBlock(),!0)}setActiveBlock(e){this.lastDirection=e,"up"===e?this.activeBlock--:this.activeBlock++,this.activeBlock<0&&(this.activeBlock=0),this.activeBlock>this.blocks.length-1&&(this.activeBlock=this.blocks.length-1)}scrollToBlock(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.activeBlock,t=!1,i=e;!1===this.animationInProgress&&(i===this.blocks.length-1&&(i=this.blocks.length-2,t=!0),this.pager&&(t&&null!==this.emissionBlock?this.pager.classList.add("pager--hidden"):this.pager.classList.remove("pager--hidden")),this.animationInProgress=!0,(0,c.A)(this.blocks[i],{duration:800,easing:d.ED,offset:t?this.footerHeight:0,callback:()=>{this.activeBlock=t?i+1:i,this.activeBlockBeforeFooter=i===this.blocks.length-2,this.animationInProgress=!1}}))}getPlayerIndex(e){var t=e.parentNode;return parseInt(Array.prototype.indexOf.call(t.children,e)-1,10)}setPager(){n(this.pager.querySelectorAll("li"),(e=>{e.classList.remove("pager__button--active"),parseInt(e.getAttribute("data-target"),10)===this.activeBlock+1&&e.classList.add("pager__button--active")}))}disableScroll(){this.scrollDisabled=!0}enabledScroll(){this.scrollDisabled=!1}setFooterHeight(e){this.footerHeight=e}}},47304:(e,t,i)=>{"use strict";i.d(t,{A:()=>p});var n,o,s,r,a,c,l,h,d,u=i(7350),f=i(37503),v=!1;r=window,a=document,c=a.documentElement,l=a.getElementsByTagName("body")[0],h=r.innerWidth||c.clientWidth||l.clientWidth,d=r.innerHe
2ight||c.clientHeight||l.clientHeight,!1===v&&(v=!0,window.addEventListener("resize",u((()=>{(()=>{var e=window,t=document,i=t.documentElement,o=t.getElementsByTagName("body")[0],s=e.innerWidth||i.clientWidth||o.clientWidth,r=e.innerHeight||i.clientHeight||o.clientHeight;n.window.width=s,n.window.height=r})()}),50),!!f.HE&&{capture:!1,passive:!0}));const p=n={connection:navigator.connection?navigator.connection:"unknown",pixelRatio:window.devicePixelRatio,scrollbarWidth:(s=document.createElement("div"),s.classList.add("scrollbar-measure"),document.body.appendChild(s),o=s.offsetWidth-s.clientWidth,document.body.removeChild(s),o),window:{width:h,height:d}}},58398:(e,t,i)=>{"use strict";function n(e,t,i,n){return i*Math.sin(e/n*(2*Math.PI)-Math.PI/2)+i+t}function o(e,t,i,n){return(e/=n/2)<1?i/2*e*e+t:-i/2*(--e*(e-2)-1)+t}function s(e,t,i,n){return i*((e=e/n-1)*e*e+1)+t}function r(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t}function a(e,t,i,n){return-i*Math.cos(e/n*(Math.PI/2))+i+t}function c(e,t,i,n){return i*Math.sin(e/n*(Math.PI/2))+t}function l(e,t,i,n){return e==n?t+i:i*(1-Math.pow(2,-10*e/n))+t}function h(e,t,i,n){return 0==e?t:e==n?t+i:(e/=n/2)<1?i/2*Math.pow(2,10*(e-1))+t:i/2*(2-Math.pow(2,-10*--e))+t}i.d(t,{ED:()=>c,ME:()=>r,dV:()=>o,e2:()=>h,lu:()=>l,p2:()=>a,p_:()=>s,z1:()=>n})},9346:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(58398);const o=(()=>{var e,t,i,o,s,r,a,c,l,h,d,u;function f(e){return e.getBoundingClientRect().top+t}function v(i){l||(l=i),d=s(h=i-l,t,a,c),window.scrollTo(0,d),h<c?window.requestAnimationFrame(v):(window.scrollTo(0,t+a),e&&r&&(e.setAttribute("tabindex","-1"),e.focus()),"function"==typeof u&&u(),l=!1)}return function(l){var h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(c=h.duration||1e3,o=h.offset||0,u=h.callback,s=h.easing||n.dV,r=h.a11y||!1,t=window.scrollY||window.pageYOffset,typeof l){case"number":e=void 0,r=!1,i=t+l;break;case"object":i=f(e=l);break;case"string":e=document.querySelector(l),i=f(e)}switch(a=i-t+o,typeof h.duration){case"number":c=h.duration;break;case"function":c=h.duration(a)}window.requestAnimationFrame(v)}})()}}]);

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.