@appbaseio/reactivesearch-vue 3.0.0-alpha.1 → 3.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +2327 -827
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-611cf7f9.js → ComponentWrapper-2dc930e1.js} +20 -19
  6. package/dist/cjs/{DropDown-dc184468.js → DropDown-7bd56543.js} +3 -4
  7. package/dist/cjs/DynamicRangeSlider.js +51 -50
  8. package/dist/cjs/MultiDropdownList.js +33 -33
  9. package/dist/cjs/MultiList.js +29 -30
  10. package/dist/cjs/MultiRange.js +17 -17
  11. package/dist/cjs/{Pagination-b5ddc906.js → Pagination-4ffc67cd.js} +3 -4
  12. package/dist/cjs/{PreferencesConsumer-22d1b49f.js → PreferencesConsumer-2c69ac61.js} +1 -1
  13. package/dist/cjs/RangeInput.js +7 -8
  14. package/dist/cjs/RangeSlider.js +15 -15
  15. package/dist/cjs/ReactiveBase.js +32 -13
  16. package/dist/cjs/{ReactiveComponent-a6108189.js → ReactiveComponent-4435adfa.js} +84 -81
  17. package/dist/cjs/ReactiveComponent.js +8 -8
  18. package/dist/cjs/ReactiveGoogleMap.js +33 -34
  19. package/dist/cjs/ReactiveList.js +37 -27
  20. package/dist/cjs/SelectedFilters.js +7 -8
  21. package/dist/cjs/SingleDropdownList.js +23 -24
  22. package/dist/cjs/SingleList.js +20 -21
  23. package/dist/cjs/SingleRange.js +14 -14
  24. package/dist/cjs/StateProvider.js +4 -5
  25. package/dist/cjs/ToggleButton.js +17 -18
  26. package/dist/cjs/{index-d8d8f291.js → index-1481798c.js} +4 -7
  27. package/dist/cjs/index.js +12 -17
  28. package/dist/cjs/initReactivesearch.js +10 -464
  29. package/dist/cjs/install.js +9 -8
  30. package/dist/cjs/{ssr-6c8a72e1.js → ssr-c58b64c4.js} +4 -4
  31. package/dist/cjs/{utils-83fd01e9.js → utils-36b1b880.js} +2 -5
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/es/{ComponentWrapper-3dfe6931.js → ComponentWrapper-3a215eed.js} +9 -7
  34. package/dist/es/DynamicRangeSlider.js +33 -31
  35. package/dist/es/MultiDropdownList.js +16 -15
  36. package/dist/es/MultiList.js +15 -15
  37. package/dist/es/MultiRange.js +7 -6
  38. package/dist/es/RangeInput.js +2 -2
  39. package/dist/es/RangeSlider.js +5 -4
  40. package/dist/es/ReactiveBase.js +27 -8
  41. package/dist/es/{ReactiveComponent-0a97eb1e.js → ReactiveComponent-04d94e01.js} +38 -34
  42. package/dist/es/ReactiveComponent.js +3 -3
  43. package/dist/es/ReactiveGoogleMap.js +11 -11
  44. package/dist/es/ReactiveList.js +16 -5
  45. package/dist/es/SingleDropdownList.js +6 -6
  46. package/dist/es/SingleList.js +6 -6
  47. package/dist/es/SingleRange.js +4 -3
  48. package/dist/es/ToggleButton.js +6 -6
  49. package/dist/es/index.js +7 -12
  50. package/dist/es/initReactivesearch.js +9 -463
  51. package/dist/es/install.js +4 -3
  52. package/dist/es/{ssr-584c278d.js → ssr-e5eb1f1e.js} +4 -4
  53. package/dist/es/version.js +1 -1
  54. package/package.json +2 -2
@@ -1010,7 +1010,7 @@
1010
1010
  return state;
1011
1011
  }
1012
1012
  });
1013
- var dependencyTreeReducer = unwrapExports(dependencyTreeReducer_1);
1013
+ unwrapExports(dependencyTreeReducer_1);
1014
1014
 
1015
1015
  var queryReducer_1 = createCommonjsModule(function (module, exports) {
1016
1016
  Object.defineProperty(exports, "__esModule", {
@@ -1063,7 +1063,7 @@
1063
1063
  return state;
1064
1064
  }
1065
1065
  });
1066
- var queryReducer = unwrapExports(queryReducer_1);
1066
+ unwrapExports(queryReducer_1);
1067
1067
 
1068
1068
  var appbaseQueryReducer_1 = createCommonjsModule(function (module, exports) {
1069
1069
  Object.defineProperty(exports, "__esModule", {
@@ -1143,7 +1143,7 @@
1143
1143
  return state;
1144
1144
  }
1145
1145
  });
1146
- var queryOptionsReducer = unwrapExports(queryOptionsReducer_1);
1146
+ unwrapExports(queryOptionsReducer_1);
1147
1147
 
1148
1148
  var constants$1 = createCommonjsModule(function (module, exports) {
1149
1149
  Object.defineProperty(exports, "__esModule", {
@@ -1673,7 +1673,7 @@
1673
1673
  }
1674
1674
  }
1675
1675
  });
1676
- var valueReducer = unwrapExports(valueReducer_1);
1676
+ unwrapExports(valueReducer_1);
1677
1677
 
1678
1678
  var internalValueReducer = createCommonjsModule(function (module, exports) {
1679
1679
  Object.defineProperty(exports, "__esModule", {
@@ -2544,7 +2544,7 @@
2544
2544
  return state;
2545
2545
  }
2546
2546
  });
2547
- var compositeAggsReducer = unwrapExports(compositeAggsReducer_1);
2547
+ unwrapExports(compositeAggsReducer_1);
2548
2548
 
2549
2549
  var appliedSettingsReducer_1 = createCommonjsModule(function (module, exports) {
2550
2550
  Object.defineProperty(exports, "__esModule", {
@@ -5102,13 +5102,15 @@
5102
5102
  size = props.size,
5103
5103
  sortBy = props.sortBy,
5104
5104
  showMissing = props.showMissing,
5105
- missingLabel = props.missingLabel;
5105
+ missingLabel = props.missingLabel,
5106
+ aggregationSize = props.aggregationSize;
5106
5107
  clonedQuery.size = 0;
5107
5108
  if (typeof dataField === 'string') {
5108
5109
  clonedQuery.aggs = _defineProperty({}, dataField, {
5109
5110
  terms: _extends({
5110
5111
  field: dataField,
5111
5112
  size: size,
5113
+ aggregationSize: aggregationSize,
5112
5114
  order: getAggsOrder(sortBy || 'count')
5113
5115
  }, showMissing ? {
5114
5116
  missing: missingLabel
@@ -5121,6 +5123,7 @@
5121
5123
  terms: _extends({
5122
5124
  field: dataFieldItem,
5123
5125
  size: size,
5126
+ aggregationSize: aggregationSize,
5124
5127
  order: getAggsOrder(sortBy || 'count')
5125
5128
  }, showMissing ? {
5126
5129
  missing: missingLabel
@@ -5994,7 +5997,7 @@
5994
5997
  excludeFields: props.excludeFields,
5995
5998
  size: props.size,
5996
5999
  aggregationSize: props.aggregationSize,
5997
- from: props.from,
6000
+ from: props.from || undefined,
5998
6001
  queryFormat: props.queryFormat,
5999
6002
  sortBy: props.sortBy,
6000
6003
  fieldWeights: getNormalizedField(props.fieldWeights),
@@ -7532,7 +7535,7 @@
7532
7535
  dependencyTree = _getState3.dependencyTree,
7533
7536
  queryList = _getState3.queryList,
7534
7537
  queryOptions = _getState3.queryOptions;
7535
- var lockTime = config.initialQueriesSyncTime || 50;
7538
+ var lockTime = config.initialQueriesSyncTime || 100;
7536
7539
  var initialTimestamp = config.initialTimestamp;
7537
7540
  var queryId = requestId || new Date().getTime();
7538
7541
  if (config.queryLockConfig instanceof Object) {
@@ -7573,16 +7576,20 @@
7573
7576
  var queryToLog = _extends(_defineProperty({}, component, currentQuery), Object.keys(dependentQueries).reduce(function (acc, q) {
7574
7577
  return _extends({}, acc, _defineProperty({}, q, _extends({}, dependentQueries[q], {
7575
7578
  execute: false
7576
- })));
7579
+ }, dependentQueries[q].type === constants$1.queryTypes.suggestion ? {
7580
+ type: 'search'
7581
+ } : {})));
7577
7582
  }, {}));
7578
7583
  var queryType = transform.componentToTypeMap[componentProps && componentProps.componentType];
7579
7584
  if ([constants$1.queryTypes.range, constants$1.queryTypes.term].includes(queryType)) {
7580
7585
  var _value = currentQuery.value,
7581
7586
  rest = _objectWithoutProperties(currentQuery, ['value']);
7582
7587
  queryToLog = _extends(_defineProperty({}, component, rest), Object.keys(dependentQueries).reduce(function (acc, q) {
7583
- return _extends({}, acc, _defineProperty({}, q, [].concat(_toConsumableArray(dependentQueries[q]), _toConsumableArray({
7588
+ return _extends({}, acc, _defineProperty({}, q, _extends({}, dependentQueries[q], {
7584
7589
  execute: false
7585
- }))));
7590
+ }, dependentQueries[q].type === constants$1.queryTypes.suggestion ? {
7591
+ type: 'search'
7592
+ } : {})));
7586
7593
  }, {}));
7587
7594
  }
7588
7595
  if (mustExecuteMapQuery || !(0, helper.compareQueries)(queryToLog, oldQuery, false)) {
@@ -8466,6 +8473,337 @@
8466
8473
  };
8467
8474
  var babelHelperVueTransformOn = transformOn;
8468
8475
 
8476
+ function _regeneratorRuntime() {
8477
+ _regeneratorRuntime = function () {
8478
+ return exports;
8479
+ };
8480
+ var exports = {},
8481
+ Op = Object.prototype,
8482
+ hasOwn = Op.hasOwnProperty,
8483
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
8484
+ obj[key] = desc.value;
8485
+ },
8486
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
8487
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
8488
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
8489
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
8490
+ function define(obj, key, value) {
8491
+ return Object.defineProperty(obj, key, {
8492
+ value: value,
8493
+ enumerable: !0,
8494
+ configurable: !0,
8495
+ writable: !0
8496
+ }), obj[key];
8497
+ }
8498
+ try {
8499
+ define({}, "");
8500
+ } catch (err) {
8501
+ define = function (obj, key, value) {
8502
+ return obj[key] = value;
8503
+ };
8504
+ }
8505
+ function wrap(innerFn, outerFn, self, tryLocsList) {
8506
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
8507
+ generator = Object.create(protoGenerator.prototype),
8508
+ context = new Context(tryLocsList || []);
8509
+ return defineProperty(generator, "_invoke", {
8510
+ value: makeInvokeMethod(innerFn, self, context)
8511
+ }), generator;
8512
+ }
8513
+ function tryCatch(fn, obj, arg) {
8514
+ try {
8515
+ return {
8516
+ type: "normal",
8517
+ arg: fn.call(obj, arg)
8518
+ };
8519
+ } catch (err) {
8520
+ return {
8521
+ type: "throw",
8522
+ arg: err
8523
+ };
8524
+ }
8525
+ }
8526
+ exports.wrap = wrap;
8527
+ var ContinueSentinel = {};
8528
+ function Generator() {}
8529
+ function GeneratorFunction() {}
8530
+ function GeneratorFunctionPrototype() {}
8531
+ var IteratorPrototype = {};
8532
+ define(IteratorPrototype, iteratorSymbol, function () {
8533
+ return this;
8534
+ });
8535
+ var getProto = Object.getPrototypeOf,
8536
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
8537
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
8538
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
8539
+ function defineIteratorMethods(prototype) {
8540
+ ["next", "throw", "return"].forEach(function (method) {
8541
+ define(prototype, method, function (arg) {
8542
+ return this._invoke(method, arg);
8543
+ });
8544
+ });
8545
+ }
8546
+ function AsyncIterator(generator, PromiseImpl) {
8547
+ function invoke(method, arg, resolve, reject) {
8548
+ var record = tryCatch(generator[method], generator, arg);
8549
+ if ("throw" !== record.type) {
8550
+ var result = record.arg,
8551
+ value = result.value;
8552
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
8553
+ invoke("next", value, resolve, reject);
8554
+ }, function (err) {
8555
+ invoke("throw", err, resolve, reject);
8556
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
8557
+ result.value = unwrapped, resolve(result);
8558
+ }, function (error) {
8559
+ return invoke("throw", error, resolve, reject);
8560
+ });
8561
+ }
8562
+ reject(record.arg);
8563
+ }
8564
+ var previousPromise;
8565
+ defineProperty(this, "_invoke", {
8566
+ value: function (method, arg) {
8567
+ function callInvokeWithMethodAndArg() {
8568
+ return new PromiseImpl(function (resolve, reject) {
8569
+ invoke(method, arg, resolve, reject);
8570
+ });
8571
+ }
8572
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
8573
+ }
8574
+ });
8575
+ }
8576
+ function makeInvokeMethod(innerFn, self, context) {
8577
+ var state = "suspendedStart";
8578
+ return function (method, arg) {
8579
+ if ("executing" === state) throw new Error("Generator is already running");
8580
+ if ("completed" === state) {
8581
+ if ("throw" === method) throw arg;
8582
+ return doneResult();
8583
+ }
8584
+ for (context.method = method, context.arg = arg;;) {
8585
+ var delegate = context.delegate;
8586
+ if (delegate) {
8587
+ var delegateResult = maybeInvokeDelegate(delegate, context);
8588
+ if (delegateResult) {
8589
+ if (delegateResult === ContinueSentinel) continue;
8590
+ return delegateResult;
8591
+ }
8592
+ }
8593
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
8594
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
8595
+ context.dispatchException(context.arg);
8596
+ } else "return" === context.method && context.abrupt("return", context.arg);
8597
+ state = "executing";
8598
+ var record = tryCatch(innerFn, self, context);
8599
+ if ("normal" === record.type) {
8600
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
8601
+ return {
8602
+ value: record.arg,
8603
+ done: context.done
8604
+ };
8605
+ }
8606
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
8607
+ }
8608
+ };
8609
+ }
8610
+ function maybeInvokeDelegate(delegate, context) {
8611
+ var methodName = context.method,
8612
+ method = delegate.iterator[methodName];
8613
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
8614
+ var record = tryCatch(method, delegate.iterator, context.arg);
8615
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
8616
+ var info = record.arg;
8617
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
8618
+ }
8619
+ function pushTryEntry(locs) {
8620
+ var entry = {
8621
+ tryLoc: locs[0]
8622
+ };
8623
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
8624
+ }
8625
+ function resetTryEntry(entry) {
8626
+ var record = entry.completion || {};
8627
+ record.type = "normal", delete record.arg, entry.completion = record;
8628
+ }
8629
+ function Context(tryLocsList) {
8630
+ this.tryEntries = [{
8631
+ tryLoc: "root"
8632
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
8633
+ }
8634
+ function values(iterable) {
8635
+ if (iterable) {
8636
+ var iteratorMethod = iterable[iteratorSymbol];
8637
+ if (iteratorMethod) return iteratorMethod.call(iterable);
8638
+ if ("function" == typeof iterable.next) return iterable;
8639
+ if (!isNaN(iterable.length)) {
8640
+ var i = -1,
8641
+ next = function next() {
8642
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
8643
+ return next.value = undefined, next.done = !0, next;
8644
+ };
8645
+ return next.next = next;
8646
+ }
8647
+ }
8648
+ return {
8649
+ next: doneResult
8650
+ };
8651
+ }
8652
+ function doneResult() {
8653
+ return {
8654
+ value: undefined,
8655
+ done: !0
8656
+ };
8657
+ }
8658
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
8659
+ value: GeneratorFunctionPrototype,
8660
+ configurable: !0
8661
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
8662
+ value: GeneratorFunction,
8663
+ configurable: !0
8664
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
8665
+ var ctor = "function" == typeof genFun && genFun.constructor;
8666
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
8667
+ }, exports.mark = function (genFun) {
8668
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
8669
+ }, exports.awrap = function (arg) {
8670
+ return {
8671
+ __await: arg
8672
+ };
8673
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
8674
+ return this;
8675
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
8676
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
8677
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
8678
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
8679
+ return result.done ? result.value : iter.next();
8680
+ });
8681
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
8682
+ return this;
8683
+ }), define(Gp, "toString", function () {
8684
+ return "[object Generator]";
8685
+ }), exports.keys = function (val) {
8686
+ var object = Object(val),
8687
+ keys = [];
8688
+ for (var key in object) keys.push(key);
8689
+ return keys.reverse(), function next() {
8690
+ for (; keys.length;) {
8691
+ var key = keys.pop();
8692
+ if (key in object) return next.value = key, next.done = !1, next;
8693
+ }
8694
+ return next.done = !0, next;
8695
+ };
8696
+ }, exports.values = values, Context.prototype = {
8697
+ constructor: Context,
8698
+ reset: function (skipTempReset) {
8699
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
8700
+ },
8701
+ stop: function () {
8702
+ this.done = !0;
8703
+ var rootRecord = this.tryEntries[0].completion;
8704
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
8705
+ return this.rval;
8706
+ },
8707
+ dispatchException: function (exception) {
8708
+ if (this.done) throw exception;
8709
+ var context = this;
8710
+ function handle(loc, caught) {
8711
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
8712
+ }
8713
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8714
+ var entry = this.tryEntries[i],
8715
+ record = entry.completion;
8716
+ if ("root" === entry.tryLoc) return handle("end");
8717
+ if (entry.tryLoc <= this.prev) {
8718
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
8719
+ hasFinally = hasOwn.call(entry, "finallyLoc");
8720
+ if (hasCatch && hasFinally) {
8721
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
8722
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
8723
+ } else if (hasCatch) {
8724
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
8725
+ } else {
8726
+ if (!hasFinally) throw new Error("try statement without catch or finally");
8727
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
8728
+ }
8729
+ }
8730
+ }
8731
+ },
8732
+ abrupt: function (type, arg) {
8733
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8734
+ var entry = this.tryEntries[i];
8735
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
8736
+ var finallyEntry = entry;
8737
+ break;
8738
+ }
8739
+ }
8740
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
8741
+ var record = finallyEntry ? finallyEntry.completion : {};
8742
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
8743
+ },
8744
+ complete: function (record, afterLoc) {
8745
+ if ("throw" === record.type) throw record.arg;
8746
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
8747
+ },
8748
+ finish: function (finallyLoc) {
8749
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8750
+ var entry = this.tryEntries[i];
8751
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
8752
+ }
8753
+ },
8754
+ catch: function (tryLoc) {
8755
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
8756
+ var entry = this.tryEntries[i];
8757
+ if (entry.tryLoc === tryLoc) {
8758
+ var record = entry.completion;
8759
+ if ("throw" === record.type) {
8760
+ var thrown = record.arg;
8761
+ resetTryEntry(entry);
8762
+ }
8763
+ return thrown;
8764
+ }
8765
+ }
8766
+ throw new Error("illegal catch attempt");
8767
+ },
8768
+ delegateYield: function (iterable, resultName, nextLoc) {
8769
+ return this.delegate = {
8770
+ iterator: values(iterable),
8771
+ resultName: resultName,
8772
+ nextLoc: nextLoc
8773
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
8774
+ }
8775
+ }, exports;
8776
+ }
8777
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8778
+ try {
8779
+ var info = gen[key](arg);
8780
+ var value = info.value;
8781
+ } catch (error) {
8782
+ reject(error);
8783
+ return;
8784
+ }
8785
+ if (info.done) {
8786
+ resolve(value);
8787
+ } else {
8788
+ Promise.resolve(value).then(_next, _throw);
8789
+ }
8790
+ }
8791
+ function _asyncToGenerator(fn) {
8792
+ return function () {
8793
+ var self = this,
8794
+ args = arguments;
8795
+ return new Promise(function (resolve, reject) {
8796
+ var gen = fn.apply(self, args);
8797
+ function _next(value) {
8798
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
8799
+ }
8800
+ function _throw(err) {
8801
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
8802
+ }
8803
+ _next(undefined);
8804
+ });
8805
+ };
8806
+ }
8469
8807
  function _defineProperties(target, props) {
8470
8808
  for (var i = 0; i < props.length; i++) {
8471
8809
  var descriptor = props[i];
@@ -12752,6 +13090,7 @@
12752
13090
  destroyOnUnmount: Q.bool.def(true)
12753
13091
  },
12754
13092
  created: function created() {
13093
+ var _this = this;
12755
13094
  // clone the props for component it is needed because attrs gets changed on time
12756
13095
  var componentProps = _extends({}, this.$attrs);
12757
13096
  // handle kebab case for props
@@ -12763,9 +13102,6 @@
12763
13102
  this.componentId = this.componentProps.componentId;
12764
13103
  this.react = this.componentProps.react;
12765
13104
  this.$timestamp = new Date().getTime();
12766
- },
12767
- beforeMount: function beforeMount() {
12768
- var _this = this;
12769
13105
  var components = [];
12770
13106
  if (this.$$store) {
12771
13107
  var _this$$$store$getStat = this.$$store.getState();
@@ -12800,11 +13136,15 @@
12800
13136
  this.addComponent(this.internalComponent, this.$timestamp);
12801
13137
  this.setComponentProps(this.internalComponent, this.componentProps, options.componentType);
12802
13138
  }
13139
+ if (this.internalComponent) {
13140
+ // Watch component after rendering the component to avoid the un-necessary calls
13141
+ this.setReact(this.componentProps, false);
13142
+ }
12803
13143
  },
12804
13144
  mounted: function mounted() {
12805
13145
  if (this.internalComponent) {
12806
13146
  // Watch component after rendering the component to avoid the un-necessary calls
12807
- this.setReact(this.componentProps);
13147
+ this.setReact(this.componentProps, true);
12808
13148
  }
12809
13149
  },
12810
13150
  beforeDestroy: function beforeDestroy() {
@@ -12843,7 +13183,7 @@
12843
13183
  }
12844
13184
  },
12845
13185
  methods: {
12846
- setReact: function setReact(props) {
13186
+ setReact: function setReact(props, shouldExecute) {
12847
13187
  var react = props.react,
12848
13188
  executeInitialQuery = props.executeInitialQuery;
12849
13189
  if (this.internalComponent) {
@@ -12853,10 +13193,10 @@
12853
13193
  } else {
12854
13194
  this.watchComponent(props.componentId, {
12855
13195
  and: this.internalComponent
12856
- }, executeInitialQuery);
13196
+ }, shouldExecute || executeInitialQuery);
12857
13197
  }
12858
13198
  } else {
12859
- this.watchComponent(props.componentId, react, executeInitialQuery);
13199
+ this.watchComponent(props.componentId, react, shouldExecute || executeInitialQuery);
12860
13200
  }
12861
13201
  }
12862
13202
  },
@@ -13301,7 +13641,7 @@
13301
13641
  }, constants_1$1.reactiveList);
13302
13642
  },
13303
13643
  props: {
13304
- currentPage: Q.number.def(0),
13644
+ currentPage: Q.number,
13305
13645
  includeFields: types.includeFields,
13306
13646
  // component props
13307
13647
  className: types.string,
@@ -13486,7 +13826,16 @@
13486
13826
  },
13487
13827
  infiniteScroll: function infiniteScroll(newVal, oldVal) {
13488
13828
  if (newVal !== oldVal) {
13489
- if (!newVal) {
13829
+ if (newVal && !this.pagination) {
13830
+ window.addEventListener('scroll', this.scrollHandler);
13831
+ } else {
13832
+ window.removeEventListener('scroll', this.scrollHandler);
13833
+ }
13834
+ }
13835
+ },
13836
+ pagination: function pagination(newVal, oldVal) {
13837
+ if (newVal !== oldVal) {
13838
+ if (!newVal && this.infiniteScroll) {
13490
13839
  window.addEventListener('scroll', this.scrollHandler);
13491
13840
  } else {
13492
13841
  window.removeEventListener('scroll', this.scrollHandler);
@@ -13768,8 +14117,8 @@
13768
14117
  triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
13769
14118
  var docId = documentId;
13770
14119
  if (!docId) {
13771
- var _this$getData = this.getData(),
13772
- data = _this$getData.data;
14120
+ var _this$getData2 = this.getData(),
14121
+ data = _this$getData2.data;
13773
14122
  var hitData = data.find(function (hit) {
13774
14123
  return hit._click_id === searchPosition;
13775
14124
  });
@@ -13927,6 +14276,8 @@
13927
14276
  internalComponent: ReactiveList.hasInternalComponent()
13928
14277
  }));
13929
14278
  RLConnected.name = ReactiveList.name;
14279
+ RLConnected.generateQueryOptions = ReactiveList.generateQueryOptions;
14280
+ RLConnected.hasInternalComponent = ReactiveList.hasInternalComponent;
13930
14281
  RLConnected.install = function (Vue) {
13931
14282
  Vue.component(RLConnected.name, RLConnected);
13932
14283
  Vue.component(ResultListWrapper.name, ResultListWrapper);
@@ -16057,12 +16408,12 @@
16057
16408
  try {
16058
16409
  var component = item[0],
16059
16410
  value = item[1];
16060
- var _ref = _this.selectedValues[component] || {
16411
+ var _ref2 = _this.selectedValues[component] || {
16061
16412
  label: component
16062
16413
  },
16063
- label = _ref.label,
16064
- showFilter = _ref.showFilter,
16065
- URLParams = _ref.URLParams;
16414
+ label = _ref2.label,
16415
+ showFilter = _ref2.showFilter,
16416
+ URLParams = _ref2.URLParams;
16066
16417
  _this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
16067
16418
  } catch (e) {
16068
16419
  // Do not set value if JSON parsing fails.
@@ -16279,6 +16630,7 @@
16279
16630
  function _isSlot$4(s) {
16280
16631
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
16281
16632
  }
16633
+ var setValues = lib_5.setValues;
16282
16634
  var ReactiveBase = {
16283
16635
  name: 'ReactiveBase',
16284
16636
  data: function data() {
@@ -16305,6 +16657,7 @@
16305
16657
  initialQueriesSyncTime: types.number,
16306
16658
  className: types.string,
16307
16659
  initialState: Q.object.def({}),
16660
+ contextCollector: Q.func,
16308
16661
  transformRequest: types.func,
16309
16662
  transformResponse: types.func,
16310
16663
  as: Q.string.def('div'),
@@ -16315,11 +16668,15 @@
16315
16668
  preferences: Q.object
16316
16669
  },
16317
16670
  provide: function provide() {
16671
+ var createCacheFn = createCache;
16672
+ if (createCache["default"]) {
16673
+ createCacheFn = createCache["default"];
16674
+ }
16318
16675
  return {
16319
16676
  theme_reactivesearch: composeThemeObject(getTheme(this.$props.themePreset), this.$props.theme),
16320
16677
  store: this.store,
16321
16678
  $searchPreferences: this.preferences,
16322
- $emotionCache: this.$parent && this.$parent.$emotionCache || createCache({
16679
+ $emotionCache: this.$parent && this.$parent.$emotionCache || createCacheFn({
16323
16680
  key: 'css'
16324
16681
  })
16325
16682
  };
@@ -16473,8 +16830,20 @@
16473
16830
  selectedValues: selectedValues,
16474
16831
  urlValues: urlValues,
16475
16832
  headers: this.getHeaders
16476
- }, this.$props.initialState);
16477
- this.store = configureStore(initialState);
16833
+ }, this.initialState);
16834
+ var storeFn = configureStore;
16835
+ if (configureStore["default"]) {
16836
+ storeFn = configureStore["default"];
16837
+ }
16838
+ this.store = storeFn(initialState);
16839
+ // server side rendered app to collect context
16840
+ if (typeof window === 'undefined' && props.contextCollector) {
16841
+ var res = props.contextCollector({
16842
+ ctx: this.store
16843
+ });
16844
+ // necessary for supporting SSR of queryParams
16845
+ this.store.dispatch(setValues(res.selectedValues));
16846
+ }
16478
16847
  this.analyticsRef = analyticsRef;
16479
16848
  }
16480
16849
  },
@@ -18413,14 +18782,14 @@
18413
18782
  if (status === STATUS.active) {
18414
18783
  this.status = STATUS.inactive;
18415
18784
  }
18416
- var _this$$props = this.$props,
18417
- handleResult = _this$$props.handleResult,
18418
- onNoMatch = _this$$props.onNoMatch,
18419
- onError = _this$$props.onError,
18420
- lang = _this$$props.lang,
18421
- getInstance = _this$$props.getInstance;
18422
- var _window = window,
18423
- SpeechRecognition = _window.SpeechRecognition;
18785
+ var _this$$props2 = this.$props,
18786
+ handleResult = _this$$props2.handleResult,
18787
+ onNoMatch = _this$$props2.onNoMatch,
18788
+ onError = _this$$props2.onError,
18789
+ lang = _this$$props2.lang,
18790
+ getInstance = _this$$props2.getInstance;
18791
+ var _window2 = window,
18792
+ SpeechRecognition = _window2.SpeechRecognition;
18424
18793
  if (this.instance && this.status !== STATUS.denied) {
18425
18794
  this.status = STATUS.inactive;
18426
18795
  this.instance.stop();
@@ -18691,6 +19060,13 @@
18691
19060
  // Set custom and default queries in store
18692
19061
  this.triggerCustomQuery(this.currentValue, this.selectedCategory);
18693
19062
  this.triggerDefaultQuery(this.currentValue);
19063
+ if (this.selectedValue) {
19064
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
19065
+ } else if (this.$props.value) {
19066
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
19067
+ } else if (this.$props.defaultValue) {
19068
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
19069
+ }
18694
19070
  },
18695
19071
  computed: {
18696
19072
  hasCustomRenderer: function hasCustomRenderer$1() {
@@ -18781,15 +19157,6 @@
18781
19157
  searchboxId: Q.string,
18782
19158
  endpoint: types.endpointConfig
18783
19159
  },
18784
- beforeMount: function beforeMount() {
18785
- if (this.selectedValue) {
18786
- this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
18787
- } else if (this.$props.value) {
18788
- this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
18789
- } else if (this.$props.defaultValue) {
18790
- this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined);
18791
- }
18792
- },
18793
19160
  mounted: function mounted() {
18794
19161
  this.listenForFocusShortcuts();
18795
19162
  },
@@ -19267,12 +19634,12 @@
19267
19634
  renderInputAddonBefore: function renderInputAddonBefore() {
19268
19635
  var addonBefore = this.$slots.addonBefore;
19269
19636
  if (addonBefore) {
19270
- var _slot;
19637
+ var _slot2;
19271
19638
  return vue.createVNode(InputAddon, {
19272
19639
  "class": "addon-before"
19273
- }, _isSlot$5(_slot = addonBefore()) ? _slot : {
19640
+ }, _isSlot$5(_slot2 = addonBefore()) ? _slot2 : {
19274
19641
  "default": function _default() {
19275
- return [_slot];
19642
+ return [_slot2];
19276
19643
  }
19277
19644
  });
19278
19645
  }
@@ -19281,12 +19648,12 @@
19281
19648
  renderInputAddonAfter: function renderInputAddonAfter() {
19282
19649
  var addonAfter = this.$slots.addonAfter;
19283
19650
  if (addonAfter) {
19284
- var _slot2;
19651
+ var _slot4;
19285
19652
  return vue.createVNode(InputAddon, {
19286
19653
  "class": "addon-after"
19287
- }, _isSlot$5(_slot2 = addonAfter()) ? _slot2 : {
19654
+ }, _isSlot$5(_slot4 = addonAfter()) ? _slot4 : {
19288
19655
  "default": function _default() {
19289
- return [_slot2];
19656
+ return [_slot4];
19290
19657
  }
19291
19658
  });
19292
19659
  }
@@ -19328,7 +19695,7 @@
19328
19695
  },
19329
19696
  renderIcons: function renderIcons() {
19330
19697
  var _this6 = this;
19331
- var _slot3, _slot4, _slot5;
19698
+ var _slot5, _slot6, _slot7;
19332
19699
  var _this$$props3 = this.$props,
19333
19700
  iconPosition = _this$$props3.iconPosition,
19334
19701
  showClear = _this$$props3.showClear,
@@ -19347,9 +19714,9 @@
19347
19714
  "onClick": _this6.clearValue,
19348
19715
  "showIcon": showIcon,
19349
19716
  "isClearIcon": true
19350
- }, _isSlot$5(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
19717
+ }, _isSlot$5(_slot5 = _this6.renderCancelIcon()) ? _slot5 : {
19351
19718
  "default": function _default() {
19352
- return [_slot3];
19719
+ return [_slot5];
19353
19720
  }
19354
19721
  }), showVoiceSearch && vue.createVNode(Mic, {
19355
19722
  "getInstance": getMicInstance,
@@ -19358,9 +19725,9 @@
19358
19725
  "className": getClassName$3(innerClass, 'mic') || null
19359
19726
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(IconWrapper, {
19360
19727
  "onClick": _this6.handleSearchIconClick
19361
- }, _isSlot$5(_slot4 = _this6.renderIcon()) ? _slot4 : {
19728
+ }, _isSlot$5(_slot6 = _this6.renderIcon()) ? _slot6 : {
19362
19729
  "default": function _default() {
19363
- return [_slot4];
19730
+ return [_slot6];
19364
19731
  }
19365
19732
  })];
19366
19733
  }
@@ -19371,9 +19738,9 @@
19371
19738
  "default": function _default() {
19372
19739
  return [iconPosition === 'left' && showIcon && vue.createVNode(IconWrapper, {
19373
19740
  "onClick": _this6.handleSearchIconClick
19374
- }, _isSlot$5(_slot5 = _this6.renderIcon()) ? _slot5 : {
19741
+ }, _isSlot$5(_slot7 = _this6.renderIcon()) ? _slot7 : {
19375
19742
  "default": function _default() {
19376
- return [_slot5];
19743
+ return [_slot7];
19377
19744
  }
19378
19745
  })];
19379
19746
  }
@@ -19683,6 +20050,9 @@
19683
20050
  document.removeEventListener('keydown', this.onKeyDown);
19684
20051
  }
19685
20052
  });
20053
+ SearchBox.hasInternalComponent = function () {
20054
+ return true;
20055
+ };
19686
20056
  SearchBox.defaultQuery = function (value, props) {
19687
20057
  var finalQuery = null;
19688
20058
  finalQuery = {
@@ -19741,6 +20111,9 @@
19741
20111
  internalComponent: true
19742
20112
  }));
19743
20113
  SBConnected.name = SearchBox.name;
20114
+ SBConnected.defaultQuery = SearchBox.defaultQuery;
20115
+ SBConnected.shouldQuery = SearchBox.shouldQuery;
20116
+ SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
19744
20117
  SBConnected.install = function (Vue) {
19745
20118
  Vue.component(SBConnected.name, SBConnected);
19746
20119
  };
@@ -19889,8 +20262,6 @@
19889
20262
  // Set custom and default queries in store
19890
20263
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
19891
20264
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
19892
- },
19893
- beforeMount: function beforeMount() {
19894
20265
  this.updateQueryHandlerOptions(this.$props);
19895
20266
  if (this.selectedValue) {
19896
20267
  this.setValue(this.selectedValue);
@@ -20215,13 +20586,15 @@
20215
20586
  internalComponent: SingleList.hasInternalComponent()
20216
20587
  }));
20217
20588
  ListConnected.name = SingleList.name;
20589
+ ListConnected.defaultQuery = SingleList.defaultQuery;
20590
+ ListConnected.generateQueryOptions = SingleList.generateQueryOptions;
20591
+ ListConnected.hasInternalComponent = SingleList.hasInternalComponent;
20592
+ // Add componentType for SSR
20593
+ ListConnected.componentType = constants_1$1.singleList;
20218
20594
  ListConnected.install = function (Vue) {
20219
20595
  Vue.component(ListConnected.name, ListConnected);
20220
20596
  };
20221
20597
 
20222
- // Add componentType for SSR
20223
- ListConnected.componentType = constants_1$1.singleList;
20224
-
20225
20598
  var updateQuery$3 = lib_5.updateQuery,
20226
20599
  setQueryOptions$2 = lib_5.setQueryOptions,
20227
20600
  setCustomQuery$2 = lib_5.setCustomQuery,
@@ -20284,8 +20657,6 @@
20284
20657
  // Set custom and default queries in store
20285
20658
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
20286
20659
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
20287
- },
20288
- beforeMount: function beforeMount() {
20289
20660
  this.updateQueryHandlerOptions(this.$props);
20290
20661
  var value = this.selectedValue || this.$props.value || this.$props.defaultValue;
20291
20662
  this.setValue(value, !this.selectedValue);
@@ -20473,16 +20844,16 @@
20473
20844
  });
20474
20845
  }
20475
20846
  if (selectAllLabel && selectAllLabel in currentValue) {
20476
- var _currentValue = currentValue,
20477
- del = _currentValue[selectAllLabel],
20478
- obj = _objectWithoutPropertiesLoose(_currentValue, [selectAllLabel].map(_toPropertyKey$1));
20847
+ var _currentValue2 = currentValue,
20848
+ del = _currentValue2[selectAllLabel],
20849
+ obj = _objectWithoutPropertiesLoose(_currentValue2, [selectAllLabel].map(_toPropertyKey$1));
20479
20850
  currentValue = _extends({}, obj);
20480
20851
  }
20481
20852
  } else {
20482
20853
  if (currentValue[value]) {
20483
- var _currentValue2 = currentValue,
20484
- _del = _currentValue2[value],
20485
- rest = _objectWithoutPropertiesLoose(_currentValue2, [value].map(_toPropertyKey$1));
20854
+ var _currentValue4 = currentValue,
20855
+ _del = _currentValue4[value],
20856
+ rest = _objectWithoutPropertiesLoose(_currentValue4, [value].map(_toPropertyKey$1));
20486
20857
  currentValue = _extends({}, rest);
20487
20858
  } else if (Array.isArray(value)) {
20488
20859
  value.forEach(function (val) {
@@ -20492,9 +20863,9 @@
20492
20863
  currentValue[value] = true;
20493
20864
  }
20494
20865
  if (selectAllLabel && selectAllLabel in currentValue) {
20495
- var _currentValue3 = currentValue,
20496
- _del2 = _currentValue3[selectAllLabel],
20497
- _obj = _objectWithoutPropertiesLoose(_currentValue3, [selectAllLabel].map(_toPropertyKey$1));
20866
+ var _currentValue6 = currentValue,
20867
+ _del2 = _currentValue6[selectAllLabel],
20868
+ _obj = _objectWithoutPropertiesLoose(_currentValue6, [selectAllLabel].map(_toPropertyKey$1));
20498
20869
  currentValue = _extends({}, _obj);
20499
20870
  }
20500
20871
  finalValues = Object.keys(currentValue);
@@ -20668,13 +21039,15 @@
20668
21039
  internalComponent: MultiList.hasInternalComponent()
20669
21040
  }));
20670
21041
  ListConnected$1.name = MultiList.name;
21042
+ ListConnected$1.defaultQuery = MultiList.defaultQuery;
21043
+ ListConnected$1.generateQueryOptions = MultiList.generateQueryOptions;
21044
+ ListConnected$1.hasInternalComponent = MultiList.hasInternalComponent;
21045
+ // Add componentType for SSR
21046
+ ListConnected$1.componentType = constants_1$1.multiList;
20671
21047
  ListConnected$1.install = function (Vue) {
20672
21048
  Vue.component(ListConnected$1.name, ListConnected$1);
20673
21049
  };
20674
21050
 
20675
- // Add componentType for SSR
20676
- ListConnected$1.componentType = constants_1$1.multiList;
20677
-
20678
21051
  var _templateObject$m, _templateObject2$7;
20679
21052
  var small = "\n\tmin-height: 0;\n\theight: 30px;\n\tborder: 0;\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;\n\tborder-radius: 2px;\n";
20680
21053
  var dark$2 = function dark(_ref) {
@@ -21029,8 +21402,6 @@
21029
21402
  // Set custom and default queries in store
21030
21403
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
21031
21404
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
21032
- },
21033
- beforeMount: function beforeMount() {
21034
21405
  this.updateQueryOptions(this.$props);
21035
21406
  if (this.selectedValue) {
21036
21407
  this.setValue(this.selectedValue);
@@ -21343,14 +21714,16 @@
21343
21714
  componentType: constants_1$1.singleDropdownList,
21344
21715
  internalComponent: SingleDropdownList.hasInternalComponent()
21345
21716
  }));
21717
+ ListConnected$2.defaultQuery = SingleDropdownList.defaultQuery;
21718
+ ListConnected$2.generateQueryOptions = SingleDropdownList.generateQueryOptions;
21719
+ ListConnected$2.hasInternalComponent = SingleDropdownList.hasInternalComponent;
21346
21720
  ListConnected$2.name = SingleDropdownList.name;
21721
+ // Add componentType for SSR
21722
+ ListConnected$2.componentType = constants_1$1.singleDropdownList;
21347
21723
  ListConnected$2.install = function (Vue) {
21348
21724
  Vue.component(ListConnected$2.name, ListConnected$2);
21349
21725
  };
21350
21726
 
21351
- // Add componentType for SSR
21352
- ListConnected$2.componentType = constants_1$1.singleDropdownList;
21353
-
21354
21727
  function _isSlot$7(s) {
21355
21728
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
21356
21729
  }
@@ -21424,8 +21797,6 @@
21424
21797
  // Set custom and default queries in store
21425
21798
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
21426
21799
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
21427
- },
21428
- beforeMount: function beforeMount() {
21429
21800
  this.updateQueryOptions(this.$props);
21430
21801
  if (this.selectedValue) {
21431
21802
  this.setValue(this.selectedValue, true);
@@ -21631,24 +22002,24 @@
21631
22002
  });
21632
22003
  }
21633
22004
  if (selectAllLabel && selectAllLabel in currentValue) {
21634
- var _currentValue = currentValue,
21635
- del = _currentValue[selectAllLabel],
21636
- obj = _objectWithoutPropertiesLoose(_currentValue, [selectAllLabel].map(_toPropertyKey$1));
22005
+ var _currentValue2 = currentValue,
22006
+ del = _currentValue2[selectAllLabel],
22007
+ obj = _objectWithoutPropertiesLoose(_currentValue2, [selectAllLabel].map(_toPropertyKey$1));
21637
22008
  currentValue = _extends({}, obj);
21638
22009
  }
21639
22010
  } else {
21640
22011
  if (currentValue[value]) {
21641
- var _currentValue2 = currentValue,
21642
- _del = _currentValue2[value],
21643
- rest = _objectWithoutPropertiesLoose(_currentValue2, [value].map(_toPropertyKey$1));
22012
+ var _currentValue4 = currentValue,
22013
+ _del = _currentValue4[value],
22014
+ rest = _objectWithoutPropertiesLoose(_currentValue4, [value].map(_toPropertyKey$1));
21644
22015
  currentValue = _extends({}, rest);
21645
22016
  } else {
21646
22017
  currentValue[value] = true;
21647
22018
  }
21648
22019
  if (selectAllLabel && selectAllLabel in currentValue) {
21649
- var _currentValue3 = currentValue,
21650
- _del2 = _currentValue3[selectAllLabel],
21651
- _obj = _objectWithoutPropertiesLoose(_currentValue3, [selectAllLabel].map(_toPropertyKey$1));
22020
+ var _currentValue6 = currentValue,
22021
+ _del2 = _currentValue6[selectAllLabel],
22022
+ _obj = _objectWithoutPropertiesLoose(_currentValue6, [selectAllLabel].map(_toPropertyKey$1));
21652
22023
  currentValue = _extends({}, _obj);
21653
22024
  }
21654
22025
  finalValues = Object.keys(currentValue);
@@ -21799,12 +22170,15 @@
21799
22170
  internalComponent: MultiDropdownList.hasInternalComponent()
21800
22171
  }));
21801
22172
  ListConnected$3.name = MultiDropdownList.name;
21802
- ListConnected$3.install = function (Vue) {
21803
- Vue.component(ListConnected$3.name, ListConnected$3);
21804
- };
21805
22173
 
21806
22174
  // Add componentType for SSR
21807
22175
  ListConnected$3.componentType = constants_1$1.multiDropdownList;
22176
+ ListConnected$3.defaultQuery = MultiDropdownList.defaultQuery;
22177
+ ListConnected$3.generateQueryOptions = MultiDropdownList.generateQueryOptions;
22178
+ ListConnected$3.hasInternalComponent = MultiDropdownList.hasInternalComponent;
22179
+ ListConnected$3.install = function (Vue) {
22180
+ Vue.component(ListConnected$3.name, ListConnected$3);
22181
+ };
21808
22182
 
21809
22183
  var updateQuery$6 = lib_5.updateQuery,
21810
22184
  setQueryOptions$5 = lib_5.setQueryOptions,
@@ -21842,7 +22216,9 @@
21842
22216
  };
21843
22217
  return this.__state;
21844
22218
  },
21845
- beforeMount: function beforeMount() {
22219
+ created: function created() {
22220
+ // Set custom query in store
22221
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
21846
22222
  var props = this.$props;
21847
22223
  var hasMounted = false;
21848
22224
  var value = this.selectedValue || props.value || props.defaultValue || [];
@@ -21852,10 +22228,6 @@
21852
22228
  this.handleToggle(this.$data.currentValue, true, props, hasMounted);
21853
22229
  }
21854
22230
  },
21855
- created: function created() {
21856
- // Set custom query in store
21857
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
21858
- },
21859
22231
  watch: {
21860
22232
  defaultValue: function defaultValue(newVal) {
21861
22233
  this.setValue(ToggleButton.parseValue(newVal, this.$props));
@@ -22081,6 +22453,8 @@
22081
22453
  var TBConnected = PreferencesConsumer(ComponentWrapper$1(connect(mapStateToProps$8, mapDispatchtoProps$6)(ToggleButton), {
22082
22454
  componentType: constants_1$1.toggleButton
22083
22455
  }));
22456
+ TBConnected.parseValue = ToggleButton.parseValue;
22457
+ TBConnected.defaultQuery = ToggleButton.defaultQuery;
22084
22458
  TBConnected.name = ToggleButton.name;
22085
22459
  TBConnected.install = function (Vue) {
22086
22460
  Vue.component(TBConnected.name, TBConnected);
@@ -22123,216 +22497,6 @@
22123
22497
  var _templateObject$o;
22124
22498
  var Slider = styled('div')(_templateObject$o || (_templateObject$o = _taggedTemplateLiteralLoose(["\n\tmargin-top: 30px;\n\tpadding: 10px;\n\n\t/* component style */\n\t.vue-slider-disabled {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n\n\t/* rail style */\n\t.vue-slider-rail {\n\t\tbackground-color: #ccc;\n\t\tborder-radius: 15px;\n\t\theight: 4px;\n\t}\n\n\t/* process style */\n\t.vue-slider-process {\n\t\tbackground-color: #0b6aff;\n\t\tborder-radius: 15px;\n\t}\n\n\t/* mark style */\n\t.vue-slider-mark {\n\t\tz-index: 4;\n\t}\n\n\t.vue-slider-mark:first-child .vue-slider-mark-step,\n\t.vue-slider-mark:last-child .vue-slider-mark-step {\n\t\tdisplay: none;\n\t}\n\n\t.vue-slider-mark-step {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: rgba(0, 0, 0, 0.16);\n\t}\n\n\t.vue-slider-mark-label {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t}\n\n\t/* dot style */\n\t.vue-slider-dot {\n\t\tz-index: 2;\n\t}\n\n\t.vue-slider-dot-handle {\n\t\tcursor: pointer;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: #fff;\n\t\tbox-sizing: border-box;\n\t\tborder: 1px solid #9a9a9a;\n\t\tz-index: 2;\n\t\tbox-shadow: 0.5px 0.5px 2px 1px rgb(0 0 0 / 32%);\n\t}\n\n\t.vue-slider-dot-handle-disabled {\n\t\tcursor: not-allowed;\n\t\tbackground-color: #ccc;\n\t}\n\n\t.vue-slider-dot-tooltip-inner {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t\tpadding: 2px 5px;\n\t\tmin-width: 20px;\n\t\ttext-align: center;\n\t\tcolor: #fff;\n\t\tborder-radius: 5px;\n\t\tborder: 1px solid #3498db;\n\t\tbackground-color: #3498db;\n\t\tbox-sizing: content-box;\n\t}\n\n\t.vue-slider-dot-tooltip-inner::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-top::after {\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-top-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-bottom::after {\n\t\tbottom: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-bottom-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-left::after {\n\t\tleft: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-left-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-right::after {\n\t\tright: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-right-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-wrapper {\n\t\topacity: 0;\n\t\ttransition: all 0.3s;\n\t}\n\t.vue-slider-dot-tooltip-wrapper-show {\n\t\topacity: 1;\n\t}\n\n\t.label-container {\n\t\tmargin: 10px 0;\n\t\twidth: 100%;\n\t}\n\n\t.range-label-right {\n\t\tfloat: right;\n\t}\n"])));
22125
22499
 
22126
- // shim for using process in browser
22127
- // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
22128
-
22129
- function defaultSetTimout() {
22130
- throw new Error('setTimeout has not been defined');
22131
- }
22132
- function defaultClearTimeout() {
22133
- throw new Error('clearTimeout has not been defined');
22134
- }
22135
- var cachedSetTimeout = defaultSetTimout;
22136
- var cachedClearTimeout = defaultClearTimeout;
22137
- if (typeof global$1.setTimeout === 'function') {
22138
- cachedSetTimeout = setTimeout;
22139
- }
22140
- if (typeof global$1.clearTimeout === 'function') {
22141
- cachedClearTimeout = clearTimeout;
22142
- }
22143
- function runTimeout(fun) {
22144
- if (cachedSetTimeout === setTimeout) {
22145
- //normal enviroments in sane situations
22146
- return setTimeout(fun, 0);
22147
- }
22148
- // if setTimeout wasn't available but was latter defined
22149
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
22150
- cachedSetTimeout = setTimeout;
22151
- return setTimeout(fun, 0);
22152
- }
22153
- try {
22154
- // when when somebody has screwed with setTimeout but no I.E. maddness
22155
- return cachedSetTimeout(fun, 0);
22156
- } catch (e) {
22157
- try {
22158
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
22159
- return cachedSetTimeout.call(null, fun, 0);
22160
- } catch (e) {
22161
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
22162
- return cachedSetTimeout.call(this, fun, 0);
22163
- }
22164
- }
22165
- }
22166
- function runClearTimeout(marker) {
22167
- if (cachedClearTimeout === clearTimeout) {
22168
- //normal enviroments in sane situations
22169
- return clearTimeout(marker);
22170
- }
22171
- // if clearTimeout wasn't available but was latter defined
22172
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
22173
- cachedClearTimeout = clearTimeout;
22174
- return clearTimeout(marker);
22175
- }
22176
- try {
22177
- // when when somebody has screwed with setTimeout but no I.E. maddness
22178
- return cachedClearTimeout(marker);
22179
- } catch (e) {
22180
- try {
22181
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
22182
- return cachedClearTimeout.call(null, marker);
22183
- } catch (e) {
22184
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
22185
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
22186
- return cachedClearTimeout.call(this, marker);
22187
- }
22188
- }
22189
- }
22190
- var queue = [];
22191
- var draining = false;
22192
- var currentQueue;
22193
- var queueIndex = -1;
22194
- function cleanUpNextTick() {
22195
- if (!draining || !currentQueue) {
22196
- return;
22197
- }
22198
- draining = false;
22199
- if (currentQueue.length) {
22200
- queue = currentQueue.concat(queue);
22201
- } else {
22202
- queueIndex = -1;
22203
- }
22204
- if (queue.length) {
22205
- drainQueue();
22206
- }
22207
- }
22208
- function drainQueue() {
22209
- if (draining) {
22210
- return;
22211
- }
22212
- var timeout = runTimeout(cleanUpNextTick);
22213
- draining = true;
22214
- var len = queue.length;
22215
- while (len) {
22216
- currentQueue = queue;
22217
- queue = [];
22218
- while (++queueIndex < len) {
22219
- if (currentQueue) {
22220
- currentQueue[queueIndex].run();
22221
- }
22222
- }
22223
- queueIndex = -1;
22224
- len = queue.length;
22225
- }
22226
- currentQueue = null;
22227
- draining = false;
22228
- runClearTimeout(timeout);
22229
- }
22230
- function nextTick(fun) {
22231
- var args = new Array(arguments.length - 1);
22232
- if (arguments.length > 1) {
22233
- for (var i = 1; i < arguments.length; i++) {
22234
- args[i - 1] = arguments[i];
22235
- }
22236
- }
22237
- queue.push(new Item(fun, args));
22238
- if (queue.length === 1 && !draining) {
22239
- runTimeout(drainQueue);
22240
- }
22241
- }
22242
- // v8 likes predictible objects
22243
- function Item(fun, array) {
22244
- this.fun = fun;
22245
- this.array = array;
22246
- }
22247
- Item.prototype.run = function () {
22248
- this.fun.apply(null, this.array);
22249
- };
22250
- var title = 'browser';
22251
- var platform = 'browser';
22252
- var browser = true;
22253
- var env = {};
22254
- var argv = [];
22255
- var version = ''; // empty string to avoid regexp issues
22256
- var versions = {};
22257
- var release = {};
22258
- var config = {};
22259
- function noop() {}
22260
- var on = noop;
22261
- var addListener = noop;
22262
- var once = noop;
22263
- var off = noop;
22264
- var removeListener = noop;
22265
- var removeAllListeners = noop;
22266
- var emit = noop;
22267
- function binding(name) {
22268
- throw new Error('process.binding is not supported');
22269
- }
22270
- function cwd() {
22271
- return '/';
22272
- }
22273
- function chdir(dir) {
22274
- throw new Error('process.chdir is not supported');
22275
- }
22276
- function umask() {
22277
- return 0;
22278
- }
22279
-
22280
- // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
22281
- var performance = global$1.performance || {};
22282
- var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () {
22283
- return new Date().getTime();
22284
- };
22285
-
22286
- // generate timestamp or delta
22287
- // see http://nodejs.org/api/process.html#process_process_hrtime
22288
- function hrtime(previousTimestamp) {
22289
- var clocktime = performanceNow.call(performance) * 1e-3;
22290
- var seconds = Math.floor(clocktime);
22291
- var nanoseconds = Math.floor(clocktime % 1 * 1e9);
22292
- if (previousTimestamp) {
22293
- seconds = seconds - previousTimestamp[0];
22294
- nanoseconds = nanoseconds - previousTimestamp[1];
22295
- if (nanoseconds < 0) {
22296
- seconds--;
22297
- nanoseconds += 1e9;
22298
- }
22299
- }
22300
- return [seconds, nanoseconds];
22301
- }
22302
- var startTime = new Date();
22303
- function uptime() {
22304
- var currentTime = new Date();
22305
- var dif = currentTime - startTime;
22306
- return dif / 1000;
22307
- }
22308
- var process = {
22309
- nextTick: nextTick,
22310
- title: title,
22311
- browser: browser,
22312
- env: env,
22313
- argv: argv,
22314
- version: version,
22315
- versions: versions,
22316
- on: on,
22317
- addListener: addListener,
22318
- once: once,
22319
- off: off,
22320
- removeListener: removeListener,
22321
- removeAllListeners: removeAllListeners,
22322
- emit: emit,
22323
- binding: binding,
22324
- cwd: cwd,
22325
- chdir: chdir,
22326
- umask: umask,
22327
- hrtime: hrtime,
22328
- platform: platform,
22329
- release: release,
22330
- config: config,
22331
- uptime: uptime
22332
- };
22333
-
22334
- var browser$1 = true;
22335
-
22336
22500
  /**
22337
22501
  * Caution: Please do not change this file without having a discussion with the Team.
22338
22502
  * Any change may break the umd build, we're directly replacing the line no: 14
@@ -22351,8 +22515,8 @@
22351
22515
  var components = {
22352
22516
  NoSSR: NoSSR
22353
22517
  };
22354
- if (process && browser$1) {
22355
- try {
22518
+ try {
22519
+ if (typeof window !== 'undefined') {
22356
22520
  // in older versions of nuxt, it's process.BROWSER_BUILD
22357
22521
  // eslint-disable-next-line
22358
22522
 
@@ -22364,9 +22528,9 @@
22364
22528
  };
22365
22529
  document.head.appendChild(s);
22366
22530
 
22367
- } catch (e) {
22368
- console.error('Unable to load vue-slider', e);
22369
22531
  }
22532
+ } catch (e) {
22533
+ console.error('Unable to load vue-slider', e);
22370
22534
  }
22371
22535
  return components;
22372
22536
  };
@@ -22422,25 +22586,6 @@
22422
22586
  created: function created() {
22423
22587
  var _this = this;
22424
22588
  this.$timestamp = new Date().getTime();
22425
- var onQueryChange = function onQueryChange() {
22426
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22427
- args[_key] = arguments[_key];
22428
- }
22429
- _this.$emit.apply(_this, ['queryChange'].concat(args));
22430
- _this.$emit.apply(_this, ['query-change'].concat(args));
22431
- };
22432
- this.setQueryListener(this.$props.componentId, onQueryChange, null);
22433
- // Update props in store
22434
- this.setComponentProps(this.componentId, this.$props, constants_1$1.dynamicRangeSlider);
22435
- this.setComponentProps(this.internalRangeComponent, this.$props, constants_1$1.dynamicRangeSlider);
22436
-
22437
- // Set custom query in store
22438
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
22439
- },
22440
- mounted: function mounted() {
22441
- this.setReact();
22442
- },
22443
- beforeMount: function beforeMount() {
22444
22589
  var components = [];
22445
22590
  if (this.$$store) {
22446
22591
  var _this$$$store$getStat = this.$$store.getState();
@@ -22461,6 +22606,24 @@
22461
22606
  // get range before executing other queries
22462
22607
  this.updateRangeQueryOptions();
22463
22608
  }
22609
+ var onQueryChange = function onQueryChange() {
22610
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22611
+ args[_key] = arguments[_key];
22612
+ }
22613
+ _this.$emit.apply(_this, ['queryChange'].concat(args));
22614
+ _this.$emit.apply(_this, ['query-change'].concat(args));
22615
+ };
22616
+ this.setQueryListener(this.$props.componentId, onQueryChange, null);
22617
+ // Update props in store
22618
+ this.setComponentProps(this.componentId, this.$props, constants_1$1.dynamicRangeSlider);
22619
+ this.setComponentProps(this.internalRangeComponent, this.$props, constants_1$1.dynamicRangeSlider);
22620
+
22621
+ // Set custom query in store
22622
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
22623
+ this.setReact(false);
22624
+ },
22625
+ mounted: function mounted() {
22626
+ this.setReact(true);
22464
22627
  },
22465
22628
  beforeUpdate: function beforeUpdate() {
22466
22629
  if (!this.currentValue) {
@@ -22484,9 +22647,9 @@
22484
22647
  var start = _ref.start,
22485
22648
  end = _ref.end;
22486
22649
  if (this.$props.defaultValue) {
22487
- var _this$$props$defaultV = this.$props.defaultValue(start, end),
22488
- defaultStart = _this$$props$defaultV.start,
22489
- defaultEnd = _this$$props$defaultV.end;
22650
+ var _this$$props$defaultV2 = this.$props.defaultValue(start, end),
22651
+ defaultStart = _this$$props$defaultV2.start,
22652
+ defaultEnd = _this$$props$defaultV2.end;
22490
22653
  this.handleChange([defaultStart, defaultEnd]);
22491
22654
  } else if (this.isControlled()) {
22492
22655
  this.handleChange(DynamicRangeSlider.parseValue(this.$props.value), 'change');
@@ -22494,13 +22657,13 @@
22494
22657
  this.currentValue = [start, end];
22495
22658
  }
22496
22659
  },
22497
- setReact: function setReact() {
22660
+ setReact: function setReact(shouldExecute) {
22498
22661
  if (this.$props.react) {
22499
- this.watchComponent(this.internalRangeComponent, this.$props.react);
22500
- this.watchComponent(this.$props.componentId, this.$props.react);
22662
+ this.watchComponent(this.internalRangeComponent, this.$props.react, shouldExecute);
22663
+ this.watchComponent(this.$props.componentId, this.$props.react, shouldExecute);
22501
22664
  } else {
22502
- this.watchComponent(this.internalRangeComponent, {});
22503
- this.watchComponent(this.$props.componentId, {});
22665
+ this.watchComponent(this.internalRangeComponent, {}, shouldExecute);
22666
+ this.watchComponent(this.$props.componentId, {}, shouldExecute);
22504
22667
  }
22505
22668
  },
22506
22669
  rangeQuery: function rangeQuery() {
@@ -22758,13 +22921,16 @@
22758
22921
  updateComponentProps: updateComponentProps$2
22759
22922
  };
22760
22923
  var RangeConnected = PreferencesConsumer(connect(mapStateToProps$9, mapDispatchtoProps$7)(DynamicRangeSlider));
22924
+ RangeConnected.defaultQuery = DynamicRangeSlider.defaultQuery;
22925
+ RangeConnected.parseValue = DynamicRangeSlider.parseValue;
22926
+ RangeConnected.hasInternalComponent = DynamicRangeSlider.hasInternalComponent;
22761
22927
  RangeConnected.name = DynamicRangeSlider.name;
22762
- RangeConnected.install = function (Vue) {
22763
- Vue.component(RangeConnected.name, RangeConnected);
22764
- };
22765
22928
 
22766
22929
  // Add componentType for SSR
22767
22930
  RangeConnected.componentType = constants_1$1.dynamicRangeSlider;
22931
+ RangeConnected.install = function (Vue) {
22932
+ Vue.component(RangeConnected.name, RangeConnected);
22933
+ };
22768
22934
 
22769
22935
  function _isSlot$8(s) {
22770
22936
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
@@ -22808,8 +22974,6 @@
22808
22974
  created: function created() {
22809
22975
  // Set custom query in store
22810
22976
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
22811
- },
22812
- beforeMount: function beforeMount() {
22813
22977
  if (this.selectedValue) {
22814
22978
  this.setValue(this.selectedValue);
22815
22979
  } else if (this.$props.value) {
@@ -22958,6 +23122,9 @@
22958
23122
  componentType: constants_1$1.singleRange
22959
23123
  }));
22960
23124
  RangeConnected$1.name = SingleRange.name;
23125
+ RangeConnected$1.defaultQuery = SingleRange.defaultQuery;
23126
+ RangeConnected$1.parseValue = SingleRange.parseValue;
23127
+ RangeConnected$1.hasInternalComponent = SingleRange.hasInternalComponent;
22961
23128
  RangeConnected$1.install = function (Vue) {
22962
23129
  Vue.component(RangeConnected$1.name, RangeConnected$1);
22963
23130
  };
@@ -23046,9 +23213,9 @@
23046
23213
  currentValue = currentValue.filter(function (value) {
23047
23214
  return value.label !== item;
23048
23215
  });
23049
- var _selectedValues = selectedValues,
23050
- del = _selectedValues[item],
23051
- selected = _objectWithoutPropertiesLoose(_selectedValues, [item].map(_toPropertyKey$1));
23216
+ var _selectedValues2 = selectedValues,
23217
+ del = _selectedValues2[item],
23218
+ selected = _objectWithoutPropertiesLoose(_selectedValues2, [item].map(_toPropertyKey$1));
23052
23219
  selectedValues = selected;
23053
23220
  } else {
23054
23221
  var _extends2;
@@ -23120,8 +23287,6 @@
23120
23287
  created: function created() {
23121
23288
  // Set custom query in store
23122
23289
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
23123
- },
23124
- beforeMount: function beforeMount() {
23125
23290
  if (this.selectedValue) {
23126
23291
  this.selectItem(this.selectedValue, true);
23127
23292
  } else if (this.$props.value) {
@@ -23203,6 +23368,9 @@
23203
23368
  componentType: constants_1$1.multiRange
23204
23369
  }));
23205
23370
  RangeConnected$2.name = MultiRange.name;
23371
+ RangeConnected$2.defaultQuery = MultiRange.defaultQuery;
23372
+ RangeConnected$2.parseValue = MultiRange.parseValue;
23373
+ RangeConnected$2.hasInternalComponent = MultiRange.hasInternalComponent;
23206
23374
  RangeConnected$2.install = function (Vue) {
23207
23375
  Vue.component(RangeConnected$2.name, RangeConnected$2);
23208
23376
  };
@@ -23352,8 +23520,6 @@
23352
23520
 
23353
23521
  // Set custom query in store
23354
23522
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
23355
- },
23356
- beforeMount: function beforeMount() {
23357
23523
  var _this$$props = this.$props,
23358
23524
  value = _this$$props.value,
23359
23525
  defaultValue = _this$$props.defaultValue;
@@ -23449,6 +23615,9 @@
23449
23615
  componentType: constants_1$1.rangeSlider
23450
23616
  }));
23451
23617
  RangeConnected$3.name = RangeSlider.name;
23618
+ RangeConnected$3.defaultQuery = RangeSlider.defaultQuery;
23619
+ RangeConnected$3.parseValue = RangeSlider.parseValue;
23620
+ RangeConnected$3.hasInternalComponent = RangeSlider.hasInternalComponent;
23452
23621
  RangeConnected$3.install = function (Vue) {
23453
23622
  Vue.component(RangeConnected$3.name, RangeConnected$3);
23454
23623
  };
@@ -24086,13 +24255,13 @@
24086
24255
  }
24087
24256
  });
24088
24257
  RcConnected.name = ReactiveComponent.name;
24258
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
24259
+ // Add componentType for SSR
24260
+ RcConnected.componentType = constants_1$1.reactiveComponent;
24089
24261
  RcConnected.install = function (Vue) {
24090
24262
  Vue.component(RcConnected.name, RcConnected);
24091
24263
  };
24092
24264
 
24093
- // Add componentType for SSR
24094
- RcConnected.componentType = constants_1$1.reactiveComponent;
24095
-
24096
24265
  var setValue$2 = lib_5.setValue,
24097
24266
  clearValues = lib_5.clearValues,
24098
24267
  resetValuesToDefault = lib_5.resetValuesToDefault;
@@ -26528,13 +26697,13 @@
26528
26697
  var map = this.getMap();
26529
26698
  if (map instanceof google.maps.Map && this.getProjection()) {
26530
26699
  google.maps.event.trigger(this, MarkerClustererEvents.CLUSTERING_BEGIN, this);
26531
- var _this$algorithm$calcu = this.algorithm.calculate({
26700
+ var _this$algorithm$calcu2 = this.algorithm.calculate({
26532
26701
  markers: this.markers,
26533
26702
  map: map,
26534
26703
  mapCanvasProjection: this.getProjection()
26535
26704
  }),
26536
- clusters = _this$algorithm$calcu.clusters,
26537
- changed = _this$algorithm$calcu.changed;
26705
+ clusters = _this$algorithm$calcu2.clusters,
26706
+ changed = _this$algorithm$calcu2.changed;
26538
26707
  // allow algorithms to return flag on whether the clusters/markers have changed
26539
26708
  if (changed || changed == undefined) {
26540
26709
  // reset visibility of markers and clusters
@@ -27892,9 +28061,9 @@
27892
28061
  var options = getQueryOptions$5(this.$props);
27893
28062
  options.from = 0;
27894
28063
  this.$defaultQuery = newVal(null, this.$props);
27895
- var _ref = this.$defaultQuery || {},
27896
- sort = _ref.sort,
27897
- query = _ref.query;
28064
+ var _ref2 = this.$defaultQuery || {},
28065
+ sort = _ref2.sort,
28066
+ query = _ref2.query;
27898
28067
  if (sort) {
27899
28068
  options.sort = this.$defaultQuery.sort;
27900
28069
  }
@@ -28277,8 +28446,8 @@
28277
28446
  geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
28278
28447
  };
28279
28448
  if (this.$defaultQuery) {
28280
- var _ref2 = this.$defaultQuery || {},
28281
- query = _ref2.query;
28449
+ var _ref4 = this.$defaultQuery || {},
28450
+ query = _ref4.query;
28282
28451
  if (query) {
28283
28452
  // adds defaultQuery's query to geo-query
28284
28453
  // to generate a map query
@@ -28321,8 +28490,8 @@
28321
28490
  triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
28322
28491
  var docId = documentId;
28323
28492
  if (!docId) {
28324
- var _this$getData2 = this.getData(),
28325
- data = _this$getData2.data;
28493
+ var _this$getData3 = this.getData(),
28494
+ data = _this$getData3.data;
28326
28495
  var hitData = data.find(function (hit) {
28327
28496
  return hit._click_id === searchPosition;
28328
28497
  });
@@ -28413,10 +28582,10 @@
28413
28582
  var options = getQueryOptions$5(this.$props);
28414
28583
  options.from = this.$data.from;
28415
28584
  if (this.$props.sortBy) {
28416
- var _ref3;
28417
- options.sort = [(_ref3 = {}, _ref3[this.$props.dataField] = {
28585
+ var _ref5;
28586
+ options.sort = [(_ref5 = {}, _ref5[this.$props.dataField] = {
28418
28587
  order: this.$props.sortBy
28419
- }, _ref3)];
28588
+ }, _ref5)];
28420
28589
  }
28421
28590
  this.$defaultQuery = null;
28422
28591
  if (this.$props.defaultQuery) {
@@ -29856,506 +30025,1837 @@
29856
30025
  // Add componentType for SSR
29857
30026
  ReactiveGoogleMap.componentType = constants_1$1.reactiveMap;
29858
30027
 
29859
- var graphQL = createCommonjsModule(function (module, exports) {
29860
- Object.defineProperty(exports, "__esModule", {
29861
- value: true
29862
- });
29863
- var _extends = Object.assign || function (target) {
29864
- for (var i = 1; i < arguments.length; i++) {
29865
- var source = arguments[i];
29866
- for (var key in source) {
29867
- if (Object.prototype.hasOwnProperty.call(source, key)) {
29868
- target[key] = source[key];
30028
+ var _PatchFlagNames, _slotFlagsText;
30029
+ /**
30030
+ * Make a map and return a function for checking if a key
30031
+ * is in that map.
30032
+ * IMPORTANT: all calls of this function must be prefixed with
30033
+ * \/\*#\_\_PURE\_\_\*\/
30034
+ * So that rollup can tree-shake them if necessary.
30035
+ */
30036
+ function makeMap(str, expectsLowerCase) {
30037
+ var map = Object.create(null);
30038
+ var list = str.split(',');
30039
+ for (var i = 0; i < list.length; i++) {
30040
+ map[list[i]] = true;
30041
+ }
30042
+ return expectsLowerCase ? function (val) {
30043
+ return !!map[val.toLowerCase()];
30044
+ } : function (val) {
30045
+ return !!map[val];
30046
+ };
30047
+ }
30048
+
30049
+ /**
30050
+ * dev only flag -> name mapping
30051
+ */
30052
+ var PatchFlagNames = (_PatchFlagNames = {}, _PatchFlagNames[1 /* PatchFlags.TEXT */] = "TEXT", _PatchFlagNames[2 /* PatchFlags.CLASS */] = "CLASS", _PatchFlagNames[4 /* PatchFlags.STYLE */] = "STYLE", _PatchFlagNames[8 /* PatchFlags.PROPS */] = "PROPS", _PatchFlagNames[16 /* PatchFlags.FULL_PROPS */] = "FULL_PROPS", _PatchFlagNames[32 /* PatchFlags.HYDRATE_EVENTS */] = "HYDRATE_EVENTS", _PatchFlagNames[64 /* PatchFlags.STABLE_FRAGMENT */] = "STABLE_FRAGMENT", _PatchFlagNames[128 /* PatchFlags.KEYED_FRAGMENT */] = "KEYED_FRAGMENT", _PatchFlagNames[256 /* PatchFlags.UNKEYED_FRAGMENT */] = "UNKEYED_FRAGMENT", _PatchFlagNames[512 /* PatchFlags.NEED_PATCH */] = "NEED_PATCH", _PatchFlagNames[1024 /* PatchFlags.DYNAMIC_SLOTS */] = "DYNAMIC_SLOTS", _PatchFlagNames[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */] = "DEV_ROOT_FRAGMENT", _PatchFlagNames[-1 /* PatchFlags.HOISTED */] = "HOISTED", _PatchFlagNames[-2 /* PatchFlags.BAIL */] = "BAIL", _PatchFlagNames);
30053
+
30054
+ /**
30055
+ * Dev only
30056
+ */
30057
+ var slotFlagsText = (_slotFlagsText = {}, _slotFlagsText[1 /* SlotFlags.STABLE */] = 'STABLE', _slotFlagsText[2 /* SlotFlags.DYNAMIC */] = 'DYNAMIC', _slotFlagsText[3 /* SlotFlags.FORWARDED */] = 'FORWARDED', _slotFlagsText);
30058
+ function normalizeStyle(value) {
30059
+ if (isArray(value)) {
30060
+ var res = {};
30061
+ for (var i = 0; i < value.length; i++) {
30062
+ var item = value[i];
30063
+ var normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
30064
+ if (normalized) {
30065
+ for (var key in normalized) {
30066
+ res[key] = normalized[key];
29869
30067
  }
29870
30068
  }
29871
30069
  }
29872
- return target;
29873
- };
29874
- var _crossFetch2 = _interopRequireDefault(browserPonyfill);
29875
- function _interopRequireDefault(obj) {
29876
- return obj && obj.__esModule ? obj : {
29877
- "default": obj
29878
- };
30070
+ return res;
30071
+ } else if (isString(value)) {
30072
+ return value;
30073
+ } else if (isObject$1(value)) {
30074
+ return value;
29879
30075
  }
29880
- var fetchGraphQL = function fetchGraphQL(requestOptions) {
29881
- var graphQLUrl = requestOptions.graphQLUrl,
29882
- url = requestOptions.url,
29883
- credentials = requestOptions.credentials,
29884
- app = requestOptions.app,
29885
- query = requestOptions.query,
29886
- headers = requestOptions.headers;
29887
- var fetchUrl = credentials ? url.replace('//', '//' + credentials + '@') : url;
29888
- return (0, _crossFetch2["default"])(graphQLUrl, {
29889
- method: 'POST',
29890
- body: '\n\t\t\tquery{\n\t\t\t\telastic77(host: "' + fetchUrl + '"){\n\t\t\t\t\tmsearch(\n\t\t\t\t\t\tindex: "' + app + '"\n\t\t\t\t\t\tbody: ' + JSON.stringify(query.map(function (item) {
29891
- return JSON.stringify(item);
29892
- })) + '\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t',
29893
- headers: _extends({}, headers, {
29894
- 'Content-Type': 'application/graphql'
29895
- })
29896
- }).then(function (res) {
29897
- return res.json();
29898
- }).then(function (jsonRes) {
29899
- return jsonRes.data.elastic77.msearch;
29900
- })["catch"](function (error) {
29901
- console.error(error);
29902
- });
30076
+ }
30077
+ var listDelimiterRE = /;(?![^(]*\))/g;
30078
+ var propertyDelimiterRE = /:([^]+)/;
30079
+ var styleCommentRE = /\/\*[\s\S]*?\*\//g;
30080
+ function parseStringStyle(cssText) {
30081
+ var ret = {};
30082
+ cssText.replace(styleCommentRE, '').split(listDelimiterRE).forEach(function (item) {
30083
+ if (item) {
30084
+ var tmp = item.split(propertyDelimiterRE);
30085
+ tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
30086
+ }
30087
+ });
30088
+ return ret;
30089
+ }
30090
+ function stringifyStyle(styles) {
30091
+ var ret = '';
30092
+ if (!styles || isString(styles)) {
30093
+ return ret;
30094
+ }
30095
+ for (var key in styles) {
30096
+ var value = styles[key];
30097
+ var normalizedKey = key.startsWith("--") ? key : hyphenate(key);
30098
+ if (isString(value) || typeof value === 'number') {
30099
+ // only render valid values
30100
+ ret += normalizedKey + ":" + value + ";";
30101
+ }
30102
+ }
30103
+ return ret;
30104
+ }
30105
+ function normalizeClass(value) {
30106
+ var res = '';
30107
+ if (isString(value)) {
30108
+ res = value;
30109
+ } else if (isArray(value)) {
30110
+ for (var i = 0; i < value.length; i++) {
30111
+ var normalized = normalizeClass(value[i]);
30112
+ if (normalized) {
30113
+ res += normalized + ' ';
30114
+ }
30115
+ }
30116
+ } else if (isObject$1(value)) {
30117
+ for (var name in value) {
30118
+ if (value[name]) {
30119
+ res += name + ' ';
30120
+ }
30121
+ }
30122
+ }
30123
+ return res.trim();
30124
+ }
30125
+ // https://developer.mozilla.org/en-US/docs/Web/SVG/Element
30126
+ var SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' + 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' + 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' + 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' + 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' + 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' + 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' + 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' + 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' + 'text,textPath,title,tspan,unknown,use,view';
30127
+ var VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
30128
+ /**
30129
+ * Compiler only.
30130
+ * Do NOT use in runtime code paths unless behind `("development" !== 'production')` flag.
30131
+ */
30132
+ var isSVGTag = /*#__PURE__*/makeMap(SVG_TAGS);
30133
+ /**
30134
+ * Compiler only.
30135
+ * Do NOT use in runtime code paths unless behind `("development" !== 'production')` flag.
30136
+ */
30137
+ var isVoidTag = /*#__PURE__*/makeMap(VOID_TAGS);
30138
+
30139
+ /**
30140
+ * On the client we only need to offer special cases for boolean attributes that
30141
+ * have different names from their corresponding dom properties:
30142
+ * - itemscope -> N/A
30143
+ * - allowfullscreen -> allowFullscreen
30144
+ * - formnovalidate -> formNoValidate
30145
+ * - ismap -> isMap
30146
+ * - nomodule -> noModule
30147
+ * - novalidate -> noValidate
30148
+ * - readonly -> readOnly
30149
+ */
30150
+ var specialBooleanAttrs = "itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";
30151
+ /**
30152
+ * The full list is needed during SSR to produce the correct initial markup.
30153
+ */
30154
+ var isBooleanAttr = /*#__PURE__*/makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden," + "loop,open,required,reversed,scoped,seamless," + "checked,muted,multiple,selected");
30155
+ /**
30156
+ * Boolean attributes should be included if the value is truthy or ''.
30157
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
30158
+ */
30159
+ function includeBooleanAttr(value) {
30160
+ return !!value || value === '';
30161
+ }
30162
+ var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
30163
+ var attrValidationCache = {};
30164
+ function isSSRSafeAttrName(name) {
30165
+ if (attrValidationCache.hasOwnProperty(name)) {
30166
+ return attrValidationCache[name];
30167
+ }
30168
+ var isUnsafe = unsafeAttrCharRE.test(name);
30169
+ if (isUnsafe) {
30170
+ console.error("unsafe attribute name: " + name);
30171
+ }
30172
+ return attrValidationCache[name] = !isUnsafe;
30173
+ }
30174
+ var propsToAttrMap = {
30175
+ acceptCharset: 'accept-charset',
30176
+ className: 'class',
30177
+ htmlFor: 'for',
30178
+ httpEquiv: 'http-equiv'
30179
+ };
30180
+ var escapeRE = /["'&<>]/;
30181
+ function escapeHtml(string) {
30182
+ var str = '' + string;
30183
+ var match = escapeRE.exec(str);
30184
+ if (!match) {
30185
+ return str;
30186
+ }
30187
+ var html = '';
30188
+ var escaped;
30189
+ var index;
30190
+ var lastIndex = 0;
30191
+ for (index = match.index; index < str.length; index++) {
30192
+ switch (str.charCodeAt(index)) {
30193
+ case 34:
30194
+ // "
30195
+ escaped = '&quot;';
30196
+ break;
30197
+ case 38:
30198
+ // &
30199
+ escaped = '&amp;';
30200
+ break;
30201
+ case 39:
30202
+ // '
30203
+ escaped = '&#39;';
30204
+ break;
30205
+ case 60:
30206
+ // <
30207
+ escaped = '&lt;';
30208
+ break;
30209
+ case 62:
30210
+ // >
30211
+ escaped = '&gt;';
30212
+ break;
30213
+ default:
30214
+ continue;
30215
+ }
30216
+ if (lastIndex !== index) {
30217
+ html += str.slice(lastIndex, index);
30218
+ }
30219
+ lastIndex = index + 1;
30220
+ html += escaped;
30221
+ }
30222
+ return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
30223
+ }
30224
+ // https://www.w3.org/TR/html52/syntax.html#comments
30225
+ var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
30226
+ function escapeHtmlComment(src) {
30227
+ return src.replace(commentStripRE, '');
30228
+ }
30229
+ var EMPTY_OBJ = Object.freeze({}) ;
30230
+ var EMPTY_ARR = Object.freeze([]) ;
30231
+ var NOOP = function NOOP() {};
30232
+ var onRE = /^on[^a-z]/;
30233
+ var isOn = function isOn(key) {
30234
+ return onRE.test(key);
30235
+ };
30236
+ var isArray = Array.isArray;
30237
+ var isFunction$1 = function isFunction(val) {
30238
+ return typeof val === 'function';
30239
+ };
30240
+ var isString = function isString(val) {
30241
+ return typeof val === 'string';
30242
+ };
30243
+ var isObject$1 = function isObject(val) {
30244
+ return val !== null && typeof val === 'object';
30245
+ };
30246
+ var isPromise = function isPromise(val) {
30247
+ return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val["catch"]);
30248
+ };
30249
+ var cacheStringFunction = function cacheStringFunction(fn) {
30250
+ var cache = Object.create(null);
30251
+ return function (str) {
30252
+ var hit = cache[str];
30253
+ return hit || (cache[str] = fn(str));
29903
30254
  };
29904
- exports["default"] = fetchGraphQL;
30255
+ };
30256
+ var hyphenateRE = /\B([A-Z])/g;
30257
+ /**
30258
+ * @private
30259
+ */
30260
+ var hyphenate = cacheStringFunction(function (str) {
30261
+ return str.replace(hyphenateRE, '-$1').toLowerCase();
29905
30262
  });
29906
- var fetchGraphQL = unwrapExports(graphQL);
29907
30263
 
29908
- var _excluded$a = ["aggs", "size"],
29909
- _excluded2 = ["query"],
29910
- _excluded3 = ["query"];
29911
- var _componentTypeToDefau;
29912
- var X_SEARCH_CLIENT$1 = 'ReactiveSearch Vue';
29913
- var componentsWithoutFilters = [constants_1$1.numberBox, constants_1$1.ratingsFilter];
29914
- var resultComponents = [constants_1$1.reactiveList, constants_1$1.reactiveMap];
29915
- var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[constants_1$1.singleList] = '', _componentTypeToDefau[constants_1$1.multiList] = [], _componentTypeToDefau[constants_1$1.singleDataList] = '', _componentTypeToDefau[constants_1$1.singleDropdownList] = '', _componentTypeToDefau[constants_1$1.multiDataList] = [], _componentTypeToDefau[constants_1$1.multiDropdownList] = [], _componentTypeToDefau[constants_1$1.tagCloud] = '', _componentTypeToDefau[constants_1$1.toggleButton] = '', _componentTypeToDefau[constants_1$1.singleDropdownRange] = '', _componentTypeToDefau[constants_1$1.multiDropdownRange] = [], _componentTypeToDefau[constants_1$1.singleRange] = '', _componentTypeToDefau[constants_1$1.multiRange] = [], _componentTypeToDefau);
29916
- function getValue(state, id, defaultValue, componentType) {
29917
- if (state && state[id]) {
29918
- try {
29919
- // parsing for next.js - since it uses extra set of quotes to wrap params
29920
- var parsedValue = JSON.parse(state[id]);
29921
- return {
29922
- value: parsedValue,
29923
- reference: 'URL'
29924
- };
29925
- } catch (error) {
29926
- // using react-dom-server for ssr
29927
- return {
29928
- value: state[id],
29929
- reference: 'URL'
29930
- };
30264
+ var _ErrorTypeStrings;
30265
+
30266
+ // leading comma for empty string ""
30267
+ var shouldIgnoreProp = makeMap(",key,ref,innerHTML,textContent,ref_key,ref_for");
30268
+ function ssrRenderAttrs(props, tag) {
30269
+ var ret = '';
30270
+ for (var key in props) {
30271
+ if (shouldIgnoreProp(key) || isOn(key) || tag === 'textarea' && key === 'value') {
30272
+ continue;
30273
+ }
30274
+ var value = props[key];
30275
+ if (key === 'class') {
30276
+ ret += " class=\"" + ssrRenderClass(value) + "\"";
30277
+ } else if (key === 'style') {
30278
+ ret += " style=\"" + ssrRenderStyle(value) + "\"";
30279
+ } else {
30280
+ ret += ssrRenderDynamicAttr(key, value, tag);
29931
30281
  }
29932
30282
  }
29933
- return {
29934
- value: defaultValue || componentTypeToDefaultValue[componentType] || null,
29935
- reference: 'DEFAULT'
29936
- };
30283
+ return ret;
29937
30284
  }
29938
- function parseValue(value, component) {
29939
- if (component.source && component.source.parseValue) {
29940
- return component.source.parseValue(value, component);
30285
+ // render an attr with dynamic (unknown) key.
30286
+ function ssrRenderDynamicAttr(key, value, tag) {
30287
+ if (!isRenderableValue(value)) {
30288
+ return "";
30289
+ }
30290
+ var attrKey = tag && (tag.indexOf('-') > 0 || isSVGTag(tag)) ? key // preserve raw name on custom elements and svg
30291
+ : propsToAttrMap[key] || key.toLowerCase();
30292
+ if (isBooleanAttr(attrKey)) {
30293
+ return includeBooleanAttr(value) ? " " + attrKey : "";
30294
+ } else if (isSSRSafeAttrName(attrKey)) {
30295
+ return value === '' ? " " + attrKey : " " + attrKey + "=\"" + escapeHtml(value) + "\"";
30296
+ } else {
30297
+ console.warn("[@vue/server-renderer] Skipped rendering unsafe attribute name: " + attrKey);
30298
+ return "";
29941
30299
  }
29942
- return value;
29943
30300
  }
29944
-
29945
- // Returns query DSL with query property and other options
29946
- function getDefaultQuery(component, value) {
29947
- // get custom or default query of sensor components
29948
- var currentValue = parseValue(value, component);
29949
- // get default query of result components
29950
- if (component.defaultQuery) {
29951
- var defaultQuery = component.defaultQuery(currentValue, component);
29952
- return _extends({
29953
- query: helper_22(defaultQuery)
29954
- }, helper_23(defaultQuery));
29955
- }
29956
- return component.source.defaultQuery ? {
29957
- query: component.source.defaultQuery(currentValue, component)
29958
- } : {};
29959
- }
29960
- // Only results the query part
29961
- function getCustomQuery(component, value) {
29962
- // get custom or default query of sensor components
29963
- var currentValue = parseValue(value, component);
29964
- if (component.customQuery) {
29965
- var customQuery = component.customQuery(currentValue, component);
29966
- return _extends({
29967
- query: helper_22(customQuery)
29968
- }, helper_23(customQuery));
30301
+ function isRenderableValue(value) {
30302
+ if (value == null) {
30303
+ return false;
29969
30304
  }
29970
- return component.source.defaultQuery ? {
29971
- query: component.source.defaultQuery(currentValue, component)
29972
- } : null;
30305
+ var type = typeof value;
30306
+ return type === 'string' || type === 'number' || type === 'boolean';
29973
30307
  }
29974
- function initReactivesearch(componentCollection, searchState, settings) {
29975
- return new Promise(function (resolve, reject) {
29976
- var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
29977
- var enableTelemetry = settings.reactivesearchAPIConfig && settings.reactivesearchAPIConfig.enableTelemetry !== undefined ? settings.reactivesearchAPIConfig.enableTelemetry : true;
29978
- var headers = _extends({}, _extends({
29979
- 'X-Search-Client': X_SEARCH_CLIENT$1
29980
- }, enableTelemetry === false && {
29981
- 'X-Enable-Telemetry': false
29982
- }), settings.headers, settings.endpoint && settings.endpoint.headers ? settings.endpoint.headers : {});
29983
- var url = settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io';
29984
- var transformRequest = settings.transformRequest || null;
29985
- if (settings.endpoint) {
29986
- if (settings.endpoint.url) {
29987
- // eslint-disable-next-line prefer-destructuring
29988
- url = settings.endpoint.url;
29989
- }
29990
- transformRequest = function transformRequest(request) {
29991
- var modifiedRequest = helper_1(request, settings.endpoint);
29992
- if (settings.transformRequest) {
29993
- return settings.transformRequest(modifiedRequest);
29994
- }
29995
- return modifiedRequest;
29996
- };
29997
- }
29998
- var config = {
29999
- url: url,
30000
- app: settings.app,
30001
- credentials: credentials,
30002
- transformRequest: transformRequest,
30003
- type: settings.type ? settings.type : '*',
30004
- transformResponse: settings.transformResponse || null,
30005
- graphQLUrl: settings.graphQLUrl || '',
30006
- headers: headers,
30007
- analyticsConfig: settings.reactivesearchAPIConfig || null,
30008
- enableAppbase: true,
30009
- endpoint: settings.endpoint
30010
- };
30011
- var appbaseRef = appbasejs(config);
30012
- if (config.transformRequest) {
30013
- appbaseRef.transformRequest = config.transformRequest;
30308
+ function ssrRenderClass(raw) {
30309
+ return escapeHtml(normalizeClass(raw));
30310
+ }
30311
+ function ssrRenderStyle(raw) {
30312
+ if (!raw) {
30313
+ return '';
30314
+ }
30315
+ if (isString(raw)) {
30316
+ return escapeHtml(raw);
30317
+ }
30318
+ var styles = normalizeStyle(raw);
30319
+ return escapeHtml(stringifyStyle(styles));
30320
+ }
30321
+ function ssrCompile(template, instance) {
30322
+ {
30323
+ throw new Error("On-the-fly template compilation is not supported in the ESM build of " + "@vue/server-renderer. All templates must be pre-compiled into " + "render functions.");
30324
+ }
30325
+ }
30326
+ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
30327
+ parentPush('<!--teleport start-->');
30328
+ var context = parentComponent.appContext.provides[vue.ssrContextKey];
30329
+ var teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
30330
+ var targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
30331
+ // record current index of the target buffer to handle nested teleports
30332
+ // since the parent needs to be rendered before the child
30333
+ var bufferIndex = targetBuffer.length;
30334
+ var teleportContent;
30335
+ if (disabled) {
30336
+ contentRenderFn(parentPush);
30337
+ teleportContent = "<!--teleport anchor-->";
30338
+ } else {
30339
+ var _createBuffer2 = createBuffer(),
30340
+ getBuffer = _createBuffer2.getBuffer,
30341
+ push = _createBuffer2.push;
30342
+ contentRenderFn(push);
30343
+ push("<!--teleport anchor-->");
30344
+ teleportContent = getBuffer();
30345
+ }
30346
+ targetBuffer.splice(bufferIndex, 0, teleportContent);
30347
+ parentPush('<!--teleport end-->');
30348
+ }
30349
+ var createComponentInstance = vue.ssrUtils.createComponentInstance,
30350
+ setCurrentRenderingInstance = vue.ssrUtils.setCurrentRenderingInstance,
30351
+ setupComponent = vue.ssrUtils.setupComponent,
30352
+ renderComponentRoot = vue.ssrUtils.renderComponentRoot,
30353
+ normalizeVNode = vue.ssrUtils.normalizeVNode;
30354
+ // Each component has a buffer array.
30355
+ // A buffer array can contain one of the following:
30356
+ // - plain string
30357
+ // - A resolved buffer (recursive arrays of strings that can be unrolled
30358
+ // synchronously)
30359
+ // - An async buffer (a Promise that resolves to a resolved buffer)
30360
+ function createBuffer() {
30361
+ var appendable = false;
30362
+ var buffer = [];
30363
+ return {
30364
+ getBuffer: function getBuffer() {
30365
+ // Return static buffer and await on items during unroll stage
30366
+ return buffer;
30367
+ },
30368
+ push: function push(item) {
30369
+ var isStringItem = isString(item);
30370
+ if (appendable && isStringItem) {
30371
+ buffer[buffer.length - 1] += item;
30372
+ } else {
30373
+ buffer.push(item);
30374
+ }
30375
+ appendable = isStringItem;
30376
+ if (isPromise(item) || isArray(item) && item.hasAsync) {
30377
+ // promise, or child buffer with async, mark as async.
30378
+ // this allows skipping unnecessary await ticks during unroll stage
30379
+ buffer.hasAsync = true;
30380
+ }
30014
30381
  }
30015
- if (config.transformResponse) {
30016
- appbaseRef.transformResponse = config.transformResponse;
30382
+ };
30383
+ }
30384
+ function renderComponentVNode(vnode, parentComponent, slotScopeId) {
30385
+ if (parentComponent === void 0) {
30386
+ parentComponent = null;
30387
+ }
30388
+ var instance = createComponentInstance(vnode, parentComponent, null);
30389
+ var res = setupComponent(instance, true /* isSSR */);
30390
+ var hasAsyncSetup = isPromise(res);
30391
+ var prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
30392
+ if (hasAsyncSetup || prefetches) {
30393
+ var p = hasAsyncSetup ? res : Promise.resolve();
30394
+ if (prefetches) {
30395
+ p = p.then(function () {
30396
+ return Promise.all(prefetches.map(function (prefetch) {
30397
+ return prefetch.call(instance.proxy);
30398
+ }));
30399
+ })
30400
+ // Note: error display is already done by the wrapped lifecycle hook function.
30401
+ ["catch"](function () {});
30017
30402
  }
30018
- var components = [];
30019
- var selectedValues = {};
30020
- var internalValues = {};
30021
- var queryList = {};
30022
- var queryLog = {};
30023
- var queryOptions = {};
30024
- var dependencyTree = {};
30025
- var finalQuery = [];
30026
- var appbaseQuery = {}; // Use object to prevent duplicate query added by react prop
30027
- var orderOfQueries = [];
30028
- var hits = {};
30029
- var aggregations = {};
30030
- var compositeAggregations = {};
30031
- var state = {};
30032
- var customQueries = {};
30033
- var defaultQueries = {};
30034
- var componentProps = {};
30035
- componentCollection.forEach(function (component) {
30036
- var componentType = component.source.componentType;
30037
- components = [].concat(components, [component.componentId]);
30038
- // Set component props
30039
- var compProps = {};
30040
- Object.keys(component).forEach(function (key) {
30041
- if (constants_3$1.includes(key)) {
30042
- compProps[key] = component[key];
30403
+ return p.then(function () {
30404
+ return renderComponentSubTree(instance, slotScopeId);
30405
+ });
30406
+ } else {
30407
+ return renderComponentSubTree(instance, slotScopeId);
30408
+ }
30409
+ }
30410
+ function renderComponentSubTree(instance, slotScopeId) {
30411
+ var comp = instance.type;
30412
+ var _createBuffer = createBuffer(),
30413
+ getBuffer = _createBuffer.getBuffer,
30414
+ push = _createBuffer.push;
30415
+ if (isFunction$1(comp)) {
30416
+ var root = renderComponentRoot(instance);
30417
+ // #5817 scope ID attrs not falling through if functional component doesn't
30418
+ // have props
30419
+ if (!comp.props) {
30420
+ for (var key in instance.attrs) {
30421
+ if (key.startsWith("data-v-")) {
30422
+ (root.props || (root.props = {}))[key] = "";
30423
+ }
30424
+ }
30425
+ }
30426
+ renderVNode(push, instance.subTree = root, instance, slotScopeId);
30427
+ } else {
30428
+ if ((!instance.render || instance.render === NOOP) && !instance.ssrRender && !comp.ssrRender && isString(comp.template)) {
30429
+ comp.ssrRender = ssrCompile(comp.template);
30430
+ }
30431
+ // perf: enable caching of computed getters during render
30432
+ // since there cannot be state mutations during render.
30433
+ for (var _iterator = _createForOfIteratorHelperLoose(instance.scope.effects), _step; !(_step = _iterator()).done;) {
30434
+ var e = _step.value;
30435
+ if (e.computed) e.computed._cacheable = true;
30436
+ }
30437
+ var ssrRender = instance.ssrRender || comp.ssrRender;
30438
+ if (ssrRender) {
30439
+ // optimized
30440
+ // resolve fallthrough attrs
30441
+ var attrs = instance.inheritAttrs !== false ? instance.attrs : undefined;
30442
+ var hasCloned = false;
30443
+ var cur = instance;
30444
+ while (true) {
30445
+ var scopeId = cur.vnode.scopeId;
30446
+ if (scopeId) {
30447
+ if (!hasCloned) {
30448
+ attrs = _extends({}, attrs);
30449
+ hasCloned = true;
30450
+ }
30451
+ attrs[scopeId] = '';
30043
30452
  }
30044
- });
30045
- var isInternalComponentPresent = false;
30046
- if (component.source.hasInternalComponent) {
30047
- isInternalComponentPresent = component.source.hasInternalComponent(component);
30048
- }
30049
- var isResultComponent = resultComponents.includes(componentType);
30050
- var internalComponent = component.componentId + "__internal";
30051
- var label = component.filterLabel || component.componentId;
30052
- var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
30053
- value = _getValue.value,
30054
- reference = _getValue.reference;
30055
- // [1] set selected values
30056
- var showFilter = component.showFilter !== undefined ? component.showFilter : true;
30057
- if (componentsWithoutFilters.includes(componentType)) {
30058
- showFilter = false;
30059
- }
30060
- selectedValues = valueReducer(selectedValues, {
30061
- type: 'SET_VALUE',
30062
- component: component.componentId,
30063
- label: label,
30064
- value: value,
30065
- reference: reference,
30066
- showFilter: showFilter,
30067
- URLParams: component.URLParams || false
30068
- });
30069
- // Set custom and default queries
30070
- if (component.customQuery && typeof component.customQuery === 'function') {
30071
- customQueries[component.componentId] = component.customQuery(value, compProps);
30453
+ var parent = cur.parent;
30454
+ if (parent && parent.subTree && parent.subTree === cur.vnode) {
30455
+ // parent is a non-SSR compiled component and is rendering this
30456
+ // component as root. inherit its scopeId if present.
30457
+ cur = parent;
30458
+ } else {
30459
+ break;
30460
+ }
30461
+ }
30462
+ if (slotScopeId) {
30463
+ if (!hasCloned) attrs = _extends({}, attrs);
30464
+ attrs[slotScopeId.trim()] = '';
30072
30465
  }
30073
- if (component.defaultQuery && typeof component.defaultQuery === 'function') {
30074
- defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
30466
+ // set current rendering instance for asset resolution
30467
+ var prev = setCurrentRenderingInstance(instance);
30468
+ try {
30469
+ ssrRender(instance.proxy, push, instance, attrs,
30470
+ // compiler-optimized bindings
30471
+ instance.props, instance.setupState, instance.data, instance.ctx);
30472
+ } finally {
30473
+ setCurrentRenderingInstance(prev);
30075
30474
  }
30076
- var componentQueryOptions = {};
30077
- // [2] set query options - main component query (valid for result components)
30078
- if (component && component.source.generateQueryOptions) {
30079
- componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
30475
+ } else if (instance.render && instance.render !== NOOP) {
30476
+ renderVNode(push, instance.subTree = renderComponentRoot(instance), instance, slotScopeId);
30477
+ } else {
30478
+ var componentName = comp.name || comp.__file || "<Anonymous>";
30479
+ vue.warn("Component " + componentName + " is missing template or render function.");
30480
+ push("<!---->");
30481
+ }
30482
+ }
30483
+ return getBuffer();
30484
+ }
30485
+ function renderVNode(push, vnode, parentComponent, slotScopeId) {
30486
+ var type = vnode.type,
30487
+ shapeFlag = vnode.shapeFlag,
30488
+ children = vnode.children;
30489
+ switch (type) {
30490
+ case vue.Text:
30491
+ push(escapeHtml(children));
30492
+ break;
30493
+ case vue.Comment:
30494
+ push(children ? "<!--" + escapeHtmlComment(children) + "-->" : "<!---->");
30495
+ break;
30496
+ case vue.Static:
30497
+ push(children);
30498
+ break;
30499
+ case vue.Fragment:
30500
+ if (vnode.slotScopeIds) {
30501
+ slotScopeId = (slotScopeId ? slotScopeId + ' ' : '') + vnode.slotScopeIds.join(' ');
30080
30502
  }
30081
- var highlightQuery = {};
30082
- if (component.source.highlightQuery) {
30083
- highlightQuery = component.source.highlightQuery(component);
30503
+ push("<!--[-->"); // open
30504
+ renderVNodeChildren(push, children, parentComponent, slotScopeId);
30505
+ push("<!--]-->"); // close
30506
+ break;
30507
+ default:
30508
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
30509
+ renderElementVNode(push, vnode, parentComponent, slotScopeId);
30510
+ } else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
30511
+ push(renderComponentVNode(vnode, parentComponent, slotScopeId));
30512
+ } else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
30513
+ renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
30514
+ } else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
30515
+ renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
30516
+ } else {
30517
+ vue.warn('[@vue/server-renderer] Invalid VNode type:', type, "(" + typeof type + ")");
30084
30518
  }
30085
- if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
30086
- // eslint-disable-next-line
30087
- var _ref = componentQueryOptions || {},
30088
- aggs = _ref.aggs,
30089
- size = _ref.size,
30090
- otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded$a);
30091
- if (aggs && Object.keys(aggs).length) {
30092
- isInternalComponentPresent = true;
30093
- componentQueryOptions = _extends({}, componentQueryOptions, {
30094
- aggs: aggs,
30095
- size: typeof size === 'undefined' ? 100 : size
30096
- });
30097
- }
30098
-
30099
- // sort, highlight, size, from - query should be applied on the main component
30100
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
30101
- if (!otherQueryOptions) otherQueryOptions = {};
30102
- if (!highlightQuery) highlightQuery = {};
30103
- var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
30104
- size: size
30105
- });
30106
- if (isInternalComponentPresent) {
30107
- mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
30519
+ }
30520
+ }
30521
+ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
30522
+ for (var i = 0; i < children.length; i++) {
30523
+ renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
30524
+ }
30525
+ }
30526
+ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
30527
+ var tag = vnode.type;
30528
+ var props = vnode.props,
30529
+ children = vnode.children,
30530
+ shapeFlag = vnode.shapeFlag,
30531
+ scopeId = vnode.scopeId,
30532
+ dirs = vnode.dirs;
30533
+ var openTag = "<" + tag;
30534
+ if (dirs) {
30535
+ props = applySSRDirectives(vnode, props, dirs);
30536
+ }
30537
+ if (props) {
30538
+ openTag += ssrRenderAttrs(props, tag);
30539
+ }
30540
+ if (scopeId) {
30541
+ openTag += " " + scopeId;
30542
+ }
30543
+ // inherit parent chain scope id if this is the root node
30544
+ var curParent = parentComponent;
30545
+ var curVnode = vnode;
30546
+ while (curParent && curVnode === curParent.subTree) {
30547
+ curVnode = curParent.vnode;
30548
+ if (curVnode.scopeId) {
30549
+ openTag += " " + curVnode.scopeId;
30550
+ }
30551
+ curParent = curParent.parent;
30552
+ }
30553
+ if (slotScopeId) {
30554
+ openTag += " " + slotScopeId;
30555
+ }
30556
+ push(openTag + ">");
30557
+ if (!isVoidTag(tag)) {
30558
+ var hasChildrenOverride = false;
30559
+ if (props) {
30560
+ if (props.innerHTML) {
30561
+ hasChildrenOverride = true;
30562
+ push(props.innerHTML);
30563
+ } else if (props.textContent) {
30564
+ hasChildrenOverride = true;
30565
+ push(escapeHtml(props.textContent));
30566
+ } else if (tag === 'textarea' && props.value) {
30567
+ hasChildrenOverride = true;
30568
+ push(escapeHtml(props.value));
30569
+ }
30570
+ }
30571
+ if (!hasChildrenOverride) {
30572
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
30573
+ push(escapeHtml(children));
30574
+ } else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
30575
+ renderVNodeChildren(push, children, parentComponent, slotScopeId);
30576
+ }
30577
+ }
30578
+ push("</" + tag + ">");
30579
+ }
30580
+ }
30581
+ function applySSRDirectives(vnode, rawProps, dirs) {
30582
+ var toMerge = [];
30583
+ for (var i = 0; i < dirs.length; i++) {
30584
+ var binding = dirs[i];
30585
+ var getSSRProps = binding.dir.getSSRProps;
30586
+ if (getSSRProps) {
30587
+ var props = getSSRProps(binding, vnode);
30588
+ if (props) toMerge.push(props);
30589
+ }
30590
+ }
30591
+ return vue.mergeProps.apply(void 0, [rawProps || {}].concat(toMerge));
30592
+ }
30593
+ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
30594
+ var target = vnode.props && vnode.props.to;
30595
+ var disabled = vnode.props && vnode.props.disabled;
30596
+ if (!target) {
30597
+ if (!disabled) {
30598
+ vue.warn("[@vue/server-renderer] Teleport is missing target prop.");
30599
+ }
30600
+ return [];
30601
+ }
30602
+ if (!isString(target)) {
30603
+ vue.warn("[@vue/server-renderer] Teleport target must be a query selector string.");
30604
+ return [];
30605
+ }
30606
+ ssrRenderTeleport(push, function (push) {
30607
+ renderVNodeChildren(push, vnode.children, parentComponent, slotScopeId);
30608
+ }, target, disabled || disabled === '', parentComponent);
30609
+ }
30610
+ var isVNode = vue.ssrUtils.isVNode;
30611
+ function unrollBuffer(_x) {
30612
+ return _unrollBuffer.apply(this, arguments);
30613
+ }
30614
+ function _unrollBuffer() {
30615
+ _unrollBuffer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(buffer) {
30616
+ var ret, i, item;
30617
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
30618
+ while (1) switch (_context2.prev = _context2.next) {
30619
+ case 0:
30620
+ if (!buffer.hasAsync) {
30621
+ _context2.next = 23;
30622
+ break;
30623
+ }
30624
+ ret = '';
30625
+ i = 0;
30626
+ case 3:
30627
+ if (!(i < buffer.length)) {
30628
+ _context2.next = 20;
30629
+ break;
30630
+ }
30631
+ item = buffer[i];
30632
+ if (!isPromise(item)) {
30633
+ _context2.next = 9;
30634
+ break;
30635
+ }
30636
+ _context2.next = 8;
30637
+ return item;
30638
+ case 8:
30639
+ item = _context2.sent;
30640
+ case 9:
30641
+ if (!isString(item)) {
30642
+ _context2.next = 13;
30643
+ break;
30644
+ }
30645
+ ret += item;
30646
+ _context2.next = 17;
30647
+ break;
30648
+ case 13:
30649
+ _context2.t0 = ret;
30650
+ _context2.next = 16;
30651
+ return unrollBuffer(item);
30652
+ case 16:
30653
+ ret = _context2.t0 += _context2.sent;
30654
+ case 17:
30655
+ i++;
30656
+ _context2.next = 3;
30657
+ break;
30658
+ case 20:
30659
+ return _context2.abrupt("return", ret);
30660
+ case 23:
30661
+ return _context2.abrupt("return", unrollBufferSync(buffer));
30662
+ case 24:
30663
+ case "end":
30664
+ return _context2.stop();
30665
+ }
30666
+ }, _callee2);
30667
+ }));
30668
+ return _unrollBuffer.apply(this, arguments);
30669
+ }
30670
+ function unrollBufferSync(buffer) {
30671
+ var ret = '';
30672
+ for (var i = 0; i < buffer.length; i++) {
30673
+ var item = buffer[i];
30674
+ if (isString(item)) {
30675
+ ret += item;
30676
+ } else {
30677
+ // since this is a sync buffer, child buffers are never promises
30678
+ ret += unrollBufferSync(item);
30679
+ }
30680
+ }
30681
+ return ret;
30682
+ }
30683
+ function renderToString(_x2, _x3) {
30684
+ return _renderToString.apply(this, arguments);
30685
+ }
30686
+ function _renderToString() {
30687
+ _renderToString = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(input, context) {
30688
+ var vnode, buffer, result, _iterator3, _step3, unwatch;
30689
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
30690
+ while (1) switch (_context3.prev = _context3.next) {
30691
+ case 0:
30692
+ if (context === void 0) {
30693
+ context = {};
30694
+ }
30695
+ if (!isVNode(input)) {
30696
+ _context3.next = 3;
30697
+ break;
30108
30698
  }
30109
- if (isResultComponent) {
30110
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
30111
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
30112
- currentPage = selectedValues[component.componentId].value - 1 || 0;
30699
+ return _context3.abrupt("return", renderToString(vue.createApp({
30700
+ render: function render() {
30701
+ return input;
30702
+ }
30703
+ }), context));
30704
+ case 3:
30705
+ // rendering an app
30706
+ vnode = vue.createVNode(input._component, input._props);
30707
+ vnode.appContext = input._context;
30708
+ // provide the ssr context to the tree
30709
+ input.provide(vue.ssrContextKey, context);
30710
+ _context3.next = 8;
30711
+ return renderComponentVNode(vnode);
30712
+ case 8:
30713
+ buffer = _context3.sent;
30714
+ _context3.next = 11;
30715
+ return unrollBuffer(buffer);
30716
+ case 11:
30717
+ result = _context3.sent;
30718
+ _context3.next = 14;
30719
+ return resolveTeleports(context);
30720
+ case 14:
30721
+ if (context.__watcherHandles) {
30722
+ for (_iterator3 = _createForOfIteratorHelperLoose(context.__watcherHandles); !(_step3 = _iterator3()).done;) {
30723
+ unwatch = _step3.value;
30724
+ unwatch();
30113
30725
  }
30114
- var resultSize = component.size || 10;
30115
- var from = currentPage * resultSize;
30116
- // Update props for RS API
30117
- compProps.from = from;
30118
- mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
30119
- size: resultSize,
30120
- from: from
30121
- });
30122
30726
  }
30123
- componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
30124
- }
30125
- }
30126
- // [3] set dependency tree
30127
- if (component.react || isInternalComponentPresent || isResultComponent) {
30128
- var react = component.react;
30129
- if (isInternalComponentPresent || isResultComponent) {
30130
- react = helper_38(react, internalComponent);
30131
- }
30132
- dependencyTree = dependencyTreeReducer(dependencyTree, {
30133
- type: 'WATCH_COMPONENT',
30134
- component: component.componentId,
30135
- react: react
30136
- });
30727
+ return _context3.abrupt("return", result);
30728
+ case 16:
30729
+ case "end":
30730
+ return _context3.stop();
30137
30731
  }
30138
- // [4] set query list
30139
- // Do not set default query for suggestions
30140
- if (isInternalComponentPresent && !transform_8(component.componentType)) {
30141
- var _ref2 = getDefaultQuery(component, value) || {},
30142
- defaultQuery = _ref2.query,
30143
- defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
30144
- queryList = queryReducer(queryList, {
30145
- type: 'SET_QUERY',
30146
- component: internalComponent,
30147
- query: defaultQuery
30148
- });
30149
- queryOptions = queryOptionsReducer(queryOptions, {
30150
- type: 'SET_QUERY_OPTIONS',
30151
- component: internalComponent,
30152
- options: _extends({}, componentQueryOptions, defaultQueryOptions)
30153
- });
30732
+ }, _callee3);
30733
+ }));
30734
+ return _renderToString.apply(this, arguments);
30735
+ }
30736
+ function resolveTeleports(_x4) {
30737
+ return _resolveTeleports.apply(this, arguments);
30738
+ }
30739
+ function _resolveTeleports() {
30740
+ _resolveTeleports = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(context) {
30741
+ var key;
30742
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
30743
+ while (1) switch (_context4.prev = _context4.next) {
30744
+ case 0:
30745
+ if (!context.__teleportBuffers) {
30746
+ _context4.next = 14;
30747
+ break;
30748
+ }
30749
+ context.teleports = context.teleports || {};
30750
+ _context4.t0 = _regeneratorRuntime().keys(context.__teleportBuffers);
30751
+ case 3:
30752
+ if ((_context4.t1 = _context4.t0()).done) {
30753
+ _context4.next = 14;
30754
+ break;
30755
+ }
30756
+ key = _context4.t1.value;
30757
+ _context4.t2 = unrollBuffer;
30758
+ _context4.next = 8;
30759
+ return Promise.all([context.__teleportBuffers[key]]);
30760
+ case 8:
30761
+ _context4.t3 = _context4.sent;
30762
+ _context4.next = 11;
30763
+ return (0, _context4.t2)(_context4.t3);
30764
+ case 11:
30765
+ context.teleports[key] = _context4.sent;
30766
+ _context4.next = 3;
30767
+ break;
30768
+ case 14:
30769
+ case "end":
30770
+ return _context4.stop();
30154
30771
  }
30155
- var _ref3 = getCustomQuery(component, value) || {},
30156
- query = _ref3.query,
30157
- options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
30158
- var customQuery = query;
30159
- // set custom query for main component
30160
- queryList = queryReducer(queryList, {
30161
- type: 'SET_QUERY',
30162
- component: component.componentId,
30163
- query: customQuery
30164
- });
30165
- queryOptions = queryOptionsReducer(queryOptions, {
30166
- type: 'SET_QUERY_OPTIONS',
30167
- component: component.componentId,
30168
- options: _extends({}, options)
30169
- });
30170
- // Set component type in component props
30171
- compProps.componentType = componentType;
30172
- componentProps[component.componentId] = compProps;
30173
- });
30174
- state = {
30175
- components: components,
30176
- dependencyTree: dependencyTree,
30177
- queryList: queryList,
30178
- queryOptions: queryOptions,
30179
- selectedValues: selectedValues,
30180
- internalValues: internalValues,
30181
- props: componentProps,
30182
- customQueries: customQueries,
30183
- defaultQueries: defaultQueries
30772
+ }, _callee4);
30773
+ }));
30774
+ return _resolveTeleports.apply(this, arguments);
30775
+ }
30776
+ var isVNode$1 = vue.ssrUtils.isVNode;
30777
+ var ErrorTypeStrings = (_ErrorTypeStrings = {}, _ErrorTypeStrings["sp" /* LifecycleHooks.SERVER_PREFETCH */] = 'serverPrefetch hook', _ErrorTypeStrings["bc" /* LifecycleHooks.BEFORE_CREATE */] = 'beforeCreate hook', _ErrorTypeStrings["c" /* LifecycleHooks.CREATED */] = 'created hook', _ErrorTypeStrings["bm" /* LifecycleHooks.BEFORE_MOUNT */] = 'beforeMount hook', _ErrorTypeStrings["m" /* LifecycleHooks.MOUNTED */] = 'mounted hook', _ErrorTypeStrings["bu" /* LifecycleHooks.BEFORE_UPDATE */] = 'beforeUpdate hook', _ErrorTypeStrings["u" /* LifecycleHooks.UPDATED */] = 'updated', _ErrorTypeStrings["bum" /* LifecycleHooks.BEFORE_UNMOUNT */] = 'beforeUnmount hook', _ErrorTypeStrings["um" /* LifecycleHooks.UNMOUNTED */] = 'unmounted hook', _ErrorTypeStrings["a" /* LifecycleHooks.ACTIVATED */] = 'activated hook', _ErrorTypeStrings["da" /* LifecycleHooks.DEACTIVATED */] = 'deactivated hook', _ErrorTypeStrings["ec" /* LifecycleHooks.ERROR_CAPTURED */] = 'errorCaptured hook', _ErrorTypeStrings["rtc" /* LifecycleHooks.RENDER_TRACKED */] = 'renderTracked hook', _ErrorTypeStrings["rtg" /* LifecycleHooks.RENDER_TRIGGERED */] = 'renderTriggered hook', _ErrorTypeStrings[0 /* ErrorCodes.SETUP_FUNCTION */] = 'setup function', _ErrorTypeStrings[1 /* ErrorCodes.RENDER_FUNCTION */] = 'render function', _ErrorTypeStrings[2 /* ErrorCodes.WATCH_GETTER */] = 'watcher getter', _ErrorTypeStrings[3 /* ErrorCodes.WATCH_CALLBACK */] = 'watcher callback', _ErrorTypeStrings[4 /* ErrorCodes.WATCH_CLEANUP */] = 'watcher cleanup function', _ErrorTypeStrings[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */] = 'native event handler', _ErrorTypeStrings[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */] = 'component event handler', _ErrorTypeStrings[7 /* ErrorCodes.VNODE_HOOK */] = 'vnode hook', _ErrorTypeStrings[8 /* ErrorCodes.DIRECTIVE_HOOK */] = 'directive hook', _ErrorTypeStrings[9 /* ErrorCodes.TRANSITION_HOOK */] = 'transition hook', _ErrorTypeStrings[10 /* ErrorCodes.APP_ERROR_HANDLER */] = 'app errorHandler', _ErrorTypeStrings[11 /* ErrorCodes.APP_WARN_HANDLER */] = 'app warnHandler', _ErrorTypeStrings[12 /* ErrorCodes.FUNCTION_REF */] = 'ref function', _ErrorTypeStrings[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */] = 'async component loader', _ErrorTypeStrings[14 /* ErrorCodes.SCHEDULER */] = 'scheduler flush. This is likely a Vue internals bug. ' + 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core', _ErrorTypeStrings);
30778
+ vue.initDirectivesForSSR();
30779
+
30780
+ var componentTypes = {
30781
+ reactiveList: 'REACTIVELIST',
30782
+ // search components
30783
+ dataSearch: 'DATASEARCH',
30784
+ categorySearch: 'CATEGORYSEARCH',
30785
+ searchBox: 'SEARCHBOX',
30786
+ // list components
30787
+ singleList: 'SINGLELIST',
30788
+ multiList: 'MULTILIST',
30789
+ singleDataList: 'SINGLEDATALIST',
30790
+ tabDataList: 'TABDATALIST',
30791
+ singleDropdownList: 'SINGLEDROPDOWNLIST',
30792
+ multiDataList: 'MULTIDATALIST',
30793
+ multiDropdownList: 'MULTIDROPDOWNLIST',
30794
+ singleDropdownRange: 'SINGLEDROPDOWNRANGE',
30795
+ treeList: 'TREELIST',
30796
+ // basic components
30797
+ numberBox: 'NUMBERBOX',
30798
+ tagCloud: 'TAGCLOUD',
30799
+ toggleButton: 'TOGGLEBUTTON',
30800
+ reactiveComponent: 'REACTIVECOMPONENT',
30801
+ // range components
30802
+ datePicker: 'DATEPICKER',
30803
+ dateRange: 'DATERANGE',
30804
+ dynamicRangeSlider: 'DYNAMICRANGESLIDER',
30805
+ multiDropdownRange: 'MULTIDROPDOWNRANGE',
30806
+ singleRange: 'SINGLERANGE',
30807
+ multiRange: 'MULTIRANGE',
30808
+ rangeSlider: 'RANGESLIDER',
30809
+ ratingsFilter: 'RATINGSFILTER',
30810
+ rangeInput: 'RANGEINPUT',
30811
+ // map components
30812
+ geoDistanceDropdown: 'GEO_DISTANCE_DROPDOWN',
30813
+ geoDistanceSlider: 'GEO_DISTANCE_SLIDER',
30814
+ reactiveMap: 'REACTIVE_MAP',
30815
+ // chart components
30816
+ reactiveChart: 'REACTIVE_CHART'
30817
+ };
30818
+ var queryTypes = {
30819
+ search: 'search',
30820
+ term: 'term',
30821
+ range: 'range',
30822
+ geo: 'geo',
30823
+ suggestion: 'suggestion'
30824
+ };
30825
+
30826
+ var REMOVE_COMPONENT = 'REMOVE_COMPONENT';
30827
+ var PATCH_VALUE = 'PATCH_VALUE';
30828
+ var CLEAR_VALUES = 'CLEAR_VALUES';
30829
+ var SET_VALUE = 'SET_VALUE';
30830
+ var SET_VALUES = 'SET_VALUES';
30831
+ var RESET_TO_DEFAULT = 'RESET_TO_DEFAULT';
30832
+
30833
+ var dateFormats = {
30834
+ date: 'YYYY-MM-DD',
30835
+ basic_date: 'YYYYMMDD',
30836
+ basic_date_time: 'YYYYMMDD[T]HHmmss.SSSZ',
30837
+ basic_date_time_no_millis: 'YYYYMMDD[T]HHmmssZ',
30838
+ date_time_no_millis: 'YYYY-MM-DD[T]HH:mm:ssZ',
30839
+ basic_time: 'HHmmss.SSSZ',
30840
+ basic_time_no_millis: 'HHmmssZ',
30841
+ epoch_millis: 'epoch_millis',
30842
+ epoch_second: 'epoch_second'
30843
+ };
30844
+
30845
+ var _componentTypeToDefau;
30846
+ function getOperation(conjunction) {
30847
+ if (conjunction === 'and') {
30848
+ return 'must';
30849
+ }
30850
+ if (conjunction === 'or') {
30851
+ return 'should';
30852
+ }
30853
+ return 'must_not';
30854
+ }
30855
+ function createBoolQuery(operation, query) {
30856
+ var resultQuery = null;
30857
+ if (Array.isArray(query) && query.length || !Array.isArray(query) && query) {
30858
+ var _bool;
30859
+ resultQuery = {
30860
+ bool: (_bool = {}, _bool[operation] = query, _bool)
30184
30861
  };
30185
- // [5] Generate finalQuery for search
30186
- componentCollection.forEach(function (component) {
30187
- // eslint-disable-next-line
30188
- var _buildQuery = helper_37(component.componentId, dependencyTree, queryList, queryOptions),
30189
- queryObj = _buildQuery.queryObj,
30190
- options = _buildQuery.options;
30191
- var componentQueryOptions = options;
30192
- var validOptions = ['aggs', 'from', 'sort'];
30193
- // check if query or componentQueryOptions are valid - non-empty
30194
- if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
30195
- return validOptions.includes(item);
30196
- })) {
30197
- var _extends2;
30198
- if (!queryObj || queryObj && !Object.keys(queryObj).length) {
30199
- queryObj = {
30200
- match_all: {}
30201
- };
30202
- }
30203
- orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
30204
- var currentQuery = _extends({
30205
- query: _extends({}, queryObj)
30206
- }, componentQueryOptions, queryOptions[component.componentId]);
30207
- queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
30208
- var query = transform_5(component.componentId, transform_3(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
30209
- from: queryOptions[component.componentId].from
30210
- } : null));
30211
- if (query) {
30212
- var _extends3;
30213
- // Apply dependent queries
30214
- appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_2(state, component.componentId, orderOfQueries));
30862
+ }
30863
+ if (operation === 'should' && resultQuery) {
30864
+ resultQuery = {
30865
+ bool: _extends({}, resultQuery.bool, {
30866
+ minimum_should_match: 1
30867
+ })
30868
+ };
30869
+ }
30870
+ return resultQuery;
30871
+ }
30872
+ function getQuery(react, queryList) {
30873
+ var query = [];
30874
+ Object.keys(react).forEach(function (conjunction) {
30875
+ if (Array.isArray(react[conjunction])) {
30876
+ var operation = getOperation(conjunction);
30877
+ var queryArr = react[conjunction].map(function (comp) {
30878
+ if (typeof comp !== 'string') {
30879
+ // in this case, we have { <conjunction>: <> } objects inside the array
30880
+ return getQuery(comp, queryList);
30881
+ } else if (comp in queryList) {
30882
+ if (queryList[comp] && Object.keys(queryList[comp]).length) {
30883
+ return queryList[comp];
30884
+ }
30215
30885
  }
30886
+ return null;
30887
+ }).filter(function (item) {
30888
+ return !!item;
30889
+ });
30890
+ var boolQuery = createBoolQuery(operation, queryArr);
30891
+ if (boolQuery && Object.keys(boolQuery).length) {
30892
+ query = [].concat(query, [boolQuery]);
30216
30893
  }
30217
- });
30218
- state.queryLog = queryLog;
30219
- var handleTransformResponse = function handleTransformResponse(res, component) {
30220
- if (config.transformResponse && typeof config.transformResponse === 'function') {
30221
- return config.transformResponse(res, component);
30894
+ } else if (typeof react[conjunction] === 'string') {
30895
+ var _operation = getOperation(conjunction);
30896
+ var _boolQuery = createBoolQuery(_operation, queryList[react[conjunction]]);
30897
+ if (_boolQuery && Object.keys(_boolQuery).length) {
30898
+ query = [].concat(query, [_boolQuery]);
30222
30899
  }
30223
- return new Promise(function (resolveTransformResponse) {
30224
- return resolveTransformResponse(res);
30225
- });
30226
- };
30227
- var handleResponse = function handleResponse(res) {
30228
- var allPromises = orderOfQueries.map(function (component, index) {
30229
- return new Promise(function (responseResolve, responseReject) {
30230
- handleTransformResponse(res.responses[index], component).then(function (response) {
30231
- var _extends5;
30232
- if (response.aggregations) {
30233
- var _extends4;
30234
- aggregations = _extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
30235
- compositeAggregations = compositeAggsReducer(compositeAggregations, {
30236
- type: constants_10,
30237
- aggregations: response.aggregations,
30238
- append: false
30239
- });
30240
- }
30241
- hits = _extends({}, hits, (_extends5 = {}, _extends5[component] = {
30242
- hits: response.hits.hits,
30243
- total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
30244
- time: response.took
30245
- }, _extends5));
30246
- responseResolve();
30247
- })["catch"](function (err) {
30248
- return responseReject(err);
30900
+ } else if (typeof react[conjunction] === 'object' && react[conjunction] !== null) {
30901
+ var _boolQuery2 = getQuery(react[conjunction], queryList);
30902
+ if (_boolQuery2 && Object.keys(_boolQuery2).length) {
30903
+ query = [].concat(query, [_boolQuery2]);
30904
+ }
30905
+ }
30906
+ });
30907
+ if (Array.isArray(query) && query.length) {
30908
+ return {
30909
+ bool: {
30910
+ must: query
30911
+ }
30912
+ };
30913
+ }
30914
+ if (query && Object.keys(query).length) {
30915
+ return query;
30916
+ }
30917
+ return null;
30918
+ }
30919
+ function getExternalQueryOptions(react, options, component) {
30920
+ var queryOptions = {};
30921
+ Object.keys(react).forEach(function (conjunction) {
30922
+ if (Array.isArray(react[conjunction])) {
30923
+ react[conjunction].forEach(function (comp) {
30924
+ if (options[comp]) {
30925
+ queryOptions = _extends({}, queryOptions, options[comp]);
30926
+ }
30927
+ });
30928
+ } else if (typeof react[conjunction] === 'string') {
30929
+ if (options[react[conjunction]]) {
30930
+ queryOptions = _extends({}, queryOptions, options[react[conjunction]]);
30931
+ }
30932
+ } else if (typeof react[conjunction] === 'object' && react[conjunction] !== null && !Array.isArray(react[conjunction])) {
30933
+ queryOptions = _extends({}, queryOptions, getExternalQueryOptions(react[conjunction], options));
30934
+ }
30935
+ });
30936
+ if (options[component]) {
30937
+ queryOptions = _extends({}, queryOptions, options[component]);
30938
+ }
30939
+ return queryOptions;
30940
+ }
30941
+ function buildQuery(component, dependencyTree, queryList, queryOptions) {
30942
+ var queryObj = null;
30943
+ var options = null;
30944
+ if (component in dependencyTree) {
30945
+ queryObj = getQuery(dependencyTree[component], queryList);
30946
+ options = getExternalQueryOptions(dependencyTree[component], queryOptions, component);
30947
+ }
30948
+ return {
30949
+ queryObj: queryObj,
30950
+ options: options
30951
+ };
30952
+ }
30953
+ function formatDate(date, props) {
30954
+ if (props.parseDate) {
30955
+ // We would be passing an instance of dayjs instead of xdate below. Users need to know.
30956
+ return props.parseDate(date, props);
30957
+ }
30958
+ switch (props.queryFormat) {
30959
+ case 'epoch_millis':
30960
+ return date.valueOf();
30961
+ case 'epoch_second':
30962
+ return Math.floor(date.valueOf() / 1000);
30963
+ default:
30964
+ {
30965
+ if (dateFormats[props.queryFormat]) {
30966
+ return date.format(dateFormats[props.queryFormat]);
30967
+ }
30968
+ return date.valueOf();
30969
+ }
30970
+ }
30971
+ }
30972
+ var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[componentTypes.singleList] = '', _componentTypeToDefau[componentTypes.multiList] = [], _componentTypeToDefau[componentTypes.singleDataList] = '', _componentTypeToDefau[componentTypes.singleDropdownList] = '', _componentTypeToDefau[componentTypes.multiDataList] = [], _componentTypeToDefau[componentTypes.multiDropdownList] = [], _componentTypeToDefau[componentTypes.tagCloud] = '', _componentTypeToDefau[componentTypes.toggleButton] = '', _componentTypeToDefau[componentTypes.singleDropdownRange] = '', _componentTypeToDefau[componentTypes.multiDropdownRange] = [], _componentTypeToDefau[componentTypes.singleRange] = '', _componentTypeToDefau[componentTypes.multiRange] = [], _componentTypeToDefau);
30973
+
30974
+ /* isValidDateRangeQueryFormat() checks if the queryFormat is one of the dateFormats
30975
+ accepted by the elasticsearch or not. */
30976
+ function isValidDateRangeQueryFormat(queryFormat) {
30977
+ return Object.keys(dateFormats).includes(queryFormat);
30978
+ }
30979
+
30980
+ var _componentToTypeMap;
30981
+ var componentToTypeMap = (_componentToTypeMap = {}, _componentToTypeMap[componentTypes.reactiveList] = queryTypes.search, _componentToTypeMap[componentTypes.dataSearch] = queryTypes.search, _componentToTypeMap[componentTypes.categorySearch] = queryTypes.search, _componentToTypeMap[componentTypes.searchBox] = queryTypes.suggestion, _componentToTypeMap[componentTypes.singleList] = queryTypes.term, _componentToTypeMap[componentTypes.multiList] = queryTypes.term, _componentToTypeMap[componentTypes.singleDataList] = queryTypes.term, _componentToTypeMap[componentTypes.singleDropdownList] = queryTypes.term, _componentToTypeMap[componentTypes.multiDataList] = queryTypes.term, _componentToTypeMap[componentTypes.multiDropdownList] = queryTypes.term, _componentToTypeMap[componentTypes.tagCloud] = queryTypes.term, _componentToTypeMap[componentTypes.toggleButton] = queryTypes.term, _componentToTypeMap[componentTypes.reactiveChart] = queryTypes.term, _componentToTypeMap[componentTypes.treeList] = queryTypes.term, _componentToTypeMap[componentTypes.numberBox] = queryTypes.term, _componentToTypeMap[componentTypes.datePicker] = queryTypes.range, _componentToTypeMap[componentTypes.dateRange] = queryTypes.range, _componentToTypeMap[componentTypes.dynamicRangeSlider] = queryTypes.range, _componentToTypeMap[componentTypes.singleDropdownRange] = queryTypes.range, _componentToTypeMap[componentTypes.multiDropdownRange] = queryTypes.range, _componentToTypeMap[componentTypes.singleRange] = queryTypes.range, _componentToTypeMap[componentTypes.multiRange] = queryTypes.range, _componentToTypeMap[componentTypes.rangeSlider] = queryTypes.range, _componentToTypeMap[componentTypes.ratingsFilter] = queryTypes.range, _componentToTypeMap[componentTypes.rangeInput] = queryTypes.range, _componentToTypeMap[componentTypes.geoDistanceDropdown] = queryTypes.geo, _componentToTypeMap[componentTypes.geoDistanceSlider] = queryTypes.geo, _componentToTypeMap[componentTypes.reactiveMap] = queryTypes.geo, _componentToTypeMap);
30982
+ var multiRangeComponents = [componentTypes.multiRange, componentTypes.multiDropdownRange];
30983
+ var dateRangeComponents = [componentTypes.dateRange, componentTypes.datePicker];
30984
+ var searchComponents = [componentTypes.categorySearch, componentTypes.dataSearch, componentTypes.searchBox];
30985
+ var listComponentsWithPagination = [componentTypes.singleList, componentTypes.multiList, componentTypes.singleDropdownList, componentTypes.multiDropdownList];
30986
+ var getNormalizedField = function getNormalizedField(field) {
30987
+ if (field && !Array.isArray(field)) {
30988
+ return [field];
30989
+ }
30990
+ return field;
30991
+ };
30992
+ var isInternalComponent = function isInternalComponent(componentID) {
30993
+ if (componentID === void 0) {
30994
+ componentID = '';
30995
+ }
30996
+ return componentID.endsWith('__internal');
30997
+ };
30998
+ var getInternalComponentID = function getInternalComponentID(componentID) {
30999
+ if (componentID === void 0) {
31000
+ componentID = '';
31001
+ }
31002
+ return componentID + "__internal";
31003
+ };
31004
+ var getHistogramComponentID = function getHistogramComponentID(componentID) {
31005
+ if (componentID === void 0) {
31006
+ componentID = '';
31007
+ }
31008
+ return componentID + "__histogram__internal";
31009
+ };
31010
+ var isDRSRangeComponent = function isDRSRangeComponent(componentID) {
31011
+ if (componentID === void 0) {
31012
+ componentID = '';
31013
+ }
31014
+ return componentID.endsWith('__range__internal');
31015
+ };
31016
+ var isSearchComponent = function isSearchComponent(componentType) {
31017
+ if (componentType === void 0) {
31018
+ componentType = '';
31019
+ }
31020
+ return searchComponents.includes(componentType);
31021
+ };
31022
+ var isComponentUsesLabelAsValue = function isComponentUsesLabelAsValue(componentType) {
31023
+ if (componentType === void 0) {
31024
+ componentType = '';
31025
+ }
31026
+ return componentType === componentTypes.multiDataList || componentType === componentTypes.singleDataList || componentType === componentTypes.tabDataList;
31027
+ };
31028
+ var hasPaginationSupport = function hasPaginationSupport(componentType) {
31029
+ if (componentType === void 0) {
31030
+ componentType = '';
31031
+ }
31032
+ return listComponentsWithPagination.includes(componentType);
31033
+ };
31034
+ var getRSQuery = function getRSQuery(componentId, props, execute) {
31035
+ if (execute === void 0) {
31036
+ execute = true;
31037
+ }
31038
+ if (props && componentId) {
31039
+ var queryType = props.type ? props.type : componentToTypeMap[props.componentType];
31040
+ // dataField is a required field for components other than search
31041
+ // TODO: Revisit this logic based on the Appbase version
31042
+ // dataField is no longer a required field in RS API
31043
+ if (!isSearchComponent(props.componentType) && !props.dataField) {
31044
+ return null;
31045
+ }
31046
+ var endpoint;
31047
+ if (props.endpoint instanceof Object) {
31048
+ endpoint = props.endpoint;
31049
+ }
31050
+ return _extends({
31051
+ id: componentId,
31052
+ type: queryType || queryTypes.search,
31053
+ dataField: getNormalizedField(props.dataField),
31054
+ execute: execute,
31055
+ react: props.react,
31056
+ highlight: props.highlight,
31057
+ highlightField: getNormalizedField(props.highlightField),
31058
+ fuzziness: props.fuzziness,
31059
+ searchOperators: props.searchOperators,
31060
+ includeFields: props.includeFields,
31061
+ excludeFields: props.excludeFields,
31062
+ size: props.size,
31063
+ aggregationSize: props.aggregationSize,
31064
+ from: props.from || undefined,
31065
+ // Need to maintain for RL
31066
+ queryFormat: props.queryFormat,
31067
+ sortBy: props.sortBy,
31068
+ fieldWeights: getNormalizedField(props.fieldWeights),
31069
+ includeNullValues: props.includeNullValues,
31070
+ aggregationField: props.aggregationField || undefined,
31071
+ categoryField: props.categoryField || undefined,
31072
+ missingLabel: props.missingLabel || undefined,
31073
+ showMissing: props.showMissing,
31074
+ nestedField: props.nestedField || undefined,
31075
+ interval: props.interval,
31076
+ highlightConfig: props.customHighlight || props.highlightConfig,
31077
+ customQuery: props.customQuery,
31078
+ defaultQuery: props.defaultQuery,
31079
+ value: props.value,
31080
+ categoryValue: props.categoryValue || undefined,
31081
+ after: props.after || undefined,
31082
+ aggregations: props.aggregations || undefined,
31083
+ enableSynonyms: props.enableSynonyms,
31084
+ selectAllLabel: props.selectAllLabel,
31085
+ pagination: props.pagination,
31086
+ queryString: props.queryString,
31087
+ distinctField: props.distinctField,
31088
+ distinctFieldConfig: props.distinctFieldConfig,
31089
+ index: props.index
31090
+ }, queryType === queryTypes.suggestion ? _extends({
31091
+ enablePopularSuggestions: props.enablePopularSuggestions,
31092
+ enableEndpointSuggestions: props.enableEndpointSuggestions,
31093
+ enableRecentSuggestions: props.enableRecentSuggestions,
31094
+ popularSuggestionsConfig: props.popularSuggestionsConfig,
31095
+ recentSuggestionsConfig: props.recentSuggestionsConfig,
31096
+ applyStopwords: props.applyStopwords,
31097
+ customStopwords: props.customStopwords,
31098
+ enablePredictiveSuggestions: props.enablePredictiveSuggestions,
31099
+ featuredSuggestionsConfig: props.featuredSuggestionsConfig,
31100
+ indexSuggestionsConfig: props.indexSuggestionsConfig,
31101
+ enableFeaturedSuggestions: props.enableFeaturedSuggestions,
31102
+ enableIndexSuggestions: props.enableIndexSuggestions
31103
+ }, props.searchboxId ? {
31104
+ searchboxId: props.searchboxId
31105
+ } : {}) : {}, {
31106
+ calendarInterval: props.calendarInterval,
31107
+ endpoint: endpoint,
31108
+ range: props.range
31109
+ });
31110
+ }
31111
+ return null;
31112
+ };
31113
+ var extractPropsFromState = function extractPropsFromState(store, component, customOptions) {
31114
+ var componentProps = store.props[component];
31115
+ if (!componentProps) {
31116
+ return null;
31117
+ }
31118
+ var queryType = componentProps.type ? componentProps.type : componentToTypeMap[componentProps.componentType];
31119
+ var calcValues = store.selectedValues[component];
31120
+ var value = calcValues !== undefined && calcValues !== null ? calcValues.value : undefined;
31121
+ var queryFormat = componentProps.queryFormat;
31122
+ // calendarInterval only supported when using date types
31123
+ var calendarInterval;
31124
+ var interval = componentProps.interval;
31125
+ var type = queryType;
31126
+ var dataField = componentProps.dataField;
31127
+ var aggregations = componentProps.aggregations;
31128
+ var pagination; // pagination for `term` type of queries
31129
+ var from = componentProps.from; // offset for RL
31130
+ var range; // applicable for range components supporting histogram
31131
+
31132
+ // For term queries i.e list component `dataField` will be treated as aggregationField
31133
+ if (queryType === queryTypes.term) {
31134
+ // Only apply pagination prop for the components which supports it otherwise it can break the UI
31135
+ if (componentProps.showLoadMore && hasPaginationSupport(componentProps.componentType)) {
31136
+ pagination = true;
31137
+ }
31138
+ // Extract values from components that are type of objects
31139
+ // This code handles the controlled behavior in list components for e.g ToggleButton
31140
+ if (value != null && typeof value === 'object' && value.value) {
31141
+ value = value.value;
31142
+ } else if (Array.isArray(value)) {
31143
+ var parsedValue = [];
31144
+ value.forEach(function (val) {
31145
+ if (val != null && typeof val === 'object' && val.value) {
31146
+ parsedValue.push(val.value);
31147
+ } else {
31148
+ parsedValue.push(val);
31149
+ }
31150
+ });
31151
+ value = parsedValue;
31152
+ }
31153
+ }
31154
+ if (queryType === queryTypes.range) {
31155
+ if (Array.isArray(value)) {
31156
+ if (multiRangeComponents.includes(componentProps.componentType)) {
31157
+ value = value.map(function (_ref) {
31158
+ var start = _ref.start,
31159
+ end = _ref.end;
31160
+ return {
31161
+ start: start,
31162
+ end: end
31163
+ };
31164
+ });
31165
+ } else {
31166
+ value = {
31167
+ start: value[0],
31168
+ end: value[1]
31169
+ };
31170
+ }
31171
+ } else if (componentProps.showHistogram) {
31172
+ var internalComponentID = getInternalComponentID(component);
31173
+ var internalComponentValue = store.internalValues[internalComponentID];
31174
+ if (!internalComponentValue) {
31175
+ // Handle dynamic range slider
31176
+ var histogramComponentID = getHistogramComponentID(component);
31177
+ internalComponentValue = store.internalValues[histogramComponentID];
31178
+ }
31179
+ if (internalComponentValue && Array.isArray(internalComponentValue.value)) {
31180
+ value = {
31181
+ start: internalComponentValue.value[0],
31182
+ end: internalComponentValue.value[1]
31183
+ };
31184
+ }
31185
+ }
31186
+ if (isDRSRangeComponent(component)) {
31187
+ aggregations = ['min', 'max'];
31188
+ } else if (componentProps.showHistogram) {
31189
+ aggregations = ['histogram'];
31190
+ }
31191
+
31192
+ // handle number box, number box query changes based on the `queryFormat` value
31193
+ if (componentProps.componentType === componentTypes.dynamicRangeSlider || componentProps.componentType === componentTypes.rangeSlider) {
31194
+ calendarInterval = Object.keys(dateFormats).includes(queryFormat) ? componentProps.calendarInterval : undefined;
31195
+
31196
+ // Set value
31197
+ if (value) {
31198
+ if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
31199
+ // check if date types are dealt with
31200
+ value = {
31201
+ start: formatDate(dayjs_min(new Date(value.start)), componentProps),
31202
+ end: formatDate(dayjs_min(new Date(value.end)), componentProps)
31203
+ };
31204
+ } else {
31205
+ value = {
31206
+ start: parseFloat(value.start),
31207
+ end: parseFloat(value.end)
31208
+ };
31209
+ }
31210
+ }
31211
+ var rangeValue;
31212
+ if (componentProps.componentType === componentTypes.dynamicRangeSlider) {
31213
+ rangeValue = store.aggregations[component + "__range__internal"];
31214
+ if (componentProps.nestedField) {
31215
+ rangeValue = rangeValue && store.aggregations[component + "__range__internal"][componentProps.nestedField].min ? {
31216
+ start: store.aggregations[component + "__range__internal"][componentProps.nestedField].min.value,
31217
+ end: store.aggregations[component + "__range__internal"][componentProps.nestedField].max.value
31218
+ } // prettier-ignore
31219
+ : null;
31220
+ } else {
31221
+ rangeValue = rangeValue && store.aggregations[component + "__range__internal"].min ? {
31222
+ start: store.aggregations[component + "__range__internal"].min.value,
31223
+ end: store.aggregations[component + "__range__internal"].max.value
31224
+ } // prettier-ignore
31225
+ : null;
31226
+ }
31227
+ } else {
31228
+ rangeValue = componentProps.range;
31229
+ }
31230
+ if (rangeValue) {
31231
+ if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
31232
+ // check if date types are dealt with
31233
+ range = {
31234
+ start: formatDate(dayjs_min(rangeValue.start), componentProps),
31235
+ end: formatDate(dayjs_min(rangeValue.end), componentProps)
31236
+ };
31237
+ } else {
31238
+ range = {
31239
+ start: parseFloat(rangeValue.start),
31240
+ end: parseFloat(rangeValue.end)
31241
+ };
31242
+ }
31243
+ }
31244
+ }
31245
+
31246
+ // handle date components
31247
+ if (dateRangeComponents.includes(componentProps.componentType)) {
31248
+ // Set value
31249
+ if (value) {
31250
+ if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
31251
+ if (typeof value === 'string') {
31252
+ value = {
31253
+ // value would be an ISO Date string
31254
+ start: formatDate(dayjs_min(value).subtract(24, 'hour'), componentProps),
31255
+ end: formatDate(dayjs_min(value), componentProps)
31256
+ };
31257
+ } else if (Array.isArray(value)) {
31258
+ value = value.map(function (val) {
31259
+ return {
31260
+ // value would be one of ISO Date string, number, native date
31261
+ start: formatDate(dayjs_min(val).subtract(24, 'hour'), componentProps),
31262
+ end: formatDate(dayjs_min(val), componentProps)
31263
+ };
31264
+ });
31265
+ } else {
31266
+ value = {
31267
+ start: formatDate(dayjs_min(value.start).subtract(24, 'hour'), componentProps),
31268
+ end: formatDate(dayjs_min(value.end), componentProps)
31269
+ };
31270
+ }
31271
+ }
31272
+ }
31273
+ }
31274
+ }
31275
+ if (queryType === queryTypes.geo) {
31276
+ // override the value extracted from selectedValues reducer
31277
+ value = undefined;
31278
+ var geoCalcValues = store.selectedValues[component] || store.internalValues[component] || store.internalValues[getInternalComponentID(component)];
31279
+ if (geoCalcValues && geoCalcValues.meta) {
31280
+ if (geoCalcValues.meta.distance && geoCalcValues.meta.coordinates) {
31281
+ value = {
31282
+ distance: geoCalcValues.meta.distance,
31283
+ location: geoCalcValues.meta.coordinates
31284
+ };
31285
+ if (componentProps.unit) {
31286
+ value.unit = componentProps.unit;
31287
+ }
31288
+ }
31289
+ if (geoCalcValues.meta.mapBoxBounds && geoCalcValues.meta.mapBoxBounds.top_left && geoCalcValues.meta.mapBoxBounds.bottom_right) {
31290
+ value = {
31291
+ // Note: format will be reverse of what we're using now
31292
+ geoBoundingBox: {
31293
+ topLeft: geoCalcValues.meta.mapBoxBounds.top_left[1] + ", " + geoCalcValues.meta.mapBoxBounds.top_left[0],
31294
+ bottomRight: geoCalcValues.meta.mapBoxBounds.bottom_right[1] + ", " + geoCalcValues.meta.mapBoxBounds.bottom_right[0]
31295
+ }
31296
+ };
31297
+ }
31298
+ }
31299
+ }
31300
+ // handle number box, number box query changes based on the `queryFormat` value
31301
+ if (componentProps.componentType === componentTypes.numberBox) {
31302
+ if (queryFormat === 'exact') {
31303
+ type = 'term';
31304
+ } else {
31305
+ type = 'range';
31306
+ if (queryFormat === 'lte') {
31307
+ value = {
31308
+ end: value,
31309
+ boost: 2.0
31310
+ };
31311
+ } else {
31312
+ value = {
31313
+ start: value,
31314
+ boost: 2.0
31315
+ };
31316
+ }
31317
+ }
31318
+ // Remove query format
31319
+ queryFormat = 'or';
31320
+ }
31321
+ // Fake dataField for ReactiveComponent
31322
+ // TODO: Remove it after some time. The `dataField` is no longer required
31323
+ if (componentProps.componentType === componentTypes.reactiveComponent) {
31324
+ // Set the type to `term`
31325
+ type = 'term';
31326
+ dataField = 'reactive_component_field';
31327
+ // Don't set value property for ReactiveComponent
31328
+ // since it is driven by `defaultQuery` and `customQuery`
31329
+ value = undefined;
31330
+ }
31331
+ // Assign default value as an empty string for search components so search relevancy can work
31332
+ if (isSearchComponent(componentProps.componentType) && !value) {
31333
+ value = '';
31334
+ }
31335
+
31336
+ // Handle components which uses label instead of value as the selected value
31337
+ if (isComponentUsesLabelAsValue(componentProps.componentType)) {
31338
+ var data = componentProps.data,
31339
+ selectAllLabel = componentProps.selectAllLabel;
31340
+ var absValue = [];
31341
+ if (value && Array.isArray(value)) {
31342
+ absValue = value;
31343
+ } else if (value && typeof value === 'string') {
31344
+ absValue = [value];
31345
+ }
31346
+ var normalizedValue = [];
31347
+ if (absValue.length) {
31348
+ if (data && Array.isArray(data)) {
31349
+ absValue.forEach(function (val) {
31350
+ var dataItem = data.find(function (o) {
31351
+ return o.label === val;
30249
31352
  });
31353
+ if (dataItem && dataItem.value) {
31354
+ normalizedValue.push(dataItem.value);
31355
+ }
30250
31356
  });
31357
+ }
31358
+ }
31359
+ if (selectAllLabel && absValue.length && absValue.includes(selectAllLabel)) {
31360
+ normalizedValue = absValue;
31361
+ }
31362
+ if (normalizedValue.length) {
31363
+ value = normalizedValue;
31364
+ } else {
31365
+ value = undefined;
31366
+ }
31367
+ }
31368
+ if (componentProps.componentType === componentTypes.reactiveList) {
31369
+ // We set selected page as the value in the redux store for RL.
31370
+ // It's complex to change this logic in the component so changed it here.
31371
+ if (value > 0) {
31372
+ from = (value - 1) * (componentProps.size || 10);
31373
+ }
31374
+ value = undefined;
31375
+ }
31376
+ var queryValue = value || undefined;
31377
+ if (componentProps.componentType === componentTypes.searchBox) {
31378
+ if (Array.isArray(queryValue)) {
31379
+ queryValue = undefined;
31380
+ }
31381
+ }
31382
+ var endpoint;
31383
+ if (componentProps.endpoint instanceof Object) {
31384
+ endpoint = _extends({}, endpoint || {}, componentProps.endpoint);
31385
+ }
31386
+ return _extends({}, componentProps, {
31387
+ endpoint: endpoint,
31388
+ calendarInterval: calendarInterval,
31389
+ dataField: dataField,
31390
+ queryFormat: queryFormat,
31391
+ type: type,
31392
+ aggregations: aggregations,
31393
+ interval: interval,
31394
+ react: store.dependencyTree ? store.dependencyTree[component] : undefined,
31395
+ customQuery: store.customQueries ? store.customQueries[component] : undefined,
31396
+ defaultQuery: store.defaultQueries ? store.defaultQueries[component] : undefined,
31397
+ customHighlight: store.customHighlightOptions ? store.customHighlightOptions[component] : undefined,
31398
+ categoryValue: store.internalValues[component] ? store.internalValues[component].category : undefined,
31399
+ value: queryValue,
31400
+ pagination: pagination,
31401
+ from: from,
31402
+ range: range
31403
+ }, customOptions);
31404
+ };
31405
+ function flatReactProp(reactProp, componentID) {
31406
+ var flattenReact = [];
31407
+ var flatReact = function flatReact(react) {
31408
+ if (react && Object.keys(react)) {
31409
+ Object.keys(react).forEach(function (r) {
31410
+ if (react[r]) {
31411
+ if (typeof react[r] === 'string') {
31412
+ flattenReact = [].concat(flattenReact, [react[r]]);
31413
+ } else if (Array.isArray(react[r])) {
31414
+ flattenReact = [].concat(flattenReact, react[r]);
31415
+ } else if (typeof react[r] === 'object') {
31416
+ flatReact(react[r]);
31417
+ }
31418
+ }
30251
31419
  });
30252
- Promise.all(allPromises).then(function () {
30253
- state = _extends({}, state, {
30254
- hits: hits,
30255
- aggregations: aggregations
31420
+ }
31421
+ };
31422
+ flatReact(reactProp);
31423
+ // Remove cyclic dependencies
31424
+ flattenReact = flattenReact.filter(function (react) {
31425
+ return react !== componentID;
31426
+ });
31427
+ return flattenReact;
31428
+ }
31429
+ var getDependentQueries = function getDependentQueries(store, componentID, orderOfQueries) {
31430
+ if (orderOfQueries === void 0) {
31431
+ orderOfQueries = [];
31432
+ }
31433
+ var finalQuery = {};
31434
+ var react = flatReactProp(store.dependencyTree[componentID], componentID);
31435
+ react.forEach(function (componentObject) {
31436
+ var component = componentObject;
31437
+ var customQuery = store.customQueries[component];
31438
+ if (!isInternalComponent(component)) {
31439
+ var calcValues = store.selectedValues[component] || store.internalValues[component];
31440
+ // Only include queries for that component that has `customQuery` or `value` defined
31441
+ if ((calcValues && calcValues.value || customQuery) && !finalQuery[component]) {
31442
+ var execute = false;
31443
+ if (Array.isArray(orderOfQueries) && orderOfQueries.includes(component)) {
31444
+ execute = true;
31445
+ }
31446
+ var componentProps = store.props[component];
31447
+ // build query
31448
+ var dependentQuery = getRSQuery(component, extractPropsFromState(store, component, _extends({}, componentProps && _extends({}, componentProps.componentType === componentTypes.searchBox ? _extends({}, execute === false ? {
31449
+ type: queryTypes.search
31450
+ } : {}, calcValues.category ? {
31451
+ categoryValue: calcValues.category
31452
+ } : {
31453
+ categoryValue: undefined
31454
+ }, calcValues.value ? {
31455
+ value: calcValues.value
31456
+ } : {}) : {}, componentProps.componentType === componentTypes.categorySearch ? _extends({}, calcValues.category ? {
31457
+ categoryValue: calcValues.category
31458
+ } : {
31459
+ categoryValue: undefined
31460
+ }) : {}))), execute);
31461
+ if (dependentQuery) {
31462
+ finalQuery[component] = dependentQuery;
31463
+ }
31464
+ }
31465
+ }
31466
+ });
31467
+ return finalQuery;
31468
+ };
31469
+
31470
+ var handleTransformResponse = function handleTransformResponse(res, config, component) {
31471
+ if (res === void 0) {
31472
+ res = null;
31473
+ }
31474
+ if (config === void 0) {
31475
+ config = {};
31476
+ }
31477
+ if (component === void 0) {
31478
+ component = '';
31479
+ }
31480
+ if (config.transformResponse && typeof config.transformResponse === 'function') {
31481
+ return config.transformResponse(res, component);
31482
+ }
31483
+ return new Promise(function (resolve) {
31484
+ return resolve(res);
31485
+ });
31486
+ };
31487
+
31488
+ var isPropertyDefined = function isPropertyDefined(property) {
31489
+ return property !== undefined && property !== null;
31490
+ };
31491
+
31492
+ var _excluded$a = ["value"];
31493
+ function valueReducer(state, action) {
31494
+ var _extends3;
31495
+ if (state === void 0) {
31496
+ state = {};
31497
+ }
31498
+ switch (action.type) {
31499
+ case SET_VALUE:
31500
+ {
31501
+ var _extends2;
31502
+ var newState = {};
31503
+ Object.keys(action.componentsToReset || {}).forEach(function (id) {
31504
+ newState[id] = _extends({}, state[id], {
31505
+ value: action.componentsToReset[id]
31506
+ });
30256
31507
  });
30257
- resolve(state);
31508
+ return _extends({}, state, newState, (_extends2 = {}, _extends2[action.component] = {
31509
+ value: action.value,
31510
+ label: action.label || action.component,
31511
+ showFilter: action.showFilter,
31512
+ URLParams: action.URLParams,
31513
+ componentType: action.componentType,
31514
+ category: action.category,
31515
+ meta: action.meta,
31516
+ reference: action.reference
31517
+ }, _extends2));
31518
+ }
31519
+ case SET_VALUES:
31520
+ {
31521
+ var componentKeys = action.componentsValues ? Object.keys(action.componentsValues) : [];
31522
+ if (componentKeys.length) {
31523
+ var _newState = {};
31524
+ componentKeys.forEach(function (component) {
31525
+ var _action$componentsVal = action.componentsValues[component],
31526
+ value = _action$componentsVal.value,
31527
+ rest = _objectWithoutPropertiesLoose(_action$componentsVal, _excluded$a);
31528
+ _newState[component] = _extends({}, state[component], {
31529
+ value: value
31530
+ }, rest);
31531
+ });
31532
+ return _extends({}, state, _newState);
31533
+ }
31534
+ return state;
31535
+ }
31536
+ case PATCH_VALUE:
31537
+ return _extends({}, state, (_extends3 = {}, _extends3[action.component] = _extends({}, state[action.component], action.payload), _extends3));
31538
+ case CLEAR_VALUES:
31539
+ {
31540
+ var nextState = {};
31541
+ if (action.resetValues) {
31542
+ Object.keys(action.resetValues).forEach(function (componentId) {
31543
+ nextState[componentId] = _extends({}, state[componentId], {
31544
+ value: action.resetValues[componentId]
31545
+ });
31546
+ });
31547
+ }
31548
+ // clearAllBlacklistComponents has more priority over reset values
31549
+ if (Array.isArray(action.clearAllBlacklistComponents)) {
31550
+ Object.keys(state).forEach(function (componentId) {
31551
+ if (action.clearAllBlacklistComponents.includes(componentId)) {
31552
+ nextState[componentId] = state[componentId];
31553
+ }
31554
+ });
31555
+ }
31556
+ return nextState;
31557
+ }
31558
+ case REMOVE_COMPONENT:
31559
+ {
31560
+ var _state2 = state,
31561
+ _action$component2 = action.component,
31562
+ del = _state2[_action$component2],
31563
+ obj = _objectWithoutPropertiesLoose(_state2, [_action$component2].map(_toPropertyKey$1));
31564
+ return obj;
31565
+ }
31566
+ case RESET_TO_DEFAULT:
31567
+ return _extends({}, state, action.defaultValues);
31568
+ default:
31569
+ return state;
31570
+ }
31571
+ }
31572
+
31573
+ var _excluded$b = ["value"];
31574
+ function getValue(state, id, defaultValue) {
31575
+ if (state && state[id]) {
31576
+ try {
31577
+ // parsing for next.js - since it uses extra set of quotes to wrap params
31578
+ var parsedValue = JSON.parse(state[id]);
31579
+ return _extends({}, typeof parsedValue === 'object' && parsedValue.value ? _extends({
31580
+ value: parsedValue.value
31581
+ }, parsedValue.category ? {
31582
+ category: parsedValue.category
31583
+ } : {}) : {
31584
+ value: parsedValue
31585
+ }, {
31586
+ reference: 'URL'
30258
31587
  });
30259
- };
30260
- var handleRSResponse = function handleRSResponse(res) {
30261
- var promotedResults = {};
30262
- var rawData = {};
30263
- var customData = {};
30264
- var settingsResponse = {};
30265
- var timestamp = {};
30266
- var allPromises = orderOfQueries.map(function (component) {
30267
- return new Promise(function (responseResolve, responseReject) {
30268
- handleTransformResponse(res[component], component).then(function (response) {
30269
- if (response) {
30270
- var _extends7;
30271
- if (response.promoted) {
30272
- promotedResults[component] = response.promoted.map(function (promoted) {
30273
- return _extends({}, promoted.doc, {
30274
- _position: promoted.position
30275
- });
31588
+ } catch (error) {
31589
+ // using react-dom-server for ssr
31590
+ return {
31591
+ value: state[id],
31592
+ reference: 'URL'
31593
+ };
31594
+ }
31595
+ }
31596
+ return {
31597
+ value: defaultValue,
31598
+ reference: 'DEFAULT'
31599
+ };
31600
+ }
31601
+
31602
+ // parse query string
31603
+ // ref: https://stackoverflow.com/a/13896633/10822996
31604
+ function parseQuery(str) {
31605
+ if (str instanceof Object) {
31606
+ return str;
31607
+ }
31608
+ if (typeof str !== 'string' || str.length === 0) return {};
31609
+ var s;
31610
+ if (str.split('/?')[1]) {
31611
+ s = str.split('/?')[1].split('&');
31612
+ }
31613
+ if (str.split('?')[1]) {
31614
+ s = str.split('?')[1].split('&');
31615
+ }
31616
+ if (!s) return {};
31617
+ var sLength = s.length;
31618
+ var bit;
31619
+ var query = {};
31620
+ var first;
31621
+ var second;
31622
+ for (var i = 0; i < sLength; i += 1) {
31623
+ bit = s[i].split('=');
31624
+ first = decodeURIComponent(bit[0]);
31625
+ // eslint-disable-next-line no-continue
31626
+ if (first.length === 0) continue;
31627
+ second = decodeURIComponent(bit[1]);
31628
+ if (typeof query[first] === 'undefined') query[first] = second;else if (query[first] instanceof Array) query[first].push(second);else query[first] = [query[first], second];
31629
+ }
31630
+ return query;
31631
+ }
31632
+ var getServerResults = function getServerResults() {
31633
+ var storeReference = null;
31634
+ return function (App, queryString, ssrRenderFunc) {
31635
+ if (queryString === void 0) {
31636
+ queryString = '';
31637
+ }
31638
+ try {
31639
+ // parse the query String to respect url params in SSR
31640
+ var parsedQueryString = parseQuery(queryString);
31641
+ if (!storeReference) {
31642
+ var newSelectedValues = {};
31643
+ // callback function to collect SearchBase context
31644
+ var contextCollector = function contextCollector(params) {
31645
+ if (params.ctx) {
31646
+ // store collected
31647
+ storeReference = params.ctx;
31648
+
31649
+ // collect selected values from the URL query string
31650
+ Object.keys(parsedQueryString).forEach(function (componentId) {
31651
+ var _getValue = getValue(parsedQueryString, componentId, null),
31652
+ value = _getValue.value,
31653
+ reference = _getValue.reference;
31654
+ if (value) {
31655
+ newSelectedValues = valueReducer(newSelectedValues, {
31656
+ type: 'PATCH_VALUE',
31657
+ component: componentId,
31658
+ payload: {
31659
+ value: value,
31660
+ reference: reference
31661
+ }
30276
31662
  });
30277
31663
  }
30278
- rawData[component] = response;
30279
- // Update custom data
30280
- if (response.customData) {
30281
- customData[component] = response.customData;
31664
+ });
31665
+ }
31666
+ return {
31667
+ // send back to ReactiveBase to hydrate the store with values from queryParams(if present)
31668
+ selectedValues: newSelectedValues
31669
+ };
31670
+ };
31671
+
31672
+ // render the app server-side to collect context and build initial state
31673
+ // for hydration on client side
31674
+ // in case of React, ssrRenderFunc === renderToString || renderToStaticMarkup
31675
+ // in case of Vue, ssrRenderFunc === renderToString (import { renderToString } from 'vue/server-renderer')
31676
+ var output = ssrRenderFunc(App({
31677
+ contextCollector: contextCollector
31678
+ }));
31679
+ var promiseFunc;
31680
+ if (!output.then) {
31681
+ promiseFunc = Promise.resolve(promiseFunc);
31682
+ } else {
31683
+ promiseFunc = output;
31684
+ }
31685
+ return promiseFunc.then(function () {
31686
+ if (storeReference) {
31687
+ var extractedState = storeReference.getState();
31688
+ var components = extractedState.components,
31689
+ config = extractedState.config,
31690
+ appbaseRef = extractedState.appbaseRef,
31691
+ queryOptions = extractedState.queryOptions,
31692
+ internalValues = extractedState.internalValues,
31693
+ props = extractedState.props,
31694
+ queryList = extractedState.queryList,
31695
+ dependencyTree = extractedState.dependencyTree;
31696
+ var queryLog = extractedState.queryLog;
31697
+ var finalQuery = [];
31698
+ var appbaseQuery = {}; // Use object to prevent duplicate query added by react prop
31699
+ var orderOfQueries = [];
31700
+ var hits = {};
31701
+ var aggregations = {};
31702
+ var state = _extends({}, extractedState);
31703
+
31704
+ // Generate finalQuery for search
31705
+ components.filter(function (t) {
31706
+ return !t.endsWith('__internal');
31707
+ }).forEach(function (componentId) {
31708
+ // eslint-disable-next-line
31709
+ var _buildQuery = buildQuery(componentId, dependencyTree, queryList, queryOptions),
31710
+ queryObj = _buildQuery.queryObj,
31711
+ options = _buildQuery.options;
31712
+ if (!queryObj && !options) {
31713
+ return;
30282
31714
  }
31715
+ var query = getRSQuery(componentId, extractPropsFromState(state, componentId, queryOptions && queryOptions[componentId] ? {
31716
+ from: queryOptions[componentId].from
31717
+ } : null));
30283
31718
 
30284
- // Update settings
30285
- if (response.settings) {
30286
- settingsResponse[component] = response.settings;
31719
+ // check if query or options are valid - non-empty
31720
+ if (query && !!Object.keys(query).length) {
31721
+ var _extends2, _extends6;
31722
+ var currentQuery = query;
31723
+ var dependentQueries = getDependentQueries(state, componentId, orderOfQueries);
31724
+ var queryToLog = _extends({}, (_extends2 = {}, _extends2[componentId] = currentQuery, _extends2), Object.keys(dependentQueries).reduce(function (acc, q) {
31725
+ var _extends3;
31726
+ return _extends({}, acc, (_extends3 = {}, _extends3[q] = _extends({}, dependentQueries[q], {
31727
+ execute: false
31728
+ }, dependentQueries[q].type === queryTypes.suggestion ? {
31729
+ type: 'search'
31730
+ } : {}), _extends3));
31731
+ }, {}));
31732
+ if ([queryTypes.range, queryTypes.term].includes(componentToTypeMap[props[componentId].componentType])) {
31733
+ var _extends4;
31734
+ // Avoid logging `value` for term type of components
31735
+ // eslint-disable-next-line
31736
+ var value = currentQuery.value,
31737
+ rest = _objectWithoutPropertiesLoose(currentQuery, _excluded$b);
31738
+ queryToLog = _extends({}, (_extends4 = {}, _extends4[componentId] = rest, _extends4), Object.keys(dependentQueries).reduce(function (acc, q) {
31739
+ var _extends5;
31740
+ return _extends({}, acc, (_extends5 = {}, _extends5[q] = _extends({}, dependentQueries[q], {
31741
+ execute: false
31742
+ }, dependentQueries[q].type === queryTypes.suggestion ? {
31743
+ type: 'search'
31744
+ } : {}), _extends5));
31745
+ }, {}));
31746
+ }
31747
+ // if (!compareQueries(queryToLog, currentQuery, false)) {
31748
+ orderOfQueries = [].concat(orderOfQueries, [componentId]);
31749
+ queryLog = _extends({}, queryLog, (_extends6 = {}, _extends6[componentId] = queryToLog, _extends6));
31750
+ // }
31751
+
31752
+ if (query) {
31753
+ var _extends7;
31754
+ // Apply dependent queries
31755
+ var dependentQueriesToAppend = getDependentQueries(state, componentId, orderOfQueries);
31756
+ appbaseQuery = _extends({}, appbaseQuery, (_extends7 = {}, _extends7[componentId] = query, _extends7));
31757
+ Object.keys(dependentQueriesToAppend).forEach(function (cId) {
31758
+ if (appbaseQuery[cId]) {
31759
+ appbaseQuery[cId + Math.random()] = dependentQueriesToAppend[cId];
31760
+ } else {
31761
+ appbaseQuery[cId] = dependentQueriesToAppend[cId];
31762
+ }
31763
+ });
31764
+ }
30287
31765
  }
30288
- if (response.aggregations) {
30289
- var _extends6;
30290
- aggregations = _extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
31766
+ });
31767
+ var handleRSResponse = function handleRSResponse(res) {
31768
+ var promotedResults = {};
31769
+ var rawData = {};
31770
+ var customData = {};
31771
+ var allPromises = orderOfQueries.map(function (component) {
31772
+ return new Promise(function (responseResolve, responseReject) {
31773
+ handleTransformResponse(res[component], config, component).then(function (response) {
31774
+ if (response) {
31775
+ var _extends9;
31776
+ if (response.promoted) {
31777
+ promotedResults[component] = response.promoted.map(function (promoted) {
31778
+ return _extends({}, promoted.doc, {
31779
+ _position: promoted.position
31780
+ });
31781
+ });
31782
+ }
31783
+ rawData[component] = response;
31784
+ // Update custom data
31785
+ if (response.customData) {
31786
+ customData[component] = response.customData;
31787
+ }
31788
+ if (response.aggregations) {
31789
+ var _extends8;
31790
+ aggregations = _extends({}, aggregations, (_extends8 = {}, _extends8[component] = response.aggregations, _extends8));
31791
+ }
31792
+ var hitsObj = response.hits || {};
31793
+ hits = _extends({}, hits, (_extends9 = {}, _extends9[component] = {
31794
+ hits: hitsObj.hits,
31795
+ total: typeof hitsObj.total === 'object' ? hitsObj.total.value : hitsObj.total,
31796
+ time: response.took
31797
+ }, _extends9));
31798
+ responseResolve();
31799
+ }
31800
+ })["catch"](function (err) {
31801
+ responseReject(err);
31802
+ });
31803
+ });
31804
+ });
31805
+ return Promise.all(allPromises).then(function () {
31806
+ state = {
31807
+ queryList: queryList,
31808
+ queryOptions: queryOptions,
31809
+ selectedValues: newSelectedValues,
31810
+ internalValues: internalValues,
31811
+ queryLog: queryLog,
31812
+ hits: hits,
31813
+ aggregations: aggregations,
31814
+ promotedResults: promotedResults,
31815
+ customData: customData,
31816
+ rawData: rawData,
31817
+ dependencyTree: dependencyTree
31818
+ };
31819
+ return Promise.resolve(JSON.parse(JSON.stringify(state)));
31820
+ });
31821
+ };
31822
+ if (Object.keys(appbaseQuery).length) {
31823
+ finalQuery = Object.values(appbaseQuery);
31824
+ // Call RS API
31825
+ var rsAPISettings = {};
31826
+ if (config.analyticsConfig) {
31827
+ rsAPISettings.recordAnalytics = isPropertyDefined(config.analyticsConfig.recordAnalytics) ? config.analyticsConfig.recordAnalytics : undefined;
31828
+ rsAPISettings.userId = isPropertyDefined(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
31829
+ rsAPISettings.enableQueryRules = isPropertyDefined(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
31830
+ rsAPISettings.customEvents = isPropertyDefined(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
30291
31831
  }
30292
- timestamp[component] = res._timestamp;
30293
- var hitsObj = response.hits ? response.hits : response[component].hits;
30294
- hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
30295
- hits: hitsObj.hits,
30296
- total: typeof hitsObj.total === 'object' ? hitsObj.total.value : hitsObj.total,
30297
- time: response.took
30298
- }, _extends7));
30299
- responseResolve();
31832
+ return appbaseRef.reactiveSearchv3(finalQuery, rsAPISettings).then(function (res) {
31833
+ return handleRSResponse(res);
31834
+ })["catch"](function (err) {
31835
+ return Promise.reject(err);
31836
+ });
30300
31837
  }
30301
- })["catch"](function (err) {
30302
- return responseReject(err);
30303
- });
30304
- });
30305
- });
30306
- Promise.all(allPromises).then(function () {
30307
- state = _extends({}, state, {
30308
- hits: hits,
30309
- timestamp: timestamp,
30310
- aggregations: aggregations,
30311
- compositeAggregations: compositeAggregations,
30312
- promotedResults: promotedResults,
30313
- settings: settingsResponse,
30314
- customData: customData,
30315
- rawData: rawData
30316
- });
30317
- resolve(state);
30318
- });
30319
- };
30320
- if (config.graphQLUrl) {
30321
- var handleTransformRequest = function handleTransformRequest(res) {
30322
- if (config.transformRequest && typeof config.transformRequest === 'function') {
30323
- var transformRequestPromise = config.transformRequest(res);
30324
- return transformRequestPromise instanceof Promise ? transformRequestPromise : Promise.resolve(transformRequestPromise);
30325
- }
30326
- return Promise.resolve(res);
30327
- };
30328
- handleTransformRequest(finalQuery).then(function (requestQuery) {
30329
- fetchGraphQL(config.graphQLUrl, config.url, config.credentials, config.app, requestQuery).then(function (res) {
30330
- handleResponse(res);
30331
- })["catch"](function (err) {
30332
- return reject(err);
31838
+ throw new Error('Could not compute server-side initial state of the app!');
31839
+ } else {
31840
+ return null;
31841
+ }
30333
31842
  });
30334
- })["catch"](function (err) {
30335
- return reject(err);
30336
- });
30337
- } else if (Object.keys(appbaseQuery).length) {
30338
- finalQuery = Object.keys(appbaseQuery).map(function (c) {
30339
- return appbaseQuery[c];
30340
- });
30341
- // Call RS API
30342
- var rsAPISettings = {};
30343
- if (config.analyticsConfig) {
30344
- rsAPISettings.recordAnalytics = utils_2(config.analyticsConfig.recordAnalytics) ? config.analyticsConfig.recordAnalytics : undefined;
30345
- rsAPISettings.userId = utils_2(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
30346
- rsAPISettings.enableQueryRules = utils_2(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
30347
- rsAPISettings.customEvents = utils_2(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
30348
31843
  }
30349
- appbaseRef.reactiveSearchv3(finalQuery, rsAPISettings).then(function (res) {
30350
- handleRSResponse(res);
30351
- })["catch"](function (err) {
30352
- return reject(err);
30353
- });
31844
+ return null;
31845
+ } catch (error) {
31846
+ return Promise.reject(error);
30354
31847
  }
30355
- });
31848
+ };
31849
+ };
31850
+
31851
+ function getServerState(App, queryString) {
31852
+ var renderFunction = renderToString;
31853
+ return getServerResults()(function (props) {
31854
+ return vue.createSSRApp(App, props);
31855
+ }, queryString, renderFunction);
30356
31856
  }
30357
31857
 
30358
- var version$1 = "3.0.0-alpha.1";
31858
+ var version = "3.0.0-alpha.3";
30359
31859
 
30360
31860
  var components = [RLConnected, ResultCard, ResultList, ReactiveBase, SBConnected, ListConnected, ListConnected$1, RangeConnected$1, RangeConnected$2, RangeConnected$3, RangeConnected, RcConnected, RcConnected$1, TBConnected, ListConnected$2, ListConnected$3, StateProviderConnected, RangeConnected$4];
30361
31861
  function install$1 (Vue) {
@@ -30370,7 +31870,7 @@
30370
31870
  install$1(window.Vue);
30371
31871
  }
30372
31872
  var index$1 = {
30373
- version: version$1,
31873
+ version: version,
30374
31874
  install: install$1
30375
31875
  };
30376
31876
 
@@ -30395,9 +31895,9 @@
30395
31895
  exports.ToggleButton = TBConnected;
30396
31896
  exports.componentTypes = constants_1$1;
30397
31897
  exports.default = index$1;
30398
- exports.initReactivesearch = initReactivesearch;
31898
+ exports.getServerState = getServerState;
30399
31899
  exports.install = install$1;
30400
- exports.version = version$1;
31900
+ exports.version = version;
30401
31901
 
30402
31902
  Object.defineProperty(exports, '__esModule', { value: true });
30403
31903