// /* ================================ */
// /* ================================ */
// /* DO NOT MODIFY THIS FILE */
// /* ================================ */
// /* ================================ */
@use "sass:list";
@use "sass:string";
@use "sass:meta";
@use "sass:math";
@use "sass:map";
@use "../settings/breakpoints" as *;

// /**
// * __comment__
// * @param {String|null} $i null|important
// * @return {String}
// */
@mixin hideEl($i: null) {
    @if $i == important {
        display: none !important;
    } @else {
        display: none;
    }
}

// /**
// * ensure the is a px unit
// * @param {String|Number} $value
// * @return {String} {value}px
// */
@function ensure-px($value) {
    @if meta.type-of($value) == "number" and math.is-unitless($value) {
        @return $value * 1px; // Convert number to px
    } @else if math.unit($value) == "px" {
        @return $value; // Return as is if already px
    } @else {
        @return $value + px; // Add px if not present
    }
}

// /**
// * // @mixin breakpoint
// * BreakPoint print utility
// */
@mixin breakpoint($screen, $param: null, $exclude: null) {
    $isAlias: map.get($xBreakpointsAlias, $screen);
    @if $isAlias != null {
        $screen: $isAlias;
    }
    $values: map.get($xBreakpoints, $screen);
    $min: 0;
    $max: null;

    @if $values != null {
        $min: ensure-px(list.nth($values, 1));

        @if meta.type-of(list.nth($values, 2)) == "number" {
            $maxTmp: list.nth($values, 2);
            @if $maxTmp != 0 {
                $max: ensure-px($maxTmp);
            }
        }
    }

    // exclude=true
    @if $exclude == true {
        @if $values != null {
            @if $max != null {
                @media not ((min-width: $min) and (max-width: $max)) {
                    @content;
                }
            } @else {
                @media not (min-width: $min) {
                    @content;
                }
            }
        }
    } @else {
        // predefined breakpoint
        @if $values != null {
            @if $param != null and $param == landscape {
                @if $max != null {
                    @media (min-width: $min) and (max-width: ensure-px($max)) and (orientation: landscape) {
                        @content;
                    }
                } @else {
                    @media (min-width: $min) and ($param) {
                        @content;
                    }
                }
            } @else {
                @if $max != null {
                    @media (min-width: $min) and (max-width: $max) {
                        @content;
                    }
                } @else {
                    @media (min-width: $min) {
                        @content;
                    }
                }
            }
        }
        // custom user-defined
        @else if $screen != null and $param != null {
            @if meta.type-of($param) == "number" {
                @media (min-width: ensure-px($screen)) and (max-width: ensure-px($param)) {
                    @content;
                }
            } @else {
                @media (min-width: ensure-px($screen)) and ($param) {
                    @content;
                }
            }
        }
        // single unit
        @else if $screen != null {
            @if meta.type-of($screen) == "number" {
                @media (min-width: ensure-px($screen)) {
                    @content;
                }
            } @else {
                @media ($screen) {
                    @content;
                }
            }
        } @else {
            @warn "no value could be found for `#{$screen}`. "
        + "Please make sure it is defined in `$xBreakpoints` map.";
        }
    }
}

// headers mixin
@mixin set-headers-value($prop, $value) {
    $headers: (h1, h2, h3, h4, h5, ".h1", ".h2", ".h3", ".h4", ".h5");
    @each $tag in $headers {
        #{$tag} {
            #{$prop}: #{$value};
        }
    }
}

// transition mixin
@mixin transitionProp($property, $duration: 0.5s, $method: ease, $delay: 0s) {
    transition: $property $duration $method $delay;
    -moz-transition: $property $duration $method $delay;
    -webkit-transition: $property $duration $method $delay;
    -o-transition: $property $duration $method $delay;
}

:root {
    --bs-disabled-bg: #e9ecef;
    --bs-disabled-text: #6c757d;
    --bs-disabled-border: #c8cbcf;
    --bs-disabled-line: #6c757d;
}

// disabled mixin
@mixin disabled() {
    &,
    &:hover {
        background: var(--bs-disabled-bg);
        color: var(--bs-disabled-text);
        border-color: var(--bs-disabled-border);
        position: relative;
    }

    &:before {
        position: absolute;
        height: 1px;
        width: 100%;
        top: 50%;
        left: 0;

        display: block;
        border-bottom: 1px solid var(--bs-disabled-line);
        content: " ";
        transform: rotate(15deg);
    }

    &:hover {
        cursor: not-allowed;
    }
}

// mapMerge function
@function mapMerge($maps...) {
    $m: ();

    // single list of maps
    @if meta.type-of(list.nth($maps, 1)) == "list" and list.length($maps) == 1 {
        @each $map in list.nth($maps, 1) {
            $m: map.merge($m, $map);
        }
    }
    // multiple maps
    @else {
        @each $map in $maps {
            $m: map.merge($m, $map);
        }
    }

    @return $m;
}
