@import "../../../core/functions/maps";
@import "../mixins/responsive";

@mixin print-twbs-responsive-helpers($config: $built-twbs) {
    // a custom macro to print TWBS responsive helper classes
    // based on the given config
    //
    // ..param: $config map
    //

    // Responsive: Utility classes ----------------------------------------- //

    // IE10 in Windows (Phone) 8
    //
    // Support for responsive views via media queries is kind of borked in IE10, for
    // Surface/desktop in split view and for Windows Phone 8. This particular fix
    // must be accompanied by a snippet of JavaScript to sniff the user agent and
    // apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at
    // our Getting Started page for more information on this bug.
    //
    // For more information, see the following:
    //
    // Issue: https://github.com/twbs/bootstrap/issues/10497
    // Docs: http://getbootstrap.com/getting-started/#support-ie10-width
    // Source: http://timkadlec.com/2013/01/windows-phone-8-and-device-width/
    // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/

    @-ms-viewport {
        width: device-width;
    }

    // Visibility utilities
    // Note: Deprecated .visible-xs, .visible-sm, .visible-md, and .visible-lg as of v3.2.0

    $breakpoint-xs: get($config, breakpoint-xs);
    $breakpoint-xs-xm: get($config, breakpoint-xs-sm);
    $breakpoint-sm: get($config, breakpoint-sm);
    $breakpoint-sm-md: get($config, breakpoint-sm-md);
    $breakpoint-md: get($config, breakpoint-md);
    $breakpoint-md-lg: get($config, breakpoint-md-lg);
    $breakpoint-lg: get($config, breakpoint-lg);

    @include print-responsive-invisibility('.visible-xs, .visible-sm, .visible-md, .visible-lg');

    .visible-xs-block,
    .visible-xs-inline,
    .visible-xs-inline-block,
    .visible-sm-block,
    .visible-sm-inline,
    .visible-sm-inline-block,
    .visible-md-block,
    .visible-md-inline,
    .visible-md-inline-block,
    .visible-lg-block,
    .visible-lg-inline,
    .visible-lg-inline-block {
        display: none !important;
    }

    @include breakpoint(max-width $breakpoint-sm) {
        @include print-responsive-visibility('.visible-xs');
    }
    .visible-xs-block {
        @include breakpoint(max-width $breakpoint-sm) {
            display: block !important;
        }
    }
    .visible-xs-inline {
        @include breakpoint(max-width $breakpoint-sm) {
            display: inline !important;
        }
    }
    .visible-xs-inline-block {
        @include breakpoint(max-width $breakpoint-sm) {
            display: inline-block !important;
        }
    }

    @include breakpoint($breakpoint-sm-md) {
        @include print-responsive-visibility('.visible-sm');
    }
    .visible-sm-block {
        @include breakpoint($breakpoint-sm-md) {
            display: block !important;
        }
    }
    .visible-sm-inline {
        @include breakpoint($breakpoint-sm-md) {
            display: inline !important;
        }
    }
    .visible-sm-inline-block {
        @include breakpoint($breakpoint-sm-md) {
            display: inline-block !important;
        }
    }

    @include breakpoint($breakpoint-md-lg) {
        @include print-responsive-visibility('.visible-md');
    }
    .visible-md-block {
        @include breakpoint($breakpoint-md-lg) {
            display: block !important;
        }
    }
    .visible-md-inline {
        @include breakpoint($breakpoint-md-lg) {
            display: inline !important;
        }
    }
    .visible-md-inline-block {
        @include breakpoint($breakpoint-md-lg) {
            display: inline-block !important;
        }
    }

    @include breakpoint($breakpoint-lg) {
        @include print-responsive-visibility('.visible-lg');
    }
    .visible-lg-block {
        @include breakpoint($breakpoint-lg) {
            display: block !important;
        }
    }
    .visible-lg-inline {
        @include breakpoint($breakpoint-lg) {
            display: inline !important;
        }
    }
    .visible-lg-inline-block {
        @include breakpoint($breakpoint-lg) {
            display: inline-block !important;
        }
    }

    @include breakpoint(max-width $breakpoint-sm) {
        @include print-responsive-invisibility('.hidden-xs');
    }

    @include breakpoint($breakpoint-sm-md) {
        @include print-responsive-invisibility('.hidden-sm');
    }

    @include breakpoint($breakpoint-md-lg) {
        @include print-responsive-invisibility('.hidden-md');
    }

    @include breakpoint($breakpoint-lg) {
        @include print-responsive-invisibility('.hidden-lg');
    }

    // Print utilities
    //
    // Media queries are placed on the inside to be mixin-friendly.

    // Note: Deprecated .visible-print as of v3.2.0

    @include print-responsive-invisibility('.visible-print');

    @media print {
        @include print-responsive-visibility('.visible-print');
    }
    .visible-print-block {
        display: none !important;

        @media print {
            display: block !important;
        }
    }
    .visible-print-inline {
        display: none !important;

        @media print {
            display: inline !important;
        }
    }
    .visible-print-inline-block {
        display: none !important;

        @media print {
            display: inline-block !important;
        }
    }

    @media print {
        @include print-responsive-invisibility('.hidden-print');
    }

}
