{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/animation/eventBus/EventBus.ts","webpack://@verndale/toolkit/./src/js/animation/eventBus/index.ts","webpack://@verndale/toolkit/./src/js/helpers/index.ts","webpack://@verndale/toolkit/./src/js/helpers/variables.ts","webpack://@verndale/toolkit/./src/js/modules/featuredCallToActions.ts","webpack://@verndale/toolkit/./node_modules/@motionone/dom/dist/animate/create-animate.es.js","webpack://@verndale/toolkit/./node_modules/@motionone/dom/dist/animate/index.es.js","webpack://@verndale/toolkit/./node_modules/motion/dist/animate.es.js"],"names":["EventBus","subscriptions","eventType","callback","id","arg","key","_EventBus","EventBusSingleton","debounce","wait","timerId","args","darkColorPalette","lightColorPalette","getRandomColor","background","breakpoints","FeaturedCallToActions","Component","el","__publicField","duration","animate","progress","createAnimate","AnimatePolyfill","elements","keyframes","options","numElements","animationFactories","i","element","valueOptions","animation","animateProgress","target","keyframesOrOptions"],"mappings":"wIAiBA,SAASA,GAAW,CAClB,MAAMC,EAA+B,CAAC,EAyBtC,MAAO,CAAE,UAvBS,CAACC,EAAmBC,IAAyB,CAC7D,MAAMC,EAAK,OAAO,IAAI,EACtB,OAAKH,EAAcC,KAAYD,EAAcC,GAAa,CAAC,GAC3DD,EAAcC,GAAWE,GAAMD,EACxB,CACL,YAAa,UAAuB,CAClC,OAAOF,EAAcC,GAAWE,GAE9B,OAAO,sBAAsBH,EAAcC,EAAU,EAAE,SAAW,GAElE,OAAOD,EAAcC,EAEzB,CACF,CACF,EASoB,QAPJ,CAACA,EAAmBG,IAAgB,CAC9C,CAACJ,EAAcC,IACnB,OAAO,sBAAsBD,EAAcC,EAAU,EAAE,QAAQI,GAC7DL,EAAcC,GAAWI,GAAKD,CAAG,CACnC,CACF,CAE4B,CAC9B,CAEA,QAAeL,EC5CF,EAAWO,KACXC,EAAoB,IAAID,C,sDCC9B,MAAME,EAAW,CAACN,EAAmCO,IAAiB,CAC3E,IAAIC,EAEJ,MAAO,IAAIC,IAAoB,CAC7B,aAAaD,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EAAS,Q,EAC7B,KAAU,QAAQG,CAAW,EAAG,4BAA4B,G,EAC5D,KAAU,QAAQF,CAAS,EAAG,uBAAuB,EAIrD,MAAMG,EAAqB,CAAC,EAC5B,QAASC,EAAI,EAAGA,EAAIF,EAAaE,IAAK,CAClC,MAAMC,EAAUN,EAASK,GACzB,UAAW1B,KAAOsB,EAAW,CACzB,MAAMM,G,EAAe,KAAWL,EAASvB,CAAG,EAC5C4B,EAAa,O,EAAQ,MAAcA,EAAa,MAAOF,EAAGF,CAAW,EACrE,MAAMK,G,EAAY,KAAaF,EAAS3B,EAAKsB,EAAUtB,GAAM4B,EAAcR,CAAe,EAC1FK,EAAmB,KAAKI,CAAS,CACrC,CACJ,CACA,O,EAAO,KAAaJ,EAAoBF,EAUxCA,EAAQ,QAAQ,CACpB,CACJ,CCnCA,MAAMN,EAAUE,EAAc,GAAS,E,eCCvC,SAASW,EAAgBC,EAAQR,EAAU,CAAC,EAAG,CAC3C,O,EAAO,KAAa,CAChB,IAAM,CACF,MAAMM,EAAY,IAAI,IAAUE,EAAQ,CAAC,EAAG,CAAC,EAAGR,CAAO,EACvD,OAAAM,EAAU,SAAS,MAAM,IAAM,CAAE,CAAC,EAC3BA,CACX,CACJ,EAAGN,EAASA,EAAQ,QAAQ,CAChC,CACA,SAAS,EAAQQ,EAAQC,EAAoBT,EAAS,CAElD,Q,EADgB,KAAWQ,CAAM,EAAID,EAAkBb,GACxCc,EAAQC,EAAoBT,CAAO,CACtD,C","file":"scripts/6192.3c73ffd08f8043acb235.js","sourcesContent":["declare class EventBus {\n constructor();\n subscribe(\n eventType: string,\n callback: () => void\n ): {\n unsubscribe: () => void;\n };\n publish(eventType: string, arg?: symbol): void;\n}\n\nexport type Subscriptions = {\n [key: string]: {\n [key: symbol]: (arg: symbol) => void;\n };\n};\n\nfunction EventBus() {\n const subscriptions: Subscriptions = {};\n\n const subscribe = (eventType: string, callback: () => void) => {\n const id = Symbol('id');\n if (!subscriptions[eventType]) subscriptions[eventType] = {};\n subscriptions[eventType][id] = callback;\n return {\n unsubscribe: function unsubscribe() {\n delete subscriptions[eventType][id];\n if (\n Object.getOwnPropertySymbols(subscriptions[eventType]).length === 0\n ) {\n delete subscriptions[eventType];\n }\n }\n };\n };\n\n const publish = (eventType: string, arg: symbol) => {\n if (!subscriptions[eventType]) return;\n Object.getOwnPropertySymbols(subscriptions[eventType]).forEach(key =>\n subscriptions[eventType][key](arg)\n );\n };\n\n return { subscribe, publish };\n}\n\nexport default EventBus;\n","import _EventBus from './EventBus';\n\nexport const EventBus = _EventBus;\nexport const EventBusSingleton = new _EventBus();\n","// /**\n// * debounce function\n// * Delays the processing of the event\n// */\nexport const debounce = (callback: (args: unknown) => void, wait: number) => {\n let timerId: ReturnType;\n\n return (...args: [unknown]) => {\n clearTimeout(timerId);\n timerId = setTimeout(() => {\n callback(...args);\n }, wait);\n };\n};\n\ninterface IColorPalette {\n name: string;\n code: string;\n}\n\nexport const darkColorPalette: Array = [\n { name: 'orange', code: '#f47920' },\n { name: 'yellow', code: '#f4b450' },\n { name: 'green', code: '#0f9d58' },\n { name: 'light-blue', code: '#009cde' }\n];\n\nexport const lightColorPalette: Array = [\n { name: 'red', code: '#da291c' },\n { name: 'purple', code: '#492d8c' },\n { name: 'blue', code: '#2e67b2' },\n { name: 'orange', code: '#f47920' },\n { name: 'yellow', code: '#f4b450' },\n { name: 'green', code: '#0f9d58' },\n { name: 'light-blue', code: '#009cde' }\n];\n\nexport const getRandomColor = (\n background: 'light' | 'dark' = 'light'\n): IColorPalette => {\n if (background === 'light') {\n const lightRandomColor =\n lightColorPalette[Math.floor(Math.random() * lightColorPalette.length)];\n return lightRandomColor;\n }\n\n const darkRandomColor =\n darkColorPalette[Math.floor(Math.random() * darkColorPalette.length)];\n return darkRandomColor;\n};\n","// /**\n// * Key code list object\n// */\nexport const breakpoints = {\n mobile: 360,\n mobileLarge: 480,\n tablet: 768,\n tabletLandscape: 1024,\n desktop: 1280,\n wide: 1440\n};\n","import { Component } from '@verndale/core';\nimport { animate, AnimationControls } from 'motion';\nimport { EventBusSingleton } from '../animation/eventBus';\nimport { debounce } from '../helpers';\nimport { breakpoints } from '../helpers/variables';\n\nclass FeaturedCallToActions extends Component {\n MOTION_ZERO_DURATION = 0.000001;\n mainTimeline: AnimationControls | undefined;\n reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');\n initialDelay = 1;\n breakpointTabletLandscape = window.matchMedia(\n `(min-width: ${breakpoints.tabletLandscape}px)`\n );\n breakpointTablet = window.matchMedia(`(min-width: ${breakpoints.tablet}px)`);\n breakpointWide = window.matchMedia(`(min-width: ${breakpoints.wide}px)`);\n viewportWidth = window.innerWidth;\n hasMastheadPlayed: string | null;\n\n constructor(el: HTMLElement) {\n super(el);\n this.hasMastheadPlayed = localStorage.getItem(\n 'manhattan_masthead-animation'\n );\n if (\n !this.reducedMotion.matches &&\n this.breakpointTablet.matches &&\n !this.hasMastheadPlayed\n ) {\n this.setInitialStyles();\n } else {\n (this.dom.imageContainer as HTMLElement).style.setProperty(\n '--clip',\n `${this.breakpointTabletLandscape.matches ? 160 : 0}px`\n );\n }\n\n if (!this.hasMastheadPlayed) {\n if (EventBusSingleton && this.dom.introAnimation) {\n EventBusSingleton.subscribe(\n 'introAnimationOverlay:hide',\n this.animateImage.bind(this)\n );\n } else {\n this.animateImage();\n }\n }\n }\n\n setupDefaults() {\n this.dom = {\n el: this.el,\n callToActionsBlock: this.el.querySelector(\n '.featured-call-to-actions__info-block'\n ),\n imageContainer: this.el.querySelector(\n '.featured-call-to-actions__image-container'\n ),\n image: this.el.querySelector(\n '.featured-call-to-actions__image-container picture'\n ),\n introAnimation: document.querySelector(\n '.intro-animation-overlay'\n )\n };\n }\n\n addListeners() {\n window.addEventListener(\n 'resize',\n debounce(this.handlePageResize.bind(this), 100)\n );\n }\n\n handlePageResize() {\n if (window.innerWidth !== this.viewportWidth) {\n this.setInitialStyles();\n this.animateImage(this.MOTION_ZERO_DURATION);\n this.viewportWidth = window.innerWidth;\n }\n }\n\n setInitialStyles() {\n (this.dom.imageContainer as HTMLElement).style.setProperty(\n '--clip',\n '100%'\n );\n }\n\n animateImage(duration?: number) {\n animate(\n progress => {\n (this.dom.imageContainer as HTMLElement).setAttribute(\n 'style',\n `--clip: calc(${100 - progress * 100}% + ${\n this.breakpointTabletLandscape.matches ? 160 : 0\n }px);`\n );\n },\n {\n delay: this.initialDelay,\n duration: duration ? duration : 0.75\n }\n );\n animate(\n this.dom.image as HTMLElement,\n {\n scale: [1.2, 1]\n },\n {\n delay: this.initialDelay,\n duration: duration ? duration : 1.25\n }\n );\n }\n}\n\nexport default FeaturedCallToActions;\n","import { invariant } from 'hey-listen';\nimport { animateStyle } from './animate-style.es.js';\nimport { getOptions } from './utils/options.es.js';\nimport { resolveElements } from '../utils/resolve-elements.es.js';\nimport { withControls } from './utils/controls.es.js';\nimport { resolveOption } from '../utils/stagger.es.js';\n\nfunction createAnimate(AnimatePolyfill) {\n return function animate(elements, keyframes, options = {}) {\n elements = resolveElements(elements);\n const numElements = elements.length;\n invariant(Boolean(numElements), \"No valid element provided.\");\n invariant(Boolean(keyframes), \"No keyframes defined.\");\n /**\n * Create and start new animations\n */\n const animationFactories = [];\n for (let i = 0; i < numElements; i++) {\n const element = elements[i];\n for (const key in keyframes) {\n const valueOptions = getOptions(options, key);\n valueOptions.delay = resolveOption(valueOptions.delay, i, numElements);\n const animation = animateStyle(element, key, keyframes[key], valueOptions, AnimatePolyfill);\n animationFactories.push(animation);\n }\n }\n return withControls(animationFactories, options, \n /**\n * TODO:\n * If easing is set to spring or glide, duration will be dynamically\n * generated. Ideally we would dynamically generate this from\n * animation.effect.getComputedTiming().duration but this isn't\n * supported in iOS13 or our number polyfill. Perhaps it's possible\n * to Proxy animations returned from animateStyle that has duration\n * as a getter.\n */\n options.duration);\n };\n}\n\nexport { createAnimate };\n","import { Animation } from '@motionone/animation';\nimport { createAnimate } from './create-animate.es.js';\n\nconst animate = createAnimate(Animation);\n\nexport { animate };\n","import { animate as animate$1, withControls } from '@motionone/dom';\nimport { isFunction } from '@motionone/utils';\nimport { Animation } from '@motionone/animation';\n\nfunction animateProgress(target, options = {}) {\n return withControls([\n () => {\n const animation = new Animation(target, [0, 1], options);\n animation.finished.catch(() => { });\n return animation;\n },\n ], options, options.duration);\n}\nfunction animate(target, keyframesOrOptions, options) {\n const factory = isFunction(target) ? animateProgress : animate$1;\n return factory(target, keyframesOrOptions, options);\n}\n\nexport { animate, animateProgress };\n"],"sourceRoot":""}