@appbaseio/reactivesearch-vue 3.0.0-rc.5.alpha.4 → 3.0.0-rc.6

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 (67) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +39803 -35283
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +32 -32
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-d4da7470.js → Button-9e179864.js} +13 -6
  6. package/dist/cjs/{ComponentWrapper-9146d811.js → ComponentWrapper-0b9ffb1a.js} +3 -0
  7. package/dist/cjs/DropDown-aef75c14.js +702 -0
  8. package/dist/cjs/DynamicRangeSlider.js +1 -1
  9. package/dist/cjs/{Input-497be42a.js → Input-56eba499.js} +71 -1
  10. package/dist/cjs/MultiDropdownList.js +6 -6
  11. package/dist/cjs/MultiList.js +3 -3
  12. package/dist/cjs/MultiRange.js +2 -2
  13. package/dist/cjs/{Pagination-b953a80a.js → Pagination-58a0cf3f.js} +2 -2
  14. package/dist/cjs/RangeInput.js +3 -3
  15. package/dist/cjs/RangeSlider.js +2 -2
  16. package/dist/cjs/ReactiveBase.js +4 -4
  17. package/dist/cjs/ReactiveComponent.js +2 -2
  18. package/dist/cjs/ReactiveGoogleMap.js +6 -5
  19. package/dist/cjs/ReactiveList.js +4 -4
  20. package/dist/cjs/ResultCard.js +1 -1
  21. package/dist/cjs/ResultList.js +1 -1
  22. package/dist/cjs/SelectedFilters.js +3 -2
  23. package/dist/cjs/SingleDropdownList.js +6 -6
  24. package/dist/cjs/SingleList.js +3 -3
  25. package/dist/cjs/SingleRange.js +2 -2
  26. package/dist/cjs/ToggleButton.js +4 -3
  27. package/dist/cjs/index.js +14 -13
  28. package/dist/cjs/install-70991c13.js +3820 -0
  29. package/dist/cjs/install.js +9 -9
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-a5f1745e.js} +18 -0
  32. package/dist/es/{Button-fd869491.js → Button-c2ff5178.js} +13 -6
  33. package/dist/es/{ComponentWrapper-8a3c388d.js → ComponentWrapper-a2635cfc.js} +3 -0
  34. package/dist/es/DropDown-39fedff8.js +693 -0
  35. package/dist/es/DynamicRangeSlider.js +1 -1
  36. package/dist/es/{Input-f7499ef8.js → Input-11d211d2.js} +71 -2
  37. package/dist/es/MultiDropdownList.js +6 -6
  38. package/dist/es/MultiList.js +3 -3
  39. package/dist/es/MultiRange.js +2 -2
  40. package/dist/es/{Pagination-c2745bec.js → Pagination-ae401c33.js} +2 -2
  41. package/dist/es/RangeInput.js +3 -3
  42. package/dist/es/RangeSlider.js +2 -2
  43. package/dist/es/ReactiveBase.js +4 -4
  44. package/dist/es/ReactiveComponent.js +2 -2
  45. package/dist/es/ReactiveGoogleMap.js +6 -5
  46. package/dist/es/ReactiveList.js +4 -4
  47. package/dist/es/ResultCard.js +1 -1
  48. package/dist/es/ResultList.js +1 -1
  49. package/dist/es/SelectedFilters.js +3 -2
  50. package/dist/es/SingleDropdownList.js +6 -6
  51. package/dist/es/SingleList.js +3 -3
  52. package/dist/es/SingleRange.js +2 -2
  53. package/dist/es/ToggleButton.js +4 -3
  54. package/dist/es/index.js +11 -11
  55. package/dist/es/install-8296e8da.js +3812 -0
  56. package/dist/es/install.js +9 -9
  57. package/dist/es/version.js +1 -1
  58. package/dist/es/{vueTypes-f1923c72.js → vueTypes-09cab4d3.js} +18 -0
  59. package/package.json +7 -5
  60. package/dist/cjs/CancelSvg-ab0f8b23.js +0 -409
  61. package/dist/cjs/DropDown-e7125b72.js +0 -299
  62. package/dist/cjs/SearchBox.js +0 -1853
  63. package/dist/cjs/install-3c4520bf.js +0 -874
  64. package/dist/es/CancelSvg-e7ae49e9.js +0 -401
  65. package/dist/es/DropDown-13afb4d2.js +0 -295
  66. package/dist/es/SearchBox.js +0 -1847
  67. package/dist/es/install-ff8b0750.js +0 -868
@@ -0,0 +1,3812 @@
1
+ import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
+ import { SEARCH_COMPONENTS_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
+ import _transformOn from '@vue/babel-helper-vue-transform-on';
4
+ import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
+ import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
+ import VueTypes from 'vue-types';
7
+ import { getQueryOptions, getObjectFromLocalStorage, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
+ import { styled, createGlobalStyle } from '@appbaseio/vue-emotion';
9
+ import { css, keyframes } from '@emotion/css';
10
+ import { lighten } from 'polished';
11
+ import { B as Button } from './Button-c2ff5178.js';
12
+ import { t as types } from './vueTypes-09cab4d3.js';
13
+ import { RLConnected as ReactiveList } from './ReactiveList.js';
14
+ import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
15
+ import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-882489e1.js';
16
+ import { C as ComponentWrapper } from './ComponentWrapper-a2635cfc.js';
17
+ import { P as PreferencesConsumer } from './PreferencesConsumer-b058d14e.js';
18
+ import { T as Title } from './Title-863dfa42.js';
19
+ import { L as ListItem } from './ListItem-e3c6acf4.js';
20
+ import { F as Flex } from './Flex-25792bc3.js';
21
+ import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
22
+ import ReactiveBase from './ReactiveBase.js';
23
+ import hotkeys from 'hotkeys-js';
24
+ import { Remarkable } from 'remarkable';
25
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-39fedff8.js';
26
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
27
+ import { C as Container } from './Container-d00219f7.js';
28
+ import Highlight from 'vue-highlight-words';
29
+ import { fetchAIResponse } from '@appbaseio/reactivecore/lib/actions/query';
30
+ import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
31
+ import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
32
+ import { s as sanitizeObject } from './utils-d7dd4f4e.js';
33
+ import { ListConnected as SingleList } from './SingleList.js';
34
+ import { ListConnected as MultiList } from './MultiList.js';
35
+ import types$1 from '@appbaseio/reactivecore/lib/utils/types';
36
+ import { ListConnected as SingleDropdownList } from './SingleDropdownList.js';
37
+ import { ListConnected as MultiDropdownList } from './MultiDropdownList.js';
38
+ import { TBConnected as ToggleButton } from './ToggleButton.js';
39
+ import ReactiveComponent from './ReactiveComponent.js';
40
+ import { RangeConnected as DynamicRangeSlider } from './DynamicRangeSlider.js';
41
+ import { RangeConnected as SingleRange } from './SingleRange.js';
42
+ import { RangeConnected as MultiRange } from './MultiRange.js';
43
+ import { RangeConnected as RangeSlider } from './RangeSlider.js';
44
+ import { RangeConnected as RangeInput } from './RangeInput.js';
45
+ import SelectedFilters from './SelectedFilters.js';
46
+ import ResultCard from './ResultCard.js';
47
+ import ResultList from './ResultList.js';
48
+ import StateProvider from './StateProvider.js';
49
+
50
+ var _templateObject;
51
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
52
+ InputGroup.defaultProps = {
53
+ className: 'input-group'
54
+ };
55
+
56
+ var _templateObject$1;
57
+ 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"])));
58
+ InputAddon.defaultProps = {
59
+ className: 'input-addon'
60
+ };
61
+
62
+ var getClassName = helper.getClassName;
63
+ var SuggestionWrapper = {
64
+ name: 'SuggestionWrapper',
65
+ props: {
66
+ innerClassName: types.string,
67
+ themePreset: types.themePreset,
68
+ innerClass: types.style
69
+ },
70
+ render: function render() {
71
+ var _this$$props = this.$props,
72
+ themePreset = _this$$props.themePreset,
73
+ innerClass = _this$$props.innerClass,
74
+ innerClassName = _this$$props.innerClassName;
75
+ return createVNode("div", {
76
+ "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
77
+ }, [createVNode("li", null, [this.$slots["default"]()])]);
78
+ }
79
+ };
80
+
81
+ var _templateObject$2;
82
+ var highlightStyle = {
83
+ fontWeight: 600,
84
+ padding: 0,
85
+ backgroundColor: 'transparent',
86
+ color: 'inherit'
87
+ };
88
+ 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"])));
89
+ var SuggestionItem = {
90
+ name: 'SuggestionItem',
91
+ props: {
92
+ currentValue: types.string,
93
+ suggestion: types.any
94
+ },
95
+ render: function render() {
96
+ var _this = this;
97
+ var _this$suggestion = this.suggestion,
98
+ label = _this$suggestion.label,
99
+ value = _this$suggestion.value,
100
+ title = _this$suggestion.title,
101
+ description = _this$suggestion.description,
102
+ image = _this$suggestion.image,
103
+ isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
104
+ _suggestion_type = _this$suggestion._suggestion_type,
105
+ _category = _this$suggestion._category;
106
+ if (label) {
107
+ // label has highest precedence
108
+ return typeof label === 'string' ? createVNode("div", {
109
+ "class": "trim"
110
+ }, [(_category ? false : isPredictiveSuggestion
111
+ // eslint-disable-next-line
112
+ || !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
113
+ "innerHTML": label
114
+ }, null) : createVNode(Highlight, {
115
+ "searchWords": _category ? [_category] : this.currentValue.split(' '),
116
+ "textToHighlight": label,
117
+ "autoEscape": true,
118
+ "highlightStyle": highlightStyle
119
+ }, null)]) : label;
120
+ }
121
+ if (title || image || description) {
122
+ return createVNode(Flex, {
123
+ "alignItems": "center",
124
+ "css": {
125
+ width: '100%'
126
+ }
127
+ }, {
128
+ "default": function _default() {
129
+ return [image && createVNode("div", {
130
+ "css": {
131
+ margin: 'auto',
132
+ marginRight: 10
133
+ }
134
+ }, [createVNode("img", {
135
+ "src": image,
136
+ "alt": " ",
137
+ "height": "50px",
138
+ "width": "50px",
139
+ "css": {
140
+ objectFit: 'contain'
141
+ }
142
+ }, null)]), createVNode(Flex, {
143
+ "direction": "column",
144
+ "css": {
145
+ width: image ? 'calc(100% - 60px)' : '100%'
146
+ }
147
+ }, {
148
+ "default": function _default() {
149
+ return [title && createVNode("div", {
150
+ "class": "trim"
151
+ }, [createVNode(Highlight, {
152
+ "searchWords": _this.currentValue.split(' '),
153
+ "textToHighlight": title,
154
+ "highlightStyle": highlightStyle,
155
+ "class": css({
156
+ fontSize: '1rem'
157
+ })
158
+ }, null)]), description && createVNode("div", {
159
+ "class": ['trim', css({
160
+ marginTop: 3
161
+ })]
162
+ }, [createVNode(Highlight, {
163
+ "searchWords": _this.currentValue.split(' '),
164
+ "textToHighlight": description,
165
+ "highlightStyle": highlightStyle
166
+ }, null)])];
167
+ }
168
+ })];
169
+ }
170
+ });
171
+ }
172
+ return value;
173
+ }
174
+ };
175
+
176
+ var SearchSvg = {
177
+ name: 'SearchSvg',
178
+ props: ['styles'],
179
+ render: function render() {
180
+ return createVNode("svg", {
181
+ "alt": "Search",
182
+ "class": "search-icon",
183
+ "height": "12",
184
+ "xmlns": "http://www.w3.org/2000/svg",
185
+ "viewBox": "0 0 15 15",
186
+ "style": _extends({
187
+ transform: 'scale(1.35)',
188
+ position: 'relative'
189
+ }, this.$props.styles ? this.$props.styles : {})
190
+ }, [createVNode("title", null, [createTextVNode("Search")]), createVNode("path", {
191
+ "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'
192
+ }, null)]);
193
+ }
194
+ };
195
+
196
+ var _templateObject$3;
197
+
198
+ // eslint-disable-next-line
199
+ createGlobalStyle(_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"])));
200
+ var MicSvg = {
201
+ name: 'MicSvg',
202
+ props: ['className'],
203
+ render: function render() {
204
+ return createVNode("svg", {
205
+ "viewBox": "0 0 480 480",
206
+ "xmlns": "http://www.w3.org/2000/svg",
207
+ "id": "el_xS0FRzQjJ",
208
+ "width": 28,
209
+ "height": 28,
210
+ "className": this.$props.className,
211
+ "style": {
212
+ transform: 'scale(1.5)'
213
+ }
214
+ }, [createVNode("g", {
215
+ "id": "el_TvxDfTAtKp",
216
+ "fillRule": "evenodd"
217
+ }, [createVNode("g", {
218
+ "id": "el_D93PK3GbmJ",
219
+ "fillRule": "nonzero",
220
+ "style": {
221
+ fill: '#595959'
222
+ }
223
+ }, [createVNode("path", {
224
+ "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",
225
+ "id": "el_uly3EwA2O3"
226
+ }, null), createVNode("path", {
227
+ "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",
228
+ "id": "el_tnDbR4ytu4"
229
+ }, null)])])]);
230
+ }
231
+ };
232
+
233
+ var _templateObject$4;
234
+
235
+ // eslint-disable-next-line
236
+ createGlobalStyle(_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"])));
237
+ var MuteSvg = {
238
+ name: 'MuteSvg',
239
+ props: ['className'],
240
+ render: function render() {
241
+ return createVNode("svg", {
242
+ "style": {
243
+ transform: 'scale(1.5)'
244
+ },
245
+ "viewBox": "0 0 480 480",
246
+ "xmlns": "http://www.w3.org/2000/svg",
247
+ "id": "el_D1rEpH2zj",
248
+ "width": 28,
249
+ "height": 28,
250
+ "className": this.$props.className
251
+ }, [createVNode("g", {
252
+ "id": "el_X81iT9kZYo",
253
+ "fillRule": "evenodd"
254
+ }, [createVNode("g", {
255
+ "id": "el_gMpyalCphp"
256
+ }, [createVNode("path", {
257
+ "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",
258
+ "id": "el_c7H-3u-D4l",
259
+ "fillRule": "nonzero",
260
+ "style": {
261
+ fill: '#595959'
262
+ }
263
+ }, null), createVNode("path", {
264
+ "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",
265
+ "id": "el_qhFcdAAFwo",
266
+ "fillRule": "nonzero",
267
+ "style": {
268
+ fill: '#595959'
269
+ }
270
+ }, null), createVNode("path", {
271
+ "d": "M11.5,206.5 L142.5,12.5",
272
+ "id": "el_M8X8g37WOI",
273
+ "strokeLinecap": "round",
274
+ "strokeLinejoin": "round"
275
+ }, null)])])]);
276
+ }
277
+ };
278
+
279
+ var _templateObject$5;
280
+
281
+ // eslint-disable-next-line
282
+ createGlobalStyle(_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"])));
283
+ var ListenSvg = {
284
+ name: 'ListenSvg',
285
+ props: ['className'],
286
+ render: function render() {
287
+ return createVNode("svg", {
288
+ "viewBox": "0 0 480 480",
289
+ "xmlns": "http://www.w3.org/2000/svg",
290
+ "xmlnsXlink": "http://www.w3.org/1999/xlink",
291
+ "id": "el_hiibMG0x-",
292
+ "width": 28,
293
+ "height": 29,
294
+ "className": this.$props.className,
295
+ "style": {
296
+ transform: 'scale(1.5)'
297
+ }
298
+ }, [createVNode("defs", null, [createVNode("path", {
299
+ "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",
300
+ "id": "path-1"
301
+ }, null), createVNode("path", {
302
+ "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",
303
+ "id": "path-3"
304
+ }, null), createVNode("path", {
305
+ "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",
306
+ "id": "path-5"
307
+ }, null), createVNode("path", {
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-7"
310
+ }, null), createVNode("path", {
311
+ "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",
312
+ "id": "path-9"
313
+ }, null), createVNode("path", {
314
+ "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",
315
+ "id": "path-11"
316
+ }, null), createVNode("path", {
317
+ "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",
318
+ "id": "path-13"
319
+ }, null), createVNode("path", {
320
+ "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",
321
+ "id": "path-15"
322
+ }, null)]), createVNode("g", {
323
+ "id": "el_QJeJ_2CDw5",
324
+ "fillRule": "evenodd"
325
+ }, [createVNode("g", {
326
+ "id": "el_UYYCfubTRf"
327
+ }, [createVNode("path", {
328
+ "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",
329
+ "id": "el_uzZNtK32Zi",
330
+ "fillRule": "nonzero",
331
+ "style": {
332
+ fill: '#0B6AFF'
333
+ }
334
+ }, null), createVNode("path", {
335
+ "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",
336
+ "id": "el_EYKQ2N9Kgy",
337
+ "fillRule": "nonzero"
338
+ }, null), createVNode("g", {
339
+ "id": "el_6SDP2LAgKC"
340
+ }, [createVNode("mask", {
341
+ "id": "mask-2",
342
+ "fill": "#fff"
343
+ }, [createVNode("use", {
344
+ "xlink:href": "#path-1"
345
+ }, null)]), createVNode("path", {
346
+ "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",
347
+ "id": "el_-Vm65Ltfy7",
348
+ "fillRule": "nonzero",
349
+ "mask": "url(#mask-2)"
350
+ }, null), createVNode("rect", {
351
+ "id": "el_q04iZcSim4",
352
+ "mask": "url(#mask-2)",
353
+ "x": "0.279",
354
+ "width": "77",
355
+ "height": "130"
356
+ }, null)]), createVNode("g", {
357
+ "id": "el_6WKby7wXqV"
358
+ }, [createVNode("mask", {
359
+ "id": "mask-4",
360
+ "fill": "#fff"
361
+ }, [createVNode("use", {
362
+ "xlink:href": "#path-3"
363
+ }, null)]), createVNode("path", {
364
+ "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",
365
+ "id": "el_9bggsfQOtU",
366
+ "fillRule": "nonzero",
367
+ "mask": "url(#mask-4)"
368
+ }, null), createVNode("rect", {
369
+ "id": "el_NKxqi9eIym",
370
+ "mask": "url(#mask-4)",
371
+ "x": "0.279",
372
+ "width": "77",
373
+ "height": "115"
374
+ }, null)]), createVNode("g", {
375
+ "id": "el_Wi-my975tM"
376
+ }, [createVNode("mask", {
377
+ "id": "mask-6",
378
+ "fill": "#fff"
379
+ }, [createVNode("use", {
380
+ "xlink:href": "#path-5"
381
+ }, null)]), createVNode("path", {
382
+ "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",
383
+ "id": "el_zclQ34fvf7",
384
+ "fillRule": "nonzero",
385
+ "mask": "url(#mask-6)"
386
+ }, null), createVNode("rect", {
387
+ "id": "el_1OsvRT8HkeZ",
388
+ "mask": "url(#mask-6)",
389
+ "x": "0.279",
390
+ "width": "77",
391
+ "height": "100"
392
+ }, null)]), createVNode("g", {
393
+ "id": "el_DkfFFTaFxy8"
394
+ }, [createVNode("mask", {
395
+ "id": "mask-8",
396
+ "fill": "#fff"
397
+ }, [createVNode("use", {
398
+ "xlink:href": "#path-7"
399
+ }, null)]), createVNode("path", {
400
+ "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",
401
+ "id": "el_aa9sjx4H0vA",
402
+ "fillRule": "nonzero",
403
+ "mask": "url(#mask-8)"
404
+ }, null), createVNode("rect", {
405
+ "id": "el_tea114vWg0J",
406
+ "mask": "url(#mask-8)",
407
+ "x": "0.279",
408
+ "width": "77",
409
+ "height": "85"
410
+ }, null)]), createVNode("g", {
411
+ "id": "el_34IgwiMB5rf"
412
+ }, [createVNode("mask", {
413
+ "id": "mask-10",
414
+ "fill": "#fff"
415
+ }, [createVNode("use", {
416
+ "xlink:href": "#path-9"
417
+ }, null)]), createVNode("path", {
418
+ "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",
419
+ "id": "el_z5u6RAFhx7d",
420
+ "fillRule": "nonzero",
421
+ "mask": "url(#mask-10)"
422
+ }, null), createVNode("rect", {
423
+ "id": "el_7nfuWmA5Uhy",
424
+ "mask": "url(#mask-10)",
425
+ "x": "0.279",
426
+ "width": "77",
427
+ "height": "70"
428
+ }, null)]), createVNode("g", {
429
+ "id": "el_DeebuCsPTGA"
430
+ }, [createVNode("mask", {
431
+ "id": "mask-12",
432
+ "fill": "#fff"
433
+ }, [createVNode("use", {
434
+ "xlink:href": "#path-11"
435
+ }, null)]), createVNode("path", {
436
+ "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",
437
+ "id": "el__ZcqlS20zcw",
438
+ "fillRule": "nonzero",
439
+ "mask": "url(#mask-12)"
440
+ }, null), createVNode("rect", {
441
+ "id": "el_8DnEQnD7VWV",
442
+ "mask": "url(#mask-12)",
443
+ "x": "0.279",
444
+ "width": "77",
445
+ "height": "55"
446
+ }, null)]), createVNode("g", {
447
+ "id": "el_ZOjjrPTvyrv"
448
+ }, [createVNode("mask", {
449
+ "id": "mask-14",
450
+ "fill": "#fff"
451
+ }, [createVNode("use", {
452
+ "xlink:href": "#path-13"
453
+ }, null)]), createVNode("path", {
454
+ "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",
455
+ "id": "el_FYYKCI_u24e",
456
+ "fillRule": "nonzero",
457
+ "mask": "url(#mask-14)"
458
+ }, null), createVNode("rect", {
459
+ "id": "el_XZty4MnTp5Y",
460
+ "mask": "url(#mask-14)",
461
+ "x": "0.279",
462
+ "width": "77",
463
+ "height": "40"
464
+ }, null)]), createVNode("g", {
465
+ "id": "el_2FATegVmf0K"
466
+ }, [createVNode("mask", {
467
+ "id": "mask-16",
468
+ "fill": "#fff"
469
+ }, [createVNode("use", {
470
+ "xlink:href": "#path-15"
471
+ }, null)]), createVNode("path", {
472
+ "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",
473
+ "id": "el_RMT1KUfbdF8",
474
+ "fillRule": "nonzero",
475
+ "mask": "url(#mask-16)"
476
+ }, null), createVNode("rect", {
477
+ "id": "el_RgLcovvFiO1",
478
+ "mask": "url(#mask-16)",
479
+ "x": "0.279",
480
+ "width": "77",
481
+ "height": "25"
482
+ }, null)])])])]);
483
+ }
484
+ };
485
+
486
+ var STATUS = {
487
+ inactive: 'INACTIVE',
488
+ stopped: 'STOPPED',
489
+ active: 'ACTIVE',
490
+ denied: 'DENIED'
491
+ };
492
+ var Mic = {
493
+ name: 'Mic',
494
+ props: {
495
+ children: types.title,
496
+ lang: VueTypes.string.def('en-US'),
497
+ iconPosition: VueTypes.string.def('left'),
498
+ handleResult: types.func,
499
+ onNoMatch: types.func,
500
+ onError: types.func,
501
+ getInstance: types.func,
502
+ render: types.func,
503
+ className: types.string,
504
+ applyClearStyle: VueTypes.bool,
505
+ showIcon: VueTypes.bool
506
+ },
507
+ methods: {
508
+ getComponent: function getComponent$1() {
509
+ var status = this.$data.status;
510
+ var data = {
511
+ handleClick: this.handleClick,
512
+ status: status
513
+ };
514
+ return getComponent(data, this);
515
+ },
516
+ stopMic: function stopMic() {
517
+ if (this.instance) {
518
+ this.status = STATUS.inactive;
519
+ this.instance.stop();
520
+ this.instance = null;
521
+ }
522
+ },
523
+ handleClick: function handleClick() {
524
+ var _this = this;
525
+ this.results = [];
526
+ if (window && window.SpeechRecognition) {
527
+ var status = this.$data.status;
528
+ if (status === STATUS.active) {
529
+ this.status = STATUS.inactive;
530
+ }
531
+ var _this$$props = this.$props,
532
+ handleResult = _this$$props.handleResult,
533
+ onNoMatch = _this$$props.onNoMatch,
534
+ onError = _this$$props.onError,
535
+ lang = _this$$props.lang,
536
+ getInstance = _this$$props.getInstance;
537
+ var _window = window,
538
+ SpeechRecognition = _window.SpeechRecognition;
539
+ if (this.instance && this.status !== STATUS.denied) {
540
+ this.status = STATUS.inactive;
541
+ this.instance.stop();
542
+ this.instance = null;
543
+ return;
544
+ }
545
+ this.instance = new SpeechRecognition();
546
+ this.instance.continuous = true;
547
+ this.instance.interimResults = true;
548
+ this.instance.lang = lang;
549
+ if (getInstance) {
550
+ getInstance(this.instance);
551
+ }
552
+ this.instance.start();
553
+ this.instance.onstart = function () {
554
+ _this.status = STATUS.active;
555
+ };
556
+ this.instance.onresult = function (_ref) {
557
+ var results = _ref.results,
558
+ timeStamp = _ref.timeStamp;
559
+ _this.stopMic();
560
+ if (handleResult) {
561
+ handleResult({
562
+ results: results,
563
+ timeStamp: timeStamp
564
+ });
565
+ }
566
+ _this.results.push({
567
+ results: results,
568
+ timeStamp: timeStamp
569
+ });
570
+ };
571
+ this.instance.onnomatch = function (e) {
572
+ return onNoMatch ? onNoMatch(e) : console.warn(e);
573
+ };
574
+ this.instance.onerror = function (e) {
575
+ if (e.error === 'no-speech' || e.error === 'audio-capture') {
576
+ _this.status = STATUS.inactive;
577
+ } else if (e.error === 'not-allowed') {
578
+ _this.status = STATUS.denied;
579
+ }
580
+ console.error(e);
581
+ if (onError) {
582
+ onError(e);
583
+ }
584
+ };
585
+
586
+ /* Below Two methods run when Continuous is False */
587
+ this.instance.onspeechend = function () {
588
+ _this.status = STATUS.inactive;
589
+ };
590
+ this.instance.onaudioend = function () {
591
+ _this.status = STATUS.inactive;
592
+ };
593
+ }
594
+ }
595
+ },
596
+ computed: {
597
+ hasCustomRenderer: function hasCustomRenderer$1() {
598
+ return hasCustomRenderer(this);
599
+ },
600
+ Icon: function Icon() {
601
+ var status = this.$data.status;
602
+ var className = this.$props.className;
603
+ switch (status) {
604
+ case STATUS.active:
605
+ return createVNode(ListenSvg, {
606
+ "className": className,
607
+ "nativeOnClick": this.handleClick
608
+ }, null);
609
+ case STATUS.stopped:
610
+ case STATUS.denied:
611
+ return createVNode(MuteSvg, {
612
+ "className": className,
613
+ "nativeOnClick": this.handleClick
614
+ }, null);
615
+ default:
616
+ return createVNode(MicSvg, {
617
+ "className": className,
618
+ "nativeOnClick": this.handleClick
619
+ }, null);
620
+ }
621
+ }
622
+ },
623
+ data: function data() {
624
+ return {
625
+ status: STATUS.inactive
626
+ };
627
+ },
628
+ created: function created() {
629
+ this.results = [];
630
+ if (typeof window !== 'undefined') {
631
+ window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
632
+ if (!window.SpeechRecognition) {
633
+ 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.');
634
+ }
635
+ }
636
+ },
637
+ render: function render() {
638
+ var _this2 = this;
639
+ if (this.hasCustomRenderer) {
640
+ return this.getComponent();
641
+ }
642
+ return createVNode(IconWrapper, null, {
643
+ "default": function _default() {
644
+ return [_this2.Icon];
645
+ }
646
+ });
647
+ }
648
+ };
649
+
650
+ var CustomSvg = {
651
+ name: 'CustomSvg',
652
+ props: {
653
+ className: String,
654
+ icon: Function,
655
+ type: String
656
+ },
657
+ data: function data() {
658
+ return {
659
+ customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
660
+ };
661
+ },
662
+ render: function render() {
663
+ if (this.customIcon) {
664
+ return createVNode("div", {
665
+ "class": this.$props.className
666
+ }, [this.customIcon]);
667
+ }
668
+ if (this.$props.type === 'recent-search-icon') {
669
+ return createVNode("svg", {
670
+ "xmlns": "http://www.w3.org/2000/svg",
671
+ "alt": "Recent Search",
672
+ "height": "20",
673
+ "width": "20",
674
+ "viewBox": "0 0 24 24",
675
+ "style": {
676
+ fill: '#707070'
677
+ },
678
+ "class": this.$props.className
679
+ }, [createVNode("path", {
680
+ "d": "M0 0h24v24H0z",
681
+ "fill": "none"
682
+ }, null), createVNode("path", {
683
+ "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"
684
+ }, null)]);
685
+ }
686
+ if (this.$props.type === 'promoted-search-icon') {
687
+ return createVNode("svg", {
688
+ "xmlns": "http://www.w3.org/2000/svg",
689
+ "width": "20",
690
+ "alt": "promoted search",
691
+ "height": "20",
692
+ "viewBox": "0 0 24 24",
693
+ "class": this.$props.className,
694
+ "style": {
695
+ fill: '#707070'
696
+ }
697
+ }, [createVNode("path", {
698
+ "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"
699
+ }, null)]);
700
+ }
701
+ if (this.$props.type === 'popular-search-icon') {
702
+ return createVNode("svg", {
703
+ "xmlns": "http://www.w3.org/2000/svg",
704
+ "alt": "Popular Search",
705
+ "height": "20",
706
+ "width": "20",
707
+ "viewBox": "0 0 24 24",
708
+ "style": {
709
+ fill: '#707070'
710
+ },
711
+ "class": this.$props.className
712
+ }, [createVNode("path", {
713
+ "d": "M0 0h24v24H0z",
714
+ "fill": "none"
715
+ }, null), createVNode("path", {
716
+ "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"
717
+ }, null)]);
718
+ }
719
+ return createVNode(SearchSvg, {
720
+ "styles": {
721
+ position: 'relative',
722
+ fill: '#707070',
723
+ left: '3px',
724
+ marginRight: '8px'
725
+ }
726
+ }, null);
727
+ }
728
+ };
729
+
730
+ var _templateObject$6;
731
+ var AutofillSvgIcon = styled('button')(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tposition: relative;\n\tright: -3px;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tpadding: 0;\n\tz-index: 111000;\n\n\tsvg {\n\t\tcursor: pointer;\n\t\tfill: #707070;\n\t\theight: 20px;\n\t}\n\n\t&:hover {\n\t\tsvg {\n\t\t\tfill: #1c1a1a;\n\t\t}\n\t}\n"])));
732
+ var AutoFillSvg = {
733
+ name: 'AutoFillSvg',
734
+ render: function render() {
735
+ return createVNode(AutofillSvgIcon, {
736
+ "onClick": this.$attrs.click
737
+ }, {
738
+ "default": function _default() {
739
+ return [createVNode("svg", {
740
+ "viewBox": "0 0 24 24"
741
+ }, [createVNode("path", {
742
+ "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
743
+ }, null)])];
744
+ }
745
+ });
746
+ },
747
+ methods: {
748
+ clicked: function clicked(e) {
749
+ e.stopPropagation();
750
+ window.console.log('hey', e);
751
+ }
752
+ }
753
+ };
754
+
755
+ var _templateObject$7, _templateObject2;
756
+ var TagsContainer = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
757
+ var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
758
+
759
+ var _templateObject$8, _templateObject2$1, _templateObject3;
760
+ var skeletonAnimation = keyframes(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
761
+ var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
762
+ var SkeletonLine = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
763
+ var HorizontalSkeletonLoader = defineComponent({
764
+ name: 'HorizontalSkeletonLoader',
765
+ render: function render() {
766
+ return createVNode(SkeletonLoader, null, {
767
+ "default": function _default() {
768
+ return [createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null)];
769
+ }
770
+ });
771
+ }
772
+ });
773
+
774
+ var _templateObject$9, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
775
+ var Chatbox = styled('div')(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n"])), function (props) {
776
+ return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
777
+ });
778
+ var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
779
+ return props.showInput ? 'bottom: 48px;' : '';
780
+ }, function (props) {
781
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
782
+ }, function (props) {
783
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
784
+ }, function (props) {
785
+ return props.showInput ? ".--ai-answer-feedback-container {\n\t\tmargin-top: 15px;\n\t\tmargin-bottom: -10px;\n\t}" : ".--ai-answer-feedback-container {\n\t\tmargin-top: 4px;\n\t}";
786
+ });
787
+ var MessagesContainer = styled('div')(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
788
+ var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
789
+ var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
790
+ var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
791
+ var finalColor;
792
+ if (props.isSender) {
793
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
794
+ } else {
795
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
796
+ }
797
+ return finalColor;
798
+ }, typingDots);
799
+ var resetCSS = function resetCSS(props) {
800
+ return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
801
+ // eslint-disable-next-line no-nested-ternary
802
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\t}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
803
+ // eslint-disable-next-line no-nested-ternary
804
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\n\t}\n\n\tli{\n\t\tdisplay: unset;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n";
805
+ };
806
+ var messageBGColor = function messageBGColor(props) {
807
+ var finalBGColor;
808
+ if (props.isSender) {
809
+ finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
810
+ } else {
811
+ finalBGColor = props.themePreset !== 'dark' ? lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
812
+ }
813
+ return finalBGColor;
814
+ };
815
+ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
816
+ return messageBGColor(props);
817
+ }, function (props) {
818
+ var finalColor;
819
+ if (props.isSender) {
820
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
821
+ } else {
822
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
823
+ }
824
+ return finalColor;
825
+ }, function (props) {
826
+ return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
827
+ }, function (props) {
828
+ return props.isSender ? 'flex-end' : 'flex-start';
829
+ }, function (props) {
830
+ return resetCSS(props);
831
+ });
832
+ var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
833
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
834
+ return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
835
+ }, function (props) {
836
+ return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
837
+ }, function (props) {
838
+ return props.theme.colors.textColor;
839
+ }, function (props) {
840
+ return props.theme.colors.textColor;
841
+ }, function (props) {
842
+ return props.theme.colors.textColor;
843
+ }, function (_ref) {
844
+ var enterButton = _ref.enterButton;
845
+ return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
846
+ });
847
+ var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
848
+ var AIFeedbackContainer = styled('div')(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
849
+
850
+ var _templateObject$a, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
851
+ var fadeInFromBottom = keyframes(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
852
+ var fadeInFromTop = keyframes(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
853
+ var SearchBoxAISection = styled('div')(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
854
+ var themePreset = _ref.themePreset,
855
+ theme = _ref.theme;
856
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
857
+ }, function (_ref2) {
858
+ var theme = _ref2.theme;
859
+ return theme.colors.textColor;
860
+ });
861
+ var Question = styled('div')(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
862
+ var Answer = styled('div')(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
863
+ return resetCSS(props);
864
+ });
865
+ var Footer = styled('div')(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
866
+ var themePreset = _ref3.themePreset,
867
+ theme = _ref3.theme;
868
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
869
+ }, function (_ref4) {
870
+ var theme = _ref4.theme;
871
+ return theme.colors.textColor;
872
+ });
873
+ var SourceTags = styled('div')(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
874
+
875
+ var ThumbsUpSvg = {
876
+ name: 'ThumbsUpSvg',
877
+ props: ['clickHandler', 'className'],
878
+ render: function render() {
879
+ return createVNode("svg", {
880
+ "stroke": "currentColor",
881
+ "fill": "none",
882
+ "strokeWidth": "2",
883
+ "viewBox": "0 0 24 24",
884
+ "strokeLinecap": "round",
885
+ "strokeLinejoin": "round",
886
+ "class": this.$props.className,
887
+ "height": "1em",
888
+ "width": "1em",
889
+ "xmlns": "http://www.w3.org/2000/svg",
890
+ "onClick": this.$props.clickHandler
891
+ }, [createVNode("path", {
892
+ "d": "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"
893
+ }, null)]);
894
+ }
895
+ };
896
+
897
+ var ThumbsDownSvg = {
898
+ name: 'ThumbsDownSvg',
899
+ props: ['clickHandler', 'className'],
900
+ render: function render() {
901
+ return createVNode("svg", {
902
+ "stroke": "currentColor",
903
+ "fill": "none",
904
+ "strokeWidth": "2",
905
+ "viewBox": "0 0 24 24",
906
+ "strokeLinecap": "round",
907
+ "strokeLinejoin": "round",
908
+ "class": this.$props.className,
909
+ "height": "1em",
910
+ "width": "1em",
911
+ "xmlns": "http://www.w3.org/2000/svg",
912
+ "onClick": this.$props.clickHandler
913
+ }, [createVNode("path", {
914
+ "d": "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"
915
+ }, null), ' ']);
916
+ }
917
+ };
918
+
919
+ var AIFeedback = defineComponent({
920
+ name: 'FeedbackComponent',
921
+ props: {
922
+ onFeedbackSubmit: {
923
+ type: Function,
924
+ "default": function _default() {}
925
+ },
926
+ hideUI: {
927
+ type: Boolean,
928
+ "default": false
929
+ },
930
+ overrideState: {
931
+ type: Object,
932
+ "default": function _default() {
933
+ return {};
934
+ }
935
+ }
936
+ },
937
+ setup: function setup(props, _ref) {
938
+ var emit = _ref.emit;
939
+ var showInput = ref(false);
940
+ var feedbackType = ref(null);
941
+ var feedbackText = ref('');
942
+ var feedbackRecorded = ref(false);
943
+ var handleButtonClick = function handleButtonClick(type) {
944
+ if (feedbackType.value === type) {
945
+ feedbackType.value = null;
946
+ showInput.value = false;
947
+ } else {
948
+ feedbackType.value = type;
949
+ showInput.value = true;
950
+ }
951
+ };
952
+ var handleInputChange = function handleInputChange(e) {
953
+ feedbackText.value = e.target.value;
954
+ };
955
+ var handleSubmit = function handleSubmit() {
956
+ emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
957
+ feedbackText.value = '';
958
+ showInput.value = false;
959
+ feedbackRecorded.value = true;
960
+ };
961
+ var handleCancel = function handleCancel() {
962
+ feedbackType.value = null;
963
+ feedbackText.value = '';
964
+ showInput.value = false;
965
+ };
966
+ watch(function () {
967
+ return props.overrideState;
968
+ }, function (newValue) {
969
+ if (newValue && newValue.isRecorded) {
970
+ feedbackRecorded.value = true;
971
+ feedbackType.value = newValue.feedbackType || 'positive';
972
+ }
973
+ });
974
+ if (props.overrideState && props.overrideState.isRecorded) {
975
+ feedbackRecorded.value = true;
976
+ feedbackType.value = props.overrideState.feedbackType || 'positive';
977
+ }
978
+ return {
979
+ showInput: showInput,
980
+ feedbackType: feedbackType,
981
+ feedbackText: feedbackText,
982
+ feedbackRecorded: feedbackRecorded,
983
+ handleButtonClick: handleButtonClick,
984
+ handleInputChange: handleInputChange,
985
+ handleSubmit: handleSubmit,
986
+ handleCancel: handleCancel
987
+ };
988
+ },
989
+ render: function render() {
990
+ var _this = this;
991
+ if (this.$props.hideUI) {
992
+ return null;
993
+ }
994
+ if (this.feedbackRecorded) {
995
+ return createVNode(AIFeedbackContainer, null, {
996
+ "default": function _default() {
997
+ return [createVNode("div", {
998
+ "class": "--feedback-svgs-wrapper"
999
+ }, [_this.feedbackType === 'positive' ? createVNode(ThumbsUpSvg, {
1000
+ "class": "selected"
1001
+ }, null) : createVNode(ThumbsDownSvg, {
1002
+ "class": "selected"
1003
+ }, null)])];
1004
+ }
1005
+ });
1006
+ }
1007
+ return createVNode(AIFeedbackContainer, null, {
1008
+ "default": function _default() {
1009
+ return [!_this.showInput && createVNode("div", {
1010
+ "class": "--feedback-svgs-wrapper"
1011
+ }, [createVNode(ThumbsUpSvg, {
1012
+ "class": _this.feedbackType === 'positive' ? 'selected' : '',
1013
+ "onClick": function onClick() {
1014
+ return _this.handleButtonClick('positive');
1015
+ }
1016
+ }, null), createVNode(ThumbsDownSvg, {
1017
+ "class": _this.feedbackType === 'negative' ? 'selected' : '',
1018
+ "onClick": function onClick() {
1019
+ return _this.handleButtonClick('negative');
1020
+ }
1021
+ }, null)]), _this.showInput && createVNode("div", {
1022
+ "class": "--feedback-input-wrapper"
1023
+ }, [createVNode(Input, {
1024
+ "show": _this.showInput,
1025
+ "placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
1026
+ "value": _this.feedbackText,
1027
+ "onInput": _this.handleInputChange
1028
+ }, null), createVNode(Button, {
1029
+ "primary": true,
1030
+ "onClick": _this.handleSubmit
1031
+ }, {
1032
+ "default": function _default() {
1033
+ return [createTextVNode("Submit")];
1034
+ }
1035
+ }), createVNode(Button, {
1036
+ "onClick": _this.handleCancel
1037
+ }, {
1038
+ "default": function _default() {
1039
+ return [createTextVNode("Cancel")];
1040
+ }
1041
+ })])];
1042
+ }
1043
+ });
1044
+ }
1045
+ });
1046
+
1047
+ var _excluded = ["_source"];
1048
+ function _isSlot(s) {
1049
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1050
+ }
1051
+ var md = new Remarkable();
1052
+ md.set({
1053
+ html: true,
1054
+ breaks: true,
1055
+ xhtmlOut: true
1056
+ });
1057
+ var _dropdownULRef = 'dropdownULRef';
1058
+ var _inputGroupRef = 'inputGroupRef';
1059
+ var updateQuery = Actions.updateQuery,
1060
+ setCustomQuery = Actions.setCustomQuery,
1061
+ setDefaultQuery = Actions.setDefaultQuery,
1062
+ recordSuggestionClick = Actions.recordSuggestionClick;
1063
+ var _debounce = helper.debounce,
1064
+ checkValueChange = helper.checkValueChange,
1065
+ getClassName$1 = helper.getClassName,
1066
+ isEqual = helper.isEqual,
1067
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
1068
+ withClickIds = helper.withClickIds,
1069
+ getResultStats = helper.getResultStats;
1070
+ var SearchBox = defineComponent({
1071
+ name: 'SearchBox',
1072
+ isTagsMode: false,
1073
+ data: function data() {
1074
+ var props = this.$props;
1075
+ this.__state = {
1076
+ currentValue: '',
1077
+ selectedTags: [],
1078
+ isOpen: false,
1079
+ normalizedSuggestions: [],
1080
+ showAIScreen: false,
1081
+ showAIScreenFooter: false,
1082
+ showFeedbackComponent: false,
1083
+ feedbackState: null
1084
+ };
1085
+ this.internalComponent = props.componentId + "__internal";
1086
+ return this.__state;
1087
+ },
1088
+ inject: {
1089
+ theme: {
1090
+ from: 'theme_reactivesearch'
1091
+ }
1092
+ },
1093
+ created: function created() {
1094
+ var mode = this.$props.mode;
1095
+ if (mode === SEARCH_COMPONENTS_MODES.TAG) {
1096
+ this.$options.isTagsMode = true;
1097
+ }
1098
+ if (this.$options.isTagsMode) {
1099
+ console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
1100
+ }
1101
+ this.currentValue = decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
1102
+ if (this.$options.isTagsMode) {
1103
+ this.currentValue = '';
1104
+ }
1105
+ this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
1106
+
1107
+ // Set custom and default queries in store
1108
+ this.triggerCustomQuery(this.currentValue, this.selectedCategory);
1109
+ this.triggerDefaultQuery(this.currentValue);
1110
+ if (this.selectedValue) {
1111
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1112
+ } else if (this.$props.value) {
1113
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1114
+ } else if (this.$props.defaultValue) {
1115
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1116
+ }
1117
+ },
1118
+ computed: {
1119
+ hasCustomRenderer: function hasCustomRenderer$1() {
1120
+ return hasCustomRenderer(this);
1121
+ },
1122
+ stats: function stats() {
1123
+ return getResultStats(this);
1124
+ }
1125
+ },
1126
+ props: {
1127
+ autoFocus: VueTypes.bool,
1128
+ autosuggest: VueTypes.bool.def(true),
1129
+ beforeValueChange: types.func,
1130
+ className: VueTypes.string.def(''),
1131
+ clearIcon: types.children,
1132
+ componentId: types.stringRequired,
1133
+ customHighlight: types.func,
1134
+ customQuery: types.func,
1135
+ defaultQuery: types.func,
1136
+ dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
1137
+ field: VueTypes.string,
1138
+ weight: VueTypes.number
1139
+ }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
1140
+ field: VueTypes.string,
1141
+ weight: VueTypes.number
1142
+ })]),
1143
+ aggregationField: types.string,
1144
+ aggregationSize: VueTypes.number,
1145
+ size: VueTypes.number,
1146
+ debounce: VueTypes.number.def(0),
1147
+ defaultValue: types.string,
1148
+ excludeFields: types.excludeFields,
1149
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types.value]),
1150
+ defaultSuggestions: types.suggestions,
1151
+ enableSynonyms: VueTypes.bool.def(true),
1152
+ enableQuerySuggestions: VueTypes.bool.def(false),
1153
+ enablePopularSuggestions: VueTypes.bool.def(false),
1154
+ enableRecentSuggestions: VueTypes.bool.def(false),
1155
+ fieldWeights: types.fieldWeights,
1156
+ filterLabel: types.string,
1157
+ fuzziness: types.fuzziness,
1158
+ highlight: VueTypes.bool,
1159
+ highlightField: types.stringOrArray,
1160
+ icon: types.children,
1161
+ iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
1162
+ includeFields: types.includeFields,
1163
+ innerClass: types.style,
1164
+ innerRef: VueTypes.string.def('searchInputField'),
1165
+ render: types.func,
1166
+ renderNoSuggestion: types.title,
1167
+ renderError: types.title,
1168
+ placeholder: VueTypes.string.def('Search'),
1169
+ queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
1170
+ react: types.react,
1171
+ showClear: VueTypes.bool.def(true),
1172
+ showDistinctSuggestions: VueTypes.bool.def(true),
1173
+ showFilter: VueTypes.bool.def(true),
1174
+ showIcon: VueTypes.bool.def(true),
1175
+ title: types.title,
1176
+ URLParams: VueTypes.bool.def(false),
1177
+ strictSelection: VueTypes.bool.def(false),
1178
+ nestedField: types.string,
1179
+ enablePredictiveSuggestions: VueTypes.bool.def(false),
1180
+ recentSearchesIcon: VueTypes.any,
1181
+ popularSearchesIcon: VueTypes.any,
1182
+ // mic props
1183
+ showVoiceSearch: VueTypes.bool.def(false),
1184
+ getMicInstance: types.func,
1185
+ renderMic: types.func,
1186
+ distinctField: types.string,
1187
+ distinctFieldConfig: types.props,
1188
+ //
1189
+ focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1190
+ addonBefore: VueTypes.any,
1191
+ addonAfter: VueTypes.any,
1192
+ expandSuggestionsContainer: VueTypes.bool.def(true),
1193
+ index: VueTypes.string,
1194
+ popularSuggestionsConfig: VueTypes.object,
1195
+ recentSuggestionsConfig: VueTypes.object,
1196
+ applyStopwords: VueTypes.bool,
1197
+ customStopwords: types.stringArray,
1198
+ onData: types.func,
1199
+ renderItem: types.func,
1200
+ enterButton: VueTypes.bool.def(false),
1201
+ renderEnterButton: VueTypes.any,
1202
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1203
+ renderSelectedTags: VueTypes.any,
1204
+ searchboxId: VueTypes.string,
1205
+ endpoint: types.endpointConfig,
1206
+ enableAI: VueTypes.bool.def(false),
1207
+ AIConfig: types.AIConfig,
1208
+ AIUIConfig: types.AIUIConfig
1209
+ },
1210
+ mounted: function mounted() {
1211
+ this.listenForFocusShortcuts();
1212
+ },
1213
+ watch: {
1214
+ dataField: function dataField(newVal, oldVal) {
1215
+ if (!isEqual(newVal, oldVal)) {
1216
+ this.triggerCustomQuery(this.$data.currentValue);
1217
+ }
1218
+ },
1219
+ fieldWeights: function fieldWeights() {
1220
+ this.triggerCustomQuery(this.$data.currentValue);
1221
+ },
1222
+ fuzziness: function fuzziness() {
1223
+ this.triggerCustomQuery(this.$data.currentValue);
1224
+ },
1225
+ queryFormat: function queryFormat() {
1226
+ this.triggerCustomQuery(this.$data.currentValue);
1227
+ },
1228
+ defaultValue: function defaultValue(newVal) {
1229
+ this.setValue(newVal, true, this.$props);
1230
+ },
1231
+ value: function value(newVal, oldVal) {
1232
+ if (!isEqual(newVal, oldVal)) {
1233
+ this.setValue(newVal, true, this.$props, newVal === '' ? causes.CLEAR_VALUE : undefined, false);
1234
+ }
1235
+ },
1236
+ defaultQuery: function defaultQuery(newVal, oldVal) {
1237
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1238
+ this.triggerDefaultQuery(this.$data.currentValue);
1239
+ }
1240
+ },
1241
+ customQuery: function customQuery(newVal, oldVal) {
1242
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1243
+ this.triggerCustomQuery(this.$data.currentValue);
1244
+ }
1245
+ },
1246
+ suggestions: function suggestions(newVal) {
1247
+ var suggestionsList = [];
1248
+ if (Array.isArray(newVal) && newVal.length) {
1249
+ suggestionsList = [].concat(withClickIds(newVal));
1250
+ } else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
1251
+ suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
1252
+ }
1253
+ this.normalizedSuggestions = suggestionsList;
1254
+ this.handleTextAreaHeightChange();
1255
+ },
1256
+ selectedValue: function selectedValue(newVal, oldVal) {
1257
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1258
+ if (!newVal && this.$data.currentValue) {
1259
+ // selected value is cleared, call onValueSelected
1260
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1261
+ }
1262
+ if (this.$options.isTagsMode) {
1263
+ // handling reset of tags through SelectedFilters or URL
1264
+ this.selectedTags = [];
1265
+ }
1266
+ var cause = !newVal ? causes.CLEAR_VALUE : undefined;
1267
+ if (this.$options.isTagsMode) {
1268
+ cause = causes.SUGGESTION_SELECT;
1269
+ }
1270
+ this.setValue(newVal || '', true, this.$props, cause);
1271
+ }
1272
+ },
1273
+ focusShortcuts: function focusShortcuts() {
1274
+ this.listenForFocusShortcuts();
1275
+ },
1276
+ rawData: function rawData(newVal) {
1277
+ this.$emit('on-data', {
1278
+ data: this.normalizedSuggestions,
1279
+ rawData: newVal,
1280
+ aggregationData: this.aggregationData,
1281
+ loading: this.isLoading,
1282
+ error: this.isError
1283
+ });
1284
+ },
1285
+ aggregationData: function aggregationData(newVal) {
1286
+ this.$emit('on-data', {
1287
+ data: this.normalizedSuggestions,
1288
+ rawData: this.rawData,
1289
+ aggregationData: newVal,
1290
+ loading: this.isLoading,
1291
+ error: this.isError
1292
+ });
1293
+ },
1294
+ loading: function loading(newVal) {
1295
+ this.$emit('on-data', {
1296
+ data: this.normalizedSuggestions,
1297
+ rawData: this.rawData,
1298
+ aggregationData: this.aggregationData,
1299
+ loading: newVal,
1300
+ error: this.isError
1301
+ });
1302
+ },
1303
+ error: function error(newVal) {
1304
+ this.$emit('on-data', {
1305
+ data: this.normalizedSuggestions,
1306
+ rawData: this.rawData,
1307
+ aggregationData: this.aggregationData,
1308
+ loading: this.isLoading,
1309
+ error: newVal
1310
+ });
1311
+ },
1312
+ debounce: function debounce(newVal, oldVal) {
1313
+ if (!isEqual(newVal, oldVal)) {
1314
+ this.handleTextChange = _debounce(this.handleText, newVal);
1315
+ }
1316
+ },
1317
+ isAITyping: function isAITyping(newVal, oldVal) {
1318
+ var _this = this;
1319
+ var scrollAIContainer = function scrollAIContainer() {
1320
+ var dropdownEle = _this.$refs[_dropdownULRef];
1321
+ if (dropdownEle) {
1322
+ dropdownEle.scrollTo({
1323
+ top: dropdownEle.scrollHeight,
1324
+ behavior: 'smooth'
1325
+ });
1326
+ }
1327
+ };
1328
+ if (!newVal && oldVal) {
1329
+ this.showAIScreenFooter = true;
1330
+ if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1331
+ this.showFeedbackComponent = true;
1332
+ }
1333
+ setTimeout(function () {
1334
+ scrollAIContainer();
1335
+ }, 500);
1336
+ } else if (newVal) {
1337
+ this.scrollTimerRef = setTimeout(function () {
1338
+ scrollAIContainer();
1339
+ }, 2000);
1340
+ }
1341
+ },
1342
+ showAIScreen: function showAIScreen(newVal) {
1343
+ if (newVal) {
1344
+ var _this$$refs;
1345
+ if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
1346
+ this.$refs[this.$props.innerRef].$el.blur();
1347
+ }
1348
+ } else {
1349
+ this.feedbackState = null;
1350
+ this.showFeedbackComponent = false;
1351
+ }
1352
+ },
1353
+ currentValue: function currentValue() {
1354
+ this.handleTextAreaHeightChange();
1355
+ }
1356
+ },
1357
+ methods: {
1358
+ handleText: function handleText(value, cause) {
1359
+ if (cause === causes.CLEAR_VALUE) {
1360
+ this.triggerCustomQuery(value);
1361
+ this.triggerDefaultQuery(value);
1362
+ } else if (this.$props.autosuggest) {
1363
+ this.triggerDefaultQuery(value);
1364
+ } else if (!this.$props.enterButton) {
1365
+ this.triggerCustomQuery(value);
1366
+ }
1367
+ },
1368
+ getComponent: function getComponent$1(downshiftProps) {
1369
+ if (downshiftProps === void 0) {
1370
+ downshiftProps = {};
1371
+ }
1372
+ var currentValue = this.$data.currentValue;
1373
+ var data = {
1374
+ error: this.error,
1375
+ loading: this.isLoading,
1376
+ downshiftProps: downshiftProps,
1377
+ data: this.normalizedSuggestions,
1378
+ rawData: this.rawData,
1379
+ value: currentValue,
1380
+ resultStats: this.stats,
1381
+ AIData: {
1382
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1383
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1384
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1385
+ showAIScreen: this.showAIScreen,
1386
+ sources: this.getAISourceObjects(),
1387
+ isAILoading: this.isAIResponseLoading,
1388
+ AIError: this.AIResponseError
1389
+ }
1390
+ };
1391
+ return createVNode("div", {
1392
+ "ref": _dropdownULRef
1393
+ }, [getComponent(data, this)]);
1394
+ },
1395
+ // returns size and aggs property
1396
+ getBasicQueryOptions: function getBasicQueryOptions() {
1397
+ var aggregationField = this.$props.aggregationField;
1398
+ var queryOptions = getQueryOptions(this.$props);
1399
+ if (aggregationField) {
1400
+ queryOptions.aggs = getCompositeAggsQuery({
1401
+ props: this.$props,
1402
+ showTopHits: true
1403
+ }).aggs;
1404
+ }
1405
+ return queryOptions;
1406
+ },
1407
+ handleSearchIconClick: function handleSearchIconClick() {
1408
+ var currentValue = this.currentValue;
1409
+ if (currentValue.trim()) {
1410
+ this.setValue(currentValue, true);
1411
+ this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1412
+ }
1413
+ },
1414
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1415
+ var _this2 = this;
1416
+ if (isDefaultValue === void 0) {
1417
+ isDefaultValue = false;
1418
+ }
1419
+ if (props === void 0) {
1420
+ props = this.$props;
1421
+ }
1422
+ if (toggleIsOpen === void 0) {
1423
+ toggleIsOpen = true;
1424
+ }
1425
+ if (categoryValue === void 0) {
1426
+ categoryValue = undefined;
1427
+ }
1428
+ var performUpdate = function performUpdate() {
1429
+ if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1430
+ return;
1431
+ }
1432
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1433
+ if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1434
+ // check if value already present in selectedTags
1435
+ if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1436
+ _this2.isOpen = false;
1437
+ return;
1438
+ }
1439
+ _this2.selectedTags = [].concat(_this2.selectedTags);
1440
+ if (typeof value === 'string' && !!value) {
1441
+ _this2.selectedTags.push(value);
1442
+ } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1443
+ _this2.selectedTags = value;
1444
+ }
1445
+ } else if (value) {
1446
+ _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1447
+ }
1448
+ _this2.currentValue = '';
1449
+ } else {
1450
+ _this2.currentValue = decodeHtml(value);
1451
+ }
1452
+ var queryHandlerValue = value;
1453
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1454
+ queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1455
+ }
1456
+ if (isDefaultValue) {
1457
+ if (_this2.$props.autosuggest) {
1458
+ if (toggleIsOpen) {
1459
+ _this2.isOpen = false;
1460
+ }
1461
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1462
+ enableAI: true
1463
+ } : {});
1464
+ } // in case of strict selection only SUGGESTION_SELECT should be able
1465
+ // to set the query otherwise the value should reset
1466
+ if (props.strictSelection) {
1467
+ if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1468
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1469
+ } else {
1470
+ _this2.setValue('', true);
1471
+ }
1472
+ } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1473
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1474
+ }
1475
+ } else {
1476
+ // debounce for handling text while typing
1477
+ _this2.handleTextChange(value, cause);
1478
+ }
1479
+ _this2.$emit('valueChange', value);
1480
+ _this2.$emit('value-change', value);
1481
+ };
1482
+ checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1483
+ },
1484
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1485
+ if (meta === void 0) {
1486
+ meta = {};
1487
+ }
1488
+ if (!this.$props.autosuggest) {
1489
+ return;
1490
+ }
1491
+ var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
1492
+ var query = SearchBox.defaultQuery(value, this.$props);
1493
+ if (this.defaultQuery) {
1494
+ var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
1495
+ if (defaultQueryToBeSet.query) {
1496
+ query = defaultQueryToBeSet.query;
1497
+ }
1498
+
1499
+ // Update calculated default query in store
1500
+ updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
1501
+ }
1502
+ this.updateQuery({
1503
+ componentId: this.internalComponent,
1504
+ query: query,
1505
+ value: value,
1506
+ componentType: componentTypes.searchBox,
1507
+ meta: meta
1508
+ });
1509
+ },
1510
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1511
+ if (categoryValue === void 0) {
1512
+ categoryValue = undefined;
1513
+ }
1514
+ var _this$$props = this.$props,
1515
+ customQuery = _this$$props.customQuery,
1516
+ filterLabel = _this$$props.filterLabel,
1517
+ showFilter = _this$$props.showFilter,
1518
+ URLParams = _this$$props.URLParams;
1519
+ var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
1520
+ if (this.$options.isTagsMode) {
1521
+ value = paramValue;
1522
+ }
1523
+ var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
1524
+ var query = defaultQueryTobeSet;
1525
+ if (customQuery) {
1526
+ var customQueryTobeSet = customQuery(value, this.$props);
1527
+ var queryTobeSet = customQueryTobeSet.query;
1528
+ if (queryTobeSet) {
1529
+ query = queryTobeSet;
1530
+ }
1531
+ updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
1532
+ }
1533
+ this.updateQuery({
1534
+ componentId: this.$props.componentId,
1535
+ query: query,
1536
+ value: value,
1537
+ label: filterLabel,
1538
+ showFilter: showFilter,
1539
+ URLParams: URLParams,
1540
+ componentType: componentTypes.searchBox,
1541
+ category: categoryValue
1542
+ });
1543
+ },
1544
+ handleFocus: function handleFocus(event) {
1545
+ if (this.$props.autosuggest) {
1546
+ this.isOpen = true;
1547
+ }
1548
+ this.$emit('focus', event);
1549
+ },
1550
+ handleVoiceResults: function handleVoiceResults(_ref) {
1551
+ var results = _ref.results;
1552
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1553
+ this.setValue(results[0][0].transcript.trim(), true);
1554
+ }
1555
+ },
1556
+ triggerQuery: function triggerQuery(_ref2) {
1557
+ var _ref2$isOpen = _ref2.isOpen,
1558
+ isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
1559
+ _ref2$customQuery = _ref2.customQuery,
1560
+ customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
1561
+ _ref2$defaultQuery = _ref2.defaultQuery,
1562
+ defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
1563
+ _ref2$value = _ref2.value,
1564
+ value = _ref2$value === void 0 ? undefined : _ref2$value,
1565
+ _ref2$categoryValue = _ref2.categoryValue,
1566
+ categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
1567
+ if (typeof isOpen === 'boolean') {
1568
+ this.isOpen = isOpen;
1569
+ }
1570
+ if (customQuery) {
1571
+ this.triggerCustomQuery(value, categoryValue);
1572
+ }
1573
+ if (defaultQuery) {
1574
+ this.triggerDefaultQuery(value);
1575
+ }
1576
+ },
1577
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1578
+ // click analytics would only work client side and after javascript loads
1579
+ var docId = documentId;
1580
+ if (!docId) {
1581
+ var hitData = this.normalizedSuggestions.find(function (hit) {
1582
+ return hit._click_id === searchPosition;
1583
+ });
1584
+ if (hitData && hitData.source && hitData.source._id) {
1585
+ docId = hitData.source._id;
1586
+ }
1587
+ }
1588
+ this.recordSuggestionClick(searchPosition, docId);
1589
+ },
1590
+ clearValue: function clearValue() {
1591
+ this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1592
+ this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1593
+ },
1594
+ handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1595
+ if (highlightedIndex === void 0) {
1596
+ highlightedIndex = null;
1597
+ }
1598
+ // if a suggestion was selected, delegate the handling to suggestion handler
1599
+ if (event.key === 'Enter') {
1600
+ if (this.$props.autosuggest === false) {
1601
+ this.enterButtonOnClick();
1602
+ } else if (highlightedIndex === null) {
1603
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined,
1604
+ // to handle tags
1605
+ !this.$props.enableAI);
1606
+ if (this.$props.enableAI && !this.showAIScreen) {
1607
+ this.showAIScreen = true;
1608
+ }
1609
+ this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1610
+ }
1611
+ }
1612
+
1613
+ // Need to review
1614
+ this.$emit('keyDown', event, this.triggerQuery);
1615
+ this.$emit('key-down', event, this.triggerQuery);
1616
+ },
1617
+ onInputChange: function onInputChange(e) {
1618
+ var _this3 = this;
1619
+ var inputValue = e.target.value;
1620
+ if (!this.$data.isOpen && this.$props.autosuggest) {
1621
+ this.isOpen = true;
1622
+ }
1623
+ if (this.showAIScreen) {
1624
+ this.showAIScreen = false;
1625
+ }
1626
+ var value = this.$props.value;
1627
+ if (value === undefined) {
1628
+ this.setValue(inputValue, false, this.$props, undefined);
1629
+ } else {
1630
+ this.$emit('change', inputValue, function (_ref3) {
1631
+ var isOpen = _ref3.isOpen;
1632
+ return _this3.triggerQuery({
1633
+ defaultQuery: true,
1634
+ customQuery: true,
1635
+ value: inputValue,
1636
+ isOpen: isOpen
1637
+ });
1638
+ }, e);
1639
+ }
1640
+ },
1641
+ onSuggestionSelected: function onSuggestionSelected(suggestion) {
1642
+ var _this4 = this;
1643
+ if (!this.$props.enableAI) this.isOpen = false;else {
1644
+ this.showAIScreen = true;
1645
+ }
1646
+ var value = this.$props.value;
1647
+ // Record analytics for selected suggestions
1648
+ this.triggerClickAnalytics(suggestion._click_id);
1649
+ if (value === undefined) {
1650
+ this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1651
+ } else {
1652
+ var emitValue = suggestion.value;
1653
+ if (this.$options.isTagsMode) {
1654
+ emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1655
+ if (this.selectedTags.includes(suggestion.value)) {
1656
+ // avoid duplicates in tags array
1657
+ this.isOpen = false;
1658
+ return;
1659
+ }
1660
+ emitValue.push(suggestion.value);
1661
+ }
1662
+ this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1663
+ this.$emit('change', emitValue, function (_ref4) {
1664
+ var isOpen = _ref4.isOpen;
1665
+ return _this4.triggerQuery(_extends({
1666
+ isOpen: isOpen,
1667
+ value: emitValue
1668
+ }, !_this4.$options.isTagsMode && {
1669
+ categoryValue: suggestion._category
1670
+ }));
1671
+ });
1672
+ }
1673
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1674
+ },
1675
+ onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1676
+ if (currentValue === void 0) {
1677
+ currentValue = this.$data.currentValue;
1678
+ }
1679
+ for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1680
+ cause[_key - 1] = arguments[_key];
1681
+ }
1682
+ this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1683
+ this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1684
+ },
1685
+ handleStateChange: function handleStateChange(changes) {
1686
+ var isOpen = changes.isOpen;
1687
+ this.isOpen = isOpen;
1688
+ },
1689
+ getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1690
+ var isDark = this.themePreset === 'dark';
1691
+ if (isDark) {
1692
+ return highlightedIndex === index ? '#555' : '#424242';
1693
+ }
1694
+ return highlightedIndex === index ? '#eee' : '#fff';
1695
+ },
1696
+ renderIcon: function renderIcon() {
1697
+ if (this.$props.showIcon) {
1698
+ return this.$props.icon || createVNode(SearchSvg, null, null);
1699
+ }
1700
+ return null;
1701
+ },
1702
+ renderErrorComponent: function renderErrorComponent(isAIError) {
1703
+ var _this5 = this;
1704
+ if (isAIError === void 0) {
1705
+ isAIError = false;
1706
+ }
1707
+ var renderError = this.$slots.renderError || this.$props.renderError;
1708
+ if (isAIError) {
1709
+ if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
1710
+ if (renderError) {
1711
+ return createVNode("div", {
1712
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1713
+ }, [renderError(this.AIResponseError)]);
1714
+ }
1715
+ return createVNode("div", {
1716
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1717
+ }, [createVNode("div", {
1718
+ "class": "--default-error-element"
1719
+ }, [createVNode("span", null, [typeof this.AIResponseError === 'string' ? this.AIResponseError : this.AIResponseError.message ? this.AIResponseError.message : 'There was an error in generating the response.', this.AIResponseError.code ? "Code:\n\t\t\t\t\t\t\t" + this.AIResponseError.code : ''])])]);
1720
+ }
1721
+ }
1722
+ if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1723
+ return createVNode(SuggestionWrapper, {
1724
+ "innerClass": this.$props.innerClass,
1725
+ "innerClassName": "error",
1726
+ "theme": this.theme,
1727
+ "themePreset": this.themePreset
1728
+ }, {
1729
+ "default": function _default() {
1730
+ return [isFunction(renderError) ? renderError(_this5.error) : renderError];
1731
+ }
1732
+ });
1733
+ }
1734
+ return null;
1735
+ },
1736
+ renderCancelIcon: function renderCancelIcon() {
1737
+ if (this.$props.showClear) {
1738
+ return this.$props.clearIcon || createVNode(CancelSvg, null, null);
1739
+ }
1740
+ return null;
1741
+ },
1742
+ renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1743
+ if (finalSuggestionsList === void 0) {
1744
+ finalSuggestionsList = [];
1745
+ }
1746
+ var innerClass = this.$props.innerClass;
1747
+ var renderNoSuggestion = this.$slots.renderNoSuggestion || this.$props.renderNoSuggestion;
1748
+ var renderError = this.$slots.renderError || this.$props.renderError;
1749
+ var _this$$data = this.$data,
1750
+ isOpen = _this$$data.isOpen,
1751
+ currentValue = _this$$data.currentValue;
1752
+ if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1753
+ return createVNode(SuggestionWrapper, {
1754
+ "innerClass": innerClass,
1755
+ "themePreset": this.themePreset,
1756
+ "theme": this.theme,
1757
+ "innerClassName": "noSuggestion"
1758
+ }, {
1759
+ "default": function _default() {
1760
+ return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1761
+ }
1762
+ });
1763
+ }
1764
+ return null;
1765
+ },
1766
+ renderInputAddonBefore: function renderInputAddonBefore() {
1767
+ var addonBefore = this.$slots.addonBefore;
1768
+ if (addonBefore) {
1769
+ var _slot;
1770
+ return createVNode(InputAddon, {
1771
+ "class": "addon-before"
1772
+ }, _isSlot(_slot = addonBefore()) ? _slot : {
1773
+ "default": function _default() {
1774
+ return [_slot];
1775
+ }
1776
+ });
1777
+ }
1778
+ return null;
1779
+ },
1780
+ renderInputAddonAfter: function renderInputAddonAfter() {
1781
+ var addonAfter = this.$slots.addonAfter;
1782
+ if (addonAfter) {
1783
+ var _slot2;
1784
+ return createVNode(InputAddon, {
1785
+ "class": "addon-after"
1786
+ }, _isSlot(_slot2 = addonAfter()) ? _slot2 : {
1787
+ "default": function _default() {
1788
+ return [_slot2];
1789
+ }
1790
+ });
1791
+ }
1792
+ return null;
1793
+ },
1794
+ enterButtonOnClick: function enterButtonOnClick() {
1795
+ this.showAIScreen = false;
1796
+ this.triggerQuery({
1797
+ isOpen: false,
1798
+ value: this.currentValue,
1799
+ customQuery: true
1800
+ });
1801
+ },
1802
+ renderEnterButtonElement: function renderEnterButtonElement() {
1803
+ var _this6 = this;
1804
+ var _this$$props2 = this.$props,
1805
+ enterButton = _this$$props2.enterButton,
1806
+ innerClass = _this$$props2.innerClass;
1807
+ var renderEnterButton = this.$slots.renderEnterButton;
1808
+ if (enterButton) {
1809
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
1810
+ if (renderEnterButton) {
1811
+ return renderEnterButton(_this6.enterButtonOnClick);
1812
+ }
1813
+ return createVNode(Button, {
1814
+ "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1815
+ "primary": true,
1816
+ "onClick": _this6.enterButtonOnClick
1817
+ }, {
1818
+ "default": function _default() {
1819
+ return [createTextVNode("Search")];
1820
+ }
1821
+ });
1822
+ };
1823
+ return createVNode("div", {
1824
+ "class": "enter-button-wrapper"
1825
+ }, [getEnterButtonMarkup()]);
1826
+ }
1827
+ return null;
1828
+ },
1829
+ renderIcons: function renderIcons() {
1830
+ var _this7 = this;
1831
+ var _slot3, _slot4, _slot5;
1832
+ var _this$$props3 = this.$props,
1833
+ iconPosition = _this$$props3.iconPosition,
1834
+ showClear = _this$$props3.showClear,
1835
+ innerClass = _this$$props3.innerClass,
1836
+ getMicInstance = _this$$props3.getMicInstance,
1837
+ showVoiceSearch = _this$$props3.showVoiceSearch,
1838
+ showIcon = _this$$props3.showIcon;
1839
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
1840
+ var currentValue = this.$data.currentValue;
1841
+ return createVNode("div", null, [createVNode(IconGroup, {
1842
+ "groupPosition": "right",
1843
+ "positionType": "absolute"
1844
+ }, {
1845
+ "default": function _default() {
1846
+ return [currentValue && showClear && createVNode(IconWrapper, {
1847
+ "onClick": _this7.clearValue,
1848
+ "showIcon": showIcon,
1849
+ "isClearIcon": true
1850
+ }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
1851
+ "default": function _default() {
1852
+ return [_slot3];
1853
+ }
1854
+ }), showVoiceSearch && createVNode(Mic, {
1855
+ "getInstance": getMicInstance,
1856
+ "render": renderMic,
1857
+ "handleResult": _this7.handleVoiceResults,
1858
+ "className": getClassName$1(innerClass, 'mic') || null
1859
+ }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1860
+ "onClick": _this7.handleSearchIconClick
1861
+ }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
1862
+ "default": function _default() {
1863
+ return [_slot4];
1864
+ }
1865
+ })];
1866
+ }
1867
+ }), createVNode(IconGroup, {
1868
+ "groupPosition": "left",
1869
+ "positionType": "absolute"
1870
+ }, {
1871
+ "default": function _default() {
1872
+ return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1873
+ "onClick": _this7.handleSearchIconClick
1874
+ }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1875
+ "default": function _default() {
1876
+ return [_slot5];
1877
+ }
1878
+ })];
1879
+ }
1880
+ })]);
1881
+ },
1882
+ focusSearchBox: function focusSearchBox(event) {
1883
+ var _this$$refs2, _this$$refs2$this$$pr;
1884
+ var elt = event.target || event.srcElement;
1885
+ var tagName = elt.tagName;
1886
+ if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1887
+ // already in an input
1888
+ return;
1889
+ }
1890
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
1891
+ },
1892
+ listenForFocusShortcuts: function listenForFocusShortcuts() {
1893
+ var _this8 = this;
1894
+ var _this$$props$focusSho = this.$props.focusShortcuts,
1895
+ focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1896
+ if (isEmpty(focusShortcuts)) {
1897
+ return;
1898
+ }
1899
+ var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
1900
+
1901
+ // handler for alphabets and other key combinations
1902
+ hotkeys(shortcutsString,
1903
+ // eslint-disable-next-line no-unused-vars
1904
+ /* eslint-disable no-shadow */
1905
+ function (event, handler) {
1906
+ // Prevent the default refresh event under WINDOWS system
1907
+ event.preventDefault();
1908
+ _this8.focusSearchBox(event);
1909
+ });
1910
+
1911
+ // if one of modifier keys are used, they are handled below
1912
+ hotkeys('*', function (event) {
1913
+ var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1914
+ if (modifierKeys.length === 0) return;
1915
+ for (var index = 0; index < modifierKeys.length; index += 1) {
1916
+ var element = modifierKeys[index];
1917
+ if (hotkeys[element]) {
1918
+ _this8.focusSearchBox(event);
1919
+ break;
1920
+ }
1921
+ }
1922
+ });
1923
+ },
1924
+ onAutofillClick: function onAutofillClick(suggestion) {
1925
+ var value = suggestion.value;
1926
+ this.isOpen = true;
1927
+ this.currentValue = decodeHtml(value);
1928
+ this.triggerDefaultQuery(value);
1929
+ },
1930
+ renderAutoFill: function renderAutoFill(suggestion) {
1931
+ var _this9 = this;
1932
+ var handleAutoFillClick = function handleAutoFillClick(e) {
1933
+ e.stopPropagation();
1934
+ _this9.onAutofillClick(suggestion);
1935
+ };
1936
+ /* 👇 avoid showing autofill for category suggestions👇 */
1937
+ return suggestion._category ? null : createVNode(AutoFillSvg, {
1938
+ "onClick": handleAutoFillClick
1939
+ }, null);
1940
+ },
1941
+ renderTag: function renderTag(item) {
1942
+ var _this10 = this;
1943
+ var innerClass = this.$props.innerClass;
1944
+ return createVNode(TagItem, {
1945
+ "class": getClassName$1(innerClass, 'selected-tag') || ''
1946
+ }, {
1947
+ "default": function _default() {
1948
+ return [createVNode("span", null, [item]), createVNode("span", {
1949
+ "role": "img",
1950
+ "aria-label": "delete-tag",
1951
+ "class": "close-icon",
1952
+ "onClick": function onClick() {
1953
+ return _this10.clearTag(item);
1954
+ }
1955
+ }, [createVNode(CancelSvg, null, null)])];
1956
+ }
1957
+ });
1958
+ },
1959
+ clearAllTags: function clearAllTags() {
1960
+ this.selectedTags = [];
1961
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1962
+ if (this.$props.value !== undefined) {
1963
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1964
+ }
1965
+ },
1966
+ clearTag: function clearTag(tagValue) {
1967
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1968
+ return tag !== tagValue;
1969
+ }));
1970
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1971
+ if (this.$props.value !== undefined) {
1972
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1973
+ }
1974
+ },
1975
+ renderTags: function renderTags() {
1976
+ var _this11 = this;
1977
+ if (!Array.isArray(this.selectedTags)) {
1978
+ return null;
1979
+ }
1980
+ var tagsList = [].concat(this.selectedTags);
1981
+ var shouldRenderClearAllTag = tagsList.length > 1;
1982
+ var renderSelectedTags = this.$slots.renderSelectedTags || this.$props.renderSelectedTags;
1983
+ return renderSelectedTags ? renderSelectedTags({
1984
+ values: this.selectedTags,
1985
+ handleClear: this.clearTag,
1986
+ handleClearAll: this.clearAllTags
1987
+ }) : createVNode(TagsContainer, null, {
1988
+ "default": function _default() {
1989
+ return [tagsList.map(function (item) {
1990
+ return _this11.renderTag(item);
1991
+ }), shouldRenderClearAllTag && createVNode(TagItem, {
1992
+ "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
1993
+ }, {
1994
+ "default": function _default() {
1995
+ return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
1996
+ "role": "img",
1997
+ "aria-label": "delete-tag",
1998
+ "class": "close-icon",
1999
+ "onClick": _this11.clearAllTags
2000
+ }, [createVNode(CancelSvg, null, null)])];
2001
+ }
2002
+ })];
2003
+ }
2004
+ });
2005
+ },
2006
+ getAISourceObjects: function getAISourceObjects() {
2007
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
2008
+ var sourceObjects = [];
2009
+ if (!this.AIResponse) return sourceObjects;
2010
+ var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2011
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2012
+ docIds.forEach(function (id) {
2013
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2014
+ return hit._id === id;
2015
+ }) || {};
2016
+ if (foundSourceObj) {
2017
+ var _foundSourceObj$_sour = foundSourceObj._source,
2018
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
2019
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded);
2020
+ sourceObjects.push(_extends({}, rest, _source));
2021
+ }
2022
+ });
2023
+ } else {
2024
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
2025
+ return {
2026
+ _id: id
2027
+ };
2028
+ }));
2029
+ }
2030
+ return sourceObjects;
2031
+ },
2032
+ renderAIScreenLoader: function renderAIScreenLoader() {
2033
+ var _this$$props$AIUIConf = this.$props.AIUIConfig,
2034
+ AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
2035
+ var _ref5 = AIUIConfig || {},
2036
+ loaderMessage = _ref5.loaderMessage;
2037
+ if (loaderMessage) {
2038
+ return loaderMessage;
2039
+ }
2040
+ if (this.$slots.AILoaderMessage) {
2041
+ return this.$slots.AILoaderMessage();
2042
+ }
2043
+ return createVNode(HorizontalSkeletonLoader, null, null);
2044
+ },
2045
+ renderAIScreenFooter: function renderAIScreenFooter() {
2046
+ var _slot6;
2047
+ var _this12 = this;
2048
+ var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2049
+ AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2050
+ var _ref6 = AIUIConfig || {},
2051
+ _ref6$showSourceDocum = _ref6.showSourceDocuments,
2052
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2053
+ _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2054
+ sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2055
+ _ref6$onSourceClick = _ref6.onSourceClick,
2056
+ onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2057
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
2058
+ "themePreset": this.$props.themePreset
2059
+ }, {
2060
+ "default": function _default() {
2061
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2062
+ return createVNode(Button, {
2063
+ "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2064
+ "title": el[sourceDocumentLabel],
2065
+ "info": true,
2066
+ "onClick": function onClick() {
2067
+ return onSourceClick && onSourceClick(el);
2068
+ }
2069
+ }, {
2070
+ "default": function _default() {
2071
+ return [el[sourceDocumentLabel]];
2072
+ }
2073
+ });
2074
+ })) ? _slot6 : {
2075
+ "default": function _default() {
2076
+ return [_slot6];
2077
+ }
2078
+ })];
2079
+ }
2080
+ }) : null;
2081
+ },
2082
+ renderAIScreen: function renderAIScreen() {
2083
+ var _this13 = this;
2084
+ var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2085
+ if (customAIRenderer) {
2086
+ return customAIRenderer({
2087
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2088
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2089
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2090
+ loading: this.isAIResponseLoading || this.isLoading,
2091
+ sources: this.getAISourceObjects(),
2092
+ error: this.AIResponseError
2093
+ });
2094
+ }
2095
+ if (this.isAIResponseLoading || this.isLoading) {
2096
+ return this.renderAIScreenLoader();
2097
+ }
2098
+ return createVNode("div", null, [createVNode(Answer, {
2099
+ "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2100
+ }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
2101
+ "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2102
+ }, [createVNode(AIFeedback, {
2103
+ "overrideState": this.feedbackState,
2104
+ "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2105
+ "key": this.sessionIdFromStore,
2106
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2107
+ _this13.feedbackState = {
2108
+ isRecorded: true,
2109
+ feedbackType: useful ? 'positive' : 'negative'
2110
+ };
2111
+ _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2112
+ useful: useful,
2113
+ reason: reason
2114
+ });
2115
+ }
2116
+ }, null)])]);
2117
+ },
2118
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2119
+ var _this$$refs$this$$pro, _this$$refs$_inputGro;
2120
+ var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
2121
+ var inputGroupEle = (_this$$refs$_inputGro = this.$refs[_inputGroupRef]) == null ? void 0 : _this$$refs$_inputGro.$el;
2122
+ if (textArea) {
2123
+ textArea.style.height = '42px';
2124
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2125
+ var maxHeight = lineHeight * 4; // max height for 3 lines
2126
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2127
+ textArea.style.height = height + "px";
2128
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2129
+ var dropdownEle = this.$refs[_dropdownULRef];
2130
+ if (dropdownEle) {
2131
+ dropdownEle.style.top = "" + textArea.style.height;
2132
+ }
2133
+ if (inputGroupEle) {
2134
+ inputGroupEle.style.height = "" + textArea.style.height;
2135
+ }
2136
+ }
2137
+ },
2138
+ askButtonOnClick: function askButtonOnClick() {
2139
+ this.showAIScreen = true;
2140
+ this.isOpen = true;
2141
+ this.triggerDefaultQuery(this.currentValue, {
2142
+ enableAI: true
2143
+ });
2144
+ },
2145
+ renderAskButtonElement: function renderAskButtonElement() {
2146
+ var _this14 = this;
2147
+ var _this$$props4 = this.$props,
2148
+ AIUIConfig = _this$$props4.AIUIConfig,
2149
+ innerClass = _this$$props4.innerClass;
2150
+ var _ref7 = AIUIConfig || {},
2151
+ askButton = _ref7.askButton;
2152
+ var renderAskButton = this.$slots.renderAskButton;
2153
+ if (askButton) {
2154
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2155
+ if (renderAskButton) {
2156
+ return renderAskButton(_this14.askButtonOnClick);
2157
+ }
2158
+ return createVNode(Button, {
2159
+ "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2160
+ "info": true,
2161
+ "onClick": _this14.askButtonOnClick
2162
+ }, {
2163
+ "default": function _default() {
2164
+ return [createTextVNode("Ask")];
2165
+ }
2166
+ });
2167
+ };
2168
+ return createVNode("div", {
2169
+ "class": "enter-button-wrapper"
2170
+ }, [getEnterButtonMarkup()]);
2171
+ }
2172
+ return null;
2173
+ }
2174
+ },
2175
+ render: function render() {
2176
+ var _this15 = this;
2177
+ var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2178
+ var _this$$slots = this.$slots,
2179
+ recentSearchesIcon = _this$$slots.recentSearchesIcon,
2180
+ popularSearchesIcon = _this$$slots.popularSearchesIcon;
2181
+ var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2182
+ var renderItem = this.$slots.renderItem || this.$props.renderItem;
2183
+ return createVNode(Container, {
2184
+ "class": this.$props.className
2185
+ }, {
2186
+ "default": function _default() {
2187
+ return [_this15.$props.title && createVNode(Title, {
2188
+ "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
2189
+ }, {
2190
+ "default": function _default() {
2191
+ return [_this15.$props.title];
2192
+ }
2193
+ }), _this15.$props.autosuggest ? createVNode(Downshift, {
2194
+ "id": _this15.$props.componentId + "-downshift",
2195
+ "handleChange": _this15.onSuggestionSelected,
2196
+ "handleMouseup": _this15.handleStateChange,
2197
+ "isOpen": _this15.$data.isOpen
2198
+ }, {
2199
+ "default": function _default(_ref8) {
2200
+ var getInputEvents = _ref8.getInputEvents,
2201
+ getInputProps = _ref8.getInputProps,
2202
+ getItemProps = _ref8.getItemProps,
2203
+ getItemEvents = _ref8.getItemEvents,
2204
+ isOpen = _ref8.isOpen,
2205
+ highlightedIndex = _ref8.highlightedIndex,
2206
+ setHighlightedIndex = _ref8.setHighlightedIndex;
2207
+ var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
2208
+ var getIcon = function getIcon(iconType) {
2209
+ switch (iconType) {
2210
+ case suggestionTypes.Recent:
2211
+ return recentSearchesIcon;
2212
+ case suggestionTypes.Popular:
2213
+ return popularSearchesIcon;
2214
+ default:
2215
+ return null;
2216
+ }
2217
+ };
2218
+ return createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
2219
+ isOpen: isOpen,
2220
+ getItemProps: getItemProps,
2221
+ getItemEvents: getItemEvents,
2222
+ highlightedIndex: highlightedIndex
2223
+ }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2224
+ "class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2225
+ "ref": _dropdownULRef
2226
+ }, [_this15.showAIScreen && createVNode(SearchBoxAISection, {
2227
+ "themePreset": _this15.$props.themePreset
2228
+ }, {
2229
+ "default": function _default() {
2230
+ return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2231
+ }
2232
+ }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
2233
+ return renderItem ? createVNode("li", mergeProps(getItemProps({
2234
+ item: item
2235
+ }), getItemEvents({
2236
+ item: item
2237
+ }), {
2238
+ "key": index + 1 + "-" + item.value,
2239
+ "style": {
2240
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2241
+ justifyContent: 'flex-start',
2242
+ alignItems: 'center'
2243
+ }
2244
+ }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
2245
+ item: item
2246
+ }), _transformOn(getItemEvents({
2247
+ item: item
2248
+ })), {
2249
+ "key": index + 1 + "-" + item.value,
2250
+ "style": {
2251
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2252
+ justifyContent: 'flex-start',
2253
+ alignItems: 'center'
2254
+ }
2255
+ }), [createVNode("div", {
2256
+ "style": {
2257
+ padding: '0 10px 0 0',
2258
+ display: 'flex'
2259
+ }
2260
+ }, [createVNode(CustomSvg, {
2261
+ "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2262
+ "icon": getIcon(item._suggestion_type),
2263
+ "type": item._suggestion_type + "-search-icon"
2264
+ }, null)]), createVNode(SuggestionItem, {
2265
+ "currentValue": _this15.currentValue,
2266
+ "suggestion": item
2267
+ }, null), _this15.renderAutoFill(item)]);
2268
+ })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2269
+ };
2270
+ return createVNode("div", {
2271
+ "class": suggestionsContainer
2272
+ }, [createVNode(InputGroup, {
2273
+ "ref": _inputGroupRef
2274
+ }, {
2275
+ "default": function _default() {
2276
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2277
+ "default": function _default() {
2278
+ return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2279
+ onInput: _this15.onInputChange,
2280
+ onBlur: function onBlur(e) {
2281
+ _this15.$emit('blur', e, _this15.triggerQuery);
2282
+ },
2283
+ onFocus: _this15.handleFocus,
2284
+ onKeyPress: function onKeyPress(e) {
2285
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2286
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2287
+ },
2288
+ onKeyDown: function onKeyDown(e) {
2289
+ return _this15.handleKeyDown(e, highlightedIndex);
2290
+ },
2291
+ onKeyUp: function onKeyUp(e) {
2292
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2293
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2294
+ },
2295
+ onClick: function onClick() {
2296
+ setHighlightedIndex(null);
2297
+ }
2298
+ })), {
2299
+ "id": _this15.$props.componentId + "-input",
2300
+ "showIcon": _this15.$props.showIcon,
2301
+ "showClear": _this15.$props.showClear,
2302
+ "iconPosition": _this15.$props.iconPosition,
2303
+ "ref": _this15.$props.innerRef,
2304
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2305
+ "placeholder": _this15.$props.placeholder,
2306
+ "autoFocus": _this15.$props.autoFocus,
2307
+ "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2308
+ "showVoiceSearch": _this15.$props.showVoiceSearch
2309
+ }, getInputProps({
2310
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2311
+ }), {
2312
+ "themePreset": _this15.themePreset,
2313
+ "autocomplete": "off"
2314
+ }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2315
+ }
2316
+ }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
2317
+ }
2318
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
2319
+ }
2320
+ }) : createVNode("div", {
2321
+ "class": suggestionsContainer
2322
+ }, [createVNode(InputGroup, {
2323
+ "ref": _inputGroupRef
2324
+ }, {
2325
+ "default": function _default() {
2326
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2327
+ "default": function _default() {
2328
+ return [createVNode(TextArea, mergeProps(_transformOn({
2329
+ blur: function blur(e) {
2330
+ _this15.$emit('blur', e, _this15.triggerQuery);
2331
+ },
2332
+ keypress: function keypress(e) {
2333
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2334
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2335
+ },
2336
+ input: _this15.onInputChange,
2337
+ focus: function focus(e) {
2338
+ _this15.$emit('focus', e, _this15.triggerQuery);
2339
+ },
2340
+ keydown: _this15.handleKeyDown,
2341
+ keyup: function keyup(e) {
2342
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2343
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2344
+ }
2345
+ }), {
2346
+ "class": getClassName$1(_this15.$props.innerClass, 'input') || '',
2347
+ "placeholder": _this15.$props.placeholder,
2348
+ "autofocus": _this15.$props.autoFocus,
2349
+ "value": _this15.$data.currentValue ? _this15.$data.currentValue : '',
2350
+ "iconPosition": _this15.$props.iconPosition,
2351
+ "showIcon": _this15.$props.showIcon,
2352
+ "showClear": _this15.$props.showClear,
2353
+ "ref": _this15.$props.innerRef,
2354
+ "themePreset": _this15.themePreset
2355
+ }), null), _this15.renderIcons()];
2356
+ }
2357
+ }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
2358
+ }
2359
+ })])];
2360
+ }
2361
+ });
2362
+ },
2363
+ destroyed: function destroyed() {
2364
+ document.removeEventListener('keydown', this.onKeyDown);
2365
+ }
2366
+ });
2367
+ SearchBox.hasInternalComponent = function () {
2368
+ return true;
2369
+ };
2370
+ SearchBox.defaultQuery = function (value, props) {
2371
+ var finalQuery = null;
2372
+ finalQuery = {
2373
+ bool: {
2374
+ should: SearchBox.shouldQuery(value, props),
2375
+ minimum_should_match: '1'
2376
+ }
2377
+ };
2378
+ if (finalQuery && props.nestedField) {
2379
+ return {
2380
+ query: {
2381
+ nested: {
2382
+ path: props.nestedField,
2383
+ query: finalQuery
2384
+ }
2385
+ }
2386
+ };
2387
+ }
2388
+ return finalQuery;
2389
+ };
2390
+ SearchBox.shouldQuery = function (value, props) {
2391
+ return {
2392
+ query: {
2393
+ queryFormat: props.queryFormat,
2394
+ dataField: props.dataField,
2395
+ value: value,
2396
+ nestedField: props.nestedField,
2397
+ queryString: props.queryString,
2398
+ searchOperators: props.searchOperators
2399
+ }
2400
+ };
2401
+ };
2402
+ var mapStateToProps = function mapStateToProps(state, props) {
2403
+ return {
2404
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2405
+ selectedCategory: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].category || null,
2406
+ suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
2407
+ rawData: state.rawData[props.componentId],
2408
+ aggregationData: state.compositeAggregations[props.componentId] || [],
2409
+ themePreset: state.config.themePreset,
2410
+ isLoading: !!state.isLoading["" + props.componentId],
2411
+ error: state.error[props.componentId],
2412
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
2413
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
2414
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2415
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
2416
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2417
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2418
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
2419
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
2420
+ };
2421
+ };
2422
+ var mapDispatchToProps = {
2423
+ updateQuery: updateQuery,
2424
+ setCustomQuery: setCustomQuery,
2425
+ setDefaultQuery: setDefaultQuery,
2426
+ recordSuggestionClick: recordSuggestionClick,
2427
+ recordAISessionUsefulness: recordAISessionUsefulness
2428
+ };
2429
+ var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
2430
+ componentType: componentTypes.searchBox,
2431
+ internalComponent: true
2432
+ }));
2433
+ SBConnected.name = SearchBox.name;
2434
+ SBConnected.defaultQuery = SearchBox.defaultQuery;
2435
+ SBConnected.shouldQuery = SearchBox.shouldQuery;
2436
+ SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
2437
+ SBConnected.install = function (Vue) {
2438
+ Vue.component(SBConnected.name, SBConnected);
2439
+ };
2440
+ // Add componentType for SSR
2441
+ SBConnected.componentType = componentTypes.searchBox;
2442
+
2443
+ function _isSlot$1(s) {
2444
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2445
+ }
2446
+ var md$1 = new Remarkable();
2447
+ md$1.set({
2448
+ html: true,
2449
+ breaks: true,
2450
+ xhtmlOut: true
2451
+ });
2452
+ var _inputWrapperRef = 'inputWrapperRef';
2453
+ var _inputRef = 'inputRef';
2454
+ var _errorContainerRef = 'errorContainerRef';
2455
+ var AIAnswer = defineComponent({
2456
+ name: 'AIAnswer',
2457
+ data: function data() {
2458
+ var props = this.$props;
2459
+ this.__state = {
2460
+ messages: [],
2461
+ inputMessage: '',
2462
+ AISessionId: '',
2463
+ error: null
2464
+ };
2465
+ this.internalComponent = props.componentId + "__internal";
2466
+ return this.__state;
2467
+ },
2468
+ inject: {
2469
+ theme: {
2470
+ from: 'theme_reactivesearch'
2471
+ }
2472
+ },
2473
+ created: function created() {},
2474
+ computed: {
2475
+ hasCustomRenderer: function hasCustomRenderer$1() {
2476
+ return hasCustomRenderer(this);
2477
+ },
2478
+ isLoadingState: function isLoadingState() {
2479
+ return this.isAIResponseLoading || this.isLoading;
2480
+ },
2481
+ shouldShowComponent: function shouldShowComponent() {
2482
+ return this.showComponent;
2483
+ }
2484
+ },
2485
+ props: {
2486
+ componentId: types.string.isRequired,
2487
+ showVoiceInput: VueTypes.bool.def(false),
2488
+ showFeedback: VueTypes.bool.def(true),
2489
+ showIcon: VueTypes.bool.def(true),
2490
+ onData: types.func,
2491
+ innerRef: VueTypes.string.def('AISearchInputField'),
2492
+ react: types.react,
2493
+ enableAI: VueTypes.bool.def(true),
2494
+ AIConfig: types.AIConfig,
2495
+ iconPosition: types.iconPosition.def('left'),
2496
+ themePreset: types.themePreset,
2497
+ theme: types.style,
2498
+ icon: types.children,
2499
+ iconURL: VueTypes.string.def(''),
2500
+ renderMic: types.func,
2501
+ getMicInstance: types.func,
2502
+ innerClass: types.style,
2503
+ placeholder: VueTypes.string.def('Ask a question'),
2504
+ title: types.title,
2505
+ AIResponse: types.componentObject,
2506
+ isAIResponseLoading: VueTypes.bool.def(false),
2507
+ AIResponseError: types.componentObject,
2508
+ getAIResponse: types.func.isRequired,
2509
+ enterButton: types.bool,
2510
+ renderEnterButton: types.title,
2511
+ showInput: VueTypes.bool.def(true),
2512
+ clearSessionOnDestroy: VueTypes.bool.def(true),
2513
+ rawData: types.rawData,
2514
+ render: types.func,
2515
+ onError: types.func,
2516
+ renderError: types.title,
2517
+ isLoading: types.boolRequired,
2518
+ sessionIdFromStore: VueTypes.string,
2519
+ showComponent: types.boolRequired
2520
+ },
2521
+ mounted: function mounted() {},
2522
+ watch: {
2523
+ AIResponse: function AIResponse(newVal) {
2524
+ if (newVal) {
2525
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2526
+ var messagesHistory = newVal.messages,
2527
+ response = newVal.response;
2528
+ var finalMessages = [];
2529
+ if (response && response.error) {
2530
+ this.error = {
2531
+ message: response.error
2532
+ };
2533
+ }
2534
+
2535
+ // pushing message history so far
2536
+ if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
2537
+ finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2538
+ return msg.role !== AI_ROLES.SYSTEM;
2539
+ }));
2540
+ }
2541
+ // fresh response
2542
+ if (response && response.answer) ;
2543
+ this.messages = finalMessages;
2544
+ } else if (!newVal && !this.error) {
2545
+ this.messages = [];
2546
+ }
2547
+ },
2548
+ rawData: function rawData(newVal) {
2549
+ this.$emit('on-data', {
2550
+ data: this.messages,
2551
+ rawData: newVal,
2552
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2553
+ error: this.$props.AIResponseError
2554
+ });
2555
+ },
2556
+ isAIResponseLoading: function isAIResponseLoading(newVal) {
2557
+ this.isLoadingState = newVal;
2558
+ this.$emit('on-data', {
2559
+ data: this.messages,
2560
+ rawData: this.$props.rawData,
2561
+ loading: newVal || this.$props.isLoading,
2562
+ error: this.$props.AIResponseError
2563
+ });
2564
+ },
2565
+ isLoading: function isLoading(newVal) {
2566
+ this.isLoadingState = newVal;
2567
+ this.$emit('on-data', {
2568
+ data: this.messages,
2569
+ rawData: this.$props.rawData,
2570
+ loading: newVal || this.$props.isLoading,
2571
+ error: this.$props.AIResponseError
2572
+ });
2573
+ },
2574
+ sessionIdFromStore: function sessionIdFromStore(newVal) {
2575
+ if (newVal) {
2576
+ this.sessionId = newVal;
2577
+ }
2578
+ },
2579
+ AIResponseError: function AIResponseError(newVal) {
2580
+ this.error = newVal;
2581
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2582
+ this.$emit('on-data', {
2583
+ data: this.messages,
2584
+ rawData: this.$props.rawData,
2585
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2586
+ error: newVal
2587
+ });
2588
+ },
2589
+ messages: function messages() {
2590
+ this.scrollToBottom();
2591
+ }
2592
+ },
2593
+ methods: {
2594
+ scrollToBottom: function scrollToBottom() {
2595
+ var _this = this;
2596
+ this.$nextTick(function () {
2597
+ var _this$$refs;
2598
+ var messageContainer = (_this$$refs = _this.$refs) == null ? void 0 : _this$$refs[_this.$props.innerRef];
2599
+ if (messageContainer && messageContainer.$el) {
2600
+ messageContainer.$el.scrollTo({
2601
+ top: messageContainer.$el.scrollHeight,
2602
+ behavior: 'smooth'
2603
+ });
2604
+ }
2605
+ });
2606
+ },
2607
+ handleMessageInputChange: function handleMessageInputChange(e) {
2608
+ this.inputMessage = e.target.value;
2609
+ this.handleTextAreaHeightChange();
2610
+ },
2611
+ handleSendMessage: function handleSendMessage(e, isRetry, text) {
2612
+ if (isRetry === void 0) {
2613
+ isRetry = false;
2614
+ }
2615
+ if (text === void 0) {
2616
+ text = this.inputMessage;
2617
+ }
2618
+ if (typeof e === 'object') e.preventDefault();
2619
+ if (text.trim()) {
2620
+ if (this.isLoadingState) {
2621
+ return;
2622
+ }
2623
+ if (this.AISessionId) {
2624
+ if (!isRetry) this.messages = [].concat(this.messages, [{
2625
+ content: text,
2626
+ role: AI_ROLES.USER
2627
+ }]);
2628
+ this.getAIResponse(this.AISessionId, this.componentId, text);
2629
+ } else {
2630
+ console.error("AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2631
+ this.error = {
2632
+ message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Trying reloading the App."
2633
+ };
2634
+ }
2635
+ this.inputMessage = '';
2636
+ }
2637
+ },
2638
+ handleRetryRequest: function handleRetryRequest() {
2639
+ if (this.messages && !this.isLoadingState) {
2640
+ var _this$messages;
2641
+ var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
2642
+ if (this.AISessionId) {
2643
+ this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
2644
+ this.inputMessage = '';
2645
+ } else {
2646
+ console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2647
+ }
2648
+ }
2649
+ },
2650
+ renderErrorComponent: function renderErrorComponent() {
2651
+ var renderError = this.$slots.renderError || this.$props.renderError;
2652
+ if (this.error && !this.isLoadingState) {
2653
+ var _this$error, _this$error2;
2654
+ if (renderError) {
2655
+ return createVNode("div", {
2656
+ "ref": _errorContainerRef,
2657
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2658
+ }, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
2659
+ }
2660
+ return createVNode("div", {
2661
+ "ref": _errorContainerRef,
2662
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2663
+ }, [createVNode("div", {
2664
+ "class": "--default-error-element"
2665
+ }, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
2666
+ "primary": true,
2667
+ "onClick": this.handleRetryRequest
2668
+ }, {
2669
+ "default": function _default() {
2670
+ return [createTextVNode("Try again")];
2671
+ }
2672
+ })])]);
2673
+ }
2674
+ return null;
2675
+ },
2676
+ handleKeyPress: function handleKeyPress(e) {
2677
+ if (e.key === 'Enter') {
2678
+ this.handleSendMessage(e);
2679
+ this.inputMessage = '';
2680
+ }
2681
+ },
2682
+ renderIcon: function renderIcon() {
2683
+ if (this.$props.showIcon) {
2684
+ if (this.$props.icon) {
2685
+ return this.$props.icon;
2686
+ }
2687
+ if (this.$slots.icon) {
2688
+ return this.$slots.icon();
2689
+ }
2690
+ if (this.$props.iconURL) {
2691
+ return createVNode("img", {
2692
+ "style": {
2693
+ maxHeight: '25px'
2694
+ },
2695
+ "src": this.$props.iconURL,
2696
+ "alt": "search-icon"
2697
+ }, null);
2698
+ }
2699
+ return createVNode(SearchSvg, null, null);
2700
+ }
2701
+ return null;
2702
+ },
2703
+ shouldMicRender: function shouldMicRender(showVoiceSearch) {
2704
+ // checks for SSR
2705
+ if (typeof window === 'undefined') return false;
2706
+ return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
2707
+ },
2708
+ handleVoiceResults: function handleVoiceResults(_ref) {
2709
+ var results = _ref.results;
2710
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
2711
+ this.handleSendMessage(null, false, results[0][0].transcript.trim());
2712
+ }
2713
+ },
2714
+ renderIcons: function renderIcons() {
2715
+ var _this2 = this;
2716
+ var _slot, _slot2;
2717
+ var _this$$props = this.$props,
2718
+ getMicInstance = _this$$props.getMicInstance,
2719
+ showVoiceInput = _this$$props.showVoiceInput,
2720
+ iconPosition = _this$$props.iconPosition,
2721
+ innerClass = _this$$props.innerClass;
2722
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
2723
+ return createVNode("div", null, [createVNode(IconGroup, {
2724
+ "enableAI": true,
2725
+ "groupPosition": "right",
2726
+ "positionType": "absolute"
2727
+ }, {
2728
+ "default": function _default() {
2729
+ return [_this2.shouldMicRender(showVoiceInput) && createVNode(Mic, {
2730
+ "getInstance": getMicInstance,
2731
+ "render": renderMic,
2732
+ "onResult": _this2.handleVoiceResults,
2733
+ "class": getClassName$2(innerClass, 'ai-search-mic') || null
2734
+ }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this2.renderIcon()) ? _slot : {
2735
+ "default": function _default() {
2736
+ return [_slot];
2737
+ }
2738
+ })];
2739
+ }
2740
+ }), createVNode(IconGroup, {
2741
+ "enableAI": true,
2742
+ "groupPosition": "left",
2743
+ "positionType": "absolute"
2744
+ }, {
2745
+ "default": function _default() {
2746
+ return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this2.renderIcon()) ? _slot2 : {
2747
+ "default": function _default() {
2748
+ return [_slot2];
2749
+ }
2750
+ })];
2751
+ }
2752
+ })]);
2753
+ },
2754
+ enterButtonOnClick: function enterButtonOnClick(e) {
2755
+ this.handleSendMessage(e);
2756
+ },
2757
+ renderEnterButtonElement: function renderEnterButtonElement() {
2758
+ var _this3 = this;
2759
+ var _this$$props2 = this.$props,
2760
+ enterButton = _this$$props2.enterButton,
2761
+ innerClass = _this$$props2.innerClass;
2762
+ var renderEnterButton = this.$slots.renderEnterButton;
2763
+ if (enterButton) {
2764
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2765
+ if (renderEnterButton) {
2766
+ return renderEnterButton(_this3.enterButtonOnClick);
2767
+ }
2768
+ return createVNode(SendButton, {
2769
+ "primary": true,
2770
+ "type": "submit",
2771
+ "tabIndex": 0,
2772
+ "onClick": _this3.handleSendMessage,
2773
+ "onKeyPress": _this3.handleKeyPress,
2774
+ "class": "enter-btn " + getClassName$2(innerClass, 'ai-enter-button')
2775
+ }, {
2776
+ "default": function _default() {
2777
+ return [createTextVNode("Send")];
2778
+ }
2779
+ });
2780
+ };
2781
+ return createVNode("div", {
2782
+ "class": "ai-enter-button-wrapper"
2783
+ }, [getEnterButtonMarkup()]);
2784
+ }
2785
+ return null;
2786
+ },
2787
+ getComponent: function getComponent$1() {
2788
+ var data = {
2789
+ error: this.AIResponseError,
2790
+ loading: this.isAIResponseLoading,
2791
+ data: this.messages,
2792
+ rawData: this.rawData
2793
+ };
2794
+ return getComponent(data, this);
2795
+ },
2796
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2797
+ var _this$$refs2, _this$$refs2$_inputRe, _this$$refs3, _this$$refs3$_inputWr, _this$$refs4;
2798
+ var textArea = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputRe = _this$$refs2[_inputRef]) == null ? void 0 : _this$$refs2$_inputRe.$el;
2799
+ var inputWrapper = (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$_inputWr = _this$$refs3[_inputWrapperRef]) == null ? void 0 : _this$$refs3$_inputWr.$el;
2800
+ var errorContainer = (_this$$refs4 = this.$refs) == null ? void 0 : _this$$refs4[_errorContainerRef];
2801
+ if (textArea) {
2802
+ textArea.style.height = '42px';
2803
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2804
+ var maxHeight = lineHeight * 11; // max height for 10 lines
2805
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2806
+ textArea.style.height = height + "px";
2807
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2808
+ // wrapper around input/ textarea
2809
+ inputWrapper.style.height = height + "px";
2810
+ // adjust error-container
2811
+
2812
+ if (errorContainer) {
2813
+ errorContainer.style.bottom = height + "px";
2814
+ }
2815
+ this.$forceUpdate();
2816
+ }
2817
+ }
2818
+ },
2819
+ beforeUnmount: function beforeUnmount() {
2820
+ if (this.$props.clearSessionOnDestroy) {
2821
+ // cleanup logic
2822
+ // final Object to store in local storage cache
2823
+ var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
2824
+ // delete current component's cache
2825
+ delete finalCacheObj[this.$props.componentId];
2826
+ // update local cache
2827
+ setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
2828
+ }
2829
+ },
2830
+ render: function render() {
2831
+ var _slot3;
2832
+ var _this4 = this;
2833
+ var props = this.$props;
2834
+ if (!this.shouldShowComponent) {
2835
+ return null;
2836
+ }
2837
+ return createVNode(Chatbox, null, {
2838
+ "default": function _default() {
2839
+ return [_this4.$props.title && createVNode(Title, {
2840
+ "class": getClassName$2(_this4.$props.innerClass, 'title') || ''
2841
+ }, {
2842
+ "default": function _default() {
2843
+ return [_this4.$props.title];
2844
+ }
2845
+ }), createVNode(ChatContainer, {
2846
+ "theme": props.theme,
2847
+ "showInput": props.showInput
2848
+ }, {
2849
+ "default": function _default() {
2850
+ return [_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2851
+ "themePreset": _this4.themePreset,
2852
+ "theme": props.theme,
2853
+ "ref": _this4.$props.innerRef,
2854
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2855
+ }, _isSlot$1(_slot3 = _this4.getComponent()) ? _slot3 : {
2856
+ "default": function _default() {
2857
+ return [_slot3];
2858
+ }
2859
+ }), !_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2860
+ "themePreset": _this4.themePreset,
2861
+ "theme": props.theme,
2862
+ "ref": _this4.$props.innerRef,
2863
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2864
+ }, {
2865
+ "default": function _default() {
2866
+ return [_this4.messages.map(function (message, index) {
2867
+ return createVNode(Message, {
2868
+ "key": index,
2869
+ "isSender": message.role === AI_ROLES.USER,
2870
+ "innerHTML": md$1.render(message.content),
2871
+ "themePreset": _this4.themePreset,
2872
+ "theme": props.theme,
2873
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
2874
+ }, null);
2875
+ }), _this4.isLoadingState && createVNode(Message, {
2876
+ "themePreset": _this4.themePreset,
2877
+ "theme": props.theme,
2878
+ "isSender": false,
2879
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
2880
+ }, {
2881
+ "default": function _default() {
2882
+ return [createVNode(TypingIndicator, null, {
2883
+ "default": function _default() {
2884
+ return [createVNode(TypingDot, {
2885
+ "themePreset": _this4.themePreset
2886
+ }, null), createVNode(TypingDot, {
2887
+ "themePreset": _this4.themePreset
2888
+ }, null), createVNode(TypingDot, {
2889
+ "themePreset": _this4.themePreset
2890
+ }, null)];
2891
+ }
2892
+ })];
2893
+ }
2894
+ })];
2895
+ }
2896
+ }), _this4.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
2897
+ "class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
2898
+ }, [createVNode(AIFeedback, {
2899
+ "hideUI": _this4.isLoadingState || !_this4.sessionId,
2900
+ "key": _this4.sessionId,
2901
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2902
+ _this4.trackUsefullness(_this4.sessionId, {
2903
+ useful: useful,
2904
+ reason: reason
2905
+ });
2906
+ }
2907
+ }, null)]), props.showInput && createVNode(MessageInputContainer, {
2908
+ "class": "--ai-input-container",
2909
+ "onSubmit": _this4.handleSendMessage
2910
+ }, {
2911
+ "default": function _default() {
2912
+ return [createVNode(InputGroup, {
2913
+ "enableAI": true,
2914
+ "isOpen": false
2915
+ }, {
2916
+ "default": function _default() {
2917
+ return [createVNode(InputWrapper, {
2918
+ "ref": _inputWrapperRef
2919
+ }, {
2920
+ "default": function _default() {
2921
+ return [createVNode(MessageInput, {
2922
+ "ref": _inputRef,
2923
+ "type": "text",
2924
+ "placeholder": props.placeholder,
2925
+ "enterButton": props.enterButton,
2926
+ "value": _this4.inputMessage,
2927
+ "onInput": _this4.handleMessageInputChange,
2928
+ "onKeyPress": _this4.handleKeyPress,
2929
+ "id": props.componentId + "-ai-input",
2930
+ "showIcon": props.showIcon,
2931
+ "iconPosition": props.iconPosition,
2932
+ "themePreset": _this4.themePreset,
2933
+ "disabled": _this4.isLoadingState,
2934
+ "class": getClassName$2(props.innerClass, 'ai-input') || null
2935
+ }, null), ' ', _this4.renderIcons()];
2936
+ }
2937
+ })];
2938
+ }
2939
+ }), _this4.renderEnterButtonElement()];
2940
+ }
2941
+ }), ' '];
2942
+ }
2943
+ })];
2944
+ }
2945
+ });
2946
+ }
2947
+ });
2948
+ AIAnswer.hasInternalComponent = function () {
2949
+ return true;
2950
+ };
2951
+ var mapStateToProps$1 = function mapStateToProps(state, props) {
2952
+ var dependencyComponent = Object.values(props.react)[0];
2953
+ if (Array.isArray(dependencyComponent)) {
2954
+ // eslint-disable-next-line prefer-destructuring
2955
+ dependencyComponent = dependencyComponent[0];
2956
+ }
2957
+ var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
2958
+ return {
2959
+ showComponent: showComponent,
2960
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
2961
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2962
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2963
+ rawData: state.rawData[props.componentId],
2964
+ themePreset: state.config.themePreset,
2965
+ isLoading: state.isLoading[props.componentId] || false,
2966
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || ''
2967
+ };
2968
+ };
2969
+ var mapDispatchToProps$1 = {
2970
+ getAIResponse: fetchAIResponse,
2971
+ trackUsefullness: recordAISessionUsefulness
2972
+ };
2973
+ var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
2974
+ componentType: componentTypes.AIAnswer,
2975
+ internalComponent: true
2976
+ }));
2977
+ AIConnected.name = AIAnswer.name;
2978
+ AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
2979
+ AIConnected.install = function (Vue) {
2980
+ Vue.component(AIConnected.name, AIConnected);
2981
+ };
2982
+ // Add componentType for SSR
2983
+ AIConnected.componentType = componentTypes.AIAnswer;
2984
+
2985
+ var _templateObject$b, _templateObject2$4;
2986
+ var HierarchicalMenuList = styled('ul')(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
2987
+ var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
2988
+ return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
2989
+ });
2990
+
2991
+ var HierarchicalMenuListItemComponent = {
2992
+ name: 'HierarchicalMenuListItemComponent',
2993
+ data: function data() {
2994
+ return {
2995
+ isExpanded: false,
2996
+ newParentPath: ''
2997
+ };
2998
+ },
2999
+ created: function created() {
3000
+ var listItemLabel = this.listItem.key;
3001
+ var newParentPath = listItemLabel;
3002
+ if (this.parentPath) {
3003
+ newParentPath = "" + this.parentPath + TREELIST_VALUES_PATH_SEPARATOR + listItemLabel;
3004
+ }
3005
+ this.newParentPath = newParentPath;
3006
+ this.isExpanded = !!recLookup(this.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3007
+ },
3008
+ watch: {
3009
+ listItem: function listItem(newVal) {
3010
+ if (newVal.initiallyExpanded) {
3011
+ this.isExpanded = newVal.initiallyExpanded;
3012
+ }
3013
+ },
3014
+ selectedValues: function selectedValues(newVal) {
3015
+ this.isExpanded = !!recLookup(newVal, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3016
+ }
3017
+ },
3018
+ props: {
3019
+ parentPath: types$1.string,
3020
+ selectedValues: types$1.rawData,
3021
+ mode: types$1.string,
3022
+ searchTerm: types$1.string,
3023
+ listItem: types$1.rawData,
3024
+ showLine: types$1.bool,
3025
+ renderItem: types$1.func,
3026
+ handleListItemClick: types$1.func,
3027
+ renderSwitcherIcon: types$1.func,
3028
+ showCheckbox: VueTypes.bool,
3029
+ innerClass: types$1.style,
3030
+ showRadio: VueTypes.bool,
3031
+ renderIcon: types$1.func,
3032
+ showCount: VueTypes.bool,
3033
+ showSwitcherIcon: types$1.bool,
3034
+ switcherIcon: types$1.children
3035
+ },
3036
+ render: function render() {
3037
+ var _this = this;
3038
+ var _this$$props = this.$props,
3039
+ selectedValues = _this$$props.selectedValues,
3040
+ mode = _this$$props.mode,
3041
+ searchTerm = _this$$props.searchTerm,
3042
+ listItem = _this$$props.listItem,
3043
+ parentPath = _this$$props.parentPath,
3044
+ showLine = _this$$props.showLine,
3045
+ renderItem = _this$$props.renderItem,
3046
+ handleListItemClick = _this$$props.handleListItemClick,
3047
+ showCheckbox = _this$$props.showCheckbox,
3048
+ innerClass = _this$$props.innerClass,
3049
+ showRadio = _this$$props.showRadio,
3050
+ renderIcon = _this$$props.renderIcon,
3051
+ showCount = _this$$props.showCount,
3052
+ showSwitcherIcon = _this$$props.showSwitcherIcon;
3053
+ if (!(listItem instanceof Object) || Object.keys(listItem).length === 0) {
3054
+ return null;
3055
+ }
3056
+ var listItemLabel = listItem.key;
3057
+ var listItemCount = listItem.count;
3058
+ var isLeafNode = !(Array.isArray(listItem.list) && listItem.list.length > 0);
3059
+ var renderSwitcherIcon = function renderSwitcherIcon(isExpandedProp) {
3060
+ if (showSwitcherIcon === false) {
3061
+ return null;
3062
+ }
3063
+ var switcherIcon = _this.$props.switcherIcon;
3064
+ if (switcherIcon) return switcherIcon(isExpandedProp);
3065
+ return (
3066
+ /* eslint-disable jsx-a11y/click-events-have-key-events
3067
+ , jsx-a11y/no-static-element-interactions,jsx-a11y/no-noninteractive-tabindex */
3068
+ createVNode("span", {
3069
+ "tabIndex": "0",
3070
+ "onClick": function onClick(e) {
3071
+ e.stopPropagation();
3072
+ _this.isExpanded = !_this.isExpanded;
3073
+ },
3074
+ "class": "--switcher-icon"
3075
+ }, [createTextVNode("\u27A4")])
3076
+ );
3077
+ };
3078
+ var isSelected = false;
3079
+ if (mode === 'single') {
3080
+ if (recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR) === true) {
3081
+ isSelected = true;
3082
+ }
3083
+ } else {
3084
+ isSelected = !!recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3085
+ }
3086
+ return createVNode(HierarchicalMenuListItem, {
3087
+ "class": (isSelected ? '-selected-item' : '') + " " + (this.isExpanded ? '-expanded-item' : ''),
3088
+ "key": this.newParentPath,
3089
+ "showLine": showLine
3090
+ }, {
3091
+ "default": function _default() {
3092
+ return [createVNode(ListItem, {
3093
+ "isTreeListItem": true,
3094
+ "onClick": function onClick() {
3095
+ handleListItemClick(listItemLabel, parentPath);
3096
+ },
3097
+ "style": {
3098
+ textDecoration: 'none'
3099
+ }
3100
+ }, {
3101
+ "default": function _default() {
3102
+ return [renderItem ? renderItem(listItemLabel, listItemCount, isSelected) : createVNode(Flex, {
3103
+ "alignItems": "center",
3104
+ "gap": "5px"
3105
+ }, {
3106
+ "default": function _default() {
3107
+ return [!isLeafNode && renderSwitcherIcon(isSelected), mode === 'multiple' && showCheckbox && createVNode(Flex, {
3108
+ "alignItems": "center",
3109
+ "gap": "5px"
3110
+ }, {
3111
+ "default": function _default() {
3112
+ return [createVNode(Checkbox, {
3113
+ "type": "checkbox",
3114
+ "class": getClassName$2(innerClass, 'checkbox') || null,
3115
+ "checked": isSelected,
3116
+ "id": listItemLabel + "-checkbox-" + _this.newParentPath,
3117
+ "name": listItemLabel + "-checkbox-" + _this.newParentPath,
3118
+ "show": true,
3119
+ "readOnly": true
3120
+ }, null), createVNode("label", {
3121
+ "style": {
3122
+ width: '26px',
3123
+ marginTop: 0,
3124
+ marginBottom: 0,
3125
+ marginRight: '-9px',
3126
+ left: '-3px'
3127
+ },
3128
+ "htmlFor": listItemLabel + "-checkbox-" + _this.newParentPath,
3129
+ "onClick": function onClick(e) {
3130
+ e.stopPropagation();
3131
+ }
3132
+ }, null)];
3133
+ }
3134
+ }), mode === 'single' && showRadio && createVNode(Flex, {
3135
+ "alignItems": "center",
3136
+ "gap": "5px"
3137
+ }, {
3138
+ "default": function _default() {
3139
+ return [createVNode(Radio, {
3140
+ "checked": isSelected,
3141
+ "class": getClassName$2(innerClass, 'radio') || null,
3142
+ "id": listItemLabel + "-radio-" + _this.newParentPath,
3143
+ "name": listItemLabel + "-radio-" + _this.newParentPath,
3144
+ "show": true,
3145
+ "readOnly": true,
3146
+ "type": "radio"
3147
+ }, null), createVNode("label", {
3148
+ "style": {
3149
+ width: '26px',
3150
+ marginTop: 0,
3151
+ marginBottom: 0,
3152
+ marginRight: '-9px',
3153
+ left: '-3px'
3154
+ },
3155
+ "htmlFor": listItemLabel + "-radio-" + _this.newParentPath,
3156
+ "onClick": function onClick(e) {
3157
+ e.stopPropagation();
3158
+ }
3159
+ }, null)];
3160
+ }
3161
+ }), ' ', renderIcon(isLeafNode), createVNode("div", {
3162
+ "class": "--list-item-label-count-wrapper"
3163
+ }, [createVNode("span", {
3164
+ "class": "--list-item-label " + (getClassName$2(innerClass, 'label') || '')
3165
+ }, [listItemLabel]), showCount && createVNode("span", {
3166
+ "class": "--list-item-count " + (getClassName$2(innerClass, 'count') || '')
3167
+ }, [listItemCount])])];
3168
+ }
3169
+ })];
3170
+ }
3171
+ }), isLeafNode === false && createVNode("div", {
3172
+ "class": "--list-child " + (showSwitcherIcon ? ' --show-switcher-icon' : '')
3173
+ }, [createVNode(HierarchicalMenuComponent, {
3174
+ "key": _this.newParentPath + "-" + listItemLabel + "-" + listItemCount,
3175
+ "listArray": listItem.list,
3176
+ "parentPath": _this.newParentPath,
3177
+ "isExpanded": _this.isExpanded,
3178
+ "listItemProps": {
3179
+ mode: mode,
3180
+ selectedValues: selectedValues,
3181
+ searchTerm: searchTerm,
3182
+ showLine: showLine,
3183
+ renderItem: renderItem,
3184
+ handleListItemClick: handleListItemClick,
3185
+ renderSwitcherIcon: renderSwitcherIcon,
3186
+ showCheckbox: showCheckbox,
3187
+ innerClass: innerClass,
3188
+ showRadio: showRadio,
3189
+ renderIcon: renderIcon,
3190
+ showCount: showCount,
3191
+ showSwitcherIcon: showSwitcherIcon,
3192
+ switcherIcon: _this.$props.switcherIcon
3193
+ }
3194
+ }, null)])];
3195
+ }
3196
+ });
3197
+ }
3198
+ };
3199
+
3200
+ function _isSlot$2(s) {
3201
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3202
+ }
3203
+ var HierarchicalMenuComponent = {
3204
+ name: 'HierarchicalMenuComponent',
3205
+ props: {
3206
+ listArray: VueTypes.arrayOf(VueTypes.object),
3207
+ // array of objects
3208
+ parentPath: VueTypes.string.def(''),
3209
+ isExpanded: VueTypes.bool.def(false),
3210
+ listItemProps: types$1.rawData
3211
+ },
3212
+ render: function render() {
3213
+ var _slot;
3214
+ var _this$$props = this.$props,
3215
+ listArray = _this$$props.listArray,
3216
+ isExpanded = _this$$props.isExpanded,
3217
+ parentPath = _this$$props.parentPath,
3218
+ listItemProps = _this$$props.listItemProps;
3219
+ if (!Array.isArray(listArray) || listArray.length === 0) {
3220
+ return null;
3221
+ }
3222
+ return createVNode(HierarchicalMenuList, {
3223
+ "class": "" + (isExpanded ? '--open' : ''),
3224
+ "isSelected": isExpanded
3225
+ }, _isSlot$2(_slot = listArray.map(function (listItem) {
3226
+ return createVNode(HierarchicalMenuListItemComponent, mergeProps({
3227
+ "key": parentPath + "__" + JSON.stringify(listItem),
3228
+ "parentPath": parentPath,
3229
+ "listItem": listItem
3230
+ }, listItemProps), null);
3231
+ })) ? _slot : {
3232
+ "default": function _default() {
3233
+ return [_slot];
3234
+ }
3235
+ });
3236
+ }
3237
+ };
3238
+
3239
+ function _isSlot$3(s) {
3240
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3241
+ }
3242
+ var updateQueryAction = Actions.updateQuery,
3243
+ setQueryOptions = Actions.setQueryOptions;
3244
+ var transformValueIntoLocalState = function transformValueIntoLocalState(valueArray) {
3245
+ var valueToSet = {};
3246
+ if (valueArray.length) {
3247
+ var newSelectedValues = {};
3248
+ valueArray.forEach(function (valueItem) {
3249
+ setDeep(newSelectedValues, valueItem.split(' > '), !recLookup(newSelectedValues, valueItem.split(' > '), TREELIST_VALUES_PATH_SEPARATOR), true);
3250
+ });
3251
+ valueToSet = newSelectedValues;
3252
+ }
3253
+ return valueToSet;
3254
+ };
3255
+ var TreeList = {
3256
+ name: 'TreeList',
3257
+ props: {
3258
+ selectedValue: types.selectedValue,
3259
+ error: types.title,
3260
+ rawData: types.rawData,
3261
+ aggregationData: types.rawData,
3262
+ themePreset: types.themePreset,
3263
+ updateQueryAction: types.funcRequired,
3264
+ setQueryOptions: types.funcRequired,
3265
+ // component props
3266
+ componentId: types.string.isRequired,
3267
+ className: types.string,
3268
+ style: types.style,
3269
+ showRadio: VueTypes.bool.def(false),
3270
+ showCheckbox: types.bool.def(false),
3271
+ mode: VueTypes.oneOf(['single', 'multiple']).def('multiple'),
3272
+ showCount: VueTypes.bool.def(false),
3273
+ showSearch: VueTypes.bool.def(false),
3274
+ showIcon: VueTypes.bool.def(false),
3275
+ icon: types.children,
3276
+ showLeafIcon: VueTypes.bool.def(false),
3277
+ leafIcon: types.children,
3278
+ showLine: VueTypes.bool.def(false),
3279
+ switcherIcon: types.func,
3280
+ render: types.func,
3281
+ renderItem: types.func,
3282
+ innerClass: types.style,
3283
+ placeholder: types.string,
3284
+ title: types.title,
3285
+ isLoading: types.bool,
3286
+ dataField: types.stringArray.isRequired,
3287
+ onQueryChange: types.func,
3288
+ defaultValue: types.stringArray,
3289
+ value: types.stringArray,
3290
+ customQuery: types.func,
3291
+ defaultQuery: types.func,
3292
+ enableAppbase: types.bool,
3293
+ index: types.string,
3294
+ showFilter: types.bool,
3295
+ URLParams: types.bool,
3296
+ filterLabel: types.string,
3297
+ onChange: types.func,
3298
+ onValueChange: types.func,
3299
+ beforeValueChange: types.func,
3300
+ sortBy: types.sortByWithCount.def('count'),
3301
+ onError: types.func,
3302
+ showSwitcherIcon: types.bool.def(true),
3303
+ renderError: types.title,
3304
+ renderNoResults: types.func,
3305
+ loader: types.title,
3306
+ aggergationSize: types.number,
3307
+ endpoint: types.endpoint,
3308
+ queryFormat: types.queryFormatSearch.def('or'),
3309
+ size: types.number.def(100),
3310
+ nestedField: types.string,
3311
+ react: types.react,
3312
+ transformData: types.func,
3313
+ selectAllLabel: types.string,
3314
+ showMissing: VueTypes.bool.def(false),
3315
+ missingLabel: VueTypes.string.def('N/A')
3316
+ },
3317
+ data: function data() {
3318
+ var props = this.$props;
3319
+ this.__state = {
3320
+ selectedValues: {},
3321
+ searchTerm: '',
3322
+ aggregationData: []
3323
+ };
3324
+ this.internalComponent = props.componentId + "__internal";
3325
+ return this.__state;
3326
+ },
3327
+ created: function created() {
3328
+ var props = this.$props;
3329
+ var componentId = props.componentId;
3330
+ var defaultValue = this.defaultValue || this.value;
3331
+ var currentValueArray = this.selectedValue || defaultValue || [];
3332
+ // update local state for selected values
3333
+ if (currentValueArray.length) {
3334
+ var newSelectedValues = transformValueIntoLocalState(currentValueArray);
3335
+ this.setValue(newSelectedValues, true);
3336
+ }
3337
+
3338
+ // Set custom and default queries in store
3339
+ updateCustomQuery$1(componentId, props, currentValueArray);
3340
+ updateDefaultQuery$1(componentId, props, currentValueArray);
3341
+ this.updateQueryOptions();
3342
+ },
3343
+ mounted: function mounted() {
3344
+ var _this$$props = this.$props,
3345
+ enableAppbase = _this$$props.enableAppbase,
3346
+ index = _this$$props.index;
3347
+ if (!enableAppbase && index) {
3348
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
3349
+ }
3350
+ },
3351
+ watch: {
3352
+ defaultQuery: function defaultQuery() {
3353
+ this.updateDefaultQuery();
3354
+ this.updateQuery([]);
3355
+ },
3356
+ customQuery: function customQuery() {
3357
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3358
+ this.updateQuery(valueArray);
3359
+ },
3360
+ sortBy: function sortBy() {
3361
+ this.updateQueryOptions();
3362
+ },
3363
+ dataField: function dataField() {
3364
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3365
+ this.updateQueryOptions();
3366
+ this.updateQuery(valueArray);
3367
+ },
3368
+ value: function value(newVal, oldVal) {
3369
+ if (!isEqual$1(newVal, oldVal)) {
3370
+ this.setValue(newVal);
3371
+ }
3372
+ },
3373
+ selectedValue: function selectedValue(newVal) {
3374
+ if (!isEqual$1(transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues), newVal)) {
3375
+ var _this$$props2 = this.$props,
3376
+ value = _this$$props2.value,
3377
+ onChange = _this$$props2.onChange;
3378
+ var valueToSet = [];
3379
+ if (Array.isArray(newVal) && newVal.length) {
3380
+ valueToSet = newVal;
3381
+ }
3382
+ if (value === undefined) {
3383
+ this.setValue(valueToSet);
3384
+ } else if (onChange && !isEqual$1(value, valueToSet)) {
3385
+ onChange(valueToSet);
3386
+ }
3387
+ }
3388
+ },
3389
+ aggregationData: function aggregationData(newVal, oldVal) {
3390
+ if (newVal && !isEqual$1(newVal, oldVal)) {
3391
+ this.$data.aggregationData = newVal;
3392
+ }
3393
+ }
3394
+ },
3395
+ computed: {
3396
+ hasCustomRenderer: function hasCustomRenderer$1() {
3397
+ return hasCustomRenderer(this);
3398
+ }
3399
+ },
3400
+ methods: {
3401
+ renderIcon: function renderIcon(isLeafNode) {
3402
+ var _this$$props3 = this.$props,
3403
+ showIcon = _this$$props3.showIcon,
3404
+ showLeafIcon = _this$$props3.showLeafIcon,
3405
+ icon = _this$$props3.icon;
3406
+ if (isLeafNode) {
3407
+ if (!showLeafIcon) return null;
3408
+ var _ref = this.$slots || this.$props,
3409
+ leafIcon = _ref.leafIcon;
3410
+ if (leafIcon) return leafIcon();
3411
+ return createVNode("span", {
3412
+ "role": "img",
3413
+ "aria-label": "file",
3414
+ "class": "--leaf-icon"
3415
+ }, [createVNode("svg", {
3416
+ "viewBox": "64 64 896 896",
3417
+ "focusable": "false",
3418
+ "data-icon": "file",
3419
+ "width": "1em",
3420
+ "height": "1em",
3421
+ "fill": "currentColor",
3422
+ "aria-hidden": "true"
3423
+ }, [createVNode("path", {
3424
+ "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"
3425
+ }, null)])]);
3426
+ }
3427
+ if (!showIcon) return null;
3428
+ if (icon) {
3429
+ return icon;
3430
+ }
3431
+ if (this.$slots.icon) {
3432
+ return this.$slots.icon();
3433
+ }
3434
+ return createVNode("span", {
3435
+ "role": "img",
3436
+ "aria-label": "folder-open",
3437
+ "class": "--folder-icon"
3438
+ }, [createVNode("svg", {
3439
+ "viewBox": "64 64 896 896",
3440
+ "focusable": "false",
3441
+ "data-icon": "folder-open",
3442
+ "width": "1em",
3443
+ "height": "1em",
3444
+ "fill": "currentColor",
3445
+ "aria-hidden": "true"
3446
+ }, [createVNode("path", {
3447
+ "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"
3448
+ }, null)])]);
3449
+ },
3450
+ getTransformedData: function getTransformedData() {
3451
+ var _this$$props4 = this.$props,
3452
+ dataField = _this$$props4.dataField,
3453
+ showSearch = _this$$props4.showSearch;
3454
+ var transformedData = transformRawTreeListData(this.$data.aggregationData, dataField);
3455
+ var filteredData = [];
3456
+ if (showSearch && this.searchTerm) {
3457
+ filteredData = this.filterDataBasedOnSearchTerm(transformedData, '');
3458
+ }
3459
+ return filteredData.length ? filteredData : transformedData;
3460
+ },
3461
+ handleInputChange: function handleInputChange(e) {
3462
+ var value = e.target.value;
3463
+ this.searchTerm = value;
3464
+ },
3465
+ renderSearch: function renderSearch() {
3466
+ var _this$$props5 = this.$props,
3467
+ showSearch = _this$$props5.showSearch,
3468
+ innerClass = _this$$props5.innerClass,
3469
+ placeholder = _this$$props5.placeholder,
3470
+ componentId = _this$$props5.componentId,
3471
+ themePreset = _this$$props5.themePreset;
3472
+ if (showSearch) {
3473
+ return createVNode(Input, {
3474
+ "class": getClassName$2(innerClass, 'input') || null,
3475
+ "onInput": this.handleInputChange,
3476
+ "value": this.searchTerm,
3477
+ "placeholder": placeholder || 'Search',
3478
+ "style": {
3479
+ margin: '0 0 8px'
3480
+ },
3481
+ "aria-label": componentId + "-search",
3482
+ "themePreset": themePreset
3483
+ }, null);
3484
+ }
3485
+ return null;
3486
+ },
3487
+ handleListItemClick: function handleListItemClick(key, parentPath) {
3488
+ var path = key;
3489
+ if (parentPath) {
3490
+ path = "" + parentPath + TREELIST_VALUES_PATH_SEPARATOR + key;
3491
+ }
3492
+ var newSelectedValues = _extends({}, this.selectedValues);
3493
+ if (this.$props.mode === 'single') {
3494
+ newSelectedValues = {};
3495
+ setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), true, true);
3496
+ } else {
3497
+ var newValue = !recLookup(newSelectedValues, path, TREELIST_VALUES_PATH_SEPARATOR);
3498
+ setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), newValue, true);
3499
+ }
3500
+ newSelectedValues = sanitizeObject(_extends({}, newSelectedValues));
3501
+ if (this.$props.value === undefined) {
3502
+ this.setValue(newSelectedValues);
3503
+ } else if (this.$props.onChange) {
3504
+ var valueToSet = transformTreeListLocalStateIntoQueryComptaibleFormat(newSelectedValues);
3505
+ this.$props.onChange(valueToSet);
3506
+ }
3507
+ },
3508
+ filterDataBasedOnSearchTerm: function filterDataBasedOnSearchTerm(listArray, parentPath) {
3509
+ var _this = this;
3510
+ if (!(listArray && Array.isArray(listArray) && listArray.length)) {
3511
+ return null;
3512
+ }
3513
+ var result = [];
3514
+ listArray.forEach(function (ele) {
3515
+ var isLeafItem = !ele.list;
3516
+ var newParentPath = ele.key;
3517
+ if (parentPath) {
3518
+ newParentPath = parentPath + "." + ele.key;
3519
+ }
3520
+ var keyHasSearchTerm = replaceDiacritics(ele.key).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm).toLowerCase()) || recLookup(_this.$data.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3521
+ if (isLeafItem && keyHasSearchTerm) {
3522
+ result.push(_extends({}, ele, {
3523
+ initiallyExpanded: keyHasSearchTerm
3524
+ }));
3525
+ } else if (!isLeafItem) {
3526
+ var filteredChildrenItems = _this.filterDataBasedOnSearchTerm(ele.list, newParentPath);
3527
+ if (keyHasSearchTerm || !!filteredChildrenItems.length) {
3528
+ result.push(_extends({}, ele, {
3529
+ initiallyExpanded: keyHasSearchTerm || !!filteredChildrenItems.length,
3530
+ list: filteredChildrenItems
3531
+ }));
3532
+ }
3533
+ }
3534
+ });
3535
+ return result;
3536
+ },
3537
+ getComponent: function getComponent() {
3538
+ var _this$$props6 = this.$props,
3539
+ rawData = _this$$props6.rawData,
3540
+ error = _this$$props6.error,
3541
+ isLoading = _this$$props6.isLoading;
3542
+ var data = {
3543
+ data: this.getTransformedData(),
3544
+ rawData: rawData,
3545
+ error: error,
3546
+ handleClick: this.handleListItemClick,
3547
+ value: this.$data.selectedValues,
3548
+ loading: isLoading,
3549
+ PATH_SEPARATOR: TREELIST_VALUES_PATH_SEPARATOR
3550
+ };
3551
+ return this.$slots.render(data) || getComponent$1(data, this.$props);
3552
+ },
3553
+ getDefaultQuery: function getDefaultQuery(value) {
3554
+ var _this2 = this;
3555
+ var query = null;
3556
+ var type = 'term';
3557
+ var booleanAggregator = this.$props.queryFormat === 'or' ? 'should' : 'must';
3558
+ if (!Array.isArray(value) || value.length === 0) {
3559
+ return null;
3560
+ }
3561
+ if (value) {
3562
+ var _bool;
3563
+ // adds a sub-query with must as an array of objects for each term/value
3564
+ var queryArray = value.map(function (item) {
3565
+ return {
3566
+ bool: {
3567
+ must: item.split(' > ').map(function (subItem, i) {
3568
+ var _type, _ref2;
3569
+ return _ref2 = {}, _ref2[type] = (_type = {}, _type[_this2.$props.dataField[i]] = subItem, _type), _ref2;
3570
+ })
3571
+ }
3572
+ };
3573
+ });
3574
+ var listQuery = {
3575
+ bool: (_bool = {}, _bool[booleanAggregator] = queryArray, _bool)
3576
+ };
3577
+ query = value.length ? listQuery : null;
3578
+ }
3579
+ if (query && this.$props.nestedField) {
3580
+ return {
3581
+ nested: {
3582
+ path: this.$props.nestedField,
3583
+ query: query
3584
+ }
3585
+ };
3586
+ }
3587
+ return query;
3588
+ },
3589
+ updateQuery: function updateQuery(value) {
3590
+ var customQuery = this.$props.customQuery;
3591
+ var query = this.getDefaultQuery(value);
3592
+ var customQueryOptions;
3593
+ if (customQuery) {
3594
+ var _ref3 = customQuery(value, this.$props) || {};
3595
+ query = _ref3.query;
3596
+ customQueryOptions = getOptionsFromQuery(customQuery(value, this.$props));
3597
+ updateCustomQuery$1(this.$props.componentId, this.$props, value);
3598
+ }
3599
+ this.setQueryOptions(this.$props.componentId, _extends({}, this.generateQueryOptions(), customQueryOptions));
3600
+ this.updateQueryAction({
3601
+ componentId: this.$props.componentId,
3602
+ query: query,
3603
+ value: value,
3604
+ label: this.$props.filterLabel,
3605
+ showFilter: this.$props.showFilter,
3606
+ URLParams: this.$props.URLParams,
3607
+ componentType: componentTypes.treeList
3608
+ });
3609
+ },
3610
+ setValue: function setValue(value, hasMountedParam) {
3611
+ var _this3 = this;
3612
+ if (hasMountedParam === void 0) {
3613
+ hasMountedParam = true;
3614
+ }
3615
+ var finalValues = Array.isArray(value) === false ? transformTreeListLocalStateIntoQueryComptaibleFormat(value) : value;
3616
+ var performUpdate = function performUpdate() {
3617
+ var handleUpdates = function handleUpdates() {
3618
+ _this3.updateQuery(finalValues);
3619
+ if (_this3.$props.onValueChange) _this3.$props.onValueChange(finalValues);
3620
+ };
3621
+ if (hasMountedParam) {
3622
+ _this3.selectedValues = Array.isArray(value) ? transformValueIntoLocalState(value) : value;
3623
+ handleUpdates();
3624
+ } else {
3625
+ handleUpdates();
3626
+ }
3627
+ };
3628
+ checkValueChange$1(this.$props.componentId, finalValues, this.$props.beforeValueChange, performUpdate);
3629
+ },
3630
+ generateQueryOptions: function generateQueryOptions() {
3631
+ var queryOptions = getQueryOptions(this.$props);
3632
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3633
+ return getAggsQuery(valueArray, queryOptions, this.$props);
3634
+ },
3635
+ updateDefaultQuery: function updateDefaultQuery(queryOptions) {
3636
+ var value = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3637
+ // Update default query for RS API
3638
+ updateDefaultQuery$1(this.$props.componentId, this.$props, value);
3639
+ updateInternalQuery(getInternalComponentID(this.$props.componentId), queryOptions, value, this.$props, this.generateQueryOptions(), null);
3640
+ },
3641
+ updateQueryOptions: function updateQueryOptions() {
3642
+ // for a new query due to other changes don't append after to get fresh results
3643
+ var queryOptions = this.generateQueryOptions(this.$props, {}, transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues));
3644
+ if (this.$props.defaultQuery) {
3645
+ // eslint-disable-next-line no-use-before-define
3646
+ this.updateDefaultQuery(queryOptions);
3647
+ } else {
3648
+ this.setQueryOptions(getInternalComponentID(this.$props.componentId), queryOptions);
3649
+ }
3650
+ }
3651
+ },
3652
+ render: function render() {
3653
+ var _this4 = this;
3654
+ var props = this.$props;
3655
+ var style = props.style,
3656
+ className = props.className,
3657
+ mode = props.mode,
3658
+ showLine = props.showLine,
3659
+ renderItem = props.renderItem,
3660
+ showCheckbox = props.showCheckbox,
3661
+ innerClass = props.innerClass,
3662
+ showRadio = props.showRadio,
3663
+ showCount = props.showCount,
3664
+ showSwitcherIcon = props.showSwitcherIcon,
3665
+ switcherIcon = props.switcherIcon,
3666
+ title = props.title,
3667
+ loader = props.loader,
3668
+ renderError = props.renderError;
3669
+ if (this.isLoading) {
3670
+ return (this.$slots.loader ? this.$slots.loader() : loader) || null;
3671
+ }
3672
+ if (this.error) {
3673
+ if (this.$slots.renderError) {
3674
+ return this.$slots.renderError(this.error);
3675
+ }
3676
+ return isFunction$1(renderError) ? renderError(this.error) : renderError;
3677
+ }
3678
+ var transformedData = this.getTransformedData();
3679
+ if (!transformedData || transformedData.length === 0) {
3680
+ return this.$slots.renderNoResults ? this.$slots.renderNoResults() : null;
3681
+ }
3682
+ return createVNode(Container, {
3683
+ "style": style,
3684
+ "class": className
3685
+ }, {
3686
+ "default": function _default() {
3687
+ return [props.title && createVNode(Title, {
3688
+ "class": getClassName$2(innerClass, 'title') || null
3689
+ }, _isSlot$3(title) ? title : {
3690
+ "default": function _default() {
3691
+ return [title];
3692
+ }
3693
+ }), _this4.renderSearch(), _this4.hasCustomRenderer ? _this4.getComponent() : createVNode(HierarchicalMenuComponent, {
3694
+ "key": "initial-node",
3695
+ "listArray": transformedData,
3696
+ "parentPath": "",
3697
+ "isExpanded": true,
3698
+ "listItemProps": {
3699
+ mode: mode,
3700
+ selectedValues: _this4.selectedValues,
3701
+ searchTerm: _this4.searchTerm,
3702
+ showLine: showLine,
3703
+ renderItem: renderItem != null ? renderItem : _this4.$slots.renderItem,
3704
+ handleListItemClick: _this4.handleListItemClick,
3705
+ showCheckbox: showCheckbox,
3706
+ innerClass: innerClass,
3707
+ showRadio: showRadio,
3708
+ renderIcon: _this4.renderIcon,
3709
+ showCount: showCount,
3710
+ showSwitcherIcon: showSwitcherIcon,
3711
+ switcherIcon: switcherIcon != null ? switcherIcon : _this4.$slots.switcherIcon
3712
+ }
3713
+ }, null)];
3714
+ }
3715
+ });
3716
+ }
3717
+ };
3718
+ var mapStateToProps$2 = function mapStateToProps(state, props) {
3719
+ return {
3720
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
3721
+ rawData: state.rawData[props.componentId] || {},
3722
+ aggregationData: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId] || {},
3723
+ themePreset: state.config.themePreset,
3724
+ error: state.error[props.componentId],
3725
+ isLoading: state.isLoading[props.componentId],
3726
+ enableAppbase: state.config.enableAppbase
3727
+ };
3728
+ };
3729
+ var mapDispatchtoProps = {
3730
+ setQueryOptions: setQueryOptions,
3731
+ updateQueryAction: updateQueryAction
3732
+ };
3733
+ TreeList.hasInternalComponent = function () {
3734
+ return true;
3735
+ };
3736
+ var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$2, mapDispatchtoProps)(TreeList), {
3737
+ componentType: componentTypes.treeList,
3738
+ internalComponent: TreeList.hasInternalComponent()
3739
+ }));
3740
+ TreeListConnected.name = TreeList.name;
3741
+ TreeListConnected.install = function (Vue) {
3742
+ Vue.component(TreeListConnected.name, TreeListConnected);
3743
+ };
3744
+
3745
+ // Add componentType for SSR
3746
+ TreeListConnected.componentType = componentTypes.treeList;
3747
+
3748
+ var RcConnected = PreferencesConsumer({
3749
+ name: 'RcConnected',
3750
+ render: function render() {
3751
+ var component = ReactiveComponent;
3752
+ switch (this.$attrs.componentType) {
3753
+ case componentTypes.reactiveList:
3754
+ component = ReactiveList;
3755
+ break;
3756
+ case componentTypes.searchBox:
3757
+ component = SBConnected;
3758
+ break;
3759
+ // list components
3760
+ case componentTypes.singleList:
3761
+ component = SingleList;
3762
+ break;
3763
+ case componentTypes.multiList:
3764
+ component = MultiList;
3765
+ break;
3766
+ case componentTypes.singleDropdownList:
3767
+ component = SingleDropdownList;
3768
+ break;
3769
+ case componentTypes.multiDropdownList:
3770
+ component = MultiDropdownList;
3771
+ break;
3772
+ // basic components
3773
+ case componentTypes.toggleButton:
3774
+ component = ToggleButton;
3775
+ break;
3776
+ // range components
3777
+ case componentTypes.dynamicRangeSlider:
3778
+ component = DynamicRangeSlider;
3779
+ break;
3780
+ case componentTypes.singleRange:
3781
+ component = SingleRange;
3782
+ break;
3783
+ case componentTypes.multiRange:
3784
+ component = MultiRange;
3785
+ break;
3786
+ case componentTypes.rangeSlider:
3787
+ component = RangeSlider;
3788
+ break;
3789
+ case componentTypes.rangeInput:
3790
+ component = RangeInput;
3791
+ break;
3792
+ }
3793
+ return h(component, null, this.$slots);
3794
+ }
3795
+ });
3796
+ RcConnected.name = ReactiveComponent.name;
3797
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
3798
+ // Add componentType for SSR
3799
+ RcConnected.componentType = componentTypes.reactiveComponent;
3800
+ RcConnected.install = function (Vue) {
3801
+ Vue.component(RcConnected.name, RcConnected);
3802
+ };
3803
+
3804
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected, AIConnected];
3805
+ function install (Vue) {
3806
+ components.map(function (component) {
3807
+ Vue.use(component);
3808
+ return null;
3809
+ });
3810
+ }
3811
+
3812
+ export { AIConnected as A, RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };