/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.maps_bundle_jsonpfunction=window.maps_bundle_jsonpfunction||[]).push([[12,13],{102:function(e,t,r){e.exports=r(22)(448)},106:function(e,t,r){"use strict";r.d(t,"a",(function(){return AbstractLayer}));var s=r(2),i=r.n(s),a=r(39),n=r.n(a),o=(r(4),r(14)),u=r(41),c=r(87),l=r(0),d=r(88),p=r(3);class AbstractLayer{static createDescriptor(e){return{...e,sourceDescriptor:e.sourceDescriptor?e.sourceDescriptor:null,__dataRequests:n.a.get(e,"__dataRequests",[]),id:n.a.get(e,"id",Object(u.v4)()),label:e.label&&e.label.length>0?e.label:null,minZoom:n.a.get(e,"minZoom",l.lb),maxZoom:n.a.get(e,"maxZoom",l.hb),alpha:n.a.get(e,"alpha",.75),visible:n.a.get(e,"visible",!0),style:n.a.get(e,"style",null),includeInFitToBounds:"boolean"!=typeof e.includeInFitToBounds||e.includeInFitToBounds}}constructor({layerDescriptor:e,source:t}){i()(this,"_descriptor",void 0),i()(this,"_source",void 0),i()(this,"_dataRequests",void 0),this._descriptor=AbstractLayer.createDescriptor(e),this._source=t,this._descriptor.__dataRequests?this._dataRequests=this._descriptor.__dataRequests.map((e=>new c.a(e))):this._dataRequests=[]}static getBoundDataForSource(e,t){return e.getStyle().sources[t].data}getDescriptor(){return this._descriptor}async cloneDescriptor(){const e=Object(d.b)(this._descriptor);e.id=Object(u.v4)();const t=await this.getDisplayName();return e.label=`Clone of ${t}`,e.sourceDescriptor=this.getSource().cloneDescriptor(),[e]}makeMbLayerId(e){return`${this.getId()}${l.jb}${e}`}isPreviewLayer(){return!!this._descriptor.__isPreviewLayer}supportsElasticsearchFilters(){return this.getSource().isESSource()}async supportsFitToBounds(){return await this.getSource().supportsFitToBounds()}async isFittable(){return await this.supportsFitToBounds()&&this.isVisible()&&this.isIncludeInFitToBounds()}isIncludeInFitToBounds(){return!!this._descriptor.includeInFitToBounds}async isFilteredByGlobalTime(){return!1}async getDisplayName(e){return this._descriptor.label?this._descriptor.label:(e?await e.getDisplayName():await this.getSource().getDisplayName())||`Layer ${this._descriptor.id}`}async getAttributions(){if(this.hasErrors()||!this.isVisible())return[];const e=this.getSource().getAttributionProvider();return e?e():void 0!==this._descriptor.attribution?[this._descriptor.attribution]:[]}getStyleForEditing(){throw new Error("Should implement AbstractLayer#getStyleForEditing")}getStyle(){throw new Error("Should implement AbstractLayer#getStyle")}getCurrentStyle(){throw new Error("Should implement AbstractLayer#getCurrentStyle")}getLabel(){return this._descriptor.label?this._descriptor.label:""}getLocale(){return null}getLayerIcon(e){return{icon:Object(p.jsx)(o.EuiIcon,{size:"m",type:this.getLayerTypeIconName()})}}async hasLegendDetails(){return!1}renderLegendDetails(){return null}getId(){return this._descriptor.id}getSource(){return this._source}getSourceForEditing(){return this._source}isVisible(){return!!this._descriptor.visible}showAtZoomLevel(e){return e>=this.getMinZoom()&&e<=this.getMaxZoom()}getMinZoom(){return"number"==typeof this._descriptor.minZoom?this._descriptor.minZoom:l.lb}getMaxZoom(){return"number"==typeof this._descriptor.maxZoom?this._descriptor.maxZoom:l.hb}getMinSourceZoom(){return this._source.getMinZoom()}getMbSourceId(){return this.getId()}_requiresPrevSourceCleanup(e){return!1}_removeStaleMbSourcesAndLayers(e){if(this._requiresPrevSourceCleanup(e)){const t=e.getStyle();t.layers.forEach((t=>{this.ownsMbLayerId(t.id)&&e.removeLayer(t.id)})),Object.keys(t.sources).some((t=>{this.ownsMbSourceId(t)&&e.removeSource(t)}))}}getAlpha(){return"number"==typeof this._descriptor.alpha?this._descriptor.alpha:1}getQuery(){return this._descriptor.query?this._descriptor.query:null}renderSourceSettingsEditor(e){return this.getSourceForEditing().renderSourceSettingsEditor(e)}getPrevRequestToken(e){const t=this.getDataRequest(e);if(t)return t.getRequestToken()}getInFlightRequestTokens(){if(!this._dataRequests)return[];const e=this._dataRequests.map((e=>e.getRequestToken()));return n.a.compact(e)}getSourceDataRequest(){return this.getDataRequest(l.xb)}getDataRequest(e){return this._dataRequests.find((t=>t.getDataId()===e))}isLayerLoading(e){if(!this.isVisible()||!this.showAtZoomLevel(e))return!1;const t=this._dataRequests.some((e=>e.isLoading()));return this._isTiled()?t||void 0===this._descriptor.__areTilesLoaded||!this._descriptor.__areTilesLoaded:!this.getSourceDataRequest()||t}hasErrors(){return n.a.get(this._descriptor,"__isInErrorState",!1)}getErrors(){return this.hasErrors()&&this._descriptor.__errorMessage?this._descriptor.__errorMessage:""}async syncData(e){}getMbLayerIds(){throw new Error("Should implement AbstractLayer#getMbLayerIds")}ownsMbLayerId(e){throw new Error("Should implement AbstractLayer#ownsMbLayerId")}ownsMbSourceId(e){throw new Error("Should implement AbstractLayer#ownsMbSourceId")}syncLayerWithMB(e){throw new Error("Should implement AbstractLayer#syncLayerWithMB")}getLayerTypeIconName(){throw new Error("should implement Layer#getLayerTypeIconName")}async getBounds(e){return null}renderStyleEditor(e,t){const r=this.getStyleForEditing();return r?r.renderEditor(e,t):null}getIndexPatternIds(){return[]}getQueryableIndexPatternIds(){return[]}syncVisibilityWithMb(e,t){e.setLayoutProperty(t,"visibility",this.isVisible()?"visible":"none")}getType(){return this._descriptor.type}areLabelsOnTop(){return!1}supportsLabelsOnTop(){return!1}supportsLabelLocales(){return!1}async getLicensedFeatures(){return[]}getGeoFieldNames(){const e=this.getSource();return e.isESSource()?[e.getGeoFieldName()]:[]}async getStyleMetaDescriptorFromLocalFeatures(){return null}isBasemap(e){return!1}getParent(){return this._descriptor.parent}_getMetaFromTiles(){return this._descriptor.__metaFromTiles||[]}_isTiled(){throw new Error("Must implement AbstractLayer#_isTiled")}}},110:function(e,t,r){"use strict";r.d(t,"a",(function(){return AbstractSource}));var s=r(2),i=r.n(s),a=r(88),n=r(0);class AbstractSource{constructor(e){i()(this,"_descriptor",void 0),this._descriptor=e}cloneDescriptor(){return Object(a.b)(this._descriptor)}async supportsFitToBounds(){return!1}async getImmutableProperties(){return[]}getType(){return this._descriptor.type}async getDisplayName(){return""}getAttributionProvider(){return null}isFieldAware(){return!1}isQueryAware(){return!1}renderSourceSettingsEditor(e){return null}getApplyGlobalQuery(){return!1}getApplyGlobalTime(){return!1}getApplyForceRefresh(){return!1}getIndexPatternIds(){return[]}getQueryableIndexPatternIds(){return[]}isESSource(){return!1}async createFieldFormatter(e){return null}async getValueSuggestions(e,t){return[]}async isTimeAware(){return!1}isFilterByMapBounds(){return!1}getMinZoom(){return n.lb}getMaxZoom(){return n.hb}async getLicensedFeatures(){return[]}getUpdateDueToTimeslice(e,t){return!0}}},173:function(e,t,r){"use strict";r.r(t),r.d(t,"suggestEMSTermJoinConfig",(function(){return i})),r.d(t,"emsAutoSuggest",(function(){return a}));var s=r(75);async function i(e){try{return a(e,await Object(s.getEmsFileLayers)())}catch(e){return null}}function a(e,t){const r=[];if(e.sampleValuesColumnName){const s=function(e,t,r){const s=[];return e.forEach((e=>{e.getFields().forEach((i=>{if(!i.alias||!i.alias.length)return;const a={layerId:e.getId(),field:i.id,displayName:e.getDisplayName()};i.alias.forEach((e=>{const o=new RegExp(e,"i"),u=!!t.match(o);let c;c=r?!(!i.values||!i.values.length)&&u&&n(r,i.values):u,c&&s.push(a)}))}))})),s}(t,e.sampleValuesColumnName,e.sampleValues);r.push(...s)}if(e.sampleValues&&e.sampleValues.length){const s=function(e,t){const r=[];return e.forEach((e=>{e.getFields().forEach((s=>{s.values&&s.values.length&&n(t,s.values)&&r.push({layerId:e.getId(),field:s.id,displayName:e.getDisplayName()})}))})),r}(t,e.sampleValues);r.push(...s)}const s=r.reduce(((e,t)=>{const r=e.find((e=>e.config.layerId===t.layerId&&e.config.field===t.layerId));return r?r.count+=1:e.push({config:t,count:1}),e}),[]);return s.sort(((e,t)=>t.count-e.count)),s.length?s[0].config:null}function n(e,t){for(let r=0;r{const t=e[r];t&&"__other__"!==t&&!i.includes(t)&&i.push(t)})),Object(s.emsAutoSuggest)({sampleValues:i},e)}},538:function(e,t,r){"use strict";r.r(t),r.d(t,"ChoroplethChart",(function(){return b}));var s=r(4),i=r.n(s),a=r(1),n=r(35),o=r(0),u=r(229),c=r(2),l=r.n(c),d=r(41),p=r(14),h=r(20),m=r(169),g=r(3);class passive_map_PassiveMap extends s.Component{constructor(...e){super(...e),l()(this,"_isMounted",!1),l()(this,"_prevPassiveLayer",this.props.passiveLayer),l()(this,"_embeddableRef",i.a.createRef()),l()(this,"_onRenderSubscription",void 0),l()(this,"state",{mapEmbeddable:null})}componentDidMount(){this._isMounted=!0,this._setupEmbeddable()}componentWillUnmount(){this._isMounted=!1,this.state.mapEmbeddable&&this.state.mapEmbeddable.destroy(),this._onRenderSubscription&&this._onRenderSubscription.unsubscribe()}componentDidUpdate(){this.state.mapEmbeddable&&this._prevPassiveLayer!==this.props.passiveLayer&&(this.state.mapEmbeddable.updateLayerById(this.props.passiveLayer),this._prevPassiveLayer=this.props.passiveLayer)}async _setupEmbeddable(){const e=Object(m.createBasemapLayerDescriptor)(),t=e?[e]:[],r=await this.props.factory.create({id:Object(d.v4)(),attributes:{title:"",layerListJSON:JSON.stringify([...t,this.props.passiveLayer])},filters:[],hidePanelTitles:!0,viewMode:h.ViewMode.VIEW,isLayerTOCOpen:!1,hideFilterActions:!0,mapSettings:{disableInteractive:!1,hideToolbarOverlay:!1,hideLayerControl:!1,hideViewControl:!1,initialLocation:n.INITIAL_LOCATION.AUTO_FIT_TO_BOUNDS,autoFitToDataBounds:!0}});r&&(this._onRenderSubscription=r.getOnRenderComplete$().subscribe((()=>{this._isMounted&&this.props.onRenderComplete()})),this._isMounted&&(r.setIsSharable(!1),this.setState({mapEmbeddable:r},(()=>{this.state.mapEmbeddable&&this._embeddableRef.current&&this.state.mapEmbeddable.render(this._embeddableRef.current)}))))}render(){return this.state.mapEmbeddable?Object(g.jsx)("div",{className:"mapEmbeddableContainer",ref:this._embeddableRef}):Object(g.jsx)(p.EuiLoadingChart,{mono:!0,size:"l"})}}function b({data:e,args:t,formatFactory:r,uiSettings:s,emsFileLayers:i,mapEmbeddableFactory:c,onRenderComplete:l}){if(!t.regionAccessor||!t.valueAccessor)return null;let d=t.emsLayerId?t.emsLayerId:o.Jb,p=t.emsField?t.emsField:"iso2";if(!t.emsLayerId||!t.emsField){const r=Object(u.a)(i,e,t.regionAccessor);r&&(d=r.layerId,p=r.field)}const h=function(e,t){const r=t.find((t=>t.getId()===e));return r?r.getDisplayName():null}(d,i),m={id:t.layerId,label:h?a.i18n.translate("xpack.maps.lens.choroplethChart.choroplethLayerLabel",{defaultMessage:"{emsLayerLabel} by {accessorLabel}",values:{emsLayerLabel:h,accessorLabel:y(e,t.valueAccessor)}}):"",joins:[{leftField:p,right:{id:t.valueAccessor,type:n.SOURCE_TYPES.TABLE_SOURCE,__rows:e.rows,__columns:[{name:t.regionAccessor,label:y(e,t.regionAccessor),type:"string"},{name:t.valueAccessor,label:y(e,t.valueAccessor),type:"number"}],term:t.regionAccessor}}],sourceDescriptor:{type:n.SOURCE_TYPES.EMS_FILE,id:d,tooltipProperties:[p]},style:{type:"VECTOR",properties:{[n.VECTOR_STYLES.FILL_COLOR]:{type:n.STYLE_TYPE.DYNAMIC,options:{color:"Blue to Red",colorCategory:"palette_0",fieldMetaOptions:{isEnabled:!0,sigma:3},type:n.COLOR_MAP_TYPE.ORDINAL,field:{name:t.valueAccessor,origin:n.FIELD_ORIGIN.JOIN},useCustomColorRamp:!1}},[n.VECTOR_STYLES.LINE_COLOR]:{type:n.STYLE_TYPE.STATIC,options:{color:"#3d3d3d"}},[n.VECTOR_STYLES.LINE_WIDTH]:{type:n.STYLE_TYPE.STATIC,options:{size:1}}},isTimeAware:!1},type:n.LAYER_TYPE.GEOJSON_VECTOR};return Object(g.jsx)(passive_map_PassiveMap,{passiveLayer:m,factory:c,onRenderComplete:l})}function y(e,t){const r=e.columns.find((e=>e.id===t));return r?r.name:t}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"f",(function(){return a})),r.d(t,"e",(function(){return n})),r.d(t,"b",(function(){return o})),r.d(t,"d",(function(){return u})),r.d(t,"c",(function(){return c}));var s=r(1);function i(){return s.i18n.translate("xpack.maps.source.dataSourceLabel",{defaultMessage:"Data source"})}function a(){return s.i18n.translate("xpack.maps.source.urlLabel",{defaultMessage:"Url"})}function n(e){switch(e){case"intersects":return s.i18n.translate("xpack.maps.common.esSpatialRelation.intersectsLabel",{defaultMessage:"intersects"});case"disjoint":return s.i18n.translate("xpack.maps.common.esSpatialRelation.disjointLabel",{defaultMessage:"disjoint"});case"within":return s.i18n.translate("xpack.maps.common.esSpatialRelation.withinLabel",{defaultMessage:"within"});case"contains":return s.i18n.translate("xpack.maps.common.esSpatialRelation.containsLabel",{defaultMessage:"contains"});default:return e}}function o(){return s.i18n.translate("xpack.maps.dataView.label",{defaultMessage:"Data view"})}function u(){return s.i18n.translate("xpack.maps.dataView.selectPlacholder",{defaultMessage:"Select data view"})}function c(e){return s.i18n.translate("xpack.maps.dataView.notFoundMessage",{defaultMessage:"Unable to find data view '{id}'",values:{id:e}})}},87:function(e,t,r){"use strict";r.d(t,"a",(function(){return DataRequest})),r.d(t,"b",(function(){return DataRequestAbortError}));var s=r(2),i=r.n(s);class DataRequest{constructor(e){i()(this,"_descriptor",void 0),this._descriptor={...e}}getData(){return this._descriptor.data}isLoading(){return!!this._descriptor.dataRequestToken}getMeta(){return this._descriptor.dataRequestMetaAtStart?this._descriptor.dataRequestMetaAtStart:this._descriptor.dataRequestMeta?this._descriptor.dataRequestMeta:{}}hasData(){return!!this._descriptor.data}hasDataOrRequestInProgress(){return this.hasData()||this.isLoading()}getDataId(){return this._descriptor.dataId}getRequestToken(){return this._descriptor.dataRequestToken}}class DataRequestAbortError extends Error{constructor(){super()}}},88:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return i}));const s="__trackedLayerDescriptor";function i(e){if("object"!=typeof e||null===e)return e;const t=Array.isArray(e)?[]:{};for(const r in e)r.startsWith("__")||(t[r]=i(e[r]));return t}},93:function(e,t,r){e.exports=r(22)(190)}}]);