define(() => {
    (function () {
        const $this = $(this);
        const $document = $(document);
        const $wrapper = $('.works-wrapper');
        const $sider = $('.works-sider');

        $sider.bind('click', event => {
            event.stopPropagation();
        });

        this.bind('click', event => {
            event.stopPropagation();
            if ($sider.hasClass('works-sider-active')) {
                $sider.removeClass('works-sider-active');
                $wrapper.removeClass('works-sider-active');
                $document.unbind('click.worksMenuHandler');
            }
            else {
                $sider.addClass('works-sider-active');
                $wrapper.addClass('works-sider-active');
                $document.unbind('click.worksMenuHandler').bind('click.worksMenuHandler', function (event) {
                    event.preventDefault();
                    $sider.removeClass('works-sider-active');
                    $wrapper.removeClass('works-sider-active');
                    $document.unbind('click.worksMenuHandler');
                });
            }
        });
    }).hook('menu', null, {
        nativeElement: `<button></button>`
    });
});