stream-chat-react 9.1.5 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/browser.full-bundle.js +810 -265
  2. package/dist/browser.full-bundle.js.map +1 -1
  3. package/dist/browser.full-bundle.min.js +4 -4
  4. package/dist/browser.full-bundle.min.js.map +1 -1
  5. package/dist/components/Channel/channelState.d.ts.map +1 -1
  6. package/dist/components/Channel/channelState.js +2 -2
  7. package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts +12 -1
  8. package/dist/components/ChatAutoComplete/ChatAutoComplete.d.ts.map +1 -1
  9. package/dist/components/Message/Message.d.ts.map +1 -1
  10. package/dist/components/Message/Message.js +1 -1
  11. package/dist/components/Message/MessageStatus.d.ts +2 -0
  12. package/dist/components/Message/MessageStatus.d.ts.map +1 -1
  13. package/dist/components/Message/MessageStatus.js +4 -4
  14. package/dist/components/Message/types.d.ts +2 -0
  15. package/dist/components/Message/types.d.ts.map +1 -1
  16. package/dist/components/Message/utils.d.ts +10 -1
  17. package/dist/components/Message/utils.d.ts.map +1 -1
  18. package/dist/components/Message/utils.js +13 -4
  19. package/dist/components/MessageInput/hooks/useSubmitHandler.d.ts.map +1 -1
  20. package/dist/components/MessageInput/hooks/useSubmitHandler.js +1 -1
  21. package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
  22. package/dist/components/MessageList/VirtualizedMessageList.js +2 -2
  23. package/dist/context/MessageContext.d.ts +2 -0
  24. package/dist/context/MessageContext.d.ts.map +1 -1
  25. package/dist/index.cjs.js +43 -18
  26. package/dist/index.cjs.js.map +1 -1
  27. package/dist/stories/message-status-readby-tooltip.stories.d.ts +4 -0
  28. package/dist/stories/message-status-readby-tooltip.stories.d.ts.map +1 -0
  29. package/dist/stories/message-status-readby-tooltip.stories.js +58 -0
  30. package/dist/stories/navigate-long-message-lists.stories.d.ts.map +1 -1
  31. package/dist/stories/navigate-long-message-lists.stories.js +22 -2
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js +17 -2
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/package.json +6 -4
@@ -13555,346 +13555,681 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
13555
13555
  var linkifyjs = linkify;
13556
13556
  var linkifyjs_1 = linkifyjs.find;
13557
13557
 
13558
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
13559
- var convert_1 = convert;
13560
-
13561
- function convert(test) {
13562
- if (test == null) {
13563
- return ok
13564
- }
13558
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function escapeStringRegexp(string) {
13559
+ if (typeof string !== 'string') {
13560
+ throw new TypeError('Expected a string');
13561
+ }
13565
13562
 
13566
- if (typeof test === 'string') {
13567
- return typeFactory(test)
13568
- }
13563
+ // Escape characters with special meaning either inside or outside character sets.
13564
+ // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
13565
+ return string
13566
+ .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
13567
+ .replace(/-/g, '\\x2d');
13568
+ }
13569
13569
 
13570
- if (typeof test === 'object') {
13571
- return 'length' in test ? anyFactory(test) : allFactory(test)
13572
- }
13570
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
13571
+ * @typedef {import('unist').Node} Node
13572
+ * @typedef {import('unist').Parent} Parent
13573
+ *
13574
+ * @typedef {string} Type
13575
+ * @typedef {Object<string, unknown>} Props
13576
+ *
13577
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
13578
+ */
13573
13579
 
13574
- if (typeof test === 'function') {
13575
- return test
13576
- }
13580
+ const convert$2 =
13581
+ /**
13582
+ * @type {(
13583
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
13584
+ * ((test?: Test) => AssertAnything)
13585
+ * )}
13586
+ */
13587
+ (
13588
+ /**
13589
+ * Generate an assertion from a check.
13590
+ * @param {Test} [test]
13591
+ * When nullish, checks if `node` is a `Node`.
13592
+ * When `string`, works like passing `function (node) {return node.type === test}`.
13593
+ * When `function` checks if function passed the node is true.
13594
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
13595
+ * When `array`, checks any one of the subtests pass.
13596
+ * @returns {AssertAnything}
13597
+ */
13598
+ function (test) {
13599
+ if (test === undefined || test === null) {
13600
+ return ok$2
13601
+ }
13577
13602
 
13578
- throw new Error('Expected function, string, or object as test')
13579
- }
13603
+ if (typeof test === 'string') {
13604
+ return typeFactory$2(test)
13605
+ }
13580
13606
 
13581
- // Utility assert each property in `test` is represented in `node`, and each
13582
- // values are strictly equal.
13583
- function allFactory(test) {
13584
- return all
13607
+ if (typeof test === 'object') {
13608
+ return Array.isArray(test) ? anyFactory$2(test) : propsFactory$1(test)
13609
+ }
13585
13610
 
13586
- function all(node) {
13587
- var key;
13611
+ if (typeof test === 'function') {
13612
+ return castFactory$1(test)
13613
+ }
13588
13614
 
13589
- for (key in test) {
13590
- if (node[key] !== test[key]) return false
13615
+ throw new Error('Expected function, string, or object as test')
13591
13616
  }
13592
-
13593
- return true
13594
- }
13595
- }
13596
-
13597
- function anyFactory(tests) {
13598
- var checks = [];
13599
- var index = -1;
13617
+ );
13618
+ /**
13619
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
13620
+ * @returns {AssertAnything}
13621
+ */
13622
+ function anyFactory$2(tests) {
13623
+ /** @type {Array.<AssertAnything>} */
13624
+ const checks = [];
13625
+ let index = -1;
13600
13626
 
13601
13627
  while (++index < tests.length) {
13602
- checks[index] = convert(tests[index]);
13628
+ checks[index] = convert$2(tests[index]);
13603
13629
  }
13604
13630
 
13605
- return any
13631
+ return castFactory$1(any)
13606
13632
 
13607
- function any() {
13608
- var index = -1;
13633
+ /**
13634
+ * @this {unknown}
13635
+ * @param {unknown[]} parameters
13636
+ * @returns {boolean}
13637
+ */
13638
+ function any(...parameters) {
13639
+ let index = -1;
13609
13640
 
13610
13641
  while (++index < checks.length) {
13611
- if (checks[index].apply(this, arguments)) {
13612
- return true
13613
- }
13642
+ if (checks[index].call(this, ...parameters)) return true
13614
13643
  }
13615
13644
 
13616
13645
  return false
13617
13646
  }
13618
13647
  }
13619
13648
 
13620
- // Utility to convert a string into a function which checks a given node’s type
13621
- // for said string.
13622
- function typeFactory(test) {
13623
- return type
13649
+ /**
13650
+ * Utility to assert each property in `test` is represented in `node`, and each
13651
+ * values are strictly equal.
13652
+ *
13653
+ * @param {Props} check
13654
+ * @returns {AssertAnything}
13655
+ */
13656
+ function propsFactory$1(check) {
13657
+ return castFactory$1(all)
13624
13658
 
13625
- function type(node) {
13626
- return Boolean(node && node.type === test)
13627
- }
13628
- }
13659
+ /**
13660
+ * @param {Node} node
13661
+ * @returns {boolean}
13662
+ */
13663
+ function all(node) {
13664
+ /** @type {string} */
13665
+ let key;
13629
13666
 
13630
- // Utility to return true.
13631
- function ok() {
13632
- return true
13633
- }
13667
+ for (key in check) {
13668
+ // @ts-expect-error: hush, it sure works as an index.
13669
+ if (node[key] !== check[key]) return false
13670
+ }
13634
13671
 
13635
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var color_1 = color;
13636
- function color(d) {
13637
- return '\u001B[33m' + d + '\u001B[39m'
13672
+ return true
13673
+ }
13638
13674
  }
13639
13675
 
13640
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
13641
- var unistUtilVisitParents$1 = visitParents$1;
13676
+ /**
13677
+ * Utility to convert a string into a function which checks a given node’s type
13678
+ * for said string.
13679
+ *
13680
+ * @param {Type} check
13681
+ * @returns {AssertAnything}
13682
+ */
13683
+ function typeFactory$2(check) {
13684
+ return castFactory$1(type)
13642
13685
 
13686
+ /**
13687
+ * @param {Node} node
13688
+ */
13689
+ function type(node) {
13690
+ return node && node.type === check
13691
+ }
13692
+ }
13643
13693
 
13694
+ /**
13695
+ * Utility to convert a string into a function which checks a given node’s type
13696
+ * for said string.
13697
+ * @param {TestFunctionAnything} check
13698
+ * @returns {AssertAnything}
13699
+ */
13700
+ function castFactory$1(check) {
13701
+ return assertion
13644
13702
 
13703
+ /**
13704
+ * @this {unknown}
13705
+ * @param {Array.<unknown>} parameters
13706
+ * @returns {boolean}
13707
+ */
13708
+ function assertion(...parameters) {
13709
+ // @ts-expect-error: spreading is fine.
13710
+ return Boolean(check.call(this, ...parameters))
13711
+ }
13712
+ }
13645
13713
 
13646
- var CONTINUE$1 = true;
13647
- var SKIP$1 = 'skip';
13648
- var EXIT$1 = false;
13714
+ // Utility to return true.
13715
+ function ok$2() {
13716
+ return true
13717
+ }
13649
13718
 
13650
- visitParents$1.CONTINUE = CONTINUE$1;
13651
- visitParents$1.SKIP = SKIP$1;
13652
- visitParents$1.EXIT = EXIT$1;
13719
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
13720
+ * @param {string} d
13721
+ * @returns {string}
13722
+ */
13723
+ function color$1(d) {
13724
+ return d
13725
+ }
13653
13726
 
13654
- function visitParents$1(tree, test, visitor, reverse) {
13655
- var step;
13656
- var is;
13727
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
13728
+ * @typedef {import('unist').Node} Node
13729
+ * @typedef {import('unist').Parent} Parent
13730
+ * @typedef {import('unist-util-is').Test} Test
13731
+ * @typedef {import('./complex-types').Action} Action
13732
+ * @typedef {import('./complex-types').Index} Index
13733
+ * @typedef {import('./complex-types').ActionTuple} ActionTuple
13734
+ * @typedef {import('./complex-types').VisitorResult} VisitorResult
13735
+ * @typedef {import('./complex-types').Visitor} Visitor
13736
+ */
13657
13737
 
13658
- if (typeof test === 'function' && typeof visitor !== 'function') {
13659
- reverse = visitor;
13660
- visitor = test;
13661
- test = null;
13662
- }
13738
+ /**
13739
+ * Continue traversing as normal
13740
+ */
13741
+ const CONTINUE$2 = true;
13742
+ /**
13743
+ * Do not traverse this node’s children
13744
+ */
13745
+ const SKIP$2 = 'skip';
13746
+ /**
13747
+ * Stop traversing immediately
13748
+ */
13749
+ const EXIT$2 = false;
13663
13750
 
13664
- is = convert_1(test);
13665
- step = reverse ? -1 : 1;
13751
+ /**
13752
+ * Visit children of tree which pass a test
13753
+ *
13754
+ * @param tree Abstract syntax tree to walk
13755
+ * @param test Test node, optional
13756
+ * @param visitor Function to run for each node
13757
+ * @param reverse Visit the tree in reverse order, defaults to false
13758
+ */
13759
+ const visitParents$2 =
13760
+ /**
13761
+ * @type {(
13762
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
13763
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types').BuildVisitor<Tree>, reverse?: boolean) => void)
13764
+ * )}
13765
+ */
13766
+ (
13767
+ /**
13768
+ * @param {Node} tree
13769
+ * @param {Test} test
13770
+ * @param {import('./complex-types').Visitor<Node>} visitor
13771
+ * @param {boolean} [reverse]
13772
+ */
13773
+ function (tree, test, visitor, reverse) {
13774
+ if (typeof test === 'function' && typeof visitor !== 'function') {
13775
+ reverse = visitor;
13776
+ // @ts-expect-error no visitor given, so `visitor` is test.
13777
+ visitor = test;
13778
+ test = null;
13779
+ }
13666
13780
 
13667
- factory(tree, null, [])();
13781
+ const is = convert$2(test);
13782
+ const step = reverse ? -1 : 1;
13668
13783
 
13669
- function factory(node, index, parents) {
13670
- var value = typeof node === 'object' && node !== null ? node : {};
13671
- var name;
13784
+ factory(tree, null, [])();
13672
13785
 
13673
- if (typeof value.type === 'string') {
13674
- name =
13675
- typeof value.tagName === 'string'
13676
- ? value.tagName
13677
- : typeof value.name === 'string'
13678
- ? value.name
13679
- : undefined;
13786
+ /**
13787
+ * @param {Node} node
13788
+ * @param {number?} index
13789
+ * @param {Array.<Parent>} parents
13790
+ */
13791
+ function factory(node, index, parents) {
13792
+ /** @type {Object.<string, unknown>} */
13793
+ // @ts-expect-error: hush
13794
+ const value = typeof node === 'object' && node !== null ? node : {};
13795
+ /** @type {string|undefined} */
13796
+ let name;
13797
+
13798
+ if (typeof value.type === 'string') {
13799
+ name =
13800
+ typeof value.tagName === 'string'
13801
+ ? value.tagName
13802
+ : typeof value.name === 'string'
13803
+ ? value.name
13804
+ : undefined;
13805
+
13806
+ Object.defineProperty(visit, 'name', {
13807
+ value:
13808
+ 'node (' +
13809
+ color$1(value.type + (name ? '<' + name + '>' : '')) +
13810
+ ')'
13811
+ });
13812
+ }
13680
13813
 
13681
- visit.displayName =
13682
- 'node (' + color_1(value.type + (name ? '<' + name + '>' : '')) + ')';
13683
- }
13814
+ return visit
13684
13815
 
13685
- return visit
13816
+ function visit() {
13817
+ /** @type {ActionTuple} */
13818
+ let result = [];
13819
+ /** @type {ActionTuple} */
13820
+ let subresult;
13821
+ /** @type {number} */
13822
+ let offset;
13823
+ /** @type {Array.<Parent>} */
13824
+ let grandparents;
13686
13825
 
13687
- function visit() {
13688
- var grandparents = parents.concat(node);
13689
- var result = [];
13690
- var subresult;
13691
- var offset;
13826
+ if (!test || is(node, index, parents[parents.length - 1] || null)) {
13827
+ result = toResult$1(visitor(node, parents));
13692
13828
 
13693
- if (!test || is(node, index, parents[parents.length - 1] || null)) {
13694
- result = toResult(visitor(node, parents));
13829
+ if (result[0] === EXIT$2) {
13830
+ return result
13831
+ }
13832
+ }
13695
13833
 
13696
- if (result[0] === EXIT$1) {
13697
- return result
13698
- }
13699
- }
13834
+ // @ts-expect-error looks like a parent.
13835
+ if (node.children && result[0] !== SKIP$2) {
13836
+ // @ts-expect-error looks like a parent.
13837
+ offset = (reverse ? node.children.length : -1) + step;
13838
+ // @ts-expect-error looks like a parent.
13839
+ grandparents = parents.concat(node);
13700
13840
 
13701
- if (node.children && result[0] !== SKIP$1) {
13702
- offset = (reverse ? node.children.length : -1) + step;
13841
+ // @ts-expect-error looks like a parent.
13842
+ while (offset > -1 && offset < node.children.length) {
13843
+ // @ts-expect-error looks like a parent.
13844
+ subresult = factory(node.children[offset], offset, grandparents)();
13703
13845
 
13704
- while (offset > -1 && offset < node.children.length) {
13705
- subresult = factory(node.children[offset], offset, grandparents)();
13846
+ if (subresult[0] === EXIT$2) {
13847
+ return subresult
13848
+ }
13706
13849
 
13707
- if (subresult[0] === EXIT$1) {
13708
- return subresult
13850
+ offset =
13851
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step;
13852
+ }
13709
13853
  }
13710
13854
 
13711
- offset =
13712
- typeof subresult[1] === 'number' ? subresult[1] : offset + step;
13855
+ return result
13713
13856
  }
13714
13857
  }
13715
-
13716
- return result
13717
13858
  }
13718
- }
13719
- }
13859
+ );
13720
13860
 
13721
- function toResult(value) {
13722
- if (value !== null && typeof value === 'object' && 'length' in value) {
13861
+ /**
13862
+ * @param {VisitorResult} value
13863
+ * @returns {ActionTuple}
13864
+ */
13865
+ function toResult$1(value) {
13866
+ if (Array.isArray(value)) {
13723
13867
  return value
13724
13868
  }
13725
13869
 
13726
13870
  if (typeof value === 'number') {
13727
- return [CONTINUE$1, value]
13871
+ return [CONTINUE$2, value]
13728
13872
  }
13729
13873
 
13730
13874
  return [value]
13731
13875
  }
13732
13876
 
13733
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
13734
- var escapeStringRegexp = string => {
13735
- if (typeof string !== 'string') {
13736
- throw new TypeError('Expected a string');
13737
- }
13738
-
13739
- // Escape characters with special meaning either inside or outside character sets.
13740
- // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
13741
- return string
13742
- .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
13743
- .replace(/-/g, '\\x2d');
13744
- };
13877
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
13878
+ * @typedef {import('unist').Node} Node
13879
+ * @typedef {import('unist').Parent} Parent
13880
+ *
13881
+ * @typedef {string} Type
13882
+ * @typedef {Object<string, unknown>} Props
13883
+ *
13884
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
13885
+ */
13745
13886
 
13746
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
13747
- var mdastUtilFindAndReplace = findAndReplace;
13887
+ const convert$1 =
13888
+ /**
13889
+ * @type {(
13890
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
13891
+ * ((test?: Test) => AssertAnything)
13892
+ * )}
13893
+ */
13894
+ (
13895
+ /**
13896
+ * Generate an assertion from a check.
13897
+ * @param {Test} [test]
13898
+ * When nullish, checks if `node` is a `Node`.
13899
+ * When `string`, works like passing `function (node) {return node.type === test}`.
13900
+ * When `function` checks if function passed the node is true.
13901
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
13902
+ * When `array`, checks any one of the subtests pass.
13903
+ * @returns {AssertAnything}
13904
+ */
13905
+ function (test) {
13906
+ if (test === undefined || test === null) {
13907
+ return ok$1
13908
+ }
13748
13909
 
13910
+ if (typeof test === 'string') {
13911
+ return typeFactory$1(test)
13912
+ }
13749
13913
 
13914
+ if (typeof test === 'object') {
13915
+ return Array.isArray(test) ? anyFactory$1(test) : propsFactory(test)
13916
+ }
13750
13917
 
13918
+ if (typeof test === 'function') {
13919
+ return castFactory(test)
13920
+ }
13751
13921
 
13922
+ throw new Error('Expected function, string, or object as test')
13923
+ }
13924
+ );
13925
+ /**
13926
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
13927
+ * @returns {AssertAnything}
13928
+ */
13929
+ function anyFactory$1(tests) {
13930
+ /** @type {Array.<AssertAnything>} */
13931
+ const checks = [];
13932
+ let index = -1;
13752
13933
 
13753
- var splice$2 = [].splice;
13934
+ while (++index < tests.length) {
13935
+ checks[index] = convert$1(tests[index]);
13936
+ }
13754
13937
 
13755
- function findAndReplace(tree, find, replace, options) {
13756
- var settings;
13757
- var schema;
13938
+ return castFactory(any)
13758
13939
 
13759
- if (typeof find === 'string' || (find && typeof find.exec === 'function')) {
13760
- schema = [[find, replace]];
13761
- } else {
13762
- schema = find;
13763
- options = replace;
13764
- }
13940
+ /**
13941
+ * @this {unknown}
13942
+ * @param {unknown[]} parameters
13943
+ * @returns {boolean}
13944
+ */
13945
+ function any(...parameters) {
13946
+ let index = -1;
13765
13947
 
13766
- settings = options || {};
13948
+ while (++index < checks.length) {
13949
+ if (checks[index].call(this, ...parameters)) return true
13950
+ }
13767
13951
 
13768
- search$2(tree, settings, handlerFactory(toPairs$1(schema)));
13952
+ return false
13953
+ }
13954
+ }
13769
13955
 
13770
- return tree
13956
+ /**
13957
+ * Utility to assert each property in `test` is represented in `node`, and each
13958
+ * values are strictly equal.
13959
+ *
13960
+ * @param {Props} check
13961
+ * @returns {AssertAnything}
13962
+ */
13963
+ function propsFactory(check) {
13964
+ return castFactory(all)
13771
13965
 
13772
- function handlerFactory(pairs) {
13773
- var pair = pairs[0];
13966
+ /**
13967
+ * @param {Node} node
13968
+ * @returns {boolean}
13969
+ */
13970
+ function all(node) {
13971
+ /** @type {string} */
13972
+ let key;
13774
13973
 
13775
- return handler
13974
+ for (key in check) {
13975
+ // @ts-expect-error: hush, it sure works as an index.
13976
+ if (node[key] !== check[key]) return false
13977
+ }
13776
13978
 
13777
- function handler(node, parent) {
13778
- var find = pair[0];
13779
- var replace = pair[1];
13780
- var nodes = [];
13781
- var start = 0;
13782
- var index = parent.children.indexOf(node);
13783
- var position;
13784
- var match;
13785
- var subhandler;
13786
- var value;
13979
+ return true
13980
+ }
13981
+ }
13787
13982
 
13788
- find.lastIndex = 0;
13983
+ /**
13984
+ * Utility to convert a string into a function which checks a given node’s type
13985
+ * for said string.
13986
+ *
13987
+ * @param {Type} check
13988
+ * @returns {AssertAnything}
13989
+ */
13990
+ function typeFactory$1(check) {
13991
+ return castFactory(type)
13789
13992
 
13790
- match = find.exec(node.value);
13993
+ /**
13994
+ * @param {Node} node
13995
+ */
13996
+ function type(node) {
13997
+ return node && node.type === check
13998
+ }
13999
+ }
13791
14000
 
13792
- while (match) {
13793
- position = match.index;
13794
- value = replace.apply(
13795
- null,
13796
- [].concat(match, {index: match.index, input: match.input})
13797
- );
14001
+ /**
14002
+ * Utility to convert a string into a function which checks a given node’s type
14003
+ * for said string.
14004
+ * @param {TestFunctionAnything} check
14005
+ * @returns {AssertAnything}
14006
+ */
14007
+ function castFactory(check) {
14008
+ return assertion
13798
14009
 
13799
- if (value !== false) {
13800
- if (start !== position) {
13801
- nodes.push({type: 'text', value: node.value.slice(start, position)});
13802
- }
14010
+ /**
14011
+ * @this {unknown}
14012
+ * @param {Array.<unknown>} parameters
14013
+ * @returns {boolean}
14014
+ */
14015
+ function assertion(...parameters) {
14016
+ // @ts-expect-error: spreading is fine.
14017
+ return Boolean(check.call(this, ...parameters))
14018
+ }
14019
+ }
13803
14020
 
13804
- if (typeof value === 'string' && value.length > 0) {
13805
- value = {type: 'text', value: value};
13806
- }
14021
+ // Utility to return true.
14022
+ function ok$1() {
14023
+ return true
14024
+ }
13807
14025
 
13808
- if (value) {
13809
- nodes = [].concat(nodes, value);
13810
- }
14026
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};/**
14027
+ * @typedef Options
14028
+ * Configuration (optional).
14029
+ * @property {Test} [ignore]
14030
+ * `unist-util-is` test used to assert parents
14031
+ *
14032
+ * @typedef {import('mdast').Root} Root
14033
+ * @typedef {import('mdast').Content} Content
14034
+ * @typedef {import('mdast').PhrasingContent} PhrasingContent
14035
+ * @typedef {import('mdast').Text} Text
14036
+ * @typedef {Content|Root} Node
14037
+ * @typedef {Exclude<Extract<Node, import('mdast').Parent>, Root>} Parent
14038
+ *
14039
+ * @typedef {import('unist-util-visit-parents').Test} Test
14040
+ * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
14041
+ *
14042
+ * @typedef RegExpMatchObject
14043
+ * @property {number} index
14044
+ * @property {string} input
14045
+ * @property {[Root, ...Array<Parent>, Text]} stack
14046
+ *
14047
+ * @typedef {string|RegExp} Find
14048
+ * @typedef {string|ReplaceFunction} Replace
14049
+ *
14050
+ * @typedef {[Find, Replace]} FindAndReplaceTuple
14051
+ * @typedef {Record<string, Replace>} FindAndReplaceSchema
14052
+ * @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
14053
+ *
14054
+ * @typedef {[RegExp, ReplaceFunction]} Pair
14055
+ * @typedef {Array<Pair>} Pairs
14056
+ */
13811
14057
 
13812
- start = position + match[0].length;
13813
- }
14058
+ const own$5 = {}.hasOwnProperty;
13814
14059
 
13815
- if (!find.global) {
13816
- break
13817
- }
14060
+ /**
14061
+ * @param tree mdast tree
14062
+ * @param find Value to find and remove. When `string`, escaped and made into a global `RegExp`
14063
+ * @param [replace] Value to insert.
14064
+ * * When `string`, turned into a Text node.
14065
+ * * When `Function`, called with the results of calling `RegExp.exec` as
14066
+ * arguments, in which case it can return a single or a list of `Node`,
14067
+ * a `string` (which is wrapped in a `Text` node), or `false` to not replace
14068
+ * @param [options] Configuration.
14069
+ */
14070
+ const findAndReplace =
14071
+ /**
14072
+ * @type {(
14073
+ * ((tree: Node, find: Find, replace?: Replace, options?: Options) => Node) &
14074
+ * ((tree: Node, schema: FindAndReplaceSchema|FindAndReplaceList, options?: Options) => Node)
14075
+ * )}
14076
+ **/
14077
+ (
14078
+ /**
14079
+ * @param {Node} tree
14080
+ * @param {Find|FindAndReplaceSchema|FindAndReplaceList} find
14081
+ * @param {Replace|Options} [replace]
14082
+ * @param {Options} [options]
14083
+ */
14084
+ function (tree, find, replace, options) {
14085
+ /** @type {Options|undefined} */
14086
+ let settings;
14087
+ /** @type {FindAndReplaceSchema|FindAndReplaceList} */
14088
+ let schema;
14089
+
14090
+ if (typeof find === 'string' || find instanceof RegExp) {
14091
+ // @ts-expect-error don’t expect options twice.
14092
+ schema = [[find, replace]];
14093
+ settings = options;
14094
+ } else {
14095
+ schema = find;
14096
+ // @ts-expect-error don’t expect replace twice.
14097
+ settings = replace;
14098
+ }
13818
14099
 
13819
- match = find.exec(node.value);
14100
+ if (!settings) {
14101
+ settings = {};
13820
14102
  }
13821
14103
 
13822
- if (position === undefined) {
13823
- nodes = [node];
13824
- index--;
13825
- } else {
13826
- if (start < node.value.length) {
13827
- nodes.push({type: 'text', value: node.value.slice(start)});
13828
- }
14104
+ const ignored = convert$1(settings.ignore || []);
14105
+ const pairs = toPairs$1(schema);
14106
+ let pairIndex = -1;
13829
14107
 
13830
- nodes.unshift(index, 1);
13831
- splice$2.apply(parent.children, nodes);
14108
+ while (++pairIndex < pairs.length) {
14109
+ visitParents$2(tree, 'text', visitor);
13832
14110
  }
13833
14111
 
13834
- if (pairs.length > 1) {
13835
- subhandler = handlerFactory(pairs.slice(1));
13836
- position = -1;
14112
+ return tree
13837
14113
 
13838
- while (++position < nodes.length) {
13839
- node = nodes[position];
14114
+ /** @type {import('unist-util-visit-parents/complex-types').BuildVisitor<Root, 'text'>} */
14115
+ function visitor(node, parents) {
14116
+ let index = -1;
14117
+ /** @type {Parent|undefined} */
14118
+ let grandparent;
13840
14119
 
13841
- if (node.type === 'text') {
13842
- subhandler(node, parent);
13843
- } else {
13844
- search$2(node, settings, subhandler);
14120
+ while (++index < parents.length) {
14121
+ const parent = /** @type {Parent} */ (parents[index]);
14122
+
14123
+ if (
14124
+ ignored(
14125
+ parent,
14126
+ // @ts-expect-error mdast vs. unist parent.
14127
+ grandparent ? grandparent.children.indexOf(parent) : undefined,
14128
+ grandparent
14129
+ )
14130
+ ) {
14131
+ return
13845
14132
  }
14133
+
14134
+ grandparent = parent;
14135
+ }
14136
+
14137
+ if (grandparent) {
14138
+ // @ts-expect-error: stack is fine.
14139
+ return handler(node, parents)
13846
14140
  }
13847
14141
  }
13848
14142
 
13849
- return index + nodes.length + 1
13850
- }
13851
- }
13852
- }
14143
+ /**
14144
+ * @param {Text} node
14145
+ * @param {[Root, ...Array<Parent>]} parents
14146
+ * @returns {VisitorResult}
14147
+ */
14148
+ function handler(node, parents) {
14149
+ const parent = parents[parents.length - 1];
14150
+ const find = pairs[pairIndex][0];
14151
+ const replace = pairs[pairIndex][1];
14152
+ let start = 0;
14153
+ // @ts-expect-error: TS is wrong, some of these children can be text.
14154
+ const index = parent.children.indexOf(node);
14155
+ let change = false;
14156
+ /** @type {Array<PhrasingContent>} */
14157
+ let nodes = [];
14158
+ /** @type {number|undefined} */
14159
+ let position;
14160
+
14161
+ find.lastIndex = 0;
14162
+
14163
+ let match = find.exec(node.value);
14164
+
14165
+ while (match) {
14166
+ position = match.index;
14167
+ /** @type {RegExpMatchObject} */
14168
+ const matchObject = {
14169
+ index: match.index,
14170
+ input: match.input,
14171
+ stack: [...parents, node]
14172
+ };
14173
+ let value = replace(...match, matchObject);
13853
14174
 
13854
- function search$2(tree, settings, handler) {
13855
- var ignored = convert_1(settings.ignore || []);
13856
- var result = [];
14175
+ if (typeof value === 'string') {
14176
+ value = value.length > 0 ? {type: 'text', value} : undefined;
14177
+ }
13857
14178
 
13858
- unistUtilVisitParents$1(tree, 'text', visitor);
14179
+ if (value !== false) {
14180
+ if (start !== position) {
14181
+ nodes.push({
14182
+ type: 'text',
14183
+ value: node.value.slice(start, position)
14184
+ });
14185
+ }
13859
14186
 
13860
- return result
14187
+ if (Array.isArray(value)) {
14188
+ nodes.push(...value);
14189
+ } else if (value) {
14190
+ nodes.push(value);
14191
+ }
13861
14192
 
13862
- function visitor(node, parents) {
13863
- var index = -1;
13864
- var parent;
13865
- var grandparent;
14193
+ start = position + match[0].length;
14194
+ change = true;
14195
+ }
13866
14196
 
13867
- while (++index < parents.length) {
13868
- parent = parents[index];
14197
+ if (!find.global) {
14198
+ break
14199
+ }
13869
14200
 
13870
- if (
13871
- ignored(
13872
- parent,
13873
- grandparent ? grandparent.children.indexOf(parent) : undefined,
13874
- grandparent
13875
- )
13876
- ) {
13877
- return
13878
- }
14201
+ match = find.exec(node.value);
14202
+ }
13879
14203
 
13880
- grandparent = parent;
13881
- }
14204
+ if (change) {
14205
+ if (start < node.value.length) {
14206
+ nodes.push({type: 'text', value: node.value.slice(start)});
14207
+ }
13882
14208
 
13883
- return handler(node, grandparent)
13884
- }
13885
- }
14209
+ parent.children.splice(index, 1, ...nodes);
14210
+ } else {
14211
+ nodes = [node];
14212
+ }
14213
+
14214
+ return index + nodes.length
14215
+ }
14216
+ }
14217
+ );
13886
14218
 
14219
+ /**
14220
+ * @param {FindAndReplaceSchema|FindAndReplaceList} schema
14221
+ * @returns {Pairs}
14222
+ */
13887
14223
  function toPairs$1(schema) {
13888
- var result = [];
13889
- var key;
13890
- var index;
14224
+ /** @type {Pairs} */
14225
+ const result = [];
13891
14226
 
13892
14227
  if (typeof schema !== 'object') {
13893
- throw new Error('Expected array or object as schema')
14228
+ throw new TypeError('Expected array or object as schema')
13894
14229
  }
13895
14230
 
13896
- if ('length' in schema) {
13897
- index = -1;
14231
+ if (Array.isArray(schema)) {
14232
+ let index = -1;
13898
14233
 
13899
14234
  while (++index < schema.length) {
13900
14235
  result.push([
@@ -13903,24 +14238,33 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
13903
14238
  ]);
13904
14239
  }
13905
14240
  } else {
14241
+ /** @type {string} */
14242
+ let key;
14243
+
13906
14244
  for (key in schema) {
13907
- result.push([toExpression(key), toFunction(schema[key])]);
14245
+ if (own$5.call(schema, key)) {
14246
+ result.push([toExpression(key), toFunction(schema[key])]);
14247
+ }
13908
14248
  }
13909
14249
  }
13910
14250
 
13911
14251
  return result
13912
14252
  }
13913
14253
 
14254
+ /**
14255
+ * @param {Find} find
14256
+ * @returns {RegExp}
14257
+ */
13914
14258
  function toExpression(find) {
13915
14259
  return typeof find === 'string' ? new RegExp(escapeStringRegexp(find), 'g') : find
13916
14260
  }
13917
14261
 
14262
+ /**
14263
+ * @param {Replace} replace
14264
+ * @returns {ReplaceFunction}
14265
+ */
13918
14266
  function toFunction(replace) {
13919
- return typeof replace === 'function' ? replace : returner
13920
-
13921
- function returner() {
13922
- return replace
13923
- }
14267
+ return typeof replace === 'function' ? replace : () => replace
13924
14268
  }
13925
14269
 
13926
14270
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var immutable = extend$1;
@@ -14759,7 +15103,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
14759
15103
 
14760
15104
  function noop$2() {}
14761
15105
 
14762
- var on$1 = noop$2;
15106
+ var on$2 = noop$2;
14763
15107
  var addListener = noop$2;
14764
15108
  var once = noop$2;
14765
15109
  var off = noop$2;
@@ -14818,7 +15162,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
14818
15162
  argv: argv,
14819
15163
  version: version$1,
14820
15164
  versions: versions,
14821
- on: on$1,
15165
+ on: on$2,
14822
15166
  addListener: addListener,
14823
15167
  once: once,
14824
15168
  off: off,
@@ -23943,10 +24287,10 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
23943
24287
 
23944
24288
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
23945
24289
  /* Expose. */
23946
- var unistUtilVisitParents = visitParents;
24290
+ var unistUtilVisitParents$1 = visitParents$1;
23947
24291
 
23948
24292
  /* Visit. */
23949
- function visitParents(tree, type, visitor) {
24293
+ function visitParents$1(tree, type, visitor) {
23950
24294
  var stack = [];
23951
24295
 
23952
24296
  if (typeof type === 'function') {
@@ -23996,7 +24340,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
23996
24340
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
23997
24341
  function addListMetadata() {
23998
24342
  return function (ast) {
23999
- unistUtilVisitParents(ast, 'list', function (listNode, parents) {
24343
+ unistUtilVisitParents$1(ast, 'list', function (listNode, parents) {
24000
24344
  var depth = 0, i, n;
24001
24345
  for (i = 0, n = parents.length; i < n; i++) {
24002
24346
  if (parents[i].type === 'list') depth += 1;
@@ -24014,14 +24358,189 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
24014
24358
 
24015
24359
  var mdastAddListMetadata = addListMetadata;
24016
24360
 
24361
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
24362
+ var convert_1 = convert;
24363
+
24364
+ function convert(test) {
24365
+ if (test == null) {
24366
+ return ok
24367
+ }
24368
+
24369
+ if (typeof test === 'string') {
24370
+ return typeFactory(test)
24371
+ }
24372
+
24373
+ if (typeof test === 'object') {
24374
+ return 'length' in test ? anyFactory(test) : allFactory(test)
24375
+ }
24376
+
24377
+ if (typeof test === 'function') {
24378
+ return test
24379
+ }
24380
+
24381
+ throw new Error('Expected function, string, or object as test')
24382
+ }
24383
+
24384
+ // Utility assert each property in `test` is represented in `node`, and each
24385
+ // values are strictly equal.
24386
+ function allFactory(test) {
24387
+ return all
24388
+
24389
+ function all(node) {
24390
+ var key;
24391
+
24392
+ for (key in test) {
24393
+ if (node[key] !== test[key]) return false
24394
+ }
24395
+
24396
+ return true
24397
+ }
24398
+ }
24399
+
24400
+ function anyFactory(tests) {
24401
+ var checks = [];
24402
+ var index = -1;
24403
+
24404
+ while (++index < tests.length) {
24405
+ checks[index] = convert(tests[index]);
24406
+ }
24407
+
24408
+ return any
24409
+
24410
+ function any() {
24411
+ var index = -1;
24412
+
24413
+ while (++index < checks.length) {
24414
+ if (checks[index].apply(this, arguments)) {
24415
+ return true
24416
+ }
24417
+ }
24418
+
24419
+ return false
24420
+ }
24421
+ }
24422
+
24423
+ // Utility to convert a string into a function which checks a given node’s type
24424
+ // for said string.
24425
+ function typeFactory(test) {
24426
+ return type
24427
+
24428
+ function type(node) {
24429
+ return Boolean(node && node.type === test)
24430
+ }
24431
+ }
24432
+
24433
+ // Utility to return true.
24434
+ function ok() {
24435
+ return true
24436
+ }
24437
+
24438
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var color_1 = color;
24439
+ function color(d) {
24440
+ return '\u001B[33m' + d + '\u001B[39m'
24441
+ }
24442
+
24443
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
24444
+ var unistUtilVisitParents = visitParents;
24445
+
24446
+
24447
+
24448
+
24449
+ var CONTINUE$1 = true;
24450
+ var SKIP$1 = 'skip';
24451
+ var EXIT$1 = false;
24452
+
24453
+ visitParents.CONTINUE = CONTINUE$1;
24454
+ visitParents.SKIP = SKIP$1;
24455
+ visitParents.EXIT = EXIT$1;
24456
+
24457
+ function visitParents(tree, test, visitor, reverse) {
24458
+ var step;
24459
+ var is;
24460
+
24461
+ if (typeof test === 'function' && typeof visitor !== 'function') {
24462
+ reverse = visitor;
24463
+ visitor = test;
24464
+ test = null;
24465
+ }
24466
+
24467
+ is = convert_1(test);
24468
+ step = reverse ? -1 : 1;
24469
+
24470
+ factory(tree, null, [])();
24471
+
24472
+ function factory(node, index, parents) {
24473
+ var value = typeof node === 'object' && node !== null ? node : {};
24474
+ var name;
24475
+
24476
+ if (typeof value.type === 'string') {
24477
+ name =
24478
+ typeof value.tagName === 'string'
24479
+ ? value.tagName
24480
+ : typeof value.name === 'string'
24481
+ ? value.name
24482
+ : undefined;
24483
+
24484
+ visit.displayName =
24485
+ 'node (' + color_1(value.type + (name ? '<' + name + '>' : '')) + ')';
24486
+ }
24487
+
24488
+ return visit
24489
+
24490
+ function visit() {
24491
+ var grandparents = parents.concat(node);
24492
+ var result = [];
24493
+ var subresult;
24494
+ var offset;
24495
+
24496
+ if (!test || is(node, index, parents[parents.length - 1] || null)) {
24497
+ result = toResult(visitor(node, parents));
24498
+
24499
+ if (result[0] === EXIT$1) {
24500
+ return result
24501
+ }
24502
+ }
24503
+
24504
+ if (node.children && result[0] !== SKIP$1) {
24505
+ offset = (reverse ? node.children.length : -1) + step;
24506
+
24507
+ while (offset > -1 && offset < node.children.length) {
24508
+ subresult = factory(node.children[offset], offset, grandparents)();
24509
+
24510
+ if (subresult[0] === EXIT$1) {
24511
+ return subresult
24512
+ }
24513
+
24514
+ offset =
24515
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step;
24516
+ }
24517
+ }
24518
+
24519
+ return result
24520
+ }
24521
+ }
24522
+ }
24523
+
24524
+ function toResult(value) {
24525
+ if (value !== null && typeof value === 'object' && 'length' in value) {
24526
+ return value
24527
+ }
24528
+
24529
+ if (typeof value === 'number') {
24530
+ return [CONTINUE$1, value]
24531
+ }
24532
+
24533
+ return [value]
24534
+ }
24535
+
24017
24536
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
24018
24537
  var unistUtilVisit = visit;
24019
24538
 
24020
24539
 
24021
24540
 
24022
- var CONTINUE = unistUtilVisitParents$1.CONTINUE;
24023
- var SKIP = unistUtilVisitParents$1.SKIP;
24024
- var EXIT = unistUtilVisitParents$1.EXIT;
24541
+ var CONTINUE = unistUtilVisitParents.CONTINUE;
24542
+ var SKIP = unistUtilVisitParents.SKIP;
24543
+ var EXIT = unistUtilVisitParents.EXIT;
24025
24544
 
24026
24545
  visit.CONTINUE = CONTINUE;
24027
24546
  visit.SKIP = SKIP;
@@ -24034,7 +24553,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
24034
24553
  test = null;
24035
24554
  }
24036
24555
 
24037
- unistUtilVisitParents$1(tree, test, overload, reverse);
24556
+ unistUtilVisitParents(tree, test, overload, reverse);
24038
24557
 
24039
24558
  function overload(node, parents) {
24040
24559
  var parent = parents[parents.length - 1];
@@ -36573,7 +37092,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
36573
37092
  };
36574
37093
  }
36575
37094
  var transform = function (markdownAST) {
36576
- mdastUtilFindAndReplace(markdownAST, emojiRegex(), replace);
37095
+ findAndReplace(markdownAST, emojiRegex(), replace);
36577
37096
  return markdownAST;
36578
37097
  };
36579
37098
  return transform;
@@ -36600,7 +37119,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
36600
37119
  return markdownAST;
36601
37120
  }
36602
37121
  var mentionedUsersRegex = new RegExp(mentioned_usernames.map(function (username) { return "@" + username; }).join('|'), 'g');
36603
- mdastUtilFindAndReplace(markdownAST, mentionedUsersRegex, replace);
37122
+ findAndReplace(markdownAST, mentionedUsersRegex, replace);
36604
37123
  return markdownAST;
36605
37124
  };
36606
37125
  return transform;
@@ -36631,6 +37150,22 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
36631
37150
  if (noParsingNeeded.length > 0 || linkIsInBlock)
36632
37151
  return;
36633
37152
  try {
37153
+ // special case for mentions:
37154
+ // it could happen that a user's name matches with an e-mail format pattern.
37155
+ // in that case, we check whether the found e-mail is actually a mention
37156
+ // by naively checking for an existence of @ sign in front of it.
37157
+ if (type === 'email' && mentioned_users) {
37158
+ var emailMatchesWithName = mentioned_users.some(function (u) { return u.name === value; });
37159
+ if (emailMatchesWithName) {
37160
+ newText = newText.replace(new RegExp(escapeRegExp(value), 'g'), function (match, position) {
37161
+ var isMention = newText.charAt(position - 1) === '@';
37162
+ // in case of mention, we leave the match in its original form,
37163
+ // and we let `mentionsMarkdownPlugin` to do its job
37164
+ return isMention ? match : "[" + match + "](" + encodeDecode(href) + ")";
37165
+ });
37166
+ return;
37167
+ }
37168
+ }
36634
37169
  var displayLink = type === 'email' ? value : formatUrlForDisplay(href);
36635
37170
  newText = newText.replace(new RegExp(escapeRegExp(value), 'g'), "[" + displayLink + "](" + encodeDecode(href) + ")");
36636
37171
  }
@@ -39174,7 +39709,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
39174
39709
  }
39175
39710
  case 'loadMoreFinished': {
39176
39711
  var hasMore = action.hasMore, messages = action.messages;
39177
- return __assign$2(__assign$2({}, state), { hasMore: hasMore, loadingMore: false, messages: messages });
39712
+ return __assign$2(__assign$2({}, state), { hasMore: hasMore, loadingMore: false, messages: messages, suppressAutoscroll: false });
39178
39713
  }
39179
39714
  case 'loadMoreNewerFinished': {
39180
39715
  var hasMoreNewer = action.hasMoreNewer, messages = action.messages;
@@ -39195,7 +39730,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
39195
39730
  case 'setLoadingMore': {
39196
39731
  var loadingMore = action.loadingMore;
39197
39732
  // suppress the autoscroll behavior
39198
- return __assign$2(__assign$2({}, state), { loadingMore: loadingMore, suppressAutoscroll: true });
39733
+ return __assign$2(__assign$2({}, state), { loadingMore: loadingMore, suppressAutoscroll: loadingMore });
39199
39734
  }
39200
39735
  case 'setLoadingMoreNewer': {
39201
39736
  var loadingMoreNewer = action.loadingMoreNewer;
@@ -39809,15 +40344,24 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
39809
40344
  }
39810
40345
  return message.attachments.filter(function (item) { return item.type !== 'image'; });
39811
40346
  };
39812
- var getReadByTooltipText = function (users, t, client) {
40347
+ /**
40348
+ * Default Tooltip Username mapper implementation.
40349
+ *
40350
+ * @param user the user.
40351
+ */
40352
+ var mapToUserNameOrId = function (user) { return user.name || user.id; };
40353
+ var getReadByTooltipText = function (users, t, client, tooltipUserNameMapper) {
39813
40354
  var outStr = '';
39814
40355
  if (!t) {
39815
- throw new Error('`getReadByTooltipText was called, but translation function is not available`');
40356
+ throw new Error('getReadByTooltipText was called, but translation function is not available');
40357
+ }
40358
+ if (!tooltipUserNameMapper) {
40359
+ throw new Error('getReadByTooltipText was called, but tooltipUserNameMapper function is not available');
39816
40360
  }
39817
40361
  // first filter out client user, so restLength won't count it
39818
40362
  var otherUsers = users
39819
40363
  .filter(function (item) { return item && (client === null || client === void 0 ? void 0 : client.user) && item.id !== client.user.id; })
39820
- .map(function (item) { return item.name || item.id; });
40364
+ .map(tooltipUserNameMapper);
39821
40365
  var slicedArr = otherUsers.slice(0, 5);
39822
40366
  var restLength = otherUsers.length - slicedArr.length;
39823
40367
  if (slicedArr.length === 1) {
@@ -39836,7 +40380,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
39836
40380
  // example: "bob, joe, sam and 4 more"
39837
40381
  if (restLength === 0) {
39838
40382
  // mutate slicedArr to remove last user to display it separately
39839
- var lastUser = slicedArr.splice(slicedArr.length - 2, 1);
40383
+ var lastUser = slicedArr.splice(slicedArr.length - 1, 1);
39840
40384
  outStr = t('{{ commaSeparatedUsers }}, and {{ lastUser }}', {
39841
40385
  commaSeparatedUsers: slicedArr.join(', '),
39842
40386
  lastUser: lastUser,
@@ -40093,10 +40637,10 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
40093
40637
 
40094
40638
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedMessageStatus = function (props) {
40095
40639
  var _a;
40096
- var propAvatar = props.Avatar, _b = props.messageType, messageType = _b === void 0 ? 'simple' : _b;
40640
+ var propAvatar = props.Avatar, _b = props.messageType, messageType = _b === void 0 ? 'simple' : _b, _c = props.tooltipUserNameMapper, tooltipUserNameMapper = _c === void 0 ? mapToUserNameOrId : _c;
40097
40641
  var client = useChatContext('MessageStatus').client;
40098
40642
  var contextAvatar = useComponentContext('MessageStatus').Avatar;
40099
- var _c = useMessageContext('MessageStatus'), isMyMessage = _c.isMyMessage, lastReceivedId = _c.lastReceivedId, message = _c.message, readBy = _c.readBy, threadList = _c.threadList;
40643
+ var _d = useMessageContext('MessageStatus'), isMyMessage = _d.isMyMessage, lastReceivedId = _d.lastReceivedId, message = _d.message, readBy = _d.readBy, threadList = _d.threadList;
40100
40644
  var t = useTranslationContext('MessageStatus').t;
40101
40645
  var Avatar$1 = propAvatar || contextAvatar || Avatar;
40102
40646
  if (!isMyMessage() || message.type === 'error') {
@@ -40111,7 +40655,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
40111
40655
  if ((readBy === null || readBy === void 0 ? void 0 : readBy.length) && !threadList && !justReadByMe) {
40112
40656
  var lastReadUser = readBy.filter(function (item) { var _a; return item.id !== ((_a = client.user) === null || _a === void 0 ? void 0 : _a.id); })[0];
40113
40657
  return (React__default['default'].createElement("span", { className: "str-chat__message-" + messageType + "-status", "data-testid": 'message-status-read-by' },
40114
- React__default['default'].createElement(Tooltip, null, getReadByTooltipText(readBy, t, client)),
40658
+ React__default['default'].createElement(Tooltip, null, getReadByTooltipText(readBy, t, client, tooltipUserNameMapper)),
40115
40659
  React__default['default'].createElement(Avatar$1, { image: lastReadUser.image, name: lastReadUser.name || lastReadUser.id, size: 15, user: lastReadUser }),
40116
40660
  readBy.length > 2 && (React__default['default'].createElement("span", { className: "str-chat__message-" + messageType + "-status-number", "data-testid": 'message-status-read-by-many' }, readBy.length - 1))));
40117
40661
  }
@@ -42765,7 +43309,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
42765
43309
  _a.label = 1;
42766
43310
  case 1:
42767
43311
  _a.trys.push([1, 3, , 4]);
42768
- return [4 /*yield*/, editMessage(__assign$2(__assign$2({}, message), updatedMessage))];
43312
+ return [4 /*yield*/, editMessage(__assign$2(__assign$2(__assign$2({}, message), updatedMessage), customMessageData))];
42769
43313
  case 2:
42770
43314
  _a.sent();
42771
43315
  clearEditingState === null || clearEditingState === void 0 ? void 0 : clearEditingState();
@@ -45141,7 +45685,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
45141
45685
 
45142
45686
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
45143
45687
 
45144
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '9.1.5';
45688
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version = '9.4.0';
45145
45689
 
45146
45690
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
45147
45691
  var _b, _c;
@@ -45608,7 +46152,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
45608
46152
  }), canPin = _d.canPin, handlePin = _d.handlePin;
45609
46153
  var _e = useReactionClick(message, reactionSelectorRef, undefined, closeReactionSelectorOnClick), isReactionEnabled = _e.isReactionEnabled, onReactionListClick = _e.onReactionListClick, showDetailedReactions = _e.showDetailedReactions;
45610
46154
  var highlighted = highlightedMessageId === message.id;
45611
- return (React__default['default'].createElement(MemoizedMessage, { additionalMessageInputProps: props.additionalMessageInputProps, canPin: canPin, customMessageActions: props.customMessageActions, disableQuotedMessages: props.disableQuotedMessages, endOfGroup: props.endOfGroup, firstOfGroup: props.firstOfGroup, formatDate: props.formatDate, groupedByUser: props.groupedByUser, groupStyles: props.groupStyles, handleAction: handleAction, handleDelete: handleDelete, handleFlag: handleFlag, handleMute: handleMute, handleOpenThread: handleOpenThread, handlePin: handlePin, handleReaction: handleReaction, handleRetry: handleRetry, highlighted: highlighted, initialMessage: props.initialMessage, isReactionEnabled: isReactionEnabled, lastReceivedId: props.lastReceivedId, message: message, Message: props.Message, messageActions: props.messageActions, messageListRect: props.messageListRect, mutes: mutes, onMentionsClickMessage: onMentionsClick, onMentionsHoverMessage: onMentionsHover, onReactionListClick: onReactionListClick, onUserClick: props.onUserClick, onUserHover: props.onUserHover, pinPermissions: props.pinPermissions, reactionSelectorRef: reactionSelectorRef, readBy: props.readBy, renderText: props.renderText, showDetailedReactions: showDetailedReactions, threadList: props.threadList, unsafeHTML: props.unsafeHTML, userRoles: userRoles }));
46155
+ return (React__default['default'].createElement(MemoizedMessage, { additionalMessageInputProps: props.additionalMessageInputProps, autoscrollToBottom: props.autoscrollToBottom, canPin: canPin, customMessageActions: props.customMessageActions, disableQuotedMessages: props.disableQuotedMessages, endOfGroup: props.endOfGroup, firstOfGroup: props.firstOfGroup, formatDate: props.formatDate, groupedByUser: props.groupedByUser, groupStyles: props.groupStyles, handleAction: handleAction, handleDelete: handleDelete, handleFlag: handleFlag, handleMute: handleMute, handleOpenThread: handleOpenThread, handlePin: handlePin, handleReaction: handleReaction, handleRetry: handleRetry, highlighted: highlighted, initialMessage: props.initialMessage, isReactionEnabled: isReactionEnabled, lastReceivedId: props.lastReceivedId, message: message, Message: props.Message, messageActions: props.messageActions, messageListRect: props.messageListRect, mutes: mutes, onMentionsClickMessage: onMentionsClick, onMentionsHoverMessage: onMentionsHover, onReactionListClick: onReactionListClick, onUserClick: props.onUserClick, onUserHover: props.onUserHover, pinPermissions: props.pinPermissions, reactionSelectorRef: reactionSelectorRef, readBy: props.readBy, renderText: props.renderText, showDetailedReactions: showDetailedReactions, threadList: props.threadList, unsafeHTML: props.unsafeHTML, userRoles: userRoles }));
45612
46156
  };
45613
46157
 
45614
46158
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var MessageCommerceWithContext = function (props) {
@@ -48237,7 +48781,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
48237
48781
  };
48238
48782
  }
48239
48783
 
48240
- window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function u(){return u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);}return t},u.apply(this,arguments)}function c(t,e){if(null==t)return {};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return (n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,p,h="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR";}(p||(p={}));var g=((f={})[p.DEBUG]="debug",f[p.INFO]="log",f[p.WARN]="warn",f[p.ERROR]="error",f),v=system(function(){var t=statefulStream(p.ERROR);return {log:statefulStream(function(n,r,o){var i;void 0===o&&(o=p.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:getValue(t))&&console[g[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r);}),logLevel:t}},[],{singleton:!0});function S(t,e){void 0===e&&(e=!0);var n=React.useRef(null),r=function(t){};if("undefined"!=typeof ResizeObserver){var o=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n);});r=function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null);};}return {ref:n,callbackRef:r}}function I(t,e){return void 0===e&&(e=!0),S(t,e).callbackRef}function C(t,e,n,r,o,i){return S(function(n){for(var a=function(t,e,n,r){var o=t.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},p.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++;}}}return i}(n.children,e,0,o),l=n.parentElement;!l.dataset.virtuosoScroller;)l=l.parentElement;var s=i?i.scrollTop:"window"===l.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:l.scrollTop;r({scrollTop:Math.max(s,0),scrollHeight:(null!=i?i:l).scrollHeight,viewportHeight:(null!=i?i:l).offsetHeight}),null!==a&&t(a);},n)}function T(t,e){return Math.round(t.getBoundingClientRect()[e])}function w(t,e){return Math.abs(t-e)<1.01}function x(t,n,r,l,u){void 0===l&&(l=noop);var c=React.useRef(null),m=React.useRef(null),d=React.useRef(null),f=React.useRef(!1),p=React.useCallback(function(e){var r=e.target,o=r===window||r===document?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,i=r===window?document.documentElement.scrollHeight:r.scrollHeight,a=r===window?window.innerHeight:r.offsetHeight,l=function(){t({scrollTop:Math.max(o,0),scrollHeight:i,viewportHeight:a});};f.current?reactDom.flushSync(l):l(),f.current=!1,null!==m.current&&(o===m.current||o<=0||o===r.scrollHeight-T(r,"height"))&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null));},[t,n]);return React.useEffect(function(){var t=u||c.current;return l(u||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p);}},[c,p,r,l,u]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t);},scrollToCallback:function(e){var r=c.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===e.behavior;if(r===window?(i=Math.max(T(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=T(r,"height"),a=r.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-o,e.top),0)),w(o,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0);},1e3)):m.current=null,r.scrollTo(e);}}}}var b=system(function(){var t=stream(),n=stream(),r=statefulStream(0),o=stream(),i=statefulStream(0),a=stream(),l=stream(),s=statefulStream(0),u=statefulStream(0),c=statefulStream(0),m=stream(),d=stream(),f=statefulStream(!1),p=statefulStream(!1);return connect(pipe(t,map(function(t){return t.scrollTop})),n),connect(pipe(t,map(function(t){return t.scrollHeight})),l),connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0}),y={lvl:0};function E(t,e,n,r,o){return void 0===r&&(r=y),void 0===o&&(o=y),{k:t,v:e,lvl:n,l:r,r:o}}function H$1(t){return t===y}function R$1(){return y}function L$1(t,e){if(H$1(t))return y;var n=t.k,r=t.l,o=t.r;if(e===n){if(H$1(r))return o;if(H$1(o))return r;var i=P$1(r);return U$1(M$1(t,{k:i[0],v:i[1],l:O$1(r)}))}return U$1(M$1(t,e<n?{l:L$1(r,e)}:{r:L$1(o,e)}))}function k$1(t,e,n){if(void 0===n&&(n="k"),H$1(t))return [-Infinity,void 0];if(t[n]===e)return [t.k,t.v];if(t[n]<e){var r=k$1(t.r,e,n);return -Infinity===r[0]?[t.k,t.v]:r}return k$1(t.l,e,n)}function z$1(t,e,n){return H$1(t)?E(e,n,1):e===t.k?M$1(t,{k:e,v:n}):function(t){return N$1(D$1(t))}(M$1(t,e<t.k?{l:z$1(t.l,e,n)}:{r:z$1(t.r,e,n)}))}function B$1(t,e,n){if(H$1(t))return [];var r=t.k,o=t.v,i=t.r,a=[];return r>e&&(a=a.concat(B$1(t.l,e,n))),r>=e&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(B$1(i,e,n))),a}function F$1(t){return H$1(t)?[]:[].concat(F$1(t.l),[{k:t.k,v:t.v}],F$1(t.r))}function P$1(t){return H$1(t.r)?[t.k,t.v]:P$1(t.r)}function O$1(t){return H$1(t.r)?t.l:U$1(M$1(t,{r:O$1(t.r)}))}function M$1(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function V$1(t){return H$1(t)||t.lvl>t.r.lvl}function U$1(t){var e=t.l,n=t.r,r=t.lvl;if(n.lvl>=r-1&&e.lvl>=r-1)return t;if(r>n.lvl+1){if(V$1(e))return D$1(M$1(t,{lvl:r-1}));if(H$1(e)||H$1(e.r))throw new Error("Unexpected empty nodes");return M$1(e.r,{l:M$1(e,{r:e.r.l}),r:M$1(t,{l:e.r.r,lvl:r-1}),lvl:r})}if(V$1(t))return N$1(M$1(t,{lvl:r-1}));if(H$1(n)||H$1(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=V$1(o)?n.lvl-1:n.lvl;return M$1(o,{l:M$1(t,{r:o.l,lvl:r-1}),r:N$1(M$1(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function A$1(t,e,n){return H$1(t)?[]:W$1(B$1(t,k$1(t,e)[0],n),function(t){return {index:t.k,value:t.v}})}function W$1(t,e){var n=t.length;if(0===n)return [];for(var r=e(t[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c;}return a.push({start:o,end:Infinity,value:i}),a}function N$1(t){var e=t.r,n=t.lvl;return H$1(e)||H$1(e.r)||e.lvl!==n||e.r.lvl!==n?t:M$1(e,{l:M$1(t,{r:e.l}),lvl:n+1})}function D$1(t){var e=t.l;return H$1(e)||e.lvl!==t.lvl?t:M$1(e,{r:M$1(t,{l:e.r})})}function G$1(t,e,n,r){void 0===r&&(r=0);for(var o=t.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1;}else {if(o===r)return i;r=i+1;}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function _$1(t,e,n){return t[G$1(t,e,n)]}var j$1=system(function(){return {recalcInProgress:statefulStream(!1)}},[],{singleton:!0});function K$1(t){var e=t.size,n=t.startIndex,r=t.endIndex;return function(t){return t.start===n&&(t.end===r||Infinity===t.end)&&t.value===e}}function Y$1(t,e){var n=t.index;return e===n?0:e<n?-1:1}function q$1(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function Z$1(t){return {index:t.index,value:t}}function J$1(t,e,n){var r=t,o=0,i=0,a=0,l=0;if(0!==e){a=r[l=G$1(r,e-1,Y$1)].offset;var s=k$1(n,e-1);o=s[0],i=s[1],r.length&&r[l].size===k$1(n,e)[1]&&(l-=1),r=r.slice(0,l+1);}else r=[];for(var u,c=d(A$1(n,e,Infinity));!(u=c()).done;){var m=u.value,f=m.start,p=m.value,h=(f-o)*i+a;r.push({offset:h,size:p,index:f}),o=f,a=h,i=p;}return {offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function $$1(t,e){var n=e[0],r=e[1];n.length>0&&(0, e[2])("received item sizes",n,p.DEBUG);var o=t.sizeTree,i=o,a=0;if(r.length>0&&H$1(o)&&2===n.length){var l=n[0].size,s=n[1].size;i=r.reduce(function(t,e){return z$1(z$1(t,e,l),e+1,s)},i);}else {var u=function(t,e){for(var n,r=H$1(t)?0:Infinity,o=d(e);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),H$1(t))t=z$1(t,0,a);else {var u=A$1(t,l-1,s+1);if(!u.some(K$1(i))){for(var c,m=!1,f=!1,p=d(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=L$1(t,g)):(f=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=z$1(t,s+1,S));}f&&(t=z$1(t,l,a));}}}return [t,r]}(i,n);i=u[0],a=u[1];}if(i===o)return t;var c=J$1(t.offsetTree,a,i),m=c.offsetTree;return {sizeTree:i,offsetTree:m,lastIndex:c.lastIndex,lastOffset:c.lastOffset,lastSize:c.lastSize,groupOffsetTree:r.reduce(function(t,e){return z$1(t,e,Q$1(e,m))},R$1()),groupIndices:r}}function Q$1(t,e){if(0===e.length)return 0;var n=_$1(e,t,Y$1);return n.size*(t-n.index)+n.offset}function X$1(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var r=tt$1("LAST"===t.index?n:t.index,e);return Math.max(0,r,Math.min(n,r))}function tt$1(t,e){if(!et$1(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function et$1(t){return !H$1(t.groupOffsetTree)}var nt$1={offsetHeight:"height",offsetWidth:"width"},rt$1=system(function(t){var n=t[0].log,r=t[1].recalcInProgress,o=stream(),i=stream(),a=statefulStreamFromEmitter(i,0),l=stream(),s=stream(),c=statefulStream(0),m=statefulStream([]),d=statefulStream(void 0),f=statefulStream(void 0),h=statefulStream(function(t,e){return T(t,nt$1[e])}),g=statefulStream(void 0),v={offsetTree:[],sizeTree:R$1(),groupOffsetTree:R$1(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},S=statefulStreamFromEmitter(pipe(o,withLatestFrom(m,n),scan($$1,v),distinctUntilChanged()),v);connect(pipe(m,filter(function(t){return t.length>0}),withLatestFrom(S),map(function(t){var e=t[0],n=t[1],r=e.reduce(function(t,e,r){return z$1(t,e,Q$1(e,n.offsetTree)||r)},R$1());return u({},n,{groupIndices:e,groupOffsetTree:r})})),S),connect(pipe(i,withLatestFrom(S),filter(function(t){return t[0]<t[1].lastIndex}),map(function(t){var e=t[1];return [{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),connect(d,f);var I=statefulStreamFromEmitter(pipe(d,map(function(t){return void 0===t})),!0);connect(pipe(f,filter(function(t){return void 0!==t&&H$1(getValue(S).sizeTree)}),map(function(t){return [{startIndex:0,endIndex:0,size:t}]})),o);var C=streamFromEmitter(pipe(o,withLatestFrom(S),scan(function(t,e){var n=e[1];return {changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:v}),map(function(t){return t.changed})));subscribe(pipe(c,scan(function(t,e){return {diff:t.prev-e,prev:e}},{diff:0,prev:0}),map(function(t){return t.diff})),function(t){t>0?(publish(r,!0),publish(l,t)):t<0&&publish(s,t);}),subscribe(pipe(c,withLatestFrom(n)),function(t){t[0]<0&&(0, t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},p.ERROR);});var w=streamFromEmitter(l);connect(pipe(l,withLatestFrom(S),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return F$1(n.sizeTree).reduce(function(t,n){var r=n.k,o=n.v;return {ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:r+e-1,size:t.prevSize}]),prevIndex:r+e,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var x=streamFromEmitter(pipe(s,withLatestFrom(S),map(function(t){return Q$1(-t[0],t[1].offsetTree)})));return connect(pipe(s,withLatestFrom(S),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=F$1(n.sizeTree).reduce(function(t,n){var r=n.v;return z$1(t,Math.max(0,n.k+e),r)},R$1());return u({},n,{sizeTree:r},J$1(n.offsetTree,0,r))})),S),{data:g,totalCount:i,sizeRanges:o,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:x,beforeUnshiftWith:w,firstItemIndex:c,sizes:S,listRefresh:C,statefulTotalCount:a,trackItemSizes:I,itemSize:h}},tup(v,j$1),{singleton:!0}),ot$1="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function it$1(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&ot$1||(e.behavior="auto"),e.offset||(e.offset=0),e}var at$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=t[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,d=a.footerHeight,f=t[2].log,h=stream(),g=statefulStream(0),v=null,S=null,I=null;function C(){v&&(v(),v=null),I&&(I(),I=null),S&&(clearTimeout(S),S=null),publish(l,!1);}return connect(pipe(h,withLatestFrom(r,s,o,g,m,d,f),map(function(t){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],u=t[5],m=t[6],d=t[7],f=it$1(n),g=f.align,T=f.behavior,w=f.offset,x=a-1,b=X$1(f,r,x),y=Q$1(b,r.offsetTree)+u;"end"===g?(y=y-o+k$1(r.sizeTree,b)[1],b===x&&(y+=m)):"center"===g?y=y-o/2+k$1(r.sizeTree,b)[1]/2:y-=s,w&&(y+=w);var E=function(t){C(),t?(d("retrying to scroll to",{location:n},p.DEBUG),publish(h,n)):d("list did not change, scroll successful",{},p.DEBUG);};if(C(),"smooth"===T){var H=!1;I=subscribe(i,function(t){H=H||t;}),v=handleNext(c,function(){E(H);});}else v=handleNext(pipe(i,function(t){var e=setTimeout(function(){t(!1);},150);return function(n){n&&(t(!0),clearTimeout(e));}}),E);return S=setTimeout(function(){C();},1200),publish(l,!0),d("scrolling from index to",{index:b,top:y,behavior:T},p.DEBUG),{top:y,behavior:T}})),u),{scrollToIndex:h,topListHeight:g}},tup(rt$1,b,v),{singleton:!0}),lt$1="up",st$1={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ut$1=system(function(t){var n=t[0],r=n.scrollContainerState,o=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=statefulStream(!1),c=statefulStream(!0),m=stream(),d=stream(),f=statefulStream(4),p=statefulStream(0),h=statefulStreamFromEmitter(pipe(merge(pipe(duc(o),skip(1),mapTo(!0)),pipe(duc(o),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()),!1),g=statefulStreamFromEmitter(pipe(merge(pipe(s,mapTo(!0)),pipe(s,mapTo(!1),debounceTime(200))),distinctUntilChanged()),!1);connect(pipe(combineLatest(duc(o),duc(p)),map(function(t){return t[0]<=t[1]}),distinctUntilChanged()),c),connect(pipe(c,throttleTime(50)),d);var v=streamFromEmitter(pipe(combineLatest(r,duc(i),duc(a),duc(l),duc(f)),scan(function(t,e){var n,r,o=e[0],i=o.scrollTop,a=o.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",r=t.state.scrollTop-i):(n="SIZE_DECREASED",r=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},st$1),distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=statefulStreamFromEmitter(pipe(r,scan(function(t,e){var n=e.scrollTop,r=e.scrollHeight,o=e.viewportHeight;return w(t.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:t.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),filter(function(t){return t.changed}),map(function(t){return t.jump})),0);connect(pipe(v,map(function(t){return t.atBottom})),u),connect(pipe(u,throttleTime(50)),m);var I=statefulStream("down");connect(pipe(r,map(function(t){return t.scrollTop}),distinctUntilChanged(),scan(function(t,n){return getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?lt$1:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),map(function(t){return t.direction})),I),connect(pipe(r,throttleTime(50),mapTo("none")),I);var C=statefulStream(0);return connect(pipe(h,filter(function(t){return !t}),mapTo(0)),C),connect(pipe(o,throttleTime(100),withLatestFrom(h),filter(function(t){return !!t[1]}),scan(function(t,e){return [t[1],e[0]]},[0,0]),map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},tup(b)),ct$1=system(function(t){var n=t[0].log,r=statefulStream(!1),o=streamFromEmitter(pipe(r,filter(function(t){return t}),distinctUntilChanged()));return subscribe(r,function(t){t&&getValue(n)("props updated",{},p.DEBUG);}),{propsReady:r,didMount:o}},tup(v),{singleton:!0}),mt$1=system(function(t){var n=t[0],r=n.sizes,o=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=statefulStream(!0),c=statefulStream(0);return connect(pipe(s,withLatestFrom(c),filter(function(t){return !!t[1]}),mapTo(!1)),u),subscribe(pipe(combineLatest(o,s),withLatestFrom(u,r,i),filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!H$1(t[2].sizeTree)||void 0!==n)&&!e}),withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){handleNext(a,function(){publish(u,!0);}),publish(l,n);});}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},tup(rt$1,b,at$1,ct$1),{singleton:!0});function dt$1(t){return !!t&&("smooth"===t?"smooth":"auto")}var ft$1=system(function(t){var n=t[0],r=n.totalCount,o=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,h=t[6].scrollingInProgress,g=statefulStream(!1),v=null;function S(t){publish(s,{index:"LAST",align:"end",behavior:t});}return subscribe(pipe(combineLatest(pipe(duc(r),skip(1)),d),withLatestFrom(duc(g),a,u,h),map(function(t){var e=t[0],n=e[0],r=e[1]&&t[3],o="auto";return r&&(o=function(t,e){return "function"==typeof t?dt$1(t(e)):e&&dt$1(t)}(t[1],t[2]||t[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,r=t.followOutputBehavior;v&&(v(),v=null),v=handleNext(o,function(){getValue(f)("following output to ",{totalCount:n},p.DEBUG),S(r),v=null;});}),subscribe(pipe(combineLatest(duc(g),r,m),filter(function(t){return t[0]&&t[2]}),scan(function(t,e){var n=e[1];return {refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),filter(function(t){return t.refreshed}),withLatestFrom(g,r)),function(t){var n=t[1],r=handleNext(l,function(t){!n||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||v||(getValue(f)("scrolling to bottom due to increased size",{},p.DEBUG),S("auto"));});setTimeout(r,100);}),subscribe(combineLatest(duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&S("auto");}),{followOutput:g}},tup(rt$1,ut$1,at$1,mt$1,ct$1,v,b));function pt$1(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var ht$1=system(function(t){var n=t[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=stream(),c=stream(),m=streamFromEmitter(pipe(u,map(pt$1)));return connect(pipe(m,map(function(t){return t.totalCount})),r),connect(pipe(m,map(function(t){return t.groupIndices})),o),connect(pipe(combineLatest(l,i,s),filter(function(t){return et$1(t[1])}),map(function(t){return k$1(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),distinctUntilChanged(),map(function(t){return [t]})),c),{groupCounts:u,topItemsIndexes:c}},tup(rt$1,b));function gt$1(t,e){return !(!t||t[0]!==e[0]||t[1]!==e[1])}function vt$1(t,e){return !(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function St$1(t,e,n){return "number"==typeof t?n===lt$1&&"top"===e||"down"===n&&"bottom"===e?t:0:n===lt$1?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function It$1(t,e){return "number"==typeof t?t:t[e]||0}var Ct$1=system(function(t){var n=t[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=stream(),u=statefulStream(0),c=statefulStream(0),m=statefulStream(0),d=statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(o),duc(a),duc(s,gt$1),duc(m),duc(u),duc(l),duc(i),duc(c)),map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=o[0],a=o[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(r-m,0),p="none",h=It$1(c,"top"),g=It$1(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>e+d-h&&(p=lt$1),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-St$1(l,"top",p)-h,0),m-f-s+n+St$1(l,"bottom",p)+g]:null}),filter(function(t){return null!=t}),distinctUntilChanged(gt$1)),[0,0]);return {listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},tup(b),{singleton:!0}),Tt$1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function wt$1(t,e,n){if(0===t.length)return [];if(!et$1(e))return t.map(function(t){return u({},t,{index:t.index+n,originalIndex:t.index})});for(var r,o=[],i=A$1(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=d(t);!(r=s()).done;){var c=r.value;(!a||a.end<c.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),o.push(u({},c.index===a.start?{type:"group",index:l}:{index:c.index-(l+1)+n,groupIndex:l},{size:c.size,offset:c.offset,originalIndex:c.index,data:c.data}));}return o}function xt$1(t,e,n,r,o){var i=0,a=0;if(t.length>0){i=t[0].offset;var l=t[t.length-1];a=l.offset+l.size;}var s=i,u=r.lastOffset+(n-r.lastIndex)*r.lastSize-a;return {items:wt$1(t,r,o),topItems:wt$1(e,r,o),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n,firstItemIndex:o}}var bt$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.data,a=n.firstItemIndex,l=t[1],s=t[2],c=s.visibleRange,m=s.listBoundary,f=s.topListHeight,p=t[3],h=p.scrolledToInitialItem,g=p.initialTopMostItemIndex,v=t[4].topListHeight,S=t[5],I=t[6].didMount,C=t[7].recalcInProgress,T=statefulStream([]),w=stream();connect(l.topItemsIndexes,T);var x=statefulStreamFromEmitter(pipe(combineLatest(I,C,duc(c,gt$1),duc(o),duc(r),duc(g),h,duc(T),duc(a),i),filter(function(t){return t[0]&&!t[1]}),map(function(t){var n=t[2],r=n[0],o=n[1],i=t[3],a=t[5],l=t[6],s=t[7],u=t[8],c=t[9],m=t[4],f=m.sizeTree,p=m.offsetTree;if(0===i||0===r&&0===o)return Tt$1;if(H$1(f))return xt$1(function(t,e,n){if(et$1(e)){var r=tt$1(t,e);return [{index:k$1(e.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return [{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return "number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),m,c),[],i,m,u);var h=[];if(s.length>0)for(var g,v=s[0],S=s[s.length-1],I=0,C=d(A$1(f,v,S));!(g=C()).done;)for(var T=g.value,w=T.value,x=Math.max(T.start,v),b=Math.min(T.end,S),y=x;y<=b;y++)h.push({index:y,size:w,offset:I,data:c&&c[y]}),I+=w;if(!l)return xt$1([],h,i,m,u);var E=s.length>0?s[s.length-1]+1:0,R=function(t,e,n,r){return void 0===r&&(r=0),r>0&&(e=Math.max(e,_$1(t,r,Y$1).offset)),W$1((i=n,l=G$1(o=t,e,a=q$1),s=G$1(o,i,a,l),o.slice(l,s+1)),Z$1);var o,i,a,l,s;}(p,r,o,E);if(0===R.length)return null;var L=i-1;return xt$1(tap([],function(t){for(var e,n=d(R);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;a.offset<r&&(l+=((s+=Math.floor((r-a.offset)/u))-i.start)*u),s<E&&(l+=(E-s)*u,s=E);for(var m=Math.min(i.end,L),f=s;f<=m&&!(l>=o);f++)t.push({index:f,size:u,offset:l,data:c&&c[f]}),l+=u;}}),h,i,m,u)}),filter(function(t){return null!==t}),distinctUntilChanged()),Tt$1);return connect(pipe(i,filter(function(t){return void 0!==t}),map(function(t){return t.length})),o),connect(pipe(x,map(function(t){return t.topListHeight})),v),connect(v,f),connect(pipe(x,map(function(t){return [t.top,t.bottom]})),m),connect(pipe(x,map(function(t){return t.items})),w),u({listState:x,topItemsIndexes:T,endReached:streamFromEmitter(pipe(x,filter(function(t){return t.items.length>0}),withLatestFrom(o,i),filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),map(function(t){return [t[1]-1,t[2]]}),distinctUntilChanged(gt$1),map(function(t){return t[0]}))),startReached:streamFromEmitter(pipe(x,throttleTime(200),filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),map(function(t){return t.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(x,filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(vt$1))),itemsRendered:w},S)},tup(rt$1,ht$1,Ct$1,mt$1,at$1,ut$1,ct$1,j$1),{singleton:!0}),yt$1=system(function(t){var n=t[0],r=n.sizes,o=n.firstItemIndex,i=n.data,a=t[1].listState,l=t[2].didMount,s=statefulStream(0);return connect(pipe(l,withLatestFrom(s),filter(function(t){return 0!==t[1]}),withLatestFrom(r,o,i),map(function(t){var e=t[0][1],n=t[1],r=t[2],o=t[3],i=void 0===o?[]:o,a=0;if(n.groupIndices.length>0)for(var l,s=d(n.groupIndices);!((l=s()).done||l.value-a>=e);)a++;var u=e+a;return xt$1(Array.from({length:u}).map(function(t,e){return {index:e,size:0,offset:0,data:i[e]}}),[],u,n,r)})),a),{initialItemCount:s}},tup(rt$1,bt$1,ct$1),{singleton:!0}),Et$1=system(function(t){var n=t[0].scrollVelocity,r=statefulStream(!1),o=stream(),i=statefulStream(!1);return connect(pipe(n,withLatestFrom(i,r,o),filter(function(t){return !!t[1]}),map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=n.enter;if(r){if((0, n.exit)(e,o))return !1}else if(i(e,o))return !0;return r}),distinctUntilChanged()),r),subscribe(pipe(combineLatest(r,n,o),withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},tup(ut$1),{singleton:!0}),Ht$1=system(function(t){var n=t[0].topItemsIndexes,r=statefulStream(0);return connect(pipe(r,filter(function(t){return t>0}),map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:r}},tup(bt$1)),Rt$1=system(function(t){var n=t[0],r=n.footerHeight,o=n.headerHeight,i=n.fixedHeaderHeight,a=t[1].listState,l=stream(),s=statefulStreamFromEmitter(pipe(combineLatest(r,o,i,a),map(function(t){var e=t[3];return t[0]+t[1]+t[2]+e.offsetBottom+e.bottom})),0);return connect(duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},tup(b,bt$1),{singleton:!0});function Lt$1(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var kt$1=Lt$1(function(){return /iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),zt$1=system(function(t){var n=t[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,h=m.sizes,g=t[4].log,v=t[5].recalcInProgress,S=streamFromEmitter(pipe(t[2].listState,withLatestFrom(l.lastJumpDueToItemResize),scan(function(t,e){var n=t[1],r=e[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return t[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,o,i,a]},[0,[],0,0]),filter(function(t){return 0!==t[0]}),withLatestFrom(o,c,a,u,g),filter(function(t){return !t[3]&&0!==t[1]&&t[2]===lt$1}),map(function(t){var e=t[0][0];return (0, t[5])("Upward scrolling compensation",{amount:e},p.DEBUG),e})));function I(t){t>0?(publish(r,{top:-t,behavior:"auto"}),publish(i,0)):(publish(i,0),publish(r,{top:-t,behavior:"auto"}));}return subscribe(pipe(S,withLatestFrom(i,s)),function(t){var n=t[0],r=t[1];t[2]&&kt$1()?publish(i,r-n):I(-n);}),subscribe(pipe(combineLatest(statefulStreamFromEmitter(s,!1),i,v),filter(function(t){return !t[0]&&!t[2]&&0!==t[1]}),map(function(t){return t[1]}),throttleTime(1)),I),connect(pipe(f,map(function(t){return {top:-t}})),r),subscribe(pipe(d,withLatestFrom(h),map(function(t){return t[0]*t[1].lastSize})),function(t){publish(i,t),requestAnimationFrame(function(){publish(r,{top:t}),requestAnimationFrame(function(){publish(i,0),publish(v,!1);});});}),{deviation:i}},tup(b,ut$1,bt$1,rt$1,v,j$1)),Bt$1=system(function(t){var n=t[0].totalListHeight,r=t[1].didMount,o=t[2].scrollTo,i=statefulStream(0);return subscribe(pipe(r,withLatestFrom(i),filter(function(t){return 0!==t[1]}),map(function(t){return {top:t[1]}})),function(t){handleNext(pipe(n,filter(function(t){return 0!==t})),function(){setTimeout(function(){publish(o,t);});});}),{initialScrollTop:i}},tup(Rt$1,ct$1,b),{singleton:!0}),Ft$1=system(function(t){var n=t[0].viewportHeight,r=t[1].totalListHeight,o=statefulStream(!1);return {alignToBottom:o,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(o,n,r),filter(function(t){return t[0]}),map(function(t){return Math.max(0,t[1]-t[2])}),distinctUntilChanged()),0)}},tup(b,Rt$1),{singleton:!0}),Pt$1=system(function(t){var n=t[0],r=n.scrollTo,o=n.scrollContainerState,i=stream(),a=stream(),l=stream(),s=statefulStream(!1),c=statefulStream(void 0);return connect(pipe(combineLatest(i,a),map(function(t){var e=t[0],n=e.viewportHeight,r=e.scrollHeight;return {scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:r,viewportHeight:n}})),o),connect(pipe(r,withLatestFrom(a),map(function(t){var e=t[0];return u({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},tup(b)),Ot$1=["done","behavior"],Mt$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=t[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,m=i.scrollingInProgress,d=t[2].scrollToIndex,f=stream();return connect(pipe(f,withLatestFrom(r,l,o,s,a),map(function(t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],l=t[5],s=n.done,d=n.behavior,f=c(n,Ot$1),p=null,h=X$1(n,r,i-1),g=Q$1(h,r.offsetTree)+a;return g<l?p=u({},f,{behavior:d,align:"start"}):g+k$1(r.sizeTree,h)[1]>l+o&&(p=u({},f,{behavior:d,align:"end"})),p?s&&handleNext(pipe(m,skip(1),filter(function(t){return !1===t})),s):s&&s(),p}),filter(function(t){return null!==t})),d),{scrollIntoView:f}},tup(rt$1,b,at$1,bt$1,v),{singleton:!0}),Vt$1=["listState","topItemsIndexes"],Ut$1=system(function(t){return u({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},tup(Ct$1,yt$1,ct$1,Et$1,Rt$1,Bt$1,Ft$1,Pt$1,Mt$1)),At$1=system(function(t){var n=t[0],r=n.totalCount,o=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,m=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=t[1],g=h.initialTopMostItemIndex,v=h.scrolledToInitialItem,S=t[2],I=t[3],C=t[4],T=C.listState,w=C.topItemsIndexes,x=c(C,Vt$1),b=t[5].scrollToIndex,y=t[7].topItemCount,E=t[8].groupCounts,H=t[9],R=t[10];return connect(x.rangeChanged,H.scrollSeekRangeChanged),connect(pipe(H.windowViewportRect,map(function(t){return t.visibleHeight})),S.viewportHeight),u({totalCount:r,data:m,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:g,scrolledToInitialItem:v,topItemsIndexes:w,topItemCount:y,groupCounts:E,fixedItemHeight:i,defaultItemHeight:a},I,{statefulTotalCount:p,listState:T,scrollToIndex:b,trackItemSizes:l,itemSize:s,groupIndices:f},x,H,S,R)},tup(rt$1,mt$1,b,ft$1,bt$1,at$1,zt$1,Ht$1,ht$1,Ut$1,v)),Wt$1=Lt$1(function(){if("undefined"==typeof document)return "sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Nt$1(t,e){var n=React.useRef(null),r=React.useCallback(function(r){if(null!==r&&r.offsetParent){var o,i,a=r.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+e.scrollTop;}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:o,visibleWidth:l},t(n.current);}},[t,e]),l=S(r),s=l.callbackRef,u=l.ref,c=React.useCallback(function(){r(u.current);},[r,u]);return React.useEffect(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e);}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c);}},[c,e]),s}var Dt$1=["placeholder"],Gt$1=["style","children"],_t$1=["style","children"];function jt$1(t){return t}var Kt$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),n=statefulStream(null),r=statefulStream(function(t){return "Group "+t}),o=statefulStream({}),i=statefulStream(jt$1),a=statefulStream("div"),l=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(o,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {context:n,itemContent:t,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Yt$1(t,n){var r=stream();return subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),connect(r,t),r}var qt$1=system(function(t){var n=t[0],r=t[1],o={item:Yt$1(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Yt$1(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Yt$1(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Yt$1(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Yt$1(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function i(t,n,o){connect(pipe(t,withLatestFrom(r.components),map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components);}return subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,Dt$1);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(r.components,u({},getValue(r.components),{ScrollSeekPlaceholder:o})),publish(n.scrollSeekConfiguration,i);}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),u({},n,r,o)},tup(At$1,Kt$1)),Zt$1=function(t){return React__namespace.createElement("div",{style:{height:t.height}})},Jt$1={position:Wt$1(),zIndex:1,overflowAnchor:"none"},$t$1={overflowAnchor:"none"},Qt$1=React__namespace.memo(function(t){var r=t.showTopList,o=void 0!==r&&r,i=fe$1("listState"),a=de$1("sizeRanges"),s=fe$1("useWindowScroll"),c=fe$1("customScrollParent"),m=de$1("windowScrollContainerState"),d=de$1("scrollContainerState"),f=c||s?m:d,p=fe$1("itemContent"),h=fe$1("context"),g=fe$1("groupContent"),v=fe$1("trackItemSizes"),S=fe$1("itemSize"),I=fe$1("log"),T=C(a,S,v,o?noop:f,I,c).callbackRef,w=React__namespace.useState(0),x=w[0],b=w[1];pe$1("deviation",function(t){x!==t&&b(t);});var y=fe$1("EmptyPlaceholder"),E=fe$1("ScrollSeekPlaceholder")||Zt$1,H=fe$1("ListComponent"),R=fe$1("ItemComponent"),L=fe$1("GroupComponent"),k=fe$1("computeItemKey"),z=fe$1("isSeeking"),B=fe$1("groupIndices").length>0,F=fe$1("paddingTopAddition"),P=o?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+F,paddingBottom:i.offsetBottom,marginTop:x};return !o&&0===i.totalCount&&y?React.createElement(y,ne$1(y,h)):React.createElement(H,u({},ne$1(H,h),{ref:T,style:P,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=k(e+i.firstItemIndex,t.data,h);return z?React.createElement(E,u({},ne$1(E,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?React.createElement(L,u({},ne$1(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Jt$1}),g(t.index)):React.createElement(R,u({},ne$1(R,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:$t$1}),B?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),Xt$1={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch",willChange:"transform"},te$1={width:"100%",height:"100%",position:"absolute",top:0},ee$1={width:"100%",position:Wt$1(),top:0};function ne$1(t,e){if("string"!=typeof t)return {context:e}}var re$1=React__namespace.memo(function(){var t=fe$1("HeaderComponent"),e=de$1("headerHeight"),n=fe$1("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe$1("context");return t?React.createElement(n,{ref:r},React.createElement(t,ne$1(t,o))):null}),oe$1=React__namespace.memo(function(){var t=fe$1("FooterComponent"),e=de$1("footerHeight"),n=fe$1("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe$1("context");return t?React.createElement(n,{ref:r},React.createElement(t,ne$1(t,o))):null});function ie$1(t){var e=t.usePublisher,r=t.useEmitter,o=t.useEmitterValue;return React__namespace.memo(function(t){var n=t.style,i=t.children,a=c(t,Gt$1),s=e("scrollContainerState"),m=o("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(s,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),React.createElement(m,u({ref:g,style:u({},Xt$1,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,ne$1(m,p)),i)})}function ae$1(t){var r=t.usePublisher,o=t.useEmitter,i=t.useEmitterValue;return React__namespace.memo(function(t){var n=t.style,a=t.children,s=c(t,_t$1),m=r("windowScrollContainerState"),d=i("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=i("totalListHeight"),g=i("deviation"),v=i("customScrollParent"),S=i("context"),I=x(m,f,d,noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return h(function(){return C.current=v||window,function(){C.current=null;}},[C,v]),o("windowScrollTo",w),o("scrollBy",T),React.createElement(d,u({style:u({position:"relative"},n,0!==p?{height:p+g}:{}),"data-virtuoso-scroller":!0},s,ne$1(d,S)),a)})}var le$1=function(t){var r=t.children,o=de$1("viewportHeight"),i=I(compose(o,function(t){return T(t,"height")}));return React__namespace.createElement("div",{style:te$1,ref:i,"data-viewport-type":"element"},r)},se$1=function(t){var e=t.children,r=Nt$1(de$1("windowViewportRect"),fe$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1,"data-viewport-type":"window"},e)},ue$1=function(t){var e=t.children,n=fe$1("TopItemListComponent"),r=fe$1("headerHeight"),o=u({},ee$1,{marginTop:r+"px"}),i=fe$1("context");return React.createElement(n||"div",{style:o,context:i},e)},ce$1=systemToComponent(qt$1,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React__namespace.memo(function(t){var e=fe$1("useWindowScroll"),r=fe$1("topItemsIndexes").length>0,o=fe$1("customScrollParent"),i=o||e?se$1:le$1;return React__namespace.createElement(o||e?ge$1:he$1,u({},t),React__namespace.createElement(i,null,React__namespace.createElement(re$1,null),React__namespace.createElement(Qt$1,null),React__namespace.createElement(oe$1,null)),r&&React__namespace.createElement(ue$1,null,React__namespace.createElement(Qt$1,{showTopList:!0})))})),me$1=ce$1.Component,de$1=ce$1.usePublisher,fe$1=ce$1.useEmitterValue,pe$1=ce$1.useEmitter,he$1=ie$1({usePublisher:de$1,useEmitterValue:fe$1,useEmitter:pe$1}),ge$1=ae$1({usePublisher:de$1,useEmitterValue:fe$1,useEmitter:pe$1}),ve$1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Se$1={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ie$1=Math.round,Ce$1=Math.ceil,Te$1=Math.floor,we$1=Math.min,xe$1=Math.max;function be$1(t,e){return Array.from({length:e-t+1}).map(function(e,n){return {index:n+t}})}var ye$1=system(function(t){var n=t[0],r=n.overscan,o=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=statefulStream(0),E=statefulStream(0),H=statefulStream(ve$1),R=statefulStream({height:0,width:0}),L=statefulStream({height:0,width:0}),k=stream(),z=stream(),B=statefulStream(0);connect(pipe(S,withLatestFrom(E),filter(function(t){return 0!==t[1]}),map(function(t){return {items:be$1(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),H),connect(pipe(combineLatest(duc(y),o,duc(L,function(t,e){return t&&t.width===e.width&&t.height===e.height})),withLatestFrom(R),map(function(t){var e=t[0],n=e[0],r=e[1],o=r[0],i=r[1],a=e[2],l=t[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return ve$1;if(0===u)return Se$1;var m=Re$1(c,u),d=m*Te$1(o/s),f=m*Ce$1(i/s)-1;f=xe$1(0,we$1(n-1,f));var p=be$1(d=we$1(f,xe$1(0,d)),f),h=Ee$1(l,a,p),g=h.top,v=h.bottom;return {items:p,offsetTop:g,offsetBottom:Ce$1(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),H),connect(pipe(R,map(function(t){return t.height})),s),connect(pipe(combineLatest(R,L,H),map(function(t){var e=Ee$1(t[0],t[1],t[2].items);return [e.top,e.bottom]}),distinctUntilChanged(gt$1)),i);var F=streamFromEmitter(pipe(duc(H),filter(function(t){return t.items.length>0}),withLatestFrom(y),filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),map(function(t){return t[1]-1}),distinctUntilChanged())),P=streamFromEmitter(pipe(duc(H),filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),mapTo(0),distinctUntilChanged())),O=streamFromEmitter(pipe(duc(H),filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(vt$1)));connect(O,h.scrollSeekRangeChanged),connect(pipe(k,withLatestFrom(R,L,y),map(function(t){var e=t[1],n=t[2],r=t[3],o=it$1(t[0]),i=o.align,a=o.behavior,l=o.offset,s=o.index;"LAST"===s&&(s=r-1);var u=He$1(e,n,s=xe$1(0,s,we$1(r-1,s)));return "end"===i?u=Ie$1(u-e.height+n.height):"center"===i&&(u=Ie$1(u-e.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),m);var M=statefulStreamFromEmitter(pipe(H,map(function(t){return t.offsetBottom+t.bottom})),0);return connect(pipe(C,map(function(t){return {width:t.visibleWidth,height:t.visibleHeight}})),R),u({totalCount:y,viewportDimensions:R,itemDimensions:L,scrollTop:l,scrollHeight:z,overscan:r,scrollBy:c,scrollTo:m,scrollToIndex:k,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:B,scrollContainerState:f,initialItemCount:E},h,{gridState:H,totalListHeight:M},p,{startReached:P,endReached:F,rangeChanged:O,propsReady:v})},tup(Ct$1,b,ut$1,Et$1,ct$1,Pt$1));function Ee$1(t,e,n){var r=e.height;return void 0===r||0===n.length?{top:0,bottom:0}:{top:He$1(t,e,n[0].index),bottom:He$1(t,e,n[n.length-1].index)+r}}function He$1(t,e,n){var r=Re$1(t.width,e.width);return Te$1(n/r)*e.height}function Re$1(t,e){return xe$1(1,Te$1(t/e))}var Le$1=["placeholder"],ke$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),n=statefulStream({}),r=statefulStream(null),o=statefulStream("virtuoso-grid-item"),i=statefulStream("virtuoso-grid-list"),a=statefulStream(jt$1),l=statefulStream(noop),s=function(t,r){return void 0===r&&(r=null),statefulStreamFromEmitter(pipe(n,map(function(e){return e[t]}),distinctUntilChanged()),r)};return {context:r,itemContent:t,components:n,computeItemKey:a,itemClassName:o,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),ze$1=system(function(t){var n=t[0],r=t[1],o={item:Yt$1(r.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function i(t,n,o){connect(pipe(t,withLatestFrom(r.components),map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components);}return subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,Le$1);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(r.components,u({},getValue(r.components),{ScrollSeekPlaceholder:o})),publish(n.scrollSeekConfiguration,i);}),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),u({},n,r,o)},tup(ye$1,ke$1)),Be$1=React__namespace.memo(function(){var t=Ue$1("gridState"),e=Ue$1("listClassName"),n=Ue$1("itemClassName"),r=Ue$1("itemContent"),o=Ue$1("computeItemKey"),i=Ue$1("isSeeking"),a=Ve$1("scrollHeight"),s=Ue$1("ItemComponent"),c=Ue$1("ListComponent"),m=Ue$1("ScrollSeekPlaceholder"),d=Ue$1("context"),f=Ve$1("itemDimensions"),p=I(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect());});return React.createElement(c,u({ref:p,className:e},ne$1(c,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=o(e.index);return i?React.createElement(m,u({key:a},ne$1(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):React.createElement(s,u({},ne$1(s,d),{className:n,"data-index":e.index,key:a}),r(e.index,d))}))}),Fe$1=function(t){var e=t.children,r=Ve$1("viewportDimensions"),o=I(function(t){r(t.getBoundingClientRect());});return React__namespace.createElement("div",{style:te$1,ref:o},e)},Pe$1=function(t){var e=t.children,r=Nt$1(Ve$1("windowViewportRect"),Ue$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1},e)},Oe$1=systemToComponent(ze$1,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React__namespace.memo(function(t){var e=u({},t),r=Ue$1("useWindowScroll"),o=Ue$1("customScrollParent"),i=o||r?Pe$1:Fe$1;return React__namespace.createElement(o||r?Ne$1:We$1,u({},e),React__namespace.createElement(i,null,React__namespace.createElement(Be$1,null)))})),Ve$1=Oe$1.usePublisher,Ue$1=Oe$1.useEmitterValue,Ae$1=Oe$1.useEmitter,We$1=ie$1({usePublisher:Ve$1,useEmitterValue:Ue$1,useEmitter:Ae$1}),Ne$1=ae$1({usePublisher:Ve$1,useEmitterValue:Ue$1,useEmitter:Ae$1}),De$1=system(function(){var t=statefulStream(function(t){return React__namespace.createElement("td",null,"Item $",t)}),r=statefulStream(null),o=statefulStream(null),i=statefulStream({}),a=statefulStream(jt$1),l=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(i,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {context:r,itemContent:t,fixedHeaderContent:o,components:i,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),Ge$1=system(function(t){return u({},t[0],t[1])},tup(At$1,De$1)),_e$1=function(t){return React__namespace.createElement("tr",null,React__namespace.createElement("td",{style:{height:t.height}}))},je$1=function(t){return React__namespace.createElement("tr",null,React__namespace.createElement("td",{style:{height:t.height,padding:0,border:0}}))},Ke$1=React__namespace.memo(function(){var t=Qe$1("listState"),e=$e("sizeRanges"),r=Qe$1("useWindowScroll"),o=Qe$1("customScrollParent"),i=$e("windowScrollContainerState"),a=$e("scrollContainerState"),s=o||r?i:a,c=Qe$1("itemContent"),m=Qe$1("trackItemSizes"),d=C(e,Qe$1("itemSize"),m,s,Qe$1("log"),o),f=d.callbackRef,p=d.ref,h=React__namespace.useState(0),g=h[0],v=h[1];Xe$1("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t));});var S=Qe$1("EmptyPlaceholder"),I=Qe$1("ScrollSeekPlaceholder")||_e$1,T=Qe$1("FillerRow")||je$1,w=Qe$1("TableBodyComponent"),x=Qe$1("TableRowComponent"),b=Qe$1("computeItemKey"),y=Qe$1("isSeeking"),E=Qe$1("paddingTopAddition"),H=Qe$1("firstItemIndex"),R=Qe$1("statefulTotalCount"),L=Qe$1("context");if(0===R&&S)return React.createElement(S,ne$1(S,L));var k=t.offsetTop+E+g,z=t.offsetBottom,B=k>0?React__namespace.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?React__namespace.createElement(T,{height:z,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+H,t.data,L);return y?React.createElement(I,u({},ne$1(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):React.createElement(x,u({},ne$1(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),c(t.index,t.data,L))});return React.createElement(w,u({ref:f,"data-test-id":"virtuoso-item-list"},ne$1(w,L)),[B].concat(P,[F]))}),Ye$1=function(t){var r=t.children,o=$e("viewportHeight"),i=I(compose(o,function(t){return T(t,"height")}));return React__namespace.createElement("div",{style:te$1,ref:i,"data-viewport-type":"element"},r)},qe$1=function(t){var e=t.children,r=Nt$1($e("windowViewportRect"),Qe$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1,"data-viewport-type":"window"},e)},Ze$1=systemToComponent(Ge$1,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React__namespace.memo(function(t){var r=Qe$1("useWindowScroll"),o=Qe$1("customScrollParent"),i=$e("fixedHeaderHeight"),a=Qe$1("fixedHeaderContent"),l=Qe$1("context"),s=I(compose(i,function(t){return T(t,"height")})),c=o||r?en$1:tn$1,m=o||r?qe$1:Ye$1,d=Qe$1("TableComponent"),f=Qe$1("TableHeadComponent"),p=a?React__namespace.createElement(f,u({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:s},ne$1(f,l)),a()):null;return React__namespace.createElement(c,u({},t),React__namespace.createElement(m,null,React__namespace.createElement(d,u({style:{borderSpacing:0}},ne$1(d,l)),[p,React__namespace.createElement(Ke$1,{key:"TableBody"})])))})),$e=Ze$1.usePublisher,Qe$1=Ze$1.useEmitterValue,Xe$1=Ze$1.useEmitter,tn$1=ie$1({usePublisher:$e,useEmitterValue:Qe$1,useEmitter:Xe$1}),en$1=ae$1({usePublisher:$e,useEmitterValue:Qe$1,useEmitter:Xe$1}),nn$1=me$1;
48784
+ window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};function u(){return u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);}return t},u.apply(this,arguments)}function c(t,e){if(null==t)return {};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return (n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,p,h="undefined"!=typeof document?React.useLayoutEffect:React.useEffect;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR";}(p||(p={}));var g=((f={})[p.DEBUG]="debug",f[p.INFO]="log",f[p.WARN]="warn",f[p.ERROR]="error",f),v=system(function(){var t=statefulStream(p.ERROR);return {log:statefulStream(function(n,r,o){var i;void 0===o&&(o=p.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:getValue(t))&&console[g[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r);}),logLevel:t}},[],{singleton:!0});function S(t,e){void 0===e&&(e=!0);var n=React.useRef(null),r=function(t){};if("undefined"!=typeof ResizeObserver){var o=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n);});r=function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null);};}return {ref:n,callbackRef:r}}function I(t,e){return void 0===e&&(e=!0),S(t,e).callbackRef}function C(t,e,n,r,o,i,a){return S(function(n){for(var l=function(t,e,n,r){var o=t.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},p.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++;}}}return i}(n.children,e,0,o),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u=a?a.scrollTop:"window"===s.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop;r({scrollTop:Math.max(u,0),scrollHeight:(null!=a?a:s).scrollHeight,viewportHeight:(null!=a?a:s).offsetHeight}),null==i||i(function(t,e,n){return "normal"===e||e.endsWith("px")||n("row-gap was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(e,10)}(0,getComputedStyle(n).rowGap,o)),null!==l&&t(l);},n)}function T(t,e){return Math.round(t.getBoundingClientRect()[e])}function w(t,e){return Math.abs(t-e)<1.01}function x(t,n,r,l,u){void 0===l&&(l=noop);var c=React.useRef(null),m=React.useRef(null),d=React.useRef(null),f=React.useRef(!1),p=React.useCallback(function(e){var r=e.target,o=r===window||r===document,i=o?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,a=o?document.documentElement.scrollHeight:r.scrollHeight,l=o?window.innerHeight:r.offsetHeight,u=function(){t({scrollTop:Math.max(i,0),scrollHeight:a,viewportHeight:l});};f.current?reactDom.flushSync(u):u(),f.current=!1,null!==m.current&&(i===m.current||i<=0||i===a-l)&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null));},[t,n]);return React.useEffect(function(){var t=u||c.current;return l(u||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p);}},[c,p,r,l,u]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t);},scrollToCallback:function(e){var r=c.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===e.behavior;if(r===window?(i=Math.max(T(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=T(r,"height"),a=r.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-o,e.top),0)),w(o,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0);},1e3)):m.current=null,r.scrollTo(e);}}}}var b=system(function(){var t=stream(),n=stream(),r=statefulStream(0),o=stream(),i=statefulStream(0),a=stream(),l=stream(),s=statefulStream(0),u=statefulStream(0),c=statefulStream(0),m=stream(),d=stream(),f=statefulStream(!1),p=statefulStream(!1);return connect(pipe(t,map(function(t){return t.scrollTop})),n),connect(pipe(t,map(function(t){return t.scrollHeight})),l),connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0}),y={lvl:0};function E(t,e,n,r,o){return void 0===r&&(r=y),void 0===o&&(o=y),{k:t,v:e,lvl:n,l:r,r:o}}function H$1(t){return t===y}function R$1(){return y}function L$1(t,e){if(H$1(t))return y;var n=t.k,r=t.l,o=t.r;if(e===n){if(H$1(r))return o;if(H$1(o))return r;var i=P$1(r);return U$1(M$1(t,{k:i[0],v:i[1],l:O$1(r)}))}return U$1(M$1(t,e<n?{l:L$1(r,e)}:{r:L$1(o,e)}))}function k$1(t,e,n){if(void 0===n&&(n="k"),H$1(t))return [-Infinity,void 0];if(t[n]===e)return [t.k,t.v];if(t[n]<e){var r=k$1(t.r,e,n);return -Infinity===r[0]?[t.k,t.v]:r}return k$1(t.l,e,n)}function z$1(t,e,n){return H$1(t)?E(e,n,1):e===t.k?M$1(t,{k:e,v:n}):function(t){return N$1(D$1(t))}(M$1(t,e<t.k?{l:z$1(t.l,e,n)}:{r:z$1(t.r,e,n)}))}function B$1(t,e,n){if(H$1(t))return [];var r=t.k,o=t.v,i=t.r,a=[];return r>e&&(a=a.concat(B$1(t.l,e,n))),r>=e&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(B$1(i,e,n))),a}function F$1(t){return H$1(t)?[]:[].concat(F$1(t.l),[{k:t.k,v:t.v}],F$1(t.r))}function P$1(t){return H$1(t.r)?[t.k,t.v]:P$1(t.r)}function O$1(t){return H$1(t.r)?t.l:U$1(M$1(t,{r:O$1(t.r)}))}function M$1(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function V$1(t){return H$1(t)||t.lvl>t.r.lvl}function U$1(t){var e=t.l,n=t.r,r=t.lvl;if(n.lvl>=r-1&&e.lvl>=r-1)return t;if(r>n.lvl+1){if(V$1(e))return D$1(M$1(t,{lvl:r-1}));if(H$1(e)||H$1(e.r))throw new Error("Unexpected empty nodes");return M$1(e.r,{l:M$1(e,{r:e.r.l}),r:M$1(t,{l:e.r.r,lvl:r-1}),lvl:r})}if(V$1(t))return N$1(M$1(t,{lvl:r-1}));if(H$1(n)||H$1(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=V$1(o)?n.lvl-1:n.lvl;return M$1(o,{l:M$1(t,{r:o.l,lvl:r-1}),r:N$1(M$1(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function A$1(t,e,n){return H$1(t)?[]:W$1(B$1(t,k$1(t,e)[0],n),function(t){return {index:t.k,value:t.v}})}function W$1(t,e){var n=t.length;if(0===n)return [];for(var r=e(t[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c;}return a.push({start:o,end:Infinity,value:i}),a}function N$1(t){var e=t.r,n=t.lvl;return H$1(e)||H$1(e.r)||e.lvl!==n||e.r.lvl!==n?t:M$1(e,{l:M$1(t,{r:e.l}),lvl:n+1})}function D$1(t){var e=t.l;return H$1(e)||e.lvl!==t.lvl?t:M$1(e,{r:M$1(t,{l:e.r})})}function G$1(t,e,n,r){void 0===r&&(r=0);for(var o=t.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1;}else {if(o===r)return i;r=i+1;}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function _$1(t,e,n){return t[G$1(t,e,n)]}var j$1=system(function(){return {recalcInProgress:statefulStream(!1)}},[],{singleton:!0});function K$1(t){var e=t.size,n=t.startIndex,r=t.endIndex;return function(t){return t.start===n&&(t.end===r||Infinity===t.end)&&t.value===e}}function Y$1(t,e){var n=t.index;return e===n?0:e<n?-1:1}function q$1(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function Z$1(t){return {index:t.index,value:t}}function J$1(t,e,n,r){var o=t,i=0,a=0,l=0,s=0;if(0!==e){l=o[s=G$1(o,e-1,Y$1)].offset;var u=k$1(n,e-1);i=u[0],a=u[1],o.length&&o[s].size===k$1(n,e)[1]&&(s-=1),o=o.slice(0,s+1);}else o=[];for(var c,m=d(A$1(n,e,Infinity));!(c=m()).done;){var f=c.value,p=f.start,h=f.value,g=p-i,v=g*a+l+g*r;o.push({offset:v,size:h,index:p}),i=p,l=v,a=h;}return {offsetTree:o,lastIndex:i,lastOffset:l,lastSize:a}}function $$1(t,e){var n=e[0],r=e[1],o=e[3];n.length>0&&(0, e[2])("received item sizes",n,p.DEBUG);var i=t.sizeTree,a=i,l=0;if(r.length>0&&H$1(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=r.reduce(function(t,e){return z$1(z$1(t,e,s),e+1,u)},a);}else {var c=function(t,e){for(var n,r=H$1(t)?0:Infinity,o=d(e);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),H$1(t))t=z$1(t,0,a);else {var u=A$1(t,l-1,s+1);if(!u.some(K$1(i))){for(var c,m=!1,f=!1,p=d(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=L$1(t,g)):(f=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=z$1(t,s+1,S));}f&&(t=z$1(t,l,a));}}}return [t,r]}(a,n);a=c[0],l=c[1];}if(a===i)return t;var m=J$1(t.offsetTree,l,a,o),f=m.offsetTree;return {sizeTree:a,offsetTree:f,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:r.reduce(function(t,e){return z$1(t,e,Q$1(e,f,o))},R$1()),groupIndices:r}}function Q$1(t,e,n){if(0===e.length)return 0;var r=_$1(e,t,Y$1),o=t-r.index,i=r.size*o+(o-1)*n+r.offset;return i>0?i+n:i}function X$1(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var r=tt$1("LAST"===t.index?n:t.index,e);return Math.max(0,r,Math.min(n,r))}function tt$1(t,e){if(!et$1(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function et$1(t){return !H$1(t.groupOffsetTree)}var nt$1={offsetHeight:"height",offsetWidth:"width"},rt$1=system(function(t){var n=t[0].log,r=t[1].recalcInProgress,o=stream(),i=stream(),a=statefulStreamFromEmitter(i,0),l=stream(),s=stream(),c=statefulStream(0),m=statefulStream([]),d=statefulStream(void 0),f=statefulStream(void 0),h=statefulStream(function(t,e){return T(t,nt$1[e])}),g=statefulStream(void 0),v=statefulStream(0),S={offsetTree:[],sizeTree:R$1(),groupOffsetTree:R$1(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=statefulStreamFromEmitter(pipe(o,withLatestFrom(m,n,v),scan($$1,S),distinctUntilChanged()),S);connect(pipe(m,filter(function(t){return t.length>0}),withLatestFrom(I,v),map(function(t){var e=t[0],n=t[1],r=t[2],o=e.reduce(function(t,e,o){return z$1(t,e,Q$1(e,n.offsetTree,r)||o)},R$1());return u({},n,{groupIndices:e,groupOffsetTree:o})})),I),connect(pipe(i,withLatestFrom(I),filter(function(t){return t[0]<t[1].lastIndex}),map(function(t){var e=t[1];return [{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),connect(d,f);var C=statefulStreamFromEmitter(pipe(d,map(function(t){return void 0===t})),!0);connect(pipe(f,filter(function(t){return void 0!==t&&H$1(getValue(I).sizeTree)}),map(function(t){return [{startIndex:0,endIndex:0,size:t}]})),o);var w=streamFromEmitter(pipe(o,withLatestFrom(I),scan(function(t,e){var n=e[1];return {changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:S}),map(function(t){return t.changed})));subscribe(pipe(c,scan(function(t,e){return {diff:t.prev-e,prev:e}},{diff:0,prev:0}),map(function(t){return t.diff})),function(t){t>0?(publish(r,!0),publish(l,t)):t<0&&publish(s,t);}),subscribe(pipe(c,withLatestFrom(n)),function(t){t[0]<0&&(0, t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},p.ERROR);});var x=streamFromEmitter(l);connect(pipe(l,withLatestFrom(I),map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return F$1(n.sizeTree).reduce(function(t,n){var r=n.k,o=n.v;return {ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:r+e-1,size:t.prevSize}]),prevIndex:r+e,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var b=streamFromEmitter(pipe(s,withLatestFrom(I,v),map(function(t){return Q$1(-t[0],t[1].offsetTree,t[2])})));return connect(pipe(s,withLatestFrom(I,v),map(function(t){var e=t[0],n=t[1],r=t[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=F$1(n.sizeTree).reduce(function(t,n){var r=n.v;return z$1(t,Math.max(0,n.k+e),r)},R$1());return u({},n,{sizeTree:o},J$1(n.offsetTree,0,o,r))})),I),{data:g,totalCount:i,sizeRanges:o,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:b,beforeUnshiftWith:x,firstItemIndex:c,gap:v,sizes:I,listRefresh:w,statefulTotalCount:a,trackItemSizes:C,itemSize:h}},tup(v,j$1),{singleton:!0}),ot$1="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function it$1(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&ot$1||(e.behavior="auto"),e.offset||(e.offset=0),e}var at$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=n.gap,l=t[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,h=t[2].log,g=stream(),v=statefulStream(0),S=null,I=null,C=null;function T(){S&&(S(),S=null),C&&(C(),C=null),I&&(clearTimeout(I),I=null),publish(s,!1);}return connect(pipe(g,withLatestFrom(r,u,o,v,d,f,h),withLatestFrom(a),map(function(t){var n=t[0],r=n[0],o=n[1],a=n[2],l=n[3],u=n[4],c=n[5],d=n[6],f=n[7],h=t[1],v=it$1(r),w=v.align,x=v.behavior,b=v.offset,y=l-1,E=X$1(v,o,y),H=Q$1(E,o.offsetTree,h)+c;"end"===w?(H=H-a+k$1(o.sizeTree,E)[1],E===y&&(H+=d)):"center"===w?H=H-a/2+k$1(o.sizeTree,E)[1]/2:H-=u,b&&(H+=b);var R=function(t){T(),t?(f("retrying to scroll to",{location:r},p.DEBUG),publish(g,r)):f("list did not change, scroll successful",{},p.DEBUG);};if(T(),"smooth"===x){var L=!1;C=subscribe(i,function(t){L=L||t;}),S=handleNext(m,function(){R(L);});}else S=handleNext(pipe(i,function(t){var e=setTimeout(function(){t(!1);},150);return function(n){n&&(t(!0),clearTimeout(e));}}),R);return I=setTimeout(function(){T();},1200),publish(s,!0),f("scrolling from index to",{index:E,top:H,behavior:x},p.DEBUG),{top:H,behavior:x}})),c),{scrollToIndex:g,topListHeight:v}},tup(rt$1,b,v),{singleton:!0}),lt$1="up",st$1={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ut$1=system(function(t){var n=t[0],r=n.scrollContainerState,o=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=statefulStream(!1),c=statefulStream(!0),m=stream(),d=stream(),f=statefulStream(4),p=statefulStream(0),h=statefulStreamFromEmitter(pipe(merge(pipe(duc(o),skip(1),mapTo(!0)),pipe(duc(o),skip(1),mapTo(!1),debounceTime(100))),distinctUntilChanged()),!1),g=statefulStreamFromEmitter(pipe(merge(pipe(s,mapTo(!0)),pipe(s,mapTo(!1),debounceTime(200))),distinctUntilChanged()),!1);connect(pipe(combineLatest(duc(o),duc(p)),map(function(t){return t[0]<=t[1]}),distinctUntilChanged()),c),connect(pipe(c,throttleTime(50)),d);var v=streamFromEmitter(pipe(combineLatest(r,duc(i),duc(a),duc(l),duc(f)),scan(function(t,e){var n,r,o=e[0],i=o.scrollTop,a=o.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",r=t.state.scrollTop-i):(n="SIZE_DECREASED",r=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},st$1),distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=statefulStreamFromEmitter(pipe(r,scan(function(t,e){var n=e.scrollTop,r=e.scrollHeight,o=e.viewportHeight;return w(t.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:t.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),filter(function(t){return t.changed}),map(function(t){return t.jump})),0);connect(pipe(v,map(function(t){return t.atBottom})),u),connect(pipe(u,throttleTime(50)),m);var I=statefulStream("down");connect(pipe(r,map(function(t){return t.scrollTop}),distinctUntilChanged(),scan(function(t,n){return getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?lt$1:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),map(function(t){return t.direction})),I),connect(pipe(r,throttleTime(50),mapTo("none")),I);var C=statefulStream(0);return connect(pipe(h,filter(function(t){return !t}),mapTo(0)),C),connect(pipe(o,throttleTime(100),withLatestFrom(h),filter(function(t){return !!t[1]}),scan(function(t,e){return [t[1],e[0]]},[0,0]),map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},tup(b)),ct$1=system(function(t){var n=t[0].log,r=statefulStream(!1),o=streamFromEmitter(pipe(r,filter(function(t){return t}),distinctUntilChanged()));return subscribe(r,function(t){t&&getValue(n)("props updated",{},p.DEBUG);}),{propsReady:r,didMount:o}},tup(v),{singleton:!0}),mt$1=system(function(t){var n=t[0],r=n.sizes,o=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=statefulStream(!0),c=statefulStream(0);return connect(pipe(s,withLatestFrom(c),filter(function(t){return !!t[1]}),mapTo(!1)),u),subscribe(pipe(combineLatest(o,s),withLatestFrom(u,r,i),filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!H$1(t[2].sizeTree)||void 0!==n)&&!e}),withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){handleNext(a,function(){publish(u,!0);}),publish(l,n);});}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},tup(rt$1,b,at$1,ct$1),{singleton:!0});function dt$1(t){return !!t&&("smooth"===t?"smooth":"auto")}var ft$1=system(function(t){var n=t[0],r=n.totalCount,o=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,h=t[6].scrollingInProgress,g=statefulStream(!1),v=stream(),S=null;function I(t){publish(s,{index:"LAST",align:"end",behavior:t});}function C(t){var n=handleNext(l,function(n){!t||n.atBottom||"SIZE_INCREASED"!==n.notAtBottomBecause||S||(getValue(f)("scrolling to bottom due to increased size",{},p.DEBUG),I("auto"));});setTimeout(n,100);}return subscribe(pipe(combineLatest(pipe(duc(r),skip(1)),d),withLatestFrom(duc(g),a,u,h),map(function(t){var e=t[0],n=e[0],r=e[1]&&t[3],o="auto";return r&&(o=function(t,e){return "function"==typeof t?dt$1(t(e)):e&&dt$1(t)}(t[1],t[2]||t[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,r=t.followOutputBehavior;S&&(S(),S=null),S=handleNext(o,function(){getValue(f)("following output to ",{totalCount:n},p.DEBUG),I(r),S=null;});}),subscribe(pipe(combineLatest(duc(g),r,m),filter(function(t){return t[0]&&t[2]}),scan(function(t,e){var n=e[1];return {refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),filter(function(t){return t.refreshed}),withLatestFrom(g,r)),function(t){C(!1!==t[1]);}),subscribe(v,function(){C(!1!==getValue(g));}),subscribe(combineLatest(duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&I("auto");}),{followOutput:g,autoscrollToBottom:v}},tup(rt$1,ut$1,at$1,mt$1,ct$1,v,b));function pt$1(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var ht$1=system(function(t){var n=t[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=stream(),c=stream(),m=streamFromEmitter(pipe(u,map(pt$1)));return connect(pipe(m,map(function(t){return t.totalCount})),r),connect(pipe(m,map(function(t){return t.groupIndices})),o),connect(pipe(combineLatest(l,i,s),filter(function(t){return et$1(t[1])}),map(function(t){return k$1(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),distinctUntilChanged(),map(function(t){return [t]})),c),{groupCounts:u,topItemsIndexes:c}},tup(rt$1,b));function gt$1(t,e){return !(!t||t[0]!==e[0]||t[1]!==e[1])}function vt$1(t,e){return !(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function St$1(t,e,n){return "number"==typeof t?n===lt$1&&"top"===e||"down"===n&&"bottom"===e?t:0:n===lt$1?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function It$1(t,e){return "number"==typeof t?t:t[e]||0}var Ct$1=system(function(t){var n=t[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=stream(),u=statefulStream(0),c=statefulStream(0),m=statefulStream(0),d=statefulStreamFromEmitter(pipe(combineLatest(duc(r),duc(o),duc(a),duc(s,gt$1),duc(m),duc(u),duc(l),duc(i),duc(c)),map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=o[0],a=o[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(r-m,0),p="none",h=It$1(c,"top"),g=It$1(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>e+d-h&&(p=lt$1),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-St$1(l,"top",p)-h,0),m-f-s+n+St$1(l,"bottom",p)+g]:null}),filter(function(t){return null!=t}),distinctUntilChanged(gt$1)),[0,0]);return {listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},tup(b),{singleton:!0}),Tt$1={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function wt$1(t,e,n){if(0===t.length)return [];if(!et$1(e))return t.map(function(t){return u({},t,{index:t.index+n,originalIndex:t.index})});for(var r,o=[],i=A$1(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=d(t);!(r=s()).done;){var c=r.value;(!a||a.end<c.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),o.push(u({},c.index===a.start?{type:"group",index:l}:{index:c.index-(l+1)+n,groupIndex:l},{size:c.size,offset:c.offset,originalIndex:c.index,data:c.data}));}return o}function xt$1(t,e,n,r,o,i){var a=0,l=0;if(t.length>0){a=t[0].offset;var s=t[t.length-1];l=s.offset+s.size;}var u=n-o.lastIndex,c=a,m=o.lastOffset+u*o.lastSize+(u-1)*r-l;return {items:wt$1(t,o,i),topItems:wt$1(e,o,i),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var bt$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.data,a=n.firstItemIndex,l=n.gap,s=t[1],c=t[2],m=c.visibleRange,f=c.listBoundary,p=c.topListHeight,h=t[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=t[4].topListHeight,I=t[5],C=t[6].didMount,T=t[7].recalcInProgress,w=statefulStream([]),x=stream();connect(s.topItemsIndexes,w);var b=statefulStreamFromEmitter(pipe(combineLatest(C,T,duc(m,gt$1),duc(o),duc(r),duc(v),g,duc(w),duc(a),duc(l),i),filter(function(t){return t[0]&&!t[1]}),map(function(t){var n=t[2],r=n[0],o=n[1],i=t[3],a=t[5],l=t[6],s=t[7],u=t[8],c=t[9],m=t[10],f=t[4],p=f.sizeTree,h=f.offsetTree;if(0===i||0===r&&0===o)return Tt$1;if(H$1(p))return xt$1(function(t,e,n){if(et$1(e)){var r=tt$1(t,e);return [{index:k$1(e.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return [{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return "number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),f,m),[],i,c,f,u);var g=[];if(s.length>0)for(var v,S=s[0],I=s[s.length-1],C=0,T=d(A$1(p,S,I));!(v=T()).done;)for(var w=v.value,x=w.value,b=Math.max(w.start,S),y=Math.min(w.end,I),E=b;E<=y;E++)g.push({index:E,size:x,offset:C,data:m&&m[E]}),C+=x;if(!l)return xt$1([],g,i,c,f,u);var R=s.length>0?s[s.length-1]+1:0,L=function(t,e,n,r){return void 0===r&&(r=0),r>0&&(e=Math.max(e,_$1(t,r,Y$1).offset)),W$1((i=n,l=G$1(o=t,e,a=q$1),s=G$1(o,i,a,l),o.slice(l,s+1)),Z$1);var o,i,a,l,s;}(h,r,o,R);if(0===L.length)return null;var z=i-1;return xt$1(tap([],function(t){for(var e,n=d(L);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<r){var f=(s+=Math.floor((r-a.offset+c)/(u+c)))-i.start;l+=f*u+f*c;}s<R&&(l+=(R-s)*u,s=R);for(var p=Math.min(i.end,z),h=s;h<=p&&!(l>=o);h++)t.push({index:h,size:u,offset:l,data:m&&m[h]}),l+=u+c;}}),g,i,c,f,u)}),filter(function(t){return null!==t}),distinctUntilChanged()),Tt$1);return connect(pipe(i,filter(function(t){return void 0!==t}),map(function(t){return t.length})),o),connect(pipe(b,map(function(t){return t.topListHeight})),S),connect(S,p),connect(pipe(b,map(function(t){return [t.top,t.bottom]})),f),connect(pipe(b,map(function(t){return t.items})),x),u({listState:b,topItemsIndexes:w,endReached:streamFromEmitter(pipe(b,filter(function(t){return t.items.length>0}),withLatestFrom(o,i),filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),map(function(t){return [t[1]-1,t[2]]}),distinctUntilChanged(gt$1),map(function(t){return t[0]}))),startReached:streamFromEmitter(pipe(b,throttleTime(200),filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),map(function(t){return t.items[0].index}),distinctUntilChanged())),rangeChanged:streamFromEmitter(pipe(b,filter(function(t){return t.items.length>0}),map(function(t){for(var e=t.items,n=0,r=e.length-1;"group"===e[n].type&&n<r;)n++;for(;"group"===e[r].type&&r>n;)r--;return {startIndex:e[n].index,endIndex:e[r].index}}),distinctUntilChanged(vt$1))),itemsRendered:x},I)},tup(rt$1,ht$1,Ct$1,mt$1,at$1,ut$1,ct$1,j$1),{singleton:!0}),yt$1=system(function(t){var n=t[0],r=n.sizes,o=n.firstItemIndex,i=n.data,a=n.gap,l=t[1].listState,s=t[2].didMount,u=statefulStream(0);return connect(pipe(s,withLatestFrom(u),filter(function(t){return 0!==t[1]}),withLatestFrom(r,o,a,i),map(function(t){var e=t[0][1],n=t[1],r=t[2],o=t[3],i=t[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=d(n.groupIndices);!((s=u()).done||s.value-l>=e);)l++;var c=e+l;return xt$1(Array.from({length:c}).map(function(t,e){return {index:e,size:0,offset:0,data:a[e]}}),[],c,o,n,r)})),l),{initialItemCount:u}},tup(rt$1,bt$1,ct$1),{singleton:!0}),Et$1=system(function(t){var n=t[0].scrollVelocity,r=statefulStream(!1),o=stream(),i=statefulStream(!1);return connect(pipe(n,withLatestFrom(i,r,o),filter(function(t){return !!t[1]}),map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=n.enter;if(r){if((0, n.exit)(e,o))return !1}else if(i(e,o))return !0;return r}),distinctUntilChanged()),r),subscribe(pipe(combineLatest(r,n,o),withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},tup(ut$1),{singleton:!0}),Ht$1=system(function(t){var n=t[0].topItemsIndexes,r=statefulStream(0);return connect(pipe(r,filter(function(t){return t>0}),map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:r}},tup(bt$1)),Rt$1=system(function(t){var n=t[0],r=n.footerHeight,o=n.headerHeight,i=n.fixedHeaderHeight,a=t[1].listState,l=stream(),s=statefulStreamFromEmitter(pipe(combineLatest(r,o,i,a),map(function(t){var e=t[3];return t[0]+t[1]+t[2]+e.offsetBottom+e.bottom})),0);return connect(duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},tup(b,bt$1),{singleton:!0});function Lt$1(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var kt$1=Lt$1(function(){return /iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),zt$1=system(function(t){var n=t[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,h=m.sizes,g=m.gap,v=t[4].log,S=t[5].recalcInProgress,I=streamFromEmitter(pipe(t[2].listState,withLatestFrom(l.lastJumpDueToItemResize),scan(function(t,e){var n=t[1],r=e[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return t[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,o,i,a]},[0,[],0,0]),filter(function(t){return 0!==t[0]}),withLatestFrom(o,c,a,u,v),filter(function(t){return !t[3]&&0!==t[1]&&t[2]===lt$1}),map(function(t){var e=t[0][0];return (0, t[5])("Upward scrolling compensation",{amount:e},p.DEBUG),e})));function C(t){t>0?(publish(r,{top:-t,behavior:"auto"}),publish(i,0)):(publish(i,0),publish(r,{top:-t,behavior:"auto"}));}return subscribe(pipe(I,withLatestFrom(i,s)),function(t){var n=t[0],r=t[1];t[2]&&kt$1()?publish(i,r-n):C(-n);}),subscribe(pipe(combineLatest(statefulStreamFromEmitter(s,!1),i,S),filter(function(t){return !t[0]&&!t[2]&&0!==t[1]}),map(function(t){return t[1]}),throttleTime(1)),C),connect(pipe(f,map(function(t){return {top:-t}})),r),subscribe(pipe(d,withLatestFrom(h,g),map(function(t){var e=t[0];return e*t[1].lastSize+e*t[2]})),function(t){publish(i,t),requestAnimationFrame(function(){publish(r,{top:t}),requestAnimationFrame(function(){publish(i,0),publish(S,!1);});});}),{deviation:i}},tup(b,ut$1,bt$1,rt$1,v,j$1)),Bt$1=system(function(t){var n=t[0].totalListHeight,r=t[1].didMount,o=t[2].scrollTo,i=statefulStream(0);return subscribe(pipe(r,withLatestFrom(i),filter(function(t){return 0!==t[1]}),map(function(t){return {top:t[1]}})),function(t){handleNext(pipe(n,filter(function(t){return 0!==t})),function(){setTimeout(function(){publish(o,t);});});}),{initialScrollTop:i}},tup(Rt$1,ct$1,b),{singleton:!0}),Ft$1=system(function(t){var n=t[0].viewportHeight,r=t[1].totalListHeight,o=statefulStream(!1);return {alignToBottom:o,paddingTopAddition:statefulStreamFromEmitter(pipe(combineLatest(o,n,r),filter(function(t){return t[0]}),map(function(t){return Math.max(0,t[1]-t[2])}),distinctUntilChanged()),0)}},tup(b,Rt$1),{singleton:!0}),Pt$1=system(function(t){var n=t[0],r=n.scrollTo,o=n.scrollContainerState,i=stream(),a=stream(),l=stream(),s=statefulStream(!1),c=statefulStream(void 0);return connect(pipe(combineLatest(i,a),map(function(t){var e=t[0],n=e.viewportHeight,r=e.scrollHeight;return {scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:r,viewportHeight:n}})),o),connect(pipe(r,withLatestFrom(a),map(function(t){var e=t[0];return u({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},tup(b)),Ot$1=["done","behavior"],Mt$1=system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.gap,a=t[1],l=a.scrollTop,s=a.viewportHeight,m=a.headerHeight,d=a.scrollingInProgress,f=t[2].scrollToIndex,p=stream();return connect(pipe(p,withLatestFrom(r,s,o,m,l,i),map(function(t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],l=t[5],s=t[6],m=n.done,f=n.behavior,p=c(n,Ot$1),h=null,g=X$1(n,r,i-1),v=Q$1(g,r.offsetTree,s)+a;return v<l?h=u({},p,{behavior:f,align:"start"}):v+k$1(r.sizeTree,g)[1]>l+o&&(h=u({},p,{behavior:f,align:"end"})),h?m&&handleNext(pipe(d,skip(1),filter(function(t){return !1===t})),m):m&&m(),h}),filter(function(t){return null!==t})),f),{scrollIntoView:p}},tup(rt$1,b,at$1,bt$1,v),{singleton:!0}),Vt$1=["listState","topItemsIndexes"],Ut$1=system(function(t){return u({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},tup(Ct$1,yt$1,ct$1,Et$1,Rt$1,Bt$1,Ft$1,Pt$1,Mt$1)),At$1=system(function(t){var n=t[0],r=n.totalCount,o=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,m=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=n.gap,g=t[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=t[2],C=t[3],T=t[4],w=T.listState,x=T.topItemsIndexes,b=c(T,Vt$1),y=t[5].scrollToIndex,E=t[7].topItemCount,H=t[8].groupCounts,R=t[9],L=t[10];return connect(b.rangeChanged,R.scrollSeekRangeChanged),connect(pipe(R.windowViewportRect,map(function(t){return t.visibleHeight})),I.viewportHeight),u({totalCount:r,data:m,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:x,topItemCount:E,groupCounts:H,fixedItemHeight:i,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:w,scrollToIndex:y,trackItemSizes:l,itemSize:s,groupIndices:f},b,R,I,L)},tup(rt$1,mt$1,b,ft$1,bt$1,at$1,zt$1,Ht$1,ht$1,Ut$1,v)),Wt$1=Lt$1(function(){if("undefined"==typeof document)return "sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Nt$1(t,e){var n=React.useRef(null),r=React.useCallback(function(r){if(null!==r&&r.offsetParent){var o,i,a=r.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+e.scrollTop;}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:o,visibleWidth:l},t(n.current);}},[t,e]),l=S(r),s=l.callbackRef,u=l.ref,c=React.useCallback(function(){r(u.current);},[r,u]);return React.useEffect(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e);}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c);}},[c,e]),s}var Dt$1=["placeholder"],Gt$1=["style","children"],_t$1=["style","children"];function jt$1(t){return t}var Kt$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),n=statefulStream(null),r=statefulStream(function(t){return "Group "+t}),o=statefulStream({}),i=statefulStream(jt$1),a=statefulStream("div"),l=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(o,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {context:n,itemContent:t,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Yt$1(t,n){var r=stream();return subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),connect(r,t),r}var qt$1=system(function(t){var n=t[0],r=t[1],o={item:Yt$1(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Yt$1(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Yt$1(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Yt$1(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Yt$1(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:stream(),maxHeightCacheSize:stream(),footer:stream(),header:stream(),HeaderContainer:stream(),FooterContainer:stream(),ItemContainer:stream(),ScrollContainer:stream(),GroupContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function i(t,n,o){connect(pipe(t,withLatestFrom(r.components),map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components);}return subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;");}),subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.");}),subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.");}),subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.");}),subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,Dt$1);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(r.components,u({},getValue(r.components),{ScrollSeekPlaceholder:o})),publish(n.scrollSeekConfiguration,i);}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),u({},n,r,o)},tup(At$1,Kt$1)),Zt$1=function(t){return React__namespace.createElement("div",{style:{height:t.height}})},Jt$1={position:Wt$1(),zIndex:1,overflowAnchor:"none"},$t$1={overflowAnchor:"none"},Qt$1=React__namespace.memo(function(t){var r=t.showTopList,o=void 0!==r&&r,i=fe$1("listState"),a=de$1("sizeRanges"),s=fe$1("useWindowScroll"),c=fe$1("customScrollParent"),m=de$1("windowScrollContainerState"),d=de$1("scrollContainerState"),f=c||s?m:d,p=fe$1("itemContent"),h=fe$1("context"),g=fe$1("groupContent"),v=fe$1("trackItemSizes"),S=fe$1("itemSize"),I=fe$1("log"),T=de$1("gap"),w=C(a,S,v,o?noop:f,I,T,c).callbackRef,x=React__namespace.useState(0),b=x[0],y=x[1];pe$1("deviation",function(t){b!==t&&y(t);});var E=fe$1("EmptyPlaceholder"),H=fe$1("ScrollSeekPlaceholder")||Zt$1,R=fe$1("ListComponent"),L=fe$1("ItemComponent"),k=fe$1("GroupComponent"),z=fe$1("computeItemKey"),B=fe$1("isSeeking"),F=fe$1("groupIndices").length>0,P=fe$1("paddingTopAddition"),O=o?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+P,paddingBottom:i.offsetBottom,marginTop:b};return !o&&0===i.totalCount&&E?React.createElement(E,ne$1(E,h)):React.createElement(R,u({},ne$1(R,h),{ref:w,style:O,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=z(e+i.firstItemIndex,t.data,h);return B?React.createElement(H,u({},ne$1(H,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?React.createElement(k,u({},ne$1(k,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Jt$1}),g(t.index)):React.createElement(L,u({},ne$1(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:$t$1}),F?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),Xt$1={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},te$1={width:"100%",height:"100%",position:"absolute",top:0},ee$1={width:"100%",position:Wt$1(),top:0};function ne$1(t,e){if("string"!=typeof t)return {context:e}}var re$1=React__namespace.memo(function(){var t=fe$1("HeaderComponent"),e=de$1("headerHeight"),n=fe$1("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe$1("context");return t?React.createElement(n,{ref:r},React.createElement(t,ne$1(t,o))):null}),oe$1=React__namespace.memo(function(){var t=fe$1("FooterComponent"),e=de$1("footerHeight"),n=fe$1("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe$1("context");return t?React.createElement(n,{ref:r},React.createElement(t,ne$1(t,o))):null});function ie$1(t){var e=t.usePublisher,r=t.useEmitter,o=t.useEmitterValue;return React__namespace.memo(function(t){var n=t.style,i=t.children,a=c(t,Gt$1),s=e("scrollContainerState"),m=o("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(s,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),React.createElement(m,u({ref:g,style:u({},Xt$1,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,ne$1(m,p)),i)})}function ae$1(t){var r=t.usePublisher,o=t.useEmitter,i=t.useEmitterValue;return React__namespace.memo(function(t){var n=t.style,a=t.children,s=c(t,_t$1),m=r("windowScrollContainerState"),d=i("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=i("totalListHeight"),g=i("deviation"),v=i("customScrollParent"),S=i("context"),I=x(m,f,d,noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return h(function(){return C.current=v||window,function(){C.current=null;}},[C,v]),o("windowScrollTo",w),o("scrollBy",T),React.createElement(d,u({style:u({position:"relative"},n,0!==p?{height:p+g}:{}),"data-virtuoso-scroller":!0},s,ne$1(d,S)),a)})}var le$1=function(t){var r=t.children,o=de$1("viewportHeight"),i=I(compose(o,function(t){return T(t,"height")}));return React__namespace.createElement("div",{style:te$1,ref:i,"data-viewport-type":"element"},r)},se$1=function(t){var e=t.children,r=Nt$1(de$1("windowViewportRect"),fe$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1,"data-viewport-type":"window"},e)},ue$1=function(t){var e=t.children,n=fe$1("TopItemListComponent"),r=fe$1("headerHeight"),o=u({},ee$1,{marginTop:r+"px"}),i=fe$1("context");return React.createElement(n||"div",{style:o,context:i},e)},ce$1=systemToComponent(qt$1,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React__namespace.memo(function(t){var e=fe$1("useWindowScroll"),r=fe$1("topItemsIndexes").length>0,o=fe$1("customScrollParent"),i=o||e?se$1:le$1;return React__namespace.createElement(o||e?ge$1:he$1,u({},t),React__namespace.createElement(i,null,React__namespace.createElement(re$1,null),React__namespace.createElement(Qt$1,null),React__namespace.createElement(oe$1,null)),r&&React__namespace.createElement(ue$1,null,React__namespace.createElement(Qt$1,{showTopList:!0})))})),me$1=ce$1.Component,de$1=ce$1.usePublisher,fe$1=ce$1.useEmitterValue,pe$1=ce$1.useEmitter,he$1=ie$1({usePublisher:de$1,useEmitterValue:fe$1,useEmitter:pe$1}),ge$1=ae$1({usePublisher:de$1,useEmitterValue:fe$1,useEmitter:pe$1}),ve$1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Se$1={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ie$1=Math.round,Ce$1=Math.ceil,Te$1=Math.floor,we$1=Math.min,xe$1=Math.max;function be$1(t,e){return Array.from({length:e-t+1}).map(function(e,n){return {index:n+t}})}function ye$1(t,e){return t&&t.column===e.column&&t.row===e.row}var Ee$1=system(function(t){var n=t[0],r=n.overscan,o=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=t[6],E=statefulStream(0),H=statefulStream(0),R=statefulStream(ve$1),L=statefulStream({height:0,width:0}),k=statefulStream({height:0,width:0}),z=stream(),B=stream(),F=statefulStream(0),P=statefulStream({row:0,column:0});connect(pipe(S,withLatestFrom(H),filter(function(t){return 0!==t[1]}),map(function(t){return {items:be$1(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),connect(pipe(combineLatest(duc(E),o,duc(P,ye$1),duc(k,function(t,e){return t&&t.width===e.width&&t.height===e.height})),withLatestFrom(L),map(function(t){var e=t[0],n=e[0],r=e[1],o=r[0],i=r[1],a=e[2],l=e[3],s=t[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return ve$1;if(0===m)return Se$1;var f=Le$1(d,m,a.column),p=f*Te$1((o+u)/(c+u)),h=f*Ce$1((i+u)/(c+u))-1;h=xe$1(0,we$1(n-1,h));var g=be$1(p=we$1(h,xe$1(0,p)),h),v=He$1(s,a,l,g),S=v.top,I=v.bottom,C=Ce$1(n/f);return {items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),R),connect(pipe(L,map(function(t){return t.height})),s),connect(pipe(combineLatest(L,k,R,P),map(function(t){var e=He$1(t[0],t[3],t[1],t[2].items);return [e.top,e.bottom]}),distinctUntilChanged(gt$1)),i);var O=streamFromEmitter(pipe(duc(R),filter(function(t){return t.items.length>0}),withLatestFrom(E),filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),map(function(t){return t[1]-1}),distinctUntilChanged())),M=streamFromEmitter(pipe(duc(R),filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),mapTo(0),distinctUntilChanged())),V=streamFromEmitter(pipe(duc(R),filter(function(t){return t.items.length>0}),map(function(t){var e=t.items;return {startIndex:e[0].index,endIndex:e[e.length-1].index}}),distinctUntilChanged(vt$1)));connect(V,h.scrollSeekRangeChanged),connect(pipe(z,withLatestFrom(L,k,E,P),map(function(t){var e=t[1],n=t[2],r=t[3],o=t[4],i=it$1(t[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=r-1);var c=Re$1(e,o,n,u=xe$1(0,u,we$1(r-1,u)));return "end"===a?c=Ie$1(c-e.height+n.height):"center"===a&&(c=Ie$1(c-e.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=statefulStreamFromEmitter(pipe(R,map(function(t){return t.offsetBottom+t.bottom})),0);return connect(pipe(C,map(function(t){return {width:t.visibleWidth,height:t.visibleHeight}})),L),u({totalCount:E,viewportDimensions:L,itemDimensions:k,scrollTop:l,scrollHeight:B,overscan:r,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:F,scrollContainerState:f,initialItemCount:H,gap:P},h,{gridState:R,totalListHeight:U},p,{startReached:M,endReached:O,rangeChanged:V,propsReady:v},y)},tup(Ct$1,b,ut$1,Et$1,ct$1,Pt$1,v));function He$1(t,e,n,r){var o=n.height;return void 0===o||0===r.length?{top:0,bottom:0}:{top:Re$1(t,e,n,r[0].index),bottom:Re$1(t,e,n,r[r.length-1].index)+o}}function Re$1(t,e,n,r){var o=Le$1(t.width,n.width,e.column),i=Te$1(r/o),a=i*n.height+xe$1(0,i-1)*e.row;return a>0?a+e.row:a}function Le$1(t,e,n){return xe$1(1,Te$1((t+n)/(e+n)))}var ke$1=["placeholder"],ze$1=system(function(){var t=statefulStream(function(t){return "Item "+t}),n=statefulStream({}),r=statefulStream(null),o=statefulStream("virtuoso-grid-item"),i=statefulStream("virtuoso-grid-list"),a=statefulStream(jt$1),l=statefulStream(noop),s=function(t,r){return void 0===r&&(r=null),statefulStreamFromEmitter(pipe(n,map(function(e){return e[t]}),distinctUntilChanged()),r)};return {context:r,itemContent:t,components:n,computeItemKey:a,itemClassName:o,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Be$1=system(function(t){var n=t[0],r=t[1],o={item:Yt$1(r.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:stream(),ScrollContainer:stream(),ListContainer:stream(),emptyComponent:stream(),scrollSeek:stream()};function i(t,n,o){connect(pipe(t,withLatestFrom(r.components),map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components);}return subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,ke$1);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),publish(r.components,u({},getValue(r.components),{ScrollSeekPlaceholder:o})),publish(n.scrollSeekConfiguration,i);}),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),u({},n,r,o)},tup(Ee$1,ze$1)),Fe$1=React__namespace.memo(function(){var t=Ae$1("gridState"),e=Ae$1("listClassName"),n=Ae$1("itemClassName"),r=Ae$1("itemContent"),o=Ae$1("computeItemKey"),i=Ae$1("isSeeking"),a=Ue$1("scrollHeight"),s=Ae$1("ItemComponent"),c=Ae$1("ListComponent"),m=Ae$1("ScrollSeekPlaceholder"),d=Ae$1("context"),f=Ue$1("itemDimensions"),p=Ue$1("gap"),h=Ae$1("log"),g=I(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect()),p({row:Ge$1("row-gap",getComputedStyle(t).rowGap,h),column:Ge$1("column-gap",getComputedStyle(t).columnGap,h)});});return React.createElement(c,u({ref:g,className:e},ne$1(c,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=o(e.index);return i?React.createElement(m,u({key:a},ne$1(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):React.createElement(s,u({},ne$1(s,d),{className:n,"data-index":e.index,key:a}),r(e.index,d))}))}),Pe$1=function(t){var e=t.children,r=Ue$1("viewportDimensions"),o=I(function(t){r(t.getBoundingClientRect());});return React__namespace.createElement("div",{style:te$1,ref:o},e)},Oe$1=function(t){var e=t.children,r=Nt$1(Ue$1("windowViewportRect"),Ae$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1},e)},Me$1=systemToComponent(Be$1,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},React__namespace.memo(function(t){var e=u({},t),r=Ae$1("useWindowScroll"),o=Ae$1("customScrollParent"),i=o||r?Oe$1:Pe$1;return React__namespace.createElement(o||r?De$1:Ne$1,u({},e),React__namespace.createElement(i,null,React__namespace.createElement(Fe$1,null)))})),Ue$1=Me$1.usePublisher,Ae$1=Me$1.useEmitterValue,We$1=Me$1.useEmitter,Ne$1=ie$1({usePublisher:Ue$1,useEmitterValue:Ae$1,useEmitter:We$1}),De$1=ae$1({usePublisher:Ue$1,useEmitterValue:Ae$1,useEmitter:We$1});function Ge$1(t,e,n){return "normal"===e||null!=e&&e.endsWith("px")||n(t+" was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}var _e$1=system(function(){var t=statefulStream(function(t){return React__namespace.createElement("td",null,"Item $",t)}),r=statefulStream(null),o=statefulStream(null),i=statefulStream({}),a=statefulStream(jt$1),l=statefulStream(noop),s=function(t,n){return void 0===n&&(n=null),statefulStreamFromEmitter(pipe(i,map(function(e){return e[t]}),distinctUntilChanged()),n)};return {context:r,itemContent:t,fixedHeaderContent:o,components:i,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),je$1=system(function(t){return u({},t[0],t[1])},tup(At$1,_e$1)),Ke$1=function(t){return React__namespace.createElement("tr",null,React__namespace.createElement("td",{style:{height:t.height}}))},Ye$1=function(t){return React__namespace.createElement("tr",null,React__namespace.createElement("td",{style:{height:t.height,padding:0,border:0}}))},qe$1=React__namespace.memo(function(){var t=tn$1("listState"),e=Xe$1("sizeRanges"),r=tn$1("useWindowScroll"),o=tn$1("customScrollParent"),i=Xe$1("windowScrollContainerState"),a=Xe$1("scrollContainerState"),s=o||r?i:a,c=tn$1("itemContent"),m=tn$1("trackItemSizes"),d=C(e,tn$1("itemSize"),m,s,tn$1("log"),void 0,o),f=d.callbackRef,p=d.ref,h=React__namespace.useState(0),g=h[0],v=h[1];en$1("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t));});var S=tn$1("EmptyPlaceholder"),I=tn$1("ScrollSeekPlaceholder")||Ke$1,T=tn$1("FillerRow")||Ye$1,w=tn$1("TableBodyComponent"),x=tn$1("TableRowComponent"),b=tn$1("computeItemKey"),y=tn$1("isSeeking"),E=tn$1("paddingTopAddition"),H=tn$1("firstItemIndex"),R=tn$1("statefulTotalCount"),L=tn$1("context");if(0===R&&S)return React.createElement(S,ne$1(S,L));var k=t.offsetTop+E+g,z=t.offsetBottom,B=k>0?React__namespace.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?React__namespace.createElement(T,{height:z,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+H,t.data,L);return y?React.createElement(I,u({},ne$1(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):React.createElement(x,u({},ne$1(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),c(t.index,t.data,L))});return React.createElement(w,u({ref:f,"data-test-id":"virtuoso-item-list"},ne$1(w,L)),[B].concat(P,[F]))}),Ze$1=function(t){var r=t.children,o=Xe$1("viewportHeight"),i=I(compose(o,function(t){return T(t,"height")}));return React__namespace.createElement("div",{style:te$1,ref:i,"data-viewport-type":"element"},r)},Je$1=function(t){var e=t.children,r=Nt$1(Xe$1("windowViewportRect"),tn$1("customScrollParent"));return React__namespace.createElement("div",{ref:r,style:te$1,"data-viewport-type":"window"},e)},$e=systemToComponent(je$1,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},React__namespace.memo(function(t){var r=tn$1("useWindowScroll"),o=tn$1("customScrollParent"),i=Xe$1("fixedHeaderHeight"),a=tn$1("fixedHeaderContent"),l=tn$1("context"),s=I(compose(i,function(t){return T(t,"height")})),c=o||r?rn$1:nn$1,m=o||r?Je$1:Ze$1,d=tn$1("TableComponent"),f=tn$1("TableHeadComponent"),p=a?React__namespace.createElement(f,u({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:s},ne$1(f,l)),a()):null;return React__namespace.createElement(c,u({},t),React__namespace.createElement(m,null,React__namespace.createElement(d,u({style:{borderSpacing:0}},ne$1(d,l)),[p,React__namespace.createElement(qe$1,{key:"TableBody"})])))})),Xe$1=$e.usePublisher,tn$1=$e.useEmitterValue,en$1=$e.useEmitter,nn$1=ie$1({usePublisher:Xe$1,useEmitterValue:tn$1,useEmitter:en$1}),rn$1=ae$1({usePublisher:Xe$1,useEmitterValue:tn$1,useEmitter:en$1}),on$1=me$1;
48241
48785
 
48242
48786
  window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useGiphyPreview = function (separateGiphyPreview) {
48243
48787
  var _a = React.useState(), giphyPreviewMessage = _a[0], setGiphyPreviewMessage = _a[1];
@@ -48501,7 +49045,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
48501
49045
  return isAtBottom ? stickToBottomScrollBehavior : false;
48502
49046
  };
48503
49047
  var messageRenderer = React.useCallback(function (messageList, virtuosoIndex) {
48504
- var _a, _b, _c, _d, _e, _f, _g, _h;
49048
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
48505
49049
  var streamMessageIndex = virtuosoIndex + numItemsPrepended - PREPEND_OFFSET;
48506
49050
  // use custom renderer supplied by client if present and skip the rest
48507
49051
  if (customMessageRenderer) {
@@ -48521,7 +49065,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
48521
49065
  ((_a = message.user) === null || _a === void 0 ? void 0 : _a.id) === ((_b = messageList[streamMessageIndex - 1].user) === null || _b === void 0 ? void 0 : _b.id);
48522
49066
  var firstOfGroup = shouldGroupByUser && ((_c = message.user) === null || _c === void 0 ? void 0 : _c.id) !== ((_e = (_d = messageList[streamMessageIndex - 1]) === null || _d === void 0 ? void 0 : _d.user) === null || _e === void 0 ? void 0 : _e.id);
48523
49067
  var endOfGroup = shouldGroupByUser && ((_f = message.user) === null || _f === void 0 ? void 0 : _f.id) !== ((_h = (_g = messageList[streamMessageIndex + 1]) === null || _g === void 0 ? void 0 : _g.user) === null || _h === void 0 ? void 0 : _h.id);
48524
- return (React__default['default'].createElement(Message, { closeReactionSelectorOnClick: closeReactionSelectorOnClick, customMessageActions: props.customMessageActions, endOfGroup: endOfGroup, firstOfGroup: firstOfGroup, groupedByUser: groupedByUser, message: message, Message: MessageUIComponent, messageActions: props.messageActions }));
49068
+ return (React__default['default'].createElement(Message, { autoscrollToBottom: (_j = virtuoso.current) === null || _j === void 0 ? void 0 : _j.autoscrollToBottom, closeReactionSelectorOnClick: closeReactionSelectorOnClick, customMessageActions: props.customMessageActions, endOfGroup: endOfGroup, firstOfGroup: firstOfGroup, groupedByUser: groupedByUser, message: message, Message: MessageUIComponent, messageActions: props.messageActions }));
48525
49069
  }, [customMessageRenderer, shouldGroupByUser, numItemsPrepended]);
48526
49070
  var Item = React.useMemo(function () {
48527
49071
  // using 'display: inline-block'
@@ -48574,7 +49118,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
48574
49118
  return null;
48575
49119
  return (React__default['default'].createElement(React__default['default'].Fragment, null,
48576
49120
  React__default['default'].createElement("div", { className: (customClasses === null || customClasses === void 0 ? void 0 : customClasses.virtualizedMessageList) || 'str-chat__virtual-list' },
48577
- React__default['default'].createElement(nn$1, __assign$2({ atBottomStateChange: atBottomStateChange, components: virtuosoComponents, computeItemKey: function (index) {
49121
+ React__default['default'].createElement(on$1, __assign$2({ atBottomStateChange: atBottomStateChange, components: virtuosoComponents, computeItemKey: function (index) {
48578
49122
  return processedMessages[numItemsPrepended + index - PREPEND_OFFSET].id;
48579
49123
  }, endReached: endReached, firstItemIndex: PREPEND_OFFSET - numItemsPrepended, followOutput: followOutput, increaseViewportBy: { bottom: 200, top: 0 }, initialTopMostItemIndex: calculateInitialTopMostItemIndex(processedMessages, highlightedMessageId), itemContent: function (i) { return messageRenderer(processedMessages, i); }, itemSize: fractionalItemSize, key: messageSetKey, overscan: overscan, ref: virtuoso, startReached: startReached, style: { overflowX: 'hidden' }, totalCount: processedMessages.length }, additionalVirtuosoProps, (scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {}), (defaultItemHeight ? { defaultItemHeight: defaultItemHeight } : {})))),
48580
49124
  React__default['default'].createElement(MessageListNotifications$1, { hasNewMessages: newMessagesNotification, isNotAtLatestMessageSet: hasMoreNewer, MessageNotification: MessageNotification$1, notifications: notifications, scrollToBottom: scrollToBottom }),
@@ -65335,6 +65879,7 @@ var StreamChatReact = (function (exports, React, streamChat, reactDom) {
65335
65879
  exports.jaTranslations = jaTranslations;
65336
65880
  exports.koTranslations = koTranslations;
65337
65881
  exports.makeDateMessageId = makeDateMessageId;
65882
+ exports.mapToUserNameOrId = mapToUserNameOrId;
65338
65883
  exports.markDownRenderers = markDownRenderers$1;
65339
65884
  exports.matchMarkdownLinks = matchMarkdownLinks$1;
65340
65885
  exports.mentionsMarkdownPlugin = mentionsMarkdownPlugin;