{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/Blocks/Video/VideoBlock.tsx","webpack:///./Avensia.Common/Features/Shared/BoxLayout/index.tsx","webpack:///./Avensia.Common/Features/Shared/Blocks/PaddedBlock.tsx"],"names":["getVideoUrl","videoId","videoSource","VideoIframe","iframe","position","top","left","height","width","VideoBlock","props","Div","css","compose","className","header","for","component","ratio","SixteenToNine","loading","frameBorder","allowFullScreen","allowFullscreen","src","description","SPACING_DEFAULT","SPACING_MOBILE","BOX_ITEM_CLASSNAME","fractions","spacingDefaulter","value","currentBreakpoint","Tiny","isThin","fraction","Column","div","display","flexDirection","flexGrow","minWidth","Block","sort","entities","a","b","render","children","Children","toArray","this","row","allowSorting","Small","map","entry","element","shift","columns","Micro","reduce","current","item","convert","layout","spacing","spacingBetweenBlocks","flexWrap","margin","xy","wrap","entity","index","isColumn","key","flexBasis","padding","Component","state","BoxLayout","marginTop"],"mappings":"2FAAA,iHAcaA,EAAc,SAACC,EAAiBC,GAC3C,MAAoB,YAAhBA,EACK,2BAA2BD,EACT,UAAhBC,EACF,4BAA4BD,OAD9B,GAKHE,EAAc,IAAOC,OAAO,CAChCC,SAAU,WACVC,IAAK,IACLC,KAAM,IACNC,OAAQ,OACRC,MAAO,SAGHC,EAAa,aAAU,SAACC,GAAoB,OAChD,kBAAC,IAAOC,IAAG,CAACC,IAAKF,EAAMG,UAAWC,UAAW,KAC1C,YAAiBJ,EAAMK,SAAW,kBAAC,IAAW,CAACC,IAAKN,EAAMK,OAAQE,UAAU,OAC7E,kBAAC,IAAW,CAACC,MAAO,IAAMC,cAAeP,IAAG,GAC1C,kBAACV,EAAW,CACVkB,QAAQ,OACRC,YAAY,IACZC,gBAAiB,YAAiBZ,EAAMa,iBACxCC,IAAKzB,EAAY,YAAiBW,EAAMV,SAAU,YAAiBU,EAAMT,iBAG5E,YAAiBS,EAAMe,cAAgB,kBAAC,IAAW,CAACT,IAAKN,EAAMe,kBAIrD,Y,MAZmC,CAAErB,SAAU,a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zC,MAAMyD,qBAAsBhB,KAAKzC,MAAMsB,sBAIvE,EAzBA,CAAwB,IAAM8C,WA6Bf,gBACb,aACE,SAACC,GAA4B,OAC3B/C,kBAAmB+C,EAAM/C,qBAF7B,CAIEgD,K,8DC1NW,kBAAM,GACnBC,UAAW,MACV,MAAqB,CACpBA,UAAW,aAAa,KAE1B,EAAC,MAAoB,CACnBA,UAAW,K","file":"assets/28.chunk.b41b893668ef3cbad72e.js","sourcesContent":["/**\r\n * @ComponentFor VideoBlock\r\n */\r\nimport React from 'react';\r\nimport { styled, StyledProps } from '@glitz/react';\r\nimport { EpiProperty, epiPropertyValue } from '@avensia/scope-episerver';\r\nimport VideoBlockType from './VideoBlock.type';\r\nimport VideoSource from './VideoSource.type';\r\nimport AspectRatio, { Ratio } from './../../AspectRatio';\r\nimport padStyled from 'Shared/Blocks/PaddedBlock';\r\nimport { BOX_ITEM_CLASSNAME } from 'Shared/BoxLayout';\r\n\r\ntype PropType = VideoBlockType & StyledProps;\r\n\r\nexport const getVideoUrl = (videoId: string, videoSource: VideoSource) => {\r\n if (videoSource === 'youTube') {\r\n return `//www.youtube.com/embed/${videoId}`;\r\n } else if (videoSource === 'vimeo') {\r\n return `//player.vimeo.com/video/${videoId}`;\r\n }\r\n};\r\n\r\nconst VideoIframe = styled.iframe({\r\n position: 'absolute',\r\n top: '0',\r\n left: '0',\r\n height: '100%',\r\n width: '100%',\r\n});\r\n\r\nconst VideoBlock = padStyled((props: PropType) => (\r\n \r\n {epiPropertyValue(props.header) && }\r\n \r\n \r\n \r\n {epiPropertyValue(props.description) && }\r\n \r\n));\r\n\r\nexport default VideoBlock;\r\n","import React from 'react';\r\nimport { styled, StyledProps } from '@glitz/react';\r\nimport connect from '../connect';\r\nimport { Breakpoint } from '@avensia/scope';\r\nimport * as style from '../Style';\r\n\r\nexport const SPACING_DEFAULT = style.pixelsToUnit(25);\r\nexport const SPACING_MOBILE = style.pixelsToUnit(15);\r\nexport const BOX_CLASSNAME = 'purefun-box';\r\nexport const BOX_ITEM_CLASSNAME = 'purefun-box-item';\r\n\r\nconst fractions = {\r\n '1:2': 1 / 2,\r\n '1:3': 1 / 3,\r\n '1:4': 1 / 4,\r\n '2:3': 2 / 3,\r\n '3:4': 3 / 4,\r\n};\r\n\r\nexport type LayoutAliasType = keyof typeof fractions;\r\n\r\ntype LayoutColumnType = LayoutAliasType[] & {\r\n 0: LayoutAliasType;\r\n 1: LayoutAliasType[] & {\r\n 0: LayoutAliasType;\r\n 1: LayoutAliasType;\r\n };\r\n};\r\n\r\nexport type LayoutType = LayoutAliasType | LayoutColumnType;\r\n\r\nfunction spacingDefaulter(value: boolean | string, currentBreakpoint: number) {\r\n return value === true ? (currentBreakpoint > Breakpoint.Tiny ? SPACING_DEFAULT : SPACING_MOBILE) : value;\r\n}\r\n\r\nfunction isThin(fraction: number) {\r\n return fraction <= 1 / 3;\r\n}\r\n\r\nconst Column = styled.div({\r\n display: 'flex',\r\n flexDirection: 'column',\r\n flexGrow: 1,\r\n minWidth: 0,\r\n});\r\n\r\nconst Block = styled.div({\r\n flexGrow: 1,\r\n minWidth: 0,\r\n});\r\n\r\ntype BlockEntityType = {\r\n fraction: number;\r\n element: React.ReactNode;\r\n};\r\n\r\ntype ColumnEntityType = {\r\n fraction: number;\r\n columns: BlockEntityType[];\r\n};\r\n\r\nfunction sort(entities: BlockEntityType[]) {\r\n return entities.sort((a, b) => b.fraction - a.fraction);\r\n}\r\n\r\nfunction convert(\r\n row: LayoutType[],\r\n children: React.ReactNode[],\r\n currentBreakpoint: number,\r\n allowSorting?: boolean,\r\n ): (BlockEntityType | ColumnEntityType)[] {\r\n if (currentBreakpoint > Breakpoint.Small) {\r\n return row.map(entry => {\r\n if (typeof entry === 'string') {\r\n return {\r\n fraction: fractions[entry],\r\n element: children.shift(),\r\n };\r\n }\r\n\r\n return {\r\n fraction: fractions[entry[0]],\r\n columns: entry[1].map(entry => ({\r\n fraction: fractions[entry],\r\n element: children.shift(),\r\n })),\r\n };\r\n });\r\n }\r\n\r\n // Flatten all blocks to full or half width\r\n if (currentBreakpoint > Breakpoint.Micro) {\r\n const entities = row.reduce((current, item) => {\r\n if (typeof item === 'string') {\r\n return [\r\n ...current,\r\n {\r\n fraction: isThin(fractions[item]) ? 0.5 : 1,\r\n element: children.shift(),\r\n },\r\n ];\r\n }\r\n\r\n const value = isThin(fractions[item[0]]) ? 0.5 : 1;\r\n return [\r\n ...current,\r\n ...item[1].map(() => ({\r\n fraction: value,\r\n element: children.shift(),\r\n })),\r\n ];\r\n }, []);\r\n\r\n return allowSorting ? sort(entities) : entities;\r\n }\r\n\r\n // Flatten all blocks to full width\r\n const entities = row.reduce(\r\n (current, entry) =>\r\n typeof entry === 'string'\r\n ? [\r\n ...current,\r\n {\r\n fraction: 1,\r\n element: children.shift(),\r\n },\r\n ]\r\n : [\r\n ...current,\r\n ...entry[1].map(() => ({\r\n fraction: 1,\r\n element: children.shift(),\r\n })),\r\n ],\r\n [],\r\n );\r\n\r\n return allowSorting ? sort(entities) : entities;\r\n}\r\n\r\nfunction isColumn(entity: BlockEntityType | ColumnEntityType): entity is ColumnEntityType {\r\n return 'columns' in entity;\r\n}\r\n\r\nfunction wrap(spacingBetweenBlocks: boolean | string, currentBreakpoint: number) {\r\n const spacing = spacingDefaulter(spacingBetweenBlocks, currentBreakpoint);\r\n return (entity: BlockEntityType | ColumnEntityType, index: number): React.ReactNode => {\r\n return isColumn(entity) ? (\r\n \r\n {entity.columns.map(wrap(spacingBetweenBlocks, currentBreakpoint))}\r\n \r\n ) : (\r\n \r\n {entity.element}\r\n \r\n );\r\n };\r\n}\r\n\r\ntype RequiredPropType = {\r\n layout: LayoutType[];\r\n spacingBetweenBlocks?: boolean | string;\r\n allowSorting?: boolean;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n};\r\n\r\ntype ConnectStateType = {\r\n currentBreakpoint: number;\r\n};\r\n\r\ntype PropType = StyledProps & RequiredPropType & ConnectStateType;\r\n\r\nclass BoxLayout extends React.Component {\r\n render() {\r\n const children = React.Children.toArray(this.props.children);\r\n const entities = convert(this.props.layout, children, this.props.currentBreakpoint, this.props.allowSorting);\r\n const spacing = spacingDefaulter(this.props.spacingBetweenBlocks, this.props.currentBreakpoint);\r\n return (\r\n Breakpoint.Small && {\r\n flexWrap: 'nowrap',\r\n }),\r\n }}\r\n className={BOX_CLASSNAME}\r\n >\r\n {entities.map(wrap(this.props.spacingBetweenBlocks, this.props.currentBreakpoint))}\r\n \r\n );\r\n }\r\n}\r\n\r\n\r\n\r\nexport default styled(\r\n connect(\r\n (state): ConnectStateType => ({\r\n currentBreakpoint: state.currentBreakpoint,\r\n }),\r\n )(BoxLayout),\r\n);\r\n","import { styled } from '@glitz/react';\r\nimport { minTinyMediaQuery, minLargeMediaQuery, pixelsToUnit } from 'Shared/Style';\r\nimport { SPACING_DEFAULT, SPACING_MOBILE } from 'Shared/BoxLayout';\r\n\r\nexport default styled({\r\n marginTop: SPACING_MOBILE,\r\n [minLargeMediaQuery]: {\r\n marginTop: pixelsToUnit(40),\r\n },\r\n [minTinyMediaQuery]: {\r\n marginTop: SPACING_DEFAULT,\r\n },\r\n});\r\n"],"sourceRoot":""}