/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @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 s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},t.d=(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let s=e.default;var i=t.n(s);let o=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,i=this.options,o=i.x||0,r=i.y,n=(0,s.clamp)(e.top+e.height+r,t.plotTop,t.plotTop+t.plotHeight),a={};t.styledMode||(a={cursor:i.cursor,stroke:i.lineColor,"stroke-width":i.lineWidth,dashstyle:i.lineDashStyle}),this.lastPos=n-r,this.controlLine||(this.controlLine=t.renderer.path().addClass("highcharts-axis-resizer")),this.controlLine.add(e.axisGroup);let h=t.styledMode?this.controlLine.strokeWidth():i.lineWidth;a.d=t.renderer.crispLine([["M",e.left+o,n],["L",e.left+e.width+o,n]],h),this.controlLine.attr(a)}addMouseEvents(){let e,t,i,o=this,r=o.controlLine.element,n=o.axis.chart.container,a=[];o.mouseMoveHandler=e=e=>o.onMouseMove(e),o.mouseUpHandler=t=e=>o.onMouseUp(e),o.mouseDownHandler=i=()=>o.onMouseDown(),a.push((0,s.addEvent)(n,"mousemove",e),(0,s.addEvent)(n.ownerDocument,"mouseup",t),(0,s.addEvent)(r,"mousedown",i),(0,s.addEvent)(n,"touchmove",e),(0,s.addEvent)(n.ownerDocument,"touchend",t),(0,s.addEvent)(r,"touchstart",i)),o.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,i=this.options.controlledAxis,o=0===i.next.length?[t.yAxis.indexOf(this.axis)+1]:i.next,r=[this.axis].concat(i.prev),n=[],a=t.plotTop,h=t.plotHeight,l=a+h,d=e=>100*e/h+"%",p=(e,t,i)=>Math.round((0,s.clamp)(e,t,i));e=(0,s.clamp)(e,a,l);let c=!1,u=e-this.lastPos;if(u*u<1)return;let x=!0;for(let i of[r,o])for(let r of i){let v,f,g=(0,s.isNumber)(r)?t.yAxis[r]:x?r:t.get(r),m=g&&g.options,y={};if(!m||m.isInternal){x=!1;continue}f=g.top;let z=Math.round((0,s.relativeLength)(m.minLength||NaN,h)),M=Math.round((0,s.relativeLength)(m.maxLength||NaN,h));if(x||i!==o)(v=p(e-f,z,M))===M&&(c=!0),e=f+v,n.push({axis:g,options:{height:d(v)}});else{if(u=e-this.lastPos,v=p(g.len-u,z,M),(f=g.top+u)+v>l){let t=l-v-f;e+=t,f+=t}f<a&&(f=a)+v>l&&(v=h),v===z&&(c=!0),n.push({axis:g,options:{top:d(f-a),height:d(v)}})}x=!1,y.height=v}if(!c){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}},r={minLength:"10%",maxLength:"100%",resize:{controlledAxis:{next:[],prev:[]},enabled:!1,cursor:"ns-resize",lineColor:"var(--highcharts-neutral-color-20)",lineDashStyle:"Solid",lineWidth:4,x:0,y:0}},{defaultOptions:n}=i();function a(){let e=this.resizer,t=this.options.resize;if(t){let s=!1!==t.enabled;e?s?e.init(this,!0):e.destroy():s&&(this.resizer=new o(this))}}function h(e){!e.keepEvents&&this.resizer&&this.resizer.destroy()}function l(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}function d(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}let p=i();({compose:function(e,t){e.keepProps.includes("resizer")||((0,s.merge)(!0,n.yAxis,r),e.keepProps.push("resizer"),(0,s.addEvent)(e,"afterRender",a),(0,s.addEvent)(e,"destroy",h),(0,s.wrap)(t.prototype,"runPointActions",d),(0,s.wrap)(t.prototype,"drag",l))}}).compose(p.Axis,p.Pointer);let c=i();export{c as default};