{"version":3,"file":"useStableId.mjs","names":[],"sources":["../../../../src/components/UtilityComponents/useStableId.ts"],"sourcesContent":["import { nanoid } from 'nanoid';\nimport React, { useMemo } from 'react';\n\nconst reactUseId = React.useId as (() => string) | undefined;\n\n/**\n * Strips the `useId` wrapper characters so the value is a safe HTML ID: `:r0:` (React 19.0) and\n * `«r0»` (19.1) become `r0`. React 19.2+ (`_r_1_`) needs no stripping.\n */\nexport const stripUseIdWrappers = (id: string): string => id.replace(/[:«»]/g, '');\n\n/**\n * Returns a stable, unique string ID: `React.useId()` with its wrapper characters stripped\n * (SSR-stable) where it exists, a client-only `nanoid` on React 17.\n */\nexport const useStableId = () => {\n  if (reactUseId) return stripUseIdWrappers(reactUseId());\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  return useMemo(() => nanoid(), []);\n};\n"],"mappings":";;;AAGA,IAAM,aAAa,MAAM;;;;;AAMzB,IAAa,sBAAsB,OAAuB,GAAG,QAAQ,UAAU,EAAE;;;;;AAMjF,IAAa,oBAAoB;CAC/B,IAAI,YAAY,OAAO,mBAAmB,WAAW,CAAC;CAEtD,OAAO,cAAc,OAAO,GAAG,CAAC,CAAC;AACnC"}