/**
 * Highstock JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/drag-panes
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Drag-panes module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Kacper Madej
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as e from"../highcharts.js";var t={};t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var s in o)t.o(o,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:o[s]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let o=e.default;var s=t.n(o);let{doc:i,win:n}=s();function r(e,t,o,i={}){let n="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(n,"hcEvents")||(n.hcEvents={});let a=n.hcEvents;s().Point&&e instanceof s().Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let l=e.addEventListener;l&&l.call(e,t,o,!!s().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==t.indexOf("touch"):i.passive,capture:!1}),a[t]||(a[t]=[]);let c={fn:o,order:"number"==typeof i.order?i.order:1/0};return a[t].push(c),a[t].sort((e,t)=>e.order-t.order),function(){!function(e,t,o){function s(t,o){let s=e.removeEventListener;s&&s.call(e,t,o,!1)}function i(o){let i,n;e.nodeName&&(t?(i={})[t]=!0:i=o,h(i,function(e,t){if(o[t])for(n=o[t].length;n--;)s(t,o[t][n].fn)}))}let n="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(n,"hcEvents")){let e=n.hcEvents;if(t){let n=e[t]||[];o?(e[t]=n.filter(function(e){return o!==e.fn}),s(t,o)):(i(e),e[t]=[])}else i(e),delete n.hcEvents}}(e,t,o)}}function a(e,t,o){return e>t?e<o?e:o:t}function l(e){return c(e)&&"number"==typeof e.nodeType}function c(e,t){let o;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(o=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==o)}function h(e,t,o){for(let s in e)Object.hasOwnProperty.call(e,s)&&t.call(o||e[s],e[s],s,e)}function p(e,t,o){return/%$/.test(e)?t*parseFloat(e)/100+(o||0):parseFloat(e)}function u(e,t,o){let s=e[t];e[t]=function(){let e=arguments,t=this;return o.apply(this,[function(){return s.apply(t,arguments.length?arguments:e)}].concat([].slice.call(arguments)))}}Array.prototype.find;let d=class{constructor(e){this.init(e)}init(e,t){this.axis=e,this.options=e.options.resize||{},this.render(),t||this.addMouseEvents()}render(){let e=this.axis,t=e.chart,o=this.options,s=o.x||0,i=o.y,n=a(e.top+e.height+i,t.plotTop,t.plotTop+t.plotHeight),r={};t.styledMode||(r={cursor:o.cursor,stroke:o.lineColor,"stroke-width":o.lineWidth,dashstyle:o.lineDashStyle}),this.lastPos=n-i,this.controlLine||(this.controlLine=t.renderer.path().addClass("highcharts-axis-resizer")),this.controlLine.add(e.axisGroup);let l=t.styledMode?this.controlLine.strokeWidth():o.lineWidth;r.d=t.renderer.crispLine([["M",e.left+s,n],["L",e.left+e.width+s,n]],l),this.controlLine.attr(r)}addMouseEvents(){let e,t,o,s=this,i=s.controlLine.element,n=s.axis.chart.container,a=[];s.mouseMoveHandler=e=e=>s.onMouseMove(e),s.mouseUpHandler=t=e=>s.onMouseUp(e),s.mouseDownHandler=o=()=>s.onMouseDown(),a.push(r(n,"mousemove",e),r(n.ownerDocument,"mouseup",t),r(i,"mousedown",o),r(n,"touchmove",e),r(n.ownerDocument,"touchend",t),r(i,"touchstart",o)),s.eventsToUnbind=a}onMouseMove(e){if(!e.touches||0!==e.touches[0].pageX){let t=this.axis.chart.pointer;this.grabbed&&t&&(this.hasDragged=!0,this.updateAxes(t.normalize(e).chartY-(this.options.y||0)))}}onMouseUp(e){let t=this.axis.chart.pointer;this.hasDragged&&t&&this.updateAxes(t.normalize(e).chartY-(this.options.y||0)),this.grabbed=this.hasDragged=this.axis.chart.activeResizer=void 0}onMouseDown(){this.axis.chart.pointer?.reset(!1,0),this.grabbed=this.axis.chart.activeResizer=!0}updateAxes(e){let t=this.axis.chart,o=this.options.controlledAxis,s=0===o.next.length?[t.yAxis.indexOf(this.axis)+1]:o.next,i=[this.axis].concat(o.prev),n=[],r=t.plotTop,l=t.plotHeight,c=r+l,h=e=>100*e/l+"%",u=(e,t,o)=>Math.round(a(e,t,o));e=a(e,r,c);let d=!1,f=e-this.lastPos;if(f*f<1)return;let y=!0;for(let o of[i,s])for(let i of o){let a,v,x="number"==typeof i&&!isNaN(i)&&i<1/0&&i>-1/0?t.yAxis[i]:y?i:t.get(i),g=x&&x.options,m={};if(!g||g.isInternal){y=!1;continue}v=x.top;let b=Math.round(p(g.minLength||NaN,l)),z=Math.round(p(g.maxLength||NaN,l));if(y||o!==s)(a=u(e-v,b,z))===z&&(d=!0),e=v+a,n.push({axis:x,options:{height:h(a)}});else{if(f=e-this.lastPos,a=u(x.len-f,b,z),(v=x.top+f)+a>c){let t=c-a-v;e+=t,v+=t}v<r&&(v=r)+a>c&&(a=l),a===b&&(d=!0),n.push({axis:x,options:{top:h(v-r),height:h(a)}})}y=!1,m.height=a}if(!d){for(let e of n)e.axis.update(e.options,!1);t.redraw(!1)}}destroy(){let e=this.axis;for(let t of(delete e.resizer,this.eventsToUnbind&&this.eventsToUnbind.forEach(e=>e()),this.controlLine.destroy(),Object.keys(this)))this[t]=null}},f={minLength:"10%",maxLength:"100%",resize:{controlledAxis:{next:[],prev:[]},enabled:!1,cursor:"ns-resize",lineColor:"#cccccc",lineDashStyle:"Solid",lineWidth:4,x:0,y:0}},{defaultOptions:y}=s();function v(){let e=this.resizer,t=this.options.resize;if(t){let o=!1!==t.enabled;e?o?e.init(this,!0):e.destroy():o&&(this.resizer=new d(this))}}function x(e){!e.keepEvents&&this.resizer&&this.resizer.destroy()}function g(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}function m(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}let b=s();({compose:function(e,t){e.keepProps.includes("resizer")||(!function(e,...t){let o,s=[e,...t],i={},n=function(e,t){return"object"!=typeof e&&(e={}),h(t,function(o,s){if("__proto__"!==s&&"constructor"!==s){let i;!c(o,!0)||(i=o?.constructor,c(o,!0)&&!l(o)&&i?.name&&"Object"!==i.name)||l(o)?e[s]=t[s]:e[s]=n(e[s]||{},o)}}),e};!0===e&&(i=s[1],s=Array.prototype.slice.call(s,2));let r=s.length;for(o=0;o<r;o++)i=n(i,s[o])}(!0,y.yAxis,f),e.keepProps.push("resizer"),r(e,"afterRender",v),r(e,"destroy",x),u(t.prototype,"runPointActions",m),u(t.prototype,"drag",g))}}).compose(b.Axis,b.Pointer);let z=s();export{z as default};