{"version":3,"sources":["../../src/use-key-stroke-once/index.ts"],"sourcesContent":["import { useKeyStroke } from '../use-key-stroke'\nimport { useLatest } from '../use-latest'\n\nimport type { KeyFilter, UseKeyStrokeHandler, UseKeyStrokeOptions } from '../use-key-stroke'\nimport type { Noop } from '../utils/basic'\n\n/**\n * A React Hook that helps to handle key strokes **once**.\n */\nexport function useKeyStrokeOnce(\n  key?: KeyFilter,\n  handler?: UseKeyStrokeHandler,\n  options?: Omit<UseKeyStrokeOptions, 'once'>,\n): Noop {\n  const latest = useLatest({ handler })\n\n  return useKeyStroke(\n    key,\n    (event) => {\n      latest.current.handler?.(event)\n    },\n    { ...options, once: true },\n  )\n}\n"],"names":["useKeyStrokeOnce","key","handler","options","latest","useLatest","useKeyStroke","event","current","once"],"mappings":";;;;+BASgBA;;;eAAAA;;;4BATa;yBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQnB,SAASA,iBACdC,GAAe,EACfC,OAA6B,EAC7BC,OAA2C;IAE3C,IAAMC,SAASC,IAAAA,oBAAS,EAAC;QAAEH,SAAAA;IAAQ;IAEnC,OAAOI,IAAAA,0BAAY,EACjBL,KACA,SAACM;YACCH,yBAAAA;SAAAA,0BAAAA,CAAAA,kBAAAA,OAAOI,OAAO,EAACN,OAAO,cAAtBE,8CAAAA,6BAAAA,iBAAyBG;IAC3B,GACA,wCAAKJ;QAASM,MAAM;;AAExB"}