/** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/d3-zoom@3.0.0/src/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ import{dispatch as t}from"../d3-dispatch@3.0.1/b5f7cdc6.js";import{dragDisable as n,dragEnable as e}from"../d3-drag@3.0.0/b22c5864.js";import{interpolateZoom as o}from"../d3-interpolate@3.0.1/034b7bcb.js";import{select as i,pointer as r}from"../d3-selection@3.0.0/5dcd62f4.js";import{interrupt as u}from"../d3-transition@3.0.1/8debb4ba.js";var h=t=>()=>t;function s(t,{sourceEvent:n,target:e,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function a(t,n,e){this.k=t,this.x=n,this.y=e}a.prototype={constructor:a,scale:function(t){return 1===t?this:new a(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new a(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 a(1,0,0);function l(t){for(;!t.__zoom;)if(!(t=t.parentNode))return c;return t.__zoom}function f(t){t.stopImmediatePropagation()}function m(t){t.preventDefault(),t.stopImmediatePropagation()}function p(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function v(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function y(){return this.__zoom||c}function d(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function z(){return navigator.maxTouchPoints||"ontouchstart"in this}function _(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))}function g(){var l,g,k,x=p,w=v,b=_,T=d,M=z,E=[0,1/0],Y=[[-1/0,-1/0],[1/0,1/0]],X=250,V=o,B=t("start","zoom","end"),D=500,P=150,I=0,K=10;function S(t){t.property("__zoom",y).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",Z).filter(M).on("touchstart.zoom",C).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function q(t,n){return(n=Math.max(E[0],Math.min(E[1],n)))===t.k?t:new a(n,t.x,t.y)}function G(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 a(t.k,o,i)}function j(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function A(t,n,e,o){t.on("start.zoom",(function(){H(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){H(this,arguments).event(o).end()})).tween("zoom",(function(){var t=this,i=arguments,r=H(t,i).event(o),u=w.apply(t,i),h=null==e?j(u):"function"==typeof e?e.apply(t,i):e,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),c=t.__zoom,l="function"==typeof n?n.apply(t,i):n,f=V(c.invert(h).concat(s/c.k),l.invert(h).concat(s/l.k));return function(t){if(1===t)t=l;else{var n=f(t),e=s/n[2];t=new a(e,h[0]-n[0]*e,h[1]-n[1]*e)}r.zoom(null,t)}}))}function H(t,n,e){return!e&&t.__zooming||new N(t,n)}function N(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=w.apply(t,n),this.taps=0}function O(t,...n){if(x.apply(this,arguments)){var e=H(this,n).event(t),o=this.__zoom,i=Math.max(E[0],Math.min(E[1],o.k*Math.pow(2,T.apply(this,arguments)))),h=r(t);if(e.wheel)e.mouse[0][0]===h[0]&&e.mouse[0][1]===h[1]||(e.mouse[1]=o.invert(e.mouse[0]=h)),clearTimeout(e.wheel);else{if(o.k===i)return;e.mouse=[h,o.invert(h)],u(this),e.start()}m(t),e.wheel=setTimeout((function(){e.wheel=null,e.end()}),P),e.zoom("mouse",b(G(q(o,i),e.mouse[0],e.mouse[1]),e.extent,Y))}}function W(t,...o){if(!k&&x.apply(this,arguments)){var h=t.currentTarget,s=H(this,o,!0).event(t),a=i(t.view).on("mousemove.zoom",(function(t){if(m(t),!s.moved){var n=t.clientX-l,e=t.clientY-p;s.moved=n*n+e*e>I}s.event(t).zoom("mouse",b(G(s.that.__zoom,s.mouse[0]=r(t,h),s.mouse[1]),s.extent,Y))}),!0).on("mouseup.zoom",(function(t){a.on("mousemove.zoom mouseup.zoom",null),e(t.view,s.moved),m(t),s.event(t).end()}),!0),c=r(t,h),l=t.clientX,p=t.clientY;n(t.view),f(t),s.mouse=[c,this.__zoom.invert(c)],u(this),s.start()}}function Z(t,...n){if(x.apply(this,arguments)){var e=this.__zoom,o=r(t.changedTouches?t.changedTouches[0]:t,this),u=e.invert(o),h=e.k*(t.shiftKey?.5:2),s=b(G(q(e,h),o,u),w.apply(this,n),Y);m(t),X>0?i(this).transition().duration(X).call(A,s,o,t):i(this).call(S.transform,s,o,t)}}function C(t,...n){if(x.apply(this,arguments)){var e,o,i,h,s=t.touches,a=s.length,c=H(this,n,t.changedTouches.length===a).event(t);for(f(t),o=0;o