{"version":3,"file":"view-script.min.js","sources":["../../../../assets/js/modules/animations/_util.js","../../../../assets/js/modules/animations/_block.js","../../../../assets/js/modules/animations/_image.js","../../../../block-editor/blocks/person-header/view-script.js","../../../../assets/js/modules/animations/_words.js"],"sourcesContent":["/**\n * Basic dom node selector\n *\n * @param {String|Array|NodeList|HTMLElement} selector what nodes to select\n * @returns {Array[HTMLElement]}\n */\nexport function select( selector ) {\n\tlet nodes = [];\n\n\tif ( Array.isArray( selector ) ) {\n\t\tnodes = selector;\n\t} else if ( selector instanceof NodeList ) {\n\t\tnodes = Array.from( selector );\n\t} else if ( selector instanceof HTMLElement ) {\n\t\tnodes = [ selector ];\n\t} else if ( typeof selector === 'string' ) {\n\t\tnodes = Array.from( document.querySelectorAll( selector ) );\n\t} else {\n\t\tconsole.error( \"Invalid node selector\", selector );\n\t}\n\n\tnodes = nodes.filter( node => node instanceof HTMLElement );\n\n\treturn nodes;\n}\n\n/**\n * Observe an elements scroll position and resolve a promise after it's passed it's threshold visibility\n *\n * @param {HTMLElement} node the element to observe it's scroll position\n * @param {Object} opts\n * @returns {Promise}\n */\nexport function observe( node, opts = { threshold: 50 } ) {\n\treturn new Promise(( resolve, reject ) => {\n\t\tlet threshold = parseFloat( opts.threshold );\n\n\t\tif ( isNaN( threshold ) ) {\n\t\t\tthreshold = 50;\n\t\t}\n\n\t\tthreshold = Math.min( 100, Math.max( 0, threshold ) ) / 100;\n\n\t\tconst observer = new IntersectionObserver(\n\t\t\t(entries) => {\n\t\t\t\tentries.forEach( entry => {\n\t\t\t\t\tif ( entry.isIntersecting ) {\n\t\t\t\t\t\tresolve( entry );\n\t\t\t\t\t\tobserver.disconnect();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t{\n\t\t\t\tthreshold,\n\t\t\t}\n\t\t);\n\n\t\tobserver.observe( node );\n\t});\n}\n\n/**\n * Normalize a duration variable that defaults to ms without a time unit\n *\n * @param {Number|String} duration\n * @returns {String}\n */\nexport function parseDuration( duration ) {\n\tif ( Number.isInteger( duration ) || ! isNaN( parseFloat( duration ) ) ) {\n\t\treturn `${duration}ms`;\n\t}\n\n\treturn duration;\n}\n\n","import { select, observe, parseDuration } from './_util.js';\n\n/**\n * Reveal an entire block when visible\n *\n * @param {String|Array|NodeList|HTMLElement} selector\n * @param {object} opts\n * @returns {Array}\n */\nexport function block( selector, opts = {} ) {\n\topts = {\n\t\tdelay: 10,\n\t\tduration: null,\n\t\t...opts\n\t}\n\n\treturn select( selector ).forEach( ( node ) => {\n\t\tnode.classList.add('animated-block');\n\n\t\tif ( opts.duration ) {\n\t\t\tnode.style.animationDuration = parseDuration( opts.duration );\n\t\t}\n\n\t\tobserve( node ).then( () => setTimeout( () => node.classList.add('animated-block--active'), opts.delay ) );\n\t} );\n}\n","import { select, observe, parseDuration } from './_util.js';\n\n/**\n * Animate an image using the slide up color wash\n *\n * @param {String|Array|NodeList|HTMLElement} selector\n * @param {object} opts\n * @returns {Array}\n */\nexport function image( selector, opts = {} ) {\n\topts = {\n\t\tdelay: 1,\n\t\tduration: null,\n\t\t...opts\n\t}\n\n\treturn select( selector ).forEach( ( node ) => {\n\t\tnode.classList.add( 'animated-image' );\n\n\t\tlet wash = node.querySelector( '.animated-image__wash' );\n\n\t\tif ( ! wash ) {\n\t\t\twash = document.createElement( 'div' );\n\t\t\twash.classList.add( 'animated-image__wash' );\n\t\t\tnode.appendChild( wash );\n\t\t}\n\n\t\tif ( opts.duration ) {\n\t\t\tnode.style.animationDuration = parseDuration( opts.duration );\n\t\t}\n\n\t\tobserve( node ).then( () => setTimeout( () => node.classList.add( 'animated-image--active' ), opts.delay ) );\n\t} );\n}\n","import { words, image, block } from '../../../assets/js/modules/_animations.js';\n\nimage( '.person-header .person-header__image figure' );\nwords( '.person-header .wp-block-post-title', { delay: 400 } );\nblock( '.person-header .breadcrumb', { delay: 1200 } );\nblock( '.person-header .person-title', { delay: 1200 } );\nblock( '.person-header .person-contact', { delay: 1200 } );\nblock( '.person-header .person-header__terms', { delay: 1200 } );\n","import { select, observe, parseDuration } from './_util.js';\n\n/**\n * Parse text nodes and wrap each word with a span\n *\n * @param {HTMLElement} node\n */\nfunction prepare( node ) {\n\tnode.classList.add( 'animated-words' );\n\tnode.childNodes.forEach( child => {\n\t\tswitch ( child.nodeType ) {\n\t\t\tcase 3: // Text\n\t\t\t\tconst masks = child.textContent.split( ' ' ).reduce(\n\t\t\t\t\t( masks, word, wordIndex ) => {\n\t\t\t\t\t\tif ( wordIndex > 0 ) {\n\t\t\t\t\t\t\tmasks.push( document.createTextNode( ' ' ) );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst mask = document.createElement( 'span' );\n\t\t\t\t\t\tmask.classList.add( 'animated-words__mask' );\n\n\t\t\t\t\t\tconst wordNode = document.createElement( 'span' );\n\t\t\t\t\t\twordNode.classList.add( 'animated-words__word' );\n\t\t\t\t\t\twordNode.appendChild( document.createTextNode( word ) );\n\n\t\t\t\t\t\tmask.appendChild( wordNode );\n\t\t\t\t\t\tmasks.push( mask );\n\n\t\t\t\t\t\treturn masks;\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\n\t\t\t\tnode.removeChild( child );\n\t\t\t\tmasks.forEach( mask => node.appendChild( mask ) );\n\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tprepareWordsNode( child );\n\t\t\tbreak;\n\t\t}\n\t} );\n}\n\n/**\n * Animate each word of a node in individually\n *\n * @param {String|Array|NodeList|HTMLElement} selector\n * @param {Object} opts\n * @returns {Array}\n */\nexport function words( selector, opts = {} ) {\n\topts = {\n\t\tdelay: 200,\n\t\tinterval: 100,\n\t\tduration: null,\n\t\tthreshold: 50,\n\t\t...opts\n\t};\n\n\treturn select( selector ).map( ( node ) => {\n\t\tprepare( node );\n\n\t\tconst words = node.querySelectorAll( '.animated-words__word' );\n\n\t\tif ( opts.duration ) {\n\t\t\topts.duration = parseDuration( opts.duration );\n\t\t\twords.forEach( word => word.style.animationDuration = opts.duration );\n\t\t}\n\n\t\treturn observe( node, { threshold: opts.threshold } ).then( () => {\n\t\t\tsetTimeout(\n\t\t\t\t() => {\n\t\t\t\t\twords.forEach( ( word, i ) => {\n\t\t\t\t\t\tsetTimeout(\n\t\t\t\t\t\t\t() => word.classList.add( 'animated-words__word--visible' ),\n\t\t\t\t\t\t\topts.interval * ( i + 1 )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t},\n\t\t\t\topts.delay\n\t\t\t)\n\t\t} );\n\t} );\n}\n"],"names":["select","selector","nodes","Array","isArray","NodeList","from","HTMLElement","document","querySelectorAll","console","error","filter","node","observe","opts","threshold","Promise","resolve","reject","parseFloat","isNaN","Math","min","max","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","disconnect","parseDuration","duration","Number","isInteger","block","delay","classList","add","style","animationDuration","then","setTimeout","wash","querySelector","createElement","appendChild","image","interval","map","childNodes","child","nodeType","masks","textContent","split","reduce","word","wordIndex","push","createTextNode","mask","wordNode","removeChild","prepareWordsNode","prepare","words","i"],"mappings":"yBAMO,SAASA,EAAQC,GACvB,IAAIC,EAAQ,GAgBZ,OAdKC,MAAMC,QAASH,GACnBC,EAAQD,EACGA,aAAoBI,SAC/BH,EAAQC,MAAMG,KAAML,GACTA,aAAoBM,YAC/BL,EAAQ,CAAED,GACqB,iBAAbA,EAClBC,EAAQC,MAAMG,KAAME,SAASC,iBAAkBR,IAE/CS,QAAQC,MAAO,wBAAyBV,GAGzCC,EAAQA,EAAMU,QAAQC,GAAQA,aAAgBN,cAEvCL,CACR,CASO,SAASY,EAASD,EAAME,EAAO,CAAEC,UAAW,KAClD,OAAO,IAAIC,SAAQ,CAAEC,EAASC,KAC7B,IAAIH,EAAYI,WAAYL,EAAKC,WAE5BK,MAAOL,KACXA,EAAY,IAGbA,EAAYM,KAAKC,IAAK,IAAKD,KAAKE,IAAK,EAAGR,IAAgB,IAExD,MAAMS,EAAW,IAAIC,sBACnBC,IACAA,EAAQC,SAASC,IACXA,EAA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