(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[51],{901: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'},943:function(t,e,i){"use strict";i.r(e),i.d(e,"AuWidgetVariantSelector",function(){return s}),i.d(e,"widget",function(){return s});var n=i(0),r=i(1),a=i(2),c=i(160),o=i(901);let s=class extends c.c{constructor(){super(...arguments),this.onDoubleClick=null}async exportWidgetData(t){return{selectedVariant:this.selectedVariant}}async restoreWidgetFromData(t,e){this.selectedVariant=t.selectedVariant,this.emitChange()}updateParams(t){t.onDoubleClick&&(this.onDoubleClick=r.a.functionWrapperConstructor(t.onDoubleClick)),this._initIFrame(t.productId,t.productVersionId,t.productFilterId)}async _initIFrame(t,e,i){const n=this.querySelectorShadow("#frameID"),r=n.contentWindow||n,a=n.contentDocument||r.document,c=await this.getScriptContent();a.write(c),this._element=a.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(i)&&(this._element.productFilterId=Number(i)),this._element.addEventListener("variantSelected",t=>{this.selectedVariant=t.detail,this.emitChange()}),this._element.addEventListener("variantDoubleClicked",t=>{this.onDoubleClick&&this.onDoubleClick()}),a.write("<body></body"),a.body.appendChild(this._element)}async getScriptContent(){let t=await(async()=>{let t="";if(this.driver.backOffice&&0!==this.driver.backOffice.tenantId){const e=r.a.ensureEndsWith(this.driver.backOffice.backOfficeUrl,"/")+"assets/variant-selector/dist/variantSelector.html?t="+Date.now();try{t=await r.a.loadHtml(e)}catch(t){console.warn(`Failed to load VariantSelector scripts from backend ${e}`)}}return t})();return""===t&&(t=await(async()=>await r.a.loadHtml(r.a.getPatchedUrl("static/variant-selector/variantSelector.html?t="+Date.now())))()),t}};Object(n.a)([Object(a.c)(),Object(n.b)("design:type",Object)],s.prototype,"selectedVariant",void 0),s=Object(n.a)([Object(a.a)("au-widget-variant-selector",o)],s)}}]);