{"version":3,"names":["focusElement","focusLastActiveElement","setTimeout","focus","$","on","document","activeElement","this","data","show","addClass","hasClass","css","height","overflow","modalid","attr","find","focusableElements","undefined","addEventListener","e","modal","querySelector","firstFocusableElement","querySelectorAll","focusableContent","lastFocusableElement","length","key","keyCode","shiftKey","preventDefault","closest","hide","removeClass","target","attachEventHandlerCustom","analytics","eventConfig","push","codeId","events","eventTarget","eventType","tags","componentId","componentName","elementText","destinationUrl","event","elementType","eventLabel","fileName","parentName","parentOrdinal","parentTitle","rule","value"],"sources":["assets/feature/pagecontent/CTACollection/js/_ctaCollectionModal.js"],"sourcesContent":["var focusElement;\r\n\r\nfunction focusLastActiveElement() {\r\n setTimeout(function () { focusElement.focus(); }, 500);\r\n}\r\n\r\n//modal clikc handler\r\n$(\".cardListModal_container__child a[data-toggle]\").on(\"click\", function () {\r\n focusElement = document.activeElement;\r\n $($(this).data(\"target\")).show();\r\n $($(this).data(\"target\")).addClass(\"animate\");\r\n $(\"body\").addClass(\"modal-open\");\r\n\r\n if ($('body').hasClass('modal-open')) {\r\n $('html').css({ 'height': '100%', 'overflow': 'hidden' });\r\n }\r\n\r\n $(\".modal-backdrop\").show();\r\n var modalid = $(this).attr('data-target');\r\n var modal = $(modalid);\r\n modal.find(\"button.close\").focus();\r\n \r\n if ($(\".cardListModal__popup.modal_container\").hasClass('animate')) {\r\n setTimeout(function () {\r\n // add all the elements inside modal which you want to make focusable\r\n var focusableElements = 'button:not(.d-none), [href], input:not([type=\"hidden\"]), select, textarea, [tabindex]:not([tabindex=\"-1\"])';\r\n \r\n if (modalid !== undefined) {\r\n document.addEventListener('keydown', function (e) {\r\n var modal = document.querySelector(modalid); // select the modal by it's id\r\n var firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal\r\n var focusableContent = modal.querySelectorAll(focusableElements);\r\n var lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal\r\n var isTabPressed = e.key === 'Tab' || e.keyCode === 9;\r\n if (!isTabPressed) {\r\n return;\r\n }\r\n if (e.shiftKey) { // if shift key pressed for shift + tab combination\r\n if (document.activeElement === firstFocusableElement) {\r\n lastFocusableElement.focus(); // add focus for the last focusable element\r\n e.preventDefault();\r\n }\r\n } else { // if tab key is pressed\r\n if (document.activeElement === lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab\r\n firstFocusableElement.focus(); // add focus for the first focusable element\r\n e.preventDefault();\r\n }\r\n }\r\n });\r\n\r\n }\r\n }, 1200);\r\n }\r\n});\r\n\r\n$(\".cardListModal__popup .close\").on(\"click\", function () {\r\n $(this).closest(\".modal_container\").hide();\r\n $(\".modal-backdrop\").hide();\r\n $(this).closest(\".modal_container\").removeClass(\"animate\");\r\n $(\"body\").removeClass(\"modal-open\");\r\n\r\n if (!$('body').hasClass('modal-open')) {\r\n $('html').css({ 'height': 'unset', 'overflow': 'unset' });\r\n }\r\n\r\n focusLastActiveElement();\r\n});\r\n\r\n$(\".cardListModal__popup\").on(\"click\", function (e) {\r\n if (!$(e.target).closest(\".modal_body\").length) {\r\n attachEventHandlerCustom(\".cardListModal__popup\", \"backdropClick\", true);\r\n $(\".modal_container\").hide();\r\n $(\".modal-backdrop\").hide();\r\n $(\".modal_container\").removeClass(\"animate\");\r\n $(\"body\").removeClass(\"modal-open\");\r\n\r\n if (!$('body').hasClass('modal-open')) {\r\n $('html').css({ 'height': 'unset', 'overflow': 'unset' });\r\n }\r\n\r\n focusLastActiveElement();\r\n }\r\n});\r\n\r\n/*Analytics*/\r\nanalytics.eventConfig.push({\r\n \"target\": \".cardListModal_container\",\r\n \"codeId\": \"C04\",\r\n \"events\": [\r\n {\r\n \"eventTarget\": \".cardListModal_container__child a:not([href*=\\\\http])\",\r\n \"eventType\": \"click\",\r\n \"tags\": {\r\n \"componentId\": \"c04\",\r\n \"componentName\": \"lightbox\",\r\n \"elementText\": \"\",\r\n \"destinationUrl\": \"\",\r\n \"event\": \"navigation\",\r\n \"eventType\": \"lightbox load click\",\r\n \"elementType\": \"lightbox link\",\r\n \"eventLabel\": \"\",\r\n \"fileName\": \"\",\r\n \"parentName\": \"Card List Modal collection\",\r\n \"parentOrdinal\": \"\",\r\n \"parentTitle\": \"\"\r\n }\r\n },\r\n // need to check if this is needed\r\n {\r\n \"eventTarget\": \".cardListModal_container__child.cardListModal_link a[href^=http]\",\r\n \"eventType\": \"click\",\r\n \"tags\": {\r\n \"event\": [\r\n {\r\n \"rule\": \"$(context).prop('hostname') !== window.location.hostname\",\r\n \"value\": \"outbound\"\r\n },\r\n {\r\n \"rule\": \"true\",\r\n \"value\": \"navigation\"\r\n }\r\n ],\r\n \"eventType\": [\r\n {\r\n \"rule\": \"$(context).prop('hostname') !== window.location.hostname\",\r\n \"value\": \"lightbox load outbound click\"\r\n },\r\n {\r\n \"rule\": \"true\",\r\n \"value\": \"lightbox load internal navigation click\"\r\n }\r\n ],\r\n\r\n \"componentName\": \"lightbox\",\r\n \"componentId\": \"c04\",\r\n \"elementType\": \"lightbox link\",\r\n \"elementText\": \"\",\r\n \"eventLabel\": \"\",\r\n \"fileName\": \"\",\r\n \"destinationUrl\": \"\",\r\n \"parentName\": \"Card List Modal collection\",\r\n \"parentOrdinal\": \"\",\r\n \"parentTitle\": \"\"\r\n }\r\n },\r\n // clicking the close icon\r\n {\r\n \"eventTarget\": \".cardListModal__popup .close\",\r\n \"eventType\": \"click\",\r\n \"tags\": {\r\n \"componentId\": \"c04\",\r\n \"componentName\": \"lightbox\",\r\n \"elementText\": \"\",\r\n \"destinationUrl\": \"\",\r\n \"event\": \"navigation\",\r\n \"eventType\": \"lightbox exit click\",\r\n \"elementType\": \"x out icon\",\r\n \"fileName\": \"\",\r\n \"parentName\": \"Card List Modal collection\",\r\n \"parentOrdinal\": \"\",\r\n \"parentTitle\": \"\"\r\n }\r\n },\r\n ]\r\n}, {\r\n \"target\": \".cardListModal__popup\",\r\n \"codeId\": \"C04\",\r\n \"events\": [\r\n {\r\n \"eventTarget\": \"backdropClick\",\r\n \"eventType\": \"click\",\r\n \"tags\": {\r\n \"componentId\": \"c04\",\r\n \"componentName\": \"lightbox\",\r\n \"elementText\": \"\",\r\n \"destinationUrl\": \"\",\r\n \"event\": \"navigation\",\r\n \"eventType\": \"lightbox exit click\",\r\n \"elementType\": \"outside click\",\r\n \"fileName\": \"\",\r\n \"parentName\": \"Card List Modal collection\",\r\n \"parentOrdinal\": \"\",\r\n \"parentTitle\": \"\"\r\n }\r\n },\r\n ]\r\n});"],"mappings":"AAAA,IAAIA,aAEJ,SAASC,yBACLC,YAAW,WAAcF,aAAaG,OAAS,GAAG,IACtD,CAGAC,EAAE,kDAAkDC,GAAG,SAAS,WAC5DL,aAAeM,SAASC,cACxBH,EAAEA,EAAEI,MAAMC,KAAK,WAAWC,OAC1BN,EAAEA,EAAEI,MAAMC,KAAK,WAAWE,SAAS,WACnCP,EAAE,QAAQO,SAAS,cAEfP,EAAE,QAAQQ,SAAS,eACnBR,EAAE,QAAQS,IAAI,CAAEC,OAAU,OAAQC,SAAY,WAGlDX,EAAE,mBAAmBM,OACrB,IAAIM,EAAUZ,EAAEI,MAAMS,KAAK,eACfb,EAAEY,GACRE,KAAK,gBAAgBf,QAEvBC,EAAE,yCAAyCQ,SAAS,YACpDV,YAAW,WAEP,IAAIiB,EAAoB,kHAERC,IAAZJ,GACAV,SAASe,iBAAiB,WAAW,SAAUC,GAC3C,IAAIC,EAAQjB,SAASkB,cAAcR,GAC/BS,EAAwBF,EAAMG,iBAAiBP,GAAmB,GAClEQ,EAAmBJ,EAAMG,iBAAiBP,GAC1CS,EAAuBD,EAAiBA,EAAiBE,OAAS,IACzC,QAAVP,EAAEQ,KAA+B,IAAdR,EAAES,WAIpCT,EAAEU,SACE1B,SAASC,gBAAkBkB,IAC3BG,EAAqBzB,QACrBmB,EAAEW,kBAGF3B,SAASC,gBAAkBqB,IAC3BH,EAAsBtB,QACtBmB,EAAEW,kBAGd,GAGR,GAAG,KAEX,IAEA7B,EAAE,gCAAgCC,GAAG,SAAS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