{"version":3,"file":"env-BvwEf5yc.cjs","names":["isBrowser","globalThis","window","undefined","safeLocalStorage","localStorage"],"sources":["../src/utils/env.ts"],"sourcesContent":["/**\n * Whether a DOM `window` is available. Returns `false` under SSR / in a\n * plain Node environment, so callers can fall back to non-DOM behaviour.\n *\n * Reads through a cast because the DOM lib types declare `window` as\n * always present, which it isn't on the server.\n *\n * @returns `true` when running in a browser-like environment.\n */\nexport function isBrowser(): boolean {\n  return (globalThis as { window?: unknown }).window !== undefined;\n}\n\n/**\n * `localStorage` when it is actually usable, else `undefined`. The GETTER\n * itself throws a SecurityError when storage is blocked (Safari private\n * mode, sandboxed iframes, some embedded webviews), so even touching\n * `globalThis.localStorage` must be guarded.\n *\n * @returns The storage object, or `undefined` under SSR / blocked storage.\n */\nexport function safeLocalStorage():\n  | Pick<Storage, \"getItem\" | \"setItem\" | \"removeItem\">\n  | undefined {\n  if (!isBrowser()) return undefined;\n  try {\n    return globalThis.localStorage;\n  } catch {\n    return undefined;\n  }\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAgBA,YAAqB;CACnC,OAAQC,WAAoCC,WAAWC,KAAAA;AACzD;;;;;;;;;AAUA,SAAgBC,mBAEF;CACZ,IAAI,CAACJ,UAAU,GAAG,OAAOG,KAAAA;CACzB,IAAI;EACF,OAAOF,WAAWI;CACpB,QAAQ;EACN;CACF;AACF"}