{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/helpers/index.ts","webpack://@verndale/toolkit/./src/js/modules/contentWithMediaRow.ts"],"names":["debounce","callback","wait","timerId","args","darkColorPalette","lightColorPalette","getRandomColor","background","ContentWithMediaRow","Component","el","__publicField","_a","_b","randomColor"],"mappings":"2JAIO,MAAMA,EAAW,CAACC,EAAmCC,IAAiB,CAC3E,IAAIC,EAEJ,MAAO,IAAIC,IAAoB,CAC7B,aAAaD,CAAO,EACpBA,EAAU,WAAW,IAAM,CACzBF,EAAS,GAAGG,CAAI,CAClB,EAAGF,CAAI,CACT,CACF,EAOaG,EAAyC,CACpD,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,aAAc,KAAM,SAAU,CACxC,EAEaC,EAA0C,CACrD,CAAE,KAAM,MAAO,KAAM,SAAU,EAC/B,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,OAAQ,KAAM,SAAU,EAChC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,SAAU,KAAM,SAAU,EAClC,CAAE,KAAM,QAAS,KAAM,SAAU,EACjC,CAAE,KAAM,aAAc,KAAM,SAAU,CACxC,EAEaC,EAAiB,CAC5BC,EAA+B,UAE3BA,IAAe,QAEfF,EAAkB,KAAK,MAAM,KAAK,OAAO,EAAIA,EAAkB,MAAM,GAKvED,EAAiB,KAAK,MAAM,KAAK,OAAO,EAAIA,EAAiB,MAAM,E,+OC5CvE,MAAMI,UAA4BC,WAAU,CAG1C,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,EAHVC,EAAA,kBAAa,IAIX,KAAK,WAAa,KAAK,GAAG,QAAQ,gBAAkB,OAChD,KAAK,YAAY,KAAK,oBAAoB,CAChD,CAEA,eAAgB,CACd,KAAK,IAAM,CACT,QAAS,KAAK,GAAG,cAA2B,UAAU,EACtD,aAAc,KAAK,GAAG,cAA2B,gBAAgB,CACnE,CACF,CAEA,qBAAsB,CAnBxB,IAAAC,EAAAC,EAoBI,MAAMC,G,EAAcR,MAAe,MAAM,GAExCM,EAAA,KAAK,IAAI,UAAT,MAAAA,EAAqC,UAAU,IAC9C,YAAYE,EAAY,WAAW,GAEpCD,EAAA,KAAK,IAAI,eAAT,MAAAA,EAA0C,UAAU,IACnD,kBAAkBC,EAAY,WAAW,CAE7C,CACF,CAEA,QAAeN,C","file":"scripts/2927.06e2c262251450ed49e0.js","sourcesContent":["// /**\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","import { Component } from '@verndale/core';\nimport { getRandomColor } from '../helpers';\n\nclass ContentWithMediaRow extends Component {\n decoration = false;\n\n constructor(el: HTMLElement) {\n super(el);\n this.decoration = this.el.dataset.addDecoration === 'true';\n if (this.decoration) this.generateRandomColor();\n }\n\n setupDefaults() {\n this.dom = {\n picture: this.el.querySelector('.picture'),\n vidyardVideo: this.el.querySelector('.vidyard-video')\n };\n }\n\n generateRandomColor() {\n const randomColor = getRandomColor('dark');\n\n (this.dom.picture as HTMLDivElement)?.classList.add(\n `picture--${randomColor.name}-glow`\n );\n (this.dom.vidyardVideo as HTMLDivElement)?.classList.add(\n `vidyard-video--${randomColor.name}-glow`\n );\n }\n}\n\nexport default ContentWithMediaRow;\n"],"sourceRoot":""}