"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useExampleKey=void 0;const react_1=require("react"),jotai_1=require("jotai"),operation_1=require("../../jotai/operation");function useExampleKey({pointer:e}={},t){const[a,o]=(0,jotai_1.useAtom)((0,operation_1.operationStore)(e)),{activeExampleName:r}=a,[s,i]=(0,react_1.useState)(r&&t[r]?r:Object.keys(t)[0]);return(0,react_1.useEffect)((()=>{r&&t[r]&&(i(r),o((e=>Object.assign(Object.assign({},e),{activeExampleName:r}))))}),[r,t,o]),{exampleKey:t[s]?s:Object.keys(t)[0]}}exports.useExampleKey=useExampleKey;
//# sourceMappingURL=use-example-key.js.map