(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[48],{958:function(t,e,n){"use strict";n.r(e),n.d(e,"AuWidgetSteps",function(){return l}),n.d(e,"widget",function(){return l});var i,s=n(0),r=n(2),a=n(76),o=n(14),c=n(1),u=n(46),d=n(160);!function(t){t[t.previous=0]="previous",t[t.visited=1]="visited",t[t.all=2]="all"}(i||(i={}));var l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._isSubscribedToOnFinish=!1,e}return Object(s.d)(e,t),e.prototype.connectedCallback=function(){var e=this;t.prototype.connectedCallback.call(this),this.stepSubscription=this.observe(o.a.STEP_CHANGED).subscribe(function(t){return Object(s.b)(e,void 0,void 0,function(){var e;return Object(s.e)(this,function(n){switch(n.label){case 0:return this._currentStep=null===(e=null===t||void 0===t?void 0:t.data)||void 0===e?void 0:e.step,[4,this.updateParamsAsync(this.params)];case 1:return n.sent(),[2]}})})})},e.prototype._stepChangeCallback=function(t){return Object(s.b)(this,void 0,void 0,function(){return Object(s.e)(this,function(e){if(c.a.isNotNullOrUndefined(this.params)&&c.a.isNotNullOrUndefined(this.params.availabilityMode))switch(i[this.params.availabilityMode.toString()]){case i.previous:this.stepsManager.handleModePrevious(t);break;case i.visited:this.stepsManager.handleModeVisited(t);break;case i.all:}return[2]})})},e.prototype.updateParams=function(t){},e.prototype.updateParamsAsync=function(e){var n,i;return Object(s.b)(this,void 0,void 0,function(){return Object(s.e)(this,function(s){switch(s.label){case 0:return[4,t.prototype.updateParamsAsync.call(this,e)];case 1:return s.sent(),(null===e||void 0===e?void 0:e.steps)?[4,this.changeStepState(e.steps)]:[3,3];case 2:s.sent(),s.label=3;case 3:return(null===e||void 0===e?void 0:e.finishButton)&&((null===(n=e.finishButton)||void 0===n?void 0:n.onClick)&&this._subscribeToOnFinishClick(null===(i=e.finishButton)||void 0===i?void 0:i.onClick),this.stepsManager.finishButton=e.finishButton,this.stepsManager.update()),(null===e||void 0===e?void 0:e.backToProductButton)&&(this.stepsManager.backToProductButton=e.backToProductButton,this.stepsManager.update()),this._currentStep?[4,this._stepChangeCallback(this._currentStep)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[2]}})})},e.prototype._subscribeToOnFinishClick=function(t){return Object(s.b)(this,void 0,void 0,function(){var e=this;return Object(s.e)(this,function(n){return this.publishData({selector:"#finishButton"},o.a.GET_ELEMENT_FROM_AU_WIZARD).then(function(n){n&&(e._isSubscribedToOnFinish||(n.onFinish.subscribe(function(){return Object(s.b)(e,void 0,void 0,function(){return Object(s.e)(this,function(e){switch(e.label){case 0:return[4,c.a.functionWrapperConstructor(t)()];case 1:return e.sent(),[2]}})})}),e._isSubscribedToOnFinish=!0))}),[2]})})},e.prototype.changeStepState=function(t){return Object(s.b)(this,void 0,void 0,function(){var e,n,i,r,a,o,c,u,d;return Object(s.e)(this,function(l){switch(l.label){case 0:e=this.stepsManager.steps,l.label=1;case 1:l.trys.push([1,6,7,8]),n=Object(s.k)(Object.entries(t)),i=n.next(),l.label=2;case 2:return i.done?[3,5]:(r=Object(s.h)(i.value,2),a=r[0],o=r[1],[4,this._applyConfig(e,a,o)]);case 3:l.sent(),l.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return c=l.sent(),u={error:c},[3,8];case 7:try{i&&!i.done&&(d=n.return)&&d.call(n)}finally{if(u)throw u.error}return[7];case 8:return this.stepsManager.update(),[2]}})})},e.prototype._applyConfig=function(t,e,n){return Object(s.b)(this,void 0,void 0,function(){var i,r;return Object(s.e)(this,function(s){return(i=c.a.isNum(e)?t[Number(e)]:t.find(function(t){return t.title===e||t.name===e}))&&(r=t.indexOf(i),c.a.isNotNullOrUndefined(n.enabled)&&this.stepsManager.toggleDisable(r,!n.enabled,!1),c.a.isNotNullOrUndefined(n.disabled)&&this.stepsManager.toggleDisable(r,n.disabled,!1),c.a.isNotNullOrUndefined(n.hidden)&&this.stepsManager.toggleHidden(r,n.hidden,!1)),[2]})})},Object(s.c)([Object(u.b)("StepsManager"),Object(s.g)("design:type",a.a)],e.prototype,"stepsManager",void 0),Object(s.c)([Object(r.c)(),Object(s.g)("design:type",Object)],e.prototype,"params",void 0),e=Object(s.c)([Object(r.a)("au-widget-steps")],e)}(d.a)}}]);