// Version 1.1.1 d3-zoomable - https://github.com/vasturiano/d3-zoomable !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).zoomable=n()}(this,function(){"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function e(t){for(var e=1;e=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),i.hasOwnProperty(n)?{space:i[n],local:t}:t}function u(t){var n=o(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===r&&n.documentElement.namespaceURI===r?n.createElement(t):n.createElementNS(e,t)}})(n)}function a(){}function s(t){return null==t?a:function(){return this.querySelector(t)}}function c(){return[]}function l(t){return null==t?c:function(){return this.querySelectorAll(t)}}function h(t){return function(){return this.matches(t)}}function f(t){return new Array(t.length)}function p(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}p.prototype={constructor:p,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var d="$";function m(t,n,e,r,i,o){for(var u,a=0,s=n.length,c=o.length;an?1:t>=n?0:NaN}function g(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function _(t,n){return t.style.getPropertyValue(n)||g(t).getComputedStyle(t,null).getPropertyValue(n)}function w(t){return t.trim().split(/^|\s+/)}function b(t){return t.classList||new x(t)}function x(t){this._node=t,this._names=w(t.getAttribute("class")||"")}function k(t,n){for(var e=b(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var X={},q=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(X={mouseenter:"mouseover",mouseleave:"mouseout"}));function O(t,n,e){return t=Y(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Y(t,n,e){return function(r){var i=q;q=r;try{t.call(this,this.__data__,n,e)}finally{q=i}}}function j(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=k&&(k=x+1);!(b=_[k])&&++k=0;)(r=i[o])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=y);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):_(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=w(t+"");if(arguments.length<2){for(var r=b(this.node()),i=-1,o=e.length;++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),u=o.length;if(!(arguments.length<2)){for(a=n?I:j,null==e&&(e=!1),r=0;r=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),u=-1,a=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u0)for(var e,r,i=new Array(e),o=0;o=0&&n._call.call(null,t),n=n._next;--nt}()}finally{nt=0,function(){var t,n,e=Z,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Z=n);tt=t,vt(r)}(),ut=0}}function mt(){var t=st.now(),n=t-ot;n>it&&(at-=n,ot=t)}function vt(t){nt||(et&&(et=clearTimeout(et)),t-ut>24?(t<1/0&&(et=setTimeout(dt,t-st.now()-at)),rt&&(rt=clearInterval(rt))):(rt||(ot=st.now(),rt=setInterval(mt,it)),nt=1,ct(dt)))}function yt(t,n,e){var r=new ft;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}ft.prototype=pt.prototype={constructor:ft,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?lt():+e)+(null==n?0:+n),this._next||tt===this||(tt?tt._next=this:Z=this,tt=this),this._call=t,this._time=e,vt()},stop:function(){this._call&&(this._call=null,this._time=1/0,vt())}};var gt=K("start","end","cancel","interrupt"),_t=[],wt=0,bt=1,xt=2,kt=3,Mt=4,Et=5,zt=6;function Nt(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(s){var c,l,h,f;if(e.state!==bt)return a();for(c in i)if((f=i[c]).name===e.name){if(f.state===kt)return yt(o);f.state===Mt?(f.state=zt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+cwt)throw new Error("too late; already scheduled");return e}function St(t,n){var e=Tt(t,n);if(e.state>kt)throw new Error("too late; already running");return e}function Tt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Ct(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>xt&&e.state>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=Dt.exec(t))?Ft(parseInt(n[1],16)):(n=Ut.exec(t))?new Jt(n[1],n[2],n[3],1):(n=Vt.exec(t))?new Jt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Rt.exec(t))?Kt(n[1],n[2],n[3],n[4]):(n=Bt.exec(t))?Kt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Lt.exec(t))?tn(n[1],n[2]/100,n[3]/100,1):(n=$t.exec(t))?tn(n[1],n[2]/100,n[3]/100,n[4]):Gt.hasOwnProperty(t)?Ft(Gt[t]):"transparent"===t?new Jt(NaN,NaN,NaN,0):null}function Ft(t){return new Jt(t>>16&255,t>>8&255,255&t,1)}function Kt(t,n,e,r){return r<=0&&(t=n=e=NaN),new Jt(t,n,e,r)}function Qt(t){return t instanceof qt||(t=Ht(t)),t?new Jt((t=t.rgb()).r,t.g,t.b,t.opacity):new Jt}function Wt(t,n,e,r){return 1===arguments.length?Qt(t):new Jt(t,n,e,null==r?1:r)}function Jt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Zt(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function tn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new nn(t,n,e,r)}function nn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function en(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Pt(qt,Ht,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Pt(Jt,Wt,Xt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Zt(this.r)+Zt(this.g)+Zt(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Pt(nn,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof nn)return new nn(t.h,t.s,t.l,t.opacity);if(t instanceof qt||(t=Ht(t)),!t)return new nn;if(t instanceof nn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e0&&s<1?0:u,new nn(u,a,s,t.opacity)}(t):new nn(t,n,e,null==r?1:r)},Xt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Jt(en(t>=240?t-240:t+120,i,r),en(t,i,r),en(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var rn=Math.PI/180,on=180/Math.PI,un=.96422,an=1,sn=.82521,cn=4/29,ln=6/29,hn=3*ln*ln,fn=ln*ln*ln;function pn(t){if(t instanceof dn)return new dn(t.l,t.a,t.b,t.opacity);if(t instanceof _n){if(isNaN(t.h))return new dn(t.l,0,0,t.opacity);var n=t.h*rn;return new dn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Jt||(t=Qt(t));var e,r,i=gn(t.r),o=gn(t.g),u=gn(t.b),a=mn((.2225045*i+.7168786*o+.0606169*u)/an);return i===o&&o===u?e=r=a:(e=mn((.4360747*i+.3850649*o+.1430804*u)/un),r=mn((.0139322*i+.0971045*o+.7141733*u)/sn)),new dn(116*a-16,500*(e-a),200*(a-r),t.opacity)}function dn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function mn(t){return t>fn?Math.pow(t,1/3):t/hn+cn}function vn(t){return t>ln?t*t*t:hn*(t-cn)}function yn(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _n(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Pt(dn,function(t,n,e,r){return 1===arguments.length?pn(t):new dn(t,n,e,null==r?1:r)},Xt(qt,{brighter:function(t){return new dn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new dn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Jt(yn(3.1338561*(n=un*vn(n))-1.6168667*(t=an*vn(t))-.4906146*(e=sn*vn(e))),yn(-.9787684*n+1.9161415*t+.033454*e),yn(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Pt(_n,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof _n)return new _n(t.h,t.c,t.l,t.opacity);if(t instanceof dn||(t=pn(t)),0===t.a&&0===t.b)return new _n(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*on;return new _n(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new _n(t,n,e,null==r?1:r)},Xt(qt,{brighter:function(t){return new _n(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new _n(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var wn=-.14861,bn=1.78277,xn=-.29227,kn=-.90649,Mn=1.97294,En=Mn*kn,zn=Mn*bn,Nn=bn*xn-kn*wn;function An(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Sn(t){return function(){return t}}function Tn(t){return 1==(t=+t)?Cn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Sn(isNaN(n)?e:n)}}function Cn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Sn(isNaN(t)?n:t)}Pt(An,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);t instanceof Jt||(t=Qt(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Nn*r+En*n-zn*e)/(Nn+En-zn),o=r-i,u=(Mn*(e-i)-xn*o)/kn,a=Math.sqrt(u*u+o*o)/(Mn*i*(1-i)),s=a?Math.atan2(u,o)*on-120:NaN;return new An(s<0?s+360:s,a,i,t.opacity)}(t):new An(t,n,e,null==r?1:r)},Xt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new An(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*rn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Jt(255*(n+e*(wn*r+bn*i)),255*(n+e*(xn*r+kn*i)),255*(n+e*(Mn*r)),this.opacity)}}));var Pn=function t(n){var e=Tn(n);function r(t,n){var r=e((t=Wt(t)).r,(n=Wt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=Cn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}return r.gamma=t,r}(1);function Xn(t,n){return n-=t=+t,function(e){return t+n*e}}var qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,On=new RegExp(qn.source,"g");var Yn,jn,In,Dn,Un=180/Math.PI,Vn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Rn(t,n,e,r,i,o){var u,a,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,s/=a),t*r180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Xn(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,u.rotate,a,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Xn(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,u.skewX,a,s),function(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:Xn(t,e)},{i:a-2,x:Xn(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,u.scaleX,u.scaleY,a,s),o=u=null,function(t){for(var n,e=-1,r=s.length;++eo&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,s.push({i:u,x:Xn(e,r)})),o=On.lastIndex;return o=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?At:St;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}(e,t,n))},attr:function(t,n){var e=o(t),r="transform"===e?$n:Zn;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttributeNS(t.space,t.local))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttribute(t))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttribute(t)}})(e,r,Jn(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttributeNS(t.space,t.local);return u===o?null:u===r?i:i=n(r=u,e)}}:function(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttribute(t);return u===o?null:u===r?i:i=n(r=u,e)}})(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=o(t);return this.tween(e,(r.local?function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n(e))}}(t,i)),e}return i._value=n,i}:function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n(e))}}(t,i)),e}return i._value=n,i})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Ln:Zn;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=_(this,t),u=(this.style.removeProperty(t),_(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}(t,r)).on("end.style."+t,ne(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var u=_(this,t),a=e(this),s=a+"";return null==a&&(this.style.removeProperty(t),s=a=_(this,t)),u===s?null:u===r&&s===i?o:(i=s,o=n(r=u,a))}}(t,r,Jn(this,"style."+t,n))).each(function(t,n){var e,r,i,o,u="style."+n,a="end."+u;return function(){var s=St(this,t),c=s.on,l=null==s.value[u]?o||(o=ne(n)):void 0;c===e&&i===l||(r=(e=c).copy()).on(a,i=l),s.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var u=_(this,t);return u===o?null:u===r?i:i=n(r=u,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n(r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Jn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Tt(this.node(),e).tween,o=0,u=i.length;or?(r+i)/2:Math.min(0,r)||Math.max(0,i),u>o?(o+u)/2:Math.min(0,o)||Math.max(0,u))}function xe(){var t,n,e=ve,r=ye,i=be,o=_e,u=we,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,l=Wn,h=[],f=K("start","zoom","end"),p=500,d=150,m=0;function v(t){t.property("__zoom",ge).on("wheel.zoom",k).on("mousedown.zoom",M).on("dblclick.zoom",E).filter(u).on("touchstart.zoom",z).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",A).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(t,n){return(n=Math.max(a[0],Math.min(a[1],n)))===t.k?t:new fe(n,t.x,t.y)}function g(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new fe(t.k,r,i)}function _(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,n,e){t.on("start.zoom",function(){b(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).end()}).tween("zoom",function(){var t=arguments,i=b(this,t),o=r.apply(this,t),u=e||_(o),a=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),s=this.__zoom,c="function"==typeof n?n.apply(this,t):n,h=l(s.invert(u).concat(a/s.k),c.invert(u).concat(a/c.k));return function(t){if(1===t)t=c;else{var n=h(t),e=a/n[2];t=new fe(e,u[0]-n[0]*e,u[1]-n[1]*e)}i.zoom(null,t)}})}function b(t,n){for(var e,r=0,i=h.length;rm}t.zoom("mouse",i(g(t.that.__zoom,t.mouse[0]=G(t.that),t.mouse[1]),t.extent,s))},!0).on("mouseup.zoom",function(){r.on("mousemove.zoom mouseup.zoom",null),function(t,n){var e=t.document.documentElement,r=B(t).on("dragstart.drag",null);n&&(r.on("click.drag",ce,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(q.view,t.moved),me(),t.end()},!0),o=G(this),u=q.clientX,a=q.clientY;!function(t){var n=t.document.documentElement,e=B(t).on("dragstart.drag",ce,!0);"onselectstart"in n?e.on("selectstart.drag",ce,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(q.view),de(),t.mouse=[o,this.__zoom.invert(o)],Ct(this),t.start()}}function E(){if(e.apply(this,arguments)){var t=this.__zoom,n=G(this),o=t.invert(n),u=t.k*(q.shiftKey?.5:2),a=i(g(y(t,u),n,o),r.apply(this,arguments),s);me(),c>0?B(this).transition().duration(c).call(w,a,n):B(this).call(v.transform,a)}}function z(){if(e.apply(this,arguments)){var n,r,i,o,u=b(this,arguments),a=q.changedTouches,s=a.length;for(de(),r=0;r=0?r=setTimeout(s,n-c):(r=null,e||(a=t.apply(o,i),o=i=null))}null==n&&(n=100);var c=function(){o=this,i=arguments,u=Date.now();var c=e&&!r;return r||(r=setTimeout(s,n)),c&&(a=t.apply(o,i),o=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=t.apply(o,i),o=i=null,clearTimeout(r),r=null)},c}ke.debounce=ke;var Me=ke;function Ee(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return e}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ze,Ne,Ae,Se,Te,Ce,Pe,Xe,qe,Oe,Ye,je,Ie,De,Ue=function t(n,e){var r=e.default,i=void 0===r?null:r,o=e.triggerUpdate,u=void 0===o||o,a=e.onChange,s=void 0===a?function(t,n){}:a;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=n,this.defaultVal=i,this.triggerUpdate=u,this.onChange=s};return Ne=(ze={props:{htmlEl:{onChange:function(n,e){e.htmlEls=(n?n instanceof Array?n:[n]:[]).map(function(n){return"object"===t(n)&&n.node&&"function"==typeof n.node?n:B(n)})},triggerUpdate:!1},svgEl:{onChange:function(n,e){e.svgEls=(n?n instanceof Array?n:[n]:[]).map(function(n){return"object"===t(n)&&n.node&&"function"==typeof n.node?n:B(n)})},triggerUpdate:!1},canvasEl:{onChange:function(n,e){e.canvasCtxs=(n?n instanceof Array?n:[n]:[]).map(function(n){return"object"===t(n)&&n.node&&"function"==typeof n.node?n.node().getContext("2d"):n.getContext("2d")})},triggerUpdate:!1},enableX:{default:!0,triggerUpdate:!1},enableY:{default:!0,triggerUpdate:!1},scaleExtent:{default:[1,1/0],onChange:function(t,n){t&&n.zoom.scaleExtent(t)},triggerUpdate:!1},translateExtent:{onChange:function(t,n){t&&n.zoom.translateExtent(t)},triggerUpdate:!1},onChange:{triggerUpdate:!1}},methods:{current:function(t){return e({},t.zoomTransform)},zoomBy:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t.initialised&&(t.transitionDuration=e,t.el.call(t.zoom.scaleBy,n)),this},zoomReset:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.initialised&&(t.transitionDuration=n,t.el.call(t.zoom.transform,pe)),this},zoomTo:function(t,n){var e=n.x,r=void 0===e?0:e,i=n.y,o=void 0===i?0:i,u=n.k,a=void 0===u?1:u,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t.initialised&&(t.transitionDuration=s,t.el.call(t.zoom.transform,pe.scale(a).translate(r,o))),this}},stateInit:function(){return{zoom:xe().filter(function(){return!q.button&&!q.dblclick}),zoomTransform:{x:0,y:0,k:1}}},init:function(n,r){var i=!!n&&"object"===t(n)&&!!n.node&&"function"==typeof n.node;r.el=B(i?n.node():n),r.el.call(r.zoom.on("zoom",function(){var t=e({},q.transform);!r.enableX&&(t.x=0),!r.enableY&&(t.y=0);var n=r.zoomTransform;r.zoomTransform=t;var i=r.transitionDuration||0;r.transitionDuration=0;var o=r.enableX?t.k:1,u=r.enableY?t.k:1;r.htmlEls.forEach(function(n){(i?n.transition().duration(i):n).style("transform","translate(".concat(t.x,"px, ").concat(t.y,"px) scale(").concat(o,", ").concat(u,")"))}),r.svgEls.forEach(function(n){(i?n.transition().duration(i):n).attr("transform","translate(".concat(t.x,", ").concat(t.y,") scale(").concat(o,", ").concat(u,")"))}),r.canvasCtxs.forEach(function(a,s){var c=function(t){var n=t.x,e=t.y,r=t.scX,i=t.scY;a.setTransform(r,0,0,i,n,e)};i?ie().duration(i).tween("animate-ctx-".concat(s),function(){var e=Xn(n.x,t.x),i=Xn(n.y,t.y),o=r.enableX?Xn(n.k,t.k):function(){return 1},u=r.enableY?Xn(n.k,t.k):function(){return 1};return function(t){return c({x:e(t),y:i(t),scX:o(t),scY:u(t)})}}):c(e({scX:o,scY:u},t))}),r.onChange&&r.onChange(t,n,i)})),r.el.on("dblclick.zoom",null)}}).stateInit,Ae=void 0===Ne?function(){return{}}:Ne,Se=ze.props,Te=void 0===Se?{}:Se,Ce=ze.methods,Pe=void 0===Ce?{}:Ce,Xe=ze.aliases,qe=void 0===Xe?{}:Xe,Oe=ze.init,Ye=void 0===Oe?function(){}:Oe,je=ze.update,Ie=void 0===je?function(){}:je,De=Object.keys(Te).map(function(t){return new Ue(t,Te[t])}),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},Ae instanceof Function?Ae(t):Ae,{initialised:!1});function e(n){return r(n,t),i(),e}var r=function(t,r){Ye.call(e,t,n,r),n.initialised=!0},i=Me(function(){n.initialised&&Ie.call(e,n)},1);return De.forEach(function(t){e[t.name]=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t,n){};return function(u){var a=n[t];return arguments.length?(n[t]=u,o.call(e,u,n,a),r&&i(),e):a}}(t.name,t.triggerUpdate,t.onChange)}),Object.keys(Pe).forEach(function(t){e[t]=function(){for(var r,i=arguments.length,o=new Array(i),u=0;u