realmap 1.1.3 → 1.1.4
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/band.js +2 -2
- package/band.mjs +2 -2
- package/chart.js +2 -2
- package/chart.mjs +2 -2
- package/design.d.ts +13 -0
- package/design.js +7 -0
- package/design.mjs +7 -0
- package/editing.js +2 -2
- package/editing.mjs +2 -2
- package/export.js +3 -3
- package/export.mjs +3 -3
- package/feature.js +2 -2
- package/feature.mjs +2 -2
- package/gl.js +2 -2
- package/gl.mjs +2 -2
- package/heatmap.js +2 -2
- package/heatmap.mjs +2 -2
- package/index.d.ts +2709 -2062
- package/index.js +3 -3
- package/index.mjs +3 -3
- package/package.json +7 -1
- package/realmap-style.css +26 -1
- package/region.js +2 -2
- package/region.mjs +2 -2
- package/sankey.js +2 -2
- package/sankey.mjs +2 -2
- package/table.js +2 -2
- package/table.mjs +2 -2
- package/tiledweb.js +2 -2
- package/tiledweb.mjs +2 -2
- package/track.js +2 -2
- package/track.mjs +2 -2
- package/vector.js +2 -2
- package/vector.mjs +2 -2
package/band.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Band v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Band v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("realmap")):"function"==typeof define&&define.amd?define(["exports","realmap"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).RealMapband={},e.RealMap)}(this,(function(e,r){"use strict";function t(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var s=t(r);class i extends r.MarkerSeriesPoint{_readObject(e,r){super._readObject(e,r)}}class n extends r.MarkerSeries{_doApply(e){super._doApply(e)}_createPoint(e){return new i(e)}_defLabelOff(){return 2}}n.type=r.BandSeriesType,n.defaults=r.extend(r.MarkerSeries.defaults,{});class a extends r.MarkerSeriesPointView{constructor(e){super(e)}}class o extends r.MarkerSeriesView{constructor(e){super(e,"rm-band-series",!0,!1)}_createMarkers(e){return new r.PointViewPool(e,a)}_doPrepeare(e,r,t){this.$_prepareMarkers(r,r._visPoints)}_doRender(e,r){this.$_layoutMarkers(e,r)}_doReset(){}_runShowEffect(e){e&&r.SeriesAnimation.grow(this)}_doViewRateChanged(e){this.$_layoutMarkers(this.width,this.height)}$_prepareMarkers(e,r){}$_layoutMarkers(e,r){}}function d(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(n),e.SeriesView.register([n,o]))}d(s),e.BandSeries=n,e.default=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/band.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Band v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Band v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import{BandSeriesType as e,extend as r,MarkerSeries as s,MarkerSeriesPoint as t,MarkerSeriesView as a,PointViewPool as i,SeriesAnimation as n,MarkerSeriesPointView as o}from"./index.mjs";class d extends t{_readObject(e,r){super._readObject(e,r)}}class u extends s{_doApply(e){super._doApply(e)}_createPoint(e){return new d(e)}_defLabelOff(){return 2}}u.type=e,u.defaults=r(s.defaults,{});class _ extends o{constructor(e){super(e)}}class p extends a{constructor(e){super(e,"rm-band-series",!0,!1)}_createMarkers(e){return new i(e,_)}_doPrepeare(e,r,s){this.$_prepareMarkers(r,r._visPoints)}_doRender(e,r){this.$_layoutMarkers(e,r)}_doReset(){}_runShowEffect(e){e&&n.grow(this)}_doViewRateChanged(e){this.$_layoutMarkers(this.width,this.height)}$_prepareMarkers(e,r){}$_layoutMarkers(e,r){}}function c(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(u),e.SeriesView.register([u,p]))}export{u as BandSeries,c as default};
|
package/chart.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Chart v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Chart v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realmap"),require("realchart")):"function"==typeof define&&define.amd?define(["exports","realmap","realchart"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealMapChart={},e.RealMap,e.RealChart)}(this,(function(e,t,r){"use strict";function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=a(t),n=a(r);class o extends t.Annotation{constructor(){super(...arguments),this._chart=null}get realchart(){return this._chart}set realchart(e){this._chart=e}}o.DEF_SIZE=100,o.type=t.ChartAnnotationType,o.defaults=t.extend(t.MarkerSeries.defaults,{});class s extends t.AnnotationView{constructor(e){super(e,s.CLASS_NAME),this.add(this._foreignObj=new t.RmElement(e,"","foreignObject")),this._htmlView=e.createElementNS("http://www.w3.org/1999/xhtml","div"),this._htmlView.className="rm-chart-annotation-container",this._foreignObj.addDom(this._htmlView)}_doMeasure(e,r,a,i){const n=r.getSize(a,i),s=this._htmlView;return this._foreignObj.resize(t.pickNum(n.width,o.DEF_SIZE),n.height),this.model.realchart||this.$_prepareChart(e),isNaN(this._foreignObj.height)&&(this._foreignObj.height=s.offsetHeight),t.rectToSize(this._foreignObj.bbox())}_doDestory(){this.model.realchart&&(this.model.realchart.destroy(),this.model.realchart=null),this._foreignObj.remove()}$_prepareChart(e){try{const r=this.model.options,a=this._htmlView,i=t.ExternalModuleManager.getInstance().findModule("realchart");if(!i)throw new Error("리얼차트 모듈을 로드하지 못했습니다. realchart 모듈을 등록했는지 확인하세요.");this.model.realchart=i.createChart(e,a,r.config||{},!0)}catch(e){console.error("차트 생성 중 오류가 발생했습니다. 리얼차트의 모듈과 라이선스가 올바르게 적용되었는지 확인하세요.")}}}function h(e,t){if(function(e){return e.Series&&e.SeriesView}(e)){e.Annotation.register(o),e.AnnotationView.register([o,s]);const r=e.ExternalModuleManager.getInstance();t&&r.registerModule("realchart",t)}}s.CLASS_NAME="rm-chart-annotation",h(i,n),e.ChartAnnotation=o,e.default=h,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/chart.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Chart v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Chart v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import{ChartAnnotationType as t,extend as e,MarkerSeries as r,Annotation as i,AnnotationView as h,RmElement as s,pickNum as a,rectToSize as o,ExternalModuleManager as n}from"./index.mjs";class l extends i{constructor(){super(...arguments),this._chart=null}get realchart(){return this._chart}set realchart(t){this._chart=t}}l.DEF_SIZE=100,l.type=t,l.defaults=e(r.defaults,{});class c extends h{constructor(t){super(t,c.CLASS_NAME),this.add(this._foreignObj=new s(t,"","foreignObject")),this._htmlView=t.createElementNS("http://www.w3.org/1999/xhtml","div"),this._htmlView.className="rm-chart-annotation-container",this._foreignObj.addDom(this._htmlView)}_doMeasure(t,e,r,i){const h=e.getSize(r,i),s=this._htmlView;return this._foreignObj.resize(a(h.width,l.DEF_SIZE),h.height),this.model.realchart||this.$_prepareChart(t),isNaN(this._foreignObj.height)&&(this._foreignObj.height=s.offsetHeight),o(this._foreignObj.bbox())}_doDestory(){this.model.realchart&&(this.model.realchart.destroy(),this.model.realchart=null),this._foreignObj.remove()}$_prepareChart(t){try{const e=this.model.options,r=this._htmlView,i=n.getInstance().findModule("realchart");if(!i)throw new Error("리얼차트 모듈을 로드하지 못했습니다. realchart 모듈을 등록했는지 확인하세요.");this.model.realchart=i.createChart(t,r,e.config||{},!0)}catch(t){console.error("차트 생성 중 오류가 발생했습니다. 리얼차트의 모듈과 라이선스가 올바르게 적용되었는지 확인하세요.")}}}function d(t,e){if(function(t){return t.Series&&t.SeriesView}(t)){t.Annotation.register(l),t.AnnotationView.register([l,c]);const r=t.ExternalModuleManager.getInstance();e&&r.registerModule("realchart",e)}}c.CLASS_NAME="rm-chart-annotation";export{l as ChartAnnotation,d as default};
|
package/design.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as RealMap from 'realmap';
|
|
2
|
+
import { ChartView, ChartControl } from 'realmap';
|
|
3
|
+
|
|
4
|
+
declare class DesignChartView extends ChartView {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare class DesignChartControl extends ChartControl {
|
|
8
|
+
protected _createChartView(doc: Document): DesignChartView;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function registerSeries(chart: typeof RealMap): void;
|
|
12
|
+
|
|
13
|
+
export { DesignChartControl, registerSeries as default };
|
package/design.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* RealMap Design v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
|
+
* All Rights Reserved.
|
|
6
|
+
*/
|
|
7
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("realmap")):"function"==typeof define&&define.amd?define(["exports","realmap"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).RealMapdesign={},e.RealMap)}(this,(function(e,s){"use strict";function i(e){var s=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var t=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(s,i,t.get?t:{enumerable:!0,get:function(){return e[i]}})}})),s.default=e,Object.freeze(s)}var t=i(s);class n extends s.ImageAnnotationView{designSelect(e){}designDeselect(){}}class l extends s.TextAnnotationView{designSelect(e){}designDeselect(){}}class c extends s.ShapeAnnotationView{designSelect(e){}designDeselect(){}}class r extends s.MapSeriesView{designSelect(e){}designDeselect(){}}class a extends s.PinSeriesView{designSelect(e){}designDeselect(){}}class d extends s.BarSeriesView{designSelect(e){}designDeselect(){}}class g extends s.LineSeriesView{designSelect(e){}designDeselect(){}}class o extends s.PieSeriesView{designSelect(e){}designDeselect(){}}class S extends s.FigureSeriesView{designSelect(e){}designDeselect(){}}class u extends s.WaffleSeriesView{designSelect(e){}designDeselect(){}}class f extends s.RouteSeriesView{designSelect(e){}designDeselect(){}}class w extends s.BubbleSeriesView{designSelect(e){}designDeselect(){}}class x extends s.ImageSeriesView{designSelect(e){}designDeselect(){}}class V extends s.PanelSeriesView{designSelect(e){}designDeselect(){}}class D extends s.HtmlSeriesView{designSelect(e){}designDeselect(){}}class p extends s.CircleGaugeView{designSelect(e){}designDeselect(){}}class b extends s.ClockGaugeView{designSelect(e){}designDeselect(){}}class m extends s.HtmlAnnotationView{designSelect(e){}designDeselect(){}}class h extends s.ChartView{}class C extends s.ChartControl{_createChartView(e){return new h(e)}}function P(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.SeriesView.register([t.MapSeries,r],[t.PointSeries,r],[t.PinSeries,a],[t.BarSeries,d],[t.LineSeries,g],[t.PieSeries,o],[t.FigureSeries,S],[t.WaffleSeries,u],[t.RouteSeries,f],[t.BubbleSeries,w],[t.ImageSeries,x],[t.PanelSeries,V],[t.HtmlSeries,D],[t.CircleGauge,p],[t.ClockGauge,b]),e.AnnotationView.register([t.TextAnnotation,l],[t.ImageAnnotation,n],[t.ShapeAnnotation,c],[t.HtmlAnnotation,m]))}P(t),e.DesignChartControl=C,e.default=P,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/design.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* RealMap Design v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
|
+
* All Rights Reserved.
|
|
6
|
+
*/
|
|
7
|
+
import*as e from"./index.mjs";import{ImageAnnotationView as s,TextAnnotationView as n,ShapeAnnotationView as t,MapSeriesView as i,PinSeriesView as l,BarSeriesView as c,LineSeriesView as d,PieSeriesView as g,FigureSeriesView as a,WaffleSeriesView as r,RouteSeriesView as S,BubbleSeriesView as x,ImageSeriesView as o,PanelSeriesView as D,HtmlSeriesView as m,CircleGaugeView as u,ClockGaugeView as f,HtmlAnnotationView as p,ChartView as w,ChartControl as A}from"./index.mjs";class P extends s{designSelect(e){}designDeselect(){}}class V extends n{designSelect(e){}designDeselect(){}}class C extends t{designSelect(e){}designDeselect(){}}class b extends i{designSelect(e){}designDeselect(){}}class h extends l{designSelect(e){}designDeselect(){}}class j extends c{designSelect(e){}designDeselect(){}}class v extends d{designSelect(e){}designDeselect(){}}class B extends g{designSelect(e){}designDeselect(){}}class G extends a{designSelect(e){}designDeselect(){}}class H extends r{designSelect(e){}designDeselect(){}}class I extends S{designSelect(e){}designDeselect(){}}class k extends x{designSelect(e){}designDeselect(){}}class F extends o{designSelect(e){}designDeselect(){}}class L extends D{designSelect(e){}designDeselect(){}}class M extends m{designSelect(e){}designDeselect(){}}class R extends u{designSelect(e){}designDeselect(){}}class T extends f{designSelect(e){}designDeselect(){}}class W extends p{designSelect(e){}designDeselect(){}}class _ extends w{}class q extends A{_createChartView(e){return new _(e)}}var y,z=void(function(e){return e.Series&&e.SeriesView}(y=e)&&(y.SeriesView.register([e.MapSeries,b],[e.PointSeries,b],[e.PinSeries,h],[e.BarSeries,j],[e.LineSeries,v],[e.PieSeries,B],[e.FigureSeries,G],[e.WaffleSeries,H],[e.RouteSeries,I],[e.BubbleSeries,k],[e.ImageSeries,F],[e.PanelSeries,L],[e.HtmlSeries,M],[e.CircleGauge,R],[e.ClockGauge,T]),y.AnnotationView.register([e.TextAnnotation,V],[e.ImageAnnotation,P],[e.ShapeAnnotation,C],[e.HtmlAnnotation,W])));export{q as DesignChartControl,z as default};
|
package/editing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Editing v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Editing v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("realmap")):"function"==typeof define&&define.amd?define(["realmap"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealMap)}(this,(function(e){"use strict";function t(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var r=t(e);class n extends e.MapTool{_getDragTracker(e,t,r){return console.log("get drag tracker"),super._getDragTracker(e,t,r,!1)}}class a extends e.ChartControl{_creatDefaultTool(){return new n(this)}}r.setGlobals({chartControl:a})}));
|
package/editing.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Editing v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Editing v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import*as r from"./index.mjs";import{MapTool as e,ChartControl as t}from"./index.mjs";class s extends e{_getDragTracker(r,e,t){return console.log("get drag tracker"),super._getDragTracker(r,e,t,!1)}}r.setGlobals({chartControl:class extends t{_creatDefaultTool(){return new s(this)}}});
|
package/export.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Export v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Export v1.1.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):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).$$_RealMapExporter={})}(this,(function(e){"use strict";const t=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function n(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let r=null;function o(e={}){return r||(e.includeStyleProperties?(r=e.includeStyleProperties,r):(r=n(window.getComputedStyle(document.documentElement)),r))}function i(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function s(e,t={}){return{width:t.width||function(e){const t=i(e,"border-left-width"),n=i(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=i(e,"border-top-width"),n=i(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const a=16384;function c(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function l(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),async function(e){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(e))).then(encodeURIComponent).then((e=>`data:image/svg+xml;charset=utf-8,${e}`))}(o)}const u=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||u(n,t))};function h(e,t,n,r){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return o(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,r);return document.createTextNode(`${i}{${s}}`)}function d(e,n,r,o){const i=window.getComputedStyle(e,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=t();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(h(a,r,i,o)),n.appendChild(c)}const m="application/font-woff",f="image/jpeg",g={woff:m,woff2:m,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:f,jpeg:f,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function p(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return g[t]||""}function y(e){return-1!==e.search(/^(data:)/)}function w(e,t){return`data:${t};base64,${e}`}async function x(e,t,n){const r=await fetch(e,t);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onerror=t,i.onloadend=()=>{try{e(n({res:r,result:i.result}))}catch(e){t(e)}},i.readAsDataURL(o)}))}const v={};async function b(e,t,n){const r=function(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}(e,t,n.includeQueryParams);if(null!=v[r])return v[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await x(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=w(r,t)}catch(t){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${e}`;t&&(r="string"==typeof t?t:t.message),r&&console.warn(r)}return v[r]=o,o}async function E(e,t){return u(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):c(t)}(e):u(e,HTMLVideoElement)?async function(e,t){if(e.currentSrc){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),c(t.toDataURL())}const n=e.poster,r=p(n);return c(await b(n,r,t))}(e,t):u(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await R(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode($(e))}const S=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),$=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function C(e,t,n){return u(t,Element)&&(function(e,t,n){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):o(n).forEach((n=>{let o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){const e=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o=`${e}px`}u(e,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(n,o,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){d(e,t,":before",n),d(e,t,":after",n)}(e,t,n),function(e,t){u(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),u(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(u(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function R(e,t,r){return r||!t.filter||t.filter(e)?Promise.resolve(e).then((e=>E(e,t))).then((r=>async function(e,t,r){var o,i;if($(t))return t;let s=[];return s=S(e)&&e.assignedNodes?n(e.assignedNodes()):u(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?n(e.contentDocument.body.childNodes):n((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||u(e,HTMLVideoElement)||await s.reduce(((e,n)=>e.then((()=>R(n,r))).then((e=>{e&&t.appendChild(e)}))),Promise.resolve()),t}(e,r,t))).then((n=>C(e,n,t))).then((e=>async function(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;const r={};for(let o=0;o<n.length;o++){const i=n[o].getAttribute("xlink:href");if(i){const n=e.querySelector(i),o=document.querySelector(i);n||!o||r[i]||(r[i]=await R(o,t,!0))}}const o=Object.values(r);if(o.length){const t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";const r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<o.length;e++)r.appendChild(o[e]);e.appendChild(n)}return e}(e,t))):null}const _=/url\((['"]?)([^'"]+?)\1\)/g,L=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function T(e,t,n,r,o){try{const i=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}(t,n):t,s=p(t);let a;if(o){a=w(await o(i),s)}else a=await b(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function I(e){return-1!==e.search(_)}async function A(e,t,n){if(!I(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(k,(e=>{for(;;){const[n,,r]=L.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(_,((e,n,r)=>(t.push(r),e))),t.filter((e=>!y(e)))}(r);return o.reduce(((e,r)=>e.then((e=>T(e,r,t,n)))),Promise.resolve(r))}async function P(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await A(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function N(e,t){u(e,Element)&&(await async function(e,t){await P("background",e,t)||await P("background-image",e,t),await P("mask",e,t)||await P("-webkit-mask",e,t)||await P("mask-image",e,t)||await P("-webkit-mask-image",e,t)}(e,t),await async function(e,t){const n=u(e,HTMLImageElement);if((!n||y(e.src))&&(!u(e,SVGImageElement)||y(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await b(r,p(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,t),await async function(e,t){const r=n(e.childNodes).map((e=>N(e,t)));await Promise.all(r).then((()=>e))}(e,t))}const M={};async function H(e){let t=M[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},M[e]=t,t}async function D(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),x(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function B(e){if(null==e)return[];const t=[];let n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=o.exec(n);if(null===e){if(e=i.exec(n),null===e)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(e[0])}return t}async function j(e,t){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=n(e.ownerDocument.styleSheets),o=await async function(e,t){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{n(r.cssRules||[]).forEach(((e,n)=>{if(e.type===CSSRule.IMPORT_RULE){let i=n+1;const s=H(e.href).then((e=>D(e,t))).then((e=>B(e).forEach((e=>{try{r.insertRule(e,e.startsWith("@import")?i+=1:r.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})))).catch((e=>{console.error("Error loading remote css",e.toString())}));o.push(s)}}))}catch(n){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(H(r.href).then((e=>D(e,t))).then((e=>B(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",n)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{n(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,t);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>I(e.style.getPropertyValue("src"))))}(o)}function F(e){return e.trim().replace(/["']/g,"")}async function V(e,t){const n=await j(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(F(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(F(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return A(e.cssText,n,t)})))).join("\n")}async function U(e,t={}){const{width:n,height:r}=s(e,t),o=await R(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await V(e,t);if(n){const t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}(o,t),await N(o,t),function(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;null!=r&&Object.keys(r).forEach((e=>{n[e]=r[e]}))}(o,t);return await l(o,n,r)}async function O(e,t={}){const{width:n,height:r}=s(e,t),o=await U(e,t),i=await c(o),l=document.createElement("canvas"),u=l.getContext("2d"),h=t.pixelRatio||function(){let e,t;try{t=process}catch(e){}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,m=t.canvasHeight||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>a||e.height>a)&&(e.width>a&&e.height>a?e.width>e.height?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a):e.width>a?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a))}(l),l.style.width=`${d}`,l.style.height=`${m}`,t.backgroundColor&&(u.fillStyle=t.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.drawImage(i,0,0,l.width,l.height),l}class q{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];o.hideNavigator&&l.push("rm-navigator"),o.hideScrollbar&&l.push("rm-axis-scrollbar"),o.hideZoomButton&&l.push("rm-reset-zoom");let u,h={};switch(h.width=r.width,h.height=r.height,h.canvasWidth=r.width*i,h.canvasHeight=r.height*i,h.filter=e=>{var t;return"none"!==(null===(t=e.style)||void 0===t?void 0:t.display)&&!l.some((t=>{var n;return null===(n=e.classList)||void 0===n?void 0:n.contains(t)}))},h.pixelRatio=1,s){case"png":u=async function(e,t={}){return(await O(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await O(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=U(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class z{export(e,t,n){}$_removeItems(e,t){e.querySelectorAll(t).forEach((e=>{e.remove()}))}$_removeAriaLabelRecursively(e){e.hasAttribute("aria-label")&&e.removeAttribute("aria-label");const t=e.children;for(let e=0;e<t.length;e++)this.$_removeAriaLabelRecursively(t[e])}$_removeHiddenElementsRecursively(e){if("none"===window.getComputedStyle(e).display||"none"===e.style.display)return void e.parentNode.removeChild(e);const t=e.children;for(let e=0;e<t.length;e++)this.$_removeHiddenElementsRecursively(t[e])}}class W extends z{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-export-indicator"),u.style.position="absolute",u.style.width="40px",u.style.height="40px",u.style.top=(s.height+40)/2+"px",u.style.left=(s.width+40)/2+"px";const h=e.cloneNode(!0);e.appendChild(u);const d=()=>{const n=new Image;n.onload=function(){l.drawImage(n,0,0,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.height,0,0,e,r);const h=o.toDataURL(`image/${t.type}`),d=document.createElement("a");d.href=h,d.download=`${i}.${t.type}`,d.click(),u&&u.remove()},h.querySelectorAll("g").forEach((e=>{0===e.childElementCount&&e.remove()})),this.$_removeItems(h,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),o.hideNavigator&&this.$_removeItems(h,".rm-navigator"),o.hideScrollbar&&this.$_removeItems(h,".rm-axis-scrollbar"),o.hideZoomButton&&this.$_removeItems(h,".rm-reset-zoom"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),d=5e4;let m="";if(l.length/d>1)for(let e=0;e<l.length/d;e++)m+=String.fromCharCode.apply(null,l.slice(e*d,(e+1)*d));else m=String.fromCharCode.apply(null,l);try{n.src="data:image/svg+xml;base64,"+btoa(m)}catch(e){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.co.kr/api";fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t.type,size:{width:s.width,height:s.height},dom:h.outerHTML})}).then((e=>e.json())).then((({data:e})=>{n.src=`data:image/png;base64,${e}`})).catch((e=>{u&&u.remove(),console.log("error"),console.error("Error:",e)}))}}))},m=h.style.backgroundImage;if(m&&"none"!==m&&"initial"!==m){const e=null===(r=m.match(/^url\(["']?(.*?)["']?\)$/))||void 0===r?void 0:r[1];if(e){const t=new Image;t.onload=()=>{l.drawImage(t,0,0,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}return t}$_imagesToBase64(e,t){var n;function r(e){return fetch(e).then((e=>e.blob())).then((e=>new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})))).catch((e=>{throw console.error("Error:",e),e}))}const o=[],i=e.style.backgroundImage;if(i&&"none"!==i){const t=null===(n=i.match(/^url\(["']?(.*?)["']?\)$/))||void 0===n?void 0:n[1];if(t){const n=r(t).then((t=>{e.style.backgroundImage=`url(${t})`})).catch((e=>{console.warn("Failed to convert background image to base64",e)}));o.push(n)}}const s=e.querySelectorAll("image, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class G{constructor(e,t,n){this._imageExporter=new W,this._libraryExporter=new q,this._chart=n,this.$_render(e,t)}exportToImage(e,t,n){n&&(n.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,n):this._imageExporter.export(e,t,n))}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.options.exporting||{},o=e.getElementsByClassName("rm-contextmenu-button");for(const e of Array.from(o))e.remove();if(!r.visible)return;this._contextmenuButton&&(this._contextmenuButton.remove(),this._contextmenuButton=null,this._contextmenu=null),n.style.position="relative";const i=this._contextmenuButton=e.createElement("div");i.classList.add("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.menus.forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.fileName};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i,this._chart.options.exporting);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class X{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(X))}static createExporter(e,t,n){return new G(e,t,n)}}X.MODULE_NAME="$$realmap_export";const Z=X.use;e.RealMapExport=Z}));
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).$$_RealMapExporter={})}(this,(function(e){"use strict";const t=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function n(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let r=null;function o(e={}){return r||(e.includeStyleProperties?(r=e.includeStyleProperties,r):(r=n(window.getComputedStyle(document.documentElement)),r))}function i(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function s(e,t={}){return{width:t.width||function(e){const t=i(e,"border-left-width"),n=i(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=i(e,"border-top-width"),n=i(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const a=16384;function c(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function l(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),async function(e){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(e))).then(encodeURIComponent).then((e=>`data:image/svg+xml;charset=utf-8,${e}`))}(o)}const u=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||u(n,t))};function h(e,t,n,r){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return o(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,r);return document.createTextNode(`${i}{${s}}`)}function d(e,n,r,o){const i=window.getComputedStyle(e,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=t();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(h(a,r,i,o)),n.appendChild(c)}const m="application/font-woff",f="image/jpeg",g={woff:m,woff2:m,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:f,jpeg:f,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function p(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return g[t]||""}function y(e){return-1!==e.search(/^(data:)/)}function w(e,t){return`data:${t};base64,${e}`}async function x(e,t,n){const r=await fetch(e,t);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onerror=t,i.onloadend=()=>{try{e(n({res:r,result:i.result}))}catch(e){t(e)}},i.readAsDataURL(o)}))}const b={};async function v(e,t,n){const r=function(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}(e,t,n.includeQueryParams);if(null!=b[r])return b[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await x(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=w(r,t)}catch(t){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${e}`;t&&(r="string"==typeof t?t:t.message),r&&console.warn(r)}return b[r]=o,o}async function E(e,t){return u(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):c(t)}(e):u(e,HTMLVideoElement)?async function(e,t){if(e.currentSrc){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),c(t.toDataURL())}const n=e.poster,r=p(n);return c(await v(n,r,t))}(e,t):u(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await R(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode($(e))}const S=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),$=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function C(e,t,n){return u(t,Element)&&(function(e,t,n){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):o(n).forEach((n=>{let o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){const e=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o=`${e}px`}u(e,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(n,o,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){d(e,t,":before",n),d(e,t,":after",n)}(e,t,n),function(e,t){u(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),u(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(u(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function R(e,t,r){return r||!t.filter||t.filter(e)?Promise.resolve(e).then((e=>E(e,t))).then((r=>async function(e,t,r){var o,i;if($(t))return t;let s=[];return s=S(e)&&e.assignedNodes?n(e.assignedNodes()):u(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?n(e.contentDocument.body.childNodes):n((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||u(e,HTMLVideoElement)||await s.reduce(((e,n)=>e.then((()=>R(n,r))).then((e=>{e&&t.appendChild(e)}))),Promise.resolve()),t}(e,r,t))).then((n=>C(e,n,t))).then((e=>async function(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;const r={};for(let o=0;o<n.length;o++){const i=n[o].getAttribute("xlink:href");if(i){const n=e.querySelector(i),o=document.querySelector(i);n||!o||r[i]||(r[i]=await R(o,t,!0))}}const o=Object.values(r);if(o.length){const t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";const r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<o.length;e++)r.appendChild(o[e]);e.appendChild(n)}return e}(e,t))):null}const _=/url\((['"]?)([^'"]+?)\1\)/g,L=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function T(e,t,n,r,o){try{const i=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}(t,n):t,s=p(t);let a;if(o){a=w(await o(i),s)}else a=await v(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function A(e){return-1!==e.search(_)}async function I(e,t,n){if(!A(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(k,(e=>{for(;;){const[n,,r]=L.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(_,((e,n,r)=>(t.push(r),e))),t.filter((e=>!y(e)))}(r);return o.reduce(((e,r)=>e.then((e=>T(e,r,t,n)))),Promise.resolve(r))}async function P(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await I(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function N(e,t){u(e,Element)&&(await async function(e,t){await P("background",e,t)||await P("background-image",e,t),await P("mask",e,t)||await P("-webkit-mask",e,t)||await P("mask-image",e,t)||await P("-webkit-mask-image",e,t)}(e,t),await async function(e,t){const n=u(e,HTMLImageElement);if((!n||y(e.src))&&(!u(e,SVGImageElement)||y(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await v(r,p(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,t),await async function(e,t){const r=n(e.childNodes).map((e=>N(e,t)));await Promise.all(r).then((()=>e))}(e,t))}const M={};async function H(e){let t=M[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},M[e]=t,t}async function D(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),x(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function j(e){if(null==e)return[];const t=[];let n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=o.exec(n);if(null===e){if(e=i.exec(n),null===e)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(e[0])}return t}async function F(e,t){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=n(e.ownerDocument.styleSheets),o=await async function(e,t){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{n(r.cssRules||[]).forEach(((e,n)=>{if(e.type===CSSRule.IMPORT_RULE){let i=n+1;const s=H(e.href).then((e=>D(e,t))).then((e=>j(e).forEach((e=>{try{r.insertRule(e,e.startsWith("@import")?i+=1:r.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})))).catch((e=>{console.error("Error loading remote css",e.toString())}));o.push(s)}}))}catch(n){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(H(r.href).then((e=>D(e,t))).then((e=>j(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",n)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{n(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,t);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>A(e.style.getPropertyValue("src"))))}(o)}function V(e){return e.trim().replace(/["']/g,"")}async function B(e,t){const n=await F(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(V(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(V(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return I(e.cssText,n,t)})))).join("\n")}async function U(e,t={}){const{width:n,height:r}=s(e,t),o=await R(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await B(e,t);if(n){const t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}(o,t),await N(o,t),function(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;null!=r&&Object.keys(r).forEach((e=>{n[e]=r[e]}))}(o,t);return await l(o,n,r)}async function O(e,t={}){const{width:n,height:r}=s(e,t),o=await U(e,t),i=await c(o),l=document.createElement("canvas"),u=l.getContext("2d"),h=t.pixelRatio||function(){let e,t;try{t=process}catch(e){}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,m=t.canvasHeight||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>a||e.height>a)&&(e.width>a&&e.height>a?e.width>e.height?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a):e.width>a?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a))}(l),l.style.width=`${d}`,l.style.height=`${m}`,t.backgroundColor&&(u.fillStyle=t.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.drawImage(i,0,0,l.width,l.height),l}class q{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];let u,h={};switch(h.width=r.width,h.height=r.height,h.canvasWidth=r.width*i,h.canvasHeight=r.height*i,h.filter=e=>{var t;return"none"!==(null===(t=e.style)||void 0===t?void 0:t.display)&&!l.some((t=>{var n;return null===(n=e.classList)||void 0===n?void 0:n.contains(t)}))},h.pixelRatio=1,s){case"png":u=async function(e,t={}){return(await O(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await O(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=U(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class z{export(e,t,n){}$_removeItems(e,t){e.querySelectorAll(t).forEach((e=>{e.remove()}))}$_removeAriaLabelRecursively(e){e.hasAttribute("aria-label")&&e.removeAttribute("aria-label");const t=e.children;for(let e=0;e<t.length;e++)this.$_removeAriaLabelRecursively(t[e])}$_removeHiddenElementsRecursively(e){if("none"===window.getComputedStyle(e).display||"none"===e.style.display)return void e.parentNode.removeChild(e);const t=e.children;for(let e=0;e<t.length;e++)this.$_removeHiddenElementsRecursively(t[e])}}class W extends z{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-export-indicator"),u.style.position="absolute",u.style.width="40px",u.style.height="40px",u.style.top=(s.height+40)/2+"px",u.style.left=(s.width+40)/2+"px";const h=e.cloneNode(!0);e.appendChild(u);const d=()=>{const n=new Image;n.onload=function(){l.drawImage(n,0,0,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.height,0,0,e,r);const h=o.toDataURL(`image/${t.type}`),d=document.createElement("a");d.href=h,d.download=`${i}.${t.type}`,d.click(),u&&u.remove()},h.querySelectorAll("g").forEach((e=>{0===e.childElementCount&&e.remove()})),this.$_removeItems(h,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),d=5e4;let m="";if(l.length/d>1)for(let e=0;e<l.length/d;e++)m+=String.fromCharCode.apply(null,l.slice(e*d,(e+1)*d));else m=String.fromCharCode.apply(null,l);try{n.src="data:image/svg+xml;base64,"+btoa(m)}catch(e){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.co.kr/api";fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t.type,size:{width:s.width,height:s.height},dom:h.outerHTML})}).then((e=>e.json())).then((({data:e})=>{n.src=`data:image/png;base64,${e}`})).catch((e=>{u&&u.remove(),console.log("error"),console.error("Error:",e)}))}}))},m=h.style.backgroundImage;if(m&&"none"!==m&&"initial"!==m){const e=null===(r=m.match(/^url\(["']?(.*?)["']?\)$/))||void 0===r?void 0:r[1];if(e){const t=new Image;t.onload=()=>{l.drawImage(t,0,0,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}return t}$_imagesToBase64(e,t){var n;function r(e){return fetch(e).then((e=>e.blob())).then((e=>new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})))).catch((e=>{throw console.error("Error:",e),e}))}const o=[],i=e.style.backgroundImage;if(i&&"none"!==i){const t=null===(n=i.match(/^url\(["']?(.*?)["']?\)$/))||void 0===n?void 0:n[1];if(t){const n=r(t).then((t=>{e.style.backgroundImage=`url(${t})`})).catch((e=>{console.warn("Failed to convert background image to base64",e)}));o.push(n)}}const s=e.querySelectorAll("image, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class G{constructor(e,t,n){this._imageExporter=new W,this._libraryExporter=new q,this._chart=n,this.$_render(e,t)}exportToImage(e,t,n){n&&(n.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,n):this._imageExporter.export(e,t,n))}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.options.exporting||{},o=e.getElementsByClassName("rm-contextmenu-button");for(const e of Array.from(o))e.remove();if(!r.visible)return;this._contextmenuButton&&(this._contextmenuButton.remove(),this._contextmenuButton=null,this._contextmenu=null),n.style.position="relative";const i=this._contextmenuButton=e.createElement("div");i.classList.add("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.menus.forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.fileName};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i,this._chart.options.exporting);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class X{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(X))}static createExporter(e,t,n){return new G(e,t,n)}}X.MODULE_NAME="$$realmap_export";const J=X.use;e.RealMapExport=J}));
|
package/export.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Export v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Export v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
|
-
const e=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function t(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let n=null;function r(e={}){return n||(e.includeStyleProperties?(n=e.includeStyleProperties,n):(n=t(window.getComputedStyle(document.documentElement)),n))}function o(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function i(e,t={}){return{width:t.width||function(e){const t=o(e,"border-left-width"),n=o(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=o(e,"border-top-width"),n=o(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const s=16384;function a(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function c(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),async function(e){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(e))).then(encodeURIComponent).then((e=>`data:image/svg+xml;charset=utf-8,${e}`))}(o)}const l=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||l(n,t))};function u(e,t,n,o){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return r(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,o);return document.createTextNode(`${i}{${s}}`)}function h(t,n,r,o){const i=window.getComputedStyle(t,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=e();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(u(a,r,i,o)),n.appendChild(c)}const d="application/font-woff",m="image/jpeg",f={woff:d,woff2:d,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:m,jpeg:m,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return f[t]||""}function p(e){return-1!==e.search(/^(data:)/)}function y(e,t){return`data:${t};base64,${e}`}async function w(e,t,n){const r=await fetch(e,t);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onerror=t,i.onloadend=()=>{try{e(n({res:r,result:i.result}))}catch(e){t(e)}},i.readAsDataURL(o)}))}const v={};async function x(e,t,n){const r=function(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}(e,t,n.includeQueryParams);if(null!=v[r])return v[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await w(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=y(r,t)}catch(t){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${e}`;t&&(r="string"==typeof t?t:t.message),r&&console.warn(r)}return v[r]=o,o}async function b(e,t){return l(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):a(t)}(e):l(e,HTMLVideoElement)?async function(e,t){if(e.currentSrc){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),a(t.toDataURL())}const n=e.poster,r=g(n);return a(await x(n,r,t))}(e,t):l(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await C(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode(S(e))}const E=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),S=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function $(e,t,n){return l(t,Element)&&(function(e,t,n){const o=t.style;if(!o)return;const i=window.getComputedStyle(e);i.cssText?(o.cssText=i.cssText,o.transformOrigin=i.transformOrigin):r(n).forEach((n=>{let r=i.getPropertyValue(n);if("font-size"===n&&r.endsWith("px")){const e=Math.floor(parseFloat(r.substring(0,r.length-2)))-.1;r=`${e}px`}l(e,HTMLIFrameElement)&&"display"===n&&"inline"===r&&(r="block"),"d"===n&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){h(e,t,":before",n),h(e,t,":after",n)}(e,t,n),function(e,t){l(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),l(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(l(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function C(e,n,r){return r||!n.filter||n.filter(e)?Promise.resolve(e).then((e=>b(e,n))).then((r=>async function(e,n,r){var o,i;if(S(n))return n;let s=[];return s=E(e)&&e.assignedNodes?t(e.assignedNodes()):l(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?t(e.contentDocument.body.childNodes):t((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||l(e,HTMLVideoElement)||await s.reduce(((e,t)=>e.then((()=>C(t,r))).then((e=>{e&&n.appendChild(e)}))),Promise.resolve()),n}(e,r,n))).then((t=>$(e,t,n))).then((e=>async function(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;const r={};for(let o=0;o<n.length;o++){const i=n[o].getAttribute("xlink:href");if(i){const n=e.querySelector(i),o=document.querySelector(i);n||!o||r[i]||(r[i]=await C(o,t,!0))}}const o=Object.values(r);if(o.length){const t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";const r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<o.length;e++)r.appendChild(o[e]);e.appendChild(n)}return e}(e,n))):null}const R=/url\((['"]?)([^'"]+?)\1\)/g,_=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,L=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function k(e,t,n,r,o){try{const i=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}(t,n):t,s=g(t);let a;if(o){a=y(await o(i),s)}else a=await x(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function T(e){return-1!==e.search(R)}async function I(e,t,n){if(!T(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(L,(e=>{for(;;){const[n,,r]=_.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(R,((e,n,r)=>(t.push(r),e))),t.filter((e=>!p(e)))}(r);return o.reduce(((e,r)=>e.then((e=>k(e,r,t,n)))),Promise.resolve(r))}async function A(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await I(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function P(e,n){l(e,Element)&&(await async function(e,t){await A("background",e,t)||await A("background-image",e,t),await A("mask",e,t)||await A("-webkit-mask",e,t)||await A("mask-image",e,t)||await A("-webkit-mask-image",e,t)}(e,n),await async function(e,t){const n=l(e,HTMLImageElement);if((!n||p(e.src))&&(!l(e,SVGImageElement)||p(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await x(r,g(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,n),await async function(e,n){const r=t(e.childNodes).map((e=>P(e,n)));await Promise.all(r).then((()=>e))}(e,n))}const N={};async function M(e){let t=N[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},N[e]=t,t}async function H(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),w(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function D(e){if(null==e)return[];const t=[];let n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=o.exec(n);if(null===e){if(e=i.exec(n),null===e)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(e[0])}return t}async function B(e,n){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=t(e.ownerDocument.styleSheets),o=await async function(e,n){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{t(r.cssRules||[]).forEach(((e,t)=>{if(e.type===CSSRule.IMPORT_RULE){let i=t+1;const s=M(e.href).then((e=>H(e,n))).then((e=>D(e).forEach((e=>{try{r.insertRule(e,e.startsWith("@import")?i+=1:r.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})))).catch((e=>{console.error("Error loading remote css",e.toString())}));o.push(s)}}))}catch(t){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(M(r.href).then((e=>H(e,n))).then((e=>D(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",t)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{t(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,n);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>T(e.style.getPropertyValue("src"))))}(o)}function F(e){return e.trim().replace(/["']/g,"")}async function V(e,t){const n=await B(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(F(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(F(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return I(e.cssText,n,t)})))).join("\n")}async function j(e,t={}){const{width:n,height:r}=i(e,t),o=await C(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await V(e,t);if(n){const t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}(o,t),await P(o,t),function(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;null!=r&&Object.keys(r).forEach((e=>{n[e]=r[e]}))}(o,t);return await c(o,n,r)}async function U(e,t={}){const{width:n,height:r}=i(e,t),o=await j(e,t),c=await a(o),l=document.createElement("canvas"),u=l.getContext("2d"),h=t.pixelRatio||function(){let e,t;try{t=process}catch(e){}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,m=t.canvasHeight||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>s||e.height>s)&&(e.width>s&&e.height>s?e.width>e.height?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s):e.width>s?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s))}(l),l.style.width=`${d}`,l.style.height=`${m}`,t.backgroundColor&&(u.fillStyle=t.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.drawImage(c,0,0,l.width,l.height),l}class O{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];o.hideNavigator&&l.push("rm-navigator"),o.hideScrollbar&&l.push("rm-axis-scrollbar"),o.hideZoomButton&&l.push("rm-reset-zoom");let u,h={};switch(h.width=r.width,h.height=r.height,h.canvasWidth=r.width*i,h.canvasHeight=r.height*i,h.filter=e=>{var t;return"none"!==(null===(t=e.style)||void 0===t?void 0:t.display)&&!l.some((t=>{var n;return null===(n=e.classList)||void 0===n?void 0:n.contains(t)}))},h.pixelRatio=1,s){case"png":u=async function(e,t={}){return(await U(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await U(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=j(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class q{export(e,t,n){}$_removeItems(e,t){e.querySelectorAll(t).forEach((e=>{e.remove()}))}$_removeAriaLabelRecursively(e){e.hasAttribute("aria-label")&&e.removeAttribute("aria-label");const t=e.children;for(let e=0;e<t.length;e++)this.$_removeAriaLabelRecursively(t[e])}$_removeHiddenElementsRecursively(e){if("none"===window.getComputedStyle(e).display||"none"===e.style.display)return void e.parentNode.removeChild(e);const t=e.children;for(let e=0;e<t.length;e++)this.$_removeHiddenElementsRecursively(t[e])}}class z extends q{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-export-indicator"),u.style.position="absolute",u.style.width="40px",u.style.height="40px",u.style.top=(s.height+40)/2+"px",u.style.left=(s.width+40)/2+"px";const h=e.cloneNode(!0);e.appendChild(u);const d=()=>{const n=new Image;n.onload=function(){l.drawImage(n,0,0,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.height,0,0,e,r);const h=o.toDataURL(`image/${t.type}`),d=document.createElement("a");d.href=h,d.download=`${i}.${t.type}`,d.click(),u&&u.remove()},h.querySelectorAll("g").forEach((e=>{0===e.childElementCount&&e.remove()})),this.$_removeItems(h,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),o.hideNavigator&&this.$_removeItems(h,".rm-navigator"),o.hideScrollbar&&this.$_removeItems(h,".rm-axis-scrollbar"),o.hideZoomButton&&this.$_removeItems(h,".rm-reset-zoom"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),d=5e4;let m="";if(l.length/d>1)for(let e=0;e<l.length/d;e++)m+=String.fromCharCode.apply(null,l.slice(e*d,(e+1)*d));else m=String.fromCharCode.apply(null,l);try{n.src="data:image/svg+xml;base64,"+btoa(m)}catch(e){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.co.kr/api";fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t.type,size:{width:s.width,height:s.height},dom:h.outerHTML})}).then((e=>e.json())).then((({data:e})=>{n.src=`data:image/png;base64,${e}`})).catch((e=>{u&&u.remove(),console.log("error"),console.error("Error:",e)}))}}))},m=h.style.backgroundImage;if(m&&"none"!==m&&"initial"!==m){const e=null===(r=m.match(/^url\(["']?(.*?)["']?\)$/))||void 0===r?void 0:r[1];if(e){const t=new Image;t.onload=()=>{l.drawImage(t,0,0,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}return t}$_imagesToBase64(e,t){var n;function r(e){return fetch(e).then((e=>e.blob())).then((e=>new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})))).catch((e=>{throw console.error("Error:",e),e}))}const o=[],i=e.style.backgroundImage;if(i&&"none"!==i){const t=null===(n=i.match(/^url\(["']?(.*?)["']?\)$/))||void 0===n?void 0:n[1];if(t){const n=r(t).then((t=>{e.style.backgroundImage=`url(${t})`})).catch((e=>{console.warn("Failed to convert background image to base64",e)}));o.push(n)}}const s=e.querySelectorAll("image, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class W{constructor(e,t,n){this._imageExporter=new z,this._libraryExporter=new O,this._chart=n,this.$_render(e,t)}exportToImage(e,t,n){n&&(n.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,n):this._imageExporter.export(e,t,n))}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.options.exporting||{},o=e.getElementsByClassName("rm-contextmenu-button");for(const e of Array.from(o))e.remove();if(!r.visible)return;this._contextmenuButton&&(this._contextmenuButton.remove(),this._contextmenuButton=null,this._contextmenu=null),n.style.position="relative";const i=this._contextmenuButton=e.createElement("div");i.classList.add("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.menus.forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.fileName};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i,this._chart.options.exporting);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class G{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(G))}static createExporter(e,t,n){return new W(e,t,n)}}G.MODULE_NAME="$$realmap_export";const X=G.use;export{X as RealMapExport};
|
|
7
|
+
const e=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function t(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let n=null;function r(e={}){return n||(e.includeStyleProperties?(n=e.includeStyleProperties,n):(n=t(window.getComputedStyle(document.documentElement)),n))}function o(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function i(e,t={}){return{width:t.width||function(e){const t=o(e,"border-left-width"),n=o(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=o(e,"border-top-width"),n=o(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const s=16384;function a(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function c(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),async function(e){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(e))).then(encodeURIComponent).then((e=>`data:image/svg+xml;charset=utf-8,${e}`))}(o)}const l=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||l(n,t))};function u(e,t,n,o){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return r(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,o);return document.createTextNode(`${i}{${s}}`)}function h(t,n,r,o){const i=window.getComputedStyle(t,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=e();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(u(a,r,i,o)),n.appendChild(c)}const d="application/font-woff",m="image/jpeg",f={woff:d,woff2:d,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:m,jpeg:m,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return f[t]||""}function p(e){return-1!==e.search(/^(data:)/)}function y(e,t){return`data:${t};base64,${e}`}async function w(e,t,n){const r=await fetch(e,t);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onerror=t,i.onloadend=()=>{try{e(n({res:r,result:i.result}))}catch(e){t(e)}},i.readAsDataURL(o)}))}const x={};async function v(e,t,n){const r=function(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}(e,t,n.includeQueryParams);if(null!=x[r])return x[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await w(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=y(r,t)}catch(t){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${e}`;t&&(r="string"==typeof t?t:t.message),r&&console.warn(r)}return x[r]=o,o}async function b(e,t){return l(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):a(t)}(e):l(e,HTMLVideoElement)?async function(e,t){if(e.currentSrc){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),a(t.toDataURL())}const n=e.poster,r=g(n);return a(await v(n,r,t))}(e,t):l(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await C(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode(S(e))}const E=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),S=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function $(e,t,n){return l(t,Element)&&(function(e,t,n){const o=t.style;if(!o)return;const i=window.getComputedStyle(e);i.cssText?(o.cssText=i.cssText,o.transformOrigin=i.transformOrigin):r(n).forEach((n=>{let r=i.getPropertyValue(n);if("font-size"===n&&r.endsWith("px")){const e=Math.floor(parseFloat(r.substring(0,r.length-2)))-.1;r=`${e}px`}l(e,HTMLIFrameElement)&&"display"===n&&"inline"===r&&(r="block"),"d"===n&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){h(e,t,":before",n),h(e,t,":after",n)}(e,t,n),function(e,t){l(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),l(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(l(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function C(e,n,r){return r||!n.filter||n.filter(e)?Promise.resolve(e).then((e=>b(e,n))).then((r=>async function(e,n,r){var o,i;if(S(n))return n;let s=[];return s=E(e)&&e.assignedNodes?t(e.assignedNodes()):l(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?t(e.contentDocument.body.childNodes):t((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||l(e,HTMLVideoElement)||await s.reduce(((e,t)=>e.then((()=>C(t,r))).then((e=>{e&&n.appendChild(e)}))),Promise.resolve()),n}(e,r,n))).then((t=>$(e,t,n))).then((e=>async function(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;const r={};for(let o=0;o<n.length;o++){const i=n[o].getAttribute("xlink:href");if(i){const n=e.querySelector(i),o=document.querySelector(i);n||!o||r[i]||(r[i]=await C(o,t,!0))}}const o=Object.values(r);if(o.length){const t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";const r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<o.length;e++)r.appendChild(o[e]);e.appendChild(n)}return e}(e,n))):null}const R=/url\((['"]?)([^'"]+?)\1\)/g,L=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,_=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function k(e,t,n,r,o){try{const i=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}(t,n):t,s=g(t);let a;if(o){a=y(await o(i),s)}else a=await v(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function T(e){return-1!==e.search(R)}async function A(e,t,n){if(!T(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(_,(e=>{for(;;){const[n,,r]=L.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(R,((e,n,r)=>(t.push(r),e))),t.filter((e=>!p(e)))}(r);return o.reduce(((e,r)=>e.then((e=>k(e,r,t,n)))),Promise.resolve(r))}async function I(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await A(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function P(e,n){l(e,Element)&&(await async function(e,t){await I("background",e,t)||await I("background-image",e,t),await I("mask",e,t)||await I("-webkit-mask",e,t)||await I("mask-image",e,t)||await I("-webkit-mask-image",e,t)}(e,n),await async function(e,t){const n=l(e,HTMLImageElement);if((!n||p(e.src))&&(!l(e,SVGImageElement)||p(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await v(r,g(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,n),await async function(e,n){const r=t(e.childNodes).map((e=>P(e,n)));await Promise.all(r).then((()=>e))}(e,n))}const N={};async function M(e){let t=N[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},N[e]=t,t}async function H(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),w(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function D(e){if(null==e)return[];const t=[];let n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=o.exec(n);if(null===e){if(e=i.exec(n),null===e)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(e[0])}return t}async function F(e,n){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=t(e.ownerDocument.styleSheets),o=await async function(e,n){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{t(r.cssRules||[]).forEach(((e,t)=>{if(e.type===CSSRule.IMPORT_RULE){let i=t+1;const s=M(e.href).then((e=>H(e,n))).then((e=>D(e).forEach((e=>{try{r.insertRule(e,e.startsWith("@import")?i+=1:r.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})))).catch((e=>{console.error("Error loading remote css",e.toString())}));o.push(s)}}))}catch(t){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(M(r.href).then((e=>H(e,n))).then((e=>D(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",t)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{t(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,n);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>T(e.style.getPropertyValue("src"))))}(o)}function V(e){return e.trim().replace(/["']/g,"")}async function j(e,t){const n=await F(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(V(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(V(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return A(e.cssText,n,t)})))).join("\n")}async function B(e,t={}){const{width:n,height:r}=i(e,t),o=await C(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await j(e,t);if(n){const t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}(o,t),await P(o,t),function(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;null!=r&&Object.keys(r).forEach((e=>{n[e]=r[e]}))}(o,t);return await c(o,n,r)}async function U(e,t={}){const{width:n,height:r}=i(e,t),o=await B(e,t),c=await a(o),l=document.createElement("canvas"),u=l.getContext("2d"),h=t.pixelRatio||function(){let e,t;try{t=process}catch(e){}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,m=t.canvasHeight||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>s||e.height>s)&&(e.width>s&&e.height>s?e.width>e.height?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s):e.width>s?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s))}(l),l.style.width=`${d}`,l.style.height=`${m}`,t.backgroundColor&&(u.fillStyle=t.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.drawImage(c,0,0,l.width,l.height),l}class O{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];let u,h={};switch(h.width=r.width,h.height=r.height,h.canvasWidth=r.width*i,h.canvasHeight=r.height*i,h.filter=e=>{var t;return"none"!==(null===(t=e.style)||void 0===t?void 0:t.display)&&!l.some((t=>{var n;return null===(n=e.classList)||void 0===n?void 0:n.contains(t)}))},h.pixelRatio=1,s){case"png":u=async function(e,t={}){return(await U(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await U(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=B(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class q{export(e,t,n){}$_removeItems(e,t){e.querySelectorAll(t).forEach((e=>{e.remove()}))}$_removeAriaLabelRecursively(e){e.hasAttribute("aria-label")&&e.removeAttribute("aria-label");const t=e.children;for(let e=0;e<t.length;e++)this.$_removeAriaLabelRecursively(t[e])}$_removeHiddenElementsRecursively(e){if("none"===window.getComputedStyle(e).display||"none"===e.style.display)return void e.parentNode.removeChild(e);const t=e.children;for(let e=0;e<t.length;e++)this.$_removeHiddenElementsRecursively(t[e])}}class z extends q{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-export-indicator"),u.style.position="absolute",u.style.width="40px",u.style.height="40px",u.style.top=(s.height+40)/2+"px",u.style.left=(s.width+40)/2+"px";const h=e.cloneNode(!0);e.appendChild(u);const d=()=>{const n=new Image;n.onload=function(){l.drawImage(n,0,0,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.height,0,0,e,r);const h=o.toDataURL(`image/${t.type}`),d=document.createElement("a");d.href=h,d.download=`${i}.${t.type}`,d.click(),u&&u.remove()},h.querySelectorAll("g").forEach((e=>{0===e.childElementCount&&e.remove()})),this.$_removeItems(h,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),d=5e4;let m="";if(l.length/d>1)for(let e=0;e<l.length/d;e++)m+=String.fromCharCode.apply(null,l.slice(e*d,(e+1)*d));else m=String.fromCharCode.apply(null,l);try{n.src="data:image/svg+xml;base64,"+btoa(m)}catch(e){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.co.kr/api";fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t.type,size:{width:s.width,height:s.height},dom:h.outerHTML})}).then((e=>e.json())).then((({data:e})=>{n.src=`data:image/png;base64,${e}`})).catch((e=>{u&&u.remove(),console.log("error"),console.error("Error:",e)}))}}))},m=h.style.backgroundImage;if(m&&"none"!==m&&"initial"!==m){const e=null===(r=m.match(/^url\(["']?(.*?)["']?\)$/))||void 0===r?void 0:r[1];if(e){const t=new Image;t.onload=()=>{l.drawImage(t,0,0,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}return t}$_imagesToBase64(e,t){var n;function r(e){return fetch(e).then((e=>e.blob())).then((e=>new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})))).catch((e=>{throw console.error("Error:",e),e}))}const o=[],i=e.style.backgroundImage;if(i&&"none"!==i){const t=null===(n=i.match(/^url\(["']?(.*?)["']?\)$/))||void 0===n?void 0:n[1];if(t){const n=r(t).then((t=>{e.style.backgroundImage=`url(${t})`})).catch((e=>{console.warn("Failed to convert background image to base64",e)}));o.push(n)}}const s=e.querySelectorAll("image, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class W{constructor(e,t,n){this._imageExporter=new z,this._libraryExporter=new O,this._chart=n,this.$_render(e,t)}exportToImage(e,t,n){n&&(n.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,n):this._imageExporter.export(e,t,n))}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.options.exporting||{},o=e.getElementsByClassName("rm-contextmenu-button");for(const e of Array.from(o))e.remove();if(!r.visible)return;this._contextmenuButton&&(this._contextmenuButton.remove(),this._contextmenuButton=null,this._contextmenu=null),n.style.position="relative";const i=this._contextmenuButton=e.createElement("div");i.classList.add("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.menus.forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.fileName};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i,this._chart.options.exporting);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class G{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(G))}static createExporter(e,t,n){return new W(e,t,n)}}G.MODULE_NAME="$$realmap_export";const X=G.use;export{X as RealMapExport};
|
package/feature.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Feature v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Feature v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realmap")):"function"==typeof define&&define.amd?define(["exports","realmap"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealMapfeature={},e.RealMap)}(this,(function(e,t){"use strict";function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=r(t);class s extends t.ValuePoint{_readObject(e,t){super._readObject(e,t),this.value=t.value}}class i extends s{_readObject(e,r){super._readObject(e,r),this.polygon=t.isArray(r.polygon)?r.polygon:[]}}class n extends t.DataPointLabel{}n.defaults=t.extend(t.DataPointLabel.defaults,{visible:!1});class a extends t.ValueSeries{get color(){return this._colorObj}getValueRange(){return{min:this._minValue,max:this._maxValue}}_createLabel(e){return new n(e)}_doApply(e){super._doApply(e)}needMapScale(){return!0}getRangedColor(e){var t;if(!isNaN(e.value)){const r=this._colorRanger||(null===(t=this.chart.getColorScale(this._op.colorScale))||void 0===t?void 0:t.getRanger());return null==r?void 0:r.getColor(this._minValue,this._maxValue,e.value,this._colorObj)}}followTooltipPointer(){return!0}getLegendSources(e,t){return this._points.count>0&&super.getLegendSources(e,t)}_createPoint(e){var t;null!==(t=e.type)&&void 0!==t||this._op.featureType;return new i(e)}_prepareRender(){super._prepareRender()}_doPrepareRender(e,r){super._doPrepareRender(e,r);const o=this._visPoints,{min:s,max:i}=this._calcMinMax(o);if(this._minValue=s,this._maxValue=i,t.isObject(r.colorRange)){const e=t.copyObj(r.colorRange);isNaN(e.minValue)&&(e.minValue=s),isNaN(e.maxValue)&&(e.maxValue=i),this._colorRanger=new t.ColorRanger(e)}else this._colorRanger=null}_doLoadPoints(e){super._doLoadPoints(e)}setCalcedColor(e,r){super.setCalcedColor(e,r),this._colorObj=new t.Color(this._calcedColor),this._color=this._colorObj?this._colorObj.toString():null}getColorScale(){return this._op.colorScale}}a.type=t.FeatureSeriesType,a.defaults=t.extend(t.CoordBaseSeries.defaults,{});const l="rm-feature-series-id-";class u extends t.PointElement{static idClass(e){return l+e.id}static getId(e){for(const t of Array.from(e.classList))if(t.startsWith(l))return t.substring(21)}render(e,t,r){e!==this.model&&(e instanceof i&&this.$_renderArea(e,t),this.model=e),r&&this.dom.classList.add(u.idClass(e))}reset(){}prepare(){this._checkStatic()}$_renderArea(e,t){const r=e.polygon.map((e=>t.project(e)));let o=r.length>0?`M${r[0][0]} ${r[0][1]}`:"";if(r.length>1){const e=[];for(let t=1;t<r.length;t++)e.push(r[t][0],r[t][1]);o+="L "+e.join(" ")+"Z"}this.setPath(o)}}class c extends t.SeriesView{constructor(e){super(e,"rm-feature-series",!0,!1),this._features={},this._featurePool=new t.PointViewPool(this._pointContainer,u)}featureOfDom(e){}needClip(){return!0}_getPointPool(){return this._featurePool}_setModelColor(e){this._pointContainer.setFill(e)}_setPointColor(e,t){e.setFill(t)}_doPrepeare(e,t,r){const o=this._visPoints;this._featurePool.prepare(o.length,((e,r)=>{const s=e.point=o[r];this._setPointStyle(e,t,s),e.internalSetStyle("vectorEffect","non-scaling-stroke"),e.prepare()}))}_doRender(e,t){this.$_layoutFeatures(e,t)}_doReset(){this._featurePool.forEach((e=>{e.visible&&e.reset()}))}_doPointerMoved(e,t,r){return!0}_doPointClicked(e){}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this.$_layoutFeatures(this.width,this.height)}$_layoutFeatures(e,t){const r=this.chart(),o=r.isDirty;r.body;const s=this.model;s.options;const i=r.getProjection(),n=this._features={};s.pointLabel,this._labelViews(),this._scale,this._featurePool.forEach(((e,t)=>{const r=e.point;n[r.id]=e,e.setVisible(!r.isNull)&&e.render(r,i,o)}))}}function d(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(a),e.SeriesView.register([a,c]))}d(o),e.FeatureSeries=a,e.default=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/feature.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Feature v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Feature v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import{extend as e,DataPointLabel as t,FeatureSeriesType as s,CoordBaseSeries as r,ValueSeries as o,isObject as i,copyObj as n,ColorRanger as l,Color as a,isArray as c,ValuePoint as u,SeriesView as d,PointViewPool as h,SeriesAnimation as _,PointElement as p}from"./index.mjs";class g extends u{_readObject(e,t){super._readObject(e,t),this.value=t.value}}class f extends g{_readObject(e,t){super._readObject(e,t),this.polygon=c(t.polygon)?t.polygon:[]}}class m extends t{}m.defaults=e(t.defaults,{visible:!1});class P extends o{get color(){return this._colorObj}getValueRange(){return{min:this._minValue,max:this._maxValue}}_createLabel(e){return new m(e)}_doApply(e){super._doApply(e)}needMapScale(){return!0}getRangedColor(e){var t;if(!isNaN(e.value)){const s=this._colorRanger||(null===(t=this.chart.getColorScale(this._op.colorScale))||void 0===t?void 0:t.getRanger());return null==s?void 0:s.getColor(this._minValue,this._maxValue,e.value,this._colorObj)}}followTooltipPointer(){return!0}getLegendSources(e,t){return this._points.count>0&&super.getLegendSources(e,t)}_createPoint(e){var t;null!==(t=e.type)&&void 0!==t||this._op.featureType;return new f(e)}_prepareRender(){super._prepareRender()}_doPrepareRender(e,t){super._doPrepareRender(e,t);const s=this._visPoints,{min:r,max:o}=this._calcMinMax(s);if(this._minValue=r,this._maxValue=o,i(t.colorRange)){const e=n(t.colorRange);isNaN(e.minValue)&&(e.minValue=r),isNaN(e.maxValue)&&(e.maxValue=o),this._colorRanger=new l(e)}else this._colorRanger=null}_doLoadPoints(e){super._doLoadPoints(e)}setCalcedColor(e,t){super.setCalcedColor(e,t),this._colorObj=new a(this._calcedColor),this._color=this._colorObj?this._colorObj.toString():null}getColorScale(){return this._op.colorScale}}P.type=s,P.defaults=e(r.defaults,{});const C="rm-feature-series-id-";class b extends p{static idClass(e){return C+e.id}static getId(e){for(const t of Array.from(e.classList))if(t.startsWith(C))return t.substring(21)}render(e,t,s){e!==this.model&&(e instanceof f&&this.$_renderArea(e,t),this.model=e),s&&this.dom.classList.add(b.idClass(e))}reset(){}prepare(){this._checkStatic()}$_renderArea(e,t){const s=e.polygon.map((e=>t.project(e)));let r=s.length>0?`M${s[0][0]} ${s[0][1]}`:"";if(s.length>1){const e=[];for(let t=1;t<s.length;t++)e.push(s[t][0],s[t][1]);r+="L "+e.join(" ")+"Z"}this.setPath(r)}}class y extends d{constructor(e){super(e,"rm-feature-series",!0,!1),this._features={},this._featurePool=new h(this._pointContainer,b)}featureOfDom(e){}needClip(){return!0}_getPointPool(){return this._featurePool}_setModelColor(e){this._pointContainer.setFill(e)}_setPointColor(e,t){e.setFill(t)}_doPrepeare(e,t,s){const r=this._visPoints;this._featurePool.prepare(r.length,((e,s)=>{const o=e.point=r[s];this._setPointStyle(e,t,o),e.internalSetStyle("vectorEffect","non-scaling-stroke"),e.prepare()}))}_doRender(e,t){this.$_layoutFeatures(e,t)}_doReset(){this._featurePool.forEach((e=>{e.visible&&e.reset()}))}_doPointerMoved(e,t,s){return!0}_doPointClicked(e){}_runShowEffect(e){e&&_.grow(this)}_doViewRateChanged(e){this.$_layoutFeatures(this.width,this.height)}$_layoutFeatures(e,t){const s=this.chart(),r=s.isDirty;s.body;const o=this.model;o.options;const i=s.getProjection(),n=this._features={};o.pointLabel,this._labelViews(),this._scale,this._featurePool.forEach(((e,t)=>{const s=e.point;n[s.id]=e,e.setVisible(!s.isNull)&&e.render(s,i,r)}))}}function S(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(P),e.SeriesView.register([P,y]))}export{P as FeatureSeries,S as default};
|
package/gl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Gl v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Gl v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realmap")):"function"==typeof define&&define.amd?define(["exports","realmap"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealMapgl={},t.RealMap)}(this,(function(t,e){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var a=r(e);class i extends e.ValuePoint{}class n extends e.ValueSeries{_doApply(t){super._doApply(t)}_createPoint(t){return new i(t)}isPointLabelsVisible(){return!1}_defLabelOff(){return 2}_doPrepareRender(t,e){super._doPrepareRender(t,e),this._hitPoints=void 0}hitTest(t,e){this._hitPoints||!0===this._op.disabled||(console.time("prepare gl hit tests"),this._hitPoints=this._visPoints.slice().sort(((t,e)=>t.glPoint[0]-e.glPoint[0])),console.timeEnd("prepare gl hit tests"));const r=this._hitPoints;if(!r)return;const a=this._getHitRadius(),i=[];let n=0,s=r.length-1,o=-1;for(;n<=s;){const e=Math.floor((n+s)/2),i=r[e];if(t<i.glPoint[0]-a)s=e-1;else{if(!(t>=i.glPoint[0]+a)){o=e;break}n=e+1}}if(-1===o)return i;let l=o;for(;l>=0&&r[l].glPoint[0]-a<=t;)r[l].glPoint[0]+a>t&&i.unshift(r[l]),l--;for(l=o+1;l<r.length&&r[l].glPoint[0]-a<=t;)r[l].glPoint[1]+a>t&&i.push(r[l]),l++;return i.length>0?i.filter((t=>e>=t.glPoint[1]-a&&e<t.glPoint[1]+a)):void 0}}n.defaults=e.extend(e.ValueSeries.defaults,{});class s extends i{_readObject(t,e){super._readObject(t,e)}}class o extends n{getRadius(){return e.pickNum(this._op.radius,o.defaults.radius)}_doApply(t){super._doApply(t)}_createPoint(t){return new s(t)}_defLabelOff(){return 2}_getHitRadius(){return this.getRadius()}}o.type=e.GLPointSeriesType,o.defaults=e.extend(n.defaults,{radius:5,position:"center"});const l=Array.isArray,c=Math.min,f=Math.max,h=Math.abs,u=function(t,e){return t=parseFloat(t),isNaN(t)?parseFloat(e):t};let d=0;class g{$_hash;$_destroyed=!1;$_destroying=!1;constructor(t){t||(this.$_hash=String(d++))}destroy(){return!this.$_destroyed&&!this.$_destroying&&(this.$_destroying=!0,this._doDestory(),this.$_destroyed=!0),null}_doDestory(){}get destroying(){return this.$_destroying}get orphaned(){return this.$_destroying||this.$_destroyed}get hash(){return this.$_hash}isMe(t){return t===this.$_hash}toString(){return this.constructor.name}toBool(t){return"string"==typeof t?"true"===t:t}toNum(t,e=NaN){return t=parseFloat(t),isNaN(t)?e:t}}class p extends g{_width;_height;_mat;_gl;_program;constructor(t){super(),this._gl=t._gl}_doDestory(){if(this._program){const t=this._gl;t.getAttachedShaders(this._program).forEach((e=>t.deleteShader(e))),t.deleteProgram(this._program),this._program=null}}_run(t,e,r,a){this._program||(this._program=this.$_createProgram(this._gl,this._getVShader(),this._getFShader())),(r!==this._width||a!==this._height)&&(this.$_useProgram(this._gl,this._program),this._width=r,this._height=a,this._mat=this.$_createMatrix(0,0,r,a),t.viewport(0,0,r,a),t.uniformMatrix4fv(t.getUniformLocation(this._program,"u_matrix"),!1,this._mat)),t.bindBuffer(t.ARRAY_BUFFER,e),this._doRun(t,e,r,a)}$_createShader(t,e,r){const a=t.createShader(e);if(!a)throw new Error("Failed to create a shader");if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(a);throw t.deleteShader(a),new Error(`Shader compilation failed:\n${r.split("\n").map(((t,e)=>`${e+1}: ${t}`)).join("\n")}\n\n${e}`)}return a}$_createProgram(t,e,r){const a=this.$_createShader(t,t.VERTEX_SHADER,e),i=this.$_createShader(t,t.FRAGMENT_SHADER,r),n=t.createProgram();if(!n)throw new Error("Failed to create a program");if(t.attachShader(n,a),t.attachShader(n,i),t.linkProgram(n),!t.getProgramParameter(n,t.LINK_STATUS))throw t.getShaderInfoLog(n),t.deleteProgram(n),new Error(t.getProgramInfoLog(n));return n}$_useProgram(t,e){t.useProgram(e)}$_createMatrix(t,e,r,a){return new Float32Array([2/(r-t),0,0,0,0,2/(e-a),0,0,0,0,1,0,-(r+t)/(r-t),-(e+a)/(e-a),0,1])}_drawTrianlges(t,e){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(t.TRIANGLES,0,e.length/2)}_drawPoints(t,e,r){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(t.POINTS,0,e.length/r)}_drawLines(t,e,r,a){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(a?t.LINE_LOOP:t.LINES,0,e.length/r)}}class _ extends g{_gl;_buffer;_programs;constructor(t){super();const e=this._gl=t.getContext("webgl");if(!e)throw new Error("WebGL not supported");this._buffer=e.createBuffer()}_doDestory(){const t=this._gl;t&&(t.deleteBuffer(this._buffer),this._programs.forEach((t=>t.destroy())),this._gl=null)}render(t,e=!0,r,a){const i=this._gl;console.time("gl_render"),e&&this.$_clear(),t.forEach((t=>t._run(i,this._buffer,u(r,i.canvas.width),u(a,i.canvas.height)))),console.timeEnd("gl_render")}$_clear(){const t=this._gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)}}const m=(new Date).getTime();typeof window<"u"&&!Element.prototype.animate&&(Element.prototype.animate=function(t){});const b=typeof navigator<"u"?navigator.userAgent:"",y=b?navigator.appVersion:"";b.match(/Trident.*rv\:11\./),y.indexOf("MSIE 10"),y.indexOf("MSIE 9");class w{static LOGGING=!1;static log(...t){this.LOGGING&&console.log(...t)}static logIf(t,...e){this.LOGGING&&t&&console.log(...e)}static week_days=["일","월","화","수","목","금","토"];static long_week_days=["일요일","월요일","화요일","수요일","목요일","금요일","토요일"];static month_days=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]];static now(){return+new Date}static parseDate(t,e){const r=new Date(t);return isNaN(r.getTime())?e||new Date:r}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static dateOfYear(t){var e=t.getMonth(),r=t.getDate(),a=[0,31,59,90,120,151,181,212,243,273,304,334][e]+r;return e>1&&w.isLeapYear(t.getFullYear())&&a++,a}static incMonth(t,e){const r=t.getDate();return t.setDate(1),t.setMonth(t.getMonth()+e),t.setDate(c(r,w.month_days[w.isLeapYear(t.getFullYear())?1:0][t.getMonth()])),t}static minDate(t,e){return null!==t?t:null!==e?e:t.getTime()<e.getTime()?t:e}static maxDate(t,e){return null!==t?e:null!==e||t.getTime()>e.getTime()?t:e}static weekOfMonth(t,e,r){const a=t.getMonth(),i=t.getFullYear(),n=new Date(i,a,1).getDay(),s=new Date(i,a+1,0).getDate(),o=t.getDate()+n-1,l=e+Math.ceil((s+n-7)/7),c=e+Math.floor(o/7);return r||c<2+e?c:c===l?e+5:c}static weekOfYear(t,e){const r=t.getFullYear(),a=new Date(r,0,1).getDay(),i=this.dateOfYear(t)+a-1;return e+Math.floor(i/7)}static isObject(t){return t&&"object"==typeof t&&!l(t)}static isValidObject(t){if(this.isObject(t))for(let e in t)if(t.hasOwnProperty(e))return!0}static checkArray(t){return l(t)?t:void 0}static makeArray(t,e=!1){return null!=t?l(t)?t:[t]:e?[]:void 0}static makeNumArray(t){return l(t)?t.map((t=>+t)):null!=t?[+t]:[]}static getIntArray(t,e=0){const r=[];for(let a=e,i=e+t;a<i;a++)r.push(a);return r}static isValueArray(t){if(l(t)){for(let e=t.length-1;e>=0;e--)if(null!=t[e]&&"object"==typeof t[e])return!1;return!0}return!1}static toArray(t){return l(t)?t:null!=t?[t]:null}static copyArray(t){return l(t)?t.slice(0):null!=t?[t]:void 0}static push(t,e){if(e&&e.length>0)for(let r=0,a=e.length;r<a;r++)t.push(e[r])}static isDefined(t){return null!=t}static isNotDefined(t){return null==t}static isNum(t){return"number"==typeof t}static canNumber(t){return!isNaN(t)&&!isNaN(parseFloat(t))}static isValidNum(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}static getNum(t,e=0){const r=parseFloat(t);return isFinite(r)?r:e}static toNum(t,e=0){return isNaN(t)||null===t||""===t?e:+t}static compareText(t,e,r=!1){return t=t||"",e=e||"",r&&(t=t.toLocaleLowerCase(),e=e.toLocaleLowerCase()),t>e?1:t<e?-1:0}static getTimeF(){return(new Date).getTime()/1e3}static getTimer(){return(new Date).getTime()-m}static isWhiteSpace(t){return!t||!t.trim()}static pad(t,e,r){return e=f(e||2,1),r=r||"0",new Array(e-String(t).length+1).join(r)+t}static pad16(t,e,r){return e=f(e||2,1),r=r||"0",new Array(e-t.toString(16).length+1).join(r)+t.toString(16)}static pick(...t){const e=t.length;let r;for(let a=0;a<e;a++)if(r=t[a],null!=r)return r}static toStr(t){return Number.isNaN(t)||null==t?"":String(t)}static extend(t,e){t=t||{};for(let r in e)t[r]=e[r];return t}static equalNumbers(t,e){return isNaN(t)==isNaN(e)&&!isNaN(t)&&t==e}static equalArrays(t,e){if(t===e)return!0;if(null==t||null==e)return!1;const r=t.length;if(r!=e.length)return!1;for(let a=0;a<r;++a)if(t[a]!==e[a])return!1;return!0}static isEmpty(t){if(t)for(let e in t)return!1;return!0}static isNotEmpty(t){if(t)for(let e in t)return!0;return!1}static deepClone(t){if(t instanceof Date)return new Date(t);if(null==t||"object"!=typeof t)return t;{const e=l(t)?[]:{};for(let r of Object.keys(t))e[r]=w.deepClone(t[r]);return e}}static getArray(t,e){const r=[];for(let a=0;a<t;a++)r.push(e);return r}static getNumArray(t,e=0){const r=[];for(let a=0;a<t;a++)r.push(e);return r}static dedupe(t,e){t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0));for(let e=t.length-1;e>0;e--)t[e]===t[e-1]&&t.splice(e,1);return t}static sortNum(t){return t.sort(((t,e)=>t-e))}static logElapsed(t,e){const r=+new Date;e(),w.log(t,+new Date-r+"ms")}static clamp(t,e,r){return f(e,c(r,t))}static clampEx(t,e,r){return isNaN(e)||(t=f(e,t)),isNaN(r)||(t=c(r,t)),t}static makeIntArray(t,e){const r=new Array(f(0,e-t));for(let a=t;a<e;a++)r[a-t]=a;return r}static shuffle(t){for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static isValidDate(t){return t.getTime()==t.getTime()}static asFunction(t){return"function"==typeof t?t:void 0}static getFieldProp(t){const e=t.indexOf(".");if(e>=0)return{field:t.substring(0,e),props:t.substring(e+1).split(".")}}static uniqueKey(){return Math.random().toString(36).substring(2,10)}static startsWith(t,e){if(t&&e)return 0===t.indexOf(e)}static endsWith(t,e){if(t&&e)return t.indexOf(e,-t.length)===t.length-e.length}static scaleNumber(t,e,r){const a=h(t);if(a>=1e3){let i=e.length;for(;i>0;){const n=Math.pow(1e3,i--);if(n<=Math.pow(10,Math.log(a)*Math.LOG10E)&&(r||10*a%n==0))return{value:t/n,symbol:e[i]}}}}static jitter(t,e){return t+(2*Math.random()-1)*e}static getLogger(t){if(t>=2)return function(e){return Math.log(e)/Math.log(t)}}static getMinMax(t){let e=t[0],r=t[0];for(let a=1;a<t.length;a++)e=c(e,t[a]),r=f(r,t[a]);return{min:e,max:r}}static valueAt(t,e){if(e&&(this.isObject(t)||l(t))){const r=e.split(".");let a=t;for(let t of r)a=a[t];return a}return t}static normalizeToSteps(t,e){if(t.length<2)return t;const r=Math.min(...t),a=Math.max(...t);if(r===a)return[r];const i=(a-r)/(e-1),n=10**Math.floor(Math.log10(i)),s=i/n;let o;o=s<=1?1:s<=2?2:s<=5?5:10,o*=n;const l=Math.floor(r/o)*o,c=[];o=(Math.ceil(a/o)*o-l)/(e-1);for(let t=0;t<e;t++)c.push(l+t*o);return c}}const A=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],P=["f0f8ff","faebd7","00ffff","7fffd4","f0ffff","f5f5dc","ffe4c4","000000","ffebcd","0000ff","8a2be2","a52a2a","deb887","5f9ea0","7fff00","d2691e","ff7f50","6495ed","fff8dc","dc143c","00ffff","00008b","008b8b","b8860b","a9a9a9","a9a9a9","006400","bdb76b","8b008b","556b2f","ff8c00","9932cc","8b0000","e9967a","8fbc8f","483d8b","2f4f4f","2f4f4f","00ced1","9400d3","ff1493","00bfff","696969","696969","1e90ff","b22222","fffaf0","228b22","ff00ff","dcdcdc","f8f8ff","ffd700","daa520","808080","808080","008000","adff2f","f0fff0","ff69b4","cd5c5c","4b0082","fffff0","f0e68c","e6e6fa","fff0f5","7cfc00","fffacd","add8e6","f08080","e0ffff","fafad2","d3d3d3","d3d3d3","90ee90","ffb6c1","ffa07a","20b2aa","87cefa","778899","778899","b0c4de","ffffe0","00ff00","32cd32","faf0e6","ff00ff","800000","66cdaa","0000cd","ba55d3","9370db","3cb371","7b68ee","00fa9a","48d1cc","c71585","191970","f5fffa","ffe4e1","ffe4b5","ffdead","000080","fdf5e6","808000","6b8e23","ffa500","ff4500","da70d6","eee8aa","98fb98","afeeee","db7093","ffefd5","ffdab9","cd853f","ffc0cb","dda0dd","b0e0e6","800080","663399","ff0000","bc8f8f","4169e1","8b4513","fa8072","f4a460","2e8b57","fff5ee","a0522d","c0c0c0","87ceeb","6a5acd","708090","708090","fffafa","00ff7f","4682b4","d2b48c","008080","d8bfd8","ff6347","40e0d0","ee82ee","f5deb3","ffffff","f5f5f5","ffff00","9acd32"];class S{static COLORS=function(){const t={};for(let e=0;e<A.length;e++)t[A[e]]=P[e];return t}();static create(t){return"string"==typeof t?new S(t):void 0}static isBright(t){return new S(t).isBright()}static getContrast(t,e,r){return new S(t).getContrast(e,r)}static interpolate(t,e,r){const a=new S(null);return a.r=Math.ceil(t.r+(e.r-t.r)*r),a.g=Math.ceil(t.g+(e.g-t.g)*r),a.b=Math.ceil(t.b+(e.b-t.b)*r),a.a=t.a+(e.a-t.a)*r,a}r=0;g=0;b=0;a=1;constructor(t){(t=t&&t.trim())&&(w.startsWith(t,"rgb(")&&w.endsWith(t,")")?this.$_parseRgb(t.substring(4,t.length-1)):w.startsWith(t,"rgba(")&&w.endsWith(t,")")?this.$_parseRgb(t.substring(5,t.length-1)):w.startsWith(t,"#")?this.$_parseNumber(t.substring(1)):S.COLORS[t]&&this.$_parseNumber(S.COLORS[t]))}get rgba(){return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}isBright(){return.299*this.r+.587*this.g+.114*this.b>140}getContrast(t,e){return this.isBright()?t||"#000000":e||"#FFFFFF"}brighten(t,e=null){return(e=e||new S(null)).r=Math.ceil(this.r+(255-this.r)*t),e.g=Math.ceil(this.g+(255-this.g)*t),e.b=Math.ceil(this.b+(255-this.b)*t),e.a=this.a,e}toString(){return this.rgba}$_parseRgb(t){const e=t.split(/\,\s*/);e.length>=3&&(this.r=+e[0],this.g=+e[1],this.b=+e[2],e.length>=4?this.a=+e[3]:this.a=1)}$_parseNumber(t){const e=t.length;let r;e>6?(r=parseInt(t.substr(0,6),16),this.a=parseInt(t.substring(6),16)/255):e>0&&(3===e&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),r=parseInt(t,16)),this.r=(16711680&r)>>16,this.g=(65280&r)>>8,this.b=255&r}}class v extends p{_points;_radius;_color;constructor(t){super(t)}setOptions(t){const e=this._points=[];this._radius=Math.max(1,u(+t.radius,3)),this._color=new S(t.color||"black");const r=this._color.r/255,a=this._color.g/255,i=this._color.b/255,n=this._color.a;return t.points.forEach((t=>{t.color?S.create(t.color):this._color,e.push(t.x,t.y,r,a,i,n)})),this}_getVShader(){return"\n uniform mat4 u_matrix;\n uniform float u_radius;\n attribute vec2 a_position;\n attribute vec4 a_color;\n varying vec4 v_color;\n\n void main() {\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n gl_PointSize = u_radius; // 픽셀 단위 점 크기\n v_color = a_color;\n }\n "}_getFShader(){return"\n precision mediump float;\n\n varying vec4 v_color;\n\n void main() {\n gl_FragColor = v_color;\n }\n "}_doRun(t,e,r,a){const i=t.getUniformLocation(this._program,"u_radius"),n=t.getAttribLocation(this._program,"a_position"),s=t.getAttribLocation(this._program,"a_color");t.uniform1f(i,2*this._radius),t.vertexAttribPointer(n,2,t.FLOAT,!1,24,0),t.enableVertexAttribArray(n),t.vertexAttribPointer(s,4,t.FLOAT,!1,24,8),t.enableVertexAttribArray(s),this._drawPoints(t,this._points,6)}}class N extends e.PointElement{setPoint(t){return this.point=t,this}}class M extends e.SeriesView{constructor(t,r,a,i){super(t,r,a,i);const n=e.RmElement.createElement(t,"foreignObject");this._pointContainer.add(this._pointView=this._createPointView(t)),this._pointContainer.appendDom(n),n.appendChild(this._canvas=t.createElement("canvas")),this._gl=new _(this._canvas)}getPointView(t,e,r,a){return this.$_pointViewAt(e,r)}render(t,e,r){const a=this._canvas,i=a.parentNode;i.setAttribute("width",t),i.setAttribute("height",e),a.width=t,a.height=e,a.style.width=t+"px",a.style.height=e+"px",super.render(t,e,r),this.trans(0,0)}pointByDom(t,e){return this.$_pointViewAt(e.x,e.y)}_mapToGL(t,e){const{tx:r,ty:a,scale:i,vx:n,vy:s}=this._transInfo;e.forEach((e=>{const n=e.glPoint=t.project([e.lon,e.lat]);n[0]=n[0]*i+r,n[1]=a-n[1]*i}))}$_pointViewAt(t,e){const r=this.model.hitTest(t,e);if(r)return this._pointView.setPoint(r[0])}_drawCircle(t,e,r,a,i){const n=this._ctx;n.beginPath(),n.arc(t,e,r,0,2*Math.PI),n.strokeStyle=a,n.lineWidth=1,n.stroke(),n.beginPath(),n.arc(t,e,r,0,2*Math.PI),n.fillStyle=i,n.fill()}}class k extends N{}class x extends M{constructor(t){super(t,"rm-gl-point-series",!0,!1),this._program=new v(this._gl)}_createPointView(t){return new k(t)}_doPrepeare(t,e,r){}_doRender(t,e){this.$_layoutMarkers(this._getGrowRate())}_doReset(){}$_layoutMarkers(t){const e=this.model,r=e.chart.getProjection(),a=Math.max(0,e.getRadius()),i=e._visPoints,n=new Array(i.length);this._mapToGL(r,i),i.forEach(((t,e)=>{n[e]={x:t.glPoint[0],y:t.glPoint[1]}})),this._program.setOptions({radius:a,points:n,color:String(e.options.color)||"black"}),this._gl.render([this._program])}}function O(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(o),t.SeriesView.register([o,x]))}O(a),t.GlSeries=n,t.default=O,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/gl.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Gl v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Gl v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import{extend as t,ValueSeries as e,ValuePoint as r,GLPointSeriesType as a,pickNum as i,SeriesView as s,RmElement as n,PointElement as o}from"./index.mjs";class l extends r{}class c extends e{_doApply(t){super._doApply(t)}_createPoint(t){return new l(t)}isPointLabelsVisible(){return!1}_defLabelOff(){return 2}_doPrepareRender(t,e){super._doPrepareRender(t,e),this._hitPoints=void 0}hitTest(t,e){this._hitPoints||!0===this._op.disabled||(console.time("prepare gl hit tests"),this._hitPoints=this._visPoints.slice().sort(((t,e)=>t.glPoint[0]-e.glPoint[0])),console.timeEnd("prepare gl hit tests"));const r=this._hitPoints;if(!r)return;const a=this._getHitRadius(),i=[];let s=0,n=r.length-1,o=-1;for(;s<=n;){const e=Math.floor((s+n)/2),i=r[e];if(t<i.glPoint[0]-a)n=e-1;else{if(!(t>=i.glPoint[0]+a)){o=e;break}s=e+1}}if(-1===o)return i;let l=o;for(;l>=0&&r[l].glPoint[0]-a<=t;)r[l].glPoint[0]+a>t&&i.unshift(r[l]),l--;for(l=o+1;l<r.length&&r[l].glPoint[0]-a<=t;)r[l].glPoint[1]+a>t&&i.push(r[l]),l++;return i.length>0?i.filter((t=>e>=t.glPoint[1]-a&&e<t.glPoint[1]+a)):void 0}}c.defaults=t(e.defaults,{});class h extends l{_readObject(t,e){super._readObject(t,e)}}class f extends c{getRadius(){return i(this._op.radius,f.defaults.radius)}_doApply(t){super._doApply(t)}_createPoint(t){return new h(t)}_defLabelOff(){return 2}_getHitRadius(){return this.getRadius()}}f.type=a,f.defaults=t(c.defaults,{radius:5,position:"center"});const u=Array.isArray,d=Math.min,g=Math.max,_=Math.abs,p=function(t,e){return t=parseFloat(t),isNaN(t)?parseFloat(e):t};let m=0;class b{$_hash;$_destroyed=!1;$_destroying=!1;constructor(t){t||(this.$_hash=String(m++))}destroy(){return!this.$_destroyed&&!this.$_destroying&&(this.$_destroying=!0,this._doDestory(),this.$_destroyed=!0),null}_doDestory(){}get destroying(){return this.$_destroying}get orphaned(){return this.$_destroying||this.$_destroyed}get hash(){return this.$_hash}isMe(t){return t===this.$_hash}toString(){return this.constructor.name}toBool(t){return"string"==typeof t?"true"===t:t}toNum(t,e=NaN){return t=parseFloat(t),isNaN(t)?e:t}}class y extends b{_width;_height;_mat;_gl;_program;constructor(t){super(),this._gl=t._gl}_doDestory(){if(this._program){const t=this._gl;t.getAttachedShaders(this._program).forEach((e=>t.deleteShader(e))),t.deleteProgram(this._program),this._program=null}}_run(t,e,r,a){this._program||(this._program=this.$_createProgram(this._gl,this._getVShader(),this._getFShader())),(r!==this._width||a!==this._height)&&(this.$_useProgram(this._gl,this._program),this._width=r,this._height=a,this._mat=this.$_createMatrix(0,0,r,a),t.viewport(0,0,r,a),t.uniformMatrix4fv(t.getUniformLocation(this._program,"u_matrix"),!1,this._mat)),t.bindBuffer(t.ARRAY_BUFFER,e),this._doRun(t,e,r,a)}$_createShader(t,e,r){const a=t.createShader(e);if(!a)throw new Error("Failed to create a shader");if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS)){const e=t.getShaderInfoLog(a);throw t.deleteShader(a),new Error(`Shader compilation failed:\n${r.split("\n").map(((t,e)=>`${e+1}: ${t}`)).join("\n")}\n\n${e}`)}return a}$_createProgram(t,e,r){const a=this.$_createShader(t,t.VERTEX_SHADER,e),i=this.$_createShader(t,t.FRAGMENT_SHADER,r),s=t.createProgram();if(!s)throw new Error("Failed to create a program");if(t.attachShader(s,a),t.attachShader(s,i),t.linkProgram(s),!t.getProgramParameter(s,t.LINK_STATUS))throw t.getShaderInfoLog(s),t.deleteProgram(s),new Error(t.getProgramInfoLog(s));return s}$_useProgram(t,e){t.useProgram(e)}$_createMatrix(t,e,r,a){return new Float32Array([2/(r-t),0,0,0,0,2/(e-a),0,0,0,0,1,0,-(r+t)/(r-t),-(e+a)/(e-a),0,1])}_drawTrianlges(t,e){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(t.TRIANGLES,0,e.length/2)}_drawPoints(t,e,r){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(t.POINTS,0,e.length/r)}_drawLines(t,e,r,a){t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),t.drawArrays(a?t.LINE_LOOP:t.LINES,0,e.length/r)}}class w extends b{_gl;_buffer;_programs;constructor(t){super();const e=this._gl=t.getContext("webgl");if(!e)throw new Error("WebGL not supported");this._buffer=e.createBuffer()}_doDestory(){const t=this._gl;t&&(t.deleteBuffer(this._buffer),this._programs.forEach((t=>t.destroy())),this._gl=null)}render(t,e=!0,r,a){const i=this._gl;console.time("gl_render"),e&&this.$_clear(),t.forEach((t=>t._run(i,this._buffer,p(r,i.canvas.width),p(a,i.canvas.height)))),console.timeEnd("gl_render")}$_clear(){const t=this._gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)}}const A=(new Date).getTime();typeof window<"u"&&!Element.prototype.animate&&(Element.prototype.animate=function(t){});const P=typeof navigator<"u"?navigator.userAgent:"",S=P?navigator.appVersion:"";P.match(/Trident.*rv\:11\./),S.indexOf("MSIE 10"),S.indexOf("MSIE 9");class v{static LOGGING=!1;static log(...t){this.LOGGING&&console.log(...t)}static logIf(t,...e){this.LOGGING&&t&&console.log(...e)}static week_days=["일","월","화","수","목","금","토"];static long_week_days=["일요일","월요일","화요일","수요일","목요일","금요일","토요일"];static month_days=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]];static now(){return+new Date}static parseDate(t,e){const r=new Date(t);return isNaN(r.getTime())?e||new Date:r}static isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}static dateOfYear(t){var e=t.getMonth(),r=t.getDate(),a=[0,31,59,90,120,151,181,212,243,273,304,334][e]+r;return e>1&&v.isLeapYear(t.getFullYear())&&a++,a}static incMonth(t,e){const r=t.getDate();return t.setDate(1),t.setMonth(t.getMonth()+e),t.setDate(d(r,v.month_days[v.isLeapYear(t.getFullYear())?1:0][t.getMonth()])),t}static minDate(t,e){return null!==t?t:null!==e?e:t.getTime()<e.getTime()?t:e}static maxDate(t,e){return null!==t?e:null!==e||t.getTime()>e.getTime()?t:e}static weekOfMonth(t,e,r){const a=t.getMonth(),i=t.getFullYear(),s=new Date(i,a,1).getDay(),n=new Date(i,a+1,0).getDate(),o=t.getDate()+s-1,l=e+Math.ceil((n+s-7)/7),c=e+Math.floor(o/7);return r||c<2+e?c:c===l?e+5:c}static weekOfYear(t,e){const r=t.getFullYear(),a=new Date(r,0,1).getDay(),i=this.dateOfYear(t)+a-1;return e+Math.floor(i/7)}static isObject(t){return t&&"object"==typeof t&&!u(t)}static isValidObject(t){if(this.isObject(t))for(let e in t)if(t.hasOwnProperty(e))return!0}static checkArray(t){return u(t)?t:void 0}static makeArray(t,e=!1){return null!=t?u(t)?t:[t]:e?[]:void 0}static makeNumArray(t){return u(t)?t.map((t=>+t)):null!=t?[+t]:[]}static getIntArray(t,e=0){const r=[];for(let a=e,i=e+t;a<i;a++)r.push(a);return r}static isValueArray(t){if(u(t)){for(let e=t.length-1;e>=0;e--)if(null!=t[e]&&"object"==typeof t[e])return!1;return!0}return!1}static toArray(t){return u(t)?t:null!=t?[t]:null}static copyArray(t){return u(t)?t.slice(0):null!=t?[t]:void 0}static push(t,e){if(e&&e.length>0)for(let r=0,a=e.length;r<a;r++)t.push(e[r])}static isDefined(t){return null!=t}static isNotDefined(t){return null==t}static isNum(t){return"number"==typeof t}static canNumber(t){return!isNaN(t)&&!isNaN(parseFloat(t))}static isValidNum(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}static getNum(t,e=0){const r=parseFloat(t);return isFinite(r)?r:e}static toNum(t,e=0){return isNaN(t)||null===t||""===t?e:+t}static compareText(t,e,r=!1){return t=t||"",e=e||"",r&&(t=t.toLocaleLowerCase(),e=e.toLocaleLowerCase()),t>e?1:t<e?-1:0}static getTimeF(){return(new Date).getTime()/1e3}static getTimer(){return(new Date).getTime()-A}static isWhiteSpace(t){return!t||!t.trim()}static pad(t,e,r){return e=g(e||2,1),r=r||"0",new Array(e-String(t).length+1).join(r)+t}static pad16(t,e,r){return e=g(e||2,1),r=r||"0",new Array(e-t.toString(16).length+1).join(r)+t.toString(16)}static pick(...t){const e=t.length;let r;for(let a=0;a<e;a++)if(r=t[a],null!=r)return r}static toStr(t){return Number.isNaN(t)||null==t?"":String(t)}static extend(t,e){t=t||{};for(let r in e)t[r]=e[r];return t}static equalNumbers(t,e){return isNaN(t)==isNaN(e)&&!isNaN(t)&&t==e}static equalArrays(t,e){if(t===e)return!0;if(null==t||null==e)return!1;const r=t.length;if(r!=e.length)return!1;for(let a=0;a<r;++a)if(t[a]!==e[a])return!1;return!0}static isEmpty(t){if(t)for(let e in t)return!1;return!0}static isNotEmpty(t){if(t)for(let e in t)return!0;return!1}static deepClone(t){if(t instanceof Date)return new Date(t);if(null==t||"object"!=typeof t)return t;{const e=u(t)?[]:{};for(let r of Object.keys(t))e[r]=v.deepClone(t[r]);return e}}static getArray(t,e){const r=[];for(let a=0;a<t;a++)r.push(e);return r}static getNumArray(t,e=0){const r=[];for(let a=0;a<t;a++)r.push(e);return r}static dedupe(t,e){t=t.sort(e||((t,e)=>t>e?1:t<e?-1:0));for(let e=t.length-1;e>0;e--)t[e]===t[e-1]&&t.splice(e,1);return t}static sortNum(t){return t.sort(((t,e)=>t-e))}static logElapsed(t,e){const r=+new Date;e(),v.log(t,+new Date-r+"ms")}static clamp(t,e,r){return g(e,d(r,t))}static clampEx(t,e,r){return isNaN(e)||(t=g(e,t)),isNaN(r)||(t=d(r,t)),t}static makeIntArray(t,e){const r=new Array(g(0,e-t));for(let a=t;a<e;a++)r[a-t]=a;return r}static shuffle(t){for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}}static isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}static isValidDate(t){return t.getTime()==t.getTime()}static asFunction(t){return"function"==typeof t?t:void 0}static getFieldProp(t){const e=t.indexOf(".");if(e>=0)return{field:t.substring(0,e),props:t.substring(e+1).split(".")}}static uniqueKey(){return Math.random().toString(36).substring(2,10)}static startsWith(t,e){if(t&&e)return 0===t.indexOf(e)}static endsWith(t,e){if(t&&e)return t.indexOf(e,-t.length)===t.length-e.length}static scaleNumber(t,e,r){const a=_(t);if(a>=1e3){let i=e.length;for(;i>0;){const s=Math.pow(1e3,i--);if(s<=Math.pow(10,Math.log(a)*Math.LOG10E)&&(r||10*a%s==0))return{value:t/s,symbol:e[i]}}}}static jitter(t,e){return t+(2*Math.random()-1)*e}static getLogger(t){if(t>=2)return function(e){return Math.log(e)/Math.log(t)}}static getMinMax(t){let e=t[0],r=t[0];for(let a=1;a<t.length;a++)e=d(e,t[a]),r=g(r,t[a]);return{min:e,max:r}}static valueAt(t,e){if(e&&(this.isObject(t)||u(t))){const r=e.split(".");let a=t;for(let t of r)a=a[t];return a}return t}static normalizeToSteps(t,e){if(t.length<2)return t;const r=Math.min(...t),a=Math.max(...t);if(r===a)return[r];const i=(a-r)/(e-1),s=10**Math.floor(Math.log10(i)),n=i/s;let o;o=n<=1?1:n<=2?2:n<=5?5:10,o*=s;const l=Math.floor(r/o)*o,c=[];o=(Math.ceil(a/o)*o-l)/(e-1);for(let t=0;t<e;t++)c.push(l+t*o);return c}}const N=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=["f0f8ff","faebd7","00ffff","7fffd4","f0ffff","f5f5dc","ffe4c4","000000","ffebcd","0000ff","8a2be2","a52a2a","deb887","5f9ea0","7fff00","d2691e","ff7f50","6495ed","fff8dc","dc143c","00ffff","00008b","008b8b","b8860b","a9a9a9","a9a9a9","006400","bdb76b","8b008b","556b2f","ff8c00","9932cc","8b0000","e9967a","8fbc8f","483d8b","2f4f4f","2f4f4f","00ced1","9400d3","ff1493","00bfff","696969","696969","1e90ff","b22222","fffaf0","228b22","ff00ff","dcdcdc","f8f8ff","ffd700","daa520","808080","808080","008000","adff2f","f0fff0","ff69b4","cd5c5c","4b0082","fffff0","f0e68c","e6e6fa","fff0f5","7cfc00","fffacd","add8e6","f08080","e0ffff","fafad2","d3d3d3","d3d3d3","90ee90","ffb6c1","ffa07a","20b2aa","87cefa","778899","778899","b0c4de","ffffe0","00ff00","32cd32","faf0e6","ff00ff","800000","66cdaa","0000cd","ba55d3","9370db","3cb371","7b68ee","00fa9a","48d1cc","c71585","191970","f5fffa","ffe4e1","ffe4b5","ffdead","000080","fdf5e6","808000","6b8e23","ffa500","ff4500","da70d6","eee8aa","98fb98","afeeee","db7093","ffefd5","ffdab9","cd853f","ffc0cb","dda0dd","b0e0e6","800080","663399","ff0000","bc8f8f","4169e1","8b4513","fa8072","f4a460","2e8b57","fff5ee","a0522d","c0c0c0","87ceeb","6a5acd","708090","708090","fffafa","00ff7f","4682b4","d2b48c","008080","d8bfd8","ff6347","40e0d0","ee82ee","f5deb3","ffffff","f5f5f5","ffff00","9acd32"];class M{static COLORS=function(){const t={};for(let e=0;e<N.length;e++)t[N[e]]=k[e];return t}();static create(t){return"string"==typeof t?new M(t):void 0}static isBright(t){return new M(t).isBright()}static getContrast(t,e,r){return new M(t).getContrast(e,r)}static interpolate(t,e,r){const a=new M(null);return a.r=Math.ceil(t.r+(e.r-t.r)*r),a.g=Math.ceil(t.g+(e.g-t.g)*r),a.b=Math.ceil(t.b+(e.b-t.b)*r),a.a=t.a+(e.a-t.a)*r,a}r=0;g=0;b=0;a=1;constructor(t){(t=t&&t.trim())&&(v.startsWith(t,"rgb(")&&v.endsWith(t,")")?this.$_parseRgb(t.substring(4,t.length-1)):v.startsWith(t,"rgba(")&&v.endsWith(t,")")?this.$_parseRgb(t.substring(5,t.length-1)):v.startsWith(t,"#")?this.$_parseNumber(t.substring(1)):M.COLORS[t]&&this.$_parseNumber(M.COLORS[t]))}get rgba(){return"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}isBright(){return.299*this.r+.587*this.g+.114*this.b>140}getContrast(t,e){return this.isBright()?t||"#000000":e||"#FFFFFF"}brighten(t,e=null){return(e=e||new M(null)).r=Math.ceil(this.r+(255-this.r)*t),e.g=Math.ceil(this.g+(255-this.g)*t),e.b=Math.ceil(this.b+(255-this.b)*t),e.a=this.a,e}toString(){return this.rgba}$_parseRgb(t){const e=t.split(/\,\s*/);e.length>=3&&(this.r=+e[0],this.g=+e[1],this.b=+e[2],e.length>=4?this.a=+e[3]:this.a=1)}$_parseNumber(t){const e=t.length;let r;e>6?(r=parseInt(t.substr(0,6),16),this.a=parseInt(t.substring(6),16)/255):e>0&&(3===e&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)),r=parseInt(t,16)),this.r=(16711680&r)>>16,this.g=(65280&r)>>8,this.b=255&r}}class x extends y{_points;_radius;_color;constructor(t){super(t)}setOptions(t){const e=this._points=[];this._radius=Math.max(1,p(+t.radius,3)),this._color=new M(t.color||"black");const r=this._color.r/255,a=this._color.g/255,i=this._color.b/255,s=this._color.a;return t.points.forEach((t=>{t.color?M.create(t.color):this._color,e.push(t.x,t.y,r,a,i,s)})),this}_getVShader(){return"\n uniform mat4 u_matrix;\n uniform float u_radius;\n attribute vec2 a_position;\n attribute vec4 a_color;\n varying vec4 v_color;\n\n void main() {\n gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);\n gl_PointSize = u_radius; // 픽셀 단위 점 크기\n v_color = a_color;\n }\n "}_getFShader(){return"\n precision mediump float;\n\n varying vec4 v_color;\n\n void main() {\n gl_FragColor = v_color;\n }\n "}_doRun(t,e,r,a){const i=t.getUniformLocation(this._program,"u_radius"),s=t.getAttribLocation(this._program,"a_position"),n=t.getAttribLocation(this._program,"a_color");t.uniform1f(i,2*this._radius),t.vertexAttribPointer(s,2,t.FLOAT,!1,24,0),t.enableVertexAttribArray(s),t.vertexAttribPointer(n,4,t.FLOAT,!1,24,8),t.enableVertexAttribArray(n),this._drawPoints(t,this._points,6)}}class D extends o{setPoint(t){return this.point=t,this}}class F extends s{constructor(t,e,r,a){super(t,e,r,a);const i=n.createElement(t,"foreignObject");this._pointContainer.add(this._pointView=this._createPointView(t)),this._pointContainer.appendDom(i),i.appendChild(this._canvas=t.createElement("canvas")),this._gl=new w(this._canvas)}getPointView(t,e,r,a){return this.$_pointViewAt(e,r)}render(t,e,r){const a=this._canvas,i=a.parentNode;i.setAttribute("width",t),i.setAttribute("height",e),a.width=t,a.height=e,a.style.width=t+"px",a.style.height=e+"px",super.render(t,e,r),this.trans(0,0)}pointByDom(t,e){return this.$_pointViewAt(e.x,e.y)}_mapToGL(t,e){const{tx:r,ty:a,scale:i,vx:s,vy:n}=this._transInfo;e.forEach((e=>{const s=e.glPoint=t.project([e.lon,e.lat]);s[0]=s[0]*i+r,s[1]=a-s[1]*i}))}$_pointViewAt(t,e){const r=this.model.hitTest(t,e);if(r)return this._pointView.setPoint(r[0])}_drawCircle(t,e,r,a,i){const s=this._ctx;s.beginPath(),s.arc(t,e,r,0,2*Math.PI),s.strokeStyle=a,s.lineWidth=1,s.stroke(),s.beginPath(),s.arc(t,e,r,0,2*Math.PI),s.fillStyle=i,s.fill()}}class O extends D{}class R extends F{constructor(t){super(t,"rm-gl-point-series",!0,!1),this._program=new x(this._gl)}_createPointView(t){return new O(t)}_doPrepeare(t,e,r){}_doRender(t,e){this.$_layoutMarkers(this._getGrowRate())}_doReset(){}$_layoutMarkers(t){const e=this.model,r=e.chart.getProjection(),a=Math.max(0,e.getRadius()),i=e._visPoints,s=new Array(i.length);this._mapToGL(r,i),i.forEach(((t,e)=>{s[e]={x:t.glPoint[0],y:t.glPoint[1]}})),this._program.setOptions({radius:a,points:s,color:String(e.options.color)||"black"}),this._gl.render([this._program])}}function $(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(f),t.SeriesView.register([f,R]))}export{c as GlSeries,$ as default};
|
package/heatmap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Heatmap v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Heatmap v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("realmap")):"function"==typeof define&&define.amd?define(["exports","realmap"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).RealMapheatmap={},e.RealMap)}(this,(function(e,t){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var r=i(t);class s extends t.MarkerSeriesPoint{_readObject(e,t){super._readObject(e,t)}}const o={count:e=>e.length,sum:e=>e.map((e=>e.getValue())).reduce(((e,t)=>e+t)),avg:e=>e.map((e=>e.getValue())).reduce(((e,t)=>e+t))/e.length};class l{_apply(e){this.origin=t.parseCoord(e.origin),this.cellWidth=+e.cellWidth,this.cellHeight=+e.cellWidth,isNaN(this.cellHeight)&&(this.cellHeight=t.maxv(60,t.pickNum(this.cellWidth,3600))),isNaN(this.cellWidth)&&(this.cellWidth=this.cellHeight),this.blur=t.maxv(0,t.pickNum(e.blur,0)),this.aggregation=t.pickProp(e.aggregation,"sum")}buildCells(e){const i={},r=this.origin[0],s=this.origin[1],l=this.cellWidth,n=this.cellHeight;e.forEach((e=>{if(e.visible){const o=t.floor(3600*(e.lon-r)/l),a=t.floor(3600*(e.lat-s)/n),h=`${o}+${a}`;let p=i[h];p?p.points.push(e):i[h]={lon:o*l/3600,lat:a*n/3600,points:[e]}}}));const a=this._cells=Object.values(i),h=o[this.aggregation]||o.sum;return a.forEach((e=>{e.value=h(e.points)})),a}}class n{_apply(e){}}class a extends t.MarkerSeries{constructor(){super(...arguments),this._grid=new l,this._point=new n}_doApply(e){super._doApply(e),this._mode=e.mode||"grid",this._grid._apply(e.grid||{}),this._point._apply(e.point||{})}_createPoint(e){return new s(e)}setCalcedColor(e,i){super.setCalcedColor(e,i),this._colorObj=new t.Color(this._calcedColor)}getColorScale(){return 0}getValueRange(){return{min:this._minValue,max:this._maxValue}}getRangedColor(e){if(this._colorRanger)return this._colorRanger.getColor(this._minValue,this._maxValue,e.value,this._colorObj)}initPoints(e){const t=this._orgPoints=super.initPoints(e);if("grid"===this._mode){const e=this._grid.buildCells(t);t.length=0,e.forEach(((e,i)=>{const r=new s;r.index=i,r.coord=[e.lon,e.lat],r.value=e.value,r.cell=e,t.push(r)}))}return t}_doPrepareRender(e,t){var i;super._doPrepareRender(e,t);const r=this._visPoints,{min:s,max:o}=this._calcMinMax(r);this._minValue=s,this._maxValue=o,this._colorRanger=null===(i=e.getColorScale(this.getColorScale()))||void 0===i?void 0:i.getRanger()}}a.type=t.HeatmapSeriesType,a.defaults=t.extend(t.MarkerSeries.defaults,{mode:"grid"});class h extends t.MarkerSeriesPointView{constructor(e){super(e)}renderGrid(e,t){this.setPath(["M",0,0,"L",(e.p2[0]-e.p1[0])*t,0,(e.p2[0]-e.p1[0])*t,(e.p3[1]-e.p2[1])*t,(e.p4[0]-e.p1[0])*t,(e.p4[1]-e.p1[1])*t,"Z"])}renderPoint(e,t){}tooltipColor(){return getComputedStyle(this.dom).fill}}class p extends t.MarkerSeriesView{constructor(e){super(e,"rm-heatmap-series",!1,!1);const i=t.RmElement.createElement(e,"foreignObject");this._pointContainer.appendDom(i),this._pointContainer.add(this._dummy=new t.RmElement(e,t.SeriesView.POINT_CLASS)),this._dummy.dom.style.display="none",i.appendChild(this._canvas=e.createElement("canvas"))}_createMarkers(e){return new t.PointViewPool(e,h)}_doPrepeare(e,t,i){this.$_prepareMarkers(t,t._visPoints)}_doRender(e,t){this.$_layoutMarkers(e,t)}_doReset(){}_runShowEffect(e){e&&t.SeriesAnimation.grow(this)}_doViewRateChanged(e){this.$_layoutMarkers(this.width,this.height)}$_prepareSvgCells(e,t){this._pointContainer.setFill(e._runColor),this._markers.prepare(t.length,((i,r)=>{const s=i.point=t[r].point;this._setPointStyle(i,e,s)}))}$_prepareCanvasCells(e,t){}$_prepareGridMode(e,t){const i=e.chart.getProjection(),r=e._grid.cellWidth/3600,s=e._grid.cellHeight/3600,o=this._cells=[];t.forEach((e=>{if(!e.isNull){const t=[e.lon,e.lat],l=[e.lon+r,e.lat],n=[e.lon+r,e.lat+s],a=[e.lon,e.lat+s];if(i.isVisible(t)||i.isVisible(l)||i.isVisible(n)||i.isVisible(a)){const r=i.projectCoord(t),s=i.projectCoord(l),h=i.projectCoord(n),p=i.projectCoord(a);e.xPos=r[0],e.yPos=r[1],o.push({point:e,p1:r,p2:s,p3:h,p4:p})}}})),e._grid.blur>0?this.$_prepareCanvasCells(e,o):this.$_prepareSvgCells(e,o)}$_renderSvgCells(e){const t=this._scale;this._markers.forEach(((i,r)=>{const s=this._cells[r];i.setVisible(!0),i.renderGrid(s,t),i.trans(s.p1[0]*t,s.p1[1]*-t).rotate(e)}))}$_renderCanvasCells(e,t,i){const r=this.model,s=this._dummy,o=this._canvas,l=o.parentNode,n=o.getContext("2d"),{tx:a,ty:h,scale:p}=this._transInfo,d=this._wBody,c=this._hBody;l.setAttribute("width",d),l.setAttribute("height",c),o.width=d,o.height=c,o.style.width=d+"px",o.style.height=c+"px",n.clearRect(0,0,d,c),n.filter="blur(20px)",this._cells.forEach((e=>{const{p1:t,p2:i,p3:o,p4:l,point:d}=e,c=t[0]+(i[0]-t[0])/2,u=t[1]+(l[1]-t[1])/2,_=(i[0]-t[0]+o[0]-i[0])/2,g=(i[1]-t[1]+o[1]-i[1])/2;this._setPointStyle(s,r,d),n.fillStyle=getComputedStyle(s.dom).fill,n.beginPath(),n.ellipse((c-_/2)*p+a,(u-g/2)*-p+h,2*_*p,2*g*p,0,0,2*Math.PI),n.fill(),n.beginPath(),n.ellipse((c-_/10)*p+a,(u-g/10)*-p+h,1.2*_*p,1.2*g*p,0,0,2*Math.PI),n.fill()})),this.trans(0,0)}$_renderGridMode(e,t,i,r){e._grid.blur>0?this.$_renderCanvasCells(t,i,r):this.$_renderSvgCells(r)}$_preparePointMode(e,t){}$_renderPointMode(e,t){}$_prepareMarkers(e,t){if("point"===e._mode);else this.$_prepareGridMode(e,t)}$_layoutMarkers(e,t){const i=this.model,r=+i.options.rotation||0;if("point"===i._mode);else this.$_renderGridMode(i,e,t,r)}}function d(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(a),e.SeriesView.register([a,p]))}d(r),e.HeatmapSeries=a,e.default=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/heatmap.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* RealMap Heatmap v1.1.
|
|
4
|
-
* Copyright (C) 2023-
|
|
3
|
+
* RealMap Heatmap v1.1.4
|
|
4
|
+
* Copyright (C) 2023-2026 WooriTech Inc.
|
|
5
5
|
* All Rights Reserved.
|
|
6
6
|
*/
|
|
7
7
|
import{HeatmapSeriesType as e,extend as t,MarkerSeries as i,Color as s,MarkerSeriesPoint as r,parseCoord as l,maxv as o,pickNum as n,pickProp as a,floor as h,MarkerSeriesView as d,RmElement as p,SeriesView as c,PointViewPool as _,SeriesAnimation as g,MarkerSeriesPointView as u}from"./index.mjs";class m extends r{_readObject(e,t){super._readObject(e,t)}}const C={count:e=>e.length,sum:e=>e.map((e=>e.getValue())).reduce(((e,t)=>e+t)),avg:e=>e.map((e=>e.getValue())).reduce(((e,t)=>e+t))/e.length};class f{_apply(e){this.origin=l(e.origin),this.cellWidth=+e.cellWidth,this.cellHeight=+e.cellWidth,isNaN(this.cellHeight)&&(this.cellHeight=o(60,n(this.cellWidth,3600))),isNaN(this.cellWidth)&&(this.cellWidth=this.cellHeight),this.blur=o(0,n(e.blur,0)),this.aggregation=a(e.aggregation,"sum")}buildCells(e){const t={},i=this.origin[0],s=this.origin[1],r=this.cellWidth,l=this.cellHeight;e.forEach((e=>{if(e.visible){const o=h(3600*(e.lon-i)/r),n=h(3600*(e.lat-s)/l),a=`${o}+${n}`;let d=t[a];d?d.points.push(e):t[a]={lon:o*r/3600,lat:n*l/3600,points:[e]}}}));const o=this._cells=Object.values(t),n=C[this.aggregation]||C.sum;return o.forEach((e=>{e.value=n(e.points)})),o}}class y{_apply(e){}}class b extends i{constructor(){super(...arguments),this._grid=new f,this._point=new y}_doApply(e){super._doApply(e),this._mode=e.mode||"grid",this._grid._apply(e.grid||{}),this._point._apply(e.point||{})}_createPoint(e){return new m(e)}setCalcedColor(e,t){super.setCalcedColor(e,t),this._colorObj=new s(this._calcedColor)}getColorScale(){return 0}getValueRange(){return{min:this._minValue,max:this._maxValue}}getRangedColor(e){if(this._colorRanger)return this._colorRanger.getColor(this._minValue,this._maxValue,e.value,this._colorObj)}initPoints(e){const t=this._orgPoints=super.initPoints(e);if("grid"===this._mode){const e=this._grid.buildCells(t);t.length=0,e.forEach(((e,i)=>{const s=new m;s.index=i,s.coord=[e.lon,e.lat],s.value=e.value,s.cell=e,t.push(s)}))}return t}_doPrepareRender(e,t){var i;super._doPrepareRender(e,t);const s=this._visPoints,{min:r,max:l}=this._calcMinMax(s);this._minValue=r,this._maxValue=l,this._colorRanger=null===(i=e.getColorScale(this.getColorScale()))||void 0===i?void 0:i.getRanger()}}b.type=e,b.defaults=t(i.defaults,{mode:"grid"});class v extends u{constructor(e){super(e)}renderGrid(e,t){this.setPath(["M",0,0,"L",(e.p2[0]-e.p1[0])*t,0,(e.p2[0]-e.p1[0])*t,(e.p3[1]-e.p2[1])*t,(e.p4[0]-e.p1[0])*t,(e.p4[1]-e.p1[1])*t,"Z"])}renderPoint(e,t){}tooltipColor(){return getComputedStyle(this.dom).fill}}class P extends d{constructor(e){super(e,"rm-heatmap-series",!1,!1);const t=p.createElement(e,"foreignObject");this._pointContainer.appendDom(t),this._pointContainer.add(this._dummy=new p(e,c.POINT_CLASS)),this._dummy.dom.style.display="none",t.appendChild(this._canvas=e.createElement("canvas"))}_createMarkers(e){return new _(e,v)}_doPrepeare(e,t,i){this.$_prepareMarkers(t,t._visPoints)}_doRender(e,t){this.$_layoutMarkers(e,t)}_doReset(){}_runShowEffect(e){e&&g.grow(this)}_doViewRateChanged(e){this.$_layoutMarkers(this.width,this.height)}$_prepareSvgCells(e,t){this._pointContainer.setFill(e._runColor),this._markers.prepare(t.length,((i,s)=>{const r=i.point=t[s].point;this._setPointStyle(i,e,r)}))}$_prepareCanvasCells(e,t){}$_prepareGridMode(e,t){const i=e.chart.getProjection(),s=e._grid.cellWidth/3600,r=e._grid.cellHeight/3600,l=this._cells=[];t.forEach((e=>{if(!e.isNull){const t=[e.lon,e.lat],o=[e.lon+s,e.lat],n=[e.lon+s,e.lat+r],a=[e.lon,e.lat+r];if(i.isVisible(t)||i.isVisible(o)||i.isVisible(n)||i.isVisible(a)){const s=i.projectCoord(t),r=i.projectCoord(o),h=i.projectCoord(n),d=i.projectCoord(a);e.xPos=s[0],e.yPos=s[1],l.push({point:e,p1:s,p2:r,p3:h,p4:d})}}})),e._grid.blur>0?this.$_prepareCanvasCells(e,l):this.$_prepareSvgCells(e,l)}$_renderSvgCells(e){const t=this._scale;this._markers.forEach(((i,s)=>{const r=this._cells[s];i.setVisible(!0),i.renderGrid(r,t),i.trans(r.p1[0]*t,r.p1[1]*-t).rotate(e)}))}$_renderCanvasCells(e,t,i){const s=this.model,r=this._dummy,l=this._canvas,o=l.parentNode,n=l.getContext("2d"),{tx:a,ty:h,scale:d}=this._transInfo,p=this._wBody,c=this._hBody;o.setAttribute("width",p),o.setAttribute("height",c),l.width=p,l.height=c,l.style.width=p+"px",l.style.height=c+"px",n.clearRect(0,0,p,c),n.filter="blur(20px)",this._cells.forEach((e=>{const{p1:t,p2:i,p3:l,p4:o,point:p}=e,c=t[0]+(i[0]-t[0])/2,_=t[1]+(o[1]-t[1])/2,g=(i[0]-t[0]+l[0]-i[0])/2,u=(i[1]-t[1]+l[1]-i[1])/2;this._setPointStyle(r,s,p),n.fillStyle=getComputedStyle(r.dom).fill,n.beginPath(),n.ellipse((c-g/2)*d+a,(_-u/2)*-d+h,2*g*d,2*u*d,0,0,2*Math.PI),n.fill(),n.beginPath(),n.ellipse((c-g/10)*d+a,(_-u/10)*-d+h,1.2*g*d,1.2*u*d,0,0,2*Math.PI),n.fill()})),this.trans(0,0)}$_renderGridMode(e,t,i,s){e._grid.blur>0?this.$_renderCanvasCells(t,i,s):this.$_renderSvgCells(s)}$_preparePointMode(e,t){}$_renderPointMode(e,t){}$_prepareMarkers(e,t){if("point"===e._mode);else this.$_prepareGridMode(e,t)}$_layoutMarkers(e,t){const i=this.model,s=+i.options.rotation||0;if("point"===i._mode);else this.$_renderGridMode(i,e,t,s)}}function $(e){(function(e){return e.Series&&e.SeriesView})(e)&&(e.Series.register(b),e.SeriesView.register([b,P]))}export{b as HeatmapSeries,$ as default};
|