/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/textpath-support
 * @requires highcharts
 *
 * (c) 2009-2026 Highsoft AS
 * Author: Torstein Honsi
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e={};e.n=t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a:a}),a},e.d=(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let a=t.default;var r=e.n(a);let{deg2rad:h}=r(),{addEvent:s,merge:l,uniqueKey:n,defined:o,extend:i}=r();function d(t,e){e=l(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let a=this.renderer.url,r=this.text||this,h=r.textPath,{attributes:d,enabled:x}=e;if(t=t||h&&h.path,h&&h.undo(),t&&x){let e=s(r,"afterModifyTree",e=>{if(t&&x){let h=t.attr("id");h||t.attr("id",h=n());let s={x:0,y:0};o(d.dx)&&(s.dx=d.dx,delete d.dx),o(d.dy)&&(s.dy=d.dy,delete d.dy),r.attr(s),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let l=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:i(d,{"text-anchor":d.textAnchor,href:`${a}#${h}`}),children:l}}});r.textPath={path:t,undo:e}}else r.attr({dx:0,dy:0}),delete r.textPath;return this.added&&(r.textCache="",this.renderer.buildText(r)),this}function x(t){let e=t.bBox,a=this.element?.querySelector("textPath");if(a){let t=[],{b:r,h:s}=this.renderer.fontMetrics(this.element),l=s-r,n=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),o=a.innerHTML.replace(n,"").split(/<tspan class="highcharts-br"[^>]*>/),i=o.length,d=(t,e)=>{let{x:s,y:n}=e,o=(a.getRotationOfChar(t)-90)*h,i=Math.cos(o),d=Math.sin(o);return[[s-l*i,n-l*d],[s+r*i,n+r*d]]};for(let e=0,r=0;r<i;r++){let h=o[r].length;for(let s=0;s<h;s+=5)try{let h=e+s+r,[l,n]=d(h,a.getStartPositionOfChar(h));0===s?(t.push(n),t.push(l)):(0===r&&t.unshift(n),r===i-1&&t.push(l))}catch{break}e+=h-1;try{let h=e+r,s=a.getEndPositionOfChar(h),[l,n]=d(h,s);t.unshift(n),t.unshift(l)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function f(t){let e=t.labelOptions,a=t.point,r=e[a.formatPrefix+"TextPath"]||e.textPath;r&&!e.useHTML&&(this.setTextPath(a.getDataLabelPath?.(this)||a.graphic,r),a.dataLabelPath&&!r.enabled&&(a.dataLabelPath=a.dataLabelPath.destroy()))}let c=r();c.TextPath={compose:function(t){s(t,"afterGetBBox",x),s(t,"beforeAddingDataLabel",f);let e=t.prototype;e.setTextPath||(e.setTextPath=d)}},c.TextPath.compose(c.SVGElement);let p=r();export{p as default};