/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@udecode/react-hotkeys@52.0.11/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{c}from"react-compiler-runtime";import React,{createContext,useCallback,useContext,useEffect,useLayoutEffect,useMemo,useRef,useState}from"react";const BoundHotkeysProxyProvider=createContext(void 0),useBoundHotkeysProxy=()=>useContext(BoundHotkeysProxyProvider);function BoundHotkeysProxyProviderProvider(e){const o=c(6),{addHotkey:t,children:a,removeHotkey:r}=e;let n,i;return o[0]!==t||o[1]!==r?(n={addHotkey:t,removeHotkey:r},o[0]=t,o[1]=r,o[2]=n):n=o[2],o[3]!==a||o[4]!==n?(i=React.createElement(BoundHotkeysProxyProvider.Provider,{value:n},a),o[3]=a,o[4]=n,o[5]=i):i=o[5],i}function deepEqual(e,o){return e&&o&&"object"==typeof e&&"object"==typeof o?Object.keys(e).length===Object.keys(o).length&&Object.keys(e).reduce(((t,a)=>t&&deepEqual(e[a],o[a])),!0):e===o}const HotkeysContext=createContext({activeScopes:[],hotkeys:[],disableScope:()=>{},enableScope:()=>{},toggleScope:()=>{}}),useHotkeysContext=()=>useContext(HotkeysContext),HotkeysProvider=e=>{const o=c(16),{children:t,initiallyActiveScopes:a}=e;let r;o[0]!==a?(r=void 0===a?["*"]:a,o[0]=a,o[1]=r):r=o[1];const[n,i]=useState(r);let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],o[2]=s):s=o[2];const[l,u]=useState(s);let d;o[3]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{i((o=>o.includes("*")?[e]:Array.from(new Set([e,...o]))))},o[3]=d):d=o[3];const p=d;let y;o[4]===Symbol.for("react.memo_cache_sentinel")?(y=e=>{i((o=>o.filter((o=>o!==e))))},o[4]=y):y=o[4];const m=y;let f;o[5]===Symbol.for("react.memo_cache_sentinel")?(f=e=>{i((o=>o.includes(e)?o.filter((o=>o!==e)):o.includes("*")?[e]:Array.from(new Set([e,...o]))))},o[5]=f):f=o[5];const h=f;let S;o[6]===Symbol.for("react.memo_cache_sentinel")?(S=e=>{u((o=>[...o,e]))},o[6]=S):S=o[6];const C=S;let v;o[7]===Symbol.for("react.memo_cache_sentinel")?(v=e=>{u((o=>o.filter((o=>!deepEqual(o,e)))))},o[7]=v):v=o[7];const A=v;let k,w,P;return o[8]!==l||o[9]!==n?(k={activeScopes:n,disableScope:m,enableScope:p,hotkeys:l,toggleScope:h},o[8]=l,o[9]=n,o[10]=k):k=o[10],o[11]!==t?(w=React.createElement(BoundHotkeysProxyProviderProvider,{addHotkey:C,removeHotkey:A},t),o[11]=t,o[12]=w):w=o[12],o[13]!==w||o[14]!==k?(P=React.createElement(HotkeysContext.Provider,{value:k},w),o[13]=w,o[14]=k,o[15]=P):P=o[15],P},reservedModifierKeywords=new Set(["alt","control","ctrl","meta","mod","shift"]),mappedKeys={AltLeft:"alt",AltRight:"alt",ControlLeft:"ctrl",ControlRight:"ctrl",down:"arrowdown",esc:"escape",left:"arrowleft",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",return:"enter",right:"arrowright",ShiftLeft:"shift",ShiftRight:"shift",up:"arrowup"},KEY_PREFIX_REGEX=/key|digit|numpad/;function mapKey(e){return(mappedKeys[e.trim()]||e.trim()).toLowerCase().replace(KEY_PREFIX_REGEX,"")}function isHotkeyModifier(e){return reservedModifierKeywords.has(e)}function parseKeysHookInput(e,o=","){return e.toLowerCase().split(o)}function parseHotkey(e,o="+",t=!1,a){const r=e.toLocaleLowerCase().split(o).map((e=>mapKey(e)));return{...{alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),meta:r.includes("meta"),mod:r.includes("mod"),shift:r.includes("shift"),useKey:t},keys:r.filter((e=>!reservedModifierKeywords.has(e))),description:a}}"undefined"!=typeof document&&(document.addEventListener("keydown",(e=>{void 0!==e.code&&pushToCurrentlyPressedKeys([mapKey(e.code)])})),document.addEventListener("keyup",(e=>{void 0!==e.code&&removeFromCurrentlyPressedKeys([mapKey(e.code)])}))),"undefined"!=typeof window&&window.addEventListener("blur",(()=>{currentlyPressedKeys.clear()}));const currentlyPressedKeys=new Set;function isReadonlyArray(e){return Array.isArray(e)}function isHotkeyPressed(e,o=","){return(isReadonlyArray(e)?e:e.split(o)).every((e=>currentlyPressedKeys.has(e.trim().toLowerCase())))}function pushToCurrentlyPressedKeys(e){const o=Array.isArray(e)?e:[e];if(currentlyPressedKeys.has("meta"))for(const e of currentlyPressedKeys)isHotkeyModifier(e)||currentlyPressedKeys.delete(e.toLowerCase());for(const e of o)currentlyPressedKeys.add(e.toLowerCase())}function removeFromCurrentlyPressedKeys(e){const o=Array.isArray(e)?e:[e];if("meta"===e)currentlyPressedKeys.clear();else for(const e of o)currentlyPressedKeys.delete(e.toLowerCase())}const Key={Accept:"Accept",Add:"Add",Again:"Again",AllCandidates:"AllCandidates",Alphanumeric:"Alphanumeric",Alt:"Alt",AltGraph:"AltGraph",AppSwitch:"AppSwitch",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",ArrowUp:"ArrowUp",Attn:"Attn",AudioBalanceLeft:"AudioBalanceLeft",AudioBalanceRight:"AudioBalanceRight",AudioBassBoostDown:"AudioBassBoostDown",AudioBassBoostToggle:"AudioBassBoostToggle",AudioBassBoostUp:"AudioBassBoostUp",AudioBassDown:"AudioBassDown",AudioBassUp:"AudioBassUp",AudioFaderFront:"AudioFaderFront",AudioFaderRear:"AudioFaderRear",AudioSurroundModeNext:"AudioSurroundModeNext",AudioTrebleDown:"AudioTrebleDown",AudioTrebleUp:"AudioTrebleUp",AudioVolumeDown:"AudioVolumeDown",AudioVolumeMute:"AudioVolumeMute",AudioVolumeUp:"AudioVolumeUp",AVRInput:"AVRInput",AVRPower:"AVRPower",Backspace:"Backspace",BrightnessDown:"BrightnessDown",BrightnessUp:"BrightnessUp",BrowserBack:"BrowserBack",BrowserFavorites:"BrowserFavorites",BrowserForward:"BrowserForward",BrowserHome:"BrowserHome",BrowserRefresh:"BrowserRefresh",BrowserSearch:"BrowserSearch",BrowserStop:"BrowserStop",Call:"Call",Camera:"Camera",CameraFocus:"CameraFocus",Cancel:"Cancel",CapsLock:"CapsLock",ChannelDown:"ChannelDown",ChannelUp:"ChannelUp",Clear:"Clear",Close:"Close",ClosedCaptionToggle:"ClosedCaptionToggle",CodeInput:"CodeInput",ColorF0Red:"ColorF0Red",ColorF1Green:"ColorF1Green",ColorF2Yellow:"ColorF2Yellow",ColorF3Blue:"ColorF3Blue",ColorF4Grey:"ColorF4Grey",ColorF5Brown:"ColorF5Brown",Compose:"Compose",ContextMenu:"ContextMenu",Control:"Control",Convert:"Convert",Copy:"Copy",CrSel:"CrSel",Cut:"Cut",Dead:"Dead",Decimal:"Decimal",Delete:"Delete",Dimmer:"Dimmer",DisplaySwap:"DisplaySwap",Divide:"Divide",DVR:"DVR",Eisu:"Eisu",Eject:"Eject",End:"End",EndCall:"EndCall",Enter:"Enter",EraseEof:"EraseEof",Escape:"Escape",Execute:"Execute",Exit:"Exit",ExSel:"ExSel",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F20:"F20",FavoriteClear0:"FavoriteClear0",FavoriteClear1:"FavoriteClear1",FavoriteClear2:"FavoriteClear2",FavoriteClear3:"FavoriteClear3",FavoriteRecall0:"FavoriteRecall0",FavoriteRecall1:"FavoriteRecall1",FavoriteRecall2:"FavoriteRecall2",FavoriteRecall3:"FavoriteRecall3",FavoriteStore0:"FavoriteStore0",FavoriteStore1:"FavoriteStore1",FavoriteStore2:"FavoriteStore2",FavoriteStore3:"FavoriteStore3",FinalMode:"FinalMode",Find:"Find",Finish:"Finish",Fn:"Fn",FnLock:"FnLock",GoBack:"GoBack",GoHome:"GoHome",GroupFirst:"GroupFirst",GroupLast:"GroupLast",GroupNext:"GroupNext",GroupPrevious:"GroupPrevious",Guide:"Guide",GuideNextDay:"GuideNextDay",GuidePreviousDay:"GuidePreviousDay",HangulMode:"HangulMode",HanjaMode:"HanjaMode",Hankaku:"Hankaku",HeadsetHook:"HeadsetHook",Help:"Help",Hibernate:"Hibernate",Hiragana:"Hiragana",HiraganaKatakana:"HiraganaKatakana",Home:"Home",Hyper:"Hyper",Info:"Info",Insert:"Insert",InstantReplay:"InstantReplay",JunjaMode:"JunjaMode",KanaMode:"KanaMode",KanjiMode:"KanjiMode",Katakana:"Katakana",Key11:"Key11",Key12:"Key12",LastNumberRedial:"LastNumberRedial",LaunchApplication1:"LaunchApplication1",LaunchApplication2:"LaunchApplication2",LaunchApplication3:"LaunchApplication3",LaunchApplication4:"LaunchApplication4",LaunchApplication5:"LaunchApplication5",LaunchApplication6:"LaunchApplication6",LaunchApplication7:"LaunchApplication7",LaunchApplication8:"LaunchApplication8",LaunchApplication9:"LaunchApplication9",LaunchApplication10:"LaunchApplication10",LaunchApplication11:"LaunchApplication11",LaunchApplication12:"LaunchApplication12",LaunchApplication13:"LaunchApplication13",LaunchApplication14:"LaunchApplication14",LaunchApplication15:"LaunchApplication15",LaunchApplication16:"LaunchApplication16",LaunchCalculator:"LaunchCalculator",LaunchCalendar:"LaunchCalendar",LaunchContacts:"LaunchContacts",LaunchMail:"LaunchMail",LaunchMediaPlayer:"LaunchMediaPlayer",LaunchMusicPlayer:"LaunchMusicPlayer",LaunchMyComputer:"LaunchMyComputer",LaunchPhone:"LaunchPhone",LaunchScreenSaver:"LaunchScreenSaver",LaunchSpreadsheet:"LaunchSpreadsheet",LaunchWebBrowser:"LaunchWebBrowser",LaunchWebCam:"LaunchWebCam",LaunchWordProcessor:"LaunchWordProcessor",Link:"Link",ListProgram:"ListProgram",LiveContent:"LiveContent",Lock:"Lock",LogOff:"LogOff",MailForward:"MailForward",MailReply:"MailReply",MailSend:"MailSend",MannerMode:"MannerMode",MediaApps:"MediaApps",MediaAudioTrack:"MediaAudioTrack",MediaFastForward:"MediaFastForward",MediaLast:"MediaLast",MediaPause:"MediaPause",MediaPlay:"MediaPlay",MediaPlayPause:"MediaPlayPause",MediaRecord:"MediaRecord",MediaRewind:"MediaRewind",MediaSkipBackward:"MediaSkipBackward",MediaSkipForward:"MediaSkipForward",MediaStepBackward:"MediaStepBackward",MediaStepForward:"MediaStepForward",MediaStop:"MediaStop",MediaTopMenu:"MediaTopMenu",MediaTrackNext:"MediaTrackNext",MediaTrackPrevious:"MediaTrackPrevious",Meta:"Meta",MicrophoneToggle:"MicrophoneToggle",MicrophoneVolumeDown:"MicrophoneVolumeDown",MicrophoneVolumeMute:"MicrophoneVolumeMute",MicrophoneVolumeUp:"MicrophoneVolumeUp",Mod:"Mod",ModeChange:"ModeChange",Multiply:"Multiply",NavigateIn:"NavigateIn",NavigateNext:"NavigateNext",NavigateOut:"NavigateOut",NavigatePrevious:"NavigatePrevious",New:"New",NextCandidate:"NextCandidate",NextFavoriteChannel:"NextFavoriteChannel",NextUserProfile:"NextUserProfile",NonConvert:"NonConvert",Notification:"Notification",NumLock:"NumLock",OnDemand:"OnDemand",Open:"Open",PageDown:"PageDown",PageUp:"PageUp",Pairing:"Pairing",Paste:"Paste",Pause:"Pause",PinPDown:"PinPDown",PinPMove:"PinPMove",PinPToggle:"PinPToggle",PinPUp:"PinPUp",Play:"Play",PlaySpeedDown:"PlaySpeedDown",PlaySpeedReset:"PlaySpeedReset",PlaySpeedUp:"PlaySpeedUp",Power:"Power",PowerOff:"PowerOff",PreviousCandidate:"PreviousCandidate",Print:"Print",PrintScreen:"PrintScreen",Process:"Process",Props:"Props",RandomToggle:"RandomToggle",RcLowBattery:"RcLowBattery",RecordSpeedNext:"RecordSpeedNext",Redo:"Redo",RfBypass:"RfBypass",Romaji:"Romaji",Save:"Save",ScanChannelsToggle:"ScanChannelsToggle",ScreenModeNext:"ScreenModeNext",ScrollLock:"ScrollLock",Select:"Select",Separator:"Separator",Settings:"Settings",Shift:"Shift",SingleCandidate:"SingleCandidate",Soft1:"Soft1",Soft2:"Soft2",Soft3:"Soft3",Soft4:"Soft4",SpeechCorrectionList:"SpeechCorrectionList",SpeechInputToggle:"SpeechInputToggle",SpellCheck:"SpellCheck",SplitScreenToggle:"SplitScreenToggle",Standby:"Standby",STBInput:"STBInput",STBPower:"STBPower",Subtitle:"Subtitle",Subtract:"Subtract",Super:"Super",Symbol:"Symbol",SymbolLock:"SymbolLock",Tab:"Tab",Teletext:"Teletext",TV:"TV",TV3DMode:"TV3DMode",TVAntennaCable:"TVAntennaCable",TVAudioDescription:"TVAudioDescription",TVAudioDescriptionMixDown:"TVAudioDescriptionMixDown",TVAudioDescriptionMixUp:"TVAudioDescriptionMixUp",TVContentsMenu:"TVContentsMenu",TVDataService:"TVDataService",TVInput:"TVInput",TVInputComponent1:"TVInputComponent1",TVInputComponent2:"TVInputComponent2",TVInputComposite1:"TVInputComposite1",TVInputComposite2:"TVInputComposite2",TVInputHDMI1:"TVInputHDMI1",TVInputHDMI2:"TVInputHDMI2",TVInputHDMI3:"TVInputHDMI3",TVInputHDMI4:"TVInputHDMI4",TVInputVGA1:"TVInputVGA1",TVMediaContext:"TVMediaContext",TVNetwork:"TVNetwork",TVNumberEntry:"TVNumberEntry",TVPower:"TVPower",TVRadioService:"TVRadioService",TVSatellite:"TVSatellite",TVSatelliteBS:"TVSatelliteBS",TVSatelliteCS:"TVSatelliteCS",TVSatelliteToggle:"TVSatelliteToggle",TVTerrestrialAnalog:"TVTerrestrialAnalog",TVTerrestrialDigital:"TVTerrestrialDigital",TVTimer:"TVTimer",Undo:"Undo",Unidentified:"Unidentified",VideoModeNext:"VideoModeNext",VoiceDial:"VoiceDial",WakeUp:"WakeUp",Wink:"Wink",Zenkaku:"Zenkaku",ZenkakuHanaku:"ZenkakuHanaku",ZoomIn:"ZoomIn",ZoomOut:"ZoomOut",ZoomToggle:"ZoomToggle"};function useDeepEqualMemo(e){const o=useRef(void 0);return deepEqual(o.current,e)||(o.current=e),o.current}function maybePreventDefault(e,o,t){("function"==typeof t&&t(e,o)||!0===t)&&e.preventDefault()}function isHotkeyEnabled(e,o,t){return"function"==typeof t?t(e,o):!0===t||void 0===t}function isKeyboardEventTriggeredByInput(e){return isHotkeyEnabledOnTag(e,["input","textarea","select"])}function isHotkeyEnabledOnTag({target:e},o=!1){const t=e&&e.tagName;return isReadonlyArray(o)?Boolean(t&&o?.some((e=>e.toLowerCase()===t.toLowerCase()))):Boolean(t&&o&&o)}function isScopeActive(e,o){return 0===e.length&&o?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!o||(e.some((e=>o.includes(e)))||e.includes("*"))}const isHotkeyMatchingKeyboardEvent=(e,o,t=!1)=>{const{keys:a,alt:r,ctrl:n,meta:i,mod:s,shift:c,useKey:l}=o,{key:u,altKey:d,code:p,ctrlKey:y,metaKey:m,shiftKey:f}=e,h=mapKey(p);if(l&&1===a?.length&&a.includes(u))return!0;if(!a?.includes(h)&&!["alt","control","ctrl","meta","os","shift","unknown"].includes(h))return!1;if(!t){if(r!==d&&"alt"!==h)return!1;if(c!==f&&"shift"!==h)return!1;if(s){if(!m&&!y)return!1}else{if(i!==m&&"meta"!==h&&"os"!==h)return!1;if(n!==y&&"ctrl"!==h&&"control"!==h)return!1}}return!(!a||1!==a.length||!a.includes(h))||(a?isHotkeyPressed(a):!a)},stopPropagation=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},useSafeLayoutEffect="undefined"==typeof window?useEffect:useLayoutEffect;function useHotkeys(e,o,t,a){const[r,n]=useState(null),i=useRef(!1),s=Array.isArray(t)?Array.isArray(a)?void 0:a:t,c=useMemo((()=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0])?e.map((e=>e.map((e=>e.toString())).join(s?.splitKey||"+"))).join(s?.delimiter||","):Array.isArray(e)?e.join(s?.delimiter||","):e),[e,s?.splitKey,s?.delimiter]),l=Array.isArray(t)?t:Array.isArray(a)?a:void 0,u=useCallback(o,l??[]),d=useRef(u);d.current=l?u:o;const p=useDeepEqualMemo(s),{activeScopes:y}=useHotkeysContext(),m=useBoundHotkeysProxy();return useSafeLayoutEffect((()=>{if(!1===p?.enabled||!isScopeActive(y,p?.scopes))return;const e=(e,o=!1)=>{if(!isKeyboardEventTriggeredByInput(e)||isHotkeyEnabledOnTag(e,p?.enableOnFormTags)){if(null!==r){const o=r.getRootNode();if((o instanceof Document||o instanceof ShadowRoot)&&o.activeElement!==r&&!r.contains(o.activeElement))return void stopPropagation(e)}e.target?.isContentEditable&&!p?.enableOnContentEditable||parseKeysHookInput(c,p?.delimiter).forEach((t=>{const a=parseHotkey(t,p?.splitKey,p?.useKey);if(isHotkeyMatchingKeyboardEvent(e,a,p?.ignoreModifiers)||a.keys?.includes("*")){if((p?.ignoreEventWhenPrevented??1)&&e.defaultPrevented)return;if(p?.ignoreEventWhen?.(e))return;if(o&&i.current)return;if(!isHotkeyEnabled(e,a,p?.enabled))return void stopPropagation(e);d.current(e,a),maybePreventDefault(e,a,p?.preventDefault),o||(i.current=!0)}}))}},o=o=>{void 0!==o.code&&(pushToCurrentlyPressedKeys(mapKey(o.code)),(void 0===p?.keydown&&!0!==p?.keyup||p?.keydown)&&e(o))},t=o=>{void 0!==o.code&&(removeFromCurrentlyPressedKeys(mapKey(o.code)),i.current=!1,p?.keyup&&e(o,!0))},a=r||s?.document||document;if(a.addEventListener("keyup",t),a.addEventListener("keydown",o),m)for(const e of parseKeysHookInput(c,p?.delimiter))m.addHotkey(parseHotkey(e,p?.splitKey,p?.useKey,p?.description));return()=>{if(a.removeEventListener("keyup",t),a.removeEventListener("keydown",o),m)for(const e of parseKeysHookInput(c,p?.delimiter))m.removeHotkey(parseHotkey(e,p?.splitKey,p?.useKey,p?.description))}}),[r,c,p,y]),n}function useRecordHotkeys(){const e=c(10);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Set,e[0]=o):o=e[0];const[t,a]=useState(o),[r,n]=useState(!1);let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=e=>{void 0!==e.code&&(e.preventDefault(),e.stopPropagation(),a((o=>{const t=new Set(o);return t.add(mapKey(e.code)),t})))},e[1]=i):i=e[1];const s=i;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{"undefined"!=typeof document&&(document.removeEventListener("keydown",s),n(!1))},e[2]=l):l=e[2];const u=l;let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{a(new Set),"undefined"!=typeof document&&(u(),document.addEventListener("keydown",s),n(!0))},e[3]=d):d=e[3];const p=d;let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{a(new Set)},e[4]=y):y=e[4];const m=y;let f,h;return e[5]!==r?(f={isRecording:r,resetKeys:m,start:p,stop:u},e[5]=r,e[6]=f):f=e[6],e[7]!==t||e[8]!==f?(h=[t,f],e[7]=t,e[8]=f,e[9]=h):h=e[9],h}export{HotkeysProvider,Key,isHotkeyPressed,useHotkeys,useHotkeysContext,useRecordHotkeys};
//# sourceMappingURL=/sm/c007c4860abc574be7b4075f28464032574d6e8ffbd622fef8c7c8bbc3dbf1b3.map