(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[48],{958:function(t,s,e){"use strict";e.r(s),e.d(s,"AuWidgetSteps",function(){return u}),e.d(s,"widget",function(){return u});var i,a=e(0),n=e(2),o=e(76),r=e(14),c=e(1),d=e(46),p=e(160);!function(t){t[t.previous=0]="previous",t[t.visited=1]="visited",t[t.all=2]="all"}(i||(i={}));let u=class extends p.a{constructor(){super(...arguments),this._isSubscribedToOnFinish=!1}connectedCallback(){super.connectedCallback(),this.stepSubscription=this.observe(r.a.STEP_CHANGED).subscribe(t=>this._stepChangeCallback(t))}async _stepChangeCallback(t){const s=t.data.step;if(c.a.isNotNullOrUndefined(this.params)&&c.a.isNotNullOrUndefined(this.params.availabilityMode)){switch(i[this.params.availabilityMode.toString()]){case i.previous:await this.stepsManager.handleModePrevious(s);break;case i.visited:await this.stepsManager.handleModeVisited(s);break;case i.all:}this.updateParams(this.params)}}updateParams(t){var s,e;t.steps&&this.changeStepState(t.steps),t.finishButton&&((null===(s=t.finishButton)||void 0===s?void 0:s.onClick)&&this._subscribeToOnFinishClick(null===(e=t.finishButton)||void 0===e?void 0:e.onClick),this.stepsManager.finishButton=t.finishButton,this.stepsManager.update()),t.backToProductButton&&(this.stepsManager.backToProductButton=t.backToProductButton,this.stepsManager.update())}async _subscribeToOnFinishClick(t){this.publishData({selector:"#finishButton"},r.a.GET_ELEMENT_FROM_AU_WIZARD).then(s=>{s&&(this._isSubscribedToOnFinish||(s.onFinish.subscribe(async()=>{await c.a.functionWrapperConstructor(t)()}),this._isSubscribedToOnFinish=!0))})}async changeStepState(t){const s=this.stepsManager.steps;for(const[e,i]of Object.entries(t))await this._applyConfig(s,e,i);this.stepsManager.update()}async _applyConfig(t,s,e){const i=c.a.isNum(s)?t[Number(s)]:t.find(t=>t.title===s||t.name===s);if(i){const s=t.indexOf(i);c.a.isNotNullOrUndefined(e.enabled)&&this.stepsManager.toggleDisable(s,!e.enabled,!1),c.a.isNotNullOrUndefined(e.disabled)&&this.stepsManager.toggleDisable(s,e.disabled,!1),c.a.isNotNullOrUndefined(e.hidden)&&this.stepsManager.toggleHidden(s,e.hidden,!1)}}};Object(a.a)([Object(d.b)("StepsManager"),Object(a.b)("design:type",o.a)],u.prototype,"stepsManager",void 0),Object(a.a)([Object(n.c)(),Object(a.b)("design:type",Object)],u.prototype,"params",void 0),u=Object(a.a)([Object(n.a)("au-widget-steps")],u)}}]);