{"version":3,"sources":["src/scripts/components/legacy-spacer.js"],"names":["$","jQuery","dimensionSpacer","length","window","width","each","hasClass","authorCardHeight","find","outerHeight","css","cardHeight","init","debouncedDimension","document","on","e","context"],"mappings":";;;;;;;AACA;;AADA,IAAIA,IAAIC,MAAR;;;AAGA,SAASC,eAAT,GAA2B;AACzB;AACA,MAAIF,EAAE,iBAAF,EAAqBG,MAArB,IAA+BH,EAAEI,MAAF,EAAUC,KAAV,KAAoB,IAAvD,EAA6D;AAC3DL,MAAE,iBAAF,EAAqBM,IAArB,CAA0B,YAAW;AACnC;AACA,UAAIN,EAAE,IAAF,EAAQO,QAAR,CAAiB,YAAjB,CAAJ,EAAoC;AAClC,YAAIC,mBAAmBR,EAAE,IAAF,EAAQS,IAAR,CAAa,cAAb,EAA6BC,WAA7B,EAAvB;AACAV,UAAE,IAAF,EAAQS,IAAR,CAAa,eAAb,EAA8BE,GAA9B,CAAkC,QAAlC,EAA4CH,mBAAmB,IAA/D;AACD;AACD;AAJA,WAKK,IAAGR,EAAE,IAAF,EAAQO,QAAR,CAAiB,QAAjB,CAAH,EAA+B;AAClC,cAAIK,UAAJ;AACA,cAAGZ,EAAE,IAAF,EAAQS,IAAR,CAAa,cAAb,EAA6BN,MAAhC,EAAwC;AACtCS,yBAAaZ,EAAE,IAAF,EAAQS,IAAR,CAAa,cAAb,EAA6BC,WAA7B,EAAb;AACD,WAFD,MAGK,IAAGV,EAAE,IAAF,EAAQS,IAAR,CAAa,mBAAb,EAAkCN,MAArC,EAA6C;AAChDS,yBAAaZ,EAAE,IAAF,EAAQS,IAAR,CAAa,mBAAb,EAAkCC,WAAlC,EAAb;AACD;;AAEDV,YAAE,IAAF,EAAQS,IAAR,CAAa,eAAb,EAA8BE,GAA9B,CAAkC,QAAlC,EAA4CC,aAAa,IAAzD;AACD;AACF,KAlBD;AAmBD;AACF;;AAGD,SAASC,IAAT,GAAgB;AACd,MAAIC,qBAAqB,yBAAS,YAAW;AAC3CZ;AACD,GAFwB,EAEtB,EAFsB,CAAzB;;AAIAA;;AAEAF,IAAEe,QAAF,EAAYC,EAAZ,CAAe,iBAAf,EAAkC,UAASC,CAAT,EAAYC,OAAZ,EAAqB;AACrDhB;AACD,GAFD;;AAIAF,IAAEI,MAAF,EAAUY,EAAV,CAAa,QAAb,EAAuBF,kBAAvB;AACD;;QAEQD,I,GAAAA,I","file":"legacy-spacer.js","sourcesContent":["var $ = jQuery;\nimport {debounce} from '../utils/utilities.js';\n\nfunction dimensionSpacer() {\n //if legacy article and desktop\n if ($('article._legacy').length && $(window).width() > 1023) {\n $('article._legacy').each(function() {\n //if commentary, apply the height of the author card\n if ($(this).hasClass('commentary')) {\n let authorCardHeight = $(this).find('.author-card').outerHeight();\n $(this).find('.body__spacer').css('height', authorCardHeight + 'px');\n }\n //if report, find the expert card or contributor card and assign height to spacer\n else if($(this).hasClass('report')) {\n var cardHeight;\n if($(this).find('.expert-card').length) {\n cardHeight = $(this).find('.expert-card').outerHeight();\n }\n else if($(this).find('.contributor-card').length) {\n cardHeight = $(this).find('.contributor-card').outerHeight();\n }\n\n $(this).find('.body__spacer').css('height', cardHeight + 'px');\n }\n });\n }\n}\n\n\nfunction init() {\n var debouncedDimension = debounce(function() {\n dimensionSpacer();\n }, 20);\n\n dimensionSpacer();\n\n $(document).on('newSectionAdded', function(e, context) {\n dimensionSpacer();\n });\n\n $(window).on('resize', debouncedDimension);\n}\n\nexport { init };\n"]}