'use strict';
import { expect } from 'playwright/test';
import { metaErrorMessages } from '../../level2/meta/constants/meta-error-messages-constants.js';
import { ignoredConsoleErrors } from '../constants/ui-tester/ignored-console-errors.js';

var __defProp=Object['defineProperty'],__name=(_0x33c173,_0xbb1f9)=>__defProp(_0x33c173,'name',{'value':_0xbb1f9,'configurable':!![]});const pageErrorEvent='pageerror',pageConsoleEvent='console';function setupErrorTracking(_0x3ee802,_0x832a11=ignoredConsoleErrors){const _0x2d6b6a=[],_0x5c3a0c=__name((_0x3a5f2f,_0x48b971='')=>{return _0x832a11['some'](_0x5ac5bc=>{if(_0x5ac5bc instanceof RegExp)return _0x5ac5bc['test'](_0x3a5f2f)||_0x5ac5bc['test'](_0x48b971);return _0x3a5f2f['includes'](_0x5ac5bc)||_0x48b971['includes'](_0x5ac5bc);});},'isErrorIgnored');return _0x3ee802['on'](pageErrorEvent,_0x474734=>{!_0x5c3a0c(_0x474734['message'])&&_0x2d6b6a['push'](_0x474734['message']);}),_0x3ee802['on'](pageConsoleEvent,_0x3074c4=>{if(_0x3074c4['type']()===metaErrorMessages['consoleErrorMessageType']){const _0x1febbf=_0x3074c4['text'](),_0x543f07=_0x3074c4['location']()['url'];!_0x5c3a0c(_0x1febbf,_0x543f07)&&_0x2d6b6a['push'](_0x1febbf+'\x20('+_0x543f07+')');}}),{'checkErrors':__name(()=>{expect(_0x2d6b6a)['toHaveLength'](0x10cd*0x1+0x1a1a+-0xe4d*0x3);},'checkErrors')};}__name(setupErrorTracking,'setupErrorTracking');

export { setupErrorTracking };
