@use "sass:math";
@use "sass:meta";
@import 'mathsass/dist/math';

@function sqrt($number) {
	// math.sqrt was added in version 1.25.0
	// import-only files were added in version 1.23.0
	// meta.module-functions was added in version 1.23.0
	$math-functions: meta.module-functions("math");
	$has-sqrt-function: map-has-key($math-functions, "sqrt");
	@if $has-sqrt-function {
		@return math.sqrt($number);
	} @else {
		@return sqrt($number);
	}
}

@function pow($base, $exponent) {
	// math.pow was added in version 1.25.0
	// import-only files were added in version 1.23.0
	// meta.module-functions was added in version 1.23.0
	$math-functions: meta.module-functions("math");
	$has-pow-function: map-has-key($math-functions, "pow");
	@if $has-pow-function {
		@return math.pow($base, $exponent);
	} @else {
		@return pow($base, $exponent);
	}
}

@function div($number1, $number2) {
	// math.div was added in version 1.33.0
	// import-only files were added in version 1.23.0
	// meta.module-functions was added in version 1.23.0
	$math-functions: meta.module-functions("math");
	$has-div-function: map-has-key($math-functions, "div");
	@if $has-div-function {
		@return math.div($number1, $number2);
	} @else {
		@return $number1 / $number2;
	}
}
