
/* Smart UI v9.1.74 (2021-03-16) 
Copyright (c) 2011-2021 jQWidgets. 
License: https://htmlelements.com/license/ */ //

!function(e){var t={};function i(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=51)}({51:function(e,t){Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(e){const t=this,i=e[0];let n,a=!0,o=[];for(let e in i){if("$"===e)continue;if("string"===t.dataSource.dataFields.find(t=>t.name===e).dataType){0===t.columns.findIndex(t=>t.dataField===e)&&(n=e)}else a=!1,o.push({dataField:e,displayText:e})}return{xAxisDataField:n,series:o,stringOnly:a}}createChart(e,t){const i=this,n=i.getSelection(),a=n.rows,o=n.columns,r=n.cells,l=document.createElement("smart-chart"),s=[],d={};let c,u=[],f=[];if(r&&r.length>1&&r.forEach(e=>{-1===u.indexOf(e.row.index)&&u.push(e.row.index),-1===f.indexOf(e.dataField)&&f.push(e.dataField)}),t)s.concat(t);else for(let e=0;e<i.dataSource.length;e++){const t={};if(a){if(!a.find(t=>t.row.index===e))continue}else{if(o){o.forEach(n=>{t[n.dataField]=i.dataSource[e][n.dataField]}),s.push(t);continue}if(r&&r.length>1){if(-1===u.indexOf(e))continue;f.forEach(n=>{t[n]=i.dataSource[e][n]}),s.push(t);continue}}i.columns.forEach(n=>t[n.dataField]=i.dataSource[e][n.dataField]),s.push(t)}const h=i._getChartDataFields(s);if(h.stringOnly){if(i.header.visible&&i.$.header.firstElementChild){const t=i.enableShadowDOM?i.shadowRoot.getElementById(e):i.querySelector("#"+e);i.$.header.firstElementChild.classList.add("warning"),t&&t.classList.add("warning"),setTimeout((function(){i.$.header.firstElementChild.classList.remove("warning"),t&&t.classList.remove("warning")}),1e3)}}else{if(c=h.series,l.caption="",l.description="",l.clip=!1,l.showLegend=!0,l.showBorderLine=!1,l.padding={left:5,top:10,right:5,bottom:5},l.dataSource=s,l.xAxis={dataField:h.xAxisDataField,gridLines:{visible:!0}},l.valueAxis={displayValueAxis:!0,description:i.charting.description,axisSize:"auto",formatSettings:i.charting.formatSettings},l.colorScheme=i.charting.colorScheme,l.seriesGroups=[d],d.formatSettings=i.charting.formatSettings,d.series=c,"line"===e)c.forEach((function(e){e.symbolSize=8,e.symbolType="square"}));else if("pie"===e){const e=c[0].dataField;delete d.formatSettings,d.formatFunction=function(e,t){return isNaN(e)&&"object"==typeof e?t:e},d.showLabels=!0,c.length=0,c.push({dataField:e,displayText:h.xAxisDataField,initialAngle:0})}else if("bar"===e)e="column",d.orientation="horizontal",l.xAxis.textRotationAngle=90,l.valueAxis.textRotationAngle=30,l.valueAxis.flip=!0;else if("area"===e){let e=1;for(let t=0;t<c.length;t++)c[t].opacity=e,e-=.2,e=Math.max(.3,e)}if(d.type=e,i.onChartInit&&i.onChartInit(l),i.charting.appendTo){const e="string"===i.charting.appendTo?document.querySelector(i.charting.appendTo):i.charting.appendTo;e&&e.appendChild(l)}else i._openChartDialog(l,e)}}_openChartDialog(e,t){const i=this;if(!i.charting.dialog.enabled)return!1;const n=i._dialogChart||i._createDialog(i.charting.dialog),a=t.substring(0,1).toUpperCase()+t.substring(1),o="{{message}}"===i.charting.dialog.header?i.localize("dialogChartHeader",{value:a}):i.charting.dialog.header;e.style.width="100%",e.style.height="100%",n.header.innerHTML=o,n.content.innerHTML="",n.content.style.width="100%",n.content.style.height="100%",n.btnCancel.classList.add("smart-hidden"),i._dialogChart||(n.modal=!0,n.onOpen=function(){i.charting.dialog.visible=!0},n.onClose=function(){i.charting.dialog.visible=!1},n.btnConfirm.onclick=function(){n.close()},n.btnClose.onclick=function(){n.close()},n.onkeydown=function(e){"Escape"===e.key&&n.close()},i._dialogChart=n),n.open(),setTimeout((function(){n.btnConfirm.focus(),n.content.appendChild(e)}),100)}})}});