realchart 1.4.33 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vector.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ConnectableSeries, VectorSeriesOptions, DataPoint, RcElement } from 're
3
3
 
4
4
  /**
5
5
  * Vector 시리즈 모델.<br/>
6
- * {@link https://realchart.co.kr/docs/api/options/SeriesOptions#type type}은 {@link https://realchart.co.kr/config/config/series/vecotor vector}이고,
6
+ * {@link https://realchart.co.kr/docs/api/options/SeriesOptions#type type}은 {@link https://realchart.co.kr/config/config/series/vector vector}이고,
7
7
  * {@link options 설정} 모델은 {@link https://realchart.co.kr/docs/api/options/VectorSeriesOptions VectorSeriesOptions}이다.
8
8
  *
9
9
  * @modules Vector
package/vector.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Vector v1.4.33
3
+ * RealChart Vector v1.5.0
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartVector={},e.RealChart)}(this,function(e,t){"use strict";function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,Object.freeze(t)}var r=s(t);class n extends t.DataPoint{_assignTo(e){return t.assignObj(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,s){if(s.length<=2)this.isNull=!0;else{const r=s.length>3?1:0;r>0&&(this.x=s[t.pickNum(e.prop("xField"),0)]),this.y=s[t.pickNum(e.prop("yField"),0+r)],this.length=s[t.pickNum(e.prop("lengthField"),1+r)],this.angle=s[t.pickNum(e.prop("angleField"),2+r)]}}_readObject(e,s){super._readObject(e,s),this.length=t.pickProp(s[e.prop("lengthField")],s.length),this.angle=t.pickProp(s[e.prop("angleField")],s.angle),this.y=t.pickProp3(e._yFielder(s),s.y,s.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,s){this.lengthValue=t.incv(e.lengthValue,this.lengthValue,s)}}class i extends t.ConnectableSeries{_createPoint(e){return new n(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const s=this.num("maxLength"),r=this.prop("origin"),n=e.map(e=>e.length).reduce((e,s)=>t.maxv(e,s));e.forEach(e=>{const t=e.length/n;switch(e._len=t*s,r){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,s){const r=.3,n=.7*s,i=[0,-r*s,-.2*s,-r*s,0,-.6*s,.2*s,-r*s,0,-r*s,0,.6*s],a=["M",i[0],i[1]+n];for(let e=2;e<i.length;e+=2)a.push("L",i[e],i[e+1]+n);const l=new t.PathElement(e,t.Series.LEGEND_MARKER).setPath(a);return l.setStyle("strokeWidth","2px"),l.rotation=30,l}}i.type=t.VectorSeriesType,i.defaults=t.extend(t.Series.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class a extends t.PointElement{layout(e,t,s){const r=this.point._len,n=r*s,i=.5;let a,l=(r-n)/2;switch(e){case"none":a=[0,l-i*n,0,l+i*n];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*n,0-e*n,l-s*n,0,l-i*n,0+e*n,l-s*n,0,l-t*n,0,l+i*n];break;default:const r=.1,o=.3;a=[0,l-o*n,0-r*n,l-o*n,0,l-i*n,0+r*n,l-o*n,0,l-o*n,0,l+i*n]}const o=this.point._off*s,h=["M",a[0],a[1]+o];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+o);this.rotation=t,this.setPath(h)}}class l extends t.SeriesView{constructor(e){super(e,"rct-vector-series"),this._arrows=new t.PointViewPool(this._pointContainer,a)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let r=s.prop("startAngle");const n=s.prop("arrowHead"),i=s._xAxisObj,a=s._yAxisObj,l=this._inverted,o=l?e:t,h=l?t:e,u=this._getGrowRate(),p=l?0:t,g=i.prop("reversed")?-1:1,c=a.prop("reversed");this._pointContainer.invert(l,t),this._arrows.forEach(e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=i.getPos(h,t.xValue),d=p-a.getPos(o,t.yValue);let f=r+t.angleValue*g;c&&(f=180-f),t.xPos=l?p+a.getPos(o,t.yValue):s,t.yPos=l?h-i.getPos(h,t.xValue):d,e.trans(s,d),e.layout(n,f,u)}})}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,r)=>{const n=s.point=t[r];this._setPointStyle(s,e,n)})}}function o(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(i),e.SeriesView.register([i,l]))}o(r),e.VectorSeries=i,e.default=o,Object.defineProperty(e,"__esModule",{value:!0})});
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealChartVector={},e.RealChart)}(this,function(e,t){"use strict";function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,Object.freeze(t)}var i=s(t);class n extends t.DataPoint{_assignTo(e){return t.assignObj(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,s){if(s.length<=2)this.isNull=!0;else{const i=s.length>3?1:0;i>0&&(this.x=s[t.pickNum(e.prop("xField"),0)]),this.y=s[t.pickNum(e.prop("yField"),0+i)],this.length=s[t.pickNum(e.prop("lengthField"),1+i)],this.angle=s[t.pickNum(e.prop("angleField"),2+i)]}}_readObject(e,s){super._readObject(e,s),this.length=t.pickProp(s[e.prop("lengthField")],s.length),this.angle=t.pickProp(s[e.prop("angleField")],s.angle),this.y=t.pickProp3(e._yFielder(s),s.y,s.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,s){this.lengthValue=t.incv(e.lengthValue,this.lengthValue,s)}}class r extends t.ConnectableSeries{_createPoint(e){return new n(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const s=this.num("maxLength"),i=this.prop("origin"),n=e.map(e=>e.length).reduce((e,s)=>t.maxv(e,s));e.forEach(e=>{const t=e.length/n;switch(e._len=t*s,i){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,s){const i=.3,n=.7*s,r=[0,-i*s,-.2*s,-i*s,0,-.6*s,.2*s,-i*s,0,-i*s,0,.6*s],a=["M",r[0],r[1]+n];for(let e=2;e<r.length;e+=2)a.push("L",r[e],r[e+1]+n);const l=new t.PathElement(e,t.Series.LEGEND_MARKER).setPath(a);return l.setStyle("strokeWidth","2px"),l.rotation=30,l}}r.type=t.VectorSeriesType,r.defaults=t.extend(t.Series.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class a extends t.PointElement{layout(e,t,s){const i=this.point._len,n=i*s,r=.5;let a,l=(i-n)/2;switch(e){case"none":a=[0,l-r*n,0,l+r*n];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*n,0-e*n,l-s*n,0,l-r*n,0+e*n,l-s*n,0,l-t*n,0,l+r*n];break;default:const i=.1,o=.3;a=[0,l-o*n,0-i*n,l-o*n,0,l-r*n,0+i*n,l-o*n,0,l-o*n,0,l+r*n]}const o=this.point._off*s,h=["M",a[0],a[1]+o];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+o);this.rotation=t,this.setPath(h)}}class l extends t.SeriesView{constructor(e){super(e,"rct-vector-series"),this._arrows=new t.PointViewPool(this._pointContainer,a)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let i=s.prop("startAngle");const n=s.prop("arrowHead"),r=s._xAxisObj,a=s._yAxisObj,l=this._inverted,o=l?e:t,h=l?t:e,p=this._getGrowRate(),u=l?0:t,g=r.prop("reversed")?-1:1,c=a.prop("reversed"),d=s.pointLabel,f=this._labelViews(),_=this._labelContainer._textAlign,y=d.prop("position");this._pointContainer.invert(l,t),this._arrows.forEach(e=>{const t=e.point,d=f&&f.get(t,0);if(e.setVis(!t.isNull)){const f=r.getPos(h,t.xValue),P=u-a.getPos(o,t.yValue);let V=i+t.angleValue*g;if(c&&(V=180-V),t.xPos=l?u+a.getPos(o,t.yValue):f,t.yPos=l?h-r.getPos(h,t.xValue):P,e.trans(f,P),e.layout(n,V,p),d){d.setContrast(e.dom),d.layout(_);const i=d.getBBox(),n=s.getLabelOff2(t),r=t.xPos-i.width/2,a="inside"===y?t.yPos-i.height/2:t.yPos-i.height-n;d.trans(r,a),this._layoutLabelRotation(d,i,r,a)}}else d&&d.setVis(!1)})}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,i)=>{const n=s.point=t[i];this._setPointStyle(s,e,n)})}}function o(e){(function(e){return!!(e&&e.Series&&e.SeriesView)})(e)&&(e.Series.register(r),e.SeriesView.register([r,l]))}o(i),e.VectorSeries=r,e.default=o,Object.defineProperty(e,"__esModule",{value:!0})});
package/vector.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Vector v1.4.33
3
+ * RealChart Vector v1.5.0
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- import{VectorSeriesType as e,extend as t,Series as s,ConnectableSeries as r,maxv as n,PathElement as i,DataPoint as a,assignObj as l,pickNum as h,pickProp as o,pickProp3 as g,incv as p,SeriesView as u,PointViewPool as _,SeriesAnimation as d,PointElement as c}from"./index.mjs";class f extends a{_assignTo(e){return l(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,t){if(t.length<=2)this.isNull=!0;else{const s=t.length>3?1:0;s>0&&(this.x=t[h(e.prop("xField"),0)]),this.y=t[h(e.prop("yField"),0+s)],this.length=t[h(e.prop("lengthField"),1+s)],this.angle=t[h(e.prop("angleField"),2+s)]}}_readObject(e,t){super._readObject(e,t),this.length=o(t[e.prop("lengthField")],t.length),this.angle=o(t[e.prop("angleField")],t.angle),this.y=g(e._yFielder(t),t.y,t.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,t){this.lengthValue=p(e.lengthValue,this.lengthValue,t)}}class V extends r{_createPoint(e){return new f(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const t=this.num("maxLength"),s=this.prop("origin"),r=e.map(e=>e.length).reduce((e,t)=>n(e,t));e.forEach(e=>{const n=e.length/r;switch(e._len=n*t,s){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,t){const r=.3,n=.7*t,a=[0,-r*t,-.2*t,-r*t,0,-.6*t,.2*t,-r*t,0,-r*t,0,.6*t],l=["M",a[0],a[1]+n];for(let e=2;e<a.length;e+=2)l.push("L",a[e],a[e+1]+n);const h=new i(e,s.LEGEND_MARKER).setPath(l);return h.setStyle("strokeWidth","2px"),h.rotation=30,h}}V.type=e,V.defaults=t(s.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class w extends c{layout(e,t,s){const r=this.point._len,n=r*s,i=.5;let a,l=(r-n)/2;switch(e){case"none":a=[0,l-i*n,0,l+i*n];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*n,0-e*n,l-s*n,0,l-i*n,0+e*n,l-s*n,0,l-t*n,0,l+i*n];break;default:const r=.1,h=.3;a=[0,l-h*n,0-r*n,l-h*n,0,l-i*n,0+r*n,l-h*n,0,l-h*n,0,l+i*n]}const h=this.point._off*s,o=["M",a[0],a[1]+h];for(let e=2;e<a.length;e+=2)o.push("L",a[e],a[e+1]+h);this.rotation=t,this.setPath(o)}}class y extends u{constructor(e){super(e,"rct-vector-series"),this._arrows=new _(this._pointContainer,w)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let r=s.prop("startAngle");const n=s.prop("arrowHead"),i=s._xAxisObj,a=s._yAxisObj,l=this._inverted,h=l?e:t,o=l?t:e,g=this._getGrowRate(),p=l?0:t,u=i.prop("reversed")?-1:1,_=a.prop("reversed");this._pointContainer.invert(l,t),this._arrows.forEach(e=>{const t=e.point;if(e.setVis(!t.isNull)){const s=i.getPos(o,t.xValue),d=p-a.getPos(h,t.yValue);let c=r+t.angleValue*u;_&&(c=180-c),t.xPos=l?p+a.getPos(h,t.yValue):s,t.yPos=l?o-i.getPos(o,t.xValue):d,e.trans(s,d),e.layout(n,c,g)}})}_runShowEffect(e){e&&d.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,r)=>{const n=s.point=t[r];this._setPointStyle(s,e,n)})}}function P(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(V),e.SeriesView.register([V,y]))}export{V as VectorSeries,P as default};
7
+ import*as e from"./index.mjs";import{VectorSeriesType as t,extend as s,Series as i,ConnectableSeries as n,maxv as r,PathElement as a,DataPoint as l,assignObj as o,pickNum as h,pickProp as g,pickProp3 as p,incv as u,SeriesView as _,PointViewPool as d,SeriesAnimation as c,PointElement as f}from"./index.mjs";class V extends l{_assignTo(e){return o(super._assignTo(e),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})}_valuesChangd(e){return this.length!==e.length||this.angle!==e.angle||super._valuesChangd(e)}_readArray(e,t){if(t.length<=2)this.isNull=!0;else{const s=t.length>3?1:0;s>0&&(this.x=t[h(e.prop("xField"),0)]),this.y=t[h(e.prop("yField"),0+s)],this.length=t[h(e.prop("lengthField"),1+s)],this.angle=t[h(e.prop("angleField"),2+s)]}}_readObject(e,t){super._readObject(e,t),this.length=g(t[e.prop("lengthField")],t.length),this.angle=g(t[e.prop("angleField")],t.angle),this.y=p(e._yFielder(t),t.y,t.value)}_readSingle(e){super._readSingle(e),this.length=this.angle=this.y}parse(e){super.parse(e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))}initValues(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)}initPrev(e,t){t.yValue=this.yValue,t.lengthValue=.001}applyValueRate(e,t){this.lengthValue=u(e.lengthValue,this.lengthValue,t)}}class y extends n{_createPoint(e){return new V(e)}_doPrepareRender(){super._doPrepareRender();const e=this._runPoints;if(e.length>0){const t=this.num("maxLength"),s=this.prop("origin"),i=e.map(e=>e.length).reduce((e,t)=>r(e,t));e.forEach(e=>{const n=e.length/i;switch(e._len=n*t,s){case"start":e._off=-e._len/2;break;case"end":e._off=e._len/2;break;default:e._off=0}})}}_createLegendMarker(e,t){const s=.3,n=.7*t,r=[0,-s*t,-.2*t,-s*t,0,-.6*t,.2*t,-s*t,0,-s*t,0,.6*t],l=["M",r[0],r[1]+n];for(let e=2;e<r.length;e+=2)l.push("L",r[e],r[e+1]+n);const o=new a(e,i.LEGEND_MARKER).setPath(l);return o.setStyle("strokeWidth","2px"),o.rotation=30,o}}y.type=t,y.defaults=s(i.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"});class w extends f{layout(e,t,s){const i=this.point._len,n=i*s,r=.5;let a,l=(i-n)/2;switch(e){case"none":a=[0,l-r*n,0,l+r*n];break;case"open":const e=.15,t=.45,s=.2;a=[0,l-t*n,0-e*n,l-s*n,0,l-r*n,0+e*n,l-s*n,0,l-t*n,0,l+r*n];break;default:const i=.1,o=.3;a=[0,l-o*n,0-i*n,l-o*n,0,l-r*n,0+i*n,l-o*n,0,l-o*n,0,l+r*n]}const o=this.point._off*s,h=["M",a[0],a[1]+o];for(let e=2;e<a.length;e+=2)h.push("L",a[e],a[e+1]+o);this.rotation=t,this.setPath(h)}}class x extends _{constructor(e){super(e,"rct-vector-series"),this._arrows=new d(this._pointContainer,w)}_getPointPool(){return this._arrows}_prepareSeries(e,t){this.$_prepareArrows(t,this._visPoints)}_renderSeries(e,t){const s=this.model;let i=s.prop("startAngle");const n=s.prop("arrowHead"),r=s._xAxisObj,a=s._yAxisObj,l=this._inverted,o=l?e:t,h=l?t:e,g=this._getGrowRate(),p=l?0:t,u=r.prop("reversed")?-1:1,_=a.prop("reversed"),d=s.pointLabel,c=this._labelViews(),f=this._labelContainer._textAlign,V=d.prop("position");this._pointContainer.invert(l,t),this._arrows.forEach(e=>{const t=e.point,d=c&&c.get(t,0);if(e.setVis(!t.isNull)){const c=r.getPos(h,t.xValue),y=p-a.getPos(o,t.yValue);let w=i+t.angleValue*u;if(_&&(w=180-w),t.xPos=l?p+a.getPos(o,t.yValue):c,t.yPos=l?h-r.getPos(h,t.xValue):y,e.trans(c,y),e.layout(n,w,g),d){d.setContrast(e.dom),d.layout(f);const i=d.getBBox(),n=s.getLabelOff2(t),r=t.xPos-i.width/2,a="inside"===V?t.yPos-i.height/2:t.yPos-i.height-n;d.trans(r,a),this._layoutLabelRotation(d,i,r,a)}}else d&&d.setVis(!1)})}_runShowEffect(e){e&&c.grow(this)}_doViewRateChanged(e){this._renderSeries(this.width,this.height)}getPointsAt(e,t){return[]}$_prepareArrows(e,t){this._arrows.prepare(t.length,(s,i)=>{const n=s.point=t[i];this._setPointStyle(s,e,n)})}}function P(e){(function(e){return!!(e&&e.Series&&e.SeriesView)})(e)&&(e.Series.register(y),e.SeriesView.register([y,x]))}P(e);export{y as VectorSeries,P as default};
package/wordcloud.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Wordcloud v1.4.33
3
+ * RealChart Wordcloud v1.5.0
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this.prop("logBase");return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this.prop("colorByPoint")}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this.prop("text");let s=[];if(i){const t=Math.max(this.num("minLength")||1,1),e={};let n=this.prop("excludes"),r=i.split(/\s+/g);Array.isArray(n)&&n.length>0&&(r=r.filter(t=>n.indexOf(t)<0)),r.forEach(i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)});for(const t in e)s.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)s.push({x:e.toStr(t[i]),y:t[i+1]||0});s.length>0&&(t=s.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const a=Math.floor;class h{constructor(t){this._series=t}start(t,i,s,n,r,o){this._series=s,this._container=t;const a=s.prop("frame"),h="circle"===a||"ellipse"===a,l=s.prop("autoScale"),c=e.pickNum(s.num("seed"),0)*Math.PI*2/360,u=Math.max(0,e.pickNum(s.num("wordGap"),0));let d=n,_=0,x=r,p=0,m=0;this._prepare(s,n,r),this._unit,this._startTime=Date.now(),i.forEach(t=>{const e=t.point;if(this._findPos(t,h,s.prop("shuffle"),this._radius,c,u)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),_=Math.max(_,i+n),x=Math.min(x,s),p=Math.max(p,s+r),m++}else t.setVis(!1)}),e.Utils.log("Words placed.",m,"of",i.length);const f=_-d,g=p-x,y=n/2,M=r/2,w=l?1/(Math.max(f/n,g/r)+.02):1,P=~~((d+f/2-y)*w),S=~~((x+g/2-M)*w);return this._trans={x:P,y:S,cx:y,cy:M,rate:w},i.forEach(t=>{const e=t.point;e.xPos=y-P+(e.xPos-y)*w,e.yPos=M-S+(e.yPos-M)*w}),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:i,y:s,cx:n,cy:r,rate:o}=this._trans;if(i=~~(i*t),s=~~(s*t),e.isIE){const e=o*t,a=n*(1-e),h=r*(1-e);this._container.trans(-i+a,-s+h),this._container.scale(e)}else this._container.dom.setAttribute("transform-origin",`${n} ${r}`),this._container.trans(-i,-s),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[];const r=t.prop("frame");this._ellipticity="ellipse"===r||"rectangle"===r?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=Math.min(t*this._unit,64);let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,u=a+l,d=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:u},{x:c,y:u}].map(t=>({x:d+(t.x-d)*n-(t.y-_)*r,y:_+(t.x-d)*r+(t.y-_)*n})),p=Math.min(...x.map(t=>t.x)),m=Math.min(...x.map(t=>t.y)),f=Math.max(...x.map(t=>t.x)),g=Math.max(...x.map(t=>t.y)),y=this._unit,M=f-p,w=g-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:p,y:m,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),u=Math.ceil(l/2),d=Math.max(0,e-c),_=Math.max(0,i-u),x=d+Math.ceil(h),p=_+Math.ceil(l),m={x:(e-c)*r,y:(i-u)*r,width:o,height:a};return n?this._rotatePoint(m,n,s):{c1:d,r1:_,c2:x+s,r2:p,bounds:m}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=Date.now()-this._startTime;if(n>e.pickNum(this._series.num("drawTimeout"),5e3))throw new Error(`단어배치 시간이 ${n} ms 경과하여 중단합니다.`);const u=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(u);if(u.some((i,s)=>{let n=this._series.prop("rotation")?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}}))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,u=c*Math.cos(l)/n,d=c*Math.sin(l),_=s.c+u,x=s.r+d;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const u=Math.max(1,this._unit>>1),d=u-Math.max(1,u>>1),_=.99;for(;++o>=0;){e=1+d*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class u extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.PointViewPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,i){const s=this.model,n=s.prop("text");if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();s.num("minWeight")>0&&(o=o.filter(t=>t.yValue>=s.num("minWeight"))),s.num("minLength")>1&&(o=o.filter(t=>t.x.length>=s.num("minLength")));const a=s.num("maxCount");if(a<o.length&&(o.length=Math.max(0,a)),this.$_prepareWords(this.doc,s,o),"spiral"===s.prop("placer"))this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const u=n===r||l===h,d=u?NaN:i.prop("logBase"),_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.prop("textHeight"))),p=isNaN(x)?t.createElement("canvas").getContext("2d"):null,m=1-c.TOP_PAD;let f;this._words.prepare(s.length,(r,a)=>{const c=r.point=s[a],g=r.textView;r._bbox=null;let y=(c.y-n)/o;d>1&&(y=1-(Math.pow(d,1-y)-1)/(d-1));let M=l+(u?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),p?(p.font=`${e.pixel(M)} ${_}`,f=p.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*m):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)})}}function d(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,u]))}d(s),t.WordCloudSeries=o,t.default=d,Object.defineProperty(t,"__esModule",{value:!0})});
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartWordCloud={},t.RealChart)}(this,function(t,e){"use strict";function i(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var s=i(e);class n extends e.WidgetSeriesPoint{}class r extends n{constructor(t,e){super(t),this.points=e}}class o extends e.WidgetSeries{$_denormalizeFontSize(t,i,s){let n,r;return"min"==t?(n=e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxMinFontSize,!1),i)):(n=e.calcPercent(e.parsePercentSize(o.MinMaxFontSize,!1),i),r=e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),i)),s>1?r:s<0?n:s*(r-n)+n}calcFontRatio(t,i,s,n){return e.calcPercent(i,s,n)}getMinFontSize(t,i){const{fixed:s,size:n}=this._minFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("min",t,n):e.calcPercent(this._minFontSizeDim,t,i);return Math.max(e.calcPercent(e.parsePercentSize(o.MinFontSize,!1),t),r)}getMaxFontSize(t,i){const{fixed:s,size:n}=this._maxFontSizeDim,r=s&&n<=1?this.$_denormalizeFontSize("max",t,n):e.calcPercent(this._maxFontSizeDim,t,i);return Math.min(e.calcPercent(e.parsePercentSize(o.MaxFontSize,!1),t),r)}getLogFunc(){const t=this.prop("logBase");return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this.prop("colorByPoint")}_createPoint(t){return new n(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new r(t,e)}_doApply(t){var i;super._doApply(t),(t.text!==this._text||e.Utils.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(i=t.excludes)||void 0===i?void 0:i.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const i=this.prop("text");let s=[];if(i){const t=Math.max(this.num("minLength")||1,1),e={};let n=this.prop("excludes"),r=i.split(/\s+/g);Array.isArray(n)&&n.length>0&&(r=r.filter(t=>n.indexOf(t)<0)),r.forEach(i=>{i.length>=t&&(i in e?e[i]++:e[i]=1)});for(const t in e)s.push({x:t,y:e[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let i=0;i<t.length;i+=2)s.push({x:e.toStr(t[i]),y:t[i+1]||0});s.length>0&&(t=s.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}o.type=e.WordCloudSeriesType,o.MinFontSize=8,o.MaxMinFontSize=15,o.MaxFontSize="15%",o.MinMaxFontSize="5%",o.defaults=e.extend(e.WidgetSeries.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const a=Math.floor;class h{constructor(t){this._series=t}start(t,i,s,n,r,o){this._series=s,this._container=t;const a=s.prop("frame"),h="circle"===a||"ellipse"===a,l=s.prop("autoScale"),c=e.pickNum(s.num("seed"),0)*Math.PI*2/360,u=Math.max(0,e.pickNum(s.num("wordGap"),0));let d=n,_=0,x=r,p=0,m=0;this._prepare(s,n,r),this._unit,this._startTime=Date.now(),i.forEach(t=>{const e=t.point;if(this._findPos(t,h,s.prop("shuffle"),this._radius,c,u)){const{x:i,y:s,width:n,height:r}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,d=Math.min(d,i),_=Math.max(_,i+n),x=Math.min(x,s),p=Math.max(p,s+r),m++}else t.setVis(!1)}),e.Utils.log("Words placed.",m,"of",i.length);const f=_-d,g=p-x,y=n/2,M=r/2,w=l?1/(Math.max(f/n,g/r)+.02):1,P=~~((d+f/2-y)*w),S=~~((x+g/2-M)*w);return this._trans={x:P,y:S,cx:y,cy:M,rate:w},i.forEach(t=>{const e=t.point;e.xPos=y-P+(e.xPos-y)*w,e.yPos=M-S+(e.yPos-M)*w}),this.$_transform(),null==o||o(i),this}stop(){}$_transform(t=1){let{x:i,y:s,cx:n,cy:r,rate:o}=this._trans;if(i=~~(i*t),s=~~(s*t),e.isIE){const e=o*t,a=n*(1-e),h=r*(1-e);this._container.trans(-i+a,-s+h),this._container.scale(e)}else this._container.dom.setAttribute("transform-origin",`${n} ${r}`),this._container.trans(-i,-s),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=a(e/s),this._rows=a(i/s),this._radius=a(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[];const r=t.prop("frame");this._ellipticity="ellipse"===r||"rectangle"===r?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,r=Math.min(t*this._unit,64);let o=0,a=[];for(0===t&&a.push([s.c,s.r]);o<r;){const h=o/r*2*Math.PI+i;let l=t*Math.cos(h)/n,c=t*Math.sin(h);if(!e){const t=Math.max(Math.abs(Math.cos(h)),Math.abs(Math.sin(h)));l/=t,c/=t}a.push([~~(s.c+l),~~(s.r+c)]),o++}return this._rdPoints[t]=a}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),r=Math.sin(s),{x:o,y:a,width:h,height:l}=t,c=o+h,u=a+l,d=o+h/2,_=a+l/2,x=[{x:o,y:a},{x:c,y:a},{x:o,y:u},{x:c,y:u}].map(t=>({x:d+(t.x-d)*n-(t.y-_)*r,y:_+(t.x-d)*r+(t.y-_)*n})),p=Math.min(...x.map(t=>t.x)),m=Math.min(...x.map(t=>t.y)),f=Math.max(...x.map(t=>t.x)),g=Math.max(...x.map(t=>t.y)),y=this._unit,M=f-p,w=g-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(f/y),r2:~~(g/y)+i,bounds:{x:p,y:m,width:M,height:w}}}_getBox(t,e,i,s,n=0){const r=this._unit,{width:o}=t.getBBox(),a=t.hText,h=o/r,l=a/r,c=Math.ceil(h/2),u=Math.ceil(l/2),d=Math.max(0,e-c),_=Math.max(0,i-u),x=d+Math.ceil(h),p=_+Math.ceil(l),m={x:(e-c)*r,y:(i-u)*r,width:o,height:a};return n?this._rotatePoint(m,n,s):{c1:d,r1:_,c2:x+s,r2:p,bounds:m}}$_drawDebugBox(t,i){const{doc:s}=this._container,{x:n,y:r,width:o,height:a}=t.bounds,h=e.RectElement.create(s,"",n,r,o,a);h.setFill((null==i?void 0:i.fill)||"#ff000055"),h.setStroke((null==i?void 0:i.stroke)||"none"),h.setAttr("stroke-dasharray",(null==i?void 0:i.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,i,s,n,r,o){let a=0,h=0;n=Math.max(n,this._grid.length+1);const l=[0,-90],c=l.length;for(;a<n;){const n=Date.now()-this._startTime;if(n>e.pickNum(this._series.num("drawTimeout"),5e3))throw new Error(`단어배치 시간이 ${n} ms 경과하여 중단합니다.`);const u=this._getPoints(a,i,r+h++%4*(Math.PI/4));s&&e.Utils.shuffle(u);if(u.some((i,s)=>{let n=this._series.prop("rotation")?l[~~(e.Utils.randomLike(s+r)*c)]:0;const a=this._getBox(t,i[0],i[1],o,n);if(!this._isOverlapping(a)){if(a.bounds.x<0||a.bounds.y<0)return!1;const e=this._getBox(t,i[0],i[1],o),{bounds:s}=e,r={x:s.width/2,y:s.height/2};return t.wx=s.x,t.wy=s.y,t.setRotation(r.x,r.y,n),t.box=a,!0}}))return!0;a++}}}class l extends h{_findPos(t,e,i,s,n,r){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],r);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,r=2*t*this._unit;let o=-1,a=[];0===t&&a.push([s.c,s.r]);const h=i>Math.PI?1:-1;if(e)for(;++o<r;){const e=o/r,l=i+o*e*h,c=t*e,u=c*Math.cos(l)/n,d=c*Math.sin(l),_=s.c+u,x=s.r+d;a.push([~~_,~~x])}else{let e=this._unit>>1,r=e/n,l=s.c+r*Math.cos(i),c=s.r+e*Math.sin(i);const u=Math.max(1,this._unit>>1),d=u-Math.max(1,u>>1),_=.99;for(;++o>=0;){e=1+d*Math.pow(_,o),r=e/n;switch(3&(h*Math.sqrt(1+8*o)-1)/2){case 0:l+=r;break;case 1:c+=e;break;case 2:l-=r;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;a.push([~~l,~~c])}}return a}_getBox(t,e,i,s){const n=this._unit,r=t.getBBox(),o=t.hText,h=Math.min(2*this._radius,Math.max(0,e-a(r.width/2/n))),l=Math.min(2*this._radius,Math.max(0,i-a(o/2/n)));return{c1:h,r1:l,c2:h+a(r.width/n)+s,r2:l+a(o/n),w:t.width,h:o}}}class c extends e.RcElement{constructor(t){super(t,e.SeriesView.POINT_CLASS),this.add(this.hintView=new e.RectElement(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new e.TextElement(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*c.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*c.TOP_PAD)}}c.TOP_PAD=.5;class u extends e.WidgetSeriesView{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new e.LayerElement(t,null)),this._words=new e.PointViewPool(this._wordContainer,c)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,i){const s=this.model,n=s.prop("text");if(t!==this._wSave||i!==this._hSave||n!==this._tSave){const r=+new Date;let o=this._visPoints.slice();s.num("minWeight")>0&&(o=o.filter(t=>t.yValue>=s.num("minWeight"))),s.num("minLength")>1&&(o=o.filter(t=>t.x.length>=s.num("minLength")));const a=s.num("maxCount");if(a<o.length&&(o.length=Math.max(0,a)),this.$_prepareWords(this.doc,s,o),"spiral"===s.prop("placer"))this._placer=new l(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});else this._placer=new h(s).start(this._wordContainer,this._words._internalItems(),s,t,i,e=>{this.$_layoutWords(t,i)});this._wSave=t,this._hSave=i,this._tSave=n,this._empty=o.length<1,e.Utils.log(o.length+" words placed in "+(+new Date-r)+"ms.")}else this.$_layoutWords(t,i)}_runShowEffect(t){t&&e.SeriesAnimation.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,i,s){const n=i._minY,r=i._maxY,o=r-n,a=this.height,h=i.getMaxFontSize(a,1);let l=Math.min(h,i.getMinFontSize(a,0));const u=n===r||l===h,d=u?NaN:i.prop("logBase"),_=getComputedStyle(this._wordContainer.dom).fontFamily,x=Math.min(2,Math.max(.1,+i.prop("textHeight"))),p=isNaN(x)?t.createElement("canvas").getContext("2d"):null,m=1-c.TOP_PAD;let f;this._words.prepare(s.length,(r,a)=>{const c=r.point=s[a],g=r.textView;r._bbox=null;let y=(c.y-n)/o;d>1&&(y=1-(Math.pow(d,1-y)-1)/(d-1));let M=l+(u?(h-l)/2:y*(h-l));const w=c.x;this._preparePoint(t,i,c,r),delete r.box,g.text=w,g.anchor=e.TextAnchor.START,g.setStyles({fontSize:e.pixel(M)}),g.layoutText(),p?(p.font=`${e.pixel(M)} ${_}`,f=p.measureText(w),r.yText=.9*Math.max(0,f.fontBoundingBoxAscent-f.actualBoundingBoxAscent),r.hText=Math.ceil((f.actualBoundingBoxAscent+f.actualBoundingBoxDescent)*(M<=10?1.1:1.08)-.1)+r.yText*m):(r.yText=0,r.hText=r.getBBox().height*x),r.layout(),r.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,r=n.width,o=n.height,a=(t-r)/2;let h=(e-o)/2;i.trans(i.wx-(i.wx-a)*s,i.wy-(i.wy-h)*s)})}}function d(t){(function(t){return!!(t&&t.Series&&t.SeriesView)})(t)&&(t.Series.register(o),t.SeriesView.register([o,u]))}d(s),t.WordCloudSeries=o,t.default=d,Object.defineProperty(t,"__esModule",{value:!0})});
package/wordcloud.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealChart Wordcloud v1.4.33
3
+ * RealChart Wordcloud v1.5.0
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- import{WordCloudSeriesType as t,extend as e,WidgetSeries as i,calcPercent as s,parsePercentSize as n,Utils as o,toStr as r,WidgetSeriesPoint as h,RcElement as a,SeriesView as l,RectElement as c,TextElement as _,WidgetSeriesView as u,LayerElement as x,PointViewPool as d,SeriesAnimation as p,TextAnchor as m,pixel as g,pickNum as M,isIE as y}from"./index.mjs";class f extends h{}class w extends f{constructor(t,e){super(t),this.points=e}}class S extends i{$_denormalizeFontSize(t,e,i){let o,r;return"min"==t?(o=s(n(S.MinFontSize,!1),e),r=s(n(S.MaxMinFontSize,!1),e)):(o=s(n(S.MinMaxFontSize,!1),e),r=s(n(S.MaxFontSize,!1),e)),i>1?r:i<0?o:i*(r-o)+o}calcFontRatio(t,e,i,n){return s(e,i,n)}getMinFontSize(t,e){const{fixed:i,size:o}=this._minFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("min",t,o):s(this._minFontSizeDim,t,e);return Math.max(s(n(S.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:o}=this._maxFontSizeDim,r=i&&o<=1?this.$_denormalizeFontSize("max",t,o):s(this._maxFontSizeDim,t,e);return Math.min(s(n(S.MaxFontSize,!1),t),r)}getLogFunc(){const t=this.prop("logBase");return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this.prop("colorByPoint")}_createPoint(t){return new f(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new w(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||o.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this.prop("text");let i=[];if(e){const t=Math.max(this.num("minLength")||1,1),s={};let n=this.prop("excludes"),o=e.split(/\s+/g);Array.isArray(n)&&n.length>0&&(o=o.filter(t=>n.indexOf(t)<0)),o.forEach(e=>{e.length>=t&&(e in s?s[e]++:s[e]=1)});for(const t in s)i.push({x:t,y:s[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)i.push({x:r(t[e]),y:t[e+1]||0});i.length>0&&(t=i.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}S.type=t,S.MinFontSize=8,S.MaxMinFontSize=15,S.MaxFontSize="15%",S.MinMaxFontSize="5%",S.defaults=e(i.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const P=Math.floor;class b{constructor(t){this._series=t}start(t,e,i,s,n,r){this._series=i,this._container=t;const h=i.prop("frame"),a="circle"===h||"ellipse"===h,l=i.prop("autoScale"),c=M(i.num("seed"),0)*Math.PI*2/360,_=Math.max(0,M(i.num("wordGap"),0));let u=s,x=0,d=n,p=0,m=0;this._prepare(i,s,n),this._unit,this._startTime=Date.now(),e.forEach(t=>{const e=t.point;if(this._findPos(t,a,i.prop("shuffle"),this._radius,c,_)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,u=Math.min(u,i),x=Math.max(x,i+n),d=Math.min(d,s),p=Math.max(p,s+o),m++}else t.setVis(!1)}),o.log("Words placed.",m,"of",e.length);const g=x-u,y=p-d,f=s/2,w=n/2,S=l?1/(Math.max(g/s,y/n)+.02):1,P=~~((u+g/2-f)*S),b=~~((d+y/2-w)*S);return this._trans={x:P,y:b,cx:f,cy:w,rate:S},e.forEach(t=>{const e=t.point;e.xPos=f-P+(e.xPos-f)*S,e.yPos=w-b+(e.yPos-w)*S}),this.$_transform(),null==r||r(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;if(e=~~(e*t),i=~~(i*t),y){const r=o*t,h=s*(1-r),a=n*(1-r);this._container.trans(-e+h,-i+a),this._container.scale(r)}else this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=P(e/s),this._rows=P(i/s),this._radius=P(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[];const o=t.prop("frame");this._ellipticity="ellipse"===o||"rectangle"===o?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=Math.min(t*this._unit,64);let r=0,h=[];for(0===t&&h.push([s.c,s.r]);r<o;){const a=r/o*2*Math.PI+i;let l=t*Math.cos(a)/n,c=t*Math.sin(a);if(!e){const t=Math.max(Math.abs(Math.cos(a)),Math.abs(Math.sin(a)));l/=t,c/=t}h.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=h}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:h,width:a,height:l}=t,c=r+a,_=h+l,u=r+a/2,x=h+l/2,d=[{x:r,y:h},{x:c,y:h},{x:r,y:_},{x:c,y:_}].map(t=>({x:u+(t.x-u)*n-(t.y-x)*o,y:x+(t.x-u)*o+(t.y-x)*n})),p=Math.min(...d.map(t=>t.x)),m=Math.min(...d.map(t=>t.y)),g=Math.max(...d.map(t=>t.x)),M=Math.max(...d.map(t=>t.y)),y=this._unit,f=g-p,w=M-m;return{c1:Math.max(0,~~(p/y)),r1:Math.max(0,~~(m/y)),c2:~~(g/y),r2:~~(M/y)+i,bounds:{x:p,y:m,width:f,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),h=t.hText,a=r/o,l=h/o,c=Math.ceil(a/2),_=Math.ceil(l/2),u=Math.max(0,e-c),x=Math.max(0,i-_),d=u+Math.ceil(a),p=x+Math.ceil(l),m={x:(e-c)*o,y:(i-_)*o,width:r,height:h};return n?this._rotatePoint(m,n,s):{c1:u,r1:x,c2:d+s,r2:p,bounds:m}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,h=c.create(i,"",s,n,o,r);h.setFill((null==e?void 0:e.fill)||"#ff000055"),h.setStroke((null==e?void 0:e.stroke)||"none"),h.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,e,i,s,n,r){let h=0,a=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;h<s;){const s=Date.now()-this._startTime;if(s>M(this._series.num("drawTimeout"),5e3))throw new Error(`단어배치 시간이 ${s} ms 경과하여 중단합니다.`);const _=this._getPoints(h,e,n+a++%4*(Math.PI/4));i&&o.shuffle(_);if(_.some((e,i)=>{let s=this._series.prop("rotation")?l[~~(o.randomLike(i+n)*c)]:0;const h=this._getBox(t,e[0],e[1],r,s);if(!this._isOverlapping(h)){if(h.bounds.x<0||h.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],r),{bounds:n}=i,o={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(o.x,o.y,s),t.box=h,!0}}))return!0;h++}}}class z extends b{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,h=[];0===t&&h.push([s.c,s.r]);const a=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*a,c=t*e,_=c*Math.cos(l)/n,u=c*Math.sin(l),x=s.c+_,d=s.r+u;h.push([~~x,~~d])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),u=_-Math.max(1,_>>1),x=.99;for(;++r>=0;){e=1+u*Math.pow(x,r),o=e/n;switch(3&(a*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;h.push([~~l,~~c])}}return h}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,h=Math.min(2*this._radius,Math.max(0,e-P(o.width/2/n))),a=Math.min(2*this._radius,Math.max(0,i-P(r/2/n)));return{c1:h,r1:a,c2:h+P(o.width/n)+s,r2:a+P(r/n),w:t.width,h:r}}}class B extends a{constructor(t){super(t,l.POINT_CLASS),this.add(this.hintView=new c(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new _(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*B.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*B.TOP_PAD)}}B.TOP_PAD=.5;class F extends u{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new x(t,null)),this._words=new d(this._wordContainer,B)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,e){const i=this.model,s=i.prop("text");if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let r=this._visPoints.slice();i.num("minWeight")>0&&(r=r.filter(t=>t.yValue>=i.num("minWeight"))),i.num("minLength")>1&&(r=r.filter(t=>t.x.length>=i.num("minLength")));const h=i.num("maxCount");if(h<r.length&&(r.length=Math.max(0,h)),this.$_prepareWords(this.doc,i,r),"spiral"===i.prop("placer"))this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});else this._placer=new b(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});this._wSave=t,this._hSave=e,this._tSave=s,this._empty=r.length<1,o.log(r.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&p.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,h=e.getMaxFontSize(r,1);let a=Math.min(h,e.getMinFontSize(r,0));const l=s===n||a===h,c=l?NaN:e.prop("logBase"),_=getComputedStyle(this._wordContainer.dom).fontFamily,u=Math.min(2,Math.max(.1,+e.prop("textHeight"))),x=isNaN(u)?t.createElement("canvas").getContext("2d"):null,d=1-B.TOP_PAD;let p;this._words.prepare(i.length,(n,r)=>{const M=n.point=i[r],y=n.textView;n._bbox=null;let f=(M.y-s)/o;c>1&&(f=1-(Math.pow(c,1-f)-1)/(c-1));let w=a+(l?(h-a)/2:f*(h-a));const S=M.x;this._preparePoint(t,e,M,n),delete n.box,y.text=S,y.anchor=m.START,y.setStyles({fontSize:g(w)}),y.layoutText(),x?(x.font=`${g(w)} ${_}`,p=x.measureText(S),n.yText=.9*Math.max(0,p.fontBoundingBoxAscent-p.actualBoundingBoxAscent),n.hText=Math.ceil((p.actualBoundingBoxAscent+p.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*d):(n.yText=0,n.hText=n.getBBox().height*u),n.layout(),n.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,o=n.width,r=n.height,h=(t-o)/2;let a=(e-r)/2;i.trans(i.wx-(i.wx-h)*s,i.wy-(i.wy-a)*s)})}}function T(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(S),t.SeriesView.register([S,F]))}export{S as WordCloudSeries,T as default};
7
+ import*as t from"./index.mjs";import{WordCloudSeriesType as e,extend as i,WidgetSeries as s,calcPercent as n,parsePercentSize as o,Utils as r,toStr as h,WidgetSeriesPoint as a,RcElement as l,SeriesView as c,RectElement as _,TextElement as u,WidgetSeriesView as x,LayerElement as d,PointViewPool as m,SeriesAnimation as p,TextAnchor as g,pixel as M,pickNum as f,isIE as y}from"./index.mjs";class w extends a{}class S extends w{constructor(t,e){super(t),this.points=e}}class P extends s{$_denormalizeFontSize(t,e,i){let s,r;return"min"==t?(s=n(o(P.MinFontSize,!1),e),r=n(o(P.MaxMinFontSize,!1),e)):(s=n(o(P.MinMaxFontSize,!1),e),r=n(o(P.MaxFontSize,!1),e)),i>1?r:i<0?s:i*(r-s)+s}calcFontRatio(t,e,i,s){return n(e,i,s)}getMinFontSize(t,e){const{fixed:i,size:s}=this._minFontSizeDim,r=i&&s<=1?this.$_denormalizeFontSize("min",t,s):n(this._minFontSizeDim,t,e);return Math.max(n(o(P.MinFontSize,!1),t),r)}getMaxFontSize(t,e){const{fixed:i,size:s}=this._maxFontSizeDim,r=i&&s<=1?this.$_denormalizeFontSize("max",t,s):n(this._maxFontSizeDim,t,e);return Math.min(n(o(P.MaxFontSize,!1),t),r)}getLogFunc(){const t=this.prop("logBase");return t>=2?function(e){return Math.max(Math.log(e)/Math.log(t))}:function(t){return t}}_colorByPoint(){return this.prop("colorByPoint")}_createPoint(t){return new w(t)}_createOthersPoint(t,e){return t.y=e.map(t=>t.y).reduce((t,e)=>t+e),new S(t,e)}_doApply(t){var e;super._doApply(t),(t.text!==this._text||r.equalArrays(this._excludes,t.excludes))&&(this._text=t.text,this._excludes=null===(e=t.excludes)||void 0===e?void 0:e.slice(),this._dataSourceDirty=!0),this._setDims(t,"minFontSize","maxFontSize")}_doLoadPoints(t){const e=this.prop("text");let i=[];if(e){const t=Math.max(this.num("minLength")||1,1),s={};let n=this.prop("excludes"),o=e.split(/\s+/g);Array.isArray(n)&&n.length>0&&(o=o.filter(t=>n.indexOf(t)<0)),o.forEach(e=>{e.length>=t&&(e in s?s[e]++:s[e]=1)});for(const t in s)i.push({x:t,y:s[t]})}else if(Array.isArray(t)&&!(t.length>0&&"object"==typeof t[0]&&null!==t[0]))for(let e=0;e<t.length;e+=2)i.push({x:h(t[e]),y:t[e+1]||0});i.length>0&&(t=i.sort((t,e)=>e.y-t.y)),super._doLoadPoints(t)}isPointLabelVisible(t){return!1}_prepareRender(){super._prepareRender(),this.collectValues(null,null),this.prepareReferents(null),this.collectRanges(null,null)}}P.type=e,P.MinFontSize=8,P.MaxMinFontSize=15,P.MaxFontSize="15%",P.MinMaxFontSize="5%",P.defaults=i(s.defaults,{frame:"rectangle",maxCount:100,maxFontSize:1,minFontSize:0,colorByPoint:!0,autoScale:!0,drawTimeout:2e4});const b=Math.floor;class z{constructor(t){this._series=t}start(t,e,i,s,n,o){this._series=i,this._container=t;const h=i.prop("frame"),a="circle"===h||"ellipse"===h,l=i.prop("autoScale"),c=f(i.num("seed"),0)*Math.PI*2/360,_=Math.max(0,f(i.num("wordGap"),0));let u=s,x=0,d=n,m=0,p=0;this._prepare(i,s,n),this._unit,this._startTime=Date.now(),e.forEach(t=>{const e=t.point;if(this._findPos(t,a,i.prop("shuffle"),this._radius,c,_)){const{x:i,y:s,width:n,height:o}=t.box.bounds;this.$_placeWord(t),e.xPos=i+n/2,e.yPos=s,u=Math.min(u,i),x=Math.max(x,i+n),d=Math.min(d,s),m=Math.max(m,s+o),p++}else t.setVis(!1)}),r.log("Words placed.",p,"of",e.length);const g=x-u,M=m-d,y=s/2,w=n/2,S=l?1/(Math.max(g/s,M/n)+.02):1,P=~~((u+g/2-y)*S),b=~~((d+M/2-w)*S);return this._trans={x:P,y:b,cx:y,cy:w,rate:S},e.forEach(t=>{const e=t.point;e.xPos=y-P+(e.xPos-y)*S,e.yPos=w-b+(e.yPos-w)*S}),this.$_transform(),null==o||o(e),this}stop(){}$_transform(t=1){let{x:e,y:i,cx:s,cy:n,rate:o}=this._trans;if(e=~~(e*t),i=~~(i*t),y){const r=o*t,h=s*(1-r),a=n*(1-r);this._container.trans(-e+h,-i+a),this._container.scale(r)}else this._container.dom.setAttribute("transform-origin",`${s} ${n}`),this._container.trans(-e,-i),this._container.scale(o*t)}_prepare(t,e,i){const s=this._unit=8;this._grid=[],this._cols=b(e/s),this._rows=b(i/s),this._radius=b(Math.sqrt(this._cols*this._cols+this._rows*this._rows)/2);const n=2*this._radius;this._center={c:this._radius,r:this._radius};for(let t=0;t<n;t++)this._grid.push([]);this._rdPoints=[];const o=t.prop("frame");this._ellipticity="ellipse"===o||"rectangle"===o?i/e:1}_isOverlapping(t){const e=this._grid;for(let i=t.r1;i<=t.r2;i++)for(let s=t.c1;s<=t.c2;s++)if(e[i]||(e[i]=[]),e[i][s])return!0;return!1}$_placeWord(t){const e=this._grid,i=t.box;for(let s=i.r1;s<=i.r2;s++)for(let n=i.c1;n<=i.c2;n++)e[s][n]=t}_getPoints(t,e,i){if(this._rdPoints[t])return this._rdPoints[t];const s=this._center,n=this._ellipticity,o=Math.min(t*this._unit,64);let r=0,h=[];for(0===t&&h.push([s.c,s.r]);r<o;){const a=r/o*2*Math.PI+i;let l=t*Math.cos(a)/n,c=t*Math.sin(a);if(!e){const t=Math.max(Math.abs(Math.cos(a)),Math.abs(Math.sin(a)));l/=t,c/=t}h.push([~~(s.c+l),~~(s.r+c)]),r++}return this._rdPoints[t]=h}_rotatePoint(t,e,i){const s=e*Math.PI/180,n=Math.cos(s),o=Math.sin(s),{x:r,y:h,width:a,height:l}=t,c=r+a,_=h+l,u=r+a/2,x=h+l/2,d=[{x:r,y:h},{x:c,y:h},{x:r,y:_},{x:c,y:_}].map(t=>({x:u+(t.x-u)*n-(t.y-x)*o,y:x+(t.x-u)*o+(t.y-x)*n})),m=Math.min(...d.map(t=>t.x)),p=Math.min(...d.map(t=>t.y)),g=Math.max(...d.map(t=>t.x)),M=Math.max(...d.map(t=>t.y)),f=this._unit,y=g-m,w=M-p;return{c1:Math.max(0,~~(m/f)),r1:Math.max(0,~~(p/f)),c2:~~(g/f),r2:~~(M/f)+i,bounds:{x:m,y:p,width:y,height:w}}}_getBox(t,e,i,s,n=0){const o=this._unit,{width:r}=t.getBBox(),h=t.hText,a=r/o,l=h/o,c=Math.ceil(a/2),_=Math.ceil(l/2),u=Math.max(0,e-c),x=Math.max(0,i-_),d=u+Math.ceil(a),m=x+Math.ceil(l),p={x:(e-c)*o,y:(i-_)*o,width:r,height:h};return n?this._rotatePoint(p,n,s):{c1:u,r1:x,c2:d+s,r2:m,bounds:p}}$_drawDebugBox(t,e){const{doc:i}=this._container,{x:s,y:n,width:o,height:r}=t.bounds,h=_.create(i,"",s,n,o,r);h.setFill((null==e?void 0:e.fill)||"#ff000055"),h.setStroke((null==e?void 0:e.stroke)||"none"),h.setAttr("stroke-dasharray",(null==e?void 0:e.strokeDashArray)||"4"),this._container.add(h)}_findPos(t,e,i,s,n,o){let h=0,a=0;s=Math.max(s,this._grid.length+1);const l=[0,-90],c=l.length;for(;h<s;){const s=Date.now()-this._startTime;if(s>f(this._series.num("drawTimeout"),5e3))throw new Error(`단어배치 시간이 ${s} ms 경과하여 중단합니다.`);const _=this._getPoints(h,e,n+a++%4*(Math.PI/4));i&&r.shuffle(_);if(_.some((e,i)=>{let s=this._series.prop("rotation")?l[~~(r.randomLike(i+n)*c)]:0;const h=this._getBox(t,e[0],e[1],o,s);if(!this._isOverlapping(h)){if(h.bounds.x<0||h.bounds.y<0)return!1;const i=this._getBox(t,e[0],e[1],o),{bounds:n}=i,r={x:n.width/2,y:n.height/2};return t.wx=n.x,t.wy=n.y,t.setRotation(r.x,r.y,s),t.box=h,!0}}))return!0;h++}}}class B extends z{_findPos(t,e,i,s,n,o){if(this._getPoints(s,e,i?Math.random()*Math.PI*2:n).some(e=>{const i=this._getBox(t,e[0],e[1],o);if(!this._isOverlapping(i))return t.box=i,!0}))return!0}_getPoints(t,e,i){const s=this._center,n=this._ellipticity,o=2*t*this._unit;let r=-1,h=[];0===t&&h.push([s.c,s.r]);const a=i>Math.PI?1:-1;if(e)for(;++r<o;){const e=r/o,l=i+r*e*a,c=t*e,_=c*Math.cos(l)/n,u=c*Math.sin(l),x=s.c+_,d=s.r+u;h.push([~~x,~~d])}else{let e=this._unit>>1,o=e/n,l=s.c+o*Math.cos(i),c=s.r+e*Math.sin(i);const _=Math.max(1,this._unit>>1),u=_-Math.max(1,_>>1),x=.99;for(;++r>=0;){e=1+u*Math.pow(x,r),o=e/n;switch(3&(a*Math.sqrt(1+8*r)-1)/2){case 0:l+=o;break;case 1:c+=e;break;case 2:l-=o;break;default:c-=e}if(Math.max(Math.abs(l-t),Math.abs(c-t))>t)break;h.push([~~l,~~c])}}return h}_getBox(t,e,i,s){const n=this._unit,o=t.getBBox(),r=t.hText,h=Math.min(2*this._radius,Math.max(0,e-b(o.width/2/n))),a=Math.min(2*this._radius,Math.max(0,i-b(r/2/n)));return{c1:h,r1:a,c2:h+b(o.width/n)+s,r2:a+b(r/n),w:t.width,h:r}}}class F extends l{constructor(t){super(t,c.POINT_CLASS),this.add(this.hintView=new _(t)),this.hintView.setStyles({stroke:"none",fill:"transparent"}),this.add(this.textView=new u(t)),this.textView.setStyle("pointerEvents","none")}getBBox(){return this._bbox?this._bbox:this._bbox=this.textView.getBBox()}layout(){const t=this.getBBox();this.hintView.setRect({x:0,y:this.yText*F.TOP_PAD,width:t.width,height:this.hText-this.yText}),this.textView.transY(-this.yText*F.TOP_PAD)}}F.TOP_PAD=.5;class T extends x{constructor(t){super(t,"rct-wordcloud-series"),this._pointContainer.add(this._wordContainer=new d(t,null)),this._words=new m(this._wordContainer,F)}_getPointPool(){return this._words}needFronting(){return!1}getClipContainer(){return null}isEmptyView(){return this._empty}_refreshZombie(){}_renderSeries(t,e){const i=this.model,s=i.prop("text");if(t!==this._wSave||e!==this._hSave||s!==this._tSave){const n=+new Date;let o=this._visPoints.slice();i.num("minWeight")>0&&(o=o.filter(t=>t.yValue>=i.num("minWeight"))),i.num("minLength")>1&&(o=o.filter(t=>t.x.length>=i.num("minLength")));const h=i.num("maxCount");if(h<o.length&&(o.length=Math.max(0,h)),this.$_prepareWords(this.doc,i,o),"spiral"===i.prop("placer"))this._placer=new B(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});else this._placer=new z(i).start(this._wordContainer,this._words._internalItems(),i,t,e,i=>{this.$_layoutWords(t,e)});this._wSave=t,this._hSave=e,this._tSave=s,this._empty=o.length<1,r.log(o.length+" words placed in "+(+new Date-n)+"ms.")}else this.$_layoutWords(t,e)}_runShowEffect(t){t&&p.spread(this,()=>{})}_doPosRateChanged(t){this.$_layoutWords(this.width,this.height)}$_prepareWords(t,e,i){const s=e._minY,n=e._maxY,o=n-s,r=this.height,h=e.getMaxFontSize(r,1);let a=Math.min(h,e.getMinFontSize(r,0));const l=s===n||a===h,c=l?NaN:e.prop("logBase"),_=getComputedStyle(this._wordContainer.dom).fontFamily,u=Math.min(2,Math.max(.1,+e.prop("textHeight"))),x=isNaN(u)?t.createElement("canvas").getContext("2d"):null,d=1-F.TOP_PAD;let m;this._words.prepare(i.length,(n,r)=>{const p=n.point=i[r],f=n.textView;n._bbox=null;let y=(p.y-s)/o;c>1&&(y=1-(Math.pow(c,1-y)-1)/(c-1));let w=a+(l?(h-a)/2:y*(h-a));const S=p.x;this._preparePoint(t,e,p,n),delete n.box,f.text=S,f.anchor=g.START,f.setStyles({fontSize:M(w)}),f.layoutText(),x?(x.font=`${M(w)} ${_}`,m=x.measureText(S),n.yText=.9*Math.max(0,m.fontBoundingBoxAscent-m.actualBoundingBoxAscent),n.hText=Math.ceil((m.actualBoundingBoxAscent+m.actualBoundingBoxDescent)*(w<=10?1.1:1.08)-.1)+n.yText*d):(n.yText=0,n.hText=n.getBBox().height*u),n.layout(),n.setVis(!0)})}$_layoutWords(t,e){var i;let s=this._getPosRate();null===(i=this._placer)||void 0===i||i.$_transform(s),s=1-s,this._words.forEach(i=>{const{bounds:n}=i.box,o=n.width,r=n.height,h=(t-o)/2;let a=(e-r)/2;i.trans(i.wx-(i.wx-h)*s,i.wy-(i.wy-a)*s)})}}function $(t){(function(t){return!!(t&&t.Series&&t.SeriesView)})(t)&&(t.Series.register(P),t.SeriesView.register([P,T]))}$(t);export{P as WordCloudSeries,$ as default};