fenix-ui-visualization-box
Version:
FENIX resource visualization box
2 lines • 166 kB
JavaScript
define(["loglevel","jquery","underscore","underscore.string","fenix-ui-pivotator-utils","fenix-ui-filter-utils","fenix-ui-metadata-viewer","fenix-ui-dropdown","fenix-ui-bridge","fenix-ui-reports","swiper","amplify-pubsub","fenix-ui-filter","fenix-ui-chart-creator","bootstrap","fenix-ui-map-creator","fenix-ui-table-creator"],function(t,e,a,n,i,o,r,s,l,c,u,d,h,p,b,_,f){return function(t){function e(n){if(a[n])return a[n].exports;var i=a[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var a={};return e.m=t,e.c=a,e.p="",e(0)}([function(t,e,a){t.exports=a(1)},function(t,e,a){var n,i;n=[a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(14),a(15),a(16),a(36),a(37),a(38),a(39),a(40),a(41),a(42),a(43),a(44),a(11),a(45),a(46),a(47),a(48)],i=function(t,e,n,i,o,r,s,l,c,u,d,h,p,b,_,f,g,m,v,y,S,T,x,w,E){"use strict";function O(n){t.info("Create box"),t.info(n),a(49),a(57),e.extend(!0,this,o,{initial:n||{},$el:e(n.el)});var i=this._validateInput();return i===!0?(this._initState(),this._initVariables(),this._initObj(),this._setStatus("loading"),this._renderMenu(),this._bindEventListeners(),this._initTabSources(),this.valid=!0,this._getModelInfo(),this._reactToModelStatus(),this):(this.valid=!1,t.error("Impossible to create visualization box"),t.error(i),this._setObjState("error",i),void 0)}var R={filter:_,map:f,metadata:g},L={BOX:"[data-role='box']",CONTENT_READY:"[data-content='ready']",RIGHT_MENU:"[data-role='right-menu']",FLIP_CONTAINER:"[data-role='flip-container']",FLIP_BUTTONS:"[data-action='flip']",FRONT_CONTENT:"[data-role='front-content']",FRONT_TOOLBAR:"[data-role='front-toolbar']",BACK_TOOLBAR:"[data-role='back-toolbar']",PROCESS_STEPS:"[data-role='process-steps']",PROCESS_DETAILS:"[data-role='process-details']",BACK_CONTENT:"[data-role='back-content']",BOX_TITLE:"[data-role='box-title']",QUERY_BUTTON:"[data-action='query']",ERROR_TEXT:"[data-role='error-text']",EMPTY_FILTER_BUTTON:"[data-content='empty'] [data-action='filter'], [data-content='error'] [data-action='filter']",BACK_FILTER_ERRORS:"[data-role='filter-error']",FILTER_AGGREGATION_TEMPLATE:"[data-role='filter-aggregation-template']",FILTER_FILTER_TEMPLATE:"[data-role='filter-filter-template']",FILTER_MAP_TEMPLATE:"[data-role='filter-map-template']",ROWS_SWIPER:"[data-role='filter-rows-swiper']",BTN_SIDEBAR:"[data-action='show-back-sidebar']",SIDEBAR:"[data-role='back-sidebar']",FRONT_FACE:"[data-face='front']",BACK_FACE:"[data-face='back']",OTHER_CONTENT:"[data-content='empty'], [data-content='error'], [data-content='huge'], [data-content='toomany']"},C="./tabs/";return O.prototype.render=function(a){t.info("Render model for box ["+this.id+"]:"),t.info(a),e.extend(!0,this,a),this._reactToModelStatus()},O.prototype.dispose=function(){this._dispose(),t.info("Box ["+this.id+"] disposed")},O.prototype.setStatus=function(t){this._setStatus(t)},O.prototype.showTab=function(t,e){this._showFrontTab(t,e)},O.prototype.setSize=function(t){this._setSize(t)},O.prototype.flip=function(t){return this._flip(t)},O.prototype.on=function(t,e,a){var n=a||this;return this.channels[t]||(this.channels[t]=[]),this.channels[t].push({context:n,callback:e}),this},O.prototype.getState=function(){return this.state},O.prototype.setTitle=function(e){t.info("Set box title: "+e),this._updateBoxTitle(e)},O.prototype._validateInput=function(){var e=!0,a=[];return this.id||(window.fx_vis_box_id>=0?window.fx_vis_box_id++:window.fx_vis_box_id=0,this.id="fx-box-"+window.fx_vis_box_id,this._setObjState("id",this.id),t.info("Set box id: "+this.id)),0===this.$el.length&&(a.push({code:r.MISSING_CONTAINER}),t.warn("Impossible to find box container")),a.length>0?a:e},O.prototype._initVariables=function(){this.front_tab_instances={},this.back_tab_instances={},this.serviceProvider=this.initial.serviceProvider,this.bridge=new T({environment:this._getObjState("environment"),cache:this._getObjState("cache"),serviceProvider:this.serviceProvider}),this.report=new x({environment:this._getObjState("environment"),cache:this._getObjState("cache"),serviceProvider:this.serviceProvider})},O.prototype._initObj=function(){var t=e(d(e.extend(!0,{},this.getState(),this._getObjState("nls"))));this.$el.html(t),this.channels={},this.hasMenu=this.$el.find(L.RIGHT_MENU).length>0,this.flip(this._getObjState("face")),this.$processSteps=this.$el.find(L.PROCESS_STEPS),this.$processStepDetails=this.$el.find(L.PROCESS_DETAILS),this.$boxTitle=this.$el.find(L.BOX_TITLE)},O.prototype._initState=function(){var t=this.initial.lang||o.lang;t=t.toLowerCase(),this._setObjState("lang",t),this._setObjState("hideToolbar",!!this.initial.hideToolbar),this._setObjState("hideMenu",!!this.initial.hideMenu),this._setObjState("hideMetadataButton",!!this.initial.hideMetadataButton),this._setObjState("hideRemoveButton",!!this.initial.hideRemoveButton),this._setObjState("hideDownloadButton",!!this.initial.hideDownloadButton),this._setObjState("hideCloneButton",!!this.initial.hideCloneButton),this._setObjState("hideFlipButton",!!this.initial.hideFlipButton),this._setObjState("hideMinimizeButton",!!this.initial.hideMinimizeButton),this._setObjState("tabStates",this.initial.tabStates||{}),this._setObjState("tabOptions",this.initial.tabOptions||{}),this._setObjState("tab",this.initial.tab),this._setObjState("tabConfig",this.initial.tabConfig||o.tabConfig),this._setObjState("face",this.initial.face||o.face),this._setObjState("faces",this.initial.faces||o.faces),this._setObjState("model",this.initial.model),this._setObjState("version",this.initial.version?this.initial.version:void 0),this._setObjState("values",this.initial.values),this._setObjState("process",this.initial.process||[]),this._setObjState("uid",this.initial.uid||l.getNestedProperty("metadata.uid",this._getObjState("model"))),this._setObjState("size",this.initial.size||o.size),this._setObjState("status",this.initial.status||o.status),this._setObjState("environment",this.initial.environment),this._setObjState("maxDataSize",this.initial.maxDataSize||o.maxDataSize),this._setObjState("minDataSize",this.initial.minDataSize||o.minDataSize),this._setObjState("cache","boolean"==typeof this.initial.cache?this.initial.cache:o.cache),this._setObjState("backFilter",this.initial.backFilter),this._setObjState("backMap",this.initial.backMap);var a=e.extend(!0,this.initial.loadResourceServiceQueryParams||o.loadResourceServiceQueryParams,{language:"EN"!==this._getObjState("lang").toUpperCase()?"EN,"+this._getObjState("lang").toUpperCase():"EN"});this._setObjState("loadResourceServiceQueryParams",a),this._setObjState("menuModel",this.initial.menu||v),this._setObjState("title",this.initial.title||this._getModelTitle),this._setObjState("showFilter","boolean"==typeof this.initial.showFilter&&this.initial.showFilter),this._setObjState("nls",e.extend(!0,{},S[this._getObjState("lang")],this.initial.nls))},O.prototype._setObjState=function(t,e){return l.assign(this.state,t,e),e},O.prototype._getObjState=function(t){return l.getNestedProperty(t,this.getState())},O.prototype._reactToModelStatus=function(e){t.info("React to model status: "),t.info(e),this._setObjState("error",null);var a=e||this._getModelStatus();switch(t.info("Status found: "),t.info(a),a){case"ready":this._getModelInfo(),this._renderBox();break;case"empty":this.setStatus("empty");break;case"huge":this.setStatus("huge");break;case"toomany":this.setStatus("toomany");break;case"no_model":this.setStatus("loading");break;case"to_load":this._loadResource().then(n.bind(this._onLoadResourceSuccess,this),n.bind(this._onLoadResourceError,this));break;case"missing_metadata":this._loadResourceMetadata().then(n.bind(this._loadResourceMetadataSuccess,this),n.bind(this._loadResourceMetadataError,this));break;case"to_filter":this._forceModelFilter();break;default:this.setStatus("error")}},O.prototype._getModelStatus=function(){var t=(this._getObjState("uid"),this._getObjState("process"),this._getObjState("version"),this._getObjState("model")),e=this._getObjState("model.metadata"),a=this._getObjState("resourceRepresentationType");if(n.isEmpty(e))return"missing_metadata";if("dataset"===a&&t){if("object"!=typeof t)return"error";if(!t.size||0===t.size)return"empty";if(!Array.isArray(t.data))return"to_filter";if(Array.isArray(t.data)&&t.data.length<=this._getObjState("minDataSize"))return"empty";if(t.data.length>this._getObjState("maxDataSize"))return"huge";if(Array.isArray(t.data)&&t.data.length>0)return"ready"}if("geographic"===a){var i=this._getObjState("model.metadata.dsd"),o=i.workspace,s=i.layerName;if(o&&s)return"ready"}return this._setObjState("error",{code:r.RESOURCE_STATUS}),"error"},O.prototype._loadResource=function(a){t.info("Loading FENIX resource"),this.setStatus("loading"),this._setObjState("showFilter",!0);var n=this._getObjState("loadResourceServiceQueryParams"),i=Array.isArray(a)?a:[];return this._setObjState("process",i.slice(0)),this.bridge.getProcessedResource({body:i,uid:this._getObjState("uid"),version:this._getObjState("version"),params:e.extend(!0,{},n)})},O.prototype._onLoadResourceError=function(e){return t.error("Impossible to load resource"),t.error(e),'"Result limit exceeded exception"'==e.responseText?(this._setObjState("toomany",{code:r.LOAD_RESOURCE,filter:!0}),void this._setStatus("toomany")):(t.error({code:r.LOAD_RESOURCE}),this._setObjState("error",{code:r.LOAD_RESOURCE,filter:!0}),void this._setStatus("error"))},O.prototype._onLoadResourceSuccess=function(e){t.info("Load resource success"),this._disposeBoxFaces(),this._updateModel(e),this._getModelInfo(),this.setStatus("ready"),this._reactToModelStatus()},O.prototype._updateModel=function(t){var e=this._getObjState("model")||{},a=l.getNestedProperty("metadata",t),i=l.getNestedProperty("dsd",a)||{},o=l.getNestedProperty("data",t),r=l.getNestedProperty("size",t),s=n.without(Object.keys(i),"rid");s.length>0&&l.assign(e,"metadata.dsd",i),Array.isArray(o)&&l.assign(e,"data",o),e.size!==r&&l.assign(e,"size",r),this._setObjState("model",e)},O.prototype._loadResourceMetadata=function(){t.info("Loading FENIX resource metadata"),this.setStatus("loading");var a=this._getObjState("loadResourceServiceQueryParams");return this.bridge.getMetadata({uid:this._getObjState("uid"),version:this._getObjState("version"),params:e.extend(a,{dsd:!0,full:!0})})},O.prototype._loadResourceMetadataError=function(){t.error("Impossible to load resource"),t.error({code:r.LOAD_METADATA}),this._setObjState("error",{code:r.LOAD_METADATA}),this._setStatus("error")},O.prototype._loadResourceMetadataSuccess=function(e){t.info("Load resource metadata success"),t.info(e),this._setObjState("model",{metadata:e}),this._checkResourceType()},O.prototype._checkResourceType=function(){t.info("Check Resource type"),this._getModelInfo();var e=this._getObjState("resourceRepresentationType");switch(t.info("Check resource type: "+e),e){case"dataset":var a=l.getNestedProperty("metadata.dsd.datasources",this._getObjState("model"));n.isArray(a)&&a.length>0?this._getObjState("process").length>0?(t.info("Process present. Load resource instead of fetch()"),this._loadResource(this._getObjState("process")).then(n.bind(this._onLoadResourceSuccess,this),n.bind(this._onLoadResourceError,this))):this._fetchResource().then(n.bind(this._fetchResourceSuccess,this),n.bind(this._fetchResourceError,this)):(t.error({code:r.UNKNOWN_RESOURCE_TYPE}),this._setObjState("error",{code:r.MISSING_DATASOURCES}),this._setStatus("error"));break;case"geographic":this.setStatus("ready"),this._reactToModelStatus();break;default:t.error({code:r.UNKNOWN_RESOURCE_TYPE}),this._setObjState("error",{code:r.UNKNOWN_RESOURCE_TYPE}),this._setStatus("error")}},O.prototype._fetchResource=function(){return t.info("Fetching FENIX resource"),this.setStatus("loading"),this._setObjState("showFilter",!1),this.bridge.getResource({body:[],uid:this._getObjState("uid"),version:this._getObjState("version"),params:e.extend(!0,{},{perPage:1})})},O.prototype._fetchResourceError=function(e){t.error("Impossible to fetch resource"),t.error(e),t.error({code:r.FETCH_RESOURCE}),this._setObjState("error",{code:r.FETCH_RESOURCE}),this._setStatus("error")},O.prototype._fetchResourceSuccess=function(e){t.info("Fetch resource success"),this._updateModel(e),this._checkModelSize()},O.prototype._checkModelSize=function(){var t=this._getModelStatus();switch(t.toLowerCase()){case"ready":this._reactToModelStatus("to_load");break;default:this._reactToModelStatus(t)}},O.prototype._getModelInfo=function(){var e=this._getObjState("model.metadata.meContent.resourceRepresentationType")||"",a=e.toLowerCase();t.info("Resource type is: "),t.info(a),this._setObjState("resourceRepresentationType",a)},O.prototype._renderBox=function(){t.info("Render box start:"),this._setStatus("ready"),this._renderBoxFaces()},O.prototype._initTabSources=function(){var a=e.extend(!0,{},this.pluginRegistry),i=this.tabs,o=Object.keys(i),r=[];n.each(o,n.bind(function(n){var o=a[n];o||t.error('Registration not found for "'+n+' tab".'),e.isPlainObject(i[n])||this._setObjState("tabs."+n,{}),this._setObjState("tabs."+n+".suitable",!1),o.path?r.push(o.path):t.error('Impossible to find path configuration for "'+n+' tab".')},this)),t.info("Tab paths found: "),t.info(r)},O.prototype._renderBoxFaces=function(){t.info("Render box faces"),this._updateBoxTitle(),this._renderFrontFace(),this._renderBackFace(),this._updateBoxTitle()},O.prototype._updateBoxTitle=function(t){var e=this._getObjState("title"),a="function"==typeof e?e.call(this,this._getObjState("model")):e;this.computed&&(a+=S[this._getObjState("lang")].computed_resource),this.$boxTitle.html(t||a)},O.prototype._getModelTitle=function(t){var e=l.getNestedProperty("metadata.title",t),a=l.getNestedProperty("metadata.uid",t);return this._getI18nLabel(e)||a},O.prototype._getI18nLabel=function(t){if("object"!=typeof t)return"";var e=this.langFallbackOrder.slice(0),a="Missing label";e.unshift(this._getObjState("lang")),e=n.uniq(e);for(var i=0;i<e.length&&!(a=t[e[i]]);i++);return a},O.prototype._validateValues=function(t){this._hideFilterError();var e=!0,a=this._getObjState("model"),i=l.getNestedProperty("metadata.dsd.columns",a)||[],o=l.cleanArray(i.map(function(t){if(t.key===!0)return t.id})),s=[],c=l.getNestedProperty("aggregations.values.aggregations",t)||[],u=l.getNestedProperty("filter.values",t)||{},d=Object.keys(u)||[],h=n.findWhere(i,{subject:"value"})||{},p=h.id,b=n.where(c,{parent:"sum"}).map(function(t){return t.value}),_=n.where(c,{parent:"avg"}).map(function(t){return t.value}),f=n.where(c,{parent:"first"}).map(function(t){return t.value}),g=n.where(c,{parent:"last"}).map(function(t){return t.value}),m=n.where(c,{parent:"group"}).map(function(t){return t.value}),v=parseInt(b.length,10),y=parseInt(_.length,10),S=parseInt(f.length,10),T=parseInt(g.length,10),x=parseInt(m.length,10),w=v+y+S+T;if(n.each(b,function(t){var e=n.findWhere(i,{id:t})||{},a=e.dataType;"number"!==a&&s.push({code:r.NO_NUMBER_DATATYPE,value:t,label:n.findWhere(c,{value:t}).label})}),n.each(_,function(t){var e=n.findWhere(i,{id:t})||{},a=e.dataType;"number"!==a&&s.push({code:r.NO_NUMBER_DATATYPE,value:t,label:n.findWhere(c,{value:t}).label})}),n.contains(m,p)){var E=n.findWhere(c,{value:p});s.push({code:r.VALUE_IN_GROUP_BY,value:E.value,label:E.label})}if(w>0&&0===x&&s.push({code:r.MISSING_GROUP_BY}),x>0){var O=n.contains(b,p)||n.contains(_,p)||n.contains(f,p)||n.contains(g,p);O||s.push({code:r.MISSING_VALUE_IN_AGGREGATION_RULES})}var R=n.difference(o,d);if(d.length>0&&R.length>0){var L=n.map(R,n.bind(function(t){return n.findWhere(i,{id:t}).title[this._getObjState("lang")]},this));s.push({code:r.EXCLUDE_KEY_DIMENSION,value:L,label:L.join(", ")})}return s.length>0?s:e},O.prototype._createQuery=function(e){function a(e){var a={name:"filter",parameters:{}},i=!1,o=Object.keys(l.getNestedProperty("filter.values",e)||{}),r=e.rows||{},u=l.getNestedProperty("metadata.dsd.columns",s._getObjState("model"))||[],d=u.filter(function(t){return!c._endsWith(t.id,"_"+s._getObjState("lang").toUpperCase())&&!c._endsWith(t.id,"_EN")}).map(function(t){return t.id}).sort(),h=n.findWhere(u,{subject:"value"});return Object.getOwnPropertyNames(r).length>0?(a.parameters.rows=r,i=!0):t.warn("Filter.rows not included"),o.length>0&&!n.contains(o,h.id)&&o.push(h.id),o=o.sort(),o.length>0&&!n.isEqual(d,o)?(a.parameters.columns=o,i=!0):t.warn("Filter.columns not included"),i?a:null}function i(t){if(t.aggregations){var e={name:"group",parameters:{}},a=!1,i=l.getNestedProperty("aggregations.values.aggregations",t),o=[],r=[],s=[],c=[],u=[],d=[];return n.each(i,function(t){switch(t.parent.toLowerCase()){case"group":o.push(t.value);break;case"sum":r.push(t.value);break;case"avg":s.push(t.value);break;case"first":c.push(t.value);break;case"last":u.push(t.value)}}),r=l.cleanArray(r).map(function(t){return{columns:[t],rule:"SUM"}}),s=l.cleanArray(s).map(function(t){return{columns:[t],rule:"AVG"}}),c=l.cleanArray(c).map(function(t){return{columns:[t],rule:"FIRST"}}),u=l.cleanArray(u).map(function(t){return{columns:[t],rule:"LAST"}}),o.length>0&&(e.parameters.by=l.cleanArray(o),a=!0),n.each([r,s,c,u],function(t){t.length>0&&(d=n.uniq(n.union(d,t),!1))}),d.length>0&&(e.parameters.aggregations=d,a=!0),a?e:null}}var o,r,s=this,u=[],d=!1;return o=a(e),r=i(e),o&&(d=!0,u.push(o)),r&&(d=!0,u.push(r)),this.computed=d,u},O.prototype._renderFrontFace=function(){t.info("Start rendering box front face");var e=this._getObjState("faces");return n.contains(e,"front")&&this.frontFaceIsRendered!==!0?(this.frontFaceIsRendered=!0,this._checkSuitableTabs(),"dataset"===this._getObjState("resourceRepresentationType")?this._showMenuItem("download"):t.warn("Download menu item not show because resource is not 'dataset'"),void this._showDefaultFrontTab()):void t.warn("Abort 'front' face rendering. face is already rendered: "+this.frontFaceIsRendered+", config render face: "+n.contains(e,"front"))},O.prototype._bindFrameEventListeners=function(){var a=this;this.$el.find(L.FRONT_FACE).find("[data-action]").each(function(){var n=e(this),i=n.data("action"),o=a._getEventTopic(i);n.on("click",{event:o,box:a},function(e){e.preventDefault(),t.info("Raise event: "+e.data.event),E.publish(o,{target:this,box:e.data.box,state:a.getState()})})})},O.prototype._showFrontTab=function(e,a,i){t.info("Show tab "+e),t.info(a);var o=this.tabs;if(!o[e])return t.error("Error on show tab content: ",e),t.error({code:r.MISSING_TAB}),this._setObjState("error",{code:r.MISSING_TAB}),void this._setStatus("error");var s=this._getObjState("tab"),c=this._getObjState("tabOptions")[s];return!i&&s===e&&n.isEqual(c,a)?void t.info("Aborting show tab current tab is equal to selected one"):this._getObjState("tabs."+e+".suitable")!==!0?void t.error("Aborting show tab because selected tab is not suitable with current model"):(t.info("Show '"+e+"' tab for result id: "+this.id),a||(a=l.getNestedProperty("options",this.tabs[e])),this._setObjState("tab",e),this._setObjState("tabOptions."+e,a),this.$el.find(L.CONTENT_READY).attr("data-tab",this._getObjState("tab")),void this._showTabContent())},O.prototype._showTabContent=function(){var e=this.tabs,a=this._getObjState("tab");return e[a]?(this._setObjState("tabs."+a+".initialized",!0),void this._callTabInstanceMethod({tab:a,method:"show",opt1:this._getObjState("tabOptions")[a]})):(t.error("Error on show tab content: "+a),t.error({code:r.MISSING_TAB}),this._setObjState("error",{code:r.MISSING_TAB}),void this._setStatus("error"))},O.prototype._createTabInstance=function(t){var i,r=this._getObjState("tabStates."+t)||{},s=e.extend(!0,{},this._getObjState("model")),l=this.pluginRegistry,c=this._getObjState("lang")||o.lang,u=a(59)(this._getPluginPath(l[t])+".js"),d=e.extend(!0,{},r,{el:this._getTabContainer(t),box:this,lang:c,model:s,id:t+"_"+this.id,environment:this._getObjState("environment"),cache:this._getObjState("cache"),serviceProvider:this.serviceProvider,config:this._getObjState("tabConfig")[t],nls:this._getObjState("nls")});return i=new u(d),i.on("filter",n.bind(this._onTabToolbarChangeEvent,this)),i.on("state",n.bind(this._onTabStateChangeEvent,this,t)),i.on("initialized",n.bind(this._onInitializatedEvent,this)),i.on("title.change",n.bind(this._onTitleChangeEvent,this,t)),this.front_tab_instances[t]=i,i},O.prototype._onTitleChangeEvent=function(t,e){this._updateBoxTitle(e)},O.prototype._getTabInstance=function(t,e){return"back"===e?this.back_tab_instances[t]:this.front_tab_instances[t]},O.prototype._getTabContainer=function(t){var a=this.$el.find(L.FRONT_CONTENT).find("[data-section='"+t+"']");return 0===a.length&&(a=e('<div data-section="'+t+'"></div>'),this.$el.find(L.FRONT_CONTENT).append(a)),a},O.prototype._checkSuitableTabs=function(){var e=this.pluginRegistry,a=Object.keys(this.tabs);n.each(a,n.bind(function(a){var n=e[a];n||t.error('Registration not found for "'+a+' tab".'),n.path?(this._createTabInstance(a),this._setObjState("tabs."+a+".suitable",this._callTabInstanceMethod({tab:a,method:"isSuitable"})),t.info(a+" tab is suitable? ",this._callTabInstanceMethod({tab:a,method:"isSuitable"})),this._getObjState("tabs."+a+".suitable")===!0?this._showMenuItem(a):this._hideMenuItem(a)):t.error('Impossible to find path configuration for "'+a+' tab".')},this)),this._syncFrontTabs()},O.prototype._showDefaultFrontTab=function(){var e=this._getObjState("tab")||o.tab,a=this._getObjState("tabs."+e+".suitable"),i=this._getObjState("tabOptions."+e);if(a!==!0){t.warn("Default tab is not suitable. Find first suitable tab to show");var r=Object.keys(this.tabs),s=!1;n.each(r,n.bind(function(t){!s===this._getObjState("tabs."+t+".suitable")==!0&&(e=t)},this))}this._showFrontTab(e,i,!0)},O.prototype._syncFrontTabs=function(){t.info("Send front 'sync' signal");var e=Object.keys(this.tabs);n.each(e,n.bind(function(t){this._getObjState("tabs."+t+".suitable")===!0&&this._callTabInstanceMethod({tab:t,method:"sync",opt1:this._getObjState("sync")||{}})},this))},O.prototype._renderBackFace=function(){t.info("Start rendering box back face");var e=this._getObjState("faces");return n.contains(e,"back")&&this.backFaceIsRendered!==!0?(this.backFaceIsRendered=!0,this._hideFilterError(),this._createProcessSteps(),this._renderProcessSteps(),void this._bindBackFaceEventListeners()):void t.warn("Abort 'front' face rendering. face is already rendered: "+this.backFaceIsRendered+", confing render face: "+n.contains(e,"front"))},O.prototype._bindBackFaceEventListeners=function(){var a=this;this.$el.find(L.BTN_SIDEBAR).on("click",n.bind(function(){this.$el.find(L.SIDEBAR).toggleClass("hidden-xs hidden-sm")},this)),this.$el.find(L.BACK_FACE).find("[data-action]").each(function(){var n=e(this),i=n.data("action"),o=a._getEventTopic(i);n.on("click",{event:o,box:a},function(e){e.preventDefault(),t.info("Raise box event: "+e.data.event),E.publish(o,{target:this,box:e.data.box,state:a.getState()})})})},O.prototype._createProcessSteps=function(){var t,a,n,i;if(t=this._createBackTabConfiguration("filter"),a=this._createBackTabConfiguration("aggregations"),n=this._createBackTabConfiguration("map"),i=e.extend(!0,{},this._getObjState("model")),this.processSteps=[],this._stepControlAccess("metadata")){var o=l.getNestedProperty("metadata.title",i)||{},r=l.getNestedProperty("metadata.uid",i),s=o[this._getObjState("lang")]?o[this._getObjState("lang")]:r;this.processSteps.push({tab:"metadata",id:"metadata",model:i,labels:{title:s}})}this._stepControlAccess("filter")&&this.processSteps.push({id:"filter",tab:"filter",values:t.values,config:t.config,template:t.template,onReady:t.onReady,labels:{title:this._getObjState("nls").step_filter}}),this._stepControlAccess("aggregations")&&this.processSteps.push({id:"aggregations",tab:"filter",values:a.values,config:a.filter,template:a.template,labels:{title:this._getObjState("nls").step_aggregations}})},O.prototype._stepControlAccess=function(t){var e=this._getObjState("resourceRepresentationType");switch(t.toLowerCase()){case"metadata":return!0;case"filter":return"dataset"===e;case"aggregations":return"dataset"===e;case"map":return this._getObjState("tabs.map.suitable");default:return!1}},O.prototype._createBackTabConfiguration=function(t){var e,a=this._getObjState("backFilter")||{},n=this._getObjState("backMap")||{};switch(t.toLowerCase()){case"aggregations":e=this._createBackAggregationTabConfiguration(a[t]);break;case"filter":e=this._createBackFilterTabConfiguration(a[t]);break;case"map":e=this._createBackMapTabConfiguration(n[t]);break;default:e={}}return e},O.prototype._createBackFilterTabConfiguration=function(t){var e,a=this,i=["value"],o=["value"],r=l.getNestedProperty("metadata.dsd.columns",this._getObjState("model"))||[],s=r.filter(function(t){return!n.contains(o,t.subject)}),u=s.filter(function(t){return!n.contains(i,t.id.toLowerCase())}).filter(function(t){return!c._endsWith(t.id,"_"+a._getObjState("lang").toUpperCase())&&!c._endsWith(t.id,"_EN")});e=c.createConfiguration({model:this._getObjState("model"),common:{selector:{hideSummary:!0},template:{hideSwitch:!0,hideHeader:!1}}});var d={};return n.each(e,function(t,e){c._endsWith(e,"_"+a._getObjState("lang").toUpperCase())||c._endsWith(e,"_EN")||(d[e]=t)}),{values:t,config:d,template:h({columns:u}),onReady:n.bind(function(){new w(this.$el.find(L.ROWS_SWIPER),{pagination:this.$el.find(L.ROWS_SWIPER).find(".swiper-pagination"),paginationClickable:!0,nextButton:this.$el.find(L.ROWS_SWIPER).find(".swiper-button-next"),prevButton:this.$el.find(L.ROWS_SWIPER).find(".swiper-button-prev"),slidesPerView:"auto",simulateTouch:!1})},this)}},O.prototype._createBackMapTabConfiguration=function(t){return e.extend(!0,{},{values:t,filter:{layers:{selector:{id:"tree",source:n.map(y,function(t){var e=t.Title.replace("area","").replace("3857","");return{label:i.humanize(e),value:"earthstat:"+t.Name}}),config:{core:{multiple:!0}}},dependencies:{layergroups:{id:"focus",event:"select"}},template:{title:"Select layers to show on map",hideSwitch:!0,hideRemoveButton:!0}}},template:p({layers:[]}),onReady:n.bind(function(t){},this)})},O.prototype._createBackAggregationTabConfiguration=function(t){var a=this._getSourceForAggregationTabConfiguration();return e.extend(!0,{},{values:t,filter:{aggregations:{selector:{id:"sortable",source:a,config:{groups:{dimensions:this._getObjState("nls").aggregations_dimensions,group:this._getObjState("nls").aggregations_group,sum:this._getObjState("nls").aggregations_sum}}},template:{hideHeader:!0}}},template:b(this._getObjState("nls"))})},O.prototype._getSourceForAggregationTabConfiguration=function(){var t=[],a=this._getObjState("lang").toUpperCase(),i=l.getNestedProperty("metadata.dsd.columns",this._getObjState("model"));return n.each(i,function(n){var i,o,r,s;c._endsWith(n.id,"_"+a)||c._endsWith(n.id,"_EN")||(i=l.getNestedProperty("title",n),r="object"==typeof i?i:{},s=r[a]||r[Object.keys(i)[0]],s?o=s:(window.fx_vis_box_missing_title>=0?window.fx_vis_box_missing_title++:window.fx_vis_box_missing_title=0,o="Missing dimension title ["+n.id+"]"),t.push(e.extend(!0,{},{value:n.id,parent:"dimensions",label:o})))}),t},O.prototype._renderProcessSteps=function(){function t(){o++,r.length===o&&(this.$el.find(L.BACK_CONTENT).find(L.QUERY_BUTTON).attr("disabled",!1),i._bindStepEventListeners(),i._onBackTabsReady())}var i=this,o=0,r=this.processSteps;n.each(r,n.bind(function(i,o){var r=e(R[i.tab](e.extend(!0,{},i,this._getObjState("nls"),this._getObjState("model"),this._getObjState("model"))));this._bindStepLabelEventListeners(r,i),this.$processSteps.append(r);var s=this.pluginRegistry,l=a(59)(this._getPluginPath(s[i.tab])+".js"),c=this.$processStepDetails.find("[data-tab='"+i.id+"']");0===c.length&&(c=e("<li data-tab='"+i.id+"'></li>"),0!==o&&c.hide(),this.$processStepDetails.append(c));var u=new l({el:c,box:this,cache:this._getObjState("cache"),serviceProvider:this.serviceProvider,model:e.extend(!0,{},this._getObjState("model")),config:i.config,lang:this._getObjState("lang"),values:i.values||{},id:i.tab+"_"+i.id,labels:i.labels,template:i.template,onReady:i.onReady,environment:this._getObjState("environment")});"function"==typeof i.onReady&&u.on("ready",n.bind(i.onReady,this)),this.back_tab_instances[i.id]=u,t.call(this)},this))},O.prototype._onBackTabsReady=function(){var t=Object.keys(this.back_tab_instances)[0];this._showBackTab(t)},O.prototype._bindStepLabelEventListeners=function(t,e){t.on("click",{step:e},n.bind(function(t){this._showBackTab(t.data.step.id)},this))},O.prototype._showBackTab=function(t){this.$processStepDetails.find(">li").hide(),this.$processStepDetails.find(">li[data-tab='"+t+"']").show(),this.$processSteps.find("[data-tab]").removeClass("active"),this.$processSteps.find("[data-tab='"+t+"']").addClass("active"),this.back_tab_instances[t].show(this._getBackSyncModel())},O.prototype._bindStepEventListeners=function(){var t=this.back_tab_instances.aggregations,e=this.back_tab_instances.filter;t&&e&&(e.on("change",n.bind(this._onBackFilterChangeEvent,this)),t.on("change",n.bind(this._onBackFilterChangeEvent,this)))},O.prototype._onBackFilterChangeEvent=function(){var e=this._getBackFilterValues(),a=this._validateValues(e);return a!==!0?void this._printFilterError(a):(t.warn("Invalid back filter values:"),t.warn(a),void this._syncBackTabs())},O.prototype._getBackSyncModel=function(){function a(e){var a=n.findWhere(h,{value:e}),o=n.findWhere(r,{value:e});if(o||!e)return void t.info("Not include dimension because already present: "+e);if(a)r.push(a);else{var s=n.findWhere(f,{id:e}),l=s.title[i._getObjState("lang").toUpperCase()]||s.title[Object.keys(s.title)[0]];r.push({value:e,parent:"dimensions",label:l})}}var i=this,o={},r=[],s=this._getBackFilterValues(),u=l.getNestedProperty("metadata.dsd.columns",i._getObjState("model"))||[],d=u.filter(function(t){return!c._endsWith(t.id,"_"+i._getObjState("lang").toUpperCase())}).map(function(t){return t.id}).sort(),h=l.getNestedProperty("aggregations.values.aggregations",s)||[],p=l.getNestedProperty("filter.values",s)||{},b=Object.keys(p).length>0?Object.keys(p):d,_=!e.isEmptyObject(p),f=l.getNestedProperty("metadata.dsd.columns",this._getObjState("model"))||[],g=n.map(f,function(t){return t.id}),m=n.without.apply(n,[g].concat(b)),v=n.findWhere(f,{subject:"value"})||{};if(_===!0||h.length>0?(n.each(h,n.bind(function(t){n.contains(m,t.value)&&v.id!==t.value||a(t.value)},this)),n.each(g,n.bind(function(t){n.contains(m,t)||n.findWhere(r,{value:t})||a(t)},this))):r=this._getSourceForAggregationTabConfiguration(),a(v.id),r.length>0){var y=n.uniq(r,function(t,e,a){return t.value}).filter(function(t){return!c._endsWith(t.value,"_"+i._getObjState("lang").toUpperCase())&&!c._endsWith(t.value,"_EN")});l.assign(o,"values.aggregations",y)}return o},O.prototype._syncBackTabs=function(){var t=this.back_tab_instances.aggregations,e=this._getBackSyncModel();t&&t.setValues(e)},O.prototype._bindEventListeners=function(){var a=this;E.subscribe(this._getEventTopic("remove"),this,this._onRemoveEvent),E.subscribe(this._getEventTopic("resize"),this,this._onResizeEvent),E.subscribe(this._getEventTopic("clone"),this,this._onCloneEvent),E.subscribe(this._getEventTopic("flip"),this,this._onFlipEvent),E.subscribe(this._getEventTopic("metadata"),this,this._onMetadataEvent),E.subscribe(this._getEventTopic("tab"),this,this._onTabEvent),E.subscribe(this._getEventTopic("minimize"),this,this._onMinimizeEvent),E.subscribe(this._getEventTopic("query"),this,this._onQueryEvent),E.subscribe(this._getEventTopic("filter"),this,this._onFilterEvent),E.subscribe(this._getEventTopic("download"),this,this._onDownloadEvent),E.subscribe(this._getEventTopic("noelem"),this,this._onNoElemEvent),this.$el.find(L.RIGHT_MENU).on("click","a",function(t){t.preventDefault()}),this.$el.find(L.OTHER_CONTENT).find("[data-action]").each(function(){var n=e(this),i=n.data("action"),o=a._getEventTopic(i);n.on("click",{event:o,box:a},function(e){e.preventDefault(),t.info("Raise box event: "+e.data.event),E.publish(o,{target:this,box:e.data.box,state:a.getState()})})}),
this.report.on("export.success",function(){}),this._bindFrameEventListeners()},O.prototype._onLoadedEvent=function(e){t.info("Listen to event: "+this._getEventTopic("loaded")),console.log("IT IS LOADED!")},O.prototype._onRemoveEvent=function(a){t.info("Listen to event: "+this._getEventTopic("remove")),t.info(a);var n=confirm(this._getObjState("nls").confirm_remove),i=e.extend(!0,{},this.getState());1==n?(E.publish(s.remove,this),this._dispose(),this._trigger("remove",i)):t.info("Abort remove")},O.prototype._onResizeEvent=function(a){t.info("Listen to event: "+this._getEventTopic("resize")),t.info(a);var n;a.target&&e(a.target).data("size")&&(n=e(a.target).data("size"),t.info("Size: "+n),this._setSize(n))},O.prototype._onCloneEvent=function(a){t.info("Listen to event: "+this._getEventTopic("clone")),t.info(a);var n=e.extend(!0,{},this.getState());E.publish(this._getEventTopic("clone",!0),n),this._trigger("clone",n)},O.prototype._onFlipEvent=function(e){t.info("Listen to event: "+this._getEventTopic("flip")),t.info(e),"back"!==this._getObjState("face")?this._flip("back"):this._flip("front"),t.info("Set box face to: "+this._getObjState("face"))},O.prototype._onMetadataEvent=function(e){t.info("Listen to event: "+this._getEventTopic("metadata")),t.info(e),this.showTab("metadata")},O.prototype._onMinimizeEvent=function(a){t.info("Listen to event: "+this._getEventTopic("minimize")),t.info(a);var n=e.extend(!0,{},this.getState());E.publish(this._getEventTopic("minimize",!0),n),this._trigger("minimize",n),this.dispose()},O.prototype._onTabEvent=function(a){t.info("Listen to event: "+this._getEventTopic("tab")),t.info(a);var n={};n.type=e(a.target).data("type"),this._showFrontTab(e(a.target).data("tab"),n)},O.prototype._onTabToolbarChangeEvent=function(e){n.isEmpty(e.values)?t.warn("Abort sync"):(this._setObjState("sync.toolbar",e),this._syncFrontTabs())},O.prototype._onTabStateChangeEvent=function(t,e){this._setObjState("tabStates."+t,e)},O.prototype._onInitializatedEvent=function(t){this._trigger("initializated",t)},O.prototype._onQueryEvent=function(a){function i(t){var e=!0;return n.each(t,function(t){(!Array.isArray(t)||t.length>0)&&(e=!1)}),e}t.info("Listen to event: "+this._getEventTopic("query")),t.info(a);var o=this._getBackFilterValues(),r=this._validateValues(o),s=this._getBackMapValues(),c=i(l.getNestedProperty("map.values",s));if(r===!0){this._enableFlip();var u=this._createQuery(o)||[];n.isEqual(u,this._getObjState("process"))?t.warn("Abort resource filter because process have not changed"):(this._setObjState("backFilter",e.extend(!0,{},o)),this._setObjState("process",u.slice(0)),t.info("D3P process",u),this._loadResource(u).then(n.bind(this._onLoadResourceSuccess,this),n.bind(this._onLoadResourceError,this))),c||n.isEqual(s,this._getObjState("backMap"))?t.warn("Abort map update because values have not changed"):(this._setObjState("backMap",e.extend(!0,{},s)),this._updateMap()),this._flip("front")}else this._printFilterError(r)},O.prototype._updateMap=function(){if(this._getObjState("tabs.map.suitable")!==!0)return void t.warn("Abort map update because map table is not suitable for current resource");var e=this._getObjState("backMap").map;this._setObjState("sync.map",e),this._syncFrontTabs();var a=this._getObjState("tab");this._showFrontTab(a)},O.prototype._onNoElemEvent=function(t){this._trigger("noelem",t)},O.prototype._onDownloadEvent=function(a){if(t.info("Listen to event: "+this._getEventTopic("download")),t.info(a),"dataset"!==this._getObjState("resourceRepresentationType"))return void t.warn("Abort download because resource is not 'dataset'");var n=e(a.target).attr("data-target")||"";switch(n.toLocaleLowerCase()){case"data":t.info("Data download"),this._downloadData();break;case"metadata":t.info("Metadata download"),this._downloadMetadata();break;default:t.warn("Unknown download target")}},O.prototype._downloadData=function(){var e={resource:this._getObjState("model"),input:{config:{}},output:{config:{lang:this._getObjState("lang").toUpperCase()}}};t.info("Configure FENIX export: table"),this._getObjState("lang").toUpperCase(),this.computed&&(e.output.config.notes=S[this._getObjState("lang").toLowerCase()].computed_export),this.initial&&this.initial.filterSelection&&(e.output.config.notes=this.initial.filterSelection.notes),t.info(e),this.report.export({format:"table",config:e})},O.prototype._getMetadataTemplate=function(t){return console.log(t),"undefined"==t?"fao":"uneca"===t?t:String(t).includes("cstat")?"cstat":"fao"},O.prototype._downloadMetadata=function(){var e=this._getObjState("model"),a=l.getNestedProperty("metadata.title",e)||{},n=a[this._getObjState("lang")]?a[this._getObjState("lang")]:"fenix_export",i=l.getNestedProperty("metadata.dsd.contextSystem",e),o=this._getMetadataTemplate(i),r={resource:{metadata:{uid:l.getNestedProperty("metadata.uid",e)},data:[]},input:{config:{}},output:{config:{template:o,lang:this._getObjState("lang").toUpperCase(),fileName:n.replace(/[^a-z0-9]/gi,"_")+".pdf"}}};t.info("Configure FENIX export: metadata"),t.info(r),this.report.export({format:"metadata",config:r})},O.prototype._onFilterEvent=function(e){t.info("Listen to event: "+this._getEventTopic("filter")),t.info(e),this._forceModelFilter()},O.prototype._flip=function(t){var e=t||"front";switch(e.toLocaleLowerCase()){case"front":this.$el.find(L.FLIP_CONTAINER).removeClass(o.flippedClassName);break;case"back":this.$el.find(L.FLIP_CONTAINER).addClass(o.flippedClassName)}this._setObjState("face",e)},O.prototype._disableFlip=function(){this.$el.find(L.FLIP_BUTTONS).attr("disabled",!0)},O.prototype._enableFlip=function(){this.$el.find(L.FLIP_BUTTONS).attr("disabled",!1)},O.prototype._printFilterError=function(t){var a=this,i={},o=e("<ul class='list-unstyled'></ul>");n.each(t,function(t){i[t.code]||(i[t.code]=[]),i[t.code].push(t.label)}),n.each(i,function(t,n){o.append(e("<li>"+a._getObjState("nls")[n]+"</li>"))}),this._showFilterError(o)},O.prototype._showFilterError=function(t){this.$el.find(L.BACK_FILTER_ERRORS).html(t).show()},O.prototype._hideFilterError=function(){this.$el.find(L.BACK_FILTER_ERRORS).hide()},O.prototype._getBackFilterValues=function(){var t=this.forceModelFilter===!0?{}:this._getObjState("backFilter")||{},a=this.back_tab_instances.filter?this.back_tab_instances.filter.getValues(null):null,i=this.back_tab_instances.aggregations?this.back_tab_instances.aggregations.getValues(null):null,o=this.back_tab_instances.filter?this.back_tab_instances.filter.getValues("fenix"):null,r={filter:n.isEqual(a,t.filter)?t.filter:a,aggregations:n.isEqual(i,t.aggregations)?t.aggregations:i,rows:n.isEqual(o,t.rows)?t.rows:o};return e.extend(!0,{},r)},O.prototype._getBackMapValues=function(){var t=this._getObjState("backMap")||{},a=this.back_tab_instances.map?this.back_tab_instances.map.getValues(null):null,i={map:n.isEmpty(a)?t:a};return e.extend(!0,{},i)},O.prototype._renderMenu=function(){var a=this;this.hasMenu===!0?this.rightMenu=new m({el:this.$el.find(L.RIGHT_MENU),model:this._getObjState("menuModel").map(function(t){return e.extend(t,{label:S[a._getObjState("lang")]["menu_"+t.id]})})}):t.warn("Menu will not be rendered. Impossible to find container.")},O.prototype._showMenuItem=function(t){this.hasMenu&&this.rightMenu.showItem(t)},O.prototype._hideMenuItem=function(t){this.hasMenu&&this.rightMenu.hideItem(t)},O.prototype._callTabInstanceMethod=function(a){var n=this._getTabInstance(a.tab,a.face);return n&&e.isFunction(n[a.method])?n[a.method](a.opt1,a.opt2):void t.error(a.tab+" tab does not implement the "+a.method+"() fn")},O.prototype._trigger=function(t){if(!this.channels[t])return!1;for(var e=Array.prototype.slice.call(arguments,1),a=0,n=this.channels[t].length;a<n;a++){var i=this.channels[t][a];i.callback.apply(i.context,e)}return this},O.prototype._setStatus=function(e){switch(t.info("Set '"+e+"' status for result id: "+this.id),this._setObjState("status",e),this.$el.find(L.BOX).attr("data-status",this._getObjState("status")),this._getObjState("status").toLowerCase()){case"error":var a=this._getObjState("error");this.$el.find(L.ERROR_TEXT).html(this._getObjState("nls")[a.code]?this._getObjState("nls")[a.code]:a.code),a.filter===!0?this.$el.find(L.EMPTY_FILTER_BUTTON).show():this.$el.find(L.EMPTY_FILTER_BUTTON).hide();break;case"empty":var n=this.$el.find(L.EMPTY_FILTER_BUTTON);this._getObjState("showFilter")?n.show():n.hide()}},O.prototype._setSize=function(a){if(this._getObjState("size")===a)return void t.info("Aborting resize because current size is equal to selected one");this._setObjState("size",a),this.$el.find(L.BOX).attr("data-size",this._getObjState("size"));var n=e.extend(!0,{},this.getState());E.publish(s.resize,this),this._trigger("resize",n),this._redrawTabs()},O.prototype._redrawTabs=function(){var t=this._getObjState("tab");this._callTabInstanceMethod({tab:t,method:"redraw"}),this._syncFrontTabs()},O.prototype._getEventTopic=function(t,e){var a=s[t]?s[t]:t;return e===!0?a:a+"."+this.id},O.prototype._forceModelFilter=function(){t.warn("Force model filter"),this.forceModelFilter=!0,this._disableFlip(),this._flip("back"),this._renderBackFace(),this._setStatus("ready")},O.prototype._dispose=function(){this._unbindEventListeners(),this._disposeBoxFaces(),this.$el.remove(),this._trigger("dispose"),delete this},O.prototype._disposeBoxFaces=function(){this._disposeFrontFace(),this._disposeBackFace()},O.prototype._disposeFrontFace=function(){var t=this.front_tab_instances,e=Object.keys(t);n.each(e,n.bind(function(t){this._callTabInstanceMethod({tab:t,method:"dispose"})},this)),this.frontFaceIsRendered=!1},O.prototype._disposeBackFace=function(){var t=this.back_tab_instances,e=Object.keys(t);n.each(e,n.bind(function(t){this._callTabInstanceMethod({tab:t,method:"dispose",face:"back"})},this)),this.$el.find(L.BACK_FACE).find("[data-action]").off(),this.$processSteps.empty(),this.backFaceIsRendered=!1},O.prototype._unbindEventListeners=function(){E.unsubscribe(this._getEventTopic("remove"),this._onRemoveEvent),E.unsubscribe(this._getEventTopic("resize"),this._onResizeEvent),E.unsubscribe(this._getEventTopic("clone"),this._onCloneEvent),E.unsubscribe(this._getEventTopic("flip"),this._onFlipEvent),E.unsubscribe(this._getEventTopic("metadata"),this._onMetadataEvent),E.unsubscribe(this._getEventTopic("tab"),this._onTabEvent),E.unsubscribe(this._getEventTopic("minimize"),this._onMinimizeEvent),E.unsubscribe(this._getEventTopic("query"),this._onQueryEvent),E.unsubscribe(this._getEventTopic("filter"),this._onFilterEvent),E.unsubscribe(this._getEventTopic("download"),this._onDownloadEvent),E.unsubscribe(this._getEventTopic("noelem"),this._onNoElemEvent),this.$el.find("[data-action]").off(),this.$el.find(L.RIGHT_MENU).off(),this.$el.find(L.OTHER_CONTENT).find("[data-action]").off(),this.$el.find(L.FRONT_FACE).find("[data-action]").off()},O.prototype._getPluginPath=function(t){return C+t.path},O}.apply(e,n),!(void 0!==i&&(t.exports=i))},function(e,a){e.exports=t},function(t,a){t.exports=e},function(t,e){t.exports=a},function(t,e){t.exports=n},function(t,e,a){var n;n=function(){"use strict";return{status:"loading",tab:"table",size:"full",face:"front",faces:["front","back"],pluginRegistry:{blank:{path:"blank"},table:{path:"table"},map:{path:"map"},chart:{path:"chart"},metadata:{path:"metadata"},filter:{path:"filter"},download:{path:"download"}},tabs:{table:{options:{}},metadata:{options:{}},filter:{options:{}},map:{options:{}},chart:{options:{type:"line"}},download:{options:{}}},tabConfig:{},flippedClassName:"flipped",state:{},lang:"FR",langFallbackOrder:["EN","FR","ES","AR","PR"],toolbarPosition:"up",loadResourceServiceQueryParams:{dsd:!0},syncTabsOnToolbarChange:!1,renderVisualizationComponents:!0,maxDataSize:3500,minDataSize:0,cache:!1}}.call(e,a,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,a){var n;n=function(){"use strict";var t="";return{MISSING_CONTAINER:t+"missing_container",LOAD_RESOURCE:t+"load_resource",LOAD_METADATA:t+"load_metadata",MISSING_TAB:t+"missing_tab",FETCH_RESOURCE:t+"fetch_resource",MISSING_DATASOURCES:t+"missing_datasources",UNKNOWN_RESOURCE_TYPE:t+"unknown_resource_type",MISSING_GEO_COLUMN:t+"missing_geo_column",NO_NUMBER_DATATYPE:t+"no_number_datatype",VALUE_IN_GROUP_BY:t+"value_in_group_by",MISSING_GROUP_BY:t+"missing_group_by",MISSING_VALUE_IN_AGGREGATION_RULES:t+"missing_value_in_aggregation_rules",GROUP_BY_CONTAINS_NO_KEY:t+"group_by_contains_no_key",EXCLUDE_KEY_DIMENSION:t+"exclude_key_dimension",INCOMPATIBLE_RESOURCE_TYPE:t+"incompatible_resource_type",RESOURCE_STATUS:t+"resource_status"}}.call(e,a,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,a){var n;n=function(){"use strict";var t="fx.visualization.";return{remove:t+"remove",resize:t+"resize",clone:t+"clone",flip:t+"flip",metadata:t+"metadata",tab:t+"tab",query:t+"query",toolbar:t+"toolbar",model_done:"model.done",model_error:"model.error"}}.call(e,a,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,a){var n,i;n=[a(3),a(2),a(4),a(6),a(7),a(8),a(10),a(11)],i=function(t,e,a,n,i,o,r,s){"use strict";function l(){return this.fenixTool=new r,this}return l.prototype._getToolbarConfig=function(t,e){return this.fenixTool.toFilter(t,e)},l.prototype.getTableToolbarConfig=function(t,e){return this._getToolbarConfig(t,e)},l.prototype.getChartToolbarConfig=function(e,a){return this._getToolbarConfig(e,t.extend(a,{rowLabel:s.series,columnsLabel:s.xAxis,valuesLabel:s.yAxis}))},l.prototype.getMapToolbarConfig=function(t,e){return{}},l.prototype.getChartCreatorConfiguration=function(t){return this.fenixTool.toChartConfig(t)},l.prototype.getTableCreatorConfiguration=function(t){return this.fenixTool.toTableConfig(t)},l.prototype.getMapCreatorConfiguration=function(t){return this.fenixTool.toTableConfig(t)},l.prototype.assign=function(t,e,a){if("string"==typeof e&&(e=e.split(".")),e.length>1){var n=e.shift();this.assign(t[n]="[object Object]"===Object.prototype.toString.call(t[n])?t[n]:{},e,a)}else t[e[0]]=a},l.prototype.getNestedProperty=function(e,a){for(var a=t.extend(!0,{},a),n=e.split(".");n.length&&(a=a[n.shift()]););return a},l.prototype.cleanArray=function(t){for(var e=[],a=0;a<t.length;a++)t[a]&&e.push(t[a]);return e},new l}.apply(e,n),!(void 0!==i&&(t.exports=i))},function(t,e){t.exports=i},function(t,e,a){var n,i;n=[a(12),a(13)],i=function(t,e){"use strict";return{en:t,fr:e}}.apply(e,n),!(void 0!==i&&(t.exports=i))},function(t,e,a){var n;n=function(){"use strict";return{confirm_remove:"Remove resource?",submit_button:"Submit",reset_button:"Reset",add_button:"Add",remove_button:"Remove",cancel_button:"Cancel",computed_resource:" (computed)",computed_export:"This is a computed resource.",back_current_resource:"Resources",no_number_datatype:"Impossible to aggregate for [{{ dimensions }}] because the data type is not number",value_in_group_by:"'Value' dimension can not be in group by",missing_group_by:"Specify at least one 'group by'",missing_value_in_aggregation_rules:"'Value' should be in Sum, Average, First or Last",group_by_contains_no_key:"'Group by' can contains only key dimensions",exclude_key_dimension:"The dimensions [{{ dimensions }}] can not be excluded because keys.",aggregations_dimensions:"Dimensions",aggregations_group:"Group by",aggregations_sum:"Sum",aggregations_avg:"Average",aggregations_first:"First",aggregations_last:"Last",map_select_overlay:"Select Overlayer",map_baselayers:"Base Layers",map_selected_layers:"Selected Layers",map_show_bounds:"Show Map Boundaries",map_show_labels:"Show Map Labels",step_metadata:"Metadata",step_filter:"Filter",step_aggregations:"Aggregations",step_map:"Earthstat Layer Collection",series:"Series",xAxis:"X Axis",yAxis:"Y Axis",tooltip_right_menu:"Settings",tooltip_remove_button:"Close resource",tooltip_resize_button:"Resize resource",tooltip_clone_button:"Clone resource",tooltip_flip_button:"Resource filtering",tooltip_metadata_button:"Visualize metadata",tooltip_minimize_button:"Minimize resource",tooltip_download_button:"Download resource",tooltip_toolbar_button:"Visualization options",error_content_title:"An error occurred",error_content_text:"You can remove the AVB, please use the button below",empty_content_title:"The result is empty",empty_content_text:"You can remove the AVB or redo the filtering, please use the button below",huge_content_title:"The result is too big for the visualization",huge_content_text:"You can redo the filtering, please use the button below",menu_download:"Download",menu_download_data:"Resource",menu_download_metadata:"Metadata",menu_visualize_as:"Visualize as",menu_visualize_as_chart:"Chart",menu_chart_line:"Line",menu_chart_column:"Column",menu_chart_column_stacked:"Column stacked",menu_chart_area:"Area",menu_visualize_as_map:"Map",menu_visualize_as_table:"Table",menu_size:"Size",menu_full:"Full",menu_half:"Half",tab_table_toolbar_format:"Format",tab_table_toolbar_decimals:"Decimals",tab_table_toolbar_show:"Show",tab_table_toolbar_dimensionsSort:"Sort dimension",tab_table_toolbar_aggregationValue:"Aggregator for Value",tab_table_toolbar_rows:"Rows",tab_table_toolbar_columns:"Columns",tab_table_toolbar_hidden:"Hidden",tab_table_toolbar_values:"Values",tab_table_toolbar_aggregations:"Aggregations",tab_table_toolbar_unit:"Unit",tab_table_toolbar_flag:"Flag",tab_table_toolbar_code:"Code"}}.call(e,a,e,t),!(void 0!==n&&(t.exports=n))},function(t,e,a){var n;n=function(){"use strict";return{confirm_remove:"Voulez-vou supprimer la ressource?",submit_button:"Envoyer",reset_button:"Réinitialiser",add_button:"Ajouter",remove_button:"Supprimer",cancel_button:"Annuler",computed_resource:" (calculé)",computed_export:"Il s'agit d'une ressource calculée.",back_current_resource:"Ressources",no_number_datatype:"Impossible agréger par [{{ dimensions }}] parce que le type de données n’est pas un nombre",value_in_group_by:"La dimension 'Valeur' ne peut pas être dans le groupe par",missing_group_by:"Spécifier au moins un 'groupe par'",missing_value_in_aggregation_rules:"'Valeur' doit être dan Somme, Moyenne, P