@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
1 lines • 1.87 kB
JavaScript
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`react`)):typeof define==`function`&&define.amd?define([`exports`,`react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.dnbBasis={},e.React))})(this,function(exports,t){Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;let n=`Mac|iPad|iPhone|iPod`,r=`Linux`,i=()=>typeof navigator<`u`&&new RegExp(n,`i`).test(navigator?.platform),a=()=>typeof navigator<`u`&&RegExp(`Win`,`i`).test(navigator?.platform),o=()=>typeof navigator<`u`&&RegExp(`Android`,`i`).test(navigator?.userAgent),s=()=>typeof navigator<`u`&&new RegExp(r,`i`).test(navigator?.platform),c=()=>typeof navigator<`u`&&RegExp(`iOS|iPhone|iPad|iPod`,`i`).test(navigator?.platform),l=()=>typeof navigator<`u`&&/safari/i.test(navigator?.userAgent)&&!/chrome/i.test(navigator?.userAgent),u=()=>typeof navigator<`u`&&/edge/i.test(navigator?.userAgent);u(),c(),l(),a(),o(),i(),s();function d(){if(typeof document<`u`){let e=!1;try{e=document.documentElement.getAttribute(`data-whatintent`)}catch{}return e===`touch`}return!1}function f(){let e=()=>{if(!(typeof document>`u`||typeof window>`u`||typeof navigator>`u`)){try{typeof window<`u`&&window.IS_TEST?document.documentElement.setAttribute(`data-os`,`other`):navigator.platform.match(new RegExp(n))===null?navigator.platform.match(RegExp(`Win`))===null?navigator.platform.match(new RegExp(r))!==null&&document.documentElement.setAttribute(`data-os`,`linux`):document.documentElement.setAttribute(`data-os`,`win`):document.documentElement.setAttribute(`data-os`,`mac`)}catch{}document.removeEventListener(`DOMContentLoaded`,e)}};typeof document<`u`&&document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e()}exports.defineNavigator=f,exports.isTouchDevice=d});