storybook 10.0.0-beta.5 → 10.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/assets/server/openBrowser.applescript +94 -0
  2. package/dist/_browser-chunks/{WithTooltip-ERFLZL6W.js → WithTooltip-SK46ZJ2J.js} +1 -1
  3. package/dist/_browser-chunks/{chunk-EOILZP2R.js → chunk-BOOOPFZF.js} +7 -2
  4. package/dist/_node-chunks/{builder-manager-ZTS4EIKQ.js → builder-manager-V33CQT2M.js} +21 -151
  5. package/dist/_node-chunks/camelcase-BZ55OCHI.js +18 -0
  6. package/dist/_node-chunks/{chunk-WCSHG2QT.js → chunk-2DMFI367.js} +7 -7
  7. package/dist/_node-chunks/{chunk-VQN4WAIA.js → chunk-4TOI4VSK.js} +7 -7
  8. package/dist/_node-chunks/{chunk-TBWOUVTA.js → chunk-55VWKF63.js} +709 -935
  9. package/dist/_node-chunks/{chunk-P3TWEOO5.js → chunk-5IEY46LQ.js} +7 -7
  10. package/dist/_node-chunks/{chunk-EIHJ5J3O.js → chunk-6PTV7XGR.js} +8 -8
  11. package/dist/_node-chunks/{chunk-D7SDB4XE.js → chunk-7NJGTQ3W.js} +8 -8
  12. package/dist/_node-chunks/{chunk-4VDRH7SM.js → chunk-7WH7AGOR.js} +7 -7
  13. package/dist/_node-chunks/{chunk-AK5PHLUA.js → chunk-A7CUP23N.js} +7 -7
  14. package/dist/_node-chunks/{chunk-K4YETNYJ.js → chunk-B3AMFGAL.js} +7 -7
  15. package/dist/_node-chunks/{chunk-PIKDGR3O.js → chunk-BNOZ3EKF.js} +7 -7
  16. package/dist/_node-chunks/{chunk-F7YW5W6B.js → chunk-DC7OWBHB.js} +12 -12
  17. package/dist/_node-chunks/{chunk-VX5P3IYA.js → chunk-E6TLN2J2.js} +7 -7
  18. package/dist/_node-chunks/{chunk-TVKUJ3SE.js → chunk-EAOPWIKA.js} +8 -8
  19. package/dist/_node-chunks/{chunk-TKN5TEZV.js → chunk-EY5PTUZL.js} +13 -13
  20. package/dist/_node-chunks/{chunk-DZJNLBBL.js → chunk-F3PO67U3.js} +7 -7
  21. package/dist/_node-chunks/chunk-FDDJHDCE.js +62 -0
  22. package/dist/_node-chunks/{chunk-KZB7ELL6.js → chunk-HEBHWRWL.js} +7 -7
  23. package/dist/_node-chunks/{chunk-VWSUFVUF.js → chunk-HPFXREVG.js} +7 -7
  24. package/dist/_node-chunks/{chunk-OC3TVLYU.js → chunk-IINJT47N.js} +7 -7
  25. package/dist/_node-chunks/{chunk-J3DQMIO4.js → chunk-JNHUDBJL.js} +7 -7
  26. package/dist/_node-chunks/{chunk-SW3VZAH7.js → chunk-JOXYGIZK.js} +9 -9
  27. package/dist/_node-chunks/{chunk-P7YMEOXF.js → chunk-MLBTKECD.js} +7 -7
  28. package/dist/_node-chunks/{chunk-UTCFHTQH.js → chunk-NJXBURX7.js} +7 -7
  29. package/dist/_node-chunks/{chunk-H52PBBSK.js → chunk-NKZ4UPPV.js} +7 -7
  30. package/dist/_node-chunks/{chunk-F3WE3456.js → chunk-NUVGSFQI.js} +7 -7
  31. package/dist/_node-chunks/chunk-R5DIBOM6.js +18 -0
  32. package/dist/_node-chunks/{chunk-ACUNHBEO.js → chunk-RIPA4LFD.js} +22 -22
  33. package/dist/_node-chunks/{chunk-KU3JBNPY.js → chunk-TJIMCNYJ.js} +8 -8
  34. package/dist/_node-chunks/{chunk-4KRR46V2.js → chunk-UYKQJMQY.js} +15 -15
  35. package/dist/_node-chunks/{chunk-3VVGIILJ.js → chunk-VQH4ZFTS.js} +8 -8
  36. package/dist/_node-chunks/{chunk-QHIU5I7C.js → chunk-VSC6LSCQ.js} +6 -6
  37. package/dist/_node-chunks/{chunk-2VMDKLSW.js → chunk-XZTBG2TG.js} +6 -6
  38. package/dist/_node-chunks/{dist-OGRBL76N.js → dist-CGGAYWME.js} +9 -9
  39. package/dist/_node-chunks/{globby-65LOULA6.js → globby-3IFB7BJC.js} +17 -13
  40. package/dist/_node-chunks/{lib-TF7JCT3A.js → lib-IT6OBSID.js} +7 -7
  41. package/dist/_node-chunks/{mdx-N42X6CFJ-6ZJEUZMZ.js → mdx-N42X6CFJ-WM36SSZ6.js} +8 -8
  42. package/dist/_node-chunks/{p-limit-PF7JSPDT.js → p-limit-3V5XIKA7.js} +7 -7
  43. package/dist/_node-chunks/{plugin-LGHGAC6J.js → plugin-3YREMMJJ.js} +10 -10
  44. package/dist/_node-chunks/{plugin-A6XAWMXN.js → plugin-GJUBUKCT.js} +10 -10
  45. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-HDSEOU3Z.js → webpack-inject-mocker-runtime-plugin-DCJQFJQ5.js} +10 -10
  46. package/dist/_node-chunks/{webpack-mock-plugin-ZJJVMJUS.js → webpack-mock-plugin-XJNFAHBI.js} +9 -9
  47. package/dist/babel/index.js +11 -11
  48. package/dist/bin/core.js +11 -11
  49. package/dist/bin/dispatcher.js +11 -11
  50. package/dist/bin/loader.js +8 -8
  51. package/dist/cli/index.js +27 -22
  52. package/dist/common/index.js +21 -21
  53. package/dist/components/index.js +3 -3
  54. package/dist/core-events/index.d.ts +18 -2
  55. package/dist/core-events/index.js +7 -1
  56. package/dist/core-server/index.js +1104 -999
  57. package/dist/core-server/presets/common-manager.js +67 -27
  58. package/dist/core-server/presets/common-override-preset.js +9 -9
  59. package/dist/core-server/presets/common-preset.js +691 -29
  60. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  61. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  62. package/dist/csf-tools/index.js +9 -9
  63. package/dist/manager/globals-runtime.js +1250 -972
  64. package/dist/manager/globals.d.ts +0 -4
  65. package/dist/manager/globals.js +1 -6
  66. package/dist/manager/runtime.js +1724 -464
  67. package/dist/manager-api/index.d.ts +2 -0
  68. package/dist/manager-api/index.js +284 -48
  69. package/dist/node-logger/index.js +14 -14
  70. package/dist/preview/runtime.js +7 -1
  71. package/dist/server-errors.js +10 -10
  72. package/dist/telemetry/index.d.ts +1 -1
  73. package/dist/telemetry/index.js +24 -24
  74. package/dist/types/index.d.ts +4 -0
  75. package/package.json +5 -4
  76. package/dist/_node-chunks/camelcase-K3BM7RII.js +0 -18
  77. package/dist/_node-chunks/chunk-7LG5CLCT.js +0 -18
  78. package/dist/_node-chunks/chunk-DWJ7TV2O.js +0 -62
  79. package/dist/_node-chunks/default-browser-id-4RZZMHJE.js +0 -1719
@@ -1589,7 +1589,7 @@ var require_copy_to_clipboard = __commonJS({
1589
1589
  return message.replace(/#{\s*key\s*}/g, copyKey);
1590
1590
  }
1591
1591
  __name(format, "format");
1592
- function copy2(text, options2) {
1592
+ function copy3(text, options2) {
1593
1593
  var debug, message, reselectPrevious, range3, selection, mark, success = false;
1594
1594
  if (!options2) {
1595
1595
  options2 = {};
@@ -1667,8 +1667,8 @@ var require_copy_to_clipboard = __commonJS({
1667
1667
  }
1668
1668
  return success;
1669
1669
  }
1670
- __name(copy2, "copy");
1671
- module.exports = copy2;
1670
+ __name(copy3, "copy");
1671
+ module.exports = copy3;
1672
1672
  }
1673
1673
  });
1674
1674
 
@@ -2455,7 +2455,7 @@ var { Channel, HEARTBEAT_INTERVAL, HEARTBEAT_MAX_LATENCY, PostMessageTransport,
2455
2455
 
2456
2456
  // global-externals:storybook/internal/core-events
2457
2457
  var core_events_default = __STORYBOOK_CORE_EVENTS__;
2458
- var { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, GLOBALS_UPDATED, NAVIGATE_URL, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_HOT_UPDATED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, TELEMETRY_ERROR, TOGGLE_WHATS_NEW_NOTIFICATIONS, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS } = __STORYBOOK_CORE_EVENTS__;
2458
+ var { ARGTYPES_INFO_REQUEST, ARGTYPES_INFO_RESPONSE, CHANNEL_CREATED, CHANNEL_WS_DISCONNECT, CONFIG_ERROR, CREATE_NEW_STORYFILE_REQUEST, CREATE_NEW_STORYFILE_RESPONSE, CURRENT_STORY_WAS_SET, DOCS_PREPARED, DOCS_RENDERED, FILE_COMPONENT_SEARCH_REQUEST, FILE_COMPONENT_SEARCH_RESPONSE, FORCE_REMOUNT, FORCE_RE_RENDER, GLOBALS_UPDATED, NAVIGATE_URL, OPEN_IN_EDITOR_REQUEST, OPEN_IN_EDITOR_RESPONSE, PLAY_FUNCTION_THREW_EXCEPTION, PRELOAD_ENTRIES, PREVIEW_BUILDER_PROGRESS, PREVIEW_KEYDOWN, REGISTER_SUBSCRIPTION, REQUEST_WHATS_NEW_DATA, RESET_STORY_ARGS, RESULT_WHATS_NEW_DATA, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, SELECT_STORY, SET_CONFIG, SET_CURRENT_STORY, SET_FILTER, SET_GLOBALS, SET_INDEX, SET_STORIES, SET_WHATS_NEW_CACHE, SHARED_STATE_CHANGED, SHARED_STATE_SET, STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL, STORY_ARGS_UPDATED, STORY_CHANGED, STORY_ERRORED, STORY_FINISHED, STORY_HOT_UPDATED, STORY_INDEX_INVALIDATED, STORY_MISSING, STORY_PREPARED, STORY_RENDERED, STORY_RENDER_PHASE_CHANGED, STORY_SPECIFIED, STORY_THREW_EXCEPTION, STORY_UNCHANGED, TELEMETRY_ERROR, TOGGLE_WHATS_NEW_NOTIFICATIONS, UNHANDLED_ERRORS_WHILE_PLAYING, UPDATE_GLOBALS, UPDATE_QUERY_PARAMS, UPDATE_STORY_ARGS } = __STORYBOOK_CORE_EVENTS__;
2459
2459
 
2460
2460
  // ../node_modules/@storybook/global/dist/index.mjs
2461
2461
  var scope = (() => {
@@ -2572,6 +2572,7 @@ __export(icons_exports, {
2572
2572
  DownloadIcon: () => DownloadIcon,
2573
2573
  DragIcon: () => DragIcon,
2574
2574
  EditIcon: () => EditIcon,
2575
+ EditorIcon: () => EditorIcon,
2575
2576
  EllipsisIcon: () => EllipsisIcon,
2576
2577
  EmailIcon: () => EmailIcon,
2577
2578
  ExpandAltIcon: () => ExpandAltIcon,
@@ -2731,7 +2732,7 @@ __export(icons_exports, {
2731
2732
  iconList: () => iconList
2732
2733
  });
2733
2734
  var icons_default = __STORYBOOK_ICONS__;
2734
- var { AccessibilityAltIcon, AccessibilityIcon, AccessibilityIgnoredIcon, AddIcon, AdminIcon, AlertAltIcon, AlertIcon, AlignLeftIcon, AlignRightIcon, AppleIcon, ArrowBottomLeftIcon, ArrowBottomRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowSolidDownIcon, ArrowSolidLeftIcon, ArrowSolidRightIcon, ArrowSolidUpIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowUpIcon, AzureDevOpsIcon, BackIcon, BasketIcon, BatchAcceptIcon, BatchDenyIcon, BeakerIcon, BellIcon, BitbucketIcon, BoldIcon, BookIcon, BookmarkHollowIcon, BookmarkIcon, BottomBarIcon, BottomBarToggleIcon, BoxIcon, BranchIcon, BrowserIcon, BugIcon, ButtonIcon, CPUIcon, CalendarIcon, CameraIcon, CameraStabilizeIcon, CategoryIcon, CertificateIcon, ChangedIcon, ChatIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronSmallDownIcon, ChevronSmallLeftIcon, ChevronSmallRightIcon, ChevronSmallUpIcon, ChevronUpIcon, ChromaticIcon, ChromeIcon, CircleHollowIcon, CircleIcon, ClearIcon, CloseAltIcon, CloseIcon, CloudHollowIcon, CloudIcon, CogIcon, CollapseIcon, CommandIcon, CommentAddIcon, CommentIcon, CommentsIcon, CommitIcon, CompassIcon, ComponentDrivenIcon, ComponentIcon, ContrastIcon, ContrastIgnoredIcon, ControlsIcon, CopyIcon, CreditIcon, CrossIcon, DashboardIcon, DatabaseIcon, DeleteIcon, DiamondIcon, DirectionIcon, DiscordIcon, DocChartIcon, DocListIcon, DocumentIcon, DownloadIcon, DragIcon, EditIcon, EllipsisIcon, EmailIcon, ExpandAltIcon, ExpandIcon, EyeCloseIcon, EyeIcon, FaceHappyIcon, FaceNeutralIcon, FaceSadIcon, FacebookIcon, FailedIcon, FastForwardIcon, FigmaIcon, FilterIcon, FlagIcon, FolderIcon, FormIcon, GDriveIcon, GiftIcon, GithubIcon, GitlabIcon, GlobeIcon, GoogleIcon, GraphBarIcon, GraphLineIcon, GraphqlIcon, GridAltIcon, GridIcon, GrowIcon, HeartHollowIcon, HeartIcon, HomeIcon, HourglassIcon, InfoIcon, ItalicIcon, JumpToIcon, KeyIcon, LightningIcon, LightningOffIcon, LinkBrokenIcon, LinkIcon, LinkedinIcon, LinuxIcon, ListOrderedIcon, ListUnorderedIcon, LocationIcon, LockIcon, MarkdownIcon, MarkupIcon, MediumIcon, MemoryIcon, MenuIcon, MergeIcon, MirrorIcon, MobileIcon, MoonIcon, NutIcon, OutboxIcon, OutlineIcon, PaintBrushAltIcon, PaintBrushIcon, PaperClipIcon, ParagraphIcon, PassedIcon, PhoneIcon, PhotoDragIcon, PhotoIcon, PhotoStabilizeIcon, PinAltIcon, PinIcon, PlayAllHollowIcon, PlayBackIcon, PlayHollowIcon, PlayIcon, PlayNextIcon, PlusIcon, PointerDefaultIcon, PointerHandIcon, PowerIcon, PrintIcon, ProceedIcon, ProfileIcon, PullRequestIcon, QuestionIcon, RSSIcon, RedirectIcon, ReduxIcon, RefreshIcon, ReplyIcon, RepoIcon, RequestChangeIcon, RewindIcon, RulerIcon, SaveIcon, SearchIcon, ShareAltIcon, ShareIcon, ShieldIcon, SideBySideIcon, SidebarAltIcon, SidebarAltToggleIcon, SidebarIcon, SidebarToggleIcon, SortDownIcon, SortUpIcon, SpeakerIcon, StackedIcon, StarHollowIcon, StarIcon, StatusFailIcon, StatusIcon, StatusPassIcon, StatusWarnIcon, StickerIcon, StopAltHollowIcon, StopAltIcon, StopIcon, StorybookIcon, StructureIcon, SubtractIcon, SunIcon, SupportIcon, SweepIcon, SwitchAltIcon, SyncIcon, TabletIcon, ThumbsUpIcon, TimeIcon, TimerIcon, TransferIcon, TrashIcon, TwitterIcon, TypeIcon, UbuntuIcon, UndoIcon, UnfoldIcon, UnlockIcon, UnpinIcon, UploadIcon, UserAddIcon, UserAltIcon, UserIcon, UsersIcon, VSCodeIcon, VerifiedIcon, VideoIcon, WandIcon, WatchIcon, WindowsIcon, WrenchIcon, XIcon, YoutubeIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, iconList } = __STORYBOOK_ICONS__;
2735
+ var { AccessibilityAltIcon, AccessibilityIcon, AccessibilityIgnoredIcon, AddIcon, AdminIcon, AlertAltIcon, AlertIcon, AlignLeftIcon, AlignRightIcon, AppleIcon, ArrowBottomLeftIcon, ArrowBottomRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowSolidDownIcon, ArrowSolidLeftIcon, ArrowSolidRightIcon, ArrowSolidUpIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowUpIcon, AzureDevOpsIcon, BackIcon, BasketIcon, BatchAcceptIcon, BatchDenyIcon, BeakerIcon, BellIcon, BitbucketIcon, BoldIcon, BookIcon, BookmarkHollowIcon, BookmarkIcon, BottomBarIcon, BottomBarToggleIcon, BoxIcon, BranchIcon, BrowserIcon, BugIcon, ButtonIcon, CPUIcon, CalendarIcon, CameraIcon, CameraStabilizeIcon, CategoryIcon, CertificateIcon, ChangedIcon, ChatIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronSmallDownIcon, ChevronSmallLeftIcon, ChevronSmallRightIcon, ChevronSmallUpIcon, ChevronUpIcon, ChromaticIcon, ChromeIcon, CircleHollowIcon, CircleIcon, ClearIcon, CloseAltIcon, CloseIcon, CloudHollowIcon, CloudIcon, CogIcon, CollapseIcon, CommandIcon, CommentAddIcon, CommentIcon, CommentsIcon, CommitIcon, CompassIcon, ComponentDrivenIcon, ComponentIcon, ContrastIcon, ContrastIgnoredIcon, ControlsIcon, CopyIcon, CreditIcon, CrossIcon, DashboardIcon, DatabaseIcon, DeleteIcon, DiamondIcon, DirectionIcon, DiscordIcon, DocChartIcon, DocListIcon, DocumentIcon, DownloadIcon, DragIcon, EditIcon, EditorIcon, EllipsisIcon, EmailIcon, ExpandAltIcon, ExpandIcon, EyeCloseIcon, EyeIcon, FaceHappyIcon, FaceNeutralIcon, FaceSadIcon, FacebookIcon, FailedIcon, FastForwardIcon, FigmaIcon, FilterIcon, FlagIcon, FolderIcon, FormIcon, GDriveIcon, GiftIcon, GithubIcon, GitlabIcon, GlobeIcon, GoogleIcon, GraphBarIcon, GraphLineIcon, GraphqlIcon, GridAltIcon, GridIcon, GrowIcon, HeartHollowIcon, HeartIcon, HomeIcon, HourglassIcon, InfoIcon, ItalicIcon, JumpToIcon, KeyIcon, LightningIcon, LightningOffIcon, LinkBrokenIcon, LinkIcon, LinkedinIcon, LinuxIcon, ListOrderedIcon, ListUnorderedIcon, LocationIcon, LockIcon, MarkdownIcon, MarkupIcon, MediumIcon, MemoryIcon, MenuIcon, MergeIcon, MirrorIcon, MobileIcon, MoonIcon, NutIcon, OutboxIcon, OutlineIcon, PaintBrushAltIcon, PaintBrushIcon, PaperClipIcon, ParagraphIcon, PassedIcon, PhoneIcon, PhotoDragIcon, PhotoIcon, PhotoStabilizeIcon, PinAltIcon, PinIcon, PlayAllHollowIcon, PlayBackIcon, PlayHollowIcon, PlayIcon, PlayNextIcon, PlusIcon, PointerDefaultIcon, PointerHandIcon, PowerIcon, PrintIcon, ProceedIcon, ProfileIcon, PullRequestIcon, QuestionIcon, RSSIcon, RedirectIcon, ReduxIcon, RefreshIcon, ReplyIcon, RepoIcon, RequestChangeIcon, RewindIcon, RulerIcon, SaveIcon, SearchIcon, ShareAltIcon, ShareIcon, ShieldIcon, SideBySideIcon, SidebarAltIcon, SidebarAltToggleIcon, SidebarIcon, SidebarToggleIcon, SortDownIcon, SortUpIcon, SpeakerIcon, StackedIcon, StarHollowIcon, StarIcon, StatusFailIcon, StatusIcon, StatusPassIcon, StatusWarnIcon, StickerIcon, StopAltHollowIcon, StopAltIcon, StopIcon, StorybookIcon, StructureIcon, SubtractIcon, SunIcon, SupportIcon, SweepIcon, SwitchAltIcon, SyncIcon, TabletIcon, ThumbsUpIcon, TimeIcon, TimerIcon, TransferIcon, TrashIcon, TwitterIcon, TypeIcon, UbuntuIcon, UndoIcon, UnfoldIcon, UnlockIcon, UnpinIcon, UploadIcon, UserAddIcon, UserAltIcon, UserIcon, UsersIcon, VSCodeIcon, VerifiedIcon, VideoIcon, WandIcon, WatchIcon, WindowsIcon, WrenchIcon, XIcon, YoutubeIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, iconList } = __STORYBOOK_ICONS__;
2735
2736
 
2736
2737
  // global-externals:storybook/manager-api
2737
2738
  var manager_api_default = __STORYBOOK_API__;
@@ -5473,14 +5474,14 @@ var import_prop_types5 = __toESM(require_prop_types());
5473
5474
 
5474
5475
  // ../node_modules/react-transition-group/esm/utils/ChildMapping.js
5475
5476
  function getChildMapping(children2, mapFn) {
5476
- var mapper3 = /* @__PURE__ */ __name(function mapper4(child) {
5477
+ var mapper5 = /* @__PURE__ */ __name(function mapper6(child) {
5477
5478
  return mapFn && isValidElement(child) ? mapFn(child) : child;
5478
5479
  }, "mapper");
5479
5480
  var result2 = /* @__PURE__ */ Object.create(null);
5480
5481
  if (children2) Children.map(children2, function(c2) {
5481
5482
  return c2;
5482
5483
  }).forEach(function(child) {
5483
- result2[child.key] = mapper3(child);
5484
+ result2[child.key] = mapper5(child);
5484
5485
  });
5485
5486
  return result2;
5486
5487
  }
@@ -6936,6 +6937,8 @@ var events = /* @__PURE__ */ ((events2) => {
6936
6937
  events2["ARGTYPES_INFO_RESPONSE"] = "argtypesInfoResponse";
6937
6938
  events2["CREATE_NEW_STORYFILE_REQUEST"] = "createNewStoryfileRequest";
6938
6939
  events2["CREATE_NEW_STORYFILE_RESPONSE"] = "createNewStoryfileResponse";
6940
+ events2["OPEN_IN_EDITOR_REQUEST"] = "openInEditorRequest";
6941
+ events2["OPEN_IN_EDITOR_RESPONSE"] = "openInEditorResponse";
6939
6942
  return events2;
6940
6943
  })(events || {});
6941
6944
  var {
@@ -6995,7 +6998,9 @@ var {
6995
6998
  SAVE_STORY_REQUEST: SAVE_STORY_REQUEST2,
6996
6999
  SAVE_STORY_RESPONSE: SAVE_STORY_RESPONSE2,
6997
7000
  ARGTYPES_INFO_REQUEST: ARGTYPES_INFO_REQUEST2,
6998
- ARGTYPES_INFO_RESPONSE: ARGTYPES_INFO_RESPONSE2
7001
+ ARGTYPES_INFO_RESPONSE: ARGTYPES_INFO_RESPONSE2,
7002
+ OPEN_IN_EDITOR_REQUEST: OPEN_IN_EDITOR_REQUEST2,
7003
+ OPEN_IN_EDITOR_RESPONSE: OPEN_IN_EDITOR_RESPONSE2
6999
7004
  } = events;
7000
7005
 
7001
7006
  // src/manager/components/panel/Panel.tsx
@@ -7272,194 +7277,6 @@ var FramesRenderer = /* @__PURE__ */ __name(({
7272
7277
  }));
7273
7278
  }, "FramesRenderer");
7274
7279
 
7275
- // src/manager/components/preview/tools/addons.tsx
7276
- var menuMapper = /* @__PURE__ */ __name(({ api, state }) => ({
7277
- isVisible: api.getIsPanelShown(),
7278
- singleStory: state.singleStory,
7279
- panelPosition: state.layout.panelPosition,
7280
- toggle: /* @__PURE__ */ __name(() => api.togglePanel(), "toggle")
7281
- }), "menuMapper");
7282
- var addonsTool = {
7283
- title: "addons",
7284
- id: "addons",
7285
- type: types.TOOL,
7286
- match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7287
- render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper }, ({ isVisible, toggle, singleStory, panelPosition }) => !singleStory && !isVisible && react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { "aria-label": "Show addons", key: "addons", onClick: toggle, title: "Show addons" }, panelPosition === "bottom" ? react_default.createElement(BottomBarIcon, null) : react_default.createElement(SidebarAltIcon, null)))), "render")
7288
- };
7289
-
7290
- // src/manager/components/preview/tools/copy.tsx
7291
- var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
7292
- var { PREVIEW_URL, document: document2 } = scope;
7293
- var copyMapper = /* @__PURE__ */ __name(({ state }) => {
7294
- const { storyId, refId, refs } = state;
7295
- const { location } = document2;
7296
- const ref = refs[refId];
7297
- let baseUrl = `${location.origin}${location.pathname}`;
7298
- if (!baseUrl.endsWith("/")) {
7299
- baseUrl += "/";
7300
- }
7301
- return {
7302
- refId,
7303
- baseUrl: ref ? `${ref.url}/iframe.html` : PREVIEW_URL || `${baseUrl}iframe.html`,
7304
- storyId,
7305
- queryParams: state.customQueryParams
7306
- };
7307
- }, "copyMapper");
7308
- var copyTool = {
7309
- title: "copy",
7310
- id: "copy",
7311
- type: types.TOOL,
7312
- match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7313
- render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: copyMapper }, ({ baseUrl, storyId, queryParams }) => storyId ? react_default.createElement(
7314
- IconButton,
7315
- {
7316
- key: "copy",
7317
- onClick: () => (0, import_copy_to_clipboard.default)(getStoryHref(baseUrl, storyId, queryParams)),
7318
- title: "Copy canvas link"
7319
- },
7320
- react_default.createElement(LinkIcon, null)
7321
- ) : null), "render")
7322
- };
7323
-
7324
- // src/manager/components/preview/tools/eject.tsx
7325
- var { PREVIEW_URL: PREVIEW_URL2 } = scope;
7326
- var ejectMapper = /* @__PURE__ */ __name(({ state }) => {
7327
- const { storyId, refId, refs } = state;
7328
- const ref = refs[refId];
7329
- return {
7330
- refId,
7331
- baseUrl: ref ? `${ref.url}/iframe.html` : PREVIEW_URL2 || "iframe.html",
7332
- storyId,
7333
- queryParams: state.customQueryParams
7334
- };
7335
- }, "ejectMapper");
7336
- var ejectTool = {
7337
- title: "eject",
7338
- id: "eject",
7339
- type: types.TOOL,
7340
- match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7341
- render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: ejectMapper }, ({ baseUrl, storyId, queryParams }) => storyId ? react_default.createElement(IconButton, { key: "opener", asChild: true }, react_default.createElement(
7342
- "a",
7343
- {
7344
- href: getStoryHref(baseUrl, storyId, queryParams),
7345
- target: "_blank",
7346
- rel: "noopener noreferrer",
7347
- title: "Open canvas in new tab"
7348
- },
7349
- react_default.createElement(ShareAltIcon, null)
7350
- )) : null), "render")
7351
- };
7352
-
7353
- // src/manager/components/preview/tools/remount.tsx
7354
- var StyledAnimatedIconButton = styled(IconButton)(({ theme, animating, disabled }) => ({
7355
- opacity: disabled ? 0.5 : 1,
7356
- svg: {
7357
- animation: animating ? `${theme.animation.rotate360} 1000ms ease-out` : void 0
7358
- }
7359
- }));
7360
- var menuMapper2 = /* @__PURE__ */ __name(({ api, state }) => {
7361
- const { storyId } = state;
7362
- return {
7363
- storyId,
7364
- remount: /* @__PURE__ */ __name(() => api.emit(FORCE_REMOUNT, { storyId: state.storyId }), "remount"),
7365
- api
7366
- };
7367
- }, "menuMapper");
7368
- var remountTool = {
7369
- title: "remount",
7370
- id: "remount",
7371
- type: types.TOOL,
7372
- match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7373
- render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper2 }, ({ remount, storyId, api }) => {
7374
- const [isAnimating, setIsAnimating] = useState(false);
7375
- const remountComponent = /* @__PURE__ */ __name(() => {
7376
- if (!storyId) {
7377
- return;
7378
- }
7379
- remount();
7380
- }, "remountComponent");
7381
- api.on(FORCE_REMOUNT, () => {
7382
- setIsAnimating(true);
7383
- });
7384
- return react_default.createElement(
7385
- StyledAnimatedIconButton,
7386
- {
7387
- key: "remount",
7388
- title: "Remount component",
7389
- onClick: remountComponent,
7390
- onAnimationEnd: () => setIsAnimating(false),
7391
- animating: isAnimating,
7392
- disabled: !storyId
7393
- },
7394
- react_default.createElement(SyncIcon, null)
7395
- );
7396
- }), "render")
7397
- };
7398
-
7399
- // src/manager/components/preview/tools/zoom.tsx
7400
- var initialZoom = 1;
7401
- var Context = createContext({ value: initialZoom, set: /* @__PURE__ */ __name((v2) => {
7402
- }, "set") });
7403
- var _ZoomProvider = class _ZoomProvider extends Component {
7404
- constructor() {
7405
- super(...arguments);
7406
- this.state = {
7407
- value: initialZoom
7408
- };
7409
- this.set = /* @__PURE__ */ __name((value) => this.setState({ value }), "set");
7410
- }
7411
- render() {
7412
- const { children: children2, shouldScale } = this.props;
7413
- const { set: set2 } = this;
7414
- const { value } = this.state;
7415
- return react_default.createElement(Context.Provider, { value: { value: shouldScale ? value : initialZoom, set: set2 } }, children2);
7416
- }
7417
- };
7418
- __name(_ZoomProvider, "ZoomProvider");
7419
- var ZoomProvider = _ZoomProvider;
7420
- var { Consumer: ZoomConsumer } = Context;
7421
- var Zoom2 = memo(/* @__PURE__ */ __name(function Zoom3({ zoomIn, zoomOut, reset }) {
7422
- return react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { key: "zoomin", onClick: zoomIn, title: "Zoom in" }, react_default.createElement(ZoomIcon, null)), react_default.createElement(IconButton, { key: "zoomout", onClick: zoomOut, title: "Zoom out" }, react_default.createElement(ZoomOutIcon, null)), react_default.createElement(IconButton, { key: "zoomreset", onClick: reset, title: "Reset zoom" }, react_default.createElement(ZoomResetIcon, null)));
7423
- }, "Zoom"));
7424
- var ZoomWrapper = memo(/* @__PURE__ */ __name(function ZoomWrapper2({
7425
- set: set2,
7426
- value
7427
- }) {
7428
- const zoomIn = useCallback(
7429
- (e2) => {
7430
- e2.preventDefault();
7431
- set2(0.8 * value);
7432
- },
7433
- [set2, value]
7434
- );
7435
- const zoomOut = useCallback(
7436
- (e2) => {
7437
- e2.preventDefault();
7438
- set2(1.25 * value);
7439
- },
7440
- [set2, value]
7441
- );
7442
- const reset = useCallback(
7443
- (e2) => {
7444
- e2.preventDefault();
7445
- set2(initialZoom);
7446
- },
7447
- [set2, initialZoom]
7448
- );
7449
- return react_default.createElement(Zoom2, { key: "zoom", ...{ zoomIn, zoomOut, reset } });
7450
- }, "ZoomWrapper"));
7451
- function ZoomToolRenderer() {
7452
- return react_default.createElement(react_default.Fragment, null, react_default.createElement(ZoomConsumer, null, ({ set: set2, value }) => react_default.createElement(ZoomWrapper, { ...{ set: set2, value } })), react_default.createElement(Separator, null));
7453
- }
7454
- __name(ZoomToolRenderer, "ZoomToolRenderer");
7455
- var zoomTool = {
7456
- title: "zoom",
7457
- id: "zoom",
7458
- type: types.TOOL,
7459
- match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7460
- render: ZoomToolRenderer
7461
- };
7462
-
7463
7280
  // src/manager/components/preview/Toolbar.tsx
7464
7281
  var fullScreenMapper = /* @__PURE__ */ __name(({ api, state }) => {
7465
7282
  return {
@@ -7676,6 +7493,70 @@ var defaultWrappers = [
7676
7493
  }
7677
7494
  ];
7678
7495
 
7496
+ // src/manager/components/preview/tools/zoom.tsx
7497
+ var initialZoom = 1;
7498
+ var Context = createContext({ value: initialZoom, set: /* @__PURE__ */ __name((v2) => {
7499
+ }, "set") });
7500
+ var _ZoomProvider = class _ZoomProvider extends Component {
7501
+ constructor() {
7502
+ super(...arguments);
7503
+ this.state = {
7504
+ value: initialZoom
7505
+ };
7506
+ this.set = /* @__PURE__ */ __name((value) => this.setState({ value }), "set");
7507
+ }
7508
+ render() {
7509
+ const { children: children2, shouldScale } = this.props;
7510
+ const { set: set2 } = this;
7511
+ const { value } = this.state;
7512
+ return react_default.createElement(Context.Provider, { value: { value: shouldScale ? value : initialZoom, set: set2 } }, children2);
7513
+ }
7514
+ };
7515
+ __name(_ZoomProvider, "ZoomProvider");
7516
+ var ZoomProvider = _ZoomProvider;
7517
+ var { Consumer: ZoomConsumer } = Context;
7518
+ var Zoom2 = memo(/* @__PURE__ */ __name(function Zoom3({ zoomIn, zoomOut, reset }) {
7519
+ return react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { key: "zoomin", onClick: zoomIn, title: "Zoom in" }, react_default.createElement(ZoomIcon, null)), react_default.createElement(IconButton, { key: "zoomout", onClick: zoomOut, title: "Zoom out" }, react_default.createElement(ZoomOutIcon, null)), react_default.createElement(IconButton, { key: "zoomreset", onClick: reset, title: "Reset zoom" }, react_default.createElement(ZoomResetIcon, null)));
7520
+ }, "Zoom"));
7521
+ var ZoomWrapper = memo(/* @__PURE__ */ __name(function ZoomWrapper2({
7522
+ set: set2,
7523
+ value
7524
+ }) {
7525
+ const zoomIn = useCallback(
7526
+ (e2) => {
7527
+ e2.preventDefault();
7528
+ set2(0.8 * value);
7529
+ },
7530
+ [set2, value]
7531
+ );
7532
+ const zoomOut = useCallback(
7533
+ (e2) => {
7534
+ e2.preventDefault();
7535
+ set2(1.25 * value);
7536
+ },
7537
+ [set2, value]
7538
+ );
7539
+ const reset = useCallback(
7540
+ (e2) => {
7541
+ e2.preventDefault();
7542
+ set2(initialZoom);
7543
+ },
7544
+ [set2, initialZoom]
7545
+ );
7546
+ return react_default.createElement(Zoom2, { key: "zoom", ...{ zoomIn, zoomOut, reset } });
7547
+ }, "ZoomWrapper"));
7548
+ function ZoomToolRenderer() {
7549
+ return react_default.createElement(react_default.Fragment, null, react_default.createElement(ZoomConsumer, null, ({ set: set2, value }) => react_default.createElement(ZoomWrapper, { ...{ set: set2, value } })), react_default.createElement(Separator, null));
7550
+ }
7551
+ __name(ZoomToolRenderer, "ZoomToolRenderer");
7552
+ var zoomTool = {
7553
+ title: "zoom",
7554
+ id: "zoom",
7555
+ type: types.TOOL,
7556
+ match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7557
+ render: ZoomToolRenderer
7558
+ };
7559
+
7679
7560
  // src/manager/components/preview/Preview.tsx
7680
7561
  var canvasMapper = /* @__PURE__ */ __name(({ state, api }) => ({
7681
7562
  storyId: state.storyId,
@@ -7828,8 +7709,23 @@ function filterTabs(panels, parameters) {
7828
7709
  }
7829
7710
  __name(filterTabs, "filterTabs");
7830
7711
 
7712
+ // src/manager/components/preview/tools/addons.tsx
7713
+ var menuMapper = /* @__PURE__ */ __name(({ api, state }) => ({
7714
+ isVisible: api.getIsPanelShown(),
7715
+ singleStory: state.singleStory,
7716
+ panelPosition: state.layout.panelPosition,
7717
+ toggle: /* @__PURE__ */ __name(() => api.togglePanel(), "toggle")
7718
+ }), "menuMapper");
7719
+ var addonsTool = {
7720
+ title: "addons",
7721
+ id: "addons",
7722
+ type: types.TOOL,
7723
+ match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7724
+ render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper }, ({ isVisible, toggle, singleStory, panelPosition }) => !singleStory && !isVisible && react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { "aria-label": "Show addons", key: "addons", onClick: toggle, title: "Show addons" }, panelPosition === "bottom" ? react_default.createElement(BottomBarIcon, null) : react_default.createElement(SidebarAltIcon, null)))), "render")
7725
+ };
7726
+
7831
7727
  // src/manager/components/preview/tools/menu.tsx
7832
- var menuMapper3 = /* @__PURE__ */ __name(({ api, state }) => ({
7728
+ var menuMapper2 = /* @__PURE__ */ __name(({ api, state }) => ({
7833
7729
  isVisible: api.getIsNavShown(),
7834
7730
  singleStory: state.singleStory,
7835
7731
  toggle: /* @__PURE__ */ __name(() => api.toggleNav(), "toggle")
@@ -7838,15 +7734,1559 @@ var menuTool = {
7838
7734
  title: "menu",
7839
7735
  id: "menu",
7840
7736
  type: types.TOOL,
7841
- // @ts-expect-error (non strict)
7842
- match: /* @__PURE__ */ __name(({ viewMode }) => ["story", "docs"].includes(viewMode), "match"),
7843
- render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper3 }, ({ isVisible, toggle, singleStory }) => !singleStory && !isVisible && react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { "aria-label": "Show sidebar", key: "menu", onClick: toggle, title: "Show sidebar" }, react_default.createElement(MenuIcon, null)), react_default.createElement(Separator, null))), "render")
7737
+ // @ts-expect-error (non strict)
7738
+ match: /* @__PURE__ */ __name(({ viewMode }) => ["story", "docs"].includes(viewMode), "match"),
7739
+ render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper2 }, ({ isVisible, toggle, singleStory }) => !singleStory && !isVisible && react_default.createElement(react_default.Fragment, null, react_default.createElement(IconButton, { "aria-label": "Show sidebar", key: "menu", onClick: toggle, title: "Show sidebar" }, react_default.createElement(MenuIcon, null)), react_default.createElement(Separator, null))), "render")
7740
+ };
7741
+
7742
+ // src/manager/components/preview/tools/open-in-editor.tsx
7743
+ var mapper2 = /* @__PURE__ */ __name(({ state, api }) => {
7744
+ const { storyId, refId } = state;
7745
+ const entry = api.getData(storyId, refId);
7746
+ const isCompositionStory = !!refId;
7747
+ return {
7748
+ storyId,
7749
+ isCompositionStory,
7750
+ importPath: entry?.importPath
7751
+ };
7752
+ }, "mapper");
7753
+ var openInEditorTool = {
7754
+ title: "open-in-editor",
7755
+ id: "open-in-editor",
7756
+ type: types.TOOL,
7757
+ match: /* @__PURE__ */ __name(({ viewMode, tabId }) => scope.CONFIG_TYPE === "DEVELOPMENT" && (viewMode === "story" || viewMode === "docs") && !tabId, "match"),
7758
+ render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: mapper2 }, ({ importPath, isCompositionStory }) => {
7759
+ const api = useStorybookApi();
7760
+ if (isCompositionStory || !importPath) {
7761
+ return null;
7762
+ }
7763
+ return react_default.createElement(
7764
+ IconButton,
7765
+ {
7766
+ key: "open-in-editor",
7767
+ onClick: () => api.openInEditor({
7768
+ file: importPath
7769
+ }),
7770
+ title: "Open in editor",
7771
+ "aria-label": "Open in editor"
7772
+ },
7773
+ react_default.createElement(EditorIcon, null)
7774
+ );
7775
+ }), "render")
7776
+ };
7777
+
7778
+ // src/manager/components/preview/tools/remount.tsx
7779
+ var StyledAnimatedIconButton = styled(IconButton)(({ theme, animating, disabled }) => ({
7780
+ opacity: disabled ? 0.5 : 1,
7781
+ svg: {
7782
+ animation: animating ? `${theme.animation.rotate360} 1000ms ease-out` : void 0
7783
+ }
7784
+ }));
7785
+ var menuMapper3 = /* @__PURE__ */ __name(({ api, state }) => {
7786
+ const { storyId } = state;
7787
+ return {
7788
+ storyId,
7789
+ remount: /* @__PURE__ */ __name(() => api.emit(FORCE_REMOUNT, { storyId: state.storyId }), "remount"),
7790
+ api
7791
+ };
7792
+ }, "menuMapper");
7793
+ var remountTool = {
7794
+ title: "remount",
7795
+ id: "remount",
7796
+ type: types.TOOL,
7797
+ match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
7798
+ render: /* @__PURE__ */ __name(() => react_default.createElement(Consumer, { filter: menuMapper3 }, ({ remount, storyId, api }) => {
7799
+ const [isAnimating, setIsAnimating] = useState(false);
7800
+ const remountComponent = /* @__PURE__ */ __name(() => {
7801
+ if (!storyId) {
7802
+ return;
7803
+ }
7804
+ remount();
7805
+ }, "remountComponent");
7806
+ api.on(FORCE_REMOUNT, () => {
7807
+ setIsAnimating(true);
7808
+ });
7809
+ return react_default.createElement(
7810
+ StyledAnimatedIconButton,
7811
+ {
7812
+ key: "remount",
7813
+ title: "Remount component",
7814
+ onClick: remountComponent,
7815
+ onAnimationEnd: () => setIsAnimating(false),
7816
+ animating: isAnimating,
7817
+ disabled: !storyId
7818
+ },
7819
+ react_default.createElement(SyncIcon, null)
7820
+ );
7821
+ }), "render")
7822
+ };
7823
+
7824
+ // src/manager/components/preview/tools/share.tsx
7825
+ var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
7826
+
7827
+ // ../node_modules/qrcode.react/lib/esm/index.js
7828
+ var __defProp2 = Object.defineProperty;
7829
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7830
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
7831
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7832
+ var __defNormalProp = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, "__defNormalProp");
7833
+ var __spreadValues = /* @__PURE__ */ __name((a2, b2) => {
7834
+ for (var prop in b2 || (b2 = {}))
7835
+ if (__hasOwnProp2.call(b2, prop))
7836
+ __defNormalProp(a2, prop, b2[prop]);
7837
+ if (__getOwnPropSymbols)
7838
+ for (var prop of __getOwnPropSymbols(b2)) {
7839
+ if (__propIsEnum.call(b2, prop))
7840
+ __defNormalProp(a2, prop, b2[prop]);
7841
+ }
7842
+ return a2;
7843
+ }, "__spreadValues");
7844
+ var __objRest = /* @__PURE__ */ __name((source, exclude) => {
7845
+ var target = {};
7846
+ for (var prop in source)
7847
+ if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
7848
+ target[prop] = source[prop];
7849
+ if (source != null && __getOwnPropSymbols)
7850
+ for (var prop of __getOwnPropSymbols(source)) {
7851
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
7852
+ target[prop] = source[prop];
7853
+ }
7854
+ return target;
7855
+ }, "__objRest");
7856
+ var qrcodegen;
7857
+ ((qrcodegen2) => {
7858
+ var _a, _b;
7859
+ const _QrCode = (_a = class {
7860
+ /*-- Constructor (low level) and fields --*/
7861
+ // Creates a new QR Code with the given version number,
7862
+ // error correction level, data codeword bytes, and mask number.
7863
+ // This is a low-level API that most users should not use directly.
7864
+ // A mid-level API is the encodeSegments() function.
7865
+ constructor(version3, errorCorrectionLevel, dataCodewords, msk) {
7866
+ this.version = version3;
7867
+ this.errorCorrectionLevel = errorCorrectionLevel;
7868
+ this.modules = [];
7869
+ this.isFunction = [];
7870
+ if (version3 < _a.MIN_VERSION || version3 > _a.MAX_VERSION)
7871
+ throw new RangeError("Version value out of range");
7872
+ if (msk < -1 || msk > 7)
7873
+ throw new RangeError("Mask value out of range");
7874
+ this.size = version3 * 4 + 17;
7875
+ let row = [];
7876
+ for (let i2 = 0; i2 < this.size; i2++)
7877
+ row.push(false);
7878
+ for (let i2 = 0; i2 < this.size; i2++) {
7879
+ this.modules.push(row.slice());
7880
+ this.isFunction.push(row.slice());
7881
+ }
7882
+ this.drawFunctionPatterns();
7883
+ const allCodewords = this.addEccAndInterleave(dataCodewords);
7884
+ this.drawCodewords(allCodewords);
7885
+ if (msk == -1) {
7886
+ let minPenalty = 1e9;
7887
+ for (let i2 = 0; i2 < 8; i2++) {
7888
+ this.applyMask(i2);
7889
+ this.drawFormatBits(i2);
7890
+ const penalty = this.getPenaltyScore();
7891
+ if (penalty < minPenalty) {
7892
+ msk = i2;
7893
+ minPenalty = penalty;
7894
+ }
7895
+ this.applyMask(i2);
7896
+ }
7897
+ }
7898
+ assert(0 <= msk && msk <= 7);
7899
+ this.mask = msk;
7900
+ this.applyMask(msk);
7901
+ this.drawFormatBits(msk);
7902
+ this.isFunction = [];
7903
+ }
7904
+ /*-- Static factory functions (high level) --*/
7905
+ // Returns a QR Code representing the given Unicode text string at the given error correction level.
7906
+ // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
7907
+ // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
7908
+ // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
7909
+ // ecl argument if it can be done without increasing the version.
7910
+ static encodeText(text, ecl) {
7911
+ const segs = qrcodegen2.QrSegment.makeSegments(text);
7912
+ return _a.encodeSegments(segs, ecl);
7913
+ }
7914
+ // Returns a QR Code representing the given binary data at the given error correction level.
7915
+ // This function always encodes using the binary segment mode, not any text mode. The maximum number of
7916
+ // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
7917
+ // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
7918
+ static encodeBinary(data, ecl) {
7919
+ const seg = qrcodegen2.QrSegment.makeBytes(data);
7920
+ return _a.encodeSegments([seg], ecl);
7921
+ }
7922
+ /*-- Static factory functions (mid level) --*/
7923
+ // Returns a QR Code representing the given segments with the given encoding parameters.
7924
+ // The smallest possible QR Code version within the given range is automatically
7925
+ // chosen for the output. Iff boostEcl is true, then the ECC level of the result
7926
+ // may be higher than the ecl argument if it can be done without increasing the
7927
+ // version. The mask number is either between 0 to 7 (inclusive) to force that
7928
+ // mask, or -1 to automatically choose an appropriate mask (which may be slow).
7929
+ // This function allows the user to create a custom sequence of segments that switches
7930
+ // between modes (such as alphanumeric and byte) to encode text in less space.
7931
+ // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
7932
+ static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {
7933
+ if (!(_a.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _a.MAX_VERSION) || mask < -1 || mask > 7)
7934
+ throw new RangeError("Invalid value");
7935
+ let version3;
7936
+ let dataUsedBits;
7937
+ for (version3 = minVersion; ; version3++) {
7938
+ const dataCapacityBits2 = _a.getNumDataCodewords(version3, ecl) * 8;
7939
+ const usedBits = QrSegment.getTotalBits(segs, version3);
7940
+ if (usedBits <= dataCapacityBits2) {
7941
+ dataUsedBits = usedBits;
7942
+ break;
7943
+ }
7944
+ if (version3 >= maxVersion)
7945
+ throw new RangeError("Data too long");
7946
+ }
7947
+ for (const newEcl of [_a.Ecc.MEDIUM, _a.Ecc.QUARTILE, _a.Ecc.HIGH]) {
7948
+ if (boostEcl && dataUsedBits <= _a.getNumDataCodewords(version3, newEcl) * 8)
7949
+ ecl = newEcl;
7950
+ }
7951
+ let bb = [];
7952
+ for (const seg of segs) {
7953
+ appendBits(seg.mode.modeBits, 4, bb);
7954
+ appendBits(seg.numChars, seg.mode.numCharCountBits(version3), bb);
7955
+ for (const b2 of seg.getData())
7956
+ bb.push(b2);
7957
+ }
7958
+ assert(bb.length == dataUsedBits);
7959
+ const dataCapacityBits = _a.getNumDataCodewords(version3, ecl) * 8;
7960
+ assert(bb.length <= dataCapacityBits);
7961
+ appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
7962
+ appendBits(0, (8 - bb.length % 8) % 8, bb);
7963
+ assert(bb.length % 8 == 0);
7964
+ for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)
7965
+ appendBits(padByte, 8, bb);
7966
+ let dataCodewords = [];
7967
+ while (dataCodewords.length * 8 < bb.length)
7968
+ dataCodewords.push(0);
7969
+ bb.forEach((b2, i2) => dataCodewords[i2 >>> 3] |= b2 << 7 - (i2 & 7));
7970
+ return new _a(version3, ecl, dataCodewords, mask);
7971
+ }
7972
+ /*-- Accessor methods --*/
7973
+ // Returns the color of the module (pixel) at the given coordinates, which is false
7974
+ // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
7975
+ // If the given coordinates are out of bounds, then false (light) is returned.
7976
+ getModule(x2, y2) {
7977
+ return 0 <= x2 && x2 < this.size && 0 <= y2 && y2 < this.size && this.modules[y2][x2];
7978
+ }
7979
+ // Modified to expose modules for easy access
7980
+ getModules() {
7981
+ return this.modules;
7982
+ }
7983
+ /*-- Private helper methods for constructor: Drawing function modules --*/
7984
+ // Reads this object's version field, and draws and marks all function modules.
7985
+ drawFunctionPatterns() {
7986
+ for (let i2 = 0; i2 < this.size; i2++) {
7987
+ this.setFunctionModule(6, i2, i2 % 2 == 0);
7988
+ this.setFunctionModule(i2, 6, i2 % 2 == 0);
7989
+ }
7990
+ this.drawFinderPattern(3, 3);
7991
+ this.drawFinderPattern(this.size - 4, 3);
7992
+ this.drawFinderPattern(3, this.size - 4);
7993
+ const alignPatPos = this.getAlignmentPatternPositions();
7994
+ const numAlign = alignPatPos.length;
7995
+ for (let i2 = 0; i2 < numAlign; i2++) {
7996
+ for (let j2 = 0; j2 < numAlign; j2++) {
7997
+ if (!(i2 == 0 && j2 == 0 || i2 == 0 && j2 == numAlign - 1 || i2 == numAlign - 1 && j2 == 0))
7998
+ this.drawAlignmentPattern(alignPatPos[i2], alignPatPos[j2]);
7999
+ }
8000
+ }
8001
+ this.drawFormatBits(0);
8002
+ this.drawVersion();
8003
+ }
8004
+ // Draws two copies of the format bits (with its own error correction code)
8005
+ // based on the given mask and this object's error correction level field.
8006
+ drawFormatBits(mask) {
8007
+ const data = this.errorCorrectionLevel.formatBits << 3 | mask;
8008
+ let rem2 = data;
8009
+ for (let i2 = 0; i2 < 10; i2++)
8010
+ rem2 = rem2 << 1 ^ (rem2 >>> 9) * 1335;
8011
+ const bits = (data << 10 | rem2) ^ 21522;
8012
+ assert(bits >>> 15 == 0);
8013
+ for (let i2 = 0; i2 <= 5; i2++)
8014
+ this.setFunctionModule(8, i2, getBit(bits, i2));
8015
+ this.setFunctionModule(8, 7, getBit(bits, 6));
8016
+ this.setFunctionModule(8, 8, getBit(bits, 7));
8017
+ this.setFunctionModule(7, 8, getBit(bits, 8));
8018
+ for (let i2 = 9; i2 < 15; i2++)
8019
+ this.setFunctionModule(14 - i2, 8, getBit(bits, i2));
8020
+ for (let i2 = 0; i2 < 8; i2++)
8021
+ this.setFunctionModule(this.size - 1 - i2, 8, getBit(bits, i2));
8022
+ for (let i2 = 8; i2 < 15; i2++)
8023
+ this.setFunctionModule(8, this.size - 15 + i2, getBit(bits, i2));
8024
+ this.setFunctionModule(8, this.size - 8, true);
8025
+ }
8026
+ // Draws two copies of the version bits (with its own error correction code),
8027
+ // based on this object's version field, iff 7 <= version <= 40.
8028
+ drawVersion() {
8029
+ if (this.version < 7)
8030
+ return;
8031
+ let rem2 = this.version;
8032
+ for (let i2 = 0; i2 < 12; i2++)
8033
+ rem2 = rem2 << 1 ^ (rem2 >>> 11) * 7973;
8034
+ const bits = this.version << 12 | rem2;
8035
+ assert(bits >>> 18 == 0);
8036
+ for (let i2 = 0; i2 < 18; i2++) {
8037
+ const color2 = getBit(bits, i2);
8038
+ const a2 = this.size - 11 + i2 % 3;
8039
+ const b2 = Math.floor(i2 / 3);
8040
+ this.setFunctionModule(a2, b2, color2);
8041
+ this.setFunctionModule(b2, a2, color2);
8042
+ }
8043
+ }
8044
+ // Draws a 9*9 finder pattern including the border separator,
8045
+ // with the center module at (x, y). Modules can be out of bounds.
8046
+ drawFinderPattern(x2, y2) {
8047
+ for (let dy = -4; dy <= 4; dy++) {
8048
+ for (let dx = -4; dx <= 4; dx++) {
8049
+ const dist = Math.max(Math.abs(dx), Math.abs(dy));
8050
+ const xx = x2 + dx;
8051
+ const yy = y2 + dy;
8052
+ if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
8053
+ this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
8054
+ }
8055
+ }
8056
+ }
8057
+ // Draws a 5*5 alignment pattern, with the center module
8058
+ // at (x, y). All modules must be in bounds.
8059
+ drawAlignmentPattern(x2, y2) {
8060
+ for (let dy = -2; dy <= 2; dy++) {
8061
+ for (let dx = -2; dx <= 2; dx++)
8062
+ this.setFunctionModule(x2 + dx, y2 + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
8063
+ }
8064
+ }
8065
+ // Sets the color of a module and marks it as a function module.
8066
+ // Only used by the constructor. Coordinates must be in bounds.
8067
+ setFunctionModule(x2, y2, isDark) {
8068
+ this.modules[y2][x2] = isDark;
8069
+ this.isFunction[y2][x2] = true;
8070
+ }
8071
+ /*-- Private helper methods for constructor: Codewords and masking --*/
8072
+ // Returns a new byte string representing the given data with the appropriate error correction
8073
+ // codewords appended to it, based on this object's version and error correction level.
8074
+ addEccAndInterleave(data) {
8075
+ const ver = this.version;
8076
+ const ecl = this.errorCorrectionLevel;
8077
+ if (data.length != _a.getNumDataCodewords(ver, ecl))
8078
+ throw new RangeError("Invalid argument");
8079
+ const numBlocks = _a.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
8080
+ const blockEccLen = _a.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
8081
+ const rawCodewords = Math.floor(_a.getNumRawDataModules(ver) / 8);
8082
+ const numShortBlocks = numBlocks - rawCodewords % numBlocks;
8083
+ const shortBlockLen = Math.floor(rawCodewords / numBlocks);
8084
+ let blocks = [];
8085
+ const rsDiv = _a.reedSolomonComputeDivisor(blockEccLen);
8086
+ for (let i2 = 0, k2 = 0; i2 < numBlocks; i2++) {
8087
+ let dat = data.slice(k2, k2 + shortBlockLen - blockEccLen + (i2 < numShortBlocks ? 0 : 1));
8088
+ k2 += dat.length;
8089
+ const ecc = _a.reedSolomonComputeRemainder(dat, rsDiv);
8090
+ if (i2 < numShortBlocks)
8091
+ dat.push(0);
8092
+ blocks.push(dat.concat(ecc));
8093
+ }
8094
+ let result2 = [];
8095
+ for (let i2 = 0; i2 < blocks[0].length; i2++) {
8096
+ blocks.forEach((block, j2) => {
8097
+ if (i2 != shortBlockLen - blockEccLen || j2 >= numShortBlocks)
8098
+ result2.push(block[i2]);
8099
+ });
8100
+ }
8101
+ assert(result2.length == rawCodewords);
8102
+ return result2;
8103
+ }
8104
+ // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
8105
+ // data area of this QR Code. Function modules need to be marked off before this is called.
8106
+ drawCodewords(data) {
8107
+ if (data.length != Math.floor(_a.getNumRawDataModules(this.version) / 8))
8108
+ throw new RangeError("Invalid argument");
8109
+ let i2 = 0;
8110
+ for (let right = this.size - 1; right >= 1; right -= 2) {
8111
+ if (right == 6)
8112
+ right = 5;
8113
+ for (let vert = 0; vert < this.size; vert++) {
8114
+ for (let j2 = 0; j2 < 2; j2++) {
8115
+ const x2 = right - j2;
8116
+ const upward = (right + 1 & 2) == 0;
8117
+ const y2 = upward ? this.size - 1 - vert : vert;
8118
+ if (!this.isFunction[y2][x2] && i2 < data.length * 8) {
8119
+ this.modules[y2][x2] = getBit(data[i2 >>> 3], 7 - (i2 & 7));
8120
+ i2++;
8121
+ }
8122
+ }
8123
+ }
8124
+ }
8125
+ assert(i2 == data.length * 8);
8126
+ }
8127
+ // XORs the codeword modules in this QR Code with the given mask pattern.
8128
+ // The function modules must be marked and the codeword bits must be drawn
8129
+ // before masking. Due to the arithmetic of XOR, calling applyMask() with
8130
+ // the same mask value a second time will undo the mask. A final well-formed
8131
+ // QR Code needs exactly one (not zero, two, etc.) mask applied.
8132
+ applyMask(mask) {
8133
+ if (mask < 0 || mask > 7)
8134
+ throw new RangeError("Mask value out of range");
8135
+ for (let y2 = 0; y2 < this.size; y2++) {
8136
+ for (let x2 = 0; x2 < this.size; x2++) {
8137
+ let invert3;
8138
+ switch (mask) {
8139
+ case 0:
8140
+ invert3 = (x2 + y2) % 2 == 0;
8141
+ break;
8142
+ case 1:
8143
+ invert3 = y2 % 2 == 0;
8144
+ break;
8145
+ case 2:
8146
+ invert3 = x2 % 3 == 0;
8147
+ break;
8148
+ case 3:
8149
+ invert3 = (x2 + y2) % 3 == 0;
8150
+ break;
8151
+ case 4:
8152
+ invert3 = (Math.floor(x2 / 3) + Math.floor(y2 / 2)) % 2 == 0;
8153
+ break;
8154
+ case 5:
8155
+ invert3 = x2 * y2 % 2 + x2 * y2 % 3 == 0;
8156
+ break;
8157
+ case 6:
8158
+ invert3 = (x2 * y2 % 2 + x2 * y2 % 3) % 2 == 0;
8159
+ break;
8160
+ case 7:
8161
+ invert3 = ((x2 + y2) % 2 + x2 * y2 % 3) % 2 == 0;
8162
+ break;
8163
+ default:
8164
+ throw new Error("Unreachable");
8165
+ }
8166
+ if (!this.isFunction[y2][x2] && invert3)
8167
+ this.modules[y2][x2] = !this.modules[y2][x2];
8168
+ }
8169
+ }
8170
+ }
8171
+ // Calculates and returns the penalty score based on state of this QR Code's current modules.
8172
+ // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
8173
+ getPenaltyScore() {
8174
+ let result2 = 0;
8175
+ for (let y2 = 0; y2 < this.size; y2++) {
8176
+ let runColor = false;
8177
+ let runX = 0;
8178
+ let runHistory = [0, 0, 0, 0, 0, 0, 0];
8179
+ for (let x2 = 0; x2 < this.size; x2++) {
8180
+ if (this.modules[y2][x2] == runColor) {
8181
+ runX++;
8182
+ if (runX == 5)
8183
+ result2 += _a.PENALTY_N1;
8184
+ else if (runX > 5)
8185
+ result2++;
8186
+ } else {
8187
+ this.finderPenaltyAddHistory(runX, runHistory);
8188
+ if (!runColor)
8189
+ result2 += this.finderPenaltyCountPatterns(runHistory) * _a.PENALTY_N3;
8190
+ runColor = this.modules[y2][x2];
8191
+ runX = 1;
8192
+ }
8193
+ }
8194
+ result2 += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _a.PENALTY_N3;
8195
+ }
8196
+ for (let x2 = 0; x2 < this.size; x2++) {
8197
+ let runColor = false;
8198
+ let runY = 0;
8199
+ let runHistory = [0, 0, 0, 0, 0, 0, 0];
8200
+ for (let y2 = 0; y2 < this.size; y2++) {
8201
+ if (this.modules[y2][x2] == runColor) {
8202
+ runY++;
8203
+ if (runY == 5)
8204
+ result2 += _a.PENALTY_N1;
8205
+ else if (runY > 5)
8206
+ result2++;
8207
+ } else {
8208
+ this.finderPenaltyAddHistory(runY, runHistory);
8209
+ if (!runColor)
8210
+ result2 += this.finderPenaltyCountPatterns(runHistory) * _a.PENALTY_N3;
8211
+ runColor = this.modules[y2][x2];
8212
+ runY = 1;
8213
+ }
8214
+ }
8215
+ result2 += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _a.PENALTY_N3;
8216
+ }
8217
+ for (let y2 = 0; y2 < this.size - 1; y2++) {
8218
+ for (let x2 = 0; x2 < this.size - 1; x2++) {
8219
+ const color2 = this.modules[y2][x2];
8220
+ if (color2 == this.modules[y2][x2 + 1] && color2 == this.modules[y2 + 1][x2] && color2 == this.modules[y2 + 1][x2 + 1])
8221
+ result2 += _a.PENALTY_N2;
8222
+ }
8223
+ }
8224
+ let dark = 0;
8225
+ for (const row of this.modules)
8226
+ dark = row.reduce((sum3, color2) => sum3 + (color2 ? 1 : 0), dark);
8227
+ const total = this.size * this.size;
8228
+ const k2 = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
8229
+ assert(0 <= k2 && k2 <= 9);
8230
+ result2 += k2 * _a.PENALTY_N4;
8231
+ assert(0 <= result2 && result2 <= 2568888);
8232
+ return result2;
8233
+ }
8234
+ /*-- Private helper functions --*/
8235
+ // Returns an ascending list of positions of alignment patterns for this version number.
8236
+ // Each position is in the range [0,177), and are used on both the x and y axes.
8237
+ // This could be implemented as lookup table of 40 variable-length lists of integers.
8238
+ getAlignmentPatternPositions() {
8239
+ if (this.version == 1)
8240
+ return [];
8241
+ else {
8242
+ const numAlign = Math.floor(this.version / 7) + 2;
8243
+ const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
8244
+ let result2 = [6];
8245
+ for (let pos = this.size - 7; result2.length < numAlign; pos -= step)
8246
+ result2.splice(1, 0, pos);
8247
+ return result2;
8248
+ }
8249
+ }
8250
+ // Returns the number of data bits that can be stored in a QR Code of the given version number, after
8251
+ // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
8252
+ // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
8253
+ static getNumRawDataModules(ver) {
8254
+ if (ver < _a.MIN_VERSION || ver > _a.MAX_VERSION)
8255
+ throw new RangeError("Version number out of range");
8256
+ let result2 = (16 * ver + 128) * ver + 64;
8257
+ if (ver >= 2) {
8258
+ const numAlign = Math.floor(ver / 7) + 2;
8259
+ result2 -= (25 * numAlign - 10) * numAlign - 55;
8260
+ if (ver >= 7)
8261
+ result2 -= 36;
8262
+ }
8263
+ assert(208 <= result2 && result2 <= 29648);
8264
+ return result2;
8265
+ }
8266
+ // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
8267
+ // QR Code of the given version number and error correction level, with remainder bits discarded.
8268
+ // This stateless pure function could be implemented as a (40*4)-cell lookup table.
8269
+ static getNumDataCodewords(ver, ecl) {
8270
+ return Math.floor(_a.getNumRawDataModules(ver) / 8) - _a.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _a.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
8271
+ }
8272
+ // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
8273
+ // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
8274
+ static reedSolomonComputeDivisor(degree) {
8275
+ if (degree < 1 || degree > 255)
8276
+ throw new RangeError("Degree out of range");
8277
+ let result2 = [];
8278
+ for (let i2 = 0; i2 < degree - 1; i2++)
8279
+ result2.push(0);
8280
+ result2.push(1);
8281
+ let root = 1;
8282
+ for (let i2 = 0; i2 < degree; i2++) {
8283
+ for (let j2 = 0; j2 < result2.length; j2++) {
8284
+ result2[j2] = _a.reedSolomonMultiply(result2[j2], root);
8285
+ if (j2 + 1 < result2.length)
8286
+ result2[j2] ^= result2[j2 + 1];
8287
+ }
8288
+ root = _a.reedSolomonMultiply(root, 2);
8289
+ }
8290
+ return result2;
8291
+ }
8292
+ // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
8293
+ static reedSolomonComputeRemainder(data, divisor) {
8294
+ let result2 = divisor.map((_2) => 0);
8295
+ for (const b2 of data) {
8296
+ const factor = b2 ^ result2.shift();
8297
+ result2.push(0);
8298
+ divisor.forEach((coef, i2) => result2[i2] ^= _a.reedSolomonMultiply(coef, factor));
8299
+ }
8300
+ return result2;
8301
+ }
8302
+ // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
8303
+ // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
8304
+ static reedSolomonMultiply(x2, y2) {
8305
+ if (x2 >>> 8 != 0 || y2 >>> 8 != 0)
8306
+ throw new RangeError("Byte out of range");
8307
+ let z2 = 0;
8308
+ for (let i2 = 7; i2 >= 0; i2--) {
8309
+ z2 = z2 << 1 ^ (z2 >>> 7) * 285;
8310
+ z2 ^= (y2 >>> i2 & 1) * x2;
8311
+ }
8312
+ assert(z2 >>> 8 == 0);
8313
+ return z2;
8314
+ }
8315
+ // Can only be called immediately after a light run is added, and
8316
+ // returns either 0, 1, or 2. A helper function for getPenaltyScore().
8317
+ finderPenaltyCountPatterns(runHistory) {
8318
+ const n3 = runHistory[1];
8319
+ assert(n3 <= this.size * 3);
8320
+ const core = n3 > 0 && runHistory[2] == n3 && runHistory[3] == n3 * 3 && runHistory[4] == n3 && runHistory[5] == n3;
8321
+ return (core && runHistory[0] >= n3 * 4 && runHistory[6] >= n3 ? 1 : 0) + (core && runHistory[6] >= n3 * 4 && runHistory[0] >= n3 ? 1 : 0);
8322
+ }
8323
+ // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
8324
+ finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
8325
+ if (currentRunColor) {
8326
+ this.finderPenaltyAddHistory(currentRunLength, runHistory);
8327
+ currentRunLength = 0;
8328
+ }
8329
+ currentRunLength += this.size;
8330
+ this.finderPenaltyAddHistory(currentRunLength, runHistory);
8331
+ return this.finderPenaltyCountPatterns(runHistory);
8332
+ }
8333
+ // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
8334
+ finderPenaltyAddHistory(currentRunLength, runHistory) {
8335
+ if (runHistory[0] == 0)
8336
+ currentRunLength += this.size;
8337
+ runHistory.pop();
8338
+ runHistory.unshift(currentRunLength);
8339
+ }
8340
+ }, __name(_a, "_QrCode"), _a);
8341
+ _QrCode.MIN_VERSION = 1;
8342
+ _QrCode.MAX_VERSION = 40;
8343
+ _QrCode.PENALTY_N1 = 3;
8344
+ _QrCode.PENALTY_N2 = 3;
8345
+ _QrCode.PENALTY_N3 = 40;
8346
+ _QrCode.PENALTY_N4 = 10;
8347
+ _QrCode.ECC_CODEWORDS_PER_BLOCK = [
8348
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
8349
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
8350
+ [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
8351
+ // Low
8352
+ [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
8353
+ // Medium
8354
+ [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
8355
+ // Quartile
8356
+ [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
8357
+ // High
8358
+ ];
8359
+ _QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
8360
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
8361
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
8362
+ [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
8363
+ // Low
8364
+ [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
8365
+ // Medium
8366
+ [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
8367
+ // Quartile
8368
+ [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
8369
+ // High
8370
+ ];
8371
+ let QrCode = _QrCode;
8372
+ qrcodegen2.QrCode = _QrCode;
8373
+ function appendBits(val, len, bb) {
8374
+ if (len < 0 || len > 31 || val >>> len != 0)
8375
+ throw new RangeError("Value out of range");
8376
+ for (let i2 = len - 1; i2 >= 0; i2--)
8377
+ bb.push(val >>> i2 & 1);
8378
+ }
8379
+ __name(appendBits, "appendBits");
8380
+ function getBit(x2, i2) {
8381
+ return (x2 >>> i2 & 1) != 0;
8382
+ }
8383
+ __name(getBit, "getBit");
8384
+ function assert(cond2) {
8385
+ if (!cond2)
8386
+ throw new Error("Assertion error");
8387
+ }
8388
+ __name(assert, "assert");
8389
+ const _QrSegment = (_b = class {
8390
+ /*-- Constructor (low level) and fields --*/
8391
+ // Creates a new QR Code segment with the given attributes and data.
8392
+ // The character count (numChars) must agree with the mode and the bit buffer length,
8393
+ // but the constraint isn't checked. The given bit buffer is cloned and stored.
8394
+ constructor(mode, numChars, bitData) {
8395
+ this.mode = mode;
8396
+ this.numChars = numChars;
8397
+ this.bitData = bitData;
8398
+ if (numChars < 0)
8399
+ throw new RangeError("Invalid argument");
8400
+ this.bitData = bitData.slice();
8401
+ }
8402
+ /*-- Static factory functions (mid level) --*/
8403
+ // Returns a segment representing the given binary data encoded in
8404
+ // byte mode. All input byte arrays are acceptable. Any text string
8405
+ // can be converted to UTF-8 bytes and encoded as a byte mode segment.
8406
+ static makeBytes(data) {
8407
+ let bb = [];
8408
+ for (const b2 of data)
8409
+ appendBits(b2, 8, bb);
8410
+ return new _b(_b.Mode.BYTE, data.length, bb);
8411
+ }
8412
+ // Returns a segment representing the given string of decimal digits encoded in numeric mode.
8413
+ static makeNumeric(digits) {
8414
+ if (!_b.isNumeric(digits))
8415
+ throw new RangeError("String contains non-numeric characters");
8416
+ let bb = [];
8417
+ for (let i2 = 0; i2 < digits.length; ) {
8418
+ const n3 = Math.min(digits.length - i2, 3);
8419
+ appendBits(parseInt(digits.substring(i2, i2 + n3), 10), n3 * 3 + 1, bb);
8420
+ i2 += n3;
8421
+ }
8422
+ return new _b(_b.Mode.NUMERIC, digits.length, bb);
8423
+ }
8424
+ // Returns a segment representing the given text string encoded in alphanumeric mode.
8425
+ // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
8426
+ // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
8427
+ static makeAlphanumeric(text) {
8428
+ if (!_b.isAlphanumeric(text))
8429
+ throw new RangeError("String contains unencodable characters in alphanumeric mode");
8430
+ let bb = [];
8431
+ let i2;
8432
+ for (i2 = 0; i2 + 2 <= text.length; i2 += 2) {
8433
+ let temp = _b.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2)) * 45;
8434
+ temp += _b.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2 + 1));
8435
+ appendBits(temp, 11, bb);
8436
+ }
8437
+ if (i2 < text.length)
8438
+ appendBits(_b.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i2)), 6, bb);
8439
+ return new _b(_b.Mode.ALPHANUMERIC, text.length, bb);
8440
+ }
8441
+ // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
8442
+ // The result may use various segment modes and switch modes to optimize the length of the bit stream.
8443
+ static makeSegments(text) {
8444
+ if (text == "")
8445
+ return [];
8446
+ else if (_b.isNumeric(text))
8447
+ return [_b.makeNumeric(text)];
8448
+ else if (_b.isAlphanumeric(text))
8449
+ return [_b.makeAlphanumeric(text)];
8450
+ else
8451
+ return [_b.makeBytes(_b.toUtf8ByteArray(text))];
8452
+ }
8453
+ // Returns a segment representing an Extended Channel Interpretation
8454
+ // (ECI) designator with the given assignment value.
8455
+ static makeEci(assignVal) {
8456
+ let bb = [];
8457
+ if (assignVal < 0)
8458
+ throw new RangeError("ECI assignment value out of range");
8459
+ else if (assignVal < 1 << 7)
8460
+ appendBits(assignVal, 8, bb);
8461
+ else if (assignVal < 1 << 14) {
8462
+ appendBits(2, 2, bb);
8463
+ appendBits(assignVal, 14, bb);
8464
+ } else if (assignVal < 1e6) {
8465
+ appendBits(6, 3, bb);
8466
+ appendBits(assignVal, 21, bb);
8467
+ } else
8468
+ throw new RangeError("ECI assignment value out of range");
8469
+ return new _b(_b.Mode.ECI, 0, bb);
8470
+ }
8471
+ // Tests whether the given string can be encoded as a segment in numeric mode.
8472
+ // A string is encodable iff each character is in the range 0 to 9.
8473
+ static isNumeric(text) {
8474
+ return _b.NUMERIC_REGEX.test(text);
8475
+ }
8476
+ // Tests whether the given string can be encoded as a segment in alphanumeric mode.
8477
+ // A string is encodable iff each character is in the following set: 0 to 9, A to Z
8478
+ // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
8479
+ static isAlphanumeric(text) {
8480
+ return _b.ALPHANUMERIC_REGEX.test(text);
8481
+ }
8482
+ /*-- Methods --*/
8483
+ // Returns a new copy of the data bits of this segment.
8484
+ getData() {
8485
+ return this.bitData.slice();
8486
+ }
8487
+ // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
8488
+ // the given version. The result is infinity if a segment has too many characters to fit its length field.
8489
+ static getTotalBits(segs, version3) {
8490
+ let result2 = 0;
8491
+ for (const seg of segs) {
8492
+ const ccbits = seg.mode.numCharCountBits(version3);
8493
+ if (seg.numChars >= 1 << ccbits)
8494
+ return Infinity;
8495
+ result2 += 4 + ccbits + seg.bitData.length;
8496
+ }
8497
+ return result2;
8498
+ }
8499
+ // Returns a new array of bytes representing the given string encoded in UTF-8.
8500
+ static toUtf8ByteArray(str) {
8501
+ str = encodeURI(str);
8502
+ let result2 = [];
8503
+ for (let i2 = 0; i2 < str.length; i2++) {
8504
+ if (str.charAt(i2) != "%")
8505
+ result2.push(str.charCodeAt(i2));
8506
+ else {
8507
+ result2.push(parseInt(str.substring(i2 + 1, i2 + 3), 16));
8508
+ i2 += 2;
8509
+ }
8510
+ }
8511
+ return result2;
8512
+ }
8513
+ }, __name(_b, "_QrSegment"), _b);
8514
+ _QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
8515
+ _QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
8516
+ _QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
8517
+ let QrSegment = _QrSegment;
8518
+ qrcodegen2.QrSegment = _QrSegment;
8519
+ })(qrcodegen || (qrcodegen = {}));
8520
+ ((qrcodegen2) => {
8521
+ let QrCode;
8522
+ ((QrCode2) => {
8523
+ var _a;
8524
+ const _Ecc = (_a = class {
8525
+ // The QR Code can tolerate about 30% erroneous codewords
8526
+ /*-- Constructor and fields --*/
8527
+ constructor(ordinal, formatBits) {
8528
+ this.ordinal = ordinal;
8529
+ this.formatBits = formatBits;
8530
+ }
8531
+ }, __name(_a, "_Ecc"), _a);
8532
+ _Ecc.LOW = new _Ecc(0, 1);
8533
+ _Ecc.MEDIUM = new _Ecc(1, 0);
8534
+ _Ecc.QUARTILE = new _Ecc(2, 3);
8535
+ _Ecc.HIGH = new _Ecc(3, 2);
8536
+ let Ecc = _Ecc;
8537
+ QrCode2.Ecc = _Ecc;
8538
+ })(QrCode = qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
8539
+ })(qrcodegen || (qrcodegen = {}));
8540
+ ((qrcodegen2) => {
8541
+ let QrSegment;
8542
+ ((QrSegment2) => {
8543
+ var _a;
8544
+ const _Mode = (_a = class {
8545
+ /*-- Constructor and fields --*/
8546
+ constructor(modeBits, numBitsCharCount) {
8547
+ this.modeBits = modeBits;
8548
+ this.numBitsCharCount = numBitsCharCount;
8549
+ }
8550
+ /*-- Method --*/
8551
+ // (Package-private) Returns the bit width of the character count field for a segment in
8552
+ // this mode in a QR Code at the given version number. The result is in the range [0, 16].
8553
+ numCharCountBits(ver) {
8554
+ return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
8555
+ }
8556
+ }, __name(_a, "_Mode"), _a);
8557
+ _Mode.NUMERIC = new _Mode(1, [10, 12, 14]);
8558
+ _Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]);
8559
+ _Mode.BYTE = new _Mode(4, [8, 16, 16]);
8560
+ _Mode.KANJI = new _Mode(8, [8, 10, 12]);
8561
+ _Mode.ECI = new _Mode(7, [0, 0, 0]);
8562
+ let Mode = _Mode;
8563
+ QrSegment2.Mode = _Mode;
8564
+ })(QrSegment = qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
8565
+ })(qrcodegen || (qrcodegen = {}));
8566
+ var qrcodegen_default = qrcodegen;
8567
+ var ERROR_LEVEL_MAP = {
8568
+ L: qrcodegen_default.QrCode.Ecc.LOW,
8569
+ M: qrcodegen_default.QrCode.Ecc.MEDIUM,
8570
+ Q: qrcodegen_default.QrCode.Ecc.QUARTILE,
8571
+ H: qrcodegen_default.QrCode.Ecc.HIGH
8572
+ };
8573
+ var DEFAULT_SIZE = 128;
8574
+ var DEFAULT_LEVEL = "L";
8575
+ var DEFAULT_BGCOLOR = "#FFFFFF";
8576
+ var DEFAULT_FGCOLOR = "#000000";
8577
+ var DEFAULT_INCLUDEMARGIN = false;
8578
+ var DEFAULT_MINVERSION = 1;
8579
+ var SPEC_MARGIN_SIZE = 4;
8580
+ var DEFAULT_MARGIN_SIZE = 0;
8581
+ var DEFAULT_IMG_SCALE = 0.1;
8582
+ function generatePath(modules, margin = 0) {
8583
+ const ops = [];
8584
+ modules.forEach(function(row, y2) {
8585
+ let start = null;
8586
+ row.forEach(function(cell, x2) {
8587
+ if (!cell && start !== null) {
8588
+ ops.push(
8589
+ `M${start + margin} ${y2 + margin}h${x2 - start}v1H${start + margin}z`
8590
+ );
8591
+ start = null;
8592
+ return;
8593
+ }
8594
+ if (x2 === row.length - 1) {
8595
+ if (!cell) {
8596
+ return;
8597
+ }
8598
+ if (start === null) {
8599
+ ops.push(`M${x2 + margin},${y2 + margin} h1v1H${x2 + margin}z`);
8600
+ } else {
8601
+ ops.push(
8602
+ `M${start + margin},${y2 + margin} h${x2 + 1 - start}v1H${start + margin}z`
8603
+ );
8604
+ }
8605
+ return;
8606
+ }
8607
+ if (cell && start === null) {
8608
+ start = x2;
8609
+ }
8610
+ });
8611
+ });
8612
+ return ops.join("");
8613
+ }
8614
+ __name(generatePath, "generatePath");
8615
+ function excavateModules(modules, excavation) {
8616
+ return modules.slice().map((row, y2) => {
8617
+ if (y2 < excavation.y || y2 >= excavation.y + excavation.h) {
8618
+ return row;
8619
+ }
8620
+ return row.map((cell, x2) => {
8621
+ if (x2 < excavation.x || x2 >= excavation.x + excavation.w) {
8622
+ return cell;
8623
+ }
8624
+ return false;
8625
+ });
8626
+ });
8627
+ }
8628
+ __name(excavateModules, "excavateModules");
8629
+ function getImageSettings(cells, size2, margin, imageSettings) {
8630
+ if (imageSettings == null) {
8631
+ return null;
8632
+ }
8633
+ const numCells = cells.length + margin * 2;
8634
+ const defaultSize = Math.floor(size2 * DEFAULT_IMG_SCALE);
8635
+ const scale = numCells / size2;
8636
+ const w2 = (imageSettings.width || defaultSize) * scale;
8637
+ const h2 = (imageSettings.height || defaultSize) * scale;
8638
+ const x2 = imageSettings.x == null ? cells.length / 2 - w2 / 2 : imageSettings.x * scale;
8639
+ const y2 = imageSettings.y == null ? cells.length / 2 - h2 / 2 : imageSettings.y * scale;
8640
+ const opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
8641
+ let excavation = null;
8642
+ if (imageSettings.excavate) {
8643
+ let floorX = Math.floor(x2);
8644
+ let floorY = Math.floor(y2);
8645
+ let ceilW = Math.ceil(w2 + x2 - floorX);
8646
+ let ceilH = Math.ceil(h2 + y2 - floorY);
8647
+ excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
8648
+ }
8649
+ const crossOrigin = imageSettings.crossOrigin;
8650
+ return { x: x2, y: y2, h: h2, w: w2, excavation, opacity, crossOrigin };
8651
+ }
8652
+ __name(getImageSettings, "getImageSettings");
8653
+ function getMarginSize(includeMargin, marginSize) {
8654
+ if (marginSize != null) {
8655
+ return Math.max(Math.floor(marginSize), 0);
8656
+ }
8657
+ return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
8658
+ }
8659
+ __name(getMarginSize, "getMarginSize");
8660
+ function useQRCode({
8661
+ value,
8662
+ level,
8663
+ minVersion,
8664
+ includeMargin,
8665
+ marginSize,
8666
+ imageSettings,
8667
+ size: size2,
8668
+ boostLevel
8669
+ }) {
8670
+ let qrcode = react_default.useMemo(() => {
8671
+ const values3 = Array.isArray(value) ? value : [value];
8672
+ const segments = values3.reduce((accum, v2) => {
8673
+ accum.push(...qrcodegen_default.QrSegment.makeSegments(v2));
8674
+ return accum;
8675
+ }, []);
8676
+ return qrcodegen_default.QrCode.encodeSegments(
8677
+ segments,
8678
+ ERROR_LEVEL_MAP[level],
8679
+ minVersion,
8680
+ void 0,
8681
+ void 0,
8682
+ boostLevel
8683
+ );
8684
+ }, [value, level, minVersion, boostLevel]);
8685
+ const { cells, margin, numCells, calculatedImageSettings } = react_default.useMemo(() => {
8686
+ let cells2 = qrcode.getModules();
8687
+ const margin2 = getMarginSize(includeMargin, marginSize);
8688
+ const numCells2 = cells2.length + margin2 * 2;
8689
+ const calculatedImageSettings2 = getImageSettings(
8690
+ cells2,
8691
+ size2,
8692
+ margin2,
8693
+ imageSettings
8694
+ );
8695
+ return {
8696
+ cells: cells2,
8697
+ margin: margin2,
8698
+ numCells: numCells2,
8699
+ calculatedImageSettings: calculatedImageSettings2
8700
+ };
8701
+ }, [qrcode, size2, imageSettings, includeMargin, marginSize]);
8702
+ return {
8703
+ qrcode,
8704
+ margin,
8705
+ cells,
8706
+ numCells,
8707
+ calculatedImageSettings
8708
+ };
8709
+ }
8710
+ __name(useQRCode, "useQRCode");
8711
+ var SUPPORTS_PATH2D = function() {
8712
+ try {
8713
+ new Path2D().addPath(new Path2D());
8714
+ } catch (e2) {
8715
+ return false;
8716
+ }
8717
+ return true;
8718
+ }();
8719
+ var QRCodeCanvas = react_default.forwardRef(
8720
+ /* @__PURE__ */ __name(function QRCodeCanvas2(props, forwardedRef) {
8721
+ const _a = props, {
8722
+ value,
8723
+ size: size2 = DEFAULT_SIZE,
8724
+ level = DEFAULT_LEVEL,
8725
+ bgColor = DEFAULT_BGCOLOR,
8726
+ fgColor = DEFAULT_FGCOLOR,
8727
+ includeMargin = DEFAULT_INCLUDEMARGIN,
8728
+ minVersion = DEFAULT_MINVERSION,
8729
+ boostLevel,
8730
+ marginSize,
8731
+ imageSettings
8732
+ } = _a, extraProps = __objRest(_a, [
8733
+ "value",
8734
+ "size",
8735
+ "level",
8736
+ "bgColor",
8737
+ "fgColor",
8738
+ "includeMargin",
8739
+ "minVersion",
8740
+ "boostLevel",
8741
+ "marginSize",
8742
+ "imageSettings"
8743
+ ]);
8744
+ const _b = extraProps, { style } = _b, otherProps = __objRest(_b, ["style"]);
8745
+ const imgSrc = imageSettings == null ? void 0 : imageSettings.src;
8746
+ const _canvas = react_default.useRef(null);
8747
+ const _image = react_default.useRef(null);
8748
+ const setCanvasRef = react_default.useCallback(
8749
+ (node) => {
8750
+ _canvas.current = node;
8751
+ if (typeof forwardedRef === "function") {
8752
+ forwardedRef(node);
8753
+ } else if (forwardedRef) {
8754
+ forwardedRef.current = node;
8755
+ }
8756
+ },
8757
+ [forwardedRef]
8758
+ );
8759
+ const [isImgLoaded, setIsImageLoaded] = react_default.useState(false);
8760
+ const { margin, cells, numCells, calculatedImageSettings } = useQRCode({
8761
+ value,
8762
+ level,
8763
+ minVersion,
8764
+ boostLevel,
8765
+ includeMargin,
8766
+ marginSize,
8767
+ imageSettings,
8768
+ size: size2
8769
+ });
8770
+ react_default.useEffect(() => {
8771
+ if (_canvas.current != null) {
8772
+ const canvas = _canvas.current;
8773
+ const ctx = canvas.getContext("2d");
8774
+ if (!ctx) {
8775
+ return;
8776
+ }
8777
+ let cellsToDraw = cells;
8778
+ const image = _image.current;
8779
+ const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
8780
+ if (haveImageToRender) {
8781
+ if (calculatedImageSettings.excavation != null) {
8782
+ cellsToDraw = excavateModules(
8783
+ cells,
8784
+ calculatedImageSettings.excavation
8785
+ );
8786
+ }
8787
+ }
8788
+ const pixelRatio = window.devicePixelRatio || 1;
8789
+ canvas.height = canvas.width = size2 * pixelRatio;
8790
+ const scale = size2 / numCells * pixelRatio;
8791
+ ctx.scale(scale, scale);
8792
+ ctx.fillStyle = bgColor;
8793
+ ctx.fillRect(0, 0, numCells, numCells);
8794
+ ctx.fillStyle = fgColor;
8795
+ if (SUPPORTS_PATH2D) {
8796
+ ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));
8797
+ } else {
8798
+ cells.forEach(function(row, rdx) {
8799
+ row.forEach(function(cell, cdx) {
8800
+ if (cell) {
8801
+ ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
8802
+ }
8803
+ });
8804
+ });
8805
+ }
8806
+ if (calculatedImageSettings) {
8807
+ ctx.globalAlpha = calculatedImageSettings.opacity;
8808
+ }
8809
+ if (haveImageToRender) {
8810
+ ctx.drawImage(
8811
+ image,
8812
+ calculatedImageSettings.x + margin,
8813
+ calculatedImageSettings.y + margin,
8814
+ calculatedImageSettings.w,
8815
+ calculatedImageSettings.h
8816
+ );
8817
+ }
8818
+ }
8819
+ });
8820
+ react_default.useEffect(() => {
8821
+ setIsImageLoaded(false);
8822
+ }, [imgSrc]);
8823
+ const canvasStyle = __spreadValues({ height: size2, width: size2 }, style);
8824
+ let img = null;
8825
+ if (imgSrc != null) {
8826
+ img = react_default.createElement(
8827
+ "img",
8828
+ {
8829
+ src: imgSrc,
8830
+ key: imgSrc,
8831
+ style: { display: "none" },
8832
+ onLoad: /* @__PURE__ */ __name(() => {
8833
+ setIsImageLoaded(true);
8834
+ }, "onLoad"),
8835
+ ref: _image,
8836
+ crossOrigin: calculatedImageSettings == null ? void 0 : calculatedImageSettings.crossOrigin
8837
+ }
8838
+ );
8839
+ }
8840
+ return react_default.createElement(react_default.Fragment, null, react_default.createElement(
8841
+ "canvas",
8842
+ __spreadValues({
8843
+ style: canvasStyle,
8844
+ height: size2,
8845
+ width: size2,
8846
+ ref: setCanvasRef,
8847
+ role: "img"
8848
+ }, otherProps)
8849
+ ), img);
8850
+ }, "QRCodeCanvas2")
8851
+ );
8852
+ QRCodeCanvas.displayName = "QRCodeCanvas";
8853
+ var QRCodeSVG = react_default.forwardRef(
8854
+ /* @__PURE__ */ __name(function QRCodeSVG2(props, forwardedRef) {
8855
+ const _a = props, {
8856
+ value,
8857
+ size: size2 = DEFAULT_SIZE,
8858
+ level = DEFAULT_LEVEL,
8859
+ bgColor = DEFAULT_BGCOLOR,
8860
+ fgColor = DEFAULT_FGCOLOR,
8861
+ includeMargin = DEFAULT_INCLUDEMARGIN,
8862
+ minVersion = DEFAULT_MINVERSION,
8863
+ boostLevel,
8864
+ title,
8865
+ marginSize,
8866
+ imageSettings
8867
+ } = _a, otherProps = __objRest(_a, [
8868
+ "value",
8869
+ "size",
8870
+ "level",
8871
+ "bgColor",
8872
+ "fgColor",
8873
+ "includeMargin",
8874
+ "minVersion",
8875
+ "boostLevel",
8876
+ "title",
8877
+ "marginSize",
8878
+ "imageSettings"
8879
+ ]);
8880
+ const { margin, cells, numCells, calculatedImageSettings } = useQRCode({
8881
+ value,
8882
+ level,
8883
+ minVersion,
8884
+ boostLevel,
8885
+ includeMargin,
8886
+ marginSize,
8887
+ imageSettings,
8888
+ size: size2
8889
+ });
8890
+ let cellsToDraw = cells;
8891
+ let image = null;
8892
+ if (imageSettings != null && calculatedImageSettings != null) {
8893
+ if (calculatedImageSettings.excavation != null) {
8894
+ cellsToDraw = excavateModules(
8895
+ cells,
8896
+ calculatedImageSettings.excavation
8897
+ );
8898
+ }
8899
+ image = react_default.createElement(
8900
+ "image",
8901
+ {
8902
+ href: imageSettings.src,
8903
+ height: calculatedImageSettings.h,
8904
+ width: calculatedImageSettings.w,
8905
+ x: calculatedImageSettings.x + margin,
8906
+ y: calculatedImageSettings.y + margin,
8907
+ preserveAspectRatio: "none",
8908
+ opacity: calculatedImageSettings.opacity,
8909
+ crossOrigin: calculatedImageSettings.crossOrigin
8910
+ }
8911
+ );
8912
+ }
8913
+ const fgPath = generatePath(cellsToDraw, margin);
8914
+ return react_default.createElement(
8915
+ "svg",
8916
+ __spreadValues({
8917
+ height: size2,
8918
+ width: size2,
8919
+ viewBox: `0 0 ${numCells} ${numCells}`,
8920
+ ref: forwardedRef,
8921
+ role: "img"
8922
+ }, otherProps),
8923
+ !!title && react_default.createElement("title", null, title),
8924
+ react_default.createElement(
8925
+ "path",
8926
+ {
8927
+ fill: bgColor,
8928
+ d: `M0,0 h${numCells}v${numCells}H0z`,
8929
+ shapeRendering: "crispEdges"
8930
+ }
8931
+ ),
8932
+ react_default.createElement("path", { fill: fgColor, d: fgPath, shapeRendering: "crispEdges" }),
8933
+ image
8934
+ );
8935
+ }, "QRCodeSVG2")
8936
+ );
8937
+ QRCodeSVG.displayName = "QRCodeSVG";
8938
+
8939
+ // src/manager/container/Menu.tsx
8940
+ var focusableUIElements = {
8941
+ storySearchField: "storybook-explorer-searchfield",
8942
+ storyListMenu: "storybook-explorer-menu",
8943
+ storyPanelRoot: "storybook-panel-root"
8944
+ };
8945
+ var Key = styled.span(({ theme }) => ({
8946
+ display: "inline-block",
8947
+ height: 16,
8948
+ lineHeight: "16px",
8949
+ textAlign: "center",
8950
+ fontSize: "11px",
8951
+ background: theme.base === "light" ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
8952
+ color: theme.base === "light" ? theme.color.dark : theme.textMutedColor,
8953
+ borderRadius: 2,
8954
+ userSelect: "none",
8955
+ pointerEvents: "none",
8956
+ padding: "0 6px"
8957
+ }));
8958
+ var KeyChild = styled.code(({ theme }) => ({
8959
+ padding: 0,
8960
+ fontFamily: theme.typography.fonts.base,
8961
+ verticalAlign: "middle",
8962
+ "& + &": {
8963
+ marginLeft: 6
8964
+ }
8965
+ }));
8966
+ var Shortcut = /* @__PURE__ */ __name(({ keys: keys2 }) => react_default.createElement(Key, null, keys2.map((key) => react_default.createElement(KeyChild, { key }, shortcutToHumanString([key])))), "Shortcut");
8967
+ var useMenu = /* @__PURE__ */ __name((state, api, showToolbar, isFullscreen, isPanelShown, isNavShown, enableShortcuts) => {
8968
+ const shortcutKeys = api.getShortcutKeys();
8969
+ const about = useMemo(
8970
+ () => ({
8971
+ id: "about",
8972
+ title: "About your Storybook",
8973
+ onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("about"), "onClick"),
8974
+ icon: react_default.createElement(InfoIcon, null)
8975
+ }),
8976
+ [api]
8977
+ );
8978
+ const documentation = useMemo(() => {
8979
+ const docsUrl = api.getDocsUrl({ versioned: true, renderer: true });
8980
+ return {
8981
+ id: "documentation",
8982
+ title: "Documentation",
8983
+ href: docsUrl,
8984
+ icon: react_default.createElement(ShareAltIcon, null)
8985
+ };
8986
+ }, [api]);
8987
+ const whatsNewNotificationsEnabled = state.whatsNewData?.status === "SUCCESS" && !state.disableWhatsNewNotifications;
8988
+ const isWhatsNewUnread = api.isWhatsNewUnread();
8989
+ const whatsNew = useMemo(
8990
+ () => ({
8991
+ id: "whats-new",
8992
+ title: "What's new?",
8993
+ onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("whats-new"), "onClick"),
8994
+ right: whatsNewNotificationsEnabled && isWhatsNewUnread && react_default.createElement(Badge, { status: "positive" }, "Check it out"),
8995
+ icon: react_default.createElement(WandIcon, null)
8996
+ }),
8997
+ [api, whatsNewNotificationsEnabled, isWhatsNewUnread]
8998
+ );
8999
+ const shortcuts = useMemo(
9000
+ () => ({
9001
+ id: "shortcuts",
9002
+ title: "Keyboard shortcuts",
9003
+ onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("shortcuts"), "onClick"),
9004
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.shortcutsPage }) : null,
9005
+ icon: react_default.createElement(CommandIcon, null)
9006
+ }),
9007
+ [api, enableShortcuts, shortcutKeys.shortcutsPage]
9008
+ );
9009
+ const sidebarToggle = useMemo(
9010
+ () => ({
9011
+ id: "S",
9012
+ title: "Show sidebar",
9013
+ onClick: /* @__PURE__ */ __name(() => api.toggleNav(), "onClick"),
9014
+ active: isNavShown,
9015
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toggleNav }) : null,
9016
+ icon: isNavShown ? react_default.createElement(CheckIcon, null) : null
9017
+ }),
9018
+ [api, enableShortcuts, shortcutKeys, isNavShown]
9019
+ );
9020
+ const toolbarToogle = useMemo(
9021
+ () => ({
9022
+ id: "T",
9023
+ title: "Show toolbar",
9024
+ onClick: /* @__PURE__ */ __name(() => api.toggleToolbar(), "onClick"),
9025
+ active: showToolbar,
9026
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toolbar }) : null,
9027
+ icon: showToolbar ? react_default.createElement(CheckIcon, null) : null
9028
+ }),
9029
+ [api, enableShortcuts, shortcutKeys, showToolbar]
9030
+ );
9031
+ const addonsToggle = useMemo(
9032
+ () => ({
9033
+ id: "A",
9034
+ title: "Show addons panel",
9035
+ onClick: /* @__PURE__ */ __name(() => api.togglePanel(), "onClick"),
9036
+ active: isPanelShown,
9037
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.togglePanel }) : null,
9038
+ icon: isPanelShown ? react_default.createElement(CheckIcon, null) : null
9039
+ }),
9040
+ [api, enableShortcuts, shortcutKeys, isPanelShown]
9041
+ );
9042
+ const addonsOrientationToggle = useMemo(
9043
+ () => ({
9044
+ id: "D",
9045
+ title: "Change addons orientation",
9046
+ onClick: /* @__PURE__ */ __name(() => api.togglePanelPosition(), "onClick"),
9047
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.panelPosition }) : null
9048
+ }),
9049
+ [api, enableShortcuts, shortcutKeys]
9050
+ );
9051
+ const fullscreenToggle = useMemo(
9052
+ () => ({
9053
+ id: "F",
9054
+ title: "Go full screen",
9055
+ onClick: /* @__PURE__ */ __name(() => api.toggleFullscreen(), "onClick"),
9056
+ active: isFullscreen,
9057
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.fullScreen }) : null,
9058
+ icon: isFullscreen ? react_default.createElement(CheckIcon, null) : null
9059
+ }),
9060
+ [api, enableShortcuts, shortcutKeys, isFullscreen]
9061
+ );
9062
+ const searchToggle = useMemo(
9063
+ () => ({
9064
+ id: "/",
9065
+ title: "Search",
9066
+ onClick: /* @__PURE__ */ __name(() => api.focusOnUIElement(focusableUIElements.storySearchField), "onClick"),
9067
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.search }) : null
9068
+ }),
9069
+ [api, enableShortcuts, shortcutKeys]
9070
+ );
9071
+ const up = useMemo(
9072
+ () => ({
9073
+ id: "up",
9074
+ title: "Previous component",
9075
+ onClick: /* @__PURE__ */ __name(() => api.jumpToComponent(-1), "onClick"),
9076
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevComponent }) : null
9077
+ }),
9078
+ [api, enableShortcuts, shortcutKeys]
9079
+ );
9080
+ const down = useMemo(
9081
+ () => ({
9082
+ id: "down",
9083
+ title: "Next component",
9084
+ onClick: /* @__PURE__ */ __name(() => api.jumpToComponent(1), "onClick"),
9085
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextComponent }) : null
9086
+ }),
9087
+ [api, enableShortcuts, shortcutKeys]
9088
+ );
9089
+ const prev = useMemo(
9090
+ () => ({
9091
+ id: "prev",
9092
+ title: "Previous story",
9093
+ onClick: /* @__PURE__ */ __name(() => api.jumpToStory(-1), "onClick"),
9094
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevStory }) : null
9095
+ }),
9096
+ [api, enableShortcuts, shortcutKeys]
9097
+ );
9098
+ const next = useMemo(
9099
+ () => ({
9100
+ id: "next",
9101
+ title: "Next story",
9102
+ onClick: /* @__PURE__ */ __name(() => api.jumpToStory(1), "onClick"),
9103
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextStory }) : null
9104
+ }),
9105
+ [api, enableShortcuts, shortcutKeys]
9106
+ );
9107
+ const collapse = useMemo(
9108
+ () => ({
9109
+ id: "collapse",
9110
+ title: "Collapse all",
9111
+ onClick: /* @__PURE__ */ __name(() => api.emit(STORIES_COLLAPSE_ALL), "onClick"),
9112
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.collapseAll }) : null
9113
+ }),
9114
+ [api, enableShortcuts, shortcutKeys]
9115
+ );
9116
+ const getAddonsShortcuts = useCallback(() => {
9117
+ const addonsShortcuts = api.getAddonsShortcuts();
9118
+ const keys2 = shortcutKeys;
9119
+ return Object.entries(addonsShortcuts).filter(([_2, { showInMenu }]) => showInMenu).map(([actionName, { label, action }]) => ({
9120
+ id: actionName,
9121
+ title: label,
9122
+ onClick: /* @__PURE__ */ __name(() => action(), "onClick"),
9123
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: keys2[actionName] }) : null
9124
+ }));
9125
+ }, [api, enableShortcuts, shortcutKeys]);
9126
+ return useMemo(
9127
+ () => [
9128
+ [
9129
+ about,
9130
+ ...state.whatsNewData?.status === "SUCCESS" ? [whatsNew] : [],
9131
+ documentation,
9132
+ ...enableShortcuts ? [shortcuts] : []
9133
+ ],
9134
+ [
9135
+ sidebarToggle,
9136
+ toolbarToogle,
9137
+ addonsToggle,
9138
+ addonsOrientationToggle,
9139
+ fullscreenToggle,
9140
+ searchToggle,
9141
+ up,
9142
+ down,
9143
+ prev,
9144
+ next,
9145
+ collapse
9146
+ ],
9147
+ getAddonsShortcuts()
9148
+ ],
9149
+ [
9150
+ about,
9151
+ state,
9152
+ whatsNew,
9153
+ documentation,
9154
+ shortcuts,
9155
+ sidebarToggle,
9156
+ toolbarToogle,
9157
+ addonsToggle,
9158
+ addonsOrientationToggle,
9159
+ fullscreenToggle,
9160
+ searchToggle,
9161
+ up,
9162
+ down,
9163
+ prev,
9164
+ next,
9165
+ collapse,
9166
+ getAddonsShortcuts,
9167
+ enableShortcuts
9168
+ ]
9169
+ );
9170
+ }, "useMenu");
9171
+
9172
+ // src/manager/components/preview/tools/share.tsx
9173
+ var { PREVIEW_URL, document: document2 } = scope;
9174
+ var mapper3 = /* @__PURE__ */ __name(({ state }) => {
9175
+ const { storyId, refId, refs } = state;
9176
+ const { location } = document2;
9177
+ const ref = refs[refId];
9178
+ let baseUrl = `${location.origin}${location.pathname}`;
9179
+ if (!baseUrl.endsWith("/")) {
9180
+ baseUrl += "/";
9181
+ }
9182
+ return {
9183
+ refId,
9184
+ baseUrl: ref ? `${ref.url}/iframe.html` : PREVIEW_URL || `${baseUrl}iframe.html`,
9185
+ storyId,
9186
+ queryParams: state.customQueryParams
9187
+ };
9188
+ }, "mapper");
9189
+ var QRContainer = styled.div(() => ({
9190
+ display: "flex",
9191
+ alignItems: "center",
9192
+ padding: 8,
9193
+ maxWidth: 200
9194
+ }));
9195
+ var QRImageContainer = styled.div(() => ({
9196
+ width: 64,
9197
+ height: 64,
9198
+ marginRight: 12,
9199
+ backgroundColor: "white",
9200
+ padding: 2
9201
+ }));
9202
+ var QRImage = /* @__PURE__ */ __name(({ value }) => {
9203
+ const theme = useTheme();
9204
+ return react_default.createElement(QRImageContainer, null, react_default.createElement(QRCodeSVG, { value, marginSize: 0, size: 60, fgColor: theme.color.darkest }));
9205
+ }, "QRImage");
9206
+ var QRContent = styled.div(() => ({}));
9207
+ var QRTitle = styled.div(({ theme }) => ({
9208
+ fontWeight: theme.typography.weight.bold,
9209
+ fontSize: theme.typography.size.s1,
9210
+ marginBottom: 4
9211
+ }));
9212
+ var QRDescription = styled.div(({ theme }) => ({
9213
+ fontSize: theme.typography.size.s1,
9214
+ color: theme.textMutedColor
9215
+ }));
9216
+ function ShareMenu({
9217
+ baseUrl,
9218
+ storyId,
9219
+ queryParams,
9220
+ qrUrl
9221
+ }) {
9222
+ const api = useStorybookApi();
9223
+ const shortcutKeys = api.getShortcutKeys();
9224
+ const enableShortcuts = !!shortcutKeys;
9225
+ const [copied, setCopied] = useState(false);
9226
+ const copyStoryLink = shortcutKeys?.copyStoryLink;
9227
+ const links = useMemo(() => {
9228
+ const copyTitle = copied ? "Copied!" : "Copy story link";
9229
+ const baseLinks = [
9230
+ [
9231
+ {
9232
+ id: "copy-link",
9233
+ title: copyTitle,
9234
+ icon: react_default.createElement(LinkIcon, null),
9235
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: copyStoryLink }) : null,
9236
+ onClick: /* @__PURE__ */ __name(() => {
9237
+ (0, import_copy_to_clipboard.default)(window.location.href);
9238
+ setCopied(true);
9239
+ setTimeout(() => setCopied(false), 2e3);
9240
+ }, "onClick")
9241
+ },
9242
+ {
9243
+ id: "open-new-tab",
9244
+ title: "Open in isolation mode",
9245
+ icon: react_default.createElement(BugIcon, null),
9246
+ onClick: /* @__PURE__ */ __name(() => {
9247
+ const href = getStoryHref(baseUrl, storyId, queryParams);
9248
+ window.open(href, "_blank", "noopener,noreferrer");
9249
+ }, "onClick")
9250
+ }
9251
+ ]
9252
+ ];
9253
+ baseLinks.push([
9254
+ {
9255
+ id: "qr-section",
9256
+ // @ts-expect-error (non strict)
9257
+ content: react_default.createElement(QRContainer, null, react_default.createElement(QRImage, { value: qrUrl }), react_default.createElement(QRContent, null, react_default.createElement(QRTitle, null, "Scan me"), react_default.createElement(QRDescription, null, "Must be on the same network as this device.")))
9258
+ }
9259
+ ]);
9260
+ return baseLinks;
9261
+ }, [baseUrl, storyId, queryParams, copied, qrUrl, enableShortcuts, copyStoryLink]);
9262
+ return react_default.createElement(TooltipLinkList, { links });
9263
+ }
9264
+ __name(ShareMenu, "ShareMenu");
9265
+ var shareTool = {
9266
+ title: "share",
9267
+ id: "share",
9268
+ type: types.TOOL,
9269
+ match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
9270
+ render: /* @__PURE__ */ __name(() => {
9271
+ return react_default.createElement(Consumer, { filter: mapper3 }, ({ baseUrl, storyId, queryParams }) => {
9272
+ const storyUrl = scope.STORYBOOK_NETWORK_ADDRESS ? `${scope.STORYBOOK_NETWORK_ADDRESS}${window.location.search}` : window.location.href;
9273
+ return storyId ? react_default.createElement(
9274
+ WithTooltip,
9275
+ {
9276
+ hasChrome: true,
9277
+ placement: "bottom",
9278
+ tooltip: react_default.createElement(ShareMenu, { ...{ baseUrl, storyId, queryParams, qrUrl: storyUrl } })
9279
+ },
9280
+ react_default.createElement(IconButton, { title: "Share" }, react_default.createElement(ShareIcon, null))
9281
+ ) : null;
9282
+ });
9283
+ }, "render")
7844
9284
  };
7845
9285
 
7846
9286
  // src/manager/container/Preview.tsx
7847
9287
  var defaultTabs = [createCanvasTab()];
7848
9288
  var defaultTools = [menuTool, remountTool, zoomTool];
7849
- var defaultToolsExtra = [addonsTool, fullScreenTool, ejectTool, copyTool];
9289
+ var defaultToolsExtra = [addonsTool, fullScreenTool, shareTool, openInEditorTool];
7850
9290
  var emptyTabsList = [];
7851
9291
  var memoizedTabs = (0, import_memoizerific.default)(1)(
7852
9292
  (_2, tabElements, parameters, showTabs) => showTabs ? filterTabs([...defaultTabs, ...Object.values(tabElements)], parameters) : emptyTabsList
@@ -7861,7 +9301,7 @@ var memoizedWrapper = (0, import_memoizerific.default)(1)((_2, previewElements)
7861
9301
  ...defaultWrappers,
7862
9302
  ...Object.values(previewElements)
7863
9303
  ]);
7864
- var { PREVIEW_URL: PREVIEW_URL3 } = scope;
9304
+ var { PREVIEW_URL: PREVIEW_URL2 } = scope;
7865
9305
  var splitTitleAddExtraSpace = /* @__PURE__ */ __name((input) => input.split("/").join(" / ").replace(/\s\s/, " "), "splitTitleAddExtraSpace");
7866
9306
  var getDescription = /* @__PURE__ */ __name((item) => {
7867
9307
  if (item?.type === "story" || item?.type === "docs") {
@@ -7870,7 +9310,7 @@ var getDescription = /* @__PURE__ */ __name((item) => {
7870
9310
  }
7871
9311
  return item?.name ? `${item.name} \u22C5 Storybook` : "Storybook";
7872
9312
  }, "getDescription");
7873
- var mapper2 = /* @__PURE__ */ __name(({
9313
+ var mapper4 = /* @__PURE__ */ __name(({
7874
9314
  api,
7875
9315
  state
7876
9316
  // @ts-expect-error (non strict)
@@ -7904,7 +9344,7 @@ var mapper2 = /* @__PURE__ */ __name(({
7904
9344
  viewMode,
7905
9345
  refs,
7906
9346
  storyId,
7907
- baseUrl: PREVIEW_URL3 || "iframe.html",
9347
+ baseUrl: PREVIEW_URL2 || "iframe.html",
7908
9348
  queryParams: customQueryParams,
7909
9349
  tools,
7910
9350
  toolsExtra,
@@ -7922,7 +9362,7 @@ var mapper2 = /* @__PURE__ */ __name(({
7922
9362
  };
7923
9363
  }, "mapper");
7924
9364
  var PreviewConnected = react_default.memo(/* @__PURE__ */ __name(function PreviewConnected2(props) {
7925
- return react_default.createElement(Consumer, { filter: mapper2 }, (fromState) => react_default.createElement(Preview, { ...props, ...fromState }));
9365
+ return react_default.createElement(Consumer, { filter: mapper4 }, (fromState) => react_default.createElement(Preview, { ...props, ...fromState }));
7926
9366
  }, "PreviewConnected"));
7927
9367
  var Preview_default = PreviewConnected;
7928
9368
 
@@ -10365,6 +11805,9 @@ function getGroupStatus(collapsedData, allStatuses) {
10365
11805
  }
10366
11806
  __name(getGroupStatus, "getGroupStatus");
10367
11807
 
11808
+ // src/manager/components/sidebar/ContextMenu.tsx
11809
+ var import_copy_to_clipboard2 = __toESM(require_copy_to_clipboard(), 1);
11810
+
10368
11811
  // src/manager/components/sidebar/StatusButton.tsx
10369
11812
  var withStatusColor = /* @__PURE__ */ __name(({ theme, status }) => {
10370
11813
  const defaultColor = theme.base === "light" ? curriedTransparentize$1(0.3, theme.color.defaultText) : curriedTransparentize$1(0.6, theme.color.defaultText);
@@ -10435,6 +11878,47 @@ var FloatingStatusButton = styled(StatusButton)({
10435
11878
  var useContextMenu = /* @__PURE__ */ __name((context, links, api) => {
10436
11879
  const [hoverCount, setHoverCount] = useState(0);
10437
11880
  const [isOpen, setIsOpen] = useState(false);
11881
+ const [copyText, setCopyText] = react_default.useState("Copy story name");
11882
+ const shortcutKeys = api.getShortcutKeys();
11883
+ const enableShortcuts = !!shortcutKeys;
11884
+ const topLinks = useMemo(() => {
11885
+ const defaultLinks = [];
11886
+ if (context && "importPath" in context) {
11887
+ defaultLinks.push({
11888
+ id: "open-in-editor",
11889
+ title: "Open in editor",
11890
+ icon: react_default.createElement(EditorIcon, null),
11891
+ right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.openInEditor }) : null,
11892
+ onClick: /* @__PURE__ */ __name((e2) => {
11893
+ e2.preventDefault();
11894
+ api.openInEditor({
11895
+ file: context.importPath
11896
+ });
11897
+ }, "onClick")
11898
+ });
11899
+ }
11900
+ if (context.type === "story") {
11901
+ defaultLinks.push({
11902
+ id: "copy-story-name",
11903
+ title: copyText,
11904
+ icon: react_default.createElement(CopyIcon, null),
11905
+ // TODO: bring this back once we want to add shortcuts for this
11906
+ // right:
11907
+ // enableShortcuts && shortcutKeys.copyStoryName ? (
11908
+ // <Shortcut keys={shortcutKeys.copyStoryName} />
11909
+ // ) : null,
11910
+ onClick: /* @__PURE__ */ __name((e2) => {
11911
+ e2.preventDefault();
11912
+ (0, import_copy_to_clipboard2.default)(context.exportName);
11913
+ setCopyText("Copied!");
11914
+ setTimeout(() => {
11915
+ setCopyText("Copy story name");
11916
+ }, 2e3);
11917
+ }, "onClick")
11918
+ });
11919
+ }
11920
+ return defaultLinks;
11921
+ }, [context, copyText, enableShortcuts, shortcutKeys]);
10438
11922
  const handlers = useMemo(() => {
10439
11923
  return {
10440
11924
  onMouseEnter: /* @__PURE__ */ __name(() => {
@@ -10456,14 +11940,14 @@ var useContextMenu = /* @__PURE__ */ __name((context, links, api) => {
10456
11940
  }
10457
11941
  return [];
10458
11942
  }, [api, context, hoverCount]);
10459
- const isRendered = providerLinks.length > 0 || links.length > 0;
11943
+ const shouldRender = !context.refId && (providerLinks.length > 0 || links.length > 0 || topLinks.length > 0);
10460
11944
  return useMemo(() => {
10461
11945
  if (globalThis.CONFIG_TYPE !== "DEVELOPMENT") {
10462
11946
  return empty;
10463
11947
  }
10464
11948
  return {
10465
11949
  onMouseEnter: handlers.onMouseEnter,
10466
- node: isRendered ? react_default.createElement(
11950
+ node: shouldRender ? react_default.createElement(
10467
11951
  PositionedWithTooltip,
10468
11952
  {
10469
11953
  "data-displayed": isOpen ? "on" : "off",
@@ -10477,12 +11961,12 @@ var useContextMenu = /* @__PURE__ */ __name((context, links, api) => {
10477
11961
  setIsOpen(true);
10478
11962
  }
10479
11963
  },
10480
- tooltip: react_default.createElement(LiveContextMenu, { context, links })
11964
+ tooltip: react_default.createElement(LiveContextMenu, { context, links: [...topLinks, ...links] })
10481
11965
  },
10482
11966
  react_default.createElement(FloatingStatusButton, { type: "button", status: "status-value:pending" }, react_default.createElement(EllipsisIcon, null))
10483
11967
  ) : null
10484
11968
  };
10485
- }, [context, handlers, isOpen, isRendered, links]);
11969
+ }, [context, handlers, isOpen, shouldRender, links, topLinks]);
10486
11970
  }, "useContextMenu");
10487
11971
  var LiveContextMenu = /* @__PURE__ */ __name(({
10488
11972
  context,
@@ -10493,7 +11977,7 @@ var LiveContextMenu = /* @__PURE__ */ __name(({
10493
11977
  Addon_TypesEnum.experimental_TEST_PROVIDER
10494
11978
  );
10495
11979
  const providerLinks = generateTestProviderLinks(registeredTestProviders, context);
10496
- const groups = Array.isArray(links[0]) ? links : [links];
11980
+ const groups = Array.isArray(links[0]) || links.length === 0 ? links : [links];
10497
11981
  const all = groups.concat([providerLinks]);
10498
11982
  return react_default.createElement(TooltipLinkList, { ...rest3, links: all });
10499
11983
  }, "LiveContextMenu");
@@ -11988,8 +13472,8 @@ var SidebarMenu = /* @__PURE__ */ __name(({ menu, isHighlighted, onClick }) => {
11988
13472
  react_default.createElement(
11989
13473
  SidebarIconButton,
11990
13474
  {
11991
- title: "Shortcuts",
11992
- "aria-label": "Shortcuts",
13475
+ title: "Settings",
13476
+ "aria-label": "Settings",
11993
13477
  highlighted: !!isHighlighted,
11994
13478
  active: isTooltipVisible,
11995
13479
  size: "medium",
@@ -15288,6 +16772,7 @@ var FocusKey = styled.code(({ theme }) => ({
15288
16772
  margin: 5,
15289
16773
  marginTop: 6,
15290
16774
  height: 16,
16775
+ fontFamily: theme.typography.fonts.base,
15291
16776
  lineHeight: "16px",
15292
16777
  textAlign: "center",
15293
16778
  fontSize: "11px",
@@ -17322,11 +18807,11 @@ function countBy(collection, iteratee$1) {
17322
18807
  return {};
17323
18808
  }
17324
18809
  const array = isArrayLike(collection) ? Array.from(collection) : Object.values(collection);
17325
- const mapper3 = iteratee(iteratee$1 ?? void 0);
18810
+ const mapper5 = iteratee(iteratee$1 ?? void 0);
17326
18811
  const result2 = /* @__PURE__ */ Object.create(null);
17327
18812
  for (let i2 = 0; i2 < array.length; i2++) {
17328
18813
  const item = array[i2];
17329
- const key = mapper3(item);
18814
+ const key = mapper5(item);
17330
18815
  result2[key] = (result2[key] ?? 0) + 1;
17331
18816
  }
17332
18817
  return result2;
@@ -17385,10 +18870,10 @@ function last2(array) {
17385
18870
  __name(last2, "last");
17386
18871
 
17387
18872
  // ../node_modules/es-toolkit/dist/array/differenceBy.mjs
17388
- function differenceBy(firstArr, secondArr, mapper3) {
17389
- const mappedSecondSet = new Set(secondArr.map((item) => mapper3(item)));
18873
+ function differenceBy(firstArr, secondArr, mapper5) {
18874
+ const mappedSecondSet = new Set(secondArr.map((item) => mapper5(item)));
17390
18875
  return firstArr.filter((item) => {
17391
- return !mappedSecondSet.has(mapper3(item));
18876
+ return !mappedSecondSet.has(mapper5(item));
17392
18877
  });
17393
18878
  }
17394
18879
  __name(differenceBy, "differenceBy");
@@ -18151,9 +19636,9 @@ function intersection2(...arrays) {
18151
19636
  __name(intersection2, "intersection");
18152
19637
 
18153
19638
  // ../node_modules/es-toolkit/dist/array/intersectionBy.mjs
18154
- function intersectionBy(firstArr, secondArr, mapper3) {
18155
- const mappedSecondSet = new Set(secondArr.map(mapper3));
18156
- return firstArr.filter((item) => mappedSecondSet.has(mapper3(item)));
19639
+ function intersectionBy(firstArr, secondArr, mapper5) {
19640
+ const mappedSecondSet = new Set(secondArr.map(mapper5));
19641
+ return firstArr.filter((item) => mappedSecondSet.has(mapper5(item)));
18157
19642
  }
18158
19643
  __name(intersectionBy, "intersectionBy");
18159
19644
 
@@ -19353,11 +20838,11 @@ function union(...arrays) {
19353
20838
  __name(union, "union");
19354
20839
 
19355
20840
  // ../node_modules/es-toolkit/dist/array/uniqBy.mjs
19356
- function uniqBy(arr, mapper3) {
20841
+ function uniqBy(arr, mapper5) {
19357
20842
  const map2 = /* @__PURE__ */ new Map();
19358
20843
  for (let i2 = 0; i2 < arr.length; i2++) {
19359
20844
  const item = arr[i2];
19360
- const key = mapper3(item);
20845
+ const key = mapper5(item);
19361
20846
  if (!map2.has(key)) {
19362
20847
  map2.set(key, item);
19363
20848
  }
@@ -19530,15 +21015,15 @@ __name(windowed, "windowed");
19530
21015
  // ../node_modules/es-toolkit/dist/compat/array/xorBy.mjs
19531
21016
  function xorBy(...values3) {
19532
21017
  const lastValue = last2(values3);
19533
- let mapper3 = identity;
21018
+ let mapper5 = identity;
19534
21019
  if (!isArrayLikeObject(lastValue) && lastValue != null) {
19535
- mapper3 = iteratee(lastValue);
21020
+ mapper5 = iteratee(lastValue);
19536
21021
  values3 = values3.slice(0, -1);
19537
21022
  }
19538
21023
  const arrays = values3.filter(isArrayLikeObject);
19539
- const union2 = unionBy(...arrays, mapper3);
19540
- const intersections = windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy2(arr1, arr2, mapper3));
19541
- return differenceBy2(union2, unionBy(...intersections, mapper3), mapper3);
21024
+ const union2 = unionBy(...arrays, mapper5);
21025
+ const intersections = windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy2(arr1, arr2, mapper5));
21026
+ return differenceBy2(union2, unionBy(...intersections, mapper5), mapper5);
19542
21027
  }
19543
21028
  __name(xorBy, "xorBy");
19544
21029
 
@@ -23639,241 +25124,9 @@ var Sidebar = react_default.memo(/* @__PURE__ */ __name(function Sidebar2({
23639
25124
  )), isMobile || isLoading ? null : react_default.createElement(SidebarBottom, { isDevelopment })));
23640
25125
  }, "Sidebar"));
23641
25126
 
23642
- // src/manager/container/Menu.tsx
23643
- var focusableUIElements = {
23644
- storySearchField: "storybook-explorer-searchfield",
23645
- storyListMenu: "storybook-explorer-menu",
23646
- storyPanelRoot: "storybook-panel-root"
23647
- };
23648
- var Key = styled.span(({ theme }) => ({
23649
- display: "inline-block",
23650
- height: 16,
23651
- lineHeight: "16px",
23652
- textAlign: "center",
23653
- fontSize: "11px",
23654
- background: theme.base === "light" ? "rgba(0,0,0,0.05)" : "rgba(255,255,255,0.05)",
23655
- color: theme.base === "light" ? theme.color.dark : theme.textMutedColor,
23656
- borderRadius: 2,
23657
- userSelect: "none",
23658
- pointerEvents: "none",
23659
- padding: "0 6px"
23660
- }));
23661
- var KeyChild = styled.code({
23662
- padding: 0,
23663
- verticalAlign: "middle",
23664
- "& + &": {
23665
- marginLeft: 6
23666
- }
23667
- });
23668
- var Shortcut = /* @__PURE__ */ __name(({ keys: keys2 }) => react_default.createElement(Key, null, keys2.map((key) => react_default.createElement(KeyChild, { key }, shortcutToHumanString([key])))), "Shortcut");
23669
- var useMenu = /* @__PURE__ */ __name((state, api, showToolbar, isFullscreen, isPanelShown, isNavShown, enableShortcuts) => {
23670
- const shortcutKeys = api.getShortcutKeys();
23671
- const about = useMemo(
23672
- () => ({
23673
- id: "about",
23674
- title: "About your Storybook",
23675
- onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("about"), "onClick"),
23676
- icon: react_default.createElement(InfoIcon, null)
23677
- }),
23678
- [api]
23679
- );
23680
- const documentation = useMemo(() => {
23681
- const docsUrl = api.getDocsUrl({ versioned: true, renderer: true });
23682
- return {
23683
- id: "documentation",
23684
- title: "Documentation",
23685
- href: docsUrl,
23686
- icon: react_default.createElement(ShareAltIcon, null)
23687
- };
23688
- }, [api]);
23689
- const whatsNewNotificationsEnabled = state.whatsNewData?.status === "SUCCESS" && !state.disableWhatsNewNotifications;
23690
- const isWhatsNewUnread = api.isWhatsNewUnread();
23691
- const whatsNew = useMemo(
23692
- () => ({
23693
- id: "whats-new",
23694
- title: "What's new?",
23695
- onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("whats-new"), "onClick"),
23696
- right: whatsNewNotificationsEnabled && isWhatsNewUnread && react_default.createElement(Badge, { status: "positive" }, "Check it out"),
23697
- icon: react_default.createElement(WandIcon, null)
23698
- }),
23699
- [api, whatsNewNotificationsEnabled, isWhatsNewUnread]
23700
- );
23701
- const shortcuts = useMemo(
23702
- () => ({
23703
- id: "shortcuts",
23704
- title: "Keyboard shortcuts",
23705
- onClick: /* @__PURE__ */ __name(() => api.changeSettingsTab("shortcuts"), "onClick"),
23706
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.shortcutsPage }) : null,
23707
- icon: react_default.createElement(CommandIcon, null)
23708
- }),
23709
- [api, enableShortcuts, shortcutKeys.shortcutsPage]
23710
- );
23711
- const sidebarToggle = useMemo(
23712
- () => ({
23713
- id: "S",
23714
- title: "Show sidebar",
23715
- onClick: /* @__PURE__ */ __name(() => api.toggleNav(), "onClick"),
23716
- active: isNavShown,
23717
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toggleNav }) : null,
23718
- icon: isNavShown ? react_default.createElement(CheckIcon, null) : null
23719
- }),
23720
- [api, enableShortcuts, shortcutKeys, isNavShown]
23721
- );
23722
- const toolbarToogle = useMemo(
23723
- () => ({
23724
- id: "T",
23725
- title: "Show toolbar",
23726
- onClick: /* @__PURE__ */ __name(() => api.toggleToolbar(), "onClick"),
23727
- active: showToolbar,
23728
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.toolbar }) : null,
23729
- icon: showToolbar ? react_default.createElement(CheckIcon, null) : null
23730
- }),
23731
- [api, enableShortcuts, shortcutKeys, showToolbar]
23732
- );
23733
- const addonsToggle = useMemo(
23734
- () => ({
23735
- id: "A",
23736
- title: "Show addons panel",
23737
- onClick: /* @__PURE__ */ __name(() => api.togglePanel(), "onClick"),
23738
- active: isPanelShown,
23739
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.togglePanel }) : null,
23740
- icon: isPanelShown ? react_default.createElement(CheckIcon, null) : null
23741
- }),
23742
- [api, enableShortcuts, shortcutKeys, isPanelShown]
23743
- );
23744
- const addonsOrientationToggle = useMemo(
23745
- () => ({
23746
- id: "D",
23747
- title: "Change addons orientation",
23748
- onClick: /* @__PURE__ */ __name(() => api.togglePanelPosition(), "onClick"),
23749
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.panelPosition }) : null
23750
- }),
23751
- [api, enableShortcuts, shortcutKeys]
23752
- );
23753
- const fullscreenToggle = useMemo(
23754
- () => ({
23755
- id: "F",
23756
- title: "Go full screen",
23757
- onClick: /* @__PURE__ */ __name(() => api.toggleFullscreen(), "onClick"),
23758
- active: isFullscreen,
23759
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.fullScreen }) : null,
23760
- icon: isFullscreen ? react_default.createElement(CheckIcon, null) : null
23761
- }),
23762
- [api, enableShortcuts, shortcutKeys, isFullscreen]
23763
- );
23764
- const searchToggle = useMemo(
23765
- () => ({
23766
- id: "/",
23767
- title: "Search",
23768
- onClick: /* @__PURE__ */ __name(() => api.focusOnUIElement(focusableUIElements.storySearchField), "onClick"),
23769
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.search }) : null
23770
- }),
23771
- [api, enableShortcuts, shortcutKeys]
23772
- );
23773
- const up = useMemo(
23774
- () => ({
23775
- id: "up",
23776
- title: "Previous component",
23777
- onClick: /* @__PURE__ */ __name(() => api.jumpToComponent(-1), "onClick"),
23778
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevComponent }) : null
23779
- }),
23780
- [api, enableShortcuts, shortcutKeys]
23781
- );
23782
- const down = useMemo(
23783
- () => ({
23784
- id: "down",
23785
- title: "Next component",
23786
- onClick: /* @__PURE__ */ __name(() => api.jumpToComponent(1), "onClick"),
23787
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextComponent }) : null
23788
- }),
23789
- [api, enableShortcuts, shortcutKeys]
23790
- );
23791
- const prev = useMemo(
23792
- () => ({
23793
- id: "prev",
23794
- title: "Previous story",
23795
- onClick: /* @__PURE__ */ __name(() => api.jumpToStory(-1), "onClick"),
23796
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.prevStory }) : null
23797
- }),
23798
- [api, enableShortcuts, shortcutKeys]
23799
- );
23800
- const next = useMemo(
23801
- () => ({
23802
- id: "next",
23803
- title: "Next story",
23804
- onClick: /* @__PURE__ */ __name(() => api.jumpToStory(1), "onClick"),
23805
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.nextStory }) : null
23806
- }),
23807
- [api, enableShortcuts, shortcutKeys]
23808
- );
23809
- const collapse = useMemo(
23810
- () => ({
23811
- id: "collapse",
23812
- title: "Collapse all",
23813
- onClick: /* @__PURE__ */ __name(() => api.emit(STORIES_COLLAPSE_ALL), "onClick"),
23814
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: shortcutKeys.collapseAll }) : null
23815
- }),
23816
- [api, enableShortcuts, shortcutKeys]
23817
- );
23818
- const getAddonsShortcuts = useCallback(() => {
23819
- const addonsShortcuts = api.getAddonsShortcuts();
23820
- const keys2 = shortcutKeys;
23821
- return Object.entries(addonsShortcuts).filter(([_2, { showInMenu }]) => showInMenu).map(([actionName, { label, action }]) => ({
23822
- id: actionName,
23823
- title: label,
23824
- onClick: /* @__PURE__ */ __name(() => action(), "onClick"),
23825
- right: enableShortcuts ? react_default.createElement(Shortcut, { keys: keys2[actionName] }) : null
23826
- }));
23827
- }, [api, enableShortcuts, shortcutKeys]);
23828
- return useMemo(
23829
- () => [
23830
- [
23831
- about,
23832
- ...state.whatsNewData?.status === "SUCCESS" ? [whatsNew] : [],
23833
- documentation,
23834
- ...enableShortcuts ? [shortcuts] : []
23835
- ],
23836
- [
23837
- sidebarToggle,
23838
- toolbarToogle,
23839
- addonsToggle,
23840
- addonsOrientationToggle,
23841
- fullscreenToggle,
23842
- searchToggle,
23843
- up,
23844
- down,
23845
- prev,
23846
- next,
23847
- collapse
23848
- ],
23849
- getAddonsShortcuts()
23850
- ],
23851
- [
23852
- about,
23853
- state,
23854
- whatsNew,
23855
- documentation,
23856
- shortcuts,
23857
- sidebarToggle,
23858
- toolbarToogle,
23859
- addonsToggle,
23860
- addonsOrientationToggle,
23861
- fullscreenToggle,
23862
- searchToggle,
23863
- up,
23864
- down,
23865
- prev,
23866
- next,
23867
- collapse,
23868
- getAddonsShortcuts,
23869
- enableShortcuts
23870
- ]
23871
- );
23872
- }, "useMenu");
23873
-
23874
25127
  // src/manager/container/Sidebar.tsx
23875
25128
  var Sidebar3 = react_default.memo(/* @__PURE__ */ __name(function Sideber({ onMenuClick }) {
23876
- const mapper3 = /* @__PURE__ */ __name(({ state, api }) => {
25129
+ const mapper5 = /* @__PURE__ */ __name(({ state, api }) => {
23877
25130
  const {
23878
25131
  ui: { name, url, enableShortcuts },
23879
25132
  viewMode,
@@ -23914,7 +25167,7 @@ var Sidebar3 = react_default.memo(/* @__PURE__ */ __name(function Sideber({ onMe
23914
25167
  enableShortcuts
23915
25168
  };
23916
25169
  }, "mapper");
23917
- return react_default.createElement(Consumer, { filter: mapper3 }, (fromState) => {
25170
+ return react_default.createElement(Consumer, { filter: mapper5 }, (fromState) => {
23918
25171
  const allStatuses = experimental_useStatusStore();
23919
25172
  return react_default.createElement(Sidebar, { ...fromState, allStatuses, onMenuClick });
23920
25173
  });
@@ -24145,7 +25398,11 @@ var shortcutLabels = {
24145
25398
  aboutPage: "Go to about page",
24146
25399
  collapseAll: "Collapse all items on sidebar",
24147
25400
  expandAll: "Expand all items on sidebar",
24148
- remount: "Remount component"
25401
+ remount: "Remount component",
25402
+ openInEditor: "Open story in editor",
25403
+ copyStoryLink: "Copy story link to clipboard"
25404
+ // TODO: bring this back once we want to add shortcuts for this
25405
+ // copyStoryName: 'Copy story name to clipboard',
24149
25406
  };
24150
25407
  var fixedShortcuts = ["escape"];
24151
25408
  function toShortcutState(shortcutKeys) {
@@ -24168,11 +25425,14 @@ var _ShortcutsScreen = class _ShortcutsScreen extends Component {
24168
25425
  if (!shortcut) {
24169
25426
  return false;
24170
25427
  }
25428
+ const normalizedShortcut = shortcut.map(
25429
+ (key) => Array.isArray(key) ? key.at(-1) : key
25430
+ );
24171
25431
  const error = !!Object.entries(shortcutKeys).find(
24172
- ([feature, { shortcut: existingShortcut }]) => feature !== activeFeature && existingShortcut && shortcutMatchesShortcut(shortcut, existingShortcut)
25432
+ ([feature, { shortcut: existingShortcut }]) => feature !== activeFeature && existingShortcut && shortcutMatchesShortcut(normalizedShortcut, existingShortcut)
24173
25433
  );
24174
25434
  return this.setState({
24175
- shortcutKeys: { ...shortcutKeys, [activeFeature]: { shortcut, error } }
25435
+ shortcutKeys: { ...shortcutKeys, [activeFeature]: { shortcut: normalizedShortcut, error } }
24176
25436
  });
24177
25437
  }, "onKeyDown");
24178
25438
  this.onFocus = /* @__PURE__ */ __name((focusedInput) => () => {