{"version":3,"file":"index.es.min.js","sources":["../../../packages/helpers/src/props.helpers.js","../../../packages/page-builder-sections/src/hero/hero.js","../../../packages/helpers/src/dataset.helpers.js"],"sourcesContent":["const getData = attributes => attributes.find(attribute => attribute.nodeName === 'data')\n\nconst createProps = attributes => {\n    const data = getData([...attributes])\n    const props = [...attributes]\n        .filter(attribute => attribute.nodeName !== 'data')\n        .reduce((all, attr) => {\n            return { ...all, [attr.nodeName]: attr.nodeValue }\n        }, {})\n\n    if (isNil(data)) {\n        return props\n    }\n\n    try {\n        return { ...props, ...JSON.parse(data.nodeValue) }\n    } catch (error) {\n        console.log('ERROR: No data', error, data?.nodeValue)\n    }\n}\n\nconst isNil = obj => obj === undefined || obj === null\n\nexport const parseBool = value => (!value || value === 'false' ? false : true)\n\nexport default createProps\n","import createProps from '@kissui/helpers/src/props.helpers'\nimport { projectHasNextSibling } from '@kissui/helpers/src/dataset.helpers'\n\nclass Hero extends HTMLElement {\n    constructor() {\n        super()\n    }\n\n    connectedCallback() {\n        this.props = createProps(this.attributes)\n        this.render()\n        this.setExtraPaddingForPlpFilter()\n    }\n\n    render() {\n        const {\n            campaign = {},\n            campaign_id = '',\n            campaign_name = '',\n            campaign_position = '',\n            campaign_creative = '',\n            contrast,\n            padding_top = 'pt9',\n            padding_bottom = 'pb9',\n            heading = '',\n            sub_heading = '',\n            a11y_heading = '',\n            description = '',\n            background_retina = '',\n            background_desktop = '',\n            background_mobile = ''\n        } = this.props\n        const { id = '', name = '', position = '', creative = '' } = campaign\n\n        this.innerHTML = `\n            <nb-container\n                contrast='${contrast}'\n                classname='${padding_top} ${padding_bottom}'\n                background_mobile='${background_mobile}'\n                background_desktop='${background_desktop}'\n                background_retina='${background_retina}'\n                campaign_id='${id ? id : campaign_id}'\n                campaign_name='${name ? name : campaign_name}'\n                campaign_position='${position ? position : campaign_position}'\n                campaign_creative='${creative ? creative : campaign_creative}'\n                lazy_load=\"false\"\n            >\n                ${sub_heading && `<h3>${sub_heading}</h1>`}\n                ${heading && `<h1 class='h-3xl-700'>${heading}</h1>`}\n                ${a11y_heading && `<span class='sr-only'>${a11y_heading}</span>`}\n                ${description && `<p class='t-md-400-sl'>${description}</p>`}\n            </nb-container>\n        `\n    }\n\n    setExtraPaddingForPlpFilter() {\n        if (projectHasNextSibling(this, 'nb-plp')) {\n            this.classList.add('hasPlpAfter')\n        }\n    }\n}\n\ncustomElements.get('nb-hero') || customElements.define('nb-hero', Hero)\n\nexport default Hero\n","export const projectHasNextSibling = (currentComponent, tagName) => {\n    // Todo : only for storybook\n    if (window.nwc == null) {\n        return (\n            currentComponent.nextElementSibling != null &&\n            currentComponent.nextElementSibling.tagName.toLowerCase() === tagName\n        )\n    }\n    // For production\n    let currentIndex = -1\n    const project = window.nwc.projects.find(project => {\n        currentIndex = project.components.findIndex(\n            component => component.uuid === currentComponent.id\n        )\n        return currentIndex !== -1\n    })\n    return (\n        project &&\n        project.components.find(\n            (component, index) => component.module === tagName && index === currentIndex + 1\n        ) != null\n    )\n}\n"],"names":["isNil","obj","Hero","HTMLElement","constructor","connectedCallback","props","attributes","data","find","attribute","nodeName","getData","filter","reduce","all","attr","nodeValue","JSON","parse","error","console","log","createProps","this","render","setExtraPaddingForPlpFilter","campaign","campaign_id","campaign_name","campaign_position","campaign_creative","contrast","padding_top","padding_bottom","heading","sub_heading","a11y_heading","description","background_retina","background_desktop","background_mobile","id","name","position","creative","innerHTML","projectHasNextSibling","currentComponent","tagName","window","nwc","nextElementSibling","toLowerCase","currentIndex","project","projects","components","findIndex","component","uuid","index","module","classList","add","customElements","get","define"],"mappings":"AAAA,MAqBMA,EAAQC,GAAoC,MAARA,EClB1C,MAAMC,UAAaC,YACfC,WAAAA,UAEA,CAEAC,iBAAAA,GACSC,KAAAA,MDPOC,CAAAA,IACVC,MAAAA,EAHMD,CAAAA,GAAcA,EAAWE,MAAKC,GAAoC,SAAvBA,EAAUC,WAGpDC,CAAQ,IAAIL,IACnBD,EAAQ,IAAIC,GACbM,QAAOH,GAA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