@appbaseio/reactivesearch-vue 1.28.0 → 1.29.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1759 -371
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-11307285.js → Button-e0b7c1f6.js} +1 -1
  6. package/dist/cjs/DataSearch-eec21890.js +2171 -0
  7. package/dist/cjs/DataSearch.js +18 -2107
  8. package/dist/cjs/{DropDown-7aa3d0d2.js → DropDown-e4381fcc.js} +1 -1
  9. package/dist/cjs/{Input-3cc3fa59.js → Input-0d7b25ad.js} +1 -1
  10. package/dist/cjs/MultiDropdownList.js +3 -3
  11. package/dist/cjs/MultiList.js +1 -1
  12. package/dist/cjs/RangeInput.js +1 -1
  13. package/dist/cjs/ReactiveList.js +1 -1
  14. package/dist/cjs/SelectedFilters.js +1 -1
  15. package/dist/cjs/SingleDropdownList.js +3 -3
  16. package/dist/cjs/SingleList.js +1 -1
  17. package/dist/cjs/ToggleButton.js +1 -1
  18. package/dist/cjs/index.js +10 -9
  19. package/dist/cjs/install-b05fef06.js +1247 -0
  20. package/dist/cjs/install.js +24 -29
  21. package/dist/cjs/version.js +1 -1
  22. package/dist/es/{Button-91561391.js → Button-33de88e6.js} +1 -1
  23. package/dist/es/DataSearch-42f547cd.js +2158 -0
  24. package/dist/es/DataSearch.js +17 -2106
  25. package/dist/es/{DropDown-60a426a2.js → DropDown-ff6ad982.js} +1 -1
  26. package/dist/es/{Input-08bb1bcf.js → Input-e339e63a.js} +1 -1
  27. package/dist/es/MultiDropdownList.js +3 -3
  28. package/dist/es/MultiList.js +1 -1
  29. package/dist/es/RangeInput.js +1 -1
  30. package/dist/es/ReactiveList.js +1 -1
  31. package/dist/es/SelectedFilters.js +1 -1
  32. package/dist/es/SingleDropdownList.js +3 -3
  33. package/dist/es/SingleList.js +1 -1
  34. package/dist/es/ToggleButton.js +1 -1
  35. package/dist/es/index.js +6 -6
  36. package/dist/es/install-bd448c02.js +1240 -0
  37. package/dist/es/install.js +22 -31
  38. package/dist/es/version.js +1 -1
  39. package/package.json +3 -3
@@ -0,0 +1,2158 @@
1
+ import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
3
+ import VueTypes from 'vue-types';
4
+ import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
+ import { getQueryOptions } from '@appbaseio/reactivecore/lib/utils/helper';
6
+ import styled, { css, cx, injectGlobal } from '@appbaseio/vue-emotion';
7
+ import { t as types } from './vueTypes-687b2304.js';
8
+ import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-78920565.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
10
+ import { T as Title } from './Title-3522ff56.js';
11
+ import { F as Flex } from './Flex-8770345d.js';
12
+ import hotkeys from 'hotkeys-js';
13
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-c2c03a35.js';
14
+ import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-e339e63a.js';
15
+ import { C as Container } from './Container-18b03fde.js';
16
+ import Highlight from 'vue-highlight-words';
17
+
18
+ var _templateObject;
19
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
20
+ InputGroup.defaultProps = {
21
+ className: 'input-group'
22
+ };
23
+
24
+ var _templateObject$1;
25
+ var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
26
+ InputAddon.defaultProps = {
27
+ className: 'input-addon'
28
+ };
29
+
30
+ var getClassName = helper.getClassName;
31
+ var SuggestionWrapper = {
32
+ name: 'SuggestionWrapper',
33
+ props: {
34
+ innerClassName: types.string,
35
+ themePreset: types.themePreset,
36
+ innerClass: types.style
37
+ },
38
+ render: function render() {
39
+ var h = arguments[0];
40
+ var _this$$props = this.$props,
41
+ themePreset = _this$$props.themePreset,
42
+ innerClass = _this$$props.innerClass,
43
+ innerClassName = _this$$props.innerClassName;
44
+ return h("div", {
45
+ "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
46
+ }, [h("li", [this.$scopedSlots["default"]()])]);
47
+ }
48
+ };
49
+
50
+ var _templateObject$2;
51
+ var highlightStyle = {
52
+ fontWeight: 600,
53
+ padding: 0,
54
+ backgroundColor: 'transparent',
55
+ color: 'inherit'
56
+ };
57
+ var PredictiveSuggestion = styled('span')(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n\t.highlight {\n\t\tbackground: transparent;\n\t\tcolor: inherit;\n\t\tfont-weight: 600;\n\t\tpadding: 0;\n\t}\n"])));
58
+ var SuggestionItem = {
59
+ name: 'SuggestionItem',
60
+ props: {
61
+ currentValue: types.string,
62
+ suggestion: types.any
63
+ },
64
+ render: function render() {
65
+ var h = arguments[0];
66
+ var _this$suggestion = this.suggestion,
67
+ label = _this$suggestion.label,
68
+ value = _this$suggestion.value,
69
+ title = _this$suggestion.title,
70
+ description = _this$suggestion.description,
71
+ image = _this$suggestion.image,
72
+ isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
73
+ _suggestion_type = _this$suggestion._suggestion_type,
74
+ _category = _this$suggestion._category;
75
+
76
+ if (label) {
77
+ // label has highest precedence
78
+ return typeof label === 'string' ? h("div", {
79
+ "class": "trim"
80
+ }, [(_category ? false : isPredictiveSuggestion // eslint-disable-next-line
81
+ || !!_suggestion_type) ? h(PredictiveSuggestion, {
82
+ "domProps": {
83
+ "innerHTML": label
84
+ }
85
+ }) : h(Highlight, {
86
+ "attrs": {
87
+ "searchWords": _category ? [_category] : this.currentValue.split(' '),
88
+ "textToHighlight": label,
89
+ "autoEscape": true,
90
+ "highlightStyle": highlightStyle
91
+ }
92
+ })]) : label;
93
+ }
94
+
95
+ if (title || image || description) {
96
+ return h(Flex, {
97
+ "attrs": {
98
+ "alignItems": "center",
99
+ "css": {
100
+ width: '100%'
101
+ }
102
+ }
103
+ }, [image && h("div", {
104
+ "attrs": {
105
+ "css": {
106
+ margin: 'auto',
107
+ marginRight: 10
108
+ }
109
+ }
110
+ }, [h("img", {
111
+ "attrs": {
112
+ "src": image,
113
+ "alt": " ",
114
+ "height": "50px",
115
+ "width": "50px",
116
+ "css": {
117
+ objectFit: 'contain'
118
+ }
119
+ }
120
+ })]), h(Flex, {
121
+ "attrs": {
122
+ "direction": "column",
123
+ "css": {
124
+ width: image ? 'calc(100% - 60px)' : '100%'
125
+ }
126
+ }
127
+ }, [title && h("div", {
128
+ "class": "trim"
129
+ }, [h(Highlight, {
130
+ "attrs": {
131
+ "searchWords": this.currentValue.split(' '),
132
+ "textToHighlight": title,
133
+ "highlightStyle": highlightStyle
134
+ },
135
+ "class": css({
136
+ fontSize: '1rem'
137
+ })
138
+ })]), description && h("div", {
139
+ "class": cx('trim', css({
140
+ marginTop: 3
141
+ }))
142
+ }, [h(Highlight, {
143
+ "attrs": {
144
+ "searchWords": this.currentValue.split(' '),
145
+ "textToHighlight": description,
146
+ "highlightStyle": highlightStyle
147
+ }
148
+ })])])]);
149
+ }
150
+
151
+ return value;
152
+ }
153
+ };
154
+
155
+ var SearchSvg = {
156
+ name: 'SearchSvg',
157
+ props: ['styles'],
158
+ render: function render() {
159
+ var h = arguments[0];
160
+ return h("svg", {
161
+ "attrs": {
162
+ "alt": "Search",
163
+ "height": "12",
164
+ "xmlns": "http://www.w3.org/2000/svg",
165
+ "viewBox": "0 0 15 15"
166
+ },
167
+ "class": "search-icon",
168
+ "style": _extends({
169
+ transform: 'scale(1.35)',
170
+ position: 'relative'
171
+ }, this.$props.styles ? this.$props.styles : {})
172
+ }, [h("title", ["Search"]), h("path", {
173
+ "attrs": {
174
+ "d": 'M6.02945,10.20327a4.17382,4.17382,0,1,1,4.17382-4.17382A4.15609,4.15609,0,0,1,6.02945,10.20327Zm9.69195,4.2199L10.8989,9.59979A5.88021,5.88021,0,0,0,12.058,6.02856,6.00467,6.00467,0,1,0,9.59979,10.8989l4.82338,4.82338a.89729.89729,0,0,0,1.29912,0,.89749.89749,0,0,0-.00087-1.29909Z'
175
+ }
176
+ })]);
177
+ }
178
+ };
179
+
180
+ var _templateObject$3;
181
+
182
+ injectGlobal(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n\t#el_TvxDfTAtKp {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_D93PK3GbmJ {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t\tfill: #d8d8d8;\n\t}\n"])));
183
+ var MicSvg = {
184
+ name: 'MicSvg',
185
+ props: ['className'],
186
+ render: function render() {
187
+ var h = arguments[0];
188
+ return h("svg", {
189
+ "attrs": {
190
+ "viewBox": "0 0 480 480",
191
+ "xmlns": "http://www.w3.org/2000/svg",
192
+ "id": "el_xS0FRzQjJ",
193
+ "width": 28,
194
+ "height": 28,
195
+ "className": this.$props.className
196
+ },
197
+ "style": {
198
+ transform: 'scale(1.5)'
199
+ }
200
+ }, [h("g", {
201
+ "attrs": {
202
+ "id": "el_TvxDfTAtKp",
203
+ "fillRule": "evenodd"
204
+ }
205
+ }, [h("g", {
206
+ "attrs": {
207
+ "id": "el_D93PK3GbmJ",
208
+ "fillRule": "nonzero"
209
+ },
210
+ "style": {
211
+ fill: '#595959'
212
+ }
213
+ }, [h("path", {
214
+ "attrs": {
215
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
216
+ "id": "el_uly3EwA2O3"
217
+ }
218
+ }), h("path", {
219
+ "attrs": {
220
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
221
+ "id": "el_tnDbR4ytu4"
222
+ }
223
+ })])])]);
224
+ }
225
+ };
226
+
227
+ var _templateObject$4;
228
+
229
+ injectGlobal(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\t#el_X81iT9kZYo {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_gMpyalCphp {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t}\n\t#el_c7H-3u-D4l {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_qhFcdAAFwo {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_M8X8g37WOI {\n\t\tstroke: #e83137;\n\t\tstroke-width: 21;\n\t}\n"])));
230
+ var MuteSvg = {
231
+ name: 'MuteSvg',
232
+ props: ['className'],
233
+ render: function render() {
234
+ var h = arguments[0];
235
+ return h("svg", {
236
+ "style": {
237
+ transform: 'scale(1.5)'
238
+ },
239
+ "attrs": {
240
+ "viewBox": "0 0 480 480",
241
+ "xmlns": "http://www.w3.org/2000/svg",
242
+ "id": "el_D1rEpH2zj",
243
+ "width": 28,
244
+ "height": 28,
245
+ "className": this.$props.className
246
+ }
247
+ }, [h("g", {
248
+ "attrs": {
249
+ "id": "el_X81iT9kZYo",
250
+ "fillRule": "evenodd"
251
+ }
252
+ }, [h("g", {
253
+ "attrs": {
254
+ "id": "el_gMpyalCphp"
255
+ }
256
+ }, [h("path", {
257
+ "attrs": {
258
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
259
+ "id": "el_c7H-3u-D4l",
260
+ "fillRule": "nonzero"
261
+ },
262
+ "style": {
263
+ fill: '#595959'
264
+ }
265
+ }), h("path", {
266
+ "attrs": {
267
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
268
+ "id": "el_qhFcdAAFwo",
269
+ "fillRule": "nonzero"
270
+ },
271
+ "style": {
272
+ fill: '#595959'
273
+ }
274
+ }), h("path", {
275
+ "attrs": {
276
+ "d": "M11.5,206.5 L142.5,12.5",
277
+ "id": "el_M8X8g37WOI",
278
+ "strokeLinecap": "round",
279
+ "strokeLinejoin": "round"
280
+ }
281
+ })])])]);
282
+ }
283
+ };
284
+
285
+ var _templateObject$5;
286
+
287
+ injectGlobal(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n\t@-webkit-keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t#el_hiibMG0x- * {\n\t\t-webkit-animation-duration: 1.2s;\n\t\tanimation-duration: 1.2s;\n\t\t-webkit-animation-iteration-count: infinite;\n\t\tanimation-iteration-count: infinite;\n\t\t-webkit-animation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t}\n\t#el_QJeJ_2CDw5 {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_UYYCfubTRf {\n\t\t-webkit-transform: translate(163px, 123px);\n\t\ttransform: translate(163px, 123px);\n\t}\n\t#el_uzZNtK32Zi {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_EYKQ2N9Kgy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6SDP2LAgKC {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t}\n\t#el_-Vm65Ltfy7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_q04iZcSim4 {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6WKby7wXqV {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\tanimation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_9bggsfQOtU {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_NKxqi9eIym {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_Wi-my975tM {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\tanimation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_zclQ34fvf7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_1OsvRT8HkeZ {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DkfFFTaFxy8 {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\tanimation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_aa9sjx4H0vA {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_tea114vWg0J {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_34IgwiMB5rf {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\tanimation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_z5u6RAFhx7d {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_7nfuWmA5Uhy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DeebuCsPTGA {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\tanimation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el__ZcqlS20zcw {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_8DnEQnD7VWV {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_ZOjjrPTvyrv {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\tanimation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_FYYKCI_u24e {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_XZty4MnTp5Y {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_2FATegVmf0K {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\tanimation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_RMT1KUfbdF8 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_RgLcovvFiO1 {\n\t\tfill: #d8d8d8;\n\t}\n"])));
288
+ var ListenSvg = {
289
+ name: 'ListenSvg',
290
+ props: ['className'],
291
+ render: function render() {
292
+ var h = arguments[0];
293
+ return h("svg", {
294
+ "attrs": {
295
+ "viewBox": "0 0 480 480",
296
+ "xmlns": "http://www.w3.org/2000/svg",
297
+ "xmlnsXlink": "http://www.w3.org/1999/xlink",
298
+ "id": "el_hiibMG0x-",
299
+ "width": 28,
300
+ "height": 29,
301
+ "className": this.$props.className
302
+ },
303
+ "style": {
304
+ transform: 'scale(1.5)'
305
+ }
306
+ }, [h("defs", [h("path", {
307
+ "attrs": {
308
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
309
+ "id": "path-1"
310
+ }
311
+ }), h("path", {
312
+ "attrs": {
313
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
314
+ "id": "path-3"
315
+ }
316
+ }), h("path", {
317
+ "attrs": {
318
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
319
+ "id": "path-5"
320
+ }
321
+ }), h("path", {
322
+ "attrs": {
323
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
324
+ "id": "path-7"
325
+ }
326
+ }), h("path", {
327
+ "attrs": {
328
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
329
+ "id": "path-9"
330
+ }
331
+ }), h("path", {
332
+ "attrs": {
333
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
334
+ "id": "path-11"
335
+ }
336
+ }), h("path", {
337
+ "attrs": {
338
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
339
+ "id": "path-13"
340
+ }
341
+ }), h("path", {
342
+ "attrs": {
343
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
344
+ "id": "path-15"
345
+ }
346
+ })]), h("g", {
347
+ "attrs": {
348
+ "id": "el_QJeJ_2CDw5",
349
+ "fillRule": "evenodd"
350
+ }
351
+ }, [h("g", {
352
+ "attrs": {
353
+ "id": "el_UYYCfubTRf"
354
+ }
355
+ }, [h("path", {
356
+ "attrs": {
357
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
358
+ "id": "el_uzZNtK32Zi",
359
+ "fillRule": "nonzero"
360
+ },
361
+ "style": {
362
+ fill: '#0B6AFF'
363
+ }
364
+ }), h("path", {
365
+ "attrs": {
366
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,0 76.9864699,0 C55.8825877,0 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
367
+ "id": "el_EYKQ2N9Kgy",
368
+ "fillRule": "nonzero"
369
+ }
370
+ }), h("g", {
371
+ "attrs": {
372
+ "id": "el_6SDP2LAgKC"
373
+ }
374
+ }, [h("mask", {
375
+ "attrs": {
376
+ "id": "mask-2",
377
+ "fill": "#fff"
378
+ }
379
+ }, [h("use", {
380
+ "attrs": {
381
+ "xlink:href": "#path-1"
382
+ }
383
+ })]), h("path", {
384
+ "attrs": {
385
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
386
+ "id": "el_-Vm65Ltfy7",
387
+ "fillRule": "nonzero",
388
+ "mask": "url(#mask-2)"
389
+ }
390
+ }), h("rect", {
391
+ "attrs": {
392
+ "id": "el_q04iZcSim4",
393
+ "mask": "url(#mask-2)",
394
+ "x": "0.279",
395
+ "width": "77",
396
+ "height": "130"
397
+ }
398
+ })]), h("g", {
399
+ "attrs": {
400
+ "id": "el_6WKby7wXqV"
401
+ }
402
+ }, [h("mask", {
403
+ "attrs": {
404
+ "id": "mask-4",
405
+ "fill": "#fff"
406
+ }
407
+ }, [h("use", {
408
+ "attrs": {
409
+ "xlink:href": "#path-3"
410
+ }
411
+ })]), h("path", {
412
+ "attrs": {
413
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
414
+ "id": "el_9bggsfQOtU",
415
+ "fillRule": "nonzero",
416
+ "mask": "url(#mask-4)"
417
+ }
418
+ }), h("rect", {
419
+ "attrs": {
420
+ "id": "el_NKxqi9eIym",
421
+ "mask": "url(#mask-4)",
422
+ "x": "0.279",
423
+ "width": "77",
424
+ "height": "115"
425
+ }
426
+ })]), h("g", {
427
+ "attrs": {
428
+ "id": "el_Wi-my975tM"
429
+ }
430
+ }, [h("mask", {
431
+ "attrs": {
432
+ "id": "mask-6",
433
+ "fill": "#fff"
434
+ }
435
+ }, [h("use", {
436
+ "attrs": {
437
+ "xlink:href": "#path-5"
438
+ }
439
+ })]), h("path", {
440
+ "attrs": {
441
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
442
+ "id": "el_zclQ34fvf7",
443
+ "fillRule": "nonzero",
444
+ "mask": "url(#mask-6)"
445
+ }
446
+ }), h("rect", {
447
+ "attrs": {
448
+ "id": "el_1OsvRT8HkeZ",
449
+ "mask": "url(#mask-6)",
450
+ "x": "0.279",
451
+ "width": "77",
452
+ "height": "100"
453
+ }
454
+ })]), h("g", {
455
+ "attrs": {
456
+ "id": "el_DkfFFTaFxy8"
457
+ }
458
+ }, [h("mask", {
459
+ "attrs": {
460
+ "id": "mask-8",
461
+ "fill": "#fff"
462
+ }
463
+ }, [h("use", {
464
+ "attrs": {
465
+ "xlink:href": "#path-7"
466
+ }
467
+ })]), h("path", {
468
+ "attrs": {
469
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
470
+ "id": "el_aa9sjx4H0vA",
471
+ "fillRule": "nonzero",
472
+ "mask": "url(#mask-8)"
473
+ }
474
+ }), h("rect", {
475
+ "attrs": {
476
+ "id": "el_tea114vWg0J",
477
+ "mask": "url(#mask-8)",
478
+ "x": "0.279",
479
+ "width": "77",
480
+ "height": "85"
481
+ }
482
+ })]), h("g", {
483
+ "attrs": {
484
+ "id": "el_34IgwiMB5rf"
485
+ }
486
+ }, [h("mask", {
487
+ "attrs": {
488
+ "id": "mask-10",
489
+ "fill": "#fff"
490
+ }
491
+ }, [h("use", {
492
+ "attrs": {
493
+ "xlink:href": "#path-9"
494
+ }
495
+ })]), h("path", {
496
+ "attrs": {
497
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
498
+ "id": "el_z5u6RAFhx7d",
499
+ "fillRule": "nonzero",
500
+ "mask": "url(#mask-10)"
501
+ }
502
+ }), h("rect", {
503
+ "attrs": {
504
+ "id": "el_7nfuWmA5Uhy",
505
+ "mask": "url(#mask-10)",
506
+ "x": "0.279",
507
+ "width": "77",
508
+ "height": "70"
509
+ }
510
+ })]), h("g", {
511
+ "attrs": {
512
+ "id": "el_DeebuCsPTGA"
513
+ }
514
+ }, [h("mask", {
515
+ "attrs": {
516
+ "id": "mask-12",
517
+ "fill": "#fff"
518
+ }
519
+ }, [h("use", {
520
+ "attrs": {
521
+ "xlink:href": "#path-11"
522
+ }
523
+ })]), h("path", {
524
+ "attrs": {
525
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
526
+ "id": "el__ZcqlS20zcw",
527
+ "fillRule": "nonzero",
528
+ "mask": "url(#mask-12)"
529
+ }
530
+ }), h("rect", {
531
+ "attrs": {
532
+ "id": "el_8DnEQnD7VWV",
533
+ "mask": "url(#mask-12)",
534
+ "x": "0.279",
535
+ "width": "77",
536
+ "height": "55"
537
+ }
538
+ })]), h("g", {
539
+ "attrs": {
540
+ "id": "el_ZOjjrPTvyrv"
541
+ }
542
+ }, [h("mask", {
543
+ "attrs": {
544
+ "id": "mask-14",
545
+ "fill": "#fff"
546
+ }
547
+ }, [h("use", {
548
+ "attrs": {
549
+ "xlink:href": "#path-13"
550
+ }
551
+ })]), h("path", {
552
+ "attrs": {
553
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
554
+ "id": "el_FYYKCI_u24e",
555
+ "fillRule": "nonzero",
556
+ "mask": "url(#mask-14)"
557
+ }
558
+ }), h("rect", {
559
+ "attrs": {
560
+ "id": "el_XZty4MnTp5Y",
561
+ "mask": "url(#mask-14)",
562
+ "x": "0.279",
563
+ "width": "77",
564
+ "height": "40"
565
+ }
566
+ })]), h("g", {
567
+ "attrs": {
568
+ "id": "el_2FATegVmf0K"
569
+ }
570
+ }, [h("mask", {
571
+ "attrs": {
572
+ "id": "mask-16",
573
+ "fill": "#fff"
574
+ }
575
+ }, [h("use", {
576
+ "attrs": {
577
+ "xlink:href": "#path-15"
578
+ }
579
+ })]), h("path", {
580
+ "attrs": {
581
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
582
+ "id": "el_RMT1KUfbdF8",
583
+ "fillRule": "nonzero",
584
+ "mask": "url(#mask-16)"
585
+ }
586
+ }), h("rect", {
587
+ "attrs": {
588
+ "id": "el_RgLcovvFiO1",
589
+ "mask": "url(#mask-16)",
590
+ "x": "0.279",
591
+ "width": "77",
592
+ "height": "25"
593
+ }
594
+ })])])])]);
595
+ }
596
+ };
597
+
598
+ var STATUS = {
599
+ inactive: 'INACTIVE',
600
+ stopped: 'STOPPED',
601
+ active: 'ACTIVE',
602
+ denied: 'DENIED'
603
+ };
604
+ var Mic = {
605
+ name: 'Mic',
606
+ props: {
607
+ children: types.title,
608
+ lang: VueTypes.string.def('en-US'),
609
+ iconPosition: VueTypes.string.def('left'),
610
+ handleResult: types.func,
611
+ onNoMatch: types.func,
612
+ onError: types.func,
613
+ getInstance: types.func,
614
+ render: types.func,
615
+ className: types.string,
616
+ applyClearStyle: VueTypes.bool,
617
+ showIcon: VueTypes.bool
618
+ },
619
+ methods: {
620
+ getComponent: function getComponent$1() {
621
+ var status = this.$data.status;
622
+ var data = {
623
+ handleClick: this.handleClick,
624
+ status: status
625
+ };
626
+ return getComponent(data, this);
627
+ },
628
+ stopMic: function stopMic() {
629
+ if (this.instance) {
630
+ this.status = STATUS.inactive;
631
+ this.instance.stop();
632
+ this.instance = null;
633
+ }
634
+ },
635
+ handleClick: function handleClick() {
636
+ var _this = this;
637
+
638
+ this.results = [];
639
+
640
+ if (window && window.SpeechRecognition) {
641
+ var status = this.$data.status;
642
+
643
+ if (status === STATUS.active) {
644
+ this.status = STATUS.inactive;
645
+ }
646
+
647
+ var _this$$props = this.$props,
648
+ handleResult = _this$$props.handleResult,
649
+ onNoMatch = _this$$props.onNoMatch,
650
+ onError = _this$$props.onError,
651
+ lang = _this$$props.lang,
652
+ getInstance = _this$$props.getInstance;
653
+ var _window = window,
654
+ SpeechRecognition = _window.SpeechRecognition;
655
+
656
+ if (this.instance && this.status !== STATUS.denied) {
657
+ this.status = STATUS.inactive;
658
+ this.instance.stop();
659
+ this.instance = null;
660
+ return;
661
+ }
662
+
663
+ this.instance = new SpeechRecognition();
664
+ this.instance.continuous = true;
665
+ this.instance.interimResults = true;
666
+ this.instance.lang = lang;
667
+
668
+ if (getInstance) {
669
+ getInstance(this.instance);
670
+ }
671
+
672
+ this.instance.start();
673
+
674
+ this.instance.onstart = function () {
675
+ _this.status = STATUS.active;
676
+ };
677
+
678
+ this.instance.onresult = function (_ref) {
679
+ var results = _ref.results,
680
+ timeStamp = _ref.timeStamp;
681
+
682
+ _this.stopMic();
683
+
684
+ if (handleResult) {
685
+ handleResult({
686
+ results: results,
687
+ timeStamp: timeStamp
688
+ });
689
+ }
690
+
691
+ _this.results.push({
692
+ results: results,
693
+ timeStamp: timeStamp
694
+ });
695
+ };
696
+
697
+ this.instance.onnomatch = function (e) {
698
+ return onNoMatch ? onNoMatch(e) : console.warn(e);
699
+ };
700
+
701
+ this.instance.onerror = function (e) {
702
+ if (e.error === 'no-speech' || e.error === 'audio-capture') {
703
+ _this.status = STATUS.inactive;
704
+ } else if (e.error === 'not-allowed') {
705
+ _this.status = STATUS.denied;
706
+ }
707
+
708
+ console.error(e);
709
+
710
+ if (onError) {
711
+ onError(e);
712
+ }
713
+ };
714
+ /* Below Two methods run when Continuous is False */
715
+
716
+
717
+ this.instance.onspeechend = function () {
718
+ _this.status = STATUS.inactive;
719
+ };
720
+
721
+ this.instance.onaudioend = function () {
722
+ _this.status = STATUS.inactive;
723
+ };
724
+ }
725
+ }
726
+ },
727
+ computed: {
728
+ hasCustomRenderer: function hasCustomRenderer$1() {
729
+ return hasCustomRenderer(this);
730
+ },
731
+ Icon: function Icon() {
732
+ var h = this.$createElement;
733
+ var status = this.$data.status;
734
+ var className = this.$props.className;
735
+
736
+ switch (status) {
737
+ case STATUS.active:
738
+ return h(ListenSvg, {
739
+ "attrs": {
740
+ "className": className
741
+ },
742
+ "nativeOn": {
743
+ "click": this.handleClick
744
+ }
745
+ });
746
+
747
+ case STATUS.stopped:
748
+ case STATUS.denied:
749
+ return h(MuteSvg, {
750
+ "attrs": {
751
+ "className": className
752
+ },
753
+ "nativeOn": {
754
+ "click": this.handleClick
755
+ }
756
+ });
757
+
758
+ default:
759
+ return h(MicSvg, {
760
+ "attrs": {
761
+ "className": className
762
+ },
763
+ "nativeOn": {
764
+ "click": this.handleClick
765
+ }
766
+ });
767
+ }
768
+ }
769
+ },
770
+ data: function data() {
771
+ return {
772
+ status: STATUS.inactive
773
+ };
774
+ },
775
+ created: function created() {
776
+ this.results = [];
777
+
778
+ if (typeof window !== 'undefined') {
779
+ window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
780
+
781
+ if (!window.SpeechRecognition) {
782
+ console.error('SpeechRecognition is not supported in this browser. Please check the browser compatibility at https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility.');
783
+ }
784
+ }
785
+ },
786
+ render: function render() {
787
+ var h = arguments[0];
788
+
789
+ if (this.hasCustomRenderer) {
790
+ return this.getComponent();
791
+ }
792
+
793
+ return h(IconWrapper, [this.Icon]);
794
+ }
795
+ };
796
+
797
+ var CustomSvg = {
798
+ name: 'CustomSvg',
799
+ props: {
800
+ className: String,
801
+ icon: Function,
802
+ type: String
803
+ },
804
+ data: function data() {
805
+ return {
806
+ customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
807
+ };
808
+ },
809
+ render: function render() {
810
+ var h = arguments[0];
811
+
812
+ if (this.customIcon) {
813
+ return h("div", {
814
+ "class": this.$props.className
815
+ }, [this.customIcon]);
816
+ }
817
+
818
+ if (this.$props.type === 'recent-search-icon') {
819
+ return h("svg", {
820
+ "attrs": {
821
+ "xmlns": "http://www.w3.org/2000/svg",
822
+ "alt": "Recent Search",
823
+ "height": "20",
824
+ "width": "20",
825
+ "viewBox": "0 0 24 24"
826
+ },
827
+ "style": {
828
+ fill: '#707070'
829
+ },
830
+ "class": this.$props.className
831
+ }, [h("path", {
832
+ "attrs": {
833
+ "d": "M0 0h24v24H0z",
834
+ "fill": "none"
835
+ }
836
+ }), h("path", {
837
+ "attrs": {
838
+ "d": "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
839
+ }
840
+ })]);
841
+ }
842
+
843
+ if (this.$props.type === 'promoted-search-icon') {
844
+ return h("svg", {
845
+ "attrs": {
846
+ "xmlns": "http://www.w3.org/2000/svg",
847
+ "width": "20",
848
+ "alt": "promoted search",
849
+ "height": "20",
850
+ "viewBox": "0 0 24 24"
851
+ },
852
+ "class": this.$props.className,
853
+ "style": {
854
+ fill: '#707070'
855
+ }
856
+ }, [h("path", {
857
+ "attrs": {
858
+ "d": "M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"
859
+ }
860
+ })]);
861
+ }
862
+
863
+ if (this.$props.type === 'popular-search-icon') {
864
+ return h("svg", {
865
+ "attrs": {
866
+ "xmlns": "http://www.w3.org/2000/svg",
867
+ "alt": "Popular Search",
868
+ "height": "20",
869
+ "width": "20",
870
+ "viewBox": "0 0 24 24"
871
+ },
872
+ "style": {
873
+ fill: '#707070'
874
+ },
875
+ "class": this.$props.className
876
+ }, [h("path", {
877
+ "attrs": {
878
+ "d": "M0 0h24v24H0z",
879
+ "fill": "none"
880
+ }
881
+ }), h("path", {
882
+ "attrs": {
883
+ "d": "M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"
884
+ }
885
+ })]);
886
+ }
887
+
888
+ return h(SearchSvg, {
889
+ "attrs": {
890
+ "styles": {
891
+ position: 'relative',
892
+ fill: '#707070',
893
+ left: '3px',
894
+ marginRight: '8px'
895
+ }
896
+ }
897
+ });
898
+ }
899
+ };
900
+
901
+ var updateQuery = Actions.updateQuery,
902
+ setQueryOptions = Actions.setQueryOptions,
903
+ setCustomQuery = Actions.setCustomQuery,
904
+ setDefaultQuery = Actions.setDefaultQuery,
905
+ setCustomHighlightOptions = Actions.setCustomHighlightOptions,
906
+ recordSuggestionClick = Actions.recordSuggestionClick,
907
+ loadPopularSuggestions = Actions.loadPopularSuggestions,
908
+ getRecentSearches = Actions.getRecentSearches;
909
+ var debounce = helper.debounce,
910
+ checkValueChange = helper.checkValueChange,
911
+ getClassName$1 = helper.getClassName,
912
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
913
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery,
914
+ isEqual = helper.isEqual,
915
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
916
+ withClickIds = helper.withClickIds,
917
+ getResultStats = helper.getResultStats,
918
+ handleOnSuggestions = helper.handleOnSuggestions,
919
+ getTopSuggestions = helper.getTopSuggestions,
920
+ normalizeDataField = helper.normalizeDataField;
921
+ var DataSearch = {
922
+ name: 'DataSearch',
923
+ data: function data() {
924
+ var props = this.$props;
925
+ this.__state = {
926
+ currentValue: '',
927
+ isOpen: false,
928
+ normalizedSuggestions: [],
929
+ isPending: false
930
+ };
931
+ this.internalComponent = props.componentId + "__internal";
932
+ return this.__state;
933
+ },
934
+ inject: {
935
+ theme: {
936
+ from: 'theme_reactivesearch'
937
+ }
938
+ },
939
+ created: function created() {
940
+ var _this$$props = this.$props,
941
+ enableQuerySuggestions = _this$$props.enableQuerySuggestions,
942
+ renderQuerySuggestions = _this$$props.renderQuerySuggestions,
943
+ enableRecentSearches = _this$$props.enableRecentSearches,
944
+ distinctField = _this$$props.distinctField,
945
+ distinctFieldConfig = _this$$props.distinctFieldConfig,
946
+ index = _this$$props.index; // TODO: Remove in 2.0
947
+
948
+ if (enableQuerySuggestions) {
949
+ console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
950
+ } // TODO: Remove in 2.0
951
+
952
+
953
+ if (renderQuerySuggestions) {
954
+ console.warn('Warning(ReactiveSearch): The `renderQuerySuggestions` prop has been marked as deprecated, please use the `renderPopularSuggestions` prop instead.');
955
+ }
956
+
957
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
958
+ console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
959
+ }
960
+
961
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
962
+ console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
963
+ }
964
+
965
+ if (!this.enableAppbase && index) {
966
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
967
+ }
968
+
969
+ this.currentValue = this.selectedValue || '';
970
+ var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
971
+
972
+ if (shouldFetchInitialSuggestions) {
973
+ this.loadPopularSuggestions(this.$props.componentId);
974
+
975
+ if (enableRecentSearches) {
976
+ this.getRecentSearches();
977
+ }
978
+ }
979
+
980
+ this.handleTextChange = debounce(this.handleText, this.$props.debounce); // Set custom and default queries in store
981
+
982
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
983
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
984
+ },
985
+ computed: {
986
+ suggestionsList: function suggestionsList() {
987
+ var suggestionsList = [];
988
+
989
+ if (!this.$data.currentValue && this.$props.defaultSuggestions && this.$props.defaultSuggestions.length) {
990
+ suggestionsList = this.$props.defaultSuggestions;
991
+ } else if (this.$data.currentValue) {
992
+ suggestionsList = this.normalizedSuggestions;
993
+ }
994
+
995
+ return withClickIds(suggestionsList);
996
+ },
997
+ topSuggestions: function topSuggestions() {
998
+ if (!this.currentValue) {
999
+ return [];
1000
+ }
1001
+
1002
+ return this.enableQuerySuggestions || this.enablePopularSuggestions ? this.normalizedPopularSuggestions : [];
1003
+ },
1004
+ normalizedRecentSearches: function normalizedRecentSearches() {
1005
+ return this.recentSearches || [];
1006
+ },
1007
+ normalizedPopularSuggestions: function normalizedPopularSuggestions() {
1008
+ return getTopSuggestions( // use default popular suggestions if value is empty
1009
+ this.currentValue ? this.popularSuggestions : this.defaultPopularSuggestions || [], this.currentValue, this.showDistinctSuggestions);
1010
+ },
1011
+ defaultSearchSuggestions: function defaultSearchSuggestions() {
1012
+ var isPopularSuggestionsEnabled = this.enableQuerySuggestions || this.enablePopularSuggestions;
1013
+
1014
+ if (this.currentValue || !this.enableDefaultSuggestions) {
1015
+ return [];
1016
+ }
1017
+
1018
+ var customDefaultPopularSuggestions = (this.defaultPopularSuggestions || []).map(function (suggestion) {
1019
+ return _extends({}, suggestion, {
1020
+ _popular_suggestion: true
1021
+ });
1022
+ });
1023
+ var customNormalizedRecentSearches = (this.normalizedRecentSearches || []).map(function (search) {
1024
+ return _extends({}, search, {
1025
+ _recent_search: true
1026
+ });
1027
+ });
1028
+ var defaultSuggestions = isPopularSuggestionsEnabled ? [].concat(customNormalizedRecentSearches, customDefaultPopularSuggestions || []) : customNormalizedRecentSearches;
1029
+ return getTopSuggestions( // use default popular suggestions if value is empty
1030
+ defaultSuggestions, this.currentValue, this.showDistinctSuggestions);
1031
+ },
1032
+ hasCustomRenderer: function hasCustomRenderer$1() {
1033
+ return hasCustomRenderer(this);
1034
+ },
1035
+ stats: function stats() {
1036
+ return getResultStats(this);
1037
+ }
1038
+ },
1039
+ props: {
1040
+ options: types.options,
1041
+ autoFocus: VueTypes.bool,
1042
+ autosuggest: VueTypes.bool.def(true),
1043
+ beforeValueChange: types.func,
1044
+ className: VueTypes.string.def(''),
1045
+ clearIcon: types.children,
1046
+ componentId: types.stringRequired,
1047
+ customHighlight: types.func,
1048
+ customQuery: types.func,
1049
+ defaultQuery: types.func,
1050
+ dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
1051
+ field: VueTypes.string,
1052
+ weight: VueTypes.number
1053
+ }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
1054
+ field: VueTypes.string,
1055
+ weight: VueTypes.number
1056
+ })]),
1057
+ aggregationField: types.string,
1058
+ aggregationSize: VueTypes.number,
1059
+ size: VueTypes.number,
1060
+ debounce: VueTypes.number.def(0),
1061
+ defaultValue: types.string,
1062
+ excludeFields: types.excludeFields,
1063
+ value: types.value,
1064
+ defaultSuggestions: types.suggestions,
1065
+ enableSynonyms: VueTypes.bool.def(true),
1066
+ enableQuerySuggestions: VueTypes.bool.def(false),
1067
+ enablePopularSuggestions: VueTypes.bool.def(false),
1068
+ enableRecentSearches: VueTypes.bool.def(false),
1069
+ fieldWeights: types.fieldWeights,
1070
+ filterLabel: types.string,
1071
+ fuzziness: types.fuzziness,
1072
+ highlight: VueTypes.bool,
1073
+ highlightField: types.stringOrArray,
1074
+ icon: types.children,
1075
+ iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
1076
+ includeFields: types.includeFields,
1077
+ innerClass: types.style,
1078
+ innerRef: VueTypes.string.def('searchInputField'),
1079
+ render: types.func,
1080
+ renderQuerySuggestions: types.func,
1081
+ renderPopularSuggestions: types.func,
1082
+ parseSuggestion: types.func,
1083
+ renderNoSuggestion: types.title,
1084
+ renderError: types.title,
1085
+ placeholder: VueTypes.string.def('Search'),
1086
+ queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
1087
+ react: types.react,
1088
+ showClear: VueTypes.bool.def(true),
1089
+ showDistinctSuggestions: VueTypes.bool.def(true),
1090
+ showFilter: VueTypes.bool.def(true),
1091
+ showIcon: VueTypes.bool.def(true),
1092
+ title: types.title,
1093
+ theme: types.style,
1094
+ URLParams: VueTypes.bool.def(false),
1095
+ strictSelection: VueTypes.bool.def(false),
1096
+ nestedField: types.string,
1097
+ enablePredictiveSuggestions: VueTypes.bool.def(false),
1098
+ recentSearchesIcon: VueTypes.any,
1099
+ popularSearchesIcon: VueTypes.any,
1100
+ // mic props
1101
+ showVoiceSearch: VueTypes.bool.def(false),
1102
+ getMicInstance: types.func,
1103
+ renderMic: types.func,
1104
+ distinctField: types.string,
1105
+ distinctFieldConfig: types.props,
1106
+ //
1107
+ focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1108
+ addonBefore: VueTypes.any,
1109
+ addonAfter: VueTypes.any,
1110
+ expandSuggestionsContainer: VueTypes.bool.def(true),
1111
+ index: VueTypes.string,
1112
+ enableDefaultSuggestions: VueTypes.bool.def(true)
1113
+ },
1114
+ beforeMount: function beforeMount() {
1115
+ if (this.$props.highlight) {
1116
+ if (this.customHighlight && typeof this.customHighlight === 'function') {
1117
+ this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1118
+ }
1119
+
1120
+ var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1121
+ this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1122
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1123
+ } else {
1124
+ this.queryOptions = this.getBasicQueryOptions();
1125
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1126
+ }
1127
+
1128
+ if (this.selectedValue) {
1129
+ this.setValue(this.selectedValue, true);
1130
+ } else if (this.$props.value) {
1131
+ this.setValue(this.$props.value, true);
1132
+ } else if (this.$props.defaultValue) {
1133
+ this.setValue(this.$props.defaultValue, true);
1134
+ }
1135
+ },
1136
+ mounted: function mounted() {
1137
+ this.listenForFocusShortcuts();
1138
+ },
1139
+ watch: {
1140
+ highlight: function highlight() {
1141
+ this.updateQueryOptions();
1142
+ },
1143
+ dataField: function dataField() {
1144
+ this.updateQueryOptions();
1145
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1146
+ },
1147
+ highlightField: function highlightField() {
1148
+ this.updateQueryOptions();
1149
+ },
1150
+ fieldWeights: function fieldWeights() {
1151
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1152
+ },
1153
+ fuzziness: function fuzziness() {
1154
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1155
+ },
1156
+ queryFormat: function queryFormat() {
1157
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1158
+ },
1159
+ defaultValue: function defaultValue(newVal) {
1160
+ this.setValue(newVal, true, this.$props);
1161
+ },
1162
+ value: function value(newVal, oldVal) {
1163
+ if (!isEqual(newVal, oldVal)) {
1164
+ this.setValue(newVal, true, this.$props, undefined, false);
1165
+ }
1166
+ },
1167
+ defaultQuery: function defaultQuery(newVal, oldVal) {
1168
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1169
+ this.updateDefaultQueryHandler(this.$data.currentValue, this.$props);
1170
+ }
1171
+ },
1172
+ customQuery: function customQuery(newVal, oldVal) {
1173
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1174
+ this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
1175
+ }
1176
+ },
1177
+ suggestions: function suggestions(newVal) {
1178
+ if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
1179
+ // shallow check allows us to set suggestions even if the next set
1180
+ // of suggestions are same as the current one
1181
+ this.$emit('suggestions', newVal);
1182
+ this.normalizedSuggestions = this.onSuggestions(newVal);
1183
+ }
1184
+ },
1185
+ selectedValue: function selectedValue(newVal, oldVal) {
1186
+ if (oldVal !== newVal && this.$data.currentValue !== newVal) {
1187
+ if (!newVal && this.$data.currentValue) {
1188
+ // selected value is cleared, call onValueSelected
1189
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1190
+ }
1191
+
1192
+ this.setValue(newVal || '', true, this.$props);
1193
+ }
1194
+ },
1195
+ focusShortcuts: function focusShortcuts() {
1196
+ this.listenForFocusShortcuts();
1197
+ }
1198
+ },
1199
+ methods: {
1200
+ handleText: function handleText(value) {
1201
+ if (this.$props.autosuggest) {
1202
+ this.updateDefaultQueryHandler(value, this.$props);
1203
+ } else {
1204
+ this.updateQueryHandler(this.$props.componentId, value, this.$props);
1205
+ }
1206
+ },
1207
+ validateDataField: function validateDataField() {
1208
+ var propName = 'dataField';
1209
+ var componentName = DataSearch.name;
1210
+ var props = this.$props;
1211
+ var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
1212
+ var propValue = props[propName];
1213
+
1214
+ if (!this.enableAppbase) {
1215
+ if (!propValue) {
1216
+ console.error(requiredError);
1217
+ return;
1218
+ }
1219
+
1220
+ if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
1221
+ console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
1222
+ return;
1223
+ }
1224
+
1225
+ if (Array.isArray(propValue) && propValue.length === 0) {
1226
+ console.error(requiredError);
1227
+ }
1228
+ }
1229
+ },
1230
+ updateQueryOptions: function updateQueryOptions() {
1231
+ if (this.customHighlight && typeof this.customHighlight === 'function') {
1232
+ this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1233
+ }
1234
+
1235
+ var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1236
+ this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1237
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1238
+ },
1239
+ getComponent: function getComponent$1(downshiftProps, isQuerySuggestionsRender) {
1240
+ if (downshiftProps === void 0) {
1241
+ downshiftProps = {};
1242
+ }
1243
+
1244
+ if (isQuerySuggestionsRender === void 0) {
1245
+ isQuerySuggestionsRender = false;
1246
+ }
1247
+
1248
+ var currentValue = this.$data.currentValue;
1249
+ var data = {
1250
+ error: this.error,
1251
+ loading: this.isLoading,
1252
+ downshiftProps: downshiftProps,
1253
+ data: this.suggestionsList,
1254
+ promotedData: this.promotedResults,
1255
+ aggregationData: this.aggregationData,
1256
+ rawData: this.rawData,
1257
+ customData: this.customData,
1258
+ value: currentValue,
1259
+ triggerClickAnalytics: this.triggerClickAnalytics,
1260
+ resultStats: this.stats,
1261
+ querySuggestions: this.normalizedPopularSuggestions,
1262
+ popularSuggestions: this.normalizedPopularSuggestions
1263
+ };
1264
+
1265
+ if (isQuerySuggestionsRender) {
1266
+ return getQuerySuggestionsComponent({
1267
+ downshiftProps: downshiftProps,
1268
+ data: this.normalizedPopularSuggestions,
1269
+ value: currentValue,
1270
+ loading: this.isLoading,
1271
+ error: this.error
1272
+ }, this);
1273
+ }
1274
+
1275
+ return getComponent(data, this);
1276
+ },
1277
+ // returns size and aggs property
1278
+ getBasicQueryOptions: function getBasicQueryOptions() {
1279
+ var aggregationField = this.$props.aggregationField;
1280
+ var queryOptions = getQueryOptions(this.$props);
1281
+
1282
+ if (aggregationField) {
1283
+ queryOptions.aggs = getCompositeAggsQuery({
1284
+ props: this.$props,
1285
+ showTopHits: true
1286
+ }).aggs;
1287
+ }
1288
+
1289
+ return queryOptions;
1290
+ },
1291
+ onSuggestions: function onSuggestions(results) {
1292
+ return handleOnSuggestions(results, this.$data.currentValue, this);
1293
+ },
1294
+ handleSearchIconClick: function handleSearchIconClick() {
1295
+ var currentValue = this.currentValue;
1296
+
1297
+ if (currentValue.trim()) {
1298
+ this.isPending = false;
1299
+ this.setValue(currentValue, true);
1300
+ this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1301
+ }
1302
+ },
1303
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen) {
1304
+ var _this = this;
1305
+
1306
+ if (isDefaultValue === void 0) {
1307
+ isDefaultValue = false;
1308
+ }
1309
+
1310
+ if (props === void 0) {
1311
+ props = this.$props;
1312
+ }
1313
+
1314
+ if (toggleIsOpen === void 0) {
1315
+ toggleIsOpen = true;
1316
+ }
1317
+
1318
+ var performUpdate = function performUpdate() {
1319
+ // Refresh recent searches when value becomes empty
1320
+ if (!value && _this.currentValue && _this.enableRecentSearches) {
1321
+ _this.getRecentSearches();
1322
+ }
1323
+
1324
+ _this.currentValue = value;
1325
+
1326
+ if (isDefaultValue) {
1327
+ if (_this.$props.autosuggest) {
1328
+ if (toggleIsOpen) {
1329
+ _this.isOpen = false;
1330
+ }
1331
+
1332
+ _this.updateDefaultQueryHandler(value, _this.$props);
1333
+ } // in case of strict selection only SUGGESTION_SELECT should be able
1334
+ // to set the query otherwise the value should reset
1335
+
1336
+
1337
+ if (props.strictSelection) {
1338
+ if (cause === causes.SUGGESTION_SELECT || value === '') {
1339
+ _this.updateQueryHandler(props.componentId, value, props);
1340
+ } else {
1341
+ _this.setValue('', true);
1342
+ }
1343
+ } else {
1344
+ _this.updateQueryHandler(props.componentId, value, props);
1345
+ }
1346
+ } else {
1347
+ // debounce for handling text while typing
1348
+ _this.handleTextChange(value);
1349
+ }
1350
+
1351
+ _this.$emit('valueChange', value);
1352
+
1353
+ _this.$emit('value-change', value); // Set the already fetched suggestions if query is same as used last to fetch the hits
1354
+
1355
+
1356
+ if (value === _this.lastUsedQuery) {
1357
+ _this.suggestions = _this.onSuggestions(_this.suggestions); // invoke on suggestions
1358
+
1359
+ _this.$emit('suggestions', _this.suggestions);
1360
+ } else if (!value) {
1361
+ // reset suggestions
1362
+ _this.suggestions = []; // invoke on suggestions
1363
+
1364
+ _this.$emit('suggestions', _this.suggestions);
1365
+ }
1366
+ };
1367
+
1368
+ checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1369
+ },
1370
+ updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
1371
+ var defaultQueryOptions;
1372
+ var query = DataSearch.defaultQuery(value, props);
1373
+
1374
+ if (this.defaultQuery) {
1375
+ var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
1376
+ var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
1377
+
1378
+ if (defaultQueryObj) {
1379
+ query = defaultQueryObj;
1380
+ }
1381
+
1382
+ defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
1383
+
1384
+ updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
1385
+ }
1386
+
1387
+ this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), false);
1388
+ this.updateQuery({
1389
+ componentId: this.internalComponent,
1390
+ query: query,
1391
+ value: value,
1392
+ componentType: componentTypes.dataSearch
1393
+ });
1394
+ },
1395
+ updateQueryHandler: function updateQueryHandler(componentId, value, props) {
1396
+ var customQuery = props.customQuery,
1397
+ filterLabel = props.filterLabel,
1398
+ showFilter = props.showFilter,
1399
+ URLParams = props.URLParams;
1400
+ var customQueryOptions;
1401
+ var defaultQueryTobeSet = DataSearch.defaultQuery(value, props);
1402
+ var query = defaultQueryTobeSet;
1403
+
1404
+ if (customQuery) {
1405
+ var customQueryTobeSet = customQuery(value, props);
1406
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
1407
+
1408
+ if (queryTobeSet) {
1409
+ query = queryTobeSet;
1410
+ }
1411
+
1412
+ customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
1413
+ updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
1414
+ this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
1415
+ }
1416
+
1417
+ if (!this.isPending) {
1418
+ this.updateQuery({
1419
+ componentId: componentId,
1420
+ query: query,
1421
+ value: value,
1422
+ label: filterLabel,
1423
+ showFilter: showFilter,
1424
+ URLParams: URLParams,
1425
+ componentType: 'DATASEARCH'
1426
+ });
1427
+ }
1428
+ },
1429
+ // need to review
1430
+ handleFocus: function handleFocus(event) {
1431
+ this.isOpen = true;
1432
+ this.$emit('focus', event);
1433
+ },
1434
+ handleVoiceResults: function handleVoiceResults(_ref) {
1435
+ var results = _ref.results;
1436
+
1437
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1438
+ this.isPending = false;
1439
+ this.setValue(results[0][0].transcript.trim(), true);
1440
+ }
1441
+ },
1442
+ triggerQuery: function triggerQuery(_temp) {
1443
+ var _ref2 = _temp === void 0 ? false : _temp,
1444
+ _ref2$isOpen = _ref2.isOpen,
1445
+ isOpen = _ref2$isOpen === void 0 ? false : _ref2$isOpen;
1446
+
1447
+ var value = this.$props.value;
1448
+
1449
+ if (value !== undefined) {
1450
+ this.isPending = false;
1451
+ this.setValue(this.$props.value, !isOpen);
1452
+ }
1453
+ },
1454
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1455
+ // click analytics would only work client side and after javascript loads
1456
+ var docId = documentId;
1457
+
1458
+ if (!docId) {
1459
+ var hitData = this.suggestionsList.find(function (hit) {
1460
+ return hit._click_id === searchPosition;
1461
+ });
1462
+
1463
+ if (hitData && hitData.source && hitData.source._id) {
1464
+ docId = hitData.source._id;
1465
+ }
1466
+ }
1467
+
1468
+ this.recordSuggestionClick(searchPosition, docId);
1469
+ },
1470
+ clearValue: function clearValue() {
1471
+ this.isPending = false;
1472
+ this.setValue('', true);
1473
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1474
+ },
1475
+ handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1476
+ var value = this.$props.value;
1477
+
1478
+ if (value !== undefined) {
1479
+ this.isPending = true;
1480
+ } // if a suggestion was selected, delegate the handling to suggestion handler
1481
+
1482
+
1483
+ if (event.key === 'Enter' && highlightedIndex === null) {
1484
+ this.setValue(event.target.value, true);
1485
+ this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1486
+ } // Need to review
1487
+
1488
+
1489
+ this.$emit('keyDown', event, this.triggerQuery);
1490
+ this.$emit('key-down', event, this.triggerQuery);
1491
+ },
1492
+ onInputChange: function onInputChange(e) {
1493
+ var inputValue = e.target.value;
1494
+
1495
+ if (!this.$data.isOpen) {
1496
+ this.isOpen = true;
1497
+ }
1498
+
1499
+ var value = this.$props.value;
1500
+
1501
+ if (value === undefined) {
1502
+ this.setValue(inputValue);
1503
+ } else {
1504
+ this.isPending = true;
1505
+ this.$emit('change', inputValue, this.triggerQuery, e);
1506
+ }
1507
+ },
1508
+ onSuggestionSelected: function onSuggestionSelected(suggestion) {
1509
+ var value = this.$props.value; // Record analytics for selected suggestions
1510
+
1511
+ this.triggerClickAnalytics(suggestion._click_id);
1512
+
1513
+ if (value === undefined) {
1514
+ this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT);
1515
+ } else {
1516
+ this.isPending = false;
1517
+ this.$emit('change', suggestion.value, this.triggerQuery);
1518
+ }
1519
+
1520
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1521
+ },
1522
+ onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1523
+ if (currentValue === void 0) {
1524
+ currentValue = this.$data.currentValue;
1525
+ }
1526
+
1527
+ for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1528
+ cause[_key - 1] = arguments[_key];
1529
+ }
1530
+
1531
+ this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1532
+ this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1533
+ },
1534
+ handleStateChange: function handleStateChange(changes) {
1535
+ var isOpen = changes.isOpen;
1536
+ this.isOpen = isOpen;
1537
+ },
1538
+ getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1539
+ var isDark = this.themePreset === 'dark';
1540
+
1541
+ if (isDark) {
1542
+ return highlightedIndex === index ? '#555' : '#424242';
1543
+ }
1544
+
1545
+ return highlightedIndex === index ? '#eee' : '#fff';
1546
+ },
1547
+ renderIcon: function renderIcon() {
1548
+ var h = this.$createElement;
1549
+
1550
+ if (this.$props.showIcon) {
1551
+ return this.$props.icon || h(SearchSvg);
1552
+ }
1553
+
1554
+ return null;
1555
+ },
1556
+ renderErrorComponent: function renderErrorComponent() {
1557
+ var h = this.$createElement;
1558
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1559
+
1560
+ if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1561
+ return h(SuggestionWrapper, {
1562
+ "attrs": {
1563
+ "innerClass": this.$props.innerClass,
1564
+ "innerClassName": "error",
1565
+ "theme": this.theme,
1566
+ "themePreset": this.themePreset
1567
+ }
1568
+ }, [isFunction(renderError) ? renderError(this.error) : renderError]);
1569
+ }
1570
+
1571
+ return null;
1572
+ },
1573
+ renderCancelIcon: function renderCancelIcon() {
1574
+ var h = this.$createElement;
1575
+
1576
+ if (this.$props.showClear) {
1577
+ return this.$props.clearIcon || h(CancelSvg);
1578
+ }
1579
+
1580
+ return null;
1581
+ },
1582
+ renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1583
+ if (finalSuggestionsList === void 0) {
1584
+ finalSuggestionsList = [];
1585
+ }
1586
+
1587
+ var h = this.$createElement;
1588
+ var _this$$props2 = this.$props,
1589
+ theme = _this$$props2.theme,
1590
+ innerClass = _this$$props2.innerClass;
1591
+ var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
1592
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1593
+ var _this$$data = this.$data,
1594
+ isOpen = _this$$data.isOpen,
1595
+ currentValue = _this$$data.currentValue;
1596
+
1597
+ if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1598
+ return h(SuggestionWrapper, {
1599
+ "attrs": {
1600
+ "innerClass": innerClass,
1601
+ "themePreset": this.themePreset,
1602
+ "theme": theme,
1603
+ "innerClassName": "noSuggestion"
1604
+ },
1605
+ "scopedSlots": {
1606
+ "default": function _default() {
1607
+ return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1608
+ }
1609
+ }
1610
+ });
1611
+ }
1612
+
1613
+ return null;
1614
+ },
1615
+ renderInputAddonBefore: function renderInputAddonBefore() {
1616
+ var h = this.$createElement;
1617
+ var addonBefore = this.$scopedSlots.addonBefore;
1618
+
1619
+ if (addonBefore) {
1620
+ return h(InputAddon, [addonBefore()]);
1621
+ }
1622
+
1623
+ return null;
1624
+ },
1625
+ renderInputAddonAfter: function renderInputAddonAfter() {
1626
+ var h = this.$createElement;
1627
+ var addonAfter = this.$scopedSlots.addonAfter;
1628
+
1629
+ if (addonAfter) {
1630
+ return h(InputAddon, [addonAfter()]);
1631
+ }
1632
+
1633
+ return null;
1634
+ },
1635
+ renderIcons: function renderIcons() {
1636
+ var h = this.$createElement;
1637
+ var _this$$props3 = this.$props,
1638
+ iconPosition = _this$$props3.iconPosition,
1639
+ showClear = _this$$props3.showClear,
1640
+ innerClass = _this$$props3.innerClass,
1641
+ getMicInstance = _this$$props3.getMicInstance,
1642
+ showVoiceSearch = _this$$props3.showVoiceSearch,
1643
+ showIcon = _this$$props3.showIcon;
1644
+ var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
1645
+ var currentValue = this.$data.currentValue;
1646
+ return h("div", [h(IconGroup, {
1647
+ "attrs": {
1648
+ "groupPosition": "right",
1649
+ "positionType": "absolute"
1650
+ }
1651
+ }, [currentValue && showClear && h(IconWrapper, {
1652
+ "on": {
1653
+ "click": this.clearValue
1654
+ },
1655
+ "attrs": {
1656
+ "showIcon": showIcon,
1657
+ "isClearIcon": true
1658
+ }
1659
+ }, [this.renderCancelIcon()]), showVoiceSearch && h(Mic, {
1660
+ "attrs": {
1661
+ "getInstance": getMicInstance,
1662
+ "render": renderMic,
1663
+ "handleResult": this.handleVoiceResults,
1664
+ "className": getClassName$1(innerClass, 'mic') || null
1665
+ }
1666
+ }), iconPosition === 'right' && showIcon && h(IconWrapper, {
1667
+ "on": {
1668
+ "click": this.handleSearchIconClick
1669
+ }
1670
+ }, [this.renderIcon()])]), h(IconGroup, {
1671
+ "attrs": {
1672
+ "groupPosition": "left",
1673
+ "positionType": "absolute"
1674
+ }
1675
+ }, [iconPosition === 'left' && showIcon && h(IconWrapper, {
1676
+ "on": {
1677
+ "click": this.handleSearchIconClick
1678
+ }
1679
+ }, [this.renderIcon()])])]);
1680
+ },
1681
+ focusSearchBox: function focusSearchBox(event) {
1682
+ var _this$$refs, _this$$refs$this$$pro;
1683
+
1684
+ var elt = event.target || event.srcElement;
1685
+ var tagName = elt.tagName;
1686
+
1687
+ if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1688
+ // already in an input
1689
+ return;
1690
+ }
1691
+
1692
+ (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
1693
+ },
1694
+ listenForFocusShortcuts: function listenForFocusShortcuts() {
1695
+ var _this2 = this;
1696
+
1697
+ var _this$$props$focusSho = this.$props.focusShortcuts,
1698
+ focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1699
+
1700
+ if (isEmpty(focusShortcuts)) {
1701
+ return;
1702
+ }
1703
+
1704
+ var shortcutsString = parseFocusShortcuts(focusShortcuts).join(','); // handler for alphabets and other key combinations
1705
+
1706
+ hotkeys(shortcutsString, // eslint-disable-next-line no-unused-vars
1707
+
1708
+ /* eslint-disable no-shadow */
1709
+ function (event, handler) {
1710
+ // Prevent the default refresh event under WINDOWS system
1711
+ event.preventDefault();
1712
+
1713
+ _this2.focusSearchBox(event);
1714
+ }); // if one of modifier keys are used, they are handled below
1715
+
1716
+ hotkeys('*', function (event) {
1717
+ var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1718
+ if (modifierKeys.length === 0) return;
1719
+
1720
+ for (var index = 0; index < modifierKeys.length; index += 1) {
1721
+ var element = modifierKeys[index];
1722
+
1723
+ if (hotkeys[element]) {
1724
+ _this2.focusSearchBox(event);
1725
+
1726
+ break;
1727
+ }
1728
+ }
1729
+ });
1730
+ }
1731
+ },
1732
+ render: function render() {
1733
+ var _this3 = this;
1734
+
1735
+ var h = arguments[0];
1736
+ var _this$$props4 = this.$props,
1737
+ theme = _this$$props4.theme,
1738
+ size = _this$$props4.size,
1739
+ expandSuggestionsContainer = _this$$props4.expandSuggestionsContainer,
1740
+ enableDefaultSuggestions = _this$$props4.enableDefaultSuggestions;
1741
+ var _this$$scopedSlots = this.$scopedSlots,
1742
+ recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
1743
+ popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
1744
+ var hasSuggestions = this.currentValue ? this.suggestionsList.length || this.topSuggestions.length : this.defaultSearchSuggestions.length;
1745
+
1746
+ if (enableDefaultSuggestions === false && !this.currentValue) {
1747
+ hasSuggestions = false;
1748
+ }
1749
+
1750
+ return h(Container, {
1751
+ "class": this.$props.className
1752
+ }, [this.$props.title && h(Title, {
1753
+ "class": getClassName$1(this.$props.innerClass, 'title') || ''
1754
+ }, [this.$props.title]), this.$props.defaultSuggestions || this.$props.autosuggest ? h(Downshift, {
1755
+ "attrs": {
1756
+ "id": this.$props.componentId + "-downshift",
1757
+ "handleChange": this.onSuggestionSelected,
1758
+ "handleMouseup": this.handleStateChange,
1759
+ "isOpen": this.$data.isOpen
1760
+ },
1761
+ "scopedSlots": {
1762
+ "default": function _default(_ref3) {
1763
+ var getInputEvents = _ref3.getInputEvents,
1764
+ getInputProps = _ref3.getInputProps,
1765
+ getItemProps = _ref3.getItemProps,
1766
+ getItemEvents = _ref3.getItemEvents,
1767
+ isOpen = _ref3.isOpen,
1768
+ highlightedIndex = _ref3.highlightedIndex,
1769
+ setHighlightedIndex = _ref3.setHighlightedIndex;
1770
+
1771
+ var renderSuggestionsContainer = function renderSuggestionsContainer() {
1772
+ return h("div", [_this3.hasCustomRenderer && _this3.getComponent({
1773
+ isOpen: isOpen,
1774
+ getItemProps: getItemProps,
1775
+ getItemEvents: getItemEvents,
1776
+ highlightedIndex: highlightedIndex
1777
+ }), _this3.renderErrorComponent(), !_this3.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1778
+ "class": suggestions(_this3.themePreset, theme) + " " + getClassName$1(_this3.$props.innerClass, 'list')
1779
+ }, [_this3.suggestionsList.slice(0, size || 10).map(function (item, index) {
1780
+ return h("li", {
1781
+ "domProps": _extends({}, getItemProps({
1782
+ item: item
1783
+ })),
1784
+ "on": _extends({}, getItemEvents({
1785
+ item: item
1786
+ })),
1787
+ "key": index + 1 + "-" + item.value,
1788
+ "style": {
1789
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, index)
1790
+ }
1791
+ }, [h(SuggestionItem, {
1792
+ "attrs": {
1793
+ "currentValue": _this3.currentValue,
1794
+ "suggestion": item
1795
+ }
1796
+ })]);
1797
+ }), _this3.defaultSearchSuggestions.map(function (sugg, index) {
1798
+ return h("li", {
1799
+ "domProps": _extends({}, getItemProps({
1800
+ item: sugg
1801
+ })),
1802
+ "on": _extends({}, getItemEvents({
1803
+ item: sugg
1804
+ })),
1805
+ "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1806
+ "style": {
1807
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1808
+ justifyContent: 'flex-start'
1809
+ }
1810
+ }, [h("div", {
1811
+ "style": {
1812
+ padding: '0 10px 0 0'
1813
+ }
1814
+ }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1815
+ "attrs": {
1816
+ "className": getClassName$1(_this3.$props.innerClass, 'recent-search-icon') || null,
1817
+ "icon": recentSearchesIcon,
1818
+ "type": "recent-search-icon"
1819
+ }
1820
+ }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1821
+ "attrs": {
1822
+ "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1823
+ "icon": popularSearchesIcon,
1824
+ "type": "popular-search-icon"
1825
+ }
1826
+ })]), h(SuggestionItem, {
1827
+ "attrs": {
1828
+ "currentValue": _this3.currentValue,
1829
+ "suggestion": sugg
1830
+ }
1831
+ })]);
1832
+ }), hasQuerySuggestionsRenderer(_this3) ? _this3.getComponent({
1833
+ isOpen: isOpen,
1834
+ getItemProps: getItemProps,
1835
+ getItemEvents: getItemEvents,
1836
+ highlightedIndex: highlightedIndex
1837
+ }, true) : _this3.topSuggestions.map(function (sugg, index) {
1838
+ return h("li", {
1839
+ "domProps": _extends({}, getItemProps({
1840
+ item: sugg
1841
+ })),
1842
+ "on": _extends({}, getItemEvents({
1843
+ item: sugg
1844
+ })),
1845
+ "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1846
+ "style": {
1847
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1848
+ justifyContent: 'flex-start'
1849
+ }
1850
+ }, [h("div", {
1851
+ "style": {
1852
+ padding: '0 10px 0 0'
1853
+ }
1854
+ }, [h(CustomSvg, {
1855
+ "attrs": {
1856
+ "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1857
+ "icon": popularSearchesIcon,
1858
+ "type": "popular-search-icon"
1859
+ }
1860
+ })]), h(SuggestionItem, {
1861
+ "attrs": {
1862
+ "currentValue": _this3.currentValue,
1863
+ "suggestion": sugg
1864
+ }
1865
+ })]);
1866
+ })]) : _this3.renderNoSuggestions(_this3.suggestionsList)]);
1867
+ };
1868
+
1869
+ return h("div", {
1870
+ "class": suggestionsContainer
1871
+ }, [h(InputGroup, [_this3.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1872
+ "attrs": {
1873
+ "id": _this3.$props.componentId + "-input",
1874
+ "showIcon": _this3.$props.showIcon,
1875
+ "showClear": _this3.$props.showClear,
1876
+ "iconPosition": _this3.$props.iconPosition,
1877
+ "placeholder": _this3.$props.placeholder,
1878
+ "autoFocus": _this3.$props.autoFocus,
1879
+ "themePreset": _this3.themePreset,
1880
+ "autocomplete": "off"
1881
+ },
1882
+ "ref": _this3.$props.innerRef,
1883
+ "class": getClassName$1(_this3.$props.innerClass, 'input'),
1884
+ "on": _extends({}, getInputEvents({
1885
+ onInput: _this3.onInputChange,
1886
+ onBlur: function onBlur(e) {
1887
+ _this3.$emit('blur', e, _this3.triggerQuery);
1888
+ },
1889
+ onFocus: _this3.handleFocus,
1890
+ onKeyPress: function onKeyPress(e) {
1891
+ _this3.$emit('keyPress', e, _this3.triggerQuery);
1892
+
1893
+ _this3.$emit('key-press', e, _this3.triggerQuery);
1894
+ },
1895
+ onKeyDown: function onKeyDown(e) {
1896
+ return _this3.handleKeyDown(e, highlightedIndex);
1897
+ },
1898
+ onKeyUp: function onKeyUp(e) {
1899
+ _this3.$emit('keyUp', e, _this3.triggerQuery);
1900
+
1901
+ _this3.$emit('key-up', e, _this3.triggerQuery);
1902
+ },
1903
+ onClick: function onClick() {
1904
+ setHighlightedIndex(null);
1905
+ }
1906
+ })),
1907
+ "domProps": _extends({}, getInputProps({
1908
+ value: _this3.$data.currentValue === null ? '' : _this3.$data.currentValue
1909
+ }))
1910
+ }), _this3.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this3.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer()]);
1911
+ }
1912
+ }
1913
+ }) : h("div", {
1914
+ "class": suggestionsContainer
1915
+ }, [h(InputGroup, [this.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1916
+ "class": getClassName$1(this.$props.innerClass, 'input') || '',
1917
+ "attrs": {
1918
+ "placeholder": this.$props.placeholder,
1919
+ "iconPosition": this.$props.iconPosition,
1920
+ "showIcon": this.$props.showIcon,
1921
+ "showClear": this.$props.showClear,
1922
+ "themePreset": this.themePreset
1923
+ },
1924
+ "on": _extends({}, {
1925
+ blur: function blur(e) {
1926
+ _this3.$emit('blur', e, _this3.triggerQuery);
1927
+ },
1928
+ keypress: function keypress(e) {
1929
+ _this3.$emit('keyPress', e, _this3.triggerQuery);
1930
+
1931
+ _this3.$emit('key-press', e, _this3.triggerQuery);
1932
+ },
1933
+ input: this.onInputChange,
1934
+ focus: function focus(e) {
1935
+ _this3.$emit('focus', e, _this3.triggerQuery);
1936
+ },
1937
+ keydown: function keydown(e) {
1938
+ _this3.$emit('keyDown', e, _this3.triggerQuery);
1939
+
1940
+ _this3.$emit('key-down', e, _this3.triggerQuery);
1941
+ },
1942
+ keyup: function keyup(e) {
1943
+ _this3.$emit('keyUp', e, _this3.triggerQuery);
1944
+
1945
+ _this3.$emit('key-up', e, _this3.triggerQuery);
1946
+ }
1947
+ }),
1948
+ "domProps": _extends({}, {
1949
+ autofocus: this.$props.autoFocus,
1950
+ value: this.$data.currentValue ? this.$data.currentValue : ''
1951
+ }),
1952
+ "ref": this.$props.innerRef
1953
+ }), this.renderIcons()]), this.renderInputAddonAfter()])])]);
1954
+ },
1955
+ destroyed: function destroyed() {
1956
+ document.removeEventListener('keydown', this.onKeyDown);
1957
+ }
1958
+ };
1959
+
1960
+ DataSearch.defaultQuery = function (value, props) {
1961
+ var finalQuery = null;
1962
+
1963
+ if (value) {
1964
+ var fields = normalizeDataField(props.dataField, props.fieldWeights);
1965
+ finalQuery = {
1966
+ bool: {
1967
+ should: DataSearch.shouldQuery(value, fields, props),
1968
+ minimum_should_match: '1'
1969
+ }
1970
+ };
1971
+ }
1972
+
1973
+ if (value === '') {
1974
+ finalQuery = null;
1975
+ }
1976
+
1977
+ if (finalQuery && props.nestedField) {
1978
+ return {
1979
+ query: {
1980
+ nested: {
1981
+ path: props.nestedField,
1982
+ query: finalQuery
1983
+ }
1984
+ }
1985
+ };
1986
+ }
1987
+
1988
+ return finalQuery;
1989
+ };
1990
+
1991
+ DataSearch.shouldQuery = function (value, dataFields, props) {
1992
+ var finalQuery = [];
1993
+ var phrasePrefixFields = [];
1994
+ var fields = dataFields.map(function (dataField) {
1995
+ var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
1996
+
1997
+ if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
1998
+ phrasePrefixFields.push(queryField);
1999
+ }
2000
+
2001
+ return queryField;
2002
+ });
2003
+
2004
+ if (props.searchOperators || props.queryString) {
2005
+ return {
2006
+ query: value,
2007
+ fields: fields,
2008
+ default_operator: props.queryFormat
2009
+ };
2010
+ }
2011
+
2012
+ if (props.queryFormat === 'and') {
2013
+ finalQuery.push({
2014
+ multi_match: {
2015
+ query: value,
2016
+ fields: fields,
2017
+ type: 'cross_fields',
2018
+ operator: 'and'
2019
+ }
2020
+ });
2021
+ finalQuery.push({
2022
+ multi_match: {
2023
+ query: value,
2024
+ fields: fields,
2025
+ type: 'phrase',
2026
+ operator: 'and'
2027
+ }
2028
+ });
2029
+
2030
+ if (phrasePrefixFields.length > 0) {
2031
+ finalQuery.push({
2032
+ multi_match: {
2033
+ query: value,
2034
+ fields: phrasePrefixFields,
2035
+ type: 'phrase_prefix',
2036
+ operator: 'and'
2037
+ }
2038
+ });
2039
+ }
2040
+
2041
+ return finalQuery;
2042
+ }
2043
+
2044
+ finalQuery.push({
2045
+ multi_match: {
2046
+ query: value,
2047
+ fields: fields,
2048
+ type: 'best_fields',
2049
+ operator: 'or',
2050
+ fuzziness: props.fuzziness ? props.fuzziness : 0
2051
+ }
2052
+ });
2053
+ finalQuery.push({
2054
+ multi_match: {
2055
+ query: value,
2056
+ fields: fields,
2057
+ type: 'phrase',
2058
+ operator: 'or'
2059
+ }
2060
+ });
2061
+
2062
+ if (phrasePrefixFields.length > 0) {
2063
+ finalQuery.push({
2064
+ multi_match: {
2065
+ query: value,
2066
+ fields: phrasePrefixFields,
2067
+ type: 'phrase_prefix',
2068
+ operator: 'or'
2069
+ }
2070
+ });
2071
+ }
2072
+
2073
+ return finalQuery;
2074
+ };
2075
+
2076
+ DataSearch.highlightQuery = function (props) {
2077
+ if (props.customHighlight) {
2078
+ return props.customHighlight(props);
2079
+ }
2080
+
2081
+ if (!props.highlight) {
2082
+ return null;
2083
+ }
2084
+
2085
+ var fields = {};
2086
+ var highlightField = props.highlightField ? props.highlightField : props.dataField;
2087
+
2088
+ if (typeof highlightField === 'string') {
2089
+ fields[highlightField] = {};
2090
+ } else if (Array.isArray(highlightField)) {
2091
+ highlightField.forEach(function (item) {
2092
+ fields[item] = {};
2093
+ });
2094
+ }
2095
+
2096
+ return {
2097
+ highlight: _extends({
2098
+ pre_tags: ['<mark>'],
2099
+ post_tags: ['</mark>'],
2100
+ fields: fields
2101
+ }, props.highlightField && {
2102
+ require_field_match: false
2103
+ })
2104
+ };
2105
+ };
2106
+
2107
+ DataSearch.hasInternalComponent = function () {
2108
+ return true;
2109
+ };
2110
+
2111
+ var mapStateToProps = function mapStateToProps(state, props) {
2112
+ return {
2113
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2114
+ suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
2115
+ rawData: state.rawData[props.componentId],
2116
+ aggregationData: state.compositeAggregations[props.componentId] || [],
2117
+ isLoading: !!state.isLoading[props.componentId + "_active"],
2118
+ themePreset: state.config.themePreset,
2119
+ error: state.error[props.componentId],
2120
+ analytics: state.analytics,
2121
+ enableAppbase: state.config.enableAppbase,
2122
+ headers: state.appbaseRef.headers,
2123
+ promotedResults: state.promotedResults[props.componentId] || [],
2124
+ customData: state.customData[props.componentId],
2125
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
2126
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
2127
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2128
+ popularSuggestions: state.querySuggestions[props.componentId],
2129
+ defaultPopularSuggestions: state.defaultPopularSuggestions[props.componentId],
2130
+ componentProps: state.props[props.componentId],
2131
+ lastUsedQuery: state.queryToHits[props.componentId],
2132
+ recentSearches: state.recentSearches.data
2133
+ };
2134
+ };
2135
+
2136
+ var mapDispatchToProps = {
2137
+ setQueryOptions: setQueryOptions,
2138
+ updateQuery: updateQuery,
2139
+ setCustomQuery: setCustomQuery,
2140
+ setDefaultQuery: setDefaultQuery,
2141
+ setCustomHighlightOptions: setCustomHighlightOptions,
2142
+ recordSuggestionClick: recordSuggestionClick,
2143
+ loadPopularSuggestions: loadPopularSuggestions,
2144
+ getRecentSearches: getRecentSearches
2145
+ };
2146
+ var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2147
+ componentType: componentTypes.dataSearch,
2148
+ internalComponent: DataSearch.hasInternalComponent()
2149
+ });
2150
+
2151
+ DataSearch.install = function (Vue) {
2152
+ Vue.component(DataSearch.name, DSConnected);
2153
+ }; // Add componentType for SSR
2154
+
2155
+
2156
+ DataSearch.componentType = componentTypes.dataSearch;
2157
+
2158
+ export { CustomSvg as C, DataSearch as D, InputAddon as I, Mic as M, SearchSvg as S, SuggestionWrapper as a, InputGroup as b, SuggestionItem as c };