package zsh

import (
	
	

	
	
	
)

type zstyles struct {
	rawValues common.RawValues
}

func ( zstyles) () string {
	if  := style.Carapace.Description;  != "" && ui.ParseStyling() != nil {
		return style.SGR()
	}
	return style.SGR(style.Default)
}

func ( zstyles) ( common.RawValue) string {
	if .Style != "" && ui.ParseStyling(.Style) != nil {
		return style.SGR(.Style)
	}

	if ui.ParseStyling(style.Carapace.Value) != nil {
		return style.SGR(style.Carapace.Value)
	}
	return style.SGR(style.Default)

}

func ( zstyles) () string {
	 := strings.NewReplacer(
		"#", `\#`,
		"*", `\*`,
		"(", `\(`,
		")", `\)`,
		"[", `\[`,
		"]", `\]`,
		"|", `\|`,
		"~", `\~`,
	)

	 := make([]string, 0)
	if len(.rawValues) < 500 { // disable styling for large amount of values (bad performance)
		for ,  := range .rawValues {
			// match value with description
			 = append(, fmt.Sprintf("=(#b)(%v)([ ]## -- *)=0=%v=%v", .Replace(.Display), .valueSGR(), .descriptionSGR()))
			// only match value (also matches aliased completions that are placed on the same line if the space allows it)
			 = append(, fmt.Sprintf("=(#b)(%v)=0=%v", .Replace(.Display), .valueSGR()))
		}
	}
	 = append(, fmt.Sprintf("=(#b)(%v)=0=%v", "-- *", .descriptionSGR())) // match description for aliased completions
	return strings.Join(, ":")
}