{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/SubNavigation/Horizontal.tsx","webpack:///./Avensia.Common/Features/Shared/Page/index.tsx","webpack:///./Avensia.Common/Features/Shared/Breadcrumbs/index.tsx","webpack:///./Avensia.Common/Features/Shared/use-active-element-in-view.ts","webpack:///./Avensia.Common/Features/Shared/Breadcrumbs/ScrollableBreadcrumbs.tsx"],"names":["props","createElement","Fragment","Base","List","row","items","map","item","SubMenuItemMobile","key","url","activeItem","urlA","urlB","host","pathname","Divider","Item","Current","Sibling","productCount","wasPreviouslyActive","selectedItem","tabNameTestId","split","pop","current","scrollIntoView","inline","block","ref","el","to","name","ProductCount","display","justifyContent","isMobile","padding","y","div","overflow","WebkitOverflowScrolling","margin","top","bottom","borderBottom","width","style","color","Link","position","textDecoration","x","whiteSpace","fontWeight","SemiBold","content","left","span","StrictPage","breadcrumbs","headerContent","topContent","aboveTheFoldContent","belowTheFoldContent","restProps","isCompact","appearance","Default","Gap","MobileBreadcrumbs","Breadcrumbs","Object","assign","_a","children","subNavigation","prioritizedSubContent","unprioritizedSubContent","passProps","hasSubContent","layout","PageLayout","None","Horizontal","OneToFour","css","__$hoisted_o0","ScrollableBreadcrumbs","right","marginTop","presentUrl","currentItemRef","isActive","elementRef","useActiveElementInView","length","setElementRef","text","index","isCurrent","Parent","Anchor","height","fontSize","flexWrap","breadcrumbStyled","Li","siteTheme","linkHoverColor"],"mappings":";sNAUe,mBAAO,SAAuBA,GACzC,OAAQ,IAAMC,cAAc,IAAMC,SAAU,KACxC,IAAMD,cAAcE,EAAM,KACtB,IAAMF,cAAcG,EAAM,CAAEC,KAAK,GAAQL,EAAMM,MAAMC,KAAIC,IACrD,OAAQ,IAAMP,cAAcQ,EAAmB,CAAEC,IAAKF,EAAKG,IAAKH,KAAMA,EAAMI,YAPrDC,EAOwF,IAAI,IAAKL,EAAKG,KAPhGG,EAOsG,cANxID,EAAKE,OAASD,EAAKC,MAAQF,EAAKG,WAAaF,EAAKE,YADtD,IAA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AQC,eAAe,CAAEC,OAAQ,SAAUC,MAAO,YAEnER,EAAoBK,QAAUf,IAC/B,CAACA,IACI,IAAMX,cAAc,KAAM,CAAE8B,IAAKC,IAC7BpB,IACAW,EAAaI,QAAUK,KAG/B,IAAM/B,cAAciB,EAAM,CAAEe,GAAIzB,EAAKG,IAAK,eAAgBa,GAAiBhB,EAAK4F,QAElFhG,EAAO,YAAO,IAAI,CACpBgC,QAAS,OACTC,eAAgB,EAAGC,cAAgBA,EAAW,aAAe,SAC7DC,QAAS,CAAEC,EAAG,QAEZrC,EAAO,IAAOsC,IAAI,CACpBC,SAAU,OACVC,wBAAyB,QACzBC,OAAQ,CAAEJ,EAAG,QAEXpB,EAAU,YAAO,IAAM,YAAoB,CAC7CgC,SAAU,WACVF,MAAO,UACPG,eAAgB,OAChBE,WAAY,SACZ,SAAU,CACNG,QAAS,MACTnB,QAAS,CACLe,EAAG,MAEPC,WAAY,QAEjB,CAAEL,MAAO,QACN/B,EAAU,YAAOC,EAAS,CAC5B8B,MAAO,KACP,UAAW,CACPQ,QAAS,KACTN,SAAU,WACVP,IAAK,gBAAgB,aAAa,OAClCc,KAAM,EACNX,MAAO","file":"assets/0.chunk.b72e142f2d0752b72048.js","sourcesContent":["import React, { useRef, useLayoutEffect } from 'react';\r\nimport { styled } from '@glitz/react';\r\nimport { currentUrl, URLX } from '@avensia/scope';\r\nimport { Ul } from 'Shared/Generic';\r\nimport { createLinkDecorator } from 'Shared/Generic/A';\r\nimport Link from 'Shared/Link';\r\nimport { medium, primary, small, placeholderGrey, thin, thicker, pixelsToUnit, FontWeight, grey30 } from 'Shared/Style';\r\nexport function equalsUrlWithoutParams(urlA, urlB) {\r\n return urlA.host === urlB.host && urlA.pathname === urlB.pathname;\r\n}\r\nexport default styled(function SubNavigation(props) {\r\n return (React.createElement(React.Fragment, null,\r\n React.createElement(Base, null,\r\n React.createElement(List, { row: true }, props.items.map(item => {\r\n return (React.createElement(SubMenuItemMobile, { key: item.url, item: item, activeItem: equalsUrlWithoutParams(new URLX(item.url), currentUrl()) }));\r\n }))),\r\n React.createElement(Divider, null)));\r\n});\r\nconst SubMenuItemMobile = ({ item, activeItem }) => {\r\n const Item = activeItem ? Current : Sibling;\r\n const productCount = 'productCount' in item && item.productCount;\r\n const wasPreviouslyActive = useRef(false);\r\n const selectedItem = useRef(null);\r\n const tabNameTestId = item.url.split('/').pop();\r\n useLayoutEffect(() => {\r\n if (!wasPreviouslyActive.current && activeItem) {\r\n selectedItem.current.scrollIntoView({ inline: 'center', block: 'nearest' });\r\n }\r\n wasPreviouslyActive.current = activeItem;\r\n }, [activeItem]);\r\n return (React.createElement(\"li\", { ref: el => {\r\n if (activeItem) {\r\n selectedItem.current = el;\r\n }\r\n } },\r\n React.createElement(Item, { to: item.url, \"data-test-id\": tabNameTestId },\r\n item.name,\r\n productCount && React.createElement(ProductCount, null, ` (${productCount})`))));\r\n};\r\nconst List = styled(Ul, {\r\n display: 'flex',\r\n justifyContent: ({ isMobile }) => (isMobile ? 'flex-start' : 'center'),\r\n padding: { y: medium },\r\n});\r\nconst Base = styled.div({\r\n overflow: 'auto',\r\n WebkitOverflowScrolling: 'touch',\r\n margin: { y: small },\r\n});\r\nconst Divider = styled.div({\r\n margin: { top: -14, bottom: small },\r\n borderBottom: { width: thin, style: 'solid', color: grey30 },\r\n});\r\nconst Sibling = styled(Link, createLinkDecorator({\r\n position: 'relative',\r\n color: 'inherit',\r\n textDecoration: 'none',\r\n padding: { x: medium },\r\n whiteSpace: 'nowrap',\r\n}, { color: primary }));\r\nconst Current = styled(Sibling, {\r\n fontWeight: FontWeight.SemiBold,\r\n color: primary,\r\n '::after': {\r\n content: '\"\"',\r\n position: 'absolute',\r\n top: `calc(100% + ${pixelsToUnit(10)})`,\r\n left: 0,\r\n width: '100%',\r\n borderBottom: { width: thicker, style: 'solid', color: primary },\r\n },\r\n});\r\nconst ProductCount = styled.span({\r\n fontWeight: 'normal',\r\n color: placeholderGrey,\r\n});\r\n","import { __rest } from \"tslib\";\r\nimport React, { Fragment } from 'react';\r\nimport { Main, Aside, Basic, Layout as PageLayout, Appearance as PageAppearance, Part } from 'Shared/PageLayout';\r\nimport { useIsCompact } from 'Shared/use-viewport';\r\nimport { small, tiny, huge, medium } from 'Shared/Style';\r\nimport { default as HorizontalSubNavigation } from 'Shared/SubNavigation/Horizontal';\r\nexport { Appearance } from 'Shared/PageLayout';\r\nimport Breadcrumbs from 'Shared/Breadcrumbs';\r\nimport ScrollableBreadcrumbs from 'Shared/Breadcrumbs/ScrollableBreadcrumbs';\r\nimport { styled } from '@glitz/react';\r\n// A `StrictPage` or `Page` component should be the root element to your page\r\nexport const StrictPage = props => {\r\n let { breadcrumbs } = props;\r\n const { headerContent, topContent, aboveTheFoldContent, belowTheFoldContent } = props, restProps = __rest(props, [\"headerContent\", \"topContent\", \"aboveTheFoldContent\", \"belowTheFoldContent\"]);\r\n if ('breadcrumbs' in props) {\r\n // If we get a breadcrumb prop but it's undefined it means that we expect breadcrumbs, but they haven't been loaded\r\n // yet. So we make an empty list to render a placeholder\r\n breadcrumbs = breadcrumbs || [];\r\n }\r\n const isCompact = useIsCompact();\r\n return (React.createElement(Main, null,\r\n headerContent && headerContent,\r\n aboveTheFoldContent && aboveTheFoldContent,\r\n breadcrumbs && (React.createElement(Basic, { appearance: [PageAppearance.Default, PageAppearance.Gap] }, isCompact ?\r\n React.createElement(MobileBreadcrumbs, { items: breadcrumbs || [] }) :\r\n React.createElement(Breadcrumbs, { breadcrumbs: breadcrumbs }))),\r\n topContent && topContent,\r\n React.createElement(Basic, Object.assign({}, restProps)),\r\n belowTheFoldContent && belowTheFoldContent));\r\n};\r\nconst Page = (_a) => {\r\n var { children, subNavigation, prioritizedSubContent, unprioritizedSubContent } = _a, passProps = __rest(_a, [\"children\", \"subNavigation\", \"prioritizedSubContent\", \"unprioritizedSubContent\"]);\r\n const isCompact = useIsCompact();\r\n const hasSubContent = prioritizedSubContent || unprioritizedSubContent;\r\n // Children are keyed to prevent unmount/mount whenever the viewport changes\r\n return isCompact ? (React.createElement(StrictPage, Object.assign({ layout: PageLayout.None }, passProps),\r\n React.createElement(Fragment, { key: \"subcontent\" },\r\n prioritizedSubContent,\r\n subNavigation && (React.createElement(Part, null,\r\n React.createElement(HorizontalSubNavigation, { items: subNavigation }))),\r\n unprioritizedSubContent),\r\n React.createElement(Fragment, { key: \"content\" }, children))) : (React.createElement(StrictPage, Object.assign({ layout: hasSubContent ? PageLayout.OneToFour : PageLayout.None }, passProps),\r\n React.createElement(Fragment, { key: \"content\" },\r\n subNavigation && (React.createElement(Part, null,\r\n React.createElement(HorizontalSubNavigation, { items: subNavigation }))),\r\n children),\r\n React.createElement(Fragment, { key: \"subcontent\" }, hasSubContent && (React.createElement(Aside, { css: __$hoisted_o0 },\r\n prioritizedSubContent,\r\n unprioritizedSubContent)))));\r\n};\r\nexport default Page;\r\nconst MobileBreadcrumbs = styled(ScrollableBreadcrumbs, {\r\n margin: {\r\n top: ({ isCompact }) => (isCompact ? tiny : huge),\r\n bottom: 0,\r\n left: ({ isCompact }) => (isCompact ? medium : 0),\r\n right: ({ isCompact }) => (isCompact ? medium : 0),\r\n },\r\n justifyContent: 'start',\r\n});\r\nconst __$hoisted_o0 = { marginTop: small };\r\n","import React from 'react';\r\nimport { currentUrl, relativeUrl } from '@avensia/scope';\r\nimport { styled } from '@glitz/react';\r\nimport { Ul } from 'Shared/Generic';\r\nimport Link from 'Shared/Link';\r\nimport { small, tiny, gigantic, alternativeTextColor, preserveEmptyDecorator, epsilon, mediaMinMicro, grey05, sourceSansPro, figma, thicker, primary, delta, } from 'Shared/Style';\r\nimport { createLinkDecorator } from 'Shared/Generic/A';\r\nimport { useActiveElementInView } from 'Shared/use-active-element-in-view';\r\nconst Breadcrubms = (props) => {\r\n const presentUrl = relativeUrl(currentUrl());\r\n const currentItemRef = useActiveElementInView(props.breadcrumbs.length > 0);\r\n const setElementRef = (el) => {\r\n currentItemRef.current = el;\r\n };\r\n return (React.createElement(List, { row: true }, props.breadcrumbs.map(({ url, text }, index) => {\r\n const isCurrent = index === props.breadcrumbs.length - 1;\r\n const Item = isCurrent ? Current : Parent;\r\n return (React.createElement(Item, { key: url, ref: isCurrent ? setElementRef : null }, presentUrl === url ? React.createElement(\"span\", null, text) : React.createElement(Anchor, { to: url }, text)));\r\n })));\r\n};\r\nexport default styled(Breadcrubms);\r\nconst List = styled(Ul, preserveEmptyDecorator, {\r\n height: gigantic - tiny,\r\n fontSize: epsilon,\r\n color: alternativeTextColor,\r\n flexWrap: 'wrap',\r\n justifyContent: ({ isMobile }) => (isMobile ? 'center' : 'left'),\r\n margin: {\r\n top: ({ isCompact }) => (isCompact ? thicker : figma),\r\n bottom: ({ isCompact }) => (isCompact ? small : figma),\r\n },\r\n ['@media ' + mediaMinMicro]: {\r\n flexWrap: 'nowrap',\r\n whiteSpace: 'nowrap',\r\n WebkitOverflowScrolling: 'touch',\r\n },\r\n});\r\nconst breadcrumbStyled = styled({\r\n display: 'inline-block',\r\n padding: { y: small },\r\n});\r\nconst Parent = styled(styled.Li, breadcrumbStyled, sourceSansPro(delta), {\r\n ':after': {\r\n content: '\" / \"',\r\n whiteSpace: 'pre',\r\n },\r\n color: grey05,\r\n});\r\nconst Current = styled(styled.Li, breadcrumbStyled, sourceSansPro(delta), {\r\n color: primary,\r\n});\r\nconst Anchor = styled(Link, createLinkDecorator({\r\n color: 'inherit',\r\n textDecoration: 'inherit',\r\n ':hover': { color: ({ siteTheme }) => siteTheme.breadcrumbs.linkHoverColor },\r\n padding: { y: small },\r\n}));\r\n","import { isBrowser } from '@avensia/scope';\r\nimport { useRef, useLayoutEffect } from 'react';\r\nexport function useActiveElementInView(isActive) {\r\n const elementRef = useRef(null);\r\n const wasPreviouslyActive = useRef(false);\r\n useLayoutEffect(() => {\r\n var _a;\r\n if (!wasPreviouslyActive.current && isActive && isBrowser()) {\r\n (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ inline: 'center', block: 'nearest' });\r\n }\r\n wasPreviouslyActive.current = isActive;\r\n }, [elementRef, isActive]);\r\n return elementRef;\r\n}\r\n","import React, { useRef, useLayoutEffect } from 'react';\r\nimport { styled } from '@glitz/react';\r\nimport { Ul } from 'Shared/Generic';\r\nimport { createLinkDecorator } from 'Shared/Generic/A';\r\nimport Link from 'Shared/Link';\r\nimport { medium, primary, small, pixelsToUnit } from 'Shared/Style';\r\nexport default styled(function ScrollableBreadcrumbs(props) {\r\n return (React.createElement(Base, null,\r\n React.createElement(List, { row: true }, props.items.map((item, index) => {\r\n const isCurrent = index === props.items.length - 1;\r\n return React.createElement(SubMenuItemMobile, { key: item.url, item: item, activeItem: isCurrent });\r\n }))));\r\n});\r\nconst SubMenuItemMobile = ({ item, activeItem }) => {\r\n const Item = activeItem ? Current : Sibling;\r\n const wasPreviouslyActive = useRef(false);\r\n const selectedItem = useRef(null);\r\n const tabNameTestId = item.url.split('/').pop();\r\n useLayoutEffect(() => {\r\n if (!wasPreviouslyActive.current && activeItem) {\r\n selectedItem.current.scrollIntoView({ inline: 'center', block: 'nearest' });\r\n }\r\n wasPreviouslyActive.current = activeItem;\r\n }, [activeItem]);\r\n return (React.createElement(\"li\", { ref: el => {\r\n if (activeItem) {\r\n selectedItem.current = el;\r\n }\r\n } },\r\n React.createElement(Item, { to: item.url, \"data-test-id\": tabNameTestId }, item.text)));\r\n};\r\nconst List = styled(Ul, {\r\n display: 'flex',\r\n justifyContent: ({ isMobile }) => (isMobile ? 'flex-start' : 'center'),\r\n padding: { y: medium },\r\n});\r\nconst Base = styled.div({\r\n overflow: 'auto',\r\n WebkitOverflowScrolling: 'touch',\r\n margin: { y: small },\r\n});\r\nconst Sibling = styled(Link, createLinkDecorator({\r\n position: 'relative',\r\n color: 'inherit',\r\n textDecoration: 'none',\r\n whiteSpace: 'nowrap',\r\n ':after': {\r\n content: '\"/\"',\r\n padding: {\r\n x: small,\r\n },\r\n whiteSpace: 'pre',\r\n },\r\n}, { color: primary }));\r\nconst Current = styled(Sibling, {\r\n color: primary,\r\n '::after': {\r\n content: '\"\"',\r\n position: 'absolute',\r\n top: `calc(100% + ${pixelsToUnit(10)})`,\r\n left: 0,\r\n width: '100%',\r\n },\r\n});\r\n"],"sourceRoot":""}