/*! 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([[11,8,19,22],{100:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var n=s(1),a=s(5);function r(){const e=Object(a.l)();return e.isIncludeElasticMapsService()?e.isEMSUrlSet()?e.hasOnPremLicense()?n.i18n.translate("xpack.maps.source.ems.noOnPremConnectionDescription",{defaultMessage:"Cannot connect to {host}.",values:{host:e.getEMSRoot()}}):n.i18n.translate("xpack.maps.source.ems.noOnPremLicenseDescription",{defaultMessage:"An enterprise license is required to connect to local Elastic Maps Server installations."}):n.i18n.translate("xpack.maps.source.ems.noAccessDescription",{defaultMessage:"Kibana is unable to access Elastic Maps Service. Contact your system administrator."}):n.i18n.translate("xpack.maps.source.ems.disabledDescription",{defaultMessage:'Access to Elastic Maps Service has been disabled. Ask your system administrator to set "map.includeElasticMapsService" in kibana.yml.'})}},134:function(e,t,s){"use strict";s.d(t,"a",(function(){return EMSFileSelect}));var n=s(2),a=s.n(n),r=s(4),i=s(14),o=s(1),l=s(75),c=s(100),u=s(3);class EMSFileSelect extends r.Component{constructor(...e){super(...e),a()(this,"_isMounted",!1),a()(this,"state",{hasLoadedOptions:!1,emsFileOptions:[]}),a()(this,"_loadFileOptions",(async()=>{let e=[];try{e=await Object(l.getEmsFileLayers)()}catch(e){this._isMounted&&this.setState({hasLoadedOptions:!0,emsFileOptions:[]})}const t=e.map((e=>({value:e.getId(),label:e.getDisplayName()})));this._isMounted&&this.setState({hasLoadedOptions:!0,emsFileOptions:t})})),a()(this,"_onChange",(e=>{0!==e.length&&this.props.onChange(e[0].value)}))}componentWillUnmount(){this._isMounted=!1}componentDidMount(){this._isMounted=!0,this._loadFileOptions()}_renderSelect(){if(!this.state.hasLoadedOptions)return Object(u.jsx)(i.EuiSelect,{isLoading:!0});const e=this.state.emsFileOptions.find((e=>e.value===this.props.value));return Object(u.jsx)(i.EuiComboBox,{placeholder:o.i18n.translate("xpack.maps.emsFileSelect.selectPlaceholder",{defaultMessage:"Select EMS boundaries"}),options:this.state.emsFileOptions,selectedOptions:e?[e]:[],onChange:this._onChange,isClearable:!1,singleSelection:!0,isDisabled:0===this.state.emsFileOptions.length,"data-test-subj":"emsFileSelect"})}render(){return Object(u.jsx)(i.EuiFormRow,{label:o.i18n.translate("xpack.maps.source.emsFileSelect.selectLabel",{defaultMessage:"EMS boundaries"}),helpText:0===this.state.emsFileOptions.length?Object(c.a)():null,display:this.props.isColumnCompressed?"columnCompressed":"row"},this._renderSelect())}}},139:function(e,t,s){"use strict";e.exports=s(177)},140:function(e,t,s){"use strict";e.exports=s(184)},173:function(e,t,s){"use strict";s.r(t),s.d(t,"suggestEMSTermJoinConfig",(function(){return a})),s.d(t,"emsAutoSuggest",(function(){return r}));var n=s(75);async function a(e){try{return r(e,await Object(n.getEmsFileLayers)())}catch(e){return null}}function r(e,t){const s=[];if(e.sampleValuesColumnName){const n=function(e,t,s){const n=[];return e.forEach((e=>{e.getFields().forEach((a=>{if(!a.alias||!a.alias.length)return;const r={layerId:e.getId(),field:a.id,displayName:e.getDisplayName()};a.alias.forEach((e=>{const o=new RegExp(e,"i"),l=!!t.match(o);let c;c=s?!(!a.values||!a.values.length)&&l&&i(s,a.values):l,c&&n.push(r)}))}))})),n}(t,e.sampleValuesColumnName,e.sampleValues);s.push(...n)}if(e.sampleValues&&e.sampleValues.length){const n=function(e,t){const s=[];return e.forEach((e=>{e.getFields().forEach((n=>{n.values&&n.values.length&&i(t,n.values)&&s.push({layerId:e.getId(),field:n.id,displayName:e.getDisplayName()})}))})),s}(t,e.sampleValues);s.push(...n)}const n=s.reduce(((e,t)=>{const s=e.find((e=>e.config.layerId===t.layerId&&e.config.field===t.layerId));return s?s.count+=1:e.push({config:t,count:1}),e}),[]);return n.sort(((e,t)=>t.count-e.count)),n.length?n[0].config:null}function i(e,t){for(let s=0;s=4;++n,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),s=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&s)+(59797*(s>>>16)<<16);switch(a){case 3:s^=(255&e.charCodeAt(n+2))<<16;case 2:s^=(255&e.charCodeAt(n+1))<<8;case 1:s=1540483477*(65535&(s^=255&e.charCodeAt(n)))+(59797*(s>>>16)<<16)}return(((s=1540483477*(65535&(s^=s>>>13))+(59797*(s>>>16)<<16))^s>>>15)>>>0).toString(36)}},180:function(e,t,s){"use strict";e.exports=s(181)},181:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},182:function(e,t,s){"use strict";e.exports=s(183)},183:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Object.create(null);return function(s){return void 0===t[s]&&(t[s]=e(s)),t[s]}}},184:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="undefined"!=typeof document,a=function(e,t,s){var a=e.key+"-"+t.name;(!1===s||!1===n&&void 0!==e.compat)&&void 0===e.registered[a]&&(e.registered[a]=t.styles)};t.getRegisteredStyles=function(e,t,s){var n="";return s.split(" ").forEach((function(s){void 0!==e[s]?t.push(e[s]+";"):n+=s+" "})),n},t.insertStyles=function(e,t,s){a(e,t,s);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i="",o=t;do{var l=e.insert(t===o?"."+r:"",o,e.sheet,!0);n||void 0===l||(i+=l),o=o.next}while(void 0!==o);if(!n&&0!==i.length)return i}},t.registerStyles=a},229:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));var n=s(173);function a(e,t,s){const a=[];return t.rows.forEach((e=>{const t=e[s];t&&"__other__"!==t&&!a.includes(t)&&a.push(t)})),Object(n.emsAutoSuggest)({sampleValues:a},e)}},536:function(e,t,s){"use strict";s.r(t),s.d(t,"getVisualization",(function(){return A}));var n=s(4),a=s.n(n),r=s(1),i=s(67),o=s(23),l=s.n(o),c=s(174),u=s(46);const d={subdued:Object(c.css)("fill:",u.euiThemeVars.euiTextSubduedColor,";",""),accent:Object(c.css)("fill:",u.euiThemeVars.euiColorVis0,";","")};var f=s(3);const p=({title:e,titleId:t,...s})=>Object(f.jsx)("svg",l()({xmlns:"http://www.w3.org/2000/svg",width:"30",height:"22",viewBox:"0 0 30 22"},s),e?Object(f.jsx)("title",{id:t}):null,Object(f.jsx)("path",{className:d.accent,d:"M.985.001L1.01 0H7c.325 0 .502.078.602.145.105.07.188.17.254.302A1.46 1.46 0 018 1.01v3.982a1.46 1.46 0 01-.144.562.758.758 0 01-.254.302C7.502 5.922 7.325 6 7 6c-.325 0-.502-.078-.602-.145a.758.758 0 01-.254-.302A1.46 1.46 0 016 4.99v-.012a1.984 1.984 0 00-.006-.135 3.457 3.457 0 00-.35-1.29 2.754 2.754 0 00-.933-1.073C4.248 2.172 3.675 2 3 2H1.009a1.46 1.46 0 01-.562-.144.758.758 0 01-.302-.254C.078 1.502 0 1.325 0 1 0 .675.078.498.145.398A.758.758 0 01.447.144 1.46 1.46 0 01.985.001zM0 21v-5.991l.001-.024a1.46 1.46 0 01.143-.538.757.757 0 01.254-.302C.498 14.078.675 14 1 14h8c.675 0 1.248-.172 1.71-.48.458-.305.75-.704.934-1.073A3.453 3.453 0 0012 11.056v-.046l.002-.025a1.464 1.464 0 01.143-.538.758.758 0 01.254-.302c.1-.067.277-.145.602-.145.325 0 .502.078.602.145.105.07.188.17.254.302a1.464 1.464 0 01.143.538l.001.024V21c0 .325-.078.502-.145.602a.758.758 0 01-.302.254 1.464 1.464 0 01-.538.143h-.013L12.99 22H1.009l-.024-.001a1.464 1.464 0 01-.538-.143.758.758 0 01-.302-.254C.078 21.502 0 21.325 0 21zM27.009 14l-.024.001a1.464 1.464 0 00-.538.143.757.757 0 00-.302.255c-.067.099-.145.276-.145.601v1.991l.001.024a1.464 1.464 0 00.143.538.757.757 0 00.254.302c.1.067.277.145.602.145h1.991l.024-.001a1.464 1.464 0 00.538-.143.757.757 0 00.302-.254c.067-.1.145-.277.145-.602v-1.991l-.001-.024a1.464 1.464 0 00-.143-.538.757.757 0 00-.254-.302c-.1-.067-.277-.145-.602-.145h-1.991z"}),Object(f.jsx)("path",{className:d.subdued,d:"M18 3V.981.959a1.424 1.424 0 00-.128-.522.7.7 0 00-.242-.29C17.53.081 17.346 0 17 0h-6c-.325 0-.502.078-.602.145a.758.758 0 00-.254.302 1.464 1.464 0 00-.143.538L10 1.01v4.013a1.984 1.984 0 01-.006.135 3.457 3.457 0 01-.35 1.29 2.754 2.754 0 01-.933 1.073C8.248 7.828 7.675 8 7 8s-1.248-.172-1.711-.48a2.754 2.754 0 01-.933-1.073A3.457 3.457 0 014 5.022V5.01a1.46 1.46 0 00-.144-.563.758.758 0 00-.254-.302C3.502 4.078 3.325 4 3 4H1.009l-.024.001a1.46 1.46 0 00-.538.143.758.758 0 00-.302.254C.078 4.498 0 4.675 0 5v5.991l.001.024a1.46 1.46 0 00.143.538.758.758 0 00.254.303c.1.066.277.144.602.144h8c.325 0 .502-.078.602-.145a.757.757 0 00.254-.302 1.46 1.46 0 00.143-.538L10 10.99v-.025l.001-.02c0-.027.003-.061.005-.102a3.453 3.453 0 01.35-1.29c.184-.369.476-.768.933-1.073C11.752 8.172 12.325 8 13 8s1.248.172 1.71.48c.458.305.75.704.934 1.073A3.453 3.453 0 0116 10.978v4.013l.001.024a1.464 1.464 0 00.143.538.757.757 0 00.254.302c.1.067.277.145.602.145.325 0 .502-.078.602-.145a.758.758 0 00.254-.302 1.464 1.464 0 00.143-.538v-.012l.001-.012V11c0-.675.172-1.248.48-1.711.305-.457.704-.75 1.073-.933A3.456 3.456 0 0120.944 8H20.99l.025-.002a1.46 1.46 0 00.538-.143.758.758 0 00.302-.254c.067-.1.145-.277.145-.602 0-.325-.078-.502-.145-.602a.758.758 0 00-.302-.254 1.46 1.46 0 00-.538-.143h-.017L20.99 6c-.671-.002-1.24-.173-1.702-.48a2.754 2.754 0 01-.933-1.073A3.453 3.453 0 0118 3.022V3z"}),Object(f.jsx)("path",{className:d.subdued,d:"M20 3V1.009l.001-.024a1.464 1.464 0 01.143-.538.758.758 0 01.254-.302C20.498.078 20.675 0 21 0h8c.325 0 .502.078.602.145.105.07.188.17.254.302a1.464 1.464 0 01.143.538L30 1.01V11c0 .325-.078.502-.145.602a.758.758 0 01-.302.254 1.464 1.464 0 01-.538.143H29L28.99 12h-7.982l-.024-.001a1.464 1.464 0 01-.538-.143.758.758 0 01-.302-.254c-.067-.1-.145-.277-.145-.602 0-.325.078-.502.145-.602a.758.758 0 01.302-.254 1.464 1.464 0 01.538-.143L21.01 10h.025l.02-.001c.027 0 .061-.003.102-.005a3.456 3.456 0 001.29-.35 2.755 2.755 0 001.073-.933C23.828 8.248 24 7.675 24 7s-.172-1.248-.48-1.711a2.755 2.755 0 00-1.073-.933A3.456 3.456 0 0021.022 4h-.012a1.46 1.46 0 01-.563-.144.757.757 0 01-.302-.254C20.078 3.502 20 3.325 20 3zM20.998 14l-.013.001a1.464 1.464 0 00-.538.143.757.757 0 00-.302.255c-.067.099-.145.276-.145.601 0 .675-.172 1.248-.48 1.71-.305.458-.704.75-1.073.934a3.453 3.453 0 01-1.425.356h-.012l-.025.001a1.464 1.464 0 00-.538.143.757.757 0 00-.302.254c-.067.1-.145.277-.145.602v1.991l.001.024a1.464 1.464 0 00.143.538.757.757 0 00.254.302c.1.067.277.145.602.145h11.991l.024-.001a1.464 1.464 0 00.538-.143.758.758 0 00.302-.254c.067-.1.145-.277.145-.602 0-.325-.078-.502-.145-.602a.758.758 0 00-.302-.254A1.464 1.464 0 0028.99 20H27c-.675 0-1.248-.172-1.71-.48a2.755 2.755 0 01-.934-1.073A3.453 3.453 0 0124 17.022V15c0-.325-.078-.502-.145-.601a.757.757 0 00-.302-.255A1.464 1.464 0 0022.99 14H20.998z"}));var m=s(39),h=s(229),g=s(14),y=s(134);function v(e){let t;const s=b(e.emsFileLayers,e.state.emsLayerId);if(s.length){let n;e.state.emsField&&(n=s.find((t=>e.state.emsField===t.value))),t=Object(f.jsx)(g.EuiFormRow,{label:r.i18n.translate("xpack.maps.choropleth.joinFieldLabel",{defaultMessage:"Join field"}),display:"columnCompressed"},Object(f.jsx)(g.EuiComboBox,{singleSelection:!0,isClearable:!1,options:s,selectedOptions:n?[n]:[],onChange:function(t){0!==t.length&&e.setState({...e.state,emsField:t[0].value})}}))}return Object(f.jsx)(a.a.Fragment,null,Object(f.jsx)(y.a,{isColumnCompressed:!0,value:e.state.emsLayerId?e.state.emsLayerId:null,onChange:function(t){const s=b(e.emsFileLayers,t);e.setState({...e.state,emsLayerId:t,emsField:s.length?s[0].value:void 0})}}),t)}function b(e,t){if(!t)return[];const s=e.find((e=>e.getId()===t));return s?s.getFieldsInLanguage().filter((e=>"id"===e.type)).map((e=>({value:e.name,label:e.description}))):[]}const C="region_key",S="metric",x=r.i18n.translate("xpack.maps.lens.choropleth.label",{defaultMessage:"Region map"}),A=({paletteService:e,theme:t,emsFileLayers:s})=>({id:"lnsChoropleth",visualizationTypes:[{id:"lnsChoropleth",icon:p,label:x,groupLabel:r.i18n.translate("xpack.maps.lens.groupLabel",{defaultMessage:"Map"}),sortPriority:1,showExperimentalBadge:!0}],getVisualizationTypeId:()=>"lnsChoropleth",clearLayer(e){const t={...e};return delete t.emsLayerId,delete t.emsField,delete t.regionAccessor,delete t.valueAccessor,t},getLayerIds:e=>[e.layerId],getDescription:()=>({icon:p,label:x}),getSuggestions:e=>function(e,t){const{activeData:s,keptLayerIds:n,state:a,table:i}=e;if(!s)return[];if(a&&"unchanged"===i.changeType||n.length>1||n.length&&i.layerId!==n[0])return[];const[o,l]=Object(m.partition)(i.columns,(e=>e.operation.isBucketed));if(1!==o.length||1!==l.length)return[];const c=l[0],u=[];return o.filter((e=>"string"===e.operation.dataType)).forEach((e=>{for(const n in s)if(s.hasOwnProperty(n)){const a=Object(h.a)(t,s[n],e.columnId);a&&u.push({title:r.i18n.translate("xpack.maps.lens.choroplethChart.suggestionLabel",{defaultMessage:"{emsLayerLabel} by {metricLabel}",values:{emsLayerLabel:a.displayName,metricLabel:c.operation.label.toLowerCase()}}),score:.7,state:{layerId:n,emsLayerId:a.layerId,emsField:a.field,valueAccessor:c.columnId,regionAccessor:e.columnId},previewIcon:p})}})),u}(e,s),initialize:(e,t)=>t||{layerId:e(),layerType:i.layerTypes.DATA},getConfiguration:({state:e})=>({groups:[{groupId:C,groupLabel:r.i18n.translate("xpack.maps.lens.choroplethChart.regionKeyLabel",{defaultMessage:"Region key"}),layerId:e.layerId,accessors:e.regionAccessor?[{columnId:e.regionAccessor}]:[],supportsMoreColumns:!e.regionAccessor,filterOperations:e=>e.isBucketed&&"string"===e.dataType,enableDimensionEditor:!0,required:!0,dataTestSubj:"lnsChoropleth_regionKeyDimensionPanel"},{groupId:S,groupLabel:r.i18n.translate("xpack.maps.lens.choroplethChart.metricValueLabel",{defaultMessage:"Metric"}),layerId:e.layerId,accessors:e.valueAccessor?[{columnId:e.valueAccessor}]:[],supportsMoreColumns:!e.valueAccessor,filterOperations:e=>!e.isBucketed&&"number"===e.dataType,enableDimensionEditor:!0,required:!0,dataTestSubj:"lnsChoropleth_valueDimensionPanel"}]}),getSupportedLayers:()=>[{type:i.layerTypes.DATA,label:r.i18n.translate("xpack.maps.lens.choroplethChart.addLayer",{defaultMessage:"Add visualization layer"})}],getLayerType(e,t){if((null==t?void 0:t.layerId)===e)return i.layerTypes.DATA},toExpression:(e,t,s,n={})=>{if(!e.regionAccessor||!e.valueAccessor)return null;const a=n[e.layerId];return{type:"expression",chain:[...a?a.chain:[],{type:"function",function:"lens_choropleth_chart",arguments:{title:[(null==s?void 0:s.title)||""],layerId:[e.layerId],emsField:e.emsField?[e.emsField]:[],emsLayerId:e.emsLayerId?[e.emsLayerId]:[],regionAccessor:[e.regionAccessor],valueAccessor:[e.valueAccessor]}}]}},toPreviewExpression:(e,t)=>null,setDimension({columnId:e,groupId:t,prevState:s}){const n={};return t===C?n.regionAccessor=e:t===S&&(n.valueAccessor=e),{...s,...n}},removeDimension({prevState:e,layerId:t,columnId:s}){const n={...e};return e.regionAccessor===s?(delete n.regionAccessor,delete n.emsLayerId,delete n.emsField):e.valueAccessor===s&&delete n.valueAccessor,n},DimensionEditorComponent:e=>e.groupId===C?Object(f.jsx)(v,{emsFileLayers:s,state:e.state,setState:e.setState}):null})},75:function(e,t,s){"use strict";s.r(t),s.d(t,"getKibanaTileMap",(function(){return r})),s.d(t,"getEmsFileLayers",(function(){return i})),s.d(t,"getEmsTmsServices",(function(){return o})),s.d(t,"isRetina",(function(){return d}));var n=s(5),a=s(19);function r(){const e=Object(n.A)();return e.config.tilemap?e.config.tilemap:{}}async function i(){return Object(n.l)().isEMSEnabled()?(await u()).getFileLayers():[]}async function o(){return Object(n.l)().isEMSEnabled()?(await u()).getTMSServices():[]}let l,c=null;async function u(){c||(c=new Promise((async(e,t)=>{try{e(await Object(n.A)().createEMSClient())}catch(e){t(e)}})));const e=await c,t=Object(a.c)();return l!==t&&(l=t,e.addQueryParams({license:t||""})),e}function d(){return 2===window.devicePixelRatio}}}]);