{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/dRoNsxlF6imjtQsbzg8a/ajl7diV9rk8IMgi5u3Ja/Shortcuts.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";export function withKeyboardShortcuts(Component){const handleKeyDown=event=>{// Don't capture input if the user is typing in an input field/textarea or a meta key is pressed\nif(event.target instanceof HTMLInputElement||event.target instanceof HTMLTextAreaElement){return;}if(event.shiftKey||event.ctrlKey||event.altKey||event.metaKey){return;}// Save pressed keys to session storage\nlet pressedKeys=JSON.parse(sessionStorage.getItem(\"pressedKeys\")||\"[]\");pressedKeys.push(event.key);if(pressedKeys.length>1)pressedKeys.shift();sessionStorage.setItem(\"pressedKeys\",JSON.stringify(pressedKeys));if(typeof window!==\"undefined\"){// Notify other components\nconst customEvent=new CustomEvent(\"pressedKeysChanged\",{detail:pressedKeys});window.dispatchEvent(customEvent);}};const handleBeforeUnload=()=>{sessionStorage.removeItem(\"pressedKeys\");};return props=>{if(typeof window!==\"undefined\"){React.useEffect(()=>{// Focus window on load\nwindow.focus();window.addEventListener(\"keydown\",handleKeyDown);window.addEventListener(\"beforeunload\",handleBeforeUnload);return()=>{window.removeEventListener(\"keydown\",handleKeyDown);window.removeEventListener(\"beforeunload\",handleBeforeUnload);};},[]);}return /*#__PURE__*/_jsx(Component,{...props});};}export function withShortcutTrigger(Component){const handlePressedKeysChanged=(event,key,containerRef)=>{const pressedKeys=event.detail;// Check if the last pressed key matches the shortcut\nif(pressedKeys[pressedKeys.length-1].toLowerCase()===key.toLowerCase()){event.preventDefault();setTimeout(()=>{if(containerRef.current){const button=containerRef.current.querySelector(\"button\");const link=containerRef.current.querySelector(\"a\");if(button){button.click();}else if(link){link.click();}else{console.error(`\uD83E\uDD8E Error: The shortcut trigger element ${key} isn't working properly. Check the docs for help.`);}}else{console.error(`\uD83E\uDD8E Error: The shortcut trigger element ${key} isn't working properly. Check the docs for help.`);}sessionStorage.removeItem(\"pressedKeys\");},0);}};return props=>{var _props_name;const regExp=/\\[(.*?)\\]/;let lizardKeyRegex=(_props_name=props.name)===null||_props_name===void 0?void 0:_props_name.match(regExp);let lizardKey=\"\";let lizardContainerRef=React.useRef(null);if(lizardKeyRegex){lizardKey=lizardKeyRegex[1];}else{console.error(`\uD83E\uDD8E Error: Your shortcut trigger layer (${props.name}) is missing a key in its layer name.`);}if(typeof window!==\"undefined\"){React.useEffect(()=>{const handlePressedKeysEvent=event=>{const customEvent=event;handlePressedKeysChanged(customEvent,lizardKey,lizardContainerRef);};window.addEventListener(\"pressedKeysChanged\",handlePressedKeysEvent);},[]);}return /*#__PURE__*/_jsx(\"span\",{ref:lizardContainerRef,\"data-lizard-shortcuts-trigger\":lizardKey,children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withKeyboardShortcuts\":{\"type\":\"reactHoc\",\"name\":\"withKeyboardShortcuts\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShortcutTrigger\":{\"type\":\"reactHoc\",\"name\":\"withShortcutTrigger\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shortcuts.map"],
  "mappings": "yFAA2E,SAASA,EAAsBC,EAAU,CAAC,IAAMC,EAAcC,GAAO,CAC9C,GAA/FA,EAAM,kBAAkB,kBAAkBA,EAAM,kBAAkB,qBAAgCA,EAAM,UAAUA,EAAM,SAASA,EAAM,QAAQA,EAAM,QAAS,OACjK,IAAIC,EAAY,KAAK,MAAM,eAAe,QAAQ,aAAa,GAAG,IAAI,EAA4I,GAA1IA,EAAY,KAAKD,EAAM,GAAG,EAAKC,EAAY,OAAO,GAAEA,EAAY,MAAM,EAAE,eAAe,QAAQ,cAAc,KAAK,UAAUA,CAAW,CAAC,EAAK,OAAOC,EAAS,IAAY,CACjP,IAAMC,EAAY,IAAI,YAAY,qBAAqB,CAAC,OAAOF,CAAW,CAAC,EAAEC,EAA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,GAAO,CAAyBS,EAANT,EAA2CiB,EAAUC,CAAkB,CAAE,EAAEhB,EAAO,iBAAiB,qBAAqBiB,CAAsB,CAAE,EAAE,CAAC,CAAC,EAAuBZ,EAAK,OAAO,CAAC,IAAIW,EAAmB,gCAAgCD,EAAU,SAAsBV,EAAKT,EAAU,CAAC,GAAGO,CAAK,CAAC,CAAC,CAAC,CAAE,CAAE",
  "names": ["withKeyboardShortcuts", "Component", "handleKeyDown", "event", "pressedKeys", "window", "customEvent", "handleBeforeUnload", "props", "e", "p", "withShortcutTrigger", "handlePressedKeysChanged", "key", "containerRef", "button", "link", "_props_name", "regExp", "lizardKeyRegex", "lizardKey", "lizardContainerRef", "handlePressedKeysEvent"]
}
