"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5217],{25217(e,t,i){i.r(t),i.d(t,{default:()=>w});var a=i(49186),s=i(17676),c=i(83300),l=i(16930),o=i(19211),n=i(35063),r=i(28208),h=i(66655);class w{constructor(e,t,i,c,w,u,d,f,m,p){this.level=e,this.row=t,this.column=i,this.horizontalFieldOfView=c,this.verticalFieldOfView=w,this.yaw=u,this.pitch=d,this.distance=f,this.horizonAngles=m,this.getPixelBlock=p,this._cache=null,this.loadMesh=async e=>{const{level:t,row:i,column:c,horizontalFieldOfView:w,verticalFieldOfView:u,yaw:d,pitch:f,distance:m}=this,{Mesh:p,MeshComponent:v,MeshVertexAttributes:g,panoramicMeshManager:A}=await(0,h.Zg)(),{faces:x,...M}=await A.getFacesWithVertexAttributes({distance:m,yaw:d,horizontalFieldOfView:w,pitch:f,verticalFieldOfView:u});(0,s.Te)(e);const V=await this.getPixelBlock(t,i,c,e);if((0,s.Te)(e),!V)throw new a.A("panoramic-viewer:missing-tile-data",`Tile data for level ${t}, row ${i}, column ${c} is missing`,{level:t,row:i,column:c});const b=await A.convertPixelBlockToImageData(V);(0,s.Te)(e);const k=new p({vertexAttributes:new g(M),components:[new v({faces:x,trustSourceNormals:!0,material:new o.default({colorTexture:new n.default({data:b})})})],spatialReference:l.A.WebMercator});return k.rotate(...this.horizonAngles,{origin:r.ZH}),await k.load(e),this._cache=k,this._cache},this.loadMeshAtDistance=async(e,t)=>{const i=this.distance;return this.distance=e,Math.abs(i-e)>1e-6&&this._cache?this._cache:await this.loadMesh(t)}}get loaded(){return null!==this._cache}get key(){return`${this.level}/${this.row}/${this.column}`}clone(){const{level:e,row:t,column:i,horizontalFieldOfView:a,verticalFieldOfView:s,yaw:l,pitch:o,distance:n,getPixelBlock:r,horizonAngles:h}=this,u=new w(e,t,i,a,s,l,o,n,h,r);if(this._cache){const{vertexAttributes:e,components:t,spatialReference:i}=this._cache,a=t?.map(({material:e,faces:t,trustSourceNormals:i})=>({material:e,faces:t?.slice(),trustSourceNormals:i}));u._cache=new c.default({components:a,vertexAttributes:e.clone(),spatialReference:i})}return u}}}}]);