/*! 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([[22,8],{173:function(e,n,t){"use strict";t.r(n),t.d(n,"suggestEMSTermJoinConfig",(function(){return i})),t.d(n,"emsAutoSuggest",(function(){return s}));var a=t(75);async function i(e){try{return s(e,await Object(a.getEmsFileLayers)())}catch(e){return null}}function s(e,n){const t=[];if(e.sampleValuesColumnName){const a=function(e,n,t){const a=[];return e.forEach((e=>{e.getFields().forEach((i=>{if(!i.alias||!i.alias.length)return;const s={layerId:e.getId(),field:i.id,displayName:e.getDisplayName()};i.alias.forEach((e=>{const c=new RegExp(e,"i"),r=!!n.match(c);let l;l=t?!(!i.values||!i.values.length)&&r&&u(t,i.values):r,l&&a.push(s)}))}))})),a}(n,e.sampleValuesColumnName,e.sampleValues);t.push(...a)}if(e.sampleValues&&e.sampleValues.length){const a=function(e,n){const t=[];return e.forEach((e=>{e.getFields().forEach((a=>{a.values&&a.values.length&&u(n,a.values)&&t.push({layerId:e.getId(),field:a.id,displayName:e.getDisplayName()})}))})),t}(n,e.sampleValues);t.push(...a)}const a=t.reduce(((e,n)=>{const t=e.find((e=>e.config.layerId===n.layerId&&e.config.field===n.layerId));return t?t.count+=1:e.push({config:n,count:1}),e}),[]);return a.sort(((e,n)=>n.count-e.count)),a.length?a[0].config:null}function u(e,n){for(let t=0;t{try{e(await Object(a.A)().createEMSClient())}catch(e){n(e)}})));const e=await l,n=Object(i.c)();return r!==n&&(r=n,e.addQueryParams({license:n||""})),e}function f(){return 2===window.devicePixelRatio}}}]);