{"version":3,"file":"script.min.js","sources":["../../../../block-editor/blocks/header/script.js"],"sourcesContent":["export function init( node ) {\n\n\tconst nextBlock = node.nextElementSibling;\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tlet blockStyle = nextBlock.currentStyle || window.getComputedStyle(nextBlock);\n\t//calculate height of next element\n\tlet blockHeight = parseInt(blockStyle.height);\n\n\t//gutterHeight should equal double the padding of the nextBlock if padding exists OR set to 3.5rem - this is double the gutter\n\tlet gutterHeight;\n\n\t//use gutter css variable if padding doesn't exist on element\n\tconst defaultGutter = parseFloat(window.getComputedStyle(document.body).getPropertyValue('--wp--custom--gutter')) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);\n\tlet topPadding = parseInt(blockStyle.paddingTop);\n\tlet bottomPadding = parseInt(blockStyle.paddingBottom);\n\n\tif(topPadding > 0 || bottomPadding > 0) {\n\t\tgutterHeight = topPadding + bottomPadding;\n\t} else {\n\t\tgutterHeight = defaultGutter;\n\t}\n\n\tlet isGreater768 = document.body.clientWidth >= 768;\n\tconst matchMedia = window.matchMedia(\"(min-width: 768px)\");\n\n\tmatchMedia.addEventListener('change', ()=> {\n\t\tisGreater768 = document.body.clientWidth >= 768;\n\t\tblockSettings();\n\t});\n\n\tconst blockSettings = () => {\n\t\tif(isGreater768) {\n\t\t\t//apply blockHeight value to node as padding minus gutterHeight\n\t\t\tnode.style.paddingBottom = blockHeight - gutterHeight + 'px';\n\n\t\t\t//apply blockHeight value to nextBlock as negative margin minus gutterHeight\n\t\t\tnextBlock.style.marginTop = ((blockHeight - gutterHeight)*-1) + 'px';\n\n\t\t\t//add gutterHeight margin bottom to nextBlock\n\t\t\tnextBlock.style.marginBottom = (gutterHeight * -1) + 'px';\n\t\t} else {\n\t\t\tnode.removeAttribute('style');\n\t\t\tnextBlock.removeAttribute('style');\n\t\t}\n\t}\n\n\tblockSettings();\n\n\treturn node;\n\n}\n\n\nexport const instances = Array.from( document.querySelectorAll( '.split-header.has-include-next-block' ) ).map( init );\n"],"names":["init","node","nextBlock","nextElementSibling","gutterHeight","blockStyle","currentStyle","window","getComputedStyle","blockHeight","parseInt","height","defaultGutter","parseFloat","document","body","getPropertyValue","documentElement","fontSize","topPadding","paddingTop","bottomPadding","paddingBottom","isGreater768","clientWidth","matchMedia","addEventListener","blockSettings","style","marginTop","marginBottom","removeAttribute","instances","Array","from","querySelectorAll","map"],"mappings":"0GAAO,SAASA,EAAMC,GAErB,MAAMC,EAAaD,EAAKE,mBAExB,IAAOF,EACN,OAGD,IAKIG,EALAC,EAAaH,EAAUI,cAAgBC,OAAOC,iBAAiBN,GAE/DO,EAAcC,SAASL,EAAWM,QAMtC,MAAMC,EAAgBC,WAAWN,OAAOC,iBAAiBM,SAASC,MAAMC,iBAAiB,yBAA2BH,WAAWN,OAAOC,iBAAiBM,SAASG,iBAAiBC,UACjL,IAAIC,EAAaT,SAASL,EAAWe,YACjCC,EAAgBX,SAASL,EAAWiB,eAGvClB,EADEe,EAAa,GAAKE,EAAgB,EACrBF,EAAaE,EAEbT,EAGhB,IAAIW,EAAeT,SAASC,KAAKS,aAAe,IAC7BjB,OAAOkB,WAAW,sBAE1BC,iBAAiB,UAAU,KACrCH,EAAeT,SAASC,KAAKS,aAAe,IAC5CG,GAAe,IAGhB,MAAMA,EAAgBA,KAClBJ,GAEFtB,EAAK2B,MAAMN,cAAgBb,EAAcL,EAAe,KAGxDF,EAAU0B,MAAMC,WAA2C,GAA7BpB,EAAcL,GAAoB,KAGhEF,EAAU0B,MAAME,cAAgC,EAAhB1B,EAAqB,OAErDH,EAAK8B,gBAAgB,SACrB7B,EAAU6B,gBAAgB,SAC3B,EAKD,OAFAJ,IAEO1B,CAER,OAGa+B,EAAYC,MAAMC,KAAMpB,SAASqB,iBAAkB,yCAA2CC,IAAKpC"}