import{s as e,p as t}from"./d3-selection-DXmtSzok.js";import{d as n}from"./d3-dispatch-Q6TpkW-B.js";const o={passive:!1},r={capture:!0,passive:!1};function a(e){e.stopImmediatePropagation()}function i(e){e.preventDefault(),e.stopImmediatePropagation()}function u(t){var n=t.document.documentElement,o=e(t).on("dragstart.drag",i,r);"onselectstart"in n?o.on("selectstart.drag",i,r):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function c(t,n){var o=t.document.documentElement,a=e(t).on("dragstart.drag",null);n&&(a.on("click.drag",i,r),setTimeout(function(){a.on("click.drag",null)},0)),"onselectstart"in o?a.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const l=e=>()=>e;function s(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:a,x:i,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function f(e){return!e.ctrlKey&&!e.button}function d(){return this.parentNode}function g(e,t){return null==t?{x:e.x,y:e.y}:t}function h(){return navigator.maxTouchPoints||"ontouchstart"in this}function v(){var v,m,p,b,y=f,x=d,w=g,_=h,j={},T=n("start","drag","end"),E=0,k=0;function M(e){e.on("mousedown.drag",P).filter(_).on("touchstart.drag",U).on("touchmove.drag",X,o).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function P(t,n){if(!b&&y.call(this,t,n)){var o=I(this,x.call(this,t,n),t,n,"mouse");o&&(e(t.view).on("mousemove.drag",z,r).on("mouseup.drag",S,r),u(t.view),a(t),p=!1,v=t.clientX,m=t.clientY,o("start",t))}}function z(e){if(i(e),!p){var t=e.clientX-v,n=e.clientY-m;p=t*t+n*n>k}j.mouse("drag",e)}function S(t){e(t.view).on("mousemove.drag mouseup.drag",null),c(t.view,p),i(t),j.mouse("end",t)}function U(e,t){if(y.call(this,e,t)){var n,o,r=e.changedTouches,i=x.call(this,e,t),u=r.length;for(n=0;n<u;++n)(o=I(this,i,e,t,r[n].identifier,r[n]))&&(a(e),o("start",e,r[n]))}}function X(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=j[o[t].identifier])&&(i(e),n("drag",e,o[t]))}function D(e){var t,n,o=e.changedTouches,r=o.length;for(b&&clearTimeout(b),b=setTimeout(function(){b=null},500),t=0;t<r;++t)(n=j[o[t].identifier])&&(a(e),n("end",e,o[t]))}function I(e,n,o,r,a,i){var u,c,l,f=T.copy(),d=t(i||o,n);if(null!=(l=w.call(e,new s("beforestart",{sourceEvent:o,target:M,identifier:a,active:E,x:d[0],y:d[1],dx:0,dy:0,dispatch:f}),r)))return u=l.x-d[0]||0,c=l.y-d[1]||0,function o(i,g,h){var v,m=d;switch(i){case"start":j[a]=o,v=E++;break;case"end":delete j[a],--E;case"drag":d=t(h||g,n),v=E}f.call(i,e,new s(i,{sourceEvent:g,subject:l,target:M,identifier:a,active:v,x:d[0]+u,y:d[1]+c,dx:d[0]-m[0],dy:d[1]-m[1],dispatch:f}),r)}}return M.filter=function(e){return arguments.length?(y="function"==typeof e?e:l(!!e),M):y},M.container=function(e){return arguments.length?(x="function"==typeof e?e:l(e),M):x},M.subject=function(e){return arguments.length?(w="function"==typeof e?e:l(e),M):w},M.touchable=function(e){return arguments.length?(_="function"==typeof e?e:l(!!e),M):_},M.on=function(){var e=T.on.apply(T,arguments);return e===T?M:e},M.clickDistance=function(e){return arguments.length?(k=(e=+e)*e,M):Math.sqrt(k)},M}s.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};export{u as a,v as d,c as y};
