{"version":3,"file":"content-social.js","names":["a1ContentSocial","SesoContentSocial","constructor","selector","this","el","wrapper","HTMLElement","document","getElementById","querySelector","cookieHint","undefined","socialEmbed","params","classHidden","cookieSocialName","cookieAlertBoxClosedName","cookieAlertBoxClosedValue","socialCookieValue","socialCookieGroups","socialCookiePart","initContentSocial","body","classList","contains","showSocialContent","window","setInterval","checkCookie","bind","lastAlertBoxClosedCookie","currentAlertBoxClosedCookie","String","cookie","match","lastSocialCookie","currentSocialCookie","split","length","getSocialCookieValue","manageSocialContentView","i","indexOf","substring","hideSocialContent","remove","add","addEventListener","querySelectorAll","forEach","fragment"],"sources":["content-social.js"],"mappings":"AACA,GAA+B,oBAApBA,gBAAiC,CACxC,MAAMC,EAAoB,MACtBC,YAAYC,GACRC,KAAKC,GAAK,CAAC,EACXD,KAAKC,GAAGC,QAAUH,aAAoBI,YAChCJ,EAEEK,SAASC,eAAeN,IACrBK,SAASE,cAAcP,GAGlCC,KAAKC,GAAGM,WAAaP,KAAKC,GAAGC,QAAQI,cAAc,qCAC7CN,KAAKC,GAAGC,QAAQI,cAAc,0CAC9BE,EAENR,KAAKC,GAAGQ,YAAcT,KAAKC,GAAGC,QAAQI,cAAc,+BAC9CN,KAAKC,GAAGC,QAAQI,cAAc,oCAC9BE,EAENR,KAAKU,OAAS,CACVC,YAAa,YACbC,iBAAkB,iBAClBC,yBAA0B,wBAC1BC,0BAA2B,GAC3BC,kBAAmB,GACnBC,mBAAoB,SACpBC,iBAAkB,WAGtBjB,KAAKkB,mBACT,CAEAA,oBAESd,SAASe,KAAKC,UAAUC,SAAS,sBAMlCrB,KAAKsB,oBAHLC,OAAOC,YAAYxB,KAAKyB,YAAYC,KAAK1B,MAAO,IAKxD,CAEAyB,cACI,IAAIV,EAAoB,IAExB,MAAMY,EAA2B3B,KAAKU,OAAOI,0BACvCc,EAA8BC,OAAOzB,SAAS0B,OAAOC,MAAM,UAAU/B,KAAKU,OAAOG,0CAEjFmB,EAAmBhC,KAAKU,OAAO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c,sBAC1E,GAAE,GAEV","sourcesContent":["// seso content social\nif (typeof a1ContentSocial === 'undefined') {\n const SesoContentSocial = class {\n constructor(selector) {\n this.el = {};\n this.el.wrapper = selector instanceof HTMLElement\n ? selector\n : (\n document.getElementById(selector)\n || document.querySelector(selector)\n );\n\n this.el.cookieHint = this.el.wrapper.querySelector('.js-a1-content-social-cookie-hint')\n ? this.el.wrapper.querySelector('.js-a1-content-social-cookie-hint')\n : undefined;\n\n this.el.socialEmbed = this.el.wrapper.querySelector('.js-a1-content-social-embed')\n ? this.el.wrapper.querySelector('.js-a1-content-social-embed')\n : undefined;\n\n this.params = {\n classHidden: 'is-hidden',\n cookieSocialName: 'OptanonConsent',\n cookieAlertBoxClosedName: 'OptanonAlertBoxClosed',\n cookieAlertBoxClosedValue: '',\n socialCookieValue: '',\n socialCookieGroups: 'groups',\n socialCookiePart: '%2C8%3A' // group 8 for social media cookies\n };\n\n this.initContentSocial();\n }\n\n initContentSocial() {\n // if edit mode -> show embed, dont show cookie hint\n if (!document.body.classList.contains('has-edit-mode-menu')) {\n // if not edit mode\n // check cookies\n window.setInterval(this.checkCookie.bind(this), 250);\n } else {\n // is edit mode -> show social content\n this.showSocialContent();\n }\n }\n\n checkCookie() {\n let socialCookieValue = '0';\n\n const lastAlertBoxClosedCookie = this.params.cookieAlertBoxClosedValue;\n const currentAlertBoxClosedCookie = String(document.cookie.match('(^|;) ?' + this.params.cookieAlertBoxClosedName + '=([^;]*)(;|$)'));\n\n const lastSocialCookie = this.params.socialCookieValue;\n const currentSocialCookie = String(document.cookie.match('(^|;) ?' + this.params.cookieSocialName + '=([^;]*)(;|$)'));\n\n if ((currentAlertBoxClosedCookie !== null && currentAlertBoxClosedCookie !== lastAlertBoxClosedCookie)\n || (currentSocialCookie !== 'null' && currentSocialCookie !== lastSocialCookie)) {\n this.params.cookieAlertBoxClosedValue = currentAlertBoxClosedCookie;\n this.params.socialCookieValue = currentSocialCookie;\n\n // check social cookie\n if (currentSocialCookie !== 'null') {\n const socialCookieGroups = currentSocialCookie.split('&');\n\n if (socialCookieGroups.length > 1) {\n socialCookieValue = this.getSocialCookieValue(socialCookieGroups);\n }\n }\n // manage social content view if settings have changed\n this.manageSocialContentView(socialCookieValue);\n }\n }\n\n getSocialCookieValue(socialCookieGroups) {\n let i = 0;\n let socialCookieValue = '0';\n\n for (i = 0; i < socialCookieGroups.length; i++) {\n if (socialCookieGroups[i].indexOf(this.params.socialCookieGroups) >= 0) {\n const socialCookieParts = socialCookieGroups[i].split(this.params.socialCookiePart);\n socialCookieValue = socialCookieParts[1].substring(0, 1);\n break;\n }\n }\n\n return socialCookieValue;\n }\n\n manageSocialContentView(socialCookieValue) {\n if (typeof socialCookieValue !== 'undefined' && socialCookieValue == '1') {\n // if cookies for social media are allowed\n this.showSocialContent();\n } else {\n // if social media cookies are blocked\n this.hideSocialContent();\n }\n }\n\n hideSocialContent() {\n this.el.cookieHint.classList.remove(this.params.classHidden);\n this.el.socialEmbed.classList.add(this.params.classHidden);\n }\n\n showSocialContent() {\n this.el.cookieHint.classList.add(this.params.classHidden);\n this.el.socialEmbed.classList.remove(this.params.classHidden);\n }\n };\n\n if (typeof window !== 'undefined') {\n window.a1ContentSocial = SesoContentSocial;\n }\n\n window.addEventListener('load', () => {\n // content-social\n document.querySelectorAll('a1-fragment[name=\"content-social\"]').forEach(function(fragment) {\n // params: selector\n window.a1ContentSocial = new SesoContentSocial(fragment.querySelector('.a1-content-social'));\n });\n });\n}\n"]}