import { window } from './facade/browser'; import { currentBsVersion } from './theme-provider'; export class Utils { // eslint-disable-next-line @typescript-eslint/no-explicit-any static reflow(element: any): void { // eslint-disable-next-line @typescript-eslint/no-explicit-any ((bs: any): void => bs)(element.offsetHeight); } // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js // eslint-disable-next-line @typescript-eslint/no-explicit-any static getStyles(elem: any): any { // Support: IE <=11 only, Firefox <=30 (#15098, #14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" let view = elem.ownerDocument.defaultView; if (!view || !view.opener) { view = window; } return view.getComputedStyle(elem); } static stackOverflowConfig(): { crossorigin?: string, integrity?: string, cdnLink: string } { const bsVer = currentBsVersion(); return { crossorigin: "anonymous", integrity: bsVer === 'bs5' ? 'sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65' : 'sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2', cdnLink: bsVer === 'bs5' ? 'https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css' : 'https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css', }; } }