var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
import { r as registerInstance, c as createEvent, h, g as getElement } from './chunk-7400f9fd.js';
import './chunk-816ec46a.js';
import './chunk-ec33cfea.js';
import { s as supportsCssVariables, M as MDCRipple } from './chunk-8d68a411.js';
var Step = /** @class */ (function () {
    function Step(hostRef) {
        registerInstance(this, hostRef);
        this.status = 'empty';
        this.active = false;
        this.stepClick = createEvent(this, "stepClick", 7);
        this.previousStep = createEvent(this, "previousStep", 7);
        this.submitStep = createEvent(this, "submitStep", 7);
        this.submitStepper = createEvent(this, "submitStepper", 7);
    }
    Step.prototype.componentDidLoad = function () {
        var _this = this;
        if (supportsCssVariables(window)) {
            MDCRipple.attachTo(this.header);
        }
        var slot = this.host.shadowRoot.querySelector('slot');
        slot.addEventListener('slotchange', function () {
            _this.adjustHeight();
        });
        this.adjustHeight();
    };
    Step.prototype.getStepClasses = function () {
        return {
            'step': true,
            'mdc-typography': true,
            'step-editable': this.editable,
            'step-active': this.active,
            'step-valid': this.status === 'valid',
            'step-empty': this.status === 'empty',
            'step-invalid': this.status === 'invalid',
            'step-last': this.isLast,
        };
    };
    Step.prototype.getStepIconContent = function () {
        if (this.status === 'valid') {
            return h("materials-icon", { name: "done", color: "#fff" });
        }
        else {
            return (this.index + 1).toString();
        }
    };
    Step.prototype.getStepIconClasses = function () {
        return {
            'step-icon': true,
            'step-icon-valid': this.status === 'valid',
            'step-icon-invalid': this.status === 'invalid',
        };
    };
    Step.prototype.getStepBodyClasses = function () {
        return {
            'step-body': true,
            'no-padding': this.noPadding,
            'step-body-active': this.active,
        };
    };
    Step.prototype.handleClickNext = function () {
        if (this.status === 'valid') {
            this.submitStep.emit();
        }
    };
    Step.prototype.handleClickFinish = function () {
        if (this.status === 'valid') {
            this.submitStepper.emit();
        }
    };
    Step.prototype.handleClickPrevious = function () {
        this.previousStep.emit();
    };
    Step.prototype.adjustHeight = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                if (this.body) {
                    this.body.style.maxHeight = this.active ? this.body.scrollHeight + 'px' : '0px';
                }
                return [2 /*return*/];
            });
        });
    };
    Step.prototype.handleLast = function () {
        if (this.isLast) {
            this.host.classList.add('step-last');
        }
        else {
            this.host.classList.remove('step-last');
        }
    };
    Step.prototype.render = function () {
        var _this = this;
        return (h("div", { class: this.getStepClasses() }, h("div", { ref: function (el) { return _this.header = el; }, class: "step-header mdc-ripple-surface", onClick: function () { return _this.stepClick.emit(_this.index); } }, h("div", { class: this.getStepIconClasses() }, this.getStepIconContent()), h("div", { class: "step-title" }, this.stepTitle, this.summary && h("span", { class: "step-summary" }, h("br", null), this.summary), !this.summary && this.optional && h("span", { class: "step-optional" }, h("br", null), "Optionnel"))), h("div", { ref: function (el) { return _this.body = el; }, class: this.getStepBodyClasses() }, h("div", { class: "step-content" }, h("slot", null)), this.showButtons && h("div", { class: "step-buttons" }, this.index > 0 && h("materials-button", { class: "previous-button", onClick: function () { return _this.handleClickPrevious(); }, color: "#444" }, "Pr\u00E9c\u00E9dent"), this.isLast ?
            h("materials-button", { disabled: this.status !== 'valid' && !this.optional, raised: true, onClick: function () { return _this.handleClickFinish(); } }, this.confirmationText ? this.confirmationText : 'Valider')
            : h("materials-button", { disabled: this.status !== 'valid' && !this.optional, raised: true, onClick: function () { return _this.handleClickNext(); } }, "Suivant")), this.confirmationText && !this.showButtons && this.isLast &&
            h("materials-button", { disabled: this.status !== 'valid' && !this.optional, raised: true, onClick: function () { return _this.handleClickFinish(); } }, this.confirmationText))));
    };
    Object.defineProperty(Step.prototype, "host", {
        get: function () { return getElement(this); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Step, "watchers", {
        get: function () {
            return {
                "active": ["adjustHeight"],
                "isLast": ["handleLast"]
            };
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Step, "style", {
        get: function () { return ":host{\@-webkit-keyframes mdc-ripple-fg-radius-in{0%{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}\@keyframes mdc-ripple-fg-radius-in{0%{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start,0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}}\@-webkit-keyframes mdc-ripple-fg-opacity-in{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity,0)}}\@keyframes mdc-ripple-fg-opacity-in{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity,0)}}\@-webkit-keyframes mdc-ripple-fg-opacity-out{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity,0)}to{opacity:0}}\@keyframes mdc-ripple-fg-opacity-out{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity,0)}to{opacity:0}}display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;position:relative}:host .mdc-ripple-surface--test-edge-var-bug{--mdc-ripple-surface-test-edge-var:1px solid #000;visibility:hidden}:host .mdc-ripple-surface--test-edge-var-bug:before{border:var(--mdc-ripple-surface-test-edge-var)}:host .mdc-ripple-surface{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0,0,0,0);position:relative;outline:none;overflow:hidden}:host .mdc-ripple-surface:after,:host .mdc-ripple-surface:before{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}:host .mdc-ripple-surface:before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1}:host .mdc-ripple-surface.mdc-ripple-upgraded:before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}:host .mdc-ripple-surface.mdc-ripple-upgraded:after{top:0;left:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;transform-origin:center center}:host .mdc-ripple-surface.mdc-ripple-upgraded--unbounded:after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}:host .mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation:after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}:host .mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation:after{-webkit-animation:mdc-ripple-fg-opacity-out .15s;animation:mdc-ripple-fg-opacity-out .15s;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}:host .mdc-ripple-surface:after,:host .mdc-ripple-surface:before{background-color:#000}:host .mdc-ripple-surface:hover:before{opacity:.04}:host .mdc-ripple-surface.mdc-ripple-upgraded--background-focused:before,:host .mdc-ripple-surface:not(.mdc-ripple-upgraded):focus:before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface:not(.mdc-ripple-upgraded):after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}:host .mdc-ripple-surface:not(.mdc-ripple-upgraded):active:after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:0.12}:host .mdc-ripple-surface:after,:host .mdc-ripple-surface:before{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}:host .mdc-ripple-surface.mdc-ripple-upgraded:after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded]{overflow:visible}:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded]:after,:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded]:before{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded:after,:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded:before{top:var(--mdc-ripple-top,calc(50% - 50%));left:var(--mdc-ripple-left,calc(50% - 50%));width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}:host .mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded:after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}:host .mdc-ripple-surface--primary:after,:host .mdc-ripple-surface--primary:before{background-color:#6200ee}\@supports not (-ms-ime-align:auto){:host .mdc-ripple-surface--primary:after,:host .mdc-ripple-surface--primary:before{background-color:var(--mdc-theme-primary,#6200ee)}}:host .mdc-ripple-surface--primary:hover:before{opacity:.04}:host .mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused:before,:host .mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus:before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}:host .mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active:after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:0.12}:host .mdc-ripple-surface--accent:after,:host .mdc-ripple-surface--accent:before{background-color:#018786}\@supports not (-ms-ime-align:auto){:host .mdc-ripple-surface--accent:after,:host .mdc-ripple-surface--accent:before{background-color:var(--mdc-theme-secondary,#018786)}}:host .mdc-ripple-surface--accent:hover:before{opacity:.04}:host .mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused:before,:host .mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus:before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}:host .mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active:after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:0.12}:host .mdc-typography{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .mdc-typography--headline1{font-size:6rem;line-height:6rem;letter-spacing:-.015625em}:host .mdc-typography--headline1,:host .mdc-typography--headline2{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:300;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--headline2{font-size:3.75rem;line-height:3.75rem;letter-spacing:-.0083333333em}:host .mdc-typography--headline3{font-size:3rem;line-height:3.125rem;letter-spacing:normal}:host .mdc-typography--headline3,:host .mdc-typography--headline4{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:400;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--headline4{font-size:2.125rem;line-height:2.5rem;letter-spacing:.0073529412em}:host .mdc-typography--headline5{font-size:1.5rem;font-weight:400;letter-spacing:normal}:host .mdc-typography--headline5,:host .mdc-typography--headline6{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;line-height:2rem;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--headline6{font-size:1.25rem;font-weight:500;letter-spacing:.0125em}:host .mdc-typography--subtitle1{font-size:1rem;line-height:1.75rem;font-weight:400;letter-spacing:.009375em}:host .mdc-typography--subtitle1,:host .mdc-typography--subtitle2{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--subtitle2{font-size:.875rem;line-height:1.375rem;font-weight:500;letter-spacing:.0071428571em}:host .mdc-typography--body1{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:1rem;line-height:1.5rem;font-weight:400;letter-spacing:.03125em;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--body2{font-size:.875rem;letter-spacing:.0178571429em}:host .mdc-typography--body2,:host .mdc-typography--caption{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;line-height:1.25rem;font-weight:400;text-decoration:inherit;text-transform:inherit}:host .mdc-typography--caption{font-size:.75rem;letter-spacing:.0333333333em}:host .mdc-typography--button{font-size:.875rem;line-height:2.25rem;letter-spacing:.0892857143em}:host .mdc-typography--button,:host .mdc-typography--overline{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:500;text-decoration:none;text-transform:uppercase}:host .mdc-typography--overline{font-size:.75rem;line-height:2rem;letter-spacing:.1666666667em}:host .step-header{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0,0,0,0);display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:24px;padding:24px;-ms-flex-align:center;align-items:center;overflow:hidden;cursor:pointer}:host .step-header:after,:host .step-header:before{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}:host .step-header:before{-webkit-transition:opacity 15ms linear,background-color 15ms linear;transition:opacity 15ms linear,background-color 15ms linear;z-index:1}:host .step-header.mdc-ripple-upgraded:before{-webkit-transform:scale(var(--mdc-ripple-fg-scale,1));transform:scale(var(--mdc-ripple-fg-scale,1))}:host .step-header.mdc-ripple-upgraded:after{top:0;left:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;transform-origin:center center}:host .step-header.mdc-ripple-upgraded--unbounded:after{top:var(--mdc-ripple-top,0);left:var(--mdc-ripple-left,0)}:host .step-header.mdc-ripple-upgraded--foreground-activation:after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}:host .step-header.mdc-ripple-upgraded--foreground-deactivation:after{-webkit-animation:mdc-ripple-fg-opacity-out .15s;animation:mdc-ripple-fg-opacity-out .15s;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1));transform:translate(var(--mdc-ripple-fg-translate-end,0)) scale(var(--mdc-ripple-fg-scale,1))}:host .step-header:after,:host .step-header:before{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}:host .step-header.mdc-ripple-upgraded:after{width:var(--mdc-ripple-fg-size,100%);height:var(--mdc-ripple-fg-size,100%)}:host .step-header:after,:host .step-header:before{background-color:#000}:host .step-header:hover:before{opacity:.04}:host .step-header.mdc-ripple-upgraded--background-focused:before,:host .step-header:not(.mdc-ripple-upgraded):focus:before{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .step-header:not(.mdc-ripple-upgraded):after{-webkit-transition:opacity .15s linear;transition:opacity .15s linear}:host .step-header:not(.mdc-ripple-upgraded):active:after{-webkit-transition-duration:75ms;transition-duration:75ms;opacity:.12}:host .step-header.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:0.12}:host .step-header .step-icon{background-color:#ccc;color:#fff;border-radius:50%;width:24px;text-align:center;line-height:24px}:host .step-header .step-title{margin-left:6px;font-size:14px;font-weight:400;vertical-align:middle}:host .step-header .step-title .step-optional,:host .step-header .step-title .step-summary{font-weight:400;color:#999}:host .step-body{position:relative;margin-left:36px;padding:0 24px 0 24px;overflow:hidden;-webkit-transition:max-height .5s;transition:max-height .5s}:host .step-body .step-buttons{padding-top:16px;margin-left:-8px;max-height:36px}:host .step-body.no-padding{padding:0!important}:host .step-body.no-padding .step-buttons{padding-left:24px}:host .previous-button{margin-right:16px}:host .step-active .step-icon{background-color:var(--mdc-theme-primary,#6200ee)}:host .step-active .step-title{font-weight:600}:host .step-valid .step-icon{background-color:var(--mdc-theme-primary,#6200ee)}:host .step-invalid .step-icon-invalid{background-color:red}:host .step-invalid .step-title{color:red}:host .step-empty:not(.step-active) .step-title{color:#ccc}:host .step-last{padding-bottom:8px}:host(:not(.step-last)):before{content:\"\";position:absolute;top:56px;bottom:-16px;left:36px;border-left-width:1px;border-left-style:solid;border-left-color:#ccc}"; },
        enumerable: true,
        configurable: true
    });
    return Step;
}());
export { Step as materials_step };
