(window.discover_bundle_jsonpfunction=window.discover_bundle_jsonpfunction||[]).push([[5],{101:function(e,t,i){switch(window.__kbnThemeTag__){case"v8dark":return i(102);case"v8light":return i(104)}},102:function(e,t,i){var n=i(70),l=i(103);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},103:function(e,t,i){(t=i(71)(!1)).push([e.i,".kbnFieldButton{align-items:flex-start;border-radius:6px;display:flex;font-size:14px;font-size:1rem;line-height:1.71429rem;margin-bottom:4px;padding:0 8px;transition:box-shadow .15s cubic-bezier(.694,.0482,.335,1),background-color .15s cubic-bezier(.694,.0482,.335,1)}.kbnFieldButton-isActive,.kbnFieldButton:focus-within{outline:2px solid currentColor}.kbnFieldButton-isActive:focus-visible,.kbnFieldButton:focus-within:focus-visible{outline-style:auto}.kbnFieldButton-isActive:not(:focus-visible),.kbnFieldButton:focus-within:not(:focus-visible){outline:none}.kbnFieldButton__button{align-items:flex-start;display:flex;flex-grow:1;line-height:normal;padding:8px 0;text-align:left}.kbnFieldButton__fieldIcon{flex-shrink:0;line-height:0}.kbnFieldButton__name{flex-grow:1;padding:0 8px;word-break:break-word}.kbnFieldButton__infoIcon{align-items:center;display:flex;flex-shrink:0;justify-content:center;line-height:0;min-height:16px}.kbnFieldButton__fieldAction{margin-left:8px}.kbnFieldButton__dragHandle{margin-right:8px}.kbnFieldButton__dragHandle,.kbnFieldButton__fieldAction{line-height:32px}.kbnFieldButton--xs{font-size:12px}.kbnFieldButton--xs .kbnFieldButton__button{padding:4px 0}.kbnFieldButton--xs .kbnFieldButton__fieldAction{margin-left:4px}.kbnFieldButton--xs .kbnFieldButton__dragHandle,.kbnFieldButton--xs .kbnFieldButton__fieldAction{line-height:24px}.kbnFieldButton--flushBoth{padding-left:0;padding-right:0}",""]),e.exports=t},104:function(e,t,i){var n=i(70),l=i(105);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},105:function(e,t,i){(t=i(71)(!1)).push([e.i,".kbnFieldButton{align-items:flex-start;border-radius:6px;display:flex;font-size:14px;font-size:1rem;line-height:1.71429rem;margin-bottom:4px;padding:0 8px;transition:box-shadow .15s cubic-bezier(.694,.0482,.335,1),background-color .15s cubic-bezier(.694,.0482,.335,1)}.kbnFieldButton-isActive,.kbnFieldButton:focus-within{outline:2px solid currentColor}.kbnFieldButton-isActive:focus-visible,.kbnFieldButton:focus-within:focus-visible{outline-style:auto}.kbnFieldButton-isActive:not(:focus-visible),.kbnFieldButton:focus-within:not(:focus-visible){outline:none}.kbnFieldButton__button{align-items:flex-start;display:flex;flex-grow:1;line-height:normal;padding:8px 0;text-align:left}.kbnFieldButton__fieldIcon{flex-shrink:0;line-height:0}.kbnFieldButton__name{flex-grow:1;padding:0 8px;word-break:break-word}.kbnFieldButton__infoIcon{align-items:center;display:flex;flex-shrink:0;justify-content:center;line-height:0;min-height:16px}.kbnFieldButton__fieldAction{margin-left:8px}.kbnFieldButton__dragHandle{margin-right:8px}.kbnFieldButton__dragHandle,.kbnFieldButton__fieldAction{line-height:32px}.kbnFieldButton--xs{font-size:12px}.kbnFieldButton--xs .kbnFieldButton__button{padding:4px 0}.kbnFieldButton--xs .kbnFieldButton__fieldAction{margin-left:4px}.kbnFieldButton--xs .kbnFieldButton__dragHandle,.kbnFieldButton--xs .kbnFieldButton__fieldAction{line-height:24px}.kbnFieldButton--flushBoth{padding-left:0;padding-right:0}",""]),e.exports=t},124:function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i(83);function l(e,t){var i;const l=t?t(e):function(e){var t;return e.timeSeriesMetric||(null!==(t=e.type)&&void 0!==t?t:"string")}(e),s=(null===(i=e.esTypes)||void 0===i?void 0:i[0])||null;return s&&["_id","_index"].includes(s)&&"string"===l?"keyword":"unknown"===l&&s&&Object(n.c)(s)||"string"===l&&s?s:l}},145:function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));const n={META_FIELDS:"metaFields",DOC_HIGHLIGHT:"doc_table:highlight",QUERY_STRING_OPTIONS:"query:queryString:options",QUERY_ALLOW_LEADING_WILDCARDS:"query:allowLeadingWildcards",SEARCH_QUERY_LANGUAGE:"search:queryLanguage",SORT_OPTIONS:"sort:options",COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX:"courier:ignoreFilterIfFieldNotInIndex",COURIER_SET_REQUEST_PREFERENCE:"courier:setRequestPreference",COURIER_CUSTOM_REQUEST_PREFERENCE:"courier:customRequestPreference",COURIER_MAX_CONCURRENT_SHARD_REQUESTS:"courier:maxConcurrentShardRequests",SEARCH_INCLUDE_FROZEN:"search:includeFrozen",SEARCH_TIMEOUT:"search:timeout",HISTOGRAM_BAR_TARGET:"histogram:barTarget",HISTOGRAM_MAX_BARS:"histogram:maxBars",HISTORY_LIMIT:"history:limit",TIMEPICKER_REFRESH_INTERVAL_DEFAULTS:"timepicker:refreshIntervalDefaults",TIMEPICKER_QUICK_RANGES:"timepicker:quickRanges",TIMEPICKER_TIME_DEFAULTS:"timepicker:timeDefaults",FILTERS_PINNED_BY_DEFAULT:"filters:pinnedByDefault",FILTERS_EDITOR_SUGGEST_VALUES:"filterEditor:suggestValues",AUTOCOMPLETE_USE_TIMERANGE:"autocomplete:useTimeRange",AUTOCOMPLETE_VALUE_SUGGESTION_METHOD:"autocomplete:valueSuggestionMethod",DATE_FORMAT:"dateFormat",DATEFORMAT_TZ:"dateFormat:tz"}},146:function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i(124);function l(e){return{type:Object(n.a)(e),scripted:e.scripted}}},147:function(e,t,i){"use strict";i.d(t,"a",(function(){return d}));var n=i(2),l=i.n(n),s=i(1);const o=()=>Object(s.jsx)(n.Fragment,null),a=l.a.lazy((()=>i.e(12).then(i.bind(null,276)))),d=function(e){return Object(s.jsx)(l.a.Suspense,{fallback:Object(s.jsx)(o,null)},Object(s.jsx)(a,e))}},261:function(e,t,i){switch(window.__kbnThemeTag__){case"v8dark":return i(262);case"v8light":return i(264)}},262:function(e,t,i){var n=i(70),l=i(263);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},263:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldListSidebar{flex-grow:1;height:100%;margin:0!important;overflow:hidden;padding:0;width:304px}@media only screen and (max-width:574px){.unifiedFieldListSidebar{background-color:#141519;padding:16px;width:100%}}@media only screen and (min-width:575px) and (max-width:767px){.unifiedFieldListSidebar{background-color:#141519;padding:16px;width:100%}}.unifiedFieldListSidebar__list{padding:8px 0 8px 8px}@media only screen and (max-width:574px){.unifiedFieldListSidebar__list{padding:8px 0 0}}@media only screen and (min-width:575px) and (max-width:767px){.unifiedFieldListSidebar__list{padding:8px 0 0}}.unifiedFieldListSidebar__group{height:100%}.unifiedFieldListSidebar__mobile{padding:8px 8px 0;width:100%}.unifiedFieldListSidebar__mobile .unifiedFieldListSidebar__mobileBadge{margin-left:8px;vertical-align:text-bottom}.unifiedFieldListSidebar__flyoutHeader{align-items:center}",""]),e.exports=t},264:function(e,t,i){var n=i(70),l=i(265);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},265:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldListSidebar{flex-grow:1;height:100%;margin:0!important;overflow:hidden;padding:0;width:304px}@media only screen and (max-width:574px){.unifiedFieldListSidebar{background-color:#fafbfd;padding:16px;width:100%}}@media only screen and (min-width:575px) and (max-width:767px){.unifiedFieldListSidebar{background-color:#fafbfd;padding:16px;width:100%}}.unifiedFieldListSidebar__list{padding:8px 0 8px 8px}@media only screen and (max-width:574px){.unifiedFieldListSidebar__list{padding:8px 0 0}}@media only screen and (min-width:575px) and (max-width:767px){.unifiedFieldListSidebar__list{padding:8px 0 0}}.unifiedFieldListSidebar__group{height:100%}.unifiedFieldListSidebar__mobile{padding:8px 8px 0;width:100%}.unifiedFieldListSidebar__mobile .unifiedFieldListSidebar__mobileBadge{margin-left:8px;vertical-align:text-bottom}.unifiedFieldListSidebar__flyoutHeader{align-items:center}",""]),e.exports=t},266:function(e,t,i){switch(window.__kbnThemeTag__){case"v8dark":return i(267);case"v8light":return i(269)}},267:function(e,t,i){var n=i(70),l=i(268);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},268:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldListItemButton__action{opacity:0}.unifiedFieldListItemButton__action--always,.unifiedFieldListItemButton__action:focus{opacity:1}.unifiedFieldListItemButton{width:100%}.unifiedFieldListItemButton.kbnFieldButton-isActive,.unifiedFieldListItemButton.kbnFieldButton:focus-within{outline:none}.unifiedFieldListItemButton.kbnFieldButton-isActive:focus-visible,.unifiedFieldListItemButton.kbnFieldButton:focus-within:focus-visible{outline-style:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus{outline:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus:focus-visible{outline-style:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus .kbnFieldButton__nameInner{outline:2px solid currentColor}.unifiedFieldListItemButton .kbnFieldButton__button:focus:focus-visible .kbnFieldButton__nameInner{outline-style:auto}.unifiedFieldListItemButton .kbnFieldButton__button:focus:not(:focus-visible) .kbnFieldButton__nameInner{outline:none}.unifiedFieldListItemButton button .kbnFieldButton__nameInner:hover{text-decoration:underline}.unifiedFieldListItemButton:hover .unifiedFieldListItemButton__action,.unifiedFieldListItemButton[class*=-isActive] .unifiedFieldListItemButton__action{opacity:1}.unifiedFieldListItemButton--missing{background:#1d1e24;color:#98a2b3}",""]),e.exports=t},269:function(e,t,i){var n=i(70),l=i(270);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},270:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldListItemButton__action{opacity:0}.unifiedFieldListItemButton__action--always,.unifiedFieldListItemButton__action:focus{opacity:1}.unifiedFieldListItemButton{width:100%}.unifiedFieldListItemButton.kbnFieldButton-isActive,.unifiedFieldListItemButton.kbnFieldButton:focus-within{outline:none}.unifiedFieldListItemButton.kbnFieldButton-isActive:focus-visible,.unifiedFieldListItemButton.kbnFieldButton:focus-within:focus-visible{outline-style:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus{outline:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus:focus-visible{outline-style:none}.unifiedFieldListItemButton .kbnFieldButton__button:focus .kbnFieldButton__nameInner{outline:2px solid currentColor}.unifiedFieldListItemButton .kbnFieldButton__button:focus:focus-visible .kbnFieldButton__nameInner{outline-style:auto}.unifiedFieldListItemButton .kbnFieldButton__button:focus:not(:focus-visible) .kbnFieldButton__nameInner{outline:none}.unifiedFieldListItemButton button .kbnFieldButton__nameInner:hover{text-decoration:underline}.unifiedFieldListItemButton:hover .unifiedFieldListItemButton__action,.unifiedFieldListItemButton[class*=-isActive] .unifiedFieldListItemButton__action{opacity:1}.unifiedFieldListItemButton--missing{background:#98a2b31a;color:#69707d}",""]),e.exports=t},271:function(e,t,i){switch(window.__kbnThemeTag__){case"v8dark":return i(272);case"v8light":return i(274)}},272:function(e,t,i){var n=i(70),l=i(273);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},273:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldList__fieldPopover__fieldPopoverPanel{max-width:300px!important;min-width:260px!important}",""]),e.exports=t},274:function(e,t,i){var n=i(70),l=i(275);"string"==typeof(l=l.__esModule?l.default:l)&&(l=[[e.i,l,""]]);n(l,{insert:"head",singleton:!1}),e.exports=l.locals||{}},275:function(e,t,i){(t=i(71)(!1)).push([e.i,".unifiedFieldList__fieldPopover__fieldPopoverPanel{max-width:300px!important;min-width:260px!important}",""]),e.exports=t},302:function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i(145);function l(e){return{allowLeadingWildcards:e.get(n.a.QUERY_ALLOW_LEADING_WILDCARDS),queryStringOptions:e.get(n.a.QUERY_STRING_OPTIONS),ignoreFilterIfFieldNotInIndex:e.get(n.a.COURIER_IGNORE_FILTER_IF_FIELD_NOT_IN_INDEX),dateFormatTZ:e.get("dateFormat:tz")}}},303:function(e,t,i){"use strict";i.d(t,"a",(function(){return ErrorBoundary}));var n=i(2),l=i.n(n);class ErrorBoundary extends l.a.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?null:this.props.children}}},306:function(e,t,i){"use strict";i.r(t);var n=i(11),l=i.n(n),s=i(2),o=i.n(s),a=i(4),d=i(44),r=i(7),u=i(6),c=i(302),f=i(82),p=i(93);const b=async()=>(await Promise.resolve().then(i.t.bind(null,46,7))).buildEsQuery,F=Object(r.htmlIdGenerator)(),m={fetchStatus:p.a.unknown,existingFieldsByFieldNameMap:{},numberOfFetches:0},g=new u.BehaviorSubject({});let j="";const x=()=>{const e=Object(s.useRef)(!0),[t,i]=Object(s.useState)(g.getValue());Object(s.useEffect)((()=>{const t=g.subscribe((t=>{e.current&&Object.keys(t).length>0&&i((e=>({...e,...t})))}));return()=>{t.unsubscribe()}}),[i,e]);const n=Object(s.useCallback)(((e,i)=>{const n=t[e];return(null==n?void 0:n.fetchStatus)!==p.a.succeeded||(null==n?void 0:n.hasDataViewRestrictions)||Boolean(null==n?void 0:n.existingFieldsByFieldNameMap[i])}),[t]),l=Object(s.useCallback)((e=>e?t[e]:m),[t]),o=Object(s.useCallback)((e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.fetchStatus)||p.a.unknown}),[l]),a=Object(s.useCallback)((e=>{const t=l(e);return Boolean((null==t?void 0:t.fetchStatus)===p.a.failed||(null==t?void 0:t.hasDataViewRestrictions))}),[l]);return Object(s.useEffect)((()=>()=>{e.current=!1}),[e]),Object(s.useMemo)((()=>({hasFieldData:n,getFieldsExistenceStatus:o,isFieldsExistenceInfoUnavailable:a})),[n,o,a])};async function h(e,t,i,n){const l=await b();try{return l(e,t,i,n)}catch(e){return{bool:{must_not:{match_all:{}}}}}}var _=i(99);i(261),i(68);var v=i(32),O=i(1);const y={name:"zxsb69",styles:"position:relative;width:100%;height:100%"},k=({"data-test-subj":e="fieldList",isProcessing:t,prepend:i,append:n,className:l,children:s})=>Object(O.jsx)(r.EuiFlexGroup,{gutterSize:"none",direction:"column",responsive:!1,"data-test-subj":e,css:y,className:l},t&&Object(O.jsx)(r.EuiProgress,{size:"xs",color:"accent",position:"absolute"}),!!i&&Object(O.jsx)(r.EuiFlexItem,{grow:!1},i),Object(O.jsx)(r.EuiFlexItem,{grow:!0},s),!!n&&Object(O.jsx)(r.EuiFlexItem,{grow:!1},n)),I=()=>Object(O.jsx)(s.Fragment,null),E=o.a.lazy((()=>i.e(13).then(i.bind(null,310)))),S=function(e){return Object(O.jsx)(o.a.Suspense,{fallback:Object(O.jsx)(I,null)},Object(O.jsx)(E,e))},w=()=>Object(O.jsx)(s.Fragment,null),T=o.a.lazy((()=>i.e(8).then(i.bind(null,313)))),B=function(e){return Object(O.jsx)(o.a.Suspense,{fallback:Object(O.jsx)(w,null)},Object(O.jsx)(T,e))};var L=i(12),A=i(124);const N=Object(L.memoize)((function(e){const t=e.split("*").map(L.escapeRegExp).join(".*");return new RegExp(t.includes("*")?`^${t}$`:t,"i")})),M=(e,t)=>!!t&&(!!e.displayName&&N(t).test(e.displayName)||N(t).test(e.name)),P=Object(r.htmlIdGenerator)("fieldList");const D=new Intl.Collator(void 0,{sensitivity:"base"});function R(e,t){return D.compare(e.displayName||e.name,t.displayName||t.name)}function C(){return!0}var G=i(95),V=i(45),z=i.n(V),H=i(97),U=i(146),W=i(147);function $({field:e,fieldSearchHighlight:t,isSelected:i,isActive:n,isEmpty:s,infoIcon:o,className:d,getCustomFieldType:u,dataTestSubj:c,size:f,onClick:p,shouldAlwaysShowAction:b,buttonAddFieldToWorkspaceProps:F,buttonRemoveFieldFromWorkspaceProps:m,onAddFieldToWorkspace:g,onRemoveFieldFromWorkspace:j,...x}){var h,_;const v=e.displayName||e.name,y=v!==e.name&&"___records___"!==e.name?a.i18n.translate("unifiedFieldList.fieldItemButton.fieldTitle",{defaultMessage:"{fieldDisplayName} ({fieldName})",values:{fieldName:e.name,fieldDisplayName:v}}):v,k=u?{type:u(e)}:Object(U.a)(e),I=k.type,E=z()("unifiedFieldListItemButton",{[`unifiedFieldListItemButton--${I}`]:I,"unifiedFieldListItemButton--exists":!s,"unifiedFieldListItemButton--missing":s},d),S=null!==(h=null==F?void 0:F["aria-label"])&&void 0!==h?h:a.i18n.translate("unifiedFieldList.fieldItemButton.addFieldToWorkspaceLabel",{defaultMessage:'Add "{field}" field',values:{field:e.displayName}}),w=null!==(_=null==m?void 0:m["aria-label"])&&void 0!==_?_:a.i18n.translate("unifiedFieldList.fieldItemButton.removeFieldToWorkspaceLabel",{defaultMessage:'Remove "{field}" field',values:{field:e.displayName}}),T=z()("unifiedFieldListItemButton__action",{"unifiedFieldListItemButton__action--always":b}),B=i?j&&Object(O.jsx)(r.EuiToolTip,{key:`selected-to-remove-${e.name}-${w}`,content:w},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldToggle-${e.name}`,"aria-label":w},m||{},{className:z()(T,null==m?void 0:m.className),color:"danger",iconType:"cross",onClick:t=>{t.preventDefault(),t.stopPropagation(),j(e)}}))):g&&Object(O.jsx)(r.EuiToolTip,{key:`deselected-to-add-${e.name}-${S}`,content:S},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldToggle-${e.name}`,"aria-label":S},F||{},{className:z()(T,null==F?void 0:F.className),color:"text",iconType:"plusInCircle",onClick:t=>{t.preventDefault(),t.stopPropagation(),g(e)}}))),L="conflict"===e.type?Object(O.jsx)(q,null):null;return Object(O.jsx)(H.a,l()({key:`field-item-button-${e.name}`,dataTestSubj:c||`field-${e.name}-showDetails`,size:f||"s",className:E,isActive:n,buttonProps:{"aria-label":a.i18n.translate("unifiedFieldList.fieldItemButton.ariaLabel",{defaultMessage:"Preview {fieldDisplayName}: {fieldType}",values:{fieldDisplayName:v,fieldType:u?u(e):e.type}})},fieldIcon:Object(O.jsx)(W.a,k),fieldName:Object(O.jsx)(r.EuiHighlight,{search:K(v,t),title:y,"data-test-subj":`field-${e.name}`},v),fieldAction:B,fieldInfoIcon:L||o,onClick:p},x))}function q(){return Object(O.jsx)(r.EuiToolTip,{position:"bottom",content:a.i18n.translate("unifiedFieldList.fieldItemButton.mappingConflictDescription",{defaultMessage:"This field is defined as several types (string, integer, etc) across the indices that match this pattern.You may still be able to use this conflicting field, but it will be unavailable for functions that require Kibana to know their type. Correcting this issue will require reindexing your data."})},Object(O.jsx)(r.EuiIcon,{tabIndex:0,type:"warning",title:a.i18n.translate("unifiedFieldList.fieldItemButton.mappingConflictTitle",{defaultMessage:"Mapping Conflict"}),size:"s"}))}function K(e,t){const i=t||"";return i.includes("*")&&M({name:e},i)?e:i}i(266);var Y=i(51);const Q=({field:e,visualizeInfo:t,handleVisualizeLinkClick:i,buttonProps:n})=>Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)(r.EuiButton,l()({fullWidth:!0,size:"s","data-test-subj":`fieldVisualize-${e.name}`},n||{},{href:t.href,onClick:i}),Object(O.jsx)(d.FormattedMessage,{id:"unifiedFieldList.fieldVisualizeButton.label",defaultMessage:"Visualize"}))),Z=(a.i18n.translate("uiActions.triggers.rowClickTitle",{defaultMessage:"Table row click"}),a.i18n.translate("uiActions.triggers.rowClickkDescription",{defaultMessage:"A click on a table row"}),"VISUALIZE_FIELD_TRIGGER"),X={id:Z,title:"Visualize field",description:"Triggered when user wants to visualize a field."},J="VISUALIZE_GEO_FIELD_TRIGGER",ee={id:J,title:"Visualize Geo field",description:"Triggered when user wants to visualize a geo field."},te="CATEGORIZE_FIELD_TRIGGER";var ie=i(74);function ne(e){return e===ie.b.GEO_POINT||e===ie.b.GEO_SHAPE?J:Z}async function le(e,t,i,n=[],l){return await e.getTriggerCompatibleActions(l,{dataViewSpec:i.toSpec(!1),fieldName:t,contextualFields:n})}const se=o.a.memo((({field:e,dataView:t,contextualFields:i,trackUiMetric:n,multiFields:l,originatingApp:s,uiActions:o,buttonProps:a,visualizeInfo:d})=>d?Object(O.jsx)(Q,{field:e,visualizeInfo:d,handleVisualizeLinkClick:async e=>{var l;e.preventDefault(),l=t,null==n||n(Y.METRIC_TYPE.CLICK,"visualize_link_click"),function(e,t,i=[],n,l){if(!l)return;const s=ne(t.type),o={dataViewSpec:l.toSpec(!1),fieldName:t.name,contextualFields:i,originatingApp:n};e.getTrigger(s).exec(o)}(o,d.field,i,s,l)},buttonProps:a}):null));const oe=({fieldName:e,handleVisualizeLinkClick:t,buttonProps:i})=>Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)(r.EuiButton,l()({fullWidth:!0,size:"s","data-test-subj":`fieldCategorize-${e}`},i||{},{onClick:t,iconSide:"left",iconType:"machineLearningApp"}),Object(O.jsx)(d.FormattedMessage,{id:"unifiedFieldList.fieldCategorizeButton.label",defaultMessage:"Run pattern analysis"}))),ae=o.a.memo((({field:e,dataView:t,trackUiMetric:i,originatingApp:n,uiActions:l,buttonProps:s,closePopover:o})=>Object(O.jsx)(oe,{fieldName:e.name,handleVisualizeLinkClick:async s=>{var a;s.preventDefault(),a=t,null==i||i(Y.METRIC_TYPE.CLICK,"categorize_link_click"),function(e,t,i,n){if(!n)return;const l={dataView:n,field:t,originatingApp:i};e.getTrigger(te).exec(l)}(l,e,n,a),o&&o()},buttonProps:s})));var de=i(303);const re=e=>{const[t,i]=Object(s.useState)(null),[n,o]=Object(s.useState)(null);return Object(s.useEffect)((()=>{(async function(e){const t=await async function(e,t,i,n=[],l=[]){var s;if("_id"!==t.name&&null!=i&&i.id)for(const d of[t,...l]){if(!d.visualizable)continue;const t=await le(e,d.name,i,n,ne(d.type));if(t.length>0){var o,a;const e={dataViewSpec:null==i?void 0:i.toSpec(!1),fieldName:d.name,contextualFields:n,trigger:(s=d.type,s===ie.b.GEO_POINT||s===ie.b.GEO_SHAPE?ee:X)};return{field:d,href:await(null===(o=(a=t[0]).getHref)||void 0===o?void 0:o.call(a,e))}}}}(e.uiActions,e.field,e.dataView,e.contextualFields,e.multiFields);return t?Object(O.jsx)(se,l()({},e,{visualizeInfo:t})):null})(e).then(i).catch((e=>{console.error(e)})),async function(e){return await async function(e,t,i){var n;return!!("_id"!==t.name&&null!=i&&i.id&&i.isTimeBased()&&null!==(n=t.esTypes)&&void 0!==n&&n.includes("text"))&&(await async function(e,t,i,n){return await e.getTriggerCompatibleActions(n,{dataView:i,field:t})}(e,t,i,te)).length>0}(e.uiActions,e.field,e.dataView)?Object(O.jsx)(ae,e):null}(e).then(o).catch((e=>{console.error(e)}))}),[e]),t||n?Object(O.jsx)(r.EuiPopoverFooter,null,t,t&&n?Object(O.jsx)(r.EuiSpacer,{size:"s"}):null,n):null},ue=e=>Object(O.jsx)(de.a,null,Object(O.jsx)(re,e));i(271);const ce=({isOpen:e,closePopover:t,renderHeader:i,renderContent:n,...s})=>{let a=null,d=null;if(e){try{a=(null==i?void 0:i())||null}catch(e){console.error(e)}try{d=(null==n?void 0:n())||null}catch(e){console.error(e)}}return Object(O.jsx)(r.EuiPopover,l()({ownFocus:!0,isOpen:e,closePopover:t,display:"block",anchorPosition:"rightUp","data-test-subj":"fieldPopover",panelClassName:"unifiedFieldList__fieldPopover__fieldPopoverPanel"},s),e&&Object(O.jsx)(o.a.Fragment,null,d&&a?Object(O.jsx)(r.EuiPopoverTitle,null,a):a,d))},fe=({field:e,closePopover:t,buttonAddFieldToWorkspaceProps:i,buttonAddFilterProps:n,buttonEditFieldProps:s,buttonDeleteFieldProps:o,onAddFieldToWorkspace:d,onAddFilter:u,onEditField:c,onDeleteField:f})=>{var p,b,F,m;if(!e)return null;const g=a.i18n.translate("unifiedFieldList.fieldPopover.addFieldToWorkspaceLabel",{defaultMessage:'Add "{field}" field',values:{field:e.displayName}}),j=a.i18n.translate("unifiedFieldList.fieldPopover.addExistsFilterLabel",{defaultMessage:"Filter for field present"}),x=a.i18n.translate("unifiedFieldList.fieldPopover.editFieldLabel",{defaultMessage:"Edit data view field"}),h=a.i18n.translate("unifiedFieldList.fieldPopover.deleteFieldLabel",{defaultMessage:"Delete data view field"});return Object(O.jsx)(r.EuiFlexGroup,{alignItems:"center",gutterSize:"s",responsive:!1},Object(O.jsx)(r.EuiFlexItem,{grow:!0},Object(O.jsx)(r.EuiTitle,{size:"xxs"},Object(O.jsx)("h5",{className:"eui-textBreakWord"},e.displayName))),d&&Object(O.jsx)(r.EuiFlexItem,{grow:!1,"data-test-subj":"fieldPopoverHeader_addField"},Object(O.jsx)(r.EuiToolTip,{content:null!==(p=null==i?void 0:i["aria-label"])&&void 0!==p?p:g},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldPopoverHeader_addField-${e.name}`,"aria-label":g},i||{},{iconType:"plusInCircle",onClick:()=>{t(),d(e)}})))),u&&e.filterable&&!e.scripted&&Object(O.jsx)(r.EuiFlexItem,{grow:!1,"data-test-subj":"fieldPopoverHeader_addExistsFilter"},Object(O.jsx)(r.EuiToolTip,{content:null!==(b=null==n?void 0:n["aria-label"])&&void 0!==b?b:j},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldPopoverHeader_addExistsFilter-${e.name}`,"aria-label":j},n||{},{iconType:"filter",onClick:()=>{t(),u("_exists_",e.name,"+")}})))),c&&(e.isRuntimeField||!["unknown","unknown_selected"].includes(e.type))&&Object(O.jsx)(r.EuiFlexItem,{grow:!1,"data-test-subj":"fieldPopoverHeader_editField"},Object(O.jsx)(r.EuiToolTip,{content:null!==(F=null==s?void 0:s["aria-label"])&&void 0!==F?F:x},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldPopoverHeader_editField-${e.name}`,"aria-label":x},s||{},{iconType:"pencil",onClick:()=>{t(),c(e.name)}})))),f&&e.isRuntimeField&&Object(O.jsx)(r.EuiFlexItem,{grow:!1,"data-test-subj":"fieldPopoverHeader_deleteField"},Object(O.jsx)(r.EuiToolTip,{content:null!==(m=null==o?void 0:o["aria-label"])&&void 0!==m?m:h},Object(O.jsx)(r.EuiButtonIcon,l()({"data-test-subj":`fieldPopoverHeader_deleteField-${e.name}`,"aria-label":h},o||{},{color:"danger",iconType:"trash",onClick:()=>{t(),f(e.name)}})))))},pe=()=>Object(O.jsx)(s.Fragment,null),be=o.a.lazy((()=>i.e(10).then(i.bind(null,309)))),Fe=e=>Object(O.jsx)(o.a.Suspense,{fallback:Object(O.jsx)(pe,null)},Object(O.jsx)(be,e)),me=o.a.memo((({stateService:e,services:t,field:i,dataView:n,multiFields:l,onAddFilter:o})=>{var a;const d=Object(_.b)({data:t.data,timeRangeUpdatesType:e.creationOptions.timeRangeUpdatesType}),r=Object(s.useMemo)((()=>{var e;return(null==l?void 0:l.length)&&(null===(e=l.find((e=>e.field.aggregatable)))||void 0===e?void 0:e.field)||i}),[i,l]),u=Object(s.useMemo)((()=>({data:t.data,dataViews:t.dataViews,fieldFormats:t.fieldFormats,charts:t.charts,uiSettings:t.core.uiSettings})),[t]);return Object(_.a)(d)?Object(O.jsx)(Fe,{services:u,query:d.query,filters:d.filters,fromDate:d.fromDate,toDate:d.toDate,dataViewOrDataViewId:n,field:r,"data-test-subj":null===(a=e.creationOptions.dataTestSubj)||void 0===a?void 0:a.fieldListItemStatsDataTestSubj,onAddFilter:o}):null}));function ge({stateService:e,field:t,isSelected:i,toggleDisplay:n}){const l="_source"===t.name?void 0:e=>n(e,i);return{field:t,isSelected:i,buttonAddFieldToWorkspaceProps:e.creationOptions.buttonAddFieldToWorkspaceProps,buttonRemoveFieldFromWorkspaceProps:e.creationOptions.buttonRemoveFieldFromWorkspaceProps,onAddFieldToWorkspace:l,onRemoveFieldFromWorkspace:l}}const je=Object(s.memo)((({stateService:e,multiFields:t,toggleDisplay:i,alwaysShowActionButton:n})=>Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)(r.EuiTitle,{size:"xxxs"},Object(O.jsx)("h5",null,a.i18n.translate("unifiedFieldList.fieldListItem.multiFields",{defaultMessage:"Multi fields"}))),Object(O.jsx)(r.EuiSpacer,{size:"xs"}),t.map((t=>Object(O.jsx)($,l()({key:t.field.name,size:"xs",flush:"both",isEmpty:!1,isActive:!1,shouldAlwaysShowAction:n,onClick:void 0},ge({stateService:e,field:t.field,isSelected:t.isSelected,toggleDisplay:i}))))))));function xe({stateService:e,services:t,searchMode:i,alwaysShowActionButton:n=!1,field:a,highlight:d,dataView:u,onAddFieldToWorkspace:c,onRemoveFieldFromWorkspace:f,onAddFilter:p,isEmpty:b,isSelected:F,trackUiMetric:m,multiFields:g,onEditField:j,onDeleteField:x,workspaceSelectedFieldNames:h,groupIndex:_,itemIndex:v}){var y,k,I;const[E,S]=Object(s.useState)(!1),w=Object(s.useMemo)((()=>p?(...e)=>{S(!1),null==p||p(...e)}:void 0),[S,p]),T=Object(s.useCallback)((()=>{S((e=>!e))}),[S]),B=Object(s.useCallback)((()=>{S(!1)}),[S]),L=Object(s.useCallback)(((e,t)=>{B(),t?f(e):c(e)}),[c,f,B]),A=Object(s.useMemo)((()=>null==g?void 0:g.map((e=>e.field))),[g]),N=Object(s.useMemo)((()=>{var t;const i=null===(t=e.creationOptions.dataTestSubj)||void 0===t?void 0:t.fieldListItemPopoverHeaderDataTestSubjPrefix;return{buttonAddFieldToWorkspaceProps:e.creationOptions.buttonAddFieldToWorkspaceProps,...i&&{buttonAddFilterProps:{"data-test-subj":`${i}AddExistFilter-${a.name}`},buttonEditFieldProps:{"data-test-subj":`${i}Edit-${a.name}`},buttonDeleteFieldProps:{"data-test-subj":`${i}Delete-${a.name}`}}}}),[a.name,e.creationOptions]),M=Object(s.useMemo)((()=>({id:a.name,humanData:{label:a.displayName,position:v+1}})),[a,v]),P=Object(s.useMemo)((()=>[0,_,v]),[_,v]);return Object(O.jsx)(ce,{isOpen:E,button:Object(O.jsx)(G.a,{draggable:!0,order:P,value:M,onDragStart:B,isDisabled:n||e.creationOptions.disableFieldListItemDragAndDrop,dataTestSubj:`${null!==(y=null===(k=e.creationOptions.dataTestSubj)||void 0===k?void 0:k.fieldListItemDndDataTestSubjPrefix)&&void 0!==y?y:"unifiedFieldListItemDnD"}-${a.name}`},Object(O.jsx)($,l()({size:"xs",fieldSearchHighlight:d,isEmpty:b,isActive:E,flush:n?"both":void 0,shouldAlwaysShowAction:n,onClick:"_source"!==a.type?T:void 0},ge({stateService:e,field:a,isSelected:F,toggleDisplay:L})))),closePopover:B,"data-test-subj":null===(I=e.creationOptions.dataTestSubj)||void 0===I?void 0:I.fieldListItemPopoverDataTestSubj,renderHeader:()=>Object(O.jsx)(fe,l()({field:a,closePopover:B,onAddFieldToWorkspace:F?void 0:L,onAddFilter:p,onEditField:j,onDeleteField:x},N)),renderContent:"documents"===i?()=>Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)(me,{stateService:e,services:t,field:a,multiFields:g,dataView:u,onAddFilter:w}),g&&Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)(r.EuiSpacer,{size:"m"}),Object(O.jsx)(je,{stateService:e,multiFields:g,alwaysShowActionButton:n,toggleDisplay:L})),!!t.uiActions&&Object(O.jsx)(ue,{field:a,dataView:u,multiFields:A,trackUiMetric:m,contextualFields:h,originatingApp:e.creationOptions.originatingApp,uiActions:t.uiActions,closePopover:()=>B()})):void 0})}const he=Object(s.memo)(xe);var _e=i(48);const ve={selectedFields:[],selectedFieldsMap:{}},Oe=({stateService:e,searchMode:t,services:i,workspaceSelectedFieldNames:n,isProcessing:o,alwaysShowActionButton:d,allFields:u,dataView:c,trackUiMetric:f,showFieldList:b=!0,isAffectedByGlobalFilter:F,prepend:m,onAddFieldToWorkspace:g,onRemoveFieldFromWorkspace:j,onAddFilter:h,onSelectedFieldFilter:_,onEditField:y,onDeleteField:I})=>{var E,w,T,N,D,G,V;const{dataViews:z,core:H}=i,U=Object(s.useMemo)((()=>!H.uiSettings.get(v.p)),[H.uiSettings]),[W,$]=Object(s.useState)(ve),[q,K]=Object(s.useState)(void 0);Object(s.useEffect)((()=>{const e=function({dataView:e,workspaceSelectedFieldNames:t,allFields:i,searchMode:n}){const l={selectedFields:[],selectedFieldsMap:{}};if(!(t&&Array.isArray(t)&&t.length&&i))return ve;for(const o of t){var s;const t="documents"===n&&(null==e||null===(s=e.getFieldByName)||void 0===s?void 0:s.call(e,o))||i.find((e=>e.name===o))||{name:o,displayName:o,type:"unknown_selected"};l.selectedFields.push(t),l.selectedFieldsMap[t.name]=!0}return l.selectedFields=Object(L.uniqBy)(l.selectedFields,"name"),1===l.selectedFields.length&&"_source"===l.selectedFields[0].name?ve:l}({dataView:c,workspaceSelectedFieldNames:_?[]:n,allFields:u,searchMode:t});$(e)}),[c,n,$,u,t,_]),Object(s.useEffect)((()=>{"documents"!==t||!U||e.creationOptions.disableMultiFieldsGroupingByParent?K(void 0):K(function(e,t){if(!e)return;const i=new Map;return e.forEach((e=>{var n;const l=function(e){return function(e){var t;const i=null==e?void 0:e.subType;return!(null==i||null===(t=i.multi)||void 0===t||!t.parent)}(e)?e.subType:void 0}(e),s=null==l?void 0:l.multi.parent;if(!s)return;const o={field:e,isSelected:Boolean(null==t?void 0:t[e.name])},a=null!==(n=i.get(s))&&void 0!==n?n:[];a.push(o),i.set(s,a)})),i}(u,W.selectedFieldsMap))}),[e.creationOptions.disableMultiFieldsGroupingByParent,W.selectedFieldsMap,u,U,K,t]);const Y=Object(s.useMemo)((()=>H.uiSettings.get(v.h)),[H.uiSettings]),Q=Object(s.useCallback)((i=>function(e,t,i){return!(null==e||!e.type||"_source"===e.type||"text-based"!==t&&!i&&Object(_e.getFieldSubtypeMulti)(null==e?void 0:e.spec))}(i,t,e.creationOptions.disableMultiFieldsGroupingByParent)),[t,e.creationOptions.disableMultiFieldsGroupingByParent]),{fieldListFiltersProps:Z,fieldListGroupedProps:X}=function({dataViewId:e,allFields:t,services:i,isAffectedByGlobalFilter:n=!1,popularFieldsLimit:l,sortedSelectedFields:o,getCustomFieldType:d,onOverrideFieldGroupDetails:r,onSupportedFieldFilter:u,onSelectedFieldFilter:c}){const f=x(),b=function({allFields:e,getCustomFieldType:t,onSupportedFieldFilter:i,services:n}){const[l,o]=Object(s.useState)([]),[a,d]=Object(s.useState)(""),r=Object(s.useMemo)((()=>P()),[]),u=n.core.docLinks;return Object(s.useMemo)((()=>{const n=a.toLowerCase();return{fieldSearchHighlight:n,fieldListFiltersProps:{docLinks:u,selectedFieldTypes:l,allFields:e,getCustomFieldType:t,onSupportedFieldFilter:i,onChangeFieldTypes:o,nameFilter:a,onChangeNameFilter:d,screenReaderDescriptionId:r},onFilterField:null!=n&&n.length||l.length>0?e=>!(n&&!M(e,n))&&(!(l.length>0)||l.includes(Object(A.a)(e,t))):void 0}}),[u,l,e,t,i,o,a,d,r])}({allFields:t,services:i,getCustomFieldType:d,onSupportedFieldFilter:u}),F=b.onFilterField,[m,g]=Object(s.useState)(null),j=Boolean(null==m?void 0:m.timeFieldName),h=!e||f.isFieldsExistenceInfoUnavailable(e),_=e?f.hasFieldData:C;Object(s.useEffect)((()=>{(async()=>{if(e){let t=null;try{t=await i.dataViews.get(e,!1)}catch(e){}g(t||null)}else g(null)})()}),[e,i.dataViews,g,_]),Object(s.useEffect)((()=>{m&&!e&&g(null)}),[m,g,e]);const v=Object(s.useMemo)((()=>Date.now()),[e,F]),O=Object(s.useMemo)((()=>{const i=o||[],s=[...t||[]].sort(R),d={specialFields:[],availableFields:[],emptyFields:[],metaFields:[],unmappedFields:[],skippedFields:[],...Object(L.groupBy)(s,(t=>{var n;return!o&&c&&c(t)&&i.push(t),u&&!u(t)?"skippedFields":"document"===t.type?"specialFields":null!=m&&null!==(n=m.metaFields)&&void 0!==n&&n.includes(t.name)?"metaFields":"nested"===t.type?"availableFields":null!=m&&m.getFieldByName&&!m.getFieldByName(t.name)?"unmappedFields":(t=>!e||_(e,t.name))(t)||h?"availableFields":"emptyFields"}))},f=l?s.filter((e=>e.count&&"_source"!==e.type&&(!u||u(e)))).sort(((e,t)=>(t.count||0)-(e.count||0))).slice(0,l):[];let p={SpecialFields:{fields:d.specialFields,fieldCount:d.specialFields.length,isAffectedByGlobalFilter:!1,isAffectedByTimeFilter:!1,isInitiallyOpen:!1,showInAccordion:!1,title:"",hideDetails:!0},SelectedFields:{fields:i,fieldCount:i.length,isInitiallyOpen:!0,showInAccordion:!0,title:a.i18n.translate("unifiedFieldList.useGroupedFields.selectedFieldsLabel",{defaultMessage:"Selected fields"}),isAffectedByGlobalFilter:n,isAffectedByTimeFilter:j,hideDetails:!1,hideIfEmpty:!0},PopularFields:{fields:f,fieldCount:f.length,isInitiallyOpen:!0,showInAccordion:!0,title:a.i18n.translate("unifiedFieldList.useGroupedFields.popularFieldsLabel",{defaultMessage:"Popular fields"}),helpText:a.i18n.translate("unifiedFieldList.useGroupedFields.popularFieldsLabelHelp",{defaultMessage:"Fields that your organization frequently uses, from most to least popular."}),isAffectedByGlobalFilter:n,isAffectedByTimeFilter:j,hideDetails:!1,hideIfEmpty:!0},AvailableFields:{fields:d.availableFields,fieldCount:d.availableFields.length,isInitiallyOpen:!0,showInAccordion:!0,title:e&&h?a.i18n.translate("unifiedFieldList.useGroupedFields.allFieldsLabel",{defaultMessage:"All fields"}):a.i18n.translate("unifiedFieldList.useGroupedFields.availableFieldsLabel",{defaultMessage:"Available fields"}),isAffectedByGlobalFilter:n,isAffectedByTimeFilter:j,hideDetails:h,defaultNoFieldsMessage:a.i18n.translate("unifiedFieldList.useGroupedFields.noAvailableDataLabel",{defaultMessage:"There are no available fields that contain data."})},UnmappedFields:{fields:d.unmappedFields,fieldCount:d.unmappedFields.length,isAffectedByGlobalFilter:n,isAffectedByTimeFilter:j,isInitiallyOpen:!1,showInAccordion:!0,hideDetails:!1,hideIfEmpty:!0,title:a.i18n.translate("unifiedFieldList.useGroupedFields.unmappedFieldsLabel",{defaultMessage:"Unmapped fields"}),helpText:a.i18n.translate("unifiedFieldList.useGroupedFields.unmappedFieldsLabelHelp",{defaultMessage:"Fields that aren't explicitly mapped to a field data type."})},EmptyFields:{fields:d.emptyFields,fieldCount:d.emptyFields.length,isAffectedByGlobalFilter:!1,isAffectedByTimeFilter:!1,isInitiallyOpen:!1,showInAccordion:!0,hideDetails:!1,hideIfEmpty:!e,title:a.i18n.translate("unifiedFieldList.useGroupedFields.emptyFieldsLabel",{defaultMessage:"Empty fields"}),helpText:a.i18n.translate("unifiedFieldList.useGroupedFields.emptyFieldsLabelHelp",{defaultMessage:"Fields that don't have any values based on your filters."}),defaultNoFieldsMessage:a.i18n.translate("unifiedFieldList.useGroupedFields.noEmptyDataLabel",{defaultMessage:"There are no empty fields."})},MetaFields:{fields:d.metaFields,fieldCount:d.metaFields.length,isAffectedByGlobalFilter:!1,isAffectedByTimeFilter:!1,isInitiallyOpen:!1,showInAccordion:!0,hideDetails:!1,hideIfEmpty:!e,title:a.i18n.translate("unifiedFieldList.useGroupedFields.metaFieldsLabel",{defaultMessage:"Meta fields"}),defaultNoFieldsMessage:a.i18n.translate("unifiedFieldList.useGroupedFields.noMetaDataLabel",{defaultMessage:"There are no meta fields."})}};return h&&delete p.EmptyFields,r&&(p=Object.keys(p).reduce(((e,t)=>{const i=t,n=p[i];return n&&(e[i]={...n,...r(i)||{}}),e}),{})),p}),[t,u,c,r,m,e,_,h,n,j,l,o]),y=Object(s.useMemo)((()=>F?Object.fromEntries(Object.entries(O).map((([e,t])=>[e,{...t,fieldSearchHighlight:b.fieldSearchHighlight,fields:t.fields.filter(F)}]))):O),[O,F,b.fieldSearchHighlight]),k=Boolean(t),I=null==t?void 0:t.length,E=Object(s.useMemo)((()=>!e||Boolean(I)),[e,I]),S=Object(s.useMemo)((()=>k?e&&f?f.getFieldsExistenceStatus(e):p.a.succeeded:p.a.unknown),[e,k,f]),w=b.fieldListFiltersProps.screenReaderDescriptionId;return{fieldListGroupedProps:Object(s.useMemo)((()=>({fieldGroups:y,scrollToTopResetCounter:v,fieldsExistInIndex:E,fieldsExistenceStatus:S,screenReaderDescriptionId:w})),[y,v,E,S,w]),fieldListFiltersProps:b.fieldListFiltersProps}}({dataViewId:"documents"===t&&(null==c?void 0:c.id)||null,allFields:u,popularFieldsLimit:"documents"!==t||e.creationOptions.disablePopularFields?0:Y,isAffectedByGlobalFilter:F,services:{dataViews:z,core:H},sortedSelectedFields:_?void 0:W.selectedFields,onSelectedFieldFilter:_,onSupportedFieldFilter:null!==(E=e.creationOptions.onSupportedFieldFilter)&&void 0!==E?E:Q,onOverrideFieldGroupDetails:e.creationOptions.onOverrideFieldGroupDetails}),J=Object(s.useCallback)((({field:l,groupName:s,groupIndex:o,itemIndex:a,fieldSearchHighlight:r})=>Object(O.jsx)("li",{key:`field${l.name}`,"data-attr-field":l.name},Object(O.jsx)(he,{stateService:e,searchMode:t,services:i,alwaysShowActionButton:d,field:l,highlight:r,dataView:c,onAddFieldToWorkspace:g,onRemoveFieldFromWorkspace:j,onAddFilter:h,trackUiMetric:f,multiFields:null==q?void 0:q.get(l.name),onEditField:y,onDeleteField:I,workspaceSelectedFieldNames:n,groupIndex:o,itemIndex:a,isEmpty:s===p.b.EmptyFields,isSelected:s===p.b.SelectedFields||Boolean(W.selectedFieldsMap[l.name])}))),[e,t,i,d,c,g,j,h,f,q,y,I,n,W.selectedFieldsMap]);return c?Object(O.jsx)(r.EuiPageSidebar,{className:"unifiedFieldListSidebar","aria-label":a.i18n.translate("unifiedFieldList.fieldListSidebar.indexAndFieldsSectionAriaLabel",{defaultMessage:"Index and fields"}),id:null!==(w=null===(T=e.creationOptions.dataTestSubj)||void 0===T?void 0:T.fieldListSidebarDataTestSubj)&&void 0!==w?w:"unifiedFieldListSidebarId","data-test-subj":null!==(N=null===(D=e.creationOptions.dataTestSubj)||void 0===D?void 0:D.fieldListSidebarDataTestSubj)&&void 0!==N?N:"unifiedFieldListSidebarId"},Object(O.jsx)(r.EuiFlexGroup,{className:"unifiedFieldListSidebar__group",direction:"column",alignItems:"stretch",gutterSize:"s",responsive:!1},Boolean(m)&&Object(O.jsx)(r.EuiFlexItem,{grow:!1},m),Object(O.jsx)(r.EuiFlexItem,null,Object(O.jsx)(k,{isProcessing:o,prepend:Object(O.jsx)(S,Z),className:"unifiedFieldListSidebar__list"},b?Object(O.jsx)(B,l()({},X,{renderFieldItem:J,localStorageKeyPrefix:e.creationOptions.localStorageKeyPrefix})):Object(O.jsx)(r.EuiFlexItem,{grow:!0}),!!y&&Object(O.jsx)(r.EuiFlexItem,{grow:!1},Object(O.jsx)(r.EuiButton,{iconType:"indexOpen","data-test-subj":null!==(G=null===(V=e.creationOptions.dataTestSubj)||void 0===V?void 0:V.fieldListAddFieldButtonTestSubj)&&void 0!==G?G:"unifiedFieldListAddField",onClick:()=>y(),size:"s"},a.i18n.translate("unifiedFieldList.fieldListSidebar.addFieldButtonLabel",{defaultMessage:"Add a field"}))))))):null},ye=Object(s.memo)(Oe),ke=Object(s.forwardRef)((function(e,t){var n;const{getCreationOptions:u,services:b,dataView:x,workspaceSelectedFieldNames:v,isSidebarCollapsed:y,prependInFlyout:k,variant:I="responsive",onFieldEdited:E}=e,[S]=Object(s.useState)((({options:e})=>({creationOptions:e}))({options:u()})),{data:w,dataViewFieldEditor:T}=b,[B,L]=Object(s.useState)(!1),A=Boolean(null==T?void 0:T.userPermissions.editIndexPattern())||Boolean(x&&!x.isPersisted()),N=Object(s.useRef)(),M=Object(s.useCallback)((e=>{N.current=e}),[]),P=Object(s.useCallback)((()=>{L(!1)}),[]),D=Object(_.b)({data:w,timeRangeUpdatesType:S.creationOptions.timeRangeUpdatesType}),R=D.searchMode,C=Boolean(null===(n=D.filters)||void 0===n?void 0:n.length),{isProcessing:G,refetchFieldsExistenceInfo:V}=(e=>{const t=Object(s.useRef)(!0),[n,l]=Object(s.useState)(0),o=n>0,a=Object(s.useCallback)((async({dataViewId:e,query:n,filters:s,fromDate:o,toDate:a,services:{dataViews:d,data:r,core:u},onNoData:f,fetchId:b})=>{var F,x,_,v,O;if(!(e&&n&&o&&a))return;const y=null===(F=g.getValue())||void 0===F?void 0:F[e];if(!t.current)return;const k=(null!==(x=null==y?void 0:y.numberOfFetches)&&void 0!==x?x:0)+1;let I=null;try{I=await d.get(e,!1)}catch(e){}if(null===(_=I)||void 0===_||!_.title)return;l((e=>e+1));const E=Boolean(null===(v=(O=I).getAggregationRestrictions)||void 0===v?void 0:v.call(O)),S={...m,numberOfFetches:k};if(E)S.fetchStatus=p.a.succeeded,S.hasDataViewRestrictions=!0;else try{const t=await(async e=>{const{loadFieldExisting:t}=await i.e(16).then(i.bind(null,314));return await t(e)})({dslQuery:await h(I,n,s||[],Object(c.a)(u.uiSettings)),fromDate:o,toDate:a,timeFieldName:I.timeFieldName,data:r,uiSettingsClient:u.uiSettings,dataViewsService:d,dataView:I}),l=(null==t?void 0:t.existingFieldNames)||[];f&&1===k&&!l.filter((e=>{var t,i;return!(null!==(t=I)&&void 0!==t&&null!==(i=t.metaFields)&&void 0!==i&&i.includes(e))})).length&&f(e),S.existingFieldsByFieldNameMap=l.reduce(((e,t)=>(e[t]=!0,e)),{}),S.fetchStatus=p.a.succeeded}catch(e){S.fetchStatus=p.a.failed}t.current&&b===j&&g.next({...g.getValue(),[e]:S}),l((e=>e-1))}),[t,l]),d=e.dataViews.map((e=>{var t,i;return`${e.id}:${e.title}:${e.timeFieldName||"no-timefield"}:${null!==(t=null===(i=e.fields)||void 0===i?void 0:i.length)&&void 0!==t?t:0}`})).join(","),r=Object(s.useCallback)((async t=>{const i=window.performance.now(),n="fetchFieldsExistenceInfo",l=F();j=l;const s={fetchId:l,dataViewId:t,...e};if(t)return await a({...s,dataViewId:t}),void Object(f.a)(e.services.core.analytics,{eventName:n,duration:window.performance.now()-i,meta:{dataViewsCount:1}});await Promise.all(e.dataViews.map((e=>a({...s,dataViewId:e.id})))),Object(f.a)(e.services.core.analytics,{eventName:n,duration:window.performance.now()-i,meta:{dataViewsCount:e.dataViews.length}})}),[a,d,e.query,e.filters,e.fromDate,e.toDate,e.services.core]);return Object(s.useEffect)((()=>{e.disableAutoFetching||r()}),[r,e.disableAutoFetching]),Object(s.useEffect)((()=>()=>{t.current=!1,g.next({})}),[t]),Object(s.useMemo)((()=>({refetchFieldsExistenceInfo:r,isProcessing:o})),[r,o])})({disableAutoFetching:S.creationOptions.disableFieldsExistenceAutoFetching,dataViews:"documents"===R&&x?[x]:[],query:D.query,filters:D.filters,fromDate:D.fromDate,toDate:D.toDate,services:b}),z=Object(s.useMemo)((()=>x&&T&&"documents"===R&&A?e=>{const t=T.openEditor({ctx:{dataView:x},fieldName:e,onSave:async()=>{E&&await E({editedFieldName:e})}});M(t),P()}:void 0),[R,A,T,x,M,P,E]),H=Object(s.useMemo)((()=>x&&T&&z?e=>{const t=T.openDeleteModal({ctx:{dataView:x},fieldName:e,onDelete:async()=>{E&&await E({removedFieldName:e})}});M(t),P()}:void 0),[x,M,z,P,T,E]);if(Object(s.useEffect)((()=>()=>{null!=N&&N.current&&(null==N||N.current())}),[]),Object(s.useImperativeHandle)(t,(()=>({refetchFieldsExistenceInfo:V,closeFieldListFlyout:P,createField:z,editField:z,deleteField:H})),[V,P,z,H]),!x)return null;const U={...e,searchMode:R,stateService:S,isProcessing:G,isAffectedByGlobalFilter:C,onEditField:z,onDeleteField:H},W=S.creationOptions.buttonPropsToTriggerFlyout,$=()=>Object(O.jsx)(ye,U),q=()=>Object(O.jsx)(o.a.Fragment,null,Object(O.jsx)("div",{className:"unifiedFieldListSidebar__mobile"},Object(O.jsx)(r.EuiButton,l()({},W,{contentProps:{...null==W?void 0:W.contentProps,className:"unifiedFieldListSidebar__mobileButton"},fullWidth:!0,onClick:()=>L(!0)}),Object(O.jsx)(d.FormattedMessage,{id:"unifiedFieldList.fieldListSidebar.fieldsMobileButtonLabel",defaultMessage:"Fields"}),Object(O.jsx)(r.EuiBadge,{className:"unifiedFieldListSidebar__mobileBadge",color:"_source"===(null==v?void 0:v[0])?"default":"accent"},null!=v&&v.length&&"_source"!==v[0]?v.length:0))),B&&Object(O.jsx)(r.EuiPortal,null,Object(O.jsx)(r.EuiFlyout,{size:"s",onClose:()=>L(!1),"aria-labelledby":"flyoutTitle",ownFocus:!0},Object(O.jsx)(r.EuiFlyoutHeader,{hasBorder:!0},Object(O.jsx)(r.EuiTitle,{size:"s"},Object(O.jsx)("h2",{id:"flyoutTitle"},Object(O.jsx)(r.EuiLink,{color:"text",onClick:()=>L(!1)},Object(O.jsx)(r.EuiIcon,{className:"eui-alignBaseline","aria-label":a.i18n.translate("unifiedFieldList.fieldListSidebar.flyoutBackIcon",{defaultMessage:"Back"}),type:"arrowLeft"})," ",Object(O.jsx)("strong",null,a.i18n.translate("unifiedFieldList.fieldListSidebar.flyoutHeading",{defaultMessage:"Field list"})))))),Object(O.jsx)(ye,l()({},U,{alwaysShowActionButton:!0,prepend:null==k?void 0:k()})))));return"button-and-flyout-always"===I?q():"list-always"===I?!y&&$()||null:Object(O.jsx)(o.a.Fragment,null,!y&&Object(O.jsx)(r.EuiHideFor,{sizes:["xs","s"]},$()),Object(O.jsx)(r.EuiShowFor,{sizes:["xs","s"]},q()))}));t.default=ke},83:function(e,t,i){"use strict";let n;i.d(t,"a",(function(){return n})),i.d(t,"b",(function(){return l})),i.d(t,"c",(function(){return s})),function(e){e.DOCUMENT="document",e.BINARY="binary",e.BOOLEAN="boolean",e.CONFLICT="conflict",e.COUNTER="counter",e.DATE="date",e.DATE_RANGE="date_range",e.DENSE_VECTOR="dense_vector",e.GAUGE="gauge",e.GEO_POINT="geo_point",e.GEO_SHAPE="geo_shape",e.HISTOGRAM="histogram",e.IP="ip",e.IP_RANGE="ip_range",e.FLATTENED="flattened",e.KEYWORD="keyword",e.MURMUR3="murmur3",e.NUMBER="number",e.NESTED="nested",e.RANK_FEATURE="rank_feature",e.RANK_FEATURES="rank_features",e.POINT="point",e.SHAPE="shape",e.STRING="string",e.TEXT="text",e.VERSION="version"}(n||(n={}));const l=Object.values(n),s=e=>!!e&&l.includes(e)},97:function(e,t,i){"use strict";i.d(t,"b",(function(){return p})),i.d(t,"a",(function(){return F}));var n=i(11),l=i.n(n),s=i(2),o=i.n(s),a=i(45),d=i.n(a),r=i(7),u=i(1);const c={iconType:"questionInCircle",color:"gray"},f={binary:{iconType:"tokenBinary"},boolean:{iconType:"tokenBoolean"},conflict:{iconType:"warning",color:"euiColorVis9",shape:"square"},date:{iconType:"tokenDate"},date_range:{iconType:"tokenDate"},dense_vector:{iconType:"tokenDenseVector"},geo_point:{iconType:"tokenGeo"},geo_shape:{iconType:"tokenGeo"},ip:{iconType:"tokenIP"},ip_range:{iconType:"tokenIP"},flattened:{iconType:"tokenFlattened"},match_only_text:{iconType:"tokenString"},murmur3:{iconType:"tokenSearchType"},number:{iconType:"tokenNumber"},number_range:{iconType:"tokenNumber"},rank_feature:{iconType:"tokenRankFeature"},rank_features:{iconType:"tokenRankFeatures"},histogram:{iconType:"tokenHistogram"},_source:{iconType:"editorCodeBlock",color:"gray"},point:{iconType:"tokenShape"},shape:{iconType:"tokenShape"},string:{iconType:"tokenString"},text:{iconType:"tokenString"},keyword:{iconType:"tokenKeyword"},gauge:{iconType:"tokenMetricGauge"},counter:{iconType:"tokenMetricCounter"},nested:{iconType:"tokenNested"},version:{iconType:"tokenTag"}};function p({type:e,label:t,size:i="s",scripted:n,className:s,...o}){const a=f[e]||c;return Object(u.jsx)(r.EuiToken,l()({},a,{className:d()("kbnFieldIcon",s),"aria-label":t||e,title:t||e,size:i,fill:n?"dark":void 0},o))}i(101);const b={xs:"kbnFieldButton--xs",s:"kbnFieldButton--s"};function F({size:e,isActive:t=!1,fieldIcon:i,fieldName:n,fieldInfoIcon:s,fieldAction:a,flush:r,className:c,dragHandle:f,onClick:p,dataTestSubj:F,buttonProps:m,...g}){const j=d()("kbnFieldButton",e?b[e]:null,{"kbnFieldButton-isActive":t,"kbnFieldButton--flushBoth":"both"===r},c),x=d()("kbn-resetFocusState","kbnFieldButton__button"),h=Object(u.jsx)(o.a.Fragment,null,i&&Object(u.jsx)("span",{className:"kbnFieldButton__fieldIcon"},i),n&&Object(u.jsx)("span",{className:"kbnFieldButton__name"},Object(u.jsx)("span",{className:"kbnFieldButton__nameInner"},n)),s&&Object(u.jsx)("div",{className:"kbnFieldButton__infoIcon"},s));return Object(u.jsx)("div",l()({className:j},g),f&&Object(u.jsx)("div",{className:"kbnFieldButton__dragHandle"},f),p?Object(u.jsx)("button",l()({onClick:e=>{"click"===e.type&&e.currentTarget.focus(),p()},"data-test-subj":F,className:x},m),h):Object(u.jsx)("div",{className:x,"data-test-subj":F},h),a&&Object(u.jsx)("div",{className:"kbnFieldButton__fieldAction"},a))}Object.keys(b)}}]);