Socket
Socket
Sign inDemoInstall

playwright-core

Package Overview
Dependencies
Maintainers
4
Versions
4543
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-core - npm Package Compare versions

Comparing version 1.45.0-alpha-2024-06-05 to 1.45.0-alpha-2024-06-06

lib/vite/traceViewer/assets/codeMirrorModule-ZLOyW3P1.js

2

browsers.json

@@ -30,3 +30,3 @@ {

"name": "webkit",
"revision": "2017",
"revision": "2019",
"installByDefault": true,

@@ -33,0 +33,0 @@ "revisionOverrides": {

@@ -7,2 +7,2 @@ "use strict";

exports.source = void 0;
const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/playwright-core/src/third_party/fake-timers-src.js\nvar require_fake_timers_src = __commonJS({\n \"packages/playwright-core/src/third_party/fake-timers-src.js\"(exports) {\n \"use strict\";\n function withGlobal(_global) {\n const maxTimeout = Math.pow(2, 31) - 1;\n const idCounterStart = 1e12;\n const NOOP = function() {\n return void 0;\n };\n const NOOP_ARRAY = function() {\n return [];\n };\n const timeoutResult = _global.setTimeout(NOOP, 0);\n const addTimerReturnsObject = typeof timeoutResult === \"object\";\n const performancePresent = _global.performance && typeof _global.performance.now === \"function\";\n const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);\n const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;\n const queueMicrotaskPresent = _global.hasOwnProperty(\"queueMicrotask\");\n const requestAnimationFramePresent = _global.requestAnimationFrame && typeof _global.requestAnimationFrame === \"function\";\n const cancelAnimationFramePresent = _global.cancelAnimationFrame && typeof _global.cancelAnimationFrame === \"function\";\n const requestIdleCallbackPresent = _global.requestIdleCallback && typeof _global.requestIdleCallback === \"function\";\n const cancelIdleCallbackPresent = _global.cancelIdleCallback && typeof _global.cancelIdleCallback === \"function\";\n const setImmediatePresent = _global.setImmediate && typeof _global.setImmediate === \"function\";\n const intlPresent = _global.Intl && typeof _global.Intl === \"object\";\n _global.clearTimeout(timeoutResult);\n const NativeDate = _global.Date;\n const NativeIntl = _global.Intl;\n let uniqueTimerId = idCounterStart;\n function isNumberFinite(num) {\n if (Number.isFinite) {\n return Number.isFinite(num);\n }\n return isFinite(num);\n }\n let isNearInfiniteLimit = false;\n function checkIsNearInfiniteLimit(clock, i) {\n if (clock.loopLimit && i === clock.loopLimit - 1) {\n isNearInfiniteLimit = true;\n }\n }\n function resetIsNearInfiniteLimit() {\n isNearInfiniteLimit = false;\n }\n function parseTime(str) {\n if (!str) {\n return 0;\n }\n const strings = str.split(\":\");\n const l = strings.length;\n let i = l;\n let ms = 0;\n let parsed;\n if (l > 3 || !/^(\\d\\d:){0,2}\\d\\d?$/.test(str)) {\n throw new Error(\n \"tick only understands numbers, 'm:s' and 'h:m:s'. Each part must be two digits\"\n );\n }\n while (i--) {\n parsed = parseInt(strings[i], 10);\n if (parsed >= 60) {\n throw new Error(`Invalid time ${str}`);\n }\n ms += parsed * Math.pow(60, l - i - 1);\n }\n return ms * 1e3;\n }\n function nanoRemainder(msFloat) {\n const modulo = 1e6;\n const remainder = msFloat * 1e6 % modulo;\n const positiveRemainder = remainder < 0 ? remainder + modulo : remainder;\n return Math.floor(positiveRemainder);\n }\n function getEpoch(epoch) {\n if (!epoch) {\n return 0;\n }\n if (typeof epoch.getTime === \"function\") {\n return epoch.getTime();\n }\n if (typeof epoch === \"number\") {\n return epoch;\n }\n throw new TypeError(\"now should be milliseconds since UNIX epoch\");\n }\n function inRange(from, to, timer) {\n return timer && timer.callAt >= from && timer.callAt <= to;\n }\n function getInfiniteLoopError(clock, job) {\n const infiniteLoopError = new Error(\n `Aborting after running ${clock.loopLimit} timers, assuming an infinite loop!`\n );\n if (!job.error) {\n return infiniteLoopError;\n }\n const computedTargetPattern = /target\\.*[<|(|[].*?[>|\\]|)]\\s*/;\n let clockMethodPattern = new RegExp(\n String(Object.keys(clock).join(\"|\"))\n );\n if (addTimerReturnsObject) {\n clockMethodPattern = new RegExp(\n `\\\\s+at (Object\\\\.)?(?:${Object.keys(clock).join(\"|\")})\\\\s+`\n );\n }\n let matchedLineIndex = -1;\n job.error.stack.split(\"\\n\").some(function(line, i) {\n const matchedComputedTarget = line.match(computedTargetPattern);\n if (matchedComputedTarget) {\n matchedLineIndex = i;\n return true;\n }\n const matchedClockMethod = line.match(clockMethodPattern);\n if (matchedClockMethod) {\n matchedLineIndex = i;\n return false;\n }\n return matchedLineIndex >= 0;\n });\n const stack = `${infiniteLoopError}\n${job.type || \"Microtask\"} - ${job.func.name || \"anonymous\"}\n${job.error.stack.split(\"\\n\").slice(matchedLineIndex + 1).join(\"\\n\")}`;\n try {\n Object.defineProperty(infiniteLoopError, \"stack\", {\n value: stack\n });\n } catch (e) {\n }\n return infiniteLoopError;\n }\n function mirrorDateProperties(target, source) {\n let prop;\n for (prop in source) {\n if (source.hasOwnProperty(prop)) {\n target[prop] = source[prop];\n }\n }\n if (source.now) {\n target.now = function now() {\n return target.clock.now;\n };\n } else {\n delete target.now;\n }\n if (source.toSource) {\n target.toSource = function toSource() {\n return source.toSource();\n };\n } else {\n delete target.toSource;\n }\n target.toString = function toString() {\n return source.toString();\n };\n target.prototype = source.prototype;\n target.parse = source.parse;\n target.UTC = source.UTC;\n target.prototype.toUTCString = source.prototype.toUTCString;\n target.isFake = true;\n return target;\n }\n function createDate() {\n function ClockDate(year, month, date, hour, minute, second, ms) {\n if (!(this instanceof ClockDate)) {\n return new NativeDate(ClockDate.clock.now).toString();\n }\n switch (arguments.length) {\n case 0:\n return new NativeDate(ClockDate.clock.now);\n case 1:\n return new NativeDate(year);\n case 2:\n return new NativeDate(year, month);\n case 3:\n return new NativeDate(year, month, date);\n case 4:\n return new NativeDate(year, month, date, hour);\n case 5:\n return new NativeDate(year, month, date, hour, minute);\n case 6:\n return new NativeDate(\n year,\n month,\n date,\n hour,\n minute,\n second\n );\n default:\n return new NativeDate(\n year,\n month,\n date,\n hour,\n minute,\n second,\n ms\n );\n }\n }\n return mirrorDateProperties(ClockDate, NativeDate);\n }\n function createIntl() {\n const ClockIntl = {};\n Object.getOwnPropertyNames(NativeIntl).forEach(\n (property) => ClockIntl[property] = NativeIntl[property]\n );\n ClockIntl.DateTimeFormat = function(...args) {\n const realFormatter = new NativeIntl.DateTimeFormat(...args);\n const formatter = {};\n [\"formatRange\", \"formatRangeToParts\", \"resolvedOptions\"].forEach(\n (method) => {\n formatter[method] = realFormatter[method].bind(realFormatter);\n }\n );\n [\"format\", \"formatToParts\"].forEach((method) => {\n formatter[method] = function(date) {\n return realFormatter[method](date || ClockIntl.clock.now);\n };\n });\n return formatter;\n };\n ClockIntl.DateTimeFormat.prototype = Object.create(\n NativeIntl.DateTimeFormat.prototype\n );\n ClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;\n return ClockIntl;\n }\n function enqueueJob(clock, job) {\n if (!clock.jobs) {\n clock.jobs = [];\n }\n clock.jobs.push(job);\n }\n function runJobs(clock) {\n if (!clock.jobs) {\n return;\n }\n for (let i = 0; i < clock.jobs.length; i++) {\n const job = clock.jobs[i];\n job.func.apply(null, job.args);\n checkIsNearInfiniteLimit(clock, i);\n if (clock.loopLimit && i > clock.loopLimit) {\n throw getInfiniteLoopError(clock, job);\n }\n }\n resetIsNearInfiniteLimit();\n clock.jobs = [];\n }\n function addTimer(clock, timer) {\n if (timer.func === void 0) {\n throw new Error(\"Callback must be provided to timer calls\");\n }\n if (addTimerReturnsObject) {\n if (typeof timer.func !== \"function\") {\n throw new TypeError(\n `[ERR_INVALID_CALLBACK]: Callback must be a function. Received ${timer.func} of type ${typeof timer.func}`\n );\n }\n }\n if (isNearInfiniteLimit) {\n timer.error = new Error();\n }\n timer.type = timer.immediate ? \"Immediate\" : \"Timeout\";\n if (timer.hasOwnProperty(\"delay\")) {\n if (typeof timer.delay !== \"number\") {\n timer.delay = parseInt(timer.delay, 10);\n }\n if (!isNumberFinite(timer.delay)) {\n timer.delay = 0;\n }\n timer.delay = timer.delay > maxTimeout ? 1 : timer.delay;\n timer.delay = Math.max(0, timer.delay);\n }\n if (timer.hasOwnProperty(\"interval\")) {\n timer.type = \"Interval\";\n timer.interval = timer.interval > maxTimeout ? 1 : timer.interval;\n }\n if (timer.hasOwnProperty(\"animation\")) {\n timer.type = \"AnimationFrame\";\n timer.animation = true;\n }\n if (timer.hasOwnProperty(\"idleCallback\")) {\n timer.type = \"IdleCallback\";\n timer.idleCallback = true;\n }\n if (!clock.timers) {\n clock.timers = {};\n }\n timer.id = uniqueTimerId++;\n timer.createdAt = clock.now;\n timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));\n clock.timers[timer.id] = timer;\n if (addTimerReturnsObject) {\n const res = {\n refed: true,\n ref: function() {\n this.refed = true;\n return res;\n },\n unref: function() {\n this.refed = false;\n return res;\n },\n hasRef: function() {\n return this.refed;\n },\n refresh: function() {\n timer.callAt = clock.now + (parseInt(timer.delay) || (clock.duringTick ? 1 : 0));\n clock.timers[timer.id] = timer;\n return res;\n },\n [Symbol.toPrimitive]: function() {\n return timer.id;\n }\n };\n return res;\n }\n return timer.id;\n }\n function compareTimers(a, b) {\n if (a.callAt < b.callAt) {\n return -1;\n }\n if (a.callAt > b.callAt) {\n return 1;\n }\n if (a.immediate && !b.immediate) {\n return -1;\n }\n if (!a.immediate && b.immediate) {\n return 1;\n }\n if (a.createdAt < b.createdAt) {\n return -1;\n }\n if (a.createdAt > b.createdAt) {\n return 1;\n }\n if (a.id < b.id) {\n return -1;\n }\n if (a.id > b.id) {\n return 1;\n }\n }\n function firstTimerInRange(clock, from, to) {\n const timers2 = clock.timers;\n let timer = null;\n let id, isInRange;\n for (id in timers2) {\n if (timers2.hasOwnProperty(id)) {\n isInRange = inRange(from, to, timers2[id]);\n if (isInRange && (!timer || compareTimers(timer, timers2[id]) === 1)) {\n timer = timers2[id];\n }\n }\n }\n return timer;\n }\n function firstTimer(clock) {\n const timers2 = clock.timers;\n let timer = null;\n let id;\n for (id in timers2) {\n if (timers2.hasOwnProperty(id)) {\n if (!timer || compareTimers(timer, timers2[id]) === 1) {\n timer = timers2[id];\n }\n }\n }\n return timer;\n }\n function lastTimer(clock) {\n const timers2 = clock.timers;\n let timer = null;\n let id;\n for (id in timers2) {\n if (timers2.hasOwnProperty(id)) {\n if (!timer || compareTimers(timer, timers2[id]) === -1) {\n timer = timers2[id];\n }\n }\n }\n return timer;\n }\n function callTimer(clock, timer) {\n if (typeof timer.interval === \"number\") {\n clock.timers[timer.id].callAt += timer.interval;\n } else {\n delete clock.timers[timer.id];\n }\n if (typeof timer.func === \"function\") {\n timer.func.apply(null, timer.args);\n } else {\n const eval2 = eval;\n (function() {\n eval2(timer.func);\n })();\n }\n }\n function getClearHandler(ttype) {\n if (ttype === \"IdleCallback\" || ttype === \"AnimationFrame\") {\n return `cancel${ttype}`;\n }\n return `clear${ttype}`;\n }\n function getScheduleHandler(ttype) {\n if (ttype === \"IdleCallback\" || ttype === \"AnimationFrame\") {\n return `request${ttype}`;\n }\n return `set${ttype}`;\n }\n function createWarnOnce() {\n let calls = 0;\n return function(msg) {\n !calls++ && console.warn(msg);\n };\n }\n const warnOnce = createWarnOnce();\n function clearTimer(clock, timerId, ttype) {\n if (!timerId) {\n return;\n }\n if (!clock.timers) {\n clock.timers = {};\n }\n const id = Number(timerId);\n if (Number.isNaN(id) || id < idCounterStart) {\n const handlerName = getClearHandler(ttype);\n if (clock.shouldClearNativeTimers === true) {\n const nativeHandler = clock[`_${handlerName}`];\n return typeof nativeHandler === \"function\" ? nativeHandler(timerId) : void 0;\n }\n warnOnce(\n `FakeTimers: ${handlerName} was invoked to clear a native timer instead of one created by this library.\nTo automatically clean-up native timers, use \\`shouldClearNativeTimers\\`.`\n );\n }\n if (clock.timers.hasOwnProperty(id)) {\n const timer = clock.timers[id];\n if (timer.type === ttype || timer.type === \"Timeout\" && ttype === \"Interval\" || timer.type === \"Interval\" && ttype === \"Timeout\") {\n delete clock.timers[id];\n } else {\n const clear = getClearHandler(ttype);\n const schedule = getScheduleHandler(timer.type);\n throw new Error(\n `Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`\n );\n }\n }\n }\n function uninstall(clock, config) {\n let method, i, l;\n const installedHrTime = \"_hrtime\";\n const installedNextTick = \"_nextTick\";\n for (i = 0, l = clock.methods.length; i < l; i++) {\n method = clock.methods[i];\n if (method === \"performance\") {\n const originalPerfDescriptor = Object.getOwnPropertyDescriptor(\n clock,\n `_${method}`\n );\n if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {\n Object.defineProperty(\n _global,\n method,\n originalPerfDescriptor\n );\n } else if (originalPerfDescriptor.configurable) {\n _global[method] = clock[`_${method}`];\n }\n } else {\n if (_global[method] && _global[method].hadOwnProperty) {\n _global[method] = clock[`_${method}`];\n } else {\n try {\n delete _global[method];\n } catch (ignore) {\n }\n }\n }\n }\n if (config.shouldAdvanceTime === true) {\n _global.clearInterval(clock.attachedInterval);\n }\n clock.methods = [];\n if (!clock.timers) {\n return [];\n }\n return Object.keys(clock.timers).map(function mapper(key) {\n return clock.timers[key];\n });\n }\n function hijackMethod(target, method, clock) {\n clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(\n target,\n method\n );\n clock[`_${method}`] = target[method];\n if (method === \"Date\") {\n const date = mirrorDateProperties(clock[method], target[method]);\n target[method] = date;\n } else if (method === \"Intl\") {\n target[method] = clock[method];\n } else if (method === \"performance\") {\n const originalPerfDescriptor = Object.getOwnPropertyDescriptor(\n target,\n method\n );\n if (originalPerfDescriptor && originalPerfDescriptor.get && !originalPerfDescriptor.set) {\n Object.defineProperty(\n clock,\n `_${method}`,\n originalPerfDescriptor\n );\n const perfDescriptor = Object.getOwnPropertyDescriptor(\n clock,\n method\n );\n Object.defineProperty(target, method, perfDescriptor);\n } else {\n target[method] = clock[method];\n }\n } else {\n target[method] = function() {\n return clock[method].apply(clock, arguments);\n };\n Object.defineProperties(\n target[method],\n Object.getOwnPropertyDescriptors(clock[method])\n );\n }\n target[method].clock = clock;\n }\n function doIntervalTick(clock, advanceTimeDelta) {\n clock.tick(advanceTimeDelta);\n }\n const timers = {\n setTimeout: _global.setTimeout,\n clearTimeout: _global.clearTimeout,\n setInterval: _global.setInterval,\n clearInterval: _global.clearInterval,\n Date: _global.Date\n };\n if (setImmediatePresent) {\n timers.setImmediate = _global.setImmediate;\n timers.clearImmediate = _global.clearImmediate;\n }\n if (performancePresent) {\n timers.performance = _global.performance;\n }\n if (requestAnimationFramePresent) {\n timers.requestAnimationFrame = _global.requestAnimationFrame;\n }\n if (queueMicrotaskPresent) {\n timers.queueMicrotask = true;\n }\n if (cancelAnimationFramePresent) {\n timers.cancelAnimationFrame = _global.cancelAnimationFrame;\n }\n if (requestIdleCallbackPresent) {\n timers.requestIdleCallback = _global.requestIdleCallback;\n }\n if (cancelIdleCallbackPresent) {\n timers.cancelIdleCallback = _global.cancelIdleCallback;\n }\n if (intlPresent) {\n timers.Intl = _global.Intl;\n }\n const originalSetTimeout = _global.setImmediate || _global.setTimeout;\n function createClock(start, loopLimit) {\n start = Math.floor(getEpoch(start));\n loopLimit = loopLimit || 1e3;\n let nanos = 0;\n const adjustedSystemTime = [0, 0];\n if (NativeDate === void 0) {\n throw new Error(\n \"The global scope doesn't have a `Date` object (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)\"\n );\n }\n const clock = {\n now: start,\n Date: createDate(),\n loopLimit\n };\n clock.Date.clock = clock;\n function getTimeToNextFrame() {\n return 16 - (clock.now - start) % 16;\n }\n function hrtime(prev) {\n const millisSinceStart = clock.now - adjustedSystemTime[0] - start;\n const secsSinceStart = Math.floor(millisSinceStart / 1e3);\n const remainderInNanos = (millisSinceStart - secsSinceStart * 1e3) * 1e6 + nanos - adjustedSystemTime[1];\n if (Array.isArray(prev)) {\n if (prev[1] > 1e9) {\n throw new TypeError(\n \"Number of nanoseconds can't exceed a billion\"\n );\n }\n const oldSecs = prev[0];\n let nanoDiff = remainderInNanos - prev[1];\n let secDiff = secsSinceStart - oldSecs;\n if (nanoDiff < 0) {\n nanoDiff += 1e9;\n secDiff -= 1;\n }\n return [secDiff, nanoDiff];\n }\n return [secsSinceStart, remainderInNanos];\n }\n function fakePerformanceNow() {\n const hrt = hrtime();\n const millis = hrt[0] * 1e3 + hrt[1] / 1e6;\n return millis;\n }\n if (intlPresent) {\n clock.Intl = createIntl();\n clock.Intl.clock = clock;\n }\n clock.requestIdleCallback = function requestIdleCallback(func, timeout) {\n let timeToNextIdlePeriod = 0;\n if (clock.countTimers() > 0) {\n timeToNextIdlePeriod = 50;\n }\n const result = addTimer(clock, {\n func,\n args: Array.prototype.slice.call(arguments, 2),\n delay: typeof timeout === \"undefined\" ? timeToNextIdlePeriod : Math.min(timeout, timeToNextIdlePeriod),\n idleCallback: true\n });\n return Number(result);\n };\n clock.cancelIdleCallback = function cancelIdleCallback(timerId) {\n return clearTimer(clock, timerId, \"IdleCallback\");\n };\n clock.setTimeout = function setTimeout(func, timeout) {\n return addTimer(clock, {\n func,\n args: Array.prototype.slice.call(arguments, 2),\n delay: timeout\n });\n };\n clock.clearTimeout = function clearTimeout(timerId) {\n return clearTimer(clock, timerId, \"Timeout\");\n };\n clock.nextTick = function nextTick(func) {\n return enqueueJob(clock, {\n func,\n args: Array.prototype.slice.call(arguments, 1),\n error: isNearInfiniteLimit ? new Error() : null\n });\n };\n clock.queueMicrotask = function queueMicrotask(func) {\n return clock.nextTick(func);\n };\n clock.setInterval = function setInterval(func, timeout) {\n timeout = parseInt(timeout, 10);\n return addTimer(clock, {\n func,\n args: Array.prototype.slice.call(arguments, 2),\n delay: timeout,\n interval: timeout\n });\n };\n clock.clearInterval = function clearInterval(timerId) {\n return clearTimer(clock, timerId, \"Interval\");\n };\n if (setImmediatePresent) {\n clock.setImmediate = function setImmediate(func) {\n return addTimer(clock, {\n func,\n args: Array.prototype.slice.call(arguments, 1),\n immediate: true\n });\n };\n clock.clearImmediate = function clearImmediate(timerId) {\n return clearTimer(clock, timerId, \"Immediate\");\n };\n }\n clock.countTimers = function countTimers() {\n return Object.keys(clock.timers || {}).length + (clock.jobs || []).length;\n };\n clock.requestAnimationFrame = function requestAnimationFrame(func) {\n const result = addTimer(clock, {\n func,\n delay: getTimeToNextFrame(),\n get args() {\n return [fakePerformanceNow()];\n },\n animation: true\n });\n return Number(result);\n };\n clock.cancelAnimationFrame = function cancelAnimationFrame(timerId) {\n return clearTimer(clock, timerId, \"AnimationFrame\");\n };\n clock.runMicrotasks = function runMicrotasks() {\n runJobs(clock);\n };\n function doTick(tickValue, isAsync, resolve, reject) {\n const msFloat = typeof tickValue === \"number\" ? tickValue : parseTime(tickValue);\n const ms = Math.floor(msFloat);\n const remainder = nanoRemainder(msFloat);\n let nanosTotal = nanos + remainder;\n let tickTo = clock.now + ms;\n if (msFloat < 0) {\n throw new TypeError(\"Negative ticks are not supported\");\n }\n if (nanosTotal >= 1e6) {\n tickTo += 1;\n nanosTotal -= 1e6;\n }\n nanos = nanosTotal;\n let tickFrom = clock.now;\n let previous = clock.now;\n let timer, firstException, oldNow, nextPromiseTick, compensationCheck, postTimerCall;\n clock.duringTick = true;\n oldNow = clock.now;\n runJobs(clock);\n if (oldNow !== clock.now) {\n tickFrom += clock.now - oldNow;\n tickTo += clock.now - oldNow;\n }\n function doTickInner() {\n timer = firstTimerInRange(clock, tickFrom, tickTo);\n while (timer && tickFrom <= tickTo) {\n if (clock.timers[timer.id]) {\n tickFrom = timer.callAt;\n clock.now = timer.callAt;\n oldNow = clock.now;\n try {\n runJobs(clock);\n callTimer(clock, timer);\n } catch (e) {\n firstException = firstException || e;\n }\n if (isAsync) {\n originalSetTimeout(nextPromiseTick);\n return;\n }\n compensationCheck();\n }\n postTimerCall();\n }\n oldNow = clock.now;\n runJobs(clock);\n if (oldNow !== clock.now) {\n tickFrom += clock.now - oldNow;\n tickTo += clock.now - oldNow;\n }\n clock.duringTick = false;\n timer = firstTimerInRange(clock, tickFrom, tickTo);\n if (timer) {\n try {\n clock.tick(tickTo - clock.now);\n } catch (e) {\n firstException = firstException || e;\n }\n } else {\n clock.now = tickTo;\n nanos = nanosTotal;\n }\n if (firstException) {\n throw firstException;\n }\n if (isAsync) {\n resolve(clock.now);\n } else {\n return clock.now;\n }\n }\n nextPromiseTick = isAsync && function() {\n try {\n compensationCheck();\n postTimerCall();\n doTickInner();\n } catch (e) {\n reject(e);\n }\n };\n compensationCheck = function() {\n if (oldNow !== clock.now) {\n tickFrom += clock.now - oldNow;\n tickTo += clock.now - oldNow;\n previous += clock.now - oldNow;\n }\n };\n postTimerCall = function() {\n timer = firstTimerInRange(clock, previous, tickTo);\n previous = tickFrom;\n };\n return doTickInner();\n }\n clock.tick = function tick(tickValue) {\n return doTick(tickValue, false);\n };\n if (typeof _global.Promise !== \"undefined\") {\n clock.tickAsync = function tickAsync(tickValue) {\n return new _global.Promise(function(resolve, reject) {\n originalSetTimeout(function() {\n try {\n doTick(tickValue, true, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n });\n };\n }\n clock.next = function next() {\n runJobs(clock);\n const timer = firstTimer(clock);\n if (!timer) {\n return clock.now;\n }\n clock.duringTick = true;\n try {\n clock.now = timer.callAt;\n callTimer(clock, timer);\n runJobs(clock);\n return clock.now;\n } finally {\n clock.duringTick = false;\n }\n };\n if (typeof _global.Promise !== \"undefined\") {\n clock.nextAsync = function nextAsync() {\n return new _global.Promise(function(resolve, reject) {\n originalSetTimeout(function() {\n try {\n const timer = firstTimer(clock);\n if (!timer) {\n resolve(clock.now);\n return;\n }\n let err;\n clock.duringTick = true;\n clock.now = timer.callAt;\n try {\n callTimer(clock, timer);\n } catch (e) {\n err = e;\n }\n clock.duringTick = false;\n originalSetTimeout(function() {\n if (err) {\n reject(err);\n } else {\n resolve(clock.now);\n }\n });\n } catch (e) {\n reject(e);\n }\n });\n });\n };\n }\n clock.runAll = function runAll() {\n let numTimers, i;\n runJobs(clock);\n for (i = 0; i < clock.loopLimit; i++) {\n if (!clock.timers) {\n resetIsNearInfiniteLimit();\n return clock.now;\n }\n numTimers = Object.keys(clock.timers).length;\n if (numTimers === 0) {\n resetIsNearInfiniteLimit();\n return clock.now;\n }\n clock.next();\n checkIsNearInfiniteLimit(clock, i);\n }\n const excessJob = firstTimer(clock);\n throw getInfiniteLoopError(clock, excessJob);\n };\n clock.runToFrame = function runToFrame() {\n return clock.tick(getTimeToNextFrame());\n };\n if (typeof _global.Promise !== \"undefined\") {\n clock.runAllAsync = function runAllAsync() {\n return new _global.Promise(function(resolve, reject) {\n let i = 0;\n function doRun() {\n originalSetTimeout(function() {\n try {\n runJobs(clock);\n let numTimers;\n if (i < clock.loopLimit) {\n if (!clock.timers) {\n resetIsNearInfiniteLimit();\n resolve(clock.now);\n return;\n }\n numTimers = Object.keys(\n clock.timers\n ).length;\n if (numTimers === 0) {\n resetIsNearInfiniteLimit();\n resolve(clock.now);\n return;\n }\n clock.next();\n i++;\n doRun();\n checkIsNearInfiniteLimit(clock, i);\n return;\n }\n const excessJob = firstTimer(clock);\n reject(getInfiniteLoopError(clock, excessJob));\n } catch (e) {\n reject(e);\n }\n });\n }\n doRun();\n });\n };\n }\n clock.runToLast = function runToLast() {\n const timer = lastTimer(clock);\n if (!timer) {\n runJobs(clock);\n return clock.now;\n }\n return clock.tick(timer.callAt - clock.now);\n };\n if (typeof _global.Promise !== \"undefined\") {\n clock.runToLastAsync = function runToLastAsync() {\n return new _global.Promise(function(resolve, reject) {\n originalSetTimeout(function() {\n try {\n const timer = lastTimer(clock);\n if (!timer) {\n runJobs(clock);\n resolve(clock.now);\n }\n resolve(clock.tickAsync(timer.callAt - clock.now));\n } catch (e) {\n reject(e);\n }\n });\n });\n };\n }\n clock.reset = function reset() {\n nanos = 0;\n clock.timers = {};\n clock.jobs = [];\n clock.now = start;\n };\n clock.setSystemTime = function setSystemTime(systemTime) {\n const newNow = getEpoch(systemTime);\n const difference = newNow - clock.now;\n let id, timer;\n adjustedSystemTime[0] = adjustedSystemTime[0] + difference;\n adjustedSystemTime[1] = adjustedSystemTime[1] + nanos;\n clock.now = newNow;\n nanos = 0;\n for (id in clock.timers) {\n if (clock.timers.hasOwnProperty(id)) {\n timer = clock.timers[id];\n timer.createdAt += difference;\n timer.callAt += difference;\n }\n }\n };\n clock.jump = function jump(tickValue) {\n const msFloat = typeof tickValue === \"number\" ? tickValue : parseTime(tickValue);\n const ms = Math.floor(msFloat);\n for (const timer of Object.values(clock.timers)) {\n if (clock.now + ms > timer.callAt) {\n timer.callAt = clock.now + ms;\n }\n }\n clock.tick(ms);\n };\n if (performancePresent) {\n clock.performance = /* @__PURE__ */ Object.create(null);\n clock.performance.now = fakePerformanceNow;\n }\n return clock;\n }\n function install(config) {\n console.log(\"INSTALL\", config);\n if (arguments.length > 1 || config instanceof Date || Array.isArray(config) || typeof config === \"number\") {\n throw new TypeError(\n `FakeTimers.install called with ${String(\n config\n )} install requires an object parameter`\n );\n }\n if (_global.Date.isFake === true) {\n throw new TypeError(\n \"Can't install fake timers twice on the same global object.\"\n );\n }\n config = typeof config !== \"undefined\" ? config : {};\n config.shouldAdvanceTime = config.shouldAdvanceTime || false;\n config.advanceTimeDelta = config.advanceTimeDelta || 20;\n config.shouldClearNativeTimers = config.shouldClearNativeTimers || false;\n if (config.target) {\n throw new TypeError(\n \"config.target is no longer supported. Use `withGlobal(target)` instead.\"\n );\n }\n let i, l;\n const clock = createClock(config.now, config.loopLimit);\n clock.shouldClearNativeTimers = config.shouldClearNativeTimers;\n clock.uninstall = function() {\n return uninstall(clock, config);\n };\n clock.methods = config.toFake || [];\n if (clock.methods.length === 0) {\n clock.methods = Object.keys(timers).filter(function(key) {\n return key !== \"nextTick\" && key !== \"queueMicrotask\";\n });\n }\n if (config.shouldAdvanceTime === true) {\n const intervalTick = doIntervalTick.bind(\n null,\n clock,\n config.advanceTimeDelta\n );\n const intervalId = _global.setInterval(\n intervalTick,\n config.advanceTimeDelta\n );\n clock.attachedInterval = intervalId;\n }\n if (clock.methods.includes(\"performance\")) {\n const proto = (() => {\n if (hasPerformanceConstructorPrototype) {\n return _global.performance.constructor.prototype;\n }\n if (hasPerformancePrototype) {\n return _global.Performance.prototype;\n }\n })();\n if (proto) {\n Object.getOwnPropertyNames(proto).forEach(function(name) {\n if (name !== \"now\") {\n clock.performance[name] = name.indexOf(\"getEntries\") === 0 ? NOOP_ARRAY : NOOP;\n }\n });\n } else if ((config.toFake || []).includes(\"performance\")) {\n throw new ReferenceError(\n \"non-existent performance object cannot be faked\"\n );\n }\n }\n for (i = 0, l = clock.methods.length; i < l; i++) {\n const nameOfMethodToReplace = clock.methods[i];\n hijackMethod(_global, nameOfMethodToReplace, clock);\n }\n return clock;\n }\n return {\n timers,\n createClock,\n install,\n withGlobal\n };\n }\n var defaultImplementation = withGlobal(globalThis);\n exports.install = defaultImplementation.install;\n }\n});\n\n// packages/playwright-core/src/server/injected/fakeTimers.ts\nvar fakeTimers_exports = {};\n__export(fakeTimers_exports, {\n inject: () => inject\n});\nmodule.exports = __toCommonJS(fakeTimers_exports);\nvar import_fake_timers_src = __toESM(require_fake_timers_src());\nfunction inject() {\n var _a, _b;\n const window = globalThis;\n const builtin = {\n setTimeout: window.setTimeout.bind(window),\n clearTimeout: window.clearTimeout.bind(window),\n setInterval: window.setInterval.bind(window),\n clearInterval: window.clearInterval.bind(window),\n requestAnimationFrame: window.requestAnimationFrame.bind(window),\n cancelAnimationFrame: window.cancelAnimationFrame.bind(window),\n requestIdleCallback: (_a = window.requestIdleCallback) == null ? void 0 : _a.bind(window),\n cancelIdleCallback: (_b = window.cancelIdleCallback) == null ? void 0 : _b.bind(window),\n performance: window.performance,\n Intl: window.Intl,\n Date: window.Date\n };\n const result = import_fake_timers_src.default;\n result.builtin = builtin;\n return result;\n}\n";
const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/playwright-core/src/server/injected/fakeTimers.ts\nvar fakeTimers_exports = {};\n__export(fakeTimers_exports, {\n createClock: () => createClock,\n inject: () => inject,\n install: () => install\n});\nmodule.exports = __toCommonJS(fakeTimers_exports);\nvar TimerType = /* @__PURE__ */ ((TimerType2) => {\n TimerType2[\"Timeout\"] = \"Timeout\";\n TimerType2[\"Interval\"] = \"Interval\";\n TimerType2[\"Immediate\"] = \"Immediate\";\n TimerType2[\"AnimationFrame\"] = \"AnimationFrame\";\n TimerType2[\"IdleCallback\"] = \"IdleCallback\";\n return TimerType2;\n})(TimerType || {});\nvar Clock = class {\n constructor(embedder, startDate, loopLimit = 1e3) {\n this._jobs = [];\n this._adjustedSystemTime = 0;\n this._duringTick = false;\n this._timers = /* @__PURE__ */ new Map();\n this._isNearInfiniteLimit = false;\n this._uniqueTimerId = idCounterStart;\n this.disposables = [];\n const start = Math.floor(getEpoch(startDate));\n this.start = start;\n this._now = start;\n this._embedder = embedder;\n this._loopLimit = loopLimit;\n }\n uninstall() {\n this.disposables.forEach((dispose) => dispose());\n this.disposables.length = 0;\n }\n now() {\n return this._now;\n }\n performanceNow() {\n const millisSinceStart = this._now - this._adjustedSystemTime - this.start;\n const secsSinceStart = Math.floor(millisSinceStart / 1e3);\n const millis = secsSinceStart * 1e3;\n return millis;\n }\n _doTick(tickValue, isAsync, resolve, reject) {\n const msFloat = typeof tickValue === \"number\" ? tickValue : parseTime(tickValue);\n const ms = Math.floor(msFloat);\n let tickTo = this._now + ms;\n if (msFloat < 0)\n throw new TypeError(\"Negative ticks are not supported\");\n let tickFrom = this._now;\n let previous = this._now;\n let timer;\n let firstException;\n let oldNow;\n let nextPromiseTick;\n let compensationCheck;\n let postTimerCall;\n this._duringTick = true;\n oldNow = this._now;\n this._runJobs();\n if (oldNow !== this._now) {\n tickFrom += this._now - oldNow;\n tickTo += this._now - oldNow;\n }\n const doTickInner = () => {\n timer = this._firstTimerInRange(tickFrom, tickTo);\n while (timer && tickFrom <= tickTo) {\n if (this._timers.has(timer.id)) {\n tickFrom = timer.callAt;\n this._now = timer.callAt;\n oldNow = this._now;\n try {\n this._runJobs();\n this._callTimer(timer);\n } catch (e) {\n firstException = firstException || e;\n }\n if (isAsync) {\n this._embedder.postTask(nextPromiseTick);\n return;\n }\n compensationCheck();\n }\n postTimerCall();\n }\n oldNow = this._now;\n this._runJobs();\n if (oldNow !== this._now) {\n tickFrom += this._now - oldNow;\n tickTo += this._now - oldNow;\n }\n this._duringTick = false;\n timer = this._firstTimerInRange(tickFrom, tickTo);\n if (timer) {\n try {\n this.tick(tickTo - this._now);\n } catch (e) {\n firstException = firstException || e;\n }\n } else {\n this._now = tickTo;\n }\n if (firstException)\n throw firstException;\n if (isAsync)\n resolve(this._now);\n else\n return this._now;\n };\n nextPromiseTick = isAsync ? () => {\n try {\n compensationCheck();\n postTimerCall();\n doTickInner();\n } catch (e) {\n reject(e);\n }\n } : null;\n compensationCheck = () => {\n if (oldNow !== this._now) {\n tickFrom += this._now - oldNow;\n tickTo += this._now - oldNow;\n previous += this._now - oldNow;\n }\n };\n postTimerCall = () => {\n timer = this._firstTimerInRange(previous, tickTo);\n previous = tickFrom;\n };\n return doTickInner();\n }\n tick(tickValue) {\n return this._doTick(tickValue, false);\n }\n tickAsync(tickValue) {\n return new Promise((resolve, reject) => {\n this._embedder.postTask(() => {\n try {\n this._doTick(tickValue, true, resolve, reject);\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n next() {\n this._runJobs();\n const timer = this._firstTimer();\n if (!timer)\n return this._now;\n this._duringTick = true;\n try {\n this._now = timer.callAt;\n this._callTimer(timer);\n this._runJobs();\n return this._now;\n } finally {\n this._duringTick = false;\n }\n }\n nextAsync() {\n return new Promise((resolve, reject) => {\n this._embedder.postTask(() => {\n try {\n const timer = this._firstTimer();\n if (!timer) {\n resolve(this._now);\n return;\n }\n let err;\n this._duringTick = true;\n this._now = timer.callAt;\n try {\n this._callTimer(timer);\n } catch (e) {\n err = e;\n }\n this._duringTick = false;\n this._embedder.postTask(() => {\n if (err)\n reject(err);\n else\n resolve(this._now);\n });\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n runAll() {\n this._runJobs();\n for (let i = 0; i < this._loopLimit; i++) {\n const numTimers = this._timers.size;\n if (numTimers === 0) {\n this._resetIsNearInfiniteLimit();\n return this._now;\n }\n this.next();\n this._checkIsNearInfiniteLimit(i);\n }\n const excessJob = this._firstTimer();\n throw this._getInfiniteLoopError(excessJob);\n }\n runToFrame() {\n return this.tick(this.getTimeToNextFrame());\n }\n runAllAsync() {\n return new Promise((resolve, reject) => {\n let i = 0;\n const doRun = () => {\n this._embedder.postTask(() => {\n try {\n this._runJobs();\n let numTimers;\n if (i < this._loopLimit) {\n if (!this._timers) {\n this._resetIsNearInfiniteLimit();\n resolve(this._now);\n return;\n }\n numTimers = this._timers.size;\n if (numTimers === 0) {\n this._resetIsNearInfiniteLimit();\n resolve(this._now);\n return;\n }\n this.next();\n i++;\n doRun();\n this._checkIsNearInfiniteLimit(i);\n return;\n }\n const excessJob = this._firstTimer();\n reject(this._getInfiniteLoopError(excessJob));\n } catch (e) {\n reject(e);\n }\n });\n };\n doRun();\n });\n }\n runToLast() {\n const timer = this._lastTimer();\n if (!timer) {\n this._runJobs();\n return this._now;\n }\n return this.tick(timer.callAt - this._now);\n }\n runToLastAsync() {\n return new Promise((resolve, reject) => {\n this._embedder.postTask(() => {\n try {\n const timer = this._lastTimer();\n if (!timer) {\n this._runJobs();\n resolve(this._now);\n return;\n }\n this.tickAsync(timer.callAt - this._now).then(resolve);\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n reset() {\n this._timers.clear();\n this._jobs = [];\n this._now = this.start;\n }\n setSystemTime(systemTime) {\n const newNow = getEpoch(systemTime);\n const difference = newNow - this._now;\n this._adjustedSystemTime = this._adjustedSystemTime + difference;\n this._now = newNow;\n for (const timer of this._timers.values()) {\n timer.createdAt += difference;\n timer.callAt += difference;\n }\n }\n jump(tickValue) {\n const msFloat = typeof tickValue === \"number\" ? tickValue : parseTime(tickValue);\n const ms = Math.floor(msFloat);\n for (const timer of this._timers.values()) {\n if (this._now + ms > timer.callAt)\n timer.callAt = this._now + ms;\n }\n return this.tick(ms);\n }\n _checkIsNearInfiniteLimit(i) {\n if (this._loopLimit && i === this._loopLimit - 1)\n this._isNearInfiniteLimit = true;\n }\n _resetIsNearInfiniteLimit() {\n this._isNearInfiniteLimit = false;\n }\n _runJobs() {\n if (!this._jobs)\n return;\n for (let i = 0; i < this._jobs.length; i++) {\n const job = this._jobs[i];\n callFunction(job.func, job.args);\n this._checkIsNearInfiniteLimit(i);\n if (this._loopLimit && i > this._loopLimit)\n throw this._getInfiniteLoopError(job);\n }\n this._resetIsNearInfiniteLimit();\n this._jobs = [];\n }\n addTimer(options) {\n if (options.func === void 0)\n throw new Error(\"Callback must be provided to timer calls\");\n let delay = options.delay ? +options.delay : 0;\n if (!Number.isFinite(delay))\n delay = 0;\n delay = delay > maxTimeout ? 1 : delay;\n delay = Math.max(0, delay);\n const timer = {\n type: options.type,\n func: options.func,\n args: options.args || [],\n delay,\n callAt: this._now + (delay || (this._duringTick ? 1 : 0)),\n createdAt: this._now,\n id: this._uniqueTimerId++,\n error: this._isNearInfiniteLimit ? new Error() : void 0\n };\n this._timers.set(timer.id, timer);\n return timer.id;\n }\n _firstTimerInRange(from, to) {\n let firstTimer = null;\n for (const timer of this._timers.values()) {\n const isInRange = inRange(from, to, timer);\n if (isInRange && (!firstTimer || compareTimers(firstTimer, timer) === 1))\n firstTimer = timer;\n }\n return firstTimer;\n }\n countTimers() {\n return this._timers.size + this._jobs.length;\n }\n _firstTimer() {\n let firstTimer = null;\n for (const timer of this._timers.values()) {\n if (!firstTimer || compareTimers(firstTimer, timer) === 1)\n firstTimer = timer;\n }\n return firstTimer;\n }\n _lastTimer() {\n let lastTimer = null;\n for (const timer of this._timers.values()) {\n if (!lastTimer || compareTimers(lastTimer, timer) === -1)\n lastTimer = timer;\n }\n return lastTimer;\n }\n _callTimer(timer) {\n if (timer.type === \"Interval\" /* Interval */)\n this._timers.get(timer.id).callAt += timer.delay;\n else\n this._timers.delete(timer.id);\n callFunction(timer.func, timer.args);\n }\n _getInfiniteLoopError(job) {\n const infiniteLoopError = new Error(\n `Aborting after running ${this._loopLimit} timers, assuming an infinite loop!`\n );\n if (!job.error)\n return infiniteLoopError;\n const computedTargetPattern = /target\\.*[<|(|[].*?[>|\\]|)]\\s*/;\n const clockMethodPattern = new RegExp(\n String(Object.keys(this).join(\"|\"))\n );\n let matchedLineIndex = -1;\n job.error.stack.split(\"\\n\").some((line, i) => {\n const matchedComputedTarget = line.match(computedTargetPattern);\n if (matchedComputedTarget) {\n matchedLineIndex = i;\n return true;\n }\n const matchedClockMethod = line.match(clockMethodPattern);\n if (matchedClockMethod) {\n matchedLineIndex = i;\n return false;\n }\n return matchedLineIndex >= 0;\n });\n const funcName = typeof job.func === \"function\" ? job.func.name : \"anonymous\";\n const stack = `${infiniteLoopError}\n${job.type || \"Microtask\"} - ${funcName}\n${job.error.stack.split(\"\\n\").slice(matchedLineIndex + 1).join(\"\\n\")}`;\n try {\n Object.defineProperty(infiniteLoopError, \"stack\", {\n value: stack\n });\n } catch (e) {\n }\n return infiniteLoopError;\n }\n getTimeToNextFrame() {\n return 16 - (this._now - this.start) % 16;\n }\n clearTimer(timerId, type) {\n if (!timerId) {\n return;\n }\n const id = Number(timerId);\n if (Number.isNaN(id) || id < idCounterStart) {\n const handlerName = getClearHandler(type);\n new Error(`Clock: ${handlerName} was invoked to clear a native timer instead of one created by the clock library.`);\n }\n const timer = this._timers.get(id);\n if (timer) {\n if (timer.type === type || timer.type === \"Timeout\" && type === \"Interval\" || timer.type === \"Interval\" && type === \"Timeout\") {\n this._timers.delete(id);\n } else {\n const clear = getClearHandler(type);\n const schedule = getScheduleHandler(timer.type);\n throw new Error(\n `Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`\n );\n }\n }\n }\n advanceAutomatically(advanceTimeDelta = 20) {\n return this._embedder.postTaskPeriodically(\n () => this.tick(advanceTimeDelta),\n advanceTimeDelta\n );\n }\n};\nfunction getEpoch(epoch) {\n if (!epoch)\n return 0;\n if (typeof epoch !== \"number\")\n return epoch.getTime();\n return epoch;\n}\nfunction inRange(from, to, timer) {\n return timer && timer.callAt >= from && timer.callAt <= to;\n}\nfunction parseTime(str) {\n if (!str)\n return 0;\n const strings = str.split(\":\");\n const l = strings.length;\n let i = l;\n let ms = 0;\n let parsed;\n if (l > 3 || !/^(\\d\\d:){0,2}\\d\\d?$/.test(str)) {\n throw new Error(\n `Clock only understands numbers, 'mm:ss' and 'hh:mm:ss'`\n );\n }\n while (i--) {\n parsed = parseInt(strings[i], 10);\n if (parsed >= 60)\n throw new Error(`Invalid time ${str}`);\n ms += parsed * Math.pow(60, l - i - 1);\n }\n return ms * 1e3;\n}\nfunction mirrorDateProperties(target, source) {\n let prop;\n for (prop of Object.keys(source))\n target[prop] = source[prop];\n target.toString = () => source.toString();\n target.prototype = source.prototype;\n target.parse = source.parse;\n target.UTC = source.UTC;\n target.prototype.toUTCString = source.prototype.toUTCString;\n target.isFake = true;\n return target;\n}\nfunction createDate(clock, NativeDate) {\n function ClockDate(year, month, date, hour, minute, second, ms) {\n if (!(this instanceof ClockDate))\n return new NativeDate(clock.now()).toString();\n switch (arguments.length) {\n case 0:\n return new NativeDate(clock.now());\n case 1:\n return new NativeDate(year);\n case 2:\n return new NativeDate(year, month);\n case 3:\n return new NativeDate(year, month, date);\n case 4:\n return new NativeDate(year, month, date, hour);\n case 5:\n return new NativeDate(year, month, date, hour, minute);\n case 6:\n return new NativeDate(\n year,\n month,\n date,\n hour,\n minute,\n second\n );\n default:\n return new NativeDate(\n year,\n month,\n date,\n hour,\n minute,\n second,\n ms\n );\n }\n }\n ClockDate.now = () => clock.now();\n return mirrorDateProperties(ClockDate, NativeDate);\n}\nfunction createIntl(clock, NativeIntl) {\n const ClockIntl = {};\n for (const key of Object.keys(NativeIntl))\n ClockIntl[key] = NativeIntl[key];\n ClockIntl.DateTimeFormat = (...args2) => {\n const realFormatter = new NativeIntl.DateTimeFormat(...args2);\n const formatter = {\n formatRange: realFormatter.formatRange.bind(realFormatter),\n formatRangeToParts: realFormatter.formatRangeToParts.bind(realFormatter),\n resolvedOptions: realFormatter.resolvedOptions.bind(realFormatter),\n format: (date) => realFormatter.format(date || clock.now()),\n formatToParts: (date) => realFormatter.formatToParts(date || clock.now())\n };\n return formatter;\n };\n ClockIntl.DateTimeFormat.prototype = Object.create(\n NativeIntl.DateTimeFormat.prototype\n );\n ClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;\n return ClockIntl;\n}\nfunction compareTimers(a, b) {\n if (a.callAt < b.callAt)\n return -1;\n if (a.callAt > b.callAt)\n return 1;\n if (a.type === \"Immediate\" /* Immediate */ && b.type !== \"Immediate\" /* Immediate */)\n return -1;\n if (a.type !== \"Immediate\" /* Immediate */ && b.type === \"Immediate\" /* Immediate */)\n return 1;\n if (a.createdAt < b.createdAt)\n return -1;\n if (a.createdAt > b.createdAt)\n return 1;\n if (a.id < b.id)\n return -1;\n if (a.id > b.id)\n return 1;\n}\nfunction callFunction(func, args) {\n if (typeof func === \"function\")\n func.apply(null, args);\n else\n (() => {\n eval(func);\n })();\n}\nvar maxTimeout = Math.pow(2, 31) - 1;\nvar idCounterStart = 1e12;\nfunction platformOriginals(globalObject) {\n return {\n setTimeout: globalObject.setTimeout.bind(globalObject),\n clearTimeout: globalObject.clearTimeout.bind(globalObject),\n setInterval: globalObject.setInterval.bind(globalObject),\n clearInterval: globalObject.clearInterval.bind(globalObject),\n requestAnimationFrame: globalObject.requestAnimationFrame ? globalObject.requestAnimationFrame.bind(globalObject) : void 0,\n cancelAnimationFrame: globalObject.cancelAnimationFrame ? globalObject.cancelAnimationFrame.bind(globalObject) : void 0,\n requestIdleCallback: globalObject.requestIdleCallback ? globalObject.requestIdleCallback.bind(globalObject) : void 0,\n cancelIdleCallback: globalObject.cancelIdleCallback ? globalObject.cancelIdleCallback.bind(globalObject) : void 0,\n Date: globalObject.Date,\n performance: globalObject.performance,\n Intl: globalObject.Intl\n };\n}\nfunction getScheduleHandler(type) {\n if (type === \"IdleCallback\" || type === \"AnimationFrame\")\n return `request${type}`;\n return `set${type}`;\n}\nfunction createApi(clock, originals) {\n return {\n setTimeout: (func2, timeout, ...args2) => {\n const delay = timeout ? +timeout : timeout;\n return clock.addTimer({\n type: \"Timeout\" /* Timeout */,\n func: func2,\n args: args2,\n delay\n });\n },\n clearTimeout: (timerId) => {\n if (timerId)\n clock.clearTimer(timerId, \"Timeout\" /* Timeout */);\n },\n setInterval: (func2, timeout, ...args2) => {\n const delay = timeout ? +timeout : timeout;\n return clock.addTimer({\n type: \"Interval\" /* Interval */,\n func: func2,\n args: args2,\n delay\n });\n },\n clearInterval: (timerId) => {\n if (timerId)\n return clock.clearTimer(timerId, \"Interval\" /* Interval */);\n },\n requestAnimationFrame: (callback) => {\n return clock.addTimer({\n type: \"AnimationFrame\" /* AnimationFrame */,\n func: callback,\n delay: clock.getTimeToNextFrame(),\n get args() {\n return [clock.performanceNow()];\n }\n });\n },\n cancelAnimationFrame: (timerId) => {\n if (timerId)\n return clock.clearTimer(timerId, \"AnimationFrame\" /* AnimationFrame */);\n },\n requestIdleCallback: (callback, options) => {\n let timeToNextIdlePeriod = 0;\n if (clock.countTimers() > 0)\n timeToNextIdlePeriod = 50;\n return clock.addTimer({\n type: \"IdleCallback\" /* IdleCallback */,\n func: callback,\n args: [],\n delay: (options == null ? void 0 : options.timeout) ? Math.min(options == null ? void 0 : options.timeout, timeToNextIdlePeriod) : timeToNextIdlePeriod\n });\n },\n cancelIdleCallback: (timerId) => {\n if (timerId)\n return clock.clearTimer(timerId, \"IdleCallback\" /* IdleCallback */);\n },\n Intl: originals.Intl ? createIntl(clock, originals.Intl) : void 0,\n Date: createDate(clock, originals.Date),\n performance: originals.performance ? fakePerformance(clock, originals.performance) : void 0\n };\n}\nfunction getClearHandler(type) {\n if (type === \"IdleCallback\" || type === \"AnimationFrame\")\n return `cancel${type}`;\n return `clear${type}`;\n}\nfunction fakePerformance(clock, performance) {\n const result = {\n now: () => clock.performanceNow(),\n timeOrigin: clock.start,\n __proto__: performance\n };\n return result;\n}\nfunction createClock(globalObject, config = {}) {\n const originals = platformOriginals(globalObject);\n const embedder = {\n postTask: (task) => {\n originals.setTimeout(task, 0);\n },\n postTaskPeriodically: (task, delay) => {\n const intervalId = globalObject.setInterval(task, delay);\n return () => originals.clearInterval(intervalId);\n }\n };\n const clock = new Clock(embedder, config.now, config.loopLimit);\n const api = createApi(clock, originals);\n return { clock, api, originals };\n}\nfunction install(globalObject, config = {}) {\n var _a, _b;\n if ((_a = globalObject.Date) == null ? void 0 : _a.isFake) {\n throw new TypeError(`Can't install fake timers twice on the same global object.`);\n }\n const { clock, api, originals } = createClock(globalObject, config);\n const toFake = ((_b = config.toFake) == null ? void 0 : _b.length) ? config.toFake : Object.keys(originals);\n for (const method of toFake) {\n if (method === \"Date\") {\n globalObject.Date = mirrorDateProperties(api.Date, globalObject.Date);\n } else if (method === \"Intl\") {\n globalObject.Intl = api[method];\n } else if (method === \"performance\") {\n globalObject.performance = api[method];\n } else {\n globalObject[method] = (...args2) => {\n return api[method].apply(api, args2);\n };\n }\n clock.disposables.push(() => {\n globalObject[method] = originals[method];\n });\n }\n return { clock, api, originals };\n}\nfunction inject(globalObject) {\n return {\n install: (config) => {\n const { clock } = install(globalObject, config);\n return clock;\n },\n builtin: platformOriginals(globalObject)\n };\n}\n";

@@ -100,3 +100,3 @@ "use strict";

${fakeTimersSource.source}
globalThis.__pwFakeTimers = (module.exports.inject())();
globalThis.__pwFakeTimers = (module.exports.inject())(globalThis);
})();`;

@@ -103,0 +103,0 @@ await this._addAndEvaluate(script);

{
"name": "playwright-core",
"version": "1.45.0-alpha-2024-06-05",
"version": "1.45.0-alpha-2024-06-06",
"description": "A high-level API to automate web browsers",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc