UNPKG

survey-analytics

Version:

SurveyJS Dashboard is a UI component for visualizing and analyzing survey data. It interprets the form JSON schema to identify question types and renders collected responses using interactive charts and tables.

2 lines 253 kB
/*! For license information please see survey.analytics.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("plotly.js-dist-min"),require("survey-core")):"function"==typeof define&&define.amd?define("SurveyAnalytics",["plotly.js-dist-min","survey-core"],t):"object"==typeof exports?exports.SurveyAnalytics=t(require("plotly.js-dist-min"),require("survey-core")):e.SurveyAnalytics=t(e.Plotly,e.Survey)}(this,((e,t)=>(()=>{var i={24:e=>{e.exports='<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"><g><circle cx="8" cy="4" r="3"></circle><path d="M8,8c-3.31,0-6,2.73-6,4.67S5.27,15,8,15s6-0.4,6-2.33S11.31,8,8,8z"></path></g></svg>'},41:e=>{e.exports='<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M12.79,4.2L16,1l-1-1l-3.32,3.32C10.57,2.55,9.32,2,8,2C3.63,2,0,7.97,0,7.97s1.27,2.1,3.21,3.82l-3.23,3.23 L0.96,16l3.35-3.34C5.41,13.44,6.67,14,8,14c4.37,0,8-6,8-6S14.73,5.91,12.79,4.2z M2,7.97c1.07-1.47,3.61-4,6-4 c0.8,0,1.6,0.27,2.35,0.68L9.57,5.43C9.11,5.14,8.58,4.97,8,4.97c-1.66,0-3,1.34-3,3c0,0.58,0.17,1.11,0.46,1.57l-0.97,0.97 C3.36,9.64,2.45,8.59,2,7.97z M8,11.97c-0.8,0-1.59-0.27-2.33-0.67l0.78-0.77C6.9,10.8,7.43,10.97,8,10.97c1.66,0,3-1.34,3-3 c0-0.57-0.17-1.09-0.44-1.55l0.98-0.98c1.11,0.87,2.01,1.91,2.46,2.52C12.93,9.44,10.39,11.97,8,11.97z"></path></g></svg>'},61:t=>{"use strict";t.exports=e},70:(e,t,i)=>{"use strict";i.d(t,{NW:()=>l,QV:()=>a,QX:()=>u,Qk:()=>o,gf:()=>s});var r=i(156),n=i(240),s=function(){function e(){}return e.createSelector=function(t,i,r,n){var s=document.createElement("div");s.className="sa-question__select-wrapper";var o=e.createElement("span","sa-question__select-title"),a=document.createElement("select");return a.className="sa-question__select",a.onchange=r,s.appendChild(a),s.__updateSelect=function(){var r;r=!!n&&("string"==typeof n?n:n()),o.innerText=r,r?s.insertBefore(o,a):o.parentElement===s&&s.removeChild(o),function(){a.innerHTML="";var r=t||[];(Array.isArray(r)?r:r()).forEach((function(t){var r=e.createElement("option","",{value:t.value,text:t.text,selected:i(t)});a.appendChild(r)}))}()},s.__updateSelect(),s},e.createButton=function(t,i,r){return void 0===i&&(i=""),void 0===r&&(r="sa-toolbar__button"),e.createElement("span",r,{innerText:i,onclick:t})},e.createElement=function(e,t,i){void 0===t&&(t="");var r=document.createElement(e);return r.className=t,i&&Object.keys(i).forEach((function(e){r[e]=i[e]})),r},e.createSvgElement=function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=document.createElementNS("http://www.w3.org/2000/svg","use");return i.setAttributeNS("http://www.w3.org/1999/xlink","href","#sa-svg-"+e),t.appendChild(i),t},e.createSvgButton=function(t){var i=e.createElement("button","sa-table__svg-button");return i.appendChild(e.createSvgElement(t)),i},e.createSvgToggleButton=function(t,i,r,n,s,o,a,l){void 0===a&&(a="first"),void 0===l&&(l="sa-toolbar__button sa-toolbar__svg-button");var u=e.createSvgElement(t),h=e.createSvgElement(i),c=e.createElement("button",l);return"first"===a?(c.title=r,c.appendChild(u)):(a="second")&&(c.title=n,c.appendChild(h)),c.onclick=function(e){"first"===a?(a="second",c.title=n,c.removeChild(u),c.appendChild(h),o(e)):"second"===a&&(a="first",c.title=r,c.removeChild(h),c.appendChild(u),s(e))},c},e.createInput=function(t,i,r){return void 0===i&&(i=""),void 0===r&&(r=""),e.createElement("input",t,{placeholder:i,defaultValue:r})},e}();function o(){var e,t=s.createElement("div","sa-commercial"),i=s.createElement("div","sa-commercial__text"),o=s.createElement("span",""),a=s.createElement("span","sa-commercial__product",{innerHTML:(e=!!r.glc&&(0,r.glc)(1),e&&e.toLocaleDateString?n.qG.getString("license2").replace("{date}",e.toLocaleDateString()):n.qG.getString("license"))});return t.appendChild(i).appendChild(o),o.appendChild(a),t}function a(){var e=s.createElement("div","sa-data-loading-indicator-panel"),t=s.createElement("div","sa-data-loading-indicator");return t.innerHTML='\n <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_17928_11482)">\n <path d="M32 64C14.36 64 0 49.65 0 32C0 14.35 14.36 0 32 0C49.64 0 64 14.35 64 32C64 49.65 49.64 64 32 64ZM32 4C16.56 4 4 16.56 4 32C4 47.44 16.56 60 32 60C47.44 60 60 47.44 60 32C60 16.56 47.44 4 32 4Z" fill="#E5E5E5"></path>\n <path d="M53.2101 55.2104C52.7001 55.2104 52.1901 55.0104 51.8001 54.6204C51.0201 53.8404 51.0201 52.5704 51.8001 51.7904C57.0901 46.5004 60.0001 39.4704 60.0001 31.9904C60.0001 24.5104 57.0901 17.4804 51.8001 12.1904C51.0201 11.4104 51.0201 10.1404 51.8001 9.36039C52.5801 8.58039 53.8501 8.58039 54.6301 9.36039C60.6701 15.4004 64.0001 23.4404 64.0001 31.9904C64.0001 40.5404 60.6701 48.5704 54.6301 54.6204C54.2401 55.0104 53.7301 55.2104 53.2201 55.2104H53.2101Z" fill="#19B394"></path>\n </g>\n <defs>\n <clipPath id="clip0_17928_11482">\n <rect width="64" height="64" fill="white"></rect>\n </clipPath>\n </defs>\n </svg>\n ',e.appendChild(t),e}window.URL.createObjectURL;var l=function(){function e(){}return e.zipArrays=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=[],r=function(t){i[t]=[],e.forEach((function(e){i[t].push(e[t])}))},n=0;n<e[0].length;n++)r(n);return i},e.unzipArrays=function(e){var t=[];return e.forEach((function(e,i){e.forEach((function(e,r){t[r]||(t[r]=[]),t[r][i]=e}))})),t},e.sortDictionary=function(e,t,i){var r=this.zipArrays(e,t),n=function(e,t,i){void 0===i&&(i=!0);var r=e[1]<t[1]?1:e[1]==t[1]?0:-1;return i?r:-1*r};r.sort((function(e,t){return i?n(e,t,!1):n(e,t)}));var s=this.unzipArrays(r);return{keys:s[0],values:s[1]}},e.toPercentage=function(e,t){return e/t*100},e}();function u(e,t){void 0===t&&(t=2);var i=Math.pow(10,t);return Math.round(i*e)/i}},87:(e,t,i)=>{"use strict";i.d(t,{C6:()=>n,Cl:()=>r,YH:()=>o,sH:()=>s});var r=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function n(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);function r(){this.constructor=e}e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function s(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function o(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}},143:(e,t,i)=>{"use strict";i.d(t,{u:()=>a});var r=i(87),n=i(156),s=i(183),o=i(557),a=function(e){function t(t,i,r,n){var s=e.call(this,t,i,r,n||"matrix")||this;return s._transposeData=!0,s}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"matrixQuestion",{get:function(){return this.question},enumerable:!1,configurable:!0}),t.prototype.isSupportMissingAnswers=function(){return!1},t.prototype.getSeriesValues=function(){return this.matrixQuestion.rows.map((function(e){return""+e.value}))},t.prototype.getSeriesLabels=function(){var e=this;return this.matrixQuestion.rows.map((function(t){return n.ItemValue.getTextOrHtmlByValue(e.matrixQuestion.rows,t.value)}))},t.prototype.getSelectedItemByText=function(e){return this.matrixQuestion.columns.filter((function(t){return t.text===e}))[0]},t.prototype.valuesSource=function(){return this.matrixQuestion.columns},t.prototype.getHasAnswersInAllSeriesArray=function(e){for(var t=Array(),i=0;i<e[0].length;i++)for(var r=0;r<e.length;r++)0!=e[r][i]&&(t[i]=!0);return t},t.prototype.getHasAnswersInSeries=function(e){for(var t=0;t<e.length;t++)if(0!=e[t])return!0;return!1},t.prototype.hideEmptyAnswersInData=function(e){for(var t={datasets:[],labels:[],colors:[],texts:[],seriesLabels:[]},i=this.getHasAnswersInAllSeriesArray(e.datasets),r=0;r<e.datasets.length;r++)if(this.getHasAnswersInSeries(e.datasets[r])){t.labels.push(e.labels[r]),t.colors.push(e.colors[r]);for(var n=[],s=[],o=0;o<e.datasets[0].length;o++)i[o]&&(n.push(e.datasets[r][o]),s.push(e.texts[r][o]));t.datasets.push(n),t.texts.push(s)}for(r=0;r<e.datasets[0].length;r++)i[r]&&t.seriesLabels.push(e.seriesLabels[r]);return t},t}(s.o);o.g.registerVisualizer("matrix",a)},156:e=>{"use strict";e.exports=t},183:(e,t,i)=>{"use strict";i.d(t,{M:()=>u,o:()=>h});var r=i(87),n=i(156),s=i(267),o=i(240),a=i(70),l=i(557);function u(e){var t={datasets:[],labels:[],colors:[],texts:[],seriesLabels:[]};if(0===e.seriesLabels.length){t.datasets.push([]),t.texts.push([]);for(var i=0;i<e.datasets[0].length;i++)0!=e.datasets[0][i]&&(t.datasets[0].push(e.datasets[0][i]),t.labels.push(e.labels[i]),t.colors.push(e.colors[i]),t.texts[0].push(e.texts[0][i]));return t}var r=[];r.length=e.seriesLabels.length;var n=[];n.length=e.labels.length;for(var s=0;s<e.seriesLabels.length;s++)for(var o=0;o<e.labels.length;o++)0!=e.datasets[s][o]&&(r[s]=!0,n[o]=!0);for(o=0;o<n.length;o++)n[o]&&(t.labels.push(e.labels[o]),t.colors.push(e.colors[o]));for(s=0;s<e.seriesLabels.length;s++)r[s]&&t.seriesLabels.push(e.seriesLabels[s]);for(s=0;s<e.datasets.length;s++)if(r[s]){var a=[],l=[];for(o=0;o<e.labels.length;o++)n[o]&&(a.push(e.datasets[s][o]),l.push(e.texts[s][o]));t.datasets.push(a),t.texts.push(l)}return t}var h=function(e){function t(i,r,l,u){var h=e.call(this,i,r,l,u||"selectBase")||this;return h.selectedItem=void 0,h.choicesOrderSelector=void 0,h.showPercentageBtn=void 0,h.emptyAnswersBtn=void 0,h.transposeDataBtn=void 0,h.topNSelector=void 0,h._showOnlyPercentages=!1,h._percentagePrecision=2,h._answersOrder="default",h._hideEmptyAnswers=!1,h._topN=-1,h.topNValues=[].concat(t.topNValuesDefaults),h._transposeData=!1,h._showMissingAnswers=!1,h.missingAnswersBtn=void 0,h.chartTypes=[],h._chartType="bar",h.onAnswersDataReady=new n.Event,i&&(i.visibleChoicesChangedCallback=function(){h.dataProvider.raiseDataChanged()}),h._supportSelection=!0,h._showOnlyPercentages=!0===h.options.showOnlyPercentages,h.options.percentagePrecision&&(h._percentagePrecision=h.options.percentagePrecision),void 0!==h.options.transposeData&&(h._transposeData=h.options.transposeData),h._hideEmptyAnswers=!0===h.options.hideEmptyAnswers,h._answersOrder=h.options.answersOrder||"default",h._showMissingAnswers=h.isSupportMissingAnswers()&&!0===h.options.showMissingAnswers,h.options.allowExperimentalFeatures,s.w.chartAdapterType&&(h._chartAdapter=new s.w.chartAdapterType(h),h.chartTypes=h._chartAdapter.getChartTypes(),h.getSeriesValues().length>0&&-1===h.chartTypes.indexOf("stackedbar")&&h.chartTypes.push("stackedbar"),h._chartType=h.chartTypes[0],-1!==h.chartTypes.indexOf(h.options.defaultChartType)&&(h._chartType=h.options.defaultChartType)),!1!==h.options.allowChangeVisualizerType&&h.registerToolbarItem("changeChartType",(function(){return h.chartTypes.length>1?a.gf.createSelector(h.chartTypes.map((function(e){return{value:e,text:o.qG.getString("chartType_"+e)}})),(function(e){return h.chartType===e.value}),(function(e){h.setChartType(e.target.value)})):null})),h.registerToolbarItem("changeAnswersOrder",(function(){return h.isSupportAnswersOrder()&&(h.choicesOrderSelector=a.gf.createSelector([{text:o.qG.getString("defaultOrder"),value:"default"},{text:o.qG.getString("ascOrder"),value:"asc"},{text:o.qG.getString("descOrder"),value:"desc"}],(function(e){return!1}),(function(e){h.answersOrder=e.target.value})),h.updateOrderSelector()),h.choicesOrderSelector})),h.registerToolbarItem("showPercentages",(function(){if(h.options.allowShowPercentages&&(-1!==h.chartTypes.indexOf("bar")||-1!==h.chartTypes.indexOf("stackedbar")))return h.showPercentageBtn=a.gf.createButton((function(){h.showPercentages=!h.showPercentages})),h.updateShowPercentageBtn(),h.showPercentageBtn})),h.registerToolbarItem("hideEmptyAnswers",(function(){return h.options.allowHideEmptyAnswers&&(h.emptyAnswersBtn=a.gf.createButton((function(){h.hideEmptyAnswers=!h._hideEmptyAnswers})),h.updateEmptyAnswersBtn()),h.emptyAnswersBtn}),1e3),h.registerToolbarItem("topNAnswers",(function(){return h.options.allowTopNAnswers&&0===h.getSeriesValues().length&&(h.topNSelector=a.gf.createSelector(h.topNValues.map((function(e){return{text:o.qG.getString("topNValueText"+e),value:e}})),(function(e){return!1}),(function(e){h.topN=parseInt(e.target.value)})),h.updateTopNSelector()),h.topNSelector})),h.registerToolbarItem("transposeData",(function(){return h.options.allowTransposeData&&(h.transposeDataBtn=a.gf.createButton((function(){h.transposeData=!h.transposeData})),h.updateTransposeDataBtn()),h.transposeDataBtn})),h.registerToolbarItem("showMissingAnswers",(function(){return h.isSupportMissingAnswers()&&h.options.allowShowMissingAnswers&&(h.missingAnswersBtn=a.gf.createButton((function(){h.showMissingAnswers=!h._showMissingAnswers})),h.updateMissingAnswersBtn()),h.missingAnswersBtn})),h}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"chartType",{get:function(){return this._chartType},set:function(e){this.setChartType(e)},enumerable:!1,configurable:!0}),t.prototype.updateEmptyAnswersBtn=function(){this.emptyAnswersBtn&&(this.emptyAnswersBtn.innerText=this._hideEmptyAnswers?o.qG.getString("showEmptyAnswers"):o.qG.getString("hideEmptyAnswers"),"bar"==this.chartType||"vbar"==this.chartType||"line"==this.chartType||"scatter"==this.chartType?this.emptyAnswersBtn.style.display="inline":this.emptyAnswersBtn.style.display="none")},t.prototype.updateTransposeDataBtn=function(){this.transposeDataBtn&&(this.transposeDataBtn.innerText=this.transposeData?o.qG.getString("showPerColumns"):o.qG.getString("showPerValues"),this.getSeriesValues().length>0?this.transposeDataBtn.style.display="inline":this.transposeDataBtn.style.display="none")},t.prototype.updateOrderSelector=function(){this.choicesOrderSelector&&("bar"==this.chartType||"vbar"==this.chartType||"line"==this.chartType||"scatter"==this.chartType||("pie"==this.chartType||"doughnut"==this.chartType)&&this.topN>0?this.choicesOrderSelector.style.display="inline-flex":this.choicesOrderSelector.style.display="none",this.choicesOrderSelector.getElementsByTagName("select")[0].value=this.answersOrder)},t.prototype.updateShowPercentageBtn=function(){this.showPercentageBtn&&(this.showPercentageBtn.innerText=this._showPercentages?o.qG.getString("hidePercentages"):o.qG.getString("showPercentages"),"bar"==this.chartType||"vbar"==this.chartType||"stackedbar"==this.chartType?this.showPercentageBtn.style.display="inline":this.showPercentageBtn.style.display="none")},t.prototype.updateTopNSelector=function(){this.topNSelector&&(this.topNSelector.getElementsByTagName("select")[0].value=this._topN)},t.prototype.updateMissingAnswersBtn=function(){this.missingAnswersBtn&&(this.missingAnswersBtn.innerText=this._showMissingAnswers?o.qG.getString("hideMissingAnswers"):o.qG.getString("showMissingAnswers"))},t.prototype.onChartTypeChanged=function(){this.updateOrderSelector(),this.updateShowPercentageBtn(),this.updateEmptyAnswersBtn(),this.updateTopNSelector(),this.stateChanged("chartType",this._chartType)},t.prototype.setChartType=function(e){-1!==this.chartTypes.indexOf(e)&&this._chartType!==e&&(this._chartType=e,this.onChartTypeChanged(),this.refreshContent())},t.prototype.getCorrectAnswerText=function(){var t=e.prototype.getCorrectAnswerText.call(this),i=Array.isArray(t)?t:[t],r=this.question;return i.map((function(e){return n.ItemValue.getTextOrHtmlByValue(r.choices,e)})).join(", ")},t.prototype.isSupportSoftUpdateContent=function(){return!0},t.prototype.softUpdateContent=function(){var e,t=null===(e=this.contentContainer)||void 0===e?void 0:e.children[0];t&&this._chartAdapter.update(t)},t.prototype.getSelectedItemByText=function(e){var t;if(this.question instanceof n.QuestionRatingModel){var i=this.question.rateValues;return null!==(t=null==i?void 0:i.filter((function(t){return t.text===e}))[0])&&void 0!==t?t:new n.ItemValue(parseFloat(e),e)}var r=this.question;return this.question.hasOther&&e==r.otherText?r.otherItem:r.choices.filter((function(t){return t.text===e}))[0]},t.prototype.onSelectionChanged=function(e){var t;void 0!==this.onDataItemSelected&&this.onDataItemSelected(void 0!==e?e.value:void 0,void 0!==e?e.text:""),this.stateChanged("filter",null===(t=this.selectedItem)||void 0===t?void 0:t.value)},t.prototype.setSelection=function(e){this.selectedItem!==e&&(this.selectedItem=e,this.onSelectionChanged(e))},Object.defineProperty(t.prototype,"selection",{get:function(){return this.selectedItem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"showOnlyPercentages",{get:function(){return this._showOnlyPercentages},set:function(e){this._showOnlyPercentages=e,this.refreshContent(),this.stateChanged("showOnlyPercentages",e)},enumerable:!1,configurable:!0}),t.prototype.getShowPercentagesDefault=function(){return void 0===this.options.showPercentages?-1!==["pie","doughnut"].indexOf(this.chartType):!0===this.options.showPercentages},Object.defineProperty(t.prototype,"showPercentages",{get:function(){return void 0!==this._showPercentages?this._showPercentages:this.getShowPercentagesDefault()},set:function(e){this._showPercentages=e,this.updateShowPercentageBtn(),this.refreshContent(),this.stateChanged("showPercentages",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"answersOrder",{get:function(){return this._answersOrder},set:function(e){this._answersOrder=e,this.updateOrderSelector(),this.refreshContent(),this.stateChanged("answersOrder",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hideEmptyAnswers",{get:function(){return this._hideEmptyAnswers},set:function(e){this._hideEmptyAnswers=e,this.updateEmptyAnswersBtn(),this.refreshContent(),this.stateChanged("hideEmptyAnswers",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transposeData",{get:function(){return this._transposeData},set:function(e){this._transposeData=e,this.updateTransposeDataBtn(),this.refreshContent(),this.stateChanged("transposeData",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"topN",{get:function(){return this._topN},set:function(e){this._topN=e,this.updateTopNSelector(),this.updateOrderSelector(),this.refreshContent(),this.stateChanged("topN",e)},enumerable:!1,configurable:!0}),t.prototype.isSupportAnswersOrder=function(){return!1!==this.options.allowSortAnswers&&!1!==this.options.allowChangeAnswersOrder&&0===this.getSeriesValues().length},t.prototype.isSupportMissingAnswers=function(){return!0},Object.defineProperty(t.prototype,"showMissingAnswers",{get:function(){return this._showMissingAnswers},set:function(e){this._showMissingAnswers=this.isSupportMissingAnswers()&&e,this.updateMissingAnswersBtn(),this.dataProvider.raiseDataChanged(this.name),this.refreshContent(),this.stateChanged("showMissingAnsewrs",e)},enumerable:!1,configurable:!0}),t.prototype.refreshContent=function(){this.contentContainer&&(this.destroyContent(this.contentContainer),this.renderContent(this.contentContainer)),this.invokeOnUpdate()},Object.defineProperty(t.prototype,"showValuesInOriginalOrder",{get:function(){return!1!==this.options.showValuesInOriginalOrder},enumerable:!1,configurable:!0}),t.prototype.valuesSource=function(){var e=this.question;return e.choicesFromQuestion&&e.survey&&(e=e.survey.getQuestionByName(e.choicesFromQuestion)),e.activeChoices||e.visibleChoices||e.choices||[]},t.prototype.getValues=function(){var e=this.valuesSource().map((function(e){return e.value}));return this.question.hasNone&&e.push(this.question.noneItem.value),this.question.hasOther&&e.push("other"),this.showMissingAnswers&&e.unshift(void 0),this.showValuesInOriginalOrder?e.reverse():e},t.prototype.getLabels=function(){var e=this;if(this.options.useValuesAsLabels)return this.getValues();var t=this.valuesSource().map((function(t){return n.ItemValue.getTextOrHtmlByValue(e.valuesSource(),t.value)})),i=this.question;return i.hasNone&&t.push(i.noneText),i.hasOther&&t.push(i.otherText),this.showMissingAnswers&&t.unshift(o.qG.getString("missingAnswersLabel")),this.showValuesInOriginalOrder?t.reverse():t},t.prototype.getPercentages=function(e){var t=[],i=this._percentagePrecision;if(e.length<2){var r=e[0].reduce((function(e,t){return e+t}),0);t[0]=e[0].map((function(e){var t=i?+(e/r*100).toFixed(i):Math.round(e/r*100);return r&&t}))}else for(var n=0;n<e[0].length;n++){r=0;for(var s=0;s<e.length;s++)r+=e[s][n];for(s=0;s<e.length;s++){Array.isArray(t[s])||(t[s]=[]);var o=i?+(e[s][n]/r*100).toFixed(i):Math.round(e[s][n]/r*100);t[s][n]=r&&o}}return t},t.prototype.getAnswersData=function(){return(0,r.sH)(this,void 0,void 0,(function(){var e,t,i,n,s,o,l,h,c,d;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return e=this.getSeriesLabels(),[4,this.getCalculatedValues()];case 1:return t=r.sent(),i=this.getLabels(),n=this.getColors(),this.transposeData&&(t=this.transpose(t),s=e,e=i,i=s),o=this.showPercentages?this.getPercentages(t):t,"asc"!=this.answersOrder&&"desc"!=this.answersOrder||(l=this.showPercentages?a.NW.zipArrays(i,n,o[0]):a.NW.zipArrays(i,n),h=a.NW.sortDictionary(l,t[0],"desc"==this.answersOrder),c=a.NW.unzipArrays(h.keys),i=c[0],n=c[1],this.showPercentages&&(o[0]=c[2]),t[0]=h.values),d={datasets:t,labels:i,colors:n,texts:o,seriesLabels:e},this.hideEmptyAnswers&&(d=u(d)),this.topN>0&&(d.datasets[0]=d.datasets[0].slice(-this.topN),d.labels=d.labels.slice(-this.topN),d.colors=d.colors.slice(-this.topN),d.texts[0]=d.texts[0].slice(-this.topN)),this.onAnswersDataReady.fire(this,d),[2,d]}}))}))},t.prototype.convertFromExternalData=function(e){var t=this.getValues(),i=this.getSeriesValues(),r=[];if(i.length>0)for(var n=0;n<i.length;n++){for(var s=[],o=0;o<t.length;o++)e[i[n]]?s.push(e[i[n]][t[o]]||0):s.push(0);r.push(s)}else{for(s=[],o=0;o<t.length;o++)s.push(e[t[o]]||0);r.push(s)}return r},t.prototype.transpose=function(e){for(var t=e[0].length,i=new Array(t),r=0;r<t;++r)i[r]=new Array(e.length);for(r=0;r<e.length;++r)for(var n=0;n<t;++n)i[n][r]=e[r][n];return i},t.prototype.getState=function(){var e=this,i={};return t._stateProperties.forEach((function(t){i[t]=e[t]})),this.selectedItem&&(i.filter=this.selectedItem.value),i},t.prototype.setState=function(e){var i=this;t._stateProperties.forEach((function(t){void 0!==e[t]&&(i[t]=e[t])}));var r=n.ItemValue.getItemByValue(this.question.visibleChoices,e.filter);this.setSelection(null!=r?r:void 0)},t.prototype.resetState=function(){e.prototype.resetState.call(this),this._hideEmptyAnswers=!0===this.options.hideEmptyAnswers,this._answersOrder=this.options.answersOrder||"default",this._topN=-1,this.chartType=this.chartTypes[0],this.setSelection(void 0)},t.topNValuesDefaults=[-1,5,10,20],t._stateProperties=["chartType","answersOrder","hideEmptyAnswers","topN"],t}(s.w);l.g.registerVisualizer("checkbox",h),l.g.registerVisualizer("radiogroup",h),l.g.registerVisualizer("dropdown",h),l.g.registerVisualizer("imagepicker",h),l.g.registerVisualizer("tagbox",h),l.g.registerVisualizer("rating",h,100)},226:(e,t,i)=>{"use strict";i.d(t,{YW:()=>g,Zl:()=>d,hA:()=>p});var r=i(87),n=i(156),s=i(555),o=i(183),a=i(557),l=i(873),u=i(70),h=i(240);function c(e){switch(Math.floor(e.getMonth()/3)+1){case 1:return"I";case 2:return"II";case 3:return"III";case 4:return"IV"}}function d(e,t){var i=new Date(e),r=new Date(t),n=12*(r.getFullYear()-i.getFullYear())+(r.getMonth()-i.getMonth());return n>120?"decades":n>24?"years":n>12?"quarters":n>4?"months":"days"}var p={decades:function(e,t){var i=[],r=new Date(e);r.setFullYear(10*Math.floor(r.getFullYear()/10)),r.setMonth(0),r.setDate(1),r.setHours(0,0,0,0);for(var n=r.getFullYear(),s=new Date(t).getFullYear();n<=s;){var o=new Date(n,0,1),a=new Date(n+10,0,1);i.push({start:o.getTime(),end:a.getTime(),label:n+"s"}),n+=10}return i},years:function(e,t){var i=[],r=new Date(e);r.setMonth(0),r.setDate(1),r.setHours(0,0,0,0);for(var n=r.getFullYear(),s=new Date(t).getFullYear();n<=s;){var o=new Date(n,0,1),a=new Date(n+1,0,1);i.push({start:o.getTime(),end:a.getTime(),label:""+n}),n++}return i},months:function(e,t){var i=[],r=new Date(e);r.setDate(1),r.setHours(0,0,0,0);for(var n=r.getFullYear(),s=r.getMonth(),o=new Date(t),a=o.getFullYear(),l=o.getMonth();n<a||n===a&&s<=l;){var u=new Date(n,s,1),h=new Date(n,s+1,1);i.push({start:u.getTime(),end:h.getTime(),label:u.toLocaleDateString(void 0,{year:"numeric",month:"short"})}),++s>=12&&(s=0,n++)}return i},quarters:function(e,t){var i=[],r=new Date(e);r.setDate(1),r.setHours(0,0,0,0);for(var n=r.getFullYear(),s=r.getMonth(),o=new Date(t),a=o.getFullYear(),l=o.getMonth();n<a||n===a&&s<=l;){var u=new Date(n,s,1),h=new Date(n,s+3,1);i.push({start:u.getTime(),end:h.getTime(),label:c(u)+" "+u.getFullYear().toString()}),(s+=3)>=12&&(s%=12,n++)}return i},days:function(e,t){var i=[],r=new Date(e);r.setHours(0,0,0,0);var n=new Date(t);for(n.setHours(0,0,0,0);r<=n;){var s=new Date(r),o=new Date(r);o.setDate(o.getDate()+1),i.push({start:s.getTime(),end:o.getTime(),label:s.toLocaleDateString()}),r.setDate(r.getDate()+1)}return i}},g=function(e){function t(t,i,r,n){var s=e.call(this,t,i,r,n||"histogram")||this;return s.valueType="number",s._cachedValues=void 0,s._continuousData=void 0,s._cachedIntervals=void 0,s._intervalPrecision=2,s.showRunningTotalsBtn=void 0,s.showGroupedBtn=void 0,s.changeIntervalsModeSelector=void 0,s.aggregateDataNameSelector=void 0,s.intervalModes=["auto","decades","years","quarters","months","days"],s._showRunningTotals=!1,s._showGrouped=!1,s._aggregateDataName="",s._transposeData=!1,void 0!==s.options.intervalPrecision&&(s._intervalPrecision=s.options.intervalPrecision),"text"!==t.getType()||"date"!==t.inputType&&"datetime"!==t.inputType?s.valueType="number":s.valueType="date",s._intervalsMode="date"===s.valueType?"auto":"default",s.allowChangeIntervals&&s.registerToolbarItem("changeIntervalsMode",(function(){return s.changeIntervalsModeSelector=u.gf.createSelector(s.intervalModes.map((function(e){return{value:e,text:h.qG.getString("intervalMode_"+e)}})),(function(e){return s.intervalsMode===e.value}),(function(e){s.intervalsMode=e.target.value}),h.qG.getString("intervalModeTitle")),s.changeIntervalsModeSelector})),s.possibleAggregateDataNames.length>0&&s.registerToolbarItem("aggregateDataName",(function(){var e=s.possibleAggregateDataNames.map((function(e){return"string"==typeof e?{value:e,text:e}:e}));return e.unshift({value:"",text:h.qG.getString("noneAggregateText")}),s.aggregateDataNameSelector=u.gf.createSelector(e,(function(e){return s.aggregateDataName===e.value}),(function(e){s.aggregateDataName=e.target.value}),h.qG.getString("selectAggregateText")),s.updateAggregateDataNameSelector(),s.aggregateDataNameSelector})),s.allowChangeIntervals&&s.options.allowRunningTotals&&s.registerToolbarItem("showRunningTotals",(function(){return s.showRunningTotalsBtn=u.gf.createButton((function(){s.showRunningTotals=!s.showRunningTotals})),s.updateShowRunningTotalsBtn(),s.showRunningTotalsBtn})),s.allowChangeIntervals&&s.options.allowCompareDatePeriods&&s.registerToolbarItem("showGrouped",(function(){return s.showGroupedBtn=u.gf.createButton((function(){s.showGrouped=!s.showGrouped})),s.updateShowGroupedBtn(),s.showGroupedBtn})),s}return(0,r.C6)(t,e),t.prototype.updateIntervalsModeSelector=function(){this.changeIntervalsModeSelector&&(this.changeIntervalsModeSelector.getElementsByTagName("select")[0].value=this.intervalsMode)},t.prototype.updateAggregateDataNameSelector=function(){this.aggregateDataNameSelector&&(this.aggregateDataNameSelector.getElementsByTagName("select")[0].value=this.aggregateDataName)},t.prototype.reset=function(){this._continuousData=void 0,this._cachedValues=void 0,this._cachedIntervals=void 0},t.prototype.getContinuousValue=function(e){return"date"===this.valueType?Date.parse(e):parseFloat(e)},t.prototype.getString=function(e){return"date"===this.valueType?new Date(e).toLocaleDateString():""+e},t.prototype.toPrecision=function(e){var t=Math.pow(10,this._intervalPrecision);return Math.round(t*e)/t},t.prototype.getSelectedItemByText=function(e){if(this.hasCustomIntervals||this.getContinuousValues().length>t.UseIntervalsFrom){var i=this.intervals.filter((function(t){return t.label===e}))[0];return new n.ItemValue(i,void 0!==i?i.label:"")}var r=this.getLabels(),s=r.indexOf(e);return new n.ItemValue(this.getValues()[s],r[s])},t.prototype.updateData=function(t){this.reset(),e.prototype.updateData.call(this,t)},t.prototype.onDataChanged=function(){this.reset(),e.prototype.onDataChanged.call(this)},t.prototype.onSelectionChanged=function(t){if(void 0!==t&&void 0!==this.onDataItemSelected&&"date"===this.valueType){var i=this.intervalModes.indexOf(this.intervalsMode);i>0&&i<this.intervalModes.length-1&&(this.intervalsMode=this.intervalModes[i+1])}e.prototype.onSelectionChanged.call(this,t)},t.prototype.getContinuousValues=function(){var e=this;if(void 0===this._cachedValues){var t=this.getSeriesValues();0===t.length&&t.push(""),this._continuousData={},t.forEach((function(t){return e._continuousData[t]=[]}));var i={};this.data.forEach((function(t){(0,l.XZ)(t,e).forEach((function(t){var r=t[e.dataNames[0]];if(void 0!==r){var n=t[s.M.seriesMarkerKey]||"";e._continuousData[n].push({continuous:e.getContinuousValue(r),row:t}),i[r]=r}}))})),this._cachedValues=Object.keys(i).map((function(t){return{original:i[t],continuous:e.getContinuousValue(t),row:i[t].row}})),this._cachedValues.sort((function(e,t){return e.continuous-t.continuous}))}return this._cachedValues},t.prototype.isSupportSoftUpdateContent=function(){return!1},t.prototype.isSupportMissingAnswers=function(){return!1},Object.defineProperty(t.prototype,"needUseRateValues",{get:function(){return"rating"==this.question.getType()&&Array.isArray(this.question.rateValues)&&this.question.rateValues.length>0},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.intervals.map((function(e){return e.start}))},t.prototype.getLabels=function(){return this.intervals.map((function(e){return e.label}))},Object.defineProperty(t.prototype,"hasCustomIntervals",{get:function(){return!!this.questionOptions&&Array.isArray(this.questionOptions.intervals)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intervals",{get:function(){if(this.hasCustomIntervals)return this.questionOptions.intervals;if("rating"==this.question.getType()){if(this.needUseRateValues){var e=this.question.rateValues;return e.sort((function(e,t){return e.value-t.value})),e.map((function(t,i){return{start:t.value,end:i<e.length-1?e[i+1].value:t.value+1,label:t.text}}))}for(var i=[],r=this.question.rateMin||0;r<=(this.question.rateMax||t.IntervalsCount-1);r+=this.question.rateStep||1)i.push({start:r,end:r+1,label:""+(this.question.rateMin&&this.question.rateMax?r:r+"-"+(r+1))});return i}if(void 0===this._cachedIntervals){var n=this.getContinuousValues();if(this._cachedIntervals=[],n.length){var s=n[0].continuous,o=n[n.length-1].continuous,a="auto"===this.intervalsMode?d(s,o):this.intervalsMode;if(void 0!==p[a])this._cachedIntervals=p[a](s,o);else{var l=t.IntervalsCount,u=(o-s)/l;for(r=0;r<l;++r){var h=s+u,c=this.toPrecision(s),g=this.toPrecision(h);this._cachedIntervals.push({start:c,end:r<l-1?g:g+u/100,label:this.getString(c)+"-"+this.getString(g)}),s=h}}}}return this._cachedIntervals},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"intervalsMode",{get:function(){return this.hasCustomIntervals?"custom":this._intervalsMode},set:function(e){this.allowChangeIntervals&&this._intervalsMode!==e&&(this._intervalsMode=e,this.canShowGroupedDateSeries||(this._showGrouped=!1),this.updateIntervalsModeSelector(),this.updateShowGroupedBtn(),this.onDataChanged())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"allowChangeIntervals",{get:function(){return"date"===this.valueType&&!this.hasCustomIntervals&&!0===this.options.allowChangeIntervals},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"showRunningTotals",{get:function(){return this._showRunningTotals},set:function(e){this._showRunningTotals=e,this.updateShowRunningTotalsBtn(),this.stateChanged("showRunningTotals",e),this.refreshContent()},enumerable:!1,configurable:!0}),t.prototype.updateShowRunningTotalsBtn=function(){this.showRunningTotalsBtn&&(this.showRunningTotalsBtn.innerText=this.showRunningTotals?h.qG.getString("noRunningTotals"):h.qG.getString("runningTotals"))},Object.defineProperty(t.prototype,"showGrouped",{get:function(){return this._showGrouped},set:function(e){this._showGrouped=e,this.updateShowGroupedBtn(),this.stateChanged("showGrouped",e),this.refreshContent()},enumerable:!1,configurable:!0}),t.prototype.updateShowGroupedBtn=function(){this.showGroupedBtn&&(this.showGroupedBtn.innerText=this.showGrouped?h.qG.getString("ungroupDateSeries"):h.qG.getString("groupDateSeries"),this.showGroupedBtn.style.display=this.canShowGroupedDateSeries?"inline":"none")},Object.defineProperty(t.prototype,"canShowGroupedDateSeries",{get:function(){return-1!==["years","quarters","months"].indexOf(this.intervalsMode)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aggregateDataName",{get:function(){return this._aggregateDataName},set:function(e){this._aggregateDataName!==e&&(this._aggregateDataName=e,this.onDataChanged())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"possibleAggregateDataNames",{get:function(){var e,t;return null!==(t=null===(e=this.questionOptions)||void 0===e?void 0:e.aggregateDataNames)&&void 0!==t?t:[]},enumerable:!1,configurable:!0}),t.prototype.convertFromExternalData=function(e){return[e]},t.prototype.getCalculatedValuesCore=function(){return this.getContinuousValues(),(0,l.er)(this._continuousData,this.intervals,this,[this.aggregateDataName].filter((function(e){return!!e})))},t.prototype.getCalculatedValues=function(){return(0,r.sH)(this,void 0,void 0,(function(){var t,i,n,s;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,e.prototype.getCalculatedValues.call(this)];case 1:if(t=r.sent(),i=JSON.parse(JSON.stringify(t)),this.showRunningTotals)for(n=0;n<i.length;n++)for(s=1;s<i[n].length;s++)i[n][s]+=i[n][s-1];return[2,i]}}))}))},t.prototype.getGroupedDateAnswersData=function(){return(0,r.sH)(this,void 0,void 0,(function(){var e,t,i,n,s,o,a,l,u,h,c,d,p,g,f,m,v,_,y;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return[4,this.getCalculatedValues()];case 1:if(e=r.sent(),t=this.getColors(),i=this.getLabels(),n=this.getSeriesLabels(),s=[].concat(this.intervals),o=new Date(s[0].start),a=new Date(s[s.length-1].end),l=o.getFullYear(),u=a.getFullYear(),"years"===this.intervalsMode){for(n=[],g=[],y=10*Math.floor(l/10);y<=u;y+=10)n.push(y.toString()+"s"),g.push(new Array(10).fill(0));for(f=0;f<s.length;f++)m=s[f],v=new Date(m.start),h=10*Math.floor(v.getFullYear()/10),c=v.getFullYear()-h,d=Math.floor((h-10*Math.floor(l/10))/10),g[d][c]=e[0][f];e=g,i=["0","1","2","3","4","5","6","7","8","9"]}else if("quarters"===this.intervalsMode){for(n=[],g=[],y=l;y<=u;y++)n.push(y.toString()),g.push(new Array(4).fill(0));for(f=0;f<s.length;f++)m=s[f],v=new Date(m.start),p=Math.floor(v.getMonth()/3),y=v.getFullYear(),g[y-l][p]=e[0][f];e=g,i=["I","II","III","IV"]}else if("months"===this.intervalsMode){for(n=[],g=[],y=l;y<=u;y++)n.push(y.toString()),g.push(new Array(12).fill(0));for(f=0;f<s.length;f++)m=s[f],v=new Date(m.start),_=v.getMonth(),y=v.getFullYear(),g[y-l][_]=e[0][f];e=g,i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}return[2,{datasets:e,labels:i,colors:t,texts:e,seriesLabels:n}]}}))}))},t.prototype.getAnswersData=function(){return(0,r.sH)(this,void 0,void 0,(function(){var t,i,n,s;return(0,r.YH)(this,(function(r){switch(r.label){case 0:return this.showGrouped?[4,this.getGroupedDateAnswersData()]:[2,e.prototype.getAnswersData.call(this)];case 1:return t=r.sent(),(i=this.getContinuousValues()).length&&(n=i[0].continuous,s=i[i.length-1].continuous,"years"===("auto"===this.intervalsMode?d(n,s):this.intervalsMode)&&this.showGrouped&&(t.labelsTitle=h.qG.getString("groupedYearsAxisTitle"))),this.onAnswersDataReady.fire(this,t),[2,t]}}))}))},t.prototype.getValueType=function(){return this.valueType},t.IntervalsCount=10,t.UseIntervalsFrom=10,t}(o.o);a.g.registerVisualizer("date",g),a.g.registerVisualizer("number",g,100),a.g.registerVisualizer("rating",g,300)},240:(e,t,i)=>{"use strict";i.d(t,{DQ:()=>o,UN:()=>a,qG:()=>s});var r=i(391),n=i(156),s={currentLocaleValue:"",defaultLocaleValue:"en",locales:{},localeNames:{},supportedLocales:[],get currentLocale(){return this.currentLocaleValue===this.defaultLocaleValue?"":this.currentLocaleValue},set currentLocale(e){this.currentLocaleValue=e},get defaultLocale(){return this.defaultLocaleValue},set defaultLocale(e){this.defaultLocaleValue=e},setupLocale:function(e,t){this.locales[e]=t},getLocaleName:function(e,t){return void 0===t&&(t=!1),(t?"":this.localeNames[e])||n.surveyLocalization.getLocaleName(e,t)},getString:function(e){var t=this.currentLocale?this.locales[this.currentLocale]:this.locales[this.defaultLocale];t&&t[e]||(t=this.locales[this.defaultLocale]);var i=t[e];return void 0===i&&(i=this.locales.en[e]||e),i},getLocales:function(){var e=[];if(e.push(""),this.supportedLocales&&this.supportedLocales.length>0)for(var t=0;t<this.supportedLocales.length;t++)e.push(this.supportedLocales[t]);else for(var i in this.locales)e.push(i);return e.sort(),e}},o=r.z;function a(e){var t=e.localeCode;s.setupLocale(t,e.strings),e.nativeName&&(s.localeNames[t]=e.nativeName)}a({localeCode:"en",strings:r.z,nativeName:"English"})},267:(e,t,i)=>{"use strict";i.d(t,{b:()=>c,w:()=>d});var r=i(87),n=i(156),s=i(555),o=i(818),a=i(557),l=i(70),u=i(240),h=i(873),c=function(){function e(){}return e.postpone=function(t,i){return e.postponeFunction?e.postponeFunction(t,i):setTimeout(t,i)},e}(),d=function(){function e(t,i,r,o){void 0===r&&(r={});var a,l=this;this.question=t,this.options=r,this._type=o,this._showToolbar=!0,this._footerVisualizer=void 0,this._dataProvider=void 0,this._getDataCore=void 0,this.labelTruncateLength=27,this.haveCommercialLicense=!1,this.renderResult=void 0,this.toolbarContainer=void 0,this.headerContainer=void 0,this.contentContainer=void 0,this.footerContainer=void 0,this._supportSelection=!1,this._chartAdapter=void 0,this._footerIsCollapsed=void 0,this.onAfterRender=new n.Event,this.onLocaleChanged=new n.Event,this.onStateChanged=new n.Event,this.toolbarItemCreators={},this._backgroundColor="#f7f7f7",this._calculationsCache=void 0,this.loadingData=!1,this._settingState=!1;var u=n.hasLicense;this.haveCommercialLicense=!!u&&u(4)||e.haveCommercialLicense||void 0!==r.haveCommercialLicense&&r.haveCommercialLicense,this._getDataCore=null===(a=this.questionOptions)||void 0===a?void 0:a.getDataCore,this._dataProvider=r.dataProvider||new s.M(i),this._dataProvider.onDataChanged.add((function(){return l.onDataChanged()})),this.loadingData=!!this._dataProvider.dataFn,void 0!==r.labelTruncateLength&&(this.labelTruncateLength=r.labelTruncateLength)}return e.prototype.afterRender=function(e){this.onAfterRender.fire(this,{htmlElement:e})},e.prototype.stateChanged=function(e,t){this._settingState||this.onStateChanged.fire(this,this.getState())},e.prototype.getToolbarItemCreators=function(){return Object.assign({},this.toolbarItemCreators,this.onGetToolbarItemCreators&&this.onGetToolbarItemCreators()||{})},Object.defineProperty(e.prototype,"questionOptions",{get:function(){var e;return this.options[null===(e=this.question)||void 0===e?void 0:e.name]},enumerable:!1,configurable:!0}),e.prototype.onDataChanged=function(){this._calculationsCache=void 0,this.loadingData=!!this._dataProvider.dataFn,this.refresh()},Object.defineProperty(e.prototype,"name",{get:function(){return this.question.valueName||this.question.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataNames",{get:function(){return[this.name]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataPath",{get:function(){return this.options.dataPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasHeader",{get:function(){return!!(this.options&&this.options.showCorrectAnswers&&this.question&&this.question.correctAnswer)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasFooter",{get:function(){return!!this.question&&(this.question.hasComment||this.question.hasOther)},enumerable:!1,configurable:!0}),e.prototype.createVisualizer=function(e,t,i){var r=Object.assign({},t||this.options);return void 0===r.dataProvider&&(r.dataProvider=this.dataProvider),o.D.createVisualizer(e,i||this.data,r)},Object.defineProperty(e.prototype,"footerVisualizer",{get:function(){var e=this;if(this.hasFooter){if(!this._footerVisualizer){var t=new n.QuestionCommentModel(this.question.name+(n.settings||{}).commentPrefix);t.title=this.processText(this.question.title);var i=Object.assign({},this.options);i.renderContent=void 0,this._footerVisualizer=this.createVisualizer(t,i),this._footerVisualizer&&(this._footerVisualizer.onUpdate=function(){return e.invokeOnUpdate()})}return this._footerVisualizer}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supportSelection",{get:function(){return(void 0===this.options.allowSelection||this.options.allowSelection)&&this._supportSelection},enumerable:!1,configurable:!0}),e.prototype.getSeriesValues=function(){return this.options.seriesValues||[]},e.prototype.getSeriesLabels=function(){return this.options.seriesLabels||this.getSeriesValues()},e.prototype.getValues=function(){throw new Error("Method not implemented.")},e.prototype.getLabels=function(){return this.getValues()},e.prototype.registerToolbarItem=function(e,t,i){void 0===i&&(i=100),this.toolbarItemCreators[e]={creator:t,order:i}},e.prototype.unregisterToolbarItem=function(e){if(void 0!==this.toolbarItemCreators[e]){var t=this.toolbarItemCreators[e];return delete this.toolbarItemCreators[e],t.creator}},Object.defineProperty(e.prototype,"title",{get:function(){return this.getTitle(this.question)},enumerable:!1,configurable:!0}),e.prototype.getTitle=function(e){var t;return void 0===e?"":this.processText((null===(t=e.locTitle)||void 0===t?void 0:t.renderedHtml)?e.locTitle.renderedHtml:e.title)},Object.defineProperty(e.prototype,"type",{get:function(){return this._type||"visualizer"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.dataProvider.filteredData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"surveyData",{get:function(){return this.dataProvider.filteredData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataProvider",{get:function(){return this._dataProvider},enumerable:!1,configurable:!0}),e.prototype.updateData=function(e){this.dataProvider.data=e,this.hasFooter&&this.footerVisualizer.updateData(e)},e.prototype.invokeOnUpdate=function(){this.onUpdate&&this.onUpdate()},e.prototype.destroy=function(){this.renderResult&&(this.clear(),this.toolbarContainer=void 0,this.headerContainer=void 0,this.contentContainer=void 0,this.footerContainer=void 0,this.renderResult.innerHTML="",this.renderResult=void 0),this._footerVisualizer&&(this._footerVisualizer.destroy(),this._footerVisualizer.onUpdate=void 0,this._footerVisualizer=void 0)},e.prototype.clear=function(){this.toolbarContainer&&this.destroyToolbar(this.toolbarContainer),this.headerContainer&&this.destroyHeader(this.headerContainer),this.contentContainer&&this.destroyContent(this.contentContainer),this.footerContainer&&this.destroyFooter(this.footerContainer)},e.prototype.createToolbarItems=function(e){var t=this.getToolbarItemCreators();Object.keys(t||{}).map((function(e){return(0,r.Cl)({name:e},t[e])})).sort((function(e,t){return e.order-t.order})).forEach((function(t){var i=t.creator(e);i&&e.appendChild(i)}))},e.prototype.getCorrectAnswerText=function(){return this.question?this.question.correctAnswer:""},e.prototype.destroyToolbar=function(e){e.innerHTML=""},e.prototype.renderToolbar=function(e){if(this.showToolbar){var t=l.gf.createElement("div","sa-toolbar");this.createToolbarItems(t),e.appendChild(t)}},e.prototype.destroyHeader=function(e){this.options&&"function"==typeof this.options.destroyHeader?this.options.destroyHeader(e,this):e.innerHTML=""},e.prototype.destroyContent=function(e){this.options&&"function"==typeof this.options.destroyContent?this.options.destroyContent(e,this):this._chartAdapter&&this._chartAdapter.destroy(e.children[0]),e.innerHTML=""},e.prototype.renderHeader=function(e){if(this.options&&"function"==typeof this.options.renderHeader)this.options.renderHeader(e,this);else{var t=l.gf.createElement("div","sa-visualizer__correct-answer");t.innerText=u.qG.getString("correctAnswer")+this.getCorrectAnswerText(),e.appendChild(t)}},e.prototype.renderContentAsync=function(e){return(0,r.sH)(this,void 0,void 0,(function(){var t;return(0,r.YH)(this,(function(i){switch(i.label){case 0:return this._chartAdapter?(t=l.gf.createElement("div"),e.innerHTML="",e.appendChild(t),[4,this._chartAdapter.create(t)]):[3,2];case 1:return i.sent(),[3,3];case 2:e.innerText=u.qG.getString("noVisualizerForQuestion"),i.label=3;case 3:return[2,e]}}))}))},e.prototype.ensureQuestionIsReady=function(){var e=this;return new Promise((function(t){e.question?e.question.waitForQuestionIsReady().then((function(){return t()})):t()}))},e.prototype.renderContent=function(e){var t=this;this.options&&"function"==typeof this.options.renderContent?!1!==this.options.renderContent(e,this)&&this.afterRender(e):(this.loadingData&&this.renderLoadingIndicator(this.contentContainer),this.ensureQuestionIsReady().then((function(){return t.renderContentAsync(e).then((function(e){return t.afterRender(e)}))})))},e.prototype.destroyFooter=function(e){e.innerHTML=""},Object.defineProperty(e.prototype,"isFooterCollapsed",{get:function(){return void 0===this._footerIsCollapsed&&(this._footerIsCollapsed=e.otherCommentCollapsed),this._footerIsCollapsed},set:function(e){this._footerIsCollapsed=e},enumerable:!1,configurable:!0}),e.prototype.renderFooter=function(e){var t=this;if(e.innerHTML="",this.hasFooter){var i=l.gf.createElement("h4","sa-visualizer__footer-title",{innerText:u.qG.getString("otherCommentTitle")});e.appendChild(i);var r=l.gf.createElement("div","sa-visualizer__footer-content");r.style.display=this.isFooterCollapsed?"none":"block";var n=u.qG.getString(this.isFooterCollapsed?"showButton":"hideButton"),s=l.gf.createButton((function(){"none"===r.style.display?(r.style.display="block",s.innerText=u.qG.getString("hideButton"),t._footerIsCollapsed=!1):(r.style.display="none",s.innerText=u.qG.getString("showButton"),t._footerIsCollapsed=!0),t.footerVisualizer.invokeOnUpdate()}),n);e.appendChild(s),e.appendChild(r),this.footerVisualizer.render(r)}},e.prototype.render=function(e){"string"==typeof e&&(e=document.getElementById(e)),this.renderResult=e,this.toolbarContainer=l.gf.createElement("div","sa-visualizer__toolbar"),e.appendChild(this.toolbarContainer),this.renderToolbar(this.toolbarContainer),this.hasHeader&&(this.headerContainer=l.gf.createElement("div","sa-visualizer__header"),e.appendChild(this.headerContainer),this.renderHeader(this.headerContainer)),this.contentContainer=l.gf.createElement("div","sa-visualizer__content"),e.appendChild(this.contentContainer),this.renderContent(this.contentContainer),this.footerContainer=l.gf.createElement("div","sa-visualizer__footer"),e.appendChild(this.footerContainer),this.renderFooter(this.footerContainer)},e.prototype.updateToolbar=function(){var e=this;this.toolbarContainer&&c.postpone((function(){e.destroyToolbar(e.toolbarContainer),e.renderToolbar(e.toolbarContainer)}))},e.prototype.isSupportSoftUpdateContent=function(){return!1},e.prototype.softUpdateContent=function(){},e.prototype.hardUpdateContent=function(){this.destroyContent(this.contentContainer),this.renderContent(this.contentContainer)},e.prototype.updateContent=function(){this.isSupportSoftUpdateContent()?this.softUpdateContent():this.hardUpdateContent()},e.prototype.refresh=function(){var e=this;this.headerContainer&&c.postpone((function(){e.destroyHeader(e.headerContainer),e.renderHeader(e.headerContainer),e.invokeOnUpdate()})),this.contentContainer&&c.postpone((function(){e.updateContent(),e.invokeOnUpdate()})),this.footerContainer&&c.postpone((function(){e.destroyFooter(e.footerContainer),e.renderFooter(e.footerContainer),e.invokeOnUpdate()}))},e.prototype.processText=function(e){return!1!==this.options.stripHtmlFromTitles?(e||"").replace(/(<([^>]+)>)/gi,""):e},e.prototype.getRandomColor=function(){var e=this.getColors();return e[Math.floor(Math.random()*e.length)]},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this.getBackgroundColorCore()},set:funct