<commit_before>(function() {

    var config = {
        keys: {
            config: [ 'property' , 'value' , 'duration' , 'easing' , 'delay' , 'relative' , 'pseudoHide' , 'done' , 'fallback' ],
            nonXform: [ 'opacity' ]
        }
    };

    window.hxManager = function( element ) {

        if (!element)
            throw "Error: You must pass an element to the hxManager constructor.";
        
        $.extend( this , {
            element: element,
            queue: {},
            components: {},
            _callback: function() {}
        });

        return this._init();
    };

    hxManager.prototype = {
        _init: function() {

            // instantiate the vendorPatch
            this.vendorPatch = new hxManager.vendorPatch();

            // trigger the hx_init event
            this.trigger( 'hx_init' );

            // check the element's display state
            if (!_checkDisplayState( this.element ))
                this._prepHiddenElement();
            
            var self = $(this.element);
            self.hxManager = 1;
            $.extend( self , this );
            return self;
        },
        _prepHiddenElement: function() {

            function task1() {
                this.setTransition( 'opacity' , {
                    duration: 0,
                    delay: 0
                });
                flow.progress();
            }

            function task2() {
                this.element.style.opacity = 0;
                this.element.style.display = 'block';
                flow.progress();
            }

            function task3() {
                // getBoundingClientRect forces a DOM reflow
                this.element.getBoundingClientRect();
                flow.progress();
            }

            var flow = new hxManager.workflow();

            flow.add( task1 , this );
            flow.add( task2 , this );
            flow.add( task3 , this );

            flow.run();
        },
        getComputedMatrix: function( property ) {

            if (config.keys.nonXform.indexOf( property ) >= 0)
                return null;
            
            var matrix = this.vendorPatch.getComputedMatrix( this.element );

            if (_isHXTransform( matrix ) !== false) {
                
                matrix = _parse( matrix );
                
                if (matrix.transform.length < 1)
                    return null;

                return matrix;

            } else {
                return null;
            }
        },
        apply: function( property , options ) {
            
            var matrix = this.getComputedMatrix( property );

            if (matrix) {
                this.components.transform = this.components.transform || {};
                this.components.transform.computed = matrix;
            }

            return this.set( property , options , true );
        },
        set: function( property , options , setComputed ) {

            this.components[property] = this.components[property] || {};

            // prevent computed matrix transform from being applied if it exists and the set method is called directly
            if (setComputed === false && typeof this.components[property].computed !== 'undefined')
                delete this.components[property].computed;

            // build the component array
            this.components[property] = $.extend( this.components[property] , _getRawComponents( options ));

            // extend the options object with key defaults
            options = $.extend({
                duration: 0,
                delay: 0,
                relative: setComputed === true ? true : false,
                fallback: true
            } , options );

            // add the animation instance to the queue
            this.queue[ property ] = new hxManager.animator({
                element     : this.element,
                property    : property,
                eventType   : this.vendorPatch.getEventType(),
                value       : config.keys.nonXform.indexOf( property ) < 0 ? _buildTransformString( this.components[property] ) : this.components[property][property][0],
                duration    : options.duration,
                easing      : hxManager._easing.call( this , options.easing ),
                delay       : options.delay,
                fallback    : options.fallback,
                trigger     : this.trigger.bind( this ),
                cancel      : this.cancel.bind( this ),
                complete    : this._transitionEnd.bind( this )
            });

            // build and apply the transition string
            this.setTransition( property );

            if (this.queue[ property ]) {
                
                // apply the style string and start the fallback timeout
                var transform = {
                    property: this.vendorPatch.getPrefixed( property ),
                    value: this.vendorPatch.getPrefixed( this.queue[ property ].value )
                };
                
                $(this.element).css( transform.property , transform.value );
                this.queue[ property ].start();

                // trigger the hx_applyXform event
                this.trigger( 'hx_applyXform' , property , transform.value , options );
            }

            return this;

        },
        setTransition: function( property , options ) {
            
            if (!property)
                return;

            options = options || {};

            // if easing was passed in the options object, get the corresponding bezier
            if (options.easing)
                options.easing = hxManager._easing.call( this , options.easing );

            var tempQueue = {};

            if (this.queue[ property ]) {
                // if the property already exists in the queue, extend it with the new options
                this.queue[ property ] = $.extend( this.queue[ property ] , options );
            } else {
                // otherwise, populate tempQueue with defaults
                tempQueue[ property ] = {
                    easing: typeof options.easing !== 'undefined' ? options.easing : 'ease',
                    duration: options.duration || 0,
                    delay: options.delay || 0
                };
            }

            // extend tempQueue with the instance queue
            tempQueue = $.extend( {} , this.queue , tempQueue );

            // construct the transition string
            var tString = _buildTransitionString( tempQueue );
            tString = this.vendorPatch.getPrefixed( tString );

            // add vendor prefixes
            var tProp = this.vendorPatch.getPrefixed( 'transition' );

            // if the element's style is already equal to the new transition string, don't apply it
            if (this.element.style.transition === tString)
                return;

            $(this.element).css( tProp , tString );

            // trigger the hx_setTransition event
            this.trigger( 'hx_setTransition' , property , tString );
        },
        trigger: function() {

            var type = arguments[0];
            var args = Array.prototype.slice.call( arguments , 1 );
            var evt = {};

            if (typeof _constructEvent[type] === 'function') {
                evt = _constructEvent[type].apply( this , args );
            } else {
                evt = this.vendorPatch.createEvent( type , args[0] );
            }

            this.element.dispatchEvent( evt );

        },
        _transitionEnd: function( event , name ) {

            // trigger the hx_transitionEnd event
            this.trigger( 'hx_transitionEnd' , name );

            // remove the animator object from the queue
            delete this.queue[name];

            // check the remaining queue elements
            if (hxManager.objSize( this.queue ) > 0)
                return;
                
            // trigger the hx_done event
            this.trigger( 'hx_done' );

            if (typeof this._callback === 'function')
                this._callback.call( this , event );

            this.hxManager = 0;
        },
        done: function( callback ) {
            this._callback = callback || function() {};
        },
        cancel: function() {
            
            for (var key in this.queue) {
                try {
                    this.queue[key].destroy();
                } catch( err ) {
                    delete this.queue[key];
                }
            }

            // trigger the hx_cancel event
            this.trigger( 'hx_cancel' );
        }
    };





    // ----------------------- event constructors ----------------------- //

        var _constructEvent = {

            hx_init: function() {
                return this.vendorPatch.createEvent( 'hx_init' );
            },

            hx_setTransition: function( property , string ) {
                return this.vendorPatch.createEvent( 'hx_setTransition' , {
                    propertyName: property,
                    string: string
                });
            },

            hx_applyXform: function( property , string , xform ) {
                return this.vendorPatch.createEvent( 'hx_applyXform' , {
                    propertyName: property,
                    string: string,
                    xform: xform
                });
            },

            hx_transitionEnd: function( property ) {
                return this.vendorPatch.createEvent( 'hx_transitionEnd' , {
                    propertyName: property
                });
            },

            hx_fallback: function( property ) {
                return this.vendorPatch.createEvent( 'hx_fallback' , {
                    propertyName: property
                });
            },

            hx_cancel: function() {
                return this.vendorPatch.createEvent( 'hx_cancel' );
            },

            hx_done: function() {
                return this.vendorPatch.createEvent( 'hx_done' );
            }

        };

    // ------------------------------------------------------------------ //





    // ------------------------- public methods ------------------------- //

        hxManager.pseudoHide = function( element ) {
            $(element)
                .addClass('hx_pseudoHide')
                .css('pointer-events', 'none');<commit_msg>changed when vendorPatch is instantiated, set bubble to false for all hx_* events.<commit_after>(function() {

    var config = {
        keys: {
            config: [ 'property' , 'value' , 'duration' , 'easing' , 'delay' , 'relative' , 'pseudoHide' , 'done' , 'fallback' ],
            nonXform: [ 'opacity' ]
        }
    };

    window.hxManager = function( element ) {

        if (!element)
            throw "Error: You must pass an element to the hxManager constructor.";
        
        $.extend( this , {
            element: element,
            queue: {},
            components: {},
            _callback: function() {}
        });

        return this._init();
    };

    hxManager.prototype = {
        _init: function() {

            // trigger the hx_init event
            this.trigger( 'hx_init' );

            // check the element's display state
            if (!_checkDisplayState( this.element ))
                this._prepHiddenElement();
            
            var self = $(this.element);
            self.hxManager = 1;
            $.extend( self , this );
            return self;
        },
        _prepHiddenElement: function() {

            function task1() {
                this.setTransition( 'opacity' , {
                    duration: 0,
                    delay: 0
                });
                flow.progress();
            }

            function task2() {
                this.element.style.opacity = 0;
                this.element.style.display = 'block';
                flow.progress();
            }

            function task3() {
                // getBoundingClientRect forces a DOM reflow
                this.element.getBoundingClientRect();
                flow.progress();
            }

            var flow = new hxManager.workflow();

            flow.add( task1 , this );
            flow.add( task2 , this );
            flow.add( task3 , this );

            flow.run();
        },
        getComputedMatrix: function( property ) {

            if (config.keys.nonXform.indexOf( property ) >= 0)
                return null;
            
            var matrix = hxManager.vendorPatch.getComputedMatrix( this.element );

            if (_isHXTransform( matrix ) !== false) {
                
                matrix = _parse( matrix );
                
                if (matrix.transform.length < 1)
                    return null;

                return matrix;

            } else {
                return null;
            }
        },
        apply: function( property , options ) {
            
            var matrix = this.getComputedMatrix( property );

            if (matrix) {
                this.components.transform = this.components.transform || {};
                this.components.transform.computed = matrix;
            }

            return this.set( property , options , true );
        },
        set: function( property , options , setComputed ) {

            this.components[property] = this.components[property] || {};

            // prevent computed matrix transform from being applied if it exists and the set method is called directly
            if (setComputed === false && typeof this.components[property].computed !== 'undefined')
                delete this.components[property].computed;

            // build the component array
            this.components[property] = $.extend( this.components[property] , _getRawComponents( options ));

            // extend the options object with key defaults
            options = $.extend({
                duration: 0,
                delay: 0,
                relative: setComputed === true ? true : false,
                fallback: true
            } , options );

            // add the animation instance to the queue
            this.queue[ property ] = new hxManager.animator({
                element     : this.element,
                property    : property,
                eventType   : hxManager.vendorPatch.getEventType(),
                value       : config.keys.nonXform.indexOf( property ) < 0 ? _buildTransformString( this.components[property] ) : this.components[property][property][0],
                duration    : options.duration,
                easing      : hxManager._easing( options.easing ),
                delay       : options.delay,
                fallback    : options.fallback,
                trigger     : this.trigger.bind( this ),
                cancel      : this.cancel.bind( this ),
                complete    : this._transitionEnd.bind( this )
            });

            // build and apply the transition string
            this.setTransition( property );

            if (this.queue[ property ]) {
                
                // apply the style string and start the fallback timeout
                var transform = {
                    property: hxManager.vendorPatch.getPrefixed( property ),
                    value: hxManager.vendorPatch.getPrefixed( this.queue[ property ].value )
                };
                
                $(this.element).css( transform.property , transform.value );
                this.queue[ property ].start();

                // trigger the hx_applyXform event
                this.trigger( 'hx_applyXform' , property , transform.value , options );
            }

            return this;

        },
        setTransition: function( property , options ) {
            
            if (!property)
                return;

            options = options || {};

            // if easing was passed in the options object, get the corresponding bezier
            if (options.easing)
                options.easing = hxManager._easing( options.easing );

            var tempQueue = {};

            if (this.queue[ property ]) {
                // if the property already exists in the queue, extend it with the new options
                this.queue[ property ] = $.extend( this.queue[ property ] , options );
            } else {
                // otherwise, populate tempQueue with defaults
                tempQueue[ property ] = {
                    easing: typeof options.easing !== 'undefined' ? options.easing : 'ease',
                    duration: options.duration || 0,
                    delay: options.delay || 0
                };
            }

            // extend tempQueue with the instance queue
            tempQueue = $.extend( {} , this.queue , tempQueue );

            // construct the transition string
            var tString = _buildTransitionString( tempQueue );
            tString = hxManager.vendorPatch.getPrefixed( tString );

            // add vendor prefixes
            var tProp = hxManager.vendorPatch.getPrefixed( 'transition' );

            // if the element's style is already equal to the new transition string, don't apply it
            if (this.element.style.transition === tString)
                return;

            $(this.element).css( tProp , tString );

            // trigger the hx_setTransition event
            this.trigger( 'hx_setTransition' , property , tString );
        },
        trigger: function() {

            var type = arguments[0];
            var args = Array.prototype.slice.call( arguments , 1 );
            var evt = {};

            if (typeof _constructEvent[type] === 'function') {
                evt = _constructEvent[type].apply( this , args );
            } else {
                evt = hxManager.vendorPatch.createEvent( type , args[0] );
            }

            this.element.dispatchEvent( evt );

        },
        _transitionEnd: function( event , name ) {

            // trigger the hx_transitionEnd event
            this.trigger( 'hx_transitionEnd' , name );

            // remove the animator object from the queue
            delete this.queue[name];

            // check the remaining queue elements
            if (hxManager.objSize( this.queue ) > 0)
                return;
                
            // trigger the hx_done event
            this.trigger( 'hx_done' );

            if (typeof this._callback === 'function')
                this._callback.call( this , event );

            this.hxManager = 0;
        },
        done: function( callback ) {
            this._callback = callback || function() {};
        },
        cancel: function() {
            
            for (var key in this.queue) {
                try {
                    this.queue[key].destroy();
                } catch( err ) {
                    delete this.queue[key];
                }
            }

            // trigger the hx_cancel event
            this.trigger( 'hx_cancel' );
        }
    };





    // ----------------------- event constructors ----------------------- //

        var _constructEvent = {

            hx_init: function() {
                return hxManager.vendorPatch.createEvent( 'hx_init' , {} , false , true );
            },

            hx_setTransition: function( property , string ) {
                return hxManager.vendorPatch.createEvent( 'hx_setTransition' , {
                    propertyName: property,
                    string: string
                } , false , true );
            },

            hx_applyXform: function( property , string , xform ) {
                return hxManager.vendorPatch.createEvent( 'hx_applyXform' , {
                    propertyName: property,
                    string: string,
                    xform: xform
                } , false , true );
            },

            hx_transitionEnd: function( property ) {
                return hxManager.vendorPatch.createEvent( 'hx_transitionEnd' , {
                    propertyName: property
                } , false , true );
            },

            hx_fallback: function( property ) {
                return hxManager.vendorPatch.createEvent( 'hx_fallback' , {
                    propertyName: property
                } , false , true );
            },

            hx_cancel: function() {
                return hxManager.vendorPatch.createEvent( 'hx_cancel' , {} , false , true );
            },

            hx_done: function() {
                return hxManager.vendorPatch.createEvent( 'hx_done' , {} , false , true );
            }

        };

    // ------------------------------------------------------------------ //





    // ------------------------- public methods ------------------------- //

        hxManager.pseudoHide = function( element ) {
            $(element)
                .addClass('hx_pseudoHide')
                .css('pointer-events', 'none');
{'fraction_non_alphanumeric': 0.113373063170441, 'fraction_numerical': 0.002193087008343266, 'mean_word_length': 1.2723431914202146, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7171427', 'n_tokens_mistral': 5156, 'n_tokens_neox': 4814, 'n_words': 1245}