// https://d3js.org/d3-zoom/ v1.7.3 Copyright 2018 Mike Bostock !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-dispatch"),require("d3-drag"),require("d3-interpolate"),require("d3-transition")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-drag","d3-interpolate","d3-transition"],n):n(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,o,i,r){"use strict";function u(t){return function(){return t}}function h(t,n,e){this.target=t,this.type=n,this.transform=e}function s(t,n,e){this.k=t,this.x=n,this.y=e}s.prototype={constructor:s,scale:function(t){return 1===t?this:new s(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new s(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var c=new s(1,0,0);function a(t){return t.__zoom||c}function f(){n.event.stopImmediatePropagation()}function l(){n.event.preventDefault(),n.event.stopImmediatePropagation()}function m(){return!n.event.button}function p(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function d(){return this.__zoom||c}function v(){return-n.event.deltaY*(n.event.deltaMode?120:1)/500}function y(){return"ontouchstart"in this}function z(t,n,e){var o=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],r=t.invertY(n[0][1])-e[0][1],u=t.invertY(n[1][1])-e[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),u>r?(r+u)/2:Math.min(0,r)||Math.max(0,u))}a.prototype=s.prototype,t.zoom=function(){var t,a,_=m,g=p,k=z,x=v,w=y,M=[0,1/0],T=[[-1/0,-1/0],[1/0,1/0]],b=250,Y=i.interpolateZoom,X=[],q=e.dispatch("start","zoom","end"),E=500,D=150,V=0;function I(t){t.property("__zoom",d).on("wheel.zoom",K).on("mousedown.zoom",O).on("dblclick.zoom",W).filter(w).on("touchstart.zoom",Z).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function P(t,n){return(n=Math.max(M[0],Math.min(M[1],n)))===t.k?t:new s(n,t.x,t.y)}function S(t,n,e){var o=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return o===t.x&&i===t.y?t:new s(t.k,o,i)}function j(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function B(t,n,e){t.on("start.zoom",function(){G(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){G(this,arguments).end()}).tween("zoom",function(){var t=arguments,o=G(this,t),i=g.apply(this,t),r=e||j(i),u=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),h=this.__zoom,c="function"==typeof n?n.apply(this,t):n,a=Y(h.invert(r).concat(u/h.k),c.invert(r).concat(u/c.k));return function(t){if(1===t)t=c;else{var n=a(t),e=u/n[2];t=new s(e,r[0]-n[0]*e,r[1]-n[1]*e)}o.zoom(null,t)}})}function G(t,n){for(var e,o=0,i=X.length;oV}t.zoom("mouse",k(S(t.that.__zoom,t.mouse[0]=n.mouse(t.that),t.mouse[1]),t.extent,T))},!0).on("mouseup.zoom",function(){e.on("mousemove.zoom mouseup.zoom",null),o.dragEnable(n.event.view,t.moved),l(),t.end()},!0),i=n.mouse(this),u=n.event.clientX,h=n.event.clientY;o.dragDisable(n.event.view),f(),t.mouse=[i,this.__zoom.invert(i)],r.interrupt(this),t.start()}}function W(){if(_.apply(this,arguments)){var t=this.__zoom,e=n.mouse(this),o=t.invert(e),i=t.k*(n.event.shiftKey?.5:2),r=k(S(P(t,i),e,o),g.apply(this,arguments),T);l(),b>0?n.select(this).transition().duration(b).call(B,r,e):n.select(this).call(I.transform,r)}}function Z(){if(_.apply(this,arguments)){var e,o,i,u,h=G(this,arguments),s=n.event.changedTouches,c=s.length;for(f(),o=0;o