// #region Imports
import { html } from '../../../../Dom/Html';
import { RendererServiceLocator } from '../../../../Dom/Renderer';
import { styleMap, when } from '../../../Directives/Directives';
// #endregion
/**
 * The template of the {@link MeterBarElement}.
 *
 * @public
 */
export function meterBarElementTemplate(e) {
    const percentage = ((e.value - e.min) / (e.max - e.min)) * 100;
    return html `
        ${when(e.label.trim(), () => html `
        <slot name="label">
            <mosaik-text part="label"
                         .truncate="${true}"
                         .text="${e.label.trim()}"></mosaik-text>
        </slot>
        `)}
        <div part="bar"
             style="${styleMap({ height: `${e.thickness}px` })}">
            <div part="fill"
                 style="width: ${percentage}%"></div>
        </div>
        <div part="hint">
            <slot name="hint"
                  @slotchange="${(x) => x.target.assignedElements().map((x, i) => RendererServiceLocator.current.setStyle(x, 'order', i))}"></slot>
        </div>
    `;
}
//# sourceMappingURL=MeterBarElementTemplate.js.map