react-instantsearch 7.29.0 → 7.31.0
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.
- package/dist/cjs/components/AutocompleteSearch.js +6 -3
- package/dist/cjs/components/ChatGreeting.js +16 -0
- package/dist/cjs/components/ChatMessageLoader.js +16 -0
- package/dist/cjs/components/ChatSidePanelLayout.js +17 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/ui/SearchBox.js +38 -2
- package/dist/cjs/widgets/Autocomplete.js +43 -19
- package/dist/cjs/widgets/Chat.js +23 -5
- package/dist/cjs/widgets/SearchBox.js +18 -2
- package/dist/cjs/widgets/TrendingFacets.js +55 -0
- package/dist/cjs/widgets/chat/tools/SearchIndexTool.js +7 -3
- package/dist/cjs/widgets/index.js +1 -0
- package/dist/es/components/AutocompleteSearch.d.ts +5 -2
- package/dist/es/components/AutocompleteSearch.js +6 -3
- package/dist/es/components/ChatGreeting.d.ts +1 -0
- package/dist/es/components/ChatGreeting.js +8 -0
- package/dist/es/components/ChatMessageLoader.d.ts +1 -0
- package/dist/es/components/ChatMessageLoader.js +8 -0
- package/dist/es/components/ChatOverlayLayout.d.ts +1 -3
- package/dist/es/components/ChatSidePanelLayout.d.ts +1 -0
- package/dist/es/components/ChatSidePanelLayout.js +9 -0
- package/dist/es/components/index.d.ts +3 -0
- package/dist/es/components/index.js +3 -0
- package/dist/es/index.js +4 -0
- package/dist/es/ui/SearchBox.d.ts +15 -1
- package/dist/es/ui/SearchBox.js +38 -2
- package/dist/es/widgets/Autocomplete.d.ts +6 -0
- package/dist/es/widgets/Autocomplete.js +43 -19
- package/dist/es/widgets/Chat.d.ts +13 -3
- package/dist/es/widgets/Chat.js +37 -19
- package/dist/es/widgets/RefinementList.d.ts +3 -2
- package/dist/es/widgets/SearchBox.d.ts +8 -2
- package/dist/es/widgets/SearchBox.js +19 -3
- package/dist/es/widgets/TrendingFacets.d.ts +11 -0
- package/dist/es/widgets/TrendingFacets.js +46 -0
- package/dist/es/widgets/chat/tools/SearchIndexTool.js +7 -3
- package/dist/es/widgets/index.d.ts +1 -0
- package/dist/es/widgets/index.js +1 -0
- package/dist/umd/ReactInstantSearch.js +988 -262
- package/dist/umd/ReactInstantSearch.min.js +3 -3
- package/package.json +5 -5
- package/dist/cjs/widgets/index.umd.js +0 -69
- package/dist/es/widgets/index.umd.d.ts +0 -32
- package/dist/es/widgets/index.umd.js +0 -37
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch 7.
|
|
1
|
+
/*! React InstantSearch 7.31.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.
|
|
27
|
+
var version$2 = '7.31.0';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -1507,6 +1507,12 @@
|
|
|
1507
1507
|
* This doesn't contain any beta/hidden features.
|
|
1508
1508
|
* @private
|
|
1509
1509
|
*/ SearchParameters.PARAMETERS = Object.keys(new SearchParameters());
|
|
1510
|
+
// Returns a finite number or null. Used to reject Infinity/-Infinity from parseFloat.
|
|
1511
|
+
function parseFiniteFloat(value) {
|
|
1512
|
+
var n = parseFloat(value);
|
|
1513
|
+
// global isFinite is safe here: n is always a number type (no string coercion risk)
|
|
1514
|
+
return isFinite(n) ? n : null;
|
|
1515
|
+
}
|
|
1510
1516
|
/**
|
|
1511
1517
|
* @private
|
|
1512
1518
|
* @param {object} partialState full or part of a state
|
|
@@ -1532,8 +1538,18 @@
|
|
|
1532
1538
|
var value = partialState[k];
|
|
1533
1539
|
if (typeof value === 'string') {
|
|
1534
1540
|
var parsedValue = parseFloat(value);
|
|
1535
|
-
|
|
1536
|
-
|
|
1541
|
+
if (isNaN(parsedValue)) {
|
|
1542
|
+
// originally an unparseable string like "all", keep NaN
|
|
1543
|
+
numbers[k] = value;
|
|
1544
|
+
} else if (!isFinite(parsedValue)) {
|
|
1545
|
+
// Infinity/-Infinity — convert to null
|
|
1546
|
+
numbers[k] = null;
|
|
1547
|
+
} else {
|
|
1548
|
+
numbers[k] = parsedValue;
|
|
1549
|
+
}
|
|
1550
|
+
} else if (typeof value === 'number' && !isFinite(value)) {
|
|
1551
|
+
// Already-numeric Infinity — convert to null
|
|
1552
|
+
numbers[k] = null;
|
|
1537
1553
|
}
|
|
1538
1554
|
});
|
|
1539
1555
|
// there's two formats of insideBoundingBox, we need to parse
|
|
@@ -1542,7 +1558,13 @@
|
|
|
1542
1558
|
numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) {
|
|
1543
1559
|
if (Array.isArray(geoRect)) {
|
|
1544
1560
|
return geoRect.map(function(value) {
|
|
1545
|
-
|
|
1561
|
+
if (typeof value === 'string') {
|
|
1562
|
+
return parseFiniteFloat(value);
|
|
1563
|
+
}
|
|
1564
|
+
if (typeof value === 'number' && !isFinite(value)) {
|
|
1565
|
+
return null;
|
|
1566
|
+
}
|
|
1567
|
+
return value;
|
|
1546
1568
|
});
|
|
1547
1569
|
}
|
|
1548
1570
|
return geoRect;
|
|
@@ -1559,12 +1581,17 @@
|
|
|
1559
1581
|
if (Array.isArray(v)) {
|
|
1560
1582
|
return v.map(function(vPrime) {
|
|
1561
1583
|
if (typeof vPrime === 'string') {
|
|
1562
|
-
return
|
|
1584
|
+
return parseFiniteFloat(vPrime);
|
|
1585
|
+
}
|
|
1586
|
+
if (typeof vPrime === 'number' && !isFinite(vPrime)) {
|
|
1587
|
+
return null;
|
|
1563
1588
|
}
|
|
1564
1589
|
return vPrime;
|
|
1565
1590
|
});
|
|
1566
1591
|
} else if (typeof v === 'string') {
|
|
1567
|
-
return
|
|
1592
|
+
return parseFiniteFloat(v);
|
|
1593
|
+
} else if (typeof v === 'number' && !isFinite(v)) {
|
|
1594
|
+
return null;
|
|
1568
1595
|
}
|
|
1569
1596
|
return v;
|
|
1570
1597
|
});
|
|
@@ -3892,7 +3919,7 @@
|
|
|
3892
3919
|
function requireVersion() {
|
|
3893
3920
|
if (hasRequiredVersion) return version$1;
|
|
3894
3921
|
hasRequiredVersion = 1;
|
|
3895
|
-
version$1 = '3.28.
|
|
3922
|
+
version$1 = '3.28.2';
|
|
3896
3923
|
return version$1;
|
|
3897
3924
|
}
|
|
3898
3925
|
|
|
@@ -5938,7 +5965,7 @@
|
|
|
5938
5965
|
}
|
|
5939
5966
|
}
|
|
5940
5967
|
|
|
5941
|
-
var withUsage$
|
|
5968
|
+
var withUsage$t = createDocumentationMessageGenerator({
|
|
5942
5969
|
name: 'configure',
|
|
5943
5970
|
connector: true
|
|
5944
5971
|
});
|
|
@@ -5954,7 +5981,7 @@
|
|
|
5954
5981
|
var renderFn = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : noop, unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
5955
5982
|
return function(widgetParams) {
|
|
5956
5983
|
if (!widgetParams || !isPlainObject(widgetParams.searchParameters)) {
|
|
5957
|
-
throw new Error(withUsage$
|
|
5984
|
+
throw new Error(withUsage$t('The `searchParameters` option expects an object.'));
|
|
5958
5985
|
}
|
|
5959
5986
|
var connectorState = {};
|
|
5960
5987
|
function refine(helper) {
|
|
@@ -6499,13 +6526,13 @@
|
|
|
6499
6526
|
}
|
|
6500
6527
|
}
|
|
6501
6528
|
|
|
6502
|
-
var withUsage$
|
|
6529
|
+
var withUsage$s = createDocumentationMessageGenerator({
|
|
6503
6530
|
name: 'dynamic-widgets',
|
|
6504
6531
|
connector: true
|
|
6505
6532
|
});
|
|
6506
6533
|
var connectDynamicWidgets = function connectDynamicWidgets(renderFn) {
|
|
6507
6534
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
6508
|
-
checkRendering(renderFn, withUsage$
|
|
6535
|
+
checkRendering(renderFn, withUsage$s());
|
|
6509
6536
|
return function(widgetParams) {
|
|
6510
6537
|
var widgets = widgetParams.widgets, _widgetParams_maxValuesPerFacet = widgetParams.maxValuesPerFacet, maxValuesPerFacet = _widgetParams_maxValuesPerFacet === void 0 ? 20 : _widgetParams_maxValuesPerFacet, _widgetParams_facets = widgetParams.facets, facets = _widgetParams_facets === void 0 ? [
|
|
6511
6538
|
'*'
|
|
@@ -6515,10 +6542,10 @@
|
|
|
6515
6542
|
if (!(widgets && Array.isArray(widgets) && widgets.every(function(widget) {
|
|
6516
6543
|
return (typeof widget === "undefined" ? "undefined" : _type_of(widget)) === 'object';
|
|
6517
6544
|
}))) {
|
|
6518
|
-
throw new Error(withUsage$
|
|
6545
|
+
throw new Error(withUsage$s('The `widgets` option expects an array of widgets.'));
|
|
6519
6546
|
}
|
|
6520
6547
|
if (!Array.isArray(facets)) {
|
|
6521
|
-
throw new Error(withUsage$
|
|
6548
|
+
throw new Error(withUsage$s("The `facets` option only accepts an array of facets, you passed ".concat(JSON.stringify(facets))));
|
|
6522
6549
|
}
|
|
6523
6550
|
var localWidgets = new Map();
|
|
6524
6551
|
return {
|
|
@@ -6620,7 +6647,7 @@
|
|
|
6620
6647
|
results: results
|
|
6621
6648
|
});
|
|
6622
6649
|
if (!Array.isArray(attributesToRender)) {
|
|
6623
|
-
throw new Error(withUsage$
|
|
6650
|
+
throw new Error(withUsage$s('The `transformItems` option expects a function that returns an Array.'));
|
|
6624
6651
|
}
|
|
6625
6652
|
return {
|
|
6626
6653
|
attributesToRender: attributesToRender,
|
|
@@ -6801,7 +6828,7 @@
|
|
|
6801
6828
|
};
|
|
6802
6829
|
}
|
|
6803
6830
|
|
|
6804
|
-
var withUsage$
|
|
6831
|
+
var withUsage$r = createDocumentationMessageGenerator({
|
|
6805
6832
|
name: 'index-widget'
|
|
6806
6833
|
});
|
|
6807
6834
|
/**
|
|
@@ -6895,7 +6922,7 @@
|
|
|
6895
6922
|
}
|
|
6896
6923
|
var index = function index(widgetParams) {
|
|
6897
6924
|
if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.EXPERIMENTAL_isolated) {
|
|
6898
|
-
throw new Error(withUsage$
|
|
6925
|
+
throw new Error(withUsage$r('The `indexName` option is required.'));
|
|
6899
6926
|
}
|
|
6900
6927
|
// When isolated=true, we use an empty string as the default indexName.
|
|
6901
6928
|
// This is intentional: isolated indices do not require a real index name.
|
|
@@ -6985,7 +7012,7 @@
|
|
|
6985
7012
|
addWidgets: function addWidgets(widgets) {
|
|
6986
7013
|
var _this = this;
|
|
6987
7014
|
if (!Array.isArray(widgets)) {
|
|
6988
|
-
throw new Error(withUsage$
|
|
7015
|
+
throw new Error(withUsage$r('The `addWidgets` method expects an array of widgets.'));
|
|
6989
7016
|
}
|
|
6990
7017
|
var flatWidgets = widgets.reduce(function(acc, w) {
|
|
6991
7018
|
return acc.concat(Array.isArray(w) ? w : [
|
|
@@ -6995,7 +7022,7 @@
|
|
|
6995
7022
|
if (flatWidgets.some(function(widget) {
|
|
6996
7023
|
return typeof widget.init !== 'function' && typeof widget.render !== 'function';
|
|
6997
7024
|
})) {
|
|
6998
|
-
throw new Error(withUsage$
|
|
7025
|
+
throw new Error(withUsage$r('The widget definition expects a `render` and/or an `init` method.'));
|
|
6999
7026
|
}
|
|
7000
7027
|
flatWidgets.forEach(function(widget) {
|
|
7001
7028
|
widget.parent = _this;
|
|
@@ -7055,7 +7082,7 @@
|
|
|
7055
7082
|
removeWidgets: function removeWidgets(widgets) {
|
|
7056
7083
|
var _this = this;
|
|
7057
7084
|
if (!Array.isArray(widgets)) {
|
|
7058
|
-
throw new Error(withUsage$
|
|
7085
|
+
throw new Error(withUsage$r('The `removeWidgets` method expects an array of widgets.'));
|
|
7059
7086
|
}
|
|
7060
7087
|
var flatWidgets = widgets.reduce(function(acc, w) {
|
|
7061
7088
|
return acc.concat(Array.isArray(w) ? w : [
|
|
@@ -7065,7 +7092,7 @@
|
|
|
7065
7092
|
if (flatWidgets.some(function(widget) {
|
|
7066
7093
|
return typeof widget.dispose !== 'function';
|
|
7067
7094
|
})) {
|
|
7068
|
-
throw new Error(withUsage$
|
|
7095
|
+
throw new Error(withUsage$r('The widget definition expects a `dispose` method.'));
|
|
7069
7096
|
}
|
|
7070
7097
|
localWidgets = localWidgets.filter(function(widget) {
|
|
7071
7098
|
return flatWidgets.indexOf(widget) === -1;
|
|
@@ -9684,7 +9711,7 @@
|
|
|
9684
9711
|
};
|
|
9685
9712
|
}
|
|
9686
9713
|
|
|
9687
|
-
var version = '4.
|
|
9714
|
+
var version = '4.95.0';
|
|
9688
9715
|
|
|
9689
9716
|
function hydrateSearchClient(client, results) {
|
|
9690
9717
|
if (!results) {
|
|
@@ -9819,7 +9846,7 @@
|
|
|
9819
9846
|
});
|
|
9820
9847
|
}
|
|
9821
9848
|
|
|
9822
|
-
var withUsage$
|
|
9849
|
+
var withUsage$q = createDocumentationMessageGenerator({
|
|
9823
9850
|
name: 'instantsearch'
|
|
9824
9851
|
});
|
|
9825
9852
|
function defaultCreateURL() {
|
|
@@ -9875,7 +9902,7 @@
|
|
|
9875
9902
|
_this.setMaxListeners(100);
|
|
9876
9903
|
var _options_indexName = options.indexName, indexName = _options_indexName === void 0 ? '' : _options_indexName, compositionID = options.compositionID, numberLocale = options.numberLocale, _options_initialUiState = options.initialUiState, initialUiState = _options_initialUiState === void 0 ? {} : _options_initialUiState, _options_routing = options.routing, routing = _options_routing === void 0 ? null : _options_routing, _options_insights = options.insights, insights = _options_insights === void 0 ? undefined : _options_insights, searchFunction = options.searchFunction, _options_stalledSearchDelay = options.stalledSearchDelay, stalledSearchDelay = _options_stalledSearchDelay === void 0 ? 200 : _options_stalledSearchDelay, _options_searchClient = options.searchClient, searchClient = _options_searchClient === void 0 ? null : _options_searchClient, _options_insightsClient = options.insightsClient, insightsClient = _options_insightsClient === void 0 ? null : _options_insightsClient, _options_onStateChange = options.onStateChange, onStateChange = _options_onStateChange === void 0 ? null : _options_onStateChange, _options_future1 = options.future, future = _options_future1 === void 0 ? _object_spread({}, INSTANTSEARCH_FUTURE_DEFAULTS, options.future || {}) : _options_future1;
|
|
9877
9904
|
if (searchClient === null) {
|
|
9878
|
-
throw new Error(withUsage$
|
|
9905
|
+
throw new Error(withUsage$q('The `searchClient` option is required.'));
|
|
9879
9906
|
}
|
|
9880
9907
|
if (typeof searchClient.search !== 'function') {
|
|
9881
9908
|
throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/");
|
|
@@ -9884,7 +9911,7 @@
|
|
|
9884
9911
|
searchClient.addAlgoliaAgent("instantsearch.js (".concat(version, ")"));
|
|
9885
9912
|
}
|
|
9886
9913
|
if (insightsClient && typeof insightsClient !== 'function') {
|
|
9887
|
-
throw new Error(withUsage$
|
|
9914
|
+
throw new Error(withUsage$q('The `insightsClient` option should be a function.'));
|
|
9888
9915
|
}
|
|
9889
9916
|
_this.client = searchClient;
|
|
9890
9917
|
_this.future = future;
|
|
@@ -10032,12 +10059,12 @@
|
|
|
10032
10059
|
* @param widgets The array of widgets to add to InstantSearch.
|
|
10033
10060
|
*/ function addWidgets(widgets) {
|
|
10034
10061
|
if (!Array.isArray(widgets)) {
|
|
10035
|
-
throw new Error(withUsage$
|
|
10062
|
+
throw new Error(withUsage$q('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));
|
|
10036
10063
|
}
|
|
10037
10064
|
if (this.compositionID && widgets.some(function(w) {
|
|
10038
10065
|
return !Array.isArray(w) && isIndexWidget(w) && !w._isolated;
|
|
10039
10066
|
})) {
|
|
10040
|
-
throw new Error(withUsage$
|
|
10067
|
+
throw new Error(withUsage$q('The `index` widget cannot be used with a composition-based InstantSearch implementation.'));
|
|
10041
10068
|
}
|
|
10042
10069
|
this.mainIndex.addWidgets(widgets);
|
|
10043
10070
|
return this;
|
|
@@ -10066,7 +10093,7 @@
|
|
|
10066
10093
|
* The widgets must implement a `dispose()` method to clear their states.
|
|
10067
10094
|
*/ function removeWidgets(widgets) {
|
|
10068
10095
|
if (!Array.isArray(widgets)) {
|
|
10069
|
-
throw new Error(withUsage$
|
|
10096
|
+
throw new Error(withUsage$q('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));
|
|
10070
10097
|
}
|
|
10071
10098
|
this.mainIndex.removeWidgets(widgets);
|
|
10072
10099
|
return this;
|
|
@@ -10080,7 +10107,7 @@
|
|
|
10080
10107
|
*/ function start() {
|
|
10081
10108
|
var _this = this;
|
|
10082
10109
|
if (this.started) {
|
|
10083
|
-
throw new Error(withUsage$
|
|
10110
|
+
throw new Error(withUsage$q('The `start` method has already been called once.'));
|
|
10084
10111
|
}
|
|
10085
10112
|
// This Helper is used for the queries, we don't care about its state. The
|
|
10086
10113
|
// states are managed at the `index` level. We use this Helper to create
|
|
@@ -10282,7 +10309,7 @@
|
|
|
10282
10309
|
var _this = this;
|
|
10283
10310
|
var callOnStateChange = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
10284
10311
|
if (!this.mainHelper) {
|
|
10285
|
-
throw new Error(withUsage$
|
|
10312
|
+
throw new Error(withUsage$q('The `start` method needs to be called before `setUiState`.'));
|
|
10286
10313
|
}
|
|
10287
10314
|
// We refresh the index UI state to update the local UI state that the
|
|
10288
10315
|
// main index passes to the function form of `setUiState`.
|
|
@@ -10319,7 +10346,7 @@
|
|
|
10319
10346
|
value: function createURL() {
|
|
10320
10347
|
var nextState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
10321
10348
|
if (!this.started) {
|
|
10322
|
-
throw new Error(withUsage$
|
|
10349
|
+
throw new Error(withUsage$q('The `start` method needs to be called before `createURL`.'));
|
|
10323
10350
|
}
|
|
10324
10351
|
return this._createURL(nextState);
|
|
10325
10352
|
}
|
|
@@ -10328,7 +10355,7 @@
|
|
|
10328
10355
|
key: "refresh",
|
|
10329
10356
|
value: function refresh() {
|
|
10330
10357
|
if (!this.mainHelper) {
|
|
10331
|
-
throw new Error(withUsage$
|
|
10358
|
+
throw new Error(withUsage$q('The `start` method needs to be called before `refresh`.'));
|
|
10332
10359
|
}
|
|
10333
10360
|
this.mainHelper.clearCache().search();
|
|
10334
10361
|
}
|
|
@@ -10990,17 +11017,36 @@
|
|
|
10990
11017
|
return bindEventForHits;
|
|
10991
11018
|
}
|
|
10992
11019
|
|
|
10993
|
-
|
|
11020
|
+
function addQueryID(hits, queryID) {
|
|
11021
|
+
if (!queryID) {
|
|
11022
|
+
return hits;
|
|
11023
|
+
}
|
|
11024
|
+
return hits.map(function(hit) {
|
|
11025
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
11026
|
+
__queryID: queryID
|
|
11027
|
+
});
|
|
11028
|
+
});
|
|
11029
|
+
}
|
|
11030
|
+
|
|
11031
|
+
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
11032
|
+
return hits.map(function(hit, idx) {
|
|
11033
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
11034
|
+
__position: hitsPerPage * page + idx + 1
|
|
11035
|
+
});
|
|
11036
|
+
});
|
|
11037
|
+
}
|
|
11038
|
+
|
|
11039
|
+
var withUsage$p = createDocumentationMessageGenerator({
|
|
10994
11040
|
name: 'autocomplete',
|
|
10995
11041
|
connector: true
|
|
10996
11042
|
});
|
|
10997
11043
|
var connectAutocomplete = function connectAutocomplete(renderFn) {
|
|
10998
11044
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
10999
|
-
checkRendering(renderFn, withUsage$
|
|
11045
|
+
checkRendering(renderFn, withUsage$p());
|
|
11000
11046
|
return function(widgetParams) {
|
|
11001
11047
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(indices) {
|
|
11002
11048
|
return indices;
|
|
11003
|
-
} : _ref_transformItems;
|
|
11049
|
+
} : _ref_transformItems, tmp = _ref.future, _ref1 = tmp === void 0 ? {} : tmp, _ref_undefinedEmptyQuery = _ref1.undefinedEmptyQuery, undefinedEmptyQuery = _ref_undefinedEmptyQuery === void 0 ? false : _ref_undefinedEmptyQuery;
|
|
11004
11050
|
var connectorState = {};
|
|
11005
11051
|
return {
|
|
11006
11052
|
$$type: 'ais.autocomplete',
|
|
@@ -11036,7 +11082,7 @@
|
|
|
11036
11082
|
}
|
|
11037
11083
|
var sendEventMap = {};
|
|
11038
11084
|
var indices = scopedResults.map(function(scopedResult) {
|
|
11039
|
-
var _scopedResult_results
|
|
11085
|
+
var _scopedResult_results;
|
|
11040
11086
|
// We need to escape the hits because highlighting
|
|
11041
11087
|
// exposes HTML tags to the end-user.
|
|
11042
11088
|
if (scopedResult.results) {
|
|
@@ -11047,15 +11093,16 @@
|
|
|
11047
11093
|
helper: scopedResult.helper,
|
|
11048
11094
|
widgetType: _this.$$type
|
|
11049
11095
|
});
|
|
11096
|
+
var hits = scopedResult.results ? addQueryID(addAbsolutePosition(scopedResult.results.hits, scopedResult.results.page, scopedResult.results.hitsPerPage), scopedResult.results.queryID) : [];
|
|
11050
11097
|
return {
|
|
11051
11098
|
indexId: scopedResult.indexId,
|
|
11052
11099
|
indexName: ((_scopedResult_results = scopedResult.results) === null || _scopedResult_results === void 0 ? void 0 : _scopedResult_results.index) || '',
|
|
11053
|
-
hits:
|
|
11100
|
+
hits: hits,
|
|
11054
11101
|
results: scopedResult.results || {}
|
|
11055
11102
|
};
|
|
11056
11103
|
});
|
|
11057
11104
|
return {
|
|
11058
|
-
currentRefinement: state.query || '',
|
|
11105
|
+
currentRefinement: undefinedEmptyQuery ? state.query : state.query || '',
|
|
11059
11106
|
indices: transformItems(indices).map(function(transformedIndex) {
|
|
11060
11107
|
return _object_spread_props(_object_spread({}, transformedIndex), {
|
|
11061
11108
|
sendEvent: sendEventMap[transformedIndex.indexId]
|
|
@@ -11067,8 +11114,8 @@
|
|
|
11067
11114
|
},
|
|
11068
11115
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
11069
11116
|
var searchParameters = param.searchParameters;
|
|
11070
|
-
var query = searchParameters.query || '';
|
|
11071
|
-
if (query === '' || uiState && uiState.query === query) {
|
|
11117
|
+
var query = undefinedEmptyQuery ? searchParameters.query : searchParameters.query || '';
|
|
11118
|
+
if (!query || query === '' || uiState && uiState.query === query) {
|
|
11072
11119
|
return uiState;
|
|
11073
11120
|
}
|
|
11074
11121
|
return _object_spread_props(_object_spread({}, uiState), {
|
|
@@ -11078,7 +11125,7 @@
|
|
|
11078
11125
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
11079
11126
|
var uiState = param.uiState;
|
|
11080
11127
|
var parameters = {
|
|
11081
|
-
query: uiState.query || ''
|
|
11128
|
+
query: undefinedEmptyQuery ? uiState.query : uiState.query || ''
|
|
11082
11129
|
};
|
|
11083
11130
|
if (!escapeHTML) {
|
|
11084
11131
|
return searchParameters.setQueryParameters(parameters);
|
|
@@ -11104,20 +11151,20 @@
|
|
|
11104
11151
|
return useConnector(connectAutocomplete, props, additionalWidgetProperties);
|
|
11105
11152
|
}
|
|
11106
11153
|
|
|
11107
|
-
var withUsage$
|
|
11154
|
+
var withUsage$o = createDocumentationMessageGenerator({
|
|
11108
11155
|
name: 'breadcrumb',
|
|
11109
11156
|
connector: true
|
|
11110
11157
|
});
|
|
11111
11158
|
var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
11112
11159
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
11113
|
-
checkRendering(renderFn, withUsage$
|
|
11160
|
+
checkRendering(renderFn, withUsage$o());
|
|
11114
11161
|
var connectorState = {};
|
|
11115
11162
|
return function(widgetParams) {
|
|
11116
11163
|
var _ref = widgetParams || {}, attributes = _ref.attributes, _ref_separator = _ref.separator, separator = _ref_separator === void 0 ? ' > ' : _ref_separator, _ref_rootPath = _ref.rootPath, rootPath = _ref_rootPath === void 0 ? null : _ref_rootPath, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
11117
11164
|
return items;
|
|
11118
11165
|
} : _ref_transformItems;
|
|
11119
11166
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
11120
|
-
throw new Error(withUsage$
|
|
11167
|
+
throw new Error(withUsage$o('The `attributes` option expects an array of strings.'));
|
|
11121
11168
|
}
|
|
11122
11169
|
var _attributes = _sliced_to_array(attributes, 1), hierarchicalFacetName = _attributes[0];
|
|
11123
11170
|
function getRefinedState(state, facetValue) {
|
|
@@ -11453,12 +11500,81 @@
|
|
|
11453
11500
|
return Promise.resolve(value);
|
|
11454
11501
|
}
|
|
11455
11502
|
|
|
11503
|
+
var tryParseJson = function tryParseJson(value) {
|
|
11504
|
+
try {
|
|
11505
|
+
return JSON.parse(value);
|
|
11506
|
+
} catch (unused) {
|
|
11507
|
+
return undefined;
|
|
11508
|
+
}
|
|
11509
|
+
};
|
|
11510
|
+
var repairPartialJson = function repairPartialJson(value) {
|
|
11511
|
+
var repaired = value.trim();
|
|
11512
|
+
if (!repaired) {
|
|
11513
|
+
return repaired;
|
|
11514
|
+
}
|
|
11515
|
+
var inString = false;
|
|
11516
|
+
var isEscaped = false;
|
|
11517
|
+
var stack = [];
|
|
11518
|
+
for(var index = 0; index < repaired.length; index++){
|
|
11519
|
+
var char = repaired[index];
|
|
11520
|
+
if (inString) {
|
|
11521
|
+
if (isEscaped) {
|
|
11522
|
+
isEscaped = false;
|
|
11523
|
+
} else if (char === '\\') {
|
|
11524
|
+
isEscaped = true;
|
|
11525
|
+
} else if (char === '"') {
|
|
11526
|
+
inString = false;
|
|
11527
|
+
}
|
|
11528
|
+
continue;
|
|
11529
|
+
}
|
|
11530
|
+
if (char === '"') {
|
|
11531
|
+
inString = true;
|
|
11532
|
+
continue;
|
|
11533
|
+
}
|
|
11534
|
+
if (char === '{' || char === '[') {
|
|
11535
|
+
stack.push(char);
|
|
11536
|
+
continue;
|
|
11537
|
+
}
|
|
11538
|
+
if (char === '}' && stack[stack.length - 1] === '{') {
|
|
11539
|
+
stack.pop();
|
|
11540
|
+
continue;
|
|
11541
|
+
}
|
|
11542
|
+
if (char === ']' && stack[stack.length - 1] === '[') {
|
|
11543
|
+
stack.pop();
|
|
11544
|
+
}
|
|
11545
|
+
}
|
|
11546
|
+
if (inString && !isEscaped) {
|
|
11547
|
+
repaired += '"';
|
|
11548
|
+
}
|
|
11549
|
+
repaired = repaired.replace(RegExp(",\\s*$", "u"), '');
|
|
11550
|
+
if (stack.length > 0) {
|
|
11551
|
+
repaired += stack.reverse().map(function(opening) {
|
|
11552
|
+
return opening === '{' ? '}' : ']';
|
|
11553
|
+
}).join('');
|
|
11554
|
+
}
|
|
11555
|
+
return repaired.replace(RegExp(",\\s*([}\\]])", "gu"), '$1');
|
|
11556
|
+
};
|
|
11557
|
+
var parseToolInputDelta = function parseToolInputDelta(accumulatedRawInput, fallbackInput) {
|
|
11558
|
+
var normalized = accumulatedRawInput.trim();
|
|
11559
|
+
if (!normalized) {
|
|
11560
|
+
return fallbackInput;
|
|
11561
|
+
}
|
|
11562
|
+
var directParsed = tryParseJson(normalized);
|
|
11563
|
+
if (directParsed !== undefined) {
|
|
11564
|
+
return directParsed;
|
|
11565
|
+
}
|
|
11566
|
+
var repairedParsed = tryParseJson(repairPartialJson(normalized));
|
|
11567
|
+
if (repairedParsed !== undefined) {
|
|
11568
|
+
return repairedParsed;
|
|
11569
|
+
}
|
|
11570
|
+
return fallbackInput;
|
|
11571
|
+
};
|
|
11456
11572
|
/**
|
|
11457
11573
|
* Abstract base class for chat implementations.
|
|
11458
11574
|
*/ var AbstractChat = /*#__PURE__*/ function() {
|
|
11459
11575
|
function AbstractChat(param) {
|
|
11460
11576
|
var _this = this;
|
|
11461
|
-
var _param_generateId = param.generateId, generateId$1 = _param_generateId === void 0 ? generateId : _param_generateId, _param_id = param.id, id = _param_id === void 0 ? generateId$1() : _param_id, transport = param.transport, state = param.state, onError = param.onError, onToolCall = param.onToolCall, onFinish = param.onFinish, onData = param.onData, sendAutomaticallyWhen = param.sendAutomaticallyWhen;
|
|
11577
|
+
var _param_generateId = param.generateId, generateId$1 = _param_generateId === void 0 ? generateId : _param_generateId, _param_id = param.id, id = _param_id === void 0 ? generateId$1() : _param_id, transport = param.transport, state = param.state, onError = param.onError, onToolCall = param.onToolCall, onFinish = param.onFinish, onData = param.onData, sendAutomaticallyWhen = param.sendAutomaticallyWhen, shouldRepairToolInput = param.shouldRepairToolInput;
|
|
11462
11578
|
var _this1 = this;
|
|
11463
11579
|
_class_call_check(this, AbstractChat);
|
|
11464
11580
|
_define_property(this, "id", void 0);
|
|
@@ -11470,6 +11586,7 @@
|
|
|
11470
11586
|
_define_property(this, "onFinish", void 0);
|
|
11471
11587
|
_define_property(this, "onData", void 0);
|
|
11472
11588
|
_define_property(this, "sendAutomaticallyWhen", void 0);
|
|
11589
|
+
_define_property(this, "shouldRepairToolInput", void 0);
|
|
11473
11590
|
_define_property(this, "activeResponse", null);
|
|
11474
11591
|
_define_property(this, "jobExecutor", new SerialJobExecutor());
|
|
11475
11592
|
/**
|
|
@@ -11679,6 +11796,7 @@
|
|
|
11679
11796
|
this.onFinish = onFinish;
|
|
11680
11797
|
this.onData = onData;
|
|
11681
11798
|
this.sendAutomaticallyWhen = sendAutomaticallyWhen;
|
|
11799
|
+
this.shouldRepairToolInput = shouldRepairToolInput;
|
|
11682
11800
|
}
|
|
11683
11801
|
_create_class(AbstractChat, [
|
|
11684
11802
|
{
|
|
@@ -11781,6 +11899,7 @@
|
|
|
11781
11899
|
// Track current text/reasoning part state
|
|
11782
11900
|
var currentTextPartId;
|
|
11783
11901
|
var currentReasoningPartId;
|
|
11902
|
+
var toolRawInputByCallId = {};
|
|
11784
11903
|
// Promise chain for handling tool calls that return promises
|
|
11785
11904
|
var pendingToolCall = Promise.resolve();
|
|
11786
11905
|
return new Promise(function(resolve) {
|
|
@@ -11919,11 +12038,14 @@
|
|
|
11919
12038
|
case 'tool-input-start':
|
|
11920
12039
|
{
|
|
11921
12040
|
if (!currentMessage) break;
|
|
12041
|
+
var initialRawInput = typeof chunk.input === 'string' ? chunk.input : chunk.input !== undefined ? JSON.stringify(chunk.input) : '';
|
|
12042
|
+
toolRawInputByCallId[chunk.toolCallId] = initialRawInput;
|
|
11922
12043
|
var toolPart = {
|
|
11923
12044
|
type: "tool-".concat(chunk.toolName),
|
|
11924
12045
|
toolCallId: chunk.toolCallId,
|
|
11925
12046
|
state: 'input-streaming',
|
|
11926
12047
|
input: chunk.input,
|
|
12048
|
+
rawInput: initialRawInput || undefined,
|
|
11927
12049
|
providerExecuted: chunk.providerExecuted
|
|
11928
12050
|
};
|
|
11929
12051
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
@@ -11936,11 +12058,47 @@
|
|
|
11936
12058
|
}
|
|
11937
12059
|
case 'tool-input-delta':
|
|
11938
12060
|
{
|
|
12061
|
+
var _ref, _ref1, _chunk_toolName, _ref2;
|
|
12062
|
+
var _existingPart_type, _this_shouldRepairToolInput, _this1;
|
|
12063
|
+
if (!currentMessage) break;
|
|
12064
|
+
var toolIndex = currentMessage.parts.findIndex(function(p) {
|
|
12065
|
+
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12066
|
+
});
|
|
12067
|
+
var existingPart = toolIndex >= 0 ? currentMessage.parts[toolIndex] : null;
|
|
12068
|
+
var previousRawInput = (_ref = (_ref1 = existingPart === null || existingPart === void 0 ? void 0 : existingPart.rawInput) !== null && _ref1 !== void 0 ? _ref1 : toolRawInputByCallId[chunk.toolCallId]) !== null && _ref !== void 0 ? _ref : '';
|
|
12069
|
+
var nextRawInput = "".concat(previousRawInput).concat(chunk.inputTextDelta);
|
|
12070
|
+
toolRawInputByCallId[chunk.toolCallId] = nextRawInput;
|
|
12071
|
+
var toolName = (_chunk_toolName = chunk.toolName) !== null && _chunk_toolName !== void 0 ? _chunk_toolName : existingPart === null || existingPart === void 0 ? void 0 : (_existingPart_type = existingPart.type) === null || _existingPart_type === void 0 ? void 0 : _existingPart_type.replace('tool-', '');
|
|
12072
|
+
var shouldRepair = toolName ? (_ref2 = (_this_shouldRepairToolInput = (_this1 = _this).shouldRepairToolInput) === null || _this_shouldRepairToolInput === void 0 ? void 0 : _this_shouldRepairToolInput.call(_this1, toolName)) !== null && _ref2 !== void 0 ? _ref2 : true : true;
|
|
12073
|
+
var parsedInput = shouldRepair ? parseToolInputDelta(nextRawInput, existingPart === null || existingPart === void 0 ? void 0 : existingPart.input) : existingPart === null || existingPart === void 0 ? void 0 : existingPart.input;
|
|
12074
|
+
var nextToolPart = _object_spread_props(_object_spread({}, existingPart !== null && existingPart !== void 0 ? existingPart : {
|
|
12075
|
+
type: "tool-".concat(chunk.toolName),
|
|
12076
|
+
toolCallId: chunk.toolCallId
|
|
12077
|
+
}), {
|
|
12078
|
+
state: 'input-streaming',
|
|
12079
|
+
input: parsedInput,
|
|
12080
|
+
rawInput: nextRawInput
|
|
12081
|
+
});
|
|
12082
|
+
if (toolIndex >= 0) {
|
|
12083
|
+
var updatedParts4 = _to_consumable_array(currentMessage.parts);
|
|
12084
|
+
updatedParts4[toolIndex] = nextToolPart;
|
|
12085
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12086
|
+
parts: updatedParts4
|
|
12087
|
+
});
|
|
12088
|
+
} else {
|
|
12089
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12090
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12091
|
+
nextToolPart
|
|
12092
|
+
])
|
|
12093
|
+
});
|
|
12094
|
+
}
|
|
12095
|
+
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
11939
12096
|
break;
|
|
11940
12097
|
}
|
|
11941
12098
|
case 'tool-input-available':
|
|
11942
12099
|
{
|
|
11943
12100
|
if (!currentMessage) break;
|
|
12101
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
11944
12102
|
// Find existing tool part or create new one
|
|
11945
12103
|
var existingIndex = currentMessage.parts.findIndex(function(p) {
|
|
11946
12104
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
@@ -11954,10 +12112,10 @@
|
|
|
11954
12112
|
providerExecuted: chunk.providerExecuted
|
|
11955
12113
|
};
|
|
11956
12114
|
if (existingIndex >= 0) {
|
|
11957
|
-
var
|
|
11958
|
-
|
|
12115
|
+
var updatedParts5 = _to_consumable_array(currentMessage.parts);
|
|
12116
|
+
updatedParts5[existingIndex] = toolPart1;
|
|
11959
12117
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
11960
|
-
parts:
|
|
12118
|
+
parts: updatedParts5
|
|
11961
12119
|
});
|
|
11962
12120
|
} else {
|
|
11963
12121
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
@@ -11974,7 +12132,8 @@
|
|
|
11974
12132
|
toolCall: {
|
|
11975
12133
|
toolName: chunk.toolName,
|
|
11976
12134
|
toolCallId: chunk.toolCallId,
|
|
11977
|
-
input: chunk.input
|
|
12135
|
+
input: chunk.input,
|
|
12136
|
+
dynamic: 'dynamic' in chunk ? chunk.dynamic : undefined
|
|
11978
12137
|
}
|
|
11979
12138
|
});
|
|
11980
12139
|
if (result && typeof result.then === 'function') {
|
|
@@ -11988,20 +12147,21 @@
|
|
|
11988
12147
|
case 'tool-output-available':
|
|
11989
12148
|
{
|
|
11990
12149
|
if (!currentMessage) break;
|
|
11991
|
-
var
|
|
12150
|
+
var toolIndex1 = currentMessage.parts.findIndex(function(p) {
|
|
11992
12151
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
11993
12152
|
});
|
|
11994
|
-
if (
|
|
11995
|
-
|
|
11996
|
-
var
|
|
11997
|
-
|
|
12153
|
+
if (toolIndex1 >= 0) {
|
|
12154
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
12155
|
+
var updatedParts6 = _to_consumable_array(currentMessage.parts);
|
|
12156
|
+
var existingPart1 = updatedParts6[toolIndex1];
|
|
12157
|
+
updatedParts6[toolIndex1] = _object_spread_props(_object_spread({}, existingPart1), {
|
|
11998
12158
|
state: 'output-available',
|
|
11999
12159
|
output: chunk.output,
|
|
12000
12160
|
callProviderMetadata: chunk.callProviderMetadata,
|
|
12001
12161
|
preliminary: chunk.preliminary
|
|
12002
12162
|
});
|
|
12003
12163
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12004
|
-
parts:
|
|
12164
|
+
parts: updatedParts6
|
|
12005
12165
|
});
|
|
12006
12166
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
12007
12167
|
}
|
|
@@ -12010,21 +12170,22 @@
|
|
|
12010
12170
|
case 'tool-error':
|
|
12011
12171
|
{
|
|
12012
12172
|
if (!currentMessage) break;
|
|
12013
|
-
var
|
|
12173
|
+
var toolIndex2 = currentMessage.parts.findIndex(function(p) {
|
|
12014
12174
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12015
12175
|
});
|
|
12016
|
-
if (
|
|
12176
|
+
if (toolIndex2 >= 0) {
|
|
12017
12177
|
var _chunk_input;
|
|
12018
|
-
|
|
12019
|
-
var
|
|
12020
|
-
|
|
12178
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
12179
|
+
var updatedParts7 = _to_consumable_array(currentMessage.parts);
|
|
12180
|
+
var existingPart2 = updatedParts7[toolIndex2];
|
|
12181
|
+
updatedParts7[toolIndex2] = _object_spread_props(_object_spread({}, existingPart2), {
|
|
12021
12182
|
state: 'output-error',
|
|
12022
12183
|
errorText: chunk.errorText,
|
|
12023
|
-
input: (_chunk_input = chunk.input) !== null && _chunk_input !== void 0 ? _chunk_input :
|
|
12184
|
+
input: (_chunk_input = chunk.input) !== null && _chunk_input !== void 0 ? _chunk_input : existingPart2.input,
|
|
12024
12185
|
callProviderMetadata: chunk.callProviderMetadata
|
|
12025
12186
|
});
|
|
12026
12187
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12027
|
-
parts:
|
|
12188
|
+
parts: updatedParts7
|
|
12028
12189
|
});
|
|
12029
12190
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
12030
12191
|
}
|
|
@@ -12754,7 +12915,7 @@
|
|
|
12754
12915
|
return refinements;
|
|
12755
12916
|
}
|
|
12756
12917
|
|
|
12757
|
-
var withUsage$
|
|
12918
|
+
var withUsage$n = createDocumentationMessageGenerator({
|
|
12758
12919
|
name: 'chat',
|
|
12759
12920
|
connector: true
|
|
12760
12921
|
});
|
|
@@ -12805,12 +12966,14 @@
|
|
|
12805
12966
|
}
|
|
12806
12967
|
var connectChat = function connectChat(renderFn) {
|
|
12807
12968
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
12808
|
-
checkRendering(renderFn, withUsage$
|
|
12969
|
+
checkRendering(renderFn, withUsage$n());
|
|
12809
12970
|
return function(widgetParams) {
|
|
12810
|
-
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, options = _object_without_properties(_ref, [
|
|
12971
|
+
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, context = _ref.context, initialUserMessage = _ref.initialUserMessage, options = _object_without_properties(_ref, [
|
|
12811
12972
|
"resume",
|
|
12812
12973
|
"tools",
|
|
12813
|
-
"type"
|
|
12974
|
+
"type",
|
|
12975
|
+
"context",
|
|
12976
|
+
"initialUserMessage"
|
|
12814
12977
|
]);
|
|
12815
12978
|
var _chatInstance;
|
|
12816
12979
|
var input = '';
|
|
@@ -12852,6 +13015,10 @@
|
|
|
12852
13015
|
if (!_chatInstance.messages || _chatInstance.messages.length === 0) {
|
|
12853
13016
|
return;
|
|
12854
13017
|
}
|
|
13018
|
+
var status = _chatInstance.status;
|
|
13019
|
+
if (status === 'submitted' || status === 'streaming') {
|
|
13020
|
+
_chatInstance.stop();
|
|
13021
|
+
}
|
|
12855
13022
|
setIsClearing(true);
|
|
12856
13023
|
};
|
|
12857
13024
|
var onClearTransitionEnd = function onClearTransitionEnd() {
|
|
@@ -12901,7 +13068,7 @@
|
|
|
12901
13068
|
}
|
|
12902
13069
|
if ('agentId' in options && options.agentId) {
|
|
12903
13070
|
if (!appId || !apiKey) {
|
|
12904
|
-
throw new Error(withUsage$
|
|
13071
|
+
throw new Error(withUsage$n('Could not extract Algolia credentials from the search client.'));
|
|
12905
13072
|
}
|
|
12906
13073
|
var baseApi = "https://".concat(appId, ".algolia.net/agent-studio/1/agents/").concat(agentId, "/completions?compatibilityMode=ai-sdk-5");
|
|
12907
13074
|
transport = new DefaultChatTransport({
|
|
@@ -12927,7 +13094,7 @@
|
|
|
12927
13094
|
});
|
|
12928
13095
|
}
|
|
12929
13096
|
if (!transport) {
|
|
12930
|
-
throw new Error(withUsage$
|
|
13097
|
+
throw new Error(withUsage$n('You need to provide either an `agentId` or a `transport`.'));
|
|
12931
13098
|
}
|
|
12932
13099
|
if ('chat' in options) {
|
|
12933
13100
|
return options.chat;
|
|
@@ -12935,6 +13102,14 @@
|
|
|
12935
13102
|
return new Chat$1(_object_spread_props(_object_spread({}, options), {
|
|
12936
13103
|
transport: transport,
|
|
12937
13104
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
13105
|
+
shouldRepairToolInput: function shouldRepairToolInput(toolName) {
|
|
13106
|
+
var tool = tools[toolName];
|
|
13107
|
+
if (!tool && toolName.startsWith("".concat(SearchIndexToolType$1, "_"))) {
|
|
13108
|
+
tool = tools[SearchIndexToolType$1];
|
|
13109
|
+
}
|
|
13110
|
+
if (!tool) return true;
|
|
13111
|
+
return Boolean(tool.streamInput);
|
|
13112
|
+
},
|
|
12938
13113
|
onToolCall: function onToolCall(param) {
|
|
12939
13114
|
var toolCall = param.toolCall;
|
|
12940
13115
|
var tool = tools[toolCall.toolName];
|
|
@@ -13000,7 +13175,7 @@
|
|
|
13000
13175
|
if (agentId && feedback) {
|
|
13001
13176
|
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(initOptions.instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13002
13177
|
if (!appId || !apiKey) {
|
|
13003
|
-
throw new Error(withUsage$
|
|
13178
|
+
throw new Error(withUsage$n('Could not extract Algolia credentials from the search client.'));
|
|
13004
13179
|
}
|
|
13005
13180
|
feedbackAbortController = new AbortController();
|
|
13006
13181
|
_sendChatMessageFeedback = function _sendChatMessageFeedback(messageId, vote) {
|
|
@@ -13025,6 +13200,11 @@
|
|
|
13025
13200
|
if (resume) {
|
|
13026
13201
|
_chatInstance.resumeStream();
|
|
13027
13202
|
}
|
|
13203
|
+
if (initialUserMessage && !resume && _chatInstance.messages.length === 0) {
|
|
13204
|
+
_chatInstance.sendMessage({
|
|
13205
|
+
text: initialUserMessage
|
|
13206
|
+
});
|
|
13207
|
+
}
|
|
13028
13208
|
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13029
13209
|
instantSearchInstance: instantSearchInstance
|
|
13030
13210
|
}), true);
|
|
@@ -13060,10 +13240,65 @@
|
|
|
13060
13240
|
var _param = _sliced_to_array(param, 2), key = _param[0], tool = _param[1];
|
|
13061
13241
|
var toolWithAddToolResult = _object_spread_props(_object_spread({}, tool), {
|
|
13062
13242
|
addToolResult: _chatInstance.addToolResult,
|
|
13063
|
-
applyFilters: applyFilters
|
|
13243
|
+
applyFilters: applyFilters,
|
|
13244
|
+
sendEvent: sendEvent
|
|
13064
13245
|
});
|
|
13065
13246
|
toolsWithAddToolResult[key] = toolWithAddToolResult;
|
|
13066
13247
|
});
|
|
13248
|
+
var sendMessageWithContext = function sendMessageWithContext(message) {
|
|
13249
|
+
for(var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
13250
|
+
rest[_key - 1] = arguments[_key];
|
|
13251
|
+
}
|
|
13252
|
+
var _chatInstance1;
|
|
13253
|
+
if (!context || !message) {
|
|
13254
|
+
var _chatInstance2;
|
|
13255
|
+
return (_chatInstance2 = _chatInstance).sendMessage.apply(_chatInstance2, [
|
|
13256
|
+
message
|
|
13257
|
+
].concat(_to_consumable_array(rest)));
|
|
13258
|
+
}
|
|
13259
|
+
var resolvedContext = typeof context === 'function' ? context() : context;
|
|
13260
|
+
var serializedContext;
|
|
13261
|
+
try {
|
|
13262
|
+
serializedContext = JSON.stringify(resolvedContext);
|
|
13263
|
+
} catch (unused) {
|
|
13264
|
+
var _chatInstance3;
|
|
13265
|
+
return (_chatInstance3 = _chatInstance).sendMessage.apply(_chatInstance3, [
|
|
13266
|
+
message
|
|
13267
|
+
].concat(_to_consumable_array(rest)));
|
|
13268
|
+
}
|
|
13269
|
+
var contextTextPart = {
|
|
13270
|
+
type: 'text',
|
|
13271
|
+
text: '<context>'.concat(serializedContext).concat('</context>')
|
|
13272
|
+
};
|
|
13273
|
+
if ('parts' in message && message.parts) {
|
|
13274
|
+
var _chatInstance4;
|
|
13275
|
+
return (_chatInstance4 = _chatInstance).sendMessage.apply(_chatInstance4, [
|
|
13276
|
+
_object_spread_props(_object_spread({}, message), {
|
|
13277
|
+
parts: [
|
|
13278
|
+
contextTextPart
|
|
13279
|
+
].concat(_to_consumable_array(message.parts)),
|
|
13280
|
+
text: undefined,
|
|
13281
|
+
files: undefined
|
|
13282
|
+
})
|
|
13283
|
+
].concat(_to_consumable_array(rest)));
|
|
13284
|
+
}
|
|
13285
|
+
var textContent = 'text' in message && message.text ? message.text : '';
|
|
13286
|
+
return (_chatInstance1 = _chatInstance).sendMessage.apply(_chatInstance1, [
|
|
13287
|
+
{
|
|
13288
|
+
parts: [
|
|
13289
|
+
contextTextPart,
|
|
13290
|
+
{
|
|
13291
|
+
type: 'text',
|
|
13292
|
+
text: textContent
|
|
13293
|
+
}
|
|
13294
|
+
],
|
|
13295
|
+
metadata: message.metadata,
|
|
13296
|
+
messageId: message.messageId,
|
|
13297
|
+
files: undefined,
|
|
13298
|
+
text: undefined
|
|
13299
|
+
}
|
|
13300
|
+
].concat(_to_consumable_array(rest)));
|
|
13301
|
+
};
|
|
13067
13302
|
return {
|
|
13068
13303
|
indexUiState: instantSearchInstance.getUiState()[parent.getIndexId()],
|
|
13069
13304
|
input: input,
|
|
@@ -13090,7 +13325,7 @@
|
|
|
13090
13325
|
messages: _chatInstance.messages,
|
|
13091
13326
|
regenerate: _chatInstance.regenerate,
|
|
13092
13327
|
resumeStream: _chatInstance.resumeStream,
|
|
13093
|
-
sendMessage:
|
|
13328
|
+
sendMessage: sendMessageWithContext,
|
|
13094
13329
|
status: _chatInstance.status,
|
|
13095
13330
|
stop: _chatInstance.stop
|
|
13096
13331
|
};
|
|
@@ -13113,13 +13348,13 @@
|
|
|
13113
13348
|
return useConnector(connectChat, props, additionalWidgetProperties);
|
|
13114
13349
|
}
|
|
13115
13350
|
|
|
13116
|
-
var withUsage$
|
|
13351
|
+
var withUsage$m = createDocumentationMessageGenerator({
|
|
13117
13352
|
name: 'clear-refinements',
|
|
13118
13353
|
connector: true
|
|
13119
13354
|
});
|
|
13120
13355
|
var connectClearRefinements = function connectClearRefinements(renderFn) {
|
|
13121
13356
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13122
|
-
checkRendering(renderFn, withUsage$
|
|
13357
|
+
checkRendering(renderFn, withUsage$m());
|
|
13123
13358
|
return function(widgetParams) {
|
|
13124
13359
|
var _ref = widgetParams || {}, _ref_includedAttributes = _ref.includedAttributes, includedAttributes = _ref_includedAttributes === void 0 ? [] : _ref_includedAttributes, _ref_excludedAttributes = _ref.excludedAttributes, excludedAttributes = _ref_excludedAttributes === void 0 ? [
|
|
13125
13360
|
'query'
|
|
@@ -13127,7 +13362,7 @@
|
|
|
13127
13362
|
return items;
|
|
13128
13363
|
} : _ref_transformItems;
|
|
13129
13364
|
if (widgetParams && widgetParams.includedAttributes && widgetParams.excludedAttributes) {
|
|
13130
|
-
throw new Error(withUsage$
|
|
13365
|
+
throw new Error(withUsage$m('The options `includedAttributes` and `excludedAttributes` cannot be used together.'));
|
|
13131
13366
|
}
|
|
13132
13367
|
var connectorState = {
|
|
13133
13368
|
refine: noop,
|
|
@@ -13230,16 +13465,16 @@
|
|
|
13230
13465
|
return useConnector(connectClearRefinements, props, additionalWidgetProperties);
|
|
13231
13466
|
}
|
|
13232
13467
|
|
|
13233
|
-
var withUsage$
|
|
13468
|
+
var withUsage$l = createDocumentationMessageGenerator({
|
|
13234
13469
|
name: 'current-refinements',
|
|
13235
13470
|
connector: true
|
|
13236
13471
|
});
|
|
13237
13472
|
var connectCurrentRefinements = function connectCurrentRefinements(renderFn) {
|
|
13238
13473
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13239
|
-
checkRendering(renderFn, withUsage$
|
|
13474
|
+
checkRendering(renderFn, withUsage$l());
|
|
13240
13475
|
return function(widgetParams) {
|
|
13241
13476
|
if ((widgetParams || {}).includedAttributes && (widgetParams || {}).excludedAttributes) {
|
|
13242
|
-
throw new Error(withUsage$
|
|
13477
|
+
throw new Error(withUsage$l('The options `includedAttributes` and `excludedAttributes` cannot be used together.'));
|
|
13243
13478
|
}
|
|
13244
13479
|
var _ref = widgetParams || {}, includedAttributes = _ref.includedAttributes, _ref_excludedAttributes = _ref.excludedAttributes, excludedAttributes = _ref_excludedAttributes === void 0 ? [
|
|
13245
13480
|
'query'
|
|
@@ -13409,38 +13644,19 @@
|
|
|
13409
13644
|
return useConnector(connectCurrentRefinements, props, additionalWidgetProperties);
|
|
13410
13645
|
}
|
|
13411
13646
|
|
|
13412
|
-
|
|
13413
|
-
return hits.map(function(hit, idx) {
|
|
13414
|
-
return _object_spread_props(_object_spread({}, hit), {
|
|
13415
|
-
__position: hitsPerPage * page + idx + 1
|
|
13416
|
-
});
|
|
13417
|
-
});
|
|
13418
|
-
}
|
|
13419
|
-
|
|
13420
|
-
function addQueryID(hits, queryID) {
|
|
13421
|
-
if (!queryID) {
|
|
13422
|
-
return hits;
|
|
13423
|
-
}
|
|
13424
|
-
return hits.map(function(hit) {
|
|
13425
|
-
return _object_spread_props(_object_spread({}, hit), {
|
|
13426
|
-
__queryID: queryID
|
|
13427
|
-
});
|
|
13428
|
-
});
|
|
13429
|
-
}
|
|
13430
|
-
|
|
13431
|
-
var withUsage$j = createDocumentationMessageGenerator({
|
|
13647
|
+
var withUsage$k = createDocumentationMessageGenerator({
|
|
13432
13648
|
name: 'frequently-bought-together',
|
|
13433
13649
|
connector: true
|
|
13434
13650
|
});
|
|
13435
13651
|
var connectFrequentlyBoughtTogether = function connectFrequentlyBoughtTogether(renderFn) {
|
|
13436
13652
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13437
|
-
checkRendering(renderFn, withUsage$
|
|
13653
|
+
checkRendering(renderFn, withUsage$k());
|
|
13438
13654
|
return function(widgetParams) {
|
|
13439
13655
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
13440
13656
|
return items;
|
|
13441
13657
|
} : _ref_transformItems, objectIDs = _ref.objectIDs, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, queryParameters = _ref.queryParameters;
|
|
13442
13658
|
if (!objectIDs || objectIDs.length === 0) {
|
|
13443
|
-
throw new Error(withUsage$
|
|
13659
|
+
throw new Error(withUsage$k('The `objectIDs` option is required.'));
|
|
13444
13660
|
}
|
|
13445
13661
|
var sendEvent;
|
|
13446
13662
|
return {
|
|
@@ -13578,7 +13794,7 @@
|
|
|
13578
13794
|
return insideBoundingBoxStringToBoundingBox(value);
|
|
13579
13795
|
}
|
|
13580
13796
|
|
|
13581
|
-
var withUsage$
|
|
13797
|
+
var withUsage$j = createDocumentationMessageGenerator({
|
|
13582
13798
|
name: 'geo-search',
|
|
13583
13799
|
connector: true
|
|
13584
13800
|
});
|
|
@@ -13602,7 +13818,7 @@
|
|
|
13602
13818
|
* Currently, the feature is not compatible with multiple values in the _geoloc attribute.
|
|
13603
13819
|
*/ var connectGeoSearch = function connectGeoSearch(renderFn) {
|
|
13604
13820
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13605
|
-
checkRendering(renderFn, withUsage$
|
|
13821
|
+
checkRendering(renderFn, withUsage$j());
|
|
13606
13822
|
return function(widgetParams) {
|
|
13607
13823
|
var _ref = widgetParams || {}, _ref_enableRefineOnMapMove = _ref.enableRefineOnMapMove, enableRefineOnMapMove = _ref_enableRefineOnMapMove === void 0 ? true : _ref_enableRefineOnMapMove, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
13608
13824
|
return items;
|
|
@@ -13820,7 +14036,7 @@
|
|
|
13820
14036
|
return sendEventForFacet;
|
|
13821
14037
|
}
|
|
13822
14038
|
|
|
13823
|
-
var withUsage$
|
|
14039
|
+
var withUsage$i = createDocumentationMessageGenerator({
|
|
13824
14040
|
name: 'hierarchical-menu',
|
|
13825
14041
|
connector: true
|
|
13826
14042
|
});
|
|
@@ -13841,16 +14057,16 @@
|
|
|
13841
14057
|
* @return {function(CustomHierarchicalMenuWidgetParams)} Re-usable widget factory for a custom **HierarchicalMenu** widget.
|
|
13842
14058
|
*/ var connectHierarchicalMenu = function connectHierarchicalMenu(renderFn) {
|
|
13843
14059
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13844
|
-
checkRendering(renderFn, withUsage$
|
|
14060
|
+
checkRendering(renderFn, withUsage$i());
|
|
13845
14061
|
return function(widgetParams) {
|
|
13846
14062
|
var _ref = widgetParams || {}, attributes = _ref.attributes, _ref_separator = _ref.separator, separator = _ref_separator === void 0 ? ' > ' : _ref_separator, _ref_rootPath = _ref.rootPath, rootPath = _ref_rootPath === void 0 ? null : _ref_rootPath, _ref_showParentLevel = _ref.showParentLevel, showParentLevel = _ref_showParentLevel === void 0 ? true : _ref_showParentLevel, _ref_limit = _ref.limit, limit = _ref_limit === void 0 ? 10 : _ref_limit, _ref_showMore = _ref.showMore, showMore = _ref_showMore === void 0 ? false : _ref_showMore, _ref_showMoreLimit = _ref.showMoreLimit, showMoreLimit = _ref_showMoreLimit === void 0 ? 20 : _ref_showMoreLimit, _ref_sortBy = _ref.sortBy, sortBy = _ref_sortBy === void 0 ? DEFAULT_SORT$2 : _ref_sortBy, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
13847
14063
|
return items;
|
|
13848
14064
|
} : _ref_transformItems;
|
|
13849
14065
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
13850
|
-
throw new Error(withUsage$
|
|
14066
|
+
throw new Error(withUsage$i('The `attributes` option expects an array of strings.'));
|
|
13851
14067
|
}
|
|
13852
14068
|
if (showMore === true && showMoreLimit <= limit) {
|
|
13853
|
-
throw new Error(withUsage$
|
|
14069
|
+
throw new Error(withUsage$i('The `showMoreLimit` option must be greater than `limit`.'));
|
|
13854
14070
|
}
|
|
13855
14071
|
// we need to provide a hierarchicalFacet name for the search state
|
|
13856
14072
|
// so that we can always map $hierarchicalFacetName => real attributes
|
|
@@ -14042,13 +14258,13 @@
|
|
|
14042
14258
|
return useConnector(connectHierarchicalMenu, props, additionalWidgetProperties);
|
|
14043
14259
|
}
|
|
14044
14260
|
|
|
14045
|
-
var withUsage$
|
|
14261
|
+
var withUsage$h = createDocumentationMessageGenerator({
|
|
14046
14262
|
name: 'hits',
|
|
14047
14263
|
connector: true
|
|
14048
14264
|
});
|
|
14049
14265
|
var connectHits = function connectHits(renderFn) {
|
|
14050
14266
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14051
|
-
checkRendering(renderFn, withUsage$
|
|
14267
|
+
checkRendering(renderFn, withUsage$h());
|
|
14052
14268
|
return function(widgetParams) {
|
|
14053
14269
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
14054
14270
|
return items;
|
|
@@ -14146,29 +14362,29 @@
|
|
|
14146
14362
|
return useConnector(connectHits, props, additionalWidgetProperties);
|
|
14147
14363
|
}
|
|
14148
14364
|
|
|
14149
|
-
var withUsage$
|
|
14365
|
+
var withUsage$g = createDocumentationMessageGenerator({
|
|
14150
14366
|
name: 'hits-per-page',
|
|
14151
14367
|
connector: true
|
|
14152
14368
|
});
|
|
14153
14369
|
var connectHitsPerPage = function connectHitsPerPage(renderFn) {
|
|
14154
14370
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14155
|
-
checkRendering(renderFn, withUsage$
|
|
14371
|
+
checkRendering(renderFn, withUsage$g());
|
|
14156
14372
|
return function(widgetParams) {
|
|
14157
14373
|
var _ref = widgetParams || {}, userItems = _ref.items, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
14158
14374
|
return items;
|
|
14159
14375
|
} : _ref_transformItems;
|
|
14160
14376
|
if (!Array.isArray(userItems)) {
|
|
14161
|
-
throw new Error(withUsage$
|
|
14377
|
+
throw new Error(withUsage$g('The `items` option expects an array of objects.'));
|
|
14162
14378
|
}
|
|
14163
14379
|
var items = userItems;
|
|
14164
14380
|
var defaultItems = items.filter(function(item) {
|
|
14165
14381
|
return item.default === true;
|
|
14166
14382
|
});
|
|
14167
14383
|
if (defaultItems.length === 0) {
|
|
14168
|
-
throw new Error(withUsage$
|
|
14384
|
+
throw new Error(withUsage$g("A default value must be specified in `items`."));
|
|
14169
14385
|
}
|
|
14170
14386
|
if (defaultItems.length > 1) {
|
|
14171
|
-
throw new Error(withUsage$
|
|
14387
|
+
throw new Error(withUsage$g('More than one default value is specified in `items`.'));
|
|
14172
14388
|
}
|
|
14173
14389
|
var defaultItem = defaultItems[0];
|
|
14174
14390
|
var normalizeItems = function normalizeItems(param) {
|
|
@@ -14287,7 +14503,7 @@
|
|
|
14287
14503
|
});
|
|
14288
14504
|
}
|
|
14289
14505
|
|
|
14290
|
-
var withUsage$
|
|
14506
|
+
var withUsage$f = createDocumentationMessageGenerator({
|
|
14291
14507
|
name: 'infinite-hits',
|
|
14292
14508
|
connector: true
|
|
14293
14509
|
});
|
|
@@ -14333,7 +14549,7 @@
|
|
|
14333
14549
|
}
|
|
14334
14550
|
var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
14335
14551
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14336
|
-
checkRendering(renderFn, withUsage$
|
|
14552
|
+
checkRendering(renderFn, withUsage$f());
|
|
14337
14553
|
return function(widgetParams) {
|
|
14338
14554
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
14339
14555
|
return items;
|
|
@@ -14539,7 +14755,7 @@
|
|
|
14539
14755
|
return useConnector(connectInfiniteHits, props, additionalWidgetProperties);
|
|
14540
14756
|
}
|
|
14541
14757
|
|
|
14542
|
-
var withUsage$
|
|
14758
|
+
var withUsage$e = createDocumentationMessageGenerator({
|
|
14543
14759
|
name: 'menu',
|
|
14544
14760
|
connector: true
|
|
14545
14761
|
});
|
|
@@ -14557,16 +14773,16 @@
|
|
|
14557
14773
|
* **Requirement:** the attribute passed as `attribute` must be present in "attributes for faceting" on the Algolia dashboard or configured as attributesForFaceting via a set settings call to the Algolia API.
|
|
14558
14774
|
*/ var connectMenu = function connectMenu(renderFn) {
|
|
14559
14775
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14560
|
-
checkRendering(renderFn, withUsage$
|
|
14776
|
+
checkRendering(renderFn, withUsage$e());
|
|
14561
14777
|
return function(widgetParams) {
|
|
14562
14778
|
var _ref = widgetParams || {}, attribute = _ref.attribute, _ref_limit = _ref.limit, limit = _ref_limit === void 0 ? 10 : _ref_limit, _ref_showMore = _ref.showMore, showMore = _ref_showMore === void 0 ? false : _ref_showMore, _ref_showMoreLimit = _ref.showMoreLimit, showMoreLimit = _ref_showMoreLimit === void 0 ? 20 : _ref_showMoreLimit, _ref_sortBy = _ref.sortBy, sortBy = _ref_sortBy === void 0 ? DEFAULT_SORT$1 : _ref_sortBy, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
14563
14779
|
return items;
|
|
14564
14780
|
} : _ref_transformItems;
|
|
14565
14781
|
if (!attribute) {
|
|
14566
|
-
throw new Error(withUsage$
|
|
14782
|
+
throw new Error(withUsage$e('The `attribute` option is required.'));
|
|
14567
14783
|
}
|
|
14568
14784
|
if (showMore === true && showMoreLimit <= limit) {
|
|
14569
|
-
throw new Error(withUsage$
|
|
14785
|
+
throw new Error(withUsage$e('The `showMoreLimit` option must be greater than `limit`.'));
|
|
14570
14786
|
}
|
|
14571
14787
|
var sendEvent;
|
|
14572
14788
|
var _createURL;
|
|
@@ -14736,7 +14952,7 @@
|
|
|
14736
14952
|
return typeof value === 'number' && isFinite(value);
|
|
14737
14953
|
}
|
|
14738
14954
|
|
|
14739
|
-
var withUsage$
|
|
14955
|
+
var withUsage$d = createDocumentationMessageGenerator({
|
|
14740
14956
|
name: 'numeric-menu',
|
|
14741
14957
|
connector: true
|
|
14742
14958
|
});
|
|
@@ -14755,16 +14971,16 @@
|
|
|
14755
14971
|
};
|
|
14756
14972
|
var connectNumericMenu = function connectNumericMenu(renderFn) {
|
|
14757
14973
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
14758
|
-
checkRendering(renderFn, withUsage$
|
|
14974
|
+
checkRendering(renderFn, withUsage$d());
|
|
14759
14975
|
return function(widgetParams) {
|
|
14760
14976
|
var _ref = widgetParams || {}, _ref_attribute = _ref.attribute, attribute = _ref_attribute === void 0 ? '' : _ref_attribute, _ref_items = _ref.items, items = _ref_items === void 0 ? [] : _ref_items, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(item) {
|
|
14761
14977
|
return item;
|
|
14762
14978
|
} : _ref_transformItems;
|
|
14763
14979
|
if (attribute === '') {
|
|
14764
|
-
throw new Error(withUsage$
|
|
14980
|
+
throw new Error(withUsage$d('The `attribute` option is required.'));
|
|
14765
14981
|
}
|
|
14766
14982
|
if (!items || items.length === 0) {
|
|
14767
|
-
throw new Error(withUsage$
|
|
14983
|
+
throw new Error(withUsage$d('The `items` option expects an array of objects.'));
|
|
14768
14984
|
}
|
|
14769
14985
|
var prepareItems = function prepareItems(state) {
|
|
14770
14986
|
return items.map(function(param) {
|
|
@@ -15079,7 +15295,7 @@
|
|
|
15079
15295
|
return Paginator;
|
|
15080
15296
|
}();
|
|
15081
15297
|
|
|
15082
|
-
var withUsage$
|
|
15298
|
+
var withUsage$c = createDocumentationMessageGenerator({
|
|
15083
15299
|
name: 'pagination',
|
|
15084
15300
|
connector: true
|
|
15085
15301
|
});
|
|
@@ -15091,7 +15307,7 @@
|
|
|
15091
15307
|
* beyond the 1000th hits by default. You can find more information on the [Algolia documentation](https://www.algolia.com/doc/guides/searching/pagination/#pagination-limitations).
|
|
15092
15308
|
*/ var connectPagination = function connectPagination(renderFn) {
|
|
15093
15309
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15094
|
-
checkRendering(renderFn, withUsage$
|
|
15310
|
+
checkRendering(renderFn, withUsage$c());
|
|
15095
15311
|
return function(widgetParams) {
|
|
15096
15312
|
var _ref = widgetParams || {}, totalPages = _ref.totalPages, _ref_padding = _ref.padding, padding = _ref_padding === void 0 ? 3 : _ref_padding;
|
|
15097
15313
|
var pager = new Paginator({
|
|
@@ -15213,7 +15429,7 @@
|
|
|
15213
15429
|
};
|
|
15214
15430
|
}
|
|
15215
15431
|
|
|
15216
|
-
var withUsage$
|
|
15432
|
+
var withUsage$b = createDocumentationMessageGenerator({
|
|
15217
15433
|
name: 'query-rules',
|
|
15218
15434
|
connector: true
|
|
15219
15435
|
});
|
|
@@ -15269,7 +15485,7 @@
|
|
|
15269
15485
|
}
|
|
15270
15486
|
var connectQueryRules = function connectQueryRules(render) {
|
|
15271
15487
|
var unmount = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15272
|
-
checkRendering(render, withUsage$
|
|
15488
|
+
checkRendering(render, withUsage$b());
|
|
15273
15489
|
return function(widgetParams) {
|
|
15274
15490
|
var _ref = widgetParams || {}, _ref_trackedFilters = _ref.trackedFilters, trackedFilters = _ref_trackedFilters === void 0 ? {} : _ref_trackedFilters, _ref_transformRuleContexts = _ref.transformRuleContexts, transformRuleContexts = _ref_transformRuleContexts === void 0 ? function(rules) {
|
|
15275
15491
|
return rules;
|
|
@@ -15278,7 +15494,7 @@
|
|
|
15278
15494
|
} : _ref_transformItems;
|
|
15279
15495
|
Object.keys(trackedFilters).forEach(function(facetName) {
|
|
15280
15496
|
if (typeof trackedFilters[facetName] !== 'function') {
|
|
15281
|
-
throw new Error(withUsage$
|
|
15497
|
+
throw new Error(withUsage$b("'The \"".concat(facetName, '" filter value in the `trackedFilters` option expects a function.')));
|
|
15282
15498
|
}
|
|
15283
15499
|
});
|
|
15284
15500
|
var hasTrackedFilters = Object.keys(trackedFilters).length > 0;
|
|
@@ -15354,7 +15570,7 @@
|
|
|
15354
15570
|
return useConnector(connectQueryRules, props, additionalWidgetProperties);
|
|
15355
15571
|
}
|
|
15356
15572
|
|
|
15357
|
-
var withUsage$
|
|
15573
|
+
var withUsage$a = createDocumentationMessageGenerator({
|
|
15358
15574
|
name: 'range-input',
|
|
15359
15575
|
connector: true
|
|
15360
15576
|
}, {
|
|
@@ -15378,14 +15594,14 @@
|
|
|
15378
15594
|
* information about the min and max bounds for the current result set.
|
|
15379
15595
|
*/ var connectRange = function connectRange(renderFn) {
|
|
15380
15596
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15381
|
-
checkRendering(renderFn, withUsage$
|
|
15597
|
+
checkRendering(renderFn, withUsage$a());
|
|
15382
15598
|
return function(widgetParams) {
|
|
15383
15599
|
var _ref = widgetParams || {}, _ref_attribute = _ref.attribute, attribute = _ref_attribute === void 0 ? '' : _ref_attribute, minBound = _ref.min, maxBound = _ref.max, _ref_precision = _ref.precision, precision = _ref_precision === void 0 ? 0 : _ref_precision;
|
|
15384
15600
|
if (!attribute) {
|
|
15385
|
-
throw new Error(withUsage$
|
|
15601
|
+
throw new Error(withUsage$a('The `attribute` option is required.'));
|
|
15386
15602
|
}
|
|
15387
15603
|
if (isFiniteNumber(minBound) && isFiniteNumber(maxBound) && minBound > maxBound) {
|
|
15388
|
-
throw new Error(withUsage$
|
|
15604
|
+
throw new Error(withUsage$a("The `max` option can't be lower than `min`."));
|
|
15389
15605
|
}
|
|
15390
15606
|
var formatToNumber = function formatToNumber(v) {
|
|
15391
15607
|
return Number(Number(v).toFixed(precision));
|
|
@@ -15605,7 +15821,7 @@
|
|
|
15605
15821
|
return useConnector(connectRange, props, additionalWidgetProperties);
|
|
15606
15822
|
}
|
|
15607
15823
|
|
|
15608
|
-
var withUsage$
|
|
15824
|
+
var withUsage$9 = createDocumentationMessageGenerator({
|
|
15609
15825
|
name: 'refinement-list',
|
|
15610
15826
|
connector: true
|
|
15611
15827
|
});
|
|
@@ -15627,19 +15843,19 @@
|
|
|
15627
15843
|
* - a `searchForItems()` function to search within the items.
|
|
15628
15844
|
*/ var connectRefinementList = function connectRefinementList(renderFn) {
|
|
15629
15845
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15630
|
-
checkRendering(renderFn, withUsage$
|
|
15846
|
+
checkRendering(renderFn, withUsage$9());
|
|
15631
15847
|
return function(widgetParams) {
|
|
15632
15848
|
var _ref = widgetParams || {}, attribute = _ref.attribute, _ref_operator = _ref.operator, operator = _ref_operator === void 0 ? 'or' : _ref_operator, _ref_limit = _ref.limit, limit = _ref_limit === void 0 ? 10 : _ref_limit, _ref_showMore = _ref.showMore, showMore = _ref_showMore === void 0 ? false : _ref_showMore, _ref_showMoreLimit = _ref.showMoreLimit, showMoreLimit = _ref_showMoreLimit === void 0 ? 20 : _ref_showMoreLimit, _ref_sortBy = _ref.sortBy, sortBy = _ref_sortBy === void 0 ? DEFAULT_SORT : _ref_sortBy, _ref_escapeFacetValues = _ref.escapeFacetValues, escapeFacetValues = _ref_escapeFacetValues === void 0 ? true : _ref_escapeFacetValues, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
15633
15849
|
return items;
|
|
15634
15850
|
} : _ref_transformItems;
|
|
15635
15851
|
if (!attribute) {
|
|
15636
|
-
throw new Error(withUsage$
|
|
15852
|
+
throw new Error(withUsage$9('The `attribute` option is required.'));
|
|
15637
15853
|
}
|
|
15638
15854
|
if (!/^(and|or)$/.test(operator)) {
|
|
15639
|
-
throw new Error(withUsage$
|
|
15855
|
+
throw new Error(withUsage$9('The `operator` must one of: `"and"`, `"or"` (got "'.concat(operator, '").')));
|
|
15640
15856
|
}
|
|
15641
15857
|
if (showMore === true && showMoreLimit <= limit) {
|
|
15642
|
-
throw new Error(withUsage$
|
|
15858
|
+
throw new Error(withUsage$9('`showMoreLimit` should be greater than `limit`.'));
|
|
15643
15859
|
}
|
|
15644
15860
|
var formatItems = function formatItems(_0) {
|
|
15645
15861
|
var label = _0.name, value = _0.escapedValue, item = _object_without_properties(_0, [
|
|
@@ -15867,19 +16083,19 @@
|
|
|
15867
16083
|
return useConnector(connectRefinementList, props, additionalWidgetProperties);
|
|
15868
16084
|
}
|
|
15869
16085
|
|
|
15870
|
-
var withUsage$
|
|
16086
|
+
var withUsage$8 = createDocumentationMessageGenerator({
|
|
15871
16087
|
name: 'related-products',
|
|
15872
16088
|
connector: true
|
|
15873
16089
|
});
|
|
15874
16090
|
var connectRelatedProducts = function connectRelatedProducts(renderFn) {
|
|
15875
16091
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15876
|
-
checkRendering(renderFn, withUsage$
|
|
16092
|
+
checkRendering(renderFn, withUsage$8());
|
|
15877
16093
|
return function(widgetParams) {
|
|
15878
16094
|
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, objectIDs = _ref.objectIDs, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, queryParameters = _ref.queryParameters, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
15879
16095
|
return items;
|
|
15880
16096
|
} : _ref_transformItems;
|
|
15881
16097
|
if (!objectIDs || objectIDs.length === 0) {
|
|
15882
|
-
throw new Error(withUsage$
|
|
16098
|
+
throw new Error(withUsage$8('The `objectIDs` option is required.'));
|
|
15883
16099
|
}
|
|
15884
16100
|
var sendEvent;
|
|
15885
16101
|
return {
|
|
@@ -15955,7 +16171,7 @@
|
|
|
15955
16171
|
return useConnector(connectRelatedProducts, props, additionalWidgetProperties);
|
|
15956
16172
|
}
|
|
15957
16173
|
|
|
15958
|
-
var withUsage$
|
|
16174
|
+
var withUsage$7 = createDocumentationMessageGenerator({
|
|
15959
16175
|
name: 'search-box',
|
|
15960
16176
|
connector: true
|
|
15961
16177
|
});
|
|
@@ -15969,7 +16185,7 @@
|
|
|
15969
16185
|
* may be impacted by the `queryHook` widget parameter.
|
|
15970
16186
|
*/ var connectSearchBox = function connectSearchBox(renderFn) {
|
|
15971
16187
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
15972
|
-
checkRendering(renderFn, withUsage$
|
|
16188
|
+
checkRendering(renderFn, withUsage$7());
|
|
15973
16189
|
return function(widgetParams) {
|
|
15974
16190
|
var _ref = widgetParams || {}, _ref_queryHook = _ref.queryHook, queryHook = _ref_queryHook === void 0 ? defaultQueryHook : _ref_queryHook;
|
|
15975
16191
|
var _refine;
|
|
@@ -16040,7 +16256,7 @@
|
|
|
16040
16256
|
return useConnector(connectSearchBox, props, additionalWidgetProperties);
|
|
16041
16257
|
}
|
|
16042
16258
|
|
|
16043
|
-
var withUsage$
|
|
16259
|
+
var withUsage$6 = createDocumentationMessageGenerator({
|
|
16044
16260
|
name: 'sort-by',
|
|
16045
16261
|
connector: true
|
|
16046
16262
|
});
|
|
@@ -16060,14 +16276,14 @@
|
|
|
16060
16276
|
}
|
|
16061
16277
|
var connectSortBy = function connectSortBy(renderFn) {
|
|
16062
16278
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16063
|
-
checkRendering(renderFn, withUsage$
|
|
16279
|
+
checkRendering(renderFn, withUsage$6());
|
|
16064
16280
|
var connectorState = {};
|
|
16065
16281
|
return function(widgetParams) {
|
|
16066
16282
|
var _ref = widgetParams || {}, items = _ref.items, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(x) {
|
|
16067
16283
|
return x;
|
|
16068
16284
|
} : _ref_transformItems;
|
|
16069
16285
|
if (!Array.isArray(items)) {
|
|
16070
|
-
throw new Error(withUsage$
|
|
16286
|
+
throw new Error(withUsage$6('The `items` option expects an array of objects.'));
|
|
16071
16287
|
}
|
|
16072
16288
|
var itemsLookup = {};
|
|
16073
16289
|
items.forEach(function(item, index) {
|
|
@@ -16075,10 +16291,10 @@
|
|
|
16075
16291
|
var hasStrategy = 'strategy' in item && item.strategy !== undefined;
|
|
16076
16292
|
// Validate mutual exclusivity
|
|
16077
16293
|
if (hasValue && hasStrategy) {
|
|
16078
|
-
throw new Error(withUsage$
|
|
16294
|
+
throw new Error(withUsage$6("Item at index ".concat(index, ' cannot have both "value" and "strategy" properties.')));
|
|
16079
16295
|
}
|
|
16080
16296
|
if (!hasValue && !hasStrategy) {
|
|
16081
|
-
throw new Error(withUsage$
|
|
16297
|
+
throw new Error(withUsage$6("Item at index ".concat(index, ' must have either a "value" or "strategy" property.')));
|
|
16082
16298
|
}
|
|
16083
16299
|
var itemValue = getItemValue(item);
|
|
16084
16300
|
itemsLookup[itemValue] = item;
|
|
@@ -16093,7 +16309,7 @@
|
|
|
16093
16309
|
return 'strategy' in item && item.strategy;
|
|
16094
16310
|
});
|
|
16095
16311
|
if (hasStrategyItems && !instantSearchInstance.compositionID) {
|
|
16096
|
-
throw new Error(withUsage$
|
|
16312
|
+
throw new Error(withUsage$6('Sorting strategies can only be used in composition mode. Please provide a "compositionID" to your InstantSearch instance.'));
|
|
16097
16313
|
}
|
|
16098
16314
|
var widgetRenderState = this.getWidgetRenderState(initOptions);
|
|
16099
16315
|
var currentIndex = widgetRenderState.currentRefinement;
|
|
@@ -16206,13 +16422,13 @@
|
|
|
16206
16422
|
return useConnector(connectSortBy, props, additionalWidgetProperties);
|
|
16207
16423
|
}
|
|
16208
16424
|
|
|
16209
|
-
var withUsage$
|
|
16425
|
+
var withUsage$5 = createDocumentationMessageGenerator({
|
|
16210
16426
|
name: 'stats',
|
|
16211
16427
|
connector: true
|
|
16212
16428
|
});
|
|
16213
16429
|
var connectStats = function connectStats(renderFn) {
|
|
16214
16430
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16215
|
-
checkRendering(renderFn, withUsage$
|
|
16431
|
+
checkRendering(renderFn, withUsage$5());
|
|
16216
16432
|
return function(widgetParams) {
|
|
16217
16433
|
return {
|
|
16218
16434
|
$$type: 'ais.stats',
|
|
@@ -16271,7 +16487,7 @@
|
|
|
16271
16487
|
return useConnector(connectStats, props, additionalWidgetProperties);
|
|
16272
16488
|
}
|
|
16273
16489
|
|
|
16274
|
-
var withUsage$
|
|
16490
|
+
var withUsage$4 = createDocumentationMessageGenerator({
|
|
16275
16491
|
name: 'toggle-refinement',
|
|
16276
16492
|
connector: true
|
|
16277
16493
|
});
|
|
@@ -16322,11 +16538,11 @@
|
|
|
16322
16538
|
* - switch between two values.
|
|
16323
16539
|
*/ var connectToggleRefinement = function connectToggleRefinement(renderFn) {
|
|
16324
16540
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16325
|
-
checkRendering(renderFn, withUsage$
|
|
16541
|
+
checkRendering(renderFn, withUsage$4());
|
|
16326
16542
|
return function(widgetParams) {
|
|
16327
16543
|
var _ref = widgetParams || {}, attribute = _ref.attribute, tmp = _ref.on, userOn = tmp === void 0 ? true : tmp, userOff = _ref.off;
|
|
16328
16544
|
if (!attribute) {
|
|
16329
|
-
throw new Error(withUsage$
|
|
16545
|
+
throw new Error(withUsage$4('The `attribute` option is required.'));
|
|
16330
16546
|
}
|
|
16331
16547
|
var hasAnOffValue = userOff !== undefined;
|
|
16332
16548
|
// even though facet values can be numbers and boolean,
|
|
@@ -16547,19 +16763,19 @@
|
|
|
16547
16763
|
return useConnector(connectToggleRefinement, props, additionalWidgetProperties);
|
|
16548
16764
|
}
|
|
16549
16765
|
|
|
16550
|
-
var withUsage$
|
|
16766
|
+
var withUsage$3 = createDocumentationMessageGenerator({
|
|
16551
16767
|
name: 'trending-items',
|
|
16552
16768
|
connector: true
|
|
16553
16769
|
});
|
|
16554
16770
|
var connectTrendingItems = function connectTrendingItems(renderFn) {
|
|
16555
16771
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16556
|
-
checkRendering(renderFn, withUsage$
|
|
16772
|
+
checkRendering(renderFn, withUsage$3());
|
|
16557
16773
|
return function(widgetParams) {
|
|
16558
16774
|
var _ref = widgetParams || {}, facetName = _ref.facetName, facetValue = _ref.facetValue, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, queryParameters = _ref.queryParameters, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
16559
16775
|
return items;
|
|
16560
16776
|
} : _ref_transformItems;
|
|
16561
16777
|
if (facetName && !facetValue || !facetName && facetValue) {
|
|
16562
|
-
throw new Error(withUsage$
|
|
16778
|
+
throw new Error(withUsage$3("When you provide facetName (received type ".concat(getObjectType(facetName), "), you must also provide facetValue (received type ").concat(getObjectType(facetValue), ").")));
|
|
16563
16779
|
}
|
|
16564
16780
|
var sendEvent;
|
|
16565
16781
|
return {
|
|
@@ -16633,24 +16849,23 @@
|
|
|
16633
16849
|
return useConnector(connectTrendingItems, props, additionalWidgetProperties);
|
|
16634
16850
|
}
|
|
16635
16851
|
|
|
16636
|
-
var withUsage$
|
|
16637
|
-
name: '
|
|
16852
|
+
var withUsage$2 = createDocumentationMessageGenerator({
|
|
16853
|
+
name: 'trending-facets',
|
|
16638
16854
|
connector: true
|
|
16639
16855
|
});
|
|
16640
|
-
var
|
|
16856
|
+
var connectTrendingFacets = function connectTrendingFacets(renderFn) {
|
|
16641
16857
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16642
|
-
checkRendering(renderFn, withUsage$
|
|
16858
|
+
checkRendering(renderFn, withUsage$2());
|
|
16643
16859
|
return function(widgetParams) {
|
|
16644
|
-
var _ref = widgetParams || {},
|
|
16860
|
+
var _ref = widgetParams || {}, facetName = _ref.facetName, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, queryParameters = _ref.queryParameters, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
16645
16861
|
return items;
|
|
16646
16862
|
} : _ref_transformItems;
|
|
16647
|
-
if (!
|
|
16648
|
-
throw new Error(withUsage$
|
|
16863
|
+
if (!facetName) {
|
|
16864
|
+
throw new Error(withUsage$2('The `facetName` option is required.'));
|
|
16649
16865
|
}
|
|
16650
|
-
var sendEvent;
|
|
16651
16866
|
return {
|
|
16652
16867
|
dependsOn: 'recommend',
|
|
16653
|
-
$$type: 'ais.
|
|
16868
|
+
$$type: 'ais.trendingFacets',
|
|
16654
16869
|
init: function init(initOptions) {
|
|
16655
16870
|
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16656
16871
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
@@ -16666,31 +16881,120 @@
|
|
|
16666
16881
|
return renderState;
|
|
16667
16882
|
},
|
|
16668
16883
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
16669
|
-
var results = param.results
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
instantSearchInstance: instantSearchInstance,
|
|
16673
|
-
helper: helper,
|
|
16674
|
-
widgetType: this.$$type
|
|
16675
|
-
});
|
|
16676
|
-
}
|
|
16884
|
+
var results = param.results;
|
|
16885
|
+
param.helper;
|
|
16886
|
+
param.instantSearchInstance;
|
|
16677
16887
|
if (results === null || results === undefined) {
|
|
16678
16888
|
return {
|
|
16679
16889
|
items: [],
|
|
16680
|
-
widgetParams: widgetParams
|
|
16681
|
-
sendEvent: sendEvent
|
|
16890
|
+
widgetParams: widgetParams
|
|
16682
16891
|
};
|
|
16683
16892
|
}
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
results: results
|
|
16893
|
+
var items = (results.hits || []).map(function(hit) {
|
|
16894
|
+
return {
|
|
16895
|
+
facetName: hit.facetName,
|
|
16896
|
+
facetValue: hit.facetValue,
|
|
16897
|
+
_score: hit._score
|
|
16898
|
+
};
|
|
16691
16899
|
});
|
|
16692
|
-
|
|
16693
|
-
items
|
|
16900
|
+
if (escapeHTML) {
|
|
16901
|
+
items = items.map(function(item) {
|
|
16902
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
16903
|
+
facetValue: escape$1(item.facetValue)
|
|
16904
|
+
});
|
|
16905
|
+
});
|
|
16906
|
+
}
|
|
16907
|
+
items = transformItems(items, {
|
|
16908
|
+
results: results
|
|
16909
|
+
});
|
|
16910
|
+
return {
|
|
16911
|
+
items: items,
|
|
16912
|
+
widgetParams: widgetParams
|
|
16913
|
+
};
|
|
16914
|
+
},
|
|
16915
|
+
dispose: function dispose(param) {
|
|
16916
|
+
var recommendState = param.recommendState;
|
|
16917
|
+
unmountFn();
|
|
16918
|
+
return recommendState.removeParams(this.$$id);
|
|
16919
|
+
},
|
|
16920
|
+
getWidgetParameters: function getWidgetParameters(state) {
|
|
16921
|
+
// v4 TrendingFacetsQuery doesn't include queryParameters or
|
|
16922
|
+
// fallbackParameters, but the v5 API and the helper support them.
|
|
16923
|
+
return state.removeParams(this.$$id).addTrendingFacets({
|
|
16924
|
+
facetName: facetName,
|
|
16925
|
+
maxRecommendations: limit,
|
|
16926
|
+
threshold: threshold,
|
|
16927
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
16928
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
16929
|
+
$$id: this.$$id
|
|
16930
|
+
});
|
|
16931
|
+
}
|
|
16932
|
+
};
|
|
16933
|
+
};
|
|
16934
|
+
};
|
|
16935
|
+
|
|
16936
|
+
function useTrendingFacets(props, additionalWidgetProperties) {
|
|
16937
|
+
return useConnector(connectTrendingFacets, props, additionalWidgetProperties);
|
|
16938
|
+
}
|
|
16939
|
+
|
|
16940
|
+
var withUsage$1 = createDocumentationMessageGenerator({
|
|
16941
|
+
name: 'looking-similar',
|
|
16942
|
+
connector: true
|
|
16943
|
+
});
|
|
16944
|
+
var connectLookingSimilar = function connectLookingSimilar(renderFn) {
|
|
16945
|
+
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
16946
|
+
checkRendering(renderFn, withUsage$1());
|
|
16947
|
+
return function(widgetParams) {
|
|
16948
|
+
var _ref = widgetParams || {}, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, objectIDs = _ref.objectIDs, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, queryParameters = _ref.queryParameters, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
16949
|
+
return items;
|
|
16950
|
+
} : _ref_transformItems;
|
|
16951
|
+
if (!objectIDs || objectIDs.length === 0) {
|
|
16952
|
+
throw new Error(withUsage$1('The `objectIDs` option is required.'));
|
|
16953
|
+
}
|
|
16954
|
+
var sendEvent;
|
|
16955
|
+
return {
|
|
16956
|
+
dependsOn: 'recommend',
|
|
16957
|
+
$$type: 'ais.lookingSimilar',
|
|
16958
|
+
init: function init(initOptions) {
|
|
16959
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16960
|
+
instantSearchInstance: initOptions.instantSearchInstance
|
|
16961
|
+
}), true);
|
|
16962
|
+
},
|
|
16963
|
+
render: function render(renderOptions) {
|
|
16964
|
+
var renderState = this.getWidgetRenderState(renderOptions);
|
|
16965
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
16966
|
+
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16967
|
+
}), false);
|
|
16968
|
+
},
|
|
16969
|
+
getRenderState: function getRenderState(renderState) {
|
|
16970
|
+
return renderState;
|
|
16971
|
+
},
|
|
16972
|
+
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
16973
|
+
var results = param.results, helper = param.helper, instantSearchInstance = param.instantSearchInstance;
|
|
16974
|
+
if (!sendEvent) {
|
|
16975
|
+
sendEvent = createSendEventForHits({
|
|
16976
|
+
instantSearchInstance: instantSearchInstance,
|
|
16977
|
+
helper: helper,
|
|
16978
|
+
widgetType: this.$$type
|
|
16979
|
+
});
|
|
16980
|
+
}
|
|
16981
|
+
if (results === null || results === undefined) {
|
|
16982
|
+
return {
|
|
16983
|
+
items: [],
|
|
16984
|
+
widgetParams: widgetParams,
|
|
16985
|
+
sendEvent: sendEvent
|
|
16986
|
+
};
|
|
16987
|
+
}
|
|
16988
|
+
if (escapeHTML && results.hits.length > 0) {
|
|
16989
|
+
results.hits = escapeHits(results.hits);
|
|
16990
|
+
}
|
|
16991
|
+
var itemsWithAbsolutePosition = addAbsolutePosition(results.hits, 0, 1);
|
|
16992
|
+
var itemsWithAbsolutePositionAndQueryID = addQueryID(itemsWithAbsolutePosition, results.queryID);
|
|
16993
|
+
var transformedItems = transformItems(itemsWithAbsolutePositionAndQueryID, {
|
|
16994
|
+
results: results
|
|
16995
|
+
});
|
|
16996
|
+
return {
|
|
16997
|
+
items: transformedItems,
|
|
16694
16998
|
widgetParams: widgetParams,
|
|
16695
16999
|
sendEvent: sendEvent
|
|
16696
17000
|
};
|
|
@@ -17344,37 +17648,13 @@
|
|
|
17344
17648
|
};
|
|
17345
17649
|
}
|
|
17346
17650
|
|
|
17347
|
-
function createButtonComponent(param) {
|
|
17348
|
-
var createElement = param.createElement;
|
|
17349
|
-
return function Button(userProps) {
|
|
17350
|
-
var _userProps_variant = userProps.variant, variant = _userProps_variant === void 0 ? 'primary' : _userProps_variant, _userProps_size = userProps.size, size = _userProps_size === void 0 ? 'md' : _userProps_size, _userProps_iconOnly = userProps.iconOnly, iconOnly = _userProps_iconOnly === void 0 ? false : _userProps_iconOnly, className = userProps.className, children = userProps.children, props = _object_without_properties(userProps, [
|
|
17351
|
-
"variant",
|
|
17352
|
-
"size",
|
|
17353
|
-
"iconOnly",
|
|
17354
|
-
"className",
|
|
17355
|
-
"children"
|
|
17356
|
-
]);
|
|
17357
|
-
return /*#__PURE__*/ createElement("button", _object_spread({
|
|
17358
|
-
type: "button",
|
|
17359
|
-
className: cx('ais-Button', "ais-Button--".concat(variant), "ais-Button--".concat(size), iconOnly && 'ais-Button--icon-only', className)
|
|
17360
|
-
}, props), children);
|
|
17361
|
-
};
|
|
17362
|
-
}
|
|
17363
|
-
|
|
17364
17651
|
function createAutocompleteDetachedFormContainerComponent(param) {
|
|
17365
17652
|
var createElement = param.createElement;
|
|
17366
|
-
var Button = createButtonComponent({
|
|
17367
|
-
createElement: createElement
|
|
17368
|
-
});
|
|
17369
17653
|
return function AutocompleteDetachedFormContainer(userProps) {
|
|
17370
|
-
var children = userProps.children, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames
|
|
17654
|
+
var children = userProps.children, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
17371
17655
|
return /*#__PURE__*/ createElement("div", {
|
|
17372
17656
|
className: cx('ais-AutocompleteDetachedFormContainer', classNames.detachedFormContainer)
|
|
17373
|
-
}, children
|
|
17374
|
-
variant: "ghost",
|
|
17375
|
-
className: cx('ais-AutocompleteDetachedCancelButton', classNames.detachedCancelButton),
|
|
17376
|
-
onClick: onCancel
|
|
17377
|
-
}, translations.detachedCancelButtonText));
|
|
17657
|
+
}, children);
|
|
17378
17658
|
};
|
|
17379
17659
|
}
|
|
17380
17660
|
|
|
@@ -17475,6 +17755,28 @@
|
|
|
17475
17755
|
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"
|
|
17476
17756
|
}));
|
|
17477
17757
|
}
|
|
17758
|
+
function AiModeIcon(param) {
|
|
17759
|
+
var createElement = param.createElement;
|
|
17760
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
17761
|
+
className: "ais-AiModeButton-icon",
|
|
17762
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17763
|
+
fill: "none",
|
|
17764
|
+
viewBox: "0 0 20 20",
|
|
17765
|
+
width: "16",
|
|
17766
|
+
height: "16",
|
|
17767
|
+
"aria-hidden": "true"
|
|
17768
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
17769
|
+
fill: "currentColor",
|
|
17770
|
+
fillRule: "evenodd",
|
|
17771
|
+
d: "M10 1.875c.27 0 .51.173.594.43l1.593 4.844a1.043 1.043 0 0 0 .664.664l4.844 1.593a.625.625 0 0 1 0 1.188l-4.844 1.593a1.043 1.043 0 0 0-.664.664l-1.593 4.844a.625.625 0 0 1-1.188 0l-1.593-4.844a1.042 1.042 0 0 0-.664-.664l-4.844-1.593a.625.625 0 0 1 0-1.188l4.844-1.593a1.042 1.042 0 0 0 .664-.664l1.593-4.844a.625.625 0 0 1 .594-.43ZM9 7.539A2.292 2.292 0 0 1 7.54 9L4.5 10l3.04 1A2.292 2.292 0 0 1 9 12.46l1 3.04 1-3.04A2.293 2.293 0 0 1 12.46 11l3.04-1-3.04-1A2.292 2.292 0 0 1 11 7.54L10 4.5 9 7.54ZM4.167 1.875c.345 0 .625.28.625.625v3.333a.625.625 0 0 1-1.25 0V2.5c0-.345.28-.625.625-.625ZM15.833 13.542c.345 0 .625.28.625.625V17.5a.625.625 0 1 1-1.25 0v-3.333c0-.345.28-.625.625-.625Z",
|
|
17772
|
+
clipRule: "evenodd"
|
|
17773
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
17774
|
+
fill: "currentColor",
|
|
17775
|
+
fillRule: "evenodd",
|
|
17776
|
+
d: "M1.875 4.167c0-.346.28-.625.625-.625h3.333a.625.625 0 1 1 0 1.25H2.5a.625.625 0 0 1-.625-.625ZM13.542 15.833c0-.345.28-.625.625-.625H17.5a.625.625 0 0 1 0 1.25h-3.333a.625.625 0 0 1-.625-.625Z",
|
|
17777
|
+
clipRule: "evenodd"
|
|
17778
|
+
}));
|
|
17779
|
+
}
|
|
17478
17780
|
function SearchIcon(param) {
|
|
17479
17781
|
var createElement = param.createElement;
|
|
17480
17782
|
return /*#__PURE__*/ createElement("svg", {
|
|
@@ -17485,6 +17787,16 @@
|
|
|
17485
17787
|
d: "M16.041 15.856c-0.034 0.026-0.067 0.055-0.099 0.087s-0.060 0.064-0.087 0.099c-1.258 1.213-2.969 1.958-4.855 1.958-1.933 0-3.682-0.782-4.95-2.050s-2.050-3.017-2.050-4.95 0.782-3.682 2.050-4.95 3.017-2.050 4.95-2.050 3.682 0.782 4.95 2.050 2.050 3.017 2.050 4.95c0 1.886-0.745 3.597-1.959 4.856zM21.707 20.293l-3.675-3.675c1.231-1.54 1.968-3.493 1.968-5.618 0-2.485-1.008-4.736-2.636-6.364s-3.879-2.636-6.364-2.636-4.736 1.008-6.364 2.636-2.636 3.879-2.636 6.364 1.008 4.736 2.636 6.364 3.879 2.636 6.364 2.636c2.125 0 4.078-0.737 5.618-1.968l3.675 3.675c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"
|
|
17486
17788
|
}));
|
|
17487
17789
|
}
|
|
17790
|
+
function BackIcon(param) {
|
|
17791
|
+
var createElement = param.createElement;
|
|
17792
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
17793
|
+
className: "ais-AutocompleteBackIcon",
|
|
17794
|
+
viewBox: "0 0 24 24",
|
|
17795
|
+
fill: "currentColor"
|
|
17796
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
17797
|
+
d: "M9.828 11H21a1 1 0 110 2H9.828l3.586 3.586a1 1 0 01-1.414 1.414l-5.3-5.3a1 1 0 010-1.414l5.3-5.3a1 1 0 111.414 1.414L9.828 11z"
|
|
17798
|
+
}));
|
|
17799
|
+
}
|
|
17488
17800
|
|
|
17489
17801
|
function createAutocompleteDetachedSearchButtonComponent(param) {
|
|
17490
17802
|
var createElement = param.createElement;
|
|
@@ -17528,7 +17840,7 @@
|
|
|
17528
17840
|
function createAutocompleteIndexComponent(param) {
|
|
17529
17841
|
var createElement = param.createElement;
|
|
17530
17842
|
return function AutocompleteIndex(userProps) {
|
|
17531
|
-
var items = userProps.items, HeaderComponent = userProps.HeaderComponent, ItemComponent = userProps.ItemComponent, NoResultsComponent = userProps.NoResultsComponent, getItemProps = userProps.getItemProps, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
17843
|
+
var items = userProps.items, HeaderComponent = userProps.HeaderComponent, ItemComponent = userProps.ItemComponent, NoResultsComponent = userProps.NoResultsComponent, getItemProps = userProps.getItemProps, sendEvent = userProps.sendEvent, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
17532
17844
|
if (items.length === 0 && !NoResultsComponent) {
|
|
17533
17845
|
return null;
|
|
17534
17846
|
}
|
|
@@ -17551,7 +17863,13 @@
|
|
|
17551
17863
|
return /*#__PURE__*/ createElement("li", _object_spread_props(_object_spread({
|
|
17552
17864
|
key: "".concat(itemProps.id, ":").concat(item.objectID)
|
|
17553
17865
|
}, itemProps), {
|
|
17554
|
-
className: cx('ais-AutocompleteIndexItem', classNames.item, className)
|
|
17866
|
+
className: cx('ais-AutocompleteIndexItem', classNames.item, className),
|
|
17867
|
+
onClick: function onClick() {
|
|
17868
|
+
sendEvent === null || sendEvent === void 0 ? void 0 : sendEvent('click:internal', item, 'Hit Clicked');
|
|
17869
|
+
},
|
|
17870
|
+
onAuxClick: function onAuxClick() {
|
|
17871
|
+
sendEvent === null || sendEvent === void 0 ? void 0 : sendEvent('click:internal', item, 'Hit Clicked');
|
|
17872
|
+
}
|
|
17555
17873
|
}), /*#__PURE__*/ createElement(ItemComponent, {
|
|
17556
17874
|
item: item,
|
|
17557
17875
|
onSelect: onSelect,
|
|
@@ -17942,7 +18260,9 @@
|
|
|
17942
18260
|
function createAutocompleteSearchComponent(param) {
|
|
17943
18261
|
var createElement = param.createElement;
|
|
17944
18262
|
return function AutocompleteSearch(userProps) {
|
|
17945
|
-
var inputProps = userProps.inputProps, onClear = userProps.onClear, query = userProps.query, isSearchStalled = userProps.isSearchStalled;
|
|
18263
|
+
var inputProps = userProps.inputProps, onClear = userProps.onClear, query = userProps.query, isSearchStalled = userProps.isSearchStalled, onCancel = userProps.onCancel, isDetached = userProps.isDetached, submitTitle = userProps.submitTitle, onAiModeClick = userProps.onAiModeClick;
|
|
18264
|
+
var isBackButton = Boolean(isDetached && onCancel);
|
|
18265
|
+
var resolvedCancelTitle = submitTitle !== null && submitTitle !== void 0 ? submitTitle : 'Close';
|
|
17946
18266
|
var inputRef = inputProps.ref;
|
|
17947
18267
|
return /*#__PURE__*/ createElement("form", {
|
|
17948
18268
|
className: "ais-AutocompleteForm",
|
|
@@ -17950,7 +18270,7 @@
|
|
|
17950
18270
|
noValidate: true,
|
|
17951
18271
|
role: "search",
|
|
17952
18272
|
onSubmit: function onSubmit(e) {
|
|
17953
|
-
|
|
18273
|
+
e.preventDefault();
|
|
17954
18274
|
},
|
|
17955
18275
|
onReset: function onReset() {
|
|
17956
18276
|
var _inputRef_current;
|
|
@@ -17958,11 +18278,20 @@
|
|
|
17958
18278
|
}
|
|
17959
18279
|
}, /*#__PURE__*/ createElement("div", {
|
|
17960
18280
|
className: "ais-AutocompleteInputWrapperPrefix"
|
|
17961
|
-
}, /*#__PURE__*/ createElement("
|
|
18281
|
+
}, isBackButton && /*#__PURE__*/ createElement("button", {
|
|
18282
|
+
className: "ais-AutocompleteBackButton",
|
|
18283
|
+
type: "button",
|
|
18284
|
+
title: resolvedCancelTitle,
|
|
18285
|
+
onClick: onCancel,
|
|
18286
|
+
hidden: isSearchStalled
|
|
18287
|
+
}, /*#__PURE__*/ createElement(BackIcon, {
|
|
18288
|
+
createElement: createElement
|
|
18289
|
+
})), /*#__PURE__*/ createElement("label", {
|
|
17962
18290
|
className: "ais-AutocompleteLabel",
|
|
17963
18291
|
"aria-label": "Submit",
|
|
17964
18292
|
htmlFor: inputProps.id,
|
|
17965
|
-
id: "".concat(inputProps.id, "-label")
|
|
18293
|
+
id: "".concat(inputProps.id, "-label"),
|
|
18294
|
+
hidden: isBackButton || undefined
|
|
17966
18295
|
}, /*#__PURE__*/ createElement("button", {
|
|
17967
18296
|
className: "ais-AutocompleteSubmitButton",
|
|
17968
18297
|
type: "submit",
|
|
@@ -18000,7 +18329,19 @@
|
|
|
18000
18329
|
onClick: onClear
|
|
18001
18330
|
}, /*#__PURE__*/ createElement(ClearIcon, {
|
|
18002
18331
|
createElement: createElement
|
|
18003
|
-
}))
|
|
18332
|
+
})), onAiModeClick && /*#__PURE__*/ createElement("button", {
|
|
18333
|
+
className: "ais-AiModeButton",
|
|
18334
|
+
type: "button",
|
|
18335
|
+
title: "AI Mode",
|
|
18336
|
+
onClick: function onClick(e) {
|
|
18337
|
+
e.preventDefault();
|
|
18338
|
+
onAiModeClick();
|
|
18339
|
+
}
|
|
18340
|
+
}, /*#__PURE__*/ createElement(AiModeIcon, {
|
|
18341
|
+
createElement: createElement
|
|
18342
|
+
}), /*#__PURE__*/ createElement("span", {
|
|
18343
|
+
className: "ais-AiModeButton-label"
|
|
18344
|
+
}, "AI Mode"))));
|
|
18004
18345
|
};
|
|
18005
18346
|
}
|
|
18006
18347
|
|
|
@@ -18112,7 +18453,7 @@
|
|
|
18112
18453
|
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
18113
18454
|
}
|
|
18114
18455
|
var actualDescendant = (_override_activeDescendant = override.activeDescendant) !== null && _override_activeDescendant !== void 0 ? _override_activeDescendant : activeDescendant;
|
|
18115
|
-
if (!actualDescendant && override.query) {
|
|
18456
|
+
if (!actualDescendant && override.query !== undefined) {
|
|
18116
18457
|
onRefine(override.query);
|
|
18117
18458
|
}
|
|
18118
18459
|
if (actualDescendant && items.has(actualDescendant)) {
|
|
@@ -18452,6 +18793,23 @@
|
|
|
18452
18793
|
};
|
|
18453
18794
|
}
|
|
18454
18795
|
|
|
18796
|
+
function createButtonComponent(param) {
|
|
18797
|
+
var createElement = param.createElement;
|
|
18798
|
+
return function Button(userProps) {
|
|
18799
|
+
var _userProps_variant = userProps.variant, variant = _userProps_variant === void 0 ? 'primary' : _userProps_variant, _userProps_size = userProps.size, size = _userProps_size === void 0 ? 'md' : _userProps_size, _userProps_iconOnly = userProps.iconOnly, iconOnly = _userProps_iconOnly === void 0 ? false : _userProps_iconOnly, className = userProps.className, children = userProps.children, props = _object_without_properties(userProps, [
|
|
18800
|
+
"variant",
|
|
18801
|
+
"size",
|
|
18802
|
+
"iconOnly",
|
|
18803
|
+
"className",
|
|
18804
|
+
"children"
|
|
18805
|
+
]);
|
|
18806
|
+
return /*#__PURE__*/ createElement("button", _object_spread({
|
|
18807
|
+
type: "button",
|
|
18808
|
+
className: cx('ais-Button', "ais-Button--".concat(variant), "ais-Button--".concat(size), iconOnly && 'ais-Button--icon-only', className)
|
|
18809
|
+
}, props), children);
|
|
18810
|
+
};
|
|
18811
|
+
}
|
|
18812
|
+
|
|
18455
18813
|
function createDefaultItemComponent(param) {
|
|
18456
18814
|
var createElement = param.createElement, Fragment = param.Fragment;
|
|
18457
18815
|
return function DefaultItem(userProps) {
|
|
@@ -18701,6 +19059,10 @@
|
|
|
18701
19059
|
};
|
|
18702
19060
|
}
|
|
18703
19061
|
|
|
19062
|
+
function startsWith(str, prefix) {
|
|
19063
|
+
return str.slice(0, prefix.length) === prefix;
|
|
19064
|
+
}
|
|
19065
|
+
|
|
18704
19066
|
var getTextContent = function getTextContent(message) {
|
|
18705
19067
|
return message.parts.map(function(part) {
|
|
18706
19068
|
return 'text' in part ? part.text : '';
|
|
@@ -18712,13 +19074,24 @@
|
|
|
18712
19074
|
var isPartText = function isPartText(part) {
|
|
18713
19075
|
return part.type === 'text';
|
|
18714
19076
|
};
|
|
19077
|
+
var isPartTool = function isPartTool(part) {
|
|
19078
|
+
return startsWith(part.type, 'tool-');
|
|
19079
|
+
};
|
|
19080
|
+
var findTool = function findTool(partType, tools) {
|
|
19081
|
+
var toolName = partType.replace('tool-', '');
|
|
19082
|
+
var tool = tools[toolName];
|
|
19083
|
+
if (!tool) {
|
|
19084
|
+
var _Object_entries_find;
|
|
19085
|
+
tool = (_Object_entries_find = Object.entries(tools).find(function(param) {
|
|
19086
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
19087
|
+
return startsWith(toolName, "".concat(key, "_"));
|
|
19088
|
+
})) === null || _Object_entries_find === void 0 ? void 0 : _Object_entries_find[1];
|
|
19089
|
+
}
|
|
19090
|
+
return tool;
|
|
19091
|
+
};
|
|
18715
19092
|
|
|
18716
19093
|
function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);}return e},n.apply(this,arguments)}const o=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,n)=>(e[n.toLowerCase()]=n,e),{class:"className",for:"htmlFor"}),a={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script","pre"],i=["src","href","data","formAction","srcDoc","action"],u=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,l=/\n{2,}$/,s=/^(\s*>[\s\S]*?)(?=\n\n|$)/,f=/^ *> ?/gm,_=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,d=/^ {2,}\n/,p=/^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/,y=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,h=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,g=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,m=/^(?:\n *)*\n/,k=/\r\n?/g,x=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,q=/^\[\^([^\]]+)]/,v=/\f/g,b=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,$=/^\s*?\[(x|\s)\]/,S=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,z=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,E=/^([^\n]+)\n *(=|-)\2{2,} *\n/,A=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,R=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,B=/^<!--[\s\S]*?(?:-->)/,L=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,O=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,j=/^\{.*\}$/,C=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,I=/^<([^ >]+[:@\/][^ >]+)>/,T=/-([a-z])?/gi,M=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,w=/^[^\n]+(?: \n|\n{2,})/,D=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,F=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,P=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Z=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,N=/\t/g,G=/(^ *\||\| *$)/g,U=/^ *:-+: *$/,V=/^ *:-+ *$/,H=/^ *-+: *$/,Q=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,W="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",J=RegExp(`^([*_])\\1${Q(1)}${W}\\1\\1(?!\\1)`),K=RegExp(`^([*_])${Q(0)}${W}\\1(?!\\1)`),X=RegExp(`^(==)${Q(0)}${W}\\1`),Y=RegExp(`^(~~)${Q(0)}${W}\\1`),ee=/^(:[a-zA-Z0-9-_]+:)/,ne=/^\\([^0-9A-Za-z\s])/,re=/\\([^0-9A-Za-z\s])/g,te=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,oe=/^\n+/,ae=/^([ \t]*)/,ce=/(?:^|\n)( *)$/,ie="(?:\\d+\\.)",ue="(?:[*+-])";function le(e){return "( *)("+(1===e?ie:ue)+") +"}const se=le(1),fe=le(2);function _e(e){return RegExp("^"+(1===e?se:fe))}const de=_e(1),pe=_e(2);function ye(e){return RegExp("^"+(1===e?se:fe)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ie:ue)+" )[^\\n]*)*(\\n|$)","gm")}const he=ye(1),ge=ye(2);function me(e){const n=1===e?ie:ue;return RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}const ke=me(1),xe=me(2);function qe(e,n){const r=1===n,t=r?ke:xe,o=r?he:ge,a=r?de:pe;return {t:e=>a.test(e),o:je(function(e,n){const r=ce.exec(n.prevCapture);return r&&(n.list||!n.inline&&!n.simple)?t.exec(e=r[1]+e):null}),i:1,u(e,n,t){const c=r?+e[2]:void 0,i=e[0].replace(l,"\n").match(o);let u=!1;return {items:i.map(function(e,r){const o=a.exec(e)[0].length,c=RegExp("^ {1,"+o+"}","gm"),l=e.replace(c,"").replace(a,""),s=r===i.length-1,f=-1!==l.indexOf("\n\n")||s&&u;u=f;const _=t.inline,d=t.list;let p;t.list=!0,f?(t.inline=!1,p=Se(l)+"\n\n"):(t.inline=!0,p=Se(l));const y=n(p,t);return t.inline=_,t.list=d,y}),ordered:r,start:c}},l:(n,r,t)=>e(n.ordered?"ol":"ul",{key:t.key,start:"20"===n.type?n.start:void 0},n.items.map(function(n,o){return e("li",{key:o},r(n,t))}))}}const ve=RegExp("^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),be=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function $e(e){return "string"==typeof e}function Se(e){let n=e.length;for(;n>0&&e[n-1]<=" ";)n--;return e.slice(0,n)}function ze(e,n){return e.startsWith(n)}function Ee(e,n,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(ze(e,r[n]))return !0;return !1}return r(e,n)}function Ae(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function Re(e){return H.test(e)?"right":U.test(e)?"center":V.test(e)?"left":null}function Be(e,n,r,t){const o=r.inTable;r.inTable=!0;let a=[[]],c="";function i(){if(!c)return;const e=a[a.length-1];e.push.apply(e,n(c,r)),c="";}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((e,n,r)=>{"|"===e.trim()&&(i(),t)?0!==n&&n!==r.length-1&&a.push([]):c+=e;}),i(),r.inTable=o,a}function Le(e,n,r){r.inline=!0;const t=e[2]?e[2].replace(G,"").split("|").map(Re):[],o=e[3]?function(e,n,r){return e.trim().split("\n").map(function(e){return Be(e,n,r,!0)})}(e[3],n,r):[],a=Be(e[1],n,r,!!o.length);return r.inline=!1,o.length?{align:t,cells:o,header:a,type:"25"}:{children:a,type:"21"}}function Oe(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function je(e){return e.inline=1,e}function Ce(e){return je(function(n,r){return r.inline?e.exec(n):null})}function Ie(e){return je(function(n,r){return r.inline||r.simple?e.exec(n):null})}function Te(e){return function(n,r){return r.inline||r.simple?null:e.exec(n)}}function Me(e){return je(function(n){return e.exec(n)})}const we=/(javascript|vbscript|data(?!:image)):/i;function De(e){try{const n=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(we.test(n))return null}catch(e){return null}return e}function Fe(e){return e?e.replace(re,"$1"):e}function Pe(e,n,r){const t=r.inline||!1,o=r.simple||!1;r.inline=!0,r.simple=!0;const a=e(n,r);return r.inline=t,r.simple=o,a}function Ze(e,n,r){const t=r.inline||!1,o=r.simple||!1;r.inline=!1,r.simple=!0;const a=e(n,r);return r.inline=t,r.simple=o,a}function Ne(e,n,r){const t=r.inline||!1;r.inline=!1;const o=e(n,r);return r.inline=t,o}const Ge=(e,n,r)=>({children:Pe(n,e[2],r)});function Ue(){return {}}function Ve(){return null}function He(...e){return e.filter(Boolean).join(" ")}function Qe(e,n,r){let t=e;const o=n.split(".");for(;o.length&&(t=t[o[0]],void 0!==t);)o.shift();return t||r}function We(r="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?n({},a,t.namedCodesToUnicode):a;const l=t.slugify||Ae,G=t.sanitizer||De,U=t.createElement||React__namespace.createElement,V=[s,y,h,t.enforceAtxHeadings?z:S,E,M,ke,xe],H=[...V,w,A,B,O];function Q(e,n){for(let r=0;r<e.length;r++)if(e[r].test(n))return !0;return !1}function W(e,r,...o){const a=Qe(t.overrides,e+".props",{});return U(function(e,n){const r=Qe(n,e);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:Qe(n,e+".component",e):e}(e,t.overrides),n({},r,a,{className:He(null==r?void 0:r.className,a.className)||void 0}),...o)}function re(e){e=e.replace(b,"");let n=!1;t.forceInline?n=!0:t.forceBlock||(n=!1===Z.test(e));const r=fe(se(n?e:Se(e).replace(oe,"")+"\n\n",{inline:n}));for(;$e(r[r.length-1])&&!r[r.length-1].trim();)r.pop();if(null===t.wrapper)return r;const o=t.wrapper||(n?"span":"div");let a;if(r.length>1||t.forceWrapper)a=r;else {if(1===r.length)return a=r[0],"string"==typeof a?W("span",{key:"outer"},a):a;a=null;}return U(o,{key:"outer"},a)}function ce(e,n){if(!n||!n.trim())return null;const r=n.match(u);return r?r.reduce(function(n,r){const t=r.indexOf("=");if(-1!==t){const a=function(e){return -1!==e.indexOf("-")&&null===e.match(L)&&(e=e.replace(T,function(e,n){return n.toUpperCase()})),e}(r.slice(0,t)).trim(),c=function(e){const n=e[0];return ('"'===n||"'"===n)&&e.length>=2&&e[e.length-1]===n?e.slice(1,-1):e}(r.slice(t+1).trim()),u=o[a]||a;if("ref"===u)return n;const l=n[u]=function(e,n,r,t){return "style"===n?function(e){const n=[];let r="",t=!1,o=!1,a="";if(!e)return n;for(let c=0;c<e.length;c++){const i=e[c];if('"'!==i&&"'"!==i||t||(o?i===a&&(o=!1,a=""):(o=!0,a=i)),"("===i&&r.endsWith("url")?t=!0:")"===i&&t&&(t=!1),";"!==i||o||t)r+=i;else {const e=r.trim();if(e){const r=e.indexOf(":");if(r>0){const t=e.slice(0,r).trim(),o=e.slice(r+1).trim();n.push([t,o]);}}r="";}}const c=r.trim();if(c){const e=c.indexOf(":");if(e>0){const r=c.slice(0,e).trim(),t=c.slice(e+1).trim();n.push([r,t]);}}return n}(r).reduce(function(n,[r,o]){return n[r.replace(/(-[a-z])/g,e=>e[1].toUpperCase())]=t(o,e,r),n},{}):-1!==i.indexOf(n)?t(Fe(r),e,n):(r.match(j)&&(r=Fe(r.slice(1,r.length-1))),"true"===r||"false"!==r&&r)}(e,a,c,G);"string"==typeof l&&(A.test(l)||O.test(l))&&(n[u]=re(l.trim()));}else "style"!==r&&(n[o[r]||r]=!0);return n},{}):null}const ie=[],ue={},le={0:{t:[">"],o:Te(s),i:1,u(e,n,r){const[,t,o]=e[0].replace(f,"").match(_);return {alert:t,children:n(o,r)}},l(e,n,r){const t={key:r.key};return e.alert&&(t.className="markdown-alert-"+l(e.alert.toLowerCase(),Ae),e.children.unshift({attrs:{},children:[{type:"27",text:e.alert}],noInnerParse:!0,type:"11",tag:"header"})),W("blockquote",t,n(e.children,r))}},1:{t:[" "],o:Me(d),i:1,u:Ue,l:(e,n,r)=>W("br",{key:r.key})},2:{t:["--","__","**","- ","* ","_ "],o:Te(p),i:1,u:Ue,l:(e,n,r)=>W("hr",{key:r.key})},3:{t:[" "],o:Te(h),i:0,u:e=>({lang:void 0,text:Fe(Se(e[0].replace(/^ {4}/gm,"")))}),l:(e,r,t)=>W("pre",{key:t.key},W("code",n({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))},4:{t:["```","~~~"],o:Te(y),i:0,u:e=>({attrs:ce("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"})},5:{t:["`"],o:Ie(g),i:3,u:e=>({text:Fe(e[2])}),l:(e,n,r)=>W("code",{key:r.key},e.text)},6:{t:["[^"],o:Te(x),i:0,u:e=>(ie.push({footnote:e[2],identifier:e[1]}),{}),l:Ve},7:{t:["[^"],o:Ce(q),i:1,u:e=>({target:"#"+l(e[1],Ae),text:e[1]}),l:(e,n,r)=>W("a",{key:r.key,href:G(e.target,"a","href")},W("sup",{key:r.key},e.text))},8:{t:["[ ]","[x]"],o:Ce($),i:1,u:e=>({completed:"x"===e[1].toLowerCase()}),l:(e,n,r)=>W("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:Te(t.enforceAtxHeadings?z:S),i:1,u:(e,n,r)=>({children:Pe(n,e[2],r),id:l(e[2],Ae),level:e[1].length}),l:(e,n,r)=>W("h"+e.level,{id:e.id,key:r.key},n(e.children,r))},10:{t:e=>{const n=e.indexOf("\n");return n>0&&n<e.length-1&&("="===e[n+1]||"-"===e[n+1])},o:Te(E),i:0,u:(e,n,r)=>({children:Pe(n,e[1],r),level:"="===e[2]?1:2,type:"9"})},11:{t:["<"],o:Me(A),i:1,u(e,n,r){const[,t]=e[3].match(ae),o=RegExp("^"+t,"gm"),a=e[3].replace(o,""),i=Q(H,a)?Ne:Pe,u=e[1].toLowerCase(),l=-1!==c.indexOf(u),s=(l?u:e[1]).trim(),f={attrs:ce(s,e[2]),noInnerParse:l,tag:s};if(r.inAnchor=r.inAnchor||"a"===u,l)f.text=e[3];else {const e=r.inHTML;r.inHTML=!0,f.children=i(n,a,r),r.inHTML=e;}return r.inAnchor=!1,f},l:(e,r,t)=>W(e.tag,n({key:t.key},e.attrs),e.text||(e.children?r(e.children,t):""))},13:{t:["<"],o:Me(O),i:1,u(e){const n=e[1].trim();return {attrs:ce(n,e[2]||""),tag:n}},l:(e,r,t)=>W(e.tag,n({},e.attrs,{key:t.key}))},12:{t:["\x3c!--"],o:Me(B),i:1,u:()=>({}),l:Ve},14:{t:["!["],o:Ie(be),i:1,u:e=>({alt:Fe(e[1]),target:Fe(e[2]),title:Fe(e[3])}),l:(e,n,r)=>W("img",{key:r.key,alt:e.alt||void 0,title:e.title||void 0,src:G(e.target,"img","src")})},15:{t:["["],o:Ce(ve),i:3,u:(e,n,r)=>({children:Ze(n,e[1],r),target:Fe(e[2]),title:Fe(e[3])}),l:(e,n,r)=>W("a",{key:r.key,href:G(e.target,"a","href"),title:e.title},n(e.children,r))},16:{t:["<"],o:Ce(I),i:0,u(e){let n=e[1],r=!1;return -1!==n.indexOf("@")&&-1===n.indexOf("//")&&(r=!0,n=n.replace("mailto:","")),{children:[{text:n,type:"27"}],target:r?"mailto:"+n:n,type:"15"}}},17:{t:(e,n)=>!n.inAnchor&&!t.disableAutoLink&&(ze(e,"http://")||ze(e,"https://")),o:Ce(C),i:0,u:e=>({children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"})},20:qe(W,1),33:qe(W,2),19:{t:["\n"],o:Te(m),i:3,u:Ue,l:()=>"\n"},21:{o:je(function(e,n){if(n.inline||n.simple||n.inHTML&&-1===e.indexOf("\n\n")&&-1===n.prevCapture.indexOf("\n\n"))return null;let r="",t=0;for(;;){const n=e.indexOf("\n",t),o=e.slice(t,-1===n?void 0:n+1);if(Q(V,o))break;if(r+=o,-1===n||!o.trim())break;t=n+1;}const o=Se(r);return ""===o?null:[r,,o]}),i:3,u:Ge,l:(e,n,r)=>W("p",{key:r.key},n(e.children,r))},22:{t:["["],o:Ce(D),i:0,u:e=>(ue[e[1]]={target:e[2],title:e[4]},{}),l:Ve},23:{t:["!["],o:Ie(F),i:0,u:e=>({alt:e[1]?Fe(e[1]):void 0,ref:e[2]}),l:(e,n,r)=>ue[e.ref]?W("img",{key:r.key,alt:e.alt,src:G(ue[e.ref].target,"img","src"),title:ue[e.ref].title}):null},24:{t:e=>"["===e[0]&&-1===e.indexOf("]("),o:Ce(P),i:0,u:(e,n,r)=>({children:n(e[1],r),fallbackChildren:e[0],ref:e[2]}),l:(e,n,r)=>ue[e.ref]?W("a",{key:r.key,href:G(ue[e.ref].target,"a","href"),title:ue[e.ref].title},n(e.children,r)):W("span",{key:r.key},e.fallbackChildren)},25:{t:["|"],o:Te(M),i:1,u:Le,l(e,n,r){const t=e;return W("table",{key:r.key},W("thead",null,W("tr",null,t.header.map(function(e,o){return W("th",{key:o,style:Oe(t,o)},n(e,r))}))),W("tbody",null,t.cells.map(function(e,o){return W("tr",{key:o},e.map(function(e,o){return W("td",{key:o,style:Oe(t,o)},n(e,r))}))})))}},27:{o:je(function(e,n){let r;return ze(e,":")&&(r=ee.exec(e)),r||te.exec(e)}),i:4,u(e){const n=e[0];return {text:-1===n.indexOf("&")?n:n.replace(R,(e,n)=>t.namedCodesToUnicode[n]||e)}},l:e=>e.text},28:{t:["**","__"],o:Ie(J),i:2,u:(e,n,r)=>({children:n(e[2],r)}),l:(e,n,r)=>W("strong",{key:r.key},n(e.children,r))},29:{t:e=>{const n=e[0];return ("*"===n||"_"===n)&&e[1]!==n},o:Ie(K),i:3,u:(e,n,r)=>({children:n(e[2],r)}),l:(e,n,r)=>W("em",{key:r.key},n(e.children,r))},30:{t:["\\"],o:Ie(ne),i:1,u:e=>({text:e[1],type:"27"})},31:{t:["=="],o:Ie(X),i:3,u:Ge,l:(e,n,r)=>W("mark",{key:r.key},n(e.children,r))},32:{t:["~~"],o:Ie(Y),i:3,u:Ge,l:(e,n,r)=>W("del",{key:r.key},n(e.children,r))}};!0===t.disableParsingRawHTML&&(delete le[11],delete le[13]);const se=function(e){var n=Object.keys(e);function r(t,o){var a=[];if(o.prevCapture=o.prevCapture||"",t.trim())for(;t;)for(var c=0;c<n.length;){var i=n[c],u=e[i];if(!u.t||Ee(t,o,u.t)){var l=u.o(t,o);if(l&&l[0]){t=t.substring(l[0].length);var s=u.u(l,r,o);o.prevCapture+=l[0],s.type||(s.type=i),a.push(s);break}c++;}else c++;}return o.prevCapture="",a}return n.sort(function(n,r){return e[n].i-e[r].i||(n<r?-1:1)}),function(e,n){return r(function(e){return e.replace(k,"\n").replace(v,"").replace(N," ")}(e),n)}}(le),fe=function(e,n){return function r(t,o={}){if(Array.isArray(t)){const e=o.key,n=[];let a=!1;for(let e=0;e<t.length;e++){o.key=e;const c=r(t[e],o),i=$e(c);i&&a?n[n.length-1]+=c:null!==c&&n.push(c),a=i;}return o.key=e,n}return function(r,t,o){const a=e[r.type].l;return n?n(()=>a(r,t,o),r,t,o):a(r,t,o)}(t,r,o)}}(le,t.renderRule),_e=re(r);return ie.length?W("div",null,_e,W("footer",{key:"footer"},ie.map(function(e){return W("div",{id:l(e.identifier,Ae),key:e.identifier},e.identifier,fe(se(e.footnote,{inline:!0})))}))):_e}
|
|
18717
19094
|
|
|
18718
|
-
function startsWith(str, prefix) {
|
|
18719
|
-
return str.slice(0, prefix.length) === prefix;
|
|
18720
|
-
}
|
|
18721
|
-
|
|
18722
19095
|
// Keep in sync with packages/instantsearch.js/src/lib/chat/index.ts
|
|
18723
19096
|
var SearchIndexToolType = 'algolia_search_index';
|
|
18724
19097
|
function createChatMessageComponent(param) {
|
|
@@ -18765,6 +19138,9 @@
|
|
|
18765
19138
|
return null;
|
|
18766
19139
|
}
|
|
18767
19140
|
if (part.type === 'text') {
|
|
19141
|
+
if (part.text.startsWith('<context>') && part.text.endsWith('</context>')) {
|
|
19142
|
+
return null;
|
|
19143
|
+
}
|
|
18768
19144
|
var markdown = We(part.text, {
|
|
18769
19145
|
createElement: createElement,
|
|
18770
19146
|
disableParsingRawHTML: true
|
|
@@ -18791,6 +19167,9 @@
|
|
|
18791
19167
|
toolCallId: toolMessage.toolCallId
|
|
18792
19168
|
});
|
|
18793
19169
|
};
|
|
19170
|
+
if (toolMessage.state === 'input-streaming' && !tool.streamInput) {
|
|
19171
|
+
return null;
|
|
19172
|
+
}
|
|
18794
19173
|
if (!ToolLayoutComponent) {
|
|
18795
19174
|
return null;
|
|
18796
19175
|
}
|
|
@@ -18803,6 +19182,7 @@
|
|
|
18803
19182
|
setIndexUiState: setIndexUiState,
|
|
18804
19183
|
addToolResult: boundAddToolResult,
|
|
18805
19184
|
applyFilters: tool.applyFilters,
|
|
19185
|
+
sendEvent: tool.sendEvent || function() {},
|
|
18806
19186
|
onClose: onClose
|
|
18807
19187
|
}));
|
|
18808
19188
|
}
|
|
@@ -18899,7 +19279,7 @@
|
|
|
18899
19279
|
"translations"
|
|
18900
19280
|
]);
|
|
18901
19281
|
var translations = _object_spread({
|
|
18902
|
-
loaderText: '
|
|
19282
|
+
loaderText: ''
|
|
18903
19283
|
}, userTranslations);
|
|
18904
19284
|
return /*#__PURE__*/ createElement("article", _object_spread({
|
|
18905
19285
|
className: "ais-ChatMessageLoader ais-ChatMessage ais-ChatMessage--left ais-ChatMessage--subtle"
|
|
@@ -19052,7 +19432,7 @@
|
|
|
19052
19432
|
});
|
|
19053
19433
|
return function ChatMessages(userProps) {
|
|
19054
19434
|
var _lastMessage_parts;
|
|
19055
|
-
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, _userProps_messageClassNames = userProps.messageClassNames, messageClassNames = _userProps_messageClassNames === void 0 ? {} : _userProps_messageClassNames, messageTranslations = userProps.messageTranslations, _userProps_messages = userProps.messages, messages = _userProps_messages === void 0 ? [] : _userProps_messages, MessageComponent = userProps.messageComponent, LoaderComponent = userProps.loaderComponent, ErrorComponent = userProps.errorComponent, ActionsComponent = userProps.actionsComponent, tools = userProps.tools, indexUiState = userProps.indexUiState, setIndexUiState = userProps.setIndexUiState, _userProps_status = userProps.status, status = _userProps_status === void 0 ? 'ready' : _userProps_status, _userProps_hideScrollToBottom = userProps.hideScrollToBottom, hideScrollToBottom = _userProps_hideScrollToBottom === void 0 ? false : _userProps_hideScrollToBottom, onReload = userProps.onReload, onClose = userProps.onClose, userTranslations = userProps.translations, userMessageProps = userProps.userMessageProps, assistantMessageProps = userProps.assistantMessageProps, _userProps_isClearing = userProps.isClearing, isClearing = _userProps_isClearing === void 0 ? false : _userProps_isClearing, onClearTransitionEnd = userProps.onClearTransitionEnd, isScrollAtBottom = userProps.isScrollAtBottom, scrollRef = userProps.scrollRef, contentRef = userProps.contentRef, onScrollToBottom = userProps.onScrollToBottom, suggestionsElement = userProps.suggestionsElement, onFeedback = userProps.onFeedback, feedbackState = userProps.feedbackState, props = _object_without_properties(userProps, [
|
|
19435
|
+
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, _userProps_messageClassNames = userProps.messageClassNames, messageClassNames = _userProps_messageClassNames === void 0 ? {} : _userProps_messageClassNames, messageTranslations = userProps.messageTranslations, _userProps_messages = userProps.messages, messages = _userProps_messages === void 0 ? [] : _userProps_messages, MessageComponent = userProps.messageComponent, LoaderComponent = userProps.loaderComponent, ErrorComponent = userProps.errorComponent, EmptyComponent = userProps.emptyComponent, ActionsComponent = userProps.actionsComponent, tools = userProps.tools, indexUiState = userProps.indexUiState, setIndexUiState = userProps.setIndexUiState, _userProps_status = userProps.status, status = _userProps_status === void 0 ? 'ready' : _userProps_status, _userProps_hideScrollToBottom = userProps.hideScrollToBottom, hideScrollToBottom = _userProps_hideScrollToBottom === void 0 ? false : _userProps_hideScrollToBottom, onReload = userProps.onReload, onClose = userProps.onClose, sendMessage = userProps.sendMessage, setInput = userProps.setInput, userTranslations = userProps.translations, userMessageProps = userProps.userMessageProps, assistantMessageProps = userProps.assistantMessageProps, _userProps_isClearing = userProps.isClearing, isClearing = _userProps_isClearing === void 0 ? false : _userProps_isClearing, onClearTransitionEnd = userProps.onClearTransitionEnd, isScrollAtBottom = userProps.isScrollAtBottom, scrollRef = userProps.scrollRef, contentRef = userProps.contentRef, onScrollToBottom = userProps.onScrollToBottom, suggestionsElement = userProps.suggestionsElement, onFeedback = userProps.onFeedback, feedbackState = userProps.feedbackState, props = _object_without_properties(userProps, [
|
|
19056
19436
|
"classNames",
|
|
19057
19437
|
"messageClassNames",
|
|
19058
19438
|
"messageTranslations",
|
|
@@ -19060,6 +19440,7 @@
|
|
|
19060
19440
|
"messageComponent",
|
|
19061
19441
|
"loaderComponent",
|
|
19062
19442
|
"errorComponent",
|
|
19443
|
+
"emptyComponent",
|
|
19063
19444
|
"actionsComponent",
|
|
19064
19445
|
"tools",
|
|
19065
19446
|
"indexUiState",
|
|
@@ -19068,6 +19449,8 @@
|
|
|
19068
19449
|
"hideScrollToBottom",
|
|
19069
19450
|
"onReload",
|
|
19070
19451
|
"onClose",
|
|
19452
|
+
"sendMessage",
|
|
19453
|
+
"setInput",
|
|
19071
19454
|
"translations",
|
|
19072
19455
|
"userMessageProps",
|
|
19073
19456
|
"assistantMessageProps",
|
|
@@ -19099,10 +19482,8 @@
|
|
|
19099
19482
|
};
|
|
19100
19483
|
var lastMessage = messages[messages.length - 1];
|
|
19101
19484
|
var lastPart = lastMessage === null || lastMessage === void 0 ? void 0 : (_lastMessage_parts = lastMessage.parts) === null || _lastMessage_parts === void 0 ? void 0 : _lastMessage_parts[lastMessage.parts.length - 1];
|
|
19102
|
-
var
|
|
19103
|
-
var
|
|
19104
|
-
var isStreamingNonTextContent = status === 'streaming' && lastPart && !isPartText(lastPart);
|
|
19105
|
-
var showLoader = isWaitingForResponse || isStreamingWithNoContent || isStreamingNonTextContent;
|
|
19485
|
+
var showLoader = getShowLoader(status, lastPart, tools);
|
|
19486
|
+
var showEmpty = messages.length === 0 && !showLoader && !isClearing && status !== 'error';
|
|
19106
19487
|
var DefaultMessage = MessageComponent || DefaultMessageComponent;
|
|
19107
19488
|
var DefaultLoader = LoaderComponent || DefaultLoaderComponent;
|
|
19108
19489
|
var DefaultError = ErrorComponent || DefaultErrorComponent;
|
|
@@ -19121,7 +19502,12 @@
|
|
|
19121
19502
|
onClearTransitionEnd === null || onClearTransitionEnd === void 0 ? void 0 : onClearTransitionEnd();
|
|
19122
19503
|
}
|
|
19123
19504
|
}
|
|
19124
|
-
},
|
|
19505
|
+
}, showEmpty && EmptyComponent && /*#__PURE__*/ createElement(EmptyComponent, {
|
|
19506
|
+
sendMessage: sendMessage,
|
|
19507
|
+
setInput: setInput,
|
|
19508
|
+
status: status,
|
|
19509
|
+
onClose: onClose
|
|
19510
|
+
}), messages.map(function(message, index) {
|
|
19125
19511
|
return /*#__PURE__*/ createElement(DefaultMessage, {
|
|
19126
19512
|
key: message.id,
|
|
19127
19513
|
message: message,
|
|
@@ -19160,6 +19546,21 @@
|
|
|
19160
19546
|
})));
|
|
19161
19547
|
};
|
|
19162
19548
|
}
|
|
19549
|
+
var getShowLoader = function getShowLoader(status, lastPart, tools) {
|
|
19550
|
+
if (status !== 'submitted' && status !== 'streaming') return false;
|
|
19551
|
+
if (status === 'submitted') return true;
|
|
19552
|
+
if (!lastPart) return true;
|
|
19553
|
+
if (isPartText(lastPart)) return false;
|
|
19554
|
+
if (isPartTool(lastPart)) {
|
|
19555
|
+
if (lastPart.state === 'output-available') return false;
|
|
19556
|
+
if (lastPart.state === 'input-streaming') {
|
|
19557
|
+
var tool = findTool(lastPart.type, tools);
|
|
19558
|
+
return !(tool === null || tool === void 0 ? void 0 : tool.streamInput);
|
|
19559
|
+
}
|
|
19560
|
+
return true;
|
|
19561
|
+
}
|
|
19562
|
+
return true;
|
|
19563
|
+
};
|
|
19163
19564
|
|
|
19164
19565
|
function createChatOverlayLayoutComponent(param) {
|
|
19165
19566
|
var createElement = param.createElement;
|
|
@@ -19568,6 +19969,107 @@
|
|
|
19568
19969
|
};
|
|
19569
19970
|
}
|
|
19570
19971
|
|
|
19972
|
+
function createChatSidePanelLayoutComponent(param) {
|
|
19973
|
+
var createElement = param.createElement;
|
|
19974
|
+
var originalMargins = new WeakMap();
|
|
19975
|
+
return function ChatSidePanelLayout(userProps) {
|
|
19976
|
+
var open = userProps.open, maximized = userProps.maximized, headerComponent = userProps.headerComponent, messagesComponent = userProps.messagesComponent, promptComponent = userProps.promptComponent, toggleButtonComponent = userProps.toggleButtonComponent, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, className = userProps.className, parentElement = userProps.parentElement; // Chat state props (destructured to avoid spreading on div)
|
|
19977
|
+
userProps.messages;
|
|
19978
|
+
userProps.status;
|
|
19979
|
+
userProps.isClearing;
|
|
19980
|
+
userProps.clearMessages;
|
|
19981
|
+
userProps.onClearTransitionEnd;
|
|
19982
|
+
userProps.suggestions;
|
|
19983
|
+
userProps.tools;
|
|
19984
|
+
userProps.sendMessage;
|
|
19985
|
+
userProps.regenerate;
|
|
19986
|
+
userProps.stop;
|
|
19987
|
+
userProps.error;
|
|
19988
|
+
var rest = _object_without_properties(userProps, [
|
|
19989
|
+
"open",
|
|
19990
|
+
"maximized",
|
|
19991
|
+
"headerComponent",
|
|
19992
|
+
"messagesComponent",
|
|
19993
|
+
"promptComponent",
|
|
19994
|
+
"toggleButtonComponent",
|
|
19995
|
+
"classNames",
|
|
19996
|
+
"className",
|
|
19997
|
+
"parentElement",
|
|
19998
|
+
"messages",
|
|
19999
|
+
"status",
|
|
20000
|
+
"isClearing",
|
|
20001
|
+
"clearMessages",
|
|
20002
|
+
"onClearTransitionEnd",
|
|
20003
|
+
"suggestions",
|
|
20004
|
+
"tools",
|
|
20005
|
+
"sendMessage",
|
|
20006
|
+
"regenerate",
|
|
20007
|
+
"stop",
|
|
20008
|
+
"error"
|
|
20009
|
+
]);
|
|
20010
|
+
var element = typeof document !== 'undefined' ? parentElement ? document.querySelector(parentElement) : document.body : null;
|
|
20011
|
+
if (element) {
|
|
20012
|
+
if (open && !originalMargins.has(element)) {
|
|
20013
|
+
originalMargins.set(element, element.style.marginRight);
|
|
20014
|
+
var chatWidth = getComputedStyle(document.documentElement).getPropertyValue('--ais-chat-width').trim() || '22.5rem';
|
|
20015
|
+
var original = originalMargins.get(element);
|
|
20016
|
+
element.style.marginRight = original ? "calc(".concat(original, " + ").concat(chatWidth, ")") : chatWidth;
|
|
20017
|
+
} else if (!open && originalMargins.has(element)) {
|
|
20018
|
+
var saved = originalMargins.get(element);
|
|
20019
|
+
if (saved) {
|
|
20020
|
+
element.style.marginRight = saved;
|
|
20021
|
+
} else {
|
|
20022
|
+
element.style.removeProperty('margin-right');
|
|
20023
|
+
}
|
|
20024
|
+
originalMargins.delete(element);
|
|
20025
|
+
}
|
|
20026
|
+
}
|
|
20027
|
+
return /*#__PURE__*/ createElement("div", _object_spread_props(_object_spread({}, rest), {
|
|
20028
|
+
className: cx('ais-Chat', 'ais-ChatSidePanelLayout', maximized && 'ais-ChatSidePanelLayout--maximized', classNames.root, className)
|
|
20029
|
+
}), /*#__PURE__*/ createElement("div", {
|
|
20030
|
+
className: cx('ais-Chat-container', open && 'ais-Chat-container--open', maximized && 'ais-Chat-container--maximized', classNames.container)
|
|
20031
|
+
}, headerComponent, messagesComponent, promptComponent), /*#__PURE__*/ createElement("div", {
|
|
20032
|
+
className: "ais-Chat-toggleButtonWrapper"
|
|
20033
|
+
}, toggleButtonComponent));
|
|
20034
|
+
};
|
|
20035
|
+
}
|
|
20036
|
+
|
|
20037
|
+
function createChatGreetingComponent(param) {
|
|
20038
|
+
var createElement = param.createElement;
|
|
20039
|
+
return function ChatGreeting(userProps) {
|
|
20040
|
+
var _ref, _ref1;
|
|
20041
|
+
var userTranslations = userProps.translations, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
20042
|
+
userProps.sendMessage;
|
|
20043
|
+
userProps.status;
|
|
20044
|
+
userProps.onClose;
|
|
20045
|
+
userProps.setInput;
|
|
20046
|
+
var banner = userProps.banner, props = _object_without_properties(userProps, [
|
|
20047
|
+
"translations",
|
|
20048
|
+
"classNames",
|
|
20049
|
+
"sendMessage",
|
|
20050
|
+
"status",
|
|
20051
|
+
"onClose",
|
|
20052
|
+
"setInput",
|
|
20053
|
+
"banner"
|
|
20054
|
+
]);
|
|
20055
|
+
var translations = {
|
|
20056
|
+
heading: (_ref = userTranslations === null || userTranslations === void 0 ? void 0 : userTranslations.heading) !== null && _ref !== void 0 ? _ref : 'How can I help you today?',
|
|
20057
|
+
subheading: (_ref1 = userTranslations === null || userTranslations === void 0 ? void 0 : userTranslations.subheading) !== null && _ref1 !== void 0 ? _ref1 : "Ask me anything about our products, and I'll do my best to assist you."
|
|
20058
|
+
};
|
|
20059
|
+
return /*#__PURE__*/ createElement("div", _object_spread_props(_object_spread({}, props), {
|
|
20060
|
+
className: cx('ais-ChatGreeting', classNames.root, props.className)
|
|
20061
|
+
}), banner && /*#__PURE__*/ createElement("img", {
|
|
20062
|
+
className: cx('ais-ChatGreeting-banner', classNames.banner),
|
|
20063
|
+
src: banner,
|
|
20064
|
+
alt: ""
|
|
20065
|
+
}), /*#__PURE__*/ createElement("h2", {
|
|
20066
|
+
className: cx('ais-ChatGreeting-heading', classNames.heading)
|
|
20067
|
+
}, translations.heading), /*#__PURE__*/ createElement("p", {
|
|
20068
|
+
className: cx('ais-ChatGreeting-subheading', classNames.subheading)
|
|
20069
|
+
}, translations.subheading));
|
|
20070
|
+
};
|
|
20071
|
+
}
|
|
20072
|
+
|
|
19571
20073
|
function createDefaultEmptyComponent(param) {
|
|
19572
20074
|
var createElement = param.createElement, Fragment = param.Fragment;
|
|
19573
20075
|
return function DefaultEmpty() {
|
|
@@ -19962,6 +20464,74 @@
|
|
|
19962
20464
|
};
|
|
19963
20465
|
}
|
|
19964
20466
|
|
|
20467
|
+
function createTrendingFacetsComponent(param) {
|
|
20468
|
+
var createElement = param.createElement, Fragment = param.Fragment;
|
|
20469
|
+
function DefaultHeader(param) {
|
|
20470
|
+
var _param_classNames = param.classNames, classNames = _param_classNames === void 0 ? {} : _param_classNames, items = param.items, translations = param.translations;
|
|
20471
|
+
if (!items || items.length < 1) {
|
|
20472
|
+
return null;
|
|
20473
|
+
}
|
|
20474
|
+
if (!translations.title) {
|
|
20475
|
+
return null;
|
|
20476
|
+
}
|
|
20477
|
+
return /*#__PURE__*/ createElement("h3", {
|
|
20478
|
+
className: classNames.title
|
|
20479
|
+
}, translations.title);
|
|
20480
|
+
}
|
|
20481
|
+
function DefaultItem(param) {
|
|
20482
|
+
var item = param.item;
|
|
20483
|
+
return /*#__PURE__*/ createElement(Fragment, null, item.facetValue);
|
|
20484
|
+
}
|
|
20485
|
+
function DefaultEmpty() {
|
|
20486
|
+
return /*#__PURE__*/ createElement(Fragment, null, "No results");
|
|
20487
|
+
}
|
|
20488
|
+
return function TrendingFacets(userProps) {
|
|
20489
|
+
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, tmp = userProps.emptyComponent, EmptyComponent = tmp === void 0 ? DefaultEmpty : tmp, tmp1 = userProps.headerComponent, HeaderComponent = tmp1 === void 0 ? DefaultHeader : tmp1, tmp2 = userProps.itemComponent, ItemComponent = tmp2 === void 0 ? DefaultItem : tmp2, items = userProps.items, status = userProps.status, userTranslations = userProps.translations, props = _object_without_properties(userProps, [
|
|
20490
|
+
"classNames",
|
|
20491
|
+
"emptyComponent",
|
|
20492
|
+
"headerComponent",
|
|
20493
|
+
"itemComponent",
|
|
20494
|
+
"items",
|
|
20495
|
+
"status",
|
|
20496
|
+
"translations"
|
|
20497
|
+
]);
|
|
20498
|
+
var translations = _object_spread({
|
|
20499
|
+
title: 'Trending'
|
|
20500
|
+
}, userTranslations);
|
|
20501
|
+
var cssClasses = {
|
|
20502
|
+
root: cx('ais-TrendingFacets', classNames.root),
|
|
20503
|
+
emptyRoot: cx('ais-TrendingFacets', classNames.root, 'ais-TrendingFacets--empty', classNames.emptyRoot, props.className),
|
|
20504
|
+
title: cx('ais-TrendingFacets-title', classNames.title),
|
|
20505
|
+
container: cx('ais-TrendingFacets-container', classNames.container),
|
|
20506
|
+
list: cx('ais-TrendingFacets-list', classNames.list),
|
|
20507
|
+
item: cx('ais-TrendingFacets-item', classNames.item)
|
|
20508
|
+
};
|
|
20509
|
+
if (items.length === 0 && status === 'idle') {
|
|
20510
|
+
return /*#__PURE__*/ createElement("section", _object_spread_props(_object_spread({}, props), {
|
|
20511
|
+
className: cssClasses.emptyRoot
|
|
20512
|
+
}), /*#__PURE__*/ createElement(EmptyComponent, null));
|
|
20513
|
+
}
|
|
20514
|
+
return /*#__PURE__*/ createElement("section", _object_spread_props(_object_spread({}, props), {
|
|
20515
|
+
className: cssClasses.root
|
|
20516
|
+
}), /*#__PURE__*/ createElement(HeaderComponent, {
|
|
20517
|
+
classNames: cssClasses,
|
|
20518
|
+
items: items,
|
|
20519
|
+
translations: translations
|
|
20520
|
+
}), /*#__PURE__*/ createElement("div", {
|
|
20521
|
+
className: cssClasses.container
|
|
20522
|
+
}, /*#__PURE__*/ createElement("ol", {
|
|
20523
|
+
className: cssClasses.list
|
|
20524
|
+
}, items.map(function(item, index) {
|
|
20525
|
+
return /*#__PURE__*/ createElement("li", {
|
|
20526
|
+
key: "".concat(item.facetName, ":").concat(item.facetValue, ":").concat(index),
|
|
20527
|
+
className: cssClasses.item
|
|
20528
|
+
}, /*#__PURE__*/ createElement(ItemComponent, {
|
|
20529
|
+
item: item
|
|
20530
|
+
}));
|
|
20531
|
+
}))));
|
|
20532
|
+
};
|
|
20533
|
+
}
|
|
20534
|
+
|
|
19965
20535
|
function createFilterSuggestionsComponent(param) {
|
|
19966
20536
|
var createElement = param.createElement;
|
|
19967
20537
|
var Button = createButtonComponent({
|
|
@@ -20525,18 +21095,21 @@
|
|
|
20525
21095
|
Fragment: React.Fragment
|
|
20526
21096
|
});
|
|
20527
21097
|
function AutocompleteSearch(param) {
|
|
20528
|
-
var inputProps = param.inputProps, clearQuery = param.clearQuery, onQueryChange = param.onQueryChange, query = param.query,
|
|
21098
|
+
var inputProps = param.inputProps, clearQuery = param.clearQuery, onQueryChange = param.onQueryChange, query = param.query, isSearchStalled = param.isSearchStalled, onCancel = param.onCancel, isDetached = param.isDetached, submitTitle = param.submitTitle, onAiModeClick = param.onAiModeClick;
|
|
20529
21099
|
return /*#__PURE__*/ React.createElement(AutocompleteSearchComponent, {
|
|
20530
21100
|
inputProps: _object_spread_props(_object_spread({}, inputProps), {
|
|
20531
21101
|
onChange: function onChange(event) {
|
|
20532
21102
|
var value = event.currentTarget.value;
|
|
20533
|
-
refine(value);
|
|
20534
21103
|
onQueryChange === null || onQueryChange === void 0 ? void 0 : onQueryChange(value);
|
|
20535
21104
|
}
|
|
20536
21105
|
}),
|
|
20537
21106
|
onClear: clearQuery,
|
|
20538
21107
|
query: query,
|
|
20539
|
-
isSearchStalled: isSearchStalled
|
|
21108
|
+
isSearchStalled: isSearchStalled,
|
|
21109
|
+
onCancel: onCancel,
|
|
21110
|
+
isDetached: isDetached,
|
|
21111
|
+
submitTitle: submitTitle,
|
|
21112
|
+
onAiModeClick: onAiModeClick
|
|
20540
21113
|
});
|
|
20541
21114
|
}
|
|
20542
21115
|
|
|
@@ -20922,7 +21495,7 @@
|
|
|
20922
21495
|
}))));
|
|
20923
21496
|
}
|
|
20924
21497
|
function InnerAutocomplete(_0) {
|
|
20925
|
-
var indicesConfig = _0.indicesConfig, refineSearchBox = _0.refineSearchBox, isSearchStalled = _0.isSearchStalled, getSearchPageURL = _0.getSearchPageURL, userOnSelect = _0.onSelect, indexUiState = _0.indexUiState, isSearchPage = _0.isSearchPage, PanelComponent = _0.panelComponent, showRecent = _0.showRecent, recentSearchConfig = _0.recentSearchConfig, showQuerySuggestions = _0.showQuerySuggestions, showPromptSuggestions = _0.showPromptSuggestions, chatRenderState = _0.chatRenderState, transformItems = _0.transformItems, placeholder = _0.placeholder, autoFocus = _0.autoFocus, _0_detachedMediaQuery = _0.detachedMediaQuery, detachedMediaQuery = _0_detachedMediaQuery === void 0 ? DEFAULT_DETACHED_MEDIA_QUERY : _0_detachedMediaQuery, translations = _0.translations, classNames = _0.classNames, props = _object_without_properties(_0, [
|
|
21498
|
+
var indicesConfig = _0.indicesConfig, refineSearchBox = _0.refineSearchBox, isSearchStalled = _0.isSearchStalled, getSearchPageURL = _0.getSearchPageURL, userOnSelect = _0.onSelect, indexUiState = _0.indexUiState, isSearchPage = _0.isSearchPage, PanelComponent = _0.panelComponent, showRecent = _0.showRecent, recentSearchConfig = _0.recentSearchConfig, showQuerySuggestions = _0.showQuerySuggestions, showPromptSuggestions = _0.showPromptSuggestions, chatRenderState = _0.chatRenderState, transformItems = _0.transformItems, placeholder = _0.placeholder, autoFocus = _0.autoFocus, _0_detachedMediaQuery = _0.detachedMediaQuery, detachedMediaQuery = _0_detachedMediaQuery === void 0 ? DEFAULT_DETACHED_MEDIA_QUERY : _0_detachedMediaQuery, translations = _0.translations, classNames = _0.classNames, aiMode = _0.aiMode, props = _object_without_properties(_0, [
|
|
20926
21499
|
"indicesConfig",
|
|
20927
21500
|
"refineSearchBox",
|
|
20928
21501
|
"isSearchStalled",
|
|
@@ -20941,13 +21514,18 @@
|
|
|
20941
21514
|
"autoFocus",
|
|
20942
21515
|
"detachedMediaQuery",
|
|
20943
21516
|
"translations",
|
|
20944
|
-
"classNames"
|
|
21517
|
+
"classNames",
|
|
21518
|
+
"aiMode"
|
|
20945
21519
|
]);
|
|
20946
|
-
var _ref;
|
|
21520
|
+
var _indexUiState_query, _ref;
|
|
20947
21521
|
var _showPromptSuggestions_searchParameters;
|
|
20948
21522
|
var _useAutocomplete = useAutocomplete({
|
|
20949
|
-
transformItems: transformItems
|
|
21523
|
+
transformItems: transformItems,
|
|
21524
|
+
future: {
|
|
21525
|
+
undefinedEmptyQuery: true
|
|
21526
|
+
}
|
|
20950
21527
|
}), indices = _useAutocomplete.indices, refineAutocomplete = _useAutocomplete.refine, currentRefinement = _useAutocomplete.currentRefinement;
|
|
21528
|
+
var resolvedQuery = currentRefinement !== undefined ? currentRefinement : (_indexUiState_query = indexUiState.query) !== null && _indexUiState_query !== void 0 ? _indexUiState_query : '';
|
|
20951
21529
|
var _useDetachedMode = useDetachedMode(detachedMediaQuery), isDetached = _useDetachedMode.isDetached, isModalDetached = _useDetachedMode.isModalDetached, isModalOpen = _useDetachedMode.isModalOpen, setIsModalOpen = _useDetachedMode.setIsModalOpen;
|
|
20952
21530
|
var previousIsDetachedRef = React.useRef(isDetached);
|
|
20953
21531
|
var _useStorage = useStorage({
|
|
@@ -21117,7 +21695,7 @@
|
|
|
21117
21695
|
});
|
|
21118
21696
|
}
|
|
21119
21697
|
indicesForPanel.forEach(function(param) {
|
|
21120
|
-
var indexId = param.indexId, indexName = param.indexName, hits = param.hits;
|
|
21698
|
+
var indexId = param.indexId, indexName = param.indexName, hits = param.hits, sendEvent = param.sendEvent;
|
|
21121
21699
|
var elementId = indexName;
|
|
21122
21700
|
if (indexName === (showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName)) {
|
|
21123
21701
|
elementId = 'suggestions';
|
|
@@ -21143,9 +21721,14 @@
|
|
|
21143
21721
|
});
|
|
21144
21722
|
}),
|
|
21145
21723
|
getItemProps: getItemProps,
|
|
21724
|
+
sendEvent: sendEvent,
|
|
21146
21725
|
classNames: currentIndexConfig.classNames
|
|
21147
21726
|
});
|
|
21148
21727
|
});
|
|
21728
|
+
var handleCancel = function handleCancel() {
|
|
21729
|
+
setIsModalOpen(false);
|
|
21730
|
+
setIsOpen(false);
|
|
21731
|
+
};
|
|
21149
21732
|
var searchBoxContent = /*#__PURE__*/ React.createElement(AutocompleteSearch, {
|
|
21150
21733
|
inputProps: getInputProps(),
|
|
21151
21734
|
clearQuery: function clearQuery() {
|
|
@@ -21155,9 +21738,31 @@
|
|
|
21155
21738
|
onQueryChange: function onQueryChange(query) {
|
|
21156
21739
|
refineAutocomplete(query);
|
|
21157
21740
|
},
|
|
21158
|
-
query:
|
|
21159
|
-
|
|
21160
|
-
|
|
21741
|
+
query: resolvedQuery,
|
|
21742
|
+
isSearchStalled: isSearchStalled,
|
|
21743
|
+
onCancel: function onCancel() {
|
|
21744
|
+
if (isDetached) {
|
|
21745
|
+
handleCancel();
|
|
21746
|
+
}
|
|
21747
|
+
},
|
|
21748
|
+
isDetached: isDetached,
|
|
21749
|
+
submitTitle: isDetached ? translations.detachedCancelButtonText : undefined,
|
|
21750
|
+
onAiModeClick: aiMode ? function() {
|
|
21751
|
+
setIsOpen(false);
|
|
21752
|
+
if (isDetached) {
|
|
21753
|
+
setIsModalOpen(false);
|
|
21754
|
+
}
|
|
21755
|
+
if (chatRenderState) {
|
|
21756
|
+
var _chatRenderState_setOpen;
|
|
21757
|
+
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
21758
|
+
if (resolvedQuery.trim()) {
|
|
21759
|
+
var _chatRenderState_sendMessage;
|
|
21760
|
+
(_chatRenderState_sendMessage = chatRenderState.sendMessage) === null || _chatRenderState_sendMessage === void 0 ? void 0 : _chatRenderState_sendMessage.call(chatRenderState, {
|
|
21761
|
+
text: resolvedQuery
|
|
21762
|
+
});
|
|
21763
|
+
}
|
|
21764
|
+
}
|
|
21765
|
+
} : undefined
|
|
21161
21766
|
});
|
|
21162
21767
|
var panelContent = /*#__PURE__*/ React.createElement(AutocompletePanel, getPanelProps(), PanelComponent ? /*#__PURE__*/ React.createElement(PanelComponent, {
|
|
21163
21768
|
elements: elements,
|
|
@@ -21176,7 +21781,7 @@
|
|
|
21176
21781
|
rootRef: rootRef,
|
|
21177
21782
|
classNames: classNames
|
|
21178
21783
|
}), /*#__PURE__*/ React.createElement(AutocompleteDetachedSearchButton, {
|
|
21179
|
-
query:
|
|
21784
|
+
query: resolvedQuery,
|
|
21180
21785
|
placeholder: placeholder,
|
|
21181
21786
|
classNames: classNames,
|
|
21182
21787
|
onClick: function onClick() {
|
|
@@ -21190,19 +21795,11 @@
|
|
|
21190
21795
|
translations: translations
|
|
21191
21796
|
}), isModalOpen && /*#__PURE__*/ React.createElement(AutocompleteDetachedOverlay, {
|
|
21192
21797
|
classNames: classNames,
|
|
21193
|
-
onClose:
|
|
21194
|
-
setIsModalOpen(false);
|
|
21195
|
-
setIsOpen(false);
|
|
21196
|
-
}
|
|
21798
|
+
onClose: handleCancel
|
|
21197
21799
|
}, /*#__PURE__*/ React.createElement(AutocompleteDetachedContainer, {
|
|
21198
21800
|
classNames: detachedContainerClassNames
|
|
21199
21801
|
}, /*#__PURE__*/ React.createElement(AutocompleteDetachedFormContainer, {
|
|
21200
|
-
classNames: classNames
|
|
21201
|
-
onCancel: function onCancel() {
|
|
21202
|
-
setIsModalOpen(false);
|
|
21203
|
-
setIsOpen(false);
|
|
21204
|
-
},
|
|
21205
|
-
translations: translations
|
|
21802
|
+
classNames: classNames
|
|
21206
21803
|
}, searchBoxContent), panelContent)));
|
|
21207
21804
|
}
|
|
21208
21805
|
// Normal (non-detached) rendering
|
|
@@ -21340,6 +21937,10 @@
|
|
|
21340
21937
|
return /*#__PURE__*/ React.createElement(CarouselUiComponent, _object_spread({}, carouselRefs, props));
|
|
21341
21938
|
}
|
|
21342
21939
|
|
|
21940
|
+
var ChatMessageLoader = createChatMessageLoaderComponent({
|
|
21941
|
+
createElement: React.createElement
|
|
21942
|
+
});
|
|
21943
|
+
|
|
21343
21944
|
var ChatOverlayLayout = createChatOverlayLayoutComponent({
|
|
21344
21945
|
createElement: React.createElement,
|
|
21345
21946
|
Fragment: React.Fragment
|
|
@@ -21350,15 +21951,27 @@
|
|
|
21350
21951
|
Fragment: React.Fragment
|
|
21351
21952
|
});
|
|
21352
21953
|
|
|
21954
|
+
var ChatSidePanelLayout = createChatSidePanelLayoutComponent({
|
|
21955
|
+
createElement: React.createElement,
|
|
21956
|
+
Fragment: React.Fragment
|
|
21957
|
+
});
|
|
21958
|
+
|
|
21959
|
+
var ChatGreeting = createChatGreetingComponent({
|
|
21960
|
+
createElement: React.createElement
|
|
21961
|
+
});
|
|
21962
|
+
|
|
21353
21963
|
function createCarouselTool(showViewAll, itemComponent, getSearchPageURL) {
|
|
21354
21964
|
var Button = createButtonComponent({
|
|
21355
21965
|
createElement: React.createElement
|
|
21356
21966
|
});
|
|
21357
21967
|
function SearchLayoutComponent(param) {
|
|
21358
|
-
var message = param.message, applyFilters = param.applyFilters, onClose = param.onClose;
|
|
21968
|
+
var message = param.message, applyFilters = param.applyFilters, onClose = param.onClose, sendEvent = param.sendEvent;
|
|
21969
|
+
var _ref;
|
|
21970
|
+
var _output_hits;
|
|
21359
21971
|
var input = message === null || message === void 0 ? void 0 : message.input;
|
|
21360
21972
|
var output = message === null || message === void 0 ? void 0 : message.output;
|
|
21361
|
-
var
|
|
21973
|
+
var hitsWithAbsolutePosition = addAbsolutePosition((output === null || output === void 0 ? void 0 : output.hits) || [], 0, ((_ref = input === null || input === void 0 ? void 0 : input.number_of_results) !== null && _ref !== void 0 ? _ref : output === null || output === void 0 ? void 0 : (_output_hits = output.hits) === null || _output_hits === void 0 ? void 0 : _output_hits.length) || 5);
|
|
21974
|
+
var items = addQueryID(hitsWithAbsolutePosition, output === null || output === void 0 ? void 0 : output.queryID);
|
|
21362
21975
|
var MemoedHeaderComponent = React.useMemo(function() {
|
|
21363
21976
|
return function(props) {
|
|
21364
21977
|
return /*#__PURE__*/ React.createElement(HeaderComponent, _object_spread({
|
|
@@ -21379,7 +21992,7 @@
|
|
|
21379
21992
|
return /*#__PURE__*/ React.createElement(Carousel, {
|
|
21380
21993
|
items: items,
|
|
21381
21994
|
itemComponent: itemComponent,
|
|
21382
|
-
sendEvent:
|
|
21995
|
+
sendEvent: sendEvent,
|
|
21383
21996
|
showNavigation: false,
|
|
21384
21997
|
headerComponent: MemoedHeaderComponent
|
|
21385
21998
|
});
|
|
@@ -21447,8 +22060,11 @@
|
|
|
21447
22060
|
var _obj;
|
|
21448
22061
|
return _obj = {}, _define_property(_obj, SearchIndexToolType$1, createCarouselTool(true, itemComponent, getSearchPageURL)), _define_property(_obj, RecommendToolType, createCarouselTool(false, itemComponent, getSearchPageURL)), _define_property(_obj, MemorizeToolType, {}), _define_property(_obj, MemorySearchToolType, {}), _define_property(_obj, PonderToolType, {}), _obj;
|
|
21449
22062
|
}
|
|
21450
|
-
function
|
|
21451
|
-
var
|
|
22063
|
+
function ChatInner(_0, _1) {
|
|
22064
|
+
var _ref = [
|
|
22065
|
+
_0,
|
|
22066
|
+
_1
|
|
22067
|
+
], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), userTools = _ref2.tools, toggleButtonProps = _ref2.toggleButtonProps, headerProps = _ref2.headerProps, messagesProps = _ref2.messagesProps, promptProps = _ref2.promptProps, itemComponent = _ref2.itemComponent, layoutComponent = _ref2.layoutComponent, toggleButtonComponent = _ref2.toggleButtonComponent, toggleButtonIconComponent = _ref2.toggleButtonIconComponent, headerComponent = _ref2.headerComponent, headerTitleIconComponent = _ref2.headerTitleIconComponent, headerCloseIconComponent = _ref2.headerCloseIconComponent, headerMinimizeIconComponent = _ref2.headerMinimizeIconComponent, headerMaximizeIconComponent = _ref2.headerMaximizeIconComponent, loaderComponent = _ref2.loaderComponent, messagesErrorComponent = _ref2.messagesErrorComponent, promptComponent = _ref2.promptComponent, promptHeaderComponent = _ref2.promptHeaderComponent, promptFooterComponent = _ref2.promptFooterComponent, assistantMessageLeadingComponent = _ref2.assistantMessageLeadingComponent, assistantMessageFooterComponent = _ref2.assistantMessageFooterComponent, userMessageLeadingComponent = _ref2.userMessageLeadingComponent, userMessageFooterComponent = _ref2.userMessageFooterComponent, emptyComponent = _ref2.emptyComponent, actionsComponent = _ref2.actionsComponent, suggestionsComponent = _ref2.suggestionsComponent, classNames = _ref2.classNames, _ref_translations = _ref2.translations, translations = _ref_translations === void 0 ? {} : _ref_translations, title = _ref2.title, getSearchPageURL = _ref2.getSearchPageURL, props = _object_without_properties(_ref2, [
|
|
21452
22068
|
"tools",
|
|
21453
22069
|
"toggleButtonProps",
|
|
21454
22070
|
"headerProps",
|
|
@@ -21463,7 +22079,7 @@
|
|
|
21463
22079
|
"headerCloseIconComponent",
|
|
21464
22080
|
"headerMinimizeIconComponent",
|
|
21465
22081
|
"headerMaximizeIconComponent",
|
|
21466
|
-
"
|
|
22082
|
+
"loaderComponent",
|
|
21467
22083
|
"messagesErrorComponent",
|
|
21468
22084
|
"promptComponent",
|
|
21469
22085
|
"promptHeaderComponent",
|
|
@@ -21472,13 +22088,14 @@
|
|
|
21472
22088
|
"assistantMessageFooterComponent",
|
|
21473
22089
|
"userMessageLeadingComponent",
|
|
21474
22090
|
"userMessageFooterComponent",
|
|
22091
|
+
"emptyComponent",
|
|
21475
22092
|
"actionsComponent",
|
|
21476
22093
|
"suggestionsComponent",
|
|
21477
22094
|
"classNames",
|
|
21478
22095
|
"translations",
|
|
21479
22096
|
"title",
|
|
21480
22097
|
"getSearchPageURL"
|
|
21481
|
-
]);
|
|
22098
|
+
]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
|
|
21482
22099
|
var promptTranslations = translations.prompt, headerTranslations = translations.header, messageTranslations = translations.message, messagesTranslations = translations.messages;
|
|
21483
22100
|
var _useInstantSearch = useInstantSearch(), indexUiState = _useInstantSearch.indexUiState, setIndexUiState = _useInstantSearch.setIndexUiState;
|
|
21484
22101
|
var _useState = _sliced_to_array(React.useState(false), 2), maximized = _useState[0], setMaximized = _useState[1];
|
|
@@ -21499,6 +22116,15 @@
|
|
|
21499
22116
|
tools: tools
|
|
21500
22117
|
}));
|
|
21501
22118
|
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, isClearing = chatState.isClearing, clearMessages = chatState.clearMessages, onClearTransitionEnd = chatState.onClearTransitionEnd, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions, onFeedback = chatState.sendChatMessageFeedback, feedbackState = chatState.feedbackState;
|
|
22119
|
+
React.useImperativeHandle(ref, function() {
|
|
22120
|
+
return {
|
|
22121
|
+
setOpen: setOpen,
|
|
22122
|
+
sendMessage: function sendMessage1(params) {
|
|
22123
|
+
return sendMessage(params);
|
|
22124
|
+
},
|
|
22125
|
+
setInput: setInput
|
|
22126
|
+
};
|
|
22127
|
+
});
|
|
21502
22128
|
var wasOpenRef = React.useRef(false);
|
|
21503
22129
|
React.useEffect(function() {
|
|
21504
22130
|
var shouldFocusPrompt = !wasOpenRef.current && open;
|
|
@@ -21561,6 +22187,8 @@
|
|
|
21561
22187
|
onClose: function onClose() {
|
|
21562
22188
|
return setOpen(false);
|
|
21563
22189
|
},
|
|
22190
|
+
sendMessage: sendMessage,
|
|
22191
|
+
setInput: setInput,
|
|
21564
22192
|
onFeedback: onFeedback,
|
|
21565
22193
|
feedbackState: feedbackState,
|
|
21566
22194
|
messages: messages,
|
|
@@ -21573,8 +22201,9 @@
|
|
|
21573
22201
|
scrollRef: scrollRef,
|
|
21574
22202
|
contentRef: contentRef,
|
|
21575
22203
|
onScrollToBottom: scrollToBottom,
|
|
21576
|
-
loaderComponent:
|
|
22204
|
+
loaderComponent: loaderComponent,
|
|
21577
22205
|
errorComponent: messagesErrorComponent,
|
|
22206
|
+
emptyComponent: emptyComponent,
|
|
21578
22207
|
actionsComponent: actionsComponent,
|
|
21579
22208
|
assistantMessageProps: _object_spread({
|
|
21580
22209
|
leadingComponent: assistantMessageLeadingComponent,
|
|
@@ -21618,6 +22247,7 @@
|
|
|
21618
22247
|
classNames: classNames
|
|
21619
22248
|
});
|
|
21620
22249
|
}
|
|
22250
|
+
var Chat = /*#__PURE__*/ React.forwardRef(ChatInner);
|
|
21621
22251
|
|
|
21622
22252
|
function ClearRefinements$1(_0) {
|
|
21623
22253
|
var _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, _0_disabled = _0.disabled, disabled = _0_disabled === void 0 ? false : _0_disabled, _0_onClick = _0.onClick, onClick = _0_onClick === void 0 ? function() {} : _0_onClick, translations = _0.translations, props = _object_without_properties(_0, [
|
|
@@ -22696,8 +23326,30 @@
|
|
|
22696
23326
|
repeatCount: "indefinite"
|
|
22697
23327
|
})))));
|
|
22698
23328
|
}
|
|
23329
|
+
function DefaultAiModeIcon(param) {
|
|
23330
|
+
var classNames = param.classNames;
|
|
23331
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
23332
|
+
className: cx('ais-AiModeButton-icon', classNames.aiModeIcon),
|
|
23333
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23334
|
+
fill: "none",
|
|
23335
|
+
viewBox: "0 0 20 20",
|
|
23336
|
+
width: "16",
|
|
23337
|
+
height: "16",
|
|
23338
|
+
"aria-hidden": "true"
|
|
23339
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
23340
|
+
fill: "currentColor",
|
|
23341
|
+
fillRule: "evenodd",
|
|
23342
|
+
d: "M10 1.875c.27 0 .51.173.594.43l1.593 4.844a1.043 1.043 0 0 0 .664.664l4.844 1.593a.625.625 0 0 1 0 1.188l-4.844 1.593a1.043 1.043 0 0 0-.664.664l-1.593 4.844a.625.625 0 0 1-1.188 0l-1.593-4.844a1.042 1.042 0 0 0-.664-.664l-4.844-1.593a.625.625 0 0 1 0-1.188l4.844-1.593a1.042 1.042 0 0 0 .664-.664l1.593-4.844a.625.625 0 0 1 .594-.43ZM9 7.539A2.292 2.292 0 0 1 7.54 9L4.5 10l3.04 1A2.292 2.292 0 0 1 9 12.46l1 3.04 1-3.04A2.293 2.293 0 0 1 12.46 11l3.04-1-3.04-1A2.292 2.292 0 0 1 11 7.54L10 4.5 9 7.54ZM4.167 1.875c.345 0 .625.28.625.625v3.333a.625.625 0 0 1-1.25 0V2.5c0-.345.28-.625.625-.625ZM15.833 13.542c.345 0 .625.28.625.625V17.5a.625.625 0 1 1-1.25 0v-3.333c0-.345.28-.625.625-.625Z",
|
|
23343
|
+
clipRule: "evenodd"
|
|
23344
|
+
}), /*#__PURE__*/ React.createElement("path", {
|
|
23345
|
+
fill: "currentColor",
|
|
23346
|
+
fillRule: "evenodd",
|
|
23347
|
+
d: "M1.875 4.167c0-.346.28-.625.625-.625h3.333a.625.625 0 1 1 0 1.25H2.5a.625.625 0 0 1-.625-.625ZM13.542 15.833c0-.345.28-.625.625-.625H17.5a.625.625 0 0 1 0 1.25h-3.333a.625.625 0 0 1-.625-.625Z",
|
|
23348
|
+
clipRule: "evenodd"
|
|
23349
|
+
}));
|
|
23350
|
+
}
|
|
22699
23351
|
function SearchBox$1(_0) {
|
|
22700
|
-
var formRef = _0.formRef, inputRef = _0.inputRef, inputProps = _0.inputProps, isSearchStalled = _0.isSearchStalled, onChange = _0.onChange, onReset = _0.onReset, onSubmit = _0.onSubmit, _0_placeholder = _0.placeholder, placeholder = _0_placeholder === void 0 ? '' : _0_placeholder, value = _0.value, autoFocus = _0.autoFocus, tmp = _0.resetIconComponent, ResetIcon = tmp === void 0 ? DefaultResetIcon : tmp, tmp1 = _0.submitIconComponent, SubmitIcon = tmp1 === void 0 ? DefaultSubmitIcon : tmp1, tmp2 = _0.loadingIconComponent, LoadingIcon = tmp2 === void 0 ? DefaultLoadingIcon : tmp2, _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, translations = _0.translations, props = _object_without_properties(_0, [
|
|
23352
|
+
var formRef = _0.formRef, inputRef = _0.inputRef, inputProps = _0.inputProps, isSearchStalled = _0.isSearchStalled, onChange = _0.onChange, onReset = _0.onReset, onSubmit = _0.onSubmit, _0_placeholder = _0.placeholder, placeholder = _0_placeholder === void 0 ? '' : _0_placeholder, value = _0.value, autoFocus = _0.autoFocus, tmp = _0.resetIconComponent, ResetIcon = tmp === void 0 ? DefaultResetIcon : tmp, tmp1 = _0.submitIconComponent, SubmitIcon = tmp1 === void 0 ? DefaultSubmitIcon : tmp1, tmp2 = _0.loadingIconComponent, LoadingIcon = tmp2 === void 0 ? DefaultLoadingIcon : tmp2, tmp3 = _0.aiModeIconComponent, AiModeIcon = tmp3 === void 0 ? DefaultAiModeIcon : tmp3, onAiModeClick = _0.onAiModeClick, _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, translations = _0.translations, props = _object_without_properties(_0, [
|
|
22701
23353
|
"formRef",
|
|
22702
23354
|
"inputRef",
|
|
22703
23355
|
"inputProps",
|
|
@@ -22711,6 +23363,8 @@
|
|
|
22711
23363
|
"resetIconComponent",
|
|
22712
23364
|
"submitIconComponent",
|
|
22713
23365
|
"loadingIconComponent",
|
|
23366
|
+
"aiModeIconComponent",
|
|
23367
|
+
"onAiModeClick",
|
|
22714
23368
|
"classNames",
|
|
22715
23369
|
"translations"
|
|
22716
23370
|
]);
|
|
@@ -22770,7 +23424,19 @@
|
|
|
22770
23424
|
hidden: value.length === 0 || isSearchStalled
|
|
22771
23425
|
}, /*#__PURE__*/ React.createElement(ResetIcon, {
|
|
22772
23426
|
classNames: classNames
|
|
22773
|
-
})), /*#__PURE__*/ React.createElement("
|
|
23427
|
+
})), onAiModeClick && /*#__PURE__*/ React.createElement("button", {
|
|
23428
|
+
className: cx('ais-AiModeButton', classNames.aiModeButton),
|
|
23429
|
+
type: "button",
|
|
23430
|
+
title: translations.aiModeButtonTitle || 'AI Mode',
|
|
23431
|
+
onClick: function onClick(e) {
|
|
23432
|
+
e.preventDefault();
|
|
23433
|
+
onAiModeClick();
|
|
23434
|
+
}
|
|
23435
|
+
}, /*#__PURE__*/ React.createElement(AiModeIcon, {
|
|
23436
|
+
classNames: classNames
|
|
23437
|
+
}), /*#__PURE__*/ React.createElement("span", {
|
|
23438
|
+
className: "ais-AiModeButton-label"
|
|
23439
|
+
}, translations.aiModeButtonTitle || 'AI Mode')), /*#__PURE__*/ React.createElement("span", {
|
|
22774
23440
|
className: cx('ais-SearchBox-loadingIndicator', classNames.loadingIndicator),
|
|
22775
23441
|
hidden: !isSearchStalled
|
|
22776
23442
|
}, /*#__PURE__*/ React.createElement(LoadingIcon, {
|
|
@@ -22934,10 +23600,11 @@
|
|
|
22934
23600
|
}
|
|
22935
23601
|
|
|
22936
23602
|
function SearchBox(_0) {
|
|
22937
|
-
var queryHook = _0.queryHook, _0_searchAsYouType = _0.searchAsYouType, searchAsYouType = _0_searchAsYouType === void 0 ? true : _0_searchAsYouType, _0_ignoreCompositionEvents = _0.ignoreCompositionEvents, ignoreCompositionEvents = _0_ignoreCompositionEvents === void 0 ? false : _0_ignoreCompositionEvents, translations = _0.translations, props = _object_without_properties(_0, [
|
|
23603
|
+
var queryHook = _0.queryHook, _0_searchAsYouType = _0.searchAsYouType, searchAsYouType = _0_searchAsYouType === void 0 ? true : _0_searchAsYouType, _0_ignoreCompositionEvents = _0.ignoreCompositionEvents, ignoreCompositionEvents = _0_ignoreCompositionEvents === void 0 ? false : _0_ignoreCompositionEvents, aiMode = _0.aiMode, translations = _0.translations, props = _object_without_properties(_0, [
|
|
22938
23604
|
"queryHook",
|
|
22939
23605
|
"searchAsYouType",
|
|
22940
23606
|
"ignoreCompositionEvents",
|
|
23607
|
+
"aiMode",
|
|
22941
23608
|
"translations"
|
|
22942
23609
|
]);
|
|
22943
23610
|
var _useSearchBox = useSearchBox({
|
|
@@ -22945,6 +23612,7 @@
|
|
|
22945
23612
|
}, {
|
|
22946
23613
|
$$widgetType: 'ais.searchBox'
|
|
22947
23614
|
}), query = _useSearchBox.query, refine = _useSearchBox.refine, isSearchStalled = _useSearchBox.isSearchStalled;
|
|
23615
|
+
var indexRenderState = useInstantSearch().indexRenderState;
|
|
22948
23616
|
var _useState = _sliced_to_array(React.useState(query), 2), inputValue = _useState[0], setInputValue = _useState[1];
|
|
22949
23617
|
var inputRef = React.useRef(null);
|
|
22950
23618
|
function setQuery(newQuery) {
|
|
@@ -22984,10 +23652,24 @@
|
|
|
22984
23652
|
onChange: onChange,
|
|
22985
23653
|
onReset: onReset,
|
|
22986
23654
|
onSubmit: onSubmit,
|
|
23655
|
+
onAiModeClick: aiMode ? function() {
|
|
23656
|
+
var chatRenderState = indexRenderState.chat;
|
|
23657
|
+
if (chatRenderState) {
|
|
23658
|
+
var _chatRenderState_setOpen;
|
|
23659
|
+
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
23660
|
+
if (inputValue.trim()) {
|
|
23661
|
+
var _chatRenderState_sendMessage;
|
|
23662
|
+
(_chatRenderState_sendMessage = chatRenderState.sendMessage) === null || _chatRenderState_sendMessage === void 0 ? void 0 : _chatRenderState_sendMessage.call(chatRenderState, {
|
|
23663
|
+
text: inputValue
|
|
23664
|
+
});
|
|
23665
|
+
}
|
|
23666
|
+
}
|
|
23667
|
+
} : undefined,
|
|
22987
23668
|
value: inputValue,
|
|
22988
23669
|
translations: _object_spread({
|
|
22989
23670
|
submitButtonTitle: 'Submit the search query',
|
|
22990
|
-
resetButtonTitle: 'Clear the search query'
|
|
23671
|
+
resetButtonTitle: 'Clear the search query',
|
|
23672
|
+
aiModeButtonTitle: 'AI Mode'
|
|
22991
23673
|
}, translations)
|
|
22992
23674
|
};
|
|
22993
23675
|
return /*#__PURE__*/ React.createElement(SearchBox$1, _object_spread({}, props, uiProps));
|
|
@@ -23257,6 +23939,45 @@
|
|
|
23257
23939
|
return /*#__PURE__*/ React.createElement(TrendingItemsUiComponent, _object_spread({}, props, uiProps));
|
|
23258
23940
|
}
|
|
23259
23941
|
|
|
23942
|
+
var TrendingFacetsUiComponent = createTrendingFacetsComponent({
|
|
23943
|
+
createElement: React.createElement,
|
|
23944
|
+
Fragment: React.Fragment
|
|
23945
|
+
});
|
|
23946
|
+
function TrendingFacets(_0) {
|
|
23947
|
+
var facetName = _0.facetName, limit = _0.limit, threshold = _0.threshold, fallbackParameters = _0.fallbackParameters, queryParameters = _0.queryParameters, escapeHTML = _0.escapeHTML, transformItems = _0.transformItems, itemComponent = _0.itemComponent, headerComponent = _0.headerComponent, emptyComponent = _0.emptyComponent, props = _object_without_properties(_0, [
|
|
23948
|
+
"facetName",
|
|
23949
|
+
"limit",
|
|
23950
|
+
"threshold",
|
|
23951
|
+
"fallbackParameters",
|
|
23952
|
+
"queryParameters",
|
|
23953
|
+
"escapeHTML",
|
|
23954
|
+
"transformItems",
|
|
23955
|
+
"itemComponent",
|
|
23956
|
+
"headerComponent",
|
|
23957
|
+
"emptyComponent"
|
|
23958
|
+
]);
|
|
23959
|
+
var status = useInstantSearch().status;
|
|
23960
|
+
var items = useTrendingFacets({
|
|
23961
|
+
facetName: facetName,
|
|
23962
|
+
limit: limit,
|
|
23963
|
+
threshold: threshold,
|
|
23964
|
+
fallbackParameters: fallbackParameters,
|
|
23965
|
+
queryParameters: queryParameters,
|
|
23966
|
+
escapeHTML: escapeHTML,
|
|
23967
|
+
transformItems: transformItems
|
|
23968
|
+
}, {
|
|
23969
|
+
$$widgetType: 'ais.trendingFacets'
|
|
23970
|
+
}).items;
|
|
23971
|
+
var uiProps = {
|
|
23972
|
+
items: items,
|
|
23973
|
+
itemComponent: itemComponent,
|
|
23974
|
+
headerComponent: headerComponent,
|
|
23975
|
+
emptyComponent: emptyComponent,
|
|
23976
|
+
status: status
|
|
23977
|
+
};
|
|
23978
|
+
return /*#__PURE__*/ React.createElement(TrendingFacetsUiComponent, _object_spread({}, props, uiProps));
|
|
23979
|
+
}
|
|
23980
|
+
|
|
23260
23981
|
var FilterSuggestionsUiComponent = createFilterSuggestionsComponent({
|
|
23261
23982
|
createElement: React.createElement,
|
|
23262
23983
|
Fragment: React.Fragment
|
|
@@ -23300,8 +24021,11 @@
|
|
|
23300
24021
|
exports.Breadcrumb = Breadcrumb;
|
|
23301
24022
|
exports.Carousel = Carousel;
|
|
23302
24023
|
exports.Chat = Chat;
|
|
24024
|
+
exports.ChatGreeting = ChatGreeting;
|
|
23303
24025
|
exports.ChatInlineLayout = ChatInlineLayout;
|
|
24026
|
+
exports.ChatMessageLoader = ChatMessageLoader;
|
|
23304
24027
|
exports.ChatOverlayLayout = ChatOverlayLayout;
|
|
24028
|
+
exports.ChatSidePanelLayout = ChatSidePanelLayout;
|
|
23305
24029
|
exports.ClearRefinements = ClearRefinements;
|
|
23306
24030
|
exports.Configure = Configure;
|
|
23307
24031
|
exports.CurrentRefinements = CurrentRefinements;
|
|
@@ -23338,6 +24062,7 @@
|
|
|
23338
24062
|
exports.SortBy = SortBy;
|
|
23339
24063
|
exports.Stats = Stats;
|
|
23340
24064
|
exports.ToggleRefinement = ToggleRefinement;
|
|
24065
|
+
exports.TrendingFacets = TrendingFacets;
|
|
23341
24066
|
exports.TrendingItems = TrendingItems;
|
|
23342
24067
|
exports.createDefaultTools = createDefaultTools;
|
|
23343
24068
|
exports.getServerState = getServerState;
|
|
@@ -23373,6 +24098,7 @@
|
|
|
23373
24098
|
exports.useStats = useStats;
|
|
23374
24099
|
exports.useStickToBottom = useStickToBottom;
|
|
23375
24100
|
exports.useToggleRefinement = useToggleRefinement;
|
|
24101
|
+
exports.useTrendingFacets = useTrendingFacets;
|
|
23376
24102
|
exports.useTrendingItems = useTrendingItems;
|
|
23377
24103
|
exports.version = version$2;
|
|
23378
24104
|
exports.wrapPromiseWithState = wrapPromiseWithState;
|