box-content-preview 3.114.0 → 3.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/index.js CHANGED
@@ -31,11 +31,12 @@ import { default as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_features_virtua
31
31
  import { AutoSizer as __WEBPACK_EXTERNAL_MODULE__box_react_virtualized_ec986521_AutoSizer__, Column as __WEBPACK_EXTERNAL_MODULE__box_react_virtualized_ec986521_Column__, SortDirection as __WEBPACK_EXTERNAL_MODULE__box_react_virtualized_ec986521_SortDirection__ } from "@box/react-virtualized";
32
32
  import { default as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_breadcrumb_da64b71d_default__ } from "box-ui-elements/es/components/breadcrumb";
33
33
  import { default as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_plain_button_PlainButton_6ddbae5a_default__ } from "box-ui-elements/es/components/plain-button/PlainButton";
34
- import { Pause as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c_Pause__, Play as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c_Play__ } from "@box/blueprint-web-assets/icons/MediumFilled";
35
34
  import { createPortal as __WEBPACK_EXTERNAL_MODULE_react_dom_7dac9eee_createPortal__ } from "react-dom";
36
35
  import { Grid as __WEBPACK_EXTERNAL_MODULE__box_react_virtualized_dist_es_Grid_5f3cce90_Grid__ } from "@box/react-virtualized/dist/es/Grid";
37
36
  import * as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__ from "@box/blueprint-web";
38
37
  import * as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__ from "@box/blueprint-web-assets/icons/Medium";
38
+ import * as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c__ from "@box/blueprint-web-assets/icons/MediumFilled";
39
+ import * as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_tokens_tokens_b764a744__ from "@box/blueprint-web-assets/tokens/tokens";
39
40
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
40
41
  import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7__ from "react-dom/client";
41
42
  import { default as __WEBPACK_EXTERNAL_MODULE_axios_default__ } from "axios";
@@ -46,10 +47,22 @@ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Me
46
47
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__ } from "@box/blueprint-web-assets/icons/Medium/PencilTip";
47
48
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__ } from "@box/blueprint-web-assets/icons/Medium/SquarePlus";
48
49
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__ } from "@box/blueprint-web-assets/icons/Medium/TCursorHighlight";
50
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Search_ef3e4aba_default__ } from "@box/blueprint-web-assets/icons/Medium/Search";
51
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize";
52
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize";
53
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_GridView_ac92b674_default__ } from "@box/blueprint-web-assets/icons/Medium/GridView";
49
54
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronDown";
50
55
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronUp";
56
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__ } from "@box/blueprint-web-assets/icons/Medium/RotateLeft";
57
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Nav_d41e959a_default__ } from "@box/blueprint-web-assets/icons/Medium/Nav";
58
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Nav_ae6d790f_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Nav";
51
59
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__ } from "@box/blueprint-web-assets/icons/Medium/Minus";
52
60
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__ } from "@box/blueprint-web-assets/icons/Medium/Plus";
61
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Checkmark_52a58454_default__ } from "@box/blueprint-web-assets/icons/Medium/Checkmark";
62
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Download_0dc63cde_default__ } from "@box/blueprint-web-assets/icons/Medium/Download";
63
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Ellipsis_9a96c07b_default__ } from "@box/blueprint-web-assets/icons/Medium/Ellipsis";
64
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Expand_92c6b888_default__ } from "@box/blueprint-web-assets/icons/Medium/Expand";
65
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Trash_28211f44_default__ } from "@box/blueprint-web-assets/icons/Medium/Trash";
53
66
  import { PreviewLoading as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_PreviewLoading__, getIcon as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_components_preview_386c8d2b_getIcon__ } from "box-ui-elements/es/components/preview";
54
67
  /******/ var __webpack_modules__ = ({
55
68
 
@@ -57,12 +70,16 @@ import { PreviewLoading as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_componen
57
70
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
58
71
 
59
72
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
60
- /* harmony export */ A: () => (/* binding */ BlueprintProviders)
73
+ /* harmony export */ A: () => (/* binding */ BlueprintProviders),
74
+ /* harmony export */ n: () => (/* binding */ PortalContainerContext)
61
75
  /* harmony export */ });
62
76
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1649);
63
77
  /* harmony import */ var _box_blueprint_web__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8912);
64
78
 
65
79
 
80
+ // Tooltips read the container from TooltipProvider; Popover and DropdownMenu content take it as a prop.
81
+ const PortalContainerContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["default"].createContext(undefined);
82
+
66
83
  // Preview has no Split client, so Blueprint's treatment-driven configuration resolves to its defaults.
67
84
  function BlueprintProviders({
68
85
  children,
@@ -70,9 +87,11 @@ function BlueprintProviders({
70
87
  }) {
71
88
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["default"].createElement(_box_blueprint_web__WEBPACK_IMPORTED_MODULE_1__.BlueprintProvider, {
72
89
  useTreatment: _box_blueprint_web__WEBPACK_IMPORTED_MODULE_1__.useNoopTreatment
90
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["default"].createElement(PortalContainerContext.Provider, {
91
+ value: container
73
92
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["default"].createElement(_box_blueprint_web__WEBPACK_IMPORTED_MODULE_1__.TooltipProvider, {
74
93
  container: container
75
- }, children));
94
+ }, children)));
76
95
  }
77
96
 
78
97
  /***/ },
@@ -1082,7 +1101,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
1082
1101
  const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
1083
1102
  const CLIENT_NAME_KEY = 'box_client_name';
1084
1103
  const CLIENT_VERSION_KEY = 'box_client_version';
1085
- const CLIENT_VERSION = "3.114.0"; // eslint-disable-line no-undef
1104
+ const CLIENT_VERSION = "3.115.0"; // eslint-disable-line no-undef
1086
1105
  const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
1087
1106
  const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
1088
1107
  const PROMISE_MAP = {};
@@ -4251,7 +4270,29 @@ function MediaToggle(props) {
4251
4270
 
4252
4271
  /***/ },
4253
4272
 
4254
- /***/ 2677
4273
+ /***/ 2048
4274
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4275
+
4276
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4277
+ /* harmony export */ A: () => (/* binding */ PlayOverlayIcon)
4278
+ /* harmony export */ });
4279
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1649);
4280
+ /* harmony import */ var _box_blueprint_web_assets_icons_MediumFilled__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5903);
4281
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4282
+
4283
+
4284
+
4285
+ // IconButton sizes its icon from its own size map (24px at most); play overlays need 48px.
4286
+ function PlayOverlayIcon(props) {
4287
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["default"].createElement(_box_blueprint_web_assets_icons_MediumFilled__WEBPACK_IMPORTED_MODULE_1__.Play, _extends({}, props, {
4288
+ height: 48,
4289
+ width: 48
4290
+ }));
4291
+ }
4292
+
4293
+ /***/ },
4294
+
4295
+ /***/ 5760
4255
4296
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4256
4297
 
4257
4298
 
@@ -4264,8 +4305,8 @@ __webpack_require__.d(__webpack_exports__, {
4264
4305
  var external_react_ = __webpack_require__(1649);
4265
4306
  // EXTERNAL MODULE: external "@box/blueprint-web"
4266
4307
  var blueprint_web_ = __webpack_require__(8912);
4267
- ;// external "@box/blueprint-web-assets/icons/MediumFilled"
4268
-
4308
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/icons/MediumFilled"
4309
+ var MediumFilled_ = __webpack_require__(5903);
4269
4310
  ;// ./src/lib/viewers/controls/icons/IconPause24.tsx
4270
4311
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4271
4312
 
@@ -4325,7 +4366,7 @@ function PlayPauseButton({
4325
4366
  "aria-label": title,
4326
4367
  "data-resin-target": "playPause",
4327
4368
  "data-target-id": "PlayPauseButton-playPause",
4328
- icon: isPlaying ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c_Pause__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c_Play__,
4369
+ icon: isPlaying ? MediumFilled_.Pause : MediumFilled_.Play,
4329
4370
  onClick: handleClick,
4330
4371
  onKeyDown: utils/* stopActivationKeyPropagation */.My,
4331
4372
  size: "large",
@@ -4357,8 +4398,8 @@ var external_react_ = __webpack_require__(1649);
4357
4398
  // EXTERNAL MODULE: ./node_modules/lodash/noop.js
4358
4399
  var noop = __webpack_require__(3950);
4359
4400
  var noop_default = /*#__PURE__*/__webpack_require__.n(noop);
4360
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseButton.tsx + 3 modules
4361
- var PlayPauseButton = __webpack_require__(2677);
4401
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseButton.tsx + 2 modules
4402
+ var PlayPauseButton = __webpack_require__(5760);
4362
4403
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/SkipButton.tsx + 2 modules
4363
4404
  var SkipButton = __webpack_require__(2659);
4364
4405
  ;// ./src/lib/viewers/controls/media/PlayPauseToggle.scss
@@ -4496,7 +4537,7 @@ function SkipButton({
4496
4537
 
4497
4538
  /***/ },
4498
4539
 
4499
- /***/ 3904
4540
+ /***/ 3308
4500
4541
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4501
4542
 
4502
4543
 
@@ -4512,6 +4553,12 @@ var external_react_ = __webpack_require__(1649);
4512
4553
  // EXTERNAL MODULE: ./node_modules/classnames/index.js
4513
4554
  var classnames = __webpack_require__(2485);
4514
4555
  var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
4556
+ // EXTERNAL MODULE: external "@box/blueprint-web"
4557
+ var blueprint_web_ = __webpack_require__(8912);
4558
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/icons/Medium"
4559
+ var Medium_ = __webpack_require__(9747);
4560
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/tokens/tokens"
4561
+ var tokens_ = __webpack_require__(8380);
4515
4562
  // EXTERNAL MODULE: ./src/lib/viewers/media/formatTimecode.ts
4516
4563
  var formatTimecode = __webpack_require__(4179);
4517
4564
  // EXTERNAL MODULE: ./src/lib/viewers/controls/icons/IconCheckMark24.tsx
@@ -4522,8 +4569,75 @@ var IconChevronDownMedium24 = __webpack_require__(8668);
4522
4569
  var IconChevronUpMedium24 = __webpack_require__(2155);
4523
4570
  // EXTERNAL MODULE: ./src/lib/viewers/controls/hooks/useClickOutside.ts
4524
4571
  var useClickOutside = __webpack_require__(2959);
4572
+ ;// ./src/lib/TabularDigits.scss
4573
+ // extracted by mini-css-extract-plugin
4574
+
4575
+ ;// ./src/lib/TabularDigits.tsx
4576
+ /* unused harmony import specifier */ var React;
4577
+
4578
+
4579
+
4580
+ // The Inter subset served to the app has no tabular figures, so `font-variant-numeric: tabular-nums`
4581
+ // has no effect. Wrapping each digit in a 1ch box keeps changing numbers, and whatever follows them,
4582
+ // from shifting as they update.
4583
+ const TABULAR_DIGIT_CLASS = 'bp-TabularDigit';
4584
+ const isDigit = char => char >= '0' && char <= '9';
4585
+ const isDigitNode = node => node.nodeType === Node.ELEMENT_NODE;
4586
+
4587
+ /**
4588
+ * Writes `text` into `el` with each digit in a fixed-width box. For labels updated outside React,
4589
+ * e.g. on animation frames. Unchanged characters are left in place, so a ticking clock only touches
4590
+ * the digits that changed.
4591
+ */
4592
+ function renderTabularDigits(el, text) {
4593
+ if (el.textContent === text) {
4594
+ return;
4595
+ }
4596
+ const chars = Array.from(text);
4597
+ const nodes = el.childNodes;
4598
+ const canPatch = nodes.length === chars.length && chars.every((char, index) => isDigit(char) === isDigitNode(nodes[index]));
4599
+ if (canPatch) {
4600
+ chars.forEach((char, index) => {
4601
+ if (nodes[index].textContent !== char) {
4602
+ nodes[index].textContent = char;
4603
+ }
4604
+ });
4605
+ return;
4606
+ }
4607
+ const fragment = document.createDocumentFragment();
4608
+ chars.forEach(char => {
4609
+ if (isDigit(char)) {
4610
+ const digitEl = document.createElement('span');
4611
+ digitEl.className = TABULAR_DIGIT_CLASS;
4612
+ digitEl.textContent = char;
4613
+ fragment.appendChild(digitEl);
4614
+ } else {
4615
+ fragment.appendChild(document.createTextNode(char));
4616
+ }
4617
+ });
4618
+ el.replaceChildren(fragment);
4619
+ }
4620
+ /**
4621
+ * Renders `children` with each digit in a fixed-width box. Place it inside the element that
4622
+ * provides the typography, e.g. `<Text as="span"><TabularDigits>{label}</TabularDigits></Text>`.
4623
+ */
4624
+ function TabularDigits({
4625
+ children
4626
+ }) {
4627
+ const elRef = React.useRef(null);
4628
+ React.useLayoutEffect(() => {
4629
+ if (elRef.current) {
4630
+ renderTabularDigits(elRef.current, children);
4631
+ }
4632
+ }, [children]);
4633
+ return /*#__PURE__*/React.createElement("span", {
4634
+ ref: elRef
4635
+ });
4636
+ }
4525
4637
  // EXTERNAL MODULE: ./src/lib/viewers/media/videoFps.ts
4526
4638
  var videoFps = __webpack_require__(3234);
4639
+ // EXTERNAL MODULE: ./src/lib/BlueprintProviders.tsx
4640
+ var BlueprintProviders = __webpack_require__(2758);
4527
4641
  // EXTERNAL MODULE: ./src/lib/util.js + 1 modules
4528
4642
  var util = __webpack_require__(4410);
4529
4643
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/DurationLabels.tsx + 1 modules
@@ -4543,6 +4657,11 @@ var DurationLabels = __webpack_require__(820);
4543
4657
 
4544
4658
 
4545
4659
 
4660
+
4661
+
4662
+
4663
+
4664
+
4546
4665
  let TimeFormat = /*#__PURE__*/function (TimeFormat) {
4547
4666
  TimeFormat["STANDARD"] = "standard";
4548
4667
  TimeFormat["TIMECODE"] = "timecode";
@@ -4560,6 +4679,14 @@ function formatLabel(time, format, fps) {
4560
4679
  return (0,DurationLabels/* formatTime */.f)(time);
4561
4680
  }
4562
4681
  }
4682
+
4683
+ // The viewer maps Space, Enter and the arrow keys to playback, seek and volume shortcuts.
4684
+ const stopMenuTriggerKeyPropagation = event => {
4685
+ const key = (0,util/* decodeKeydown */.wU)(event);
4686
+ if (key === 'Enter' || key === 'Space' || key === 'ArrowDown' || key === 'ArrowUp') {
4687
+ event.stopPropagation();
4688
+ }
4689
+ };
4563
4690
  const FORMAT_OPTIONS = [{
4564
4691
  label: () => "Standard time",
4565
4692
  value: TimeFormat.STANDARD
@@ -4575,6 +4702,7 @@ function TimestampControl({
4575
4702
  durationTime = 0,
4576
4703
  fps = videoFps/* DEFAULT_FPS */.ge,
4577
4704
  canChangeTimeFormat = false,
4705
+ isBlueprintEnabled = false,
4578
4706
  isNarrowWidth = false,
4579
4707
  mediaEl
4580
4708
  }) {
@@ -4583,8 +4711,15 @@ function TimestampControl({
4583
4711
  const containerElRef = external_react_["default"].useRef(null);
4584
4712
  const buttonElRef = external_react_["default"].useRef(null);
4585
4713
  const currentElRef = external_react_["default"].useRef(null);
4714
+ const durationElRef = external_react_["default"].useRef(null);
4586
4715
  const rafIdRef = external_react_["default"].useRef(0);
4587
- (0,useClickOutside/* default */.A)(containerElRef, () => setIsOpen(false));
4716
+ const portalContainer = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n) ?? undefined;
4717
+ (0,useClickOutside/* default */.A)(containerElRef, () => {
4718
+ // The Blueprint menu portals outside the container and handles outside clicks itself.
4719
+ if (!isBlueprintEnabled) {
4720
+ setIsOpen(false);
4721
+ }
4722
+ });
4588
4723
  external_react_["default"].useEffect(() => {
4589
4724
  const container = mediaEl?.closest('.bp-media-container');
4590
4725
  if (container) {
@@ -4600,7 +4735,12 @@ function TimestampControl({
4600
4735
  }
4601
4736
  const tick = () => {
4602
4737
  if (currentElRef.current && mediaEl) {
4603
- currentElRef.current.textContent = formatLabel(mediaEl.currentTime, format, fps);
4738
+ const label = formatLabel(mediaEl.currentTime, format, fps);
4739
+ if (isBlueprintEnabled) {
4740
+ renderTabularDigits(currentElRef.current, label);
4741
+ } else {
4742
+ currentElRef.current.textContent = label;
4743
+ }
4604
4744
  }
4605
4745
  rafIdRef.current = requestAnimationFrame(tick);
4606
4746
  };
@@ -4621,7 +4761,21 @@ function TimestampControl({
4621
4761
  mediaEl.removeEventListener('play', startLoop);
4622
4762
  mediaEl.removeEventListener('pause', stopLoop);
4623
4763
  };
4624
- }, [format, fps, mediaEl]);
4764
+ }, [format, fps, isBlueprintEnabled, mediaEl]);
4765
+ const currentLabel = formatLabel(currentTime, format, fps);
4766
+ external_react_["default"].useLayoutEffect(() => {
4767
+ // The animation frame loop owns the label while a frame-accurate format is playing.
4768
+ const isFrameLoopRunning = format !== TimeFormat.STANDARD && mediaEl?.paused === false;
4769
+ if (isBlueprintEnabled && currentElRef.current && !isFrameLoopRunning) {
4770
+ renderTabularDigits(currentElRef.current, currentLabel);
4771
+ }
4772
+ }, [currentLabel, format, isBlueprintEnabled, mediaEl]);
4773
+ const durationLabel = formatLabel(durationTime, format, fps);
4774
+ external_react_["default"].useLayoutEffect(() => {
4775
+ if (isBlueprintEnabled && durationElRef.current) {
4776
+ renderTabularDigits(durationElRef.current, durationLabel);
4777
+ }
4778
+ }, [durationLabel, isBlueprintEnabled, isNarrowWidth]);
4625
4779
  const handleKeyDown = event => {
4626
4780
  const key = (0,util/* decodeKeydown */.wU)(event);
4627
4781
  if (key === 'Escape' && isOpen) {
@@ -4632,6 +4786,13 @@ function TimestampControl({
4632
4786
  event.stopPropagation();
4633
4787
  }
4634
4788
  };
4789
+
4790
+ // Menu keys must not reach the viewer shortcuts or the host page, which may close the preview
4791
+ // on Escape. The Blueprint menu's own Escape listener is on the document, so close it here.
4792
+ const handleMenuKeyDown = event => {
4793
+ event.stopPropagation();
4794
+ handleKeyDown(event);
4795
+ };
4635
4796
  const handleSelect = selectedFormat => {
4636
4797
  setFormat(selectedFormat);
4637
4798
  setIsOpen(false);
@@ -4649,6 +4810,84 @@ function TimestampControl({
4649
4810
  event.stopPropagation();
4650
4811
  handleSelect(selectedFormat);
4651
4812
  };
4813
+ const renderChevron = () => {
4814
+ if (isBlueprintEnabled) {
4815
+ const Chevron = isOpen ? Medium_.ChevronUp : Medium_.ChevronDown;
4816
+ return /*#__PURE__*/external_react_["default"].createElement(Chevron, {
4817
+ className: "bp-TimestampControl-chevron",
4818
+ color: tokens_.bpIconCtaIconOnDark
4819
+ });
4820
+ }
4821
+ return isOpen ? /*#__PURE__*/external_react_["default"].createElement(IconChevronUpMedium24/* default */.A, {
4822
+ className: "bp-TimestampControl-chevron"
4823
+ }) : /*#__PURE__*/external_react_["default"].createElement(IconChevronDownMedium24/* default */.A, {
4824
+ className: "bp-TimestampControl-chevron"
4825
+ });
4826
+ };
4827
+ const renderBlueprintTime = () => /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
4828
+ ref: currentElRef,
4829
+ as: "span",
4830
+ color: "textOnDarkDefault",
4831
+ variant: "bodyDefault"
4832
+ }), !isNarrowWidth && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
4833
+ as: "span",
4834
+ color: "textOnDarkDefault",
4835
+ variant: "bodyDefault"
4836
+ }, "/"), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
4837
+ ref: durationElRef,
4838
+ as: "span",
4839
+ color: "textOnDarkDefault",
4840
+ variant: "bodyDefault"
4841
+ })));
4842
+ if (isBlueprintEnabled && !canChangeTimeFormat) {
4843
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
4844
+ className: "bp-TimestampControl",
4845
+ "data-testid": "bp-TimestampControl"
4846
+ }, /*#__PURE__*/external_react_["default"].createElement("span", {
4847
+ className: "bp-TimestampControl-static",
4848
+ "data-testid": "bp-TimestampControl-static"
4849
+ }, renderBlueprintTime()));
4850
+ }
4851
+ if (isBlueprintEnabled) {
4852
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
4853
+ ref: containerElRef,
4854
+ className: "bp-TimestampControl",
4855
+ "data-testid": "bp-TimestampControl"
4856
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, {
4857
+ modal: false,
4858
+ onOpenChange: setIsOpen,
4859
+ open: isOpen
4860
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
4861
+ asChild: true
4862
+ }, /*#__PURE__*/external_react_["default"].createElement("button", {
4863
+ "aria-label": "Time format",
4864
+ className: classnames_default()('bp-TimestampControl-button', {
4865
+ 'bp-is-open': isOpen
4866
+ }),
4867
+ "data-resin-target": "timeFormat",
4868
+ "data-testid": "bp-TimestampControl-button",
4869
+ onKeyDown: stopMenuTriggerKeyPropagation,
4870
+ type: "button"
4871
+ }, renderBlueprintTime(), renderChevron())), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, {
4872
+ align: "center",
4873
+ container: portalContainer,
4874
+ "data-testid": "bp-TimestampControl-flyout",
4875
+ onKeyDown: handleMenuKeyDown,
4876
+ side: "top"
4877
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.SubHeader, null, "Time format"), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.RadioGroup, {
4878
+ onValueChange: value => setFormat(value),
4879
+ value: format
4880
+ }, FORMAT_OPTIONS.map(({
4881
+ label,
4882
+ value
4883
+ }) => /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.RadioSelectItem, {
4884
+ key: value,
4885
+ "data-resin-target": `timeFormat-${value}`,
4886
+ value: value
4887
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
4888
+ as: "span"
4889
+ }, label())))))));
4890
+ }
4652
4891
  if (!canChangeTimeFormat) {
4653
4892
  return /*#__PURE__*/external_react_["default"].createElement("div", {
4654
4893
  className: "bp-TimestampControl",
@@ -4688,11 +4927,7 @@ function TimestampControl({
4688
4927
  className: "bp-TimestampControl-separator"
4689
4928
  }, "/"), /*#__PURE__*/external_react_["default"].createElement("span", {
4690
4929
  className: "bp-TimestampControl-duration"
4691
- }, format === TimeFormat.FRAMES ? Math.floor(durationTime * fps).toString() : formatLabel(durationTime, format, fps))), isOpen ? /*#__PURE__*/external_react_["default"].createElement(IconChevronUpMedium24/* default */.A, {
4692
- className: "bp-TimestampControl-chevron"
4693
- }) : /*#__PURE__*/external_react_["default"].createElement(IconChevronDownMedium24/* default */.A, {
4694
- className: "bp-TimestampControl-chevron"
4695
- })), isOpen && /*#__PURE__*/external_react_["default"].createElement("div", {
4930
+ }, format === TimeFormat.FRAMES ? Math.floor(durationTime * fps).toString() : formatLabel(durationTime, format, fps))), renderChevron()), isOpen && /*#__PURE__*/external_react_["default"].createElement("div", {
4696
4931
  className: "bp-TimestampControl-flyout",
4697
4932
  "data-testid": "bp-TimestampControl-flyout",
4698
4933
  onKeyDown: handleKeyDown,
@@ -5552,6 +5787,7 @@ function useDismissableMarkerSelection(hostSelectedId = null, selectionSeq = nul
5552
5787
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5553
5788
 
5554
5789
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5790
+ /* harmony export */ B9: () => (/* binding */ stopToolbarKeyPropagation),
5555
5791
  /* harmony export */ KN: () => (/* binding */ percent),
5556
5792
  /* harmony export */ My: () => (/* binding */ stopActivationKeyPropagation)
5557
5793
  /* harmony export */ });
@@ -5572,6 +5808,14 @@ const stopActivationKeyPropagation = event => {
5572
5808
  event.stopPropagation();
5573
5809
  }
5574
5810
  };
5811
+ const TOOLBAR_KEYS = new Set(['ArrowLeft', 'ArrowRight', 'End', 'Enter', 'Home', 'Space']);
5812
+
5813
+ // Toolbars move focus with the arrow, Home and End keys, which the viewer maps to seeking.
5814
+ const stopToolbarKeyPropagation = event => {
5815
+ if (TOOLBAR_KEYS.has((0,_util__WEBPACK_IMPORTED_MODULE_0__/* .decodeKeydown */ .wU)(event))) {
5816
+ event.stopPropagation();
5817
+ }
5818
+ };
5575
5819
 
5576
5820
  /***/ },
5577
5821
 
@@ -6489,12 +6733,18 @@ var external_react_ = __webpack_require__(1649);
6489
6733
  // EXTERNAL MODULE: ./node_modules/lodash/isFinite.js
6490
6734
  var lodash_isFinite = __webpack_require__(2297);
6491
6735
  var isFinite_default = /*#__PURE__*/__webpack_require__.n(lodash_isFinite);
6736
+ // EXTERNAL MODULE: external "@box/blueprint-web"
6737
+ var blueprint_web_ = __webpack_require__(8912);
6492
6738
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/MediaSettings.tsx + 6 modules
6493
6739
  var MediaSettings = __webpack_require__(9229);
6740
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayOverlayIcon.tsx
6741
+ var PlayOverlayIcon = __webpack_require__(2048);
6494
6742
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseToggle.tsx + 1 modules
6495
6743
  var PlayPauseToggle = __webpack_require__(6321);
6496
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
6497
- var TimestampControl = __webpack_require__(3904);
6744
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
6745
+ var TimestampControl = __webpack_require__(3308);
6746
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
6747
+ var utils = __webpack_require__(5346);
6498
6748
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/VolumeControls.tsx + 8 modules
6499
6749
  var VolumeControls = __webpack_require__(3945);
6500
6750
  // EXTERNAL MODULE: ./src/lib/icons/play_48px.svg
@@ -6614,8 +6864,6 @@ var buildClusters = __webpack_require__(5510);
6614
6864
  var MarkerAvatarStack = __webpack_require__(308);
6615
6865
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/markers/MarkerAvatar.tsx + 1 modules
6616
6866
  var MarkerAvatar = __webpack_require__(2040);
6617
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
6618
- var utils = __webpack_require__(5346);
6619
6867
  ;// ./src/lib/viewers/media/waveform/WaveformCommentMarkers.scss
6620
6868
  // extracted by mini-css-extract-plugin
6621
6869
 
@@ -6768,8 +7016,6 @@ function WaveformCommentMarkers({
6768
7016
  }));
6769
7017
  })));
6770
7018
  }
6771
- // EXTERNAL MODULE: external "@box/blueprint-web"
6772
- var blueprint_web_ = __webpack_require__(8912);
6773
7019
  ;// ./src/lib/viewers/media/waveform/WaveformGeneratingIndicator.scss
6774
7020
  // extracted by mini-css-extract-plugin
6775
7021
 
@@ -6809,6 +7055,10 @@ function WaveformGeneratingIndicator({
6809
7055
  className: "bp-WaveformGeneratingIndicator-label"
6810
7056
  }, label));
6811
7057
  }
7058
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/icons/MediumFilled"
7059
+ var MediumFilled_ = __webpack_require__(5903);
7060
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/tokens/tokens"
7061
+ var tokens_ = __webpack_require__(8380);
6812
7062
  ;// ./src/lib/viewers/controls/icons/IconShuttleForward.tsx
6813
7063
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
6814
7064
 
@@ -6840,6 +7090,8 @@ var util = __webpack_require__(4410);
6840
7090
 
6841
7091
 
6842
7092
 
7093
+
7094
+
6843
7095
  function WaveformShuttleIndicator({
6844
7096
  direction,
6845
7097
  isBlueprintEnabled = false,
@@ -6848,6 +7100,7 @@ function WaveformShuttleIndicator({
6848
7100
  const isReverse = direction === 'reverse';
6849
7101
  const rateLabel = `${rate}x`;
6850
7102
  const label = (0,util/* replacePlaceholders */.Lb)(isReverse ? "Scanning backward at {1}x" : "Scanning forward at {1}x", [String(rate)]);
7103
+ const ShuttleIcon = isReverse ? MediumFilled_.Backward : MediumFilled_.Forward;
6851
7104
  return /*#__PURE__*/external_react_["default"].createElement("div", {
6852
7105
  "aria-label": label,
6853
7106
  className: classnames_default()('bp-WaveformShuttle', {
@@ -6855,16 +7108,22 @@ function WaveformShuttleIndicator({
6855
7108
  }),
6856
7109
  "data-testid": "bp-waveform-shuttle",
6857
7110
  role: "status"
6858
- }, /*#__PURE__*/external_react_["default"].createElement(icons_IconShuttleForward, {
6859
- "aria-hidden": "true",
6860
- className: "bp-WaveformShuttle-glyph"
6861
- }), isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
7111
+ }, isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ShuttleIcon, {
7112
+ "aria-hidden": true,
7113
+ color: tokens_.bpIconIconOnDark,
7114
+ "data-testid": "bp-waveform-shuttle-icon",
7115
+ height: tokens_.Size5,
7116
+ width: tokens_.Size5
7117
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
6862
7118
  as: "span",
6863
7119
  color: "textOnDarkDefault",
6864
7120
  variant: "bodyDefaultSemibold"
6865
- }, rateLabel) : /*#__PURE__*/external_react_["default"].createElement("span", {
7121
+ }, rateLabel)) : /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(icons_IconShuttleForward, {
7122
+ "aria-hidden": "true",
7123
+ className: "bp-WaveformShuttle-glyph"
7124
+ }), /*#__PURE__*/external_react_["default"].createElement("span", {
6866
7125
  className: "bp-WaveformShuttle-rate"
6867
- }, rateLabel));
7126
+ }, rateLabel)));
6868
7127
  }
6869
7128
  ;// external "react-dom"
6870
7129
 
@@ -6872,6 +7131,8 @@ function WaveformShuttleIndicator({
6872
7131
  function t(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class e{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),null==i?void 0:i.once){const i=(...n)=>{this.un(t,i),e(...n)};return this.listeners[t].add(i),()=>this.un(t,i)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var i;null===(i=this.listeners[t])||void 0===i||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach((t=>t(...e)))}}const i={decode:function(e,i){return t(this,void 0,void 0,(function*(){const t=new AudioContext({sampleRate:i});try{return yield t.decodeAudioData(e)}finally{"closed"!==t.state&&(yield t.close().catch((()=>{})))}}))},createBuffer:function(t,e){if(!t||0===t.length)throw new Error("channelData must be a non-empty array");if(e<=0)throw new Error("duration must be greater than 0");if("number"==typeof t[0]&&(t=[t]),!t[0]||0===t[0].length)throw new Error("channelData must contain non-empty channel arrays");!function(t){const e=t[0];if(e.some((t=>t>1||t<-1))){const i=e.length;let n=0;for(let t=0;t<i;t++){const i=Math.abs(e[t]);i>n&&(n=i)}for(const e of t)for(let t=0;t<i;t++)e[t]/=n}}(t);const i=t.map((t=>t instanceof Float32Array?t:Float32Array.from(t)));return{duration:e,length:i[0].length,sampleRate:i[0].length/e,numberOfChannels:i.length,getChannelData:t=>{const e=i[t];if(!e)throw new Error(`Channel ${t} not found`);return e},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function n(t,e){const i=e.xmlns?document.createElementNS(e.xmlns,t):document.createElement(t);for(const[t,s]of Object.entries(e))if("children"===t&&s)for(const[t,e]of Object.entries(s))e instanceof Node?i.appendChild(e):"string"==typeof e?i.appendChild(document.createTextNode(e)):i.appendChild(n(t,e));else"style"===t?Object.assign(i.style,s):"textContent"===t?i.textContent=s:i.setAttribute(t,s.toString());return i}function s(t,e,i){const s=n(t,e||{});return null==i||i.appendChild(s),s}function r(t){return t instanceof HTMLElement||"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE&&"object"==typeof t.style}var o=Object.freeze({__proto__:null,createElement:s,default:s,isHTMLElement:r});const a={fetchBlob:function(e,i,n){return t(this,void 0,void 0,(function*(){var s;const r=yield fetch(e,n);if(r.status>=400)throw new Error(`Failed to fetch ${e}: ${r.status} (${r.statusText})`);return function(e,i,n){t(this,void 0,void 0,(function*(){var t;if(!e.body||!e.headers)return;const s=e.body.getReader(),r=Number(e.headers.get("Content-Length"))||0;let o=0;const a=()=>{s.cancel()};if(n){if(n.aborted)return void s.cancel();n.addEventListener("abort",a,{once:!0})}try{for(;;){const e=yield s.read();if(e.done)break;if(o+=(null===(t=e.value)||void 0===t?void 0:t.length)||0,r>0){const t=Math.round(o/r*100);i(t)}}}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;console.warn("Progress tracking error:",t)}finally{n&&n.removeEventListener("abort",a)}}))}(r.clone(),i,null!==(s=null==n?void 0:n.signal)&&void 0!==s?s:void 0),r.blob()}))}};function l(t){let e=t;const i=new Set;return{get value(){return e},set(t){Object.is(e,t)||(e=t,i.forEach((t=>t(e))))},update(t){this.set(t(e))},subscribe:t=>(i.add(t),()=>i.delete(t))}}function h(t,e){const i=l(t());return e.forEach((e=>e.subscribe((()=>{const e=t();Object.is(i.value,e)||i.set(e)})))),{get value(){return i.value},subscribe:t=>i.subscribe(t)}}function c(t,e){let i;const n=()=>{i&&(i(),i=void 0),i=t()},s=e.map((t=>t.subscribe(n)));return n(),()=>{i&&(i(),i=void 0),s.forEach((t=>t()))}}class u extends e{get isPlayingSignal(){return this._isPlaying}get currentTimeSignal(){return this._currentTime}get durationSignal(){return this._duration}get volumeSignal(){return this._volume}get mutedSignal(){return this._muted}get playbackRateSignal(){return this._playbackRate}get seekingSignal(){return this._seeking}constructor(t){super(),this.isExternalMedia=!1,this._ownBlobUrl=null,this.reactiveMediaEventCleanups=[],t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),this._isPlaying=l(!1),this._currentTime=l(0),this._duration=l(0),this._volume=l(this.media.volume),this._muted=l(this.media.muted),this._playbackRate=l(this.media.playbackRate||1),this._seeking=l(!1),this.setupReactiveMediaEvents(),t.mediaControls&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),null!=t.playbackRate&&this.onMediaEvent("canplay",(()=>{null!=t.playbackRate&&(this.media.playbackRate=t.playbackRate)}),{once:!0})}setupReactiveMediaEvents(){this.reactiveMediaEventCleanups.push(this.onMediaEvent("play",(()=>{this._isPlaying.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("pause",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ended",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("timeupdate",(()=>{this._currentTime.set(this.media.currentTime)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("durationchange",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("loadedmetadata",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeking",(()=>{this._seeking.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeked",(()=>{this._seeking.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("volumechange",(()=>{this._volume.set(this.media.volume),this._muted.set(this.media.muted)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ratechange",(()=>{this._playbackRate.set(this.media.playbackRate)})))}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){this._ownBlobUrl&&(URL.revokeObjectURL(this._ownBlobUrl),this._ownBlobUrl=null)}canPlayType(t){return""!==this.media.canPlayType(t)}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const n=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(n!==t&&(this._ownBlobUrl=n),i&&this.media.removeAttribute("src"),n||t)try{this.media.src=n}catch(e){this.media.src=t}}destroy(){this.reactiveMediaEventCleanups.forEach((t=>t())),this.reactiveMediaEventCleanups=[],this.revokeSrc(),this.unAll(),this.isExternalMedia||(this.media.pause(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.reactiveMediaEventCleanups.forEach((t=>t())),this.reactiveMediaEventCleanups=[],this.media=t,this.setupReactiveMediaEvents()}play(){return t(this,void 0,void 0,(function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;throw t}}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){null!=e&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}}function d({maxTop:t,maxBottom:e,halfHeight:i,vScale:n,barMinHeight:s=0,barAlign:r}){let o=Math.round(t*i*n);let a=o+Math.round(e*i*n)||1;return a<s&&(a=s,r||(o=a/2)),{topHeight:o,totalHeight:a}}function p({barAlign:t,halfHeight:e,topHeight:i,totalHeight:n,canvasHeight:s}){return"top"===t?0:"bottom"===t?s-n:e-i}function m(t,e,i){const n=e-t.left,s=i-t.top;return[n/t.width,s/t.height]}function g(t){return Boolean(t.barWidth||t.barGap||t.barAlign)}function f(t,e){if(!g(e))return t;const i=e.barWidth||.5,n=i+(e.barGap||i/2);return 0===n?t:Math.floor(t/n)*n}function v({scrollLeft:t,totalWidth:e,numCanvases:i}){if(0===e)return[0];const n=t/e,s=Math.floor(n*i);return[s-1,s,s+1]}function b(t){const e=t._cleanup;"function"==typeof e&&e()}function y(t){const e=l({scrollLeft:t.scrollLeft,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth}),i=h((()=>function(t){const{scrollLeft:e,scrollWidth:i,clientWidth:n}=t;if(0===i)return{startX:0,endX:1};const s=e/i,r=(e+n)/i;return{startX:Math.max(0,Math.min(1,s)),endX:Math.max(0,Math.min(1,r))}}(e.value)),[e]),n=h((()=>function(t){return{left:t.scrollLeft,right:t.scrollLeft+t.clientWidth}}(e.value)),[e]),s=()=>{e.set({scrollLeft:t.scrollLeft,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth})};t.addEventListener("scroll",s,{passive:!0});return{scrollData:e,percentages:i,bounds:n,cleanup:()=>{t.removeEventListener("scroll",s),b(e)}}}class C extends e{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragStream=null,this.scrollStream=null,this.containerInlinePadding=0,this.onClickWrapper=t=>{const e=this.wrapper.getBoundingClientRect(),[i,n]=m(e,t.clientX,t.clientY);this.emit("click",i,n)},this.onDblClickWrapper=t=>{const e=this.wrapper.getBoundingClientRect(),[i,n]=m(e,t.clientX,t.clientY);this.emit("dblclick",i,n)},this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[n,s]=this.initHtml();i.appendChild(n),this.container=n,this.scrollContainer=s.querySelector(".scroll"),this.wrapper=s.querySelector(".wrapper"),this.canvasWrapper=s.querySelector(".canvases"),this.progressWrapper=s.querySelector(".progress"),this.cursor=s.querySelector(".cursor"),this.calculateInlinePadding(),e&&s.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if("string"==typeof t?e=document.querySelector(t):r(t)&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){this.wrapper.addEventListener("click",this.onClickWrapper),this.wrapper.addEventListener("dblclick",this.onDblClickWrapper),!0!==this.options.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.scrollStream=y(this.scrollContainer);const t=c((()=>{const{startX:t,endX:e}=this.scrollStream.percentages.value,{left:i,right:n}=this.scrollStream.bounds.value;this.emit("scroll",t,e,i,n)}),[this.scrollStream.percentages,this.scrollStream.bounds]);if(this.subscriptions.push(t),"function"==typeof ResizeObserver){const t=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{t().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;this.calculateInlinePadding(),t===this.lastContainerWidth&&"auto"!==this.options.height||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){if(this.dragStream)return;this.dragStream=function(t,e={}){const{threshold:i=3,mouseButton:n=0,touchDelay:s=100}=e,r=l(null),o=new Map,a=matchMedia("(pointer: coarse)").matches;let h=()=>{};const c=e=>{if(e.button!==n)return;if(o.has(e.pointerId))return;if(o.set(e.pointerId,e),o.size>1)return;const l=e.pointerId;let c=e.clientX,u=e.clientY,d=!1;const p=Date.now(),m=t.getBoundingClientRect(),{left:g,top:f}=m,v=t=>{if(t.pointerId!==l)return;if(t.defaultPrevented||o.size>1)return;if(a&&Date.now()-p<s)return;const e=t.clientX,n=t.clientY,h=e-c,m=n-u;(d||Math.abs(h)>i||Math.abs(m)>i)&&(t.preventDefault(),t.stopPropagation(),d||(r.set({type:"start",x:c-g,y:u-f}),d=!0),r.set({type:"move",x:e-g,y:n-f,deltaX:h,deltaY:m}),c=e,u=n)},b=t=>{if(o.delete(t.pointerId)){if(t.pointerId===l&&d){const e=t.clientX,i=t.clientY;r.set({type:"end",x:e-g,y:i-f})}0===o.size&&h()}},y=t=>{t.relatedTarget&&t.relatedTarget!==document.documentElement||b(t)},C=t=>{d&&(t.stopPropagation(),t.preventDefault())},S=t=>{t.defaultPrevented||o.size>1||d&&t.preventDefault()};document.addEventListener("pointermove",v),document.addEventListener("pointerup",b),document.addEventListener("pointerout",y),document.addEventListener("pointercancel",y),document.addEventListener("touchmove",S,{passive:!1}),document.addEventListener("click",C,{capture:!0}),h=()=>{document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",b),document.removeEventListener("pointerout",y),document.removeEventListener("pointercancel",y),document.removeEventListener("touchmove",S),setTimeout((()=>{document.removeEventListener("click",C,{capture:!0})}),10)}};return t.addEventListener("pointerdown",c),{signal:r,cleanup:()=>{h(),t.removeEventListener("pointerdown",c),o.clear(),b(r)}}}(this.wrapper);const t=c((()=>{const t=this.dragStream.signal.value;if(!t)return;const e=this.wrapper.getBoundingClientRect().width,i=(n=t.x/e)<0?0:n>1?1:n;var n;"start"===t.type?(this.isDragging=!0,this.emit("dragstart",i)):"move"===t.type?this.emit("drag",i):"end"===t.type&&(this.isDragging=!1,this.emit("dragend",i))}),[this.dragStream.signal]);this.subscriptions.push(t)}calculateInlinePadding(){const{paddingLeft:t,paddingRight:e}=getComputedStyle(this.scrollContainer),i=parseFloat(t)+parseFloat(e);this.containerInlinePadding=Number.isNaN(i)?0:i}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&"string"==typeof this.options.cspNonce?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`\n <style${i?` nonce="${i}"`:""}>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;\n pointer-events: none;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases" part="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[t,e]}setOptions(t){var e;if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}!0===t.dragToSeek||"object"==typeof this.options.dragToSeek?this.initDrag():(null===(e=this.dragStream)||void 0===e||e.cleanup(),this.dragStream=null),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth-this.containerInlinePadding}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t;this.wrapper.removeEventListener("click",this.onClickWrapper),this.wrapper.removeEventListener("dblclick",this.onDblClickWrapper),this.timeouts.forEach((t=>t())),this.timeouts=[],this.subscriptions.forEach((t=>t())),this.container.remove(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),null===(t=this.unsubscribeOnScroll)||void 0===t||t.forEach((t=>t())),this.unsubscribeOnScroll=[],this.dragStream&&(this.dragStream.cleanup(),this.dragStream=null),this.scrollStream&&(this.scrollStream.cleanup(),this.scrollStream=null)}createDelay(t=10){let e,i;const n=()=>{e&&(clearTimeout(e),e=void 0),i&&(i(),i=void 0)};return this.timeouts.push(n),()=>new Promise(((s,r)=>{n(),i=r,e=setTimeout((()=>{e=void 0,i=void 0,s()}),t)}))}getHeight(t,e){var i;const n=(null===(i=this.audioData)||void 0===i?void 0:i.numberOfChannels)||1;return function({optionsHeight:t,optionsSplitChannels:e,parentHeight:i,numberOfChannels:n,defaultHeight:s=128}){if(null==t)return s;const r=Number(t);if(!isNaN(r))return r;if("auto"===t){const t=i||s;return(null==e?void 0:e.every((t=>!t.overlay)))?t/n:t}return s}({optionsHeight:t,optionsSplitChannels:e,parentHeight:this.parent.clientHeight,numberOfChannels:n,defaultHeight:128})}convertColorValues(t,e){return function(t,e,i){if(!Array.isArray(t))return t||"";if(0===t.length)return"#999";if(t.length<2)return t[0]||"";const n=document.createElement("canvas"),s=n.getContext("2d");if(!s)return t[0]||"";const r=i||n.height*e,o=s.createLinearGradient(0,0,0,r),a=1/(t.length-1);return t.forEach(((t,e)=>{o.addColorStop(e*a,t)})),o}(t,this.getPixelRatio(),null==e?void 0:e.canvas.height)}getPixelRatio(){return t=window.devicePixelRatio,Math.max(1,t||1);// removed by dead control flow
6873
7132
  var t; }renderBarWaveform(t,e,i,n){const{width:s,height:r}=i.canvas,{halfHeight:o,barWidth:a,barRadius:l,barIndexScale:h,barSpacing:c,barMinHeight:u}=function({width:t,height:e,length:i,options:n,pixelRatio:s}){const r=e/2,o=n.barWidth?n.barWidth*s:1,a=n.barGap?n.barGap*s:n.barWidth?o/2:0,l=o+a||1;return{halfHeight:r,barWidth:o,barGap:a,barRadius:n.barRadius||0,barMinHeight:n.barMinHeight?n.barMinHeight*s:0,barIndexScale:i>0?t/l/i:0,barSpacing:l}}({width:s,height:r,length:(t[0]||[]).length,options:e,pixelRatio:this.getPixelRatio()}),m=function({channelData:t,barIndexScale:e,barSpacing:i,barWidth:n,halfHeight:s,vScale:r,canvasHeight:o,barAlign:a,barMinHeight:l}){const h=t[0]||[],c=t[1]||h,u=h.length,m=[];let g=0,f=0,v=0;for(let t=0;t<=u;t++){const u=Math.round(t*e);if(u>g){const{topHeight:t,totalHeight:e}=d({maxTop:f,maxBottom:v,halfHeight:s,vScale:r,barMinHeight:l,barAlign:a}),h=p({barAlign:a,halfHeight:s,topHeight:t,totalHeight:e,canvasHeight:o});m.push({x:g*i,y:h,width:n,height:e}),g=u,f=0,v=0}const b=Math.abs(h[t]||0),y=Math.abs(c[t]||0);b>f&&(f=b),y>v&&(v=y)}return m}({channelData:t,barIndexScale:h,barSpacing:c,barWidth:a,halfHeight:o,vScale:n,canvasHeight:r,barAlign:e.barAlign,barMinHeight:u});i.beginPath();for(const t of m)l&&"roundRect"in i?i.roundRect(t.x,t.y,t.width,t.height,l):i.rect(t.x,t.y,t.width,t.height);i.fill(),i.closePath()}renderLineWaveform(t,e,i,n){const{width:s,height:r}=i.canvas,o=function({channelData:t,width:e,height:i,vScale:n}){const s=i/2,r=t[0]||[];return[r,t[1]||r].map(((t,i)=>{const r=t.length,o=r?e/r:0,a=s,l=0===i?-1:1,h=[{x:0,y:a}];let c=0,u=0;for(let e=0;e<=r;e++){const i=Math.round(e*o);if(i>c){const t=a+(Math.round(u*s*n)||1)*l;h.push({x:c,y:t}),c=i,u=0}const r=Math.abs(t[e]||0);r>u&&(u=r)}return h.push({x:c,y:a}),h}))}({channelData:t,width:s,height:r,vScale:n});i.beginPath();for(const t of o)if(t.length){i.moveTo(t[0].x,t[0].y);for(let e=1;e<t.length;e++){const n=t[e];i.lineTo(n.x,n.y)}}i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor,i),e.renderFunction)return void e.renderFunction(t,i);const n=function({channelData:t,barHeight:e,normalize:i,maxPeak:n}){var s;const r=e||1;if(!i)return r;const o=t[0];if(!o||0===o.length)return r;let a=null!=n?n:0;if(!n)for(let t=0;t<o.length;t++){const e=null!==(s=o[t])&&void 0!==s?s:0,i=Math.abs(e);i>a&&(a=i)}return a?r/a:r}({channelData:t,barHeight:e.barHeight,normalize:e.normalize,maxPeak:e.maxPeak});g(e)?this.renderBarWaveform(t,e,i,n):this.renderLineWaveform(t,e,i,n)}renderSingleCanvas(t,e,i,n,s,r,o){const a=this.getPixelRatio(),l=document.createElement("canvas");l.width=Math.round(i*a),l.height=Math.round(n*a),l.style.width=`${i}px`,l.style.height=`${n}px`,l.style.left=`${Math.round(s)}px`,r.appendChild(l);const h=l.getContext("2d");if(e.renderFunction?(h.fillStyle=this.convertColorValues(e.waveColor,h),e.renderFunction(t,h)):this.renderWaveform(t,e,h),l.width>0&&l.height>0){const t=l.cloneNode(),i=t.getContext("2d");i.drawImage(l,0,0),i.globalCompositeOperation="source-in",i.fillStyle=this.convertColorValues(e.progressColor,i),i.fillRect(0,0,l.width,l.height),o.appendChild(t)}}renderMultiCanvas(t,e,i,n,s,r){const o=this.getPixelRatio(),{clientWidth:a}=this.scrollContainer,l=i/o,h=function({clientWidth:t,totalWidth:e,options:i}){return f(Math.min(8e3,t,e),i)}({clientWidth:a,totalWidth:l,options:e});let c={};if(0===h)return;const u=i=>{if(i<0||i>=d)return;if(c[i])return;c[i]=!0;const o=i*h;let a=Math.min(l-o,h);if(a=f(a,e),a<=0)return;const u=function({channelData:t,offset:e,clampedWidth:i,totalWidth:n}){return t.map((t=>{const s=Math.floor(e/n*t.length),r=Math.floor((e+i)/n*t.length);return t.slice(s,r)}))}({channelData:t,offset:o,clampedWidth:a,totalWidth:l});this.renderSingleCanvas(u,e,a,n,o,s,r)},d=Math.ceil(l/h);if(!this.isScrollable){for(let t=0;t<d;t++)u(t);return}if(v({scrollLeft:this.scrollContainer.scrollLeft,totalWidth:l,numCanvases:d}).forEach((t=>u(t))),d>1){const t=this.on("scroll",(()=>{const{scrollLeft:t}=this.scrollContainer;Object.keys(c).length>10&&(s.innerHTML="",r.innerHTML="",c={}),v({scrollLeft:t,totalWidth:l,numCanvases:d}).forEach((t=>u(t)))}));this.unsubscribeOnScroll.push(t)}}renderChannel(t,e,i,n){var{overlay:s}=e,r=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]])}return i}(e,["overlay"]);const o=document.createElement("div"),a=this.getHeight(r.height,r.splitChannels);o.style.height=`${a}px`,s&&n>0&&(o.style.marginTop=`-${a}px`),this.canvasWrapper.style.minHeight=`${a}px`,this.canvasWrapper.appendChild(o);const l=o.cloneNode();this.progressWrapper.appendChild(l),this.renderMultiCanvas(t,r,i,a,o,l)}render(e){return t(this,void 0,void 0,(function*(){var t;this.timeouts.forEach((t=>t())),this.timeouts=[],this.unsubscribeOnScroll.forEach((t=>t())),this.unsubscribeOnScroll=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const i=this.getPixelRatio(),n=this.scrollContainer.clientWidth-this.containerInlinePadding,{scrollWidth:s,isScrollable:r,useParentWidth:o,width:a}=function({duration:t,minPxPerSec:e=0,parentWidth:i,fillParent:n,pixelRatio:s}){const r=Math.ceil(t*e),o=r>i,a=Boolean(n&&!o);return{scrollWidth:r,isScrollable:o,useParentWidth:a,width:(a?i:r)*s}}({duration:e.duration,minPxPerSec:this.options.minPxPerSec||0,parentWidth:n,fillParent:this.options.fillParent,pixelRatio:i});if(this.isScrollable=r,this.wrapper.style.width=o?"100%":`${s}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=e,this.emit("render"),this.options.splitChannels)for(let i=0;i<e.numberOfChannels;i++){const n=Object.assign(Object.assign({},this.options),null===(t=this.options.splitChannels)||void 0===t?void 0:t[i]);this.renderChannel([e.getChannelData(i)],n,a,i)}else{const t=[e.getChannelData(0)];e.numberOfChannels>1&&t.push(e.getChannelData(1)),this.renderChannel(t,this.options,a,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){if(this.unsubscribeOnScroll.forEach((t=>t())),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),!this.isScrollable&&this.scrollContainer.scrollLeft)this.scrollContainer.scrollLeft=0;else if(this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:t}=this.progressWrapper.getBoundingClientRect(),i=function(t){const e=2*t;return(e<0?Math.floor(e):Math.ceil(e))/2}(t-e);this.scrollContainer.scrollLeft+=i}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){var i;const{scrollLeft:n,scrollWidth:s,clientWidth:r}=this.scrollContainer,o=t*s,a=n,l=n+r,h=r/2;if(this.isDragging){const t=30;o+t>l?this.scrollContainer.scrollLeft+=t:o-t<a&&(this.scrollContainer.scrollLeft-=t)}else{(o<a||o>l)&&(this.scrollContainer.scrollLeft=o-(this.options.autoCenter?h:0));const t=o-n-h;if(e&&this.options.autoCenter&&t>0){const e=null===(i=this.audioData)||void 0===i?void 0:i.duration;if(void 0===e||e<=0)return void(this.scrollContainer.scrollLeft+=t);const n=s/e;this.scrollContainer.scrollLeft+=n<=600?Math.min(t,10):t}}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.audioData&&this.audioData.duration>0&&this.scrollIntoView(t,e)}exportImage(e,i,n){return t(this,void 0,void 0,(function*(){const t=this.canvasWrapper.querySelectorAll("canvas");if(!t.length)throw new Error("No waveform data");if("dataURL"===n){const n=Array.from(t).map((t=>t.toDataURL(e,i)));return Promise.resolve(n)}return Promise.all(Array.from(t).map((t=>new Promise(((n,s)=>{t.toBlob((t=>{t?n(t):s(new Error("Could not export image"))}),e,i)})))))}))}}class S extends e{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const t=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(t))};t()}stop(){this.isRunning=!1,null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop(),this.unAll()}}class E extends e{constructor(t){super(),this.bufferNode=null,this.playStartTime=0,this.playbackPosition=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this._destroyed=!1,function(){const t=globalThis.navigator;if(null==t?void 0:t.audioSession)try{t.audioSession.type="playback"}catch(t){console.warn("Setting navigator.audioSession.type failed:",t)}}(),this.audioContext=t||new AudioContext,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return t(this,void 0,void 0,(function*(){}))}remove(){this.destroy()}destroy(){if(!this._destroyed){if(this._destroyed=!0,this.currentSrc="",this.bufferNode){this.bufferNode.onended=null;try{this.bufferNode.stop()}catch(t){}this.bufferNode.disconnect(),this.bufferNode=null}this.gainNode.disconnect(),"function"==typeof this.audioContext.close&&Promise.resolve(this.audioContext.close.call(this.audioContext)).catch((()=>{})),this.buffer=null,this.unAll()}}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then((e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()})).then((e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e))).then((e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})).catch((t=>{console.error("WebAudioPlayer load error:",t)}))}_play(){if(!this.paused)return;this.paused=!1,this.bufferNode&&(this.bufferNode.onended=null,this.bufferNode.disconnect()),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playbackPosition;(t>=this.duration||t<0)&&(t=0,this.playbackPosition=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{!this.paused&&this.duration-this.currentTime<.01&&(this.pause(),this.emit("ended"))}}_pause(){if(this.paused=!0,this.bufferNode){this.bufferNode.onended=null;try{this.bufferNode.stop()}catch(t){}}this.playbackPosition+=(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}play(){return t(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=(t-this.currentTime)/this._playbackRate,i=this.bufferNode;null==i||i.stop(this.audioContext.currentTime+e),null==i||i.addEventListener("ended",(()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause(),this.playbackPosition=Math.min(t,this.duration),this.emit("timeupdate"))}),{once:!0})}setSinkId(e){return t(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(e)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){const e=!this.paused;e&&this._pause(),this._playbackRate=t,e&&this._play(),this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return this.paused?this.playbackPosition:this.playbackPosition+(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playbackPosition=t,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return null!==(t=this._duration)&&void 0!==t?t:(null===(e=this.buffer)||void 0===e?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}removeAttribute(t){switch(t){case"src":this.src="";break;case"playbackRate":this.playbackRate=0;break;case"currentTime":this.currentTime=0;break;case"duration":this.duration=0;break;case"volume":this.volume=0;break;case"muted":this.muted=!1}}}const P={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class w extends u{static create(t){return new w(t)}getState(){return this.wavesurferState}getRenderer(){return this.renderer}constructor(t){const e=t.media||("WebAudio"===t.backend?new E:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this._isDestroyed=!1,this._loadVersion=0,this.reactiveCleanups=[],this.options=Object.assign({},P,t);const{state:i,actions:n}=function(t){var e,i,n,s,r,o;const a=null!==(e=null==t?void 0:t.currentTime)&&void 0!==e?e:l(0),c=null!==(i=null==t?void 0:t.duration)&&void 0!==i?i:l(0),u=null!==(n=null==t?void 0:t.isPlaying)&&void 0!==n?n:l(!1),d=null!==(s=null==t?void 0:t.isSeeking)&&void 0!==s?s:l(!1),p=null!==(r=null==t?void 0:t.volume)&&void 0!==r?r:l(1),m=null!==(o=null==t?void 0:t.playbackRate)&&void 0!==o?o:l(1),g=l(null),f=l(null),v=l(""),b=l(0),y=l(0),C=h((()=>!u.value),[u]),S=h((()=>null!==g.value),[g]),E=h((()=>S.value&&c.value>0),[S,c]),P=h((()=>a.value),[a]),w=h((()=>c.value>0?a.value/c.value:0),[a,c]);return{state:{currentTime:a,duration:c,isPlaying:u,isPaused:C,isSeeking:d,volume:p,playbackRate:m,audioBuffer:g,peaks:f,url:v,zoom:b,scrollPosition:y,canPlay:S,isReady:E,progress:P,progressPercent:w},actions:{setCurrentTime:t=>{const e=Math.max(0,Math.min(c.value||1/0,t));a.set(e)},setDuration:t=>{c.set(Math.max(0,t))},setPlaying:t=>{u.set(t)},setSeeking:t=>{d.set(t)},setVolume:t=>{const e=Math.max(0,Math.min(1,t));p.set(e)},setPlaybackRate:t=>{const e=Math.max(.1,Math.min(16,t));m.set(e)},setAudioBuffer:t=>{g.set(t),t&&c.set(t.duration)},setPeaks:t=>{f.set(t)},setUrl:t=>{v.set(t)},setZoom:t=>{b.set(Math.max(0,t))},setScrollPosition:t=>{y.set(Math.max(0,t))}}}}({isPlaying:this.isPlayingSignal,currentTime:this.currentTimeSignal,duration:this.durationSignal,volume:this.volumeSignal,playbackRate:this.playbackRateSignal,isSeeking:this.seekingSignal});this.wavesurferState=i,this.wavesurferActions=n,this.timer=new S;const s=e?void 0:this.getMediaElement();this.renderer=new C(this.options,s),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initReactiveState(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");const{peaks:t,duration:e}=this.options;(r||t&&e)&&this.load(r,t,e).catch((()=>{}))}))}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const t=this.updateProgress();if(this.emit("timeupdate",t),this.emit("audioprocess",t),null!=this.stopAtPosition&&this.isPlaying()&&t>=this.stopAtPosition){const t=this.stopAtPosition;this.pause(),this.setTime(t)}}})))}initReactiveState(){this.reactiveCleanups.push(function(t,e){const i=[];i.push(c((()=>{const i=t.isPlaying.value;e.emit(i?"play":"pause")}),[t.isPlaying])),i.push(c((()=>{const i=t.currentTime.value;e.emit("timeupdate",i),t.isPlaying.value&&e.emit("audioprocess",i)}),[t.currentTime,t.isPlaying])),i.push(c((()=>{t.isSeeking.value&&e.emit("seeking",t.currentTime.value)}),[t.isSeeking,t.currentTime]));let n=!1;i.push(c((()=>{t.isReady.value&&!n&&(n=!0,e.emit("ready",t.duration.value))}),[t.isReady,t.duration])),i.push(c((()=>{null===t.audioBuffer.value&&(n=!1)}),[t.audioBuffer]));let s=!1;return i.push(c((()=>{const i=t.isPlaying.value,n=t.currentTime.value,r=t.duration.value,o=r>0&&n>=r;s&&!i&&o&&e.emit("finish"),s=i&&o}),[t.isPlaying,t.currentTime,t.duration])),i.push(c((()=>{const i=t.zoom.value;i>0&&e.emit("zoom",i)}),[t.zoom])),()=>{i.forEach((t=>t()))}}(this.wavesurferState,{emit:this.emit.bind(this)}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const t=this.updateProgress();this.emit("timeupdate",t)})),this.onMediaEvent("play",(()=>{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("emptied",(()=>{this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("ended",(()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})),this.onMediaEvent("error",(()=>{var t;this.emit("error",null!==(t=this.getMediaElement().error)&&void 0!==t?t:new Error("Media error")),this.stopAtPosition=null})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))})),this.renderer.on("dblclick",((t,e)=>{this.emit("dblclick",t,e)})),this.renderer.on("scroll",((t,e,i,n)=>{const s=this.getDuration();this.emit("scroll",t*s,e*s,i,n)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(t=>{this.emit("dragstart",t)})),this.renderer.on("dragend",(t=>{this.emit("dragend",t)})),this.renderer.on("resize",(()=>{this.emit("resize")})));{let t;const e=this.renderer.on("drag",(e=>{var i;if(!this.options.interact)return;this.renderer.renderProgress(e),clearTimeout(t);let n=0;const s=this.options.dragToSeek;this.isPlaying()?n=0:!0===s?n=200:s&&"object"==typeof s&&(n=null!==(i=s.debounceTime)&&void 0!==i?i:200),t=setTimeout((()=>{this.seekTo(e)}),n),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}));this.subscriptions.push((()=>{clearTimeout(t),e()}))}}initPlugins(){var t;(null===(t=this.options.plugins)||void 0===t?void 0:t.length)&&this.options.plugins.forEach((t=>{this.registerPlugin(t)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((t=>t())),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=i.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=i.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),null!=t.mediaControls&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",(()=>{this.plugins=this.plugins.filter((e=>e!==t)),this.subscriptions=this.subscriptions.filter((t=>t!==e))}));return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter((e=>e!==t)),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(e,n,s,r){return t(this,void 0,void 0,(function*(){var t;const o=++this._loadVersion;if(this._isDestroyed=!1,this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null,!n&&!s){const t=this.options.fetchParams||{};window.AbortController&&!t.signal&&(this.abortController=new AbortController,t.signal=this.abortController.signal);const i=t=>this.emit("loading",t);if(n=yield a.fetchBlob(e,i,t),this._isDestroyed||o!==this._loadVersion)return;const s=this.options.blobMimeType;s&&(n=new Blob([n],{type:s}))}if(this._isDestroyed||o!==this._loadVersion)return;this.setSrc(e,n);const l=yield new Promise((t=>{const e=r||this.getDuration();e?t(e):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>t(this.getDuration())),{once:!0}))}));if(!this._isDestroyed&&o===this._loadVersion){if(!e&&!n){const t=this.getMediaElement();t instanceof E&&(t.duration=l)}if(s)this.decodedData=i.createBuffer(s,l||0);else if(n){const t=yield n.arrayBuffer();if(this._isDestroyed||o!==this._loadVersion)return;this.decodedData=yield i.decode(t,this.options.sampleRate)}this._isDestroyed||o!==this._loadVersion||(this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration()))}}))}load(e,i,n){return t(this,void 0,void 0,(function*(){try{return yield this.loadAudio(e,void 0,i,n)}catch(t){throw this.emit("error",t),t}}))}loadBlob(e,i,n){return t(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",e,i,n)}catch(t){throw this.emit("error",t),t}}))}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const n=Math.min(t,this.decodedData.numberOfChannels),s=[];for(let t=0;t<n;t++){const n=this.decodedData.getChannelData(t),r=[],o=n.length/e;for(let t=0;t<e;t++){const e=n.slice(Math.floor(t*o),Math.ceil((t+1)*o));let s=0;for(let t=0;t<e.length;t++){const i=e[t];Math.abs(i)>Math.abs(s)&&(s=i)}r.push(Math.round(s*i)/i)}s.push(r)}return s}getDuration(){let t=super.getDuration()||0;return 0!==t&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(e,i){const n=Object.create(null,{play:{get:()=>super.play}});return t(this,void 0,void 0,(function*(){null!=e&&this.setTime(e);const t=yield n.play.call(this);return null!=i&&(this.media instanceof E?this.media.stopAt(i):this.stopAtPosition=i),t}))}playPause(){return t(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return t(this,arguments,void 0,(function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)}))}destroy(){var t;this._isDestroyed=!0,this.emit("destroy"),null===(t=this.abortController)||void 0===t||t.abort(),this.plugins.forEach((t=>t.destroy())),this.subscriptions.forEach((t=>t())),this.unsubscribePlayerEvents(),this.reactiveCleanups.forEach((t=>t())),this.reactiveCleanups=[],this.timer.destroy(),this.renderer.destroy(),super.destroy()}}w.BasePlugin=class extends e{constructor(t){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=t}onInit(){}_init(t){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=t,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((t=>t())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},w.dom=o;
6874
7133
 
7134
+ // EXTERNAL MODULE: external "@box/blueprint-web-assets/icons/Medium"
7135
+ var Medium_ = __webpack_require__(9747);
6875
7136
  ;// ./src/lib/viewers/media/waveform/colors.ts
6876
7137
  /**
6877
7138
  * Figma Audio Player waveform tokens as opaque fills.
@@ -7539,6 +7800,9 @@ var IconExit24 = __webpack_require__(8950);
7539
7800
 
7540
7801
 
7541
7802
 
7803
+
7804
+
7805
+
7542
7806
  function stopRangeEvent(event) {
7543
7807
  event.stopPropagation();
7544
7808
  }
@@ -7586,6 +7850,7 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
7586
7850
  getPlayheadSec,
7587
7851
  isSwiping = false,
7588
7852
  interactive = true,
7853
+ isBlueprintEnabled = false,
7589
7854
  isHighlighted = false,
7590
7855
  keepHighlight = true,
7591
7856
  onDragChange,
@@ -7858,7 +8123,45 @@ const WaveformRangeSelection = /*#__PURE__*/(0,external_react_.forwardRef)(funct
7858
8123
  className: "bp-WaveformRange-commentIcon"
7859
8124
  }), "Comment");
7860
8125
  let commentButton = null;
7861
- if (showClearOnly && onRangeClear) {
8126
+ if (isBlueprintEnabled && (showCommentButton || showClearControl)) {
8127
+ commentButton = /*#__PURE__*/external_react_["default"].createElement("div", {
8128
+ ref: commentPillRef,
8129
+ className: "bp-WaveformRange-comment bp-WaveformRange-comment--blueprint",
8130
+ "data-testid": "bp-waveform-range-comment-toolbar",
8131
+ role: "presentation",
8132
+ onKeyDown: utils/* stopToolbarKeyPropagation */.B9,
8133
+ onPointerDown: stopRangeEvent,
8134
+ onPointerUp: stopRangeEvent
8135
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, {
8136
+ "aria-label": "Comment"
8137
+ }, showCommentButton && onDragCreate && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
8138
+ "data-resin-target": "waveformRangeComment",
8139
+ "data-target-id": "Waveform-commentOnRange",
8140
+ "data-testid": "bp-waveform-range-comment",
8141
+ onClick: event => {
8142
+ stopRangeEvent(event);
8143
+ onDragCreate();
8144
+ }
8145
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
8146
+ icon: Medium_.Comment
8147
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
8148
+ as: "span"
8149
+ }, "Comment")), showCommentButton && showClearControl && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), showClearControl && onRangeClear && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
8150
+ content: "Clear"
8151
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
8152
+ "aria-label": "Clear",
8153
+ "data-resin-target": "waveformRangeClear",
8154
+ "data-target-id": "Waveform-clearRange",
8155
+ "data-testid": "bp-waveform-range-clear",
8156
+ onClick: event => {
8157
+ stopRangeEvent(event);
8158
+ focusMediaContainer(event);
8159
+ onRangeClear();
8160
+ }
8161
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
8162
+ icon: Medium_.XMark
8163
+ })))));
8164
+ } else if (showClearOnly && onRangeClear) {
7862
8165
  commentButton = /*#__PURE__*/external_react_["default"].createElement("button", {
7863
8166
  ref: commentButtonRef,
7864
8167
  "aria-label": "Clear",
@@ -7991,6 +8294,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
7991
8294
 
7992
8295
 
7993
8296
 
8297
+
8298
+
7994
8299
  function recordGestureSession(lastAtRef, target, record) {
7995
8300
  const currentTime = Date.now();
7996
8301
  if (currentTime - lastAtRef.current > constants/* WAVEFORM_RESIN_GESTURE_GAP_MS */.Uz) {
@@ -9397,7 +9702,28 @@ function WaveformView({
9397
9702
  onPointerDown: onPlayheadPointerDown,
9398
9703
  onPointerMove: onPlayheadPointerMove,
9399
9704
  onPointerUp: onPlayheadPointerUp
9400
- }, showPlayheadComment && /*#__PURE__*/external_react_["default"].createElement("button", {
9705
+ }, showPlayheadComment && isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement("div", {
9706
+ className: "bp-WaveformRange-comment bp-WaveformRange-comment--blueprint bp-WaveformView-playheadComment",
9707
+ "data-testid": "bp-waveform-playhead-comment-toolbar",
9708
+ role: "presentation",
9709
+ onKeyDown: utils/* stopToolbarKeyPropagation */.B9,
9710
+ onPointerDown: event => event.stopPropagation(),
9711
+ onPointerUp: event => event.stopPropagation()
9712
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, {
9713
+ "aria-label": "Comment"
9714
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
9715
+ "data-resin-target": "waveformPlayheadComment",
9716
+ "data-target-id": "Waveform-commentAtTime",
9717
+ "data-testid": "bp-waveform-playhead-comment",
9718
+ onClick: event => {
9719
+ event.stopPropagation();
9720
+ onPlayheadComment?.();
9721
+ }
9722
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
9723
+ icon: Medium_.Comment
9724
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
9725
+ as: "span"
9726
+ }, "Comment")))), showPlayheadComment && !isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement("button", {
9401
9727
  className: "bp-WaveformRange-comment bp-WaveformView-playheadComment",
9402
9728
  "data-resin-target": "waveformPlayheadComment",
9403
9729
  "data-target-id": "Waveform-commentAtTime",
@@ -9418,6 +9744,7 @@ function WaveformView({
9418
9744
  durationSec: durationSec,
9419
9745
  getPlayheadSec: getPlayheadSec,
9420
9746
  interactive: interactive && !isOverlayReadOnly,
9747
+ isBlueprintEnabled: isBlueprintEnabled,
9421
9748
  isHighlighted: isRangeDragging || isRangeHovered,
9422
9749
  isSwiping: isTape && scrubPreviewTimeSec != null,
9423
9750
  keepHighlight: true,
@@ -9523,6 +9850,8 @@ var SliderControl = __webpack_require__(4937);
9523
9850
 
9524
9851
 
9525
9852
 
9853
+
9854
+
9526
9855
  function WaveformZoomControl({
9527
9856
  isBlueprintEnabled = false,
9528
9857
  isRevealed = false,
@@ -9582,6 +9911,11 @@ function WaveformZoomControl({
9582
9911
  handleStep(constants/* WAVEFORM_ZOOM_BUTTON_STEP */.QD);
9583
9912
  }
9584
9913
  }, [handleStep, isAtMaxZoom]);
9914
+ const handleZoomOutClick = (0,external_react_.useCallback)(() => {
9915
+ if (!isAtMinZoom) {
9916
+ handleStep(-constants/* WAVEFORM_ZOOM_BUTTON_STEP */.QD);
9917
+ }
9918
+ }, [handleStep, isAtMinZoom]);
9585
9919
  return /*#__PURE__*/external_react_["default"].createElement("div", {
9586
9920
  ref: zoomControlElRef,
9587
9921
  "aria-label": "Zoom",
@@ -9628,7 +9962,22 @@ function WaveformZoomControl({
9628
9962
  "aria-hidden": "true",
9629
9963
  className: "bp-WaveformZoomControl-divider",
9630
9964
  "data-testid": "bp-waveform-zoom-divider"
9631
- })), /*#__PURE__*/external_react_["default"].createElement(MediaToggle/* default */.A, {
9965
+ })), isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
9966
+ content: "Zoom in"
9967
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
9968
+ "aria-disabled": isOpen && isAtMaxZoom,
9969
+ "aria-label": "Zoom in",
9970
+ className: "bp-WaveformZoomControl-iconButton",
9971
+ "data-resin-target": "waveformZoomIn",
9972
+ "data-target-id": "WaveformZoomControl-zoomIn",
9973
+ "data-testid": "bp-waveform-zoom-in",
9974
+ icon: Medium_.ZoomIn,
9975
+ onClick: handleZoomInClick,
9976
+ onKeyDown: utils/* stopActivationKeyPropagation */.My,
9977
+ onPointerDown: handleZoomInPointerDown,
9978
+ size: "large",
9979
+ variant: "on-dark"
9980
+ })) : /*#__PURE__*/external_react_["default"].createElement(MediaToggle/* default */.A, {
9632
9981
  "aria-disabled": isOpen && isAtMaxZoom,
9633
9982
  className: "bp-WaveformZoomControl-button",
9634
9983
  "data-resin-target": "waveformZoomIn",
@@ -9641,16 +9990,27 @@ function WaveformZoomControl({
9641
9990
  className: classnames_default()('bp-WaveformZoomControl-flyout', {
9642
9991
  'bp-is-open': isOpen
9643
9992
  })
9644
- }, /*#__PURE__*/external_react_["default"].createElement(MediaToggle/* default */.A, {
9993
+ }, isBlueprintEnabled ? /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
9994
+ content: "Zoom out"
9995
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
9996
+ "aria-disabled": isAtMinZoom,
9997
+ "aria-label": "Zoom out",
9998
+ className: "bp-WaveformZoomControl-iconButton",
9999
+ "data-resin-target": "waveformZoomOut",
10000
+ "data-target-id": "WaveformZoomControl-zoomOut",
10001
+ "data-testid": "bp-waveform-zoom-out",
10002
+ icon: Medium_.ZoomOut,
10003
+ onClick: handleZoomOutClick,
10004
+ onKeyDown: utils/* stopActivationKeyPropagation */.My,
10005
+ size: "large",
10006
+ tabIndex: isOpen ? 0 : -1,
10007
+ variant: "on-dark"
10008
+ })) : /*#__PURE__*/external_react_["default"].createElement(MediaToggle/* default */.A, {
9645
10009
  "aria-disabled": isAtMinZoom,
9646
10010
  className: "bp-WaveformZoomControl-button",
9647
10011
  "data-resin-target": "waveformZoomOut",
9648
10012
  "data-testid": "bp-waveform-zoom-out",
9649
- onClick: () => {
9650
- if (!isAtMinZoom) {
9651
- handleStep(-constants/* WAVEFORM_ZOOM_BUTTON_STEP */.QD);
9652
- }
9653
- },
10013
+ onClick: handleZoomOutClick,
9654
10014
  tabIndex: isOpen ? 0 : -1,
9655
10015
  title: "Zoom out"
9656
10016
  }, /*#__PURE__*/external_react_["default"].createElement(icons_IconZoomOut24, null)), /*#__PURE__*/external_react_["default"].createElement(SliderControl/* default */.A, {
@@ -9691,6 +10051,9 @@ function WaveformZoomControl({
9691
10051
 
9692
10052
 
9693
10053
 
10054
+
10055
+
10056
+
9694
10057
 
9695
10058
  const PLACEHOLDER_PEAKS = placeholderPeaks();
9696
10059
 
@@ -9911,7 +10274,21 @@ function MP3ControlsV2({
9911
10274
  maxZoom: maxZoom,
9912
10275
  onZoomChange: handleWaveformZoom,
9913
10276
  zoomLevel: zoomLevel
9914
- })), showPlayOverlay && /*#__PURE__*/external_react_["default"].createElement("button", {
10277
+ })), showPlayOverlay && isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
10278
+ content: "Play"
10279
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
10280
+ "aria-label": "Play",
10281
+ className: "bp-MP3ControlsV2-playOverlayButton",
10282
+ "data-resin-target": "playOverlay",
10283
+ "data-target-id": "MP3ControlsV2-play",
10284
+ "data-testid": "bp-MP3ControlsV2-play-overlay",
10285
+ icon: PlayOverlayIcon/* default */.A,
10286
+ onClick: handlePlayOverlayClick,
10287
+ onKeyDown: utils/* stopActivationKeyPropagation */.My,
10288
+ onMouseDown: event => event.preventDefault(),
10289
+ size: "large",
10290
+ variant: "on-dark"
10291
+ })), showPlayOverlay && !isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement("button", {
9915
10292
  className: "bp-MP3ControlsV2-playOverlay"
9916
10293
  // Static SVG from the icons module, same asset video uses for the overlay.
9917
10294
  // eslint-disable-next-line react/no-danger
@@ -9943,7 +10320,8 @@ function MP3ControlsV2({
9943
10320
  className: "bp-MP3ControlsV2-divider"
9944
10321
  }), /*#__PURE__*/external_react_["default"].createElement(TimestampControl/* default */.Ay, {
9945
10322
  currentTime: currentTime,
9946
- durationTime: durationValue
10323
+ durationTime: durationValue,
10324
+ isBlueprintEnabled: isBlueprintEnabled
9947
10325
  })), /*#__PURE__*/external_react_["default"].createElement("div", {
9948
10326
  className: "bp-MP3ControlsV2-group"
9949
10327
  }, /*#__PURE__*/external_react_["default"].createElement(VolumeControls/* default */.Ay, {
@@ -18565,7 +18943,7 @@ var x = (y) => {
18565
18943
  var x = {}; __webpack_require__.d(x, y); return x
18566
18944
  }
18567
18945
  var y = (x) => (() => (x))
18568
- module.exports = x({ ["BlueprintProvider"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.BlueprintProvider), ["Breadcrumb"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Breadcrumb), ["IconButton"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.IconButton), ["IconToggleButton"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.IconToggleButton), ["LoadingIndicator"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.LoadingIndicator), ["SearchInput"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.SearchInput), ["SelectMenu"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.SelectMenu), ["Text"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Text), ["Toolbar"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Toolbar), ["Tooltip"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Tooltip), ["TooltipProvider"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.TooltipProvider), ["useNoopTreatment"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.useNoopTreatment) });
18946
+ module.exports = x({ ["BlueprintProvider"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.BlueprintProvider), ["Breadcrumb"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Breadcrumb), ["DropdownMenu"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.DropdownMenu), ["IconButton"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.IconButton), ["IconToggleButton"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.IconToggleButton), ["LoadingIndicator"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.LoadingIndicator), ["SearchInput"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.SearchInput), ["SelectMenu"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.SelectMenu), ["Text"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Text), ["Toolbar"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Toolbar), ["Tooltip"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.Tooltip), ["TooltipProvider"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.TooltipProvider), ["useNoopTreatment"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_e1e285a9__.useNoopTreatment) });
18569
18947
 
18570
18948
  /***/ },
18571
18949
 
@@ -18576,7 +18954,29 @@ var x = (y) => {
18576
18954
  var x = {}; __webpack_require__.d(x, y); return x
18577
18955
  }
18578
18956
  var y = (x) => (() => (x))
18579
- module.exports = x({ ["ArrowCurveBack5"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowCurveBack5), ["ArrowCurveForward5"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowCurveForward5), ["ArrowsMaximize"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowsMaximize), ["ArrowsMinimize"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowsMinimize), ["Volume0"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume0), ["Volume1"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume1), ["Volume2"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume2), ["VolumeX"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.VolumeX) });
18957
+ module.exports = x({ ["ArrowCurveBack5"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowCurveBack5), ["ArrowCurveForward5"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowCurveForward5), ["ArrowsMaximize"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowsMaximize), ["ArrowsMinimize"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ArrowsMinimize), ["ChevronDown"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ChevronDown), ["ChevronUp"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ChevronUp), ["Comment"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Comment), ["Volume0"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume0), ["Volume1"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume1), ["Volume2"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.Volume2), ["VolumeX"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.VolumeX), ["XMark"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.XMark), ["ZoomIn"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ZoomIn), ["ZoomOut"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_3b21b01f__.ZoomOut) });
18958
+
18959
+ /***/ },
18960
+
18961
+ /***/ 5903
18962
+ (module, __unused_webpack_exports, __webpack_require__) {
18963
+
18964
+ var x = (y) => {
18965
+ var x = {}; __webpack_require__.d(x, y); return x
18966
+ }
18967
+ var y = (x) => (() => (x))
18968
+ module.exports = x({ ["Backward"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c__.Backward), ["Forward"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c__.Forward), ["Pause"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c__.Pause), ["Play"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_1ed4080c__.Play) });
18969
+
18970
+ /***/ },
18971
+
18972
+ /***/ 8380
18973
+ (module, __unused_webpack_exports, __webpack_require__) {
18974
+
18975
+ var x = (y) => {
18976
+ var x = {}; __webpack_require__.d(x, y); return x
18977
+ }
18978
+ var y = (x) => (() => (x))
18979
+ module.exports = x({ ["Size5"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_tokens_tokens_b764a744__.Size5), ["bpIconCtaIconOnDark"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_tokens_tokens_b764a744__.bpIconCtaIconOnDark), ["bpIconIconOnDark"]: () => (__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_tokens_tokens_b764a744__.bpIconIconOnDark) });
18580
18980
 
18581
18981
  /***/ },
18582
18982
 
@@ -34188,7 +34588,7 @@ function isNpmBuild() {
34188
34588
  ;// ./src/lib/Logger.js
34189
34589
  /* eslint-disable no-undef */
34190
34590
  const CLIENT_NAME = "box-content-preview";
34191
- const CLIENT_VERSION = "3.114.0";
34591
+ const CLIENT_VERSION = "3.115.0";
34192
34592
  /* eslint-enable no-undef */
34193
34593
 
34194
34594
  class Logger {
@@ -48498,6 +48898,12 @@ var play_48px = __webpack_require__(3493);
48498
48898
  const arrow_curved_back_24px_namespaceObject = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.707 2.29346C12.3165 1.90293 11.6835 1.90293 11.293 2.29346L8.64648 4.93994C8.06097 5.52574 8.06083 6.47534 8.64648 7.06104L11.293 9.70752C11.6834 10.0976 12.3166 10.0976 12.707 9.70752C13.0974 9.3171 13.0972 8.68399 12.707 8.29346L11.4131 6.99951H12C15.3136 6.99951 17.9998 9.68597 18 12.9995C18 16.3132 15.3137 18.9995 12 18.9995C10.7239 18.9995 9.54372 18.6019 8.57227 17.9243C8.11945 17.6086 7.49569 17.7198 7.17969 18.1724C6.8638 18.6252 6.97502 19.2489 7.42773 19.5649C8.72394 20.4691 10.3016 20.9995 12 20.9995C16.4183 20.9995 20 17.4178 20 12.9995C19.9998 8.5814 16.4182 4.99951 12 4.99951H11.415L12.707 3.70752C13.0975 3.31707 13.0973 2.684 12.707 2.29346ZM3.2793 8.99951C2.67882 8.99951 2.32725 9.26833 2.27832 9.9126L2.09277 12.3882V12.4126C2.06348 12.8862 2.33203 13.2964 2.92285 13.2964C3.31348 13.2964 3.49414 13.2085 3.76758 12.9692C3.99217 12.7691 4.29991 12.5933 4.68555 12.5933C5.35925 12.5933 5.83283 13.0476 5.83301 13.6919C5.83301 14.3511 5.33984 14.8394 4.6709 14.8394C4.10449 14.8394 3.7627 14.5708 3.48926 14.1606C3.27447 13.8923 3.05948 13.7798 2.72266 13.7798C2.26868 13.7798 2.00015 14.0437 2 14.4829C2 14.6537 2.04404 14.8199 2.12207 14.9761C2.4834 15.6938 3.51855 16.2212 4.68555 16.2212C6.36035 16.2212 7.52246 15.2007 7.52246 13.6528C7.52229 12.3151 6.56531 11.3774 5.23242 11.3774C4.49526 11.3774 3.92389 11.6852 3.65039 12.1489H3.61621L3.75293 10.3765H6.44824C6.87793 10.3765 7.15137 10.1079 7.15137 9.68799C7.15121 9.26828 6.87292 8.99951 6.44824 8.99951H3.2793Z\" fill=\"white\"/>\n</svg>\n";
48499
48899
  ;// ./src/lib/icons/arrow_curved_forward_24px.svg
48500
48900
  const arrow_curved_forward_24px_namespaceObject = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M11.293 2.29346C11.6835 1.90293 12.3165 1.90293 12.707 2.29346L15.3535 4.93994C15.939 5.52574 15.9392 6.47535 15.3535 7.06104L12.707 9.70752C12.3166 10.0976 11.6834 10.0976 11.293 9.70752C10.9026 9.31711 10.9028 8.684 11.293 8.29346L12.5869 6.99951H12C8.68642 6.99951 6.00021 9.68598 6 12.9995C6 16.3132 8.68629 18.9995 12 18.9995C13.2761 18.9995 14.4563 18.6019 15.4277 17.9243C15.8805 17.6086 16.5043 17.7198 16.8203 18.1724C17.1362 18.6252 17.025 19.2489 16.5723 19.5649C15.2761 20.4691 13.6984 20.9995 12 20.9995C7.58172 20.9995 4 17.4178 4 12.9995C4.00021 8.58141 7.58185 4.99951 12 4.99951H12.585L11.293 3.70752C10.9025 3.31708 10.9027 2.684 11.293 2.29346ZM20.9258 8.99951C21.3505 8.99951 21.6287 9.26828 21.6289 9.68799C21.6289 10.1079 21.3555 10.3765 20.9258 10.3765H18.2305L18.0938 12.1489H18.1279C18.4014 11.6852 18.9728 11.3774 19.71 11.3774C21.0428 11.3774 21.9998 12.3151 22 13.6528C22 15.2007 20.8379 16.2212 19.1631 16.2212C17.9961 16.2212 16.9609 15.6938 16.5996 14.9761C16.5216 14.8199 16.4775 14.6537 16.4775 14.4829C16.4777 14.0437 16.7462 13.7798 17.2002 13.7798C17.537 13.7798 17.752 13.8923 17.9668 14.1606C18.2402 14.5708 18.582 14.8394 19.1484 14.8394C19.8174 14.8394 20.3105 14.3511 20.3105 13.6919C20.3104 13.0476 19.8368 12.5933 19.1631 12.5933C18.7774 12.5933 18.4697 12.7691 18.2451 12.9692C17.9717 13.2085 17.791 13.2964 17.4004 13.2964C16.8096 13.2964 16.541 12.8862 16.5703 12.4126V12.3882L16.7559 9.9126C16.8048 9.26833 17.1564 8.99951 17.7568 8.99951H20.9258Z\" fill=\"white\"/>\n</svg>\n";
48901
+ // EXTERNAL MODULE: external "@box/blueprint-web"
48902
+ var blueprint_web_ = __webpack_require__(8912);
48903
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayOverlayIcon.tsx
48904
+ var PlayOverlayIcon = __webpack_require__(2048);
48905
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
48906
+ var utils = __webpack_require__(5346);
48501
48907
  ;// ./src/lib/viewers/media/fitFrameToViewport.js
48502
48908
  /**
48503
48909
  * Contain-fits a frame into the viewport (same model as object-fit: contain).
@@ -48544,6 +48950,12 @@ function VideoPreloader_toPrimitive(t, r) { if ("object" != typeof t || !t) retu
48544
48950
 
48545
48951
 
48546
48952
 
48953
+
48954
+
48955
+
48956
+
48957
+
48958
+
48547
48959
  class VideoPreloader extends (events_default()) {
48548
48960
  /**
48549
48961
  * [constructor]
@@ -48578,6 +48990,8 @@ class VideoPreloader extends (events_default()) {
48578
48990
  VideoPreloader_defineProperty(this, "preloadRequestId", 0);
48579
48991
  /** @property {Promise|null} - In-flight showPreload promise (single-flight) */
48580
48992
  VideoPreloader_defineProperty(this, "showPreloadPromise", null);
48993
+ /** @property {Root|undefined} - React root for the Blueprint play overlay */
48994
+ VideoPreloader_defineProperty(this, "playOverlayRoot", void 0);
48581
48995
  /**
48582
48996
  * Cleans up preload DOM.
48583
48997
  *
@@ -48585,6 +48999,7 @@ class VideoPreloader extends (events_default()) {
48585
48999
  * @return {void}
48586
49000
  */
48587
49001
  VideoPreloader_defineProperty(this, "cleanupPreload", () => {
49002
+ this.unmountBlueprintPlayOverlay();
48588
49003
  if (this.wrapperEl) {
48589
49004
  if (this.wrapperEl.parentNode) {
48590
49005
  this.wrapperEl.parentNode.removeChild(this.wrapperEl);
@@ -48689,6 +49104,8 @@ class VideoPreloader extends (events_default()) {
48689
49104
  * @param {Object} [options] - Optional options
48690
49105
  * @param {Object} [options.viewport] - { width, height } to use for sizing (same as video viewport to avoid jump)
48691
49106
  * @param {Function} [options.onImageClick] - Called when user clicks the preload image
49107
+ * @param {boolean} [options.isBlueprintEnabled] - Renders the play overlay as a Blueprint IconButton
49108
+ * @param {HTMLElement} [options.portalContainer] - Container for Blueprint portaled content (tooltips)
48692
49109
  * @return {Promise} Promise to show preload
48693
49110
  */
48694
49111
  showPreload(preloadUrlWithAuth, containerEl, options = {}) {
@@ -48712,13 +49129,17 @@ class VideoPreloader extends (events_default()) {
48712
49129
  return;
48713
49130
  }
48714
49131
  this.srcUrl = URL.createObjectURL(imgBlob);
49132
+ const {
49133
+ isBlueprintEnabled
49134
+ } = this.preloadOptions;
49135
+ const playOverlayClassName = isBlueprintEnabled ? `${constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci} ${constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci}--blueprint` : constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci;
48715
49136
  const wrapperEl = document.createElement('div');
48716
49137
  wrapperEl.className = this.wrapperClassName;
48717
49138
  wrapperEl.innerHTML = `
48718
49139
  <div class="${constants/* CLASS_BOX_PREVIEW_PRELOAD */.Ar} ${constants/* CLASS_INVISIBLE */.Zb}">
48719
49140
  <div class="${constants/* CLASS_BOX_PREVIEW_PRELOAD_PLACEHOLDER */.oK}">
48720
49141
  <img class="${constants/* CLASS_BOX_PREVIEW_PRELOAD_CONTENT */.eF}" src="${this.srcUrl}" />
48721
- <div class="${constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci}">${play_48px}</div>
49142
+ <div class="${playOverlayClassName}">${isBlueprintEnabled ? '' : play_48px}</div>
48722
49143
  </div>
48723
49144
  </div>
48724
49145
  `.trim();
@@ -48737,6 +49158,9 @@ class VideoPreloader extends (events_default()) {
48737
49158
  this.placeholderEl = this.wrapperEl.querySelector(`.${constants/* CLASS_BOX_PREVIEW_PRELOAD_PLACEHOLDER */.oK}`);
48738
49159
  this.preloadEl = this.wrapperEl.querySelector(`.${constants/* CLASS_BOX_PREVIEW_PRELOAD */.Ar}`);
48739
49160
  this.imageEl = this.preloadEl.querySelector(`.${constants/* CLASS_BOX_PREVIEW_PRELOAD_CONTENT */.eF}`);
49161
+ if (isBlueprintEnabled) {
49162
+ this.renderBlueprintPlayOverlay();
49163
+ }
48740
49164
  this.bindDOMListeners();
48741
49165
 
48742
49166
  // If image is already loaded (cached), show it immediately
@@ -48752,6 +49176,49 @@ class VideoPreloader extends (events_default()) {
48752
49176
  return this.showPreloadPromise;
48753
49177
  }
48754
49178
 
49179
+ /**
49180
+ * Renders the Blueprint play button into the thumbnail's play overlay. Clicks bubble to
49181
+ * the wrapper's image click handler, so the button and the thumbnail start playback the same way.
49182
+ *
49183
+ * @private
49184
+ * @return {void}
49185
+ */
49186
+ renderBlueprintPlayOverlay() {
49187
+ const overlayEl = this.wrapperEl.querySelector(`.${constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci}`);
49188
+ if (!overlayEl) {
49189
+ return;
49190
+ }
49191
+ this.playOverlayRoot = (0,client_.createRoot)(overlayEl);
49192
+ this.playOverlayRoot.render(/*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
49193
+ container: this.preloadOptions.portalContainer
49194
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
49195
+ content: "Play"
49196
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
49197
+ "aria-label": "Play",
49198
+ className: "bp-video-preload-play-button",
49199
+ "data-resin-target": "playOverlay",
49200
+ "data-target-id": "VideoPreloader-play",
49201
+ "data-testid": "bp-video-preload-play-button",
49202
+ icon: PlayOverlayIcon/* default */.A,
49203
+ onKeyDown: utils/* stopActivationKeyPropagation */.My,
49204
+ size: "large",
49205
+ variant: "on-dark"
49206
+ }))));
49207
+ }
49208
+
49209
+ /**
49210
+ * Unmounts the Blueprint play overlay, if any.
49211
+ *
49212
+ * @private
49213
+ * @return {void}
49214
+ */
49215
+ unmountBlueprintPlayOverlay() {
49216
+ if (this.playOverlayRoot) {
49217
+ this.playOverlayRoot.unmount();
49218
+ this.playOverlayRoot = undefined;
49219
+ }
49220
+ }
49221
+
48755
49222
  /**
48756
49223
  * Hides the preload if it exists.
48757
49224
  *
@@ -48825,6 +49292,10 @@ class VideoPreloader extends (events_default()) {
48825
49292
  }
48826
49293
  const playOverlay = this.wrapperEl.querySelector(`.${constants/* CLASS_BOX_PREVIEW_VIDEO_PRELOAD_PLAY_OVERLAY */.Ci}`);
48827
49294
  if (playOverlay) {
49295
+ // Hiding the focused play button would drop focus to body, where Space no longer reaches the player.
49296
+ if (playOverlay.contains(document.activeElement)) {
49297
+ this.containerEl?.focus();
49298
+ }
48828
49299
  playOverlay.classList.add(constants/* CLASS_HIDDEN */.zX);
48829
49300
  }
48830
49301
  if (this.imageClickHandler) {
@@ -49253,7 +49724,9 @@ class VideoBaseViewer extends media_MediaBaseViewer {
49253
49724
  url_template: template
49254
49725
  } = preloadRep.content;
49255
49726
  const options = {
49256
- onImageClick: () => this.handlePlayRequest()
49727
+ isBlueprintEnabled: this.isBlueprintMediaControlsEnabled(),
49728
+ onImageClick: () => this.handlePlayRequest(),
49729
+ portalContainer: this.containerEl
49257
49730
  };
49258
49731
  if (this.isVideoPosterEarlyPaint) {
49259
49732
  // Resolve viewport at paint time so sidebar/layout changes after showPreload
@@ -50110,12 +50583,12 @@ function VideoControls({
50110
50583
  onFullscreenToggle: onFullscreenToggle
50111
50584
  })))));
50112
50585
  }
50113
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseButton.tsx + 3 modules
50114
- var PlayPauseButton = __webpack_require__(2677);
50586
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseButton.tsx + 2 modules
50587
+ var PlayPauseButton = __webpack_require__(5760);
50115
50588
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/SkipButton.tsx + 2 modules
50116
50589
  var SkipButton = __webpack_require__(2659);
50117
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
50118
- var TimestampControl = __webpack_require__(3904);
50590
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
50591
+ var TimestampControl = __webpack_require__(3308);
50119
50592
  // EXTERNAL MODULE: ./src/lib/viewers/media/formatTimecode.ts
50120
50593
  var formatTimecode = __webpack_require__(4179);
50121
50594
  ;// ./src/lib/viewers/controls/media/FilmstripV2.scss
@@ -50306,8 +50779,6 @@ function MarkerCluster({
50306
50779
  selectedId: selectedId
50307
50780
  }));
50308
50781
  }
50309
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
50310
- var utils = __webpack_require__(5346);
50311
50782
  ;// ./src/lib/viewers/controls/media/TimeControlsV2.scss
50312
50783
  // extracted by mini-css-extract-plugin
50313
50784
 
@@ -50442,8 +50913,6 @@ function TimeControlsV2({
50442
50913
  selectedId: selectedId
50443
50914
  }))));
50444
50915
  }
50445
- // EXTERNAL MODULE: external "@box/blueprint-web"
50446
- var blueprint_web_ = __webpack_require__(8912);
50447
50916
  // EXTERNAL MODULE: external "@box/blueprint-web-assets/icons/Medium"
50448
50917
  var Medium_ = __webpack_require__(9747);
50449
50918
  ;// ./src/lib/viewers/controls/media/VideoFullscreenButton.scss
@@ -50651,6 +51120,7 @@ function VideoControlsV2({
50651
51120
  currentTime: currentTime,
50652
51121
  durationTime: durationTime,
50653
51122
  fps: fps,
51123
+ isBlueprintEnabled: isBlueprintEnabled,
50654
51124
  isNarrowWidth: isNarrowVideo,
50655
51125
  mediaEl: mediaEl
50656
51126
  })), /*#__PURE__*/external_react_["default"].createElement("div", {
@@ -53559,6 +54029,95 @@ function ColorPickerControlV2({
53559
54029
  onClick: () => onColorSelect(color)
53560
54030
  }))));
53561
54031
  }
54032
+ ;// external "@box/blueprint-web-assets/icons/Medium/Search"
54033
+
54034
+ ;// ./src/lib/viewers/controls/findbar/FindBarToggleV2.tsx
54035
+
54036
+
54037
+
54038
+ function FindBarToggleV2({
54039
+ onFindBarToggle
54040
+ }) {
54041
+ if (!onFindBarToggle) {
54042
+ return null;
54043
+ }
54044
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
54045
+ content: "Toggle findbar"
54046
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
54047
+ "aria-label": "Toggle findbar",
54048
+ "data-resin-target": "findBar",
54049
+ onClick: ({
54050
+ currentTarget
54051
+ }) => onFindBarToggle(currentTarget)
54052
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
54053
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Search_ef3e4aba_default__
54054
+ })));
54055
+ }
54056
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize"
54057
+
54058
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize"
54059
+
54060
+ ;// ./src/lib/viewers/controls/fullscreen/FullscreenToggleV2.tsx
54061
+ const FullscreenToggleV2_excluded = ["onFullscreenToggle"];
54062
+ function FullscreenToggleV2_extends() { return FullscreenToggleV2_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FullscreenToggleV2_extends.apply(null, arguments); }
54063
+ function FullscreenToggleV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = FullscreenToggleV2_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
54064
+ function FullscreenToggleV2_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
54065
+
54066
+
54067
+
54068
+
54069
+
54070
+ function FullscreenToggleV2(_ref) {
54071
+ let {
54072
+ onFullscreenToggle
54073
+ } = _ref,
54074
+ rest = FullscreenToggleV2_objectWithoutProperties(_ref, FullscreenToggleV2_excluded);
54075
+ const isFullscreen = useFullscreen();
54076
+ const icon = isFullscreen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__;
54077
+ const label = isFullscreen ? "Exit fullscreen" : "Enter fullscreen";
54078
+ const handleClick = ({
54079
+ currentTarget
54080
+ }) => {
54081
+ onFullscreenToggle(!isFullscreen, currentTarget);
54082
+ };
54083
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
54084
+ content: label
54085
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, FullscreenToggleV2_extends({
54086
+ "aria-label": label,
54087
+ "data-resin-target": "fullscreen",
54088
+ onClick: handleClick
54089
+ }, rest), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
54090
+ icon: icon
54091
+ })));
54092
+ }
54093
+ ;// external "@box/blueprint-web-assets/icons/Medium/GridView"
54094
+
54095
+ ;// ./src/lib/viewers/controls/gallery/GalleryToggleV2.tsx
54096
+
54097
+
54098
+
54099
+
54100
+ function GalleryToggleV2({
54101
+ isGalleryOpen,
54102
+ onGalleryToggle
54103
+ }) {
54104
+ if (!onGalleryToggle) {
54105
+ return null;
54106
+ }
54107
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54108
+ onValueChange: () => onGalleryToggle(),
54109
+ type: "multiple",
54110
+ value: isGalleryOpen ? ['gallery'] : []
54111
+ }, /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54112
+ content: "Gallery view"
54113
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
54114
+ "aria-label": "Gallery view",
54115
+ "data-bp-gallery-toggle": "",
54116
+ "data-resin-target": "galleryView",
54117
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_GridView_ac92b674_default__,
54118
+ value: "gallery"
54119
+ })));
54120
+ }
53562
54121
  ;// external "@box/blueprint-web-assets/icons/Medium/ChevronDown"
53563
54122
 
53564
54123
  ;// external "@box/blueprint-web-assets/icons/Medium/ChevronUp"
@@ -53708,6 +54267,62 @@ function PageControlsV2({
53708
54267
  icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__
53709
54268
  }))));
53710
54269
  }
54270
+ ;// external "@box/blueprint-web-assets/icons/Medium/RotateLeft"
54271
+
54272
+ ;// ./src/lib/viewers/controls/rotate/RotateControlV2.tsx
54273
+
54274
+
54275
+
54276
+ function RotateControlV2({
54277
+ onRotateLeft
54278
+ }) {
54279
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
54280
+ content: "Rotate left"
54281
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
54282
+ "aria-label": "Rotate left",
54283
+ "data-resin-target": "rotate",
54284
+ onClick: onRotateLeft
54285
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
54286
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__
54287
+ })));
54288
+ }
54289
+ ;// external "@box/blueprint-web-assets/icons/Medium/Nav"
54290
+
54291
+ ;// external "@box/blueprint-web-assets/icons/MediumFilled/Nav"
54292
+
54293
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggleV2.scss
54294
+ // extracted by mini-css-extract-plugin
54295
+
54296
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggleV2.tsx
54297
+
54298
+
54299
+
54300
+
54301
+
54302
+
54303
+ function ThumbnailsToggleV2({
54304
+ isThumbnailsOpen,
54305
+ onThumbnailsToggle
54306
+ }) {
54307
+ if (!onThumbnailsToggle) {
54308
+ return null;
54309
+ }
54310
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
54311
+ className: "bp-ThumbnailsToggleV2"
54312
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54313
+ onValueChange: () => onThumbnailsToggle(),
54314
+ type: "multiple",
54315
+ value: isThumbnailsOpen ? ['thumbnails'] : []
54316
+ }, /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54317
+ content: "Toggle thumbnails"
54318
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
54319
+ "aria-expanded": isThumbnailsOpen,
54320
+ "aria-label": "Toggle thumbnails",
54321
+ "data-resin-target": "thumbnails",
54322
+ icon: isThumbnailsOpen ? __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Nav_ae6d790f_default__ : __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Nav_d41e959a_default__,
54323
+ value: "thumbnails"
54324
+ }))));
54325
+ }
53711
54326
  ;// external "@box/blueprint-web-assets/icons/Medium/Minus"
53712
54327
 
53713
54328
  ;// external "@box/blueprint-web-assets/icons/Medium/Plus"
@@ -53832,10 +54447,10 @@ function DocControlsV2({
53832
54447
  };
53833
54448
  return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
53834
54449
  experiences: experiences
53835
- }, /*#__PURE__*/external_react_["default"].createElement(ControlsBarV2, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
54450
+ }, /*#__PURE__*/external_react_["default"].createElement(ControlsBarV2, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggleV2, {
53836
54451
  isThumbnailsOpen: isThumbnailsOpen,
53837
54452
  onThumbnailsToggle: onThumbnailsToggle
53838
- }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
54453
+ }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggleV2, {
53839
54454
  onFindBarToggle: onFindBarToggle
53840
54455
  }), /*#__PURE__*/external_react_["default"].createElement(PageControlsV2, {
53841
54456
  onPageChange: onPageChange,
@@ -53850,12 +54465,12 @@ function DocControlsV2({
53850
54465
  resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
53851
54466
  resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
53852
54467
  scale: scale
53853
- }), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
54468
+ }), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(RotateControlV2, {
53854
54469
  onRotateLeft: onRotateLeft
53855
- }), /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
54470
+ }), /*#__PURE__*/external_react_["default"].createElement(GalleryToggleV2, {
53856
54471
  isGalleryOpen: isGalleryOpen,
53857
54472
  onGalleryToggle: onGalleryToggle
53858
- }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
54473
+ }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
53859
54474
  onFullscreenToggle: onFullscreenToggle
53860
54475
  }), hasAnnotations && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Separator, null), /*#__PURE__*/external_react_["default"].createElement(AnnotationsExitButtonV2, {
53861
54476
  onClick: handleAnnotationsExit
@@ -57623,7 +58238,7 @@ class DocBaseViewer extends viewers_BaseViewer {
57623
58238
  toggleThumbnails: () => this.toggleThumbnails(),
57624
58239
  requestUiUpdate: () => this.renderUI(),
57625
58240
  focusToggle: () => {
57626
- const toggle = this.containerEl.querySelector('.bp-GalleryToggle');
58241
+ const toggle = this.containerEl.querySelector('.bp-GalleryToggle, [data-bp-gallery-toggle]');
57627
58242
  if (toggle && toggle.focus) {
57628
58243
  toggle.focus();
57629
58244
  }
@@ -59435,6 +60050,9 @@ class DocBaseViewer extends viewers_BaseViewer {
59435
60050
  pagesCount
59436
60051
  } = this.pdfViewer;
59437
60052
  this.cacheThumbnailsToggledState(this.thumbnailsSidebar.isOpen);
60053
+ if (this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ)) {
60054
+ this.renderUI();
60055
+ }
59438
60056
  let metricName;
59439
60057
  let eventName;
59440
60058
  if (!this.thumbnailsSidebar.isOpen) {
@@ -64739,6 +65357,16 @@ office_OfficeLoader,
64739
65357
  doc_DocLoader,
64740
65358
  // should come after text
64741
65359
  swf_SWFLoader, video360_Video360Loader, media_MediaLoader, image360_Image360Loader, image_ImageLoader, model3d_Model3DLoader, iframe_IFrameLoader]);
65360
+ ;// external "@box/blueprint-web-assets/icons/Medium/Checkmark"
65361
+
65362
+ ;// external "@box/blueprint-web-assets/icons/Medium/Download"
65363
+
65364
+ ;// external "@box/blueprint-web-assets/icons/Medium/Ellipsis"
65365
+
65366
+ ;// external "@box/blueprint-web-assets/icons/Medium/Expand"
65367
+
65368
+ ;// external "@box/blueprint-web-assets/icons/Medium/Trash"
65369
+
64742
65370
  ;// ./src/lib/ComparisonBanner.tsx
64743
65371
  function ComparisonBanner_defineProperty(e, r, t) { return (r = ComparisonBanner_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
64744
65372
  function ComparisonBanner_toPropertyKey(t) { var i = ComparisonBanner_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -64746,6 +65374,13 @@ function ComparisonBanner_toPrimitive(t, r) { if ("object" != typeof t || !t) re
64746
65374
 
64747
65375
 
64748
65376
 
65377
+
65378
+
65379
+
65380
+
65381
+
65382
+
65383
+
64749
65384
  function formatComparisonTimestamp(iso, locale) {
64750
65385
  if (!iso) {
64751
65386
  return '';
@@ -64767,7 +65402,13 @@ function getComparisonBannerAuthor(file = {}) {
64767
65402
  function ComparisonBanner({
64768
65403
  file = {},
64769
65404
  isComparedPreview = false,
64770
- locale
65405
+ isOnDark = false,
65406
+ locale,
65407
+ menuContainer,
65408
+ onDelete,
65409
+ onDownload,
65410
+ onMakeCurrent,
65411
+ onOpenFullPreview
64771
65412
  }) {
64772
65413
  const versionNumber = file.version_number != null && file.version_number !== '' ? String(file.version_number) : '';
64773
65414
  const timestamp = formatComparisonTimestamp(file.modified_at, locale);
@@ -64776,8 +65417,10 @@ function ComparisonBanner({
64776
65417
  return null;
64777
65418
  }
64778
65419
  return /*#__PURE__*/external_react_["default"].createElement("div", {
65420
+ className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on
65421
+ }, /*#__PURE__*/external_react_["default"].createElement("div", {
64779
65422
  "aria-label": isComparedPreview ? "Previous version" : "Current version",
64780
- className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on,
65423
+ className: "bp-version-banner-details",
64781
65424
  role: "status"
64782
65425
  }, versionNumber && /*#__PURE__*/external_react_["default"].createElement("span", {
64783
65426
  className: "bp-version-banner-badge"
@@ -64787,24 +65430,88 @@ function ComparisonBanner({
64787
65430
  className: "bp-version-banner-time"
64788
65431
  }, timestamp), author && /*#__PURE__*/external_react_["default"].createElement("div", {
64789
65432
  className: "bp-version-banner-author"
64790
- }, author)));
65433
+ }, author))), isComparedPreview && (onMakeCurrent || onDownload || onOpenFullPreview || onDelete) && /*#__PURE__*/external_react_["default"].createElement("div", {
65434
+ className: "bp-version-banner-actions",
65435
+ onKeyDown: event => {
65436
+ event.stopPropagation(); // Prevents global key handling
65437
+ },
65438
+ role: "presentation"
65439
+ }, /*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
65440
+ container: menuContainer
65441
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
65442
+ asChild: true
65443
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
65444
+ "aria-label": "More actions",
65445
+ "data-target-id": "ComparisonBanner-openActions",
65446
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Ellipsis_9a96c07b_default__,
65447
+ size: "small",
65448
+ variant: isOnDark ? 'on-dark' : 'default'
65449
+ })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, {
65450
+ align: "end",
65451
+ container: menuContainer ?? undefined,
65452
+ side: "bottom"
65453
+ }, onMakeCurrent && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
65454
+ "data-target-id": "ComparisonBanner-makeCurrent",
65455
+ onSelect: onMakeCurrent
65456
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
65457
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Checkmark_52a58454_default__
65458
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
65459
+ label: "Make Current"
65460
+ })), onDownload && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
65461
+ "data-target-id": "ComparisonBanner-download",
65462
+ onSelect: onDownload
65463
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
65464
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Download_0dc63cde_default__
65465
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
65466
+ label: "Download"
65467
+ })), onOpenFullPreview && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
65468
+ "data-target-id": "ComparisonBanner-openFullPreview",
65469
+ onSelect: onOpenFullPreview
65470
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
65471
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Expand_92c6b888_default__
65472
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
65473
+ label: "Open Full Preview"
65474
+ })), onDelete && (onMakeCurrent || onDownload || onOpenFullPreview) && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null), onDelete && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
65475
+ "data-target-id": "ComparisonBanner-delete",
65476
+ onSelect: onDelete,
65477
+ variant: "destructive"
65478
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
65479
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Trash_28211f44_default__
65480
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
65481
+ label: "Delete"
65482
+ })))))));
64791
65483
  }
64792
65484
  class ComparisonBannerRoot {
64793
65485
  constructor(containerEl) {
65486
+ ComparisonBanner_defineProperty(this, "containerEl", void 0);
64794
65487
  ComparisonBanner_defineProperty(this, "hostEl", void 0);
64795
65488
  ComparisonBanner_defineProperty(this, "root", void 0);
65489
+ this.containerEl = containerEl;
64796
65490
  this.hostEl = document.createElement('div');
64797
65491
  containerEl.insertBefore(this.hostEl, containerEl.firstChild);
64798
65492
  this.root = (0,client_.createRoot)(this.hostEl);
64799
65493
  }
64800
- render(file = {}, {
64801
- isComparedPreview = false,
64802
- locale
64803
- } = {}) {
65494
+ render(file = {}, options = {}) {
65495
+ const {
65496
+ isComparedPreview = false,
65497
+ isOnDark,
65498
+ locale,
65499
+ menuContainer,
65500
+ onDelete,
65501
+ onDownload,
65502
+ onMakeCurrent,
65503
+ onOpenFullPreview
65504
+ } = options;
64804
65505
  this.root.render(/*#__PURE__*/external_react_["default"].createElement(ComparisonBanner, {
64805
65506
  file: file,
64806
65507
  isComparedPreview: isComparedPreview,
64807
- locale: locale
65508
+ isOnDark: isOnDark,
65509
+ locale: locale,
65510
+ menuContainer: menuContainer ?? this.containerEl,
65511
+ onDelete: onDelete,
65512
+ onDownload: onDownload,
65513
+ onMakeCurrent: onMakeCurrent,
65514
+ onOpenFullPreview: onOpenFullPreview
64808
65515
  }));
64809
65516
  }
64810
65517
  destroy() {
@@ -66520,11 +67227,25 @@ class Preview extends (events_default()) {
66520
67227
  }
66521
67228
  const {
66522
67229
  currentFileVersion,
66523
- previousFileVersion
67230
+ previousFileVersion,
67231
+ onDelete,
67232
+ onDownload: onDownloadVersion,
67233
+ onMakeCurrent,
67234
+ onOpenFullPreview
66524
67235
  } = comparisonBanner || {};
67236
+
67237
+ // Videos always lower the lights; MP3 is dark only on the v2 player.
67238
+ const viewerName = (0,util/* getProp */.GT)(this.viewer, 'options.viewer.NAME', '');
67239
+ const isOnDark = constants/* VIDEO_VIEWER_NAMES */.yE.indexOf(viewerName) > -1 || viewerName === 'MP3' && !!(0,util/* getProp */.GT)(this.viewer, 'isAudioPlayerV2');
66525
67240
  this.comparisonBannerRoot.render(isComparedPreview ? previousFileVersion : currentFileVersion, {
66526
67241
  isComparedPreview,
66527
- locale: (0,util/* getProp */.GT)(this.location, 'locale')
67242
+ isOnDark,
67243
+ locale: (0,util/* getProp */.GT)(this.location, 'locale'),
67244
+ menuContainer: this.container,
67245
+ onDelete: isComparedPreview ? onDelete : undefined,
67246
+ onDownload: isComparedPreview ? onDownloadVersion : undefined,
67247
+ onMakeCurrent: isComparedPreview ? onMakeCurrent : undefined,
67248
+ onOpenFullPreview: isComparedPreview ? onOpenFullPreview : undefined
66528
67249
  });
66529
67250
  }
66530
67251
 
@@ -66987,6 +67708,9 @@ class Preview extends (events_default()) {
66987
67708
  // Setup the viewer DOM
66988
67709
  this.viewer.setup();
66989
67710
 
67711
+ // The banner renders before the viewer exists, so refresh it once the viewer's stage is known
67712
+ this.updateComparisonBanner();
67713
+
66990
67714
  // Load the representation into the viewer
66991
67715
  this.viewer.load();
66992
67716