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

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