/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/wordcloud
 * @requires highcharts
 *
 * (c) 2016-2026 Highsoft AS
 * Authors: Jon Arild Nygard
 *
 * 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,{extend:s}=o();class h extends l{isValid(){return!0}}s(h.prototype,{weight:1});let{deg2rad:p}=o(),{extend:d,find:g,isNumber:u,isObject:m,merge:c}=o();function f(t,e){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}function x(t){let e,i=t.axes||[];return i.length||(i=[],(e=t.concat([t[0]])).reduce((t,e)=>{let o,a,n=(o=e[0]-t[0],[[-(a=e[1]-t[1]),o],[a,-o]])[0];return g(i,t=>t[0]===n[0]&&t[1]===n[1])||i.push(n),e}),t.axes=i),i}function y(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 b(t,e){let i=x(t),o=x(e);return!g(i.concat(o),i=>{let o,a;return o=y(t,i),!!((a=y(e,i)).min>o.max||a.max<o.min)})}function M(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 w(t,e){let i=Math.pow(10,u(e)?e:14);return Math.round(t*i)/i}function S(t,e){let i=t[0],o=t[1],a=-(p*e),n=Math.cos(a),r=Math.sin(a);return[w(i*n-o*r),w(i*r+o*n)]}function F(t,e,i){let o=S([t[0]-e[0],t[1]-e[1]],i);return[o[0]+e[0],o[1]+e[1]]}let{noop:P}=o(),{column:A}=r().seriesTypes,{extend:X,isArray:T,isNumber:z,isObject:v,merge:Y}=o(),{archimedeanSpiral:B,extendPlayingField:C,getBoundingBoxFromPolygon:W,getPlayingField:N,getPolygon:O,getRandomPosition:D,getRotation:R,getScale:_,getSpiral:E,intersectionTesting:L,isPolygonsColliding:j,rectangularSpiral:H,rotate2DToOrigin:U,rotate2DToPoint:V,squareSpiral:q,updateFieldBoundaries:k}={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 i,o,a,n,r,l;return m(t)&&m(e)?(i=e.bottom-e.top,o=e.right-e.left,r=o*(a=t.ratioX)>i*(n=t.ratioY)?o:i,l=c(t,{width:t.width+r*a*2,height:t.height+r*n*2})):l=t,l},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 F(t,n,-a)})},getRandomPosition:function(t){return Math.round(t*(Math.random()+.5)/2)},getRotation:function(t,e,i,o){let a=!1,n;return u(t)&&u(e)&&u(i)&&u(o)&&t>0&&e>-1&&o>i&&(n=(o-i)/(t-1||1),a=i+e%t*n),a},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 i,o,a,n,r,l,s=e.placed,h=e.field,p=e.rectangle,u=e.polygon,c=e.spiral,x=t.rect=d({},p),y=1,M={x:0,y:0};for(t.polygon=u,t.rotation=e.rotation;!1!==M&&(i=t.rect,o=t.polygon,a=t.lastCollidedWith,n=function(e){let a=f(i,e.rect);return a&&(t.rotation%90||e.rotation%90)&&(a=b(o,e.polygon)),a},r=!1,a&&!(r=n(a))&&delete t.lastCollidedWith,!r&&(r=!!g(s,function(e){let i=n(e);return i&&(t.lastCollidedWith=e),i})),r||!((l={left:-(h.width/2),right:h.width/2,top:-(h.height/2),bottom:h.height/2}).left<x.left&&l.right>x.right&&l.top<x.top&&l.bottom>x.bottom));)m(M=c(y))&&(x.left=p.left+M.x,x.right=p.right+M.x,x.top=p.top+M.y,x.bottom=p.bottom+M.y,t.polygon=function(t,e,i){return i.map(function(i){return[i[0]+t,i[1]+e]})}(M.x,M.y,u)),y++;return M},isPolygonsColliding:b,isRectanglesIntersecting:f,rectangularSpiral:function(t,e){let i=M(t,e),o=e.field;return i&&(i.x*=o.ratioX,i.y*=o.ratioY),i},rotate2DToOrigin:S,rotate2DToPoint:F,squareSpiral:M,updateFieldBoundaries:function(t,e){return(!u(t.left)||t.left>e.left)&&(t.left=e.left),(!u(t.right)||t.right<e.right)&&(t.right=e.right),(!u(t.top)||t.top>e.top)&&(t.top=e.top),(!u(t.bottom)||t.bottom<e.bottom)&&(t.bottom=e.bottom),t}};class I extends A{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,i){let o=z(t)?t:0,a=z(e)?e:1;return Math.floor(Math.max(z(i)?i:1,o*a))}drawPoints(){if(this.zooming||this.defaultScale&&this.group.scaleX!==this.defaultScale)return;let t=this.hasRendered,e=this.xAxis,i=this.yAxis,o=this.chart,n=this.group,r=this.options,l=r.animation,s=r.allowExtendPlayingField,h=o.renderer,p=[],d=this.placementStrategy[r.placementStrategy],g=r.rotation,u=this.points.map(function(t){return t.weight}),m=Math.max.apply(null,u),c=this.points.concat().sort((t,e)=>e.weight-t.weight),f=h.text().add(n),x;for(let t of(this.group.attr({scaleX:1,scaleY:1}),c)){let e=1/m*t.weight,i=X({fontSize:this.deriveFontSize(e,r.maxFontSize,r.minFontSize)+"px"},r.style);f.css(i).attr({x:0,y:0,text:t.name});let o=f.getBBox(!0);t.dimensions={height:o.height,width:o.width}}x=N(e.len,i.len,c);let y=E(this.spirals[r.spiral],{field:x});for(let e of c){let i=1/m*e.weight,o=X({fontSize:this.deriveFontSize(i,r.maxFontSize,r.minFontSize)+"px"},r.style),u=d(e,{data:c,field:x,placed:p,rotation:g}),f=X(this.pointAttribs(e,e.selected&&"select"),{align:"center","alignment-baseline":"middle","dominant-baseline":"middle",x:u.x,y:u.y,text:e.name,rotation:z(u.rotation)?u.rotation:void 0}),b=O(u.x,u.y,e.dimensions.width,e.dimensions.height,u.rotation),M=W(b),w=L(e,{rectangle:M,polygon:b,field:x,placed:p,spiral:y,rotation:u.rotation}),S;!w&&s&&(x=C(x,M),w=L(e,{rectangle:M,polygon:b,field:x,placed:p,spiral:y,rotation:u.rotation})),v(w)?(f.x=(f.x||0)+w.x,f.y=(f.y||0)+w.y,M.left+=w.x,M.right+=w.x,M.top+=w.y,M.bottom+=w.y,x=k(x,M),p.push(e),e.isNull=!1,e.isInside=!0):e.isNull=!0,l&&(S={x:f.x,y:f.y},t?(delete f.x,delete f.y):(f.x=0,f.y=0)),a(e,{animatableAttribs:S,attribs:f,css:o,group:n,renderer:h,shapeArgs:void 0,shapeType:"text"})}f=f.destroy(),this.defaultScale=_(e.len,i.len,x),this.field=x,this.group.attr({scaleX:this.defaultScale,scaleY:this.defaultScale})}hasData(){return v(this)&&!0===this.visible&&T(this.points)&&this.points.length>0}getPlotBox(t){let{chart:e,group:i,zooming:o}=this,{plotSizeX:a=0,plotSizeY:n=0,inverted:r}=e,l=this[r?"yAxis":"xAxis"],s=this[r?"xAxis":"yAxis"],h=l?l.len:e.plotWidth,p=s?s.len:e.plotHeight,d=l?l.left:e.plotLeft,g=s?s.top:e.plotTop,u=this.field,m=0,c=0,f=d+h/2,x=g+p/2,y=f,b=x,M=this.defaultScale||1,w=0,S=0;if(u&&(w=2*Math.max(Math.abs(u.top),Math.abs(u.bottom)),S=2*Math.max(Math.abs(u.left),Math.abs(u.right))),r&&([S,w]=[w,S]),i&&o){let e=d+Math.max(S*(M=Math.max(o.scale,this.defaultScale||1)),h)/2,r=g+Math.max(w*M,p)/2,l=M-(i.scaleX||1);m=l*((a-S)/2+o.zoomX*a-h/2),c=l*((n-w)/2+o.zoomY*n-p/2),"series"===t&&(o.x=Math.max(0,Math.min(1-o.width,o.x+o.panX/o.scale)),m+=o.panX*a,o.panX=0,o.y=Math.max(0,Math.min(1-o.height,o.y+o.panY/o.scale)),c+=o.panY*n,o.panY=0),z(i.translateX)&&z(i.translateY)&&(y=i.translateX,b=i.translateY),f=y-m,(x=b-c)>r?x=r:x<2*g+p-r&&(x=2*g+p-r),f>e?f=e:f<2*d+h-e&&(f=2*d+h-e)}return{translateX:f,translateY:x,scaleX:M,scaleY:M}}}I.defaultOptions=Y(A.defaultOptions,{allowExtendPlayingField:!0,animation:{duration:500},borderWidth:0,clip:!1,colorByPoint:!0,cropThreshold:1/0,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/>'}}),X(I.prototype,{animate:P,animateDrilldown:P,animateDrillupFrom:P,isCartesian:!1,pointClass:h,setClip:P,placementStrategy:{random:function(t,e){let i=e.field,o=e.rotation;return{x:D(i.width)-i.width/2,y:D(i.height)-i.height/2,rotation:R(o.orientations,t.index,o.from,o.to)}},center:function(t,e){let i=e.rotation;return{x:0,y:0,rotation:R(i.orientations,t.index,i.from,i.to)}}},pointArrayMap:["weight"],spirals:{archimedean:B,rectangular:H,square:q},utils:{extendPlayingField:C,getRotation:R,isPolygonsColliding:j,rotate2DToOrigin:U,rotate2DToPoint:V}}),r().registerSeriesType("wordcloud",I);let G=o();export{G as default};