(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[45],{903:function(e,t){e.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>'},945:function(e,t,i){"use strict";i.r(t),i.d(t,"AuWidgetPreviewMockupSlider",function(){return d}),i.d(t,"widget",function(){return d});var r=i(0),n=i(1),a=i(2),s=i(160),c=i(903);let d=class extends s.c{async exportWidgetData(e){return{previewResourceUrl:this.previewResourceUrl}}async restoreWidgetFromData(e,t){this.previewResourceUrl=e.previewResourceUrl,this.emitChange()}updateParams(e){this._initIFrame(e.productId,e.productVersionId,e.productVariantId,e.stateId,e.previewSize.width,e.previewSize.height)}async createPreviewResource(){return this.previewResourceUrl=await this._element.createPreviewResource(),this.emitChange(),this.previewResourceUrl}async _initIFrame(e,t,i,r,n,a){const s=this.querySelectorShadow("#frameID"),c=s.contentWindow||s,d=s.contentDocument||c.document;if(0===d.head.innerHTML.length){const e=await this.getScriptContent(),t=d.createRange();t.selectNode(d.head);const i=t.createContextualFragment(e);d.head.appendChild(i)}0!==d.body.innerHTML.length&&(d.body.innerHTML=""),this._element=d.createElement("au-preview-mockup-slider"),this._element.token=this.auWizard.driver.backOffice.token,this._element.assetStorageUrl=this.auWizard.driver.backOffice.assetStorageUrl,this._element.backOfficeUrl=this.auWizard.driver.backOffice.backOfficeUrl,this._element.designAtomsApiUrl=this.auWizard.driver.backOffice.designAtomsApiUrl,Number(e)&&(this._element.productId=Number(e)),Number(t)&&(this._element.productVersionId=Number(t)),Number(i)&&(this._element.productVariantId=Number(i)),this._element.tenantId=this.auWizard.driver.backOffice.tenantId,this._element.userId=this.auWizard.driver.user.id,this._element.stateId=r,Number(n)&&(this._element.previewWidth=Number(n)),Number(a)&&(this._element.previewHeight=Number(a)),d.body.appendChild(this._element)}async getScriptContent(){let e=await(async()=>{let e="";if(this.driver.backOffice&&0!==this.driver.backOffice.tenantId){const t=n.a.ensureEndsWith(this.driver.backOffice.backOfficeUrl,"/")+"assets/preview-mockup-slider/dist/previewMockupSlider.html?t="+Date.now();try{e=await n.a.loadHtml(t)}catch(e){console.warn(`Failed to load PreviewMockupSlider scripts from backend ${t}`)}}return e})();return""===e&&(e=await(async()=>await n.a.loadHtml(n.a.getPatchedUrl("static/preview-mockup-slider/previewMockupSlider.html?t="+Date.now())))()),e}};Object(r.a)([Object(a.c)(),Object(r.b)("design:type",String)],d.prototype,"previewResourceUrl",void 0),d=Object(r.a)([Object(a.a)("au-widget-preview-mockup-slider",c)],d)}}]);