{"version":3,"file":"computed.cjs","names":[],"sources":["../../src/computed/computed.ts"],"sourcesContent":["import { useMemo, type DependencyList } from 'react';\n\n/**\n * Memoizes the result of a computed value based on a dependency list.\n *\n * This is a lightweight wrapper around React's `useMemo` hook that provides\n * a more semantic API for derived or computed values.\n *\n * @typeParam T - The type of the computed value.\n *\n * @param fn - A function that computes and returns the memoized value.\n * @param deps - A dependency list that determines when the computed value\n * should be recalculated.\n *\n * @returns The memoized computed value.\n *\n * @remarks\n * The computation function will only be re-executed when one of the values\n * in the dependency list changes.\n *\n * @example\n * ```tsx\n * const total = computed(() => price * quantity, [price, quantity]);\n * ```\n *\n * @example\n * ```tsx\n * const filteredUsers = computed(() => users.filter((user) => user.active), [users]);\n * ```\n */\nexport function computed<T = any>(fn: () => T, deps: DependencyList): T {\n  return useMemo(fn, deps);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,SAAkB,IAAa,MAAyB;CACtE,QAAA,GAAA,MAAA,QAAA,CAAe,IAAI,IAAI;AACzB"}