import * as i0 from '@angular/core';
import { inject, ElementRef, DestroyRef, output, input, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
import { ZIconComponent } from '@shival99/z-ui/components/z-icon';
import { ZTooltipDirective } from '@shival99/z-ui/components/z-tooltip';
import { zTransform, zMergeClasses } from '@shival99/z-ui/utils';
import { cva } from 'class-variance-authority';

const zStepsContainerVariants = cva(['relative list-none m-0 p-0'], {
    variants: {
        orientation: {
            vertical: 'text-foreground',
            horizontal: 'flex items-center w-full',
        },
    },
    defaultVariants: {
        orientation: 'vertical',
    },
});
const zStepsItemVariants = cva(['relative flex items-start'], {
    variants: {
        orientation: {
            vertical: 'last:mb-0',
            horizontal: 'flex-1 last:flex-none',
        },
        size: {
            sm: 'mb-6 ps-10 min-h-6',
            default: 'mb-8 ps-12 min-h-8',
            lg: 'mb-10 ps-14 min-h-10',
        },
    },
    compoundVariants: [{ orientation: 'horizontal', class: 'mb-0 ps-0 min-h-0' }],
    defaultVariants: {
        orientation: 'vertical',
        size: 'default',
    },
});
const zStepsIconVariants = cva([
    'absolute start-0 z-10 flex items-center justify-center rounded-full border shadow-sm ring-[3px] ring-background transform-gpu transition-transform duration-200 ease-out hover:scale-105',
], {
    variants: {
        size: {
            sm: 'w-8 h-8 text-xs',
            default: 'w-9 h-9 text-sm',
            lg: 'w-11 h-11 text-base',
        },
        status: {
            pending: 'bg-background border-input text-muted-foreground ring-muted/70',
            current: 'bg-primary border-primary text-primary-foreground ring-primary/20',
            completed: 'bg-primary border-primary text-primary-foreground ring-primary/20',
            error: 'bg-destructive border-destructive text-destructive-foreground ring-destructive/20',
        },
    },
    defaultVariants: {
        size: 'default',
        status: 'pending',
    },
});
const zStepsLineVariants = cva(['absolute border-s-2 border-input/80'], {
    variants: {
        size: {
            sm: 'start-4 top-4 bottom-0',
            default: 'start-[18px] top-[1.125rem] bottom-0',
            lg: 'start-[22px] top-[1.375rem] bottom-0',
        },
    },
    defaultVariants: {
        size: 'default',
    },
});
const zStepsConnectorVariants = cva(['transition-colors duration-200'], {
    variants: {
        orientation: {
            vertical: 'hidden',
            horizontal: 'flex-1 h-1 mx-4 rounded-full',
        },
        status: {
            pending: 'bg-input',
            current: 'bg-input',
            completed: 'bg-primary',
            error: 'bg-destructive/30',
        },
    },
    defaultVariants: {
        orientation: 'vertical',
        status: 'pending',
    },
});
const zStepsArrowItemVariants = cva(['z-steps-arrow-item relative flex flex-1 flex-col justify-center transition-all duration-200'], {
    variants: {
        size: {
            sm: 'min-w-[7.5rem] py-2 px-4',
            default: 'min-w-[9.375rem] py-3 px-5',
            lg: 'min-w-[11.25rem] py-4 px-6',
        },
        status: {
            pending: 'bg-muted text-muted-foreground',
            current: 'bg-primary text-primary-foreground z-steps-arrow-active',
            completed: 'bg-primary text-primary-foreground z-steps-arrow-active',
            error: 'bg-destructive text-destructive-foreground',
        },
    },
    defaultVariants: {
        size: 'default',
        status: 'pending',
    },
});
const zStepsDotVariants = cva(['rounded-full transition-all duration-200'], {
    variants: {
        size: {
            sm: 'w-2 h-2',
            default: 'w-2.5 h-2.5',
            lg: 'w-3 h-3',
        },
        status: {
            pending: 'bg-muted-foreground/30',
            current: 'bg-primary ring-2 ring-primary/20',
            completed: 'bg-primary ring-2 ring-primary/20',
            error: 'bg-destructive ring-2 ring-destructive/20',
        },
    },
    defaultVariants: {
        size: 'default',
        status: 'pending',
    },
});
const zStepsDotLineVariants = cva(['transition-colors duration-200'], {
    variants: {
        orientation: {
            vertical: 'w-[0.125rem] flex-1 min-h-14 rounded-full',
            horizontal: 'h-[0.125rem] flex-1 rounded-full',
        },
        status: {
            pending: 'bg-muted-foreground/20',
            current: 'bg-muted-foreground/20',
            completed: 'bg-primary',
            error: 'bg-destructive/30',
        },
    },
    defaultVariants: {
        orientation: 'horizontal',
        status: 'pending',
    },
});

const RESPONSIVE_BREAKPOINT = 640;
class ZStepsComponent {
    _elementRef = inject(ElementRef);
    _destroyRef = inject(DestroyRef);
    zOnStepClick = output();
    zControl = output();
    class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
    zSteps = input.required(...(ngDevMode ? [{ debugName: "zSteps" }] : []));
    zCurrent = input(0, ...(ngDevMode ? [{ debugName: "zCurrent" }] : []));
    zOrientation = input('vertical', ...(ngDevMode ? [{ debugName: "zOrientation" }] : []));
    zType = input('default', ...(ngDevMode ? [{ debugName: "zType" }] : []));
    zSize = input('default', ...(ngDevMode ? [{ debugName: "zSize" }] : []));
    zClickable = input(false, { ...(ngDevMode ? { debugName: "zClickable" } : {}), transform: zTransform });
    zShowNumber = input(true, { ...(ngDevMode ? { debugName: "zShowNumber" } : {}), transform: zTransform });
    zResponsive = input(true, { ...(ngDevMode ? { debugName: "zResponsive" } : {}), transform: zTransform });
    zDisabled = input(false, { ...(ngDevMode ? { debugName: "zDisabled" } : {}), transform: zTransform });
    _internalCurrent = signal(null, ...(ngDevMode ? [{ debugName: "_internalCurrent" }] : []));
    _stepOverrides = signal(new Map(), ...(ngDevMode ? [{ debugName: "_stepOverrides" }] : []));
    _resizeObserver = null;
    isResponsiveVertical = signal(false, ...(ngDevMode ? [{ debugName: "isResponsiveVertical" }] : []));
    currentStep = computed(() => this._internalCurrent() ?? this.zCurrent(), ...(ngDevMode ? [{ debugName: "currentStep" }] : []));
    mergedSteps = computed(() => {
        const steps = this.zSteps();
        const overrides = this._stepOverrides();
        return steps.map((step, index) => {
            const override = overrides.get(index);
            return override ? { ...step, ...override } : step;
        });
    }, ...(ngDevMode ? [{ debugName: "mergedSteps" }] : []));
    effectiveOrientation = computed(() => {
        if (this.zResponsive() && this.isResponsiveVertical()) {
            return 'vertical';
        }
        return this.zOrientation();
    }, ...(ngDevMode ? [{ debugName: "effectiveOrientation" }] : []));
    containerClasses = computed(() => zMergeClasses(zStepsContainerVariants({
        orientation: this.effectiveOrientation(),
    }), this.class()), ...(ngDevMode ? [{ debugName: "containerClasses" }] : []));
    getItemClasses = computed(() => zStepsItemVariants({
        orientation: this.effectiveOrientation(),
        size: this.zSize(),
    }), ...(ngDevMode ? [{ debugName: "getItemClasses" }] : []));
    iconClassesMap = computed(() => {
        const size = this.zSize();
        const steps = this.mergedSteps();
        const current = this.currentStep();
        const classMap = new Map();
        steps.forEach((step, index) => {
            const status = this._getStepStatus(step, index, current);
            const baseClasses = zStepsIconVariants({ size, status });
            classMap.set(index, zMergeClasses(baseClasses, step.iconClass));
        });
        return classMap;
    }, ...(ngDevMode ? [{ debugName: "iconClassesMap" }] : []));
    lineClasses = computed(() => zStepsLineVariants({ size: this.zSize() }), ...(ngDevMode ? [{ debugName: "lineClasses" }] : []));
    getConnectorClassesByIndex = computed(() => {
        const orientation = this.effectiveOrientation();
        const steps = this.mergedSteps();
        const current = this.currentStep();
        return steps.map((step, index) => {
            const status = this._getConnectorStatus(step, index, current);
            return zStepsConnectorVariants({ orientation, status });
        });
    }, ...(ngDevMode ? [{ debugName: "getConnectorClassesByIndex" }] : []));
    stepStatuses = computed(() => {
        const steps = this.mergedSteps();
        const current = this.currentStep();
        return steps.map((step, index) => this._getStepStatus(step, index, current));
    }, ...(ngDevMode ? [{ debugName: "stepStatuses" }] : []));
    getArrowClassesByIndex = computed(() => {
        const size = this.zSize();
        const steps = this.mergedSteps();
        const current = this.currentStep();
        const total = steps.length;
        return steps.map((step, index) => {
            const status = this._getStepStatus(step, index, current);
            const baseClasses = zStepsArrowItemVariants({ size, status });
            let positionClass = 'z-steps-arrow-middle';
            if (index === 0) {
                positionClass = 'z-steps-arrow-first';
            }
            if (index === total - 1) {
                positionClass = 'z-steps-arrow-last';
            }
            return zMergeClasses(baseClasses, positionClass);
        });
    }, ...(ngDevMode ? [{ debugName: "getArrowClassesByIndex" }] : []));
    getDotClassesByIndex = computed(() => {
        const size = this.zSize();
        const steps = this.mergedSteps();
        const current = this.currentStep();
        return steps.map((step, index) => {
            const status = this._getStepStatus(step, index, current);
            return zStepsDotVariants({ size, status });
        });
    }, ...(ngDevMode ? [{ debugName: "getDotClassesByIndex" }] : []));
    getDotLineClassesByIndex = computed(() => {
        const orientation = this.effectiveOrientation();
        const steps = this.mergedSteps();
        const current = this.currentStep();
        return steps.map((step, index) => {
            const status = this._getConnectorStatus(step, index, current);
            return zStepsDotLineVariants({ orientation, status });
        });
    }, ...(ngDevMode ? [{ debugName: "getDotLineClassesByIndex" }] : []));
    defaultIconSize = computed(() => {
        const size = this.zSize();
        if (size === 'sm') {
            return '16';
        }
        if (size === 'lg') {
            return '24';
        }
        return '20';
    }, ...(ngDevMode ? [{ debugName: "defaultIconSize" }] : []));
    getIconSizeByIndex = computed(() => {
        const defaultSize = this.defaultIconSize();
        const steps = this.mergedSteps();
        return steps.map(step => step.iconSize ?? defaultSize);
    }, ...(ngDevMode ? [{ debugName: "getIconSizeByIndex" }] : []));
    iconWidth = computed(() => {
        const size = this.zSize();
        if (size === 'sm') {
            return 32;
        }
        if (size === 'lg') {
            return 44;
        }
        return 36;
    }, ...(ngDevMode ? [{ debugName: "iconWidth" }] : []));
    ngAfterViewInit() {
        if (this.zResponsive() && this.zOrientation() === 'horizontal') {
            this._setupResizeObserver();
        }
        this._destroyRef.onDestroy(() => {
            this._resizeObserver?.disconnect();
        });
        this.zControl.emit({
            setActive: (index) => {
                if (this.zDisabled()) {
                    return;
                }
                if (index >= 0 && index < this.zSteps().length) {
                    this._internalCurrent.set(index);
                }
            },
            next: () => {
                if (this.zDisabled()) {
                    return;
                }
                const current = this.currentStep();
                const total = this.zSteps().length;
                if (current < total - 1) {
                    this._internalCurrent.set(current + 1);
                }
            },
            prev: () => {
                if (this.zDisabled()) {
                    return;
                }
                const current = this.currentStep();
                if (current > 0) {
                    this._internalCurrent.set(current - 1);
                }
            },
            reset: () => {
                if (this.zDisabled()) {
                    return;
                }
                this._internalCurrent.set(0);
                this._stepOverrides.set(new Map());
            },
            setDisabled: (index, disabled) => {
                if (this.zDisabled()) {
                    return;
                }
                this._updateStepOverride(index, { disabled });
            },
            setStatus: (index, status) => {
                if (this.zDisabled()) {
                    return;
                }
                this._updateStepOverride(index, { status });
            },
            getCurrent: () => this.currentStep(),
            getTotal: () => this.zSteps().length,
        });
    }
    _updateStepOverride(index, override) {
        const overrides = new Map(this._stepOverrides());
        const existing = overrides.get(index) || {};
        overrides.set(index, { ...existing, ...override });
        this._stepOverrides.set(overrides);
    }
    _setupResizeObserver() {
        const container = this._elementRef.nativeElement;
        this._resizeObserver = new ResizeObserver(entries => {
            const width = entries[0]?.contentRect.width || 0;
            this.isResponsiveVertical.set(width < RESPONSIVE_BREAKPOINT);
        });
        this._resizeObserver.observe(container);
    }
    _getStepStatus(step, index, current) {
        if (step.status) {
            return step.status;
        }
        if (index < current) {
            return 'completed';
        }
        if (index === current) {
            return 'current';
        }
        return 'pending';
    }
    _getConnectorStatus(step, index, current) {
        if (step.status === 'error') {
            return 'error';
        }
        if (index < current) {
            return 'completed';
        }
        return 'pending';
    }
    onStepClick(index) {
        if (this.zDisabled()) {
            return;
        }
        const step = this.zSteps()[index];
        if (step.disabled) {
            return;
        }
        if (!this.zClickable()) {
            return;
        }
        this.zOnStepClick.emit(index);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZStepsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.9", type: ZStepsComponent, isStandalone: true, selector: "z-steps", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zSteps: { classPropertyName: "zSteps", publicName: "zSteps", isSignal: true, isRequired: true, transformFunction: null }, zCurrent: { classPropertyName: "zCurrent", publicName: "zCurrent", isSignal: true, isRequired: false, transformFunction: null }, zOrientation: { classPropertyName: "zOrientation", publicName: "zOrientation", isSignal: true, isRequired: false, transformFunction: null }, zType: { classPropertyName: "zType", publicName: "zType", isSignal: true, isRequired: false, transformFunction: null }, zSize: { classPropertyName: "zSize", publicName: "zSize", isSignal: true, isRequired: false, transformFunction: null }, zClickable: { classPropertyName: "zClickable", publicName: "zClickable", isSignal: true, isRequired: false, transformFunction: null }, zShowNumber: { classPropertyName: "zShowNumber", publicName: "zShowNumber", isSignal: true, isRequired: false, transformFunction: null }, zResponsive: { classPropertyName: "zResponsive", publicName: "zResponsive", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zOnStepClick: "zOnStepClick", zControl: "zControl" }, host: { classAttribute: "block" }, ngImport: i0, template: "<ol\n  [class]=\"containerClasses()\"\n  [class.rounded-md]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.border]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.border-border/70]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.bg-muted/20]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.p-2]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\">\n  @for (step of mergedSteps(); track $index; let i = $index; let last = $last) {\n    @if (effectiveOrientation() === 'vertical') {\n      @if (zType() === 'dot') {\n        <!-- Vertical Dot Layout -->\n        <li\n          class=\"flex items-start gap-3\"\n          [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n          [class.cursor-not-allowed]=\"step.disabled\"\n          [class.opacity-50]=\"step.disabled\"\n          (click)=\"onStepClick(i)\">\n          <!-- Dot + Line Column -->\n          <div class=\"flex w-10 shrink-0 flex-col items-center\">\n            <!-- Dot -->\n            <span [class]=\"getDotClassesByIndex()[i]\" class=\"shrink-0\"></span>\n            <!-- Vertical Line -->\n            @if (!last) {\n              <div\n                class=\"my-1 h-10 w-[0.125rem] rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/30]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n\n          <!-- Content (optional) -->\n          @if (step.title) {\n            <span\n              class=\"pt-0.5 text-sm\"\n              [class.text-foreground]=\"stepStatuses()[i] === 'current'\"\n              [class.font-medium]=\"stepStatuses()[i] === 'current'\"\n              [class.text-muted-foreground]=\"stepStatuses()[i] !== 'current'\">\n              {{ step.title }}\n            </span>\n          }\n        </li>\n      } @else {\n        <!-- Vertical Layout -->\n        <li\n          class=\"flex items-start gap-3\"\n          [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n          [class.cursor-not-allowed]=\"step.disabled\"\n          [class.opacity-50]=\"step.disabled\"\n          (click)=\"onStepClick(i)\">\n          <div class=\"flex w-10 shrink-0 flex-col items-center\">\n            <!-- Step Icon -->\n            <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto!\">\n              @switch (stepStatuses()[i]) {\n                @case ('completed') {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else {\n                    <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                }\n                @case ('error') {\n                  <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                }\n                @default {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else if (zShowNumber()) {\n                    <span class=\"font-medium\">{{ i + 1 }}</span>\n                  }\n                }\n              }\n            </span>\n\n            <!-- Vertical Line -->\n            @if (!last) {\n              <div\n                class=\"my-1 h-10 w-[0.125rem] rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/30]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n\n          <!-- Content -->\n          @if (step.title || step.description) {\n            <div class=\"min-w-0 flex-1 pt-1 pb-3\">\n              @if (step.title) {\n                <h3 class=\"leading-tight font-medium\">{{ step.title }}</h3>\n              }\n              @if (step.description) {\n                <p class=\"text-muted-foreground mt-1 text-sm\">{{ step.description }}</p>\n              }\n            </div>\n          }\n        </li>\n      }\n    } @else {\n      <!-- Horizontal Layout -->\n      <li\n        [class]=\"zType() === 'arrow' ? 'flex-1' : 'flex-1 last:flex-none'\"\n        [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n        [class.cursor-not-allowed]=\"step.disabled\"\n        [class.opacity-50]=\"step.disabled\"\n        (click)=\"onStepClick(i)\">\n        @if (zType() === 'arrow') {\n          <!-- Arrow Style -->\n          <div [class]=\"getArrowClassesByIndex()[i]\">\n            <div class=\"flex items-center gap-3.5\">\n              @if (step.icon) {\n                <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" class=\"shrink-0\" />\n              }\n              <div class=\"flex min-w-0 flex-col\">\n                @if (step.title) {\n                  <h3\n                    z-tooltip\n                    [zContent]=\"step.title\"\n                    [zAutoDetect]=\"true\"\n                    zPosition=\"top\"\n                    class=\"truncate text-sm leading-tight font-semibold whitespace-nowrap\">\n                    {{ step.title }}\n                  </h3>\n                }\n                @if (step.description) {\n                  <p\n                    z-tooltip\n                    [zContent]=\"step.description\"\n                    [zAutoDetect]=\"true\"\n                    zPosition=\"bottom\"\n                    class=\"mt-1 truncate text-xs whitespace-nowrap opacity-80\">\n                    {{ step.description }}\n                  </p>\n                }\n              </div>\n            </div>\n          </div>\n        } @else if (zType() === 'dot') {\n          <!-- Dot Style: Simple dots with optional labels -->\n          <div class=\"flex items-center\">\n            <!-- Dot -->\n            <span [class]=\"getDotClassesByIndex()[i]\"></span>\n\n            <!-- Content (optional) -->\n            @if (step.title) {\n              <span\n                z-tooltip\n                [zContent]=\"step.title\"\n                [zAutoDetect]=\"true\"\n                zPosition=\"top\"\n                class=\"ms-2 max-w-24 truncate text-sm whitespace-nowrap\"\n                [class.text-foreground]=\"stepStatuses()[i] === 'current'\"\n                [class.font-medium]=\"stepStatuses()[i] === 'current'\"\n                [class.text-muted-foreground]=\"stepStatuses()[i] !== 'current'\">\n                {{ step.title }}\n              </span>\n            }\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div\n                class=\"mx-3 h-[0.1875rem] min-w-8 flex-1 rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/25]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n        } @else if (zType() === 'inline') {\n          <!-- Inline: Icon + Content + Line in one row -->\n          <div class=\"flex items-center\">\n            <div class=\"flex min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2\">\n              <!-- Step Icon -->\n              <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto! shrink-0\">\n                @switch (stepStatuses()[i]) {\n                  @case ('completed') {\n                    @if (step.icon) {\n                      <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    } @else {\n                      <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    }\n                  }\n                  @case ('error') {\n                    <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                  @default {\n                    @if (step.icon) {\n                      <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    } @else if (zShowNumber()) {\n                      <span class=\"font-medium\">{{ i + 1 }}</span>\n                    }\n                  }\n                }\n              </span>\n\n              <!-- Content Inline -->\n              @if (step.title || step.description) {\n                <div class=\"min-w-0 flex-1\">\n                  @if (step.title) {\n                    <h3\n                      z-tooltip\n                      [zContent]=\"step.title\"\n                      [zAutoDetect]=\"true\"\n                      zPosition=\"top\"\n                      class=\"truncate text-sm leading-tight font-medium whitespace-nowrap\">\n                      {{ step.title }}\n                    </h3>\n                  }\n                  @if (step.description) {\n                    <p\n                      z-tooltip\n                      [zContent]=\"step.description\"\n                      [zAutoDetect]=\"true\"\n                      zPosition=\"bottom\"\n                      class=\"text-muted-foreground mt-1 truncate text-xs whitespace-nowrap\">\n                      {{ step.description }}\n                    </p>\n                  }\n                </div>\n              }\n            </div>\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div\n                class=\"mx-3 h-[0.1875rem] min-w-8 flex-1 rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/25]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n        } @else {\n          <!-- Default: Icon + Line row, Content below -->\n          <div class=\"flex items-center\">\n            <!-- Step Icon -->\n            <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto! shrink-0\">\n              @switch (stepStatuses()[i]) {\n                @case ('completed') {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else {\n                    <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                }\n                @case ('error') {\n                  <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                }\n                @default {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else if (zShowNumber()) {\n                    <span class=\"font-medium\">{{ i + 1 }}</span>\n                  }\n                }\n              }\n            </span>\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div [class]=\"getConnectorClassesByIndex()[i]\"></div>\n            }\n          </div>\n\n          <!-- Content Below -->\n          @if (step.title || step.description) {\n            <div\n              class=\"z-steps-content mt-3 flex flex-col text-center\"\n              [style.width.px]=\"150\"\n              [style.margin-left.px]=\"(iconWidth() - 150) / 2\">\n              @if (step.title) {\n                <h3\n                  z-tooltip\n                  [zContent]=\"step.title\"\n                  [zAutoDetect]=\"true\"\n                  zPosition=\"top\"\n                  class=\"truncate text-sm leading-tight font-medium whitespace-nowrap\">\n                  {{ step.title }}\n                </h3>\n              }\n              @if (step.description) {\n                <p\n                  z-tooltip\n                  [zContent]=\"step.description\"\n                  [zAutoDetect]=\"true\"\n                  zPosition=\"bottom\"\n                  class=\"text-muted-foreground mt-1 truncate text-xs whitespace-nowrap\">\n                  {{ step.description }}\n                </p>\n              }\n            </div>\n          }\n        }\n      </li>\n    }\n  }\n</ol>\n", styles: ["z-steps ol li:not(:last-child)>div[class*=border-s]{height:calc(100% + 2rem)}z-steps ol li[class*=mb-6]:not(:last-child)>div[class*=border-s]{height:calc(100% + 1.5rem)}z-steps ol li[class*=mb-10]:not(:last-child)>div[class*=border-s]{height:calc(100% + 2.5rem)}z-steps .z-steps-arrow-item{position:relative;display:flex;flex-direction:column;justify-content:center;transition:all .2s ease-out}z-steps .z-steps-arrow-item:hover{filter:brightness(.92)}z-steps .z-steps-arrow-first{border-radius:.375rem 0 0 .375rem;clip-path:polygon(0 0,calc(100% - 16px) 0,100% 50%,calc(100% - 16px) 100%,0 100%)}z-steps .z-steps-arrow-middle{margin-left:-.5rem;padding-left:2rem;clip-path:polygon(0 0,calc(100% - 16px) 0,100% 50%,calc(100% - 16px) 100%,0 100%,16px 50%)}z-steps .z-steps-arrow-last{margin-left:-.5rem;padding-left:2rem;border-radius:0 .375rem .375rem 0;clip-path:polygon(0 0,100% 0,100% 100%,0 100%,16px 50%)}\n"], dependencies: [{ kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zAnimatedType", "zAnimate", "zAnimationTrigger", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "directive", type: ZTooltipDirective, selector: "[z-tooltip], [zTooltip]", inputs: ["zContent", "zPosition", "zTooltipPosition", "zTrigger", "zTooltipTrigger", "zTooltipType", "zTooltipSize", "zClass", "zTooltipClass", "zShowDelay", "zTooltipShowDelay", "zHideDelay", "zTooltipHideDelay", "zArrow", "zTooltipArrow", "zDisabled", "zTooltipDisabled", "zOffset", "zTooltipOffset", "zAutoDetect", "zTriggerElement", "zAlwaysShow", "zMaxWidth"], outputs: ["zShow", "zHide"], exportAs: ["zTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZStepsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'z-steps', imports: [ZIconComponent, ZTooltipDirective], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'block',
                    }, template: "<ol\n  [class]=\"containerClasses()\"\n  [class.rounded-md]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.border]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.border-border/70]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.bg-muted/20]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\"\n  [class.p-2]=\"effectiveOrientation() === 'horizontal' && (zType() === 'inline' || zType() === 'dot')\">\n  @for (step of mergedSteps(); track $index; let i = $index; let last = $last) {\n    @if (effectiveOrientation() === 'vertical') {\n      @if (zType() === 'dot') {\n        <!-- Vertical Dot Layout -->\n        <li\n          class=\"flex items-start gap-3\"\n          [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n          [class.cursor-not-allowed]=\"step.disabled\"\n          [class.opacity-50]=\"step.disabled\"\n          (click)=\"onStepClick(i)\">\n          <!-- Dot + Line Column -->\n          <div class=\"flex w-10 shrink-0 flex-col items-center\">\n            <!-- Dot -->\n            <span [class]=\"getDotClassesByIndex()[i]\" class=\"shrink-0\"></span>\n            <!-- Vertical Line -->\n            @if (!last) {\n              <div\n                class=\"my-1 h-10 w-[0.125rem] rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/30]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n\n          <!-- Content (optional) -->\n          @if (step.title) {\n            <span\n              class=\"pt-0.5 text-sm\"\n              [class.text-foreground]=\"stepStatuses()[i] === 'current'\"\n              [class.font-medium]=\"stepStatuses()[i] === 'current'\"\n              [class.text-muted-foreground]=\"stepStatuses()[i] !== 'current'\">\n              {{ step.title }}\n            </span>\n          }\n        </li>\n      } @else {\n        <!-- Vertical Layout -->\n        <li\n          class=\"flex items-start gap-3\"\n          [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n          [class.cursor-not-allowed]=\"step.disabled\"\n          [class.opacity-50]=\"step.disabled\"\n          (click)=\"onStepClick(i)\">\n          <div class=\"flex w-10 shrink-0 flex-col items-center\">\n            <!-- Step Icon -->\n            <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto!\">\n              @switch (stepStatuses()[i]) {\n                @case ('completed') {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else {\n                    <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                }\n                @case ('error') {\n                  <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                }\n                @default {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else if (zShowNumber()) {\n                    <span class=\"font-medium\">{{ i + 1 }}</span>\n                  }\n                }\n              }\n            </span>\n\n            <!-- Vertical Line -->\n            @if (!last) {\n              <div\n                class=\"my-1 h-10 w-[0.125rem] rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/30]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n\n          <!-- Content -->\n          @if (step.title || step.description) {\n            <div class=\"min-w-0 flex-1 pt-1 pb-3\">\n              @if (step.title) {\n                <h3 class=\"leading-tight font-medium\">{{ step.title }}</h3>\n              }\n              @if (step.description) {\n                <p class=\"text-muted-foreground mt-1 text-sm\">{{ step.description }}</p>\n              }\n            </div>\n          }\n        </li>\n      }\n    } @else {\n      <!-- Horizontal Layout -->\n      <li\n        [class]=\"zType() === 'arrow' ? 'flex-1' : 'flex-1 last:flex-none'\"\n        [class.cursor-pointer]=\"zClickable() && !step.disabled\"\n        [class.cursor-not-allowed]=\"step.disabled\"\n        [class.opacity-50]=\"step.disabled\"\n        (click)=\"onStepClick(i)\">\n        @if (zType() === 'arrow') {\n          <!-- Arrow Style -->\n          <div [class]=\"getArrowClassesByIndex()[i]\">\n            <div class=\"flex items-center gap-3.5\">\n              @if (step.icon) {\n                <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" class=\"shrink-0\" />\n              }\n              <div class=\"flex min-w-0 flex-col\">\n                @if (step.title) {\n                  <h3\n                    z-tooltip\n                    [zContent]=\"step.title\"\n                    [zAutoDetect]=\"true\"\n                    zPosition=\"top\"\n                    class=\"truncate text-sm leading-tight font-semibold whitespace-nowrap\">\n                    {{ step.title }}\n                  </h3>\n                }\n                @if (step.description) {\n                  <p\n                    z-tooltip\n                    [zContent]=\"step.description\"\n                    [zAutoDetect]=\"true\"\n                    zPosition=\"bottom\"\n                    class=\"mt-1 truncate text-xs whitespace-nowrap opacity-80\">\n                    {{ step.description }}\n                  </p>\n                }\n              </div>\n            </div>\n          </div>\n        } @else if (zType() === 'dot') {\n          <!-- Dot Style: Simple dots with optional labels -->\n          <div class=\"flex items-center\">\n            <!-- Dot -->\n            <span [class]=\"getDotClassesByIndex()[i]\"></span>\n\n            <!-- Content (optional) -->\n            @if (step.title) {\n              <span\n                z-tooltip\n                [zContent]=\"step.title\"\n                [zAutoDetect]=\"true\"\n                zPosition=\"top\"\n                class=\"ms-2 max-w-24 truncate text-sm whitespace-nowrap\"\n                [class.text-foreground]=\"stepStatuses()[i] === 'current'\"\n                [class.font-medium]=\"stepStatuses()[i] === 'current'\"\n                [class.text-muted-foreground]=\"stepStatuses()[i] !== 'current'\">\n                {{ step.title }}\n              </span>\n            }\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div\n                class=\"mx-3 h-[0.1875rem] min-w-8 flex-1 rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/25]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n        } @else if (zType() === 'inline') {\n          <!-- Inline: Icon + Content + Line in one row -->\n          <div class=\"flex items-center\">\n            <div class=\"flex min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2\">\n              <!-- Step Icon -->\n              <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto! shrink-0\">\n                @switch (stepStatuses()[i]) {\n                  @case ('completed') {\n                    @if (step.icon) {\n                      <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    } @else {\n                      <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    }\n                  }\n                  @case ('error') {\n                    <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                  @default {\n                    @if (step.icon) {\n                      <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                    } @else if (zShowNumber()) {\n                      <span class=\"font-medium\">{{ i + 1 }}</span>\n                    }\n                  }\n                }\n              </span>\n\n              <!-- Content Inline -->\n              @if (step.title || step.description) {\n                <div class=\"min-w-0 flex-1\">\n                  @if (step.title) {\n                    <h3\n                      z-tooltip\n                      [zContent]=\"step.title\"\n                      [zAutoDetect]=\"true\"\n                      zPosition=\"top\"\n                      class=\"truncate text-sm leading-tight font-medium whitespace-nowrap\">\n                      {{ step.title }}\n                    </h3>\n                  }\n                  @if (step.description) {\n                    <p\n                      z-tooltip\n                      [zContent]=\"step.description\"\n                      [zAutoDetect]=\"true\"\n                      zPosition=\"bottom\"\n                      class=\"text-muted-foreground mt-1 truncate text-xs whitespace-nowrap\">\n                      {{ step.description }}\n                    </p>\n                  }\n                </div>\n              }\n            </div>\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div\n                class=\"mx-3 h-[0.1875rem] min-w-8 flex-1 rounded-full\"\n                [class.bg-primary]=\"stepStatuses()[i] === 'completed'\"\n                [class.bg-destructive/40]=\"stepStatuses()[i] === 'error'\"\n                [class.bg-muted-foreground/25]=\"\n                  stepStatuses()[i] !== 'completed' && stepStatuses()[i] !== 'error'\n                \"></div>\n            }\n          </div>\n        } @else {\n          <!-- Default: Icon + Line row, Content below -->\n          <div class=\"flex items-center\">\n            <!-- Step Icon -->\n            <span [class]=\"iconClassesMap().get(i)\" class=\"relative! start-auto! shrink-0\">\n              @switch (stepStatuses()[i]) {\n                @case ('completed') {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else {\n                    <z-icon zType=\"lucideCheck\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  }\n                }\n                @case ('error') {\n                  <z-icon zType=\"lucideX\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                }\n                @default {\n                  @if (step.icon) {\n                    <z-icon [zType]=\"step.icon\" [zSize]=\"getIconSizeByIndex()[i]\" />\n                  } @else if (zShowNumber()) {\n                    <span class=\"font-medium\">{{ i + 1 }}</span>\n                  }\n                }\n              }\n            </span>\n\n            <!-- Horizontal Line -->\n            @if (!last) {\n              <div [class]=\"getConnectorClassesByIndex()[i]\"></div>\n            }\n          </div>\n\n          <!-- Content Below -->\n          @if (step.title || step.description) {\n            <div\n              class=\"z-steps-content mt-3 flex flex-col text-center\"\n              [style.width.px]=\"150\"\n              [style.margin-left.px]=\"(iconWidth() - 150) / 2\">\n              @if (step.title) {\n                <h3\n                  z-tooltip\n                  [zContent]=\"step.title\"\n                  [zAutoDetect]=\"true\"\n                  zPosition=\"top\"\n                  class=\"truncate text-sm leading-tight font-medium whitespace-nowrap\">\n                  {{ step.title }}\n                </h3>\n              }\n              @if (step.description) {\n                <p\n                  z-tooltip\n                  [zContent]=\"step.description\"\n                  [zAutoDetect]=\"true\"\n                  zPosition=\"bottom\"\n                  class=\"text-muted-foreground mt-1 truncate text-xs whitespace-nowrap\">\n                  {{ step.description }}\n                </p>\n              }\n            </div>\n          }\n        }\n      </li>\n    }\n  }\n</ol>\n", styles: ["z-steps ol li:not(:last-child)>div[class*=border-s]{height:calc(100% + 2rem)}z-steps ol li[class*=mb-6]:not(:last-child)>div[class*=border-s]{height:calc(100% + 1.5rem)}z-steps ol li[class*=mb-10]:not(:last-child)>div[class*=border-s]{height:calc(100% + 2.5rem)}z-steps .z-steps-arrow-item{position:relative;display:flex;flex-direction:column;justify-content:center;transition:all .2s ease-out}z-steps .z-steps-arrow-item:hover{filter:brightness(.92)}z-steps .z-steps-arrow-first{border-radius:.375rem 0 0 .375rem;clip-path:polygon(0 0,calc(100% - 16px) 0,100% 50%,calc(100% - 16px) 100%,0 100%)}z-steps .z-steps-arrow-middle{margin-left:-.5rem;padding-left:2rem;clip-path:polygon(0 0,calc(100% - 16px) 0,100% 50%,calc(100% - 16px) 100%,0 100%,16px 50%)}z-steps .z-steps-arrow-last{margin-left:-.5rem;padding-left:2rem;border-radius:0 .375rem .375rem 0;clip-path:polygon(0 0,100% 0,100% 100%,0 100%,16px 50%)}\n"] }]
        }], propDecorators: { zOnStepClick: [{ type: i0.Output, args: ["zOnStepClick"] }], zControl: [{ type: i0.Output, args: ["zControl"] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zSteps: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSteps", required: true }] }], zCurrent: [{ type: i0.Input, args: [{ isSignal: true, alias: "zCurrent", required: false }] }], zOrientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOrientation", required: false }] }], zType: [{ type: i0.Input, args: [{ isSignal: true, alias: "zType", required: false }] }], zSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSize", required: false }] }], zClickable: [{ type: i0.Input, args: [{ isSignal: true, alias: "zClickable", required: false }] }], zShowNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShowNumber", required: false }] }], zResponsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "zResponsive", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { ZStepsComponent, zStepsArrowItemVariants, zStepsConnectorVariants, zStepsContainerVariants, zStepsIconVariants, zStepsItemVariants, zStepsLineVariants };
//# sourceMappingURL=shival99-z-ui-components-z-steps.mjs.map
