/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/wordcloud
 * @requires highcharts
 *
 * (c) 2016-2026 Highsoft AS
 * Authors: Jon Arild Nygård
 *
 * 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 i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var o=e.n(i);let a=function(t,e){let{animatableAttribs:i,onComplete:o,css:a,renderer:n}=e,r=t.series&&t.series.chart.hasRendered?void 0:t.series&&t.series.options.animation,l=t.graphic;if(e.attribs={...e.attribs,class:t.getClassName()},t.shouldDraw())l||(t.graphic=l="text"===e.shapeType?n.text():"image"===e.shapeType?n.image(e.imageUrl||"").attr(e.shapeArgs||{}):n[e.shapeType](e.shapeArgs||{}),l.add(e.group)),a&&l.css(a),l.attr(e.attribs).animate(i,!e.isNew&&r,o);else if(l){let e=()=>{t.graphic=l=l&&l.destroy(),"function"==typeof o&&o()};Object.keys(i).length?l.animate(i,void 0,()=>e()):e()}},n=t.default.SeriesRegistry;var r=e.n(n);let{column:{prototype:{pointClass:l}}}=r().seriesTypes;class s extends l{isValid(){return!0}}(0,i.extend)(s.prototype,{weight:1});let{deg2rad:h}=o();function d(t,e){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}function p(t){let e,o=t.axes||[];return o.length||(o=[],(e=t.concat([t[0]])).reduce((t,e)=>{let a,n,r=(a=e[0]-t[0],[[-(n=e[1]-t[1]),a],[n,-a]])[0];return(0,i.find)(o,t=>t[0]===r[0]&&t[1]===r[1])||o.push(r),e}),t.axes=o),o}function u(t,e){let i=t.map(t=>{let i=t[0],o=t[1];return i*e[0]+o*e[1]});return{min:Math.min.apply(this,i),max:Math.max.apply(this,i)}}function m(t,e){let o=p(t),a=p(e),n=o.concat(a);return!(0,i.find)(n,i=>{let o,a;return o=u(t,i),!!((a=u(e,i)).min>o.max||a.max<o.min)})}function g(t,e){let i=4*t,o=Math.ceil((Math.sqrt(i)-1)/2),a=2*o+1,n=Math.pow(a,2),r=!1;return a-=1,t<=1e4&&("boolean"==typeof r&&i>=n-a&&(r={x:o-(n-i),y:-o}),n-=a,"boolean"==typeof r&&i>=n-a&&(r={x:-o,y:-o+(n-i)}),n-=a,"boolean"==typeof r&&(r=i>=n-a?{x:-o+(n-i),y:o}:{x:o,y:o-(n-i-a)}),r.x*=5,r.y*=5),r}function c(t,e){let o=Math.pow(10,(0,i.isNumber)(e)?e:14);return Math.round(t*o)/o}function f(t,e){let i=t[0],o=t[1],a=-(h*e),n=Math.cos(a),r=Math.sin(a);return[c(i*n-o*r),c(i*r+o*n)]}function x(t,e,i){let o=f([t[0]-e[0],t[1]-e[1]],i);return[o[0]+e[0],o[1]+e[1]]}let{noop:y}=o(),{column:b}=r().seriesTypes,{archimedeanSpiral:M,extendPlayingField:w,getBoundingBoxFromPolygon:S,getPlayingField:A,getPolygon:F,getRandomPosition:N,getRotation:P,getScale:X,getSpiral:T,intersectionTesting:z,isPolygonsColliding:v,rectangularSpiral:O,rotate2DToOrigin:Y,rotate2DToPoint:B,squareSpiral:C,updateFieldBoundaries:W}={archimedeanSpiral:function(t,e){let i=e.field,o=i.width*i.width+i.height*i.height,a=.8*t,n=!1;return t<=1e4&&(Math.min(Math.abs((n={x:a*Math.cos(a),y:a*Math.sin(a)}).x),Math.abs(n.y))<o||(n=!1)),n},extendPlayingField:function(t,e){let o,a,n,r,l,s;return(0,i.isObject)(t)&&(0,i.isObject)(e)?(o=e.bottom-e.top,a=e.right-e.left,l=a*(n=t.ratioX)>o*(r=t.ratioY)?a:o,s=(0,i.merge)(t,{width:t.width+l*n*2,height:t.height+l*r*2})):s=t,s},getBoundingBoxFromPolygon:function(t){return t.reduce(function(t,e){let i=e[0],o=e[1];return t.left=Math.min(i,t.left),t.right=Math.max(i,t.right),t.bottom=Math.max(o,t.bottom),t.top=Math.min(o,t.top),t},{left:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,top:Number.MAX_VALUE})},getPlayingField:function(t,e,i){let o=i.reduce(function(t,e){let i=e.dimensions,o=Math.max(i.width,i.height);return t.maxHeight=Math.max(t.maxHeight,i.height),t.maxWidth=Math.max(t.maxWidth,i.width),t.area+=o*o,t},{maxHeight:0,maxWidth:0,area:0}),a=Math.max(o.maxHeight,o.maxWidth,.85*Math.sqrt(o.area)),n=t>e?t/e:1,r=e>t?e/t:1;return{width:a*n,height:a*r,ratioX:n,ratioY:r}},getPolygon:function(t,e,i,o,a){let n=[t,e],r=t-i/2,l=t+i/2,s=e-o/2,h=e+o/2;return[[r,s],[l,s],[l,h],[r,h]].map(function(t){return x(t,n,-a)})},getRandomPosition:function(t){return Math.round(t*(Math.random()+.5)/2)},getRotation:function(t,e,o,a){let n=!1,r;return(0,i.isNumber)(t)&&(0,i.isNumber)(e)&&(0,i.isNumber)(o)&&(0,i.isNumber)(a)&&t>0&&e>-1&&a>o&&(r=(a-o)/(t-1||1),n=o+e%t*r),n},getScale:function(t,e,i){let o=2*Math.max(Math.abs(i.top),Math.abs(i.bottom)),a=2*Math.max(Math.abs(i.left),Math.abs(i.right));return Math.min(a>0?1/a*t:1,o>0?1/o*e:1)},getSpiral:function(t,e){let i=[];for(let o=1;o<1e4;o++)i.push(t(o,e));return t=>t<=1e4&&i[t-1]},intersectionTesting:function(t,e){let o,a,n,r,l,s,h=e.placed,p=e.field,u=e.rectangle,g=e.polygon,c=e.spiral,f=t.rect=(0,i.extend)({},u),x=1,y={x:0,y:0};for(t.polygon=g,t.rotation=e.rotation;!1!==y&&(o=t.rect,a=t.polygon,n=t.lastCollidedWith,r=function(e){let i=d(o,e.rect);return i&&(t.rotation%90||e.rotation%90)&&(i=m(a,e.polygon)),i},l=!1,n&&!(l=r(n))&&delete t.lastCollidedWith,!l&&(l=!!(0,i.find)(h,function(e){let i=r(e);return i&&(t.lastCollidedWith=e),i})),l||!((s={left:-(p.width/2),right:p.width/2,top:-(p.height/2),bottom:p.height/2}).left<f.left&&s.right>f.right&&s.top<f.top&&s.bottom>f.bottom));)y=c(x),(0,i.isObject)(y)&&(f.left=u.left+y.x,f.right=u.right+y.x,f.top=u.top+y.y,f.bottom=u.bottom+y.y,t.polygon=function(t,e,i){return i.map(function(i){return[i[0]+t,i[1]+e]})}(y.x,y.y,g)),x++;return y},isPolygonsColliding:m,isRectanglesIntersecting:d,rectangularSpiral:function(t,e){let i=g(t,e),o=e.field;return i&&(i.x*=o.ratioX,i.y*=o.ratioY),i},rotate2DToOrigin:f,rotate2DToPoint:x,squareSpiral:g,updateFieldBoundaries:function(t,e){return(!(0,i.isNumber)(t.left)||t.left>e.left)&&(t.left=e.left),(!(0,i.isNumber)(t.right)||t.right<e.right)&&(t.right=e.right),(!(0,i.isNumber)(t.top)||t.top>e.top)&&(t.top=e.top),(!(0,i.isNumber)(t.bottom)||t.bottom<e.bottom)&&(t.bottom=e.bottom),t}};class j extends b{pointAttribs(t,e){let i=o().seriesTypes.column.prototype.pointAttribs.call(this,t,e);return delete i.stroke,delete i["stroke-width"],i}deriveFontSize(t,e,o){let a=(0,i.isNumber)(t)?t:0,n=(0,i.isNumber)(e)?e:1;return Math.floor(Math.max((0,i.isNumber)(o)?o:1,a*n))}drawPoints(){if(this.zooming||this.defaultScale&&this.group.scaleX!==this.defaultScale)return;let t=this.hasRendered,e=this.xAxis,o=this.yAxis,n=this.chart,r=this.group,l=this.options,s=l.animation,h=l.allowExtendPlayingField,d=n.renderer,p=[],u=this.placementStrategy[l.placementStrategy],m=l.rotation,g=this.points.map(function(t){return t.weight}),c=Math.max.apply(null,g),f=this.points.concat().sort((t,e)=>e.weight-t.weight),x=d.text().add(r),y;for(let t of(this.group.attr({scaleX:1,scaleY:1}),f)){let e=1/c*t.weight,o=this.deriveFontSize(e,l.maxFontSize,l.minFontSize),a=(0,i.extend)({fontSize:o+"px"},l.style);x.css(a).attr({x:0,y:0,text:t.name});let n=x.getBBox(!0);t.dimensions={height:n.height,width:n.width}}y=A(e.len,o.len,f);let b=T(this.spirals[l.spiral],{field:y});for(let e of f){let o=1/c*e.weight,n=this.deriveFontSize(o,l.maxFontSize,l.minFontSize),g=(0,i.extend)({fontSize:n+"px"},l.style),x=u(e,{data:f,field:y,placed:p,rotation:m}),M=(0,i.extend)(this.pointAttribs(e,e.selected&&"select"),{align:"center","alignment-baseline":"middle","dominant-baseline":"middle",x:x.x,y:x.y,text:e.name,rotation:(0,i.isNumber)(x.rotation)?x.rotation:void 0}),A=F(x.x,x.y,e.dimensions.width,e.dimensions.height,x.rotation),N=S(A),P=z(e,{rectangle:N,polygon:A,field:y,placed:p,spiral:b,rotation:x.rotation}),X;!P&&h&&(y=w(y,N),P=z(e,{rectangle:N,polygon:A,field:y,placed:p,spiral:b,rotation:x.rotation})),(0,i.isObject)(P)?(M.x=(M.x||0)+P.x,M.y=(M.y||0)+P.y,N.left+=P.x,N.right+=P.x,N.top+=P.y,N.bottom+=P.y,y=W(y,N),p.push(e),e.isNull=!1,e.isInside=!0):e.isNull=!0,s&&(X={x:M.x,y:M.y},t?(delete M.x,delete M.y):(M.x=0,M.y=0)),a(e,{animatableAttribs:X,attribs:M,css:g,group:r,renderer:d,shapeArgs:void 0,shapeType:"text"})}x=x.destroy(),this.defaultScale=X(e.len,o.len,y),this.field=y,this.group.attr({scaleX:this.defaultScale,scaleY:this.defaultScale})}hasData(){return(0,i.isObject)(this)&&!0===this.visible&&(0,i.isArray)(this.points)&&this.points.length>0}getPlotBox(t){let{chart:e,group:o,zooming:a}=this,{plotSizeX:n=0,plotSizeY:r=0,inverted:l}=e,s=this[l?"yAxis":"xAxis"],h=this[l?"xAxis":"yAxis"],d=s?s.len:e.plotWidth,p=h?h.len:e.plotHeight,u=s?s.left:e.plotLeft,m=h?h.top:e.plotTop,g=this.field,c=0,f=0,x=u+d/2,y=m+p/2,b=x,M=y,w=this.defaultScale||1,S=0,A=0;if(g&&(S=2*Math.max(Math.abs(g.top),Math.abs(g.bottom)),A=2*Math.max(Math.abs(g.left),Math.abs(g.right))),l&&([A,S]=[S,A]),o&&a){let e=u+Math.max(A*(w=Math.max(a.scale,this.defaultScale||1)),d)/2,l=m+Math.max(S*w,p)/2,s=w-(o.scaleX||1);c=s*((n-A)/2+a.zoomX*n-d/2),f=s*((r-S)/2+a.zoomY*r-p/2),"series"===t&&(a.x=Math.max(0,Math.min(1-a.width,a.x+a.panX/a.scale)),c+=a.panX*n,a.panX=0,a.y=Math.max(0,Math.min(1-a.height,a.y+a.panY/a.scale)),f+=a.panY*r,a.panY=0),(0,i.isNumber)(o.translateX)&&(0,i.isNumber)(o.translateY)&&(b=o.translateX,M=o.translateY),x=b-c,(y=M-f)>l?y=l:y<2*m+p-l&&(y=2*m+p-l),x>e?x=e:x<2*u+d-e&&(x=2*u+d-e)}return{translateX:x,translateY:y,scaleX:w,scaleY:w}}}j.defaultOptions=(0,i.merge)(b.defaultOptions,{allowExtendPlayingField:!0,animation:{duration:500},borderWidth:0,clip:!1,colorByPoint:!0,cropThreshold:1/0,colorKey:"weight",minFontSize:1,maxFontSize:25,placementStrategy:"center",rotation:{from:0,orientations:2,to:90},showInLegend:!1,spiral:"rectangular",style:{fontFamily:"sans-serif",fontWeight:"900",whiteSpace:"nowrap"},tooltip:{followPointer:!0,pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.weight}</b><br/>'}}),(0,i.extend)(j.prototype,{animate:y,animateDrilldown:y,animateDrillupFrom:y,isCartesian:!1,pointClass:s,setClip:y,placementStrategy:{random:function(t,e){let i=e.field,o=e.rotation;return{x:N(i.width)-i.width/2,y:N(i.height)-i.height/2,rotation:P(o.orientations,t.index,o.from,o.to)}},center:function(t,e){let i=e.rotation;return{x:0,y:0,rotation:P(i.orientations,t.index,i.from,i.to)}}},pointArrayMap:["weight"],spirals:{archimedean:M,rectangular:O,square:C},utils:{extendPlayingField:w,getRotation:P,isPolygonsColliding:v,rotate2DToOrigin:Y,rotate2DToPoint:B}}),r().registerSeriesType("wordcloud",j);let D=o();export{D as default};