@appquality/unguess-design-system 3.1.103-attachments → 3.1.103

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 (41) hide show
  1. package/CHANGELOG.md +360 -0
  2. package/build/index.js +721 -570
  3. package/build/stories/avatar/InternalAvatar.d.ts +2 -0
  4. package/build/stories/buttons/button/index.stories.d.ts +0 -1
  5. package/build/stories/buttons/utils.d.ts +27 -27
  6. package/build/stories/chat/_types.d.ts +6 -6
  7. package/build/stories/chat/context/chatContext.d.ts +5 -4
  8. package/build/stories/chat/hooks/useMedia.d.ts +8 -0
  9. package/build/stories/chat/index.stories.d.ts +3 -5
  10. package/build/stories/chat/parts/MediaLightbox.d.ts +14 -0
  11. package/build/stories/chat/parts/ThumbnailContainer/Thumbnail.d.ts +11 -0
  12. package/build/stories/chat/parts/ThumbnailContainer/index.d.ts +1 -9
  13. package/build/stories/chat/parts/comment.d.ts +2 -7
  14. package/build/stories/dropdowns/select/index.stories.d.ts +0 -1
  15. package/build/stories/editor/index.stories.d.ts +0 -1
  16. package/build/stories/highlight/CreateObservationButton.d.ts +17 -0
  17. package/build/stories/highlight/_types.d.ts +9 -8
  18. package/build/stories/highlight/demo-parts/data.d.ts +55 -0
  19. package/build/stories/highlight/demo-parts/sentiment-tag.d.ts +7 -0
  20. package/build/stories/highlight/demo-parts/transcript-base.d.ts +5 -0
  21. package/build/stories/highlight/demo-parts/transcript-diarization.d.ts +5 -0
  22. package/build/stories/highlight/demo-parts/transcript-paragraph.d.ts +5 -0
  23. package/build/stories/highlight/demo-parts/transcript-sentiment.d.ts +5 -0
  24. package/build/stories/highlight/index.stories.d.ts +8 -9
  25. package/build/stories/highlight/searchable.d.ts +1 -2
  26. package/build/stories/player/_types.d.ts +19 -1
  27. package/build/stories/player/index.d.ts +7 -2
  28. package/build/stories/player/index.stories.d.ts +1 -1
  29. package/build/stories/player/parts/CutStart.d.ts +4 -0
  30. package/build/stories/player/parts/controlButton.d.ts +289 -0
  31. package/build/stories/player/parts/controls.d.ts +2 -1
  32. package/build/stories/player/parts/floatingControls.d.ts +1 -0
  33. package/build/stories/tooltip/_types.d.ts +1 -0
  34. package/build/stories/tooltip/index.d.ts +1 -0
  35. package/build/stories/tooltip/index.stories.d.ts +1 -0
  36. package/package.json +2 -1
  37. package/build/stories/chat/parts/ThumbnailContainer/ImageThumbnail.d.ts +0 -11
  38. package/build/stories/chat/parts/ThumbnailContainer/VideoThumbnail.d.ts +0 -11
  39. package/yarn-error.log +0 -17994
  40. /package/build/stories/player/{parts → context}/progressContext.d.ts +0 -0
  41. /package/build/stories/player/{parts/utils.d.ts → utils.d.ts} +0 -0
package/build/index.js CHANGED
@@ -25,9 +25,9 @@ var sunburst = require('@nivo/sunburst');
25
25
  var waffle = require('@nivo/waffle');
26
26
  var line = require('@nivo/line');
27
27
  var reactForms = require('@zendeskgarden/react-forms');
28
- var uuid = require('uuid');
29
28
  var react = require('@tiptap/react');
30
29
  var reactTooltips = require('@zendeskgarden/react-tooltips');
30
+ var uuid = require('uuid');
31
31
  var Typography = require('@tiptap/extension-typography');
32
32
  var Link = require('@tiptap/extension-link');
33
33
  var StarterKit = require('@tiptap/starter-kit');
@@ -38,10 +38,10 @@ var Mention = require('@tiptap/extension-mention');
38
38
  var tippy = require('tippy.js');
39
39
  var Image$2 = require('@tiptap/extension-image');
40
40
  var Dropcursor = require('@tiptap/extension-dropcursor');
41
- var reactGrid = require('@zendeskgarden/react-grid');
42
41
  var reactModals = require('@zendeskgarden/react-modals');
43
42
  var SlickSlider = require('react-slick');
44
43
  var Video = require('@appquality/stream-player');
44
+ var reactGrid = require('@zendeskgarden/react-grid');
45
45
  var containerUtilities = require('@zendeskgarden/container-utilities');
46
46
  var reactColorpickers = require('@zendeskgarden/react-colorpickers');
47
47
  var reactDropdowns = require('@zendeskgarden/react-dropdowns');
@@ -642,6 +642,15 @@ Alert.Close = reactNotifications.Close;
642
642
 
643
643
  var img$2 = "data:image/svg+xml,%3csvg width='26' height='26' viewBox='0 0 26 26' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M17.2597 12.9199V14.767H17.2367C17.075 17.4452 15.5974 18.969 13.127 18.969C10.4949 18.969 8.92496 17.4452 8.76335 14.767H8.74026V12.9199H5V14.767V14.7901C5.20779 19.4538 8.34777 22.4322 13.1039 22.4322C17.8139 22.4322 20.7922 19.5231 21 14.7901V12.9199H17.2597Z' fill='%23003A57'/%3e%3cpath d='M8.78629 3.5H5.02295V7.26335H8.78629V3.5Z' fill='%2370C38A'/%3e%3cpath d='M20.9768 3.5H17.1672V7.30952H20.9768V3.5Z' fill='%23003A57'/%3e%3c/svg%3e";
644
644
 
645
+ const StyledInternalAvatar = styled__default["default"].div `
646
+ display: flex;
647
+ align-items: center;
648
+ justify-content: center;
649
+ `;
650
+ const InternalAvatar = () => {
651
+ return (jsxRuntime.jsx(StyledInternalAvatar, { children: jsxRuntime.jsx("img", { alt: "avatar", src: img$2 }) }));
652
+ };
653
+
645
654
  const UgAvatar = styled__default["default"](reactAvatars.Avatar) `
646
655
  text-transform: uppercase;
647
656
 
@@ -673,7 +682,7 @@ const Avatar = (_a) => {
673
682
  if (type === "text")
674
683
  return jsxRuntime.jsx(Avatar.Text, { children: props.children });
675
684
  if (type === "system")
676
- return jsxRuntime.jsx("img", { alt: "avatar", src: img$2 });
685
+ return jsxRuntime.jsx(InternalAvatar, {});
677
686
  };
678
687
  return (jsxRuntime.jsx(UgAvatar, Object.assign({}, props, { badge: fixedBadge, isSystem: props.avatarType === "system" || isSystem, children: wrapChildren(props.avatarType || "text"), size: props.size || "small" })));
679
688
  };
@@ -842,48 +851,48 @@ Tag.Avatar = StyledAvatar;
842
851
  Tag.Close = StyledClose;
843
852
  Tag.SecondaryText = StyledSpan;
844
853
 
845
- var _path$F;
846
- function _extends$S() { _extends$S = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$S.apply(this, arguments); }
847
- const SvgUgSquare = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$S({
854
+ var _path$G;
855
+ function _extends$T() { _extends$T = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$T.apply(this, arguments); }
856
+ const SvgUgSquare = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$T({
848
857
  width: 24,
849
858
  height: 24,
850
859
  viewBox: "0 0 24 24",
851
860
  fill: "none",
852
861
  xmlns: "http://www.w3.org/2000/svg"
853
- }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
862
+ }, props), _path$G || (_path$G = /*#__PURE__*/React__namespace.createElement("path", {
854
863
  d: "M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19Z",
855
864
  fill: "#E80C7A"
856
865
  })));
857
866
 
858
- var _path$E;
859
- function _extends$R() { _extends$R = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$R.apply(this, arguments); }
860
- const SvgUgCircle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$R({
867
+ var _path$F;
868
+ function _extends$S() { _extends$S = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$S.apply(this, arguments); }
869
+ const SvgUgCircle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$S({
861
870
  width: 24,
862
871
  height: 24,
863
872
  viewBox: "0 0 24 24",
864
873
  fill: "none",
865
874
  xmlns: "http://www.w3.org/2000/svg"
866
- }, props), _path$E || (_path$E = /*#__PURE__*/React__namespace.createElement("path", {
875
+ }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
867
876
  d: "M12 2C6.47 2 2 6.47 2 12C2 17.53 6.47 22 12 22C17.53 22 22 17.53 22 12C22 6.47 17.53 2 12 2ZM12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4C16.42 4 20 7.58 20 12C20 16.42 16.42 20 12 20Z",
868
877
  fill: "#FFCD1A"
869
878
  })));
870
879
 
871
- var _path$D;
872
- function _extends$Q() { _extends$Q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Q.apply(this, arguments); }
873
- const SvgUgTriangle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$Q({
880
+ var _path$E;
881
+ function _extends$R() { _extends$R = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$R.apply(this, arguments); }
882
+ const SvgUgTriangle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$R({
874
883
  width: 24,
875
884
  height: 24,
876
885
  viewBox: "0 0 24 24",
877
886
  fill: "none",
878
887
  xmlns: "http://www.w3.org/2000/svg"
879
- }, props), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
888
+ }, props), _path$E || (_path$E = /*#__PURE__*/React__namespace.createElement("path", {
880
889
  d: "M11.9993 7.32625L18.3893 17.5563H5.60929L11.9993 7.32625ZM11.1493 4.91625L2.94929 18.0262C2.53929 18.6962 3.01929 19.5563 3.79929 19.5563H20.1993C20.9893 19.5563 21.4593 18.6962 21.0493 18.0262L12.8493 4.91625C12.4593 4.28625 11.5393 4.28625 11.1493 4.91625Z",
881
890
  fill: "#7B0DFF"
882
891
  })));
883
892
 
884
- var _rect$4, _path$C, _path2$c, _path3$4;
885
- function _extends$P() { _extends$P = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$P.apply(this, arguments); }
886
- const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$P({
893
+ var _rect$4, _path$D, _path2$c, _path3$4;
894
+ function _extends$Q() { _extends$Q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Q.apply(this, arguments); }
895
+ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$Q({
887
896
  width: 24,
888
897
  height: 24,
889
898
  viewBox: "0 0 24 24",
@@ -894,7 +903,7 @@ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElemen
894
903
  height: 24,
895
904
  rx: 12,
896
905
  fill: "#F6F6F8"
897
- })), _path$C || (_path$C = /*#__PURE__*/React__namespace.createElement("path", {
906
+ })), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
898
907
  d: "M20.6953 5.73905C21.0148 5.41953 21.0148 4.90149 20.6953 4.58197C20.3758 4.26245 19.8577 4.26245 19.5382 4.58197L11.88 12.2402L10.0849 9.95981C9.80539 9.60476 9.29098 9.54352 8.93593 9.82303C8.58088 10.1025 8.51963 10.6169 8.79914 10.972L11.1642 13.9763C11.3089 14.16 11.5252 14.2731 11.7586 14.2869C11.9921 14.3008 12.2203 14.2141 12.3856 14.0487L20.6953 5.73905Z",
899
908
  fill: "#50BF95"
900
909
  })), _path2$c || (_path2$c = /*#__PURE__*/React__namespace.createElement("path", {
@@ -905,9 +914,9 @@ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElemen
905
914
  fill: "#007345"
906
915
  })));
907
916
 
908
- var _rect$3, _path$B, _path2$b;
909
- function _extends$O() { _extends$O = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$O.apply(this, arguments); }
910
- const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$O({
917
+ var _rect$3, _path$C, _path2$b;
918
+ function _extends$P() { _extends$P = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$P.apply(this, arguments); }
919
+ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$P({
911
920
  width: 24,
912
921
  height: 24,
913
922
  viewBox: "0 0 24 24",
@@ -918,7 +927,7 @@ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("
918
927
  height: 24,
919
928
  rx: 12,
920
929
  fill: "#F6F6F8"
921
- })), _path$B || (_path$B = /*#__PURE__*/React__namespace.createElement("path", {
930
+ })), _path$C || (_path$C = /*#__PURE__*/React__namespace.createElement("path", {
922
931
  fillRule: "evenodd",
923
932
  clipRule: "evenodd",
924
933
  d: "M13.55 19.0875C14.25 19.7875 15.1063 20.1375 16.1188 20.1375C17.1313 20.1375 17.9875 19.7875 18.6875 19.0875C19.3875 18.3875 19.7375 17.5312 19.7375 16.5187C19.7375 15.5062 19.3875 14.65 18.6875 13.95C17.9875 13.25 17.1313 12.9 16.1188 12.9C15.1063 12.9 14.25 13.25 13.55 13.95C12.85 14.65 12.5 15.5062 12.5 16.5187C12.5 17.5312 12.85 18.3875 13.55 19.0875ZM17.5062 18.2812C17.4187 18.2812 17.3375 18.25 17.2625 18.1875L15.7438 16.7812C15.6813 16.6687 15.65 16.6 15.65 16.575V14.55C15.65 14.4375 15.6875 14.3437 15.7625 14.2687C15.8375 14.1937 15.9313 14.1562 16.0438 14.1562C16.1563 14.1562 16.25 14.1937 16.325 14.2687C16.4 14.3437 16.4375 14.4375 16.4375 14.55V16.4813L17.7313 17.6625C17.8063 17.725 17.8469 17.8062 17.8531 17.9062C17.8594 18.0063 17.825 18.0938 17.75 18.1688C17.675 18.2438 17.5937 18.2812 17.5062 18.2812Z",
@@ -930,9 +939,9 @@ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("
930
939
  fill: "#F4AC1A"
931
940
  })));
932
941
 
933
- var _rect$2, _path$A, _path2$a;
934
- function _extends$N() { _extends$N = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$N.apply(this, arguments); }
935
- const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$N({
942
+ var _rect$2, _path$B, _path2$a;
943
+ function _extends$O() { _extends$O = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$O.apply(this, arguments); }
944
+ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$O({
936
945
  width: 24,
937
946
  height: 24,
938
947
  viewBox: "0 0 24 24",
@@ -943,7 +952,7 @@ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement
943
952
  height: 24,
944
953
  rx: 12,
945
954
  fill: "#F6F6F8"
946
- })), _path$A || (_path$A = /*#__PURE__*/React__namespace.createElement("path", {
955
+ })), _path$B || (_path$B = /*#__PURE__*/React__namespace.createElement("path", {
947
956
  d: "M11.2266 13.0313H14.997M11.2266 9.26075V13.0313V9.26075ZM11.2266 13.0313L20.121 5.03906L11.2266 13.0313Z",
948
957
  stroke: "#024780",
949
958
  strokeWidth: 1.5,
@@ -957,9 +966,9 @@ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement
957
966
  strokeLinejoin: "round"
958
967
  })));
959
968
 
960
- var _rect$1, _path$z, _path2$9, _path3$3, _path4$1, _path5$1, _path6$1, _path7$1, _path8$1, _path9$1, _path10$1;
961
- function _extends$M() { _extends$M = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$M.apply(this, arguments); }
962
- const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$M({
969
+ var _rect$1, _path$A, _path2$9, _path3$3, _path4$1, _path5$1, _path6$1, _path7$1, _path8$1, _path9$1, _path10$1;
970
+ function _extends$N() { _extends$N = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$N.apply(this, arguments); }
971
+ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$N({
963
972
  width: 24,
964
973
  height: 24,
965
974
  viewBox: "0 0 24 24",
@@ -970,7 +979,7 @@ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement
970
979
  height: 24,
971
980
  rx: 12,
972
981
  fill: "#F6F6F8"
973
- })), _path$z || (_path$z = /*#__PURE__*/React__namespace.createElement("path", {
982
+ })), _path$A || (_path$A = /*#__PURE__*/React__namespace.createElement("path", {
974
983
  d: "M13.059 16.7647C13.059 16.1799 12.585 15.7059 12.0002 15.7059C11.4154 15.7059 10.9414 16.1799 10.9414 16.7647V19.9412C10.9414 20.5259 11.4154 21 12.0002 21C12.585 21 13.059 20.5259 13.059 19.9412V16.7647Z",
975
984
  fill: "#D1820A"
976
985
  })), _path2$9 || (_path2$9 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -1002,9 +1011,9 @@ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement
1002
1011
  fill: "#FFB65A"
1003
1012
  })));
1004
1013
 
1005
- var _g$c, _path$y, _path2$8, _path3$2, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11;
1006
- function _extends$L() { _extends$L = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$L.apply(this, arguments); }
1007
- const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$L({
1014
+ var _g$c, _path$z, _path2$8, _path3$2, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11;
1015
+ function _extends$M() { _extends$M = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$M.apply(this, arguments); }
1016
+ const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$M({
1008
1017
  width: 24,
1009
1018
  height: 24,
1010
1019
  viewBox: "0 0 24 24",
@@ -1016,7 +1025,7 @@ const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createEle
1016
1025
  opacity: 0.3,
1017
1026
  d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",
1018
1027
  fill: "#50BF95"
1019
- }))), _path$y || (_path$y = /*#__PURE__*/React__namespace.createElement("path", {
1028
+ }))), _path$z || (_path$z = /*#__PURE__*/React__namespace.createElement("path", {
1020
1029
  d: "M12.487 3.19652C8.68003 3.19652 5.59895 6.27761 5.59895 10.0846C5.59895 10.2597 5.59895 10.4348 5.62438 10.5855C5.29857 11.1863 4.82307 12.013 4.24678 12.514C3.82117 12.8897 3.92096 13.2908 3.97085 13.4405C4.09609 13.7663 4.44635 14.0413 5.02265 14.2418C5.22322 14.3172 5.44825 14.3671 5.64883 14.417L5.67427 16.8464C5.67427 17.7984 6.47559 18.6251 7.45304 18.6251L8.93044 18.1496L9.08111 19.0263C9.18091 19.6026 9.68185 20.0282 10.2836 20.0282C10.3589 20.0282 10.4343 20.0282 10.5086 20.0028L15.1424 19.177C15.8185 19.0517 16.2441 18.4256 16.1443 17.7495L15.8185 16.1214C17.9974 14.9189 19.375 12.5892 19.375 10.0845C19.375 6.30279 16.2696 3.19641 12.4869 3.19641L12.487 3.19652Z",
1021
1030
  fill: "#2B8473",
1022
1031
  stroke: "#2B8473"
@@ -1072,9 +1081,9 @@ const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createEle
1072
1081
  fill: "#ECF4F2"
1073
1082
  })));
1074
1083
 
1075
- var _g$b, _path$x;
1076
- function _extends$K() { _extends$K = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$K.apply(this, arguments); }
1077
- const SvgCampaignFunctional = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$K({
1084
+ var _g$b, _path$y;
1085
+ function _extends$L() { _extends$L = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$L.apply(this, arguments); }
1086
+ const SvgCampaignFunctional = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$L({
1078
1087
  width: 24,
1079
1088
  height: 24,
1080
1089
  viewBox: "0 0 24 24",
@@ -1086,7 +1095,7 @@ const SvgCampaignFunctional = props => /*#__PURE__*/React__namespace.createEleme
1086
1095
  opacity: 0.3,
1087
1096
  d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",
1088
1097
  fill: "#003A57"
1089
- }))), _path$x || (_path$x = /*#__PURE__*/React__namespace.createElement("path", {
1098
+ }))), _path$y || (_path$y = /*#__PURE__*/React__namespace.createElement("path", {
1090
1099
  d: "M17.9983 7.16705C17.5188 6.58566 17.1422 6.73039 17.1422 6.73039C17.1422 6.73039 16.406 7.02453 16.0401 7.16303C15.6742 7.30153 15.2408 7.17357 15.2408 7.17357L14.7579 6.8851C14.7579 6.8851 14.4296 6.56554 14.3656 6.18067C14.3123 5.78958 14.1888 5.00269 14.1888 5.00269C14.1888 5.00269 14.1356 4.61159 13.3938 4.47257C12.652 4.33356 12.4678 4.68715 12.4678 4.68715C12.4678 4.68715 12.0932 5.38344 11.9091 5.73703C11.7249 6.09062 11.3114 6.27118 11.3114 6.27118L10.7639 6.36908C10.7639 6.36908 10.3144 6.33771 10.0176 6.07271L9.12712 5.27769C9.12712 5.27769 8.8303 5.01268 8.18313 5.38632C7.53595 5.75997 7.61705 6.14953 7.61705 6.14953L7.86033 7.3182C7.94143 7.70776 7.74381 8.11275 7.74381 8.11275L7.38528 8.53794C7.38528 8.53794 7.02217 8.80577 6.62387 8.78845C6.22557 8.77114 5.43527 8.7474 5.43527 8.7474C5.43527 8.7474 5.03697 8.73009 4.78646 9.44201C4.53595 10.1539 4.84804 10.3956 4.84804 10.3956C4.84804 10.3956 5.46774 10.896 5.77983 11.1376C6.09192 11.3793 6.19373 11.8296 6.19373 11.8296L6.20207 12.3921C6.20207 12.3921 6.09618 12.8314 5.79331 13.079C5.49043 13.3266 4.86759 13.8171 4.86759 13.8171C4.86759 13.8171 4.56471 14.0647 4.81769 14.7769C5.08144 15.4828 5.46713 15.4783 5.46713 15.4783C5.46713 15.4783 6.26012 15.4569 6.64582 15.4524C7.03152 15.4479 7.40116 15.7145 7.40116 15.7145L7.76458 16.1447C7.76458 16.1447 7.96976 16.5499 7.89441 16.9425C7.81907 17.3351 7.66208 18.1094 7.66208 18.1094C7.66208 18.1094 7.58674 18.502 8.23785 18.8824C8.88895 19.2629 9.18553 19.0044 9.18553 19.0044C9.18553 19.0044 9.7724 18.4765 10.069 18.218C10.3655 17.9595 10.8115 17.9347 10.8115 17.9347L11.3609 18.0394C11.3609 18.0394 11.77 18.225 11.9608 18.5803C12.1516 18.9356 12.5268 19.6354 12.5268 19.6354C12.5268 19.6354 12.7176 19.9907 13.4583 19.8539C14.1946 19.7343 14.2529 19.337 14.2529 19.337C14.2529 19.337 14.3586 18.5487 14.4232 18.1623C14.4814 17.765 14.8086 17.4598 14.8086 17.4598L15.2939 17.1796C15.2939 17.1796 15.7281 17.0598 16.095 17.1971C16.4682 17.3453 17.1975 17.637 17.1975 17.637C17.1975 17.637 17.5707 17.7851 18.0424 17.2073C18.5142 16.6295 18.3189 16.2913 18.3189 16.2913C18.3189 16.2913 17.9006 15.6164 17.6882 15.2736C17.4759 14.9307 17.5197 14.4836 17.5197 14.4836L17.7038 13.9555C17.7038 13.9555 17.9482 13.5816 18.3203 13.454C18.6925 13.3264 19.4431 13.0822 19.4431 13.0822C19.4431 13.0822 19.8153 12.9546 19.8113 12.2005C19.8074 11.4464 19.4297 11.3153 19.4297 11.3153C19.4297 11.3153 18.6807 11.0641 18.303 10.9331C17.9253 10.802 17.677 10.4217 17.677 10.4217L17.4861 9.8919C17.4861 9.8919 17.4293 9.4447 17.6368 9.1067C17.8443 8.7687 18.2486 8.09891 18.2486 8.09891C18.2486 8.09891 18.4778 7.74844 17.9983 7.16707L17.9983 7.16705ZM9.33902 8.38466L10.6176 10.5992C10.0433 11.149 9.82793 11.9715 10.0567 12.7413L7.86713 14.0054C6.98868 12.0106 7.60355 9.66286 9.33905 8.38457L9.33902 8.38466ZM13.9748 16.414C11.9998 17.2778 9.65918 16.6363 8.37099 14.8783L10.5605 13.6141C11.1128 14.1971 11.9329 14.4219 12.6961 14.1994L13.9748 16.414ZM12.6552 13.132C12.1159 13.4434 11.4325 13.2561 11.1176 12.7107C10.8027 12.1652 10.9822 11.4797 11.5215 11.1684C12.0608 10.857 12.7441 11.0443 13.0591 11.5897C13.374 12.1352 13.1945 12.8207 12.6552 13.132ZM14.8376 15.9158L13.5591 13.7012C14.1333 13.1515 14.3487 12.3289 14.12 11.5591L16.3095 10.295C17.188 12.2898 16.5731 14.6376 14.8376 15.9159L14.8376 15.9158ZM13.6161 10.6863C13.0638 10.1034 12.2437 9.87862 11.4805 10.1011L10.2019 7.88652C12.1769 7.02266 14.5112 7.65314 15.8057 9.42223L13.6161 10.6863Z",
1091
1100
  fill: "#003A57"
1092
1101
  })));
@@ -1948,8 +1957,8 @@ const WaffleChart = ({ height, width, data, total, tooltip, }) => {
1948
1957
  };
1949
1958
 
1950
1959
  var _g$a, _defs$4;
1951
- function _extends$J() { _extends$J = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$J.apply(this, arguments); }
1952
- const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$J({
1960
+ function _extends$K() { _extends$K = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$K.apply(this, arguments); }
1961
+ const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$K({
1953
1962
  width: 27,
1954
1963
  height: 26,
1955
1964
  viewBox: "0 0 27 26",
@@ -1972,8 +1981,8 @@ const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg"
1972
1981
  })))));
1973
1982
 
1974
1983
  var _g$9, _defs$3;
1975
- function _extends$I() { _extends$I = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$I.apply(this, arguments); }
1976
- const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$I({
1984
+ function _extends$J() { _extends$J = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$J.apply(this, arguments); }
1985
+ const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$J({
1977
1986
  width: 27,
1978
1987
  height: 26,
1979
1988
  viewBox: "0 0 27 26",
@@ -1996,8 +2005,8 @@ const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg"
1996
2005
  })))));
1997
2006
 
1998
2007
  var _g$8, _defs$2;
1999
- function _extends$H() { _extends$H = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$H.apply(this, arguments); }
2000
- const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$H({
2008
+ function _extends$I() { _extends$I = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$I.apply(this, arguments); }
2009
+ const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$I({
2001
2010
  width: 27,
2002
2011
  height: 26,
2003
2012
  viewBox: "0 0 27 26",
@@ -2026,8 +2035,8 @@ const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg"
2026
2035
  })))));
2027
2036
 
2028
2037
  var _g$7, _defs$1;
2029
- function _extends$G() { _extends$G = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$G.apply(this, arguments); }
2030
- const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$G({
2038
+ function _extends$H() { _extends$H = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$H.apply(this, arguments); }
2039
+ const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$H({
2031
2040
  width: 27,
2032
2041
  height: 26,
2033
2042
  viewBox: "0 0 27 26",
@@ -2056,8 +2065,8 @@ const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg"
2056
2065
  })))));
2057
2066
 
2058
2067
  var _g$6, _defs;
2059
- function _extends$F() { _extends$F = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$F.apply(this, arguments); }
2060
- const SvgSentiment5 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$F({
2068
+ function _extends$G() { _extends$G = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$G.apply(this, arguments); }
2069
+ const SvgSentiment5 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$G({
2061
2070
  width: 26,
2062
2071
  height: 26,
2063
2072
  viewBox: "0 0 26 26",
@@ -2337,28 +2346,26 @@ const ChatContextProvider = ({ onSave, onFileUpload, onDeleteThumbnail, setMenti
2337
2346
  setEditor,
2338
2347
  thumbnails,
2339
2348
  setThumbnails,
2340
- addThumbnails: ({ files }) => {
2341
- files.forEach((file) => (file.isLoadingMedia = true));
2349
+ afterUploadCallback: (failed) => { },
2350
+ addThumbnails: ({ files }) => __awaiter(void 0, void 0, void 0, function* () {
2342
2351
  setThumbnails((prev) => [...prev, ...files]);
2343
- if (onFileUpload) {
2344
- onFileUpload(files).then((data) => {
2345
- var _a;
2346
- const failed = (_a = data.failed) === null || _a === void 0 ? void 0 : _a.map((f) => f.name);
2347
- setThumbnails((prev) => {
2348
- return prev.map((file) => {
2349
- file.isLoadingMedia = false;
2350
- if ((failed === null || failed === void 0 ? void 0 : failed.length) && failed.includes(file.name)) {
2351
- file.isError = true;
2352
- }
2353
- else {
2354
- file.isError = false;
2355
- }
2356
- return file;
2357
- });
2352
+ if (!onFileUpload)
2353
+ return;
2354
+ try {
2355
+ const data = yield onFileUpload(files);
2356
+ setThumbnails((prev) => {
2357
+ return prev.map(file => {
2358
+ var _a, _b;
2359
+ file.isLoadingMedia = false;
2360
+ file.error = (_b = (_a = data.failed) === null || _a === void 0 ? void 0 : _a.find(f => f.name === file.name)) === null || _b === void 0 ? void 0 : _b.errorCode;
2361
+ return file;
2358
2362
  });
2359
2363
  });
2360
2364
  }
2361
- },
2365
+ catch (e) {
2366
+ console.log("Error uploading files", e);
2367
+ }
2368
+ }),
2362
2369
  clearInput: () => {
2363
2370
  if (editor && !editor.isEmpty) {
2364
2371
  editor.commands.clearContent();
@@ -2724,96 +2731,28 @@ const ChatTitle = styled__default["default"](Title$1) `
2724
2731
  padding: ${({ theme }) => `${theme.space.sm} ${theme.space.md}`};
2725
2732
  `;
2726
2733
 
2727
- const UgClose$1 = styled__default["default"](reactNotifications.Close) `
2728
- display: flex;
2729
- align-items: center;
2730
- justify-content: center;
2731
- width: ${({ theme }) => theme.space.xl};
2732
- height: ${({ theme }) => theme.space.xl};
2733
- `;
2734
- /**
2735
- * Title is a basic component used to display a title. Often used in card headers.
2736
- */
2737
- const Close = (props) => jsxRuntime.jsx(UgClose$1, Object.assign({}, props));
2738
-
2739
- const NOTIFICATION_COMPONENT_ID = "notifications.notification";
2740
- const CLOSE_COMPONENT_ID = "notifications.notification.close";
2741
- const CLOSE_ICON_COMPONENT_ID = "notifications.notification.close-icon";
2742
- const TITLE_COMPONENT_ID = "notifications.notification.title";
2743
- const UgClose = styled__default["default"](Close).attrs((props) => {
2744
- var _a;
2745
- return ({
2746
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_ICON_COMPONENT_ID,
2747
- });
2748
- }) `
2749
- ${(props) => reactTheming.retrieveComponentStyles(CLOSE_ICON_COMPONENT_ID, props)};
2750
- `;
2751
- const UgAnchor = styled__default["default"](reactButtons.Anchor).attrs((props) => {
2752
- var _a;
2753
- return ({
2754
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_COMPONENT_ID,
2755
- });
2756
- }) `
2757
- ${(props) => reactTheming.retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
2758
- `;
2759
- const UgTitle = styled__default["default"](Title$1).attrs((props) => {
2760
- var _a;
2761
- return ({
2762
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : TITLE_COMPONENT_ID,
2763
- });
2764
- }) `
2765
- ${(props) => reactTheming.retrieveComponentStyles(TITLE_COMPONENT_ID, props)};
2766
- `;
2767
- const UgNotification = styled__default["default"](reactNotifications.Notification) `
2768
- display: flex;
2769
- align-items: center;
2770
- justify-content: space-between;
2771
- padding-right: ${({ theme }) => theme.space.md};
2772
- white-space: pre;
2773
-
2774
- ${UgAnchor} {
2775
- flex-shrink: 0;
2776
- margin-left: ${({ theme }) => theme.space.md};
2777
- }
2778
-
2779
- ${(props) => reactTheming.retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};
2780
- `;
2781
- /**
2782
- * A Notification is a passive status update that keeps users informed of system progress.
2783
- * <hr>
2784
- * Used for this:
2785
- - For a passive status update about user or system activity
2786
- */
2787
- const Notification = (_a) => {
2788
- var { closeText, message, onClose, type, isPrimary, isRegular } = _a, props = __rest(_a, ["closeText", "message", "onClose", "type", "isPrimary", "isRegular"]);
2789
- return (jsxRuntime.jsxs(UgNotification, Object.assign({ type: type, isPrimary: isPrimary }, props, { children: [jsxRuntime.jsx(UgTitle, Object.assign({ isRegular: isRegular, type: type, isPrimary: isPrimary }, { children: message })), jsxRuntime.jsx(UgAnchor, Object.assign({ type: type, isPrimary: isPrimary, onClick: onClose }, { children: closeText !== null && closeText !== void 0 ? closeText : jsxRuntime.jsx(UgClose, {}) }))] })));
2790
- };
2791
- // ToastProvider
2792
- const ToastProvider = (props) => (jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props)));
2793
- const useToast = reactNotifications.useToast;
2794
-
2795
- var _path$w;
2796
- function _extends$E() { _extends$E = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$E.apply(this, arguments); }
2797
- const SvgBoldFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$E({
2734
+ var _path$x;
2735
+ function _extends$F() { _extends$F = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$F.apply(this, arguments); }
2736
+ const SvgBoldFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$F({
2798
2737
  xmlns: "http://www.w3.org/2000/svg",
2799
2738
  width: 16,
2800
2739
  height: 16,
2801
2740
  focusable: "false",
2802
2741
  viewBox: "0 0 16 16"
2803
- }, props), _path$w || (_path$w = /*#__PURE__*/React__namespace.createElement("path", {
2742
+ }, props), _path$x || (_path$x = /*#__PURE__*/React__namespace.createElement("path", {
2804
2743
  fill: "currentColor",
2805
2744
  d: "M7.5 0C9.952 0 12 2.048 12 4.5a4.483 4.483 0 01-1.27 3.108C12.078 8.39 13 9.855 13 11.5c0 2.452-2.048 4.5-4.5 4.5H4a1 1 0 01-1-1V1a1 1 0 011-1h3.5zM5 14h3.5c1.348 0 2.5-1.152 2.5-2.5S9.848 9 8.5 9H5v5zM7.5 2H5v5h2.5C8.848 7 10 5.848 10 4.5S8.848 2 7.5 2z"
2806
2745
  })));
2807
2746
 
2808
- var _path$v;
2809
- function _extends$D() { _extends$D = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$D.apply(this, arguments); }
2810
- const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$D({
2747
+ var _path$w;
2748
+ function _extends$E() { _extends$E = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$E.apply(this, arguments); }
2749
+ const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$E({
2811
2750
  xmlns: "http://www.w3.org/2000/svg",
2812
2751
  width: 16,
2813
2752
  height: 16,
2814
2753
  focusable: "false",
2815
2754
  viewBox: "0 0 16 16"
2816
- }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
2755
+ }, props), _path$w || (_path$w = /*#__PURE__*/React__namespace.createElement("path", {
2817
2756
  fill: "none",
2818
2757
  stroke: "currentColor",
2819
2758
  strokeLinecap: "round",
@@ -2821,15 +2760,15 @@ const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg"
2821
2760
  d: "M8 1h3M9.5 1l-3 14M5 15h3"
2822
2761
  })));
2823
2762
 
2824
- var _path$u, _path2$7;
2825
- function _extends$C() { _extends$C = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$C.apply(this, arguments); }
2826
- const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$C({
2763
+ var _path$v, _path2$7;
2764
+ function _extends$D() { _extends$D = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$D.apply(this, arguments); }
2765
+ const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$D({
2827
2766
  xmlns: "http://www.w3.org/2000/svg",
2828
2767
  width: 16,
2829
2768
  height: 16,
2830
2769
  focusable: "false",
2831
2770
  viewBox: "0 0 16 16"
2832
- }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
2771
+ }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
2833
2772
  fill: "currentColor",
2834
2773
  d: "M7 8H4c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v3c0 .55-.45 1-1 1zm6 0h-3c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v3c0 .55-.45 1-1 1z"
2835
2774
  })), _path2$7 || (_path2$7 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -2841,8 +2780,8 @@ const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg",
2841
2780
  })));
2842
2781
 
2843
2782
  var _g$5;
2844
- function _extends$B() { _extends$B = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$B.apply(this, arguments); }
2845
- const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$B({
2783
+ function _extends$C() { _extends$C = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$C.apply(this, arguments); }
2784
+ const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$C({
2846
2785
  xmlns: "http://www.w3.org/2000/svg",
2847
2786
  width: 16,
2848
2787
  height: 16,
@@ -2869,8 +2808,8 @@ const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _e
2869
2808
  }))));
2870
2809
 
2871
2810
  var _g$4;
2872
- function _extends$A() { _extends$A = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$A.apply(this, arguments); }
2873
- const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$A({
2811
+ function _extends$B() { _extends$B = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$B.apply(this, arguments); }
2812
+ const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$B({
2874
2813
  xmlns: "http://www.w3.org/2000/svg",
2875
2814
  width: 16,
2876
2815
  height: 16,
@@ -2897,8 +2836,8 @@ const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _e
2897
2836
  }))));
2898
2837
 
2899
2838
  var _g$3;
2900
- function _extends$z() { _extends$z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$z.apply(this, arguments); }
2901
- const SvgH3Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$z({
2839
+ function _extends$A() { _extends$A = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$A.apply(this, arguments); }
2840
+ const SvgH3Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$A({
2902
2841
  xmlns: "http://www.w3.org/2000/svg",
2903
2842
  width: 16,
2904
2843
  height: 16,
@@ -2965,70 +2904,169 @@ const FloatingMenu = (props) => {
2965
2904
  const TooltipComponent = (props) => {
2966
2905
  var _a;
2967
2906
  const theme = React.useContext(styled.ThemeContext);
2968
- return jsxRuntime.jsx(reactTooltips.Tooltip, Object.assign({}, props, { zIndex: (_a = props.zIndex) !== null && _a !== void 0 ? _a : theme.levels.front }));
2907
+ return (jsxRuntime.jsx(reactTooltips.Tooltip, Object.assign({}, props, { zIndex: (_a = props.zIndex) !== null && _a !== void 0 ? _a : theme.levels.front })));
2969
2908
  };
2970
2909
  const Tooltip = styled__default["default"](TooltipComponent) `
2971
2910
  box-shadow: ${({ theme }) => theme.shadows.lg(`${theme.space.base * 3}px`, `${theme.space.base * 5}px`, getColor("neutralHue", 600, theme, 0.15))};
2911
+
2912
+ ${({ isTransparent }) => isTransparent &&
2913
+ `
2914
+ box-shadow: none;
2915
+ background-color: transparent;
2916
+ border: none;
2917
+ `};
2972
2918
  `;
2973
2919
 
2974
- var _path$t;
2975
- function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); }
2976
- const SvgBoldStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$y({
2920
+ var _path$u;
2921
+ function _extends$z() { _extends$z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$z.apply(this, arguments); }
2922
+ const SvgBoldStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$z({
2977
2923
  xmlns: "http://www.w3.org/2000/svg",
2978
2924
  width: 16,
2979
2925
  height: 16,
2980
2926
  focusable: "false",
2981
2927
  viewBox: "0 0 16 16"
2982
- }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
2928
+ }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
2983
2929
  fill: "currentColor",
2984
2930
  d: "M7 1c2.176 0 4 1.824 4 4 0 1.315-.666 2.501-1.673 3.234C10.869 8.792 12 10.287 12 12c0 2.176-1.824 4-4 4H3.5a.5.5 0 01-.5-.5v-14a.5.5 0 01.5-.5H7zM4 15h4c1.624 0 3-1.376 3-3S9.624 9 8 9H4v6zM7 2H4v6h3c1.624 0 3-1.376 3-3S8.624 2 7 2z"
2985
2931
  })));
2986
2932
 
2987
- var _path$s;
2988
- function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
2989
- const SvgItalicStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
2933
+ var _path$t;
2934
+ function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); }
2935
+ const SvgItalicStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$y({
2990
2936
  xmlns: "http://www.w3.org/2000/svg",
2991
2937
  width: 16,
2992
2938
  height: 16,
2993
2939
  focusable: "false",
2994
2940
  viewBox: "0 0 16 16"
2995
- }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
2941
+ }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
2996
2942
  fill: "none",
2997
2943
  stroke: "currentColor",
2998
2944
  strokeLinecap: "round",
2999
2945
  d: "M7.5 1.5h3M9 1.5l-3 14m-1.5 0h3"
3000
2946
  })));
3001
2947
 
3002
- var _path$r;
3003
- function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
3004
- const SvgAtStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
2948
+ var _path$s;
2949
+ function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
2950
+ const SvgAtStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
3005
2951
  xmlns: "http://www.w3.org/2000/svg",
3006
2952
  width: 16,
3007
2953
  height: 16,
3008
2954
  focusable: "false",
3009
2955
  role: "presentation"
3010
- }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
2956
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
3011
2957
  fill: "none",
3012
2958
  stroke: "currentColor",
3013
2959
  strokeLinecap: "round",
3014
2960
  d: "M11.5 4.5V8h0A3.5 3.5 0 018 11.5h0A3.5 3.5 0 014.5 8h0A3.5 3.5 0 018 4.5h0A3.5 3.5 0 0111.5 8h0v1.5a2 2 0 002 2h0a2 2 0 002-2V8h0A7.5 7.5 0 008 .5h0A7.5 7.5 0 00.5 8h0A7.5 7.5 0 008 15.5h3.41"
3015
2961
  })));
3016
2962
 
3017
- var _path$q;
3018
- function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
3019
- const SvgClipboard = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
2963
+ var _path$r;
2964
+ function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
2965
+ const SvgClipboard = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
3020
2966
  xmlns: "http://www.w3.org/2000/svg",
3021
2967
  width: 16,
3022
2968
  height: 16,
3023
2969
  focusable: "false",
3024
2970
  role: "presentation"
3025
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
2971
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
3026
2972
  fill: "none",
3027
2973
  stroke: "currentColor",
3028
2974
  strokeLinecap: "round",
3029
2975
  d: "M9.5 4v7.7c0 .8-.7 1.5-1.5 1.5s-1.5-.7-1.5-1.5V3C6.5 1.6 7.6.5 9 .5s2.5 1.1 2.5 2.5v9c0 1.9-1.6 3.5-3.5 3.5S4.5 13.9 4.5 12V4"
3030
2976
  })));
3031
2977
 
2978
+ const UgClose$1 = styled__default["default"](reactNotifications.Close) `
2979
+ display: flex;
2980
+ align-items: center;
2981
+ justify-content: center;
2982
+ width: ${({ theme }) => theme.space.xl};
2983
+ height: ${({ theme }) => theme.space.xl};
2984
+ `;
2985
+ /**
2986
+ * Title is a basic component used to display a title. Often used in card headers.
2987
+ */
2988
+ const Close = (props) => jsxRuntime.jsx(UgClose$1, Object.assign({}, props));
2989
+
2990
+ const NOTIFICATION_COMPONENT_ID = "notifications.notification";
2991
+ const CLOSE_COMPONENT_ID = "notifications.notification.close";
2992
+ const CLOSE_ICON_COMPONENT_ID = "notifications.notification.close-icon";
2993
+ const TITLE_COMPONENT_ID = "notifications.notification.title";
2994
+ const UgClose = styled__default["default"](Close).attrs((props) => {
2995
+ var _a;
2996
+ return ({
2997
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_ICON_COMPONENT_ID,
2998
+ });
2999
+ }) `
3000
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_ICON_COMPONENT_ID, props)};
3001
+ `;
3002
+ const UgAnchor = styled__default["default"](reactButtons.Anchor).attrs((props) => {
3003
+ var _a;
3004
+ return ({
3005
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_COMPONENT_ID,
3006
+ });
3007
+ }) `
3008
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
3009
+ `;
3010
+ const UgTitle = styled__default["default"](Title$1).attrs((props) => {
3011
+ var _a;
3012
+ return ({
3013
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : TITLE_COMPONENT_ID,
3014
+ });
3015
+ }) `
3016
+ ${(props) => reactTheming.retrieveComponentStyles(TITLE_COMPONENT_ID, props)};
3017
+ `;
3018
+ const UgNotification = styled__default["default"](reactNotifications.Notification) `
3019
+ display: flex;
3020
+ align-items: center;
3021
+ justify-content: space-between;
3022
+ padding-right: ${({ theme }) => theme.space.md};
3023
+ white-space: pre;
3024
+
3025
+ ${UgAnchor} {
3026
+ flex-shrink: 0;
3027
+ margin-left: ${({ theme }) => theme.space.md};
3028
+ }
3029
+
3030
+ ${(props) => reactTheming.retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};
3031
+ `;
3032
+ /**
3033
+ * A Notification is a passive status update that keeps users informed of system progress.
3034
+ * <hr>
3035
+ * Used for this:
3036
+ - For a passive status update about user or system activity
3037
+ */
3038
+ const Notification = (_a) => {
3039
+ var { closeText, message, onClose, type, isPrimary, isRegular } = _a, props = __rest(_a, ["closeText", "message", "onClose", "type", "isPrimary", "isRegular"]);
3040
+ return (jsxRuntime.jsxs(UgNotification, Object.assign({ type: type, isPrimary: isPrimary }, props, { children: [jsxRuntime.jsx(UgTitle, Object.assign({ isRegular: isRegular, type: type, isPrimary: isPrimary }, { children: message })), jsxRuntime.jsx(UgAnchor, Object.assign({ type: type, isPrimary: isPrimary, onClick: onClose }, { children: closeText !== null && closeText !== void 0 ? closeText : jsxRuntime.jsx(UgClose, {}) }))] })));
3041
+ };
3042
+ // ToastProvider
3043
+ const ToastProvider = (props) => (jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props)));
3044
+ const useToast = reactNotifications.useToast;
3045
+
3046
+ const acceptedMediaTypes = /^(image|video)\//;
3047
+ function useMedia() {
3048
+ const { addToast } = useToast();
3049
+ function getValidMedia(data) {
3050
+ const wrongFiles = Array.from(data).filter((file) => !acceptedMediaTypes.test(file.type));
3051
+ if (wrongFiles.length) {
3052
+ addToast(({ close }) => (jsxRuntime.jsx(Notification, { onClose: close, type: "error", message: wrongFiles.length === 1
3053
+ ? `${wrongFiles[0].name} not supported, please upload video or image only`
3054
+ : "Some attachments are not supported, please upload video or image only", isPrimary: true })), { placement: "top" });
3055
+ }
3056
+ return Array.from(data).filter((file) => acceptedMediaTypes.test(file.type));
3057
+ }
3058
+ function getMedia(data) {
3059
+ return getValidMedia(data).map((file) => {
3060
+ return Object.assign(file, {
3061
+ url: URL.createObjectURL(file),
3062
+ isLoadingMedia: true,
3063
+ id: uuid.v4(),
3064
+ });
3065
+ });
3066
+ }
3067
+ return { getMedia };
3068
+ }
3069
+
3032
3070
  const MenuContainer = styled__default["default"].div `
3033
3071
  padding: ${({ theme }) => theme.space.xs} 0;
3034
3072
  display: flex;
@@ -3046,59 +3084,33 @@ const VerticalDivider = styled__default["default"].div `
3046
3084
  const CommentBar = ({ editor, i18n, }) => {
3047
3085
  var _a, _b, _c, _d, _e, _f, _g, _h;
3048
3086
  const { addThumbnails } = useChatContext();
3087
+ const { getMedia } = useMedia();
3049
3088
  if (!editor)
3050
3089
  return null;
3051
- const getIcon = (type) => {
3052
- switch (type) {
3053
- case "bold":
3054
- return jsxRuntime.jsx(SvgBoldStroke, {});
3055
- case "italic":
3056
- return jsxRuntime.jsx(SvgItalicStroke, {});
3057
- case "mention":
3058
- return jsxRuntime.jsx(SvgAtStroke, {});
3059
- case "attachment":
3060
- return jsxRuntime.jsx(SvgClipboard, {});
3061
- default:
3062
- return null;
3063
- }
3090
+ const handleBoldClick = () => {
3091
+ editor.chain().focus().toggleBold().run();
3064
3092
  };
3065
- const handleClick = (type) => {
3066
- switch (type) {
3067
- case "bold":
3068
- return editor.chain().focus().toggleBold().run();
3069
- case "italic":
3070
- return editor.chain().focus().toggleItalic().run();
3071
- case "mention":
3072
- const { from } = editor.state.selection;
3073
- const char = from > 1 ? " @" : "@";
3074
- return editor.chain().focus().insertContent(char).run();
3075
- case "attachment":
3076
- //open a file browser to select one or more images
3077
- const fileInput = document.createElement("input");
3078
- fileInput.type = "file";
3079
- fileInput.accept = "image/*,video/*";
3080
- fileInput.multiple = true;
3081
- fileInput.click();
3082
- fileInput.onchange = () => {
3083
- const files = fileInput.files;
3084
- if (files) {
3085
- const mediaFiles = Array.from(files).map((file) => {
3086
- return Object.assign(file, {
3087
- isLoadingMedia: false,
3088
- internalId: uuid.v4(),
3089
- });
3090
- });
3091
- if (mediaFiles.length === 0)
3092
- return;
3093
- addThumbnails({ files: mediaFiles });
3094
- }
3095
- };
3096
- return;
3097
- default:
3098
- return;
3099
- }
3093
+ const handleItalicClick = () => {
3094
+ editor.chain().focus().toggleItalic().run();
3095
+ };
3096
+ const handleMentionClick = () => {
3097
+ const { from } = editor.state.selection;
3098
+ const char = from > 1 ? " @" : "@";
3099
+ editor.chain().focus().insertContent(char).run();
3100
3100
  };
3101
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(MenuContainer, Object.assign({ id: "menu-container" }, { children: [jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _a === void 0 ? void 0 : _a.bold) !== null && _b !== void 0 ? _b : "Bold text"} ${isMac() ? "Cmd" : "Ctrl"} + B`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("bold"), isPrimary: editor.isActive("bold"), isPill: false, onClick: () => handleClick("bold") }, { children: getIcon("bold") })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_d = (_c = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _c === void 0 ? void 0 : _c.italic) !== null && _d !== void 0 ? _d : "Italic text"} ${isMac() ? "Cmd" : "Ctrl"} + I`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("italic"), isPrimary: editor.isActive("italic"), isPill: false, onClick: () => handleClick("italic") }, { children: getIcon("italic") })) })), jsxRuntime.jsx(VerticalDivider, {}), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_f = (_e = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _e === void 0 ? void 0 : _e.mention) !== null && _f !== void 0 ? _f : "Add a mention", placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("mention"), isPrimary: editor.isActive("mention"), isPill: false, onClick: () => handleClick("mention") }, { children: getIcon("mention") })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_h = (_g = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _g === void 0 ? void 0 : _g.attachment) !== null && _h !== void 0 ? _h : "Upload images and video. Max size: 5GB", placement: "top", type: "light", size: "small", hasArrow: true }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("attachment"), isPrimary: editor.isActive("attachment"), isPill: false, onClick: () => handleClick("attachment") }, { children: getIcon("attachment") })) }))] })) }));
3101
+ const handleAttachmentClick = () => {
3102
+ const fileInput = document.createElement("input");
3103
+ fileInput.type = "file";
3104
+ fileInput.accept = "image/*,video/*";
3105
+ fileInput.multiple = true;
3106
+ fileInput.click();
3107
+ fileInput.onchange = () => {
3108
+ if (fileInput.files) {
3109
+ addThumbnails({ files: getMedia(fileInput.files) });
3110
+ }
3111
+ };
3112
+ };
3113
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(MenuContainer, Object.assign({ id: "menu-container" }, { children: [jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _a === void 0 ? void 0 : _a.bold) !== null && _b !== void 0 ? _b : "Bold text"} ${isMac() ? "Cmd" : "Ctrl"} + B`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("bold"), isPrimary: editor.isActive("bold"), isPill: false, onClick: handleBoldClick }, { children: jsxRuntime.jsx(SvgBoldStroke, {}) })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_d = (_c = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _c === void 0 ? void 0 : _c.italic) !== null && _d !== void 0 ? _d : "Italic text"} ${isMac() ? "Cmd" : "Ctrl"} + I`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("italic"), isPrimary: editor.isActive("italic"), isPill: false, onClick: handleItalicClick }, { children: jsxRuntime.jsx(SvgItalicStroke, {}) })) })), jsxRuntime.jsx(VerticalDivider, {}), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_f = (_e = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _e === void 0 ? void 0 : _e.mention) !== null && _f !== void 0 ? _f : "Add a mention", placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("mention"), isPrimary: editor.isActive("mention"), isPill: false, onClick: handleMentionClick }, { children: jsxRuntime.jsx(SvgAtStroke, {}) })) })), jsxRuntime.jsx(Tooltip, Object.assign({ style: { textAlign: "center" }, content: (_h = (_g = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _g === void 0 ? void 0 : _g.attachment) !== null && _h !== void 0 ? _h : (jsxRuntime.jsxs("span", { children: ["Upload images and video.", " ", jsxRuntime.jsxs("span", Object.assign({ style: { color: theme.palette.grey[600] } }, { children: [" ", jsxRuntime.jsx("br", {}), " Max size: 5GB", " "] }))] })), placement: "top", type: "light", size: "small", hasArrow: true }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("attachment"), isPrimary: editor.isActive("attachment"), isPill: false, onClick: handleAttachmentClick }, { children: jsxRuntime.jsx(SvgClipboard, {}) })) }))] })) }));
3102
3114
  };
3103
3115
 
3104
3116
  const CustomMention = Mention__default["default"].extend({
@@ -3347,9 +3359,9 @@ const editorExtensions = ({ placeholderOptions, mentionableUsers, }) => {
3347
3359
  ];
3348
3360
  };
3349
3361
 
3350
- var _circle$3, _path$p, _path2$6;
3351
- function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
3352
- const SvgRemoveMediaIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
3362
+ var _circle$3, _path$q, _path2$6;
3363
+ function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
3364
+ const SvgRemoveMediaIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
3353
3365
  width: 56,
3354
3366
  height: 56,
3355
3367
  viewBox: "0 0 56 56",
@@ -3360,7 +3372,7 @@ const SvgRemoveMediaIcon = props => /*#__PURE__*/React__namespace.createElement(
3360
3372
  cy: 28,
3361
3373
  r: 28,
3362
3374
  fill: "#edf7ff"
3363
- })), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
3375
+ })), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
3364
3376
  d: "M16.929 16.929L39.071 39.071",
3365
3377
  stroke: "currentColor",
3366
3378
  strokeWidth: 4
@@ -3379,48 +3391,17 @@ const StyledDeleteThumbnailX = styled__default["default"].div `
3379
3391
  width: 32px;
3380
3392
  height: 32px;
3381
3393
  opacity: 0;
3394
+ transition: opacity 0.2s;
3382
3395
  z-index: 2;
3396
+ color: ${({ theme }) => theme.palette.grey[800]};
3383
3397
  `;
3384
3398
  const DeleteThumbnailX = ({ deleteThumbnail }) => {
3385
3399
  return (jsxRuntime.jsx(StyledDeleteThumbnailX, Object.assign({ className: "deleteThumbnail" }, { children: jsxRuntime.jsx(SvgRemoveMediaIcon, { onClick: (e) => deleteThumbnail(e) }) })));
3386
3400
  };
3387
3401
 
3388
- const ImageCard = styled__default["default"](SpecialCard) `
3389
- padding: 0;
3390
- :hover .deleteThumbnail {
3391
- opacity: 1;
3392
- }
3393
- `;
3394
- const Preview$1 = styled__default["default"].div `
3395
- display: flex;
3396
- justify-content: center;
3397
- align-items: center;
3398
- height: 150px;
3399
- width: 100%;
3400
- background-image: url(${(props) => props.url});
3401
- background-color: ${({ theme }) => theme.palette.grey[100]};
3402
- background-size: contain;
3403
- background-position: center;
3404
- background-repeat: no-repeat;
3405
- `;
3406
- const ImageThumbnail = ({ src, index = 0, removeThumbnail, clickThumbnail, showX = true, isLoadingMedia = true, isError = false, }) => {
3407
- const handleCancel = (e) => {
3408
- e.stopPropagation();
3409
- if (removeThumbnail)
3410
- removeThumbnail(index);
3411
- };
3412
- return (jsxRuntime.jsxs(ImageCard, Object.assign({ onClick: clickThumbnail }, { children: [isLoadingMedia && (jsxRuntime.jsx(Preview$1, Object.assign({ url: "" }, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3413
- display: "flex",
3414
- alignItems: "center",
3415
- justifyContent: "center",
3416
- }, size: "large" }) }))), isError && (
3417
- // todo: add error icon
3418
- jsxRuntime.jsx("span", { children: "error uploading media" })), !isLoadingMedia && (jsxRuntime.jsx(Preview$1, Object.assign({ url: src }, { children: showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })) })))] })));
3419
- };
3420
-
3421
- var _circle$2, _path$o;
3422
- function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
3423
- const SvgVideoPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
3402
+ var _circle$2, _path$p;
3403
+ function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
3404
+ const SvgVideoPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
3424
3405
  width: 56,
3425
3406
  height: 56,
3426
3407
  viewBox: "0 0 56 56",
@@ -3431,123 +3412,128 @@ const SvgVideoPlayIcon = props => /*#__PURE__*/React__namespace.createElement("s
3431
3412
  cy: 28,
3432
3413
  r: 28,
3433
3414
  fill: "white"
3434
- })), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
3415
+ })), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
3435
3416
  d: "M47 28L18.5 44.4545L18.5 11.5455L47 28Z",
3436
3417
  fill: "currentColor"
3437
3418
  })));
3438
3419
 
3439
- const VideoCard = styled__default["default"](SpecialCard) `
3420
+ const ImageCard = styled__default["default"](SpecialCard) `
3440
3421
  padding: 0;
3441
3422
  position: relative;
3442
3423
  overflow: hidden;
3443
-
3444
- &:hover .deleteThumbnail {
3445
- opacity: 1;
3446
- z-index: 9999;
3447
- }
3424
+ width: 90px;
3448
3425
 
3449
3426
  &:before {
3450
3427
  content: "";
3428
+ font-size: ${({ theme }) => theme.fontSizes.xs};
3451
3429
  position: absolute;
3430
+ padding: ${({ theme }) => theme.space.xs};
3452
3431
  top: 0;
3453
3432
  left: 0;
3454
3433
  width: 100%;
3455
3434
  height: 100%;
3456
- background-color: ${({ theme }) => theme.palette.grey[800]};
3457
- opacity: 0.3;
3458
- z-index: 1;
3435
+ background-color: ${({ theme }) => theme.palette.grey[800]}00; // 0% opacity
3436
+ transition: opacity 0.2s;
3459
3437
  }
3460
3438
 
3461
- > svg {
3462
- position: absolute;
3463
- top: 50%;
3464
- left: 50%;
3465
- transform: translate(-50%, -50%);
3466
- width: 32px;
3467
- height: 32px;
3468
- z-index: 2;
3439
+ &:hover {
3440
+ .deleteThumbnail {
3441
+ opacity: 1;
3442
+ }
3443
+ &:before {
3444
+ background-color: ${({ theme }) => theme.palette.grey[800]}4d; // 30% opacity
3445
+ }
3446
+ }
3447
+ ${(p) => p.error &&
3448
+ `
3449
+ &:before{
3450
+ content: "Error: ${p.error}";
3451
+ color: ${p.theme.palette.white};
3452
+ background-color: ${p.theme.palette.grey[800]}b3; // 0.7 opacity
3453
+ }
3454
+ `}
3455
+ ${(p) => p.isLoading &&
3456
+ `
3457
+ &:before{
3458
+ background-color: ${p.theme.palette.grey[800]}b3; // 0.7 opacity
3459
+ }
3460
+ `}
3461
+ &.video {
3462
+ svg {
3463
+ color: ${({ theme }) => theme.palette.grey[800]};
3464
+ position: absolute;
3465
+ top: 50%;
3466
+ left: 50%;
3467
+ transform: translate(-50%, -50%);
3468
+ width: 32px;
3469
+ height: 32px;
3470
+ z-index: 2;
3471
+ }
3469
3472
  }
3470
3473
  `;
3471
3474
  const Preview = styled__default["default"].div `
3472
- padding: ${({ theme }) => theme.space.md};
3473
3475
  display: flex;
3474
3476
  justify-content: center;
3475
3477
  align-items: center;
3476
- height: 150px;
3478
+ height: 100px;
3477
3479
  width: 100%;
3480
+ color: ${({ theme }) => theme.palette.white};
3481
+
3482
+ ${p => p.url &&
3483
+ `
3484
+ background-image: url(${p.url});
3485
+ background-color: ${p.theme.palette.grey[100]};
3486
+ background-size: cover;
3487
+ background-position: center;
3488
+ background-repeat: no-repeat;
3489
+ `}
3478
3490
 
3479
3491
  > video {
3480
3492
  width: 100%;
3481
3493
  height: 100%;
3482
3494
  }
3483
3495
  `;
3484
- const VideoThumbnail = ({ src, index = 0, removeThumbnail, clickThumbnail, showX = true, isLoadingMedia = true, isError = false, }) => {
3496
+ const Thumbnail = ({ src, type, removeThumbnail, clickThumbnail, showX, isLoadingMedia, error = "", }) => {
3485
3497
  const handleCancel = (e) => {
3486
3498
  e.stopPropagation();
3487
3499
  if (removeThumbnail)
3488
- removeThumbnail(index);
3500
+ removeThumbnail();
3489
3501
  };
3490
- return (jsxRuntime.jsxs(VideoCard, Object.assign({ onClick: clickThumbnail }, { children: [isLoadingMedia && (jsxRuntime.jsx(Preview, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3491
- display: "flex",
3492
- alignItems: "center",
3493
- justifyContent: "center",
3494
- }, size: "large" }) })), isError && (
3495
- // todo: add error icon
3496
- jsxRuntime.jsx("span", { children: "error uploading media" })), !isLoadingMedia && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })), jsxRuntime.jsx(Preview, { children: jsxRuntime.jsx("video", Object.assign({ src: src }, { children: jsxRuntime.jsx("track", { kind: "captions" }) })) }), jsxRuntime.jsx(SvgVideoPlayIcon, {})] }))] })));
3502
+ return (jsxRuntime.jsx(ImageCard, Object.assign({ onClick: clickThumbnail, className: type.includes("video") ? "video" : "image", error: error, isLoading: isLoadingMedia }, { children: isLoadingMedia ? (jsxRuntime.jsx(Preview, Object.assign({ url: src }, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3503
+ display: "flex",
3504
+ position: "absolute",
3505
+ color: "white",
3506
+ alignItems: "center",
3507
+ justifyContent: "center",
3508
+ }, size: "large" }) }))) : (jsxRuntime.jsxs(Preview, Object.assign({ url: src }, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })), type.includes("video") && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("video", Object.assign({ src: src }, { children: jsxRuntime.jsx("track", { kind: "captions" }) })), jsxRuntime.jsx(SvgVideoPlayIcon, { opacity: error ? "0.3" : "1" })] }))] }))) })));
3497
3509
  };
3498
3510
 
3499
- const UgGrid = styled__default["default"](reactGrid.Grid) `
3500
- padding-left: 0;
3501
- padding-right: 0;
3502
- `;
3503
- /**
3504
- * The Grid component is a framework for building modular layouts.
3505
- * <hr>
3506
- * Used for this:
3507
- - To structure the layout of a page
3508
- */
3509
- const Grid = (props) => jsxRuntime.jsx(UgGrid, Object.assign({}, props));
3510
-
3511
- const Row$1 = (props) => jsxRuntime.jsx(reactGrid.Row, Object.assign({}, props));
3512
-
3513
- const StyledCol$1 = styled__default["default"](reactGrid.Col) `
3514
- margin-bottom: ${theme.space.lg};
3515
-
3516
- @media screen and (max-width: ${theme.breakpoints.sm}) {
3517
- margin-bottom: ${theme.space.md};
3518
- }
3511
+ const FlexContainer = styled.styled.div `
3512
+ display: flex;
3513
+ gap: ${({ theme }) => theme.space.xs};
3514
+ flex-wrap: wrap;
3519
3515
  `;
3520
- const Col = (props) => jsxRuntime.jsx(StyledCol$1, Object.assign({}, props));
3521
-
3522
3516
  const ThumbnailContainer = ({ openLightbox }) => {
3523
3517
  const { thumbnails, removeThumbnail, onDeleteThumbnail } = useChatContext();
3524
- const media = React.useMemo(() => (thumbnails.map((file) => ({
3525
- src: URL.createObjectURL(file),
3526
- internalId: file.internalId,
3527
- type: file.type,
3528
- isLoadingMedia: file.isLoadingMedia,
3529
- }))), [thumbnails]);
3530
- if (!media || media.length === 0) {
3518
+ const mediaFiles = React.useMemo(() => {
3519
+ return thumbnails.map((file) => ({
3520
+ fileName: file.name,
3521
+ fileType: file.type,
3522
+ previewUrl: file.url,
3523
+ id: file.id,
3524
+ isLoadingMedia: file.isLoadingMedia,
3525
+ error: file.error,
3526
+ }));
3527
+ }, [thumbnails]);
3528
+ if (!mediaFiles || mediaFiles.length === 0) {
3531
3529
  return null;
3532
3530
  }
3533
- return (jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: media.map((file, index) => {
3534
- // Check if item is an image or a video
3535
- if (file.type.includes("image"))
3536
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 3, xl: 3, lg: 3, className: "flex-3-sm" }, { children: jsxRuntime.jsx(ImageThumbnail, { src: file.src, index: index, showX: true, isLoadingMedia: file.isLoadingMedia, removeThumbnail: () => {
3537
- removeThumbnail(index);
3538
- onDeleteThumbnail(file.internalId);
3539
- }, clickThumbnail: () => {
3540
- openLightbox(thumbnails[index], index);
3541
- } }, file.internalId) })));
3542
- if (file.type.includes("video"))
3543
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 3, className: "flex-3-sm" }, { children: jsxRuntime.jsx(VideoThumbnail, { src: file.src, index: index, showX: true, isLoadingMedia: file.isLoadingMedia, removeThumbnail: () => {
3544
- removeThumbnail(index);
3545
- onDeleteThumbnail(file.internalId);
3546
- }, clickThumbnail: () => {
3547
- openLightbox(thumbnails[index], index);
3548
- } }, file.internalId) })));
3549
- return null;
3550
- }) })) }));
3531
+ return (jsxRuntime.jsx(FlexContainer, { children: mediaFiles.map((file, index) => (jsxRuntime.jsx(Thumbnail, { src: file.previewUrl, showX: true, type: file.fileType, isLoadingMedia: file.isLoadingMedia, error: file.error, removeThumbnail: () => {
3532
+ removeThumbnail(index);
3533
+ onDeleteThumbnail(file.id);
3534
+ }, clickThumbnail: () => {
3535
+ openLightbox(index);
3536
+ } }, file.id))) }));
3551
3537
  };
3552
3538
 
3553
3539
  const UgModalBody = styled__default["default"](reactModals.Body) `
@@ -3616,28 +3602,28 @@ Lightbox.Body = ModalBody; // Includes Main and Details
3616
3602
  Lightbox.Footer = Footer$3;
3617
3603
  Lightbox.Close = reactModals.Close;
3618
3604
 
3619
- var _path$n;
3620
- function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
3621
- const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
3605
+ var _path$o;
3606
+ function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
3607
+ const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
3622
3608
  xmlns: "http://www.w3.org/2000/svg",
3623
3609
  width: 16,
3624
3610
  height: 16,
3625
3611
  focusable: "false",
3626
3612
  viewBox: "0 0 16 16"
3627
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3613
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
3628
3614
  fill: "currentColor",
3629
3615
  d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
3630
3616
  })));
3631
3617
 
3632
- var _path$m;
3633
- function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3634
- const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3618
+ var _path$n;
3619
+ function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
3620
+ const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
3635
3621
  xmlns: "http://www.w3.org/2000/svg",
3636
3622
  width: 16,
3637
3623
  height: 16,
3638
3624
  focusable: "false",
3639
3625
  viewBox: "0 0 16 16"
3640
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3626
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3641
3627
  fill: "currentColor",
3642
3628
  d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
3643
3629
  })));
@@ -3860,15 +3846,15 @@ Slider.Slide = Slide;
3860
3846
  Slider.PrevButton = PrevButton;
3861
3847
  Slider.NextButton = NextButton;
3862
3848
 
3863
- var _path$l, _path2$5;
3864
- function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3865
- const SvgVolumeMutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3849
+ var _path$m, _path2$5;
3850
+ function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3851
+ const SvgVolumeMutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3866
3852
  xmlns: "http://www.w3.org/2000/svg",
3867
3853
  width: 16,
3868
3854
  height: 16,
3869
3855
  focusable: "false",
3870
3856
  viewBox: "0 0 16 16"
3871
- }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3857
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3872
3858
  stroke: "currentColor",
3873
3859
  strokeLinecap: "round",
3874
3860
  d: "M11.5 10l4-4m-4 0l4 4"
@@ -3877,15 +3863,15 @@ const SvgVolumeMutedFill = props => /*#__PURE__*/React__namespace.createElement(
3877
3863
  d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
3878
3864
  })));
3879
3865
 
3880
- var _path$k, _path2$4;
3881
- function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3882
- const SvgVolumeUnmutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3866
+ var _path$l, _path2$4;
3867
+ function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3868
+ const SvgVolumeUnmutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3883
3869
  xmlns: "http://www.w3.org/2000/svg",
3884
3870
  width: 16,
3885
3871
  height: 16,
3886
3872
  focusable: "false",
3887
3873
  viewBox: "0 0 16 16"
3888
- }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
3874
+ }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3889
3875
  fill: "currentColor",
3890
3876
  d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
3891
3877
  })), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -3895,6 +3881,10 @@ const SvgVolumeUnmutedFill = props => /*#__PURE__*/React__namespace.createElemen
3895
3881
  d: "M11.77 9.77c.45-.45.73-1.08.73-1.77s-.28-1.31-.73-1.77m2.17 5.6c.97-.99 1.56-2.34 1.56-3.83 0-1.52-.62-2.89-1.61-3.89"
3896
3882
  })));
3897
3883
 
3884
+ const ControlButton = styled__default["default"](IconButton) `
3885
+ color: ${({ theme }) => theme.palette.grey[700]};
3886
+ `;
3887
+
3898
3888
  const AudioButton = () => {
3899
3889
  const [hasAudio, setHasAudio] = React.useState(false);
3900
3890
  const { isMuted, setMuted, context } = Video.useVideoContext();
@@ -3919,8 +3909,8 @@ const AudioButton = () => {
3919
3909
  setMuted(!hasVolume(player.ref.current));
3920
3910
  checkAudio(player.ref.current);
3921
3911
  }
3922
- }, [context.isPlaying, isMuted]);
3923
- return (jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, disabled: !hasAudio, onClick: () => {
3912
+ }, [context.isPlaying, isMuted, player, setMuted]);
3913
+ return (jsxRuntime.jsx(ControlButton, Object.assign({ disabled: !hasAudio, onClick: () => {
3924
3914
  if (player === null || player === void 0 ? void 0 : player.ref.current) {
3925
3915
  player.ref.current.volume = player.ref.current.volume > 0 ? 0 : 1;
3926
3916
  setMuted(!player.ref.current.volume);
@@ -3956,8 +3946,8 @@ const useProgressContext = () => {
3956
3946
  };
3957
3947
 
3958
3948
  var _g$2;
3959
- function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
3960
- const SvgGrip = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
3949
+ function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3950
+ const SvgGrip = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3961
3951
  xmlns: "http://www.w3.org/2000/svg",
3962
3952
  width: 16,
3963
3953
  height: 16,
@@ -4059,6 +4049,9 @@ const StyledGrabber = styled.styled.div `
4059
4049
  const activeBookMark = styled.css `
4060
4050
  height: 250%;
4061
4051
  transform: translateY(-30%);
4052
+ cursor: pointer;
4053
+ z-index: 2;
4054
+ border-radius: 4px;
4062
4055
 
4063
4056
  ${StyledGrabber} {
4064
4057
  display: block;
@@ -4067,17 +4060,24 @@ const activeBookMark = styled.css `
4067
4060
  const Rect = styled.styled.div `
4068
4061
  position: absolute;
4069
4062
  height: 110%;
4070
- background-color: ${({ hue, theme }) => hue || theme.palette.grey[800]};
4063
+ background-color: ${({ hue, theme }) => getColor(hue || theme.palette.grey[800], undefined, undefined, 0.8)};
4071
4064
  z-index: 1;
4072
4065
  border-radius: 2px;
4066
+ color: white;
4067
+ transition: width 0.1s ease;
4068
+
4073
4069
  &:hover {
4070
+ background-color: ${({ hue, theme }) => hue || theme.palette.grey[800]};
4074
4071
  ${activeBookMark}
4075
- border-radius: 4px;
4076
4072
  }
4077
- color: white;
4073
+
4078
4074
  ${({ isActive }) => isActive && activeBookMark}
4075
+ ${({ isFocused }) => isFocused && activeBookMark}
4076
+ `;
4077
+ const StyledTooltip$1 = styled.styled(Tooltip) `
4078
+ margin-bottom: ${({ theme }) => theme.space.sm};
4079
+ color: ${({ tooltipColor }) => tooltipColor};
4079
4080
 
4080
- transition: width 0.1s ease;
4081
4081
  `;
4082
4082
  const Grabber = (props) => {
4083
4083
  const { observation } = props;
@@ -4093,7 +4093,7 @@ const Grabber = (props) => {
4093
4093
  };
4094
4094
  const Bookmark = (props) => {
4095
4095
  var _a, _b;
4096
- const { start, end, hue, label } = props;
4096
+ const { start, end, hue, tooltipContent } = props;
4097
4097
  const { context } = Video.useVideoContext();
4098
4098
  const videoStart = context.part.start || 0;
4099
4099
  const videoEnd = context.part.end || ((_a = context.player) === null || _a === void 0 ? void 0 : _a.totalTime) || 0;
@@ -4104,21 +4104,21 @@ const Bookmark = (props) => {
4104
4104
  }
4105
4105
  if (start > videoEnd || start < videoStart)
4106
4106
  return null;
4107
- return (jsxRuntime.jsx(Tooltip, Object.assign({ content: label, type: "light", size: "large" }, { children: jsxRuntime.jsxs(Rect, Object.assign({ isActive: activeBookmark && activeBookmark.id === props.id, hue: hue, style: {
4107
+ return (jsxRuntime.jsx(StyledTooltip$1, Object.assign({ content: tooltipContent, type: "light", size: "large", isTransparent: true }, { children: jsxRuntime.jsxs(Rect, Object.assign({ isActive: activeBookmark && activeBookmark.id === props.id, hue: hue, isFocused: props.isFocused, style: {
4108
4108
  left: `${((start - videoStart) / duration) * 100}%`,
4109
4109
  width: `${((end - start) / duration) * 100}%`,
4110
4110
  }, onClick: props.onClick }, { children: [jsxRuntime.jsx(Grabber, { observation: props }), jsxRuntime.jsx(Grabber, { isEnd: true, observation: props })] })) })));
4111
4111
  };
4112
4112
 
4113
- var _path$j, _path2$3, _path3$1;
4114
- function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
4115
- const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
4113
+ var _path$k, _path2$3, _path3$1;
4114
+ function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
4115
+ const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
4116
4116
  width: 16,
4117
4117
  height: 16,
4118
4118
  viewBox: "0 0 16 16",
4119
4119
  fill: "none",
4120
4120
  xmlns: "http://www.w3.org/2000/svg"
4121
- }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
4121
+ }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
4122
4122
  fillRule: "evenodd",
4123
4123
  clipRule: "evenodd",
4124
4124
  d: "M4.34099 3.5C5.25886 2.85974 6.34919 2.5 7.5 2.5C10.5477 2.5 13 4.95228 13 8C13 11.0477 10.5477 13.5 7.5 13.5C5.79771 13.5 4.25432 12.7171 3.18087 11.3753C2.83586 10.944 2.20657 10.8741 1.7753 11.2191C1.34404 11.5641 1.27412 12.1934 1.61913 12.6247C3.06275 14.4292 5.17372 15.5 7.5 15.5C11.6523 15.5 15 12.1523 15 8C15 3.84772 11.6523 0.5 7.5 0.5C5.84359 0.5 4.28318 1.04496 3 2.00147V1C3 0.447715 2.55229 0 2 0C1.44771 0 1 0.447715 1 1V4C1 4.85228 1.64772 5.5 2.5 5.5H5.5C6.05229 5.5 6.5 5.05228 6.5 4.5C6.5 3.94772 6.05229 3.5 5.5 3.5H4.34099Z",
@@ -4131,15 +4131,15 @@ const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement(
4131
4131
  fill: "currentColor"
4132
4132
  })));
4133
4133
 
4134
- var _path$i, _path2$2, _path3;
4135
- function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
4136
- const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
4134
+ var _path$j, _path2$2, _path3;
4135
+ function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
4136
+ const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
4137
4137
  width: 16,
4138
4138
  height: 16,
4139
4139
  viewBox: "0 0 16 16",
4140
4140
  fill: "none",
4141
4141
  xmlns: "http://www.w3.org/2000/svg"
4142
- }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
4142
+ }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
4143
4143
  fillRule: "evenodd",
4144
4144
  clipRule: "evenodd",
4145
4145
  d: "M11.659 3.5C10.7411 2.85974 9.65081 2.5 8.5 2.5C5.45228 2.5 3 4.95228 3 8C3 11.0477 5.45228 13.5 8.5 13.5C10.2023 13.5 11.7457 12.7171 12.8191 11.3753C13.1641 10.944 13.7934 10.8741 14.2247 11.2191C14.656 11.5641 14.7259 12.1934 14.3809 12.6247C12.9372 14.4292 10.8263 15.5 8.5 15.5C4.34772 15.5 1 12.1523 1 8C1 3.84772 4.34772 0.5 8.5 0.5C10.1564 0.5 11.7168 1.04496 13 2.00147V1C13 0.447715 13.4477 0 14 0C14.5523 0 15 0.447715 15 1V4C15 4.85228 14.3523 5.5 13.5 5.5H10.5C9.94771 5.5 9.5 5.05228 9.5 4.5C9.5 3.94772 9.94771 3.5 10.5 3.5H11.659Z",
@@ -4153,8 +4153,8 @@ const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createEleme
4153
4153
  })));
4154
4154
 
4155
4155
  var _g$1;
4156
- function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
4157
- const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
4156
+ function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
4157
+ const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
4158
4158
  xmlns: "http://www.w3.org/2000/svg",
4159
4159
  width: 16,
4160
4160
  height: 16,
@@ -4178,28 +4178,28 @@ const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg",
4178
4178
  ry: 1
4179
4179
  }))));
4180
4180
 
4181
- var _path$h;
4182
- function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
4183
- const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
4181
+ var _path$i;
4182
+ function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
4183
+ const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
4184
4184
  xmlns: "http://www.w3.org/2000/svg",
4185
4185
  width: 16,
4186
4186
  height: 16,
4187
4187
  focusable: "false",
4188
4188
  viewBox: "0 0 16 16"
4189
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
4189
+ }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
4190
4190
  fill: "currentColor",
4191
4191
  d: "M6 15.79c-.13 0-.26-.03-.38-.08a.977.977 0 01-.62-.92V1.21a1 1 0 01.62-.93C6 .12 6.42.21 6.71.5l6.44 6.44c.58.58.58 1.54 0 2.12L6.71 15.5c-.19.19-.45.29-.71.29z"
4192
4192
  })));
4193
4193
 
4194
- var _path$g, _path2$1;
4195
- function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
4196
- const SvgPreviousFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
4194
+ var _path$h, _path2$1;
4195
+ function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
4196
+ const SvgPreviousFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
4197
4197
  xmlns: "http://www.w3.org/2000/svg",
4198
4198
  width: 16,
4199
4199
  height: 16,
4200
4200
  focusable: "false",
4201
4201
  viewBox: "0 0 24 24"
4202
- }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
4202
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
4203
4203
  d: "M2.75 20C2.75 20.5523 3.19772 21 3.75 21C4.30228 21 4.75 20.5523 4.75 20L4.75 4C4.75 3.44772 4.30229 3 3.75 3C3.19772 3 2.75 3.44772 2.75 4V20Z",
4204
4204
  fill: "currentColor"
4205
4205
  })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -4257,18 +4257,18 @@ const ControlsGroupCenter = (props) => {
4257
4257
  const nextTime = videoRef.currentTime + 10;
4258
4258
  videoRef.currentTime = nextTime;
4259
4259
  };
4260
- return (jsxRuntime.jsxs(StyledDiv$3, Object.assign({}, props, { children: [jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4260
+ return (jsxRuntime.jsxs(StyledDiv$3, Object.assign({}, props, { children: [jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4261
4261
  if (videoRef) {
4262
4262
  videoRef.currentTime = 0;
4263
4263
  }
4264
4264
  e.stopPropagation();
4265
- } }, { children: jsxRuntime.jsx(SvgPreviousFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4265
+ } }, { children: jsxRuntime.jsx(SvgPreviousFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4266
4266
  onRewind();
4267
4267
  e.stopPropagation();
4268
- } }, { children: jsxRuntime.jsx(SvgBackSecondsFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, size: "large", onClick: togglePlay }, { children: isPlaying ? (jsxRuntime.jsx(SvgPauseFill, { style: { width: "24px", height: "24px" } })) : (jsxRuntime.jsx(SvgPlayFill, { style: { width: "24px", height: "24px" } })) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4268
+ } }, { children: jsxRuntime.jsx(SvgBackSecondsFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ size: "large", onClick: togglePlay }, { children: isPlaying ? (jsxRuntime.jsx(SvgPauseFill, { style: { width: "24px", height: "24px" } })) : (jsxRuntime.jsx(SvgPlayFill, { style: { width: "24px", height: "24px" } })) })), jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4269
4269
  onForward();
4270
4270
  e.stopPropagation();
4271
- } }, { children: jsxRuntime.jsx(SvgForwardSecondsFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, isPill: true, onClick: (e) => {
4271
+ } }, { children: jsxRuntime.jsx(SvgForwardSecondsFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ isPill: true, onClick: (e) => {
4272
4272
  const newSpeed = getNextPlaybackRate(playBackRate);
4273
4273
  if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.playbackRate) {
4274
4274
  setPlayBackRate(newSpeed);
@@ -4278,30 +4278,82 @@ const ControlsGroupCenter = (props) => {
4278
4278
  } }, { children: jsxRuntime.jsxs(SM, Object.assign({ isBold: true, style: { lineHeight: "16px" } }, { children: [playBackRate, "x"] })) }))] })));
4279
4279
  };
4280
4280
 
4281
+ var _path$g, _circle$1;
4282
+ function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
4283
+ const SvgTagStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
4284
+ xmlns: "http://www.w3.org/2000/svg",
4285
+ width: 16,
4286
+ height: 16,
4287
+ focusable: "false",
4288
+ viewBox: "0 0 16 16"
4289
+ }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
4290
+ fill: "none",
4291
+ stroke: "currentColor",
4292
+ d: "M.5 1v5.3c0 .1.1.3.1.4l8.5 8.5c.2.2.5.2.7 0l5.3-5.3c.2-.2.2-.5 0-.7L6.6.6S6.4.5 6.3.5H1C.7.5.5.7.5 1z"
4293
+ })), _circle$1 || (_circle$1 = /*#__PURE__*/React__namespace.createElement("circle", {
4294
+ cx: 4,
4295
+ cy: 4,
4296
+ r: 1,
4297
+ fill: "currentColor"
4298
+ })));
4299
+
4281
4300
  var _path$f;
4282
4301
  function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
4283
- const SvgMaximizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
4302
+ const SvgPlus$1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
4303
+ width: 12,
4304
+ height: 12,
4305
+ viewBox: "0 0 12 12",
4306
+ fill: "none",
4307
+ xmlns: "http://www.w3.org/2000/svg"
4308
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4309
+ fillRule: "evenodd",
4310
+ clipRule: "evenodd",
4311
+ d: "M6.5 1C6.19318 1 5.94444 1.24873 5.94444 1.55556V5.44444H2.05556C1.74873 5.44444 1.5 5.69318 1.5 6C1.5 6.30683 1.74873 6.55556 2.05556 6.55556H5.94444V10.4444C5.94444 10.7513 6.19318 11 6.5 11C6.80683 11 7.05556 10.7513 7.05556 10.4444V6.55556H10.9444C11.2513 6.55556 11.5 6.30683 11.5 6C11.5 5.69318 11.2513 5.44444 10.9444 5.44444H7.05556V1.55556C7.05556 1.24873 6.80683 1 6.5 1Z",
4312
+ fill: "currentColor"
4313
+ })));
4314
+
4315
+ // Prevent button from breaking on smaller screens
4316
+ const StyledButton$2 = styled.styled(Button) `
4317
+ overflow: visible;
4318
+ `;
4319
+ const Cutter = ({ onCutHandler, isCutting, i18n, }) => {
4320
+ var _a;
4321
+ const { context } = Video.useVideoContext();
4322
+ const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
4323
+ if (!onCutHandler)
4324
+ return null;
4325
+ return (jsxRuntime.jsx(StyledButton$2, Object.assign({ isPrimary: true, isAccent: !isCutting, size: "small", onClick: (e) => {
4326
+ if (videoRef) {
4327
+ onCutHandler(videoRef.currentTime);
4328
+ }
4329
+ e.stopPropagation();
4330
+ } }, { children: isCutting ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgTagStroke, {}) }), jsxRuntime.jsx(Span, { children: (i18n === null || i18n === void 0 ? void 0 : i18n.onHighlight) || "End observation" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgPlus$1, {}) }), jsxRuntime.jsx(Span, { children: (i18n === null || i18n === void 0 ? void 0 : i18n.beforeHighlight) || "Start observation" })] })) })));
4331
+ };
4332
+
4333
+ var _path$e;
4334
+ function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4335
+ const SvgMaximizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4284
4336
  xmlns: "http://www.w3.org/2000/svg",
4285
4337
  width: 16,
4286
4338
  height: 16,
4287
4339
  focusable: "false",
4288
4340
  viewBox: "0 0 16 16"
4289
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4341
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4290
4342
  fill: "none",
4291
4343
  stroke: "currentColor",
4292
4344
  strokeLinecap: "round",
4293
4345
  d: "M4.5.5H1C.72.5.5.72.5 1v3.5m15 0V1c0-.28-.22-.5-.5-.5h-3.5m-11 11V15c0 .28.22.5.5.5h3.5m11-4V15c0 .28-.22.5-.5.5h-3.5m-7-11L1 1m10.5 3.5L15 1M4.5 11.5L1 15m10.5-3.5L15 15"
4294
4346
  })));
4295
4347
 
4296
- var _path$e;
4297
- function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4298
- const SvgMinimizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4348
+ var _path$d;
4349
+ function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4350
+ const SvgMinimizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4299
4351
  xmlns: "http://www.w3.org/2000/svg",
4300
4352
  width: 16,
4301
4353
  height: 16,
4302
4354
  focusable: "false",
4303
4355
  viewBox: "0 0 16 16"
4304
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4356
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4305
4357
  fill: "none",
4306
4358
  stroke: "currentColor",
4307
4359
  strokeLinecap: "round",
@@ -4344,7 +4396,7 @@ const FullScreenButton = ({ container, }) => {
4344
4396
  setFullScreen(false);
4345
4397
  }
4346
4398
  }
4347
- }), [ref, isFullScreen]);
4399
+ }), [ref, isFullScreen, setFullScreen]);
4348
4400
  const canGoFullScreen = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
4349
4401
  if (ref) {
4350
4402
  return (requestFullscreen ||
@@ -4369,7 +4421,7 @@ const FullScreenButton = ({ container, }) => {
4369
4421
  }
4370
4422
  };
4371
4423
  }, [ref]);
4372
- return (jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4424
+ return (jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4373
4425
  handleFullScreen();
4374
4426
  e.stopPropagation();
4375
4427
  }, disabled: !canGoFullScreen() }, { children: document.fullscreenElement || isFullScreen ? (jsxRuntime.jsx(SvgMinimizeStroke, {})) : (jsxRuntime.jsx(SvgMaximizeStroke, {})) })));
@@ -4391,7 +4443,7 @@ const Progress = React.forwardRef((props, ref) => (jsxRuntime.jsx(UgProgress, Ob
4391
4443
  const StyledProgress = styled.styled(Progress) `
4392
4444
  width: 100%;
4393
4445
  border-radius: 0;
4394
- color: ${({ theme }) => theme.palette.grey[700]};
4446
+ color: ${({ theme }) => theme.palette.grey[400]};
4395
4447
  cursor: pointer;
4396
4448
  > div {
4397
4449
  border-radius: 0;
@@ -4404,7 +4456,7 @@ const ProgressBar = React.forwardRef((props, ref) => {
4404
4456
 
4405
4457
  const StyledDiv$2 = styled__default["default"].div `
4406
4458
  display: flex;
4407
- color: ${({ theme }) => theme.palette.grey[300]};
4459
+ color: ${({ theme }) => theme.palette.grey[700]};
4408
4460
  `;
4409
4461
  const TimeLabel = ({ current, duration, }) => (jsxRuntime.jsx(StyledDiv$2, { children: jsxRuntime.jsxs(SM, Object.assign({ tag: "span" }, { children: [formatDuration(current), "/", formatDuration(duration)] })) }));
4410
4462
 
@@ -4421,57 +4473,61 @@ const Content$1 = styled__default["default"].div `
4421
4473
  padding: 2px 4px;
4422
4474
  display: inline-flex;
4423
4475
  color: white;
4476
+ font-size: ${({ theme }) => theme.fontSizes.sm};
4424
4477
  align-items: center;
4425
4478
  justify-content: center;
4426
- min-height: 16px;
4479
+ min-height: 14px;
4427
4480
  `;
4428
4481
  const PlayerTooltip = (_a) => {
4429
4482
  var { children } = _a, props = __rest(_a, ["children"]);
4430
4483
  return (jsxRuntime.jsx(Wrapper$1, Object.assign({}, props, { children: jsxRuntime.jsx(Content$1, { children: children }) })));
4431
4484
  };
4432
4485
 
4433
- var _path$d, _circle$1;
4434
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4435
- const SvgTagStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4436
- xmlns: "http://www.w3.org/2000/svg",
4437
- width: 16,
4438
- height: 16,
4439
- focusable: "false",
4440
- viewBox: "0 0 16 16"
4441
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4442
- fill: "none",
4443
- stroke: "currentColor",
4444
- d: "M.5 1v5.3c0 .1.1.3.1.4l8.5 8.5c.2.2.5.2.7 0l5.3-5.3c.2-.2.2-.5 0-.7L6.6.6S6.4.5 6.3.5H1C.7.5.5.7.5 1z"
4445
- })), _circle$1 || (_circle$1 = /*#__PURE__*/React__namespace.createElement("circle", {
4446
- cx: 4,
4447
- cy: 4,
4448
- r: 1,
4449
- fill: "currentColor"
4450
- })));
4486
+ function useDebounce(value, delay) {
4487
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
4488
+ React.useEffect(() => {
4489
+ const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
4490
+ return () => {
4491
+ clearTimeout(timer);
4492
+ };
4493
+ }, [value, delay]);
4494
+ return debouncedValue;
4495
+ }
4451
4496
 
4452
- const Cutter = ({ onCutHandler, isCutting, i18n, }) => {
4453
- var _a;
4454
- const { context } = Video.useVideoContext();
4455
- const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
4456
- if (!onCutHandler)
4457
- return null;
4458
- return (jsxRuntime.jsxs(Button, Object.assign({ isPrimary: true, isAccent: true, size: "small", onClick: (e) => {
4459
- if (videoRef) {
4460
- onCutHandler(videoRef.currentTime);
4461
- }
4462
- e.stopPropagation();
4463
- } }, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgTagStroke, {}) }), isCutting
4464
- ? (i18n === null || i18n === void 0 ? void 0 : i18n.onHighlight) || "Click again to stop"
4465
- : (i18n === null || i18n === void 0 ? void 0 : i18n.beforeHighlight) || "New highlight"] })));
4497
+ const Pin = styled.styled.div `
4498
+ width: 2px;
4499
+ bottom: 0;
4500
+ left: ${({ left }) => `${left}%`};
4501
+ position: absolute;
4502
+ height: 250%;
4503
+ z-index: 2;
4504
+ background-color: ${({ theme }) => theme.palette.grey[600]};
4505
+ margin-left: -2px; // To not override the current time marker
4506
+
4507
+ &:after {
4508
+ content: "";
4509
+ position: absolute;
4510
+ bottom: 100%;
4511
+ left: 50%;
4512
+ width: 10px;
4513
+ height: 10px;
4514
+ border-radius: 50%;
4515
+ transform: translate(-50%, 0);
4516
+ background-color: ${({ theme }) => theme.palette.grey[600]};
4517
+ }
4518
+ `;
4519
+ const CutStart = ({ left }) => {
4520
+ return jsxRuntime.jsx(Pin, { id: "obs-start-pin", left: left });
4466
4521
  };
4467
4522
 
4468
4523
  const ControlsWrapper = styled__default["default"].div `
4469
- position: absolute;
4524
+ ${({ showControls }) => showControls ? "position: relative;" : "position: absolute;"}
4470
4525
  bottom: 0;
4471
4526
  left: 0;
4472
4527
  right: 0;
4473
4528
  padding: ${({ theme }) => theme.space.xxs} 0;
4474
- background-color: ${({ theme }) => reactTheming.getColor(theme.palette.grey, 700, undefined, 0.8)};
4529
+ background-color: ${({ theme }) => theme.palette.grey[100]};
4530
+ height: 80px;
4475
4531
  ${({ isPlaying }) => isPlaying && "display: none;"}
4476
4532
  z-index: 2;
4477
4533
  `;
@@ -4493,14 +4549,26 @@ const StyledDiv$1 = styled__default["default"].div `
4493
4549
  display: flex;
4494
4550
  align-items: center;
4495
4551
  `;
4496
- const Controls = ({ container, onCutHandler, bookmarks, isCutting, onBookMarkUpdated, i18n, }) => {
4552
+ const CurrentTimeMarker = styled__default["default"].div `
4553
+ width: 2px;
4554
+ top: 0;
4555
+ left: ${({ left }) => `${left}%`};
4556
+ position: absolute;
4557
+ height: 110%;
4558
+ z-index: 1;
4559
+ background-color: white;
4560
+ `;
4561
+ const Controls = ({ container, onCutHandler, bookmarks, isCutting, onBookMarkUpdated, i18n, showControls = false, }) => {
4497
4562
  var _a, _b, _c;
4498
4563
  const [progress, setProgress] = React.useState(0);
4499
4564
  const [tooltipMargin, setTooltipMargin] = React.useState(0);
4500
4565
  const [tooltipLabel, setTooltipLabel] = React.useState("00:00");
4501
4566
  const [marks, setMarks] = React.useState(bookmarks);
4567
+ const [updatedMark, setUpdatedMark] = React.useState();
4502
4568
  const progressRef = React.useRef(null);
4503
4569
  const { context, setCurrentTime } = Video.useVideoContext();
4570
+ const debouncedMark = useDebounce(updatedMark, 500);
4571
+ const [cutStart, setCutStart] = React.useState(0);
4504
4572
  const { reset, isGrabbing, activeBookmark, fromEnd } = useProgressContext();
4505
4573
  React.useEffect(() => {
4506
4574
  setMarks(bookmarks);
@@ -4556,15 +4624,8 @@ const Controls = ({ container, onCutHandler, bookmarks, isCutting, onBookMarkUpd
4556
4624
  ...marks.slice(currentObsIndex + 1),
4557
4625
  ];
4558
4626
  setMarks(newMarks);
4559
- onBookMarkUpdated === null || onBookMarkUpdated === void 0 ? void 0 : onBookMarkUpdated(updatedMark);
4560
- }, [
4561
- activeBookmark,
4562
- context.part.start,
4563
- duration,
4564
- fromEnd,
4565
- onBookMarkUpdated,
4566
- marks,
4567
- ]);
4627
+ setUpdatedMark(updatedMark);
4628
+ }, [activeBookmark, context.part.start, duration, fromEnd, marks]);
4568
4629
  React.useEffect(() => {
4569
4630
  var _a;
4570
4631
  const currentTime = ((_a = context.player) === null || _a === void 0 ? void 0 : _a.currentTime) || 0;
@@ -4578,8 +4639,19 @@ const Controls = ({ container, onCutHandler, bookmarks, isCutting, onBookMarkUpd
4578
4639
  document.removeEventListener("mouseup", reset);
4579
4640
  };
4580
4641
  }, [reset, marks]);
4581
- return (jsxRuntime.jsxs(ControlsWrapper, Object.assign({ isPlaying: context.isPlaying }, { children: [jsxRuntime.jsxs(ProgressContainer, Object.assign({ onMouseEnter: onMouseEvent, onMouseMove: onMouseEvent, onMouseLeave: onMouseEvent }, { children: [jsxRuntime.jsx(StyledTooltip, Object.assign({ style: { marginLeft: `${tooltipMargin}px` } }, { children: tooltipLabel })), !!duration &&
4582
- (marks === null || marks === void 0 ? void 0 : marks.map((bookmark, index) => (jsxRuntime.jsx(Bookmark, Object.assign({}, bookmark), `${index}${bookmark.start}`)))), jsxRuntime.jsx(ProgressBar, { ref: progressRef, progress: progress, handleSkipAhead: handleSkipAhead, duration: duration })] })), jsxRuntime.jsxs(ControlsBar, { children: [jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "start" } }, { children: [jsxRuntime.jsx(AudioButton, {}), jsxRuntime.jsx(TimeLabel, { current: relCurrentTime, duration: duration })] })), jsxRuntime.jsx(ControlsGroupCenter, { style: { width: "60%" } }), jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "end" } }, { children: [jsxRuntime.jsx(Cutter, { onCutHandler: onCutHandler, isCutting: isCutting, i18n: i18n }), jsxRuntime.jsx(FullScreenButton, { container: container })] }))] })] })));
4642
+ React.useEffect(() => {
4643
+ if (debouncedMark) {
4644
+ onBookMarkUpdated === null || onBookMarkUpdated === void 0 ? void 0 : onBookMarkUpdated(debouncedMark);
4645
+ }
4646
+ }, [debouncedMark, onBookMarkUpdated]);
4647
+ React.useEffect(() => {
4648
+ if (isCutting) {
4649
+ setCutStart(progress);
4650
+ }
4651
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4652
+ }, [isCutting]);
4653
+ return (jsxRuntime.jsxs(ControlsWrapper, Object.assign({ showControls: showControls }, (!showControls && { isPlaying: context.isPlaying }), { children: [jsxRuntime.jsxs(ProgressContainer, Object.assign({ onMouseEnter: onMouseEvent, onMouseMove: onMouseEvent, onMouseLeave: onMouseEvent }, { children: [jsxRuntime.jsx(StyledTooltip, Object.assign({ style: { marginLeft: `${tooltipMargin}px` } }, { children: tooltipLabel })), !!duration &&
4654
+ (marks === null || marks === void 0 ? void 0 : marks.map((bookmark, index) => (jsxRuntime.jsx(Bookmark, Object.assign({}, bookmark), `${index}${bookmark.start}`)))), jsxRuntime.jsx(ProgressBar, { ref: progressRef, progress: progress, handleSkipAhead: handleSkipAhead, duration: duration }), isCutting && jsxRuntime.jsx(CutStart, { left: cutStart }), jsxRuntime.jsx(CurrentTimeMarker, { left: progress })] })), jsxRuntime.jsxs(ControlsBar, { children: [jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "start" } }, { children: [jsxRuntime.jsx(AudioButton, {}), jsxRuntime.jsx(TimeLabel, { current: relCurrentTime, duration: duration })] })), jsxRuntime.jsx(ControlsGroupCenter, { style: { width: "60%" } }), jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "end" } }, { children: [jsxRuntime.jsx(Cutter, { onCutHandler: onCutHandler, isCutting: isCutting, i18n: i18n }), jsxRuntime.jsx(FullScreenButton, { container: container })] }))] })] })));
4583
4655
  };
4584
4656
 
4585
4657
  var _path$c;
@@ -4601,8 +4673,9 @@ const FloatingContainer = styled__default["default"].div `
4601
4673
  top: 0;
4602
4674
  left: 0;
4603
4675
  right: 0;
4604
- ${({ isPlaying }) => isPlaying && "display: none;"}
4605
4676
  z-index: 1;
4677
+ ${({ isPlaying }) => isPlaying && "display: none;"}
4678
+ ${({ showControls }) => showControls ? "height: 100%" : "height: calc(100% - 80px)"};
4606
4679
  `;
4607
4680
  const PlayIcon = styled__default["default"](SvgPlayIcon) ``;
4608
4681
  const BigButton = styled__default["default"](IconButton) `
@@ -4611,6 +4684,10 @@ const BigButton = styled__default["default"](IconButton) `
4611
4684
  min-width: ${({ theme }) => theme.space.base * 15}px;
4612
4685
  width: 80px;
4613
4686
  height: 80px;
4687
+
4688
+ box-shadow: ${({ theme }) => theme.shadows.boxShadow(theme)};
4689
+
4690
+
4614
4691
  ${PlayIcon} {
4615
4692
  width: 60%;
4616
4693
  height: 60%;
@@ -4623,8 +4700,8 @@ const ButtonsContainer = styled__default["default"].div `
4623
4700
  height: 100%;
4624
4701
  `;
4625
4702
  const FloatingControls = (props) => {
4626
- const { isPlaying, onClick } = props;
4627
- return (jsxRuntime.jsx(FloatingContainer, Object.assign({ isPlaying: isPlaying, onClick: onClick }, { children: jsxRuntime.jsx(ButtonsContainer, { children: !isPlaying && (jsxRuntime.jsx(BigButton, Object.assign({ isPrimary: true, size: "large" }, { children: jsxRuntime.jsx(PlayIcon, { color: "red" }) }))) }) })));
4703
+ const { isPlaying, showControls, onClick } = props;
4704
+ return (jsxRuntime.jsx(FloatingContainer, Object.assign({ isPlaying: isPlaying, showControls: showControls, onClick: onClick }, { children: jsxRuntime.jsx(ButtonsContainer, { children: !isPlaying && (jsxRuntime.jsx(BigButton, Object.assign({ isPrimary: true, size: "large" }, { children: jsxRuntime.jsx(PlayIcon, { color: "red" }) }))) }) })));
4628
4705
  };
4629
4706
 
4630
4707
  const VideoStyle = styled.css `
@@ -4650,9 +4727,13 @@ const VideoStyle = styled.css `
4650
4727
 
4651
4728
  const Container$1 = styled__default["default"].div `
4652
4729
  position: relative;
4653
- display: flex;
4654
- flex-direction: column;
4655
- justify-content: center;
4730
+ ${({ showControls }) => !showControls ? `
4731
+ display: flex;
4732
+ flex-direction: column;
4733
+ justify-content: center;
4734
+ ` : `
4735
+ margin-bottom: 80px;
4736
+ `}
4656
4737
  height: 100%;
4657
4738
  width: 100%;
4658
4739
  video {
@@ -4677,8 +4758,7 @@ const Container$1 = styled__default["default"].div `
4677
4758
  }
4678
4759
  }
4679
4760
  }
4680
-
4681
- background-color: ${({ theme }) => theme.palette.grey[700]};
4761
+ background: ${({ theme }) => theme.palette.grey[400]};
4682
4762
  `;
4683
4763
 
4684
4764
  const UgSpinner = styled__default["default"](reactLoaders.Spinner) ``;
@@ -4706,11 +4786,7 @@ const VideoSpinner = () => (jsxRuntime.jsx(StyledDiv, { children: jsxRuntime.jsx
4706
4786
  * Used for this:
4707
4787
  - To display a video
4708
4788
  */
4709
- const Player = React.forwardRef((props, forwardRef) => {
4710
- const videoRef = React.useRef(null);
4711
- React.useImperativeHandle(forwardRef, () => videoRef.current);
4712
- return (jsxRuntime.jsx(Video__default["default"], Object.assign({ src: props.url }, props, { children: jsxRuntime.jsx(PlayerCore, Object.assign({ ref: videoRef }, props)) })));
4713
- });
4789
+ const Player = React.forwardRef((props, forwardRef) => (jsxRuntime.jsx(Video__default["default"], Object.assign({ src: props.url }, props, { children: jsxRuntime.jsx(PlayerCore, Object.assign({ ref: forwardRef }, props)) }))));
4714
4790
  const PlayerCore = React.forwardRef((props, forwardRef) => {
4715
4791
  var _a;
4716
4792
  const { context, togglePlay, setIsPlaying } = Video.useVideoContext();
@@ -4718,7 +4794,9 @@ const PlayerCore = React.forwardRef((props, forwardRef) => {
4718
4794
  const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
4719
4795
  const isLoaded = !!videoRef;
4720
4796
  const containerRef = React.useRef(null);
4721
- React.useImperativeHandle(forwardRef, () => videoRef);
4797
+ React.useImperativeHandle(forwardRef, () => videoRef, [
4798
+ videoRef,
4799
+ ]);
4722
4800
  React.useEffect(() => {
4723
4801
  if (videoRef) {
4724
4802
  videoRef.addEventListener("pause", () => {
@@ -4734,7 +4812,18 @@ const PlayerCore = React.forwardRef((props, forwardRef) => {
4734
4812
  };
4735
4813
  }, [setIsPlaying, videoRef]);
4736
4814
  return (jsxRuntime.jsxs(Container$1, Object.assign({ isLoaded: isLoaded, isPlaying: context.isPlaying, ref: containerRef }, { children: [!isLoaded ? (jsxRuntime.jsx(VideoSpinner, {})) : (jsxRuntime.jsx(FloatingControls, { isPlaying: context.isPlaying, onClick: togglePlay })), jsxRuntime.jsx(Video__default["default"].Player, { className: "player-container" }), jsxRuntime.jsx(ProgressContextProvider, { children: jsxRuntime.jsx(Controls, { container: containerRef.current, onCutHandler: onCutHandler, bookmarks: bookmarks, isCutting: isCutting, onBookMarkUpdated: props.handleBookmarkUpdate, i18n: props.i18n }) })] })));
4737
- });
4815
+ });
4816
+ const PlayerProvider = (props) => (jsxRuntime.jsx(Video__default["default"], Object.assign({ src: props.url }, props, { children: props.children })));
4817
+ PlayerProvider.Core = PlayerCore;
4818
+
4819
+ const MediaLightBox = ({ header, onClose, slideChange, selectedImageIndex, thumbnails, videoRefs, isOpen, details }) => {
4820
+ if (!isOpen) {
4821
+ return null;
4822
+ }
4823
+ return (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: onClose }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: header }), jsxRuntime.jsxs(Lightbox.Body, { children: [jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: details ? 2 : 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: thumbnails.map((item) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: item.url, alt: `media ${item.name}`, style: { maxHeight: "100%", height: "auto" } })), item.type.includes("video") && item.url && (jsxRuntime.jsx(Player, { ref: (ref) => {
4824
+ videoRefs.current.push(ref);
4825
+ }, url: item.url }))] }, item.id))) })) })), details && (jsxRuntime.jsx(Lightbox.Body.Details, Object.assign({ style: { flex: 1 } }, { children: details })))] }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] })));
4826
+ };
4738
4827
 
4739
4828
  const ChatBoxContainer = styled__default["default"].div `
4740
4829
  display: flex;
@@ -4755,14 +4844,19 @@ const ChatBoxContainer = styled__default["default"].div `
4755
4844
  - Simple text input, use textarea instead.
4756
4845
  */
4757
4846
  const CommentBox = (_a) => {
4847
+ var _b;
4758
4848
  var { placeholderOptions } = _a, props = __rest(_a, ["placeholderOptions"]);
4759
4849
  const { children, hasFloatingMenu, hasButtonsMenu, bubbleOptions, i18n } = props;
4760
4850
  const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails, } = useChatContext();
4761
- const { addToast } = useToast();
4762
4851
  const [isOpen, setIsOpen] = React.useState(false);
4763
- const [selectedImage, setSelectedImage] = React.useState({});
4764
4852
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
4853
+ const { getMedia } = useMedia();
4765
4854
  const ext = editorExtensions({ placeholderOptions, mentionableUsers });
4855
+ function handleEvent(data) {
4856
+ if (!data || !data.files)
4857
+ return;
4858
+ addThumbnails({ files: getMedia(data.files) });
4859
+ }
4766
4860
  const closeLightbox = () => {
4767
4861
  setIsOpen(false);
4768
4862
  };
@@ -4775,10 +4869,7 @@ const CommentBox = (_a) => {
4775
4869
  }
4776
4870
  });
4777
4871
  }, [videoRefs]);
4778
- const handleOpenLightbox = (file, index) => {
4779
- if (!file)
4780
- throw Error("Error with the image");
4781
- setSelectedImage(file);
4872
+ const handleOpenLightbox = (index) => {
4782
4873
  setSelectedImageIndex(index);
4783
4874
  setIsOpen(true);
4784
4875
  };
@@ -4790,48 +4881,12 @@ const CommentBox = (_a) => {
4790
4881
  return false;
4791
4882
  },
4792
4883
  handleDrop: function (view, event, slice, moved) {
4793
- if (!event.dataTransfer || !event.dataTransfer.files)
4794
- return false;
4795
4884
  event.preventDefault();
4796
- const files = Array.from(event.dataTransfer.files).map((file) => {
4797
- return Object.assign(file, {
4798
- isLoadingMedia: false,
4799
- internalId: uuid.v4(),
4800
- });
4801
- });
4802
- const wrongFiles = files.filter((file) => !/^(image|video)\//.test(file.type));
4803
- if (wrongFiles.length > 0) {
4804
- for (const file of wrongFiles) {
4805
- addToast(({ close }) => (jsxRuntime.jsx(Notification, { onClose: close, type: "error", message: `${props.messageBadFileFormat} - ${file.name}`, isPrimary: true })), { placement: "top" });
4806
- }
4807
- }
4808
- const mediaFiles = files.filter((file) => /^(image|video)\//.test(file.type));
4809
- if (mediaFiles.length === 0)
4810
- return false;
4811
- addThumbnails({ files: mediaFiles });
4812
- return false;
4885
+ handleEvent(event.dataTransfer);
4813
4886
  },
4814
4887
  handlePaste: (view, event, slice) => {
4815
- if (!event.clipboardData || !event.clipboardData.items)
4816
- return false;
4817
4888
  event.preventDefault();
4818
- const files = Array.from(event.clipboardData.files).map((file) => {
4819
- return Object.assign(file, {
4820
- isLoadingMedia: false,
4821
- internalId: uuid.v4(),
4822
- });
4823
- });
4824
- const wrongFiles = files.filter((file) => !/^(image|video)\//.test(file.type));
4825
- if (wrongFiles.length > 0) {
4826
- for (const file of wrongFiles) {
4827
- addToast(({ close }) => (jsxRuntime.jsx(Notification, { onClose: close, type: "error", message: `${props.messageBadFileFormat} - ${file.name}`, isPrimary: true })), { placement: "top" });
4828
- }
4829
- }
4830
- const mediaFiles = files.filter((file) => /^(image|video)\//.test(file.type));
4831
- if (mediaFiles.length === 0)
4832
- return false;
4833
- addThumbnails({ files: mediaFiles });
4834
- return false;
4889
+ handleEvent(event.clipboardData);
4835
4890
  },
4836
4891
  } }, props));
4837
4892
  const onKeyDown = (event) => {
@@ -4844,14 +4899,32 @@ const CommentBox = (_a) => {
4844
4899
  return null;
4845
4900
  ed.on("create", ({ editor }) => setEditor(editor));
4846
4901
  ed.on("update", ({ editor }) => setEditor(editor));
4847
- const mediaFiles = thumbnails.map((file) => {
4848
- return Object.assign(file, { isLoadingMedia: file.isLoadingMedia });
4849
- });
4850
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: selectedImage.name }), jsxRuntime.jsx(Lightbox.Body, { children: jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: mediaFiles.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: URL.createObjectURL(item), alt: `media ${item.name}` })), item.type.includes("video") && (jsxRuntime.jsx(Player, { ref: (ref) => {
4851
- videoRefs.current.push(ref);
4852
- }, url: URL.createObjectURL(item) }))] }))) })) })) }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4902
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MediaLightBox, { isOpen: isOpen, header: (_b = thumbnails[selectedImageIndex]) === null || _b === void 0 ? void 0 : _b.name, onClose: closeLightbox, slideChange: slideChange, selectedImageIndex: selectedImageIndex, thumbnails: thumbnails, videoRefs: videoRefs }), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4853
4903
  };
4854
4904
 
4905
+ const UgGrid = styled__default["default"](reactGrid.Grid) `
4906
+ padding-left: 0;
4907
+ padding-right: 0;
4908
+ `;
4909
+ /**
4910
+ * The Grid component is a framework for building modular layouts.
4911
+ * <hr>
4912
+ * Used for this:
4913
+ - To structure the layout of a page
4914
+ */
4915
+ const Grid = (props) => jsxRuntime.jsx(UgGrid, Object.assign({}, props));
4916
+
4917
+ const Row$1 = (props) => jsxRuntime.jsx(reactGrid.Row, Object.assign({}, props));
4918
+
4919
+ const StyledCol$1 = styled__default["default"](reactGrid.Col) `
4920
+ margin-bottom: ${theme.space.lg};
4921
+
4922
+ @media screen and (max-width: ${theme.breakpoints.sm}) {
4923
+ margin-bottom: ${theme.space.md};
4924
+ }
4925
+ `;
4926
+ const Col = (props) => jsxRuntime.jsx(StyledCol$1, Object.assign({}, props));
4927
+
4855
4928
  const CommentCard = styled.styled(Card) `
4856
4929
  padding: ${({ theme }) => `${theme.space.base * 3}px ${theme.space.sm}`};
4857
4930
  background-color: ${({ theme }) => theme.palette.grey[100]};
@@ -4895,13 +4968,9 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4895
4968
  var _a, _b;
4896
4969
  const { mentionableUsers } = useChatContext();
4897
4970
  const [isOpen, setIsOpen] = React.useState(false);
4898
- const [selectedImage, setSelectedImage] = React.useState({});
4899
4971
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
4900
4972
  const ext = editorExtensions({ mentionableUsers });
4901
- const handleClickThumbnail = (file, index) => {
4902
- if (!file)
4903
- throw Error("Error with the image");
4904
- setSelectedImage(file);
4973
+ const handleClickThumbnail = (index) => {
4905
4974
  setSelectedImageIndex(index);
4906
4975
  setIsOpen(true);
4907
4976
  };
@@ -4910,14 +4979,13 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4910
4979
  };
4911
4980
  const videoRefs = React.useRef([]);
4912
4981
  const slideChange = React.useCallback((index) => {
4913
- setSelectedImage(media[index]);
4914
4982
  setSelectedImageIndex(index);
4915
4983
  videoRefs.current.forEach((ref) => {
4916
4984
  if (ref) {
4917
4985
  ref.pause();
4918
4986
  }
4919
4987
  });
4920
- }, [videoRefs, media]);
4988
+ }, [videoRefs]);
4921
4989
  const ed = react.useEditor({
4922
4990
  extensions: ext,
4923
4991
  content: message || "",
@@ -4927,23 +4995,12 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4927
4995
  ed.setOptions({
4928
4996
  editable: false,
4929
4997
  });
4930
- return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", " ", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: media.map((file, index) => {
4931
- // Check if item is an image or a video
4932
- if (file.type.includes("image"))
4933
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(ImageThumbnail, { src: file.url, index: index, showX: false, isLoadingMedia: false, clickThumbnail: () => {
4934
- handleClickThumbnail(file, index);
4935
- } }, index) })));
4936
- if (file.type.includes("video"))
4937
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(VideoThumbnail, { src: file.url, index: index, showX: false, isLoadingMedia: false, clickThumbnail: () => {
4938
- handleClickThumbnail(file, index);
4939
- } }, index) })));
4940
- return null;
4941
- }) })) }), isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })) }), jsxRuntime.jsxs(Lightbox.Body, { children: [jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 2 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: media.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type === "image" && (jsxRuntime.jsx("img", { src: item.url, alt: `{{${item.url}}}` })), item.type === "video" && (jsxRuntime.jsx(Player, { ref: (ref) => {
4942
- videoRefs.current.push(ref);
4943
- }, url: item.url }))] }))) })) })), jsxRuntime.jsx(Lightbox.Body.Details, Object.assign({ style: { flex: 1 } }, { children: jsxRuntime.jsx(Comment, Object.assign({ header: header, author: {
4944
- avatar: author.avatar,
4945
- name: author.name,
4946
- }, date: date, message: message }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("br", {}) }) })) }))] }), jsxRuntime.jsx(Lightbox.Footer, {}), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(Footer$2, { children: children })] }));
4998
+ return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", " ", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: media.map((file, index) => (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(Thumbnail, { src: file.url, type: file.type, showX: false, isLoadingMedia: false, clickThumbnail: () => {
4999
+ handleClickThumbnail(index);
5000
+ } }) }), index))) })) }), jsxRuntime.jsx(MediaLightBox, { isOpen: isOpen, header: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })), onClose: closeLightbox, slideChange: slideChange, selectedImageIndex: selectedImageIndex, thumbnails: media, videoRefs: videoRefs, details: jsxRuntime.jsx(Comment, Object.assign({ header: header, author: {
5001
+ avatar: author.avatar,
5002
+ name: author.name,
5003
+ }, date: date, message: message }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("br", {}) }) })) }), jsxRuntime.jsx(Footer$2, { children: children })] }));
4947
5004
  };
4948
5005
 
4949
5006
  /**
@@ -5601,9 +5658,10 @@ const useHighlightContext = () => {
5601
5658
  };
5602
5659
 
5603
5660
  const StyledSearchWord = styled__default["default"].span `
5604
- background-color: ${({ theme }) => theme.palette.product.talk};
5605
- color: ${({ theme }) => theme.palette.grey[700]};`;
5606
- const Searchable = ({ start, text, }) => {
5661
+ background-color: ${({ theme }) => theme.palette.product.talk};
5662
+ color: ${({ theme }) => theme.palette.grey[700]};
5663
+ `;
5664
+ const Searchable = ({ text, }) => {
5607
5665
  const { searchTerm } = useHighlightContext();
5608
5666
  if (searchTerm) {
5609
5667
  const parts = text.split(new RegExp(`(${searchTerm})`, "gi"));
@@ -5612,66 +5670,140 @@ const Searchable = ({ start, text, }) => {
5612
5670
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: text });
5613
5671
  };
5614
5672
 
5615
- const StyledWord = styled__default["default"](reactTypography.Span) `
5673
+ const CreateObservationButton = styled.styled(Button) `
5674
+ user-select: none;
5675
+ position: absolute;
5676
+ left: ${({ position: { x } }) => x}px;
5677
+ top: ${({ position: { y } }) => y}px;
5678
+ transform: translate(-50%, 0);
5679
+ z-index: ${({ theme }) => theme.levels.front};
5680
+ `;
5681
+
5682
+ const getFocusedObs = (observations) => {
5683
+ return observations.find((obs) => obs.isFocused);
5684
+ };
5685
+ const StyledWord = styled__default["default"].div `
5686
+ display: inline-block;
5616
5687
  font-size: ${({ theme, size }) => theme.fontSizes[size !== null && size !== void 0 ? size : "md"]};
5617
5688
  padding: ${({ theme }) => theme.space.xxs} 0;
5689
+ position: relative;
5690
+ color: ${({ theme }) => theme.palette.grey[700]};
5691
+ white-space: pre;
5618
5692
 
5619
- ${({ observation, theme }) => {
5620
- var _a, _b;
5621
- return observation &&
5622
- ` user-select: none;
5623
- padding: 0;
5624
- background-color: ${(_a = observation.backgroundColor) !== null && _a !== void 0 ? _a : getColor(theme.palette.azure, 700, undefined, 0.5)};
5625
- color: ${(_b = observation.color) !== null && _b !== void 0 ? _b : "white"};
5693
+ ${({ observations, theme }) => {
5694
+ var _a;
5695
+ return observations &&
5696
+ observations.length > 0 &&
5697
+ `
5698
+ color: ${(_a = observations[observations.length - 1].color) !== null && _a !== void 0 ? _a : theme.palette.grey[600]};
5626
5699
  box-sizing: border-box;
5700
+ font-weight: ${getFocusedObs(observations)
5701
+ ? theme.fontWeights.extrabold
5702
+ : theme.fontWeights.semibold};
5703
+ font-style: ${getFocusedObs(observations) ? "italic" : "normal"};
5704
+ z-index: 1;
5627
5705
  &:focus {
5628
5706
  outline: none;
5629
5707
  }
5630
-
5631
- + span:not([observation]) {
5632
- margin-left: 2px;
5633
- }
5634
5708
  `;
5635
5709
  }}
5636
5710
  `;
5637
5711
  const ActiveWord = styled__default["default"].span `
5638
- background-color: ${({ theme }) => getColor(theme.palette.fuschia, 700, undefined, 0.5)};
5639
- padding: 0 2px;
5712
+ position: relative;
5713
+ z-index: 2;
5714
+ background-color: ${({ theme }) => getColor(theme.palette.fuschia, 400, undefined, 0.4)};
5640
5715
  `;
5641
5716
  const WordsContainer = styled__default["default"].div `
5642
5717
  box-sizing: border-box;
5643
5718
  ${StyledWord}, span {
5644
5719
  &::selection {
5645
- background-color: ${({ theme }) => getColor(theme.palette.kale, 700, undefined, 0.5)};
5720
+ background-color: ${({ theme }) => getColor(theme.palette.grey, 400, undefined, 0.5)};
5646
5721
  }
5647
5722
  }
5648
5723
  `;
5724
+ const Layer = styled__default["default"].div `
5725
+ position: absolute;
5726
+ top: 0;
5727
+ left: 0;
5728
+ width: 100%;
5729
+ height: 100%;
5730
+ z-index: 0;
5731
+ background-color: ${({ color }) => getColor(color, undefined, undefined, 0.2)};
5732
+ `;
5649
5733
  /**
5650
5734
  * Use Highlight to use highlight interation on any text element
5651
5735
  */
5652
5736
  const Highlight = (props) => {
5737
+ var _a;
5738
+ const { onSelectionButtonClick, search, i18n, children } = props;
5653
5739
  const ref = React.useRef(null);
5740
+ const [isSelecting, setIsSelecting] = React.useState(false);
5741
+ const [position, setPosition] = React.useState();
5742
+ const [selection, setSelection] = React.useState();
5743
+ const activeSelection = document.getSelection();
5744
+ const extractText = (selection) => {
5745
+ if (selection.anchorNode === null || selection.focusNode === null)
5746
+ return "";
5747
+ var range = selection.getRangeAt(0);
5748
+ var tempDiv = document.createElement("div");
5749
+ tempDiv.appendChild(range.cloneContents());
5750
+ var items = tempDiv.querySelectorAll("div");
5751
+ items.forEach(function (item) {
5752
+ if (item.getAttribute("data-unselectable")) {
5753
+ item.remove();
5754
+ }
5755
+ });
5756
+ var filteredText = tempDiv.textContent || tempDiv.innerText;
5757
+ return filteredText.length ? filteredText.trim() : selection.toString();
5758
+ };
5654
5759
  const handleSelectionChange = React.useCallback(() => {
5655
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5656
- const activeSelection = document.getSelection();
5657
- const text = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.toString();
5658
- if (!activeSelection || !text) {
5659
- return;
5760
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5761
+ if (activeSelection && activeSelection.toString().length > 0) {
5762
+ // Extract the text from the selection cleaning unselectable items
5763
+ const text = extractText(activeSelection);
5764
+ if (!text)
5765
+ return;
5766
+ const anchorNode = (_a = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.anchorNode) === null || _a === void 0 ? void 0 : _a.parentElement;
5767
+ const focusNode = (_b = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.focusNode) === null || _b === void 0 ? void 0 : _b.parentElement;
5768
+ if (anchorNode &&
5769
+ focusNode &&
5770
+ ((_c = ref.current) === null || _c === void 0 ? void 0 : _c.contains(anchorNode)) && // Selection starts inside the ref
5771
+ ((_d = ref.current) === null || _d === void 0 ? void 0 : _d.contains(focusNode)) // Selection ends inside the ref
5772
+ ) {
5773
+ if (onSelectionButtonClick) {
5774
+ setIsSelecting(true);
5775
+ const range = activeSelection.getRangeAt(0);
5776
+ const rects = range.getClientRects();
5777
+ const lastRect = rects[rects.length - 1];
5778
+ const containerRect = ref && ref.current ? ref.current.getBoundingClientRect() : null;
5779
+ if (!lastRect || !containerRect)
5780
+ return;
5781
+ const relativeY = lastRect.bottom - containerRect.top + ref.current.scrollTop;
5782
+ const relativeX = lastRect.right - containerRect.left + ref.current.scrollLeft;
5783
+ if (relativeY > 0 || relativeX > 0)
5784
+ // Fix to avoid the button to be placed sometimes at the top left corner of the screen (X: 0, Y: 0)
5785
+ setPosition({
5786
+ x: relativeX,
5787
+ y: relativeY + 15,
5788
+ });
5789
+ }
5790
+ else {
5791
+ setIsSelecting(false);
5792
+ }
5793
+ const selectionPart = {
5794
+ from: Math.min(Number.parseFloat((_e = anchorNode.getAttribute("data-start")) !== null && _e !== void 0 ? _e : "0"), Number.parseFloat((_f = focusNode.getAttribute("data-start")) !== null && _f !== void 0 ? _f : "0")),
5795
+ to: Math.max(Number.parseFloat((_g = anchorNode.getAttribute("data-end")) !== null && _g !== void 0 ? _g : "0"), Number.parseFloat((_h = focusNode.getAttribute("data-end")) !== null && _h !== void 0 ? _h : "0")),
5796
+ };
5797
+ setSelection(Object.assign(Object.assign({}, selectionPart), { text }));
5798
+ }
5799
+ else {
5800
+ setIsSelecting(false);
5801
+ }
5660
5802
  }
5661
- const anchorNode = (_a = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.anchorNode) === null || _a === void 0 ? void 0 : _a.parentElement;
5662
- const focusNode = (_b = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.focusNode) === null || _b === void 0 ? void 0 : _b.parentElement;
5663
- if (anchorNode &&
5664
- focusNode &&
5665
- ((_c = ref.current) === null || _c === void 0 ? void 0 : _c.contains(anchorNode)) && // Selection starts inside the ref
5666
- ((_d = ref.current) === null || _d === void 0 ? void 0 : _d.contains(focusNode)) // Selection ends inside the ref
5667
- ) {
5668
- const selectionPart = {
5669
- from: Math.min(Number.parseFloat((_e = anchorNode.getAttribute("data-start")) !== null && _e !== void 0 ? _e : "0"), Number.parseFloat((_f = focusNode.getAttribute("data-start")) !== null && _f !== void 0 ? _f : "0")),
5670
- to: Math.max(Number.parseFloat((_g = anchorNode.getAttribute("data-end")) !== null && _g !== void 0 ? _g : "0"), Number.parseFloat((_h = focusNode.getAttribute("data-end")) !== null && _h !== void 0 ? _h : "0")),
5671
- };
5672
- (_j = props === null || props === void 0 ? void 0 : props.handleSelection) === null || _j === void 0 ? void 0 : _j.call(props, Object.assign(Object.assign({}, selectionPart), { text }));
5803
+ else {
5804
+ setIsSelecting(false);
5673
5805
  }
5674
- }, [props]);
5806
+ }, [onSelectionButtonClick, activeSelection]);
5675
5807
  React.useEffect(() => {
5676
5808
  if (ref.current === null)
5677
5809
  return;
@@ -5680,16 +5812,30 @@ const Highlight = (props) => {
5680
5812
  document.removeEventListener("selectionchange", handleSelectionChange);
5681
5813
  };
5682
5814
  }, [ref, props, handleSelectionChange]);
5683
- return (jsxRuntime.jsx(HighlightContextProvider, Object.assign({ term: props.search }, { children: jsxRuntime.jsx(WordsContainer, Object.assign({ ref: ref }, { children: props.children })) })));
5815
+ return (jsxRuntime.jsxs(HighlightContextProvider, Object.assign({ term: search }, { children: [jsxRuntime.jsx(WordsContainer, Object.assign({ ref: ref }, { children: children })), onSelectionButtonClick && isSelecting && selection && (jsxRuntime.jsxs(CreateObservationButton, Object.assign({ isAccent: true, isPrimary: true, position: position !== null && position !== void 0 ? position : {
5816
+ x: 0,
5817
+ y: 0,
5818
+ }, onClick: () => onSelectionButtonClick(selection) }, { children: [jsxRuntime.jsx(CreateObservationButton.StartIcon, { children: jsxRuntime.jsx(SvgTagStroke, {}) }), (_a = i18n === null || i18n === void 0 ? void 0 : i18n.selectionButtonLabel) !== null && _a !== void 0 ? _a : "Create observation"] })))] })));
5684
5819
  };
5685
5820
  const Word = (props) => {
5686
- var _a;
5687
5821
  const isActive = props.currentTime &&
5688
5822
  props.currentTime >= props.start &&
5689
5823
  props.currentTime < props.end;
5690
- // Is there an observation that contains this word?
5691
- const observation = (_a = props.observations) === null || _a === void 0 ? void 0 : _a.find((obs) => props.start >= obs.start && props.end <= obs.end);
5692
- return (jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { observation: observation, "data-start": props.start, "data-end": props.end, className: !!observation ? "highlighted" : "" }, (!!observation ? { tag: "observation" } : {}), { children: [isActive ? (jsxRuntime.jsx(ActiveWord, { children: jsxRuntime.jsx(Searchable, { start: props.start, text: props.text }) })) : (jsxRuntime.jsx(Searchable, { start: props.start, text: props.text })), " "] })));
5824
+ // Are there any observations containing this word?
5825
+ const foundObservations = React.useMemo(() => {
5826
+ var _a, _b;
5827
+ return (_b = (_a = props.observations) === null || _a === void 0 ? void 0 : _a.filter((obs) => Number(props.start.toFixed(8)) >= Number(obs.start.toFixed(8)) &&
5828
+ Number(props.end.toFixed(8)) <= Number(obs.end.toFixed(8)))) !== null && _b !== void 0 ? _b : [];
5829
+ }, [props.observations, props.start, props.end]);
5830
+ const ObsWord = React.useMemo(() => (jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { "data-start": props.start, "data-end": props.end, className: foundObservations.length > 0 ? "highlighted" : "" }, (foundObservations && { observations: foundObservations }), { children: [foundObservations.length > 0 &&
5831
+ foundObservations.map((obs) => {
5832
+ var _a;
5833
+ return (jsxRuntime.jsx(Layer, { color: (_a = obs.hue) !== null && _a !== void 0 ? _a : theme.palette.grey[600] }, obs.id));
5834
+ }), isActive ? (jsxRuntime.jsx(ActiveWord, Object.assign({ "data-start": props.start, "data-end": props.end }, { children: jsxRuntime.jsx(Searchable, { text: props.text }) }))) : (jsxRuntime.jsx(Searchable, { text: props.text })), " "] }))), [props, foundObservations, isActive]);
5835
+ if (props.tooltipContent !== undefined && foundObservations.length > 0) {
5836
+ return (jsxRuntime.jsx(Tooltip, Object.assign({ content: props.tooltipContent(foundObservations), isTransparent: true }, { children: ObsWord })));
5837
+ }
5838
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: ObsWord });
5693
5839
  };
5694
5840
  Highlight.Word = Word;
5695
5841
 
@@ -7115,6 +7261,10 @@ Object.defineProperty(exports, 'ModalClose', {
7115
7261
  enumerable: true,
7116
7262
  get: function () { return reactModals.Close; }
7117
7263
  });
7264
+ Object.defineProperty(exports, 'useVideoContext', {
7265
+ enumerable: true,
7266
+ get: function () { return Video.useVideoContext; }
7267
+ });
7118
7268
  exports.Accordion = Accordion;
7119
7269
  exports.Alert = Alert;
7120
7270
  exports.Anchor = Anchor;
@@ -7212,6 +7362,7 @@ exports.Pagination = Pagination;
7212
7362
  exports.Paragraph = Paragraph;
7213
7363
  exports.PieChart = PieChart;
7214
7364
  exports.Player = Player;
7365
+ exports.PlayerProvider = PlayerProvider;
7215
7366
  exports.PreviousItem = PreviousItem;
7216
7367
  exports.ProductCard = ProductCard;
7217
7368
  exports.ProfileModal = ProfileModal;