/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/pointandfigure
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Point and figure series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 *
 * Author: Kamil Musiałowski
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,s={};s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var o=s.n(r);let{setLength:i,splice:n}={convertToNumber:function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}},setLength:function(t,e,s){return Array.isArray(t)?(t.length=e,t):t[s?"subarray":"slice"](0,e)},splice:function(t,e,s,r,o=[]){if(Array.isArray(t))return Array.isArray(o)||(o=Array.from(o)),{removed:t.splice(e,s,...o),array:t};let i=Object.getPrototypeOf(t).constructor,n=t[r?"subarray":"slice"](e,e+s),a=new i(t.length-s+o.length);return a.set(t.subarray(0,e),0),a.set(o,e),a.set(t.subarray(e+s),e+o.length),{removed:n,array:a}}},a=class{constructor(t={}){this.isDataTable=!0,this.autoId=!t.id,this.columns={},this.id=t.id||(0,r.uniqueKey)(),this.rowCount=0,this.versionTag=(0,r.uniqueKey)();let e=0;(0,r.objectEach)(t.columns||{},(t,s)=>{this.columns[s]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,(0,r.objectEach)(this.columns,(e,s)=>{e.length!==t&&(this.columns[s]=i(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let s=0;(0,r.objectEach)(this.columns,(r,o)=>{this.columns[o]=n(r,t,e).array,s=r.length}),this.rowCount=s}(0,r.fireEvent)(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,r.uniqueKey)()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRowObject(t,e){let s={},r=this.columns;for(let o of(e??(e=Object.keys(this.columns)),e))s[o]=r[o]?.[t];return s}setColumn(t,e=[],s=0,r){this.setColumns({[t]:e},s,r)}setColumns(t,e,s){let o=this.rowCount;(0,r.objectEach)(t,(t,e)=>{this.columns[e]=t.slice(),o=t.length}),this.applyRowCount(o),s?.silent||((0,r.fireEvent)(this,"afterSetColumns"),this.versionTag=(0,r.uniqueKey)())}setRow(t,e=this.rowCount,s,o){var i;let{columns:a}=this,l=s?this.rowCount+1:e+1,h=Object.keys(t);if(o?.addColumns!==!1)for(let t=0,e=h.length;t<e;t++)a[i=h[t]]||(a[i]=Array(this.rowCount));(0,r.objectEach)(a,(r,o)=>{r&&(s?r=n(r,e,0,!0,[t[o]]).array:r[e]=o in t?t[o]:r[e],a[o]=r)}),this.applyRowCount(Math.max(l,this.rowCount)),o?.silent||((0,r.fireEvent)(this,"afterSetRows",{rowIndex:e}),this.versionTag=(0,r.uniqueKey)())}getModified(){return this.modified||this}},l=t.default.SeriesRegistry;var h=s.n(l);let{seriesTypes:{scatter:{prototype:{pointClass:u}}}}=h(),p=class extends u{resolveMarker(){let t=this.series.options;this.marker=this.options.marker=this.upTrend?t.markerUp:t.marker,this.color=this.options.marker.lineColor}resolveColor(){super.resolveColor(),this.resolveMarker()}getClassName(){return super.getClassName.call(this)+(this.upTrend?" highcharts-point-up":" highcharts-point-down")}},{composed:c}=o();function d(t,e,s,r){return[["M",t,e],["L",t+s,e+r],["M",t+s,e],["L",t,e+r],["Z"]]}(e||(e={})).compose=function(t){(0,r.pushUnique)(c,"Series.CrossSymbol")&&(t.prototype.symbols.cross=d)};let m=e,{composed:y}=o(),{scatter:f,column:{prototype:g}}=h().seriesTypes;class b extends f{constructor(){super(...arguments),this.allowDG=!1}static compose(t){(0,r.pushUnique)(y,"pointandfigure")&&m.compose(t)}init(){super.init.apply(this,arguments),this.pnfDataGroups=[]}getProcessedData(){let t;if(!this.pnfDataGroups)return{modified:this.dataTable.getModified(),cropped:!1,cropStart:0,closestPointRange:1};let e=this.options,s=this.getColumn("x",!0),o=this.getColumn("y",!0),i=e.boxSize,n=(0,r.isNumber)(i)?i:(0,r.relativeLength)(i,o[0]),l=this.pnfDataGroups,h=n*e.reversalAmount,u=this.dataTable.getModified(),p=u===this.dataTable?u:new a;function c(t,e,s){let r=l[l.length-1],o=e?1:-1,i=Math.floor(o*(t-s)/n);for(let t=1;t<=i;t++){let e=s+n*t*o;r.y.push(e)}}if(this.calculatedBoxSize=n,this.isDirtyData||0===l.length){this.pnfDataGroups.length=0;for(let e=0;e<o.length;e++){let r=s[e],i=o[e],a=o[0];if(i-a>=n){t=!0,l.push({x:r,y:[i],upTrend:t});break}if(a-i>=n){t=!1,l.push({x:r,y:[i],upTrend:t});break}}o.forEach((e,r)=>{let o,i=s[r],a=(o=l[l.length-1].y)[o.length-1];t&&(e-a>=n&&c(e,t,a),a-e>=h&&(t=!1,l.push({x:i,y:[],upTrend:t}),c(e,t,a))),!t&&(a-e>=n&&c(e,t,a),e-a>=h&&(t=!0,l.push({x:i,y:[],upTrend:t}),c(e,t,a)))})}let d=[],m=[],y=[],f=[];return l.forEach(t=>{let e=t.x,s=t.upTrend;t.y.forEach(t=>{m.push(e),y.push(t),f.push(s),d.push({x:e,y:t,upTrend:s})})}),p.setColumn("x",m),p.setColumn("y",y),p.setColumn("upTrend",f),this.pnfDataGroups=l,this.hasProcessedDataTable=!0,{modified:p,cropped:!1,cropStart:0,closestPointRange:1}}markerAttribs(t){let e=this.options,s={},r=t.pos();return s.width=this.markerWidth,s.height=this.markerHeight,r&&s.width&&s.height&&(s.x=r[0]-Math.round(s.width)/2,s.y=r[1]-Math.round(s.height)/2),e.crisp&&s.x&&(s.x=Math.floor(s.x)),s}translate(){let t=this.getColumnMetrics(),e=this.calculatedBoxSize;this.markerWidth=t.width+t.paddedWidth+t.offset,this.markerHeight=this.yAxis.toPixels(0)-this.yAxis.toPixels(e),super.translate()}}b.defaultOptions=(0,r.merge)(f.defaultOptions,{boxSize:"1%",reversalAmount:3,tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>Close: {point.y:.2f}<br/>',headerFormat:""},turboThreshold:0,groupPadding:.2,pointPadding:.1,pointRange:null,dataGrouping:{enabled:!1},markerUp:{symbol:"cross",lineColor:"#00FF00",lineWidth:2},marker:{symbol:"circle",fillColor:"transparent",lineColor:"#FF0000",lineWidth:2},legendSymbol:"lineMarker"}),(0,r.extend)(b.prototype,{takeOrdinalPosition:!0,pnfDataGroups:[],getColumnMetrics:g.getColumnMetrics,pointClass:p,sorted:!0}),h().registerSeriesType("pointandfigure",b);let C=o();b.compose(C.Renderer);let w=o();export{w as default};