/**
 * Highstock JS v11.3.0 (2024-01-10)
 *
 * Drag-panes module
 *
 * (c) 2010-2024 Highsoft AS
 * Author: Kacper Madej
 *
 * License: www.highcharts.com/license
 */!function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/modules/drag-panes",["highcharts","highcharts/modules/stock"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function s(e,t,s,i){e.hasOwnProperty(t)||(e[t]=i.apply(null,s),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}s(t,"Extensions/DragPanes/AxisResizerDefaults.js",[],function(){return{minLength:"10%",maxLength:"100%",resize:{controlledAxis:{next:[],prev:[]},enabled:!1,cursor:"ns-resize",lineColor:"#cccccc",lineDashStyle:"Solid",lineWidth:4,x:0,y:0}}}),s(t,"Extensions/DragPanes/AxisResizer.js",[t["Extensions/DragPanes/AxisResizerDefaults.js"],t["Core/Globals.js"],t["Core/Utilities.js"]],function(e,t,s){let{hasTouch:i}=t,{addEvent:o,clamp:n,isNumber:r,relativeLength:a}=s;class h{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,s=this.options,i=s.x||0,o=s.y,r=n(e.top+e.height+o,t.plotTop,t.plotTop+t.plotHeight),a={};t.styledMode||(a={cursor:s.cursor,stroke:s.lineColor,"stroke-width":s.lineWidth,dashstyle:s.lineDashStyle}),this.lastPos=r-o,this.controlLine||(this.controlLine=t.renderer.path().addClass("highcharts-axis-resizer")),this.controlLine.add(e.axisGroup);let h=t.styledMode?this.controlLine.strokeWidth():s.lineWidth;a.d=t.renderer.crispLine([["M",e.left+i,r],["L",e.left+e.width+i,r]],h),this.controlLine.attr(a)}addMouseEvents(){let e,t,s;let n=this,r=n.controlLine.element,a=n.axis.chart.container,h=[];n.mouseMoveHandler=e=e=>n.onMouseMove(e),n.mouseUpHandler=t=e=>n.onMouseUp(e),n.mouseDownHandler=s=e=>n.onMouseDown(e),h.push(o(a,"mousemove",e),o(a.ownerDocument,"mouseup",t),o(r,"mousedown",s)),i&&h.push(o(a,"touchmove",e),o(a.ownerDocument,"touchend",t),o(r,"touchstart",s)),n.eventsToUnbind=h}onMouseMove(e){(!e.touches||0!==e.touches[0].pageX)&&this.grabbed&&(this.hasDragged=!0,this.updateAxes(this.axis.chart.pointer.normalize(e).chartY-this.options.y))}onMouseUp(e){this.hasDragged&&this.updateAxes(this.axis.chart.pointer.normalize(e).chartY-this.options.y),this.grabbed=this.hasDragged=this.axis.chart.activeResizer=void 0}onMouseDown(e){this.axis.chart.pointer.reset(!1,0),this.grabbed=this.axis.chart.activeResizer=!0}updateAxes(e){let t=this.axis.chart,s=this.options.controlledAxis,i=0===s.next.length?[t.yAxis.indexOf(this.axis)+1]:s.next,o=[this.axis].concat(s.prev),h=[],l=t.plotTop,c=t.plotHeight,d=l+c,u=e=>100*e/c+"%",p=(e,t,s)=>Math.round(n(e,t,s));e=n(e,l,d);let x=!1,f=e-this.lastPos;if(f*f<1)return;let g=!0;for(let s of[o,i])for(let i of s){let s,o;let n=r(i)?t.yAxis[i]:g?i:t.get(i),m=n&&n.options,y={};if(!m||"navigator-y-axis"===m.id){g=!1;continue}o=n.top;let z=Math.round(a(m.minLength||NaN,c)),v=Math.round(a(m.maxLength||NaN,c));if(g)(s=p(e-o,z,v))===v&&(x=!0),e=o+s,h.push({axis:n,options:{height:u(s)}});else{if(f=e-this.lastPos,s=p(n.len-f,z,v),(o=n.top+f)+s>d){let t=d-s-o;e+=t,o+=t}o<l&&(o=l)+s>d&&(s=c),s===z&&(x=!0),h.push({axis:n,options:{top:u(o-l),height:u(s)}})}g=!1,y.height=s}if(!x){for(let e of h)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}}return h.resizerOptions=e,h}),s(t,"Extensions/DragPanes/DragPanes.js",[t["Extensions/DragPanes/AxisResizer.js"],t["Core/Defaults.js"],t["Core/Globals.js"],t["Core/Utilities.js"]],function(e,t,s,i){let{defaultOptions:o}=t,{composed:n}=s,{addEvent:r,merge:a,pushUnique:h,wrap:l}=i;function c(){let t=this.resizer,s=this.options.resize;if(s){let i=!1!==s.enabled;t?i?t.init(this,!0):t.destroy():i&&(this.resizer=new e(this))}}function d(e){!e.keepEvents&&this.resizer&&this.resizer.destroy()}function u(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}function p(e){this.chart.activeResizer||e.apply(this,[].slice.call(arguments,1))}return{compose:function t(s,i){h(n,t)&&(a(!0,o.yAxis,e.resizerOptions),s.keepProps.push("resizer"),r(s,"afterRender",c),r(s,"destroy",d),l(i.prototype,"runPointActions",p),l(i.prototype,"drag",u))}}}),s(t,"masters/modules/drag-panes.src.js",[t["Core/Globals.js"],t["Extensions/DragPanes/AxisResizer.js"],t["Extensions/DragPanes/DragPanes.js"]],function(e,t,s){e.AxisResizer=t,s.compose(e.Axis,e.Pointer)})});