/*! For license information please see 7813.js.LICENSE.txt */
"use strict";(self.webpackChunkmp_webgl=self.webpackChunkmp_webgl||[]).push([[7813],{20014:(e,t,i)=>{i.d(t,{g:()=>o,l:()=>a});var s=i(92475);class a extends s.E{constructor(e,t){super(e),this.pinchDelta=t}}class o extends s.E{constructor(e,t,i){super(e),this.pinchDelta=t,this.timeSinceLastMove=i}}},44667:(e,t,i)=>{i.d(t,{s:()=>a});var s=i(92475);class a extends s.E{constructor(e,t,i){super(e),this.position=t,this.delta=i}}},60043:(e,t,i)=>{i.d(t,{k:()=>a});var s=i(49586);class a extends s.T{constructor(e,t,i){super(),this.key=e,this.state=t,this.modifiers=i}}},31285:(e,t,i)=>{i.d(t,{A:()=>a});var s=i(7478);class a extends s.QB{constructor(e){super(),this.zoomLevel=e}}},37813:(e,t,i)=>{i.r(t),i.d(t,{default:()=>k});var s=i(64882),a=i(71687),o=i(44667),n=i(20014),r=i(60043),h=i(71397),d=i(28337),c=i(10459),l=i(12767),m=i(99583),u=i(12837),p=i(3249),w=i(53172),g=i(46771);const D=.1,y=.7,v=2,b=3,z=1.1;var B=i(74717),S=i(31285),T=i(76318);class k extends s.n{constructor(){super(...arguments),this.name="zoom-controls",this.uhQuality={},this.config={enabled:!0}}async init(e,t){this.config.enabled=!!e.enabled,this.sweepTilingModule=await t.getModuleBySymbol(a.qD),this.config.enabled&&await this.registerControls(t),this.engine=t,this.cameraModule=await t.getModuleBySymbol(a.jh),this.cameraData=await t.market.waitForData(c.M),this.viewmodeData=await t.market.waitForData(m.X),this.sweepData=await t.market.waitForData(u.A),this.bindings.push(t.commandBinder.addBinding(B.EG,(async e=>this.zoomBy(e.step))),t.commandBinder.addBinding(B.De,(async e=>this.zoomBy(-e.step))),t.commandBinder.addBinding(B.i9,(async()=>this.zoomTo(1))),t.commandBinder.addBinding(B.hd,(async e=>this.zoomTo(e.value))),t.commandBinder.addBinding(B.BW,(async()=>Promise.resolve(this.getMaxZoomAvailable()))))}async registerControls(e){e.getModuleBySymbol(a.mL).then((e=>{this.bindings.push(e.registerHandler(o.s,(e=>this.zoomByInput(this.scrollToZoomDelta(e))))),this.bindings.push(e.registerHandler(n.l,(e=>this.zoomByInput(this.pinchToZoomDelta(e))))),this.bindings.push(e.registerHandler(r.k,(e=>this.keyHandler(e))))}))}zoomTo(e){const t=this.cameraData.zoom();if(!this.validateViewmode())return t;const i=this.sweepData.state.currentSweep,{currentSweepObject:s}=this.sweepData;if(s&&this.checkTilingZoomLevels(e,s),(e=(0,p.qE)(e,y,this.getMaxZoom(i)))!==t){const t=(0,w.H)(this.cameraData.baseFovY/e),i=l.Bv.near,s=l.Bv.far;this.cameraModule.getCameraControllerForViewport().updateCameraProjection((new g.k).makePerspectiveFov(t,this.cameraData.aspect(),i,s))}return this.engine.broadcast(new S.A(e)),e}checkTilingZoomLevels(e,t){if(e>=z&&this.zoomedSweep!==t){this.zoomedSweep=t;this.sweepTilingModule.enableZooming(!0,t.id)?this.uhQuality[t.id]=!0:(this.uhQuality[t.id]=!1,this.zoomedSweep=void 0)}else e<z&&this.zoomedSweep&&this.zoomedSweep===t&&(this.sweepTilingModule.enableZooming(!1,this.zoomedSweep.id),this.zoomedSweep=void 0)}getMaxZoom(e){return this.uhQuality[null!=e?e:"none"]?b:v}zoomBy(e){const t=this.cameraData.zoom();return this.validateViewmode()?this.zoomTo(t+e):t}validateViewmode(){return this.viewmodeData.isInside()&&this.cameraData.canTransition()}scrollToZoomDelta(e){return-Math.sign(e.delta.y)*D}pinchToZoomDelta(e){return e.pinchDelta*(v-y)}zoomByInput(e){const t=this.cameraData.zoom();if(!this.validateViewmode())return t;const i=this.sweepData.state.currentSweep,s=(0,p.qE)(t+e,y,this.getMaxZoom(i));return this.zoomTo(s)}keyHandler(e){if(e.state===d.$.DOWN)switch(e.key){case h.D.PLUSEQUALS:this.zoomByInput(D);break;case h.D.DASHUNDERSCORE:this.zoomByInput(-D);break;case h.D.OPENBRACKET:this.zoomTo(1)}}getMaxZoomAvailable(){if(!this.sweepData.currentSweepObject)return v;return this.sweepData.currentSweepObject.availableResolution(T.MF.ULTRAHIGH)>=T.MF.ULTRAHIGH?b:v}}},28337:(e,t,i)=>{var s;i.d(t,{$:()=>s}),function(e){e[e.DOWN=0]="DOWN",e[e.PRESSED=1]="PRESSED",e[e.UP=2]="UP"}(s||(s={}))}}]);