box-content-preview 3.123.0 → 3.124.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
@@ -45,25 +45,26 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_dom_client_4cb20cd7__ from "react-do
45
45
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_179142b8__ from "react/jsx-runtime";
46
46
  import { default as __WEBPACK_EXTERNAL_MODULE_axios_default__ } from "axios";
47
47
  import { bdlBoxBlue as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__, bdlGray65 as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlGray65__, white as __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_white__ } from "box-ui-elements/es/styles/variables";
48
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__ } from "@box/blueprint-web-assets/icons/Medium/VrGoggles";
48
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__ } from "@box/blueprint-web-assets/icons/Medium/XMark";
49
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__ } from "@box/blueprint-web-assets/icons/Medium/Comment";
50
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__ } from "@box/blueprint-web-assets/icons/Medium/PencilTip";
51
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__ } from "@box/blueprint-web-assets/icons/Medium/SquarePlus";
52
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__ } from "@box/blueprint-web-assets/icons/Medium/TCursorHighlight";
53
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__ } from "@box/blueprint-web-assets/icons/Medium/EllipsisVertical";
49
54
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMaximize_12b9ae40_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize";
50
55
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ArrowsMinimize_35faab95_default__ } from "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize";
56
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__ } from "@box/blueprint-web-assets/icons/Medium/RotateLeft";
51
57
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__ } from "@box/blueprint-web-assets/icons/Medium/Minus";
52
58
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__ } from "@box/blueprint-web-assets/icons/Medium/Plus";
59
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronDown";
60
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronUp";
61
+ import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__ } from "@box/blueprint-web-assets/icons/Medium/VrGoggles";
53
62
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_CheckmarkCircle_e8bd4624_default__ } from "@box/blueprint-web-assets/icons/Medium/CheckmarkCircle";
54
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__ } from "@box/blueprint-web-assets/icons/Medium/PencilTip";
55
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__ } from "@box/blueprint-web-assets/icons/Medium/SquarePlus";
56
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__ } from "@box/blueprint-web-assets/icons/Medium/TCursorHighlight";
57
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__ } from "@box/blueprint-web-assets/icons/Medium/Comment";
58
63
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_GridView_ac92b674_default__ } from "@box/blueprint-web-assets/icons/Medium/GridView";
59
64
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Nav_d41e959a_default__ } from "@box/blueprint-web-assets/icons/Medium/Nav";
60
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__ } from "@box/blueprint-web-assets/icons/Medium/RotateLeft";
61
65
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Search_ef3e4aba_default__ } from "@box/blueprint-web-assets/icons/Medium/Search";
62
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__ } from "@box/blueprint-web-assets/icons/Medium/XMark";
63
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__ } from "@box/blueprint-web-assets/icons/Medium/EllipsisVertical";
64
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronDown";
65
- import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__ } from "@box/blueprint-web-assets/icons/Medium/ChevronUp";
66
66
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Nav_ae6d790f_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Nav";
67
+ import { Search as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Fill_15c08185_Search__ } from "@box/blueprint-web-assets/icons/Fill";
67
68
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Pause_0cc1f701_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Pause";
68
69
  import { default as __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_MediumFilled_Play_ee47c078_default__ } from "@box/blueprint-web-assets/icons/MediumFilled/Play";
69
70
  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";
@@ -412,6 +413,87 @@ class PreviewError extends Error {
412
413
 
413
414
  /***/ },
414
415
 
416
+ /***/ 2459
417
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
418
+
419
+
420
+ // EXPORTS
421
+ __webpack_require__.d(__webpack_exports__, {
422
+ Ay: () => (/* binding */ TabularDigits),
423
+ k7: () => (/* binding */ renderTabularDigits)
424
+ });
425
+
426
+ // UNUSED EXPORTS: TABULAR_DIGIT_CLASS
427
+
428
+ // EXTERNAL MODULE: external "react"
429
+ var external_react_ = __webpack_require__(1649);
430
+ ;// ./src/lib/TabularDigits.scss
431
+ // extracted by mini-css-extract-plugin
432
+
433
+ ;// ./src/lib/TabularDigits.tsx
434
+
435
+
436
+
437
+ // The Inter subset served to the app has no tabular figures, so `font-variant-numeric: tabular-nums`
438
+ // has no effect. Wrapping each digit in a 1ch box keeps changing numbers, and whatever follows them,
439
+ // from shifting as they update.
440
+ const TABULAR_DIGIT_CLASS = 'bp-TabularDigit';
441
+ const isDigit = char => char >= '0' && char <= '9';
442
+ const isDigitNode = node => node.nodeType === Node.ELEMENT_NODE;
443
+
444
+ /**
445
+ * Writes `text` into `el` with each digit in a fixed-width box. For labels updated outside React,
446
+ * e.g. on animation frames. Unchanged characters are left in place, so a ticking clock only touches
447
+ * the digits that changed.
448
+ */
449
+ function renderTabularDigits(el, text) {
450
+ if (el.textContent === text) {
451
+ return;
452
+ }
453
+ const chars = Array.from(text);
454
+ const nodes = el.childNodes;
455
+ const canPatch = nodes.length === chars.length && chars.every((char, index) => isDigit(char) === isDigitNode(nodes[index]));
456
+ if (canPatch) {
457
+ chars.forEach((char, index) => {
458
+ if (nodes[index].textContent !== char) {
459
+ nodes[index].textContent = char;
460
+ }
461
+ });
462
+ return;
463
+ }
464
+ const fragment = document.createDocumentFragment();
465
+ chars.forEach(char => {
466
+ if (isDigit(char)) {
467
+ const digitEl = document.createElement('span');
468
+ digitEl.className = TABULAR_DIGIT_CLASS;
469
+ digitEl.textContent = char;
470
+ fragment.appendChild(digitEl);
471
+ } else {
472
+ fragment.appendChild(document.createTextNode(char));
473
+ }
474
+ });
475
+ el.replaceChildren(fragment);
476
+ }
477
+ /**
478
+ * Renders `children` with each digit in a fixed-width box. Place it inside the element that
479
+ * provides the typography, e.g. `<Text as="span"><TabularDigits>{label}</TabularDigits></Text>`.
480
+ */
481
+ function TabularDigits({
482
+ children
483
+ }) {
484
+ const elRef = external_react_["default"].useRef(null);
485
+ external_react_["default"].useLayoutEffect(() => {
486
+ if (elRef.current) {
487
+ renderTabularDigits(elRef.current, children);
488
+ }
489
+ }, [children]);
490
+ return /*#__PURE__*/external_react_["default"].createElement("span", {
491
+ ref: elRef
492
+ });
493
+ }
494
+
495
+ /***/ },
496
+
415
497
  /***/ 9130
416
498
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
417
499
 
@@ -1112,7 +1194,7 @@ const DEFAULT_LANGUAGE = 'en-US';
1112
1194
  const MESSAGE_KEY_PREFIX = 'bcp.';
1113
1195
 
1114
1196
  // Only the npm build defines __BCP_DEFAULT_MESSAGES__; the CDN build bakes strings in per locale.
1115
- const defaultStrings = (0,_isNpmBuild__WEBPACK_IMPORTED_MODULE_0__/* .isNpmBuild */ .w)() ? {"rotate_left":"Rotate left","zoom_current_scale":"Current zoom level","zoom_in":"Zoom in","zoom_out":"Zoom out","enter_fullscreen":"Enter fullscreen","exit_fullscreen":"Exit fullscreen","controls_more":"More options","controls_find":"Find","controls_rotate_document":"Rotate document","controls_zoom_scale":"Zoom: {1}","controls_view_as_grid":"View as grid","controls_show_thumbnails":"View thumbnails","controls_hide_thumbnails":"Hide thumbnails","controls_shortcut_ctrl":"Ctrl + {1}","drawing_comment":"Markup","region_comment":"Comment on Region","highlight_text":"Highlight and Comment","exit_annotations":"Exit Annotations","annotation_tools":"Comment and markup","drawing_color":"Drawing color","drawing_color_blue":"Blue","drawing_color_green":"Green","drawing_color_red":"Red","drawing_color_orange":"Orange","drawing_color_yellow":"Yellow","drawing_color_purple":"Purple","previous_page":"Previous page","enter_page_num":"Click to enter page number","next_page":"Next page","download":"Download","print":"Print","print_notification":"Please press the print button to get a printable version of this document.","print_loading":"Preparing to print...","print_ready":"Ready to print.","print_close":"Close print dialog","previous_file":"Previous file","logo":"Logo","next_file":"Next file","loading_preview":"Loading Preview...","download_file":"Download File","text_truncated":"This file has been truncated due to size limits. Please download to view the whole file.","toggle_findbar":"Toggle findbar","toggle_thumbnails":"Toggle thumbnails","gallery_view":"Gallery view","page_gallery":"Page gallery","page_gallery_tile":"Page {1}","has_x_refs":"This preview has references you cannot view. Open the file in its native application.","find_next":"Find next","find_previous":"Find previous","find_close":"Close","find_label":"Search input","thumbnail_label":"Page thumbnails","file_preview_label":"File preview","comparison_banner_current":"Current version","comparison_banner_previous":"Previous version","comparison_banner_version":"Version {1}","comparison_banner_actions":"More actions","comparison_banner_open_full_preview":"Open Full Preview","comparison_banner_close":"Close","comparison_banner_make_current":"Make Current","comparison_banner_delete":"Delete","error_generic":"This preview didn’t load. Please try to open or download the file to view.","error_unsupported":"This preview didn’t load because the file type is unsupported. Please try to open or download the file to view.","error_account":"This preview didn’t load because your account is unable to preview this file type. Please try to open or download the file to view.","error_permissions":"This preview didn’t load because you don’t have permission. Please ask the file owner to update permissions.","error_refresh":"This preview didn’t load. Please try to open or download the file to view.","error_rate_limit":"This preview didn’t load because your request was rate limited. Please try to open or download the file to view.","error_reupload":"This preview didn’t load. Please try to open or download the file to view.","error_browser_unsupported":"Your browser doesn’t support preview for {1}. Please try to open or download the file to view.","error_document":"This preview didn’t load because the document may be protected. Please try to open or download the file to view.","error_password_protected":"This preview didn’t load because the document is protected. Please try to open or download the file to view.","error_try_again_later":"This preview didn’t load. Please refresh the page or download file to view.","error_bad_file":"This preview didn’t load. Please try to open or download the file to view.","error_not_downloadable":"Something seems to be wrong with this file. Please refresh the page, and if the issue continues, try to upload a new version.","error_flash_not_enabled":"This preview didn’t load because Flash is not enabled on your browser. Please try to enable Flash or download the file to view.","error_internet_explorer_office_online":"This version of Internet Explorer is out of date and the experience may be degraded. Please try switching to a different browser for a better experience.","error_large_file":"File exceeds supported size for preview. Open or download the file to view.","error_too_many_operations":"The file is too complex to display in your browser. Please download it to view.","error_zero_byte_file":"Cannot preview 0 B file. Open or download the file to view.","filename":"Name","last_modified_date":"Modified","size":"Size","search":"Search","search_results":"Search Results","search_placeholder":"Search files and folders","search_clear":"Clear search","breadcrumb":"Breadcrumb","breadcrumb_truncated":"Show hidden folders","media_autoplay":"Autoplay","media_autoplay_disabled":"Disabled","media_autoplay_enabled":"Enabled","media_play_next":"Play next file","media_play_next_disabled":"Disabled","media_play_next_enabled":"Enabled","media_speed":"Speed","media_speed_normal":"Normal","media_quality":"Quality","media_quality_auto":"Auto","media_guides":"Guides","media_guides_off":"Off","media_guides_default":"Default","media_guides_widescreen_hd":"Widescreen HD","media_guides_vertical":"Vertical","media_guides_square":"Square","media_guides_social_portrait":"Social Portrait","media_guides_cinemascope":"Cinemascope","media_guides_univisium":"Univisium","media_guides_cinema_flat":"Cinema Flat","media_guides_scope":"Scope","media_guides_fullscreen":"Fullscreen","media_guides_ultrawide":"Ultrawide","media_volume_slider":"Volume Slider","media_generating_waveform":"Generating waveform","media_loading":"Loading","media_zoom":"Zoom","media_zoom_slider":"Zoom Slider","media_time_slider":"Media Slider","media_comment_marker":"Comment marker","media_range_comment":"Comment","media_range_clear":"Clear","media_shuttle_forward":"Scanning forward at {1}x","media_shuttle_reverse":"Scanning backward at {1}x","media_mute":"Mute","media_unmute":"Unmute","media_play":"Play","media_pause":"Pause","media_skip_forward":"Skip forward","media_skip_backward":"Skip backward","media_settings":"Settings","media_subtitles_cc":"Subtitles/Closed Captions","media_time_format":"Time format","media_time_format_standard":"Standard time","media_time_format_timecode":"Timecode","media_time_format_frames":"Frame numbers","volume":"Volume","of":"of","subtitles":"Subtitles","off":"Off","media_audio":"Audio","track":"Track","media_auto_generated_captions":"Auto-Generated Captions","auto_generated":"Auto-Generated","box3d_animation_clips":"Animation clips","box3d_camera_projection_perspective":"Perspective","box3d_camera_projection_orthographic":"Orthographic","box3d_reset":"Reset","box3d_toggle_animation":"Play/pause animation","box3d_toggle_vr":"Toggle VR display","box3d_render_mode_lit":"Lit","box3d_render_mode_unlit":"Unlit","box3d_render_mode_normals":"Normals","box3d_render_mode_shape":"Shape","box3d_render_mode_uv_overlay":"UV Overlay","box3d_settings":"Settings","box3d_settings_render_label":"Render mode","box3d_settings_grid_label":"Show grid","box3d_settings_wireframes_label":"Show wireframes","box3d_settings_skeletons_label":"Show skeletons","box3d_settings_projection_label":"Camera Projection","box3d_settings_rotate_label":"Rotate Model","box3d_settings_rotate_left":"Rotate left around {1} axis","box3d_settings_rotate_right":"Rotate right around {1} axis","document_label":"Document Viewer","annotation_add_comment_placeholder":"Add a comment here...","annotation_reply_placeholder":"Post a reply...","annotation_done":"Done","annotation_close":"Close","annotation_cancel":"Cancel","annotation_save":"Save","annotation_post":"Post","annotation_delete":"Delete","annotation_delete_confirmation_message":"Delete this annotation?","annotation_profile_alt":"Avatar","annotation_anonymous_user_name":"Some User","annotation_posting_message":"Posting...","annotation_point_toggle":"Point annotation mode","annotation_draw_toggle":"Drawing annotation mode","annotation_highlight_toggle":"Highlight text","annotation_highlight_comment":"Add comment to highlighted text","annotation_who_highlighted":"{1} highlighted","annotation_who_drew":"{1} drew","annotation_draw_save":"Save drawing","annotation_draw_delete":"Delete drawing","annotations_load_error":"Annotations could not be loaded for this file. Please refresh the page to try again.","annotations_create_error":"This annotation could not be created. Please try again.","annotations_delete_error":"This annotation could not be deleted. Please try again.","annotations_authorization_error":"Annotations could not be loaded for this file. You may not have permission to take this action.","notification_button_default_text":"Okay","notification_button_default_label":"Clear Notification","notification_annotation_point_mode":"Click anywhere to add a comment to the document","notification_annotation_draw_mode":"Press down and drag the pointer to draw on the document","notification_degraded_preview":"Your connection to {1} is being blocked. Please reach out to your network admin to adjust firewall settings.","notification_cannot_download":"This file could not be downloaded.","notification_cannot_download_due_to_policy":"The file could not be downloaded due to a security policy.","link_contact_us":"Contact Us","360_videos":"360-degree videos","360_images":"360-degree images","3d_models":"3D models","afrikaans":"Afrikaans","albanian":"Albanian","arabic":"Arabic","armenian":"Armenian","belarusian":"Belarusian","bengali":"Bengali","bosnian":"Bosnian","bulgarian":"Bulgarian","burmese":"Burmese","catalan":"Catalan","central_khmer":"Central Khmer","chinese":"Chinese","croatian":"Croatian","czech":"Czech","danish":"Danish","dutch":"Dutch","english":"English","estonian":"Estonian","filipino":"Filipino","finnish":"Finnish","french":"French","galician":"Galician","ganda":"Ganda","georgian":"Georgian","german":"German","haitian_creole":"Haitian Creole","hebrew":"Hebrew","hindi":"Hindi","hmong":"Hmong","hungarian":"Hungarian","icelandic":"Icelandic","indonesian":"Indonesian","irish":"Irish","italian":"Italian","japanese":"Japanese","kazakh":"Kazakh","korean":"Korean","kurdish":"Kurdish","lao":"Lao","latvian":"Latvian","lithuanian":"Lithuanian","luxembourgish":"Luxembourgish","malay_macrolanguage":"Malay","modern_greek_1453_":"Greek","mongolian":"Mongolian","norwegian":"Norwegian","persian":"Persian","polish":"Polish","portuguese":"Portuguese","romanian":"Romanian","russian":"Russian","serbian":"Serbian","sichuan_yi":"Sichuan Yi","sicilian":"Sicilian","slovak":"Slovak","slovenian":"Slovenian","somali":"Somali","spanish":"Spanish","swahili_macrolanguage":"Swahili","swedish":"Swedish","swiss_german":"Swiss German","tagalog":"Tagalog","telugu":"Telugu","thai":"Thai","tibetan":"Tibetan","turkish":"Turkish","ukrainian":"Ukrainian","uzbek":"Uzbek","vietnamese":"Vietnamese"} : {};
1197
+ const defaultStrings = (0,_isNpmBuild__WEBPACK_IMPORTED_MODULE_0__/* .isNpmBuild */ .w)() ? {"rotate_left":"Rotate left","zoom_current_scale":"Current zoom level","zoom_in":"Zoom in","zoom_out":"Zoom out","enter_fullscreen":"Enter fullscreen","exit_fullscreen":"Exit fullscreen","controls_more":"More options","controls_find":"Find","controls_rotate_document":"Rotate document","controls_rotate_image":"Rotate image","controls_zoom_scale":"Zoom: {1}","controls_view_as_grid":"View as grid","controls_show_thumbnails":"View thumbnails","controls_hide_thumbnails":"Hide thumbnails","controls_shortcut_ctrl":"Ctrl + {1}","drawing_comment":"Markup","region_comment":"Comment on Region","highlight_text":"Highlight and Comment","exit_annotations":"Exit Annotations","annotation_tools":"Comment and markup","drawing_color":"Drawing color","drawing_color_blue":"Blue","drawing_color_green":"Green","drawing_color_red":"Red","drawing_color_orange":"Orange","drawing_color_yellow":"Yellow","drawing_color_purple":"Purple","previous_page":"Previous page","enter_page_num":"Click to enter page number","next_page":"Next page","download":"Download","print":"Print","print_notification":"Please press the print button to get a printable version of this document.","print_loading":"Preparing to print...","print_ready":"Ready to print.","print_close":"Close print dialog","previous_file":"Previous file","logo":"Logo","next_file":"Next file","loading_preview":"Loading Preview...","download_file":"Download File","text_truncated":"This file has been truncated due to size limits. Please download to view the whole file.","toggle_findbar":"Toggle findbar","toggle_thumbnails":"Toggle thumbnails","gallery_view":"Gallery view","page_gallery":"Page gallery","page_gallery_tile":"Page {1}","has_x_refs":"This preview has references you cannot view. Open the file in its native application.","find_next":"Find next","find_previous":"Find previous","find_close":"Close","find_label":"Search input","find_placeholder":"Find in document","find_match_count":"{1} of {2}","thumbnail_label":"Page thumbnails","file_preview_label":"File preview","comparison_banner_current":"Current version","comparison_banner_previous":"Previous version","comparison_banner_version":"Version {1}","comparison_banner_actions":"More actions","comparison_banner_open_full_preview":"Open Full Preview","comparison_banner_close":"Close","comparison_banner_make_current":"Make Current","comparison_banner_delete":"Delete","error_generic":"This preview didn’t load. Please try to open or download the file to view.","error_unsupported":"This preview didn’t load because the file type is unsupported. Please try to open or download the file to view.","error_account":"This preview didn’t load because your account is unable to preview this file type. Please try to open or download the file to view.","error_permissions":"This preview didn’t load because you don’t have permission. Please ask the file owner to update permissions.","error_refresh":"This preview didn’t load. Please try to open or download the file to view.","error_rate_limit":"This preview didn’t load because your request was rate limited. Please try to open or download the file to view.","error_reupload":"This preview didn’t load. Please try to open or download the file to view.","error_browser_unsupported":"Your browser doesn’t support preview for {1}. Please try to open or download the file to view.","error_document":"This preview didn’t load because the document may be protected. Please try to open or download the file to view.","error_password_protected":"This preview didn’t load because the document is protected. Please try to open or download the file to view.","error_try_again_later":"This preview didn’t load. Please refresh the page or download file to view.","error_bad_file":"This preview didn’t load. Please try to open or download the file to view.","error_not_downloadable":"Something seems to be wrong with this file. Please refresh the page, and if the issue continues, try to upload a new version.","error_flash_not_enabled":"This preview didn’t load because Flash is not enabled on your browser. Please try to enable Flash or download the file to view.","error_internet_explorer_office_online":"This version of Internet Explorer is out of date and the experience may be degraded. Please try switching to a different browser for a better experience.","error_large_file":"File exceeds supported size for preview. Open or download the file to view.","error_too_many_operations":"The file is too complex to display in your browser. Please download it to view.","error_zero_byte_file":"Cannot preview 0 B file. Open or download the file to view.","filename":"Name","last_modified_date":"Modified","size":"Size","search":"Search","search_results":"Search Results","search_placeholder":"Search files and folders","search_clear":"Clear search","breadcrumb":"Breadcrumb","breadcrumb_truncated":"Show hidden folders","media_autoplay":"Autoplay","media_autoplay_disabled":"Disabled","media_autoplay_enabled":"Enabled","media_play_next":"Play next file","media_play_next_disabled":"Disabled","media_play_next_enabled":"Enabled","media_speed":"Speed","media_speed_normal":"Normal","media_quality":"Quality","media_quality_auto":"Auto","media_guides":"Guides","media_guides_off":"Off","media_guides_default":"Default","media_guides_widescreen_hd":"Widescreen HD","media_guides_vertical":"Vertical","media_guides_square":"Square","media_guides_social_portrait":"Social Portrait","media_guides_cinemascope":"Cinemascope","media_guides_univisium":"Univisium","media_guides_cinema_flat":"Cinema Flat","media_guides_scope":"Scope","media_guides_fullscreen":"Fullscreen","media_guides_ultrawide":"Ultrawide","media_volume_slider":"Volume Slider","media_generating_waveform":"Generating waveform","media_loading":"Loading","media_zoom":"Zoom","media_zoom_slider":"Zoom Slider","media_time_slider":"Media Slider","media_comment_marker":"Comment marker","media_range_comment":"Comment","media_range_clear":"Clear","media_shuttle_forward":"Scanning forward at {1}x","media_shuttle_reverse":"Scanning backward at {1}x","media_mute":"Mute","media_unmute":"Unmute","media_play":"Play","media_pause":"Pause","media_skip_forward":"Skip forward","media_skip_backward":"Skip backward","media_settings":"Settings","media_subtitles_cc":"Subtitles/Closed Captions","media_time_format":"Time format","media_time_format_standard":"Standard time","media_time_format_timecode":"Timecode","media_time_format_frames":"Frame numbers","volume":"Volume","of":"of","subtitles":"Subtitles","off":"Off","media_audio":"Audio","track":"Track","media_auto_generated_captions":"Auto-Generated Captions","auto_generated":"Auto-Generated","box3d_animation_clips":"Animation clips","box3d_camera_projection_perspective":"Perspective","box3d_camera_projection_orthographic":"Orthographic","box3d_reset":"Reset","box3d_toggle_animation":"Play/pause animation","box3d_toggle_vr":"Toggle VR display","box3d_render_mode_lit":"Lit","box3d_render_mode_unlit":"Unlit","box3d_render_mode_normals":"Normals","box3d_render_mode_shape":"Shape","box3d_render_mode_uv_overlay":"UV Overlay","box3d_settings":"Settings","box3d_settings_render_label":"Render mode","box3d_settings_grid_label":"Show grid","box3d_settings_wireframes_label":"Show wireframes","box3d_settings_skeletons_label":"Show skeletons","box3d_settings_projection_label":"Camera Projection","box3d_settings_rotate_label":"Rotate Model","box3d_settings_rotate_left":"Rotate left around {1} axis","box3d_settings_rotate_right":"Rotate right around {1} axis","document_label":"Document Viewer","annotation_add_comment_placeholder":"Add a comment here...","annotation_reply_placeholder":"Post a reply...","annotation_done":"Done","annotation_close":"Close","annotation_cancel":"Cancel","annotation_save":"Save","annotation_post":"Post","annotation_delete":"Delete","annotation_delete_confirmation_message":"Delete this annotation?","annotation_profile_alt":"Avatar","annotation_anonymous_user_name":"Some User","annotation_posting_message":"Posting...","annotation_point_toggle":"Point annotation mode","annotation_draw_toggle":"Drawing annotation mode","annotation_highlight_toggle":"Highlight text","annotation_highlight_comment":"Add comment to highlighted text","annotation_who_highlighted":"{1} highlighted","annotation_who_drew":"{1} drew","annotation_draw_save":"Save drawing","annotation_draw_delete":"Delete drawing","annotations_load_error":"Annotations could not be loaded for this file. Please refresh the page to try again.","annotations_create_error":"This annotation could not be created. Please try again.","annotations_delete_error":"This annotation could not be deleted. Please try again.","annotations_authorization_error":"Annotations could not be loaded for this file. You may not have permission to take this action.","notification_button_default_text":"Okay","notification_button_default_label":"Clear Notification","notification_annotation_point_mode":"Click anywhere to add a comment to the document","notification_annotation_draw_mode":"Press down and drag the pointer to draw on the document","notification_degraded_preview":"Your connection to {1} is being blocked. Please reach out to your network admin to adjust firewall settings.","notification_cannot_download":"This file could not be downloaded.","notification_cannot_download_due_to_policy":"The file could not be downloaded due to a security policy.","link_contact_us":"Contact Us","360_videos":"360-degree videos","360_images":"360-degree images","3d_models":"3D models","afrikaans":"Afrikaans","albanian":"Albanian","arabic":"Arabic","armenian":"Armenian","belarusian":"Belarusian","bengali":"Bengali","bosnian":"Bosnian","bulgarian":"Bulgarian","burmese":"Burmese","catalan":"Catalan","central_khmer":"Central Khmer","chinese":"Chinese","croatian":"Croatian","czech":"Czech","danish":"Danish","dutch":"Dutch","english":"English","estonian":"Estonian","filipino":"Filipino","finnish":"Finnish","french":"French","galician":"Galician","ganda":"Ganda","georgian":"Georgian","german":"German","haitian_creole":"Haitian Creole","hebrew":"Hebrew","hindi":"Hindi","hmong":"Hmong","hungarian":"Hungarian","icelandic":"Icelandic","indonesian":"Indonesian","irish":"Irish","italian":"Italian","japanese":"Japanese","kazakh":"Kazakh","korean":"Korean","kurdish":"Kurdish","lao":"Lao","latvian":"Latvian","lithuanian":"Lithuanian","luxembourgish":"Luxembourgish","malay_macrolanguage":"Malay","modern_greek_1453_":"Greek","mongolian":"Mongolian","norwegian":"Norwegian","persian":"Persian","polish":"Polish","portuguese":"Portuguese","romanian":"Romanian","russian":"Russian","serbian":"Serbian","sichuan_yi":"Sichuan Yi","sicilian":"Sicilian","slovak":"Slovak","slovenian":"Slovenian","somali":"Somali","spanish":"Spanish","swahili_macrolanguage":"Swahili","swedish":"Swedish","swiss_german":"Swiss German","tagalog":"Tagalog","telugu":"Telugu","thai":"Thai","tibetan":"Tibetan","turkish":"Turkish","ukrainian":"Ukrainian","uzbek":"Uzbek","vietnamese":"Vietnamese"} : {};
1116
1198
  let language = true ? "en-US" : 0;
1117
1199
  let strings = defaultStrings;
1118
1200
  function getLanguage() {
@@ -1215,7 +1297,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
1215
1297
  const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
1216
1298
  const CLIENT_NAME_KEY = 'box_client_name';
1217
1299
  const CLIENT_VERSION_KEY = 'box_client_version';
1218
- const CLIENT_VERSION = "3.123.0"; // eslint-disable-line no-undef
1300
+ const CLIENT_VERSION = "3.124.0"; // eslint-disable-line no-undef
1219
1301
  const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
1220
1302
  const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
1221
1303
  const PROMISE_MAP = {};
@@ -6996,7 +7078,7 @@ function SkipButton({
6996
7078
 
6997
7079
  /***/ },
6998
7080
 
6999
- /***/ 3308
7081
+ /***/ 3904
7000
7082
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7001
7083
 
7002
7084
 
@@ -7028,71 +7110,8 @@ var IconChevronDownMedium24 = __webpack_require__(8668);
7028
7110
  var IconChevronUpMedium24 = __webpack_require__(2155);
7029
7111
  // EXTERNAL MODULE: ./src/lib/viewers/controls/hooks/useClickOutside.ts
7030
7112
  var useClickOutside = __webpack_require__(2959);
7031
- ;// ./src/lib/TabularDigits.scss
7032
- // extracted by mini-css-extract-plugin
7033
-
7034
- ;// ./src/lib/TabularDigits.tsx
7035
- /* unused harmony import specifier */ var React;
7036
-
7037
-
7038
-
7039
- // The Inter subset served to the app has no tabular figures, so `font-variant-numeric: tabular-nums`
7040
- // has no effect. Wrapping each digit in a 1ch box keeps changing numbers, and whatever follows them,
7041
- // from shifting as they update.
7042
- const TABULAR_DIGIT_CLASS = 'bp-TabularDigit';
7043
- const isDigit = char => char >= '0' && char <= '9';
7044
- const isDigitNode = node => node.nodeType === Node.ELEMENT_NODE;
7045
-
7046
- /**
7047
- * Writes `text` into `el` with each digit in a fixed-width box. For labels updated outside React,
7048
- * e.g. on animation frames. Unchanged characters are left in place, so a ticking clock only touches
7049
- * the digits that changed.
7050
- */
7051
- function renderTabularDigits(el, text) {
7052
- if (el.textContent === text) {
7053
- return;
7054
- }
7055
- const chars = Array.from(text);
7056
- const nodes = el.childNodes;
7057
- const canPatch = nodes.length === chars.length && chars.every((char, index) => isDigit(char) === isDigitNode(nodes[index]));
7058
- if (canPatch) {
7059
- chars.forEach((char, index) => {
7060
- if (nodes[index].textContent !== char) {
7061
- nodes[index].textContent = char;
7062
- }
7063
- });
7064
- return;
7065
- }
7066
- const fragment = document.createDocumentFragment();
7067
- chars.forEach(char => {
7068
- if (isDigit(char)) {
7069
- const digitEl = document.createElement('span');
7070
- digitEl.className = TABULAR_DIGIT_CLASS;
7071
- digitEl.textContent = char;
7072
- fragment.appendChild(digitEl);
7073
- } else {
7074
- fragment.appendChild(document.createTextNode(char));
7075
- }
7076
- });
7077
- el.replaceChildren(fragment);
7078
- }
7079
- /**
7080
- * Renders `children` with each digit in a fixed-width box. Place it inside the element that
7081
- * provides the typography, e.g. `<Text as="span"><TabularDigits>{label}</TabularDigits></Text>`.
7082
- */
7083
- function TabularDigits({
7084
- children
7085
- }) {
7086
- const elRef = React.useRef(null);
7087
- React.useLayoutEffect(() => {
7088
- if (elRef.current) {
7089
- renderTabularDigits(elRef.current, children);
7090
- }
7091
- }, [children]);
7092
- return /*#__PURE__*/React.createElement("span", {
7093
- ref: elRef
7094
- });
7095
- }
7113
+ // EXTERNAL MODULE: ./src/lib/TabularDigits.tsx + 1 modules
7114
+ var TabularDigits = __webpack_require__(2459);
7096
7115
  // EXTERNAL MODULE: ./src/lib/viewers/media/videoFps.ts
7097
7116
  var videoFps = __webpack_require__(3234);
7098
7117
  // EXTERNAL MODULE: ./src/lib/BlueprintProviders.tsx
@@ -7197,7 +7216,7 @@ function TimestampControl({
7197
7216
  if (currentElRef.current && mediaEl) {
7198
7217
  const label = formatLabel(mediaEl.currentTime, format, fps);
7199
7218
  if (isBlueprintEnabled) {
7200
- renderTabularDigits(currentElRef.current, label);
7219
+ (0,TabularDigits/* renderTabularDigits */.k7)(currentElRef.current, label);
7201
7220
  } else {
7202
7221
  currentElRef.current.textContent = label;
7203
7222
  }
@@ -7227,13 +7246,13 @@ function TimestampControl({
7227
7246
  // The animation frame loop owns the label while a frame-accurate format is playing.
7228
7247
  const isFrameLoopRunning = format !== TimeFormat.STANDARD && mediaEl?.paused === false;
7229
7248
  if (isBlueprintEnabled && currentElRef.current && !isFrameLoopRunning) {
7230
- renderTabularDigits(currentElRef.current, currentLabel);
7249
+ (0,TabularDigits/* renderTabularDigits */.k7)(currentElRef.current, currentLabel);
7231
7250
  }
7232
7251
  }, [currentLabel, format, isBlueprintEnabled, mediaEl]);
7233
7252
  const durationLabel = formatLabel(durationTime, format, fps);
7234
7253
  external_react_["default"].useLayoutEffect(() => {
7235
7254
  if (isBlueprintEnabled && durationElRef.current) {
7236
- renderTabularDigits(durationElRef.current, durationLabel);
7255
+ (0,TabularDigits/* renderTabularDigits */.k7)(durationElRef.current, durationLabel);
7237
7256
  }
7238
7257
  }, [durationLabel, isBlueprintEnabled, isNarrowWidth]);
7239
7258
  const handleKeyDown = event => {
@@ -9365,8 +9384,8 @@ var MediaSettingsV2 = __webpack_require__(4027);
9365
9384
  var PlayOverlayIcon = __webpack_require__(2048);
9366
9385
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayPauseToggle.tsx + 1 modules
9367
9386
  var PlayPauseToggle = __webpack_require__(6321);
9368
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
9369
- var TimestampControl = __webpack_require__(3308);
9387
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
9388
+ var TimestampControl = __webpack_require__(3904);
9370
9389
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
9371
9390
  var utils = __webpack_require__(5346);
9372
9391
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/VolumeControls.tsx + 8 modules
@@ -21633,7 +21652,7 @@ var x = (y) => {
21633
21652
  var x = {}; __webpack_require__.d(x, y); return x
21634
21653
  }
21635
21654
  var y = (x) => (() => (x))
21636
- module.exports = x({ ["Component"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.Component), ["createElement"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createElement), ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_react__["default"]), ["forwardRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.forwardRef), ["useCallback"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useCallback), ["useEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useEffect), ["useId"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useId), ["useImperativeHandle"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle), ["useLayoutEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect), ["useMemo"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useMemo), ["useReducer"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useReducer), ["useRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef), ["useState"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useState) });
21655
+ module.exports = x({ ["Component"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.Component), ["createElement"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createElement), ["createRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.createRef), ["default"]: () => (__WEBPACK_EXTERNAL_MODULE_react__["default"]), ["forwardRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.forwardRef), ["useCallback"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useCallback), ["useEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useEffect), ["useId"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useId), ["useImperativeHandle"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle), ["useLayoutEffect"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useLayoutEffect), ["useMemo"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useMemo), ["useReducer"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useReducer), ["useRef"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef), ["useState"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useState) });
21637
21656
 
21638
21657
  /***/ },
21639
21658
 
@@ -37254,7 +37273,7 @@ var isNpmBuild = __webpack_require__(8080);
37254
37273
  ;// ./src/lib/Logger.js
37255
37274
  /* eslint-disable no-undef */
37256
37275
  const CLIENT_NAME = "box-content-preview";
37257
- const CLIENT_VERSION = "3.123.0";
37276
+ const CLIENT_VERSION = "3.124.0";
37258
37277
  /* eslint-enable no-undef */
37259
37278
 
37260
37279
  class Logger {
@@ -40589,7 +40608,7 @@ class ImageBaseViewer extends viewers_BaseViewer {
40589
40608
  this.zoomOut();
40590
40609
  return true;
40591
40610
  }
40592
- return false;
40611
+ return this.handleFullscreenKey(key);
40593
40612
  }
40594
40613
 
40595
40614
  /**
@@ -41405,265 +41424,1332 @@ function ImageControls({
41405
41424
  onAnnotationColorChange: onAnnotationColorChange
41406
41425
  })));
41407
41426
  }
41408
- ;// ./src/lib/viewers/image/Image.scss
41427
+ // EXTERNAL MODULE: external "@box/blueprint-web"
41428
+ var blueprint_web_ = __webpack_require__(8912);
41429
+ ;// external "@box/blueprint-web-assets/icons/Medium/XMark"
41430
+
41431
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.scss
41409
41432
  // extracted by mini-css-extract-plugin
41410
41433
 
41411
- ;// ./src/lib/viewers/image/ImageViewer.js
41434
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.tsx
41435
+ /* provided dependency */ var AnnotationsExitButtonV2_ = __webpack_require__(441)["Tl"];
41412
41436
 
41413
41437
 
41414
41438
 
41415
41439
 
41440
+ function AnnotationsExitButtonV2({
41441
+ onClick
41442
+ }) {
41443
+ return /*#__PURE__*/external_react_["default"].createElement("span", {
41444
+ className: "bp-AnnotationsControls-exitBtn"
41445
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
41446
+ content: AnnotationsExitButtonV2_('exit_annotations')
41447
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
41448
+ "aria-label": AnnotationsExitButtonV2_('exit_annotations'),
41449
+ "data-resin-target": "exit",
41450
+ "data-testid": "bp-annotations-controls-exit-btn",
41451
+ onClick: onClick
41452
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
41453
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__
41454
+ }))));
41455
+ }
41456
+ ;// external "@box/blueprint-web-assets/icons/Medium/Comment"
41416
41457
 
41458
+ ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.scss
41459
+ // extracted by mini-css-extract-plugin
41417
41460
 
41461
+ ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.tsx
41418
41462
 
41419
41463
 
41420
41464
 
41421
- const CSS_CLASS_IMAGE = 'bp-image';
41422
- const IMAGE_PADDING = 15;
41423
- const IMAGE_ZOOM_SCALE = 1.2;
41424
- class ImageViewer extends image_ImageBaseViewer {
41425
- /** @inheritdoc */
41426
- constructor(options) {
41427
- super(options);
41428
- this.api = options.api;
41465
+ // Blueprint's Tooltip writes its own data-state onto the element it wraps, which overwrites the
41466
+ // data-state Toolbar.ToggleItem uses for its selected styling, so the tooltip gets its own element.
41467
+ function ToggleTooltipV2({
41468
+ children,
41469
+ content,
41470
+ side
41471
+ }) {
41472
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
41473
+ content: content,
41474
+ side: side
41475
+ }, /*#__PURE__*/external_react_["default"].createElement("span", {
41476
+ className: "bp-ToggleTooltipV2"
41477
+ }, children));
41478
+ }
41479
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsToggleV2.tsx
41480
+ /* provided dependency */ var AnnotationsToggleV2_ = __webpack_require__(441)["Tl"];
41481
+ function AnnotationsToggleV2_extends() { return AnnotationsToggleV2_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; }, AnnotationsToggleV2_extends.apply(null, arguments); }
41429
41482
 
41430
- // Bind context for callbacks
41431
- this.applyCursorFtux = this.applyCursorFtux.bind(this);
41432
- this.finishLoading = this.finishLoading.bind(this);
41433
- this.getViewportDimensions = this.getViewportDimensions.bind(this);
41434
- this.handleAnnotationColorChange = this.handleAnnotationColorChange.bind(this);
41435
- this.handleAnnotationControlsClick = this.handleAnnotationControlsClick.bind(this);
41436
- this.handleAnnotationCreateEvent = this.handleAnnotationCreateEvent.bind(this);
41437
- this.handleAssetAndRepLoad = this.handleAssetAndRepLoad.bind(this);
41438
- this.handleImageDownloadError = this.handleImageDownloadError.bind(this);
41439
- this.handleZoomEvent = this.handleZoomEvent.bind(this);
41440
- this.rotateLeft = this.rotateLeft.bind(this);
41441
- this.updateDiscoverabilityResinTag = this.updateDiscoverabilityResinTag.bind(this);
41442
- this.updateExperiences = this.updateExperiences.bind(this);
41443
- this.updatePannability = this.updatePannability.bind(this);
41444
- this.annotationControlsFSM = new AnnotationControlsFSM(this.isDiscoverabilityEnabled() ? AnnotationState.REGION_TEMP : AnnotationState.NONE);
41445
- this.annotationControlsFSM.subscribe(this.applyCursorFtux);
41446
- this.annotationControlsFSM.subscribe(this.updateDiscoverabilityResinTag);
41447
- if (this.isMobile) {
41448
- this.handleOrientationChange = this.handleOrientationChange.bind(this);
41449
- }
41450
- }
41451
41483
 
41452
- /**
41453
- * [destructor]
41454
- *
41455
- * @return {void}
41456
- */
41457
- destroy() {
41458
- if (this.isDiscoverabilityEnabled()) {
41459
- this.removeListener('zoom', this.handleZoomEvent);
41460
- }
41461
41484
 
41462
- // Blob URLs stay allocated until revoked.
41463
- if (this.imageEl && this.imageEl.src && this.imageEl.src.startsWith('blob:')) {
41464
- URL.revokeObjectURL(this.imageEl.src);
41465
- }
41466
- super.destroy();
41467
- }
41468
41485
 
41469
- /**
41470
- * @inheritdoc
41471
- */
41472
- setup() {
41473
- if (this.isSetup) {
41474
- return;
41475
- }
41476
41486
 
41477
- // Call super() to set up common layout
41478
- super.setup();
41479
- this.wrapperEl = this.createViewer(document.createElement('div'));
41480
- this.wrapperEl.classList.add(CSS_CLASS_IMAGE);
41481
- this.imageEl = this.wrapperEl.appendChild(document.createElement('img'));
41482
- this.imageEl.setAttribute('data-page-number', 1);
41483
41487
 
41484
- // hides image tag until content is loaded
41485
- this.imageEl.classList.add(constants/* CLASS_INVISIBLE */.Zb);
41486
- this.currentRotationAngle = 0;
41487
- const fileName = get_default()(this.options, 'file.name');
41488
- this.imageEl.setAttribute('alt', fileName);
41489
- if (this.isDiscoverabilityEnabled()) {
41490
- this.addListener('zoom', this.handleZoomEvent);
41488
+
41489
+ // The toolbar parts throw outside a Toolbar.Root, so surfaces without one (the media bar) use a standalone button.
41490
+
41491
+ const TOGGLE_VALUE = 'annotations';
41492
+ function AnnotationsToggleV2(props, ref) {
41493
+ const {
41494
+ annotationMode = AnnotationMode.NONE,
41495
+ isExpanded,
41496
+ modes,
41497
+ onAnnotationModeClick = (noop_default()),
41498
+ onAnnotationModeEscape = (noop_default()),
41499
+ tooltipSide
41500
+ } = props;
41501
+ const [lastMode, setLastMode] = external_react_["default"].useState(null);
41502
+ const isActive = annotationMode !== AnnotationMode.NONE;
41503
+ const resumeMode = lastMode && modes.includes(lastMode) ? lastMode : modes[0];
41504
+ external_react_["default"].useEffect(() => {
41505
+ if (annotationMode !== AnnotationMode.NONE) {
41506
+ setLastMode(annotationMode);
41491
41507
  }
41492
- this.updateDiscoverabilityResinTag();
41493
- }
41508
+ }, [annotationMode]);
41494
41509
 
41495
- /**
41496
- * Loads an Image.
41497
- *
41498
- * @return {Promise}
41499
- */
41500
- load() {
41501
- super.load();
41502
- const {
41503
- representation,
41504
- viewer
41505
- } = this.options;
41506
- const template = representation.content.url_template;
41507
- this.bindDOMListeners();
41508
- const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
41509
- return this.getRepStatus().getPromise().then(() => {
41510
- this.startLoadTimer();
41511
- return this.fetchContentAsBlobUrl(contentUrl);
41512
- }).then(blobUrl => {
41513
- if (this.isDestroyed()) {
41514
- URL.revokeObjectURL(blobUrl);
41510
+ // Global event handlers
41511
+ external_react_["default"].useEffect(() => {
41512
+ const handleKeyDown = event => {
41513
+ if (event.key !== 'Escape') {
41515
41514
  return;
41516
41515
  }
41517
- this.imageEl.src = blobUrl;
41518
- if (this.imageEl.complete) {
41519
- this.finishLoading();
41520
- }
41521
- super.handleAssetAndRepLoad();
41522
- }).catch(this.handleAssetError);
41523
- }
41524
-
41525
- /**
41526
- * Loads the image to be viewed
41527
- *
41528
- * @override
41529
- * @return {void}
41530
- */
41531
- handleAssetAndRepLoad(downloadUrl) {
41532
- this.startLoadTimer();
41533
- this.imageEl.src = downloadUrl;
41534
- if (this.imageEl.complete) {
41535
- this.finishLoading();
41516
+ event.preventDefault();
41517
+ event.stopPropagation();
41518
+ onAnnotationModeEscape();
41519
+ };
41520
+ if (annotationMode !== AnnotationMode.NONE) {
41521
+ document.addEventListener('keydown', handleKeyDown);
41536
41522
  }
41537
- super.handleAssetAndRepLoad();
41538
- }
41539
- finishLoading() {
41540
- this.hidePreviewMask();
41541
- this.emitFirstRenderMetric();
41542
- return super.finishLoading();
41523
+ return () => {
41524
+ document.removeEventListener('keydown', handleKeyDown);
41525
+ };
41526
+ }, [annotationMode, onAnnotationModeEscape]);
41527
+ if (!resumeMode) {
41528
+ return null;
41543
41529
  }
41544
-
41545
- /**
41546
- * Emits first render time metric.
41547
- * Overrides base implementation to use BaseViewer's emitMetric(event, data) format.
41548
- *
41549
- * @protected
41550
- * @return {void}
41551
- */
41552
- emitFirstRenderMetric() {
41553
- if (this.isDestroyed() || this.firstRenderEmitted) {
41554
- return;
41555
- }
41530
+ const handleToggle = isPressed => {
41531
+ onAnnotationModeClick({
41532
+ mode: isPressed ? resumeMode : AnnotationMode.NONE
41533
+ });
41534
+ };
41535
+ const toggleProps = {
41536
+ ref,
41537
+ 'aria-expanded': isExpanded ?? isActive,
41538
+ 'aria-label': AnnotationsToggleV2_('annotation_tools'),
41539
+ 'data-resin-target': 'annotations',
41540
+ 'data-testid': 'bp-AnnotationsControls-toggleBtn',
41541
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__
41542
+ };
41543
+ const renderToggle = toggle => /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
41544
+ content: AnnotationsToggleV2_('annotation_tools'),
41545
+ side: tooltipSide
41546
+ }, toggle);
41547
+ if (props.buttonType === 'icon') {
41556
41548
  const {
41557
- file
41558
- } = this.options;
41559
- const tag = lib_Timer.createTag(file.id, lib_events/* FIRST_RENDER_METRIC */.VT);
41560
- const time = lib_Timer.stop(tag);
41561
- if (time && time.elapsed) {
41562
- this.emitMetric(lib_events/* LOAD_METRIC */.Yy.firstRenderTime, time.elapsed);
41563
- this.firstRenderEmitted = true;
41564
- }
41549
+ className,
41550
+ size,
41551
+ variant
41552
+ } = props;
41553
+ return renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconToggleButton, AnnotationsToggleV2_extends({}, toggleProps, {
41554
+ className: className,
41555
+ onPressedChange: handleToggle,
41556
+ pressed: isActive,
41557
+ size: size,
41558
+ variant: variant
41559
+ })));
41565
41560
  }
41561
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
41562
+ onValueChange: value => handleToggle(value.includes(TOGGLE_VALUE)),
41563
+ type: "multiple",
41564
+ value: isActive ? [TOGGLE_VALUE] : []
41565
+ }, renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, AnnotationsToggleV2_extends({}, toggleProps, {
41566
+ value: TOGGLE_VALUE
41567
+ }))));
41568
+ }
41569
+ /* harmony default export */ const annotations_AnnotationsToggleV2 = (/*#__PURE__*/external_react_["default"].forwardRef(AnnotationsToggleV2));
41570
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsControlsV2.tsx
41571
+ const AnnotationsControlsV2_excluded = ["onAnnotationModeClick"];
41572
+ function AnnotationsControlsV2_extends() { return AnnotationsControlsV2_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; }, AnnotationsControlsV2_extends.apply(null, arguments); }
41573
+ function AnnotationsControlsV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = AnnotationsControlsV2_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; }
41574
+ function AnnotationsControlsV2_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; }
41566
41575
 
41567
- /**
41568
- * Prefetches assets for an image.
41569
- *
41570
- * @param {boolean} [options.content] - Whether or not to prefetch rep content
41571
- * @return {void}
41572
- */
41573
- prefetch({
41574
- content = true,
41575
- preload = false
41576
- } = {}) {
41577
- const {
41578
- file,
41579
- representation,
41580
- viewer
41581
- } = this.options;
41582
- const isWatermarked = file && file.watermark_info && file.watermark_info.is_watermarked;
41583
- if ((content || preload) && !isWatermarked && this.isRepresentationReady(representation)) {
41584
- const template = representation.content.url_template;
41585
- const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
41586
- this.api.get(contentUrl, {
41587
- type: 'blob',
41588
- headers: this.appendAuthHeader()
41589
- }).catch(err => {
41590
- console.warn('Image prefetch failed', err); // eslint-disable-line no-console
41591
- });
41592
- }
41593
- }
41594
41576
 
41595
- /**
41596
- * Can the viewer currently be panned
41597
- *
41598
- * @private
41599
- * @return {void}
41600
- */
41601
- updatePannability() {
41602
- if (!this.imageEl) {
41603
- return;
41604
- }
41605
- if (this.isRotated()) {
41606
- this.isPannable = this.imageEl.height > this.wrapperEl.clientWidth || this.imageEl.width > this.wrapperEl.clientHeight;
41607
- } else {
41608
- this.isPannable = this.imageEl.width > this.wrapperEl.clientWidth || this.imageEl.height > this.wrapperEl.clientHeight;
41609
- }
41610
- this.didPan = false;
41611
- this.updateCursor();
41612
- }
41613
41577
 
41614
- /**
41615
- * Rotate image anti-clockwise by 90 degrees
41616
- *
41617
- * @return {void}
41618
- */
41619
- rotateLeft() {
41620
- this.currentRotationAngle = (this.currentRotationAngle - 90) % 3600 % 360;
41621
- this.imageEl.setAttribute('data-rotation-angle', this.currentRotationAngle);
41622
- this.imageEl.style.transform = `rotate(${this.currentRotationAngle}deg)`;
41623
- this.emit('rotate');
41624
41578
 
41625
- // Re-adjust image position after rotation
41626
- this.handleOrientationChange();
41627
- this.setScale(this.imageEl.offsetwidth, this.imageEl.offsetHeight);
41628
- }
41629
41579
 
41630
- // Annotation overrides
41631
- getInitialAnnotationMode() {
41632
- return this.isDiscoverabilityEnabled() ? AnnotationMode.REGION : AnnotationMode.NONE;
41633
- }
41580
+ // The markup controls at the end of a Blueprint controls bar
41581
+ function AnnotationsControlsV2(_ref) {
41582
+ let {
41583
+ onAnnotationModeClick
41584
+ } = _ref,
41585
+ rest = AnnotationsControlsV2_objectWithoutProperties(_ref, AnnotationsControlsV2_excluded);
41586
+ const toggleRef = external_react_["default"].useRef(null);
41587
+ const handleExit = () => {
41588
+ toggleRef.current?.focus();
41589
+ onAnnotationModeClick?.({
41590
+ mode: AnnotationMode.NONE
41591
+ });
41592
+ };
41593
+ return /*#__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, {
41594
+ onClick: handleExit
41595
+ }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, AnnotationsControlsV2_extends({
41596
+ ref: toggleRef,
41597
+ onAnnotationModeClick: onAnnotationModeClick
41598
+ }, rest)));
41599
+ }
41600
+ ;// external "@box/blueprint-web-assets/icons/Medium/PencilTip"
41634
41601
 
41635
- /**
41636
- * Gets the width & height after the transforms are applied.
41637
- * When an image is rotated, the width & height of an image, e.g. offsetWidth & offsetHeight,
41638
- * are the values before transforms are applied, so if the image is rotated we need to swap the
41639
- * width & height
41640
- *
41641
- * @private
41642
- * @param {number} [width] - The width in px
41643
- * @param {number} [height] - The height in px
41644
- * @param {boolean} [isRotated] - if the image has a transform rotate applied to it
41645
- * @return {Object} the width & height of the image after tranformations
41646
- */
41647
- getTransformWidthAndHeight(width, height, isRotated) {
41648
- if (isRotated) {
41649
- return {
41650
- width: height,
41651
- height: width
41652
- };
41653
- }
41654
- return {
41655
- width,
41656
- height
41657
- };
41658
- }
41602
+ ;// external "@box/blueprint-web-assets/icons/Medium/SquarePlus"
41659
41603
 
41660
- /**
41661
- * Gets the viewport dimensions.
41662
- *
41663
- * @return {Object} the width & height of the viewport
41664
- */
41665
- getViewportDimensions() {
41666
- return {
41604
+ ;// external "@box/blueprint-web-assets/icons/Medium/TCursorHighlight"
41605
+
41606
+ ;// ./src/lib/viewers/controls/annotations/annotationModeIcons.ts
41607
+
41608
+
41609
+
41610
+
41611
+ const ANNOTATION_MODE_ICONS = {
41612
+ [AnnotationMode.DRAWING]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__,
41613
+ [AnnotationMode.HIGHLIGHT]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__,
41614
+ [AnnotationMode.REGION]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__
41615
+ };
41616
+ /* harmony default export */ const annotationModeIcons = (ANNOTATION_MODE_ICONS);
41617
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.tsx
41618
+ const ControlsBarV2_excluded = ["children"];
41619
+ function ControlsBarV2_extends() { return ControlsBarV2_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; }, ControlsBarV2_extends.apply(null, arguments); }
41620
+ function ControlsBarV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsBarV2_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; }
41621
+ function ControlsBarV2_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; }
41622
+
41623
+
41624
+ function ControlsBarV2(_ref, ref) {
41625
+ let {
41626
+ children
41627
+ } = _ref,
41628
+ rest = ControlsBarV2_objectWithoutProperties(_ref, ControlsBarV2_excluded);
41629
+ if (!children) {
41630
+ return null;
41631
+ }
41632
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, ControlsBarV2_extends({
41633
+ ref: ref,
41634
+ colorScheme: "dark",
41635
+ "data-testid": "bp-ControlsBar"
41636
+ }, rest), children);
41637
+ }
41638
+ /* harmony default export */ const controls_bar_ControlsBarV2 = (/*#__PURE__*/external_react_["default"].forwardRef(ControlsBarV2));
41639
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.scss
41640
+ // extracted by mini-css-extract-plugin
41641
+
41642
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.tsx
41643
+ /* provided dependency */ var AnnotationsPaletteV2_ = __webpack_require__(441)["Tl"];
41644
+ function AnnotationsPaletteV2_extends() { return AnnotationsPaletteV2_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; }, AnnotationsPaletteV2_extends.apply(null, arguments); }
41645
+
41646
+
41647
+
41648
+
41649
+
41650
+
41651
+
41652
+
41653
+ function AnnotationsPaletteV2({
41654
+ children
41655
+ }) {
41656
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
41657
+ className: "bp-AnnotationsPaletteV2",
41658
+ "data-testid": "bp-AnnotationsPaletteV2"
41659
+ }, /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, null, children));
41660
+ }
41661
+ function Modes({
41662
+ annotationMode,
41663
+ children,
41664
+ onAnnotationModeClick = (noop_default())
41665
+ }) {
41666
+ // The single-select group reports an empty value when the active mode is clicked again. Exiting
41667
+ // is left to the trigger on the main bar, so the palette never closes under the cursor.
41668
+ const handleModeChange = mode => {
41669
+ if (!mode || mode === annotationMode) {
41670
+ return;
41671
+ }
41672
+ onAnnotationModeClick({
41673
+ mode: mode
41674
+ });
41675
+ };
41676
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
41677
+ "data-testid": "bp-annotations-controls",
41678
+ onValueChange: handleModeChange,
41679
+ type: "single",
41680
+ value: annotationMode
41681
+ }, children);
41682
+ }
41683
+ function Mode({
41684
+ value
41685
+ }) {
41686
+ const {
41687
+ label,
41688
+ resinTarget,
41689
+ testId
41690
+ } = {
41691
+ [AnnotationMode.DRAWING]: {
41692
+ label: AnnotationsPaletteV2_('drawing_comment'),
41693
+ resinTarget: 'draw',
41694
+ testId: 'bp-AnnotationsControls-drawBtn'
41695
+ },
41696
+ [AnnotationMode.HIGHLIGHT]: {
41697
+ label: AnnotationsPaletteV2_('highlight_text'),
41698
+ resinTarget: 'highlightText',
41699
+ testId: 'bp-AnnotationsControls-highlightBtn'
41700
+ },
41701
+ [AnnotationMode.REGION]: {
41702
+ label: AnnotationsPaletteV2_('region_comment'),
41703
+ resinTarget: 'highlightRegion',
41704
+ testId: 'bp-AnnotationsControls-regionBtn'
41705
+ }
41706
+ }[value];
41707
+ return /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
41708
+ content: label
41709
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
41710
+ "aria-label": label,
41711
+ "data-resin-target": resinTarget,
41712
+ "data-testid": testId,
41713
+ icon: annotationModeIcons[value],
41714
+ value: value
41715
+ }));
41716
+ }
41717
+ /* harmony default export */ const annotations_AnnotationsPaletteV2 = (AnnotationsPaletteV2_extends(AnnotationsPaletteV2, {
41718
+ Mode,
41719
+ Modes
41720
+ }));
41721
+ ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.scss
41722
+ // extracted by mini-css-extract-plugin
41723
+
41724
+ ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.tsx
41725
+ /* provided dependency */ var ColorPickerControlV2_ = __webpack_require__(441)["Tl"];
41726
+
41727
+
41728
+
41729
+
41730
+
41731
+ const getColorLabels = () => ({
41732
+ [AnnotationColor.BOX_BLUE]: ColorPickerControlV2_('drawing_color_blue'),
41733
+ [AnnotationColor.GREEN_LIGHT]: ColorPickerControlV2_('drawing_color_green'),
41734
+ [AnnotationColor.WATERMELON_RED]: ColorPickerControlV2_('drawing_color_red'),
41735
+ [AnnotationColor.YELLORANGE]: ColorPickerControlV2_('drawing_color_orange'),
41736
+ [AnnotationColor.YELLOW]: ColorPickerControlV2_('drawing_color_yellow'),
41737
+ [AnnotationColor.GRIMACE]: ColorPickerControlV2_('drawing_color_purple')
41738
+ });
41739
+ function ColorPickerControlV2({
41740
+ activeColor = __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__,
41741
+ colors,
41742
+ onColorSelect
41743
+ }) {
41744
+ const colorLabels = getColorLabels();
41745
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
41746
+ className: "bp-ColorPickerControlV2",
41747
+ "data-testid": "bp-color-picker-control"
41748
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Grid, {
41749
+ "aria-label": ColorPickerControlV2_('drawing_color'),
41750
+ columns: colors.length
41751
+ }, colors.map(color => /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Option.ColorCircle, {
41752
+ key: color,
41753
+ active: color === activeColor,
41754
+ "aria-label": colorLabels[color] || color,
41755
+ className: "bp-ColorPickerControlV2-swatch",
41756
+ color: color,
41757
+ "data-resin-target": "colorSelect",
41758
+ onClick: () => onColorSelect(color)
41759
+ }))));
41760
+ }
41761
+ ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteControlsV2.tsx
41762
+
41763
+
41764
+
41765
+
41766
+
41767
+
41768
+ // The palette opened by the markup toggle, with the drawing colors while drawing
41769
+ function AnnotationsPaletteControlsV2({
41770
+ annotationColor,
41771
+ annotationMode,
41772
+ modes,
41773
+ onAnnotationColorChange,
41774
+ onAnnotationModeClick
41775
+ }) {
41776
+ if (annotationMode === AnnotationMode.NONE || !modes.length) {
41777
+ return null;
41778
+ }
41779
+ return /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2, null, /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Modes, {
41780
+ annotationMode: annotationMode,
41781
+ onAnnotationModeClick: onAnnotationModeClick
41782
+ }, modes.map(mode => /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Mode, {
41783
+ key: mode,
41784
+ value: mode
41785
+ }))), annotationMode === AnnotationMode.DRAWING && /*#__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(ColorPickerControlV2, {
41786
+ activeColor: annotationColor,
41787
+ colors: ANNOTATION_COLORS,
41788
+ onColorSelect: onAnnotationColorChange
41789
+ })));
41790
+ }
41791
+ ;// ./src/lib/viewers/controls/annotations/useAnnotationModes.ts
41792
+
41793
+
41794
+ // Listed in the palette's button order, which is also the order the toggle falls back to. Annotating is
41795
+ // unavailable in fullscreen, so no modes are offered there.
41796
+ function useAnnotationModes({
41797
+ hasDrawing,
41798
+ hasHighlight,
41799
+ hasRegion
41800
+ }) {
41801
+ const isFullscreen = useFullscreen();
41802
+ const modes = [];
41803
+ if (isFullscreen) {
41804
+ return modes;
41805
+ }
41806
+ if (hasRegion) {
41807
+ modes.push(AnnotationMode.REGION);
41808
+ }
41809
+ if (hasHighlight) {
41810
+ modes.push(AnnotationMode.HIGHLIGHT);
41811
+ }
41812
+ if (hasDrawing) {
41813
+ modes.push(AnnotationMode.DRAWING);
41814
+ }
41815
+ return modes;
41816
+ }
41817
+ ;// external "@box/blueprint-web-assets/icons/Medium/EllipsisVertical"
41818
+
41819
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/tooltip/MenuTriggerTooltipV2.tsx
41820
+ var MenuTriggerTooltipV2 = __webpack_require__(6014);
41821
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/settings/stopMenuKeyPropagation.ts
41822
+ var stopMenuKeyPropagation = __webpack_require__(9646);
41823
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.scss
41824
+ // extracted by mini-css-extract-plugin
41825
+
41826
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.tsx
41827
+ /* provided dependency */ var ControlsOverflowMenuV2_ = __webpack_require__(441)["Tl"];
41828
+ function ControlsOverflowMenuV2_extends() { return ControlsOverflowMenuV2_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; }, ControlsOverflowMenuV2_extends.apply(null, arguments); }
41829
+
41830
+
41831
+
41832
+
41833
+
41834
+
41835
+
41836
+
41837
+ // Handlers that return focus to the control that invoked them get the trigger, since the row unmounts with the menu
41838
+ const ControlsOverflowTriggerContext = /*#__PURE__*/external_react_["default"].createContext({
41839
+ current: null
41840
+ });
41841
+
41842
+ // The menu portals out of the controls root, so it carries the root's Resin attributes itself
41843
+ const getResinAttributes = element => {
41844
+ const resinComponent = element?.closest('[data-resin-component]');
41845
+ return resinComponent ? Object.fromEntries(Array.from(resinComponent.attributes).filter(({
41846
+ name
41847
+ }) => name.startsWith('data-resin-')).map(({
41848
+ name,
41849
+ value
41850
+ }) => [name, value])) : {};
41851
+ };
41852
+ function ControlsOverflowToggle(props, ref) {
41853
+ const isMenuOpen = props['aria-expanded'] === true || props['aria-expanded'] === 'true';
41854
+ return /*#__PURE__*/external_react_["default"].createElement(MenuTriggerTooltipV2/* default */.A, {
41855
+ content: ControlsOverflowMenuV2_('controls_more'),
41856
+ isMenuOpen: isMenuOpen
41857
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, ControlsOverflowMenuV2_extends({
41858
+ ref: ref,
41859
+ "aria-label": ControlsOverflowMenuV2_('controls_more'),
41860
+ "data-resin-target": "moreOptions",
41861
+ "data-testid": "bp-ControlsBar-overflowBtn"
41862
+ }, props), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
41863
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__
41864
+ })));
41865
+ }
41866
+ const ControlsOverflowToggleV2 = /*#__PURE__*/external_react_["default"].forwardRef(ControlsOverflowToggle);
41867
+ function ControlsOverflowMenuV2({
41868
+ items
41869
+ }) {
41870
+ const container = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n) ?? undefined;
41871
+ const {
41872
+ setIsForced
41873
+ } = external_react_["default"].useContext(ControlsLayerContext);
41874
+ const triggerRef = external_react_["default"].useRef(null);
41875
+ const [isOpen, setIsOpen] = external_react_["default"].useState(false);
41876
+ const [resinAttributes, setResinAttributes] = external_react_["default"].useState({});
41877
+ const handleOpenChange = open => {
41878
+ if (open) {
41879
+ setResinAttributes(getResinAttributes(triggerRef.current));
41880
+ }
41881
+ setIsOpen(open);
41882
+ };
41883
+
41884
+ // The menu sits outside the controls layer, which would otherwise hide the bar under the open menu
41885
+ external_react_["default"].useEffect(() => {
41886
+ if (!isOpen) {
41887
+ return undefined;
41888
+ }
41889
+ setIsForced(true);
41890
+ return () => setIsForced(false);
41891
+ }, [isOpen, setIsForced]);
41892
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, {
41893
+ modal: false,
41894
+ onOpenChange: handleOpenChange,
41895
+ open: isOpen
41896
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
41897
+ ref: triggerRef,
41898
+ asChild: true,
41899
+ "data-overflow-ids": items.map(({
41900
+ id
41901
+ }) => id).join(' '),
41902
+ "data-overflow-trigger": ""
41903
+ }, /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowToggleV2, null)), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, ControlsOverflowMenuV2_extends({
41904
+ align: "end",
41905
+ className: "bp-ControlsOverflowMenuV2",
41906
+ container: container,
41907
+ "data-testid": "bp-ControlsBar-overflowMenu",
41908
+ onEscapeKeyDown: stopMenuKeyPropagation/* stopEscapePropagation */.s,
41909
+ onKeyDown: stopMenuKeyPropagation/* stopKeyPropagation */.a,
41910
+ side: "top"
41911
+ }, resinAttributes), /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowTriggerContext.Provider, {
41912
+ value: triggerRef
41913
+ }, items.map(({
41914
+ id,
41915
+ menu
41916
+ }) => /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, {
41917
+ key: id
41918
+ }, menu)))));
41919
+ }
41920
+ ;// ./src/lib/viewers/controls/controls-bar/useControlsOverflow.ts
41921
+
41922
+
41923
+
41924
+ const ALWAYS_OVERFLOW = 0;
41925
+ // The space the mocks leave between the bar and the edges of the viewer
41926
+ const EDGE_MARGIN = 40;
41927
+ // One toolbar button, the estimate for a control or the overflow trigger before it has been measured
41928
+ const DEFAULT_WIDTH = 32;
41929
+ const isCollapsible = ({
41930
+ menu,
41931
+ priority
41932
+ }) => !!menu && priority !== undefined;
41933
+ function getOverflowIds(items, availableWidth, metrics) {
41934
+ const {
41935
+ chrome,
41936
+ gap,
41937
+ triggerWidth = DEFAULT_WIDTH,
41938
+ widths
41939
+ } = metrics;
41940
+ const overflowIds = new Set(items.filter(item => isCollapsible(item) && item.priority === ALWAYS_OVERFLOW).map(({
41941
+ id
41942
+ }) => id));
41943
+ const getBarWidth = () => {
41944
+ const slots = items.filter(({
41945
+ id
41946
+ }) => !overflowIds.has(id)).map(({
41947
+ id
41948
+ }) => widths.get(id) ?? DEFAULT_WIDTH);
41949
+ if (overflowIds.size) {
41950
+ slots.push(triggerWidth);
41951
+ }
41952
+ return chrome + slots.reduce((total, width) => total + width, 0) + gap * Math.max(slots.length - 1, 0);
41953
+ };
41954
+ const priorities = items.filter(item => isCollapsible(item) && item.priority !== ALWAYS_OVERFLOW).map(({
41955
+ priority
41956
+ }) => priority).sort((a, b) => a - b);
41957
+ Array.from(new Set(priorities)).every(priority => {
41958
+ if (getBarWidth() <= availableWidth) {
41959
+ return false;
41960
+ }
41961
+ items.filter(item => isCollapsible(item) && item.priority === priority).forEach(({
41962
+ id
41963
+ }) => overflowIds.add(id));
41964
+ return true;
41965
+ });
41966
+ return overflowIds;
41967
+ }
41968
+ const getStyleWidth = (style, properties) => properties.reduce((total, property) => total + (parseFloat(style.getPropertyValue(property)) || 0), 0);
41969
+ function useControlsOverflow(items) {
41970
+ const barRef = external_react_["default"].useRef(null);
41971
+ const metricsRef = external_react_["default"].useRef({
41972
+ chrome: 0,
41973
+ gap: 0,
41974
+ widths: new Map()
41975
+ });
41976
+ const portalContainer = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n);
41977
+ const [availableWidth, setAvailableWidth] = external_react_["default"].useState(Number.POSITIVE_INFINITY);
41978
+ const [, forceUpdate] = external_react_["default"].useReducer(count => count + 1, 0);
41979
+
41980
+ // A control can only be measured while it is on the bar, so each width is cached as it renders and
41981
+ // reused to decide whether that control would fit again
41982
+ external_react_["default"].useLayoutEffect(() => {
41983
+ const bar = barRef.current;
41984
+ if (!bar) {
41985
+ return;
41986
+ }
41987
+ const metrics = metricsRef.current;
41988
+ const style = window.getComputedStyle(bar);
41989
+ const chrome = getStyleWidth(style, ['padding-left', 'padding-right', 'border-left-width', 'border-right-width']);
41990
+ const gap = getStyleWidth(style, ['column-gap']);
41991
+ let hasChanged = chrome !== metrics.chrome || gap !== metrics.gap;
41992
+ metrics.chrome = chrome;
41993
+ metrics.gap = gap;
41994
+ Array.from(bar.children).forEach(child => {
41995
+ const {
41996
+ offsetWidth
41997
+ } = child;
41998
+ const {
41999
+ overflowId,
42000
+ overflowTrigger
42001
+ } = child.dataset;
42002
+ if (!offsetWidth) {
42003
+ return;
42004
+ }
42005
+ if (overflowId && metrics.widths.get(overflowId) !== offsetWidth) {
42006
+ metrics.widths.set(overflowId, offsetWidth);
42007
+ hasChanged = true;
42008
+ }
42009
+ if (overflowTrigger !== undefined && metrics.triggerWidth !== offsetWidth) {
42010
+ metrics.triggerWidth = offsetWidth;
42011
+ hasChanged = true;
42012
+ }
42013
+ });
42014
+ if (hasChanged) {
42015
+ forceUpdate();
42016
+ }
42017
+ });
42018
+
42019
+ // The bar renders nothing without items, so the viewer lookup reruns once it mounts
42020
+ const hasItems = items.length > 0;
42021
+
42022
+ // The controls root is centered and shrinks to fit the bar, so the space the bar can grow into is the
42023
+ // viewer's. Fullscreen resizes the viewer too, which the observer picks up.
42024
+ external_react_["default"].useLayoutEffect(() => {
42025
+ const container = portalContainer ?? barRef.current?.closest(`.${constants/* CLASS_BOX_PREVIEW_CONTENT */.SG}`) ?? null;
42026
+ if (!container) {
42027
+ return undefined;
42028
+ }
42029
+ const updateAvailableWidth = () => {
42030
+ const {
42031
+ clientWidth
42032
+ } = container;
42033
+
42034
+ // A container that has not been laid out yet measures zero, which would collapse everything
42035
+ setAvailableWidth(clientWidth > 0 ? clientWidth - EDGE_MARGIN : Number.POSITIVE_INFINITY);
42036
+ };
42037
+ updateAvailableWidth();
42038
+ if (typeof ResizeObserver === 'undefined') {
42039
+ return undefined;
42040
+ }
42041
+ const observer = new ResizeObserver(updateAvailableWidth);
42042
+ observer.observe(container);
42043
+ return () => observer.disconnect();
42044
+ }, [hasItems, portalContainer]);
42045
+ const overflowIds = getOverflowIds(items, availableWidth, metricsRef.current);
42046
+ return {
42047
+ barRef,
42048
+ overflowItems: items.filter(({
42049
+ id
42050
+ }) => overflowIds.has(id)),
42051
+ visibleItems: items.filter(({
42052
+ id
42053
+ }) => !overflowIds.has(id))
42054
+ };
42055
+ }
42056
+ ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.scss
42057
+ // extracted by mini-css-extract-plugin
42058
+
42059
+ ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.tsx
42060
+
42061
+
42062
+
42063
+
42064
+
42065
+ // Moves controls into an overflow menu as the viewer narrows. Bars that always show everything, like the
42066
+ // annotations palette, use ControlsBarV2 directly.
42067
+ function ResponsiveControlsBarV2({
42068
+ items
42069
+ }) {
42070
+ const {
42071
+ barRef,
42072
+ overflowItems,
42073
+ visibleItems
42074
+ } = useControlsOverflow(items);
42075
+ if (!items.length) {
42076
+ return null;
42077
+ }
42078
+ return /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, {
42079
+ ref: barRef
42080
+ }, visibleItems.map(({
42081
+ control,
42082
+ id
42083
+ }) => /*#__PURE__*/external_react_["default"].createElement("div", {
42084
+ key: id,
42085
+ className: "bp-ResponsiveControlsBarV2-item",
42086
+ "data-overflow-id": id
42087
+ }, control)), overflowItems.length > 0 && /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowMenuV2, {
42088
+ items: overflowItems
42089
+ }));
42090
+ }
42091
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize"
42092
+
42093
+ ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize"
42094
+
42095
+ ;// ./src/lib/viewers/controls/fullscreen/FullscreenToggleV2.tsx
42096
+ /* provided dependency */ var FullscreenToggleV2_ = __webpack_require__(441)["Tl"];
42097
+ const FullscreenToggleV2_excluded = ["onFullscreenToggle"];
42098
+ 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); }
42099
+ 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; }
42100
+ 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; }
42101
+
42102
+
42103
+
42104
+
42105
+
42106
+ function FullscreenToggleV2(_ref) {
42107
+ let {
42108
+ onFullscreenToggle
42109
+ } = _ref,
42110
+ rest = FullscreenToggleV2_objectWithoutProperties(_ref, FullscreenToggleV2_excluded);
42111
+ const isFullscreen = useFullscreen();
42112
+ 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__;
42113
+ const label = isFullscreen ? FullscreenToggleV2_('exit_fullscreen') : FullscreenToggleV2_('enter_fullscreen');
42114
+ const handleClick = ({
42115
+ currentTarget
42116
+ }) => {
42117
+ onFullscreenToggle(!isFullscreen, currentTarget);
42118
+ };
42119
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42120
+ content: label
42121
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, FullscreenToggleV2_extends({
42122
+ "aria-label": label,
42123
+ "data-resin-target": "fullscreen",
42124
+ onClick: handleClick
42125
+ }, rest), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42126
+ icon: icon
42127
+ })));
42128
+ }
42129
+ ;// ./src/lib/viewers/controls/controls-bar/shortcuts.ts
42130
+ /* provided dependency */ var shortcuts_ = __webpack_require__(441)["Tl"];
42131
+
42132
+ // iPads report a Mac user agent, and their keyboards have the command key too
42133
+ const isApplePlatform = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
42134
+
42135
+ // Preview binds its shortcuts to both Cmd and Ctrl, so each platform is shown the modifier its keyboard labels
42136
+ function getShortcut(key) {
42137
+ return isApplePlatform() ? {
42138
+ keys: `Meta+${key}`,
42139
+ label: `⌘ + ${key}`
42140
+ } : {
42141
+ keys: `Control+${key}`,
42142
+ label: (0,util/* replacePlaceholders */.Lb)(shortcuts_('controls_shortcut_ctrl'), [key])
42143
+ };
42144
+ }
42145
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.scss
42146
+ // extracted by mini-css-extract-plugin
42147
+
42148
+ ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.tsx
42149
+ const ControlsMenuItemV2_excluded = ["bareKey", "icon", "keepOpen", "label", "onSelect", "shortcutKey"];
42150
+ function ControlsMenuItemV2_extends() { return ControlsMenuItemV2_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; }, ControlsMenuItemV2_extends.apply(null, arguments); }
42151
+ function ControlsMenuItemV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsMenuItemV2_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; }
42152
+ function ControlsMenuItemV2_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; }
42153
+
42154
+
42155
+
42156
+
42157
+
42158
+ // The menu form of a bar control. Toggles are plain rows whose label names the next action, since checkbox
42159
+ // rows reserve space for a checkmark that the mocks do not have.
42160
+ function ControlsMenuItemV2(_ref) {
42161
+ let {
42162
+ bareKey,
42163
+ icon,
42164
+ keepOpen,
42165
+ label,
42166
+ onSelect,
42167
+ shortcutKey
42168
+ } = _ref,
42169
+ rest = ControlsMenuItemV2_objectWithoutProperties(_ref, ControlsMenuItemV2_excluded);
42170
+ const triggerRef = external_react_["default"].useContext(ControlsOverflowTriggerContext);
42171
+ let shortcut = null;
42172
+ if (shortcutKey) {
42173
+ shortcut = getShortcut(shortcutKey);
42174
+ } else if (bareKey) {
42175
+ shortcut = {
42176
+ keys: bareKey,
42177
+ label: bareKey
42178
+ };
42179
+ }
42180
+ const handleSelect = event => {
42181
+ if (keepOpen) {
42182
+ event.preventDefault();
42183
+ }
42184
+ onSelect(triggerRef.current);
42185
+ };
42186
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, ControlsMenuItemV2_extends({
42187
+ "aria-keyshortcuts": shortcut?.keys,
42188
+ onSelect: handleSelect
42189
+ }, rest, {
42190
+ className: "bp-ControlsMenuItemV2"
42191
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
42192
+ icon: icon
42193
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
42194
+ label: label
42195
+ }), shortcut && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.EndElement, {
42196
+ "aria-hidden": true
42197
+ }, shortcut.label));
42198
+ }
42199
+ ;// ./src/lib/viewers/controls/fullscreen/FullscreenMenuItemV2.tsx
42200
+ /* provided dependency */ var FullscreenMenuItemV2_ = __webpack_require__(441)["Tl"];
42201
+
42202
+
42203
+
42204
+
42205
+
42206
+ // Viewers using this menu row bind F to fullscreen while the Blueprint controls bar is on
42207
+ function FullscreenMenuItemV2({
42208
+ onFullscreenToggle
42209
+ }) {
42210
+ const isFullscreen = useFullscreen();
42211
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42212
+ bareKey: "F",
42213
+ "data-resin-target": "fullscreen",
42214
+ 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__,
42215
+ label: isFullscreen ? FullscreenMenuItemV2_('exit_fullscreen') : FullscreenMenuItemV2_('enter_fullscreen'),
42216
+ onSelect: trigger => onFullscreenToggle(!isFullscreen, trigger)
42217
+ });
42218
+ }
42219
+ ;// external "@box/blueprint-web-assets/icons/Medium/RotateLeft"
42220
+
42221
+ ;// ./src/lib/viewers/controls/rotate/RotateControlV2.tsx
42222
+ /* provided dependency */ var RotateControlV2_ = __webpack_require__(441)["Tl"];
42223
+
42224
+
42225
+
42226
+ function RotateControlV2({
42227
+ onRotateLeft
42228
+ }) {
42229
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42230
+ content: RotateControlV2_('rotate_left')
42231
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42232
+ "aria-label": RotateControlV2_('rotate_left'),
42233
+ "data-resin-target": "rotate",
42234
+ onClick: onRotateLeft
42235
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42236
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__
42237
+ })));
42238
+ }
42239
+ ;// ./src/lib/viewers/controls/rotate/RotateMenuItemV2.tsx
42240
+
42241
+
42242
+
42243
+ // Viewers using this menu row bind R to rotate while the Blueprint controls bar is on
42244
+ function RotateMenuItemV2({
42245
+ label,
42246
+ onRotateLeft
42247
+ }) {
42248
+ return /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42249
+ bareKey: "R",
42250
+ "data-resin-target": "rotate",
42251
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__,
42252
+ label: label,
42253
+ onSelect: () => onRotateLeft()
42254
+ });
42255
+ }
42256
+ ;// external "@box/blueprint-web-assets/icons/Medium/Minus"
42257
+
42258
+ ;// external "@box/blueprint-web-assets/icons/Medium/Plus"
42259
+
42260
+ ;// ./src/lib/viewers/controls/zoom/ZoomControlsV2.tsx
42261
+ /* provided dependency */ var ZoomControlsV2_ = __webpack_require__(441)["Tl"];
42262
+
42263
+
42264
+
42265
+
42266
+
42267
+
42268
+ function getZoomState({
42269
+ maxScale = MAX_SCALE,
42270
+ minScale = MIN_SCALE,
42271
+ scale = 1
42272
+ }) {
42273
+ const currentScale = Math.round((scale + Number.EPSILON) * 100) / 100;
42274
+ const maxScaleValue = isFinite_default()(maxScale) ? Math.min(maxScale, MAX_SCALE) : MAX_SCALE;
42275
+ const minScaleValue = isFinite_default()(minScale) ? Math.max(minScale, MIN_SCALE) : MIN_SCALE;
42276
+ return {
42277
+ canZoomIn: currentScale < maxScaleValue,
42278
+ canZoomOut: currentScale > minScaleValue,
42279
+ currentScale
42280
+ };
42281
+ }
42282
+ function ZoomControlsV2({
42283
+ maxScale,
42284
+ minScale,
42285
+ onZoomIn,
42286
+ onZoomOut,
42287
+ resinTargetZoomIn = 'zoomIn',
42288
+ resinTargetZoomOut = 'zoomOut',
42289
+ scale
42290
+ }) {
42291
+ const {
42292
+ canZoomIn,
42293
+ canZoomOut,
42294
+ currentScale
42295
+ } = getZoomState({
42296
+ maxScale,
42297
+ minScale,
42298
+ scale
42299
+ });
42300
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42301
+ content: ZoomControlsV2_('zoom_out')
42302
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42303
+ "aria-label": ZoomControlsV2_('zoom_out'),
42304
+ "data-resin-target": resinTargetZoomOut,
42305
+ "data-testid": "bp-ZoomControls-out",
42306
+ disabled: !canZoomOut,
42307
+ onClick: onZoomOut
42308
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42309
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__
42310
+ }))), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
42311
+ as: "span",
42312
+ color: "textOnDarkDefault",
42313
+ "data-testid": "bp-ZoomControls-current",
42314
+ title: ZoomControlsV2_('zoom_current_scale'),
42315
+ variant: "bodyDefaultSemibold"
42316
+ }, `${Math.round(currentScale * 100)}%`), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
42317
+ content: ZoomControlsV2_('zoom_in')
42318
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
42319
+ "aria-label": ZoomControlsV2_('zoom_in'),
42320
+ "data-resin-target": resinTargetZoomIn,
42321
+ "data-testid": "bp-ZoomControls-in",
42322
+ disabled: !canZoomIn,
42323
+ onClick: onZoomIn
42324
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
42325
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__
42326
+ }))));
42327
+ }
42328
+ ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.scss
42329
+ // extracted by mini-css-extract-plugin
42330
+
42331
+ ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.tsx
42332
+ /* provided dependency */ var ZoomMenuItemsV2_ = __webpack_require__(441)["Tl"];
42333
+
42334
+
42335
+
42336
+
42337
+
42338
+
42339
+
42340
+
42341
+
42342
+ // The overflow menu form of the zoom controls: the current scale, then zoom in and zoom out
42343
+ function ZoomMenuItemsV2({
42344
+ maxScale,
42345
+ minScale,
42346
+ onZoomIn,
42347
+ onZoomOut,
42348
+ resinTargetZoomIn = 'zoomIn',
42349
+ resinTargetZoomOut = 'zoomOut',
42350
+ scale
42351
+ }) {
42352
+ const {
42353
+ canZoomIn,
42354
+ canZoomOut,
42355
+ currentScale
42356
+ } = getZoomState({
42357
+ maxScale,
42358
+ minScale,
42359
+ scale
42360
+ });
42361
+ const scaleLabel = (0,util/* replacePlaceholders */.Lb)(ZoomMenuItemsV2_('controls_zoom_scale'), [`${Math.round(currentScale * 100)}%`]);
42362
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
42363
+ as: "div",
42364
+ className: "bp-ZoomMenuItemsV2-scale",
42365
+ color: "textOnLightSecondary",
42366
+ "data-testid": "bp-ZoomMenuItems-scale",
42367
+ variant: "caption"
42368
+ }, scaleLabel), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42369
+ "data-resin-target": resinTargetZoomIn,
42370
+ "data-testid": "bp-ZoomControls-in-menuItem",
42371
+ disabled: !canZoomIn,
42372
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__,
42373
+ keepOpen: true,
42374
+ label: ZoomMenuItemsV2_('zoom_in'),
42375
+ onSelect: () => onZoomIn()
42376
+ }), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
42377
+ "data-resin-target": resinTargetZoomOut,
42378
+ "data-testid": "bp-ZoomControls-out-menuItem",
42379
+ disabled: !canZoomOut,
42380
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__,
42381
+ keepOpen: true,
42382
+ label: ZoomMenuItemsV2_('zoom_out'),
42383
+ onSelect: () => onZoomOut()
42384
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null));
42385
+ }
42386
+ ;// ./src/lib/viewers/image/ImageControlsV2.tsx
42387
+ /* provided dependency */ var ImageControlsV2_ = __webpack_require__(441)["Tl"];
42388
+
42389
+
42390
+
42391
+
42392
+
42393
+
42394
+
42395
+
42396
+
42397
+
42398
+
42399
+ // The same collapse order as documents: rotate, then fullscreen, then zoom. The markup trigger has no menu
42400
+ // form and never collapses.
42401
+ const PRIORITY = {
42402
+ fullscreen: 2,
42403
+ rotate: 1,
42404
+ zoom: 3
42405
+ };
42406
+ function ImageControlsV2({
42407
+ annotationColor,
42408
+ annotationMode = AnnotationMode.NONE,
42409
+ experiences,
42410
+ hasDrawing,
42411
+ hasHighlight,
42412
+ hasRegion,
42413
+ onAnnotationColorChange,
42414
+ onAnnotationModeClick = (noop_default()),
42415
+ onAnnotationModeEscape,
42416
+ onFullscreenToggle,
42417
+ onRotateLeft,
42418
+ onZoomIn,
42419
+ onZoomOut,
42420
+ scale
42421
+ }) {
42422
+ const annotationModes = useAnnotationModes({
42423
+ hasDrawing,
42424
+ hasHighlight,
42425
+ hasRegion
42426
+ });
42427
+ const hasAnnotations = annotationModes.length > 0;
42428
+ const zoomProps = {
42429
+ onZoomIn,
42430
+ onZoomOut,
42431
+ scale
42432
+ };
42433
+ const items = [{
42434
+ control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
42435
+ id: 'zoom',
42436
+ menu: /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
42437
+ priority: PRIORITY.zoom
42438
+ }, {
42439
+ control: /*#__PURE__*/external_react_["default"].createElement(RotateControlV2, {
42440
+ onRotateLeft: onRotateLeft
42441
+ }),
42442
+ id: 'rotate',
42443
+ menu: /*#__PURE__*/external_react_["default"].createElement(RotateMenuItemV2, {
42444
+ label: ImageControlsV2_('controls_rotate_image'),
42445
+ onRotateLeft: onRotateLeft
42446
+ }),
42447
+ priority: PRIORITY.rotate
42448
+ }, {
42449
+ control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
42450
+ onFullscreenToggle: onFullscreenToggle
42451
+ }),
42452
+ id: 'fullscreen',
42453
+ menu: /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
42454
+ onFullscreenToggle: onFullscreenToggle
42455
+ }),
42456
+ priority: PRIORITY.fullscreen
42457
+ }, hasAnnotations && {
42458
+ control: /*#__PURE__*/external_react_["default"].createElement(AnnotationsControlsV2, {
42459
+ annotationMode: annotationMode,
42460
+ modes: annotationModes,
42461
+ onAnnotationModeClick: onAnnotationModeClick,
42462
+ onAnnotationModeEscape: onAnnotationModeEscape
42463
+ }),
42464
+ id: 'annotations'
42465
+ }];
42466
+ return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
42467
+ experiences: experiences
42468
+ }, /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
42469
+ items: items.filter(item => !!item)
42470
+ }), hasAnnotations && /*#__PURE__*/external_react_["default"].createElement(AnnotationsPaletteControlsV2, {
42471
+ annotationColor: annotationColor,
42472
+ annotationMode: annotationMode,
42473
+ modes: annotationModes,
42474
+ onAnnotationColorChange: onAnnotationColorChange,
42475
+ onAnnotationModeClick: onAnnotationModeClick
42476
+ }));
42477
+ }
42478
+ ;// ./src/lib/viewers/image/Image.scss
42479
+ // extracted by mini-css-extract-plugin
42480
+
42481
+ ;// ./src/lib/viewers/image/ImageViewer.js
42482
+
42483
+
42484
+
42485
+
42486
+
42487
+
42488
+
42489
+
42490
+
42491
+
42492
+ const CSS_CLASS_IMAGE = 'bp-image';
42493
+ const IMAGE_PADDING = 15;
42494
+ const IMAGE_ZOOM_SCALE = 1.2;
42495
+ class ImageViewer extends image_ImageBaseViewer {
42496
+ /** @inheritdoc */
42497
+ constructor(options) {
42498
+ super(options);
42499
+ this.api = options.api;
42500
+
42501
+ // Bind context for callbacks
42502
+ this.applyCursorFtux = this.applyCursorFtux.bind(this);
42503
+ this.finishLoading = this.finishLoading.bind(this);
42504
+ this.getViewportDimensions = this.getViewportDimensions.bind(this);
42505
+ this.handleAnnotationColorChange = this.handleAnnotationColorChange.bind(this);
42506
+ this.handleAnnotationControlsClick = this.handleAnnotationControlsClick.bind(this);
42507
+ this.handleAnnotationCreateEvent = this.handleAnnotationCreateEvent.bind(this);
42508
+ this.handleAssetAndRepLoad = this.handleAssetAndRepLoad.bind(this);
42509
+ this.handleImageDownloadError = this.handleImageDownloadError.bind(this);
42510
+ this.handleZoomEvent = this.handleZoomEvent.bind(this);
42511
+ this.rotateLeft = this.rotateLeft.bind(this);
42512
+ this.updateDiscoverabilityResinTag = this.updateDiscoverabilityResinTag.bind(this);
42513
+ this.updateExperiences = this.updateExperiences.bind(this);
42514
+ this.updatePannability = this.updatePannability.bind(this);
42515
+ this.annotationControlsFSM = new AnnotationControlsFSM(this.isDiscoverabilityEnabled() ? AnnotationState.REGION_TEMP : AnnotationState.NONE);
42516
+ this.annotationControlsFSM.subscribe(this.applyCursorFtux);
42517
+ this.annotationControlsFSM.subscribe(this.updateDiscoverabilityResinTag);
42518
+ if (this.isMobile) {
42519
+ this.handleOrientationChange = this.handleOrientationChange.bind(this);
42520
+ }
42521
+ }
42522
+
42523
+ /**
42524
+ * [destructor]
42525
+ *
42526
+ * @return {void}
42527
+ */
42528
+ destroy() {
42529
+ if (this.isDiscoverabilityEnabled()) {
42530
+ this.removeListener('zoom', this.handleZoomEvent);
42531
+ }
42532
+
42533
+ // Blob URLs stay allocated until revoked.
42534
+ if (this.imageEl && this.imageEl.src && this.imageEl.src.startsWith('blob:')) {
42535
+ URL.revokeObjectURL(this.imageEl.src);
42536
+ }
42537
+ super.destroy();
42538
+ }
42539
+
42540
+ /**
42541
+ * @inheritdoc
42542
+ */
42543
+ setup() {
42544
+ if (this.isSetup) {
42545
+ return;
42546
+ }
42547
+
42548
+ // Call super() to set up common layout
42549
+ super.setup();
42550
+ this.wrapperEl = this.createViewer(document.createElement('div'));
42551
+ this.wrapperEl.classList.add(CSS_CLASS_IMAGE);
42552
+ this.imageEl = this.wrapperEl.appendChild(document.createElement('img'));
42553
+ this.imageEl.setAttribute('data-page-number', 1);
42554
+
42555
+ // hides image tag until content is loaded
42556
+ this.imageEl.classList.add(constants/* CLASS_INVISIBLE */.Zb);
42557
+ this.currentRotationAngle = 0;
42558
+ const fileName = get_default()(this.options, 'file.name');
42559
+ this.imageEl.setAttribute('alt', fileName);
42560
+ if (this.isDiscoverabilityEnabled()) {
42561
+ this.addListener('zoom', this.handleZoomEvent);
42562
+ }
42563
+ this.updateDiscoverabilityResinTag();
42564
+ }
42565
+
42566
+ /**
42567
+ * Loads an Image.
42568
+ *
42569
+ * @return {Promise}
42570
+ */
42571
+ load() {
42572
+ super.load();
42573
+ const {
42574
+ representation,
42575
+ viewer
42576
+ } = this.options;
42577
+ const template = representation.content.url_template;
42578
+ this.bindDOMListeners();
42579
+ const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
42580
+ return this.getRepStatus().getPromise().then(() => {
42581
+ this.startLoadTimer();
42582
+ return this.fetchContentAsBlobUrl(contentUrl);
42583
+ }).then(blobUrl => {
42584
+ if (this.isDestroyed()) {
42585
+ URL.revokeObjectURL(blobUrl);
42586
+ return;
42587
+ }
42588
+ this.imageEl.src = blobUrl;
42589
+ if (this.imageEl.complete) {
42590
+ this.finishLoading();
42591
+ }
42592
+ super.handleAssetAndRepLoad();
42593
+ }).catch(this.handleAssetError);
42594
+ }
42595
+
42596
+ /**
42597
+ * Loads the image to be viewed
42598
+ *
42599
+ * @override
42600
+ * @return {void}
42601
+ */
42602
+ handleAssetAndRepLoad(downloadUrl) {
42603
+ this.startLoadTimer();
42604
+ this.imageEl.src = downloadUrl;
42605
+ if (this.imageEl.complete) {
42606
+ this.finishLoading();
42607
+ }
42608
+ super.handleAssetAndRepLoad();
42609
+ }
42610
+ finishLoading() {
42611
+ this.hidePreviewMask();
42612
+ this.emitFirstRenderMetric();
42613
+ return super.finishLoading();
42614
+ }
42615
+
42616
+ /**
42617
+ * Emits first render time metric.
42618
+ * Overrides base implementation to use BaseViewer's emitMetric(event, data) format.
42619
+ *
42620
+ * @protected
42621
+ * @return {void}
42622
+ */
42623
+ emitFirstRenderMetric() {
42624
+ if (this.isDestroyed() || this.firstRenderEmitted) {
42625
+ return;
42626
+ }
42627
+ const {
42628
+ file
42629
+ } = this.options;
42630
+ const tag = lib_Timer.createTag(file.id, lib_events/* FIRST_RENDER_METRIC */.VT);
42631
+ const time = lib_Timer.stop(tag);
42632
+ if (time && time.elapsed) {
42633
+ this.emitMetric(lib_events/* LOAD_METRIC */.Yy.firstRenderTime, time.elapsed);
42634
+ this.firstRenderEmitted = true;
42635
+ }
42636
+ }
42637
+
42638
+ /**
42639
+ * Prefetches assets for an image.
42640
+ *
42641
+ * @param {boolean} [options.content] - Whether or not to prefetch rep content
42642
+ * @return {void}
42643
+ */
42644
+ prefetch({
42645
+ content = true,
42646
+ preload = false
42647
+ } = {}) {
42648
+ const {
42649
+ file,
42650
+ representation,
42651
+ viewer
42652
+ } = this.options;
42653
+ const isWatermarked = file && file.watermark_info && file.watermark_info.is_watermarked;
42654
+ if ((content || preload) && !isWatermarked && this.isRepresentationReady(representation)) {
42655
+ const template = representation.content.url_template;
42656
+ const contentUrl = this.createContentUrlV2(template, viewer.ASSET);
42657
+ this.api.get(contentUrl, {
42658
+ type: 'blob',
42659
+ headers: this.appendAuthHeader()
42660
+ }).catch(err => {
42661
+ console.warn('Image prefetch failed', err); // eslint-disable-line no-console
42662
+ });
42663
+ }
42664
+ }
42665
+
42666
+ /**
42667
+ * Can the viewer currently be panned
42668
+ *
42669
+ * @private
42670
+ * @return {void}
42671
+ */
42672
+ updatePannability() {
42673
+ if (!this.imageEl) {
42674
+ return;
42675
+ }
42676
+ if (this.isRotated()) {
42677
+ this.isPannable = this.imageEl.height > this.wrapperEl.clientWidth || this.imageEl.width > this.wrapperEl.clientHeight;
42678
+ } else {
42679
+ this.isPannable = this.imageEl.width > this.wrapperEl.clientWidth || this.imageEl.height > this.wrapperEl.clientHeight;
42680
+ }
42681
+ this.didPan = false;
42682
+ this.updateCursor();
42683
+ }
42684
+
42685
+ /**
42686
+ * Rotate image anti-clockwise by 90 degrees
42687
+ *
42688
+ * @return {void}
42689
+ */
42690
+ rotateLeft() {
42691
+ this.currentRotationAngle = (this.currentRotationAngle - 90) % 3600 % 360;
42692
+ this.imageEl.setAttribute('data-rotation-angle', this.currentRotationAngle);
42693
+ this.imageEl.style.transform = `rotate(${this.currentRotationAngle}deg)`;
42694
+ this.emit('rotate');
42695
+
42696
+ // Re-adjust image position after rotation
42697
+ this.handleOrientationChange();
42698
+ this.setScale(this.imageEl.offsetwidth, this.imageEl.offsetHeight);
42699
+ }
42700
+
42701
+ /**
42702
+ * Handles keyboard events for the image
42703
+ *
42704
+ * @param {string} key - Keydown key
42705
+ * @return {boolean} Consumed or not
42706
+ */
42707
+ onKeydown(key) {
42708
+ // This bare key belongs to the Blueprint controls bar, whose menu lists it; the older bar has no such shortcut
42709
+ if (this.controls && (key === 'r' || key === 'R') && this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ)) {
42710
+ this.rotateLeft();
42711
+ return true;
42712
+ }
42713
+ return super.onKeydown(key);
42714
+ }
42715
+
42716
+ // Annotation overrides
42717
+ getInitialAnnotationMode() {
42718
+ return this.isDiscoverabilityEnabled() ? AnnotationMode.REGION : AnnotationMode.NONE;
42719
+ }
42720
+
42721
+ /**
42722
+ * Gets the width & height after the transforms are applied.
42723
+ * When an image is rotated, the width & height of an image, e.g. offsetWidth & offsetHeight,
42724
+ * are the values before transforms are applied, so if the image is rotated we need to swap the
42725
+ * width & height
42726
+ *
42727
+ * @private
42728
+ * @param {number} [width] - The width in px
42729
+ * @param {number} [height] - The height in px
42730
+ * @param {boolean} [isRotated] - if the image has a transform rotate applied to it
42731
+ * @return {Object} the width & height of the image after tranformations
42732
+ */
42733
+ getTransformWidthAndHeight(width, height, isRotated) {
42734
+ if (isRotated) {
42735
+ return {
42736
+ width: height,
42737
+ height: width
42738
+ };
42739
+ }
42740
+ return {
42741
+ width,
42742
+ height
42743
+ };
42744
+ }
42745
+
42746
+ /**
42747
+ * Gets the viewport dimensions.
42748
+ *
42749
+ * @return {Object} the width & height of the viewport
42750
+ */
42751
+ getViewportDimensions() {
42752
+ return {
41667
42753
  width: this.wrapperEl.clientWidth - 2 * IMAGE_PADDING,
41668
42754
  height: this.wrapperEl.clientHeight - 2 * IMAGE_PADDING
41669
42755
  };
@@ -41820,7 +42906,8 @@ class ImageViewer extends image_ImageBaseViewer {
41820
42906
  }
41821
42907
  const canAnnotate = this.areNewAnnotationsEnabled() && this.hasAnnotationCreatePermission();
41822
42908
  const canDraw = canAnnotate && this.options.showAnnotationsDrawingCreate;
41823
- this.controls.render(/*#__PURE__*/external_react_["default"].createElement(ImageControls, {
42909
+ const Controls = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ) ? ImageControlsV2 : ImageControls;
42910
+ this.controls.render(/*#__PURE__*/external_react_["default"].createElement(Controls, {
41824
42911
  annotationColor: this.annotationModule.getColor(),
41825
42912
  annotationMode: this.annotationControlsFSM.getMode(),
41826
42913
  experiences: this.experiences,
@@ -42192,6 +43279,214 @@ function MultiImageControls({
42192
43279
  onFullscreenToggle: onFullscreenToggle
42193
43280
  })));
42194
43281
  }
43282
+ ;// external "@box/blueprint-web-assets/icons/Medium/ChevronDown"
43283
+
43284
+ ;// external "@box/blueprint-web-assets/icons/Medium/ChevronUp"
43285
+
43286
+ ;// ./src/lib/viewers/controls/page/PageControlsFormV2.scss
43287
+ // extracted by mini-css-extract-plugin
43288
+
43289
+ ;// ./src/lib/viewers/controls/page/PageControlsFormV2.tsx
43290
+ /* provided dependency */ var PageControlsFormV2_ = __webpack_require__(441)["Tl"];
43291
+
43292
+
43293
+
43294
+
43295
+
43296
+ function PageControlsFormV2({
43297
+ onPageSubmit,
43298
+ pageNumber,
43299
+ pageCount
43300
+ }) {
43301
+ const [isInputShown, setIsInputShown] = external_react_["default"].useState(false);
43302
+ // A string because Toolbar.Input only supports text types, so a parsed number would show "NaN" once cleared
43303
+ const [inputValue, setInputValue] = external_react_["default"].useState(pageNumber.toString());
43304
+ const buttonElRef = external_react_["default"].useRef(null);
43305
+ const inputElRef = external_react_["default"].useRef(null);
43306
+ const isRetryRef = external_react_["default"].useRef(false);
43307
+ const setPage = (allowRetry = false) => {
43308
+ const newPageNumber = Number(inputValue);
43309
+ if (Number.isInteger(newPageNumber) && newPageNumber >= 1 && newPageNumber <= pageCount && newPageNumber !== pageNumber) {
43310
+ onPageSubmit(newPageNumber);
43311
+ } else {
43312
+ setInputValue(pageNumber.toString()); // Reset the invalid input value to the current page
43313
+
43314
+ if (allowRetry) {
43315
+ isRetryRef.current = true;
43316
+ }
43317
+ }
43318
+ setIsInputShown(false);
43319
+ };
43320
+ const handleNumInputChange = event => {
43321
+ setInputValue(event.target.value);
43322
+ };
43323
+ const handleNumInputBlur = () => {
43324
+ setPage();
43325
+ };
43326
+ const handleNumInputKeyDown = event => {
43327
+ const key = (0,util/* decodeKeydown */.wU)(event);
43328
+ switch (key) {
43329
+ case ENTER:
43330
+ event.stopPropagation();
43331
+ event.preventDefault();
43332
+ setPage(true);
43333
+ break;
43334
+ case ESCAPE:
43335
+ event.stopPropagation();
43336
+ event.preventDefault();
43337
+ isRetryRef.current = true;
43338
+ setIsInputShown(false);
43339
+ setInputValue(pageNumber.toString());
43340
+ break;
43341
+ default:
43342
+ break;
43343
+ }
43344
+ };
43345
+ external_react_["default"].useEffect(() => {
43346
+ setInputValue(pageNumber.toString()); // Keep internal state in sync with prop as it changes
43347
+ }, [pageNumber]);
43348
+ external_react_["default"].useLayoutEffect(() => {
43349
+ if (inputElRef.current && isInputShown) {
43350
+ inputElRef.current.select();
43351
+ }
43352
+ if (buttonElRef.current && !isInputShown) {
43353
+ if (isRetryRef.current) {
43354
+ buttonElRef.current.focus();
43355
+ }
43356
+ isRetryRef.current = false;
43357
+ }
43358
+ }, [isInputShown]);
43359
+ return /*#__PURE__*/external_react_["default"].createElement("div", {
43360
+ className: "bp-PageControlsFormV2",
43361
+ "data-testid": "bp-PageControlsForm"
43362
+ }, isInputShown ? /*#__PURE__*/external_react_["default"].createElement("div", {
43363
+ className: "bp-PageControlsFormV2-input"
43364
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Input, {
43365
+ ref: inputElRef,
43366
+ "aria-label": PageControlsFormV2_('enter_page_num'),
43367
+ "data-resin-target": "pageNumberInput",
43368
+ "data-testid": "bp-PageControlsForm-input",
43369
+ inputMode: "numeric",
43370
+ onBlur: handleNumInputBlur,
43371
+ onChange: handleNumInputChange,
43372
+ onKeyDown: handleNumInputKeyDown,
43373
+ pattern: "[0-9]*",
43374
+ size: 3,
43375
+ value: inputValue
43376
+ })) : /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43377
+ content: PageControlsFormV2_('enter_page_num')
43378
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43379
+ ref: buttonElRef,
43380
+ "data-resin-target": "pageNumberOpen",
43381
+ "data-testid": "bp-PageControlsForm-button",
43382
+ disabled: pageCount <= 1,
43383
+ onClick: () => setIsInputShown(true)
43384
+ }, /*#__PURE__*/external_react_["default"].createElement("span", {
43385
+ className: "bp-PageControlsFormV2-button-label",
43386
+ "data-testid": "bp-PageControlsForm-button-label"
43387
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
43388
+ as: "span",
43389
+ color: "textOnDarkDefault"
43390
+ }, `${pageNumber} / ${pageCount}`)))));
43391
+ }
43392
+ ;// ./src/lib/viewers/controls/page/PageControlsV2.tsx
43393
+ /* provided dependency */ var PageControlsV2_ = __webpack_require__(441)["Tl"];
43394
+
43395
+
43396
+
43397
+
43398
+
43399
+ function PageControlsV2({
43400
+ onPageChange,
43401
+ onPageSubmit,
43402
+ pageCount,
43403
+ pageNumber
43404
+ }) {
43405
+ if (pageCount <= 1) {
43406
+ return null;
43407
+ }
43408
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43409
+ content: PageControlsV2_('previous_page')
43410
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43411
+ "aria-label": PageControlsV2_('previous_page'),
43412
+ "data-resin-target": "pagePrevious",
43413
+ "data-testid": "bp-PageControls-previous",
43414
+ disabled: pageNumber === 1,
43415
+ onClick: () => onPageChange(pageNumber - 1)
43416
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
43417
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__
43418
+ }))), /*#__PURE__*/external_react_["default"].createElement(PageControlsFormV2, {
43419
+ onPageSubmit: onPageSubmit,
43420
+ pageCount: pageCount,
43421
+ pageNumber: pageNumber
43422
+ }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
43423
+ content: PageControlsV2_('next_page')
43424
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
43425
+ "aria-label": PageControlsV2_('next_page'),
43426
+ "data-resin-target": "pageNext",
43427
+ "data-testid": "bp-PageControls-next",
43428
+ disabled: pageNumber === pageCount,
43429
+ onClick: () => onPageChange(pageNumber + 1)
43430
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
43431
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__
43432
+ }))));
43433
+ }
43434
+ ;// ./src/lib/viewers/image/MultiImageControlsV2.tsx
43435
+
43436
+
43437
+
43438
+
43439
+
43440
+ // The same collapse order as documents: fullscreen, then zoom. Page has no menu form and never collapses.
43441
+ const MultiImageControlsV2_PRIORITY = {
43442
+ fullscreen: 2,
43443
+ zoom: 3
43444
+ };
43445
+ function MultiImageControlsV2({
43446
+ onFullscreenToggle,
43447
+ onPageChange,
43448
+ onPageSubmit,
43449
+ onZoomIn,
43450
+ onZoomOut,
43451
+ pageCount,
43452
+ pageNumber,
43453
+ scale
43454
+ }) {
43455
+ const zoomProps = {
43456
+ onZoomIn,
43457
+ onZoomOut,
43458
+ scale
43459
+ };
43460
+
43461
+ // Page is gated here rather than only inside it, so the bar never reserves width for a control that
43462
+ // would render nothing
43463
+ const items = [pageCount > 1 && {
43464
+ control: /*#__PURE__*/external_react_["default"].createElement(PageControlsV2, {
43465
+ onPageChange: onPageChange,
43466
+ onPageSubmit: onPageSubmit,
43467
+ pageCount: pageCount,
43468
+ pageNumber: pageNumber
43469
+ }),
43470
+ id: 'page'
43471
+ }, {
43472
+ control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
43473
+ id: 'zoom',
43474
+ menu: /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
43475
+ priority: MultiImageControlsV2_PRIORITY.zoom
43476
+ }, {
43477
+ control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
43478
+ onFullscreenToggle: onFullscreenToggle
43479
+ }),
43480
+ id: 'fullscreen',
43481
+ menu: /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
43482
+ onFullscreenToggle: onFullscreenToggle
43483
+ }),
43484
+ priority: MultiImageControlsV2_PRIORITY.fullscreen
43485
+ }];
43486
+ return /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
43487
+ items: items.filter(item => !!item)
43488
+ });
43489
+ }
42195
43490
  ;// ./src/lib/viewers/image/MultiImage.scss
42196
43491
  // extracted by mini-css-extract-plugin
42197
43492
 
@@ -42205,6 +43500,7 @@ function MultiImageViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) re
42205
43500
 
42206
43501
 
42207
43502
 
43503
+
42208
43504
  const PADDING_BUFFER = 100;
42209
43505
  const MultiImageViewer_CSS_CLASS_IMAGE = 'bp-images';
42210
43506
  const CSS_CLASS_IMAGE_WRAPPER = 'bp-images-wrapper';
@@ -42471,7 +43767,8 @@ class MultiImageViewer extends image_ImageBaseViewer {
42471
43767
  if (!this.controls) {
42472
43768
  return;
42473
43769
  }
42474
- this.controls.render(/*#__PURE__*/external_react_["default"].createElement(MultiImageControls, {
43770
+ const Controls = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_CONTROLS_BAR */.OQ) ? MultiImageControlsV2 : MultiImageControls;
43771
+ this.controls.render(/*#__PURE__*/external_react_["default"].createElement(Controls, {
42475
43772
  onFullscreenToggle: this.toggleFullscreen,
42476
43773
  onPageChange: this.setPage,
42477
43774
  onPageSubmit: this.handlePageSubmit,
@@ -44444,92 +45741,56 @@ function Image360Controls({
44444
45741
  onVrToggle: onVrToggle
44445
45742
  }));
44446
45743
  }
44447
- // EXTERNAL MODULE: external "@box/blueprint-web"
44448
- var blueprint_web_ = __webpack_require__(8912);
44449
45744
  ;// external "@box/blueprint-web-assets/icons/Medium/VrGoggles"
44450
45745
 
45746
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
45747
+ var utils = __webpack_require__(5346);
44451
45748
  ;// ./src/lib/viewers/controls/box3d/VrToggleControlV2.tsx
44452
45749
  /* provided dependency */ var VrToggleControlV2_ = __webpack_require__(441)["Tl"];
45750
+ const VrToggleControlV2_excluded = ["buttonType", "isVrShown", "onVrToggle"];
45751
+ function VrToggleControlV2_extends() { return VrToggleControlV2_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; }, VrToggleControlV2_extends.apply(null, arguments); }
45752
+ function VrToggleControlV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = VrToggleControlV2_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; }
45753
+ function VrToggleControlV2_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; }
44453
45754
 
44454
45755
 
44455
45756
 
44456
- function VrToggleControlV2({
44457
- isVrShown,
44458
- onVrToggle
44459
- }) {
44460
- if (!isVrShown) {
45757
+
45758
+
45759
+ // Toolbar.Button throws outside a Toolbar.Root, so surfaces without one (the media bar) use IconButton.
45760
+
45761
+ function VrToggleControlV2(props) {
45762
+ if (!props.isVrShown) {
44461
45763
  return null;
44462
45764
  }
45765
+ if (props.buttonType === 'icon') {
45766
+ const {
45767
+ buttonType,
45768
+ isVrShown,
45769
+ onVrToggle
45770
+ } = props,
45771
+ rest = VrToggleControlV2_objectWithoutProperties(props, VrToggleControlV2_excluded);
45772
+ return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45773
+ content: VrToggleControlV2_('box3d_toggle_vr')
45774
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, VrToggleControlV2_extends({
45775
+ "data-target-id": "VrToggleControlV2-toggle",
45776
+ onKeyDown: utils/* stopActivationKeyPropagation */.My
45777
+ }, rest, {
45778
+ "aria-label": VrToggleControlV2_('box3d_toggle_vr'),
45779
+ "data-resin-target": "vrToggle",
45780
+ icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__,
45781
+ onClick: onVrToggle
45782
+ })));
45783
+ }
44463
45784
  return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
44464
45785
  content: VrToggleControlV2_('box3d_toggle_vr')
44465
45786
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
44466
45787
  "aria-label": VrToggleControlV2_('box3d_toggle_vr'),
44467
45788
  "data-resin-target": "vrToggle",
44468
- onClick: onVrToggle
45789
+ onClick: props.onVrToggle
44469
45790
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
44470
45791
  icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_VrGoggles_9eb581be_default__
44471
45792
  })));
44472
45793
  }
44473
- ;// ./src/lib/viewers/controls/controls-bar/ControlsBarV2.tsx
44474
- const ControlsBarV2_excluded = ["children"];
44475
- function ControlsBarV2_extends() { return ControlsBarV2_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; }, ControlsBarV2_extends.apply(null, arguments); }
44476
- function ControlsBarV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsBarV2_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; }
44477
- function ControlsBarV2_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; }
44478
-
44479
-
44480
- function ControlsBarV2(_ref, ref) {
44481
- let {
44482
- children
44483
- } = _ref,
44484
- rest = ControlsBarV2_objectWithoutProperties(_ref, ControlsBarV2_excluded);
44485
- if (!children) {
44486
- return null;
44487
- }
44488
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Root, ControlsBarV2_extends({
44489
- ref: ref,
44490
- colorScheme: "dark",
44491
- "data-testid": "bp-ControlsBar"
44492
- }, rest), children);
44493
- }
44494
- /* harmony default export */ const controls_bar_ControlsBarV2 = (/*#__PURE__*/external_react_["default"].forwardRef(ControlsBarV2));
44495
- ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMaximize"
44496
-
44497
- ;// external "@box/blueprint-web-assets/icons/Medium/ArrowsMinimize"
44498
-
44499
- ;// ./src/lib/viewers/controls/fullscreen/FullscreenToggleV2.tsx
44500
- /* provided dependency */ var FullscreenToggleV2_ = __webpack_require__(441)["Tl"];
44501
- const FullscreenToggleV2_excluded = ["onFullscreenToggle"];
44502
- 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); }
44503
- 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; }
44504
- 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; }
44505
-
44506
-
44507
-
44508
-
44509
-
44510
- function FullscreenToggleV2(_ref) {
44511
- let {
44512
- onFullscreenToggle
44513
- } = _ref,
44514
- rest = FullscreenToggleV2_objectWithoutProperties(_ref, FullscreenToggleV2_excluded);
44515
- const isFullscreen = useFullscreen();
44516
- 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__;
44517
- const label = isFullscreen ? FullscreenToggleV2_('exit_fullscreen') : FullscreenToggleV2_('enter_fullscreen');
44518
- const handleClick = ({
44519
- currentTarget
44520
- }) => {
44521
- onFullscreenToggle(!isFullscreen, currentTarget);
44522
- };
44523
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
44524
- content: label
44525
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, FullscreenToggleV2_extends({
44526
- "aria-label": label,
44527
- "data-resin-target": "fullscreen",
44528
- onClick: handleClick
44529
- }, rest), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
44530
- icon: icon
44531
- })));
44532
- }
44533
45794
  ;// ./src/lib/viewers/box3d/image360/Image360ControlsV2.tsx
44534
45795
 
44535
45796
 
@@ -45266,78 +46527,6 @@ function TextControls({
45266
46527
  onFullscreenToggle: onFullscreenToggle
45267
46528
  })));
45268
46529
  }
45269
- ;// external "@box/blueprint-web-assets/icons/Medium/Minus"
45270
-
45271
- ;// external "@box/blueprint-web-assets/icons/Medium/Plus"
45272
-
45273
- ;// ./src/lib/viewers/controls/zoom/ZoomControlsV2.tsx
45274
- /* provided dependency */ var ZoomControlsV2_ = __webpack_require__(441)["Tl"];
45275
-
45276
-
45277
-
45278
-
45279
-
45280
-
45281
- function getZoomState({
45282
- maxScale = MAX_SCALE,
45283
- minScale = MIN_SCALE,
45284
- scale = 1
45285
- }) {
45286
- const currentScale = Math.round((scale + Number.EPSILON) * 100) / 100;
45287
- const maxScaleValue = isFinite_default()(maxScale) ? Math.min(maxScale, MAX_SCALE) : MAX_SCALE;
45288
- const minScaleValue = isFinite_default()(minScale) ? Math.max(minScale, MIN_SCALE) : MIN_SCALE;
45289
- return {
45290
- canZoomIn: currentScale < maxScaleValue,
45291
- canZoomOut: currentScale > minScaleValue,
45292
- currentScale
45293
- };
45294
- }
45295
- function ZoomControlsV2({
45296
- maxScale,
45297
- minScale,
45298
- onZoomIn,
45299
- onZoomOut,
45300
- resinTargetZoomIn = 'zoomIn',
45301
- resinTargetZoomOut = 'zoomOut',
45302
- scale
45303
- }) {
45304
- const {
45305
- canZoomIn,
45306
- canZoomOut,
45307
- currentScale
45308
- } = getZoomState({
45309
- maxScale,
45310
- minScale,
45311
- scale
45312
- });
45313
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45314
- content: ZoomControlsV2_('zoom_out')
45315
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
45316
- "aria-label": ZoomControlsV2_('zoom_out'),
45317
- "data-resin-target": resinTargetZoomOut,
45318
- "data-testid": "bp-ZoomControls-out",
45319
- disabled: !canZoomOut,
45320
- onClick: onZoomOut
45321
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
45322
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__
45323
- }))), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
45324
- as: "span",
45325
- color: "textOnDarkDefault",
45326
- "data-testid": "bp-ZoomControls-current",
45327
- title: ZoomControlsV2_('zoom_current_scale'),
45328
- variant: "bodyDefaultSemibold"
45329
- }, `${Math.round(currentScale * 100)}%`), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
45330
- content: ZoomControlsV2_('zoom_in')
45331
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
45332
- "aria-label": ZoomControlsV2_('zoom_in'),
45333
- "data-resin-target": resinTargetZoomIn,
45334
- "data-testid": "bp-ZoomControls-in",
45335
- disabled: !canZoomIn,
45336
- onClick: onZoomIn
45337
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
45338
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__
45339
- }))));
45340
- }
45341
46530
  ;// ./src/lib/viewers/text/TextControlsV2.tsx
45342
46531
 
45343
46532
 
@@ -51976,8 +53165,6 @@ const arrow_curved_forward_24px_namespaceObject = "<svg width=\"24\" height=\"24
51976
53165
  var MediaLoadingIndicator = __webpack_require__(4301);
51977
53166
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/PlayOverlayIcon.tsx
51978
53167
  var PlayOverlayIcon = __webpack_require__(2048);
51979
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/utils.ts
51980
- var utils = __webpack_require__(5346);
51981
53168
  ;// ./src/lib/viewers/media/fitFrameToViewport.js
51982
53169
  /**
51983
53170
  * Contain-fits a frame into the viewport (same model as object-fit: contain).
@@ -52713,7 +53900,7 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52713
53900
  this.bufferingSpinnerEl = this.mediaContainerEl.appendChild(document.createElement('div'));
52714
53901
  this.bufferingSpinnerEl.classList.add(constants/* CLASS_HIDDEN */.zX);
52715
53902
  // Shift up by half the control bar + half the spinner to visually center above the controls
52716
- const spinnerMarginTop = this.useReactControls() && !this.isVideoPlayerV2 ? `-${constants/* VIDEO_PLAYER_CONTROL_BAR_HEIGHT */.qL / 2 + SPINNER_HALF_SIZE}px` : undefined;
53903
+ const spinnerMarginTop = this.useReactControls() && !this.isVideoControlsV2Enabled() ? `-${constants/* VIDEO_PLAYER_CONTROL_BAR_HEIGHT */.qL / 2 + SPINNER_HALF_SIZE}px` : undefined;
52717
53904
  if (this.isBlueprintMediaControlsEnabled()) {
52718
53905
  this.bufferingSpinnerRoot = (0,client_.createRoot)(this.bufferingSpinnerEl);
52719
53906
  this.bufferingSpinnerRoot.render(/*#__PURE__*/external_react_["default"].createElement(MediaLoadingIndicator/* default */.A, {
@@ -52739,6 +53926,16 @@ class VideoBaseViewer extends media_MediaBaseViewer {
52739
53926
  return true;
52740
53927
  }
52741
53928
 
53929
+ /**
53930
+ * Whether to render the V2 React controls. Separate from the V2 layout so a viewer
53931
+ * can keep its own stage and still use the V2 controls.
53932
+ *
53933
+ * @return {boolean} true when the V2 controls should render
53934
+ */
53935
+ isVideoControlsV2Enabled() {
53936
+ return this.isVideoPlayerV2;
53937
+ }
53938
+
52742
53939
  /**
52743
53940
  * Loads a media source.
52744
53941
  *
@@ -53047,9 +54244,9 @@ class VideoBaseViewer extends media_MediaBaseViewer {
53047
54244
  loadUIReact() {
53048
54245
  super.loadUIReact();
53049
54246
 
53050
- // For the V2 player, mount the controls on the wrapper (above the media container)
54247
+ // For the V2 controls, mount on the wrapper (above the media container)
53051
54248
  // so their width is constrained by the viewport rather than the video
53052
- const controlsContainerEl = this.isVideoPlayerV2 ? this.wrapperEl : this.mediaContainerEl;
54249
+ const controlsContainerEl = this.isVideoControlsV2Enabled() ? this.wrapperEl : this.mediaContainerEl;
53053
54250
  this.controls = new ControlsRoot({
53054
54251
  className: 'bp-VideoControlsRoot',
53055
54252
  containerEl: controlsContainerEl,
@@ -53368,7 +54565,7 @@ class VideoBaseViewer extends media_MediaBaseViewer {
53368
54565
  */
53369
54566
  handleNarrowVideoUI() {
53370
54567
  if (this.useReactControls()) {
53371
- const widthNumber = this.isVideoPlayerV2 ? this.wrapperEl.clientWidth : parseInt(this.mediaEl.style.width, 10);
54568
+ const widthNumber = this.isVideoControlsV2Enabled() ? this.wrapperEl.clientWidth : parseInt(this.mediaEl.style.width, 10);
53372
54569
  if (!Number.isNaN(widthNumber)) {
53373
54570
  // check if play and seek buttons exist in the dom
53374
54571
  if (this.playContainerEl && widthNumber >= SMALL_VIDEO_WIDTH_THRESHOLD) {
@@ -53546,27 +54743,6 @@ function MediaFullscreenToggle(props) {
53546
54743
  var Medium_ = __webpack_require__(9747);
53547
54744
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/MediaToggle.tsx
53548
54745
  var MediaToggle = __webpack_require__(8997);
53549
- ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.scss
53550
- // extracted by mini-css-extract-plugin
53551
-
53552
- ;// ./src/lib/viewers/controls/tooltip/ToggleTooltipV2.tsx
53553
-
53554
-
53555
-
53556
- // Blueprint's Tooltip writes its own data-state onto the element it wraps, which overwrites the
53557
- // data-state Toolbar.ToggleItem uses for its selected styling, so the tooltip gets its own element.
53558
- function ToggleTooltipV2({
53559
- children,
53560
- content,
53561
- side
53562
- }) {
53563
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
53564
- content: content,
53565
- side: side
53566
- }, /*#__PURE__*/external_react_["default"].createElement("span", {
53567
- className: "bp-ToggleTooltipV2"
53568
- }, children));
53569
- }
53570
54746
  ;// ./src/lib/viewers/controls/media/SubtitlesToggle.scss
53571
54747
  // extracted by mini-css-extract-plugin
53572
54748
 
@@ -53760,8 +54936,8 @@ var MediaSettingsV2 = __webpack_require__(4027);
53760
54936
  var PlayPauseButton = __webpack_require__(5760);
53761
54937
  // EXTERNAL MODULE: ./src/lib/viewers/controls/media/SkipButton.tsx + 2 modules
53762
54938
  var SkipButton = __webpack_require__(2659);
53763
- // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 3 modules
53764
- var TimestampControl = __webpack_require__(3308);
54939
+ // EXTERNAL MODULE: ./src/lib/viewers/controls/media/TimestampControl.tsx + 1 modules
54940
+ var TimestampControl = __webpack_require__(3904);
53765
54941
  // EXTERNAL MODULE: ./src/lib/viewers/media/formatTimecode.ts
53766
54942
  var formatTimecode = __webpack_require__(4179);
53767
54943
  ;// ./src/lib/viewers/controls/media/FilmstripV2.scss
@@ -54110,6 +55286,13 @@ function TimeControlsV2({
54110
55286
 
54111
55287
 
54112
55288
 
55289
+ function isFocusVisible(el) {
55290
+ try {
55291
+ return !!el?.matches(':focus-visible');
55292
+ } catch {
55293
+ return true;
55294
+ }
55295
+ }
54113
55296
  function VideoFullscreenButton({
54114
55297
  mediaEl,
54115
55298
  onFullscreenToggle,
@@ -54119,11 +55302,21 @@ function VideoFullscreenButton({
54119
55302
  const title = isFullscreen ? VideoFullscreenButton_('exit_fullscreen') : VideoFullscreenButton_('enter_fullscreen');
54120
55303
  const ref = external_react_["default"].useRef(null);
54121
55304
  const [position, setPosition] = external_react_["default"].useState(null);
55305
+ const [isTooltipOpen, setIsTooltipOpen] = external_react_["default"].useState(false);
55306
+ const isHoveredRef = external_react_["default"].useRef(false);
54122
55307
  external_react_["default"].useEffect(() => {
54123
55308
  if (!mediaEl) return undefined;
55309
+ const observed = {};
54124
55310
  const update = () => {
54125
55311
  const parent = ref.current?.offsetParent;
54126
55312
  if (!parent) return;
55313
+ if (parent !== observed.parent) {
55314
+ if (observed.parent) {
55315
+ observed.observer?.unobserve(observed.parent);
55316
+ }
55317
+ observed.parent = parent;
55318
+ observed.observer?.observe(parent);
55319
+ }
54127
55320
  const videoRect = mediaEl.getBoundingClientRect();
54128
55321
  const parentRect = parent.getBoundingClientRect();
54129
55322
  setPosition({
@@ -54131,17 +55324,20 @@ function VideoFullscreenButton({
54131
55324
  right: parentRect.right - videoRect.right + 24
54132
55325
  });
54133
55326
  };
54134
- update();
54135
55327
 
54136
55328
  // Watch both the video and the overlay parent. A sibling layout change
54137
55329
  // (e.g. a host-page sidebar) can shrink the parent and re-center the
54138
55330
  // video without changing the video element's box size, so observing
54139
55331
  // mediaEl alone would leave the button at a stale `right` offset.
55332
+ // The button is watched too: it has no offsetParent while the preview is hidden during load, and the
55333
+ // video can reach its final size before then, so the button appearing may be the only signal left.
54140
55334
  const resizeObserver = new ResizeObserver(update);
55335
+ observed.observer = resizeObserver;
54141
55336
  resizeObserver.observe(mediaEl);
54142
- if (ref.current?.offsetParent) {
54143
- resizeObserver.observe(ref.current.offsetParent);
55337
+ if (ref.current) {
55338
+ resizeObserver.observe(ref.current);
54144
55339
  }
55340
+ update();
54145
55341
  window.addEventListener('resize', update);
54146
55342
  return () => {
54147
55343
  resizeObserver.disconnect();
@@ -54153,6 +55349,13 @@ function VideoFullscreenButton({
54153
55349
  }) => {
54154
55350
  onFullscreenToggle(!isFullscreen, target);
54155
55351
  };
55352
+
55353
+ // The viewer refocuses this button after a fullscreen change, mid-relayout. Show the tooltip for
55354
+ // hover or keyboard focus only, not for that refocus after a mouse click.
55355
+ const handleTooltipOpenChange = open => {
55356
+ if (open && !isHoveredRef.current && !isFocusVisible(document.activeElement)) return;
55357
+ setIsTooltipOpen(open);
55358
+ };
54156
55359
  const positionStyle = position ? {
54157
55360
  top: position.top,
54158
55361
  right: position.right
@@ -54161,9 +55364,17 @@ function VideoFullscreenButton({
54161
55364
  return /*#__PURE__*/external_react_["default"].createElement("div", {
54162
55365
  ref: ref,
54163
55366
  className: "bp-VideoFullscreenButton-position",
55367
+ onPointerEnter: () => {
55368
+ isHoveredRef.current = true;
55369
+ },
55370
+ onPointerLeave: () => {
55371
+ isHoveredRef.current = false;
55372
+ },
54164
55373
  style: positionStyle
54165
55374
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
54166
- content: title
55375
+ content: title,
55376
+ onOpenChange: handleTooltipOpenChange,
55377
+ open: isTooltipOpen
54167
55378
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
54168
55379
  "aria-label": title,
54169
55380
  "data-resin-target": "videoFullscreen",
@@ -54245,238 +55456,6 @@ function AnnotationsPaletteAnchorV2({
54245
55456
  }
54246
55457
  }, children), container);
54247
55458
  }
54248
- ;// external "@box/blueprint-web-assets/icons/Medium/PencilTip"
54249
-
54250
- ;// external "@box/blueprint-web-assets/icons/Medium/SquarePlus"
54251
-
54252
- ;// external "@box/blueprint-web-assets/icons/Medium/TCursorHighlight"
54253
-
54254
- ;// ./src/lib/viewers/controls/annotations/annotationModeIcons.ts
54255
-
54256
-
54257
-
54258
-
54259
- const ANNOTATION_MODE_ICONS = {
54260
- [AnnotationMode.DRAWING]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_PencilTip_154ad3fd_default__,
54261
- [AnnotationMode.HIGHLIGHT]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_TCursorHighlight_508374cb_default__,
54262
- [AnnotationMode.REGION]: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_SquarePlus_c11758f1_default__
54263
- };
54264
- /* harmony default export */ const annotationModeIcons = (ANNOTATION_MODE_ICONS);
54265
- ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.scss
54266
- // extracted by mini-css-extract-plugin
54267
-
54268
- ;// ./src/lib/viewers/controls/annotations/AnnotationsPaletteV2.tsx
54269
- /* provided dependency */ var AnnotationsPaletteV2_ = __webpack_require__(441)["Tl"];
54270
- function AnnotationsPaletteV2_extends() { return AnnotationsPaletteV2_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; }, AnnotationsPaletteV2_extends.apply(null, arguments); }
54271
-
54272
-
54273
-
54274
-
54275
-
54276
-
54277
-
54278
-
54279
- function AnnotationsPaletteV2({
54280
- children
54281
- }) {
54282
- return /*#__PURE__*/external_react_["default"].createElement("div", {
54283
- className: "bp-AnnotationsPaletteV2",
54284
- "data-testid": "bp-AnnotationsPaletteV2"
54285
- }, /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, null, children));
54286
- }
54287
- function Modes({
54288
- annotationMode,
54289
- children,
54290
- onAnnotationModeClick = (noop_default())
54291
- }) {
54292
- // The single-select group reports an empty value when the active mode is clicked again. Exiting
54293
- // is left to the trigger on the main bar, so the palette never closes under the cursor.
54294
- const handleModeChange = mode => {
54295
- if (!mode || mode === annotationMode) {
54296
- return;
54297
- }
54298
- onAnnotationModeClick({
54299
- mode: mode
54300
- });
54301
- };
54302
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54303
- "data-testid": "bp-annotations-controls",
54304
- onValueChange: handleModeChange,
54305
- type: "single",
54306
- value: annotationMode
54307
- }, children);
54308
- }
54309
- function Mode({
54310
- value
54311
- }) {
54312
- const {
54313
- label,
54314
- resinTarget,
54315
- testId
54316
- } = {
54317
- [AnnotationMode.DRAWING]: {
54318
- label: AnnotationsPaletteV2_('drawing_comment'),
54319
- resinTarget: 'draw',
54320
- testId: 'bp-AnnotationsControls-drawBtn'
54321
- },
54322
- [AnnotationMode.HIGHLIGHT]: {
54323
- label: AnnotationsPaletteV2_('highlight_text'),
54324
- resinTarget: 'highlightText',
54325
- testId: 'bp-AnnotationsControls-highlightBtn'
54326
- },
54327
- [AnnotationMode.REGION]: {
54328
- label: AnnotationsPaletteV2_('region_comment'),
54329
- resinTarget: 'highlightRegion',
54330
- testId: 'bp-AnnotationsControls-regionBtn'
54331
- }
54332
- }[value];
54333
- return /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54334
- content: label
54335
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, {
54336
- "aria-label": label,
54337
- "data-resin-target": resinTarget,
54338
- "data-testid": testId,
54339
- icon: annotationModeIcons[value],
54340
- value: value
54341
- }));
54342
- }
54343
- /* harmony default export */ const annotations_AnnotationsPaletteV2 = (AnnotationsPaletteV2_extends(AnnotationsPaletteV2, {
54344
- Mode,
54345
- Modes
54346
- }));
54347
- ;// external "@box/blueprint-web-assets/icons/Medium/Comment"
54348
-
54349
- ;// ./src/lib/viewers/controls/annotations/AnnotationsToggleV2.tsx
54350
- /* provided dependency */ var AnnotationsToggleV2_ = __webpack_require__(441)["Tl"];
54351
- function AnnotationsToggleV2_extends() { return AnnotationsToggleV2_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; }, AnnotationsToggleV2_extends.apply(null, arguments); }
54352
-
54353
-
54354
-
54355
-
54356
-
54357
-
54358
-
54359
- // The toolbar parts throw outside a Toolbar.Root, so surfaces without one (the media bar) use a standalone button.
54360
-
54361
- const TOGGLE_VALUE = 'annotations';
54362
- function AnnotationsToggleV2(props, ref) {
54363
- const {
54364
- annotationMode = AnnotationMode.NONE,
54365
- isExpanded,
54366
- modes,
54367
- onAnnotationModeClick = (noop_default()),
54368
- onAnnotationModeEscape = (noop_default()),
54369
- tooltipSide
54370
- } = props;
54371
- const [lastMode, setLastMode] = external_react_["default"].useState(null);
54372
- const isActive = annotationMode !== AnnotationMode.NONE;
54373
- const resumeMode = lastMode && modes.includes(lastMode) ? lastMode : modes[0];
54374
- external_react_["default"].useEffect(() => {
54375
- if (annotationMode !== AnnotationMode.NONE) {
54376
- setLastMode(annotationMode);
54377
- }
54378
- }, [annotationMode]);
54379
-
54380
- // Global event handlers
54381
- external_react_["default"].useEffect(() => {
54382
- const handleKeyDown = event => {
54383
- if (event.key !== 'Escape') {
54384
- return;
54385
- }
54386
- event.preventDefault();
54387
- event.stopPropagation();
54388
- onAnnotationModeEscape();
54389
- };
54390
- if (annotationMode !== AnnotationMode.NONE) {
54391
- document.addEventListener('keydown', handleKeyDown);
54392
- }
54393
- return () => {
54394
- document.removeEventListener('keydown', handleKeyDown);
54395
- };
54396
- }, [annotationMode, onAnnotationModeEscape]);
54397
- if (!resumeMode) {
54398
- return null;
54399
- }
54400
- const handleToggle = isPressed => {
54401
- onAnnotationModeClick({
54402
- mode: isPressed ? resumeMode : AnnotationMode.NONE
54403
- });
54404
- };
54405
- const toggleProps = {
54406
- ref,
54407
- 'aria-expanded': isExpanded ?? isActive,
54408
- 'aria-label': AnnotationsToggleV2_('annotation_tools'),
54409
- 'data-resin-target': 'annotations',
54410
- 'data-testid': 'bp-AnnotationsControls-toggleBtn',
54411
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Comment_c700dfbc_default__
54412
- };
54413
- const renderToggle = toggle => /*#__PURE__*/external_react_["default"].createElement(ToggleTooltipV2, {
54414
- content: AnnotationsToggleV2_('annotation_tools'),
54415
- side: tooltipSide
54416
- }, toggle);
54417
- if (props.buttonType === 'icon') {
54418
- const {
54419
- className,
54420
- size,
54421
- variant
54422
- } = props;
54423
- return renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconToggleButton, AnnotationsToggleV2_extends({}, toggleProps, {
54424
- className: className,
54425
- onPressedChange: handleToggle,
54426
- pressed: isActive,
54427
- size: size,
54428
- variant: variant
54429
- })));
54430
- }
54431
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleGroup, {
54432
- onValueChange: value => handleToggle(value.includes(TOGGLE_VALUE)),
54433
- type: "multiple",
54434
- value: isActive ? [TOGGLE_VALUE] : []
54435
- }, renderToggle(/*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.ToggleItem, AnnotationsToggleV2_extends({}, toggleProps, {
54436
- value: TOGGLE_VALUE
54437
- }))));
54438
- }
54439
- /* harmony default export */ const annotations_AnnotationsToggleV2 = (/*#__PURE__*/external_react_["default"].forwardRef(AnnotationsToggleV2));
54440
- ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.scss
54441
- // extracted by mini-css-extract-plugin
54442
-
54443
- ;// ./src/lib/viewers/controls/color-picker/ColorPickerControlV2.tsx
54444
- /* provided dependency */ var ColorPickerControlV2_ = __webpack_require__(441)["Tl"];
54445
-
54446
-
54447
-
54448
-
54449
-
54450
- const getColorLabels = () => ({
54451
- [AnnotationColor.BOX_BLUE]: ColorPickerControlV2_('drawing_color_blue'),
54452
- [AnnotationColor.GREEN_LIGHT]: ColorPickerControlV2_('drawing_color_green'),
54453
- [AnnotationColor.WATERMELON_RED]: ColorPickerControlV2_('drawing_color_red'),
54454
- [AnnotationColor.YELLORANGE]: ColorPickerControlV2_('drawing_color_orange'),
54455
- [AnnotationColor.YELLOW]: ColorPickerControlV2_('drawing_color_yellow'),
54456
- [AnnotationColor.GRIMACE]: ColorPickerControlV2_('drawing_color_purple')
54457
- });
54458
- function ColorPickerControlV2({
54459
- activeColor = __WEBPACK_EXTERNAL_MODULE_box_ui_elements_es_styles_variables_c815ce80_bdlBoxBlue__,
54460
- colors,
54461
- onColorSelect
54462
- }) {
54463
- const colorLabels = getColorLabels();
54464
- return /*#__PURE__*/external_react_["default"].createElement("div", {
54465
- className: "bp-ColorPickerControlV2",
54466
- "data-testid": "bp-color-picker-control"
54467
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Grid, {
54468
- "aria-label": ColorPickerControlV2_('drawing_color'),
54469
- columns: colors.length
54470
- }, colors.map(color => /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.SelectMenu.Option.ColorCircle, {
54471
- key: color,
54472
- active: color === activeColor,
54473
- "aria-label": colorLabels[color] || color,
54474
- className: "bp-ColorPickerControlV2-swatch",
54475
- color: color,
54476
- "data-resin-target": "colorSelect",
54477
- onClick: () => onColorSelect(color)
54478
- }))));
54479
- }
54480
55459
  ;// ./src/lib/viewers/media/VideoControlsV2.scss
54481
55460
  // extracted by mini-css-extract-plugin
54482
55461
 
@@ -54502,6 +55481,7 @@ function ColorPickerControlV2({
54502
55481
 
54503
55482
 
54504
55483
 
55484
+
54505
55485
 
54506
55486
 
54507
55487
  function VideoControlsV2({
@@ -54547,12 +55527,14 @@ function VideoControlsV2({
54547
55527
  onSubtitlesToggle,
54548
55528
  onTimeChange,
54549
55529
  onVolumeChange,
55530
+ onVrToggle,
54550
55531
  playNext,
54551
55532
  quality,
54552
55533
  rate,
54553
55534
  subtitle,
54554
55535
  subtitles = [],
54555
55536
  isBlueprintEnabled = false,
55537
+ isVrShown = false,
54556
55538
  videoAnnotationsEnabled = false,
54557
55539
  volume
54558
55540
  }) {
@@ -54709,6 +55691,12 @@ function VideoControlsV2({
54709
55691
  rate: rate,
54710
55692
  subtitle: subtitle,
54711
55693
  subtitles: subtitles
55694
+ }), onVrToggle && isBlueprintEnabled && /*#__PURE__*/external_react_["default"].createElement(VrToggleControlV2, {
55695
+ buttonType: "icon",
55696
+ isVrShown: isVrShown,
55697
+ onVrToggle: onVrToggle,
55698
+ size: "large",
55699
+ variant: "on-dark"
54712
55700
  }), hasAnnotationsV2 && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement("div", {
54713
55701
  className: "bp-VideoControlsV2-divider"
54714
55702
  }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, {
@@ -56315,13 +57303,22 @@ class DashViewer extends media_VideoBaseViewer {
56315
57303
  this.setSubtitle(showSubtitles ? this.selectedSubtitle : constants/* SUBTITLES_OFF */.eA);
56316
57304
  }
56317
57305
 
57306
+ /**
57307
+ * Extra props a subclass passes to the V2 controls.
57308
+ *
57309
+ * @protected
57310
+ * @return {Object} props spread onto VideoControlsV2
57311
+ */
57312
+ getVideoControlsV2Props() {
57313
+ return {};
57314
+ }
57315
+
56318
57316
  /**
56319
57317
  * @inheritdoc
56320
57318
  */
56321
57319
  renderUI() {
56322
57320
  // Extra guard for `render` is needed because Video360Viewer extends DashViewer
56323
- // and creates and assigns the 360 control to this.controls which usually has
56324
- // been reserved for new React controls
57321
+ // and, without React controls, assigns its imperative 360 controls to this.controls
56325
57322
  if (!this.controls || !this.controls.render) {
56326
57323
  return;
56327
57324
  }
@@ -56383,11 +57380,11 @@ class DashViewer extends media_VideoBaseViewer {
56383
57380
  mediaEl: this.mediaEl
56384
57381
  }));
56385
57382
  }
56386
- if (this.isVideoPlayerV2) {
57383
+ if (this.isVideoControlsV2Enabled()) {
56387
57384
  this.controls.render(/*#__PURE__*/external_react_["default"].createElement(VideoControlsV2, DashViewer_extends({
56388
57385
  commentMarkers: this.commentMarkers,
56389
57386
  onCommentMarkerClick: this.handleCommentMarkerClick
56390
- }, sharedProps, {
57387
+ }, sharedProps, this.getVideoControlsV2Props(), {
56391
57388
  onPlayNextChange: this.setPlayNext,
56392
57389
  playNext: this.isPlayNextEnabled(),
56393
57390
  isBlueprintEnabled: this.isBlueprintMediaControlsEnabled()
@@ -56792,6 +57789,8 @@ class Video360Viewer extends media_DashViewer {
56792
57789
  Video360Viewer_defineProperty(this, "videoAsset", void 0);
56793
57790
  /** @property {Box3D.Components.SkyboxRenderer} - The component for rendering the video as 360 degree (on a skybox) */
56794
57791
  Video360Viewer_defineProperty(this, "skybox", void 0);
57792
+ /** @property {boolean} - Whether the React controls show the VR toggle */
57793
+ Video360Viewer_defineProperty(this, "isVrShown", false);
56795
57794
  this.create360Environment = this.create360Environment.bind(this);
56796
57795
  this.handleToggleVr = this.handleToggleVr.bind(this);
56797
57796
  this.handleShowVrButton = this.handleShowVrButton.bind(this);
@@ -56804,6 +57803,30 @@ class Video360Viewer extends media_DashViewer {
56804
57803
  return false;
56805
57804
  }
56806
57805
 
57806
+ /** @inheritdoc */
57807
+ isVideoControlsV2Enabled() {
57808
+ return this.useReactControls() && this.featureEnabled('videoPlayerV2.enabled') && this.isBlueprintMediaControlsEnabled();
57809
+ }
57810
+
57811
+ /** @inheritdoc */
57812
+ getVideoControlsV2Props() {
57813
+ return {
57814
+ isVrShown: this.isVrShown,
57815
+ onVrToggle: this.handleToggleVr
57816
+ };
57817
+ }
57818
+
57819
+ /**
57820
+ * The canvas shows the picture, so the container fills the viewer instead of fitting the video, which
57821
+ * Video360.scss sizes to place its captions. resize() clears the container size before calling this.
57822
+ *
57823
+ * @inheritdoc
57824
+ */
57825
+ setVideoDimensions() {
57826
+ this.mediaContainerEl.style.width = '100%';
57827
+ this.mediaContainerEl.style.height = '100%';
57828
+ }
57829
+
56807
57830
  /** @inheritdoc */
56808
57831
  setup() {
56809
57832
  if (this.isSetup) {
@@ -56814,18 +57837,25 @@ class Video360Viewer extends media_DashViewer {
56814
57837
  super.setup();
56815
57838
  this.destroyed = false;
56816
57839
 
56817
- // Hide video element
56818
- this.mediaEl.style.display = 'none';
56819
57840
  // Instead of keeping aspect ratio of video, we want full sized canvas to render to
56820
57841
  this.mediaContainerEl.style.width = '100%';
56821
57842
  this.mediaContainerEl.style.height = '100%';
56822
57843
  this.wrapperEl.classList.add(CSS_CLASS_VIDEO_360);
57844
+
57845
+ // The video is visible for its captions, but its own picture is flat; keep it out of casting and
57846
+ // picture-in-picture.
57847
+ this.mediaEl.setAttribute('disableremoteplayback', '');
57848
+ this.mediaEl.setAttribute('disablepictureinpicture', '');
57849
+ if (this.isVideoControlsV2Enabled()) {
57850
+ // Scopes the V2 control styles without the padded V2 container or stage
57851
+ this.wrapperEl.classList.add('bp-media--v2');
57852
+ }
56823
57853
  }
56824
57854
 
56825
57855
  /** @inheritdoc */
56826
57856
  destroy() {
56827
57857
  // Tear down 360 controls before super.destroy(), which destroys this.controls
56828
- // (DashViewer's React ControlsRoot when createControls() has not run yet).
57858
+ // (DashViewer's React ControlsRoot when the imperative 360 controls never replaced it).
56829
57859
  if (this.video360Controls) {
56830
57860
  this.destroyControls();
56831
57861
  this.video360Controls = null;
@@ -56896,6 +57926,10 @@ class Video360Viewer extends media_DashViewer {
56896
57926
  * @return {void}
56897
57927
  */
56898
57928
  createControls() {
57929
+ // The V2 React controls render the VR toggle and show themselves on pointer movement.
57930
+ if (this.isVideoControlsV2Enabled()) {
57931
+ return;
57932
+ }
56899
57933
  this.video360Controls = new video360_Video360Controls(this.mediaContainerEl);
56900
57934
  // Overwrite this.controls so DashViewer.renderUI() skips React controls.
56901
57935
  this.controls = this.video360Controls;
@@ -56975,6 +58009,8 @@ class Video360Viewer extends media_DashViewer {
56975
58009
  this.textureAsset = this.renderer.getBox3D().createTexture2d(VIDEO_TEXTURE_PROPS, 'VIDEO_TEX_ID');
56976
58010
  return new Promise(resolve => {
56977
58011
  this.textureAsset.load(() => {
58012
+ // Box3D hides the video it reads frames from; show it again so the browser draws its captions
58013
+ this.mediaEl.style.display = '';
56978
58014
  this.skybox.setAttribute('skyboxTexture', this.textureAsset.id);
56979
58015
  this.skybox.enable();
56980
58016
  this.renderer.getBox3D().on('mouseDown', this.onCanvasMouseDown);
@@ -57009,6 +58045,9 @@ class Video360Viewer extends media_DashViewer {
57009
58045
  handleShowVrButton() {
57010
58046
  if (this.video360Controls) {
57011
58047
  this.video360Controls.showVrButton();
58048
+ } else if (this.isVideoControlsV2Enabled()) {
58049
+ this.isVrShown = true;
58050
+ this.renderUI();
57012
58051
  }
57013
58052
  }
57014
58053
 
@@ -57137,568 +58176,195 @@ function IconGridView24(props) {
57137
58176
  focusable: "false",
57138
58177
  height: "1em",
57139
58178
  role: "img",
57140
- viewBox: "0 0 24 24",
57141
- width: "1em"
57142
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57143
- d: "M8 13a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2ZM6 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2ZM8 3a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2ZM6 5a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z",
57144
- fill: "#fff",
57145
- fillRule: "evenodd"
57146
- }));
57147
- }
57148
- /* harmony default export */ const icons_IconGridView24 = (IconGridView24);
57149
- ;// ./src/lib/viewers/controls/gallery/GalleryToggle.scss
57150
- // extracted by mini-css-extract-plugin
57151
-
57152
- ;// ./src/lib/viewers/controls/gallery/GalleryToggle.tsx
57153
- /* provided dependency */ var GalleryToggle_ = __webpack_require__(441)["Tl"];
57154
-
57155
-
57156
-
57157
- function GalleryToggle({
57158
- onGalleryToggle,
57159
- isGalleryOpen
57160
- }) {
57161
- if (!onGalleryToggle) {
57162
- return null;
57163
- }
57164
- return /*#__PURE__*/external_react_["default"].createElement("button", {
57165
- "aria-pressed": isGalleryOpen,
57166
- className: `bp-GalleryToggle${isGalleryOpen ? ' bp-is-active' : ''}`,
57167
- "data-resin-target": "galleryView",
57168
- onClick: onGalleryToggle,
57169
- title: GalleryToggle_('gallery_view'),
57170
- type: "button"
57171
- }, /*#__PURE__*/external_react_["default"].createElement(icons_IconGridView24, null));
57172
- }
57173
- ;// ./src/lib/viewers/controls/icons/IconNavMedium24.tsx
57174
- function IconNavMedium24_extends() { return IconNavMedium24_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; }, IconNavMedium24_extends.apply(null, arguments); }
57175
-
57176
- function IconNavMedium24(props) {
57177
- return /*#__PURE__*/external_react_.createElement("svg", IconNavMedium24_extends({
57178
- "data-testid": "IconNavMedium24",
57179
- focusable: "false",
57180
- height: "1em",
57181
- role: "img",
57182
- viewBox: "0 0 24 24",
57183
- width: "1em"
57184
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57185
- clipRule: "evenodd",
57186
- d: "M11 6h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8V6ZM9 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h4ZM5 18a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h4v12H5Zm0-9a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H6a1 1 0 0 1-1-1Zm1 2a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H6Z",
57187
- fill: "#fff",
57188
- fillRule: "evenodd"
57189
- }));
57190
- }
57191
- /* harmony default export */ const icons_IconNavMedium24 = (IconNavMedium24);
57192
- ;// ./src/lib/viewers/controls/icons/IconNavMediumFilled24.tsx
57193
- function IconNavMediumFilled24_extends() { return IconNavMediumFilled24_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; }, IconNavMediumFilled24_extends.apply(null, arguments); }
57194
-
57195
- function IconNavMediumFilled24(props) {
57196
- return /*#__PURE__*/external_react_.createElement("svg", IconNavMediumFilled24_extends({
57197
- "data-testid": "IconNavMediumFilled24",
57198
- fill: "none",
57199
- focusable: "false",
57200
- height: "1em",
57201
- role: "img",
57202
- viewBox: "0 0 24 24",
57203
- width: "1em"
57204
- }, props), /*#__PURE__*/external_react_.createElement("path", {
57205
- clipRule: "evenodd",
57206
- d: "M6 4a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V8a4 4 0 0 0-4-4H6Zm0 4a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2H6Zm-1 4a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm13-6h-7v12h7a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2Z",
57207
- fill: "#fff",
57208
- fillRule: "evenodd"
57209
- }));
57210
- }
57211
- /* harmony default export */ const icons_IconNavMediumFilled24 = (IconNavMediumFilled24);
57212
- ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.scss
57213
- // extracted by mini-css-extract-plugin
57214
-
57215
- ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.tsx
57216
- /* provided dependency */ var ThumbnailsToggle_ = __webpack_require__(441)["Tl"];
57217
-
57218
-
57219
-
57220
-
57221
- function ThumbnailsToggle({
57222
- onThumbnailsToggle,
57223
- isThumbnailsOpen
57224
- }) {
57225
- if (!onThumbnailsToggle) {
57226
- return null;
57227
- }
57228
- return /*#__PURE__*/external_react_["default"].createElement("button", {
57229
- "aria-expanded": isThumbnailsOpen,
57230
- className: "bp-ThumbnailsToggle",
57231
- "data-resin-target": "thumbnails",
57232
- onClick: onThumbnailsToggle,
57233
- title: ThumbnailsToggle_('toggle_thumbnails'),
57234
- type: "button"
57235
- }, isThumbnailsOpen ? /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMediumFilled24, null) : /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMedium24, null));
57236
- }
57237
- ;// ./src/lib/viewers/doc/DocControls.tsx
57238
-
57239
-
57240
-
57241
-
57242
-
57243
-
57244
-
57245
-
57246
-
57247
-
57248
-
57249
-
57250
- function DocControls({
57251
- annotationColor,
57252
- annotationMode,
57253
- experiences,
57254
- hasDrawing,
57255
- hasGalleryZoom = false,
57256
- hasHighlight,
57257
- hasRegion,
57258
- isGalleryOpen,
57259
- isThumbnailsOpen,
57260
- maxScale,
57261
- minScale,
57262
- onAnnotationColorChange,
57263
- onAnnotationModeClick,
57264
- onAnnotationModeEscape,
57265
- onFindBarToggle,
57266
- onFullscreenToggle,
57267
- onGalleryToggle,
57268
- onPageChange,
57269
- onPageSubmit,
57270
- onRotateLeft,
57271
- onThumbnailsToggle,
57272
- onZoomIn,
57273
- onZoomOut,
57274
- pageCount,
57275
- pageNumber,
57276
- scale
57277
- }) {
57278
- return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
57279
- experiences: experiences
57280
- }, /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
57281
- isThumbnailsOpen: isThumbnailsOpen,
57282
- onThumbnailsToggle: onThumbnailsToggle
57283
- }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
57284
- onFindBarToggle: onFindBarToggle
57285
- })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
57286
- isDistinct: true
57287
- }, /*#__PURE__*/external_react_["default"].createElement(PageControls, {
57288
- onPageChange: onPageChange,
57289
- onPageSubmit: onPageSubmit,
57290
- pageCount: pageCount,
57291
- pageNumber: pageNumber
57292
- }))), (!isGalleryOpen || hasGalleryZoom) && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
57293
- isDistinct: true
57294
- }, /*#__PURE__*/external_react_["default"].createElement(ZoomControls, {
57295
- maxScale: maxScale,
57296
- minScale: minScale,
57297
- onZoomIn: onZoomIn,
57298
- onZoomOut: onZoomOut,
57299
- resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
57300
- resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
57301
- scale: scale
57302
- })), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
57303
- onRotateLeft: onRotateLeft
57304
- })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
57305
- isGalleryOpen: isGalleryOpen,
57306
- onGalleryToggle: onGalleryToggle
57307
- }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
57308
- onFullscreenToggle: onFullscreenToggle
57309
- }), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(AnnotationsControls, {
57310
- annotationColor: annotationColor,
57311
- annotationMode: annotationMode,
57312
- hasDrawing: hasDrawing,
57313
- hasHighlight: hasHighlight,
57314
- hasRegion: hasRegion,
57315
- onAnnotationModeClick: onAnnotationModeClick,
57316
- onAnnotationModeEscape: onAnnotationModeEscape
57317
- }))), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, /*#__PURE__*/external_react_["default"].createElement(DrawingControls, {
57318
- annotationColor: annotationColor,
57319
- annotationMode: annotationMode,
57320
- onAnnotationColorChange: onAnnotationColorChange
57321
- })));
57322
- }
57323
- ;// external "@box/blueprint-web-assets/icons/Medium/GridView"
57324
-
57325
- ;// external "@box/blueprint-web-assets/icons/Medium/Nav"
57326
-
57327
- ;// external "@box/blueprint-web-assets/icons/Medium/RotateLeft"
57328
-
57329
- ;// external "@box/blueprint-web-assets/icons/Medium/Search"
57330
-
57331
- ;// external "@box/blueprint-web-assets/icons/Medium/XMark"
57332
-
57333
- ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.scss
57334
- // extracted by mini-css-extract-plugin
57335
-
57336
- ;// ./src/lib/viewers/controls/annotations/AnnotationsExitButtonV2.tsx
57337
- /* provided dependency */ var AnnotationsExitButtonV2_ = __webpack_require__(441)["Tl"];
57338
-
57339
-
57340
-
57341
-
57342
- function AnnotationsExitButtonV2({
57343
- onClick
57344
- }) {
57345
- return /*#__PURE__*/external_react_["default"].createElement("span", {
57346
- className: "bp-AnnotationsControls-exitBtn"
57347
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57348
- content: AnnotationsExitButtonV2_('exit_annotations')
57349
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57350
- "aria-label": AnnotationsExitButtonV2_('exit_annotations'),
57351
- "data-resin-target": "exit",
57352
- "data-testid": "bp-annotations-controls-exit-btn",
57353
- onClick: onClick
57354
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57355
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_XMark_07fbe0f0_default__
57356
- }))));
57357
- }
57358
- ;// ./src/lib/viewers/controls/controls-bar/useControlsOverflow.ts
57359
-
57360
-
57361
-
57362
- const ALWAYS_OVERFLOW = 0;
57363
- // The space the mocks leave between the bar and the edges of the viewer
57364
- const EDGE_MARGIN = 40;
57365
- // One toolbar button, the estimate for a control or the overflow trigger before it has been measured
57366
- const DEFAULT_WIDTH = 32;
57367
- const isCollapsible = ({
57368
- menu,
57369
- priority
57370
- }) => !!menu && priority !== undefined;
57371
- function getOverflowIds(items, availableWidth, metrics) {
57372
- const {
57373
- chrome,
57374
- gap,
57375
- triggerWidth = DEFAULT_WIDTH,
57376
- widths
57377
- } = metrics;
57378
- const overflowIds = new Set(items.filter(item => isCollapsible(item) && item.priority === ALWAYS_OVERFLOW).map(({
57379
- id
57380
- }) => id));
57381
- const getBarWidth = () => {
57382
- const slots = items.filter(({
57383
- id
57384
- }) => !overflowIds.has(id)).map(({
57385
- id
57386
- }) => widths.get(id) ?? DEFAULT_WIDTH);
57387
- if (overflowIds.size) {
57388
- slots.push(triggerWidth);
57389
- }
57390
- return chrome + slots.reduce((total, width) => total + width, 0) + gap * Math.max(slots.length - 1, 0);
57391
- };
57392
- const priorities = items.filter(item => isCollapsible(item) && item.priority !== ALWAYS_OVERFLOW).map(({
57393
- priority
57394
- }) => priority).sort((a, b) => a - b);
57395
- Array.from(new Set(priorities)).every(priority => {
57396
- if (getBarWidth() <= availableWidth) {
57397
- return false;
57398
- }
57399
- items.filter(item => isCollapsible(item) && item.priority === priority).forEach(({
57400
- id
57401
- }) => overflowIds.add(id));
57402
- return true;
57403
- });
57404
- return overflowIds;
57405
- }
57406
- const getStyleWidth = (style, properties) => properties.reduce((total, property) => total + (parseFloat(style.getPropertyValue(property)) || 0), 0);
57407
- function useControlsOverflow(items) {
57408
- const barRef = external_react_["default"].useRef(null);
57409
- const metricsRef = external_react_["default"].useRef({
57410
- chrome: 0,
57411
- gap: 0,
57412
- widths: new Map()
57413
- });
57414
- const portalContainer = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n);
57415
- const [availableWidth, setAvailableWidth] = external_react_["default"].useState(Number.POSITIVE_INFINITY);
57416
- const [, forceUpdate] = external_react_["default"].useReducer(count => count + 1, 0);
57417
-
57418
- // A control can only be measured while it is on the bar, so each width is cached as it renders and
57419
- // reused to decide whether that control would fit again
57420
- external_react_["default"].useLayoutEffect(() => {
57421
- const bar = barRef.current;
57422
- if (!bar) {
57423
- return;
57424
- }
57425
- const metrics = metricsRef.current;
57426
- const style = window.getComputedStyle(bar);
57427
- const chrome = getStyleWidth(style, ['padding-left', 'padding-right', 'border-left-width', 'border-right-width']);
57428
- const gap = getStyleWidth(style, ['column-gap']);
57429
- let hasChanged = chrome !== metrics.chrome || gap !== metrics.gap;
57430
- metrics.chrome = chrome;
57431
- metrics.gap = gap;
57432
- Array.from(bar.children).forEach(child => {
57433
- const {
57434
- offsetWidth
57435
- } = child;
57436
- const {
57437
- overflowId,
57438
- overflowTrigger
57439
- } = child.dataset;
57440
- if (!offsetWidth) {
57441
- return;
57442
- }
57443
- if (overflowId && metrics.widths.get(overflowId) !== offsetWidth) {
57444
- metrics.widths.set(overflowId, offsetWidth);
57445
- hasChanged = true;
57446
- }
57447
- if (overflowTrigger !== undefined && metrics.triggerWidth !== offsetWidth) {
57448
- metrics.triggerWidth = offsetWidth;
57449
- hasChanged = true;
57450
- }
57451
- });
57452
- if (hasChanged) {
57453
- forceUpdate();
57454
- }
57455
- });
57456
-
57457
- // The bar renders nothing without items, so the viewer lookup reruns once it mounts
57458
- const hasItems = items.length > 0;
57459
-
57460
- // The controls root is centered and shrinks to fit the bar, so the space the bar can grow into is the
57461
- // viewer's. Fullscreen resizes the viewer too, which the observer picks up.
57462
- external_react_["default"].useLayoutEffect(() => {
57463
- const container = portalContainer ?? barRef.current?.closest(`.${constants/* CLASS_BOX_PREVIEW_CONTENT */.SG}`) ?? null;
57464
- if (!container) {
57465
- return undefined;
57466
- }
57467
- const updateAvailableWidth = () => {
57468
- const {
57469
- clientWidth
57470
- } = container;
57471
-
57472
- // A container that has not been laid out yet measures zero, which would collapse everything
57473
- setAvailableWidth(clientWidth > 0 ? clientWidth - EDGE_MARGIN : Number.POSITIVE_INFINITY);
57474
- };
57475
- updateAvailableWidth();
57476
- if (typeof ResizeObserver === 'undefined') {
57477
- return undefined;
57478
- }
57479
- const observer = new ResizeObserver(updateAvailableWidth);
57480
- observer.observe(container);
57481
- return () => observer.disconnect();
57482
- }, [hasItems, portalContainer]);
57483
- const overflowIds = getOverflowIds(items, availableWidth, metricsRef.current);
57484
- return {
57485
- barRef,
57486
- overflowItems: items.filter(({
57487
- id
57488
- }) => overflowIds.has(id)),
57489
- visibleItems: items.filter(({
57490
- id
57491
- }) => !overflowIds.has(id))
57492
- };
58179
+ viewBox: "0 0 24 24",
58180
+ width: "1em"
58181
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58182
+ d: "M8 13a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h2ZM6 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2ZM8 3a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2Zm10 0a3 3 0 0 1 3 3v2a3 3 0 0 1-3 3h-2a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h2ZM6 5a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H6Zm10 0a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z",
58183
+ fill: "#fff",
58184
+ fillRule: "evenodd"
58185
+ }));
57493
58186
  }
57494
- ;// external "@box/blueprint-web-assets/icons/Medium/EllipsisVertical"
57495
-
57496
- // EXTERNAL MODULE: ./src/lib/viewers/controls/tooltip/MenuTriggerTooltipV2.tsx
57497
- var MenuTriggerTooltipV2 = __webpack_require__(6014);
57498
- // EXTERNAL MODULE: ./src/lib/viewers/controls/settings/stopMenuKeyPropagation.ts
57499
- var stopMenuKeyPropagation = __webpack_require__(9646);
57500
- ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.scss
58187
+ /* harmony default export */ const icons_IconGridView24 = (IconGridView24);
58188
+ ;// ./src/lib/viewers/controls/gallery/GalleryToggle.scss
57501
58189
  // extracted by mini-css-extract-plugin
57502
58190
 
57503
- ;// ./src/lib/viewers/controls/controls-bar/ControlsOverflowMenuV2.tsx
57504
- /* provided dependency */ var ControlsOverflowMenuV2_ = __webpack_require__(441)["Tl"];
57505
- function ControlsOverflowMenuV2_extends() { return ControlsOverflowMenuV2_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; }, ControlsOverflowMenuV2_extends.apply(null, arguments); }
57506
-
57507
-
58191
+ ;// ./src/lib/viewers/controls/gallery/GalleryToggle.tsx
58192
+ /* provided dependency */ var GalleryToggle_ = __webpack_require__(441)["Tl"];
57508
58193
 
57509
58194
 
57510
58195
 
58196
+ function GalleryToggle({
58197
+ onGalleryToggle,
58198
+ isGalleryOpen
58199
+ }) {
58200
+ if (!onGalleryToggle) {
58201
+ return null;
58202
+ }
58203
+ return /*#__PURE__*/external_react_["default"].createElement("button", {
58204
+ "aria-pressed": isGalleryOpen,
58205
+ className: `bp-GalleryToggle${isGalleryOpen ? ' bp-is-active' : ''}`,
58206
+ "data-resin-target": "galleryView",
58207
+ onClick: onGalleryToggle,
58208
+ title: GalleryToggle_('gallery_view'),
58209
+ type: "button"
58210
+ }, /*#__PURE__*/external_react_["default"].createElement(icons_IconGridView24, null));
58211
+ }
58212
+ ;// ./src/lib/viewers/controls/icons/IconNavMedium24.tsx
58213
+ function IconNavMedium24_extends() { return IconNavMedium24_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; }, IconNavMedium24_extends.apply(null, arguments); }
57511
58214
 
58215
+ function IconNavMedium24(props) {
58216
+ return /*#__PURE__*/external_react_.createElement("svg", IconNavMedium24_extends({
58217
+ "data-testid": "IconNavMedium24",
58218
+ focusable: "false",
58219
+ height: "1em",
58220
+ role: "img",
58221
+ viewBox: "0 0 24 24",
58222
+ width: "1em"
58223
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58224
+ clipRule: "evenodd",
58225
+ d: "M11 6h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8V6ZM9 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h4ZM5 18a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h4v12H5Zm0-9a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H6a1 1 0 0 1-1-1Zm1 2a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H6Z",
58226
+ fill: "#fff",
58227
+ fillRule: "evenodd"
58228
+ }));
58229
+ }
58230
+ /* harmony default export */ const icons_IconNavMedium24 = (IconNavMedium24);
58231
+ ;// ./src/lib/viewers/controls/icons/IconNavMediumFilled24.tsx
58232
+ function IconNavMediumFilled24_extends() { return IconNavMediumFilled24_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; }, IconNavMediumFilled24_extends.apply(null, arguments); }
57512
58233
 
58234
+ function IconNavMediumFilled24(props) {
58235
+ return /*#__PURE__*/external_react_.createElement("svg", IconNavMediumFilled24_extends({
58236
+ "data-testid": "IconNavMediumFilled24",
58237
+ fill: "none",
58238
+ focusable: "false",
58239
+ height: "1em",
58240
+ role: "img",
58241
+ viewBox: "0 0 24 24",
58242
+ width: "1em"
58243
+ }, props), /*#__PURE__*/external_react_.createElement("path", {
58244
+ clipRule: "evenodd",
58245
+ d: "M6 4a4 4 0 0 0-4 4v8a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V8a4 4 0 0 0-4-4H6Zm0 4a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2H6Zm-1 4a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm13-6h-7v12h7a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2Z",
58246
+ fill: "#fff",
58247
+ fillRule: "evenodd"
58248
+ }));
58249
+ }
58250
+ /* harmony default export */ const icons_IconNavMediumFilled24 = (IconNavMediumFilled24);
58251
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.scss
58252
+ // extracted by mini-css-extract-plugin
57513
58253
 
57514
- // Handlers that return focus to the control that invoked them get the trigger, since the row unmounts with the menu
57515
- const ControlsOverflowTriggerContext = /*#__PURE__*/external_react_["default"].createContext({
57516
- current: null
57517
- });
58254
+ ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggle.tsx
58255
+ /* provided dependency */ var ThumbnailsToggle_ = __webpack_require__(441)["Tl"];
57518
58256
 
57519
- // The menu portals out of the controls root, so it carries the root's Resin attributes itself
57520
- const getResinAttributes = element => {
57521
- const resinComponent = element?.closest('[data-resin-component]');
57522
- return resinComponent ? Object.fromEntries(Array.from(resinComponent.attributes).filter(({
57523
- name
57524
- }) => name.startsWith('data-resin-')).map(({
57525
- name,
57526
- value
57527
- }) => [name, value])) : {};
57528
- };
57529
- function ControlsOverflowToggle(props, ref) {
57530
- const isMenuOpen = props['aria-expanded'] === true || props['aria-expanded'] === 'true';
57531
- return /*#__PURE__*/external_react_["default"].createElement(MenuTriggerTooltipV2/* default */.A, {
57532
- content: ControlsOverflowMenuV2_('controls_more'),
57533
- isMenuOpen: isMenuOpen
57534
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, ControlsOverflowMenuV2_extends({
57535
- ref: ref,
57536
- "aria-label": ControlsOverflowMenuV2_('controls_more'),
57537
- "data-resin-target": "moreOptions",
57538
- "data-testid": "bp-ControlsBar-overflowBtn"
57539
- }, props), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57540
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_EllipsisVertical_06d33c4b_default__
57541
- })));
57542
- }
57543
- const ControlsOverflowToggleV2 = /*#__PURE__*/external_react_["default"].forwardRef(ControlsOverflowToggle);
57544
- function ControlsOverflowMenuV2({
57545
- items
57546
- }) {
57547
- const container = external_react_["default"].useContext(BlueprintProviders/* PortalContainerContext */.n) ?? undefined;
57548
- const {
57549
- setIsForced
57550
- } = external_react_["default"].useContext(ControlsLayerContext);
57551
- const triggerRef = external_react_["default"].useRef(null);
57552
- const [isOpen, setIsOpen] = external_react_["default"].useState(false);
57553
- const [resinAttributes, setResinAttributes] = external_react_["default"].useState({});
57554
- const handleOpenChange = open => {
57555
- if (open) {
57556
- setResinAttributes(getResinAttributes(triggerRef.current));
57557
- }
57558
- setIsOpen(open);
57559
- };
57560
58257
 
57561
- // The menu sits outside the controls layer, which would otherwise hide the bar under the open menu
57562
- external_react_["default"].useEffect(() => {
57563
- if (!isOpen) {
57564
- return undefined;
57565
- }
57566
- setIsForced(true);
57567
- return () => setIsForced(false);
57568
- }, [isOpen, setIsForced]);
57569
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Root, {
57570
- modal: false,
57571
- onOpenChange: handleOpenChange,
57572
- open: isOpen
57573
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Trigger, {
57574
- ref: triggerRef,
57575
- asChild: true,
57576
- "data-overflow-ids": items.map(({
57577
- id
57578
- }) => id).join(' '),
57579
- "data-overflow-trigger": ""
57580
- }, /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowToggleV2, null)), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, ControlsOverflowMenuV2_extends({
57581
- align: "end",
57582
- className: "bp-ControlsOverflowMenuV2",
57583
- container: container,
57584
- "data-testid": "bp-ControlsBar-overflowMenu",
57585
- onEscapeKeyDown: stopMenuKeyPropagation/* stopEscapePropagation */.s,
57586
- onKeyDown: stopMenuKeyPropagation/* stopKeyPropagation */.a,
57587
- side: "top"
57588
- }, resinAttributes), /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowTriggerContext.Provider, {
57589
- value: triggerRef
57590
- }, items.map(({
57591
- id,
57592
- menu
57593
- }) => /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, {
57594
- key: id
57595
- }, menu)))));
57596
- }
57597
- ;// ./src/lib/viewers/controls/controls-bar/shortcuts.ts
57598
- /* provided dependency */ var shortcuts_ = __webpack_require__(441)["Tl"];
57599
58258
 
57600
- // iPads report a Mac user agent, and their keyboards have the command key too
57601
- const isApplePlatform = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
57602
58259
 
57603
- // Preview binds its shortcuts to both Cmd and Ctrl, so each platform is shown the modifier its keyboard labels
57604
- function getShortcut(key) {
57605
- return isApplePlatform() ? {
57606
- keys: `Meta+${key}`,
57607
- label: `⌘ + ${key}`
57608
- } : {
57609
- keys: `Control+${key}`,
57610
- label: (0,util/* replacePlaceholders */.Lb)(shortcuts_('controls_shortcut_ctrl'), [key])
57611
- };
58260
+ function ThumbnailsToggle({
58261
+ onThumbnailsToggle,
58262
+ isThumbnailsOpen
58263
+ }) {
58264
+ if (!onThumbnailsToggle) {
58265
+ return null;
58266
+ }
58267
+ return /*#__PURE__*/external_react_["default"].createElement("button", {
58268
+ "aria-expanded": isThumbnailsOpen,
58269
+ className: "bp-ThumbnailsToggle",
58270
+ "data-resin-target": "thumbnails",
58271
+ onClick: onThumbnailsToggle,
58272
+ title: ThumbnailsToggle_('toggle_thumbnails'),
58273
+ type: "button"
58274
+ }, isThumbnailsOpen ? /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMediumFilled24, null) : /*#__PURE__*/external_react_["default"].createElement(icons_IconNavMedium24, null));
57612
58275
  }
57613
- ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.scss
57614
- // extracted by mini-css-extract-plugin
58276
+ ;// ./src/lib/viewers/doc/DocControls.tsx
57615
58277
 
57616
- ;// ./src/lib/viewers/controls/controls-bar/ControlsMenuItemV2.tsx
57617
- const ControlsMenuItemV2_excluded = ["bareKey", "icon", "keepOpen", "label", "onSelect", "shortcutKey"];
57618
- function ControlsMenuItemV2_extends() { return ControlsMenuItemV2_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; }, ControlsMenuItemV2_extends.apply(null, arguments); }
57619
- function ControlsMenuItemV2_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ControlsMenuItemV2_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; }
57620
- function ControlsMenuItemV2_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; }
57621
58278
 
57622
58279
 
57623
58280
 
57624
58281
 
57625
58282
 
57626
- // The menu form of a bar control. Toggles are plain rows whose label names the next action, since checkbox
57627
- // rows reserve space for a checkmark that the mocks do not have.
57628
- function ControlsMenuItemV2(_ref) {
57629
- let {
57630
- bareKey,
57631
- icon,
57632
- keepOpen,
57633
- label,
57634
- onSelect,
57635
- shortcutKey
57636
- } = _ref,
57637
- rest = ControlsMenuItemV2_objectWithoutProperties(_ref, ControlsMenuItemV2_excluded);
57638
- const triggerRef = external_react_["default"].useContext(ControlsOverflowTriggerContext);
57639
- let shortcut = null;
57640
- if (shortcutKey) {
57641
- shortcut = getShortcut(shortcutKey);
57642
- } else if (bareKey) {
57643
- shortcut = {
57644
- keys: bareKey,
57645
- label: bareKey
57646
- };
57647
- }
57648
- const handleSelect = event => {
57649
- if (keepOpen) {
57650
- event.preventDefault();
57651
- }
57652
- onSelect(triggerRef.current);
57653
- };
57654
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, ControlsMenuItemV2_extends({
57655
- "aria-keyshortcuts": shortcut?.keys,
57656
- onSelect: handleSelect
57657
- }, rest, {
57658
- className: "bp-ControlsMenuItemV2"
57659
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
57660
- icon: icon
57661
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
57662
- label: label
57663
- }), shortcut && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.EndElement, {
57664
- "aria-hidden": true
57665
- }, shortcut.label));
57666
- }
57667
- ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.scss
57668
- // extracted by mini-css-extract-plugin
57669
58283
 
57670
- ;// ./src/lib/viewers/controls/controls-bar/ResponsiveControlsBarV2.tsx
57671
58284
 
57672
58285
 
57673
58286
 
57674
58287
 
57675
58288
 
57676
- // Moves controls into an overflow menu as the viewer narrows. Bars that always show everything, like the
57677
- // annotations palette, use ControlsBarV2 directly.
57678
- function ResponsiveControlsBarV2({
57679
- items
58289
+ function DocControls({
58290
+ annotationColor,
58291
+ annotationMode,
58292
+ experiences,
58293
+ hasDrawing,
58294
+ hasGalleryZoom = false,
58295
+ hasHighlight,
58296
+ hasRegion,
58297
+ isGalleryOpen,
58298
+ isThumbnailsOpen,
58299
+ maxScale,
58300
+ minScale,
58301
+ onAnnotationColorChange,
58302
+ onAnnotationModeClick,
58303
+ onAnnotationModeEscape,
58304
+ onFindBarToggle,
58305
+ onFullscreenToggle,
58306
+ onGalleryToggle,
58307
+ onPageChange,
58308
+ onPageSubmit,
58309
+ onRotateLeft,
58310
+ onThumbnailsToggle,
58311
+ onZoomIn,
58312
+ onZoomOut,
58313
+ pageCount,
58314
+ pageNumber,
58315
+ scale
57680
58316
  }) {
57681
- const {
57682
- barRef,
57683
- overflowItems,
57684
- visibleItems
57685
- } = useControlsOverflow(items);
57686
- if (!items.length) {
57687
- return null;
57688
- }
57689
- return /*#__PURE__*/external_react_["default"].createElement(controls_bar_ControlsBarV2, {
57690
- ref: barRef
57691
- }, visibleItems.map(({
57692
- control,
57693
- id
57694
- }) => /*#__PURE__*/external_react_["default"].createElement("div", {
57695
- key: id,
57696
- className: "bp-ResponsiveControlsBarV2-item",
57697
- "data-overflow-id": id
57698
- }, control)), overflowItems.length > 0 && /*#__PURE__*/external_react_["default"].createElement(ControlsOverflowMenuV2, {
57699
- items: overflowItems
57700
- }));
58317
+ return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
58318
+ experiences: experiences
58319
+ }, /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(ThumbnailsToggle, {
58320
+ isThumbnailsOpen: isThumbnailsOpen,
58321
+ onThumbnailsToggle: onThumbnailsToggle
58322
+ }), /*#__PURE__*/external_react_["default"].createElement(FindBarToggle, {
58323
+ onFindBarToggle: onFindBarToggle
58324
+ })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
58325
+ isDistinct: true
58326
+ }, /*#__PURE__*/external_react_["default"].createElement(PageControls, {
58327
+ onPageChange: onPageChange,
58328
+ onPageSubmit: onPageSubmit,
58329
+ pageCount: pageCount,
58330
+ pageNumber: pageNumber
58331
+ }))), (!isGalleryOpen || hasGalleryZoom) && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, {
58332
+ isDistinct: true
58333
+ }, /*#__PURE__*/external_react_["default"].createElement(ZoomControls, {
58334
+ maxScale: maxScale,
58335
+ minScale: minScale,
58336
+ onZoomIn: onZoomIn,
58337
+ onZoomOut: onZoomOut,
58338
+ resinTargetZoomIn: isGalleryOpen ? 'galleryZoomIn' : undefined,
58339
+ resinTargetZoomOut: isGalleryOpen ? 'galleryZoomOut' : undefined,
58340
+ scale: scale
58341
+ })), !isGalleryOpen && onRotateLeft && /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(RotateControl, {
58342
+ onRotateLeft: onRotateLeft
58343
+ })), /*#__PURE__*/external_react_["default"].createElement(ControlsBarGroup, null, /*#__PURE__*/external_react_["default"].createElement(GalleryToggle, {
58344
+ isGalleryOpen: isGalleryOpen,
58345
+ onGalleryToggle: onGalleryToggle
58346
+ }), /*#__PURE__*/external_react_["default"].createElement(FullscreenToggle, {
58347
+ onFullscreenToggle: onFullscreenToggle
58348
+ }), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(AnnotationsControls, {
58349
+ annotationColor: annotationColor,
58350
+ annotationMode: annotationMode,
58351
+ hasDrawing: hasDrawing,
58352
+ hasHighlight: hasHighlight,
58353
+ hasRegion: hasRegion,
58354
+ onAnnotationModeClick: onAnnotationModeClick,
58355
+ onAnnotationModeEscape: onAnnotationModeEscape
58356
+ }))), !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsBar, null, /*#__PURE__*/external_react_["default"].createElement(DrawingControls, {
58357
+ annotationColor: annotationColor,
58358
+ annotationMode: annotationMode,
58359
+ onAnnotationColorChange: onAnnotationColorChange
58360
+ })));
57701
58361
  }
58362
+ ;// external "@box/blueprint-web-assets/icons/Medium/GridView"
58363
+
58364
+ ;// external "@box/blueprint-web-assets/icons/Medium/Nav"
58365
+
58366
+ ;// external "@box/blueprint-web-assets/icons/Medium/Search"
58367
+
57702
58368
  ;// ./src/lib/viewers/controls/findbar/FindBarToggleV2.tsx
57703
58369
  /* provided dependency */ var FindBarToggleV2_ = __webpack_require__(441)["Tl"];
57704
58370
 
@@ -57749,176 +58415,6 @@ function GalleryToggleV2({
57749
58415
  value: "gallery"
57750
58416
  })));
57751
58417
  }
57752
- ;// external "@box/blueprint-web-assets/icons/Medium/ChevronDown"
57753
-
57754
- ;// external "@box/blueprint-web-assets/icons/Medium/ChevronUp"
57755
-
57756
- ;// ./src/lib/viewers/controls/page/PageControlsFormV2.scss
57757
- // extracted by mini-css-extract-plugin
57758
-
57759
- ;// ./src/lib/viewers/controls/page/PageControlsFormV2.tsx
57760
- /* provided dependency */ var PageControlsFormV2_ = __webpack_require__(441)["Tl"];
57761
-
57762
-
57763
-
57764
-
57765
-
57766
- function PageControlsFormV2({
57767
- onPageSubmit,
57768
- pageNumber,
57769
- pageCount
57770
- }) {
57771
- const [isInputShown, setIsInputShown] = external_react_["default"].useState(false);
57772
- // A string because Toolbar.Input only supports text types, so a parsed number would show "NaN" once cleared
57773
- const [inputValue, setInputValue] = external_react_["default"].useState(pageNumber.toString());
57774
- const buttonElRef = external_react_["default"].useRef(null);
57775
- const inputElRef = external_react_["default"].useRef(null);
57776
- const isRetryRef = external_react_["default"].useRef(false);
57777
- const setPage = (allowRetry = false) => {
57778
- const newPageNumber = Number(inputValue);
57779
- if (Number.isInteger(newPageNumber) && newPageNumber >= 1 && newPageNumber <= pageCount && newPageNumber !== pageNumber) {
57780
- onPageSubmit(newPageNumber);
57781
- } else {
57782
- setInputValue(pageNumber.toString()); // Reset the invalid input value to the current page
57783
-
57784
- if (allowRetry) {
57785
- isRetryRef.current = true;
57786
- }
57787
- }
57788
- setIsInputShown(false);
57789
- };
57790
- const handleNumInputChange = event => {
57791
- setInputValue(event.target.value);
57792
- };
57793
- const handleNumInputBlur = () => {
57794
- setPage();
57795
- };
57796
- const handleNumInputKeyDown = event => {
57797
- const key = (0,util/* decodeKeydown */.wU)(event);
57798
- switch (key) {
57799
- case ENTER:
57800
- event.stopPropagation();
57801
- event.preventDefault();
57802
- setPage(true);
57803
- break;
57804
- case ESCAPE:
57805
- event.stopPropagation();
57806
- event.preventDefault();
57807
- isRetryRef.current = true;
57808
- setIsInputShown(false);
57809
- setInputValue(pageNumber.toString());
57810
- break;
57811
- default:
57812
- break;
57813
- }
57814
- };
57815
- external_react_["default"].useEffect(() => {
57816
- setInputValue(pageNumber.toString()); // Keep internal state in sync with prop as it changes
57817
- }, [pageNumber]);
57818
- external_react_["default"].useLayoutEffect(() => {
57819
- if (inputElRef.current && isInputShown) {
57820
- inputElRef.current.select();
57821
- }
57822
- if (buttonElRef.current && !isInputShown) {
57823
- if (isRetryRef.current) {
57824
- buttonElRef.current.focus();
57825
- }
57826
- isRetryRef.current = false;
57827
- }
57828
- }, [isInputShown]);
57829
- return /*#__PURE__*/external_react_["default"].createElement("div", {
57830
- className: "bp-PageControlsFormV2",
57831
- "data-testid": "bp-PageControlsForm"
57832
- }, isInputShown ? /*#__PURE__*/external_react_["default"].createElement("div", {
57833
- className: "bp-PageControlsFormV2-input"
57834
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Input, {
57835
- ref: inputElRef,
57836
- "aria-label": PageControlsFormV2_('enter_page_num'),
57837
- "data-resin-target": "pageNumberInput",
57838
- "data-testid": "bp-PageControlsForm-input",
57839
- inputMode: "numeric",
57840
- onBlur: handleNumInputBlur,
57841
- onChange: handleNumInputChange,
57842
- onKeyDown: handleNumInputKeyDown,
57843
- pattern: "[0-9]*",
57844
- size: 3,
57845
- value: inputValue
57846
- })) : /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57847
- content: PageControlsFormV2_('enter_page_num')
57848
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57849
- ref: buttonElRef,
57850
- "data-resin-target": "pageNumberOpen",
57851
- "data-testid": "bp-PageControlsForm-button",
57852
- disabled: pageCount <= 1,
57853
- onClick: () => setIsInputShown(true)
57854
- }, /*#__PURE__*/external_react_["default"].createElement("span", {
57855
- className: "bp-PageControlsFormV2-button-label",
57856
- "data-testid": "bp-PageControlsForm-button-label"
57857
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
57858
- as: "span",
57859
- color: "textOnDarkDefault"
57860
- }, `${pageNumber} / ${pageCount}`)))));
57861
- }
57862
- ;// ./src/lib/viewers/controls/page/PageControlsV2.tsx
57863
- /* provided dependency */ var PageControlsV2_ = __webpack_require__(441)["Tl"];
57864
-
57865
-
57866
-
57867
-
57868
-
57869
- function PageControlsV2({
57870
- onPageChange,
57871
- onPageSubmit,
57872
- pageCount,
57873
- pageNumber
57874
- }) {
57875
- if (pageCount <= 1) {
57876
- return null;
57877
- }
57878
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57879
- content: PageControlsV2_('previous_page')
57880
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57881
- "aria-label": PageControlsV2_('previous_page'),
57882
- "data-resin-target": "pagePrevious",
57883
- "data-testid": "bp-PageControls-previous",
57884
- disabled: pageNumber === 1,
57885
- onClick: () => onPageChange(pageNumber - 1)
57886
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57887
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronUp_d399c022_default__
57888
- }))), /*#__PURE__*/external_react_["default"].createElement(PageControlsFormV2, {
57889
- onPageSubmit: onPageSubmit,
57890
- pageCount: pageCount,
57891
- pageNumber: pageNumber
57892
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57893
- content: PageControlsV2_('next_page')
57894
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57895
- "aria-label": PageControlsV2_('next_page'),
57896
- "data-resin-target": "pageNext",
57897
- "data-testid": "bp-PageControls-next",
57898
- disabled: pageNumber === pageCount,
57899
- onClick: () => onPageChange(pageNumber + 1)
57900
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57901
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_ChevronDown_a545a634_default__
57902
- }))));
57903
- }
57904
- ;// ./src/lib/viewers/controls/rotate/RotateControlV2.tsx
57905
- /* provided dependency */ var RotateControlV2_ = __webpack_require__(441)["Tl"];
57906
-
57907
-
57908
-
57909
- function RotateControlV2({
57910
- onRotateLeft
57911
- }) {
57912
- return /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
57913
- content: RotateControlV2_('rotate_left')
57914
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Button, {
57915
- "aria-label": RotateControlV2_('rotate_left'),
57916
- "data-resin-target": "rotate",
57917
- onClick: onRotateLeft
57918
- }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Toolbar.Icon, {
57919
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__
57920
- })));
57921
- }
57922
58418
  ;// external "@box/blueprint-web-assets/icons/MediumFilled/Nav"
57923
58419
 
57924
58420
  ;// ./src/lib/viewers/controls/sidebar/ThumbnailsToggleV2.scss
@@ -57972,64 +58468,6 @@ function useMediaQuery(query) {
57972
58468
  }, [query]);
57973
58469
  return matches;
57974
58470
  }
57975
- ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.scss
57976
- // extracted by mini-css-extract-plugin
57977
-
57978
- ;// ./src/lib/viewers/controls/zoom/ZoomMenuItemsV2.tsx
57979
- /* provided dependency */ var ZoomMenuItemsV2_ = __webpack_require__(441)["Tl"];
57980
-
57981
-
57982
-
57983
-
57984
-
57985
-
57986
-
57987
-
57988
-
57989
- // The overflow menu form of the zoom controls: the current scale, then zoom in and zoom out
57990
- function ZoomMenuItemsV2({
57991
- maxScale,
57992
- minScale,
57993
- onZoomIn,
57994
- onZoomOut,
57995
- resinTargetZoomIn = 'zoomIn',
57996
- resinTargetZoomOut = 'zoomOut',
57997
- scale
57998
- }) {
57999
- const {
58000
- canZoomIn,
58001
- canZoomOut,
58002
- currentScale
58003
- } = getZoomState({
58004
- maxScale,
58005
- minScale,
58006
- scale
58007
- });
58008
- const scaleLabel = (0,util/* replacePlaceholders */.Lb)(ZoomMenuItemsV2_('controls_zoom_scale'), [`${Math.round(currentScale * 100)}%`]);
58009
- return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
58010
- as: "div",
58011
- className: "bp-ZoomMenuItemsV2-scale",
58012
- color: "textOnLightSecondary",
58013
- "data-testid": "bp-ZoomMenuItems-scale",
58014
- variant: "caption"
58015
- }, scaleLabel), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58016
- "data-resin-target": resinTargetZoomIn,
58017
- "data-testid": "bp-ZoomControls-in-menuItem",
58018
- disabled: !canZoomIn,
58019
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Plus_aaa7b14f_default__,
58020
- keepOpen: true,
58021
- label: ZoomMenuItemsV2_('zoom_in'),
58022
- onSelect: () => onZoomIn()
58023
- }), /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58024
- "data-resin-target": resinTargetZoomOut,
58025
- "data-testid": "bp-ZoomControls-out-menuItem",
58026
- disabled: !canZoomOut,
58027
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_Minus_cc9df143_default__,
58028
- keepOpen: true,
58029
- label: ZoomMenuItemsV2_('zoom_out'),
58030
- onSelect: () => onZoomOut()
58031
- }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null));
58032
- }
58033
58471
  ;// ./src/lib/viewers/doc/DocControlsV2.tsx
58034
58472
  /* provided dependency */ var DocControlsV2_ = __webpack_require__(441)["Tl"];
58035
58473
 
@@ -58047,11 +58485,6 @@ function ZoomMenuItemsV2({
58047
58485
 
58048
58486
 
58049
58487
 
58050
-
58051
-
58052
-
58053
-
58054
-
58055
58488
 
58056
58489
 
58057
58490
 
@@ -58064,7 +58497,7 @@ const THUMBNAILS_MEDIA_QUERY = '(min-width: 768px)';
58064
58497
  // open. Then the grid toggle is the button itself, and nothing else collapses into a more options menu.
58065
58498
  // Rotate collapses next, then thumbnails and fullscreen together, then zoom. Page and the markup trigger
58066
58499
  // have no menu form and never collapse.
58067
- const PRIORITY = {
58500
+ const DocControlsV2_PRIORITY = {
58068
58501
  find: ALWAYS_OVERFLOW,
58069
58502
  fullscreen: 2,
58070
58503
  gallery: ALWAYS_OVERFLOW,
@@ -58100,30 +58533,14 @@ function DocControlsV2({
58100
58533
  pageNumber,
58101
58534
  scale
58102
58535
  }) {
58103
- const annotationsToggleRef = external_react_["default"].useRef(null);
58104
58536
  const isFullscreen = useFullscreen();
58105
58537
  const canShowThumbnails = useMediaQuery(THUMBNAILS_MEDIA_QUERY);
58106
-
58107
- // Listed in the palette's button order, which is also the order the toggle falls back to
58108
- const annotationModes = [];
58109
- if (!isFullscreen) {
58110
- if (hasRegion) {
58111
- annotationModes.push(AnnotationMode.REGION);
58112
- }
58113
- if (hasHighlight) {
58114
- annotationModes.push(AnnotationMode.HIGHLIGHT);
58115
- }
58116
- if (hasDrawing) {
58117
- annotationModes.push(AnnotationMode.DRAWING);
58118
- }
58119
- }
58538
+ const annotationModes = useAnnotationModes({
58539
+ hasDrawing,
58540
+ hasHighlight,
58541
+ hasRegion
58542
+ });
58120
58543
  const hasAnnotations = !isGalleryOpen && annotationModes.length > 0;
58121
- const handleAnnotationsExit = () => {
58122
- annotationsToggleRef.current?.focus();
58123
- onAnnotationModeClick({
58124
- mode: AnnotationMode.NONE
58125
- });
58126
- };
58127
58544
  const zoomProps = {
58128
58545
  maxScale,
58129
58546
  minScale,
@@ -58148,7 +58565,7 @@ function DocControlsV2({
58148
58565
  label: isThumbnailsOpen ? DocControlsV2_('controls_hide_thumbnails') : DocControlsV2_('controls_show_thumbnails'),
58149
58566
  onSelect: () => onThumbnailsToggle()
58150
58567
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null)),
58151
- priority: PRIORITY.thumbnails
58568
+ priority: DocControlsV2_PRIORITY.thumbnails
58152
58569
  }, !isGalleryOpen && pageCount > 1 && {
58153
58570
  control: /*#__PURE__*/external_react_["default"].createElement(PageControlsV2, {
58154
58571
  onPageChange: onPageChange,
@@ -58161,7 +58578,7 @@ function DocControlsV2({
58161
58578
  control: /*#__PURE__*/external_react_["default"].createElement(ZoomControlsV2, zoomProps),
58162
58579
  id: 'zoom',
58163
58580
  menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ZoomMenuItemsV2, zoomProps),
58164
- priority: isGalleryOpen ? undefined : PRIORITY.zoom
58581
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.zoom
58165
58582
  }, !isGalleryOpen && onFindBarToggle && {
58166
58583
  control: /*#__PURE__*/external_react_["default"].createElement(FindBarToggleV2, {
58167
58584
  onFindBarToggle: onFindBarToggle
@@ -58174,20 +58591,17 @@ function DocControlsV2({
58174
58591
  onSelect: onFindBarToggle,
58175
58592
  shortcutKey: "F"
58176
58593
  }),
58177
- priority: PRIORITY.find
58594
+ priority: DocControlsV2_PRIORITY.find
58178
58595
  }, !isGalleryOpen && onRotateLeft && {
58179
58596
  control: /*#__PURE__*/external_react_["default"].createElement(RotateControlV2, {
58180
58597
  onRotateLeft: onRotateLeft
58181
58598
  }),
58182
58599
  id: 'rotate',
58183
- menu: /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58184
- "data-resin-target": "rotate",
58185
- icon: __WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Medium_RotateLeft_c726d679_default__,
58186
- bareKey: "R",
58600
+ menu: /*#__PURE__*/external_react_["default"].createElement(RotateMenuItemV2, {
58187
58601
  label: DocControlsV2_('controls_rotate_document'),
58188
- onSelect: () => onRotateLeft()
58602
+ onRotateLeft: onRotateLeft
58189
58603
  }),
58190
- priority: PRIORITY.rotate
58604
+ priority: DocControlsV2_PRIORITY.rotate
58191
58605
  }, onGalleryToggle && {
58192
58606
  control: /*#__PURE__*/external_react_["default"].createElement(GalleryToggleV2, {
58193
58607
  isGalleryOpen: isGalleryOpen,
@@ -58200,47 +58614,36 @@ function DocControlsV2({
58200
58614
  label: DocControlsV2_('controls_view_as_grid'),
58201
58615
  onSelect: () => onGalleryToggle()
58202
58616
  }),
58203
- priority: isGalleryOpen ? undefined : PRIORITY.gallery
58617
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.gallery
58204
58618
  }, {
58205
58619
  control: /*#__PURE__*/external_react_["default"].createElement(FullscreenToggleV2, {
58206
58620
  onFullscreenToggle: onFullscreenToggle
58207
58621
  }),
58208
58622
  id: 'fullscreen',
58209
- menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(ControlsMenuItemV2, {
58210
- "data-resin-target": "fullscreen",
58211
- 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__,
58212
- bareKey: "F",
58213
- label: isFullscreen ? DocControlsV2_('exit_fullscreen') : DocControlsV2_('enter_fullscreen'),
58214
- onSelect: trigger => onFullscreenToggle(!isFullscreen, trigger)
58623
+ menu: !isGalleryOpen && /*#__PURE__*/external_react_["default"].createElement(FullscreenMenuItemV2, {
58624
+ onFullscreenToggle: onFullscreenToggle
58215
58625
  }),
58216
- priority: isGalleryOpen ? undefined : PRIORITY.fullscreen
58626
+ priority: isGalleryOpen ? undefined : DocControlsV2_PRIORITY.fullscreen
58217
58627
  }, hasAnnotations && {
58218
- control: /*#__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, {
58219
- onClick: handleAnnotationsExit
58220
- }), /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsToggleV2, {
58221
- ref: annotationsToggleRef,
58628
+ control: /*#__PURE__*/external_react_["default"].createElement(AnnotationsControlsV2, {
58222
58629
  annotationMode: annotationMode,
58223
58630
  modes: annotationModes,
58224
58631
  onAnnotationModeClick: onAnnotationModeClick,
58225
58632
  onAnnotationModeEscape: onAnnotationModeEscape
58226
- })),
58633
+ }),
58227
58634
  id: 'annotations'
58228
58635
  }];
58229
58636
  return /*#__PURE__*/external_react_["default"].createElement(ExperiencesProvider, {
58230
58637
  experiences: experiences
58231
58638
  }, /*#__PURE__*/external_react_["default"].createElement(ResponsiveControlsBarV2, {
58232
58639
  items: items.filter(item => !!item)
58233
- }), hasAnnotations && annotationMode !== AnnotationMode.NONE && /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2, null, /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Modes, {
58640
+ }), hasAnnotations && /*#__PURE__*/external_react_["default"].createElement(AnnotationsPaletteControlsV2, {
58641
+ annotationColor: annotationColor,
58234
58642
  annotationMode: annotationMode,
58643
+ modes: annotationModes,
58644
+ onAnnotationColorChange: onAnnotationColorChange,
58235
58645
  onAnnotationModeClick: onAnnotationModeClick
58236
- }, annotationModes.map(mode => /*#__PURE__*/external_react_["default"].createElement(annotations_AnnotationsPaletteV2.Mode, {
58237
- key: mode,
58238
- value: mode
58239
- }))), annotationMode === AnnotationMode.DRAWING && /*#__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(ColorPickerControlV2, {
58240
- activeColor: annotationColor,
58241
- colors: ANNOTATION_COLORS,
58242
- onColorSelect: onAnnotationColorChange
58243
- }))));
58646
+ }));
58244
58647
  }
58245
58648
  ;// ./src/lib/icons/search.svg
58246
58649
  const search_namespaceObject = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 15 14\" focusable=\"false\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M-2-3h20v20H-2z\"/>\n <path class=\"icon\" fill=\"#FFF\" d=\"M6.931 0a5.994 5.994 0 0 1 4.907 9.438l2.806 2.807a1 1 0 0 1 0 1.415l-.047.047a1 1 0 0 1-1.414 0L10.375 10.9A5.994 5.994 0 1 1 6.931 0zm0 1.998a3.996 3.996 0 1 0 0 7.992 3.996 3.996 0 0 0 0-7.992z\"/>\n </g>\n</svg>\n";
@@ -58675,6 +59078,343 @@ class DocFindBar extends (events_default()) {
58675
59078
  }
58676
59079
  }
58677
59080
  /* harmony default export */ const doc_DocFindBar = (DocFindBar);
59081
+ ;// external "@box/blueprint-web-assets/icons/Fill"
59082
+
59083
+ // EXTERNAL MODULE: ./src/lib/TabularDigits.tsx + 1 modules
59084
+ var TabularDigits = __webpack_require__(2459);
59085
+ ;// ./src/lib/viewers/doc/DocFindBarV2.scss
59086
+ // extracted by mini-css-extract-plugin
59087
+
59088
+ ;// ./src/lib/viewers/doc/DocFindBarV2.tsx
59089
+ /* provided dependency */ var DocFindBarV2_ = __webpack_require__(441)["Tl"];
59090
+ function DocFindBarV2_extends() { return DocFindBarV2_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; }, DocFindBarV2_extends.apply(null, arguments); }
59091
+ function DocFindBarV2_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
59092
+ function DocFindBarV2_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? DocFindBarV2_ownKeys(Object(t), !0).forEach(function (r) { DocFindBarV2_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : DocFindBarV2_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
59093
+ function DocFindBarV2_defineProperty(e, r, t) { return (r = DocFindBarV2_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
59094
+ function DocFindBarV2_toPropertyKey(t) { var i = DocFindBarV2_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
59095
+ function DocFindBarV2_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
59096
+
59097
+
59098
+
59099
+
59100
+
59101
+
59102
+
59103
+
59104
+
59105
+
59106
+
59107
+
59108
+
59109
+
59110
+
59111
+
59112
+ // Mirrors pdf.js FindState
59113
+ const FindState = {
59114
+ FOUND: 0,
59115
+ NOT_FOUND: 1,
59116
+ WRAPPED: 2,
59117
+ PENDING: 3
59118
+ };
59119
+ const canNavigateMatches = (query, isNotFound) => !!query && !isNotFound;
59120
+ const NO_MATCHES = {
59121
+ current: 0,
59122
+ total: 0
59123
+ };
59124
+ const formatMatchesCount = ({
59125
+ current,
59126
+ total
59127
+ }) => (0,util/* replacePlaceholders */.Lb)(DocFindBarV2_('find_match_count'), [String(current), String(total)]);
59128
+ function DocFindBarV2({
59129
+ inputRef,
59130
+ isNotFound,
59131
+ matchesCount,
59132
+ nextButtonRef,
59133
+ onClose,
59134
+ onFindNext,
59135
+ onFindPrevious,
59136
+ onQueryChange,
59137
+ previousButtonRef,
59138
+ query
59139
+ }) {
59140
+ const canNavigate = canNavigateMatches(query, isNotFound);
59141
+ const hasMatches = !!matchesCount && matchesCount.total > 0;
59142
+ let displayedCount = null;
59143
+ if (hasMatches) {
59144
+ displayedCount = matchesCount;
59145
+ } else if (query && isNotFound) {
59146
+ displayedCount = NO_MATCHES;
59147
+ }
59148
+ return /*#__PURE__*/external_react_["default"].createElement(external_react_["default"].Fragment, null, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
59149
+ as: "label",
59150
+ className: classnames_default()('bp-DocFindBarV2-field', {
59151
+ 'bp-DocFindBarV2-field--filled': !!query
59152
+ }),
59153
+ variant: "bodyDefault"
59154
+ }, /*#__PURE__*/external_react_["default"].createElement(__WEBPACK_EXTERNAL_MODULE__box_blueprint_web_assets_icons_Fill_15c08185_Search__, {
59155
+ "aria-hidden": true,
59156
+ className: "bp-DocFindBarV2-searchIcon",
59157
+ color: tokens_.bpIconIconOnLightSecondary
59158
+ }), /*#__PURE__*/external_react_["default"].createElement("input", {
59159
+ ref: inputRef,
59160
+ "aria-label": DocFindBarV2_('find_label'),
59161
+ className: "bp-DocFindBarV2-input",
59162
+ enterKeyHint: "search",
59163
+ onChange: ({
59164
+ currentTarget
59165
+ }) => onQueryChange(currentTarget.value),
59166
+ placeholder: DocFindBarV2_('find_placeholder'),
59167
+ role: "searchbox",
59168
+ value: query
59169
+ }), /*#__PURE__*/external_react_["default"].createElement("span", {
59170
+ className: "bp-DocFindBarV2-count",
59171
+ role: "status"
59172
+ }, displayedCount && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Text, {
59173
+ as: "span",
59174
+ color: "textOnLightSecondary",
59175
+ "data-testid": "bp-DocFindBarV2-count",
59176
+ variant: "bodyDefault"
59177
+ }, /*#__PURE__*/external_react_["default"].createElement(TabularDigits/* default */.Ay, null, formatMatchesCount(displayedCount))))), /*#__PURE__*/external_react_["default"].createElement("div", {
59178
+ className: "bp-DocFindBarV2-actions"
59179
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59180
+ content: DocFindBarV2_('find_previous')
59181
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59182
+ ref: previousButtonRef,
59183
+ "aria-label": DocFindBarV2_('find_previous'),
59184
+ "data-target-id": "DocFindBarV2-previous",
59185
+ disabled: !canNavigate,
59186
+ icon: Medium_.ChevronUp,
59187
+ onClick: onFindPrevious
59188
+ })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59189
+ content: DocFindBarV2_('find_next')
59190
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59191
+ ref: nextButtonRef,
59192
+ "aria-label": DocFindBarV2_('find_next'),
59193
+ "data-target-id": "DocFindBarV2-next",
59194
+ disabled: !canNavigate,
59195
+ icon: Medium_.ChevronDown,
59196
+ onClick: onFindNext
59197
+ })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.Tooltip, {
59198
+ content: DocFindBarV2_('find_close')
59199
+ }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
59200
+ "aria-label": DocFindBarV2_('find_close'),
59201
+ "data-target-id": "DocFindBarV2-close",
59202
+ icon: Medium_.XMark,
59203
+ onClick: onClose
59204
+ }))));
59205
+ }
59206
+ class DocFindBarV2Root extends (events_default()) {
59207
+ constructor(containerEl, findController, eventBus) {
59208
+ super();
59209
+ DocFindBarV2_defineProperty(this, "containerEl", void 0);
59210
+ DocFindBarV2_defineProperty(this, "eventBus", void 0);
59211
+ DocFindBarV2_defineProperty(this, "findBarEl", void 0);
59212
+ DocFindBarV2_defineProperty(this, "findController", void 0);
59213
+ DocFindBarV2_defineProperty(this, "inputRef", /*#__PURE__*/(0,external_react_.createRef)());
59214
+ DocFindBarV2_defineProperty(this, "isDestroyed", false);
59215
+ DocFindBarV2_defineProperty(this, "nextButtonRef", /*#__PURE__*/(0,external_react_.createRef)());
59216
+ DocFindBarV2_defineProperty(this, "opened", false);
59217
+ DocFindBarV2_defineProperty(this, "prevSearchQuery", '');
59218
+ DocFindBarV2_defineProperty(this, "previousButtonRef", /*#__PURE__*/(0,external_react_.createRef)());
59219
+ DocFindBarV2_defineProperty(this, "root", void 0);
59220
+ DocFindBarV2_defineProperty(this, "state", {
59221
+ isNotFound: false,
59222
+ matchesCount: null,
59223
+ query: ''
59224
+ });
59225
+ DocFindBarV2_defineProperty(this, "findFieldHandler", () => {
59226
+ this.dispatchFindEvent('find');
59227
+ });
59228
+ DocFindBarV2_defineProperty(this, "close", () => {
59229
+ this.prevSearchQuery = this.state.query;
59230
+ this.setFindFieldElValue('');
59231
+ this.findFieldHandler();
59232
+ if (!this.opened) {
59233
+ return;
59234
+ }
59235
+ this.emit('close');
59236
+ this.opened = false;
59237
+ this.findBarEl.classList.add(constants/* CLASS_HIDDEN */.zX);
59238
+ });
59239
+ DocFindBarV2_defineProperty(this, "handleFindBarKeyDown", event => {
59240
+ const key = (0,util/* decodeKeydown */.wU)(event).toLowerCase();
59241
+ switch (key) {
59242
+ case 'enter':
59243
+ case 'shift+enter':
59244
+ {
59245
+ if (event.isComposing) {
59246
+ break;
59247
+ }
59248
+ const navigationTargets = [this.inputRef.current, this.nextButtonRef.current, this.previousButtonRef.current];
59249
+ if (!navigationTargets.some(el => el === event.target)) {
59250
+ break;
59251
+ }
59252
+ const findPrevious = key === 'shift+enter';
59253
+ const buttonRef = findPrevious ? this.previousButtonRef : this.nextButtonRef;
59254
+ event.preventDefault();
59255
+ buttonRef.current?.focus();
59256
+ this.findAgain(findPrevious);
59257
+ break;
59258
+ }
59259
+ case 'escape':
59260
+ case 'esc':
59261
+ if (!this.opened) {
59262
+ return;
59263
+ }
59264
+ this.close();
59265
+ event.stopPropagation();
59266
+ event.preventDefault();
59267
+ break;
59268
+ case 'shift++':
59269
+ case 'shift+_':
59270
+ case '[':
59271
+ case ']':
59272
+ event.stopPropagation();
59273
+ break;
59274
+ default:
59275
+ break;
59276
+ }
59277
+ });
59278
+ DocFindBarV2_defineProperty(this, "handleFindControlState", ({
59279
+ matchesCount,
59280
+ state
59281
+ }) => {
59282
+ const isNotFound = state === FindState.PENDING ? this.state.isNotFound : state === FindState.NOT_FOUND;
59283
+ const hasNavigationFocus = [this.nextButtonRef.current, this.previousButtonRef.current].some(el => !!el && el === document.activeElement);
59284
+ this.update({
59285
+ isNotFound,
59286
+ matchesCount: matchesCount || null
59287
+ });
59288
+ if (isNotFound && hasNavigationFocus) {
59289
+ this.inputRef.current?.focus();
59290
+ }
59291
+ });
59292
+ DocFindBarV2_defineProperty(this, "handleFindMatchesCount", ({
59293
+ matchesCount
59294
+ }) => {
59295
+ this.update({
59296
+ matchesCount: matchesCount || null
59297
+ });
59298
+ });
59299
+ DocFindBarV2_defineProperty(this, "handleQueryChange", query => {
59300
+ this.setFindFieldElValue(query);
59301
+ this.findFieldHandler();
59302
+ });
59303
+ if (!containerEl) {
59304
+ throw new Error('DocFindBar cannot be used without a container element.');
59305
+ }
59306
+ if (!eventBus) {
59307
+ throw new Error('DocFindBar cannot be used without an EventBus instance.');
59308
+ }
59309
+ if (!findController) {
59310
+ throw new Error('DocFindBar cannot be used without a PDFFindController instance.');
59311
+ }
59312
+ this.containerEl = containerEl;
59313
+ this.eventBus = eventBus;
59314
+ this.findController = findController;
59315
+ this.findBarEl = document.createElement('div');
59316
+ this.findBarEl.className = `bp-DocFindBarV2 ${constants/* CLASS_HIDDEN */.zX}`;
59317
+ this.findBarEl.setAttribute('data-testid', 'document-findbar');
59318
+ containerEl.appendChild(this.findBarEl);
59319
+ this.root = (0,client_.createRoot)(this.findBarEl);
59320
+ this.findBarEl.addEventListener('keydown', this.handleFindBarKeyDown, true);
59321
+ this.eventBus.on('updatefindcontrolstate', this.handleFindControlState);
59322
+ this.eventBus.on('updatefindmatchescount', this.handleFindMatchesCount);
59323
+ this.render();
59324
+ }
59325
+ destroy() {
59326
+ this.isDestroyed = true;
59327
+ this.removeAllListeners();
59328
+ this.eventBus.off('updatefindcontrolstate', this.handleFindControlState);
59329
+ this.eventBus.off('updatefindmatchescount', this.handleFindMatchesCount);
59330
+ this.findBarEl.removeEventListener('keydown', this.handleFindBarKeyDown, true);
59331
+ this.root.unmount();
59332
+ this.findBarEl.remove();
59333
+ }
59334
+ dispatchFindEvent(type, findPrevious) {
59335
+ this.eventBus.dispatch('find', {
59336
+ query: this.state.query,
59337
+ phraseSearch: true,
59338
+ highlightAll: true,
59339
+ findPrevious,
59340
+ type
59341
+ });
59342
+ }
59343
+ setFindFieldElValue(phrase) {
59344
+ this.update({
59345
+ query: phrase
59346
+ });
59347
+ }
59348
+ onKeydown(event) {
59349
+ const key = (0,util/* decodeKeydown */.wU)(event).toLowerCase();
59350
+ switch (key) {
59351
+ case 'meta+f':
59352
+ case 'control+f':
59353
+ case 'meta+g':
59354
+ case 'control+g':
59355
+ case 'f3':
59356
+ this.open();
59357
+ event.preventDefault();
59358
+ return true;
59359
+ default:
59360
+ return false;
59361
+ }
59362
+ }
59363
+ open() {
59364
+ if (this.prevSearchQuery) {
59365
+ this.setFindFieldElValue(this.prevSearchQuery);
59366
+ this.findFieldHandler();
59367
+ }
59368
+ if (!this.opened) {
59369
+ this.opened = true;
59370
+ this.findBarEl.classList.remove(constants/* CLASS_HIDDEN */.zX);
59371
+ this.emit(lib_events/* VIEWER_EVENT */.Oi.metric, {
59372
+ name: lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.OPEN
59373
+ });
59374
+ }
59375
+ this.inputRef.current?.select();
59376
+ this.inputRef.current?.focus();
59377
+ }
59378
+ toggle() {
59379
+ if (this.opened) {
59380
+ this.close();
59381
+ } else {
59382
+ this.open();
59383
+ }
59384
+ }
59385
+ findAgain(findPrevious) {
59386
+ if (!canNavigateMatches(this.state.query, this.state.isNotFound)) {
59387
+ return;
59388
+ }
59389
+ this.dispatchFindEvent('again', findPrevious);
59390
+ this.emit(lib_events/* VIEWER_EVENT */.Oi.metric, {
59391
+ name: findPrevious ? lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.PREVIOUS : lib_events/* USER_DOCUMENT_FIND_EVENTS */.gV.NEXT
59392
+ });
59393
+ }
59394
+ update(nextState) {
59395
+ if (this.isDestroyed) {
59396
+ return;
59397
+ }
59398
+ this.state = DocFindBarV2_objectSpread(DocFindBarV2_objectSpread({}, this.state), nextState);
59399
+ this.render();
59400
+ }
59401
+ render() {
59402
+ // Commits synchronously so open() can focus and select the input right after
59403
+ (0,external_react_dom_.flushSync)(() => {
59404
+ this.root.render(/*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
59405
+ container: this.containerEl
59406
+ }, /*#__PURE__*/external_react_["default"].createElement(DocFindBarV2, DocFindBarV2_extends({}, this.state, {
59407
+ inputRef: this.inputRef,
59408
+ nextButtonRef: this.nextButtonRef,
59409
+ onClose: this.close,
59410
+ onFindNext: () => this.findAgain(false),
59411
+ onFindPrevious: () => this.findAgain(true),
59412
+ onQueryChange: this.handleQueryChange,
59413
+ previousButtonRef: this.previousButtonRef
59414
+ }))));
59415
+ });
59416
+ }
59417
+ }
58678
59418
  ;// ./src/lib/Cache.js
58679
59419
 
58680
59420
  class Cache {
@@ -61991,6 +62731,7 @@ function DocBaseViewer_toPrimitive(t, r) { if ("object" != typeof t || !t) retur
61991
62731
 
61992
62732
 
61993
62733
 
62734
+
61994
62735
 
61995
62736
 
61996
62737
  const DOC_FIRST_PAGES_ENABLED = 'docFirstPages.enabled';
@@ -63108,7 +63849,8 @@ class DocBaseViewer extends viewers_BaseViewer {
63108
63849
  if (this.isFindDisabled()) {
63109
63850
  return;
63110
63851
  }
63111
- this.findBar = new doc_DocFindBar(this.containerEl, this.pdfFindController, this.pdfEventBus);
63852
+ const FindBar = this.featureEnabled(constants/* BLUEPRINT_MIGRATION_SUPPORTING_UI */.Ed) ? DocFindBarV2Root : doc_DocFindBar;
63853
+ this.findBar = new FindBar(this.containerEl, this.pdfFindController, this.pdfEventBus);
63112
63854
  this.findBar.addListener(lib_events/* VIEWER_EVENT */.Oi.metric, this.emitMetric);
63113
63855
  this.findBar.addListener('close', this.handleFindBarClose);
63114
63856
  }
@@ -69791,7 +70533,8 @@ function ComparisonBanner({
69791
70533
  return /*#__PURE__*/external_react_["default"].createElement(BlueprintProviders/* default */.A, {
69792
70534
  container: menuContainer
69793
70535
  }, /*#__PURE__*/external_react_["default"].createElement("div", {
69794
- className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on
70536
+ className: isComparedPreview ? `${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on} ${constants/* CLASS_BOX_PREVIEW_VERSION_BANNER_COMPARED */.Uj}` : constants/* CLASS_BOX_PREVIEW_VERSION_BANNER */.on,
70537
+ "data-resin-feature": "versionComparison"
69795
70538
  }, /*#__PURE__*/external_react_["default"].createElement("div", {
69796
70539
  "aria-label": isComparedPreview ? ComparisonBanner_('comparison_banner_previous') : ComparisonBanner_('comparison_banner_current'),
69797
70540
  className: "bp-version-banner-details",
@@ -69829,8 +70572,10 @@ function ComparisonBanner({
69829
70572
  })), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Content, {
69830
70573
  align: "end",
69831
70574
  container: menuContainer ?? undefined,
70575
+ "data-resin-feature": "versionComparison",
69832
70576
  side: "bottom"
69833
70577
  }, onMakeCurrent && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70578
+ "data-resin-target": "makeCurrentVersion",
69834
70579
  "data-target-id": "ComparisonBanner-makeCurrent",
69835
70580
  onSelect: onMakeCurrent
69836
70581
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69838,6 +70583,7 @@ function ComparisonBanner({
69838
70583
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69839
70584
  label: ComparisonBanner_('comparison_banner_make_current')
69840
70585
  })), onDownload && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70586
+ "data-resin-target": "downloadVersion",
69841
70587
  "data-target-id": "ComparisonBanner-download",
69842
70588
  onSelect: onDownload
69843
70589
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69845,6 +70591,7 @@ function ComparisonBanner({
69845
70591
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69846
70592
  label: ComparisonBanner_('download')
69847
70593
  })), onOpenFullPreview && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70594
+ "data-resin-target": "openFullPreview",
69848
70595
  "data-target-id": "ComparisonBanner-openFullPreview",
69849
70596
  onSelect: onOpenFullPreview
69850
70597
  }, /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.StartElement, {
@@ -69852,6 +70599,7 @@ function ComparisonBanner({
69852
70599
  }), /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item.MainContent, {
69853
70600
  label: ComparisonBanner_('comparison_banner_open_full_preview')
69854
70601
  })), onDelete && (onMakeCurrent || onDownload || onOpenFullPreview) && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Separator, null), onDelete && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.DropdownMenu.Item, {
70602
+ "data-resin-target": "deleteVersion",
69855
70603
  "data-target-id": "ComparisonBanner-delete",
69856
70604
  onSelect: onDelete,
69857
70605
  variant: "destructive"
@@ -69864,6 +70612,7 @@ function ComparisonBanner({
69864
70612
  className: "bp-version-banner-divider"
69865
70613
  }), showClose && /*#__PURE__*/external_react_["default"].createElement(blueprint_web_.IconButton, {
69866
70614
  "aria-label": ComparisonBanner_('comparison_banner_close'),
70615
+ "data-resin-target": "closeComparison",
69867
70616
  "data-target-id": "ComparisonBanner-close",
69868
70617
  icon: Medium_.XMark,
69869
70618
  onClick: onOpenFullPreview,