{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/sBN65zJscFKCwdwUq1y0/FHxhO0aQsBD1Aiaz30dZ/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": "2HAA2E,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,EAAO,cAAcC,CAAW,CAAE,CAAC,EAAQC,EAAmB,IAAI,CAAC,eAAe,WAAW,aAAa,CAAE,EAAE,OAAOC,IAAW,OAAOH,EAAS,KAAaI,EAAM,UAAU,KAC1PJ,EAAO,MAAM,EAAEA,EAAO,iBAAiB,UAAUH,CAAa,EAAEG,EAAO,iBAAiB,eAAeE,CAAkB,EAAQ,IAAI,CAACF,EAAO,oBAAoB,UAAUH,CAAa,EAAEG,EAAO,oBAAoB,eAAeE,CAAkB,CAAE,GAAI,CAAC,CAAC,EAAuBG,EAAKT,EAAU,CAAC,GAAGO,CAAK,CAAC,EAAI",
  "names": ["withKeyboardShortcuts", "Component", "handleKeyDown", "event", "pressedKeys", "window", "customEvent", "handleBeforeUnload", "props", "e", "p"]
}
