{"version":3,"names":["hasNavigator","navigator","getNavigatorData","platform","maxTouchPoints","uaData","userAgentData","getUserAgent","Array","isArray","brands","map","brand","version","join","userAgent","getPlatform","nav","isAndroid","test","isJSDOM","includes","isHappyDOM","isTestEnv","isIOS","isMac","toLowerCase","startsWith","isSafari","vendor","isWebKit"],"sources":["detect-browser.ts"],"sourcesContent":["/**\n * Minimal browser / environment detection used by the floating-ui-react port.\n *\n * Mirrors `@base-ui/utils/detectBrowser` — only the subset the port actually\n * consumes is inlined here so we don't have to vendor a separate dependency.\n * Each flag matches the React source so behavior is 1:1.\n */\n\ninterface NavigatorUAData {\n\tbrands: Array<{ brand: string; version: string }>;\n\tmobile: boolean;\n\tplatform: string;\n}\n\nconst hasNavigator = typeof navigator !== \"undefined\";\n\nfunction getNavigatorData(): { platform: string; maxTouchPoints: number } {\n\tif (!hasNavigator) {\n\t\treturn { platform: \"\", maxTouchPoints: -1 };\n\t}\n\tconst uaData = (navigator as { userAgentData?: NavigatorUAData })\n\t\t.userAgentData;\n\tif (uaData?.platform) {\n\t\treturn {\n\t\t\tplatform: uaData.platform,\n\t\t\tmaxTouchPoints: navigator.maxTouchPoints,\n\t\t};\n\t}\n\treturn {\n\t\tplatform: navigator.platform ?? \"\",\n\t\tmaxTouchPoints: navigator.maxTouchPoints ?? -1,\n\t};\n}\n\nfunction getUserAgent(): string {\n\tif (!hasNavigator) {\n\t\treturn \"\";\n\t}\n\tconst uaData = (navigator as { userAgentData?: NavigatorUAData })\n\t\t.userAgentData;\n\tif (uaData && Array.isArray(uaData.brands)) {\n\t\treturn uaData.brands\n\t\t\t.map(({ brand, version }) => `${brand}/${version}`)\n\t\t\t.join(\" \");\n\t}\n\t// `navigator` can exist with an absent `userAgent` on non-browser runtimes\n\t// (Node ≥21, Deno, edge workers expose a partial Navigator), so the\n\t// `hasNavigator` guard alone isn't enough — coalesce to avoid a\n\t// module-load crash on `userAgent.includes(...)` below.\n\treturn navigator.userAgent ?? \"\";\n}\n\nfunction getPlatform(): string {\n\tif (!hasNavigator) {\n\t\treturn \"\";\n\t}\n\tconst uaData = (navigator as { userAgentData?: NavigatorUAData })\n\t\t.userAgentData;\n\tif (uaData?.platform) {\n\t\treturn uaData.platform;\n\t}\n\treturn navigator.platform ?? \"\";\n}\n\nconst nav = getNavigatorData();\nconst platform = getPlatform();\nconst userAgent = getUserAgent();\n\nexport const isAndroid =\n\t(hasNavigator && /android/i.test(platform)) || /android/i.test(userAgent);\n\nexport const isJSDOM = userAgent.includes(\"jsdom/\");\n\n/**\n * happy-dom sets a user-agent beginning with \"Mozilla/5.0 (X11; Linux x64) ...\"\n * and does NOT include \"jsdom/\". We also treat happy-dom as JSDOM-ish because\n * it shares the same limitations (no real focus-visible, no real layout).\n */\nconst isHappyDOM = userAgent.includes(\"HappyDOM\");\n\n/**\n * Umbrella flag: true in either jsdom or happy-dom. Code that guards on\n * test-env limitations (e.g. `matches(':focus-visible')` throwing) should\n * use this.\n */\nexport const isTestEnv = isJSDOM || isHappyDOM;\n\nexport const isIOS =\n\tnav.platform === \"MacIntel\" && nav.maxTouchPoints > 1\n\t\t? true\n\t\t: /iP(hone|ad|od)|iOS/.test(nav.platform);\n\nexport const isMac =\n\thasNavigator &&\n\tplatform.toLowerCase().startsWith(\"mac\") &&\n\t!navigator.maxTouchPoints;\n\n/**\n * Safari detection — mirrors `@base-ui/utils/detectBrowser`'s `isSafari`.\n * Uses `navigator.vendor` which is \"Apple Computer, Inc.\" in Safari and\n * empty / different in Chrome/Firefox/Edge.\n */\nexport const isSafari =\n\thasNavigator && /apple/i.test((navigator as Navigator).vendor ?? \"\");\n\n/**\n * WebKit engine detection — mirrors `@base-ui/utils/detectBrowser`'s\n * `isWebKit`. Matches Safari AND other WebKit-shell browsers (WKWebView,\n * standalone iOS PWAs) without matching Chromium-based browsers (which\n * keep \"AppleWebKit\" in their UA for historical compat).\n */\nexport const isWebKit =\n\thasNavigator &&\n\t/AppleWebKit/.test(userAgent) &&\n\t!/Edg|Chrome|Chromium|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