@use "sass:list";
@use "sass:map";
@use "sass:meta";

@function map-deep-get($map, $keys...) {
	$scope: $map;
	$i: 1;

	@while (meta.type-of($scope) == map) and ($i <= list.length($keys)) {
		$scope: map.get($scope, list.nth($keys, $i));
		$i: $i + 1;
	}

	@return $scope;
}

@function generate-selector-string($list, $prepend: "", $append: "") {
	$result: null;

	@for $i from 1 through length($list) {
		$e: nth($list, $i);
		$result: if(
			$i != length($list),
			$result#{$prepend}#{$e}#{$append}#{","},
			$result#{$prepend}#{$e}#{$append}
		);
	}

	@return $result;
}
