import{G as c}from"./GraphinaGoogleChartBase.js";class u extends c{constructor(e){super(e),this.chart=null,this.data=null,this.options={},this.initFilter(),this.region={}}initFilter(){jQuery(document.body).off("click",".graphina-geo-filter-div-button"),jQuery(document.body).on("click",".graphina-geo-filter-div-button",this.debounce(this.handleGeoChartFilter.bind(this),300))}handleGeoChartFilter(e){const r=e.currentTarget,o=jQuery(r).data("element_id"),t=jQuery(`.graphina-google-chart[data-element_id="${o}"]`);let s=jQuery(`#graphina-geo-drop_down_filter_${o}`).val();this.setupChart(t,"GeoChart"),this.region[o]=s}setUpChartsHandler(){this.chartHandlers={geo_google:e=>this.observeChartElement(e,"GeoChart")}}observeChartElement(e,r){gcfe_public_localize.view_port==="off"?(this.observer||(this.observer=new IntersectionObserver(o=>{o.forEach(t=>{t.isIntersecting&&(this.setupChart(jQuery(t.target),r),this.observer.unobserve(t.target))})},{threshold:.1})),this.observer.observe(e[0])):this.setupChart(e,r)}getFinalChartOptions(e,r){return this.region&&this.region[r]&&(e.region=this.region[r],e.resolution=gcfe_public_localize.provinceSupportedCountries.includes(this.region[r])?"provinces":"countries"),e}setupTableData(e,r,o,t,s){var n;((n=e==null?void 0:e.google_chart_data)==null?void 0:n.data.length)>0?(r.addColumn("string","State"),s.geo_label?r.addColumn("number",s.geo_label):r.addColumn("number","Sale"),e.google_chart_data.data.forEach(i=>r.addRow(i)),o.show(),t.hide()):(e==null?void 0:e.columns.length)>0&&e.rows.length>0?(e.columns.forEach((i,l)=>{r.addColumn(i[0],i[1])}),e.rows.forEach(i=>r.addRow(i))):(o.hide(),t.show())}afterSetupChart(e,r,o,t,s){const n={"#4684ee":r.ballColor??"#4684ee","#f7f7f7":r.innerCircleColor??"#f7f7f7","#cccccc":r.outerCircleColor??"#cccccc"},i=r.needleColor??"#c63310";e.querySelectorAll("circle").forEach(l=>{const h=n[l.getAttribute("fill")];h&&l.setAttribute("fill",h)}),e.querySelectorAll("path").forEach(l=>{l.getAttribute("stroke")==="#c63310"&&(l.setAttribute("stroke",i),l.setAttribute("fill",i))}),window.addEventListener("resize",()=>{o&&t&&s&&o.draw(t,s)})}}window.graphinaGoogleGeoChart=new u;
//# sourceMappingURL=geo_google.js.map
