(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[36],{965:function(e,t,i){"use strict";i.r(t),i.d(t,"AuWidgetMockup3DViewer",function(){return c}),i.d(t,"widget",function(){return c});var r,s=i(0),a=i(911),n=i(2),o=i(762),d=i(1),l=i(761),u=i(577);!function(e){e.default="default",e.blender="blender"}(r||(r={}));let c=class extends o.a{constructor(){super(),this._DAMockupsApiClientConfig=this._createProductApiClientConfig(),this._DAMockupsApi=new a.b(this._DAMockupsApiClientConfig,this.designAtomsApiUrl)}_createProductApiClientConfig(){const e=new a.a;return e.apiUrl=this.backOfficeUrl,e.setAuthorizationToken(this.token),e}get ownerId(){var e;return null===(e=this.auWizard.driver.user)||void 0===e?void 0:e.id}get backOfficeUrl(){return d.a.removeTrailingSlash(this.auWizard.driver.backOffice.backOfficeUrl)}get designAtomsApiUrl(){return d.a.removeTrailingSlash(this.auWizard.driver.backOffice.designAtomsApiUrl)}get tenantId(){return this.auWizard.driver.backOffice.tenantId}get token(){return this.auWizard.driver.backOffice.token}async updateParams(e){var t;if(d.a.isEmptyArray(e.items))return;const i=e.items.some(e=>0===e.images.filter(e=>e).length),s=e.items.some(e=>d.a.isEmptyString(e.model));if(i||s)return;this.origamiViewer=null,this.speed=null!==(t=e.animationSpeed)&&void 0!==t?t:this.speed,this._preloaderLockingSum=0,this.showPreloader(!0);const a=this.querySelectorShadow("#divContainer"),n=[];for(let t of e.items)n.push(await this._getTextModel(t));const o=new class{constructor(e,t,i,s){this.preloader=!0,this.axesHelperEnabled=!1,this.orbitsControlEnabled=!0,this.container=e,this.onLoadCallback=s,this.backgroundColor=t.backgroundColor||u.a,this.orbitsControl=t.orbitsControl,this.distance=t.distance,this.camera=t.cameraButtons,this.pauseAtEnd=t.pauseAtEnd,this.preloader=t.preloader,this.modelType=null!=t.modelType?t.modelType:r.default,this.items=t.items.map((e,t)=>{const r=Object.assign({},e);return r.model=i[t],r})}}(a,e,n,()=>{this.showPreloader(!1),this.SetAnimationSpeed(this.speed),this.PlayAnimation(),setTimeout(()=>{this.image=this.origamiViewer.renderer.domElement.toDataURL(),this.emitChange({image:this.image})},1500)});this.origamiViewer=new window.Aurigma.Origami.Viewer(o,!0),setTimeout(()=>this.applyInterfaceParams(e),250)}async _getTextModel(e){const t=await this._DAMockupsApi.getGeometryFile(e.model,e.isPrivateMockup?this.ownerId:null,this.tenantId);return await t.data.text()}};c=Object(s.a)([Object(n.a)("au-widget-mockup-3d-viewer",l),Object(s.b)("design:paramtypes",[])],c)}}]);