(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[51],{902:function(t,e){t.exports='<style>\n    :host {\n        width: 100%;\n        height: 100%;\n    }\n</style>\n\n<iframe id="frameID" width="100%" height="100%" style="border: none;"></iframe>\n'},944:function(t,e,n){"use strict";n.r(e),n.d(e,"AuWidgetVariantSelector",function(){return s}),n.d(e,"widget",function(){return s});var i=n(0),r=n(1),c=n(2),o=n(160),a=n(902),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onDoubleClick=null,e}return Object(i.d)(e,t),e.prototype.exportWidgetData=function(t){return Object(i.b)(this,void 0,void 0,function(){return Object(i.e)(this,function(t){return[2,{selectedVariant:this.selectedVariant}]})})},e.prototype.restoreWidgetFromData=function(t,e){return Object(i.b)(this,void 0,void 0,function(){return Object(i.e)(this,function(e){return this.selectedVariant=t.selectedVariant,this.emitChange(),[2]})})},e.prototype.updateParams=function(t){t.onDoubleClick&&(this.onDoubleClick=r.a.functionWrapperConstructor(t.onDoubleClick)),this._initIFrame(t.productId,t.productVersionId,t.productFilterId)},e.prototype._initIFrame=function(t,e,n){return Object(i.b)(this,void 0,void 0,function(){var r,c,o,a,s=this;return Object(i.e)(this,function(i){switch(i.label){case 0:return r=this.querySelectorShadow("#frameID"),c=r.contentWindow||r,o=r.contentDocument||c.document,[4,this.getScriptContent()];case 1:return a=i.sent(),o.write(a),this._element=o.createElement("au-product-variant-selector"),this._element.apiUrl=this.auWizard.driver.backOffice.backOfficeUrl,this._element.token=this.auWizard.driver.backOffice.token,Number(t)&&(this._element.productId=Number(t)),Number(e)&&(this._element.productVersionId=Number(e)),Number(n)&&(this._element.productFilterId=Number(n)),this._element.addEventListener("variantSelected",function(t){s.selectedVariant=t.detail,s.emitChange()}),this._element.addEventListener("variantDoubleClicked",function(t){s.onDoubleClick&&s.onDoubleClick()}),o.write("<body></body"),o.body.appendChild(this._element),[2]}})})},e.prototype.getScriptContent=function(){return Object(i.b)(this,void 0,void 0,function(){var t,e,n=this;return Object(i.e)(this,function(c){switch(c.label){case 0:return t=function(){return Object(i.b)(n,void 0,void 0,function(){return Object(i.e)(this,function(t){switch(t.label){case 0:return[4,r.a.loadHtml(r.a.getPatchedUrl("static/variant-selector/variantSelector.html?t="+Date.now()))];case 1:return[2,t.sent()]}})})},[4,function(){return Object(i.b)(n,void 0,void 0,function(){var t,e;return Object(i.e)(this,function(n){switch(n.label){case 0:if(t="",!this.driver.backOffice||0===this.driver.backOffice.tenantId)return[3,4];e=r.a.ensureEndsWith(this.driver.backOffice.backOfficeUrl,"/")+"assets/variant-selector/dist/variantSelector.html?t="+Date.now(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.a.loadHtml(e)];case 2:return t=n.sent(),[3,4];case 3:return n.sent(),console.warn("Failed to load VariantSelector scripts from backend ".concat(e)),[3,4];case 4:return[2,t]}})})}()];case 1:return""!==(e=c.sent())?[3,3]:[4,t()];case 2:e=c.sent(),c.label=3;case 3:return[2,e]}})})},Object(i.c)([Object(c.c)(),Object(i.g)("design:type",Object)],e.prototype,"selectedVariant",void 0),e=Object(i.c)([Object(c.a)("au-widget-variant-selector",a)],e)}(o.c)}}]);