From 152529bde0862a6f45e97c78ab610a8c81a7eeec Mon Sep 17 00:00:00 2001 From: samuelecalamita Date: Wed, 8 May 2024 09:50:36 +0200 Subject: [PATCH] 33 maints refactor (#83) Refactor eds-init --- config.ts | 18 +- ....js => createOptimizedPicture.CyR9tLTg.js} | 4 +- ...=> createOptimizedPicture.CyR9tLTg.js.map} | 2 +- ....DgmLKlDK.js => fetch.service.C1Ie3Sjw.js} | 8 +- dist/__chunks__/fetch.service.C1Ie3Sjw.js.map | 1 + dist/__chunks__/fetch.service.DgmLKlDK.js.map | 1 - dist/__chunks__/state.CJfvw0Ck.js | 6 + dist/__chunks__/state.CJfvw0Ck.js.map | 1 + dist/__chunks__/toClassName.D9HYXfPD.js | 6 - dist/__chunks__/toClassName.D9HYXfPD.js.map | 1 - dist/form/form.js | 4 +- dist/form/form.js.map | 2 +- dist/main/main.js | 14 +- dist/main/main.js.map | 2 +- dist/posts/posts.js | 2 +- scripts/__backup__/aem.js | 43 ++-- src/app/app.types.ts | 8 + src/app/index.ts | 223 ++++++++++++++++++ src/app/init.ts | 29 +++ src/app/tasks/adjustMarkup.ts | 32 +++ src/app/tasks/collectBlocks.ts | 24 ++ src/app/tasks/decorateBlocks.ts | 17 ++ src/app/tasks/decorateButtons.ts | 37 +++ src/app/tasks/decorateImages.ts | 13 + src/app/tasks/decorateTemplateAndTheme.ts | 20 ++ src/app/tasks/initSampleRUM.ts | 17 ++ src/app/tasks/loadBlock.ts | 25 ++ src/app/tasks/loadBlockModules.ts | 28 +++ src/app/tasks/loadBlockStyles.ts | 15 ++ src/app/tasks/loadBlocks.ts | 13 + src/app/tasks/loadCSS.ts | 23 ++ src/app/tasks/loadFonts.ts | 15 ++ src/app/tasks/processSectionMetaData.ts | 26 ++ src/app/tasks/readBlockConfig.ts | 44 ++++ src/app/tasks/sampleRUM.ts | 135 +++++++++++ src/app/tasks/setDocLanguage.ts | 10 + src/app/tasks/setupHlxObj.ts | 16 ++ src/app/tasks/showSection.ts | 7 + src/app/tasks/transformSections.ts | 15 ++ src/app/tasks/waitForLCP.ts | 42 ++++ src/app/utils/getUrlForEndpoint.ts | 13 + src/components/form/form.ts | 1 - .../innerContainer/innerContainer.init.ts | 7 + .../innerContainer/innerContainer.ts | 8 + src/components/sidebar/sidebar.init.ts | 19 ++ src/components/sidebar/sidebar.ts | 1 + src/main.ts | 28 +-- src/services/fetch.service.ts | 12 +- src/services/main.service.ts | 42 ++-- src/services/section.service.ts | 1 + src/utils/getMetadata.ts | 12 +- types/config.d.ts | 4 + types/src/app/app.d.ts | 27 +++ types/src/app/app.types.d.ts | 7 + types/src/app/decorateBodyTag.d.ts | 12 + types/src/app/index.d.ts | 40 ++++ types/src/app/init.d.ts | 1 + types/src/app/setDocLanguage.d.ts | 1 + types/src/app/setupHlxObj.d.ts | 1 + types/src/app/tasks/adjustMarkup.d.ts | 10 + types/src/app/tasks/collectBlocks.d.ts | 11 + types/src/app/tasks/decorateBlocks.d.ts | 5 + types/src/app/tasks/decorateBodyTag.d.ts | 12 + types/src/app/tasks/decorateButtons.d.ts | 5 + types/src/app/tasks/decorateImages.d.ts | 1 + .../app/tasks/decorateTemplateAndTheme.d.ts | 12 + types/src/app/tasks/initSampleRUM.d.ts | 1 + types/src/app/tasks/loadBlock.d.ts | 6 + types/src/app/tasks/loadBlockModules.d.ts | 2 + types/src/app/tasks/loadBlockStyles.d.ts | 7 + types/src/app/tasks/loadBlocks.d.ts | 6 + types/src/app/tasks/loadCSS.d.ts | 6 + types/src/app/tasks/loadFonts.d.ts | 1 + .../src/app/tasks/processSectionMetaData.d.ts | 1 + types/src/app/tasks/readBlockConfig.d.ts | 1 + types/src/app/tasks/sampleRUM.d.ts | 10 + types/src/app/tasks/setDocLanguage.d.ts | 1 + types/src/app/tasks/setupHlxObj.d.ts | 1 + types/src/app/tasks/showSection.d.ts | 5 + types/src/app/tasks/transformSections.d.ts | 7 + types/src/app/tasks/waitForLCP.d.ts | 6 + types/src/app/utils/getHlxBaseUrl.d.ts | 1 + types/src/app/utils/getUrlForEndpoint.d.ts | 10 + .../innerContainer/innerContainer.d.ts | 1 + .../innerContainer/innerContainer.init.d.ts | 1 + .../src/components/sidebar/sidebar.init.d.ts | 1 + types/src/main.d.ts | 4 +- types/src/services/app.d.ts | 27 +++ types/src/services/app/setupHlxObj.d.ts | 1 + types/src/services/fetch.service.d.ts | 1 - types/src/services/main.service.d.ts | 13 +- types/src/utils/getCodeBasePath.d.ts | 1 + types/src/utils/getMetadata.d.ts | 12 +- 93 files changed, 1255 insertions(+), 121 deletions(-) rename dist/__chunks__/{createOptimizedPicture.Z5VLB_Rl.js => createOptimizedPicture.CyR9tLTg.js} (92%) rename dist/__chunks__/{createOptimizedPicture.Z5VLB_Rl.js.map => createOptimizedPicture.CyR9tLTg.js.map} (99%) rename dist/__chunks__/{fetch.service.DgmLKlDK.js => fetch.service.C1Ie3Sjw.js} (56%) create mode 100644 dist/__chunks__/fetch.service.C1Ie3Sjw.js.map delete mode 100644 dist/__chunks__/fetch.service.DgmLKlDK.js.map create mode 100644 dist/__chunks__/state.CJfvw0Ck.js create mode 100644 dist/__chunks__/state.CJfvw0Ck.js.map delete mode 100644 dist/__chunks__/toClassName.D9HYXfPD.js delete mode 100644 dist/__chunks__/toClassName.D9HYXfPD.js.map create mode 100644 src/app/app.types.ts create mode 100644 src/app/index.ts create mode 100644 src/app/init.ts create mode 100644 src/app/tasks/adjustMarkup.ts create mode 100644 src/app/tasks/collectBlocks.ts create mode 100644 src/app/tasks/decorateBlocks.ts create mode 100644 src/app/tasks/decorateButtons.ts create mode 100644 src/app/tasks/decorateImages.ts create mode 100644 src/app/tasks/decorateTemplateAndTheme.ts create mode 100644 src/app/tasks/initSampleRUM.ts create mode 100644 src/app/tasks/loadBlock.ts create mode 100644 src/app/tasks/loadBlockModules.ts create mode 100644 src/app/tasks/loadBlockStyles.ts create mode 100644 src/app/tasks/loadBlocks.ts create mode 100644 src/app/tasks/loadCSS.ts create mode 100644 src/app/tasks/loadFonts.ts create mode 100644 src/app/tasks/processSectionMetaData.ts create mode 100644 src/app/tasks/readBlockConfig.ts create mode 100644 src/app/tasks/sampleRUM.ts create mode 100644 src/app/tasks/setDocLanguage.ts create mode 100644 src/app/tasks/setupHlxObj.ts create mode 100644 src/app/tasks/showSection.ts create mode 100644 src/app/tasks/transformSections.ts create mode 100644 src/app/tasks/waitForLCP.ts create mode 100644 src/app/utils/getUrlForEndpoint.ts create mode 100644 src/components/innerContainer/innerContainer.init.ts create mode 100644 src/components/innerContainer/innerContainer.ts create mode 100644 src/components/sidebar/sidebar.init.ts create mode 100644 types/src/app/app.d.ts create mode 100644 types/src/app/app.types.d.ts create mode 100644 types/src/app/decorateBodyTag.d.ts create mode 100644 types/src/app/index.d.ts create mode 100644 types/src/app/init.d.ts create mode 100644 types/src/app/setDocLanguage.d.ts create mode 100644 types/src/app/setupHlxObj.d.ts create mode 100644 types/src/app/tasks/adjustMarkup.d.ts create mode 100644 types/src/app/tasks/collectBlocks.d.ts create mode 100644 types/src/app/tasks/decorateBlocks.d.ts create mode 100644 types/src/app/tasks/decorateBodyTag.d.ts create mode 100644 types/src/app/tasks/decorateButtons.d.ts create mode 100644 types/src/app/tasks/decorateImages.d.ts create mode 100644 types/src/app/tasks/decorateTemplateAndTheme.d.ts create mode 100644 types/src/app/tasks/initSampleRUM.d.ts create mode 100644 types/src/app/tasks/loadBlock.d.ts create mode 100644 types/src/app/tasks/loadBlockModules.d.ts create mode 100644 types/src/app/tasks/loadBlockStyles.d.ts create mode 100644 types/src/app/tasks/loadBlocks.d.ts create mode 100644 types/src/app/tasks/loadCSS.d.ts create mode 100644 types/src/app/tasks/loadFonts.d.ts create mode 100644 types/src/app/tasks/processSectionMetaData.d.ts create mode 100644 types/src/app/tasks/readBlockConfig.d.ts create mode 100644 types/src/app/tasks/sampleRUM.d.ts create mode 100644 types/src/app/tasks/setDocLanguage.d.ts create mode 100644 types/src/app/tasks/setupHlxObj.d.ts create mode 100644 types/src/app/tasks/showSection.d.ts create mode 100644 types/src/app/tasks/transformSections.d.ts create mode 100644 types/src/app/tasks/waitForLCP.d.ts create mode 100644 types/src/app/utils/getHlxBaseUrl.d.ts create mode 100644 types/src/app/utils/getUrlForEndpoint.d.ts create mode 100644 types/src/components/innerContainer/innerContainer.d.ts create mode 100644 types/src/components/innerContainer/innerContainer.init.d.ts create mode 100644 types/src/components/sidebar/sidebar.init.d.ts create mode 100644 types/src/services/app.d.ts create mode 100644 types/src/services/app/setupHlxObj.d.ts create mode 100644 types/src/utils/getCodeBasePath.d.ts diff --git a/config.ts b/config.ts index 63ac1584..3c1ed2db 100644 --- a/config.ts +++ b/config.ts @@ -4,16 +4,24 @@ export interface Config { iconsDirPath: string; iconsTypesPath: string; fontsScssPath?: string; + fontsCssPath?: string; lazyStylesScssPath?: string; + lazyStylesCssPath?: string; sidekickLibraryStylesScssPath?: string; + sidekickLibraryStylesCssPath?: string; + lcpBlocks?: string[]; } export const config: Config = { - mainTsPath: 'src/main.ts', - mainScssPath: 'src/styles/sass/main.scss', + mainTsPath: './src/main.ts', + mainScssPath: './src/styles/sass/main.scss', iconsDirPath: './public/icons', iconsTypesPath: './src/types/icons.types.ts', - fontsScssPath: 'src/styles/sass/fonts.scss', - lazyStylesScssPath: 'src/styles/sass/lazy-styles.scss', - sidekickLibraryStylesScssPath: 'src/styles/sass/sidekick-library-styles.scss', + fontsScssPath: './src/styles/sass/fonts.scss', + fontsCssPath: './dist/fonts/fonts.css', + lazyStylesScssPath: './src/styles/sass/lazy-styles.scss', + lazyStylesCssPath: './dist/lazyStyles/lazyStyles.css', + sidekickLibraryStylesScssPath: './src/styles/sass/sidekick-library-styles.scss', + sidekickLibraryStylesCssPath: './dist/sidekickLibraryStyles/sidekickLibraryStyles.css', + lcpBlocks: [], }; diff --git a/dist/__chunks__/createOptimizedPicture.Z5VLB_Rl.js b/dist/__chunks__/createOptimizedPicture.CyR9tLTg.js similarity index 92% rename from dist/__chunks__/createOptimizedPicture.Z5VLB_Rl.js rename to dist/__chunks__/createOptimizedPicture.CyR9tLTg.js index f894ddb9..9086bfea 100644 --- a/dist/__chunks__/createOptimizedPicture.Z5VLB_Rl.js +++ b/dist/__chunks__/createOptimizedPicture.CyR9tLTg.js @@ -1,2 +1,2 @@ -import{F as w,m as u}from"./fetch.service.DgmLKlDK.js";import{i as f}from"./isSidekickLibraryActive.U-fJCMMj.js";class g{async getPlaceHolder(o){try{const c="/placeholder.json",h={cacheOptions:{cacheType:"runtime"}},n=(await w.fetchJson(c,h)).data.find(t=>t.Key===o);if(!n){const t=`PlaceholderService: Placeholder with key ${o} could not be found.`;throw u.error(t),new Error(t)}return n.Text}catch(c){throw u.error("PlaceholderService: Error fetching placeholder data:",c),c}}}const P=new g;function $(){if(!f())return window.location.href;const{location:i}=window.parent,o=new URLSearchParams(i.search);return`${i.origin}${o.get("path")}`}function S(i){if(i.src==="")return;const{src:o,alt:c,eager:h=!1,width:l,height:n,breakpoints:t=[{media:"(min-width: 600px)",width:2e3},{width:750}]}=i,p=new URL(o,$()),d=document.createElement("picture"),{pathname:a}=p,m=a.substring(a.lastIndexOf(".")+1);return t.forEach(r=>{const s=document.createElement("source");r.media&&s.setAttribute("media",r.media),s.setAttribute("type","image/webp"),s.setAttribute("srcset",`${a}?width=${r.width}&format=webply&optimize=medium`),d.appendChild(s)}),t.forEach((r,s)=>{if(st.Key===o);if(!n){const t=`PlaceholderService: Placeholder with key ${o} could not be found.`;throw u.error(t),new Error(t)}return n.Text}catch(c){throw u.error("PlaceholderService: Error fetching placeholder data:",c),c}}}const P=new g;function $(){if(!f())return window.location.href;const{location:i}=window.parent,o=new URLSearchParams(i.search);return`${i.origin}${o.get("path")}`}function S(i){if(i.src==="")return;const{src:o,alt:c,eager:h=!1,width:l,height:n,breakpoints:t=[{media:"(min-width: 600px)",width:2e3},{width:750}]}=i,p=new URL(o,$()),d=document.createElement("picture"),{pathname:a}=p,m=a.substring(a.lastIndexOf(".")+1);return t.forEach(r=>{const s=document.createElement("source");r.media&&s.setAttribute("media",r.media),s.setAttribute("type","image/webp"),s.setAttribute("srcset",`${a}?width=${r.width}&format=webply&optimize=medium`),d.appendChild(s)}),t.forEach((r,s)=>{if(s {\n try {\n const url = '/placeholder.json';\n const options: FetchServiceOptions = {\n cacheOptions: { cacheType: 'runtime' },\n };\n const sheetsResponse = await FetchService.fetchJson>(url, options);\n const placeholderRecord = sheetsResponse.data.find((item: Placeholder): boolean => item.Key === key);\n\n if (!placeholderRecord) {\n const errorMessage = `PlaceholderService: Placeholder with key ${key} could not be found.`;\n DebuggerService.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n return placeholderRecord!.Text;\n } catch (error) {\n DebuggerService.error('PlaceholderService: Error fetching placeholder data:', error);\n throw error;\n }\n }\n}\n\nexport default new PlaceholderService();\n","import { isSidekickLibraryActive } from './isSidekickLibraryActive.ts';\n\n/**\n * Returns the true origin of the current page in the browser.\n * If the page is running in an iframe with srcdoc, the ancestor origin + the path query param is returned.\n * @returns {String} The href of the current page or the href of the block running in the library\n *\n * @example\n * const url = new URL(src, getHref());\n *\n * @remarks\n * Needs to be used when the Sidekick Library Plugin is in use.\n */\nexport function getHref(): string {\n if (!isSidekickLibraryActive()) return window.location.href;\n\n const { location: parentLocation } = window.parent;\n const urlParams = new URLSearchParams(parentLocation.search);\n return `${parentLocation.origin}${urlParams.get('path')}`;\n}\n","import { getHref } from 'Helpers/sidekick/getHref.ts';\n\n/**\n * Represents a breakpoint configuration used in responsive web design.\n *\n * @interface BreakPoint\n * @property {number} [media] - The media query string defining the condition for this breakpoint.\n * @property {number} [width] - The width associated with this breakpoint.\n *\n * @example\n * // Example usage:\n * const exampleBreakPoint: BreakPoint = {\n * media: \"(min-width: 600px)\",\n * width: \"100\"\n * };\n */\ninterface BreakPoint {\n media?: string;\n width?: number;\n}\n\n/**\n * Represents the arguments for creating an optimized picture element.\n *\n * @interface CreateOptimizedPictureArgs\n * @property {string} src - The URL of the image.\n * @property {string} alt - The alternative text for the image.\n * @property {number} width - The width of the image in CSS pixels.\n * @property {number} height - The height of the image in CSS pixels.\n * @property {boolean} [eager] - Whether to load the image immediately.\n * @property {BreakPoint[]} [breakpoints] - The breakpoints for responsive images.\n */\nexport interface CreateOptimizedPictureArgs {\n src: string;\n alt: string;\n width: number;\n height: number;\n eager?: boolean;\n breakpoints?: BreakPoint[];\n}\n\n/**\n * Creates an optimized HTML picture element with responsive image sources and a fallback image.\n *\n * @param {CreateOptimizedPictureArgs} createOptimizedPictureArgs - The arguments for creating the picture element.\n * @returns {HTMLPictureElement} - The created HTML picture element.\n *\n * @example\n * const args = {\n * src: 'image.jpg',\n * alt: 'Example Image',\n * width: '200',\n * height: '150',\n * eager: true,\n * breakpoints: [\n * { media: '(min-width: 600px)', width: '800' },\n * { media: '(min-width: 1200px)', width: '1600' }\n * ]\n * };\n * const pictureElement = createOptimizedPicture(args);\n * document.body.appendChild(pictureElement);\n *\n * @remarks\n * The last breakpoint provided in the `breakpoints` array is used as the source for the fallback image.\n */\nexport function createOptimizedPicture(\n createOptimizedPictureArgs: CreateOptimizedPictureArgs\n): HTMLPictureElement | undefined {\n if (createOptimizedPictureArgs.src === '') return undefined;\n\n const {\n src,\n alt,\n eager = false,\n width,\n height,\n breakpoints = [{ media: '(min-width: 600px)', width: 2000 }, { width: 750 }],\n } = createOptimizedPictureArgs;\n const url = new URL(src, getHref());\n const picture = document.createElement('picture');\n const { pathname } = url;\n const ext = pathname.substring(pathname.lastIndexOf('.') + 1);\n\n // webp\n breakpoints.forEach((breakpoint: BreakPoint): void => {\n const source = document.createElement('source');\n if (breakpoint.media) source.setAttribute('media', breakpoint.media);\n source.setAttribute('type', 'image/webp');\n source.setAttribute('srcset', `${pathname}?width=${breakpoint.width}&format=webply&optimize=medium`);\n picture.appendChild(source);\n });\n\n // fallback\n breakpoints.forEach((breakpoint: Record, index: number): void => {\n if (index < breakpoints.length - 1) {\n const source = document.createElement('source');\n if (breakpoint.media) source.setAttribute('media', breakpoint.media);\n source.setAttribute('srcset', `${pathname}?width=${breakpoint.width}&format=${ext}&optimize=medium`);\n picture.appendChild(source);\n } else {\n const img = document.createElement('img');\n img.setAttribute('loading', eager ? 'eager' : 'lazy');\n img.setAttribute('alt', alt);\n img.setAttribute('width', width.toString());\n img.setAttribute('height', height.toString());\n picture.appendChild(img);\n img.setAttribute('src', `${pathname}?width=${breakpoint.width}&format=${ext}&optimize=medium`);\n }\n });\n\n return picture;\n}\n"],"names":["PlaceholderService","key","url","options","placeholderRecord","FetchService","item","errorMessage","DebuggerService","error","PlaceholderService$1","getHref","isSidekickLibraryActive","parentLocation","urlParams","createOptimizedPicture","createOptimizedPictureArgs","src","alt","eager","width","height","breakpoints","picture","pathname","ext","breakpoint","source","index","img"],"mappings":"iHAKA,MAAMA,CAAmB,CACvB,MAAa,eAAeC,EAA8B,CACpD,GAAA,CACF,MAAMC,EAAM,oBACNC,EAA+B,CACnC,aAAc,CAAE,UAAW,SAAU,CAAA,EAGjCC,GADiB,MAAMC,EAAa,UAAuCH,EAAKC,CAAO,GACpD,KAAK,KAAMG,GAA+BA,EAAK,MAAQL,CAAG,EAEnG,GAAI,CAACG,EAAmB,CAChB,MAAAG,EAAe,4CAA4CN,CAAG,uBACpEO,MAAAA,EAAgB,MAAMD,CAAY,EAC5B,IAAI,MAAMA,CAAY,CAC9B,CAEA,OAAOH,EAAmB,WACnBK,EAAO,CACED,MAAAA,EAAA,MAAM,uDAAwDC,CAAK,EAC7EA,CACR,CACF,CACF,CAEA,MAAeC,EAAA,IAAIV,EChBZ,SAASW,GAAkB,CAChC,GAAI,CAACC,EAAwB,EAAG,OAAO,OAAO,SAAS,KAEvD,KAAM,CAAE,SAAUC,GAAmB,OAAO,OACtCC,EAAY,IAAI,gBAAgBD,EAAe,MAAM,EAC3D,MAAO,GAAGA,EAAe,MAAM,GAAGC,EAAU,IAAI,MAAM,CAAC,EACzD,CC8CO,SAASC,EACdC,EACgC,CAChC,GAAIA,EAA2B,MAAQ,GAAW,OAE5C,KAAA,CACJ,IAAAC,EACA,IAAAC,EACA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ptimizedPicture.CyR9tLTg.js","sources":["../../src/services/placeholder.service.ts","../../src/helpers/sidekick/getHref.ts","../../src/utils/createOptimizedPicture.ts"],"sourcesContent":["import { DebuggerService } from '@kluntje/services';\nimport FetchService, { FetchServiceOptions } from './fetch.service.ts';\nimport { SheetsResponse } from 'Types/sheetResponse.types.ts';\nimport { Placeholder } from 'Types/siteMap.types.ts';\n\nclass PlaceholderService {\n public async getPlaceHolder(key: string): Promise {\n try {\n const url = '/placeholder.json';\n const options: FetchServiceOptions = {\n cacheOptions: { cacheType: 'runtime' },\n };\n const sheetsResponse = await FetchService.fetchJson>(url, options);\n const placeholderRecord = sheetsResponse.data.find((item: Placeholder): boolean => item.Key === key);\n\n if (!placeholderRecord) {\n const errorMessage = `PlaceholderService: Placeholder with key ${key} could not be found.`;\n DebuggerService.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n return placeholderRecord!.Text;\n } catch (error) {\n DebuggerService.error('PlaceholderService: Error fetching placeholder data:', error);\n throw error;\n }\n }\n}\n\nexport default new PlaceholderService();\n","import { isSidekickLibraryActive } from './isSidekickLibraryActive.ts';\n\n/**\n * Returns the true origin of the current page in the browser.\n * If the page is running in an iframe with srcdoc, the ancestor origin + the path query param is returned.\n * @returns {String} The href of the current page or the href of the block running in the library\n *\n * @example\n * const url = new URL(src, getHref());\n *\n * @remarks\n * Needs to be used when the Sidekick Library Plugin is in use.\n */\nexport function getHref(): string {\n if (!isSidekickLibraryActive()) return window.location.href;\n\n const { location: parentLocation } = window.parent;\n const urlParams = new URLSearchParams(parentLocation.search);\n return `${parentLocation.origin}${urlParams.get('path')}`;\n}\n","import { getHref } from 'Helpers/sidekick/getHref.ts';\n\n/**\n * Represents a breakpoint configuration used in responsive web design.\n *\n * @interface BreakPoint\n * @property {number} [media] - The media query string defining the condition for this breakpoint.\n * @property {number} [width] - The width associated with this breakpoint.\n *\n * @example\n * // Example usage:\n * const exampleBreakPoint: BreakPoint = {\n * media: \"(min-width: 600px)\",\n * width: \"100\"\n * };\n */\ninterface BreakPoint {\n media?: string;\n width?: number;\n}\n\n/**\n * Represents the arguments for creating an optimized picture element.\n *\n * @interface CreateOptimizedPictureArgs\n * @property {string} src - The URL of the image.\n * @property {string} alt - The alternative text for the image.\n * @property {number} width - The width of the image in CSS pixels.\n * @property {number} height - The height of the image in CSS pixels.\n * @property {boolean} [eager] - Whether to load the image immediately.\n * @property {BreakPoint[]} [breakpoints] - The breakpoints for responsive images.\n */\nexport interface CreateOptimizedPictureArgs {\n src: string;\n alt: string;\n width: number;\n height: number;\n eager?: boolean;\n breakpoints?: BreakPoint[];\n}\n\n/**\n * Creates an optimized HTML picture element with responsive image sources and a fallback image.\n *\n * @param {CreateOptimizedPictureArgs} createOptimizedPictureArgs - The arguments for creating the picture element.\n * @returns {HTMLPictureElement} - The created HTML picture element.\n *\n * @example\n * const args = {\n * src: 'image.jpg',\n * alt: 'Example Image',\n * width: '200',\n * height: '150',\n * eager: true,\n * breakpoints: [\n * { media: '(min-width: 600px)', width: '800' },\n * { media: '(min-width: 1200px)', width: '1600' }\n * ]\n * };\n * const pictureElement = createOptimizedPicture(args);\n * document.body.appendChild(pictureElement);\n *\n * @remarks\n * The last breakpoint provided in the `breakpoints` array is used as the source for the fallback image.\n */\nexport function createOptimizedPicture(\n createOptimizedPictureArgs: CreateOptimizedPictureArgs\n): HTMLPictureElement | undefined {\n if (createOptimizedPictureArgs.src === '') return undefined;\n\n const {\n src,\n alt,\n eager = false,\n width,\n height,\n breakpoints = [{ media: '(min-width: 600px)', width: 2000 }, { width: 750 }],\n } = createOptimizedPictureArgs;\n const url = new URL(src, getHref());\n const picture = document.createElement('picture');\n const { pathname } = url;\n const ext = pathname.substring(pathname.lastIndexOf('.') + 1);\n\n // webp\n breakpoints.forEach((breakpoint: BreakPoint): void => {\n const source = document.createElement('source');\n if (breakpoint.media) source.setAttribute('media', breakpoint.media);\n source.setAttribute('type', 'image/webp');\n source.setAttribute('srcset', `${pathname}?width=${breakpoint.width}&format=webply&optimize=medium`);\n picture.appendChild(source);\n });\n\n // fallback\n breakpoints.forEach((breakpoint: Record, index: number): void => {\n if (index < breakpoints.length - 1) {\n const source = document.createElement('source');\n if (breakpoint.media) source.setAttribute('media', breakpoint.media);\n source.setAttribute('srcset', `${pathname}?width=${breakpoint.width}&format=${ext}&optimize=medium`);\n picture.appendChild(source);\n } else {\n const img = document.createElement('img');\n img.setAttribute('loading', eager ? 'eager' : 'lazy');\n img.setAttribute('alt', alt);\n img.setAttribute('width', width.toString());\n img.setAttribute('height', height.toString());\n picture.appendChild(img);\n img.setAttribute('src', `${pathname}?width=${breakpoint.width}&format=${ext}&optimize=medium`);\n }\n });\n\n return picture;\n}\n"],"names":["PlaceholderService","key","url","options","placeholderRecord","FetchService","item","errorMessage","DebuggerService","error","PlaceholderService$1","getHref","isSidekickLibraryActive","parentLocation","urlParams","createOptimizedPicture","createOptimizedPictureArgs","src","alt","eager","width","height","breakpoints","picture","pathname","ext","breakpoint","source","index","img"],"mappings":"iHAKA,MAAMA,CAAmB,CACvB,MAAa,eAAeC,EAA8B,CACpD,GAAA,CACF,MAAMC,EAAM,oBACNC,EAA+B,CACnC,aAAc,CAAE,UAAW,SAAU,CAAA,EAGjCC,GADiB,MAAMC,EAAa,UAAuCH,EAAKC,CAAO,GACpD,KAAK,KAAMG,GAA+BA,EAAK,MAAQL,CAAG,EAEnG,GAAI,CAACG,EAAmB,CAChB,MAAAG,EAAe,4CAA4CN,CAAG,uBACpEO,MAAAA,EAAgB,MAAMD,CAAY,EAC5B,IAAI,MAAMA,CAAY,CAC9B,CAEA,OAAOH,EAAmB,WACnBK,EAAO,CACED,MAAAA,EAAA,MAAM,uDAAwDC,CAAK,EAC7EA,CACR,CACF,CACF,CAEA,MAAeC,EAAA,IAAIV,EChBZ,SAASW,GAAkB,CAChC,GAAI,CAACC,EAAwB,EAAG,OAAO,OAAO,SAAS,KAEvD,KAAM,CAAE,SAAUC,GAAmB,OAAO,OACtCC,EAAY,IAAI,gBAAgBD,EA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,SAAU,CAAA,EAC5CE,EAAQ,YAAYM,CAAG,EACnBA,EAAA,aAAa,MAAO,GAAGL,CAAQ,UAAUE,EAAW,KAAK,WAAWD,CAAG,kBAAkB,CAC/F,CAAA,CACD,EAEMF,CACT"} \ No newline at end of file diff --git a/dist/__chunks__/fetch.service.DgmLKlDK.js b/dist/__chunks__/fetch.service.C1Ie3Sjw.js similarity index 56% rename from dist/__chunks__/fetch.service.DgmLKlDK.js rename to dist/__chunks__/fetch.service.C1Ie3Sjw.js index ad0c1f10..ff8caca7 100644 --- a/dist/__chunks__/fetch.service.DgmLKlDK.js +++ b/dist/__chunks__/fetch.service.C1Ie3Sjw.js @@ -1,7 +1,7 @@ -class q{constructor(){this.runtimeCache=new Map}get(t){return this.runtimeCache.get(t)}set(t,n){this.runtimeCache.set(t,n)}has(t){return this.runtimeCache.has(t)}delete(t){this.runtimeCache.delete(t)}}var p={},S;function P(e){return function(...t){return function(n,r,o){return Object.assign(Object.assign({},o),{value:e(o.value,...t)})}}}Object.defineProperty(p,"__esModule",{value:!0});const O=P(function(e,t=0){let n=-1;const r=function(...o){clearTimeout(n),n=window.setTimeout(()=>{e.call(this,...o)},t)};return r.cancel=function(){clearTimeout(n)},r}),Q=P(function(e,t=0){let n,r=[];const o=function(...s){r=s,n===void 0&&(n=window.setTimeout(()=>{n=void 0,e.call(this,...r)},t))};return o.cancel=function(){clearTimeout(n),n=void 0},o});p.debounce=O,S=p.throttle=Q;var i={},x,w;Object.defineProperty(i,"__esModule",{value:!0});const $=(e,t)=>e===null?[]:e instanceof Document||e.shadowRoot===null||e.shadowRoot===void 0?Array.from(e.querySelectorAll(t)):Array.from(e.shadowRoot.querySelectorAll(t)),C=(e,...t)=>{if(e!==void 0&&t.length!==0&&e!==null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.remove(...t)}},f=(e,...t)=>{if(e!==void 0&&t.length!==0&&e!==null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.add(...t)}},M=(e,t)=>e.classList.contains(t);function d(e){return Symbol.iterator in e}function R(e){return"length"in e?e.length>0:!e[Symbol.iterator]().next().done}const T=(e,t,n,r,o)=>{if(e==null||d(e)&&!R(e))return;if(d(e)&&!(e instanceof HTMLElement)){for(const a of e)T(a,t,n,r,o);return}let s;s=typeof t=="string"?t.trim().split(" "):t,s.forEach(a=>{const c=j(e,a,n,r);if(!r.eventBindingMap[c]){const l=n.bind(r);return r.eventBindingMap[c]=l,e.addEventListener(a.trim(),l,o)}})};function j(e,t,n,r){return`${m(e,r)}# +var p={},P;function x(e){return function(...t){return function(n,r,o){return Object.assign(Object.assign({},o),{value:e(o.value,...t)})}}}Object.defineProperty(p,"__esModule",{value:!0});const O=x(function(e,t=0){let n=-1;const r=function(...o){clearTimeout(n),n=window.setTimeout(()=>{e.call(this,...o)},t)};return r.cancel=function(){clearTimeout(n)},r}),Q=x(function(e,t=0){let n,r=[];const o=function(...s){r=s,n===void 0&&(n=window.setTimeout(()=>{n=void 0,e.call(this,...r)},t))};return o.cancel=function(){clearTimeout(n),n=void 0},o});p.debounce=O,P=p.throttle=Q;var i={},R,w;Object.defineProperty(i,"__esModule",{value:!0});const L=(e,t)=>e===null?[]:e instanceof Document||e.shadowRoot===null||e.shadowRoot===void 0?Array.from(e.querySelectorAll(t)):Array.from(e.shadowRoot.querySelectorAll(t)),b=(e,...t)=>{if(e!==void 0&&t.length!==0&&e!==null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.remove(...t)}},f=(e,...t)=>{if(e!==void 0&&t.length!==0&&e!==null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.add(...t)}},C=(e,t)=>e.classList.contains(t);function d(e){return Symbol.iterator in e}function T(e){return"length"in e?e.length>0:!e[Symbol.iterator]().next().done}const j=(e,t,n,r,o)=>{if(e==null||d(e)&&!T(e))return;if(d(e)&&!(e instanceof HTMLElement)){for(const a of e)j(a,t,n,r,o);return}let s;s=typeof t=="string"?t.trim().split(" "):t,s.forEach(a=>{const c=$(e,a,n,r);if(!r.eventBindingMap[c]){const l=n.bind(r);return r.eventBindingMap[c]=l,e.addEventListener(a.trim(),l,o)}})};function $(e,t,n,r){return`${m(e,r)}# ${t.trim()}# ${m(n,r)}# - ${m(r,r)}`.replace(/\n/gm,"").replace(/\s/g,"")}function m(e,t){let n;if(t.eventIdMap.has(e))n=t.eventIdMap.get(e);else{const r="xxxxxxxx".replace(/x/g,D).toLowerCase();t.eventIdMap.set(e,r),n=r}return n}function D(){return(100*Math.random()%36|0).toString(36)}const L=(e,t,n,r,o)=>{if(e==null||d(e)&&!R(e))return;if(d(e)&&!(e instanceof HTMLElement)){for(const a of e)L(a,t,n,r,o);return}let s;s=typeof t=="string"?t.trim().split(" "):t,s.forEach(a=>{const c=j(e,a,n,r),l=r.eventBindingMap[c];l&&(delete r.eventBindingMap[c],e.removeEventListener(a,l,o))})},b=(e,t)=>{$(e,t).forEach(n=>e.removeChild(n))},E=(e,t,n)=>new Promise(r=>{n!==void 0&&setTimeout(()=>r(),n),e.addEventListener(t,()=>r())});i.addClass=f,i.find=(e,t)=>e===null?null:e instanceof Document||e.shadowRoot===null||e.shadowRoot===void 0?e.querySelector(t):e.shadowRoot.querySelector(t),i.findAll=$,i.forEachNode=(e,t,n=window)=>{for(let r=0;r{let t="";return e.forEach(n=>{!t.length&&window.matchMedia(n.query).matches&&(t=n.name)}),t},i.getInnerText=e=>e.innerText||e.textContent||"",i.getParent=(e,t)=>e.closest(t),i.getUniqueID=()=>Math.random().toString(36).substr(2,9),i.hasChild=(e,t)=>e.shadowRoot!==null&&e.shadowRoot!==void 0?e.shadowRoot.querySelector(t)!==null:e.querySelector(t)!==null,i.hasClass=M,i.inViewport=(e,t)=>{const n=e.getBoundingClientRect();let r={top:0,right:window.innerWidth||document.documentElement.clientWidth,bottom:window.innerHeight||document.documentElement.clientHeight,left:0};return t!==void 0&&(r=t.getBoundingClientRect()),n.top>=r.top&&n.right<=r.right&&n.bottom<=r.bottom&&n.left>=r.left},i.isNodeList=e=>!(e instanceof HTMLElement||e instanceof Window),x=i.onEvent=T,i.removeChildren=b,i.removeChilds=b,i.removeClass=C,i.removeEvent=L,i.toggleClass=(e,t,n)=>{if(e!=null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const r of e)n===!0?f(r,t):M(r,t)||n===!1?C(r,t):f(r,t)}},i.waitFor=e=>new Promise(t=>{setTimeout(()=>t(),e)}),i.waitForAnimationEnd=function(e,t){return new Promise((n,r)=>{e.addEventListener("animationend",function o(s){s.target===e&&(t&&s.animationName!==t||(e.removeEventListener("animationend",o),n(s)))})})},i.waitForEvent=E,i.waitForInitialization=e=>{var t;return((t=e.state)===null||t===void 0?void 0:t.initialized)===!0?Promise.resolve():E(e,"kl-component-initialized",3e3)},i.waitForTransitionEnd=function(e,t){return new Promise((n,r)=>{e.addEventListener("transitionend",function o(s){s.target===e&&(t&&s.propertyName!==t||(e.removeEventListener("transitionend",o),n(s)))})})};var A={};Object.defineProperty(A,"__esModule",{value:!0});A.fetchJSON=(e,t)=>new Promise((n,r)=>{fetch(e,t).then(o=>{o.ok?n(o.json()):r(o)}).catch(o=>r(o))});var h={};Object.defineProperty(h,"__esModule",{value:!0});const g=e=>typeof e=="object"&&e!==null?JSON.stringify(e):String(e);h.getValue=(e={},t="")=>{const n=t.split(".");let r=0,o=e;for(;o&&rtypeof e==typeof t&&(typeof e=="object"?g(e).localeCompare(g(t))===0:e===t),h.isFilledObject=function(e){return typeof e=="object"&&e!==null&&Object.keys(e).length>0},h.naiveClone=function e(t){return typeof t!="object"?t:t===null?null:Array.isArray(t)?t.map(n=>e(n)):Object.entries(t).reduce((n,[r,o])=>(n[r]=e(o),n),{})},h.toArray=e=>Array.isArray(e)?e:[e],h.toString=g;/*! ***************************************************************************** + ${m(r,r)}`.replace(/\n/gm,"").replace(/\s/g,"")}function m(e,t){let n;if(t.eventIdMap.has(e))n=t.eventIdMap.get(e);else{const r="xxxxxxxx".replace(/x/g,D).toLowerCase();t.eventIdMap.set(e,r),n=r}return n}function D(){return(100*Math.random()%36|0).toString(36)}const A=(e,t,n,r,o)=>{if(e==null||d(e)&&!T(e))return;if(d(e)&&!(e instanceof HTMLElement)){for(const a of e)A(a,t,n,r,o);return}let s;s=typeof t=="string"?t.trim().split(" "):t,s.forEach(a=>{const c=$(e,a,n,r),l=r.eventBindingMap[c];l&&(delete r.eventBindingMap[c],e.removeEventListener(a,l,o))})},M=(e,t)=>{L(e,t).forEach(n=>e.removeChild(n))},E=(e,t,n)=>new Promise(r=>{n!==void 0&&setTimeout(()=>r(),n),e.addEventListener(t,()=>r())});i.addClass=f,i.find=(e,t)=>e===null?null:e instanceof Document||e.shadowRoot===null||e.shadowRoot===void 0?e.querySelector(t):e.shadowRoot.querySelector(t),i.findAll=L,i.forEachNode=(e,t,n=window)=>{for(let r=0;r{let t="";return e.forEach(n=>{!t.length&&window.matchMedia(n.query).matches&&(t=n.name)}),t},i.getInnerText=e=>e.innerText||e.textContent||"",i.getParent=(e,t)=>e.closest(t),i.getUniqueID=()=>Math.random().toString(36).substr(2,9),i.hasChild=(e,t)=>e.shadowRoot!==null&&e.shadowRoot!==void 0?e.shadowRoot.querySelector(t)!==null:e.querySelector(t)!==null,i.hasClass=C,i.inViewport=(e,t)=>{const n=e.getBoundingClientRect();let r={top:0,right:window.innerWidth||document.documentElement.clientWidth,bottom:window.innerHeight||document.documentElement.clientHeight,left:0};return t!==void 0&&(r=t.getBoundingClientRect()),n.top>=r.top&&n.right<=r.right&&n.bottom<=r.bottom&&n.left>=r.left},i.isNodeList=e=>!(e instanceof HTMLElement||e instanceof Window),R=i.onEvent=j,i.removeChildren=M,i.removeChilds=M,i.removeClass=b,i.removeEvent=A,i.toggleClass=(e,t,n)=>{if(e!=null){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const r of e)n===!0?f(r,t):C(r,t)||n===!1?b(r,t):f(r,t)}},i.waitFor=e=>new Promise(t=>{setTimeout(()=>t(),e)}),i.waitForAnimationEnd=function(e,t){return new Promise((n,r)=>{e.addEventListener("animationend",function o(s){s.target===e&&(t&&s.animationName!==t||(e.removeEventListener("animationend",o),n(s)))})})},i.waitForEvent=E,i.waitForInitialization=e=>{var t;return((t=e.state)===null||t===void 0?void 0:t.initialized)===!0?Promise.resolve():E(e,"kl-component-initialized",3e3)},i.waitForTransitionEnd=function(e,t){return new Promise((n,r)=>{e.addEventListener("transitionend",function o(s){s.target===e&&(t&&s.propertyName!==t||(e.removeEventListener("transitionend",o),n(s)))})})};var q={};Object.defineProperty(q,"__esModule",{value:!0});q.fetchJSON=(e,t)=>new Promise((n,r)=>{fetch(e,t).then(o=>{o.ok?n(o.json()):r(o)}).catch(o=>r(o))});var h={};Object.defineProperty(h,"__esModule",{value:!0});const g=e=>typeof e=="object"&&e!==null?JSON.stringify(e):String(e);h.getValue=(e={},t="")=>{const n=t.split(".");let r=0,o=e;for(;o&&rtypeof e==typeof t&&(typeof e=="object"?g(e).localeCompare(g(t))===0:e===t),h.isFilledObject=function(e){return typeof e=="object"&&e!==null&&Object.keys(e).length>0},h.naiveClone=function e(t){return typeof t!="object"?t:t===null?null:Array.isArray(t)?t.map(n=>e(n)):Object.entries(t).reduce((n,[r,o])=>(n[r]=e(o),n),{})},h.toArray=e=>Array.isArray(e)?e:[e],h.toString=g;/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -14,5 +14,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */class u{constructor(){this.eventIdMap=new WeakMap,this.eventBindingMap={},this.lastMQ=w(u.mediaQuerys),x(window,"resize",this.handleMQChange,this)}static getInstance(t){return u.instance===void 0&&(u.mediaQuerys=t,u.instance=new u),u.instance}handleMQChange(){const t=w(u.mediaQuerys);t!==this.lastMQ&&(window.dispatchEvent(new CustomEvent("kl-mq-change",{detail:{newMQ:t,oldMQ:this.lastMQ}})),this.lastMQ=t)}}(function(e,t,n,r){var o,s=arguments.length,a=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(t,n,a):o(t,n))||a);s>3&&a&&Object.defineProperty(t,n,a)})([S(100)],u.prototype,"handleMQChange",null);var I=new class{constructor(){this.urlSearchParams=new URLSearchParams(window.location.search)}get(e){return this.urlSearchParams.get(e)}getAll(e){return this.urlSearchParams.getAll(e)}getAllKeys(){return Array.from(this.urlSearchParams.keys())}set(e,t){this.urlSearchParams.set(e,t),this.updateUrl()}delete(e){this.urlSearchParams.delete(e),this.updateUrl()}getString(){return this.urlSearchParams.toString()}get curUrl(){return`${window.location.protocol}//${window.location.host}${window.location.pathname}`}updateUrl(){const e=this.getString(),t=this.curUrl,n=window.location.hash,r=e!==""?`${t}?${e}`:t;window.history.replaceState({path:r},"",r),n!==""&&(window.location.hash=n)}},B=new Proxy(console,{get:(e,t)=>I.get("js-debug")!==null?e[t]:()=>{}});new class{constructor(){this.componentMap=new WeakMap,this.intersectionObserver=new IntersectionObserver(e=>this.handleIntersectionChange(e),{rootMargin:"500px 0px"})}subscribe(e,t){this.componentMap.set(e,t),this.intersectionObserver.observe(e)}unsubscribe(e){this.intersectionObserver.unobserve(e),this.componentMap.delete(e)}handleIntersectionChange(e){e.forEach(t=>{const n=t.target;if(!t.isIntersecting||!this.componentMap.has(n))return;const r=this.componentMap.get(n);this.unsubscribe(n),r()})}};class N{constructor(){this.requestPipeline=new Map,this.runtimeCache=new q}fetchJson(t,n={}){return this.fetchData(this.getCodeBasePath(t),n,this.getResponseJSON)}async fetchText(t,n={}){return await this.fetchData(this.getCodeBasePath(t),n,this.getResponseText)}async fetchData(t,n,r){const{cacheOptions:o}=n,s=this.getCachedData(t,o);if(s!==null)return s;const a=this.requestPipeline.get(t);if(a!==void 0)return r(await a);const c=fetch(t,n.fetchOptions);this.requestPipeline.set(t,c);const l=await c;this.requestPipeline.delete(t);const v=await r(l);if(this.setCachedData(t,v,o),!l.ok){const y=await l.text();throw B.error(`FetchService: Error fetching data from ${t}: ${y}`),new Error(`Error fetching data from ${t}: ${y}`)}return v}async getResponseJSON(t){return await t.clone().json()}async getResponseText(t){return await t.clone().text()}getCachedData(t,n){return(n==null?void 0:n.cacheType)==="runtime"?this.runtimeCache.get(t)??null:null}setCachedData(t,n,r){(r==null?void 0:r.cacheType)==="runtime"&&this.runtimeCache.set(t,n)}getCodeBasePath(t){const n=t.startsWith("/")?t:`/${t}`;return`${window.hlx.codeBasePath}${n}`}}const F=new N;export{F,B as m}; -//# sourceMappingURL=fetch.service.DgmLKlDK.js.map +***************************************************************************** */class u{constructor(){this.eventIdMap=new WeakMap,this.eventBindingMap={},this.lastMQ=w(u.mediaQuerys),R(window,"resize",this.handleMQChange,this)}static getInstance(t){return u.instance===void 0&&(u.mediaQuerys=t,u.instance=new u),u.instance}handleMQChange(){const t=w(u.mediaQuerys);t!==this.lastMQ&&(window.dispatchEvent(new CustomEvent("kl-mq-change",{detail:{newMQ:t,oldMQ:this.lastMQ}})),this.lastMQ=t)}}(function(e,t,n,r){var o,s=arguments.length,a=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(t,n,a):o(t,n))||a);s>3&&a&&Object.defineProperty(t,n,a)})([P(100)],u.prototype,"handleMQChange",null);var I=new class{constructor(){this.urlSearchParams=new URLSearchParams(window.location.search)}get(e){return this.urlSearchParams.get(e)}getAll(e){return this.urlSearchParams.getAll(e)}getAllKeys(){return Array.from(this.urlSearchParams.keys())}set(e,t){this.urlSearchParams.set(e,t),this.updateUrl()}delete(e){this.urlSearchParams.delete(e),this.updateUrl()}getString(){return this.urlSearchParams.toString()}get curUrl(){return`${window.location.protocol}//${window.location.host}${window.location.pathname}`}updateUrl(){const e=this.getString(),t=this.curUrl,n=window.location.hash,r=e!==""?`${t}?${e}`:t;window.history.replaceState({path:r},"",r),n!==""&&(window.location.hash=n)}},F=new Proxy(console,{get:(e,t)=>I.get("js-debug")!==null?e[t]:()=>{}});new class{constructor(){this.componentMap=new WeakMap,this.intersectionObserver=new IntersectionObserver(e=>this.handleIntersectionChange(e),{rootMargin:"500px 0px"})}subscribe(e,t){this.componentMap.set(e,t),this.intersectionObserver.observe(e)}unsubscribe(e){this.intersectionObserver.unobserve(e),this.componentMap.delete(e)}handleIntersectionChange(e){e.forEach(t=>{const n=t.target;if(!t.isIntersecting||!this.componentMap.has(n))return;const r=this.componentMap.get(n);this.unsubscribe(n),r()})}};const S=e=>{const t=new URL(window.hlx.codeBasePath,window.location.origin);return new URL(e,t)};class N{constructor(){this.runtimeCache=new Map}get(t){return this.runtimeCache.get(t)}set(t,n){this.runtimeCache.set(t,n)}has(t){return this.runtimeCache.has(t)}delete(t){this.runtimeCache.delete(t)}}class U{constructor(){this.requestPipeline=new Map,this.runtimeCache=new N}fetchJson(t,n={}){return this.fetchData(S(t).href,n,this.getResponseJSON)}fetchText(t,n={}){return this.fetchData(S(t).href,n,this.getResponseText)}async fetchData(t,n,r){const{cacheOptions:o}=n,s=this.getCachedData(t,o);if(s!==null)return s;const a=this.requestPipeline.get(t);if(a!==void 0)return r(await a);const c=fetch(t,n.fetchOptions);this.requestPipeline.set(t,c);const l=await c;this.requestPipeline.delete(t);const v=await r(l);if(this.setCachedData(t,v,o),!l.ok){const y=await l.text();throw F.error(`FetchService: Error fetching data from ${t}: ${y}`),new Error(`Error fetching data from ${t}: ${y}`)}return v}async getResponseJSON(t){return await t.clone().json()}async getResponseText(t){return await t.clone().text()}getCachedData(t,n){return(n==null?void 0:n.cacheType)==="runtime"?this.runtimeCache.get(t)??null:null}setCachedData(t,n,r){(r==null?void 0:r.cacheType)==="runtime"&&this.runtimeCache.set(t,n)}}const k=new U;export{k as F,S as g,F as m}; +//# sourceMappingURL=fetch.service.C1Ie3Sjw.js.map diff --git a/dist/__chunks__/fetch.service.C1Ie3Sjw.js.map b/dist/__chunks__/fetch.service.C1Ie3Sjw.js.map new file mode 100644 index 00000000..0f64f88a --- /dev/null +++ b/dist/__chunks__/fetch.service.C1Ie3Sjw.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.service.C1Ie3Sjw.js","sources":["../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/function-helpers/decorators/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/dom-helpers/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/api-helpers/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/object-helpers/index.js","../../node_modules/@kluntje/services/lib/index.module.js","../../src/app/utils/getUrlForEndpoint.ts","../../src/utils/RuntimeCache.ts","../../src/services/fetch.service.ts"],"sourcesContent":["\"use strict\";function t(t){return function(...e){return function(n,o,c){return Object.assign(Object.assign({},c),{value:t(c.value,...e)})}}}Object.defineProperty(exports,\"__esModule\",{value:!0});const e=t((function(t,e=0){let n=-1;const o=function(...o){clearTimeout(n),n=window.setTimeout((()=>{t.call(this,...o)}),e)};return o.cancel=function(){clearTimeout(n)},o})),n=t((function(t,e=0){let n,o=[];const c=function(...c){o=c,void 0===n&&(n=window.setTimeout((()=>{n=void 0,t.call(this,...o)}),e))};return c.cancel=function(){clearTimeout(n),n=void 0},c}));exports.debounce=e,exports.throttle=n;\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});const e=(e,t)=>null===e?[]:e instanceof Document||null===e.shadowRoot||void 0===e.shadowRoot?Array.from(e.querySelectorAll(t)):Array.from(e.shadowRoot.querySelectorAll(t)),t=(e,...t)=>{if(void 0!==e&&0!==t.length&&null!==e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.remove(...t)}},n=(e,...t)=>{if(void 0!==e&&0!==t.length&&null!==e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.add(...t)}},o=(e,t)=>e.classList.contains(t);function r(e){return Symbol.iterator in e}function i(e){return\"length\"in e?e.length>0:!e[Symbol.iterator]().next().done}const s=(e,t,n,o,a)=>{if(null==e||r(e)&&!i(e))return;if(r(e)&&!(e instanceof HTMLElement)){for(const r of e)s(r,t,n,o,a);return}let d;d=\"string\"==typeof t?t.trim().split(\" \"):t,d.forEach((t=>{const r=l(e,t,n,o);if(!o.eventBindingMap[r]){const i=n.bind(o);return o.eventBindingMap[r]=i,e.addEventListener(t.trim(),i,a)}}))};function l(e,t,n,o){return`${a(e,o)}#\\n ${t.trim()}#\\n ${a(n,o)}#\\n ${a(o,o)}`.replace(/\\n/gm,\"\").replace(/\\s/g,\"\")}function a(e,t){let n;if(t.eventIdMap.has(e))n=t.eventIdMap.get(e);else{const o=\"xxxxxxxx\".replace(/x/g,d).toLowerCase();t.eventIdMap.set(e,o),n=o}return n}function d(){return(100*Math.random()%36|0).toString(36)}const c=(e,t,n,o,s)=>{if(null==e||r(e)&&!i(e))return;if(r(e)&&!(e instanceof HTMLElement)){for(const r of e)c(r,t,n,o,s);return}let a;a=\"string\"==typeof t?t.trim().split(\" \"):t,a.forEach((t=>{const r=l(e,t,n,o),i=o.eventBindingMap[r];i&&(delete o.eventBindingMap[r],e.removeEventListener(t,i,s))}))},u=(t,n)=>{e(t,n).forEach((e=>t.removeChild(e)))},f=(e,t,n)=>new Promise((o=>{void 0!==n&&setTimeout((()=>o()),n),e.addEventListener(t,(()=>o()))}));exports.addClass=n,exports.find=(e,t)=>null===e?null:e instanceof Document||null===e.shadowRoot||void 0===e.shadowRoot?e.querySelector(t):e.shadowRoot.querySelector(t),exports.findAll=e,exports.forEachNode=(e,t,n=window)=>{for(let o=0;o{let t=\"\";return e.forEach((e=>{!t.length&&window.matchMedia(e.query).matches&&(t=e.name)})),t},exports.getInnerText=e=>e.innerText||e.textContent||\"\",exports.getParent=(e,t)=>e.closest(t),exports.getUniqueID=()=>Math.random().toString(36).substr(2,9),exports.hasChild=(e,t)=>null!==e.shadowRoot&&void 0!==e.shadowRoot?null!==e.shadowRoot.querySelector(t):null!==e.querySelector(t),exports.hasClass=o,exports.inViewport=(e,t)=>{const n=e.getBoundingClientRect();let o={top:0,right:window.innerWidth||document.documentElement.clientWidth,bottom:window.innerHeight||document.documentElement.clientHeight,left:0};return void 0!==t&&(o=t.getBoundingClientRect()),n.top>=o.top&&n.right<=o.right&&n.bottom<=o.bottom&&n.left>=o.left},exports.isNodeList=e=>!(e instanceof HTMLElement||e instanceof Window),exports.onEvent=s,exports.removeChildren=u,exports.removeChilds=u,exports.removeClass=t,exports.removeEvent=c,exports.toggleClass=(e,r,i)=>{if(null!=e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const s of e)!0===i?n(s,r):o(s,r)||!1===i?t(s,r):n(s,r)}},exports.waitFor=e=>new Promise((t=>{setTimeout((()=>t()),e)})),exports.waitForAnimationEnd=function(e,t){return new Promise(((n,o)=>{e.addEventListener(\"animationend\",(function o(r){r.target===e&&(t&&r.animationName!==t||(e.removeEventListener(\"animationend\",o),n(r)))}))}))},exports.waitForEvent=f,exports.waitForInitialization=e=>{var t;return!0===(null===(t=e.state)||void 0===t?void 0:t.initialized)?Promise.resolve():f(e,\"kl-component-initialized\",3e3)},exports.waitForTransitionEnd=function(e,t){return new Promise(((n,o)=>{e.addEventListener(\"transitionend\",(function o(r){r.target===e&&(t&&r.propertyName!==t||(e.removeEventListener(\"transitionend\",o),n(r)))}))}))};\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});exports.fetchJSON=(e,t)=>new Promise(((o,s)=>{fetch(e,t).then((e=>{e.ok?o(e.json()):s(e)})).catch((e=>s(e)))}));\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});const e=e=>\"object\"==typeof e&&null!==e?JSON.stringify(e):String(e);exports.getValue=(e={},t=\"\")=>{const r=t.split(\".\");let o=0,n=e;for(;n&&otypeof t==typeof r&&(\"object\"==typeof t?0===e(t).localeCompare(e(r)):t===r),exports.isFilledObject=function(e){return\"object\"==typeof e&&null!==e&&Object.keys(e).length>0},exports.naiveClone=function e(t){return\"object\"!=typeof t?t:null===t?null:Array.isArray(t)?t.map((t=>e(t))):Object.entries(t).reduce(((t,[r,o])=>(t[r]=e(o),t)),{})},exports.toArray=e=>Array.isArray(e)?e:[e],exports.toString=e;\n//# sourceMappingURL=index.js.map\n","import{throttle as e}from\"@kluntje/js-utils/lib/function-helpers/decorators\";import{getCurrentMQ as t,onEvent as n}from\"@kluntje/js-utils/lib/dom-helpers\";import{fetchJSON as r}from\"@kluntje/js-utils/lib/api-helpers\";import{isFilledObject as s}from\"@kluntje/js-utils/lib/object-helpers\";const i=\"kl-mq-change\",a=\"kl-in-vp\",o=\"kl-out-vp\";class l{constructor(){}static getInstance(){return void 0===l.instance&&(l.instance=new IntersectionObserver(l.handleIntersectionChange)),l.instance}static handleIntersectionChange(e){Object.keys(e).forEach((t=>{const n=e[t],r=n.target;n.isIntersecting?r.dispatchEvent(new CustomEvent(\"kl-in-vp\",{bubbles:!1})):r.dispatchEvent(new CustomEvent(\"kl-out-vp\",{bubbles:!1}))}))}}\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */class c{constructor(){this.eventIdMap=new WeakMap,this.eventBindingMap={},this.lastMQ=t(c.mediaQuerys),n(window,\"resize\",this.handleMQChange,this)}static getInstance(e){return void 0===c.instance&&(c.mediaQuerys=e,c.instance=new c),c.instance}handleMQChange(){const e=t(c.mediaQuerys);e!==this.lastMQ&&(window.dispatchEvent(new CustomEvent(\"kl-mq-change\",{detail:{newMQ:e,oldMQ:this.lastMQ}})),this.lastMQ=e)}}!function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);i>3&&a&&Object.defineProperty(t,n,a)}([e(100)],c.prototype,\"handleMQChange\",null);const h=Symbol(\"resolve\"),d=Symbol(\"reject\"),u=Symbol(\"pending\");class p{static get PLACEHOLDER_SELECTOR(){return\"kl-i18n-placeholder\"}static getInstance(){return void 0===p._instance&&(p._instance=new p),p._instance}get isSetUp(){return Boolean(this._url||s(this._dictionary))}get loaded(){return this._loaded}get ready(){return this._ready[u]||this.fetchI18nDictionary(),this._ready}setUp({url:e,dictionary:t}={}){if(this.isSetUp)console.warn(\"@kluntje I18nService: service has already been set up. You can't set it up twice!\");else if(e)this._url=e;else{if(!t)throw new Error('@kluntje I18nService: a \"url\" or \"dictionary\" should have been passed to the setUp function.');this._dictionary=t,this._loaded=!0,this._ready[h](),this._ready[u]=!0}}get(e,{fallback:t,interpolations:n}={}){if(this.loaded){if(this._dictionary.hasOwnProperty(e)){let t=this._dictionary[e];return n&&Object.entries(n).forEach((([e,n])=>{t=t.split(`{${e}}`).join(String(n))})),t}return console.warn(`@kluntje I18nService: i18n for key '${e}' is missing in dictionary!`),void 0!==t?t:this.getHumanReadableName(e)}return this._ready[u]||(this.addStyling(),this.fetchI18nDictionary()),this.getPlaceholder(e,{fallback:t,interpolations:n})}constructor(){this._loaded=!1,this._dictionary={},this._ready=this.getReadyPromise()}getReadyPromise(){let e,t;const n=new Promise(((n,r)=>{e=n,t=r}));return n[h]=e,n[d]=t,n[u]=!1,n}ensureSetup(){if(!this.isSetUp)throw new Error(\"@kluntje I18nService: should be set up before calling other APIs\")}addStyling(){const e=document.head,t=document.createElement(\"style\");t.type=\"text/css\",t.appendChild(document.createTextNode(`\\n .${p.PLACEHOLDER_SELECTOR} {\\n display: contents;\\n }\\n `)),e.appendChild(t)}fetchI18nDictionary(){this.ensureSetup(),this._ready[u]=!0,r(this._url).then((e=>{this._dictionary=e,this._loaded=!0,this._ready[h](),this.fillInPlaceholders()})).catch((e=>{console.error(\"@kluntje I18nService: unable to fetch keys from server!\",e),this._loaded=!0,this._ready[h]()}))}fillInPlaceholders(){Array.from(document.getElementsByClassName(p.PLACEHOLDER_SELECTOR)).forEach((e=>{const{key:t,fallback:n,interpolations:r}=e.dataset;e.replaceWith(this.get(t,{fallback:n,interpolations:r?JSON.parse(r):void 0}))}))}getHumanReadableName(e){return e.split(\".\").reverse()[0].replace(/[A-Z]/g,(e=>` ${e.toLowerCase()}`))}getPlaceholder(e,{fallback:t,interpolations:n}={}){const r=document.createElement(\"span\");return r.innerText=void 0!==t?t:this.getHumanReadableName(e),r.classList.add(p.PLACEHOLDER_SELECTOR),r.setAttribute(\"data-key\",e),t&&r.setAttribute(\"data-fallback\",t),n&&r.setAttribute(\"data-interpolations\",JSON.stringify(n)),r.outerHTML}}var g=new class{constructor(){this.urlSearchParams=new URLSearchParams(window.location.search)}get(e){return this.urlSearchParams.get(e)}getAll(e){return this.urlSearchParams.getAll(e)}getAllKeys(){return Array.from(this.urlSearchParams.keys())}set(e,t){this.urlSearchParams.set(e,t),this.updateUrl()}delete(e){this.urlSearchParams.delete(e),this.updateUrl()}getString(){return this.urlSearchParams.toString()}get curUrl(){return`${window.location.protocol}//${window.location.host}${window.location.pathname}`}updateUrl(){const e=this.getString(),t=this.curUrl,n=window.location.hash,r=\"\"!==e?`${t}?${e}`:t;window.history.replaceState({path:r},\"\",r),\"\"!==n&&(window.location.hash=n)}};var m=new Proxy(console,{get:(e,t)=>null!==g.get(\"js-debug\")?e[t]:()=>{}});var y=new class{constructor(){this.componentMap=new WeakMap,this.intersectionObserver=new IntersectionObserver((e=>this.handleIntersectionChange(e)),{rootMargin:\"500px 0px\"})}subscribe(e,t){this.componentMap.set(e,t),this.intersectionObserver.observe(e)}unsubscribe(e){this.intersectionObserver.unobserve(e),this.componentMap.delete(e)}handleIntersectionChange(e){e.forEach((e=>{const t=e.target;if(!e.isIntersecting||!this.componentMap.has(t))return;const n=this.componentMap.get(t);this.unsubscribe(t),n()}))}};export{m as DebuggerService,p as I18nService,a as IN_VP_EVENT,y as LazyConnectService,i as MQ_CHANGE_EVENT,c as MediaQueryService,o as OUT_VP_EVENT,g as URLSearchParamsService,l as ViewportObserver};\n//# sourceMappingURL=index.module.js.map\n","/**\n * Get the URL for an endpoint.\n * @param endpoint - The endpoint.\n * @returns URL\n * @example\n * const url = getUrlForEndpoint('block1/block1.css');\n * console.log(url);\n * Output: URL { href: 'http://localhost:3000/block1/block1.css' }\n */\nexport const getUrlForEndpoint = (endpoint: string): URL => {\n const baseUrl = new URL(window.hlx.codeBasePath, window.location.origin);\n return new URL(endpoint, baseUrl);\n};\n","export class RuntimeCache {\n private runtimeCache: Map = new Map();\n\n public get(key: string): T | undefined {\n return this.runtimeCache.get(key);\n }\n\n public set(key: string, value: T): void {\n this.runtimeCache.set(key, value);\n }\n\n public has(key: string): boolean {\n return this.runtimeCache.has(key);\n }\n\n public delete(key: string): void {\n this.runtimeCache.delete(key);\n }\n}\n","import { getUrlForEndpoint } from '../app/utils/getUrlForEndpoint';\nimport { RuntimeCache } from '../utils/RuntimeCache';\nimport { DebuggerService } from '@kluntje/services';\n\nexport interface FetchServiceCacheOptions {\n cacheType?: 'runtime'; // 'local' | 'session' | \"request\" can be added later\n}\n\nexport interface FetchServiceOptions {\n fetchOptions?: RequestInit;\n cacheOptions?: FetchServiceCacheOptions;\n}\n\nclass FetchService {\n private requestPipeline: Map> = new Map();\n\n private runtimeCache = new RuntimeCache();\n\n public fetchJson(endpoint: string, options: FetchServiceOptions = {}): Promise {\n return this.fetchData(getUrlForEndpoint(endpoint).href, options, this.getResponseJSON);\n }\n\n public fetchText(endpoint: string, options: FetchServiceOptions = {}): Promise {\n return this.fetchData(getUrlForEndpoint(endpoint).href, options, this.getResponseText);\n }\n\n private async fetchData(\n url: string,\n options: FetchServiceOptions,\n dataMapper: (Response) => Promise\n ): Promise {\n const { cacheOptions } = options;\n const cachedData = this.getCachedData(url, cacheOptions);\n if (cachedData !== null) return cachedData;\n\n const pipelinedRequest = this.requestPipeline.get(url);\n if (pipelinedRequest !== undefined) return dataMapper(await pipelinedRequest);\n\n const request = fetch(url, options.fetchOptions);\n this.requestPipeline.set(url, request);\n\n const response = await request;\n this.requestPipeline.delete(url);\n const responseData = await dataMapper(response);\n\n this.setCachedData(url, responseData, cacheOptions);\n\n if (!response.ok) {\n const errorText = await response.text();\n\n DebuggerService.error(`FetchService: Error fetching data from ${url}: ${errorText}`);\n\n throw new Error(`Error fetching data from ${url}: ${errorText}`);\n }\n return responseData;\n }\n\n private async getResponseJSON(response: Response): Promise {\n const responseClone = response.clone();\n const responseJson = await responseClone.json();\n return responseJson;\n }\n\n private async getResponseText(response: Response): Promise {\n const responseClone = response.clone();\n const responseText = await responseClone.text();\n return responseText;\n }\n\n private getCachedData(url: string, cacheOptions?: FetchServiceCacheOptions): T | null {\n if (cacheOptions?.cacheType === 'runtime') {\n return this.runtimeCache.get(url) ?? null;\n }\n return null;\n }\n\n private setCachedData(url: string, data: T, cacheOptions?: FetchServiceCacheOptions): void {\n if (cacheOptions?.cacheType === 'runtime') {\n this.runtimeCache.set(url, data);\n }\n }\n}\n\nexport default new FetchService();\n"],"names":["t","e","o","c","decorators","n","throttle","domHelpers","r","i","s","a","d","l","u","f","getCurrentMQ","onEvent","apiHelpers","objectHelpers","g","m","getUrlForEndpoint","endpoint","baseUrl","RuntimeCache","key","value","FetchService","options","url","dataMapper","cacheOptions","cachedData","pipelinedRequest","request","response","responseData","errorText","DebuggerService","data","FetchService$1"],"mappings":"WAAa,SAASA,EAAEA,EAAE,CAAC,OAAO,YAAYC,EAAE,CAAC,OAAO,SAAS,EAAEC,EAAEC,EAAE,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,CAAE,EAACA,CAAC,EAAE,CAAC,MAAMH,EAAEG,EAAE,MAAM,GAAGF,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,eAAeG,EAAQ,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,MAAMH,EAAED,EAAG,SAASA,EAAEC,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,MAAMC,EAAE,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,WAAY,IAAI,CAACF,EAAE,KAAK,KAAK,GAAG,CAAC,CAAC,EAAGC,CAAC,CAAC,EAAE,OAAOC,EAAE,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC,EAAEA,CAAC,CAAG,EAACG,EAAEL,EAAG,SAASA,EAAEC,EAAE,EAAE,CAAC,IAAI,EAAEC,EAAE,CAAE,EAAC,MAAMC,EAAE,YAAYA,EAAE,CAACD,EAAEC,EAAW,IAAT,SAAa,EAA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E,EAE7E,IAAI,MAAM,4BAA4BR,CAAG,KAAKQ,CAAS,EAAE,CACjE,CACO,OAAAD,CACT,CAEA,MAAc,gBAAmBD,EAAgC,CAGxD,OADc,MADCA,EAAS,QACU,MAE3C,CAEA,MAAc,gBAAgBA,EAAqC,CAG1D,OADc,MADCA,EAAS,QACU,MAE3C,CAEQ,cAAiBN,EAAaE,EAAmD,CACnF,OAAAA,GAAA,YAAAA,EAAc,aAAc,UACvB,KAAK,aAAa,IAAIF,CAAG,GAAK,KAEhC,IACT,CAEQ,cAAiBA,EAAaU,EAASR,EAA+C,EACxFA,GAAA,YAAAA,EAAc,aAAc,WACzB,KAAA,aAAa,IAAIF,EAAKU,CAAI,CAEnC,CACF,CAEA,MAAeC,EAAA,IAAIb","x_google_ignoreList":[0,1,2,3,4]} \ No newline at end of file diff --git a/dist/__chunks__/fetch.service.DgmLKlDK.js.map b/dist/__chunks__/fetch.service.DgmLKlDK.js.map deleted file mode 100644 index 0980fcbb..00000000 --- a/dist/__chunks__/fetch.service.DgmLKlDK.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fetch.service.DgmLKlDK.js","sources":["../../src/utils/RuntimeCache.ts","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/function-helpers/decorators/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/dom-helpers/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/api-helpers/index.js","../../node_modules/@kluntje/services/node_modules/@kluntje/js-utils/lib/object-helpers/index.js","../../node_modules/@kluntje/services/lib/index.module.js","../../src/services/fetch.service.ts"],"sourcesContent":["export class RuntimeCache {\n private runtimeCache: Map = new Map();\n\n public get(key: string): T | undefined {\n return this.runtimeCache.get(key);\n }\n\n public set(key: string, value: T): void {\n this.runtimeCache.set(key, value);\n }\n\n public has(key: string): boolean {\n return this.runtimeCache.has(key);\n }\n\n public delete(key: string): void {\n this.runtimeCache.delete(key);\n }\n}\n","\"use strict\";function t(t){return function(...e){return function(n,o,c){return Object.assign(Object.assign({},c),{value:t(c.value,...e)})}}}Object.defineProperty(exports,\"__esModule\",{value:!0});const e=t((function(t,e=0){let n=-1;const o=function(...o){clearTimeout(n),n=window.setTimeout((()=>{t.call(this,...o)}),e)};return o.cancel=function(){clearTimeout(n)},o})),n=t((function(t,e=0){let n,o=[];const c=function(...c){o=c,void 0===n&&(n=window.setTimeout((()=>{n=void 0,t.call(this,...o)}),e))};return c.cancel=function(){clearTimeout(n),n=void 0},c}));exports.debounce=e,exports.throttle=n;\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});const e=(e,t)=>null===e?[]:e instanceof Document||null===e.shadowRoot||void 0===e.shadowRoot?Array.from(e.querySelectorAll(t)):Array.from(e.shadowRoot.querySelectorAll(t)),t=(e,...t)=>{if(void 0!==e&&0!==t.length&&null!==e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.remove(...t)}},n=(e,...t)=>{if(void 0!==e&&0!==t.length&&null!==e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const n of e)n.classList.add(...t)}},o=(e,t)=>e.classList.contains(t);function r(e){return Symbol.iterator in e}function i(e){return\"length\"in e?e.length>0:!e[Symbol.iterator]().next().done}const s=(e,t,n,o,a)=>{if(null==e||r(e)&&!i(e))return;if(r(e)&&!(e instanceof HTMLElement)){for(const r of e)s(r,t,n,o,a);return}let d;d=\"string\"==typeof t?t.trim().split(\" \"):t,d.forEach((t=>{const r=l(e,t,n,o);if(!o.eventBindingMap[r]){const i=n.bind(o);return o.eventBindingMap[r]=i,e.addEventListener(t.trim(),i,a)}}))};function l(e,t,n,o){return`${a(e,o)}#\\n ${t.trim()}#\\n ${a(n,o)}#\\n ${a(o,o)}`.replace(/\\n/gm,\"\").replace(/\\s/g,\"\")}function a(e,t){let n;if(t.eventIdMap.has(e))n=t.eventIdMap.get(e);else{const o=\"xxxxxxxx\".replace(/x/g,d).toLowerCase();t.eventIdMap.set(e,o),n=o}return n}function d(){return(100*Math.random()%36|0).toString(36)}const c=(e,t,n,o,s)=>{if(null==e||r(e)&&!i(e))return;if(r(e)&&!(e instanceof HTMLElement)){for(const r of e)c(r,t,n,o,s);return}let a;a=\"string\"==typeof t?t.trim().split(\" \"):t,a.forEach((t=>{const r=l(e,t,n,o),i=o.eventBindingMap[r];i&&(delete o.eventBindingMap[r],e.removeEventListener(t,i,s))}))},u=(t,n)=>{e(t,n).forEach((e=>t.removeChild(e)))},f=(e,t,n)=>new Promise((o=>{void 0!==n&&setTimeout((()=>o()),n),e.addEventListener(t,(()=>o()))}));exports.addClass=n,exports.find=(e,t)=>null===e?null:e instanceof Document||null===e.shadowRoot||void 0===e.shadowRoot?e.querySelector(t):e.shadowRoot.querySelector(t),exports.findAll=e,exports.forEachNode=(e,t,n=window)=>{for(let o=0;o{let t=\"\";return e.forEach((e=>{!t.length&&window.matchMedia(e.query).matches&&(t=e.name)})),t},exports.getInnerText=e=>e.innerText||e.textContent||\"\",exports.getParent=(e,t)=>e.closest(t),exports.getUniqueID=()=>Math.random().toString(36).substr(2,9),exports.hasChild=(e,t)=>null!==e.shadowRoot&&void 0!==e.shadowRoot?null!==e.shadowRoot.querySelector(t):null!==e.querySelector(t),exports.hasClass=o,exports.inViewport=(e,t)=>{const n=e.getBoundingClientRect();let o={top:0,right:window.innerWidth||document.documentElement.clientWidth,bottom:window.innerHeight||document.documentElement.clientHeight,left:0};return void 0!==t&&(o=t.getBoundingClientRect()),n.top>=o.top&&n.right<=o.right&&n.bottom<=o.bottom&&n.left>=o.left},exports.isNodeList=e=>!(e instanceof HTMLElement||e instanceof Window),exports.onEvent=s,exports.removeChildren=u,exports.removeChilds=u,exports.removeClass=t,exports.removeEvent=c,exports.toggleClass=(e,r,i)=>{if(null!=e){e instanceof Element&&(e=[e]),e instanceof NodeList&&(e=Array.from(e));for(const s of e)!0===i?n(s,r):o(s,r)||!1===i?t(s,r):n(s,r)}},exports.waitFor=e=>new Promise((t=>{setTimeout((()=>t()),e)})),exports.waitForAnimationEnd=function(e,t){return new Promise(((n,o)=>{e.addEventListener(\"animationend\",(function o(r){r.target===e&&(t&&r.animationName!==t||(e.removeEventListener(\"animationend\",o),n(r)))}))}))},exports.waitForEvent=f,exports.waitForInitialization=e=>{var t;return!0===(null===(t=e.state)||void 0===t?void 0:t.initialized)?Promise.resolve():f(e,\"kl-component-initialized\",3e3)},exports.waitForTransitionEnd=function(e,t){return new Promise(((n,o)=>{e.addEventListener(\"transitionend\",(function o(r){r.target===e&&(t&&r.propertyName!==t||(e.removeEventListener(\"transitionend\",o),n(r)))}))}))};\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});exports.fetchJSON=(e,t)=>new Promise(((o,s)=>{fetch(e,t).then((e=>{e.ok?o(e.json()):s(e)})).catch((e=>s(e)))}));\n//# sourceMappingURL=index.js.map\n","\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});const e=e=>\"object\"==typeof e&&null!==e?JSON.stringify(e):String(e);exports.getValue=(e={},t=\"\")=>{const r=t.split(\".\");let o=0,n=e;for(;n&&otypeof t==typeof r&&(\"object\"==typeof t?0===e(t).localeCompare(e(r)):t===r),exports.isFilledObject=function(e){return\"object\"==typeof e&&null!==e&&Object.keys(e).length>0},exports.naiveClone=function e(t){return\"object\"!=typeof t?t:null===t?null:Array.isArray(t)?t.map((t=>e(t))):Object.entries(t).reduce(((t,[r,o])=>(t[r]=e(o),t)),{})},exports.toArray=e=>Array.isArray(e)?e:[e],exports.toString=e;\n//# sourceMappingURL=index.js.map\n","import{throttle as e}from\"@kluntje/js-utils/lib/function-helpers/decorators\";import{getCurrentMQ as t,onEvent as n}from\"@kluntje/js-utils/lib/dom-helpers\";import{fetchJSON as r}from\"@kluntje/js-utils/lib/api-helpers\";import{isFilledObject as s}from\"@kluntje/js-utils/lib/object-helpers\";const i=\"kl-mq-change\",a=\"kl-in-vp\",o=\"kl-out-vp\";class l{constructor(){}static getInstance(){return void 0===l.instance&&(l.instance=new IntersectionObserver(l.handleIntersectionChange)),l.instance}static handleIntersectionChange(e){Object.keys(e).forEach((t=>{const n=e[t],r=n.target;n.isIntersecting?r.dispatchEvent(new CustomEvent(\"kl-in-vp\",{bubbles:!1})):r.dispatchEvent(new CustomEvent(\"kl-out-vp\",{bubbles:!1}))}))}}\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */class c{constructor(){this.eventIdMap=new WeakMap,this.eventBindingMap={},this.lastMQ=t(c.mediaQuerys),n(window,\"resize\",this.handleMQChange,this)}static getInstance(e){return void 0===c.instance&&(c.mediaQuerys=e,c.instance=new c),c.instance}handleMQChange(){const e=t(c.mediaQuerys);e!==this.lastMQ&&(window.dispatchEvent(new CustomEvent(\"kl-mq-change\",{detail:{newMQ:e,oldMQ:this.lastMQ}})),this.lastMQ=e)}}!function(e,t,n,r){var s,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(a=(i<3?s(a):i>3?s(t,n,a):s(t,n))||a);i>3&&a&&Object.defineProperty(t,n,a)}([e(100)],c.prototype,\"handleMQChange\",null);const h=Symbol(\"resolve\"),d=Symbol(\"reject\"),u=Symbol(\"pending\");class p{static get PLACEHOLDER_SELECTOR(){return\"kl-i18n-placeholder\"}static getInstance(){return void 0===p._instance&&(p._instance=new p),p._instance}get isSetUp(){return Boolean(this._url||s(this._dictionary))}get loaded(){return this._loaded}get ready(){return this._ready[u]||this.fetchI18nDictionary(),this._ready}setUp({url:e,dictionary:t}={}){if(this.isSetUp)console.warn(\"@kluntje I18nService: service has already been set up. You can't set it up twice!\");else if(e)this._url=e;else{if(!t)throw new Error('@kluntje I18nService: a \"url\" or \"dictionary\" should have been passed to the setUp function.');this._dictionary=t,this._loaded=!0,this._ready[h](),this._ready[u]=!0}}get(e,{fallback:t,interpolations:n}={}){if(this.loaded){if(this._dictionary.hasOwnProperty(e)){let t=this._dictionary[e];return n&&Object.entries(n).forEach((([e,n])=>{t=t.split(`{${e}}`).join(String(n))})),t}return console.warn(`@kluntje I18nService: i18n for key '${e}' is missing in dictionary!`),void 0!==t?t:this.getHumanReadableName(e)}return this._ready[u]||(this.addStyling(),this.fetchI18nDictionary()),this.getPlaceholder(e,{fallback:t,interpolations:n})}constructor(){this._loaded=!1,this._dictionary={},this._ready=this.getReadyPromise()}getReadyPromise(){let e,t;const n=new Promise(((n,r)=>{e=n,t=r}));return n[h]=e,n[d]=t,n[u]=!1,n}ensureSetup(){if(!this.isSetUp)throw new Error(\"@kluntje I18nService: should be set up before calling other APIs\")}addStyling(){const e=document.head,t=document.createElement(\"style\");t.type=\"text/css\",t.appendChild(document.createTextNode(`\\n .${p.PLACEHOLDER_SELECTOR} {\\n display: contents;\\n }\\n `)),e.appendChild(t)}fetchI18nDictionary(){this.ensureSetup(),this._ready[u]=!0,r(this._url).then((e=>{this._dictionary=e,this._loaded=!0,this._ready[h](),this.fillInPlaceholders()})).catch((e=>{console.error(\"@kluntje I18nService: unable to fetch keys from server!\",e),this._loaded=!0,this._ready[h]()}))}fillInPlaceholders(){Array.from(document.getElementsByClassName(p.PLACEHOLDER_SELECTOR)).forEach((e=>{const{key:t,fallback:n,interpolations:r}=e.dataset;e.replaceWith(this.get(t,{fallback:n,interpolations:r?JSON.parse(r):void 0}))}))}getHumanReadableName(e){return e.split(\".\").reverse()[0].replace(/[A-Z]/g,(e=>` ${e.toLowerCase()}`))}getPlaceholder(e,{fallback:t,interpolations:n}={}){const r=document.createElement(\"span\");return r.innerText=void 0!==t?t:this.getHumanReadableName(e),r.classList.add(p.PLACEHOLDER_SELECTOR),r.setAttribute(\"data-key\",e),t&&r.setAttribute(\"data-fallback\",t),n&&r.setAttribute(\"data-interpolations\",JSON.stringify(n)),r.outerHTML}}var g=new class{constructor(){this.urlSearchParams=new URLSearchParams(window.location.search)}get(e){return this.urlSearchParams.get(e)}getAll(e){return this.urlSearchParams.getAll(e)}getAllKeys(){return Array.from(this.urlSearchParams.keys())}set(e,t){this.urlSearchParams.set(e,t),this.updateUrl()}delete(e){this.urlSearchParams.delete(e),this.updateUrl()}getString(){return this.urlSearchParams.toString()}get curUrl(){return`${window.location.protocol}//${window.location.host}${window.location.pathname}`}updateUrl(){const e=this.getString(),t=this.curUrl,n=window.location.hash,r=\"\"!==e?`${t}?${e}`:t;window.history.replaceState({path:r},\"\",r),\"\"!==n&&(window.location.hash=n)}};var m=new Proxy(console,{get:(e,t)=>null!==g.get(\"js-debug\")?e[t]:()=>{}});var y=new class{constructor(){this.componentMap=new WeakMap,this.intersectionObserver=new IntersectionObserver((e=>this.handleIntersectionChange(e)),{rootMargin:\"500px 0px\"})}subscribe(e,t){this.componentMap.set(e,t),this.intersectionObserver.observe(e)}unsubscribe(e){this.intersectionObserver.unobserve(e),this.componentMap.delete(e)}handleIntersectionChange(e){e.forEach((e=>{const t=e.target;if(!e.isIntersecting||!this.componentMap.has(t))return;const n=this.componentMap.get(t);this.unsubscribe(t),n()}))}};export{m as DebuggerService,p as I18nService,a as IN_VP_EVENT,y as LazyConnectService,i as MQ_CHANGE_EVENT,c as MediaQueryService,o as OUT_VP_EVENT,g as URLSearchParamsService,l as ViewportObserver};\n//# sourceMappingURL=index.module.js.map\n","import { RuntimeCache } from '../utils/RuntimeCache';\nimport { DebuggerService } from '@kluntje/services';\n\nexport interface FetchServiceCacheOptions {\n cacheType?: 'runtime'; // 'local' | 'session' | \"request\" can be added later\n}\n\nexport interface FetchServiceOptions {\n fetchOptions?: RequestInit;\n cacheOptions?: FetchServiceCacheOptions;\n}\n\nclass FetchService {\n private requestPipeline: Map> = new Map();\n\n private runtimeCache = new RuntimeCache();\n\n public fetchJson(endpoint: string, options: FetchServiceOptions = {}): Promise {\n return this.fetchData(this.getCodeBasePath(endpoint), options, this.getResponseJSON);\n }\n\n public async fetchText(endpoint: string, options: FetchServiceOptions = {}): Promise {\n return await this.fetchData(this.getCodeBasePath(endpoint), options, this.getResponseText);\n }\n\n private async fetchData(\n url: string,\n options: FetchServiceOptions,\n dataMapper: (Response) => Promise\n ): Promise {\n const { cacheOptions } = options;\n const cachedData = this.getCachedData(url, cacheOptions);\n if (cachedData !== null) return cachedData;\n\n const pipelinedRequest = this.requestPipeline.get(url);\n if (pipelinedRequest !== undefined) return dataMapper(await pipelinedRequest);\n\n const request = fetch(url, options.fetchOptions);\n this.requestPipeline.set(url, request);\n\n const response = await request;\n this.requestPipeline.delete(url);\n const responseData = await dataMapper(response);\n\n this.setCachedData(url, responseData, cacheOptions);\n\n if (!response.ok) {\n const errorText = await response.text();\n\n DebuggerService.error(`FetchService: Error fetching data from ${url}: ${errorText}`);\n\n throw new Error(`Error fetching data from ${url}: ${errorText}`);\n }\n return responseData;\n }\n\n private async getResponseJSON(response: Response): Promise {\n const responseClone = response.clone();\n const responseJson = await responseClone.json();\n return responseJson;\n }\n\n private async getResponseText(response: Response): Promise {\n const responseClone = response.clone();\n const responseText = await responseClone.text();\n return responseText;\n }\n\n private getCachedData(url: string, cacheOptions?: FetchServiceCacheOptions): T | null {\n if (cacheOptions?.cacheType === 'runtime') {\n return this.runtimeCache.get(url) ?? null;\n }\n return null;\n }\n\n private setCachedData(url: string, data: T, cacheOptions?: FetchServiceCacheOptions): void {\n if (cacheOptions?.cacheType === 'runtime') {\n this.runtimeCache.set(url, data);\n }\n }\n\n private getCodeBasePath(endpoint: string): string {\n const decoratedUrl = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;\n return `${window.hlx.codeBasePath}${decoratedUrl}`;\n }\n}\n\nexport default new FetchService();\n"],"names":["RuntimeCache","key","value","t","e","o","c","decorators","n","throttle","domHelpers","r","i","s","a","d","l","u","f","getCurrentMQ","onEvent","apiHelpers","objectHelpers","g","m","FetchService","endpoint","options","url","dataMapper","cacheOptions","cachedData","pipelinedRequest","request","response","responseData","errorText","DebuggerService","data","decoratedUrl","FetchService$1"],"mappings":"AAAO,MAAMA,CAAa,CAAnB,aAAA,CACG,KAAA,iBAAqC,GAAI,CAE1C,IAAOC,EAA4B,CACjC,OAAA,KAAK,aAAa,IAAIA,CAAG,CAClC,CAEO,IAAOA,EAAaC,EAAgB,CACpC,KAAA,aAAa,IAAID,EAAKC,CAAK,CAClC,CAEO,IAAID,EAAsB,CACxB,OAAA,KAAK,aAAa,IAAIA,CAAG,CAClC,CAEO,OAAOA,EAAmB,CAC1B,KAAA,aAAa,OAAOA,CAAG,CAC9B,CACF,YClBa,SAASE,EAAEA,EAAE,CAAC,OAAO,YAAYC,EAAE,CAAC,OAAO,SAAS,EAAEC,EAAEC,EAAE,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,CAAE,EAACA,CAAC,EAAE,CAAC,MAAMH,EAAEG,EAAE,MAAM,GAAGF,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,eAAeG,EAAQ,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,MAAMH,EAAED,EAAG,SAASA,EAAEC,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,MAAMC,EAAE,YAAY,EAAE,C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,MADCA,EAAS,QACU,MAE3C,CAEA,MAAc,gBAAgBA,EAAqC,CAG1D,OADc,MADCA,EAAS,QACU,MAE3C,CAEQ,cAAiBN,EAAaE,EAAmD,CACnF,OAAAA,GAAA,YAAAA,EAAc,aAAc,UACvB,KAAK,aAAa,IAAIF,CAAG,GAAK,KAEhC,IACT,CAEQ,cAAiBA,EAAaU,EAASR,EAA+C,EACxFA,GAAA,YAAAA,EAAc,aAAc,WACzB,KAAA,aAAa,IAAIF,EAAKU,CAAI,CAEnC,CAEQ,gBAAgBZ,EAA0B,CAChD,MAAMa,EAAeb,EAAS,WAAW,GAAG,EAAIA,EAAW,IAAIA,CAAQ,GACvE,MAAO,GAAG,OAAO,IAAI,YAAY,GAAGa,CAAY,EAClD,CACF,CAEA,MAAeC,EAAA,IAAIf","x_google_ignoreList":[1,2,3,4,5]} \ No newline at end of file diff --git a/dist/__chunks__/state.CJfvw0Ck.js b/dist/__chunks__/state.CJfvw0Ck.js new file mode 100644 index 00000000..2b1cf772 --- /dev/null +++ b/dist/__chunks__/state.CJfvw0Ck.js @@ -0,0 +1,6 @@ +import{n as t}from"./property.Ds9fqW-T.js";function a(e){return e.toLowerCase().replace(/[^0-9a-z]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function o(e){return t({...e,state:!0,attribute:!1})}export{o as r,a as t}; +//# sourceMappingURL=state.CJfvw0Ck.js.map diff --git a/dist/__chunks__/state.CJfvw0Ck.js.map b/dist/__chunks__/state.CJfvw0Ck.js.map new file mode 100644 index 00000000..09ec1280 --- /dev/null +++ b/dist/__chunks__/state.CJfvw0Ck.js.map @@ -0,0 +1 @@ +{"version":3,"file":"state.CJfvw0Ck.js","sources":["../../src/utils/toClassName.ts","../../node_modules/@lit/reactive-element/decorators/state.js"],"sourcesContent":["/**\n * Converts a string into a valid CSS class name.\n *\n * @param name - The string to convert into a CSS class name.\n * @returns The converted CSS class name.\n *\n * @example\n * // Example usage:\n * const inputString = 'Hello, World!';\n * const cssClassName = toClassName(inputString);\n * console.log(cssClassName); // Output: 'hello-world'\n */\nexport function toClassName(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^0-9a-z]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '');\n}\n","import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n"],"names":["toClassName","name","r","t"],"mappings":"2CAYO,SAASA,EAAYC,EAAsB,CAChD,OAAOA,EACJ,YAAA,EACA,QAAQ,cAAe,GAAG,EAC1B,QAAQ,MAAO,GAAG,EAClB,QAAQ,SAAU,EAAE,CACzB,CCjBA;AAAA;AAAA;AAAA;AAAA,GAIG,SAASC,EAAEA,EAAE,CAAC,OAAOC,EAAE,CAAC,GAAGD,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC,CAAC","x_google_ignoreList":[1]} \ No newline at end of file diff --git a/dist/__chunks__/toClassName.D9HYXfPD.js b/dist/__chunks__/toClassName.D9HYXfPD.js deleted file mode 100644 index 6cd93588..00000000 --- a/dist/__chunks__/toClassName.D9HYXfPD.js +++ /dev/null @@ -1,6 +0,0 @@ -import{n as t}from"./property.Ds9fqW-T.js";/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */function a(e){return t({...e,state:!0,attribute:!1})}function o(e){return e.toLowerCase().replace(/[^0-9a-z]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}export{a as r,o as t}; -//# sourceMappingURL=toClassName.D9HYXfPD.js.map diff --git a/dist/__chunks__/toClassName.D9HYXfPD.js.map b/dist/__chunks__/toClassName.D9HYXfPD.js.map deleted file mode 100644 index c4be5a33..00000000 --- a/dist/__chunks__/toClassName.D9HYXfPD.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"toClassName.D9HYXfPD.js","sources":["../../node_modules/@lit/reactive-element/decorators/state.js","../../src/utils/toClassName.ts"],"sourcesContent":["import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n","/**\n * Converts a string into a valid CSS class name.\n *\n * @param name - The string to convert into a CSS class name.\n * @returns The converted CSS class name.\n *\n * @example\n * // Example usage:\n * const inputString = 'Hello, World!';\n * const cssClassName = toClassName(inputString);\n * console.log(cssClassName); // Output: 'hello-world'\n */\nexport function toClassName(name: string): string {\n return name\n .toLowerCase()\n .replace(/[^0-9a-z]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '');\n}\n"],"names":["r","t","toClassName","name"],"mappings":"2CACA;AAAA;AAAA;AAAA;AAAA,GAIG,SAASA,EAAEA,EAAE,CAAC,OAAOC,EAAE,CAAC,GAAGD,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC,CAAC,CCOhD,SAASE,EAAYC,EAAsB,CAChD,OAAOA,EACJ,YAAA,EACA,QAAQ,cAAe,GAAG,EAC1B,QAAQ,MAAO,GAAG,EAClB,QAAQ,SAAU,EAAE,CACzB","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/form/form.js b/dist/form/form.js index 3eb8e035..6ac067b6 100644 --- a/dist/form/form.js +++ b/dist/form/form.js @@ -1,4 +1,4 @@ -import{x as n,T as u,s as f,j as w}from"../__chunks__/lit-element.CH8ciVnL.js";import{n as x,t as q}from"../__chunks__/property.Ds9fqW-T.js";import{t as D,r as E}from"../__chunks__/toClassName.D9HYXfPD.js";import{F as C,m as y}from"../__chunks__/fetch.service.DgmLKlDK.js";import{o as r}from"../__chunks__/if-defined.CrfpI-tB.js";/** +import{x as n,T as u,s as f,j as w}from"../__chunks__/lit-element.CH8ciVnL.js";import{n as x,t as q}from"../__chunks__/property.Ds9fqW-T.js";import{t as D,r as E}from"../__chunks__/state.CJfvw0Ck.js";import{F as C,m as y}from"../__chunks__/fetch.service.C1Ie3Sjw.js";import{o as r}from"../__chunks__/if-defined.CrfpI-tB.js";/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -6,5 +6,5 @@ import{x as n,T as u,s as f,j as w}from"../__chunks__/lit-element.CH8ciVnL.js";i * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function R(e,a){return(t,s,o)=>{const l=i=>{var m;return((m=i.renderRoot)==null?void 0:m.querySelector(e))??null};if(a){const{get:i,set:m}=typeof s=="object"?t:o??(()=>{const c=Symbol();return{get(){return this[c]},set(S){this[c]=S}}})();return F(t,s,{get(){let c=i.call(this);return c===void 0&&(c=l(this),(c!==null||this.hasUpdated)&&m.call(this,c)),c}})}return F(t,s,{get(){return l(this)}})}}const d=[],$=(e,a="")=>{const t=D(`form-${e.name}${a}`);d[t]=d[t]||0;const s=d[t]?`-${d[t]}`:"";return d[t]+=1,`${t}${s}`},j=e=>n`${e}`,I=e=>n`
${e.label?j(e.label):u}
`,L=e=>n`
${e.class&&e.class.includes("sub-heading")?n`

${e.value||e.label}

`:n`

${e.value||e.label}

`}
`,h=(e,a)=>n``,P=e=>n`

${e.value||e.label}

`,b=(e,a=!0)=>{const t=$(e,"-label");return n`
${a?h(t,e):u} ${a?u:h(t,e)}
`},O=e=>{const a=$(e,"-label");return n`
${e.label?h(a,e):u}
`},_=e=>(e.value||(e.value="checked"),b(e,!1)),T=(e,a)=>{const t=e.trim(),s=e.trim().toLowerCase()??"";return n``},k=e=>{const a=$(e,"-label");return n`
${e.label?h(a,e):u}
`},A=e=>(e.value||(e.value=e.label||"on"),b(e,!1)),g=e=>n`
`,N=e=>n`
`,U={headline:L,plaintext:P,text:b,textarea:O,checkbox:_,select:k,radio:A,button:g,fieldset:I,reset:N,submit:g},B=e=>{e.id=e.id||$(e);const a=e.type;return(U[a]||b)(e)};var H=Object.defineProperty,J=Object.getOwnPropertyDescriptor,v=(e,a,t,s)=>{for(var o=s>1?void 0:s?J(a,t):a,l=e.length-1,i;l>=0;l--)(i=e[l])&&(o=(s?i(a,t,o):i(o))||o);return s&&o&&H(a,t,o),o};let p=class extends f{constructor(){super(...arguments),this.pathname=""}createRenderRoot(){return this}async connectedCallback(){super.connectedCallback(),await this.fetchFormData(),this.setFieldsets()}async fetchFormData(){try{const a=(await C.fetchJson(this.pathname)).data.map(t=>this.parseFieldData(t));this.formData=a}catch(e){y.error(`Form Block: Error while fetching Sheets Response from ${this.pathname}`,e)}}render(){if(this.formData)return n`
${this.formData.map(e=>n`${B(e)}`)}
`}setFieldsets(){this.form.querySelectorAll("fieldset").forEach(a=>{this.form.querySelectorAll(`[data-fieldset="${a.name}"`).forEach(t=>{a.append(t)})})}parseFieldData(e){return{class:e.class!==""?e.class:void 0,id:e.id!==""?e.id:void 0,name:e.name,label:e.label,fieldset:e.fieldset!==""?e.fieldset:void 0,value:e.value!==""?e.value:void 0,type:e.type.toLowerCase(),placeholder:e.placeholder||void 0,options:e.options?e.options.split(",").map(a=>a.trim()):[],required:e.required.toLowerCase()==="true"||e.required.toLowerCase()==="x"?!0:void 0}}generatePayload(e){const a={};return[...e.elements].forEach(t=>{t.name&&t.type!=="submit"&&!t.disabled&&(t.type==="radio"?t.checked&&(a[t.name]=t.value):t.type==="checkbox"?t.checked&&(a[t.name]=a[t.name]?`${a[t.name]},${t.value}`:t.value):a[t.name]=t.value)}),a}handleSubmitError(e,a){y.error(`Form Component: Submit failed:${a}`),e.querySelector('button[type="submit"]').disabled=!1}submitForm(e){if(e.preventDefault(),this.form.checkValidity())this.handleSubmit(this.form);else{const t=this.querySelector(":invalid:not(fieldset)");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}))}}async handleSubmit(e){if(e.getAttribute("data-submitting")==="true")return;const a=e.querySelector('button[type="submit"]');try{e.setAttribute("data-submitting","true"),a&&(a.disabled=!0);const t=e.dataset.action??"",s=this.generatePayload(e),o=await fetch(t,{method:"POST",body:JSON.stringify({data:s}),headers:{"Content-Type":"application/json"}});if(o.ok)console.log(s),e.dataset.confirmation&&(window.location.href=e.dataset.confirmation);else{const l=await o.text();throw new Error(l)}}catch(t){this.handleSubmitError(e,t)}finally{e.setAttribute("data-submitting","false"),e.reset(),a&&(a.disabled=!1)}}};v([E()],p.prototype,"formData",2);v([x({type:String})],p.prototype,"pathname",2);v([R("form")],p.prototype,"form",2);p=v([q("form-component")],p);async function Q(e){var s;const a=(s=e.querySelector('a[href$=".json"]'))==null?void 0:s.innerText;if(!a)return;const{pathname:t}=new URL(a);e.innerHTML="",w(n``,e),e.style.display="block"}export{Q as default}; + */function R(e,a){return(t,s,o)=>{const l=i=>{var m;return((m=i.renderRoot)==null?void 0:m.querySelector(e))??null};if(a){const{get:i,set:m}=typeof s=="object"?t:o??(()=>{const c=Symbol();return{get(){return this[c]},set(S){this[c]=S}}})();return F(t,s,{get(){let c=i.call(this);return c===void 0&&(c=l(this),(c!==null||this.hasUpdated)&&m.call(this,c)),c}})}return F(t,s,{get(){return l(this)}})}}const d=[],$=(e,a="")=>{const t=D(`form-${e.name}${a}`);d[t]=d[t]||0;const s=d[t]?`-${d[t]}`:"";return d[t]+=1,`${t}${s}`},j=e=>n`${e}`,I=e=>n`
${e.label?j(e.label):u}
`,L=e=>n`
${e.class&&e.class.includes("sub-heading")?n`

${e.value||e.label}

`:n`

${e.value||e.label}

`}
`,h=(e,a)=>n``,P=e=>n`

${e.value||e.label}

`,b=(e,a=!0)=>{const t=$(e,"-label");return n`
${a?h(t,e):u} ${a?u:h(t,e)}
`},O=e=>{const a=$(e,"-label");return n`
${e.label?h(a,e):u}
`},_=e=>(e.value||(e.value="checked"),b(e,!1)),T=(e,a)=>{const t=e.trim(),s=e.trim().toLowerCase()??"";return n``},k=e=>{const a=$(e,"-label");return n`
${e.label?h(a,e):u}
`},A=e=>(e.value||(e.value=e.label||"on"),b(e,!1)),g=e=>n`
`,N=e=>n`
`,U={headline:L,plaintext:P,text:b,textarea:O,checkbox:_,select:k,radio:A,button:g,fieldset:I,reset:N,submit:g},B=e=>{e.id=e.id||$(e);const a=e.type;return(U[a]||b)(e)};var H=Object.defineProperty,J=Object.getOwnPropertyDescriptor,v=(e,a,t,s)=>{for(var o=s>1?void 0:s?J(a,t):a,l=e.length-1,i;l>=0;l--)(i=e[l])&&(o=(s?i(a,t,o):i(o))||o);return s&&o&&H(a,t,o),o};let p=class extends f{constructor(){super(...arguments),this.pathname=""}createRenderRoot(){return this}async connectedCallback(){super.connectedCallback(),await this.fetchFormData(),this.setFieldsets()}async fetchFormData(){try{const a=(await C.fetchJson(this.pathname)).data.map(t=>this.parseFieldData(t));this.formData=a}catch(e){y.error(`Form Block: Error while fetching Sheets Response from ${this.pathname}`,e)}}render(){if(this.formData)return n`
${this.formData.map(e=>n`${B(e)}`)}
`}setFieldsets(){this.form.querySelectorAll("fieldset").forEach(a=>{this.form.querySelectorAll(`[data-fieldset="${a.name}"`).forEach(t=>{a.append(t)})})}parseFieldData(e){return{class:e.class!==""?e.class:void 0,id:e.id!==""?e.id:void 0,name:e.name,label:e.label,fieldset:e.fieldset!==""?e.fieldset:void 0,value:e.value!==""?e.value:void 0,type:e.type.toLowerCase(),placeholder:e.placeholder||void 0,options:e.options?e.options.split(",").map(a=>a.trim()):[],required:e.required.toLowerCase()==="true"||e.required.toLowerCase()==="x"?!0:void 0}}generatePayload(e){const a={};return[...e.elements].forEach(t=>{t.name&&t.type!=="submit"&&!t.disabled&&(t.type==="radio"?t.checked&&(a[t.name]=t.value):t.type==="checkbox"?t.checked&&(a[t.name]=a[t.name]?`${a[t.name]},${t.value}`:t.value):a[t.name]=t.value)}),a}handleSubmitError(e,a){y.error(`Form Component: Submit failed:${a}`),e.querySelector('button[type="submit"]').disabled=!1}submitForm(e){if(e.preventDefault(),this.form.checkValidity())this.handleSubmit(this.form);else{const t=this.querySelector(":invalid:not(fieldset)");t&&(t.focus(),t.scrollIntoView({behavior:"smooth"}))}}async handleSubmit(e){if(e.getAttribute("data-submitting")==="true")return;const a=e.querySelector('button[type="submit"]');try{e.setAttribute("data-submitting","true"),a&&(a.disabled=!0);const t=e.dataset.action??"",s=this.generatePayload(e),o=await fetch(t,{method:"POST",body:JSON.stringify({data:s}),headers:{"Content-Type":"application/json"}});if(o.ok)e.dataset.confirmation&&(window.location.href=e.dataset.confirmation);else{const l=await o.text();throw new Error(l)}}catch(t){this.handleSubmitError(e,t)}finally{e.setAttribute("data-submitting","false"),e.reset(),a&&(a.disabled=!1)}}};v([E()],p.prototype,"formData",2);v([x({type:String})],p.prototype,"pathname",2);v([R("form")],p.prototype,"form",2);p=v([q("form-component")],p);async function Q(e){var s;const a=(s=e.querySelector('a[href$=".json"]'))==null?void 0:s.innerText;if(!a)return;const{pathname:t}=new URL(a);e.innerHTML="",w(n``,e),e.style.display="block"}export{Q as default}; //# sourceMappingURL=form.js.map diff --git a/dist/form/form.js.map b/dist/form/form.js.map index 0007031a..cbf108ab 100644 --- a/dist/form/form.js.map +++ b/dist/form/form.js.map @@ -1 +1 @@ -{"version":3,"file":"form.js","sources":["../../node_modules/@lit/reactive-element/decorators/base.js","../../node_modules/@lit/reactive-element/decorators/query.js","../../src/components/form/form.template.ts","../../src/components/form/form.ts","../../src/blocks/form/form.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&\"object\"!=typeof t&&Object.defineProperty(e,t,c),c);export{e as desc};\n//# sourceMappingURL=base.js.map\n","import{desc as t}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e,r){return(n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}=\"object\"==typeof s?n:i??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return t(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return t(n,s,{get(){return o(this)}})}}export{e as query};\n//# sourceMappingURL=query.js.map\n","import { html, nothing } from 'lit';\nimport { toClassName } from 'Utils/toClassName.ts';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nexport type FormFieldType =\n | 'headline'\n | 'plaintext'\n | 'text'\n | 'button'\n | 'fieldset'\n | 'select'\n | 'toggle'\n | 'radio'\n | 'checkbox'\n | 'textarea'\n | 'reset'\n | 'submit';\n\nexport interface FormField {\n class?: string;\n id?: string;\n name: string;\n label: string;\n fieldset?: string;\n value?: string;\n type: FormFieldType;\n}\n\nexport interface FormFieldInput extends FormField {\n placeholder?: string;\n required?: boolean;\n}\n\nexport interface FormFieldSelect extends FormField {\n options: string[];\n required?: boolean;\n}\n\nconst ids = [];\nconst generateFieldId = (field: FormField, suffix = '') => {\n const slug = toClassName(`form-${field.name}${suffix}`);\n ids[slug] = ids[slug] || 0;\n const idSuffix = ids[slug] ? `-${ids[slug]}` : '';\n ids[slug] += 1;\n return `${slug}${idSuffix}`;\n};\n\nconst renderLegend = (legend: string) => {\n return html` ${legend} `;\n};\n\nconst renderFieldset = (field: FormField) => {\n return html`\n
\n
\n ${field.label ? renderLegend(field.label) : nothing}\n
\n
\n `;\n};\n\nconst renderHeading = (field: FormFieldInput) => {\n return html`\n
\n ${field.class && field.class.includes('sub-heading')\n ? html`

${field.value || field.label}

`\n : html`

${field.value || field.label}

`}\n
\n `;\n};\n\nconst renderLabel = (id: string, field: FormField) => {\n return html` `;\n};\n\nconst renderPlaintext = (field: FormFieldInput) => {\n return html`\n
\n

${field.value || field.label}

\n
\n `;\n};\n\nconst renderInputField = (field: FormFieldInput, hasLabelOnTop = true) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${hasLabelOnTop ? renderLabel(labelId, field) : nothing}\n \n ${!hasLabelOnTop ? renderLabel(labelId, field) : nothing}\n
\n `;\n};\n\nconst renderTextareaField = (field: FormFieldInput) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${field.label ? renderLabel(labelId, field) : nothing}\n \n
\n `;\n};\n\nconst renderCheckboxField = (field: FormFieldInput) => {\n if (!field.value) field.value = 'checked';\n return renderInputField(field, false);\n};\n\nconst renderSelectFieldOption = (option: string, selectValue) => {\n const text = option.trim();\n const value = option.trim().toLowerCase() ?? '';\n const selected = value === selectValue ? '' : undefined;\n return html``;\n};\n\nconst renderSelectField = (field: FormFieldSelect) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${field.label ? renderLabel(labelId, field) : nothing}\n \n
\n `;\n};\n\nconst renderRadioField = (field: FormFieldInput) => {\n if (!field.value) field.value = field.label || 'on';\n return renderInputField(field, false);\n};\n\nconst renderButtonField = (field: FormField) => {\n return html`\n
\n \n
\n `;\n};\n\nconst renderResetField = (field: FormFieldInput) => {\n return html`\n
\n \n
\n `;\n};\n\nconst FIELD_RENDERER_FUNCTIONS = {\n headline: renderHeading,\n plaintext: renderPlaintext,\n text: renderInputField,\n textarea: renderTextareaField,\n checkbox: renderCheckboxField,\n select: renderSelectField,\n radio: renderRadioField,\n button: renderButtonField,\n fieldset: renderFieldset,\n reset: renderResetField,\n submit: renderButtonField,\n};\n\nexport const renderField = (field: FormField) => {\n field.id = field.id || generateFieldId(field);\n const type = field.type;\n const renderFieldFunc = FIELD_RENDERER_FUNCTIONS[type] || renderInputField;\n const fieldElements = renderFieldFunc(field);\n\n return fieldElements;\n};\n","import { html, LitElement } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { FormField, FormFieldInput, FormFieldSelect, FormFieldType, renderField } from './form.template.ts';\nimport { DebuggerService } from '@kluntje/services';\n\ntype FormElement = {\n name: string;\n type: string;\n label: string;\n placeholder: string;\n options: string;\n value: string;\n required: string;\n id: string;\n fieldset: string;\n class: string;\n};\n\ninterface SheetsResponse {\n type: string;\n data: FormElement[];\n offset: number;\n total: number;\n}\n\ntype FormPayload = Record;\n\n@customElement('form-component')\nexport class Form extends LitElement {\n @state()\n formData: FormField[];\n\n @property({ type: String })\n pathname: string = '';\n\n @query('form')\n form: HTMLFormElement;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n async connectedCallback() {\n super.connectedCallback();\n await this.fetchFormData();\n this.setFieldsets();\n }\n\n async fetchFormData() {\n try {\n const data: SheetsResponse = await FetchService.fetchJson(this.pathname);\n const detailsData = data.data.map((item: FormElement) => this.parseFieldData(item));\n this.formData = detailsData;\n } catch (error) {\n DebuggerService.error(`Form Block: Error while fetching Sheets Response from ${this.pathname}`, error);\n }\n }\n\n render() {\n if (!this.formData) return;\n return html`\n
\n
${this.formData.map((element) => html`${renderField(element)}`)}
\n
\n `;\n }\n\n setFieldsets() {\n // group fields into fieldsets\n const fieldsets = this.form.querySelectorAll('fieldset');\n fieldsets.forEach((fieldset) => {\n this.form.querySelectorAll(`[data-fieldset=\"${fieldset.name}\"`).forEach((field) => {\n fieldset.append(field);\n });\n });\n }\n\n parseFieldData(item: FormElement): FormField | FormFieldInput | FormFieldSelect {\n return {\n class: item.class !== '' ? item.class : undefined,\n id: item.id !== '' ? item.id : undefined,\n name: item.name,\n label: item.label,\n fieldset: item.fieldset !== '' ? item.fieldset : undefined,\n value: item.value !== '' ? item.value : undefined,\n type: item.type.toLowerCase() as FormFieldType,\n placeholder: item.placeholder || undefined,\n options: item.options ? item.options.split(',').map((option: string) => option.trim()) : [],\n required: item.required.toLowerCase() === 'true' || item.required.toLowerCase() === 'x' ? true : undefined,\n };\n }\n\n generatePayload(form: HTMLFormElement): FormPayload {\n const payload = {};\n\n [...(form.elements as HTMLCollectionOf)].forEach((field) => {\n if (field.name && field.type !== 'submit' && !field.disabled) {\n if (field.type === 'radio') {\n if (field.checked) payload[field.name] = field.value;\n } else if (field.type === 'checkbox') {\n if (field.checked)\n payload[field.name] = payload[field.name] ? `${payload[field.name]},${field.value}` : field.value;\n } else {\n payload[field.name] = field.value;\n }\n }\n });\n return payload;\n }\n\n handleSubmitError(form, error) {\n DebuggerService.error(`Form Component: Submit failed:${error}`);\n form.querySelector('button[type=\"submit\"]').disabled = false;\n }\n\n submitForm(e: Event) {\n e.preventDefault();\n const valid = this.form.checkValidity();\n if (valid) {\n this.handleSubmit(this.form);\n } else {\n const firstInvalidEl = this.querySelector(':invalid:not(fieldset)');\n if (firstInvalidEl) {\n firstInvalidEl.focus();\n firstInvalidEl.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n\n async handleSubmit(form: HTMLFormElement) {\n if (form.getAttribute('data-submitting') === 'true') return;\n\n const submit = form.querySelector('button[type=\"submit\"]');\n try {\n form.setAttribute('data-submitting', 'true');\n if (submit) submit.disabled = true;\n\n // create payload\n const action = form.dataset.action ?? '';\n const payload = this.generatePayload(form);\n const response = await fetch(action, {\n method: 'POST',\n body: JSON.stringify({ data: payload }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (response.ok) {\n console.log(payload);\n if (form.dataset.confirmation) {\n window.location.href = form.dataset.confirmation;\n }\n } else {\n const error = await response.text();\n throw new Error(error);\n }\n } catch (e) {\n this.handleSubmitError(form, e);\n } finally {\n form.setAttribute('data-submitting', 'false');\n form.reset();\n if (submit) submit.disabled = false;\n }\n }\n}\n","import { html, render } from 'lit';\nimport '../../components/form/form.ts';\nimport './form.scss';\n\nexport default async function decorate(block: HTMLElement) {\n const formLink = block.querySelector('a[href$=\".json\"]')?.innerText;\n if (!formLink) return;\n\n const { pathname } = new URL(formLink);\n block.innerHTML = '';\n render(html``, block);\n block.style.display = 'block';\n}\n"],"names":["e","t","c","r","n","i","o","_a","ids","generateFieldId","field","suffix","slug","toClassName","idSuffix","renderLegend","legend","html","renderFieldset","ifDefined","nothing","renderHeading","renderLabel","id","renderPlaintext","renderInputField","hasLabelOnTop","labelId","renderTextareaField","renderCheckboxField","renderSelectFieldOption","option","selectValue","text","value","renderSelectField","renderRadioField","renderButtonField","renderResetField","FIELD_RENDERER_FUNCTIONS","renderField","type","Form","LitElement","detailsData","FetchService","item","error","DebuggerService","element","fieldset","form","payload","firstInvalidEl","submit","action","response","__decorateClass","state","property","query","customElement","decorate","block","formLink","pathname","render"],"mappings":"0UAAA;AAAA;AAAA;AAAA;AAAA,GAKA,MAAMA,EAAE,CAAC,EAAEC,EAAEC,KAAKA,EAAE,aAAa,GAAGA,EAAE,WAAW,GAAG,QAAQ,UAAoB,OAAOD,GAAjB,UAAoB,OAAO,eAAe,EAAEA,EAAEC,CAAC,EAAEA,GCJvH;AAAA;AAAA;AAAA;AAAA,GAIG,SAASF,EAAE,EAAEG,EAAE,CAAC,MAAM,CAACC,EAAE,EAAEC,IAAI,CAAC,MAAMC,EAAEL,GAAC,OAAE,QAAAM,EAAAN,EAAE,aAAF,YAAAM,EAAc,cAAc,KAAI,MAAK,GAAGJ,EAAE,CAAC,KAAK,CAAC,IAAIH,EAAE,IAAIG,CAAC,EAAY,OAAO,GAAjB,SAAmBC,EAAEC,IAAI,IAAI,CAAC,MAAMJ,EAAE,OAAM,EAAG,MAAM,CAAC,KAAK,CAAC,OAAO,KAAKA,CAAC,CAAC,EAAE,IAAID,EAAE,CAAC,KAAKC,CAAC,EAAED,CAAC,CAAC,CAAC,GAAC,EAAI,OAAOC,EAAEG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAIH,EAAED,EAAE,KAAK,IAAI,EAAE,OAAgBC,IAAT,SAAaA,EAAEK,EAAE,IAAI,GAAUL,IAAP,MAAU,KAAK,aAAaE,EAAE,KAAK,KAAKF,CAAC,GAAGA,CAAC,CAAC,CAAC,CAAC,CAAC,OAAOA,EAAEG,EAAE,EAAE,CAAC,KAAK,CAAC,OAAOE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CCiC5W,MAAME,EAAM,CAAA,EACNC,EAAkB,CAACC,EAAkBC,EAAS,KAAO,CACzD,MAAMC,EAAOC,EAAY,QAAQH,EAAM,IAAI,GAAGC,C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G,EAAA,CADCC,EAAM,CAAA,EADIhB,EAEX,UAAA,WAAA,CAAA,EAGAe,EAAA,CADCE,EAAS,CAAE,KAAM,OAAQ,CAAA,EAJfjB,EAKX,UAAA,WAAA,CAAA,EAGAe,EAAA,CADCG,EAAM,MAAM,CAAA,EAPFlB,EAQX,UAAA,OAAA,CAAA,EARWA,EAANe,EAAA,CADNI,EAAc,gBAAgB,CAAA,EAClBnB,CAAA,ECzBb,eAA8BoB,EAASC,EAAoB,OACzD,MAAMC,GAAWzD,EAAAwD,EAAM,cAA2B,kBAAkB,IAAnD,YAAAxD,EAAsD,UACvE,GAAI,CAACyD,EAAU,OAEf,KAAM,CAAE,SAAAC,CAAa,EAAA,IAAI,IAAID,CAAQ,EACrCD,EAAM,UAAY,GACXG,EAAAjD,8BAAiCgD,CAAQ,sBAAuBF,CAAK,EAC5EA,EAAM,MAAM,QAAU,OACxB","x_google_ignoreList":[0,1]} \ No newline at end of file +{"version":3,"file":"form.js","sources":["../../node_modules/@lit/reactive-element/decorators/base.js","../../node_modules/@lit/reactive-element/decorators/query.js","../../src/components/form/form.template.ts","../../src/components/form/form.ts","../../src/blocks/form/form.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&\"object\"!=typeof t&&Object.defineProperty(e,t,c),c);export{e as desc};\n//# sourceMappingURL=base.js.map\n","import{desc as t}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e,r){return(n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}=\"object\"==typeof s?n:i??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return t(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return t(n,s,{get(){return o(this)}})}}export{e as query};\n//# sourceMappingURL=query.js.map\n","import { html, nothing } from 'lit';\nimport { toClassName } from 'Utils/toClassName.ts';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nexport type FormFieldType =\n | 'headline'\n | 'plaintext'\n | 'text'\n | 'button'\n | 'fieldset'\n | 'select'\n | 'toggle'\n | 'radio'\n | 'checkbox'\n | 'textarea'\n | 'reset'\n | 'submit';\n\nexport interface FormField {\n class?: string;\n id?: string;\n name: string;\n label: string;\n fieldset?: string;\n value?: string;\n type: FormFieldType;\n}\n\nexport interface FormFieldInput extends FormField {\n placeholder?: string;\n required?: boolean;\n}\n\nexport interface FormFieldSelect extends FormField {\n options: string[];\n required?: boolean;\n}\n\nconst ids = [];\nconst generateFieldId = (field: FormField, suffix = '') => {\n const slug = toClassName(`form-${field.name}${suffix}`);\n ids[slug] = ids[slug] || 0;\n const idSuffix = ids[slug] ? `-${ids[slug]}` : '';\n ids[slug] += 1;\n return `${slug}${idSuffix}`;\n};\n\nconst renderLegend = (legend: string) => {\n return html` ${legend} `;\n};\n\nconst renderFieldset = (field: FormField) => {\n return html`\n
\n
\n ${field.label ? renderLegend(field.label) : nothing}\n
\n
\n `;\n};\n\nconst renderHeading = (field: FormFieldInput) => {\n return html`\n
\n ${field.class && field.class.includes('sub-heading')\n ? html`

${field.value || field.label}

`\n : html`

${field.value || field.label}

`}\n
\n `;\n};\n\nconst renderLabel = (id: string, field: FormField) => {\n return html` `;\n};\n\nconst renderPlaintext = (field: FormFieldInput) => {\n return html`\n
\n

${field.value || field.label}

\n
\n `;\n};\n\nconst renderInputField = (field: FormFieldInput, hasLabelOnTop = true) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${hasLabelOnTop ? renderLabel(labelId, field) : nothing}\n \n ${!hasLabelOnTop ? renderLabel(labelId, field) : nothing}\n
\n `;\n};\n\nconst renderTextareaField = (field: FormFieldInput) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${field.label ? renderLabel(labelId, field) : nothing}\n \n
\n `;\n};\n\nconst renderCheckboxField = (field: FormFieldInput) => {\n if (!field.value) field.value = 'checked';\n return renderInputField(field, false);\n};\n\nconst renderSelectFieldOption = (option: string, selectValue) => {\n const text = option.trim();\n const value = option.trim().toLowerCase() ?? '';\n const selected = value === selectValue ? '' : undefined;\n return html``;\n};\n\nconst renderSelectField = (field: FormFieldSelect) => {\n const labelId = generateFieldId(field, '-label');\n return html`\n
\n ${field.label ? renderLabel(labelId, field) : nothing}\n \n
\n `;\n};\n\nconst renderRadioField = (field: FormFieldInput) => {\n if (!field.value) field.value = field.label || 'on';\n return renderInputField(field, false);\n};\n\nconst renderButtonField = (field: FormField) => {\n return html`\n
\n \n
\n `;\n};\n\nconst renderResetField = (field: FormFieldInput) => {\n return html`\n
\n \n
\n `;\n};\n\nconst FIELD_RENDERER_FUNCTIONS = {\n headline: renderHeading,\n plaintext: renderPlaintext,\n text: renderInputField,\n textarea: renderTextareaField,\n checkbox: renderCheckboxField,\n select: renderSelectField,\n radio: renderRadioField,\n button: renderButtonField,\n fieldset: renderFieldset,\n reset: renderResetField,\n submit: renderButtonField,\n};\n\nexport const renderField = (field: FormField) => {\n field.id = field.id || generateFieldId(field);\n const type = field.type;\n const renderFieldFunc = FIELD_RENDERER_FUNCTIONS[type] || renderInputField;\n const fieldElements = renderFieldFunc(field);\n\n return fieldElements;\n};\n","import { html, LitElement } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { FormField, FormFieldInput, FormFieldSelect, FormFieldType, renderField } from './form.template.ts';\nimport { DebuggerService } from '@kluntje/services';\n\ntype FormElement = {\n name: string;\n type: string;\n label: string;\n placeholder: string;\n options: string;\n value: string;\n required: string;\n id: string;\n fieldset: string;\n class: string;\n};\n\ninterface SheetsResponse {\n type: string;\n data: FormElement[];\n offset: number;\n total: number;\n}\n\ntype FormPayload = Record;\n\n@customElement('form-component')\nexport class Form extends LitElement {\n @state()\n formData: FormField[];\n\n @property({ type: String })\n pathname: string = '';\n\n @query('form')\n form: HTMLFormElement;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n async connectedCallback() {\n super.connectedCallback();\n await this.fetchFormData();\n this.setFieldsets();\n }\n\n async fetchFormData() {\n try {\n const data: SheetsResponse = await FetchService.fetchJson(this.pathname);\n const detailsData = data.data.map((item: FormElement) => this.parseFieldData(item));\n this.formData = detailsData;\n } catch (error) {\n DebuggerService.error(`Form Block: Error while fetching Sheets Response from ${this.pathname}`, error);\n }\n }\n\n render() {\n if (!this.formData) return;\n return html`\n
\n
${this.formData.map((element) => html`${renderField(element)}`)}
\n
\n `;\n }\n\n setFieldsets() {\n // group fields into fieldsets\n const fieldsets = this.form.querySelectorAll('fieldset');\n fieldsets.forEach((fieldset) => {\n this.form.querySelectorAll(`[data-fieldset=\"${fieldset.name}\"`).forEach((field) => {\n fieldset.append(field);\n });\n });\n }\n\n parseFieldData(item: FormElement): FormField | FormFieldInput | FormFieldSelect {\n return {\n class: item.class !== '' ? item.class : undefined,\n id: item.id !== '' ? item.id : undefined,\n name: item.name,\n label: item.label,\n fieldset: item.fieldset !== '' ? item.fieldset : undefined,\n value: item.value !== '' ? item.value : undefined,\n type: item.type.toLowerCase() as FormFieldType,\n placeholder: item.placeholder || undefined,\n options: item.options ? item.options.split(',').map((option: string) => option.trim()) : [],\n required: item.required.toLowerCase() === 'true' || item.required.toLowerCase() === 'x' ? true : undefined,\n };\n }\n\n generatePayload(form: HTMLFormElement): FormPayload {\n const payload = {};\n\n [...(form.elements as HTMLCollectionOf)].forEach((field) => {\n if (field.name && field.type !== 'submit' && !field.disabled) {\n if (field.type === 'radio') {\n if (field.checked) payload[field.name] = field.value;\n } else if (field.type === 'checkbox') {\n if (field.checked)\n payload[field.name] = payload[field.name] ? `${payload[field.name]},${field.value}` : field.value;\n } else {\n payload[field.name] = field.value;\n }\n }\n });\n return payload;\n }\n\n handleSubmitError(form, error) {\n DebuggerService.error(`Form Component: Submit failed:${error}`);\n form.querySelector('button[type=\"submit\"]').disabled = false;\n }\n\n submitForm(e: Event) {\n e.preventDefault();\n const valid = this.form.checkValidity();\n if (valid) {\n this.handleSubmit(this.form);\n } else {\n const firstInvalidEl = this.querySelector(':invalid:not(fieldset)');\n if (firstInvalidEl) {\n firstInvalidEl.focus();\n firstInvalidEl.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n\n async handleSubmit(form: HTMLFormElement) {\n if (form.getAttribute('data-submitting') === 'true') return;\n\n const submit = form.querySelector('button[type=\"submit\"]');\n try {\n form.setAttribute('data-submitting', 'true');\n if (submit) submit.disabled = true;\n\n // create payload\n const action = form.dataset.action ?? '';\n const payload = this.generatePayload(form);\n const response = await fetch(action, {\n method: 'POST',\n body: JSON.stringify({ data: payload }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (response.ok) {\n if (form.dataset.confirmation) {\n window.location.href = form.dataset.confirmation;\n }\n } else {\n const error = await response.text();\n throw new Error(error);\n }\n } catch (e) {\n this.handleSubmitError(form, e);\n } finally {\n form.setAttribute('data-submitting', 'false');\n form.reset();\n if (submit) submit.disabled = false;\n }\n }\n}\n","import { html, render } from 'lit';\nimport '../../components/form/form.ts';\nimport './form.scss';\n\nexport default async function decorate(block: HTMLElement) {\n const formLink = block.querySelector('a[href$=\".json\"]')?.innerText;\n if (!formLink) return;\n\n const { pathname } = new URL(formLink);\n block.innerHTML = '';\n render(html``, block);\n block.style.display = 'block';\n}\n"],"names":["e","t","c","r","n","i","o","_a","ids","generateFieldId","field","suffix","slug","toClassName","idSuffix","renderLegend","legend","html","renderFieldset","ifDefined","nothing","renderHeading","renderLabel","id","renderPlaintext","renderInputField","hasLabelOnTop","labelId","renderTextareaField","renderCheckboxField","renderSelectFieldOption","option","selectValue","text","value","renderSelectField","renderRadioField","renderButtonField","renderResetField","FIELD_RENDERER_FUNCTIONS","renderField","type","Form","LitElement","detailsData","FetchService","item","error","DebuggerService","element","fieldset","form","payload","firstInvalidEl","submit","action","response","__decorateClass","state","property","query","customElement","decorate","block","formLink","pathname","render"],"mappings":"oUAAA;AAAA;AAAA;AAAA;AAAA,GAKA,MAAMA,EAAE,CAAC,EAAEC,EAAEC,KAAKA,EAAE,aAAa,GAAGA,EAAE,WAAW,GAAG,QAAQ,UAAoB,OAAOD,GAAjB,UAAoB,OAAO,eAAe,EAAEA,EAAEC,CAAC,EAAEA,GCJvH;AAAA;AAAA;AAAA;AAAA,GAIG,SAASF,EAAE,EAAEG,EAAE,CAAC,MAAM,CAACC,EAAE,EAAEC,IAAI,CAAC,MAAMC,EAAEL,GAAC,OAAE,QAAAM,EAAAN,EAAE,aAAF,YAAAM,EAAc,cAAc,KAAI,MAAK,GAAGJ,EAAE,CAAC,KAAK,CAAC,IAAIH,EAAE,IAAIG,CAAC,EAAY,OAAO,GAAjB,SAAmBC,EAAEC,IAAI,IAAI,CAAC,MAAMJ,EAAE,OAAM,EAAG,MAAM,CAAC,KAAK,CAAC,OAAO,KAAKA,CAAC,CAAC,EAAE,IAAID,EAAE,CAAC,KAAKC,CAAC,EAAED,CAAC,CAAC,CAAC,GAAC,EAAI,OAAOC,EAAEG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAIH,EAAED,EAAE,KAAK,IAAI,EAAE,OAAgBC,IAAT,SAAaA,EAAEK,EAAE,IAAI,GAAUL,IAAP,MAAU,KAAK,aAAaE,EAAE,KAAK,KAAKF,CAAC,GAAGA,CAAC,CAAC,CAAC,CAAC,CAAC,OAAOA,EAAEG,EAAE,EAAE,CAAC,KAAK,CAAC,OAAOE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CCiC5W,MAAME,EAAM,CAAA,EACNC,EAAkB,CAACC,EAAkBC,EAAS,KAAO,CACzD,MAAMC,EAAOC,EAAY,QAAQH,EAAM,IAAI,GAAGC,CAAM,EAAE,EACtDH,EAAII,CAAI,EAAIJ,EAAII,CAAI,GAAK,EACnB,MAAAE,EAAWN,EAAII,CAAI,EAAI,IA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AA,WAAA,CAAA,EAGAe,EAAA,CADCG,EAAM,MAAM,CAAA,EAPFlB,EAQX,UAAA,OAAA,CAAA,EARWA,EAANe,EAAA,CADNI,EAAc,gBAAgB,CAAA,EAClBnB,CAAA,ECzBb,eAA8BoB,EAASC,EAAoB,OACzD,MAAMC,GAAWzD,EAAAwD,EAAM,cAA2B,kBAAkB,IAAnD,YAAAxD,EAAsD,UACvE,GAAI,CAACyD,EAAU,OAEf,KAAM,CAAE,SAAAC,CAAa,EAAA,IAAI,IAAID,CAAQ,EACrCD,EAAM,UAAY,GACXG,EAAAjD,8BAAiCgD,CAAQ,sBAAuBF,CAAK,EAC5EA,EAAM,MAAM,QAAU,OACxB","x_google_ignoreList":[0,1]} \ No newline at end of file diff --git a/dist/main/main.js b/dist/main/main.js index 950d3010..ef6593c9 100644 --- a/dist/main/main.js +++ b/dist/main/main.js @@ -1,28 +1,28 @@ -import{T as u,s as v,x as c,w as N,i as te}from"../__chunks__/lit-element.CH8ciVnL.js";import{t as g,n as re}from"../__chunks__/property.Ds9fqW-T.js";import{i as se,t as oe,e as x,o as J,a as ie}from"../__chunks__/unsafe-html.C_rT9aKG.js";import{r as h,t as D}from"../__chunks__/toClassName.D9HYXfPD.js";import{F as w,m as p}from"../__chunks__/fetch.service.DgmLKlDK.js";import{r as I}from"../__chunks__/icon.template.3G0fuXUC.js";import{P as m,c as ne}from"../__chunks__/createOptimizedPicture.Z5VLB_Rl.js";import{_ as a}from"../__chunks__/preload-helper.D7itGvJr.js";import{i as S}from"../__chunks__/isSidekickLibraryActive.U-fJCMMj.js";/** +import{t as k,r as p}from"../__chunks__/state.CJfvw0Ck.js";import{_ as n}from"../__chunks__/preload-helper.D7itGvJr.js";import{g as se,m as _,F as L}from"../__chunks__/fetch.service.C1Ie3Sjw.js";import{i as R}from"../__chunks__/isSidekickLibraryActive.U-fJCMMj.js";import{T as f,s as v,x as l,w as X,i as pe}from"../__chunks__/lit-element.CH8ciVnL.js";import{t as y,n as fe}from"../__chunks__/property.Ds9fqW-T.js";import{i as me,t as _e,e as j,o as oe,a as ge}from"../__chunks__/unsafe-html.C_rT9aKG.js";import{r as z}from"../__chunks__/icon.template.3G0fuXUC.js";import{P as g,c as ve}from"../__chunks__/createOptimizedPicture.CyR9tLTg.js";const K=(e,t)=>{t.split(",").forEach(r=>{e.classList.add(k(r.trim()))})};function V(e,t=document){const r=e&&e.includes(":")?"property":"name",o=[...t.head.querySelectorAll(`meta[${r}="${e}"]`)].map(i=>i.content).join(", ");return o.length?o:""}function ye(){const e=V("template");e&&K(document.body,e);const t=V("theme");t&&K(document.body,t)}function be(e){e.querySelectorAll("a").forEach(t=>{if(t.title=t.title||t.textContent,t.href!==t.textContent){const r=t.parentElement,s=t.parentElement.parentElement;t.querySelector("img")||(r.childNodes.length===1&&(r.tagName==="P"||r.tagName==="DIV")&&(t.className="button",r.classList.add("button-container")),r.childNodes.length===1&&r.tagName==="STRONG"&&s.childNodes.length===1&&s.tagName==="P"&&(t.className="button primary",s.classList.add("button-container")),r.childNodes.length===1&&r.tagName==="EM"&&s.childNodes.length===1&&s.tagName==="P"&&(t.className="button secondary",s.classList.add("button-container")))}})}function Pe(e){return e.trim()===""?void 0:e}function we(){const e=V("language");document.documentElement.lang=Pe(e)||"en"}function ie(e){const t=[];return e.querySelectorAll("[data-block-name]").forEach(s=>{t.push({name:s.dataset.blockName,element:s})}),t}async function ae(e){const t=e.element.dataset.blockStatus;if(t!=="loading"&&t!=="loaded")try{e.element.dataset.blockStatus="loading";const{href:r}=se(`dist/${e.name}/${e.name}.js`),s=await n(()=>import(r),__vite__mapDeps([]));s.default&&await s.default(e.element),e.element.dataset.blockStatus="loaded"}catch(r){e.element.dataset.blockStatus="error",_.error("laodBloackModules:",r)}}async function E(e){return new Promise((t,r)=>{const{href:s}=se(e);if(document.querySelector(`head > link[href="${s}"]`))t(!0);else{const o=document.createElement("link");o.rel="stylesheet",o.href=s,o.onload=t,o.onerror=r,document.head.append(o)}})}async function ne(e){try{await E(`dist/${e.name}/${e.name}.css`)}catch{}}const H={mainTsPath:"./src/main.ts",mainScssPath:"./src/styles/sass/main.scss",iconsDirPath:"./public/icons",iconsTypesPath:"./src/types/icons.types.ts",fontsScssPath:"./src/styles/sass/fonts.scss",fontsCssPath:"./dist/fonts/fonts.css",lazyStylesScssPath:"./src/styles/sass/lazy-styles.scss",lazyStylesCssPath:"./dist/lazyStyles/lazyStyles.css",sidekickLibraryStylesScssPath:"./src/styles/sass/sidekick-library-styles.scss",sidekickLibraryStylesCssPath:"./dist/sidekickLibraryStyles/sidekickLibraryStyles.css",lcpBlocks:[]};function N(e){e.style.removeProperty("display")}async function Le(){const e=document.querySelector(".section"),{lcpBlocks:t}=H;if(e){const o=ie(e).map(async i=>{(t==null?void 0:t.includes(i.name))&&await Promise.all([ae(i),ne(i)])});await Promise.all(o),N(e)}document.body.style.display=null;const r=document.querySelector("main img");await new Promise(s=>{r&&!r.complete?(r.setAttribute("loading","eager"),r.setAttribute("fetchpriority","high"),r.addEventListener("load",()=>s()),r.addEventListener("error",()=>s())):s()})}function $e(){return R()?window.parent.location:window.location}async function W(){const{fontsCssPath:e}=H;if(e){await E(e);try{$e().hostname.includes("localhost")||sessionStorage.setItem("fonts-loaded","true")}catch(t){console.error("Error setting fonts-loaded in session storage",t)}}}function c(e,t={}){c.defer=c.defer||[];const r=s=>{c[s]=c[s]||((...o)=>c.defer.push({fnname:s,args:o}))};c.drain=c.drain||((s,o)=>{c[s]=o,c.defer.filter(({fnname:i})=>s===i).forEach(({fnname:i,args:a})=>c[i](...a))}),c.always=c.always||[],c.always.on=(s,o)=>{c.always[s]=o},c.on=(s,o)=>{c.cases[s]=o},r("observe"),r("cwv");try{if(window.hlx=window.hlx||{},!window.hlx.rum){const d=new URLSearchParams(window.location.search).get("rum")==="on"?1:100,h=Array.from({length:75},(Z,ue)=>String.fromCharCode(48+ue)).filter(Z=>/\d|[A-Z]/i.test(Z)).filter(()=>Math.random()*75>70).join(""),m=Math.random(),u=m*d<1,b=Date.now(),he={full:()=>window.location.href,origin:()=>window.location.origin,path:()=>window.location.href.replace(/\?.*$/,"")};window.hlx.rum={weight:d,id:h,random:m,isSelected:u,firstReadTime:b,sampleRUM:c,sanitizeURL:he[window.hlx.RUM_MASK_URL||"path"]}}const{weight:s,id:o,firstReadTime:i}=window.hlx.rum;if(window.hlx&&window.hlx.rum&&window.hlx.rum.isSelected){const a=["weight","id","referer","checkpoint","t","source","target","cwv","CLS","FID","LCP","INP"],d=(h=t)=>{const m=JSON.stringify({weight:s,id:o,referer:window.hlx.rum.sanitizeURL(),checkpoint:e,t:Date.now()-i,...t},a),u=`https://rum.hlx.page/.rum/${s}`;navigator.sendBeacon(u,m),console.debug(`ping:${e}`,h)};c.cases=c.cases||{cwv:()=>c.cwv(t)||!0,lazy:()=>{const h=document.createElement("script");return h.src="https://rum.hlx.page/.rum/@adobe/helix-rum-enhancer@^1/src/index.js",document.head.appendChild(h),!0}},d(t),c.cases[e]&&c.cases[e]()}c.always[e]&&c.always[e](t)}catch{}}function Ee(e="/dist/main/main.js"){window.hlx=window.hlx||{},window.hlx.RUM_MASK_URL="full",window.hlx.codeBasePath="",window.hlx.lighthouse=new URLSearchParams(window.location.search).get("lighthouse")==="on";const t=document.querySelector(`script[src$="${e}"]`);if(t)try{[window.hlx.codeBasePath]=new URL(t.src).pathname.split(e)}catch(r){console.log("setupHlxObj",r)}}function Ce(){Ee(),c("top"),window.addEventListener("load",()=>c("load")),window.addEventListener("unhandledrejection",e=>{c("error",{source:e.reason.sourceURL,target:e.reason.line})}),window.addEventListener("error",e=>{c("error",{source:e.filename,target:e.lineno})})}async function Te(e){const t=ie(e);if(!t.length){N(e);return}for(const r of t)Promise.all([ae(r),ne(r)]);N(e)}async function Se(){const t=[...document.querySelectorAll(".section")].map(r=>Te(r));await Promise.all(t)}function Ae(){document.querySelectorAll(".default-content-wrapper picture").forEach(t=>{const r=t.parentElement;r&&r.classList.add("image","main")})}function De(e){const t=[];let r=!1;[...e.children].forEach(s=>{if(s.tagName==="DIV"||!r){const o=document.createElement("div");t.push(o),r=s.tagName!=="DIV",r&&o.classList.add("default-content-wrapper")}t[t.length-1].append(s)}),t.forEach(s=>e.append(s)),Ae(),e.classList.add("section"),e.dataset.sectionStatus="initialized",e.style.display="none"}function Oe(e){return/^[a-z][A-Za-z0-9]*$/.test(e)?e:/^[A-Z][A-Za-z0-9]*$/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):k(e).replace(/-([a-z])/g,t=>t[1].toUpperCase())}function Ie(e){const t={};return e.querySelectorAll(":scope > div").forEach(r=>{if(r.children){const s=[...r.children];if(s[1]){const o=s[1],i=k(s[0].textContent??"");let a="";if(o.querySelector("a")){const d=[...o.querySelectorAll("a")];d.length===1?a=d[0].href:a=d.map(h=>h.href)}else if(o.querySelector("img")){const d=[...o.querySelectorAll("img")];d.length===1?a=d[0].src:a=d.map(h=>h.src)}else if(o.querySelector("p")){const d=[...o.querySelectorAll("p")];d.length===1?a=d[0].textContent:a=d.map(h=>h.textContent)}else a=r.children[1].textContent;t[i]=a}}}),t}function ke(e){const t=e.querySelector("div.section-metadata");if(t){const r=Ie(t);Object.keys(r).forEach(s=>{s==="style"?r.style.split(",").filter(i=>i).map(i=>k(i.trim())).forEach(i=>e.classList.add(i)):e.dataset[Oe(s)]=r[s]}),t.parentElement&&t.parentElement.remove()}}function Re(e){e.querySelectorAll(":scope > div").forEach(t=>{De(t),ke(t)})}function ze(e){e.querySelectorAll("div.section > div > div").forEach(t=>{const r=t.classList[0];if(r){t.classList.add("block"),t.dataset.blockName=r;const s=t.parentElement;s==null||s.classList.add(`${r}-wrapper`);const o=t.closest(".section");o&&o.classList.add(`${r}-container`)}})}class xe{constructor(){this.beforeEagerCallbacks=[],this.loadEagerCallbacks=[],this.beforeLoadLazyCallbacks=[],this.loadLazyCallbacks=[],this.beforeLoadDelayedCallbacks=[],this.loadDelayedCallbacks=[],this.initializedCallbacks=[]}get beforeEager(){return this.beforeEagerPromise===void 0&&(this.beforeEagerPromise=this.beforeLoadEager()),this.beforeEagerPromise}get loadEager(){return this.eagerPromise===void 0&&(this.eagerPromise=this.loadEagerPromise()),this.eagerPromise}get beforeLoadLazy(){return this.beforeLazyPromise===void 0&&(this.beforeLazyPromise=this.beforeLoadLazyPromise()),this.beforeLazyPromise}get loadLazy(){return this.lazyPromise===void 0&&(this.lazyPromise=this.loadLazyPromise()),this.lazyPromise}get beforeLoadDelayed(){return this.beforeDelayedPromise===void 0&&(this.beforeDelayedPromise=this.beforeLoadDelayedPromise()),this.beforeDelayedPromise}get loadDelayed(){return this.delayedPromise===void 0&&(this.delayedPromise=this.loadDelayedPromise()),this.delayedPromise}get initialized(){return this.initializedPromise===void 0&&(this.initializedPromise=this.getInitializedPromise()),this.initializedPromise}addBeforeEagerTask(t){this.beforeEagerCallbacks.push(t)}addLoadEagerTask(t){this.loadEagerCallbacks.push(t)}addBeforeLoadLazyTask(t){this.beforeLoadLazyCallbacks.push(t)}addLoadLazyTask(t){this.loadLazyCallbacks.push(t)}addBeforeLoadDelayedTask(t){this.beforeLoadDelayedCallbacks.push(t)}addLoadDelayedTask(t){this.loadDelayedCallbacks.push(t)}addInitializedTask(t){this.initializedCallbacks.push(t)}async init(){await this.beforeEager,await this.loadEager,await this.beforeLoadLazy,await this.loadLazy,await this.beforeLoadDelayed,await this.loadDelayed,await this.initialized}async beforeLoadEager(){const t=new Promise(r=>{Ce(),ye(),we(),r()});await Promise.all([...this.beforeEagerCallbacks.map(r=>r()),t])}async loadEagerPromise(){const t=new Promise(async r=>{const s=document.querySelector("main");be(s),Re(s),ze(s),setTimeout(()=>{document.body.classList.add("show"),r()},100),await Le();try{(window.innerWidth>=900||sessionStorage.getItem("fonts-loaded"))&&await W()}catch{}});await Promise.all([...this.loadEagerCallbacks.map(r=>r()),t])}async beforeLoadLazyPromise(){const t=new Promise(r=>r());await Promise.all([...this.beforeLoadLazyCallbacks.map(r=>r()),t])}async loadLazyPromise(){const t=new Promise(async r=>{try{const{lazyStylesScssPath:s,sidekickLibraryStylesScssPath:o,fontsScssPath:i,lazyStylesCssPath:a,sidekickLibraryStylesCssPath:d}=H;await Se();const{hash:h}=window.location,m=h?document.getElementById(h.substring(1)):!1;h&&m&&m.scrollIntoView(),s&&a&&await E(a),o&&d&&R()&&await E(d),i&&await W(),c("lazy");const u=document.querySelector("main");c.observe(u.querySelectorAll("div[data-block-name]")),c.observe(u.querySelectorAll("picture > img"))}catch(s){_.error("Load lazy Task: ",s)}r()});await Promise.all([...this.loadLazyCallbacks.map(r=>r()),t])}async beforeLoadDelayedPromise(){const t=new Promise(r=>r());await Promise.all([...this.beforeLoadDelayedCallbacks.map(r=>r()),t])}async loadDelayedPromise(){const t=new Promise(r=>{setTimeout(()=>{r()},3e3)});await Promise.all([...this.loadDelayedCallbacks.map(r=>r()),t])}async getInitializedPromise(){const t=new Promise(r=>r());await Promise.all([...this.initializedCallbacks.map(r=>r()),t])}}const C=new xe;/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ae=e=>e===null||typeof e!="object"&&typeof e!="function",ce=e=>e.strings===void 0;/** + */const Me=e=>e===null||typeof e!="object"&&typeof e!="function",Ve=e=>e.strings===void 0;/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const b=(e,t)=>{var s;const r=e._$AN;if(r===void 0)return!1;for(const o of r)(s=o._$AO)==null||s.call(o,t,!1),b(o,t);return!0},E=e=>{let t,r;do{if((t=e._$AM)===void 0)break;r=t._$AN,r.delete(e),e=t}while((r==null?void 0:r.size)===0)},G=e=>{for(let t;t=e._$AM;e=t){let r=t._$AN;if(r===void 0)t._$AN=r=new Set;else if(r.has(e))break;r.add(e),he(t)}};function le(e){this._$AN!==void 0?(E(this),this._$AM=e,G(this)):this._$AM=e}function de(e,t=!1,r=0){const s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let i=r;i{e.type==oe.CHILD&&(e._$AP??(e._$AP=de),e._$AQ??(e._$AQ=le))};class Q extends se{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,r,s){super._$AT(t,r,s),G(this),this.isConnected=t._$AU}_$AO(t,r=!0){var s,o;t!==this.isConnected&&(this.isConnected=t,t?(s=this.reconnected)==null||s.call(this):(o=this.disconnected)==null||o.call(this)),r&&(b(this,t),E(this))}setValue(t){if(ce(this._$Ct))this._$Ct._$AI(t,this);else{const r=[...this._$Ct._$AH];r[this._$Ci]=t,this._$Ct._$AI(r,this,0)}}disconnected(){}reconnected(){}}/** + */const P=(e,t)=>{var s;const r=e._$AN;if(r===void 0)return!1;for(const o of r)(s=o._$AO)==null||s.call(o,t,!1),P(o,t);return!0},T=e=>{let t,r;do{if((t=e._$AM)===void 0)break;r=t._$AN,r.delete(e),e=t}while((r==null?void 0:r.size)===0)},ce=e=>{for(let t;t=e._$AM;e=t){let r=t._$AN;if(r===void 0)t._$AN=r=new Set;else if(r.has(e))break;r.add(e),je(t)}};function Ne(e){this._$AN!==void 0?(T(this),this._$AM=e,ce(this)):this._$AM=e}function qe(e,t=!1,r=0){const s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(s))for(let i=r;i{e.type==_e.CHILD&&(e._$AP??(e._$AP=qe),e._$AQ??(e._$AQ=Ne))};class le extends me{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,r,s){super._$AT(t,r,s),ce(this),this.isConnected=t._$AU}_$AO(t,r=!0){var s,o;t!==this.isConnected&&(this.isConnected=t,t?(s=this.reconnected)==null||s.call(this):(o=this.disconnected)==null||o.call(this)),r&&(P(this,t),T(this))}setValue(t){if(Ve(this._$Ct))this._$Ct._$AI(t,this);else{const r=[...this._$Ct._$AH];r[this._$Ci]=t,this._$Ct._$AI(r,this,0)}}disconnected(){}reconnected(){}}/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const ue=()=>new pe;let pe=class{};const M=new WeakMap,_e=x(class extends Q{render(e){return u}update(e,[t]){var s;const r=t!==this.Y;return r&&this.Y!==void 0&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.Y=t,this.ht=(s=e.options)==null?void 0:s.host,this.rt(this.ct=e.element)),u}rt(e){if(typeof this.Y=="function"){const t=this.ht??globalThis;let r=M.get(t);r===void 0&&(r=new WeakMap,M.set(t,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){var e,t;return typeof this.Y=="function"?(e=M.get(this.ht??globalThis))==null?void 0:e.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var fe=Object.defineProperty,me=Object.getOwnPropertyDescriptor,B=(e,t,r,s)=>{for(var o=s>1?void 0:s?me(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&fe(t,r,o),o};let A=class extends v{constructor(){super(...arguments),this.error=null,this.getSubmenuName=e=>e.path.split("/")[1]}createRenderRoot(){return this}async firstUpdated(){this.items=await this.groupByFirstLevelPath()}async getPlaceholder(e){return await m.getPlaceHolder(e)}render(){if(this.error)return c`
${this.error}
`;if(this.items)return c``}toggleSubmenu({currentTarget:e}){!(e instanceof HTMLElement)||!e.classList.contains("opener")||e.classList.toggle("active")}renderSubMenu(e){return c`${e.navtitle} ${I("chevron-down","submenu__icon")}`}renderMenuItem(e){return e.error?c`

${e.error}

`:c`
  • ${e.children!==void 0?this.renderSubMenu(e):c`${e.navtitle}`}
  • `}renderMenuItems(){return c`
      ${this.items.map(e=>this.renderMenuItem(e))}
    `}getNavTitle(e){return e.path==="/"?"Homepage":e.navtitle||e.title}filterNavigation(e,t){return e.filter(r=>t.every(s=>!r.path.includes(s))).map(r=>({path:r.path,navtitle:this.getNavTitle(r)}))}groupItemsByFirstLevelPath(e){const t={};return e.forEach(r=>{const s=this.getSubmenuName(r);t[s]||(t[s]=[]),t[s].push({path:r.path,navtitle:this.getNavTitle(r)})}),t}async groupByFirstLevelPath(){const e="/query-index.json",t=["sidekick","sidekick-library","tools","development","dev-","__"];try{const r=await w.fetchJson(e);this.error=null;const s=this.filterNavigation(r.data,t),o=this.groupItemsByFirstLevelPath(s);return Object.values(o).map(n=>n.length===1?n[0]:{navtitle:n[0].path.split("/")[1],path:n[0].path,children:n})}catch(r){return p.error(`SidebarNav Component: Error while fetching ${e}`,r),this.error=await m.getPlaceHolder("error"),[]}}};B([h()],A.prototype,"items",2);B([h()],A.prototype,"error",2);A=B([g("sidebar-nav")],A);var ve=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,q=(e,t,r,s)=>{for(var o=s>1?void 0:s?ge(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&ve(t,r,o),o};let C=class extends v{constructor(){super(...arguments),this.error=null}async connectedCallback(){super.connectedCallback();const e=await this.fetchContactsHtml();e!==null&&this.getContactTemplateArgs(e)}async fetchContactsHtml(){const e=new DOMParser,t="contact.plain.html";try{const r=await w.fetchText(t,{cacheOptions:{cacheType:"runtime"}});return this.error=null,e.parseFromString(r,"text/html")}catch(r){return p.error(`SidebarContacts Component: Error while fetching ${t}`,r),this.error=await m.getPlaceHolder("error"),null}}renderHeader(e){return e?c`

    ${e}

    `:u}renderText(e){return e?c`

    ${e}

    `:u}render(){if(this.error)return c`
    ${this.error}
    `;if(!this.contactTemplateArgs)return u;const{headline:e,text:t,contacts:r}=this.contactTemplateArgs;return c`
    ${this.renderHeader(e)} ${this.renderText(t)} ${this.renderContacts(r)}
    `}createRenderRoot(){return this}renderContact(e){const{icon:t,markup:r}=e;return!t&&!r?u:c`
  • ${this.renderIcon(t)} ${this.renderContactMarkup(r)}
  • `}getContactsArgs(e){const t=e.querySelectorAll(".contact > div:not(:first-child)");return Array.from(t).map(s=>({icon:s.querySelector("div"),markup:s.querySelector("div:last-child")}))}getContactTemplateArgs(e){const t=e.querySelector("h2"),r=e.querySelector("p"),s=this.getContactsArgs(e);this.contactTemplateArgs={headline:t,text:r,contacts:s}}renderContacts(e){return e.length===0?u:c`
      ${e.map(t=>this.renderContact(t))}
    `}renderIcon(e){return e?I(e.innerHTML):u}renderContactMarkup(e){return e?J(e.innerHTML):u}};q([h()],C.prototype,"contactTemplateArgs",2);q([h()],C.prototype,"error",2);C=q([g("sidebar-contact")],C);var $e=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,R=(e,t,r,s)=>{for(var o=s>1?void 0:s?ye(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&$e(t,r,o),o};let P=class extends v{constructor(){super(...arguments),this.error=null}async connectedCallback(){super.connectedCallback();const e=await this.getPosts();this.lastTreePosts=this.getLastThreePosts(e),this.noPostsPlaceholder=await m.getPlaceHolder("no posts")}render(){if(this.lastTreePosts)return c`${this.renderHeader()} ${this.renderPosts()}`}createRenderRoot(){return this}getLastThreePosts(e){return e.sort((t,r)=>t.lastModified>r.lastModified?-1:t.lastModified${t}`:u}renderPost(e){return c`
    ${this.renderPicture(e)}

    ${e.description}

    `}async getPosts(){const e="/query-index.json";try{return this.error=null,(await w.fetchJson(e)).data.filter(r=>r.path.startsWith("/posts"))}catch(t){return p.error(`SidebarPost Component: Error while fetching ${e}`,t),this.error=await m.getPlaceHolder("error"),[]}}renderPosts(){return this.error?c`
    ${this.error}
    `:this.lastTreePosts.length===0?c`
    ${this.noPostsPlaceholder}
    `:c`
    ${this.lastTreePosts.map(e=>this.renderPost(e))}
    `}renderHeader(){return c`

    Newest Posts

    `}};R([h()],P.prototype,"lastTreePosts",2);R([h()],P.prototype,"error",2);R([h()],P.prototype,"noPostsPlaceholder",2);P=R([g("sidebar-posts")],P);var be=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,j=(e,t,r,s)=>{for(var o=s>1?void 0:s?Pe(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&be(t,r,o),o};let L=class extends v{constructor(){super(...arguments),this.error=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.fetchFooterData()}async fetchFooterData(){const e="footer.plain.html";try{const t=await w.fetchText(e,{cacheOptions:{cacheType:"runtime"}});this.error=null;const r=document.createElement("div");r.innerHTML=t,this.footerMarkup=r.querySelector("p"),this.footerMarkup&&this.footerMarkup.classList.add("copyright")}catch(t){p.error(`SidebarFooter Component: Error while fetching ${e}`,t),this.error=await m.getPlaceHolder("error")}}render(){if(this.error)return c`
    ${this.error}
    `;if(this.footerMarkup)return c`${this.footerMarkup}`}};j([h()],L.prototype,"footerMarkup",2);j([h()],L.prototype,"error",2);L=j([g("sidebar-footer")],L);var we=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Ee=(e,t,r,s)=>{for(var o=s>1?void 0:s?Se(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&we(t,r,o),o};let z=class extends v{constructor(){super(...arguments),this.toggleRef=ue(),this.handleToggleClick=e=>{e.preventDefault(),this.classList.toggle("active")}}createRenderRoot(){return this}firstUpdated(){this.toggleRef.value.addEventListener("click",this.handleToggleClick),this.classList.add("activate-animations")}render(){return c`
    ${I("hamburger")}`}};z=Ee([g("sidebar-component")],z);function Ae({input:e,specifier:t,htmlTag:r}){return t===""||r===""?e:e.split(t).map((s,o)=>o%2===1?`<${r}>${s}`:s).join("")}var Ce=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,H=(e,t,r,s)=>{for(var o=s>1?void 0:s?Le(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&Ce(t,r,o),o};let T=class extends v{constructor(){super(...arguments),this.error=null}createRenderRoot(){return this}async firstUpdated(e){await this.fetchHeaderData()}async fetchHeaderData(){try{const e=await w.fetchJson("header.json",{cacheOptions:{cacheType:"runtime"}});this.headerData={leftCol:e.leftCol.data[0],rightCol:e.rightCol.data},this.error=null}catch(e){p.error("Header Component: Error while fetching header.json",e),this.error=await m.getPlaceHolder("error")}}render(){if(this.error)return c`
    ${this.error}
    `;if(!this.headerData)return;const{leftCol:e,rightCol:t}=this.headerData,r=Ae({input:e.logoText,htmlTag:"strong",specifier:":::"}),s=J(r);return c``}};H([h()],T.prototype,"headerData",2);H([h()],T.prototype,"error",2);T=H([g("header-component")],T);/** + */const He=()=>new Be;let Be=class{};const M=new WeakMap,Ue=j(class extends le{render(e){return f}update(e,[t]){var s;const r=t!==this.Y;return r&&this.Y!==void 0&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.Y=t,this.ht=(s=e.options)==null?void 0:s.host,this.rt(this.ct=e.element)),f}rt(e){if(typeof this.Y=="function"){const t=this.ht??globalThis;let r=M.get(t);r===void 0&&(r=new WeakMap,M.set(t,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,e),e!==void 0&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){var e,t;return typeof this.Y=="function"?(e=M.get(this.ht??globalThis))==null?void 0:e.get(this.Y):(t=this.Y)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ye=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,B=(e,t,r,s)=>{for(var o=s>1?void 0:s?Fe(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&Ye(t,r,o),o};let S=class extends v{constructor(){super(...arguments),this.error=null,this.getSubmenuName=e=>e.path.split("/")[1]}createRenderRoot(){return this}async firstUpdated(){this.items=await this.groupByFirstLevelPath()}async getPlaceholder(e){return await g.getPlaceHolder(e)}render(){if(this.error)return l`
    ${this.error}
    `;if(this.items)return l``}toggleSubmenu({currentTarget:e}){!(e instanceof HTMLElement)||!e.classList.contains("opener")||e.classList.toggle("active")}renderSubMenu(e){return l`${e.navtitle} ${z("chevron-down","submenu__icon")}`}renderMenuItem(e){return e.error?l`

    ${e.error}

    `:l`
  • ${e.children!==void 0?this.renderSubMenu(e):l`${e.navtitle}`}
  • `}renderMenuItems(){return l`
      ${this.items.map(e=>this.renderMenuItem(e))}
    `}getNavTitle(e){return e.path==="/"?"Homepage":e.navtitle||e.title}filterNavigation(e,t){return e.filter(r=>t.every(s=>!r.path.includes(s))).map(r=>({path:r.path,navtitle:this.getNavTitle(r)}))}groupItemsByFirstLevelPath(e){const t={};return e.forEach(r=>{const s=this.getSubmenuName(r);t[s]||(t[s]=[]),t[s].push({path:r.path,navtitle:this.getNavTitle(r)})}),t}async groupByFirstLevelPath(){const e="/query-index.json",t=["sidekick","sidekick-library","tools","development","dev-","__"];try{const r=await L.fetchJson(e);this.error=null;const s=this.filterNavigation(r.data,t),o=this.groupItemsByFirstLevelPath(s);return Object.values(o).map(a=>a.length===1?a[0]:{navtitle:a[0].path.split("/")[1],path:a[0].path,children:a})}catch(r){return _.error(`SidebarNav Component: Error while fetching ${e}`,r),this.error=await g.getPlaceHolder("error"),[]}}};B([p()],S.prototype,"items",2);B([p()],S.prototype,"error",2);S=B([y("sidebar-nav")],S);var Ze=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,U=(e,t,r,s)=>{for(var o=s>1?void 0:s?Xe(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&Ze(t,r,o),o};let A=class extends v{constructor(){super(...arguments),this.error=null}async connectedCallback(){super.connectedCallback();const e=await this.fetchContactsHtml();e!==null&&this.getContactTemplateArgs(e)}async fetchContactsHtml(){const e=new DOMParser,t="contact.plain.html";try{const r=await L.fetchText(t,{cacheOptions:{cacheType:"runtime"}});return this.error=null,e.parseFromString(r,"text/html")}catch(r){return _.error(`SidebarContacts Component: Error while fetching ${t}`,r),this.error=await g.getPlaceHolder("error"),null}}renderHeader(e){return e?l`

    ${e}

    `:f}renderText(e){return e?l`

    ${e}

    `:f}render(){if(this.error)return l`
    ${this.error}
    `;if(!this.contactTemplateArgs)return f;const{headline:e,text:t,contacts:r}=this.contactTemplateArgs;return l`
    ${this.renderHeader(e)} ${this.renderText(t)} ${this.renderContacts(r)}
    `}createRenderRoot(){return this}renderContact(e){const{icon:t,markup:r}=e;return!t&&!r?f:l`
  • ${this.renderIcon(t)} ${this.renderContactMarkup(r)}
  • `}getContactsArgs(e){const t=e.querySelectorAll(".contact > div:not(:first-child)");return Array.from(t).map(s=>({icon:s.querySelector("div"),markup:s.querySelector("div:last-child")}))}getContactTemplateArgs(e){const t=e.querySelector("h2"),r=e.querySelector("p"),s=this.getContactsArgs(e);this.contactTemplateArgs={headline:t,text:r,contacts:s}}renderContacts(e){return e.length===0?f:l`
      ${e.map(t=>this.renderContact(t))}
    `}renderIcon(e){return e?z(e.innerHTML):f}renderContactMarkup(e){return e?oe(e.innerHTML):f}};U([p()],A.prototype,"contactTemplateArgs",2);U([p()],A.prototype,"error",2);A=U([y("sidebar-contact")],A);var Ke=Object.defineProperty,We=Object.getOwnPropertyDescriptor,x=(e,t,r,s)=>{for(var o=s>1?void 0:s?We(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&Ke(t,r,o),o};let w=class extends v{constructor(){super(...arguments),this.error=null}async connectedCallback(){super.connectedCallback();const e=await this.getPosts();this.lastTreePosts=this.getLastThreePosts(e),this.noPostsPlaceholder=await g.getPlaceHolder("no posts")}render(){if(this.lastTreePosts)return l`${this.renderHeader()} ${this.renderPosts()}`}createRenderRoot(){return this}getLastThreePosts(e){return e.sort((t,r)=>t.lastModified>r.lastModified?-1:t.lastModified${t}`:f}renderPost(e){return l`
    ${this.renderPicture(e)}

    ${e.description}

    `}async getPosts(){const e="/query-index.json";try{return this.error=null,(await L.fetchJson(e)).data.filter(r=>r.path.startsWith("/posts"))}catch(t){return _.error(`SidebarPost Component: Error while fetching ${e}`,t),this.error=await g.getPlaceHolder("error"),[]}}renderPosts(){return this.error?l`
    ${this.error}
    `:this.lastTreePosts.length===0?l`
    ${this.noPostsPlaceholder}
    `:l`
    ${this.lastTreePosts.map(e=>this.renderPost(e))}
    `}renderHeader(){return l`

    Newest Posts

    `}};x([p()],w.prototype,"lastTreePosts",2);x([p()],w.prototype,"error",2);x([p()],w.prototype,"noPostsPlaceholder",2);w=x([y("sidebar-posts")],w);var Je=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Y=(e,t,r,s)=>{for(var o=s>1?void 0:s?Ge(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&Je(t,r,o),o};let D=class extends v{constructor(){super(...arguments),this.error=null}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.fetchFooterData()}async fetchFooterData(){const e="footer.plain.html";try{const t=await L.fetchText(e,{cacheOptions:{cacheType:"runtime"}});this.error=null;const r=document.createElement("div");r.innerHTML=t,this.footerMarkup=r.querySelector("p"),this.footerMarkup&&this.footerMarkup.classList.add("copyright")}catch(t){_.error(`SidebarFooter Component: Error while fetching ${e}`,t),this.error=await g.getPlaceHolder("error")}}render(){if(this.error)return l`
    ${this.error}
    `;if(this.footerMarkup)return l`${this.footerMarkup}`}};Y([p()],D.prototype,"footerMarkup",2);Y([p()],D.prototype,"error",2);D=Y([y("sidebar-footer")],D);var Qe=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(e,t,r,s)=>{for(var o=s>1?void 0:s?et(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&Qe(t,r,o),o};let J=class extends v{constructor(){super(...arguments),this.toggleRef=He(),this.handleToggleClick=e=>{e.preventDefault(),this.classList.toggle("active")}}createRenderRoot(){return this}firstUpdated(){this.toggleRef.value.addEventListener("click",this.handleToggleClick),this.classList.add("activate-animations")}render(){return l`
    ${z("hamburger")}`}};J=tt([y("sidebar-component")],J);const rt=()=>{if(R())return;const e=document.createElement("sidebar-component");e.setAttribute("id","sidebar"),window.innerWidth<=1280?e.classList.remove("active"):e.classList.add("active"),window.innerWidth<=1280?e.classList.remove("active"):e.classList.add("active");const t=document.getElementById("main");t==null||t.after(e)};C.addLoadEagerTask(()=>(rt(),Promise.resolve()));function st(){const e=document.getElementById("main");if(!e)return;const t=e.innerHTML;e.innerHTML=`
    ${R()?"":''}${t}
    `}C.addLoadEagerTask(()=>(st(),Promise.resolve()));function ot({input:e,specifier:t,htmlTag:r}){return t===""||r===""?e:e.split(t).map((s,o)=>o%2===1?`<${r}>${s}`:s).join("")}var it=Object.defineProperty,at=Object.getOwnPropertyDescriptor,F=(e,t,r,s)=>{for(var o=s>1?void 0:s?at(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&it(t,r,o),o};let O=class extends v{constructor(){super(...arguments),this.error=null}createRenderRoot(){return this}async firstUpdated(e){await this.fetchHeaderData()}async fetchHeaderData(){try{const e=await L.fetchJson("header.json",{cacheOptions:{cacheType:"runtime"}});this.headerData={leftCol:e.leftCol.data[0],rightCol:e.rightCol.data},this.error=null}catch(e){_.error("Header Component: Error while fetching header.json",e),this.error=await g.getPlaceHolder("error")}}render(){if(this.error)return l`
    ${this.error}
    `;if(!this.headerData)return;const{leftCol:e,rightCol:t}=this.headerData,r=ot({input:e.logoText,htmlTag:"strong",specifier:":::"}),s=oe(r);return l``}};F([p()],O.prototype,"headerData",2);F([p()],O.prototype,"error",2);O=F([y("header-component")],O);/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */class V extends ie{}V.directiveName="unsafeSVG",V.resultType=2;const Te=x(V);/** + */class q extends ge{}q.directiveName="unsafeSVG",q.resultType=2;const nt=j(q);/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */class Oe{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class De{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??(this.Z=new Promise(t=>this.q=t))}resume(){var t;(t=this.q)==null||t.call(this),this.Z=this.q=void 0}}/** + */class ct{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class lt{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??(this.Z=new Promise(t=>this.q=t))}resume(){var t;(t=this.q)==null||t.call(this),this.Z=this.q=void 0}}/** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const F=e=>!ae(e)&&typeof e.then=="function",Y=1073741823;class Ie extends Q{constructor(){super(...arguments),this._$Cwt=Y,this._$Cbt=[],this._$CK=new Oe(this),this._$CX=new De}render(...t){return t.find(r=>!F(r))??N}update(t,r){const s=this._$Cbt;let o=s.length;this._$Cbt=r;const i=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let d=0;dthis._$Cwt);d++){const l=r[d];if(!F(l))return this._$Cwt=d,l;d{for(;n.get();)await n.get();const y=i.deref();if(y!==void 0){const k=y._$Cbt.indexOf(l);k>-1&&k{for(var o=s>1?void 0:s?Me(t,r):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(o=(s?n(t,r,o):n(o))||o);return s&&o&&ke(t,r,o),o};const Z=Object.assign({"/public/icons/angle-down.svg":()=>a(()=>import("../__chunks__/angle-down.CYLyXUSW.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-left.svg":()=>a(()=>import("../__chunks__/angle-left.CuEqyOC8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-right.svg":()=>a(()=>import("../__chunks__/angle-right.Ke48OV-s.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-down.svg":()=>a(()=>import("../__chunks__/angle-small-down.SNJn5nFt.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-left.svg":()=>a(()=>import("../__chunks__/angle-small-left.Bq32-m-s.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-right.svg":()=>a(()=>import("../__chunks__/angle-small-right.FYreGgDf.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-up.svg":()=>a(()=>import("../__chunks__/angle-up.D0S_oJnp.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/bolt.svg":()=>a(()=>import("../__chunks__/bolt.BAJn0zD8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/building-storefront.svg":()=>a(()=>import("../__chunks__/building-storefront.Pww5r_Sc.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/chat-bubble-left-right.svg":()=>a(()=>import("../__chunks__/chat-bubble-left-right.0PedyEPm.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/check.svg":()=>a(()=>import("../__chunks__/check.BHPURAzV.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/chevron-down.svg":()=>a(()=>import("../__chunks__/chevron-down.D5xOlW7p.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/clip.svg":()=>a(()=>import("../__chunks__/clip.DAiKYXCc.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/clock.svg":()=>a(()=>import("../__chunks__/clock.CQWyiDNK.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cpu-chip.svg":()=>a(()=>import("../__chunks__/cpu-chip.DbktS35z.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cross.svg":()=>a(()=>import("../__chunks__/cross.DjCq6kb8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cursor-arrow-ripple.svg":()=>a(()=>import("../__chunks__/cursor-arrow-ripple.DHyr9er2.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/download.svg":()=>a(()=>import("../__chunks__/download.BlSXR9C9.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/envelope.svg":()=>a(()=>import("../__chunks__/envelope.Cc7Mhg2-.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/eye-crossed.svg":()=>a(()=>import("../__chunks__/eye-crossed.C49v3GRJ.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/eye.svg":()=>a(()=>import("../__chunks__/eye.Cm2FxO9V.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/facebook.svg":()=>a(()=>import("../__chunks__/facebook.3ENFaNKU.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/globe.svg":()=>a(()=>import("../__chunks__/globe.DIrN3GJL.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/hamburger.svg":()=>a(()=>import("../__chunks__/hamburger.DXUzfmtf.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/heart.svg":()=>a(()=>import("../__chunks__/heart.DSQJkyzj.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/home.svg":()=>a(()=>import("../__chunks__/home.CfzaHiPS.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/instagram.svg":()=>a(()=>import("../__chunks__/instagram.BBx5qXGF.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/medium.svg":()=>a(()=>import("../__chunks__/medium.BPaQEP4K.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/menu-burger.svg":()=>a(()=>import("../__chunks__/menu-burger.DyVjSQ0K.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/paper-plane.svg":()=>a(()=>import("../__chunks__/paper-plane.CLiFs3FL.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/plus.svg":()=>a(()=>import("../__chunks__/plus.DuBm-jVv.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/rocket-lunch.svg":()=>a(()=>import("../__chunks__/rocket-lunch.C6eRDqkd.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/search.svg":()=>a(()=>import("../__chunks__/search.CtsY1mRN.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/share.svg":()=>a(()=>import("../__chunks__/share.D_3XZuic.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/snapchat.svg":()=>a(()=>import("../__chunks__/snapchat.Bct5wLOa.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/social-network.svg":()=>a(()=>import("../__chunks__/social-network.B-lhER-M.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/trash.svg":()=>a(()=>import("../__chunks__/trash.D1jfdnTM.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/twitter.svg":()=>a(()=>import("../__chunks__/twitter.d5w0828a.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/user.svg":()=>a(()=>import("../__chunks__/user.X8OGz61Z.js"),__vite__mapDeps([])).then(e=>e.default)});let O=class extends v{constructor(){super(...arguments),this.name=""}async getSvg(e){const r=Z[`${U}/${e}.svg`]??Z[`${U}/cross.svg`];try{const s=await r();return Te(s)}catch(s){p.error(`Icon Component: SVG icon: ${s.message}`,s);return}}render(){const e=this.getSvg(this.name);return c`${Re(e)}`}};O.styles=te`:host{display:flex;align-items:center}svg{width:100%;height:auto}`;ee([re({type:String})],O.prototype,"name",2);O=ee([g("icon-component")],O);class Ve{readBlockConfig(t){const r={};return t.querySelectorAll(":scope > div").forEach(s=>{if(s.children){const o=[...s.children];if(o[1]){const i=o[1],n=D(o[0].textContent??"");let d="";if(i.querySelector("a")){const l=[...i.querySelectorAll("a")];l.length===1?d=l[0].href:d=l.map(_=>_.href)}else if(i.querySelector("img")){const l=[...i.querySelectorAll("img")];l.length===1?d=l[0].src:d=l.map(_=>_.src)}else if(i.querySelector("p")){const l=[...i.querySelectorAll("p")];l.length===1?d=l[0].textContent:d=l.map(_=>_.textContent)}else d=s.children[1].textContent;r[n]=d}}}),r}decorateBlocks(t){t.querySelectorAll("div.section > div > div").forEach(this.decorateBlock)}decorateBlock(t){const r=t.classList[0];if(r){t.classList.add("block"),t.dataset.blockName=r;const s=t.parentElement;s==null||s.classList.add(`${r}-wrapper`);const o=t.closest(".section");o&&o.classList.add(`${r}-container`)}}}function xe(e){return/^[a-z][A-Za-z0-9]*$/.test(e)?e:/^[A-Z][A-Za-z0-9]*$/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):D(e).replace(/-([a-z])/g,t=>t[1].toUpperCase())}class Be{constructor(t){this.blockService=t}init(t){this.transformSection(t)}transformSection(t){t.querySelectorAll(":scope > div").forEach(r=>{this.adjustMarkup(r),this.processSectionMetaData(r)})}processSectionMetaData(t){const r=t.querySelector("div.section-metadata");if(r){const s=this.blockService.readBlockConfig(r);Object.keys(s).forEach(o=>{o==="style"?s.style.split(",").filter(n=>n).map(n=>D(n.trim())).forEach(n=>t.classList.add(n)):t.dataset[xe(o)]=s[o]}),r.parentElement&&r.parentElement.remove()}}adjustMarkup(t){const r=[];let s=!1;[...t.children].forEach(o=>{if(o.tagName==="DIV"||!s){const i=document.createElement("div");r.push(i),s=o.tagName!=="DIV",s&&i.classList.add("default-content-wrapper")}r[r.length-1].append(o)}),r.forEach(o=>t.append(o)),this.decorateImages(),t.classList.add("section"),t.dataset.sectionStatus="initialized",t.style.display="none"}decorateImages(){document.querySelectorAll(".default-content-wrapper picture").forEach(r=>{const s=r.parentElement;s&&s.classList.add("image","main")})}}const K=(e,t)=>{t.split(",").forEach(r=>{e.classList.add(D(r.trim()))})};function W(e,t=document){const r=e&&e.includes(":")?"property":"name",o=[...t.head.querySelectorAll(`meta[${r}="${e}"]`)].map(i=>i.content).join(", ");return o.length?o:""}const qe={mainTsPath:"src/main.ts",mainScssPath:"src/styles/sass/main.scss",iconsDirPath:"./public/icons",iconsTypesPath:"./src/types/icons.types.ts",fontsScssPath:"src/styles/sass/fonts.scss",lazyStylesScssPath:"src/styles/sass/lazy-styles.scss",sidekickLibraryStylesScssPath:"src/styles/sass/sidekick-library-styles.scss"};function X(){return S()?window.parent.location:window.location}const $=class ${};$.unloaded="unloaded",$.loading="loading",$.loaded="loaded",$.error="error";let f=$;class je{constructor(t,r){this.sectionService=t,this.blockService=r,this.lcpBlocks=["banner"],this.init=async()=>{this.setup(),await this.loadEager(),await this.loadLazy()},this.loadEager=async()=>{document.documentElement.lang="en",this.decorateTemplateAndTheme();const s=document.querySelector("main");if(s){s.setAttribute("id","main"),this.addSidebarContainer(s),this.sectionService.init(s),this.addInnerContainer(s),this.blockService.decorateBlocks(s),setTimeout(()=>{document.body.classList.add("show")},100),await this.waitForLCP();try{(window.innerWidth>=900||sessionStorage.getItem("fonts-loaded"))&&await this.loadFonts()}catch{}}},this.loadLazy=async()=>{const{lazyStylesScssPath:s,sidekickLibraryStylesScssPath:o,fontsScssPath:i}=qe;try{s&&await this.loadCSS(`${window.hlx.codeBasePath}/dist/lazyStyles/lazyStyles.css`),o&&S()&&await this.loadCSS(`${window.hlx.codeBasePath}/dist/sidekickLibraryStyles/sidekickLibraryStyles.css`),i&&await this.loadFonts(),await this.loadBlocks()}catch(n){p.error("MainService: Load lazy error: ",n)}},this.loadBlocks=async()=>{const o=[...document.querySelectorAll(".section")].map(i=>this.loadBlock(i));await Promise.all(o)}}setup(){window.hlx=window.hlx||{},window.hlx.RUM_MASK_URL="full",window.hlx.codeBasePath="",window.hlx.lighthouse=new URLSearchParams(X().search).get("lighthouse")==="on";const t=document.querySelector('script[src$="/scripts/scripts.js"]');if(t)try{[window.hlx.codeBasePath]=new URL(t.src).pathname.split("/scripts/scripts.js")}catch(r){p.error("MainService: Error initializing codeBasePath.",r)}}addSidebarContainer(t){if(S())return;const r=document.createElement("sidebar-component");r.setAttribute("id","sidebar"),window.innerWidth<=1280?r.classList.remove("active"):r.classList.add("active"),window.innerWidth<=1280?r.classList.remove("active"):r.classList.add("active"),t.after(r)}addInnerContainer(t){const r=t.innerHTML;t.innerHTML=`
    ${S()?"":''}${r}
    `}decorateTemplateAndTheme(){const t=W("template");t&&K(document.body,t);const r=W("theme");r&&K(document.body,r)}collectBlocks(t){const r=[];return t.querySelectorAll("[data-block-name]").forEach(o=>{r.push({name:o.dataset.blockName,element:o})}),r}async loadBlockModules(t){if((t.element.dataset.blockStatus??f.unloaded)===f.unloaded){t.element.dataset.blockStatus=f.loading;try{const s=await a(()=>import(`${window.hlx.codeBasePath}/dist/${t.name}/${t.name}.js`),__vite__mapDeps([]));s.default&&await s.default(t.element),t.element.dataset.blockStatus=f.loaded}catch(s){t.element.dataset.blockStatus=f.error,p.error("MainService: An error occurred during module import:",s)}}}async loadBlockStyles(t){try{await this.loadCSS(`${window.hlx.codeBasePath}/dist/${t.name}/${t.name}.css`)}catch{}}showSection(t){t.style.removeProperty("display")}async loadFonts(){await this.loadCSS(`${window.hlx.codeBasePath}/dist/fonts/fonts.css`);try{X().hostname.includes("localhost")||sessionStorage.setItem("fonts-loaded","true")}catch{}}async loadCSS(t){return new Promise((r,s)=>{if(document.querySelector(`head > link[href="${t}"]`))r(!0);else{const o=document.createElement("link");o.rel="stylesheet",o.href=t,o.onload=r,o.onerror=s,document.head.append(o)}})}async waitForLCP(){const t=document.querySelector(".section");if(t){const o=this.collectBlocks(t).map(async i=>{this.lcpBlocks.includes(i.name)&&await Promise.all([this.loadBlockModules(i),this.loadBlockStyles(i)])});await Promise.all(o),this.showSection(t)}document.body.style.display=null;const r=document.querySelector("main img");await new Promise(s=>{r&&!r.complete?(r.setAttribute("loading","eager"),r.setAttribute("fetchpriority","high"),r.addEventListener("load",()=>s()),r.addEventListener("error",()=>s())):s()})}async loadBlock(t){const r=this.collectBlocks(t);if(!r.length){this.showSection(t);return}for(const s of r)Promise.all([this.loadBlockModules(s),this.loadBlockStyles(s)]);this.showSection(t)}}(async function(){const e=new Ve,t=new Be(e);await new je(t,e).init()})(); + */const G=e=>!Me(e)&&typeof e.then=="function",Q=1073741823;class dt extends le{constructor(){super(...arguments),this._$Cwt=Q,this._$Cbt=[],this._$CK=new ct(this),this._$CX=new lt}render(...t){return t.find(r=>!G(r))??X}update(t,r){const s=this._$Cbt;let o=s.length;this._$Cbt=r;const i=this._$CK,a=this._$CX;this.isConnected||this.disconnected();for(let d=0;dthis._$Cwt);d++){const h=r[d];if(!G(h))return this._$Cwt=d,h;d{for(;a.get();)await a.get();const u=i.deref();if(u!==void 0){const b=u._$Cbt.indexOf(h);b>-1&&b{for(var o=s>1?void 0:s?pt(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(s?a(t,r,o):a(o))||o);return s&&o&&ut(t,r,o),o};const te=Object.assign({"/public/icons/angle-down.svg":()=>n(()=>import("../__chunks__/angle-down.CYLyXUSW.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-left.svg":()=>n(()=>import("../__chunks__/angle-left.CuEqyOC8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-right.svg":()=>n(()=>import("../__chunks__/angle-right.Ke48OV-s.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-down.svg":()=>n(()=>import("../__chunks__/angle-small-down.SNJn5nFt.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-left.svg":()=>n(()=>import("../__chunks__/angle-small-left.Bq32-m-s.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-small-right.svg":()=>n(()=>import("../__chunks__/angle-small-right.FYreGgDf.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/angle-up.svg":()=>n(()=>import("../__chunks__/angle-up.D0S_oJnp.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/bolt.svg":()=>n(()=>import("../__chunks__/bolt.BAJn0zD8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/building-storefront.svg":()=>n(()=>import("../__chunks__/building-storefront.Pww5r_Sc.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/chat-bubble-left-right.svg":()=>n(()=>import("../__chunks__/chat-bubble-left-right.0PedyEPm.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/check.svg":()=>n(()=>import("../__chunks__/check.BHPURAzV.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/chevron-down.svg":()=>n(()=>import("../__chunks__/chevron-down.D5xOlW7p.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/clip.svg":()=>n(()=>import("../__chunks__/clip.DAiKYXCc.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/clock.svg":()=>n(()=>import("../__chunks__/clock.CQWyiDNK.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cpu-chip.svg":()=>n(()=>import("../__chunks__/cpu-chip.DbktS35z.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cross.svg":()=>n(()=>import("../__chunks__/cross.DjCq6kb8.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/cursor-arrow-ripple.svg":()=>n(()=>import("../__chunks__/cursor-arrow-ripple.DHyr9er2.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/download.svg":()=>n(()=>import("../__chunks__/download.BlSXR9C9.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/envelope.svg":()=>n(()=>import("../__chunks__/envelope.Cc7Mhg2-.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/eye-crossed.svg":()=>n(()=>import("../__chunks__/eye-crossed.C49v3GRJ.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/eye.svg":()=>n(()=>import("../__chunks__/eye.Cm2FxO9V.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/facebook.svg":()=>n(()=>import("../__chunks__/facebook.3ENFaNKU.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/globe.svg":()=>n(()=>import("../__chunks__/globe.DIrN3GJL.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/hamburger.svg":()=>n(()=>import("../__chunks__/hamburger.DXUzfmtf.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/heart.svg":()=>n(()=>import("../__chunks__/heart.DSQJkyzj.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/home.svg":()=>n(()=>import("../__chunks__/home.CfzaHiPS.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/instagram.svg":()=>n(()=>import("../__chunks__/instagram.BBx5qXGF.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/medium.svg":()=>n(()=>import("../__chunks__/medium.BPaQEP4K.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/menu-burger.svg":()=>n(()=>import("../__chunks__/menu-burger.DyVjSQ0K.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/paper-plane.svg":()=>n(()=>import("../__chunks__/paper-plane.CLiFs3FL.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/plus.svg":()=>n(()=>import("../__chunks__/plus.DuBm-jVv.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/rocket-lunch.svg":()=>n(()=>import("../__chunks__/rocket-lunch.C6eRDqkd.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/search.svg":()=>n(()=>import("../__chunks__/search.CtsY1mRN.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/share.svg":()=>n(()=>import("../__chunks__/share.D_3XZuic.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/snapchat.svg":()=>n(()=>import("../__chunks__/snapchat.Bct5wLOa.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/social-network.svg":()=>n(()=>import("../__chunks__/social-network.B-lhER-M.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/trash.svg":()=>n(()=>import("../__chunks__/trash.D1jfdnTM.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/twitter.svg":()=>n(()=>import("../__chunks__/twitter.d5w0828a.js"),__vite__mapDeps([])).then(e=>e.default),"/public/icons/user.svg":()=>n(()=>import("../__chunks__/user.X8OGz61Z.js"),__vite__mapDeps([])).then(e=>e.default)});let I=class extends v{constructor(){super(...arguments),this.name=""}async getSvg(e){const r=te[`${ee}/${e}.svg`]??te[`${ee}/cross.svg`];try{const s=await r();return nt(s)}catch(s){_.error(`Icon Component: SVG icon: ${s.message}`,s);return}}render(){const e=this.getSvg(this.name);return l`${ht(e)}`}};I.styles=pe`:host{display:flex;align-items:center}svg{width:100%;height:auto}`;de([fe({type:String})],I.prototype,"name",2);I=de([y("icon-component")],I);const $={interactive:"interactive",complete:"complete"};function re(){C.addBeforeEagerTask(()=>(document.getElementsByTagName("main")[0].setAttribute("id","main"),Promise.resolve())),C.init()}function ft(){document.readyState===$.interactive||document.readyState===$.complete?re():document.addEventListener("readystatechange",()=>{const e=document.readyState;(e===$.interactive||e===$.complete)&&re()})}ft(); function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/main/main.js.map b/dist/main/main.js.map index 5e867dbc..85e6c898 100644 --- a/dist/main/main.js.map +++ b/dist/main/main.js.map @@ -1 +1 @@ -{"version":3,"mappings":"+nBACA;AAAA;AAAA;AAAA;AAAA,GAIO,MAASA,GAAEC,GAAUA,IAAP,MAAoB,OAAOA,GAAjB,UAAgC,OAAOA,GAAnB,WAAwLC,GAAED,GAAYA,EAAE,UAAX,OCJhP;AAAA;AAAA;AAAA;AAAA,GAIG,MAAME,EAAE,CAACH,EAAE,IAAI,OAAC,MAAMI,EAAEJ,EAAE,KAAK,GAAYI,IAAT,OAAW,MAAM,GAAG,UAAUJ,KAAKI,GAAEC,EAAAL,EAAE,OAAF,MAAAK,EAAA,KAAAL,EAAS,EAAE,IAAIG,EAAEH,EAAE,CAAC,EAAE,MAAM,EAAE,EAAEC,EAAED,GAAG,CAAC,IAAI,EAAEI,EAAE,EAAE,CAAC,IAAa,EAAEJ,EAAE,QAAd,OAAoB,MAAMI,EAAE,EAAE,KAAKA,EAAE,OAAOJ,CAAC,EAAEA,EAAE,CAAC,QAAWI,GAAA,YAAAA,EAAG,QAAP,EAAY,EAAEE,EAAEN,GAAG,CAAC,QAAQ,EAAE,EAAEA,EAAE,KAAKA,EAAE,EAAE,CAAC,IAAII,EAAE,EAAE,KAAK,GAAYA,IAAT,OAAW,EAAE,KAAKA,EAAE,IAAI,YAAYA,EAAE,IAAIJ,CAAC,EAAE,MAAMI,EAAE,IAAIJ,CAAC,EAAEO,GAAE,CAAC,CAAC,CAAC,EAAE,SAASC,GAAER,EAAE,CAAU,KAAK,OAAd,QA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AAYD,CAAY,CAC/B,CAGS,cAAK,MAAM,QAAU,KACxB,MAAAE,EAAe,SAAS,cAA4B,UAAU,EAE9D,UAAI,QAAeL,GAAY,CAC/BK,GAAgB,CAACA,EAAa,UACnBA,EAAA,aAAa,UAAW,OAAO,EAC/BA,EAAA,aAAa,gBAAiB,MAAM,EACjDA,EAAa,iBAAiB,OAAQ,IAAML,EAAS,GACrDK,EAAa,iBAAiB,QAAS,IAAML,EAAS,IAE9CA,GACV,CACD,CACH,CAEA,MAAc,UAAUxC,EAAsB,CACtC,MAAA8C,EAAiC,KAAK,cAAc9C,CAAO,EAE7D,IAAC8C,EAAe,OAAQ,CAC1B,KAAK,YAAY9C,CAAO,EACxB,MACF,CAEA,UAAWhB,KAAS8D,EACV,YAAI,CAAC,KAAK,iBAAiB9D,CAAK,EAAG,KAAK,gBAAgBA,CAAK,CAAC,CAAC,EAGzE,KAAK,YAAYgB,CAAO,CAC1B,CACF,EC3OC,gBAAkB,CAEX,MAAAI,EAAe,IAAIrB,GACnB2C,EAAiB,IAAIvB,GAAeC,CAAY,EAEtD,MADa,IAAIqB,GAAYC,EAAgBtB,CAAY,EAC9C,MACb,GAAG","names":["i","o","f","s","e","_a","r","c","h","n","t","_b","h$1","SidebarNav","LitElement","entry","key","PlaceholderService","html","currentTarget","item","renderIcon","child","queryIndex","filterValues","term","siteMapEntries","groups","firstLevelPath","endpoint","FetchService","filteredNavigation","groupItems","group","error","DebuggerService","__decorateClass","state","customElement","SidebarContact","contactHtml","parser","contactHtmlString","headline","nothing","text","contacts","contact","icon","markup","contactsElement","contactElement","unsafeHTML","SidebarPosts","posts","sitemapEntry","nextSitemapEntry","siteMapEntry","picture","createOptimizedPicture","SidebarFooter","response","responseMarkup","SidebarComponent","createRef","ref","replaceBySpecifier","input","specifier","htmlTag","part","index","HeaderComponent","_changedProperties","leftCol","rightCol","logoText","logoTextHTML","m","ICONS_PATH","modules","Icon","name","iconMarkupFunc","iconMarkup","unsafeSVG","svg","until","css","property","BlockService","block","config","row","cols","col","toClassName","value","as","a","imgs","img","ps","p","main","shortBlockName","blockWrapper","section","toCamelCase","g","SectionService","blockService","container","sectionMeta","meta","style","wrappers","defaultContent","wrapper","parentElement","addClasses","element","classes","cssClass","getMetadata","doc","attr","metaElement","getLocation","isSidekickLibraryActive","_Status","Status","MainService","sectionService","lazyStylesScssPath","sidekickLibraryStylesScssPath","fontsScssPath","SectionsPromises","scriptEl","sidebarContainer","children","template","theme","blockMap","blockModule","__vitePreload","href","resolve","reject","link","firstSection","blockPromises","lcpCandidate","sectionsBlocks"],"sources":["../../node_modules/lit-html/directive-helpers.js","../../node_modules/lit-html/async-directive.js","../../node_modules/lit-html/directives/ref.js","../../src/components/sidebar/sidebarNav.ts","../../src/components/sidebar/sidebarContact.ts","../../src/components/sidebar/sidebarPosts.ts","../../src/components/sidebar/sidebarFooter.ts","../../src/components/sidebar/sidebar.ts","../../src/utils/replaceBySpecifier.ts","../../src/components/header.ts","../../node_modules/lit-html/directives/unsafe-svg.js","../../node_modules/lit-html/directives/private-async-helpers.js","../../node_modules/lit-html/directives/until.js","../../src/constants/paths.ts","../../src/components/icon/icon.ts","../../src/services/block.service.ts","../../src/utils/toCamelCase.ts","../../src/services/section.service.ts","../../src/utils/addClasses.ts","../../src/utils/getMetadata.ts","../../config.ts","../../src/helpers/sidekick/getLocation.ts","../../src/services/main.service.ts","../../src/main.ts"],"sourcesContent":["import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:t}=o,i=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,n={HTML:1,SVG:2},e=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,l=o=>null!=o?._$litType$?.h,c=o=>void 0!==o?._$litDirective$,d=o=>o?._$litDirective$,f=o=>void 0===o.strings,s=()=>document.createComment(\"\"),r=(o,i,n)=>{const e=o._$AA.parentNode,l=void 0===i?o._$AB:i._$AA;if(void 0===n){const i=e.insertBefore(s(),l),c=e.insertBefore(s(),l);n=new t(i,c,o,o.options)}else{const t=n._$AB.nextSibling,i=n._$AM,c=i!==o;if(c){let t;n._$AQ?.(o),n._$AM=o,void 0!==n._$AP&&(t=o._$AU)!==i._$AU&&n._$AP(t)}if(t!==l||c){let o=n._$AA;for(;o!==t;){const t=o.nextSibling;e.insertBefore(o,l),o=t}}}return n},v=(o,t,i=o)=>(o._$AI(t,i),o),u={},m=(o,t=u)=>o._$AH=t,p=o=>o._$AH,h=o=>{o._$AP?.(!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},j=o=>{o._$AR()};export{n as TemplateResultType,j as clearPart,p as getCommittedValue,d as getDirectiveClass,r as insertPart,l as isCompiledTemplateResult,c as isDirectiveResult,i as isPrimitive,f as isSingleExpression,e as isTemplateResult,h as removePart,v as setChildPartValue,m as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{isSingleExpression as i}from\"./directive-helpers.js\";import{Directive as t,PartType as e}from\"./directive.js\";export{Directive,PartType,directive}from\"./directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=(i,t)=>{const e=i._$AN;if(void 0===e)return!1;for(const i of e)i._$AO?.(t,!1),s(i,t);return!0},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t}while(0===e?.size)},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c(t)}};function h(i){void 0!==this._$AN?(o(this),this._$AM=i,r(this)):this._$AM=i}function n(i,t=!1,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i{i.type==e.CHILD&&(i._$AP??=n,i._$AQ??=h)};class f extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU}_$AO(i,t=!0){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s(this,i),o(this))}setValue(t){if(i(this._$Ct))this._$Ct._$AI(t,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}export{f as AsyncDirective};\n//# sourceMappingURL=async-directive.js.map\n","import{nothing as t}from\"../lit-html.js\";import{AsyncDirective as i}from\"../async-directive.js\";import{directive as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const e=()=>new h;class h{}const o=new WeakMap,n=s(class extends i{render(i){return t}update(i,[s]){const e=s!==this.Y;return e&&void 0!==this.Y&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),t}rt(t){if(\"function\"==typeof this.Y){const i=this.ht??globalThis;let s=o.get(i);void 0===s&&(s=new WeakMap,o.set(i,s)),void 0!==s.get(this.Y)&&this.Y.call(this.ht,void 0),s.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return\"function\"==typeof this.Y?o.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});export{e as createRef,n as ref};\n//# sourceMappingURL=ref.js.map\n","import { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport FetchService from 'Services/fetch.service.ts';\nimport { renderIcon } from '../icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { SiteMapEntry } from 'Types/siteMap.types.ts';\nimport { SheetsResponse } from 'Types/sheetResponse.types.ts';\n\ninterface SubMenuItem {\n path: string;\n navtitle: string;\n}\n\ninterface MenuItem {\n path: string;\n error?: string;\n navtitle: string;\n children?: SubMenuItem[];\n}\n\n@customElement('sidebar-nav')\nexport class SidebarNav extends LitElement {\n @state()\n items: MenuItem[];\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n async firstUpdated() {\n this.items = await this.groupByFirstLevelPath();\n }\n\n async getPlaceholder(key: string): Promise {\n const placeholder = await PlaceholderService.getPlaceHolder(key);\n return placeholder;\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.items) return;\n\n return html` `;\n }\n\n private toggleSubmenu({ currentTarget }: Event) {\n if (!(currentTarget instanceof HTMLElement) || !currentTarget.classList.contains('opener')) return;\n currentTarget.classList.toggle('active');\n }\n\n private renderSubMenu(item) {\n return html`\n ${item.navtitle} \n ${renderIcon('chevron-down', 'submenu__icon')}\n \n `;\n }\n\n private renderMenuItem(item: MenuItem) {\n if (item.error) {\n return html`

    ${item.error}

    `;\n } else {\n return html`
  • \n ${item.children !== undefined ? this.renderSubMenu(item) : html`${item.navtitle}`}\n
  • `;\n }\n }\n\n private renderMenuItems() {\n return html`
      \n ${this.items.map((item: MenuItem) => this.renderMenuItem(item))}\n
    `;\n }\n\n private getSubmenuName = (entry: MenuItem) => {\n return entry.path.split('/')[1];\n };\n\n private getNavTitle(item: MenuItem | SiteMapEntry) {\n if (item.path === '/') return 'Homepage';\n return item['navtitle'] || item['title'];\n }\n\n private filterNavigation(queryIndex: SiteMapEntry[], filterValues: string[]): MenuItem[] {\n return queryIndex\n .filter((item) => filterValues.every((term) => !item.path.includes(term)))\n .map((item) => ({\n path: item.path,\n navtitle: this.getNavTitle(item),\n }));\n }\n\n private groupItemsByFirstLevelPath(siteMapEntries: MenuItem[]): Record {\n const groups = {};\n siteMapEntries.forEach((item) => {\n const firstLevelPath = this.getSubmenuName(item); // Extracting the first level of the path\n if (!groups[firstLevelPath]) {\n groups[firstLevelPath] = [];\n }\n groups[firstLevelPath].push({\n path: item.path,\n navtitle: this.getNavTitle(item),\n });\n });\n return groups;\n }\n\n private async groupByFirstLevelPath() {\n const endpoint = '/query-index.json';\n const filterValues: string[] = ['sidekick', 'sidekick-library', 'tools', 'development', 'dev-', '__'];\n\n try {\n const queryIndex = await FetchService.fetchJson>(endpoint);\n\n this.error = null;\n\n const filteredNavigation = this.filterNavigation(queryIndex.data, filterValues);\n const groupItems = this.groupItemsByFirstLevelPath(filteredNavigation);\n const groupedData = Object.values(groupItems);\n\n return groupedData.map((group: MenuItem[]) => {\n if (group.length === 1) {\n return group[0];\n }\n\n return {\n navtitle: group[0].path.split('/')[1],\n path: group[0].path,\n children: group,\n };\n });\n } catch (error) {\n DebuggerService.error(`SidebarNav Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n return [];\n }\n }\n}\n","import { html, LitElement, nothing } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { renderIcon } from '../icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from '../../services/placeholder.service.ts';\nimport { IconName } from 'Types/icons.types.ts';\n\ninterface SidebarContactTemplateArgs {\n headline: HTMLElement | null;\n text: HTMLElement | null;\n contacts: Contact[];\n}\n\ninterface Contact {\n icon: HTMLElement | null;\n markup: HTMLElement | null;\n}\n\n@customElement('sidebar-contact')\nexport class SidebarContact extends LitElement {\n @state()\n contactTemplateArgs: SidebarContactTemplateArgs;\n\n @state()\n error: string | null = null;\n\n async connectedCallback() {\n super.connectedCallback();\n const contactHtml = await this.fetchContactsHtml();\n if (contactHtml !== null) this.getContactTemplateArgs(contactHtml);\n }\n\n async fetchContactsHtml() {\n const parser = new DOMParser();\n const endpoint = 'contact.plain.html';\n\n try {\n const contactHtmlString = await FetchService.fetchText(endpoint, {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.error = null;\n return parser.parseFromString(contactHtmlString, 'text/html');\n } catch (error) {\n DebuggerService.error(`SidebarContacts Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n\n return null;\n }\n }\n\n renderHeader(headline: HTMLElement | null) {\n if (!headline) return nothing;\n return html`
    \n

    ${headline}

    \n
    `;\n }\n\n renderText(text: HTMLElement | null) {\n if (!text) return nothing;\n return html`

    ${text}

    `;\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n\n if (!this.contactTemplateArgs) return nothing;\n\n const { headline, text, contacts } = this.contactTemplateArgs;\n\n return html`\n
    ${this.renderHeader(headline)} ${this.renderText(text)} ${this.renderContacts(contacts)}
    \n `;\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n private renderContact(contact: Contact) {\n const { icon, markup } = contact;\n if (!icon && !markup) return nothing;\n\n return html`
  • ${this.renderIcon(icon)} ${this.renderContactMarkup(markup)}
  • `;\n }\n\n private getContactsArgs(contactHtml: Document): Contact[] {\n const contactsElement = contactHtml.querySelectorAll('.contact > div:not(:first-child)');\n const contactsArray = Array.from(contactsElement);\n\n return contactsArray.map((contactElement) => {\n return {\n icon: contactElement.querySelector('div'),\n markup: contactElement.querySelector('div:last-child'),\n };\n });\n }\n\n private getContactTemplateArgs(contactHtml: Document) {\n const headline = contactHtml.querySelector('h2');\n const text = contactHtml.querySelector('p');\n const contacts = this.getContactsArgs(contactHtml);\n\n this.contactTemplateArgs = {\n headline,\n text,\n contacts,\n };\n }\n\n private renderContacts(contacts: Contact[]) {\n if (contacts.length === 0) return nothing;\n return html`
      \n ${contacts.map((contact) => this.renderContact(contact))}\n
    `;\n }\n\n private renderIcon(icon: HTMLElement | null) {\n if (!icon) return nothing;\n return renderIcon(icon.innerHTML as IconName);\n }\n\n private renderContactMarkup(markup: HTMLElement | null) {\n if (!markup) return nothing;\n return unsafeHTML(markup.innerHTML);\n }\n}\n","import { html, LitElement, nothing } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { createOptimizedPicture } from 'Utils/createOptimizedPicture.ts';\nimport FetchService from 'Services/fetch.service.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { Sitemap, SiteMapEntry } from 'Types/siteMap.types.ts';\nimport { SheetsResponse } from 'Types/sheetResponse.types.ts';\n\n@customElement('sidebar-posts')\nexport class SidebarPosts extends LitElement {\n @state()\n private lastTreePosts: Sitemap;\n\n @state()\n error: string | null = null;\n\n @state()\n private noPostsPlaceholder: string;\n\n async connectedCallback() {\n super.connectedCallback();\n const posts = await this.getPosts();\n this.lastTreePosts = this.getLastThreePosts(posts);\n this.noPostsPlaceholder = await PlaceholderService.getPlaceHolder('no posts');\n }\n\n render() {\n if (!this.lastTreePosts) return;\n\n return html` ${this.renderHeader()} ${this.renderPosts()} `;\n\n //TODO: Add overview if more button is needed\n /*\n \n */\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n private getLastThreePosts(posts: Sitemap) {\n posts.sort((sitemapEntry: SiteMapEntry, nextSitemapEntry: SiteMapEntry) => {\n if (sitemapEntry.lastModified > nextSitemapEntry.lastModified) {\n return -1;\n } else if (sitemapEntry.lastModified < nextSitemapEntry.lastModified) {\n return 1;\n }\n\n return 0;\n });\n\n return posts.slice(0, 3);\n }\n\n private renderPicture(siteMapEntry: SiteMapEntry) {\n const picture = createOptimizedPicture({\n src: siteMapEntry.image,\n alt: siteMapEntry.imagealt,\n width: 336,\n height: 224,\n });\n if (!picture) return nothing;\n return html`${picture}`;\n }\n\n private renderPost(siteMapEntry: SiteMapEntry) {\n return html`
    \n ${this.renderPicture(siteMapEntry)}\n

    ${siteMapEntry.description}

    \n
    `;\n }\n\n private async getPosts() {\n const endpoint = '/query-index.json';\n\n try {\n this.error = null;\n const queryIndex = await FetchService.fetchJson>(endpoint);\n return queryIndex.data.filter((item) => item.path.startsWith('/posts'));\n } catch (error) {\n DebuggerService.error(`SidebarPost Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n return [];\n }\n }\n\n private renderPosts() {\n if (this.error) return html`
    ${this.error}
    `;\n if (this.lastTreePosts.length === 0) return html`
    ${this.noPostsPlaceholder}
    `;\n\n return html`
    \n ${this.lastTreePosts.map((siteMapEntry) => this.renderPost(siteMapEntry))}\n
    `;\n }\n\n private renderHeader() {\n return html`
    \n

    Newest Posts

    \n
    `;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from '../../services/placeholder.service.ts';\n\n@customElement('sidebar-footer')\nexport class SidebarFooter extends LitElement {\n @state()\n footerMarkup: HTMLParagraphElement | null;\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.fetchFooterData();\n }\n\n async fetchFooterData() {\n const endpoint = 'footer.plain.html';\n\n try {\n const response = await FetchService.fetchText(endpoint, {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.error = null;\n const responseMarkup = document.createElement('div');\n responseMarkup.innerHTML = response;\n this.footerMarkup = responseMarkup.querySelector('p');\n if (this.footerMarkup) this.footerMarkup.classList.add('copyright');\n } catch (error) {\n DebuggerService.error(`SidebarFooter Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n }\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.footerMarkup) return;\n return html`${this.footerMarkup}`;\n }\n}\n","/**\n * @module SidebarComponent\n * @copyright diva-e (https://diva-e.com)\n */\n\nimport { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { createRef, Ref, ref } from 'lit/directives/ref.js';\n\nimport './sidebarNav.ts';\nimport './sidebarContact.ts';\nimport './sidebarPosts.ts';\nimport './sidebarFooter.ts';\nimport { renderIcon } from '../icon/icon.template.ts';\n\n@customElement('sidebar-component')\nexport class SidebarComponent extends LitElement {\n toggleRef: Ref = createRef();\n createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n firstUpdated(): void {\n this.toggleRef.value!.addEventListener('click', this.handleToggleClick);\n this.classList.add('activate-animations');\n }\n\n handleToggleClick = (e: Event) => {\n e.preventDefault();\n this.classList.toggle('active');\n };\n\n render() {\n return html`\n
    \n \n \n \n \n
    \n \n ${renderIcon('hamburger')}\n \n `;\n }\n}\n","/**\n * Represents the structure of an object used to specify replacements in a string.\n *\n * @interface ReplaceBySpecifier\n * @property {string} input - The input string where replacements will be made.\n * @property {string} specifier - The specifier string to search for in the input.\n * @property {string} htmlTag - The HTML tag to wrap around the parts matched by the specifier.\n */\ninterface ReplaceBySpecifier {\n input: string;\n specifier: string;\n htmlTag: string;\n}\n\n/**\n * Replaces occurrences of a specified specifier in a string with an HTML tag.\n *\n * @param {ReplaceBySpecifier} param - An object containing input string, specifier, and HTML tag.\n * @param {string} param.input - The input string where replacements will be made.\n * @param {string} param.specifier - The specifier string to search for in the input.\n * @param {string} param.htmlTag - The HTML tag to wrap around the parts matched by the specifier.\n * @returns {string} - The modified string with replacements.\n *\n @example\n * // Example 1:\n * const result1 = replaceBySpecifier({\n * input: 'This is a test string with some test keywords.',\n * specifier: 'test',\n * htmlTag: 'strong'\n * });\n * console.log(result1);\n * // Output: 'This is a string with some keywords.'\n *\n * // Example 2:\n * const result2 = replaceBySpecifier({\n * input: 'Hello, world!',\n * specifier: ',',\n * htmlTag: 'span'\n * });\n * console.log(result2);\n * // Output: 'Hello world!'\n */\nexport function replaceBySpecifier({ input, specifier, htmlTag }: ReplaceBySpecifier): string {\n if (specifier === '' || htmlTag === '') return input;\n return input\n .split(specifier)\n .map((part: string, index: number): string => (index % 2 === 1 ? `<${htmlTag}>${part}` : part))\n .join('');\n}\n","import { html, LitElement, PropertyValueMap } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { replaceBySpecifier } from 'Utils/replaceBySpecifier.ts';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport FetchService from 'Services/fetch.service.ts';\nimport { renderIcon } from './icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { IconName } from 'Types/icons.types.ts';\n\nexport interface HeaderResponseData {\n leftCol: LeftCol;\n rightCol: RightCol;\n}\n\nexport interface LeftCol {\n data: LeftColData[];\n}\n\nexport interface LeftColData {\n logoText: string;\n logoLink: string;\n}\n\nexport interface RightCol {\n data: RightColData[];\n}\n\nexport interface RightColData {\n socialIcon: IconName;\n socialLabel: string;\n socialLink: string;\n}\n\ninterface HeaderTemplateData {\n leftCol: LeftColData;\n rightCol: RightColData[];\n}\n\n@customElement('header-component')\nexport class HeaderComponent extends LitElement {\n @state()\n headerData: HeaderTemplateData;\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n protected async firstUpdated(_changedProperties: PropertyValueMap | Map) {\n await this.fetchHeaderData();\n }\n\n async fetchHeaderData() {\n try {\n const response = await FetchService.fetchJson('header.json', {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.headerData = { leftCol: response.leftCol.data[0], rightCol: response.rightCol.data };\n this.error = null;\n } catch (error) {\n DebuggerService.error('Header Component: Error while fetching header.json', error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n }\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.headerData) return;\n const { leftCol, rightCol } = this.headerData;\n const logoText = replaceBySpecifier({ input: leftCol.logoText, htmlTag: 'strong', specifier: ':::' });\n const logoTextHTML = unsafeHTML(logoText);\n return html`\n ${logoTextHTML}\n \n `;\n }\n}\n","import{directive as s}from\"../directive.js\";import{UnsafeHTMLDirective as e}from\"./unsafe-html.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class t extends e{}t.directiveName=\"unsafeSVG\",t.resultType=2;const o=s(t);export{o as unsafeSVG};\n//# sourceMappingURL=unsafe-svg.js.map\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class i{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??=new Promise((t=>this.q=t))}resume(){this.q?.(),this.Z=this.q=void 0}}export{i as Pauser,s as PseudoWeakRef,t as forAwaitOf};\n//# sourceMappingURL=private-async-helpers.js.map\n","import{noChange as t}from\"../lit-html.js\";import{isPrimitive as s}from\"../directive-helpers.js\";import{AsyncDirective as i}from\"../async-directive.js\";import{PseudoWeakRef as e,Pauser as r}from\"./private-async-helpers.js\";import{directive as o}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const n=t=>!s(t)&&\"function\"==typeof t.then,h=1073741823;class c extends i{constructor(){super(...arguments),this._$Cwt=h,this._$Cbt=[],this._$CK=new e(this),this._$CX=new r}render(...s){return s.find((t=>!n(t)))??t}update(s,i){const e=this._$Cbt;let r=e.length;this._$Cbt=i;const o=this._$CK,c=this._$CX;this.isConnected||this.disconnected();for(let t=0;tthis._$Cwt);t++){const s=i[t];if(!n(s))return this._$Cwt=t,s;t{for(;c.get();)await c.get();const i=o.deref();if(void 0!==i){const e=i._$Cbt.indexOf(s);e>-1&&e {\n const config: Record = {};\n block.querySelectorAll(':scope > div').forEach((row) => {\n if (row.children) {\n const cols = [...row.children];\n if (cols[1]) {\n const col = cols[1];\n const name = toClassName(cols[0].textContent ?? '');\n let value: any = '';\n if (col.querySelector('a')) {\n const as = [...col.querySelectorAll('a')];\n if (as.length === 1) {\n value = as[0].href;\n } else {\n value = as.map((a) => a.href);\n }\n } else if (col.querySelector('img')) {\n const imgs = [...col.querySelectorAll('img')];\n if (imgs.length === 1) {\n value = imgs[0].src;\n } else {\n value = imgs.map((img) => img.src);\n }\n } else if (col.querySelector('p')) {\n const ps = [...col.querySelectorAll('p')];\n if (ps.length === 1) {\n value = ps[0].textContent;\n } else {\n value = ps.map((p) => p.textContent);\n }\n } else value = row.children[1].textContent;\n config[name] = value;\n }\n }\n });\n return config;\n }\n\n /**\n * Decorates all blocks in a container element.\n * @param {Element} main The container element\n */\n decorateBlocks(main: HTMLElement) {\n main.querySelectorAll('div.section > div > div').forEach(this.decorateBlock);\n }\n\n /**\n * Decorates a block.\n * @param {Element} block The block element\n */\n private decorateBlock(block: HTMLElement) {\n const shortBlockName = block.classList[0];\n if (shortBlockName) {\n block.classList.add('block');\n block.dataset.blockName = shortBlockName;\n const blockWrapper = block.parentElement;\n blockWrapper?.classList.add(`${shortBlockName}-wrapper`);\n const section = block.closest('.section');\n if (section) section.classList.add(`${shortBlockName}-container`);\n }\n }\n}\n","import { toClassName } from './toClassName';\n\n/**\n * Sanitizes a string for use as a JavaScript property name.\n *\n * @param {string} name - The unsanitized string.\n * @returns {string} - The camelCased name.\n *\n * @example\n * // Example usage:\n * const unsanitizedString = 'background-color';\n * const camelCasedName = toCamelCase(unsanitizedString);\n * console.log(camelCasedName); // Output: 'backgroundColor'\n */\nexport function toCamelCase(name: string): string {\n if (/^[a-z][A-Za-z0-9]*$/.test(name)) {\n return name;\n }\n\n if (/^[A-Z][A-Za-z0-9]*$/.test(name)) {\n return name.charAt(0).toLowerCase() + name.slice(1);\n }\n\n return toClassName(name).replace(/-([a-z])/g, (g: string) => g[1].toUpperCase());\n}\n","import { toCamelCase } from '../utils/toCamelCase';\nimport { toClassName } from '../utils/toClassName';\nimport { BlockService } from './block.service';\n\nexport class SectionService {\n constructor(private blockService: BlockService) {}\n\n init(container: HTMLElement) {\n this.transformSection(container);\n }\n\n /**\n * Decorates all sections in a container element.\n * @param {Element} main The container element\n */\n private transformSection(main: HTMLElement) {\n main.querySelectorAll(':scope > div').forEach((section) => {\n this.adjustMarkup(section);\n this.processSectionMetaData(section);\n });\n }\n\n private processSectionMetaData(section: HTMLElement) {\n // Process section metadata\n const sectionMeta = section.querySelector('div.section-metadata');\n if (sectionMeta) {\n const meta = this.blockService.readBlockConfig(sectionMeta);\n Object.keys(meta).forEach((key) => {\n if (key === 'style') {\n const styles = meta.style\n .split(',')\n .filter((style: string) => style)\n .map((style: string) => toClassName(style.trim()));\n styles.forEach((style: string) => section.classList.add(style));\n } else {\n section.dataset[toCamelCase(key)] = meta[key];\n }\n });\n if (sectionMeta.parentElement) sectionMeta.parentElement.remove();\n }\n }\n\n private adjustMarkup(section: HTMLDivElement) {\n const wrappers: HTMLDivElement[] = [];\n let defaultContent = false;\n [...section.children].forEach((e) => {\n if (e.tagName === 'DIV' || !defaultContent) {\n const wrapper = document.createElement('div');\n wrappers.push(wrapper);\n defaultContent = e.tagName !== 'DIV';\n\n if (defaultContent) {\n wrapper.classList.add('default-content-wrapper');\n }\n }\n wrappers[wrappers.length - 1].append(e);\n });\n wrappers.forEach((wrapper) => section.append(wrapper));\n this.decorateImages();\n section.classList.add('section');\n section.dataset.sectionStatus = 'initialized';\n section.style.display = 'none';\n }\n decorateImages() {\n const picture = document.querySelectorAll('.default-content-wrapper picture');\n picture.forEach((item) => {\n const parentElement = item.parentElement;\n if (parentElement) {\n parentElement.classList.add('image', 'main');\n }\n });\n }\n}\n","import { toClassName } from './toClassName';\n\n/**\n * Adds CSS classes to an HTML element.\n *\n * @param {HTMLElement} element - The HTML element to which classes will be added.\n * @param {string} classes - A string containing CSS classes separated by commas.\n *\n * @example\n * const element = document.getElementById('myElement');\n * const classesToAdd = 'class1, class2, class3';\n * addClasses(element, classesToAdd);\n */\nexport const addClasses = (element: HTMLElement, classes: string): void => {\n classes.split(',').forEach((cssClass: string): void => {\n element.classList.add(toClassName(cssClass.trim()));\n });\n};\n","/**\n * Retrieves the content of a specified metadata tag from the document head.\n *\n * @param {string} value - The name or property attribute value of the metadata tag.\n * @param {Document} [doc=document] - The document to search for the metadata tag (default is the current document).\n * @returns {string} - The content of the metadata tag, if found; otherwise, an empty string.\n *\n * @example\n * // Example 1:\n * // Assuming exists in the document head.\n * const metaContent = getMetadata('description');\n * console.log(metaContent);\n * // Output: 'This is a sample description.'\n *\n * @example\n * // Example 2:\n * // Assuming exists in the document head.\n * const metaContent = getMetadata('og:title', document);\n * console.log(metaContent);\n * // Output: 'Open Graph Title'\n */\nexport function getMetadata(value: string, doc: Document = document): string {\n const attr: 'property' | 'name' = value && value.includes(':') ? 'property' : 'name';\n const metaTags: HTMLMetaElement[] =\n ([...doc.head.querySelectorAll(`meta[${attr}=\"${value}\"]`)] as HTMLMetaElement[]) || [];\n const meta: string = metaTags.map((metaElement: HTMLMetaElement) => metaElement.content).join(', ');\n return meta.length ? meta : '';\n}\n","export interface Config {\n mainTsPath: string;\n mainScssPath: string;\n iconsDirPath: string;\n iconsTypesPath: string;\n fontsScssPath?: string;\n lazyStylesScssPath?: string;\n sidekickLibraryStylesScssPath?: string;\n}\n\nexport const config: Config = {\n mainTsPath: 'src/main.ts',\n mainScssPath: 'src/styles/sass/main.scss',\n iconsDirPath: './public/icons',\n iconsTypesPath: './src/types/icons.types.ts',\n fontsScssPath: 'src/styles/sass/fonts.scss',\n lazyStylesScssPath: 'src/styles/sass/lazy-styles.scss',\n sidekickLibraryStylesScssPath: 'src/styles/sass/sidekick-library-styles.scss',\n};\n","import { isSidekickLibraryActive } from './isSidekickLibraryActive.ts';\n\n/**\n * Returns the true origin of the current page in the browser.\n * If the page is running in an iframe with srcdoc, the query param is returned.\n * @returns {String} The query param of the current page or the query param of the block running in the library\n *\n * @example\n * const searchParams = new URLSearchParams(getLocation().search);\n *\n * @remarks\n * Needs to be used when the Sidekick Library Plugin is in use.\n */\nexport function getLocation(): Location {\n return isSidekickLibraryActive() ? window.parent.location : window.location;\n}\n","import { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive';\nimport { addClasses } from '../utils/addClasses';\nimport { getMetadata } from '../utils/getMetadata';\nimport { BlockService } from './block.service';\nimport { SectionService } from './section.service';\nimport { config } from '../../config.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport { getLocation } from 'Helpers/sidekick/getLocation.ts';\n\ntype BlockMapping = {\n name: string;\n element: HTMLDivElement;\n};\n\ninterface LcpCandidate extends HTMLElement {\n complete: boolean;\n}\n\nclass Status {\n static unloaded = 'unloaded';\n static loading = 'loading';\n static loaded = 'loaded';\n static error = 'error';\n}\n\nexport class MainService {\n private lcpBlocks = ['banner'];\n\n constructor(\n private sectionService: SectionService,\n private blockService: BlockService\n ) {}\n\n init = async () => {\n this.setup();\n await this.loadEager();\n await this.loadLazy();\n };\n\n /**\n * Setup block utils.\n */\n private setup() {\n window.hlx = window.hlx || {};\n window.hlx.RUM_MASK_URL = 'full';\n window.hlx.codeBasePath = '';\n window.hlx.lighthouse = new URLSearchParams(getLocation().search).get('lighthouse') === 'on';\n\n const scriptEl = document.querySelector('script[src$=\"/scripts/scripts.js\"]') as HTMLScriptElement;\n if (scriptEl) {\n try {\n [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split('/scripts/scripts.js');\n } catch (error) {\n DebuggerService.error('MainService: Error initializing codeBasePath.', error);\n }\n }\n }\n\n private loadEager = async () => {\n // TODO: how to support different languages here\n document.documentElement.lang = 'en';\n this.decorateTemplateAndTheme();\n const main = document.querySelector('main');\n if (main) {\n main.setAttribute('id', 'main');\n this.addSidebarContainer(main);\n this.sectionService.init(main);\n this.addInnerContainer(main); // TODO refactor initializing\n this.blockService.decorateBlocks(main);\n\n // TODO: Performance adjustment\n setTimeout(() => {\n document.body.classList.add('show');\n }, 100);\n\n await this.waitForLCP();\n\n try {\n /* if desktop (proxy for fast connection) or fonts already loaded, load fonts.css */\n if (window.innerWidth >= 900 || sessionStorage.getItem('fonts-loaded')) {\n await this.loadFonts();\n }\n } catch (e) {\n // do nothing\n }\n }\n };\n\n private addSidebarContainer(main: HTMLElement) {\n if (isSidekickLibraryActive()) return;\n\n const sidebarContainer = document.createElement('sidebar-component');\n sidebarContainer.setAttribute('id', 'sidebar');\n window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active');\n window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active');\n main.after(sidebarContainer);\n }\n\n private addInnerContainer(main: HTMLElement) {\n const children = main.innerHTML;\n main.innerHTML = `
    ${isSidekickLibraryActive() ? `` : ``}${children}
    `;\n }\n\n private loadLazy = async () => {\n const { lazyStylesScssPath, sidekickLibraryStylesScssPath, fontsScssPath } = config;\n try {\n if (lazyStylesScssPath) await this.loadCSS(`${window.hlx.codeBasePath}/dist/lazyStyles/lazyStyles.css`);\n if (sidekickLibraryStylesScssPath && isSidekickLibraryActive()) {\n await this.loadCSS(`${window.hlx.codeBasePath}/dist/sidekickLibraryStyles/sidekickLibraryStyles.css`);\n }\n if (fontsScssPath) await this.loadFonts();\n await this.loadBlocks();\n } catch (error) {\n DebuggerService.error('MainService: Load lazy error: ', error);\n }\n };\n\n private decorateTemplateAndTheme() {\n const template = getMetadata('template');\n if (template) addClasses(document.body, template);\n const theme = getMetadata('theme');\n if (theme) addClasses(document.body, theme);\n }\n\n /**\n * Loads Blocks\n * by getting all sections and load every block in every section\n * and shows every section that is finished loading.\n */\n private loadBlocks = async () => {\n const sections = [...document.querySelectorAll('.section')];\n const SectionsPromises = sections.map((section) => this.loadBlock(section));\n\n await Promise.all(SectionsPromises);\n };\n\n private collectBlocks(section: HTMLElement): BlockMapping[] {\n const blockMap: BlockMapping[] = [];\n const blocksElements = section.querySelectorAll('[data-block-name]');\n\n blocksElements.forEach((block: HTMLDivElement) => {\n blockMap.push({\n name: block.dataset['blockName'] as string,\n element: block,\n });\n });\n\n return blockMap;\n }\n\n private async loadBlockModules(block: BlockMapping) {\n const status = block.element.dataset.blockStatus ?? Status.unloaded;\n\n if (status === Status.unloaded) {\n block.element.dataset.blockStatus = Status.loading;\n\n try {\n const blockModule = await import(`${window.hlx.codeBasePath}/dist/${block.name}/${block.name}.js`);\n\n if (blockModule.default) {\n await blockModule.default(block.element);\n }\n\n block.element.dataset.blockStatus = Status.loaded;\n } catch (error) {\n block.element.dataset.blockStatus = Status.error;\n DebuggerService.error('MainService: An error occurred during module import:', error);\n }\n }\n }\n\n async loadBlockStyles(block: BlockMapping) {\n try {\n await this.loadCSS(`${window.hlx.codeBasePath}/dist/${block.name}/${block.name}.css`);\n } catch (error) {\n //do nothing\n }\n }\n\n private showSection(section: HTMLElement) {\n section.style.removeProperty('display');\n }\n\n private async loadFonts() {\n await this.loadCSS(`${window.hlx.codeBasePath}/dist/fonts/fonts.css`);\n try {\n if (!getLocation().hostname.includes('localhost')) sessionStorage.setItem('fonts-loaded', 'true');\n } catch (e) {\n // do nothing\n }\n }\n\n private async loadCSS(href: string) {\n return new Promise((resolve, reject) => {\n if (!document.querySelector(`head > link[href=\"${href}\"]`)) {\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n link.onload = resolve;\n link.onerror = reject;\n document.head.append(link);\n } else {\n resolve(true);\n }\n });\n }\n\n private async waitForLCP() {\n /* Js Chunks should be loaded\n Old logic only looks after the first block\n New logic looks in the first section after lcp candidates, \n since we show ech section depending on if its blocks and modules are loaded */\n const firstSection: HTMLElement | null = document.querySelector('.section');\n\n if (firstSection) {\n const blocks = this.collectBlocks(firstSection);\n const blockPromises = blocks.map(async (block) => {\n const hasLCPBlock = this.lcpBlocks.includes(block.name);\n if (hasLCPBlock) await Promise.all([this.loadBlockModules(block), this.loadBlockStyles(block)]);\n });\n\n await Promise.all(blockPromises);\n this.showSection(firstSection);\n }\n\n // @ts-ignore\n document.body.style.display = null;\n const lcpCandidate = document.querySelector('main img');\n\n await new Promise((resolve) => {\n if (lcpCandidate && !lcpCandidate.complete) {\n lcpCandidate.setAttribute('loading', 'eager');\n lcpCandidate.setAttribute('fetchpriority', 'high');\n lcpCandidate.addEventListener('load', () => resolve());\n lcpCandidate.addEventListener('error', () => resolve());\n } else {\n resolve();\n }\n });\n }\n\n private async loadBlock(section: HTMLElement) {\n const sectionsBlocks: BlockMapping[] = this.collectBlocks(section);\n\n if (!sectionsBlocks.length) {\n this.showSection(section);\n return;\n }\n\n for (const block of sectionsBlocks) {\n Promise.all([this.loadBlockModules(block), this.loadBlockStyles(block)]);\n }\n\n this.showSection(section);\n }\n}\n","// const LCP_BLOCKS: string[] = []; // add your LCP blocks to the list\n\nimport './components/sidebar/sidebar.ts';\nimport './components/header.ts';\nimport './components/icon/icon.ts';\nimport './services/fetch.service.ts';\nimport { BlockService } from './services/block.service.ts';\nimport { SectionService } from './services/section.service.ts';\nimport { MainService } from './services/main.service.ts';\n\n// function preloadLcpImageCandidate() {\n// const lcpCandidate = document.querySelector('main img') as HTMLImageElement | null;\n// const linkTag = document.createElement('link');\n// linkTag.rel = 'preload';\n// linkTag.as = 'image';\n// linkTag.href = lcpCandidate?.src || '';\n// // linkTag.type = getLinkTypeFromImageExt(lcpCandidate?.src);\n// document.head.appendChild(linkTag);\n// }\n\n(async function () {\n // preloadLcpImageCandidate();\n const blockService = new BlockService();\n const sectionService = new SectionService(blockService);\n const main = new MainService(sectionService, blockService);\n await main.init();\n})();\n\ndeclare global {\n interface Window {\n hlx: {\n RUM_MASK_URL: string;\n codeBasePath: string;\n lighthouse: boolean;\n };\n }\n}\n"],"file":"main/main.js"} \ No newline at end of file +{"version":3,"mappings":"koBAaa,MAAAA,EAAa,CAACC,EAAsBC,IAA0B,CACzEA,EAAQ,MAAM,GAAG,EAAE,QAASC,GAA2B,CACrDF,EAAQ,UAAU,IAAIG,EAAYD,EAAS,KAAM,EAAC,EACnD,CACH,ECIgB,SAAAE,EAAYC,EAAeC,EAAgB,SAAkB,CAC3E,MAAMC,EAA4BF,GAASA,EAAM,SAAS,GAAG,EAAI,WAAa,OAGxEG,EADH,CAAC,GAAGF,EAAI,KAAK,iBAAiB,QAAQC,CAAI,KAAKF,CAAK,IAAI,CAAC,EAC9B,IAAKI,GA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MAAM,EAAE,CAAC,EAC/C,aAAa,KAAM,MAAM,EACvB,QAAQ,UAChB,EAEDA,EAAI,KAAK,CACX,CAEO,SAASwG,IAAa,CACvB,SAAS,aAAeF,EAAa,aAAe,SAAS,aAAeA,EAAa,SACtFC,KAEI,0BAAiB,mBAAoB,IAAM,CAClD,MAAME,EAAa,SAAS,YACxBA,IAAeH,EAAa,aAAeG,IAAeH,EAAa,WACpEC,IACP,CACD,CAEL,CCtBAC,GAAW","names":["addClasses","element","classes","cssClass","toClassName","getMetadata","value","doc","attr","meta","metaElement","decorateTemplateAndTheme","template","theme","decorateButtons","a","up","twoup","undefinedOnEmpty","setDocLanguage","lang","collectBlocks","section","blockMap","block","loadBlockModules","status","href","getUrlForEndpoint","blockModule","error","DebuggerService","loadCSS","endpoint","resolve","reject","link","loadBlockStyles","config","showSection","waitForLCP","firstSection","lcpBlocks","blockPromises","lcpCandidate","getLocation","isSidekickLibraryActive","loadFonts","fontsCssPath","e","sampleRUM","checkpoint","data","defer","fnname","args","dfnname","fn","chkpnt","weight","id","_","i","random","isSelected","firstReadTime","urlSanitizers","knownProperties","sendPing","pdata","body","url","script","setupHlxObj","mainScriptPath","scriptEl","initSampleRUM","event","loadBlock","sectionsBlocks","loadBlocks","SectionsPromises","decorateImages","item","parentElement","adjustMarkup","wrappers","defaultContent","wrapper","toCamelCase","name","g","readBlockConfig","row","cols","col","as","imgs","img","ps","p","processSectionMetaData","sectionMeta","key","style","transformSection","main","decorateBlocks","shortBlockName","blockWrapper","HLX","cb","beforeLoadEagerTask","loadEagerTask","beforeLoadLazyTask","loadLazyTask","lazyStylesScssPath","sidekickLibraryStylesScssPath","fontsScssPath","lazyStylesCssPath","sidekickLibraryStylesCssPath","hash","beforeLoadDelayedTask","loadDelayedTask","initializedTask","HLX$1","o","f","s","_a","r","c","h","n","t","_b","h$1","SidebarNav","LitElement","entry","PlaceholderService","html","currentTarget","renderIcon","child","queryIndex","filterValues","term","siteMapEntries","groups","firstLevelPath","FetchService","filteredNavigation","groupItems","group","__decorateClass","state","customElement","SidebarContact","contactHtml","parser","contactHtmlString","headline","nothing","text","contacts","contact","icon","markup","contactsElement","contactElement","unsafeHTML","SidebarPosts","posts","sitemapEntry","nextSitemapEntry","siteMapEntry","picture","createOptimizedPicture","SidebarFooter","response","responseMarkup","SidebarComponent","createRef","ref","addSidebarContainer","sidebarContainer","addInnerContainer","children","replaceBySpecifier","input","specifier","htmlTag","part","index","HeaderComponent","_changedProperties","leftCol","rightCol","logoText","logoTextHTML","m","ICONS_PATH","modules","Icon","iconMarkupFunc","iconMarkup","unsafeSVG","svg","until","css","property","READY_STATES","init","initHLXApp","readyState"],"sources":["../../src/utils/addClasses.ts","../../src/utils/getMetadata.ts","../../src/app/tasks/decorateTemplateAndTheme.ts","../../src/app/tasks/decorateButtons.ts","../../src/utils/undefinedOnEmpty.ts","../../src/app/tasks/setDocLanguage.ts","../../src/app/tasks/collectBlocks.ts","../../src/app/tasks/loadBlockModules.ts","../../src/app/tasks/loadCSS.ts","../../src/app/tasks/loadBlockStyles.ts","../../config.ts","../../src/app/tasks/showSection.ts","../../src/app/tasks/waitForLCP.ts","../../src/helpers/sidekick/getLocation.ts","../../src/app/tasks/loadFonts.ts","../../src/app/tasks/sampleRUM.ts","../../src/app/tasks/setupHlxObj.ts","../../src/app/tasks/initSampleRUM.ts","../../src/app/tasks/loadBlock.ts","../../src/app/tasks/loadBlocks.ts","../../src/app/tasks/decorateImages.ts","../../src/app/tasks/adjustMarkup.ts","../../src/utils/toCamelCase.ts","../../src/app/tasks/readBlockConfig.ts","../../src/app/tasks/processSectionMetaData.ts","../../src/app/tasks/transformSections.ts","../../src/app/tasks/decorateBlocks.ts","../../src/app/index.ts","../../node_modules/lit-html/directive-helpers.js","../../node_modules/lit-html/async-directive.js","../../node_modules/lit-html/directives/ref.js","../../src/components/sidebar/sidebarNav.ts","../../src/components/sidebar/sidebarContact.ts","../../src/components/sidebar/sidebarPosts.ts","../../src/components/sidebar/sidebarFooter.ts","../../src/components/sidebar/sidebar.ts","../../src/components/sidebar/sidebar.init.ts","../../src/components/innerContainer/innerContainer.ts","../../src/components/innerContainer/innerContainer.init.ts","../../src/utils/replaceBySpecifier.ts","../../src/components/header.ts","../../node_modules/lit-html/directives/unsafe-svg.js","../../node_modules/lit-html/directives/private-async-helpers.js","../../node_modules/lit-html/directives/until.js","../../src/constants/paths.ts","../../src/components/icon/icon.ts","../../src/app/init.ts","../../src/main.ts"],"sourcesContent":["import { toClassName } from './toClassName';\n\n/**\n * Adds CSS classes to an HTML element.\n *\n * @param {HTMLElement} element - The HTML element to which classes will be added.\n * @param {string} classes - A string containing CSS classes separated by commas.\n *\n * @example\n * const element = document.getElementById('myElement');\n * const classesToAdd = 'class1, class2, class3';\n * addClasses(element, classesToAdd);\n */\nexport const addClasses = (element: HTMLElement, classes: string): void => {\n classes.split(',').forEach((cssClass: string): void => {\n element.classList.add(toClassName(cssClass.trim()));\n });\n};\n","/**\n * Retrieves the content of a specified metadata tag from the document head.\n *\n * @param {string} value - The name or property attribute value of the metadata tag.\n * @param {Document} [doc=document] - The document to search for the metadata tag (default is the current document).\n * @returns {string} - The content of the metadata tag, if found; otherwise, an empty string.\n *\n * @example\n * Example 1:\n * Assuming exists in the document head.\n * const metaContent = getMetadata('description');\n * console.log(metaContent);\n * Output: 'This is a sample description.'\n *\n * @example\n * Example 2:\n * Assuming exists in the document head.\n * const metaContent = getMetadata('og:title', document);\n * console.log(metaContent);\n * Output: 'Open Graph Title'\n */\nexport function getMetadata(value: string, doc: Document = document): string {\n const attr: 'property' | 'name' = value && value.includes(':') ? 'property' : 'name';\n const metaTags: HTMLMetaElement[] =\n ([...doc.head.querySelectorAll(`meta[${attr}=\"${value}\"]`)] as HTMLMetaElement[]) || [];\n const meta: string = metaTags.map((metaElement: HTMLMetaElement) => metaElement.content).join(', ');\n return meta.length ? meta : '';\n}\n","import { addClasses } from '../../utils/addClasses';\nimport { getMetadata } from '../../utils/getMetadata';\n\n/**\n * Decorates the template and theme by adding classes to the body.\n * The classes are defined in the meta tags of the document.\n * Usefull for styling the page based on the template and theme meta tags\n * that can be set in the metadata table in EDS.\n * @example\n * \n * \n * @example\n * \n */\nexport function decorateTemplateAndTheme() {\n const template = getMetadata('template');\n if (template) addClasses(document.body, template);\n const theme = getMetadata('theme');\n if (theme) addClasses(document.body, theme);\n}\n","/**\n * Decorates paragraphs containing a single link as buttons.\n * @param {Element} element container element\n */\nexport function decorateButtons(element) {\n element.querySelectorAll('a').forEach((a) => {\n a.title = a.title || a.textContent;\n if (a.href !== a.textContent) {\n const up = a.parentElement;\n const twoup = a.parentElement.parentElement;\n if (!a.querySelector('img')) {\n if (up.childNodes.length === 1 && (up.tagName === 'P' || up.tagName === 'DIV')) {\n a.className = 'button'; // default\n up.classList.add('button-container');\n }\n if (\n up.childNodes.length === 1 &&\n up.tagName === 'STRONG' &&\n twoup.childNodes.length === 1 &&\n twoup.tagName === 'P'\n ) {\n a.className = 'button primary';\n twoup.classList.add('button-container');\n }\n if (\n up.childNodes.length === 1 &&\n up.tagName === 'EM' &&\n twoup.childNodes.length === 1 &&\n twoup.tagName === 'P'\n ) {\n a.className = 'button secondary';\n twoup.classList.add('button-container');\n }\n }\n }\n });\n}\n","/**\n * Returns undefined if the value is an empty string, otherwise returns the value itself.\n *\n * @param {string} value - The value to check.\n * @returns {string | undefined} - If the value is an empty string, returns undefined\n * otherwise, returns the value itself.\n *\n * @example\n * // Example usage:\n * const emptyValue = '';\n * const nonEmptyValue = 'Hello, World!';\n *\n * const result1 = undefinedOnEmpty(emptyValue);\n * console.log(result1); // Output: undefined\n *\n * const result2 = undefinedOnEmpty(nonEmptyValue);\n * console.log(result2); // Output: 'Hello, World!'\n */\nexport function undefinedOnEmpty(value: string): string | undefined {\n return value.trim() === '' ? undefined : value;\n}\n","import { getMetadata } from '../../utils/getMetadata';\nimport { undefinedOnEmpty } from '../../utils/undefinedOnEmpty';\n\n/*\n * This function sets the language of the document based on the language metadata.\n */\nexport function setDocLanguage() {\n const lang = getMetadata('language');\n document.documentElement.lang = undefinedOnEmpty(lang) || 'en';\n}\n","import { BlockMapping } from '../app.types';\n\n/**\n * Collect all blocks in a section.\n * @param section - The section to collect the blocks from.\n * @returns BlockMapping[]\n * @example\n * const blocks = collectBlocks(section);\n * console.log(blocks);\n * Output: [{ name: 'block1', element: HTMLElement }, { name: 'block2', element: HTMLElement }]\n */\nexport function collectBlocks(section: HTMLElement): BlockMapping[] {\n const blockMap: BlockMapping[] = [];\n const blocksElements = section.querySelectorAll('[data-block-name]');\n\n blocksElements.forEach((block: HTMLDivElement) => {\n blockMap.push({\n name: block.dataset['blockName'] as string,\n element: block,\n });\n });\n\n return blockMap;\n}\n","import { DebuggerService } from '@kluntje/services';\nimport { BlockMapping } from '../app.types';\nimport { getUrlForEndpoint } from '../utils/getUrlForEndpoint';\n\n/*\n * Load the es module for the block. The module should be named as the block name.\n * @param block - The block to load the module for.\n * @returns Promise\n */\nexport async function loadBlockModules(block: BlockMapping): Promise {\n const status = block.element.dataset.blockStatus;\n if (status !== 'loading' && status !== 'loaded') {\n try {\n block.element.dataset.blockStatus = 'loading';\n const { href } = getUrlForEndpoint(`dist/${block.name}/${block.name}.js`);\n const blockModule = await import(href);\n\n if (blockModule.default) {\n await blockModule.default(block.element);\n }\n\n block.element.dataset.blockStatus = 'loaded';\n } catch (error) {\n block.element.dataset.blockStatus = 'error';\n DebuggerService.error('laodBloackModules:', error);\n }\n }\n}\n","import { getUrlForEndpoint } from '../utils/getUrlForEndpoint';\n\n/**\n * Load a CSS file if it is not already loaded append it to the head.\n * @param endpoint - The endpoint of the CSS file.\n * @returns Promise\n */\nexport async function loadCSS(endpoint: string) {\n return new Promise((resolve, reject) => {\n const { href } = getUrlForEndpoint(endpoint);\n\n if (!document.querySelector(`head > link[href=\"${href}\"]`)) {\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n link.onload = resolve;\n link.onerror = reject;\n document.head.append(link);\n } else {\n resolve(true);\n }\n });\n}\n","import { BlockMapping } from '../app.types';\nimport { loadCSS } from './loadCSS';\n\n/**\n * Load the block styles. The styles should be named as the block name.\n * @param block - The block to load the styles for.\n * @returns Promise\n */\nexport async function loadBlockStyles(block: BlockMapping) {\n try {\n await loadCSS(`dist/${block.name}/${block.name}.css`);\n } catch (error) {\n //do nothing\n }\n}\n","export interface Config {\n mainTsPath: string;\n mainScssPath: string;\n iconsDirPath: string;\n iconsTypesPath: string;\n fontsScssPath?: string;\n fontsCssPath?: string;\n lazyStylesScssPath?: string;\n lazyStylesCssPath?: string;\n sidekickLibraryStylesScssPath?: string;\n sidekickLibraryStylesCssPath?: string;\n lcpBlocks?: string[];\n}\n\nexport const config: Config = {\n mainTsPath: './src/main.ts',\n mainScssPath: './src/styles/sass/main.scss',\n iconsDirPath: './public/icons',\n iconsTypesPath: './src/types/icons.types.ts',\n fontsScssPath: './src/styles/sass/fonts.scss',\n fontsCssPath: './dist/fonts/fonts.css',\n lazyStylesScssPath: './src/styles/sass/lazy-styles.scss',\n lazyStylesCssPath: './dist/lazyStyles/lazyStyles.css',\n sidekickLibraryStylesScssPath: './src/styles/sass/sidekick-library-styles.scss',\n sidekickLibraryStylesCssPath: './dist/sidekickLibraryStyles/sidekickLibraryStyles.css',\n lcpBlocks: [],\n};\n","/**\n * Removes the display property from the section\n * @param section - The section to show\n */\nexport function showSection(section: HTMLElement) {\n section.style.removeProperty('display');\n}\n","import { collectBlocks } from './collectBlocks';\nimport { loadBlockModules } from './loadBlockModules';\nimport { loadBlockStyles } from './loadBlockStyles';\nimport { config } from '../../../config';\nimport { showSection } from './showSection';\nimport { LcpCandidate } from '../app.types';\n\n/**\n * Wait for the Largest Contentful Paint (LCP) candidate to be loaded.\n * This function will load the modules and styles for the first section after the LCP candidate.\n * @returns Promise\n */\nexport async function waitForLCP() {\n const firstSection: HTMLElement | null = document.querySelector('.section');\n const { lcpBlocks } = config;\n\n if (firstSection) {\n const blocks = collectBlocks(firstSection);\n const blockPromises = blocks.map(async (block) => {\n const hasLCPBlock = lcpBlocks?.includes(block.name);\n if (hasLCPBlock) await Promise.all([loadBlockModules(block), loadBlockStyles(block)]);\n });\n\n await Promise.all(blockPromises);\n showSection(firstSection);\n }\n\n // @ts-ignore\n document.body.style.display = null;\n const lcpCandidate = document.querySelector('main img');\n\n await new Promise((resolve) => {\n if (lcpCandidate && !lcpCandidate.complete) {\n lcpCandidate.setAttribute('loading', 'eager');\n lcpCandidate.setAttribute('fetchpriority', 'high');\n lcpCandidate.addEventListener('load', () => resolve());\n lcpCandidate.addEventListener('error', () => resolve());\n } else {\n resolve();\n }\n });\n}\n","import { isSidekickLibraryActive } from './isSidekickLibraryActive.ts';\n\n/**\n * Returns the true origin of the current page in the browser.\n * If the page is running in an iframe with srcdoc, the query param is returned.\n * @returns {String} The query param of the current page or the query param of the block running in the library\n *\n * @example\n * const searchParams = new URLSearchParams(getLocation().search);\n *\n * @remarks\n * Needs to be used when the Sidekick Library Plugin is in use.\n */\nexport function getLocation(): Location {\n return isSidekickLibraryActive() ? window.parent.location : window.location;\n}\n","import { getLocation } from 'Helpers/sidekick/getLocation';\nimport { loadCSS } from './loadCSS';\nimport { config } from '../../../config';\n\nexport async function loadFonts(): Promise {\n const { fontsCssPath } = config;\n if (!fontsCssPath) return;\n await loadCSS(fontsCssPath);\n try {\n if (!getLocation().hostname.includes('localhost')) sessionStorage.setItem('fonts-loaded', 'true');\n } catch (e) {\n console.error('Error setting fonts-loaded in session storage', e);\n // do nothing\n }\n}\n","/**\n * log RUM if part of the sample.\n * @param {string} checkpoint identifies the checkpoint in funnel\n * @param {Object} data additional data for RUM sample\n * @param {string} data.source DOM node that is the source of a checkpoint event,\n * identified by #id or .classname\n * @param {string} data.target subject of the checkpoint event,\n * for instance the href of a link, or a search term\n */\n\nexport function sampleRUM(checkpoint, data = {}) {\n // @ts-ignore\n sampleRUM.defer = sampleRUM.defer || [];\n const defer = (fnname) => {\n // @ts-ignore\n sampleRUM[fnname] = sampleRUM[fnname] || ((...args) => sampleRUM.defer.push({ fnname, args }));\n };\n // @ts-ignore\n sampleRUM.drain =\n // @ts-ignore\n sampleRUM.drain ||\n ((dfnname, fn) => {\n sampleRUM[dfnname] = fn;\n // @ts-ignore\n sampleRUM.defer\n .filter(({ fnname }) => dfnname === fnname)\n .forEach(({ fnname, args }) => sampleRUM[fnname](...args));\n });\n // @ts-ignore\n sampleRUM.always = sampleRUM.always || [];\n // @ts-ignore\n sampleRUM.always.on = (chkpnt, fn) => {\n // @ts-ignore\n sampleRUM.always[chkpnt] = fn;\n };\n // @ts-ignore\n sampleRUM.on = (chkpnt, fn) => {\n // @ts-ignore\n sampleRUM.cases[chkpnt] = fn;\n };\n defer('observe');\n defer('cwv');\n try {\n window.hlx = window.hlx || {};\n // @ts-ignore\n if (!window.hlx.rum) {\n const usp = new URLSearchParams(window.location.search);\n const weight = usp.get('rum') === 'on' ? 1 : 100; // with parameter, weight is 1. Defaults to 100.\n const id = Array.from({ length: 75 }, (_, i) => String.fromCharCode(48 + i))\n .filter((a) => /\\d|[A-Z]/i.test(a))\n .filter(() => Math.random() * 75 > 70)\n .join('');\n const random = Math.random();\n const isSelected = random * weight < 1;\n const firstReadTime = Date.now();\n const urlSanitizers = {\n full: () => window.location.href,\n origin: () => window.location.origin,\n path: () => window.location.href.replace(/\\?.*$/, ''),\n };\n // @ts-ignore\n window.hlx.rum = {\n weight,\n id,\n random,\n isSelected,\n firstReadTime,\n sampleRUM,\n sanitizeURL: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'],\n };\n }\n // @ts-ignore\n const { weight, id, firstReadTime } = window.hlx.rum;\n // @ts-ignore\n if (window.hlx && window.hlx.rum && window.hlx.rum.isSelected) {\n const knownProperties = [\n 'weight',\n 'id',\n 'referer',\n 'checkpoint',\n 't',\n 'source',\n 'target',\n 'cwv',\n 'CLS',\n 'FID',\n 'LCP',\n 'INP',\n ];\n const sendPing = (pdata = data) => {\n const body = JSON.stringify(\n {\n weight,\n id,\n // @ts-ignore\n referer: window.hlx.rum.sanitizeURL(),\n checkpoint,\n t: Date.now() - firstReadTime,\n ...data,\n },\n knownProperties\n );\n const url = `https://rum.hlx.page/.rum/${weight}`;\n navigator.sendBeacon(url, body);\n // eslint-disable-next-line no-console\n console.debug(`ping:${checkpoint}`, pdata);\n };\n // @ts-ignore\n sampleRUM.cases = sampleRUM.cases || {\n // @ts-ignore\n cwv: () => sampleRUM.cwv(data) || true,\n lazy: () => {\n // use classic script to avoid CORS issues\n const script = document.createElement('script');\n script.src = 'https://rum.hlx.page/.rum/@adobe/helix-rum-enhancer@^1/src/index.js';\n document.head.appendChild(script);\n return true;\n },\n };\n sendPing(data);\n // @ts-ignore\n if (sampleRUM.cases[checkpoint]) {\n // @ts-ignore\n sampleRUM.cases[checkpoint]();\n }\n }\n // @ts-ignore\n if (sampleRUM.always[checkpoint]) {\n // @ts-ignore\n sampleRUM.always[checkpoint](data);\n }\n } catch (error) {\n // something went wrong\n }\n}\n","export default function setupHlxObj(mainScriptPath: string = '/dist/main/main.js') {\n window.hlx = window.hlx || {};\n window.hlx.RUM_MASK_URL = 'full';\n window.hlx.codeBasePath = '';\n window.hlx.lighthouse = new URLSearchParams(window.location.search).get('lighthouse') === 'on';\n\n const scriptEl = document.querySelector(`script[src$=\"${mainScriptPath}\"]`) as HTMLScriptElement;\n if (scriptEl) {\n try {\n [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split(mainScriptPath);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log('setupHlxObj', error);\n }\n }\n}\n","import { sampleRUM } from './sampleRUM';\nimport setupHlxObj from './setupHlxObj';\n\nexport function initSampleRUM() {\n setupHlxObj();\n sampleRUM('top');\n\n window.addEventListener('load', () => sampleRUM('load'));\n\n window.addEventListener('unhandledrejection', (event) => {\n sampleRUM('error', { source: event.reason.sourceURL, target: event.reason.line });\n });\n\n window.addEventListener('error', (event) => {\n sampleRUM('error', { source: event.filename, target: event.lineno });\n });\n}\n","import { BlockMapping } from '../app.types';\nimport { collectBlocks } from './collectBlocks';\nimport { loadBlockModules } from './loadBlockModules';\nimport { loadBlockStyles } from './loadBlockStyles';\nimport { showSection } from './showSection';\n\n/**\n * Load the block modules and styles for a section and show the section.\n * @param section - The section to load the block modules and styles for.\n * @returns Promise\n */\nexport async function loadBlock(section: HTMLElement) {\n const sectionsBlocks: BlockMapping[] = collectBlocks(section);\n\n if (!sectionsBlocks.length) {\n showSection(section);\n return;\n }\n\n for (const block of sectionsBlocks) {\n Promise.all([loadBlockModules(block), loadBlockStyles(block)]);\n }\n\n showSection(section);\n}\n","import { loadBlock } from './loadBlock';\n\n/**\n * Loads Blocks\n * by getting all sections and load every block in every section\n * and shows every section that is finished loading.\n */\nexport async function loadBlocks() {\n const sections = [...document.querySelectorAll('.section')];\n const SectionsPromises = sections.map((section) => loadBlock(section));\n\n await Promise.all(SectionsPromises);\n}\n","/*\n * This function is used to decorate images in the default content.\n * It adds the class 'image' and 'main' to the parent element of the image.\n */\nexport function decorateImages() {\n const picture = document.querySelectorAll('.default-content-wrapper picture');\n picture.forEach((item) => {\n const parentElement = item.parentElement;\n if (parentElement) {\n parentElement.classList.add('image', 'main');\n }\n });\n}\n","import { decorateImages } from './decorateImages';\n\n/**\n * This function is used to adjust the markup of a section.\n * It wraps the default content in a div with the class 'default-content-wrapper'.\n * It also adds the class 'section' to the section element.\n * It decorates the images in the default content by calling the 'decorateImages' function.\n * It sets the 'data-section-status' attribute to 'initialized'.\n * It hides the section element.\n * @param section - The section element to adjust.\n */\nexport function adjustMarkup(section: HTMLDivElement) {\n const wrappers: HTMLDivElement[] = [];\n let defaultContent = false;\n [...section.children].forEach((e) => {\n if (e.tagName === 'DIV' || !defaultContent) {\n const wrapper = document.createElement('div');\n wrappers.push(wrapper);\n defaultContent = e.tagName !== 'DIV';\n\n if (defaultContent) {\n wrapper.classList.add('default-content-wrapper');\n }\n }\n wrappers[wrappers.length - 1].append(e);\n });\n wrappers.forEach((wrapper) => section.append(wrapper));\n decorateImages();\n section.classList.add('section');\n section.dataset.sectionStatus = 'initialized';\n section.style.display = 'none';\n}\n","import { toClassName } from './toClassName';\n\n/**\n * Sanitizes a string for use as a JavaScript property name.\n *\n * @param {string} name - The unsanitized string.\n * @returns {string} - The camelCased name.\n *\n * @example\n * // Example usage:\n * const unsanitizedString = 'background-color';\n * const camelCasedName = toCamelCase(unsanitizedString);\n * console.log(camelCasedName); // Output: 'backgroundColor'\n */\nexport function toCamelCase(name: string): string {\n if (/^[a-z][A-Za-z0-9]*$/.test(name)) {\n return name;\n }\n\n if (/^[A-Z][A-Za-z0-9]*$/.test(name)) {\n return name.charAt(0).toLowerCase() + name.slice(1);\n }\n\n return toClassName(name).replace(/-([a-z])/g, (g: string) => g[1].toUpperCase());\n}\n","import { toClassName } from 'Utils/toClassName';\n\n/*\n This function reads the configuration of a block from the HTML file\n and returns it as a Record object.\n @param {Element} block The block element\n*/\nexport function readBlockConfig(block: Element): Record {\n const config: Record = {};\n block.querySelectorAll(':scope > div').forEach((row) => {\n if (row.children) {\n const cols = [...row.children];\n if (cols[1]) {\n const col = cols[1];\n const name = toClassName(cols[0].textContent ?? '');\n let value: any = '';\n if (col.querySelector('a')) {\n const as = [...col.querySelectorAll('a')];\n if (as.length === 1) {\n value = as[0].href;\n } else {\n value = as.map((a) => a.href);\n }\n } else if (col.querySelector('img')) {\n const imgs = [...col.querySelectorAll('img')];\n if (imgs.length === 1) {\n value = imgs[0].src;\n } else {\n value = imgs.map((img) => img.src);\n }\n } else if (col.querySelector('p')) {\n const ps = [...col.querySelectorAll('p')];\n if (ps.length === 1) {\n value = ps[0].textContent;\n } else {\n value = ps.map((p) => p.textContent);\n }\n } else value = row.children[1].textContent;\n config[name] = value;\n }\n }\n });\n return config;\n}\n","import { toCamelCase } from 'Utils/toCamelCase';\nimport { toClassName } from 'Utils/toClassName';\nimport { readBlockConfig } from './readBlockConfig';\n\n/*\n This function processes the metadata of a section and applies it to the section element.\n @param {HTMLElement} section The section element\n*/\nexport function processSectionMetaData(section: HTMLElement) {\n const sectionMeta = section.querySelector('div.section-metadata');\n if (sectionMeta) {\n const meta = readBlockConfig(sectionMeta);\n Object.keys(meta).forEach((key) => {\n if (key === 'style') {\n const styles = meta.style\n .split(',')\n .filter((style: string) => style)\n .map((style: string) => toClassName(style.trim()));\n styles.forEach((style: string) => section.classList.add(style));\n } else {\n section.dataset[toCamelCase(key)] = meta[key];\n }\n });\n if (sectionMeta.parentElement) sectionMeta.parentElement.remove();\n }\n}\n","import { adjustMarkup } from './adjustMarkup';\nimport { processSectionMetaData } from './processSectionMetaData';\n\n/**\n * This function is used to transform the sections of the main element.\n * It adjusts the markup of each section by calling the 'adjustMarkup' function.\n * It processes the metadata of each section by calling the 'processSectionMetaData' function.\n * @param main - The main element to transform.\n */\nexport function transformSection(main: HTMLElement) {\n main.querySelectorAll(':scope > div').forEach((section) => {\n adjustMarkup(section);\n processSectionMetaData(section);\n });\n}\n","/**\n * Decorate blocks with classes and data attributes.\n * @param main - Html main element\n */\nexport function decorateBlocks(main: HTMLElement) {\n main.querySelectorAll('div.section > div > div').forEach((block) => {\n const shortBlockName = block.classList[0];\n if (shortBlockName) {\n block.classList.add('block');\n block.dataset.blockName = shortBlockName;\n const blockWrapper = block.parentElement;\n blockWrapper?.classList.add(`${shortBlockName}-wrapper`);\n const section = block.closest('.section');\n if (section) section.classList.add(`${shortBlockName}-container`);\n }\n });\n}\n","import { decorateTemplateAndTheme } from './tasks/decorateTemplateAndTheme';\nimport { decorateButtons } from './tasks/decorateButtons';\nimport { setDocLanguage } from './tasks/setDocLanguage';\nimport { waitForLCP } from './tasks/waitForLCP';\nimport { loadFonts } from './tasks/loadFonts';\nimport { initSampleRUM } from './tasks/initSampleRUM';\nimport { DebuggerService } from '@kluntje/services';\nimport { loadCSS } from './tasks/loadCSS';\nimport { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive';\nimport { config } from '../../config';\nimport { loadBlocks } from './tasks/loadBlocks';\nimport { transformSection } from './tasks/transformSections';\nimport { decorateBlocks } from './tasks/decorateBlocks';\nimport { sampleRUM } from './tasks/sampleRUM';\n\nclass HLX {\n private beforeEagerCallbacks: Array<() => Promise> = [];\n private loadEagerCallbacks: Array<() => Promise> = [];\n private beforeLoadLazyCallbacks: Array<() => Promise> = [];\n private loadLazyCallbacks: Array<() => Promise> = [];\n private beforeLoadDelayedCallbacks: Array<() => Promise> = [];\n private loadDelayedCallbacks: Array<() => Promise> = [];\n private initializedCallbacks: Array<() => Promise> = [];\n\n private beforeEagerPromise?: Promise;\n private eagerPromise?: Promise;\n private beforeLazyPromise?: Promise;\n private lazyPromise?: Promise;\n private beforeDelayedPromise?: Promise;\n private delayedPromise?: Promise;\n private initializedPromise?: Promise;\n\n private get beforeEager() {\n if (this.beforeEagerPromise === undefined) {\n this.beforeEagerPromise = this.beforeLoadEager();\n }\n return this.beforeEagerPromise;\n }\n\n private get loadEager() {\n if (this.eagerPromise === undefined) {\n this.eagerPromise = this.loadEagerPromise();\n }\n return this.eagerPromise;\n }\n\n private get beforeLoadLazy() {\n if (this.beforeLazyPromise === undefined) {\n this.beforeLazyPromise = this.beforeLoadLazyPromise();\n }\n return this.beforeLazyPromise;\n }\n\n private get loadLazy() {\n if (this.lazyPromise === undefined) {\n this.lazyPromise = this.loadLazyPromise();\n }\n return this.lazyPromise;\n }\n\n private get beforeLoadDelayed() {\n if (this.beforeDelayedPromise === undefined) {\n this.beforeDelayedPromise = this.beforeLoadDelayedPromise();\n }\n return this.beforeDelayedPromise;\n }\n\n private get loadDelayed() {\n if (this.delayedPromise === undefined) {\n this.delayedPromise = this.loadDelayedPromise();\n }\n return this.delayedPromise;\n }\n\n private get initialized() {\n if (this.initializedPromise === undefined) {\n this.initializedPromise = this.getInitializedPromise();\n }\n return this.initializedPromise;\n }\n\n public addBeforeEagerTask(cb: () => Promise) {\n this.beforeEagerCallbacks.push(cb);\n }\n\n public addLoadEagerTask(cb: () => Promise) {\n this.loadEagerCallbacks.push(cb);\n }\n\n public addBeforeLoadLazyTask(cb: () => Promise) {\n this.beforeLoadLazyCallbacks.push(cb);\n }\n\n public addLoadLazyTask(cb: () => Promise) {\n this.loadLazyCallbacks.push(cb);\n }\n\n public addBeforeLoadDelayedTask(cb: () => Promise) {\n this.beforeLoadDelayedCallbacks.push(cb);\n }\n\n public addLoadDelayedTask(cb: () => Promise) {\n this.loadDelayedCallbacks.push(cb);\n }\n\n public addInitializedTask(cb: () => Promise) {\n this.initializedCallbacks.push(cb);\n }\n\n public async init() {\n await this.beforeEager;\n await this.loadEager;\n await this.beforeLoadLazy;\n await this.loadLazy;\n await this.beforeLoadDelayed;\n await this.loadDelayed;\n await this.initialized;\n }\n\n private async beforeLoadEager(): Promise {\n const beforeLoadEagerTask: Promise = new Promise((resolve) => {\n initSampleRUM();\n decorateTemplateAndTheme();\n setDocLanguage();\n resolve();\n });\n\n await Promise.all([...this.beforeEagerCallbacks.map((cb) => cb()), beforeLoadEagerTask]);\n }\n\n private async loadEagerPromise(): Promise {\n const loadEagerTask: Promise = new Promise(async (resolve) => {\n const main = document.querySelector('main') as HTMLElement;\n decorateButtons(main);\n transformSection(main);\n decorateBlocks(main);\n setTimeout(() => {\n document.body.classList.add('show');\n resolve();\n }, 100);\n\n await waitForLCP();\n\n try {\n /* if desktop (proxy for fast connection) or fonts already loaded, load fonts.css */\n if (window.innerWidth >= 900 || sessionStorage.getItem('fonts-loaded')) {\n await loadFonts();\n }\n } catch (e) {\n // do nothing\n }\n });\n\n await Promise.all([...this.loadEagerCallbacks.map((cb) => cb()), loadEagerTask]);\n }\n\n private async beforeLoadLazyPromise(): Promise {\n const beforeLoadLazyTask: Promise = new Promise((resolve) => resolve());\n\n await Promise.all([...this.beforeLoadLazyCallbacks.map((cb) => cb()), beforeLoadLazyTask]);\n }\n\n private async loadLazyPromise(): Promise {\n const loadLazyTask: Promise = new Promise(async (resolve) => {\n try {\n const {\n lazyStylesScssPath,\n sidekickLibraryStylesScssPath,\n fontsScssPath,\n lazyStylesCssPath,\n sidekickLibraryStylesCssPath,\n } = config;\n\n await loadBlocks();\n\n const { hash } = window.location;\n const element = hash ? document.getElementById(hash.substring(1)) : false;\n if (hash && element) element.scrollIntoView();\n\n if (lazyStylesScssPath && lazyStylesCssPath) await loadCSS(lazyStylesCssPath);\n if (sidekickLibraryStylesScssPath && sidekickLibraryStylesCssPath && isSidekickLibraryActive()) {\n await loadCSS(sidekickLibraryStylesCssPath);\n }\n if (fontsScssPath) await loadFonts();\n sampleRUM('lazy');\n const main = document.querySelector('main') as HTMLElement;\n // @ts-ignore\n sampleRUM.observe(main.querySelectorAll('div[data-block-name]'));\n // @ts-ignore\n sampleRUM.observe(main.querySelectorAll('picture > img'));\n } catch (error) {\n DebuggerService.error('Load lazy Task: ', error);\n }\n resolve();\n });\n\n await Promise.all([...this.loadLazyCallbacks.map((cb) => cb()), loadLazyTask]);\n }\n\n private async beforeLoadDelayedPromise(): Promise {\n const beforeLoadDelayedTask: Promise = new Promise((resolve) => resolve());\n\n await Promise.all([...this.beforeLoadDelayedCallbacks.map((cb) => cb()), beforeLoadDelayedTask]);\n }\n\n private async loadDelayedPromise(): Promise {\n const loadDelayedTask: Promise = new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, 3000);\n });\n\n await Promise.all([...this.loadDelayedCallbacks.map((cb) => cb()), loadDelayedTask]);\n }\n\n private async getInitializedPromise(): Promise {\n const initializedTask: Promise = new Promise((resolve) => resolve());\n\n await Promise.all([...this.initializedCallbacks.map((cb) => cb()), initializedTask]);\n }\n}\n\nexport default new HLX();\n","import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:t}=o,i=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,n={HTML:1,SVG:2},e=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,l=o=>null!=o?._$litType$?.h,c=o=>void 0!==o?._$litDirective$,d=o=>o?._$litDirective$,f=o=>void 0===o.strings,s=()=>document.createComment(\"\"),r=(o,i,n)=>{const e=o._$AA.parentNode,l=void 0===i?o._$AB:i._$AA;if(void 0===n){const i=e.insertBefore(s(),l),c=e.insertBefore(s(),l);n=new t(i,c,o,o.options)}else{const t=n._$AB.nextSibling,i=n._$AM,c=i!==o;if(c){let t;n._$AQ?.(o),n._$AM=o,void 0!==n._$AP&&(t=o._$AU)!==i._$AU&&n._$AP(t)}if(t!==l||c){let o=n._$AA;for(;o!==t;){const t=o.nextSibling;e.insertBefore(o,l),o=t}}}return n},v=(o,t,i=o)=>(o._$AI(t,i),o),u={},m=(o,t=u)=>o._$AH=t,p=o=>o._$AH,h=o=>{o._$AP?.(!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},j=o=>{o._$AR()};export{n as TemplateResultType,j as clearPart,p as getCommittedValue,d as getDirectiveClass,r as insertPart,l as isCompiledTemplateResult,c as isDirectiveResult,i as isPrimitive,f as isSingleExpression,e as isTemplateResult,h as removePart,v as setChildPartValue,m as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{isSingleExpression as i}from\"./directive-helpers.js\";import{Directive as t,PartType as e}from\"./directive.js\";export{Directive,PartType,directive}from\"./directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=(i,t)=>{const e=i._$AN;if(void 0===e)return!1;for(const i of e)i._$AO?.(t,!1),s(i,t);return!0},o=i=>{let t,e;do{if(void 0===(t=i._$AM))break;e=t._$AN,e.delete(i),i=t}while(0===e?.size)},r=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(void 0===e)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),c(t)}};function h(i){void 0!==this._$AN?(o(this),this._$AM=i,r(this)):this._$AM=i}function n(i,t=!1,e=0){const r=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(t)if(Array.isArray(r))for(let i=e;i{i.type==e.CHILD&&(i._$AP??=n,i._$AQ??=h)};class f extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,e){super._$AT(i,t,e),r(this),this.isConnected=i._$AU}_$AO(i,t=!0){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(s(this,i),o(this))}setValue(t){if(i(this._$Ct))this._$Ct._$AI(t,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}export{f as AsyncDirective};\n//# sourceMappingURL=async-directive.js.map\n","import{nothing as t}from\"../lit-html.js\";import{AsyncDirective as i}from\"../async-directive.js\";import{directive as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const e=()=>new h;class h{}const o=new WeakMap,n=s(class extends i{render(i){return t}update(i,[s]){const e=s!==this.Y;return e&&void 0!==this.Y&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=s,this.ht=i.options?.host,this.rt(this.ct=i.element)),t}rt(t){if(\"function\"==typeof this.Y){const i=this.ht??globalThis;let s=o.get(i);void 0===s&&(s=new WeakMap,o.set(i,s)),void 0!==s.get(this.Y)&&this.Y.call(this.ht,void 0),s.set(this.Y,t),void 0!==t&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){return\"function\"==typeof this.Y?o.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});export{e as createRef,n as ref};\n//# sourceMappingURL=ref.js.map\n","import { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport FetchService from 'Services/fetch.service.ts';\nimport { renderIcon } from '../icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { SiteMapEntry } from 'Types/siteMap.types.ts';\nimport { SheetsResponse } from 'Types/sheetResponse.types.ts';\n\ninterface SubMenuItem {\n path: string;\n navtitle: string;\n}\n\ninterface MenuItem {\n path: string;\n error?: string;\n navtitle: string;\n children?: SubMenuItem[];\n}\n\n@customElement('sidebar-nav')\nexport class SidebarNav extends LitElement {\n @state()\n items: MenuItem[];\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n async firstUpdated() {\n this.items = await this.groupByFirstLevelPath();\n }\n\n async getPlaceholder(key: string): Promise {\n const placeholder = await PlaceholderService.getPlaceHolder(key);\n return placeholder;\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.items) return;\n\n return html` `;\n }\n\n private toggleSubmenu({ currentTarget }: Event) {\n if (!(currentTarget instanceof HTMLElement) || !currentTarget.classList.contains('opener')) return;\n currentTarget.classList.toggle('active');\n }\n\n private renderSubMenu(item) {\n return html`\n ${item.navtitle} \n ${renderIcon('chevron-down', 'submenu__icon')}\n \n `;\n }\n\n private renderMenuItem(item: MenuItem) {\n if (item.error) {\n return html`

    ${item.error}

    `;\n } else {\n return html`
  • \n ${item.children !== undefined ? this.renderSubMenu(item) : html`${item.navtitle}`}\n
  • `;\n }\n }\n\n private renderMenuItems() {\n return html`
      \n ${this.items.map((item: MenuItem) => this.renderMenuItem(item))}\n
    `;\n }\n\n private getSubmenuName = (entry: MenuItem) => {\n return entry.path.split('/')[1];\n };\n\n private getNavTitle(item: MenuItem | SiteMapEntry) {\n if (item.path === '/') return 'Homepage';\n return item['navtitle'] || item['title'];\n }\n\n private filterNavigation(queryIndex: SiteMapEntry[], filterValues: string[]): MenuItem[] {\n return queryIndex\n .filter((item) => filterValues.every((term) => !item.path.includes(term)))\n .map((item) => ({\n path: item.path,\n navtitle: this.getNavTitle(item),\n }));\n }\n\n private groupItemsByFirstLevelPath(siteMapEntries: MenuItem[]): Record {\n const groups = {};\n siteMapEntries.forEach((item) => {\n const firstLevelPath = this.getSubmenuName(item); // Extracting the first level of the path\n if (!groups[firstLevelPath]) {\n groups[firstLevelPath] = [];\n }\n groups[firstLevelPath].push({\n path: item.path,\n navtitle: this.getNavTitle(item),\n });\n });\n return groups;\n }\n\n private async groupByFirstLevelPath() {\n const endpoint = '/query-index.json';\n const filterValues: string[] = ['sidekick', 'sidekick-library', 'tools', 'development', 'dev-', '__'];\n\n try {\n const queryIndex = await FetchService.fetchJson>(endpoint);\n\n this.error = null;\n\n const filteredNavigation = this.filterNavigation(queryIndex.data, filterValues);\n const groupItems = this.groupItemsByFirstLevelPath(filteredNavigation);\n const groupedData = Object.values(groupItems);\n\n return groupedData.map((group: MenuItem[]) => {\n if (group.length === 1) {\n return group[0];\n }\n\n return {\n navtitle: group[0].path.split('/')[1],\n path: group[0].path,\n children: group,\n };\n });\n } catch (error) {\n DebuggerService.error(`SidebarNav Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n return [];\n }\n }\n}\n","import { html, LitElement, nothing } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { renderIcon } from '../icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from '../../services/placeholder.service.ts';\nimport { IconName } from 'Types/icons.types.ts';\n\ninterface SidebarContactTemplateArgs {\n headline: HTMLElement | null;\n text: HTMLElement | null;\n contacts: Contact[];\n}\n\ninterface Contact {\n icon: HTMLElement | null;\n markup: HTMLElement | null;\n}\n\n@customElement('sidebar-contact')\nexport class SidebarContact extends LitElement {\n @state()\n contactTemplateArgs: SidebarContactTemplateArgs;\n\n @state()\n error: string | null = null;\n\n async connectedCallback() {\n super.connectedCallback();\n const contactHtml = await this.fetchContactsHtml();\n if (contactHtml !== null) this.getContactTemplateArgs(contactHtml);\n }\n\n async fetchContactsHtml() {\n const parser = new DOMParser();\n const endpoint = 'contact.plain.html';\n\n try {\n const contactHtmlString = await FetchService.fetchText(endpoint, {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.error = null;\n return parser.parseFromString(contactHtmlString, 'text/html');\n } catch (error) {\n DebuggerService.error(`SidebarContacts Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n\n return null;\n }\n }\n\n renderHeader(headline: HTMLElement | null) {\n if (!headline) return nothing;\n return html`
    \n

    ${headline}

    \n
    `;\n }\n\n renderText(text: HTMLElement | null) {\n if (!text) return nothing;\n return html`

    ${text}

    `;\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n\n if (!this.contactTemplateArgs) return nothing;\n\n const { headline, text, contacts } = this.contactTemplateArgs;\n\n return html`\n
    ${this.renderHeader(headline)} ${this.renderText(text)} ${this.renderContacts(contacts)}
    \n `;\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n private renderContact(contact: Contact) {\n const { icon, markup } = contact;\n if (!icon && !markup) return nothing;\n\n return html`
  • ${this.renderIcon(icon)} ${this.renderContactMarkup(markup)}
  • `;\n }\n\n private getContactsArgs(contactHtml: Document): Contact[] {\n const contactsElement = contactHtml.querySelectorAll('.contact > div:not(:first-child)');\n const contactsArray = Array.from(contactsElement);\n\n return contactsArray.map((contactElement) => {\n return {\n icon: contactElement.querySelector('div'),\n markup: contactElement.querySelector('div:last-child'),\n };\n });\n }\n\n private getContactTemplateArgs(contactHtml: Document) {\n const headline = contactHtml.querySelector('h2');\n const text = contactHtml.querySelector('p');\n const contacts = this.getContactsArgs(contactHtml);\n\n this.contactTemplateArgs = {\n headline,\n text,\n contacts,\n };\n }\n\n private renderContacts(contacts: Contact[]) {\n if (contacts.length === 0) return nothing;\n return html`
      \n ${contacts.map((contact) => this.renderContact(contact))}\n
    `;\n }\n\n private renderIcon(icon: HTMLElement | null) {\n if (!icon) return nothing;\n return renderIcon(icon.innerHTML as IconName);\n }\n\n private renderContactMarkup(markup: HTMLElement | null) {\n if (!markup) return nothing;\n return unsafeHTML(markup.innerHTML);\n }\n}\n","import { html, LitElement, nothing } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { createOptimizedPicture } from 'Utils/createOptimizedPicture.ts';\nimport FetchService from 'Services/fetch.service.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { Sitemap, SiteMapEntry } from 'Types/siteMap.types.ts';\nimport { SheetsResponse } from 'Types/sheetResponse.types.ts';\n\n@customElement('sidebar-posts')\nexport class SidebarPosts extends LitElement {\n @state()\n private lastTreePosts: Sitemap;\n\n @state()\n error: string | null = null;\n\n @state()\n private noPostsPlaceholder: string;\n\n async connectedCallback() {\n super.connectedCallback();\n const posts = await this.getPosts();\n this.lastTreePosts = this.getLastThreePosts(posts);\n this.noPostsPlaceholder = await PlaceholderService.getPlaceHolder('no posts');\n }\n\n render() {\n if (!this.lastTreePosts) return;\n\n return html` ${this.renderHeader()} ${this.renderPosts()} `;\n\n //TODO: Add overview if more button is needed\n /*\n \n */\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n private getLastThreePosts(posts: Sitemap) {\n posts.sort((sitemapEntry: SiteMapEntry, nextSitemapEntry: SiteMapEntry) => {\n if (sitemapEntry.lastModified > nextSitemapEntry.lastModified) {\n return -1;\n } else if (sitemapEntry.lastModified < nextSitemapEntry.lastModified) {\n return 1;\n }\n\n return 0;\n });\n\n return posts.slice(0, 3);\n }\n\n private renderPicture(siteMapEntry: SiteMapEntry) {\n const picture = createOptimizedPicture({\n src: siteMapEntry.image,\n alt: siteMapEntry.imagealt,\n width: 336,\n height: 224,\n });\n if (!picture) return nothing;\n return html`${picture}`;\n }\n\n private renderPost(siteMapEntry: SiteMapEntry) {\n return html`
    \n ${this.renderPicture(siteMapEntry)}\n

    ${siteMapEntry.description}

    \n
    `;\n }\n\n private async getPosts() {\n const endpoint = '/query-index.json';\n\n try {\n this.error = null;\n const queryIndex = await FetchService.fetchJson>(endpoint);\n return queryIndex.data.filter((item) => item.path.startsWith('/posts'));\n } catch (error) {\n DebuggerService.error(`SidebarPost Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n return [];\n }\n }\n\n private renderPosts() {\n if (this.error) return html`
    ${this.error}
    `;\n if (this.lastTreePosts.length === 0) return html`
    ${this.noPostsPlaceholder}
    `;\n\n return html`
    \n ${this.lastTreePosts.map((siteMapEntry) => this.renderPost(siteMapEntry))}\n
    `;\n }\n\n private renderHeader() {\n return html`
    \n

    Newest Posts

    \n
    `;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport FetchService from '../../services/fetch.service.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from '../../services/placeholder.service.ts';\n\n@customElement('sidebar-footer')\nexport class SidebarFooter extends LitElement {\n @state()\n footerMarkup: HTMLParagraphElement | null;\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.fetchFooterData();\n }\n\n async fetchFooterData() {\n const endpoint = 'footer.plain.html';\n\n try {\n const response = await FetchService.fetchText(endpoint, {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.error = null;\n const responseMarkup = document.createElement('div');\n responseMarkup.innerHTML = response;\n this.footerMarkup = responseMarkup.querySelector('p');\n if (this.footerMarkup) this.footerMarkup.classList.add('copyright');\n } catch (error) {\n DebuggerService.error(`SidebarFooter Component: Error while fetching ${endpoint}`, error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n }\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.footerMarkup) return;\n return html`${this.footerMarkup}`;\n }\n}\n","/**\n * @module SidebarComponent\n * @copyright diva-e (https://diva-e.com)\n */\n\nimport { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { createRef, Ref, ref } from 'lit/directives/ref.js';\n\nimport './sidebarNav.ts';\nimport './sidebarContact.ts';\nimport './sidebarPosts.ts';\nimport './sidebarFooter.ts';\n\nimport { renderIcon } from '../icon/icon.template.ts';\n\n@customElement('sidebar-component')\nexport class SidebarComponent extends LitElement {\n toggleRef: Ref = createRef();\n createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n firstUpdated(): void {\n this.toggleRef.value!.addEventListener('click', this.handleToggleClick);\n this.classList.add('activate-animations');\n }\n\n handleToggleClick = (e: Event) => {\n e.preventDefault();\n this.classList.toggle('active');\n };\n\n render() {\n return html`\n
    \n \n \n \n \n
    \n \n ${renderIcon('hamburger')}\n \n `;\n }\n}\n","import HLX from '../../app/index.ts';\nimport './sidebar.ts';\nimport { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive.ts';\n\nconst addSidebarContainer = () => {\n if (isSidekickLibraryActive()) return;\n\n const sidebarContainer = document.createElement('sidebar-component');\n sidebarContainer.setAttribute('id', 'sidebar');\n window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active');\n window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active');\n const main = document.getElementById('main');\n main?.after(sidebarContainer);\n};\n\nHLX.addLoadEagerTask(() => {\n addSidebarContainer();\n return Promise.resolve();\n});\n","import { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive';\n\nexport function addInnerContainer() {\n const main = document.getElementById('main');\n if (!main) return;\n const children = main.innerHTML;\n main.innerHTML = `
    ${isSidekickLibraryActive() ? `` : ``}${children}
    `;\n}\n","import HLX from '../../app/index.ts';\nimport { addInnerContainer } from './innerContainer.ts';\n\nHLX.addLoadEagerTask(() => {\n addInnerContainer();\n return Promise.resolve();\n});\n","/**\n * Represents the structure of an object used to specify replacements in a string.\n *\n * @interface ReplaceBySpecifier\n * @property {string} input - The input string where replacements will be made.\n * @property {string} specifier - The specifier string to search for in the input.\n * @property {string} htmlTag - The HTML tag to wrap around the parts matched by the specifier.\n */\ninterface ReplaceBySpecifier {\n input: string;\n specifier: string;\n htmlTag: string;\n}\n\n/**\n * Replaces occurrences of a specified specifier in a string with an HTML tag.\n *\n * @param {ReplaceBySpecifier} param - An object containing input string, specifier, and HTML tag.\n * @param {string} param.input - The input string where replacements will be made.\n * @param {string} param.specifier - The specifier string to search for in the input.\n * @param {string} param.htmlTag - The HTML tag to wrap around the parts matched by the specifier.\n * @returns {string} - The modified string with replacements.\n *\n @example\n * // Example 1:\n * const result1 = replaceBySpecifier({\n * input: 'This is a test string with some test keywords.',\n * specifier: 'test',\n * htmlTag: 'strong'\n * });\n * console.log(result1);\n * // Output: 'This is a string with some keywords.'\n *\n * // Example 2:\n * const result2 = replaceBySpecifier({\n * input: 'Hello, world!',\n * specifier: ',',\n * htmlTag: 'span'\n * });\n * console.log(result2);\n * // Output: 'Hello world!'\n */\nexport function replaceBySpecifier({ input, specifier, htmlTag }: ReplaceBySpecifier): string {\n if (specifier === '' || htmlTag === '') return input;\n return input\n .split(specifier)\n .map((part: string, index: number): string => (index % 2 === 1 ? `<${htmlTag}>${part}` : part))\n .join('');\n}\n","import { html, LitElement, PropertyValueMap } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { replaceBySpecifier } from 'Utils/replaceBySpecifier.ts';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\nimport FetchService from 'Services/fetch.service.ts';\nimport { renderIcon } from './icon/icon.template.ts';\nimport { DebuggerService } from '@kluntje/services';\nimport PlaceholderService from 'Services/placeholder.service.ts';\nimport { IconName } from 'Types/icons.types.ts';\n\nexport interface HeaderResponseData {\n leftCol: LeftCol;\n rightCol: RightCol;\n}\n\nexport interface LeftCol {\n data: LeftColData[];\n}\n\nexport interface LeftColData {\n logoText: string;\n logoLink: string;\n}\n\nexport interface RightCol {\n data: RightColData[];\n}\n\nexport interface RightColData {\n socialIcon: IconName;\n socialLabel: string;\n socialLink: string;\n}\n\ninterface HeaderTemplateData {\n leftCol: LeftColData;\n rightCol: RightColData[];\n}\n\n@customElement('header-component')\nexport class HeaderComponent extends LitElement {\n @state()\n headerData: HeaderTemplateData;\n\n @state()\n error: string | null = null;\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n protected async firstUpdated(_changedProperties: PropertyValueMap | Map) {\n await this.fetchHeaderData();\n }\n\n async fetchHeaderData() {\n try {\n const response = await FetchService.fetchJson('header.json', {\n cacheOptions: { cacheType: 'runtime' },\n });\n this.headerData = { leftCol: response.leftCol.data[0], rightCol: response.rightCol.data };\n this.error = null;\n } catch (error) {\n DebuggerService.error('Header Component: Error while fetching header.json', error);\n this.error = await PlaceholderService.getPlaceHolder('error');\n }\n }\n\n render() {\n if (this.error) {\n return html`
    ${this.error}
    `;\n }\n if (!this.headerData) return;\n const { leftCol, rightCol } = this.headerData;\n const logoText = replaceBySpecifier({ input: leftCol.logoText, htmlTag: 'strong', specifier: ':::' });\n const logoTextHTML = unsafeHTML(logoText);\n return html`\n ${logoTextHTML}\n \n `;\n }\n}\n","import{directive as s}from\"../directive.js\";import{UnsafeHTMLDirective as e}from\"./unsafe-html.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */class t extends e{}t.directiveName=\"unsafeSVG\",t.resultType=2;const o=s(t);export{o as unsafeSVG};\n//# sourceMappingURL=unsafe-svg.js.map\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class i{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){this.Z??=new Promise((t=>this.q=t))}resume(){this.q?.(),this.Z=this.q=void 0}}export{i as Pauser,s as PseudoWeakRef,t as forAwaitOf};\n//# sourceMappingURL=private-async-helpers.js.map\n","import{noChange as t}from\"../lit-html.js\";import{isPrimitive as s}from\"../directive-helpers.js\";import{AsyncDirective as i}from\"../async-directive.js\";import{PseudoWeakRef as e,Pauser as r}from\"./private-async-helpers.js\";import{directive as o}from\"../directive.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const n=t=>!s(t)&&\"function\"==typeof t.then,h=1073741823;class c extends i{constructor(){super(...arguments),this._$Cwt=h,this._$Cbt=[],this._$CK=new e(this),this._$CX=new r}render(...s){return s.find((t=>!n(t)))??t}update(s,i){const e=this._$Cbt;let r=e.length;this._$Cbt=i;const o=this._$CK,c=this._$CX;this.isConnected||this.disconnected();for(let t=0;tthis._$Cwt);t++){const s=i[t];if(!n(s))return this._$Cwt=t,s;t{for(;c.get();)await c.get();const i=o.deref();if(void 0!==i){const e=i._$Cbt.indexOf(s);e>-1&&e {\n const main = document.getElementsByTagName('main')[0];\n main.setAttribute('id', 'main');\n return Promise.resolve();\n });\n\n HLX.init();\n}\n\nexport function initHLXApp() {\n if (document.readyState === READY_STATES.interactive || document.readyState === READY_STATES.complete) {\n init();\n } else {\n document.addEventListener('readystatechange', () => {\n const readyState = document.readyState;\n if (readyState === READY_STATES.interactive || readyState === READY_STATES.complete) {\n init();\n }\n });\n }\n}\n","import './components/sidebar/sidebar.init.ts';\nimport './components/innerContainer/innerContainer.init.ts';\nimport './components/header.ts';\nimport './components/icon/icon.ts';\nimport { initHLXApp } from './app/init.ts';\n\ninitHLXApp();\n\ndeclare global {\n interface Window {\n hlx: {\n RUM_MASK_URL: string;\n codeBasePath: string;\n lighthouse: boolean;\n };\n }\n}\n"],"file":"main/main.js"} \ No newline at end of file diff --git a/dist/posts/posts.js b/dist/posts/posts.js index 590e1e57..b74f29b1 100644 --- a/dist/posts/posts.js +++ b/dist/posts/posts.js @@ -1,2 +1,2 @@ -import{j as l,x as i,T as c}from"../__chunks__/lit-element.CH8ciVnL.js";import{P as p,c as y}from"../__chunks__/createOptimizedPicture.Z5VLB_Rl.js";import{F as h,m}from"../__chunks__/fetch.service.DgmLKlDK.js";import{o as u}from"../__chunks__/if-defined.CrfpI-tB.js";import{i as w}from"../__chunks__/isSidekickLibraryActive.U-fJCMMj.js";const $=t=>t?i`

    ${t}

    `:c,g=t=>t?t.length>200?i`

    ${t.slice(0,200)}...

    `:i`

    ${t}

    `:c,v=(t,e)=>e?i`${e}`:c,x=t=>{const{postUrl:e,headline:r,text:o,picture:a,buttontext:s}=t;return i``},T=async t=>{if(t.length===0){const e=await p.getPlaceHolder("no posts");return i`
    ${e}
    `}return t.map(e=>x(e))},H=t=>{var r;return(r=Array.from(t.querySelectorAll("p")).find(o=>o.innerText.trim().length>0))==null?void 0:r.innerText};function S(t){try{return h.fetchText(`${t.path}.plain.html`,{cacheOptions:{cacheType:"runtime"}})}catch(e){m.error(`Post Block: Error while fetching ${t.path}.plain.html`,e);return}}function q(t,e,r){var o,a;return{postUrl:w()?void 0:`${window.hlx.codeBasePath}${t[e].path}`,headline:((o=r.querySelector("h1"))==null?void 0:o.innerText)||((a=r.querySelector("h2"))==null?void 0:a.innerText),text:H(r),buttontext:t[e].buttontext,picture:y({src:t[e].image,alt:t[e].imagealt,width:323,height:199})}}async function j(t){t.innerHTML="";const e=new DOMParser;try{const o=(await h.fetchJson("/query-index.json")).data.filter(n=>n.path.startsWith("/posts")),f=(await Promise.all(o.map(n=>S(n)))).filter(n=>n!==void 0).map(n=>e.parseFromString(n,"text/html")).map((n,P)=>q(o,P,n));t.style.removeProperty("display");const d=await T(f);l(d,t)}catch(r){m.error("Post Block: Error while fetching posts.",r);const o=await p.getPlaceHolder("error"),a=document.createElement("div"),s=i`

    ${o}

    `;l(s,a),t.innerHTML="",t.appendChild(a)}}export{j as default}; +import{j as l,x as i,T as c}from"../__chunks__/lit-element.CH8ciVnL.js";import{P as p,c as y}from"../__chunks__/createOptimizedPicture.CyR9tLTg.js";import{F as h,m}from"../__chunks__/fetch.service.C1Ie3Sjw.js";import{o as u}from"../__chunks__/if-defined.CrfpI-tB.js";import{i as w}from"../__chunks__/isSidekickLibraryActive.U-fJCMMj.js";const $=t=>t?i`

    ${t}

    `:c,g=t=>t?t.length>200?i`

    ${t.slice(0,200)}...

    `:i`

    ${t}

    `:c,v=(t,e)=>e?i`${e}`:c,x=t=>{const{postUrl:e,headline:r,text:o,picture:a,buttontext:s}=t;return i``},T=async t=>{if(t.length===0){const e=await p.getPlaceHolder("no posts");return i`
    ${e}
    `}return t.map(e=>x(e))},H=t=>{var r;return(r=Array.from(t.querySelectorAll("p")).find(o=>o.innerText.trim().length>0))==null?void 0:r.innerText};function S(t){try{return h.fetchText(`${t.path}.plain.html`,{cacheOptions:{cacheType:"runtime"}})}catch(e){m.error(`Post Block: Error while fetching ${t.path}.plain.html`,e);return}}function q(t,e,r){var o,a;return{postUrl:w()?void 0:`${window.hlx.codeBasePath}${t[e].path}`,headline:((o=r.querySelector("h1"))==null?void 0:o.innerText)||((a=r.querySelector("h2"))==null?void 0:a.innerText),text:H(r),buttontext:t[e].buttontext,picture:y({src:t[e].image,alt:t[e].imagealt,width:323,height:199})}}async function j(t){t.innerHTML="";const e=new DOMParser;try{const o=(await h.fetchJson("/query-index.json")).data.filter(n=>n.path.startsWith("/posts")),f=(await Promise.all(o.map(n=>S(n)))).filter(n=>n!==void 0).map(n=>e.parseFromString(n,"text/html")).map((n,P)=>q(o,P,n));t.style.removeProperty("display");const d=await T(f);l(d,t)}catch(r){m.error("Post Block: Error while fetching posts.",r);const o=await p.getPlaceHolder("error"),a=document.createElement("div"),s=i`

    ${o}

    `;l(s,a),t.innerHTML="",t.appendChild(a)}}export{j as default}; //# sourceMappingURL=posts.js.map diff --git a/scripts/__backup__/aem.js b/scripts/__backup__/aem.js index 99f56f54..dd08903d 100644 --- a/scripts/__backup__/aem.js +++ b/scripts/__backup__/aem.js @@ -26,8 +26,9 @@ function sampleRUM(checkpoint, data = {}) { const defer = (fnname) => { sampleRUM[fnname] = sampleRUM[fnname] || ((...args) => sampleRUM.defer.push({ fnname, args })); }; - sampleRUM.drain = sampleRUM.drain - || ((dfnname, fn) => { + sampleRUM.drain = + sampleRUM.drain || + ((dfnname, fn) => { sampleRUM[dfnname] = fn; sampleRUM.defer .filter(({ fnname }) => dfnname === fnname) @@ -97,7 +98,7 @@ function sampleRUM(checkpoint, data = {}) { t: Date.now() - firstReadTime, ...data, }, - knownProperties, + knownProperties ); const url = `https://rum.hlx.page/.rum/${weight}`; // eslint-disable-next-line no-unused-expressions @@ -175,10 +176,10 @@ function init() { function toClassName(name) { return typeof name === 'string' ? name - .toLowerCase() - .replace(/[^0-9a-z]/gi, '-') - .replace(/-+/g, '-') - .replace(/^-|-$/g, '') + .toLowerCase() + .replace(/[^0-9a-z]/gi, '-') + .replace(/-+/g, '-') + .replace(/^-|-$/g, '') : ''; } @@ -287,9 +288,7 @@ async function loadScript(src, attrs) { */ function getMetadata(name, doc = document) { const attr = name && name.includes(':') ? 'property' : 'name'; - const meta = [...doc.head.querySelectorAll(`meta[${attr}="${name}"]`)] - .map((m) => m.content) - .join(', '); + const meta = [...doc.head.querySelectorAll(`meta[${attr}="${name}"]`)].map((m) => m.content).join(', '); return meta || ''; } @@ -305,7 +304,7 @@ function createOptimizedPicture( src, alt = '', eager = false, - breakpoints = [{ media: '(min-width: 600px)', width: '2000' }, { width: '750' }], + breakpoints = [{ media: '(min-width: 600px)', width: '2000' }, { width: '750' }] ) { const url = new URL(src, window.location.href); const picture = document.createElement('picture'); @@ -371,19 +370,19 @@ function decorateButtons(element) { up.classList.add('button-container'); } if ( - up.childNodes.length === 1 - && up.tagName === 'STRONG' - && twoup.childNodes.length === 1 - && twoup.tagName === 'P' + up.childNodes.length === 1 && + up.tagName === 'STRONG' && + twoup.childNodes.length === 1 && + twoup.tagName === 'P' ) { a.className = 'button primary'; twoup.classList.add('button-container'); } if ( - up.childNodes.length === 1 - && up.tagName === 'EM' - && twoup.childNodes.length === 1 - && twoup.tagName === 'P' + up.childNodes.length === 1 && + up.tagName === 'EM' && + twoup.childNodes.length === 1 && + twoup.tagName === 'P' ) { a.className = 'button secondary'; twoup.classList.add('button-container'); @@ -513,7 +512,7 @@ function updateSectionsStatus(main) { const status = section.dataset.sectionStatus; if (status !== 'loaded') { const loadingBlock = section.querySelector( - '.block[data-block-status="initialized"], .block[data-block-status="loading"]', + '.block[data-block-status="initialized"], .block[data-block-status="loading"]' ); if (loadingBlock) { section.dataset.sectionStatus = 'loading'; @@ -571,9 +570,7 @@ async function loadBlock(block) { const decorationComplete = new Promise((resolve) => { (async () => { try { - const mod = await import( - `${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.js` - ); + const mod = await import(`${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.js`); if (mod.default) { await mod.default(block); } diff --git a/src/app/app.types.ts b/src/app/app.types.ts new file mode 100644 index 00000000..904c23c3 --- /dev/null +++ b/src/app/app.types.ts @@ -0,0 +1,8 @@ +export type BlockMapping = { + name: string; + element: HTMLDivElement; +}; + +export interface LcpCandidate extends HTMLElement { + complete: boolean; +} diff --git a/src/app/index.ts b/src/app/index.ts new file mode 100644 index 00000000..dad3234f --- /dev/null +++ b/src/app/index.ts @@ -0,0 +1,223 @@ +import { decorateTemplateAndTheme } from './tasks/decorateTemplateAndTheme'; +import { decorateButtons } from './tasks/decorateButtons'; +import { setDocLanguage } from './tasks/setDocLanguage'; +import { waitForLCP } from './tasks/waitForLCP'; +import { loadFonts } from './tasks/loadFonts'; +import { initSampleRUM } from './tasks/initSampleRUM'; +import { DebuggerService } from '@kluntje/services'; +import { loadCSS } from './tasks/loadCSS'; +import { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive'; +import { config } from '../../config'; +import { loadBlocks } from './tasks/loadBlocks'; +import { transformSection } from './tasks/transformSections'; +import { decorateBlocks } from './tasks/decorateBlocks'; +import { sampleRUM } from './tasks/sampleRUM'; + +class HLX { + private beforeEagerCallbacks: Array<() => Promise> = []; + private loadEagerCallbacks: Array<() => Promise> = []; + private beforeLoadLazyCallbacks: Array<() => Promise> = []; + private loadLazyCallbacks: Array<() => Promise> = []; + private beforeLoadDelayedCallbacks: Array<() => Promise> = []; + private loadDelayedCallbacks: Array<() => Promise> = []; + private initializedCallbacks: Array<() => Promise> = []; + + private beforeEagerPromise?: Promise; + private eagerPromise?: Promise; + private beforeLazyPromise?: Promise; + private lazyPromise?: Promise; + private beforeDelayedPromise?: Promise; + private delayedPromise?: Promise; + private initializedPromise?: Promise; + + private get beforeEager() { + if (this.beforeEagerPromise === undefined) { + this.beforeEagerPromise = this.beforeLoadEager(); + } + return this.beforeEagerPromise; + } + + private get loadEager() { + if (this.eagerPromise === undefined) { + this.eagerPromise = this.loadEagerPromise(); + } + return this.eagerPromise; + } + + private get beforeLoadLazy() { + if (this.beforeLazyPromise === undefined) { + this.beforeLazyPromise = this.beforeLoadLazyPromise(); + } + return this.beforeLazyPromise; + } + + private get loadLazy() { + if (this.lazyPromise === undefined) { + this.lazyPromise = this.loadLazyPromise(); + } + return this.lazyPromise; + } + + private get beforeLoadDelayed() { + if (this.beforeDelayedPromise === undefined) { + this.beforeDelayedPromise = this.beforeLoadDelayedPromise(); + } + return this.beforeDelayedPromise; + } + + private get loadDelayed() { + if (this.delayedPromise === undefined) { + this.delayedPromise = this.loadDelayedPromise(); + } + return this.delayedPromise; + } + + private get initialized() { + if (this.initializedPromise === undefined) { + this.initializedPromise = this.getInitializedPromise(); + } + return this.initializedPromise; + } + + public addBeforeEagerTask(cb: () => Promise) { + this.beforeEagerCallbacks.push(cb); + } + + public addLoadEagerTask(cb: () => Promise) { + this.loadEagerCallbacks.push(cb); + } + + public addBeforeLoadLazyTask(cb: () => Promise) { + this.beforeLoadLazyCallbacks.push(cb); + } + + public addLoadLazyTask(cb: () => Promise) { + this.loadLazyCallbacks.push(cb); + } + + public addBeforeLoadDelayedTask(cb: () => Promise) { + this.beforeLoadDelayedCallbacks.push(cb); + } + + public addLoadDelayedTask(cb: () => Promise) { + this.loadDelayedCallbacks.push(cb); + } + + public addInitializedTask(cb: () => Promise) { + this.initializedCallbacks.push(cb); + } + + public async init() { + await this.beforeEager; + await this.loadEager; + await this.beforeLoadLazy; + await this.loadLazy; + await this.beforeLoadDelayed; + await this.loadDelayed; + await this.initialized; + } + + private async beforeLoadEager(): Promise { + const beforeLoadEagerTask: Promise = new Promise((resolve) => { + initSampleRUM(); + decorateTemplateAndTheme(); + setDocLanguage(); + resolve(); + }); + + await Promise.all([...this.beforeEagerCallbacks.map((cb) => cb()), beforeLoadEagerTask]); + } + + private async loadEagerPromise(): Promise { + const loadEagerTask: Promise = new Promise(async (resolve) => { + const main = document.querySelector('main') as HTMLElement; + decorateButtons(main); + transformSection(main); + decorateBlocks(main); + setTimeout(() => { + document.body.classList.add('show'); + resolve(); + }, 100); + + await waitForLCP(); + + try { + /* if desktop (proxy for fast connection) or fonts already loaded, load fonts.css */ + if (window.innerWidth >= 900 || sessionStorage.getItem('fonts-loaded')) { + await loadFonts(); + } + } catch (e) { + // do nothing + } + }); + + await Promise.all([...this.loadEagerCallbacks.map((cb) => cb()), loadEagerTask]); + } + + private async beforeLoadLazyPromise(): Promise { + const beforeLoadLazyTask: Promise = new Promise((resolve) => resolve()); + + await Promise.all([...this.beforeLoadLazyCallbacks.map((cb) => cb()), beforeLoadLazyTask]); + } + + private async loadLazyPromise(): Promise { + const loadLazyTask: Promise = new Promise(async (resolve) => { + try { + const { + lazyStylesScssPath, + sidekickLibraryStylesScssPath, + fontsScssPath, + lazyStylesCssPath, + sidekickLibraryStylesCssPath, + } = config; + + await loadBlocks(); + + const { hash } = window.location; + const element = hash ? document.getElementById(hash.substring(1)) : false; + if (hash && element) element.scrollIntoView(); + + if (lazyStylesScssPath && lazyStylesCssPath) await loadCSS(lazyStylesCssPath); + if (sidekickLibraryStylesScssPath && sidekickLibraryStylesCssPath && isSidekickLibraryActive()) { + await loadCSS(sidekickLibraryStylesCssPath); + } + if (fontsScssPath) await loadFonts(); + sampleRUM('lazy'); + const main = document.querySelector('main') as HTMLElement; + // @ts-ignore + sampleRUM.observe(main.querySelectorAll('div[data-block-name]')); + // @ts-ignore + sampleRUM.observe(main.querySelectorAll('picture > img')); + } catch (error) { + DebuggerService.error('Load lazy Task: ', error); + } + resolve(); + }); + + await Promise.all([...this.loadLazyCallbacks.map((cb) => cb()), loadLazyTask]); + } + + private async beforeLoadDelayedPromise(): Promise { + const beforeLoadDelayedTask: Promise = new Promise((resolve) => resolve()); + + await Promise.all([...this.beforeLoadDelayedCallbacks.map((cb) => cb()), beforeLoadDelayedTask]); + } + + private async loadDelayedPromise(): Promise { + const loadDelayedTask: Promise = new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, 3000); + }); + + await Promise.all([...this.loadDelayedCallbacks.map((cb) => cb()), loadDelayedTask]); + } + + private async getInitializedPromise(): Promise { + const initializedTask: Promise = new Promise((resolve) => resolve()); + + await Promise.all([...this.initializedCallbacks.map((cb) => cb()), initializedTask]); + } +} + +export default new HLX(); diff --git a/src/app/init.ts b/src/app/init.ts new file mode 100644 index 00000000..1f3f205a --- /dev/null +++ b/src/app/init.ts @@ -0,0 +1,29 @@ +import HLX from './index.ts'; + +const READY_STATES = { + interactive: 'interactive', + complete: 'complete', +}; + +function init() { + HLX.addBeforeEagerTask(() => { + const main = document.getElementsByTagName('main')[0]; + main.setAttribute('id', 'main'); + return Promise.resolve(); + }); + + HLX.init(); +} + +export function initHLXApp() { + if (document.readyState === READY_STATES.interactive || document.readyState === READY_STATES.complete) { + init(); + } else { + document.addEventListener('readystatechange', () => { + const readyState = document.readyState; + if (readyState === READY_STATES.interactive || readyState === READY_STATES.complete) { + init(); + } + }); + } +} diff --git a/src/app/tasks/adjustMarkup.ts b/src/app/tasks/adjustMarkup.ts new file mode 100644 index 00000000..b3a96fac --- /dev/null +++ b/src/app/tasks/adjustMarkup.ts @@ -0,0 +1,32 @@ +import { decorateImages } from './decorateImages'; + +/** + * This function is used to adjust the markup of a section. + * It wraps the default content in a div with the class 'default-content-wrapper'. + * It also adds the class 'section' to the section element. + * It decorates the images in the default content by calling the 'decorateImages' function. + * It sets the 'data-section-status' attribute to 'initialized'. + * It hides the section element. + * @param section - The section element to adjust. + */ +export function adjustMarkup(section: HTMLDivElement) { + const wrappers: HTMLDivElement[] = []; + let defaultContent = false; + [...section.children].forEach((e) => { + if (e.tagName === 'DIV' || !defaultContent) { + const wrapper = document.createElement('div'); + wrappers.push(wrapper); + defaultContent = e.tagName !== 'DIV'; + + if (defaultContent) { + wrapper.classList.add('default-content-wrapper'); + } + } + wrappers[wrappers.length - 1].append(e); + }); + wrappers.forEach((wrapper) => section.append(wrapper)); + decorateImages(); + section.classList.add('section'); + section.dataset.sectionStatus = 'initialized'; + section.style.display = 'none'; +} diff --git a/src/app/tasks/collectBlocks.ts b/src/app/tasks/collectBlocks.ts new file mode 100644 index 00000000..fc11beca --- /dev/null +++ b/src/app/tasks/collectBlocks.ts @@ -0,0 +1,24 @@ +import { BlockMapping } from '../app.types'; + +/** + * Collect all blocks in a section. + * @param section - The section to collect the blocks from. + * @returns BlockMapping[] + * @example + * const blocks = collectBlocks(section); + * console.log(blocks); + * Output: [{ name: 'block1', element: HTMLElement }, { name: 'block2', element: HTMLElement }] + */ +export function collectBlocks(section: HTMLElement): BlockMapping[] { + const blockMap: BlockMapping[] = []; + const blocksElements = section.querySelectorAll('[data-block-name]'); + + blocksElements.forEach((block: HTMLDivElement) => { + blockMap.push({ + name: block.dataset['blockName'] as string, + element: block, + }); + }); + + return blockMap; +} diff --git a/src/app/tasks/decorateBlocks.ts b/src/app/tasks/decorateBlocks.ts new file mode 100644 index 00000000..b5093226 --- /dev/null +++ b/src/app/tasks/decorateBlocks.ts @@ -0,0 +1,17 @@ +/** + * Decorate blocks with classes and data attributes. + * @param main - Html main element + */ +export function decorateBlocks(main: HTMLElement) { + main.querySelectorAll('div.section > div > div').forEach((block) => { + const shortBlockName = block.classList[0]; + if (shortBlockName) { + block.classList.add('block'); + block.dataset.blockName = shortBlockName; + const blockWrapper = block.parentElement; + blockWrapper?.classList.add(`${shortBlockName}-wrapper`); + const section = block.closest('.section'); + if (section) section.classList.add(`${shortBlockName}-container`); + } + }); +} diff --git a/src/app/tasks/decorateButtons.ts b/src/app/tasks/decorateButtons.ts new file mode 100644 index 00000000..ae55b6d0 --- /dev/null +++ b/src/app/tasks/decorateButtons.ts @@ -0,0 +1,37 @@ +/** + * Decorates paragraphs containing a single link as buttons. + * @param {Element} element container element + */ +export function decorateButtons(element) { + element.querySelectorAll('a').forEach((a) => { + a.title = a.title || a.textContent; + if (a.href !== a.textContent) { + const up = a.parentElement; + const twoup = a.parentElement.parentElement; + if (!a.querySelector('img')) { + if (up.childNodes.length === 1 && (up.tagName === 'P' || up.tagName === 'DIV')) { + a.className = 'button'; // default + up.classList.add('button-container'); + } + if ( + up.childNodes.length === 1 && + up.tagName === 'STRONG' && + twoup.childNodes.length === 1 && + twoup.tagName === 'P' + ) { + a.className = 'button primary'; + twoup.classList.add('button-container'); + } + if ( + up.childNodes.length === 1 && + up.tagName === 'EM' && + twoup.childNodes.length === 1 && + twoup.tagName === 'P' + ) { + a.className = 'button secondary'; + twoup.classList.add('button-container'); + } + } + } + }); +} diff --git a/src/app/tasks/decorateImages.ts b/src/app/tasks/decorateImages.ts new file mode 100644 index 00000000..11c32ad8 --- /dev/null +++ b/src/app/tasks/decorateImages.ts @@ -0,0 +1,13 @@ +/* + * This function is used to decorate images in the default content. + * It adds the class 'image' and 'main' to the parent element of the image. + */ +export function decorateImages() { + const picture = document.querySelectorAll('.default-content-wrapper picture'); + picture.forEach((item) => { + const parentElement = item.parentElement; + if (parentElement) { + parentElement.classList.add('image', 'main'); + } + }); +} diff --git a/src/app/tasks/decorateTemplateAndTheme.ts b/src/app/tasks/decorateTemplateAndTheme.ts new file mode 100644 index 00000000..b63ea178 --- /dev/null +++ b/src/app/tasks/decorateTemplateAndTheme.ts @@ -0,0 +1,20 @@ +import { addClasses } from '../../utils/addClasses'; +import { getMetadata } from '../../utils/getMetadata'; + +/** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * Usefull for styling the page based on the template and theme meta tags + * that can be set in the metadata table in EDS. + * @example + * + * + * @example + * + */ +export function decorateTemplateAndTheme() { + const template = getMetadata('template'); + if (template) addClasses(document.body, template); + const theme = getMetadata('theme'); + if (theme) addClasses(document.body, theme); +} diff --git a/src/app/tasks/initSampleRUM.ts b/src/app/tasks/initSampleRUM.ts new file mode 100644 index 00000000..fc68c2d4 --- /dev/null +++ b/src/app/tasks/initSampleRUM.ts @@ -0,0 +1,17 @@ +import { sampleRUM } from './sampleRUM'; +import setupHlxObj from './setupHlxObj'; + +export function initSampleRUM() { + setupHlxObj(); + sampleRUM('top'); + + window.addEventListener('load', () => sampleRUM('load')); + + window.addEventListener('unhandledrejection', (event) => { + sampleRUM('error', { source: event.reason.sourceURL, target: event.reason.line }); + }); + + window.addEventListener('error', (event) => { + sampleRUM('error', { source: event.filename, target: event.lineno }); + }); +} diff --git a/src/app/tasks/loadBlock.ts b/src/app/tasks/loadBlock.ts new file mode 100644 index 00000000..0b1a3749 --- /dev/null +++ b/src/app/tasks/loadBlock.ts @@ -0,0 +1,25 @@ +import { BlockMapping } from '../app.types'; +import { collectBlocks } from './collectBlocks'; +import { loadBlockModules } from './loadBlockModules'; +import { loadBlockStyles } from './loadBlockStyles'; +import { showSection } from './showSection'; + +/** + * Load the block modules and styles for a section and show the section. + * @param section - The section to load the block modules and styles for. + * @returns Promise + */ +export async function loadBlock(section: HTMLElement) { + const sectionsBlocks: BlockMapping[] = collectBlocks(section); + + if (!sectionsBlocks.length) { + showSection(section); + return; + } + + for (const block of sectionsBlocks) { + Promise.all([loadBlockModules(block), loadBlockStyles(block)]); + } + + showSection(section); +} diff --git a/src/app/tasks/loadBlockModules.ts b/src/app/tasks/loadBlockModules.ts new file mode 100644 index 00000000..b3876349 --- /dev/null +++ b/src/app/tasks/loadBlockModules.ts @@ -0,0 +1,28 @@ +import { DebuggerService } from '@kluntje/services'; +import { BlockMapping } from '../app.types'; +import { getUrlForEndpoint } from '../utils/getUrlForEndpoint'; + +/* + * Load the es module for the block. The module should be named as the block name. + * @param block - The block to load the module for. + * @returns Promise + */ +export async function loadBlockModules(block: BlockMapping): Promise { + const status = block.element.dataset.blockStatus; + if (status !== 'loading' && status !== 'loaded') { + try { + block.element.dataset.blockStatus = 'loading'; + const { href } = getUrlForEndpoint(`dist/${block.name}/${block.name}.js`); + const blockModule = await import(href); + + if (blockModule.default) { + await blockModule.default(block.element); + } + + block.element.dataset.blockStatus = 'loaded'; + } catch (error) { + block.element.dataset.blockStatus = 'error'; + DebuggerService.error('laodBloackModules:', error); + } + } +} diff --git a/src/app/tasks/loadBlockStyles.ts b/src/app/tasks/loadBlockStyles.ts new file mode 100644 index 00000000..aba5cdba --- /dev/null +++ b/src/app/tasks/loadBlockStyles.ts @@ -0,0 +1,15 @@ +import { BlockMapping } from '../app.types'; +import { loadCSS } from './loadCSS'; + +/** + * Load the block styles. The styles should be named as the block name. + * @param block - The block to load the styles for. + * @returns Promise + */ +export async function loadBlockStyles(block: BlockMapping) { + try { + await loadCSS(`dist/${block.name}/${block.name}.css`); + } catch (error) { + //do nothing + } +} diff --git a/src/app/tasks/loadBlocks.ts b/src/app/tasks/loadBlocks.ts new file mode 100644 index 00000000..f0f984df --- /dev/null +++ b/src/app/tasks/loadBlocks.ts @@ -0,0 +1,13 @@ +import { loadBlock } from './loadBlock'; + +/** + * Loads Blocks + * by getting all sections and load every block in every section + * and shows every section that is finished loading. + */ +export async function loadBlocks() { + const sections = [...document.querySelectorAll('.section')]; + const SectionsPromises = sections.map((section) => loadBlock(section)); + + await Promise.all(SectionsPromises); +} diff --git a/src/app/tasks/loadCSS.ts b/src/app/tasks/loadCSS.ts new file mode 100644 index 00000000..a3d46ca0 --- /dev/null +++ b/src/app/tasks/loadCSS.ts @@ -0,0 +1,23 @@ +import { getUrlForEndpoint } from '../utils/getUrlForEndpoint'; + +/** + * Load a CSS file if it is not already loaded append it to the head. + * @param endpoint - The endpoint of the CSS file. + * @returns Promise + */ +export async function loadCSS(endpoint: string) { + return new Promise((resolve, reject) => { + const { href } = getUrlForEndpoint(endpoint); + + if (!document.querySelector(`head > link[href="${href}"]`)) { + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = href; + link.onload = resolve; + link.onerror = reject; + document.head.append(link); + } else { + resolve(true); + } + }); +} diff --git a/src/app/tasks/loadFonts.ts b/src/app/tasks/loadFonts.ts new file mode 100644 index 00000000..bf33ff56 --- /dev/null +++ b/src/app/tasks/loadFonts.ts @@ -0,0 +1,15 @@ +import { getLocation } from 'Helpers/sidekick/getLocation'; +import { loadCSS } from './loadCSS'; +import { config } from '../../../config'; + +export async function loadFonts(): Promise { + const { fontsCssPath } = config; + if (!fontsCssPath) return; + await loadCSS(fontsCssPath); + try { + if (!getLocation().hostname.includes('localhost')) sessionStorage.setItem('fonts-loaded', 'true'); + } catch (e) { + console.error('Error setting fonts-loaded in session storage', e); + // do nothing + } +} diff --git a/src/app/tasks/processSectionMetaData.ts b/src/app/tasks/processSectionMetaData.ts new file mode 100644 index 00000000..a209777f --- /dev/null +++ b/src/app/tasks/processSectionMetaData.ts @@ -0,0 +1,26 @@ +import { toCamelCase } from 'Utils/toCamelCase'; +import { toClassName } from 'Utils/toClassName'; +import { readBlockConfig } from './readBlockConfig'; + +/* + This function processes the metadata of a section and applies it to the section element. + @param {HTMLElement} section The section element +*/ +export function processSectionMetaData(section: HTMLElement) { + const sectionMeta = section.querySelector('div.section-metadata'); + if (sectionMeta) { + const meta = readBlockConfig(sectionMeta); + Object.keys(meta).forEach((key) => { + if (key === 'style') { + const styles = meta.style + .split(',') + .filter((style: string) => style) + .map((style: string) => toClassName(style.trim())); + styles.forEach((style: string) => section.classList.add(style)); + } else { + section.dataset[toCamelCase(key)] = meta[key]; + } + }); + if (sectionMeta.parentElement) sectionMeta.parentElement.remove(); + } +} diff --git a/src/app/tasks/readBlockConfig.ts b/src/app/tasks/readBlockConfig.ts new file mode 100644 index 00000000..ca469446 --- /dev/null +++ b/src/app/tasks/readBlockConfig.ts @@ -0,0 +1,44 @@ +import { toClassName } from 'Utils/toClassName'; + +/* + This function reads the configuration of a block from the HTML file + and returns it as a Record object. + @param {Element} block The block element +*/ +export function readBlockConfig(block: Element): Record { + const config: Record = {}; + block.querySelectorAll(':scope > div').forEach((row) => { + if (row.children) { + const cols = [...row.children]; + if (cols[1]) { + const col = cols[1]; + const name = toClassName(cols[0].textContent ?? ''); + let value: any = ''; + if (col.querySelector('a')) { + const as = [...col.querySelectorAll('a')]; + if (as.length === 1) { + value = as[0].href; + } else { + value = as.map((a) => a.href); + } + } else if (col.querySelector('img')) { + const imgs = [...col.querySelectorAll('img')]; + if (imgs.length === 1) { + value = imgs[0].src; + } else { + value = imgs.map((img) => img.src); + } + } else if (col.querySelector('p')) { + const ps = [...col.querySelectorAll('p')]; + if (ps.length === 1) { + value = ps[0].textContent; + } else { + value = ps.map((p) => p.textContent); + } + } else value = row.children[1].textContent; + config[name] = value; + } + } + }); + return config; +} diff --git a/src/app/tasks/sampleRUM.ts b/src/app/tasks/sampleRUM.ts new file mode 100644 index 00000000..f391b7cd --- /dev/null +++ b/src/app/tasks/sampleRUM.ts @@ -0,0 +1,135 @@ +/** + * log RUM if part of the sample. + * @param {string} checkpoint identifies the checkpoint in funnel + * @param {Object} data additional data for RUM sample + * @param {string} data.source DOM node that is the source of a checkpoint event, + * identified by #id or .classname + * @param {string} data.target subject of the checkpoint event, + * for instance the href of a link, or a search term + */ + +export function sampleRUM(checkpoint, data = {}) { + // @ts-ignore + sampleRUM.defer = sampleRUM.defer || []; + const defer = (fnname) => { + // @ts-ignore + sampleRUM[fnname] = sampleRUM[fnname] || ((...args) => sampleRUM.defer.push({ fnname, args })); + }; + // @ts-ignore + sampleRUM.drain = + // @ts-ignore + sampleRUM.drain || + ((dfnname, fn) => { + sampleRUM[dfnname] = fn; + // @ts-ignore + sampleRUM.defer + .filter(({ fnname }) => dfnname === fnname) + .forEach(({ fnname, args }) => sampleRUM[fnname](...args)); + }); + // @ts-ignore + sampleRUM.always = sampleRUM.always || []; + // @ts-ignore + sampleRUM.always.on = (chkpnt, fn) => { + // @ts-ignore + sampleRUM.always[chkpnt] = fn; + }; + // @ts-ignore + sampleRUM.on = (chkpnt, fn) => { + // @ts-ignore + sampleRUM.cases[chkpnt] = fn; + }; + defer('observe'); + defer('cwv'); + try { + window.hlx = window.hlx || {}; + // @ts-ignore + if (!window.hlx.rum) { + const usp = new URLSearchParams(window.location.search); + const weight = usp.get('rum') === 'on' ? 1 : 100; // with parameter, weight is 1. Defaults to 100. + const id = Array.from({ length: 75 }, (_, i) => String.fromCharCode(48 + i)) + .filter((a) => /\d|[A-Z]/i.test(a)) + .filter(() => Math.random() * 75 > 70) + .join(''); + const random = Math.random(); + const isSelected = random * weight < 1; + const firstReadTime = Date.now(); + const urlSanitizers = { + full: () => window.location.href, + origin: () => window.location.origin, + path: () => window.location.href.replace(/\?.*$/, ''), + }; + // @ts-ignore + window.hlx.rum = { + weight, + id, + random, + isSelected, + firstReadTime, + sampleRUM, + sanitizeURL: urlSanitizers[window.hlx.RUM_MASK_URL || 'path'], + }; + } + // @ts-ignore + const { weight, id, firstReadTime } = window.hlx.rum; + // @ts-ignore + if (window.hlx && window.hlx.rum && window.hlx.rum.isSelected) { + const knownProperties = [ + 'weight', + 'id', + 'referer', + 'checkpoint', + 't', + 'source', + 'target', + 'cwv', + 'CLS', + 'FID', + 'LCP', + 'INP', + ]; + const sendPing = (pdata = data) => { + const body = JSON.stringify( + { + weight, + id, + // @ts-ignore + referer: window.hlx.rum.sanitizeURL(), + checkpoint, + t: Date.now() - firstReadTime, + ...data, + }, + knownProperties + ); + const url = `https://rum.hlx.page/.rum/${weight}`; + navigator.sendBeacon(url, body); + // eslint-disable-next-line no-console + console.debug(`ping:${checkpoint}`, pdata); + }; + // @ts-ignore + sampleRUM.cases = sampleRUM.cases || { + // @ts-ignore + cwv: () => sampleRUM.cwv(data) || true, + lazy: () => { + // use classic script to avoid CORS issues + const script = document.createElement('script'); + script.src = 'https://rum.hlx.page/.rum/@adobe/helix-rum-enhancer@^1/src/index.js'; + document.head.appendChild(script); + return true; + }, + }; + sendPing(data); + // @ts-ignore + if (sampleRUM.cases[checkpoint]) { + // @ts-ignore + sampleRUM.cases[checkpoint](); + } + } + // @ts-ignore + if (sampleRUM.always[checkpoint]) { + // @ts-ignore + sampleRUM.always[checkpoint](data); + } + } catch (error) { + // something went wrong + } +} diff --git a/src/app/tasks/setDocLanguage.ts b/src/app/tasks/setDocLanguage.ts new file mode 100644 index 00000000..4bd5438b --- /dev/null +++ b/src/app/tasks/setDocLanguage.ts @@ -0,0 +1,10 @@ +import { getMetadata } from '../../utils/getMetadata'; +import { undefinedOnEmpty } from '../../utils/undefinedOnEmpty'; + +/* + * This function sets the language of the document based on the language metadata. + */ +export function setDocLanguage() { + const lang = getMetadata('language'); + document.documentElement.lang = undefinedOnEmpty(lang) || 'en'; +} diff --git a/src/app/tasks/setupHlxObj.ts b/src/app/tasks/setupHlxObj.ts new file mode 100644 index 00000000..9f99f629 --- /dev/null +++ b/src/app/tasks/setupHlxObj.ts @@ -0,0 +1,16 @@ +export default function setupHlxObj(mainScriptPath: string = '/dist/main/main.js') { + window.hlx = window.hlx || {}; + window.hlx.RUM_MASK_URL = 'full'; + window.hlx.codeBasePath = ''; + window.hlx.lighthouse = new URLSearchParams(window.location.search).get('lighthouse') === 'on'; + + const scriptEl = document.querySelector(`script[src$="${mainScriptPath}"]`) as HTMLScriptElement; + if (scriptEl) { + try { + [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split(mainScriptPath); + } catch (error) { + // eslint-disable-next-line no-console + console.log('setupHlxObj', error); + } + } +} diff --git a/src/app/tasks/showSection.ts b/src/app/tasks/showSection.ts new file mode 100644 index 00000000..f944d307 --- /dev/null +++ b/src/app/tasks/showSection.ts @@ -0,0 +1,7 @@ +/** + * Removes the display property from the section + * @param section - The section to show + */ +export function showSection(section: HTMLElement) { + section.style.removeProperty('display'); +} diff --git a/src/app/tasks/transformSections.ts b/src/app/tasks/transformSections.ts new file mode 100644 index 00000000..5f05a917 --- /dev/null +++ b/src/app/tasks/transformSections.ts @@ -0,0 +1,15 @@ +import { adjustMarkup } from './adjustMarkup'; +import { processSectionMetaData } from './processSectionMetaData'; + +/** + * This function is used to transform the sections of the main element. + * It adjusts the markup of each section by calling the 'adjustMarkup' function. + * It processes the metadata of each section by calling the 'processSectionMetaData' function. + * @param main - The main element to transform. + */ +export function transformSection(main: HTMLElement) { + main.querySelectorAll(':scope > div').forEach((section) => { + adjustMarkup(section); + processSectionMetaData(section); + }); +} diff --git a/src/app/tasks/waitForLCP.ts b/src/app/tasks/waitForLCP.ts new file mode 100644 index 00000000..566cb870 --- /dev/null +++ b/src/app/tasks/waitForLCP.ts @@ -0,0 +1,42 @@ +import { collectBlocks } from './collectBlocks'; +import { loadBlockModules } from './loadBlockModules'; +import { loadBlockStyles } from './loadBlockStyles'; +import { config } from '../../../config'; +import { showSection } from './showSection'; +import { LcpCandidate } from '../app.types'; + +/** + * Wait for the Largest Contentful Paint (LCP) candidate to be loaded. + * This function will load the modules and styles for the first section after the LCP candidate. + * @returns Promise + */ +export async function waitForLCP() { + const firstSection: HTMLElement | null = document.querySelector('.section'); + const { lcpBlocks } = config; + + if (firstSection) { + const blocks = collectBlocks(firstSection); + const blockPromises = blocks.map(async (block) => { + const hasLCPBlock = lcpBlocks?.includes(block.name); + if (hasLCPBlock) await Promise.all([loadBlockModules(block), loadBlockStyles(block)]); + }); + + await Promise.all(blockPromises); + showSection(firstSection); + } + + // @ts-ignore + document.body.style.display = null; + const lcpCandidate = document.querySelector('main img'); + + await new Promise((resolve) => { + if (lcpCandidate && !lcpCandidate.complete) { + lcpCandidate.setAttribute('loading', 'eager'); + lcpCandidate.setAttribute('fetchpriority', 'high'); + lcpCandidate.addEventListener('load', () => resolve()); + lcpCandidate.addEventListener('error', () => resolve()); + } else { + resolve(); + } + }); +} diff --git a/src/app/utils/getUrlForEndpoint.ts b/src/app/utils/getUrlForEndpoint.ts new file mode 100644 index 00000000..9ea6933e --- /dev/null +++ b/src/app/utils/getUrlForEndpoint.ts @@ -0,0 +1,13 @@ +/** + * Get the URL for an endpoint. + * @param endpoint - The endpoint. + * @returns URL + * @example + * const url = getUrlForEndpoint('block1/block1.css'); + * console.log(url); + * Output: URL { href: 'http://localhost:3000/block1/block1.css' } + */ +export const getUrlForEndpoint = (endpoint: string): URL => { + const baseUrl = new URL(window.hlx.codeBasePath, window.location.origin); + return new URL(endpoint, baseUrl); +}; diff --git a/src/components/form/form.ts b/src/components/form/form.ts index 960c5153..feb3a0dc 100644 --- a/src/components/form/form.ts +++ b/src/components/form/form.ts @@ -147,7 +147,6 @@ export class Form extends LitElement { }, }); if (response.ok) { - console.log(payload); if (form.dataset.confirmation) { window.location.href = form.dataset.confirmation; } diff --git a/src/components/innerContainer/innerContainer.init.ts b/src/components/innerContainer/innerContainer.init.ts new file mode 100644 index 00000000..e6572a90 --- /dev/null +++ b/src/components/innerContainer/innerContainer.init.ts @@ -0,0 +1,7 @@ +import HLX from '../../app/index.ts'; +import { addInnerContainer } from './innerContainer.ts'; + +HLX.addLoadEagerTask(() => { + addInnerContainer(); + return Promise.resolve(); +}); diff --git a/src/components/innerContainer/innerContainer.ts b/src/components/innerContainer/innerContainer.ts new file mode 100644 index 00000000..5576ca96 --- /dev/null +++ b/src/components/innerContainer/innerContainer.ts @@ -0,0 +1,8 @@ +import { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive'; + +export function addInnerContainer() { + const main = document.getElementById('main'); + if (!main) return; + const children = main.innerHTML; + main.innerHTML = `
    ${isSidekickLibraryActive() ? `` : ``}${children}
    `; +} diff --git a/src/components/sidebar/sidebar.init.ts b/src/components/sidebar/sidebar.init.ts new file mode 100644 index 00000000..e139ce45 --- /dev/null +++ b/src/components/sidebar/sidebar.init.ts @@ -0,0 +1,19 @@ +import HLX from '../../app/index.ts'; +import './sidebar.ts'; +import { isSidekickLibraryActive } from 'Helpers/sidekick/isSidekickLibraryActive.ts'; + +const addSidebarContainer = () => { + if (isSidekickLibraryActive()) return; + + const sidebarContainer = document.createElement('sidebar-component'); + sidebarContainer.setAttribute('id', 'sidebar'); + window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active'); + window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active'); + const main = document.getElementById('main'); + main?.after(sidebarContainer); +}; + +HLX.addLoadEagerTask(() => { + addSidebarContainer(); + return Promise.resolve(); +}); diff --git a/src/components/sidebar/sidebar.ts b/src/components/sidebar/sidebar.ts index 635461e8..a10e3410 100644 --- a/src/components/sidebar/sidebar.ts +++ b/src/components/sidebar/sidebar.ts @@ -11,6 +11,7 @@ import './sidebarNav.ts'; import './sidebarContact.ts'; import './sidebarPosts.ts'; import './sidebarFooter.ts'; + import { renderIcon } from '../icon/icon.template.ts'; @customElement('sidebar-component') diff --git a/src/main.ts b/src/main.ts index 1d1d75dd..6440e1de 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,30 +1,10 @@ -// const LCP_BLOCKS: string[] = []; // add your LCP blocks to the list - -import './components/sidebar/sidebar.ts'; +import './components/sidebar/sidebar.init.ts'; +import './components/innerContainer/innerContainer.init.ts'; import './components/header.ts'; import './components/icon/icon.ts'; -import './services/fetch.service.ts'; -import { BlockService } from './services/block.service.ts'; -import { SectionService } from './services/section.service.ts'; -import { MainService } from './services/main.service.ts'; - -// function preloadLcpImageCandidate() { -// const lcpCandidate = document.querySelector('main img') as HTMLImageElement | null; -// const linkTag = document.createElement('link'); -// linkTag.rel = 'preload'; -// linkTag.as = 'image'; -// linkTag.href = lcpCandidate?.src || ''; -// // linkTag.type = getLinkTypeFromImageExt(lcpCandidate?.src); -// document.head.appendChild(linkTag); -// } +import { initHLXApp } from './app/init.ts'; -(async function () { - // preloadLcpImageCandidate(); - const blockService = new BlockService(); - const sectionService = new SectionService(blockService); - const main = new MainService(sectionService, blockService); - await main.init(); -})(); +initHLXApp(); declare global { interface Window { diff --git a/src/services/fetch.service.ts b/src/services/fetch.service.ts index 604231a3..2aad62c7 100644 --- a/src/services/fetch.service.ts +++ b/src/services/fetch.service.ts @@ -1,3 +1,4 @@ +import { getUrlForEndpoint } from '../app/utils/getUrlForEndpoint'; import { RuntimeCache } from '../utils/RuntimeCache'; import { DebuggerService } from '@kluntje/services'; @@ -16,11 +17,11 @@ class FetchService { private runtimeCache = new RuntimeCache(); public fetchJson(endpoint: string, options: FetchServiceOptions = {}): Promise { - return this.fetchData(this.getCodeBasePath(endpoint), options, this.getResponseJSON); + return this.fetchData(getUrlForEndpoint(endpoint).href, options, this.getResponseJSON); } - public async fetchText(endpoint: string, options: FetchServiceOptions = {}): Promise { - return await this.fetchData(this.getCodeBasePath(endpoint), options, this.getResponseText); + public fetchText(endpoint: string, options: FetchServiceOptions = {}): Promise { + return this.fetchData(getUrlForEndpoint(endpoint).href, options, this.getResponseText); } private async fetchData( @@ -78,11 +79,6 @@ class FetchService { this.runtimeCache.set(url, data); } } - - private getCodeBasePath(endpoint: string): string { - const decoratedUrl = endpoint.startsWith('/') ? endpoint : `/${endpoint}`; - return `${window.hlx.codeBasePath}${decoratedUrl}`; - } } export default new FetchService(); diff --git a/src/services/main.service.ts b/src/services/main.service.ts index f537fb94..f5d73fab 100644 --- a/src/services/main.service.ts +++ b/src/services/main.service.ts @@ -4,6 +4,7 @@ import { getMetadata } from '../utils/getMetadata'; import { BlockService } from './block.service'; import { SectionService } from './section.service'; import { config } from '../../config.ts'; +import { getUrlForEndpoint } from '../app/utils/getUrlForEndpoint.ts'; import { DebuggerService } from '@kluntje/services'; import { getLocation } from 'Helpers/sidekick/getLocation.ts'; @@ -32,6 +33,7 @@ export class MainService { ) {} init = async () => { + console.log('MainService init'); this.setup(); await this.loadEager(); await this.loadLazy(); @@ -63,7 +65,7 @@ export class MainService { const main = document.querySelector('main'); if (main) { main.setAttribute('id', 'main'); - this.addSidebarContainer(main); + //this.addSidebarContainer(main); this.sectionService.init(main); this.addInnerContainer(main); // TODO refactor initializing this.blockService.decorateBlocks(main); @@ -86,16 +88,6 @@ export class MainService { } }; - private addSidebarContainer(main: HTMLElement) { - if (isSidekickLibraryActive()) return; - - const sidebarContainer = document.createElement('sidebar-component'); - sidebarContainer.setAttribute('id', 'sidebar'); - window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active'); - window.innerWidth <= 1280 ? sidebarContainer.classList.remove('active') : sidebarContainer.classList.add('active'); - main.after(sidebarContainer); - } - private addInnerContainer(main: HTMLElement) { const children = main.innerHTML; main.innerHTML = `
    ${isSidekickLibraryActive() ? `` : ``}${children}
    `; @@ -104,9 +96,9 @@ export class MainService { private loadLazy = async () => { const { lazyStylesScssPath, sidekickLibraryStylesScssPath, fontsScssPath } = config; try { - if (lazyStylesScssPath) await this.loadCSS(`${window.hlx.codeBasePath}/dist/lazyStyles/lazyStyles.css`); + if (lazyStylesScssPath) await this.loadCSS('/dist/lazyStyles/lazyStyles.css'); if (sidekickLibraryStylesScssPath && isSidekickLibraryActive()) { - await this.loadCSS(`${window.hlx.codeBasePath}/dist/sidekickLibraryStyles/sidekickLibraryStyles.css`); + await this.loadCSS('/dist/sidekickLibraryStyles/sidekickLibraryStyles.css'); } if (fontsScssPath) await this.loadFonts(); await this.loadBlocks(); @@ -115,6 +107,18 @@ export class MainService { } }; + /** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * @private + * @memberof MainService + * @returns {void} + * @example + * + * + * @example + * + */ private decorateTemplateAndTheme() { const template = getMetadata('template'); if (template) addClasses(document.body, template); @@ -155,7 +159,8 @@ export class MainService { block.element.dataset.blockStatus = Status.loading; try { - const blockModule = await import(`${window.hlx.codeBasePath}/dist/${block.name}/${block.name}.js`); + const { href } = getUrlForEndpoint(`dist/${block.name}/${block.name}.js`); + const blockModule = await import(href); if (blockModule.default) { await blockModule.default(block.element); @@ -171,7 +176,7 @@ export class MainService { async loadBlockStyles(block: BlockMapping) { try { - await this.loadCSS(`${window.hlx.codeBasePath}/dist/${block.name}/${block.name}.css`); + await this.loadCSS(`dist/${block.name}/${block.name}.css`); } catch (error) { //do nothing } @@ -182,16 +187,19 @@ export class MainService { } private async loadFonts() { - await this.loadCSS(`${window.hlx.codeBasePath}/dist/fonts/fonts.css`); + await this.loadCSS('dist/fonts/fonts.css'); try { if (!getLocation().hostname.includes('localhost')) sessionStorage.setItem('fonts-loaded', 'true'); } catch (e) { + console.error('Error setting fonts-loaded in session storage', e); // do nothing } } - private async loadCSS(href: string) { + private async loadCSS(endpoint: string) { return new Promise((resolve, reject) => { + const { href } = getUrlForEndpoint(endpoint); + if (!document.querySelector(`head > link[href="${href}"]`)) { const link = document.createElement('link'); link.rel = 'stylesheet'; diff --git a/src/services/section.service.ts b/src/services/section.service.ts index 8fe60544..676c540d 100644 --- a/src/services/section.service.ts +++ b/src/services/section.service.ts @@ -61,6 +61,7 @@ export class SectionService { section.dataset.sectionStatus = 'initialized'; section.style.display = 'none'; } + decorateImages() { const picture = document.querySelectorAll('.default-content-wrapper picture'); picture.forEach((item) => { diff --git a/src/utils/getMetadata.ts b/src/utils/getMetadata.ts index 3320d91d..c1c022e1 100644 --- a/src/utils/getMetadata.ts +++ b/src/utils/getMetadata.ts @@ -6,18 +6,18 @@ * @returns {string} - The content of the metadata tag, if found; otherwise, an empty string. * * @example - * // Example 1: - * // Assuming exists in the document head. + * Example 1: + * Assuming exists in the document head. * const metaContent = getMetadata('description'); * console.log(metaContent); - * // Output: 'This is a sample description.' + * Output: 'This is a sample description.' * * @example - * // Example 2: - * // Assuming exists in the document head. + * Example 2: + * Assuming exists in the document head. * const metaContent = getMetadata('og:title', document); * console.log(metaContent); - * // Output: 'Open Graph Title' + * Output: 'Open Graph Title' */ export function getMetadata(value: string, doc: Document = document): string { const attr: 'property' | 'name' = value && value.includes(':') ? 'property' : 'name'; diff --git a/types/config.d.ts b/types/config.d.ts index 1d6e9416..8db7c5cc 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -4,7 +4,11 @@ export interface Config { iconsDirPath: string; iconsTypesPath: string; fontsScssPath?: string; + fontsCssPath?: string; lazyStylesScssPath?: string; + lazyStylesCssPath?: string; sidekickLibraryStylesScssPath?: string; + sidekickLibraryStylesCssPath?: string; + lcpBlocks?: string[]; } export declare const config: Config; diff --git a/types/src/app/app.d.ts b/types/src/app/app.d.ts new file mode 100644 index 00000000..cee625e0 --- /dev/null +++ b/types/src/app/app.d.ts @@ -0,0 +1,27 @@ +type LifecycleCallback = () => void | Promise; +interface LifecycleCallbacks { + beforeInit?: LifecycleCallback; + afterInit?: LifecycleCallback; + beforeLoadEager?: LifecycleCallback; + afterLoadEager?: LifecycleCallback; + beforeLoadLazy?: LifecycleCallback; + afterLoadLazy?: LifecycleCallback; + beforeLoadDelayed?: LifecycleCallback; + afterLoadDelayed?: LifecycleCallback; +} +declare class App { + private beforeInit; + private afterInit; + private beforeLoadEager; + private afterLoadEager; + private beforeLoadLazy; + private afterLoadLazy; + private beforeLoadDelayed; + private afterLoadDelayed; + constructor({ beforeInit, afterInit, beforeLoadEager, afterLoadEager, beforeLoadLazy, afterLoadLazy, beforeLoadDelayed, afterLoadDelayed, }?: LifecycleCallbacks); + private init; + private loadEager; + private loadLazy; + private loadDelayed; +} +export default App; diff --git a/types/src/app/app.types.d.ts b/types/src/app/app.types.d.ts new file mode 100644 index 00000000..407a7928 --- /dev/null +++ b/types/src/app/app.types.d.ts @@ -0,0 +1,7 @@ +export type BlockMapping = { + name: string; + element: HTMLDivElement; +}; +export interface LcpCandidate extends HTMLElement { + complete: boolean; +} diff --git a/types/src/app/decorateBodyTag.d.ts b/types/src/app/decorateBodyTag.d.ts new file mode 100644 index 00000000..280a2af3 --- /dev/null +++ b/types/src/app/decorateBodyTag.d.ts @@ -0,0 +1,12 @@ +/** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * Usefull for styling the page based on the template and theme meta tags + * that can be set in the metadata table in EDS. + * @example + * + * + * @example + * + */ +export declare function decorateBodyTag(): void; diff --git a/types/src/app/index.d.ts b/types/src/app/index.d.ts new file mode 100644 index 00000000..449c3c8c --- /dev/null +++ b/types/src/app/index.d.ts @@ -0,0 +1,40 @@ +declare class HLX { + private beforeEagerCallbacks; + private loadEagerCallbacks; + private beforeLoadLazyCallbacks; + private loadLazyCallbacks; + private beforeLoadDelayedCallbacks; + private loadDelayedCallbacks; + private initializedCallbacks; + private beforeEagerPromise?; + private eagerPromise?; + private beforeLazyPromise?; + private lazyPromise?; + private beforeDelayedPromise?; + private delayedPromise?; + private initializedPromise?; + private get beforeEager(); + private get loadEager(); + private get beforeLoadLazy(); + private get loadLazy(); + private get beforeLoadDelayed(); + private get loadDelayed(); + private get initialized(); + addBeforeEagerTask(cb: () => Promise): void; + addLoadEagerTask(cb: () => Promise): void; + addBeforeLoadLazyTask(cb: () => Promise): void; + addLoadLazyTask(cb: () => Promise): void; + addBeforeLoadDelayedTask(cb: () => Promise): void; + addLoadDelayedTask(cb: () => Promise): void; + addInitializedTask(cb: () => Promise): void; + init(): Promise; + private beforeLoadEager; + private loadEagerPromise; + private beforeLoadLazyPromise; + private loadLazyPromise; + private beforeLoadDelayedPromise; + private loadDelayedPromise; + private getInitializedPromise; +} +declare const _default: HLX; +export default _default; diff --git a/types/src/app/init.d.ts b/types/src/app/init.d.ts new file mode 100644 index 00000000..7ad0e4b7 --- /dev/null +++ b/types/src/app/init.d.ts @@ -0,0 +1 @@ +export declare function initHLXApp(): void; diff --git a/types/src/app/setDocLanguage.d.ts b/types/src/app/setDocLanguage.d.ts new file mode 100644 index 00000000..e62d70e1 --- /dev/null +++ b/types/src/app/setDocLanguage.d.ts @@ -0,0 +1 @@ +export declare function setDocLanguage(): void; diff --git a/types/src/app/setupHlxObj.d.ts b/types/src/app/setupHlxObj.d.ts new file mode 100644 index 00000000..ef47eb0a --- /dev/null +++ b/types/src/app/setupHlxObj.d.ts @@ -0,0 +1 @@ +export default function setupHlxObj(mainScriptPath?: string): void; diff --git a/types/src/app/tasks/adjustMarkup.d.ts b/types/src/app/tasks/adjustMarkup.d.ts new file mode 100644 index 00000000..52a38680 --- /dev/null +++ b/types/src/app/tasks/adjustMarkup.d.ts @@ -0,0 +1,10 @@ +/** + * This function is used to adjust the markup of a section. + * It wraps the default content in a div with the class 'default-content-wrapper'. + * It also adds the class 'section' to the section element. + * It decorates the images in the default content by calling the 'decorateImages' function. + * It sets the 'data-section-status' attribute to 'initialized'. + * It hides the section element. + * @param section - The section element to adjust. + */ +export declare function adjustMarkup(section: HTMLDivElement): void; diff --git a/types/src/app/tasks/collectBlocks.d.ts b/types/src/app/tasks/collectBlocks.d.ts new file mode 100644 index 00000000..745a3adb --- /dev/null +++ b/types/src/app/tasks/collectBlocks.d.ts @@ -0,0 +1,11 @@ +import { BlockMapping } from '../app.types'; +/** + * Collect all blocks in a section. + * @param section - The section to collect the blocks from. + * @returns BlockMapping[] + * @example + * const blocks = collectBlocks(section); + * console.log(blocks); + * Output: [{ name: 'block1', element: HTMLElement }, { name: 'block2', element: HTMLElement }] + */ +export declare function collectBlocks(section: HTMLElement): BlockMapping[]; diff --git a/types/src/app/tasks/decorateBlocks.d.ts b/types/src/app/tasks/decorateBlocks.d.ts new file mode 100644 index 00000000..3d3bcb8b --- /dev/null +++ b/types/src/app/tasks/decorateBlocks.d.ts @@ -0,0 +1,5 @@ +/** + * Decorate blocks with classes and data attributes. + * @param main - Html main element + */ +export declare function decorateBlocks(main: HTMLElement): void; diff --git a/types/src/app/tasks/decorateBodyTag.d.ts b/types/src/app/tasks/decorateBodyTag.d.ts new file mode 100644 index 00000000..6012b166 --- /dev/null +++ b/types/src/app/tasks/decorateBodyTag.d.ts @@ -0,0 +1,12 @@ +/** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * Usefull for styling the page based on the template and theme meta tags + * that can be set in the metadata table in EDS. + * @example + * + * + * @example + * + */ +export declare function decorateTemplateAndTheme(): void; diff --git a/types/src/app/tasks/decorateButtons.d.ts b/types/src/app/tasks/decorateButtons.d.ts new file mode 100644 index 00000000..13df6ab6 --- /dev/null +++ b/types/src/app/tasks/decorateButtons.d.ts @@ -0,0 +1,5 @@ +/** + * Decorates paragraphs containing a single link as buttons. + * @param {Element} element container element + */ +export declare function decorateButtons(element: any): void; diff --git a/types/src/app/tasks/decorateImages.d.ts b/types/src/app/tasks/decorateImages.d.ts new file mode 100644 index 00000000..39c2032e --- /dev/null +++ b/types/src/app/tasks/decorateImages.d.ts @@ -0,0 +1 @@ +export declare function decorateImages(): void; diff --git a/types/src/app/tasks/decorateTemplateAndTheme.d.ts b/types/src/app/tasks/decorateTemplateAndTheme.d.ts new file mode 100644 index 00000000..6012b166 --- /dev/null +++ b/types/src/app/tasks/decorateTemplateAndTheme.d.ts @@ -0,0 +1,12 @@ +/** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * Usefull for styling the page based on the template and theme meta tags + * that can be set in the metadata table in EDS. + * @example + * + * + * @example + * + */ +export declare function decorateTemplateAndTheme(): void; diff --git a/types/src/app/tasks/initSampleRUM.d.ts b/types/src/app/tasks/initSampleRUM.d.ts new file mode 100644 index 00000000..eb7cbfcc --- /dev/null +++ b/types/src/app/tasks/initSampleRUM.d.ts @@ -0,0 +1 @@ +export declare function initSampleRUM(): void; diff --git a/types/src/app/tasks/loadBlock.d.ts b/types/src/app/tasks/loadBlock.d.ts new file mode 100644 index 00000000..7f9825fa --- /dev/null +++ b/types/src/app/tasks/loadBlock.d.ts @@ -0,0 +1,6 @@ +/** + * Load the block modules and styles for a section and show the section. + * @param section - The section to load the block modules and styles for. + * @returns Promise + */ +export declare function loadBlock(section: HTMLElement): Promise; diff --git a/types/src/app/tasks/loadBlockModules.d.ts b/types/src/app/tasks/loadBlockModules.d.ts new file mode 100644 index 00000000..5d780347 --- /dev/null +++ b/types/src/app/tasks/loadBlockModules.d.ts @@ -0,0 +1,2 @@ +import { BlockMapping } from '../app.types'; +export declare function loadBlockModules(block: BlockMapping): Promise; diff --git a/types/src/app/tasks/loadBlockStyles.d.ts b/types/src/app/tasks/loadBlockStyles.d.ts new file mode 100644 index 00000000..3bb032c5 --- /dev/null +++ b/types/src/app/tasks/loadBlockStyles.d.ts @@ -0,0 +1,7 @@ +import { BlockMapping } from '../app.types'; +/** + * Load the block styles. The styles should be named as the block name. + * @param block - The block to load the styles for. + * @returns Promise + */ +export declare function loadBlockStyles(block: BlockMapping): Promise; diff --git a/types/src/app/tasks/loadBlocks.d.ts b/types/src/app/tasks/loadBlocks.d.ts new file mode 100644 index 00000000..4f2d60cf --- /dev/null +++ b/types/src/app/tasks/loadBlocks.d.ts @@ -0,0 +1,6 @@ +/** + * Loads Blocks + * by getting all sections and load every block in every section + * and shows every section that is finished loading. + */ +export declare function loadBlocks(): Promise; diff --git a/types/src/app/tasks/loadCSS.d.ts b/types/src/app/tasks/loadCSS.d.ts new file mode 100644 index 00000000..c9931e87 --- /dev/null +++ b/types/src/app/tasks/loadCSS.d.ts @@ -0,0 +1,6 @@ +/** + * Load a CSS file if it is not already loaded append it to the head. + * @param endpoint - The endpoint of the CSS file. + * @returns Promise + */ +export declare function loadCSS(endpoint: string): Promise; diff --git a/types/src/app/tasks/loadFonts.d.ts b/types/src/app/tasks/loadFonts.d.ts new file mode 100644 index 00000000..5ce5d721 --- /dev/null +++ b/types/src/app/tasks/loadFonts.d.ts @@ -0,0 +1 @@ +export declare function loadFonts(): Promise; diff --git a/types/src/app/tasks/processSectionMetaData.d.ts b/types/src/app/tasks/processSectionMetaData.d.ts new file mode 100644 index 00000000..e02f0523 --- /dev/null +++ b/types/src/app/tasks/processSectionMetaData.d.ts @@ -0,0 +1 @@ +export declare function processSectionMetaData(section: HTMLElement): void; diff --git a/types/src/app/tasks/readBlockConfig.d.ts b/types/src/app/tasks/readBlockConfig.d.ts new file mode 100644 index 00000000..1478aea1 --- /dev/null +++ b/types/src/app/tasks/readBlockConfig.d.ts @@ -0,0 +1 @@ +export declare function readBlockConfig(block: Element): Record; diff --git a/types/src/app/tasks/sampleRUM.d.ts b/types/src/app/tasks/sampleRUM.d.ts new file mode 100644 index 00000000..76dcd7b0 --- /dev/null +++ b/types/src/app/tasks/sampleRUM.d.ts @@ -0,0 +1,10 @@ +/** + * log RUM if part of the sample. + * @param {string} checkpoint identifies the checkpoint in funnel + * @param {Object} data additional data for RUM sample + * @param {string} data.source DOM node that is the source of a checkpoint event, + * identified by #id or .classname + * @param {string} data.target subject of the checkpoint event, + * for instance the href of a link, or a search term + */ +export declare function sampleRUM(checkpoint: any, data?: {}): void; diff --git a/types/src/app/tasks/setDocLanguage.d.ts b/types/src/app/tasks/setDocLanguage.d.ts new file mode 100644 index 00000000..e62d70e1 --- /dev/null +++ b/types/src/app/tasks/setDocLanguage.d.ts @@ -0,0 +1 @@ +export declare function setDocLanguage(): void; diff --git a/types/src/app/tasks/setupHlxObj.d.ts b/types/src/app/tasks/setupHlxObj.d.ts new file mode 100644 index 00000000..ef47eb0a --- /dev/null +++ b/types/src/app/tasks/setupHlxObj.d.ts @@ -0,0 +1 @@ +export default function setupHlxObj(mainScriptPath?: string): void; diff --git a/types/src/app/tasks/showSection.d.ts b/types/src/app/tasks/showSection.d.ts new file mode 100644 index 00000000..c429a975 --- /dev/null +++ b/types/src/app/tasks/showSection.d.ts @@ -0,0 +1,5 @@ +/** + * Removes the display property from the section + * @param section - The section to show + */ +export declare function showSection(section: HTMLElement): void; diff --git a/types/src/app/tasks/transformSections.d.ts b/types/src/app/tasks/transformSections.d.ts new file mode 100644 index 00000000..d22142ab --- /dev/null +++ b/types/src/app/tasks/transformSections.d.ts @@ -0,0 +1,7 @@ +/** + * This function is used to transform the sections of the main element. + * It adjusts the markup of each section by calling the 'adjustMarkup' function. + * It processes the metadata of each section by calling the 'processSectionMetaData' function. + * @param main - The main element to transform. + */ +export declare function transformSection(main: HTMLElement): void; diff --git a/types/src/app/tasks/waitForLCP.d.ts b/types/src/app/tasks/waitForLCP.d.ts new file mode 100644 index 00000000..8ff013a0 --- /dev/null +++ b/types/src/app/tasks/waitForLCP.d.ts @@ -0,0 +1,6 @@ +/** + * Wait for the Largest Contentful Paint (LCP) candidate to be loaded. + * This function will load the modules and styles for the first section after the LCP candidate. + * @returns Promise + */ +export declare function waitForLCP(): Promise; diff --git a/types/src/app/utils/getHlxBaseUrl.d.ts b/types/src/app/utils/getHlxBaseUrl.d.ts new file mode 100644 index 00000000..2425e348 --- /dev/null +++ b/types/src/app/utils/getHlxBaseUrl.d.ts @@ -0,0 +1 @@ +export declare const getUrlForEndpoint: (endpoint: string) => URL; diff --git a/types/src/app/utils/getUrlForEndpoint.d.ts b/types/src/app/utils/getUrlForEndpoint.d.ts new file mode 100644 index 00000000..fcd85767 --- /dev/null +++ b/types/src/app/utils/getUrlForEndpoint.d.ts @@ -0,0 +1,10 @@ +/** + * Get the URL for an endpoint. + * @param endpoint - The endpoint. + * @returns URL + * @example + * const url = getUrlForEndpoint('block1/block1.css'); + * console.log(url); + * Output: URL { href: 'http://localhost:3000/block1/block1.css' } + */ +export declare const getUrlForEndpoint: (endpoint: string) => URL; diff --git a/types/src/components/innerContainer/innerContainer.d.ts b/types/src/components/innerContainer/innerContainer.d.ts new file mode 100644 index 00000000..b7d6052d --- /dev/null +++ b/types/src/components/innerContainer/innerContainer.d.ts @@ -0,0 +1 @@ +export declare function addInnerContainer(): void; diff --git a/types/src/components/innerContainer/innerContainer.init.d.ts b/types/src/components/innerContainer/innerContainer.init.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/types/src/components/innerContainer/innerContainer.init.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/types/src/components/sidebar/sidebar.init.d.ts b/types/src/components/sidebar/sidebar.init.d.ts new file mode 100644 index 00000000..1a9ec8ff --- /dev/null +++ b/types/src/components/sidebar/sidebar.init.d.ts @@ -0,0 +1 @@ +import './sidebar.ts'; diff --git a/types/src/main.d.ts b/types/src/main.d.ts index a792df4e..8e29a3e4 100644 --- a/types/src/main.d.ts +++ b/types/src/main.d.ts @@ -1,7 +1,7 @@ -import './components/sidebar/sidebar.ts'; +import './components/sidebar/sidebar.init.ts'; +import './components/innerContainer/innerContainer.init.ts'; import './components/header.ts'; import './components/icon/icon.ts'; -import './services/fetch.service.ts'; declare global { interface Window { hlx: { diff --git a/types/src/services/app.d.ts b/types/src/services/app.d.ts new file mode 100644 index 00000000..cee625e0 --- /dev/null +++ b/types/src/services/app.d.ts @@ -0,0 +1,27 @@ +type LifecycleCallback = () => void | Promise; +interface LifecycleCallbacks { + beforeInit?: LifecycleCallback; + afterInit?: LifecycleCallback; + beforeLoadEager?: LifecycleCallback; + afterLoadEager?: LifecycleCallback; + beforeLoadLazy?: LifecycleCallback; + afterLoadLazy?: LifecycleCallback; + beforeLoadDelayed?: LifecycleCallback; + afterLoadDelayed?: LifecycleCallback; +} +declare class App { + private beforeInit; + private afterInit; + private beforeLoadEager; + private afterLoadEager; + private beforeLoadLazy; + private afterLoadLazy; + private beforeLoadDelayed; + private afterLoadDelayed; + constructor({ beforeInit, afterInit, beforeLoadEager, afterLoadEager, beforeLoadLazy, afterLoadLazy, beforeLoadDelayed, afterLoadDelayed, }?: LifecycleCallbacks); + private init; + private loadEager; + private loadLazy; + private loadDelayed; +} +export default App; diff --git a/types/src/services/app/setupHlxObj.d.ts b/types/src/services/app/setupHlxObj.d.ts new file mode 100644 index 00000000..ef47eb0a --- /dev/null +++ b/types/src/services/app/setupHlxObj.d.ts @@ -0,0 +1 @@ +export default function setupHlxObj(mainScriptPath?: string): void; diff --git a/types/src/services/fetch.service.d.ts b/types/src/services/fetch.service.d.ts index f138f5e2..e5aa659c 100644 --- a/types/src/services/fetch.service.d.ts +++ b/types/src/services/fetch.service.d.ts @@ -15,7 +15,6 @@ declare class FetchService { private getResponseText; private getCachedData; private setCachedData; - private getCodeBasePath; } declare const _default: FetchService; export default _default; diff --git a/types/src/services/main.service.d.ts b/types/src/services/main.service.d.ts index 1f240972..b7307c6c 100644 --- a/types/src/services/main.service.d.ts +++ b/types/src/services/main.service.d.ts @@ -15,9 +15,20 @@ export declare class MainService { */ private setup; private loadEager; - private addSidebarContainer; private addInnerContainer; private loadLazy; + /** + * Decorates the template and theme by adding classes to the body. + * The classes are defined in the meta tags of the document. + * @private + * @memberof MainService + * @returns {void} + * @example + * + * + * @example + * + */ private decorateTemplateAndTheme; /** * Loads Blocks diff --git a/types/src/utils/getCodeBasePath.d.ts b/types/src/utils/getCodeBasePath.d.ts new file mode 100644 index 00000000..d3c37967 --- /dev/null +++ b/types/src/utils/getCodeBasePath.d.ts @@ -0,0 +1 @@ +export declare function getHlxCodeBasePath(): string; diff --git a/types/src/utils/getMetadata.d.ts b/types/src/utils/getMetadata.d.ts index d5d1f7f9..1dd82af1 100644 --- a/types/src/utils/getMetadata.d.ts +++ b/types/src/utils/getMetadata.d.ts @@ -6,17 +6,17 @@ * @returns {string} - The content of the metadata tag, if found; otherwise, an empty string. * * @example - * // Example 1: - * // Assuming exists in the document head. + * Example 1: + * Assuming exists in the document head. * const metaContent = getMetadata('description'); * console.log(metaContent); - * // Output: 'This is a sample description.' + * Output: 'This is a sample description.' * * @example - * // Example 2: - * // Assuming exists in the document head. + * Example 2: + * Assuming exists in the document head. * const metaContent = getMetadata('og:title', document); * console.log(metaContent); - * // Output: 'Open Graph Title' + * Output: 'Open Graph Title' */ export declare function getMetadata(value: string, doc?: Document): string;